def resources.tree

gralha-svg-render@0.1.0.1 · svg.bend:2034

import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base
import gralha-xml-doc@0.1.0.1/xml.bend as XML
import gralha-css-style@0.1.0.1/css.bend as CSS

2034# The subtree of a found element gets its properties resolved too, since its
2035# content (stops, primitives, pattern or marker content) inherits from it.
2036def resources.tree(xs: List<&2, XML.Element>, +parent: List<&2, XML.Attr>) -> List<&2, XML.Element>:
2037  match xs:
2038    case Nil{}: Nil{}
2039    case Con{XML.Element{n, attrs, kids, txt}, rest}:
2040      +props = props.fold(props.spec(), parent, CSS.properties(attrs))
2041      Con{XML.Element{n, props, resources.tree(kids, props), txt}, resources.tree(rest, parent)}

Uses (6)

Used by (1)