meno-core 1.0.34 → 1.0.36

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 (68) hide show
  1. package/build-static.ts +18 -2
  2. package/dist/bin/cli.js +2 -2
  3. package/dist/build-static.js +8 -8
  4. package/dist/chunks/{chunk-YSV4AG55.js → chunk-A6KWUEA6.js} +3 -3
  5. package/dist/chunks/{chunk-VNAPFF4I.js → chunk-AIXKUVNG.js} +12 -6
  6. package/dist/chunks/{chunk-VNAPFF4I.js.map → chunk-AIXKUVNG.js.map} +2 -2
  7. package/dist/chunks/{chunk-RDI56Q2W.js → chunk-EUCAKI5U.js} +215 -47
  8. package/dist/chunks/chunk-EUCAKI5U.js.map +7 -0
  9. package/dist/chunks/{chunk-LDJGXCRR.js → chunk-NV25WXCA.js} +31 -22
  10. package/dist/chunks/chunk-NV25WXCA.js.map +7 -0
  11. package/dist/chunks/{chunk-RWTKZPWJ.js → chunk-P3FX5HJM.js} +1 -1
  12. package/dist/chunks/{chunk-RWTKZPWJ.js.map → chunk-P3FX5HJM.js.map} +1 -1
  13. package/dist/chunks/{chunk-7PCKKQQI.js → chunk-UR7L5UZ3.js} +100 -17
  14. package/dist/chunks/chunk-UR7L5UZ3.js.map +7 -0
  15. package/dist/chunks/{chunk-RO5BCYPR.js → chunk-VENUWN6C.js} +23 -9
  16. package/dist/chunks/chunk-VENUWN6C.js.map +7 -0
  17. package/dist/chunks/{chunk-GB2LHWZF.js → chunk-WQFG7PAH.js} +2 -1
  18. package/dist/chunks/chunk-WQFG7PAH.js.map +7 -0
  19. package/dist/chunks/{chunk-E6L5FESH.js → chunk-YSZ5IUFM.js} +4 -4
  20. package/dist/chunks/{configService-SASOCJRE.js → configService-TXBNUBBL.js} +4 -4
  21. package/dist/chunks/{fs-JMN4XQPQ.js → fs-JGINUXGL.js} +2 -2
  22. package/dist/entries/server-router.js +8 -8
  23. package/dist/lib/client/index.js +10 -68
  24. package/dist/lib/client/index.js.map +2 -2
  25. package/dist/lib/server/index.js +9 -9
  26. package/dist/lib/shared/index.js +17 -9
  27. package/dist/lib/shared/index.js.map +2 -2
  28. package/lib/client/core/builders/listBuilder.ts +8 -98
  29. package/lib/client/hmr/HMRManager.tsx +1 -1
  30. package/lib/client/templateEngine.test.ts +23 -1
  31. package/lib/client/templateEngine.ts +13 -6
  32. package/lib/client/theme.ts +2 -2
  33. package/lib/server/createServer.ts +52 -0
  34. package/lib/server/cssGenerator.ts +13 -28
  35. package/lib/server/jsonLoader.ts +60 -12
  36. package/lib/server/routes/api/components.ts +20 -0
  37. package/lib/server/routes/index.ts +15 -3
  38. package/lib/server/routes/pages.ts +4 -1
  39. package/lib/server/routes/static.ts +3 -3
  40. package/lib/server/runtime/fs.ts +1 -0
  41. package/lib/server/services/cmsService.test.ts +0 -12
  42. package/lib/server/services/cmsService.ts +11 -2
  43. package/lib/server/services/componentService.ts +45 -5
  44. package/lib/server/ssr/attributeBuilder.ts +12 -2
  45. package/lib/server/ssr/htmlGenerator.ts +17 -4
  46. package/lib/server/ssr/ssrRenderer.ts +21 -5
  47. package/lib/shared/fontLoader.ts +4 -1
  48. package/lib/shared/itemTemplateUtils.test.ts +36 -0
  49. package/lib/shared/itemTemplateUtils.ts +4 -1
  50. package/lib/shared/jsonRepair.test.ts +105 -0
  51. package/lib/shared/jsonRepair.ts +177 -0
  52. package/lib/shared/themeDefaults.ts +7 -7
  53. package/lib/shared/treePathUtils.ts +4 -0
  54. package/lib/shared/types/cms.ts +18 -2
  55. package/lib/shared/types/config.ts +18 -0
  56. package/lib/shared/types/index.ts +2 -2
  57. package/lib/shared/types/variables.ts +1 -1
  58. package/lib/shared/validation/schemas.ts +0 -1
  59. package/package.json +1 -1
  60. package/dist/chunks/chunk-7PCKKQQI.js.map +0 -7
  61. package/dist/chunks/chunk-GB2LHWZF.js.map +0 -7
  62. package/dist/chunks/chunk-LDJGXCRR.js.map +0 -7
  63. package/dist/chunks/chunk-RDI56Q2W.js.map +0 -7
  64. package/dist/chunks/chunk-RO5BCYPR.js.map +0 -7
  65. /package/dist/chunks/{chunk-YSV4AG55.js.map → chunk-A6KWUEA6.js.map} +0 -0
  66. /package/dist/chunks/{chunk-E6L5FESH.js.map → chunk-YSZ5IUFM.js.map} +0 -0
  67. /package/dist/chunks/{configService-SASOCJRE.js.map → configService-TXBNUBBL.js.map} +0 -0
  68. /package/dist/chunks/{fs-JMN4XQPQ.js.map → fs-JGINUXGL.js.map} +0 -0
package/build-static.ts CHANGED
@@ -27,6 +27,7 @@ import { FileSystemCMSProvider } from "./lib/server/providers/fileSystemCMSProvi
27
27
  import { CMSService } from "./lib/server/services/cmsService";
28
28
  import { isI18nValue, resolveI18nValue } from "./lib/shared/i18n";
29
29
  import type { ComponentDefinition, JSONPage, CMSSchema, CMSItem, I18nConfig, Experiment } from "./lib/shared/types";
30
+ import { isItemDraftForLocale, isItemFullyPublished } from "./lib/shared/types";
30
31
  import type { SlugMap } from "./lib/shared/slugTranslator";
31
32
  import { buildItemUrl } from "./lib/shared/itemTemplateUtils";
32
33
  import { generateMiddleware, generateTrackFunction, generateResultsFunction } from "./lib/server/ab/generateFunctions";
@@ -156,6 +157,7 @@ function copyDirectory(src: string, dest: string): void {
156
157
  }
157
158
  }
158
159
 
160
+
159
161
  /**
160
162
  * Get locale-specific output path for a page with translated slug support
161
163
  * Default locale files go to root, other locales to subdirectories
@@ -403,9 +405,11 @@ async function buildCMSTemplates(
403
405
  console.log(` Found ${items.length} item(s)`);
404
406
 
405
407
  // Prepare client data if clientData is enabled
408
+ // Filter out fully-draft items from client data (client data is locale-agnostic)
406
409
  let clientDataCollections: Map<string, ClientDataCollection> | undefined;
407
410
  if (cmsSchema.clientData?.enabled) {
408
- const clientData = prepareClientData(cmsSchema.id, items, cmsSchema.clientData);
411
+ const publishedItems = items.filter(item => isItemFullyPublished(item));
412
+ const clientData = prepareClientData(cmsSchema.id, publishedItems, cmsSchema.clientData);
409
413
  if (clientData) {
410
414
  if (clientData.strategy === 'inline') {
411
415
  // Inline data embedded in HTML
@@ -422,6 +426,14 @@ async function buildCMSTemplates(
422
426
  for (const item of items) {
423
427
  for (const localeConfig of i18nConfig.locales) {
424
428
  const locale = localeConfig.code;
429
+
430
+ // Skip draft items per locale in production builds
431
+ const isDevBuild = process.env.MENO_DEV_BUILD === 'true';
432
+ if (!isDevBuild && isItemDraftForLocale(item, locale)) {
433
+ console.log(` ⏭️ Skipping draft: ${item._filename || item._id} [${locale}]`);
434
+ continue;
435
+ }
436
+
425
437
  const baseUrl = siteUrl || "";
426
438
  const itemPath = buildCMSItemPath(cmsSchema.urlPattern, item, cmsSchema.slugField, locale, i18nConfig);
427
439
 
@@ -442,6 +454,7 @@ async function buildCMSTemplates(
442
454
  returnSeparateJS: true,
443
455
  pageLibraries: pageData.meta?.libraries,
444
456
  clientDataCollections,
457
+ isProductionBuild: true,
445
458
  }) as SSRHTMLResult;
446
459
 
447
460
  // If there's JavaScript, write to external file and update HTML
@@ -688,12 +701,14 @@ export async function buildStaticPages(): Promise<void> {
688
701
  console.log(`✅ ${parts.join(', ')} copied\n`);
689
702
 
690
703
  // Load all global components
691
- const components = await loadComponentDirectory(projectPaths.components());
704
+ const { components, warnings, errors } = await loadComponentDirectory(projectPaths.components());
692
705
  const globalComponents: Record<string, ComponentDefinition> = {};
693
706
  components.forEach((value, key) => {
694
707
  globalComponents[key] = value;
695
708
  });
696
709
 
710
+ for (const warning of warnings) console.warn(`⚠️ ${warning}`);
711
+ for (const error of errors) console.error(`❌ ${error}`);
697
712
  console.log(`✅ Loaded ${components.size} global component(s)\n`);
698
713
 
699
714
  // Initialize CMS service for CMSList rendering
@@ -859,6 +874,7 @@ export async function buildStaticPages(): Promise<void> {
859
874
  cmsService,
860
875
  returnSeparateJS: true,
861
876
  pageLibraries: pageData.meta?.libraries,
877
+ isProductionBuild: true,
862
878
  }) as SSRHTMLResult;
863
879
 
864
880
  // If there's JavaScript, write to external file and update HTML
package/dist/bin/cli.js CHANGED
@@ -5,11 +5,11 @@ import {
5
5
  import {
6
6
  createRuntimeServer,
7
7
  setProjectRoot
8
- } from "../chunks/chunk-E6L5FESH.js";
8
+ } from "../chunks/chunk-YSZ5IUFM.js";
9
9
  import {
10
10
  fileExists,
11
11
  serveFile
12
- } from "../chunks/chunk-GB2LHWZF.js";
12
+ } from "../chunks/chunk-WQFG7PAH.js";
13
13
  import "../chunks/chunk-KSBZ2L7C.js";
14
14
 
15
15
  // bin/cli.ts
@@ -9,14 +9,14 @@ import {
9
9
  hashContent,
10
10
  injectTrackingScript,
11
11
  isCMSPage
12
- } from "./chunks/chunk-RO5BCYPR.js";
13
- import "./chunks/chunk-RDI56Q2W.js";
14
- import "./chunks/chunk-YSV4AG55.js";
15
- import "./chunks/chunk-E6L5FESH.js";
16
- import "./chunks/chunk-GB2LHWZF.js";
17
- import "./chunks/chunk-RWTKZPWJ.js";
18
- import "./chunks/chunk-VNAPFF4I.js";
19
- import "./chunks/chunk-LDJGXCRR.js";
12
+ } from "./chunks/chunk-VENUWN6C.js";
13
+ import "./chunks/chunk-EUCAKI5U.js";
14
+ import "./chunks/chunk-A6KWUEA6.js";
15
+ import "./chunks/chunk-YSZ5IUFM.js";
16
+ import "./chunks/chunk-WQFG7PAH.js";
17
+ import "./chunks/chunk-P3FX5HJM.js";
18
+ import "./chunks/chunk-AIXKUVNG.js";
19
+ import "./chunks/chunk-NV25WXCA.js";
20
20
  import "./chunks/chunk-PGH3ATYI.js";
21
21
  import "./chunks/chunk-UB44F4Z2.js";
22
22
  import "./chunks/chunk-KULPBDC7.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  projectPaths
3
- } from "./chunk-E6L5FESH.js";
3
+ } from "./chunk-YSZ5IUFM.js";
4
4
  import {
5
5
  fileExists,
6
6
  readTextFile
7
- } from "./chunk-GB2LHWZF.js";
7
+ } from "./chunk-WQFG7PAH.js";
8
8
  import {
9
9
  DEFAULT_BREAKPOINTS,
10
10
  DEFAULT_I18N_CONFIG,
@@ -197,4 +197,4 @@ export {
197
197
  ConfigService,
198
198
  configService
199
199
  };
200
- //# sourceMappingURL=chunk-YSV4AG55.js.map
200
+ //# sourceMappingURL=chunk-A6KWUEA6.js.map
@@ -14,7 +14,7 @@ import {
14
14
  normalizeStyle,
15
15
  richTextMarkerToHtml,
16
16
  safeEvaluate
17
- } from "./chunk-LDJGXCRR.js";
17
+ } from "./chunk-NV25WXCA.js";
18
18
  import {
19
19
  NODE_TYPE,
20
20
  RAW_HTML_PREFIX,
@@ -382,7 +382,7 @@ function processStructure(structure, context, viewportWidth, instanceChildren, p
382
382
  processed.children = [processedChildren];
383
383
  }
384
384
  } else if (key === "tag") {
385
- if (isHtmlNode(processed) || isListNode(processed)) {
385
+ if (isHtmlNode(processed)) {
386
386
  if (typeof value === "string") {
387
387
  const evalContext = buildEvalContext(context, false);
388
388
  processed.tag = processCodeTemplates(value, evalContext);
@@ -446,13 +446,14 @@ function processStructure(structure, context, viewportWidth, instanceChildren, p
446
446
  } else if (key === "style" && typeof value === "object" && value !== null) {
447
447
  const processedStyle = value;
448
448
  if (processedStyle && typeof processedStyle === "object" && !Array.isArray(processedStyle)) {
449
+ const styleEvalContext = buildEvalContext(context, false);
449
450
  if (isResponsiveStyle(processedStyle)) {
450
451
  const resolvedResponsive = {};
451
452
  for (const [bkeyName, bkeyValue] of Object.entries(processedStyle)) {
452
453
  if (typeof bkeyValue === "object" && bkeyValue !== null) {
453
454
  resolvedResponsive[bkeyName] = {};
454
455
  for (const [styleKey, styleValue] of Object.entries(bkeyValue)) {
455
- const processedValue = processStyleValue(styleValue, context.props);
456
+ const processedValue = processStyleValue(styleValue, styleEvalContext);
456
457
  if (processedValue !== void 0) {
457
458
  resolvedResponsive[bkeyName][styleKey] = processedValue;
458
459
  }
@@ -463,7 +464,7 @@ function processStructure(structure, context, viewportWidth, instanceChildren, p
463
464
  } else {
464
465
  resolvedStyle = {};
465
466
  for (const [styleKey, styleValue] of Object.entries(processedStyle)) {
466
- const processedValue = processStyleValue(styleValue, context.props);
467
+ const processedValue = processStyleValue(styleValue, styleEvalContext);
467
468
  if (processedValue !== void 0) {
468
469
  resolvedStyle[styleKey] = processedValue;
469
470
  }
@@ -498,7 +499,12 @@ function processStructure(structure, context, viewportWidth, instanceChildren, p
498
499
  const processedValue = processStructure(value, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);
499
500
  if (processedValue !== null && processedValue !== void 0) {
500
501
  if (typeof processedValue === "object" && processedValue !== null && "href" in processedValue) {
501
- const linkObj = processedValue;
502
+ let linkObj = processedValue;
503
+ while (typeof linkObj.href === "object" && linkObj.href !== null && "href" in linkObj.href) {
504
+ const nested = linkObj.href;
505
+ if (!linkObj.target && nested.target) linkObj = { ...linkObj, target: nested.target };
506
+ linkObj = { ...linkObj, href: nested.href };
507
+ }
502
508
  processed.href = linkObj.href;
503
509
  if (linkObj.target) {
504
510
  processed.attributes = {
@@ -598,4 +604,4 @@ export {
598
604
  extractAttributesFromNode,
599
605
  skipEmptyTemplateAttributes
600
606
  };
601
- //# sourceMappingURL=chunk-VNAPFF4I.js.map
607
+ //# sourceMappingURL=chunk-AIXKUVNG.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../lib/client/templateEngine.ts", "../../lib/shared/styleNodeUtils.ts", "../../lib/shared/attributeNodeUtils.ts"],
4
- "sourcesContent": ["/**\n * Template Engine\n * Handles template evaluation with {{expression}} syntax and style mappings\n *\n * Security: Uses jsep for safe expression parsing instead of eval/new Function()\n */\n\nimport type { StyleMapping, HtmlMapping, ComponentDefinition, StructuredComponentDefinition, ComponentNode, HtmlNode, ComponentInstanceNode, EmbedNode, StyleObject, ResponsiveStyleObject, StyleValue, TemplateContext } from '../shared/types';\nimport { isResponsiveStyle } from '../shared/styleUtils';\nimport { normalizeStyle as normalizeStyleShared, mergeResponsiveStyles } from '../shared/responsiveStyleUtils';\nimport { DEFAULT_BREAKPOINTS } from '../shared/breakpoints';\nimport { NODE_TYPE } from '../shared/constants';\nimport { isValidNodeType, isComponentNode, isHtmlNode, isSlotMarker, isEmbedNode, isLocaleListNode, isLinkNode, isCMSListNode, isListNode } from '../shared/nodeUtils';\nimport { applyStylesToNode } from '../shared/styleNodeUtils';\nimport { isRichTextMarker, richTextMarkerToHtml } from '../shared/propResolver';\nimport { isTiptapDocument, tiptapToHtml } from '../shared/richtext';\nimport { hasItemTemplates } from '../shared/itemTemplateUtils';\nimport { safeEvaluate } from '../shared/expressionEvaluator';\nimport { RAW_HTML_PREFIX } from '../shared/constants';\nimport { getGlobalTemplateContext } from '../shared/globalTemplateContext';\n\n// Re-export for backward compatibility\nexport { isResponsiveStyle };\n\n/**\n * Normalize a style value - if it's responsive, merge it; if it's flat, return as-is\n * Uses 'all' strategy for editor compatibility (merges all breakpoints)\n */\nexport function normalizeStyle(style: StyleValue | null | undefined): StyleObject | null {\n return normalizeStyleShared(style, 'all');\n}\n\n/**\n * Helper to add a processed item to an array, handling both single items and arrays\n * Converts numbers to strings to match ComponentNode['children'] type\n */\nfunction addProcessedItemToArray(\n item: ComponentNode | (ComponentNode | string)[] | string | number | null,\n array: Array<ComponentNode | string>\n): void {\n if (item === null) return;\n\n if (Array.isArray(item)) {\n array.push(...item);\n } else if (typeof item === 'number') {\n // Convert numbers to strings to match ComponentNode['children'] type\n array.push(String(item));\n } else {\n array.push(item as ComponentNode | string);\n }\n}\n\n/**\n * Link mapping interface for link nodes\n */\nexport interface LinkMapping {\n _mapping: true;\n prop: string;\n values?: Record<string, { href: string; target?: string }>;\n}\n\n/**\n * Type guard for link mappings\n */\nexport function isLinkMapping(value: unknown): value is LinkMapping {\n if (!value || typeof value !== 'object') return false;\n const obj = value as Record<string, unknown>;\n // values is optional - when empty/missing, acts as passthrough for link-type props\n return obj._mapping === true && typeof obj.prop === 'string' && (obj.values === undefined || typeof obj.values === 'object');\n}\n\n/**\n * Resolves a link mapping object to its actual value based on current props\n *\n * Supports two modes:\n * 1. Value mapping: Maps a prop value to a predefined link object\n * { _mapping: true, prop: \"variant\", values: { primary: { href: \"/products\" } } }\n *\n * 2. Passthrough: When values is empty/missing, uses the prop directly if it's a link object\n * { _mapping: true, prop: \"link\" } - uses props.link directly\n *\n * @example\n * // Value mapping\n * resolveLinkMapping(\n * { _mapping: true, prop: \"variant\", values: { primary: { href: \"/products\" } } },\n * { variant: \"primary\" }\n * ) // { href: \"/products\" }\n *\n * @example\n * // Passthrough mode\n * resolveLinkMapping(\n * { _mapping: true, prop: \"link\" },\n * { link: { href: \"/about\", target: \"_blank\" } }\n * ) // { href: \"/about\", target: \"_blank\" }\n */\nexport function resolveLinkMapping(\n mappingObj: unknown,\n props: Record<string, unknown> | undefined\n): { href: string; target?: string } | undefined {\n if (!isLinkMapping(mappingObj)) {\n return undefined;\n }\n\n // Guard against undefined props\n if (!props) {\n return undefined;\n }\n\n const { prop, values } = mappingObj;\n const propValue = props[prop];\n if (propValue === undefined || propValue === null) {\n return undefined;\n }\n\n // Passthrough mode: if prop value is already a link object, use it directly\n if (typeof propValue === 'object' && propValue !== null && 'href' in propValue) {\n return propValue as { href: string; target?: string };\n }\n\n // Value mapping mode: look up the prop value in the values map\n if (values) {\n const mappedValue = values[String(propValue)];\n return mappedValue;\n }\n\n return undefined;\n}\n\n/**\n * Type guard for HTML mappings (embed node html property)\n */\nexport function isHtmlMapping(value: unknown): value is HtmlMapping {\n if (!value || typeof value !== 'object') return false;\n const obj = value as Record<string, unknown>;\n return obj._mapping === true && typeof obj.prop === 'string';\n}\n\n/**\n * Resolves an HTML mapping object to its actual value based on current props\n *\n * Supports two modes:\n * 1. Value mapping: Maps a prop value to a predefined HTML string\n * { _mapping: true, prop: \"icon\", values: { arrow: \"<svg>...</svg>\", check: \"<svg>...</svg>\" } }\n *\n * 2. Passthrough: When values is omitted/empty, uses the prop directly if it's a string\n * { _mapping: true, prop: \"svgContent\" } - uses props.svgContent directly\n */\nexport function resolveHtmlMapping(\n mappingObj: unknown,\n props: Record<string, unknown> | undefined\n): string | undefined {\n if (!isHtmlMapping(mappingObj)) {\n return undefined;\n }\n\n if (!props) {\n return undefined;\n }\n\n const { prop, values } = mappingObj;\n const propValue = props[prop];\n if (propValue === undefined || propValue === null) {\n return undefined;\n }\n\n // Value mapping mode: look up the prop value in the values map\n if (values && Object.keys(values).length > 0) {\n return values[String(propValue)];\n }\n\n // Passthrough mode: use the prop value directly if it's a string\n if (typeof propValue === 'string') {\n return propValue;\n }\n\n return undefined;\n}\n\n/**\n * Resolves a style mapping object to its actual value based on current props\n *\n * @example\n * resolveStyleMapping(\n * { _mapping: true, prop: \"variant\", values: { primary: \"#0070f3\", secondary: \"#f3f4f6\" } },\n * { variant: \"primary\" }\n * ) // \"#0070f3\"\n */\nexport function resolveStyleMapping(\n mappingObj: unknown,\n props: Record<string, unknown> | undefined\n): string | number | undefined {\n if (!mappingObj || typeof mappingObj !== 'object') {\n return undefined;\n }\n\n const mapping = mappingObj as StyleMapping;\n if (!mapping || !mapping._mapping) {\n return undefined;\n }\n\n const { prop, values } = mapping;\n if (!prop || !values || typeof values !== 'object') {\n return undefined;\n }\n\n // Guard against undefined props\n if (!props) {\n return undefined;\n }\n\n const propValue = props[prop];\n if (propValue === undefined || propValue === null) {\n return undefined;\n }\n\n const mappedValue = values[String(propValue)];\n return mappedValue !== undefined ? mappedValue : undefined;\n}\n\n/**\n * Process a single style value - resolves mappings and evaluates templates.\n * Skips item templates ({{item.field}}, {{varName.field}}) which are resolved later during rendering.\n *\n * @param styleValue - The style value to process (may be string, number, or mapping object)\n * @param props - Component props for resolving mappings and templates\n * @returns The processed style value, or undefined if the value should be skipped\n */\nfunction processStyleValue(\n styleValue: unknown,\n props: Record<string, unknown> | undefined\n): string | number | undefined {\n // First try style mapping resolution\n const resolved = resolveStyleMapping(styleValue, props);\n if (resolved !== undefined) {\n return resolved;\n }\n\n // String values - evaluate templates (but skip item templates)\n if (typeof styleValue === 'string') {\n if (hasTemplates(styleValue) && !hasItemTemplates(styleValue)) {\n return processCodeTemplates(styleValue, props);\n }\n return styleValue;\n }\n\n // Number values - pass through\n if (typeof styleValue === 'number') {\n return styleValue;\n }\n\n return undefined;\n}\n\n/**\n * Build evaluation context for template processing.\n * Merges global context, props, componentDef, and optionally itemContext.\n *\n * @param context - The TemplateContext containing props and componentDef\n * @param includeItemContext - Whether to include itemContext from the context object\n * @returns A flat object suitable for template evaluation\n */\nfunction buildEvalContext(\n context: TemplateContext,\n includeItemContext: boolean = false\n): Record<string, unknown> {\n const evalContext: Record<string, unknown> = {\n ...getGlobalTemplateContext(),\n ...context.props\n };\n\n if (context.componentDef && typeof context.componentDef === 'object') {\n Object.assign(evalContext, context.componentDef as Record<string, unknown>);\n }\n\n if (includeItemContext) {\n const itemContext = (context as Record<string, unknown>).itemContext as Record<string, unknown> | undefined;\n if (itemContext) {\n Object.assign(evalContext, itemContext);\n }\n }\n\n return evalContext;\n}\n\n/** Maximum allowed expression length to prevent DoS via complex expressions */\nconst MAX_EXPRESSION_LENGTH = 500;\n\n/** Maximum recursion depth to prevent stack overflow from circular references */\nconst MAX_RECURSION_DEPTH = 100;\n\n/**\n * Evaluates a template string with the given context\n * Template format: {{expression}}\n * Handles undefined variables gracefully by returning undefined instead of throwing\n *\n * Security: Uses jsep for safe expression parsing - only whitelisted AST nodes are evaluated.\n * No eval/new Function is used, preventing arbitrary code execution.\n *\n * @example\n * evaluateTemplate(\"{{name}}\", { name: \"John\" }) // \"John\"\n * evaluateTemplate(\"{{count + 1}}\", { count: 5 }) // 6\n * evaluateTemplate(\"{{undefinedVar}}\", {}) // undefined (no error thrown)\n */\nexport function evaluateTemplate(\n template: string,\n context: Record<string, unknown>\n): unknown {\n if (typeof template !== 'string') return template;\n\n const templateMatch = template.match(/^\\{\\{(.+)\\}\\}$/);\n if (!templateMatch) return template;\n\n const expression = templateMatch[1].trim();\n\n // Security: Expression length limit to prevent DoS\n if (expression.length > MAX_EXPRESSION_LENGTH) {\n console.warn('Template expression too long:', expression.slice(0, 50) + '...');\n return template;\n }\n\n try {\n // Use safe expression evaluator (jsep-based, no eval/new Function)\n const result = safeEvaluate(expression, context);\n // If result is undefined, return template string for backward compatibility\n return result === undefined ? template : result;\n } catch (error) {\n console.error('Template evaluation error:', error, 'Expression:', expression, 'Context:', context);\n // Return original template string on error for backward compatibility\n return template;\n }\n}\n\n/**\n * Checks if a code string contains any template patterns {{...}}\n */\nexport function hasTemplates(code: string): boolean {\n if (typeof code !== 'string') return false;\n return /\\{\\{[^}]+\\}\\}/.test(code);\n}\n\n/**\n * Processes template strings in JavaScript or CSS code\n * Replaces {{propName}} or {{expression}} with evaluated values\n * \n * @example\n * processCodeTemplates(\"console.log('{{name}}');\", { name: \"John\" })\n * // \"console.log('John');\"\n * \n * processCodeTemplates(\".card { color: {{color}}; }\", { color: \"#ff0000\" })\n * // \".card { color: #ff0000; }\"\n */\nexport function processCodeTemplates(\n code: string,\n context: Record<string, unknown> | undefined\n): string {\n if (typeof code !== 'string') return code;\n\n // Guard against undefined context\n if (!context) {\n return code;\n }\n\n // Match all {{...}} patterns in the code\n return code.replace(/\\{\\{([^}]+)\\}\\}/g, (match: string, expression: string): string => {\n const trimmedExpr = expression.trim();\n\n // Security: Expression length limit to prevent DoS\n if (trimmedExpr.length > MAX_EXPRESSION_LENGTH) {\n console.warn('Code template expression too long:', trimmedExpr.slice(0, 50) + '...');\n return match;\n }\n\n try {\n // Use safe expression evaluator (jsep-based, no eval/new Function)\n const result = safeEvaluate(trimmedExpr, context);\n\n // Convert result to string, handling various types\n if (result === null || result === undefined) {\n return '';\n }\n if (typeof result === 'string') {\n return result;\n }\n if (typeof result === 'number' || typeof result === 'boolean') {\n return String(result);\n }\n // Handle rich-text markers - extract HTML content for interpolation\n if (isRichTextMarker(result)) {\n return richTextMarkerToHtml(result);\n }\n // For objects/arrays, stringify them\n return JSON.stringify(result);\n } catch (error) {\n console.error('Code template evaluation error:', error, 'Expression:', trimmedExpr, 'Context:', context);\n // Return original template if evaluation fails\n return match;\n }\n });\n}\n\n/**\n * Processes a component structure recursively, evaluating templates\n * @param context - Template context containing props, componentDef, and extensible namespaces (e.g., cms, page)\n * @param viewportWidth - Optional viewport width for responsive style resolution. If provided, uses 'viewport' strategy; otherwise uses 'all' strategy.\n * @param instanceChildren - Optional children from component instance to replace { type: \"children\" } markers\n * @param preserveResponsiveStyles - Whether to preserve responsive style objects (for SSR)\n * @param depth - Internal recursion depth counter to prevent stack overflow\n */\nexport function processStructure(\n structure: ComponentNode | ComponentNode[] | string | number | null | undefined,\n context: TemplateContext,\n viewportWidth?: number,\n instanceChildren?: ComponentNode['children'],\n preserveResponsiveStyles: boolean = false,\n depth: number = 0\n): ComponentNode | (ComponentNode | string)[] | string | number | null {\n try {\n // Guard against excessive recursion (circular references or very deep structures)\n if (depth > MAX_RECURSION_DEPTH) {\n console.warn(`processStructure: Maximum recursion depth (${MAX_RECURSION_DEPTH}) exceeded. Possible circular reference.`);\n return null;\n }\n\n // Handle null/undefined\n if (structure === null || structure === undefined) return null;\n\n // Preserve boolean values (don't convert false to null)\n if (typeof structure === 'boolean') {\n return structure as any;\n }\n\n if (typeof structure === 'string') {\n // Build evaluation context with item context for nested template resolution\n const evalContext = buildEvalContext(context, true);\n\n // Check if entire string is a complete template {{expr}}\n // Use evaluateTemplate to preserve type (objects, arrays, numbers)\n if (/^\\{\\{.+\\}\\}$/.test(structure) && !hasItemTemplates(structure)) {\n const result = evaluateTemplate(structure, evalContext);\n // Check for rich-text marker - extract HTML content with RAW_HTML_PREFIX\n // The prefix signals to ComponentBuilder.processTextNode to render as HTML\n if (isRichTextMarker(result)) {\n return RAW_HTML_PREFIX + richTextMarkerToHtml(result);\n }\n if (typeof result === 'string' || typeof result === 'number') {\n return result;\n }\n if (result === undefined || result === null) {\n return '';\n }\n // Return objects as-is (e.g., link objects { href, target })\n // The caller (e.g., href handling) will process them appropriately\n if (typeof result === 'object') {\n return result as any;\n }\n return String(result);\n }\n\n // Check if string contains partial templates like \"heading-{{size}}\"\n // Use processCodeTemplates for string interpolation\n // BUT skip if it contains CMS item templates ({{item.field}}, {{varName.field}}, etc.)\n // Those will be processed later by processItemTemplate with proper context\n if (hasTemplates(structure) && !hasItemTemplates(structure)) {\n return processCodeTemplates(structure, evalContext);\n }\n\n // No templates - return as-is\n return structure;\n }\n \n if (Array.isArray(structure)) {\n const processed: Array<ComponentNode | string> = [];\n for (const item of structure) {\n // Check if this is a slot marker\n if (isSlotMarker(item)) {\n // Replace marker with instance children (if provided)\n if (instanceChildren) {\n const childrenArray = Array.isArray(instanceChildren) ? instanceChildren : [instanceChildren];\n for (const child of childrenArray) {\n const processedChild = processStructure(child, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n addProcessedItemToArray(processedChild, processed);\n }\n } else if ('default' in item && (item as any).default !== undefined) {\n // Fallback: use slot's default content if no instance children provided\n const defaultContent = (item as any).default;\n const defaultsArray = Array.isArray(defaultContent) ? defaultContent : [defaultContent];\n for (const defaultChild of defaultsArray) {\n const processedChild = processStructure(defaultChild, context, viewportWidth, undefined, preserveResponsiveStyles, depth + 1);\n addProcessedItemToArray(processedChild, processed);\n }\n }\n // If no instance children AND no default, marker renders nothing (skip it)\n } else {\n // Regular item - process normally\n const processedItem = processStructure(item, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n addProcessedItemToArray(processedItem, processed);\n }\n }\n return processed;\n }\n \n if (typeof structure === 'object' && !Array.isArray(structure) && structure !== null) {\n // Check if this is a slot marker (shouldn't happen here since we handle it in array processing, but guard anyway)\n if (isSlotMarker(structure)) {\n // This shouldn't happen in object processing, but if it does, return instance children or default\n if (instanceChildren) {\n const processed: Array<ComponentNode | string> = [];\n const childrenArray = Array.isArray(instanceChildren) ? instanceChildren : [instanceChildren];\n for (const child of childrenArray) {\n const processedChild = processStructure(child, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n addProcessedItemToArray(processedChild, processed);\n }\n return processed.length === 1 ? processed[0] : processed;\n }\n // Fallback: use slot's default content\n if ('default' in structure && (structure as any).default !== undefined) {\n const defaultContent = (structure as any).default;\n const processed: Array<ComponentNode | string> = [];\n const defaultsArray = Array.isArray(defaultContent) ? defaultContent : [defaultContent];\n for (const defaultChild of defaultsArray) {\n const processedChild = processStructure(defaultChild, context, viewportWidth, undefined, preserveResponsiveStyles, depth + 1);\n addProcessedItemToArray(processedChild, processed);\n }\n return processed.length === 1 ? processed[0] : processed;\n }\n return null;\n }\n \n // Check if this is a valid node structure or a plain object (like props)\n const inputNode = structure as ComponentNode;\n const hasValidNodeType = inputNode.type && isValidNodeType(inputNode.type);\n\n // If no valid node type, treat as plain object and process values recursively\n // This handles props objects like { text: \"{{text}}\", isMarginBottom: false }\n if (!hasValidNodeType) {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(structure)) {\n const processedValue = processStructure(value as any, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n if (processedValue !== null && processedValue !== undefined) {\n result[key] = processedValue;\n }\n }\n return result as any;\n }\n\n const preservedType = inputNode.type;\n\n // Create base processed object based on type\n let processed: ComponentNode;\n if (preservedType === NODE_TYPE.COMPONENT) {\n processed = {\n type: NODE_TYPE.COMPONENT,\n component: '',\n props: {},\n children: [] as Array<ComponentNode | string>\n } as ComponentInstanceNode;\n } else if (preservedType === NODE_TYPE.EMBED) {\n // Handle embed nodes - they have html content, not children\n processed = {\n type: NODE_TYPE.EMBED,\n html: '',\n } as any;\n } else if (preservedType === NODE_TYPE.LINK) {\n // Handle link nodes - they have href property\n processed = {\n type: NODE_TYPE.LINK,\n href: '',\n children: [] as Array<ComponentNode | string>\n } as any;\n } else if (preservedType === NODE_TYPE.LOCALE_LIST) {\n // Handle locale-list nodes - they have style, itemStyle, activeItemStyle properties\n processed = {\n type: NODE_TYPE.LOCALE_LIST,\n } as any;\n } else if (preservedType === NODE_TYPE.LIST || (preservedType as string) === 'cms-list') {\n // Handle list nodes (unified - handles both prop and collection source types)\n // Also supports legacy 'cms-list' type for migration\n processed = {\n type: NODE_TYPE.LIST,\n source: '',\n children: [] as Array<ComponentNode | string>\n } as any;\n } else {\n processed = {\n type: NODE_TYPE.NODE,\n tag: 'div',\n children: [] as Array<ComponentNode | string>\n } as HtmlNode;\n }\n \n // First pass: process all keys and resolve style mappings\n let resolvedStyle: StyleValue | null = null;\n \n for (const [key, value] of Object.entries(structure)) {\n try {\n if (key === 'children') {\n const processedChildren = processStructure(value as ComponentNode | ComponentNode[] | string | number | null | undefined, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n if (Array.isArray(processedChildren)) {\n processed.children = processedChildren;\n } else if (processedChildren !== null && processedChildren !== undefined) {\n processed.children = [processedChildren as ComponentNode | string];\n }\n } else if (key === 'tag') {\n // Handle tag for HTML nodes and list nodes\n if (isHtmlNode(processed) || isListNode(processed)) {\n if (typeof value === 'string') {\n // Process template in tag (e.g., \"h{{size}}\" -> \"h1\")\n const evalContext = buildEvalContext(context, false);\n // Use processCodeTemplates to handle partial templates like \"h{{size}}\"\n (processed as any).tag = processCodeTemplates(value, evalContext);\n } else if (value === false) {\n // Preserve boolean false for fragment mode (no container)\n (processed as any).tag = false;\n } else {\n (processed as any).tag = String(value);\n }\n }\n } else if (key === 'component') {\n if (isComponentNode(processed)) {\n if (typeof value === 'string') {\n processed.component = value;\n } else {\n processed.component = String(value);\n }\n }\n } else if (key === 'html') {\n // Handle html property for embed nodes - process templates like {{propName}}\n if (preservedType === NODE_TYPE.EMBED) {\n if (isHtmlMapping(value)) {\n // Resolve HTML mapping to actual content\n const resolved = resolveHtmlMapping(value, context.props);\n (processed as any).html = resolved ?? '';\n } else if (typeof value === 'string') {\n // Build evaluation context with item context for nested template resolution\n const evalContext = buildEvalContext(context, true);\n // Check if entire string is a complete template {{expr}}\n if (/^\\{\\{.+\\}\\}$/.test(value) && !hasItemTemplates(value)) {\n const result = evaluateTemplate(value, evalContext);\n (processed as any).html = result === undefined || result === null ? '' : String(result);\n } else if (hasTemplates(value) && !hasItemTemplates(value)) {\n // Use processCodeTemplates to handle partial templates\n (processed as any).html = processCodeTemplates(value, evalContext);\n } else {\n (processed as any).html = value;\n }\n } else if (typeof value === 'object' && value !== null && (value as any)._mapping === true) {\n // HtmlMapping object that isHtmlMapping somehow missed \u2014 resolve it defensively\n const resolved = resolveHtmlMapping(value, context.props);\n (processed as any).html = resolved ?? '';\n } else {\n (processed as any).html = '';\n }\n }\n } else if (key === 'type') {\n // Preserve type field if valid - but don't change the structure type\n if (typeof value === 'string' && isValidNodeType(value)) {\n // Only update if type actually changed\n if (value === NODE_TYPE.COMPONENT && !isComponentNode(processed)) {\n // Convert to component node\n const newProcessed: ComponentInstanceNode = {\n type: NODE_TYPE.COMPONENT,\n component: '',\n props: (processed as any).props || {},\n children: (processed as any).children as ComponentInstanceNode['children'],\n style: (processed as any).style as ComponentInstanceNode['style']\n };\n processed = newProcessed;\n } else if (value === NODE_TYPE.NODE && !isHtmlNode(processed)) {\n // Convert to HTML node\n const newProcessed: HtmlNode = {\n type: NODE_TYPE.NODE,\n tag: (processed as any).component || 'div',\n children: (processed as any).children as HtmlNode['children'],\n style: (processed as any).style as HtmlNode['style']\n };\n processed = newProcessed;\n }\n }\n } else if (key === 'style' && typeof value === 'object' && value !== null) {\n // Process style at top level - DO NOT recursively call processStructure\n // as it would mangle style mapping objects { _mapping: true, prop: \"size\", values: {...} }\n // into ComponentNode structures. Style objects need special handling.\n const processedStyle = value as Record<string, unknown>;\n if (processedStyle && typeof processedStyle === 'object' && !Array.isArray(processedStyle)) {\n // Check if it's a responsive style object\n if (isResponsiveStyle(processedStyle as StyleValue)) {\n // Preserve responsive styles (for both SSR and editor)\n // responsiveStylesToClasses will generate prefixed classes (t-, mob-)\n // CSS media queries will handle displaying the correct styles based on viewport\n const resolvedResponsive: ResponsiveStyleObject = {};\n for (const [bkeyName, bkeyValue] of Object.entries(processedStyle)) {\n if (typeof bkeyValue === 'object' && bkeyValue !== null) {\n resolvedResponsive[bkeyName] = {};\n for (const [styleKey, styleValue] of Object.entries(bkeyValue)) {\n const processedValue = processStyleValue(styleValue, context.props);\n if (processedValue !== undefined) {\n resolvedResponsive[bkeyName]![styleKey] = processedValue;\n }\n }\n }\n }\n resolvedStyle = resolvedResponsive;\n } else {\n // Legacy flat style object - resolve mappings and evaluate templates\n resolvedStyle = {};\n for (const [styleKey, styleValue] of Object.entries(processedStyle)) {\n const processedValue = processStyleValue(styleValue, context.props);\n if (processedValue !== undefined) {\n resolvedStyle[styleKey] = processedValue;\n }\n }\n }\n }\n } else if (key === 'props' && typeof value === 'object' && value !== null) {\n // Process non-style props (for instance props only)\n const processedProps = processStructure(value as ComponentNode | ComponentNode[] | string | number | null | undefined, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n // Merge non-style props (style is handled separately at top level)\n if (typeof processedProps === 'object' && !Array.isArray(processedProps) && processedProps !== null && processed.props) {\n const propsObj = processedProps as unknown as Record<string, unknown>;\n Object.assign(processed.props, propsObj);\n // Remove style from props since we handle it at top level\n if ((processed.props as Record<string, unknown>).style !== undefined) {\n delete (processed.props as Record<string, unknown>).style;\n }\n }\n } else if (key === 'hover') {\n // Skip hover for now - it's not a standard React prop\n // Could be implemented with onMouseEnter/onMouseLeave\n } else if (key === 'href' && preservedType === NODE_TYPE.LINK) {\n // Special handling for href in link nodes - resolve link mappings\n if (isLinkMapping(value)) {\n const resolved = resolveLinkMapping(value, context.props);\n if (resolved) {\n (processed as any).href = resolved.href;\n if (resolved.target) {\n (processed as any).attributes = {\n ...((processed as any).attributes || {}),\n target: resolved.target\n };\n }\n } else {\n (processed as any).href = '#';\n }\n } else {\n // Regular href value - process as template\n const processedValue = processStructure(value as ComponentNode | ComponentNode[] | string | number | null | undefined, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n if (processedValue !== null && processedValue !== undefined) {\n // Check if result is a link object (from link-type prop like {{link}})\n if (typeof processedValue === 'object' && processedValue !== null && 'href' in processedValue) {\n const linkObj = processedValue as { href: string; target?: string };\n (processed as any).href = linkObj.href;\n if (linkObj.target) {\n (processed as any).attributes = {\n ...((processed as any).attributes || {}),\n target: linkObj.target\n };\n }\n } else {\n (processed as any).href = processedValue;\n }\n }\n }\n } else if (key === 'attributes' && typeof value === 'object' && value !== null) {\n // Special handling for attributes - process templates but don't treat as node structure\n // This preserves type=\"checkbox\" etc. which would otherwise be caught by node type handling\n const processedAttributes: Record<string, unknown> = {};\n const evalContext = buildEvalContext(context, false);\n for (const [attrKey, attrValue] of Object.entries(value)) {\n if (typeof attrValue === 'string' && hasTemplates(attrValue)) {\n // Check if entire string is a complete template {{expr}} - preserve type (boolean, number)\n if (/^\\{\\{.+\\}\\}$/.test(attrValue)) {\n const result = evaluateTemplate(attrValue, evalContext);\n // Skip attribute if complete template resolved to empty string\n if (result === '') continue;\n // Keep the original type (boolean, number, string)\n processedAttributes[attrKey] = result === attrValue ? attrValue : result;\n } else {\n // Partial template like \"prefix-{{value}}\" - always string\n processedAttributes[attrKey] = processCodeTemplates(attrValue, evalContext);\n }\n } else {\n processedAttributes[attrKey] = attrValue;\n }\n }\n (processed as unknown as Record<string, unknown>).attributes = processedAttributes;\n } else if (key === 'interactiveStyles' && Array.isArray(value)) {\n // Special handling for interactiveStyles - preserve as-is without mangling\n // Interactive styles contain StyleMapping objects that shouldn't be converted to nodes\n (processed as unknown as Record<string, unknown>).interactiveStyles = value;\n } else if (key !== 'type' && key !== 'children' && key !== 'style' && key !== 'props') {\n const processedValue = processStructure(value as ComponentNode | ComponentNode[] | string | number | null | undefined, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n // Only assign if it's a valid value\n if (processedValue !== null && processedValue !== undefined) {\n // Store extra properties on the node object\n (processed as unknown as Record<string, unknown>)[key] = processedValue;\n }\n }\n } catch (error) {\n console.error(`Error processing key \"${key}\":`, error);\n // Continue processing other keys\n }\n }\n \n // Apply resolved styles to the processed node based on its type\n // Both SSR and Editor now preserve responsive styles for proper utility class generation\n if (resolvedStyle && Object.keys(resolvedStyle).length > 0) {\n if (isResponsiveStyle(resolvedStyle)) {\n // Apply responsive styles directly to node.style or props.style\n if (isComponentNode(processed)) {\n processed.props = processed.props || {};\n processed.props.style = resolvedStyle as ResponsiveStyleObject;\n } else if (isHtmlNode(processed) || isEmbedNode(processed) || isLocaleListNode(processed) || isLinkNode(processed) || isListNode(processed)) {\n processed.style = resolvedStyle as ResponsiveStyleObject;\n }\n } else {\n // Legacy flat style object\n applyStylesToNode(processed, resolvedStyle);\n }\n }\n \n return processed;\n }\n \n return structure;\n } catch (error) {\n console.error('Error in processStructure:', error);\n throw error; // Re-throw so it can be caught by error boundary\n }\n}\n\n", "/**\n * Utilities for working with styles in ComponentNode structures\n * Provides helper functions for applying and merging styles based on node type\n */\n\nimport type { ComponentNode, HtmlNode, ComponentInstanceNode, StyleValue, ResponsiveStyleObject } from './types';\nimport { isComponentNode, isHtmlNode, isEmbedNode, isListNode } from './nodeUtils';\nimport { isResponsiveStyle } from './styleUtils';\n\n/**\n * Apply styles to a ComponentNode based on its type\n * - HTML nodes: styles go at top level (node.style)\n * - Component instances: styles go in props.style\n */\nexport function applyStylesToNode(\n node: ComponentNode,\n styles: StyleValue | Record<string, string | number> | null | undefined,\n viewportWidth?: number\n): ComponentNode {\n if (!styles) return node;\n\n if (isComponentNode(node)) {\n // Component instance: put styles in props.style\n if (!node.props) {\n node.props = {};\n }\n\n node.props.style = { ...(node.props.style || {}), ...styles };\n } else if (isHtmlNode(node) || isEmbedNode(node) || isListNode(node)) {\n // HTML node, Embed node, and List node: put styles at top level\n node.style = styles as StyleValue;\n }\n\n return node;\n}\n\n/**\n * Merge instance styles with structure styles for a ComponentNode\n * Instance styles override structure styles\n */\nexport function mergeNodeStyles(\n node: ComponentNode,\n instanceStyles: StyleValue | Record<string, string | number> | null | undefined,\n viewportWidth?: number\n): ComponentNode {\n if (!instanceStyles) return node;\n\n if (isHtmlNode(node) || isEmbedNode(node) || isListNode(node)) {\n // For HTML nodes, Embed nodes, and List nodes: merge instance styles with existing top-level styles\n const existingStyle = node.style;\n if (existingStyle && typeof existingStyle === 'object') {\n node.style = {\n ...(existingStyle as Record<string, any>),\n ...(instanceStyles as Record<string, any>)\n } as StyleValue;\n } else {\n node.style = instanceStyles as StyleValue;\n }\n } else if (isComponentNode(node)) {\n // For component instances: merge into props.style\n if (!node.props) {\n node.props = {};\n }\n const existingStyle = node.props.style;\n if (existingStyle && typeof existingStyle === 'object') {\n node.props.style = {\n ...(existingStyle as Record<string, any>),\n ...(instanceStyles as Record<string, any>)\n };\n } else {\n node.props.style = instanceStyles;\n }\n }\n\n return node;\n}\n\n/**\n * Extract styles from a ComponentNode based on its type\n * Returns a flat style object ready for React props\n */\nexport function extractStylesFromNode(\n node: ComponentNode,\n viewportWidth?: number\n): Record<string, string | number> {\n if (isComponentNode(node)) {\n // Component instance: styles are in props.style\n const style = node.props?.style;\n if (!style) return {};\n\n return style as Record<string, string | number>;\n } else if (isHtmlNode(node) || isEmbedNode(node)) {\n // HTML node and Embed node: styles are at top level\n const style = node.style;\n if (!style) return {};\n\n return style as Record<string, string | number>;\n }\n\n return {};\n}\n\n", "/**\n * Utilities for working with attributes in ComponentNode structures\n * Provides helper functions for extracting and applying attributes based on node type\n */\n\nimport type { ComponentNode } from './types';\nimport { isComponentNode, isHtmlNode } from './nodeUtils';\n\n/**\n * Extract attributes from a ComponentNode\n * Attributes are stored at the top level of the node (like styles)\n * Returns a record of attributes ready for React props\n */\nexport function extractAttributesFromNode(\n node: ComponentNode\n): Record<string, string | number | boolean> {\n if (!node || typeof node !== 'object') {\n return {};\n }\n\n // Attributes are stored at top level for both HTML nodes and component instances\n if ('attributes' in node && node.attributes) {\n return node.attributes as Record<string, string | number | boolean>;\n }\n\n return {};\n}\n\n/**\n * Remove attributes that were entirely template expressions (e.g., \"{{fade}}\")\n * and resolved to empty string \"\". Static attributes and partial templates are unchanged.\n */\nexport function skipEmptyTemplateAttributes(\n original: Record<string, unknown>,\n resolved: Record<string, unknown>\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(resolved)) {\n const orig = original[key];\n if (\n typeof orig === 'string' &&\n /^\\{\\{.+\\}\\}$/.test(orig) &&\n value === ''\n ) {\n continue;\n }\n result[key] = value;\n }\n return result;\n}\n\n/**\n * Apply attributes to a ComponentNode\n * Attributes go at top level (node.attributes)\n */\nexport function applyAttributesToNode(\n node: ComponentNode,\n attributes: Record<string, string | number | boolean> | null | undefined\n): ComponentNode {\n if (!attributes || Object.keys(attributes).length === 0) {\n return node;\n }\n\n if (isComponentNode(node) || isHtmlNode(node)) {\n return {\n ...node,\n attributes: { ...(node.attributes || {}), ...attributes }\n };\n }\n\n return node;\n}\n\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAWA;;;ACGO,SAAS,kBACd,MACA,QACA,eACe;AACf,MAAI,CAAC,OAAQ,QAAO;AAEpB,MAAI,gBAAgB,IAAI,GAAG;AAEzB,QAAI,CAAC,KAAK,OAAO;AACf,WAAK,QAAQ,CAAC;AAAA,IAChB;AAEA,SAAK,MAAM,QAAQ,EAAE,GAAI,KAAK,MAAM,SAAS,CAAC,GAAI,GAAG,OAAO;AAAA,EAC9D,WAAW,WAAW,IAAI,KAAK,YAAY,IAAI,KAAK,WAAW,IAAI,GAAG;AAEpE,SAAK,QAAQ;AAAA,EACf;AAEA,SAAO;AACT;AAMO,SAAS,gBACd,MACA,gBACA,eACe;AACf,MAAI,CAAC,eAAgB,QAAO;AAE5B,MAAI,WAAW,IAAI,KAAK,YAAY,IAAI,KAAK,WAAW,IAAI,GAAG;AAE7D,UAAM,gBAAgB,KAAK;AAC3B,QAAI,iBAAiB,OAAO,kBAAkB,UAAU;AACtD,WAAK,QAAQ;AAAA,QACX,GAAI;AAAA,QACJ,GAAI;AAAA,MACN;AAAA,IACF,OAAO;AACL,WAAK,QAAQ;AAAA,IACf;AAAA,EACF,WAAW,gBAAgB,IAAI,GAAG;AAEhC,QAAI,CAAC,KAAK,OAAO;AACf,WAAK,QAAQ,CAAC;AAAA,IAChB;AACA,UAAM,gBAA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Aa,GAAG;AAEpC,cAAI,gBAAgB,SAAS,GAAG;AAC9B,sBAAU,QAAQ,UAAU,SAAS,CAAC;AACtC,sBAAU,MAAM,QAAQ;AAAA,UAC1B,WAAW,WAAW,SAAS,KAAK,YAAY,SAAS,KAAK,iBAAiB,SAAS,KAAK,WAAW,SAAS,KAAK,WAAW,SAAS,GAAG;AAC3I,sBAAU,QAAQ;AAAA,UACpB;AAAA,QACF,OAAO;AAEL,4BAAkB,WAAW,aAAa;AAAA,QAC5C;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,8BAA8B,KAAK;AACjD,UAAM;AAAA,EACR;AACF;;;AE/yBO,SAAS,0BACd,MAC2C;AAC3C,MAAI,CAAC,QAAQ,OAAO,SAAS,UAAU;AACrC,WAAO,CAAC;AAAA,EACV;AAGA,MAAI,gBAAgB,QAAQ,KAAK,YAAY;AAC3C,WAAO,KAAK;AAAA,EACd;AAEA,SAAO,CAAC;AACV;AAMO,SAAS,4BACd,UACA,UACyB;AACzB,QAAM,SAAkC,CAAC;AACzC,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,QAAQ,GAAG;AACnD,UAAM,OAAO,SAAS,GAAG;AACzB,QACE,OAAO,SAAS,YAChB,eAAe,KAAK,IAAI,KACxB,UAAU,IACV;AACA;AAAA,IACF;AACA,WAAO,GAAG,IAAI;AAAA,EAChB;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["/**\n * Template Engine\n * Handles template evaluation with {{expression}} syntax and style mappings\n *\n * Security: Uses jsep for safe expression parsing instead of eval/new Function()\n */\n\nimport type { StyleMapping, HtmlMapping, ComponentDefinition, StructuredComponentDefinition, ComponentNode, HtmlNode, ComponentInstanceNode, EmbedNode, StyleObject, ResponsiveStyleObject, StyleValue, TemplateContext } from '../shared/types';\nimport { isResponsiveStyle } from '../shared/styleUtils';\nimport { normalizeStyle as normalizeStyleShared, mergeResponsiveStyles } from '../shared/responsiveStyleUtils';\nimport { DEFAULT_BREAKPOINTS } from '../shared/breakpoints';\nimport { NODE_TYPE } from '../shared/constants';\nimport { isValidNodeType, isComponentNode, isHtmlNode, isSlotMarker, isEmbedNode, isLocaleListNode, isLinkNode, isCMSListNode, isListNode } from '../shared/nodeUtils';\nimport { applyStylesToNode } from '../shared/styleNodeUtils';\nimport { isRichTextMarker, richTextMarkerToHtml } from '../shared/propResolver';\nimport { isTiptapDocument, tiptapToHtml } from '../shared/richtext';\nimport { hasItemTemplates } from '../shared/itemTemplateUtils';\nimport { safeEvaluate } from '../shared/expressionEvaluator';\nimport { RAW_HTML_PREFIX } from '../shared/constants';\nimport { getGlobalTemplateContext } from '../shared/globalTemplateContext';\n\n// Re-export for backward compatibility\nexport { isResponsiveStyle };\n\n/**\n * Normalize a style value - if it's responsive, merge it; if it's flat, return as-is\n * Uses 'all' strategy for editor compatibility (merges all breakpoints)\n */\nexport function normalizeStyle(style: StyleValue | null | undefined): StyleObject | null {\n return normalizeStyleShared(style, 'all');\n}\n\n/**\n * Helper to add a processed item to an array, handling both single items and arrays\n * Converts numbers to strings to match ComponentNode['children'] type\n */\nfunction addProcessedItemToArray(\n item: ComponentNode | (ComponentNode | string)[] | string | number | null,\n array: Array<ComponentNode | string>\n): void {\n if (item === null) return;\n\n if (Array.isArray(item)) {\n array.push(...item);\n } else if (typeof item === 'number') {\n // Convert numbers to strings to match ComponentNode['children'] type\n array.push(String(item));\n } else {\n array.push(item as ComponentNode | string);\n }\n}\n\n/**\n * Link mapping interface for link nodes\n */\nexport interface LinkMapping {\n _mapping: true;\n prop: string;\n values?: Record<string, { href: string; target?: string }>;\n}\n\n/**\n * Type guard for link mappings\n */\nexport function isLinkMapping(value: unknown): value is LinkMapping {\n if (!value || typeof value !== 'object') return false;\n const obj = value as Record<string, unknown>;\n // values is optional - when empty/missing, acts as passthrough for link-type props\n return obj._mapping === true && typeof obj.prop === 'string' && (obj.values === undefined || typeof obj.values === 'object');\n}\n\n/**\n * Resolves a link mapping object to its actual value based on current props\n *\n * Supports two modes:\n * 1. Value mapping: Maps a prop value to a predefined link object\n * { _mapping: true, prop: \"variant\", values: { primary: { href: \"/products\" } } }\n *\n * 2. Passthrough: When values is empty/missing, uses the prop directly if it's a link object\n * { _mapping: true, prop: \"link\" } - uses props.link directly\n *\n * @example\n * // Value mapping\n * resolveLinkMapping(\n * { _mapping: true, prop: \"variant\", values: { primary: { href: \"/products\" } } },\n * { variant: \"primary\" }\n * ) // { href: \"/products\" }\n *\n * @example\n * // Passthrough mode\n * resolveLinkMapping(\n * { _mapping: true, prop: \"link\" },\n * { link: { href: \"/about\", target: \"_blank\" } }\n * ) // { href: \"/about\", target: \"_blank\" }\n */\nexport function resolveLinkMapping(\n mappingObj: unknown,\n props: Record<string, unknown> | undefined\n): { href: string; target?: string } | undefined {\n if (!isLinkMapping(mappingObj)) {\n return undefined;\n }\n\n // Guard against undefined props\n if (!props) {\n return undefined;\n }\n\n const { prop, values } = mappingObj;\n const propValue = props[prop];\n if (propValue === undefined || propValue === null) {\n return undefined;\n }\n\n // Passthrough mode: if prop value is already a link object, use it directly\n if (typeof propValue === 'object' && propValue !== null && 'href' in propValue) {\n return propValue as { href: string; target?: string };\n }\n\n // Value mapping mode: look up the prop value in the values map\n if (values) {\n const mappedValue = values[String(propValue)];\n return mappedValue;\n }\n\n return undefined;\n}\n\n/**\n * Type guard for HTML mappings (embed node html property)\n */\nexport function isHtmlMapping(value: unknown): value is HtmlMapping {\n if (!value || typeof value !== 'object') return false;\n const obj = value as Record<string, unknown>;\n return obj._mapping === true && typeof obj.prop === 'string';\n}\n\n/**\n * Resolves an HTML mapping object to its actual value based on current props\n *\n * Supports two modes:\n * 1. Value mapping: Maps a prop value to a predefined HTML string\n * { _mapping: true, prop: \"icon\", values: { arrow: \"<svg>...</svg>\", check: \"<svg>...</svg>\" } }\n *\n * 2. Passthrough: When values is omitted/empty, uses the prop directly if it's a string\n * { _mapping: true, prop: \"svgContent\" } - uses props.svgContent directly\n */\nexport function resolveHtmlMapping(\n mappingObj: unknown,\n props: Record<string, unknown> | undefined\n): string | undefined {\n if (!isHtmlMapping(mappingObj)) {\n return undefined;\n }\n\n if (!props) {\n return undefined;\n }\n\n const { prop, values } = mappingObj;\n const propValue = props[prop];\n if (propValue === undefined || propValue === null) {\n return undefined;\n }\n\n // Value mapping mode: look up the prop value in the values map\n if (values && Object.keys(values).length > 0) {\n return values[String(propValue)];\n }\n\n // Passthrough mode: use the prop value directly if it's a string\n if (typeof propValue === 'string') {\n return propValue;\n }\n\n return undefined;\n}\n\n/**\n * Resolves a style mapping object to its actual value based on current props\n *\n * @example\n * resolveStyleMapping(\n * { _mapping: true, prop: \"variant\", values: { primary: \"#0070f3\", secondary: \"#f3f4f6\" } },\n * { variant: \"primary\" }\n * ) // \"#0070f3\"\n */\nexport function resolveStyleMapping(\n mappingObj: unknown,\n props: Record<string, unknown> | undefined\n): string | number | undefined {\n if (!mappingObj || typeof mappingObj !== 'object') {\n return undefined;\n }\n\n const mapping = mappingObj as StyleMapping;\n if (!mapping || !mapping._mapping) {\n return undefined;\n }\n\n const { prop, values } = mapping;\n if (!prop || !values || typeof values !== 'object') {\n return undefined;\n }\n\n // Guard against undefined props\n if (!props) {\n return undefined;\n }\n\n const propValue = props[prop];\n if (propValue === undefined || propValue === null) {\n return undefined;\n }\n\n const mappedValue = values[String(propValue)];\n return mappedValue !== undefined ? mappedValue : undefined;\n}\n\n/**\n * Process a single style value - resolves mappings and evaluates templates.\n * Skips item templates ({{item.field}}, {{varName.field}}) which are resolved later during rendering.\n *\n * @param styleValue - The style value to process (may be string, number, or mapping object)\n * @param props - Component props for resolving mappings and templates\n * @returns The processed style value, or undefined if the value should be skipped\n */\nfunction processStyleValue(\n styleValue: unknown,\n props: Record<string, unknown> | undefined\n): string | number | undefined {\n // First try style mapping resolution\n const resolved = resolveStyleMapping(styleValue, props);\n if (resolved !== undefined) {\n return resolved;\n }\n\n // String values - evaluate templates (but skip item templates)\n if (typeof styleValue === 'string') {\n if (hasTemplates(styleValue) && !hasItemTemplates(styleValue)) {\n return processCodeTemplates(styleValue, props);\n }\n return styleValue;\n }\n\n // Number values - pass through\n if (typeof styleValue === 'number') {\n return styleValue;\n }\n\n return undefined;\n}\n\n/**\n * Build evaluation context for template processing.\n * Merges global context, props, componentDef, and optionally itemContext.\n *\n * @param context - The TemplateContext containing props and componentDef\n * @param includeItemContext - Whether to include itemContext from the context object\n * @returns A flat object suitable for template evaluation\n */\nfunction buildEvalContext(\n context: TemplateContext,\n includeItemContext: boolean = false\n): Record<string, unknown> {\n const evalContext: Record<string, unknown> = {\n ...getGlobalTemplateContext(),\n ...context.props\n };\n\n if (context.componentDef && typeof context.componentDef === 'object') {\n Object.assign(evalContext, context.componentDef as Record<string, unknown>);\n }\n\n if (includeItemContext) {\n const itemContext = (context as Record<string, unknown>).itemContext as Record<string, unknown> | undefined;\n if (itemContext) {\n Object.assign(evalContext, itemContext);\n }\n }\n\n return evalContext;\n}\n\n/** Maximum allowed expression length to prevent DoS via complex expressions */\nconst MAX_EXPRESSION_LENGTH = 500;\n\n/** Maximum recursion depth to prevent stack overflow from circular references */\nconst MAX_RECURSION_DEPTH = 100;\n\n/**\n * Evaluates a template string with the given context\n * Template format: {{expression}}\n * Handles undefined variables gracefully by returning undefined instead of throwing\n *\n * Security: Uses jsep for safe expression parsing - only whitelisted AST nodes are evaluated.\n * No eval/new Function is used, preventing arbitrary code execution.\n *\n * @example\n * evaluateTemplate(\"{{name}}\", { name: \"John\" }) // \"John\"\n * evaluateTemplate(\"{{count + 1}}\", { count: 5 }) // 6\n * evaluateTemplate(\"{{undefinedVar}}\", {}) // undefined (no error thrown)\n */\nexport function evaluateTemplate(\n template: string,\n context: Record<string, unknown>\n): unknown {\n if (typeof template !== 'string') return template;\n\n const templateMatch = template.match(/^\\{\\{(.+)\\}\\}$/);\n if (!templateMatch) return template;\n\n const expression = templateMatch[1].trim();\n\n // Security: Expression length limit to prevent DoS\n if (expression.length > MAX_EXPRESSION_LENGTH) {\n console.warn('Template expression too long:', expression.slice(0, 50) + '...');\n return template;\n }\n\n try {\n // Use safe expression evaluator (jsep-based, no eval/new Function)\n const result = safeEvaluate(expression, context);\n // If result is undefined, return template string for backward compatibility\n return result === undefined ? template : result;\n } catch (error) {\n console.error('Template evaluation error:', error, 'Expression:', expression, 'Context:', context);\n // Return original template string on error for backward compatibility\n return template;\n }\n}\n\n/**\n * Checks if a code string contains any template patterns {{...}}\n */\nexport function hasTemplates(code: string): boolean {\n if (typeof code !== 'string') return false;\n return /\\{\\{[^}]+\\}\\}/.test(code);\n}\n\n/**\n * Processes template strings in JavaScript or CSS code\n * Replaces {{propName}} or {{expression}} with evaluated values\n * \n * @example\n * processCodeTemplates(\"console.log('{{name}}');\", { name: \"John\" })\n * // \"console.log('John');\"\n * \n * processCodeTemplates(\".card { color: {{color}}; }\", { color: \"#ff0000\" })\n * // \".card { color: #ff0000; }\"\n */\nexport function processCodeTemplates(\n code: string,\n context: Record<string, unknown> | undefined\n): string {\n if (typeof code !== 'string') return code;\n\n // Guard against undefined context\n if (!context) {\n return code;\n }\n\n // Match all {{...}} patterns in the code\n return code.replace(/\\{\\{([^}]+)\\}\\}/g, (match: string, expression: string): string => {\n const trimmedExpr = expression.trim();\n\n // Security: Expression length limit to prevent DoS\n if (trimmedExpr.length > MAX_EXPRESSION_LENGTH) {\n console.warn('Code template expression too long:', trimmedExpr.slice(0, 50) + '...');\n return match;\n }\n\n try {\n // Use safe expression evaluator (jsep-based, no eval/new Function)\n const result = safeEvaluate(trimmedExpr, context);\n\n // Convert result to string, handling various types\n if (result === null || result === undefined) {\n return '';\n }\n if (typeof result === 'string') {\n return result;\n }\n if (typeof result === 'number' || typeof result === 'boolean') {\n return String(result);\n }\n // Handle rich-text markers - extract HTML content for interpolation\n if (isRichTextMarker(result)) {\n return richTextMarkerToHtml(result);\n }\n // For objects/arrays, stringify them\n return JSON.stringify(result);\n } catch (error) {\n console.error('Code template evaluation error:', error, 'Expression:', trimmedExpr, 'Context:', context);\n // Return original template if evaluation fails\n return match;\n }\n });\n}\n\n/**\n * Processes a component structure recursively, evaluating templates\n * @param context - Template context containing props, componentDef, and extensible namespaces (e.g., cms, page)\n * @param viewportWidth - Optional viewport width for responsive style resolution. If provided, uses 'viewport' strategy; otherwise uses 'all' strategy.\n * @param instanceChildren - Optional children from component instance to replace { type: \"children\" } markers\n * @param preserveResponsiveStyles - Whether to preserve responsive style objects (for SSR)\n * @param depth - Internal recursion depth counter to prevent stack overflow\n */\nexport function processStructure(\n structure: ComponentNode | ComponentNode[] | string | number | null | undefined,\n context: TemplateContext,\n viewportWidth?: number,\n instanceChildren?: ComponentNode['children'],\n preserveResponsiveStyles: boolean = false,\n depth: number = 0\n): ComponentNode | (ComponentNode | string)[] | string | number | null {\n try {\n // Guard against excessive recursion (circular references or very deep structures)\n if (depth > MAX_RECURSION_DEPTH) {\n console.warn(`processStructure: Maximum recursion depth (${MAX_RECURSION_DEPTH}) exceeded. Possible circular reference.`);\n return null;\n }\n\n // Handle null/undefined\n if (structure === null || structure === undefined) return null;\n\n // Preserve boolean values (don't convert false to null)\n if (typeof structure === 'boolean') {\n return structure as any;\n }\n\n if (typeof structure === 'string') {\n // Build evaluation context with item context for nested template resolution\n const evalContext = buildEvalContext(context, true);\n\n // Check if entire string is a complete template {{expr}}\n // Use evaluateTemplate to preserve type (objects, arrays, numbers)\n if (/^\\{\\{.+\\}\\}$/.test(structure) && !hasItemTemplates(structure)) {\n const result = evaluateTemplate(structure, evalContext);\n // Check for rich-text marker - extract HTML content with RAW_HTML_PREFIX\n // The prefix signals to ComponentBuilder.processTextNode to render as HTML\n if (isRichTextMarker(result)) {\n return RAW_HTML_PREFIX + richTextMarkerToHtml(result);\n }\n if (typeof result === 'string' || typeof result === 'number') {\n return result;\n }\n if (result === undefined || result === null) {\n return '';\n }\n // Return objects as-is (e.g., link objects { href, target })\n // The caller (e.g., href handling) will process them appropriately\n if (typeof result === 'object') {\n return result as any;\n }\n return String(result);\n }\n\n // Check if string contains partial templates like \"heading-{{size}}\"\n // Use processCodeTemplates for string interpolation\n // BUT skip if it contains CMS item templates ({{item.field}}, {{varName.field}}, etc.)\n // Those will be processed later by processItemTemplate with proper context\n if (hasTemplates(structure) && !hasItemTemplates(structure)) {\n return processCodeTemplates(structure, evalContext);\n }\n\n // No templates - return as-is\n return structure;\n }\n \n if (Array.isArray(structure)) {\n const processed: Array<ComponentNode | string> = [];\n for (const item of structure) {\n // Check if this is a slot marker\n if (isSlotMarker(item)) {\n // Replace marker with instance children (if provided)\n if (instanceChildren) {\n const childrenArray = Array.isArray(instanceChildren) ? instanceChildren : [instanceChildren];\n for (const child of childrenArray) {\n const processedChild = processStructure(child, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n addProcessedItemToArray(processedChild, processed);\n }\n } else if ('default' in item && (item as any).default !== undefined) {\n // Fallback: use slot's default content if no instance children provided\n const defaultContent = (item as any).default;\n const defaultsArray = Array.isArray(defaultContent) ? defaultContent : [defaultContent];\n for (const defaultChild of defaultsArray) {\n const processedChild = processStructure(defaultChild, context, viewportWidth, undefined, preserveResponsiveStyles, depth + 1);\n addProcessedItemToArray(processedChild, processed);\n }\n }\n // If no instance children AND no default, marker renders nothing (skip it)\n } else {\n // Regular item - process normally\n const processedItem = processStructure(item, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n addProcessedItemToArray(processedItem, processed);\n }\n }\n return processed;\n }\n \n if (typeof structure === 'object' && !Array.isArray(structure) && structure !== null) {\n // Check if this is a slot marker (shouldn't happen here since we handle it in array processing, but guard anyway)\n if (isSlotMarker(structure)) {\n // This shouldn't happen in object processing, but if it does, return instance children or default\n if (instanceChildren) {\n const processed: Array<ComponentNode | string> = [];\n const childrenArray = Array.isArray(instanceChildren) ? instanceChildren : [instanceChildren];\n for (const child of childrenArray) {\n const processedChild = processStructure(child, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n addProcessedItemToArray(processedChild, processed);\n }\n return processed.length === 1 ? processed[0] : processed;\n }\n // Fallback: use slot's default content\n if ('default' in structure && (structure as any).default !== undefined) {\n const defaultContent = (structure as any).default;\n const processed: Array<ComponentNode | string> = [];\n const defaultsArray = Array.isArray(defaultContent) ? defaultContent : [defaultContent];\n for (const defaultChild of defaultsArray) {\n const processedChild = processStructure(defaultChild, context, viewportWidth, undefined, preserveResponsiveStyles, depth + 1);\n addProcessedItemToArray(processedChild, processed);\n }\n return processed.length === 1 ? processed[0] : processed;\n }\n return null;\n }\n \n // Check if this is a valid node structure or a plain object (like props)\n const inputNode = structure as ComponentNode;\n const hasValidNodeType = inputNode.type && isValidNodeType(inputNode.type);\n\n // If no valid node type, treat as plain object and process values recursively\n // This handles props objects like { text: \"{{text}}\", isMarginBottom: false }\n if (!hasValidNodeType) {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(structure)) {\n const processedValue = processStructure(value as any, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n if (processedValue !== null && processedValue !== undefined) {\n result[key] = processedValue;\n }\n }\n return result as any;\n }\n\n const preservedType = inputNode.type;\n\n // Create base processed object based on type\n let processed: ComponentNode;\n if (preservedType === NODE_TYPE.COMPONENT) {\n processed = {\n type: NODE_TYPE.COMPONENT,\n component: '',\n props: {},\n children: [] as Array<ComponentNode | string>\n } as ComponentInstanceNode;\n } else if (preservedType === NODE_TYPE.EMBED) {\n // Handle embed nodes - they have html content, not children\n processed = {\n type: NODE_TYPE.EMBED,\n html: '',\n } as any;\n } else if (preservedType === NODE_TYPE.LINK) {\n // Handle link nodes - they have href property\n processed = {\n type: NODE_TYPE.LINK,\n href: '',\n children: [] as Array<ComponentNode | string>\n } as any;\n } else if (preservedType === NODE_TYPE.LOCALE_LIST) {\n // Handle locale-list nodes - they have style, itemStyle, activeItemStyle properties\n processed = {\n type: NODE_TYPE.LOCALE_LIST,\n } as any;\n } else if (preservedType === NODE_TYPE.LIST || (preservedType as string) === 'cms-list') {\n // Handle list nodes (unified - handles both prop and collection source types)\n // Also supports legacy 'cms-list' type for migration\n processed = {\n type: NODE_TYPE.LIST,\n source: '',\n children: [] as Array<ComponentNode | string>\n } as any;\n } else {\n processed = {\n type: NODE_TYPE.NODE,\n tag: 'div',\n children: [] as Array<ComponentNode | string>\n } as HtmlNode;\n }\n \n // First pass: process all keys and resolve style mappings\n let resolvedStyle: StyleValue | null = null;\n \n for (const [key, value] of Object.entries(structure)) {\n try {\n if (key === 'children') {\n const processedChildren = processStructure(value as ComponentNode | ComponentNode[] | string | number | null | undefined, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n if (Array.isArray(processedChildren)) {\n processed.children = processedChildren;\n } else if (processedChildren !== null && processedChildren !== undefined) {\n processed.children = [processedChildren as ComponentNode | string];\n }\n } else if (key === 'tag') {\n // Handle tag for HTML nodes\n if (isHtmlNode(processed)) {\n if (typeof value === 'string') {\n // Process template in tag (e.g., \"h{{size}}\" -> \"h1\")\n const evalContext = buildEvalContext(context, false);\n // Use processCodeTemplates to handle partial templates like \"h{{size}}\"\n (processed as any).tag = processCodeTemplates(value, evalContext);\n } else if (value === false) {\n // Preserve boolean false for fragment mode (no container)\n (processed as any).tag = false;\n } else {\n (processed as any).tag = String(value);\n }\n }\n } else if (key === 'component') {\n if (isComponentNode(processed)) {\n if (typeof value === 'string') {\n processed.component = value;\n } else {\n processed.component = String(value);\n }\n }\n } else if (key === 'html') {\n // Handle html property for embed nodes - process templates like {{propName}}\n if (preservedType === NODE_TYPE.EMBED) {\n if (isHtmlMapping(value)) {\n // Resolve HTML mapping to actual content\n const resolved = resolveHtmlMapping(value, context.props);\n (processed as any).html = resolved ?? '';\n } else if (typeof value === 'string') {\n // Build evaluation context with item context for nested template resolution\n const evalContext = buildEvalContext(context, true);\n // Check if entire string is a complete template {{expr}}\n if (/^\\{\\{.+\\}\\}$/.test(value) && !hasItemTemplates(value)) {\n const result = evaluateTemplate(value, evalContext);\n (processed as any).html = result === undefined || result === null ? '' : String(result);\n } else if (hasTemplates(value) && !hasItemTemplates(value)) {\n // Use processCodeTemplates to handle partial templates\n (processed as any).html = processCodeTemplates(value, evalContext);\n } else {\n (processed as any).html = value;\n }\n } else if (typeof value === 'object' && value !== null && (value as any)._mapping === true) {\n // HtmlMapping object that isHtmlMapping somehow missed \u2014 resolve it defensively\n const resolved = resolveHtmlMapping(value, context.props);\n (processed as any).html = resolved ?? '';\n } else {\n (processed as any).html = '';\n }\n }\n } else if (key === 'type') {\n // Preserve type field if valid - but don't change the structure type\n if (typeof value === 'string' && isValidNodeType(value)) {\n // Only update if type actually changed\n if (value === NODE_TYPE.COMPONENT && !isComponentNode(processed)) {\n // Convert to component node\n const newProcessed: ComponentInstanceNode = {\n type: NODE_TYPE.COMPONENT,\n component: '',\n props: (processed as any).props || {},\n children: (processed as any).children as ComponentInstanceNode['children'],\n style: (processed as any).style as ComponentInstanceNode['style']\n };\n processed = newProcessed;\n } else if (value === NODE_TYPE.NODE && !isHtmlNode(processed)) {\n // Convert to HTML node\n const newProcessed: HtmlNode = {\n type: NODE_TYPE.NODE,\n tag: (processed as any).component || 'div',\n children: (processed as any).children as HtmlNode['children'],\n style: (processed as any).style as HtmlNode['style']\n };\n processed = newProcessed;\n }\n }\n } else if (key === 'style' && typeof value === 'object' && value !== null) {\n // Process style at top level - DO NOT recursively call processStructure\n // as it would mangle style mapping objects { _mapping: true, prop: \"size\", values: {...} }\n // into ComponentNode structures. Style objects need special handling.\n const processedStyle = value as Record<string, unknown>;\n if (processedStyle && typeof processedStyle === 'object' && !Array.isArray(processedStyle)) {\n // Check if it's a responsive style object\n const styleEvalContext = buildEvalContext(context, false);\n if (isResponsiveStyle(processedStyle as StyleValue)) {\n // Preserve responsive styles (for both SSR and editor)\n // responsiveStylesToClasses will generate prefixed classes (t-, mob-)\n // CSS media queries will handle displaying the correct styles based on viewport\n const resolvedResponsive: ResponsiveStyleObject = {};\n for (const [bkeyName, bkeyValue] of Object.entries(processedStyle)) {\n if (typeof bkeyValue === 'object' && bkeyValue !== null) {\n resolvedResponsive[bkeyName] = {};\n for (const [styleKey, styleValue] of Object.entries(bkeyValue)) {\n const processedValue = processStyleValue(styleValue, styleEvalContext);\n if (processedValue !== undefined) {\n resolvedResponsive[bkeyName]![styleKey] = processedValue;\n }\n }\n }\n }\n resolvedStyle = resolvedResponsive;\n } else {\n // Legacy flat style object - resolve mappings and evaluate templates\n resolvedStyle = {};\n for (const [styleKey, styleValue] of Object.entries(processedStyle)) {\n const processedValue = processStyleValue(styleValue, styleEvalContext);\n if (processedValue !== undefined) {\n resolvedStyle[styleKey] = processedValue;\n }\n }\n }\n }\n } else if (key === 'props' && typeof value === 'object' && value !== null) {\n // Process non-style props (for instance props only)\n const processedProps = processStructure(value as ComponentNode | ComponentNode[] | string | number | null | undefined, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n // Merge non-style props (style is handled separately at top level)\n if (typeof processedProps === 'object' && !Array.isArray(processedProps) && processedProps !== null && processed.props) {\n const propsObj = processedProps as unknown as Record<string, unknown>;\n Object.assign(processed.props, propsObj);\n // Remove style from props since we handle it at top level\n if ((processed.props as Record<string, unknown>).style !== undefined) {\n delete (processed.props as Record<string, unknown>).style;\n }\n }\n } else if (key === 'hover') {\n // Skip hover for now - it's not a standard React prop\n // Could be implemented with onMouseEnter/onMouseLeave\n } else if (key === 'href' && preservedType === NODE_TYPE.LINK) {\n // Special handling for href in link nodes - resolve link mappings\n if (isLinkMapping(value)) {\n const resolved = resolveLinkMapping(value, context.props);\n if (resolved) {\n (processed as any).href = resolved.href;\n if (resolved.target) {\n (processed as any).attributes = {\n ...((processed as any).attributes || {}),\n target: resolved.target\n };\n }\n } else {\n (processed as any).href = '#';\n }\n } else {\n // Regular href value - process as template\n const processedValue = processStructure(value as ComponentNode | ComponentNode[] | string | number | null | undefined, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n if (processedValue !== null && processedValue !== undefined) {\n // Check if result is a link object (from link-type prop like {{link}})\n if (typeof processedValue === 'object' && processedValue !== null && 'href' in processedValue) {\n // Unwrap nested link objects (e.g., {href: {href: \"/path\"}} from double-wrapped list item templates)\n let linkObj = processedValue as { href: unknown; target?: string };\n while (typeof linkObj.href === 'object' && linkObj.href !== null && 'href' in (linkObj.href as Record<string, unknown>)) {\n const nested = linkObj.href as { href: unknown; target?: string };\n if (!linkObj.target && nested.target) linkObj = { ...linkObj, target: nested.target };\n linkObj = { ...linkObj, href: nested.href };\n }\n (processed as any).href = linkObj.href;\n if (linkObj.target) {\n (processed as any).attributes = {\n ...((processed as any).attributes || {}),\n target: linkObj.target\n };\n }\n } else {\n (processed as any).href = processedValue;\n }\n }\n }\n } else if (key === 'attributes' && typeof value === 'object' && value !== null) {\n // Special handling for attributes - process templates but don't treat as node structure\n // This preserves type=\"checkbox\" etc. which would otherwise be caught by node type handling\n const processedAttributes: Record<string, unknown> = {};\n const evalContext = buildEvalContext(context, false);\n for (const [attrKey, attrValue] of Object.entries(value)) {\n if (typeof attrValue === 'string' && hasTemplates(attrValue)) {\n // Check if entire string is a complete template {{expr}} - preserve type (boolean, number)\n if (/^\\{\\{.+\\}\\}$/.test(attrValue)) {\n const result = evaluateTemplate(attrValue, evalContext);\n // Skip attribute if complete template resolved to empty string\n if (result === '') continue;\n // Keep the original type (boolean, number, string)\n processedAttributes[attrKey] = result === attrValue ? attrValue : result;\n } else {\n // Partial template like \"prefix-{{value}}\" - always string\n processedAttributes[attrKey] = processCodeTemplates(attrValue, evalContext);\n }\n } else {\n processedAttributes[attrKey] = attrValue;\n }\n }\n (processed as unknown as Record<string, unknown>).attributes = processedAttributes;\n } else if (key === 'interactiveStyles' && Array.isArray(value)) {\n // Special handling for interactiveStyles - preserve as-is without mangling\n // Interactive styles contain StyleMapping objects that shouldn't be converted to nodes\n (processed as unknown as Record<string, unknown>).interactiveStyles = value;\n } else if (key !== 'type' && key !== 'children' && key !== 'style' && key !== 'props') {\n const processedValue = processStructure(value as ComponentNode | ComponentNode[] | string | number | null | undefined, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n // Only assign if it's a valid value\n if (processedValue !== null && processedValue !== undefined) {\n // Store extra properties on the node object\n (processed as unknown as Record<string, unknown>)[key] = processedValue;\n }\n }\n } catch (error) {\n console.error(`Error processing key \"${key}\":`, error);\n // Continue processing other keys\n }\n }\n \n // Apply resolved styles to the processed node based on its type\n // Both SSR and Editor now preserve responsive styles for proper utility class generation\n if (resolvedStyle && Object.keys(resolvedStyle).length > 0) {\n if (isResponsiveStyle(resolvedStyle)) {\n // Apply responsive styles directly to node.style or props.style\n if (isComponentNode(processed)) {\n processed.props = processed.props || {};\n processed.props.style = resolvedStyle as ResponsiveStyleObject;\n } else if (isHtmlNode(processed) || isEmbedNode(processed) || isLocaleListNode(processed) || isLinkNode(processed) || isListNode(processed)) {\n processed.style = resolvedStyle as ResponsiveStyleObject;\n }\n } else {\n // Legacy flat style object\n applyStylesToNode(processed, resolvedStyle);\n }\n }\n \n return processed;\n }\n \n return structure;\n } catch (error) {\n console.error('Error in processStructure:', error);\n throw error; // Re-throw so it can be caught by error boundary\n }\n}\n\n", "/**\n * Utilities for working with styles in ComponentNode structures\n * Provides helper functions for applying and merging styles based on node type\n */\n\nimport type { ComponentNode, HtmlNode, ComponentInstanceNode, StyleValue, ResponsiveStyleObject } from './types';\nimport { isComponentNode, isHtmlNode, isEmbedNode, isListNode } from './nodeUtils';\nimport { isResponsiveStyle } from './styleUtils';\n\n/**\n * Apply styles to a ComponentNode based on its type\n * - HTML nodes: styles go at top level (node.style)\n * - Component instances: styles go in props.style\n */\nexport function applyStylesToNode(\n node: ComponentNode,\n styles: StyleValue | Record<string, string | number> | null | undefined,\n viewportWidth?: number\n): ComponentNode {\n if (!styles) return node;\n\n if (isComponentNode(node)) {\n // Component instance: put styles in props.style\n if (!node.props) {\n node.props = {};\n }\n\n node.props.style = { ...(node.props.style || {}), ...styles };\n } else if (isHtmlNode(node) || isEmbedNode(node) || isListNode(node)) {\n // HTML node, Embed node, and List node: put styles at top level\n node.style = styles as StyleValue;\n }\n\n return node;\n}\n\n/**\n * Merge instance styles with structure styles for a ComponentNode\n * Instance styles override structure styles\n */\nexport function mergeNodeStyles(\n node: ComponentNode,\n instanceStyles: StyleValue | Record<string, string | number> | null | undefined,\n viewportWidth?: number\n): ComponentNode {\n if (!instanceStyles) return node;\n\n if (isHtmlNode(node) || isEmbedNode(node) || isListNode(node)) {\n // For HTML nodes, Embed nodes, and List nodes: merge instance styles with existing top-level styles\n const existingStyle = node.style;\n if (existingStyle && typeof existingStyle === 'object') {\n node.style = {\n ...(existingStyle as Record<string, any>),\n ...(instanceStyles as Record<string, any>)\n } as StyleValue;\n } else {\n node.style = instanceStyles as StyleValue;\n }\n } else if (isComponentNode(node)) {\n // For component instances: merge into props.style\n if (!node.props) {\n node.props = {};\n }\n const existingStyle = node.props.style;\n if (existingStyle && typeof existingStyle === 'object') {\n node.props.style = {\n ...(existingStyle as Record<string, any>),\n ...(instanceStyles as Record<string, any>)\n };\n } else {\n node.props.style = instanceStyles;\n }\n }\n\n return node;\n}\n\n/**\n * Extract styles from a ComponentNode based on its type\n * Returns a flat style object ready for React props\n */\nexport function extractStylesFromNode(\n node: ComponentNode,\n viewportWidth?: number\n): Record<string, string | number> {\n if (isComponentNode(node)) {\n // Component instance: styles are in props.style\n const style = node.props?.style;\n if (!style) return {};\n\n return style as Record<string, string | number>;\n } else if (isHtmlNode(node) || isEmbedNode(node)) {\n // HTML node and Embed node: styles are at top level\n const style = node.style;\n if (!style) return {};\n\n return style as Record<string, string | number>;\n }\n\n return {};\n}\n\n", "/**\n * Utilities for working with attributes in ComponentNode structures\n * Provides helper functions for extracting and applying attributes based on node type\n */\n\nimport type { ComponentNode } from './types';\nimport { isComponentNode, isHtmlNode } from './nodeUtils';\n\n/**\n * Extract attributes from a ComponentNode\n * Attributes are stored at the top level of the node (like styles)\n * Returns a record of attributes ready for React props\n */\nexport function extractAttributesFromNode(\n node: ComponentNode\n): Record<string, string | number | boolean> {\n if (!node || typeof node !== 'object') {\n return {};\n }\n\n // Attributes are stored at top level for both HTML nodes and component instances\n if ('attributes' in node && node.attributes) {\n return node.attributes as Record<string, string | number | boolean>;\n }\n\n return {};\n}\n\n/**\n * Remove attributes that were entirely template expressions (e.g., \"{{fade}}\")\n * and resolved to empty string \"\". Static attributes and partial templates are unchanged.\n */\nexport function skipEmptyTemplateAttributes(\n original: Record<string, unknown>,\n resolved: Record<string, unknown>\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(resolved)) {\n const orig = original[key];\n if (\n typeof orig === 'string' &&\n /^\\{\\{.+\\}\\}$/.test(orig) &&\n value === ''\n ) {\n continue;\n }\n result[key] = value;\n }\n return result;\n}\n\n/**\n * Apply attributes to a ComponentNode\n * Attributes go at top level (node.attributes)\n */\nexport function applyAttributesToNode(\n node: ComponentNode,\n attributes: Record<string, string | number | boolean> | null | undefined\n): ComponentNode {\n if (!attributes || Object.keys(attributes).length === 0) {\n return node;\n }\n\n if (isComponentNode(node) || isHtmlNode(node)) {\n return {\n ...node,\n attributes: { ...(node.attributes || {}), ...attributes }\n };\n }\n\n return node;\n}\n\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAWA;;;ACGO,SAAS,kBACd,MACA,QACA,eACe;AACf,MAAI,CAAC,OAAQ,QAAO;AAEpB,MAAI,gBAAgB,IAAI,GAAG;AAEzB,QAAI,CAAC,KAAK,OAAO;AACf,WAAK,QAAQ,CAAC;AAAA,IAChB;AAEA,SAAK,MAAM,QAAQ,EAAE,GAAI,KAAK,MAAM,SAAS,CAAC,GAAI,GAAG,OAAO;AAAA,EAC9D,WAAW,WAAW,IAAI,KAAK,YAAY,IAAI,KAAK,WAAW,IAAI,GAAG;AAEpE,SAAK,QAAQ;AAAA,EACf;AAEA,SAAO;AACT;AAMO,SAAS,gBACd,MACA,gBACA,eACe;AACf,MAAI,CAAC,eAAgB,QAAO;AAE5B,MAAI,WAAW,IAAI,KAAK,YAAY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