Arjan van Wieringen
05/03/2022, 1:46 PMElementScope<SVGElement>
context? The normal HTML elements don't do that. It makes it impossible (due to the lack of JS support for now for multiple context receivers) to write context-aware composables for SVG elements.Oleksandr Karpovich [JB]
05/04/2022, 8:57 AM<div><polygon.../></div>
Perhaps, something like this can help:
class MyElementsScope(scope: ElementScope<SVGElement>) : ElementScope<SVGElement> by scope
@OptIn(ExperimentalComposeWebSvgApi::class)
@Composable
fun MyElementsScope.MyPolyline() {
Polyline(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
}
@OptIn(ExperimentalComposeWebSvgApi::class)
@Composable
fun UseMyElementsScope() {
Svg {
with(MyElementsScope(this)) {
MyPolyline()
}
}
}
or scope instance even might be remembered:
@Composable
fun UseMyElementsScope() {
Svg {
val myElementsScope = remember { MyElementsScope(this) }
with(myElementsScope) {
MyPolyline()
}
}
}
Arjan van Wieringen
05/04/2022, 11:51 AMthead
elements outside any table
. But we have all the freedom to do that 😉 . Or we can add option
outside of select
elements.