Conversation
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
vale
docs/docs/integrations/kotlin-dsl/overview.md|45 col 5| [Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
docs/docs/integrations/kotlin-dsl/overview.md|47 col 9| [Google.Colons] ': A' should be in lowercase.
docs/docs/integrations/kotlin-dsl/overview.md|47 col 113| [Google.Colons] ': M' should be in lowercase.
docs/docs/integrations/kotlin-dsl/overview.md|50 col 88| [Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
docs/docs/integrations/kotlin-dsl/overview.md|50 col 172| [Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
docs/docs/integrations/kotlin-dsl/overview.md|55 col 38| [Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
docs/docs/integrations/kotlin-dsl/overview.md|59 col 4| [Google.Headings] 'Kotlin for Java developers' should use sentence-style capitalization.
docs/docs/integrations/kotlin-dsl/overview.md|62 col 72| [Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
docs/docs/integrations/kotlin-dsl/overview.md|101 col 5| [Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
docs/docs/integrations/kotlin-dsl/overview.md|118 col 43| [Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
| @@ -0,0 +1,214 @@ | |||
| --- | |||
| title: Extending the DSL | |||
There was a problem hiding this comment.
📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
| sidebar_position: 20 | ||
| --- | ||
|
|
||
| The Kotlin DSL is extensible, allowing the addition of DSL functions for custom components or third-party libraries. You can build composite components that use the DSL internally. |
There was a problem hiding this comment.
📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
| sidebar_position: 20 | ||
| --- | ||
|
|
||
| The Kotlin DSL is extensible, allowing the addition of DSL functions for custom components or third-party libraries. You can build composite components that use the DSL internally. |
There was a problem hiding this comment.
📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
| sidebar_position: 20 | ||
| --- | ||
|
|
||
| The Kotlin DSL is extensible, allowing the addition of DSL functions for custom components or third-party libraries. You can build composite components that use the DSL internally. |
There was a problem hiding this comment.
📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
|
|
||
| The Kotlin DSL is extensible, allowing the addition of DSL functions for custom components or third-party libraries. You can build composite components that use the DSL internally. | ||
|
|
||
| ## Adding components to the DSL {#adding-components-to-the-dsl} |
There was a problem hiding this comment.
📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
|
|
||
| ## Common parameters {#common-parameters} | ||
|
|
||
| You've seen configuration blocks used throughout these examples. Most DSL functions also accept common parameters before the block for frequently-used options: |
There was a problem hiding this comment.
📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
|
|
||
| ## Common parameters {#common-parameters} | ||
|
|
||
| You've seen configuration blocks used throughout these examples. Most DSL functions also accept common parameters before the block for frequently-used options: |
There was a problem hiding this comment.
🚫 [vale] reported by reviewdog 🐶
[Google.LyHyphens] 'frequently-used' doesn't need a hyphen.
| } | ||
| ``` | ||
|
|
||
| The DSL keeps the UI structure readable while giving you full access to component configuration. |
There was a problem hiding this comment.
📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
| @@ -0,0 +1,138 @@ | |||
| --- | |||
| title: Kotlin DSL | |||
There was a problem hiding this comment.
📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
| `}</style> | ||
| </Head> | ||
|
|
||
| webforJ provides a Kotlin *Domain Specific Language*, or DSL, that lets you build UIs with concise, type-safe syntax. Instead of imperative Java code, you write declarative code that reads like a description *of your UI structure. |
There was a problem hiding this comment.
📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
| } | ||
| } | ||
| ``` | ||
| :::important Using the `Break` component |
There was a problem hiding this comment.
We recently had to change the names for the header and footer DSL methods to nativeHeader and nativeFooter to avoid conflicts with header and footer slots of other components. This should be mentioned here too.
|
|
||
| ```kotlin | ||
| button("Primary Action") { | ||
| addClassName("btn-primary") |
There was a problem hiding this comment.
Here the HasClassName extension can be used, that allows to add class names via + or +=.
| addClassName("btn-primary") | |
| classNames += "btn-primary" |
|
|
||
| ```kotlin | ||
| // Text parameter for labels/content | ||
| button("Click me") { } |
There was a problem hiding this comment.
If the closure is empty it can be omitted.
| button("Click me") { } | |
| button("Click me") |
| class ContactView : Composite<Div>() { | ||
|
|
||
| init { | ||
| boundComponent = div { |
There was a problem hiding this comment.
boundComponent cannot be assigned, either use a self variable or use the apply scope function
| boundComponent = div { | |
| boundComponent.apply { |
or
| boundComponent = div { | |
| self = boundComponent | |
| self.apply { |
| val searchButton: Button | ||
|
|
||
| init { | ||
| boundComponent = div { |
There was a problem hiding this comment.
boundComponent cannot be assigned, either use boundComponent.apply or use a self variable.
| boundComponent = div { | |
| boundComponent.apply { |
or
| boundComponent = div { | |
| val self = boundComponent | |
| self.apply { |
|
|
||
| fun onSearch(handler: (String) -> Unit) { | ||
| searchButton.onClick { | ||
| handler(searchField.text ?: "") |
There was a problem hiding this comment.
The elvis operator is not required here, String is not nullable, if it should allow null values change it to String?.
| } | ||
|
|
||
| init { | ||
| boundComponent = div { |
There was a problem hiding this comment.
boundComponent cannot be assigned, either use boundComponent.apply or use a self variable.
| boundComponent = div { | |
| boundComponent.apply { |
or
| boundComponent = div { | |
| val self = boundComponent | |
| self.apply { |
No description provided.