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.
- package/build-astro.ts +2 -2
- package/dist/build-static.js +7 -7
- package/dist/chunks/{chunk-UUA5LEWF.js → chunk-6IVUG7FY.js} +138 -7
- package/dist/chunks/chunk-6IVUG7FY.js.map +7 -0
- package/dist/chunks/{chunk-XSWR3QLI.js → chunk-AZQYF6KE.js} +261 -130
- package/dist/chunks/chunk-AZQYF6KE.js.map +7 -0
- package/dist/chunks/{chunk-47UNLQUU.js → chunk-CHD5UCFF.js} +57 -12
- package/dist/chunks/chunk-CHD5UCFF.js.map +7 -0
- package/dist/chunks/{chunk-FGUZOYJX.js → chunk-EQYDSPBB.js} +435 -131
- package/dist/chunks/chunk-EQYDSPBB.js.map +7 -0
- package/dist/chunks/{chunk-IF3RATBY.js → chunk-H4JSCDNW.js} +2 -2
- package/dist/chunks/{chunk-KITQJYZV.js → chunk-J23ZX5AP.js} +40 -4
- package/dist/chunks/chunk-J23ZX5AP.js.map +7 -0
- package/dist/chunks/{chunk-LJFB5EBT.js → chunk-JER5NQVM.js} +5 -5
- package/dist/chunks/{chunk-ZTKHJQ2Z.js → chunk-KPU2XHOS.js} +5 -2
- package/dist/chunks/{chunk-ZTKHJQ2Z.js.map → chunk-KPU2XHOS.js.map} +2 -2
- package/dist/chunks/{chunk-BCLGRZ3U.js → chunk-LKAGAQ3M.js} +2 -2
- package/dist/chunks/{chunk-FED5MME6.js → chunk-S2CX6HFM.js} +262 -26
- package/dist/chunks/chunk-S2CX6HFM.js.map +7 -0
- package/dist/chunks/{configService-DYCUEURL.js → configService-CCA6AIDI.js} +3 -3
- package/dist/entries/server-router.js +9 -9
- package/dist/entries/server-router.js.map +2 -2
- package/dist/lib/client/index.js +64 -20
- package/dist/lib/client/index.js.map +3 -3
- package/dist/lib/server/index.js +1737 -296
- package/dist/lib/server/index.js.map +4 -4
- package/dist/lib/shared/index.js +50 -10
- package/dist/lib/shared/index.js.map +3 -3
- package/entries/server-router.tsx +6 -2
- package/lib/client/core/ComponentBuilder.test.ts +17 -0
- package/lib/client/core/ComponentBuilder.ts +25 -1
- package/lib/client/core/builders/embedBuilder.ts +15 -2
- package/lib/client/core/builders/linkNodeBuilder.ts +15 -2
- package/lib/client/core/builders/localeListBuilder.ts +17 -6
- package/lib/client/styles/StyleInjector.ts +3 -2
- package/lib/client/theme.ts +4 -4
- package/lib/server/cssGenerator.test.ts +64 -1
- package/lib/server/cssGenerator.ts +48 -9
- package/lib/server/index.ts +1 -1
- package/lib/server/jsonLoader.test.ts +0 -17
- package/lib/server/jsonLoader.ts +0 -81
- package/lib/server/providers/fileSystemCMSProvider.test.ts +163 -0
- package/lib/server/providers/fileSystemCMSProvider.ts +200 -11
- package/lib/server/routes/api/variables.ts +4 -2
- package/lib/server/routes/index.ts +1 -1
- package/lib/server/routes/pages.ts +23 -1
- package/lib/server/services/cmsService.test.ts +246 -0
- package/lib/server/services/cmsService.ts +122 -5
- package/lib/server/services/configService.ts +5 -0
- package/lib/server/ssr/attributeBuilder.ts +41 -0
- package/lib/server/ssr/htmlGenerator.test.ts +114 -2
- package/lib/server/ssr/htmlGenerator.ts +53 -6
- package/lib/server/ssr/liveReloadIntegration.test.ts +209 -0
- package/lib/server/ssr/ssrRenderer.test.ts +362 -1
- package/lib/server/ssr/ssrRenderer.ts +216 -72
- package/lib/server/utils/jsonLineMapper.test.ts +53 -1
- package/lib/server/utils/jsonLineMapper.ts +43 -3
- package/lib/server/webflow/buildWebflow.ts +343 -123
- package/lib/server/webflow/index.ts +1 -0
- package/lib/server/webflow/nodeToWebflow.test.ts +3170 -0
- package/lib/server/webflow/nodeToWebflow.ts +2141 -129
- package/lib/server/webflow/styleMapper.test.ts +389 -0
- package/lib/server/webflow/styleMapper.ts +517 -63
- package/lib/server/webflow/templateWrapper.ts +49 -0
- package/lib/server/webflow/types.ts +218 -18
- package/lib/shared/cssGeneration.test.ts +267 -1
- package/lib/shared/cssGeneration.ts +240 -18
- package/lib/shared/cssProperties.test.ts +247 -1
- package/lib/shared/cssProperties.ts +196 -6
- package/lib/shared/elementClassName.test.ts +15 -0
- package/lib/shared/elementClassName.ts +7 -3
- package/lib/shared/interfaces/contentProvider.ts +39 -6
- package/lib/shared/pathSecurity.ts +16 -0
- package/lib/shared/registry/nodeTypes/ListNodeType.ts +1 -1
- package/lib/shared/responsiveScaling.test.ts +143 -0
- package/lib/shared/responsiveScaling.ts +253 -2
- package/lib/shared/themeDefaults.test.ts +3 -3
- package/lib/shared/themeDefaults.ts +3 -3
- package/lib/shared/types/cms.ts +28 -3
- package/lib/shared/types/index.ts +2 -0
- package/lib/shared/types/variables.ts +37 -0
- package/lib/shared/utilityClassConfig.ts +3 -0
- package/lib/shared/utilityClassMapper.test.ts +123 -0
- package/lib/shared/utilityClassMapper.ts +179 -8
- package/lib/shared/validation/schemas.ts +15 -1
- package/lib/shared/validation/validators.ts +26 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-47UNLQUU.js.map +0 -7
- package/dist/chunks/chunk-FED5MME6.js.map +0 -7
- package/dist/chunks/chunk-FGUZOYJX.js.map +0 -7
- package/dist/chunks/chunk-KITQJYZV.js.map +0 -7
- package/dist/chunks/chunk-UUA5LEWF.js.map +0 -7
- package/dist/chunks/chunk-XSWR3QLI.js.map +0 -7
- /package/dist/chunks/{chunk-IF3RATBY.js.map → chunk-H4JSCDNW.js.map} +0 -0
- /package/dist/chunks/{chunk-LJFB5EBT.js.map → chunk-JER5NQVM.js.map} +0 -0
- /package/dist/chunks/{chunk-BCLGRZ3U.js.map → chunk-LKAGAQ3M.js.map} +0 -0
- /package/dist/chunks/{configService-DYCUEURL.js.map → configService-CCA6AIDI.js.map} +0 -0
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_BREAKPOINTS,
|
|
3
|
+
DEFAULT_FLUID_RANGE,
|
|
3
4
|
DEFAULT_I18N_CONFIG,
|
|
5
|
+
SCALABLE_CSS_PROPERTIES,
|
|
4
6
|
applyRemConversion,
|
|
7
|
+
buildFluidClampWithExplicitMin,
|
|
8
|
+
buildFluidPropertyValue,
|
|
5
9
|
convertPxToRem,
|
|
6
10
|
getBreakpointName,
|
|
7
11
|
getBreakpointValues,
|
|
8
12
|
getScaleMultiplier,
|
|
13
|
+
getSmallestBreakpointName,
|
|
9
14
|
isI18nValue,
|
|
15
|
+
parseValue,
|
|
10
16
|
resolveI18nInProps,
|
|
11
17
|
resolveI18nValue,
|
|
12
18
|
scalePropertyValue,
|
|
13
19
|
shouldConvertProperty
|
|
14
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-AZQYF6KE.js";
|
|
15
21
|
import {
|
|
16
22
|
isTiptapDocument,
|
|
17
23
|
tiptapToHtml
|
|
@@ -28,7 +34,7 @@ import {
|
|
|
28
34
|
|
|
29
35
|
// lib/shared/validation/schemas.ts
|
|
30
36
|
import { z } from "zod";
|
|
31
|
-
var BasePropTypeSchema, PropTypeSchema, BasePropDefinitionSchema, EnumsConfigSchema, ListItemSchemaSchema, ListPropDefinitionSchema, PropDefinitionSchema, StyleMappingSchema, BooleanMappingSchema, IfConditionSchema, LinkMappingSchema, HtmlMappingSchema, StyleObjectSchema, ResponsiveStyleObjectSchema, StyleValueSchema, InteractiveStyleRuleSchema, InteractiveStylesSchema, SlotMarkerSchema, ComponentNodeSchema, HtmlNodeSchema, ComponentInstanceNodeSchema, EmbedNodeSchema, LinkNodeSchema, LocaleListNodeSchema, ListNodeSchemaBasic, ScriptLoadModeSchema, LibraryPositionSchema, ScriptTypeSchema, JSLibraryConfigSchema, CSSLibraryConfigSchema, LibrariesConfigSchema, StructuredComponentDefinitionSchema, ComponentDefinitionSchema, I18nOrStringSchema, LibraryMergeModeSchema, PageLibrariesConfigSchema, CustomCodeConfigSchema, PageMetaDataBaseSchema, PageMetaDataSchema, LineRangeSchema, JSONPageSchema, PageDataWithComponentSchema, PageDataSchema, CMSFieldTypeSchema, CMSFieldDefinitionSchema, CMSClientDataStrategySchema, CMSClientDataConfigSchema, CMSSchemaSchema, CMSItemSchema, CMSFilterConditionSchema, CMSSortConfigSchema, CMSListQuerySchema, CMSListNodeSchema, PageCmsConfigSchema, PageMetaDataWithCMSSchema;
|
|
37
|
+
var BasePropTypeSchema, PropTypeSchema, BasePropDefinitionSchema, EnumsConfigSchema, ListItemSchemaSchema, ListPropDefinitionSchema, PropDefinitionSchema, StyleMappingSchema, BooleanMappingSchema, IfConditionSchema, LinkMappingSchema, HtmlMappingSchema, StyleObjectSchema, ResponsiveStyleObjectSchema, StyleValueSchema, InteractiveStyleRuleSchema, InteractiveStylesSchema, SlotMarkerSchema, ComponentNodeSchema, HtmlNodeSchema, ComponentInstanceNodeSchema, EmbedNodeSchema, LinkNodeSchema, LocaleListNodeSchema, ListNodeSchemaBasic, ScriptLoadModeSchema, LibraryPositionSchema, ScriptTypeSchema, JSLibraryConfigSchema, CSSLibraryConfigSchema, LibrariesConfigSchema, StructuredComponentDefinitionSchema, ComponentDefinitionSchema, I18nOrStringSchema, LibraryMergeModeSchema, PageLibrariesConfigSchema, CustomCodeConfigSchema, PageMetaDataBaseSchema, PageMetaDataSchema, LineRangeSchema, JSONPageSchema, PageDataWithComponentSchema, PageDataSchema, CMSFieldTypeSchema, CMSFieldDefinitionSchema, CMSClientDataStrategySchema, CMSClientDataConfigSchema, CMSSchemaSchema, CMSItemSchema, CMSDraftItemSchema, CMSFilterConditionSchema, CMSSortConfigSchema, CMSListQuerySchema, CMSListNodeSchema, PageCmsConfigSchema, PageMetaDataWithCMSSchema;
|
|
32
38
|
var init_schemas = __esm({
|
|
33
39
|
"lib/shared/validation/schemas.ts"() {
|
|
34
40
|
"use strict";
|
|
@@ -361,6 +367,12 @@ var init_schemas = __esm({
|
|
|
361
367
|
_filename: z.string().optional(),
|
|
362
368
|
_createdAt: z.string().optional()
|
|
363
369
|
}).passthrough();
|
|
370
|
+
CMSDraftItemSchema = z.object({
|
|
371
|
+
_id: z.string().optional(),
|
|
372
|
+
_slug: z.string().optional(),
|
|
373
|
+
_filename: z.string().optional(),
|
|
374
|
+
_createdAt: z.string().optional()
|
|
375
|
+
}).passthrough();
|
|
364
376
|
CMSFilterConditionSchema = z.object({
|
|
365
377
|
field: z.string(),
|
|
366
378
|
operator: z.enum(["eq", "neq", "gt", "gte", "lt", "lte", "contains", "in"]).optional(),
|
|
@@ -1536,7 +1548,7 @@ var init_ListNodeType = __esm({
|
|
|
1536
1548
|
children: []
|
|
1537
1549
|
},
|
|
1538
1550
|
treeDisplay: {
|
|
1539
|
-
icon: "
|
|
1551
|
+
icon: "ARRAY",
|
|
1540
1552
|
getLabel: (node) => {
|
|
1541
1553
|
const listNode = node;
|
|
1542
1554
|
const sourceType = listNode.sourceType || "prop";
|
|
@@ -1867,6 +1879,24 @@ function validateCMSItem(data) {
|
|
|
1867
1879
|
};
|
|
1868
1880
|
}
|
|
1869
1881
|
}
|
|
1882
|
+
function validateCMSDraftItem(data) {
|
|
1883
|
+
try {
|
|
1884
|
+
const result = CMSDraftItemSchema.safeParse(data);
|
|
1885
|
+
if (result.success) {
|
|
1886
|
+
return { valid: true, data: result.data };
|
|
1887
|
+
}
|
|
1888
|
+
return { valid: false, errors: zodToValidationErrors(result.error) };
|
|
1889
|
+
} catch (error) {
|
|
1890
|
+
return {
|
|
1891
|
+
valid: false,
|
|
1892
|
+
errors: [{
|
|
1893
|
+
path: "root",
|
|
1894
|
+
message: error instanceof Error ? error.message : "Unknown validation error",
|
|
1895
|
+
code: "UNKNOWN"
|
|
1896
|
+
}]
|
|
1897
|
+
};
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1870
1900
|
|
|
1871
1901
|
// lib/shared/types/cms.ts
|
|
1872
1902
|
var IRREGULAR_PLURALS = {
|
|
@@ -3020,6 +3050,8 @@ var prefixToCSSProperty = {
|
|
|
3020
3050
|
lst: "list-style",
|
|
3021
3051
|
lstt: "list-style-type",
|
|
3022
3052
|
lstp: "list-style-position",
|
|
3053
|
+
// Display
|
|
3054
|
+
d: "display",
|
|
3023
3055
|
// Flexbox
|
|
3024
3056
|
fd: "flex-direction",
|
|
3025
3057
|
jc: "justify-content",
|
|
@@ -3254,6 +3286,17 @@ function isStyleMapping(value) {
|
|
|
3254
3286
|
function sanitizeClassValue(value) {
|
|
3255
3287
|
return value.replace(/\s+/g, "-").replace(/[()]/g, "").replace(/,/g, "_").replace(/%/g, "p").replace(/\./g, "d").replace(/[^\w-]/g, "");
|
|
3256
3288
|
}
|
|
3289
|
+
function shortHash(input) {
|
|
3290
|
+
let hash = 2166136261;
|
|
3291
|
+
for (let i = 0; i < input.length; i++) {
|
|
3292
|
+
hash ^= input.charCodeAt(i);
|
|
3293
|
+
hash = Math.imul(hash, 16777619);
|
|
3294
|
+
}
|
|
3295
|
+
return (hash >>> 0).toString(36);
|
|
3296
|
+
}
|
|
3297
|
+
function hasIllegalClassChars(className) {
|
|
3298
|
+
return /[^\w-]/.test(className);
|
|
3299
|
+
}
|
|
3257
3300
|
function propertyValueToClass(prop, value) {
|
|
3258
3301
|
const prefix = propertyMap[prop];
|
|
3259
3302
|
if (!prefix) {
|
|
@@ -3331,6 +3374,9 @@ function propertyValueToClass(prop, value) {
|
|
|
3331
3374
|
if (!className) {
|
|
3332
3375
|
className = `${prefix}-${stringValue}`;
|
|
3333
3376
|
}
|
|
3377
|
+
if (hasIllegalClassChars(className)) {
|
|
3378
|
+
className = `${prefix}-h${shortHash(stringValue)}`;
|
|
3379
|
+
}
|
|
3334
3380
|
registerStyleValue(className, value);
|
|
3335
3381
|
return className;
|
|
3336
3382
|
}
|
|
@@ -3355,24 +3401,85 @@ function stylesToClasses(styles) {
|
|
|
3355
3401
|
}
|
|
3356
3402
|
return classes;
|
|
3357
3403
|
}
|
|
3358
|
-
|
|
3404
|
+
var CONTAINER_RESERVED_VALUES = /* @__PURE__ */ new Set(["auto", "inherit", "initial", "unset", ""]);
|
|
3405
|
+
function transformContainerIntent(style) {
|
|
3406
|
+
const w = style.width;
|
|
3407
|
+
const mw = style.maxWidth;
|
|
3408
|
+
if (w == null || mw == null) return style;
|
|
3409
|
+
if (typeof w !== "string" || typeof mw !== "string") return style;
|
|
3410
|
+
if (w !== mw) return style;
|
|
3411
|
+
if (CONTAINER_RESERVED_VALUES.has(w.trim())) return style;
|
|
3412
|
+
return {
|
|
3413
|
+
...style,
|
|
3414
|
+
width: "calc(100% - var(--site-margin) * 2)",
|
|
3415
|
+
marginLeft: "auto",
|
|
3416
|
+
marginRight: "auto"
|
|
3417
|
+
};
|
|
3418
|
+
}
|
|
3419
|
+
function consumeMobileIntoBaseClamp(base, mobile, responsiveScales) {
|
|
3420
|
+
const fluidRange = responsiveScales.fluidRange ?? DEFAULT_FLUID_RANGE;
|
|
3421
|
+
const patchedBase = { ...base };
|
|
3422
|
+
const patchedMobile = { ...mobile };
|
|
3423
|
+
for (const prop of Object.keys(base)) {
|
|
3424
|
+
if (!SCALABLE_CSS_PROPERTIES.has(prop)) continue;
|
|
3425
|
+
const mobileRaw = mobile[prop];
|
|
3426
|
+
if (mobileRaw == null || mobileRaw === "") continue;
|
|
3427
|
+
const baseRaw = base[prop];
|
|
3428
|
+
if (baseRaw == null || baseRaw === "") continue;
|
|
3429
|
+
if (typeof baseRaw !== "string" && typeof baseRaw !== "number") continue;
|
|
3430
|
+
if (typeof mobileRaw !== "string" && typeof mobileRaw !== "number") continue;
|
|
3431
|
+
const baseParsed = parseValue(String(baseRaw));
|
|
3432
|
+
const mobileParsed = parseValue(String(mobileRaw));
|
|
3433
|
+
if (!baseParsed || !mobileParsed) continue;
|
|
3434
|
+
if (baseParsed.unit !== mobileParsed.unit) continue;
|
|
3435
|
+
if (baseParsed.unit === "%" || baseParsed.unit === "em") continue;
|
|
3436
|
+
const clampValue = buildFluidClampWithExplicitMin(
|
|
3437
|
+
mobileParsed.value,
|
|
3438
|
+
baseParsed.value,
|
|
3439
|
+
baseParsed.unit,
|
|
3440
|
+
fluidRange.min,
|
|
3441
|
+
fluidRange.max
|
|
3442
|
+
);
|
|
3443
|
+
patchedBase[prop] = clampValue;
|
|
3444
|
+
delete patchedMobile[prop];
|
|
3445
|
+
}
|
|
3446
|
+
return { patchedBase, patchedMobile };
|
|
3447
|
+
}
|
|
3448
|
+
function responsiveStylesToClasses(styles, options) {
|
|
3359
3449
|
if (!styles) return [];
|
|
3450
|
+
const fluidActive = options?.fluidActive === true;
|
|
3451
|
+
const responsiveScales = options?.responsiveScales;
|
|
3360
3452
|
const classes = [];
|
|
3361
3453
|
if ("base" in styles || "tablet" in styles || "mobile" in styles) {
|
|
3362
3454
|
const responsiveStyles = styles;
|
|
3363
|
-
|
|
3364
|
-
|
|
3455
|
+
let baseSource = responsiveStyles.base;
|
|
3456
|
+
let mobileSource = responsiveStyles.mobile;
|
|
3457
|
+
if (fluidActive && responsiveScales?.enabled === true && baseSource && mobileSource) {
|
|
3458
|
+
const { patchedBase, patchedMobile } = consumeMobileIntoBaseClamp(
|
|
3459
|
+
baseSource,
|
|
3460
|
+
mobileSource,
|
|
3461
|
+
responsiveScales
|
|
3462
|
+
);
|
|
3463
|
+
baseSource = patchedBase;
|
|
3464
|
+
mobileSource = patchedMobile;
|
|
3465
|
+
}
|
|
3466
|
+
if (baseSource) {
|
|
3467
|
+
const base = fluidActive ? transformContainerIntent(baseSource) : baseSource;
|
|
3468
|
+
classes.push(...stylesToClasses(base));
|
|
3365
3469
|
}
|
|
3366
3470
|
if (responsiveStyles.tablet) {
|
|
3367
|
-
const
|
|
3471
|
+
const tablet = fluidActive ? transformContainerIntent(responsiveStyles.tablet) : responsiveStyles.tablet;
|
|
3472
|
+
const tabletClasses = stylesToClasses(tablet);
|
|
3368
3473
|
classes.push(...tabletClasses.map((cls) => `t-${cls}`));
|
|
3369
3474
|
}
|
|
3370
|
-
if (
|
|
3371
|
-
const
|
|
3475
|
+
if (mobileSource && Object.keys(mobileSource).length > 0) {
|
|
3476
|
+
const mobile = fluidActive ? transformContainerIntent(mobileSource) : mobileSource;
|
|
3477
|
+
const mobileClasses = stylesToClasses(mobile);
|
|
3372
3478
|
classes.push(...mobileClasses.map((cls) => `mob-${cls}`));
|
|
3373
3479
|
}
|
|
3374
3480
|
} else {
|
|
3375
|
-
|
|
3481
|
+
const flat = fluidActive ? transformContainerIntent(styles) : styles;
|
|
3482
|
+
classes.push(...stylesToClasses(flat));
|
|
3376
3483
|
}
|
|
3377
3484
|
return classes;
|
|
3378
3485
|
}
|
|
@@ -3400,6 +3507,12 @@ function classToStyle(className) {
|
|
|
3400
3507
|
}
|
|
3401
3508
|
}
|
|
3402
3509
|
if (!prop) return null;
|
|
3510
|
+
if (/^h[0-9a-z]+$/.test(value)) {
|
|
3511
|
+
const registered = getStyleValue(cleanClass);
|
|
3512
|
+
if (registered != null) {
|
|
3513
|
+
return { prop, value: String(registered) };
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3403
3516
|
if (value.includes("background") || value.includes("text") || value.includes("border")) {
|
|
3404
3517
|
return { prop, value: `var(--${value})` };
|
|
3405
3518
|
}
|
|
@@ -3643,12 +3756,12 @@ function convertComponentPathToPagePath(componentPath, componentInstancePath, co
|
|
|
3643
3756
|
}
|
|
3644
3757
|
|
|
3645
3758
|
// lib/shared/elementClassName.ts
|
|
3646
|
-
function
|
|
3759
|
+
function shortHash2(input) {
|
|
3647
3760
|
let hash = 5381;
|
|
3648
3761
|
for (let i = 0; i < input.length; i++) {
|
|
3649
3762
|
hash = (hash << 5) + hash ^ input.charCodeAt(i);
|
|
3650
3763
|
}
|
|
3651
|
-
return Math.abs(hash).toString(36).slice(
|
|
3764
|
+
return Math.abs(hash).toString(36).slice(-5);
|
|
3652
3765
|
}
|
|
3653
3766
|
function sanitizeName(name) {
|
|
3654
3767
|
return name.toLowerCase().replace(/[^a-z0-9_-]/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "");
|
|
@@ -3660,7 +3773,7 @@ function generateElementClassName(ctx) {
|
|
|
3660
3773
|
return `${prefix}_${sanitizedFileName}_${sanitizeName(ctx.label)}`;
|
|
3661
3774
|
}
|
|
3662
3775
|
const pathString = pathToString(ctx.path);
|
|
3663
|
-
const hash =
|
|
3776
|
+
const hash = shortHash2(`${ctx.fileName}:${pathString}`);
|
|
3664
3777
|
return `${prefix}_${sanitizedFileName}_${hash}`;
|
|
3665
3778
|
}
|
|
3666
3779
|
function isElementClassName(className) {
|
|
@@ -4019,6 +4132,9 @@ function getClassPropertyOrder(className) {
|
|
|
4019
4132
|
function sortClassesByPropertyOrder(classes) {
|
|
4020
4133
|
return Array.from(classes).sort((a, b) => getClassPropertyOrder(a) - getClassPropertyOrder(b));
|
|
4021
4134
|
}
|
|
4135
|
+
function getResponsiveMode(scales) {
|
|
4136
|
+
return scales?.mode ?? "breakpoints";
|
|
4137
|
+
}
|
|
4022
4138
|
var AUTO_RESPONSIVE_TYPE_MAP = {
|
|
4023
4139
|
"padding": "padding",
|
|
4024
4140
|
"padding-left": "padding",
|
|
@@ -4115,12 +4231,30 @@ function extractPropertyAndValue(className) {
|
|
|
4115
4231
|
const classValue = className.substring(knownPrefix.length + 1);
|
|
4116
4232
|
const cssProp = prefixToCSSProperty[knownPrefix];
|
|
4117
4233
|
if (cssProp) {
|
|
4234
|
+
if (/^h[0-9a-z]+$/.test(classValue)) {
|
|
4235
|
+
return null;
|
|
4236
|
+
}
|
|
4118
4237
|
return { property: cssProp, value: classValue };
|
|
4119
4238
|
}
|
|
4120
4239
|
}
|
|
4121
4240
|
}
|
|
4122
4241
|
return null;
|
|
4123
4242
|
}
|
|
4243
|
+
function resolveScalablePropertyValue(className) {
|
|
4244
|
+
const direct = extractPropertyAndValue(className);
|
|
4245
|
+
if (direct) return direct;
|
|
4246
|
+
for (const knownPrefix of SORTED_PREFIXES) {
|
|
4247
|
+
if (!className.startsWith(knownPrefix + "-")) continue;
|
|
4248
|
+
const classValue = className.substring(knownPrefix.length + 1);
|
|
4249
|
+
if (!/^h[0-9a-z]+$/.test(classValue)) continue;
|
|
4250
|
+
const cssProp = prefixToCSSProperty[knownPrefix];
|
|
4251
|
+
if (!cssProp) continue;
|
|
4252
|
+
const registered = getStyleValue(className);
|
|
4253
|
+
if (registered == null || registered === "") continue;
|
|
4254
|
+
return { property: cssProp, value: String(registered) };
|
|
4255
|
+
}
|
|
4256
|
+
return null;
|
|
4257
|
+
}
|
|
4124
4258
|
function generateRuleForClass(className) {
|
|
4125
4259
|
if (utilityClassRules[className]) {
|
|
4126
4260
|
return utilityClassRules[className];
|
|
@@ -4253,6 +4387,80 @@ function generateRuleForClass(className) {
|
|
|
4253
4387
|
}
|
|
4254
4388
|
return `${cssProp}: ${value};`;
|
|
4255
4389
|
}
|
|
4390
|
+
function applyFluidToUtilityRule(rule, className, responsiveScales, breakpoints) {
|
|
4391
|
+
const propValue = resolveScalablePropertyValue(className);
|
|
4392
|
+
if (!propValue) return rule;
|
|
4393
|
+
const category = AUTO_RESPONSIVE_TYPE_MAP[propValue.property];
|
|
4394
|
+
if (!category) return rule;
|
|
4395
|
+
const scaleConfig = responsiveScales[category];
|
|
4396
|
+
if (!scaleConfig) return rule;
|
|
4397
|
+
const smallest = getSmallestBreakpointName(breakpoints);
|
|
4398
|
+
if (!smallest) return rule;
|
|
4399
|
+
const scale = scaleConfig[smallest];
|
|
4400
|
+
if (scale == null || scale === 1) return rule;
|
|
4401
|
+
const range = responsiveScales.fluidRange ?? DEFAULT_FLUID_RANGE;
|
|
4402
|
+
const baseRef = responsiveScales.baseReference ?? 16;
|
|
4403
|
+
const fluidValue = buildFluidPropertyValue(
|
|
4404
|
+
propValue.value,
|
|
4405
|
+
scale,
|
|
4406
|
+
range.min,
|
|
4407
|
+
range.max,
|
|
4408
|
+
baseRef
|
|
4409
|
+
);
|
|
4410
|
+
if (!fluidValue) return rule;
|
|
4411
|
+
return `${propValue.property}: ${fluidValue};`;
|
|
4412
|
+
}
|
|
4413
|
+
function applyFluidToStyle(style, responsiveScales, breakpoints) {
|
|
4414
|
+
const range = responsiveScales.fluidRange ?? DEFAULT_FLUID_RANGE;
|
|
4415
|
+
const baseRef = responsiveScales.baseReference ?? 16;
|
|
4416
|
+
const smallest = getSmallestBreakpointName(breakpoints);
|
|
4417
|
+
if (!smallest) return style;
|
|
4418
|
+
const out = {};
|
|
4419
|
+
for (const [prop, value] of Object.entries(style)) {
|
|
4420
|
+
if (typeof value === "object" && value !== null && "_mapping" in value) {
|
|
4421
|
+
out[prop] = value;
|
|
4422
|
+
continue;
|
|
4423
|
+
}
|
|
4424
|
+
if (value == null || value === "") {
|
|
4425
|
+
out[prop] = value;
|
|
4426
|
+
continue;
|
|
4427
|
+
}
|
|
4428
|
+
const scale = getScaleMultiplier(
|
|
4429
|
+
responsiveScales,
|
|
4430
|
+
prop,
|
|
4431
|
+
smallest
|
|
4432
|
+
);
|
|
4433
|
+
if (scale == null || scale === 1) {
|
|
4434
|
+
out[prop] = value;
|
|
4435
|
+
continue;
|
|
4436
|
+
}
|
|
4437
|
+
const fluidValue = buildFluidPropertyValue(
|
|
4438
|
+
String(value),
|
|
4439
|
+
scale,
|
|
4440
|
+
range.min,
|
|
4441
|
+
range.max,
|
|
4442
|
+
baseRef
|
|
4443
|
+
);
|
|
4444
|
+
out[prop] = fluidValue ?? value;
|
|
4445
|
+
}
|
|
4446
|
+
return out;
|
|
4447
|
+
}
|
|
4448
|
+
var CONTAINER_RESERVED_VALUES2 = /* @__PURE__ */ new Set(["auto", "inherit", "initial", "unset", ""]);
|
|
4449
|
+
function applyContainerPattern(style, fluidActive) {
|
|
4450
|
+
if (!fluidActive) return style;
|
|
4451
|
+
const w = style.width;
|
|
4452
|
+
const mw = style.maxWidth;
|
|
4453
|
+
if (w == null || mw == null) return style;
|
|
4454
|
+
if (typeof w !== "string" || typeof mw !== "string") return style;
|
|
4455
|
+
if (w !== mw) return style;
|
|
4456
|
+
if (CONTAINER_RESERVED_VALUES2.has(w.trim())) return style;
|
|
4457
|
+
return {
|
|
4458
|
+
...style,
|
|
4459
|
+
width: "calc(100% - var(--site-margin) * 2)",
|
|
4460
|
+
marginLeft: "auto",
|
|
4461
|
+
marginRight: "auto"
|
|
4462
|
+
};
|
|
4463
|
+
}
|
|
4256
4464
|
function generateUtilityCSS(usedClasses, breakpoints = DEFAULT_BREAKPOINTS, responsiveScales, remConfig) {
|
|
4257
4465
|
const css = [];
|
|
4258
4466
|
const baseClasses = /* @__PURE__ */ new Set();
|
|
@@ -4286,7 +4494,7 @@ function generateUtilityCSS(usedClasses, breakpoints = DEFAULT_BREAKPOINTS, resp
|
|
|
4286
4494
|
if (!matched) {
|
|
4287
4495
|
baseClasses.add(className);
|
|
4288
4496
|
if (responsiveScales?.enabled) {
|
|
4289
|
-
const propValue =
|
|
4497
|
+
const propValue = resolveScalablePropertyValue(className);
|
|
4290
4498
|
if (propValue) {
|
|
4291
4499
|
const category = AUTO_RESPONSIVE_TYPE_MAP[propValue.property];
|
|
4292
4500
|
if (category && responsiveScales[category]) {
|
|
@@ -4296,18 +4504,23 @@ function generateUtilityCSS(usedClasses, breakpoints = DEFAULT_BREAKPOINTS, resp
|
|
|
4296
4504
|
}
|
|
4297
4505
|
}
|
|
4298
4506
|
}
|
|
4507
|
+
const mode = getResponsiveMode(responsiveScales);
|
|
4508
|
+
const fluidActive = responsiveScales?.enabled === true && mode === "fluid";
|
|
4299
4509
|
for (const className of sortClassesByPropertyOrder(baseClasses)) {
|
|
4300
|
-
|
|
4510
|
+
let rule = generateRuleForClass(className);
|
|
4301
4511
|
if (rule) {
|
|
4512
|
+
if (fluidActive && autoResponsiveClasses.has(className)) {
|
|
4513
|
+
rule = applyFluidToUtilityRule(rule, className, responsiveScales, breakpoints);
|
|
4514
|
+
}
|
|
4302
4515
|
const escapedClassName = escapeCSSClassName(className);
|
|
4303
4516
|
const finalRule = applyRemConversion(rule, remConfig);
|
|
4304
4517
|
css.push(`.${escapedClassName} { ${finalRule} }`);
|
|
4305
4518
|
}
|
|
4306
4519
|
}
|
|
4307
4520
|
const autoResponsiveMediaQueries = {};
|
|
4308
|
-
if (responsiveScales?.enabled) {
|
|
4521
|
+
if (responsiveScales?.enabled && !fluidActive) {
|
|
4309
4522
|
for (const className of autoResponsiveClasses) {
|
|
4310
|
-
const propValue =
|
|
4523
|
+
const propValue = resolveScalablePropertyValue(className);
|
|
4311
4524
|
if (!propValue) continue;
|
|
4312
4525
|
const category = AUTO_RESPONSIVE_TYPE_MAP[propValue.property];
|
|
4313
4526
|
if (!category) continue;
|
|
@@ -4392,13 +4605,21 @@ function generateSingleClassCSS(className, breakpoints = DEFAULT_BREAKPOINTS, re
|
|
|
4392
4605
|
}
|
|
4393
4606
|
}
|
|
4394
4607
|
if (!matched) {
|
|
4395
|
-
|
|
4608
|
+
let rule = generateRuleForClass(className);
|
|
4396
4609
|
if (!rule) return "";
|
|
4610
|
+
const mode = getResponsiveMode(responsiveScales);
|
|
4611
|
+
const fluidActive = responsiveScales?.enabled === true && mode === "fluid";
|
|
4612
|
+
if (fluidActive) {
|
|
4613
|
+
const propValue = resolveScalablePropertyValue(className);
|
|
4614
|
+
if (propValue && AUTO_RESPONSIVE_TYPE_MAP[propValue.property]) {
|
|
4615
|
+
rule = applyFluidToUtilityRule(rule, className, responsiveScales, breakpoints);
|
|
4616
|
+
}
|
|
4617
|
+
}
|
|
4397
4618
|
const escapedClassName = escapeCSSClassName(className);
|
|
4398
4619
|
const finalRule = applyRemConversion(rule, remConfig);
|
|
4399
4620
|
css.push(`.${escapedClassName} { ${finalRule} }`);
|
|
4400
|
-
if (responsiveScales?.enabled) {
|
|
4401
|
-
const propValue =
|
|
4621
|
+
if (responsiveScales?.enabled && !fluidActive) {
|
|
4622
|
+
const propValue = resolveScalablePropertyValue(className);
|
|
4402
4623
|
if (propValue) {
|
|
4403
4624
|
const category = AUTO_RESPONSIVE_TYPE_MAP[propValue.property];
|
|
4404
4625
|
if (category) {
|
|
@@ -4536,6 +4757,8 @@ function generateInteractiveCSS(elementClass, interactiveStyles, breakpoints = D
|
|
|
4536
4757
|
const css = [];
|
|
4537
4758
|
const breakpointValues = getBreakpointValues(breakpoints);
|
|
4538
4759
|
const scalingEnabled = responsiveScales?.enabled === true;
|
|
4760
|
+
const mode = getResponsiveMode(responsiveScales);
|
|
4761
|
+
const fluidActive = scalingEnabled && mode === "fluid";
|
|
4539
4762
|
for (const rule of interactiveStyles) {
|
|
4540
4763
|
const { prefix, postfix, style } = rule;
|
|
4541
4764
|
const fullSelector = `${prefix || ""}.${elementClass}${postfix || ""}`;
|
|
@@ -4545,7 +4768,12 @@ function generateInteractiveCSS(elementClass, interactiveStyles, breakpoints = D
|
|
|
4545
4768
|
if (isResponsiveStyle2(style)) {
|
|
4546
4769
|
const responsive = style;
|
|
4547
4770
|
if (responsive.base && Object.keys(responsive.base).length > 0) {
|
|
4548
|
-
|
|
4771
|
+
let baseStyle = responsive.base;
|
|
4772
|
+
if (fluidActive) {
|
|
4773
|
+
baseStyle = applyContainerPattern(baseStyle, true);
|
|
4774
|
+
baseStyle = applyFluidToStyle(baseStyle, responsiveScales, breakpoints);
|
|
4775
|
+
}
|
|
4776
|
+
const properties = applyRemConversion(styleObjectToCSS(baseStyle), remConfig);
|
|
4549
4777
|
if (properties) {
|
|
4550
4778
|
css.push(`${fullSelector} { ${properties}; }`);
|
|
4551
4779
|
}
|
|
@@ -4554,9 +4782,9 @@ function generateInteractiveCSS(elementClass, interactiveStyles, breakpoints = D
|
|
|
4554
4782
|
const explicit = responsive[breakpointName];
|
|
4555
4783
|
let merged = null;
|
|
4556
4784
|
if (explicit && Object.keys(explicit).length > 0) {
|
|
4557
|
-
merged = { ...explicit };
|
|
4785
|
+
merged = fluidActive ? applyContainerPattern({ ...explicit }, true) : { ...explicit };
|
|
4558
4786
|
}
|
|
4559
|
-
if (scalingEnabled && responsive.base) {
|
|
4787
|
+
if (scalingEnabled && !fluidActive && responsive.base) {
|
|
4560
4788
|
const scaled = scaleStyleForBreakpoint(
|
|
4561
4789
|
responsive.base,
|
|
4562
4790
|
responsiveScales,
|
|
@@ -4579,11 +4807,16 @@ function generateInteractiveCSS(elementClass, interactiveStyles, breakpoints = D
|
|
|
4579
4807
|
} else {
|
|
4580
4808
|
const flatStyle = style;
|
|
4581
4809
|
if (Object.keys(flatStyle).length > 0) {
|
|
4582
|
-
|
|
4810
|
+
let baseFlat = flatStyle;
|
|
4811
|
+
if (fluidActive) {
|
|
4812
|
+
baseFlat = applyContainerPattern(baseFlat, true);
|
|
4813
|
+
baseFlat = applyFluidToStyle(baseFlat, responsiveScales, breakpoints);
|
|
4814
|
+
}
|
|
4815
|
+
const properties = applyRemConversion(styleObjectToCSS(baseFlat), remConfig);
|
|
4583
4816
|
if (properties) {
|
|
4584
4817
|
css.push(`${fullSelector} { ${properties}; }`);
|
|
4585
4818
|
}
|
|
4586
|
-
if (scalingEnabled) {
|
|
4819
|
+
if (scalingEnabled && !fluidActive) {
|
|
4587
4820
|
for (const [breakpointName, breakpointValue] of sortedBreakpoints) {
|
|
4588
4821
|
const scaled = scaleStyleForBreakpoint(
|
|
4589
4822
|
flatStyle,
|
|
@@ -4665,6 +4898,7 @@ export {
|
|
|
4665
4898
|
validatePageMetaData,
|
|
4666
4899
|
validateCMSSchema,
|
|
4667
4900
|
validateCMSItem,
|
|
4901
|
+
validateCMSDraftItem,
|
|
4668
4902
|
singularize,
|
|
4669
4903
|
isItemDraftForLocale,
|
|
4670
4904
|
isItemFullyPublished,
|
|
@@ -4789,6 +5023,7 @@ export {
|
|
|
4789
5023
|
pathsEqual,
|
|
4790
5024
|
convertPagePathToComponentPath,
|
|
4791
5025
|
convertComponentPathToPagePath,
|
|
5026
|
+
shortHash2 as shortHash,
|
|
4792
5027
|
generateElementClassName,
|
|
4793
5028
|
isElementClassName,
|
|
4794
5029
|
parseElementClassName,
|
|
@@ -4804,10 +5039,11 @@ export {
|
|
|
4804
5039
|
isCssNamedColor,
|
|
4805
5040
|
sortClassesByPropertyOrder,
|
|
4806
5041
|
generateRuleForClass,
|
|
5042
|
+
applyContainerPattern,
|
|
4807
5043
|
generateUtilityCSS,
|
|
4808
5044
|
generateSingleClassCSS,
|
|
4809
5045
|
extractUtilityClassesFromHTML,
|
|
4810
5046
|
generateInteractiveCSS,
|
|
4811
5047
|
generateAllInteractiveCSS
|
|
4812
5048
|
};
|
|
4813
|
-
//# sourceMappingURL=chunk-
|
|
5049
|
+
//# sourceMappingURL=chunk-S2CX6HFM.js.map
|