meno-core 1.0.53 → 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.
Files changed (415) hide show
  1. package/.claude/settings.local.json +1 -3
  2. package/bin/cli.ts +66 -261
  3. package/build-astro.ts +150 -128
  4. package/dist/bin/cli.js +42 -185
  5. package/dist/bin/cli.js.map +2 -2
  6. package/dist/chunks/chunk-2AR55GYH.js +42 -0
  7. package/dist/chunks/chunk-2AR55GYH.js.map +7 -0
  8. package/dist/chunks/{chunk-JGWFTO6P.js → chunk-2IIQK7T3.js} +2624 -1389
  9. package/dist/chunks/chunk-2IIQK7T3.js.map +7 -0
  10. package/dist/chunks/chunk-4ZRU52J2.js +169 -0
  11. package/dist/chunks/chunk-4ZRU52J2.js.map +7 -0
  12. package/dist/chunks/{chunk-UB44F4Z2.js → chunk-5X4HCN7J.js} +5 -7
  13. package/dist/chunks/chunk-5X4HCN7J.js.map +7 -0
  14. package/dist/chunks/{chunk-WQFG7PAH.js → chunk-7CCVOL5M.js} +15 -19
  15. package/dist/chunks/chunk-7CCVOL5M.js.map +7 -0
  16. package/dist/chunks/{chunk-YBLHKYFF.js → chunk-AR7LHIFY.js} +8 -2
  17. package/dist/chunks/chunk-AR7LHIFY.js.map +7 -0
  18. package/dist/chunks/{chunk-O3NAGJP4.js → chunk-NUP7H7D3.js} +135 -41
  19. package/dist/chunks/chunk-NUP7H7D3.js.map +7 -0
  20. package/dist/chunks/{chunk-X754AHS5.js → chunk-QWTQZHG3.js} +194 -90
  21. package/dist/chunks/chunk-QWTQZHG3.js.map +7 -0
  22. package/dist/chunks/{chunk-H3GJ4H2U.js → chunk-XTKNX4FW.js} +216 -87
  23. package/dist/chunks/chunk-XTKNX4FW.js.map +7 -0
  24. package/dist/chunks/{fs-JGINUXGL.js → fs-G3ANWEFP.js} +2 -2
  25. package/dist/lib/client/index.js +1003 -475
  26. package/dist/lib/client/index.js.map +3 -3
  27. package/dist/lib/server/index.js +14393 -6371
  28. package/dist/lib/server/index.js.map +4 -4
  29. package/dist/lib/shared/index.js +342 -101
  30. package/dist/lib/shared/index.js.map +4 -4
  31. package/dist/lib/shared/richtext/index.js +1 -1
  32. package/dist/lib/test-utils/index.js +64 -80
  33. package/dist/lib/test-utils/index.js.map +2 -2
  34. package/entries/client-router.tsx +10 -8
  35. package/lib/client/ClientInitializer.ts +8 -8
  36. package/lib/client/ErrorBoundary.test.tsx +246 -186
  37. package/lib/client/ErrorBoundary.tsx +183 -132
  38. package/lib/client/componentRegistry.test.ts +96 -108
  39. package/lib/client/componentRegistry.ts +1 -3
  40. package/lib/client/contexts/ThemeContext.tsx +3 -2
  41. package/lib/client/core/ComponentBuilder.test.ts +663 -560
  42. package/lib/client/core/ComponentBuilder.ts +427 -155
  43. package/lib/client/core/ComponentRenderer.test.tsx +2 -4
  44. package/lib/client/core/ComponentRenderer.tsx +46 -33
  45. package/lib/client/core/builders/embedBuilder.ts +242 -54
  46. package/lib/client/core/builders/linkBuilder.ts +72 -45
  47. package/lib/client/core/builders/linkNodeBuilder.ts +79 -54
  48. package/lib/client/core/builders/listBuilder.ts +155 -89
  49. package/lib/client/core/builders/localeListBuilder.ts +97 -62
  50. package/lib/client/core/builders/types.ts +5 -5
  51. package/lib/client/core/cmsTemplateProcessor.ts +8 -9
  52. package/lib/client/elementRegistry.ts +3 -3
  53. package/lib/client/fontFamiliesService.test.ts +2 -10
  54. package/lib/client/fontFamiliesService.ts +3 -3
  55. package/lib/client/hmr/HMRManager.tsx +47 -30
  56. package/lib/client/hmrCssReload.ts +49 -14
  57. package/lib/client/hmrWebSocket.ts +14 -19
  58. package/lib/client/hooks/useColorVariables.test.ts +21 -21
  59. package/lib/client/hooks/useColorVariables.ts +23 -18
  60. package/lib/client/hooks/usePropertyAutocomplete.ts +4 -6
  61. package/lib/client/hooks/useVariables.ts +6 -4
  62. package/lib/client/hydration/HydrationUtils.test.ts +24 -25
  63. package/lib/client/hydration/HydrationUtils.ts +3 -4
  64. package/lib/client/i18nConfigService.test.ts +2 -7
  65. package/lib/client/i18nConfigService.ts +2 -2
  66. package/lib/client/meno-filter/MenoFilter.test.ts +47 -49
  67. package/lib/client/meno-filter/MenoFilter.ts +14 -15
  68. package/lib/client/meno-filter/bindings.ts +18 -43
  69. package/lib/client/meno-filter/init.ts +4 -4
  70. package/lib/client/meno-filter/renderer.ts +30 -32
  71. package/lib/client/meno-filter/script.generated.ts +1 -3
  72. package/lib/client/meno-filter/ui.ts +4 -6
  73. package/lib/client/meno-filter/updates.ts +18 -23
  74. package/lib/client/meno-filter/utils.ts +1 -1
  75. package/lib/client/navigation.test.ts +174 -178
  76. package/lib/client/navigation.ts +0 -1
  77. package/lib/client/responsiveStyleResolver.knownTokens.test.ts +71 -0
  78. package/lib/client/responsiveStyleResolver.test.ts +234 -232
  79. package/lib/client/responsiveStyleResolver.ts +74 -20
  80. package/lib/client/routing/RouteLoader.test.ts +24 -25
  81. package/lib/client/routing/RouteLoader.ts +27 -35
  82. package/lib/client/routing/Router.tsx +210 -153
  83. package/lib/client/scripts/ScriptExecutor.test.ts +157 -158
  84. package/lib/client/scripts/ScriptExecutor.ts +18 -36
  85. package/lib/client/services/PrefetchService.test.ts +3 -3
  86. package/lib/client/services/PrefetchService.ts +23 -29
  87. package/lib/client/styleProcessor.test.ts +9 -9
  88. package/lib/client/styleProcessor.ts +24 -15
  89. package/lib/client/styles/StyleInjector.test.ts +122 -115
  90. package/lib/client/styles/StyleInjector.ts +10 -7
  91. package/lib/client/styles/UtilityClassCollector.ts +62 -28
  92. package/lib/client/styles/cspNonce.test.ts +2 -5
  93. package/lib/client/templateEngine.test.ts +554 -488
  94. package/lib/client/templateEngine.ts +203 -73
  95. package/lib/client/theme.test.ts +1 -1
  96. package/lib/client/theme.ts +0 -1
  97. package/lib/client/utils/toast.ts +0 -1
  98. package/lib/server/__integration__/api-routes.test.ts +8 -4
  99. package/lib/server/__integration__/cms-integration.test.ts +1 -4
  100. package/lib/server/__integration__/server-lifecycle.test.ts +4 -5
  101. package/lib/server/__integration__/ssr-rendering.test.ts +47 -37
  102. package/lib/server/__integration__/static-assets.test.ts +3 -3
  103. package/lib/server/__integration__/test-helpers.ts +87 -74
  104. package/lib/server/ab/generateFunctions.ts +12 -10
  105. package/lib/server/astro/cmsPageEmitter.ts +26 -42
  106. package/lib/server/astro/componentEmitter.ts +35 -43
  107. package/lib/server/astro/cssCollector.ts +10 -26
  108. package/lib/server/astro/nodeToAstro.test.ts +1754 -34
  109. package/lib/server/astro/nodeToAstro.ts +232 -216
  110. package/lib/server/astro/normalizeOrphanTemplateProps.test.ts +115 -119
  111. package/lib/server/astro/normalizeOrphanTemplateProps.ts +11 -18
  112. package/lib/server/astro/pageEmitter.ts +9 -13
  113. package/lib/server/astro/tailwindMapper.test.ts +10 -37
  114. package/lib/server/astro/tailwindMapper.ts +33 -40
  115. package/lib/server/astro/templateTransformer.ts +17 -20
  116. package/lib/server/createServer.ts +7 -19
  117. package/lib/server/cssGenerator.test.ts +35 -44
  118. package/lib/server/cssGenerator.ts +8 -19
  119. package/lib/server/fileWatcher.test.ts +164 -13
  120. package/lib/server/fileWatcher.ts +209 -124
  121. package/lib/server/index.ts +14 -17
  122. package/lib/server/jsonLoader.test.ts +39 -2
  123. package/lib/server/jsonLoader.ts +39 -34
  124. package/lib/server/middleware/cors.test.ts +21 -21
  125. package/lib/server/middleware/cors.ts +28 -4
  126. package/lib/server/middleware/errorHandler.test.ts +7 -5
  127. package/lib/server/middleware/errorHandler.ts +3 -8
  128. package/lib/server/middleware/index.ts +0 -1
  129. package/lib/server/middleware/logger.test.ts +10 -8
  130. package/lib/server/middleware/logger.ts +17 -29
  131. package/lib/server/migrateTemplates.ts +3 -3
  132. package/lib/server/pageCache.test.ts +76 -77
  133. package/lib/server/pageCache.ts +0 -1
  134. package/lib/server/projectContext.ts +5 -4
  135. package/lib/server/providers/fileSystemCMSProvider.test.ts +142 -99
  136. package/lib/server/providers/fileSystemCMSProvider.ts +62 -38
  137. package/lib/server/routes/api/cms.test.ts +26 -14
  138. package/lib/server/routes/api/cms.ts +9 -14
  139. package/lib/server/routes/api/colors.test.ts +2 -2
  140. package/lib/server/routes/api/components.ts +31 -35
  141. package/lib/server/routes/api/config.ts +3 -4
  142. package/lib/server/routes/api/core-routes.ts +49 -76
  143. package/lib/server/routes/api/enums.test.ts +2 -2
  144. package/lib/server/routes/api/functions.ts +9 -17
  145. package/lib/server/routes/api/index.ts +3 -6
  146. package/lib/server/routes/api/pages.ts +8 -11
  147. package/lib/server/routes/api/shared.test.ts +1 -1
  148. package/lib/server/routes/api/shared.ts +12 -9
  149. package/lib/server/routes/api/variables.test.ts +3 -5
  150. package/lib/server/routes/api/variables.ts +1 -1
  151. package/lib/server/routes/index.ts +25 -28
  152. package/lib/server/routes/pages.ts +35 -31
  153. package/lib/server/routes/static.ts +17 -6
  154. package/lib/server/runtime/bundler.ts +98 -61
  155. package/lib/server/runtime/fs.ts +16 -26
  156. package/lib/server/runtime/httpServer.ts +8 -12
  157. package/lib/server/services/ColorService.test.ts +3 -3
  158. package/lib/server/services/ColorService.ts +37 -29
  159. package/lib/server/services/EnumService.test.ts +4 -8
  160. package/lib/server/services/EnumService.ts +11 -3
  161. package/lib/server/services/VariableService.test.ts +8 -12
  162. package/lib/server/services/VariableService.ts +11 -3
  163. package/lib/server/services/cmsService.test.ts +158 -120
  164. package/lib/server/services/cmsService.ts +36 -146
  165. package/lib/server/services/componentService.test.ts +125 -45
  166. package/lib/server/services/componentService.ts +70 -46
  167. package/lib/server/services/configService.test.ts +22 -45
  168. package/lib/server/services/configService.ts +50 -27
  169. package/lib/server/services/fileWatcherService.ts +42 -8
  170. package/lib/server/services/index.ts +0 -1
  171. package/lib/server/services/pageService.test.ts +8 -10
  172. package/lib/server/services/pageService.ts +32 -18
  173. package/lib/server/ssr/attributeBuilder.ts +18 -8
  174. package/lib/server/ssr/buildErrorOverlay.ts +11 -12
  175. package/lib/server/ssr/clientDataInjector.ts +7 -21
  176. package/lib/server/ssr/cmsSSRProcessor.ts +4 -8
  177. package/lib/server/ssr/cssCollector.ts +1 -1
  178. package/lib/server/ssr/errorOverlay.test.ts +1 -1
  179. package/lib/server/ssr/errorOverlay.ts +3 -9
  180. package/lib/server/ssr/htmlGenerator.nonce.test.ts +9 -14
  181. package/lib/server/ssr/htmlGenerator.test.ts +120 -44
  182. package/lib/server/ssr/htmlGenerator.ts +126 -91
  183. package/lib/server/ssr/imageMetadata.test.ts +3 -1
  184. package/lib/server/ssr/imageMetadata.ts +27 -21
  185. package/lib/server/ssr/jsCollector.test.ts +8 -18
  186. package/lib/server/ssr/jsCollector.ts +3 -8
  187. package/lib/server/ssr/liveReloadIntegration.test.ts +76 -36
  188. package/lib/server/ssr/metaTagGenerator.ts +2 -2
  189. package/lib/server/ssr/ssrRenderer.branches.test.ts +1103 -0
  190. package/lib/server/ssr/ssrRenderer.test.ts +316 -256
  191. package/lib/server/ssr/ssrRenderer.ts +795 -243
  192. package/lib/server/ssrRenderer.test.ts +1048 -954
  193. package/lib/server/utils/jsonLineMapper.test.ts +28 -28
  194. package/lib/server/utils/jsonLineMapper.ts +7 -7
  195. package/lib/server/validateStyleCoverage.ts +18 -21
  196. package/lib/server/websocketManager.ts +28 -19
  197. package/lib/shared/attributeNodeUtils.test.ts +15 -15
  198. package/lib/shared/attributeNodeUtils.ts +5 -12
  199. package/lib/shared/breakpoints.test.ts +5 -5
  200. package/lib/shared/breakpoints.ts +4 -11
  201. package/lib/shared/cmsQuery.test.ts +81 -0
  202. package/lib/shared/cmsQuery.ts +92 -0
  203. package/lib/shared/cmsQueryParser.test.ts +50 -42
  204. package/lib/shared/cmsQueryParser.ts +60 -38
  205. package/lib/shared/colorConversions.ts +9 -9
  206. package/lib/shared/colorVariableUtils.test.ts +27 -5
  207. package/lib/shared/colorVariableUtils.ts +21 -12
  208. package/lib/shared/componentRefs.ts +1 -5
  209. package/lib/shared/constants.test.ts +3 -3
  210. package/lib/shared/constants.ts +8 -8
  211. package/lib/shared/cssGeneration.test.ts +285 -144
  212. package/lib/shared/cssGeneration.ts +217 -531
  213. package/lib/shared/cssNamedColors.ts +152 -30
  214. package/lib/shared/cssProperties.test.ts +69 -70
  215. package/lib/shared/cssProperties.ts +298 -114
  216. package/lib/shared/elementClassName.test.ts +109 -109
  217. package/lib/shared/elementClassName.ts +3 -3
  218. package/lib/shared/elementUtils.ts +12 -16
  219. package/lib/shared/errorLogger.test.ts +12 -12
  220. package/lib/shared/errorLogger.ts +2 -10
  221. package/lib/shared/errors.test.ts +2 -13
  222. package/lib/shared/errors.ts +2 -8
  223. package/lib/shared/expressionEvaluator.test.ts +145 -0
  224. package/lib/shared/expressionEvaluator.ts +52 -24
  225. package/lib/shared/fontLoader.test.ts +32 -18
  226. package/lib/shared/fontLoader.ts +2 -2
  227. package/lib/shared/friendlyError.ts +2 -3
  228. package/lib/shared/gradientUtils.test.ts +3 -7
  229. package/lib/shared/gradientUtils.ts +17 -14
  230. package/lib/shared/hrefRefs.test.ts +2 -2
  231. package/lib/shared/hrefRefs.ts +2 -10
  232. package/lib/shared/i18n.test.ts +4 -4
  233. package/lib/shared/i18n.ts +18 -38
  234. package/lib/shared/index.ts +27 -0
  235. package/lib/shared/inlineSvgStyleRules.ts +14 -13
  236. package/lib/shared/interactiveStyleMappings.test.ts +32 -54
  237. package/lib/shared/interactiveStyleMappings.ts +11 -24
  238. package/lib/shared/interactiveStyles.test.ts +165 -188
  239. package/lib/shared/interfaces/contentProvider.ts +1 -1
  240. package/lib/shared/itemTemplateUtils.test.ts +11 -17
  241. package/lib/shared/itemTemplateUtils.ts +27 -39
  242. package/lib/shared/jsonRepair.ts +16 -10
  243. package/lib/shared/libraryLoader.test.ts +21 -55
  244. package/lib/shared/libraryLoader.ts +7 -22
  245. package/lib/shared/linkUtils.ts +1 -1
  246. package/lib/shared/logger.test.ts +66 -0
  247. package/lib/shared/logger.ts +94 -0
  248. package/lib/shared/markdown.ts +25 -0
  249. package/lib/shared/netlifyLocale404.test.ts +179 -0
  250. package/lib/shared/netlifyLocale404.ts +110 -0
  251. package/lib/shared/nodeUtils.test.ts +28 -16
  252. package/lib/shared/nodeUtils.ts +76 -23
  253. package/lib/shared/pathArrayUtils.test.ts +1 -2
  254. package/lib/shared/pathArrayUtils.ts +1 -1
  255. package/lib/shared/pathSecurity.ts +2 -2
  256. package/lib/shared/pathUtils.test.ts +4 -6
  257. package/lib/shared/pathUtils.ts +42 -49
  258. package/lib/shared/paths/Path.test.ts +2 -2
  259. package/lib/shared/paths/Path.ts +0 -1
  260. package/lib/shared/paths/PathConverter.test.ts +1 -1
  261. package/lib/shared/paths/PathConverter.ts +17 -20
  262. package/lib/shared/paths/PathUtils.ts +13 -13
  263. package/lib/shared/paths/PathValidator.test.ts +2 -15
  264. package/lib/shared/paths/PathValidator.ts +12 -10
  265. package/lib/shared/paths/index.ts +1 -2
  266. package/lib/shared/permissions.test.ts +168 -0
  267. package/lib/shared/permissions.ts +162 -0
  268. package/lib/shared/propResolver.test.ts +240 -244
  269. package/lib/shared/propResolver.ts +15 -26
  270. package/lib/shared/pxToRem.test.ts +7 -6
  271. package/lib/shared/pxToRem.ts +2 -5
  272. package/lib/shared/registry/BaseNodeTypeRegistry.test.ts +12 -6
  273. package/lib/shared/registry/ClientRegistry.ts +0 -2
  274. package/lib/shared/registry/ComponentRegistry.test.ts +46 -32
  275. package/lib/shared/registry/ComponentRegistry.ts +12 -9
  276. package/lib/shared/registry/NodeTypeDefinition.ts +16 -9
  277. package/lib/shared/registry/RegistryManager.ts +1 -2
  278. package/lib/shared/registry/SSRRegistry.ts +0 -2
  279. package/lib/shared/registry/createNodeType.ts +7 -9
  280. package/lib/shared/registry/defineNodeType.ts +2 -6
  281. package/lib/shared/registry/fieldPresets.ts +3 -1
  282. package/lib/shared/registry/index.ts +0 -1
  283. package/lib/shared/registry/nodeTypes/ComponentInstanceNodeType.ts +14 -15
  284. package/lib/shared/registry/nodeTypes/CustomNodeType.ts +103 -0
  285. package/lib/shared/registry/nodeTypes/EmbedNodeType.ts +18 -11
  286. package/lib/shared/registry/nodeTypes/HtmlNodeType.ts +48 -19
  287. package/lib/shared/registry/nodeTypes/IslandNodeType.ts +129 -0
  288. package/lib/shared/registry/nodeTypes/LinkNodeType.ts +21 -19
  289. package/lib/shared/registry/nodeTypes/ListNodeType.ts +117 -77
  290. package/lib/shared/registry/nodeTypes/LocaleListNodeType.ts +27 -21
  291. package/lib/shared/registry/nodeTypes/MarkdownNodeType.ts +78 -0
  292. package/lib/shared/registry/nodeTypes/SlotMarkerType.ts +12 -8
  293. package/lib/shared/registry/nodeTypes/index.ts +26 -3
  294. package/lib/shared/responsiveScaling.test.ts +16 -34
  295. package/lib/shared/responsiveScaling.ts +61 -42
  296. package/lib/shared/responsiveStyleUtils.test.ts +0 -1
  297. package/lib/shared/responsiveStyleUtils.ts +11 -13
  298. package/lib/shared/richtext/htmlToTiptap.test.ts +139 -130
  299. package/lib/shared/richtext/htmlToTiptap.ts +2 -4
  300. package/lib/shared/richtext/tiptapToHtml.test.ts +5 -6
  301. package/lib/shared/richtext/types.ts +1 -8
  302. package/lib/shared/slugTranslator.test.ts +13 -13
  303. package/lib/shared/slugTranslator.ts +12 -16
  304. package/lib/shared/slugify.ts +9 -15
  305. package/lib/shared/styleNodeUtils.test.ts +8 -8
  306. package/lib/shared/styleNodeUtils.ts +18 -20
  307. package/lib/shared/styleUtils.test.ts +87 -61
  308. package/lib/shared/styleUtils.ts +5 -6
  309. package/lib/shared/themeDefaults.test.ts +11 -14
  310. package/lib/shared/themeDefaults.ts +3 -4
  311. package/lib/shared/tree/PathBuilder.test.ts +63 -145
  312. package/lib/shared/tree/PathBuilder.ts +59 -47
  313. package/lib/shared/treePathUtils.test.ts +51 -12
  314. package/lib/shared/treePathUtils.ts +91 -60
  315. package/lib/shared/types/api.ts +105 -8
  316. package/lib/shared/types/cms.test.ts +34 -0
  317. package/lib/shared/types/cms.ts +90 -34
  318. package/lib/shared/types/comment.ts +49 -16
  319. package/lib/shared/types/components.ts +51 -25
  320. package/lib/shared/types/errors.test.ts +1 -6
  321. package/lib/shared/types/errors.ts +3 -7
  322. package/lib/shared/types/experiments.ts +28 -28
  323. package/lib/shared/types/index.ts +25 -2
  324. package/lib/shared/types/permissions.ts +139 -0
  325. package/lib/shared/types/styles.ts +0 -1
  326. package/lib/shared/types/variables.test.ts +4 -13
  327. package/lib/shared/types/variables.ts +51 -30
  328. package/lib/shared/types.ts +1 -2
  329. package/lib/shared/utilityClassConfig.ts +751 -321
  330. package/lib/shared/utilityClassMapper.durability.test.ts +117 -0
  331. package/lib/shared/utilityClassMapper.test.ts +433 -95
  332. package/lib/shared/utilityClassMapper.ts +322 -249
  333. package/lib/shared/utilityClassNames.test.ts +38 -0
  334. package/lib/shared/utilityClassNames.ts +458 -0
  335. package/lib/shared/utils.test.ts +2 -10
  336. package/lib/shared/utils.ts +19 -10
  337. package/lib/shared/validation/cmsValidators.ts +2 -1
  338. package/lib/shared/validation/commentValidators.test.ts +53 -0
  339. package/lib/shared/validation/commentValidators.ts +12 -1
  340. package/lib/shared/validation/index.ts +1 -0
  341. package/lib/shared/validation/permissionsValidators.test.ts +49 -0
  342. package/lib/shared/validation/permissionsValidators.ts +49 -0
  343. package/lib/shared/validation/propValidator.test.ts +19 -21
  344. package/lib/shared/validation/propValidator.ts +13 -18
  345. package/lib/shared/validation/schemas.test.ts +64 -32
  346. package/lib/shared/validation/schemas.ts +616 -345
  347. package/lib/shared/validation/validators.test.ts +3 -8
  348. package/lib/shared/validation/validators.ts +89 -68
  349. package/lib/shared/viewportUnits.integration.test.ts +14 -10
  350. package/lib/shared/viewportUnits.test.ts +24 -23
  351. package/lib/shared/viewportUnits.ts +12 -5
  352. package/lib/test-utils/dom-setup.ts +1 -1
  353. package/lib/test-utils/factories/ConsoleMockFactory.ts +10 -14
  354. package/lib/test-utils/factories/DomMockFactory.ts +17 -23
  355. package/lib/test-utils/factories/EventMockFactory.ts +7 -13
  356. package/lib/test-utils/factories/FetchMockFactory.ts +39 -57
  357. package/lib/test-utils/factories/ServerMockFactory.ts +6 -10
  358. package/lib/test-utils/factories/StoreMockFactory.ts +18 -29
  359. package/lib/test-utils/fixtures.ts +45 -45
  360. package/lib/test-utils/helpers/asyncHelpers.test.ts +15 -18
  361. package/lib/test-utils/helpers/asyncHelpers.ts +11 -20
  362. package/lib/test-utils/helpers.ts +1 -5
  363. package/lib/test-utils/index.ts +0 -4
  364. package/lib/test-utils/mockFactories.ts +13 -19
  365. package/lib/test-utils/mocks.ts +6 -4
  366. package/package.json +3 -5
  367. package/scripts/build-for-publish.mjs +2 -4
  368. package/scripts/build-meno-filter.ts +4 -7
  369. package/tsconfig.json +1 -0
  370. package/vite.config.ts +4 -4
  371. package/build-next.ts +0 -1361
  372. package/build-static.test.ts +0 -424
  373. package/build-static.ts +0 -1074
  374. package/dist/build-static.js +0 -36
  375. package/dist/chunks/chunk-2MHDV5BF.js +0 -251
  376. package/dist/chunks/chunk-2MHDV5BF.js.map +0 -7
  377. package/dist/chunks/chunk-AZQYF6KE.js +0 -559
  378. package/dist/chunks/chunk-AZQYF6KE.js.map +0 -7
  379. package/dist/chunks/chunk-GZHGVVW3.js +0 -322
  380. package/dist/chunks/chunk-GZHGVVW3.js.map +0 -7
  381. package/dist/chunks/chunk-H3GJ4H2U.js.map +0 -7
  382. package/dist/chunks/chunk-I7YIGZXT.js +0 -467
  383. package/dist/chunks/chunk-I7YIGZXT.js.map +0 -7
  384. package/dist/chunks/chunk-IGYR22T6.js +0 -6192
  385. package/dist/chunks/chunk-IGYR22T6.js.map +0 -7
  386. package/dist/chunks/chunk-JGP5A3Y5.js +0 -1136
  387. package/dist/chunks/chunk-JGP5A3Y5.js.map +0 -7
  388. package/dist/chunks/chunk-JGWFTO6P.js.map +0 -7
  389. package/dist/chunks/chunk-O3NAGJP4.js.map +0 -7
  390. package/dist/chunks/chunk-QB2LNO4W.js +0 -77
  391. package/dist/chunks/chunk-QB2LNO4W.js.map +0 -7
  392. package/dist/chunks/chunk-R6XHAFBF.js +0 -3821
  393. package/dist/chunks/chunk-R6XHAFBF.js.map +0 -7
  394. package/dist/chunks/chunk-UB44F4Z2.js.map +0 -7
  395. package/dist/chunks/chunk-WQFG7PAH.js.map +0 -7
  396. package/dist/chunks/chunk-X754AHS5.js.map +0 -7
  397. package/dist/chunks/chunk-YBLHKYFF.js.map +0 -7
  398. package/dist/chunks/configService-R3OGU2UD.js +0 -13
  399. package/dist/chunks/configService-R3OGU2UD.js.map +0 -7
  400. package/dist/chunks/constants-STK2YBIW.js +0 -46
  401. package/dist/chunks/constants-STK2YBIW.js.map +0 -7
  402. package/dist/chunks/fs-JGINUXGL.js.map +0 -7
  403. package/dist/entries/server-router.js +0 -67
  404. package/dist/entries/server-router.js.map +0 -7
  405. package/entries/server-router.tsx +0 -81
  406. package/lib/server/providers/fileSystemPageProvider.ts +0 -160
  407. package/lib/server/webflow/buildWebflow.ts +0 -635
  408. package/lib/server/webflow/index.ts +0 -23
  409. package/lib/server/webflow/nodeToWebflow.test.ts +0 -3170
  410. package/lib/server/webflow/nodeToWebflow.ts +0 -2435
  411. package/lib/server/webflow/styleMapper.test.ts +0 -389
  412. package/lib/server/webflow/styleMapper.ts +0 -695
  413. package/lib/server/webflow/templateWrapper.ts +0 -49
  414. package/lib/server/webflow/types.ts +0 -396
  415. /package/dist/{build-static.js.map → chunks/fs-G3ANWEFP.js.map} +0 -0
@@ -13,15 +13,17 @@ import {
13
13
  resolveLinkMapping,
14
14
  resolveStyleMapping,
15
15
  skipEmptyTemplateAttributes
16
- } from "../../chunks/chunk-O3NAGJP4.js";
16
+ } from "../../chunks/chunk-NUP7H7D3.js";
17
17
  import {
18
- filterCSSProperties,
19
- logNetworkError,
20
- logRuntimeError
21
- } from "../../chunks/chunk-H3GJ4H2U.js";
18
+ filterCSSProperties
19
+ } from "../../chunks/chunk-XTKNX4FW.js";
22
20
  import {
23
21
  BaseComponentRegistry,
22
+ DEFAULT_BREAKPOINTS,
24
23
  DEFAULT_PREFETCH_CONFIG,
24
+ DEFAULT_REM_CONFIG,
25
+ DEFAULT_RESPONSIVE_SCALES,
26
+ breakpointClassPrefixes,
25
27
  buildTemplateContext,
26
28
  extractInteractiveStyleMappings,
27
29
  extractNodeProperties,
@@ -29,6 +31,7 @@ import {
29
31
  generateElementClassName,
30
32
  generateRuleForClass,
31
33
  generateSingleClassCSS,
34
+ getBreakpointValues,
32
35
  getChildPath,
33
36
  getNestedValue,
34
37
  hasChildren,
@@ -36,10 +39,13 @@ import {
36
39
  hasInteractiveStyleMappings,
37
40
  hasItemTemplates,
38
41
  init_ComponentRegistry,
42
+ init_errorLogger,
39
43
  isBooleanMapping,
40
44
  isComponentNode,
41
45
  isCurrentLink,
46
+ isCustomNode,
42
47
  isEmbedNode,
48
+ isIslandNode,
43
49
  isItemDraftForLocale,
44
50
  isLinkNode,
45
51
  isListNode,
@@ -47,8 +53,12 @@ import {
47
53
  isResponsiveStyle,
48
54
  isSlotContent,
49
55
  isSlotMarker,
56
+ isValidNodeType,
57
+ logNetworkError,
58
+ logRuntimeError,
50
59
  markAsSlotContent,
51
60
  mergeResponsiveStyles,
61
+ normalizeBreakpointConfig,
52
62
  pathToString,
53
63
  processItemPropsTemplate,
54
64
  processItemTemplate,
@@ -62,24 +72,19 @@ import {
62
72
  sortClassesByPropertyOrder,
63
73
  toFriendlyError,
64
74
  validatePageData
65
- } from "../../chunks/chunk-JGWFTO6P.js";
75
+ } from "../../chunks/chunk-2IIQK7T3.js";
66
76
  import {
67
- DEFAULT_BREAKPOINTS,
68
77
  DEFAULT_I18N_CONFIG,
69
- DEFAULT_REM_CONFIG,
70
- DEFAULT_RESPONSIVE_SCALES,
71
- getBreakpointValues,
72
78
  isI18nValue,
73
79
  migrateI18nConfig,
74
- normalizeBreakpointConfig,
75
80
  parseLocaleFromPath,
76
81
  resolveI18nValue,
77
82
  setStoredLocale
78
- } from "../../chunks/chunk-AZQYF6KE.js";
83
+ } from "../../chunks/chunk-4ZRU52J2.js";
79
84
  import {
80
85
  isTiptapDocument,
81
86
  tiptapToHtml
82
- } from "../../chunks/chunk-UB44F4Z2.js";
87
+ } from "../../chunks/chunk-5X4HCN7J.js";
83
88
  import {
84
89
  API_ROUTES,
85
90
  IFRAME_MESSAGE_TYPES,
@@ -87,7 +92,7 @@ import {
87
92
  NOT_FOUND_TIMEOUT_MS,
88
93
  RAW_HTML_PREFIX,
89
94
  init_constants
90
- } from "../../chunks/chunk-YBLHKYFF.js";
95
+ } from "../../chunks/chunk-AR7LHIFY.js";
91
96
  import "../../chunks/chunk-KSBZ2L7C.js";
92
97
 
93
98
  // lib/client/core/ComponentBuilder.ts
@@ -113,11 +118,7 @@ var ErrorBoundary = class extends Component {
113
118
  }
114
119
  componentDidCatch(error, errorInfo) {
115
120
  const { onError, componentName, level = "component" } = this.props;
116
- console.error(
117
- `\u274C [${level.toUpperCase()} ERROR]${componentName ? ` in ${componentName}` : ""}:`,
118
- error,
119
- errorInfo
120
- );
121
+ console.error(`\u274C [${level.toUpperCase()} ERROR]${componentName ? ` in ${componentName}` : ""}:`, error, errorInfo);
121
122
  if (onError) {
122
123
  onError(error, errorInfo);
123
124
  }
@@ -156,77 +157,101 @@ var ErrorBoundary = class extends Component {
156
157
  padding: "24px"
157
158
  }
158
159
  },
159
- h("h2", {
160
- style: {
161
- margin: "0 0 16px 0",
162
- color: "#c00",
163
- fontSize: "24px",
164
- fontWeight: "600"
165
- }
166
- }, `\u26A0\uFE0F ${friendly.title}`),
167
- h("p", {
168
- style: {
169
- margin: "0 0 16px 0",
170
- color: "#666",
171
- fontSize: "16px",
172
- lineHeight: "1.5"
173
- }
174
- }, friendlyHint ? `${friendlyMessage} ${friendlyHint}` : friendlyMessage),
175
160
  h(
176
- "details",
161
+ "h2",
177
162
  {
178
163
  style: {
179
- marginTop: "16px",
180
- fontSize: "14px"
164
+ margin: "0 0 16px 0",
165
+ color: "#c00",
166
+ fontSize: "24px",
167
+ fontWeight: "600"
181
168
  }
182
169
  },
183
- h("summary", {
170
+ `\u26A0\uFE0F ${friendly.title}`
171
+ ),
172
+ h(
173
+ "p",
174
+ {
184
175
  style: {
185
- cursor: "pointer",
176
+ margin: "0 0 16px 0",
186
177
  color: "#666",
187
- fontWeight: "600",
188
- marginBottom: "8px"
178
+ fontSize: "16px",
179
+ lineHeight: "1.5"
189
180
  }
190
- }, "Technical details"),
191
- h("div", {
181
+ },
182
+ friendlyHint ? `${friendlyMessage} ${friendlyHint}` : friendlyMessage
183
+ ),
184
+ h(
185
+ "details",
186
+ {
192
187
  style: {
193
- background: "#fff",
194
- border: "1px solid #ddd",
195
- borderRadius: "4px",
196
- padding: "16px",
197
- margin: "8px 0",
198
- fontFamily: "monospace",
199
- fontSize: "14px",
200
- color: "#c00",
201
- overflowX: "auto"
188
+ marginTop: "16px",
189
+ fontSize: "14px"
202
190
  }
203
- }, error.message),
204
- process.env.NODE_ENV === "development" && errorInfo?.componentStack && h("pre", {
191
+ },
192
+ h(
193
+ "summary",
194
+ {
195
+ style: {
196
+ cursor: "pointer",
197
+ color: "#666",
198
+ fontWeight: "600",
199
+ marginBottom: "8px"
200
+ }
201
+ },
202
+ "Technical details"
203
+ ),
204
+ h(
205
+ "div",
206
+ {
207
+ style: {
208
+ background: "#fff",
209
+ border: "1px solid #ddd",
210
+ borderRadius: "4px",
211
+ padding: "16px",
212
+ margin: "8px 0",
213
+ fontFamily: "monospace",
214
+ fontSize: "14px",
215
+ color: "#c00",
216
+ overflowX: "auto"
217
+ }
218
+ },
219
+ error.message
220
+ ),
221
+ process.env.NODE_ENV === "development" && errorInfo?.componentStack && h(
222
+ "pre",
223
+ {
224
+ style: {
225
+ background: "#f5f5f5",
226
+ border: "1px solid #ddd",
227
+ borderRadius: "4px",
228
+ padding: "12px",
229
+ fontSize: "12px",
230
+ overflowX: "auto",
231
+ color: "#333"
232
+ }
233
+ },
234
+ errorInfo.componentStack
235
+ )
236
+ ),
237
+ h(
238
+ "button",
239
+ {
240
+ onClick: () => window.location.reload(),
205
241
  style: {
206
- background: "#f5f5f5",
207
- border: "1px solid #ddd",
242
+ marginTop: "16px",
243
+ padding: "10px 20px",
244
+ background: "#007acc",
245
+ color: "#fff",
246
+ border: "none",
208
247
  borderRadius: "4px",
209
- padding: "12px",
210
- fontSize: "12px",
211
- overflowX: "auto",
212
- color: "#333"
248
+ fontSize: "14px",
249
+ fontWeight: "600",
250
+ cursor: "pointer"
213
251
  }
214
- }, errorInfo.componentStack)
215
- ),
216
- h("button", {
217
- onClick: () => window.location.reload(),
218
- style: {
219
- marginTop: "16px",
220
- padding: "10px 20px",
221
- background: "#007acc",
222
- color: "#fff",
223
- border: "none",
224
- borderRadius: "4px",
225
- fontSize: "14px",
226
- fontWeight: "600",
227
- cursor: "pointer"
228
- }
229
- }, "\u{1F504} Reload Page")
252
+ },
253
+ "\u{1F504} Reload Page"
254
+ )
230
255
  )
231
256
  );
232
257
  }
@@ -252,37 +277,53 @@ var ErrorBoundary = class extends Component {
252
277
  marginBottom: "8px"
253
278
  }
254
279
  },
255
- h("span", {
280
+ h(
281
+ "span",
282
+ {
283
+ style: {
284
+ fontSize: "18px"
285
+ }
286
+ },
287
+ "\u26A0\uFE0F"
288
+ ),
289
+ h(
290
+ "strong",
291
+ {
292
+ style: {
293
+ color: "#c00",
294
+ fontSize: "14px"
295
+ }
296
+ },
297
+ `${friendly.title}${componentName ? ` (${componentName})` : ""}`
298
+ )
299
+ ),
300
+ h(
301
+ "div",
302
+ {
256
303
  style: {
257
- fontSize: "18px"
304
+ fontSize: "13px",
305
+ color: "#666",
306
+ lineHeight: "1.5"
258
307
  }
259
- }, "\u26A0\uFE0F"),
260
- h("strong", {
308
+ },
309
+ friendlyHint ? `${friendlyMessage} ${friendlyHint}` : friendlyMessage
310
+ ),
311
+ process.env.NODE_ENV === "development" && h(
312
+ "div",
313
+ {
261
314
  style: {
262
- color: "#c00",
263
- fontSize: "14px"
315
+ marginTop: "8px",
316
+ fontSize: "12px",
317
+ color: "#666",
318
+ fontFamily: "monospace",
319
+ background: "#fff",
320
+ padding: "8px",
321
+ borderRadius: "4px",
322
+ border: "1px solid #fcc"
264
323
  }
265
- }, `${friendly.title}${componentName ? ` (${componentName})` : ""}`)
266
- ),
267
- h("div", {
268
- style: {
269
- fontSize: "13px",
270
- color: "#666",
271
- lineHeight: "1.5"
272
- }
273
- }, friendlyHint ? `${friendlyMessage} ${friendlyHint}` : friendlyMessage),
274
- process.env.NODE_ENV === "development" && h("div", {
275
- style: {
276
- marginTop: "8px",
277
- fontSize: "12px",
278
- color: "#666",
279
- fontFamily: "monospace",
280
- background: "#fff",
281
- padding: "8px",
282
- borderRadius: "4px",
283
- border: "1px solid #fcc"
284
- }
285
- }, error.message)
324
+ },
325
+ error.message
326
+ )
286
327
  );
287
328
  }
288
329
  return children;
@@ -364,18 +405,18 @@ var InteractiveStylesRegistry = new InteractiveStylesRegistryImpl();
364
405
 
365
406
  // lib/client/responsiveStyleResolver.ts
366
407
  var breakpointConfig = null;
367
- var breakpointPromise = null;
408
+ var _breakpointPromise = null;
368
409
  var responsiveScalesConfig = null;
369
- var responsiveScalesPromise = null;
410
+ var _responsiveScalesPromise = null;
370
411
  var remConversionConfig = null;
371
412
  var configPromise = null;
372
413
  function clearBreakpointConfigCache() {
373
414
  breakpointConfig = null;
374
- breakpointPromise = null;
415
+ _breakpointPromise = null;
375
416
  }
376
417
  function clearResponsiveScalesConfigCache() {
377
418
  responsiveScalesConfig = null;
378
- responsiveScalesPromise = null;
419
+ _responsiveScalesPromise = null;
379
420
  }
380
421
  function clearRemConversionConfigCache() {
381
422
  remConversionConfig = null;
@@ -384,6 +425,7 @@ function clearAllConfigCache() {
384
425
  clearBreakpointConfigCache();
385
426
  clearResponsiveScalesConfigCache();
386
427
  clearRemConversionConfigCache();
428
+ clearKnownTokensCache();
387
429
  configPromise = null;
388
430
  }
389
431
  function getCachedBreakpointConfig() {
@@ -395,6 +437,46 @@ function getCachedResponsiveScalesConfig() {
395
437
  function getCachedRemConversionConfig() {
396
438
  return remConversionConfig;
397
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
+ }
398
480
  async function loadConfig() {
399
481
  if (breakpointConfig && responsiveScalesConfig && remConversionConfig) {
400
482
  return;
@@ -509,37 +591,37 @@ function buildResponsivePrefixMap(breakpoints) {
509
591
  const breakpointValues = getBreakpointValues(breakpoints);
510
592
  const map = {};
511
593
  for (const [breakpointName, breakpointValue] of Object.entries(breakpointValues)) {
512
- let prefix = breakpointName.charAt(0).toLowerCase();
513
- if (breakpointName.toLowerCase() === "mobile") {
514
- prefix = "mob";
594
+ for (const prefix of breakpointClassPrefixes(breakpointName)) {
595
+ map[prefix] = breakpointValue;
515
596
  }
516
- map[prefix] = breakpointValue;
517
597
  }
518
598
  return map;
519
599
  }
520
- function getClassBreakpointValue(className, prefixMap) {
521
- for (const prefix of Object.keys(prefixMap)) {
522
- if (className.startsWith(`${prefix}-`) && className.length > prefix.length + 1) {
523
- const potentialClass = className.substring(prefix.length + 1);
524
- const rule = generateRuleForClass(potentialClass);
525
- if (rule && !potentialClass.match(/^(auto|0|[\d.]+px|[\d.]+p)$/)) {
526
- return prefixMap[prefix];
600
+ function getClassBreakpointValue(className, prefixMap, knownTokens2) {
601
+ for (const [prefix, prefixValue] of Object.entries(prefixMap)) {
602
+ if (className.startsWith(prefix) && className.length > prefix.length) {
603
+ const potentialClass = className.substring(prefix.length);
604
+ const rule = generateRuleForClass(potentialClass, knownTokens2);
605
+ if (rule) {
606
+ return prefixValue;
527
607
  }
528
608
  }
529
609
  }
530
610
  return 0;
531
611
  }
532
- function sortClassesWithBreakpointOrder(classes, breakpoints) {
612
+ function sortClassesWithBreakpointOrder(classes, breakpoints, knownTokens2) {
533
613
  const prefixMap = buildResponsivePrefixMap(breakpoints);
534
614
  const arr = Array.from(classes);
535
615
  const keys = arr.map((cls) => {
536
- const bpValue = getClassBreakpointValue(cls, prefixMap);
616
+ const bpValue = getClassBreakpointValue(cls, prefixMap, knownTokens2);
537
617
  return { cls, isResponsive: bpValue > 0 ? 1 : 0, bpValue };
538
618
  });
539
619
  const propertySorted = sortClassesByPropertyOrder(arr);
540
620
  const propertyOrderIndex = /* @__PURE__ */ new Map();
541
621
  for (let i = 0; i < propertySorted.length; i++) {
542
- propertyOrderIndex.set(propertySorted[i], i);
622
+ const cls = propertySorted[i];
623
+ if (cls === void 0) continue;
624
+ propertyOrderIndex.set(cls, i);
543
625
  }
544
626
  keys.sort((a, b) => {
545
627
  if (a.isResponsive !== b.isResponsive) return a.isResponsive - b.isResponsive;
@@ -554,13 +636,15 @@ var UtilityClassCollectorImpl = class {
554
636
  injectedRules = /* @__PURE__ */ new Map();
555
637
  /** Cached reference to <style id="utility-css"> */
556
638
  styleEl = null;
639
+ /** Guards a single async warm of the known-token set (see collect()). */
640
+ knownTokensPending = false;
557
641
  /**
558
642
  * Ensure we have a valid reference to the utility-css style element.
559
643
  * Returns null during SSR (no document).
560
644
  */
561
645
  ensureStyleElement() {
562
646
  if (typeof document === "undefined") return null;
563
- if (this.styleEl && this.styleEl.isConnected) {
647
+ if (this.styleEl?.isConnected) {
564
648
  return this.styleEl;
565
649
  }
566
650
  this.styleEl = document.getElementById("utility-css");
@@ -586,23 +670,38 @@ var UtilityClassCollectorImpl = class {
586
670
  const breakpointConfig2 = getCachedBreakpointConfig() || DEFAULT_BREAKPOINTS;
587
671
  const responsiveScalesConfig2 = getCachedResponsiveScalesConfig() || DEFAULT_RESPONSIVE_SCALES;
588
672
  const remConversionConfig2 = getCachedRemConversionConfig() || void 0;
673
+ const knownTokens2 = getCachedKnownTokens() ?? void 0;
589
674
  let hasNew = false;
590
675
  for (const name of classNames) {
591
676
  this.classes.add(name);
592
677
  if (this.injectedRules.has(name)) continue;
593
- const css = generateSingleClassCSS(name, breakpointConfig2, responsiveScalesConfig2, remConversionConfig2);
678
+ const css = generateSingleClassCSS(
679
+ name,
680
+ breakpointConfig2,
681
+ responsiveScalesConfig2,
682
+ remConversionConfig2,
683
+ knownTokens2
684
+ );
594
685
  if (css) {
595
686
  this.injectedRules.set(name, rewriteViewportUnits(css));
596
687
  hasNew = true;
597
688
  }
598
689
  }
599
690
  if (hasNew) {
600
- const sorted = sortClassesWithBreakpointOrder(this.injectedRules.keys(), breakpointConfig2);
691
+ const sorted = sortClassesWithBreakpointOrder(this.injectedRules.keys(), breakpointConfig2, knownTokens2);
601
692
  const styleEl = this.ensureStyleElement();
602
693
  if (styleEl) {
603
694
  styleEl.textContent = sorted.map((name) => this.injectedRules.get(name)).join("\n");
604
695
  }
605
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
+ }
606
705
  }
607
706
  /**
608
707
  * Clear collected classes for route change.
@@ -619,7 +718,8 @@ var UtilityClassCollectorImpl = class {
619
718
  destroy() {
620
719
  this.classes.clear();
621
720
  this.injectedRules.clear();
622
- if (this.styleEl && this.styleEl.isConnected) {
721
+ this.knownTokensPending = false;
722
+ if (this.styleEl?.isConnected) {
623
723
  this.styleEl.remove();
624
724
  }
625
725
  this.styleEl = null;
@@ -698,7 +798,7 @@ function resolveI18nValue2(value, locale, config) {
698
798
  function processCMSTemplate(template, cmsItem, locale) {
699
799
  const config = getI18nConfig();
700
800
  const effectiveLocale = locale || config.defaultLocale;
701
- return template.replace(/\{\{cms\.([^}]+)\}\}/g, (match, fieldPath) => {
801
+ return template.replace(/\{\{cms\.([^}]+)\}\}/g, (_match, fieldPath) => {
702
802
  const parts = fieldPath.trim().split(".");
703
803
  let value = cmsItem;
704
804
  for (const part of parts) {
@@ -744,8 +844,193 @@ function hasCMSTemplate(text) {
744
844
  import { createElement as h2 } from "react";
745
845
  import DOMPurify from "isomorphic-dompurify";
746
846
  var SANITIZE_CONFIG = {
747
- ALLOWED_TAGS: ["svg", "path", "circle", "rect", "line", "polyline", "polygon", "g", "text", "tspan", "image", "defs", "use", "linearGradient", "radialGradient", "stop", "clipPath", "mask", "pattern", "marker", "symbol", "a", "div", "span", "p", "br", "button", "img", "iframe", "video", "audio", "source", "canvas", "b", "i", "u", "strong", "em", "sub", "sup", "mark", "s", "small", "del", "ins", "q", "abbr", "code", "pre", "blockquote", "ul", "ol", "li", "h1", "h2", "h3", "h4", "h5", "h6", "style", "animate", "animateTransform", "animateMotion", "set", "filter", "feGaussianBlur", "feOffset", "feMerge", "feMergeNode", "feColorMatrix", "feComposite", "feFlood", "feMorphology", "feBlend", "feDropShadow", "feTurbulence", "feDisplacementMap", "foreignObject"],
748
- ALLOWED_ATTR: ["class", "id", "style", "width", "height", "viewBox", "xmlns", "xmlns:xlink", "xlink:href", "fill", "stroke", "stroke-width", "stroke-linecap", "stroke-linejoin", "stroke-dasharray", "stroke-dashoffset", "d", "cx", "cy", "r", "x", "y", "x1", "y1", "x2", "y2", "points", "href", "src", "alt", "target", "rel", "data-*", "aria-*", "transform", "opacity", "fill-opacity", "fill-rule", "clip-rule", "clip-path", "clipPathUnits", "mask", "mask-type", "maskUnits", "maskContentUnits", "patternUnits", "patternContentUnits", "patternTransform", "gradientUnits", "gradientTransform", "spreadMethod", "preserveAspectRatio", "marker-start", "marker-mid", "marker-end", "markerUnits", "markerWidth", "markerHeight", "refX", "refY", "orient", "paint-order", "vector-effect", "filter", "filterUnits", "primitiveUnits", "in", "in2", "result", "stdDeviation", "flood-color", "flood-opacity", "stroke-opacity", "font-size", "font-family", "font-weight", "font-style", "text-anchor", "dominant-baseline", "offset", "stop-color", "stop-opacity", "frameborder", "allowfullscreen", "allow", "title", "attributeName", "values", "dur", "begin", "end", "repeatCount", "repeatDur", "keyTimes", "keySplines", "calcMode", "from", "to", "by", "additive", "accumulate", "type", "rotate", "keyPoints", "path"],
847
+ ALLOWED_TAGS: [
848
+ "svg",
849
+ "path",
850
+ "circle",
851
+ "rect",
852
+ "line",
853
+ "polyline",
854
+ "polygon",
855
+ "g",
856
+ "text",
857
+ "tspan",
858
+ "image",
859
+ "defs",
860
+ "use",
861
+ "linearGradient",
862
+ "radialGradient",
863
+ "stop",
864
+ "clipPath",
865
+ "mask",
866
+ "pattern",
867
+ "marker",
868
+ "symbol",
869
+ "a",
870
+ "div",
871
+ "span",
872
+ "p",
873
+ "br",
874
+ "button",
875
+ "img",
876
+ "iframe",
877
+ "video",
878
+ "audio",
879
+ "source",
880
+ "canvas",
881
+ "b",
882
+ "i",
883
+ "u",
884
+ "strong",
885
+ "em",
886
+ "sub",
887
+ "sup",
888
+ "mark",
889
+ "s",
890
+ "small",
891
+ "del",
892
+ "ins",
893
+ "q",
894
+ "abbr",
895
+ "code",
896
+ "pre",
897
+ "blockquote",
898
+ "ul",
899
+ "ol",
900
+ "li",
901
+ "h1",
902
+ "h2",
903
+ "h3",
904
+ "h4",
905
+ "h5",
906
+ "h6",
907
+ "style",
908
+ "animate",
909
+ "animateTransform",
910
+ "animateMotion",
911
+ "set",
912
+ "filter",
913
+ "feGaussianBlur",
914
+ "feOffset",
915
+ "feMerge",
916
+ "feMergeNode",
917
+ "feColorMatrix",
918
+ "feComposite",
919
+ "feFlood",
920
+ "feMorphology",
921
+ "feBlend",
922
+ "feDropShadow",
923
+ "feTurbulence",
924
+ "feDisplacementMap",
925
+ "foreignObject"
926
+ ],
927
+ ALLOWED_ATTR: [
928
+ "class",
929
+ "id",
930
+ "style",
931
+ "width",
932
+ "height",
933
+ "viewBox",
934
+ "xmlns",
935
+ "xmlns:xlink",
936
+ "xlink:href",
937
+ "fill",
938
+ "stroke",
939
+ "stroke-width",
940
+ "stroke-linecap",
941
+ "stroke-linejoin",
942
+ "stroke-dasharray",
943
+ "stroke-dashoffset",
944
+ "d",
945
+ "cx",
946
+ "cy",
947
+ "r",
948
+ "x",
949
+ "y",
950
+ "x1",
951
+ "y1",
952
+ "x2",
953
+ "y2",
954
+ "points",
955
+ "href",
956
+ "src",
957
+ "alt",
958
+ "target",
959
+ "rel",
960
+ "data-*",
961
+ "aria-*",
962
+ "transform",
963
+ "opacity",
964
+ "fill-opacity",
965
+ "fill-rule",
966
+ "clip-rule",
967
+ "clip-path",
968
+ "clipPathUnits",
969
+ "mask",
970
+ "mask-type",
971
+ "maskUnits",
972
+ "maskContentUnits",
973
+ "patternUnits",
974
+ "patternContentUnits",
975
+ "patternTransform",
976
+ "gradientUnits",
977
+ "gradientTransform",
978
+ "spreadMethod",
979
+ "preserveAspectRatio",
980
+ "marker-start",
981
+ "marker-mid",
982
+ "marker-end",
983
+ "markerUnits",
984
+ "markerWidth",
985
+ "markerHeight",
986
+ "refX",
987
+ "refY",
988
+ "orient",
989
+ "paint-order",
990
+ "vector-effect",
991
+ "filter",
992
+ "filterUnits",
993
+ "primitiveUnits",
994
+ "in",
995
+ "in2",
996
+ "result",
997
+ "stdDeviation",
998
+ "flood-color",
999
+ "flood-opacity",
1000
+ "stroke-opacity",
1001
+ "font-size",
1002
+ "font-family",
1003
+ "font-weight",
1004
+ "font-style",
1005
+ "text-anchor",
1006
+ "dominant-baseline",
1007
+ "offset",
1008
+ "stop-color",
1009
+ "stop-opacity",
1010
+ "frameborder",
1011
+ "allowfullscreen",
1012
+ "allow",
1013
+ "title",
1014
+ "attributeName",
1015
+ "values",
1016
+ "dur",
1017
+ "begin",
1018
+ "end",
1019
+ "repeatCount",
1020
+ "repeatDur",
1021
+ "keyTimes",
1022
+ "keySplines",
1023
+ "calcMode",
1024
+ "from",
1025
+ "to",
1026
+ "by",
1027
+ "additive",
1028
+ "accumulate",
1029
+ "type",
1030
+ "rotate",
1031
+ "keyPoints",
1032
+ "path"
1033
+ ],
749
1034
  KEEP_CONTENT: true
750
1035
  };
751
1036
  function buildEmbed(node, ctx, deps) {
@@ -784,7 +1069,7 @@ function buildEmbed(node, ctx, deps) {
784
1069
  if (cmsItemIndexPath && cmsItemIndexPath.length > 0) {
785
1070
  embedProps["data-cms-item-index"] = cmsItemIndexPath.join(".");
786
1071
  }
787
- let classNames = ["oem"];
1072
+ const classNames = ["oem"];
788
1073
  if (node.style) {
789
1074
  let processedStyle = node.style;
790
1075
  if (ctx.templateContext) {
@@ -799,10 +1084,10 @@ function buildEmbed(node, ctx, deps) {
799
1084
  }
800
1085
  const scales = getCachedResponsiveScalesConfig();
801
1086
  const fluidActive = scales?.enabled === true && scales?.mode === "fluid";
802
- const utilityClasses = responsiveStylesToClasses(
803
- processedStyle,
804
- { fluidActive, responsiveScales: scales ?? void 0 }
805
- );
1087
+ const utilityClasses = responsiveStylesToClasses(processedStyle, {
1088
+ fluidActive,
1089
+ responsiveScales: scales ?? void 0
1090
+ });
806
1091
  UtilityClassCollector.collect(utilityClasses);
807
1092
  classNames.push(...utilityClasses);
808
1093
  }
@@ -839,10 +1124,10 @@ function buildEmbed(node, ctx, deps) {
839
1124
  if (rule.previewProp && ctx.componentResolvedProps[rule.previewProp] === true) {
840
1125
  const previewScales = getCachedResponsiveScalesConfig();
841
1126
  const previewFluidActive = previewScales?.enabled === true && previewScales?.mode === "fluid";
842
- const styleClasses = responsiveStylesToClasses(
843
- rule.style,
844
- { fluidActive: previewFluidActive, responsiveScales: previewScales ?? void 0 }
845
- );
1127
+ const styleClasses = responsiveStylesToClasses(rule.style, {
1128
+ fluidActive: previewFluidActive,
1129
+ responsiveScales: previewScales ?? void 0
1130
+ });
846
1131
  UtilityClassCollector.collect(styleClasses);
847
1132
  previewClasses.push(...styleClasses);
848
1133
  }
@@ -869,11 +1154,7 @@ function buildEmbed(node, ctx, deps) {
869
1154
  const effectiveLocale = ctx.cmsLocale || ctx.locale;
870
1155
  const config = ctx.i18nConfig || DEFAULT_I18N_CONFIG;
871
1156
  const i18nResolver = effectiveLocale ? (value) => resolveI18nValue(value, effectiveLocale, config) : void 0;
872
- processedAttributes = processItemPropsTemplate(
873
- extractedAttributes,
874
- ctx.templateContext,
875
- i18nResolver
876
- );
1157
+ processedAttributes = processItemPropsTemplate(extractedAttributes, ctx.templateContext, i18nResolver);
877
1158
  }
878
1159
  if (Object.keys(processedAttributes).length > 0) {
879
1160
  Object.assign(embedProps, processedAttributes);
@@ -929,7 +1210,7 @@ function buildLinkNode(node, children, ctx, deps) {
929
1210
  if (cmsItemIndexPath && cmsItemIndexPath.length > 0) {
930
1211
  linkNodeProps["data-cms-item-index"] = cmsItemIndexPath.join(".");
931
1212
  }
932
- let classNames = [];
1213
+ const classNames = [];
933
1214
  if (node.style) {
934
1215
  let processedStyle = node.style;
935
1216
  if (ctx.templateContext) {
@@ -944,10 +1225,10 @@ function buildLinkNode(node, children, ctx, deps) {
944
1225
  }
945
1226
  const scales = getCachedResponsiveScalesConfig();
946
1227
  const fluidActive = scales?.enabled === true && scales?.mode === "fluid";
947
- const utilityClasses = responsiveStylesToClasses(
948
- processedStyle,
949
- { fluidActive, responsiveScales: scales ?? void 0 }
950
- );
1228
+ const utilityClasses = responsiveStylesToClasses(processedStyle, {
1229
+ fluidActive,
1230
+ responsiveScales: scales ?? void 0
1231
+ });
951
1232
  UtilityClassCollector.collect(utilityClasses);
952
1233
  classNames.push(...utilityClasses);
953
1234
  }
@@ -984,10 +1265,10 @@ function buildLinkNode(node, children, ctx, deps) {
984
1265
  if (rule.previewProp && ctx.componentResolvedProps[rule.previewProp] === true) {
985
1266
  const previewScales = getCachedResponsiveScalesConfig();
986
1267
  const previewFluidActive = previewScales?.enabled === true && previewScales?.mode === "fluid";
987
- const styleClasses = responsiveStylesToClasses(
988
- rule.style,
989
- { fluidActive: previewFluidActive, responsiveScales: previewScales ?? void 0 }
990
- );
1268
+ const styleClasses = responsiveStylesToClasses(rule.style, {
1269
+ fluidActive: previewFluidActive,
1270
+ responsiveScales: previewScales ?? void 0
1271
+ });
991
1272
  UtilityClassCollector.collect(styleClasses);
992
1273
  previewClasses.push(...styleClasses);
993
1274
  }
@@ -1019,11 +1300,7 @@ function buildLinkNode(node, children, ctx, deps) {
1019
1300
  const effectiveLocale = ctx.cmsLocale || ctx.locale;
1020
1301
  const config = ctx.i18nConfig || DEFAULT_I18N_CONFIG;
1021
1302
  const i18nResolver = effectiveLocale ? (value) => resolveI18nValue(value, effectiveLocale, config) : void 0;
1022
- processedAttributes = processItemPropsTemplate(
1023
- extractedAttributes,
1024
- ctx.templateContext,
1025
- i18nResolver
1026
- );
1303
+ processedAttributes = processItemPropsTemplate(extractedAttributes, ctx.templateContext, i18nResolver);
1027
1304
  }
1028
1305
  if (Object.keys(processedAttributes).length > 0) {
1029
1306
  Object.assign(linkNodeProps, processedAttributes);
@@ -1088,14 +1365,14 @@ function buildLocaleList(node, ctx, deps) {
1088
1365
  if (cmsItemIndexPath && cmsItemIndexPath.length > 0) {
1089
1366
  localeListProps["data-cms-item-index"] = cmsItemIndexPath.join(".");
1090
1367
  }
1091
- let classNames = [];
1368
+ const classNames = [];
1092
1369
  const scales = getCachedResponsiveScalesConfig();
1093
1370
  const fluidActive = scales?.enabled === true && scales?.mode === "fluid";
1094
1371
  if (node.style) {
1095
- const utilityClasses = responsiveStylesToClasses(
1096
- node.style,
1097
- { fluidActive, responsiveScales: scales ?? void 0 }
1098
- );
1372
+ const utilityClasses = responsiveStylesToClasses(node.style, {
1373
+ fluidActive,
1374
+ responsiveScales: scales ?? void 0
1375
+ });
1099
1376
  UtilityClassCollector.collect(utilityClasses);
1100
1377
  classNames.push(...utilityClasses);
1101
1378
  }
@@ -1130,10 +1407,10 @@ function buildLocaleList(node, ctx, deps) {
1130
1407
  const previewClasses = [];
1131
1408
  for (const rule of nodeInteractiveStyles) {
1132
1409
  if (rule.previewProp && ctx.componentResolvedProps[rule.previewProp] === true) {
1133
- const styleClasses = responsiveStylesToClasses(
1134
- rule.style,
1135
- { fluidActive, responsiveScales: scales ?? void 0 }
1136
- );
1410
+ const styleClasses = responsiveStylesToClasses(rule.style, {
1411
+ fluidActive,
1412
+ responsiveScales: scales ?? void 0
1413
+ });
1137
1414
  UtilityClassCollector.collect(styleClasses);
1138
1415
  previewClasses.push(...styleClasses);
1139
1416
  }
@@ -1169,10 +1446,22 @@ function buildLocaleList(node, ctx, deps) {
1169
1446
  const showFlag = node.showFlag !== false;
1170
1447
  const configLocales = i18nConfig?.locales || [];
1171
1448
  const currentLocaleCode = locale || i18nConfig?.defaultLocale || "en";
1172
- const itemClasses = node.itemStyle ? responsiveStylesToClasses(node.itemStyle, { fluidActive, responsiveScales: scales ?? void 0 }) : [];
1173
- const activeItemClasses = node.activeItemStyle ? responsiveStylesToClasses(node.activeItemStyle, { fluidActive, responsiveScales: scales ?? void 0 }) : [];
1174
- const separatorClasses = node.separatorStyle ? responsiveStylesToClasses(node.separatorStyle, { fluidActive, responsiveScales: scales ?? void 0 }) : [];
1175
- const flagClasses = node.flagStyle ? responsiveStylesToClasses(node.flagStyle, { fluidActive, responsiveScales: scales ?? void 0 }) : [];
1449
+ const itemClasses = node.itemStyle ? responsiveStylesToClasses(node.itemStyle, {
1450
+ fluidActive,
1451
+ responsiveScales: scales ?? void 0
1452
+ }) : [];
1453
+ const activeItemClasses = node.activeItemStyle ? responsiveStylesToClasses(node.activeItemStyle, {
1454
+ fluidActive,
1455
+ responsiveScales: scales ?? void 0
1456
+ }) : [];
1457
+ const separatorClasses = node.separatorStyle ? responsiveStylesToClasses(node.separatorStyle, {
1458
+ fluidActive,
1459
+ responsiveScales: scales ?? void 0
1460
+ }) : [];
1461
+ const flagClasses = node.flagStyle ? responsiveStylesToClasses(node.flagStyle, {
1462
+ fluidActive,
1463
+ responsiveScales: scales ?? void 0
1464
+ }) : [];
1176
1465
  UtilityClassCollector.collect(itemClasses);
1177
1466
  UtilityClassCollector.collect(activeItemClasses);
1178
1467
  UtilityClassCollector.collect(separatorClasses);
@@ -1180,22 +1469,27 @@ function buildLocaleList(node, ctx, deps) {
1180
1469
  const linkElements = [];
1181
1470
  for (let i = 0; i < configLocales.length; i++) {
1182
1471
  const localeConfig = configLocales[i];
1472
+ if (!localeConfig) continue;
1183
1473
  const isCurrent = localeConfig.code === currentLocaleCode;
1184
1474
  if (!showCurrent && isCurrent) continue;
1185
1475
  if (showSeparator && linkElements.length > 0) {
1186
- linkElements.push(h4("span", {
1187
- key: `sep-${i}`,
1188
- className: separatorClasses.length > 0 ? separatorClasses.join(" ") : void 0
1189
- }));
1476
+ linkElements.push(
1477
+ h4("span", {
1478
+ key: `sep-${i}`,
1479
+ className: separatorClasses.length > 0 ? separatorClasses.join(" ") : void 0
1480
+ })
1481
+ );
1190
1482
  }
1191
1483
  const linkContent = [];
1192
1484
  if (showFlag && localeConfig.icon) {
1193
- linkContent.push(h4("img", {
1194
- key: "flag",
1195
- src: localeConfig.icon,
1196
- alt: `${localeConfig.name} flag`,
1197
- className: flagClasses.length > 0 ? flagClasses.join(" ") : void 0
1198
- }));
1485
+ linkContent.push(
1486
+ h4("img", {
1487
+ key: "flag",
1488
+ src: localeConfig.icon,
1489
+ alt: `${localeConfig.name} flag`,
1490
+ className: flagClasses.length > 0 ? flagClasses.join(" ") : void 0
1491
+ })
1492
+ );
1199
1493
  }
1200
1494
  const displayType = node.displayType || "nativeName";
1201
1495
  let displayText;
@@ -1206,20 +1500,25 @@ function buildLocaleList(node, ctx, deps) {
1206
1500
  case "name":
1207
1501
  displayText = localeConfig.name;
1208
1502
  break;
1209
- case "nativeName":
1210
1503
  default:
1211
1504
  displayText = localeConfig.nativeName;
1212
1505
  break;
1213
1506
  }
1214
1507
  linkContent.push(h4("div", { key: "text" }, displayText));
1215
1508
  const linkClasses = isCurrent ? [...itemClasses, ...activeItemClasses] : itemClasses;
1216
- linkElements.push(h4("div", {
1217
- key: `locale-${localeConfig.code}`,
1218
- "data-current": isCurrent ? "true" : "false",
1219
- "data-locale": localeConfig.code,
1220
- className: linkClasses.length > 0 ? linkClasses.join(" ") : void 0,
1221
- style: { cursor: "pointer" }
1222
- }, ...linkContent));
1509
+ linkElements.push(
1510
+ h4(
1511
+ "div",
1512
+ {
1513
+ key: `locale-${localeConfig.code}`,
1514
+ "data-current": isCurrent ? "true" : "false",
1515
+ "data-locale": localeConfig.code,
1516
+ className: linkClasses.length > 0 ? linkClasses.join(" ") : void 0,
1517
+ style: { cursor: "pointer" }
1518
+ },
1519
+ ...linkContent
1520
+ )
1521
+ );
1223
1522
  }
1224
1523
  return h4("div", localeListProps, linkElements);
1225
1524
  }
@@ -1248,9 +1547,14 @@ function buildList(node, children, ctx, deps) {
1248
1547
  const isLegacyCMSList = nodeType === "cms-list";
1249
1548
  const sourceType = isLegacyCMSList ? "collection" : node.sourceType || "prop";
1250
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 : "";
1251
1554
  const rawSource = node.source || node.collection;
1252
1555
  const source = typeof rawSource === "string" ? rawSource : "";
1253
1556
  const sourceIsResolved = Array.isArray(rawSource);
1557
+ const hasSource = sourceIsResolved || Boolean(source) || isRemoteMode && Boolean(remoteUrl) || isSanityMode && Boolean(sanityKey);
1254
1558
  const effectiveParentComponentName = deps.getEffectiveParentComponentName(componentContext, parentComponentName);
1255
1559
  const extractedAttributes = extractAttributesFromNode(node);
1256
1560
  const containerProps = {
@@ -1263,6 +1567,14 @@ function buildList(node, children, ctx, deps) {
1263
1567
  containerProps["data-cms-list"] = "true";
1264
1568
  if (isCollectionMode) {
1265
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;
1266
1578
  } else {
1267
1579
  containerProps["data-list"] = "true";
1268
1580
  containerProps["data-source"] = source || (sourceIsResolved ? "resolved" : "");
@@ -1288,6 +1600,12 @@ function buildList(node, children, ctx, deps) {
1288
1600
  let itemsToRender;
1289
1601
  if (isCollectionMode) {
1290
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 = [];
1291
1609
  } else {
1292
1610
  if (sourceIsResolved) {
1293
1611
  itemsToRender = rawSource;
@@ -1308,41 +1626,49 @@ function buildList(node, children, ctx, deps) {
1308
1626
  const bgColor = isCollectionMode ? "rgba(139, 92, 246, 0.05)" : "rgba(59, 130, 246, 0.05)";
1309
1627
  const borderColor = isCollectionMode ? "rgba(139, 92, 246, 0.3)" : "rgba(59, 130, 246, 0.3)";
1310
1628
  const textColor = isCollectionMode ? "#8b5cf6" : "#3b82f6";
1311
- const label = isCollectionMode ? "CMS List" : "List";
1629
+ const label = isCollectionMode ? "CMS List" : isRemoteMode ? "Remote List" : isSanityMode ? "Sanity List" : "List";
1312
1630
  const tag = typeof node.tag === "string" ? node.tag : null;
1313
- if (!source && !sourceIsResolved) {
1314
- const emptyState = h5("div", {
1315
- key: "list-empty",
1316
- style: {
1317
- padding: "12px",
1318
- background: bgColor,
1319
- border: `1px dashed ${borderColor}`,
1320
- borderRadius: "4px",
1321
- color: textColor,
1322
- fontSize: "12px",
1323
- fontFamily: "system-ui, sans-serif",
1324
- textAlign: "center"
1325
- }
1326
- }, `${label}: No source - No items`);
1631
+ if (!hasSource) {
1632
+ const emptyState = h5(
1633
+ "div",
1634
+ {
1635
+ key: "list-empty",
1636
+ style: {
1637
+ padding: "12px",
1638
+ background: bgColor,
1639
+ border: `1px dashed ${borderColor}`,
1640
+ borderRadius: "4px",
1641
+ color: textColor,
1642
+ fontSize: "12px",
1643
+ fontFamily: "system-ui, sans-serif",
1644
+ textAlign: "center"
1645
+ }
1646
+ },
1647
+ `${label}: No source - No items`
1648
+ );
1327
1649
  if (tag === null) {
1328
1650
  return emptyState;
1329
1651
  }
1330
1652
  return h5(tag, containerProps, emptyState);
1331
1653
  }
1332
1654
  if (itemsToRender.length === 0) {
1333
- const emptyState = h5("div", {
1334
- key: "list-empty",
1335
- style: {
1336
- padding: "12px",
1337
- background: bgColor,
1338
- border: `1px dashed ${borderColor}`,
1339
- borderRadius: "4px",
1340
- color: textColor,
1341
- fontSize: "12px",
1342
- fontFamily: "system-ui, sans-serif",
1343
- textAlign: "center"
1344
- }
1345
- }, `${label}: ${source || "resolved"} - No items`);
1655
+ const emptyState = h5(
1656
+ "div",
1657
+ {
1658
+ key: "list-empty",
1659
+ style: {
1660
+ padding: "12px",
1661
+ background: bgColor,
1662
+ border: `1px dashed ${borderColor}`,
1663
+ borderRadius: "4px",
1664
+ color: textColor,
1665
+ fontSize: "12px",
1666
+ fontFamily: "system-ui, sans-serif",
1667
+ textAlign: "center"
1668
+ }
1669
+ },
1670
+ `${label}: ${source || remoteUrl || sanityKey || "resolved"} - No items`
1671
+ );
1346
1672
  if (tag === null) {
1347
1673
  return emptyState;
1348
1674
  }
@@ -1389,7 +1715,10 @@ function buildList(node, children, ctx, deps) {
1389
1715
  }
1390
1716
  }
1391
1717
  } else if (typeof itemChildren === "object" && itemChildren !== null && "key" in itemChildren) {
1392
- renderedItems.push({ ...itemChildren, key: `${itemChildren.key}-item-${itemKey}` });
1718
+ renderedItems.push({
1719
+ ...itemChildren,
1720
+ key: `${itemChildren.key}-item-${itemKey}`
1721
+ });
1393
1722
  } else {
1394
1723
  renderedItems.push(itemChildren);
1395
1724
  }
@@ -1438,7 +1767,12 @@ function getCollectionItems(node, source, ctx) {
1438
1767
  itemsToRender = lookupItemsByIds(ids, collectionItems);
1439
1768
  }
1440
1769
  if (node.filter) {
1441
- itemsToRender = applyClientFilters(itemsToRender, node.filter, cmsContext ?? void 0, templateContext ?? void 0);
1770
+ itemsToRender = applyClientFilters(
1771
+ itemsToRender,
1772
+ node.filter,
1773
+ cmsContext ?? void 0,
1774
+ templateContext ?? void 0
1775
+ );
1442
1776
  }
1443
1777
  if (node.sort) {
1444
1778
  itemsToRender = applyClientSorting(itemsToRender, node.sort);
@@ -1446,7 +1780,12 @@ function getCollectionItems(node, source, ctx) {
1446
1780
  } else {
1447
1781
  itemsToRender = [...collectionItems];
1448
1782
  if (node.filter) {
1449
- itemsToRender = applyClientFilters(itemsToRender, node.filter, cmsContext ?? void 0, templateContext ?? void 0);
1783
+ itemsToRender = applyClientFilters(
1784
+ itemsToRender,
1785
+ node.filter,
1786
+ cmsContext ?? void 0,
1787
+ templateContext ?? void 0
1788
+ );
1450
1789
  }
1451
1790
  if (node.sort) {
1452
1791
  itemsToRender = applyClientSorting(itemsToRender, node.sort);
@@ -1504,9 +1843,7 @@ function applyClientFilters(items, filter, cmsContext, templateContext) {
1504
1843
  );
1505
1844
  }
1506
1845
  const conditions = Array.isArray(filter) ? filter : [filter];
1507
- return items.filter(
1508
- (item) => conditions.every((cond) => matchCondition(item, cond, cmsContext, templateContext))
1509
- );
1846
+ return items.filter((item) => conditions.every((cond) => matchCondition(item, cond, cmsContext, templateContext)));
1510
1847
  }
1511
1848
  function isFilterCondition(obj) {
1512
1849
  return typeof obj === "object" && obj !== null && "field" in obj;
@@ -1663,49 +2000,56 @@ function buildLink(props, children, ctx, deps) {
1663
2000
  linkProps[propKey] = propValue;
1664
2001
  }
1665
2002
  }
1666
- return h6("a", {
1667
- ...linkProps,
1668
- ref: (el) => {
1669
- const pathKey = pathToString(elementPath);
1670
- if (!el) {
1671
- deps.prefetchService?.unobserveLinkByPath(pathKey);
1672
- }
1673
- deps.elementRegistry.register(elementPath, el, effectiveParentComponentName, false);
1674
- if (el && deps.prefetchService?.isEnabled() && isInternalLink) {
1675
- const strategy = prefetchAttr || deps.prefetchService.getDefaultStrategy();
1676
- if (strategy === "viewport") {
1677
- deps.prefetchService.observeLink(el, pathKey);
2003
+ return h6(
2004
+ "a",
2005
+ {
2006
+ ...linkProps,
2007
+ ref: (el) => {
2008
+ const pathKey = pathToString(elementPath);
2009
+ if (!el) {
2010
+ deps.prefetchService?.unobserveLinkByPath(pathKey);
1678
2011
  }
2012
+ deps.elementRegistry.register(elementPath, el, effectiveParentComponentName, false);
2013
+ if (el && deps.prefetchService?.isEnabled() && isInternalLink) {
2014
+ const strategy = prefetchAttr || deps.prefetchService.getDefaultStrategy();
2015
+ if (strategy === "viewport") {
2016
+ deps.prefetchService.observeLink(el, pathKey);
2017
+ }
2018
+ }
2019
+ },
2020
+ onClick: navigationOnClick,
2021
+ ...prefetchHandlers,
2022
+ style: {
2023
+ textDecoration: "none",
2024
+ color: "#0070f3",
2025
+ cursor: "pointer",
2026
+ ...props.style && typeof props.style === "object" ? props.style : {}
1679
2027
  }
1680
2028
  },
1681
- onClick: navigationOnClick,
1682
- ...prefetchHandlers,
1683
- style: {
1684
- textDecoration: "none",
1685
- color: "#0070f3",
1686
- cursor: "pointer",
1687
- ...props.style && typeof props.style === "object" ? props.style : {}
1688
- }
1689
- }, deps.buildChildren(children, {
1690
- elementPath,
1691
- parentComponentName: effectiveParentComponentName,
1692
- viewportWidth,
1693
- componentContext,
1694
- componentRootPath,
1695
- locale,
1696
- i18nConfig,
1697
- cmsContext,
1698
- cmsLocale,
1699
- collectionItemsMap,
1700
- itemContext,
1701
- cmsItemIndexPath,
1702
- cmsListPaths,
1703
- templateContext,
1704
- componentResolvedProps
1705
- }));
2029
+ deps.buildChildren(children, {
2030
+ elementPath,
2031
+ parentComponentName: effectiveParentComponentName,
2032
+ viewportWidth,
2033
+ componentContext,
2034
+ componentRootPath,
2035
+ locale,
2036
+ i18nConfig,
2037
+ cmsContext,
2038
+ cmsLocale,
2039
+ collectionItemsMap,
2040
+ itemContext,
2041
+ cmsItemIndexPath,
2042
+ cmsListPaths,
2043
+ templateContext,
2044
+ componentResolvedProps
2045
+ })
2046
+ );
1706
2047
  }
1707
2048
 
1708
2049
  // lib/client/core/ComponentBuilder.ts
2050
+ function isProcessedComponentNode(value) {
2051
+ return typeof value.type === "string" && isValidNodeType(value.type);
2052
+ }
1709
2053
  var DOCUMENT_STRUCTURE_TAGS = /* @__PURE__ */ new Set(["body", "html", "head"]);
1710
2054
  var ComponentBuilder = class {
1711
2055
  componentRegistry;
@@ -1732,10 +2076,10 @@ var ComponentBuilder = class {
1732
2076
  if (!cached2) {
1733
2077
  const scales = getCachedResponsiveScalesConfig();
1734
2078
  const fluidActive = scales?.enabled === true && scales?.mode === "fluid";
1735
- cached2 = responsiveStylesToClasses(
1736
- style,
1737
- { fluidActive, responsiveScales: scales ?? void 0 }
1738
- );
2079
+ cached2 = responsiveStylesToClasses(style, {
2080
+ fluidActive,
2081
+ responsiveScales: scales ?? void 0
2082
+ });
1739
2083
  this.styleClassCache.set(style, cached2);
1740
2084
  }
1741
2085
  UtilityClassCollector.collect(cached2);
@@ -1971,6 +2315,12 @@ var ComponentBuilder = class {
1971
2315
  if (nodeType === NODE_TYPE.LOCALE_LIST && isLocaleListNode(node)) {
1972
2316
  return buildLocaleList(node, ctx, builderDeps);
1973
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
+ }
1974
2324
  if (isListNode(node)) {
1975
2325
  return buildList(node, children, ctx, builderDeps);
1976
2326
  }
@@ -1989,20 +2339,24 @@ var ComponentBuilder = class {
1989
2339
  `[Meno] Component "${componentName}" not found in registry. Registered: [${this.componentRegistry.getNames().join(", ")}]`
1990
2340
  );
1991
2341
  }
1992
- return h7("div", {
1993
- key,
1994
- style: {
1995
- border: "1px dashed #e5a00d",
1996
- padding: "8px 12px",
1997
- margin: "4px 0",
1998
- borderRadius: "4px",
1999
- color: "#b8860b",
2000
- fontSize: "13px",
2001
- fontFamily: "monospace",
2002
- background: "#fffbe6"
2342
+ return h7(
2343
+ "div",
2344
+ {
2345
+ key,
2346
+ style: {
2347
+ border: "1px dashed #e5a00d",
2348
+ padding: "8px 12px",
2349
+ margin: "4px 0",
2350
+ borderRadius: "4px",
2351
+ color: "#b8860b",
2352
+ fontSize: "13px",
2353
+ fontFamily: "monospace",
2354
+ background: "#fffbe6"
2355
+ },
2356
+ "data-missing-component": componentName
2003
2357
  },
2004
- "data-missing-component": componentName
2005
- }, `Component not found: ${componentName}`);
2358
+ `Component not found: ${componentName}`
2359
+ );
2006
2360
  }
2007
2361
  if (tag === "Link") {
2008
2362
  return buildLink(finalProps, children, ctx, builderDeps);
@@ -2022,17 +2376,22 @@ var ComponentBuilder = class {
2022
2376
  const markerRegex = /<div\s+data-meno-component="([^"]+)"\s+data-meno-props="([^"]*)"[^>]*><\/div>/g;
2023
2377
  const segments = [];
2024
2378
  let lastIndex = 0;
2025
- let match;
2379
+ let match = markerRegex.exec(html);
2026
2380
  let segmentIndex = 0;
2027
- while ((match = markerRegex.exec(html)) !== null) {
2028
- if (match.index > lastIndex) {
2029
- const chunk = html.slice(lastIndex, match.index);
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);
2030
2386
  segments.push(h7("span", { key: `rt-${segmentIndex++}`, dangerouslySetInnerHTML: { __html: chunk } }));
2031
2387
  }
2032
- const componentName = match[1];
2388
+ const componentName = currentMatch[1];
2389
+ if (componentName === void 0) {
2390
+ continue;
2391
+ }
2033
2392
  let props = {};
2034
2393
  try {
2035
- const propsStr = match[2].replace(/&quot;/g, '"').replace(/&#039;/g, "'").replace(/&amp;/g, "&");
2394
+ const propsStr = (currentMatch[2] ?? "").replace(/&quot;/g, '"').replace(/&#039;/g, "'").replace(/&amp;/g, "&");
2036
2395
  props = JSON.parse(propsStr);
2037
2396
  } catch {
2038
2397
  }
@@ -2066,13 +2425,15 @@ var ComponentBuilder = class {
2066
2425
  segments.push(rendered);
2067
2426
  }
2068
2427
  } else {
2069
- segments.push(h7("span", { key: `rt-${segmentIndex}`, dangerouslySetInnerHTML: { __html: match[0] } }));
2428
+ segments.push(h7("span", { key: `rt-${segmentIndex}`, dangerouslySetInnerHTML: { __html: currentMatch[0] } }));
2070
2429
  }
2071
2430
  segmentIndex++;
2072
- lastIndex = match.index + match[0].length;
2431
+ lastIndex = currentMatch.index + currentMatch[0].length;
2073
2432
  }
2074
2433
  if (lastIndex < html.length) {
2075
- segments.push(h7("span", { key: `rt-${segmentIndex}`, dangerouslySetInnerHTML: { __html: html.slice(lastIndex) } }));
2434
+ segments.push(
2435
+ h7("span", { key: `rt-${segmentIndex}`, dangerouslySetInnerHTML: { __html: html.slice(lastIndex) } })
2436
+ );
2076
2437
  }
2077
2438
  return h7(Fragment2, null, ...segments);
2078
2439
  }
@@ -2196,7 +2557,11 @@ var ComponentBuilder = class {
2196
2557
  if (utilityClasses.length > 0) {
2197
2558
  const existingClassName = props.className || "";
2198
2559
  const classArray = existingClassName ? existingClassName.split(/\s+/) : [];
2199
- return { ...props, className: [...classArray, ...utilityClasses].filter(Boolean).join(" "), style: processedStyle };
2560
+ return {
2561
+ ...props,
2562
+ className: [...classArray, ...utilityClasses].filter(Boolean).join(" "),
2563
+ style: processedStyle
2564
+ };
2200
2565
  }
2201
2566
  }
2202
2567
  return props;
@@ -2287,11 +2652,13 @@ var ComponentBuilder = class {
2287
2652
  if (Object.keys(extractedAttributes).length === 0) {
2288
2653
  return props;
2289
2654
  }
2290
- let result = { ...props };
2655
+ const result = { ...props };
2291
2656
  if ("class" in extractedAttributes || "className" in extractedAttributes) {
2292
2657
  const attrClass = extractedAttributes.class ?? extractedAttributes.className ?? "";
2293
2658
  const existingClassName = result.className || "";
2294
2659
  result.className = [existingClassName, attrClass].filter(Boolean).join(" ");
2660
+ const classTokens = attrClass.split(/\s+/).filter(Boolean);
2661
+ if (classTokens.length > 0) UtilityClassCollector.collect(classTokens);
2295
2662
  delete extractedAttributes.class;
2296
2663
  delete extractedAttributes.className;
2297
2664
  }
@@ -2301,6 +2668,69 @@ var ComponentBuilder = class {
2301
2668
  }
2302
2669
  return { ...result, ...normalizedAttributes };
2303
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
+ }
2304
2734
  /**
2305
2735
  * Build a custom component
2306
2736
  */
@@ -2344,7 +2774,7 @@ var ComponentBuilder = class {
2344
2774
  const i18nResolver = effectiveLocale ? (value) => resolveI18nValue(value, effectiveLocale, config) : void 0;
2345
2775
  propsToResolve = processItemPropsTemplate(propsToResolve, effectiveItemContext, i18nResolver);
2346
2776
  }
2347
- let resolvedProps = resolvePropsFromDefinition(
2777
+ const resolvedProps = resolvePropsFromDefinition(
2348
2778
  structuredComponentDef,
2349
2779
  propsToResolve,
2350
2780
  children,
@@ -2363,7 +2793,7 @@ var ComponentBuilder = class {
2363
2793
  viewportWidth,
2364
2794
  markedChildren
2365
2795
  );
2366
- if (!processedStructure || typeof processedStructure === "string" || typeof processedStructure === "number" || Array.isArray(processedStructure)) {
2796
+ if (!processedStructure || typeof processedStructure === "string" || typeof processedStructure === "number" || Array.isArray(processedStructure) || !isProcessedComponentNode(processedStructure)) {
2367
2797
  return null;
2368
2798
  }
2369
2799
  if (finalProps.style && typeof finalProps.style === "object") {
@@ -2381,7 +2811,7 @@ var ComponentBuilder = class {
2381
2811
  const componentElement = this.buildComponent({
2382
2812
  node: processedStructure,
2383
2813
  key,
2384
- customProps: { "__componentProps": resolvedProps },
2814
+ customProps: { __componentProps: resolvedProps },
2385
2815
  elementPath,
2386
2816
  parentComponentName: nestedParentComponentName,
2387
2817
  viewportWidth,
@@ -2399,7 +2829,7 @@ var ComponentBuilder = class {
2399
2829
  componentResolvedProps: resolvedProps
2400
2830
  });
2401
2831
  return h7(ErrorBoundary, { key, componentName, level: "component" }, componentElement);
2402
- } catch (error) {
2832
+ } catch (_error) {
2403
2833
  return h7(ErrorBoundary, { key, componentName, level: "component" }, null);
2404
2834
  }
2405
2835
  }
@@ -2455,10 +2885,13 @@ var ComponentBuilder = class {
2455
2885
  if (cmsItemIndexPath && cmsItemIndexPath.length > 0) {
2456
2886
  el.setAttribute("data-cms-item-index", cmsItemIndexPath.join("."));
2457
2887
  if (cmsListPaths && cmsListPaths.length === cmsItemIndexPath.length) {
2458
- el.setAttribute("data-cms-context", JSON.stringify({
2459
- itemIndexPath: cmsItemIndexPath,
2460
- listPaths: cmsListPaths
2461
- }));
2888
+ el.setAttribute(
2889
+ "data-cms-context",
2890
+ JSON.stringify({
2891
+ itemIndexPath: cmsItemIndexPath,
2892
+ listPaths: cmsListPaths
2893
+ })
2894
+ );
2462
2895
  }
2463
2896
  }
2464
2897
  if (isComponentRoot) el.setAttribute("data-component-root", "true");
@@ -2493,12 +2926,34 @@ var ComponentBuilder = class {
2493
2926
  parentComponentName: parentComponentName ?? null,
2494
2927
  componentContext: componentContext ?? null
2495
2928
  };
2496
- this.elementRegistry.register(elementPath, el, componentNameForRegistry, isComponentRoot, componentProps, metadata);
2929
+ this.elementRegistry.register(
2930
+ elementPath,
2931
+ el,
2932
+ componentNameForRegistry,
2933
+ isComponentRoot,
2934
+ componentProps,
2935
+ metadata
2936
+ );
2497
2937
  };
2498
2938
  if (props.onClick) {
2499
2939
  processedProps.onClick = this.createOnClickHandler(props.onClick);
2500
2940
  }
2501
- const VOID_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"];
2941
+ const VOID_ELEMENTS = [
2942
+ "area",
2943
+ "base",
2944
+ "br",
2945
+ "col",
2946
+ "embed",
2947
+ "hr",
2948
+ "img",
2949
+ "input",
2950
+ "link",
2951
+ "meta",
2952
+ "param",
2953
+ "source",
2954
+ "track",
2955
+ "wbr"
2956
+ ];
2502
2957
  if (VOID_ELEMENTS.includes(finalTag.toLowerCase())) {
2503
2958
  const { children: _ignored, ...voidElementProps } = processedProps;
2504
2959
  return h7(finalTag, voidElementProps);
@@ -2527,33 +2982,48 @@ var ComponentBuilder = class {
2527
2982
  // lib/client/core/ComponentRenderer.tsx
2528
2983
  import { createElement as h8 } from "react";
2529
2984
  function renderPage(options) {
2530
- const { tree, currentPath, viewportWidth, componentBuilder, locale, i18nConfig, cmsContext, cmsLocale, collectionItemsMap, templateContext } = options;
2531
- if (!tree) return null;
2532
- return h8(ErrorBoundary, {
2533
- level: "page",
2534
- onError: (error, errorInfo) => {
2535
- console.error("Page rendering error:", {
2536
- path: currentPath,
2537
- error: error.message,
2538
- stack: error.stack,
2539
- componentStack: errorInfo?.componentStack
2540
- });
2541
- }
2542
- }, componentBuilder.buildComponent({
2543
- node: tree,
2544
- key: 0,
2545
- customProps: {},
2546
- elementPath: [0],
2547
- parentComponentName: null,
2985
+ const {
2986
+ tree,
2987
+ currentPath,
2548
2988
  viewportWidth,
2549
- componentContext: null,
2989
+ componentBuilder,
2550
2990
  locale,
2551
2991
  i18nConfig,
2552
2992
  cmsContext,
2553
2993
  cmsLocale,
2554
2994
  collectionItemsMap,
2555
- templateContext: templateContext ?? null
2556
- }));
2995
+ templateContext
2996
+ } = options;
2997
+ if (!tree) return null;
2998
+ return h8(
2999
+ ErrorBoundary,
3000
+ {
3001
+ level: "page",
3002
+ onError: (error, errorInfo) => {
3003
+ console.error("Page rendering error:", {
3004
+ path: currentPath,
3005
+ error: error.message,
3006
+ stack: error.stack,
3007
+ componentStack: errorInfo?.componentStack
3008
+ });
3009
+ }
3010
+ },
3011
+ componentBuilder.buildComponent({
3012
+ node: tree,
3013
+ key: 0,
3014
+ customProps: {},
3015
+ elementPath: [0],
3016
+ parentComponentName: null,
3017
+ viewportWidth,
3018
+ componentContext: null,
3019
+ locale,
3020
+ i18nConfig,
3021
+ cmsContext,
3022
+ cmsLocale,
3023
+ collectionItemsMap,
3024
+ templateContext: templateContext ?? null
3025
+ })
3026
+ );
2557
3027
  }
2558
3028
 
2559
3029
  // lib/client/routing/Router.tsx
@@ -2561,6 +3031,7 @@ import { createElement as h10, useState as useState2, useEffect as useEffect2, u
2561
3031
 
2562
3032
  // lib/client/routing/RouteLoader.ts
2563
3033
  init_constants();
3034
+ init_errorLogger();
2564
3035
  var RouteLoader = class {
2565
3036
  abortController = null;
2566
3037
  notFoundTimeout = null;
@@ -2612,9 +3083,7 @@ var RouteLoader = class {
2612
3083
  try {
2613
3084
  const response = await fetch(API_ROUTES.PAGES);
2614
3085
  const data = await response.json();
2615
- const pages = (data.pages || []).map(
2616
- (p) => typeof p === "string" ? p : p.path
2617
- );
3086
+ const pages = (data.pages || []).map((p) => typeof p === "string" ? p : p.path);
2618
3087
  if (this.config.onPagesLoaded) {
2619
3088
  this.config.onPagesLoaded(pages);
2620
3089
  }
@@ -2712,10 +3181,7 @@ var RouteLoader = class {
2712
3181
  this.config.onLoadComplete(errorTree);
2713
3182
  }
2714
3183
  if (this.config.onLoadError && !this.isCancelled) {
2715
- this.config.onLoadError(
2716
- parseError instanceof Error ? parseError : new Error(String(parseError)),
2717
- errorTree
2718
- );
3184
+ this.config.onLoadError(parseError instanceof Error ? parseError : new Error(String(parseError)), errorTree);
2719
3185
  }
2720
3186
  return errorTree;
2721
3187
  }
@@ -2724,6 +3190,7 @@ var RouteLoader = class {
2724
3190
  try {
2725
3191
  this.config.componentRegistry.merge(parsed.components);
2726
3192
  } catch (componentError) {
3193
+ logRuntimeError("RouteLoader.mergePageComponents", componentError);
2727
3194
  }
2728
3195
  tree = parsed.root || parsed;
2729
3196
  } else if (parsed.root) {
@@ -2752,10 +3219,7 @@ var RouteLoader = class {
2752
3219
  this.config.onLoadComplete(errorTree);
2753
3220
  }
2754
3221
  if (this.config.onLoadError && !this.isCancelled) {
2755
- this.config.onLoadError(
2756
- error instanceof Error ? error : new Error(String(error)),
2757
- errorTree
2758
- );
3222
+ this.config.onLoadError(error instanceof Error ? error : new Error(String(error)), errorTree);
2759
3223
  }
2760
3224
  this.clearNotFoundTimeout();
2761
3225
  this.abortController = null;
@@ -2841,6 +3305,7 @@ function getInitialLoadingState(hasSSRContent) {
2841
3305
  import { createElement as h9, useState, useEffect, useRef } from "react";
2842
3306
 
2843
3307
  // lib/client/hmrWebSocket.ts
3308
+ init_errorLogger();
2844
3309
  var HMRWebSocket = class {
2845
3310
  ws = null;
2846
3311
  config;
@@ -2881,7 +3346,7 @@ var HMRWebSocket = class {
2881
3346
  this.ws.onmessage = (event) => this.handleMessage(event);
2882
3347
  this.ws.onerror = (error) => this.handleError(error);
2883
3348
  this.ws.onclose = (event) => this.handleClose(event);
2884
- } catch (error) {
3349
+ } catch (_error) {
2885
3350
  this.scheduleReconnect();
2886
3351
  }
2887
3352
  }
@@ -2903,10 +3368,10 @@ var HMRWebSocket = class {
2903
3368
  logRuntimeError("hmrWebSocket.handleMessage", e);
2904
3369
  }
2905
3370
  }
2906
- handleError(error) {
3371
+ handleError(_error) {
2907
3372
  this.config.onStatusChange("error");
2908
3373
  }
2909
- handleClose(event) {
3374
+ handleClose(_event) {
2910
3375
  this.stopHeartbeat();
2911
3376
  if (!this.isIntentionallyClosed) {
2912
3377
  this.config.onStatusChange("disconnected");
@@ -2931,7 +3396,7 @@ var HMRWebSocket = class {
2931
3396
  return;
2932
3397
  }
2933
3398
  const delay = Math.min(
2934
- this.config.initialReconnectDelay * Math.pow(2, this.reconnectAttempts),
3399
+ this.config.initialReconnectDelay * 2 ** this.reconnectAttempts,
2935
3400
  this.config.maxReconnectDelay
2936
3401
  );
2937
3402
  const jitter = delay * 0.25 * (Math.random() - 0.5);
@@ -3083,6 +3548,10 @@ function HMRManager({
3083
3548
  document.dispatchEvent(new CustomEvent("hmr-fonts-update"));
3084
3549
  } else if (data.type === "hmr:libraries-update") {
3085
3550
  document.dispatchEvent(new CustomEvent("hmr-libraries-update"));
3551
+ } else if (data.type === "hmr:config-update") {
3552
+ document.dispatchEvent(new CustomEvent("hmr-config-update"));
3553
+ } else if (data.type === "hmr:stylesheet-update") {
3554
+ document.dispatchEvent(new CustomEvent("hmr-stylesheet-update"));
3086
3555
  }
3087
3556
  };
3088
3557
  const createStatusHandler = () => (newStatus) => {
@@ -3140,25 +3609,29 @@ function HMRIndicator({ status }) {
3140
3609
  error: { bg: "#dc2626", text: "\u274C Connection Failed - Refresh Page", show: true }
3141
3610
  };
3142
3611
  const config = statusConfig[status];
3143
- return h9("div", {
3144
- id: "hmr-indicator",
3145
- style: {
3146
- position: "fixed",
3147
- top: "20px",
3148
- right: "20px",
3149
- background: config.bg,
3150
- color: "white",
3151
- padding: "12px 20px",
3152
- borderRadius: "8px",
3153
- fontSize: "14px",
3154
- fontWeight: "600",
3155
- display: config.show ? "block" : "none",
3156
- boxShadow: `0 4px 12px ${config.bg}40`,
3157
- animation: "slideIn 0.3s ease-out",
3158
- zIndex: 9999,
3159
- transition: "all 0.3s ease"
3160
- }
3161
- }, config.text);
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
+ );
3162
3635
  }
3163
3636
 
3164
3637
  // lib/client/elementRegistry.ts
@@ -3226,6 +3699,7 @@ var ComponentRegistry = class extends BaseComponentRegistry {
3226
3699
  var globalComponentRegistry = new ComponentRegistry();
3227
3700
 
3228
3701
  // lib/client/styles/StyleInjector.ts
3702
+ init_errorLogger();
3229
3703
  function simpleHash(str) {
3230
3704
  let hash = 0;
3231
3705
  for (let i = 0; i < str.length; i++) {
@@ -3284,7 +3758,7 @@ var StyleInjector = class {
3284
3758
  processedCSSBlocks.push(`/* Component: ${name} (instance) */
3285
3759
  ${processedCSS}`);
3286
3760
  }
3287
- } catch (error) {
3761
+ } catch (_error) {
3288
3762
  processedCSSBlocks.push(`/* Component: ${name} */
3289
3763
  ${originalCSS}`);
3290
3764
  }
@@ -3366,6 +3840,7 @@ ${originalCSS}`);
3366
3840
  };
3367
3841
 
3368
3842
  // lib/client/scripts/ScriptExecutor.ts
3843
+ init_errorLogger();
3369
3844
  function generateDestructure(defineVars, interfaceDef) {
3370
3845
  const vars = defineVars === true ? Object.keys(interfaceDef || {}) : defineVars;
3371
3846
  if (vars.length === 0) return "";
@@ -3394,7 +3869,7 @@ var ScriptExecutor = class {
3394
3869
  */
3395
3870
  shouldBind(el, componentName) {
3396
3871
  let names = this.boundElements.get(el);
3397
- if (names && names.has(componentName)) return false;
3872
+ if (names?.has(componentName)) return false;
3398
3873
  if (!names) {
3399
3874
  names = /* @__PURE__ */ new Set();
3400
3875
  this.boundElements.set(el, names);
@@ -3411,7 +3886,7 @@ var ScriptExecutor = class {
3411
3886
  * @private
3412
3887
  */
3413
3888
  executeWrappedJS(jsCode, componentName) {
3414
- if (!jsCode || !jsCode.trim()) return;
3889
+ if (!jsCode?.trim()) return;
3415
3890
  const wrappedJS = `(function() {
3416
3891
  // Component: ${componentName}
3417
3892
  try {
@@ -3447,7 +3922,7 @@ var ScriptExecutor = class {
3447
3922
  try {
3448
3923
  const processedJS = processCodeTemplates(originalJS, props);
3449
3924
  this.executeWrappedJS(processedJS, `${componentName} (instance: ${rootPath})`);
3450
- } catch (templateError) {
3925
+ } catch (_templateError) {
3451
3926
  this.executeWrappedJS(originalJS, `${componentName} (instance: ${rootPath})`);
3452
3927
  }
3453
3928
  } catch (e) {
@@ -3513,12 +3988,7 @@ var ScriptExecutor = class {
3513
3988
  const defineVars = component.component.defineVars;
3514
3989
  if (defineVars) {
3515
3990
  if (!executedComponents.has(componentName)) {
3516
- this.executeWithInitPattern(
3517
- componentName,
3518
- originalJS,
3519
- defineVars,
3520
- component.component.interface
3521
- );
3991
+ this.executeWithInitPattern(componentName, originalJS, defineVars, component.component.interface);
3522
3992
  executedComponents.add(componentName);
3523
3993
  }
3524
3994
  } else if (hasTemplates(originalJS)) {
@@ -3562,12 +4032,7 @@ var ScriptExecutor = class {
3562
4032
  const originalJS = component.component.javascript;
3563
4033
  const defineVars = component.component.defineVars;
3564
4034
  if (defineVars) {
3565
- this.executeWithInitPattern(
3566
- componentName,
3567
- originalJS,
3568
- defineVars,
3569
- component.component.interface
3570
- );
4035
+ this.executeWithInitPattern(componentName, originalJS, defineVars, component.component.interface);
3571
4036
  } else if (hasTemplates(originalJS)) {
3572
4037
  const componentRootPaths = this.elementRegistry.getComponentRootPaths(componentName);
3573
4038
  for (const rootPath of componentRootPaths) {
@@ -3695,12 +4160,12 @@ var PrefetchService = class {
3695
4160
  */
3696
4161
  enforceCacheLimit() {
3697
4162
  if (this.cache.size <= this.config.maxCacheSize) return;
3698
- const entries = Array.from(this.cache.entries()).sort(
3699
- (a, b) => a[1].timestamp - b[1].timestamp
3700
- );
4163
+ const entries = Array.from(this.cache.entries()).sort((a, b) => a[1].timestamp - b[1].timestamp);
3701
4164
  const toRemove = this.cache.size - this.config.maxCacheSize;
3702
4165
  for (let i = 0; i < toRemove; i++) {
3703
- this.cache.delete(entries[i][0]);
4166
+ const entry = entries[i];
4167
+ if (entry === void 0) continue;
4168
+ this.cache.delete(entry[0]);
3704
4169
  }
3705
4170
  }
3706
4171
  /**
@@ -3713,14 +4178,11 @@ var PrefetchService = class {
3713
4178
  const abortController = new AbortController();
3714
4179
  this.pendingPrefetches.set(path, abortController);
3715
4180
  try {
3716
- const response = await fetch(
3717
- `${API_ROUTES.PAGE_CONTENT}?page=${encodeURIComponent(path)}`,
3718
- {
3719
- signal: abortController.signal,
3720
- // Allow browser caching for prefetched content
3721
- cache: "default"
3722
- }
3723
- );
4181
+ const response = await fetch(`${API_ROUTES.PAGE_CONTENT}?page=${encodeURIComponent(path)}`, {
4182
+ signal: abortController.signal,
4183
+ // Allow browser caching for prefetched content
4184
+ cache: "default"
4185
+ });
3724
4186
  if (!response.ok) {
3725
4187
  this.pendingPrefetches.delete(path);
3726
4188
  return;
@@ -3801,7 +4263,7 @@ var PrefetchService = class {
3801
4263
  if (entry.isIntersecting) {
3802
4264
  const link = entry.target;
3803
4265
  const href = link.getAttribute("href");
3804
- if (href && href.startsWith("/")) {
4266
+ if (href?.startsWith("/")) {
3805
4267
  this.prefetch(href);
3806
4268
  }
3807
4269
  }
@@ -3852,13 +4314,19 @@ var PrefetchService = class {
3852
4314
  * Clear cache and cancel all pending operations
3853
4315
  */
3854
4316
  clear() {
3855
- this.pendingPrefetches.forEach((controller) => controller.abort());
4317
+ this.pendingPrefetches.forEach((controller) => {
4318
+ controller.abort();
4319
+ });
3856
4320
  this.pendingPrefetches.clear();
3857
- this.hoverTimeouts.forEach((timeout) => clearTimeout(timeout));
4321
+ this.hoverTimeouts.forEach((timeout) => {
4322
+ clearTimeout(timeout);
4323
+ });
3858
4324
  this.hoverTimeouts.clear();
3859
4325
  this.cache.clear();
3860
4326
  if (this.viewportObserver) {
3861
- this.observedLinks.forEach((link) => this.viewportObserver?.unobserve(link));
4327
+ this.observedLinks.forEach((link) => {
4328
+ this.viewportObserver?.unobserve(link);
4329
+ });
3862
4330
  this.observedLinks.clear();
3863
4331
  this.linkPathMap.clear();
3864
4332
  this.viewportObserver.disconnect();
@@ -3954,15 +4422,13 @@ function Router(props = {}) {
3954
4422
  const [currentPath, setCurrentPath] = useState2(initialPath);
3955
4423
  const [availablePages, setAvailablePages] = useState2([]);
3956
4424
  const [showNotFound, setShowNotFound] = useState2(false);
3957
- const [viewportWidth, setViewportWidth] = useState2(
3958
- typeof window !== "undefined" ? window.innerWidth : 1920
3959
- );
4425
+ const [viewportWidth, setViewportWidth] = useState2(typeof window !== "undefined" ? window.innerWidth : 1920);
3960
4426
  const [i18nConfig, setI18nConfig2] = useState2(DEFAULT_I18N_CONFIG);
3961
4427
  const [currentLocale, setCurrentLocale] = useState2(DEFAULT_I18N_CONFIG.defaultLocale);
3962
4428
  const [cmsContext, setCmsContext] = useState2(null);
3963
4429
  const [cmsLocale, setCmsLocale] = useState2(null);
3964
4430
  const [registryVersion, setRegistryVersion] = useState2(0);
3965
- const [awaitingCmsContext, setAwaitingCmsContext] = useState2(false);
4431
+ const [awaitingCmsContext, _setAwaitingCmsContext] = useState2(false);
3966
4432
  const [collectionItemsMap, setCollectionItemsMap] = useState2({});
3967
4433
  const [cmsTemplatePath, setCmsTemplatePath] = useState2(null);
3968
4434
  const lastCommitTimestampRef = useRef2(0);
@@ -3970,33 +4436,35 @@ function Router(props = {}) {
3970
4436
  const lastCommitStructureChangedRef = useRef2(true);
3971
4437
  const ssrCmsHandledRef = useRef2(false);
3972
4438
  const initialLoadDoneRef = useRef2(false);
3973
- const routeLoader = useRef2(new RouteLoader({
3974
- componentRegistry: services.componentRegistry,
3975
- prefetchService: services.prefetchService,
3976
- onLoadStart: () => {
3977
- setLoading(true);
3978
- setShowNotFound(false);
3979
- InteractiveStylesRegistry.clear();
3980
- UtilityClassCollector.clear();
3981
- if (componentTreeRef.current) {
3982
- setPreviousComponentTree(componentTreeRef.current);
3983
- }
3984
- },
3985
- onLoadComplete: (tree) => {
3986
- setComponentTree(tree);
3987
- setLoading(false);
3988
- setShowNotFound(false);
3989
- setPreviousComponentTree(null);
3990
- },
3991
- onLoadError: (error) => {
3992
- setLoading(false);
3993
- setShowNotFound(false);
3994
- setPreviousComponentTree(null);
3995
- },
3996
- onNotFound: () => setShowNotFound(true),
3997
- onPagesLoaded: (pages) => setAvailablePages(pages),
3998
- onLocaleDetected: (locale) => setCurrentLocale(locale)
3999
- })).current;
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;
4000
4468
  useEffect2(() => {
4001
4469
  componentTreeRef.current = componentTree;
4002
4470
  }, [componentTree]);
@@ -4013,6 +4481,20 @@ function Router(props = {}) {
4013
4481
  setStoredLocale(locale);
4014
4482
  });
4015
4483
  }, []);
4484
+ useEffect2(() => {
4485
+ const handleConfigUpdate = () => {
4486
+ invalidateI18nConfig();
4487
+ fetchI18nConfig().then((config) => {
4488
+ setI18nConfig2(config);
4489
+ setI18nConfig(config);
4490
+ routeLoader.setI18nConfig(config);
4491
+ setShowNotFound(false);
4492
+ loadComponentsRef.current(window.location.pathname);
4493
+ });
4494
+ };
4495
+ document.addEventListener("hmr-config-update", handleConfigUpdate);
4496
+ return () => document.removeEventListener("hmr-config-update", handleConfigUpdate);
4497
+ }, []);
4016
4498
  useEffect2(() => {
4017
4499
  const { locale } = parseLocaleFromPath(currentPath, i18nConfig);
4018
4500
  setCurrentLocale(locale);
@@ -4124,9 +4606,12 @@ function Router(props = {}) {
4124
4606
  useEffect2(() => {
4125
4607
  if (typeof window === "undefined") return;
4126
4608
  if (window.parent === window) return;
4127
- window.parent.postMessage({
4128
- type: IFRAME_MESSAGE_TYPES.CMS_CONTEXT_REQUEST
4129
- }, "*");
4609
+ window.parent.postMessage(
4610
+ {
4611
+ type: IFRAME_MESSAGE_TYPES.CMS_CONTEXT_REQUEST
4612
+ },
4613
+ "*"
4614
+ );
4130
4615
  }, []);
4131
4616
  useLayoutEffect(() => {
4132
4617
  const treeToRender2 = previewComponentTree || componentTree;
@@ -4141,10 +4626,13 @@ function Router(props = {}) {
4141
4626
  if (treeToRender2) {
4142
4627
  if (typeof window !== "undefined" && window.parent !== window) {
4143
4628
  const registryData = Object.fromEntries(InteractiveStylesRegistry.getAll());
4144
- window.parent.postMessage({
4145
- type: IFRAME_MESSAGE_TYPES.INTERACTIVE_STYLES_UPDATE,
4146
- styles: registryData
4147
- }, "*");
4629
+ window.parent.postMessage(
4630
+ {
4631
+ type: IFRAME_MESSAGE_TYPES.INTERACTIVE_STYLES_UPDATE,
4632
+ styles: registryData
4633
+ },
4634
+ "*"
4635
+ );
4148
4636
  }
4149
4637
  const shouldRunScripts = !disableScripts && lastCommitStructureChangedRef.current;
4150
4638
  lastCommitStructureChangedRef.current = true;
@@ -4173,17 +4661,23 @@ function Router(props = {}) {
4173
4661
  }, 100);
4174
4662
  return () => clearTimeout(timeoutId);
4175
4663
  }, [componentTree, currentPath, services]);
4176
- const loadComponents = useCallback(async (path) => {
4177
- const pathToLoad = cmsTemplatePath || path;
4178
- await routeLoader.loadComponents(pathToLoad);
4179
- }, [cmsTemplatePath]);
4180
- const loadComponentsForHMR = useCallback(async (path) => {
4181
- if (Date.now() - lastCommitTimestampRef.current < COMMIT_GRACE_MS) {
4182
- return;
4183
- }
4184
- const pathToLoad = cmsTemplatePath || path;
4185
- await routeLoader.loadComponents(pathToLoad);
4186
- }, [cmsTemplatePath]);
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
+ );
4187
4681
  const loadComponentsRef = useRef2(loadComponents);
4188
4682
  useEffect2(() => {
4189
4683
  loadComponentsRef.current = loadComponents;
@@ -4195,7 +4689,7 @@ function Router(props = {}) {
4195
4689
  const data = await response.json();
4196
4690
  setCollectionItemsMap((prev) => ({ ...prev, [collection]: data.items || [] }));
4197
4691
  }
4198
- } catch (error) {
4692
+ } catch (_error) {
4199
4693
  }
4200
4694
  }, []);
4201
4695
  useEffect2(() => {
@@ -4217,7 +4711,8 @@ function Router(props = {}) {
4217
4711
  delete window.__MENO_CMS__;
4218
4712
  }
4219
4713
  routeLoader.loadPages();
4220
- routeLoader.loadGlobalComponents().then(() => {
4714
+ Promise.all([routeLoader.loadGlobalComponents(), fetchI18nConfig()]).then(([, config]) => {
4715
+ routeLoader.setI18nConfig(config);
4221
4716
  const pathToLoad = ssrCmsContext ? ssrCmsContext.templatePath : currentPath;
4222
4717
  loadComponents(pathToLoad);
4223
4718
  });
@@ -4318,11 +4813,7 @@ function Router(props = {}) {
4318
4813
  }
4319
4814
  },
4320
4815
  h10("h2", null, `Page not found: ${currentPath}`),
4321
- h10(
4322
- "p",
4323
- { style: { marginTop: "16px", marginBottom: "24px", color: "#666" } },
4324
- "Available pages:"
4325
- ),
4816
+ h10("p", { style: { marginTop: "16px", marginBottom: "24px", color: "#666" } }, "Available pages:"),
4326
4817
  h10(
4327
4818
  "ul",
4328
4819
  {
@@ -4339,16 +4830,20 @@ function Router(props = {}) {
4339
4830
  (page, i) => h10(
4340
4831
  "li",
4341
4832
  { key: i },
4342
- h10("a", {
4343
- href: page,
4344
- onClick: createNavigationHandler(page),
4345
- style: {
4346
- color: "#0070f3",
4347
- textDecoration: "none",
4348
- fontSize: "18px",
4349
- fontWeight: "600"
4350
- }
4351
- }, page === "/" ? "Home (/)" : page)
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
+ )
4352
4847
  )
4353
4848
  )
4354
4849
  )
@@ -4520,7 +5015,9 @@ function initializeHMRListener() {
4520
5015
  cachedThemes = null;
4521
5016
  cachedDefaultTheme = null;
4522
5017
  await injectUpdatedThemeCSS();
4523
- hmrCallbacks.forEach((callback) => callback());
5018
+ hmrCallbacks.forEach((callback) => {
5019
+ callback();
5020
+ });
4524
5021
  });
4525
5022
  }
4526
5023
  if (typeof window !== "undefined") {
@@ -4540,11 +5037,11 @@ async function injectUpdatedThemeCSS() {
4540
5037
  }
4541
5038
  const defaultResponse = await fetch("/api/colors");
4542
5039
  if (defaultResponse.ok) {
4543
- themeColors["default"] = (await defaultResponse.json()).colors;
5040
+ themeColors.default = (await defaultResponse.json()).colors;
4544
5041
  }
4545
5042
  let css = "";
4546
- if (themeColors["default"]) {
4547
- const vars = Object.entries(themeColors["default"]).map(([name, value]) => ` --${name}: ${value};`).join("\n");
5043
+ if (themeColors.default) {
5044
+ const vars = Object.entries(themeColors.default).map(([name, value]) => ` --${name}: ${value};`).join("\n");
4548
5045
  css += `:root {
4549
5046
  ${vars}
4550
5047
  }
@@ -4552,8 +5049,9 @@ ${vars}
4552
5049
  `;
4553
5050
  }
4554
5051
  for (const theme of data.themes) {
4555
- if (themeColors[theme.name]) {
4556
- const vars = Object.entries(themeColors[theme.name]).map(([name, value]) => ` --${name}: ${value};`).join("\n");
5052
+ const themeVars = themeColors[theme.name];
5053
+ if (themeVars) {
5054
+ const vars = Object.entries(themeVars).map(([name, value]) => ` --${name}: ${value};`).join("\n");
4557
5055
  css += `[theme="${theme.name}"] {
4558
5056
  ${vars}
4559
5057
  }
@@ -4567,7 +5065,7 @@ ${vars}
4567
5065
  themeStyleTag.id = "hmr-theme-variables";
4568
5066
  applyNonce(themeStyleTag);
4569
5067
  const mainStyle = document.querySelector("style");
4570
- if (mainStyle && mainStyle.nextSibling) {
5068
+ if (mainStyle?.nextSibling) {
4571
5069
  document.head.insertBefore(themeStyleTag, mainStyle.nextSibling);
4572
5070
  } else {
4573
5071
  document.head.appendChild(themeStyleTag);
@@ -4579,7 +5077,9 @@ ${vars}
4579
5077
  }
4580
5078
  }
4581
5079
  function useColorVariables(themeName) {
4582
- const [colors, setColors] = useState3(themeName && cachedColors[themeName] ? cachedColors[themeName] : null);
5080
+ const [colors, setColors] = useState3(
5081
+ themeName && cachedColors[themeName] ? cachedColors[themeName] : null
5082
+ );
4583
5083
  const [loading, setLoading] = useState3(!cachedColors[themeName || "default"]);
4584
5084
  const [error, setError] = useState3(null);
4585
5085
  const callbackRef = useRef3(null);
@@ -4731,6 +5231,7 @@ function useTheme() {
4731
5231
  }
4732
5232
 
4733
5233
  // lib/client/styleProcessor.ts
5234
+ init_errorLogger();
4734
5235
  function mergeComponentStyles(componentDef, props) {
4735
5236
  try {
4736
5237
  let mergedProps = { ...componentDef.props || {} };
@@ -4750,7 +5251,10 @@ function mergeComponentStyles(componentDef, props) {
4750
5251
  mergedProps = { ...mergedProps, ...effectiveInputProps };
4751
5252
  try {
4752
5253
  if (structuredComponentDef.structure) {
4753
- const processed = processStructure(structuredComponentDef.structure, { props: effectiveInputProps, componentDef: structuredComponentDef });
5254
+ const processed = processStructure(structuredComponentDef.structure, {
5255
+ props: effectiveInputProps,
5256
+ componentDef: structuredComponentDef
5257
+ });
4754
5258
  if (processed && typeof processed === "object" && !Array.isArray(processed) && "props" in processed) {
4755
5259
  const processedProps = processed.props;
4756
5260
  const structureStyle = processedProps?.style && typeof processedProps.style === "object" && processedProps.style !== null && !Array.isArray(processedProps.style) ? processedProps.style : {};
@@ -4759,6 +5263,7 @@ function mergeComponentStyles(componentDef, props) {
4759
5263
  }
4760
5264
  }
4761
5265
  } catch (e) {
5266
+ logRuntimeError("styleProcessor.mergeStructureStyle", e);
4762
5267
  }
4763
5268
  const restProps = props || {};
4764
5269
  const normalizedMergedStyle = normalizeStyle(mergedProps.style) || {};
@@ -4772,18 +5277,33 @@ function mergeComponentStyles(componentDef, props) {
4772
5277
  }
4773
5278
  };
4774
5279
  return mergedProps;
4775
- } catch (error) {
5280
+ } catch (_error) {
4776
5281
  return props || {};
4777
5282
  }
4778
5283
  }
4779
5284
  function mergeStyles(...styles) {
4780
5285
  return styles.reduce((acc, style) => {
4781
5286
  if (!style) return acc;
4782
- return { ...acc, ...style };
5287
+ Object.assign(acc, style);
5288
+ return acc;
4783
5289
  }, {});
4784
5290
  }
4785
5291
 
4786
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
+ }
4787
5307
  async function injectUpdatedThemeCSS2() {
4788
5308
  try {
4789
5309
  const themesResponse = await fetch("/api/themes");
@@ -4791,20 +5311,18 @@ async function injectUpdatedThemeCSS2() {
4791
5311
  const themesData = await themesResponse.json();
4792
5312
  const themeColors = {};
4793
5313
  for (const theme of themesData.themes) {
4794
- const colorResponse = await fetch(
4795
- `/api/colors?theme=${encodeURIComponent(theme.name)}`
4796
- );
5314
+ const colorResponse = await fetch(`/api/colors?theme=${encodeURIComponent(theme.name)}`);
4797
5315
  if (colorResponse.ok) {
4798
5316
  themeColors[theme.name] = (await colorResponse.json()).colors;
4799
5317
  }
4800
5318
  }
4801
5319
  const defaultResponse = await fetch("/api/colors");
4802
5320
  if (defaultResponse.ok) {
4803
- themeColors["default"] = (await defaultResponse.json()).colors;
5321
+ themeColors.default = (await defaultResponse.json()).colors;
4804
5322
  }
4805
5323
  let css = "";
4806
- if (themeColors["default"]) {
4807
- const vars = Object.entries(themeColors["default"]).map(([name, value]) => ` --${name}: ${value};`).join("\n");
5324
+ if (themeColors.default) {
5325
+ const vars = Object.entries(themeColors.default).map(([name, value]) => ` --${name}: ${value};`).join("\n");
4808
5326
  css += `:root {
4809
5327
  ${vars}
4810
5328
  }
@@ -4812,8 +5330,9 @@ ${vars}
4812
5330
  `;
4813
5331
  }
4814
5332
  for (const theme of themesData.themes) {
4815
- if (themeColors[theme.name]) {
4816
- const vars = Object.entries(themeColors[theme.name]).map(([name, value]) => ` --${name}: ${value};`).join("\n");
5333
+ const themeVars = themeColors[theme.name];
5334
+ if (themeVars) {
5335
+ const vars = Object.entries(themeVars).map(([name, value]) => ` --${name}: ${value};`).join("\n");
4817
5336
  css += `[theme="${theme.name}"] {
4818
5337
  ${vars}
4819
5338
  }
@@ -4890,6 +5409,12 @@ function setupCssHmrListeners() {
4890
5409
  location.reload();
4891
5410
  });
4892
5411
  }
5412
+ if (!window.__hmrStylesheetInitialized) {
5413
+ window.__hmrStylesheetInitialized = true;
5414
+ document.addEventListener("hmr-stylesheet-update", () => {
5415
+ reloadExternalStylesheets();
5416
+ });
5417
+ }
4893
5418
  }
4894
5419
 
4895
5420
  // lib/client/fontFamiliesService.ts
@@ -4947,9 +5472,7 @@ function usePropertyAutocomplete(initialProperty = "") {
4947
5472
  const handleKeyDown = (e) => {
4948
5473
  if (e.key === "ArrowDown") {
4949
5474
  e.preventDefault();
4950
- setSelectedIndex(
4951
- (prev) => prev < suggestions.length - 1 ? prev + 1 : prev
4952
- );
5475
+ setSelectedIndex((prev) => prev < suggestions.length - 1 ? prev + 1 : prev);
4953
5476
  } else if (e.key === "ArrowUp") {
4954
5477
  e.preventDefault();
4955
5478
  setSelectedIndex((prev) => prev > 0 ? prev - 1 : -1);
@@ -4969,7 +5492,7 @@ function usePropertyAutocomplete(initialProperty = "") {
4969
5492
  }
4970
5493
 
4971
5494
  // lib/client/hooks/useVariables.ts
4972
- import { useState as useState6, useEffect as useEffect6, useRef as useRef5 } from "react";
5495
+ import { useState as useState6, useEffect as useEffect5, useRef as useRef5 } from "react";
4973
5496
  var cachedVariables = null;
4974
5497
  var hmrCallbacks2 = /* @__PURE__ */ new Set();
4975
5498
  function initializeHMRListener2() {
@@ -4978,7 +5501,9 @@ function initializeHMRListener2() {
4978
5501
  window.__hmrVariablesInitialized = true;
4979
5502
  document.addEventListener("hmr-variables-update", () => {
4980
5503
  cachedVariables = null;
4981
- hmrCallbacks2.forEach((callback) => callback());
5504
+ hmrCallbacks2.forEach((callback) => {
5505
+ callback();
5506
+ });
4982
5507
  });
4983
5508
  }
4984
5509
  if (typeof window !== "undefined") {
@@ -4989,7 +5514,7 @@ function useVariables() {
4989
5514
  const [loading, setLoading] = useState6(!cachedVariables);
4990
5515
  const [error, setError] = useState6(null);
4991
5516
  const callbackRef = useRef5(null);
4992
- useEffect6(() => {
5517
+ useEffect5(() => {
4993
5518
  const refreshCallback = async () => {
4994
5519
  try {
4995
5520
  const response = await fetch("/api/variables-status");
@@ -5059,6 +5584,7 @@ export {
5059
5584
  ThemeProvider,
5060
5585
  clearAllConfigCache,
5061
5586
  clearBreakpointConfigCache,
5587
+ clearKnownTokensCache,
5062
5588
  clearRemConversionConfigCache,
5063
5589
  clearResponsiveScalesConfigCache,
5064
5590
  createNavigationHandler,
@@ -5069,6 +5595,7 @@ export {
5069
5595
  fetchI18nConfig,
5070
5596
  getCachedBreakpointConfig,
5071
5597
  getCachedFontFamilies,
5598
+ getCachedKnownTokens,
5072
5599
  getCachedRemConversionConfig,
5073
5600
  getCachedResponsiveScalesConfig,
5074
5601
  getColorVariableSuggestions,
@@ -5089,6 +5616,7 @@ export {
5089
5616
  isI18nConfigLoaded,
5090
5617
  isLinkMapping,
5091
5618
  isResponsiveStyle,
5619
+ loadKnownTokens,
5092
5620
  mergeComponentStyles,
5093
5621
  mergeStyles,
5094
5622
  navigateTo,