meno-core 1.0.44 → 1.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1 -1
- package/dist/build-static.js +8 -8
- package/dist/chunks/{chunk-KPNSCQNA.js → chunk-5ZASE4IG.js} +53 -10
- package/dist/chunks/chunk-5ZASE4IG.js.map +7 -0
- package/dist/chunks/{chunk-3XXLBUYA.js → chunk-BZQKEJQY.js} +9 -8
- package/dist/chunks/{chunk-3XXLBUYA.js.map → chunk-BZQKEJQY.js.map} +2 -2
- package/dist/chunks/{chunk-OLNQMCSR.js → chunk-F7MA62WG.js} +3 -3
- package/dist/chunks/{chunk-2NBGG2LJ.js → chunk-GYF3ABI3.js} +87 -2
- package/dist/chunks/{chunk-2NBGG2LJ.js.map → chunk-GYF3ABI3.js.map} +2 -2
- package/dist/chunks/{chunk-46AVQA4V.js → chunk-IF3RATBY.js} +2 -2
- package/dist/chunks/{chunk-S2HXJTAF.js → chunk-KITQJYZV.js} +5 -1
- package/dist/chunks/chunk-KITQJYZV.js.map +7 -0
- package/dist/chunks/{chunk-BXB6AX76.js → chunk-NZTSJS5C.js} +6 -3
- package/dist/chunks/chunk-NZTSJS5C.js.map +7 -0
- package/dist/chunks/{chunk-G3WIPJN3.js → chunk-OUNJ76QM.js} +5 -5
- package/dist/chunks/{chunk-5TJA272J.js → chunk-TVH3TC2T.js} +8 -8
- package/dist/chunks/{chunk-YEJVSNVF.js → chunk-WQSG5WHC.js} +13 -2
- package/dist/chunks/chunk-WQSG5WHC.js.map +7 -0
- package/dist/chunks/{chunk-X5SH4HXS.js → chunk-XSWR3QLI.js} +33 -1
- package/dist/chunks/chunk-XSWR3QLI.js.map +7 -0
- package/dist/chunks/{configService-KYO3TXDS.js → configService-6KTT6GRT.js} +3 -3
- package/dist/chunks/{constants-34NUGHQR.js → constants-L5IKLB6U.js} +2 -2
- package/dist/entries/server-router.js +9 -9
- package/dist/lib/client/index.js +5 -5
- package/dist/lib/server/index.js +10 -10
- package/dist/lib/shared/index.js +10 -6
- package/dist/lib/shared/index.js.map +1 -1
- package/dist/lib/test-utils/index.js +1 -1
- package/lib/server/services/configService.ts +13 -0
- package/lib/server/ssr/htmlGenerator.ts +4 -1
- package/lib/shared/constants.ts +8 -2
- package/lib/shared/cssGeneration.ts +11 -0
- package/lib/shared/cssProperties.ts +97 -2
- package/lib/shared/nodeUtils.ts +28 -0
- package/lib/shared/responsiveScaling.test.ts +20 -3
- package/lib/shared/responsiveScaling.ts +55 -1
- package/lib/shared/responsiveStyleUtils.test.ts +7 -8
- package/lib/shared/responsiveStyleUtils.ts +6 -7
- package/lib/shared/types/components.ts +1 -1
- package/lib/shared/types/variables.test.ts +9 -2
- package/lib/shared/types/variables.ts +5 -1
- package/lib/shared/utilityClassMapper.ts +14 -1
- package/lib/shared/validation/propValidator.ts +6 -0
- package/lib/shared/validation/schemas.ts +2 -2
- package/package.json +1 -1
- package/dist/chunks/chunk-BXB6AX76.js.map +0 -7
- package/dist/chunks/chunk-KPNSCQNA.js.map +0 -7
- package/dist/chunks/chunk-S2HXJTAF.js.map +0 -7
- package/dist/chunks/chunk-X5SH4HXS.js.map +0 -7
- package/dist/chunks/chunk-YEJVSNVF.js.map +0 -7
- /package/dist/chunks/{chunk-OLNQMCSR.js.map → chunk-F7MA62WG.js.map} +0 -0
- /package/dist/chunks/{chunk-46AVQA4V.js.map → chunk-IF3RATBY.js.map} +0 -0
- /package/dist/chunks/{chunk-G3WIPJN3.js.map → chunk-OUNJ76QM.js.map} +0 -0
- /package/dist/chunks/{chunk-5TJA272J.js.map → chunk-TVH3TC2T.js.map} +0 -0
- /package/dist/chunks/{configService-KYO3TXDS.js.map → configService-6KTT6GRT.js.map} +0 -0
- /package/dist/chunks/{constants-34NUGHQR.js.map → constants-L5IKLB6U.js.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../lib/server/services/configService.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Config Service\n * Centralized configuration loading and access\n *\n * Consolidates multiple config loaders into a single service that loads\n * the project.config.json file once and exposes typed sections.\n */\n\nimport type { BreakpointConfig, BreakpointConfigInput, BreakpointEntry } from '../../shared/breakpoints';\nimport { DEFAULT_BREAKPOINTS, normalizeBreakpointConfig } from '../../shared/breakpoints';\nimport type { ResponsiveScales, BreakpointScales } from '../../shared/responsiveScaling';\nimport { DEFAULT_RESPONSIVE_SCALES } from '../../shared/responsiveScaling';\nimport type { I18nConfig } from '../../shared/types/components';\nimport type { LibrariesConfig, JSLibraryConfig, CSSLibraryConfig } from '../../shared/types/libraries';\nimport type { CSPConfig } from '../../shared/types/config';\nimport type { CustomCodeConfig } from '../../shared/types/api';\nimport type { RemConversionConfig } from '../../shared/pxToRem';\nimport { DEFAULT_REM_CONFIG } from '../../shared/pxToRem';\nimport { DEFAULT_I18N_CONFIG, migrateI18nConfig } from '../../shared/i18n';\nimport { projectPaths } from '../projectContext';\nimport { readTextFile, fileExists } from '../runtime';\n\n/**\n * Icons configuration\n */\nexport interface IconsConfig {\n favicon?: string;\n appleTouchIcon?: string;\n}\n\n/**\n * Raw project config structure from project.config.json\n */\nexport type ImageFormat = 'webp' | 'avif';\n\ninterface RawProjectConfig {\n breakpoints?: BreakpointConfigInput;\n responsiveScales?: Partial<ResponsiveScales>;\n i18n?: unknown;\n icons?: IconsConfig;\n libraries?: LibrariesConfig;\n csp?: CSPConfig;\n baseComponent?: string;\n imageFormat?: ImageFormat;\n remConversion?: Partial<RemConversionConfig>;\n customCode?: CustomCodeConfig;\n showMenoBadge?: boolean;\n}\n\n/**\n * ConfigService\n * Loads project configuration once and provides typed access to sections\n */\nexport class ConfigService {\n private config: RawProjectConfig | null = null;\n private loaded = false;\n\n /**\n * Load configuration from project.config.json\n * Safe to call multiple times - only loads once\n */\n async load(): Promise<void> {\n if (this.loaded) {\n return;\n }\n\n try {\n if (await fileExists(projectPaths.config())) {\n const content = await readTextFile(projectPaths.config());\n this.config = JSON.parse(content);\n }\n } catch {\n // Fall through to defaults\n this.config = null;\n }\n\n this.loaded = true;\n }\n\n /**\n * Check if configuration has been loaded\n */\n isLoaded(): boolean {\n return this.loaded;\n }\n\n /**\n * Reset the service (for testing)\n */\n reset(): void {\n this.config = null;\n this.loaded = false;\n }\n\n /**\n * Get breakpoint configuration\n * Returns validated and normalized breakpoints (always object format)\n * Supports both legacy format { tablet: 1024 } and new format { tablet: { breakpoint: 1024, previewPoint: 768 } }\n */\n getBreakpoints(): BreakpointConfig {\n if (!this.config?.breakpoints || typeof this.config.breakpoints !== 'object') {\n return { ...DEFAULT_BREAKPOINTS };\n }\n\n // Validate breakpoint values before normalization\n const validInput: BreakpointConfigInput = {};\n for (const [key, value] of Object.entries(this.config.breakpoints)) {\n if (typeof value === 'number' && value > 0) {\n // Legacy format: number\n validInput[key] = value;\n } else if (typeof value === 'object' && value !== null) {\n // New format: object with breakpoint and optional previewPoint\n const entry = value as BreakpointEntry;\n if (typeof entry.breakpoint === 'number' && entry.breakpoint > 0) {\n validInput[key] = {\n breakpoint: entry.breakpoint,\n previewPoint: typeof entry.previewPoint === 'number' && entry.previewPoint > 0\n ? entry.previewPoint\n : entry.breakpoint,\n };\n }\n }\n }\n\n // Return normalized breakpoints or defaults if none valid\n if (Object.keys(validInput).length === 0) {\n return { ...DEFAULT_BREAKPOINTS };\n }\n\n return normalizeBreakpointConfig(validInput);\n }\n\n /**\n * Get i18n configuration\n * Automatically migrates old string[] format to LocaleConfig[] format\n */\n getI18n(): I18nConfig {\n if (!this.config?.i18n) {\n return { ...DEFAULT_I18N_CONFIG };\n }\n\n return migrateI18nConfig(this.config.i18n);\n }\n\n /**\n * Deep merge scale categories, preserving user-defined breakpoints\n * while filling in missing values from defaults\n */\n private mergeScaleCategory(\n userScales: BreakpointScales | undefined,\n defaultScales: BreakpointScales | undefined\n ): BreakpointScales | undefined {\n if (!userScales && !defaultScales) return undefined;\n if (!userScales) return defaultScales ? { ...defaultScales } : undefined;\n if (!defaultScales) return { ...userScales };\n\n // User scales take precedence, but include defaults for breakpoints not specified\n return {\n ...defaultScales,\n ...userScales,\n };\n }\n\n /**\n * Get responsive scales configuration\n * Supports dynamic breakpoints - scales are keyed by breakpoint name\n * Deep merges scale categories to preserve user breakpoint definitions\n */\n getResponsiveScales(): ResponsiveScales {\n if (!this.config?.responsiveScales || typeof this.config.responsiveScales !== 'object') {\n return { ...DEFAULT_RESPONSIVE_SCALES };\n }\n\n const userScales = this.config.responsiveScales;\n\n return {\n enabled: userScales.enabled ?? DEFAULT_RESPONSIVE_SCALES.enabled,\n baseReference: userScales.baseReference ?? DEFAULT_RESPONSIVE_SCALES.baseReference,\n fontSize: this.mergeScaleCategory(\n userScales.fontSize as BreakpointScales | undefined,\n DEFAULT_RESPONSIVE_SCALES.fontSize\n ),\n padding: this.mergeScaleCategory(\n userScales.padding as BreakpointScales | undefined,\n DEFAULT_RESPONSIVE_SCALES.padding\n ),\n margin: this.mergeScaleCategory(\n userScales.margin as BreakpointScales | undefined,\n DEFAULT_RESPONSIVE_SCALES.margin\n ),\n gap: this.mergeScaleCategory(\n userScales.gap as BreakpointScales | undefined,\n DEFAULT_RESPONSIVE_SCALES.gap\n ),\n borderRadius: this.mergeScaleCategory(\n userScales.borderRadius as BreakpointScales | undefined,\n DEFAULT_RESPONSIVE_SCALES.borderRadius\n ),\n size: this.mergeScaleCategory(\n userScales.size as BreakpointScales | undefined,\n DEFAULT_RESPONSIVE_SCALES.size\n ),\n };\n }\n\n /**\n * Get rem conversion configuration\n */\n getRemConversion(): RemConversionConfig {\n if (!this.config?.remConversion || typeof this.config.remConversion !== 'object') {\n return { ...DEFAULT_REM_CONFIG };\n }\n return {\n enabled: this.config.remConversion.enabled ?? DEFAULT_REM_CONFIG.enabled,\n baseFontSize: this.config.remConversion.baseFontSize ?? DEFAULT_REM_CONFIG.baseFontSize,\n };\n }\n\n /**\n * Get icons configuration\n * Returns empty object if not configured\n */\n getIcons(): IconsConfig {\n if (!this.config?.icons || typeof this.config.icons !== 'object') {\n return {};\n }\n\n return this.config.icons;\n }\n\n /**\n * Get libraries configuration\n * Returns empty arrays if not configured\n * Normalizes string URLs to object format for backwards compatibility\n */\n getLibraries(): LibrariesConfig {\n if (!this.config?.libraries || typeof this.config.libraries !== 'object') {\n return { js: [], css: [] };\n }\n\n const libs = this.config.libraries;\n\n // Normalize JS libraries: support both string URLs and object format\n const normalizedJs = Array.isArray(libs.js)\n ? libs.js.map((lib) =>\n typeof lib === 'string' ? { url: lib } : lib\n ) as JSLibraryConfig[]\n : [];\n\n // Normalize CSS libraries: support both string URLs and object format\n const normalizedCss = Array.isArray(libs.css)\n ? libs.css.map((lib) =>\n typeof lib === 'string' ? { url: lib } : lib\n ) as CSSLibraryConfig[]\n : [];\n\n return {\n js: normalizedJs,\n css: normalizedCss,\n };\n }\n\n /**\n * Get CSP configuration\n * Returns empty object if not configured\n */\n getCSP(): CSPConfig {\n if (!this.config?.csp || typeof this.config.csp !== 'object') {\n return {};\n }\n\n return this.config.csp;\n }\n\n /**\n * Get base component name for new pages\n * Returns undefined if not configured\n */\n getBaseComponent(): string | undefined {\n if (!this.config?.baseComponent || typeof this.config.baseComponent !== 'string') {\n return undefined;\n }\n return this.config.baseComponent;\n }\n\n /**\n * Get image format setting\n * Returns 'webp' (default) or 'avif'\n */\n getCustomCode(): CustomCodeConfig {\n if (!this.config?.customCode || typeof this.config.customCode !== 'object') {\n return {};\n }\n return this.config.customCode;\n }\n\n getShowMenoBadge(): boolean {\n return this.config?.showMenoBadge === true;\n }\n\n getImageFormat(): ImageFormat {\n if (this.config?.imageFormat === 'avif') return 'avif';\n return 'webp';\n }\n\n /**\n * Get raw config value by key (for extension)\n */\n getRaw<T>(key: string): T | undefined {\n if (!this.config) {\n return undefined;\n }\n return (this.config as Record<string, unknown>)[key] as T | undefined;\n }\n}\n\n/**\n * Singleton instance for global access\n * Use this for convenience, or create your own instance for testing\n */\nexport const configService = new Conf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AO,OAAO,KAAK,OAAO,QAAQ,UAAU;AAC5D,aAAO,CAAC;AAAA,IACV;AAEA,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,mBAAuC;AACrC,QAAI,CAAC,KAAK,QAAQ,iBAAiB,OAAO,KAAK,OAAO,kBAAkB,UAAU;AAChF,aAAO;AAAA,IACT;AACA,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,gBAAkC;AAChC,QAAI,CAAC,KAAK,QAAQ,cAAc,OAAO,KAAK,OAAO,eAAe,UAAU;AAC1E,aAAO,CAAC;AAAA,IACV;AACA,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,mBAA4B;AAC1B,WAAO,KAAK,QAAQ,kBAAkB;AAAA,EACxC;AAAA,EAEA,iBAA8B;AAC5B,QAAI,KAAK,QAAQ,gBAAgB,OAAQ,QAAO;AAChD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,OAAU,KAA4B;AACpC,QAAI,CAAC,KAAK,QAAQ;AAChB,aAAO;AAAA,IACT;AACA,WAAQ,KAAK,OAAmC,GAAG;AAAA,EACrD;AACF;AAMO,IAAM,gBAAgB,IAAI,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -69,6 +69,8 @@ function getScaleCategory(property) {
|
|
|
69
69
|
if (propertyStr.startsWith("padding")) return "padding";
|
|
70
70
|
if (propertyStr.startsWith("margin")) return "margin";
|
|
71
71
|
if (property === "gap" || property === "rowGap" || property === "columnGap") return "gap";
|
|
72
|
+
if (propertyStr === "borderRadius" || propertyStr.startsWith("border") && propertyStr.includes("Radius")) return "borderRadius";
|
|
73
|
+
if (property === "width" || property === "height" || property === "maxWidth" || property === "maxHeight" || property === "minWidth" || property === "minHeight") return "size";
|
|
72
74
|
return null;
|
|
73
75
|
}
|
|
74
76
|
function parseValue(valueStr) {
|
|
@@ -99,6 +101,9 @@ function parseMultiValue(valueStr) {
|
|
|
99
101
|
function scaleValue(valueStr, baseReference, scale) {
|
|
100
102
|
const parsed = parseValue(valueStr);
|
|
101
103
|
if (!parsed) return null;
|
|
104
|
+
if (parsed.unit === "%" || parsed.unit === "em") {
|
|
105
|
+
return valueStr.trim();
|
|
106
|
+
}
|
|
102
107
|
const scaledValue = calculateResponsiveValue(parsed.value, baseReference, scale);
|
|
103
108
|
return `${scaledValue}${parsed.unit}`;
|
|
104
109
|
}
|
|
@@ -131,6 +136,24 @@ function getResponsiveValues(baseValue, property, scales, breakpointNames) {
|
|
|
131
136
|
}
|
|
132
137
|
return result;
|
|
133
138
|
}
|
|
139
|
+
function resolveVariableValueAtBreakpoint(variable, breakpoint, responsiveScales) {
|
|
140
|
+
if (breakpoint === "base") return variable.value;
|
|
141
|
+
const override = variable.scales?.[breakpoint];
|
|
142
|
+
if (override !== void 0) return override;
|
|
143
|
+
if (responsiveScales?.enabled && variable.type !== "none") {
|
|
144
|
+
const scale = getScaleMultiplier(
|
|
145
|
+
responsiveScales,
|
|
146
|
+
variable.type,
|
|
147
|
+
breakpoint
|
|
148
|
+
);
|
|
149
|
+
if (scale !== null) {
|
|
150
|
+
const baseRef = responsiveScales.baseReference || 16;
|
|
151
|
+
const scaled = scalePropertyValue(variable.value, baseRef, scale);
|
|
152
|
+
if (scaled !== null) return scaled;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return variable.value;
|
|
156
|
+
}
|
|
134
157
|
var DEFAULT_RESPONSIVE_SCALES = {
|
|
135
158
|
enabled: false,
|
|
136
159
|
baseReference: 16,
|
|
@@ -149,6 +172,14 @@ var DEFAULT_RESPONSIVE_SCALES = {
|
|
|
149
172
|
gap: {
|
|
150
173
|
tablet: 0.65,
|
|
151
174
|
mobile: 0.4
|
|
175
|
+
},
|
|
176
|
+
borderRadius: {
|
|
177
|
+
tablet: 0.85,
|
|
178
|
+
mobile: 0.7
|
|
179
|
+
},
|
|
180
|
+
size: {
|
|
181
|
+
tablet: 0.9,
|
|
182
|
+
mobile: 0.75
|
|
152
183
|
}
|
|
153
184
|
};
|
|
154
185
|
|
|
@@ -372,6 +403,7 @@ export {
|
|
|
372
403
|
scaleValue,
|
|
373
404
|
scalePropertyValue,
|
|
374
405
|
getResponsiveValues,
|
|
406
|
+
resolveVariableValueAtBreakpoint,
|
|
375
407
|
DEFAULT_RESPONSIVE_SCALES,
|
|
376
408
|
DEFAULT_I18N_CONFIG,
|
|
377
409
|
getLocaleCodes,
|
|
@@ -393,4 +425,4 @@ export {
|
|
|
393
425
|
shouldConvertProperty,
|
|
394
426
|
applyRemConversion
|
|
395
427
|
};
|
|
396
|
-
//# sourceMappingURL=chunk-
|
|
428
|
+
//# sourceMappingURL=chunk-XSWR3QLI.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../lib/shared/breakpoints.ts", "../../lib/shared/responsiveScaling.ts", "../../lib/shared/i18n.ts", "../../lib/shared/pxToRem.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Shared Breakpoint Configuration\n * Defines breakpoints for responsive design\n * Supports dynamic breakpoints from project.config.json\n */\n\n/**\n * Extended breakpoint entry with separate CSS threshold and editor preview width\n * - breakpoint: The CSS media query threshold (max-width value)\n * - previewPoint: The width used in editor preview mode (defaults to breakpoint if not specified)\n * - label: Optional display label for UI (e.g., \"Tablet Landscape\", \"Phone\")\n */\nexport interface BreakpointEntry {\n breakpoint: number;\n previewPoint: number;\n label?: string;\n}\n\n/**\n * Input format for breakpoint config - supports both legacy (number) and new (object) format\n * Legacy: { tablet: 1024 }\n * New: { tablet: { breakpoint: 1024, previewPoint: 768 } }\n */\nexport type BreakpointConfigInput = Record<string, number | BreakpointEntry>;\n\n/**\n * Normalized breakpoint config - always uses object format\n */\nexport type BreakpointConfig = Record<string, BreakpointEntry>;\n\n/**\n * Legacy format for backward compatibility (simple number values)\n */\nexport type LegacyBreakpointConfig = Record<string, number>;\n\n// BreakpointName is now a string to support dynamic breakpoints\nexport type BreakpointName = string;\n\nexport const DEFAULT_BREAKPOINTS: BreakpointConfig = {\n tablet: { breakpoint: 1024, previewPoint: 768 },\n mobile: { breakpoint: 540, previewPoint: 375 },\n} as const;\n\n/**\n * Normalize a breakpoint config input to the full object format\n * Converts legacy number format to object format\n * If previewPoint is not specified, defaults to breakpoint value\n */\nexport function normalizeBreakpointConfig(\n input: BreakpointConfigInput | LegacyBreakpointConfig\n): BreakpointConfig {\n const result: BreakpointConfig = {};\n\n for (const [name, value] of Object.entries(input)) {\n if (typeof value === 'number') {\n // Legacy format: number -> { breakpoint: value, previewPoint: value }\n result[name] = { breakpoint: value, previewPoint: value };\n } else if (typeof value === 'object' && value !== null) {\n // New format: ensure both values exist, preserve label if present\n result[name] = {\n breakpoint: value.breakpoint,\n previewPoint: value.previewPoint ?? value.breakpoint,\n ...(value.label !== undefined && { label: value.label }),\n };\n }\n }\n\n return result;\n}\n\n/**\n * Get just the breakpoint values for CSS generation (media queries)\n * Returns Record<string, number> with breakpoint values\n */\nexport function getBreakpointValues(config: BreakpointConfig): LegacyBreakpointConfig {\n const result: LegacyBreakpointConfig = {};\n for (const [name, entry] of Object.entries(config)) {\n result[name] = entry.breakpoint;\n }\n return result;\n}\n\n/**\n * Get just the preview point values for editor preview\n * Returns Record<string, number> with previewPoint values\n */\nexport function getPreviewPointValues(config: BreakpointConfig): LegacyBreakpointConfig {\n const result: LegacyBreakpointConfig = {};\n for (const [name, entry] of Object.entries(config)) {\n result[name] = entry.previewPoint;\n }\n return result;\n}\n\n/**\n * Get all breakpoint names from the breakpoint configuration\n * Always includes 'base' plus all keys from the config\n * Order: base (desktop) -> breakpoints sorted by value descending (largest to smallest viewport)\n */\nexport function getAllBreakpointNames(\n breakpoints: BreakpointConfig = DEFAULT_BREAKPOINTS\n): BreakpointName[] {\n // Base is always included first\n const names: BreakpointName[] = ['base'];\n\n // Get all breakpoint names from config and sort by breakpoint value (descending)\n // This ensures proper order: largest viewport first\n const breakpointEntries = Object.entries(breakpoints);\n breakpointEntries.sort((a, b) => b[1].breakpoint - a[1].breakpoint); // Sort descending by breakpoint value\n\n // Add breakpoint names in sorted order\n for (const [name] of breakpointEntries) {\n names.push(name);\n }\n\n return names;\n}\n\n/**\n * Get active breakpoint name based on viewport width\n * Returns the smallest breakpoint that the viewport width is less than or equal to\n * If viewport is larger than all breakpoints, returns 'base'\n * Uses .breakpoint value for comparison (CSS threshold)\n */\nexport function getBreakpointName(\n viewportWidth: number,\n breakpoints: BreakpointConfig = DEFAULT_BREAKPOINTS\n): BreakpointName {\n // Sort breakpoints by breakpoint value (ascending) to find the smallest one that matches\n const breakpointEntries = Object.entries(breakpoints);\n breakpointEntries.sort((a, b) => a[1].breakpoint - b[1].breakpoint); // Sort ascending by breakpoint value\n\n // Find the smallest breakpoint that viewport width is <= to\n for (const [name, entry] of breakpointEntries) {\n if (viewportWidth <= entry.breakpoint) {\n return name;\n }\n }\n\n // If viewport is larger than all breakpoints, return 'base'\n return 'base';\n}\n\n/**\n * Get display label for a breakpoint\n * Priority:\n * 1. Label from config (if set)\n * 2. \"Desktop\" for 'base'\n * 3. Auto-capitalized name (camelCase -> Title Case)\n */\nexport function getBreakpointLabel(\n name: BreakpointName,\n breakpoints: BreakpointConfig = DEFAULT_BREAKPOINTS\n): string {\n // Base always returns \"Desktop\"\n if (name === 'base') {\n return 'Desktop';\n }\n\n // Check for custom label in config\n const entry = breakpoints[name];\n if (entry?.label) {\n return entry.label;\n }\n\n // Auto-format: camelCase -> Title Case\n // e.g., \"tabletLandscape\" -> \"Tablet Landscape\"\n return name\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, (str) => str.toUpperCase())\n .trim();\n}\n", "/**\n * Responsive Scaling Calculator\n * Automatically calculates responsive values for different breakpoints\n * using configured scale multipliers\n */\n\n/**\n * Scale configuration for a CSS property category\n * Keys are breakpoint names (e.g., 'tablet', 'mobile', 'small')\n * Values are scale multipliers (e.g., 0.88, 0.75)\n */\nexport type BreakpointScales = Record<string, number>;\n\nexport interface ResponsiveScales {\n enabled: boolean;\n baseReference: number;\n fontSize?: BreakpointScales;\n padding?: BreakpointScales;\n margin?: BreakpointScales;\n gap?: BreakpointScales;\n borderRadius?: BreakpointScales;\n size?: BreakpointScales;\n [key: string]: boolean | number | BreakpointScales | undefined;\n}\n\nexport type CSSPropertyType = 'fontSize' | 'padding' | 'margin' | 'gap' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft' | 'rowGap' | 'columnGap' | 'borderRadius' | 'borderTopLeftRadius' | 'borderTopRightRadius' | 'borderBottomLeftRadius' | 'borderBottomRightRadius' | 'width' | 'height' | 'maxWidth' | 'maxHeight' | 'minWidth' | 'minHeight';\n\n/**\n * Map CSS property to its scale category\n * e.g., paddingTop -> padding, marginRight -> margin\n */\nfunction getScaleCategory(property: CSSPropertyType): keyof ResponsiveScales | null {\n const propertyStr = property as string;\n if (property === 'fontSize') return 'fontSize';\n if (propertyStr.startsWith('padding')) return 'padding';\n if (propertyStr.startsWith('margin')) return 'margin';\n if (property === 'gap' || property === 'rowGap' || property === 'columnGap') return 'gap';\n if (propertyStr === 'borderRadius' || (propertyStr.startsWith('border') && propertyStr.includes('Radius'))) return 'borderRadius';\n if (property === 'width' || property === 'height' || property === 'maxWidth' || property === 'maxHeight' || property === 'minWidth' || property === 'minHeight') return 'size';\n return null;\n}\n\n/**\n * Extract numeric value and unit from a CSS value string\n * e.g., \"67px\" -> { value: 67, unit: \"px\" }\n */\nfunction parseValue(valueStr: string): { value: number; unit: string } | null {\n const match = valueStr.trim().match(/^(-?[\\d.]+)(px|rem|em|%|pt)$/);\n if (!match) return null;\n return {\n value: parseFloat(match[1]),\n unit: match[2],\n };\n}\n\n/**\n * Calculate responsive value using the formula:\n * responsive_value = base_value + (base_value - base_reference) * (scale - 1)\n */\nexport function calculateResponsiveValue(\n baseValue: number,\n baseReference: number,\n scale: number\n): number {\n // Values at or below baseReference stay unchanged\n if (Math.abs(baseValue) <= baseReference) {\n return Math.round(baseValue);\n }\n const scaled = baseValue + (baseValue - baseReference) * (scale - 1);\n return Math.round(scaled);\n}\n\n/**\n * Get the scale multiplier for a specific property and breakpoint\n * @param scales - The responsive scales configuration\n * @param property - The CSS property type (e.g., 'fontSize', 'padding')\n * @param breakpoint - The breakpoint name (e.g., 'tablet', 'mobile', 'small')\n */\nexport function getScaleMultiplier(\n scales: ResponsiveScales,\n property: CSSPropertyType,\n breakpoint: string\n): number | null {\n const category = getScaleCategory(property);\n if (!category || !scales[category]) return null;\n\n const scaleConfig = scales[category] as BreakpointScales | undefined;\n return scaleConfig?.[breakpoint] ?? null;\n}\n\n/**\n * Parse multi-value CSS property (e.g., \"20px 40px\" for padding)\n * Handles both space-separated (\"20px 40px\") and hyphen-separated (\"20px-40px\") formats\n * Returns array of individual values\n */\nexport function parseMultiValue(valueStr: string): string[] {\n // First, convert hyphen separators to spaces (for class names like \"p-0-80px\" \u2192 \"0-80px\")\n // But only convert hyphens between values (digit/px followed by hyphen followed by digit/px)\n const normalized = valueStr.replace(/(?<=\\w)-(?=\\d|auto|inherit|initial|unset)/g, ' ');\n return normalized.trim().split(/\\s+/).filter(v => v.length > 0);\n}\n\n/**\n * Scale a single CSS value using the responsive scale\n * Returns null if the value cannot be parsed (no unit)\n */\nexport function scaleValue(\n valueStr: string,\n baseReference: number,\n scale: number\n): string | null {\n const parsed = parseValue(valueStr);\n if (!parsed) return null;\n\n // `%` and `em` are already relative to their rendering context\n // (container / local font-size), so they should not be rescaled.\n if (parsed.unit === '%' || parsed.unit === 'em') {\n return valueStr.trim();\n }\n\n const scaledValue = calculateResponsiveValue(parsed.value, baseReference, scale);\n return `${scaledValue}${parsed.unit}`;\n}\n\n/**\n * Scale a potentially multi-value CSS property\n * e.g., \"20px 40px\" -> \"18px 36px\" (both values scaled independently)\n * Unitless values (0, auto, inherit) are kept as-is\n */\nexport function scalePropertyValue(\n valueStr: string,\n baseReference: number,\n scale: number\n): string | null {\n const parts = parseMultiValue(valueStr);\n if (parts.length === 0) return null;\n\n const scaledParts = parts.map(part => {\n // Try to scale the value\n const scaled = scaleValue(part, baseReference, scale);\n if (scaled !== null) {\n return scaled;\n }\n // If it can't be scaled, keep it as-is (for unitless values like 0, auto, inherit)\n return part;\n });\n\n return scaledParts.join(' ');\n}\n\n/**\n * Get responsive values for all breakpoints\n * Returns object with calculated values for each breakpoint\n *\n * @param baseValue - The base CSS value (e.g., '67px')\n * @param property - The CSS property type (e.g., 'fontSize')\n * @param scales - The responsive scales configuration\n * @param breakpointNames - Optional array of breakpoint names to calculate values for.\n * If not provided, defaults to ['tablet', 'mobile'] for backward compatibility.\n */\nexport function getResponsiveValues(\n baseValue: string,\n property: CSSPropertyType,\n scales: ResponsiveScales,\n breakpointNames?: string[]\n): Record<string, string | null> {\n if (!scales.enabled) {\n return { base: baseValue };\n }\n\n const result: Record<string, string | null> = {\n base: baseValue,\n };\n\n const baseRef = scales.baseReference || 16;\n\n // Use provided breakpoint names or default to tablet/mobile for backward compatibility\n const breakpoints = breakpointNames ?? ['tablet', 'mobile'];\n\n // Calculate value for each breakpoint\n for (const breakpointName of breakpoints) {\n const scale = getScaleMultiplier(scales, property, breakpointName);\n if (scale !== null) {\n result[breakpointName] = scalePropertyValue(baseValue, baseRef, scale);\n }\n }\n\n return result;\n}\n\n/**\n * Resolve the effective value of a CSS variable at a given breakpoint.\n *\n * Precedence (mirrors generateVariablesCSS in cssGenerator.ts so the editor\n * widget stays in sync with what the browser will render):\n * 1. `breakpoint === 'base'` \u2192 variable.value\n * 2. explicit per-variable override \u2192 variable.scales[breakpoint]\n * 3. globally-scaled value (ResponsiveScales multiplier for variable.type)\n * 4. fallback \u2192 variable.value\n */\nexport function resolveVariableValueAtBreakpoint(\n variable: { value: string; type: string; scales?: Record<string, string> },\n breakpoint: string,\n responsiveScales?: ResponsiveScales | null\n): string {\n if (breakpoint === 'base') return variable.value;\n\n const override = variable.scales?.[breakpoint];\n if (override !== undefined) return override;\n\n if (responsiveScales?.enabled && variable.type !== 'none') {\n const scale = getScaleMultiplier(\n responsiveScales,\n variable.type as CSSPropertyType,\n breakpoint\n );\n if (scale !== null) {\n const baseRef = responsiveScales.baseReference || 16;\n const scaled = scalePropertyValue(variable.value, baseRef, scale);\n if (scaled !== null) return scaled;\n }\n }\n\n return variable.value;\n}\n\n/**\n * Default responsive scales configuration\n */\nexport const DEFAULT_RESPONSIVE_SCALES: ResponsiveScales = {\n enabled: false,\n baseReference: 16,\n fontSize: {\n tablet: 0.88,\n mobile: 0.75,\n },\n padding: {\n tablet: 0.75,\n mobile: 0.5,\n },\n margin: {\n tablet: 0.7,\n mobile: 0.45,\n },\n gap: {\n tablet: 0.65,\n mobile: 0.4,\n },\n borderRadius: {\n tablet: 0.85,\n mobile: 0.7,\n },\n size: {\n tablet: 0.9,\n mobile: 0.75,\n },\n};\n", "/**\n * Internationalization (i18n) utilities\n * Handles inline translation resolution for component props\n */\n\nimport type { I18nValue, I18nConfig, LocaleConfig } from './types/components';\n\n/**\n * Default i18n configuration\n */\nexport const DEFAULT_I18N_CONFIG: I18nConfig = {\n defaultLocale: 'en',\n locales: [\n { code: 'en', name: 'English', nativeName: 'English', langTag: 'en-US' }\n ],\n};\n\n// ============================================\n// Locale helper functions\n// ============================================\n\n/**\n * Get array of locale codes from config\n */\nexport function getLocaleCodes(config: I18nConfig): string[] {\n return config.locales.map(loc => loc.code);\n}\n\n/**\n * Find a locale config by its code\n */\nexport function findLocaleByCode(config: I18nConfig, code: string): LocaleConfig | undefined {\n return config.locales.find(loc => loc.code === code);\n}\n\n/**\n * Check if a locale code is valid/exists in config\n */\nexport function isValidLocaleCode(config: I18nConfig, code: string): boolean {\n return config.locales.some(loc => loc.code === code);\n}\n\n// ============================================\n// Config Migration (old string[] -> new LocaleConfig[])\n// ============================================\n\n/**\n * Convert old locale format (string) to new format (LocaleConfig)\n */\nfunction migrateLocaleString(code: string): LocaleConfig {\n const upperCode = code.toUpperCase();\n return {\n code: code.toLowerCase(),\n name: upperCode,\n nativeName: upperCode,\n langTag: `${code.toLowerCase()}-${upperCode}`,\n };\n}\n\n/**\n * Check if locales array is in old string format\n */\nfunction isOldLocaleFormat(locales: unknown): locales is string[] {\n return Array.isArray(locales) && locales.length > 0 && typeof locales[0] === 'string';\n}\n\n/**\n * Migrate i18n config from old format to new format\n * Old: { defaultLocale: \"en\", locales: [\"en\", \"pl\"] }\n * New: { defaultLocale: \"en\", locales: [{ code: \"en\", name: \"EN\", ... }] }\n */\nexport function migrateI18nConfig(i18n: unknown): I18nConfig {\n if (!i18n || typeof i18n !== 'object') {\n return DEFAULT_I18N_CONFIG;\n }\n\n const config = i18n as Record<string, unknown>;\n const defaultLocale = (config.defaultLocale as string) || 'en';\n const locales = config.locales;\n\n if (!locales || !Array.isArray(locales)) {\n return DEFAULT_I18N_CONFIG;\n }\n\n // Migrate old string[] format\n if (isOldLocaleFormat(locales)) {\n return {\n defaultLocale,\n locales: locales.map(migrateLocaleString),\n };\n }\n\n // Already in new format\n return {\n defaultLocale,\n locales: locales as LocaleConfig[],\n };\n}\n\n/**\n * Type guard to check if a value is an I18nValue object\n */\nexport function isI18nValue(value: unknown): value is I18nValue {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return false;\n }\n return '_i18n' in value && (value as Record<string, unknown>)._i18n === true;\n}\n\n/**\n * Resolve a single translation value for the given locale\n * Fallback order: exact locale -> default locale -> first available -> empty\n * Works with any value type (strings, arrays for list props, etc.)\n */\nexport function resolveTranslation(\n value: I18nValue,\n locale: string,\n config: I18nConfig\n): unknown {\n // Try exact locale match (any type - string, array, etc.)\n if (locale in value && value[locale] !== undefined && locale !== '_i18n') {\n return value[locale];\n }\n\n // Try default locale\n if (config.defaultLocale in value && value[config.defaultLocale] !== undefined) {\n return value[config.defaultLocale];\n }\n\n // Get first available value (skip _i18n marker)\n for (const key of Object.keys(value)) {\n if (key !== '_i18n' && value[key] !== undefined) {\n return value[key];\n }\n }\n\n // Return empty string for string i18n, empty array for list i18n\n // Check if any value is an array to determine the type\n const hasArrayValue = Object.entries(value).some(\n ([k, v]) => k !== '_i18n' && Array.isArray(v)\n );\n return hasArrayValue ? [] : '';\n}\n\n/**\n * Resolve a value that might be an I18nValue or a regular value\n * Returns the original value if not an I18nValue\n */\nexport function resolveI18nValue(\n value: unknown,\n locale: string,\n config: I18nConfig\n): unknown {\n if (isI18nValue(value)) {\n return resolveTranslation(value, locale, config);\n }\n return value;\n}\n\n/**\n * Recursively resolve all I18nValue objects in a props object\n */\nexport function resolveI18nInProps(\n props: Record<string, unknown>,\n locale: string,\n config: I18nConfig\n): Record<string, unknown> {\n const resolved: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (isI18nValue(value)) {\n resolved[key] = resolveTranslation(value, locale, config);\n } else if (Array.isArray(value)) {\n resolved[key] = value.map((item) =>\n isI18nValue(item) ? resolveTranslation(item, locale, config) : item\n );\n } else if (typeof value === 'object' && value !== null) {\n // Recursively resolve nested objects (but not I18nValue which is already handled)\n resolved[key] = resolveI18nInProps(\n value as Record<string, unknown>,\n locale,\n config\n );\n } else {\n resolved[key] = value;\n }\n }\n\n return resolved;\n}\n\n/**\n * Extract locale from URL path prefix\n * e.g., '/en/about' -> 'en', '/pl/' -> 'pl', '/about' -> null\n */\nexport function extractLocaleFromPath(\n path: string,\n config: I18nConfig\n): { locale: string | null; pathWithoutLocale: string } {\n // Remove leading slash and split\n const cleanPath = path.startsWith('/') ? path.slice(1) : path;\n const segments = cleanPath.split('/');\n\n if (segments.length > 0 && isValidLocaleCode(config, segments[0])) {\n const locale = segments[0];\n const pathWithoutLocale = '/' + segments.slice(1).join('/');\n return { locale, pathWithoutLocale: pathWithoutLocale || '/' };\n }\n\n return { locale: null, pathWithoutLocale: path };\n}\n\n/**\n * Build a localized path\n * e.g., ('/about', 'pl') -> '/pl/about'\n */\nexport function buildLocalizedPath(path: string, locale: string): string {\n const cleanPath = path.startsWith('/') ? path : '/' + path;\n return `/${locale}${cleanPath === '/' ? '' : cleanPath}`;\n}\n\n/**\n * Locale context containing resolved locale info\n */\nexport interface LocaleContext {\n /** The effective locale (never null) */\n locale: string;\n /** Path with locale prefix removed */\n pathWithoutLocale: string;\n /** Whether the current locale is the default */\n isDefaultLocale: boolean;\n}\n\n/**\n * Parse locale from path and return full context with effective locale\n * Combines extractLocaleFromPath + defaultLocale resolution in one call\n */\nexport function parseLocaleFromPath(\n path: string,\n config: I18nConfig\n): LocaleContext {\n const { locale, pathWithoutLocale } = extractLocaleFromPath(path, config);\n const effectiveLocale = locale || config.defaultLocale;\n\n return {\n locale: effectiveLocale,\n pathWithoutLocale,\n isDefaultLocale: effectiveLocale === config.defaultLocale\n };\n}\n\n// ============================================\n// Client-side locale persistence utilities\n// ============================================\n\nconst LOCALE_STORAGE_KEY = 'meno_locale_preference';\nconst OLD_LOCALE_STORAGE_KEY = 'uplo_locale_preference';\n\n/**\n * Migrate locale storage key from old to new (one-time migration)\n */\nfunction migrateLocaleStorageKey(): void {\n if (typeof window === 'undefined') return;\n try {\n const oldValue = localStorage.getItem(OLD_LOCALE_STORAGE_KEY);\n const newValue = localStorage.getItem(LOCALE_STORAGE_KEY);\n if (oldValue && !newValue) {\n localStorage.setItem(LOCALE_STORAGE_KEY, oldValue);\n localStorage.removeItem(OLD_LOCALE_STORAGE_KEY);\n }\n } catch {\n // Storage not available\n }\n}\n\n/**\n * Get stored locale preference from localStorage (client-side only)\n */\nexport function getStoredLocale(): string | null {\n if (typeof window === 'undefined') return null;\n try {\n // Migrate from old key if needed\n migrateLocaleStorageKey();\n return localStorage.getItem(LOCALE_STORAGE_KEY);\n } catch {\n return null;\n }\n}\n\n/**\n * Store locale preference to localStorage (client-side only)\n */\nexport function setStoredLocale(locale: string): void {\n if (typeof window === 'undefined') return;\n try {\n localStorage.setItem(LOCALE_STORAGE_KEY, locale);\n } catch {\n // Storage not available\n }\n}\n\n/**\n * Clear stored locale preference (client-side only)\n */\nexport function clearStoredLocale(): void {\n if (typeof window === 'undefined') return;\n try {\n localStorage.removeItem(LOCALE_STORAGE_KEY);\n } catch {\n // Storage not available\n }\n}\n", "export interface RemConversionConfig {\n enabled: boolean;\n baseFontSize: number;\n}\n\nexport const DEFAULT_REM_CONFIG: RemConversionConfig = {\n enabled: false,\n baseFontSize: 16,\n};\n\nconst PX_REGEX = /(-?\\d*\\.?\\d+)px/g;\n\n/**\n * Convert all px values in a CSS value string to rem.\n * Handles multi-value shorthands like \"16px 32px\" -> \"1rem 2rem\".\n * 0px becomes \"0\" (unitless).\n */\nexport function convertPxToRem(cssValue: string, baseFontSize: number): string {\n return cssValue.replace(PX_REGEX, (_, num) => {\n const px = parseFloat(num);\n if (px === 0) return '0';\n const rem = px / baseFontSize;\n // Round to 4 decimal places, strip trailing zeros\n const rounded = parseFloat(rem.toFixed(4));\n return `${rounded}rem`;\n });\n}\n\n/**\n * CSS properties that should keep px values (thin borders, shadows).\n */\nconst PX_KEEP_PROPERTIES = new Set([\n 'border-width',\n 'border-top-width',\n 'border-right-width',\n 'border-bottom-width',\n 'border-left-width',\n 'outline-width',\n 'outline-offset',\n 'border',\n 'box-shadow',\n 'text-shadow',\n]);\n\nexport function shouldConvertProperty(cssProperty: string): boolean {\n return !PX_KEEP_PROPERTIES.has(cssProperty);\n}\n\n/**\n * Apply rem conversion to a CSS declarations string (e.g. \"padding: 16px; font-size: 18px\").\n * Checks each property against the exclusion list before converting.\n */\nexport function applyRemConversion(\n declarations: string,\n remConfig?: RemConversionConfig\n): string {\n if (!remConfig?.enabled) return declarations;\n\n return declarations\n .split(';')\n .map(decl => {\n const trimmed = decl.trim();\n if (!trimmed) return '';\n const colonIndex = trimmed.indexOf(':');\n if (colonIndex === -1) return trimmed;\n\n const property = trimmed.substring(0, colonIndex).trim();\n const value = trimmed.substring(colonIndex + 1).trim();\n\n if (shouldConvertProperty(property)) {\n return `${property}: ${convertPxToRem(value, remConfig.baseFontSize)}`;\n }\n return tr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ACvD,UAAM,QAAQ,QAAQ,UAAU,aAAa,CAAC,EAAE,KAAK;AAErD,QAAI,sBAAsB,QAAQ,GAAG;AACnC,aAAO,GAAG,QAAQ,KAAK,eAAe,OAAO,UAAU,YAAY,CAAC;AAAA,IACtE;AACA,WAAO;AAAA,EACT,CAAC,EACA,OAAO,OAAO,EACd,KAAK,IAAI;AACd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConfigService,
|
|
3
3
|
configService
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WQSG5WHC.js";
|
|
5
5
|
import "./chunk-5Z5VQRTJ.js";
|
|
6
6
|
import "./chunk-WQFG7PAH.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-XSWR3QLI.js";
|
|
8
8
|
import "./chunk-KSBZ2L7C.js";
|
|
9
9
|
export {
|
|
10
10
|
ConfigService,
|
|
11
11
|
configService
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=configService-
|
|
13
|
+
//# sourceMappingURL=configService-6KTT6GRT.js.map
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
TREE_SCROLL_DELAY_MS,
|
|
20
20
|
WEBSOCKET_STATES,
|
|
21
21
|
init_constants
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-NZTSJS5C.js";
|
|
23
23
|
import "./chunk-KSBZ2L7C.js";
|
|
24
24
|
init_constants();
|
|
25
25
|
export {
|
|
@@ -43,4 +43,4 @@ export {
|
|
|
43
43
|
TREE_SCROLL_DELAY_MS,
|
|
44
44
|
WEBSOCKET_STATES
|
|
45
45
|
};
|
|
46
|
-
//# sourceMappingURL=constants-
|
|
46
|
+
//# sourceMappingURL=constants-L5IKLB6U.js.map
|
|
@@ -6,27 +6,27 @@ import {
|
|
|
6
6
|
PageService,
|
|
7
7
|
WebSocketManager,
|
|
8
8
|
createServer
|
|
9
|
-
} from "../chunks/chunk-
|
|
9
|
+
} from "../chunks/chunk-TVH3TC2T.js";
|
|
10
10
|
import {
|
|
11
11
|
CMSService,
|
|
12
12
|
FileSystemCMSProvider,
|
|
13
13
|
loadProjectConfig,
|
|
14
14
|
migrateTemplatesDirectory
|
|
15
|
-
} from "../chunks/chunk-
|
|
15
|
+
} from "../chunks/chunk-BZQKEJQY.js";
|
|
16
16
|
import {
|
|
17
17
|
configService
|
|
18
|
-
} from "../chunks/chunk-
|
|
18
|
+
} from "../chunks/chunk-WQSG5WHC.js";
|
|
19
19
|
import {
|
|
20
20
|
projectPaths
|
|
21
21
|
} from "../chunks/chunk-5Z5VQRTJ.js";
|
|
22
22
|
import "../chunks/chunk-WQFG7PAH.js";
|
|
23
|
-
import "../chunks/chunk-
|
|
24
|
-
import "../chunks/chunk-
|
|
25
|
-
import "../chunks/chunk-
|
|
26
|
-
import "../chunks/chunk-
|
|
27
|
-
import "../chunks/chunk-
|
|
23
|
+
import "../chunks/chunk-IF3RATBY.js";
|
|
24
|
+
import "../chunks/chunk-KITQJYZV.js";
|
|
25
|
+
import "../chunks/chunk-F7MA62WG.js";
|
|
26
|
+
import "../chunks/chunk-5ZASE4IG.js";
|
|
27
|
+
import "../chunks/chunk-XSWR3QLI.js";
|
|
28
28
|
import "../chunks/chunk-UB44F4Z2.js";
|
|
29
|
-
import "../chunks/chunk-
|
|
29
|
+
import "../chunks/chunk-NZTSJS5C.js";
|
|
30
30
|
import "../chunks/chunk-KSBZ2L7C.js";
|
|
31
31
|
|
|
32
32
|
// entries/server-router.tsx
|
package/dist/lib/client/index.js
CHANGED
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
resolveLinkMapping,
|
|
13
13
|
resolveStyleMapping,
|
|
14
14
|
skipEmptyTemplateAttributes
|
|
15
|
-
} from "../../chunks/chunk-
|
|
15
|
+
} from "../../chunks/chunk-F7MA62WG.js";
|
|
16
16
|
import {
|
|
17
17
|
filterCSSProperties,
|
|
18
18
|
logNetworkError,
|
|
19
19
|
logRuntimeError
|
|
20
|
-
} from "../../chunks/chunk-
|
|
20
|
+
} from "../../chunks/chunk-GYF3ABI3.js";
|
|
21
21
|
import {
|
|
22
22
|
BaseComponentRegistry,
|
|
23
23
|
DEFAULT_PREFETCH_CONFIG,
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
singularize,
|
|
60
60
|
sortClassesByPropertyOrder,
|
|
61
61
|
validatePageData
|
|
62
|
-
} from "../../chunks/chunk-
|
|
62
|
+
} from "../../chunks/chunk-5ZASE4IG.js";
|
|
63
63
|
import {
|
|
64
64
|
DEFAULT_BREAKPOINTS,
|
|
65
65
|
DEFAULT_I18N_CONFIG,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
parseLocaleFromPath,
|
|
72
72
|
resolveI18nValue,
|
|
73
73
|
setStoredLocale
|
|
74
|
-
} from "../../chunks/chunk-
|
|
74
|
+
} from "../../chunks/chunk-XSWR3QLI.js";
|
|
75
75
|
import {
|
|
76
76
|
isTiptapDocument,
|
|
77
77
|
tiptapToHtml
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
NOT_FOUND_TIMEOUT_MS,
|
|
84
84
|
RAW_HTML_PREFIX,
|
|
85
85
|
init_constants
|
|
86
|
-
} from "../../chunks/chunk-
|
|
86
|
+
} from "../../chunks/chunk-NZTSJS5C.js";
|
|
87
87
|
import "../../chunks/chunk-KSBZ2L7C.js";
|
|
88
88
|
|
|
89
89
|
// lib/client/core/ComponentBuilder.ts
|
package/dist/lib/server/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "../../chunks/chunk-4OFZP5NQ.js";
|
|
4
4
|
import {
|
|
5
5
|
buildStaticPages
|
|
6
|
-
} from "../../chunks/chunk-
|
|
6
|
+
} from "../../chunks/chunk-OUNJ76QM.js";
|
|
7
7
|
import {
|
|
8
8
|
ComponentService,
|
|
9
9
|
EnumService,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
logResponseTime,
|
|
33
33
|
withErrorHandling,
|
|
34
34
|
withLogging
|
|
35
|
-
} from "../../chunks/chunk-
|
|
35
|
+
} from "../../chunks/chunk-TVH3TC2T.js";
|
|
36
36
|
import {
|
|
37
37
|
CMSService,
|
|
38
38
|
ColorService,
|
|
@@ -82,11 +82,11 @@ import {
|
|
|
82
82
|
styleToString,
|
|
83
83
|
translatePath,
|
|
84
84
|
variableService
|
|
85
|
-
} from "../../chunks/chunk-
|
|
85
|
+
} from "../../chunks/chunk-BZQKEJQY.js";
|
|
86
86
|
import {
|
|
87
87
|
ConfigService,
|
|
88
88
|
configService
|
|
89
|
-
} from "../../chunks/chunk-
|
|
89
|
+
} from "../../chunks/chunk-WQSG5WHC.js";
|
|
90
90
|
import {
|
|
91
91
|
bundleFile,
|
|
92
92
|
createRuntimeServer,
|
|
@@ -115,9 +115,9 @@ import {
|
|
|
115
115
|
spawnProcess,
|
|
116
116
|
writeFile
|
|
117
117
|
} from "../../chunks/chunk-WQFG7PAH.js";
|
|
118
|
-
import "../../chunks/chunk-
|
|
119
|
-
import "../../chunks/chunk-
|
|
120
|
-
import "../../chunks/chunk-
|
|
118
|
+
import "../../chunks/chunk-IF3RATBY.js";
|
|
119
|
+
import "../../chunks/chunk-KITQJYZV.js";
|
|
120
|
+
import "../../chunks/chunk-F7MA62WG.js";
|
|
121
121
|
import {
|
|
122
122
|
extractInteractiveStyleMappings,
|
|
123
123
|
generateAllInteractiveCSS,
|
|
@@ -127,14 +127,14 @@ import {
|
|
|
127
127
|
isItemDraftForLocale,
|
|
128
128
|
isVoidElement,
|
|
129
129
|
singularize
|
|
130
|
-
} from "../../chunks/chunk-
|
|
130
|
+
} from "../../chunks/chunk-5ZASE4IG.js";
|
|
131
131
|
import {
|
|
132
132
|
DEFAULT_BREAKPOINTS,
|
|
133
133
|
DEFAULT_I18N_CONFIG,
|
|
134
134
|
buildLocalizedPath,
|
|
135
135
|
isI18nValue,
|
|
136
136
|
resolveI18nValue
|
|
137
|
-
} from "../../chunks/chunk-
|
|
137
|
+
} from "../../chunks/chunk-XSWR3QLI.js";
|
|
138
138
|
import "../../chunks/chunk-UB44F4Z2.js";
|
|
139
139
|
import {
|
|
140
140
|
HMR_ROUTE,
|
|
@@ -144,7 +144,7 @@ import {
|
|
|
144
144
|
SERVER_PORT,
|
|
145
145
|
SERVE_PORT,
|
|
146
146
|
init_constants
|
|
147
|
-
} from "../../chunks/chunk-
|
|
147
|
+
} from "../../chunks/chunk-NZTSJS5C.js";
|
|
148
148
|
import "../../chunks/chunk-KSBZ2L7C.js";
|
|
149
149
|
|
|
150
150
|
// build-astro.ts
|
package/dist/lib/shared/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
generateFilenameFromItem,
|
|
4
4
|
generateUniqueFilename,
|
|
5
5
|
slugify
|
|
6
|
-
} from "../../chunks/chunk-
|
|
6
|
+
} from "../../chunks/chunk-IF3RATBY.js";
|
|
7
7
|
import {
|
|
8
8
|
PathTraversalError,
|
|
9
9
|
SAFE_IDENTIFIER_REGEX,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
isValidIdentifier,
|
|
24
24
|
resolvePaletteColor,
|
|
25
25
|
resolveSafePath
|
|
26
|
-
} from "../../chunks/chunk-
|
|
26
|
+
} from "../../chunks/chunk-KITQJYZV.js";
|
|
27
27
|
import {
|
|
28
28
|
CSS_PROPERTIES,
|
|
29
29
|
CSS_PROPERTIES_DEFINITION,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
logNetworkError,
|
|
37
37
|
logRuntimeError,
|
|
38
38
|
setErrorHandler
|
|
39
|
-
} from "../../chunks/chunk-
|
|
39
|
+
} from "../../chunks/chunk-GYF3ABI3.js";
|
|
40
40
|
import {
|
|
41
41
|
BaseComponentRegistry,
|
|
42
42
|
BaseNodeTypeRegistry,
|
|
@@ -89,6 +89,7 @@ import {
|
|
|
89
89
|
classToStyle,
|
|
90
90
|
classesToStyles,
|
|
91
91
|
clearRegistry,
|
|
92
|
+
componentHasSlot,
|
|
92
93
|
convertComponentPathToPagePath,
|
|
93
94
|
convertPagePathToComponentPath,
|
|
94
95
|
createNodeType,
|
|
@@ -204,7 +205,7 @@ import {
|
|
|
204
205
|
validatePath,
|
|
205
206
|
validatePropDefinition,
|
|
206
207
|
validateStructuredComponentDefinition
|
|
207
|
-
} from "../../chunks/chunk-
|
|
208
|
+
} from "../../chunks/chunk-5ZASE4IG.js";
|
|
208
209
|
import {
|
|
209
210
|
DEFAULT_BREAKPOINTS,
|
|
210
211
|
DEFAULT_I18N_CONFIG,
|
|
@@ -232,10 +233,11 @@ import {
|
|
|
232
233
|
resolveI18nInProps,
|
|
233
234
|
resolveI18nValue,
|
|
234
235
|
resolveTranslation,
|
|
236
|
+
resolveVariableValueAtBreakpoint,
|
|
235
237
|
scalePropertyValue,
|
|
236
238
|
scaleValue,
|
|
237
239
|
setStoredLocale
|
|
238
|
-
} from "../../chunks/chunk-
|
|
240
|
+
} from "../../chunks/chunk-XSWR3QLI.js";
|
|
239
241
|
import {
|
|
240
242
|
RICH_TEXT_ALLOWED_ATTRS,
|
|
241
243
|
RICH_TEXT_ALLOWED_TAGS,
|
|
@@ -265,7 +267,7 @@ import {
|
|
|
265
267
|
TREE_SCROLL_DELAY_MS,
|
|
266
268
|
WEBSOCKET_STATES,
|
|
267
269
|
init_constants
|
|
268
|
-
} from "../../chunks/chunk-
|
|
270
|
+
} from "../../chunks/chunk-NZTSJS5C.js";
|
|
269
271
|
import "../../chunks/chunk-KSBZ2L7C.js";
|
|
270
272
|
|
|
271
273
|
// lib/shared/index.ts
|
|
@@ -1329,6 +1331,7 @@ export {
|
|
|
1329
1331
|
classesToStyles,
|
|
1330
1332
|
clearRegistry,
|
|
1331
1333
|
clearStoredLocale,
|
|
1334
|
+
componentHasSlot,
|
|
1332
1335
|
convertComponentPathToPagePath,
|
|
1333
1336
|
convertPagePathToComponentPath,
|
|
1334
1337
|
createError,
|
|
@@ -1501,6 +1504,7 @@ export {
|
|
|
1501
1504
|
resolveSafePath,
|
|
1502
1505
|
resolveTemplateRawValue,
|
|
1503
1506
|
resolveTranslation,
|
|
1507
|
+
resolveVariableValueAtBreakpoint,
|
|
1504
1508
|
responsiveStylesToClasses,
|
|
1505
1509
|
rgbToCssString,
|
|
1506
1510
|
rgbToHex,
|