theme-provider.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VThemeProviderBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VThemeProvider(children ...h.HTMLComponent) (r *VThemeProviderBuilder) {
  11. r = &VThemeProviderBuilder{
  12. tag: h.Tag("v-theme-provider").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VThemeProviderBuilder) Dark(v bool) (r *VThemeProviderBuilder) {
  17. b.tag.Attr(":dark", fmt.Sprint(v))
  18. return b
  19. }
  20. func (b *VThemeProviderBuilder) Light(v bool) (r *VThemeProviderBuilder) {
  21. b.tag.Attr(":light", fmt.Sprint(v))
  22. return b
  23. }
  24. func (b *VThemeProviderBuilder) Root(v bool) (r *VThemeProviderBuilder) {
  25. b.tag.Attr(":root", fmt.Sprint(v))
  26. return b
  27. }
  28. func (b *VThemeProviderBuilder) SetAttr(k string, v interface{}) {
  29. b.tag.SetAttr(k, v)
  30. }
  31. func (b *VThemeProviderBuilder) Attr(vs ...interface{}) (r *VThemeProviderBuilder) {
  32. b.tag.Attr(vs...)
  33. return b
  34. }
  35. func (b *VThemeProviderBuilder) Children(children ...h.HTMLComponent) (r *VThemeProviderBuilder) {
  36. b.tag.Children(children...)
  37. return b
  38. }
  39. func (b *VThemeProviderBuilder) AppendChildren(children ...h.HTMLComponent) (r *VThemeProviderBuilder) {
  40. b.tag.AppendChildren(children...)
  41. return b
  42. }
  43. func (b *VThemeProviderBuilder) PrependChildren(children ...h.HTMLComponent) (r *VThemeProviderBuilder) {
  44. b.tag.PrependChildren(children...)
  45. return b
  46. }
  47. func (b *VThemeProviderBuilder) Class(names ...string) (r *VThemeProviderBuilder) {
  48. b.tag.Class(names...)
  49. return b
  50. }
  51. func (b *VThemeProviderBuilder) ClassIf(name string, add bool) (r *VThemeProviderBuilder) {
  52. b.tag.ClassIf(name, add)
  53. return b
  54. }
  55. func (b *VThemeProviderBuilder) On(name string, value string) (r *VThemeProviderBuilder) {
  56. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  57. return b
  58. }
  59. func (b *VThemeProviderBuilder) Bind(name string, value string) (r *VThemeProviderBuilder) {
  60. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  61. return b
  62. }
  63. func (b *VThemeProviderBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  64. return b.tag.MarshalHTML(ctx)
  65. }