I am wondering, is it possible to extend another D...
# dsl
n
I am wondering, is it possible to extend another DslMarked scope with a couple of methods and have it be used anywhere inside my scope? Example where I want access to `CARD_TEXT()`:
Copy code
BSCard {
                Body {
                    div {
                        div(classes { CARD_TEXT() }) { 
                            +"Some text"
                        }
                    }
                }
            }
Contexts are declared like:
Copy code
@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?
The only way I managed is to create new layer:
Copy code
BSCard {
                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.