I'm experimenting with Kotlin/JS, building a web t...
# javascript
j
I'm experimenting with Kotlin/JS, building a web toy. All the pure-Kotlin logic works fine (though unit testing is slower than on JVM, and it can't locate the lines that throw exceptions) and the HTML DSL was easy to pick up and extend, so long as I was just using old, old HTML - tables, divs, spans, and the like. But I can't seem to get more 'modern' CSS to work at all! I'm trying to specify a transition. My expectation is that within a
css {}
block, I should either be setting
transition
or be setting
transitionProperty
+
transitionDuration
. But while the
css.transition
property is a
Transition?
, clicking through to the
Transition
source shows it as a
sealed external interface
, not a class with constructor parameters. Similarly, I'd like to set a gradient background. Again, I expect that I should set
backgroundImage
within a
css {}
block, but
BackgroundImage
is also coming up as a
sealed external interface
. Should these features be working as I expect, or are they still works in progress? Is it possible that my project configuration needs some tweaking? (The libraries do include Gradle:
org.jetbrains.kotlin-wrappers:kotlin-csstype:klib:3.1.0-pre.3462
.)
a
@turansky ^^
t
For complex values we have factory functions. For
Transition
we have 3 factories with same name.
j
Thank you, @turansky, that makes sense. Is there any documentation that would tell me the names of these factory functions? Or is there an
import
I should add that would let IDEA auto-suggest these functions?
t
Main rule - we have safe factory functions for all.
asDynamic
and
unsafeCast
aren't required.
For complex values, like
Transition
- functions we same name name. For CSS functions, like
url
- functions with same name. For primitives and array like functions we provide:
string
,
integer
,
number
,
array
,
many
Predefined constant:
Auto.auto
None.none
and more. And it's parent types of interface, which you need. For example you can use constants from
PropertyName
for
TransitionProperty