neworldlt
07/16/2025, 9:26 PMBSCard {
Body {
div {
div(classes { CARD_TEXT() }) {
+"Some text"
}
}
}
}
Contexts are declared like:
@ComponentDsl
public interface IComponent
fun IComponent.BSCard(
content: @Composable ((@BSContextScope CardContext).() -> Unit) = { }
)
//Here I want to access only to `Body`, which is protected by @BSContextScope
class CardContext(private val context: IComponent) {
fun Body(content: CardBodyContext.() -> Unit)
}
// CardBodyContext inherits @ComponentDsl. Is there any way to override it?
class CardBodyContext(val context: IComponent) : IComponent by context {
fun BSClassListGeneric.CARD_TEXT() = add(BSClass("card-text"))
}
Nothing I tried works. Is there any clever way to overcome this?neworldlt
07/16/2025, 11:18 PMBSCard {
Body {
content {
div {
div(classes { CARD_TEXT() }) {
+"Some text"
}
}
}
}
}
Where BSCard
takes over IComponent
context, Body
introduces CARD_TEXT()
and content
continues IComponent
context. But this extra layer is not ideal.