Browse Source

web: make auto-css experimental (#1294)

Co-authored-by: Oleksandr Karpovich <oleksandr.karpovich@jetbrains.com>
pull/1296/head
Oleksandr Karpovich 3 years ago committed by GitHub
parent
commit
c5c28f8aad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/ExperimentalComposeWebStyleApi.kt
  2. 2
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleSheet.kt

4
web/core/src/jsMain/kotlin/org/jetbrains/compose/web/ExperimentalComposeWebStyleApi.kt

@ -0,0 +1,4 @@
package org.jetbrains.compose.web
@RequiresOptIn("This API is experimental and is likely to change in the future.")
annotation class ExperimentalComposeWebStyleApi

2
web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleSheet.kt

@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import org.jetbrains.compose.web.ExperimentalComposeWebStyleApi
import org.jetbrains.compose.web.css.selectors.CSSSelector import org.jetbrains.compose.web.css.selectors.CSSSelector
import org.jetbrains.compose.web.css.selectors.className import org.jetbrains.compose.web.css.selectors.className
import org.jetbrains.compose.web.dom.Style import org.jetbrains.compose.web.dom.Style
@ -86,6 +87,7 @@ open class StyleSheet(
} }
// TODO: just proof of concept, do not use it // TODO: just proof of concept, do not use it
@ExperimentalComposeWebStyleApi
fun css(cssBuild: CSSBuilder.() -> Unit): String { fun css(cssBuild: CSSBuilder.() -> Unit): String {
val selfSelector = CSSSelfSelector() val selfSelector = CSSSelfSelector()
val (style, newCssRules) = buildCSS(selfSelector, selfSelector, cssBuild) val (style, newCssRules) = buildCSS(selfSelector, selfSelector, cssBuild)

Loading…
Cancel
Save