meno-core 1.0.54 → 1.1.0
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/bin/cli.ts +19 -205
- package/build-astro.ts +31 -27
- package/dist/bin/cli.js +15 -154
- package/dist/bin/cli.js.map +2 -2
- package/dist/chunks/{chunk-7HWQUVTU.js → chunk-2IIQK7T3.js} +1353 -347
- package/dist/chunks/chunk-2IIQK7T3.js.map +7 -0
- package/dist/chunks/{chunk-3XER4E5W.js → chunk-4ZRU52J2.js} +6 -5
- package/dist/chunks/{chunk-3XER4E5W.js.map → chunk-4ZRU52J2.js.map} +2 -2
- package/dist/chunks/{chunk-NVRBTSQG.js → chunk-5X4HCN7J.js} +4 -4
- package/dist/chunks/chunk-5X4HCN7J.js.map +7 -0
- package/dist/chunks/{chunk-FZITJSSS.js → chunk-7CCVOL5M.js} +14 -14
- package/dist/chunks/chunk-7CCVOL5M.js.map +7 -0
- package/dist/chunks/{chunk-HIZMY3EP.js → chunk-AR7LHIFY.js} +8 -2
- package/dist/chunks/chunk-AR7LHIFY.js.map +7 -0
- package/dist/chunks/{chunk-AE3QK5QW.js → chunk-NUP7H7D3.js} +31 -26
- package/dist/chunks/chunk-NUP7H7D3.js.map +7 -0
- package/dist/chunks/{chunk-5ETZFREW.js → chunk-QWTQZHG3.js} +186 -79
- package/dist/chunks/chunk-QWTQZHG3.js.map +7 -0
- package/dist/chunks/{chunk-STDY3OVM.js → chunk-XTKNX4FW.js} +3 -3
- package/dist/chunks/{chunk-STDY3OVM.js.map → chunk-XTKNX4FW.js.map} +2 -2
- package/dist/chunks/{fs-ZI5JEU7V.js → fs-G3ANWEFP.js} +2 -2
- package/dist/lib/client/index.js +381 -159
- package/dist/lib/client/index.js.map +3 -3
- package/dist/lib/server/index.js +14345 -6265
- package/dist/lib/server/index.js.map +4 -4
- package/dist/lib/shared/index.js +292 -87
- package/dist/lib/shared/index.js.map +4 -4
- package/dist/lib/shared/richtext/index.js +1 -1
- package/dist/lib/test-utils/index.js +27 -21
- package/dist/lib/test-utils/index.js.map +2 -2
- package/lib/client/ErrorBoundary.test.tsx +147 -90
- package/lib/client/ErrorBoundary.tsx +8 -5
- package/lib/client/componentRegistry.ts +0 -1
- package/lib/client/core/ComponentBuilder.test.ts +150 -0
- package/lib/client/core/ComponentBuilder.ts +112 -12
- package/lib/client/core/ComponentRenderer.test.tsx +1 -2
- package/lib/client/core/builders/embedBuilder.ts +1 -1
- package/lib/client/core/builders/linkBuilder.ts +2 -2
- package/lib/client/core/builders/linkNodeBuilder.ts +1 -1
- package/lib/client/core/builders/listBuilder.ts +41 -4
- package/lib/client/core/builders/localeListBuilder.ts +2 -2
- package/lib/client/core/cmsTemplateProcessor.ts +1 -2
- package/lib/client/hmr/HMRManager.tsx +39 -30
- package/lib/client/hmrCssReload.ts +35 -6
- package/lib/client/hmrWebSocket.ts +5 -5
- package/lib/client/hooks/useColorVariables.ts +12 -9
- package/lib/client/hooks/usePropertyAutocomplete.ts +1 -1
- package/lib/client/hooks/useVariables.ts +3 -1
- package/lib/client/meno-filter/MenoFilter.test.ts +28 -28
- package/lib/client/meno-filter/MenoFilter.ts +9 -6
- package/lib/client/meno-filter/bindings.ts +3 -3
- package/lib/client/meno-filter/init.ts +3 -3
- package/lib/client/meno-filter/renderer.ts +8 -4
- package/lib/client/meno-filter/ui.ts +1 -1
- package/lib/client/meno-filter/updates.ts +3 -2
- package/lib/client/meno-filter/utils.ts +1 -1
- package/lib/client/navigation.test.ts +40 -44
- package/lib/client/responsiveStyleResolver.knownTokens.test.ts +71 -0
- package/lib/client/responsiveStyleResolver.test.ts +5 -5
- package/lib/client/responsiveStyleResolver.ts +61 -4
- package/lib/client/routing/RouteLoader.test.ts +1 -1
- package/lib/client/routing/RouteLoader.ts +8 -3
- package/lib/client/routing/Router.tsx +181 -152
- package/lib/client/scripts/ScriptExecutor.ts +3 -3
- package/lib/client/services/PrefetchService.test.ts +1 -1
- package/lib/client/services/PrefetchService.ts +13 -5
- package/lib/client/styleProcessor.ts +9 -3
- package/lib/client/styles/StyleInjector.ts +1 -1
- package/lib/client/styles/UtilityClassCollector.ts +54 -13
- package/lib/client/templateEngine.test.ts +17 -23
- package/lib/client/templateEngine.ts +7 -13
- package/lib/client/theme.test.ts +1 -1
- package/lib/server/__integration__/server-lifecycle.test.ts +3 -1
- package/lib/server/__integration__/static-assets.test.ts +2 -2
- package/lib/server/__integration__/test-helpers.ts +3 -4
- package/lib/server/astro/cmsPageEmitter.ts +4 -5
- package/lib/server/astro/componentEmitter.ts +11 -8
- package/lib/server/astro/nodeToAstro.test.ts +4 -4
- package/lib/server/astro/nodeToAstro.ts +41 -36
- package/lib/server/astro/normalizeOrphanTemplateProps.test.ts +11 -11
- package/lib/server/astro/normalizeOrphanTemplateProps.ts +7 -6
- package/lib/server/astro/pageEmitter.ts +1 -1
- package/lib/server/astro/templateTransformer.ts +3 -3
- package/lib/server/createServer.ts +2 -2
- package/lib/server/cssGenerator.ts +2 -2
- package/lib/server/fileWatcher.test.ts +41 -4
- package/lib/server/fileWatcher.ts +102 -23
- package/lib/server/index.ts +7 -16
- package/lib/server/jsonLoader.test.ts +3 -3
- package/lib/server/jsonLoader.ts +8 -5
- package/lib/server/middleware/cors.test.ts +1 -1
- package/lib/server/middleware/cors.ts +2 -2
- package/lib/server/middleware/errorHandler.test.ts +2 -2
- package/lib/server/middleware/logger.test.ts +3 -3
- package/lib/server/middleware/logger.ts +7 -7
- package/lib/server/migrateTemplates.ts +3 -3
- package/lib/server/projectContext.ts +1 -1
- package/lib/server/providers/fileSystemCMSProvider.test.ts +18 -4
- package/lib/server/providers/fileSystemCMSProvider.ts +27 -18
- package/lib/server/routes/api/cms.ts +1 -1
- package/lib/server/routes/api/colors.test.ts +2 -2
- package/lib/server/routes/api/components.ts +1 -1
- package/lib/server/routes/api/config.ts +3 -3
- package/lib/server/routes/api/core-routes.ts +2 -2
- package/lib/server/routes/api/enums.test.ts +2 -2
- package/lib/server/routes/api/functions.ts +1 -1
- package/lib/server/routes/api/variables.test.ts +2 -2
- package/lib/server/routes/index.ts +2 -2
- package/lib/server/routes/pages.ts +1 -2
- package/lib/server/routes/static.ts +1 -2
- package/lib/server/runtime/bundler.ts +65 -43
- package/lib/server/runtime/fs.ts +13 -13
- package/lib/server/runtime/httpServer.ts +3 -3
- package/lib/server/services/ColorService.test.ts +3 -3
- package/lib/server/services/ColorService.ts +5 -2
- package/lib/server/services/EnumService.test.ts +2 -2
- package/lib/server/services/EnumService.ts +4 -1
- package/lib/server/services/VariableService.test.ts +7 -7
- package/lib/server/services/VariableService.ts +5 -2
- package/lib/server/services/cmsService.test.ts +44 -44
- package/lib/server/services/cmsService.ts +17 -97
- package/lib/server/services/componentService.test.ts +10 -16
- package/lib/server/services/componentService.ts +20 -12
- package/lib/server/services/configService.test.ts +13 -14
- package/lib/server/services/configService.ts +30 -0
- package/lib/server/services/fileWatcherService.ts +2 -2
- package/lib/server/services/pageService.test.ts +7 -7
- package/lib/server/services/pageService.ts +18 -5
- package/lib/server/ssr/attributeBuilder.ts +2 -2
- package/lib/server/ssr/cmsSSRProcessor.ts +1 -2
- package/lib/server/ssr/errorOverlay.ts +1 -1
- package/lib/server/ssr/htmlGenerator.nonce.test.ts +6 -5
- package/lib/server/ssr/htmlGenerator.test.ts +0 -1
- package/lib/server/ssr/htmlGenerator.ts +7 -7
- package/lib/server/ssr/imageMetadata.ts +2 -2
- package/lib/server/ssr/jsCollector.test.ts +5 -5
- package/lib/server/ssr/liveReloadIntegration.test.ts +7 -8
- package/lib/server/ssr/ssrRenderer.branches.test.ts +9 -9
- package/lib/server/ssr/ssrRenderer.test.ts +125 -15
- package/lib/server/ssr/ssrRenderer.ts +206 -38
- package/lib/server/ssrRenderer.test.ts +6 -6
- package/lib/server/utils/jsonLineMapper.ts +7 -7
- package/lib/server/validateStyleCoverage.ts +0 -1
- package/lib/server/websocketManager.ts +12 -0
- package/lib/shared/breakpoints.test.ts +5 -5
- package/lib/shared/cmsQuery.test.ts +81 -0
- package/lib/shared/cmsQuery.ts +92 -0
- package/lib/shared/cmsQueryParser.ts +11 -7
- package/lib/shared/colorConversions.ts +9 -9
- package/lib/shared/colorVariableUtils.test.ts +22 -0
- package/lib/shared/colorVariableUtils.ts +19 -5
- package/lib/shared/constants.ts +4 -0
- package/lib/shared/cssGeneration.test.ts +23 -0
- package/lib/shared/cssGeneration.ts +40 -27
- package/lib/shared/cssProperties.test.ts +64 -64
- package/lib/shared/cssProperties.ts +2 -2
- package/lib/shared/elementClassName.ts +2 -2
- package/lib/shared/errorLogger.test.ts +12 -12
- package/lib/shared/expressionEvaluator.test.ts +27 -1
- package/lib/shared/expressionEvaluator.ts +9 -0
- package/lib/shared/fontLoader.test.ts +13 -13
- package/lib/shared/fontLoader.ts +2 -2
- package/lib/shared/gradientUtils.test.ts +2 -2
- package/lib/shared/gradientUtils.ts +15 -8
- package/lib/shared/hrefRefs.test.ts +2 -2
- package/lib/shared/hrefRefs.ts +1 -1
- package/lib/shared/i18n.test.ts +3 -3
- package/lib/shared/i18n.ts +5 -4
- package/lib/shared/index.ts +23 -0
- package/lib/shared/inlineSvgStyleRules.ts +12 -9
- package/lib/shared/interactiveStyleMappings.test.ts +21 -21
- package/lib/shared/interactiveStyleMappings.ts +2 -8
- package/lib/shared/itemTemplateUtils.test.ts +5 -5
- package/lib/shared/itemTemplateUtils.ts +9 -5
- package/lib/shared/jsonRepair.ts +8 -8
- package/lib/shared/libraryLoader.test.ts +6 -6
- package/lib/shared/linkUtils.ts +1 -1
- package/lib/shared/logger.test.ts +66 -0
- package/lib/shared/logger.ts +94 -0
- package/lib/shared/markdown.ts +25 -0
- package/lib/shared/nodeUtils.test.ts +13 -9
- package/lib/shared/nodeUtils.ts +27 -4
- package/lib/shared/pathSecurity.ts +1 -1
- package/lib/shared/pathUtils.ts +1 -2
- package/lib/shared/paths/PathConverter.ts +3 -3
- package/lib/shared/paths/PathUtils.ts +4 -3
- package/lib/shared/paths/PathValidator.ts +1 -1
- package/lib/shared/permissions.test.ts +168 -0
- package/lib/shared/permissions.ts +162 -0
- package/lib/shared/propResolver.test.ts +1 -1
- package/lib/shared/propResolver.ts +1 -1
- package/lib/shared/registry/BaseNodeTypeRegistry.test.ts +5 -3
- package/lib/shared/registry/ClientRegistry.ts +0 -1
- package/lib/shared/registry/ComponentRegistry.test.ts +3 -3
- package/lib/shared/registry/ComponentRegistry.ts +6 -1
- package/lib/shared/registry/NodeTypeDefinition.ts +2 -2
- package/lib/shared/registry/SSRRegistry.ts +0 -1
- package/lib/shared/registry/fieldPresets.ts +3 -1
- package/lib/shared/registry/nodeTypes/CustomNodeType.ts +103 -0
- package/lib/shared/registry/nodeTypes/HtmlNodeType.ts +1 -1
- package/lib/shared/registry/nodeTypes/IslandNodeType.ts +129 -0
- package/lib/shared/registry/nodeTypes/ListNodeType.ts +43 -7
- package/lib/shared/registry/nodeTypes/MarkdownNodeType.ts +78 -0
- package/lib/shared/registry/nodeTypes/SlotMarkerType.ts +6 -1
- package/lib/shared/registry/nodeTypes/index.ts +16 -1
- package/lib/shared/responsiveScaling.test.ts +1 -3
- package/lib/shared/responsiveScaling.ts +6 -5
- package/lib/shared/responsiveStyleUtils.test.ts +0 -1
- package/lib/shared/richtext/htmlToTiptap.test.ts +116 -116
- package/lib/shared/richtext/htmlToTiptap.ts +1 -1
- package/lib/shared/styleNodeUtils.ts +17 -14
- package/lib/shared/themeDefaults.test.ts +0 -3
- package/lib/shared/tree/PathBuilder.test.ts +1 -7
- package/lib/shared/tree/PathBuilder.ts +15 -13
- package/lib/shared/treePathUtils.test.ts +49 -2
- package/lib/shared/treePathUtils.ts +40 -4
- package/lib/shared/types/api.ts +105 -7
- package/lib/shared/types/cms.test.ts +34 -0
- package/lib/shared/types/cms.ts +65 -13
- package/lib/shared/types/components.ts +24 -0
- package/lib/shared/types/errors.test.ts +1 -1
- package/lib/shared/types/index.ts +23 -0
- package/lib/shared/types/permissions.ts +139 -0
- package/lib/shared/types/variables.ts +3 -3
- package/lib/shared/utilityClassConfig.ts +103 -0
- package/lib/shared/utilityClassMapper.durability.test.ts +117 -0
- package/lib/shared/utilityClassMapper.test.ts +253 -26
- package/lib/shared/utilityClassMapper.ts +160 -29
- package/lib/shared/utilityClassNames.test.ts +38 -0
- package/lib/shared/utilityClassNames.ts +155 -23
- package/lib/shared/validation/index.ts +1 -0
- package/lib/shared/validation/permissionsValidators.test.ts +49 -0
- package/lib/shared/validation/permissionsValidators.ts +49 -0
- package/lib/shared/validation/propValidator.test.ts +1 -1
- package/lib/shared/validation/propValidator.ts +1 -1
- package/lib/shared/validation/schemas.test.ts +41 -0
- package/lib/shared/validation/schemas.ts +159 -13
- package/lib/shared/validation/validators.test.ts +2 -2
- package/lib/shared/viewportUnits.test.ts +13 -0
- package/lib/shared/viewportUnits.ts +12 -5
- package/lib/test-utils/factories/ConsoleMockFactory.ts +7 -7
- package/lib/test-utils/factories/DomMockFactory.ts +10 -4
- package/lib/test-utils/factories/ServerMockFactory.ts +1 -1
- package/lib/test-utils/factories/StoreMockFactory.ts +5 -5
- package/lib/test-utils/mockFactories.ts +1 -1
- package/lib/test-utils/mocks.ts +3 -3
- package/package.json +3 -5
- package/scripts/build-for-publish.mjs +2 -4
- package/scripts/build-meno-filter.ts +3 -3
- package/tsconfig.json +1 -0
- package/vite.config.ts +1 -1
- package/build-next.ts +0 -1374
- package/build-static.test.ts +0 -453
- package/build-static.ts +0 -1072
- package/dist/build-static.js +0 -37
- package/dist/chunks/chunk-2FN4UOVO.js +0 -6465
- package/dist/chunks/chunk-2FN4UOVO.js.map +0 -7
- package/dist/chunks/chunk-5ETZFREW.js.map +0 -7
- package/dist/chunks/chunk-7E4IF5L7.js +0 -245
- package/dist/chunks/chunk-7E4IF5L7.js.map +0 -7
- package/dist/chunks/chunk-7HWQUVTU.js.map +0 -7
- package/dist/chunks/chunk-AE3QK5QW.js.map +0 -7
- package/dist/chunks/chunk-F6KTJYGV.js +0 -322
- package/dist/chunks/chunk-F6KTJYGV.js.map +0 -7
- package/dist/chunks/chunk-FZITJSSS.js.map +0 -7
- package/dist/chunks/chunk-GSYYA5GX.js +0 -77
- package/dist/chunks/chunk-GSYYA5GX.js.map +0 -7
- package/dist/chunks/chunk-HIZMY3EP.js.map +0 -7
- package/dist/chunks/chunk-I2WEGYA7.js +0 -424
- package/dist/chunks/chunk-I2WEGYA7.js.map +0 -7
- package/dist/chunks/chunk-JNO3CNLJ.js +0 -464
- package/dist/chunks/chunk-JNO3CNLJ.js.map +0 -7
- package/dist/chunks/chunk-NVRBTSQG.js.map +0 -7
- package/dist/chunks/chunk-Q4OBWKXG.js +0 -1143
- package/dist/chunks/chunk-Q4OBWKXG.js.map +0 -7
- package/dist/chunks/chunk-QTE32Y53.js +0 -3829
- package/dist/chunks/chunk-QTE32Y53.js.map +0 -7
- package/dist/chunks/configService-PRJZF7Y6.js +0 -14
- package/dist/chunks/configService-PRJZF7Y6.js.map +0 -7
- package/dist/chunks/constants-KIQEYMAM.js +0 -46
- package/dist/chunks/constants-KIQEYMAM.js.map +0 -7
- package/dist/chunks/fs-ZI5JEU7V.js.map +0 -7
- package/dist/entries/server-router.js +0 -62
- package/dist/entries/server-router.js.map +0 -7
- package/entries/server-router.tsx +0 -75
- package/lib/server/providers/fileSystemPageProvider.test.ts +0 -84
- package/lib/server/providers/fileSystemPageProvider.ts +0 -179
- package/lib/server/webflow/buildWebflow.ts +0 -623
- package/lib/server/webflow/index.ts +0 -23
- package/lib/server/webflow/nodeToWebflow.test.ts +0 -3102
- package/lib/server/webflow/nodeToWebflow.ts +0 -2372
- package/lib/server/webflow/styleMapper.test.ts +0 -348
- package/lib/server/webflow/styleMapper.ts +0 -687
- package/lib/server/webflow/templateWrapper.ts +0 -49
- package/lib/server/webflow/types.ts +0 -389
- /package/dist/{build-static.js.map → chunks/fs-G3ANWEFP.js.map} +0 -0
package/dist/lib/client/index.js
CHANGED
|
@@ -13,14 +13,17 @@ import {
|
|
|
13
13
|
resolveLinkMapping,
|
|
14
14
|
resolveStyleMapping,
|
|
15
15
|
skipEmptyTemplateAttributes
|
|
16
|
-
} from "../../chunks/chunk-
|
|
16
|
+
} from "../../chunks/chunk-NUP7H7D3.js";
|
|
17
17
|
import {
|
|
18
18
|
filterCSSProperties
|
|
19
|
-
} from "../../chunks/chunk-
|
|
19
|
+
} from "../../chunks/chunk-XTKNX4FW.js";
|
|
20
20
|
import {
|
|
21
21
|
BaseComponentRegistry,
|
|
22
|
+
DEFAULT_BREAKPOINTS,
|
|
22
23
|
DEFAULT_PREFETCH_CONFIG,
|
|
23
|
-
|
|
24
|
+
DEFAULT_REM_CONFIG,
|
|
25
|
+
DEFAULT_RESPONSIVE_SCALES,
|
|
26
|
+
breakpointClassPrefixes,
|
|
24
27
|
buildTemplateContext,
|
|
25
28
|
extractInteractiveStyleMappings,
|
|
26
29
|
extractNodeProperties,
|
|
@@ -28,6 +31,7 @@ import {
|
|
|
28
31
|
generateElementClassName,
|
|
29
32
|
generateRuleForClass,
|
|
30
33
|
generateSingleClassCSS,
|
|
34
|
+
getBreakpointValues,
|
|
31
35
|
getChildPath,
|
|
32
36
|
getNestedValue,
|
|
33
37
|
hasChildren,
|
|
@@ -35,10 +39,13 @@ import {
|
|
|
35
39
|
hasInteractiveStyleMappings,
|
|
36
40
|
hasItemTemplates,
|
|
37
41
|
init_ComponentRegistry,
|
|
42
|
+
init_errorLogger,
|
|
38
43
|
isBooleanMapping,
|
|
39
44
|
isComponentNode,
|
|
40
45
|
isCurrentLink,
|
|
46
|
+
isCustomNode,
|
|
41
47
|
isEmbedNode,
|
|
48
|
+
isIslandNode,
|
|
42
49
|
isItemDraftForLocale,
|
|
43
50
|
isLinkNode,
|
|
44
51
|
isListNode,
|
|
@@ -47,8 +54,11 @@ import {
|
|
|
47
54
|
isSlotContent,
|
|
48
55
|
isSlotMarker,
|
|
49
56
|
isValidNodeType,
|
|
57
|
+
logNetworkError,
|
|
58
|
+
logRuntimeError,
|
|
50
59
|
markAsSlotContent,
|
|
51
60
|
mergeResponsiveStyles,
|
|
61
|
+
normalizeBreakpointConfig,
|
|
52
62
|
pathToString,
|
|
53
63
|
processItemPropsTemplate,
|
|
54
64
|
processItemTemplate,
|
|
@@ -62,16 +72,7 @@ import {
|
|
|
62
72
|
sortClassesByPropertyOrder,
|
|
63
73
|
toFriendlyError,
|
|
64
74
|
validatePageData
|
|
65
|
-
} from "../../chunks/chunk-
|
|
66
|
-
import {
|
|
67
|
-
DEFAULT_BREAKPOINTS,
|
|
68
|
-
DEFAULT_REM_CONFIG,
|
|
69
|
-
DEFAULT_RESPONSIVE_SCALES,
|
|
70
|
-
getBreakpointValues,
|
|
71
|
-
logNetworkError,
|
|
72
|
-
logRuntimeError,
|
|
73
|
-
normalizeBreakpointConfig
|
|
74
|
-
} from "../../chunks/chunk-I2WEGYA7.js";
|
|
75
|
+
} from "../../chunks/chunk-2IIQK7T3.js";
|
|
75
76
|
import {
|
|
76
77
|
DEFAULT_I18N_CONFIG,
|
|
77
78
|
isI18nValue,
|
|
@@ -79,11 +80,11 @@ import {
|
|
|
79
80
|
parseLocaleFromPath,
|
|
80
81
|
resolveI18nValue,
|
|
81
82
|
setStoredLocale
|
|
82
|
-
} from "../../chunks/chunk-
|
|
83
|
+
} from "../../chunks/chunk-4ZRU52J2.js";
|
|
83
84
|
import {
|
|
84
85
|
isTiptapDocument,
|
|
85
86
|
tiptapToHtml
|
|
86
|
-
} from "../../chunks/chunk-
|
|
87
|
+
} from "../../chunks/chunk-5X4HCN7J.js";
|
|
87
88
|
import {
|
|
88
89
|
API_ROUTES,
|
|
89
90
|
IFRAME_MESSAGE_TYPES,
|
|
@@ -91,7 +92,7 @@ import {
|
|
|
91
92
|
NOT_FOUND_TIMEOUT_MS,
|
|
92
93
|
RAW_HTML_PREFIX,
|
|
93
94
|
init_constants
|
|
94
|
-
} from "../../chunks/chunk-
|
|
95
|
+
} from "../../chunks/chunk-AR7LHIFY.js";
|
|
95
96
|
import "../../chunks/chunk-KSBZ2L7C.js";
|
|
96
97
|
|
|
97
98
|
// lib/client/core/ComponentBuilder.ts
|
|
@@ -404,18 +405,18 @@ var InteractiveStylesRegistry = new InteractiveStylesRegistryImpl();
|
|
|
404
405
|
|
|
405
406
|
// lib/client/responsiveStyleResolver.ts
|
|
406
407
|
var breakpointConfig = null;
|
|
407
|
-
var
|
|
408
|
+
var _breakpointPromise = null;
|
|
408
409
|
var responsiveScalesConfig = null;
|
|
409
|
-
var
|
|
410
|
+
var _responsiveScalesPromise = null;
|
|
410
411
|
var remConversionConfig = null;
|
|
411
412
|
var configPromise = null;
|
|
412
413
|
function clearBreakpointConfigCache() {
|
|
413
414
|
breakpointConfig = null;
|
|
414
|
-
|
|
415
|
+
_breakpointPromise = null;
|
|
415
416
|
}
|
|
416
417
|
function clearResponsiveScalesConfigCache() {
|
|
417
418
|
responsiveScalesConfig = null;
|
|
418
|
-
|
|
419
|
+
_responsiveScalesPromise = null;
|
|
419
420
|
}
|
|
420
421
|
function clearRemConversionConfigCache() {
|
|
421
422
|
remConversionConfig = null;
|
|
@@ -424,6 +425,7 @@ function clearAllConfigCache() {
|
|
|
424
425
|
clearBreakpointConfigCache();
|
|
425
426
|
clearResponsiveScalesConfigCache();
|
|
426
427
|
clearRemConversionConfigCache();
|
|
428
|
+
clearKnownTokensCache();
|
|
427
429
|
configPromise = null;
|
|
428
430
|
}
|
|
429
431
|
function getCachedBreakpointConfig() {
|
|
@@ -435,6 +437,46 @@ function getCachedResponsiveScalesConfig() {
|
|
|
435
437
|
function getCachedRemConversionConfig() {
|
|
436
438
|
return remConversionConfig;
|
|
437
439
|
}
|
|
440
|
+
var knownTokens = null;
|
|
441
|
+
var _knownTokensPromise = null;
|
|
442
|
+
function getCachedKnownTokens() {
|
|
443
|
+
return knownTokens;
|
|
444
|
+
}
|
|
445
|
+
function clearKnownTokensCache() {
|
|
446
|
+
knownTokens = null;
|
|
447
|
+
_knownTokensPromise = null;
|
|
448
|
+
}
|
|
449
|
+
async function loadKnownTokens() {
|
|
450
|
+
if (knownTokens) return knownTokens;
|
|
451
|
+
if (!_knownTokensPromise) {
|
|
452
|
+
_knownTokensPromise = (async () => {
|
|
453
|
+
const tokens = /* @__PURE__ */ new Set();
|
|
454
|
+
try {
|
|
455
|
+
const res = await fetch("/api/colors-config");
|
|
456
|
+
if (res.ok) {
|
|
457
|
+
const cfg = await res.json();
|
|
458
|
+
for (const theme of Object.values(cfg?.themes ?? {})) {
|
|
459
|
+
for (const name of Object.keys(theme?.colors ?? {})) tokens.add(name);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
} catch {
|
|
463
|
+
}
|
|
464
|
+
try {
|
|
465
|
+
const res = await fetch("/api/variables-status");
|
|
466
|
+
if (res.ok) {
|
|
467
|
+
const data = await res.json();
|
|
468
|
+
for (const v of data?.config?.variables ?? []) {
|
|
469
|
+
if (v?.cssVar) tokens.add(v.cssVar.replace(/^--/, ""));
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
} catch {
|
|
473
|
+
}
|
|
474
|
+
knownTokens = tokens;
|
|
475
|
+
})();
|
|
476
|
+
}
|
|
477
|
+
await _knownTokensPromise;
|
|
478
|
+
return knownTokens ?? /* @__PURE__ */ new Set();
|
|
479
|
+
}
|
|
438
480
|
async function loadConfig() {
|
|
439
481
|
if (breakpointConfig && responsiveScalesConfig && remConversionConfig) {
|
|
440
482
|
return;
|
|
@@ -549,33 +591,37 @@ function buildResponsivePrefixMap(breakpoints) {
|
|
|
549
591
|
const breakpointValues = getBreakpointValues(breakpoints);
|
|
550
592
|
const map = {};
|
|
551
593
|
for (const [breakpointName, breakpointValue] of Object.entries(breakpointValues)) {
|
|
552
|
-
|
|
594
|
+
for (const prefix of breakpointClassPrefixes(breakpointName)) {
|
|
595
|
+
map[prefix] = breakpointValue;
|
|
596
|
+
}
|
|
553
597
|
}
|
|
554
598
|
return map;
|
|
555
599
|
}
|
|
556
|
-
function getClassBreakpointValue(className, prefixMap) {
|
|
557
|
-
for (const prefix of Object.
|
|
600
|
+
function getClassBreakpointValue(className, prefixMap, knownTokens2) {
|
|
601
|
+
for (const [prefix, prefixValue] of Object.entries(prefixMap)) {
|
|
558
602
|
if (className.startsWith(prefix) && className.length > prefix.length) {
|
|
559
603
|
const potentialClass = className.substring(prefix.length);
|
|
560
|
-
const rule = generateRuleForClass(potentialClass);
|
|
604
|
+
const rule = generateRuleForClass(potentialClass, knownTokens2);
|
|
561
605
|
if (rule) {
|
|
562
|
-
return
|
|
606
|
+
return prefixValue;
|
|
563
607
|
}
|
|
564
608
|
}
|
|
565
609
|
}
|
|
566
610
|
return 0;
|
|
567
611
|
}
|
|
568
|
-
function sortClassesWithBreakpointOrder(classes, breakpoints) {
|
|
612
|
+
function sortClassesWithBreakpointOrder(classes, breakpoints, knownTokens2) {
|
|
569
613
|
const prefixMap = buildResponsivePrefixMap(breakpoints);
|
|
570
614
|
const arr = Array.from(classes);
|
|
571
615
|
const keys = arr.map((cls) => {
|
|
572
|
-
const bpValue = getClassBreakpointValue(cls, prefixMap);
|
|
616
|
+
const bpValue = getClassBreakpointValue(cls, prefixMap, knownTokens2);
|
|
573
617
|
return { cls, isResponsive: bpValue > 0 ? 1 : 0, bpValue };
|
|
574
618
|
});
|
|
575
619
|
const propertySorted = sortClassesByPropertyOrder(arr);
|
|
576
620
|
const propertyOrderIndex = /* @__PURE__ */ new Map();
|
|
577
621
|
for (let i = 0; i < propertySorted.length; i++) {
|
|
578
|
-
|
|
622
|
+
const cls = propertySorted[i];
|
|
623
|
+
if (cls === void 0) continue;
|
|
624
|
+
propertyOrderIndex.set(cls, i);
|
|
579
625
|
}
|
|
580
626
|
keys.sort((a, b) => {
|
|
581
627
|
if (a.isResponsive !== b.isResponsive) return a.isResponsive - b.isResponsive;
|
|
@@ -590,13 +636,15 @@ var UtilityClassCollectorImpl = class {
|
|
|
590
636
|
injectedRules = /* @__PURE__ */ new Map();
|
|
591
637
|
/** Cached reference to <style id="utility-css"> */
|
|
592
638
|
styleEl = null;
|
|
639
|
+
/** Guards a single async warm of the known-token set (see collect()). */
|
|
640
|
+
knownTokensPending = false;
|
|
593
641
|
/**
|
|
594
642
|
* Ensure we have a valid reference to the utility-css style element.
|
|
595
643
|
* Returns null during SSR (no document).
|
|
596
644
|
*/
|
|
597
645
|
ensureStyleElement() {
|
|
598
646
|
if (typeof document === "undefined") return null;
|
|
599
|
-
if (this.styleEl
|
|
647
|
+
if (this.styleEl?.isConnected) {
|
|
600
648
|
return this.styleEl;
|
|
601
649
|
}
|
|
602
650
|
this.styleEl = document.getElementById("utility-css");
|
|
@@ -622,23 +670,38 @@ var UtilityClassCollectorImpl = class {
|
|
|
622
670
|
const breakpointConfig2 = getCachedBreakpointConfig() || DEFAULT_BREAKPOINTS;
|
|
623
671
|
const responsiveScalesConfig2 = getCachedResponsiveScalesConfig() || DEFAULT_RESPONSIVE_SCALES;
|
|
624
672
|
const remConversionConfig2 = getCachedRemConversionConfig() || void 0;
|
|
673
|
+
const knownTokens2 = getCachedKnownTokens() ?? void 0;
|
|
625
674
|
let hasNew = false;
|
|
626
675
|
for (const name of classNames) {
|
|
627
676
|
this.classes.add(name);
|
|
628
677
|
if (this.injectedRules.has(name)) continue;
|
|
629
|
-
const css = generateSingleClassCSS(
|
|
678
|
+
const css = generateSingleClassCSS(
|
|
679
|
+
name,
|
|
680
|
+
breakpointConfig2,
|
|
681
|
+
responsiveScalesConfig2,
|
|
682
|
+
remConversionConfig2,
|
|
683
|
+
knownTokens2
|
|
684
|
+
);
|
|
630
685
|
if (css) {
|
|
631
686
|
this.injectedRules.set(name, rewriteViewportUnits(css));
|
|
632
687
|
hasNew = true;
|
|
633
688
|
}
|
|
634
689
|
}
|
|
635
690
|
if (hasNew) {
|
|
636
|
-
const sorted = sortClassesWithBreakpointOrder(this.injectedRules.keys(), breakpointConfig2);
|
|
691
|
+
const sorted = sortClassesWithBreakpointOrder(this.injectedRules.keys(), breakpointConfig2, knownTokens2);
|
|
637
692
|
const styleEl = this.ensureStyleElement();
|
|
638
693
|
if (styleEl) {
|
|
639
694
|
styleEl.textContent = sorted.map((name) => this.injectedRules.get(name)).join("\n");
|
|
640
695
|
}
|
|
641
696
|
}
|
|
697
|
+
if (!getCachedKnownTokens() && !this.knownTokensPending) {
|
|
698
|
+
this.knownTokensPending = true;
|
|
699
|
+
void loadKnownTokens().then(() => {
|
|
700
|
+
this.knownTokensPending = false;
|
|
701
|
+
const pending = Array.from(this.classes).filter((n) => !this.injectedRules.has(n));
|
|
702
|
+
if (pending.length > 0) this.collect(pending);
|
|
703
|
+
});
|
|
704
|
+
}
|
|
642
705
|
}
|
|
643
706
|
/**
|
|
644
707
|
* Clear collected classes for route change.
|
|
@@ -655,7 +718,8 @@ var UtilityClassCollectorImpl = class {
|
|
|
655
718
|
destroy() {
|
|
656
719
|
this.classes.clear();
|
|
657
720
|
this.injectedRules.clear();
|
|
658
|
-
|
|
721
|
+
this.knownTokensPending = false;
|
|
722
|
+
if (this.styleEl?.isConnected) {
|
|
659
723
|
this.styleEl.remove();
|
|
660
724
|
}
|
|
661
725
|
this.styleEl = null;
|
|
@@ -734,7 +798,7 @@ function resolveI18nValue2(value, locale, config) {
|
|
|
734
798
|
function processCMSTemplate(template, cmsItem, locale) {
|
|
735
799
|
const config = getI18nConfig();
|
|
736
800
|
const effectiveLocale = locale || config.defaultLocale;
|
|
737
|
-
return template.replace(/\{\{cms\.([^}]+)\}\}/g, (
|
|
801
|
+
return template.replace(/\{\{cms\.([^}]+)\}\}/g, (_match, fieldPath) => {
|
|
738
802
|
const parts = fieldPath.trim().split(".");
|
|
739
803
|
let value = cmsItem;
|
|
740
804
|
for (const part of parts) {
|
|
@@ -1405,6 +1469,7 @@ function buildLocaleList(node, ctx, deps) {
|
|
|
1405
1469
|
const linkElements = [];
|
|
1406
1470
|
for (let i = 0; i < configLocales.length; i++) {
|
|
1407
1471
|
const localeConfig = configLocales[i];
|
|
1472
|
+
if (!localeConfig) continue;
|
|
1408
1473
|
const isCurrent = localeConfig.code === currentLocaleCode;
|
|
1409
1474
|
if (!showCurrent && isCurrent) continue;
|
|
1410
1475
|
if (showSeparator && linkElements.length > 0) {
|
|
@@ -1435,7 +1500,6 @@ function buildLocaleList(node, ctx, deps) {
|
|
|
1435
1500
|
case "name":
|
|
1436
1501
|
displayText = localeConfig.name;
|
|
1437
1502
|
break;
|
|
1438
|
-
case "nativeName":
|
|
1439
1503
|
default:
|
|
1440
1504
|
displayText = localeConfig.nativeName;
|
|
1441
1505
|
break;
|
|
@@ -1483,9 +1547,14 @@ function buildList(node, children, ctx, deps) {
|
|
|
1483
1547
|
const isLegacyCMSList = nodeType === "cms-list";
|
|
1484
1548
|
const sourceType = isLegacyCMSList ? "collection" : node.sourceType || "prop";
|
|
1485
1549
|
const isCollectionMode = sourceType === "collection";
|
|
1550
|
+
const isRemoteMode = sourceType === "remote";
|
|
1551
|
+
const remoteUrl = isRemoteMode && typeof node.url === "string" ? node.url : "";
|
|
1552
|
+
const isSanityMode = sourceType === "sanity";
|
|
1553
|
+
const sanityKey = isSanityMode && typeof node.documentType === "string" ? node.documentType : "";
|
|
1486
1554
|
const rawSource = node.source || node.collection;
|
|
1487
1555
|
const source = typeof rawSource === "string" ? rawSource : "";
|
|
1488
1556
|
const sourceIsResolved = Array.isArray(rawSource);
|
|
1557
|
+
const hasSource = sourceIsResolved || Boolean(source) || isRemoteMode && Boolean(remoteUrl) || isSanityMode && Boolean(sanityKey);
|
|
1489
1558
|
const effectiveParentComponentName = deps.getEffectiveParentComponentName(componentContext, parentComponentName);
|
|
1490
1559
|
const extractedAttributes = extractAttributesFromNode(node);
|
|
1491
1560
|
const containerProps = {
|
|
@@ -1498,6 +1567,14 @@ function buildList(node, children, ctx, deps) {
|
|
|
1498
1567
|
containerProps["data-cms-list"] = "true";
|
|
1499
1568
|
if (isCollectionMode) {
|
|
1500
1569
|
containerProps["data-collection"] = source || "";
|
|
1570
|
+
} else if (isRemoteMode) {
|
|
1571
|
+
containerProps["data-list"] = "true";
|
|
1572
|
+
containerProps["data-source-type"] = "remote";
|
|
1573
|
+
containerProps["data-source"] = remoteUrl;
|
|
1574
|
+
} else if (isSanityMode) {
|
|
1575
|
+
containerProps["data-list"] = "true";
|
|
1576
|
+
containerProps["data-source-type"] = "sanity";
|
|
1577
|
+
containerProps["data-source"] = sanityKey;
|
|
1501
1578
|
} else {
|
|
1502
1579
|
containerProps["data-list"] = "true";
|
|
1503
1580
|
containerProps["data-source"] = source || (sourceIsResolved ? "resolved" : "");
|
|
@@ -1523,6 +1600,12 @@ function buildList(node, children, ctx, deps) {
|
|
|
1523
1600
|
let itemsToRender;
|
|
1524
1601
|
if (isCollectionMode) {
|
|
1525
1602
|
itemsToRender = getCollectionItems(node, source, ctx);
|
|
1603
|
+
} else if (isRemoteMode) {
|
|
1604
|
+
itemsToRender = getCollectionItems(node, remoteUrl, ctx);
|
|
1605
|
+
} else if (isSanityMode) {
|
|
1606
|
+
itemsToRender = getCollectionItems(node, sanityKey, ctx);
|
|
1607
|
+
} else if (sourceType === "expression") {
|
|
1608
|
+
itemsToRender = [];
|
|
1526
1609
|
} else {
|
|
1527
1610
|
if (sourceIsResolved) {
|
|
1528
1611
|
itemsToRender = rawSource;
|
|
@@ -1543,9 +1626,9 @@ function buildList(node, children, ctx, deps) {
|
|
|
1543
1626
|
const bgColor = isCollectionMode ? "rgba(139, 92, 246, 0.05)" : "rgba(59, 130, 246, 0.05)";
|
|
1544
1627
|
const borderColor = isCollectionMode ? "rgba(139, 92, 246, 0.3)" : "rgba(59, 130, 246, 0.3)";
|
|
1545
1628
|
const textColor = isCollectionMode ? "#8b5cf6" : "#3b82f6";
|
|
1546
|
-
const label = isCollectionMode ? "CMS List" : "List";
|
|
1629
|
+
const label = isCollectionMode ? "CMS List" : isRemoteMode ? "Remote List" : isSanityMode ? "Sanity List" : "List";
|
|
1547
1630
|
const tag = typeof node.tag === "string" ? node.tag : null;
|
|
1548
|
-
if (!
|
|
1631
|
+
if (!hasSource) {
|
|
1549
1632
|
const emptyState = h5(
|
|
1550
1633
|
"div",
|
|
1551
1634
|
{
|
|
@@ -1584,7 +1667,7 @@ function buildList(node, children, ctx, deps) {
|
|
|
1584
1667
|
textAlign: "center"
|
|
1585
1668
|
}
|
|
1586
1669
|
},
|
|
1587
|
-
`${label}: ${source || "resolved"} - No items`
|
|
1670
|
+
`${label}: ${source || remoteUrl || sanityKey || "resolved"} - No items`
|
|
1588
1671
|
);
|
|
1589
1672
|
if (tag === null) {
|
|
1590
1673
|
return emptyState;
|
|
@@ -2232,6 +2315,12 @@ var ComponentBuilder = class {
|
|
|
2232
2315
|
if (nodeType === NODE_TYPE.LOCALE_LIST && isLocaleListNode(node)) {
|
|
2233
2316
|
return buildLocaleList(node, ctx, builderDeps);
|
|
2234
2317
|
}
|
|
2318
|
+
if (nodeType === NODE_TYPE.ISLAND && isIslandNode(node)) {
|
|
2319
|
+
return this.buildBlackBoxNode(node, "data-island", /\.(tsx|jsx|vue|svelte)$/i, options);
|
|
2320
|
+
}
|
|
2321
|
+
if (nodeType === NODE_TYPE.CUSTOM && isCustomNode(node)) {
|
|
2322
|
+
return this.buildBlackBoxNode(node, "data-custom", /\.astro$/i, options);
|
|
2323
|
+
}
|
|
2235
2324
|
if (isListNode(node)) {
|
|
2236
2325
|
return buildList(node, children, ctx, builderDeps);
|
|
2237
2326
|
}
|
|
@@ -2287,17 +2376,22 @@ var ComponentBuilder = class {
|
|
|
2287
2376
|
const markerRegex = /<div\s+data-meno-component="([^"]+)"\s+data-meno-props="([^"]*)"[^>]*><\/div>/g;
|
|
2288
2377
|
const segments = [];
|
|
2289
2378
|
let lastIndex = 0;
|
|
2290
|
-
let match;
|
|
2379
|
+
let match = markerRegex.exec(html);
|
|
2291
2380
|
let segmentIndex = 0;
|
|
2292
|
-
while (
|
|
2293
|
-
|
|
2294
|
-
|
|
2381
|
+
while (match !== null) {
|
|
2382
|
+
const currentMatch = match;
|
|
2383
|
+
match = markerRegex.exec(html);
|
|
2384
|
+
if (currentMatch.index > lastIndex) {
|
|
2385
|
+
const chunk = html.slice(lastIndex, currentMatch.index);
|
|
2295
2386
|
segments.push(h7("span", { key: `rt-${segmentIndex++}`, dangerouslySetInnerHTML: { __html: chunk } }));
|
|
2296
2387
|
}
|
|
2297
|
-
const componentName =
|
|
2388
|
+
const componentName = currentMatch[1];
|
|
2389
|
+
if (componentName === void 0) {
|
|
2390
|
+
continue;
|
|
2391
|
+
}
|
|
2298
2392
|
let props = {};
|
|
2299
2393
|
try {
|
|
2300
|
-
const propsStr =
|
|
2394
|
+
const propsStr = (currentMatch[2] ?? "").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
2301
2395
|
props = JSON.parse(propsStr);
|
|
2302
2396
|
} catch {
|
|
2303
2397
|
}
|
|
@@ -2331,10 +2425,10 @@ var ComponentBuilder = class {
|
|
|
2331
2425
|
segments.push(rendered);
|
|
2332
2426
|
}
|
|
2333
2427
|
} else {
|
|
2334
|
-
segments.push(h7("span", { key: `rt-${segmentIndex}`, dangerouslySetInnerHTML: { __html:
|
|
2428
|
+
segments.push(h7("span", { key: `rt-${segmentIndex}`, dangerouslySetInnerHTML: { __html: currentMatch[0] } }));
|
|
2335
2429
|
}
|
|
2336
2430
|
segmentIndex++;
|
|
2337
|
-
lastIndex =
|
|
2431
|
+
lastIndex = currentMatch.index + currentMatch[0].length;
|
|
2338
2432
|
}
|
|
2339
2433
|
if (lastIndex < html.length) {
|
|
2340
2434
|
segments.push(
|
|
@@ -2563,6 +2657,8 @@ var ComponentBuilder = class {
|
|
|
2563
2657
|
const attrClass = extractedAttributes.class ?? extractedAttributes.className ?? "";
|
|
2564
2658
|
const existingClassName = result.className || "";
|
|
2565
2659
|
result.className = [existingClassName, attrClass].filter(Boolean).join(" ");
|
|
2660
|
+
const classTokens = attrClass.split(/\s+/).filter(Boolean);
|
|
2661
|
+
if (classTokens.length > 0) UtilityClassCollector.collect(classTokens);
|
|
2566
2662
|
delete extractedAttributes.class;
|
|
2567
2663
|
delete extractedAttributes.className;
|
|
2568
2664
|
}
|
|
@@ -2572,6 +2668,69 @@ var ComponentBuilder = class {
|
|
|
2572
2668
|
}
|
|
2573
2669
|
return { ...result, ...normalizedAttributes };
|
|
2574
2670
|
}
|
|
2671
|
+
/**
|
|
2672
|
+
* Build the canvas placeholder for a "black box" node (Island / Custom) that
|
|
2673
|
+
* meno-core can't actually run. Renders the node's slotted children as normal
|
|
2674
|
+
* content, or a quiet inline marker when there are none. The wrapper carries
|
|
2675
|
+
* `data-element-path` (and CMS-list context, when inside one) via a ref so a
|
|
2676
|
+
* click resolves to this node and selects it like any regular element — even
|
|
2677
|
+
* though the `display:contents` wrapper itself draws no box.
|
|
2678
|
+
*/
|
|
2679
|
+
buildBlackBoxNode(node, dataAttr, extPattern, options) {
|
|
2680
|
+
const {
|
|
2681
|
+
key = 0,
|
|
2682
|
+
elementPath = [0],
|
|
2683
|
+
parentComponentName = null,
|
|
2684
|
+
viewportWidth = 1920,
|
|
2685
|
+
componentContext = null,
|
|
2686
|
+
componentRootPath,
|
|
2687
|
+
locale,
|
|
2688
|
+
i18nConfig,
|
|
2689
|
+
cmsContext = null,
|
|
2690
|
+
cmsLocale = null,
|
|
2691
|
+
collectionItemsMap = {},
|
|
2692
|
+
itemContext = null,
|
|
2693
|
+
cmsItemIndexPath = null,
|
|
2694
|
+
cmsListPaths = null,
|
|
2695
|
+
templateContext = null,
|
|
2696
|
+
componentResolvedProps = null
|
|
2697
|
+
} = options;
|
|
2698
|
+
const src = "src" in node && typeof node.src === "string" ? node.src : "";
|
|
2699
|
+
const name = src.split("/").pop()?.replace(extPattern, "") || "?";
|
|
2700
|
+
const childNodes = "children" in node ? node.children : void 0;
|
|
2701
|
+
const hasChildNodes = Array.isArray(childNodes) && childNodes.length > 0 || typeof childNodes === "string" && childNodes.length > 0;
|
|
2702
|
+
const inner = hasChildNodes ? this.buildChildren(childNodes, {
|
|
2703
|
+
elementPath,
|
|
2704
|
+
parentComponentName,
|
|
2705
|
+
viewportWidth,
|
|
2706
|
+
componentContext,
|
|
2707
|
+
componentRootPath,
|
|
2708
|
+
locale,
|
|
2709
|
+
i18nConfig,
|
|
2710
|
+
cmsContext,
|
|
2711
|
+
cmsLocale,
|
|
2712
|
+
collectionItemsMap,
|
|
2713
|
+
itemContext,
|
|
2714
|
+
cmsItemIndexPath,
|
|
2715
|
+
cmsListPaths,
|
|
2716
|
+
templateContext,
|
|
2717
|
+
componentResolvedProps
|
|
2718
|
+
}) : h7("span", { style: { color: "#9ca3af", fontSize: "13px" } }, name);
|
|
2719
|
+
const ref = (el) => {
|
|
2720
|
+
if (!el) return;
|
|
2721
|
+
el.setAttribute("data-element-path", pathToString(elementPath));
|
|
2722
|
+
if (cmsItemIndexPath && cmsItemIndexPath.length > 0) {
|
|
2723
|
+
el.setAttribute("data-cms-item-index", cmsItemIndexPath.join("."));
|
|
2724
|
+
if (cmsListPaths && cmsListPaths.length === cmsItemIndexPath.length) {
|
|
2725
|
+
el.setAttribute(
|
|
2726
|
+
"data-cms-context",
|
|
2727
|
+
JSON.stringify({ itemIndexPath: cmsItemIndexPath, listPaths: cmsListPaths })
|
|
2728
|
+
);
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
};
|
|
2732
|
+
return h7("div", { key, [dataAttr]: src, style: { display: "contents" }, ref }, inner);
|
|
2733
|
+
}
|
|
2575
2734
|
/**
|
|
2576
2735
|
* Build a custom component
|
|
2577
2736
|
*/
|
|
@@ -2670,7 +2829,7 @@ var ComponentBuilder = class {
|
|
|
2670
2829
|
componentResolvedProps: resolvedProps
|
|
2671
2830
|
});
|
|
2672
2831
|
return h7(ErrorBoundary, { key, componentName, level: "component" }, componentElement);
|
|
2673
|
-
} catch (
|
|
2832
|
+
} catch (_error) {
|
|
2674
2833
|
return h7(ErrorBoundary, { key, componentName, level: "component" }, null);
|
|
2675
2834
|
}
|
|
2676
2835
|
}
|
|
@@ -2872,6 +3031,7 @@ import { createElement as h10, useState as useState2, useEffect as useEffect2, u
|
|
|
2872
3031
|
|
|
2873
3032
|
// lib/client/routing/RouteLoader.ts
|
|
2874
3033
|
init_constants();
|
|
3034
|
+
init_errorLogger();
|
|
2875
3035
|
var RouteLoader = class {
|
|
2876
3036
|
abortController = null;
|
|
2877
3037
|
notFoundTimeout = null;
|
|
@@ -3030,6 +3190,7 @@ var RouteLoader = class {
|
|
|
3030
3190
|
try {
|
|
3031
3191
|
this.config.componentRegistry.merge(parsed.components);
|
|
3032
3192
|
} catch (componentError) {
|
|
3193
|
+
logRuntimeError("RouteLoader.mergePageComponents", componentError);
|
|
3033
3194
|
}
|
|
3034
3195
|
tree = parsed.root || parsed;
|
|
3035
3196
|
} else if (parsed.root) {
|
|
@@ -3144,6 +3305,7 @@ function getInitialLoadingState(hasSSRContent) {
|
|
|
3144
3305
|
import { createElement as h9, useState, useEffect, useRef } from "react";
|
|
3145
3306
|
|
|
3146
3307
|
// lib/client/hmrWebSocket.ts
|
|
3308
|
+
init_errorLogger();
|
|
3147
3309
|
var HMRWebSocket = class {
|
|
3148
3310
|
ws = null;
|
|
3149
3311
|
config;
|
|
@@ -3184,7 +3346,7 @@ var HMRWebSocket = class {
|
|
|
3184
3346
|
this.ws.onmessage = (event) => this.handleMessage(event);
|
|
3185
3347
|
this.ws.onerror = (error) => this.handleError(error);
|
|
3186
3348
|
this.ws.onclose = (event) => this.handleClose(event);
|
|
3187
|
-
} catch (
|
|
3349
|
+
} catch (_error) {
|
|
3188
3350
|
this.scheduleReconnect();
|
|
3189
3351
|
}
|
|
3190
3352
|
}
|
|
@@ -3206,10 +3368,10 @@ var HMRWebSocket = class {
|
|
|
3206
3368
|
logRuntimeError("hmrWebSocket.handleMessage", e);
|
|
3207
3369
|
}
|
|
3208
3370
|
}
|
|
3209
|
-
handleError(
|
|
3371
|
+
handleError(_error) {
|
|
3210
3372
|
this.config.onStatusChange("error");
|
|
3211
3373
|
}
|
|
3212
|
-
handleClose(
|
|
3374
|
+
handleClose(_event) {
|
|
3213
3375
|
this.stopHeartbeat();
|
|
3214
3376
|
if (!this.isIntentionallyClosed) {
|
|
3215
3377
|
this.config.onStatusChange("disconnected");
|
|
@@ -3388,6 +3550,8 @@ function HMRManager({
|
|
|
3388
3550
|
document.dispatchEvent(new CustomEvent("hmr-libraries-update"));
|
|
3389
3551
|
} else if (data.type === "hmr:config-update") {
|
|
3390
3552
|
document.dispatchEvent(new CustomEvent("hmr-config-update"));
|
|
3553
|
+
} else if (data.type === "hmr:stylesheet-update") {
|
|
3554
|
+
document.dispatchEvent(new CustomEvent("hmr-stylesheet-update"));
|
|
3391
3555
|
}
|
|
3392
3556
|
};
|
|
3393
3557
|
const createStatusHandler = () => (newStatus) => {
|
|
@@ -3445,25 +3609,29 @@ function HMRIndicator({ status }) {
|
|
|
3445
3609
|
error: { bg: "#dc2626", text: "\u274C Connection Failed - Refresh Page", show: true }
|
|
3446
3610
|
};
|
|
3447
3611
|
const config = statusConfig[status];
|
|
3448
|
-
return h9(
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3612
|
+
return h9(
|
|
3613
|
+
"div",
|
|
3614
|
+
{
|
|
3615
|
+
id: "hmr-indicator",
|
|
3616
|
+
style: {
|
|
3617
|
+
position: "fixed",
|
|
3618
|
+
top: "20px",
|
|
3619
|
+
right: "20px",
|
|
3620
|
+
background: config.bg,
|
|
3621
|
+
color: "white",
|
|
3622
|
+
padding: "12px 20px",
|
|
3623
|
+
borderRadius: "8px",
|
|
3624
|
+
fontSize: "14px",
|
|
3625
|
+
fontWeight: "600",
|
|
3626
|
+
display: config.show ? "block" : "none",
|
|
3627
|
+
boxShadow: `0 4px 12px ${config.bg}40`,
|
|
3628
|
+
animation: "slideIn 0.3s ease-out",
|
|
3629
|
+
zIndex: 9999,
|
|
3630
|
+
transition: "all 0.3s ease"
|
|
3631
|
+
}
|
|
3632
|
+
},
|
|
3633
|
+
config.text
|
|
3634
|
+
);
|
|
3467
3635
|
}
|
|
3468
3636
|
|
|
3469
3637
|
// lib/client/elementRegistry.ts
|
|
@@ -3531,6 +3699,7 @@ var ComponentRegistry = class extends BaseComponentRegistry {
|
|
|
3531
3699
|
var globalComponentRegistry = new ComponentRegistry();
|
|
3532
3700
|
|
|
3533
3701
|
// lib/client/styles/StyleInjector.ts
|
|
3702
|
+
init_errorLogger();
|
|
3534
3703
|
function simpleHash(str) {
|
|
3535
3704
|
let hash = 0;
|
|
3536
3705
|
for (let i = 0; i < str.length; i++) {
|
|
@@ -3589,7 +3758,7 @@ var StyleInjector = class {
|
|
|
3589
3758
|
processedCSSBlocks.push(`/* Component: ${name} (instance) */
|
|
3590
3759
|
${processedCSS}`);
|
|
3591
3760
|
}
|
|
3592
|
-
} catch (
|
|
3761
|
+
} catch (_error) {
|
|
3593
3762
|
processedCSSBlocks.push(`/* Component: ${name} */
|
|
3594
3763
|
${originalCSS}`);
|
|
3595
3764
|
}
|
|
@@ -3671,6 +3840,7 @@ ${originalCSS}`);
|
|
|
3671
3840
|
};
|
|
3672
3841
|
|
|
3673
3842
|
// lib/client/scripts/ScriptExecutor.ts
|
|
3843
|
+
init_errorLogger();
|
|
3674
3844
|
function generateDestructure(defineVars, interfaceDef) {
|
|
3675
3845
|
const vars = defineVars === true ? Object.keys(interfaceDef || {}) : defineVars;
|
|
3676
3846
|
if (vars.length === 0) return "";
|
|
@@ -3699,7 +3869,7 @@ var ScriptExecutor = class {
|
|
|
3699
3869
|
*/
|
|
3700
3870
|
shouldBind(el, componentName) {
|
|
3701
3871
|
let names = this.boundElements.get(el);
|
|
3702
|
-
if (names
|
|
3872
|
+
if (names?.has(componentName)) return false;
|
|
3703
3873
|
if (!names) {
|
|
3704
3874
|
names = /* @__PURE__ */ new Set();
|
|
3705
3875
|
this.boundElements.set(el, names);
|
|
@@ -3716,7 +3886,7 @@ var ScriptExecutor = class {
|
|
|
3716
3886
|
* @private
|
|
3717
3887
|
*/
|
|
3718
3888
|
executeWrappedJS(jsCode, componentName) {
|
|
3719
|
-
if (!jsCode
|
|
3889
|
+
if (!jsCode?.trim()) return;
|
|
3720
3890
|
const wrappedJS = `(function() {
|
|
3721
3891
|
// Component: ${componentName}
|
|
3722
3892
|
try {
|
|
@@ -3752,7 +3922,7 @@ var ScriptExecutor = class {
|
|
|
3752
3922
|
try {
|
|
3753
3923
|
const processedJS = processCodeTemplates(originalJS, props);
|
|
3754
3924
|
this.executeWrappedJS(processedJS, `${componentName} (instance: ${rootPath})`);
|
|
3755
|
-
} catch (
|
|
3925
|
+
} catch (_templateError) {
|
|
3756
3926
|
this.executeWrappedJS(originalJS, `${componentName} (instance: ${rootPath})`);
|
|
3757
3927
|
}
|
|
3758
3928
|
} catch (e) {
|
|
@@ -3993,7 +4163,9 @@ var PrefetchService = class {
|
|
|
3993
4163
|
const entries = Array.from(this.cache.entries()).sort((a, b) => a[1].timestamp - b[1].timestamp);
|
|
3994
4164
|
const toRemove = this.cache.size - this.config.maxCacheSize;
|
|
3995
4165
|
for (let i = 0; i < toRemove; i++) {
|
|
3996
|
-
|
|
4166
|
+
const entry = entries[i];
|
|
4167
|
+
if (entry === void 0) continue;
|
|
4168
|
+
this.cache.delete(entry[0]);
|
|
3997
4169
|
}
|
|
3998
4170
|
}
|
|
3999
4171
|
/**
|
|
@@ -4091,7 +4263,7 @@ var PrefetchService = class {
|
|
|
4091
4263
|
if (entry.isIntersecting) {
|
|
4092
4264
|
const link = entry.target;
|
|
4093
4265
|
const href = link.getAttribute("href");
|
|
4094
|
-
if (href
|
|
4266
|
+
if (href?.startsWith("/")) {
|
|
4095
4267
|
this.prefetch(href);
|
|
4096
4268
|
}
|
|
4097
4269
|
}
|
|
@@ -4142,13 +4314,19 @@ var PrefetchService = class {
|
|
|
4142
4314
|
* Clear cache and cancel all pending operations
|
|
4143
4315
|
*/
|
|
4144
4316
|
clear() {
|
|
4145
|
-
this.pendingPrefetches.forEach((controller) =>
|
|
4317
|
+
this.pendingPrefetches.forEach((controller) => {
|
|
4318
|
+
controller.abort();
|
|
4319
|
+
});
|
|
4146
4320
|
this.pendingPrefetches.clear();
|
|
4147
|
-
this.hoverTimeouts.forEach((timeout) =>
|
|
4321
|
+
this.hoverTimeouts.forEach((timeout) => {
|
|
4322
|
+
clearTimeout(timeout);
|
|
4323
|
+
});
|
|
4148
4324
|
this.hoverTimeouts.clear();
|
|
4149
4325
|
this.cache.clear();
|
|
4150
4326
|
if (this.viewportObserver) {
|
|
4151
|
-
this.observedLinks.forEach((link) =>
|
|
4327
|
+
this.observedLinks.forEach((link) => {
|
|
4328
|
+
this.viewportObserver?.unobserve(link);
|
|
4329
|
+
});
|
|
4152
4330
|
this.observedLinks.clear();
|
|
4153
4331
|
this.linkPathMap.clear();
|
|
4154
4332
|
this.viewportObserver.disconnect();
|
|
@@ -4244,15 +4422,13 @@ function Router(props = {}) {
|
|
|
4244
4422
|
const [currentPath, setCurrentPath] = useState2(initialPath);
|
|
4245
4423
|
const [availablePages, setAvailablePages] = useState2([]);
|
|
4246
4424
|
const [showNotFound, setShowNotFound] = useState2(false);
|
|
4247
|
-
const [viewportWidth, setViewportWidth] = useState2(
|
|
4248
|
-
typeof window !== "undefined" ? window.innerWidth : 1920
|
|
4249
|
-
);
|
|
4425
|
+
const [viewportWidth, setViewportWidth] = useState2(typeof window !== "undefined" ? window.innerWidth : 1920);
|
|
4250
4426
|
const [i18nConfig, setI18nConfig2] = useState2(DEFAULT_I18N_CONFIG);
|
|
4251
4427
|
const [currentLocale, setCurrentLocale] = useState2(DEFAULT_I18N_CONFIG.defaultLocale);
|
|
4252
4428
|
const [cmsContext, setCmsContext] = useState2(null);
|
|
4253
4429
|
const [cmsLocale, setCmsLocale] = useState2(null);
|
|
4254
4430
|
const [registryVersion, setRegistryVersion] = useState2(0);
|
|
4255
|
-
const [awaitingCmsContext,
|
|
4431
|
+
const [awaitingCmsContext, _setAwaitingCmsContext] = useState2(false);
|
|
4256
4432
|
const [collectionItemsMap, setCollectionItemsMap] = useState2({});
|
|
4257
4433
|
const [cmsTemplatePath, setCmsTemplatePath] = useState2(null);
|
|
4258
4434
|
const lastCommitTimestampRef = useRef2(0);
|
|
@@ -4260,33 +4436,35 @@ function Router(props = {}) {
|
|
|
4260
4436
|
const lastCommitStructureChangedRef = useRef2(true);
|
|
4261
4437
|
const ssrCmsHandledRef = useRef2(false);
|
|
4262
4438
|
const initialLoadDoneRef = useRef2(false);
|
|
4263
|
-
const routeLoader = useRef2(
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4439
|
+
const routeLoader = useRef2(
|
|
4440
|
+
new RouteLoader({
|
|
4441
|
+
componentRegistry: services.componentRegistry,
|
|
4442
|
+
prefetchService: services.prefetchService,
|
|
4443
|
+
onLoadStart: () => {
|
|
4444
|
+
setLoading(true);
|
|
4445
|
+
setShowNotFound(false);
|
|
4446
|
+
InteractiveStylesRegistry.clear();
|
|
4447
|
+
UtilityClassCollector.clear();
|
|
4448
|
+
if (componentTreeRef.current) {
|
|
4449
|
+
setPreviousComponentTree(componentTreeRef.current);
|
|
4450
|
+
}
|
|
4451
|
+
},
|
|
4452
|
+
onLoadComplete: (tree) => {
|
|
4453
|
+
setComponentTree(tree);
|
|
4454
|
+
setLoading(false);
|
|
4455
|
+
setShowNotFound(false);
|
|
4456
|
+
setPreviousComponentTree(null);
|
|
4457
|
+
},
|
|
4458
|
+
onLoadError: (_error) => {
|
|
4459
|
+
setLoading(false);
|
|
4460
|
+
setShowNotFound(false);
|
|
4461
|
+
setPreviousComponentTree(null);
|
|
4462
|
+
},
|
|
4463
|
+
onNotFound: () => setShowNotFound(true),
|
|
4464
|
+
onPagesLoaded: (pages) => setAvailablePages(pages),
|
|
4465
|
+
onLocaleDetected: (locale) => setCurrentLocale(locale)
|
|
4466
|
+
})
|
|
4467
|
+
).current;
|
|
4290
4468
|
useEffect2(() => {
|
|
4291
4469
|
componentTreeRef.current = componentTree;
|
|
4292
4470
|
}, [componentTree]);
|
|
@@ -4428,9 +4606,12 @@ function Router(props = {}) {
|
|
|
4428
4606
|
useEffect2(() => {
|
|
4429
4607
|
if (typeof window === "undefined") return;
|
|
4430
4608
|
if (window.parent === window) return;
|
|
4431
|
-
window.parent.postMessage(
|
|
4432
|
-
|
|
4433
|
-
|
|
4609
|
+
window.parent.postMessage(
|
|
4610
|
+
{
|
|
4611
|
+
type: IFRAME_MESSAGE_TYPES.CMS_CONTEXT_REQUEST
|
|
4612
|
+
},
|
|
4613
|
+
"*"
|
|
4614
|
+
);
|
|
4434
4615
|
}, []);
|
|
4435
4616
|
useLayoutEffect(() => {
|
|
4436
4617
|
const treeToRender2 = previewComponentTree || componentTree;
|
|
@@ -4445,10 +4626,13 @@ function Router(props = {}) {
|
|
|
4445
4626
|
if (treeToRender2) {
|
|
4446
4627
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
4447
4628
|
const registryData = Object.fromEntries(InteractiveStylesRegistry.getAll());
|
|
4448
|
-
window.parent.postMessage(
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4629
|
+
window.parent.postMessage(
|
|
4630
|
+
{
|
|
4631
|
+
type: IFRAME_MESSAGE_TYPES.INTERACTIVE_STYLES_UPDATE,
|
|
4632
|
+
styles: registryData
|
|
4633
|
+
},
|
|
4634
|
+
"*"
|
|
4635
|
+
);
|
|
4452
4636
|
}
|
|
4453
4637
|
const shouldRunScripts = !disableScripts && lastCommitStructureChangedRef.current;
|
|
4454
4638
|
lastCommitStructureChangedRef.current = true;
|
|
@@ -4477,17 +4661,23 @@ function Router(props = {}) {
|
|
|
4477
4661
|
}, 100);
|
|
4478
4662
|
return () => clearTimeout(timeoutId);
|
|
4479
4663
|
}, [componentTree, currentPath, services]);
|
|
4480
|
-
const loadComponents = useCallback(
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4664
|
+
const loadComponents = useCallback(
|
|
4665
|
+
async (path) => {
|
|
4666
|
+
const pathToLoad = cmsTemplatePath || path;
|
|
4667
|
+
await routeLoader.loadComponents(pathToLoad);
|
|
4668
|
+
},
|
|
4669
|
+
[cmsTemplatePath]
|
|
4670
|
+
);
|
|
4671
|
+
const loadComponentsForHMR = useCallback(
|
|
4672
|
+
async (path) => {
|
|
4673
|
+
if (Date.now() - lastCommitTimestampRef.current < COMMIT_GRACE_MS) {
|
|
4674
|
+
return;
|
|
4675
|
+
}
|
|
4676
|
+
const pathToLoad = cmsTemplatePath || path;
|
|
4677
|
+
await routeLoader.loadComponents(pathToLoad);
|
|
4678
|
+
},
|
|
4679
|
+
[cmsTemplatePath]
|
|
4680
|
+
);
|
|
4491
4681
|
const loadComponentsRef = useRef2(loadComponents);
|
|
4492
4682
|
useEffect2(() => {
|
|
4493
4683
|
loadComponentsRef.current = loadComponents;
|
|
@@ -4499,7 +4689,7 @@ function Router(props = {}) {
|
|
|
4499
4689
|
const data = await response.json();
|
|
4500
4690
|
setCollectionItemsMap((prev) => ({ ...prev, [collection]: data.items || [] }));
|
|
4501
4691
|
}
|
|
4502
|
-
} catch (
|
|
4692
|
+
} catch (_error) {
|
|
4503
4693
|
}
|
|
4504
4694
|
}, []);
|
|
4505
4695
|
useEffect2(() => {
|
|
@@ -4623,11 +4813,7 @@ function Router(props = {}) {
|
|
|
4623
4813
|
}
|
|
4624
4814
|
},
|
|
4625
4815
|
h10("h2", null, `Page not found: ${currentPath}`),
|
|
4626
|
-
h10(
|
|
4627
|
-
"p",
|
|
4628
|
-
{ style: { marginTop: "16px", marginBottom: "24px", color: "#666" } },
|
|
4629
|
-
"Available pages:"
|
|
4630
|
-
),
|
|
4816
|
+
h10("p", { style: { marginTop: "16px", marginBottom: "24px", color: "#666" } }, "Available pages:"),
|
|
4631
4817
|
h10(
|
|
4632
4818
|
"ul",
|
|
4633
4819
|
{
|
|
@@ -4644,16 +4830,20 @@ function Router(props = {}) {
|
|
|
4644
4830
|
(page, i) => h10(
|
|
4645
4831
|
"li",
|
|
4646
4832
|
{ key: i },
|
|
4647
|
-
h10(
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4833
|
+
h10(
|
|
4834
|
+
"a",
|
|
4835
|
+
{
|
|
4836
|
+
href: page,
|
|
4837
|
+
onClick: createNavigationHandler(page),
|
|
4838
|
+
style: {
|
|
4839
|
+
color: "#0070f3",
|
|
4840
|
+
textDecoration: "none",
|
|
4841
|
+
fontSize: "18px",
|
|
4842
|
+
fontWeight: "600"
|
|
4843
|
+
}
|
|
4844
|
+
},
|
|
4845
|
+
page === "/" ? "Home (/)" : page
|
|
4846
|
+
)
|
|
4657
4847
|
)
|
|
4658
4848
|
)
|
|
4659
4849
|
)
|
|
@@ -4825,7 +5015,9 @@ function initializeHMRListener() {
|
|
|
4825
5015
|
cachedThemes = null;
|
|
4826
5016
|
cachedDefaultTheme = null;
|
|
4827
5017
|
await injectUpdatedThemeCSS();
|
|
4828
|
-
hmrCallbacks.forEach((callback) =>
|
|
5018
|
+
hmrCallbacks.forEach((callback) => {
|
|
5019
|
+
callback();
|
|
5020
|
+
});
|
|
4829
5021
|
});
|
|
4830
5022
|
}
|
|
4831
5023
|
if (typeof window !== "undefined") {
|
|
@@ -4845,11 +5037,11 @@ async function injectUpdatedThemeCSS() {
|
|
|
4845
5037
|
}
|
|
4846
5038
|
const defaultResponse = await fetch("/api/colors");
|
|
4847
5039
|
if (defaultResponse.ok) {
|
|
4848
|
-
themeColors
|
|
5040
|
+
themeColors.default = (await defaultResponse.json()).colors;
|
|
4849
5041
|
}
|
|
4850
5042
|
let css = "";
|
|
4851
|
-
if (themeColors
|
|
4852
|
-
const vars = Object.entries(themeColors
|
|
5043
|
+
if (themeColors.default) {
|
|
5044
|
+
const vars = Object.entries(themeColors.default).map(([name, value]) => ` --${name}: ${value};`).join("\n");
|
|
4853
5045
|
css += `:root {
|
|
4854
5046
|
${vars}
|
|
4855
5047
|
}
|
|
@@ -4857,8 +5049,9 @@ ${vars}
|
|
|
4857
5049
|
`;
|
|
4858
5050
|
}
|
|
4859
5051
|
for (const theme of data.themes) {
|
|
4860
|
-
|
|
4861
|
-
|
|
5052
|
+
const themeVars = themeColors[theme.name];
|
|
5053
|
+
if (themeVars) {
|
|
5054
|
+
const vars = Object.entries(themeVars).map(([name, value]) => ` --${name}: ${value};`).join("\n");
|
|
4862
5055
|
css += `[theme="${theme.name}"] {
|
|
4863
5056
|
${vars}
|
|
4864
5057
|
}
|
|
@@ -4872,7 +5065,7 @@ ${vars}
|
|
|
4872
5065
|
themeStyleTag.id = "hmr-theme-variables";
|
|
4873
5066
|
applyNonce(themeStyleTag);
|
|
4874
5067
|
const mainStyle = document.querySelector("style");
|
|
4875
|
-
if (mainStyle
|
|
5068
|
+
if (mainStyle?.nextSibling) {
|
|
4876
5069
|
document.head.insertBefore(themeStyleTag, mainStyle.nextSibling);
|
|
4877
5070
|
} else {
|
|
4878
5071
|
document.head.appendChild(themeStyleTag);
|
|
@@ -5038,6 +5231,7 @@ function useTheme() {
|
|
|
5038
5231
|
}
|
|
5039
5232
|
|
|
5040
5233
|
// lib/client/styleProcessor.ts
|
|
5234
|
+
init_errorLogger();
|
|
5041
5235
|
function mergeComponentStyles(componentDef, props) {
|
|
5042
5236
|
try {
|
|
5043
5237
|
let mergedProps = { ...componentDef.props || {} };
|
|
@@ -5069,6 +5263,7 @@ function mergeComponentStyles(componentDef, props) {
|
|
|
5069
5263
|
}
|
|
5070
5264
|
}
|
|
5071
5265
|
} catch (e) {
|
|
5266
|
+
logRuntimeError("styleProcessor.mergeStructureStyle", e);
|
|
5072
5267
|
}
|
|
5073
5268
|
const restProps = props || {};
|
|
5074
5269
|
const normalizedMergedStyle = normalizeStyle(mergedProps.style) || {};
|
|
@@ -5082,18 +5277,33 @@ function mergeComponentStyles(componentDef, props) {
|
|
|
5082
5277
|
}
|
|
5083
5278
|
};
|
|
5084
5279
|
return mergedProps;
|
|
5085
|
-
} catch (
|
|
5280
|
+
} catch (_error) {
|
|
5086
5281
|
return props || {};
|
|
5087
5282
|
}
|
|
5088
5283
|
}
|
|
5089
5284
|
function mergeStyles(...styles) {
|
|
5090
5285
|
return styles.reduce((acc, style) => {
|
|
5091
5286
|
if (!style) return acc;
|
|
5092
|
-
|
|
5287
|
+
Object.assign(acc, style);
|
|
5288
|
+
return acc;
|
|
5093
5289
|
}, {});
|
|
5094
5290
|
}
|
|
5095
5291
|
|
|
5096
5292
|
// lib/client/hmrCssReload.ts
|
|
5293
|
+
function reloadExternalStylesheets() {
|
|
5294
|
+
const links = document.querySelectorAll('link[rel="stylesheet"]');
|
|
5295
|
+
for (const link of links) {
|
|
5296
|
+
const href = link.getAttribute("href");
|
|
5297
|
+
if (!href || href.startsWith("data:")) continue;
|
|
5298
|
+
try {
|
|
5299
|
+
const url = new URL(href, location.href);
|
|
5300
|
+
if (url.origin !== location.origin) continue;
|
|
5301
|
+
url.searchParams.set("hmr", String(Date.now()));
|
|
5302
|
+
link.href = url.href;
|
|
5303
|
+
} catch {
|
|
5304
|
+
}
|
|
5305
|
+
}
|
|
5306
|
+
}
|
|
5097
5307
|
async function injectUpdatedThemeCSS2() {
|
|
5098
5308
|
try {
|
|
5099
5309
|
const themesResponse = await fetch("/api/themes");
|
|
@@ -5108,11 +5318,11 @@ async function injectUpdatedThemeCSS2() {
|
|
|
5108
5318
|
}
|
|
5109
5319
|
const defaultResponse = await fetch("/api/colors");
|
|
5110
5320
|
if (defaultResponse.ok) {
|
|
5111
|
-
themeColors
|
|
5321
|
+
themeColors.default = (await defaultResponse.json()).colors;
|
|
5112
5322
|
}
|
|
5113
5323
|
let css = "";
|
|
5114
|
-
if (themeColors
|
|
5115
|
-
const vars = Object.entries(themeColors
|
|
5324
|
+
if (themeColors.default) {
|
|
5325
|
+
const vars = Object.entries(themeColors.default).map(([name, value]) => ` --${name}: ${value};`).join("\n");
|
|
5116
5326
|
css += `:root {
|
|
5117
5327
|
${vars}
|
|
5118
5328
|
}
|
|
@@ -5120,8 +5330,9 @@ ${vars}
|
|
|
5120
5330
|
`;
|
|
5121
5331
|
}
|
|
5122
5332
|
for (const theme of themesData.themes) {
|
|
5123
|
-
|
|
5124
|
-
|
|
5333
|
+
const themeVars = themeColors[theme.name];
|
|
5334
|
+
if (themeVars) {
|
|
5335
|
+
const vars = Object.entries(themeVars).map(([name, value]) => ` --${name}: ${value};`).join("\n");
|
|
5125
5336
|
css += `[theme="${theme.name}"] {
|
|
5126
5337
|
${vars}
|
|
5127
5338
|
}
|
|
@@ -5198,6 +5409,12 @@ function setupCssHmrListeners() {
|
|
|
5198
5409
|
location.reload();
|
|
5199
5410
|
});
|
|
5200
5411
|
}
|
|
5412
|
+
if (!window.__hmrStylesheetInitialized) {
|
|
5413
|
+
window.__hmrStylesheetInitialized = true;
|
|
5414
|
+
document.addEventListener("hmr-stylesheet-update", () => {
|
|
5415
|
+
reloadExternalStylesheets();
|
|
5416
|
+
});
|
|
5417
|
+
}
|
|
5201
5418
|
}
|
|
5202
5419
|
|
|
5203
5420
|
// lib/client/fontFamiliesService.ts
|
|
@@ -5275,7 +5492,7 @@ function usePropertyAutocomplete(initialProperty = "") {
|
|
|
5275
5492
|
}
|
|
5276
5493
|
|
|
5277
5494
|
// lib/client/hooks/useVariables.ts
|
|
5278
|
-
import { useState as useState6, useEffect as
|
|
5495
|
+
import { useState as useState6, useEffect as useEffect5, useRef as useRef5 } from "react";
|
|
5279
5496
|
var cachedVariables = null;
|
|
5280
5497
|
var hmrCallbacks2 = /* @__PURE__ */ new Set();
|
|
5281
5498
|
function initializeHMRListener2() {
|
|
@@ -5284,7 +5501,9 @@ function initializeHMRListener2() {
|
|
|
5284
5501
|
window.__hmrVariablesInitialized = true;
|
|
5285
5502
|
document.addEventListener("hmr-variables-update", () => {
|
|
5286
5503
|
cachedVariables = null;
|
|
5287
|
-
hmrCallbacks2.forEach((callback) =>
|
|
5504
|
+
hmrCallbacks2.forEach((callback) => {
|
|
5505
|
+
callback();
|
|
5506
|
+
});
|
|
5288
5507
|
});
|
|
5289
5508
|
}
|
|
5290
5509
|
if (typeof window !== "undefined") {
|
|
@@ -5295,7 +5514,7 @@ function useVariables() {
|
|
|
5295
5514
|
const [loading, setLoading] = useState6(!cachedVariables);
|
|
5296
5515
|
const [error, setError] = useState6(null);
|
|
5297
5516
|
const callbackRef = useRef5(null);
|
|
5298
|
-
|
|
5517
|
+
useEffect5(() => {
|
|
5299
5518
|
const refreshCallback = async () => {
|
|
5300
5519
|
try {
|
|
5301
5520
|
const response = await fetch("/api/variables-status");
|
|
@@ -5365,6 +5584,7 @@ export {
|
|
|
5365
5584
|
ThemeProvider,
|
|
5366
5585
|
clearAllConfigCache,
|
|
5367
5586
|
clearBreakpointConfigCache,
|
|
5587
|
+
clearKnownTokensCache,
|
|
5368
5588
|
clearRemConversionConfigCache,
|
|
5369
5589
|
clearResponsiveScalesConfigCache,
|
|
5370
5590
|
createNavigationHandler,
|
|
@@ -5375,6 +5595,7 @@ export {
|
|
|
5375
5595
|
fetchI18nConfig,
|
|
5376
5596
|
getCachedBreakpointConfig,
|
|
5377
5597
|
getCachedFontFamilies,
|
|
5598
|
+
getCachedKnownTokens,
|
|
5378
5599
|
getCachedRemConversionConfig,
|
|
5379
5600
|
getCachedResponsiveScalesConfig,
|
|
5380
5601
|
getColorVariableSuggestions,
|
|
@@ -5395,6 +5616,7 @@ export {
|
|
|
5395
5616
|
isI18nConfigLoaded,
|
|
5396
5617
|
isLinkMapping,
|
|
5397
5618
|
isResponsiveStyle,
|
|
5619
|
+
loadKnownTokens,
|
|
5398
5620
|
mergeComponentStyles,
|
|
5399
5621
|
mergeStyles,
|
|
5400
5622
|
navigateTo,
|