meno-core 1.1.6 → 1.1.8
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/dist/bin/cli.js +1 -1
- package/dist/chunks/{chunk-XTKNX4FW.js → chunk-AMNAKQAI.js} +25 -11
- package/dist/chunks/{chunk-XTKNX4FW.js.map → chunk-AMNAKQAI.js.map} +2 -2
- package/dist/chunks/{chunk-YMBUSHII.js → chunk-CG3O7H5V.js} +9 -4
- package/dist/chunks/chunk-CG3O7H5V.js.map +7 -0
- package/dist/chunks/{chunk-4ZRU52J2.js → chunk-EJ6QOX7C.js} +14 -10
- package/dist/chunks/chunk-EJ6QOX7C.js.map +7 -0
- package/dist/chunks/{chunk-KX2LPIZZ.js → chunk-EKB7GGQK.js} +223 -38
- package/dist/chunks/chunk-EKB7GGQK.js.map +7 -0
- package/dist/chunks/{chunk-GHNLTFCN.js → chunk-G6OXV2IV.js} +3 -3
- package/dist/chunks/{chunk-GHNLTFCN.js.map → chunk-G6OXV2IV.js.map} +2 -2
- package/dist/lib/client/index.js +9 -5
- package/dist/lib/client/index.js.map +2 -2
- package/dist/lib/server/index.js +14 -5
- package/dist/lib/server/index.js.map +2 -2
- package/dist/lib/shared/index.js +18 -6
- package/dist/lib/shared/index.js.map +2 -2
- package/lib/client/core/ComponentBuilder.test.ts +40 -0
- package/lib/client/core/ComponentBuilder.ts +8 -1
- package/lib/server/routes/static.test.ts +67 -0
- package/lib/server/routes/static.ts +9 -1
- package/lib/server/ssr/htmlGenerator.ts +7 -0
- package/lib/server/ssr/ssrRenderer.test.ts +64 -0
- package/lib/server/ssr/ssrRenderer.ts +8 -1
- package/lib/shared/attributeNodeUtils.test.ts +25 -0
- package/lib/shared/attributeNodeUtils.ts +9 -1
- package/lib/shared/cssGeneration.test.ts +150 -9
- package/lib/shared/cssGeneration.ts +116 -31
- package/lib/shared/cssProperties.ts +40 -14
- package/lib/shared/i18n.test.ts +21 -0
- package/lib/shared/i18n.ts +24 -10
- package/lib/shared/nodeUtils.test.ts +22 -0
- package/lib/shared/nodeUtils.ts +39 -4
- package/lib/shared/permissions.test.ts +46 -6
- package/lib/shared/permissions.ts +14 -2
- package/lib/shared/pxToRem.ts +2 -0
- package/lib/shared/responsiveScaling.test.ts +19 -0
- package/lib/shared/responsiveScaling.ts +8 -3
- package/lib/shared/styleUtils.ts +53 -0
- package/lib/shared/tailwindThemeScale.ts +91 -0
- package/lib/shared/types/components.ts +45 -7
- package/lib/shared/types/index.ts +1 -0
- package/lib/shared/types/permissions.ts +27 -11
- package/lib/shared/utilityClassMapper.test.ts +105 -0
- package/lib/shared/utilityClassMapper.ts +43 -5
- package/lib/shared/utilityClassNames.ts +14 -1
- package/lib/shared/validation/propValidator.test.ts +47 -0
- package/lib/shared/validation/propValidator.ts +8 -0
- package/lib/shared/validation/schemas.test.ts +149 -16
- package/lib/shared/validation/schemas.ts +101 -5
- package/package.json +1 -1
- package/dist/chunks/chunk-4ZRU52J2.js.map +0 -7
- package/dist/chunks/chunk-KX2LPIZZ.js.map +0 -7
- package/dist/chunks/chunk-YMBUSHII.js.map +0 -7
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
isI18nValue,
|
|
4
4
|
resolveI18nInProps,
|
|
5
5
|
resolveI18nValue
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EJ6QOX7C.js";
|
|
7
7
|
import {
|
|
8
8
|
isTiptapDocument,
|
|
9
9
|
tiptapToHtml
|
|
@@ -65,7 +65,7 @@ var init_errorLogger = __esm({
|
|
|
65
65
|
|
|
66
66
|
// lib/shared/validation/schemas.ts
|
|
67
67
|
import { z } from "zod";
|
|
68
|
-
var BasePropTypeSchema, PropTypeSchema, I18nValueObjectSchema, BasePropDefinitionSchema, EnumsConfigSchema, ListItemSchemaSchema, ListPropDefinitionSchema, PropDefinitionSchema, StyleMappingSchema, BooleanMappingSchema, VerbatimCodeSchema, IfConditionSchema, LinkMappingSchema, HtmlMappingSchema, StyleObjectSchema, ResponsiveStyleObjectSchema, StyleValueSchema, InteractiveStyleRuleSchema, InteractiveStylesSchema, SlotMarkerSchema, ComponentNodeSchema, HtmlNodeSchema, ComponentInstanceNodeSchema, EmbedNodeSchema, LinkNodeSchema, LocaleListNodeSchema, ListNodeSchemaBasic, IslandNodeSchema, MarkdownNodeSchema, CustomNodeSchema, ScriptLoadModeSchema, LibraryPositionSchema, ScriptTypeSchema, JSLibraryConfigSchema, CSSLibraryConfigSchema, LibrariesConfigSchema, StructuredComponentDefinitionSchema, ComponentDefinitionSchema, I18nOrStringSchema, LibraryMergeModeSchema, PageLibrariesConfigSchema, CustomCodeConfigSchema, SitemapPageConfigSchema, PageMetaDataBaseSchema, PageMetaDataSchema, LineRangeSchema, JSONPageSchema, PageDataWithComponentSchema, PageDataSchema, CMSFieldTypeSchema, CMSFieldDefinitionSchema, CMSClientDataStrategySchema, CMSClientDataConfigSchema, CMSSchemaSchema, CMSItemSchema, CMSDraftItemSchema, CMSFilterConditionSchema, CMSSortConfigSchema, CMSListQuerySchema, CMSListNodeSchema, PageCmsConfigSchema, PageDataSourceSchema, PageDataConfigSchema, PageMetaDataWithCMSSchema;
|
|
68
|
+
var BasePropTypeSchema, PropTypeSchema, I18nValueObjectSchema, BasePropDefinitionSchema, EnumsConfigSchema, ListItemSchemaSchema, ListPropDefinitionSchema, CMS_ONLY_FIELD_TYPES, ReferencePropDefinitionSchema, PropDefinitionSchema, StyleMappingSchema, BooleanMappingSchema, VerbatimCodeSchema, IfConditionSchema, LinkMappingSchema, HtmlMappingSchema, StyleObjectSchema, ResponsiveStyleObjectSchema, StyleValueSchema, InteractiveStyleRuleSchema, InteractiveStylesSchema, SlotMarkerSchema, ComponentNodeSchema, HtmlNodeSchema, ComponentInstanceNodeSchema, EmbedNodeSchema, LinkNodeSchema, LocaleListNodeSchema, ListNodeSchemaBasic, IslandNodeSchema, MarkdownNodeSchema, CustomNodeSchema, ScriptLoadModeSchema, LibraryPositionSchema, ScriptTypeSchema, JSLibraryConfigSchema, CSSLibraryConfigSchema, LibrariesConfigSchema, StructuredComponentDefinitionSchema, ComponentDefinitionSchema, I18nOrStringSchema, LibraryMergeModeSchema, PageLibrariesConfigSchema, CustomCodeConfigSchema, SitemapPageConfigSchema, PageMetaDataBaseSchema, PageMetaDataSchema, LineRangeSchema, JSONPageSchema, PageDataWithComponentSchema, PageDataSchema, CMSFieldTypeSchema, CMSFieldDefinitionSchema, CMSClientDataStrategySchema, CMSClientDataConfigSchema, CMSSchemaSchema, CMSItemSchema, CMSDraftItemSchema, CMSFilterConditionSchema, CMSSortConfigSchema, CMSListQuerySchema, CMSListNodeSchema, PageCmsConfigSchema, PageDataSourceSchema, PageDataConfigSchema, PageMetaDataWithCMSSchema;
|
|
69
69
|
var init_schemas = __esm({
|
|
70
70
|
"lib/shared/validation/schemas.ts"() {
|
|
71
71
|
"use strict";
|
|
@@ -89,7 +89,8 @@ var init_schemas = __esm({
|
|
|
89
89
|
"file",
|
|
90
90
|
"rich-text",
|
|
91
91
|
"embed",
|
|
92
|
-
"list"
|
|
92
|
+
"list",
|
|
93
|
+
"reference"
|
|
93
94
|
]);
|
|
94
95
|
I18nValueObjectSchema = z.object({
|
|
95
96
|
_i18n: z.literal(true)
|
|
@@ -132,17 +133,60 @@ var init_schemas = __esm({
|
|
|
132
133
|
)
|
|
133
134
|
).optional()
|
|
134
135
|
}).passthrough();
|
|
136
|
+
CMS_ONLY_FIELD_TYPES = {
|
|
137
|
+
text: "string",
|
|
138
|
+
image: "file",
|
|
139
|
+
date: "string"
|
|
140
|
+
};
|
|
141
|
+
ReferencePropDefinitionSchema = z.object({
|
|
142
|
+
type: z.literal("reference"),
|
|
143
|
+
collection: z.string(),
|
|
144
|
+
multiple: z.boolean().optional(),
|
|
145
|
+
default: z.union([z.string(), z.array(z.string())]).optional()
|
|
146
|
+
}).passthrough();
|
|
135
147
|
PropDefinitionSchema = z.object({ type: z.string() }).passthrough().superRefine((val, ctx) => {
|
|
136
|
-
const
|
|
148
|
+
const suggestion = CMS_ONLY_FIELD_TYPES[val.type];
|
|
149
|
+
if (suggestion) {
|
|
150
|
+
ctx.addIssue({
|
|
151
|
+
code: z.ZodIssueCode.custom,
|
|
152
|
+
path: ["type"],
|
|
153
|
+
message: `"${val.type}" is a CMS field type, not a component prop type \u2014 use "${suggestion}". Valid prop types: ${PropTypeSchema.options.join(", ")}`
|
|
154
|
+
});
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const branch = val.type === "list" ? ListPropDefinitionSchema : val.type === "reference" ? ReferencePropDefinitionSchema : BasePropDefinitionSchema;
|
|
137
158
|
const result = branch.safeParse(val);
|
|
138
159
|
if (result.success) return;
|
|
139
160
|
if (val.type === "list") {
|
|
161
|
+
const itemSchema = val.itemSchema;
|
|
162
|
+
let named = false;
|
|
163
|
+
if (itemSchema && typeof itemSchema === "object") {
|
|
164
|
+
for (const [field, def] of Object.entries(itemSchema)) {
|
|
165
|
+
const fieldType = def?.type;
|
|
166
|
+
const fix = typeof fieldType === "string" ? CMS_ONLY_FIELD_TYPES[fieldType] : void 0;
|
|
167
|
+
if (!fix) continue;
|
|
168
|
+
named = true;
|
|
169
|
+
ctx.addIssue({
|
|
170
|
+
code: z.ZodIssueCode.custom,
|
|
171
|
+
path: ["itemSchema", field, "type"],
|
|
172
|
+
message: `"${fieldType}" is a CMS field type, not a component prop type \u2014 use "${fix}". Valid list-item field types: ${BasePropTypeSchema.options.join(", ")}`
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (named) return;
|
|
140
177
|
ctx.addIssue({
|
|
141
178
|
code: z.ZodIssueCode.custom,
|
|
142
179
|
message: "list prop requires `itemSchema` and an object-array `default` (each item is a `{ field: value }` object, not a bare string)"
|
|
143
180
|
});
|
|
144
181
|
return;
|
|
145
182
|
}
|
|
183
|
+
if (val.type === "reference") {
|
|
184
|
+
ctx.addIssue({
|
|
185
|
+
code: z.ZodIssueCode.custom,
|
|
186
|
+
message: "reference prop requires a `collection` name, and `default` must be an item id string (or an array of ids when `multiple` is true)"
|
|
187
|
+
});
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
146
190
|
for (const issue of result.error.issues) ctx.addIssue(issue);
|
|
147
191
|
});
|
|
148
192
|
StyleMappingSchema = z.object({
|
|
@@ -156,7 +200,13 @@ var init_schemas = __esm({
|
|
|
156
200
|
values: z.record(z.string(), z.boolean())
|
|
157
201
|
}).passthrough();
|
|
158
202
|
VerbatimCodeSchema = z.object({ _code: z.literal(true), expr: z.string() }).passthrough();
|
|
159
|
-
IfConditionSchema = z.union([
|
|
203
|
+
IfConditionSchema = z.union([
|
|
204
|
+
z.boolean(),
|
|
205
|
+
z.string(),
|
|
206
|
+
BooleanMappingSchema,
|
|
207
|
+
I18nValueObjectSchema,
|
|
208
|
+
VerbatimCodeSchema
|
|
209
|
+
]);
|
|
160
210
|
LinkMappingSchema = z.object({
|
|
161
211
|
_mapping: z.literal(true),
|
|
162
212
|
prop: z.string(),
|
|
@@ -2327,7 +2377,7 @@ function getScaleMultiplier(scales, property, breakpoint) {
|
|
|
2327
2377
|
return scaleConfig?.[breakpoint] ?? null;
|
|
2328
2378
|
}
|
|
2329
2379
|
function parseMultiValue(valueStr) {
|
|
2330
|
-
const normalized = valueStr.replace(/(?<=\w)-(?=\d|auto|inherit|initial|unset)/g, " ");
|
|
2380
|
+
const normalized = valueStr.includes("(") ? valueStr : valueStr.replace(/(?<=\w)-(?=\d|auto|inherit|initial|unset)/g, " ");
|
|
2331
2381
|
return normalized.trim().split(/\s+/).filter((v) => v.length > 0);
|
|
2332
2382
|
}
|
|
2333
2383
|
function scaleValue(valueStr, baseReference, scale) {
|
|
@@ -3153,6 +3203,30 @@ function isStyleValue(style) {
|
|
|
3153
3203
|
}
|
|
3154
3204
|
return isStyleObject(style);
|
|
3155
3205
|
}
|
|
3206
|
+
function physicalizeBoxSpacing(style) {
|
|
3207
|
+
const s = style;
|
|
3208
|
+
for (const family of ["padding", "margin"]) {
|
|
3209
|
+
const inline = s[`${family}Inline`];
|
|
3210
|
+
const block = s[`${family}Block`];
|
|
3211
|
+
if (inline == null && block == null) continue;
|
|
3212
|
+
delete s[`${family}Inline`];
|
|
3213
|
+
delete s[`${family}Block`];
|
|
3214
|
+
const hasPhysical = s[family] != null || s[`${family}Top`] != null || s[`${family}Right`] != null || s[`${family}Bottom`] != null || s[`${family}Left`] != null;
|
|
3215
|
+
if (typeof inline === "string" && typeof block === "string" && !hasPhysical) {
|
|
3216
|
+
s[family] = `${block} ${inline}`;
|
|
3217
|
+
continue;
|
|
3218
|
+
}
|
|
3219
|
+
if (inline != null) {
|
|
3220
|
+
if (s[`${family}Left`] == null) s[`${family}Left`] = inline;
|
|
3221
|
+
if (s[`${family}Right`] == null) s[`${family}Right`] = inline;
|
|
3222
|
+
}
|
|
3223
|
+
if (block != null) {
|
|
3224
|
+
if (s[`${family}Top`] == null) s[`${family}Top`] = block;
|
|
3225
|
+
if (s[`${family}Bottom`] == null) s[`${family}Bottom`] = block;
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
return style;
|
|
3229
|
+
}
|
|
3156
3230
|
|
|
3157
3231
|
// lib/shared/responsiveStyleUtils.ts
|
|
3158
3232
|
function mergeResponsiveStyles(responsiveStyle, strategy = "all", viewportWidth, breakpoints = DEFAULT_BREAKPOINTS) {
|
|
@@ -3379,10 +3453,14 @@ function isNodeType(node, nodeType) {
|
|
|
3379
3453
|
const { globalNodeTypeManager: globalNodeTypeManager2 } = (init_registry(), __toCommonJS(registry_exports));
|
|
3380
3454
|
return globalNodeTypeManager2.getClient().isType(node, nodeType);
|
|
3381
3455
|
}
|
|
3456
|
+
function resolveIfI18n(value, locale, config) {
|
|
3457
|
+
const cfg = config || DEFAULT_I18N_CONFIG;
|
|
3458
|
+
return resolveI18nValue(value, locale || cfg.defaultLocale, cfg);
|
|
3459
|
+
}
|
|
3382
3460
|
function isBooleanMapping(value) {
|
|
3383
3461
|
return value !== null && typeof value === "object" && "_mapping" in value && value._mapping === true && "prop" in value && typeof value.prop === "string" && "values" in value && typeof value.values === "object";
|
|
3384
3462
|
}
|
|
3385
|
-
function evaluateNodeIf(node, props) {
|
|
3463
|
+
function evaluateNodeIf(node, props, i18n) {
|
|
3386
3464
|
const ifValue = hasIf(node) ? node.if : void 0;
|
|
3387
3465
|
if (ifValue === void 0) {
|
|
3388
3466
|
return true;
|
|
@@ -3390,6 +3468,9 @@ function evaluateNodeIf(node, props) {
|
|
|
3390
3468
|
if (typeof ifValue === "boolean") {
|
|
3391
3469
|
return ifValue;
|
|
3392
3470
|
}
|
|
3471
|
+
if (isI18nValue(ifValue)) {
|
|
3472
|
+
return Boolean(resolveIfI18n(ifValue, i18n?.locale, i18n?.config));
|
|
3473
|
+
}
|
|
3393
3474
|
if (isBooleanMapping(ifValue)) {
|
|
3394
3475
|
if (!props) {
|
|
3395
3476
|
return true;
|
|
@@ -3531,6 +3612,10 @@ function validateSingleProp(propName, propDef, value) {
|
|
|
3531
3612
|
coercedValue = value;
|
|
3532
3613
|
typeValid = Array.isArray(value) || isI18nValue(value);
|
|
3533
3614
|
break;
|
|
3615
|
+
case "reference":
|
|
3616
|
+
coercedValue = value;
|
|
3617
|
+
typeValid = typeof value === "string" || Array.isArray(value);
|
|
3618
|
+
break;
|
|
3534
3619
|
default:
|
|
3535
3620
|
return {
|
|
3536
3621
|
valid: false,
|
|
@@ -5271,6 +5356,46 @@ var THEME_SCALE_BY_CLASS = new Map(
|
|
|
5271
5356
|
var THEME_SCALE_BY_CSSVAR = new Map(
|
|
5272
5357
|
THEME_SCALE_ENTRIES.map((e) => [e.cssVar, e])
|
|
5273
5358
|
);
|
|
5359
|
+
var SPECS_BY_ROOT = (() => {
|
|
5360
|
+
const map = /* @__PURE__ */ new Map();
|
|
5361
|
+
for (const spec of SPECS) {
|
|
5362
|
+
const existing = map.get(spec.root);
|
|
5363
|
+
if (existing) existing.push(spec);
|
|
5364
|
+
else map.set(spec.root, [spec]);
|
|
5365
|
+
}
|
|
5366
|
+
return map;
|
|
5367
|
+
})();
|
|
5368
|
+
function resolveThemeScaleToken(root, suffix, knownTokens) {
|
|
5369
|
+
if (!knownTokens || !suffix) return null;
|
|
5370
|
+
const specs = SPECS_BY_ROOT.get(root);
|
|
5371
|
+
if (!specs) return null;
|
|
5372
|
+
for (const spec of specs) {
|
|
5373
|
+
const name = `${spec.varPrefix}-${suffix}`;
|
|
5374
|
+
if (knownTokens.has(name)) {
|
|
5375
|
+
return { property: spec.property, cssVar: `--${name}`, value: `var(--${name})` };
|
|
5376
|
+
}
|
|
5377
|
+
}
|
|
5378
|
+
return null;
|
|
5379
|
+
}
|
|
5380
|
+
function themeScaleClassForToken(cssVar, property) {
|
|
5381
|
+
const name = cssVar.startsWith("--") ? cssVar.slice(2) : cssVar;
|
|
5382
|
+
for (const spec of SPECS) {
|
|
5383
|
+
if (spec.property !== property) continue;
|
|
5384
|
+
const prefix = `${spec.varPrefix}-`;
|
|
5385
|
+
if (name.startsWith(prefix) && name.length > prefix.length) {
|
|
5386
|
+
return `${spec.root}-${name.slice(prefix.length)}`;
|
|
5387
|
+
}
|
|
5388
|
+
}
|
|
5389
|
+
return null;
|
|
5390
|
+
}
|
|
5391
|
+
var THEME_SCALE_ROOT_PROPERTY = {
|
|
5392
|
+
font: "fontFamily",
|
|
5393
|
+
rounded: "borderRadius",
|
|
5394
|
+
shadow: "boxShadow",
|
|
5395
|
+
leading: "lineHeight",
|
|
5396
|
+
tracking: "letterSpacing",
|
|
5397
|
+
"max-w": "maxWidth"
|
|
5398
|
+
};
|
|
5274
5399
|
function themeScaleValue(entry) {
|
|
5275
5400
|
return `var(${entry.cssVar})`;
|
|
5276
5401
|
}
|
|
@@ -5727,6 +5852,10 @@ function parseRootValue(root, rest, knownTokens) {
|
|
|
5727
5852
|
const value = `var(--${rest})`;
|
|
5728
5853
|
return { property: resolveRootProperty(root, value), value, root, kind: "var" };
|
|
5729
5854
|
}
|
|
5855
|
+
const themeToken = resolveThemeScaleToken(root, rest, knownTokens);
|
|
5856
|
+
if (themeToken) {
|
|
5857
|
+
return { property: themeToken.property, value: themeToken.value, root, kind: "var" };
|
|
5858
|
+
}
|
|
5730
5859
|
if (HASH_VALUE_RE.test(rest)) {
|
|
5731
5860
|
return { property: prefixToCSSProperty[root] ?? root, value: null, root, kind: "hash" };
|
|
5732
5861
|
}
|
|
@@ -5808,6 +5937,8 @@ function propertyValueToClass(prop, value) {
|
|
|
5808
5937
|
if (entry && entry.property === camelToKebab(prop)) {
|
|
5809
5938
|
return entry.className;
|
|
5810
5939
|
}
|
|
5940
|
+
const tokenClass = themeScaleClassForToken(varRef[1] ?? "", camelToKebab(prop));
|
|
5941
|
+
if (tokenClass) return tokenClass;
|
|
5811
5942
|
}
|
|
5812
5943
|
if (prop === "fontFamily") {
|
|
5813
5944
|
stringValue = stringValue.split(",").map((font) => {
|
|
@@ -6073,7 +6204,7 @@ function classToStyle(className, knownTokens) {
|
|
|
6073
6204
|
}
|
|
6074
6205
|
return { prop, value };
|
|
6075
6206
|
}
|
|
6076
|
-
function classesToStyles(classes, knownTokens) {
|
|
6207
|
+
function classesToStyles(classes, knownTokens, options) {
|
|
6077
6208
|
const styles = { base: {}, tablet: {}, mobile: {} };
|
|
6078
6209
|
for (const className of classes) {
|
|
6079
6210
|
const { breakpoint: variant, base: cleanClass } = splitVariantPrefix(className);
|
|
@@ -6095,6 +6226,12 @@ function classesToStyles(classes, knownTokens) {
|
|
|
6095
6226
|
}
|
|
6096
6227
|
}
|
|
6097
6228
|
}
|
|
6229
|
+
if (options?.physicalize !== false) {
|
|
6230
|
+
for (const bp of ["base", "tablet", "mobile"]) {
|
|
6231
|
+
const bucket = styles[bp];
|
|
6232
|
+
if (bucket) physicalizeBoxSpacing(bucket);
|
|
6233
|
+
}
|
|
6234
|
+
}
|
|
6098
6235
|
if (Object.keys(styles.tablet || {}).length === 0) delete styles.tablet;
|
|
6099
6236
|
if (Object.keys(styles.mobile || {}).length === 0) delete styles.mobile;
|
|
6100
6237
|
const hasAny = Object.keys(styles.base || {}).length > 0 || Object.keys(styles.tablet || {}).length > 0 || Object.keys(styles.mobile || {}).length > 0;
|
|
@@ -6120,8 +6257,14 @@ function classMergeKey(className) {
|
|
|
6120
6257
|
if (entry) return `${bp}|${entry.prop}`;
|
|
6121
6258
|
const dash = base.indexOf("-");
|
|
6122
6259
|
if (dash > 0) {
|
|
6123
|
-
const
|
|
6124
|
-
|
|
6260
|
+
const root = base.slice(0, dash);
|
|
6261
|
+
const suffix = base.slice(dash + 1);
|
|
6262
|
+
if (/^[a-zA-Z][\w-]*$/.test(suffix)) {
|
|
6263
|
+
const colorProp = COLOR_ROOT_TO_PROP[root];
|
|
6264
|
+
if (colorProp) return `${bp}|${colorProp}`;
|
|
6265
|
+
const themeProp = THEME_SCALE_ROOT_PROPERTY[root];
|
|
6266
|
+
if (themeProp) return `${bp}|${themeProp}`;
|
|
6267
|
+
}
|
|
6125
6268
|
}
|
|
6126
6269
|
return null;
|
|
6127
6270
|
}
|
|
@@ -6738,6 +6881,8 @@ var PX_KEEP_PROPERTIES = /* @__PURE__ */ new Set([
|
|
|
6738
6881
|
"border-right-width",
|
|
6739
6882
|
"border-bottom-width",
|
|
6740
6883
|
"border-left-width",
|
|
6884
|
+
"border-inline-width",
|
|
6885
|
+
"border-block-width",
|
|
6741
6886
|
"outline-width",
|
|
6742
6887
|
"outline-offset",
|
|
6743
6888
|
"border",
|
|
@@ -6828,22 +6973,71 @@ var utilityClassRules = (() => {
|
|
|
6828
6973
|
}
|
|
6829
6974
|
return rules;
|
|
6830
6975
|
})();
|
|
6976
|
+
var AXIS_ROOT_LONGHANDS = {
|
|
6977
|
+
size: ["width", "height"],
|
|
6978
|
+
px: ["padding-left", "padding-right"],
|
|
6979
|
+
py: ["padding-top", "padding-bottom"],
|
|
6980
|
+
mx: ["margin-left", "margin-right"],
|
|
6981
|
+
my: ["margin-top", "margin-bottom"],
|
|
6982
|
+
...ROUNDED_SIDE_CORNERS
|
|
6983
|
+
};
|
|
6984
|
+
function declarationsForRoot(root, property, value) {
|
|
6985
|
+
const longhands = root ? AXIS_ROOT_LONGHANDS[root] : void 0;
|
|
6986
|
+
if (longhands) return `${longhands[0]}: ${value}; ${longhands[1]}: ${value};`;
|
|
6987
|
+
return `${property}: ${value};`;
|
|
6988
|
+
}
|
|
6831
6989
|
function resolveScalablePropertyValue(className) {
|
|
6832
6990
|
const parsed = parseUtilityClass(className);
|
|
6833
6991
|
if (!parsed) return null;
|
|
6834
|
-
if (parsed.value != null) return { property: parsed.property, value: parsed.value };
|
|
6992
|
+
if (parsed.value != null) return { property: parsed.property, value: parsed.value, root: parsed.root };
|
|
6835
6993
|
const registered = getStyleValue(className);
|
|
6836
6994
|
if (registered == null || registered === "") return null;
|
|
6837
6995
|
const value = String(registered);
|
|
6838
6996
|
const property = parsed.root ? resolveRootProperty(parsed.root, value) : parsed.property;
|
|
6839
|
-
return { property, value };
|
|
6997
|
+
return { property, value, root: parsed.root };
|
|
6840
6998
|
}
|
|
6841
6999
|
var borderSideMap = {
|
|
7000
|
+
border: "border",
|
|
6842
7001
|
"border-t": "border-top",
|
|
6843
7002
|
"border-r": "border-right",
|
|
6844
7003
|
"border-b": "border-bottom",
|
|
6845
|
-
"border-l": "border-left"
|
|
7004
|
+
"border-l": "border-left",
|
|
7005
|
+
"border-x": "border-inline",
|
|
7006
|
+
"border-y": "border-block"
|
|
6846
7007
|
};
|
|
7008
|
+
var BORDER_STYLE_VALUES = /* @__PURE__ */ new Set([
|
|
7009
|
+
"none",
|
|
7010
|
+
"hidden",
|
|
7011
|
+
"solid",
|
|
7012
|
+
"dashed",
|
|
7013
|
+
"dotted",
|
|
7014
|
+
"double",
|
|
7015
|
+
"groove",
|
|
7016
|
+
"ridge",
|
|
7017
|
+
"inset",
|
|
7018
|
+
"outset"
|
|
7019
|
+
]);
|
|
7020
|
+
var BORDER_DEFAULT_STYLE = "solid";
|
|
7021
|
+
function isBorderWidthToken(token) {
|
|
7022
|
+
return /^-?(?:\d+|\d*\.\d+)[a-z%]*$/i.test(token) || /^(?:thin|medium|thick)$/i.test(token) || /^(?:calc|min|max|clamp)\(/i.test(token);
|
|
7023
|
+
}
|
|
7024
|
+
function splitBorderShorthand(value) {
|
|
7025
|
+
const tokens = [];
|
|
7026
|
+
let depth = 0;
|
|
7027
|
+
let current = "";
|
|
7028
|
+
for (const char of value) {
|
|
7029
|
+
if (char === "(" || char === "[") depth++;
|
|
7030
|
+
else if (char === ")" || char === "]") depth--;
|
|
7031
|
+
if (depth === 0 && /\s/.test(char)) {
|
|
7032
|
+
if (current) tokens.push(current);
|
|
7033
|
+
current = "";
|
|
7034
|
+
continue;
|
|
7035
|
+
}
|
|
7036
|
+
current += char;
|
|
7037
|
+
}
|
|
7038
|
+
if (current) tokens.push(current);
|
|
7039
|
+
return tokens;
|
|
7040
|
+
}
|
|
6847
7041
|
function generateRuleForClass(className, knownTokens) {
|
|
6848
7042
|
if (utilityClassRules[className]) {
|
|
6849
7043
|
return utilityClassRules[className];
|
|
@@ -6875,35 +7069,24 @@ function generateRuleForClass(className, knownTokens) {
|
|
|
6875
7069
|
} else {
|
|
6876
7070
|
value = parsed.value;
|
|
6877
7071
|
}
|
|
6878
|
-
if (root
|
|
6879
|
-
return
|
|
6880
|
-
}
|
|
6881
|
-
const sideCorners = root ? ROUNDED_SIDE_CORNERS[root] : void 0;
|
|
6882
|
-
if (sideCorners) {
|
|
6883
|
-
return `${sideCorners[0]}: ${value}; ${sideCorners[1]}: ${value};`;
|
|
6884
|
-
}
|
|
6885
|
-
if (root === "px") {
|
|
6886
|
-
return `padding-left: ${value}; padding-right: ${value};`;
|
|
6887
|
-
}
|
|
6888
|
-
if (root === "py") {
|
|
6889
|
-
return `padding-top: ${value}; padding-bottom: ${value};`;
|
|
6890
|
-
}
|
|
6891
|
-
if (root === "mx") {
|
|
6892
|
-
return `margin-left: ${value}; margin-right: ${value};`;
|
|
6893
|
-
}
|
|
6894
|
-
if (root === "my") {
|
|
6895
|
-
return `margin-top: ${value}; margin-bottom: ${value};`;
|
|
7072
|
+
if (root && AXIS_ROOT_LONGHANDS[root]) {
|
|
7073
|
+
return declarationsForRoot(root, property, value);
|
|
6896
7074
|
}
|
|
6897
7075
|
if (root && borderSideMap[root] && property !== "border-color") {
|
|
6898
7076
|
const side = borderSideMap[root];
|
|
6899
|
-
const tokens = value
|
|
7077
|
+
const tokens = splitBorderShorthand(value);
|
|
6900
7078
|
if (tokens.length >= 2) {
|
|
6901
7079
|
const declarations = [`${side}-width: ${tokens[0]};`, `${side}-style: ${tokens[1]};`];
|
|
6902
|
-
if (tokens
|
|
7080
|
+
if (tokens.length > 2) {
|
|
6903
7081
|
declarations.push(`${side}-color: ${tokens.slice(2).join(" ")};`);
|
|
6904
7082
|
}
|
|
6905
7083
|
return declarations.join(" ");
|
|
6906
7084
|
}
|
|
7085
|
+
const only = tokens[0];
|
|
7086
|
+
if (only) {
|
|
7087
|
+
if (BORDER_STYLE_VALUES.has(only.toLowerCase())) return `${side}-style: ${only};`;
|
|
7088
|
+
if (isBorderWidthToken(only)) return `${side}-width: ${only}; ${side}-style: ${BORDER_DEFAULT_STYLE};`;
|
|
7089
|
+
}
|
|
6907
7090
|
return `${side}: ${value};`;
|
|
6908
7091
|
}
|
|
6909
7092
|
return `${property}: ${value};`;
|
|
@@ -6923,7 +7106,7 @@ function applyFluidToUtilityRule(rule, className, responsiveScales, breakpoints)
|
|
|
6923
7106
|
const baseRef = responsiveScales.baseReference ?? 16;
|
|
6924
7107
|
const fluidValue = buildFluidPropertyValue(propValue.value, scale, range.min, range.max, baseRef);
|
|
6925
7108
|
if (!fluidValue) return rule;
|
|
6926
|
-
return
|
|
7109
|
+
return declarationsForRoot(propValue.root, propValue.property, fluidValue);
|
|
6927
7110
|
}
|
|
6928
7111
|
function applyFluidToStyle(style, responsiveScales, breakpoints) {
|
|
6929
7112
|
const range = responsiveScales.fluidRange ?? DEFAULT_FLUID_RANGE;
|
|
@@ -7046,7 +7229,7 @@ function generateUtilityCSS(usedClasses, breakpoints = DEFAULT_BREAKPOINTS, resp
|
|
|
7046
7229
|
const finalScaledValue = remConfig?.enabled && shouldConvertProperty(propValue.property) ? convertPxToRem(scaledValue, remConfig.baseFontSize) : scaledValue;
|
|
7047
7230
|
autoResponsiveMediaQueries[breakpointName].classes.push({
|
|
7048
7231
|
className: escapedClassName,
|
|
7049
|
-
rule:
|
|
7232
|
+
rule: declarationsForRoot(propValue.root, propValue.property, finalScaledValue)
|
|
7050
7233
|
});
|
|
7051
7234
|
}
|
|
7052
7235
|
}
|
|
@@ -7137,7 +7320,7 @@ function generateSingleClassCSS(className, breakpoints = DEFAULT_BREAKPOINTS, re
|
|
|
7137
7320
|
const finalScaledValue = remConfig?.enabled && shouldConvertProperty(propValue.property) ? convertPxToRem(scaledValue, remConfig.baseFontSize) : scaledValue;
|
|
7138
7321
|
css.push(
|
|
7139
7322
|
`@media (max-width: ${breakpointValue}px) {
|
|
7140
|
-
.${escapedClassName} { ${propValue.property
|
|
7323
|
+
.${escapedClassName} { ${declarationsForRoot(propValue.root, propValue.property, finalScaledValue)} }
|
|
7141
7324
|
}`
|
|
7142
7325
|
);
|
|
7143
7326
|
}
|
|
@@ -7174,7 +7357,7 @@ function isResponsiveStyle2(style) {
|
|
|
7174
7357
|
}
|
|
7175
7358
|
function styleObjectToCSS(style) {
|
|
7176
7359
|
const declarations = [];
|
|
7177
|
-
for (const [prop, value] of Object.entries(style)) {
|
|
7360
|
+
for (const [prop, value] of Object.entries(physicalizeBoxSpacing({ ...style }))) {
|
|
7178
7361
|
if (typeof value === "object" && value !== null && "_mapping" in value) {
|
|
7179
7362
|
continue;
|
|
7180
7363
|
}
|
|
@@ -7370,6 +7553,7 @@ export {
|
|
|
7370
7553
|
isResponsiveStyle,
|
|
7371
7554
|
isStyleObject,
|
|
7372
7555
|
isStyleValue,
|
|
7556
|
+
physicalizeBoxSpacing,
|
|
7373
7557
|
mergeResponsiveStyles,
|
|
7374
7558
|
normalizeStyle,
|
|
7375
7559
|
getAvailableBreakpoints,
|
|
@@ -7434,6 +7618,7 @@ export {
|
|
|
7434
7618
|
hasComponentCss,
|
|
7435
7619
|
getNodeTypeDefinition,
|
|
7436
7620
|
isNodeType,
|
|
7621
|
+
resolveIfI18n,
|
|
7437
7622
|
isBooleanMapping,
|
|
7438
7623
|
evaluateNodeIf,
|
|
7439
7624
|
markAsSlotContent,
|
|
@@ -7518,4 +7703,4 @@ export {
|
|
|
7518
7703
|
generateInteractiveCSS,
|
|
7519
7704
|
generateAllInteractiveCSS
|
|
7520
7705
|
};
|
|
7521
|
-
//# sourceMappingURL=chunk-
|
|
7706
|
+
//# sourceMappingURL=chunk-EKB7GGQK.js.map
|