meno-core 1.1.0 → 1.1.2

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 (34) hide show
  1. package/dist/chunks/{chunk-NUP7H7D3.js → chunk-7ZLF4NE5.js} +2 -2
  2. package/dist/chunks/{chunk-QWTQZHG3.js → chunk-FQBIC2OB.js} +1 -1
  3. package/dist/chunks/chunk-FQBIC2OB.js.map +7 -0
  4. package/dist/chunks/{chunk-2IIQK7T3.js → chunk-J4IPTP5X.js} +393 -3
  5. package/dist/chunks/{chunk-2IIQK7T3.js.map → chunk-J4IPTP5X.js.map} +3 -3
  6. package/dist/lib/client/index.js +2 -2
  7. package/dist/lib/server/index.js +804 -218
  8. package/dist/lib/server/index.js.map +4 -4
  9. package/dist/lib/shared/index.js +6 -2
  10. package/dist/lib/shared/index.js.map +2 -2
  11. package/lib/server/index.ts +19 -0
  12. package/lib/server/services/ColorService.ts +38 -7
  13. package/lib/server/services/VariableService.ts +34 -5
  14. package/lib/server/ssr/htmlGenerator.ts +18 -2
  15. package/lib/server/ssr/ssrRenderer.test.ts +25 -0
  16. package/lib/server/ssr/ssrRenderer.ts +12 -2
  17. package/lib/server/themeCssCodec.test.ts +154 -0
  18. package/lib/server/themeCssCodec.ts +488 -0
  19. package/lib/server/themeCssStore.test.ts +139 -0
  20. package/lib/server/themeCssStore.ts +210 -0
  21. package/lib/shared/cssGeneration.test.ts +10 -0
  22. package/lib/shared/cssGeneration.ts +10 -8
  23. package/lib/shared/index.ts +6 -0
  24. package/lib/shared/interactiveStyles.test.ts +3 -1
  25. package/lib/shared/tailwindThemeScale.ts +256 -0
  26. package/lib/shared/types/colors.ts +6 -2
  27. package/lib/shared/types/variables.ts +14 -7
  28. package/lib/shared/utilityClassConfig.ts +116 -0
  29. package/lib/shared/utilityClassMapper.test.ts +148 -0
  30. package/lib/shared/utilityClassMapper.ts +33 -0
  31. package/lib/shared/utilityClassNames.ts +146 -0
  32. package/package.json +1 -1
  33. package/dist/chunks/chunk-QWTQZHG3.js.map +0 -7
  34. /package/dist/chunks/{chunk-NUP7H7D3.js.map → chunk-7ZLF4NE5.js.map} +0 -0
@@ -16,7 +16,7 @@ import {
16
16
  normalizeStyle,
17
17
  richTextMarkerToHtml,
18
18
  safeEvaluate
19
- } from "./chunk-2IIQK7T3.js";
19
+ } from "./chunk-J4IPTP5X.js";
20
20
  import {
21
21
  NODE_TYPE,
22
22
  RAW_HTML_PREFIX,
@@ -805,4 +805,4 @@ export {
805
805
  skipEmptyTemplateAttributes,
806
806
  inlineSvgStyleRules
807
807
  };
808
- //# sourceMappingURL=chunk-NUP7H7D3.js.map
808
+ //# sourceMappingURL=chunk-7ZLF4NE5.js.map
@@ -618,4 +618,4 @@ export {
618
618
  isReservedDraftFilename,
619
619
  rewriteComponentRefs
620
620
  };
621
- //# sourceMappingURL=chunk-QWTQZHG3.js.map
621
+ //# sourceMappingURL=chunk-FQBIC2OB.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../lib/shared/fontCss.ts", "../../lib/shared/logger.ts", "../../lib/shared/types/components.ts", "../../lib/shared/types/errors.ts", "../../lib/shared/types/colors.ts", "../../lib/shared/types/variables.ts", "../../lib/shared/types/comment.ts", "../../lib/shared/types/permissions.ts", "../../lib/shared/slugify.ts", "../../lib/shared/slugTranslator.ts", "../../lib/shared/libraryLoader.ts", "../../lib/shared/pathSecurity.ts", "../../lib/shared/componentRefs.ts"],
4
+ "sourcesContent": ["/**\n * Pure `@font-face` / preload generation from a list of font configs.\n *\n * No filesystem or project-context coupling \u2014 the caller passes the `fonts`\n * array (read however it likes). This is the single source of truth for font\n * CSS formatting, shared by every renderer:\n * - meno-core SSR \u2192 via {@link ../shared/fontLoader} (cached config)\n * - meno-core JSON\u2192Astro \u2192 build-astro.ts\n * - meno-astro dialect twin \u2192 meno-astro/server `loadFontCss` \u2192 BaseLayout.astro\n *\n * Keeping it server-free means the Astro `BaseLayout` can import it without\n * dragging meno-core's server runtime into the build.\n */\n\nexport interface FontConfig {\n path: string;\n family?: string;\n weight?: number;\n weightMax?: number; // If set, font is variable with weight range [weight, weightMax]\n style?: 'normal' | 'italic';\n fontDisplay?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';\n unicodeRange?: string;\n /** Legacy alias for `path` (emitted by the website-import flow). */\n src?: string;\n}\n\n/** Detect the `@font-face` `format()` value from a file extension. */\nfunction getFontFormat(path: string): string {\n if (path.endsWith('.woff2')) return 'woff2';\n if (path.endsWith('.woff')) return 'woff';\n if (path.endsWith('.ttf')) return 'truetype';\n if (path.endsWith('.otf')) return 'opentype';\n return 'truetype';\n}\n\n/** Font `type` attribute for a `<link rel=\"preload\">`. */\nfunction getFontMimeType(path: string): string {\n if (path.endsWith('.woff2')) return 'font/woff2';\n if (path.endsWith('.woff')) return 'font/woff';\n if (path.endsWith('.ttf')) return 'font/ttf';\n if (path.endsWith('.otf')) return 'font/otf';\n return 'font/ttf';\n}\n\n/**\n * Derive a family name from a path when none is configured.\n * Example: \"/fonts/geomanist-regular.ttf\" -> \"Geomanist Regular\".\n */\nexport function extractFamilyName(path: string): string {\n const filename = path.split('/').pop() || 'Font';\n const name = filename.replace(/\\.(ttf|woff2?|otf)$/i, '');\n return name\n .split('-')\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(' ');\n}\n\n/** Build the `@font-face` rules for the given fonts (empty string for none). */\nexport function fontFaceCss(fonts: FontConfig[]): string {\n return (fonts || [])\n .filter((font) => font.path || font.src)\n .map((font) => {\n // Support both \"path\" (standard) and \"src\" (legacy from website import)\n const fontPath = (font.path || font.src) as string;\n const format = getFontFormat(fontPath);\n const family = font.family || extractFamilyName(fontPath);\n const weight = font.weight ?? 400;\n const weightMax = font.weightMax;\n const style = font.style ?? 'normal';\n const fontDisplay = font.fontDisplay;\n\n // Variable fonts use weight range syntax: \"100 900\"\n const fontWeight = weightMax != null ? `${weight} ${weightMax}` : weight;\n const unicodeRange = font.unicodeRange;\n\n return `@font-face {\n font-family: '${family}';\n src: url('${fontPath}') format('${format}');\n font-weight: ${fontWeight};\n font-style: ${style};${fontDisplay ? `\\n font-display: ${fontDisplay};` : ''}${unicodeRange ? `\\n unicode-range: ${unicodeRange};` : ''}\n}`;\n })\n .join('\\n\\n');\n}\n\n/**\n * Build `<link rel=\"preload\">` tags for the given fonts (empty string for none).\n * `crossorigin` is required for the preloaded font to be reused by the CSS.\n */\nexport function fontPreloadLinks(fonts: FontConfig[]): string {\n if (!fonts || fonts.length === 0) return '';\n\n return fonts\n .filter((font) => font.path || font.src)\n .map((font) => {\n const fontPath = (font.path || font.src) as string;\n const mimeType = getFontMimeType(fontPath);\n return `<link rel=\"preload\" href=\"${fontPath}\" as=\"font\" type=\"${mimeType}\" crossorigin>`;\n })\n .join('\\n ');\n}\n", "/**\n * Leveled logger \u2014 the single console abstraction for Meno runtime/server code.\n *\n * Why: the codebase had hundreds of raw `console.*` calls with no way to gate\n * verbosity in the field (a packaged desktop app emits everything, with no level\n * control and no telemetry path). This module adds:\n * - levels (silent < error < warn < info < debug), gated by `MENO_LOG_LEVEL`\n * (or `NODE_ENV`: `production` \u2192 warn, otherwise \u2192 debug);\n * - per-scope loggers (`createLogger('AstroProvider')`) that prefix messages;\n * - a pluggable sink (`setLogSink`) so the Electron main process / telemetry can\n * capture logs and crashes instead of (or in addition to) the console.\n *\n * Isomorphic: works in Node and the browser. Error reporting still flows through\n * `errorLogger` (`logRuntimeError`/`logNetworkError`); this is for general\n * debug/info/warn/error console output.\n */\n\nexport type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'debug';\n\nconst LEVEL_RANK: Record<LogLevel, number> = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };\n\n/** A record forwarded to the sink for every emitted log line. */\nexport interface LogRecord {\n level: Exclude<LogLevel, 'silent'>;\n scope: string;\n message: string;\n args: unknown[];\n timestamp: number;\n}\n\ntype LogSink = (record: LogRecord) => void;\n\nlet sink: LogSink | null = null;\n\n/** Install a sink (telemetry / Electron capture). Pass `null` to remove. */\nexport function setLogSink(next: LogSink | null): void {\n sink = next;\n}\n\nfunction defaultLevel(): LogLevel {\n const env = typeof process !== 'undefined' ? process.env : undefined;\n const explicit = env?.MENO_LOG_LEVEL?.toLowerCase();\n if (explicit && explicit in LEVEL_RANK) return explicit as LogLevel;\n return env?.NODE_ENV === 'production' ? 'warn' : 'debug';\n}\n\nlet currentLevel: LogLevel = defaultLevel();\n\n/** Override the active level at runtime (e.g. a debug toggle in the app). */\nexport function setLogLevel(level: LogLevel): void {\n currentLevel = level;\n}\n\n/** The active level (resolved from env at module load unless overridden). */\nexport function getLogLevel(): LogLevel {\n return currentLevel;\n}\n\nconst CONSOLE: Record<Exclude<LogLevel, 'silent'>, (...a: unknown[]) => void> = {\n error: (...a) => console.error(...a),\n warn: (...a) => console.warn(...a),\n info: (...a) => console.info(...a),\n debug: (...a) => console.debug(...a),\n};\n\nfunction emit(level: Exclude<LogLevel, 'silent'>, scope: string, message: string, args: unknown[]): void {\n if (LEVEL_RANK[level] > LEVEL_RANK[currentLevel]) return;\n const prefix = scope ? `[${scope}]` : '';\n CONSOLE[level](`${prefix} ${message}`.trimStart(), ...args);\n sink?.({ level, scope, message, args, timestamp: Date.now() });\n}\n\nexport interface Logger {\n debug(message: string, ...args: unknown[]): void;\n info(message: string, ...args: unknown[]): void;\n warn(message: string, ...args: unknown[]): void;\n error(message: string, ...args: unknown[]): void;\n /** A child logger nested under this scope (`parent:child`). */\n child(scope: string): Logger;\n}\n\n/** Create a scoped logger. `scope` is prefixed to every line and forwarded to the sink. */\nexport function createLogger(scope = ''): Logger {\n return {\n debug: (message, ...args) => emit('debug', scope, message, args),\n info: (message, ...args) => emit('info', scope, message, args),\n warn: (message, ...args) => emit('warn', scope, message, args),\n error: (message, ...args) => emit('error', scope, message, args),\n child: (childScope) => createLogger(scope ? `${scope}:${childScope}` : childScope),\n };\n}\n\n/** A default unscoped logger for ad-hoc use. Prefer a scoped `createLogger('Area')`. */\nexport const logger = createLogger();\n", "/**\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 * Verbatim frontmatter passthrough \u2014 hand-authored `.astro` frontmatter statements the\n * codec can't model (foreign `import`s, helper `const`/`function`s, `import.meta.env`\n * access, etc.). Captured byte-for-byte on parse and re-emitted unchanged so a component\n * carrying arbitrary frontmatter round-trips. Emit-side it is appended after the\n * generated frontmatter consts. See the dialect spec \u00A710 (escape hatches).\n */\n _frontmatter?: string;\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 * Verbatim frontmatter passthrough \u2014 hand-authored `.astro` frontmatter statements the\n * codec can't model (foreign `import`s, top-level `const`/`function`s, `getStaticPaths`\n * helpers, `import.meta.env` access, etc.). Captured byte-for-byte on parse and re-emitted\n * unchanged so a page carrying arbitrary frontmatter round-trips instead of being flagged\n * read-only. Emit-side it is appended after the generated `const meta`/frontmatter consts.\n * See the dialect spec \u00A710 (escape hatches).\n */\n _frontmatter?: string;\n /**\n * Set when the source file renders under Astro but is outside the meno-astro dialect\n * (can't be modeled into a node tree) \u2014 e.g. a hand-authored SSR page with arbitrary\n * frontmatter. The editor shows a read-only info state instead of a (lossy) tree, and the\n * Astro page provider's save() no-ops to protect the hand-authored source from clobber.\n */\n _unsupported?: { reason: string };\n}\n\n/**\n * Page data type that can be either a JSONPage or a component definition structure\n */\nexport type PageData =\n | JSONPage\n | {\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> = { success: true; data: T } | { 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 * 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 *\n * `label` is an editor-only display string. The theme.css codec does not persist\n * it (a theme is identified by its name \u2014 the `[theme=\"<name>\"]` selector), so it\n * is optional; consumers fall back to the (prettified) theme name.\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'\n | 'font-size'\n | 'font-weight'\n | 'line-height'\n | 'letter-spacing'\n | 'margin'\n | 'padding'\n | 'gap'\n | 'size'\n | 'position'\n | 'border-radius'\n | 'border-width'\n | 'outline'\n | 'shadow'\n | 'filter'\n | 'duration'\n | 'aspect-ratio'\n | 'opacity'\n | '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] ?? null;\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 *\n * Source of truth is `src/styles/theme.css` (the `theme.css` codec), so the CSS\n * variable name (`cssVar`) IS a token's identity \u2014 `name`/`prop_name` are\n * editor-only labels that the codec no longer persists, and `group`/`type` are\n * DERIVED on parse (from the var's comment-section header, falling back to a\n * value heuristic), not stored. They stay on the in-memory object because the\n * pickers and the responsive-scaling generator still consult them.\n */\nexport interface CSSVariable {\n /** Optional display label. Not persisted by the theme.css codec \u2014 defaults to `cssVar`. */\n name?: string;\n /** Optional prop name alias for organizational purposes (legacy; not persisted). */\n prop_name?: string;\n /** CSS custom property name (e.g., \"--h1-fs\") \u2014 the token's persistent identity. */\n cssVar: string;\n /** Base value (e.g., \"48px\") */\n value: string;\n /** Category for responsive scaling (derived from {@link group} via getDefaultScalingType). */\n type: VariableType;\n /** Optional per-variable breakpoint scale overrides */\n scales?: Record<string, string>;\n /** UI filtering group for the variable picker (derived from the theme.css comment section). */\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\n .split('-')\n .map((w) => w[0] || '')\n .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(name: string, group: string, existingVariables: CSSVariable[]): string {\n const trimmed = name.trim();\n if (!trimmed) return '--';\n if (!group) {\n // No group: just kebab-case the name\n const base =\n '--' +\n trimmed\n .toLowerCase()\n .replace(/\\s+/g, '-')\n .replace(/[^a-z0-9-]/g, '');\n return ensureUnique(base, existingVariables);\n }\n\n const groupAbbr = getGroupAbbreviation(group);\n const kebabName = trimmed\n .toLowerCase()\n .replace(/\\s+/g, '-')\n .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 =\n firstWord.slice(0, len) +\n (words.length > 1\n ? words\n .slice(1)\n .map((w) => w[0] || '')\n .join('')\n : '');\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 * Comment / Pin Types\n *\n * Comments are Figma-style pins placed on components in the studio canvas.\n * One file per pin (thread embedded). Storage layout (status as top folder):\n * {projectRoot}/comments/<status>/<pageSlug>--<seq>--<titleSlug>.json\n * e.g. comments/open/blog__post--3--hero-is-too-dark.json\n *\n * Pins are an authoring-time concept \u2014 they live in studio only.\n */\n\n/** Workflow status. No custom statuses for MVP. */\nexport type CommentStatus = 'open' | 'in-progress' | 'ready-for-review' | 'resolved' | 'closed';\n\nexport const COMMENT_STATUSES: readonly CommentStatus[] = [\n 'open',\n 'in-progress',\n 'ready-for-review',\n 'resolved',\n 'closed',\n] as const;\n\n/** Identifies the GitHub user who authored a thread entry. */\nexport interface CommentAuthor {\n /** GitHub login. `\"local\"` for non-electron / unauthenticated runs. */\n login: string;\n name?: string;\n avatarUrl?: string;\n}\n\n/**\n * Identity fingerprint for the anchored node \u2014 used to detect orphan pins\n * when the tree shifts. Mirrors the shape of `nodesMatch()` in NodeStore.\n */\nexport interface CommentNodeIdentity {\n /** `'component'` or `'node'` (HTML). */\n kind: 'component' | 'node';\n /** Component name (when kind=component) or HTML tag (when kind=node). */\n name: string;\n /** Editor-set label, used to disambiguate same-type siblings. */\n label?: string;\n}\n\n/**\n * One step of a {@link CommentAnchor.nodeRef}: a node addressed by its TYPE and\n * its occurrence among same-type siblings, rather than its raw child index. E.g.\n * `{ kind:'component', name:'HomeProducts', nth:0 }` = \"the first HomeProducts\n * under this parent\". Move-invariant: reordering/inserting/deleting siblings of\n * OTHER types doesn't change it (only reordering same-type instances does).\n */\nexport interface CommentNodeRefSegment {\n kind: 'component' | 'node';\n /** Component name (kind=component) or HTML tag / node type (kind=node). */\n name: string;\n /** 0-based occurrence among same-(kind,name) siblings under the same parent. */\n nth: number;\n}\n\n/**\n * Where the pin sits. Pins are ELEMENT-ANCHORED: a comment attaches to the\n * specific node/component the user picked (exactly like a selection), not to a\n * spot on the page. The anchor's source of truth is `nodeRef` \u2014 a type +\n * occurrence path from the page root (e.g. `HomeProducts[0]` \u2192\n * `Section[2] > Heading[4]`) \u2014 so a pin survives the section being moved,\n * inserted before, or its differently-typed siblings being deleted. `nodePath`\n * is a create-time positional snapshot kept only as a fallback for legacy pins\n * (no `nodeRef`). `cmsItemIndexPath` disambiguates which CMS-list copy was\n * clicked. The pin is drawn over the resolved element's rect;\n * `offsetXPercent`/`offsetYPercent` place it WITHIN that rect.\n *\n * The identity resolves to a DOM element in both the same-origin SSR canvas and\n * the cross-origin Astro play DOM (nodeRef \u2192 live nodePath \u2192 existing x-ray\n * pipeline), and survives the JSON\u2192.astro migration. When the node can no longer\n * be resolved the comment is \"detached\".\n */\nexport interface CommentAnchor {\n /**\n * Type + occurrence path from the page root \u2014 the move-resilient source of\n * truth for the anchored node. Absent only on legacy pins (fall back to\n * `nodePath`).\n */\n nodeRef?: CommentNodeRefSegment[];\n /** Create-time positional snapshot of the anchored node (fallback for legacy pins). */\n nodePath: number[];\n /**\n * CMS-list item path disambiguating which list copy the anchored element\n * belongs to (parallel to SelectionStore's `selectedCMSItemIndexPath`).\n * Absent when the element is not inside a CMS list.\n */\n cmsItemIndexPath?: number[];\n /** Identity fingerprint of the anchored node, used to detect orphan pins. */\n nodeIdentity: CommentNodeIdentity;\n /** Horizontal position WITHIN the anchored element's rect, 0..1 (default 0.5). */\n offsetXPercent: number;\n /** Vertical position WITHIN the anchored element's rect, 0..1 (default 0.5). */\n offsetYPercent: number;\n /**\n * Breakpoint frame this pin was placed on (e.g. `'base'`, `'tablet'`,\n * `'mobile'`). A pin is only shown on the frame where it was pinned. When\n * unset, the pin renders on every frame (or pins created before this field).\n */\n breakpoint?: string;\n}\n\n/** One message in a comment's thread (initial + replies). */\nexport interface CommentThreadEntry {\n id: string;\n author: CommentAuthor;\n /** ISO timestamp. */\n createdAt: string;\n text: string;\n /** When this entry transitioned the comment status, the target status. */\n statusChange: CommentStatus | null;\n}\n\n/** A pinned comment. */\nexport interface Comment {\n _id: string;\n _filename: string;\n /** Page path the pin lives on (e.g. `\"blog/post\"`). */\n _pagePath: string;\n /** Stable per-page badge number. Server assigns at create time. */\n _seq: number;\n /** ISO timestamps. */\n _createdAt: string;\n _updatedAt: string;\n /** Git HEAD SHA captured at create time, or null when unavailable. */\n _commitSha: string | null;\n anchor: CommentAnchor;\n status: CommentStatus;\n thread: CommentThreadEntry[];\n}\n", "/**\n * Permission Types\n *\n * Per-resource, soft (UI-coordination) edit permissions keyed by GitHub\n * identity. The policy lives in `.meno/permissions.json` at the project root\n * (committed, so every clone resolves the SAME policy locally). GitHub stays\n * the identity + grouping authority (logins, teams, repo-admin bit); this model\n * owns what those map to in editor terms.\n *\n * Enforcement tier is SOFT: these types drive UI gating (read-only editor\n * paths, disabled save), not an adversarial security boundary \u2014 a user with the\n * clone can always edit files directly. Hard enforcement (a CI check on PRs)\n * is a later, additive layer that reads the same policy file.\n *\n * This module is pure data + types; the resolver lives in `../permissions.ts`.\n */\n\n/** Permission tiers, lowest \u2192 highest capability. */\nexport type PermissionRole = 'viewer' | 'editor' | 'admin';\n\nexport const PERMISSION_ROLES = ['viewer', 'editor', 'admin'] as const satisfies readonly PermissionRole[];\n\n/**\n * The editable unit kinds of a Meno project. Mirrors the on-disk layout:\n * - `page` \u2192 `src/pages/<slug>.astro` (id = page slug, e.g. `blog/post`)\n * - `component` \u2192 `src/components/<Name>.astro` (id = component name)\n * - `cms` \u2192 `src/content/<collectionId>/` (id = collection id; items inherit)\n * - `config` \u2192 root config files (id = a {@link ConfigArea})\n */\nexport type ResourceKind = 'page' | 'component' | 'cms' | 'config';\n\nexport const RESOURCE_KINDS: readonly ResourceKind[] = ['page', 'component', 'cms', 'config'] as const;\n\n/**\n * Named global-config capabilities (the `config` resource kind's id namespace):\n * - `project` \u2192 `project.config.json` (site URL, breakpoints, fonts, \u2026)\n * - `colors` \u2192 `colors.json`\n * - `variables` \u2192 `variables.json`\n * - `i18n` \u2192 locale config inside `project.config.json`\n *\n * NOTE: `i18n` lives *inside* `project.config.json`, so the CI checker (which\n * maps whole files) enforces it at `project` granularity \u2014 granting `i18n`\n * without `project` is advisory only (no file maps to it on its own), and\n * granting `project` implies `i18n`.\n */\nexport type ConfigArea = 'project' | 'colors' | 'variables' | 'i18n';\n\nexport const CONFIG_AREAS: readonly ConfigArea[] = ['project', 'colors', 'variables', 'i18n'] as const;\n\n/**\n * A reference to one editable resource, checked against a {@link PermissionRule}.\n * `id` is matched against the rule's glob list for `kind` (see\n * `matchesPermissionPattern`).\n */\nexport interface ResourceRef {\n kind: ResourceKind;\n /** page slug | component name | collection id | config area. */\n id: string;\n}\n\n/**\n * Per-resource-kind allow-lists. Each entry is a glob pattern (`*` matches any\n * run of characters, including `/`) matched against a {@link ResourceRef.id}.\n * Only consulted for the `editor` role \u2014 `viewer` edits nothing, `admin`\n * edits everything. An absent/empty list for a kind means \"no resources of\n * that kind\".\n */\nexport interface PermissionRule {\n /** Page slugs, e.g. `[\"blog/*\", \"about\"]`. */\n pages?: string[];\n /** Component names, e.g. `[\"Card\", \"*Hero\"]`. */\n components?: string[];\n /** CMS collection ids, e.g. `[\"posts\", \"*\"]`. */\n cms?: string[];\n /** Config areas, e.g. `[\"colors\", \"variables\"]` or `[\"*\"]`. */\n config?: string[];\n}\n\n/**\n * One person's or team's grant. `role` defaults to `editor` when `allow` is\n * present, otherwise `viewer`.\n */\nexport interface PermissionGrant {\n role?: PermissionRole;\n /** Editable resources \u2014 only meaningful for the `editor` role. */\n allow?: PermissionRule;\n}\n\n/** Current `version` value written by this app. */\nexport const CURRENT_PERMISSIONS_VERSION = 1;\n\n/**\n * The committed `.meno/permissions.json` document. Logins/team slugs are\n * matched case-insensitively (GitHub logins are case-insensitive).\n */\nexport interface PermissionsPolicy {\n /** Schema version. {@link CURRENT_PERMISSIONS_VERSION} for documents this app writes. */\n version: number;\n /** Role for authenticated users not listed in `members`/`teams`. Defaults to `viewer`. */\n defaultRole?: PermissionRole;\n /** Per-GitHub-login grants. */\n members?: Record<string, PermissionGrant>;\n /** Per-GitHub-team-slug grants (a user's grants are the union over their teams). */\n teams?: Record<string, PermissionGrant>;\n}\n\n/**\n * Who is asking, resolved from the GitHub session. `login: null` means\n * unauthenticated / no GitHub identity (a local project, or a non-electron\n * run) \u2014 see {@link PermissionsPolicy} handling in the resolver.\n */\nexport interface PermissionIdentity {\n /** GitHub login, or `null` when unauthenticated. */\n login: string | null;\n /** GitHub team slugs the user belongs to (for `teams` grants). */\n teams?: string[];\n /**\n * GitHub repo `permissions.admin`. Repo admins are ALWAYS treated as admin\n * here (bootstrap safety \u2014 a policy can't lock the repo owner out).\n */\n isRepoAdmin?: boolean;\n}\n\n/**\n * The resolved capability set for one identity against one policy. Plain,\n * serializable data (no methods) so it can live in a store; query it with\n * `canEdit()` from `../permissions.ts`.\n */\nexport interface ResolvedPermissions {\n login: string | null;\n /** Effective top role after merging member + team grants (and repo-admin). */\n role: PermissionRole;\n /** `true` for `admin` role or a GitHub repo admin. Admins edit everything. */\n isAdmin: boolean;\n /** May the user edit `.meno/permissions.json` itself? Admins only. */\n canManagePolicy: boolean;\n /** Merged allow-lists from all matching grants (consulted for the `editor` role). */\n allow: Required<PermissionRule>;\n}\n", "/**\n * Slugify utilities for CMS filenames\n * Converts text to URL-safe slugs and handles i18n value extraction\n */\n\nimport { isI18nValue } from './i18n';\n\n/**\n * Convert string to URL-safe slug\n * - Lowercase\n * - Remove diacritics (accented characters)\n * - Replace spaces with hyphens\n * - Remove special characters\n */\nexport function slugify(text: string): string {\n if (!text) return '';\n\n return text\n .toLowerCase()\n .normalize('NFD') // Decompose accented chars (\u00E9 -> e + \u0301)\n .replace(/[\\u0300-\\u036f]/g, '') // Remove diacritics\n .replace(/[^a-z0-9\\s-]/g, '') // Remove special chars\n .trim()\n .replace(/\\s+/g, '-') // Replace spaces with hyphens\n .replace(/-+/g, '-') // Collapse multiple hyphens\n .replace(/^-|-$/g, ''); // Remove leading/trailing hyphens\n}\n\n/**\n * Extract string value from potentially i18n field\n * Uses specified locale if i18n, or returns string directly\n *\n * @param value - String or i18n object\n * @param defaultLocale - Locale to use for i18n extraction (default: 'en')\n * @returns Extracted string value\n */\nexport function extractStringValue(value: unknown, defaultLocale: string = 'en'): string {\n // Direct string\n if (typeof value === 'string') {\n return value;\n }\n\n // i18n object: { _i18n: true, en: \"hello\", pl: \"cze\u015B\u0107\" }\n if (isI18nValue(value)) {\n // Try default locale first\n if (typeof value[defaultLocale] === 'string') {\n return value[defaultLocale] as string;\n }\n // Fall back to first available locale\n for (const key of Object.keys(value)) {\n if (key !== '_i18n' && typeof value[key] === 'string') {\n return value[key] as string;\n }\n }\n }\n\n // Not a string or i18n object\n return '';\n}\n\n/**\n * Generate a unique filename from base slug\n * Appends -1, -2, etc. suffix if duplicate exists\n *\n * @param baseSlug - Base slug to use\n * @param existingFilenames - Array of existing filenames to check against\n * @returns Unique filename\n */\nexport function generateUniqueFilename(baseSlug: string, existingFilenames: string[]): string {\n if (!baseSlug) {\n baseSlug = 'untitled';\n }\n\n // If base slug is unique, use it directly\n if (!existingFilenames.includes(baseSlug)) {\n return baseSlug;\n }\n\n // Append counter suffix until unique\n let counter = 1;\n let candidate = `${baseSlug}-${counter}`;\n while (existingFilenames.includes(candidate)) {\n counter++;\n candidate = `${baseSlug}-${counter}`;\n }\n\n return candidate;\n}\n\n/**\n * Generate filename from item data\n * Extracts title field value, slugifies it, and ensures uniqueness\n *\n * @param item - CMS item data\n * @param titleField - Name of the field to use for title (default: 'title')\n * @param existingFilenames - Array of existing filenames\n * @param defaultLocale - Default locale for i18n extraction\n * @returns Unique filename\n */\nexport function generateFilenameFromItem(\n item: Record<string, unknown>,\n titleField: string = 'title',\n existingFilenames: string[] = [],\n defaultLocale: string = 'en',\n): string {\n // Try to get title from specified field\n const titleValue = item[titleField];\n const titleString = extractStringValue(titleValue, defaultLocale);\n const baseSlug = slugify(titleString);\n\n return generateUniqueFilename(baseSlug, existingFilenames);\n}\n", "/**\n * Slug Translation Service\n * Handles translation of URL slugs between locales\n */\n\nimport type { I18nConfig } from './types';\n\n/**\n * Slug mapping for a single page\n */\nexport interface SlugMap {\n pageId: string;\n slugs: Record<string, string>;\n}\n\n/**\n * Index entry for reverse lookup (slug+locale \u2192 pageId)\n */\ninterface SlugIndexEntry {\n pageId: string;\n slugs: Record<string, string>;\n}\n\n/**\n * Build reverse lookup index: \"locale:slug\" \u2192 SlugIndexEntry\n * This allows quick lookup of pageId from any locale's slug\n */\nexport function buildSlugIndex(mappings: SlugMap[]): Map<string, SlugIndexEntry> {\n const index = new Map<string, SlugIndexEntry>();\n\n for (const mapping of mappings) {\n for (const [locale, slug] of Object.entries(mapping.slugs)) {\n // Key format: \"locale:slug\" (e.g., \"pl:o-nas\" or \"en:about\")\n const key = `${locale}:${slug}`;\n index.set(key, {\n pageId: mapping.pageId,\n slugs: mapping.slugs,\n });\n }\n }\n\n return index;\n}\n\n/**\n * Find page by slug and locale\n * @returns The SlugIndexEntry if found, undefined otherwise\n */\nexport function findPageBySlug(\n slug: string,\n locale: string,\n index: Map<string, SlugIndexEntry>,\n): SlugIndexEntry | undefined {\n const key = `${locale}:${slug}`;\n return index.get(key);\n}\n\n/**\n * Translate a path to another locale\n *\n * @param currentPath - Current URL path (e.g., \"/pl/o-nas\" or \"/about\")\n * @param targetLocale - Target locale (e.g., \"en\")\n * @param currentLocale - Current locale (e.g., \"pl\")\n * @param defaultLocale - Default locale that doesn't use prefix (e.g., \"en\")\n * @param index - Slug index from buildSlugIndex()\n * @returns Translated path (e.g., \"/about\" for en default, \"/de/uber\" for de)\n */\nexport function translatePath(\n currentPath: string,\n targetLocale: string,\n currentLocale: string,\n defaultLocale: string,\n index: Map<string, SlugIndexEntry>,\n): string {\n // Extract slug from current path (remove locale prefix if present)\n let slug = currentPath;\n\n // Remove leading slash\n if (slug.startsWith('/')) {\n slug = slug.substring(1);\n }\n\n // Remove locale prefix if present (e.g., \"pl/o-nas\" \u2192 \"o-nas\")\n // Also handle case where slug IS the locale (e.g., \"pl\" for Polish homepage)\n if (currentLocale !== defaultLocale) {\n if (slug.startsWith(`${currentLocale}/`)) {\n slug = slug.substring(currentLocale.length + 1);\n } else if (slug === currentLocale) {\n // Path is just the locale prefix (e.g., \"/pl\" \u2192 index page)\n slug = '';\n }\n }\n\n // Handle root path\n if (slug === '' || slug === '/') {\n slug = '';\n }\n\n // Look up page by current slug and locale\n let entry = findPageBySlug(slug, currentLocale, index);\n\n // If not found for current locale, try default locale\n // This handles cases like /de/about where German uses the English slug\n if (!entry && currentLocale !== defaultLocale) {\n entry = findPageBySlug(slug, defaultLocale, index);\n }\n\n if (!entry) {\n // No translation found - return path with just locale prefix change\n if (targetLocale === defaultLocale) {\n return slug === '' ? '/' : `/${slug}`;\n }\n return slug === '' ? `/${targetLocale}` : `/${targetLocale}/${slug}`;\n }\n\n // Get translated slug for target locale\n const targetSlug = entry.slugs[targetLocale] ?? entry.slugs[defaultLocale] ?? slug;\n\n // Build target path\n if (targetLocale === defaultLocale) {\n return targetSlug === '' ? '/' : `/${targetSlug}`;\n }\n return targetSlug === '' ? `/${targetLocale}` : `/${targetLocale}/${targetSlug}`;\n}\n\n/**\n * Locale link information for locale switcher\n */\nexport interface LocaleLink {\n locale: string; // Locale code (e.g., \"pl\")\n langTag: string; // BCP 47 language tag (e.g., \"pl-PL\")\n name: string; // English name (e.g., \"Polish\")\n nativeName: string; // Display name in native language (e.g., \"Polski\")\n path: string; // Translated path for this locale\n isCurrent: boolean; // Whether this is the current locale\n}\n\n/**\n * Get all available locales with their translated paths for the current page\n * Useful for rendering locale switcher\n *\n * @param currentPath - Current URL path\n * @param currentLocale - Current locale\n * @param i18nConfig - i18n configuration with locales\n * @param index - Slug index\n * @returns Array of LocaleLink objects\n */\nexport function getLocaleLinks(\n currentPath: string,\n currentLocale: string,\n i18nConfig: I18nConfig,\n index: Map<string, SlugIndexEntry>,\n): LocaleLink[] {\n return i18nConfig.locales.map((localeConfig) => ({\n locale: localeConfig.code,\n langTag: localeConfig.langTag,\n name: localeConfig.name,\n nativeName: localeConfig.nativeName,\n path: translatePath(currentPath, localeConfig.code, currentLocale, i18nConfig.defaultLocale, index),\n isCurrent: localeConfig.code === currentLocale,\n }));\n}\n\n/**\n * Build the URL a page is served at for a given locale.\n *\n * Conventions (match what `translatePath` / the routing layer at\n * packages/core/lib/server/routes/pages.ts produces):\n * - Default locale paths are bare: \"/\" or \"/{slug}\"\n * - Non-default locale paths are locale-prefixed: \"/{locale}\" or \"/{locale}/{slug}\"\n * - An empty slug (e.g. for the index page) collapses to the root.\n *\n * Used by the slug/page-rename flow to compute the (old, new) href pair\n * for cascade rewrites in incoming links.\n */\nexport function buildPageUrlForLocale(slug: string, locale: string, defaultLocale: string): string {\n const cleanSlug = slug.replace(/^\\/+/, '');\n if (locale === defaultLocale) {\n return cleanSlug === '' ? '/' : `/${cleanSlug}`;\n }\n return cleanSlug === '' ? `/${locale}` : `/${locale}/${cleanSlug}`;\n}\n\n/**\n * Resolve a slug to its pageId (for server-side page loading)\n *\n * @param slug - URL slug (e.g., \"o-nas\")\n * @param locale - Current locale (e.g., \"pl\")\n * @param index - Slug index\n * @returns pageId if found (e.g., \"about\"), undefined otherwise\n */\nexport function resolveSlugToPageId(\n slug: string,\n locale: string,\n index: Map<string, SlugIndexEntry>,\n): string | undefined {\n const entry = findPageBySlug(slug, locale, index);\n return entry?.pageId;\n}\n", "/**\n * Library Loader\n * Generates HTML tags for external JS/CSS libraries\n */\n\nimport type { JSLibraryConfig, CSSLibraryConfig, LibrariesConfig, PageLibrariesConfig } from './types/libraries';\nimport type { ComponentDefinition } from './types/components';\n\n/**\n * Escape HTML special characters in attribute values\n */\nfunction escapeAttr(str: string): string {\n return str.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n}\n\n/**\n * Merge global and page-level library configurations\n * @param global Global libraries from project.config.json\n * @param page Page-level libraries from page meta\n * @returns Merged library configuration\n */\nexport function mergeLibraries(global: LibrariesConfig, page?: PageLibrariesConfig): LibrariesConfig {\n if (!page) {\n return global;\n }\n\n if (page.mode === 'replace') {\n return {\n js: page.js || [],\n css: page.css || [],\n };\n }\n\n // Default: extend\n return {\n js: [...(global.js || []), ...(page.js || [])],\n css: [...(global.css || []), ...(page.css || [])],\n };\n}\n\n/**\n * Generate <script> tag for a JS library\n * @param lib JavaScript library configuration\n * @returns HTML script tag string\n */\nexport function generateScriptTag(lib: JSLibraryConfig): string {\n const attrs: string[] = [`src=\"${escapeAttr(lib.url)}\"`];\n\n if (lib.type === 'module') {\n attrs.push('type=\"module\"');\n } else {\n // Default to defer for better performance\n const mode = lib.mode || 'defer';\n attrs.push(mode);\n }\n\n return `<script ${attrs.join(' ')}></script>`;\n}\n\n/**\n * Generate inline <style> tag with CSS content\n * @param content CSS content to embed\n * @param media Optional media query attribute\n * @returns HTML style tag string\n */\nexport function generateInlineStyleTag(content: string, media?: string): string {\n const attrs = media ? ` media=\"${escapeAttr(media)}\"` : '';\n return `<style${attrs}>${content}</style>`;\n}\n\n/**\n * Generate <link> tag for a CSS library\n * @param lib CSS library configuration\n * @returns HTML link tag string\n */\nexport function generateStylesheetTag(lib: CSSLibraryConfig): string {\n const attrs: string[] = ['rel=\"stylesheet\"', `href=\"${escapeAttr(lib.url)}\"`];\n\n if (lib.media) {\n attrs.push(`media=\"${escapeAttr(lib.media)}\"`);\n }\n\n return `<link ${attrs.join(' ')}>`;\n}\n\n/**\n * Generated library tags grouped by position\n */\nexport interface LibraryTags {\n /** CSS tags for <head> */\n headCSS: string;\n /** JS tags for <head> */\n headJS: string;\n /** JS tags for before </body> */\n bodyEndJS: string;\n}\n\n/**\n * Generate all library tags grouped by position\n * @param libs Library configuration\n * @param inlineContents Optional map of URL \u2192 CSS content for inline embedding\n * @returns Object with tags grouped by position\n */\nexport function generateLibraryTags(libs: LibrariesConfig, inlineContents?: Map<string, string>): LibraryTags {\n const headCSS: string[] = [];\n const headJS: string[] = [];\n const bodyEndJS: string[] = [];\n\n // CSS always goes in head\n for (const css of libs.css || []) {\n const inlineContent = inlineContents?.get(css.url);\n if (inlineContent !== undefined) {\n headCSS.push(generateInlineStyleTag(inlineContent, css.media));\n } else {\n headCSS.push(generateStylesheetTag(css));\n }\n }\n\n // JS can go in head or body-end\n for (const js of libs.js || []) {\n const tag = generateScriptTag(js);\n if (js.position === 'head') {\n headJS.push(tag);\n } else {\n // Default to body-end\n bodyEndJS.push(tag);\n }\n }\n\n return {\n headCSS: headCSS.join('\\n '),\n headJS: headJS.join('\\n '),\n bodyEndJS: bodyEndJS.join('\\n '),\n };\n}\n\n/**\n * Collect library configurations from all component definitions, deduplicated by URL\n * @param globalComponents Global component definitions\n * @param pageComponents Page-specific component definitions\n * @returns Combined library configuration from all components\n */\nexport function collectComponentLibraries(\n globalComponents: Record<string, ComponentDefinition> = {},\n pageComponents: Record<string, ComponentDefinition> = {},\n): LibrariesConfig {\n const seenJS = new Set<string>();\n const seenCSS = new Set<string>();\n const jsLibs: JSLibraryConfig[] = [];\n const cssLibs: CSSLibraryConfig[] = [];\n\n const collect = (components: Record<string, ComponentDefinition>) => {\n for (const component of Object.values(components)) {\n const libs = component?.component?.libraries;\n if (!libs) continue;\n\n for (const js of libs.js || []) {\n if (!seenJS.has(js.url)) {\n seenJS.add(js.url);\n jsLibs.push(js);\n }\n }\n for (const css of libs.css || []) {\n if (!seenCSS.has(css.url)) {\n seenCSS.add(css.url);\n cssLibs.push(css);\n }\n }\n }\n };\n\n collect(globalComponents);\n collect(pageComponents);\n\n return { js: jsLibs, css: cssLibs };\n}\n\n/**\n * Origins extracted from library URLs, grouped by resource type\n */\nexport interface LibraryOrigins {\n /** Origins for script-src (from JS library URLs) */\n scriptOrigins: Set<string>;\n /** Origins for style-src (from CSS library URLs) */\n styleOrigins: Set<string>;\n}\n\n/**\n * Extract unique origin domains from library URLs for CSP headers.\n * Skips relative URLs (/, ./, ../) since they're covered by 'self'.\n * Silently skips malformed URLs.\n */\nexport function extractLibraryOrigins(libs: LibrariesConfig): LibraryOrigins {\n const scriptOrigins = new Set<string>();\n const styleOrigins = new Set<string>();\n\n for (const js of libs.js || []) {\n const origin = safeOrigin(js.url);\n if (origin) scriptOrigins.add(origin);\n }\n\n for (const css of libs.css || []) {\n const origin = safeOrigin(css.url);\n if (origin) styleOrigins.add(origin);\n }\n\n return { scriptOrigins, styleOrigins };\n}\n\n/**\n * Filter libraries based on context (editor, build, or preview).\n * Removes CSS libraries that have the corresponding disable flag set.\n * JS libraries pass through unchanged.\n * Preview context (dev server on port 8080) returns all libraries unfiltered.\n */\nexport function filterLibrariesByContext(\n libs: LibrariesConfig,\n context: 'editor' | 'build' | 'preview',\n): LibrariesConfig {\n if (context === 'preview') return libs;\n const key = context === 'editor' ? 'disableEditor' : 'disableBuild';\n return {\n js: libs.js,\n css: (libs.css || []).filter((css) => !css[key]),\n };\n}\n\nfunction safeOrigin(url: string): string | null {\n if (!url || url.startsWith('/') || url.startsWith('./') || url.startsWith('../')) {\n return null;\n }\n try {\n return new URL(url).origin;\n } catch {\n return null;\n }\n}\n", "/**\n * Path Security Utilities\n * Provides path traversal protection for file system operations\n */\n\nimport { resolve, sep } from 'node: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", "/**\n * Component reference utilities \u2014 shared helpers for walking a node tree and\n * rewriting `{ type: \"component\", component: \"<name>\" }` references.\n *\n * Lives in `shared/` (not `server/`) because both the rename API on the server\n * and the in-editor pageData sync on the client need the same walker. Pure \u2014\n * no fs, no imports outside this file.\n */\n\n/**\n * Rewrite every `{ type: \"component\", component: \"<oldName>\" }` reference\n * inside `node` to point at `newName`. Returns true if any references were\n * rewritten. Mutates `node` in place.\n *\n * Matching is structural \u2014 node type + component-name equality \u2014 so a name\n * like \"Button\" will never collide with HTML tags, CSS classes, prop strings,\n * embedded SVG/HTML, or any user copy that happens to contain the word.\n */\nexport function rewriteComponentRefs(node: unknown, oldName: string, newName: string): boolean {\n if (!node || typeof node !== 'object') return false;\n let changed = false;\n\n const n = node as any;\n if (n.type === 'component' && n.component === oldName) {\n n.component = newName;\n changed = true;\n }\n\n const children = n.children;\n if (Array.isArray(children)) {\n for (const child of children) {\n if (child && typeof child === 'object') {\n if (rewriteComponentRefs(child, oldName, newName)) changed = true;\n }\n }\n } else if (children && typeof children === 'object') {\n if (rewriteComponentRefs(children, oldName, newName)) changed = true;\n }\n\n return changed;\n}\n"],
5
+ "mappings": ";;;;;AA2BA,SAAS,cAAc,MAAsB;AAC3C,MAAI,KAAK,SAAS,QAAQ,EAAG,QAAO;AACpC,MAAI,KAAK,SAAS,OAAO,EAAG,QAAO;AACnC,MAAI,KAAK,SAAS,MAAM,EA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