package test import ( "github.com/doors-dev/doors" "github.com/doors-dev/gox" ) type NoBeam struct{} func (f NoBeam) setBeam(_ doors.Source[Path]) {} type Beam struct { B doors.Source[Path] } func (f *Beam) setBeam(b doors.Source[Path]) { f.B = b } type Path struct { Vh bool `path:""` Vs bool `path:"/s"` Vp bool `path:"/s/:P"` P string } type Fragment interface { setBeam(b doors.Source[Path]) gox.Comp } type Page struct { Source doors.Source[Path] F Fragment H elem(doors.Source[Path]) Header string } func (p *Page) h1() string { return p.Header } func (p *Page) head() gox.Elem { if p.H == nil { return nil } return p.H(p.Source) } elem (p *Page) content() { ~(if p.F != nil { ~{ p.F.setBeam(p.Source) } ~(p.F) }) } elem (p *Page) Main() { ~(Document(p)) }