meno-core 1.1.2 → 1.1.3
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/chunks/{chunk-7ZLF4NE5.js → chunk-3JXK2QFU.js} +2 -2
- package/dist/chunks/{chunk-J4IPTP5X.js → chunk-LOZL5HOF.js} +29 -3
- package/dist/chunks/chunk-LOZL5HOF.js.map +7 -0
- package/dist/lib/client/index.js +2 -2
- package/dist/lib/server/index.js +22 -5
- package/dist/lib/server/index.js.map +2 -2
- package/dist/lib/shared/index.js +3 -1
- package/dist/lib/shared/index.js.map +1 -1
- package/lib/client/scripts/formHandler.ts +17 -0
- package/lib/server/middleware/cors.test.ts +1 -1
- package/lib/server/middleware/cors.ts +1 -1
- package/lib/server/routes/api/functions.ts +2 -2
- package/lib/shared/nodeUtils.ts +18 -0
- package/lib/shared/utilityClassMapper.test.ts +10 -0
- package/lib/shared/utilityClassMapper.ts +9 -1
- package/lib/shared/validation/schemas.test.ts +78 -0
- package/lib/shared/validation/schemas.ts +53 -5
- package/package.json +1 -1
- package/dist/chunks/chunk-J4IPTP5X.js.map +0 -7
- /package/dist/chunks/{chunk-7ZLF4NE5.js.map → chunk-3JXK2QFU.js.map} +0 -0
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
normalizeStyle,
|
|
17
17
|
richTextMarkerToHtml,
|
|
18
18
|
safeEvaluate
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-LOZL5HOF.js";
|
|
20
20
|
import {
|
|
21
21
|
NODE_TYPE,
|
|
22
22
|
RAW_HTML_PREFIX,
|
|
@@ -805,4 +805,4 @@ export {
|
|
|
805
805
|
skipEmptyTemplateAttributes,
|
|
806
806
|
inlineSvgStyleRules
|
|
807
807
|
};
|
|
808
|
-
//# sourceMappingURL=chunk-
|
|
808
|
+
//# sourceMappingURL=chunk-3JXK2QFU.js.map
|
|
@@ -132,7 +132,19 @@ var init_schemas = __esm({
|
|
|
132
132
|
)
|
|
133
133
|
).optional()
|
|
134
134
|
}).passthrough();
|
|
135
|
-
PropDefinitionSchema = z.
|
|
135
|
+
PropDefinitionSchema = z.object({ type: z.string() }).passthrough().superRefine((val, ctx) => {
|
|
136
|
+
const branch = val.type === "list" ? ListPropDefinitionSchema : BasePropDefinitionSchema;
|
|
137
|
+
const result = branch.safeParse(val);
|
|
138
|
+
if (result.success) return;
|
|
139
|
+
if (val.type === "list") {
|
|
140
|
+
ctx.addIssue({
|
|
141
|
+
code: z.ZodIssueCode.custom,
|
|
142
|
+
message: "list prop requires `itemSchema` and an object-array `default` (each item is a `{ field: value }` object, not a bare string)"
|
|
143
|
+
});
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
for (const issue of result.error.issues) ctx.addIssue(issue);
|
|
147
|
+
});
|
|
136
148
|
StyleMappingSchema = z.object({
|
|
137
149
|
_mapping: z.literal(true),
|
|
138
150
|
prop: z.string(),
|
|
@@ -455,7 +467,15 @@ var init_schemas = __esm({
|
|
|
455
467
|
_lineMap: z.record(z.string(), LineRangeSchema).optional(),
|
|
456
468
|
// Marks a page whose source is outside the meno-astro dialect (read-only in the editor).
|
|
457
469
|
// Explicit (not just .passthrough()) so it survives a future tightening of this schema.
|
|
458
|
-
_unsupported: z.object({ reason: z.string() }).passthrough().optional()
|
|
470
|
+
_unsupported: z.object({ reason: z.string() }).passthrough().optional(),
|
|
471
|
+
// A component payload (`{ component: {...} }`) must NEVER validate as a page.
|
|
472
|
+
// Without this guard the page branch parses structurally (it's `.passthrough()`)
|
|
473
|
+
// and only trips the refine below — so when both branches of `PageDataSchema`
|
|
474
|
+
// fail, zod treats this branch as the "closest" (dirty) one and surfaces
|
|
475
|
+
// "JSONPage must have …root", masking the real component error (e.g. a malformed
|
|
476
|
+
// list prop). Rejecting a present `component` key makes this branch hard-fail on
|
|
477
|
+
// component payloads, so `PageDataSchema` reports the component branch instead.
|
|
478
|
+
component: z.undefined().optional()
|
|
459
479
|
}).passthrough().refine(
|
|
460
480
|
(data) => {
|
|
461
481
|
return data.meta !== void 0 || data.components !== void 0 || data.root !== void 0;
|
|
@@ -3229,6 +3249,9 @@ function isComponentNode(node) {
|
|
|
3229
3249
|
function isHtmlNode(node) {
|
|
3230
3250
|
return node?.type === NODE_TYPE.NODE;
|
|
3231
3251
|
}
|
|
3252
|
+
function isClassStylableNode(node) {
|
|
3253
|
+
return node?.type === NODE_TYPE.NODE || node?.type === NODE_TYPE.EMBED || node?.type === NODE_TYPE.LINK || node?.type === NODE_TYPE.MARKDOWN;
|
|
3254
|
+
}
|
|
3232
3255
|
function getComponentName(node) {
|
|
3233
3256
|
return isComponentNode(node) ? node.component : void 0;
|
|
3234
3257
|
}
|
|
@@ -5336,6 +5359,8 @@ function propertyValueToClass(prop, value) {
|
|
|
5336
5359
|
className = `[${camelToKebab(prop)}:${stringValue}]`;
|
|
5337
5360
|
} else if (colorTokenProps.has(prop) && isBareColorTokenName(varName)) {
|
|
5338
5361
|
className = `${root}-${varName}`;
|
|
5362
|
+
} else if (colorTokenProps.has(prop)) {
|
|
5363
|
+
className = `${root}-[var(${varMatch[1]})]`;
|
|
5339
5364
|
} else className = `${root}-(${varMatch[1]})`;
|
|
5340
5365
|
}
|
|
5341
5366
|
}
|
|
@@ -6734,6 +6759,7 @@ export {
|
|
|
6734
6759
|
isEmptyContainer,
|
|
6735
6760
|
isComponentNode,
|
|
6736
6761
|
isHtmlNode,
|
|
6762
|
+
isClassStylableNode,
|
|
6737
6763
|
getComponentName,
|
|
6738
6764
|
getTagName,
|
|
6739
6765
|
getDisplayName,
|
|
@@ -6839,4 +6865,4 @@ export {
|
|
|
6839
6865
|
generateInteractiveCSS,
|
|
6840
6866
|
generateAllInteractiveCSS
|
|
6841
6867
|
};
|
|
6842
|
-
//# sourceMappingURL=chunk-
|
|
6868
|
+
//# sourceMappingURL=chunk-LOZL5HOF.js.map
|