From 4aeddfe3526ff51fce184d3b5dab63cd951818b2 Mon Sep 17 00:00:00 2001 From: Alex Dunmow Date: Sat, 4 Jul 2026 15:32:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20convert=20to=20codeless=20.bnp=20?= =?UTF-8?q?=E2=80=94=20templates=20+=20manifest,=20Go/templ=20deleted=20(W?= =?UTF-8?q?O-WZ-021)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- Makefile | 40 +- assets/{css/earthen.css => style.css} | 0 blocks/blocks.yaml | 42 ++ blocks/botanical_divider.ninjatpl | 5 + .../botanical_divider.schema.json | 0 blocks/donation_cta.ninjatpl | 16 + {schemas => blocks}/donation_cta.schema.json | 0 blocks/field_note.ninjatpl | 8 + {schemas => blocks}/field_note.schema.json | 0 blocks/footer.ninjatpl | 17 + {schemas => blocks}/footer.schema.json | 0 blocks/impact_metrics.ninjatpl | 7 + .../impact_metrics.schema.json | 0 blocks/partner_logos.ninjatpl | 6 + {schemas => blocks}/partner_logos.schema.json | 0 botanical_divider.go | 43 -- botanical_divider.templ | 79 --- botanical_divider_templ.go | 180 ------ button_override.go | 27 - button_override.templ | 34 -- button_override_templ.go | 114 ---- card_override.go | 33 -- card_override.templ | 46 -- card_override_templ.go | 193 ------- donation_cta.go | 67 --- donation_cta.templ | 79 --- donation_cta_templ.go | 195 ------- email_wrapper.go | 17 - email_wrapper.templ | 154 ----- email_wrapper_templ.go | 470 --------------- embed.go | 64 --- field_note.go | 44 -- field_note.templ | 52 -- field_note_templ.go | 175 ------ footer.go | 69 --- footer.templ | 104 ---- footer_templ.go | 234 -------- go.mod | 20 - go.sum | 46 -- heading_override.go | 40 -- heading_override.templ | 76 --- heading_override_templ.go | 402 ------------- helpers.go | 48 -- image_override.go | 21 - image_override.templ | 35 -- image_override_templ.go | 101 ---- impact_metrics.go | 58 -- impact_metrics.templ | 82 --- impact_metrics_templ.go | 243 -------- main.go | 17 - manifest.yaml | 159 +++++ master_pages.json | 25 + partner_logos.go | 55 -- partner_logos.templ | 95 --- partner_logos_templ.go | 334 ----------- plugin.mod | 5 +- register.go | 180 ------ registration.go | 25 - template.templ | 273 --------- template_templ.go | 543 ------------------ templates/earthen/article.ninjatpl | 17 + templates/earthen/default.ninjatpl | 11 + templates/earthen/full-width.ninjatpl | 11 + templates/earthen/landing.ninjatpl | 12 + templates/email/earthen.ninjatpl | 9 + templates/overrides/earthen/button.ninjatpl | 1 + templates/overrides/earthen/card.ninjatpl | 1 + templates/overrides/earthen/heading.ninjatpl | 1 + templates/overrides/earthen/image.ninjatpl | 1 + templates/overrides/earthen/text.ninjatpl | 1 + text_override.go | 18 - text_override.templ | 20 - text_override_templ.go | 126 ---- 73 files changed, 369 insertions(+), 5357 deletions(-) rename assets/{css/earthen.css => style.css} (100%) create mode 100644 blocks/blocks.yaml create mode 100644 blocks/botanical_divider.ninjatpl rename {schemas => blocks}/botanical_divider.schema.json (100%) create mode 100644 blocks/donation_cta.ninjatpl rename {schemas => blocks}/donation_cta.schema.json (100%) create mode 100644 blocks/field_note.ninjatpl rename {schemas => blocks}/field_note.schema.json (100%) create mode 100644 blocks/footer.ninjatpl rename {schemas => blocks}/footer.schema.json (100%) create mode 100644 blocks/impact_metrics.ninjatpl rename {schemas => blocks}/impact_metrics.schema.json (100%) create mode 100644 blocks/partner_logos.ninjatpl rename {schemas => blocks}/partner_logos.schema.json (100%) delete mode 100644 botanical_divider.go delete mode 100644 botanical_divider.templ delete mode 100644 botanical_divider_templ.go delete mode 100644 button_override.go delete mode 100644 button_override.templ delete mode 100644 button_override_templ.go delete mode 100644 card_override.go delete mode 100644 card_override.templ delete mode 100644 card_override_templ.go delete mode 100644 donation_cta.go delete mode 100644 donation_cta.templ delete mode 100644 donation_cta_templ.go delete mode 100644 email_wrapper.go delete mode 100644 email_wrapper.templ delete mode 100644 email_wrapper_templ.go delete mode 100644 embed.go delete mode 100644 field_note.go delete mode 100644 field_note.templ delete mode 100644 field_note_templ.go delete mode 100644 footer.go delete mode 100644 footer.templ delete mode 100644 footer_templ.go delete mode 100644 go.mod delete mode 100644 go.sum delete mode 100644 heading_override.go delete mode 100644 heading_override.templ delete mode 100644 heading_override_templ.go delete mode 100644 helpers.go delete mode 100644 image_override.go delete mode 100644 image_override.templ delete mode 100644 image_override_templ.go delete mode 100644 impact_metrics.go delete mode 100644 impact_metrics.templ delete mode 100644 impact_metrics_templ.go delete mode 100644 main.go create mode 100644 manifest.yaml create mode 100644 master_pages.json delete mode 100644 partner_logos.go delete mode 100644 partner_logos.templ delete mode 100644 partner_logos_templ.go delete mode 100644 register.go delete mode 100644 registration.go delete mode 100644 template.templ delete mode 100644 template_templ.go create mode 100644 templates/earthen/article.ninjatpl create mode 100644 templates/earthen/default.ninjatpl create mode 100644 templates/earthen/full-width.ninjatpl create mode 100644 templates/earthen/landing.ninjatpl create mode 100644 templates/email/earthen.ninjatpl create mode 100644 templates/overrides/earthen/button.ninjatpl create mode 100644 templates/overrides/earthen/card.ninjatpl create mode 100644 templates/overrides/earthen/heading.ninjatpl create mode 100644 templates/overrides/earthen/image.ninjatpl create mode 100644 templates/overrides/earthen/text.ninjatpl delete mode 100644 text_override.go delete mode 100644 text_override.templ delete mode 100644 text_override_templ.go diff --git a/Makefile b/Makefile index 1500a50..7ed6a57 100644 --- a/Makefile +++ b/Makefile @@ -1,26 +1,27 @@ -# earthen — build & publish helpers (wasm .bnp workflow) +# earthen — build & publish helpers (CODELESS .bnp workflow, WO-WZ-021) # -# The theme compiles to a wasip1 reactor-mode wasm module packed into a .bnp -# artifact (`ninja plugin build`). The legacy .so path is retired (WO-WZ-015): -# the CMS is wasm-native and can no longer load .so plugins. Distribution is -# publish-to-registry -> InstallFromRegistry (hot-load, no restart). +# This theme is a CODELESS .bnp: pure declaration the host runs — blocks +# (blocks/blocks.yaml + .ninjatpl), page/system templates, template overrides, +# an email wrapper, master pages, presets, fonts and CSS in manifest.yaml. No +# Go, no templ, no plugin.wasm, no block/core dependency. `ninja plugin build` +# classifies the repo as codeless (no Go at the root) and packs the artifact +# with manifest.pb (codeless: true) and NO plugin.wasm. # # Usage: -# make build # compile wasm + pack earthen-.bnp -# make verify # validate the built .bnp (layout/abi/name/size) -# make archive-check # prove a clean `git archive HEAD` compiles to wasm +# make build # pack earthen-.bnp (codeless — no wasm) +# make verify # validate the built .bnp (loader-identical checks) +# make archive-check # prove a clean `git archive HEAD` still builds codeless # make publish # ninja plugin publish --bnp (to the active registry) -# make templ # regenerate templ Go files # make clean # remove build artefacts -.PHONY: build verify archive-check publish templ clean help +.PHONY: build verify archive-check publish clean help PLUGIN_NAME := earthen NINJA := ninja BNP := $(PLUGIN_NAME)-$(shell grep '^version' plugin.mod | sed 's/.*"\(.*\)"/\1/').bnp -# Compile to wasm and pack the .bnp (GOOS=wasip1 GOARCH=wasm, DESCRIBE probe, -# tar.zst of plugin.wasm + plugin.mod + manifest.pb + schemas/ + assets/). +# Pack the codeless .bnp (manifest.pb synthesized from plugin.mod + manifest.yaml +# + blocks/ + templates/; no wasm compile, no DESCRIBE probe). build: $(NINJA) plugin build --dir . @@ -28,12 +29,12 @@ build: verify: $(NINJA) plugin verify $(BNP) -# Prove a clean `git archive HEAD` (what publish ships) compiles to wasm. +# Prove a clean `git archive HEAD` (what publish ships) still packs codeless. archive-check: @T=$$(mktemp -d /tmp/archive-check-$(PLUGIN_NAME).XXXXXX) && \ trap 'rm -rf "$$T"' EXIT && \ git archive HEAD | tar -x -C "$$T" && \ - cd "$$T" && GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o "$$T/check.wasm" . && \ + cd "$$T" && $(NINJA) plugin build --dir . && \ echo "archive-check OK" # Publish the prebuilt .bnp to the active registry. @@ -41,19 +42,14 @@ archive-check: publish: build $(NINJA) plugin publish --bnp $(BNP) -# Regenerate templ Go files locally. -templ: - templ generate - # Remove build artefacts. clean: - rm -f $(PLUGIN_NAME)-*.bnp $(PLUGIN_NAME).so plugin.wasm + rm -f $(PLUGIN_NAME)-*.bnp plugin.wasm help: @echo "Targets:" - @echo " build Compile wasm + pack the .bnp" + @echo " build Pack the codeless .bnp (no wasm)" @echo " verify Validate the built .bnp (loader-identical checks)" - @echo " archive-check Prove a clean git archive HEAD compiles to wasm" + @echo " archive-check Prove a clean git archive HEAD packs codeless" @echo " publish Publish the .bnp to the active registry" - @echo " templ Regenerate templ Go files" @echo " clean Remove build artefacts" diff --git a/assets/css/earthen.css b/assets/style.css similarity index 100% rename from assets/css/earthen.css rename to assets/style.css diff --git a/blocks/blocks.yaml b/blocks/blocks.yaml new file mode 100644 index 0000000..c386792 --- /dev/null +++ b/blocks/blocks.yaml @@ -0,0 +1,42 @@ +# Earthen theme block definitions (codeless .bnp, WO-WZ-021). +# Keys are fully qualified (earthen:) because the codeless loader registers +# definitions verbatim — there is no PluginBlockRegistry prefixing in the +# codeless path (unlike the wasm/templ path). The qualified keys match the +# hardcoded data-block attributes and the master_pages.json references. +blocks: + - key: earthen:donation_cta + title: Donation CTA + description: Donation call-to-action with preset amount tiles and custom amount field. + category: content + schema: donation_cta.schema.json + template: donation_cta.ninjatpl + - key: earthen:impact_metrics + title: Impact Metrics + description: Numerical impact metrics with optional botanical illustration. + category: content + schema: impact_metrics.schema.json + template: impact_metrics.ninjatpl + - key: earthen:partner_logos + title: Partner Logos + description: Grayscale partner logo grid with hover-to-color treatment. + category: content + schema: partner_logos.schema.json + template: partner_logos.ninjatpl + - key: earthen:field_note + title: Field Note + description: Article-style dispatch from the field with byline and location. + category: content + schema: field_note.schema.json + template: field_note.ninjatpl + - key: earthen:botanical_divider + title: Botanical Divider + description: Hand-illustrated SVG section break in fern, root or seed motif. + category: layout + schema: botanical_divider.schema.json + template: botanical_divider.ninjatpl + - key: earthen:footer + title: Site Footer + description: Cream-on-moss footer with optional newsletter and column links. + category: navigation + schema: footer.schema.json + template: footer.ninjatpl diff --git a/blocks/botanical_divider.ninjatpl b/blocks/botanical_divider.ninjatpl new file mode 100644 index 0000000..62e22b1 --- /dev/null +++ b/blocks/botanical_divider.ninjatpl @@ -0,0 +1,5 @@ + diff --git a/schemas/botanical_divider.schema.json b/blocks/botanical_divider.schema.json similarity index 100% rename from schemas/botanical_divider.schema.json rename to blocks/botanical_divider.schema.json diff --git a/blocks/donation_cta.ninjatpl b/blocks/donation_cta.ninjatpl new file mode 100644 index 0000000..e3dd95d --- /dev/null +++ b/blocks/donation_cta.ninjatpl @@ -0,0 +1,16 @@ +
+
+ {% if headline %}

{{ headline }}

{% endif %} + {% if body %}
{{ body|safe }}
{% endif %} +
+
+ {% if amounts %}{% for a in amounts %}{% endfor %}{% else %}{% endif %} +
+
+ + + +
+
+
+
diff --git a/schemas/donation_cta.schema.json b/blocks/donation_cta.schema.json similarity index 100% rename from schemas/donation_cta.schema.json rename to blocks/donation_cta.schema.json diff --git a/blocks/field_note.ninjatpl b/blocks/field_note.ninjatpl new file mode 100644 index 0000000..74735e0 --- /dev/null +++ b/blocks/field_note.ninjatpl @@ -0,0 +1,8 @@ +
+
+ + +
+ {% if image %}
{% endif %} + {% if body %}
{{ body|safe }}
{% else %}

No dispatch yet — add a body to share what you saw in the field.

{% endif %} +
diff --git a/schemas/field_note.schema.json b/blocks/field_note.schema.json similarity index 100% rename from schemas/field_note.schema.json rename to blocks/field_note.schema.json diff --git a/blocks/footer.ninjatpl b/blocks/footer.ninjatpl new file mode 100644 index 0000000..96c4751 --- /dev/null +++ b/blocks/footer.ninjatpl @@ -0,0 +1,17 @@ + diff --git a/schemas/footer.schema.json b/blocks/footer.schema.json similarity index 100% rename from schemas/footer.schema.json rename to blocks/footer.schema.json diff --git a/blocks/impact_metrics.ninjatpl b/blocks/impact_metrics.ninjatpl new file mode 100644 index 0000000..1d46d59 --- /dev/null +++ b/blocks/impact_metrics.ninjatpl @@ -0,0 +1,7 @@ +
+
+ {% if title %}

{{ title }}

{% endif %} + {% if illustration %}
{% elif title or metrics %}
{% endif %} + {% if metrics %}
{% for m in metrics %}
{{ m.value }}{{ m.suffix }}
{{ m.label }}
{% endfor %}
{% else %}

Add impact metrics to bring this section to life.

{% endif %} +
+
diff --git a/schemas/impact_metrics.schema.json b/blocks/impact_metrics.schema.json similarity index 100% rename from schemas/impact_metrics.schema.json rename to blocks/impact_metrics.schema.json diff --git a/blocks/partner_logos.ninjatpl b/blocks/partner_logos.ninjatpl new file mode 100644 index 0000000..0dbc24c --- /dev/null +++ b/blocks/partner_logos.ninjatpl @@ -0,0 +1,6 @@ +
+
+ {% if title %}

{{ title }}

{% endif %} + {% if logos %}
{% for logo in logos %}
{% if logo.url %}{% if logo.image %}{{ logo.name }}{% else %}
{% if logo.name %}{% for w in logo.name|split:" " %}{% if forloop.Counter <= 2 %}{{ w|first }}{% endif %}{% endfor %}{% else %}?{% endif %}
{% endif %}
{% else %}{% endif %}
{% endfor %}
{% else %}

Add partner logos to fill this grid.

{% endif %} +
+
diff --git a/schemas/partner_logos.schema.json b/blocks/partner_logos.schema.json similarity index 100% rename from schemas/partner_logos.schema.json rename to blocks/partner_logos.schema.json diff --git a/botanical_divider.go b/botanical_divider.go deleted file mode 100644 index 70840e6..0000000 --- a/botanical_divider.go +++ /dev/null @@ -1,43 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/blocks" -) - -// BotanicalDividerBlockMeta defines metadata for the botanical divider block. -var BotanicalDividerBlockMeta = blocks.BlockMeta{ - Key: "botanical_divider", - Title: "Botanical Divider", - Description: "Hand-illustrated SVG section break", - Source: "earthen", - Category: blocks.CategoryLayout, -} - -// BotanicalDividerBlock renders the botanical divider block. -// Content shape: {motif:"fern"|"root"|"seed"} -func BotanicalDividerBlock(ctx context.Context, content map[string]any) string { - motif := getString(content, "motif") - switch motif { - case "fern", "root", "seed": - default: - motif = "fern" - } - - data := BotanicalDividerData{ - Motif: motif, - Empty: len(content) == 0, - } - - var buf bytes.Buffer - _ = botanicalDividerComponent(data).Render(ctx, &buf) - return buf.String() -} - -// BotanicalDividerData contains data for the divider component. -type BotanicalDividerData struct { - Motif string - Empty bool -} diff --git a/botanical_divider.templ b/botanical_divider.templ deleted file mode 100644 index e738c7f..0000000 --- a/botanical_divider.templ +++ /dev/null @@ -1,79 +0,0 @@ -package main - -// botanicalDividerComponent renders a centred botanical SVG flourish flanked by hairlines. -templ botanicalDividerComponent(data BotanicalDividerData) { - -} - -// botanicalGlyph renders the SVG illustration for the named motif. -templ botanicalGlyph(motif string, size int) { - switch motif { - case "root": - - - - - - case "seed": - - - - - default: - - - - - - - - } -} diff --git a/botanical_divider_templ.go b/botanical_divider_templ.go deleted file mode 100644 index e2ac853..0000000 --- a/botanical_divider_templ.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// botanicalDividerComponent renders a centred botanical SVG flourish flanked by hairlines. -func botanicalDividerComponent(data BotanicalDividerData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = botanicalGlyph(data.Motif, 48).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -// botanicalGlyph renders the SVG illustration for the named motif. -func botanicalGlyph(motif string, size int) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - switch motif { - case "root": - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case "seed": - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - default: - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return nil - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/button_override.go b/button_override.go deleted file mode 100644 index a95298c..0000000 --- a/button_override.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "bytes" - "context" -) - -// EarthenButtonBlock renders a button with Earthen styling. -// Content expects: {"label": "...", "url": "...", "variant": "primary|secondary|ghost|destructive"} -func EarthenButtonBlock(ctx context.Context, content map[string]any) string { - label := getString(content, "label") - if label == "" { - label = getString(content, "text") - } - url := getString(content, "url") - if url == "" { - url = getString(content, "href") - } - variant := getString(content, "variant") - if variant == "" { - variant = "primary" - } - - var buf bytes.Buffer - _ = earthenButtonComponent(label, url, variant).Render(ctx, &buf) - return buf.String() -} diff --git a/button_override.templ b/button_override.templ deleted file mode 100644 index e9e7a4a..0000000 --- a/button_override.templ +++ /dev/null @@ -1,34 +0,0 @@ -package main - -// earthenButtonStyle returns inline CSS based on variant. -func earthenButtonStyle(variant string) string { - switch variant { - case "secondary": - return "background-color: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); border: 1px solid hsl(var(--border));" - case "ghost": - return "background-color: transparent; color: hsl(var(--primary)); border: 1.5px dashed hsl(var(--primary) / 0.6);" - case "destructive": - return "background-color: hsl(var(--destructive)); color: hsl(var(--destructive-foreground));" - default: - return "background-color: hsl(var(--accent)); color: hsl(var(--accent-foreground));" - } -} - -// earthenButtonComponent renders a clay-fired button with Earthen styling. -templ earthenButtonComponent(label, url, variant string) { - - { label } - -} - -func earthenButtonURL(url string) string { - if url == "" { - return "#" - } - return url -} diff --git a/button_override_templ.go b/button_override_templ.go deleted file mode 100644 index 60957a3..0000000 --- a/button_override_templ.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// earthenButtonStyle returns inline CSS based on variant. -func earthenButtonStyle(variant string) string { - switch variant { - case "secondary": - return "background-color: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); border: 1px solid hsl(var(--border));" - case "ghost": - return "background-color: transparent; color: hsl(var(--primary)); border: 1.5px dashed hsl(var(--primary) / 0.6);" - case "destructive": - return "background-color: hsl(var(--destructive)); color: hsl(var(--destructive-foreground));" - default: - return "background-color: hsl(var(--accent)); color: hsl(var(--accent-foreground));" - } -} - -// earthenButtonComponent renders a clay-fired button with Earthen styling. -func earthenButtonComponent(label, url, variant string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(label) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `button_override.templ`, Line: 25, Col: 9} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -func earthenButtonURL(url string) string { - if url == "" { - return "#" - } - return url -} - -var _ = templruntime.GeneratedTemplate diff --git a/card_override.go b/card_override.go deleted file mode 100644 index c0b3e1f..0000000 --- a/card_override.go +++ /dev/null @@ -1,33 +0,0 @@ -package main - -import ( - "bytes" - "context" -) - -// EarthenCardBlock renders a card with softer radius and ink-edge border. -// Content expects: {"title":"…","body":"…","image":"…","link":"…","linkLabel":"…"} -func EarthenCardBlock(ctx context.Context, content map[string]any) string { - data := EarthenCardData{ - Title: getString(content, "title"), - Body: getString(content, "body"), - Image: getString(content, "image"), - Link: getString(content, "link"), - LinkLabel: getString(content, "linkLabel"), - Empty: len(content) == 0, - } - - var buf bytes.Buffer - _ = earthenCardComponent(data).Render(ctx, &buf) - return buf.String() -} - -// EarthenCardData is the data shape for the card override component. -type EarthenCardData struct { - Title string - Body string - Image string - Link string - LinkLabel string - Empty bool -} diff --git a/card_override.templ b/card_override.templ deleted file mode 100644 index c66ed4e..0000000 --- a/card_override.templ +++ /dev/null @@ -1,46 +0,0 @@ -package main - -// earthenCardComponent renders a card with soft radius and ink-edge border. -templ earthenCardComponent(data EarthenCardData) { - -} diff --git a/card_override_templ.go b/card_override_templ.go deleted file mode 100644 index f0d6e2d..0000000 --- a/card_override_templ.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// earthenCardComponent renders a card with soft radius and ink-edge border. -func earthenCardComponent(data EarthenCardData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Image != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
\"")
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.Title != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(data.Title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `card_override.templ`, Line: 20, Col: 16} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.Body != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Body).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.Link != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.LinkLabel != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var8 string - templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(data.LinkLabel) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `card_override.templ`, Line: 38, Col: 27} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "Read more ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/donation_cta.go b/donation_cta.go deleted file mode 100644 index 420e377..0000000 --- a/donation_cta.go +++ /dev/null @@ -1,67 +0,0 @@ -package main - -import ( - "bytes" - "context" - "strconv" - - "git.dev.alexdunmow.com/block/core/blocks" -) - -// DonationCTABlockMeta defines metadata for the donation CTA block. -var DonationCTABlockMeta = blocks.BlockMeta{ - Key: "donation_cta", - Title: "Donation CTA", - Description: "Donation call-to-action with preset amount tiles and custom amount field", - Source: "earthen", - Category: blocks.CategoryContent, -} - -// DonationCTABlock renders the donation call-to-action block. -// Content shape: {headline, body, amounts:[int], buttonLabel, processorUrl} -func DonationCTABlock(ctx context.Context, content map[string]any) string { - amounts := getNumberSlice(content, "amounts") - if len(amounts) == 0 { - amounts = []float64{25, 50, 100} - } - - tiles := make([]DonationTile, 0, len(amounts)) - for _, a := range amounts { - tiles = append(tiles, DonationTile{ - Value: a, - Label: "$" + strconv.FormatFloat(a, 'f', -1, 64), - }) - } - - data := DonationCTAData{ - Headline: getString(content, "headline"), - Body: getString(content, "body"), - ButtonLabel: getString(content, "buttonLabel"), - ProcessorURL: getString(content, "processorUrl"), - Tiles: tiles, - Empty: len(content) == 0, - } - if data.ButtonLabel == "" { - data.ButtonLabel = "Donate" - } - - var buf bytes.Buffer - _ = donationCTAComponent(data).Render(ctx, &buf) - return buf.String() -} - -// DonationCTAData contains data for the donation CTA component. -type DonationCTAData struct { - Headline string - Body string - ButtonLabel string - ProcessorURL string - Tiles []DonationTile - Empty bool -} - -// DonationTile is a single preset amount tile. -type DonationTile struct { - Value float64 - Label string -} diff --git a/donation_cta.templ b/donation_cta.templ deleted file mode 100644 index 65d1599..0000000 --- a/donation_cta.templ +++ /dev/null @@ -1,79 +0,0 @@ -package main - -import "strconv" - -// donationCTAComponent renders the moss/clay donation CTA section. -templ donationCTAComponent(data DonationCTAData) { -
-
- if data.Headline != "" { -

- { data.Headline } -

- } - if data.Body != "" { -
- @templ.Raw(data.Body) -
- } -
-
- for i, tile := range data.Tiles { - - } -
-
- - - -
-
-
-
-} - -func donationFormAction(url string) string { - if url == "" { - return "#" - } - return url -} diff --git a/donation_cta_templ.go b/donation_cta_templ.go deleted file mode 100644 index 9c4e889..0000000 --- a/donation_cta_templ.go +++ /dev/null @@ -1,195 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import "strconv" - -// donationCTAComponent renders the moss/clay donation CTA section. -func donationCTAComponent(data DonationCTAData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Headline != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(data.Headline) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `donation_cta.templ`, Line: 19, Col: 20} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.Body != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Body).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - for i, tile := range data.Tiles { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -func donationFormAction(url string) string { - if url == "" { - return "#" - } - return url -} - -var _ = templruntime.GeneratedTemplate diff --git a/email_wrapper.go b/email_wrapper.go deleted file mode 100644 index 7917f54..0000000 --- a/email_wrapper.go +++ /dev/null @@ -1,17 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/templates" -) - -// EarthenEmailWrapper wraps body content in a botanical cream-and-moss email frame. -func EarthenEmailWrapper(body string, emailCtx templates.EmailContext) string { - var buf bytes.Buffer - if err := earthenEmailTemplate(emailCtx, body).Render(context.Background(), &buf); err != nil { - return body - } - return buf.String() -} diff --git a/email_wrapper.templ b/email_wrapper.templ deleted file mode 100644 index 52f0532..0000000 --- a/email_wrapper.templ +++ /dev/null @@ -1,154 +0,0 @@ -package main - -import ( - "fmt" - - "git.dev.alexdunmow.com/block/core/templates" -) - -// earthenEmailTemplate renders the cream/moss email wrapper. -templ earthenEmailTemplate(emailCtx templates.EmailContext, body string) { - - - - - - - - - { emailCtx.SiteSettings.SiteName } - - - if emailCtx.PreviewText != "" { -
- { emailCtx.PreviewText } -
- } - - - - -
- - - - - - - - - - -
- if emailCtx.SiteSettings.LogoURL != "" { - { - } else if emailCtx.SiteSettings.SiteName != "" { -

- { emailCtx.SiteSettings.SiteName } -

- } -
- @templ.Raw(body) -
- - - - -
-

- { emailCtx.SiteSettings.SiteName } -

-

- Registered charity. We respect your inbox. -

- if emailCtx.SiteSettings.SiteURL != "" { -

- - { emailCtx.SiteSettings.SiteURL } - -

- } - if emailCtx.UnsubscribeURL != "" { -

- - Unsubscribe - -

- } else { -

- - Unsubscribe - -

- } -
-
-
- - -} - -// Email colour helpers — fall back to cream/moss defaults when EmailColors are empty. -func earthenEmailBg(emailCtx templates.EmailContext) string { - if emailCtx.Colors.Background != "" { - return emailCtx.Colors.Background - } - return "#F6F1E6" -} - -func earthenEmailCard(emailCtx templates.EmailContext) string { - if emailCtx.Colors.Card != "" { - return emailCtx.Colors.Card - } - return "#FCF9F2" -} - -func earthenEmailFg(emailCtx templates.EmailContext) string { - if emailCtx.Colors.Foreground != "" { - return emailCtx.Colors.Foreground - } - return "#2D3A28" -} - -func earthenEmailPrimary(emailCtx templates.EmailContext) string { - if emailCtx.Colors.Primary != "" { - return emailCtx.Colors.Primary - } - return "#3A5A36" -} - -func earthenEmailPrimaryFg(emailCtx templates.EmailContext) string { - if emailCtx.Colors.PrimaryForeground != "" { - return emailCtx.Colors.PrimaryForeground - } - return "#F6F1E6" -} - -func earthenEmailBorder(emailCtx templates.EmailContext) string { - if emailCtx.Colors.Border != "" { - return emailCtx.Colors.Border - } - return "#D6D1C2" -} - -func earthenEmailMuted(emailCtx templates.EmailContext) string { - if emailCtx.Colors.Muted != "" { - return emailCtx.Colors.Muted - } - return "#EFEBDF" -} - -func earthenEmailMutedFg(emailCtx templates.EmailContext) string { - if emailCtx.Colors.MutedForeground != "" { - return emailCtx.Colors.MutedForeground - } - return "#6E7560" -} diff --git a/email_wrapper_templ.go b/email_wrapper_templ.go deleted file mode 100644 index 0192298..0000000 --- a/email_wrapper_templ.go +++ /dev/null @@ -1,470 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "fmt" - - "git.dev.alexdunmow.com/block/core/templates" -) - -// earthenEmailTemplate renders the cream/moss email wrapper. -func earthenEmailTemplate(emailCtx templates.EmailContext, body string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(emailCtx.SiteSettings.SiteName) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `email_wrapper.templ`, Line: 27, Col: 42} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if emailCtx.PreviewText != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(emailCtx.PreviewText) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `email_wrapper.templ`, Line: 32, Col: 27} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if emailCtx.SiteSettings.LogoURL != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "\"")") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else if emailCtx.SiteSettings.SiteName != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var11 string - templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(emailCtx.SiteSettings.SiteName) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `email_wrapper.templ`, Line: 45, Col: 43} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(body).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var15 string - templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(emailCtx.SiteSettings.SiteName) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `email_wrapper.templ`, Line: 61, Col: 45} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "

Registered charity. We respect your inbox.

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if emailCtx.SiteSettings.SiteURL != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var20 string - templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(emailCtx.SiteSettings.SiteURL) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `email_wrapper.templ`, Line: 69, Col: 46} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if emailCtx.UnsubscribeURL != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "

Unsubscribe

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "

Unsubscribe

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -// Email colour helpers — fall back to cream/moss defaults when EmailColors are empty. -func earthenEmailBg(emailCtx templates.EmailContext) string { - if emailCtx.Colors.Background != "" { - return emailCtx.Colors.Background - } - return "#F6F1E6" -} - -func earthenEmailCard(emailCtx templates.EmailContext) string { - if emailCtx.Colors.Card != "" { - return emailCtx.Colors.Card - } - return "#FCF9F2" -} - -func earthenEmailFg(emailCtx templates.EmailContext) string { - if emailCtx.Colors.Foreground != "" { - return emailCtx.Colors.Foreground - } - return "#2D3A28" -} - -func earthenEmailPrimary(emailCtx templates.EmailContext) string { - if emailCtx.Colors.Primary != "" { - return emailCtx.Colors.Primary - } - return "#3A5A36" -} - -func earthenEmailPrimaryFg(emailCtx templates.EmailContext) string { - if emailCtx.Colors.PrimaryForeground != "" { - return emailCtx.Colors.PrimaryForeground - } - return "#F6F1E6" -} - -func earthenEmailBorder(emailCtx templates.EmailContext) string { - if emailCtx.Colors.Border != "" { - return emailCtx.Colors.Border - } - return "#D6D1C2" -} - -func earthenEmailMuted(emailCtx templates.EmailContext) string { - if emailCtx.Colors.Muted != "" { - return emailCtx.Colors.Muted - } - return "#EFEBDF" -} - -func earthenEmailMutedFg(emailCtx templates.EmailContext) string { - if emailCtx.Colors.MutedForeground != "" { - return emailCtx.Colors.MutedForeground - } - return "#6E7560" -} - -var _ = templruntime.GeneratedTemplate diff --git a/embed.go b/embed.go deleted file mode 100644 index 41c5114..0000000 --- a/embed.go +++ /dev/null @@ -1,64 +0,0 @@ -package main - -import ( - "embed" - "io/fs" - "net/http" - - "git.dev.alexdunmow.com/block/core/plugin" -) - -//go:embed assets/* -var assetsFS embed.FS - -//go:embed schemas/* -var schemasFS embed.FS - -//go:embed presets.json -var presetsData []byte - -//go:embed fonts.json -var fontsData []byte - -//go:embed plugin.mod -var pluginModBytes []byte - -// Assets returns the embedded assets filesystem. -func Assets() fs.FS { - sub, _ := fs.Sub(assetsFS, "assets") - return sub -} - -// Schemas returns the embedded schemas filesystem. -func Schemas() fs.FS { - sub, _ := fs.Sub(schemasFS, "schemas") - return sub -} - -// AssetsHandler returns an http.Handler that serves the embedded assets. -func AssetsHandler() http.Handler { - return http.FileServer(http.FS(Assets())) -} - -// ThemePresets returns the embedded theme presets JSON. -func ThemePresets() []byte { - return presetsData -} - -// BundledFonts returns the embedded fonts manifest JSON. -func BundledFonts() []byte { - return fontsData -} - -// ThemeCSSManifest returns the theme's custom CSS utilities injected into -// the host Tailwind input so paper-grain, drop-cap, and botanical rules -// survive the global purge. -func ThemeCSSManifest() *plugin.CSSManifest { - css, err := assetsFS.ReadFile("assets/css/earthen.css") - if err != nil { - return &plugin.CSSManifest{} - } - return &plugin.CSSManifest{ - InputCSSAppend: string(css), - } -} diff --git a/field_note.go b/field_note.go deleted file mode 100644 index a0da6bf..0000000 --- a/field_note.go +++ /dev/null @@ -1,44 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/blocks" -) - -// FieldNoteBlockMeta defines metadata for the field note block. -var FieldNoteBlockMeta = blocks.BlockMeta{ - Key: "field_note", - Title: "Field Note", - Description: "Article-style dispatch from the field with byline and location", - Source: "earthen", - Category: blocks.CategoryContent, -} - -// FieldNoteBlock renders the field note block. -// Content shape: {author, location, dateline, body, image} -func FieldNoteBlock(ctx context.Context, content map[string]any) string { - data := FieldNoteData{ - Author: getString(content, "author"), - Location: getString(content, "location"), - Dateline: getString(content, "dateline"), - Body: getString(content, "body"), - Image: getString(content, "image"), - Empty: len(content) == 0, - } - - var buf bytes.Buffer - _ = fieldNoteComponent(data).Render(ctx, &buf) - return buf.String() -} - -// FieldNoteData contains data for the field note component. -type FieldNoteData struct { - Author string - Location string - Dateline string - Body string - Image string - Empty bool -} diff --git a/field_note.templ b/field_note.templ deleted file mode 100644 index 2c20bae..0000000 --- a/field_note.templ +++ /dev/null @@ -1,52 +0,0 @@ -package main - -// fieldNoteComponent renders an article-style dispatch from the field. -templ fieldNoteComponent(data FieldNoteData) { -
-
- - -
- if data.Image != "" { -
- -
- } - if data.Body != "" { -
- @templ.Raw(data.Body) -
- } else { -

- No dispatch yet — add a body to share what you saw in the field. -

- } -
-} diff --git a/field_note_templ.go b/field_note_templ.go deleted file mode 100644 index 6d49abe..0000000 --- a/field_note_templ.go +++ /dev/null @@ -1,175 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// fieldNoteComponent renders an article-style dispatch from the field. -func fieldNoteComponent(data FieldNoteData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = botanicalGlyph("seed", 28).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Image != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
\"\"
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.Body != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Body).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "

No dispatch yet — add a body to share what you saw in the field.

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/footer.go b/footer.go deleted file mode 100644 index a68aaea..0000000 --- a/footer.go +++ /dev/null @@ -1,69 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/blocks" -) - -// FooterBlockMeta defines metadata for the earthen footer block. -var FooterBlockMeta = blocks.BlockMeta{ - Key: "footer", - Title: "Site Footer", - Description: "Cream-on-moss footer with optional newsletter and column links", - Source: "earthen", - Category: blocks.CategoryNavigation, -} - -// FooterBlock renders the earthen footer block. -// Content shape: {showNewsletter, tagline, columns:[{title,links:[{text,url}]}]} -func FooterBlock(ctx context.Context, content map[string]any) string { - rawColumns := getSlice(content, "columns") - columns := make([]FooterColumn, 0, len(rawColumns)) - for _, c := range rawColumns { - rawLinks := getSlice(c, "links") - links := make([]FooterLink, 0, len(rawLinks)) - for _, l := range rawLinks { - links = append(links, FooterLink{ - Text: getString(l, "text"), - URL: getString(l, "url"), - }) - } - columns = append(columns, FooterColumn{ - Title: getString(c, "title"), - Links: links, - }) - } - - data := FooterData{ - ShowNewsletter: getBool(content, "showNewsletter", false), - Tagline: getString(content, "tagline"), - Columns: columns, - Empty: len(content) == 0, - } - - var buf bytes.Buffer - _ = footerComponent(data).Render(ctx, &buf) - return buf.String() -} - -// FooterData contains data for the footer component. -type FooterData struct { - ShowNewsletter bool - Tagline string - Columns []FooterColumn - Empty bool -} - -// FooterColumn is a single link column in the footer. -type FooterColumn struct { - Title string - Links []FooterLink -} - -// FooterLink is a single link in a footer column. -type FooterLink struct { - Text string - URL string -} diff --git a/footer.templ b/footer.templ deleted file mode 100644 index e1d9333..0000000 --- a/footer.templ +++ /dev/null @@ -1,104 +0,0 @@ -package main - -// footerComponent renders the cream-on-moss footer with optional newsletter and link columns. -templ footerComponent(data FooterData) { - -} - -// footerGridCols returns a responsive grid class for the footer column count. -func footerGridCols(count int) string { - switch count { - case 1: - return "grid-cols-1" - case 2: - return "grid-cols-1 sm:grid-cols-2" - case 3: - return "grid-cols-1 sm:grid-cols-3" - default: - return "grid-cols-2 lg:grid-cols-4" - } -} - -func footerLinkURL(url string) string { - if url == "" { - return "#" - } - return url -} diff --git a/footer_templ.go b/footer_templ.go deleted file mode 100644 index 6060889..0000000 --- a/footer_templ.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// footerComponent renders the cream-on-moss footer with optional newsletter and link columns. -func footerComponent(data FooterData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -// footerGridCols returns a responsive grid class for the footer column count. -func footerGridCols(count int) string { - switch count { - case 1: - return "grid-cols-1" - case 2: - return "grid-cols-1 sm:grid-cols-2" - case 3: - return "grid-cols-1 sm:grid-cols-3" - default: - return "grid-cols-2 lg:grid-cols-4" - } -} - -func footerLinkURL(url string) string { - if url == "" { - return "#" - } - return url -} - -var _ = templruntime.GeneratedTemplate diff --git a/go.mod b/go.mod deleted file mode 100644 index 1d0421c..0000000 --- a/go.mod +++ /dev/null @@ -1,20 +0,0 @@ -module git.dev.alexdunmow.com/block/themes/earthen - -go 1.26.4 - -require ( - git.dev.alexdunmow.com/block/core v0.15.2 - github.com/a-h/templ v0.3.1020 -) - -require ( - connectrpc.com/connect v1.20.0 // indirect - github.com/BurntSushi/toml v1.6.0 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect - github.com/jackc/pgx/v5 v5.9.2 // indirect - golang.org/x/mod v0.34.0 // indirect - golang.org/x/text v0.36.0 // indirect - google.golang.org/protobuf v1.36.11 // indirect -) diff --git a/go.sum b/go.sum deleted file mode 100644 index ebd3d11..0000000 --- a/go.sum +++ /dev/null @@ -1,46 +0,0 @@ -connectrpc.com/connect v1.20.0 h1:6TNDAB+WeNd2uolWNlYczB5E0KNNaVMNUEx8JEUsPmQ= -connectrpc.com/connect v1.20.0/go.mod h1:A2ygJrukXwWy32vkCAAHNVguZrqZ+jeZ9rGRnGR4dN4= -git.dev.alexdunmow.com/block/core v0.15.2 h1:qTjJxa1pClxwehkdTxXiJDpHQLr5DoXBUCa40QRO0L8= -git.dev.alexdunmow.com/block/core v0.15.2/go.mod h1:A+mgA9oeWoPhXruv4Mjpywwl2A9B5I3cKzlJjalBdlE= -github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= -github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/a-h/templ v0.3.1020 h1:ypAT/L5ySWEnZ6Zft/5yfoWXYYkhFNvEFOeeqecg4tw= -github.com/a-h/templ v0.3.1020/go.mod h1:A2DlK61v+K+NRoGnhmYbNYVmtYHcFO5/AisMvBdDxTM= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= -github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= -github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= -github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.9.2 h1:3ZhOzMWnR4yJ+RW1XImIPsD1aNSz4T4fyP7zlQb56hw= -github.com/jackc/pgx/v5 v5.9.2/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= -github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= -github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -github.com/tetratelabs/wazero v1.12.0 h1:DuWcpNu/FzgEXgGBDp8J1Spc+CWOvvtvVyjKlaZopYU= -github.com/tetratelabs/wazero v1.12.0/go.mod h1:LvKtzl2RqO4gyF27BiXU+nKAjcV8f38U+kP/q2vgxh0= -golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI= -golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY= -golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/sys v0.44.0 h1:ildZl3J4uzeKP07r2F++Op7E9B29JRUy+a27EibtBTQ= -golang.org/x/sys v0.44.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= -golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= -google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= -google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/heading_override.go b/heading_override.go deleted file mode 100644 index 3205bd4..0000000 --- a/heading_override.go +++ /dev/null @@ -1,40 +0,0 @@ -package main - -import ( - "bytes" - "context" - "strconv" -) - -// EarthenHeadingBlock renders a heading with Earthen styling. -// Content expects: {"text": "Heading text", "level": 1-6, "textClass": "optional"} -func EarthenHeadingBlock(ctx context.Context, content map[string]any) string { - text := getString(content, "text") - textClass := getString(content, "textClass") - level := parseHeadingLevel(content) - - var buf bytes.Buffer - _ = earthenHeadingComponent(level, text, textClass).Render(ctx, &buf) - return buf.String() -} - -// parseHeadingLevel parses the level from content, defaulting to 2. -func parseHeadingLevel(content map[string]any) int { - if level, ok := content["level"].(float64); ok { - l := int(level) - if l >= 1 && l <= 6 { - return l - } - } - if level, ok := content["level"].(int); ok { - if level >= 1 && level <= 6 { - return level - } - } - if level, ok := content["level"].(string); ok { - if l, err := strconv.Atoi(level); err == nil && l >= 1 && l <= 6 { - return l - } - } - return 2 -} diff --git a/heading_override.templ b/heading_override.templ deleted file mode 100644 index 4112864..0000000 --- a/heading_override.templ +++ /dev/null @@ -1,76 +0,0 @@ -package main - -// earthenHeadingBaseClass returns base classes for each heading level. -func earthenHeadingBaseClass(level int) string { - switch level { - case 1: - return "earthen-h1 text-5xl md:text-6xl font-semibold tracking-tight leading-tight" - case 2: - return "earthen-h2 text-3xl md:text-4xl font-semibold leading-snug crayon-underline" - case 3: - return "earthen-h3 text-2xl md:text-3xl font-semibold leading-snug" - case 4: - return "earthen-h4 text-xl md:text-2xl font-semibold" - case 5: - return "earthen-h5 text-lg font-semibold" - case 6: - return "earthen-h6 text-base font-semibold uppercase tracking-wider" - default: - return "earthen-h2 text-3xl md:text-4xl font-semibold" - } -} - -// earthenHeadingComponent renders a heading with Earthen styling. -templ earthenHeadingComponent(level int, text, textClass string) { - switch level { - case 1: -

- { text } -

- case 2: -

- { text } -

- case 3: -

- { text } -

- case 4: -

- { text } -

- case 5: -
- { text } -
- case 6: -
- { text } -
- default: -

- { text } -

- } -} diff --git a/heading_override_templ.go b/heading_override_templ.go deleted file mode 100644 index b48969f..0000000 --- a/heading_override_templ.go +++ /dev/null @@ -1,402 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// earthenHeadingBaseClass returns base classes for each heading level. -func earthenHeadingBaseClass(level int) string { - switch level { - case 1: - return "earthen-h1 text-5xl md:text-6xl font-semibold tracking-tight leading-tight" - case 2: - return "earthen-h2 text-3xl md:text-4xl font-semibold leading-snug crayon-underline" - case 3: - return "earthen-h3 text-2xl md:text-3xl font-semibold leading-snug" - case 4: - return "earthen-h4 text-xl md:text-2xl font-semibold" - case 5: - return "earthen-h5 text-lg font-semibold" - case 6: - return "earthen-h6 text-base font-semibold uppercase tracking-wider" - default: - return "earthen-h2 text-3xl md:text-4xl font-semibold" - } -} - -// earthenHeadingComponent renders a heading with Earthen styling. -func earthenHeadingComponent(level int, text, textClass string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - switch level { - case 1: - var templ_7745c5c3_Var2 = []any{earthenHeadingBaseClass(1), textClass} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var2...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `heading_override.templ`, Line: 31, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case 2: - var templ_7745c5c3_Var6 = []any{earthenHeadingBaseClass(2), textClass} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var6...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var9 string - templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `heading_override.templ`, Line: 38, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case 3: - var templ_7745c5c3_Var10 = []any{earthenHeadingBaseClass(3), textClass} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var10...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var13 string - templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `heading_override.templ`, Line: 45, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case 4: - var templ_7745c5c3_Var14 = []any{earthenHeadingBaseClass(4), textClass} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var14...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var17 string - templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `heading_override.templ`, Line: 52, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case 5: - var templ_7745c5c3_Var18 = []any{earthenHeadingBaseClass(5), textClass} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var18...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var21 string - templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `heading_override.templ`, Line: 59, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case 6: - var templ_7745c5c3_Var22 = []any{earthenHeadingBaseClass(6), textClass} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var22...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var25 string - templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `heading_override.templ`, Line: 66, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - default: - var templ_7745c5c3_Var26 = []any{earthenHeadingBaseClass(2), textClass} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var26...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var29 string - templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `heading_override.templ`, Line: 73, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return nil - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/helpers.go b/helpers.go deleted file mode 100644 index 27ef2d5..0000000 --- a/helpers.go +++ /dev/null @@ -1,48 +0,0 @@ -package main - -// getString extracts a string value from content map. -func getString(content map[string]any, key string) string { - if v, ok := content[key].(string); ok { - return v - } - return "" -} - -// getBool extracts a bool value from content map. Defaults to defaultVal. -func getBool(content map[string]any, key string, defaultVal bool) bool { - if v, ok := content[key].(bool); ok { - return v - } - return defaultVal -} - -// getSlice extracts a slice of maps from content. -func getSlice(content map[string]any, key string) []map[string]any { - if v, ok := content[key].([]any); ok { - result := make([]map[string]any, 0, len(v)) - for _, item := range v { - if m, ok := item.(map[string]any); ok { - result = append(result, m) - } - } - return result - } - return nil -} - -// getNumberSlice extracts a slice of numbers from content. Handles JSON float64. -func getNumberSlice(content map[string]any, key string) []float64 { - if v, ok := content[key].([]any); ok { - result := make([]float64, 0, len(v)) - for _, item := range v { - switch n := item.(type) { - case float64: - result = append(result, n) - case int: - result = append(result, float64(n)) - } - } - return result - } - return nil -} diff --git a/image_override.go b/image_override.go deleted file mode 100644 index b00e0a9..0000000 --- a/image_override.go +++ /dev/null @@ -1,21 +0,0 @@ -package main - -import ( - "bytes" - "context" -) - -// EarthenImageBlock renders an image with paper-grain frame and optional caption. -// Content expects: {"src":"…","alt":"…","caption":"…"} -func EarthenImageBlock(ctx context.Context, content map[string]any) string { - src := getString(content, "src") - if src == "" { - src = getString(content, "url") - } - alt := getString(content, "alt") - caption := getString(content, "caption") - - var buf bytes.Buffer - _ = earthenImageComponent(src, alt, caption).Render(ctx, &buf) - return buf.String() -} diff --git a/image_override.templ b/image_override.templ deleted file mode 100644 index 537e4c7..0000000 --- a/image_override.templ +++ /dev/null @@ -1,35 +0,0 @@ -package main - -// earthenImageComponent renders an image inside a paper-grain frame, with an optional handwritten caption. -templ earthenImageComponent(src, alt, caption string) { -
- if src != "" { -
- { -
- } else { -
- Choose an image to display here -
- } - if caption != "" { -
- { caption } -
- } -
-} diff --git a/image_override_templ.go b/image_override_templ.go deleted file mode 100644 index 09a18d6..0000000 --- a/image_override_templ.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// earthenImageComponent renders an image inside a paper-grain frame, with an optional handwritten caption. -func earthenImageComponent(src, alt, caption string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if src != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "
\"")
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
Choose an image to display here
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if caption != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(caption) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `image_override.templ`, Line: 31, Col: 13} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/impact_metrics.go b/impact_metrics.go deleted file mode 100644 index c9c253a..0000000 --- a/impact_metrics.go +++ /dev/null @@ -1,58 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/blocks" -) - -// ImpactMetricsBlockMeta defines metadata for the impact metrics block. -var ImpactMetricsBlockMeta = blocks.BlockMeta{ - Key: "impact_metrics", - Title: "Impact Metrics", - Description: "Numerical impact metrics with optional botanical illustration", - Source: "earthen", - Category: blocks.CategoryContent, -} - -// ImpactMetricsBlock renders a row of impact metrics. -// Content shape: {title, metrics:[{value,label,suffix}], illustration} -func ImpactMetricsBlock(ctx context.Context, content map[string]any) string { - rawMetrics := getSlice(content, "metrics") - - items := make([]ImpactMetric, 0, len(rawMetrics)) - for _, m := range rawMetrics { - items = append(items, ImpactMetric{ - Value: getString(m, "value"), - Label: getString(m, "label"), - Suffix: getString(m, "suffix"), - }) - } - - data := ImpactMetricsData{ - Title: getString(content, "title"), - Illustration: getString(content, "illustration"), - Metrics: items, - Empty: len(content) == 0, - } - - var buf bytes.Buffer - _ = impactMetricsComponent(data).Render(ctx, &buf) - return buf.String() -} - -// ImpactMetricsData contains data for the impact metrics component. -type ImpactMetricsData struct { - Title string - Illustration string - Metrics []ImpactMetric - Empty bool -} - -// ImpactMetric is one numerical metric tile. -type ImpactMetric struct { - Value string - Label string - Suffix string -} diff --git a/impact_metrics.templ b/impact_metrics.templ deleted file mode 100644 index 5507dd6..0000000 --- a/impact_metrics.templ +++ /dev/null @@ -1,82 +0,0 @@ -package main - -// impactMetricsComponent renders a row of impact metrics with optional botanical illustration. -templ impactMetricsComponent(data ImpactMetricsData) { -
-
- if data.Title != "" { -

- { data.Title } -

- } - if data.Illustration != "" { -
- -
- } else if data.Title != "" || len(data.Metrics) > 0 { -
- @botanicalGlyph("fern", 64) -
- } - if len(data.Metrics) > 0 { -
- for _, m := range data.Metrics { -
-
- { m.Value }{ m.Suffix } -
-
- { m.Label } -
-
- } -
- } else { -

- Add impact metrics to bring this section to life. -

- } -
-
-} - -// metricGridCols returns the responsive grid class for metric count. -func metricGridCols(count int) string { - switch count { - case 1: - return "grid-cols-1" - case 2: - return "grid-cols-1 sm:grid-cols-2" - case 3: - return "grid-cols-1 sm:grid-cols-3" - default: - return "grid-cols-2 lg:grid-cols-4" - } -} - -// resolveMedia rewrites a media reference to its served URL. The wave-1 -// implementation passes the path through verbatim and is wired so admins -// can drop in their own media adapter later without touching templates. -func resolveMedia(path string) string { - if path == "" { - return "" - } - return path -} diff --git a/impact_metrics_templ.go b/impact_metrics_templ.go deleted file mode 100644 index ba8dd45..0000000 --- a/impact_metrics_templ.go +++ /dev/null @@ -1,243 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// impactMetricsComponent renders a row of impact metrics with optional botanical illustration. -func impactMetricsComponent(data ImpactMetricsData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Title != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(data.Title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `impact_metrics.templ`, Line: 17, Col: 17} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.Illustration != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
\"\"
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else if data.Title != "" || len(data.Metrics) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = botanicalGlyph("fern", 64).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if len(data.Metrics) > 0 { - var templ_7745c5c3_Var5 = []any{"grid gap-8", metricGridCols(len(data.Metrics))} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var5...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - for _, m := range data.Metrics { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var8 string - templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(m.Value) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `impact_metrics.templ`, Line: 37, Col: 17} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var9 string - templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(m.Suffix) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `impact_metrics.templ`, Line: 37, Col: 29} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var11 string - templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(m.Label) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `impact_metrics.templ`, Line: 43, Col: 17} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "

Add impact metrics to bring this section to life.

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -// metricGridCols returns the responsive grid class for metric count. -func metricGridCols(count int) string { - switch count { - case 1: - return "grid-cols-1" - case 2: - return "grid-cols-1 sm:grid-cols-2" - case 3: - return "grid-cols-1 sm:grid-cols-3" - default: - return "grid-cols-2 lg:grid-cols-4" - } -} - -// resolveMedia rewrites a media reference to its served URL. The wave-1 -// implementation passes the path through verbatim and is wired so admins -// can drop in their own media adapter later without touching templates. -func resolveMedia(path string) string { - if path == "" { - return "" - } - return path -} - -var _ = templruntime.GeneratedTemplate diff --git a/main.go b/main.go deleted file mode 100644 index acc88fb..0000000 --- a/main.go +++ /dev/null @@ -1,17 +0,0 @@ -//go:build wasip1 - -// Package main compiles the earthen theme to a wasip1 reactor-mode wasm guest -// (WO-WZ-015). The .so build path is retired; `ninja plugin build` produces the -// .bnp artifact the registry serves. -// -// Reactor mode: the host runs `_initialize` once per pooled instance, which -// runs this init func (hence wasmguest.Serve) before any bn_invoke. Serve is -// non-blocking; all theme work then arrives over the ABI hook calls. main is -// never called. -package main - -import "git.dev.alexdunmow.com/block/core/plugin/wasmguest" - -func init() { wasmguest.Serve(Registration) } - -func main() {} // never called — reactor mode diff --git a/manifest.yaml b/manifest.yaml new file mode 100644 index 0000000..d936398 --- /dev/null +++ b/manifest.yaml @@ -0,0 +1,159 @@ +# Earthen theme — codeless .bnp manifest (WO-WZ-021 Phase B1). +# Synthesized into manifest.pb by `ninja plugin build` (no plugin.wasm). +theme_presets: presets.json +bundled_fonts: fonts.json +master_pages: master_pages.json + +system_templates: + - key: earthen + title: Earthen + description: "Botanical nonprofit theme in moss, clay, sage and cream" + +page_templates: + - system: earthen + key: default + title: Default + description: "Standard nonprofit page with header, main and footer" + slots: [header, main, footer] + - system: earthen + key: landing + title: Landing + description: "Mission hero plus CTA bands for campaigns and donation drives" + slots: [hero, main, cta, footer] + - system: earthen + key: article + title: Article + description: "Long-form storytelling with byline rail" + slots: [header, lede, main, aside, footer] + - system: earthen + key: full-width + title: Full Width + description: "Edge-to-edge imagery for reports and galleries" + slots: [header, main, footer] + +template_overrides: + - { template: earthen, block: heading } + - { template: earthen, block: text } + - { template: earthen, block: button } + - { template: earthen, block: image } + - { template: earthen, block: card } + +email_wrappers: + - earthen + +css: + input_css_append: | + /* Earthen — theme utilities injected via CSSManifest.InputCSSAppend. */ + /* All colour values reference the 19-token HSL custom properties so they */ + /* shift with the active preset (mossbed, clay-field, wet-loam). */ + + /* Paper grain backdrop — a single inline SVG noise pattern keeps page weight + inside the marketplace gate (≤ 81920 bytes). */ + .bg-paper-grain { + background-color: hsl(var(--background)); + background-image: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27160%27%20height%3D%27160%27%20viewBox%3D%270%200%20160%20160%27%3E%3Cfilter%20id%3D%27n%27%3E%3CfeTurbulence%20type%3D%27fractalNoise%27%20baseFrequency%3D%270.9%27%20numOctaves%3D%272%27%20seed%3D%274%27%2F%3E%3CfeColorMatrix%20values%3D%270%200%200%200%200.36%200%200%200%200%200.32%200%200%200%200%200.24%200%200%200%200.05%200%27%2F%3E%3C%2Ffilter%3E%3Crect%20width%3D%27160%27%20height%3D%27160%27%20filter%3D%27url%28%23n%29%27%2F%3E%3C%2Fsvg%3E"); + background-repeat: repeat; + background-size: 240px 240px; + } + + /* Botanical hairline divider — used inside .botanical-rule sections. */ + .botanical-rule > span { + display: inline-block; + } + + /* Hand-drawn crayon underline on h2 — uses currentColor and primary token. */ + .crayon-underline { + position: relative; + padding-bottom: 0.35em; + } + .crayon-underline::after { + content: ""; + position: absolute; + left: 0; + right: auto; + bottom: 0; + height: 6px; + width: 2.5em; + background-color: hsl(var(--accent) / 0.4); + border-radius: 4px 8px 6px 12px; + transform: skewY(-1deg); + } + + /* Botanical drop cap — applied to the first paragraph of .drop-cap-host. */ + .drop-cap-host > p:first-of-type::first-letter, + .drop-cap > p:first-of-type::first-letter, + .drop-cap::first-letter { + font-family: var(--font-heading, "Fraunces", "Playfair Display", Georgia, serif); + color: hsl(var(--primary)); + float: left; + font-size: 3.4em; + line-height: 0.85; + margin: 0.15em 0.18em 0 0; + font-weight: 600; + } + + /* Tile selection (donation CTA) — uses primary ring when checked. */ + .earthen-tile input[type="radio"]:checked + span { + color: hsl(var(--primary)); + } + .earthen-tile:has(input[type="radio"]:checked) { + box-shadow: 0 0 0 2px hsl(var(--primary)); + } + + /* Partner logos — grayscale at rest, full colour on hover. */ + .earthen-partner-img, + .earthen-partner-fallback { + filter: grayscale(1); + opacity: 0.85; + transition: filter 200ms ease, opacity 200ms ease; + } + .earthen-partner-tile:hover .earthen-partner-img, + .earthen-partner-link:hover .earthen-partner-img, + .earthen-partner-link:focus-visible .earthen-partner-img, + .earthen-partner-tile:hover .earthen-partner-fallback, + .earthen-partner-link:hover .earthen-partner-fallback { + filter: grayscale(0); + opacity: 1; + } + + /* Paper-grain frame around field-note imagery. */ + .earthen-paper-frame { + box-shadow: inset 0 0 0 1px hsl(var(--border) / 0.6); + } + .earthen-paper-frame-inner { + box-shadow: 0 1px 2px hsl(var(--foreground) / 0.06); + } + + /* Footer links — botanical underline on hover. */ + .earthen-footer-link { + text-decoration: none; + border-bottom: 1px solid transparent; + transition: color 150ms ease, border-color 150ms ease; + } + .earthen-footer-link:hover, + .earthen-footer-link:focus-visible { + color: hsl(var(--primary-foreground)); + border-bottom-color: hsl(var(--accent)); + } + + /* Buttons — focus ring follows the active preset. */ + .earthen-button:focus-visible { + outline: 2px solid hsl(var(--ring)); + outline-offset: 2px; + } + + /* Article aside — keeps the byline rail comfortable on mobile. */ + .earthen-aside { + color: hsl(var(--muted-foreground)); + } + + /* Ensure article main column uses the Spectral body fallback. */ + .earthen-article { + font-family: var(--font-body, "Spectral", Georgia, serif); + color: hsl(var(--foreground)); + } + + /* Divider glyph — softer stroke at rest. */ + .earthen-glyph { + color: hsl(var(--primary)); + } diff --git a/master_pages.json b/master_pages.json new file mode 100644 index 0000000..90e8905 --- /dev/null +++ b/master_pages.json @@ -0,0 +1,25 @@ +[ + { + "key": "earthen:default-master", + "title": "Earthen Default Master", + "page_templates": ["default", "article"], + "blocks": [ + { "block_key": "navbar", "title": "Main Navigation", "content": { "menuName": "main" }, "slot": "header", "sort_order": 0 }, + { "block_key": "slot", "title": "Main Content", "content": { "slotName": "main" }, "slot": "main", "sort_order": 0 }, + { "block_key": "earthen:donation_cta", "title": "Donation Rail", "content": { "amounts": [25, 50, 100], "headline": "Plant the next acre." }, "slot": "main", "sort_order": 100 }, + { "block_key": "earthen:footer", "title": "Site Footer", "content": { "showNewsletter": true, "tagline": "Rooted in place." }, "slot": "footer", "sort_order": 0 } + ] + }, + { + "key": "earthen:landing-master", + "title": "Earthen Landing Master", + "page_templates": ["landing", "full-width"], + "blocks": [ + { "block_key": "navbar", "title": "Main Navigation", "content": { "menuName": "main" }, "slot": "hero", "sort_order": 0 }, + { "block_key": "slot", "title": "Hero Slot", "content": { "slotName": "hero" }, "slot": "hero", "sort_order": 10 }, + { "block_key": "slot", "title": "Main Slot", "content": { "slotName": "main" }, "slot": "main", "sort_order": 0 }, + { "block_key": "earthen:donation_cta", "title": "Donation CTA", "content": { "amounts": [25, 50, 100, 250] }, "slot": "cta", "sort_order": 0 }, + { "block_key": "earthen:footer", "title": "Footer", "content": { "showNewsletter": true }, "slot": "footer", "sort_order": 0 } + ] + } +] diff --git a/partner_logos.go b/partner_logos.go deleted file mode 100644 index e552e4f..0000000 --- a/partner_logos.go +++ /dev/null @@ -1,55 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/blocks" -) - -// PartnerLogosBlockMeta defines metadata for the partner logos block. -var PartnerLogosBlockMeta = blocks.BlockMeta{ - Key: "partner_logos", - Title: "Partner Logos", - Description: "Grayscale partner logo grid with hover-to-color treatment", - Source: "earthen", - Category: blocks.CategoryContent, -} - -// PartnerLogosBlock renders the partner logos block. -// Content shape: {title, logos:[{name,image,url}]} -func PartnerLogosBlock(ctx context.Context, content map[string]any) string { - rawLogos := getSlice(content, "logos") - logos := make([]PartnerLogo, 0, len(rawLogos)) - for _, l := range rawLogos { - logos = append(logos, PartnerLogo{ - Name: getString(l, "name"), - Image: getString(l, "image"), - URL: getString(l, "url"), - }) - } - - data := PartnerLogosData{ - Title: getString(content, "title"), - Logos: logos, - Empty: len(content) == 0, - } - - var buf bytes.Buffer - _ = partnerLogosComponent(data).Render(ctx, &buf) - return buf.String() -} - -// PartnerLogosData contains data for the partner logos component. -type PartnerLogosData struct { - Title string - Logos []PartnerLogo - Empty bool -} - -// PartnerLogo is a single partner row. -type PartnerLogo struct { - Name string - Image string - URL string -} diff --git a/partner_logos.templ b/partner_logos.templ deleted file mode 100644 index 516221d..0000000 --- a/partner_logos.templ +++ /dev/null @@ -1,95 +0,0 @@ -package main - -// partnerLogosComponent renders a grayscale logo grid that restores colour on hover. -templ partnerLogosComponent(data PartnerLogosData) { -
-
- if data.Title != "" { -

- { data.Title } -

- } - if len(data.Logos) > 0 { -
- for _, logo := range data.Logos { -
- @partnerLogoTile(logo) -
- } -
- } else { -

- Add partner logos to fill this grid. -

- } -
-
-} - -templ partnerLogoTile(logo PartnerLogo) { - if logo.URL != "" { - - @partnerLogoImage(logo) - - } else { - - } -} - -templ partnerLogoImage(logo PartnerLogo) { - if logo.Image != "" { - { - } else { -
- { partnerInitials(logo.Name) } -
- } -} - -// partnerInitials returns up to two initials for an initials-only fallback tile. -func partnerInitials(name string) string { - if name == "" { - return "?" - } - letters := []rune{} - prevSpace := true - for _, r := range name { - if r == ' ' || r == '-' || r == '_' { - prevSpace = true - continue - } - if prevSpace { - letters = append(letters, r) - prevSpace = false - if len(letters) >= 2 { - break - } - } - } - if len(letters) == 0 { - return "?" - } - return string(letters) -} diff --git a/partner_logos_templ.go b/partner_logos_templ.go deleted file mode 100644 index aece890..0000000 --- a/partner_logos_templ.go +++ /dev/null @@ -1,334 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// partnerLogosComponent renders a grayscale logo grid that restores colour on hover. -func partnerLogosComponent(data PartnerLogosData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Title != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(data.Title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `partner_logos.templ`, Line: 17, Col: 17} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if len(data.Logos) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - for _, logo := range data.Logos { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = partnerLogoTile(logo).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "

Add partner logos to fill this grid.

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -func partnerLogoTile(logo PartnerLogo) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - if logo.URL != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = partnerLogoImage(logo).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return nil - }) -} - -func partnerLogoImage(logo PartnerLogo) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var10 := templ.GetChildren(ctx) - if templ_7745c5c3_Var10 == nil { - templ_7745c5c3_Var10 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - if logo.Image != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "\"")") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var13 string - templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(partnerInitials(logo.Name)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `partner_logos.templ`, Line: 66, Col: 53} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return nil - }) -} - -// partnerInitials returns up to two initials for an initials-only fallback tile. -func partnerInitials(name string) string { - if name == "" { - return "?" - } - letters := []rune{} - prevSpace := true - for _, r := range name { - if r == ' ' || r == '-' || r == '_' { - prevSpace = true - continue - } - if prevSpace { - letters = append(letters, r) - prevSpace = false - if len(letters) >= 2 { - break - } - } - } - if len(letters) == 0 { - return "?" - } - return string(letters) -} - -var _ = templruntime.GeneratedTemplate diff --git a/plugin.mod b/plugin.mod index 2aa55c4..bfde9d3 100644 --- a/plugin.mod +++ b/plugin.mod @@ -2,11 +2,8 @@ name = "earthen" display_name = "Earthen" scope = "@themes" -version = "0.1.2" +version = "0.2.0" description = "Botanical nonprofit theme in moss, clay, sage and cream — hand-illustrated motifs for cause-driven sites." kind = "theme" categories = ["templates"] tags = ["earth", "nonprofit", "sustainability", "outdoor", "farm", "cause", "botanical", "conservation", "ngo"] - -[compatibility] -block_core = ">=0.15.0 <0.16.0" diff --git a/register.go b/register.go deleted file mode 100644 index 4f45a2f..0000000 --- a/register.go +++ /dev/null @@ -1,180 +0,0 @@ -package main - -import ( - "context" - - "github.com/a-h/templ" - - "git.dev.alexdunmow.com/block/core/blocks" - "git.dev.alexdunmow.com/block/core/plugin" - "git.dev.alexdunmow.com/block/core/templates" -) - -// wrap adapts a templ-returning render function to templates.TemplateFunc. -// templ.Component already implements templates.HTMLComponent via Render. -func wrap(f func(ctx context.Context, doc map[string]any) templ.Component) templates.TemplateFunc { - return func(ctx context.Context, doc map[string]any) templates.HTMLComponent { - return f(ctx, doc) - } -} - -// Register is the plugin entry point that registers the Earthen system template, -// four page templates, six theme blocks, five overrides, and the email wrapper. -func Register(tr templates.TemplateRegistry, br blocks.BlockRegistry) error { - tr.RegisterSystemTemplate(templates.SystemTemplateMeta{ - Key: "earthen", - Title: "Earthen", - Description: "Botanical nonprofit theme in moss, clay, sage and cream", - }) - - if err := tr.RegisterPageTemplate("earthen", templates.PageTemplateMeta{ - Key: "default", - Title: "Default", - Description: "Standard nonprofit page with header, main and footer", - Slots: []string{"header", "main", "footer"}, - }, wrap(RenderEarthenDefault)); err != nil { - return err - } - - if err := tr.RegisterPageTemplate("earthen", templates.PageTemplateMeta{ - Key: "landing", - Title: "Landing", - Description: "Mission hero plus CTA bands for campaigns and donation drives", - Slots: []string{"hero", "main", "cta", "footer"}, - }, wrap(RenderEarthenLanding)); err != nil { - return err - } - - if err := tr.RegisterPageTemplate("earthen", templates.PageTemplateMeta{ - Key: "article", - Title: "Article", - Description: "Long-form storytelling with byline rail", - Slots: []string{"header", "lede", "main", "aside", "footer"}, - }, wrap(RenderEarthenArticle)); err != nil { - return err - } - - if err := tr.RegisterPageTemplate("earthen", templates.PageTemplateMeta{ - Key: "full-width", - Title: "Full Width", - Description: "Edge-to-edge imagery for reports and galleries", - Slots: []string{"header", "main", "footer"}, - }, wrap(RenderEarthenFullWidth)); err != nil { - return err - } - - if err := br.LoadSchemasFromFS(Schemas()); err != nil { - return err - } - - br.Register(DonationCTABlockMeta, DonationCTABlock) - br.Register(ImpactMetricsBlockMeta, ImpactMetricsBlock) - br.Register(PartnerLogosBlockMeta, PartnerLogosBlock) - br.Register(FieldNoteBlockMeta, FieldNoteBlock) - br.Register(BotanicalDividerBlockMeta, BotanicalDividerBlock) - br.Register(FooterBlockMeta, FooterBlock) - - br.RegisterTemplateOverride("earthen", "heading", EarthenHeadingBlock) - br.RegisterTemplateOverride("earthen", "text", EarthenTextBlock) - br.RegisterTemplateOverride("earthen", "button", EarthenButtonBlock) - br.RegisterTemplateOverride("earthen", "image", EarthenImageBlock) - br.RegisterTemplateOverride("earthen", "card", EarthenCardBlock) - - tr.RegisterEmailWrapper("earthen", EarthenEmailWrapper) - - return nil -} - -// DefaultMasterPages returns the default master pages that Earthen provisions -// on first plugin load. -func DefaultMasterPages() []plugin.MasterPageDefinition { - return []plugin.MasterPageDefinition{ - { - Key: "earthen:default-master", - Title: "Earthen Default Master", - PageTemplates: []string{"default", "article"}, - Blocks: []plugin.MasterPageBlock{ - { - BlockKey: "navbar", - Title: "Main Navigation", - Content: map[string]any{"menuName": "main"}, - Slot: "header", - SortOrder: 0, - }, - { - BlockKey: "slot", - Title: "Main Content", - Content: map[string]any{"slotName": "main"}, - Slot: "main", - SortOrder: 0, - }, - { - BlockKey: "earthen:donation_cta", - Title: "Donation Rail", - Content: map[string]any{ - "amounts": []any{25.0, 50.0, 100.0}, - "headline": "Plant the next acre.", - }, - Slot: "main", - SortOrder: 100, - }, - { - BlockKey: "earthen:footer", - Title: "Site Footer", - Content: map[string]any{ - "showNewsletter": true, - "tagline": "Rooted in place.", - }, - Slot: "footer", - SortOrder: 0, - }, - }, - }, - { - Key: "earthen:landing-master", - Title: "Earthen Landing Master", - PageTemplates: []string{"landing", "full-width"}, - Blocks: []plugin.MasterPageBlock{ - { - BlockKey: "navbar", - Title: "Main Navigation", - Content: map[string]any{"menuName": "main"}, - Slot: "hero", - SortOrder: 0, - }, - { - BlockKey: "slot", - Title: "Hero Slot", - Content: map[string]any{"slotName": "hero"}, - Slot: "hero", - SortOrder: 10, - }, - { - BlockKey: "slot", - Title: "Main Slot", - Content: map[string]any{"slotName": "main"}, - Slot: "main", - SortOrder: 0, - }, - { - BlockKey: "earthen:donation_cta", - Title: "Donation CTA", - Content: map[string]any{ - "amounts": []any{25.0, 50.0, 100.0, 250.0}, - }, - Slot: "cta", - SortOrder: 0, - }, - { - BlockKey: "earthen:footer", - Title: "Footer", - Content: map[string]any{ - "showNewsletter": true, - }, - Slot: "footer", - SortOrder: 0, - }, - }, - }, - } -} diff --git a/registration.go b/registration.go deleted file mode 100644 index 24f66f7..0000000 --- a/registration.go +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "io/fs" - "net/http" - - "git.dev.alexdunmow.com/block/core/blocks" - "git.dev.alexdunmow.com/block/core/plugin" - "git.dev.alexdunmow.com/block/core/templates" -) - -// Registration is the compile-time plugin registration for the Earthen theme. -var Registration = plugin.PluginRegistration{ - Name: "earthen", - Version: plugin.ParseModVersion(pluginModBytes), - Register: func(tr templates.TemplateRegistry, br blocks.BlockRegistry) error { - return Register(tr, br) - }, - Assets: func() http.Handler { return AssetsHandler() }, - Schemas: func() fs.FS { return Schemas() }, - ThemePresets: func() []byte { return ThemePresets() }, - BundledFonts: func() []byte { return BundledFonts() }, - MasterPages: func() []plugin.MasterPageDefinition { return DefaultMasterPages() }, - CSSManifest: func() *plugin.CSSManifest { return ThemeCSSManifest() }, -} diff --git a/template.templ b/template.templ deleted file mode 100644 index 2efd124..0000000 --- a/template.templ +++ /dev/null @@ -1,273 +0,0 @@ -package main - -import ( - "context" - "git.dev.alexdunmow.com/block/core/templates/bn" -) - -// PageData contains the data for a rendered Earthen page. -type PageData struct { - Title string - Slots map[string]string - ThemeMode string - ThemeCSS string - SiteSettings bn.SiteSettingsData - PageMeta bn.PageMeta - StructuredData string - CSSHash string - PageviewNonce string - EngagementConfig bn.EngagementConfig -} - -func parseEarthenPageData(doc map[string]any) PageData { - title := "Untitled" - if t, ok := doc["title"].(string); ok { - title = t - } - - slots := make(map[string]string) - if s, ok := doc["slots"].(map[string]string); ok { - slots = s - } - - themeCSS := "" - if tc, ok := doc["theme_css"].(string); ok { - themeCSS = tc - } - - structuredData := "" - if sd, ok := doc["structured_data"].(string); ok { - structuredData = sd - } - - cssHash := "" - if ch, ok := doc["css_hash"].(string); ok { - cssHash = ch - } - - pageviewNonce := "" - if pn, ok := doc["pageview_nonce"].(string); ok { - pageviewNonce = pn - } - - themeMode := "light" - if tm, ok := doc["theme_mode"].(string); ok && tm != "" { - themeMode = tm - } - - siteSettings := bn.ParseSiteSettings(doc) - pageMeta := bn.ParsePageMeta(doc) - engagementConfig := bn.ParseEngagementConfig(doc) - - return PageData{ - Title: title, - Slots: slots, - ThemeMode: themeMode, - ThemeCSS: themeCSS, - SiteSettings: siteSettings, - PageMeta: pageMeta, - StructuredData: structuredData, - CSSHash: cssHash, - PageviewNonce: pageviewNonce, - EngagementConfig: engagementConfig, - } -} - -// EarthenDefault renders the default Earthen page (header, main, footer). -templ EarthenDefault(data PageData) { - - - @bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: []string{"/templates/earthen/css/earthen.css"}, - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }) - - @bn.AdminBypassBanner(data.SiteSettings) -
- @templ.Raw(data.Slots["header"]) -
-
- if main, ok := data.Slots["main"]; ok && main != "" { - @templ.Raw(main) - } else { -
-

No content blocks assigned to this page.

-
- } -
-
- @templ.Raw(data.Slots["footer"]) -
- @bn.BodyEnd(data.SiteSettings) - - -} - -// EarthenLanding renders the landing template (hero, main, cta, footer). -templ EarthenLanding(data PageData) { - - - @bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: []string{"/templates/earthen/css/earthen.css"}, - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }) - - @bn.AdminBypassBanner(data.SiteSettings) -
- @templ.Raw(data.Slots["hero"]) -
-
- if main, ok := data.Slots["main"]; ok && main != "" { -
- @templ.Raw(main) -
- } -
-
- @templ.Raw(data.Slots["cta"]) -
-
- @templ.Raw(data.Slots["footer"]) -
- @bn.BodyEnd(data.SiteSettings) - - -} - -// EarthenArticle renders the article template (header, lede, main, aside, footer). -templ EarthenArticle(data PageData) { - - - @bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: []string{"/templates/earthen/css/earthen.css"}, - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }) - - @bn.AdminBypassBanner(data.SiteSettings) -
-
- @templ.Raw(data.Slots["header"]) -
-
- if lede, ok := data.Slots["lede"]; ok && lede != "" { -
- @templ.Raw(lede) -
- } -
-
- if main, ok := data.Slots["main"]; ok && main != "" { -
- @templ.Raw(main) -
- } else { -

No story body yet.

- } -
- if aside, ok := data.Slots["aside"]; ok && aside != "" { - - } -
-
- @templ.Raw(data.Slots["footer"]) -
- @bn.BodyEnd(data.SiteSettings) - - -} - -// EarthenFullWidth renders edge-to-edge pages (header, main, footer). -templ EarthenFullWidth(data PageData) { - - - @bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: []string{"/templates/earthen/css/earthen.css"}, - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }) - - @bn.AdminBypassBanner(data.SiteSettings) -
- @templ.Raw(data.Slots["header"]) -
-
- if main, ok := data.Slots["main"]; ok && main != "" { - @templ.Raw(main) - } else { -
-

No content blocks assigned to this page.

-
- } -
-
- @templ.Raw(data.Slots["footer"]) -
- @bn.BodyEnd(data.SiteSettings) - - -} - -// RenderEarthenDefault is the templates.TemplateFunc entry for "default". -func RenderEarthenDefault(ctx context.Context, doc map[string]any) templ.Component { - return EarthenDefault(parseEarthenPageData(doc)) -} - -// RenderEarthenLanding is the templates.TemplateFunc entry for "landing". -func RenderEarthenLanding(ctx context.Context, doc map[string]any) templ.Component { - return EarthenLanding(parseEarthenPageData(doc)) -} - -// RenderEarthenArticle is the templates.TemplateFunc entry for "article". -func RenderEarthenArticle(ctx context.Context, doc map[string]any) templ.Component { - return EarthenArticle(parseEarthenPageData(doc)) -} - -// RenderEarthenFullWidth is the templates.TemplateFunc entry for "full-width". -func RenderEarthenFullWidth(ctx context.Context, doc map[string]any) templ.Component { - return EarthenFullWidth(parseEarthenPageData(doc)) -} diff --git a/template_templ.go b/template_templ.go deleted file mode 100644 index 99939ae..0000000 --- a/template_templ.go +++ /dev/null @@ -1,543 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "context" - "git.dev.alexdunmow.com/block/core/templates/bn" -) - -// PageData contains the data for a rendered Earthen page. -type PageData struct { - Title string - Slots map[string]string - ThemeMode string - ThemeCSS string - SiteSettings bn.SiteSettingsData - PageMeta bn.PageMeta - StructuredData string - CSSHash string - PageviewNonce string - EngagementConfig bn.EngagementConfig -} - -func parseEarthenPageData(doc map[string]any) PageData { - title := "Untitled" - if t, ok := doc["title"].(string); ok { - title = t - } - - slots := make(map[string]string) - if s, ok := doc["slots"].(map[string]string); ok { - slots = s - } - - themeCSS := "" - if tc, ok := doc["theme_css"].(string); ok { - themeCSS = tc - } - - structuredData := "" - if sd, ok := doc["structured_data"].(string); ok { - structuredData = sd - } - - cssHash := "" - if ch, ok := doc["css_hash"].(string); ok { - cssHash = ch - } - - pageviewNonce := "" - if pn, ok := doc["pageview_nonce"].(string); ok { - pageviewNonce = pn - } - - themeMode := "light" - if tm, ok := doc["theme_mode"].(string); ok && tm != "" { - themeMode = tm - } - - siteSettings := bn.ParseSiteSettings(doc) - pageMeta := bn.ParsePageMeta(doc) - engagementConfig := bn.ParseEngagementConfig(doc) - - return PageData{ - Title: title, - Slots: slots, - ThemeMode: themeMode, - ThemeCSS: themeCSS, - SiteSettings: siteSettings, - PageMeta: pageMeta, - StructuredData: structuredData, - CSSHash: cssHash, - PageviewNonce: pageviewNonce, - EngagementConfig: engagementConfig, - } -} - -// EarthenDefault renders the default Earthen page (header, main, footer). -func EarthenDefault(data PageData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: []string{"/templates/earthen/css/earthen.css"}, - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.AdminBypassBanner(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["header"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if main, ok := data.Slots["main"]; ok && main != "" { - templ_7745c5c3_Err = templ.Raw(main).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "

No content blocks assigned to this page.

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["footer"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.BodyEnd(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -// EarthenLanding renders the landing template (hero, main, cta, footer). -func EarthenLanding(data PageData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: []string{"/templates/earthen/css/earthen.css"}, - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.AdminBypassBanner(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["hero"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if main, ok := data.Slots["main"]; ok && main != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(main).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["cta"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["footer"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.BodyEnd(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -// EarthenArticle renders the article template (header, lede, main, aside, footer). -func EarthenArticle(data PageData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: []string{"/templates/earthen/css/earthen.css"}, - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.AdminBypassBanner(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["header"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if lede, ok := data.Slots["lede"]; ok && lede != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(lede).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if main, ok := data.Slots["main"]; ok && main != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(main).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "

No story body yet.

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if aside, ok := data.Slots["aside"]; ok && aside != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["footer"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.BodyEnd(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -// EarthenFullWidth renders edge-to-edge pages (header, main, footer). -func EarthenFullWidth(data PageData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: []string{"/templates/earthen/css/earthen.css"}, - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.AdminBypassBanner(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["header"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if main, ok := data.Slots["main"]; ok && main != "" { - templ_7745c5c3_Err = templ.Raw(main).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "

No content blocks assigned to this page.

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["footer"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.BodyEnd(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -// RenderEarthenDefault is the templates.TemplateFunc entry for "default". -func RenderEarthenDefault(ctx context.Context, doc map[string]any) templ.Component { - return EarthenDefault(parseEarthenPageData(doc)) -} - -// RenderEarthenLanding is the templates.TemplateFunc entry for "landing". -func RenderEarthenLanding(ctx context.Context, doc map[string]any) templ.Component { - return EarthenLanding(parseEarthenPageData(doc)) -} - -// RenderEarthenArticle is the templates.TemplateFunc entry for "article". -func RenderEarthenArticle(ctx context.Context, doc map[string]any) templ.Component { - return EarthenArticle(parseEarthenPageData(doc)) -} - -// RenderEarthenFullWidth is the templates.TemplateFunc entry for "full-width". -func RenderEarthenFullWidth(ctx context.Context, doc map[string]any) templ.Component { - return EarthenFullWidth(parseEarthenPageData(doc)) -} - -var _ = templruntime.GeneratedTemplate diff --git a/templates/earthen/article.ninjatpl b/templates/earthen/article.ninjatpl new file mode 100644 index 0000000..65a3326 --- /dev/null +++ b/templates/earthen/article.ninjatpl @@ -0,0 +1,17 @@ + + +{{ head_html|safe }} + + {{ admin_banner_html|safe }} +
+
{{ slots.header|safe }}
+
+ {% if slots.lede %}
{{ slots.lede|safe }}
{% endif %} +
+
{% if slots.main %}
{{ slots.main|safe }}
{% else %}

No story body yet.

{% endif %}
+ {% if slots.aside %}{% endif %} +
+
{{ slots.footer|safe }}
+ {{ body_end_html|safe }} + + diff --git a/templates/earthen/default.ninjatpl b/templates/earthen/default.ninjatpl new file mode 100644 index 0000000..a19bc9f --- /dev/null +++ b/templates/earthen/default.ninjatpl @@ -0,0 +1,11 @@ + + +{{ head_html|safe }} + + {{ admin_banner_html|safe }} +
{{ slots.header|safe }}
+
{% if slots.main %}{{ slots.main|safe }}{% else %}

No content blocks assigned to this page.

{% endif %}
+
{{ slots.footer|safe }}
+ {{ body_end_html|safe }} + + diff --git a/templates/earthen/full-width.ninjatpl b/templates/earthen/full-width.ninjatpl new file mode 100644 index 0000000..4784c71 --- /dev/null +++ b/templates/earthen/full-width.ninjatpl @@ -0,0 +1,11 @@ + + +{{ head_html|safe }} + + {{ admin_banner_html|safe }} +
{{ slots.header|safe }}
+
{% if slots.main %}{{ slots.main|safe }}{% else %}

No content blocks assigned to this page.

{% endif %}
+
{{ slots.footer|safe }}
+ {{ body_end_html|safe }} + + diff --git a/templates/earthen/landing.ninjatpl b/templates/earthen/landing.ninjatpl new file mode 100644 index 0000000..e53d65d --- /dev/null +++ b/templates/earthen/landing.ninjatpl @@ -0,0 +1,12 @@ + + +{{ head_html|safe }} + + {{ admin_banner_html|safe }} +
{{ slots.hero|safe }}
+
{% if slots.main %}
{{ slots.main|safe }}
{% endif %}
+
{{ slots.cta|safe }}
+
{{ slots.footer|safe }}
+ {{ body_end_html|safe }} + + diff --git a/templates/email/earthen.ninjatpl b/templates/email/earthen.ninjatpl new file mode 100644 index 0000000..08abadb --- /dev/null +++ b/templates/email/earthen.ninjatpl @@ -0,0 +1,9 @@ +{{ site_name }}{% if preview_text %}
{{ preview_text }}
{% endif %}
{% if logo_url %}{{ site_name }}{% elif site_name %}

{{ site_name }}

{% endif %}
{{ body|safe }}

{{ site_name }}

Registered charity. We respect your inbox.

{% if site_url %}

{{ site_url }}

{% endif %}{% if unsubscribe_url %}

Unsubscribe

{% else %}

Unsubscribe

{% endif %}
diff --git a/templates/overrides/earthen/button.ninjatpl b/templates/overrides/earthen/button.ninjatpl new file mode 100644 index 0000000..1fcfa81 --- /dev/null +++ b/templates/overrides/earthen/button.ninjatpl @@ -0,0 +1 @@ +{{ label|default:text }} diff --git a/templates/overrides/earthen/card.ninjatpl b/templates/overrides/earthen/card.ninjatpl new file mode 100644 index 0000000..445f8de --- /dev/null +++ b/templates/overrides/earthen/card.ninjatpl @@ -0,0 +1 @@ + diff --git a/templates/overrides/earthen/heading.ninjatpl b/templates/overrides/earthen/heading.ninjatpl new file mode 100644 index 0000000..0f75842 --- /dev/null +++ b/templates/overrides/earthen/heading.ninjatpl @@ -0,0 +1 @@ +{% if level|integer == 1 %}

{{ text }}

{% elif level|integer == 3 %}

{{ text }}

{% elif level|integer == 4 %}

{{ text }}

{% elif level|integer == 5 %}
{{ text }}
{% elif level|integer == 6 %}
{{ text }}
{% else %}

{{ text }}

{% endif %} diff --git a/templates/overrides/earthen/image.ninjatpl b/templates/overrides/earthen/image.ninjatpl new file mode 100644 index 0000000..9ab7ad2 --- /dev/null +++ b/templates/overrides/earthen/image.ninjatpl @@ -0,0 +1 @@ +
{% if src|default:url %}
{{ alt }}
{% else %}
Choose an image to display here
{% endif %}{% if caption %}
{{ caption }}
{% endif %}
diff --git a/templates/overrides/earthen/text.ninjatpl b/templates/overrides/earthen/text.ninjatpl new file mode 100644 index 0000000..4937e26 --- /dev/null +++ b/templates/overrides/earthen/text.ninjatpl @@ -0,0 +1 @@ +{% if variant == "lede" %}
{{ text|safe }}
{% else %}
{{ text|safe }}
{% endif %} diff --git a/text_override.go b/text_override.go deleted file mode 100644 index d4a48e6..0000000 --- a/text_override.go +++ /dev/null @@ -1,18 +0,0 @@ -package main - -import ( - "bytes" - "context" -) - -// EarthenTextBlock renders text with Earthen styling. -// When variant is "lede", the first paragraph gains a botanical drop-cap. -func EarthenTextBlock(ctx context.Context, content map[string]any) string { - text := getString(content, "text") - class := getString(content, "class") - variant := getString(content, "variant") - - var buf bytes.Buffer - _ = earthenTextComponent(text, class, variant).Render(ctx, &buf) - return buf.String() -} diff --git a/text_override.templ b/text_override.templ deleted file mode 100644 index ec22d04..0000000 --- a/text_override.templ +++ /dev/null @@ -1,20 +0,0 @@ -package main - -// earthenTextComponent renders body text with optional lede drop-cap. -templ earthenTextComponent(text, class, variant string) { - if variant == "lede" { -
- @templ.Raw(text) -
- } else { -
- @templ.Raw(text) -
- } -} diff --git a/text_override_templ.go b/text_override_templ.go deleted file mode 100644 index 39083ee..0000000 --- a/text_override_templ.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// earthenTextComponent renders body text with optional lede drop-cap. -func earthenTextComponent(text, class, variant string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - if variant == "lede" { - var templ_7745c5c3_Var2 = []any{"earthen-text earthen-lede drop-cap-host max-w-none flex-1", class} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var2...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(text).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - var templ_7745c5c3_Var5 = []any{"earthen-text max-w-none flex-1", class} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var5...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(text).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return nil - }) -} - -var _ = templruntime.GeneratedTemplate