From 97bf0b1e9742529eb48a1d566d98b5f0dd49d00e Mon Sep 17 00:00:00 2001 From: David Vogel Date: Sat, 27 May 2023 13:43:48 +0200 Subject: [PATCH] Add color to tags on example home page --- page-home.vugu | 2 +- page-home_vgen.go | 44 ++++++++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/page-home.vugu b/page-home.vugu index 690c8f5..a68ac7c 100644 --- a/page-home.vugu +++ b/page-home.vugu @@ -22,7 +22,7 @@

Some inlined code in this line!

Tags

- This is some tag: Some Tag and Another Tag + This is some tag: Some Tag and Another Tag

List Container

diff --git a/page-home_vgen.go b/page-home_vgen.go index 29153e6..7f5c2af 100644 --- a/page-home_vgen.go +++ b/page-home_vgen.go @@ -32,7 +32,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x3A0D8AE6BFEF156A^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x435938B14B8E310C^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*layout.Container) if vgcomp == nil { @@ -61,7 +61,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x6E1D92F498801A2E^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x875AF434A3E9662^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code) if vgcomp == nil { @@ -101,7 +101,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x62A5F2D986FA701F^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0xEADA9DC4330F01D^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button) if vgcomp == nil { @@ -118,7 +118,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { _ = vgparent { - vgcompKey := vugu.MakeCompKey(0x6150C08F019481E3^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0xD54B6713507AA0AC^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LGlobe) if vgcomp == nil { @@ -151,7 +151,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x834F2F01A803397^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0xC48F0E3D229673^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button) if vgcomp == nil { @@ -168,7 +168,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { _ = vgparent { - vgcompKey := vugu.MakeCompKey(0x59FE1A7B55E3FEDF^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x81FDAC97933C5B0D^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LGlobe) if vgcomp == nil { @@ -201,7 +201,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x36E5C9A379A2E5E7^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x841620215F8E6105^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button) if vgcomp == nil { @@ -218,7 +218,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { _ = vgparent { - vgcompKey := vugu.MakeCompKey(0xB9B8910EF231F0C7^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0xDE469BC1A03068CF^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LGlobe) if vgcomp == nil { @@ -258,7 +258,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Some "} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0xE24AF0F3598FB6BA^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x1587EBA0D728FAE9^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline) if vgcomp == nil { @@ -293,7 +293,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\tThis is some tag: "} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x5FD7DCBABF1D0716^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x362CE7B36EB8D980^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Tag) if vgcomp == nil { @@ -302,6 +302,8 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { 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["class"] = "d3c-color-attention" vgcomp.DefaultSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)} vgout = &vugu.BuildOut{} @@ -320,7 +322,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: " and "} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x5BE2713EC205A735^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x4F5566CC43232733^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Tag) if vgcomp == nil { @@ -329,6 +331,8 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { 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["class"] = "d3c-color-attention" vgcomp.DefaultSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)} vgout = &vugu.BuildOut{} @@ -352,7 +356,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0xDB05085C262C3475^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0xE6A0226320DC917A^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*layout.ListContainer) if vgcomp == nil { @@ -376,7 +380,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { i := i _ = i { - vgcompKey := vugu.MakeCompKey(0xEB52F71687DCD7B8^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x1382D8236BF86A92^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*layout.LayerContainer) if vgcomp == nil { @@ -397,7 +401,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0xABF7242C22067203^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0xD7971A9ED4FD5DE7^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LInfoCircle) if vgcomp == nil { @@ -452,7 +456,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x442F85F1C7FFE70B^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x78A1467A7FD40CCF^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button) if vgcomp == nil { @@ -472,7 +476,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { _ = vgparent { - vgcompKey := vugu.MakeCompKey(0x6C629F6FA12DEF00^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0x566F49F6122950F8^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LGlobe) if vgcomp == nil { @@ -507,7 +511,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x55C8F89FD09A84F0^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0xB0734939EBECE71D^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button) if vgcomp == nil { @@ -527,7 +531,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { _ = vgparent { - vgcompKey := vugu.MakeCompKey(0x9AD4DC9A7276ADAB^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0xC6F9CFE1BF982DB8^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LGlobe) if vgcomp == nil { @@ -562,7 +566,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"} vgparent.AppendChild(vgn) { - vgcompKey := vugu.MakeCompKey(0x4A364DB60CB9C2F5^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0xC242558A255C407E^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button) if vgcomp == nil { @@ -582,7 +586,7 @@ func (c *PageHome) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { _ = vgparent { - vgcompKey := vugu.MakeCompKey(0xD0D132CA2345B342^vgin.CurrentPositionHash(), vgiterkey) + vgcompKey := vugu.MakeCompKey(0xC6FC69E810ACE861^vgin.CurrentPositionHash(), vgiterkey) // ask BuildEnv for prior instance of this specific component vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LGlobe) if vgcomp == nil {