//go:build js && wasm package ultraviolet type WebFactory struct { } func NewWebFactory() Factory { return &WebFactory{} } func (this *WebFactory) NewRoot(options any) Component { optionsRoot := options.(RootComponentOptions) return NewRootComponentWeb(optionsRoot.View) } func (this *WebFactory) NewContainer(options any) Component { optionsContainer := options.(ContainerComponentOptions) return NewContainerComponentWeb(optionsContainer.View) } func (this *WebFactory) NewButton(options any) Component { optionsButton := options.(ButtonComponentOptions) result := NewButtonComponentWeb(optionsButton.View) if optionsButton.Controller.Handler != nil { result.SetHandler(optionsButton.Controller.Handler) } if optionsButton.Model.Format != "" && optionsButton.Model.Values != nil { result.SetValue( optionsButton.Model.Format, optionsButton.Model.Values, ) } return result } func (this *WebFactory) NewImage(options any) Component { optionsImage := options.(ImageComponentOptions) result := NewImageComponentWeb(optionsImage.View) if optionsImage.Model.Path != "" { result.SetPath(optionsImage.Model.Path) } return result } func (this *WebFactory) NewMarkdown(options any) Component { optionsMarkdown := options.(MarkdownComponentOptions) result := NewMarkdownComponentWeb(optionsMarkdown.View) if optionsMarkdown.Model.Content != "" { result.SetMarkdown(optionsMarkdown.Model.Content) } return result } func (this *WebFactory) NewFrame(options any) Component { optionsFrame := options.(FrameComponentOptions) result := NewFrameComponentWeb(optionsFrame.View) if optionsFrame.Model.URL != "" { result.SetUrl(optionsFrame.Model.URL) } return result } func (this *WebFactory) NewCode(options any) Component { optionsCode := options.(CodeComponentOptions) result := NewCodeComponentWeb(optionsCode.View) if optionsCode.Model.Language != "" && optionsCode.Model.Content != "" { result.SetCode( optionsCode.Model.Language, optionsCode.Model.Content, ) } return result }