meno-core 1.0.48 → 1.0.50

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 (89) hide show
  1. package/build-astro.ts +6 -2
  2. package/dist/build-static.js +7 -7
  3. package/dist/chunks/{chunk-D5E3OKSL.js → chunk-56EUSC6D.js} +5 -5
  4. package/dist/chunks/{chunk-3FHJUHAS.js → chunk-7NIC4I3V.js} +300 -43
  5. package/dist/chunks/chunk-7NIC4I3V.js.map +7 -0
  6. package/dist/chunks/{chunk-B2RTLDXY.js → chunk-AZQYF6KE.js} +132 -1
  7. package/dist/chunks/chunk-AZQYF6KE.js.map +7 -0
  8. package/dist/chunks/{chunk-TPQ7APVQ.js → chunk-CVLFID6V.js} +473 -73
  9. package/dist/chunks/chunk-CVLFID6V.js.map +7 -0
  10. package/dist/chunks/{chunk-NP76N4HQ.js → chunk-EDQSMAMP.js} +13 -2
  11. package/dist/chunks/{chunk-NP76N4HQ.js.map → chunk-EDQSMAMP.js.map} +2 -2
  12. package/dist/chunks/{chunk-RQSTH2BS.js → chunk-H4JSCDNW.js} +2 -2
  13. package/dist/chunks/{chunk-EK4KESLU.js → chunk-J23ZX5AP.js} +8 -2
  14. package/dist/chunks/{chunk-EK4KESLU.js.map → chunk-J23ZX5AP.js.map} +2 -2
  15. package/dist/chunks/{chunk-UUA5LEWF.js → chunk-LPVETICS.js} +156 -8
  16. package/dist/chunks/chunk-LPVETICS.js.map +7 -0
  17. package/dist/chunks/{chunk-BJRKEPMP.js → chunk-PQ2HRXDR.js} +5 -2
  18. package/dist/chunks/chunk-PQ2HRXDR.js.map +7 -0
  19. package/dist/chunks/{chunk-NKUV77SR.js → chunk-YWJJD5D6.js} +133 -37
  20. package/dist/chunks/chunk-YWJJD5D6.js.map +7 -0
  21. package/dist/chunks/{configService-IGJEC3MC.js → configService-VOY2MY2K.js} +3 -3
  22. package/dist/entries/server-router.js +9 -9
  23. package/dist/entries/server-router.js.map +2 -2
  24. package/dist/lib/client/index.js +92 -32
  25. package/dist/lib/client/index.js.map +3 -3
  26. package/dist/lib/server/index.js +14 -12
  27. package/dist/lib/server/index.js.map +2 -2
  28. package/dist/lib/shared/index.js +46 -10
  29. package/dist/lib/shared/index.js.map +3 -3
  30. package/entries/server-router.tsx +6 -2
  31. package/lib/client/core/ComponentBuilder.test.ts +34 -0
  32. package/lib/client/core/ComponentBuilder.ts +33 -4
  33. package/lib/client/core/builders/embedBuilder.ts +28 -7
  34. package/lib/client/core/builders/linkNodeBuilder.ts +28 -7
  35. package/lib/client/core/builders/localeListBuilder.ts +30 -11
  36. package/lib/client/styles/StyleInjector.ts +3 -2
  37. package/lib/client/templateEngine.ts +24 -0
  38. package/lib/client/theme.ts +4 -4
  39. package/lib/server/cssGenerator.test.ts +64 -1
  40. package/lib/server/cssGenerator.ts +48 -9
  41. package/lib/server/fileWatcher.test.ts +134 -0
  42. package/lib/server/fileWatcher.ts +100 -32
  43. package/lib/server/jsonLoader.ts +1 -0
  44. package/lib/server/providers/fileSystemCMSProvider.test.ts +163 -0
  45. package/lib/server/providers/fileSystemCMSProvider.ts +240 -19
  46. package/lib/server/routes/index.ts +1 -1
  47. package/lib/server/routes/pages.ts +23 -1
  48. package/lib/server/services/cmsService.test.ts +246 -0
  49. package/lib/server/services/cmsService.ts +122 -5
  50. package/lib/server/services/configService.ts +6 -0
  51. package/lib/server/services/fileWatcherService.ts +17 -0
  52. package/lib/server/ssr/attributeBuilder.ts +41 -0
  53. package/lib/server/ssr/htmlGenerator.test.ts +113 -0
  54. package/lib/server/ssr/htmlGenerator.ts +62 -7
  55. package/lib/server/ssr/liveReloadIntegration.test.ts +209 -0
  56. package/lib/server/ssr/ssrRenderer.test.ts +564 -0
  57. package/lib/server/ssr/ssrRenderer.ts +228 -49
  58. package/lib/server/webflow/buildWebflow.ts +1 -1
  59. package/lib/server/websocketManager.test.ts +61 -6
  60. package/lib/server/websocketManager.ts +25 -1
  61. package/lib/shared/cssGeneration.test.ts +267 -1
  62. package/lib/shared/cssGeneration.ts +240 -18
  63. package/lib/shared/cssProperties.test.ts +275 -1
  64. package/lib/shared/cssProperties.ts +223 -7
  65. package/lib/shared/interfaces/contentProvider.ts +39 -6
  66. package/lib/shared/pathSecurity.ts +16 -0
  67. package/lib/shared/responsiveScaling.test.ts +143 -0
  68. package/lib/shared/responsiveScaling.ts +253 -2
  69. package/lib/shared/themeDefaults.test.ts +3 -3
  70. package/lib/shared/themeDefaults.ts +3 -3
  71. package/lib/shared/types/api.ts +10 -1
  72. package/lib/shared/types/cms.ts +46 -12
  73. package/lib/shared/types/index.ts +1 -0
  74. package/lib/shared/utilityClassConfig.ts +3 -0
  75. package/lib/shared/utilityClassMapper.test.ts +123 -0
  76. package/lib/shared/utilityClassMapper.ts +179 -8
  77. package/lib/shared/validation/schemas.test.ts +93 -0
  78. package/lib/shared/validation/schemas.ts +71 -16
  79. package/lib/shared/validation/validators.ts +26 -1
  80. package/package.json +1 -1
  81. package/dist/chunks/chunk-3FHJUHAS.js.map +0 -7
  82. package/dist/chunks/chunk-B2RTLDXY.js.map +0 -7
  83. package/dist/chunks/chunk-BJRKEPMP.js.map +0 -7
  84. package/dist/chunks/chunk-NKUV77SR.js.map +0 -7
  85. package/dist/chunks/chunk-TPQ7APVQ.js.map +0 -7
  86. package/dist/chunks/chunk-UUA5LEWF.js.map +0 -7
  87. /package/dist/chunks/{chunk-D5E3OKSL.js.map → chunk-56EUSC6D.js.map} +0 -0
  88. /package/dist/chunks/{chunk-RQSTH2BS.js.map → chunk-H4JSCDNW.js.map} +0 -0
  89. /package/dist/chunks/{configService-IGJEC3MC.js.map → configService-VOY2MY2K.js.map} +0 -0
@@ -14,7 +14,7 @@ import {
14
14
  normalizeStyle,
15
15
  richTextMarkerToHtml,
16
16
  safeEvaluate
17
- } from "./chunk-3FHJUHAS.js";
17
+ } from "./chunk-7NIC4I3V.js";
18
18
  import {
19
19
  NODE_TYPE,
20
20
  RAW_HTML_PREFIX,
@@ -552,6 +552,17 @@ function processStructure(structure, context, viewportWidth, instanceChildren, p
552
552
  processed.attributes = processedAttributes;
553
553
  } else if (key === "interactiveStyles" && Array.isArray(value)) {
554
554
  processed.interactiveStyles = value;
555
+ } else if (key === "source" && preservedType === NODE_TYPE.LIST) {
556
+ const structureRec = structure;
557
+ const sourceType = structureRec.sourceType ?? "prop";
558
+ if (sourceType === "prop" && typeof value === "string" && value !== "" && !hasTemplates(value) && context.props && Array.isArray(context.props[value])) {
559
+ processed.source = context.props[value];
560
+ } else {
561
+ const processedValue = processStructure(value, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);
562
+ if (processedValue !== null && processedValue !== void 0) {
563
+ processed.source = processedValue;
564
+ }
565
+ }
555
566
  } else if (key !== "type" && key !== "children" && key !== "style" && key !== "props") {
556
567
  const processedValue = processStructure(value, context, viewportWidth, instanceChildren, preserveResponsiveStyles, depth + 1);
557
568
  if (processedValue !== null && processedValue !== void 0) {
@@ -619,4 +630,4 @@ export {
619
630
  extractAttributesFromNode,
620
631
  skipEmptyTemplateAttributes
621
632
  };
622
- //# sourceMappingURL=chunk-NP76N4HQ.js.map
633
+ //# sourceMappingURL=chunk-EDQSMAMP.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, 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,YAAY,OAAO,EAAE,GAAG,MAAM,UAAU;AAChF,eAAO,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE;AAA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;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 === 'source' && preservedType === NODE_TYPE.LIST) {\n // Pre-resolve a bare prop-name source against the current component's\n // props. Without this, a list with `sourceType: \"prop\"` placed inside\n // another component's slot would fail to resolve at SSR time, because\n // by then `ctx.componentResolvedProps` belongs to the slot host (not\n // the component whose prop this references). The {{template}} form is\n // already handled by the default-recursion branch below.\n const structureRec = structure as Record<string, unknown>;\n const sourceType = (structureRec.sourceType as string | undefined) ?? 'prop';\n if (\n sourceType === 'prop' &&\n typeof value === 'string' &&\n value !== '' &&\n !hasTemplates(value) &&\n context.props &&\n Array.isArray((context.props as Record<string, unknown>)[value])\n ) {\n (processed as unknown as Record<string, unknown>).source = (context.props as Record<string, unknown>)[value];\n } else {\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 (processed as unknown as Record<string, unknown>).source = processedValue;\n }\n }\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,CA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+1,6 @@
1
1
  import {
2
2
  isI18nValue
3
- } from "./chunk-B2RTLDXY.js";
3
+ } from "./chunk-AZQYF6KE.js";
4
4
 
5
5
  // lib/shared/slugify.ts
6
6
  function slugify(text) {
@@ -51,4 +51,4 @@ export {
51
51
  generateUniqueFilename,
52
52
  generateFilenameFromItem
53
53
  };
54
- //# sourceMappingURL=chunk-RQSTH2BS.js.map
54
+ //# sourceMappingURL=chunk-H4JSCDNW.js.map
@@ -210,6 +210,10 @@ var SAFE_IDENTIFIER_REGEX = /^[a-zA-Z0-9_-]+$/;
210
210
  function isValidIdentifier(name) {
211
211
  return SAFE_IDENTIFIER_REGEX.test(name);
212
212
  }
213
+ var CMS_DRAFT_SUFFIX = ".draft";
214
+ function isReservedDraftFilename(filename) {
215
+ return filename.endsWith(CMS_DRAFT_SUFFIX);
216
+ }
213
217
 
214
218
  export {
215
219
  isListPropDefinition,
@@ -230,6 +234,8 @@ export {
230
234
  resolveSafePath,
231
235
  isSafePathSegment,
232
236
  SAFE_IDENTIFIER_REGEX,
233
- isValidIdentifier
237
+ isValidIdentifier,
238
+ CMS_DRAFT_SUFFIX,
239
+ isReservedDraftFilename
234
240
  };
235
- //# sourceMappingURL=chunk-EK4KESLU.js.map
241
+ //# sourceMappingURL=chunk-J23ZX5AP.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../lib/shared/types/components.ts", "../../lib/shared/types/errors.ts", "../../lib/shared/types/colors.ts", "../../lib/shared/types/variables.ts", "../../lib/shared/pathSecurity.ts"],
4
- "sourcesContent": ["/**\n * Component Definition Types\n * Improved type safety with stricter types\n */\n\nimport type { ComponentNode } from './nodes';\nimport type { LibrariesConfig } from './libraries';\n\n/**\n * Prop type definitions\n */\nexport type PropType = 'string' | 'select' | 'boolean' | 'number' | 'link' | 'file' | 'rich-text' | 'embed' | 'list';\n\n/**\n * Project-level enum configuration\n * Keys are enum names, values are arrays of options\n */\nexport type EnumsConfig = Record<string, readonly string[]>;\n\n/**\n * Internationalization (i18n) value object\n * Keys are locale codes (e.g., 'en', 'pl', 'de')\n * Values can be strings (for string props) or arrays (for list props)\n */\nexport interface I18nValue {\n _i18n: true;\n [locale: string]: string | unknown[] | true; // true is for the _i18n marker, arrays for list props\n}\n\n/**\n * Locale configuration with metadata\n */\nexport interface LocaleConfig {\n code: string; // URL prefix & translation key (e.g., \"en\", \"pl\")\n name: string; // English name for admin UI (e.g., \"Polish\")\n nativeName: string; // Native name for public UI (e.g., \"Polski\")\n langTag: string; // BCP 47 language tag for SEO (e.g., \"pl-PL\")\n icon?: string; // Optional flag icon path (e.g., \"/icons/flag-en.svg\")\n}\n\n/**\n * Internationalization configuration\n */\nexport interface I18nConfig {\n defaultLocale: string;\n locales: LocaleConfig[];\n}\n\n/**\n * Value resolver function type\n * Used for transforming field values (e.g., i18n resolution)\n */\nexport type ValueResolver = (value: unknown) => unknown;\n\n/**\n * Link prop value type\n */\nexport interface LinkPropValue {\n href: string;\n target?: '_blank';\n}\n\n/**\n * Base prop definition without list-specific fields\n */\nexport interface BasePropDefinition {\n type: Exclude<PropType, 'list'>;\n default?: string | number | boolean | I18nValue | LinkPropValue;\n options?: readonly string[]; // Required for \"select\" type (inline options)\n enumName?: string; // For \"select\" type: reference to project-level enum\n accept?: string; // For \"file\" type: MIME pattern like \"image/*\", \"video/*\"\n editor?: 'basic' | 'extended'; // For 'rich-text' type: which editor to use\n}\n\n/**\n * List item schema - defines the structure of each item in a list prop\n * Uses the same prop types as component interfaces (except nested lists)\n */\nexport type ListItemSchema = Record<string, BasePropDefinition>;\n\n/**\n * List item value type\n * Supports i18n values for localized string fields\n */\nexport type ListItemValue = Record<string, string | number | boolean | LinkPropValue | I18nValue | null>;\n\n/**\n * List prop definition - for array/list data\n */\nexport interface ListPropDefinition {\n type: 'list';\n /** Schema defining the structure of each list item */\n itemSchema: ListItemSchema;\n /** Default value is an array of items */\n default?: ListItemValue[];\n}\n\n/**\n * Prop definition with improved type safety\n */\nexport type PropDefinition = BasePropDefinition | ListPropDefinition;\n\n/**\n * Type guard to check if a prop definition is a list type\n */\nexport function isListPropDefinition(def: PropDefinition): def is ListPropDefinition {\n return def.type === 'list';\n}\n\n/**\n * Type guard to check if a prop definition is a base (non-list) type\n */\nexport function isBasePropDefinition(def: PropDefinition): def is BasePropDefinition {\n return def.type !== 'list';\n}\n\n/**\n * Structured component definition\n */\nexport interface StructuredComponentDefinition {\n interface?: Record<string, PropDefinition>;\n structure?: ComponentNode;\n javascript?: string; // Vanilla JS code to be rendered at end of HTML\n css?: string; // CSS code to be rendered in <style> tag in <head>\n category?: string; // Component category for organization\n /**\n * Define which props are available as JavaScript variables (Astro-style define:vars)\n * - true: all props from interface are exposed\n * - string[]: only specified props are exposed\n * - undefined: no automatic prop injection (backward compatible)\n */\n defineVars?: true | string[];\n /** External JS/CSS libraries required by this component */\n libraries?: LibrariesConfig;\n /** Whether instances of this component can have styles applied to the wrapper */\n acceptsStyles?: boolean;\n}\n\n/**\n * Component definition\n * Supports both new format (just component) and legacy format (type/props/children/component)\n */\nexport interface ComponentDefinition {\n type?: string; // Legacy format\n props?: Record<string, unknown>; // Legacy format\n children?: unknown[]; // Legacy format\n component: StructuredComponentDefinition;\n}\n\n/**\n * Line range for element line number tracking\n */\nexport interface LineRange {\n startLine: number;\n endLine: number;\n}\n\n/**\n * JSON page structure\n */\nexport interface JSONPage {\n meta?: import('./api').PageMetaData;\n components?: Record<string, ComponentDefinition>;\n root?: ComponentNode;\n _lineMap?: Record<string, LineRange>;\n}\n\n/**\n * Page data type that can be either a JSONPage or a component definition structure\n */\nexport type PageData = JSONPage | {\n component: {\n structure?: ComponentNode;\n interface?: Record<string, PropDefinition>;\n javascript?: string;\n css?: string;\n acceptsStyles?: boolean;\n }\n};\n\n/**\n * Page data with component structure (for type narrowing)\n */\nexport interface PageDataWithComponent {\n component: {\n structure?: ComponentNode;\n interface?: Record<string, PropDefinition>;\n javascript?: string;\n css?: string;\n libraries?: LibrariesConfig;\n acceptsStyles?: boolean;\n };\n}\n", "/**\n * Error Types\n * Structured error types for validation and type safety\n */\n\n/**\n * Validation error with context\n */\nexport interface ValidationError {\n path?: string;\n message: string;\n receivedValue?: unknown;\n expectedType?: string;\n}\n\n/**\n * Type safety error\n * Errors from type mismatches or invalid data structures\n */\nexport interface TypeSafetyError extends Error {\n readonly path?: string;\n readonly receivedValue?: unknown;\n readonly expectedType?: string;\n}\n\n/**\n * Result type for operations that can fail\n * Replaces null returns with explicit success/failure\n */\nexport type Result<T> =\n | { success: true; data: T }\n | { success: false; error: ValidationError };\n\n/**\n * Create a validation error\n */\nexport function createValidationError(\n message: string,\n options?: {\n path?: string;\n receivedValue?: unknown;\n expectedType?: string;\n }\n): ValidationError {\n return {\n message,\n ...options,\n };\n}\n\n/**\n * Create a type safety error\n */\nexport function createTypeSafetyError(\n message: string,\n options?: {\n path?: string;\n receivedValue?: unknown;\n expectedType?: string;\n }\n): TypeSafetyError {\n const error = new Error(message) as TypeSafetyError;\n Object.defineProperty(error, 'path', { value: options?.path, writable: false });\n Object.defineProperty(error, 'receivedValue', { value: options?.receivedValue, writable: false });\n Object.defineProperty(error, 'expectedType', { value: options?.expectedType, writable: false });\n return error;\n}\n\n\n", "/**\n * Color Variables Types\n * Handles color variable definitions and configuration\n */\n\n/**\n * Color variables configuration\n * Maps semantic color names to their hex/rgb values\n */\nexport interface ColorVariables {\n colors: Record<string, string>;\n}\n\n/**\n * Theme configuration with color set and metadata\n */\nexport interface Theme {\n label: string;\n colors: Record<string, string>;\n}\n\n/**\n * Theme configuration file structure\n * Supports multiple named themes with a default theme\n */\nexport interface ThemeConfig {\n default: string;\n palette?: Record<string, string>;\n themes: Record<string, Theme>;\n}\n\n/**\n * Resolve a color value through the palette.\n * If value matches a palette key, returns the palette hex; otherwise returns value as-is.\n */\nexport function resolvePaletteColor(value: string, palette?: Record<string, string>): string {\n if (!palette) return value;\n return palette[value] ?? value;\n}\n\n/**\n * Color variable entry for editor display\n */\nexport interface ColorVariableEntry {\n name: string;\n value: string;\n}\n\n/**\n * Theme entry for theme selector\n */\nexport interface ThemeEntry {\n name: string;\n label: string;\n}\n", "/**\n * CSS Variables Types\n * Defines types for the variables.json configuration file\n */\n\n/**\n * Category type for a CSS variable\n * Maps to responsiveScales categories for automatic responsive scaling\n * 'none' means no responsive scaling is applied\n */\nexport type VariableType = 'fontSize' | 'padding' | 'margin' | 'gap' | 'borderRadius' | 'size' | 'none';\n\n/**\n * UI filtering group for a CSS variable.\n * Controls which variables appear in the picker based on the CSS property being edited.\n */\nexport type VariableGroup =\n | 'font-family' | 'font-size' | 'font-weight'\n | 'line-height' | 'letter-spacing'\n | 'margin' | 'padding' | 'gap'\n | 'size'\n | 'position'\n | 'border-radius' | 'border-width'\n | 'outline'\n | 'shadow'\n | 'filter'\n | 'duration'\n | 'aspect-ratio'\n | 'opacity' | 'z-index'\n | 'text-align'\n | 'other';\n\n/** Predefined variable groups for UI dropdowns */\nexport const VARIABLE_GROUPS: { value: VariableGroup; label: string }[] = [\n { value: 'font-family', label: 'Font Family' },\n { value: 'font-size', label: 'Font Size' },\n { value: 'font-weight', label: 'Font Weight' },\n { value: 'line-height', label: 'Line Height' },\n { value: 'letter-spacing', label: 'Letter Spacing' },\n { value: 'margin', label: 'Margin' },\n { value: 'padding', label: 'Padding' },\n { value: 'gap', label: 'Gap' },\n { value: 'size', label: 'Size' },\n { value: 'position', label: 'Position' },\n { value: 'border-radius', label: 'Border Radius' },\n { value: 'border-width', label: 'Border Width' },\n { value: 'outline', label: 'Outline' },\n { value: 'shadow', label: 'Shadow' },\n { value: 'filter', label: 'Filter' },\n { value: 'duration', label: 'Duration' },\n { value: 'aspect-ratio', label: 'Aspect Ratio' },\n { value: 'opacity', label: 'Opacity' },\n { value: 'z-index', label: 'Z-Index' },\n { value: 'text-align', label: 'Text Align' },\n { value: 'other', label: 'Other' },\n];\n\n/** All valid group string values */\nexport const VARIABLE_GROUP_VALUES: VariableGroup[] = VARIABLE_GROUPS.map(g => g.value);\n\n/** Maps CSS property names to variable groups */\nconst CSS_PROPERTY_TO_GROUP: Record<string, VariableGroup> = {\n 'font-family': 'font-family',\n 'font-size': 'font-size',\n 'font-weight': 'font-weight',\n 'line-height': 'line-height',\n 'letter-spacing': 'letter-spacing',\n 'text-align': 'text-align',\n 'opacity': 'opacity',\n 'z-index': 'z-index',\n 'top': 'position',\n 'right': 'position',\n 'bottom': 'position',\n 'left': 'position',\n 'inset': 'position',\n 'inset-block': 'position',\n 'inset-inline': 'position',\n 'inset-block-start': 'position',\n 'inset-block-end': 'position',\n 'inset-inline-start': 'position',\n 'inset-inline-end': 'position',\n 'box-shadow': 'shadow',\n 'text-shadow': 'shadow',\n 'filter': 'filter',\n 'backdrop-filter': 'filter',\n 'aspect-ratio': 'aspect-ratio',\n 'transition-duration': 'duration',\n 'animation-duration': 'duration',\n 'transition-delay': 'duration',\n 'animation-delay': 'duration',\n};\n\n/** Prefix-based mappings for CSS properties */\nconst CSS_PROPERTY_PREFIX_GROUPS: { prefix: string; group: VariableGroup }[] = [\n { prefix: 'margin', group: 'margin' },\n { prefix: 'padding', group: 'padding' },\n { prefix: 'gap', group: 'gap' },\n { prefix: 'row-gap', group: 'gap' },\n { prefix: 'column-gap', group: 'gap' },\n { prefix: 'width', group: 'size' },\n { prefix: 'height', group: 'size' },\n { prefix: 'min-width', group: 'size' },\n { prefix: 'max-width', group: 'size' },\n { prefix: 'min-height', group: 'size' },\n { prefix: 'max-height', group: 'size' },\n { prefix: 'border-radius', group: 'border-radius' },\n { prefix: 'border-top-left-radius', group: 'border-radius' },\n { prefix: 'border-top-right-radius', group: 'border-radius' },\n { prefix: 'border-bottom-left-radius', group: 'border-radius' },\n { prefix: 'border-bottom-right-radius', group: 'border-radius' },\n { prefix: 'border-width', group: 'border-width' },\n { prefix: 'border-top-width', group: 'border-width' },\n { prefix: 'border-right-width', group: 'border-width' },\n { prefix: 'border-bottom-width', group: 'border-width' },\n { prefix: 'border-left-width', group: 'border-width' },\n { prefix: 'outline-width', group: 'outline' },\n { prefix: 'outline-offset', group: 'outline' },\n];\n\n/**\n * Determines which variable group a CSS property belongs to.\n * Returns null if no group matches (show all variables).\n */\nexport function getGroupForProperty(prop: string): VariableGroup | null {\n // Normalize camelCase to kebab-case (e.g., \"fontFamily\" \u2192 \"font-family\")\n const normalized = prop.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`);\n\n // Exact match first\n if (normalized in CSS_PROPERTY_TO_GROUP) {\n return CSS_PROPERTY_TO_GROUP[normalized];\n }\n // Prefix-based match (handles margin-top, padding-left, etc.)\n for (const { prefix, group } of CSS_PROPERTY_PREFIX_GROUPS) {\n if (normalized === prefix || normalized.startsWith(prefix + '-')) {\n return group;\n }\n }\n return null;\n}\n\n/**\n * A single CSS custom property definition\n */\nexport interface CSSVariable {\n /** Display name (e.g., \"H1 Font Size\") */\n name: string;\n /** Optional prop name alias for organizational purposes */\n prop_name?: string;\n /** CSS custom property name (e.g., \"--h1-fs\") */\n cssVar: string;\n /** Base value (e.g., \"48px\") */\n value: string;\n /** Category for responsive scaling */\n type: VariableType;\n /** Optional per-variable breakpoint scale overrides */\n scales?: Record<string, string>;\n /** Optional UI filtering group for the variable picker */\n group?: VariableGroup;\n}\n\n/**\n * Variables configuration file structure (variables.json)\n */\nexport interface VariablesConfig {\n variables: CSSVariable[];\n}\n\n/** Predefined variable scaling types for UI dropdowns */\nexport const VARIABLE_TYPES: { value: VariableType; label: string }[] = [\n { value: 'fontSize', label: 'Font Size' },\n { value: 'padding', label: 'Padding' },\n { value: 'margin', label: 'Margin' },\n { value: 'gap', label: 'Gap' },\n { value: 'borderRadius', label: 'Border Radius' },\n { value: 'size', label: 'Width / Height' },\n { value: 'none', label: 'None' },\n];\n\n/** All valid variable scaling type values */\nexport const VARIABLE_TYPE_VALUES: VariableType[] = VARIABLE_TYPES.map(t => t.value);\n\n/**\n * Returns an abbreviation for a variable group by taking the first letter of each word.\n * e.g. 'letter-spacing' -> 'ls', 'font-size' -> 'fs', 'spacing' -> 's'\n */\nexport function getGroupAbbreviation(group: string): string {\n return group.split('-').map(w => w[0] || '').join('');\n}\n\n/**\n * Infers a default scaling type from a variable group and optional CSS property.\n */\nexport function getDefaultScalingType(group: string, cssProperty?: string): VariableType {\n if (group === 'font-size') return 'fontSize';\n if (group === 'margin') return 'margin';\n if (group === 'padding') return 'padding';\n if (group === 'gap') return 'gap';\n if (group === 'border-radius') return 'borderRadius';\n if (group === 'size') return 'size';\n return 'none';\n}\n\n/**\n * Generates a short CSS variable name with collision detection.\n * e.g. name=\"Heading\", group=\"letter-spacing\" -> \"--h-ls\"\n * If taken, extends prefix: \"--he-ls\", \"--hea-ls\", etc.\n */\nexport function generateShortCssVar(\n name: string,\n group: string,\n existingVariables: CSSVariable[]\n): string {\n const trimmed = name.trim();\n if (!trimmed) return '--';\n if (!group) {\n // No group: just kebab-case the name\n const base = '--' + trimmed.toLowerCase().replace(/\\s+/g, '-').replace(/[^a-z0-9-]/g, '');\n return ensureUnique(base, existingVariables);\n }\n\n const groupAbbr = getGroupAbbreviation(group);\n const kebabName = trimmed.toLowerCase().replace(/\\s+/g, '-').replace(/[^a-z0-9-]/g, '');\n const words = kebabName.split('-').filter(Boolean);\n const existingNames = new Set(existingVariables.map(v => v.cssVar));\n\n // Try progressively longer prefixes from the name\n // Start with first letter of each word, then extend first word\n const initials = words.map(w => w[0] || '').join('');\n const initialCandidate = `--${initials}-${groupAbbr}`;\n if (!existingNames.has(initialCandidate)) return initialCandidate;\n\n // Extend first word progressively\n const firstWord = words[0] || '';\n for (let len = 2; len <= firstWord.length; len++) {\n const prefix = firstWord.slice(0, len) + (words.length > 1 ? words.slice(1).map(w => w[0] || '').join('') : '');\n const candidate = `--${prefix}-${groupAbbr}`;\n if (!existingNames.has(candidate)) return candidate;\n }\n\n // Full kebab name with group abbreviation\n const fullCandidate = `--${kebabName}-${groupAbbr}`;\n if (!existingNames.has(fullCandidate)) return fullCandidate;\n\n // Numeric suffix fallback\n let i = 2;\n while (existingNames.has(`${fullCandidate}-${i}`)) i++;\n return `${fullCandidate}-${i}`;\n}\n\nfunction ensureUnique(base: string, existingVariables: CSSVariable[]): string {\n const existingNames = new Set(existingVariables.map(v => v.cssVar));\n if (!existingNames.has(base)) return base;\n let i = 2;\n while (existingNames.has(`${base}-${i}`)) i++;\n return `${base}-${i}`;\n}\n", "/**\n * Path Security Utilities\n * Provides path traversal protection for file system operations\n */\n\nimport { resolve, sep } from 'path';\n\n/**\n * Error thrown when a path traversal attack is detected\n */\nexport class PathTraversalError extends Error {\n constructor(\n public readonly requestedPath: string,\n public readonly rootPath: string\n ) {\n super(`Path traversal detected: \"${requestedPath}\" escapes root \"${rootPath}\"`);\n this.name = 'PathTraversalError';\n }\n}\n\n/**\n * Check if a resolved path is within the allowed root directory\n * Uses path.resolve() to normalize and handle .. sequences\n *\n * @param requestedPath - The path to validate (can be relative or absolute)\n * @param rootPath - The root directory that paths must be within\n * @returns true if the path is within root, false otherwise\n */\nexport function isPathWithinRoot(requestedPath: string, rootPath: string): boolean {\n const normalizedRoot = resolve(rootPath);\n const normalizedPath = resolve(rootPath, requestedPath);\n\n // Check that normalized path starts with root + separator\n // Adding separator prevents /project-backup from matching /project\n return normalizedPath === normalizedRoot || normalizedPath.startsWith(normalizedRoot + sep);\n}\n\n/**\n * Resolve a path safely, throwing if it would escape the root\n *\n * @param rootPath - The root directory\n * @param segments - Path segments to join\n * @returns The resolved path\n * @throws PathTraversalError if path escapes root\n */\nexport function resolveSafePath(rootPath: string, ...segments: string[]): string {\n const normalizedRoot = resolve(rootPath);\n const normalizedPath = resolve(normalizedRoot, ...segments);\n\n if (!normalizedPath.startsWith(normalizedRoot + sep) && normalizedPath !== normalizedRoot) {\n throw new PathTraversalError(segments.join(sep), rootPath);\n }\n\n return normalizedPath;\n}\n\n/**\n * Validate that a filename/identifier contains no path traversal sequences\n * Use for collection names, filenames, etc.\n *\n * @param name - The name to validate\n * @returns true if safe, false if contains traversal sequences\n */\nexport function isSafePathSegment(name: string): boolean {\n // Reject empty names\n if (!name || name.trim() === '') return false;\n\n // Reject names with path separators\n if (name.includes('/') || name.includes('\\\\')) return false;\n\n // Reject . and ..\n if (name === '.' || name === '..') return false;\n\n // Reject names starting with .. (e.g., \"..foo\")\n if (name.startsWith('..')) return false;\n\n // Reject null bytes (used in some attacks)\n if (name.includes('\\0')) return false;\n\n return true;\n}\n\n/**\n * Regex for valid CMS identifiers (collection names, filenames)\n * Allows alphanumeric, underscore, hyphen\n */\nexport const SAFE_IDENTIFIER_REGEX = /^[a-zA-Z0-9_-]+$/;\n\n/**\n * Validate a CMS identifier (stricter than isSafePathSegment)\n * Use for collection IDs and filenames that should only contain safe chars\n */\nexport function isValidIdentifier(name: string): boolean {\n return SAFE_IDENTIFIER_REGEX.test(name);\n}\n"],
5
- "mappings": ";AAyGO,SAAS,qBAAqB,KAAgD;AACnF,SAAO,IAAI,SAAS;AACtB;AAKO,SAAS,qBAAqB,KAAgD;AACnF,SAAO,IAAI,SAAS;AACtB;;;AC9EO,SAAS,sBACd,SACA,SAKiB;AACjB,SAAO;AAAA,IACL;AAAA,IACA,GAAG;AAAA,EACL;AACF;AAKO,SAAS,sBACd,SACA,SAKiB;AACjB,QAAM,QAAQ,IAAI,MAAM,OAAO;AAC/B,SAAO,eAAe,OAAO,QAAQ,EAAE,OAAO,SAAS,MAAM,UAAU,MAAM,CAAC;AAC9E,SAAO,eAAe,OAAO,iBAAiB,EAAE,OAAO,SAAS,eAAe,UAAU,MAAM,CAAC;AAChG,SAAO,eAAe,OAAO,gBAAgB,EAAE,OAAO,SAAS,cAAc,UAAU,MAAM,CAAC;AAC9F,SAAO;AACT;;;AC/BO,SAAS,oBAAoB,OAAe,SAA0C;AAC3F,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,KAAK,KAAK;AAC3B;;;ACLO,IAAM,kBAA6D;AAAA,EACxE,EAAE,OAAO,eAAe,OAAO,cAAc;AAAA,EAC7C,EAAE,OAAO,aAAa,OAAO,YAAY;AA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Node } from './nodes';\nimport type { LibrariesConfig } from './libraries';\n\n/**\n * Prop type definitions\n */\nexport type PropType = 'string' | 'select' | 'boolean' | 'number' | 'link' | 'file' | 'rich-text' | 'embed' | 'list';\n\n/**\n * Project-level enum configuration\n * Keys are enum names, values are arrays of options\n */\nexport type EnumsConfig = Record<string, readonly string[]>;\n\n/**\n * Internationalization (i18n) value object\n * Keys are locale codes (e.g., 'en', 'pl', 'de')\n * Values can be strings (for string props) or arrays (for list props)\n */\nexport interface I18nValue {\n _i18n: true;\n [locale: string]: string | unknown[] | true; // true is for the _i18n marker, arrays for list props\n}\n\n/**\n * Locale configuration with metadata\n */\nexport interface LocaleConfig {\n code: string; // URL prefix & translation key (e.g., \"en\", \"pl\")\n name: string; // English name for admin UI (e.g., \"Polish\")\n nativeName: string; // Native name for public UI (e.g., \"Polski\")\n langTag: string; // BCP 47 language tag for SEO (e.g., \"pl-PL\")\n icon?: string; // Optional flag icon path (e.g., \"/icons/flag-en.svg\")\n}\n\n/**\n * Internationalization configuration\n */\nexport interface I18nConfig {\n defaultLocale: string;\n locales: LocaleConfig[];\n}\n\n/**\n * Value resolver function type\n * Used for transforming field values (e.g., i18n resolution)\n */\nexport type ValueResolver = (value: unknown) => unknown;\n\n/**\n * Link prop value type\n */\nexport interface LinkPropValue {\n href: string;\n target?: '_blank';\n}\n\n/**\n * Base prop definition without list-specific fields\n */\nexport interface BasePropDefinition {\n type: Exclude<PropType, 'list'>;\n default?: string | number | boolean | I18nValue | LinkPropValue;\n options?: readonly string[]; // Required for \"select\" type (inline options)\n enumName?: string; // For \"select\" type: reference to project-level enum\n accept?: string; // For \"file\" type: MIME pattern like \"image/*\", \"video/*\"\n editor?: 'basic' | 'extended'; // For 'rich-text' type: which editor to use\n}\n\n/**\n * List item schema - defines the structure of each item in a list prop\n * Uses the same prop types as component interfaces (except nested lists)\n */\nexport type ListItemSchema = Record<string, BasePropDefinition>;\n\n/**\n * List item value type\n * Supports i18n values for localized string fields\n */\nexport type ListItemValue = Record<string, string | number | boolean | LinkPropValue | I18nValue | null>;\n\n/**\n * List prop definition - for array/list data\n */\nexport interface ListPropDefinition {\n type: 'list';\n /** Schema defining the structure of each list item */\n itemSchema: ListItemSchema;\n /** Default value is an array of items */\n default?: ListItemValue[];\n}\n\n/**\n * Prop definition with improved type safety\n */\nexport type PropDefinition = BasePropDefinition | ListPropDefinition;\n\n/**\n * Type guard to check if a prop definition is a list type\n */\nexport function isListPropDefinition(def: PropDefinition): def is ListPropDefinition {\n return def.type === 'list';\n}\n\n/**\n * Type guard to check if a prop definition is a base (non-list) type\n */\nexport function isBasePropDefinition(def: PropDefinition): def is BasePropDefinition {\n return def.type !== 'list';\n}\n\n/**\n * Structured component definition\n */\nexport interface StructuredComponentDefinition {\n interface?: Record<string, PropDefinition>;\n structure?: ComponentNode;\n javascript?: string; // Vanilla JS code to be rendered at end of HTML\n css?: string; // CSS code to be rendered in <style> tag in <head>\n category?: string; // Component category for organization\n /**\n * Define which props are available as JavaScript variables (Astro-style define:vars)\n * - true: all props from interface are exposed\n * - string[]: only specified props are exposed\n * - undefined: no automatic prop injection (backward compatible)\n */\n defineVars?: true | string[];\n /** External JS/CSS libraries required by this component */\n libraries?: LibrariesConfig;\n /** Whether instances of this component can have styles applied to the wrapper */\n acceptsStyles?: boolean;\n}\n\n/**\n * Component definition\n * Supports both new format (just component) and legacy format (type/props/children/component)\n */\nexport interface ComponentDefinition {\n type?: string; // Legacy format\n props?: Record<string, unknown>; // Legacy format\n children?: unknown[]; // Legacy format\n component: StructuredComponentDefinition;\n}\n\n/**\n * Line range for element line number tracking\n */\nexport interface LineRange {\n startLine: number;\n endLine: number;\n}\n\n/**\n * JSON page structure\n */\nexport interface JSONPage {\n meta?: import('./api').PageMetaData;\n components?: Record<string, ComponentDefinition>;\n root?: ComponentNode;\n _lineMap?: Record<string, LineRange>;\n}\n\n/**\n * Page data type that can be either a JSONPage or a component definition structure\n */\nexport type PageData = JSONPage | {\n component: {\n structure?: ComponentNode;\n interface?: Record<string, PropDefinition>;\n javascript?: string;\n css?: string;\n acceptsStyles?: boolean;\n }\n};\n\n/**\n * Page data with component structure (for type narrowing)\n */\nexport interface PageDataWithComponent {\n component: {\n structure?: ComponentNode;\n interface?: Record<string, PropDefinition>;\n javascript?: string;\n css?: string;\n libraries?: LibrariesConfig;\n acceptsStyles?: boolean;\n };\n}\n", "/**\n * Error Types\n * Structured error types for validation and type safety\n */\n\n/**\n * Validation error with context\n */\nexport interface ValidationError {\n path?: string;\n message: string;\n receivedValue?: unknown;\n expectedType?: string;\n}\n\n/**\n * Type safety error\n * Errors from type mismatches or invalid data structures\n */\nexport interface TypeSafetyError extends Error {\n readonly path?: string;\n readonly receivedValue?: unknown;\n readonly expectedType?: string;\n}\n\n/**\n * Result type for operations that can fail\n * Replaces null returns with explicit success/failure\n */\nexport type Result<T> =\n | { success: true; data: T }\n | { success: false; error: ValidationError };\n\n/**\n * Create a validation error\n */\nexport function createValidationError(\n message: string,\n options?: {\n path?: string;\n receivedValue?: unknown;\n expectedType?: string;\n }\n): ValidationError {\n return {\n message,\n ...options,\n };\n}\n\n/**\n * Create a type safety error\n */\nexport function createTypeSafetyError(\n message: string,\n options?: {\n path?: string;\n receivedValue?: unknown;\n expectedType?: string;\n }\n): TypeSafetyError {\n const error = new Error(message) as TypeSafetyError;\n Object.defineProperty(error, 'path', { value: options?.path, writable: false });\n Object.defineProperty(error, 'receivedValue', { value: options?.receivedValue, writable: false });\n Object.defineProperty(error, 'expectedType', { value: options?.expectedType, writable: false });\n return error;\n}\n\n\n", "/**\n * Color Variables Types\n * Handles color variable definitions and configuration\n */\n\n/**\n * Color variables configuration\n * Maps semantic color names to their hex/rgb values\n */\nexport interface ColorVariables {\n colors: Record<string, string>;\n}\n\n/**\n * Theme configuration with color set and metadata\n */\nexport interface Theme {\n label: string;\n colors: Record<string, string>;\n}\n\n/**\n * Theme configuration file structure\n * Supports multiple named themes with a default theme\n */\nexport interface ThemeConfig {\n default: string;\n palette?: Record<string, string>;\n themes: Record<string, Theme>;\n}\n\n/**\n * Resolve a color value through the palette.\n * If value matches a palette key, returns the palette hex; otherwise returns value as-is.\n */\nexport function resolvePaletteColor(value: string, palette?: Record<string, string>): string {\n if (!palette) return value;\n return palette[value] ?? value;\n}\n\n/**\n * Color variable entry for editor display\n */\nexport interface ColorVariableEntry {\n name: string;\n value: string;\n}\n\n/**\n * Theme entry for theme selector\n */\nexport interface ThemeEntry {\n name: string;\n label: string;\n}\n", "/**\n * CSS Variables Types\n * Defines types for the variables.json configuration file\n */\n\n/**\n * Category type for a CSS variable\n * Maps to responsiveScales categories for automatic responsive scaling\n * 'none' means no responsive scaling is applied\n */\nexport type VariableType = 'fontSize' | 'padding' | 'margin' | 'gap' | 'borderRadius' | 'size' | 'none';\n\n/**\n * UI filtering group for a CSS variable.\n * Controls which variables appear in the picker based on the CSS property being edited.\n */\nexport type VariableGroup =\n | 'font-family' | 'font-size' | 'font-weight'\n | 'line-height' | 'letter-spacing'\n | 'margin' | 'padding' | 'gap'\n | 'size'\n | 'position'\n | 'border-radius' | 'border-width'\n | 'outline'\n | 'shadow'\n | 'filter'\n | 'duration'\n | 'aspect-ratio'\n | 'opacity' | 'z-index'\n | 'text-align'\n | 'other';\n\n/** Predefined variable groups for UI dropdowns */\nexport const VARIABLE_GROUPS: { value: VariableGroup; label: string }[] = [\n { value: 'font-family', label: 'Font Family' },\n { value: 'font-size', label: 'Font Size' },\n { value: 'font-weight', label: 'Font Weight' },\n { value: 'line-height', label: 'Line Height' },\n { value: 'letter-spacing', label: 'Letter Spacing' },\n { value: 'margin', label: 'Margin' },\n { value: 'padding', label: 'Padding' },\n { value: 'gap', label: 'Gap' },\n { value: 'size', label: 'Size' },\n { value: 'position', label: 'Position' },\n { value: 'border-radius', label: 'Border Radius' },\n { value: 'border-width', label: 'Border Width' },\n { value: 'outline', label: 'Outline' },\n { value: 'shadow', label: 'Shadow' },\n { value: 'filter', label: 'Filter' },\n { value: 'duration', label: 'Duration' },\n { value: 'aspect-ratio', label: 'Aspect Ratio' },\n { value: 'opacity', label: 'Opacity' },\n { value: 'z-index', label: 'Z-Index' },\n { value: 'text-align', label: 'Text Align' },\n { value: 'other', label: 'Other' },\n];\n\n/** All valid group string values */\nexport const VARIABLE_GROUP_VALUES: VariableGroup[] = VARIABLE_GROUPS.map(g => g.value);\n\n/** Maps CSS property names to variable groups */\nconst CSS_PROPERTY_TO_GROUP: Record<string, VariableGroup> = {\n 'font-family': 'font-family',\n 'font-size': 'font-size',\n 'font-weight': 'font-weight',\n 'line-height': 'line-height',\n 'letter-spacing': 'letter-spacing',\n 'text-align': 'text-align',\n 'opacity': 'opacity',\n 'z-index': 'z-index',\n 'top': 'position',\n 'right': 'position',\n 'bottom': 'position',\n 'left': 'position',\n 'inset': 'position',\n 'inset-block': 'position',\n 'inset-inline': 'position',\n 'inset-block-start': 'position',\n 'inset-block-end': 'position',\n 'inset-inline-start': 'position',\n 'inset-inline-end': 'position',\n 'box-shadow': 'shadow',\n 'text-shadow': 'shadow',\n 'filter': 'filter',\n 'backdrop-filter': 'filter',\n 'aspect-ratio': 'aspect-ratio',\n 'transition-duration': 'duration',\n 'animation-duration': 'duration',\n 'transition-delay': 'duration',\n 'animation-delay': 'duration',\n};\n\n/** Prefix-based mappings for CSS properties */\nconst CSS_PROPERTY_PREFIX_GROUPS: { prefix: string; group: VariableGroup }[] = [\n { prefix: 'margin', group: 'margin' },\n { prefix: 'padding', group: 'padding' },\n { prefix: 'gap', group: 'gap' },\n { prefix: 'row-gap', group: 'gap' },\n { prefix: 'column-gap', group: 'gap' },\n { prefix: 'width', group: 'size' },\n { prefix: 'height', group: 'size' },\n { prefix: 'min-width', group: 'size' },\n { prefix: 'max-width', group: 'size' },\n { prefix: 'min-height', group: 'size' },\n { prefix: 'max-height', group: 'size' },\n { prefix: 'border-radius', group: 'border-radius' },\n { prefix: 'border-top-left-radius', group: 'border-radius' },\n { prefix: 'border-top-right-radius', group: 'border-radius' },\n { prefix: 'border-bottom-left-radius', group: 'border-radius' },\n { prefix: 'border-bottom-right-radius', group: 'border-radius' },\n { prefix: 'border-width', group: 'border-width' },\n { prefix: 'border-top-width', group: 'border-width' },\n { prefix: 'border-right-width', group: 'border-width' },\n { prefix: 'border-bottom-width', group: 'border-width' },\n { prefix: 'border-left-width', group: 'border-width' },\n { prefix: 'outline-width', group: 'outline' },\n { prefix: 'outline-offset', group: 'outline' },\n];\n\n/**\n * Determines which variable group a CSS property belongs to.\n * Returns null if no group matches (show all variables).\n */\nexport function getGroupForProperty(prop: string): VariableGroup | null {\n // Normalize camelCase to kebab-case (e.g., \"fontFamily\" \u2192 \"font-family\")\n const normalized = prop.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`);\n\n // Exact match first\n if (normalized in CSS_PROPERTY_TO_GROUP) {\n return CSS_PROPERTY_TO_GROUP[normalized];\n }\n // Prefix-based match (handles margin-top, padding-left, etc.)\n for (const { prefix, group } of CSS_PROPERTY_PREFIX_GROUPS) {\n if (normalized === prefix || normalized.startsWith(prefix + '-')) {\n return group;\n }\n }\n return null;\n}\n\n/**\n * A single CSS custom property definition\n */\nexport interface CSSVariable {\n /** Display name (e.g., \"H1 Font Size\") */\n name: string;\n /** Optional prop name alias for organizational purposes */\n prop_name?: string;\n /** CSS custom property name (e.g., \"--h1-fs\") */\n cssVar: string;\n /** Base value (e.g., \"48px\") */\n value: string;\n /** Category for responsive scaling */\n type: VariableType;\n /** Optional per-variable breakpoint scale overrides */\n scales?: Record<string, string>;\n /** Optional UI filtering group for the variable picker */\n group?: VariableGroup;\n}\n\n/**\n * Variables configuration file structure (variables.json)\n */\nexport interface VariablesConfig {\n variables: CSSVariable[];\n}\n\n/** Predefined variable scaling types for UI dropdowns */\nexport const VARIABLE_TYPES: { value: VariableType; label: string }[] = [\n { value: 'fontSize', label: 'Font Size' },\n { value: 'padding', label: 'Padding' },\n { value: 'margin', label: 'Margin' },\n { value: 'gap', label: 'Gap' },\n { value: 'borderRadius', label: 'Border Radius' },\n { value: 'size', label: 'Width / Height' },\n { value: 'none', label: 'None' },\n];\n\n/** All valid variable scaling type values */\nexport const VARIABLE_TYPE_VALUES: VariableType[] = VARIABLE_TYPES.map(t => t.value);\n\n/**\n * Returns an abbreviation for a variable group by taking the first letter of each word.\n * e.g. 'letter-spacing' -> 'ls', 'font-size' -> 'fs', 'spacing' -> 's'\n */\nexport function getGroupAbbreviation(group: string): string {\n return group.split('-').map(w => w[0] || '').join('');\n}\n\n/**\n * Infers a default scaling type from a variable group and optional CSS property.\n */\nexport function getDefaultScalingType(group: string, cssProperty?: string): VariableType {\n if (group === 'font-size') return 'fontSize';\n if (group === 'margin') return 'margin';\n if (group === 'padding') return 'padding';\n if (group === 'gap') return 'gap';\n if (group === 'border-radius') return 'borderRadius';\n if (group === 'size') return 'size';\n return 'none';\n}\n\n/**\n * Generates a short CSS variable name with collision detection.\n * e.g. name=\"Heading\", group=\"letter-spacing\" -> \"--h-ls\"\n * If taken, extends prefix: \"--he-ls\", \"--hea-ls\", etc.\n */\nexport function generateShortCssVar(\n name: string,\n group: string,\n existingVariables: CSSVariable[]\n): string {\n const trimmed = name.trim();\n if (!trimmed) return '--';\n if (!group) {\n // No group: just kebab-case the name\n const base = '--' + trimmed.toLowerCase().replace(/\\s+/g, '-').replace(/[^a-z0-9-]/g, '');\n return ensureUnique(base, existingVariables);\n }\n\n const groupAbbr = getGroupAbbreviation(group);\n const kebabName = trimmed.toLowerCase().replace(/\\s+/g, '-').replace(/[^a-z0-9-]/g, '');\n const words = kebabName.split('-').filter(Boolean);\n const existingNames = new Set(existingVariables.map(v => v.cssVar));\n\n // Try progressively longer prefixes from the name\n // Start with first letter of each word, then extend first word\n const initials = words.map(w => w[0] || '').join('');\n const initialCandidate = `--${initials}-${groupAbbr}`;\n if (!existingNames.has(initialCandidate)) return initialCandidate;\n\n // Extend first word progressively\n const firstWord = words[0] || '';\n for (let len = 2; len <= firstWord.length; len++) {\n const prefix = firstWord.slice(0, len) + (words.length > 1 ? words.slice(1).map(w => w[0] || '').join('') : '');\n const candidate = `--${prefix}-${groupAbbr}`;\n if (!existingNames.has(candidate)) return candidate;\n }\n\n // Full kebab name with group abbreviation\n const fullCandidate = `--${kebabName}-${groupAbbr}`;\n if (!existingNames.has(fullCandidate)) return fullCandidate;\n\n // Numeric suffix fallback\n let i = 2;\n while (existingNames.has(`${fullCandidate}-${i}`)) i++;\n return `${fullCandidate}-${i}`;\n}\n\nfunction ensureUnique(base: string, existingVariables: CSSVariable[]): string {\n const existingNames = new Set(existingVariables.map(v => v.cssVar));\n if (!existingNames.has(base)) return base;\n let i = 2;\n while (existingNames.has(`${base}-${i}`)) i++;\n return `${base}-${i}`;\n}\n", "/**\n * Path Security Utilities\n * Provides path traversal protection for file system operations\n */\n\nimport { resolve, sep } from 'path';\n\n/**\n * Error thrown when a path traversal attack is detected\n */\nexport class PathTraversalError extends Error {\n constructor(\n public readonly requestedPath: string,\n public readonly rootPath: string\n ) {\n super(`Path traversal detected: \"${requestedPath}\" escapes root \"${rootPath}\"`);\n this.name = 'PathTraversalError';\n }\n}\n\n/**\n * Check if a resolved path is within the allowed root directory\n * Uses path.resolve() to normalize and handle .. sequences\n *\n * @param requestedPath - The path to validate (can be relative or absolute)\n * @param rootPath - The root directory that paths must be within\n * @returns true if the path is within root, false otherwise\n */\nexport function isPathWithinRoot(requestedPath: string, rootPath: string): boolean {\n const normalizedRoot = resolve(rootPath);\n const normalizedPath = resolve(rootPath, requestedPath);\n\n // Check that normalized path starts with root + separator\n // Adding separator prevents /project-backup from matching /project\n return normalizedPath === normalizedRoot || normalizedPath.startsWith(normalizedRoot + sep);\n}\n\n/**\n * Resolve a path safely, throwing if it would escape the root\n *\n * @param rootPath - The root directory\n * @param segments - Path segments to join\n * @returns The resolved path\n * @throws PathTraversalError if path escapes root\n */\nexport function resolveSafePath(rootPath: string, ...segments: string[]): string {\n const normalizedRoot = resolve(rootPath);\n const normalizedPath = resolve(normalizedRoot, ...segments);\n\n if (!normalizedPath.startsWith(normalizedRoot + sep) && normalizedPath !== normalizedRoot) {\n throw new PathTraversalError(segments.join(sep), rootPath);\n }\n\n return normalizedPath;\n}\n\n/**\n * Validate that a filename/identifier contains no path traversal sequences\n * Use for collection names, filenames, etc.\n *\n * @param name - The name to validate\n * @returns true if safe, false if contains traversal sequences\n */\nexport function isSafePathSegment(name: string): boolean {\n // Reject empty names\n if (!name || name.trim() === '') return false;\n\n // Reject names with path separators\n if (name.includes('/') || name.includes('\\\\')) return false;\n\n // Reject . and ..\n if (name === '.' || name === '..') return false;\n\n // Reject names starting with .. (e.g., \"..foo\")\n if (name.startsWith('..')) return false;\n\n // Reject null bytes (used in some attacks)\n if (name.includes('\\0')) return false;\n\n return true;\n}\n\n/**\n * Regex for valid CMS identifiers (collection names, filenames)\n * Allows alphanumeric, underscore, hyphen\n */\nexport const SAFE_IDENTIFIER_REGEX = /^[a-zA-Z0-9_-]+$/;\n\n/**\n * Validate a CMS identifier (stricter than isSafePathSegment)\n * Use for collection IDs and filenames that should only contain safe chars\n */\nexport function isValidIdentifier(name: string): boolean {\n return SAFE_IDENTIFIER_REGEX.test(name);\n}\n\n/**\n * Suffix used for CMS draft files: `{filename}.draft.json`. The provider must\n * never accept user-supplied filenames ending in `.draft`, because that would\n * clash with the draft-suffix convention and let a user shadow another item's\n * draft file.\n */\nexport const CMS_DRAFT_SUFFIX = '.draft';\n\n/**\n * True when a user-supplied CMS filename collides with the reserved `.draft`\n * suffix. Use as a hard reject in CMS provider write paths.\n */\nexport function isReservedDraftFilename(filename: string): boolean {\n return filename.endsWith(CMS_DRAFT_SUFFIX);\n}\n"],
5
+ "mappings": ";AAyGO,SAAS,qBAAqB,KAAgD;AACnF,SAAO,IAAI,SAAS;AACtB;AAKO,SAAS,qBAAqB,KAAgD;AACnF,SAAO,IAAI,SAAS;AACtB;;;AC9EO,SAAS,sBACd,SACA,SAKiB;AACjB,SAAO;AAAA,IACL;AAAA,IACA,GAAG;AAAA,EACL;AACF;AAKO,SAAS,sBACd,SACA,SAKiB;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