meno-core 1.0.47 → 1.0.49

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 (97) hide show
  1. package/build-astro.ts +2 -2
  2. package/dist/build-static.js +7 -7
  3. package/dist/chunks/{chunk-UUA5LEWF.js → chunk-6IVUG7FY.js} +138 -7
  4. package/dist/chunks/chunk-6IVUG7FY.js.map +7 -0
  5. package/dist/chunks/{chunk-XSWR3QLI.js → chunk-AZQYF6KE.js} +261 -130
  6. package/dist/chunks/chunk-AZQYF6KE.js.map +7 -0
  7. package/dist/chunks/{chunk-47UNLQUU.js → chunk-CHD5UCFF.js} +57 -12
  8. package/dist/chunks/chunk-CHD5UCFF.js.map +7 -0
  9. package/dist/chunks/{chunk-FGUZOYJX.js → chunk-EQYDSPBB.js} +435 -131
  10. package/dist/chunks/chunk-EQYDSPBB.js.map +7 -0
  11. package/dist/chunks/{chunk-IF3RATBY.js → chunk-H4JSCDNW.js} +2 -2
  12. package/dist/chunks/{chunk-KITQJYZV.js → chunk-J23ZX5AP.js} +40 -4
  13. package/dist/chunks/chunk-J23ZX5AP.js.map +7 -0
  14. package/dist/chunks/{chunk-LJFB5EBT.js → chunk-JER5NQVM.js} +5 -5
  15. package/dist/chunks/{chunk-ZTKHJQ2Z.js → chunk-KPU2XHOS.js} +5 -2
  16. package/dist/chunks/{chunk-ZTKHJQ2Z.js.map → chunk-KPU2XHOS.js.map} +2 -2
  17. package/dist/chunks/{chunk-BCLGRZ3U.js → chunk-LKAGAQ3M.js} +2 -2
  18. package/dist/chunks/{chunk-FED5MME6.js → chunk-S2CX6HFM.js} +262 -26
  19. package/dist/chunks/chunk-S2CX6HFM.js.map +7 -0
  20. package/dist/chunks/{configService-DYCUEURL.js → configService-CCA6AIDI.js} +3 -3
  21. package/dist/entries/server-router.js +9 -9
  22. package/dist/entries/server-router.js.map +2 -2
  23. package/dist/lib/client/index.js +64 -20
  24. package/dist/lib/client/index.js.map +3 -3
  25. package/dist/lib/server/index.js +1737 -296
  26. package/dist/lib/server/index.js.map +4 -4
  27. package/dist/lib/shared/index.js +50 -10
  28. package/dist/lib/shared/index.js.map +3 -3
  29. package/entries/server-router.tsx +6 -2
  30. package/lib/client/core/ComponentBuilder.test.ts +17 -0
  31. package/lib/client/core/ComponentBuilder.ts +25 -1
  32. package/lib/client/core/builders/embedBuilder.ts +15 -2
  33. package/lib/client/core/builders/linkNodeBuilder.ts +15 -2
  34. package/lib/client/core/builders/localeListBuilder.ts +17 -6
  35. package/lib/client/styles/StyleInjector.ts +3 -2
  36. package/lib/client/theme.ts +4 -4
  37. package/lib/server/cssGenerator.test.ts +64 -1
  38. package/lib/server/cssGenerator.ts +48 -9
  39. package/lib/server/index.ts +1 -1
  40. package/lib/server/jsonLoader.test.ts +0 -17
  41. package/lib/server/jsonLoader.ts +0 -81
  42. package/lib/server/providers/fileSystemCMSProvider.test.ts +163 -0
  43. package/lib/server/providers/fileSystemCMSProvider.ts +200 -11
  44. package/lib/server/routes/api/variables.ts +4 -2
  45. package/lib/server/routes/index.ts +1 -1
  46. package/lib/server/routes/pages.ts +23 -1
  47. package/lib/server/services/cmsService.test.ts +246 -0
  48. package/lib/server/services/cmsService.ts +122 -5
  49. package/lib/server/services/configService.ts +5 -0
  50. package/lib/server/ssr/attributeBuilder.ts +41 -0
  51. package/lib/server/ssr/htmlGenerator.test.ts +114 -2
  52. package/lib/server/ssr/htmlGenerator.ts +53 -6
  53. package/lib/server/ssr/liveReloadIntegration.test.ts +209 -0
  54. package/lib/server/ssr/ssrRenderer.test.ts +362 -1
  55. package/lib/server/ssr/ssrRenderer.ts +216 -72
  56. package/lib/server/utils/jsonLineMapper.test.ts +53 -1
  57. package/lib/server/utils/jsonLineMapper.ts +43 -3
  58. package/lib/server/webflow/buildWebflow.ts +343 -123
  59. package/lib/server/webflow/index.ts +1 -0
  60. package/lib/server/webflow/nodeToWebflow.test.ts +3170 -0
  61. package/lib/server/webflow/nodeToWebflow.ts +2141 -129
  62. package/lib/server/webflow/styleMapper.test.ts +389 -0
  63. package/lib/server/webflow/styleMapper.ts +517 -63
  64. package/lib/server/webflow/templateWrapper.ts +49 -0
  65. package/lib/server/webflow/types.ts +218 -18
  66. package/lib/shared/cssGeneration.test.ts +267 -1
  67. package/lib/shared/cssGeneration.ts +240 -18
  68. package/lib/shared/cssProperties.test.ts +247 -1
  69. package/lib/shared/cssProperties.ts +196 -6
  70. package/lib/shared/elementClassName.test.ts +15 -0
  71. package/lib/shared/elementClassName.ts +7 -3
  72. package/lib/shared/interfaces/contentProvider.ts +39 -6
  73. package/lib/shared/pathSecurity.ts +16 -0
  74. package/lib/shared/registry/nodeTypes/ListNodeType.ts +1 -1
  75. package/lib/shared/responsiveScaling.test.ts +143 -0
  76. package/lib/shared/responsiveScaling.ts +253 -2
  77. package/lib/shared/themeDefaults.test.ts +3 -3
  78. package/lib/shared/themeDefaults.ts +3 -3
  79. package/lib/shared/types/cms.ts +28 -3
  80. package/lib/shared/types/index.ts +2 -0
  81. package/lib/shared/types/variables.ts +37 -0
  82. package/lib/shared/utilityClassConfig.ts +3 -0
  83. package/lib/shared/utilityClassMapper.test.ts +123 -0
  84. package/lib/shared/utilityClassMapper.ts +179 -8
  85. package/lib/shared/validation/schemas.ts +15 -1
  86. package/lib/shared/validation/validators.ts +26 -1
  87. package/package.json +1 -1
  88. package/dist/chunks/chunk-47UNLQUU.js.map +0 -7
  89. package/dist/chunks/chunk-FED5MME6.js.map +0 -7
  90. package/dist/chunks/chunk-FGUZOYJX.js.map +0 -7
  91. package/dist/chunks/chunk-KITQJYZV.js.map +0 -7
  92. package/dist/chunks/chunk-UUA5LEWF.js.map +0 -7
  93. package/dist/chunks/chunk-XSWR3QLI.js.map +0 -7
  94. /package/dist/chunks/{chunk-IF3RATBY.js.map → chunk-H4JSCDNW.js.map} +0 -0
  95. /package/dist/chunks/{chunk-LJFB5EBT.js.map → chunk-JER5NQVM.js.map} +0 -0
  96. /package/dist/chunks/{chunk-BCLGRZ3U.js.map → chunk-LKAGAQ3M.js.map} +0 -0
  97. /package/dist/chunks/{configService-DYCUEURL.js.map → configService-CCA6AIDI.js.map} +0 -0
@@ -11,15 +11,14 @@ import {
11
11
  loadI18nConfig,
12
12
  loadJSONFile,
13
13
  loadProjectConfig,
14
- loadResponsiveScalesConfig,
15
14
  mapPageNameToPath,
16
15
  parseJSON,
17
16
  resolveSlugToPageId,
18
17
  variableService
19
- } from "./chunk-FGUZOYJX.js";
18
+ } from "./chunk-EQYDSPBB.js";
20
19
  import {
21
20
  configService
22
- } from "./chunk-ZTKHJQ2Z.js";
21
+ } from "./chunk-KPU2XHOS.js";
23
22
  import {
24
23
  bundleFile,
25
24
  createRuntimeServer,
@@ -39,16 +38,16 @@ import {
39
38
  } from "./chunk-WQFG7PAH.js";
40
39
  import {
41
40
  extractStringValue
42
- } from "./chunk-IF3RATBY.js";
41
+ } from "./chunk-H4JSCDNW.js";
43
42
  import {
44
43
  isPathWithinRoot
45
- } from "./chunk-KITQJYZV.js";
44
+ } from "./chunk-J23ZX5AP.js";
46
45
  import {
47
46
  addItemUrls
48
- } from "./chunk-FED5MME6.js";
47
+ } from "./chunk-S2CX6HFM.js";
49
48
  import {
50
49
  parseLocaleFromPath
51
- } from "./chunk-XSWR3QLI.js";
50
+ } from "./chunk-AZQYF6KE.js";
52
51
  import {
53
52
  API_ROUTES,
54
53
  HMR_ROUTE,
@@ -306,6 +305,13 @@ function buildLineMap(jsonText) {
306
305
  }
307
306
  return { start: startPos, end: pos };
308
307
  }
308
+ function recordTrackedRoot(path2) {
309
+ const { start, end } = parseValue(path2, true);
310
+ lineMap.set("", {
311
+ startLine: charToLine[start],
312
+ endLine: charToLine[end - 1] || charToLine[start]
313
+ });
314
+ }
309
315
  function parseObject(path2, trackChildren) {
310
316
  pos++;
311
317
  skipWhitespace();
@@ -316,7 +322,9 @@ function buildLineMap(jsonText) {
316
322
  pos++;
317
323
  skipWhitespace();
318
324
  if (key === "root" && path2.length === 0) {
319
- parseValue(path2, true);
325
+ recordTrackedRoot(path2);
326
+ } else if (key === "component" && path2.length === 0) {
327
+ parseComponentWrapper(path2);
320
328
  } else if (key === "children" && trackChildren) {
321
329
  parseValue(path2, true);
322
330
  } else {
@@ -328,6 +336,30 @@ function buildLineMap(jsonText) {
328
336
  }
329
337
  pos++;
330
338
  }
339
+ function parseComponentWrapper(path2) {
340
+ if (jsonText[pos] !== "{") {
341
+ parseValue(path2, false);
342
+ return;
343
+ }
344
+ pos++;
345
+ skipWhitespace();
346
+ while (pos < jsonText.length && jsonText[pos] !== "}") {
347
+ skipWhitespace();
348
+ const key = parseString();
349
+ skipWhitespace();
350
+ pos++;
351
+ skipWhitespace();
352
+ if (key === "structure") {
353
+ recordTrackedRoot(path2);
354
+ } else {
355
+ parseValue(path2, false);
356
+ }
357
+ skipWhitespace();
358
+ if (jsonText[pos] === ",") pos++;
359
+ skipWhitespace();
360
+ }
361
+ pos++;
362
+ }
331
363
  function parseArray(path2, trackChildren) {
332
364
  pos++;
333
365
  skipWhitespace();
@@ -2029,9 +2061,10 @@ async function handleVariablesStatusRoute() {
2029
2061
  return jsonResponse(result);
2030
2062
  }
2031
2063
  async function handleVariablesCSSRoute() {
2064
+ await configService.load();
2032
2065
  const variablesConfig = await variableService.loadConfig();
2033
2066
  const breakpointConfig = await loadBreakpointConfig();
2034
- const responsiveScalesConfig = await loadResponsiveScalesConfig();
2067
+ const responsiveScalesConfig = configService.getResponsiveScales();
2035
2068
  const css = generateVariablesCSS(variablesConfig, breakpointConfig, responsiveScalesConfig);
2036
2069
  return new Response(css, {
2037
2070
  headers: { "Content-Type": "text/css" }
@@ -2600,9 +2633,11 @@ function hashContent2(content) {
2600
2633
  }
2601
2634
 
2602
2635
  // lib/server/routes/pages.ts
2603
- async function handlePageRoute(url, context) {
2636
+ var EDITOR_HEADER = "x-meno-editor";
2637
+ async function handlePageRoute(url, context, req) {
2604
2638
  const { pageService, componentService, cmsService, injectLiveReload, isEditor, serverPort } = context;
2605
2639
  const pagePath = url.pathname;
2640
+ const injectEditorAttrs = req?.headers.get(EDITOR_HEADER) === "1";
2606
2641
  const i18nConfig = await loadI18nConfig();
2607
2642
  const { locale, pathWithoutLocale } = parseLocaleFromPath(pagePath, i18nConfig);
2608
2643
  const slugMappings = pageService.getSlugMappings();
@@ -2610,6 +2645,12 @@ async function handlePageRoute(url, context) {
2610
2645
  if (cmsService) {
2611
2646
  const cmsMatch = await cmsService.matchRoute(pathWithoutLocale, locale);
2612
2647
  if (cmsMatch) {
2648
+ if (injectEditorAttrs && url.searchParams.get("previewDraft") === "1" && cmsMatch.item._filename) {
2649
+ const draft = await cmsService.getDraft(cmsMatch.collection, cmsMatch.item._filename);
2650
+ if (draft) {
2651
+ cmsMatch.item = draft;
2652
+ }
2653
+ }
2613
2654
  const templatePageContent = await loadPageByFilePath(cmsMatch.pagePath);
2614
2655
  if (templatePageContent) {
2615
2656
  const templatesDir = projectPaths.templates();
@@ -2634,6 +2675,7 @@ async function handlePageRoute(url, context) {
2634
2675
  pageLibraries: typedPageData.meta?.libraries,
2635
2676
  pageCustomCode: typedPageData.meta?.customCode,
2636
2677
  injectLiveReload,
2678
+ injectEditorAttrs,
2637
2679
  isEditor,
2638
2680
  serverPort,
2639
2681
  returnSeparateJS: true
@@ -2667,6 +2709,7 @@ async function handlePageRoute(url, context) {
2667
2709
  cmsTemplatePath,
2668
2710
  pageLibraries: typedPageData.meta?.libraries,
2669
2711
  pageCustomCode: typedPageData.meta?.customCode,
2712
+ injectEditorAttrs,
2670
2713
  isEditor
2671
2714
  });
2672
2715
  return new Response(ssrHTML, {
@@ -2727,6 +2770,7 @@ async function handlePageRoute(url, context) {
2727
2770
  pageLibraries: pageData.meta?.libraries,
2728
2771
  pageCustomCode: pageData.meta?.customCode,
2729
2772
  injectLiveReload,
2773
+ injectEditorAttrs,
2730
2774
  isEditor,
2731
2775
  serverPort,
2732
2776
  returnSeparateJS: true
@@ -2758,6 +2802,7 @@ async function handlePageRoute(url, context) {
2758
2802
  cmsService,
2759
2803
  pageLibraries: pageData.meta?.libraries,
2760
2804
  pageCustomCode: pageData.meta?.customCode,
2805
+ injectEditorAttrs,
2761
2806
  isEditor
2762
2807
  });
2763
2808
  return new Response(ssrHTML, {
@@ -2934,7 +2979,7 @@ async function handleRoutes(req, url, server, context) {
2934
2979
  }
2935
2980
  }
2936
2981
  if (url.pathname === "/" || url.pathname.startsWith("/") && !url.pathname.includes(".")) {
2937
- const response2 = await handlePageRoute(url, context);
2982
+ const response2 = await handlePageRoute(url, context, req);
2938
2983
  logResponseTime(startTime, req);
2939
2984
  return response2;
2940
2985
  }
@@ -3221,4 +3266,4 @@ export {
3221
3266
  createServer,
3222
3267
  FileSystemPageProvider
3223
3268
  };
3224
- //# sourceMappingURL=chunk-47UNLQUU.js.map
3269
+ //# sourceMappingURL=chunk-CHD5UCFF.js.map