meno-core 1.0.53 → 1.0.54
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/.claude/settings.local.json +1 -3
- package/bin/cli.ts +48 -57
- package/build-astro.ts +131 -113
- package/build-next.ts +109 -96
- package/build-static.test.ts +39 -10
- package/build-static.ts +120 -122
- package/dist/bin/cli.js +34 -38
- package/dist/bin/cli.js.map +2 -2
- package/dist/build-static.js +12 -11
- package/dist/chunks/chunk-2AR55GYH.js +42 -0
- package/dist/chunks/chunk-2AR55GYH.js.map +7 -0
- package/dist/chunks/{chunk-IGYR22T6.js → chunk-2FN4UOVO.js} +512 -239
- package/dist/chunks/chunk-2FN4UOVO.js.map +7 -0
- package/dist/chunks/chunk-3XER4E5W.js +168 -0
- package/dist/chunks/chunk-3XER4E5W.js.map +7 -0
- package/dist/chunks/{chunk-X754AHS5.js → chunk-5ETZFREW.js} +9 -12
- package/dist/chunks/chunk-5ETZFREW.js.map +7 -0
- package/dist/chunks/{chunk-2MHDV5BF.js → chunk-7E4IF5L7.js} +15 -21
- package/dist/chunks/chunk-7E4IF5L7.js.map +7 -0
- package/dist/chunks/{chunk-JGWFTO6P.js → chunk-7HWQUVTU.js} +1578 -1349
- package/dist/chunks/chunk-7HWQUVTU.js.map +7 -0
- package/dist/chunks/{chunk-O3NAGJP4.js → chunk-AE3QK5QW.js} +110 -21
- package/dist/chunks/chunk-AE3QK5QW.js.map +7 -0
- package/dist/chunks/{chunk-GZHGVVW3.js → chunk-F6KTJYGV.js} +7 -7
- package/dist/chunks/chunk-F6KTJYGV.js.map +7 -0
- package/dist/chunks/{chunk-WQFG7PAH.js → chunk-FZITJSSS.js} +2 -6
- package/dist/chunks/chunk-FZITJSSS.js.map +7 -0
- package/dist/chunks/{chunk-QB2LNO4W.js → chunk-GSYYA5GX.js} +2 -2
- package/dist/chunks/chunk-GSYYA5GX.js.map +7 -0
- package/dist/chunks/{chunk-YBLHKYFF.js → chunk-HIZMY3EP.js} +1 -1
- package/dist/chunks/chunk-HIZMY3EP.js.map +7 -0
- package/dist/chunks/{chunk-AZQYF6KE.js → chunk-I2WEGYA7.js} +41 -176
- package/dist/chunks/chunk-I2WEGYA7.js.map +7 -0
- package/dist/chunks/{chunk-I7YIGZXT.js → chunk-JNO3CNLJ.js} +6 -9
- package/dist/chunks/chunk-JNO3CNLJ.js.map +7 -0
- package/dist/chunks/{chunk-UB44F4Z2.js → chunk-NVRBTSQG.js} +2 -4
- package/dist/chunks/chunk-NVRBTSQG.js.map +7 -0
- package/dist/chunks/{chunk-JGP5A3Y5.js → chunk-Q4OBWKXG.js} +40 -33
- package/dist/chunks/chunk-Q4OBWKXG.js.map +7 -0
- package/dist/chunks/{chunk-R6XHAFBF.js → chunk-QTE32Y53.js} +250 -242
- package/dist/chunks/chunk-QTE32Y53.js.map +7 -0
- package/dist/chunks/{chunk-H3GJ4H2U.js → chunk-STDY3OVM.js} +214 -85
- package/dist/chunks/chunk-STDY3OVM.js.map +7 -0
- package/dist/chunks/configService-PRJZF7Y6.js +14 -0
- package/dist/chunks/{constants-STK2YBIW.js → constants-KIQEYMAM.js} +2 -2
- package/dist/chunks/{fs-JGINUXGL.js → fs-ZI5JEU7V.js} +2 -2
- package/dist/entries/server-router.js +14 -19
- package/dist/entries/server-router.js.map +2 -2
- package/dist/lib/client/index.js +638 -332
- package/dist/lib/client/index.js.map +2 -2
- package/dist/lib/server/index.js +177 -235
- package/dist/lib/server/index.js.map +2 -2
- package/dist/lib/shared/index.js +80 -44
- package/dist/lib/shared/index.js.map +2 -2
- package/dist/lib/shared/richtext/index.js +1 -1
- package/dist/lib/test-utils/index.js +38 -60
- package/dist/lib/test-utils/index.js.map +2 -2
- package/entries/client-router.tsx +10 -8
- package/entries/server-router.tsx +1 -7
- package/lib/client/ClientInitializer.ts +8 -8
- package/lib/client/ErrorBoundary.test.tsx +146 -143
- package/lib/client/ErrorBoundary.tsx +175 -127
- package/lib/client/componentRegistry.test.ts +96 -108
- package/lib/client/componentRegistry.ts +1 -2
- package/lib/client/contexts/ThemeContext.tsx +3 -2
- package/lib/client/core/ComponentBuilder.test.ts +513 -560
- package/lib/client/core/ComponentBuilder.ts +318 -146
- package/lib/client/core/ComponentRenderer.test.tsx +1 -2
- package/lib/client/core/ComponentRenderer.tsx +46 -33
- package/lib/client/core/builders/embedBuilder.ts +241 -53
- package/lib/client/core/builders/linkBuilder.ts +71 -44
- package/lib/client/core/builders/linkNodeBuilder.ts +78 -53
- package/lib/client/core/builders/listBuilder.ts +115 -86
- package/lib/client/core/builders/localeListBuilder.ts +95 -60
- package/lib/client/core/builders/types.ts +5 -5
- package/lib/client/core/cmsTemplateProcessor.ts +7 -7
- package/lib/client/elementRegistry.ts +3 -3
- package/lib/client/fontFamiliesService.test.ts +2 -10
- package/lib/client/fontFamiliesService.ts +3 -3
- package/lib/client/hmr/HMRManager.tsx +8 -0
- package/lib/client/hmrCssReload.ts +14 -8
- package/lib/client/hmrWebSocket.ts +9 -14
- package/lib/client/hooks/useColorVariables.test.ts +21 -21
- package/lib/client/hooks/useColorVariables.ts +12 -10
- package/lib/client/hooks/usePropertyAutocomplete.ts +3 -5
- package/lib/client/hooks/useVariables.ts +4 -4
- package/lib/client/hydration/HydrationUtils.test.ts +24 -25
- package/lib/client/hydration/HydrationUtils.ts +3 -4
- package/lib/client/i18nConfigService.test.ts +2 -7
- package/lib/client/i18nConfigService.ts +2 -2
- package/lib/client/meno-filter/MenoFilter.test.ts +19 -21
- package/lib/client/meno-filter/MenoFilter.ts +5 -9
- package/lib/client/meno-filter/bindings.ts +15 -40
- package/lib/client/meno-filter/init.ts +1 -1
- package/lib/client/meno-filter/renderer.ts +23 -29
- package/lib/client/meno-filter/script.generated.ts +1 -3
- package/lib/client/meno-filter/ui.ts +3 -5
- package/lib/client/meno-filter/updates.ts +15 -21
- package/lib/client/navigation.test.ts +159 -159
- package/lib/client/navigation.ts +0 -1
- package/lib/client/responsiveStyleResolver.test.ts +230 -228
- package/lib/client/responsiveStyleResolver.ts +13 -16
- package/lib/client/routing/RouteLoader.test.ts +23 -24
- package/lib/client/routing/RouteLoader.ts +22 -35
- package/lib/client/routing/Router.tsx +31 -3
- package/lib/client/scripts/ScriptExecutor.test.ts +157 -158
- package/lib/client/scripts/ScriptExecutor.ts +15 -33
- package/lib/client/services/PrefetchService.test.ts +2 -2
- package/lib/client/services/PrefetchService.ts +10 -24
- package/lib/client/styleProcessor.test.ts +9 -9
- package/lib/client/styleProcessor.ts +18 -15
- package/lib/client/styles/StyleInjector.test.ts +122 -115
- package/lib/client/styles/StyleInjector.ts +9 -6
- package/lib/client/styles/UtilityClassCollector.ts +19 -26
- package/lib/client/styles/cspNonce.test.ts +2 -5
- package/lib/client/templateEngine.test.ts +554 -482
- package/lib/client/templateEngine.ts +200 -64
- package/lib/client/theme.ts +0 -1
- package/lib/client/utils/toast.ts +0 -1
- package/lib/server/__integration__/api-routes.test.ts +8 -4
- package/lib/server/__integration__/cms-integration.test.ts +1 -4
- package/lib/server/__integration__/server-lifecycle.test.ts +2 -5
- package/lib/server/__integration__/ssr-rendering.test.ts +47 -37
- package/lib/server/__integration__/static-assets.test.ts +1 -1
- package/lib/server/__integration__/test-helpers.ts +84 -70
- package/lib/server/ab/generateFunctions.ts +12 -10
- package/lib/server/astro/cmsPageEmitter.ts +23 -38
- package/lib/server/astro/componentEmitter.ts +25 -36
- package/lib/server/astro/cssCollector.ts +10 -26
- package/lib/server/astro/nodeToAstro.test.ts +1750 -30
- package/lib/server/astro/nodeToAstro.ts +198 -187
- package/lib/server/astro/normalizeOrphanTemplateProps.test.ts +105 -109
- package/lib/server/astro/normalizeOrphanTemplateProps.ts +4 -12
- package/lib/server/astro/pageEmitter.ts +9 -13
- package/lib/server/astro/tailwindMapper.test.ts +10 -37
- package/lib/server/astro/tailwindMapper.ts +33 -40
- package/lib/server/astro/templateTransformer.ts +14 -17
- package/lib/server/createServer.ts +5 -17
- package/lib/server/cssGenerator.test.ts +35 -44
- package/lib/server/cssGenerator.ts +6 -17
- package/lib/server/fileWatcher.test.ts +124 -10
- package/lib/server/fileWatcher.ts +124 -118
- package/lib/server/index.ts +7 -1
- package/lib/server/jsonLoader.test.ts +39 -2
- package/lib/server/jsonLoader.ts +33 -31
- package/lib/server/middleware/cors.test.ts +20 -20
- package/lib/server/middleware/cors.ts +28 -4
- package/lib/server/middleware/errorHandler.test.ts +5 -3
- package/lib/server/middleware/errorHandler.ts +3 -8
- package/lib/server/middleware/index.ts +0 -1
- package/lib/server/middleware/logger.test.ts +7 -5
- package/lib/server/middleware/logger.ts +10 -22
- package/lib/server/pageCache.test.ts +76 -77
- package/lib/server/pageCache.ts +0 -1
- package/lib/server/projectContext.ts +4 -3
- package/lib/server/providers/fileSystemCMSProvider.test.ts +124 -95
- package/lib/server/providers/fileSystemCMSProvider.ts +35 -20
- package/lib/server/providers/fileSystemPageProvider.test.ts +84 -0
- package/lib/server/providers/fileSystemPageProvider.ts +31 -12
- package/lib/server/routes/api/cms.test.ts +26 -14
- package/lib/server/routes/api/cms.ts +9 -14
- package/lib/server/routes/api/components.ts +30 -34
- package/lib/server/routes/api/config.ts +0 -1
- package/lib/server/routes/api/core-routes.ts +47 -74
- package/lib/server/routes/api/functions.ts +8 -16
- package/lib/server/routes/api/index.ts +3 -6
- package/lib/server/routes/api/pages.ts +8 -11
- package/lib/server/routes/api/shared.test.ts +1 -1
- package/lib/server/routes/api/shared.ts +12 -9
- package/lib/server/routes/api/variables.test.ts +1 -3
- package/lib/server/routes/api/variables.ts +1 -1
- package/lib/server/routes/index.ts +23 -26
- package/lib/server/routes/pages.ts +34 -29
- package/lib/server/routes/static.ts +16 -4
- package/lib/server/runtime/bundler.ts +47 -32
- package/lib/server/runtime/fs.ts +3 -13
- package/lib/server/runtime/httpServer.ts +5 -9
- package/lib/server/services/ColorService.ts +32 -27
- package/lib/server/services/EnumService.test.ts +2 -6
- package/lib/server/services/EnumService.ts +7 -2
- package/lib/server/services/VariableService.test.ts +1 -5
- package/lib/server/services/VariableService.ts +6 -1
- package/lib/server/services/cmsService.test.ts +116 -78
- package/lib/server/services/cmsService.ts +24 -54
- package/lib/server/services/componentService.test.ts +122 -36
- package/lib/server/services/componentService.ts +54 -38
- package/lib/server/services/configService.test.ts +9 -31
- package/lib/server/services/configService.ts +20 -27
- package/lib/server/services/fileWatcherService.ts +40 -6
- package/lib/server/services/index.ts +0 -1
- package/lib/server/services/pageService.test.ts +1 -3
- package/lib/server/services/pageService.ts +14 -13
- package/lib/server/ssr/attributeBuilder.ts +16 -6
- package/lib/server/ssr/buildErrorOverlay.ts +11 -12
- package/lib/server/ssr/clientDataInjector.ts +7 -21
- package/lib/server/ssr/cmsSSRProcessor.ts +3 -6
- package/lib/server/ssr/cssCollector.ts +1 -1
- package/lib/server/ssr/errorOverlay.test.ts +1 -1
- package/lib/server/ssr/errorOverlay.ts +3 -9
- package/lib/server/ssr/htmlGenerator.nonce.test.ts +3 -9
- package/lib/server/ssr/htmlGenerator.test.ts +120 -43
- package/lib/server/ssr/htmlGenerator.ts +120 -85
- package/lib/server/ssr/imageMetadata.test.ts +3 -1
- package/lib/server/ssr/imageMetadata.ts +25 -19
- package/lib/server/ssr/jsCollector.test.ts +3 -13
- package/lib/server/ssr/jsCollector.ts +3 -8
- package/lib/server/ssr/liveReloadIntegration.test.ts +69 -28
- package/lib/server/ssr/metaTagGenerator.ts +2 -2
- package/lib/server/ssr/ssrRenderer.branches.test.ts +1103 -0
- package/lib/server/ssr/ssrRenderer.test.ts +196 -246
- package/lib/server/ssr/ssrRenderer.ts +609 -225
- package/lib/server/ssrRenderer.test.ts +1044 -950
- package/lib/server/utils/jsonLineMapper.test.ts +28 -28
- package/lib/server/utils/jsonLineMapper.ts +1 -1
- package/lib/server/validateStyleCoverage.ts +18 -20
- package/lib/server/webflow/buildWebflow.ts +41 -53
- package/lib/server/webflow/nodeToWebflow.test.ts +150 -218
- package/lib/server/webflow/nodeToWebflow.ts +195 -258
- package/lib/server/webflow/styleMapper.test.ts +15 -56
- package/lib/server/webflow/styleMapper.ts +33 -41
- package/lib/server/webflow/types.ts +1 -8
- package/lib/server/websocketManager.ts +16 -19
- package/lib/shared/attributeNodeUtils.test.ts +15 -15
- package/lib/shared/attributeNodeUtils.ts +5 -12
- package/lib/shared/breakpoints.ts +4 -11
- package/lib/shared/cmsQueryParser.test.ts +50 -42
- package/lib/shared/cmsQueryParser.ts +49 -31
- package/lib/shared/colorVariableUtils.test.ts +5 -5
- package/lib/shared/colorVariableUtils.ts +3 -8
- package/lib/shared/componentRefs.ts +1 -5
- package/lib/shared/constants.test.ts +3 -3
- package/lib/shared/constants.ts +4 -8
- package/lib/shared/cssGeneration.test.ts +262 -144
- package/lib/shared/cssGeneration.ts +189 -516
- package/lib/shared/cssNamedColors.ts +152 -30
- package/lib/shared/cssProperties.test.ts +5 -6
- package/lib/shared/cssProperties.ts +296 -112
- package/lib/shared/elementClassName.test.ts +109 -109
- package/lib/shared/elementClassName.ts +1 -1
- package/lib/shared/elementUtils.ts +12 -16
- package/lib/shared/errorLogger.ts +2 -10
- package/lib/shared/errors.test.ts +2 -13
- package/lib/shared/errors.ts +2 -8
- package/lib/shared/expressionEvaluator.test.ts +119 -0
- package/lib/shared/expressionEvaluator.ts +43 -24
- package/lib/shared/fontLoader.test.ts +19 -5
- package/lib/shared/friendlyError.ts +2 -3
- package/lib/shared/gradientUtils.test.ts +1 -5
- package/lib/shared/gradientUtils.ts +2 -6
- package/lib/shared/hrefRefs.ts +2 -10
- package/lib/shared/i18n.test.ts +1 -1
- package/lib/shared/i18n.ts +13 -34
- package/lib/shared/index.ts +4 -0
- package/lib/shared/inlineSvgStyleRules.ts +2 -4
- package/lib/shared/interactiveStyleMappings.test.ts +11 -33
- package/lib/shared/interactiveStyleMappings.ts +9 -16
- package/lib/shared/interactiveStyles.test.ts +165 -188
- package/lib/shared/interfaces/contentProvider.ts +1 -1
- package/lib/shared/itemTemplateUtils.test.ts +6 -12
- package/lib/shared/itemTemplateUtils.ts +19 -35
- package/lib/shared/jsonRepair.ts +8 -2
- package/lib/shared/libraryLoader.test.ts +15 -49
- package/lib/shared/libraryLoader.ts +7 -22
- package/lib/shared/netlifyLocale404.test.ts +179 -0
- package/lib/shared/netlifyLocale404.ts +110 -0
- package/lib/shared/nodeUtils.test.ts +24 -16
- package/lib/shared/nodeUtils.ts +49 -19
- package/lib/shared/pathArrayUtils.test.ts +1 -2
- package/lib/shared/pathArrayUtils.ts +1 -1
- package/lib/shared/pathSecurity.ts +1 -1
- package/lib/shared/pathUtils.test.ts +4 -6
- package/lib/shared/pathUtils.ts +42 -48
- package/lib/shared/paths/Path.test.ts +2 -2
- package/lib/shared/paths/Path.ts +0 -1
- package/lib/shared/paths/PathConverter.test.ts +1 -1
- package/lib/shared/paths/PathConverter.ts +14 -17
- package/lib/shared/paths/PathUtils.ts +9 -10
- package/lib/shared/paths/PathValidator.test.ts +2 -15
- package/lib/shared/paths/PathValidator.ts +11 -9
- package/lib/shared/paths/index.ts +1 -2
- package/lib/shared/propResolver.test.ts +240 -244
- package/lib/shared/propResolver.ts +14 -25
- package/lib/shared/pxToRem.test.ts +7 -6
- package/lib/shared/pxToRem.ts +2 -5
- package/lib/shared/registry/BaseNodeTypeRegistry.test.ts +9 -5
- package/lib/shared/registry/ClientRegistry.ts +0 -1
- package/lib/shared/registry/ComponentRegistry.test.ts +43 -29
- package/lib/shared/registry/ComponentRegistry.ts +9 -11
- package/lib/shared/registry/NodeTypeDefinition.ts +15 -8
- package/lib/shared/registry/RegistryManager.ts +1 -2
- package/lib/shared/registry/SSRRegistry.ts +0 -1
- package/lib/shared/registry/createNodeType.ts +7 -9
- package/lib/shared/registry/defineNodeType.ts +2 -6
- package/lib/shared/registry/index.ts +0 -1
- package/lib/shared/registry/nodeTypes/ComponentInstanceNodeType.ts +14 -15
- package/lib/shared/registry/nodeTypes/EmbedNodeType.ts +18 -11
- package/lib/shared/registry/nodeTypes/HtmlNodeType.ts +47 -18
- package/lib/shared/registry/nodeTypes/LinkNodeType.ts +21 -19
- package/lib/shared/registry/nodeTypes/ListNodeType.ts +78 -74
- package/lib/shared/registry/nodeTypes/LocaleListNodeType.ts +27 -21
- package/lib/shared/registry/nodeTypes/SlotMarkerType.ts +6 -7
- package/lib/shared/registry/nodeTypes/index.ts +10 -2
- package/lib/shared/responsiveScaling.test.ts +15 -31
- package/lib/shared/responsiveScaling.ts +55 -37
- package/lib/shared/responsiveStyleUtils.ts +11 -13
- package/lib/shared/richtext/htmlToTiptap.test.ts +23 -14
- package/lib/shared/richtext/htmlToTiptap.ts +1 -3
- package/lib/shared/richtext/tiptapToHtml.test.ts +5 -6
- package/lib/shared/richtext/types.ts +1 -8
- package/lib/shared/slugTranslator.test.ts +13 -13
- package/lib/shared/slugTranslator.ts +12 -16
- package/lib/shared/slugify.ts +9 -15
- package/lib/shared/styleNodeUtils.test.ts +8 -8
- package/lib/shared/styleNodeUtils.ts +5 -10
- package/lib/shared/styleUtils.test.ts +87 -61
- package/lib/shared/styleUtils.ts +5 -6
- package/lib/shared/themeDefaults.test.ts +11 -11
- package/lib/shared/themeDefaults.ts +3 -4
- package/lib/shared/tree/PathBuilder.test.ts +62 -138
- package/lib/shared/tree/PathBuilder.ts +49 -39
- package/lib/shared/treePathUtils.test.ts +2 -10
- package/lib/shared/treePathUtils.ts +54 -59
- package/lib/shared/types/api.ts +1 -2
- package/lib/shared/types/cms.ts +25 -21
- package/lib/shared/types/comment.ts +49 -16
- package/lib/shared/types/components.ts +27 -25
- package/lib/shared/types/errors.test.ts +1 -6
- package/lib/shared/types/errors.ts +3 -7
- package/lib/shared/types/experiments.ts +28 -28
- package/lib/shared/types/index.ts +2 -2
- package/lib/shared/types/styles.ts +0 -1
- package/lib/shared/types/variables.test.ts +4 -13
- package/lib/shared/types/variables.ts +48 -27
- package/lib/shared/types.ts +1 -2
- package/lib/shared/utilityClassConfig.ts +648 -321
- package/lib/shared/utilityClassMapper.test.ts +203 -92
- package/lib/shared/utilityClassMapper.ts +188 -246
- package/lib/shared/utilityClassNames.ts +326 -0
- package/lib/shared/utils.test.ts +2 -10
- package/lib/shared/utils.ts +19 -10
- package/lib/shared/validation/cmsValidators.ts +2 -1
- package/lib/shared/validation/commentValidators.test.ts +53 -0
- package/lib/shared/validation/commentValidators.ts +12 -1
- package/lib/shared/validation/propValidator.test.ts +18 -20
- package/lib/shared/validation/propValidator.ts +12 -17
- package/lib/shared/validation/schemas.test.ts +24 -33
- package/lib/shared/validation/schemas.ts +469 -344
- package/lib/shared/validation/validators.test.ts +1 -6
- package/lib/shared/validation/validators.ts +89 -68
- package/lib/shared/viewportUnits.integration.test.ts +14 -10
- package/lib/shared/viewportUnits.test.ts +11 -23
- package/lib/test-utils/dom-setup.ts +1 -1
- package/lib/test-utils/factories/ConsoleMockFactory.ts +3 -7
- package/lib/test-utils/factories/DomMockFactory.ts +7 -19
- package/lib/test-utils/factories/EventMockFactory.ts +7 -13
- package/lib/test-utils/factories/FetchMockFactory.ts +39 -57
- package/lib/test-utils/factories/ServerMockFactory.ts +5 -9
- package/lib/test-utils/factories/StoreMockFactory.ts +14 -25
- package/lib/test-utils/fixtures.ts +45 -45
- package/lib/test-utils/helpers/asyncHelpers.test.ts +15 -18
- package/lib/test-utils/helpers/asyncHelpers.ts +11 -20
- package/lib/test-utils/helpers.ts +1 -5
- package/lib/test-utils/index.ts +0 -4
- package/lib/test-utils/mockFactories.ts +12 -18
- package/lib/test-utils/mocks.ts +4 -2
- package/package.json +1 -1
- package/scripts/build-meno-filter.ts +1 -4
- package/vite.config.ts +4 -4
- package/dist/chunks/chunk-2MHDV5BF.js.map +0 -7
- package/dist/chunks/chunk-AZQYF6KE.js.map +0 -7
- package/dist/chunks/chunk-GZHGVVW3.js.map +0 -7
- package/dist/chunks/chunk-H3GJ4H2U.js.map +0 -7
- package/dist/chunks/chunk-I7YIGZXT.js.map +0 -7
- package/dist/chunks/chunk-IGYR22T6.js.map +0 -7
- package/dist/chunks/chunk-JGP5A3Y5.js.map +0 -7
- package/dist/chunks/chunk-JGWFTO6P.js.map +0 -7
- package/dist/chunks/chunk-O3NAGJP4.js.map +0 -7
- package/dist/chunks/chunk-QB2LNO4W.js.map +0 -7
- package/dist/chunks/chunk-R6XHAFBF.js.map +0 -7
- package/dist/chunks/chunk-UB44F4Z2.js.map +0 -7
- package/dist/chunks/chunk-WQFG7PAH.js.map +0 -7
- package/dist/chunks/chunk-X754AHS5.js.map +0 -7
- package/dist/chunks/chunk-YBLHKYFF.js.map +0 -7
- package/dist/chunks/configService-R3OGU2UD.js +0 -13
- /package/dist/chunks/{configService-R3OGU2UD.js.map → configService-PRJZF7Y6.js.map} +0 -0
- /package/dist/chunks/{constants-STK2YBIW.js.map → constants-KIQEYMAM.js.map} +0 -0
- /package/dist/chunks/{fs-JGINUXGL.js.map → fs-ZI5JEU7V.js.map} +0 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// lib/shared/i18n.ts
|
|
2
|
+
var DEFAULT_I18N_CONFIG = {
|
|
3
|
+
defaultLocale: "en",
|
|
4
|
+
locales: [{ code: "en", name: "English", nativeName: "English", langTag: "en-US" }]
|
|
5
|
+
};
|
|
6
|
+
function getLocaleCodes(config) {
|
|
7
|
+
return config.locales.map((loc) => loc.code);
|
|
8
|
+
}
|
|
9
|
+
function findLocaleByCode(config, code) {
|
|
10
|
+
return config.locales.find((loc) => loc.code === code);
|
|
11
|
+
}
|
|
12
|
+
function isValidLocaleCode(config, code) {
|
|
13
|
+
return config.locales.some((loc) => loc.code === code);
|
|
14
|
+
}
|
|
15
|
+
function migrateLocaleString(code) {
|
|
16
|
+
const upperCode = code.toUpperCase();
|
|
17
|
+
return {
|
|
18
|
+
code: code.toLowerCase(),
|
|
19
|
+
name: upperCode,
|
|
20
|
+
nativeName: upperCode,
|
|
21
|
+
langTag: `${code.toLowerCase()}-${upperCode}`
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function isOldLocaleFormat(locales) {
|
|
25
|
+
return Array.isArray(locales) && locales.length > 0 && typeof locales[0] === "string";
|
|
26
|
+
}
|
|
27
|
+
function migrateI18nConfig(i18n) {
|
|
28
|
+
if (!i18n || typeof i18n !== "object") {
|
|
29
|
+
return DEFAULT_I18N_CONFIG;
|
|
30
|
+
}
|
|
31
|
+
const config = i18n;
|
|
32
|
+
const defaultLocale = config.defaultLocale || "en";
|
|
33
|
+
const locales = config.locales;
|
|
34
|
+
if (!locales || !Array.isArray(locales)) {
|
|
35
|
+
return DEFAULT_I18N_CONFIG;
|
|
36
|
+
}
|
|
37
|
+
if (isOldLocaleFormat(locales)) {
|
|
38
|
+
return {
|
|
39
|
+
defaultLocale,
|
|
40
|
+
locales: locales.map(migrateLocaleString)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
defaultLocale,
|
|
45
|
+
locales
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function isI18nValue(value) {
|
|
49
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return "_i18n" in value && value._i18n === true;
|
|
53
|
+
}
|
|
54
|
+
function resolveTranslation(value, locale, config) {
|
|
55
|
+
if (locale in value && value[locale] !== void 0 && locale !== "_i18n") {
|
|
56
|
+
return value[locale];
|
|
57
|
+
}
|
|
58
|
+
if (config.defaultLocale in value && value[config.defaultLocale] !== void 0) {
|
|
59
|
+
return value[config.defaultLocale];
|
|
60
|
+
}
|
|
61
|
+
for (const key of Object.keys(value)) {
|
|
62
|
+
if (key !== "_i18n" && value[key] !== void 0) {
|
|
63
|
+
return value[key];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const hasArrayValue = Object.entries(value).some(([k, v]) => k !== "_i18n" && Array.isArray(v));
|
|
67
|
+
return hasArrayValue ? [] : "";
|
|
68
|
+
}
|
|
69
|
+
function resolveI18nValue(value, locale, config) {
|
|
70
|
+
if (isI18nValue(value)) {
|
|
71
|
+
return resolveTranslation(value, locale, config);
|
|
72
|
+
}
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
function resolveI18nInProps(props, locale, config) {
|
|
76
|
+
const resolved = {};
|
|
77
|
+
for (const [key, value] of Object.entries(props)) {
|
|
78
|
+
if (isI18nValue(value)) {
|
|
79
|
+
resolved[key] = resolveTranslation(value, locale, config);
|
|
80
|
+
} else if (Array.isArray(value)) {
|
|
81
|
+
resolved[key] = value.map((item) => isI18nValue(item) ? resolveTranslation(item, locale, config) : item);
|
|
82
|
+
} else if (typeof value === "object" && value !== null) {
|
|
83
|
+
resolved[key] = resolveI18nInProps(value, locale, config);
|
|
84
|
+
} else {
|
|
85
|
+
resolved[key] = value;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return resolved;
|
|
89
|
+
}
|
|
90
|
+
function extractLocaleFromPath(path, config) {
|
|
91
|
+
const cleanPath = path.startsWith("/") ? path.slice(1) : path;
|
|
92
|
+
const segments = cleanPath.split("/");
|
|
93
|
+
if (segments.length > 0 && isValidLocaleCode(config, segments[0])) {
|
|
94
|
+
const locale = segments[0];
|
|
95
|
+
const pathWithoutLocale = "/" + segments.slice(1).join("/");
|
|
96
|
+
return { locale, pathWithoutLocale: pathWithoutLocale || "/" };
|
|
97
|
+
}
|
|
98
|
+
return { locale: null, pathWithoutLocale: path };
|
|
99
|
+
}
|
|
100
|
+
function buildLocalizedPath(path, locale) {
|
|
101
|
+
const cleanPath = path.startsWith("/") ? path : "/" + path;
|
|
102
|
+
return `/${locale}${cleanPath === "/" ? "" : cleanPath}`;
|
|
103
|
+
}
|
|
104
|
+
function parseLocaleFromPath(path, config) {
|
|
105
|
+
const { locale, pathWithoutLocale } = extractLocaleFromPath(path, config);
|
|
106
|
+
const effectiveLocale = locale || config.defaultLocale;
|
|
107
|
+
return {
|
|
108
|
+
locale: effectiveLocale,
|
|
109
|
+
pathWithoutLocale,
|
|
110
|
+
isDefaultLocale: effectiveLocale === config.defaultLocale
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
var LOCALE_STORAGE_KEY = "meno_locale_preference";
|
|
114
|
+
var OLD_LOCALE_STORAGE_KEY = "uplo_locale_preference";
|
|
115
|
+
function migrateLocaleStorageKey() {
|
|
116
|
+
if (typeof window === "undefined") return;
|
|
117
|
+
try {
|
|
118
|
+
const oldValue = localStorage.getItem(OLD_LOCALE_STORAGE_KEY);
|
|
119
|
+
const newValue = localStorage.getItem(LOCALE_STORAGE_KEY);
|
|
120
|
+
if (oldValue && !newValue) {
|
|
121
|
+
localStorage.setItem(LOCALE_STORAGE_KEY, oldValue);
|
|
122
|
+
localStorage.removeItem(OLD_LOCALE_STORAGE_KEY);
|
|
123
|
+
}
|
|
124
|
+
} catch {
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function getStoredLocale() {
|
|
128
|
+
if (typeof window === "undefined") return null;
|
|
129
|
+
try {
|
|
130
|
+
migrateLocaleStorageKey();
|
|
131
|
+
return localStorage.getItem(LOCALE_STORAGE_KEY);
|
|
132
|
+
} catch {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function setStoredLocale(locale) {
|
|
137
|
+
if (typeof window === "undefined") return;
|
|
138
|
+
try {
|
|
139
|
+
localStorage.setItem(LOCALE_STORAGE_KEY, locale);
|
|
140
|
+
} catch {
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function clearStoredLocale() {
|
|
144
|
+
if (typeof window === "undefined") return;
|
|
145
|
+
try {
|
|
146
|
+
localStorage.removeItem(LOCALE_STORAGE_KEY);
|
|
147
|
+
} catch {
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export {
|
|
152
|
+
DEFAULT_I18N_CONFIG,
|
|
153
|
+
getLocaleCodes,
|
|
154
|
+
findLocaleByCode,
|
|
155
|
+
isValidLocaleCode,
|
|
156
|
+
migrateI18nConfig,
|
|
157
|
+
isI18nValue,
|
|
158
|
+
resolveTranslation,
|
|
159
|
+
resolveI18nValue,
|
|
160
|
+
resolveI18nInProps,
|
|
161
|
+
extractLocaleFromPath,
|
|
162
|
+
buildLocalizedPath,
|
|
163
|
+
parseLocaleFromPath,
|
|
164
|
+
getStoredLocale,
|
|
165
|
+
setStoredLocale,
|
|
166
|
+
clearStoredLocale
|
|
167
|
+
};
|
|
168
|
+
//# sourceMappingURL=chunk-3XER4E5W.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../lib/shared/i18n.ts"],
|
|
4
|
+
"sourcesContent": ["/**\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: [{ code: 'en', name: 'English', nativeName: 'English', langTag: 'en-US' }],\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(value: I18nValue, locale: string, config: I18nConfig): 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(([k, v]) => k !== '_i18n' && Array.isArray(v));\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(value: unknown, locale: string, config: I18nConfig): 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) => (isI18nValue(item) ? resolveTranslation(item, locale, config) : item));\n } else if (typeof value === 'object' && value !== null) {\n // Recursively resolve nested objects (but not I18nValue which is already handled)\n resolved[key] = resolveI18nInProps(value as Record<string, unknown>, locale, config);\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(path: string, config: I18nConfig): 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"],
|
|
5
|
+
"mappings": ";AAUO,IAAM,sBAAkC;AAAA,EAC7C,eAAe;AAAA,EACf,SAAS,CAAC,EAAE,MAAM,MAAM,MAAM,WAAW,YAAY,WAAW,SAAS,QAAQ,CAAC;AACpF;AASO,SAAS,eAAe,QAA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AAsB;AACpD,MAAI,OAAO,WAAW,YAAa;AACnC,MAAI;AACF,iBAAa,QAAQ,oBAAoB,MAAM;AAAA,EACjD,QAAQ;AAAA,EAER;AACF;AAKO,SAAS,oBAA0B;AACxC,MAAI,OAAO,WAAW,YAAa;AACnC,MAAI;AACF,iBAAa,WAAW,kBAAkB;AAAA,EAC5C,QAAQ;AAAA,EAER;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -59,13 +59,13 @@ var CSS_PROPERTY_TO_GROUP = {
|
|
|
59
59
|
"line-height": "line-height",
|
|
60
60
|
"letter-spacing": "letter-spacing",
|
|
61
61
|
"text-align": "text-align",
|
|
62
|
-
|
|
62
|
+
opacity: "opacity",
|
|
63
63
|
"z-index": "z-index",
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
top: "position",
|
|
65
|
+
right: "position",
|
|
66
|
+
bottom: "position",
|
|
67
|
+
left: "position",
|
|
68
|
+
inset: "position",
|
|
69
69
|
"inset-block": "position",
|
|
70
70
|
"inset-inline": "position",
|
|
71
71
|
"inset-block-start": "position",
|
|
@@ -74,7 +74,7 @@ var CSS_PROPERTY_TO_GROUP = {
|
|
|
74
74
|
"inset-inline-end": "position",
|
|
75
75
|
"box-shadow": "shadow",
|
|
76
76
|
"text-shadow": "shadow",
|
|
77
|
-
|
|
77
|
+
filter: "filter",
|
|
78
78
|
"backdrop-filter": "filter",
|
|
79
79
|
"aspect-ratio": "aspect-ratio",
|
|
80
80
|
"transition-duration": "duration",
|
|
@@ -339,10 +339,7 @@ function generateInlineStyleTag(content, media) {
|
|
|
339
339
|
return `<style${attrs}>${content}</style>`;
|
|
340
340
|
}
|
|
341
341
|
function generateStylesheetTag(lib) {
|
|
342
|
-
const attrs = [
|
|
343
|
-
'rel="stylesheet"',
|
|
344
|
-
`href="${escapeAttr(lib.url)}"`
|
|
345
|
-
];
|
|
342
|
+
const attrs = ['rel="stylesheet"', `href="${escapeAttr(lib.url)}"`];
|
|
346
343
|
if (lib.media) {
|
|
347
344
|
attrs.push(`media="${escapeAttr(lib.media)}"`);
|
|
348
345
|
}
|
|
@@ -514,4 +511,4 @@ export {
|
|
|
514
511
|
CMS_DRAFT_SUFFIX,
|
|
515
512
|
isReservedDraftFilename
|
|
516
513
|
};
|
|
517
|
-
//# sourceMappingURL=chunk-
|
|
514
|
+
//# sourceMappingURL=chunk-5ETZFREW.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../lib/shared/types/components.ts", "../../lib/shared/types/errors.ts", "../../lib/shared/types/colors.ts", "../../lib/shared/types/variables.ts", "../../lib/shared/types/comment.ts", "../../lib/shared/fontCss.ts", "../../lib/shared/slugTranslator.ts", "../../lib/shared/libraryLoader.ts", "../../lib/shared/pathSecurity.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Component Definition Types\n * Improved type safety with stricter types\n */\n\nimport type { ComponentNode } from './nodes';\nimport type { LibrariesConfig } from './libraries';\n\n/**\n * Prop type definitions\n */\nexport type PropType = 'string' | 'select' | 'boolean' | 'number' | 'link' | 'file' | 'rich-text' | 'embed' | 'list';\n\n/**\n * Project-level enum configuration\n * Keys are enum names, values are arrays of options\n */\nexport type EnumsConfig = Record<string, readonly string[]>;\n\n/**\n * Internationalization (i18n) value object\n * Keys are locale codes (e.g., 'en', 'pl', 'de')\n * Values can be strings (for string props) or arrays (for list props)\n */\nexport interface I18nValue {\n _i18n: true;\n [locale: string]: string | unknown[] | true; // true is for the _i18n marker, arrays for list props\n}\n\n/**\n * Locale configuration with metadata\n */\nexport interface LocaleConfig {\n code: string; // URL prefix & translation key (e.g., \"en\", \"pl\")\n name: string; // English name for admin UI (e.g., \"Polish\")\n nativeName: string; // Native name for public UI (e.g., \"Polski\")\n langTag: string; // BCP 47 language tag for SEO (e.g., \"pl-PL\")\n icon?: string; // Optional flag icon path (e.g., \"/icons/flag-en.svg\")\n}\n\n/**\n * Internationalization configuration\n */\nexport interface I18nConfig {\n defaultLocale: string;\n locales: LocaleConfig[];\n}\n\n/**\n * Value resolver function type\n * Used for transforming field values (e.g., i18n resolution)\n */\nexport type ValueResolver = (value: unknown) => unknown;\n\n/**\n * Link prop value type\n */\nexport interface LinkPropValue {\n href: string;\n target?: '_blank';\n}\n\n/**\n * Base prop definition without list-specific fields\n */\nexport interface BasePropDefinition {\n type: Exclude<PropType, 'list'>;\n default?: string | number | boolean | I18nValue | LinkPropValue;\n options?: readonly string[]; // Required for \"select\" type (inline options)\n enumName?: string; // For \"select\" type: reference to project-level enum\n accept?: string; // For \"file\" type: MIME pattern like \"image/*\", \"video/*\"\n editor?: 'basic' | 'extended'; // For 'rich-text' type: which editor to use\n}\n\n/**\n * List item schema - defines the structure of each item in a list prop\n * Uses the same prop types as component interfaces (except nested lists)\n */\nexport type ListItemSchema = Record<string, BasePropDefinition>;\n\n/**\n * List item value type\n * Supports i18n values for localized string fields\n */\nexport type ListItemValue = Record<string, string | number | boolean | LinkPropValue | I18nValue | null>;\n\n/**\n * List prop definition - for array/list data\n */\nexport interface ListPropDefinition {\n type: 'list';\n /** Schema defining the structure of each list item */\n itemSchema: ListItemSchema;\n /** Default value is an array of items */\n default?: ListItemValue[];\n}\n\n/**\n * Prop definition with improved type safety\n */\nexport type PropDefinition = BasePropDefinition | ListPropDefinition;\n\n/**\n * Type guard to check if a prop definition is a list type\n */\nexport function isListPropDefinition(def: PropDefinition): def is ListPropDefinition {\n return def.type === 'list';\n}\n\n/**\n * Type guard to check if a prop definition is a base (non-list) type\n */\nexport function isBasePropDefinition(def: PropDefinition): def is BasePropDefinition {\n return def.type !== 'list';\n}\n\n/**\n * Structured component definition\n */\nexport interface StructuredComponentDefinition {\n interface?: Record<string, PropDefinition>;\n structure?: ComponentNode;\n javascript?: string; // Vanilla JS code to be rendered at end of HTML\n css?: string; // CSS code to be rendered in <style> tag in <head>\n category?: string; // Component category for organization\n /**\n * Define which props are available as JavaScript variables (Astro-style define:vars)\n * - true: all props from interface are exposed\n * - string[]: only specified props are exposed\n * - undefined: no automatic prop injection (backward compatible)\n */\n defineVars?: true | string[];\n /** External JS/CSS libraries required by this component */\n libraries?: LibrariesConfig;\n /** Whether instances of this component can have styles applied to the wrapper */\n acceptsStyles?: boolean;\n}\n\n/**\n * Component definition\n * Supports both new format (just component) and legacy format (type/props/children/component)\n */\nexport interface ComponentDefinition {\n type?: string; // Legacy format\n props?: Record<string, unknown>; // Legacy format\n children?: unknown[]; // Legacy format\n component: StructuredComponentDefinition;\n}\n\n/**\n * Line range for element line number tracking\n */\nexport interface LineRange {\n startLine: number;\n endLine: number;\n}\n\n/**\n * JSON page structure\n */\nexport interface JSONPage {\n meta?: import('./api').PageMetaData;\n components?: Record<string, ComponentDefinition>;\n root?: ComponentNode;\n _lineMap?: Record<string, LineRange>;\n}\n\n/**\n * Page data type that can be either a JSONPage or a component definition structure\n */\nexport type PageData =\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 */\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];\n }\n // Prefix-based match (handles margin-top, padding-left, etc.)\n for (const { prefix, group } of CSS_PROPERTY_PREFIX_GROUPS) {\n if (normalized === prefix || normalized.startsWith(prefix + '-')) {\n return group;\n }\n }\n return null;\n}\n\n/**\n * A single CSS custom property definition\n */\nexport interface CSSVariable {\n /** Display name (e.g., \"H1 Font Size\") */\n name: string;\n /** Optional prop name alias for organizational purposes */\n prop_name?: string;\n /** CSS custom property name (e.g., \"--h1-fs\") */\n cssVar: string;\n /** Base value (e.g., \"48px\") */\n value: string;\n /** Category for responsive scaling */\n type: VariableType;\n /** Optional per-variable breakpoint scale overrides */\n scales?: Record<string, string>;\n /** Optional UI filtering group for the variable picker */\n group?: VariableGroup;\n}\n\n/**\n * Variables configuration file structure (variables.json)\n */\nexport interface VariablesConfig {\n variables: CSSVariable[];\n}\n\n/** Predefined variable scaling types for UI dropdowns */\nexport const VARIABLE_TYPES: { value: VariableType; label: string }[] = [\n { value: 'fontSize', label: 'Font Size' },\n { value: 'padding', label: 'Padding' },\n { value: 'margin', label: 'Margin' },\n { value: 'gap', label: 'Gap' },\n { value: 'borderRadius', label: 'Border Radius' },\n { value: 'size', label: 'Width / Height' },\n { value: 'none', label: 'None' },\n];\n\n/** All valid variable scaling type values */\nexport const VARIABLE_TYPE_VALUES: VariableType[] = VARIABLE_TYPES.map((t) => t.value);\n\n/**\n * Returns an abbreviation for a variable group by taking the first letter of each word.\n * e.g. 'letter-spacing' -> 'ls', 'font-size' -> 'fs', 'spacing' -> 's'\n */\nexport function getGroupAbbreviation(group: string): string {\n return group\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 * 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 * 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, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>');\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 'path';\n\n/**\n * Error thrown when a path traversal attack is detected\n */\nexport class PathTraversalError extends Error {\n constructor(\n public readonly requestedPath: string,\n public readonly rootPath: string,\n ) {\n super(`Path traversal detected: \"${requestedPath}\" escapes root \"${rootPath}\"`);\n this.name = 'PathTraversalError';\n }\n}\n\n/**\n * Check if a resolved path is within the allowed root directory\n * Uses path.resolve() to normalize and handle .. sequences\n *\n * @param requestedPath - The path to validate (can be relative or absolute)\n * @param rootPath - The root directory that paths must be within\n * @returns true if the path is within root, false otherwise\n */\nexport function isPathWithinRoot(requestedPath: string, rootPath: string): boolean {\n const normalizedRoot = resolve(rootPath);\n const normalizedPath = resolve(rootPath, requestedPath);\n\n // Check that normalized path starts with root + separator\n // Adding separator prevents /project-backup from matching /project\n return normalizedPath === normalizedRoot || normalizedPath.startsWith(normalizedRoot + sep);\n}\n\n/**\n * Resolve a path safely, throwing if it would escape the root\n *\n * @param rootPath - The root directory\n * @param segments - Path segments to join\n * @returns The resolved path\n * @throws PathTraversalError if path escapes root\n */\nexport function resolveSafePath(rootPath: string, ...segments: string[]): string {\n const normalizedRoot = resolve(rootPath);\n const normalizedPath = resolve(normalizedRoot, ...segments);\n\n if (!normalizedPath.startsWith(normalizedRoot + sep) && normalizedPath !== normalizedRoot) {\n throw new PathTraversalError(segments.join(sep), rootPath);\n }\n\n return normalizedPath;\n}\n\n/**\n * Validate that a filename/identifier contains no path traversal sequences\n * Use for collection names, filenames, etc.\n *\n * @param name - The name to validate\n * @returns true if safe, false if contains traversal sequences\n */\nexport function isSafePathSegment(name: string): boolean {\n // Reject empty names\n if (!name || name.trim() === '') return false;\n\n // Reject names with path separators\n if (name.includes('/') || name.includes('\\\\')) return false;\n\n // Reject . and ..\n if (name === '.' || name === '..') return false;\n\n // Reject names starting with .. (e.g., \"..foo\")\n if (name.startsWith('..')) return false;\n\n // Reject null bytes (used in some attacks)\n if (name.includes('\\0')) return false;\n\n return true;\n}\n\n/**\n * Regex for valid CMS identifiers (collection names, filenames)\n * Allows alphanumeric, underscore, hyphen\n */\nexport const SAFE_IDENTIFIER_REGEX = /^[a-zA-Z0-9_-]+$/;\n\n/**\n * Validate a CMS identifier (stricter than isSafePathSegment)\n * Use for collection IDs and filenames that should only contain safe chars\n */\nexport function isValidIdentifier(name: string): boolean {\n return SAFE_IDENTIFIER_REGEX.test(name);\n}\n\n/**\n * Suffix used for CMS draft files: `{filename}.draft.json`. The provider must\n * never accept user-supplied filenames ending in `.draft`, because that would\n * clash with the draft-suffix convention and let a user shadow another item's\n * draft file.\n */\nexport const CMS_DRAFT_SUFFIX = '.draft';\n\n/**\n * True when a user-supplied CMS filename collides with the reserved `.draft`\n * suffix. Use as a hard reject in CMS provider write paths.\n */\nexport function isReservedDraftFilename(filename: string): boolean {\n return filename.endsWith(CMS_DRAFT_SUFFIX);\n}\n"],
|
|
5
|
+
"mappings": ";AAyGO,SAAS,qBAAqB,KAAgD;AACnF,SAAO,IAAI,SAAS;AACtB;AAKO,SAAS,qBAAqB,KAAgD;AACnF,SAAO,IAAI,SAAS;AACtB;;;AChFO,SAAS,sBACd,SACA,SAKiB;AACjB,SAAO;AAAA,IACL;AAAA,IACA,GAAG;AAAA,EACL;AACF;AAKO,SAAS,sBACd,SACA,SAKiB;AACjB,QAAM,QAAQ,IAAI,MAAM,OAAO;AAC/B,SAAO,eAAe,OAAO,QAAQ,EAAE,OAAO,SAAS,MAAM,UAAU,MAAM,CA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AK,SAAS,GAAG,KAAK,KAAK,SAAS,IAAI,EAAG,QAAO;AAGtD,MAAI,SAAS,OAAO,SAAS,KAAM,QAAO;AAG1C,MAAI,KAAK,WAAW,IAAI,EAAG,QAAO;AAGlC,MAAI,KAAK,SAAS,IAAI,EAAG,QAAO;AAEhC,SAAO;AACT;AAMO,IAAM,wBAAwB;AAM9B,SAAS,kBAAkB,MAAuB;AACvD,SAAO,sBAAsB,KAAK,IAAI;AACxC;AAQO,IAAM,mBAAmB;AAMzB,SAAS,wBAAwB,UAA2B;AACjE,SAAO,SAAS,SAAS,gBAAgB;AAC3C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
projectPaths
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JNO3CNLJ.js";
|
|
4
4
|
import {
|
|
5
5
|
fileExists,
|
|
6
6
|
readTextFile
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FZITJSSS.js";
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_BREAKPOINTS,
|
|
10
|
-
DEFAULT_I18N_CONFIG,
|
|
11
10
|
DEFAULT_REM_CONFIG,
|
|
12
11
|
DEFAULT_RESPONSIVE_SCALES,
|
|
13
|
-
|
|
12
|
+
logRuntimeError,
|
|
14
13
|
normalizeBreakpointConfig
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-I2WEGYA7.js";
|
|
15
|
+
import {
|
|
16
|
+
DEFAULT_I18N_CONFIG,
|
|
17
|
+
migrateI18nConfig
|
|
18
|
+
} from "./chunk-3XER4E5W.js";
|
|
16
19
|
|
|
17
20
|
// lib/server/services/configService.ts
|
|
18
21
|
var ConfigService = class {
|
|
@@ -31,7 +34,8 @@ var ConfigService = class {
|
|
|
31
34
|
const content = await readTextFile(projectPaths.config());
|
|
32
35
|
this.config = JSON.parse(content);
|
|
33
36
|
}
|
|
34
|
-
} catch {
|
|
37
|
+
} catch (error) {
|
|
38
|
+
logRuntimeError("configService.load", error, { filePath: projectPaths.config() });
|
|
35
39
|
this.config = null;
|
|
36
40
|
}
|
|
37
41
|
this.loaded = true;
|
|
@@ -128,18 +132,12 @@ var ConfigService = class {
|
|
|
128
132
|
userScales.margin,
|
|
129
133
|
DEFAULT_RESPONSIVE_SCALES.margin
|
|
130
134
|
),
|
|
131
|
-
gap: this.mergeScaleCategory(
|
|
132
|
-
userScales.gap,
|
|
133
|
-
DEFAULT_RESPONSIVE_SCALES.gap
|
|
134
|
-
),
|
|
135
|
+
gap: this.mergeScaleCategory(userScales.gap, DEFAULT_RESPONSIVE_SCALES.gap),
|
|
135
136
|
borderRadius: this.mergeScaleCategory(
|
|
136
137
|
userScales.borderRadius,
|
|
137
138
|
DEFAULT_RESPONSIVE_SCALES.borderRadius
|
|
138
139
|
),
|
|
139
|
-
size: this.mergeScaleCategory(
|
|
140
|
-
userScales.size,
|
|
141
|
-
DEFAULT_RESPONSIVE_SCALES.size
|
|
142
|
-
)
|
|
140
|
+
size: this.mergeScaleCategory(userScales.size, DEFAULT_RESPONSIVE_SCALES.size)
|
|
143
141
|
};
|
|
144
142
|
}
|
|
145
143
|
/**
|
|
@@ -184,12 +182,8 @@ var ConfigService = class {
|
|
|
184
182
|
return { js: [], css: [] };
|
|
185
183
|
}
|
|
186
184
|
const libs = this.config.libraries;
|
|
187
|
-
const normalizedJs = Array.isArray(libs.js) ? libs.js.map(
|
|
188
|
-
|
|
189
|
-
) : [];
|
|
190
|
-
const normalizedCss = Array.isArray(libs.css) ? libs.css.map(
|
|
191
|
-
(lib) => typeof lib === "string" ? { url: lib } : lib
|
|
192
|
-
) : [];
|
|
185
|
+
const normalizedJs = Array.isArray(libs.js) ? libs.js.map((lib) => typeof lib === "string" ? { url: lib } : lib) : [];
|
|
186
|
+
const normalizedCss = Array.isArray(libs.css) ? libs.css.map((lib) => typeof lib === "string" ? { url: lib } : lib) : [];
|
|
193
187
|
return {
|
|
194
188
|
js: normalizedJs,
|
|
195
189
|
css: normalizedCss
|
|
@@ -248,4 +242,4 @@ export {
|
|
|
248
242
|
ConfigService,
|
|
249
243
|
configService
|
|
250
244
|
};
|
|
251
|
-
//# sourceMappingURL=chunk-
|
|
245
|
+
//# sourceMappingURL=chunk-7E4IF5L7.js.map
|
|
@@ -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';\nimport { logRuntimeError } from '../../shared/errorLogger';\n\n/**\n * Icons configuration\n */\nexport interface IconsConfig {\n favicon?: string;\n faviconDark?: string;\n appleTouchIcon?: string;\n}\n\n/**\n * Site-wide social configuration\n */\nexport interface SocialConfig {\n twitterHandle?: 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 social?: SocialConfig;\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 (error) {\n // Fall through to defaults\n logRuntimeError('configService.load', error, { filePath: projectPaths.config() });\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:\n typeof entry.previewPoint === 'number' && entry.previewPoint > 0 ? entry.previewPoint : 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 mode: (userScales as { mode?: 'breakpoints' | 'fluid' }).mode ?? DEFAULT_RESPONSIVE_SCALES.mode,\n baseReference: userScales.baseReference ?? DEFAULT_RESPONSIVE_SCALES.baseReference,\n fluidRange:\n (userScales as { fluidRange?: { min: number; max: number } }).fluidRange ??\n (DEFAULT_RESPONSIVE_SCALES.fluidRange ? { ...DEFAULT_RESPONSIVE_SCALES.fluidRange } : undefined),\n siteMargin:\n (userScales as { siteMargin?: { min: number; max: number } }).siteMargin ??\n (DEFAULT_RESPONSIVE_SCALES.siteMargin ? { ...DEFAULT_RESPONSIVE_SCALES.siteMargin } : undefined),\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(userScales.gap as BreakpointScales | undefined, DEFAULT_RESPONSIVE_SCALES.gap),\n borderRadius: this.mergeScaleCategory(\n userScales.borderRadius as BreakpointScales | undefined,\n DEFAULT_RESPONSIVE_SCALES.borderRadius,\n ),\n size: this.mergeScaleCategory(userScales.size as BreakpointScales | undefined, DEFAULT_RESPONSIVE_SCALES.size),\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 site-wide social configuration\n * Returns empty object if not configured\n */\n getSocial(): SocialConfig {\n if (!this.config?.social || typeof this.config.social !== 'object') {\n return {};\n }\n\n return this.config.social;\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) => (typeof lib === 'string' ? { url: lib } : lib)) 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) => (typeof lib === 'string' ? { url: lib } : lib)) 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 ConfigService();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AA+DO,IAAM,gBAAN,MAAoB;AAAA,EACjB,SAAkC;AAAA,EAClC,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAMjB,MAAM,OAAsB;AAC1B,QAAI,KAAK,QAAQ;AACf;AAAA,IACF;AAEA,QAAI;AACF,UAAI,MAAM,WAAW,aAAa,OAAO,CAAC,GAAG;AAC3C,cAAM,UAAU,MAAM,aAAa,aAAa,OAAO,CAAC;AACxD,aAAK,SAAS,KAAK,MAAM,OAAO;AAAA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