@bettercms-ai/types 1.67.0 → 1.69.0
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/index.d.ts +660 -10
- package/dist/index.js +608 -84
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -64,14 +64,14 @@ function hiddenEverywhere(item) {
|
|
|
64
64
|
const raw = style && typeof style === "object" ? style.hideOn : void 0;
|
|
65
65
|
return Array.isArray(raw) && raw.includes("mobile") && raw.includes("tablet") && raw.includes("desktop");
|
|
66
66
|
}
|
|
67
|
-
function mapSame(
|
|
67
|
+
function mapSame(list2, fn) {
|
|
68
68
|
let changed = false;
|
|
69
|
-
const out =
|
|
69
|
+
const out = list2.map((item) => {
|
|
70
70
|
const next = fn(item);
|
|
71
71
|
if (next !== item) changed = true;
|
|
72
72
|
return next;
|
|
73
73
|
});
|
|
74
|
-
return changed ? out :
|
|
74
|
+
return changed ? out : list2;
|
|
75
75
|
}
|
|
76
76
|
function withVisibleChildren(block, now) {
|
|
77
77
|
const p = block.props ?? {};
|
|
@@ -339,15 +339,31 @@ function spaceTokenCss(token) {
|
|
|
339
339
|
// src/blockStyle.ts
|
|
340
340
|
var SPACE_PX = { none: "0", xs: "4px", sm: "8px", md: "16px", lg: "32px", xl: "64px" };
|
|
341
341
|
var FONT_SIZE_REM = {
|
|
342
|
+
xs: "0.75rem",
|
|
342
343
|
sm: "0.875rem",
|
|
343
344
|
base: "1rem",
|
|
345
|
+
md: "1.125rem",
|
|
344
346
|
lg: "1.25rem",
|
|
345
347
|
xl: "1.5rem",
|
|
346
348
|
"2xl": "2rem",
|
|
347
349
|
"3xl": "2.25rem",
|
|
350
|
+
"3.5xl": "2.5rem",
|
|
348
351
|
"4xl": "3rem",
|
|
349
352
|
"5xl": "4rem"
|
|
350
353
|
};
|
|
354
|
+
var FONT_SIZE_TOKEN_PX = {
|
|
355
|
+
xs: 12,
|
|
356
|
+
sm: 14,
|
|
357
|
+
base: 16,
|
|
358
|
+
md: 18,
|
|
359
|
+
lg: 20,
|
|
360
|
+
xl: 24,
|
|
361
|
+
"2xl": 32,
|
|
362
|
+
"3xl": 36,
|
|
363
|
+
"3.5xl": 40,
|
|
364
|
+
"4xl": 48,
|
|
365
|
+
"5xl": 64
|
|
366
|
+
};
|
|
351
367
|
var WEIGHT = { normal: 400, medium: 500, semibold: 600, bold: 700 };
|
|
352
368
|
var RADIUS_PX = { none: "0", sm: "4px", md: "8px", lg: "16px", full: "9999px" };
|
|
353
369
|
var IMAGE_ASPECTS = ["16/9", "16/7", "4/3", "4/5", "1/1"];
|
|
@@ -383,6 +399,9 @@ var FILL_SCHEME = {
|
|
|
383
399
|
dark: { colorScheme: "dark", color: "#f7f8f8" },
|
|
384
400
|
accent: { colorScheme: "var(--bcms-accent-scheme,dark)", color: "var(--bcms-on-accent,#ffffff)" }
|
|
385
401
|
};
|
|
402
|
+
var BG_TOKEN_CSS = {
|
|
403
|
+
"brand-tint": "var(--bcms-bg-tint,color-mix(in srgb,var(--bcms-bg-accent,#4f46e5) 8%,var(--bcms-bg-surface,#ffffff)))"
|
|
404
|
+
};
|
|
386
405
|
var CORNER_PX = { "0": "0", s: "4px", m: "8px", l: "16px", xl: "24px", "2xl": "32px" };
|
|
387
406
|
var SHADOW_CSS = {
|
|
388
407
|
"0": "none",
|
|
@@ -401,6 +420,43 @@ function hideOnAttr(style) {
|
|
|
401
420
|
const on = ["mobile", "tablet", "desktop"].filter((b) => raw.includes(b));
|
|
402
421
|
return on.length === 3 ? "" : on.join(" ");
|
|
403
422
|
}
|
|
423
|
+
var SECTION_ANCHOR = /^[a-z0-9-]{1,64}$/;
|
|
424
|
+
var SECTION_CSS_CLASS = /^[A-Za-z0-9_\- ]{1,200}$/;
|
|
425
|
+
function sectionIdentityAttrs(style) {
|
|
426
|
+
if (!style || typeof style !== "object") return {};
|
|
427
|
+
const s = style;
|
|
428
|
+
const out = {};
|
|
429
|
+
if (typeof s.anchor === "string" && SECTION_ANCHOR.test(s.anchor)) out.id = s.anchor;
|
|
430
|
+
if (typeof s.cssClass === "string" && SECTION_CSS_CLASS.test(s.cssClass)) {
|
|
431
|
+
const names2 = s.cssClass.split(" ").filter(Boolean);
|
|
432
|
+
if (names2.length) out.className = names2.join(" ");
|
|
433
|
+
}
|
|
434
|
+
return out;
|
|
435
|
+
}
|
|
436
|
+
function anchorSlug(text2) {
|
|
437
|
+
return text2.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64).replace(/-+$/, "");
|
|
438
|
+
}
|
|
439
|
+
function defaultSectionAnchors(blocks) {
|
|
440
|
+
const out = /* @__PURE__ */ new Map();
|
|
441
|
+
if (!Array.isArray(blocks)) return out;
|
|
442
|
+
const used = /* @__PURE__ */ new Set();
|
|
443
|
+
for (const b of blocks) {
|
|
444
|
+
const own2 = b && typeof b === "object" ? sectionIdentityAttrs(b.style).id : void 0;
|
|
445
|
+
if (own2) used.add(own2);
|
|
446
|
+
}
|
|
447
|
+
for (const b of blocks) {
|
|
448
|
+
if (!b || typeof b !== "object") continue;
|
|
449
|
+
if (sectionIdentityAttrs(b.style).id) continue;
|
|
450
|
+
const label = b.label;
|
|
451
|
+
const base = typeof label === "string" ? anchorSlug(label) : "";
|
|
452
|
+
if (!base) continue;
|
|
453
|
+
let anchor = base;
|
|
454
|
+
for (let n = 2; used.has(anchor); n++) anchor = `${base.slice(0, 64 - String(n).length - 1).replace(/-+$/, "")}-${n}`;
|
|
455
|
+
used.add(anchor);
|
|
456
|
+
out.set(b, anchor);
|
|
457
|
+
}
|
|
458
|
+
return out;
|
|
459
|
+
}
|
|
404
460
|
function usesHideOn(blocks) {
|
|
405
461
|
let found = false;
|
|
406
462
|
JSON.stringify(blocks ?? null, (k, v) => {
|
|
@@ -473,6 +529,7 @@ function blockStyleToCss(style) {
|
|
|
473
529
|
css.color = fill.color;
|
|
474
530
|
}
|
|
475
531
|
}
|
|
532
|
+
if (own(BG_TOKEN_CSS, s.bgToken)) css.background = own(BG_TOKEN_CSS, s.bgToken);
|
|
476
533
|
const bgImage = safeCssUrl(s.bgImage);
|
|
477
534
|
if (bgImage) {
|
|
478
535
|
css.backgroundImage = `url(${bgImage})`;
|
|
@@ -480,8 +537,9 @@ function blockStyleToCss(style) {
|
|
|
480
537
|
css.backgroundPosition = "center";
|
|
481
538
|
}
|
|
482
539
|
const n = style;
|
|
483
|
-
|
|
484
|
-
if (!
|
|
540
|
+
const scaled = (px) => n.padScale === true ? `calc(${clamp(px, 0, 240)}px * var(--bcms-pad-scale, 1))` : `${clamp(px, 0, 240)}px`;
|
|
541
|
+
if (!top && typeof n.paddingTop === "number") css.paddingTop = scaled(n.paddingTop);
|
|
542
|
+
if (!bottom && typeof n.paddingBottom === "number") css.paddingBottom = scaled(n.paddingBottom);
|
|
485
543
|
if (!sides && typeof n.paddingSides === "number") {
|
|
486
544
|
const px = `${clamp(n.paddingSides, 0, 240)}px`;
|
|
487
545
|
css.paddingLeft = px;
|
|
@@ -553,7 +611,7 @@ function splitButtonStyle(style) {
|
|
|
553
611
|
paint: Object.keys(paint).length ? paint : void 0
|
|
554
612
|
};
|
|
555
613
|
}
|
|
556
|
-
var FIELD_STYLE_KEYS = ["contentWidth", "contentAlign", "marginTop", "marginBottom", "align", "fontSize", "weight", "size"];
|
|
614
|
+
var FIELD_STYLE_KEYS = ["contentWidth", "contentAlign", "marginTop", "marginBottom", "align", "fontSize", "weight", "size", "textColor"];
|
|
557
615
|
var FIELD_SIZE_ZOOM = { sm: "0.875", lg: "1.125" };
|
|
558
616
|
var FIELD_KEY_SET = new Set(FIELD_STYLE_KEYS);
|
|
559
617
|
function pickFieldStyle(style) {
|
|
@@ -634,9 +692,9 @@ var SLOT_MAX_ITEMS = 12;
|
|
|
634
692
|
var SLOT_ITEMS_CAP = 50;
|
|
635
693
|
var LIST_ITEMS_CAP = 500;
|
|
636
694
|
function slotItems(value) {
|
|
637
|
-
const
|
|
695
|
+
const list2 = Array.isArray(value) ? value : [value];
|
|
638
696
|
const out = [];
|
|
639
|
-
for (const item of
|
|
697
|
+
for (const item of list2) {
|
|
640
698
|
if (!item || typeof item !== "object" || Array.isArray(item)) continue;
|
|
641
699
|
const o = item;
|
|
642
700
|
if (typeof o.componentId === "string" && o.componentId !== "") out.push(item);
|
|
@@ -3363,9 +3421,9 @@ function keyWords(key) {
|
|
|
3363
3421
|
const leaf = key.split(".").pop() ?? "";
|
|
3364
3422
|
return leaf.replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s_-]+/).filter(Boolean).map((word) => word.toLowerCase());
|
|
3365
3423
|
}
|
|
3366
|
-
function roleFromWords(
|
|
3367
|
-
const type = (
|
|
3368
|
-
const value =
|
|
3424
|
+
function roleFromWords(candidate2, words) {
|
|
3425
|
+
const type = (candidate2.type ?? "").toLowerCase();
|
|
3426
|
+
const value = candidate2.value;
|
|
3369
3427
|
if (!(value === void 0 || value === null || typeof value === "string")) return null;
|
|
3370
3428
|
if (!words.length) return null;
|
|
3371
3429
|
const last = words[words.length - 1];
|
|
@@ -3374,18 +3432,18 @@ function roleFromWords(candidate, words) {
|
|
|
3374
3432
|
if (LINK_TYPES.has(type)) return { role: "link", stems: LINK_ROLES.has(last) ? [stem] : [stem, full] };
|
|
3375
3433
|
if (!TEXT_TYPES.has(type)) return null;
|
|
3376
3434
|
if (LINK_ROLES.has(last)) {
|
|
3377
|
-
if (MEDIA.test(
|
|
3435
|
+
if (MEDIA.test(candidate2.key) || MEDIA.test(candidate2.label ?? "")) return null;
|
|
3378
3436
|
return { role: "link", stems: [stem] };
|
|
3379
3437
|
}
|
|
3380
3438
|
if (TEXT_ROLES.has(last)) return { role: "text", stems: BUTTON_NOUNS.has(last) ? [stem, full] : [stem] };
|
|
3381
3439
|
return null;
|
|
3382
3440
|
}
|
|
3383
|
-
function candidateRole(
|
|
3384
|
-
const fromKey = roleFromWords(
|
|
3441
|
+
function candidateRole(candidate2) {
|
|
3442
|
+
const fromKey = roleFromWords(candidate2, keyWords(candidate2.key));
|
|
3385
3443
|
if (fromKey) return fromKey;
|
|
3386
|
-
const label =
|
|
3444
|
+
const label = candidate2.label?.trim();
|
|
3387
3445
|
if (!label) return null;
|
|
3388
|
-
const fromLabel = roleFromWords(
|
|
3446
|
+
const fromLabel = roleFromWords(candidate2, keyWords(label.replace(/\s+/g, "_")));
|
|
3389
3447
|
return fromLabel ? { role: fromLabel.role, stems: fromLabel.stems.map((stem) => `label:${stem}`) } : null;
|
|
3390
3448
|
}
|
|
3391
3449
|
var TAG_SEGMENTS = /* @__PURE__ */ new Set(["a", "span", "button", "div", "strong"]);
|
|
@@ -3426,9 +3484,9 @@ function derivedPairs(candidates) {
|
|
|
3426
3484
|
}
|
|
3427
3485
|
function buttonLinkPairs(candidates) {
|
|
3428
3486
|
const derived = derivedPairs(candidates);
|
|
3429
|
-
const roles = candidates.map((
|
|
3487
|
+
const roles = candidates.map((candidate2, index) => {
|
|
3430
3488
|
const half = derived.get(index);
|
|
3431
|
-
return half ? { role: half.role, stems: [`derived:${half.pair}`] } : candidateRole(
|
|
3489
|
+
return half ? { role: half.role, stems: [`derived:${half.pair}`] } : candidateRole(candidate2);
|
|
3432
3490
|
});
|
|
3433
3491
|
const byStem = /* @__PURE__ */ new Map();
|
|
3434
3492
|
roles.forEach((role, index) => {
|
|
@@ -3463,8 +3521,8 @@ function buttonLinkPairs(candidates) {
|
|
|
3463
3521
|
var LINK_TYPES2 = /* @__PURE__ */ new Set(["link", "url"]);
|
|
3464
3522
|
var nameOf = (s) => s.name ?? s.key;
|
|
3465
3523
|
function rulePartnerOf(labelKey, siblings) {
|
|
3466
|
-
const
|
|
3467
|
-
for (const n of
|
|
3524
|
+
const names2 = labelKey === "label" ? ["label-href", "href", "url", "link"] : [`${labelKey}-href`];
|
|
3525
|
+
for (const n of names2) {
|
|
3468
3526
|
const s = siblings.find((f) => nameOf(f) === n);
|
|
3469
3527
|
if (s && LINK_TYPES2.has(s.type ?? "")) return n;
|
|
3470
3528
|
}
|
|
@@ -3547,7 +3605,7 @@ var LOOK_VALUE = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
|
3547
3605
|
function buttonSiteLookOf(value) {
|
|
3548
3606
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
3549
3607
|
const v = value;
|
|
3550
|
-
const tokens = (
|
|
3608
|
+
const tokens = (list2) => Array.isArray(list2) ? list2.filter((c) => typeof c === "string" && SITE_CLASS.test(c)) : [];
|
|
3551
3609
|
const variant = v.attrs?.["data-variant"];
|
|
3552
3610
|
const classes = tokens(v.classes);
|
|
3553
3611
|
const also = tokens(v.also);
|
|
@@ -3572,8 +3630,8 @@ function isButtonLookValue(value) {
|
|
|
3572
3630
|
function buttonIconOf(value) {
|
|
3573
3631
|
return typeof value === "string" && DOCK_ICON_NAME_SET.has(value) ? value : null;
|
|
3574
3632
|
}
|
|
3575
|
-
function buttonIconSvg(
|
|
3576
|
-
return iconSvg(
|
|
3633
|
+
function buttonIconSvg(name2, cls) {
|
|
3634
|
+
return iconSvg(name2, cls);
|
|
3577
3635
|
}
|
|
3578
3636
|
var BUTTON_SIZES = ["sm", "md", "lg"];
|
|
3579
3637
|
function anchorTargetRel(newTab, rel) {
|
|
@@ -3633,9 +3691,46 @@ function buttonValueProblem(value, looks) {
|
|
|
3633
3691
|
if (v.newTab !== void 0 && typeof v.newTab !== "boolean") return "newTab must be true or false";
|
|
3634
3692
|
if (v.rel !== void 0 && !LINK_RELS.includes(v.rel)) return `has an unknown rel "${String(v.rel)}" (nofollow, sponsored or ugc)`;
|
|
3635
3693
|
if (v.icon !== void 0 && v.icon !== null && buttonIconOf(v.icon) === null) return `has an unknown icon "${String(v.icon)}"`;
|
|
3694
|
+
return buttonTextProblem(v);
|
|
3695
|
+
}
|
|
3696
|
+
var BUTTON_TEXT_CSS = {
|
|
3697
|
+
radius: { prop: "borderRadius", values: { "0": "0", s: "4px", m: "8px", l: "12px", full: "999px" } },
|
|
3698
|
+
font: { prop: "fontFamily", values: { site: "inherit", serif: "var(--bcms-font-heading,Georgia,serif)", mono: "var(--bcms-font-mono,ui-monospace,SFMono-Regular,Menlo,monospace)" } },
|
|
3699
|
+
fontSize: { prop: "fontSize", values: { "12": "12px", "13": "13px", "14": "14px", "16": "16px", "18": "18px" } },
|
|
3700
|
+
weight: { prop: "fontWeight", values: { "400": "400", "500": "500", "600": "600", "700": "700", "800": "800" } },
|
|
3701
|
+
letterSpacing: { prop: "letterSpacing", values: { "-2": "-0.02em", "-1": "-0.01em", "0": "0", "1": "0.01em", "2": "0.02em" } },
|
|
3702
|
+
textCase: { prop: "textTransform", values: { none: "none", title: "capitalize", upper: "uppercase" } }
|
|
3703
|
+
};
|
|
3704
|
+
var BUTTON_TEXT_KEYS = Object.keys(BUTTON_TEXT_CSS);
|
|
3705
|
+
function buttonTextCss(props) {
|
|
3706
|
+
if (!props || typeof props !== "object") return void 0;
|
|
3707
|
+
const p = props;
|
|
3708
|
+
const css = {};
|
|
3709
|
+
for (const key of BUTTON_TEXT_KEYS) {
|
|
3710
|
+
const { prop, values } = BUTTON_TEXT_CSS[key];
|
|
3711
|
+
const token = p[key];
|
|
3712
|
+
if (typeof token === "string" && Object.prototype.hasOwnProperty.call(values, token)) css[prop] = values[token];
|
|
3713
|
+
}
|
|
3714
|
+
return Object.keys(css).length ? css : void 0;
|
|
3715
|
+
}
|
|
3716
|
+
function buttonTextCssText(props) {
|
|
3717
|
+
const css = buttonTextCss(props);
|
|
3718
|
+
return css ? Object.entries(css).map(([k, v]) => `${k.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}:${v}`).join(";") : "";
|
|
3719
|
+
}
|
|
3720
|
+
function buttonTextProblem(value) {
|
|
3721
|
+
if (!value || typeof value !== "object") return null;
|
|
3722
|
+
const v = value;
|
|
3723
|
+
for (const key of BUTTON_TEXT_KEYS) {
|
|
3724
|
+
const token = v[key];
|
|
3725
|
+
if (token === void 0 || token === null) continue;
|
|
3726
|
+
const values = BUTTON_TEXT_CSS[key].values;
|
|
3727
|
+
if (typeof token !== "string" || !Object.prototype.hasOwnProperty.call(values, token)) {
|
|
3728
|
+
return `has an unknown ${key} "${String(token)}" (${Object.keys(values).join(", ")})`;
|
|
3729
|
+
}
|
|
3730
|
+
}
|
|
3636
3731
|
return null;
|
|
3637
3732
|
}
|
|
3638
|
-
var BUTTON_LOOK_KEYS = ["variant", "size", "arrow", "icon", "newTab", "fullWidth"];
|
|
3733
|
+
var BUTTON_LOOK_KEYS = ["variant", "size", "arrow", "icon", "newTab", "fullWidth", "radius", "font", "fontSize", "weight", "letterSpacing", "textCase"];
|
|
3639
3734
|
function buttonBlockProps(value) {
|
|
3640
3735
|
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
3641
3736
|
const v = value;
|
|
@@ -3661,9 +3756,9 @@ function buttonBlockProps(value) {
|
|
|
3661
3756
|
}
|
|
3662
3757
|
function soleButtonId(blockJson) {
|
|
3663
3758
|
const ids = [];
|
|
3664
|
-
const walk = (
|
|
3665
|
-
if (!Array.isArray(
|
|
3666
|
-
for (const b of
|
|
3759
|
+
const walk = (list2) => {
|
|
3760
|
+
if (!Array.isArray(list2)) return;
|
|
3761
|
+
for (const b of list2) {
|
|
3667
3762
|
if (b?.type === "button" && typeof b.id === "string") ids.push(b.id);
|
|
3668
3763
|
walk(b?.props?.children);
|
|
3669
3764
|
if (Array.isArray(b?.props?.columns)) for (const column of b.props.columns) walk(column);
|
|
@@ -3672,8 +3767,34 @@ function soleButtonId(blockJson) {
|
|
|
3672
3767
|
walk(blockJson);
|
|
3673
3768
|
return ids.length === 1 ? ids[0] : null;
|
|
3674
3769
|
}
|
|
3675
|
-
var LOOK_PROP_TYPE = {
|
|
3676
|
-
|
|
3770
|
+
var LOOK_PROP_TYPE = {
|
|
3771
|
+
variant: "text",
|
|
3772
|
+
size: "text",
|
|
3773
|
+
arrow: "boolean",
|
|
3774
|
+
icon: "text",
|
|
3775
|
+
newTab: "boolean",
|
|
3776
|
+
fullWidth: "boolean",
|
|
3777
|
+
radius: "text",
|
|
3778
|
+
font: "text",
|
|
3779
|
+
fontSize: "text",
|
|
3780
|
+
weight: "text",
|
|
3781
|
+
letterSpacing: "text",
|
|
3782
|
+
textCase: "text"
|
|
3783
|
+
};
|
|
3784
|
+
var LOOK_PROP_LABEL = {
|
|
3785
|
+
variant: "Style",
|
|
3786
|
+
size: "Size",
|
|
3787
|
+
arrow: "Show arrow",
|
|
3788
|
+
icon: "Leading icon",
|
|
3789
|
+
newTab: "Open in new tab",
|
|
3790
|
+
fullWidth: "Full width",
|
|
3791
|
+
radius: "Radius",
|
|
3792
|
+
font: "Font",
|
|
3793
|
+
fontSize: "Size of text",
|
|
3794
|
+
weight: "Weight",
|
|
3795
|
+
letterSpacing: "Letter spacing",
|
|
3796
|
+
textCase: "Case"
|
|
3797
|
+
};
|
|
3677
3798
|
function withButtonLookProps(def) {
|
|
3678
3799
|
const props = [...def.props ?? []];
|
|
3679
3800
|
if (def.category !== "button") return props;
|
|
@@ -3690,9 +3811,9 @@ function buttonValueOfInstance(def, overrides) {
|
|
|
3690
3811
|
const blockId = soleButtonId(def.blockJson);
|
|
3691
3812
|
if (!blockId) return null;
|
|
3692
3813
|
const found = [];
|
|
3693
|
-
const walk = (
|
|
3694
|
-
if (!Array.isArray(
|
|
3695
|
-
for (const b of
|
|
3814
|
+
const walk = (list2) => {
|
|
3815
|
+
if (!Array.isArray(list2)) return;
|
|
3816
|
+
for (const b of list2) {
|
|
3696
3817
|
if (b?.id === blockId) found.push(b);
|
|
3697
3818
|
walk(b?.props?.children);
|
|
3698
3819
|
if (Array.isArray(b?.props?.columns)) for (const column of b.props.columns) walk(column);
|
|
@@ -3769,53 +3890,53 @@ function tableValueProblems(value, opts = {}) {
|
|
|
3769
3890
|
const unknownKeys = (o, allowed, at) => {
|
|
3770
3891
|
for (const k of Object.keys(o)) if (!allowed.has(k)) bad([...at, k], `unknown key "${k}" (${[...allowed].join(", ")})`);
|
|
3771
3892
|
};
|
|
3772
|
-
const
|
|
3893
|
+
const str2 = (v, at, what, max, required = false) => {
|
|
3773
3894
|
if (v === void 0 && !required) return;
|
|
3774
3895
|
if (typeof v !== "string") bad(at, `${what} must be a string`);
|
|
3775
3896
|
else if (v.length > max) bad(at, `${what} is ${v.length} characters; at most ${max}`, "table_limit_exceeded");
|
|
3776
3897
|
};
|
|
3777
|
-
const
|
|
3898
|
+
const bool2 = (v, at, what) => {
|
|
3778
3899
|
if (v !== void 0 && typeof v !== "boolean") bad(at, `${what} must be true or false`);
|
|
3779
3900
|
};
|
|
3780
|
-
const
|
|
3901
|
+
const oneOf2 = (v, at, what, allowed) => {
|
|
3781
3902
|
if (v !== void 0 && !allowed.includes(v)) bad(at, `${what} must be one of ${allowed.join(", ")}`);
|
|
3782
3903
|
};
|
|
3783
3904
|
unknownKeys(t, TOP_KEYS, []);
|
|
3784
|
-
|
|
3785
|
-
|
|
3905
|
+
str2(t.id, ["id"], "id", TABLE_LIMITS.keyChars);
|
|
3906
|
+
str2(t.caption, ["caption"], "caption", TABLE_LIMITS.captionChars, true);
|
|
3786
3907
|
if (typeof t.caption === "string" && t.caption.trim() === "" && opts.requireCaption !== false) {
|
|
3787
3908
|
bad(["caption"], "give the table a caption that says what it compares (it names the table for screen readers and search)", "table_caption_required");
|
|
3788
3909
|
}
|
|
3789
|
-
|
|
3910
|
+
str2(t.notes, ["notes"], "notes", TABLE_LIMITS.notesChars);
|
|
3790
3911
|
if (t.notes !== void 0 && opts.allowNote === false && typeof t.notes === "string" && t.notes.trim() !== "") bad(["notes"], "this table takes no note (config.allowNote is false)");
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3912
|
+
bool2(t.headerRow, ["headerRow"], "headerRow");
|
|
3913
|
+
bool2(t.headerColumn, ["headerColumn"], "headerColumn");
|
|
3914
|
+
bool2(t.filterable, ["filterable"], "filterable");
|
|
3794
3915
|
if (t.design !== void 0) {
|
|
3795
3916
|
if (!isObj(t.design)) bad(["design"], "design must be an object");
|
|
3796
3917
|
else {
|
|
3797
3918
|
const d = t.design;
|
|
3798
3919
|
unknownKeys(d, DESIGN_KEYS, ["design"]);
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
for (const k of ["sticky", "striped", "hideCaption"])
|
|
3920
|
+
oneOf2(d.responsive, ["design", "responsive"], "design.responsive", TABLE_RESPONSIVE);
|
|
3921
|
+
oneOf2(d.density, ["design", "density"], "design.density", ["compact", "comfortable"]);
|
|
3922
|
+
for (const k of ["sticky", "striped", "hideCaption"]) bool2(d[k], ["design", k], `design.${k}`);
|
|
3802
3923
|
}
|
|
3803
3924
|
}
|
|
3804
|
-
const keyed = (
|
|
3925
|
+
const keyed = (list2, at, keys, textKey, allowed) => {
|
|
3805
3926
|
const seen = /* @__PURE__ */ new Set();
|
|
3806
|
-
if (
|
|
3807
|
-
if (!Array.isArray(
|
|
3927
|
+
if (list2 === void 0) return seen;
|
|
3928
|
+
if (!Array.isArray(list2)) {
|
|
3808
3929
|
bad([at], `${at} must be an array`);
|
|
3809
3930
|
return seen;
|
|
3810
3931
|
}
|
|
3811
|
-
if (!allowed &&
|
|
3812
|
-
|
|
3932
|
+
if (!allowed && list2.length > 0) bad([at], `this table takes no ${at === "footnotes" ? "footnotes (config.allowFootnotes is false)" : "row groups (config.allowGroups is false)"}`);
|
|
3933
|
+
list2.forEach((g, i) => {
|
|
3813
3934
|
if (!isObj(g)) return bad([at, i], `${at}[${i}] must be an object`);
|
|
3814
3935
|
unknownKeys(g, keys, [at, i]);
|
|
3815
3936
|
if (typeof g._key !== "string" || g._key === "" || g._key.length > TABLE_LIMITS.keyChars) bad([at, i, "_key"], `needs a _key string of 1 to ${TABLE_LIMITS.keyChars} characters`);
|
|
3816
3937
|
else if (seen.has(g._key)) bad([at, i, "_key"], `_key "${g._key}" is used twice`);
|
|
3817
3938
|
else seen.add(g._key);
|
|
3818
|
-
|
|
3939
|
+
str2(g[textKey], [at, i, textKey], textKey, textKey === "text" ? TABLE_LIMITS.notesChars : TABLE_LIMITS.labelChars, true);
|
|
3819
3940
|
});
|
|
3820
3941
|
return seen;
|
|
3821
3942
|
};
|
|
@@ -3832,20 +3953,20 @@ function tableValueProblems(value, opts = {}) {
|
|
|
3832
3953
|
unknownKeys(c, COLUMN_KEYS, at);
|
|
3833
3954
|
if (typeof c._key !== "string" || c._key === "" || c._key.length > TABLE_LIMITS.keyChars) bad([...at, "_key"], `needs a _key string of 1 to ${TABLE_LIMITS.keyChars} characters`);
|
|
3834
3955
|
else if (cols.has(c._key)) bad([...at, "_key"], `_key "${c._key}" is used twice`);
|
|
3835
|
-
|
|
3956
|
+
str2(c.label, [...at, "label"], "label", TABLE_LIMITS.labelChars, true);
|
|
3836
3957
|
if (!TABLE_COLUMN_TYPES.includes(c.type)) bad([...at, "type"], `type must be one of ${TABLE_COLUMN_TYPES.join(", ")}`);
|
|
3837
3958
|
else if (opts.columnTypes && !opts.columnTypes.includes(c.type)) {
|
|
3838
3959
|
bad([...at, "type"], `a ${String(c.type)} column is not offered here (config.columnTypes: ${opts.columnTypes.join(", ")})`, "table_column_type_not_allowed");
|
|
3839
3960
|
}
|
|
3840
|
-
|
|
3841
|
-
|
|
3961
|
+
str2(c.description, [...at, "description"], "description", TABLE_LIMITS.notesChars);
|
|
3962
|
+
str2(c.unit, [...at, "unit"], "unit", 16);
|
|
3842
3963
|
if (c.currency !== void 0 && (typeof c.currency !== "string" || !/^[A-Z]{3}$/.test(c.currency))) bad([...at, "currency"], "currency must be an ISO 4217 code such as USD");
|
|
3843
3964
|
if (c.decimals !== void 0 && (!Number.isInteger(c.decimals) || c.decimals < 0 || c.decimals > 10)) bad([...at, "decimals"], "decimals must be a whole number from 0 to 10");
|
|
3844
3965
|
if (c.max !== void 0 && (!Number.isInteger(c.max) || c.max < 1 || c.max > 10)) bad([...at, "max"], "max must be a whole number from 1 to 10");
|
|
3845
|
-
|
|
3846
|
-
for (const k of ["sortable", "highlight"])
|
|
3847
|
-
|
|
3848
|
-
|
|
3966
|
+
oneOf2(c.align, [...at, "align"], "align", ["start", "center", "end"]);
|
|
3967
|
+
for (const k of ["sortable", "highlight"]) bool2(c[k], [...at, k], k);
|
|
3968
|
+
str2(c.trueLabel, [...at, "trueLabel"], "trueLabel", TABLE_LIMITS.labelChars);
|
|
3969
|
+
str2(c.falseLabel, [...at, "falseLabel"], "falseLabel", TABLE_LIMITS.labelChars);
|
|
3849
3970
|
if (c.group !== void 0 && (typeof c.group !== "string" || !colGroups.has(c.group))) bad([...at, "group"], `group "${String(c.group)}" is not a key of columnGroups`);
|
|
3850
3971
|
if (c.refTo !== void 0 && (!Array.isArray(c.refTo) || c.refTo.some((r) => typeof r !== "string" || r === ""))) bad([...at, "refTo"], 'refTo must be a list of collection ids or "page"');
|
|
3851
3972
|
if (typeof c._key === "string" && c._key !== "" && !cols.has(c._key)) cols.set(c._key, c);
|
|
@@ -3869,9 +3990,9 @@ function tableValueProblems(value, opts = {}) {
|
|
|
3869
3990
|
else if (rowKeys.has(r._key)) bad([...at, "_key"], `_key "${r._key}" is used twice`);
|
|
3870
3991
|
else rowKeys.add(r._key);
|
|
3871
3992
|
if (r.group !== void 0 && (typeof r.group !== "string" || !rowGroups.has(r.group))) bad([...at, "group"], `group "${String(r.group)}" is not a key of rowGroups`);
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3993
|
+
bool2(r.footer, [...at, "footer"], "footer");
|
|
3994
|
+
bool2(r.highlight, [...at, "highlight"], "highlight");
|
|
3995
|
+
oneOf2(r.type, [...at, "type"], "type", TABLE_COLUMN_TYPES);
|
|
3875
3996
|
if (!isObj(r.cells)) return bad([...at, "cells"], "cells must be an object keyed by column _key");
|
|
3876
3997
|
for (const [k, cell] of Object.entries(r.cells)) {
|
|
3877
3998
|
const cAt = [...at, "cells", k];
|
|
@@ -4023,8 +4144,8 @@ function sanitizeInline(html) {
|
|
|
4023
4144
|
return html.replace(/<(script|style|iframe|object|embed|template)\b[\s\S]*?<\/\1>/gi, "").replace(/<\/?([a-z][a-z0-9]*)\b([^>]*)>/gi, (m, tag, attrs) => {
|
|
4024
4145
|
const t = tag.toLowerCase();
|
|
4025
4146
|
if (!INLINE_TAGS.has(t)) return "";
|
|
4026
|
-
const
|
|
4027
|
-
if (m.startsWith("</")) return `</${
|
|
4147
|
+
const name2 = t === "b" ? "strong" : t === "i" ? "em" : t;
|
|
4148
|
+
if (m.startsWith("</")) return `</${name2}>`;
|
|
4028
4149
|
if (t === "a") {
|
|
4029
4150
|
const href = attrs.match(/href\s*=\s*("([^"]*)"|'([^']*)')/i);
|
|
4030
4151
|
return `<a href="${escAttr(safeHref(href ? href[2] ?? href[3] ?? "" : ""))}">`;
|
|
@@ -4033,7 +4154,7 @@ function sanitizeInline(html) {
|
|
|
4033
4154
|
const title = attrs.match(/title\s*=\s*"([^"]*)"/i);
|
|
4034
4155
|
return title ? `<abbr title="${escAttr(title[1])}">` : "<abbr>";
|
|
4035
4156
|
}
|
|
4036
|
-
return `<${
|
|
4157
|
+
return `<${name2}>`;
|
|
4037
4158
|
});
|
|
4038
4159
|
}
|
|
4039
4160
|
var alignOf = (col, t) => col.align ?? (t === "number" || t === "money" || t === "rating" ? "end" : "start");
|
|
@@ -4358,8 +4479,8 @@ var FORM_UPLOAD_REFUSED_EXTENSIONS = [
|
|
|
4358
4479
|
function isRefusedUploadExtension(ext) {
|
|
4359
4480
|
return FORM_UPLOAD_REFUSED_EXTENSIONS.includes(ext.toLowerCase());
|
|
4360
4481
|
}
|
|
4361
|
-
function fileExtension(
|
|
4362
|
-
const base =
|
|
4482
|
+
function fileExtension(name2) {
|
|
4483
|
+
const base = name2.slice(Math.max(name2.lastIndexOf("/"), name2.lastIndexOf("\\")) + 1);
|
|
4363
4484
|
const dot = base.lastIndexOf(".");
|
|
4364
4485
|
return dot <= 0 || dot === base.length - 1 ? "" : base.slice(dot + 1).toLowerCase();
|
|
4365
4486
|
}
|
|
@@ -4440,10 +4561,10 @@ function landmarkRegions(doc, dialogs = false, landmarks = false) {
|
|
|
4440
4561
|
} else if (el.parentElement?.closest(DIALOG_SELECTOR)) {
|
|
4441
4562
|
continue;
|
|
4442
4563
|
}
|
|
4443
|
-
const
|
|
4444
|
-
const n = counts.get(
|
|
4445
|
-
counts.set(
|
|
4446
|
-
out.push({ slot: `${
|
|
4564
|
+
const name2 = !LANDMARK_TAGS.has(el.tagName) && el.matches(DIALOG_SELECTOR) ? "dialog" : el.tagName.toLowerCase();
|
|
4565
|
+
const n = counts.get(name2) ?? 0;
|
|
4566
|
+
counts.set(name2, n + 1);
|
|
4567
|
+
out.push({ slot: `${name2}#${n}`, el });
|
|
4447
4568
|
}
|
|
4448
4569
|
return out;
|
|
4449
4570
|
}
|
|
@@ -4453,6 +4574,383 @@ function regionOf(regions, el) {
|
|
|
4453
4574
|
return slot;
|
|
4454
4575
|
}
|
|
4455
4576
|
|
|
4577
|
+
// src/local-setup.ts
|
|
4578
|
+
var LOCAL_SETUP_VERSION = 1;
|
|
4579
|
+
var SITE_MAP_VERSION = 3;
|
|
4580
|
+
var SITE_MAP_VERSIONS = [1, 2, 3];
|
|
4581
|
+
var LOCAL_FRAMEWORKS = ["astro", "next", "sveltekit", "nuxt", "react", "html"];
|
|
4582
|
+
var LAYOUT_ROLES = ["layout", "header", "footer", "nav"];
|
|
4583
|
+
var BLOCKED_REASONS = [
|
|
4584
|
+
"CLIENT_ONLY_ISLAND",
|
|
4585
|
+
"INNER_HTML",
|
|
4586
|
+
"COMPUTED_STRING",
|
|
4587
|
+
"DIALECT_UNSUPPORTED",
|
|
4588
|
+
"FILE_TOO_LARGE",
|
|
4589
|
+
"OVER_ROUTE_CAP",
|
|
4590
|
+
"UNRESOLVED_IMPORT",
|
|
4591
|
+
"PARSE_FAILED",
|
|
4592
|
+
"I18N_DICTIONARY"
|
|
4593
|
+
];
|
|
4594
|
+
var MAX_SITE_MAP_BYTES = 4 * 1024 * 1024;
|
|
4595
|
+
var MAX_LOCAL_SETUP_BYTES = 20 * 1024 * 1024;
|
|
4596
|
+
var LOCAL_SETUP_LIMITS = {
|
|
4597
|
+
routes: 2e4,
|
|
4598
|
+
templates: 5e3,
|
|
4599
|
+
components: 1e4,
|
|
4600
|
+
collections: 500,
|
|
4601
|
+
entryFiles: 2e4,
|
|
4602
|
+
fieldsPerCollection: 500,
|
|
4603
|
+
forms: 2e3,
|
|
4604
|
+
blocked: 5e3,
|
|
4605
|
+
partialDefault: 500,
|
|
4606
|
+
pages: 2e4,
|
|
4607
|
+
entriesPerCollection: 2e4,
|
|
4608
|
+
evidenceRows: 2e4,
|
|
4609
|
+
timings: 64,
|
|
4610
|
+
styleTokens: 2e3,
|
|
4611
|
+
/** Per `styleGuide.used` group, and the families the typography names. */
|
|
4612
|
+
styleValues: 50,
|
|
4613
|
+
/** Section candidates per template, and sections per page in the manifest. */
|
|
4614
|
+
sections: 200,
|
|
4615
|
+
/** Field keys one section holds. */
|
|
4616
|
+
sectionFields: 500
|
|
4617
|
+
};
|
|
4618
|
+
var MAX_ISSUES = 20;
|
|
4619
|
+
var SECTION_KINDS = ["element", "component", "expression", "fragment", "text"];
|
|
4620
|
+
var STYLE_TOKEN_GROUPS = ["color", "font", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "spacing", "radius", "shadow", "breakpoint", "other"];
|
|
4621
|
+
var STYLE_USED_GROUPS = ["color", "fontSize", "spacing", "radius", "shadow", "breakpoint"];
|
|
4622
|
+
var fail = (out, at, message) => {
|
|
4623
|
+
if (out.length < MAX_ISSUES) out.push({ path: at || "(root)", message });
|
|
4624
|
+
};
|
|
4625
|
+
var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4626
|
+
var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
4627
|
+
var HEX_SHA = /^[0-9a-f]{7,64}$/;
|
|
4628
|
+
var CODE = /^[A-Z][A-Z0-9_]{0,63}$/;
|
|
4629
|
+
var REPO_PATH = 2048;
|
|
4630
|
+
var NAME = 256;
|
|
4631
|
+
var str = (max, min = 0) => (v, at, out) => {
|
|
4632
|
+
if (typeof v !== "string") fail(out, at, "must be a string");
|
|
4633
|
+
else if (v.length < min || v.length > max) fail(out, at, `must be ${min}-${max} characters (got ${v.length})`);
|
|
4634
|
+
};
|
|
4635
|
+
var matching = (re, what) => (v, at, out) => {
|
|
4636
|
+
if (typeof v !== "string" || !re.test(v)) fail(out, at, `must be ${what}`);
|
|
4637
|
+
};
|
|
4638
|
+
var repoPath = (v, at, out) => {
|
|
4639
|
+
if (typeof v !== "string" || v.length === 0 || v.length > REPO_PATH) return fail(out, at, `must be a repo-relative path of 1-${REPO_PATH} characters`);
|
|
4640
|
+
if (v.startsWith("/") || v.includes("\\") || /^[a-z]:/i.test(v) || v.split("/").includes("..")) fail(out, at, `must be repo-relative with forward slashes, never absolute or climbing out (${v.slice(0, 80)})`);
|
|
4641
|
+
};
|
|
4642
|
+
var route = (v, at, out) => {
|
|
4643
|
+
if (typeof v !== "string" || !v.startsWith("/") || v.length > REPO_PATH) fail(out, at, "must be a route starting with /");
|
|
4644
|
+
};
|
|
4645
|
+
var count = (max = Number.MAX_SAFE_INTEGER) => (v, at, out) => {
|
|
4646
|
+
if (typeof v !== "number" || !Number.isInteger(v) || v < 0 || v > max) fail(out, at, `must be a whole number from 0 to ${max}`);
|
|
4647
|
+
};
|
|
4648
|
+
var positive = (v, at, out) => {
|
|
4649
|
+
if (typeof v !== "number" || !Number.isInteger(v) || v < 1) fail(out, at, "must be a whole number from 1");
|
|
4650
|
+
};
|
|
4651
|
+
var bool = (v, at, out) => {
|
|
4652
|
+
if (typeof v !== "boolean") fail(out, at, "must be true or false");
|
|
4653
|
+
};
|
|
4654
|
+
var literal = (value) => (v, at, out) => {
|
|
4655
|
+
if (v !== value) fail(out, at, `must be ${JSON.stringify(value)}`);
|
|
4656
|
+
};
|
|
4657
|
+
var oneOf = (values) => (v, at, out) => {
|
|
4658
|
+
if (!values.includes(v)) fail(out, at, `must be one of ${values.join(", ")}`);
|
|
4659
|
+
};
|
|
4660
|
+
var nullable = (check) => (v, at, out) => {
|
|
4661
|
+
if (v !== null) check(v, at, out);
|
|
4662
|
+
};
|
|
4663
|
+
var list = (max, item) => (v, at, out) => {
|
|
4664
|
+
if (!Array.isArray(v)) return fail(out, at, "must be a list");
|
|
4665
|
+
if (v.length > max) return fail(out, at, `must hold at most ${max} items (got ${v.length})`);
|
|
4666
|
+
for (let i = 0; i < v.length && out.length < MAX_ISSUES; i += 1) item(v[i], `${at}[${i}]`, out);
|
|
4667
|
+
};
|
|
4668
|
+
var keysSafe = (v, at, out) => {
|
|
4669
|
+
for (const k of Object.keys(v)) if (UNSAFE_KEYS.has(k)) fail(out, `${at}.${k}`, "is not an allowed key");
|
|
4670
|
+
};
|
|
4671
|
+
var record = (maxKeys, value) => (v, at, out) => {
|
|
4672
|
+
if (!isObject(v)) return fail(out, at, "must be an object");
|
|
4673
|
+
const keys = Object.keys(v);
|
|
4674
|
+
if (keys.length > maxKeys) return fail(out, at, `must hold at most ${maxKeys} keys (got ${keys.length})`);
|
|
4675
|
+
keysSafe(v, at, out);
|
|
4676
|
+
for (const k of keys) {
|
|
4677
|
+
if (k.length === 0 || k.length > NAME) fail(out, `${at}.${k.slice(0, 40)}`, `key must be 1-${NAME} characters`);
|
|
4678
|
+
value(v[k], `${at}.${k}`, out);
|
|
4679
|
+
}
|
|
4680
|
+
};
|
|
4681
|
+
var object = (required, optional = {}) => (v, at, out) => {
|
|
4682
|
+
if (!isObject(v)) return fail(out, at, "must be an object");
|
|
4683
|
+
keysSafe(v, at, out);
|
|
4684
|
+
for (const [k, check] of Object.entries(required)) {
|
|
4685
|
+
if (!(k in v)) fail(out, `${at}.${k}`, "is required");
|
|
4686
|
+
else check(v[k], `${at}.${k}`, out);
|
|
4687
|
+
}
|
|
4688
|
+
for (const [k, check] of Object.entries(optional)) if (k in v && v[k] !== void 0) check(v[k], `${at}.${k}`, out);
|
|
4689
|
+
};
|
|
4690
|
+
var anyObject = (v, at, out) => {
|
|
4691
|
+
if (!isObject(v)) fail(out, at, "must be an object");
|
|
4692
|
+
else keysSafe(v, at, out);
|
|
4693
|
+
};
|
|
4694
|
+
var name = str(NAME, 1);
|
|
4695
|
+
var names = (max) => list(max, name);
|
|
4696
|
+
var literals = object({ text: count(), image: count(), link: count(), video: count() });
|
|
4697
|
+
var SECTION_TYPE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
|
|
4698
|
+
var sectionType = (v, at, out) => {
|
|
4699
|
+
if (typeof v !== "string" || v.length > 64 || !SECTION_TYPE.test(v)) fail(out, at, "must be a section family: lowercase words joined by hyphens, at most 64 characters (call-to-action)");
|
|
4700
|
+
};
|
|
4701
|
+
var candidate = (v, at, out) => {
|
|
4702
|
+
object({
|
|
4703
|
+
id: name,
|
|
4704
|
+
file: repoPath,
|
|
4705
|
+
start: count(),
|
|
4706
|
+
end: count(),
|
|
4707
|
+
line: positive,
|
|
4708
|
+
kind: oneOf(SECTION_KINDS),
|
|
4709
|
+
sectionType,
|
|
4710
|
+
label: str(200, 1),
|
|
4711
|
+
fields: names(LOCAL_SETUP_LIMITS.sectionFields),
|
|
4712
|
+
component: nullable(name),
|
|
4713
|
+
props: names(500),
|
|
4714
|
+
repeats: names(LOCAL_SETUP_LIMITS.templates),
|
|
4715
|
+
variants: names(LOCAL_SETUP_LIMITS.components)
|
|
4716
|
+
})(v, at, out);
|
|
4717
|
+
if (isObject(v) && typeof v.start === "number" && typeof v.end === "number" && v.end <= v.start) fail(out, `${at}.end`, "must be after start");
|
|
4718
|
+
};
|
|
4719
|
+
var template = (v, at, out) => {
|
|
4720
|
+
object(
|
|
4721
|
+
{ id: name, file: repoPath, pattern: route, components: names(LOCAL_SETUP_LIMITS.components), literals, collection: nullable(name) },
|
|
4722
|
+
{
|
|
4723
|
+
routes: list(LOCAL_SETUP_LIMITS.routes, route),
|
|
4724
|
+
routeCount: count(LOCAL_SETUP_LIMITS.routes),
|
|
4725
|
+
sections: list(LOCAL_SETUP_LIMITS.sections, candidate),
|
|
4726
|
+
sectionsRefused: object({ code: matching(CODE, "an UPPER_SNAKE reason code"), message: str(1024) }),
|
|
4727
|
+
sectionsWrapped: bool
|
|
4728
|
+
}
|
|
4729
|
+
)(v, at, out);
|
|
4730
|
+
if (isObject(v) && "routes" in v === "routeCount" in v) fail(out, at, "must carry exactly one of routes and routeCount");
|
|
4731
|
+
};
|
|
4732
|
+
var color = object({ value: matching(/^#[0-9A-F]{6}$/, "a #RRGGBB colour"), token: nullable(name) });
|
|
4733
|
+
var styleGuide = object({
|
|
4734
|
+
tokens: list(
|
|
4735
|
+
LOCAL_SETUP_LIMITS.styleTokens,
|
|
4736
|
+
object({ name, group: oneOf(STYLE_TOKEN_GROUPS), value: nullable(str(1024)), source: repoPath, scope: str(NAME, 1) }, { alias: name })
|
|
4737
|
+
),
|
|
4738
|
+
primary: object({ primary: nullable(color), accent: nullable(color), background: nullable(color), text: nullable(color) }),
|
|
4739
|
+
typography: object({
|
|
4740
|
+
heading: nullable(name),
|
|
4741
|
+
body: nullable(name),
|
|
4742
|
+
families: names(LOCAL_SETUP_LIMITS.styleValues),
|
|
4743
|
+
faces: list(200, object({ family: name, source: repoPath }, { weight: str(16, 1), style: str(16, 1) })),
|
|
4744
|
+
scale: list(100, object({ name, size: str(256, 1), source: repoPath }))
|
|
4745
|
+
}),
|
|
4746
|
+
used: object(Object.fromEntries(STYLE_USED_GROUPS.map((g) => [g, list(LOCAL_SETUP_LIMITS.styleValues, str(256, 1))]))),
|
|
4747
|
+
components: object({ buttons: names(LOCAL_SETUP_LIMITS.components), cards: names(LOCAL_SETUP_LIMITS.components), headings: names(LOCAL_SETUP_LIMITS.components) }),
|
|
4748
|
+
reference: nullable(object({ route, file: repoPath, components: names(LOCAL_SETUP_LIMITS.components) })),
|
|
4749
|
+
sources: list(500, repoPath)
|
|
4750
|
+
});
|
|
4751
|
+
var siteMapShape = object({
|
|
4752
|
+
version: oneOf(SITE_MAP_VERSIONS),
|
|
4753
|
+
toolVersion: str(64, 1),
|
|
4754
|
+
sha: nullable(matching(HEX_SHA, "a git commit sha (7-64 hex)")),
|
|
4755
|
+
framework: oneOf(LOCAL_FRAMEWORKS),
|
|
4756
|
+
build: object({ command: nullable(str(1024, 1)), outDir: nullable(repoPath) }),
|
|
4757
|
+
templates: list(LOCAL_SETUP_LIMITS.templates, template),
|
|
4758
|
+
components: list(
|
|
4759
|
+
LOCAL_SETUP_LIMITS.components,
|
|
4760
|
+
object({ id: name, file: repoPath, usedBy: names(LOCAL_SETUP_LIMITS.templates), props: names(500), literals, sectionCandidate: bool })
|
|
4761
|
+
),
|
|
4762
|
+
layout: list(200, object({ file: repoPath, role: oneOf(LAYOUT_ROLES) })),
|
|
4763
|
+
collections: list(
|
|
4764
|
+
LOCAL_SETUP_LIMITS.collections,
|
|
4765
|
+
object({
|
|
4766
|
+
id: name,
|
|
4767
|
+
source: repoPath,
|
|
4768
|
+
fields: list(LOCAL_SETUP_LIMITS.fieldsPerCollection, object({ key: name, type: str(64, 1) }, { required: bool })),
|
|
4769
|
+
entries: count(LOCAL_SETUP_LIMITS.entriesPerCollection),
|
|
4770
|
+
files: list(LOCAL_SETUP_LIMITS.entryFiles, repoPath)
|
|
4771
|
+
})
|
|
4772
|
+
),
|
|
4773
|
+
locales: object({ default: nullable(str(35, 1)), locales: list(500, str(35, 1)), dictionaries: list(2e3, repoPath), readBy: names(LOCAL_SETUP_LIMITS.templates) }),
|
|
4774
|
+
forms: list(
|
|
4775
|
+
LOCAL_SETUP_LIMITS.forms,
|
|
4776
|
+
object({ file: repoPath, line: positive, templates: names(LOCAL_SETUP_LIMITS.templates), action: nullable(str(REPO_PATH)), method: nullable(str(16)), handler: nullable(str(64, 1)), fields: count(1e3) })
|
|
4777
|
+
),
|
|
4778
|
+
media: object({ images: count(), videos: count(), remoteHosts: list(500, str(253, 1)), overPolicy: list(5e3, object({ file: repoPath, bytes: count() })) }),
|
|
4779
|
+
styles: object({ tailwind: bool, files: list(500, repoPath), colors: list(500, object({ name, value: str(256, 1) })) }),
|
|
4780
|
+
blocked: list(
|
|
4781
|
+
LOCAL_SETUP_LIMITS.blocked,
|
|
4782
|
+
object({ file: repoPath, reason: matching(CODE, "an UPPER_SNAKE reason code") }, { line: positive, message: str(1024) })
|
|
4783
|
+
),
|
|
4784
|
+
partialDefault: list(LOCAL_SETUP_LIMITS.partialDefault, route)
|
|
4785
|
+
}, { styleGuide });
|
|
4786
|
+
function siteMapRefs(map, at, out) {
|
|
4787
|
+
const unique = (ids, where) => {
|
|
4788
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4789
|
+
ids.forEach((id, i) => {
|
|
4790
|
+
if (seen.has(id)) fail(out, `${at}.${where}[${i}].id`, `"${id.slice(0, 80)}" is not unique`);
|
|
4791
|
+
seen.add(id);
|
|
4792
|
+
});
|
|
4793
|
+
return seen;
|
|
4794
|
+
};
|
|
4795
|
+
const templates = unique(map.templates.map((t) => t.id), "templates");
|
|
4796
|
+
const components = unique(map.components.map((c) => c.id), "components");
|
|
4797
|
+
const collections = unique(map.collections.map((c) => c.id), "collections");
|
|
4798
|
+
const known = (set, ids, where, what) => ids.forEach((id, i) => {
|
|
4799
|
+
if (!set.has(id)) fail(out, `${at}.${where}[${i}]`, `names ${what} "${id.slice(0, 80)}", which is not in the map`);
|
|
4800
|
+
});
|
|
4801
|
+
let routes = 0;
|
|
4802
|
+
map.templates.forEach((t, i) => {
|
|
4803
|
+
known(components, t.components, `templates[${i}].components`, "the component");
|
|
4804
|
+
if (t.collection !== null && !collections.has(t.collection)) fail(out, `${at}.templates[${i}].collection`, `names the collection "${t.collection.slice(0, 80)}", which is not in the map`);
|
|
4805
|
+
routes += t.routes?.length ?? t.routeCount ?? 0;
|
|
4806
|
+
});
|
|
4807
|
+
if (routes > LOCAL_SETUP_LIMITS.routes) fail(out, `${at}.templates`, `render at most ${LOCAL_SETUP_LIMITS.routes} routes in all (got ${routes}); list the rest in blocked as OVER_ROUTE_CAP`);
|
|
4808
|
+
map.templates.forEach((t, i) => {
|
|
4809
|
+
const ids = /* @__PURE__ */ new Set();
|
|
4810
|
+
(t.sections ?? []).forEach((c, n) => {
|
|
4811
|
+
const where = `templates[${i}].sections[${n}]`;
|
|
4812
|
+
if (ids.has(c.id)) fail(out, `${at}.${where}.id`, `"${c.id.slice(0, 80)}" is not unique in its template`);
|
|
4813
|
+
ids.add(c.id);
|
|
4814
|
+
if (c.component !== null && !components.has(c.component)) fail(out, `${at}.${where}.component`, `names the component "${c.component.slice(0, 80)}", which is not in the map`);
|
|
4815
|
+
known(templates, c.repeats, `${where}.repeats`, "the template");
|
|
4816
|
+
known(components, c.variants, `${where}.variants`, "the component");
|
|
4817
|
+
});
|
|
4818
|
+
});
|
|
4819
|
+
map.components.forEach((c, i) => known(templates, c.usedBy, `components[${i}].usedBy`, "the template"));
|
|
4820
|
+
map.forms.forEach((f, i) => known(templates, f.templates, `forms[${i}].templates`, "the template"));
|
|
4821
|
+
known(templates, map.locales.readBy, "locales.readBy", "the template");
|
|
4822
|
+
const guide = map.styleGuide;
|
|
4823
|
+
if (guide) {
|
|
4824
|
+
const rendered = /* @__PURE__ */ new Set([...components, ...templates]);
|
|
4825
|
+
for (const kind of ["buttons", "cards", "headings"]) known(rendered, guide.components[kind], `styleGuide.components.${kind}`, "the component");
|
|
4826
|
+
if (guide.reference) {
|
|
4827
|
+
if (!templates.has(guide.reference.file)) fail(out, `${at}.styleGuide.reference.file`, `names the template "${guide.reference.file.slice(0, 80)}", which is not in the map`);
|
|
4828
|
+
known(components, guide.reference.components, "styleGuide.reference.components", "the component");
|
|
4829
|
+
}
|
|
4830
|
+
}
|
|
4831
|
+
}
|
|
4832
|
+
var proofRow = object({ path: str(512, 1) }, { route, file: str(REPO_PATH), line: positive, reason: str(1024) });
|
|
4833
|
+
var proofRows = list(LOCAL_SETUP_LIMITS.evidenceRows, proofRow);
|
|
4834
|
+
var manifestShape = object({
|
|
4835
|
+
version: literal(LOCAL_SETUP_VERSION),
|
|
4836
|
+
toolVersion: str(64, 1),
|
|
4837
|
+
sha: matching(HEX_SHA, "a git commit sha (7-64 hex)"),
|
|
4838
|
+
framework: oneOf(LOCAL_FRAMEWORKS),
|
|
4839
|
+
scope: (v, at, out) => {
|
|
4840
|
+
if (isObject(v) && v.mode === "full") return;
|
|
4841
|
+
if (isObject(v) && v.mode === "partial") return list(LOCAL_SETUP_LIMITS.routes, route)(v.routes, `${at}.routes`, out);
|
|
4842
|
+
fail(out, at, 'must be { mode: "full" } or { mode: "partial", routes: [...] }');
|
|
4843
|
+
},
|
|
4844
|
+
siteMap: siteMapShape,
|
|
4845
|
+
doc: object(
|
|
4846
|
+
{},
|
|
4847
|
+
{
|
|
4848
|
+
schema: record(LOCAL_SETUP_LIMITS.pages, object({ fields: list(LOCAL_SETUP_LIMITS.fieldsPerCollection, anyObject) }, { name: str(NAME) })),
|
|
4849
|
+
collections: record(LOCAL_SETUP_LIMITS.collections, list(LOCAL_SETUP_LIMITS.entriesPerCollection, object({ slug: str(NAME, 1), data: anyObject }, { status: oneOf(["draft", "published"]) }))),
|
|
4850
|
+
derivedCollections: literal(true),
|
|
4851
|
+
forms: list(LOCAL_SETUP_LIMITS.forms, anyObject),
|
|
4852
|
+
pages: list(LOCAL_SETUP_LIMITS.pages, anyObject),
|
|
4853
|
+
components: list(LOCAL_SETUP_LIMITS.components, anyObject)
|
|
4854
|
+
}
|
|
4855
|
+
),
|
|
4856
|
+
receipt: object({
|
|
4857
|
+
briefDigest: matching(/^sha256:[0-9a-f]{64}$/, "a sha256: brief digest"),
|
|
4858
|
+
paths: object({ declared: count(), rewritten: count(), alreadyDeclared: count(), pending: list(LOCAL_SETUP_LIMITS.routes, anyObject) })
|
|
4859
|
+
}),
|
|
4860
|
+
evidence: object({
|
|
4861
|
+
xray: list(
|
|
4862
|
+
LOCAL_SETUP_LIMITS.evidenceRows,
|
|
4863
|
+
object({ route, template: nullable(name), visible: count(), unaddressable: count(), unbound: list(500, object({ section: str(NAME), tag: str(32), text: str(256) })) })
|
|
4864
|
+
),
|
|
4865
|
+
proof: object({ sha: nullable(matching(HEX_SHA, "a git commit sha")), matched: count(), formatted: count(), indirect: proofRows, mismatched: proofRows, inert: proofRows, conflicts: proofRows }),
|
|
4866
|
+
renderEqual: list(LOCAL_SETUP_LIMITS.evidenceRows, object({ route, equal: bool }, { difference: object({ at: count(), was: str(512), now: str(512) }) }))
|
|
4867
|
+
}),
|
|
4868
|
+
timings: record(LOCAL_SETUP_LIMITS.timings, count())
|
|
4869
|
+
}, {
|
|
4870
|
+
sections: list(
|
|
4871
|
+
LOCAL_SETUP_LIMITS.pages,
|
|
4872
|
+
object(
|
|
4873
|
+
{
|
|
4874
|
+
page: matching(/^[a-z0-9][a-z0-9-/]{0,254}$/, "a page slug"),
|
|
4875
|
+
file: repoPath,
|
|
4876
|
+
sections: list(
|
|
4877
|
+
LOCAL_SETUP_LIMITS.sections,
|
|
4878
|
+
object({ id: name, name: str(200, 1), sectionType }, { variant: str(120, 1), component: nullable(name) })
|
|
4879
|
+
)
|
|
4880
|
+
},
|
|
4881
|
+
{ template: bool }
|
|
4882
|
+
)
|
|
4883
|
+
)
|
|
4884
|
+
});
|
|
4885
|
+
function utf8Bytes(s) {
|
|
4886
|
+
let n = 0;
|
|
4887
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
4888
|
+
const c = s.charCodeAt(i);
|
|
4889
|
+
if (c < 128) n += 1;
|
|
4890
|
+
else if (c < 2048) n += 2;
|
|
4891
|
+
else if (c >= 55296 && c <= 56319) {
|
|
4892
|
+
n += 4;
|
|
4893
|
+
i += 1;
|
|
4894
|
+
} else n += 3;
|
|
4895
|
+
}
|
|
4896
|
+
return n;
|
|
4897
|
+
}
|
|
4898
|
+
function parsed(input, maxBytes, out) {
|
|
4899
|
+
if (typeof input !== "string") return input;
|
|
4900
|
+
const bytes = utf8Bytes(input);
|
|
4901
|
+
if (bytes > maxBytes) {
|
|
4902
|
+
fail(out, "", `is ${bytes} bytes; the cap is ${maxBytes}`);
|
|
4903
|
+
return void 0;
|
|
4904
|
+
}
|
|
4905
|
+
try {
|
|
4906
|
+
return JSON.parse(input);
|
|
4907
|
+
} catch (err) {
|
|
4908
|
+
fail(out, "", `is not JSON: ${err instanceof Error ? err.message.slice(0, 200) : "unreadable"}`);
|
|
4909
|
+
return void 0;
|
|
4910
|
+
}
|
|
4911
|
+
}
|
|
4912
|
+
function versionIssue(v, known) {
|
|
4913
|
+
if (!isObject(v)) return { path: "(root)", message: "must be an object" };
|
|
4914
|
+
const newest = known[known.length - 1];
|
|
4915
|
+
return known.includes(v.version) ? null : { path: "version", message: `is ${JSON.stringify(v.version)}; this reader understands version ${known.join(" or ")}. Upgrade the reader, or write version ${newest}.` };
|
|
4916
|
+
}
|
|
4917
|
+
function parseSiteMap(input) {
|
|
4918
|
+
const out = [];
|
|
4919
|
+
const v = parsed(input, MAX_SITE_MAP_BYTES, out);
|
|
4920
|
+
if (out.length) return { ok: false, issues: out };
|
|
4921
|
+
const version = versionIssue(v, SITE_MAP_VERSIONS);
|
|
4922
|
+
if (version) return { ok: false, issues: [version] };
|
|
4923
|
+
siteMapShape(v, "", out);
|
|
4924
|
+
if (!out.length) siteMapRefs(v, "", out);
|
|
4925
|
+
return out.length ? { ok: false, issues: out.map(rooted) } : { ok: true, value: v };
|
|
4926
|
+
}
|
|
4927
|
+
function parseLocalSetupManifest(input) {
|
|
4928
|
+
const out = [];
|
|
4929
|
+
const v = parsed(input, MAX_LOCAL_SETUP_BYTES, out);
|
|
4930
|
+
if (out.length) return { ok: false, issues: out };
|
|
4931
|
+
const version = versionIssue(v, [LOCAL_SETUP_VERSION]);
|
|
4932
|
+
if (version) return { ok: false, issues: [version] };
|
|
4933
|
+
manifestShape(v, "", out);
|
|
4934
|
+
if (!out.length) {
|
|
4935
|
+
const m = v;
|
|
4936
|
+
siteMapRefs(m.siteMap, ".siteMap", out);
|
|
4937
|
+
if (m.siteMap.framework !== m.framework) fail(out, ".framework", `is ${m.framework}, but the site map says ${m.siteMap.framework}`);
|
|
4938
|
+
const pagesSeen = /* @__PURE__ */ new Set();
|
|
4939
|
+
(m.sections ?? []).forEach((p, i) => {
|
|
4940
|
+
const key = `${p.template === true ? "template:" : ""}${p.page}`;
|
|
4941
|
+
if (pagesSeen.has(key)) fail(out, `.sections[${i}].page`, `"${p.page}" is sent twice`);
|
|
4942
|
+
pagesSeen.add(key);
|
|
4943
|
+
const ids = /* @__PURE__ */ new Set();
|
|
4944
|
+
p.sections.forEach((x, n) => {
|
|
4945
|
+
if (ids.has(x.id)) fail(out, `.sections[${i}].sections[${n}].id`, `"${x.id.slice(0, 80)}" is not unique on its page`);
|
|
4946
|
+
ids.add(x.id);
|
|
4947
|
+
});
|
|
4948
|
+
});
|
|
4949
|
+
}
|
|
4950
|
+
return out.length ? { ok: false, issues: out.map(rooted) } : { ok: true, value: v };
|
|
4951
|
+
}
|
|
4952
|
+
var rooted = (i) => ({ ...i, path: i.path.startsWith(".") ? i.path.slice(1) : i.path });
|
|
4953
|
+
|
|
4456
4954
|
// src/sections.ts
|
|
4457
4955
|
var TAG_HEADS = /* @__PURE__ */ new Set([
|
|
4458
4956
|
"h1",
|
|
@@ -4801,9 +5299,9 @@ function canonicalJson(value) {
|
|
|
4801
5299
|
if (typeof value === "string" || typeof value === "boolean") return JSON.stringify(value);
|
|
4802
5300
|
if (Array.isArray(value)) return `[${value.map((child) => skipped(child) ? "null" : canonicalJson(child)).join(",")}]`;
|
|
4803
5301
|
if (typeof value === "object") {
|
|
4804
|
-
const
|
|
4805
|
-
const keys = Object.keys(
|
|
4806
|
-
return `{${keys.map((key) => `${JSON.stringify(key)}:${canonicalJson(
|
|
5302
|
+
const record2 = value;
|
|
5303
|
+
const keys = Object.keys(record2).filter((key) => !skipped(record2[key])).sort();
|
|
5304
|
+
return `{${keys.map((key) => `${JSON.stringify(key)}:${canonicalJson(record2[key])}`).join(",")}}`;
|
|
4807
5305
|
}
|
|
4808
5306
|
throw new TypeError(`Unsupported canonical JSON value: ${typeof value}`);
|
|
4809
5307
|
}
|
|
@@ -4832,7 +5330,7 @@ var isDockUiImportAllowed = (specifier) => {
|
|
|
4832
5330
|
if (specifier === "@bettercms-ai/dock-input") return true;
|
|
4833
5331
|
return specifier.startsWith("@bettercms-ai/kit/") && specifier.length > "@bettercms-ai/kit/".length;
|
|
4834
5332
|
};
|
|
4835
|
-
var dockUiMerkleKey = (
|
|
5333
|
+
var dockUiMerkleKey = (name2, version) => `cms:${name2}@${version}`;
|
|
4836
5334
|
|
|
4837
5335
|
// src/richtext-features.ts
|
|
4838
5336
|
var RICHTEXT_MARK_FEATURES = ["bold", "italic", "underline", "strikethrough", "code", "highlight"];
|
|
@@ -4870,13 +5368,13 @@ var RICHTEXT_FEATURE_ALIASES = {
|
|
|
4870
5368
|
headings: RICHTEXT_HEADING_FEATURES
|
|
4871
5369
|
};
|
|
4872
5370
|
var KNOWN = new Set(RICHTEXT_FEATURES);
|
|
4873
|
-
function normaliseRichTextFeatures(
|
|
5371
|
+
function normaliseRichTextFeatures(names2) {
|
|
4874
5372
|
const want = /* @__PURE__ */ new Set();
|
|
4875
5373
|
const unknown = [];
|
|
4876
|
-
for (const
|
|
4877
|
-
if (Object.hasOwn(RICHTEXT_FEATURE_ALIASES,
|
|
4878
|
-
else if (KNOWN.has(
|
|
4879
|
-
else if (!unknown.includes(
|
|
5374
|
+
for (const name2 of names2) {
|
|
5375
|
+
if (Object.hasOwn(RICHTEXT_FEATURE_ALIASES, name2)) for (const f of RICHTEXT_FEATURE_ALIASES[name2]) want.add(f);
|
|
5376
|
+
else if (KNOWN.has(name2)) want.add(name2);
|
|
5377
|
+
else if (!unknown.includes(name2)) unknown.push(name2);
|
|
4880
5378
|
}
|
|
4881
5379
|
return { features: RICHTEXT_FEATURES.filter((f) => want.has(f)), unknown };
|
|
4882
5380
|
}
|
|
@@ -4974,7 +5472,7 @@ function embedMarkerHtml(m) {
|
|
|
4974
5472
|
return `<div class="bcms-block" data-bcms-schema-key="component" data-bcms-embed="${esc2(m.ptKey)}" data-bcms-component="${esc2(m.componentId)}"` + (m.hidden ? " data-bcms-embed-hidden" : "") + (m.reason ? ` data-bcms-embed-reason="${m.reason}"` : "") + "></div>";
|
|
4975
5473
|
}
|
|
4976
5474
|
var MARKER_RE = /<div\b([^>]*\bdata-bcms-embed="[^"]*"[^>]*)>\s*<\/div>/g;
|
|
4977
|
-
var attr = (attrs,
|
|
5475
|
+
var attr = (attrs, name2) => attrs.match(new RegExp(`\\b${name2}="([^"]*)"`))?.[1];
|
|
4978
5476
|
function parseEmbedMarkers(html) {
|
|
4979
5477
|
const out = [];
|
|
4980
5478
|
for (const m of html.matchAll(MARKER_RE)) {
|
|
@@ -5013,7 +5511,7 @@ function variantOptionsFromUnion(typeText) {
|
|
|
5013
5511
|
function evaluateShowIf(showIf, values, sourceTypes) {
|
|
5014
5512
|
const rules = Array.isArray(showIf?.rules) ? showIf.rules : [];
|
|
5015
5513
|
if (!rules.length) return true;
|
|
5016
|
-
const
|
|
5514
|
+
const str2 = (v) => String(v ?? "");
|
|
5017
5515
|
const test = (r) => {
|
|
5018
5516
|
const type = sourceTypes?.get(r.field);
|
|
5019
5517
|
if (sourceTypes && type === void 0) return true;
|
|
@@ -5027,13 +5525,13 @@ function evaluateShowIf(showIf, values, sourceTypes) {
|
|
|
5027
5525
|
if (!Number.isFinite(n) || !Number.isFinite(bound)) return false;
|
|
5028
5526
|
return r.op === "gt" ? n > bound : n < bound;
|
|
5029
5527
|
}
|
|
5030
|
-
const s = type === "boolean" || type === "toggle" ? String(raw === true || raw === "true") :
|
|
5528
|
+
const s = type === "boolean" || type === "toggle" ? String(raw === true || raw === "true") : str2(raw);
|
|
5031
5529
|
if (r.op === "in" || r.op === "notIn") {
|
|
5032
|
-
const hit = (Array.isArray(r.value) ? r.value : [r.value]).map(
|
|
5530
|
+
const hit = (Array.isArray(r.value) ? r.value : [r.value]).map(str2).includes(s);
|
|
5033
5531
|
return r.op === "in" ? hit : !hit;
|
|
5034
5532
|
}
|
|
5035
|
-
if (r.op === "neq") return s !==
|
|
5036
|
-
return s ===
|
|
5533
|
+
if (r.op === "neq") return s !== str2(r.value);
|
|
5534
|
+
return s === str2(r.value);
|
|
5037
5535
|
};
|
|
5038
5536
|
return showIf.match === "any" ? rules.some(test) : rules.every(test);
|
|
5039
5537
|
}
|
|
@@ -5120,6 +5618,8 @@ function iconHtml(v, className = "") {
|
|
|
5120
5618
|
}
|
|
5121
5619
|
export {
|
|
5122
5620
|
BG_TOKENS,
|
|
5621
|
+
BG_TOKEN_CSS,
|
|
5622
|
+
BLOCKED_REASONS,
|
|
5123
5623
|
BLOCK_BINDINGS,
|
|
5124
5624
|
BLOCK_FIELD_TYPES,
|
|
5125
5625
|
BLOCK_FIELD_TYPES_RENDERABLE_NOW,
|
|
@@ -5132,6 +5632,8 @@ export {
|
|
|
5132
5632
|
BUTTON_LOOK_KEYS,
|
|
5133
5633
|
BUTTON_PLACEMENT_KEYS,
|
|
5134
5634
|
BUTTON_SIZES,
|
|
5635
|
+
BUTTON_TEXT_CSS,
|
|
5636
|
+
BUTTON_TEXT_KEYS,
|
|
5135
5637
|
BUTTON_VARIANTS,
|
|
5136
5638
|
CANVAS_GESTURE_NAMES,
|
|
5137
5639
|
CATEGORY_ID_MAX,
|
|
@@ -5156,6 +5658,7 @@ export {
|
|
|
5156
5658
|
EMBED_REASONS,
|
|
5157
5659
|
FIELD_SIZE_ZOOM,
|
|
5158
5660
|
FIELD_STYLE_KEYS,
|
|
5661
|
+
FONT_SIZE_TOKEN_PX,
|
|
5159
5662
|
FOOTER_SECTION_ID,
|
|
5160
5663
|
FORM_UPLOAD,
|
|
5161
5664
|
FORM_UPLOAD_DEFAULT_ACCEPT,
|
|
@@ -5176,14 +5679,20 @@ export {
|
|
|
5176
5679
|
KEY_RESERVED_PREFIX,
|
|
5177
5680
|
KIT_CATEGORIES,
|
|
5178
5681
|
LANDMARK_SELECTOR,
|
|
5682
|
+
LAYOUT_ROLES,
|
|
5179
5683
|
LAYOUT_SECTION_ICONS,
|
|
5180
5684
|
LAYOUT_SECTION_ICON_SET,
|
|
5181
5685
|
LINK_RELS,
|
|
5182
5686
|
LINK_VALUE_TYPES,
|
|
5183
5687
|
LIST_ITEMS_CAP,
|
|
5184
5688
|
LIST_PREVIEW_SLOTS,
|
|
5689
|
+
LOCAL_FRAMEWORKS,
|
|
5690
|
+
LOCAL_SETUP_LIMITS,
|
|
5691
|
+
LOCAL_SETUP_VERSION,
|
|
5185
5692
|
LOCATOR_PATH,
|
|
5186
5693
|
MAIN_SELECTOR,
|
|
5694
|
+
MAX_LOCAL_SETUP_BYTES,
|
|
5695
|
+
MAX_SITE_MAP_BYTES,
|
|
5187
5696
|
NAVIGATION_SECTION_ID,
|
|
5188
5697
|
OPEN_MODES,
|
|
5189
5698
|
OPEN_MODE_TYPES,
|
|
@@ -5204,13 +5713,18 @@ export {
|
|
|
5204
5713
|
RICHTEXT_TOGGLE_FEATURES,
|
|
5205
5714
|
ROLE_KEYS,
|
|
5206
5715
|
SCHEMA_HASH_INPUTS,
|
|
5716
|
+
SECTION_ANCHOR,
|
|
5717
|
+
SECTION_CSS_CLASS,
|
|
5207
5718
|
SECTION_DOCTRINE,
|
|
5719
|
+
SECTION_KINDS,
|
|
5208
5720
|
SECTION_SPACE_TOKENS,
|
|
5209
5721
|
SEGMENTED_MAX,
|
|
5210
5722
|
SEGMENTED_MIN,
|
|
5211
5723
|
SHOW_IF_SCOPES,
|
|
5212
5724
|
SIDE_SPACE_MIN_PX,
|
|
5213
5725
|
SIDE_SPACE_TOKENS,
|
|
5726
|
+
SITE_MAP_VERSION,
|
|
5727
|
+
SITE_MAP_VERSIONS,
|
|
5214
5728
|
SLOT_CHILD_KEYS,
|
|
5215
5729
|
SLOT_ITEMS_CAP,
|
|
5216
5730
|
SLOT_MAX_ITEMS,
|
|
@@ -5219,6 +5733,8 @@ export {
|
|
|
5219
5733
|
SOURCE_RANK,
|
|
5220
5734
|
SPACE_BOTTOM_TOKENS,
|
|
5221
5735
|
SPACE_STEP_TOKENS,
|
|
5736
|
+
STYLE_TOKEN_GROUPS,
|
|
5737
|
+
STYLE_USED_GROUPS,
|
|
5222
5738
|
TABLE_COLUMN_TYPES,
|
|
5223
5739
|
TABLE_CSS,
|
|
5224
5740
|
TABLE_JSONLD_TYPES,
|
|
@@ -5239,6 +5755,7 @@ export {
|
|
|
5239
5755
|
VIDEO_VALUE_KEYS,
|
|
5240
5756
|
WIDTH_FIT_FAIL_KINDS,
|
|
5241
5757
|
allowRuleOf,
|
|
5758
|
+
anchorSlug,
|
|
5242
5759
|
anchorTargetRel,
|
|
5243
5760
|
blockStyleToColumnCss,
|
|
5244
5761
|
blockStyleToCss,
|
|
@@ -5251,6 +5768,9 @@ export {
|
|
|
5251
5768
|
buttonLinkPairs,
|
|
5252
5769
|
buttonLookValue,
|
|
5253
5770
|
buttonSiteLookOf,
|
|
5771
|
+
buttonTextCss,
|
|
5772
|
+
buttonTextCssText,
|
|
5773
|
+
buttonTextProblem,
|
|
5254
5774
|
buttonValueOfInstance,
|
|
5255
5775
|
buttonValueProblem,
|
|
5256
5776
|
buttonVariantOf,
|
|
@@ -5259,6 +5779,7 @@ export {
|
|
|
5259
5779
|
compactIcon,
|
|
5260
5780
|
componentInstanceAddresses,
|
|
5261
5781
|
componentPropTargetKey,
|
|
5782
|
+
defaultSectionAnchors,
|
|
5262
5783
|
derivedPairs,
|
|
5263
5784
|
dockBudget,
|
|
5264
5785
|
dockScreens,
|
|
@@ -5322,8 +5843,10 @@ export {
|
|
|
5322
5843
|
normalizeTableValue,
|
|
5323
5844
|
normalizeWindow,
|
|
5324
5845
|
parseEmbedMarkers,
|
|
5846
|
+
parseLocalSetupManifest,
|
|
5325
5847
|
parseNumberText,
|
|
5326
5848
|
parsePropsAttribute,
|
|
5849
|
+
parseSiteMap,
|
|
5327
5850
|
pickFieldStyle,
|
|
5328
5851
|
placementBindOf,
|
|
5329
5852
|
planSections,
|
|
@@ -5338,6 +5861,7 @@ export {
|
|
|
5338
5861
|
rulePartnerOf,
|
|
5339
5862
|
safeCssUrl,
|
|
5340
5863
|
schemaHashInput,
|
|
5864
|
+
sectionIdentityAttrs,
|
|
5341
5865
|
sideFloorApplies,
|
|
5342
5866
|
sideSpaceCss,
|
|
5343
5867
|
slotBindOf,
|