@bettercms-ai/kit 3.1.29 → 3.2.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.
@@ -33,7 +33,11 @@ export declare function useFieldAccess(field: FieldSchema): {
33
33
  };
34
34
  /** CPO D39: the field's help line — schema text first, then a line computed from its settings, then the house convention. */
35
35
  export declare function withDefaultHelp(field: FieldSchema, isPublished?: boolean, readOnly?: boolean): FieldSchema;
36
- export declare function KitField({ field, path, parent }: KitFieldProps): import("react/jsx-runtime").JSX.Element | null;
36
+ /**
37
+ * One field. A held field (FieldSchema.held, or a reason from KitServices.heldReason) renders read-only with its reason
38
+ * and is never written; a control that throws while rendering holds that one field (FieldBoundary).
39
+ */
40
+ export declare function KitField(props: KitFieldProps): import("react/jsx-runtime").JSX.Element;
37
41
  /**
38
42
  * A row that opens something (V2 NavRow): type tile, title over a summary line, the field's chrome (from RowChrome),
39
43
  * the issue rollup and a chevron.
@@ -66,7 +70,9 @@ export declare function FallbackControl(props: ControlProps): import("react/jsx-
66
70
  * A control that cannot carry a stored value unchanged (rich text holding formatting its editor would drop) hands that
67
71
  * value to the host's control for the type (KitServices.LegacyControl: the dashboard's FieldRenderer arm), bare inside
68
72
  * the kit FieldShell, which owns the label and the help; the control names its reason above it. The box carries
69
- * `data-kit-legacy="<type>"`, so the parity harness counts it (mismatch class `legacy-control`). A host with no legacy
70
- * service, or a control that throws while rendering, says why in words; the form around it keeps working.
73
+ * `data-kit-legacy="<type>"`, so the parity harness counts it (mismatch class `legacy-control`). A control that throws
74
+ * while rendering says why in words; the form around it keeps working.
75
+ * Kit 3.2.0: a host with no LegacyControl gets a HELD field instead (held.tsx: the value read-only, with the reason, no
76
+ * `data-kit-legacy`). LegacyControl, this hand-off and `data-kit-legacy` are removed in 4.0.0.
71
77
  */
72
78
  export declare function LegacyFallback(props: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -17,6 +17,7 @@ import { ExpandAction, ExpandedField, expandKey, expandSpecFor, isExpandShortcut
17
17
  import { SchemaForm } from "./schema-form.js";
18
18
  import { SlotField } from "./slot.js";
19
19
  import { JsonControl } from "../controls/json.js";
20
+ import { FieldBoundary, HeldField, HeldValue } from "./held.js";
20
21
  import * as React from "react";
21
22
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
22
23
  import { IconChevronRight } from "@tabler/icons-react";
@@ -66,12 +67,36 @@ function withDefaultHelp(field, isPublished, readOnly) {
66
67
  description: help
67
68
  };
68
69
  }
69
- function KitField({ field, path, parent }) {
70
+ /**
71
+ * One field. A held field (FieldSchema.held, or a reason from KitServices.heldReason) renders read-only with its reason
72
+ * and is never written; a control that throws while rendering holds that one field (FieldBoundary).
73
+ */
74
+ function KitField(props) {
75
+ const form = useForm();
76
+ return /* @__PURE__ */ jsx(FieldBoundary, {
77
+ field: props.field,
78
+ path: props.path,
79
+ value: form?.getAt(props.path),
80
+ children: /* @__PURE__ */ jsx(KitFieldBody, { ...props })
81
+ });
82
+ }
83
+ function KitFieldBody({ field, path, parent }) {
70
84
  const form = useForm();
71
85
  const env = useKitEnv();
86
+ const services = useKitServices();
72
87
  const id = React.useId();
73
88
  const { readOnly } = useFieldAccess(field);
74
89
  if (!form) return null;
90
+ const heldReason = field.held?.reason || services.heldReason?.({
91
+ field,
92
+ path,
93
+ value: form.getAt(path)
94
+ });
95
+ if (heldReason) return /* @__PURE__ */ jsx(HeldField, {
96
+ field: withDefaultHelp(field, env.isPublished, true),
97
+ path,
98
+ reason: heldReason
99
+ });
75
100
  const Custom = env.controls?.[pathKey(path)];
76
101
  if (Custom) {
77
102
  const ck = pathKey(path);
@@ -489,28 +514,29 @@ function FallbackControl(props) {
489
514
  * A control that cannot carry a stored value unchanged (rich text holding formatting its editor would drop) hands that
490
515
  * value to the host's control for the type (KitServices.LegacyControl: the dashboard's FieldRenderer arm), bare inside
491
516
  * the kit FieldShell, which owns the label and the help; the control names its reason above it. The box carries
492
- * `data-kit-legacy="<type>"`, so the parity harness counts it (mismatch class `legacy-control`). A host with no legacy
493
- * service, or a control that throws while rendering, says why in words; the form around it keeps working.
517
+ * `data-kit-legacy="<type>"`, so the parity harness counts it (mismatch class `legacy-control`). A control that throws
518
+ * while rendering says why in words; the form around it keeps working.
519
+ * Kit 3.2.0: a host with no LegacyControl gets a HELD field instead (held.tsx: the value read-only, with the reason, no
520
+ * `data-kit-legacy`). LegacyControl, this hand-off and `data-kit-legacy` are removed in 4.0.0.
494
521
  */
495
522
  function LegacyFallback(props) {
496
523
  const { LegacyControl } = useKitServices();
497
524
  const { field, id } = props;
525
+ if (!LegacyControl) return /* @__PURE__ */ jsx(HeldValue, {
526
+ field,
527
+ value: props.value,
528
+ id,
529
+ reason: `this view has no control for ${field.type} fields`
530
+ });
498
531
  return /* @__PURE__ */ jsx("div", {
499
532
  "data-kit-legacy": field.type,
500
533
  className: "min-w-0",
501
- children: LegacyControl ? /* @__PURE__ */ jsx(LegacyBoundary, {
534
+ children: /* @__PURE__ */ jsx(LegacyBoundary, {
502
535
  field,
503
536
  id,
504
537
  value: props.value,
505
538
  children: /* @__PURE__ */ jsx(LegacyControl, { ...props })
506
- }, JSON.stringify(field)) : /* @__PURE__ */ jsxs(LegacyRefusal, {
507
- id,
508
- children: [
509
- "This view has no control for ",
510
- field.type,
511
- " fields."
512
- ]
513
- })
539
+ }, JSON.stringify(field))
514
540
  });
515
541
  }
516
542
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"kit-field.js","names":[],"sources":["../../src/engine/kit-field.tsx"],"sourcesContent":["/**\n * KitField — renders ONE field of the schema at `path` (must be inside <SchemaForm>): the shell + the control for its\n * type (V2 HEAD 9829bf1 kit/engine/kit-field.tsx).\n *\n * Arrays (array.tsx) and slots (slot.tsx) get their rows; objects open inline (FieldInset), drill (NavRow -> a frame),\n * popover or dialog (NestedForm: its own navigation stack). Primitive types dispatch through the CONTROLS table, which\n * the controls lanes fill. Every SchemaType has a control there; a type that is none of them (a schema newer than this\n * kit) edits its raw value in the JSON control (FallbackControl), never nothing and never a stand-in.\n */\nimport * as React from \"react\";\nimport type { ComponentType } from \"react\";\nimport { IconChevronRight } from \"@tabler/icons-react\";\nimport { KitIcon } from \"../lib/icons\";\nimport { cn } from \"../lib/cn\";\nimport type { FieldPath, FieldSchema, PrimitiveType, SchemaType } from \"../schema/types\";\nimport { resolveHelp } from \"../schema/help\";\nimport type { ControlProps } from \"../types\";\nimport { resolveFieldAccess, useForm, useKitEnv, useKitServices, type KitPeer } from \"../context\";\nimport { Button } from \"../ui/button\";\nimport { Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, Popover, PopoverContent, PopoverTrigger } from \"../ui/overlay\";\nimport { isObj, pathKey } from \"../lib/path\";\nimport { condCtx, isHidden, objectOpenMode, plainText, summarize } from \"../lib/schema\";\nimport { isIconImage } from \"../lib/icon-image\";\nimport { ArrayField, type NestedFormProps } from \"./array\";\nimport { ExpandAction, ExpandedField, expandKey, expandSpecFor, isExpandShortcut, openExpanded } from \"./expand\";\nimport { FieldShell } from \"./field-shell\";\nimport { FieldList } from \"./field-list\";\nimport { IssueDot, RowChrome } from \"./bits\";\nimport { FieldInset, FieldRun, groupSummary, useInsetDepth } from \"./grouping\";\nimport { SchemaForm } from \"./schema-form\";\nimport { SlotField } from \"./slot\";\nimport { JsonControl } from \"../controls/json\";\n\nexport interface KitFieldProps {\n field: FieldSchema;\n path: (string | number)[];\n parent?: Record<string, unknown>;\n}\n\n/** Type → control. Registered by the controls lane; a type with no entry edits its raw value (FallbackControl). */\nexport const CONTROLS: Partial<Record<SchemaType, ComponentType<ControlProps>>> = {};\n\n/**\n * Type → label-row action (DESIGN 4.4: slug Generate, rich text expand, table Edit in full screen), registered by the\n * controls lane next to its control. It gets the control's props. V2 draws it only while the field is editable, except\n * the types in ACTION_WHEN_READ_ONLY, whose action takes `readOnly` and decides for itself (slug Generate).\n */\nexport const ACTIONS: Partial<Record<SchemaType, ComponentType<ControlProps>>> = {};\nexport const ACTION_WHEN_READ_ONLY = new Set<SchemaType>([\"slug\"]);\n\n/** D58: the field for the lens: read-only (plain text) when it can't edit it. Hidden fields never reach here\n * (SchemaForm drops them from the schema). */\nexport function useFieldAccess(field: FieldSchema) {\n const env = useKitEnv();\n return { readOnly: resolveFieldAccess(field, env).readOnly };\n}\n\n/** CPO D39: the field's help line — schema text first, then a line computed from its settings, then the house convention. */\nexport function withDefaultHelp(field: FieldSchema, isPublished?: boolean, readOnly?: boolean): FieldSchema {\n let computed: string | undefined;\n /* a value set elsewhere says where, in one plain line (never a lock or a key) */\n if (readOnly && field.lockReason) return { ...field, description: field.lockReason.replace(/\\.?$/, \".\") };\n if (field.type === \"slug\" && !isPublished) computed = \"Follows the title until you change it or publish.\";\n else if (field.type === \"number\" && !field.scale && field.layout !== \"slider\" && field.numeric?.unit) {\n /* D63: the unit sits in the input (\"/ 5\", \"min\"), so a line that only restates it or its range is noise. A range\n still earns a line when the unit does not already say it (\"Between 1 and 12 items.\"). */\n const { min, max, unit } = field.numeric;\n const said = unit.startsWith(\"/\") || (max != null && unit.includes(String(max)));\n computed = said || (min == null && max == null) ? \"\" : min != null && max != null ? `Between ${min} and ${max} ${unit}.` : min != null ? `${min} ${unit} or more.` : `Up to ${max} ${unit}.`;\n } else if (field.type === \"number\" && !field.scale && field.layout !== \"slider\" && (field.numeric?.min != null || field.numeric?.max != null)) {\n const { min, max } = field.numeric ?? {};\n computed = min != null && max != null ? `Between ${min} and ${max}.` : min != null ? `${min} or more.` : `Up to ${max}.`;\n }\n /* resolve here so the computed line wins over the house convention; \"\" survives as \"deliberately none\" */\n const help = resolveHelp(field, computed) ?? \"\";\n return help === field.description ? field : { ...field, description: help };\n}\n\nexport function KitField({ field, path, parent }: KitFieldProps) {\n const form = useForm();\n const env = useKitEnv();\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n if (!form) return null;\n\n /* a host's own control for this field (KitEnv.controls), inside the usual shell */\n const Custom = env.controls?.[pathKey(path)];\n if (Custom) {\n const ck = pathKey(path);\n const cissue = form.visibleIssue(ck);\n const cf = withDefaultHelp(field, env.isPublished, readOnly);\n return (\n <FieldShell field={cf} path={path} id={id} value={form.getAt(path)} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={cissue}>\n <div onBlur={() => form.touch(ck)} className=\"min-w-0\">\n <Custom field={cf} value={form.getAt(path)} onChange={(v) => form.setAt(path, v)} id={id} invalid={cissue?.level === \"error\"} readOnly={readOnly} path={path} parent={parent} onBlur={() => form.touch(ck)} />\n </div>\n </FieldShell>\n );\n }\n\n if (field.type === \"array\") return <ArrayField field={field} path={path} parent={parent} />;\n if (field.type === \"slot\") return <SlotField field={field} path={path} />;\n if (field.type === \"object\") return <ObjectField field={field} path={path} />;\n\n const key = pathKey(path);\n const value = form.getAt(path);\n const onChange = (v: unknown) => form.setAt(path, v);\n const onBlur = () => form.touch(key);\n const issue = form.visibleIssue(key);\n const Control = CONTROLS[field.type] ?? FallbackControl;\n const Action = ACTIONS[field.type];\n const f = withDefaultHelp(field, env.isPublished, readOnly);\n const plain = readOnly && PLAIN_TYPES.has(field.type as PrimitiveType);\n const card = field.type === \"boolean\" && field.layout !== \"checkbox\";\n /* an icon's row carries its own name (controls/media.tsx IconImageRow): no label above it as well */\n const iconRow = isIconImage(field, value);\n /* D49: rich text, code and tables open the shared expanded editor (expand.tsx). A lane that registers its\n own ACTIONS[type] owns its expansion too (rich text's editor modal, the table's spreadsheet): the engine draws no\n second modal and binds no second ⌘↵ for it. */\n const expand = plain || Action ? null : expandSpecFor(field, { readOnly, hasKitControl: !!CONTROLS[field.type], variant: env.variant });\n const action =\n Action && (!readOnly || ACTION_WHEN_READ_ONLY.has(field.type)) ? (\n <Action field={f} value={value} onChange={onChange} id={id} readOnly={readOnly} path={path} parent={parent} />\n ) : expand ? (\n <ExpandAction field={f} path={path} spec={expand} />\n ) : undefined;\n return (\n <FieldShell field={f} path={path} id={id} value={value} onChange={onChange} readOnly={readOnly} issue={issue} layout={card ? \"card\" : iconRow ? \"row\" : \"stack\"} action={action}>\n {plain ? (\n card ? null /* the switch card already reads On / Off */ : <PlainValue field={f} value={value} id={id} />\n ) : (\n <div\n onBlur={onBlur}\n onKeyDown={\n expand\n ? (e) => {\n if (!isExpandShortcut(e)) return;\n e.preventDefault();\n openExpanded(expandKey(env.docId, path));\n }\n : undefined\n }\n className=\"min-w-0\"\n >\n <Control field={f} value={value} onChange={onChange} id={id} invalid={issue?.level === \"error\"} readOnly={readOnly} path={path} parent={parent} onBlur={onBlur} />\n </div>\n )}\n {expand ? (\n <ExpandedField field={f} path={path} spec={expand} Control={Control} value={value} onChange={onChange} onBlur={onBlur} invalid={issue?.level === \"error\"} id={id} parent={parent} />\n ) : null}\n </FieldShell>\n );\n}\n\n/**\n * A row that opens something (V2 NavRow): type tile, title over a summary line, the field's chrome (from RowChrome),\n * the issue rollup and a chevron.\n * Like V2 it always draws its button and chevron, also with no `onClick` (a popover trigger around it opens on the\n * click). Only `inert` (the form draws no frames, so nothing can open) leaves both out.\n */\nexport function NavRow({\n icon,\n title,\n subtitle,\n path,\n onClick,\n inert,\n className,\n trailing,\n}: {\n icon?: string;\n title: string;\n subtitle?: string;\n path?: FieldPath;\n onClick?: () => void;\n inert?: boolean;\n className?: string;\n trailing?: React.ReactNode;\n}) {\n const form = useForm();\n const roll = path && form ? form.rollup(path) : { errors: 0, warnings: 0 };\n const subId = React.useId();\n const chrome = React.useContext(RowChrome);\n const text = (\n <>\n <span className=\"block truncate text-kit-sm text-kit-fg\">{title}</span>\n <span id={subId} className=\"block truncate text-kit-xs text-kit-fg-3\">\n {subtitle || \"Nothing set yet\"}\n </span>\n </>\n );\n return (\n <div\n className={cn(\n \"group/nav relative flex min-h-11 w-full min-w-0 items-center gap-2.5 rounded-kit-lg border border-kit-line-strong bg-kit-control-bg py-1.5 pl-2 pr-2 text-left transition-colors hover:border-[var(--kit-emphasis-line)] hover:bg-kit-subtle\",\n className,\n )}\n >\n <span className=\"flex size-7 shrink-0 items-center justify-center rounded-kit-md bg-kit-muted text-kit-fg-2\">\n <KitIcon name={icon} fallback=\"folder\" className=\"size-4\" />\n </span>\n {!inert ? (\n <button\n type=\"button\"\n data-nav-main\n onClick={onClick}\n aria-label={`Open ${title}${roll.errors ? `, ${roll.errors} ${roll.errors === 1 ? \"issue\" : \"issues\"}` : \"\"}`}\n aria-describedby={subId}\n className=\"min-w-0 flex-1 text-left outline-none after:absolute after:inset-0 after:rounded-kit-lg after:content-[''] focus-visible:after:outline-2 focus-visible:after:outline-offset-2 focus-visible:after:outline-kit-focus-ring focus-visible:after:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:after:outline-none\"\n >\n {text}\n </button>\n ) : (\n <div data-nav-main className=\"min-w-0 flex-1 text-left\">\n {text}\n </div>\n )}\n <IssueDot errors={roll.errors} warnings={roll.warnings} className=\"relative\" />\n {chrome ? <span className=\"relative z-[1] flex shrink-0 items-center gap-0.5 empty:hidden\">{chrome}</span> : null}\n {trailing}\n {!inert ? <IconChevronRight aria-hidden className=\"pointer-events-none size-4 shrink-0 text-kit-fg-3 transition-transform group-hover/nav:translate-x-0.5\" stroke={1.5} /> : null}\n </div>\n );\n}\n\n/* ── Object: inline · drill · popover · dialog (V2 ObjectField) ───── */\n\nfunction ObjectField({ field, path }: { field: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n const depth = useInsetDepth();\n const value = form.getAt(path);\n const obj = isObj(value) ? value : {};\n const fields = field.fields ?? [];\n /* D45 nesting rule: one container per level. Inside an inset (or an expanded row) an \"inline\" object would be a box in a\n box, so it drills instead — level 3+ is always a new frame, never more indentation. */\n const wanted = objectOpenMode(field);\n const mode = wanted === \"inline\" && depth > 0 ? \"drill\" : wanted;\n const [open, setOpen] = React.useState(false);\n const sum = groupSummary(fields, obj) || summarize(fields, obj);\n const nav = React.useRef<{ back: () => boolean }>(null);\n const shell = (control: React.ReactNode, layout?: \"row\") => (\n <FieldShell field={field} path={path} id={id} value={value} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={form.visibleIssue(pathKey(path))} layout={layout}>\n {control}\n </FieldShell>\n );\n if (mode === \"inline\") {\n const cc = condCtx(form, path);\n const visible = fields.filter((f) => !isHidden(f, obj, cc));\n /* D63: label, then the children behind one inset line; short neighbours pair up only on a wide form */\n return shell(\n <FieldInset label={field.title}>\n <FieldRun fields={visible} values={obj} render={(f) => <KitField field={f} path={[...path, f.name]} parent={obj} />} />\n </FieldInset>,\n );\n }\n const help = resolveHelp(field) ?? \"\";\n if (mode === \"popover\")\n /* V2: Radix <PopoverTrigger asChild><div> — the whole row is the trigger (aria-expanded, aria-haspopup=\"dialog\");\n NavRow gets no onClick but still draws its button (\"Open <title>\") and chevron, whose click opens the popover. */\n return shell(\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger nativeButton={false} render={<div />}>\n <NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} />\n </PopoverTrigger>\n <PopoverContent className=\"w-[340px] p-3\" align=\"start\">\n <FieldList fields={fields} basePath={path} memoryKey={`pop:${pathKey(path)}`} />\n </PopoverContent>\n </Popover>,\n \"row\",\n );\n if (mode === \"dialog\")\n return shell(\n <>\n <NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} onClick={() => setOpen(true)} />\n <Modal\n open={open}\n onOpenChange={(o, d) => {\n // Escape steps back inside the dialog's own frames first (V2: onEscapeKeyDown + nav.back())\n if (!o && d.reason === \"escape-key\" && nav.current?.back()) return d.cancel();\n setOpen(o);\n }}\n >\n <ModalContent size=\"lg\">\n <ModalHeader title={field.title} description={field.description} />\n <ModalBody className=\"flex min-h-[320px] flex-col gap-5\">\n <NestedForm fields={fields} title={field.title} icon={field.icon} path={path} navRef={nav} />\n </ModalBody>\n <ModalFooter>\n <span className=\"mr-auto text-kit-xs text-kit-fg-3\">Changes save as you type</span>\n <Button variant=\"primary\" onClick={() => setOpen(false)}>\n Done\n </Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n </>,\n \"row\",\n );\n return shell(<NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} onClick={() => form.navigate(path)} inert={!form.canNavigate} />, \"row\");\n}\n\n/**\n * A dialog gets its OWN navigation stack: lists inside it drill inside the dialog (breadcrumb, Esc, stepper), never the\n * panel behind. Writes go straight into the parent form at `path`.\n */\nexport function NestedForm({ fields, title, icon, path, navRef }: NestedFormProps) {\n const form = useForm()!;\n const env = useKitEnv();\n const key = pathKey(path);\n const schema = React.useMemo(() => ({ name: key || \"nested\", title, icon, kind: \"object\" as const, fields }), [key, title, icon, fields]);\n const raw = form.getAt(path);\n const pub = form.hasPublished ? form.publishedAt(path) : undefined;\n const presence = React.useMemo(() => {\n const out: Record<string, KitPeer[]> = {};\n for (const [k, v] of Object.entries(env.presence)) if (k.startsWith(`${key}.`)) out[k.slice(key.length + 1)] = v;\n return out;\n }, [env.presence, key]);\n return (\n <SchemaForm\n schema={schema}\n value={isObj(raw) ? raw : {}}\n onChange={(v) => form.setAt(path, v)}\n variant=\"document\"\n scroll={false}\n navRef={navRef}\n resolveSchema={form.resolveSchema}\n blockLibrary={form.blockLibrary}\n published={isObj(pub) ? pub : undefined}\n presence={presence}\n readOnly={env.readOnly}\n showErrors={form.showAllErrors}\n onOpenReference={env.onOpenReference}\n env={{ docId: `${env.docId}:${key}`, docTitle: env.docTitle, urlPrefix: env.urlPrefix, isPublished: env.isPublished, palette: env.palette, helpDisplay: env.helpDisplay }}\n />\n );\n}\n\n/* ── Read-only as plain text (D58 §0): no greyed input, just the value ── */\nconst PLAIN_TYPES = new Set<PrimitiveType>([\"string\", \"text\", \"richtext\", \"number\", \"slug\", \"url\", \"email\", \"date\", \"datetime\", \"select\", \"multiselect\", \"tags\", \"boolean\", \"rating\"]);\nexport function plainOf(field: FieldSchema, value: unknown): string {\n if (value == null || value === \"\") return \"\";\n const label = (v: unknown) => field.options?.find((o) => o.value === v)?.label ?? String(v);\n if (field.type === \"boolean\") return value ? \"On\" : \"Off\";\n if (field.type === \"select\") return label(value);\n // before the list arm: stored rich text may be a Portable Text block array\n if (field.type === \"richtext\") return plainText(value);\n if (Array.isArray(value)) return value.map(label).join(\", \");\n if (field.type === \"date\" || field.type === \"datetime\") {\n const d = new Date(String(value).replace(/\\[.*\\]$/, \"\"));\n return Number.isNaN(+d) ? String(value) : d.toLocaleString(\"en-US\", field.type === \"date\" ? { month: \"short\", day: \"numeric\", year: \"numeric\" } : { month: \"short\", day: \"numeric\", year: \"numeric\", hour: \"numeric\", minute: \"2-digit\" });\n }\n if (field.type === \"number\" && isObj(value)) return String((value as { value?: unknown }).value ?? \"\");\n return typeof value === \"object\" ? \"\" : String(value);\n}\nfunction PlainValue({ field, value, id }: { field: FieldSchema; value: unknown; id: string }) {\n const text = plainOf(field, value);\n return (\n // NEW-Q48-PLAINLABEL: a <p> is not labelable, so label[for] named nothing; the group is named \"<field> <value>\"\n <p id={id} tabIndex={0} role=\"group\" aria-labelledby={`${id}-label ${id}`} data-slot=\"kit-plain\" className={cn(\"min-w-0 whitespace-pre-wrap break-words text-kit-sm leading-6 text-kit-fg outline-none\", (field.type === \"slug\" || field.type === \"url\") && \"font-kit-mono text-kit-xs leading-6\")}>\n {text || <span className=\"text-kit-fg-3\">Empty</span>}\n </p>\n );\n}\n\n/* ── Unknown type: the raw value, in the JSON control ── */\n/**\n * Every SchemaType has a kit control (kit-field.test checks CONTROLS against the type list in schema/types.ts). A field\n * whose type is none of them edits its raw stored value in the JSON control, tagged `data-kit-fallback=\"<type>\"`: the\n * value is shown and kept, and an edit is written only once it parses.\n */\nexport function FallbackControl(props: ControlProps) {\n return (\n <div data-kit-fallback={props.field.type} className=\"min-w-0\">\n <JsonControl {...props} />\n </div>\n );\n}\n\n/* ── Hand-off: the host's own control for a value the kit refuses ── */\n/**\n * A control that cannot carry a stored value unchanged (rich text holding formatting its editor would drop) hands that\n * value to the host's control for the type (KitServices.LegacyControl: the dashboard's FieldRenderer arm), bare inside\n * the kit FieldShell, which owns the label and the help; the control names its reason above it. The box carries\n * `data-kit-legacy=\"<type>\"`, so the parity harness counts it (mismatch class `legacy-control`). A host with no legacy\n * service, or a control that throws while rendering, says why in words; the form around it keeps working.\n */\nexport function LegacyFallback(props: ControlProps) {\n const { LegacyControl } = useKitServices();\n const { field, id } = props;\n return (\n <div data-kit-legacy={field.type} className=\"min-w-0\">\n {LegacyControl ? (\n // keyed by the schema's content: a schema edit remounts the control (KitField hands over a fresh field object on\n // every render, so identity would remount on every keystroke). A value change retries in place (componentDidUpdate).\n <LegacyBoundary key={JSON.stringify(field)} field={field} id={id} value={props.value}>\n <LegacyControl {...props} />\n </LegacyBoundary>\n ) : (\n <LegacyRefusal id={id}>This view has no control for {field.type} fields.</LegacyRefusal>\n )}\n </div>\n );\n}\n\n/**\n * An `<output>`: a labelable element, so the FieldShell label's `for` lands on it, and focusable, so a keyboard user\n * reaches the reason. The neutral focus ring shows under keyboard modality only.\n */\nfunction LegacyRefusal({ id, children }: { id: string; children: React.ReactNode }) {\n return (\n <output\n id={id}\n role=\"note\"\n tabIndex={0}\n data-slot=\"kit-legacy-refusal\"\n className=\"block rounded-kit-sm text-kit-xs text-kit-fg-3 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-kit-focus-ring focus-visible:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:outline-0\"\n >\n {children}\n </output>\n );\n}\n\n/** Retries the control once its field or value changes (a schema edit, a save from elsewhere, an undo). */\nclass LegacyBoundary extends React.Component<{ field: FieldSchema; id: string; value: unknown; children: React.ReactNode }, { reason: string | null }> {\n state = { reason: null as string | null };\n static getDerivedStateFromError(error: unknown) {\n return { reason: error instanceof Error ? error.message : String(error) };\n }\n componentDidUpdate(prev: { field: FieldSchema; value: unknown }) {\n if (this.state.reason === null) return;\n // by content: KitField hands over a fresh field object (withDefaultHelp) on every render\n if (prev.value !== this.props.value || JSON.stringify(prev.field) !== JSON.stringify(this.props.field)) this.setState({ reason: null });\n }\n render() {\n if (this.state.reason === null) return this.props.children;\n return (\n <LegacyRefus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KAAK,CAAC;CACxI;CACA,SAAS;EACP,IAAI,KAAK,MAAM,WAAW,MAAM,OAAO,KAAK,MAAM;EAClD,OACE,qBAAC,eAAD;GAAe,IAAI,KAAK,MAAM;GAA9B,UAAA;IAAkC;IAC3B,KAAK,MAAM,MAAM;IAAM;IAA0B,KAAK,MAAM;GACpD;;CAEnB;AACF"}
1
+ {"version":3,"file":"kit-field.js","names":[],"sources":["../../src/engine/kit-field.tsx"],"sourcesContent":["/**\n * KitField — renders ONE field of the schema at `path` (must be inside <SchemaForm>): the shell + the control for its\n * type (V2 HEAD 9829bf1 kit/engine/kit-field.tsx).\n *\n * Arrays (array.tsx) and slots (slot.tsx) get their rows; objects open inline (FieldInset), drill (NavRow -> a frame),\n * popover or dialog (NestedForm: its own navigation stack). Primitive types dispatch through the CONTROLS table, which\n * the controls lanes fill. Every SchemaType has a control there; a type that is none of them (a schema newer than this\n * kit) edits its raw value in the JSON control (FallbackControl), never nothing and never a stand-in.\n */\nimport * as React from \"react\";\nimport type { ComponentType } from \"react\";\nimport { IconChevronRight } from \"@tabler/icons-react\";\nimport { KitIcon } from \"../lib/icons\";\nimport { cn } from \"../lib/cn\";\nimport type { FieldPath, FieldSchema, PrimitiveType, SchemaType } from \"../schema/types\";\nimport { resolveHelp } from \"../schema/help\";\nimport type { ControlProps } from \"../types\";\nimport { resolveFieldAccess, useForm, useKitEnv, useKitServices, type KitPeer } from \"../context\";\nimport { Button } from \"../ui/button\";\nimport { Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, Popover, PopoverContent, PopoverTrigger } from \"../ui/overlay\";\nimport { isObj, pathKey } from \"../lib/path\";\nimport { condCtx, isHidden, objectOpenMode, plainText, summarize } from \"../lib/schema\";\nimport { isIconImage } from \"../lib/icon-image\";\nimport { ArrayField, type NestedFormProps } from \"./array\";\nimport { ExpandAction, ExpandedField, expandKey, expandSpecFor, isExpandShortcut, openExpanded } from \"./expand\";\nimport { FieldShell } from \"./field-shell\";\nimport { FieldList } from \"./field-list\";\nimport { IssueDot, RowChrome } from \"./bits\";\nimport { FieldInset, FieldRun, groupSummary, useInsetDepth } from \"./grouping\";\nimport { SchemaForm } from \"./schema-form\";\nimport { SlotField } from \"./slot\";\nimport { JsonControl } from \"../controls/json\";\nimport { FieldBoundary, HeldField, HeldValue } from \"./held\";\n\nexport interface KitFieldProps {\n field: FieldSchema;\n path: (string | number)[];\n parent?: Record<string, unknown>;\n}\n\n/** Type → control. Registered by the controls lane; a type with no entry edits its raw value (FallbackControl). */\nexport const CONTROLS: Partial<Record<SchemaType, ComponentType<ControlProps>>> = {};\n\n/**\n * Type → label-row action (DESIGN 4.4: slug Generate, rich text expand, table Edit in full screen), registered by the\n * controls lane next to its control. It gets the control's props. V2 draws it only while the field is editable, except\n * the types in ACTION_WHEN_READ_ONLY, whose action takes `readOnly` and decides for itself (slug Generate).\n */\nexport const ACTIONS: Partial<Record<SchemaType, ComponentType<ControlProps>>> = {};\nexport const ACTION_WHEN_READ_ONLY = new Set<SchemaType>([\"slug\"]);\n\n/** D58: the field for the lens: read-only (plain text) when it can't edit it. Hidden fields never reach here\n * (SchemaForm drops them from the schema). */\nexport function useFieldAccess(field: FieldSchema) {\n const env = useKitEnv();\n return { readOnly: resolveFieldAccess(field, env).readOnly };\n}\n\n/** CPO D39: the field's help line — schema text first, then a line computed from its settings, then the house convention. */\nexport function withDefaultHelp(field: FieldSchema, isPublished?: boolean, readOnly?: boolean): FieldSchema {\n let computed: string | undefined;\n /* a value set elsewhere says where, in one plain line (never a lock or a key) */\n if (readOnly && field.lockReason) return { ...field, description: field.lockReason.replace(/\\.?$/, \".\") };\n if (field.type === \"slug\" && !isPublished) computed = \"Follows the title until you change it or publish.\";\n else if (field.type === \"number\" && !field.scale && field.layout !== \"slider\" && field.numeric?.unit) {\n /* D63: the unit sits in the input (\"/ 5\", \"min\"), so a line that only restates it or its range is noise. A range\n still earns a line when the unit does not already say it (\"Between 1 and 12 items.\"). */\n const { min, max, unit } = field.numeric;\n const said = unit.startsWith(\"/\") || (max != null && unit.includes(String(max)));\n computed = said || (min == null && max == null) ? \"\" : min != null && max != null ? `Between ${min} and ${max} ${unit}.` : min != null ? `${min} ${unit} or more.` : `Up to ${max} ${unit}.`;\n } else if (field.type === \"number\" && !field.scale && field.layout !== \"slider\" && (field.numeric?.min != null || field.numeric?.max != null)) {\n const { min, max } = field.numeric ?? {};\n computed = min != null && max != null ? `Between ${min} and ${max}.` : min != null ? `${min} or more.` : `Up to ${max}.`;\n }\n /* resolve here so the computed line wins over the house convention; \"\" survives as \"deliberately none\" */\n const help = resolveHelp(field, computed) ?? \"\";\n return help === field.description ? field : { ...field, description: help };\n}\n\n/**\n * One field. A held field (FieldSchema.held, or a reason from KitServices.heldReason) renders read-only with its reason\n * and is never written; a control that throws while rendering holds that one field (FieldBoundary).\n */\nexport function KitField(props: KitFieldProps) {\n const form = useForm();\n return (\n <FieldBoundary field={props.field} path={props.path} value={form?.getAt(props.path)}>\n <KitFieldBody {...props} />\n </FieldBoundary>\n );\n}\n\nfunction KitFieldBody({ field, path, parent }: KitFieldProps) {\n const form = useForm();\n const env = useKitEnv();\n const services = useKitServices();\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n if (!form) return null;\n\n const heldReason = field.held?.reason || services.heldReason?.({ field, path, value: form.getAt(path) });\n if (heldReason) return <HeldField field={withDefaultHelp(field, env.isPublished, true)} path={path} reason={heldReason} />;\n\n /* a host's own control for this field (KitEnv.controls), inside the usual shell */\n const Custom = env.controls?.[pathKey(path)];\n if (Custom) {\n const ck = pathKey(path);\n const cissue = form.visibleIssue(ck);\n const cf = withDefaultHelp(field, env.isPublished, readOnly);\n return (\n <FieldShell field={cf} path={path} id={id} value={form.getAt(path)} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={cissue}>\n <div onBlur={() => form.touch(ck)} className=\"min-w-0\">\n <Custom field={cf} value={form.getAt(path)} onChange={(v) => form.setAt(path, v)} id={id} invalid={cissue?.level === \"error\"} readOnly={readOnly} path={path} parent={parent} onBlur={() => form.touch(ck)} />\n </div>\n </FieldShell>\n );\n }\n\n if (field.type === \"array\") return <ArrayField field={field} path={path} parent={parent} />;\n if (field.type === \"slot\") return <SlotField field={field} path={path} />;\n if (field.type === \"object\") return <ObjectField field={field} path={path} />;\n\n const key = pathKey(path);\n const value = form.getAt(path);\n const onChange = (v: unknown) => form.setAt(path, v);\n const onBlur = () => form.touch(key);\n const issue = form.visibleIssue(key);\n const Control = CONTROLS[field.type] ?? FallbackControl;\n const Action = ACTIONS[field.type];\n const f = withDefaultHelp(field, env.isPublished, readOnly);\n const plain = readOnly && PLAIN_TYPES.has(field.type as PrimitiveType);\n const card = field.type === \"boolean\" && field.layout !== \"checkbox\";\n /* an icon's row carries its own name (controls/media.tsx IconImageRow): no label above it as well */\n const iconRow = isIconImage(field, value);\n /* D49: rich text, code and tables open the shared expanded editor (expand.tsx). A lane that registers its\n own ACTIONS[type] owns its expansion too (rich text's editor modal, the table's spreadsheet): the engine draws no\n second modal and binds no second ⌘↵ for it. */\n const expand = plain || Action ? null : expandSpecFor(field, { readOnly, hasKitControl: !!CONTROLS[field.type], variant: env.variant });\n const action =\n Action && (!readOnly || ACTION_WHEN_READ_ONLY.has(field.type)) ? (\n <Action field={f} value={value} onChange={onChange} id={id} readOnly={readOnly} path={path} parent={parent} />\n ) : expand ? (\n <ExpandAction field={f} path={path} spec={expand} />\n ) : undefined;\n return (\n <FieldShell field={f} path={path} id={id} value={value} onChange={onChange} readOnly={readOnly} issue={issue} layout={card ? \"card\" : iconRow ? \"row\" : \"stack\"} action={action}>\n {plain ? (\n card ? null /* the switch card already reads On / Off */ : <PlainValue field={f} value={value} id={id} />\n ) : (\n <div\n onBlur={onBlur}\n onKeyDown={\n expand\n ? (e) => {\n if (!isExpandShortcut(e)) return;\n e.preventDefault();\n openExpanded(expandKey(env.docId, path));\n }\n : undefined\n }\n className=\"min-w-0\"\n >\n <Control field={f} value={value} onChange={onChange} id={id} invalid={issue?.level === \"error\"} readOnly={readOnly} path={path} parent={parent} onBlur={onBlur} />\n </div>\n )}\n {expand ? (\n <ExpandedField field={f} path={path} spec={expand} Control={Control} value={value} onChange={onChange} onBlur={onBlur} invalid={issue?.level === \"error\"} id={id} parent={parent} />\n ) : null}\n </FieldShell>\n );\n}\n\n/**\n * A row that opens something (V2 NavRow): type tile, title over a summary line, the field's chrome (from RowChrome),\n * the issue rollup and a chevron.\n * Like V2 it always draws its button and chevron, also with no `onClick` (a popover trigger around it opens on the\n * click). Only `inert` (the form draws no frames, so nothing can open) leaves both out.\n */\nexport function NavRow({\n icon,\n title,\n subtitle,\n path,\n onClick,\n inert,\n className,\n trailing,\n}: {\n icon?: string;\n title: string;\n subtitle?: string;\n path?: FieldPath;\n onClick?: () => void;\n inert?: boolean;\n className?: string;\n trailing?: React.ReactNode;\n}) {\n const form = useForm();\n const roll = path && form ? form.rollup(path) : { errors: 0, warnings: 0 };\n const subId = React.useId();\n const chrome = React.useContext(RowChrome);\n const text = (\n <>\n <span className=\"block truncate text-kit-sm text-kit-fg\">{title}</span>\n <span id={subId} className=\"block truncate text-kit-xs text-kit-fg-3\">\n {subtitle || \"Nothing set yet\"}\n </span>\n </>\n );\n return (\n <div\n className={cn(\n \"group/nav relative flex min-h-11 w-full min-w-0 items-center gap-2.5 rounded-kit-lg border border-kit-line-strong bg-kit-control-bg py-1.5 pl-2 pr-2 text-left transition-colors hover:border-[var(--kit-emphasis-line)] hover:bg-kit-subtle\",\n className,\n )}\n >\n <span className=\"flex size-7 shrink-0 items-center justify-center rounded-kit-md bg-kit-muted text-kit-fg-2\">\n <KitIcon name={icon} fallback=\"folder\" className=\"size-4\" />\n </span>\n {!inert ? (\n <button\n type=\"button\"\n data-nav-main\n onClick={onClick}\n aria-label={`Open ${title}${roll.errors ? `, ${roll.errors} ${roll.errors === 1 ? \"issue\" : \"issues\"}` : \"\"}`}\n aria-describedby={subId}\n className=\"min-w-0 flex-1 text-left outline-none after:absolute after:inset-0 after:rounded-kit-lg after:content-[''] focus-visible:after:outline-2 focus-visible:after:outline-offset-2 focus-visible:after:outline-kit-focus-ring focus-visible:after:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:after:outline-none\"\n >\n {text}\n </button>\n ) : (\n <div data-nav-main className=\"min-w-0 flex-1 text-left\">\n {text}\n </div>\n )}\n <IssueDot errors={roll.errors} warnings={roll.warnings} className=\"relative\" />\n {chrome ? <span className=\"relative z-[1] flex shrink-0 items-center gap-0.5 empty:hidden\">{chrome}</span> : null}\n {trailing}\n {!inert ? <IconChevronRight aria-hidden className=\"pointer-events-none size-4 shrink-0 text-kit-fg-3 transition-transform group-hover/nav:translate-x-0.5\" stroke={1.5} /> : null}\n </div>\n );\n}\n\n/* ── Object: inline · drill · popover · dialog (V2 ObjectField) ───── */\n\nfunction ObjectField({ field, path }: { field: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n const depth = useInsetDepth();\n const value = form.getAt(path);\n const obj = isObj(value) ? value : {};\n const fields = field.fields ?? [];\n /* D45 nesting rule: one container per level. Inside an inset (or an expanded row) an \"inline\" object would be a box in a\n box, so it drills instead — level 3+ is always a new frame, never more indentation. */\n const wanted = objectOpenMode(field);\n const mode = wanted === \"inline\" && depth > 0 ? \"drill\" : wanted;\n const [open, setOpen] = React.useState(false);\n const sum = groupSummary(fields, obj) || summarize(fields, obj);\n const nav = React.useRef<{ back: () => boolean }>(null);\n const shell = (control: React.ReactNode, layout?: \"row\") => (\n <FieldShell field={field} path={path} id={id} value={value} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={form.visibleIssue(pathKey(path))} layout={layout}>\n {control}\n </FieldShell>\n );\n if (mode === \"inline\") {\n const cc = condCtx(form, path);\n const visible = fields.filter((f) => !isHidden(f, obj, cc));\n /* D63: label, then the children behind one inset line; short neighbours pair up only on a wide form */\n return shell(\n <FieldInset label={field.title}>\n <FieldRun fields={visible} values={obj} render={(f) => <KitField field={f} path={[...path, f.name]} parent={obj} />} />\n </FieldInset>,\n );\n }\n const help = resolveHelp(field) ?? \"\";\n if (mode === \"popover\")\n /* V2: Radix <PopoverTrigger asChild><div> — the whole row is the trigger (aria-expanded, aria-haspopup=\"dialog\");\n NavRow gets no onClick but still draws its button (\"Open <title>\") and chevron, whose click opens the popover. */\n return shell(\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger nativeButton={false} render={<div />}>\n <NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} />\n </PopoverTrigger>\n <PopoverContent className=\"w-[340px] p-3\" align=\"start\">\n <FieldList fields={fields} basePath={path} memoryKey={`pop:${pathKey(path)}`} />\n </PopoverContent>\n </Popover>,\n \"row\",\n );\n if (mode === \"dialog\")\n return shell(\n <>\n <NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} onClick={() => setOpen(true)} />\n <Modal\n open={open}\n onOpenChange={(o, d) => {\n // Escape steps back inside the dialog's own frames first (V2: onEscapeKeyDown + nav.back())\n if (!o && d.reason === \"escape-key\" && nav.current?.back()) return d.cancel();\n setOpen(o);\n }}\n >\n <ModalContent size=\"lg\">\n <ModalHeader title={field.title} description={field.description} />\n <ModalBody className=\"flex min-h-[320px] flex-col gap-5\">\n <NestedForm fields={fields} title={field.title} icon={field.icon} path={path} navRef={nav} />\n </ModalBody>\n <ModalFooter>\n <span className=\"mr-auto text-kit-xs text-kit-fg-3\">Changes save as you type</span>\n <Button variant=\"primary\" onClick={() => setOpen(false)}>\n Done\n </Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n </>,\n \"row\",\n );\n return shell(<NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} onClick={() => form.navigate(path)} inert={!form.canNavigate} />, \"row\");\n}\n\n/**\n * A dialog gets its OWN navigation stack: lists inside it drill inside the dialog (breadcrumb, Esc, stepper), never the\n * panel behind. Writes go straight into the parent form at `path`.\n */\nexport function NestedForm({ fields, title, icon, path, navRef }: NestedFormProps) {\n const form = useForm()!;\n const env = useKitEnv();\n const key = pathKey(path);\n const schema = React.useMemo(() => ({ name: key || \"nested\", title, icon, kind: \"object\" as const, fields }), [key, title, icon, fields]);\n const raw = form.getAt(path);\n const pub = form.hasPublished ? form.publishedAt(path) : undefined;\n const presence = React.useMemo(() => {\n const out: Record<string, KitPeer[]> = {};\n for (const [k, v] of Object.entries(env.presence)) if (k.startsWith(`${key}.`)) out[k.slice(key.length + 1)] = v;\n return out;\n }, [env.presence, key]);\n return (\n <SchemaForm\n schema={schema}\n value={isObj(raw) ? raw : {}}\n onChange={(v) => form.setAt(path, v)}\n variant=\"document\"\n scroll={false}\n navRef={navRef}\n resolveSchema={form.resolveSchema}\n blockLibrary={form.blockLibrary}\n published={isObj(pub) ? pub : undefined}\n presence={presence}\n readOnly={env.readOnly}\n showErrors={form.showAllErrors}\n onOpenReference={env.onOpenReference}\n env={{ docId: `${env.docId}:${key}`, docTitle: env.docTitle, urlPrefix: env.urlPrefix, isPublished: env.isPublished, palette: env.palette, helpDisplay: env.helpDisplay }}\n />\n );\n}\n\n/* ── Read-only as plain text (D58 §0): no greyed input, just the value ── */\nconst PLAIN_TYPES = new Set<PrimitiveType>([\"string\", \"text\", \"richtext\", \"number\", \"slug\", \"url\", \"email\", \"date\", \"datetime\", \"select\", \"multiselect\", \"tags\", \"boolean\", \"rating\"]);\nexport function plainOf(field: FieldSchema, value: unknown): string {\n if (value == null || value === \"\") return \"\";\n const label = (v: unknown) => field.options?.find((o) => o.value === v)?.label ?? String(v);\n if (field.type === \"boolean\") return value ? \"On\" : \"Off\";\n if (field.type === \"select\") return label(value);\n // before the list arm: stored rich text may be a Portable Text block array\n if (field.type === \"richtext\") return plainText(value);\n if (Array.isArray(value)) return value.map(label).join(\", \");\n if (field.type === \"date\" || field.type === \"datetime\") {\n const d = new Date(String(value).replace(/\\[.*\\]$/, \"\"));\n return Number.isNaN(+d) ? String(value) : d.toLocaleString(\"en-US\", field.type === \"date\" ? { month: \"short\", day: \"numeric\", year: \"numeric\" } : { month: \"short\", day: \"numeric\", year: \"numeric\", hour: \"numeric\", minute: \"2-digit\" });\n }\n if (field.type === \"number\" && isObj(value)) return String((value as { value?: unknown }).value ?? \"\");\n return typeof value === \"object\" ? \"\" : String(value);\n}\nfunction PlainValue({ field, value, id }: { field: FieldSchema; value: unknown; id: string }) {\n const text = plainOf(field, value);\n return (\n // NEW-Q48-PLAINLABEL: a <p> is not labelable, so label[for] named nothing; the group is named \"<field> <value>\"\n <p id={id} tabIndex={0} role=\"group\" aria-labelledby={`${id}-label ${id}`} data-slot=\"kit-plain\" className={cn(\"min-w-0 whitespace-pre-wrap break-words text-kit-sm leading-6 text-kit-fg outline-none\", (field.type === \"slug\" || field.type === \"url\") && \"font-kit-mono text-kit-xs leading-6\")}>\n {text || <span className=\"text-kit-fg-3\">Empty</span>}\n </p>\n );\n}\n\n/* ── Unknown type: the raw value, in the JSON control ── */\n/**\n * Every SchemaType has a kit control (kit-field.test checks CONTROLS against the type list in schema/types.ts). A field\n * whose type is none of them edits its raw stored value in the JSON control, tagged `data-kit-fallback=\"<type>\"`: the\n * value is shown and kept, and an edit is written only once it parses.\n */\nexport function FallbackControl(props: ControlProps) {\n return (\n <div data-kit-fallback={props.field.type} className=\"min-w-0\">\n <JsonControl {...props} />\n </div>\n );\n}\n\n/* ── Hand-off: the host's own control for a value the kit refuses ── */\n/**\n * A control that cannot carry a stored value unchanged (rich text holding formatting its editor would drop) hands that\n * value to the host's control for the type (KitServices.LegacyControl: the dashboard's FieldRenderer arm), bare inside\n * the kit FieldShell, which owns the label and the help; the control names its reason above it. The box carries\n * `data-kit-legacy=\"<type>\"`, so the parity harness counts it (mismatch class `legacy-control`). A control that throws\n * while rendering says why in words; the form around it keeps working.\n * Kit 3.2.0: a host with no LegacyControl gets a HELD field instead (held.tsx: the value read-only, with the reason, no\n * `data-kit-legacy`). LegacyControl, this hand-off and `data-kit-legacy` are removed in 4.0.0.\n */\nexport function LegacyFallback(props: ControlProps) {\n const { LegacyControl } = useKitServices();\n const { field, id } = props;\n if (!LegacyControl) return <HeldValue field={field} value={props.value} id={id} reason={`this view has no control for ${field.type} fields`} />;\n return (\n <div data-kit-legacy={field.type} className=\"min-w-0\">\n {/* keyed by the schema's content: a schema edit remounts the control (KitField hands over a fresh field object on\n every render, so identity would remount on every keystroke). A value change retries in place (componentDidUpdate). */}\n <LegacyBoundary key={JSON.stringify(field)} field={field} id={id} value={props.value}>\n <LegacyControl {...props} />\n </LegacyBoundary>\n </div>\n );\n}\n\n/**\n * An `<output>`: a labelable element, so the FieldShell label's `for` lands on it, and focusable, so a keyboard user\n * reaches the reason. The neutral focus ring shows under keyboard modality only.\n */\nfunction LegacyRefusal({ id, children }: { id: string; children: React.ReactNode }) {\n return (\n <output\n id={id}\n role=\"note\"\n tabIndex={0}\n data-slot=\"kit-legacy-refusal\"\n className=\"block rounded-kit-sm text-kit-xs text-kit-fg-3 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-kit-focus-ring focus-visible:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:outline-0\"\n >\n {children}\n </output>\n );\n}\n\n/** Retries the control once its field or value changes (a schema edit, a save from elsewhere, an undo). */\nclass LegacyBoundary extends React.Component<{ field: FieldSchema; id: string; value: unknown; children: React.ReactNode }, { reason: string | null }> {\n state = { reason: null as string | null };\n static getDerivedStateFromError(error: unknown) {\n return { reason: error instanceof Error ? error.message : String(error) };\n }\n componentDidUpdate(prev: { field: FieldSchema; value: unknown }) {\n if (this.state.reason === null) return;\n // by content: KitField hands over a fresh field object (withDefaultHelp) on every render\n if (prev.value !== this.props.value || JSON.stringify(prev.field) !== JSON.stringify(this.props.field)) this.setState({ reason: null });\n }\n render() {\n if (this.state.reason === null) return this.props.children;\n return (\n <LegacyRefusal id={this.props.id}>\n The {this.props.field.title} control could not load: {this.state.reason}\n </LegacyRefusal>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,WAAqE,CAAC;;;;;;AAOn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AM,UAAoH;CACrJ,QAAQ,EAAE,QAAQ,KAAsB;CACxC,OAAO,yBAAyB,OAAgB;EAC9C,OAAO,EAAE,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE;CAC1E;CACA,mBAAmB,MAA8C;EAC/D,IAAI,KAAK,MAAM,WAAW,MAAM;EAEhC,IAAI,KAAK,UAAU,KAAK,MAAM,SAAS,KAAK,UAAU,KAAK,KAAK,MAAM,KAAK,UAAU,KAAK,MAAM,KAAK,GAAG,KAAK,SAAS,EAAE,QAAQ,KAAK,CAAC;CACxI;CACA,SAAS;EACP,IAAI,KAAK,MAAM,WAAW,MAAM,OAAO,KAAK,MAAM;EAClD,OACE,qBAAC,eAAD;GAAe,IAAI,KAAK,MAAM;GAA9B,UAAA;IAAkC;IAC3B,KAAK,MAAM,MAAM;IAAM;IAA0B,KAAK,MAAM;GACpD;;CAEnB;AACF"}
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export * from "./context";
13
13
  export type { ControlProps } from "./types";
14
14
  export * from "./engine/schema-form";
15
15
  export * from "./engine/kit-field";
16
+ export * from "./engine/held";
16
17
  export * from "./engine/field-shell";
17
18
  export * from "./engine/bits";
18
19
  export * from "./engine/group-summary";
package/dist/index.js CHANGED
@@ -39,6 +39,7 @@ import { COALESCE_MS, SchemaForm, UNDO_STEPS } from "./engine/schema-form.js";
39
39
  import { BlockPicker, SlotField, useAvailableBlocks, useUnavailableBlocks } from "./engine/slot.js";
40
40
  import { CodeControl, CodeDialogField, CodeSurface, UnreadableValue, jsonProblem } from "./controls/code.js";
41
41
  import { JsonControl } from "./controls/json.js";
42
+ import { FieldBoundary, HeldField, HeldValue, KitErrorCard, heldLines } from "./engine/held.js";
42
43
  import { ACTIONS, ACTION_WHEN_READ_ONLY, CONTROLS, FallbackControl, KitField, LegacyFallback, NavRow, NestedForm, plainOf, useFieldAccess, withDefaultHelp } from "./engine/kit-field.js";
43
44
  import { EmailControl, SlugControl, SlugGenerate, StringControl, TEXT_FOCUS, TextControl, UrlControl, slugSource, slugTidy, slugTyping, str } from "./controls/text.js";
44
45
  import { ColorControl, HEX_COLOR, pickerHex } from "./controls/color.js";
@@ -79,6 +80,6 @@ import "./kit.css";
79
80
  //#region src/index.ts
80
81
  registerKitControls();
81
82
  //#endregion
82
- export { ACTIONS, ACTION_WHEN_READ_ONLY, ADD_SEARCH_AT, AGENT_PRESENCE, AI_PRESETS, ARRAY_CONTROLS, ActionTray, AnimatedFields, Appear, ArrayField, Autocomplete, Avatar, AvatarStack, BUTTON_ICONS, Badge, BlockPicker, BooleanControl, BreakpointGroup, Button, ButtonControl, ButtonIconPicker, ButtonLinkEditor, ButtonPreview, ButtonScreen, ButtonStyleGrid, C1_ACTIONS, C1_CONTROLS, C2_CONTROLS, CAP_IDS, CATEGORY_TO_PROD, COALESCE_MS, CONTROLS, Card, CardHeader, Checkbox, ChoiceCard, ChoiceList, ChoiceSwitch, CodeControl, CodeDialogField, CodeSurface, ColorControl, ComponentSlotControl, DEFAULT_ENV, DEV_FIELD, DEV_ONLY_FIELD, DateControl, Dot, EmailControl, EmptyState, ExpandedEditorModal, FLOATING_LAYER, FallbackControl, Field, FieldCommentRequest, FieldDescribedByContext, FieldHeaderSlot, FieldInset, FieldLabelledByContext, FieldList, FieldSection, FieldShell, FieldUnit, FieldUnitRow, FieldsetSection, FileControl, FlowBody, FlowClose, FlowFooter, FlowHeader, FlowLabel, FlowModal, FormPickerControl, FormProvider, FrameCrumbs, FrameHeader, FrameSlotsProvider, FrameStage, FrameView, GalleryControl, GroupTabs, HELP_STRINGS, HEX_COLOR, HISTORY_SEGMENT, HeaderStatus, HelpMore, Highlight, HintTooltip, HoverCard, HoverCardContent, HoverCardTrigger, IconButton, IconControl, IconPicker, IconValueGlyph, ImageControl, ImageDetails, Input, InsetScope, IssueDot, ItemList, JsonControl, KIT_ICONS, Kbd, Kbdish, KitAddressContext, KitBreadcrumb, KitEnvProvider, KitField, KitIcon, KitSectionTitle, KitServicesProvider, KitToaster, LABEL_HINT_AT, LINK_TYPES, Label, LegacyFallback, LinkControl, LinkField, LinkForm, LinkLine, LinkOptions, LinkPicker, LinkPopoverBody, LinkQuickEdit, LocationControl, MediaPicker, Menu, MenuCheckItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, MiniCalendar, Modal, ModalBody, ModalClose, ModalContent, ModalFooter, ModalHeader, ModalTrigger, ModeBar, ModeBarDot, ModeBarLink, MoreOptions, MultiSelectControl, NO_CROP_OUTSIDE_LIBRARY, NUMBER_SCALE, NavRow, NestedForm, NumberControl, OptionRow, OrderLockSlot, PageHeader, PeerStack, PlainNumber, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, REL_ITEMS, RHYTHM, RT_PROSE, Radio, RadioGroup, RatingControl, RefThumb, ReferenceControl, ReferencesControl, RevealLink, RichTextControl, RichTextEditor, RichTextExpandAction, RowChrome, RowList, RowsHostContext, SEARCH_THRESHOLD, SEGMENTED_MAX, SEGMENTED_MAX_LABEL, SHOPIFY_REF_LOCK, SITE_PALETTE, STYLE_ITEMS, ScaleControl, ScaleSlider, SchemaForm, SearchInput, SectionAnchorsProvider, Segmented, Select, SelectControl, Separator, SettingsSection, SharedSortProvider, Sheet, SheetClose, SheetContent, SheetTrigger, ShortcutHint, ShortcutHintsProvider, Skeleton, Slider, SlotDepthContext, SlotField, SlotPicker, SlugControl, SlugGenerate, Sparkle, Spinner, Stat, StatusMark, StatusPill, StringControl, StyleGlyph, Switch, TARGET_KEYS, TEXT_FOCUS, Tab, TabList, TabPanel, Table, TableControl, TableFrame, TableFullScreenAction, Tabs, TagsControl, Td, TextControl, Textarea, Th, Thumb, ToggleGroup, ToggleItem, Tooltip, TooltipProvider, TooltipScope, Tr, TrayMeta, TrayMore, UNDO_STEPS, UnknownValueNote, UnreadableValue, UrlControl, VideoControl, VideoPreview, acceptsFile, actionTrayClass, apiName, arrangeFields, arrayMove, avatarRingSpread, badgeVariants, belowMin, blockDefToSchema, buttonFromProd, buttonToProd, buttonVariants, cn, codeFromProd, codeToProd, collectIssues, colorFor, conventionalHelp, cropChoice, cropPreset, cropRect, crumbSignature, dateFromProd, dateToProd, datetimeFromProd, datetimeToProd, defaultGroup, describeLink, detectType, ensureKeys, failingRules, fieldAccessOf, fieldDefToSchema, fieldDefsToSchema, fileNameFromUrl, fileTarget, filterOptions, finalizeLink, findTarget, fitsSegmented, formatBytes, frameContext, frameDirection, framesToCrumbs, fromAsset, fromTypeSchema, getIn, groupSummary, hasLink, hrefOf, iconButtonVariants, iconKey, imageFromProd, imageToProd, inferField, isBreakpointName, isCropRect, isDockIcon, isDrillable, isFormOnly, isHidden, isShort, isVideoUrl, jsonProblem, kitPathItems, kitToast, kitToastManager, leafValuePlan, linkFromProd, linkIcon, linkProblem, linkShapeOf, linkText, linkToProd, listFromProd, listMeta, listToProd, locationFromDraft, lookLabel, lookOf, matchPositions, matchScore, newBlock, newItem, nextButton, nodeText, normImage, normLink, optionIcons, parentTitleOf, parseTargetTag, pathKey, pickerHex, plainOf, plainText, planFromProd, planToProd, platformKeys, presenceColor, presenceSlot, previewOf, prod_types_exports as prod, propDefToField, propsToTypeSchema, ratingFromProd, ratingScale, ratingToProd, refFilterText, referenceFromProd, referenceNoun, referenceToProd, registerC1Controls, registerC2Controls, registerKitControls, registerKitServices, registerPresenceRoster, resetFieldClipboard, resolveFieldAccess, resolveFrames, resolveHelp, rootFrame, rowToggleField, scaleFromProd, scaleToProd, schemaSlugOf, seesDevSurfaces, selectTriggerClass, setIn, shortcutHintsOn, slugSource, slugTidy, slugTyping, snapRating, statusMap, storedLink, str, summarize, tableFromProd, tableToProd, tagRefusal, tagsFromProd, tagsToProd, targetTag, textLength, titleFromKey, toNum, toTypeSchema, typedRowsFromProd, typedRowsToProd, ungroupNumber, uniqueKey, useAvailableBlocks, useDragReorder, useDrill, useFieldAccess, useFieldDescribedBy, useFieldId, useFieldLabelledBy, useFocusReturn, useForm, useFrameNavigation, useFrameSlots, useGroupStatus, useInsetDepth, useKitEnv, useKitServices, useLinkTargets, useListOps, useLoadedFit, useOwnDescription, useReferenceRecords, useRhythm, useRichTextRefs, useSharedSort, useShortcutHints, useUnavailableBlocks, useUpload, validateValue, variantFamilyFromTypeSchema, variantFamilyToTypeSchema, variantGroupV2, videoFromProd, videoProvider, videoToProd, visibleFields, visibleSchema, withCrop, withDefaultHelp, withTarget, withText, youTubeId, zoneListFromProd, zoneListToProd };
83
+ export { ACTIONS, ACTION_WHEN_READ_ONLY, ADD_SEARCH_AT, AGENT_PRESENCE, AI_PRESETS, ARRAY_CONTROLS, ActionTray, AnimatedFields, Appear, ArrayField, Autocomplete, Avatar, AvatarStack, BUTTON_ICONS, Badge, BlockPicker, BooleanControl, BreakpointGroup, Button, ButtonControl, ButtonIconPicker, ButtonLinkEditor, ButtonPreview, ButtonScreen, ButtonStyleGrid, C1_ACTIONS, C1_CONTROLS, C2_CONTROLS, CAP_IDS, CATEGORY_TO_PROD, COALESCE_MS, CONTROLS, Card, CardHeader, Checkbox, ChoiceCard, ChoiceList, ChoiceSwitch, CodeControl, CodeDialogField, CodeSurface, ColorControl, ComponentSlotControl, DEFAULT_ENV, DEV_FIELD, DEV_ONLY_FIELD, DateControl, Dot, EmailControl, EmptyState, ExpandedEditorModal, FLOATING_LAYER, FallbackControl, Field, FieldBoundary, FieldCommentRequest, FieldDescribedByContext, FieldHeaderSlot, FieldInset, FieldLabelledByContext, FieldList, FieldSection, FieldShell, FieldUnit, FieldUnitRow, FieldsetSection, FileControl, FlowBody, FlowClose, FlowFooter, FlowHeader, FlowLabel, FlowModal, FormPickerControl, FormProvider, FrameCrumbs, FrameHeader, FrameSlotsProvider, FrameStage, FrameView, GalleryControl, GroupTabs, HELP_STRINGS, HEX_COLOR, HISTORY_SEGMENT, HeaderStatus, HeldField, HeldValue, HelpMore, Highlight, HintTooltip, HoverCard, HoverCardContent, HoverCardTrigger, IconButton, IconControl, IconPicker, IconValueGlyph, ImageControl, ImageDetails, Input, InsetScope, IssueDot, ItemList, JsonControl, KIT_ICONS, Kbd, Kbdish, KitAddressContext, KitBreadcrumb, KitEnvProvider, KitErrorCard, KitField, KitIcon, KitSectionTitle, KitServicesProvider, KitToaster, LABEL_HINT_AT, LINK_TYPES, Label, LegacyFallback, LinkControl, LinkField, LinkForm, LinkLine, LinkOptions, LinkPicker, LinkPopoverBody, LinkQuickEdit, LocationControl, MediaPicker, Menu, MenuCheckItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, MiniCalendar, Modal, ModalBody, ModalClose, ModalContent, ModalFooter, ModalHeader, ModalTrigger, ModeBar, ModeBarDot, ModeBarLink, MoreOptions, MultiSelectControl, NO_CROP_OUTSIDE_LIBRARY, NUMBER_SCALE, NavRow, NestedForm, NumberControl, OptionRow, OrderLockSlot, PageHeader, PeerStack, PlainNumber, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, REL_ITEMS, RHYTHM, RT_PROSE, Radio, RadioGroup, RatingControl, RefThumb, ReferenceControl, ReferencesControl, RevealLink, RichTextControl, RichTextEditor, RichTextExpandAction, RowChrome, RowList, RowsHostContext, SEARCH_THRESHOLD, SEGMENTED_MAX, SEGMENTED_MAX_LABEL, SHOPIFY_REF_LOCK, SITE_PALETTE, STYLE_ITEMS, ScaleControl, ScaleSlider, SchemaForm, SearchInput, SectionAnchorsProvider, Segmented, Select, SelectControl, Separator, SettingsSection, SharedSortProvider, Sheet, SheetClose, SheetContent, SheetTrigger, ShortcutHint, ShortcutHintsProvider, Skeleton, Slider, SlotDepthContext, SlotField, SlotPicker, SlugControl, SlugGenerate, Sparkle, Spinner, Stat, StatusMark, StatusPill, StringControl, StyleGlyph, Switch, TARGET_KEYS, TEXT_FOCUS, Tab, TabList, TabPanel, Table, TableControl, TableFrame, TableFullScreenAction, Tabs, TagsControl, Td, TextControl, Textarea, Th, Thumb, ToggleGroup, ToggleItem, Tooltip, TooltipProvider, TooltipScope, Tr, TrayMeta, TrayMore, UNDO_STEPS, UnknownValueNote, UnreadableValue, UrlControl, VideoControl, VideoPreview, acceptsFile, actionTrayClass, apiName, arrangeFields, arrayMove, avatarRingSpread, badgeVariants, belowMin, blockDefToSchema, buttonFromProd, buttonToProd, buttonVariants, cn, codeFromProd, codeToProd, collectIssues, colorFor, conventionalHelp, cropChoice, cropPreset, cropRect, crumbSignature, dateFromProd, dateToProd, datetimeFromProd, datetimeToProd, defaultGroup, describeLink, detectType, ensureKeys, failingRules, fieldAccessOf, fieldDefToSchema, fieldDefsToSchema, fileNameFromUrl, fileTarget, filterOptions, finalizeLink, findTarget, fitsSegmented, formatBytes, frameContext, frameDirection, framesToCrumbs, fromAsset, fromTypeSchema, getIn, groupSummary, hasLink, heldLines, hrefOf, iconButtonVariants, iconKey, imageFromProd, imageToProd, inferField, isBreakpointName, isCropRect, isDockIcon, isDrillable, isFormOnly, isHidden, isShort, isVideoUrl, jsonProblem, kitPathItems, kitToast, kitToastManager, leafValuePlan, linkFromProd, linkIcon, linkProblem, linkShapeOf, linkText, linkToProd, listFromProd, listMeta, listToProd, locationFromDraft, lookLabel, lookOf, matchPositions, matchScore, newBlock, newItem, nextButton, nodeText, normImage, normLink, optionIcons, parentTitleOf, parseTargetTag, pathKey, pickerHex, plainOf, plainText, planFromProd, planToProd, platformKeys, presenceColor, presenceSlot, previewOf, prod_types_exports as prod, propDefToField, propsToTypeSchema, ratingFromProd, ratingScale, ratingToProd, refFilterText, referenceFromProd, referenceNoun, referenceToProd, registerC1Controls, registerC2Controls, registerKitControls, registerKitServices, registerPresenceRoster, resetFieldClipboard, resolveFieldAccess, resolveFrames, resolveHelp, rootFrame, rowToggleField, scaleFromProd, scaleToProd, schemaSlugOf, seesDevSurfaces, selectTriggerClass, setIn, shortcutHintsOn, slugSource, slugTidy, slugTyping, snapRating, statusMap, storedLink, str, summarize, tableFromProd, tableToProd, tagRefusal, tagsFromProd, tagsToProd, targetTag, textLength, titleFromKey, toNum, toTypeSchema, typedRowsFromProd, typedRowsToProd, ungroupNumber, uniqueKey, useAvailableBlocks, useDragReorder, useDrill, useFieldAccess, useFieldDescribedBy, useFieldId, useFieldLabelledBy, useFocusReturn, useForm, useFrameNavigation, useFrameSlots, useGroupStatus, useInsetDepth, useKitEnv, useKitServices, useLinkTargets, useListOps, useLoadedFit, useOwnDescription, useReferenceRecords, useRhythm, useRichTextRefs, useSharedSort, useShortcutHints, useUnavailableBlocks, useUpload, validateValue, variantFamilyFromTypeSchema, variantFamilyToTypeSchema, variantGroupV2, videoFromProd, videoProvider, videoToProd, visibleFields, visibleSchema, withCrop, withDefaultHelp, withTarget, withText, youTubeId, zoneListFromProd, zoneListToProd };
83
84
 
84
85
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @bettercms-ai/kit entry point. Importing it loads kit.css (keyframes); tokens.css and theme.css are imported by\n * the host. schema/scale.ts and schema/table.ts each export their own `formatNumber`, so neither is re-exported\n * here: import it by path (\"@bettercms-ai/kit/schema/scale\", \"@bettercms-ai/kit/schema/table\").\n */\nimport \"./kit.css\";\nimport { registerKitControls } from \"./controls\";\n\nexport * from \"./schema/types\";\nexport * from \"./schema/sources\";\nexport * from \"./schema/help\";\nexport * from \"./schema/adapters\";\nexport { cn } from \"./lib/cn\";\nexport * from \"./ui\";\n\n/* the form engine, its runtime contexts, and the V2 ↔ prod schema and value adapters */\nexport * from \"./context\";\nexport type { ControlProps } from \"./types\";\nexport * from \"./engine/schema-form\";\nexport * from \"./engine/kit-field\";\nexport * from \"./engine/field-shell\";\nexport * from \"./engine/bits\";\nexport * from \"./engine/group-summary\";\n/* layout (grouping.tsx's FieldList takes `renderField`; the engine's FieldList is field-list's, drawing KitField) */\nexport {\n RHYTHM, useRhythm, InsetScope, useInsetDepth, useGroupStatus, Appear, AnimatedFields, FieldSection, FieldInset, FieldUnit, FieldUnitRow,\n isBreakpointName, BreakpointGroup, arrangeFields, defaultGroup, GroupTabs, FieldsetSection, isShort,\n type GroupStatus, type RenderField, type GroupTabItem, type FieldSectionProps,\n} from \"./engine/grouping\";\nexport * from \"./engine/field-list\";\nexport * from \"./engine/array\";\nexport * from \"./engine/item-list\";\nexport * from \"./engine/slot\";\nexport {\n FrameSlotsProvider, useFrameSlots, FrameView, frameContext, FrameHeader, parentTitleOf, frameDirection,\n useFrameNavigation, FrameStage, type FrameFieldListProps, type FrameSlots,\n} from \"./engine/frame\";\nexport * from \"./engine/breadcrumb\";\nexport { resolveFrames, rootFrame, isDrillable, type Frame } from \"./lib/frames\";\nexport * from \"./adapters/schema\";\nexport * from \"./adapters/values\";\n/* the prod model's names (Fieldset, OpenMode, ScaleUnit, SelectOption) collide with the kit's own, so they live under `prod` */\nexport * as prod from \"./adapters/prod-types\";\nexport type { LossyFeature } from \"./adapters/lossy\";\n\n/* controls: each register file adds its types to the engine's dispatch tables (one import per lane file) */\nimport \"./controls/date-register\";\nimport \"./controls/icon-register\";\nimport \"./controls/code-register\";\nimport \"./controls/json-register\";\nimport \"./controls/location-register\";\nimport \"./controls/media-register\";\nimport \"./controls/reference-register\";\nimport \"./controls/form-picker-register\";\nimport \"./controls/slot-register\";\nimport \"./controls/rich-text\";\nimport \"./controls/table\";\n/* the controls, flat as in V2: registered once here, so any host that loads the kit draws them */\nexport * from \"./controls\";\n/* the engine helpers V2's kit entry exports */\nexport { KitIcon, KIT_ICONS, iconKey } from \"./lib/icons\";\nexport { collectIssues, validateValue, textLength, uniqueKey, type KitIssue, type UniquePeers } from \"./lib/validate\";\nexport { getIn, setIn, pathKey, ensureKeys } from \"./lib/path\";\nexport { previewOf, summarize, isHidden, plainText, newBlock, newItem, failingRules, refFilterText } from \"./lib/schema\";\nregisterKitControls();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,oBAAoB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @bettercms-ai/kit entry point. Importing it loads kit.css (keyframes); tokens.css and theme.css are imported by\n * the host. schema/scale.ts and schema/table.ts each export their own `formatNumber`, so neither is re-exported\n * here: import it by path (\"@bettercms-ai/kit/schema/scale\", \"@bettercms-ai/kit/schema/table\").\n */\nimport \"./kit.css\";\nimport { registerKitControls } from \"./controls\";\n\nexport * from \"./schema/types\";\nexport * from \"./schema/sources\";\nexport * from \"./schema/help\";\nexport * from \"./schema/adapters\";\nexport { cn } from \"./lib/cn\";\nexport * from \"./ui\";\n\n/* the form engine, its runtime contexts, and the V2 ↔ prod schema and value adapters */\nexport * from \"./context\";\nexport type { ControlProps } from \"./types\";\nexport * from \"./engine/schema-form\";\nexport * from \"./engine/kit-field\";\nexport * from \"./engine/held\";\nexport * from \"./engine/field-shell\";\nexport * from \"./engine/bits\";\nexport * from \"./engine/group-summary\";\n/* layout (grouping.tsx's FieldList takes `renderField`; the engine's FieldList is field-list's, drawing KitField) */\nexport {\n RHYTHM, useRhythm, InsetScope, useInsetDepth, useGroupStatus, Appear, AnimatedFields, FieldSection, FieldInset, FieldUnit, FieldUnitRow,\n isBreakpointName, BreakpointGroup, arrangeFields, defaultGroup, GroupTabs, FieldsetSection, isShort,\n type GroupStatus, type RenderField, type GroupTabItem, type FieldSectionProps,\n} from \"./engine/grouping\";\nexport * from \"./engine/field-list\";\nexport * from \"./engine/array\";\nexport * from \"./engine/item-list\";\nexport * from \"./engine/slot\";\nexport {\n FrameSlotsProvider, useFrameSlots, FrameView, frameContext, FrameHeader, parentTitleOf, frameDirection,\n useFrameNavigation, FrameStage, type FrameFieldListProps, type FrameSlots,\n} from \"./engine/frame\";\nexport * from \"./engine/breadcrumb\";\nexport { resolveFrames, rootFrame, isDrillable, type Frame } from \"./lib/frames\";\nexport * from \"./adapters/schema\";\nexport * from \"./adapters/values\";\n/* the prod model's names (Fieldset, OpenMode, ScaleUnit, SelectOption) collide with the kit's own, so they live under `prod` */\nexport * as prod from \"./adapters/prod-types\";\nexport type { LossyFeature } from \"./adapters/lossy\";\n\n/* controls: each register file adds its types to the engine's dispatch tables (one import per lane file) */\nimport \"./controls/date-register\";\nimport \"./controls/icon-register\";\nimport \"./controls/code-register\";\nimport \"./controls/json-register\";\nimport \"./controls/location-register\";\nimport \"./controls/media-register\";\nimport \"./controls/reference-register\";\nimport \"./controls/form-picker-register\";\nimport \"./controls/slot-register\";\nimport \"./controls/rich-text\";\nimport \"./controls/table\";\n/* the controls, flat as in V2: registered once here, so any host that loads the kit draws them */\nexport * from \"./controls\";\n/* the engine helpers V2's kit entry exports */\nexport { KitIcon, KIT_ICONS, iconKey } from \"./lib/icons\";\nexport { collectIssues, validateValue, textLength, uniqueKey, type KitIssue, type UniquePeers } from \"./lib/validate\";\nexport { getIn, setIn, pathKey, ensureKeys } from \"./lib/path\";\nexport { previewOf, summarize, isHidden, plainText, newBlock, newItem, failingRules, refFilterText } from \"./lib/schema\";\nregisterKitControls();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,oBAAoB"}
@@ -157,6 +157,15 @@ export interface FieldSchema {
157
157
  * source of truth): people without that cap see the value read-only, with a small lock glyph and this line (D70).
158
158
  */
159
159
  lockReason?: string;
160
+ /**
161
+ * HELD (kit 3.2.0): the host cannot edit this field's stored value without changing it, so the form shows it read-only
162
+ * inside the usual shell (label, help, the value as stored, and `reason` in words: "it holds formatting this editor
163
+ * cannot keep") and never writes it. Unlike `readOnly` it names why. A value-dependent hold can come from
164
+ * `KitServices.heldReason` instead; either one holds the field.
165
+ */
166
+ held?: {
167
+ reason: string;
168
+ };
160
169
  /**
161
170
  * D70 "Protect in schema": the site's code depends on this field, so a schema editor refuses to rename its key, change
162
171
  * its type, archive or delete it (or a parent holding it) until someone unlocks it. Values and other settings still change.
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/schema/types.ts"],"sourcesContent":["/**\n * BETTERCMS SCHEMA — the long-term contract for every editable thing (blocks, pages, entries, globals).\n * One schema language → one form engine (`@/components/kit`) → used by BOTH the Visuals inspector and the\n * Content document editor. Modelled on Sanity's schema (types, fieldsets, groups, previews, validation,\n * conditional fields) plus BetterCMS's block slots for nested layouts.\n *\n * Design principles (CPO D8):\n * - Scales to deep nesting without inline-accordion soup: arrays render compact preview rows; opening an item\n * DRILLS IN (panel slides, breadcrumb grows). Small objects may render inline; lightweight settings open in a POPOVER.\n * - Every field has the same chrome: label · help · required · validation · counter · ⋯ menu · presence · comments.\n * - Blocks can contain blocks (slots) → complex layouts (tabs, columns, bento, mega menus, carousels).\n */\n\nimport type { IconFieldOptions, RichTextFeature } from \"@bettercms-ai/types\";\nimport type { Cap } from \"./sources\";\nimport type { TableFieldOptions } from \"./table\";\n\nexport type PrimitiveType =\n | \"string\" // single line\n | \"text\" // multi line, auto-grow\n | \"richtext\" // portable-text style rich text\n | \"number\"\n | \"boolean\"\n | \"slug\"\n | \"url\"\n | \"email\"\n | \"date\"\n | \"datetime\"\n | \"color\"\n | \"select\" // options: single\n | \"multiselect\"\n | \"tags\"\n | \"image\"\n | \"file\"\n | \"video\"\n | \"icon\" // icon picker (Tabler name)\n | \"link\" // url | page ref + target + rel (one unit)\n | \"button\" // label + link + style (one unit — founder rule)\n | \"reference\" // to a collection entry / page / form\n | \"code\"\n | \"json\"\n | \"geopoint\"\n | \"rating\"\n | \"table\"; // typed columns × keyed rows (CPO D42) — value: TableValue (src/schema/table.ts)\n\nexport type CompoundType =\n | \"object\" // nested fields\n | \"array\" // list of `of` (objects, primitives or references)\n | \"slot\"; // list of nested BLOCKS (block-in-block layouts)\n\nexport type SchemaType = PrimitiveType | CompoundType;\n\nexport interface Option {\n value: string;\n label: string;\n icon?: string;\n description?: string;\n}\n\nexport interface Validation {\n required?: boolean;\n min?: number; // chars for strings, items for arrays, value for numbers\n max?: number;\n /** soft limit: warning (amber) instead of error — e.g. SEO title 60 */\n recommendedMax?: number;\n pattern?: string;\n patternMessage?: string;\n /**\n * No two values may be the same. A field inside a list item: unique among the list's items. A list of scalars or\n * references: no item twice. A root field: unique among the model's other records when the host passes them\n * (`SchemaForm` `uniquePeers`).\n */\n unique?: boolean;\n /** array of objects: items are unique by this item key (`uniqueBy: \"sku\"`), the same check as `unique` on that key. */\n uniqueBy?: string;\n}\n\n/**\n * A reference picker's filter, typed (V2 gap 27): only published records, and/or one field equal to a value. Production\n * stores a filter as a GROQ-style string (\"category == 'billing'\"), which `reference.filter` also takes as it is.\n */\nexport interface ReferenceFilter {\n /** \"published\": only records that have a live version (Published, or Published with changes) */\n status?: \"published\";\n /** a field of the target record (\"category\"); `title` and `slug` work too */\n field?: string;\n equals?: string | number | boolean;\n}\n\n/** How a compound field is edited when opened. */\nexport type OpenMode =\n | \"inline\" // render fields in place (small objects, ≤3 primitives)\n | \"drill\" // slide the panel to a child view; breadcrumb grows (default for array items & objects)\n | \"popover\" // anchored popover (link settings, image crop/alt, small option sets)\n | \"dialog\"; // centered modal for heavy editors (rich text full screen, code, table)\n\nexport interface PreviewConfig {\n /** dotted paths into the item value */\n title?: string;\n subtitle?: string;\n media?: string;\n /** Fallback label, e.g. \"Untitled question\" */\n fallback?: string;\n /** Tabler icon name (kebab-case, e.g. \"help-circle\") shown when there is no media. */\n icon?: string;\n}\n\n/** A condition's operator. Absent: `equals` reads as is / is one of, `notEmpty` as has a value. */\nexport type ConditionOp = \"is\" | \"isNot\" | \"in\" | \"notIn\" | \"empty\" | \"notEmpty\" | \"gt\" | \"lt\";\n\n/**\n * \"Show only when\" (V2 types.ts). The field shows only while the rule holds:\n * - `field` names a key beside it (default), in the object that holds those fields (`scope: \"parent\"`) or at the top of\n * the component or CMS item (`scope: \"root\"`). `_variant` is the component's variant (its first variant when unset).\n * - `op` + `value` (is · is not · is one of · is not one of · is empty · has a value · more than · less than). The legacy\n * `equals` / `notEmpty` forms still read the same.\n * - `also`: more rules, combined by `match` (\"all\", the default, or \"any\").\n */\nexport interface Condition {\n field: string;\n equals?: unknown | unknown[];\n notEmpty?: boolean;\n op?: ConditionOp;\n value?: unknown;\n scope?: \"parent\" | \"root\";\n also?: Condition[];\n match?: \"all\" | \"any\";\n}\n\nexport interface FieldSchema {\n name: string; // key in the value object\n title: string; // label (sentence case)\n type: SchemaType;\n /** Help text under the label (CPO D39). Unset → a house convention from `@/schema/help` may apply; \"\" = none. */\n description?: string;\n /** Longer explanation behind the ⓘ next to the label (tooltip). Use when one line can't carry it. */\n helpMore?: string;\n placeholder?: string;\n initialValue?: unknown;\n validation?: Validation;\n options?: Option[]; // select / multiselect / radio-like\n layout?: \"dropdown\" | \"radio\" | \"segmented\" | \"cards\" | \"switch\" | \"checkbox\" | \"slider\" | \"grid\" | \"list\";\n /** compound */\n fields?: FieldSchema[]; // object\n of?: FieldSchema[] | { type: \"block\"; allow?: string[] }; // array items / slot allowed block types\n openMode?: OpenMode;\n preview?: PreviewConfig;\n /** organisation */\n fieldset?: string; // groups fields into a collapsible fieldset\n group?: string; // which tab (Content / Media / Settings / SEO…)\n /** behaviour */\n hidden?: Condition | boolean;\n /** true = never editable in the form (computed or system values). Who may see or change a field is `access`. */\n readOnly?: boolean;\n /** Archived (V2 types.ts): kept in the schema and its values stay stored, but no form renders it. Schema editors show it. */\n archived?: boolean;\n /**\n * D58 field-level access. `view` missing → everyone who can open the form sees it; `edit` missing → the form's own\n * rule (the host's content.edit). A field the lens can't `view` is not rendered; one it can't `edit` renders as plain\n * text. Fields in the `seo` group default to `{ edit: \"seo.edit\" }`.\n */\n access?: FieldAccess;\n localized?: boolean;\n advanced?: boolean; // tucked into the \"Advanced\" fieldset by default (calm UX)\n ai?: boolean; // show the AI assist sparkle\n // reference targets (collection ids, \"page\", \"form\"); `noun`: what the picker calls one (\"author\": \"Select an author\",\n // \"Create new author\"), else the target's (\"CMS item\", \"page\", …)\n // `excludeId`: a record this picker never lists (the entry a rich-text island sits in, which its own form cannot see)\n reference?: { to: string[]; filter?: string | ReferenceFilter; noun?: string; excludeId?: string };\n numeric?: { unit?: string; step?: number; min?: number; max?: number }; // number / slider\n /** number: a developer-controlled SCALE (tokens or a stepped range) with an optional custom escape hatch (CPO D41).\n * Value shape → `ScaleValue`. Takes precedence over `layout: \"slider\"` + `numeric` (which still work, fixed-only). */\n scale?: ScaleSchema;\n /** table: column types allowed, developer-locked columns, row limits, caption rule, JSON-LD offered (CPO D42). */\n table?: TableFieldOptions;\n\n /* ── additive (Block Kit v1) ─────────────────────────────────────────── */\n /** Tabler icon name (kebab-case) used on rows, crumbs and the block picker. */\n icon?: string;\n /** text: minimum visible rows. */\n rows?: number;\n /** Value is synced from a global block (\"Navigation\") — edits apply everywhere it is used. */\n synced?: { from: string };\n /** slot: per-child layout settings stored on each child under `_settings` (e.g. bento span). */\n slotSettings?: FieldSchema[];\n /** array: singular noun for \"Add {noun}\" and empty states (\"question\"). Defaults from the item title. */\n itemNoun?: string;\n /** array: how rows render. \"grid\" = tiles (good for images / logos). */\n arrayLayout?: \"list\" | \"grid\";\n /**\n * The reason a locked field shows editors (\"Set by developers.\"). A field is LOCKED when it has `access.edit` (D58, the one\n * source of truth): people without that cap see the value read-only, with a small lock glyph and this line (D70).\n */\n lockReason?: string;\n /**\n * D70 \"Protect in schema\": the site's code depends on this field, so a schema editor refuses to rename its key, change\n * its type, archive or delete it (or a parent holding it) until someone unlocks it. Values and other settings still change.\n */\n protected?: boolean;\n /**\n * Host-only, never persisted: the list's ORDER is set by the site's code (identity rule 36). The rows stay editable;\n * drag and Move up / down are off and the grip slot shows a lock (V2 content/editor/page-sections.tsx:31,155).\n */\n orderLocked?: boolean;\n /** link / image / button: store a plain string (href or URL) instead of the object — for legacy data. */\n valueShape?: \"string\" | \"object\";\n /** image: an inline-SVG icon, which takes SVG files only (prod `config.media: \"icon\"`). */\n svgOnly?: boolean;\n /** icon (D65): where an icon may come from (set · library · upload) and whether it asks for a label (prod `config.icons`). */\n icons?: IconFieldOptions;\n /**\n * A link LABEL's href: the sibling it links with (prod `config.linkHref`), as the owner answered the editable plan's\n * `link-pair` question where the names do not say (`title` + `to`). Read first by `linkLabelHref`.\n */\n linkHref?: string;\n /**\n * date / datetime: time zone handling (CPO D43). true = the editor picks a zone (defaults to the site's) · \"site\" = always\n * the site's zone · \"fixed:<IANA>\" = always that zone · false = no zone. Default: true for datetime, false for date.\n * Zoned values store ISO with offset + the IANA zone: \"2026-10-14T09:00:00+05:30[Asia/Kolkata]\" (RFC 9557).\n */\n timezone?: boolean | \"site\" | `fixed:${string}`;\n /** code: the field's own language and the only languages its picker offers (prod config.language / languages). */\n language?: string;\n languages?: string[];\n /**\n * richtext / document: the blocks and marks the field offers, from types RICHTEXT_FEATURES (prod config.features).\n * Absent = all of them, as V2's rich text offers (normV2 folds the full set to absent). A schema read from JSON may\n * hold an alias (`headings`) or an unknown name: the adapter expands the one and names the other.\n */\n features?: RichTextFeature[];\n /**\n * richtext / document: the content models its related posts and author bios draw from (prod config.references,\n * plan RT8), by id. posts absent: the entry's own collection; authors absent: no author bio is offered.\n */\n references?: { posts?: string; authors?: string };\n}\n\n/** D58: the caps that let someone see / change one field. */\nexport interface FieldAccess {\n view?: Cap;\n edit?: Cap;\n}\n/** Developer-owned values (anchors, custom CSS, ids): only people who can change the schema edit them. */\nexport const DEV_FIELD: FieldAccess = { edit: \"schema.manage\" };\n/** Developer-only settings: hidden unless you can see the schema. */\nexport const DEV_ONLY_FIELD: FieldAccess = { view: \"schema.view\", edit: \"schema.manage\" };\n\n/* ── Scales (CPO D41) ─────────────────────────────────────────────────── */\nexport type ScaleUnit = \"px\" | \"%\" | \"rem\" | \"em\" | \"vw\" | \"vh\";\n\n/** One allowed value of a token scale. `value` is what is stored; `label` is the short readout (\"XL\"). */\nexport interface ScaleStep {\n value: string;\n label: string;\n /** Long name for screen readers and tooltips (\"Extra large\"). Defaults to `label`. */\n title?: string;\n /** Resolved size in px, shown as \"XL · 48px\" and used to place custom values on the track. */\n px?: number;\n /** Resolved CSS when it isn't px (e.g. \"100vh\", \"var(--space-xl)\"). */\n css?: string;\n}\n\n/** A stepped numeric range (continuous with snapping). The stored value is a bare number in `defaultUnit`. */\nexport interface ScaleRange {\n min: number;\n max: number;\n step?: number;\n}\n\n/** Bounds for the custom escape hatch. min / max may be one number or per unit ({ px: 0, \"%\": 0 }). */\nexport interface ScaleCustom {\n min?: number | Partial<Record<ScaleUnit, number>>;\n max?: number | Partial<Record<ScaleUnit, number>>;\n /** Units the editor may type. Defaults to the scale's `units`. */\n units?: ScaleUnit[];\n /** Arrow-key nudge (Shift ×10, Alt ×0.1). Default 1. */\n step?: number;\n}\n\nexport interface ScaleSchema {\n /** Token steps (S M L XL 2XL) or a numeric range ({ min, max, step }). */\n steps: ScaleStep[] | ScaleRange;\n /** Units of the scale; the first is the default. A range with no units is unitless. */\n units?: ScaleUnit[];\n defaultUnit?: ScaleUnit;\n /** false (default) = fixed only: the editor can pick only the allowed values. true / object = fixed + custom. */\n allowCustom?: boolean | ScaleCustom;\n /** Quick picks in the unit menu when custom is allowed (\"50%\", \"100vh\"). */\n presets?: { label?: string; value: ScaleValue }[];\n}\n\n/**\n * How a scale value is STORED — three shapes, told apart by `typeof`, so tokens and custom values never collide and\n * older data (bare token strings, bare numbers) is already valid:\n * - token → the step's value string (\"xl\")\n * - range → a bare number in the default unit (15 → 15%)\n * - custom → an object ({ value: 200, unit: \"px\" })\n */\nexport type ScaleValue = string | number | ScaleCustomValue;\nexport interface ScaleCustomValue {\n value: number;\n unit: ScaleUnit;\n}\n\nexport interface Fieldset {\n name: string;\n title: string;\n description?: string;\n collapsed?: boolean; // collapsed by default\n columns?: 1 | 2; // short fields side by side\n /** CPO D45: the header toggles the section (default true). false = a static heading for 2–3 fields that are always needed. */\n collapsible?: boolean;\n /**\n * CPO D45: \"breakpoints\" = the members are objects, one per screen size (desktop · tablet · phone), shown as ONE group with a\n * segmented switcher instead of three stacked groups. Sibling objects named desktop / laptop / tablet / mobile / phone get\n * this automatically.\n */\n layout?: \"stack\" | \"breakpoints\";\n}\n\nexport interface FieldGroup {\n name: string;\n title: string;\n icon?: string;\n default?: boolean;\n}\n\n/** A developer-defined layout of a block (swap without losing content). */\nexport interface BlockVariant {\n id: string;\n name: string;\n description?: string;\n}\n\n/** A document/block type. */\nexport interface TypeSchema {\n name: string; // e.g. \"hero\", \"journalStory\"\n title: string;\n kind: \"block\" | \"page\" | \"entry\" | \"global\" | \"object\";\n icon?: string;\n description?: string;\n fields: FieldSchema[];\n fieldsets?: Fieldset[];\n groups?: FieldGroup[];\n preview?: PreviewConfig;\n /* ── additive (Block Kit v1) ── */\n /** Block variants (layouts) — shown as a chip on slot rows and a switcher in the block frame. */\n variants?: BlockVariant[];\n /** Block picker category (\"Layout\", \"Content\", \"Media\"…). */\n category?: string;\n /**\n * kind \"block\" only (CPO D55): where the block fits. \"inline\" = it fits a text column, so a rich-text body lists it in\n * the Insert menu's Article group. \"section\" (default) = page-width, reachable in a body only through More components.\n * \"page\" = a whole page or a feed of other content; never inside a body.\n */\n placement?: \"inline\" | \"section\" | \"page\";\n /** Starting value for a new instance (block added to a slot, new document). */\n initialValue?: Record<string, unknown>;\n}\n\n/** Every array item / slot child carries a stable key. Slot children also carry their block type. */\nexport interface KeyedItem {\n _key?: string;\n /** item type name (arrays with several `of` types) or block type (slots) */\n _type?: string;\n}\n/** A block inside a slot: its own props at the root, plus variant and per-slot layout settings. */\nexport interface SlotChild extends KeyedItem {\n _type: string;\n _variant?: string;\n _settings?: Record<string, unknown>;\n [prop: string]: unknown;\n}\n\n/** Path from the root document/block to the field being edited, e.g. [\"items\", 1, \"answer\"] */\nexport type FieldPath = (string | number)[];\n\n/** One crumb in the inspector/editor breadcrumb (drill-in navigation stack). */\nexport interface Crumb {\n path: FieldPath;\n title: string;\n icon?: string;\n /** tableGroup / tableRow / tableColumn: a table field's rows and columns drill like array items (D50) */\n kind: \"root\" | \"object\" | \"item\" | \"block\" | \"button\" | \"history\" | \"tableGroup\" | \"tableRow\" | \"tableColumn\";\n}\n\n/** Reserved path segment: the field's version history as a stacked panel, e.g. [\"title\", \"@history\"]. */\nexport const HISTORY_SEGMENT = \"@history\";\n"],"mappings":";;AAmPA,IAAa,YAAyB,EAAE,MAAM,gBAAgB;;AAE9D,IAAa,iBAA8B;CAAE,MAAM;CAAe,MAAM;AAAgB;;AA8IxF,IAAa,kBAAkB"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/schema/types.ts"],"sourcesContent":["/**\n * BETTERCMS SCHEMA — the long-term contract for every editable thing (blocks, pages, entries, globals).\n * One schema language → one form engine (`@/components/kit`) → used by BOTH the Visuals inspector and the\n * Content document editor. Modelled on Sanity's schema (types, fieldsets, groups, previews, validation,\n * conditional fields) plus BetterCMS's block slots for nested layouts.\n *\n * Design principles (CPO D8):\n * - Scales to deep nesting without inline-accordion soup: arrays render compact preview rows; opening an item\n * DRILLS IN (panel slides, breadcrumb grows). Small objects may render inline; lightweight settings open in a POPOVER.\n * - Every field has the same chrome: label · help · required · validation · counter · ⋯ menu · presence · comments.\n * - Blocks can contain blocks (slots) → complex layouts (tabs, columns, bento, mega menus, carousels).\n */\n\nimport type { IconFieldOptions, RichTextFeature } from \"@bettercms-ai/types\";\nimport type { Cap } from \"./sources\";\nimport type { TableFieldOptions } from \"./table\";\n\nexport type PrimitiveType =\n | \"string\" // single line\n | \"text\" // multi line, auto-grow\n | \"richtext\" // portable-text style rich text\n | \"number\"\n | \"boolean\"\n | \"slug\"\n | \"url\"\n | \"email\"\n | \"date\"\n | \"datetime\"\n | \"color\"\n | \"select\" // options: single\n | \"multiselect\"\n | \"tags\"\n | \"image\"\n | \"file\"\n | \"video\"\n | \"icon\" // icon picker (Tabler name)\n | \"link\" // url | page ref + target + rel (one unit)\n | \"button\" // label + link + style (one unit — founder rule)\n | \"reference\" // to a collection entry / page / form\n | \"code\"\n | \"json\"\n | \"geopoint\"\n | \"rating\"\n | \"table\"; // typed columns × keyed rows (CPO D42) — value: TableValue (src/schema/table.ts)\n\nexport type CompoundType =\n | \"object\" // nested fields\n | \"array\" // list of `of` (objects, primitives or references)\n | \"slot\"; // list of nested BLOCKS (block-in-block layouts)\n\nexport type SchemaType = PrimitiveType | CompoundType;\n\nexport interface Option {\n value: string;\n label: string;\n icon?: string;\n description?: string;\n}\n\nexport interface Validation {\n required?: boolean;\n min?: number; // chars for strings, items for arrays, value for numbers\n max?: number;\n /** soft limit: warning (amber) instead of error — e.g. SEO title 60 */\n recommendedMax?: number;\n pattern?: string;\n patternMessage?: string;\n /**\n * No two values may be the same. A field inside a list item: unique among the list's items. A list of scalars or\n * references: no item twice. A root field: unique among the model's other records when the host passes them\n * (`SchemaForm` `uniquePeers`).\n */\n unique?: boolean;\n /** array of objects: items are unique by this item key (`uniqueBy: \"sku\"`), the same check as `unique` on that key. */\n uniqueBy?: string;\n}\n\n/**\n * A reference picker's filter, typed (V2 gap 27): only published records, and/or one field equal to a value. Production\n * stores a filter as a GROQ-style string (\"category == 'billing'\"), which `reference.filter` also takes as it is.\n */\nexport interface ReferenceFilter {\n /** \"published\": only records that have a live version (Published, or Published with changes) */\n status?: \"published\";\n /** a field of the target record (\"category\"); `title` and `slug` work too */\n field?: string;\n equals?: string | number | boolean;\n}\n\n/** How a compound field is edited when opened. */\nexport type OpenMode =\n | \"inline\" // render fields in place (small objects, ≤3 primitives)\n | \"drill\" // slide the panel to a child view; breadcrumb grows (default for array items & objects)\n | \"popover\" // anchored popover (link settings, image crop/alt, small option sets)\n | \"dialog\"; // centered modal for heavy editors (rich text full screen, code, table)\n\nexport interface PreviewConfig {\n /** dotted paths into the item value */\n title?: string;\n subtitle?: string;\n media?: string;\n /** Fallback label, e.g. \"Untitled question\" */\n fallback?: string;\n /** Tabler icon name (kebab-case, e.g. \"help-circle\") shown when there is no media. */\n icon?: string;\n}\n\n/** A condition's operator. Absent: `equals` reads as is / is one of, `notEmpty` as has a value. */\nexport type ConditionOp = \"is\" | \"isNot\" | \"in\" | \"notIn\" | \"empty\" | \"notEmpty\" | \"gt\" | \"lt\";\n\n/**\n * \"Show only when\" (V2 types.ts). The field shows only while the rule holds:\n * - `field` names a key beside it (default), in the object that holds those fields (`scope: \"parent\"`) or at the top of\n * the component or CMS item (`scope: \"root\"`). `_variant` is the component's variant (its first variant when unset).\n * - `op` + `value` (is · is not · is one of · is not one of · is empty · has a value · more than · less than). The legacy\n * `equals` / `notEmpty` forms still read the same.\n * - `also`: more rules, combined by `match` (\"all\", the default, or \"any\").\n */\nexport interface Condition {\n field: string;\n equals?: unknown | unknown[];\n notEmpty?: boolean;\n op?: ConditionOp;\n value?: unknown;\n scope?: \"parent\" | \"root\";\n also?: Condition[];\n match?: \"all\" | \"any\";\n}\n\nexport interface FieldSchema {\n name: string; // key in the value object\n title: string; // label (sentence case)\n type: SchemaType;\n /** Help text under the label (CPO D39). Unset → a house convention from `@/schema/help` may apply; \"\" = none. */\n description?: string;\n /** Longer explanation behind the ⓘ next to the label (tooltip). Use when one line can't carry it. */\n helpMore?: string;\n placeholder?: string;\n initialValue?: unknown;\n validation?: Validation;\n options?: Option[]; // select / multiselect / radio-like\n layout?: \"dropdown\" | \"radio\" | \"segmented\" | \"cards\" | \"switch\" | \"checkbox\" | \"slider\" | \"grid\" | \"list\";\n /** compound */\n fields?: FieldSchema[]; // object\n of?: FieldSchema[] | { type: \"block\"; allow?: string[] }; // array items / slot allowed block types\n openMode?: OpenMode;\n preview?: PreviewConfig;\n /** organisation */\n fieldset?: string; // groups fields into a collapsible fieldset\n group?: string; // which tab (Content / Media / Settings / SEO…)\n /** behaviour */\n hidden?: Condition | boolean;\n /** true = never editable in the form (computed or system values). Who may see or change a field is `access`. */\n readOnly?: boolean;\n /** Archived (V2 types.ts): kept in the schema and its values stay stored, but no form renders it. Schema editors show it. */\n archived?: boolean;\n /**\n * D58 field-level access. `view` missing → everyone who can open the form sees it; `edit` missing → the form's own\n * rule (the host's content.edit). A field the lens can't `view` is not rendered; one it can't `edit` renders as plain\n * text. Fields in the `seo` group default to `{ edit: \"seo.edit\" }`.\n */\n access?: FieldAccess;\n localized?: boolean;\n advanced?: boolean; // tucked into the \"Advanced\" fieldset by default (calm UX)\n ai?: boolean; // show the AI assist sparkle\n // reference targets (collection ids, \"page\", \"form\"); `noun`: what the picker calls one (\"author\": \"Select an author\",\n // \"Create new author\"), else the target's (\"CMS item\", \"page\", …)\n // `excludeId`: a record this picker never lists (the entry a rich-text island sits in, which its own form cannot see)\n reference?: { to: string[]; filter?: string | ReferenceFilter; noun?: string; excludeId?: string };\n numeric?: { unit?: string; step?: number; min?: number; max?: number }; // number / slider\n /** number: a developer-controlled SCALE (tokens or a stepped range) with an optional custom escape hatch (CPO D41).\n * Value shape → `ScaleValue`. Takes precedence over `layout: \"slider\"` + `numeric` (which still work, fixed-only). */\n scale?: ScaleSchema;\n /** table: column types allowed, developer-locked columns, row limits, caption rule, JSON-LD offered (CPO D42). */\n table?: TableFieldOptions;\n\n /* ── additive (Block Kit v1) ─────────────────────────────────────────── */\n /** Tabler icon name (kebab-case) used on rows, crumbs and the block picker. */\n icon?: string;\n /** text: minimum visible rows. */\n rows?: number;\n /** Value is synced from a global block (\"Navigation\") — edits apply everywhere it is used. */\n synced?: { from: string };\n /** slot: per-child layout settings stored on each child under `_settings` (e.g. bento span). */\n slotSettings?: FieldSchema[];\n /** array: singular noun for \"Add {noun}\" and empty states (\"question\"). Defaults from the item title. */\n itemNoun?: string;\n /** array: how rows render. \"grid\" = tiles (good for images / logos). */\n arrayLayout?: \"list\" | \"grid\";\n /**\n * The reason a locked field shows editors (\"Set by developers.\"). A field is LOCKED when it has `access.edit` (D58, the one\n * source of truth): people without that cap see the value read-only, with a small lock glyph and this line (D70).\n */\n lockReason?: string;\n /**\n * HELD (kit 3.2.0): the host cannot edit this field's stored value without changing it, so the form shows it read-only\n * inside the usual shell (label, help, the value as stored, and `reason` in words: \"it holds formatting this editor\n * cannot keep\") and never writes it. Unlike `readOnly` it names why. A value-dependent hold can come from\n * `KitServices.heldReason` instead; either one holds the field.\n */\n held?: { reason: string };\n /**\n * D70 \"Protect in schema\": the site's code depends on this field, so a schema editor refuses to rename its key, change\n * its type, archive or delete it (or a parent holding it) until someone unlocks it. Values and other settings still change.\n */\n protected?: boolean;\n /**\n * Host-only, never persisted: the list's ORDER is set by the site's code (identity rule 36). The rows stay editable;\n * drag and Move up / down are off and the grip slot shows a lock (V2 content/editor/page-sections.tsx:31,155).\n */\n orderLocked?: boolean;\n /** link / image / button: store a plain string (href or URL) instead of the object — for legacy data. */\n valueShape?: \"string\" | \"object\";\n /** image: an inline-SVG icon, which takes SVG files only (prod `config.media: \"icon\"`). */\n svgOnly?: boolean;\n /** icon (D65): where an icon may come from (set · library · upload) and whether it asks for a label (prod `config.icons`). */\n icons?: IconFieldOptions;\n /**\n * A link LABEL's href: the sibling it links with (prod `config.linkHref`), as the owner answered the editable plan's\n * `link-pair` question where the names do not say (`title` + `to`). Read first by `linkLabelHref`.\n */\n linkHref?: string;\n /**\n * date / datetime: time zone handling (CPO D43). true = the editor picks a zone (defaults to the site's) · \"site\" = always\n * the site's zone · \"fixed:<IANA>\" = always that zone · false = no zone. Default: true for datetime, false for date.\n * Zoned values store ISO with offset + the IANA zone: \"2026-10-14T09:00:00+05:30[Asia/Kolkata]\" (RFC 9557).\n */\n timezone?: boolean | \"site\" | `fixed:${string}`;\n /** code: the field's own language and the only languages its picker offers (prod config.language / languages). */\n language?: string;\n languages?: string[];\n /**\n * richtext / document: the blocks and marks the field offers, from types RICHTEXT_FEATURES (prod config.features).\n * Absent = all of them, as V2's rich text offers (normV2 folds the full set to absent). A schema read from JSON may\n * hold an alias (`headings`) or an unknown name: the adapter expands the one and names the other.\n */\n features?: RichTextFeature[];\n /**\n * richtext / document: the content models its related posts and author bios draw from (prod config.references,\n * plan RT8), by id. posts absent: the entry's own collection; authors absent: no author bio is offered.\n */\n references?: { posts?: string; authors?: string };\n}\n\n/** D58: the caps that let someone see / change one field. */\nexport interface FieldAccess {\n view?: Cap;\n edit?: Cap;\n}\n/** Developer-owned values (anchors, custom CSS, ids): only people who can change the schema edit them. */\nexport const DEV_FIELD: FieldAccess = { edit: \"schema.manage\" };\n/** Developer-only settings: hidden unless you can see the schema. */\nexport const DEV_ONLY_FIELD: FieldAccess = { view: \"schema.view\", edit: \"schema.manage\" };\n\n/* ── Scales (CPO D41) ─────────────────────────────────────────────────── */\nexport type ScaleUnit = \"px\" | \"%\" | \"rem\" | \"em\" | \"vw\" | \"vh\";\n\n/** One allowed value of a token scale. `value` is what is stored; `label` is the short readout (\"XL\"). */\nexport interface ScaleStep {\n value: string;\n label: string;\n /** Long name for screen readers and tooltips (\"Extra large\"). Defaults to `label`. */\n title?: string;\n /** Resolved size in px, shown as \"XL · 48px\" and used to place custom values on the track. */\n px?: number;\n /** Resolved CSS when it isn't px (e.g. \"100vh\", \"var(--space-xl)\"). */\n css?: string;\n}\n\n/** A stepped numeric range (continuous with snapping). The stored value is a bare number in `defaultUnit`. */\nexport interface ScaleRange {\n min: number;\n max: number;\n step?: number;\n}\n\n/** Bounds for the custom escape hatch. min / max may be one number or per unit ({ px: 0, \"%\": 0 }). */\nexport interface ScaleCustom {\n min?: number | Partial<Record<ScaleUnit, number>>;\n max?: number | Partial<Record<ScaleUnit, number>>;\n /** Units the editor may type. Defaults to the scale's `units`. */\n units?: ScaleUnit[];\n /** Arrow-key nudge (Shift ×10, Alt ×0.1). Default 1. */\n step?: number;\n}\n\nexport interface ScaleSchema {\n /** Token steps (S M L XL 2XL) or a numeric range ({ min, max, step }). */\n steps: ScaleStep[] | ScaleRange;\n /** Units of the scale; the first is the default. A range with no units is unitless. */\n units?: ScaleUnit[];\n defaultUnit?: ScaleUnit;\n /** false (default) = fixed only: the editor can pick only the allowed values. true / object = fixed + custom. */\n allowCustom?: boolean | ScaleCustom;\n /** Quick picks in the unit menu when custom is allowed (\"50%\", \"100vh\"). */\n presets?: { label?: string; value: ScaleValue }[];\n}\n\n/**\n * How a scale value is STORED — three shapes, told apart by `typeof`, so tokens and custom values never collide and\n * older data (bare token strings, bare numbers) is already valid:\n * - token → the step's value string (\"xl\")\n * - range → a bare number in the default unit (15 → 15%)\n * - custom → an object ({ value: 200, unit: \"px\" })\n */\nexport type ScaleValue = string | number | ScaleCustomValue;\nexport interface ScaleCustomValue {\n value: number;\n unit: ScaleUnit;\n}\n\nexport interface Fieldset {\n name: string;\n title: string;\n description?: string;\n collapsed?: boolean; // collapsed by default\n columns?: 1 | 2; // short fields side by side\n /** CPO D45: the header toggles the section (default true). false = a static heading for 2–3 fields that are always needed. */\n collapsible?: boolean;\n /**\n * CPO D45: \"breakpoints\" = the members are objects, one per screen size (desktop · tablet · phone), shown as ONE group with a\n * segmented switcher instead of three stacked groups. Sibling objects named desktop / laptop / tablet / mobile / phone get\n * this automatically.\n */\n layout?: \"stack\" | \"breakpoints\";\n}\n\nexport interface FieldGroup {\n name: string;\n title: string;\n icon?: string;\n default?: boolean;\n}\n\n/** A developer-defined layout of a block (swap without losing content). */\nexport interface BlockVariant {\n id: string;\n name: string;\n description?: string;\n}\n\n/** A document/block type. */\nexport interface TypeSchema {\n name: string; // e.g. \"hero\", \"journalStory\"\n title: string;\n kind: \"block\" | \"page\" | \"entry\" | \"global\" | \"object\";\n icon?: string;\n description?: string;\n fields: FieldSchema[];\n fieldsets?: Fieldset[];\n groups?: FieldGroup[];\n preview?: PreviewConfig;\n /* ── additive (Block Kit v1) ── */\n /** Block variants (layouts) — shown as a chip on slot rows and a switcher in the block frame. */\n variants?: BlockVariant[];\n /** Block picker category (\"Layout\", \"Content\", \"Media\"…). */\n category?: string;\n /**\n * kind \"block\" only (CPO D55): where the block fits. \"inline\" = it fits a text column, so a rich-text body lists it in\n * the Insert menu's Article group. \"section\" (default) = page-width, reachable in a body only through More components.\n * \"page\" = a whole page or a feed of other content; never inside a body.\n */\n placement?: \"inline\" | \"section\" | \"page\";\n /** Starting value for a new instance (block added to a slot, new document). */\n initialValue?: Record<string, unknown>;\n}\n\n/** Every array item / slot child carries a stable key. Slot children also carry their block type. */\nexport interface KeyedItem {\n _key?: string;\n /** item type name (arrays with several `of` types) or block type (slots) */\n _type?: string;\n}\n/** A block inside a slot: its own props at the root, plus variant and per-slot layout settings. */\nexport interface SlotChild extends KeyedItem {\n _type: string;\n _variant?: string;\n _settings?: Record<string, unknown>;\n [prop: string]: unknown;\n}\n\n/** Path from the root document/block to the field being edited, e.g. [\"items\", 1, \"answer\"] */\nexport type FieldPath = (string | number)[];\n\n/** One crumb in the inspector/editor breadcrumb (drill-in navigation stack). */\nexport interface Crumb {\n path: FieldPath;\n title: string;\n icon?: string;\n /** tableGroup / tableRow / tableColumn: a table field's rows and columns drill like array items (D50) */\n kind: \"root\" | \"object\" | \"item\" | \"block\" | \"button\" | \"history\" | \"tableGroup\" | \"tableRow\" | \"tableColumn\";\n}\n\n/** Reserved path segment: the field's version history as a stacked panel, e.g. [\"title\", \"@history\"]. */\nexport const HISTORY_SEGMENT = \"@history\";\n"],"mappings":";;AA0PA,IAAa,YAAyB,EAAE,MAAM,gBAAgB;;AAE9D,IAAa,iBAA8B;CAAE,MAAM;CAAe,MAAM;AAAgB;;AA8IxF,IAAa,kBAAkB"}