From 074d3148975e58c6c9d17d9bbf5f55c92be0db29 Mon Sep 17 00:00:00 2001 From: Daniel S Date: Sun, 9 Aug 2026 12:54:31 +0200 Subject: [PATCH] feat: implement Dynamic Data Binding system and tags registry --- src/components/sections/HeroSection.astro | 26 +++++++----- src/pages/admin/editor.astro | 18 ++++++++- src/utils/dynamicDataBinding.ts | 49 +++++++++++++++++++++++ tests/waasEngine.test.ts | 15 +++++++ 4 files changed, 96 insertions(+), 12 deletions(-) create mode 100644 src/utils/dynamicDataBinding.ts diff --git a/src/components/sections/HeroSection.astro b/src/components/sections/HeroSection.astro index f49f993..c70a2b8 100644 --- a/src/components/sections/HeroSection.astro +++ b/src/components/sections/HeroSection.astro @@ -1,11 +1,17 @@ --- import type { SiteConfig, UIComponent } from '../../utils/configLoader'; +import { resolveDynamicBinding } from '../../utils/dynamicDataBinding'; interface Props { config: SiteConfig['hero']; + contextData?: Record; } -const { config } = Astro.props; +const { config, contextData = {} } = Astro.props; + +const heroTitle = resolveDynamicBinding(config.title, contextData); +const heroSubtitle = resolveDynamicBinding(config.subtitle, contextData); +const heroBadge = resolveDynamicBinding(config.badge, contextData); const elements = config.elements || []; const badgeElements = elements.filter((el: UIComponent) => el.slotId === 'hero-badge-slot'); @@ -21,41 +27,41 @@ const customElements = elements.filter((el: UIComponent) => !el.slotId || el.slo
- {config.badge && ( + {heroBadge && (
- {config.badge} + {heroBadge}
)} {badgeElements.map(el => ( - {el.content} + {resolveDynamicBinding(el.content, contextData)} ))}

- {config.title} + {heroTitle}

- {config.subtitle} + {heroSubtitle}

@@ -66,7 +72,7 @@ const customElements = elements.filter((el: UIComponent) => !el.slotId || el.slo {customElements.map(el => (
{el.type} [ID: {el.id}] - {el.content} + {resolveDynamicBinding(el.content, contextData)}
))} diff --git a/src/pages/admin/editor.astro b/src/pages/admin/editor.astro index b719dbf..0957eec 100644 --- a/src/pages/admin/editor.astro +++ b/src/pages/admin/editor.astro @@ -223,8 +223,22 @@ const { siteConfig, themeConfig } = loadWaasConfigs(Astro.request.headers.get('u
- - + + +
+ +
+ +