@bettercms-ai/kit 2.0.10 → 3.0.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/README.md +1 -2
- package/dist/adapters/schema.js +45 -5
- package/dist/adapters/schema.js.map +1 -1
- package/dist/brand/logo.js.map +1 -1
- package/dist/context.d.ts +7 -0
- package/dist/context.js +6 -1
- package/dist/context.js.map +1 -1
- package/dist/controls/button.js +1 -1
- package/dist/controls/code.d.ts +24 -1
- package/dist/controls/code.js +36 -20
- package/dist/controls/code.js.map +1 -1
- package/dist/controls/icon.d.ts +28 -0
- package/dist/controls/icon.js +205 -61
- package/dist/controls/icon.js.map +1 -1
- package/dist/controls/index.d.ts +20 -2
- package/dist/controls/index.js +21 -20
- package/dist/controls/index.js.map +1 -1
- package/dist/controls/link.js +4 -4
- package/dist/controls/link.js.map +1 -1
- package/dist/controls/location.js +1 -1
- package/dist/controls/media.js +2 -2
- package/dist/controls/reference.js +3 -2
- package/dist/controls/reference.js.map +1 -1
- package/dist/controls/rich-text/blocks.js +2 -2
- package/dist/controls/rich-text/control.js +1 -1
- package/dist/controls/rich-text/editor.js +5 -5
- package/dist/controls/rich-text/embed.js +1 -1
- package/dist/controls/rich-text/toc.js +1 -1
- package/dist/controls/slot-register.js +1 -1
- package/dist/controls/table/table.js +1 -1
- package/dist/controls/text.js +5 -4
- package/dist/controls/text.js.map +1 -1
- package/dist/core/core.js +1 -1
- package/dist/engine/array.js +4 -8
- package/dist/engine/array.js.map +1 -1
- package/dist/engine/bits.js +1 -1
- package/dist/engine/breadcrumb.js +1 -1
- package/dist/engine/expand.js +1 -1
- package/dist/engine/field-shell.js +8 -7
- package/dist/engine/field-shell.js.map +1 -1
- package/dist/engine/frame.d.ts +1 -12
- package/dist/engine/frame.js +7 -149
- package/dist/engine/frame.js.map +1 -1
- package/dist/engine/group-summary.js +7 -4
- package/dist/engine/group-summary.js.map +1 -1
- package/dist/engine/grouping.js +2 -2
- package/dist/engine/item-list.js +2 -2
- package/dist/engine/kit-field.js +3 -7
- package/dist/engine/kit-field.js.map +1 -1
- package/dist/engine/schema-form.d.ts +10 -5
- package/dist/engine/schema-form.js +18 -10
- package/dist/engine/schema-form.js.map +1 -1
- package/dist/engine/slot.js +2 -2
- package/dist/index.d.ts +9 -9
- package/dist/index.js +32 -6
- package/dist/index.js.map +1 -1
- package/dist/kit.css +3 -11
- package/dist/lib/cn.js.map +1 -1
- package/dist/lib/frames.js +1 -1
- package/dist/lib/schema.d.ts +8 -1
- package/dist/lib/schema.js +18 -2
- package/dist/lib/schema.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -4
- package/dist/lib/utils.js +4 -14
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/validate.d.ts +14 -1
- package/dist/lib/validate.js +26 -10
- package/dist/lib/validate.js.map +1 -1
- package/dist/library/coreNotes.d.ts +1 -1
- package/dist/library/coreNotes.js.map +1 -1
- package/dist/library/entries/advanced.entries.js +2 -2
- package/dist/library/entries/advanced.entries.js.map +1 -1
- package/dist/library/entries/commerce.entries.js +1 -1
- package/dist/library/entries/commerce.entries.js.map +1 -1
- package/dist/library/entries/company.entries.js +1 -1
- package/dist/library/entries/company.entries.js.map +1 -1
- package/dist/library/entries/conversion.entries.js +8 -0
- package/dist/library/entries/conversion.entries.js.map +1 -1
- package/dist/library/entries/features.entries.js +7 -2
- package/dist/library/entries/features.entries.js.map +1 -1
- package/dist/library/entries/heroes.entries.js +1 -1
- package/dist/library/entries/heroes.entries.js.map +1 -1
- package/dist/library/entries/listings.entries.js +1 -1
- package/dist/library/entries/listings.entries.js.map +1 -1
- package/dist/library/entries/media.entries.js +5 -5
- package/dist/library/entries/media.entries.js.map +1 -1
- package/dist/library/entries/navigation.entries.js +4 -4
- package/dist/library/entries/navigation.entries.js.map +1 -1
- package/dist/library/examples/faq.js +1 -0
- package/dist/library/examples/faq.js.map +1 -1
- package/dist/library/examples/journalStory.js +1 -2
- package/dist/library/examples/journalStory.js.map +1 -1
- package/dist/library/kit-catalog.json +17 -17
- package/dist/schema/adapters.js +17 -3
- package/dist/schema/adapters.js.map +1 -1
- package/dist/schema/sources.d.ts +9 -1
- package/dist/schema/sources.js +1 -1
- package/dist/schema/sources.js.map +1 -1
- package/dist/schema/types.d.ts +31 -3
- package/dist/schema/types.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/table/table.css +1 -1
- package/dist/theme.css +18 -9
- package/dist/tokens.css +32 -60
- package/dist/ui/action-tray.d.ts +1 -3
- package/dist/ui/action-tray.js +3 -20
- package/dist/ui/action-tray.js.map +1 -1
- package/dist/ui/display.d.ts +1 -4
- package/dist/ui/display.js +4 -6
- package/dist/ui/display.js.map +1 -1
- package/dist/ui/index.js +3 -3
- package/dist/ui/overlay.d.ts +2 -5
- package/dist/ui/overlay.js +3 -4
- package/dist/ui/overlay.js.map +1 -1
- package/dist/ui/path-crumbs.d.ts +0 -2
- package/dist/ui/path-crumbs.js.map +1 -1
- package/dist/ui/surfaces.d.ts +2 -18
- package/dist/ui/surfaces.js +3 -19
- package/dist/ui/surfaces.js.map +1 -1
- package/dist/ui/toast.js +1 -1
- package/dist/ui/toast.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ npm i @bettercms-ai/kit @base-ui/react @tabler/icons-react framer-motion react r
|
|
|
22
22
|
```tsx
|
|
23
23
|
import { KitRoot, applyScheme } from "@bettercms-ai/kit/theme";
|
|
24
24
|
|
|
25
|
-
applyScheme("dark"); // .dark on <html>: portalled layers follow it
|
|
25
|
+
applyScheme(document.documentElement, "dark"); // .dark on <html>: portalled layers follow it
|
|
26
26
|
<KitRoot>{/* kit components */}</KitRoot>;
|
|
27
27
|
```
|
|
28
28
|
|
|
@@ -30,4 +30,3 @@ applyScheme("dark"); // .dark on <html>: portalled layers follow it
|
|
|
30
30
|
|
|
31
31
|
`@bettercms-ai/kit` re-exports the engine, the controls and the UI primitives. Every module is also importable by path, e.g. `@bettercms-ai/kit/ui/button`, `@bettercms-ai/kit/schema/scale`.
|
|
32
32
|
|
|
33
|
-
0.1.x (the previous component kit) is deprecated; its source is kept at git tag `kit/0.1.1-sanity`.
|
package/dist/adapters/schema.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CATALOG, FEATURES, isHostConfigKey } from "./lossy.js";
|
|
2
2
|
import { CONTROL_TYPES, FIELDSET_DESCRIPTION_MAX, FIELD_HELP_MAX, HELP_MORE_MAX, ITEM_NAME_RE, MAX_FIELD_DEPTH, OPTION_DESCRIPTION_MAX, PROP_GROUP_DESCRIPTION_MAX, PROP_HELP_MAX, PROP_PLACEHOLDER_MAX, PROP_TAB_MAX, TAB_MAX as TAB_MAX$1, UI_CONTROLS, UI_PLACEHOLDER_MAX } from "./prod-types.js";
|
|
3
3
|
import { dockIconOf, tablerIconOf } from "./icons.js";
|
|
4
|
+
import { refFilterText } from "../lib/schema.js";
|
|
4
5
|
import { slotChildrenFromStored, slotChildrenToStored } from "../controls/slot-services.js";
|
|
5
6
|
import { isDataTableProp, tableConfigFromOptions, tableOptionsFromConfig } from "../controls/table/prod.js";
|
|
6
7
|
import { buttonFromProd, buttonToProd, datetimeFromProd, datetimeToProd, imageFromProd, imageToProd, isCropRect, linkFromProd, linkToProd, listFromProd, listToProd, ratingFromProd, ratingToProd, referenceFromProd, referenceToProd, scaleFromProd, scaleToProd, typedRowsFromProd, typedRowsToProd, videoFromProd, videoToProd, zoneListFromProd, zoneListToProd } from "./values.js";
|
|
@@ -355,7 +356,8 @@ var COMMON_KEYS = /* @__PURE__ */ new Set([
|
|
|
355
356
|
"localized",
|
|
356
357
|
"ai",
|
|
357
358
|
"placeholder",
|
|
358
|
-
"archived"
|
|
359
|
+
"archived",
|
|
360
|
+
"protected"
|
|
359
361
|
]);
|
|
360
362
|
/** Types a slot setting may not be (backend slotSettingsHardening, and a model slot's SLOT_SETTINGS_NESTING: leaf fields only). */
|
|
361
363
|
var SETTING_NESTING_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -554,7 +556,30 @@ function richFeatures(v) {
|
|
|
554
556
|
named: !Array.isArray(v) || names.length !== v.length || new Set(names).size !== names.length || unknown.length > 0
|
|
555
557
|
};
|
|
556
558
|
}
|
|
557
|
-
|
|
559
|
+
/** V2 `uniqueBy: "sku"` is `unique` on the items' `sku`: production holds it there (on every item type that has the key). */
|
|
560
|
+
function foldUniqueBy(f) {
|
|
561
|
+
const by = f.validation?.uniqueBy;
|
|
562
|
+
const items = Array.isArray(f.of) ? f.of : [];
|
|
563
|
+
if (!by || !items.some((t) => t.fields?.some((x) => x.name === by))) return f;
|
|
564
|
+
const { uniqueBy: _u, ...validation } = f.validation;
|
|
565
|
+
const of = items.map((t) => ({
|
|
566
|
+
...t,
|
|
567
|
+
fields: t.fields?.map((x) => x.name === by ? {
|
|
568
|
+
...x,
|
|
569
|
+
validation: {
|
|
570
|
+
...x.validation,
|
|
571
|
+
unique: true
|
|
572
|
+
}
|
|
573
|
+
} : x)
|
|
574
|
+
}));
|
|
575
|
+
return {
|
|
576
|
+
...f,
|
|
577
|
+
validation,
|
|
578
|
+
of
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
function convertField(field, at, lv, ctx, siblings, top, inTable = false, inItem = false, inSetting = false) {
|
|
582
|
+
const f = foldUniqueBy(field);
|
|
558
583
|
const props = ctx.lane === "props";
|
|
559
584
|
const shape = shapeOf(f, lv, ctx, top, inTable ? "rows" : inItem ? "item" : inSetting ? "setting" : void 0);
|
|
560
585
|
const node = {
|
|
@@ -564,7 +589,7 @@ function convertField(f, at, lv, ctx, siblings, top, inTable = false, inItem = f
|
|
|
564
589
|
config: {},
|
|
565
590
|
ui: {}
|
|
566
591
|
};
|
|
567
|
-
const twins = siblings.slice(0, Math.max(0, siblings.indexOf(
|
|
592
|
+
const twins = siblings.slice(0, Math.max(0, siblings.indexOf(field))).filter((s) => s.name === f.name).length;
|
|
568
593
|
if (twins) {
|
|
569
594
|
node.key = `${f.name}_${twins + 1}`;
|
|
570
595
|
lose(ctx, `${at}/name`, "duplicate name");
|
|
@@ -682,6 +707,10 @@ function convertField(f, at, lv, ctx, siblings, top, inTable = false, inItem = f
|
|
|
682
707
|
case "archived":
|
|
683
708
|
if (f.archived) node.archived = true;
|
|
684
709
|
break;
|
|
710
|
+
case "protected":
|
|
711
|
+
if (f.protected && props) lose(ctx, p, "unsupported key");
|
|
712
|
+
else if (f.protected) node.protected = true;
|
|
713
|
+
break;
|
|
685
714
|
case "advanced":
|
|
686
715
|
node.advanced = f.advanced;
|
|
687
716
|
break;
|
|
@@ -739,6 +768,10 @@ function convertField(f, at, lv, ctx, siblings, top, inTable = false, inItem = f
|
|
|
739
768
|
if (shape.type === "image" && f.svgOnly === true) node.config.media = "icon";
|
|
740
769
|
else if (f.svgOnly !== false) lose(ctx, p, "unsupported key");
|
|
741
770
|
break;
|
|
771
|
+
case "icons":
|
|
772
|
+
if (shape.type === "icon") node.config.icons = f.icons;
|
|
773
|
+
else lose(ctx, p, "unsupported key");
|
|
774
|
+
break;
|
|
742
775
|
case "timezone":
|
|
743
776
|
if (shape.type === "date" || shape.type === "datetime") {
|
|
744
777
|
const tz = f.timezone;
|
|
@@ -1692,8 +1725,9 @@ function referenceToConfig(ref, node, at, ctx) {
|
|
|
1692
1725
|
});
|
|
1693
1726
|
if (targets.length) node.config.targets = targets;
|
|
1694
1727
|
if (ref.filter !== void 0) {
|
|
1695
|
-
|
|
1696
|
-
|
|
1728
|
+
const text = refFilterText(ref.filter);
|
|
1729
|
+
if (text !== void 0 && filterKept(text)) node.config.filter = text;
|
|
1730
|
+
if (node.config.filter === void 0 || typeof ref.filter === "object" && ref.filter.status) lose(ctx, `${at}/filter`, "reference filter");
|
|
1697
1731
|
}
|
|
1698
1732
|
for (const k of Object.keys(ref)) if (k !== "to" && k !== "filter") lose(ctx, `${at}/${k}`, "unsupported key");
|
|
1699
1733
|
}
|
|
@@ -1926,6 +1960,7 @@ function emitField(n) {
|
|
|
1926
1960
|
if (n.unique !== void 0) out.unique = n.unique;
|
|
1927
1961
|
if (n.readOnly !== void 0) out.readOnly = n.readOnly;
|
|
1928
1962
|
if (n.lockReason !== void 0) out.lockReason = n.lockReason;
|
|
1963
|
+
if (n.protected) out.protected = true;
|
|
1929
1964
|
if (n.fieldsetId !== void 0) out.fieldsetId = n.fieldsetId;
|
|
1930
1965
|
const config = { ...n.config };
|
|
1931
1966
|
if (n.placeholder !== void 0) config.placeholder = n.placeholder;
|
|
@@ -2618,6 +2653,7 @@ function readToV2(n, at, siblings, ctx, top, lane) {
|
|
|
2618
2653
|
if (n.openMode !== void 0) f.openMode = n.openMode;
|
|
2619
2654
|
if (n.readOnly === true) f.readOnly = true;
|
|
2620
2655
|
if (n.archived === true) f.archived = true;
|
|
2656
|
+
if (n.protected === true) f.protected = true;
|
|
2621
2657
|
if (n.ui.access) f.access = { ...n.ui.access };
|
|
2622
2658
|
else if (n.readOnly === "developer") f.access = { edit: "schema.manage" };
|
|
2623
2659
|
if (n.lockReason !== void 0) f.lockReason = n.lockReason;
|
|
@@ -2739,6 +2775,10 @@ function readToV2(n, at, siblings, ctx, top, lane) {
|
|
|
2739
2775
|
use("media");
|
|
2740
2776
|
if (cfg.media === "icon") f.svgOnly = true;
|
|
2741
2777
|
}
|
|
2778
|
+
if (n.type === "icon") {
|
|
2779
|
+
use("icons");
|
|
2780
|
+
if (isObj(cfg.icons)) f.icons = cfg.icons;
|
|
2781
|
+
}
|
|
2742
2782
|
if (typeof cfg.linkHref === "string" && cfg.linkHref) f.linkHref = cfg.linkHref;
|
|
2743
2783
|
use("linkHref");
|
|
2744
2784
|
if ((type === "select" || type === "multiselect" || type === "tags") && n.options) f.options = optionsFromProd(n.options);
|