@wix/web5-core 1.57.2 → 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.
- package/dist/cjs/client/applyThemeOverrides.js +89 -0
- package/dist/cjs/client/applyThemeOverrides.js.map +1 -0
- package/dist/cjs/client/clientBundleUrl.js +83 -0
- package/dist/cjs/client/clientBundleUrl.js.map +1 -0
- package/dist/cjs/client/mergeClientConfig.js +59 -0
- package/dist/cjs/client/mergeClientConfig.js.map +1 -0
- package/dist/cjs/component/componentDefinitions/EntityCollectionSectionDefinition.js +159 -0
- package/dist/cjs/component/componentDefinitions/EntityCollectionSectionDefinition.js.map +1 -0
- package/dist/cjs/component/componentDefinitions/HeroEntitySectionDefinition.js +5 -2
- package/dist/cjs/component/componentDefinitions/HeroEntitySectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/HeroSectionDefinition.js +4 -1
- package/dist/cjs/component/componentDefinitions/HeroSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/NextStepsSectionDefinition.js +35 -2
- package/dist/cjs/component/componentDefinitions/NextStepsSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/TextBlockSectionDefinition.js +27 -1
- package/dist/cjs/component/componentDefinitions/TextBlockSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/index.js +14 -1
- package/dist/cjs/component/componentDefinitions/index.js.map +1 -1
- package/dist/cjs/component/componentParser.js +38 -1
- package/dist/cjs/component/componentParser.js.map +1 -1
- package/dist/cjs/component/types.js.map +1 -1
- package/dist/cjs/components/ui/SearchSection.css +66 -9
- package/dist/cjs/components/ui/SearchSection.js +23 -19
- package/dist/cjs/components/ui/SearchSection.js.map +1 -1
- package/dist/cjs/hostScope.js.map +1 -1
- package/dist/cjs/index.js +23 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/styles/prompt-input-tokens.css +41 -34
- package/dist/cjs/utils/matchDebug.js +93 -0
- package/dist/cjs/utils/matchDebug.js.map +1 -0
- package/dist/esm/client/applyThemeOverrides.js +85 -0
- package/dist/esm/client/applyThemeOverrides.js.map +1 -0
- package/dist/esm/client/clientBundleUrl.js +75 -0
- package/dist/esm/client/clientBundleUrl.js.map +1 -0
- package/dist/esm/client/mergeClientConfig.js +55 -0
- package/dist/esm/client/mergeClientConfig.js.map +1 -0
- package/dist/esm/component/componentDefinitions/EntityCollectionSectionDefinition.js +154 -0
- package/dist/esm/component/componentDefinitions/EntityCollectionSectionDefinition.js.map +1 -0
- package/dist/esm/component/componentDefinitions/HeroEntitySectionDefinition.js +6 -3
- package/dist/esm/component/componentDefinitions/HeroEntitySectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/HeroSectionDefinition.js +5 -2
- package/dist/esm/component/componentDefinitions/HeroSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/NextStepsSectionDefinition.js +36 -3
- package/dist/esm/component/componentDefinitions/NextStepsSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/TextBlockSectionDefinition.js +27 -1
- package/dist/esm/component/componentDefinitions/TextBlockSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/index.js +14 -1
- package/dist/esm/component/componentDefinitions/index.js.map +1 -1
- package/dist/esm/component/componentParser.js +38 -1
- package/dist/esm/component/componentParser.js.map +1 -1
- package/dist/esm/component/types.js.map +1 -1
- package/dist/esm/components/ui/SearchSection.css +66 -9
- package/dist/esm/components/ui/SearchSection.js +5 -1
- package/dist/esm/components/ui/SearchSection.js.map +1 -1
- package/dist/esm/hostScope.js.map +1 -1
- package/dist/esm/index.js +9 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/styles/prompt-input-tokens.css +41 -34
- package/dist/esm/utils/matchDebug.js +85 -0
- package/dist/esm/utils/matchDebug.js.map +1 -0
- package/dist/types/client/applyThemeOverrides.d.ts +19 -0
- package/dist/types/client/applyThemeOverrides.d.ts.map +1 -0
- package/dist/types/client/clientBundleUrl.d.ts +39 -0
- package/dist/types/client/clientBundleUrl.d.ts.map +1 -0
- package/dist/types/client/mergeClientConfig.d.ts +28 -0
- package/dist/types/client/mergeClientConfig.d.ts.map +1 -0
- package/dist/types/component/componentDefinitions/EntityCollectionSectionDefinition.d.ts +51 -0
- package/dist/types/component/componentDefinitions/EntityCollectionSectionDefinition.d.ts.map +1 -0
- package/dist/types/component/componentDefinitions/HeroEntitySectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/HeroSectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/NextStepsSectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/TextBlockSectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/index.d.ts +1 -0
- package/dist/types/component/componentDefinitions/index.d.ts.map +1 -1
- package/dist/types/component/componentParser.d.ts.map +1 -1
- package/dist/types/component/types.d.ts +7 -0
- package/dist/types/component/types.d.ts.map +1 -1
- package/dist/types/components/ui/SearchSection.d.ts.map +1 -1
- package/dist/types/hostScope.d.ts +11 -0
- package/dist/types/hostScope.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/utils/matchDebug.d.ts +38 -0
- package/dist/types/utils/matchDebug.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/components/ui/SearchSection.css +66 -9
- package/src/styles/prompt-input-tokens.css +41 -34
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { headingText, bodyText, firstImageSrc, parseCalloutTag, extractListItemText } from './parse-utils.js';
|
|
2
|
+
import { headingText, headingMarkdown, bodyText, firstImageSrc, parseCalloutTag, extractListItemText } from './parse-utils.js';
|
|
3
3
|
import { getPartsByType, getLinks } from '../../parts/parts.js';
|
|
4
4
|
export class HeroSectionDefinition {
|
|
5
5
|
constructor() {
|
|
@@ -198,7 +198,10 @@ Get started today with our amazing features.
|
|
|
198
198
|
leadingQuote = parseCalloutTag(raw).text || undefined;
|
|
199
199
|
}
|
|
200
200
|
return {
|
|
201
|
-
|
|
201
|
+
// Markdown-preserving (not headingText): the hero title now carries the
|
|
202
|
+
// bold+italic hook the ECHO callout used to own, so the FE needs the
|
|
203
|
+
// formatting, not just the plain text. See FeatureComparisonHero.tsx.
|
|
204
|
+
headline: headingMarkdown(parts, 1),
|
|
202
205
|
badge: headingText(parts, 3) || undefined,
|
|
203
206
|
content: bodyText(parts) || undefined,
|
|
204
207
|
buttons: buttons.length > 0 ? buttons : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["headingText","bodyText","firstImageSrc","parseCalloutTag","extractListItemText","getPartsByType","getLinks","HeroSectionDefinition","constructor","_defineProperty","headline","content","buttons","id","text","variant","markdown","expected","onClick","image","parse","parts","lists","list","item","_list$meta","meta","items","_item$meta","itemParts","nestedImage","buttonIndex","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","linkTexts","_l$content2","join","link","isFirstButton","lines","_item$meta4","h1Index","findIndex","_p$meta","level","blockquotes","leadingQuote","bq","_bq$meta","_bq$content","bqIndex","indexOf","raw","undefined","badge"],"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\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,\n };\n }\n}\n"],"mappings":";AAAA,SACEA,WAAW,EACXC,QAAQ,EACRC,aAAa,EACbC,eAAe,EACfC,mBAAmB,QACd,eAAe;AAEtB,SAASC,cAAc,EAAEC,QAAQ,QAAQ,mBAAmB;AAS5D,OAAO,MAAMC,qBAAqB,CAElC;EAAAC,YAAA;IAAAC,eAAA,sBACgB,MAAM;IAAAA,eAAA,yBACH,IAAI;IAAAA,eAAA,mBACV;IACT;IACA;IACA;IACA;IACA;IACA;IACA,mFAAmF,CACpF;IAAAA,eAAA,mBAEyB;MACxBC,QAAQ,EAAE,yBAAyB;MACnCC,OAAO,EAAE,0CAA0C;MACnDC,OAAO,EAAE,CAAC;QAAEC,EAAE,EAAE,OAAO;QAAEC,IAAI,EAAE,aAAa;QAAEC,OAAO,EAAE;MAAU,CAAC;IACpE,CAAC;IAAAN,eAAA,mBAE2C,CAC1C;MACEO,QAAQ,EACN,6EAA6E;MAC/EC,QAAQ,EAAE;QACRP,QAAQ,EAAE,SAAS;QACnBC,OAAO,EAAE,uBAAuB;QAChCC,OAAO,EAAE,CACP;UACEC,EAAE,EAA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MC,OAAO,GAAGlD,KAAK,CAACmD,OAAO,CAACJ,EAAE,CAAC;MACjC,IAAIN,OAAO,IAAI,CAAC,IAAIS,OAAO,GAAGT,OAAO,EAAE;QACrC;MACF;MACA,MAAMW,GAAG,GAAG,EAAAJ,QAAA,GAACD,EAAE,CAAC1C,IAAI,cAAA2C,QAAA,GAAPA,QAAA,CAASrD,QAAQ,qBAAlBqD,QAAA,CAA+BjC,IAAI,CAAC,CAAC,OAAAkC,WAAA,GAAIF,EAAE,CAACzD,OAAO,qBAAV2D,WAAA,CAAYlC,IAAI,CAAC,CAAC;MACvE,IAAI,CAACqC,GAAG,EAAE;QACR;MACF;MACAN,YAAY,GAAGhE,eAAe,CAACsE,GAAG,CAAC,CAAC3D,IAAI,IAAI4D,SAAS;IACvD;IAEA,OAAO;MACLhE,QAAQ,EAAEV,WAAW,CAACqB,KAAK,EAAE,CAAC,CAAC;MAC/BsD,KAAK,EAAE3E,WAAW,CAACqB,KAAK,EAAE,CAAC,CAAC,IAAIqD,SAAS;MACzC/D,OAAO,EAAEV,QAAQ,CAACoB,KAAK,CAAC,IAAIqD,SAAS;MACrC9D,OAAO,EAAEA,OAAO,CAAC0B,MAAM,GAAG,CAAC,GAAG1B,OAAO,GAAG8D,SAAS;MACjDvD,KAAK;MACLoB,YAAY;MACZ4B;IACF,CAAC;EACH;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["headingText","headingMarkdown","bodyText","firstImageSrc","parseCalloutTag","extractListItemText","getPartsByType","getLinks","HeroSectionDefinition","constructor","_defineProperty","headline","content","buttons","id","text","variant","markdown","expected","onClick","image","parse","parts","lists","list","item","_list$meta","meta","items","_item$meta","itemParts","nestedImage","buttonIndex","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","linkTexts","_l$content2","join","link","isFirstButton","lines","_item$meta4","h1Index","findIndex","_p$meta","level","blockquotes","leadingQuote","bq","_bq$meta","_bq$content","bqIndex","indexOf","raw","undefined","badge"],"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\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,SACEA,WAAW,EACXC,eAAe,EACfC,QAAQ,EACRC,aAAa,EACbC,eAAe,EACfC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AAC,IAAIqD,SAAS;MACzC/D,OAAO,EAAEV,QAAQ,CAACoB,KAAK,CAAC,IAAIqD,SAAS;MACrC9D,OAAO,EAAEA,OAAO,CAAC0B,MAAM,GAAG,CAAC,GAAG1B,OAAO,GAAG8D,SAAS;MACjDvD,KAAK;MACLoB,YAAY;MACZ4B;IACF,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { headingText, extractListItemText, firstImageSrc } from './parse-utils.js';
|
|
2
|
+
import { headingText, bodyText, extractListItemText, firstImageSrc } from './parse-utils.js';
|
|
3
3
|
import { getPartsByType, getLinks } from '../../parts/parts.js';
|
|
4
4
|
function linkToMarkdown(link) {
|
|
5
5
|
var _link$content, _link$meta;
|
|
@@ -35,16 +35,39 @@ function inlineBodyMarkdown(parts) {
|
|
|
35
35
|
export class NextStepsSectionDefinition {
|
|
36
36
|
constructor() {
|
|
37
37
|
_defineProperty(this, "sectionType", 'nextSteps');
|
|
38
|
-
_defineProperty(this, "patterns", [
|
|
38
|
+
_defineProperty(this, "patterns", [
|
|
39
|
+
// Framing sentence (`t?`) then one chip per bullet — the authored shape.
|
|
40
|
+
'(html_comment[section^="next"] | html_comment[semantic^="next"]) > h2 > image? > t? > list{item[1-]:(icon | t)* > (t? > link)+}',
|
|
41
|
+
// Legacy inline shape: chips embedded in the prose. Still arrives from
|
|
42
|
+
// sites whose next-steps prompt has not moved to the list shape.
|
|
43
|
+
'(html_comment[section^="next"] | html_comment[semantic^="next"]) > h2 > image? > (t | link)+']);
|
|
39
44
|
_defineProperty(this, "defaults", {
|
|
40
45
|
title: 'Next Steps',
|
|
41
|
-
body: '
|
|
46
|
+
body: 'Where would you like to go next?',
|
|
42
47
|
backgroundImage: undefined,
|
|
43
48
|
steps: [{
|
|
44
49
|
content: '[Get started](/start)'
|
|
45
50
|
}]
|
|
46
51
|
});
|
|
47
52
|
_defineProperty(this, "fixtures", [{
|
|
53
|
+
markdown: `<!-- section:next-steps, semantic:next_steps -->
|
|
54
|
+
|
|
55
|
+
## Find the right care for mature, sensitive skin
|
|
56
|
+
|
|
57
|
+
Want to focus on rich hydrators and barrier builders?
|
|
58
|
+
|
|
59
|
+
- [hydrating creams →](web5://ask/hydrating+creams+for+mature+skin)
|
|
60
|
+
- [gentle resurfacing serums →](web5://ask/gentle+resurfacing+serums)`,
|
|
61
|
+
expected: {
|
|
62
|
+
title: 'Find the right care for mature, sensitive skin',
|
|
63
|
+
body: 'Want to focus on rich hydrators and barrier builders?',
|
|
64
|
+
steps: [{
|
|
65
|
+
content: '[hydrating creams →](web5://ask/hydrating+creams+for+mature+skin)'
|
|
66
|
+
}, {
|
|
67
|
+
content: '[gentle resurfacing serums →](web5://ask/gentle+resurfacing+serums)'
|
|
68
|
+
}]
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
48
71
|
markdown: `<!-- section: next_steps -->
|
|
49
72
|
|
|
50
73
|
## Next Steps
|
|
@@ -66,10 +89,14 @@ export class NextStepsSectionDefinition {
|
|
|
66
89
|
const backgroundImage = firstImageSrc(parts);
|
|
67
90
|
const steps = [];
|
|
68
91
|
let body;
|
|
92
|
+
let chipsInlineInBody = false;
|
|
69
93
|
|
|
70
94
|
// Try list-based pattern first
|
|
71
95
|
const lists = getPartsByType(parts, 'list');
|
|
72
96
|
if (lists.length > 0) {
|
|
97
|
+
// The framing sentence is the only top-level prose — list items live
|
|
98
|
+
// under each list's meta.items, so bodyText never picks up a chip.
|
|
99
|
+
body = bodyText(parts) || undefined;
|
|
73
100
|
for (const list of lists) {
|
|
74
101
|
for (const item of ((_list$meta = list.meta) == null ? void 0 : _list$meta.items) ?? []) {
|
|
75
102
|
var _list$meta, _item$meta, _iconPart$meta;
|
|
@@ -99,6 +126,9 @@ export class NextStepsSectionDefinition {
|
|
|
99
126
|
}
|
|
100
127
|
} else {
|
|
101
128
|
body = inlineBodyMarkdown(parts);
|
|
129
|
+
// body carries the chips as inline links — flag it so renderers show the
|
|
130
|
+
// prose alone instead of repeating every chip as a row beneath it.
|
|
131
|
+
chipsInlineInBody = Boolean(body);
|
|
102
132
|
}
|
|
103
133
|
|
|
104
134
|
// Fallback: inline links pattern
|
|
@@ -120,6 +150,9 @@ export class NextStepsSectionDefinition {
|
|
|
120
150
|
...(body ? {
|
|
121
151
|
body
|
|
122
152
|
} : {}),
|
|
153
|
+
...(chipsInlineInBody ? {
|
|
154
|
+
chipsInlineInBody
|
|
155
|
+
} : {}),
|
|
123
156
|
...(backgroundImage ? {
|
|
124
157
|
backgroundImage
|
|
125
158
|
} : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["headingText","extractListItemText","firstImageSrc","getPartsByType","getLinks","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","_defineProperty","title","backgroundImage","steps","expected","parse","lists","length","list","item","_list$meta","items","_item$meta","_iconPart$meta","itemParts","iconPart","find","p","iconHint","contentFragments","push","_p$content","filter","Boolean","join","links","_link$content2","_link$meta2","text"],"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,SACEA,WAAW,EACXC,mBAAmB,EACnBC,aAAa,QACR,eAAe;AACtB,SACEC,cAAc,EACdC,QAAQ,QAKH,mBAAmB;AAQ1B,SAASC,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,SAAS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AAG;QAAEA;MAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;MAC/CC;IACF,CAAC;EACH;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["headingText","bodyText","extractListItemText","firstImageSrc","getPartsByType","getLinks","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","_defineProperty","title","backgroundImage","steps","expected","parse","chipsInlineInBody","lists","length","list","item","_list$meta","items","_item$meta","_iconPart$meta","itemParts","iconPart","find","p","iconHint","contentFragments","push","_p$content","filter","Boolean","join","links","_link$content2","_link$meta2","text"],"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,SACEA,WAAW,EACXC,QAAQ,EACRC,mBAAmB,EACnBC,aAAa,QACR,eAAe;AACtB,SACEC,cAAc,EACdC,QAAQ,QAKH,mBAAmB;AAQ1B,SAASC,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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AS,CAAC,GAAG,CAAC,CAAC;YAClC,CAAC,CAAC;UACJ;QACF;MACF;IACF,CAAC,MAAM;MACL5B,IAAI,GAAGF,kBAAkB,CAACC,KAAK,CAAC;MAChC;MACA;MACAgB,iBAAiB,GAAGkB,OAAO,CAACjC,IAAI,CAAC;IACnC;;IAEA;IACA,IAAIY,KAAK,CAACK,MAAM,KAAK,CAAC,EAAE;MACtB,MAAMkB,KAAK,GAAGnD,QAAQ,CAACe,KAAK,CAAC;MAC7B,KAAK,MAAMb,IAAI,IAAIiD,KAAK,EAAE;QAAA,IAAAC,cAAA,EAAAC,WAAA;QACxB,MAAMC,IAAI,IAAAF,cAAA,GAAGlD,IAAI,CAACG,OAAO,qBAAZ+C,cAAA,CAAc9C,IAAI,CAAC,CAAC;QACjC,MAAME,IAAI,IAAA6C,WAAA,GAAGnD,IAAI,CAACK,IAAI,qBAAT8C,WAAA,CAAW7C,IAAI;QAC5B,IAAI8C,IAAI,IAAI9C,IAAI,EAAE;UAChBoB,KAAK,CAACkB,IAAI,CAAC;YAAEzC,OAAO,EAAEJ,cAAc,CAACC,IAAI;UAAE,CAAC,CAAC;QAC/C;MACF;IACF;IAEA,OAAO;MACLwB,KAAK;MACL,IAAIV,IAAI,GAAG;QAAEA;MAAK,CAAC,GAAG,CAAC,CAAC,CAAC;MACzB,IAAIe,iBAAiB,GAAG;QAAEA;MAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;MACnD,IAAIJ,eAAe,GAAG;QAAEA;MAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;MAC/CC;IACF,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -4,7 +4,24 @@ import { DIAGNOSTIC_TYPES } from '../diagnosticTypes.js';
|
|
|
4
4
|
export class TextBlockSectionDefinition {
|
|
5
5
|
constructor() {
|
|
6
6
|
_defineProperty(this, "sectionType", 'textBlock');
|
|
7
|
-
|
|
7
|
+
// The trailing callout is OPTIONAL. A heading plus running copy is the shape
|
|
8
|
+
// stores emit constantly for explainer content, and requiring the blockquote
|
|
9
|
+
// meant those blocks matched no definition at all and fell through to
|
|
10
|
+
// `FallbackSectionDefinition` — rendered as undifferentiated prose with no
|
|
11
|
+
// section treatment. `parse()` already tolerates a missing callout (it only
|
|
12
|
+
// rejects when title AND description are empty).
|
|
13
|
+
//
|
|
14
|
+
// NOTE for registry authors: with the callout optional this also matches a
|
|
15
|
+
// bare `h2 > t`, and a pattern matches a PREFIX of the block. Register
|
|
16
|
+
// `textBlock` BELOW every definition whose block opens `h2 > t` — entity,
|
|
17
|
+
// entityCollection, listItemsSection, featureCards, ctaBanner, comparison,
|
|
18
|
+
// kpi, nextSteps. Above them it claims the heading + intro paragraph off the
|
|
19
|
+
// front of the block and strands the list / links / table that follow
|
|
20
|
+
// (`EntitySectionDefinition` allows `h2 > (t | callout)* > links…`, and
|
|
21
|
+
// `listItemsSection` / `ctaBanner` are the same shape). `createSdkRegistry`
|
|
22
|
+
// and the client registries in this repo order it that way; a client
|
|
23
|
+
// registry living outside this repo has to do the same.
|
|
24
|
+
_defineProperty(this, "patterns", ['html_comment? > h2 > t > callout?']);
|
|
8
25
|
_defineProperty(this, "defaults", {
|
|
9
26
|
title: 'Text Block Title',
|
|
10
27
|
description: 'Description text.',
|
|
@@ -39,6 +56,15 @@ The platform scales with your needs.
|
|
|
39
56
|
text: 'Start small with Go, then expand to the full suite as your data maturity grows.'
|
|
40
57
|
}
|
|
41
58
|
}
|
|
59
|
+
}, {
|
|
60
|
+
markdown: `## How to choose between a clinical serum and a nourishing dry oil
|
|
61
|
+
|
|
62
|
+
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.`,
|
|
63
|
+
expected: {
|
|
64
|
+
title: 'How to choose between a clinical serum and a nourishing dry oil',
|
|
65
|
+
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.',
|
|
66
|
+
callout: undefined
|
|
67
|
+
}
|
|
42
68
|
}]);
|
|
43
69
|
}
|
|
44
70
|
parse(parts, context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["headingMarkdown","bodyText","calloutFromParts","DIAGNOSTIC_TYPES","TextBlockSectionDefinition","constructor","_defineProperty","title","description","callout","text","markdown","expected","parse","parts","context","reportDiagnostic","SECTION_REJECTED"],"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,SAASA,eAAe,EAAEC,QAAQ,EAAEC,gBAAgB,QAAQ,eAAe;AAO3E,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,OAAO,MAAMC,0BAA0B,CAEvC;EAAAC,YAAA;IAAAC,eAAA,sBACgB,WAAW;IAAAA,eAAA,
|
|
1
|
+
{"version":3,"names":["headingMarkdown","bodyText","calloutFromParts","DIAGNOSTIC_TYPES","TextBlockSectionDefinition","constructor","_defineProperty","title","description","callout","text","markdown","expected","undefined","parse","parts","context","reportDiagnostic","SECTION_REJECTED"],"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,SAASA,eAAe,EAAEC,QAAQ,EAAEC,gBAAgB,QAAQ,eAAe;AAO3E,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,OAAO,MAAMC,0BAA0B,CAEvC;EAAAC,YAAA;IAAAC,eAAA,sBACgB,WAAW;IACzB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAAAA,eAAA,mBACW,CAAC,mCAAmC,CAAC;IAAAA,eAAA,mBAEjB;MAC7BC,KAAK,EAAE,kBAAkB;MACzBC,WAAW,EAAE,mBAAmB;MAChCC,OAAO,EAAE;QAAEC,IAAI,EAAE;MAA0B;IAC7C,CAAC;IAAAJ,eAAA,mBAEgD,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,GAAGP,eAAe,CAACe,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE;IAC7C,MAAMP,WAAW,GAAGP,QAAQ,CAACc,KAAK,CAAC,IAAI,EAAE;IACzC,MAAMN,OAAO,GAAGP,gBAAgB,CAACa,KAAK,CAAC;IAEvC,IAAI,CAACR,KAAK,IAAI,CAACC,WAAW,EAAE;MAC1BQ,OAAO,YAAPA,OAAO,CAAEC,gBAAgB,YAAzBD,OAAO,CAAEC,gBAAgB,CACvBd,gBAAgB,CAACe,gBAAgB,EACjC,iDACF,CAAC;MACD,OAAO,IAAI;IACb;IAEA,OAAO;MAAEX,KAAK;MAAEC,WAAW;MAAEC;IAAQ,CAAC;EACxC;AACF","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ export { HeroEntitySectionDefinition } from './HeroEntitySectionDefinition.js';
|
|
|
5
5
|
export { KpiSectionDefinition } from './KpiSectionDefinition.js';
|
|
6
6
|
export { FeatureCardsSectionDefinition } from './FeatureCardsSectionDefinition.js';
|
|
7
7
|
export { EntitySectionDefinition } from './EntitySectionDefinition.js';
|
|
8
|
+
export { EntityCollectionSectionDefinition } from './EntityCollectionSectionDefinition.js';
|
|
8
9
|
export { CtaBannerSectionDefinition } from './CtaBannerSectionDefinition.js';
|
|
9
10
|
export { CalloutSectionDefinition } from './CalloutSectionDefinition.js';
|
|
10
11
|
export { NextStepsSectionDefinition } from './NextStepsSectionDefinition.js';
|
|
@@ -21,6 +22,7 @@ import { SearchSectionDefinition } from './SearchSectionDefinition.js';
|
|
|
21
22
|
import { KpiSectionDefinition } from './KpiSectionDefinition.js';
|
|
22
23
|
import { NextStepsSectionDefinition } from './NextStepsSectionDefinition.js';
|
|
23
24
|
import { EntitySectionDefinition } from './EntitySectionDefinition.js';
|
|
25
|
+
import { EntityCollectionSectionDefinition } from './EntityCollectionSectionDefinition.js';
|
|
24
26
|
import { HeroEntitySectionDefinition } from './HeroEntitySectionDefinition.js';
|
|
25
27
|
import { HeroSectionDefinition } from './HeroSectionDefinition.js';
|
|
26
28
|
import { FeatureCardsSectionDefinition } from './FeatureCardsSectionDefinition.js';
|
|
@@ -40,6 +42,17 @@ import { TextBlockSectionDefinition } from './TextBlockSectionDefinition.js';
|
|
|
40
42
|
* Registration order determines evaluation priority — first match wins.
|
|
41
43
|
*/
|
|
42
44
|
export function createSdkRegistry() {
|
|
43
|
-
return new ComponentRegistry(null).register(new SkipNodesSectionDefinition()).register(new SearchSectionDefinition()).register(new KpiSectionDefinition()).register(new NextStepsSectionDefinition())
|
|
45
|
+
return new ComponentRegistry(null).register(new SkipNodesSectionDefinition()).register(new SearchSectionDefinition()).register(new KpiSectionDefinition()).register(new NextStepsSectionDefinition())
|
|
46
|
+
// Collection entities are claimed by their own definition first — it is a
|
|
47
|
+
// strictly narrower match than EntitySectionDefinition, which would
|
|
48
|
+
// otherwise swallow collection, product and article blocks alike.
|
|
49
|
+
.register(new EntityCollectionSectionDefinition()).register(new EntitySectionDefinition()).register(new HeroEntitySectionDefinition()).register(new HeroSectionDefinition()).register(new FeatureCardsSectionDefinition()).register(new ListItemsSectionDefinition()).register(new FeatureSection9PlusDefinition()).register(new ComparisonSectionDefinition()).register(new HtmlCommentSectionDefinition()).register(new CtaBannerSectionDefinition())
|
|
50
|
+
// textBlock comes after every definition whose block opens `h2 > t`
|
|
51
|
+
// (entity, listItems, featureCards, ctaBanner, comparison, …). Its
|
|
52
|
+
// trailing callout is optional, so its pattern also matches a bare
|
|
53
|
+
// `h2 > t`, and a pattern matches a PREFIX of the block — registered
|
|
54
|
+
// above those it would claim the heading + intro paragraph and strand
|
|
55
|
+
// the list / links / table that follow in a separate section.
|
|
56
|
+
.register(new TextBlockSectionDefinition()).register(new CalloutSectionDefinition()).register(new FallbackSectionDefinition()).register(new ErrorSectionDefinition());
|
|
44
57
|
}
|
|
45
58
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComparisonSectionDefinition","TextBlockSectionDefinition","HeroSectionDefinition","HeroEntitySectionDefinition","KpiSectionDefinition","FeatureCardsSectionDefinition","EntitySectionDefinition","CtaBannerSectionDefinition","CalloutSectionDefinition","NextStepsSectionDefinition","FeatureSection9PlusDefinition","ListItemsSectionDefinition","SkipNodesSectionDefinition","HtmlCommentSectionDefinition","SearchSectionDefinition","ErrorSectionDefinition","FallbackSectionDefinition","ComponentRegistry","createSdkRegistry","register"],"sources":["../../../../src/component/componentDefinitions/index.ts"],"sourcesContent":["export type { SectionDefinition } from '../section-definition';\nexport { ComparisonSectionDefinition } from './ComparisonSectionDefinition';\nexport { TextBlockSectionDefinition } from './TextBlockSectionDefinition';\nexport { HeroSectionDefinition } from './HeroSectionDefinition';\nexport { HeroEntitySectionDefinition } from './HeroEntitySectionDefinition';\nexport { KpiSectionDefinition } from './KpiSectionDefinition';\nexport { FeatureCardsSectionDefinition } from './FeatureCardsSectionDefinition';\nexport { EntitySectionDefinition } from './EntitySectionDefinition';\nexport { CtaBannerSectionDefinition } from './CtaBannerSectionDefinition';\nexport { CalloutSectionDefinition } from './CalloutSectionDefinition';\nexport { NextStepsSectionDefinition } from './NextStepsSectionDefinition';\nexport { FeatureSection9PlusDefinition } from './FeatureSection9PlusDefinition';\nexport { ListItemsSectionDefinition } from './listItemsSectionDefinition';\nexport { SkipNodesSectionDefinition } from './SkipNodesSectionDefinition';\nexport { HtmlCommentSectionDefinition } from './HtmlCommentSectionDefinition';\nexport { SearchSectionDefinition } from './SearchSectionDefinition';\nexport { ErrorSectionDefinition } from './ErrorSectionDefinition';\nexport { FallbackSectionDefinition } from './FallbackSectionDefinition';\n\nimport { ComponentRegistry } from '../../registry';\nimport { SkipNodesSectionDefinition } from './SkipNodesSectionDefinition';\nimport { SearchSectionDefinition } from './SearchSectionDefinition';\nimport { KpiSectionDefinition } from './KpiSectionDefinition';\nimport { NextStepsSectionDefinition } from './NextStepsSectionDefinition';\nimport { EntitySectionDefinition } from './EntitySectionDefinition';\nimport { HeroEntitySectionDefinition } from './HeroEntitySectionDefinition';\nimport { HeroSectionDefinition } from './HeroSectionDefinition';\nimport { FeatureCardsSectionDefinition } from './FeatureCardsSectionDefinition';\nimport { FeatureSection9PlusDefinition } from './FeatureSection9PlusDefinition';\nimport { ListItemsSectionDefinition } from './listItemsSectionDefinition';\nimport { ComparisonSectionDefinition } from './ComparisonSectionDefinition';\nimport { HtmlCommentSectionDefinition } from './HtmlCommentSectionDefinition';\nimport { CtaBannerSectionDefinition } from './CtaBannerSectionDefinition';\nimport { CalloutSectionDefinition } from './CalloutSectionDefinition';\nimport { FallbackSectionDefinition } from './FallbackSectionDefinition';\nimport { ErrorSectionDefinition } from './ErrorSectionDefinition';\nimport { TextBlockSectionDefinition } from './TextBlockSectionDefinition';\n\n/**\n * Creates an SDK registry with all section definitions registered in the\n * same priority order as the app registry (createAppRegistry.ts).\n * Registration order determines evaluation priority — first match wins.\n */\nexport function createSdkRegistry(): ComponentRegistry<null> {\n return new ComponentRegistry<null>(null)\n
|
|
1
|
+
{"version":3,"names":["ComparisonSectionDefinition","TextBlockSectionDefinition","HeroSectionDefinition","HeroEntitySectionDefinition","KpiSectionDefinition","FeatureCardsSectionDefinition","EntitySectionDefinition","EntityCollectionSectionDefinition","CtaBannerSectionDefinition","CalloutSectionDefinition","NextStepsSectionDefinition","FeatureSection9PlusDefinition","ListItemsSectionDefinition","SkipNodesSectionDefinition","HtmlCommentSectionDefinition","SearchSectionDefinition","ErrorSectionDefinition","FallbackSectionDefinition","ComponentRegistry","createSdkRegistry","register"],"sources":["../../../../src/component/componentDefinitions/index.ts"],"sourcesContent":["export type { SectionDefinition } from '../section-definition';\nexport { ComparisonSectionDefinition } from './ComparisonSectionDefinition';\nexport { TextBlockSectionDefinition } from './TextBlockSectionDefinition';\nexport { HeroSectionDefinition } from './HeroSectionDefinition';\nexport { HeroEntitySectionDefinition } from './HeroEntitySectionDefinition';\nexport { KpiSectionDefinition } from './KpiSectionDefinition';\nexport { FeatureCardsSectionDefinition } from './FeatureCardsSectionDefinition';\nexport { EntitySectionDefinition } from './EntitySectionDefinition';\nexport { EntityCollectionSectionDefinition } from './EntityCollectionSectionDefinition';\nexport { CtaBannerSectionDefinition } from './CtaBannerSectionDefinition';\nexport { CalloutSectionDefinition } from './CalloutSectionDefinition';\nexport { NextStepsSectionDefinition } from './NextStepsSectionDefinition';\nexport { FeatureSection9PlusDefinition } from './FeatureSection9PlusDefinition';\nexport { ListItemsSectionDefinition } from './listItemsSectionDefinition';\nexport { SkipNodesSectionDefinition } from './SkipNodesSectionDefinition';\nexport { HtmlCommentSectionDefinition } from './HtmlCommentSectionDefinition';\nexport { SearchSectionDefinition } from './SearchSectionDefinition';\nexport { ErrorSectionDefinition } from './ErrorSectionDefinition';\nexport { FallbackSectionDefinition } from './FallbackSectionDefinition';\n\nimport { ComponentRegistry } from '../../registry';\nimport { SkipNodesSectionDefinition } from './SkipNodesSectionDefinition';\nimport { SearchSectionDefinition } from './SearchSectionDefinition';\nimport { KpiSectionDefinition } from './KpiSectionDefinition';\nimport { NextStepsSectionDefinition } from './NextStepsSectionDefinition';\nimport { EntitySectionDefinition } from './EntitySectionDefinition';\nimport { EntityCollectionSectionDefinition } from './EntityCollectionSectionDefinition';\nimport { HeroEntitySectionDefinition } from './HeroEntitySectionDefinition';\nimport { HeroSectionDefinition } from './HeroSectionDefinition';\nimport { FeatureCardsSectionDefinition } from './FeatureCardsSectionDefinition';\nimport { FeatureSection9PlusDefinition } from './FeatureSection9PlusDefinition';\nimport { ListItemsSectionDefinition } from './listItemsSectionDefinition';\nimport { ComparisonSectionDefinition } from './ComparisonSectionDefinition';\nimport { HtmlCommentSectionDefinition } from './HtmlCommentSectionDefinition';\nimport { CtaBannerSectionDefinition } from './CtaBannerSectionDefinition';\nimport { CalloutSectionDefinition } from './CalloutSectionDefinition';\nimport { FallbackSectionDefinition } from './FallbackSectionDefinition';\nimport { ErrorSectionDefinition } from './ErrorSectionDefinition';\nimport { TextBlockSectionDefinition } from './TextBlockSectionDefinition';\n\n/**\n * Creates an SDK registry with all section definitions registered in the\n * same priority order as the app registry (createAppRegistry.ts).\n * Registration order determines evaluation priority — first match wins.\n */\nexport function createSdkRegistry(): ComponentRegistry<null> {\n return (\n new ComponentRegistry<null>(null)\n .register(new SkipNodesSectionDefinition())\n .register(new SearchSectionDefinition())\n .register(new KpiSectionDefinition())\n .register(new NextStepsSectionDefinition())\n // Collection entities are claimed by their own definition first — it is a\n // strictly narrower match than EntitySectionDefinition, which would\n // otherwise swallow collection, product and article blocks alike.\n .register(new EntityCollectionSectionDefinition())\n .register(new EntitySectionDefinition())\n .register(new HeroEntitySectionDefinition())\n .register(new HeroSectionDefinition())\n .register(new FeatureCardsSectionDefinition())\n .register(new ListItemsSectionDefinition())\n .register(new FeatureSection9PlusDefinition())\n .register(new ComparisonSectionDefinition())\n .register(new HtmlCommentSectionDefinition())\n .register(new CtaBannerSectionDefinition())\n // textBlock comes after every definition whose block opens `h2 > t`\n // (entity, listItems, featureCards, ctaBanner, comparison, …). Its\n // trailing callout is optional, so its pattern also matches a bare\n // `h2 > t`, and a pattern matches a PREFIX of the block — registered\n // above those it would claim the heading + intro paragraph and strand\n // the list / links / table that follow in a separate section.\n .register(new TextBlockSectionDefinition())\n .register(new CalloutSectionDefinition())\n .register(new FallbackSectionDefinition())\n .register(new ErrorSectionDefinition())\n );\n}\n"],"mappings":"AACA,SAASA,2BAA2B,QAAQ,+BAA+B;AAC3E,SAASC,0BAA0B,QAAQ,8BAA8B;AACzE,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,2BAA2B,QAAQ,+BAA+B;AAC3E,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,6BAA6B,QAAQ,iCAAiC;AAC/E,SAASC,uBAAuB,QAA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,QAAQ,CAAC,IAAIP,0BAA0B,CAAC,CAAC,CAAC,CAC1CO,QAAQ,CAAC,IAAIL,uBAAuB,CAAC,CAAC,CAAC,CACvCK,QAAQ,CAAC,IAAIhB,oBAAoB,CAAC,CAAC,CAAC,CACpCgB,QAAQ,CAAC,IAAIV,0BAA0B,CAAC,CAAC;EAC1C;EACA;EACA;EAAA,CACCU,QAAQ,CAAC,IAAIb,iCAAiC,CAAC,CAAC,CAAC,CACjDa,QAAQ,CAAC,IAAId,uBAAuB,CAAC,CAAC,CAAC,CACvCc,QAAQ,CAAC,IAAIjB,2BAA2B,CAAC,CAAC,CAAC,CAC3CiB,QAAQ,CAAC,IAAIlB,qBAAqB,CAAC,CAAC,CAAC,CACrCkB,QAAQ,CAAC,IAAIf,6BAA6B,CAAC,CAAC,CAAC,CAC7Ce,QAAQ,CAAC,IAAIR,0BAA0B,CAAC,CAAC,CAAC,CAC1CQ,QAAQ,CAAC,IAAIT,6BAA6B,CAAC,CAAC,CAAC,CAC7CS,QAAQ,CAAC,IAAIpB,2BAA2B,CAAC,CAAC,CAAC,CAC3CoB,QAAQ,CAAC,IAAIN,4BAA4B,CAAC,CAAC,CAAC,CAC5CM,QAAQ,CAAC,IAAIZ,0BAA0B,CAAC,CAAC;EAC1C;EACA;EACA;EACA;EACA;EACA;EAAA,CACCY,QAAQ,CAAC,IAAInB,0BAA0B,CAAC,CAAC,CAAC,CAC1CmB,QAAQ,CAAC,IAAIX,wBAAwB,CAAC,CAAC,CAAC,CACxCW,QAAQ,CAAC,IAAIH,yBAAyB,CAAC,CAAC,CAAC,CACzCG,QAAQ,CAAC,IAAIJ,sBAAsB,CAAC,CAAC,CAAC;AAE7C","ignoreList":[]}
|
|
@@ -21,6 +21,7 @@ import { isWeb5ImageUrl } from '../types/link-types.js';
|
|
|
21
21
|
import { findInvalidWeb5Links } from '../utils/web5LinkValidator.js';
|
|
22
22
|
import { DIAGNOSTIC_TYPES } from './diagnosticTypes.js';
|
|
23
23
|
import { ComponentTracking } from '../utils/componentTracking.js';
|
|
24
|
+
import { isMatchDebugEnabled, logMatchDebug } from '../utils/matchDebug.js';
|
|
24
25
|
import { DiagnosticsCollector } from '../utils/diagnosticsCollector.js';
|
|
25
26
|
import { parseAstToMarkdown, parseMarkdownToAst } from '../utils/unifiedMarkdownParser.js';
|
|
26
27
|
import { preprocessMarkdown } from '../utils/markdownPreprocessor.js';
|
|
@@ -30,8 +31,17 @@ import { createPageSection } from '../utils/propsExtractor.js';
|
|
|
30
31
|
function isEntityCompProps(props) {
|
|
31
32
|
return typeof props === 'object' && props !== null && Array.isArray(props.items);
|
|
32
33
|
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Section types whose props are `EntityCompProps` and therefore participate in
|
|
37
|
+
* payload enrichment. `entityCollection` is `entity` narrowed to collection
|
|
38
|
+
* links — it produces the same props and arrives under the same
|
|
39
|
+
* `semantic: items` descriptor, so leaving it out would silently strip its
|
|
40
|
+
* items of their catalog data (image, title) and render the section blank.
|
|
41
|
+
*/
|
|
42
|
+
const ENRICHABLE_ENTITY_SECTION_TYPES = new Set(['entity', 'entityCollection']);
|
|
33
43
|
function isItemsFromContentSection(sectionType, semantic, serverSectionId) {
|
|
34
|
-
if (sectionType
|
|
44
|
+
if (!ENRICHABLE_ENTITY_SECTION_TYPES.has(sectionType)) {
|
|
35
45
|
return false;
|
|
36
46
|
}
|
|
37
47
|
const normalizedSemantic = semantic == null ? void 0 : semantic.toLowerCase().replace(/_/g, '-');
|
|
@@ -261,6 +271,15 @@ export function tryParseComponent(nodes, sectionIndex, context) {
|
|
|
261
271
|
setMeta: context.tracking ? (sectionType, key, value) => context.tracking.setMeta(sectionType, key, value) : undefined,
|
|
262
272
|
getMeta: context.tracking ? (sectionType, key) => context.tracking.getMeta(sectionType, key) : undefined
|
|
263
273
|
};
|
|
274
|
+
|
|
275
|
+
// Debug-only trace (`?web5DebugMatch=1`). The registry order line doubles as
|
|
276
|
+
// a "is my definition even registered?" check — a definition missing from it
|
|
277
|
+
// never reached `register()` (stale client bundle / web5-core version skew).
|
|
278
|
+
const trace = isMatchDebugEnabled();
|
|
279
|
+
if (trace) {
|
|
280
|
+
logMatchDebug(`block #${sectionIndex} [${nodes.map(n => n.type).join(', ')}]`);
|
|
281
|
+
logMatchDebug(` registry order: ${definitions.map(d => d.sectionType).join(' > ')}`);
|
|
282
|
+
}
|
|
264
283
|
for (const {
|
|
265
284
|
sectionType,
|
|
266
285
|
definition
|
|
@@ -270,12 +289,18 @@ export function tryParseComponent(nodes, sectionIndex, context) {
|
|
|
270
289
|
// render (the main app) — their markdown should fall through to the generic
|
|
271
290
|
// sections there. Skip them unless this is a placement parse.
|
|
272
291
|
if (!placement && registry.isPlacementOnly(sectionType)) {
|
|
292
|
+
if (trace) {
|
|
293
|
+
logMatchDebug(` ${sectionType}: skipped (placement-only)`);
|
|
294
|
+
}
|
|
273
295
|
continue;
|
|
274
296
|
}
|
|
275
297
|
for (const pattern of definition.patterns) {
|
|
276
298
|
var _parts$find, _context$intent;
|
|
277
299
|
const result = validatePattern(nodes, pattern);
|
|
278
300
|
if (!result.valid) {
|
|
301
|
+
if (trace) {
|
|
302
|
+
logMatchDebug(` ${sectionType}: no match — ${result.error ?? 'pattern did not match'}\n pattern: ${pattern}`);
|
|
303
|
+
}
|
|
279
304
|
continue;
|
|
280
305
|
}
|
|
281
306
|
let parsedNodes = result.astEndIndex !== undefined && result.astEndIndex >= 0 ? result.astEndIndex + 1 : result.endIndex >= 0 ? result.endIndex + 1 : 1;
|
|
@@ -298,8 +323,14 @@ export function tryParseComponent(nodes, sectionIndex, context) {
|
|
|
298
323
|
};
|
|
299
324
|
let props = definition.parse(parts, parseContext);
|
|
300
325
|
if (props === null) {
|
|
326
|
+
if (trace) {
|
|
327
|
+
logMatchDebug(` ${sectionType}: pattern matched ${parsedNodes} node(s) but parse() returned null — falling through`);
|
|
328
|
+
}
|
|
301
329
|
continue;
|
|
302
330
|
}
|
|
331
|
+
if (trace) {
|
|
332
|
+
logMatchDebug(` ${sectionType}: MATCHED ${parsedNodes} node(s) via ${pattern}`);
|
|
333
|
+
}
|
|
303
334
|
const leadingHtmlCommentMeta = (_parts$find = parts.find(p => p.type === 'htmlComment' && p.meta)) == null ? void 0 : _parts$find.meta;
|
|
304
335
|
const semantic = leadingHtmlCommentMeta == null ? void 0 : leadingHtmlCommentMeta.semantic;
|
|
305
336
|
const serverSectionId = leadingHtmlCommentMeta == null ? void 0 : leadingHtmlCommentMeta.id;
|
|
@@ -313,6 +344,9 @@ export function tryParseComponent(nodes, sectionIndex, context) {
|
|
|
313
344
|
});
|
|
314
345
|
}
|
|
315
346
|
if (definition.singleInstance && context.tracking && context.tracking.getComponentCount(sectionType) > 0) {
|
|
347
|
+
if (trace) {
|
|
348
|
+
logMatchDebug(` ${sectionType}: dropped (singleInstance, already rendered once)`);
|
|
349
|
+
}
|
|
316
350
|
continue;
|
|
317
351
|
}
|
|
318
352
|
const isNullComponent = definition.nullComponent === true;
|
|
@@ -360,6 +394,9 @@ export function tryParseComponent(nodes, sectionIndex, context) {
|
|
|
360
394
|
};
|
|
361
395
|
}
|
|
362
396
|
}
|
|
397
|
+
if (trace) {
|
|
398
|
+
logMatchDebug(' no definition claimed this block');
|
|
399
|
+
}
|
|
363
400
|
return {};
|
|
364
401
|
}
|
|
365
402
|
//# sourceMappingURL=componentParser.js.map
|