All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jsMain.styled.dynamicCss.DynamicCssProvider.kt Maven / Gradle / Ivy

There is a newer version: 1.2.4-pre.855
Show newest version
package styled.dynamicCss

import kotlinx.css.CssBuilder
import kotlinx.css.RuleSet
import styled.StyleSheet

/**
 * Provides [RuleSet]s with caching according to provided arguments.
 *
 * @param sheet           A reference to the [StyleSheet] containing and caching all related styles.
 * @param staticCssSuffix A suffix to be included into all names of dynamic CSS classes.
 * @param builder         A builder describing how to prepare CSS rules according to the current argument.
 * */
class DynamicCssProvider internal constructor(
    private val sheet: StyleSheet,
    private val staticCssSuffix: String,
    private val builder: CssBuilder.(T) -> Unit
) {
    operator fun invoke(argument: T): RuleSet = sheet.prepareCachedRuleSet(staticCssSuffix, builder, argument)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy