meno-core 1.0.45 → 1.0.47

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 (63) hide show
  1. package/build-astro.ts +211 -124
  2. package/dist/bin/cli.js +2 -2
  3. package/dist/build-static.js +7 -7
  4. package/dist/chunks/{chunk-NZTSJS5C.js → chunk-2QK6U5UK.js} +3 -2
  5. package/dist/chunks/{chunk-NZTSJS5C.js.map → chunk-2QK6U5UK.js.map} +2 -2
  6. package/dist/chunks/{chunk-TVH3TC2T.js → chunk-47UNLQUU.js} +6 -6
  7. package/dist/chunks/{chunk-F7MA62WG.js → chunk-BCLGRZ3U.js} +5 -5
  8. package/dist/chunks/{chunk-F7MA62WG.js.map → chunk-BCLGRZ3U.js.map} +2 -2
  9. package/dist/chunks/{chunk-5ZASE4IG.js → chunk-FED5MME6.js} +234 -11
  10. package/dist/chunks/{chunk-5ZASE4IG.js.map → chunk-FED5MME6.js.map} +3 -3
  11. package/dist/chunks/{chunk-BZQKEJQY.js → chunk-FGUZOYJX.js} +49 -30
  12. package/dist/chunks/chunk-FGUZOYJX.js.map +7 -0
  13. package/dist/chunks/{chunk-5Z5VQRTJ.js → chunk-I7YIGZXT.js} +4 -4
  14. package/dist/chunks/{chunk-5Z5VQRTJ.js.map → chunk-I7YIGZXT.js.map} +2 -2
  15. package/dist/chunks/{chunk-OUNJ76QM.js → chunk-LJFB5EBT.js} +5 -5
  16. package/dist/chunks/{chunk-GYF3ABI3.js → chunk-UUA5LEWF.js} +3 -3
  17. package/dist/chunks/{chunk-GYF3ABI3.js.map → chunk-UUA5LEWF.js.map} +2 -2
  18. package/dist/chunks/{chunk-WQSG5WHC.js → chunk-ZTKHJQ2Z.js} +2 -2
  19. package/dist/chunks/{configService-6KTT6GRT.js → configService-DYCUEURL.js} +3 -3
  20. package/dist/chunks/{constants-L5IKLB6U.js → constants-GWBAD66U.js} +2 -2
  21. package/dist/entries/server-router.js +7 -7
  22. package/dist/lib/client/index.js +7 -5
  23. package/dist/lib/client/index.js.map +2 -2
  24. package/dist/lib/server/index.js +631 -208
  25. package/dist/lib/server/index.js.map +3 -3
  26. package/dist/lib/shared/index.js +7 -3
  27. package/dist/lib/shared/index.js.map +2 -2
  28. package/dist/lib/test-utils/index.js +1 -1
  29. package/lib/client/core/ComponentBuilder.test.ts +21 -0
  30. package/lib/client/core/ComponentBuilder.ts +8 -1
  31. package/lib/client/templateEngine.test.ts +64 -0
  32. package/lib/server/astro/astroEmitHelpers.ts +23 -0
  33. package/lib/server/astro/cmsPageEmitter.ts +46 -3
  34. package/lib/server/astro/componentEmitter.test.ts +59 -0
  35. package/lib/server/astro/componentEmitter.ts +53 -12
  36. package/lib/server/astro/cssCollector.ts +58 -11
  37. package/lib/server/astro/nodeToAstro.test.ts +397 -5
  38. package/lib/server/astro/nodeToAstro.ts +494 -65
  39. package/lib/server/astro/pageEmitter.ts +46 -3
  40. package/lib/server/astro/tailwindMapper.test.ts +119 -0
  41. package/lib/server/astro/tailwindMapper.ts +67 -1
  42. package/lib/server/runtime/httpServer.ts +12 -4
  43. package/lib/server/ssr/htmlGenerator.test.ts +3 -2
  44. package/lib/server/ssr/htmlGenerator.ts +6 -1
  45. package/lib/server/ssr/imageMetadata.ts +15 -9
  46. package/lib/server/ssr/jsCollector.ts +2 -2
  47. package/lib/server/ssr/ssrRenderer.test.ts +79 -0
  48. package/lib/server/ssr/ssrRenderer.ts +35 -20
  49. package/lib/shared/constants.ts +1 -0
  50. package/lib/shared/cssGeneration.test.ts +109 -3
  51. package/lib/shared/cssGeneration.ts +98 -13
  52. package/lib/shared/cssNamedColors.ts +47 -0
  53. package/lib/shared/cssProperties.ts +2 -2
  54. package/lib/shared/index.ts +1 -0
  55. package/lib/shared/styleNodeUtils.test.ts +47 -1
  56. package/lib/shared/styleNodeUtils.ts +7 -7
  57. package/package.json +1 -1
  58. package/dist/chunks/chunk-BZQKEJQY.js.map +0 -7
  59. /package/dist/chunks/{chunk-TVH3TC2T.js.map → chunk-47UNLQUU.js.map} +0 -0
  60. /package/dist/chunks/{chunk-OUNJ76QM.js.map → chunk-LJFB5EBT.js.map} +0 -0
  61. /package/dist/chunks/{chunk-WQSG5WHC.js.map → chunk-ZTKHJQ2Z.js.map} +0 -0
  62. /package/dist/chunks/{configService-6KTT6GRT.js.map → configService-DYCUEURL.js.map} +0 -0
  63. /package/dist/chunks/{constants-L5IKLB6U.js.map → constants-GWBAD66U.js.map} +0 -0
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  configService
3
- } from "./chunk-WQSG5WHC.js";
3
+ } from "./chunk-ZTKHJQ2Z.js";
4
4
  import {
5
5
  projectPaths,
6
6
  resolveProjectPath,
7
7
  validateJS
8
- } from "./chunk-5Z5VQRTJ.js";
8
+ } from "./chunk-I7YIGZXT.js";
9
9
  import {
10
10
  fileExists,
11
11
  readJsonFile,
@@ -23,7 +23,7 @@ import {
23
23
  processStructure,
24
24
  resolveHtmlMapping,
25
25
  skipEmptyTemplateAttributes
26
- } from "./chunk-F7MA62WG.js";
26
+ } from "./chunk-BCLGRZ3U.js";
27
27
  import {
28
28
  DEFAULT_PREFETCH_CONFIG,
29
29
  SSRRegistry,
@@ -62,7 +62,7 @@ import {
62
62
  singularize,
63
63
  validateCMSItem,
64
64
  validateComponentDefinition
65
- } from "./chunk-5ZASE4IG.js";
65
+ } from "./chunk-FED5MME6.js";
66
66
  import {
67
67
  DEFAULT_BREAKPOINTS,
68
68
  DEFAULT_I18N_CONFIG,
@@ -83,7 +83,7 @@ import {
83
83
  NODE_TYPE,
84
84
  RAW_HTML_PREFIX,
85
85
  init_constants
86
- } from "./chunk-NZTSJS5C.js";
86
+ } from "./chunk-2QK6U5UK.js";
87
87
  import {
88
88
  __require
89
89
  } from "./chunk-KSBZ2L7C.js";
@@ -1663,7 +1663,9 @@ __meno.initComponent("${name}", function(el, props) {
1663
1663
  });`);
1664
1664
  } else {
1665
1665
  jsCodeBlocks.push(`// Component: ${name}
1666
- ${js}`);
1666
+ (function(){
1667
+ ${js}
1668
+ })();`);
1667
1669
  }
1668
1670
  };
1669
1671
  for (const [name, component] of Object.entries(globalComponents)) {
@@ -1759,14 +1761,17 @@ async function buildImageMetadataMap() {
1759
1761
  );
1760
1762
  }
1761
1763
  }
1762
- const mainWidth = entry.width || 2400;
1763
- if (entry.formats.webp) {
1764
- webpSrcsetParts.push(`/images/${encodeURIComponent(`${baseName}.webp`)} ${mainWidth}w`);
1765
- } else {
1766
- webpSrcsetParts.push(`/images/${encodeURIComponent(filename)} ${mainWidth}w`);
1767
- }
1768
- if (entry.formats.avif) {
1769
- avifSrcsetParts.push(`/images/${encodeURIComponent(`${baseName}.avif`)} ${mainWidth}w`);
1764
+ const hasVariants = entry.variants.length > 0;
1765
+ if (hasVariants) {
1766
+ const mainWidth = entry.width || 2400;
1767
+ if (entry.formats.webp) {
1768
+ webpSrcsetParts.push(`/images/${encodeURIComponent(`${baseName}.webp`)} ${mainWidth}w`);
1769
+ } else {
1770
+ webpSrcsetParts.push(`/images/${encodeURIComponent(filename)} ${mainWidth}w`);
1771
+ }
1772
+ if (entry.formats.avif) {
1773
+ avifSrcsetParts.push(`/images/${encodeURIComponent(`${baseName}.avif`)} ${mainWidth}w`);
1774
+ }
1770
1775
  }
1771
1776
  const metadata = {
1772
1777
  srcset: webpSrcsetParts.join(", "),
@@ -2071,7 +2076,8 @@ async function buildComponentHTML(node, globalComponents = {}, pageComponents =
2071
2076
  const preloadImages = [];
2072
2077
  const neededCollections = /* @__PURE__ */ new Set();
2073
2078
  const ssrFallbackCollector = /* @__PURE__ */ new Map();
2074
- if (!node) return { html: "", interactiveStylesMap, preloadImages, neededCollections, ssrFallbackCollector };
2079
+ const processedRawHtmlCollector = /* @__PURE__ */ new Map();
2080
+ if (!node) return { html: "", interactiveStylesMap, preloadImages, neededCollections, ssrFallbackCollector, processedRawHtmlCollector };
2075
2081
  ssrComponentRegistry.merge(globalComponents);
2076
2082
  ssrComponentRegistry.merge(pageComponents);
2077
2083
  const breakpoints = await loadBreakpointConfig();
@@ -2098,10 +2104,12 @@ async function buildComponentHTML(node, globalComponents = {}, pageComponents =
2098
2104
  isProductionBuild,
2099
2105
  ssrFallbackCollector,
2100
2106
  // Collect SSR fallback HTML for complex nodes
2107
+ processedRawHtmlCollector,
2108
+ // Collect raw→processed HTML for Astro exporter
2101
2109
  imageFormat: configService.getImageFormat()
2102
2110
  };
2103
2111
  const html = await renderNode(node, ctx);
2104
- return { html, interactiveStylesMap, preloadImages, neededCollections, ssrFallbackCollector };
2112
+ return { html, interactiveStylesMap, preloadImages, neededCollections, ssrFallbackCollector, processedRawHtmlCollector };
2105
2113
  }
2106
2114
  async function renderNestedListPlaceholder(node, ctx) {
2107
2115
  const sourceValue = node.source || node.collection;
@@ -2339,10 +2347,12 @@ async function renderNode(node, ctx) {
2339
2347
  text = processCMSTemplate(text, ctx.cmsContext.cms, locale, i18nConfig);
2340
2348
  }
2341
2349
  if (text.startsWith(RAW_HTML_PREFIX)) {
2342
- let rawHtml = text.slice(RAW_HTML_PREFIX.length);
2350
+ const rawSlice = text.slice(RAW_HTML_PREFIX.length);
2351
+ let rawHtml = rawSlice;
2343
2352
  if (ctx.imageMetadataMap) rawHtml = rewriteRichTextImages(rawHtml, ctx.imageMetadataMap, ctx.imageFormat);
2344
2353
  rawHtml = await expandRichTextComponents(rawHtml, ctx);
2345
2354
  rawHtml = localizeRichTextLinks(rawHtml, ctx);
2355
+ ctx.processedRawHtmlCollector?.set(rawSlice, rawHtml);
2346
2356
  return rawHtml;
2347
2357
  }
2348
2358
  return escapeHtml(text);
@@ -2355,10 +2365,12 @@ async function renderNode(node, ctx) {
2355
2365
  text = processCMSTemplate(text, ctx.cmsContext.cms, locale, i18nConfig);
2356
2366
  }
2357
2367
  if (text.startsWith(RAW_HTML_PREFIX)) {
2358
- let rawHtml = text.slice(RAW_HTML_PREFIX.length);
2368
+ const rawSlice = text.slice(RAW_HTML_PREFIX.length);
2369
+ let rawHtml = rawSlice;
2359
2370
  if (ctx.imageMetadataMap) rawHtml = rewriteRichTextImages(rawHtml, ctx.imageMetadataMap, ctx.imageFormat);
2360
2371
  rawHtml = await expandRichTextComponents(rawHtml, ctx);
2361
2372
  rawHtml = localizeRichTextLinks(rawHtml, ctx);
2373
+ ctx.processedRawHtmlCollector?.set(rawSlice, rawHtml);
2362
2374
  return rawHtml;
2363
2375
  }
2364
2376
  return escapeHtml(text);
@@ -2615,11 +2627,11 @@ async function renderComponent(componentName, propsWithStyleAndAttrs, children,
2615
2627
  return await renderNode(processedStructure, ctx);
2616
2628
  }
2617
2629
  const rootNode = processedStructure;
2618
- if (isComponentNode(rootNode) || isHtmlNode(rootNode)) {
2630
+ if (isComponentNode(rootNode) || isHtmlNode(rootNode) || isLinkNode(rootNode)) {
2619
2631
  if (!rootNode.props) {
2620
2632
  rootNode.props = {};
2621
2633
  }
2622
- if (isHtmlNode(rootNode)) {
2634
+ if (isHtmlNode(rootNode) || isLinkNode(rootNode)) {
2623
2635
  if (propsWithStyleAndAttrs.style) {
2624
2636
  const existingStyle = rootNode.style;
2625
2637
  if (existingStyle && typeof existingStyle === "object") {
@@ -2642,7 +2654,7 @@ async function renderComponent(componentName, propsWithStyleAndAttrs, children,
2642
2654
  }
2643
2655
  }
2644
2656
  if (propsWithStyleAndAttrs.className) {
2645
- if (isHtmlNode(rootNode)) {
2657
+ if (isHtmlNode(rootNode) || isLinkNode(rootNode)) {
2646
2658
  if (!rootNode.attributes) rootNode.attributes = {};
2647
2659
  const existingClass = rootNode.attributes.class || "";
2648
2660
  rootNode.attributes.class = existingClass ? `${existingClass} ${propsWithStyleAndAttrs.className}` : propsWithStyleAndAttrs.className;
@@ -2652,7 +2664,7 @@ async function renderComponent(componentName, propsWithStyleAndAttrs, children,
2652
2664
  }
2653
2665
  }
2654
2666
  Object.assign(rootNode.props, nodeAttributes);
2655
- if (isHtmlNode(rootNode) && Object.keys(nodeAttributes).length > 0) {
2667
+ if ((isHtmlNode(rootNode) || isLinkNode(rootNode)) && Object.keys(nodeAttributes).length > 0) {
2656
2668
  if (!rootNode.attributes) {
2657
2669
  rootNode.attributes = {};
2658
2670
  }
@@ -2741,13 +2753,13 @@ async function renderHtmlElement(tag, propsWithStyleAndAttrs, children, ctx) {
2741
2753
  const voidElements = ["img", "input", "br", "hr", "meta", "link", "area", "base", "col", "embed", "source", "track", "wbr"];
2742
2754
  if (voidElements.includes(tag.toLowerCase())) {
2743
2755
  if (tag.toLowerCase() === "img") {
2744
- return renderImageElement(propsWithStyleAndAttrs, classAttr, attrs, ctx);
2756
+ return renderImageElement(propsWithStyleAndAttrs, classAttr, styleAttr, attrs, ctx);
2745
2757
  }
2746
2758
  return `<${tag}${classAttr}${styleAttr}${attrs} />`;
2747
2759
  }
2748
2760
  return `<${tag}${classAttr}${styleAttr}${attrs}>${childrenHTML}</${tag}>`;
2749
2761
  }
2750
- function renderImageElement(propsWithStyleAndAttrs, classAttr, attrs, ctx) {
2762
+ function renderImageElement(propsWithStyleAndAttrs, classAttr, styleAttr, attrs, ctx) {
2751
2763
  const imgProps = propsWithStyleAndAttrs;
2752
2764
  const src = imgProps.src;
2753
2765
  const alt = imgProps.alt;
@@ -2809,13 +2821,13 @@ function renderImageElement(propsWithStyleAndAttrs, classAttr, attrs, ctx) {
2809
2821
  }
2810
2822
  const pictureClassAttr = pictureClasses.length > 0 ? ` class="${escapeHtml(pictureClasses.join(" "))}"` : "";
2811
2823
  const imgClassAttr = imgClasses.length > 0 ? ` class="${escapeHtml(imgClasses.join(" "))}"` : "";
2812
- return `<picture${pictureClassAttr}><source type="image/avif" srcset="${escapeHtml(metadata.avifSrcset)}" sizes="${escapeHtml(sizesAttr)}" /><source type="image/webp" srcset="${escapeHtml(metadata.srcset)}" sizes="${escapeHtml(sizesAttr)}" /><img${imgClassAttr}${imgAttrs}${attrs} /></picture>`;
2824
+ return `<picture${pictureClassAttr}${styleAttr}><source type="image/avif" srcset="${escapeHtml(metadata.avifSrcset)}" sizes="${escapeHtml(sizesAttr)}" /><source type="image/webp" srcset="${escapeHtml(metadata.srcset)}" sizes="${escapeHtml(sizesAttr)}" /><img${imgClassAttr}${imgAttrs}${attrs} /></picture>`;
2813
2825
  }
2814
2826
  if (metadata?.srcset) {
2815
2827
  imgAttrs += ` srcset="${escapeHtml(metadata.srcset)}"`;
2816
2828
  imgAttrs += ` sizes="${escapeHtml(sizesAttr)}"`;
2817
2829
  }
2818
- return `<img${classAttr}${imgAttrs}${attrs} />`;
2830
+ return `<img${classAttr}${styleAttr}${imgAttrs}${attrs} />`;
2819
2831
  }
2820
2832
  function renderLocaleList(node, ctx) {
2821
2833
  const { slugMappings, pagePath, i18nConfig, locale } = ctx;
@@ -2933,7 +2945,7 @@ async function renderPageSSR(pageData, globalComponents = {}, pagePath = "/", ba
2933
2945
  }
2934
2946
  }
2935
2947
  const pageComponents = pageData?.components || {};
2936
- const { html: contentHTML, interactiveStylesMap, preloadImages, neededCollections, ssrFallbackCollector } = rootNode ? await buildComponentHTML(rootNode, globalComponents, pageComponents, effectiveLocale, config, slugMappings, pagePath, cmsContext, cmsService, isProductionBuild) : { html: "", interactiveStylesMap: /* @__PURE__ */ new Map(), preloadImages: [], neededCollections: /* @__PURE__ */ new Set(), ssrFallbackCollector: /* @__PURE__ */ new Map() };
2948
+ const { html: contentHTML, interactiveStylesMap, preloadImages, neededCollections, ssrFallbackCollector, processedRawHtmlCollector } = rootNode ? await buildComponentHTML(rootNode, globalComponents, pageComponents, effectiveLocale, config, slugMappings, pagePath, cmsContext, cmsService, isProductionBuild) : { html: "", interactiveStylesMap: /* @__PURE__ */ new Map(), preloadImages: [], neededCollections: /* @__PURE__ */ new Set(), ssrFallbackCollector: /* @__PURE__ */ new Map(), processedRawHtmlCollector: /* @__PURE__ */ new Map() };
2937
2949
  const javascript = await collectComponentJavaScript(globalComponents, pageComponents);
2938
2950
  const componentCSS = collectComponentCSS(globalComponents, pageComponents);
2939
2951
  const fullUrl = baseUrl ? `${baseUrl}${pagePath}` : pagePath;
@@ -2954,7 +2966,8 @@ async function renderPageSSR(pageData, globalComponents = {}, pagePath = "/", ba
2954
2966
  interactiveStylesMap,
2955
2967
  preloadImages,
2956
2968
  neededCollections,
2957
- ssrFallbackCollector
2969
+ ssrFallbackCollector,
2970
+ processedRawHtmlCollector
2958
2971
  };
2959
2972
  }
2960
2973
 
@@ -3415,7 +3428,7 @@ ${escapedJavaScript}
3415
3428
  const variablesCSS = generateVariablesCSS(variablesConfig, breakpointConfig, responsiveScalesConfig);
3416
3429
  const remConversionConfig = configService.getRemConversion();
3417
3430
  const utilityCSS = generateUtilityCSS(usedUtilityClasses, breakpointConfig, responsiveScalesConfig, remConversionConfig);
3418
- const interactiveCSS = rendered.interactiveStylesMap.size > 0 ? generateAllInteractiveCSS(rendered.interactiveStylesMap, breakpointConfig, remConversionConfig) : "";
3431
+ const interactiveCSS = rendered.interactiveStylesMap.size > 0 ? generateAllInteractiveCSS(rendered.interactiveStylesMap, breakpointConfig, remConversionConfig, responsiveScalesConfig) : "";
3419
3432
  printMissingStyleWarnings(false);
3420
3433
  const baseCSS = `* {
3421
3434
  margin: 0;
@@ -3433,12 +3446,17 @@ button {
3433
3446
  cursor: pointer;
3434
3447
  outline: inherit;
3435
3448
  }
3449
+ img {
3450
+ max-width: 100%;
3451
+ height: auto;
3452
+ }
3436
3453
  picture {
3437
3454
  display: block;
3438
3455
  }
3439
3456
  .olink {
3440
3457
  text-decoration: none;
3441
3458
  display: block;
3459
+ color: inherit;
3442
3460
  }
3443
3461
  .oem {
3444
3462
  display: inline-block;
@@ -5919,6 +5937,7 @@ export {
5919
5937
  loadBreakpointConfig,
5920
5938
  loadResponsiveScalesConfig,
5921
5939
  loadI18nConfig,
5940
+ loadIconsConfig,
5922
5941
  CachedConfigLoader,
5923
5942
  ColorService,
5924
5943
  colorService,
@@ -5965,4 +5984,4 @@ export {
5965
5984
  FileSystemCMSProvider,
5966
5985
  migrateTemplatesDirectory
5967
5986
  };
5968
- //# sourceMappingURL=chunk-BZQKEJQY.js.map
5987
+ //# sourceMappingURL=chunk-FGUZOYJX.js.map