Comments (3)
I'm afraid Kotlin languague is not flexible enough. While you can inherit from a function type, you can't inherit from a function with a receiver type. If you have an idea how could this be implemented please share, but I can't think of any possibility.
from kvision.
😬 How do you feel about code generation?
This works:
class App : Application() {
override fun start() {
root("kvapp") {
div("Hello world")
h2("my heading") {
color = Color.name(BLUE)
}
myComponent()
}
}
}
fun Root.myComponent() {
add(MyComponent())
}
It could be possible to generate those extension functions to Root (or Widget) based on an annotation in components. So, I could have:
@Component
class MyComponent: Div() {
init {
h2("goodbye world")
}
}
A gradle task could scan for @component, and automatically create a bunch of extension functions that could be used in dsl. I think this would improve the readability of client code quite a bit.
from kvision.
That's a nice idea :-) I'll think about it.
from kvision.
Related Issues (20)
- Kvision Gradle Plugin issue HOT 3
- Row Menu with Tabulator? HOT 9
- SplitPanel modifies style attribute on unrelated div in DOM HOT 1
- TomSelect selectSize Option HOT 2
- Static resources missing after running gradle script for deployment. HOT 2
- Request - add Widget level drag & drop HOT 2
- Request - documentation/showcase-demos for using Kotlin-ringui and Kotlin-mui HOT 3
- Task :jsProcessResources FAILED HOT 1
- Request - generate README.md from intellij plugin
- SimplePanel.add - Uncaught TypeError: Cannot read properties of undefined HOT 2
- Cannot read properties of null (reading 'x') HOT 13
- Error Deploying to Heroku - no main manifest attribute, in build/libs/uat-1.0.0-SNAPSHOT.jar HOT 8
- ResizeObserver loop completed with undelivered notifications. HOT 2
- Fetching and displaying data with Popover in Tabulator HOT 2
- request url of KVService is using related path instead of absolute path HOT 2
- Tabulator vertical scrolling issue HOT 7
- Initial value for DateTime control HOT 1
- Request - support for crossorigin attribute in Image (and others) HOT 1
- Ability to intercept image load errors HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kvision.