factory.go 635 B

1234567891011121314151617181920212223242526272829303132
  1. //go:build js && wasm
  2. package ultraviolet
  3. type Model map[string]any
  4. type Controller map[string]any
  5. type ComponentOptions struct {
  6. View View
  7. Model Model
  8. Controller Controller
  9. }
  10. type Factory interface {
  11. NewRoot(options any) Component
  12. NewContainer(options any) Component
  13. NewText(options any) Component
  14. NewButton(options any) Component
  15. NewImage(options any) Component
  16. NewMarkdown(options any) Component
  17. NewFrame(options any) Component
  18. NewCode(options any) Component
  19. }
  20. func NewFactory(platform int) Factory {
  21. switch platform {
  22. case PLATFORM_WEB:
  23. return NewWebFactory()
  24. default:
  25. return NewWebFactory()
  26. }
  27. }