meno-core 1.0.44 → 1.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-astro.ts +214 -63
- package/dist/bin/cli.js +2 -2
- package/dist/build-static.js +9 -9
- package/dist/chunks/{chunk-BXB6AX76.js → chunk-2QK6U5UK.js} +7 -3
- package/dist/chunks/chunk-2QK6U5UK.js.map +7 -0
- package/dist/chunks/{chunk-3XXLBUYA.js → chunk-77ZB6353.js} +33 -21
- package/dist/chunks/chunk-77ZB6353.js.map +7 -0
- package/dist/chunks/{chunk-5TJA272J.js → chunk-C6U5T5S5.js} +9 -9
- package/dist/chunks/{chunk-KPNSCQNA.js → chunk-FED5MME6.js} +285 -19
- package/dist/chunks/chunk-FED5MME6.js.map +7 -0
- package/dist/chunks/{chunk-5Z5VQRTJ.js → chunk-I7YIGZXT.js} +4 -4
- package/dist/chunks/{chunk-5Z5VQRTJ.js.map → chunk-I7YIGZXT.js.map} +2 -2
- package/dist/chunks/{chunk-46AVQA4V.js → chunk-IF3RATBY.js} +2 -2
- package/dist/chunks/{chunk-S2HXJTAF.js → chunk-KITQJYZV.js} +5 -1
- package/dist/chunks/chunk-KITQJYZV.js.map +7 -0
- package/dist/chunks/{chunk-G3WIPJN3.js → chunk-ORN7S4AP.js} +6 -6
- package/dist/chunks/{chunk-2NBGG2LJ.js → chunk-UUA5LEWF.js} +89 -4
- package/dist/chunks/{chunk-2NBGG2LJ.js.map → chunk-UUA5LEWF.js.map} +2 -2
- package/dist/chunks/{chunk-X5SH4HXS.js → chunk-XSWR3QLI.js} +33 -1
- package/dist/chunks/chunk-XSWR3QLI.js.map +7 -0
- package/dist/chunks/{chunk-YEJVSNVF.js → chunk-ZTKHJQ2Z.js} +14 -3
- package/dist/chunks/chunk-ZTKHJQ2Z.js.map +7 -0
- package/dist/chunks/{chunk-OLNQMCSR.js → chunk-ZWYDT3QJ.js} +3 -3
- package/dist/chunks/{configService-KYO3TXDS.js → configService-DYCUEURL.js} +4 -4
- package/dist/chunks/{constants-34NUGHQR.js → constants-GWBAD66U.js} +2 -2
- package/dist/entries/server-router.js +10 -10
- package/dist/lib/client/index.js +5 -5
- package/dist/lib/server/index.js +589 -145
- package/dist/lib/server/index.js.map +3 -3
- package/dist/lib/shared/index.js +14 -6
- package/dist/lib/shared/index.js.map +2 -2
- package/dist/lib/test-utils/index.js +1 -1
- package/lib/client/templateEngine.test.ts +64 -0
- package/lib/server/astro/astroEmitHelpers.ts +18 -0
- package/lib/server/astro/cmsPageEmitter.ts +31 -1
- package/lib/server/astro/componentEmitter.test.ts +59 -0
- package/lib/server/astro/componentEmitter.ts +43 -10
- package/lib/server/astro/cssCollector.ts +58 -11
- package/lib/server/astro/nodeToAstro.test.ts +397 -5
- package/lib/server/astro/nodeToAstro.ts +478 -63
- package/lib/server/astro/pageEmitter.ts +31 -1
- package/lib/server/astro/tailwindMapper.test.ts +119 -0
- package/lib/server/astro/tailwindMapper.ts +67 -1
- package/lib/server/runtime/httpServer.ts +12 -4
- package/lib/server/services/configService.ts +13 -0
- package/lib/server/ssr/htmlGenerator.ts +5 -2
- package/lib/server/ssr/jsCollector.ts +2 -2
- package/lib/server/ssr/ssrRenderer.test.ts +32 -0
- package/lib/server/ssr/ssrRenderer.ts +26 -11
- package/lib/shared/constants.ts +9 -2
- package/lib/shared/cssGeneration.test.ts +109 -3
- package/lib/shared/cssGeneration.ts +109 -13
- package/lib/shared/cssNamedColors.ts +47 -0
- package/lib/shared/cssProperties.ts +99 -4
- package/lib/shared/index.ts +1 -0
- package/lib/shared/nodeUtils.ts +28 -0
- package/lib/shared/responsiveScaling.test.ts +20 -3
- package/lib/shared/responsiveScaling.ts +55 -1
- package/lib/shared/responsiveStyleUtils.test.ts +7 -8
- package/lib/shared/responsiveStyleUtils.ts +6 -7
- package/lib/shared/types/components.ts +1 -1
- package/lib/shared/types/variables.test.ts +9 -2
- package/lib/shared/types/variables.ts +5 -1
- package/lib/shared/utilityClassMapper.ts +14 -1
- package/lib/shared/validation/propValidator.ts +6 -0
- package/lib/shared/validation/schemas.ts +2 -2
- package/package.json +1 -1
- package/dist/chunks/chunk-3XXLBUYA.js.map +0 -7
- package/dist/chunks/chunk-BXB6AX76.js.map +0 -7
- package/dist/chunks/chunk-KPNSCQNA.js.map +0 -7
- package/dist/chunks/chunk-S2HXJTAF.js.map +0 -7
- package/dist/chunks/chunk-X5SH4HXS.js.map +0 -7
- package/dist/chunks/chunk-YEJVSNVF.js.map +0 -7
- /package/dist/chunks/{chunk-5TJA272J.js.map → chunk-C6U5T5S5.js.map} +0 -0
- /package/dist/chunks/{chunk-46AVQA4V.js.map → chunk-IF3RATBY.js.map} +0 -0
- /package/dist/chunks/{chunk-G3WIPJN3.js.map → chunk-ORN7S4AP.js.map} +0 -0
- /package/dist/chunks/{chunk-OLNQMCSR.js.map → chunk-ZWYDT3QJ.js.map} +0 -0
- /package/dist/chunks/{configService-KYO3TXDS.js.map → configService-DYCUEURL.js.map} +0 -0
- /package/dist/chunks/{constants-34NUGHQR.js.map → constants-GWBAD66U.js.map} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
configService
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZTKHJQ2Z.js";
|
|
4
4
|
import {
|
|
5
5
|
projectPaths,
|
|
6
6
|
resolveProjectPath,
|
|
7
7
|
validateJS
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-I7YIGZXT.js";
|
|
9
9
|
import {
|
|
10
10
|
fileExists,
|
|
11
11
|
readJsonFile,
|
|
@@ -16,14 +16,14 @@ import {
|
|
|
16
16
|
isSafePathSegment,
|
|
17
17
|
isValidIdentifier,
|
|
18
18
|
resolvePaletteColor
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-KITQJYZV.js";
|
|
20
20
|
import {
|
|
21
21
|
extractAttributesFromNode,
|
|
22
22
|
isHtmlMapping,
|
|
23
23
|
processStructure,
|
|
24
24
|
resolveHtmlMapping,
|
|
25
25
|
skipEmptyTemplateAttributes
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-ZWYDT3QJ.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-
|
|
65
|
+
} from "./chunk-FED5MME6.js";
|
|
66
66
|
import {
|
|
67
67
|
DEFAULT_BREAKPOINTS,
|
|
68
68
|
DEFAULT_I18N_CONFIG,
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
normalizeBreakpointConfig,
|
|
75
75
|
resolveI18nValue,
|
|
76
76
|
scalePropertyValue
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-XSWR3QLI.js";
|
|
78
78
|
import {
|
|
79
79
|
isTiptapDocument,
|
|
80
80
|
tiptapToHtml
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
NODE_TYPE,
|
|
84
84
|
RAW_HTML_PREFIX,
|
|
85
85
|
init_constants
|
|
86
|
-
} from "./chunk-
|
|
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
|
-
|
|
1666
|
+
(function(){
|
|
1667
|
+
${js}
|
|
1668
|
+
})();`);
|
|
1667
1669
|
}
|
|
1668
1670
|
};
|
|
1669
1671
|
for (const [name, component] of Object.entries(globalComponents)) {
|
|
@@ -2071,7 +2073,8 @@ async function buildComponentHTML(node, globalComponents = {}, pageComponents =
|
|
|
2071
2073
|
const preloadImages = [];
|
|
2072
2074
|
const neededCollections = /* @__PURE__ */ new Set();
|
|
2073
2075
|
const ssrFallbackCollector = /* @__PURE__ */ new Map();
|
|
2074
|
-
|
|
2076
|
+
const processedRawHtmlCollector = /* @__PURE__ */ new Map();
|
|
2077
|
+
if (!node) return { html: "", interactiveStylesMap, preloadImages, neededCollections, ssrFallbackCollector, processedRawHtmlCollector };
|
|
2075
2078
|
ssrComponentRegistry.merge(globalComponents);
|
|
2076
2079
|
ssrComponentRegistry.merge(pageComponents);
|
|
2077
2080
|
const breakpoints = await loadBreakpointConfig();
|
|
@@ -2098,10 +2101,12 @@ async function buildComponentHTML(node, globalComponents = {}, pageComponents =
|
|
|
2098
2101
|
isProductionBuild,
|
|
2099
2102
|
ssrFallbackCollector,
|
|
2100
2103
|
// Collect SSR fallback HTML for complex nodes
|
|
2104
|
+
processedRawHtmlCollector,
|
|
2105
|
+
// Collect raw→processed HTML for Astro exporter
|
|
2101
2106
|
imageFormat: configService.getImageFormat()
|
|
2102
2107
|
};
|
|
2103
2108
|
const html = await renderNode(node, ctx);
|
|
2104
|
-
return { html, interactiveStylesMap, preloadImages, neededCollections, ssrFallbackCollector };
|
|
2109
|
+
return { html, interactiveStylesMap, preloadImages, neededCollections, ssrFallbackCollector, processedRawHtmlCollector };
|
|
2105
2110
|
}
|
|
2106
2111
|
async function renderNestedListPlaceholder(node, ctx) {
|
|
2107
2112
|
const sourceValue = node.source || node.collection;
|
|
@@ -2339,10 +2344,12 @@ async function renderNode(node, ctx) {
|
|
|
2339
2344
|
text = processCMSTemplate(text, ctx.cmsContext.cms, locale, i18nConfig);
|
|
2340
2345
|
}
|
|
2341
2346
|
if (text.startsWith(RAW_HTML_PREFIX)) {
|
|
2342
|
-
|
|
2347
|
+
const rawSlice = text.slice(RAW_HTML_PREFIX.length);
|
|
2348
|
+
let rawHtml = rawSlice;
|
|
2343
2349
|
if (ctx.imageMetadataMap) rawHtml = rewriteRichTextImages(rawHtml, ctx.imageMetadataMap, ctx.imageFormat);
|
|
2344
2350
|
rawHtml = await expandRichTextComponents(rawHtml, ctx);
|
|
2345
2351
|
rawHtml = localizeRichTextLinks(rawHtml, ctx);
|
|
2352
|
+
ctx.processedRawHtmlCollector?.set(rawSlice, rawHtml);
|
|
2346
2353
|
return rawHtml;
|
|
2347
2354
|
}
|
|
2348
2355
|
return escapeHtml(text);
|
|
@@ -2355,10 +2362,12 @@ async function renderNode(node, ctx) {
|
|
|
2355
2362
|
text = processCMSTemplate(text, ctx.cmsContext.cms, locale, i18nConfig);
|
|
2356
2363
|
}
|
|
2357
2364
|
if (text.startsWith(RAW_HTML_PREFIX)) {
|
|
2358
|
-
|
|
2365
|
+
const rawSlice = text.slice(RAW_HTML_PREFIX.length);
|
|
2366
|
+
let rawHtml = rawSlice;
|
|
2359
2367
|
if (ctx.imageMetadataMap) rawHtml = rewriteRichTextImages(rawHtml, ctx.imageMetadataMap, ctx.imageFormat);
|
|
2360
2368
|
rawHtml = await expandRichTextComponents(rawHtml, ctx);
|
|
2361
2369
|
rawHtml = localizeRichTextLinks(rawHtml, ctx);
|
|
2370
|
+
ctx.processedRawHtmlCollector?.set(rawSlice, rawHtml);
|
|
2362
2371
|
return rawHtml;
|
|
2363
2372
|
}
|
|
2364
2373
|
return escapeHtml(text);
|
|
@@ -2741,13 +2750,13 @@ async function renderHtmlElement(tag, propsWithStyleAndAttrs, children, ctx) {
|
|
|
2741
2750
|
const voidElements = ["img", "input", "br", "hr", "meta", "link", "area", "base", "col", "embed", "source", "track", "wbr"];
|
|
2742
2751
|
if (voidElements.includes(tag.toLowerCase())) {
|
|
2743
2752
|
if (tag.toLowerCase() === "img") {
|
|
2744
|
-
return renderImageElement(propsWithStyleAndAttrs, classAttr, attrs, ctx);
|
|
2753
|
+
return renderImageElement(propsWithStyleAndAttrs, classAttr, styleAttr, attrs, ctx);
|
|
2745
2754
|
}
|
|
2746
2755
|
return `<${tag}${classAttr}${styleAttr}${attrs} />`;
|
|
2747
2756
|
}
|
|
2748
2757
|
return `<${tag}${classAttr}${styleAttr}${attrs}>${childrenHTML}</${tag}>`;
|
|
2749
2758
|
}
|
|
2750
|
-
function renderImageElement(propsWithStyleAndAttrs, classAttr, attrs, ctx) {
|
|
2759
|
+
function renderImageElement(propsWithStyleAndAttrs, classAttr, styleAttr, attrs, ctx) {
|
|
2751
2760
|
const imgProps = propsWithStyleAndAttrs;
|
|
2752
2761
|
const src = imgProps.src;
|
|
2753
2762
|
const alt = imgProps.alt;
|
|
@@ -2809,13 +2818,13 @@ function renderImageElement(propsWithStyleAndAttrs, classAttr, attrs, ctx) {
|
|
|
2809
2818
|
}
|
|
2810
2819
|
const pictureClassAttr = pictureClasses.length > 0 ? ` class="${escapeHtml(pictureClasses.join(" "))}"` : "";
|
|
2811
2820
|
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>`;
|
|
2821
|
+
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
2822
|
}
|
|
2814
2823
|
if (metadata?.srcset) {
|
|
2815
2824
|
imgAttrs += ` srcset="${escapeHtml(metadata.srcset)}"`;
|
|
2816
2825
|
imgAttrs += ` sizes="${escapeHtml(sizesAttr)}"`;
|
|
2817
2826
|
}
|
|
2818
|
-
return `<img${classAttr}${imgAttrs}${attrs} />`;
|
|
2827
|
+
return `<img${classAttr}${styleAttr}${imgAttrs}${attrs} />`;
|
|
2819
2828
|
}
|
|
2820
2829
|
function renderLocaleList(node, ctx) {
|
|
2821
2830
|
const { slugMappings, pagePath, i18nConfig, locale } = ctx;
|
|
@@ -2933,7 +2942,7 @@ async function renderPageSSR(pageData, globalComponents = {}, pagePath = "/", ba
|
|
|
2933
2942
|
}
|
|
2934
2943
|
}
|
|
2935
2944
|
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() };
|
|
2945
|
+
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
2946
|
const javascript = await collectComponentJavaScript(globalComponents, pageComponents);
|
|
2938
2947
|
const componentCSS = collectComponentCSS(globalComponents, pageComponents);
|
|
2939
2948
|
const fullUrl = baseUrl ? `${baseUrl}${pagePath}` : pagePath;
|
|
@@ -2954,7 +2963,8 @@ async function renderPageSSR(pageData, globalComponents = {}, pagePath = "/", ba
|
|
|
2954
2963
|
interactiveStylesMap,
|
|
2955
2964
|
preloadImages,
|
|
2956
2965
|
neededCollections,
|
|
2957
|
-
ssrFallbackCollector
|
|
2966
|
+
ssrFallbackCollector,
|
|
2967
|
+
processedRawHtmlCollector
|
|
2958
2968
|
};
|
|
2959
2969
|
}
|
|
2960
2970
|
|
|
@@ -3327,10 +3337,11 @@ async function generateSSRHTML(pageDataOrOptions, globalComponents = {}, pagePat
|
|
|
3327
3337
|
await configService.load();
|
|
3328
3338
|
const globalLibraries = configService.getLibraries() || { js: [], css: [] };
|
|
3329
3339
|
const globalCustomCode = configService.getCustomCode();
|
|
3340
|
+
const menoBadgeHtml = configService.getShowMenoBadge() ? `<a href="https://meno.so" target="_blank" rel="noopener" style="position:fixed;bottom:12px;left:12px;z-index:9999;background:#000;color:#fff;padding:4px 10px;border-radius:6px;font-size:12px;font-family:system-ui,sans-serif;text-decoration:none;opacity:0.8;transition:opacity 0.2s" onmouseenter="this.style.opacity='1'" onmouseleave="this.style.opacity='0.8'">Made in Meno</a>` : "";
|
|
3330
3341
|
const mergedCustomCode = {
|
|
3331
3342
|
head: [globalCustomCode.head, pageCustomCode?.head].filter(Boolean).join("\n"),
|
|
3332
3343
|
bodyStart: [globalCustomCode.bodyStart, pageCustomCode?.bodyStart].filter(Boolean).join("\n"),
|
|
3333
|
-
bodyEnd: [globalCustomCode.bodyEnd, pageCustomCode?.bodyEnd].filter(Boolean).join("\n")
|
|
3344
|
+
bodyEnd: [globalCustomCode.bodyEnd, pageCustomCode?.bodyEnd, menoBadgeHtml].filter(Boolean).join("\n")
|
|
3334
3345
|
};
|
|
3335
3346
|
const componentLibraries = collectComponentLibraries(components, pageData.components || {});
|
|
3336
3347
|
const globalPlusComponent = mergeLibraries(globalLibraries, componentLibraries) || { js: [], css: [] };
|
|
@@ -3414,7 +3425,7 @@ ${escapedJavaScript}
|
|
|
3414
3425
|
const variablesCSS = generateVariablesCSS(variablesConfig, breakpointConfig, responsiveScalesConfig);
|
|
3415
3426
|
const remConversionConfig = configService.getRemConversion();
|
|
3416
3427
|
const utilityCSS = generateUtilityCSS(usedUtilityClasses, breakpointConfig, responsiveScalesConfig, remConversionConfig);
|
|
3417
|
-
const interactiveCSS = rendered.interactiveStylesMap.size > 0 ? generateAllInteractiveCSS(rendered.interactiveStylesMap, breakpointConfig, remConversionConfig) : "";
|
|
3428
|
+
const interactiveCSS = rendered.interactiveStylesMap.size > 0 ? generateAllInteractiveCSS(rendered.interactiveStylesMap, breakpointConfig, remConversionConfig, responsiveScalesConfig) : "";
|
|
3418
3429
|
printMissingStyleWarnings(false);
|
|
3419
3430
|
const baseCSS = `* {
|
|
3420
3431
|
margin: 0;
|
|
@@ -5918,6 +5929,7 @@ export {
|
|
|
5918
5929
|
loadBreakpointConfig,
|
|
5919
5930
|
loadResponsiveScalesConfig,
|
|
5920
5931
|
loadI18nConfig,
|
|
5932
|
+
loadIconsConfig,
|
|
5921
5933
|
CachedConfigLoader,
|
|
5922
5934
|
ColorService,
|
|
5923
5935
|
colorService,
|
|
@@ -5964,4 +5976,4 @@ export {
|
|
|
5964
5976
|
FileSystemCMSProvider,
|
|
5965
5977
|
migrateTemplatesDirectory
|
|
5966
5978
|
};
|
|
5967
|
-
//# sourceMappingURL=chunk-
|
|
5979
|
+
//# sourceMappingURL=chunk-77ZB6353.js.map
|