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
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
parseJSON,
|
|
17
17
|
resolveSlugToPageId,
|
|
18
18
|
variableService
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-77ZB6353.js";
|
|
20
20
|
import {
|
|
21
21
|
configService
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ZTKHJQ2Z.js";
|
|
23
23
|
import {
|
|
24
24
|
bundleFile,
|
|
25
25
|
createRuntimeServer,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
projectPaths,
|
|
30
30
|
resolvePackagePath,
|
|
31
31
|
resolveProjectPath
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-I7YIGZXT.js";
|
|
33
33
|
import {
|
|
34
34
|
fileExists,
|
|
35
35
|
hashContent,
|
|
@@ -39,16 +39,16 @@ import {
|
|
|
39
39
|
} from "./chunk-WQFG7PAH.js";
|
|
40
40
|
import {
|
|
41
41
|
extractStringValue
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-IF3RATBY.js";
|
|
43
43
|
import {
|
|
44
44
|
isPathWithinRoot
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-KITQJYZV.js";
|
|
46
46
|
import {
|
|
47
47
|
addItemUrls
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-FED5MME6.js";
|
|
49
49
|
import {
|
|
50
50
|
parseLocaleFromPath
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-XSWR3QLI.js";
|
|
52
52
|
import {
|
|
53
53
|
API_ROUTES,
|
|
54
54
|
HMR_ROUTE,
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
SERVER_PORT,
|
|
57
57
|
WEBSOCKET_STATES,
|
|
58
58
|
init_constants
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-2QK6U5UK.js";
|
|
60
60
|
|
|
61
61
|
// lib/server/pageCache.ts
|
|
62
62
|
var PageCache = class {
|
|
@@ -3221,4 +3221,4 @@ export {
|
|
|
3221
3221
|
createServer,
|
|
3222
3222
|
FileSystemPageProvider
|
|
3223
3223
|
};
|
|
3224
|
-
//# sourceMappingURL=chunk-
|
|
3224
|
+
//# sourceMappingURL=chunk-C6U5T5S5.js.map
|
|
@@ -5,12 +5,13 @@ import {
|
|
|
5
5
|
convertPxToRem,
|
|
6
6
|
getBreakpointName,
|
|
7
7
|
getBreakpointValues,
|
|
8
|
+
getScaleMultiplier,
|
|
8
9
|
isI18nValue,
|
|
9
10
|
resolveI18nInProps,
|
|
10
11
|
resolveI18nValue,
|
|
11
12
|
scalePropertyValue,
|
|
12
13
|
shouldConvertProperty
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-XSWR3QLI.js";
|
|
14
15
|
import {
|
|
15
16
|
isTiptapDocument,
|
|
16
17
|
tiptapToHtml
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
import {
|
|
19
20
|
NODE_TYPE,
|
|
20
21
|
init_constants
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-2QK6U5UK.js";
|
|
22
23
|
import {
|
|
23
24
|
__esm,
|
|
24
25
|
__export,
|
|
@@ -32,8 +33,8 @@ var init_schemas = __esm({
|
|
|
32
33
|
"lib/shared/validation/schemas.ts"() {
|
|
33
34
|
"use strict";
|
|
34
35
|
init_constants();
|
|
35
|
-
BasePropTypeSchema = z.enum(["string", "select", "boolean", "number", "link", "file", "rich-text"]);
|
|
36
|
-
PropTypeSchema = z.enum(["string", "select", "boolean", "number", "link", "file", "rich-text", "list"]);
|
|
36
|
+
BasePropTypeSchema = z.enum(["string", "select", "boolean", "number", "link", "file", "rich-text", "embed"]);
|
|
37
|
+
PropTypeSchema = z.enum(["string", "select", "boolean", "number", "link", "file", "rich-text", "embed", "list"]);
|
|
37
38
|
BasePropDefinitionSchema = z.object({
|
|
38
39
|
type: BasePropTypeSchema,
|
|
39
40
|
default: z.union([z.string(), z.number(), z.boolean(), z.object({ href: z.string(), target: z.string().optional() })]).optional(),
|
|
@@ -2278,10 +2279,9 @@ function mergeResponsiveStyles(responsiveStyle, strategy = "all", viewportWidth,
|
|
|
2278
2279
|
return merged;
|
|
2279
2280
|
}
|
|
2280
2281
|
const breakpointEntries = Object.entries(breakpointValues);
|
|
2281
|
-
breakpointEntries.sort((a, b) =>
|
|
2282
|
-
const activeBreakpointValue = breakpointValues[activeBreakpoint];
|
|
2282
|
+
breakpointEntries.sort((a, b) => b[1] - a[1]);
|
|
2283
2283
|
for (const [name, value] of breakpointEntries) {
|
|
2284
|
-
if (
|
|
2284
|
+
if (viewportWidth <= value && responsiveStyle[name]) {
|
|
2285
2285
|
Object.assign(merged, responsiveStyle[name]);
|
|
2286
2286
|
}
|
|
2287
2287
|
}
|
|
@@ -2397,6 +2397,25 @@ function isLikelyComponentTag(tag) {
|
|
|
2397
2397
|
function isSlotMarker(node) {
|
|
2398
2398
|
return node?.type === NODE_TYPE.SLOT;
|
|
2399
2399
|
}
|
|
2400
|
+
function componentHasSlot(def) {
|
|
2401
|
+
const structure = def?.component?.structure;
|
|
2402
|
+
if (!structure) return false;
|
|
2403
|
+
return structureContainsSlot(structure);
|
|
2404
|
+
}
|
|
2405
|
+
function structureContainsSlot(node) {
|
|
2406
|
+
if (node == null) return false;
|
|
2407
|
+
if (Array.isArray(node)) {
|
|
2408
|
+
for (const item of node) {
|
|
2409
|
+
if (structureContainsSlot(item)) return true;
|
|
2410
|
+
}
|
|
2411
|
+
return false;
|
|
2412
|
+
}
|
|
2413
|
+
if (typeof node !== "object") return false;
|
|
2414
|
+
const obj = node;
|
|
2415
|
+
if (obj.type === NODE_TYPE.SLOT) return true;
|
|
2416
|
+
if (obj.children !== void 0) return structureContainsSlot(obj.children);
|
|
2417
|
+
return false;
|
|
2418
|
+
}
|
|
2400
2419
|
function isEmbedNode(node) {
|
|
2401
2420
|
return node?.type === NODE_TYPE.EMBED;
|
|
2402
2421
|
}
|
|
@@ -2601,6 +2620,10 @@ function validateSingleProp(propName, propDef, value) {
|
|
|
2601
2620
|
coercedValue = value;
|
|
2602
2621
|
typeValid = typeof value === "string";
|
|
2603
2622
|
break;
|
|
2623
|
+
case "embed":
|
|
2624
|
+
coercedValue = value;
|
|
2625
|
+
typeValid = typeof value === "string";
|
|
2626
|
+
break;
|
|
2604
2627
|
case "list":
|
|
2605
2628
|
coercedValue = value;
|
|
2606
2629
|
typeValid = Array.isArray(value) || isI18nValue(value);
|
|
@@ -3242,7 +3265,16 @@ function propertyValueToClass(prop, value) {
|
|
|
3242
3265
|
registerDynamicStyle(className2, cssProperty, value);
|
|
3243
3266
|
return className2;
|
|
3244
3267
|
}
|
|
3245
|
-
|
|
3268
|
+
let stringValue = String(value);
|
|
3269
|
+
if (prop === "fontFamily") {
|
|
3270
|
+
stringValue = stringValue.split(",").map((font) => {
|
|
3271
|
+
const trimmed = font.trim();
|
|
3272
|
+
if (trimmed.startsWith('"') && trimmed.endsWith('"') || trimmed.startsWith("'") && trimmed.endsWith("'")) {
|
|
3273
|
+
return trimmed.slice(1, -1);
|
|
3274
|
+
}
|
|
3275
|
+
return trimmed;
|
|
3276
|
+
}).join(", ");
|
|
3277
|
+
}
|
|
3246
3278
|
let className = null;
|
|
3247
3279
|
if (specialValueMappings[prop]) {
|
|
3248
3280
|
const mapping = specialValueMappings[prop];
|
|
@@ -3793,6 +3825,170 @@ function isCurrentLink(href, currentPagePath) {
|
|
|
3793
3825
|
return normalizePath(href) === normalizePath(currentPagePath);
|
|
3794
3826
|
}
|
|
3795
3827
|
|
|
3828
|
+
// lib/shared/cssNamedColors.ts
|
|
3829
|
+
var CSS_NAMED_COLORS = /* @__PURE__ */ new Set([
|
|
3830
|
+
// CSS Level 4 named colors
|
|
3831
|
+
"aliceblue",
|
|
3832
|
+
"antiquewhite",
|
|
3833
|
+
"aqua",
|
|
3834
|
+
"aquamarine",
|
|
3835
|
+
"azure",
|
|
3836
|
+
"beige",
|
|
3837
|
+
"bisque",
|
|
3838
|
+
"black",
|
|
3839
|
+
"blanchedalmond",
|
|
3840
|
+
"blue",
|
|
3841
|
+
"blueviolet",
|
|
3842
|
+
"brown",
|
|
3843
|
+
"burlywood",
|
|
3844
|
+
"cadetblue",
|
|
3845
|
+
"chartreuse",
|
|
3846
|
+
"chocolate",
|
|
3847
|
+
"coral",
|
|
3848
|
+
"cornflowerblue",
|
|
3849
|
+
"cornsilk",
|
|
3850
|
+
"crimson",
|
|
3851
|
+
"cyan",
|
|
3852
|
+
"darkblue",
|
|
3853
|
+
"darkcyan",
|
|
3854
|
+
"darkgoldenrod",
|
|
3855
|
+
"darkgray",
|
|
3856
|
+
"darkgreen",
|
|
3857
|
+
"darkgrey",
|
|
3858
|
+
"darkkhaki",
|
|
3859
|
+
"darkmagenta",
|
|
3860
|
+
"darkolivegreen",
|
|
3861
|
+
"darkorange",
|
|
3862
|
+
"darkorchid",
|
|
3863
|
+
"darkred",
|
|
3864
|
+
"darksalmon",
|
|
3865
|
+
"darkseagreen",
|
|
3866
|
+
"darkslateblue",
|
|
3867
|
+
"darkslategray",
|
|
3868
|
+
"darkslategrey",
|
|
3869
|
+
"darkturquoise",
|
|
3870
|
+
"darkviolet",
|
|
3871
|
+
"deeppink",
|
|
3872
|
+
"deepskyblue",
|
|
3873
|
+
"dimgray",
|
|
3874
|
+
"dimgrey",
|
|
3875
|
+
"dodgerblue",
|
|
3876
|
+
"firebrick",
|
|
3877
|
+
"floralwhite",
|
|
3878
|
+
"forestgreen",
|
|
3879
|
+
"fuchsia",
|
|
3880
|
+
"gainsboro",
|
|
3881
|
+
"ghostwhite",
|
|
3882
|
+
"gold",
|
|
3883
|
+
"goldenrod",
|
|
3884
|
+
"gray",
|
|
3885
|
+
"green",
|
|
3886
|
+
"greenyellow",
|
|
3887
|
+
"grey",
|
|
3888
|
+
"honeydew",
|
|
3889
|
+
"hotpink",
|
|
3890
|
+
"indianred",
|
|
3891
|
+
"indigo",
|
|
3892
|
+
"ivory",
|
|
3893
|
+
"khaki",
|
|
3894
|
+
"lavender",
|
|
3895
|
+
"lavenderblush",
|
|
3896
|
+
"lawngreen",
|
|
3897
|
+
"lemonchiffon",
|
|
3898
|
+
"lightblue",
|
|
3899
|
+
"lightcoral",
|
|
3900
|
+
"lightcyan",
|
|
3901
|
+
"lightgoldenrodyellow",
|
|
3902
|
+
"lightgray",
|
|
3903
|
+
"lightgreen",
|
|
3904
|
+
"lightgrey",
|
|
3905
|
+
"lightpink",
|
|
3906
|
+
"lightsalmon",
|
|
3907
|
+
"lightseagreen",
|
|
3908
|
+
"lightskyblue",
|
|
3909
|
+
"lightslategray",
|
|
3910
|
+
"lightslategrey",
|
|
3911
|
+
"lightsteelblue",
|
|
3912
|
+
"lightyellow",
|
|
3913
|
+
"lime",
|
|
3914
|
+
"limegreen",
|
|
3915
|
+
"linen",
|
|
3916
|
+
"magenta",
|
|
3917
|
+
"maroon",
|
|
3918
|
+
"mediumaquamarine",
|
|
3919
|
+
"mediumblue",
|
|
3920
|
+
"mediumorchid",
|
|
3921
|
+
"mediumpurple",
|
|
3922
|
+
"mediumseagreen",
|
|
3923
|
+
"mediumslateblue",
|
|
3924
|
+
"mediumspringgreen",
|
|
3925
|
+
"mediumturquoise",
|
|
3926
|
+
"mediumvioletred",
|
|
3927
|
+
"midnightblue",
|
|
3928
|
+
"mintcream",
|
|
3929
|
+
"mistyrose",
|
|
3930
|
+
"moccasin",
|
|
3931
|
+
"navajowhite",
|
|
3932
|
+
"navy",
|
|
3933
|
+
"oldlace",
|
|
3934
|
+
"olive",
|
|
3935
|
+
"olivedrab",
|
|
3936
|
+
"orange",
|
|
3937
|
+
"orangered",
|
|
3938
|
+
"orchid",
|
|
3939
|
+
"palegoldenrod",
|
|
3940
|
+
"palegreen",
|
|
3941
|
+
"paleturquoise",
|
|
3942
|
+
"palevioletred",
|
|
3943
|
+
"papayawhip",
|
|
3944
|
+
"peachpuff",
|
|
3945
|
+
"peru",
|
|
3946
|
+
"pink",
|
|
3947
|
+
"plum",
|
|
3948
|
+
"powderblue",
|
|
3949
|
+
"purple",
|
|
3950
|
+
"rebeccapurple",
|
|
3951
|
+
"red",
|
|
3952
|
+
"rosybrown",
|
|
3953
|
+
"royalblue",
|
|
3954
|
+
"saddlebrown",
|
|
3955
|
+
"salmon",
|
|
3956
|
+
"sandybrown",
|
|
3957
|
+
"seagreen",
|
|
3958
|
+
"seashell",
|
|
3959
|
+
"sienna",
|
|
3960
|
+
"silver",
|
|
3961
|
+
"skyblue",
|
|
3962
|
+
"slateblue",
|
|
3963
|
+
"slategray",
|
|
3964
|
+
"slategrey",
|
|
3965
|
+
"snow",
|
|
3966
|
+
"springgreen",
|
|
3967
|
+
"steelblue",
|
|
3968
|
+
"tan",
|
|
3969
|
+
"teal",
|
|
3970
|
+
"thistle",
|
|
3971
|
+
"tomato",
|
|
3972
|
+
"turquoise",
|
|
3973
|
+
"violet",
|
|
3974
|
+
"wheat",
|
|
3975
|
+
"white",
|
|
3976
|
+
"whitesmoke",
|
|
3977
|
+
"yellow",
|
|
3978
|
+
"yellowgreen",
|
|
3979
|
+
// CSS color keywords
|
|
3980
|
+
"transparent",
|
|
3981
|
+
"currentcolor",
|
|
3982
|
+
// CSS-wide keywords (should never be wrapped in var())
|
|
3983
|
+
"inherit",
|
|
3984
|
+
"initial",
|
|
3985
|
+
"unset",
|
|
3986
|
+
"revert"
|
|
3987
|
+
]);
|
|
3988
|
+
function isCssNamedColor(value) {
|
|
3989
|
+
return CSS_NAMED_COLORS.has(value.toLowerCase());
|
|
3990
|
+
}
|
|
3991
|
+
|
|
3796
3992
|
// lib/shared/cssGeneration.ts
|
|
3797
3993
|
var SORTED_PREFIXES = Object.keys(prefixToCSSProperty).sort((a, b) => b.length - a.length);
|
|
3798
3994
|
var cssPropertyOrderMap = (() => {
|
|
@@ -3837,7 +4033,18 @@ var AUTO_RESPONSIVE_TYPE_MAP = {
|
|
|
3837
4033
|
"font-size": "fontSize",
|
|
3838
4034
|
"gap": "gap",
|
|
3839
4035
|
"row-gap": "gap",
|
|
3840
|
-
"column-gap": "gap"
|
|
4036
|
+
"column-gap": "gap",
|
|
4037
|
+
"border-radius": "borderRadius",
|
|
4038
|
+
"border-top-left-radius": "borderRadius",
|
|
4039
|
+
"border-top-right-radius": "borderRadius",
|
|
4040
|
+
"border-bottom-left-radius": "borderRadius",
|
|
4041
|
+
"border-bottom-right-radius": "borderRadius",
|
|
4042
|
+
"width": "size",
|
|
4043
|
+
"height": "size",
|
|
4044
|
+
"max-width": "size",
|
|
4045
|
+
"max-height": "size",
|
|
4046
|
+
"min-width": "size",
|
|
4047
|
+
"min-height": "size"
|
|
3841
4048
|
};
|
|
3842
4049
|
function escapeCSSClassName(className) {
|
|
3843
4050
|
return className.replace(/[.#[\](){};<>+~:,%\/\s]/g, "\\$&");
|
|
@@ -4038,6 +4245,9 @@ function generateRuleForClass(className) {
|
|
|
4038
4245
|
}
|
|
4039
4246
|
if (prefix === "bgc" || prefix === "bg" || prefix === "c" || prefix === "bc") {
|
|
4040
4247
|
if (!value.startsWith("#") && !value.includes("rgb") && !value.includes("px")) {
|
|
4248
|
+
if (isCssNamedColor(value)) {
|
|
4249
|
+
return `${cssProp}: ${value};`;
|
|
4250
|
+
}
|
|
4041
4251
|
return `${cssProp}: var(--${value});`;
|
|
4042
4252
|
}
|
|
4043
4253
|
}
|
|
@@ -4322,12 +4532,16 @@ function styleObjectToCSS(style) {
|
|
|
4322
4532
|
}
|
|
4323
4533
|
return declarations.join("; ");
|
|
4324
4534
|
}
|
|
4325
|
-
function generateInteractiveCSS(elementClass, interactiveStyles, breakpoints = DEFAULT_BREAKPOINTS, remConfig) {
|
|
4535
|
+
function generateInteractiveCSS(elementClass, interactiveStyles, breakpoints = DEFAULT_BREAKPOINTS, remConfig, responsiveScales) {
|
|
4326
4536
|
const css = [];
|
|
4327
4537
|
const breakpointValues = getBreakpointValues(breakpoints);
|
|
4538
|
+
const scalingEnabled = responsiveScales?.enabled === true;
|
|
4328
4539
|
for (const rule of interactiveStyles) {
|
|
4329
4540
|
const { prefix, postfix, style } = rule;
|
|
4330
4541
|
const fullSelector = `${prefix || ""}.${elementClass}${postfix || ""}`;
|
|
4542
|
+
const sortedBreakpoints = Object.entries(breakpointValues).sort(
|
|
4543
|
+
([, a], [, b]) => b - a
|
|
4544
|
+
);
|
|
4331
4545
|
if (isResponsiveStyle2(style)) {
|
|
4332
4546
|
const responsive = style;
|
|
4333
4547
|
if (responsive.base && Object.keys(responsive.base).length > 0) {
|
|
@@ -4336,13 +4550,25 @@ function generateInteractiveCSS(elementClass, interactiveStyles, breakpoints = D
|
|
|
4336
4550
|
css.push(`${fullSelector} { ${properties}; }`);
|
|
4337
4551
|
}
|
|
4338
4552
|
}
|
|
4339
|
-
const sortedBreakpoints = Object.entries(breakpointValues).sort(
|
|
4340
|
-
([, a], [, b]) => b - a
|
|
4341
|
-
);
|
|
4342
4553
|
for (const [breakpointName, breakpointValue] of sortedBreakpoints) {
|
|
4343
|
-
const
|
|
4344
|
-
|
|
4345
|
-
|
|
4554
|
+
const explicit = responsive[breakpointName];
|
|
4555
|
+
let merged = null;
|
|
4556
|
+
if (explicit && Object.keys(explicit).length > 0) {
|
|
4557
|
+
merged = { ...explicit };
|
|
4558
|
+
}
|
|
4559
|
+
if (scalingEnabled && responsive.base) {
|
|
4560
|
+
const scaled = scaleStyleForBreakpoint(
|
|
4561
|
+
responsive.base,
|
|
4562
|
+
responsiveScales,
|
|
4563
|
+
breakpointName,
|
|
4564
|
+
new Set(Object.keys(explicit ?? {}))
|
|
4565
|
+
);
|
|
4566
|
+
if (Object.keys(scaled).length > 0) {
|
|
4567
|
+
merged = { ...merged ?? {}, ...scaled };
|
|
4568
|
+
}
|
|
4569
|
+
}
|
|
4570
|
+
if (merged && Object.keys(merged).length > 0) {
|
|
4571
|
+
const properties = applyRemConversion(styleObjectToCSS(merged), remConfig);
|
|
4346
4572
|
if (properties) {
|
|
4347
4573
|
css.push(
|
|
4348
4574
|
`@media (max-width: ${breakpointValue}px) { ${fullSelector} { ${properties}; } }`
|
|
@@ -4357,15 +4583,52 @@ function generateInteractiveCSS(elementClass, interactiveStyles, breakpoints = D
|
|
|
4357
4583
|
if (properties) {
|
|
4358
4584
|
css.push(`${fullSelector} { ${properties}; }`);
|
|
4359
4585
|
}
|
|
4586
|
+
if (scalingEnabled) {
|
|
4587
|
+
for (const [breakpointName, breakpointValue] of sortedBreakpoints) {
|
|
4588
|
+
const scaled = scaleStyleForBreakpoint(
|
|
4589
|
+
flatStyle,
|
|
4590
|
+
responsiveScales,
|
|
4591
|
+
breakpointName,
|
|
4592
|
+
/* @__PURE__ */ new Set()
|
|
4593
|
+
);
|
|
4594
|
+
if (Object.keys(scaled).length === 0) continue;
|
|
4595
|
+
const scaledProps = applyRemConversion(styleObjectToCSS(scaled), remConfig);
|
|
4596
|
+
if (!scaledProps) continue;
|
|
4597
|
+
css.push(
|
|
4598
|
+
`@media (max-width: ${breakpointValue}px) { ${fullSelector} { ${scaledProps}; } }`
|
|
4599
|
+
);
|
|
4600
|
+
}
|
|
4601
|
+
}
|
|
4360
4602
|
}
|
|
4361
4603
|
}
|
|
4362
4604
|
}
|
|
4363
4605
|
return css.join("\n");
|
|
4364
4606
|
}
|
|
4365
|
-
function
|
|
4607
|
+
function scaleStyleForBreakpoint(baseStyle, responsiveScales, breakpointName, skipProperties) {
|
|
4608
|
+
const result = {};
|
|
4609
|
+
const baseRef = responsiveScales.baseReference ?? 16;
|
|
4610
|
+
for (const [property, value] of Object.entries(baseStyle)) {
|
|
4611
|
+
if (skipProperties.has(property)) continue;
|
|
4612
|
+
if (typeof value === "object" && value !== null && "_mapping" in value) continue;
|
|
4613
|
+
if (value == null) continue;
|
|
4614
|
+
const strValue = String(value);
|
|
4615
|
+
if (strValue === "") continue;
|
|
4616
|
+
const scale = getScaleMultiplier(
|
|
4617
|
+
responsiveScales,
|
|
4618
|
+
property,
|
|
4619
|
+
breakpointName
|
|
4620
|
+
);
|
|
4621
|
+
if (scale == null) continue;
|
|
4622
|
+
const scaledValue = scalePropertyValue(strValue, baseRef, scale);
|
|
4623
|
+
if (scaledValue == null || scaledValue === strValue) continue;
|
|
4624
|
+
result[property] = scaledValue;
|
|
4625
|
+
}
|
|
4626
|
+
return result;
|
|
4627
|
+
}
|
|
4628
|
+
function generateAllInteractiveCSS(interactiveStylesMap, breakpoints = DEFAULT_BREAKPOINTS, remConfig, responsiveScales) {
|
|
4366
4629
|
const cssBlocks = [];
|
|
4367
4630
|
for (const [elementClass, styles] of interactiveStylesMap) {
|
|
4368
|
-
const css = generateInteractiveCSS(elementClass, styles, breakpoints, remConfig);
|
|
4631
|
+
const css = generateInteractiveCSS(elementClass, styles, breakpoints, remConfig, responsiveScales);
|
|
4369
4632
|
if (css) {
|
|
4370
4633
|
cssBlocks.push(css);
|
|
4371
4634
|
}
|
|
@@ -4468,6 +4731,7 @@ export {
|
|
|
4468
4731
|
extractNodeProperties,
|
|
4469
4732
|
isLikelyComponentTag,
|
|
4470
4733
|
isSlotMarker,
|
|
4734
|
+
componentHasSlot,
|
|
4471
4735
|
isEmbedNode,
|
|
4472
4736
|
isLinkNode,
|
|
4473
4737
|
isLocaleListNode,
|
|
@@ -4536,6 +4800,8 @@ export {
|
|
|
4536
4800
|
createStyleMappingFromProps,
|
|
4537
4801
|
normalizePath,
|
|
4538
4802
|
isCurrentLink,
|
|
4803
|
+
CSS_NAMED_COLORS,
|
|
4804
|
+
isCssNamedColor,
|
|
4539
4805
|
sortClassesByPropertyOrder,
|
|
4540
4806
|
generateRuleForClass,
|
|
4541
4807
|
generateUtilityCSS,
|
|
@@ -4544,4 +4810,4 @@ export {
|
|
|
4544
4810
|
generateInteractiveCSS,
|
|
4545
4811
|
generateAllInteractiveCSS
|
|
4546
4812
|
};
|
|
4547
|
-
//# sourceMappingURL=chunk-
|
|
4813
|
+
//# sourceMappingURL=chunk-FED5MME6.js.map
|