@wix/web5-core 1.58.0 → 1.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/cjs/client/applyThemeOverrides.js +89 -0
  2. package/dist/cjs/client/applyThemeOverrides.js.map +1 -0
  3. package/dist/cjs/client/clientBundleUrl.js +43 -0
  4. package/dist/cjs/client/clientBundleUrl.js.map +1 -1
  5. package/dist/cjs/component/componentDefinitions/HeroEntitySectionDefinition.js +5 -2
  6. package/dist/cjs/component/componentDefinitions/HeroEntitySectionDefinition.js.map +1 -1
  7. package/dist/cjs/component/componentDefinitions/HeroSectionDefinition.js +4 -1
  8. package/dist/cjs/component/componentDefinitions/HeroSectionDefinition.js.map +1 -1
  9. package/dist/cjs/component/componentDefinitions/NextStepsSectionDefinition.js +35 -2
  10. package/dist/cjs/component/componentDefinitions/NextStepsSectionDefinition.js.map +1 -1
  11. package/dist/cjs/component/componentDefinitions/TextBlockSectionDefinition.js +27 -1
  12. package/dist/cjs/component/componentDefinitions/TextBlockSectionDefinition.js.map +1 -1
  13. package/dist/cjs/component/componentDefinitions/index.js +8 -1
  14. package/dist/cjs/component/componentDefinitions/index.js.map +1 -1
  15. package/dist/cjs/component/types.js.map +1 -1
  16. package/dist/cjs/hostScope.js.map +1 -1
  17. package/dist/cjs/index.js +11 -3
  18. package/dist/cjs/index.js.map +1 -1
  19. package/dist/esm/client/applyThemeOverrides.js +85 -0
  20. package/dist/esm/client/applyThemeOverrides.js.map +1 -0
  21. package/dist/esm/client/clientBundleUrl.js +39 -0
  22. package/dist/esm/client/clientBundleUrl.js.map +1 -1
  23. package/dist/esm/component/componentDefinitions/HeroEntitySectionDefinition.js +6 -3
  24. package/dist/esm/component/componentDefinitions/HeroEntitySectionDefinition.js.map +1 -1
  25. package/dist/esm/component/componentDefinitions/HeroSectionDefinition.js +5 -2
  26. package/dist/esm/component/componentDefinitions/HeroSectionDefinition.js.map +1 -1
  27. package/dist/esm/component/componentDefinitions/NextStepsSectionDefinition.js +36 -3
  28. package/dist/esm/component/componentDefinitions/NextStepsSectionDefinition.js.map +1 -1
  29. package/dist/esm/component/componentDefinitions/TextBlockSectionDefinition.js +27 -1
  30. package/dist/esm/component/componentDefinitions/TextBlockSectionDefinition.js.map +1 -1
  31. package/dist/esm/component/componentDefinitions/index.js +8 -1
  32. package/dist/esm/component/componentDefinitions/index.js.map +1 -1
  33. package/dist/esm/component/types.js.map +1 -1
  34. package/dist/esm/hostScope.js.map +1 -1
  35. package/dist/esm/index.js +2 -1
  36. package/dist/esm/index.js.map +1 -1
  37. package/dist/types/client/applyThemeOverrides.d.ts +19 -0
  38. package/dist/types/client/applyThemeOverrides.d.ts.map +1 -0
  39. package/dist/types/client/clientBundleUrl.d.ts +22 -0
  40. package/dist/types/client/clientBundleUrl.d.ts.map +1 -1
  41. package/dist/types/component/componentDefinitions/HeroEntitySectionDefinition.d.ts.map +1 -1
  42. package/dist/types/component/componentDefinitions/HeroSectionDefinition.d.ts.map +1 -1
  43. package/dist/types/component/componentDefinitions/NextStepsSectionDefinition.d.ts.map +1 -1
  44. package/dist/types/component/componentDefinitions/TextBlockSectionDefinition.d.ts.map +1 -1
  45. package/dist/types/component/componentDefinitions/index.d.ts.map +1 -1
  46. package/dist/types/component/types.d.ts +7 -0
  47. package/dist/types/component/types.d.ts.map +1 -1
  48. package/dist/types/hostScope.d.ts +11 -0
  49. package/dist/types/hostScope.d.ts.map +1 -1
  50. package/dist/types/index.d.ts +2 -1
  51. package/dist/types/index.d.ts.map +1 -1
  52. package/package.json +2 -2
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.THEME_OVERRIDE_TOKENS = void 0;
5
+ exports.applyThemeOverrides = applyThemeOverrides;
6
+ var _hostScope = require("../hostScope");
7
+ /**
8
+ * Runtime theme token injection (DL #131).
9
+ *
10
+ * `Configuration.themeOverrides` carries per-store CSS custom-property
11
+ * overrides (`--primary`, `--radius`, `--heading`, ...) computed from the
12
+ * store's own theme (e.g. the Shopify `settings_data.json` extractor). This
13
+ * applies them to the page so they win over the bundle's baked `theme.css`:
14
+ *
15
+ * - **Scoped, not `:root`**: the rule targets `WEB5_SCOPE`, the same
16
+ * `:is(#root, .w5-root, [data-web5-placement], .debug-view)` selector every
17
+ * compiled bundle stylesheet uses — host-page styling is never touched, and
18
+ * equal specificity + later document order makes the override win. Callers
19
+ * must therefore apply AFTER the client bundle's CSS is in the document.
20
+ * - **Open token set**: any sanely-shaped custom property is applied, so a
21
+ * template can grow new tokens without an FE or BE release. The mandatory
22
+ * `--` prefix means an override can only define custom properties — it can
23
+ * never set a real CSS property inside the scope. The server enforces the
24
+ * same shape (plus value sanitation) at write time.
25
+ * - **Values are inert**: entries are written with
26
+ * `CSSStyleDeclaration.setProperty`, never string-concatenated into CSS, so
27
+ * a hostile value cannot terminate the declaration or open a new rule.
28
+ * - **Idempotent**: one marker element per document, replaced wholesale on
29
+ * re-apply; empty/absent input removes it.
30
+ */
31
+
32
+ /** A themeOverrides key: always a CSS custom property. */
33
+
34
+ /**
35
+ * Writer-side shape for a theme override map. The catalog below documents
36
+ * the tokens the seed consumes today; the type stays open so new tokens
37
+ * flow end-to-end with no release anywhere but the seed.
38
+ */
39
+
40
+ /**
41
+ * The known token catalog — the CSS custom properties the seed's Tailwind
42
+ * bridge consumes today. GUIDANCE, NOT A GATE: writers (the Shopify theme
43
+ * extractor, admin tooling) should stick to these to produce visible effect,
44
+ * but `applyThemeOverrides` deliberately applies any well-formed custom
45
+ * property so the vocabulary can grow from the seed alone (matching the
46
+ * open-set validation on the server).
47
+ */
48
+ const THEME_OVERRIDE_TOKENS = exports.THEME_OVERRIDE_TOKENS = new Set(['--background', '--foreground', '--card', '--card-foreground', '--popover', '--popover-foreground', '--primary', '--primary-foreground', '--secondary', '--secondary-foreground', '--muted', '--muted-foreground', '--accent', '--accent-foreground', '--border', '--input', '--ring', '--radius', '--font-sans', '--font-display', '--heading']);
49
+
50
+ /** Mirrors the server's Consts.ThemeOverrideKeyPattern. */
51
+ const KEY_PATTERN = /^--[a-z][a-z0-9-]{0,62}$/;
52
+ const MARKER_ATTR = 'data-web5-theme-overrides';
53
+ function applyThemeOverrides(overrides) {
54
+ if (typeof document === 'undefined') return;
55
+ const existing = document.head.querySelector(`style[${MARKER_ATTR}]`);
56
+ const entries = Object.entries(overrides ?? {}).filter(([key]) => {
57
+ const wellFormed = KEY_PATTERN.test(key);
58
+ if (!wellFormed) {
59
+ console.warn(`[web5-theme] Skipping malformed theme override key: ${key}`);
60
+ }
61
+ return wellFormed;
62
+ });
63
+ if (entries.length === 0) {
64
+ existing == null || existing.remove();
65
+ return;
66
+ }
67
+ const style = document.createElement('style');
68
+ style.setAttribute(MARKER_ATTR, '');
69
+ document.head.appendChild(style);
70
+ const sheet = style.sheet;
71
+ if (!sheet) {
72
+ style.remove();
73
+ return;
74
+ }
75
+ sheet.insertRule(`${_hostScope.WEB5_SCOPE} {}`, 0);
76
+ const rule = sheet.cssRules[0];
77
+ for (const [key, value] of entries) {
78
+ try {
79
+ rule.style.setProperty(key, value);
80
+ } catch {
81
+ // An engine that rejects the value leaves the token at its baked
82
+ // default — degraded theming, never broken CSS.
83
+ }
84
+ }
85
+ // Replace-on-reapply: the fresh element is appended (so it stays last in
86
+ // document order) before the stale one is dropped.
87
+ existing == null || existing.remove();
88
+ }
89
+ //# sourceMappingURL=applyThemeOverrides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_hostScope","require","THEME_OVERRIDE_TOKENS","exports","Set","KEY_PATTERN","MARKER_ATTR","applyThemeOverrides","overrides","document","existing","head","querySelector","entries","Object","filter","key","wellFormed","test","console","warn","length","remove","style","createElement","setAttribute","appendChild","sheet","insertRule","WEB5_SCOPE","rule","cssRules","value","setProperty"],"sources":["../../../src/client/applyThemeOverrides.ts"],"sourcesContent":["/**\n * Runtime theme token injection (DL #131).\n *\n * `Configuration.themeOverrides` carries per-store CSS custom-property\n * overrides (`--primary`, `--radius`, `--heading`, ...) computed from the\n * store's own theme (e.g. the Shopify `settings_data.json` extractor). This\n * applies them to the page so they win over the bundle's baked `theme.css`:\n *\n * - **Scoped, not `:root`**: the rule targets `WEB5_SCOPE`, the same\n * `:is(#root, .w5-root, [data-web5-placement], .debug-view)` selector every\n * compiled bundle stylesheet uses — host-page styling is never touched, and\n * equal specificity + later document order makes the override win. Callers\n * must therefore apply AFTER the client bundle's CSS is in the document.\n * - **Open token set**: any sanely-shaped custom property is applied, so a\n * template can grow new tokens without an FE or BE release. The mandatory\n * `--` prefix means an override can only define custom properties — it can\n * never set a real CSS property inside the scope. The server enforces the\n * same shape (plus value sanitation) at write time.\n * - **Values are inert**: entries are written with\n * `CSSStyleDeclaration.setProperty`, never string-concatenated into CSS, so\n * a hostile value cannot terminate the declaration or open a new rule.\n * - **Idempotent**: one marker element per document, replaced wholesale on\n * re-apply; empty/absent input removes it.\n */\nimport { WEB5_SCOPE } from '../hostScope';\n\n/** A themeOverrides key: always a CSS custom property. */\nexport type ThemeOverrideKey = `--${string}`;\n\n/**\n * Writer-side shape for a theme override map. The catalog below documents\n * the tokens the seed consumes today; the type stays open so new tokens\n * flow end-to-end with no release anywhere but the seed.\n */\nexport type ThemeOverrides = Record<ThemeOverrideKey, string>;\n\n/**\n * The known token catalog — the CSS custom properties the seed's Tailwind\n * bridge consumes today. GUIDANCE, NOT A GATE: writers (the Shopify theme\n * extractor, admin tooling) should stick to these to produce visible effect,\n * but `applyThemeOverrides` deliberately applies any well-formed custom\n * property so the vocabulary can grow from the seed alone (matching the\n * open-set validation on the server).\n */\nexport const THEME_OVERRIDE_TOKENS: ReadonlySet<string> = new Set([\n '--background', '--foreground',\n '--card', '--card-foreground',\n '--popover', '--popover-foreground',\n '--primary', '--primary-foreground',\n '--secondary', '--secondary-foreground',\n '--muted', '--muted-foreground',\n '--accent', '--accent-foreground',\n '--border', '--input', '--ring',\n '--radius',\n '--font-sans', '--font-display',\n '--heading',\n]);\n\n/** Mirrors the server's Consts.ThemeOverrideKeyPattern. */\nconst KEY_PATTERN = /^--[a-z][a-z0-9-]{0,62}$/;\n\nconst MARKER_ATTR = 'data-web5-theme-overrides';\n\nexport function applyThemeOverrides(\n overrides?: Record<string, string> | null,\n): void {\n if (typeof document === 'undefined') return;\n\n const existing = document.head.querySelector(`style[${MARKER_ATTR}]`);\n const entries = Object.entries(overrides ?? {}).filter(([key]) => {\n const wellFormed = KEY_PATTERN.test(key);\n if (!wellFormed) {\n console.warn(`[web5-theme] Skipping malformed theme override key: ${key}`);\n }\n return wellFormed;\n });\n\n if (entries.length === 0) {\n existing?.remove();\n return;\n }\n\n const style = document.createElement('style');\n style.setAttribute(MARKER_ATTR, '');\n document.head.appendChild(style);\n const sheet = style.sheet;\n if (!sheet) {\n style.remove();\n return;\n }\n sheet.insertRule(`${WEB5_SCOPE} {}`, 0);\n const rule = sheet.cssRules[0] as CSSStyleRule;\n for (const [key, value] of entries) {\n try {\n rule.style.setProperty(key, value);\n } catch {\n // An engine that rejects the value leaves the token at its baked\n // default — degraded theming, never broken CSS.\n }\n }\n // Replace-on-reapply: the fresh element is appended (so it stays last in\n // document order) before the stale one is dropped.\n existing?.remove();\n}\n"],"mappings":";;;;;AAwBA,IAAAA,UAAA,GAAAC,OAAA;AAxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;;AAGA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,qBAA0C,GAAAC,OAAA,CAAAD,qBAAA,GAAG,IAAIE,GAAG,CAAC,CAChE,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,mBAAmB,EAC7B,WAAW,EAAE,sBAAsB,EACnC,WAAW,EAAE,sBAAsB,EACnC,aAAa,EAAE,wBAAwB,EACvC,SAAS,EAAE,oBAAoB,EAC/B,UAAU,EA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AiB;EAC9C,KAAK,MAAM,CAACf,GAAG,EAAEgB,KAAK,CAAC,IAAInB,OAAO,EAAE;IAClC,IAAI;MACFiB,IAAI,CAACP,KAAK,CAACU,WAAW,CAACjB,GAAG,EAAEgB,KAAK,CAAC;IACpC,CAAC,CAAC,MAAM;MACN;MACA;IAAA;EAEJ;EACA;EACA;EACAtB,QAAQ,YAARA,QAAQ,CAAEY,MAAM,CAAC,CAAC;AACpB","ignoreList":[]}
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
+ exports.TEMPLATES_MANIFEST_URL = exports.TEMPLATES_CDN_BASE = void 0;
5
+ exports.getTemplateOverride = getTemplateOverride;
6
+ exports.isTemplatePickerRequested = isTemplatePickerRequested;
7
+ exports.isValidTemplateId = isValidTemplateId;
4
8
  exports.resolveClientBundleUrl = resolveClientBundleUrl;
5
9
  /**
6
10
  * Client-UMD URL resolution, shared between `web50-server-ui` (the main app)
@@ -21,6 +25,14 @@ exports.resolveClientBundleUrl = resolveClientBundleUrl;
21
25
  const CLIENT_BUNDLE_CDN = 'https://d13cktzsgh0qls.cloudfront.net';
22
26
  const CLIENT_BUNDLE_FILENAME = 'w5-components.umd.js';
23
27
 
28
+ /**
29
+ * The template catalog the onboarding gallery and the preview picker render —
30
+ * published by web5-seed-1's CI (`templates/manifest.json` + previews),
31
+ * CORS-open. Thumbnail paths inside are relative to `TEMPLATES_CDN_BASE`.
32
+ */
33
+ const TEMPLATES_CDN_BASE = exports.TEMPLATES_CDN_BASE = `${CLIENT_BUNDLE_CDN}/templates`;
34
+ const TEMPLATES_MANIFEST_URL = exports.TEMPLATES_MANIFEST_URL = `${TEMPLATES_CDN_BASE}/manifest.json`;
35
+
24
36
  /**
25
37
  * Template ids are kebab-case slugs from `templates/manifest.json`
26
38
  * (`web5-seed-1`). The id becomes a CDN path segment, so anything else is a
@@ -28,6 +40,37 @@ const CLIENT_BUNDLE_FILENAME = 'w5-components.umd.js';
28
40
  * store keeps rendering) rather than fetching a malformed URL.
29
41
  */
30
42
  const TEMPLATE_ID_PATTERN = /^[a-z0-9]+(-[a-z0-9]+)*$/;
43
+ function isValidTemplateId(id) {
44
+ return id.length <= 64 && TEMPLATE_ID_PATTERN.test(id);
45
+ }
46
+
47
+ /**
48
+ * `?web5Template=<id>` — client-side template override (DL #129 Q10), the
49
+ * mechanism behind the live-preview picker: reload with the param and the page
50
+ * renders under that template's shared bundle, no Configuration write.
51
+ *
52
+ * Strictly narrower than `?clientBundleUrl=`: the value is a kebab-validated
53
+ * id interpolated into the fixed CDN template prefix, so it can only ever
54
+ * select one of our own template bundles — purely presentational, harmless if
55
+ * a visitor sets it by hand. Precedence at the call sites:
56
+ * `clientBundleUrl` override > this > `Configuration.templateId`.
57
+ */
58
+ function getTemplateOverride(search) {
59
+ const value = new URLSearchParams(search).get('web5Template');
60
+ if (!value) {
61
+ return null;
62
+ }
63
+ if (!isValidTemplateId(value)) {
64
+ console.warn(`[web5-core] Ignoring malformed ?web5Template= override "${value}".`);
65
+ return null;
66
+ }
67
+ return value;
68
+ }
69
+
70
+ /** `?web5TemplatePicker=1` — should the preview picker overlay render? */
71
+ function isTemplatePickerRequested(search) {
72
+ return new URLSearchParams(search).get('web5TemplatePicker') === '1';
73
+ }
31
74
  function resolveClientBundleUrl(msid, templateId) {
32
75
  if (templateId) {
33
76
  if (TEMPLATE_ID_PATTERN.test(templateId)) {
@@ -1 +1 @@
1
- {"version":3,"names":["CLIENT_BUNDLE_CDN","CLIENT_BUNDLE_FILENAME","TEMPLATE_ID_PATTERN","resolveClientBundleUrl","msid","templateId","test","console","warn"],"sources":["../../../src/client/clientBundleUrl.ts"],"sourcesContent":["/**\n * Client-UMD URL resolution, shared between `web50-server-ui` (the main app)\n * and `embed-placement` (the storefront widget) — DL #094 (per-msid) + DL #129\n * (per-template). Centralized here for the same reason as\n * `clientBundleOverride.ts`: both callers must derive identical URLs, and\n * divergence on which bundle a tenant executes would be a real bug.\n *\n * Two tiers (DL #129):\n * - `templateId` present (DIY store) → the shared per-template bundle,\n * `<cdn>/templates/<id>/production/…`. Every store on a template runs the\n * same artifact; `production` is the promoted channel.\n * - `templateId` absent (customized tier: feature-com, circana, smallflower)\n * → the per-msid bundle at `<cdn>/<msid>/latest/…`, byte-identical to the\n * pre-template behavior.\n */\n\nconst CLIENT_BUNDLE_CDN = 'https://d13cktzsgh0qls.cloudfront.net';\nconst CLIENT_BUNDLE_FILENAME = 'w5-components.umd.js';\n\n/**\n * Template ids are kebab-case slugs from `templates/manifest.json`\n * (`web5-seed-1`). The id becomes a CDN path segment, so anything else is a\n * config error — resolve falls back to the per-msid path (fail-soft, and the\n * store keeps rendering) rather than fetching a malformed URL.\n */\nconst TEMPLATE_ID_PATTERN = /^[a-z0-9]+(-[a-z0-9]+)*$/;\n\nexport function resolveClientBundleUrl(\n msid: string,\n templateId?: string | null,\n): string {\n if (templateId) {\n if (TEMPLATE_ID_PATTERN.test(templateId)) {\n return `${CLIENT_BUNDLE_CDN}/templates/${templateId}/production/${CLIENT_BUNDLE_FILENAME}`;\n }\n console.warn(\n `[web5-core] Ignoring malformed templateId \"${templateId}\" — falling back to the per-msid bundle.`,\n );\n }\n return `${CLIENT_BUNDLE_CDN}/${msid}/latest/${CLIENT_BUNDLE_FILENAME}`;\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,iBAAiB,GAAG,uCAAuC;AACjE,MAAMC,sBAAsB,GAAG,sBAAsB;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAmB,GAAG,0BAA0B;AAE/C,SAASC,sBAAsBA,CACpCC,IAAY,EACZC,UAA0B,EAClB;EACR,IAAIA,UAAU,EAAE;IACd,IAAIH,mBAAmB,CAACI,IAAI,CAACD,UAAU,CAAC,EAAE;MACxC,OAAO,GAAGL,iBAAiB,cAAcK,UAAU,eAAeJ,sBAAsB,EAAE;IAC5F;IACAM,OAAO,CAACC,IAAI,CACV,8CAA8CH,UAAU,0CAC1D,CAAC;EACH;EACA,OAAO,GAAGL,iBAAiB,IAAII,IAAI,WAAWH,sBAAsB,EAAE;AACxE","ignoreList":[]}
1
+ {"version":3,"names":["CLIENT_BUNDLE_CDN","CLIENT_BUNDLE_FILENAME","TEMPLATES_CDN_BASE","exports","TEMPLATES_MANIFEST_URL","TEMPLATE_ID_PATTERN","isValidTemplateId","id","length","test","getTemplateOverride","search","value","URLSearchParams","get","console","warn","isTemplatePickerRequested","resolveClientBundleUrl","msid","templateId"],"sources":["../../../src/client/clientBundleUrl.ts"],"sourcesContent":["/**\n * Client-UMD URL resolution, shared between `web50-server-ui` (the main app)\n * and `embed-placement` (the storefront widget) — DL #094 (per-msid) + DL #129\n * (per-template). Centralized here for the same reason as\n * `clientBundleOverride.ts`: both callers must derive identical URLs, and\n * divergence on which bundle a tenant executes would be a real bug.\n *\n * Two tiers (DL #129):\n * - `templateId` present (DIY store) → the shared per-template bundle,\n * `<cdn>/templates/<id>/production/…`. Every store on a template runs the\n * same artifact; `production` is the promoted channel.\n * - `templateId` absent (customized tier: feature-com, circana, smallflower)\n * → the per-msid bundle at `<cdn>/<msid>/latest/…`, byte-identical to the\n * pre-template behavior.\n */\n\nconst CLIENT_BUNDLE_CDN = 'https://d13cktzsgh0qls.cloudfront.net';\nconst CLIENT_BUNDLE_FILENAME = 'w5-components.umd.js';\n\n/**\n * The template catalog the onboarding gallery and the preview picker render —\n * published by web5-seed-1's CI (`templates/manifest.json` + previews),\n * CORS-open. Thumbnail paths inside are relative to `TEMPLATES_CDN_BASE`.\n */\nexport const TEMPLATES_CDN_BASE = `${CLIENT_BUNDLE_CDN}/templates`;\nexport const TEMPLATES_MANIFEST_URL = `${TEMPLATES_CDN_BASE}/manifest.json`;\n\n/**\n * Template ids are kebab-case slugs from `templates/manifest.json`\n * (`web5-seed-1`). The id becomes a CDN path segment, so anything else is a\n * config error — resolve falls back to the per-msid path (fail-soft, and the\n * store keeps rendering) rather than fetching a malformed URL.\n */\nconst TEMPLATE_ID_PATTERN = /^[a-z0-9]+(-[a-z0-9]+)*$/;\n\nexport function isValidTemplateId(id: string): boolean {\n return id.length <= 64 && TEMPLATE_ID_PATTERN.test(id);\n}\n\n/**\n * `?web5Template=<id>` — client-side template override (DL #129 Q10), the\n * mechanism behind the live-preview picker: reload with the param and the page\n * renders under that template's shared bundle, no Configuration write.\n *\n * Strictly narrower than `?clientBundleUrl=`: the value is a kebab-validated\n * id interpolated into the fixed CDN template prefix, so it can only ever\n * select one of our own template bundles — purely presentational, harmless if\n * a visitor sets it by hand. Precedence at the call sites:\n * `clientBundleUrl` override > this > `Configuration.templateId`.\n */\nexport function getTemplateOverride(search: string): string | null {\n const value = new URLSearchParams(search).get('web5Template');\n if (!value) {\n return null;\n }\n if (!isValidTemplateId(value)) {\n console.warn(\n `[web5-core] Ignoring malformed ?web5Template= override \"${value}\".`,\n );\n return null;\n }\n return value;\n}\n\n/** `?web5TemplatePicker=1` — should the preview picker overlay render? */\nexport function isTemplatePickerRequested(search: string): boolean {\n return new URLSearchParams(search).get('web5TemplatePicker') === '1';\n}\n\nexport function resolveClientBundleUrl(\n msid: string,\n templateId?: string | null,\n): string {\n if (templateId) {\n if (TEMPLATE_ID_PATTERN.test(templateId)) {\n return `${CLIENT_BUNDLE_CDN}/templates/${templateId}/production/${CLIENT_BUNDLE_FILENAME}`;\n }\n console.warn(\n `[web5-core] Ignoring malformed templateId \"${templateId}\" — falling back to the per-msid bundle.`,\n );\n }\n return `${CLIENT_BUNDLE_CDN}/${msid}/latest/${CLIENT_BUNDLE_FILENAME}`;\n}\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,iBAAiB,GAAG,uCAAuC;AACjE,MAAMC,sBAAsB,GAAG,sBAAsB;;AAErD;AACA;AACA;AACA;AACA;AACO,MAAMC,kBAAkB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53,7 @@ Nike offerings span performance and lifestyle lines.
53
53
  * [Nike Life Cable Knit Turtleneck Sweater](web5://entity/product/ZDvHxsa3IJA8CyGX8BNpdw)
54
54
  * [Nike x Jacquemus NRG HE Swoosh Hoodie](web5://entity/product/qH2lqINGneHWYVZzzGnXTA)`,
55
55
  expected: {
56
- headline: 'Nike collections',
56
+ headline: '**Nike** collections',
57
57
  content: 'Nike offerings span performance and lifestyle lines.',
58
58
  image: 'web5://image/Nike+Life+collection',
59
59
  items: [{
@@ -116,7 +116,10 @@ Nike offerings span performance and lifestyle lines.
116
116
  leadingQuote = (0, _parseUtils.parseCalloutTag)(raw).text || undefined;
117
117
  }
118
118
  return {
119
- headline: (0, _parseUtils.headingText)(parts, 1),
119
+ // Markdown-preserving (not headingText): the hero title now carries the
120
+ // bold+italic hook the ECHO callout used to own, so the FE needs the
121
+ // formatting, not just the plain text. See FeatureHeroEntity.tsx.
122
+ headline: (0, _parseUtils.headingMarkdown)(parts, 1),
120
123
  badge: (0, _parseUtils.headingText)(parts, 3) || undefined,
121
124
  content: (0, _parseUtils.bodyText)(parts) || undefined,
122
125
  image: (0, _parseUtils.firstImageSrc)(parts),
@@ -1 +1 @@
1
- {"version":3,"names":["_parseUtils","require","_parts","_diagnosticTypes","HeroEntitySectionDefinition","constructor","_defineProperty2","default","headline","content","items","entityId","entityType","entityUrl","linkText","markdown","expected","image","parse","parts","context","entityRefs","extractEntityRefs","length","reportDiagnostic","DIAGNOSTIC_TYPES","SECTION_REJECTED","map","e","undefined","description","imageUrl","markdownImageUrl","callout","h1Index","findIndex","p","_p$meta","type","meta","level","blockquotes","getPartsByType","leadingQuote","bq","_bq$meta","_bq$content","bqIndex","indexOf","raw","trim","parseCalloutTag","text","headingText","badge","bodyText","firstImageSrc","exports"],"sources":["../../../../src/component/componentDefinitions/HeroEntitySectionDefinition.ts"],"sourcesContent":["import {\n headingText,\n bodyText,\n firstImageSrc,\n parseCalloutTag,\n extractEntityRefs,\n} from './parse-utils';\nimport type { Part } from '../../parts/parts';\nimport { getPartsByType } from '../../parts/parts';\nimport type {\n EntityItem,\n HeroEntityCompProps,\n HeroEntitySectionComponent,\n SectionFixture,\n} from '../types';\nimport type { SectionDefinition, ParseContext } from '../section-definition';\nimport { DIAGNOSTIC_TYPES } from '../diagnosticTypes';\n\n/**\n * Hero section whose body carries one or more web5 entity links\n * (`web5://entity/...`). It mirrors the framing of {@link HeroSectionDefinition}\n * (leading callout, h1, image, intro text) but, instead of turning the links\n * into CTA buttons, surfaces them as resolvable entities.\n *\n * Registered ahead of `HeroSectionDefinition` so an entity-bearing hero is\n * claimed here first. The pattern requires at least one `link[entityType]`, and\n * `parse()` returns `null` when no entity refs are found, letting a plain hero\n * fall through to `HeroSectionDefinition`.\n */\nexport class HeroEntitySectionDefinition\n implements SectionDefinition<HeroEntitySectionComponent>\n{\n sectionType = 'hero-entity' as const;\n singleInstance = true;\n patterns = [\n // Leading slots mirror HeroSectionDefinition: section descriptor, then the\n // optional leading ECHO callout, then an optional h3 badge, then the h1.\n // Callout and badge are independent; the second `html_comment?` preserves the\n // legacy callout-before-descriptor ordering for pages saved before this change.\n // Entity links carried as list items (the canonical shape).\n 'html_comment? > callout? > html_comment? > h3? > h1 > (image | t | link)* > list{item[1-]:link[entityType] > image? > (t | callout)*}',\n // Entity links sitting at the top level of the hero body.\n 'html_comment? > callout? > html_comment? > h3? > h1 > (image | t)* > (link[entityType] > image? > (t | callout)*)[1-] > list?',\n ];\n\n defaults: HeroEntityCompProps = {\n headline: 'Featured collection',\n content: 'Explore the highlights from this collection.',\n items: [\n {\n entityId: 'example-1',\n entityType: 'product',\n entityUrl: 'web5://entity/product/example-1',\n linkText: 'Example product',\n },\n ],\n };\n\n fixtures: SectionFixture<HeroEntityCompProps>[] = [\n {\n markdown: `<!-- section:hero, id:hero, semantic:hero -->\n\n# **Nike** collections\n\n![Nike Life collection](web5://image/Nike+Life+collection)\nNike offerings span performance and lifestyle lines.\n\n* [Nike Throwback Future Collection](web5://entity/article/WAyuiC63OSjwpvnOyZcblQ)\n* [Nike Life Cable Knit Turtleneck Sweater](web5://entity/product/ZDvHxsa3IJA8CyGX8BNpdw)\n* [Nike x Jacquemus NRG HE Swoosh Hoodie](web5://entity/product/qH2lqINGneHWYVZzzGnXTA)`,\n expected: {\n headline: 'Nike collections',\n content: 'Nike offerings span performance and lifestyle lines.',\n image: 'web5://image/Nike+Life+collection',\n items: [\n {\n entityId: 'WAyuiC63OSjwpvnOyZcblQ',\n entityType: 'article',\n entityUrl:\n 'web5://entity/article/WAyuiC63OSjwpvnOyZcblQ',\n linkText: 'Nike Throwback Future Collection',\n },\n {\n entityId: 'ZDvHxsa3IJA8CyGX8BNpdw',\n entityType: 'product',\n entityUrl:\n 'web5://entity/product/ZDvHxsa3IJA8CyGX8BNpdw',\n linkText: 'Nike Life Cable Knit Turtleneck Sweater',\n },\n {\n entityId: 'qH2lqINGneHWYVZzzGnXTA',\n entityType: 'product',\n entityUrl:\n 'web5://entity/product/qH2lqINGneHWYVZzzGnXTA',\n linkText: 'Nike x Jacquemus NRG HE Swoosh Hoodie',\n },\n ],\n },\n },\n ];\n\n parse(parts: Part[], context?: ParseContext): HeroEntityCompProps | null {\n const entityRefs = extractEntityRefs(parts);\n\n if (entityRefs.length === 0) {\n // Not an entity hero — let HeroSectionDefinition claim it.\n context?.reportDiagnostic?.(\n DIAGNOSTIC_TYPES.SECTION_REJECTED,\n 'hero-entity: no entity links found',\n );\n return null;\n }\n\n const items: EntityItem[] = entityRefs.map((e) => ({\n entityId: e.entityId,\n entityType: e.entityType,\n entityUrl: e.entityUrl,\n linkText: e.linkText || undefined,\n description: e.description || undefined,\n imageUrl: e.markdownImageUrl,\n callout: e.callout,\n }));\n\n // The leading callout before the h1 — the ECHO the orchestrator emits as the\n // hero's opening line, right after the section descriptor — is part of the\n // hero, mirroring HeroSectionDefinition. A trailing callout falls through to a\n // downstream callout section. (Per-item callouts inside the entity list are\n // handled by extractEntityRefs above and are unaffected.)\n const h1Index = parts.findIndex(\n (p) =>\n p.type === 'heading' && (p.meta as { level?: number })?.level === 1,\n );\n const blockquotes = getPartsByType<Part>(parts, 'callout');\n let leadingQuote: string | undefined;\n\n for (const bq of blockquotes) {\n const bqIndex = parts.indexOf(bq);\n if (h1Index >= 0 && bqIndex > h1Index) {\n continue;\n }\n const raw = (bq.meta?.markdown as string)?.trim() || bq.content?.trim();\n if (!raw) {\n continue;\n }\n leadingQuote = parseCalloutTag(raw).text || undefined;\n }\n\n return {\n headline: headingText(parts, 1),\n badge: headingText(parts, 3) || undefined,\n content: bodyText(parts) || undefined,\n image: firstImageSrc(parts),\n leadingQuote,\n items,\n };\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAD,OAAA;AAQA,IAAAE,gBAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,2BAA2B,CAExC;EAAAC,YAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,uBACgB,aAAa;IAAA,IAAAD,gBAAA,CAAAC,OAAA,0BACV,IAAI;IAAA,IAAAD,gBAAA,CAAAC,OAAA,oBACV;IACT;IACA;IACA;IACA;IACA;IACA,uIAAuI;IACvI;IACA,+HAA+H,CAChI;IAAA,IAAAD,gBAAA,CAAAC,OAAA,oBAE+B;MAC9BC,QAAQ,EAAE,qBAAqB;MAC/BC,OAAO,EAAE,8CAA8C;MACvDC,KAAK,EAAE,CACL;QACEC,QAAQ,EAAE,WAAW;QACrBC,UAAU,EAAE,SAAS;QACrBC,SAAS,EAAE,iCAAiC;QAC5CC,QAAQ,EAAE;MACZ,CAAC;IAEL,CAAC;IAAA,IAAAR,gBAAA,CAAAC,OAAA,oBAEiD,CAChD;MACEQ,QAAQ,EAAE;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wFAAwF;MAClFC,QAAQ,EAAE;QACRR,QAAQ,EAAE,kBAAkB;Q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"version":3,"names":["_parseUtils","require","_parts","_diagnosticTypes","HeroEntitySectionDefinition","constructor","_defineProperty2","default","headline","content","items","entityId","entityType","entityUrl","linkText","markdown","expected","image","parse","parts","context","entityRefs","extractEntityRefs","length","reportDiagnostic","DIAGNOSTIC_TYPES","SECTION_REJECTED","map","e","undefined","description","imageUrl","markdownImageUrl","callout","h1Index","findIndex","p","_p$meta","type","meta","level","blockquotes","getPartsByType","leadingQuote","bq","_bq$meta","_bq$content","bqIndex","indexOf","raw","trim","parseCalloutTag","text","headingMarkdown","badge","headingText","bodyText","firstImageSrc","exports"],"sources":["../../../../src/component/componentDefinitions/HeroEntitySectionDefinition.ts"],"sourcesContent":["import {\n headingText,\n headingMarkdown,\n bodyText,\n firstImageSrc,\n parseCalloutTag,\n extractEntityRefs,\n} from './parse-utils';\nimport type { Part } from '../../parts/parts';\nimport { getPartsByType } from '../../parts/parts';\nimport type {\n EntityItem,\n HeroEntityCompProps,\n HeroEntitySectionComponent,\n SectionFixture,\n} from '../types';\nimport type { SectionDefinition, ParseContext } from '../section-definition';\nimport { DIAGNOSTIC_TYPES } from '../diagnosticTypes';\n\n/**\n * Hero section whose body carries one or more web5 entity links\n * (`web5://entity/...`). It mirrors the framing of {@link HeroSectionDefinition}\n * (leading callout, h1, image, intro text) but, instead of turning the links\n * into CTA buttons, surfaces them as resolvable entities.\n *\n * Registered ahead of `HeroSectionDefinition` so an entity-bearing hero is\n * claimed here first. The pattern requires at least one `link[entityType]`, and\n * `parse()` returns `null` when no entity refs are found, letting a plain hero\n * fall through to `HeroSectionDefinition`.\n */\nexport class HeroEntitySectionDefinition\n implements SectionDefinition<HeroEntitySectionComponent>\n{\n sectionType = 'hero-entity' as const;\n singleInstance = true;\n patterns = [\n // Leading slots mirror HeroSectionDefinition: section descriptor, then the\n // optional leading ECHO callout, then an optional h3 badge, then the h1.\n // Callout and badge are independent; the second `html_comment?` preserves the\n // legacy callout-before-descriptor ordering for pages saved before this change.\n // Entity links carried as list items (the canonical shape).\n 'html_comment? > callout? > html_comment? > h3? > h1 > (image | t | link)* > list{item[1-]:link[entityType] > image? > (t | callout)*}',\n // Entity links sitting at the top level of the hero body.\n 'html_comment? > callout? > html_comment? > h3? > h1 > (image | t)* > (link[entityType] > image? > (t | callout)*)[1-] > list?',\n ];\n\n defaults: HeroEntityCompProps = {\n headline: 'Featured collection',\n content: 'Explore the highlights from this collection.',\n items: [\n {\n entityId: 'example-1',\n entityType: 'product',\n entityUrl: 'web5://entity/product/example-1',\n linkText: 'Example product',\n },\n ],\n };\n\n fixtures: SectionFixture<HeroEntityCompProps>[] = [\n {\n markdown: `<!-- section:hero, id:hero, semantic:hero -->\n\n# **Nike** collections\n\n![Nike Life collection](web5://image/Nike+Life+collection)\nNike offerings span performance and lifestyle lines.\n\n* [Nike Throwback Future Collection](web5://entity/article/WAyuiC63OSjwpvnOyZcblQ)\n* [Nike Life Cable Knit Turtleneck Sweater](web5://entity/product/ZDvHxsa3IJA8CyGX8BNpdw)\n* [Nike x Jacquemus NRG HE Swoosh Hoodie](web5://entity/product/qH2lqINGneHWYVZzzGnXTA)`,\n expected: {\n headline: '**Nike** collections',\n content: 'Nike offerings span performance and lifestyle lines.',\n image: 'web5://image/Nike+Life+collection',\n items: [\n {\n entityId: 'WAyuiC63OSjwpvnOyZcblQ',\n entityType: 'article',\n entityUrl:\n 'web5://entity/article/WAyuiC63OSjwpvnOyZcblQ',\n linkText: 'Nike Throwback Future Collection',\n },\n {\n entityId: 'ZDvHxsa3IJA8CyGX8BNpdw',\n entityType: 'product',\n entityUrl:\n 'web5://entity/product/ZDvHxsa3IJA8CyGX8BNpdw',\n linkText: 'Nike Life Cable Knit Turtleneck Sweater',\n },\n {\n entityId: 'qH2lqINGneHWYVZzzGnXTA',\n entityType: 'product',\n entityUrl:\n 'web5://entity/product/qH2lqINGneHWYVZzzGnXTA',\n linkText: 'Nike x Jacquemus NRG HE Swoosh Hoodie',\n },\n ],\n },\n },\n ];\n\n parse(parts: Part[], context?: ParseContext): HeroEntityCompProps | null {\n const entityRefs = extractEntityRefs(parts);\n\n if (entityRefs.length === 0) {\n // Not an entity hero — let HeroSectionDefinition claim it.\n context?.reportDiagnostic?.(\n DIAGNOSTIC_TYPES.SECTION_REJECTED,\n 'hero-entity: no entity links found',\n );\n return null;\n }\n\n const items: EntityItem[] = entityRefs.map((e) => ({\n entityId: e.entityId,\n entityType: e.entityType,\n entityUrl: e.entityUrl,\n linkText: e.linkText || undefined,\n description: e.description || undefined,\n imageUrl: e.markdownImageUrl,\n callout: e.callout,\n }));\n\n // The leading callout before the h1 — the ECHO the orchestrator emits as the\n // hero's opening line, right after the section descriptor — is part of the\n // hero, mirroring HeroSectionDefinition. A trailing callout falls through to a\n // downstream callout section. (Per-item callouts inside the entity list are\n // handled by extractEntityRefs above and are unaffected.)\n const h1Index = parts.findIndex(\n (p) =>\n p.type === 'heading' && (p.meta as { level?: number })?.level === 1,\n );\n const blockquotes = getPartsByType<Part>(parts, 'callout');\n let leadingQuote: string | undefined;\n\n for (const bq of blockquotes) {\n const bqIndex = parts.indexOf(bq);\n if (h1Index >= 0 && bqIndex > h1Index) {\n continue;\n }\n const raw = (bq.meta?.markdown as string)?.trim() || bq.content?.trim();\n if (!raw) {\n continue;\n }\n leadingQuote = parseCalloutTag(raw).text || undefined;\n }\n\n return {\n // Markdown-preserving (not headingText): the hero title now carries the\n // bold+italic hook the ECHO callout used to own, so the FE needs the\n // formatting, not just the plain text. See FeatureHeroEntity.tsx.\n headline: headingMarkdown(parts, 1),\n badge: headingText(parts, 3) || undefined,\n content: bodyText(parts) || undefined,\n image: firstImageSrc(parts),\n leadingQuote,\n items,\n };\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AASA,IAAAC,MAAA,GAAAD,OAAA;AAQA,IAAAE,gBAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,2BAA2B,CAExC;EAAAC,YAAA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,IAAI,CAAC,CAAC,OAAAJ,WAAA,GAAIF,EAAE,CAACnC,OAAO,qBAAVqC,WAAA,CAAYI,IAAI,CAAC,CAAC;MACvE,IAAI,CAACD,GAAG,EAAE;QACR;MACF;MACAN,YAAY,GAAG,IAAAQ,2BAAe,EAACF,GAAG,CAAC,CAACG,IAAI,IAAIvB,SAAS;IACvD;IAEA,OAAO;MACL;MACA;MACA;MACArB,QAAQ,EAAE,IAAA6C,2BAAe,EAAClC,KAAK,EAAE,CAAC,CAAC;MACnCmC,KAAK,EAAE,IAAAC,uBAAW,EAACpC,KAAK,EAAE,CAAC,CAAC,IAAIU,SAAS;MACzCpB,OAAO,EAAE,IAAA+C,oBAAQ,EAACrC,KAAK,CAAC,IAAIU,SAAS;MACrCZ,KAAK,EAAE,IAAAwC,yBAAa,EAACtC,KAAK,CAAC;MAC3BwB,YAAY;MACZjC;IACF,CAAC;EACH;AACF;AAACgD,OAAA,CAAAtD,2BAAA,GAAAA,2BAAA","ignoreList":[]}
@@ -203,7 +203,10 @@ Get started today with our amazing features.
203
203
  leadingQuote = (0, _parseUtils.parseCalloutTag)(raw).text || undefined;
204
204
  }
205
205
  return {
206
- headline: (0, _parseUtils.headingText)(parts, 1),
206
+ // Markdown-preserving (not headingText): the hero title now carries the
207
+ // bold+italic hook the ECHO callout used to own, so the FE needs the
208
+ // formatting, not just the plain text. See FeatureComparisonHero.tsx.
209
+ headline: (0, _parseUtils.headingMarkdown)(parts, 1),
207
210
  badge: (0, _parseUtils.headingText)(parts, 3) || undefined,
208
211
  content: (0, _parseUtils.bodyText)(parts) || undefined,
209
212
  buttons: buttons.length > 0 ? buttons : undefined,
@@ -1 +1 @@
1
- {"version":3,"names":["_parseUtils","require","_parts","HeroSectionDefinition","constructor","_defineProperty2","default","headline","content","buttons","id","text","variant","markdown","expected","onClick","image","parse","parts","firstImageSrc","lists","getPartsByType","list","item","_list$meta","meta","items","_item$meta","itemParts","nestedImage","buttonIndex","getLinks","map","l","i","_l$content","trim","href","length","trailingList","filteredItems","_list$meta2","_item$meta2","hasImage","some","p","type","push","allItemsAreLinks","listLinks","_item$meta3","_itemLinkParts$0$cont","itemLinkParts","filter","allText","extractListItemText","linkTexts","_l$content2","join","link","isFirstButton","lines","_item$meta4","h1Index","findIndex","_p$meta","level","blockquotes","leadingQuote","bq","_bq$meta","_bq$content","bqIndex","indexOf","raw","parseCalloutTag","undefined","headingText","badge","bodyText","exports"],"sources":["../../../../src/component/componentDefinitions/HeroSectionDefinition.ts"],"sourcesContent":["import {\n headingText,\n bodyText,\n firstImageSrc,\n parseCalloutTag,\n extractListItemText,\n} from './parse-utils';\nimport type { Part, ListPart, LinkPart, ListItemPart } from '../../parts/parts';\nimport { getPartsByType, getLinks } from '../../parts/parts';\nimport type {\n HeroButton,\n HeroCompProps,\n HeroSectionComponent,\n SectionFixture,\n} from '../types';\nimport type { SectionDefinition } from '../section-definition';\n\nexport class HeroSectionDefinition\n implements SectionDefinition<HeroSectionComponent>\n{\n sectionType = 'hero' as const;\n singleInstance = true;\n patterns = [\n // Canonical hero shape: section descriptor, then the leading ECHO callout\n // (optional in the grammar — the orchestrator always emits it, but a missing\n // ECHO must not stop the hero from rendering), then an optional h3 badge,\n // then the h1. The callout and badge are independent slots so a hero can\n // carry both. The second `html_comment?` keeps the legacy ordering\n // (callout before the descriptor) matching for pages saved before this change.\n 'html_comment? > callout? > html_comment? > h3? > h1 > (image | t | link)* > list?',\n ];\n\n defaults: HeroCompProps = {\n headline: 'Build something amazing',\n content: 'Your platform for data-driven decisions.',\n buttons: [{ id: 'btn-0', text: 'Get started', variant: 'primary' }],\n };\n\n fixtures: SectionFixture<HeroCompProps>[] = [\n {\n markdown:\n '# Welcome\\n\\nBuild amazing things.\\n\\n[Get Started](/) [Learn More](/about)',\n expected: {\n headline: 'Welcome',\n content: 'Build amazing things.',\n buttons: [\n {\n id: 'btn-0',\n text: 'Get Started',\n variant: 'primary',\n onClick: '/',\n },\n {\n id: 'btn-1',\n text: 'Learn More',\n variant: 'secondary',\n onClick: '/about',\n },\n ],\n },\n },\n {\n markdown: `<!-- Hero Section -->\n\n# Welcome to Our Platform\n\n![Hero Image](hero.jpg)\n\nGet started today with our amazing features.\n\n[Get Started](/signup) [Learn More](/about)`,\n expected: {\n headline: 'Welcome to Our Platform',\n content: 'Get started today with our amazing features.',\n buttons: [\n {\n id: 'btn-0',\n text: 'Get Started',\n variant: 'primary',\n onClick: '/signup',\n },\n {\n id: 'btn-1',\n text: 'Learn More',\n variant: 'secondary',\n onClick: '/about',\n },\n ],\n image: 'hero.jpg',\n },\n },\n ];\n\n parse(parts: Part[]): HeroCompProps {\n let image = firstImageSrc(parts);\n const lists = getPartsByType<ListPart>(parts, 'list');\n\n if (!image) {\n for (const list of lists) {\n for (const item of list.meta?.items ?? []) {\n const itemParts = (item.meta?.parts ?? []) as Part[];\n const nestedImage = firstImageSrc(itemParts);\n if (nestedImage) {\n image = nestedImage;\n break;\n }\n }\n if (image) {\n break;\n }\n }\n }\n\n // Start with top-level links as buttons\n let buttonIndex = 0;\n const buttons: HeroButton[] = getLinks(parts).map(\n (l, i): HeroButton => ({\n id: `btn-${i}`,\n text: l.content?.trim() || 'Learn more',\n variant: i === 0 ? 'primary' : 'secondary',\n onClick: l.meta.href,\n }),\n );\n buttonIndex = buttons.length;\n\n // Process lists: filter out image-only items, then check if remaining\n // items are all link-only. If so, convert to buttons; otherwise keep as trailingList.\n let trailingList: string | undefined;\n if (lists.length > 0) {\n for (const list of lists) {\n // Filter out image-only items\n const filteredItems: ListItemPart[] = [];\n for (const item of list.meta?.items ?? []) {\n const itemParts = (item.meta?.parts ?? []) as Part[];\n const hasImage = itemParts.some((p) => p.type === 'image');\n if (hasImage) {\n continue;\n }\n filteredItems.push(item);\n }\n\n if (filteredItems.length === 0) {\n continue;\n }\n\n // Check if ALL remaining items contain only links (no other text)\n let allItemsAreLinks = true;\n const listLinks: { text: string; href: string }[] = [];\n\n for (const item of filteredItems) {\n const itemParts = (item.meta?.parts ?? []) as Part[];\n const itemLinkParts = itemParts.filter(\n (p): p is LinkPart => p.type === 'link',\n );\n\n if (itemLinkParts.length === 0) {\n allItemsAreLinks = false;\n break;\n }\n\n // Check if the item text is entirely link text (no extra content)\n const allText = extractListItemText(item).trim();\n const linkTexts = itemLinkParts\n .map((l) => l.content?.trim() || '')\n .join(' ')\n .trim();\n\n if (allText !== linkTexts) {\n allItemsAreLinks = false;\n break;\n }\n\n listLinks.push({\n text: itemLinkParts[0].content?.trim() || 'Learn more',\n href: itemLinkParts[0].meta.href,\n });\n }\n\n if (allItemsAreLinks && listLinks.length > 0) {\n // Convert link-only list items to buttons\n for (const link of listLinks) {\n const isFirstButton = buttons.length === 0;\n buttons.push({\n id: `btn-${buttonIndex++}`,\n text: link.text,\n variant: isFirstButton ? 'primary' : 'secondary',\n onClick: link.href,\n });\n }\n } else {\n // Keep as trailing list markdown\n const lines: string[] = [];\n for (const item of filteredItems) {\n const text =\n (item.meta?.markdown as string) || extractListItemText(item);\n if (text) {\n lines.push(`- ${text}`);\n }\n }\n if (lines.length > 0) {\n trailingList = lines.join('\\n');\n }\n }\n }\n }\n\n // The hero claims the leading callout before the h1 — the ECHO the\n // orchestrator emits as the hero's opening line, right after the section\n // descriptor. A trailing blockquote is not part of the hero pattern, so it\n // falls through to a downstream callout section instead.\n const h1Index = parts.findIndex(\n (p) => p.type === 'heading' && (p.meta as { level: number })?.level === 1,\n );\n const blockquotes = getPartsByType<Part>(parts, 'callout');\n let leadingQuote: string | undefined;\n\n for (const bq of blockquotes) {\n const bqIndex = parts.indexOf(bq);\n if (h1Index >= 0 && bqIndex > h1Index) {\n continue;\n }\n const raw = (bq.meta?.markdown as string)?.trim() || bq.content?.trim();\n if (!raw) {\n continue;\n }\n leadingQuote = parseCalloutTag(raw).text || undefined;\n }\n\n return {\n headline: headingText(parts, 1),\n badge: headingText(parts, 3) || undefined,\n content: bodyText(parts) || undefined,\n buttons: buttons.length > 0 ? buttons : undefined,\n image,\n trailingList,\n leadingQuote,\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AAI,IAAIiE,SAAS;IACvD;IAEA,OAAO;MACLrE,QAAQ,EAAE,IAAAsE,uBAAW,EAAC3D,KAAK,EAAE,CAAC,CAAC;MAC/B4D,KAAK,EAAE,IAAAD,uBAAW,EAAC3D,KAAK,EAAE,CAAC,CAAC,IAAI0D,SAAS;MACzCpE,OAAO,EAAE,IAAAuE,oBAAQ,EAAC7D,KAAK,CAAC,IAAI0D,SAAS;MACrCnE,OAAO,EAAEA,OAAO,CAAC6B,MAAM,GAAG,CAAC,GAAG7B,OAAO,GAAGmE,SAAS;MACjD5D,KAAK;MACLuB,YAAY;MACZ6B;IACF,CAAC;EACH;AACF;AAACY,OAAA,CAAA7E,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_parseUtils","require","_parts","HeroSectionDefinition","constructor","_defineProperty2","default","headline","content","buttons","id","text","variant","markdown","expected","onClick","image","parse","parts","firstImageSrc","lists","getPartsByType","list","item","_list$meta","meta","items","_item$meta","itemParts","nestedImage","buttonIndex","getLinks","map","l","i","_l$content","trim","href","length","trailingList","filteredItems","_list$meta2","_item$meta2","hasImage","some","p","type","push","allItemsAreLinks","listLinks","_item$meta3","_itemLinkParts$0$cont","itemLinkParts","filter","allText","extractListItemText","linkTexts","_l$content2","join","link","isFirstButton","lines","_item$meta4","h1Index","findIndex","_p$meta","level","blockquotes","leadingQuote","bq","_bq$meta","_bq$content","bqIndex","indexOf","raw","parseCalloutTag","undefined","headingMarkdown","badge","headingText","bodyText","exports"],"sources":["../../../../src/component/componentDefinitions/HeroSectionDefinition.ts"],"sourcesContent":["import {\n headingText,\n headingMarkdown,\n bodyText,\n firstImageSrc,\n parseCalloutTag,\n extractListItemText,\n} from './parse-utils';\nimport type { Part, ListPart, LinkPart, ListItemPart } from '../../parts/parts';\nimport { getPartsByType, getLinks } from '../../parts/parts';\nimport type {\n HeroButton,\n HeroCompProps,\n HeroSectionComponent,\n SectionFixture,\n} from '../types';\nimport type { SectionDefinition } from '../section-definition';\n\nexport class HeroSectionDefinition\n implements SectionDefinition<HeroSectionComponent>\n{\n sectionType = 'hero' as const;\n singleInstance = true;\n patterns = [\n // Canonical hero shape: section descriptor, then the leading ECHO callout\n // (optional in the grammar — the orchestrator always emits it, but a missing\n // ECHO must not stop the hero from rendering), then an optional h3 badge,\n // then the h1. The callout and badge are independent slots so a hero can\n // carry both. The second `html_comment?` keeps the legacy ordering\n // (callout before the descriptor) matching for pages saved before this change.\n 'html_comment? > callout? > html_comment? > h3? > h1 > (image | t | link)* > list?',\n ];\n\n defaults: HeroCompProps = {\n headline: 'Build something amazing',\n content: 'Your platform for data-driven decisions.',\n buttons: [{ id: 'btn-0', text: 'Get started', variant: 'primary' }],\n };\n\n fixtures: SectionFixture<HeroCompProps>[] = [\n {\n markdown:\n '# Welcome\\n\\nBuild amazing things.\\n\\n[Get Started](/) [Learn More](/about)',\n expected: {\n headline: 'Welcome',\n content: 'Build amazing things.',\n buttons: [\n {\n id: 'btn-0',\n text: 'Get Started',\n variant: 'primary',\n onClick: '/',\n },\n {\n id: 'btn-1',\n text: 'Learn More',\n variant: 'secondary',\n onClick: '/about',\n },\n ],\n },\n },\n {\n markdown: `<!-- Hero Section -->\n\n# Welcome to Our Platform\n\n![Hero Image](hero.jpg)\n\nGet started today with our amazing features.\n\n[Get Started](/signup) [Learn More](/about)`,\n expected: {\n headline: 'Welcome to Our Platform',\n content: 'Get started today with our amazing features.',\n buttons: [\n {\n id: 'btn-0',\n text: 'Get Started',\n variant: 'primary',\n onClick: '/signup',\n },\n {\n id: 'btn-1',\n text: 'Learn More',\n variant: 'secondary',\n onClick: '/about',\n },\n ],\n image: 'hero.jpg',\n },\n },\n ];\n\n parse(parts: Part[]): HeroCompProps {\n let image = firstImageSrc(parts);\n const lists = getPartsByType<ListPart>(parts, 'list');\n\n if (!image) {\n for (const list of lists) {\n for (const item of list.meta?.items ?? []) {\n const itemParts = (item.meta?.parts ?? []) as Part[];\n const nestedImage = firstImageSrc(itemParts);\n if (nestedImage) {\n image = nestedImage;\n break;\n }\n }\n if (image) {\n break;\n }\n }\n }\n\n // Start with top-level links as buttons\n let buttonIndex = 0;\n const buttons: HeroButton[] = getLinks(parts).map(\n (l, i): HeroButton => ({\n id: `btn-${i}`,\n text: l.content?.trim() || 'Learn more',\n variant: i === 0 ? 'primary' : 'secondary',\n onClick: l.meta.href,\n }),\n );\n buttonIndex = buttons.length;\n\n // Process lists: filter out image-only items, then check if remaining\n // items are all link-only. If so, convert to buttons; otherwise keep as trailingList.\n let trailingList: string | undefined;\n if (lists.length > 0) {\n for (const list of lists) {\n // Filter out image-only items\n const filteredItems: ListItemPart[] = [];\n for (const item of list.meta?.items ?? []) {\n const itemParts = (item.meta?.parts ?? []) as Part[];\n const hasImage = itemParts.some((p) => p.type === 'image');\n if (hasImage) {\n continue;\n }\n filteredItems.push(item);\n }\n\n if (filteredItems.length === 0) {\n continue;\n }\n\n // Check if ALL remaining items contain only links (no other text)\n let allItemsAreLinks = true;\n const listLinks: { text: string; href: string }[] = [];\n\n for (const item of filteredItems) {\n const itemParts = (item.meta?.parts ?? []) as Part[];\n const itemLinkParts = itemParts.filter(\n (p): p is LinkPart => p.type === 'link',\n );\n\n if (itemLinkParts.length === 0) {\n allItemsAreLinks = false;\n break;\n }\n\n // Check if the item text is entirely link text (no extra content)\n const allText = extractListItemText(item).trim();\n const linkTexts = itemLinkParts\n .map((l) => l.content?.trim() || '')\n .join(' ')\n .trim();\n\n if (allText !== linkTexts) {\n allItemsAreLinks = false;\n break;\n }\n\n listLinks.push({\n text: itemLinkParts[0].content?.trim() || 'Learn more',\n href: itemLinkParts[0].meta.href,\n });\n }\n\n if (allItemsAreLinks && listLinks.length > 0) {\n // Convert link-only list items to buttons\n for (const link of listLinks) {\n const isFirstButton = buttons.length === 0;\n buttons.push({\n id: `btn-${buttonIndex++}`,\n text: link.text,\n variant: isFirstButton ? 'primary' : 'secondary',\n onClick: link.href,\n });\n }\n } else {\n // Keep as trailing list markdown\n const lines: string[] = [];\n for (const item of filteredItems) {\n const text =\n (item.meta?.markdown as string) || extractListItemText(item);\n if (text) {\n lines.push(`- ${text}`);\n }\n }\n if (lines.length > 0) {\n trailingList = lines.join('\\n');\n }\n }\n }\n }\n\n // The hero claims the leading callout before the h1 — the ECHO the\n // orchestrator emits as the hero's opening line, right after the section\n // descriptor. A trailing blockquote is not part of the hero pattern, so it\n // falls through to a downstream callout section instead.\n const h1Index = parts.findIndex(\n (p) => p.type === 'heading' && (p.meta as { level: number })?.level === 1,\n );\n const blockquotes = getPartsByType<Part>(parts, 'callout');\n let leadingQuote: string | undefined;\n\n for (const bq of blockquotes) {\n const bqIndex = parts.indexOf(bq);\n if (h1Index >= 0 && bqIndex > h1Index) {\n continue;\n }\n const raw = (bq.meta?.markdown as string)?.trim() || bq.content?.trim();\n if (!raw) {\n continue;\n }\n leadingQuote = parseCalloutTag(raw).text || undefined;\n }\n\n return {\n // Markdown-preserving (not headingText): the hero title now carries the\n // bold+italic hook the ECHO callout used to own, so the FE needs the\n // formatting, not just the plain text. See FeatureComparisonHero.tsx.\n headline: headingMarkdown(parts, 1),\n badge: headingText(parts, 3) || undefined,\n content: bodyText(parts) || undefined,\n buttons: buttons.length > 0 ? buttons : undefined,\n image,\n trailingList,\n leadingQuote,\n };\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AASA,IAAAC,MAAA,GAAAD,OAAA;AASO,MAAME,qBAAqB,CAElC;EAAAC,YAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,uBACgB,MAAM;IAAA,IAAAD,gBAAA,CAAAC,OAAA,0BACH,IAAI;IAAA,IAAAD,gBAAA,CAAAC,OAAA,oBACV;IACT;IACA;IACA;IACA;IACA;IACA;IACA,mFAAmF,CACpF;IAAA,IAAAD,gBAAA,CAAAC,OAAA,oBAEyB;MACxBC,QAAQ,EAAE,yBAAyB;MACnCC,OAAO,EAAE,0CAA0C;MACnDC,OAAO,EAAE,CAAC;QAAEC,EAAE,EAAE,O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ignoreList":[]}
@@ -40,16 +40,39 @@ function inlineBodyMarkdown(parts) {
40
40
  class NextStepsSectionDefinition {
41
41
  constructor() {
42
42
  (0, _defineProperty2.default)(this, "sectionType", 'nextSteps');
43
- (0, _defineProperty2.default)(this, "patterns", ['(html_comment[section^="next"] | html_comment[semantic^="next"]) > h2 > image? > list{item[1-]:(icon | t)* > (t? > link)+}', '(html_comment[section^="next"] | html_comment[semantic^="next"]) > h2 > image? > (t | link)+']);
43
+ (0, _defineProperty2.default)(this, "patterns", [
44
+ // Framing sentence (`t?`) then one chip per bullet — the authored shape.
45
+ '(html_comment[section^="next"] | html_comment[semantic^="next"]) > h2 > image? > t? > list{item[1-]:(icon | t)* > (t? > link)+}',
46
+ // Legacy inline shape: chips embedded in the prose. Still arrives from
47
+ // sites whose next-steps prompt has not moved to the list shape.
48
+ '(html_comment[section^="next"] | html_comment[semantic^="next"]) > h2 > image? > (t | link)+']);
44
49
  (0, _defineProperty2.default)(this, "defaults", {
45
50
  title: 'Next Steps',
46
- body: '[Get started](/start)',
51
+ body: 'Where would you like to go next?',
47
52
  backgroundImage: undefined,
48
53
  steps: [{
49
54
  content: '[Get started](/start)'
50
55
  }]
51
56
  });
52
57
  (0, _defineProperty2.default)(this, "fixtures", [{
58
+ markdown: `<!-- section:next-steps, semantic:next_steps -->
59
+
60
+ ## Find the right care for mature, sensitive skin
61
+
62
+ Want to focus on rich hydrators and barrier builders?
63
+
64
+ - [hydrating creams →](web5://ask/hydrating+creams+for+mature+skin)
65
+ - [gentle resurfacing serums →](web5://ask/gentle+resurfacing+serums)`,
66
+ expected: {
67
+ title: 'Find the right care for mature, sensitive skin',
68
+ body: 'Want to focus on rich hydrators and barrier builders?',
69
+ steps: [{
70
+ content: '[hydrating creams →](web5://ask/hydrating+creams+for+mature+skin)'
71
+ }, {
72
+ content: '[gentle resurfacing serums →](web5://ask/gentle+resurfacing+serums)'
73
+ }]
74
+ }
75
+ }, {
53
76
  markdown: `<!-- section: next_steps -->
54
77
 
55
78
  ## Next Steps
@@ -71,10 +94,14 @@ class NextStepsSectionDefinition {
71
94
  const backgroundImage = (0, _parseUtils.firstImageSrc)(parts);
72
95
  const steps = [];
73
96
  let body;
97
+ let chipsInlineInBody = false;
74
98
 
75
99
  // Try list-based pattern first
76
100
  const lists = (0, _parts.getPartsByType)(parts, 'list');
77
101
  if (lists.length > 0) {
102
+ // The framing sentence is the only top-level prose — list items live
103
+ // under each list's meta.items, so bodyText never picks up a chip.
104
+ body = (0, _parseUtils.bodyText)(parts) || undefined;
78
105
  for (const list of lists) {
79
106
  for (const item of ((_list$meta = list.meta) == null ? void 0 : _list$meta.items) ?? []) {
80
107
  var _list$meta, _item$meta, _iconPart$meta;
@@ -104,6 +131,9 @@ class NextStepsSectionDefinition {
104
131
  }
105
132
  } else {
106
133
  body = inlineBodyMarkdown(parts);
134
+ // body carries the chips as inline links — flag it so renderers show the
135
+ // prose alone instead of repeating every chip as a row beneath it.
136
+ chipsInlineInBody = Boolean(body);
107
137
  }
108
138
 
109
139
  // Fallback: inline links pattern
@@ -125,6 +155,9 @@ class NextStepsSectionDefinition {
125
155
  ...(body ? {
126
156
  body
127
157
  } : {}),
158
+ ...(chipsInlineInBody ? {
159
+ chipsInlineInBody
160
+ } : {}),
128
161
  ...(backgroundImage ? {
129
162
  backgroundImage
130
163
  } : {}),
@@ -1 +1 @@
1
- {"version":3,"names":["_parseUtils","require","_parts","linkToMarkdown","link","_link$content","_link$meta","content","trim","meta","href","appendInlineToken","current","token","trimmed","test","inlineBodyMarkdown","parts","body","reduce","part","type","_part$meta","markdown","undefined","NextStepsSectionDefinition","constructor","_defineProperty2","default","title","backgroundImage","steps","expected","parse","headingText","firstImageSrc","lists","getPartsByType","length","list","item","_list$meta","items","_item$meta","_iconPart$meta","itemParts","iconPart","find","p","iconHint","contentFragments","push","_p$content","filter","Boolean","join","extractListItemText","links","getLinks","_link$content2","_link$meta2","text","exports"],"sources":["../../../../src/component/componentDefinitions/NextStepsSectionDefinition.ts"],"sourcesContent":["import {\n headingText,\n extractListItemText,\n firstImageSrc,\n} from './parse-utils';\nimport {\n getPartsByType,\n getLinks,\n type Part,\n type ListPart,\n type LinkPart,\n type IconPart,\n} from '../../parts/parts';\nimport type {\n NextStepsCompProps,\n NextStepsSectionComponent,\n SectionFixture,\n} from '../types';\nimport type { SectionDefinition } from '../section-definition';\n\nfunction linkToMarkdown(link: LinkPart): string {\n return `[${link.content?.trim() || ''}](${link.meta?.href || ''})`;\n}\n\nfunction appendInlineToken(current: string, token: string): string {\n const trimmed = token.trim();\n if (!trimmed) {\n return current;\n }\n if (!current) {\n return trimmed;\n }\n if (/^[,.;:!?)]/.test(trimmed)) {\n return `${current}${trimmed}`;\n }\n return `${current} ${trimmed}`;\n}\n\nfunction inlineBodyMarkdown(parts: Part[]): string | undefined {\n const body = parts.reduce((current, part) => {\n if (part.type === 'link') {\n return appendInlineToken(current, linkToMarkdown(part as LinkPart));\n }\n if (part.type === 'text' || part.type === 'richText') {\n const markdown = (part.meta?.markdown as string | undefined)?.trim();\n return appendInlineToken(current, markdown || part.content || '');\n }\n return current;\n }, '');\n\n return body || undefined;\n}\n\nexport class NextStepsSectionDefinition\n implements SectionDefinition<NextStepsSectionComponent>\n{\n sectionType = 'nextSteps' as const;\n patterns = [\n '(html_comment[section^=\"next\"] | html_comment[semantic^=\"next\"]) > h2 > image? > list{item[1-]:(icon | t)* > (t? > link)+}',\n '(html_comment[section^=\"next\"] | html_comment[semantic^=\"next\"]) > h2 > image? > (t | link)+',\n ];\n\n defaults: NextStepsCompProps = {\n title: 'Next Steps',\n body: '[Get started](/start)',\n backgroundImage: undefined,\n steps: [{ content: '[Get started](/start)' }],\n };\n\n fixtures: SectionFixture<NextStepsCompProps>[] = [\n {\n markdown: `<!-- section: next_steps -->\n\n## Next Steps\n\n- Check out [Documentation](/docs)\n- Try [Examples](/examples)`,\n expected: {\n title: 'Next Steps',\n steps: [\n { content: 'Check out [Documentation](/docs)' },\n { content: 'Try [Examples](/examples)' },\n ],\n },\n },\n ];\n\n parse(parts: Part[]): NextStepsCompProps {\n const title = headingText(parts, 2) || 'Next Steps';\n const backgroundImage = firstImageSrc(parts);\n const steps: { content: string; iconHint?: string }[] = [];\n let body: string | undefined;\n\n // Try list-based pattern first\n const lists = getPartsByType<ListPart>(parts, 'list');\n if (lists.length > 0) {\n for (const list of lists) {\n for (const item of list.meta?.items ?? []) {\n const itemParts = (item.meta?.parts ?? []) as Part[];\n\n const iconPart = itemParts.find((p) => p.type === 'icon') as\n | IconPart\n | undefined;\n const iconHint = (iconPart?.meta as { iconHint?: string })?.iconHint;\n\n const contentFragments: string[] = [];\n for (const p of itemParts) {\n if (p.type === 'link') {\n const link = p as LinkPart;\n contentFragments.push(linkToMarkdown(link));\n } else if (p.type === 'text' || p.type === 'richText') {\n contentFragments.push(p.content?.trim() || '');\n }\n }\n const content =\n contentFragments.filter(Boolean).join(' ') ||\n extractListItemText(item);\n if (content.trim()) {\n steps.push({\n content: content.trim(),\n ...(iconHint ? { iconHint } : {}),\n });\n }\n }\n }\n } else {\n body = inlineBodyMarkdown(parts);\n }\n\n // Fallback: inline links pattern\n if (steps.length === 0) {\n const links = getLinks(parts);\n for (const link of links) {\n const text = link.content?.trim();\n const href = link.meta?.href;\n if (text && href) {\n steps.push({ content: linkToMarkdown(link) });\n }\n }\n }\n\n return {\n title,\n ...(body ? { body } : {}),\n ...(backgroundImage ? { backgroundImage } : {}),\n steps,\n };\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AAeA,SAASE,cAAcA,CAACC,IAAc,EAAU;EAAA,IAAAC,aAAA,EAAAC,UAAA;EAC9C,OAAO,IAAI,EAAAD,aAAA,GAAAD,IAAI,CAACG,OAAO,qBAAZF,aAAA,CAAcG,IAAI,CAAC,CAAC,KAAI,EAAE,KAAK,EAAAF,UAAA,GAAAF,IAAI,CAACK,IAAI,qBAATH,UAAA,CAAWI,IAAI,K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IAAIqD,KAAK,EAAE;QAAA,IAAAE,cAAA,EAAAC,WAAA;QACxB,MAAMC,IAAI,IAAAF,cAAA,GAAGvD,IAAI,CAACG,OAAO,qBAAZoD,cAAA,CAAcnD,IAAI,CAAC,CAAC;QACjC,MAAME,IAAI,IAAAkD,WAAA,GAAGxD,IAAI,CAACK,IAAI,qBAATmD,WAAA,CAAWlD,IAAI;QAC5B,IAAImD,IAAI,IAAInD,IAAI,EAAE;UAChBqB,KAAK,CAACoB,IAAI,CAAC;YAAE5C,OAAO,EAAEJ,cAAc,CAACC,IAAI;UAAE,CAAC,CAAC;QAC/C;MACF;IACF;IAEA,OAAO;MACLyB,KAAK;MACL,IAAIX,IAAI,GAAG;QAAEA;MAAK,CAAC,GAAG,CAAC,CAAC,CAAC;MACzB,IAAIY,eAAe,GAAG;QAAEA;MAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;MAC/CC;IACF,CAAC;EACH;AACF;AAAC+B,OAAA,CAAArC,0BAAA,GAAAA,0BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_parseUtils","require","_parts","linkToMarkdown","link","_link$content","_link$meta","content","trim","meta","href","appendInlineToken","current","token","trimmed","test","inlineBodyMarkdown","parts","body","reduce","part","type","_part$meta","markdown","undefined","NextStepsSectionDefinition","constructor","_defineProperty2","default","title","backgroundImage","steps","expected","parse","headingText","firstImageSrc","chipsInlineInBody","lists","getPartsByType","length","bodyText","list","item","_list$meta","items","_item$meta","_iconPart$meta","itemParts","iconPart","find","p","iconHint","contentFragments","push","_p$content","filter","Boolean","join","extractListItemText","links","getLinks","_link$content2","_link$meta2","text","exports"],"sources":["../../../../src/component/componentDefinitions/NextStepsSectionDefinition.ts"],"sourcesContent":["import {\n headingText,\n bodyText,\n extractListItemText,\n firstImageSrc,\n} from './parse-utils';\nimport {\n getPartsByType,\n getLinks,\n type Part,\n type ListPart,\n type LinkPart,\n type IconPart,\n} from '../../parts/parts';\nimport type {\n NextStepsCompProps,\n NextStepsSectionComponent,\n SectionFixture,\n} from '../types';\nimport type { SectionDefinition } from '../section-definition';\n\nfunction linkToMarkdown(link: LinkPart): string {\n return `[${link.content?.trim() || ''}](${link.meta?.href || ''})`;\n}\n\nfunction appendInlineToken(current: string, token: string): string {\n const trimmed = token.trim();\n if (!trimmed) {\n return current;\n }\n if (!current) {\n return trimmed;\n }\n if (/^[,.;:!?)]/.test(trimmed)) {\n return `${current}${trimmed}`;\n }\n return `${current} ${trimmed}`;\n}\n\nfunction inlineBodyMarkdown(parts: Part[]): string | undefined {\n const body = parts.reduce((current, part) => {\n if (part.type === 'link') {\n return appendInlineToken(current, linkToMarkdown(part as LinkPart));\n }\n if (part.type === 'text' || part.type === 'richText') {\n const markdown = (part.meta?.markdown as string | undefined)?.trim();\n return appendInlineToken(current, markdown || part.content || '');\n }\n return current;\n }, '');\n\n return body || undefined;\n}\n\nexport class NextStepsSectionDefinition\n implements SectionDefinition<NextStepsSectionComponent>\n{\n sectionType = 'nextSteps' as const;\n patterns = [\n // Framing sentence (`t?`) then one chip per bullet — the authored shape.\n '(html_comment[section^=\"next\"] | html_comment[semantic^=\"next\"]) > h2 > image? > t? > list{item[1-]:(icon | t)* > (t? > link)+}',\n // Legacy inline shape: chips embedded in the prose. Still arrives from\n // sites whose next-steps prompt has not moved to the list shape.\n '(html_comment[section^=\"next\"] | html_comment[semantic^=\"next\"]) > h2 > image? > (t | link)+',\n ];\n\n defaults: NextStepsCompProps = {\n title: 'Next Steps',\n body: 'Where would you like to go next?',\n backgroundImage: undefined,\n steps: [{ content: '[Get started](/start)' }],\n };\n\n fixtures: SectionFixture<NextStepsCompProps>[] = [\n {\n markdown: `<!-- section:next-steps, semantic:next_steps -->\n\n## Find the right care for mature, sensitive skin\n\nWant to focus on rich hydrators and barrier builders?\n\n- [hydrating creams →](web5://ask/hydrating+creams+for+mature+skin)\n- [gentle resurfacing serums →](web5://ask/gentle+resurfacing+serums)`,\n expected: {\n title: 'Find the right care for mature, sensitive skin',\n body: 'Want to focus on rich hydrators and barrier builders?',\n steps: [\n {\n content:\n '[hydrating creams →](web5://ask/hydrating+creams+for+mature+skin)',\n },\n {\n content:\n '[gentle resurfacing serums →](web5://ask/gentle+resurfacing+serums)',\n },\n ],\n },\n },\n {\n markdown: `<!-- section: next_steps -->\n\n## Next Steps\n\n- Check out [Documentation](/docs)\n- Try [Examples](/examples)`,\n expected: {\n title: 'Next Steps',\n steps: [\n { content: 'Check out [Documentation](/docs)' },\n { content: 'Try [Examples](/examples)' },\n ],\n },\n },\n ];\n\n parse(parts: Part[]): NextStepsCompProps {\n const title = headingText(parts, 2) || 'Next Steps';\n const backgroundImage = firstImageSrc(parts);\n const steps: { content: string; iconHint?: string }[] = [];\n let body: string | undefined;\n let chipsInlineInBody = false;\n\n // Try list-based pattern first\n const lists = getPartsByType<ListPart>(parts, 'list');\n if (lists.length > 0) {\n // The framing sentence is the only top-level prose — list items live\n // under each list's meta.items, so bodyText never picks up a chip.\n body = bodyText(parts) || undefined;\n\n for (const list of lists) {\n for (const item of list.meta?.items ?? []) {\n const itemParts = (item.meta?.parts ?? []) as Part[];\n\n const iconPart = itemParts.find((p) => p.type === 'icon') as\n | IconPart\n | undefined;\n const iconHint = (iconPart?.meta as { iconHint?: string })?.iconHint;\n\n const contentFragments: string[] = [];\n for (const p of itemParts) {\n if (p.type === 'link') {\n const link = p as LinkPart;\n contentFragments.push(linkToMarkdown(link));\n } else if (p.type === 'text' || p.type === 'richText') {\n contentFragments.push(p.content?.trim() || '');\n }\n }\n const content =\n contentFragments.filter(Boolean).join(' ') ||\n extractListItemText(item);\n if (content.trim()) {\n steps.push({\n content: content.trim(),\n ...(iconHint ? { iconHint } : {}),\n });\n }\n }\n }\n } else {\n body = inlineBodyMarkdown(parts);\n // body carries the chips as inline links — flag it so renderers show the\n // prose alone instead of repeating every chip as a row beneath it.\n chipsInlineInBody = Boolean(body);\n }\n\n // Fallback: inline links pattern\n if (steps.length === 0) {\n const links = getLinks(parts);\n for (const link of links) {\n const text = link.content?.trim();\n const href = link.meta?.href;\n if (text && href) {\n steps.push({ content: linkToMarkdown(link) });\n }\n }\n }\n\n return {\n title,\n ...(body ? { body } : {}),\n ...(chipsInlineInBody ? { chipsInlineInBody } : {}),\n ...(backgroundImage ? { backgroundImage } : {}),\n steps,\n };\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAMA,IAAAC,MAAA,GAAAD,OAAA;AAeA,SAASE,cAAcA,CAACC,IAAc,EAAU;EAAA,IAAAC,aAAA,EAAAC,UAAA;EAC9C,OAAO,IAAI,EAAAD,aAAA,GAAAD,IAAI,CAACG,OAAO,qBAAZF,aAAA,CAAcG,IAAI,CAAC,CAAC,KAAI,EAAE,KAAK,EAAAF,UAAA,GAAAF,IAAI,CAACK,IAAI,qBAATH,UAAA,CAAWI,IAAI,KAAI,EAAE,GAAG;AACpE;AAEA,SAASC,iBAAiBA,CAACC,OAAe,EAAEC,KAAa,EAAU;EACjE,MAAMC,OAAO,GAAGD,KAAK,CAACL,IAAI,CAAC,CAAC;EAC5B,IAAI,CAACM,OAAO,EAAE;IACZ,OAAOF,OAAO;EAChB;EACA,IAAI,CAACA,OAAO,EAAE;IACZ,OAAOE,OAAO;EAChB;EACA,IAAI,YAAY,CAACC,IAAI,CAACD,OAAO,CAAC,EAAE;IAC9B,OAAO,GAAGF,OAAO,GAAGE,OAAO,EAAE;EAC/B;EACA,OAAO,GAAGF,OAAO,IAAIE,OAAO,EAAE;AAChC;AAEA,SAASE,kBAAkBA,CAACC,KAAa,EAAsB;EAC7D,MAAMC,IAAI,GAAGD,KAAK,CAACE,MAAM,CAAC,CAACP,OAAO,EAAEQ,IAAI,KAAK;IAC3C,IAAIA,IAAI,CAACC,IAAI,KAAK,MAAM,EAAE;MACxB,OAAOV,iBAAiB,CAACC,OAAO,EAAET,cAAc,CAACiB,IAAgB,CAAC,CAAC;IACrE;IACA,IAAIA,IAAI,CAACC,IAAI,KAAK,MAAM,IAAID,IAAI,CAACC,IAAI,K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E;UAChBqB,KAAK,CAACsB,IAAI,CAAC;YAAE9C,OAAO,EAAEJ,cAAc,CAACC,IAAI;UAAE,CAAC,CAAC;QAC/C;MACF;IACF;IAEA,OAAO;MACLyB,KAAK;MACL,IAAIX,IAAI,GAAG;QAAEA;MAAK,CAAC,GAAG,CAAC,CAAC,CAAC;MACzB,IAAIkB,iBAAiB,GAAG;QAAEA;MAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;MACnD,IAAIN,eAAe,GAAG;QAAEA;MAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;MAC/CC;IACF,CAAC;EACH;AACF;AAACiC,OAAA,CAAAvC,0BAAA,GAAAA,0BAAA","ignoreList":[]}
@@ -9,7 +9,24 @@ var _diagnosticTypes = require("../diagnosticTypes");
9
9
  class TextBlockSectionDefinition {
10
10
  constructor() {
11
11
  (0, _defineProperty2.default)(this, "sectionType", 'textBlock');
12
- (0, _defineProperty2.default)(this, "patterns", ['html_comment? > h2 > t > callout']);
12
+ // The trailing callout is OPTIONAL. A heading plus running copy is the shape
13
+ // stores emit constantly for explainer content, and requiring the blockquote
14
+ // meant those blocks matched no definition at all and fell through to
15
+ // `FallbackSectionDefinition` — rendered as undifferentiated prose with no
16
+ // section treatment. `parse()` already tolerates a missing callout (it only
17
+ // rejects when title AND description are empty).
18
+ //
19
+ // NOTE for registry authors: with the callout optional this also matches a
20
+ // bare `h2 > t`, and a pattern matches a PREFIX of the block. Register
21
+ // `textBlock` BELOW every definition whose block opens `h2 > t` — entity,
22
+ // entityCollection, listItemsSection, featureCards, ctaBanner, comparison,
23
+ // kpi, nextSteps. Above them it claims the heading + intro paragraph off the
24
+ // front of the block and strands the list / links / table that follow
25
+ // (`EntitySectionDefinition` allows `h2 > (t | callout)* > links…`, and
26
+ // `listItemsSection` / `ctaBanner` are the same shape). `createSdkRegistry`
27
+ // and the client registries in this repo order it that way; a client
28
+ // registry living outside this repo has to do the same.
29
+ (0, _defineProperty2.default)(this, "patterns", ['html_comment? > h2 > t > callout?']);
13
30
  (0, _defineProperty2.default)(this, "defaults", {
14
31
  title: 'Text Block Title',
15
32
  description: 'Description text.',
@@ -44,6 +61,15 @@ The platform scales with your needs.
44
61
  text: 'Start small with Go, then expand to the full suite as your data maturity grows.'
45
62
  }
46
63
  }
64
+ }, {
65
+ markdown: `## How to choose between a clinical serum and a nourishing dry oil
66
+
67
+ Clinically tested serums with patented actives target visible reduction of marks and uneven tone, while dry oils focus on broad nourishment and a satin finish.`,
68
+ expected: {
69
+ title: 'How to choose between a clinical serum and a nourishing dry oil',
70
+ description: 'Clinically tested serums with patented actives target visible reduction of marks and uneven tone, while dry oils focus on broad nourishment and a satin finish.',
71
+ callout: undefined
72
+ }
47
73
  }]);
48
74
  }
49
75
  parse(parts, context) {
@@ -1 +1 @@
1
- {"version":3,"names":["_parseUtils","require","_diagnosticTypes","TextBlockSectionDefinition","constructor","_defineProperty2","default","title","description","callout","text","markdown","expected","parse","parts","context","headingMarkdown","bodyText","calloutFromParts","reportDiagnostic","DIAGNOSTIC_TYPES","SECTION_REJECTED","exports"],"sources":["../../../../src/component/componentDefinitions/TextBlockSectionDefinition.ts"],"sourcesContent":["import type { Part } from '../../parts/parts';\nimport { headingMarkdown, bodyText, calloutFromParts } from './parse-utils';\nimport type {\n TextBlockCompProps,\n TextBlockSectionComponent,\n SectionFixture,\n} from '../types';\nimport type { SectionDefinition, ParseContext } from '../section-definition';\nimport { DIAGNOSTIC_TYPES } from '../diagnosticTypes';\n\nexport class TextBlockSectionDefinition\n implements SectionDefinition<TextBlockSectionComponent>\n{\n sectionType = 'textBlock' as const;\n patterns = ['html_comment? > h2 > t > callout'];\n\n defaults: TextBlockCompProps = {\n title: 'Text Block Title',\n description: 'Description text.',\n callout: { text: 'A key insight or quote.' },\n };\n\n fixtures: SectionFixture<TextBlockCompProps>[] = [\n {\n markdown: `## Choosing the Right Liquid Data Option\n\nLiquid Data Go is designed for brands that want affordable, scalable access to syndicated POS, shopper, and pricing insights with minimal setup and no data expertise required.\n\n> If you mainly need fast, packaged insights in one category, Liquid Data Go is usually the right fit; if you need to integrate many datasets and support multiple enterprise workflows, the broader Liquid Data platform and its solutions become more relevant.`,\n expected: {\n title: 'Choosing the Right Liquid Data Option',\n description:\n 'Liquid Data Go is designed for brands that want affordable, scalable access to syndicated POS, shopper, and pricing insights with minimal setup and no data expertise required.',\n callout: {\n text: 'If you mainly need fast, packaged insights in one category, Liquid Data Go is usually the right fit; if you need to integrate many datasets and support multiple enterprise workflows, the broader Liquid Data platform and its solutions become more relevant.',\n },\n },\n },\n {\n markdown: `<!-- section: textBlock -->\n## Key Takeaway\n\nThe platform scales with your needs.\n\n> Start small with Go, then expand to the full suite as your data maturity grows.`,\n expected: {\n title: 'Key Takeaway',\n description: 'The platform scales with your needs.',\n callout: {\n text: 'Start small with Go, then expand to the full suite as your data maturity grows.',\n },\n },\n },\n ];\n\n parse(parts: Part[], context?: ParseContext): TextBlockCompProps | null {\n const title = headingMarkdown(parts, 2) || '';\n const description = bodyText(parts) || '';\n const callout = calloutFromParts(parts);\n\n if (!title && !description) {\n context?.reportDiagnostic?.(\n DIAGNOSTIC_TYPES.SECTION_REJECTED,\n 'textBlock: both title and description are empty',\n );\n return null;\n }\n\n return { title, description, callout };\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,gBAAA,GAAAD,OAAA;AAEO,MAAME,0BAA0B,CAEvC;EAAAC,YAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,uBACgB,WAAW;IAAA,IAAAD,gBAAA,CAAAC,OAAA,oBACd,CAAC,kCAAkC,CAAC;IAAA,IAAAD,gBAAA,CAAAC,OAAA,oBAEhB;MAC7BC,KAAK,EAAE,kBAAkB;MACzBC,WAAW,EAAE,mBAAmB;MAChCC,OAAO,EAAE;QAAEC,IAAI,EAAE;MAA0B;IAC7C,CAAC;IAAA,IAAAL,gBAAA,CAAAC,OAAA,oBAEgD,CAC/C;MACEK,QAAQ,EAAE;AAChB;AACA;AACA;AACA,kQAAkQ;MAC5PC,QAAQ,EAAE;QACRL,KAAK,EAAE,uCAAuC;QAC9CC,WAAW,EACT,iLAAiL;QACnLC,OAAO,EAAE;UACPC,IAAI,EAAE;QACR;MACF;IACF,CAAC,EACD;MACEC,QAAQ,EAAE;AAChB;AACA;AACA;AACA;AACA,kFAAkF;MAC5EC,QAAQ,EAAE;QACRL,KAAK,EAAE,cAAc;QACrBC,WAAW,EAAE,sCAAsC;QACnDC,OAAO,EAAE;UACPC,IAAI,EAAE;QACR;MACF;IACF,CAAC,CACF;EAAA;EAEDG,KAAKA,CAACC,KAAa,EAAEC,OAAsB,EAA6B;IACtE,MAAMR,KAAK,GAAG,IAAAS,2BAAe,EAACF,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE;IAC7C,MAAMN,WAAW,GAAG,IAAAS,oBAAQ,EAACH,KAAK,CAAC,IAAI,EAAE;IACzC,MAAML,OAAO,GAAG,IAAAS,4BAAgB,EAACJ,KAAK,CAAC;IAEvC,IAAI,CAACP,KAAK,IAAI,CAACC,WAAW,EAAE;MAC1BO,OAAO,YAAPA,OAAO,CAAEI,gBAAgB,YAAzBJ,OAAO,CAAEI,gBAAgB,CACvBC,iCAAgB,CAACC,gBAAgB,EACjC,iDACF,CAAC;MACD,OAAO,IAAI;IACb;IAEA,OAAO;MAAEd,KAAK;MAAEC,WAAW;MAAEC;IAAQ,CAAC;EACxC;AACF;AAACa,OAAA,CAAAnB,0BAAA,GAAAA,0BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_parseUtils","require","_diagnosticTypes","TextBlockSectionDefinition","constructor","_defineProperty2","default","title","description","callout","text","markdown","expected","undefined","parse","parts","context","headingMarkdown","bodyText","calloutFromParts","reportDiagnostic","DIAGNOSTIC_TYPES","SECTION_REJECTED","exports"],"sources":["../../../../src/component/componentDefinitions/TextBlockSectionDefinition.ts"],"sourcesContent":["import type { Part } from '../../parts/parts';\nimport { headingMarkdown, bodyText, calloutFromParts } from './parse-utils';\nimport type {\n TextBlockCompProps,\n TextBlockSectionComponent,\n SectionFixture,\n} from '../types';\nimport type { SectionDefinition, ParseContext } from '../section-definition';\nimport { DIAGNOSTIC_TYPES } from '../diagnosticTypes';\n\nexport class TextBlockSectionDefinition\n implements SectionDefinition<TextBlockSectionComponent>\n{\n sectionType = 'textBlock' as const;\n // The trailing callout is OPTIONAL. A heading plus running copy is the shape\n // stores emit constantly for explainer content, and requiring the blockquote\n // meant those blocks matched no definition at all and fell through to\n // `FallbackSectionDefinition` — rendered as undifferentiated prose with no\n // section treatment. `parse()` already tolerates a missing callout (it only\n // rejects when title AND description are empty).\n //\n // NOTE for registry authors: with the callout optional this also matches a\n // bare `h2 > t`, and a pattern matches a PREFIX of the block. Register\n // `textBlock` BELOW every definition whose block opens `h2 > t` — entity,\n // entityCollection, listItemsSection, featureCards, ctaBanner, comparison,\n // kpi, nextSteps. Above them it claims the heading + intro paragraph off the\n // front of the block and strands the list / links / table that follow\n // (`EntitySectionDefinition` allows `h2 > (t | callout)* > links…`, and\n // `listItemsSection` / `ctaBanner` are the same shape). `createSdkRegistry`\n // and the client registries in this repo order it that way; a client\n // registry living outside this repo has to do the same.\n patterns = ['html_comment? > h2 > t > callout?'];\n\n defaults: TextBlockCompProps = {\n title: 'Text Block Title',\n description: 'Description text.',\n callout: { text: 'A key insight or quote.' },\n };\n\n fixtures: SectionFixture<TextBlockCompProps>[] = [\n {\n markdown: `## Choosing the Right Liquid Data Option\n\nLiquid Data Go is designed for brands that want affordable, scalable access to syndicated POS, shopper, and pricing insights with minimal setup and no data expertise required.\n\n> If you mainly need fast, packaged insights in one category, Liquid Data Go is usually the right fit; if you need to integrate many datasets and support multiple enterprise workflows, the broader Liquid Data platform and its solutions become more relevant.`,\n expected: {\n title: 'Choosing the Right Liquid Data Option',\n description:\n 'Liquid Data Go is designed for brands that want affordable, scalable access to syndicated POS, shopper, and pricing insights with minimal setup and no data expertise required.',\n callout: {\n text: 'If you mainly need fast, packaged insights in one category, Liquid Data Go is usually the right fit; if you need to integrate many datasets and support multiple enterprise workflows, the broader Liquid Data platform and its solutions become more relevant.',\n },\n },\n },\n {\n markdown: `<!-- section: textBlock -->\n## Key Takeaway\n\nThe platform scales with your needs.\n\n> Start small with Go, then expand to the full suite as your data maturity grows.`,\n expected: {\n title: 'Key Takeaway',\n description: 'The platform scales with your needs.',\n callout: {\n text: 'Start small with Go, then expand to the full suite as your data maturity grows.',\n },\n },\n },\n {\n markdown: `## How to choose between a clinical serum and a nourishing dry oil\n\nClinically tested serums with patented actives target visible reduction of marks and uneven tone, while dry oils focus on broad nourishment and a satin finish.`,\n expected: {\n title: 'How to choose between a clinical serum and a nourishing dry oil',\n description:\n 'Clinically tested serums with patented actives target visible reduction of marks and uneven tone, while dry oils focus on broad nourishment and a satin finish.',\n callout: undefined,\n },\n },\n ];\n\n parse(parts: Part[], context?: ParseContext): TextBlockCompProps | null {\n const title = headingMarkdown(parts, 2) || '';\n const description = bodyText(parts) || '';\n const callout = calloutFromParts(parts);\n\n if (!title && !description) {\n context?.reportDiagnostic?.(\n DIAGNOSTIC_TYPES.SECTION_REJECTED,\n 'textBlock: both title and description are empty',\n );\n return null;\n }\n\n return { title, description, callout };\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,gBAAA,GAAAD,OAAA;AAEO,MAAME,0BAA0B,CAEvC;EAAAC,YAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,uBACgB,WAAW;IACzB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAAA,IAAAD,gBAAA,CAAAC,OAAA,oBACW,CAAC,mCAAmC,CAAC;IAAA,IAAAD,gBAAA,CAAAC,OAAA,oBAEjB;MAC7BC,KAAK,EAAE,kBAAkB;MACzBC,WAAW,EAAE,mBAAmB;MAChCC,OAAO,EAAE;QAAEC,IAAI,EAAE;MAA0B;IAC7C,CAAC;IAAA,IAAAL,gBAAA,CAAAC,OAAA,oBAEgD,CAC/C;MACEK,QAAQ,EAAE;AAChB;AACA;AACA;AACA,kQAAkQ;MAC5PC,QAAQ,EAAE;QACRL,KAAK,EAAE,uCAAuC;QAC9CC,WAAW,EACT,iLAAiL;QACnLC,OAAO,EAAE;UACPC,IAAI,EAAE;QACR;MACF;IACF,CAAC,EACD;MACEC,QAAQ,EAAE;AAChB;AACA;AACA;AACA;AACA,kFAAkF;MAC5EC,QAAQ,EAAE;QACRL,KAAK,EAAE,cAAc;QACrBC,WAAW,EAAE,sCAAsC;QACnDC,OAAO,EAAE;UACPC,IAAI,EAAE;QACR;MACF;IACF,CAAC,EACD;MACEC,QAAQ,EAAE;AAChB;AACA,gKAAgK;MAC1JC,QAAQ,EAAE;QACRL,KAAK,EAAE,iEAAiE;QACxEC,WAAW,EACT,iKAAiK;QACnKC,OAAO,EAAEI;MACX;IACF,CAAC,CACF;EAAA;EAEDC,KAAKA,CAACC,KAAa,EAAEC,OAAsB,EAA6B;IACtE,MAAMT,KAAK,GAAG,IAAAU,2BAAe,EAACF,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE;IAC7C,MAAMP,WAAW,GAAG,IAAAU,oBAAQ,EAACH,KAAK,CAAC,IAAI,EAAE;IACzC,MAAMN,OAAO,GAAG,IAAAU,4BAAgB,EAACJ,KAAK,CAAC;IAEvC,IAAI,CAACR,KAAK,IAAI,CAACC,WAAW,EAAE;MAC1BQ,OAAO,YAAPA,OAAO,CAAEI,gBAAgB,YAAzBJ,OAAO,CAAEI,gBAAgB,CACvBC,iCAAgB,CAACC,gBAAgB,EACjC,iDACF,CAAC;MACD,OAAO,IAAI;IACb;IAEA,OAAO;MAAEf,KAAK;MAAEC,WAAW;MAAEC;IAAQ,CAAC;EACxC;AACF;AAACc,OAAA,CAAApB,0BAAA,GAAAA,0BAAA","ignoreList":[]}
@@ -49,6 +49,13 @@ function createSdkRegistry() {
49
49
  // Collection entities are claimed by their own definition first — it is a
50
50
  // strictly narrower match than EntitySectionDefinition, which would
51
51
  // otherwise swallow collection, product and article blocks alike.
52
- .register(new _EntityCollectionSectionDefinition.EntityCollectionSectionDefinition()).register(new _EntitySectionDefinition.EntitySectionDefinition()).register(new _HeroEntitySectionDefinition.HeroEntitySectionDefinition()).register(new _HeroSectionDefinition.HeroSectionDefinition()).register(new _FeatureCardsSectionDefinition.FeatureCardsSectionDefinition()).register(new _TextBlockSectionDefinition.TextBlockSectionDefinition()).register(new _listItemsSectionDefinition.ListItemsSectionDefinition()).register(new _FeatureSection9PlusDefinition.FeatureSection9PlusDefinition()).register(new _ComparisonSectionDefinition.ComparisonSectionDefinition()).register(new _HtmlCommentSectionDefinition.HtmlCommentSectionDefinition()).register(new _CtaBannerSectionDefinition.CtaBannerSectionDefinition()).register(new _CalloutSectionDefinition.CalloutSectionDefinition()).register(new _FallbackSectionDefinition.FallbackSectionDefinition()).register(new _ErrorSectionDefinition.ErrorSectionDefinition());
52
+ .register(new _EntityCollectionSectionDefinition.EntityCollectionSectionDefinition()).register(new _EntitySectionDefinition.EntitySectionDefinition()).register(new _HeroEntitySectionDefinition.HeroEntitySectionDefinition()).register(new _HeroSectionDefinition.HeroSectionDefinition()).register(new _FeatureCardsSectionDefinition.FeatureCardsSectionDefinition()).register(new _listItemsSectionDefinition.ListItemsSectionDefinition()).register(new _FeatureSection9PlusDefinition.FeatureSection9PlusDefinition()).register(new _ComparisonSectionDefinition.ComparisonSectionDefinition()).register(new _HtmlCommentSectionDefinition.HtmlCommentSectionDefinition()).register(new _CtaBannerSectionDefinition.CtaBannerSectionDefinition())
53
+ // textBlock comes after every definition whose block opens `h2 > t`
54
+ // (entity, listItems, featureCards, ctaBanner, comparison, …). Its
55
+ // trailing callout is optional, so its pattern also matches a bare
56
+ // `h2 > t`, and a pattern matches a PREFIX of the block — registered
57
+ // above those it would claim the heading + intro paragraph and strand
58
+ // the list / links / table that follow in a separate section.
59
+ .register(new _TextBlockSectionDefinition.TextBlockSectionDefinition()).register(new _CalloutSectionDefinition.CalloutSectionDefinition()).register(new _FallbackSectionDefinition.FallbackSectionDefinition()).register(new _ErrorSectionDefinition.ErrorSectionDefinition());
53
60
  }
54
61
  //# sourceMappingURL=index.js.map