meno-core 1.0.46 → 1.0.47

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 (31) hide show
  1. package/build-astro.ts +11 -75
  2. package/dist/build-static.js +3 -3
  3. package/dist/chunks/{chunk-C6U5T5S5.js → chunk-47UNLQUU.js} +2 -2
  4. package/dist/chunks/{chunk-ZWYDT3QJ.js → chunk-BCLGRZ3U.js} +3 -3
  5. package/dist/chunks/{chunk-ZWYDT3QJ.js.map → chunk-BCLGRZ3U.js.map} +2 -2
  6. package/dist/chunks/{chunk-77ZB6353.js → chunk-FGUZOYJX.js} +22 -14
  7. package/dist/chunks/chunk-FGUZOYJX.js.map +7 -0
  8. package/dist/chunks/{chunk-ORN7S4AP.js → chunk-LJFB5EBT.js} +2 -2
  9. package/dist/entries/server-router.js +3 -3
  10. package/dist/lib/client/index.js +4 -2
  11. package/dist/lib/client/index.js.map +2 -2
  12. package/dist/lib/server/index.js +70 -91
  13. package/dist/lib/server/index.js.map +2 -2
  14. package/lib/client/core/ComponentBuilder.test.ts +21 -0
  15. package/lib/client/core/ComponentBuilder.ts +8 -1
  16. package/lib/server/astro/astroEmitHelpers.ts +5 -0
  17. package/lib/server/astro/cmsPageEmitter.ts +15 -2
  18. package/lib/server/astro/componentEmitter.ts +13 -5
  19. package/lib/server/astro/nodeToAstro.ts +23 -9
  20. package/lib/server/astro/pageEmitter.ts +15 -2
  21. package/lib/server/ssr/htmlGenerator.test.ts +3 -2
  22. package/lib/server/ssr/htmlGenerator.ts +5 -0
  23. package/lib/server/ssr/imageMetadata.ts +15 -9
  24. package/lib/server/ssr/ssrRenderer.test.ts +47 -0
  25. package/lib/server/ssr/ssrRenderer.ts +9 -9
  26. package/lib/shared/styleNodeUtils.test.ts +47 -1
  27. package/lib/shared/styleNodeUtils.ts +7 -7
  28. package/package.json +1 -1
  29. package/dist/chunks/chunk-77ZB6353.js.map +0 -7
  30. /package/dist/chunks/{chunk-C6U5T5S5.js.map → chunk-47UNLQUU.js.map} +0 -0
  31. /package/dist/chunks/{chunk-ORN7S4AP.js.map → chunk-LJFB5EBT.js.map} +0 -0
@@ -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, SlotMarker, 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 | Record<string, unknown> | 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 | Record<string, unknown> | 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;\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 Record<string, unknown>;\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 SlotMarker).default !== undefined) {\n // Fallback: use slot's default content if no instance children provided\n const defaultContent = (item as SlotMarker).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 SlotMarker).default !== undefined) {\n const defaultContent = (structure as SlotMarker).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 ComponentNode | string | number | null, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n if (processedValue !== null && processedValue !== undefined) {\n result[key] = processedValue;\n }\n }\n return result;\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 unknown as ComponentNode;\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 unknown as ComponentNode;\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 unknown as ComponentNode;\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 unknown as ComponentNode;\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.tag = processCodeTemplates(value, evalContext);\n } else if (value === false) {\n // Preserve boolean false for fragment mode (no container)\n (processed as Record<string, unknown>).tag = false;\n } else {\n processed.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 && isEmbedNode(processed)) {\n if (isHtmlMapping(value)) {\n // Resolve HTML mapping to actual content\n const resolved = resolveHtmlMapping(value, context.props);\n processed.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.html = result === undefined || result === null ? '' : String(result);\n } else if (hasTemplates(value) && !hasItemTemplates(value)) {\n // Use processCodeTemplates to handle partial templates\n processed.html = processCodeTemplates(value, evalContext);\n } else {\n processed.html = value;\n }\n } else if (typeof value === 'object' && value !== null && (value as Record<string, unknown>)._mapping === true) {\n // HtmlMapping object that isHtmlMapping somehow missed \u2014 resolve it defensively\n const resolved = resolveHtmlMapping(value, context.props);\n processed.html = resolved ?? '';\n } else {\n processed.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 p = processed as Record<string, unknown>;\n const newProcessed: ComponentInstanceNode = {\n type: NODE_TYPE.COMPONENT,\n component: '',\n props: (p.props || {}) as ComponentInstanceNode['props'],\n children: p.children as ComponentInstanceNode['children'],\n style: p.style as ComponentInstanceNode['style']\n };\n processed = newProcessed;\n } else if (value === NODE_TYPE.NODE && !isHtmlNode(processed)) {\n // Convert to HTML node\n const p = processed as Record<string, unknown>;\n const newProcessed: HtmlNode = {\n type: NODE_TYPE.NODE,\n tag: (p.component as string) || 'div',\n children: p.children as HtmlNode['children'],\n style: p.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 && isLinkNode(processed)) {\n // Special handling for href in link nodes - resolve link mappings\n const pLink = processed as Record<string, unknown>;\n if (isLinkMapping(value)) {\n const resolved = resolveLinkMapping(value, context.props);\n if (resolved) {\n processed.href = resolved.href;\n if (resolved.target) {\n pLink.attributes = {\n ...((pLink.attributes as Record<string, unknown>) || {}),\n target: resolved.target\n };\n }\n } else {\n processed.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.href = linkObj.href as string;\n if (linkObj.target) {\n pLink.attributes = {\n ...((pLink.attributes as Record<string, unknown>) || {}),\n target: linkObj.target\n };\n }\n } else {\n processed.href = processedValue as string;\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 as unknown as Record<string, unknown>).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 * Deep-merge two style objects, handling responsive breakpoint keys.\n * When both are responsive ({ base, tablet, mobile }), merges per breakpoint\n * so that instance properties override structure properties within each breakpoint\n * rather than replacing the entire breakpoint object.\n */\nfunction deepMergeStyles(\n existing: StyleValue | Record<string, any>,\n instance: StyleValue | Record<string, any> | null | undefined\n): StyleValue {\n if (!instance) return existing as StyleValue;\n\n const bothResponsive =\n isResponsiveStyle(existing as StyleValue) && isResponsiveStyle(instance as StyleValue);\n\n if (bothResponsive) {\n const e = existing as Record<string, any>;\n const i = instance as Record<string, any>;\n const merged: Record<string, any> = {};\n const keys = new Set([...Object.keys(e), ...Object.keys(i)]);\n for (const key of keys) {\n if (e[key] && i[key] && typeof e[key] === 'object' && typeof i[key] === 'object') {\n merged[key] = { ...e[key], ...i[key] };\n } else {\n merged[key] = i[key] !== undefined ? i[key] : e[key];\n }\n }\n return merged as StyleValue;\n }\n\n // Flat styles: shallow merge (instance overrides)\n return { ...(existing as Record<string, any>), ...(instance as Record<string, any>) } as StyleValue;\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 = deepMergeStyles(existingStyle, instanceStyles);\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 = deepMergeStyles(existingStyle, instanceStyles);\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;AA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AAK;AAAA,QAEvD;AAAA,MACF;AAIA,UAAI,iBAAiB,OAAO,KAAK,aAAa,EAAE,SAAS,GAAG;AAC1D,YAAI,kBAAkB,aAAa,GAAG;AAEpC,cAAI,gBAAgB,SAAS,GAAG;AAC9B,YAAC,UAAiD,QAAQ;AAAA,UAC5D,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;;;AExzBO,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, SlotMarker, 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 | Record<string, unknown> | 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 | Record<string, unknown> | 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;\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 Record<string, unknown>;\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 SlotMarker).default !== undefined) {\n // Fallback: use slot's default content if no instance children provided\n const defaultContent = (item as SlotMarker).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 SlotMarker).default !== undefined) {\n const defaultContent = (structure as SlotMarker).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 ComponentNode | string | number | null, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);\n if (processedValue !== null && processedValue !== undefined) {\n result[key] = processedValue;\n }\n }\n return result;\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 unknown as ComponentNode;\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 unknown as ComponentNode;\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 unknown as ComponentNode;\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 unknown as ComponentNode;\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.tag = processCodeTemplates(value, evalContext);\n } else if (value === false) {\n // Preserve boolean false for fragment mode (no container)\n (processed as Record<string, unknown>).tag = false;\n } else {\n processed.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 && isEmbedNode(processed)) {\n if (isHtmlMapping(value)) {\n // Resolve HTML mapping to actual content\n const resolved = resolveHtmlMapping(value, context.props);\n processed.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.html = result === undefined || result === null ? '' : String(result);\n } else if (hasTemplates(value) && !hasItemTemplates(value)) {\n // Use processCodeTemplates to handle partial templates\n processed.html = processCodeTemplates(value, evalContext);\n } else {\n processed.html = value;\n }\n } else if (typeof value === 'object' && value !== null && (value as Record<string, unknown>)._mapping === true) {\n // HtmlMapping object that isHtmlMapping somehow missed \u2014 resolve it defensively\n const resolved = resolveHtmlMapping(value, context.props);\n processed.html = resolved ?? '';\n } else {\n processed.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 p = processed as Record<string, unknown>;\n const newProcessed: ComponentInstanceNode = {\n type: NODE_TYPE.COMPONENT,\n component: '',\n props: (p.props || {}) as ComponentInstanceNode['props'],\n children: p.children as ComponentInstanceNode['children'],\n style: p.style as ComponentInstanceNode['style']\n };\n processed = newProcessed;\n } else if (value === NODE_TYPE.NODE && !isHtmlNode(processed)) {\n // Convert to HTML node\n const p = processed as Record<string, unknown>;\n const newProcessed: HtmlNode = {\n type: NODE_TYPE.NODE,\n tag: (p.component as string) || 'div',\n children: p.children as HtmlNode['children'],\n style: p.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 && isLinkNode(processed)) {\n // Special handling for href in link nodes - resolve link mappings\n const pLink = processed as Record<string, unknown>;\n if (isLinkMapping(value)) {\n const resolved = resolveLinkMapping(value, context.props);\n if (resolved) {\n processed.href = resolved.href;\n if (resolved.target) {\n pLink.attributes = {\n ...((pLink.attributes as Record<string, unknown>) || {}),\n target: resolved.target\n };\n }\n } else {\n processed.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.href = linkObj.href as string;\n if (linkObj.target) {\n pLink.attributes = {\n ...((pLink.attributes as Record<string, unknown>) || {}),\n target: linkObj.target\n };\n }\n } else {\n processed.href = processedValue as string;\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 as unknown as Record<string, unknown>).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, isLinkNode } 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) || isLinkNode(node)) {\n // HTML node, Embed node, List node, and Link node: put styles at top level\n node.style = styles as StyleValue;\n }\n\n return node;\n}\n\n/**\n * Deep-merge two style objects, handling responsive breakpoint keys.\n * When both are responsive ({ base, tablet, mobile }), merges per breakpoint\n * so that instance properties override structure properties within each breakpoint\n * rather than replacing the entire breakpoint object.\n */\nfunction deepMergeStyles(\n existing: StyleValue | Record<string, any>,\n instance: StyleValue | Record<string, any> | null | undefined\n): StyleValue {\n if (!instance) return existing as StyleValue;\n\n const bothResponsive =\n isResponsiveStyle(existing as StyleValue) && isResponsiveStyle(instance as StyleValue);\n\n if (bothResponsive) {\n const e = existing as Record<string, any>;\n const i = instance as Record<string, any>;\n const merged: Record<string, any> = {};\n const keys = new Set([...Object.keys(e), ...Object.keys(i)]);\n for (const key of keys) {\n if (e[key] && i[key] && typeof e[key] === 'object' && typeof i[key] === 'object') {\n merged[key] = { ...e[key], ...i[key] };\n } else {\n merged[key] = i[key] !== undefined ? i[key] : e[key];\n }\n }\n return merged as StyleValue;\n }\n\n // Flat styles: shallow merge (instance overrides)\n return { ...(existing as Record<string, any>), ...(instance as Record<string, any>) } as StyleValue;\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) || isLinkNode(node)) {\n // For HTML nodes, Embed nodes, List nodes, and Link nodes: merge instance styles with existing top-level styles\n const existingStyle = node.style;\n if (existingStyle && typeof existingStyle === 'object') {\n node.style = deepMergeStyles(existingStyle, instanceStyles);\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 = deepMergeStyles(existingStyle, instanceStyles);\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) || isLinkNode(node)) {\n // HTML node, Embed node, and Link 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,KAAK,WAAW,IAAI,GAAG;AAExF,SAAK,QAAQ;AAAA,EACf;AAEA,SAAO;AACT;AAQA,SAAS,gBACP,UACA,UACY;AACZ,MAAI,CAAC,SAAU,QAAO;AAEtB,QAAM,iBACJ,kBAAkB,QAAsB,KAAK,kBAAkB,QAAsB;AAEvF,MAAI,gBAAgB;AAClB,UAAM,IAAI;AACV,UAAM,IAAI;AACV,UAAM,SAA8B,CAAC;AACrC,UAAM,OAAO,oBAAI,IAAI,CAAC,GAAG,OAAO,KAAK,CAAC,GAAG,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC;AAC3D,eAAW,OAAO,MAAM;AACtB,UAAI,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,OAAO,EAAE,GAAG,MAAM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QAC5C;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,8BAA8B,KAAK;AACjD,UAAM;AAAA,EACR;AACF;;;AExzBO,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;",
6
6
  "names": ["normalizeStyle", "processed"]
7
7
  }
@@ -23,7 +23,7 @@ import {
23
23
  processStructure,
24
24
  resolveHtmlMapping,
25
25
  skipEmptyTemplateAttributes
26
- } from "./chunk-ZWYDT3QJ.js";
26
+ } from "./chunk-BCLGRZ3U.js";
27
27
  import {
28
28
  DEFAULT_PREFETCH_CONFIG,
29
29
  SSRRegistry,
@@ -1761,14 +1761,17 @@ async function buildImageMetadataMap() {
1761
1761
  );
1762
1762
  }
1763
1763
  }
1764
- const mainWidth = entry.width || 2400;
1765
- if (entry.formats.webp) {
1766
- webpSrcsetParts.push(`/images/${encodeURIComponent(`${baseName}.webp`)} ${mainWidth}w`);
1767
- } else {
1768
- webpSrcsetParts.push(`/images/${encodeURIComponent(filename)} ${mainWidth}w`);
1769
- }
1770
- if (entry.formats.avif) {
1771
- avifSrcsetParts.push(`/images/${encodeURIComponent(`${baseName}.avif`)} ${mainWidth}w`);
1764
+ const hasVariants = entry.variants.length > 0;
1765
+ if (hasVariants) {
1766
+ const mainWidth = entry.width || 2400;
1767
+ if (entry.formats.webp) {
1768
+ webpSrcsetParts.push(`/images/${encodeURIComponent(`${baseName}.webp`)} ${mainWidth}w`);
1769
+ } else {
1770
+ webpSrcsetParts.push(`/images/${encodeURIComponent(filename)} ${mainWidth}w`);
1771
+ }
1772
+ if (entry.formats.avif) {
1773
+ avifSrcsetParts.push(`/images/${encodeURIComponent(`${baseName}.avif`)} ${mainWidth}w`);
1774
+ }
1772
1775
  }
1773
1776
  const metadata = {
1774
1777
  srcset: webpSrcsetParts.join(", "),
@@ -2624,11 +2627,11 @@ async function renderComponent(componentName, propsWithStyleAndAttrs, children,
2624
2627
  return await renderNode(processedStructure, ctx);
2625
2628
  }
2626
2629
  const rootNode = processedStructure;
2627
- if (isComponentNode(rootNode) || isHtmlNode(rootNode)) {
2630
+ if (isComponentNode(rootNode) || isHtmlNode(rootNode) || isLinkNode(rootNode)) {
2628
2631
  if (!rootNode.props) {
2629
2632
  rootNode.props = {};
2630
2633
  }
2631
- if (isHtmlNode(rootNode)) {
2634
+ if (isHtmlNode(rootNode) || isLinkNode(rootNode)) {
2632
2635
  if (propsWithStyleAndAttrs.style) {
2633
2636
  const existingStyle = rootNode.style;
2634
2637
  if (existingStyle && typeof existingStyle === "object") {
@@ -2651,7 +2654,7 @@ async function renderComponent(componentName, propsWithStyleAndAttrs, children,
2651
2654
  }
2652
2655
  }
2653
2656
  if (propsWithStyleAndAttrs.className) {
2654
- if (isHtmlNode(rootNode)) {
2657
+ if (isHtmlNode(rootNode) || isLinkNode(rootNode)) {
2655
2658
  if (!rootNode.attributes) rootNode.attributes = {};
2656
2659
  const existingClass = rootNode.attributes.class || "";
2657
2660
  rootNode.attributes.class = existingClass ? `${existingClass} ${propsWithStyleAndAttrs.className}` : propsWithStyleAndAttrs.className;
@@ -2661,7 +2664,7 @@ async function renderComponent(componentName, propsWithStyleAndAttrs, children,
2661
2664
  }
2662
2665
  }
2663
2666
  Object.assign(rootNode.props, nodeAttributes);
2664
- if (isHtmlNode(rootNode) && Object.keys(nodeAttributes).length > 0) {
2667
+ if ((isHtmlNode(rootNode) || isLinkNode(rootNode)) && Object.keys(nodeAttributes).length > 0) {
2665
2668
  if (!rootNode.attributes) {
2666
2669
  rootNode.attributes = {};
2667
2670
  }
@@ -3443,12 +3446,17 @@ button {
3443
3446
  cursor: pointer;
3444
3447
  outline: inherit;
3445
3448
  }
3449
+ img {
3450
+ max-width: 100%;
3451
+ height: auto;
3452
+ }
3446
3453
  picture {
3447
3454
  display: block;
3448
3455
  }
3449
3456
  .olink {
3450
3457
  text-decoration: none;
3451
3458
  display: block;
3459
+ color: inherit;
3452
3460
  }
3453
3461
  .oem {
3454
3462
  display: inline-block;
@@ -5976,4 +5984,4 @@ export {
5976
5984
  FileSystemCMSProvider,
5977
5985
  migrateTemplatesDirectory
5978
5986
  };
5979
- //# sourceMappingURL=chunk-77ZB6353.js.map
5987
+ //# sourceMappingURL=chunk-FGUZOYJX.js.map