diff --git a/components/overlay/toast-message.go b/components/overlay/toast-message.go new file mode 100644 index 0000000..1870e6f --- /dev/null +++ b/components/overlay/toast-message.go @@ -0,0 +1,30 @@ +package overlay + +type ToastMessageType int + +const ( + ToastMessageTypeSuccess ToastMessageType = iota + ToastMessageTypeAttention + ToastMessageTypeCaution + ToastMessageTypeCritical +) + +type ToastMessage struct { + MessageType ToastMessageType `vugu:"data"` + Message string `vugu:"data"` +} + +func (c *ToastMessage) OverlayClasses() (signalClasses, containerClasses string) { + switch c.MessageType { + case ToastMessageTypeSuccess: + return "d3c-color-success", "" + case ToastMessageTypeAttention: + return "d3c-color-attention", "" + case ToastMessageTypeCaution: + return "d3c-color-caution", "" + case ToastMessageTypeCritical: + return "d3c-color-critical", "" + } + + return "", "" +} diff --git a/components/overlay/toast-message.vugu b/components/overlay/toast-message.vugu new file mode 100644 index 0000000..c0743cf --- /dev/null +++ b/components/overlay/toast-message.vugu @@ -0,0 +1,25 @@ +
+ +
+ + + + +
+
+
+ + + + diff --git a/components/overlay/toast-message_vgen.go b/components/overlay/toast-message_vgen.go new file mode 100644 index 0000000..11d9d9c --- /dev/null +++ b/components/overlay/toast-message_vgen.go @@ -0,0 +1,145 @@ +package overlay + +// Code generated by vugu via vugugen. Please regenerate instead of editing or add additional code in a separate file. DO NOT EDIT. + +import "fmt" +import "reflect" +import "github.com/vugu/vjson" +import "github.com/vugu/vugu" +import js "github.com/vugu/vugu/js" + +import ( + "git.d3nexus.de/Dadido3/D3vugu-components/components/layout" + "git.d3nexus.de/Dadido3/D3vugu-components/icons" +) + +func (c *ToastMessage) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { + + vgout = &vugu.BuildOut{} + + var vgiterkey interface{} + _ = vgiterkey + var vgn *vugu.VGNode + vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute(nil)} + vgout.Out = append(vgout.Out, vgn) // root for output + { + vgparent := vgn + _ = vgparent + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t"} + vgparent.AppendChild(vgn) + { + vgcompKey := vugu.MakeCompKey(0xFE91A85B84F1D501^vgin.CurrentPositionHash(), vgiterkey) + // ask BuildEnv for prior instance of this specific component + vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*layout.Container) + if vgcomp == nil { + // create new one if needed + vgcomp = new(layout.Container) + vgin.BuildEnv.WireComponent(vgcomp) + } + vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around + vgcomp.DefaultSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { + vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)} + vgout = &vugu.BuildOut{} + vgout.Out = append(vgout.Out, vgn) + vgparent := vgn + _ = vgparent + + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} + vgparent.AppendChild(vgn) + vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "class", Val: "d3c-1685271365-flex"}}} + vgparent.AppendChild(vgn) + { + vgparent := vgn + _ = vgparent + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"} + vgparent.AppendChild(vgn) + if c.MessageType == ToastMessageTypeAttention { + { + vgcompKey := vugu.MakeCompKey(0xDF2F2876D736456A^vgin.CurrentPositionHash(), vgiterkey) + // ask BuildEnv for prior instance of this specific component + vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LInfoCircle) + if vgcomp == nil { + // create new one if needed + vgcomp = new(icons.LInfoCircle) + vgin.BuildEnv.WireComponent(vgcomp) + } + vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around + vgcomp.AttrMap = make(map[string]interface{}, 8) + vgcomp.AttrMap["style"] = "font-size: 2em;" + vgout.Components = append(vgout.Components, vgcomp) + vgn = &vugu.VGNode{Component: vgcomp} + vgparent.AppendChild(vgn) + } + } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"} + vgparent.AppendChild(vgn) + if c.MessageType == ToastMessageTypeCaution { + { + vgcompKey := vugu.MakeCompKey(0xA70DD6C2A5BD0087^vgin.CurrentPositionHash(), vgiterkey) + // ask BuildEnv for prior instance of this specific component + vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LWarning) + if vgcomp == nil { + // create new one if needed + vgcomp = new(icons.LWarning) + vgin.BuildEnv.WireComponent(vgcomp) + } + vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around + vgcomp.AttrMap = make(map[string]interface{}, 8) + vgcomp.AttrMap["style"] = "font-size: 2em;" + vgout.Components = append(vgout.Components, vgcomp) + vgn = &vugu.VGNode{Component: vgcomp} + vgparent.AppendChild(vgn) + } + } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"} + vgparent.AppendChild(vgn) + if c.MessageType == ToastMessageTypeCritical { + { + vgcompKey := vugu.MakeCompKey(0xA3F6AC7E68746E21^vgin.CurrentPositionHash(), vgiterkey) + // ask BuildEnv for prior instance of this specific component + vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LWarning) + if vgcomp == nil { + // create new one if needed + vgcomp = new(icons.LWarning) + vgin.BuildEnv.WireComponent(vgcomp) + } + vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around + vgcomp.AttrMap = make(map[string]interface{}, 8) + vgcomp.AttrMap["style"] = "font-size: 2em;" + vgout.Components = append(vgout.Components, vgcomp) + vgn = &vugu.VGNode{Component: vgcomp} + vgparent.AppendChild(vgn) + } + } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"} + vgparent.AppendChild(vgn) + vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "span", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "style", Val: "white-space: pre-wrap;"}}} + vgparent.AppendChild(vgn) + vgn.SetInnerHTML(c.Message) + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} + vgparent.AppendChild(vgn) + } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t"} + vgparent.AppendChild(vgn) + return + }) + vgout.Components = append(vgout.Components, vgcomp) + vgn = &vugu.VGNode{Component: vgcomp} + vgparent.AppendChild(vgn) + } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n"} + vgparent.AppendChild(vgn) + } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "style", Attr: []vugu.VGAttribute(nil)} + { + vgn.AppendChild(&vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t.d3c-1685271365-flex {\n\t\tmargin: 0.5em 0;\n\t\tdisplay: flex;\n\t\tgap: 0.5em;\n\t}\n", Attr: []vugu.VGAttribute(nil)}) + } + vgout.AppendCSS(vgn) + return vgout +} + +// 'fix' unused imports +var _ fmt.Stringer +var _ reflect.Type +var _ vjson.RawMessage +var _ js.Value diff --git a/components/overlay/toast-simple.go b/components/overlay/toast-simple.go index 996fe09..8e18886 100644 --- a/components/overlay/toast-simple.go +++ b/components/overlay/toast-simple.go @@ -5,8 +5,6 @@ import ( ) type ToastSimple struct { - OverlayContainerRef - IconSlot vugu.Builder `vugu:"data"` // Slot for the symbol. Message string `vugu:"data"` diff --git a/page-overlays.go b/page-overlays.go index 96c1965..6eab70a 100644 --- a/page-overlays.go +++ b/page-overlays.go @@ -39,3 +39,7 @@ func (c *PageOverlays) handleWarningToastButton(event vugu.DOMEvent) { SignalColor: "d3c-color-caution", }) } + +func (c *PageOverlays) handleToastMessageButton(event vugu.DOMEvent) { + c.AddToast(&overlay.ToastMessage{MessageType: overlay.ToastMessageTypeCritical, Message: "Uh oh!"}) +} diff --git a/page-overlays.vugu b/page-overlays.vugu index 58d531d..ee2a694 100644 --- a/page-overlays.vugu +++ b/page-overlays.vugu @@ -21,7 +21,7 @@ Open simple modal

Toasts

-

A simple text and icon containing toast is already contained in the overlay package. Use it with:

+

A simple toast with an icon slot and custom color setting can be found in the overlay package. Use it with:


+		
+ Open message toast diff --git a/page-overlays_vgen.go b/page-overlays_vgen.go index 4440f1b..fd27520 100644 --- a/page-overlays_vgen.go +++ b/page-overlays_vgen.go @@ -29,7 +29,7 @@ func (c *PageOverlays) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x4EC622AB5385FB53^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x194F4C7AF2E5A2B0^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*layout.Container) if vgcomp == nil { @@ -60,7 +60,7 @@ func (c *PageOverlays) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Overlays are handled by the "} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0xA86AF7B68F8AD85^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x3757E78A1B64D645^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline) if vgcomp == nil { @@ -97,7 +97,7 @@ func (c *PageOverlays) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Every page or component that creates overlays has to embed the "} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0xAA81EC30F5C8A301^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0xFA080C088DBCE9C9^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline) if vgcomp == nil { @@ -124,7 +124,7 @@ func (c *PageOverlays) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: " structure. Your wiring function also needs to set the reference to your "} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x86D5B8E7A405D1BA^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x629A301362214872^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline) if vgcomp == nil { @@ -164,7 +164,7 @@ func (c *PageOverlays) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x231AC275ADD0C8A2^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x9A4385E0CAC8E985^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code) if vgcomp == nil { @@ -205,7 +205,7 @@ func (c *PageOverlays) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0xD96FB389C1BB7FDA^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0xC476BA53145BB281^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button) if vgcomp == nil { @@ -239,11 +239,11 @@ func (c *PageOverlays) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgparent.AppendChild(vgn) vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "p", Attr: []vugu.VGAttribute(nil)} vgparent.AppendChild(vgn) - vgn.SetInnerHTML(vugu.HTML("A simple text and icon containing toast is already contained in the overlay package. Use it with:")) + vgn.SetInnerHTML(vugu.HTML("A simple toast with an icon slot and custom color setting can be found in the overlay package. Use it with:")) vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x4C6CB0EF8A1C94A7^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0xA9AF18688A4172C^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code) if vgcomp == nil { @@ -281,7 +281,7 @@ func (c *PageOverlays) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x27E6D3B288976594^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x780A6C984431BEBF^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button) if vgcomp == nil { @@ -309,7 +309,7 @@ func (c *PageOverlays) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0xA065017C7F9FF6D6^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x35E3A47F92F1AAD7^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button) if vgcomp == nil { @@ -334,6 +334,247 @@ func (c *PageOverlays) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Component: vgcomp} vgparent.AppendChild(vgn) } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} + vgparent.AppendChild(vgn) + vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "p", Attr: []vugu.VGAttribute(nil)} + vgparent.AppendChild(vgn) + { + vgparent := vgn + _ = vgparent + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "A shorter version of this is "} + vgparent.AppendChild(vgn) + { + vgcompKey := vugu.MakeCompKey(0xABF3E4A38937C760^vgin.CurrentPositionHash(), vgiterkey) + // ask BuildEnv for prior instance of this specific component + vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline) + if vgcomp == nil { + // create new one if needed + vgcomp = new(view.CodeInline) + vgin.BuildEnv.WireComponent(vgcomp) + } + vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around + vgcomp.DefaultSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { + vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)} + vgout = &vugu.BuildOut{} + vgout.Out = append(vgout.Out, vgn) + vgparent := vgn + _ = vgparent + + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "overlay.ToastMessage"} + vgparent.AppendChild(vgn) + return + }) + vgout.Components = append(vgout.Components, vgcomp) + vgn = &vugu.VGNode{Component: vgcomp} + vgparent.AppendChild(vgn) + } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: " which only accepts a message text and a message type which is one of"} + vgparent.AppendChild(vgn) + } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} + vgparent.AppendChild(vgn) + vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "ul", Attr: []vugu.VGAttribute(nil)} + vgparent.AppendChild(vgn) + { + vgparent := vgn + _ = vgparent + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"} + vgparent.AppendChild(vgn) + vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "li", Attr: []vugu.VGAttribute(nil)} + vgparent.AppendChild(vgn) + { + vgparent := vgn + _ = vgparent + { + vgcompKey := vugu.MakeCompKey(0xCB89A1E68B20EA8A^vgin.CurrentPositionHash(), vgiterkey) + // ask BuildEnv for prior instance of this specific component + vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline) + if vgcomp == nil { + // create new one if needed + vgcomp = new(view.CodeInline) + vgin.BuildEnv.WireComponent(vgcomp) + } + vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around + vgcomp.DefaultSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { + vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)} + vgout = &vugu.BuildOut{} + vgout.Out = append(vgout.Out, vgn) + vgparent := vgn + _ = vgparent + + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "overlay.ToastMessageTypeSuccess"} + vgparent.AppendChild(vgn) + return + }) + vgout.Components = append(vgout.Components, vgcomp) + vgn = &vugu.VGNode{Component: vgcomp} + vgparent.AppendChild(vgn) + } + } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"} + vgparent.AppendChild(vgn) + vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "li", Attr: []vugu.VGAttribute(nil)} + vgparent.AppendChild(vgn) + { + vgparent := vgn + _ = vgparent + { + vgcompKey := vugu.MakeCompKey(0x4A0D1617B8C07161^vgin.CurrentPositionHash(), vgiterkey) + // ask BuildEnv for prior instance of this specific component + vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline) + if vgcomp == nil { + // create new one if needed + vgcomp = new(view.CodeInline) + vgin.BuildEnv.WireComponent(vgcomp) + } + vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around + vgcomp.DefaultSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { + vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)} + vgout = &vugu.BuildOut{} + vgout.Out = append(vgout.Out, vgn) + vgparent := vgn + _ = vgparent + + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "overlay.ToastMessageTypeAttention"} + vgparent.AppendChild(vgn) + return + }) + vgout.Components = append(vgout.Components, vgcomp) + vgn = &vugu.VGNode{Component: vgcomp} + vgparent.AppendChild(vgn) + } + } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"} + vgparent.AppendChild(vgn) + vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "li", Attr: []vugu.VGAttribute(nil)} + vgparent.AppendChild(vgn) + { + vgparent := vgn + _ = vgparent + { + vgcompKey := vugu.MakeCompKey(0x250710AB16D8A4A7^vgin.CurrentPositionHash(), vgiterkey) + // ask BuildEnv for prior instance of this specific component + vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline) + if vgcomp == nil { + // create new one if needed + vgcomp = new(view.CodeInline) + vgin.BuildEnv.WireComponent(vgcomp) + } + vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around + vgcomp.DefaultSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { + vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)} + vgout = &vugu.BuildOut{} + vgout.Out = append(vgout.Out, vgn) + vgparent := vgn + _ = vgparent + + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "overlay.ToastMessageTypeCaution"} + vgparent.AppendChild(vgn) + return + }) + vgout.Components = append(vgout.Components, vgcomp) + vgn = &vugu.VGNode{Component: vgcomp} + vgparent.AppendChild(vgn) + } + } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"} + vgparent.AppendChild(vgn) + vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "li", Attr: []vugu.VGAttribute(nil)} + vgparent.AppendChild(vgn) + { + vgparent := vgn + _ = vgparent + { + vgcompKey := vugu.MakeCompKey(0xEDD5787DBA040BA8^vgin.CurrentPositionHash(), vgiterkey) + // ask BuildEnv for prior instance of this specific component + vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline) + if vgcomp == nil { + // create new one if needed + vgcomp = new(view.CodeInline) + vgin.BuildEnv.WireComponent(vgcomp) + } + vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around + vgcomp.DefaultSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { + vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)} + vgout = &vugu.BuildOut{} + vgout.Out = append(vgout.Out, vgn) + vgparent := vgn + _ = vgparent + + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "overlay.ToastMessageTypeCritical"} + vgparent.AppendChild(vgn) + return + }) + vgout.Components = append(vgout.Components, vgcomp) + vgn = &vugu.VGNode{Component: vgcomp} + vgparent.AppendChild(vgn) + } + } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} + vgparent.AppendChild(vgn) + } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} + vgparent.AppendChild(vgn) + { + vgcompKey := vugu.MakeCompKey(0xECE61DAD54EC1354^vgin.CurrentPositionHash(), vgiterkey) + // ask BuildEnv for prior instance of this specific component + vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code) + if vgcomp == nil { + // create new one if needed + vgcomp = new(view.Code) + vgin.BuildEnv.WireComponent(vgcomp) + } + vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around + vgcomp.DefaultSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { + vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)} + vgout = &vugu.BuildOut{} + vgout.Out = append(vgout.Out, vgn) + vgparent := vgn + _ = vgparent + + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"} + vgparent.AppendChild(vgn) + vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "pre", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "style", Val: "margin: 0;"}}} + vgparent.AppendChild(vgn) + vgn.SetInnerHTML("func (c *PageOverlays) handleButton(event vugu.DOMEvent) {\n" + + " c.AddToast(&overlay.ToastMessage{MessageType: overlay.ToastMessageTypeCritical, Message: \"Uh oh!\"})\n" + + "}") + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} + vgparent.AppendChild(vgn) + return + }) + vgout.Components = append(vgout.Components, vgcomp) + vgn = &vugu.VGNode{Component: vgcomp} + vgparent.AppendChild(vgn) + } + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} + vgparent.AppendChild(vgn) + { + vgcompKey := vugu.MakeCompKey(0x50434B1AB4676FD5^vgin.CurrentPositionHash(), vgiterkey) + // ask BuildEnv for prior instance of this specific component + vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button) + if vgcomp == nil { + // create new one if needed + vgcomp = new(input.Button) + vgin.BuildEnv.WireComponent(vgcomp) + } + vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around + vgcomp.Click = input.ClickFunc(func(event input.ClickEvent) { c.handleToastMessageButton(event) }) + vgcomp.DefaultSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { + vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)} + vgout = &vugu.BuildOut{} + vgout.Out = append(vgout.Out, vgn) + vgparent := vgn + _ = vgparent + + vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Open message toast"} + vgparent.AppendChild(vgn) + return + }) + vgout.Components = append(vgout.Components, vgcomp) + vgn = &vugu.VGNode{Component: vgcomp} + vgparent.AppendChild(vgn) + } vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t"} vgparent.AppendChild(vgn) return