@bettercms-ai/kit 4.0.0 → 4.1.1

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.
Files changed (125) hide show
  1. package/dist/adapters/lossy.d.ts +4 -0
  2. package/dist/adapters/lossy.js +4 -0
  3. package/dist/adapters/lossy.js.map +1 -1
  4. package/dist/adapters/prod-types.d.ts +4 -0
  5. package/dist/adapters/prod-types.js +4 -1
  6. package/dist/adapters/prod-types.js.map +1 -1
  7. package/dist/adapters/schema.js +7 -0
  8. package/dist/adapters/schema.js.map +1 -1
  9. package/dist/context.d.ts +83 -0
  10. package/dist/context.js +58 -1
  11. package/dist/context.js.map +1 -1
  12. package/dist/controls/choice.d.ts +1 -1
  13. package/dist/controls/choice.js +21 -2
  14. package/dist/controls/choice.js.map +1 -1
  15. package/dist/controls/index.d.ts +1 -0
  16. package/dist/controls/index.js +3 -2
  17. package/dist/controls/index.js.map +1 -1
  18. package/dist/controls/link.d.ts +23 -2
  19. package/dist/controls/link.js +456 -4
  20. package/dist/controls/link.js.map +1 -1
  21. package/dist/controls/media-v16.d.ts +27 -0
  22. package/dist/controls/media-v16.js +261 -0
  23. package/dist/controls/media-v16.js.map +1 -0
  24. package/dist/controls/media.js +63 -1
  25. package/dist/controls/media.js.map +1 -1
  26. package/dist/controls/reference-services.d.ts +8 -0
  27. package/dist/controls/reference.js +78 -2
  28. package/dist/controls/reference.js.map +1 -1
  29. package/dist/controls/rich-text/ai-runs.d.ts +13 -0
  30. package/dist/controls/rich-text/ai-runs.js +71 -0
  31. package/dist/controls/rich-text/ai-runs.js.map +1 -0
  32. package/dist/controls/rich-text/block-tool.d.ts +31 -0
  33. package/dist/controls/rich-text/block-tool.js +62 -0
  34. package/dist/controls/rich-text/block-tool.js.map +1 -0
  35. package/dist/controls/rich-text/blocks.d.ts +6 -1
  36. package/dist/controls/rich-text/blocks.js +404 -24
  37. package/dist/controls/rich-text/blocks.js.map +1 -1
  38. package/dist/controls/rich-text/catalog.d.ts +21 -6
  39. package/dist/controls/rich-text/catalog.js +312 -23
  40. package/dist/controls/rich-text/catalog.js.map +1 -1
  41. package/dist/controls/rich-text/code-head.d.ts +30 -0
  42. package/dist/controls/rich-text/code-head.js +230 -0
  43. package/dist/controls/rich-text/code-head.js.map +1 -0
  44. package/dist/controls/rich-text/codec.d.ts +1 -1
  45. package/dist/controls/rich-text/codec.js +3 -1
  46. package/dist/controls/rich-text/codec.js.map +1 -1
  47. package/dist/controls/rich-text/dom.d.ts +27 -0
  48. package/dist/controls/rich-text/dom.js +69 -4
  49. package/dist/controls/rich-text/dom.js.map +1 -1
  50. package/dist/controls/rich-text/editor.js +212 -50
  51. package/dist/controls/rich-text/editor.js.map +1 -1
  52. package/dist/controls/rich-text/ops.js +1 -0
  53. package/dist/controls/rich-text/ops.js.map +1 -1
  54. package/dist/controls/rich-text/slash-preview.d.ts +8 -0
  55. package/dist/controls/rich-text/slash-preview.js +287 -0
  56. package/dist/controls/rich-text/slash-preview.js.map +1 -0
  57. package/dist/controls/rich-text/table-grid.d.ts +22 -0
  58. package/dist/controls/rich-text/table-grid.js +1052 -0
  59. package/dist/controls/rich-text/table-grid.js.map +1 -0
  60. package/dist/controls/rich-text/toolbar.js +60 -18
  61. package/dist/controls/rich-text/toolbar.js.map +1 -1
  62. package/dist/controls/text.d.ts +6 -0
  63. package/dist/controls/text.js +95 -5
  64. package/dist/controls/text.js.map +1 -1
  65. package/dist/core/facets.d.ts +1 -0
  66. package/dist/core/facets.js +1 -0
  67. package/dist/core/facets.js.map +1 -1
  68. package/dist/engine/array.d.ts +7 -0
  69. package/dist/engine/array.js +164 -45
  70. package/dist/engine/array.js.map +1 -1
  71. package/dist/engine/field-shell.d.ts +12 -0
  72. package/dist/engine/field-shell.js +217 -63
  73. package/dist/engine/field-shell.js.map +1 -1
  74. package/dist/engine/frame.js +39 -2
  75. package/dist/engine/frame.js.map +1 -1
  76. package/dist/engine/grouping.d.ts +71 -10
  77. package/dist/engine/grouping.js +223 -26
  78. package/dist/engine/grouping.js.map +1 -1
  79. package/dist/engine/kit-field.js +38 -4
  80. package/dist/engine/kit-field.js.map +1 -1
  81. package/dist/engine/schema-form.js +7 -2
  82. package/dist/engine/schema-form.js.map +1 -1
  83. package/dist/index.d.ts +1 -1
  84. package/dist/index.js +13 -6
  85. package/dist/index.js.map +1 -1
  86. package/dist/kit.css +85 -0
  87. package/dist/schema/table.d.ts +2 -1
  88. package/dist/schema/table.js +5 -0
  89. package/dist/schema/table.js.map +1 -1
  90. package/dist/schema/types.d.ts +6 -0
  91. package/dist/schema/types.js.map +1 -1
  92. package/dist/styles.css +1 -1
  93. package/dist/theme.css +115 -0
  94. package/dist/tokens.css +268 -0
  95. package/dist/ui/block-icon-picker.d.ts +38 -0
  96. package/dist/ui/block-icon-picker.js +141 -0
  97. package/dist/ui/block-icon-picker.js.map +1 -0
  98. package/dist/ui/button.js +1 -0
  99. package/dist/ui/button.js.map +1 -1
  100. package/dist/ui/code-language-menu.d.ts +24 -0
  101. package/dist/ui/code-language-menu.js +123 -0
  102. package/dist/ui/code-language-menu.js.map +1 -0
  103. package/dist/ui/content-fields.d.ts +47 -0
  104. package/dist/ui/content-fields.js +278 -0
  105. package/dist/ui/content-fields.js.map +1 -0
  106. package/dist/ui/foundations.d.ts +118 -0
  107. package/dist/ui/foundations.js +564 -0
  108. package/dist/ui/foundations.js.map +1 -0
  109. package/dist/ui/index.d.ts +6 -0
  110. package/dist/ui/index.js +7 -1
  111. package/dist/ui/inspector.d.ts +394 -0
  112. package/dist/ui/inspector.js +1173 -0
  113. package/dist/ui/inspector.js.map +1 -0
  114. package/dist/ui/overlay.d.ts +7 -2
  115. package/dist/ui/overlay.js +55 -20
  116. package/dist/ui/overlay.js.map +1 -1
  117. package/dist/ui/shortcut-hint.js +1 -1
  118. package/dist/ui/shortcut-hint.js.map +1 -1
  119. package/dist/ui/toast.d.ts +5 -3
  120. package/dist/ui/toast.js +83 -11
  121. package/dist/ui/toast.js.map +1 -1
  122. package/dist/ui/tooltip-card.d.ts +45 -0
  123. package/dist/ui/tooltip-card.js +135 -0
  124. package/dist/ui/tooltip-card.js.map +1 -0
  125. package/package.json +1 -1
@@ -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\";\nimport { FieldBoundary, HeldField } 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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,WAAqE,CAAC;;;;;;AAOnF,IAAa,UAAoE,CAAC;AAClF,IAAa,wCAAwB,IAAI,IAAgB,CAAC,MAAM,CAAC;;;AAIjE,SAAgB,eAAe,OAAoB;CACjD,MAAM,MAAM,UAAU;CACtB,OAAO,EAAE,UAAU,mBAAmB,OAAO,GAAG,CAAC,CAAC,SAAS;AAC7D;;AAGA,SAAgB,gBAAgB,OAAoB,aAAuB,UAAiC;CAC1G,IAAI;CAEJ,IAAI,YAAY,MAAM,YAAY,OAAO;EAAE,GAAG;EAAO,aAAa,MAAM,WAAW,QAAQ,QAAQ,GAAG;CAAE;CACxG,IAAI,MAAM,SAAS,UAAU,CAAC,aAAa,WAAW;MACjD,IAAI,MAAM,SAAS,YAAY,CAAC,MAAM,SAAS,MAAM,WAAW,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;AAQA,SAAgB,gBAAgB,OAAqB;CACnD,OACE,oBAAC,OAAD;EAAK,qBAAmB,MAAM,MAAM;EAAM,WAAU;EAClD,UAAA,oBAAC,aAAD,EAAa,GAAI,MAAQ,CAAA;CACtB,CAAA;AAET"}
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, IconLink, IconList, IconMail, IconPhoto, type Icon } 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, useKitLook, 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 { FieldActionsMenu, FieldShell } from \"./field-shell\";\nimport { FieldList } from \"./field-list\";\nimport { IssueDot, RowChrome } from \"./bits\";\nimport { FieldInset, FieldRun, ObjectGroup, groupSummary, useInsetDepth } from \"./grouping\";\nimport { SchemaForm } from \"./schema-form\";\nimport { SlotField } from \"./slot\";\nimport { JsonControl } from \"../controls/json\";\nimport { FieldBoundary, HeldField } 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\n/** The Object group's marker glyph, from what the object holds: an image → photo, an email → mail, a link → link. */\nfunction objectGlyph(fields: FieldSchema[]): Icon {\n const has = (...types: string[]) => fields.some((f) => types.includes(f.type));\n return has(\"image\", \"media\", \"gallery\") ? IconPhoto : has(\"email\") ? IconMail : has(\"url\", \"link\", \"button\") ? IconLink : IconList;\n}\n\nfunction ObjectField({ field, path }: { field: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const look = useKitLook();\n const env = useKitEnv();\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 /* Look \"v16\" (prototype inspector.jsx:376-381, 401-410; kit.css:43-47): an object at a frame's top level is an Object\n group: its header, the round marker with the object's glyph, the violet line, the fields 20 in. Deeper objects keep\n the inset (never a container in a container). */\n if (look === \"v16\" && depth === 0)\n return (\n <div data-field-key={pathKey(path)} data-field={path.length === 1 ? pathKey(path) : undefined} data-slot=\"kit-field\">\n <ObjectGroup\n icon={objectGlyph(fields)}\n title={field.title}\n sub={field.description}\n actions={env.fieldChrome === \"quiet\" || env.fieldChrome === \"preview\" ? null : <FieldActionsMenu field={field} path={path} value={value} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} />}\n >\n <FieldRun fields={visible} values={obj} columns={false} render={(f) => <KitField field={f} path={[...path, f.name]} parent={obj} />} />\n </ObjectGroup>\n </div>\n );\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,WAAqE,CAAC;;;;;;AAOnF,IAAa,UAAoE,CAAC;AAClF,IAAa,wCAAwB,IAAI,IAAgB,CAAC,MAAM,CAAC;;;AAIjE,SAAgB,eAAe,OAAoB;CACjD,MAAM,MAAM,UAAU;CACtB,OAAO,EAAE,UAAU,mBAAmB,OAAO,GAAG,CAAC,CAAC,SAAS;AAC7D;;AAGA,SAAgB,gBAAgB,OAAoB,aAAuB,UAAiC;CAC1G,IAAI;CAEJ,IAAI,YAAY,MAAM,YAAY,OAAO;EAAE,GAAG;EAAO,aAAa,MAAM,WAAW,QAAQ,QAAQ,GAAG;CAAE;CACxG,IAAI,MAAM,SAAS,UAAU,CAAC,aAAa,WAAW;MACjD,IAAI,MAAM,SAAS,YAAY,CAAC,MAAM,SAAS,MAAM,WAAW,YAAY,MAAM,SAAS,MAAM;EAGpG,MAAM,EAAE,KAAK,KAAK,SAAS,MAAM;EAEjC,WADa,KAAK,WAAW,GAAG,KAAM,OAAO,QAAQ,KAAK,SAAS,OAAO,GAAG,CAAC,KAC1D,OAAO,QAAQ,OAAO,OAAQ,KAAK,OAAO,QAAQ,OAAO,OAAO,WAAW,IAAI,OAAO,IAAI,GAAG,KAAK,KAAK,OAAO,OAAO,GAAG,IAAI,GAAG,KAAK,aAAa,SAAS,IAAI,GAAG,KAAK;CAC5L,OAAO,IAAI,MAAM,SAAS,YAAY,CAAC,MAAM,SAAS,MAAM,WAAW,aAAa,MAAM,SAAS,OAA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AS,YAAY,MAAM,KAAK,GAAG,OAAO,OAAQ,MAA8B,SAAS,EAAE;CACrG,OAAO,OAAO,UAAU,WAAW,KAAK,OAAO,KAAK;AACtD;AACA,SAAS,WAAW,EAAE,OAAO,OAAO,MAA0D;CAC5F,MAAM,OAAO,QAAQ,OAAO,KAAK;CACjC,OAEE,oBAAC,KAAD;EAAO;EAAI,UAAU;EAAG,MAAK;EAAQ,mBAAiB,GAAG,GAAG,SAAS;EAAM,aAAU;EAAY,WAAW,GAAG,2FAA2F,MAAM,SAAS,UAAU,MAAM,SAAS,UAAU,qCAAqC;EAC9R,UAAA,QAAQ,oBAAC,QAAD;GAAM,WAAU;GAAgB,UAAA;EAAW,CAAA;CACnD,CAAA;AAEP;;;;;;AAQA,SAAgB,gBAAgB,OAAqB;CACnD,OACE,oBAAC,OAAD;EAAK,qBAAmB,MAAM,MAAM;EAAM,WAAU;EAClD,UAAA,oBAAC,aAAD,EAAa,GAAI,MAAQ,CAAA;CACtB,CAAA;AAET"}
@@ -1,7 +1,7 @@
1
1
  import { getIn, isObj, keyStartsWith, pathEq, pathKey, same, setIn } from "../lib/path.js";
2
2
  import { condCtx, failingRules, isHidden } from "../lib/schema.js";
3
3
  import { cn } from "../lib/cn.js";
4
- import { DEFAULT_ENV, FormProvider, KitEnvProvider, fieldAccessOf, useForm, useKitEnv, visibleSchema } from "../context.js";
4
+ import { DEFAULT_ENV, FormProvider, KitEnvProvider, fieldAccessOf, useForm, useKitEnv, useKitLook, visibleSchema } from "../context.js";
5
5
  import { collectIssues } from "../lib/validate.js";
6
6
  import { FieldList, FieldSection } from "./grouping.js";
7
7
  import { ButtonScreen } from "../controls/button.js";
@@ -272,7 +272,12 @@ function SchemaForm({ schema: schemaIn, value, onChange, path: controlledPath, d
272
272
  ]);
273
273
  const issues = React.useMemo(() => new Map(issueList.map((i) => [i.key, i])), [issueList]);
274
274
  React.useEffect(() => onIssuesChange?.(issueList), [issueList, onIssuesChange]);
275
- const isVisible = React.useCallback((i) => showErrors || !!i.live || touched.has(i.key) || i.kind === "rule" && !editing.current.has(i.key), [showErrors, touched]);
275
+ const v16 = useKitLook() === "v16";
276
+ const isVisible = React.useCallback((i) => showErrors || !!i.live || touched.has(i.key) || i.kind === "rule" && !editing.current.has(i.key) || v16 && i.kind === "required", [
277
+ showErrors,
278
+ touched,
279
+ v16
280
+ ]);
276
281
  const api = {
277
282
  schema,
278
283
  value,
@@ -1 +1 @@
1
- {"version":3,"file":"schema-form.js","names":[],"sources":["../../src/engine/schema-form.tsx"],"sourcesContent":["/**\n * <SchemaForm> — the BetterCMS Block Kit form engine (V2 HEAD 9829bf1 kit/engine/schema-form.tsx). One schema in, one\n * value out; renders through the shared field chrome; owns validation visibility, per-field undo + history (coalesced\n * 900ms, 50 steps), the published baseline (changed dots, Reset to published) and the navigation path.\n *\n * <SchemaForm schema={faq} value={v} onChange={setV} variant=\"panel\" />\n *\n * `path` is controllable so a canvas can sync selection <-> breadcrumb both ways. Frames (root, drilled object, array\n * item, slot block, button, history) come from lib/frames `resolveFrames`; the drill-in stage, crumbs and keys\n * (Esc / Alt+Up/Down) from frame.tsx and breadcrumb.tsx; the layout of each frame from grouping.tsx through field-list.\n *\n * The host provides the kit scope (`data-kit-scope`) around the form; the form never declares one of its own, so a\n * dark host scope is never reset to light inside it.\n */\nimport * as React from \"react\";\nimport { cn } from \"../lib/cn\";\nimport type { Condition, FieldPath, FieldSchema, TypeSchema } from \"../schema/types\";\nimport { DEFAULT_ENV, fieldAccessOf, FormProvider, KitEnvProvider, useForm, useKitEnv, visibleSchema, type FormApi, type HistoryEntry, type KitEnv, type KitPeer, type Swatch } from \"../context\";\nimport { resolveFrames } from \"../lib/frames\";\nimport { getIn, isObj, keyStartsWith, pathEq, pathKey, same, setIn } from \"../lib/path\";\nimport { condCtx, failingRules, isHidden } from \"../lib/schema\";\nimport { collectIssues, type KitIssue, type UniquePeers } from \"../lib/validate\";\nimport { RowsHostContext } from \"./array\";\nimport { crumbSignature, FrameCrumbs, framesToCrumbs, type KitCrumb } from \"./breadcrumb\";\nimport { FieldList, type FieldListProps } from \"./field-list\";\nimport { FrameSlotsProvider, FrameStage, useFrameNavigation, type FrameSlots } from \"./frame\";\nimport { FieldList as GroupedFieldList, FieldSection } from \"./grouping\";\nimport { KitField, NestedForm } from \"./kit-field\";\nimport { TableFrame } from \"../controls/table/table\";\nimport { ButtonScreen } from \"../controls/button\";\n\nexport interface SchemaFormProps {\n schema: TypeSchema;\n value: Record<string, unknown>;\n onChange: (value: Record<string, unknown>) => void;\n /** controlled navigation path ([] = root). Omit for uncontrolled. */\n path?: FieldPath;\n defaultPath?: FieldPath;\n onPathChange?: (path: FieldPath) => void;\n /** \"panel\" = 320–420px inspector; \"document\" = the wide document editor column */\n variant?: \"panel\" | \"document\";\n /** resolve a block type (slot children) to its schema */\n resolveSchema?: (blockType: string) => TypeSchema | undefined;\n /** blocks offered by \"+ Add block\" (filtered by each slot's allow list) */\n blockLibrary?: TypeSchema[];\n /** the published version: enables changed dots and \"Reset to published\" */\n published?: Record<string, unknown>;\n /**\n * Component instance (CPO D28): values come from `from` unless a top-level key is in `overridden`. Overridden fields\n * get an accent dot + \"Reset\"; inherited ones read muted. `onReset(key)` drops one override.\n */\n inherited?: { from: string; overridden: string[]; onReset: (key: string) => void };\n /** pathKey → teammates in that field (\"items.1.answer\") */\n presence?: Record<string, KitPeer | KitPeer[]>;\n /** pathKey → open comment threads */\n comments?: Record<string, number>;\n /** host comment system. When set, the field comment chip opens the host's popover/panel instead of the kit's. */\n onComment?: KitEnv[\"onComment\"];\n /** \"Open {title}\" on a reference: the host opens the referenced entry (e.g. a stacked panel) */\n onOpenReference?: KitEnv[\"onOpenReference\"];\n /** D61: the host's Review changes markers (while its History panel is open) */\n review?: KitEnv[\"review\"];\n /** D61 field ⋯ › History: the host opens its History panel on this field (see `KitEnv.onFieldHistory`). Keep it stable. */\n onFieldHistory?: KitEnv[\"onFieldHistory\"];\n /** the whole form is read-only for the lens (fields with their own `access.edit` still follow `env.can`) */\n readOnly?: boolean;\n /** validate everything now (after a publish attempt) */\n showErrors?: boolean;\n /** document identity + site context */\n env?: {\n docId?: string;\n docTitle?: string;\n urlPrefix?: string;\n isPublished?: boolean;\n /** the slug is the document's address (KitEnv.slugIsAddress) */\n slugIsAddress?: boolean;\n palette?: Swatch[];\n syncedFrom?: string;\n /** D58: the host's access check (`useCan` at the host). Omitted → allow-all (staff tools, demos). */\n can?: KitEnv[\"can\"];\n /** CPO D39: \"tooltip\" moves help lines behind the ⓘ (dense hosts) */\n helpDisplay?: KitEnv[\"helpDisplay\"];\n /** \"quiet\" field chrome for meta-forms (see `KitEnv.fieldChrome`) */\n fieldChrome?: KitEnv[\"fieldChrome\"];\n /** the host's own controls by path key (see `KitEnv.controls`); keep it stable */\n controls?: KitEnv[\"controls\"];\n /** the host's chip summary for collapsed fieldsets (see `KitEnv.sectionSummary`); keep it stable */\n sectionSummary?: KitEnv[\"sectionSummary\"];\n };\n /**\n * Issues the host computes itself (a live check the schema can't express), merged with the form's own. A host issue on a\n * path the form already flags is dropped; `live` ones show while typing; `fix` adds one action after the message.\n */\n extraIssues?: KitIssue[];\n /** Root fields with `validation.unique`: the values the model's other records hold (V2). Absent: not checked. Keep it stable. */\n uniquePeers?: UniquePeers;\n /** The host's access check (V2 `KitEnv.can`), the same as `env.can`; `env.can` wins when both are set. */\n can?: KitEnv[\"can\"];\n /**\n * D70 (V2 `KitEnv.hiddenLine`): keep the fields that would leave the form in place as the host's line instead. `why`\n * says what hid it: \"rule\" (its condition doesn't hold for the current value) or \"access\" (the lens can't `view` it);\n * `failed` holds the rules that don't hold (\"Badge is not Sale\"), [] for access.\n * The schema preview draws its dashed \"Hidden for Editor\" / \"Hidden: …\" lines with it. Absent: hidden fields leave the\n * form, as in every editor. Keep it stable (a new function re-renders the form).\n */\n hiddenLine?: (field: FieldSchema, path: FieldPath, why: HiddenWhy, failed: Condition[]) => React.ReactNode;\n /** own scroll container (default: panel yes, document no) */\n scroll?: boolean;\n /** rendered above the breadcrumb (e.g. a block header) */\n header?: React.ReactNode;\n /** label of the root crumb (defaults to schema.title) */\n rootLabel?: string;\n /**\n * Host-owned trail (CPO D38): the form stops rendering its own breadcrumb and reports the drill-in crumbs\n * instead, so a host with its own path header shows ONE breadcrumb. Navigate with `onPathChange`. Called in a\n * layout effect, so the host header never lags a frame.\n */\n onCrumbs?: (crumbs: KitCrumb[]) => void;\n onIssuesChange?: (issues: KitIssue[]) => void;\n /** imperative navigation for hosts (e.g. a dialog's Escape: go up one level before closing) */\n navRef?: React.Ref<{ back: () => boolean }>;\n className?: string;\n}\n\nexport const COALESCE_MS = 900;\nexport const UNDO_STEPS = 50;\nconst HISTORY_ENTRIES = 30;\n\n/* The frame pieces other lanes own, handed to frame.tsx (which never imports them directly). ButtonScreen (link\n control) and TableFrame (table control) arrive with the controls lanes; until then the header title reads the\n button's label the way V2's `normLink(v).label` does.\n The getters read the imports at render, not at module evaluation: kit-field → array / field-list → schema-form →\n kit-field is a cycle, and an eager read would hit the TDZ the day one of them becomes a const or memo(). */\nconst buttonLabel = (v: unknown) => ({ label: isObj(v) && typeof v.label === \"string\" ? v.label : undefined });\nconst FRAME_SLOTS: FrameSlots = {\n get FieldList() {\n return FieldList;\n },\n get FieldSection() {\n return FieldSection;\n },\n get TableFrame() {\n return TableFrame;\n },\n get ButtonScreen() {\n return ButtonScreen;\n },\n normLink: buttonLabel,\n};\nconst ROWS_HOST = {\n get NestedForm() {\n return NestedForm;\n },\n};\n\n/* ── archived fields leave every form ───────────────────────────────── */\n/** Drop archived fields at every depth (V2 registry: \"What a form renders: archived fields left out (their values stay\n * stored)\"). Same object back when nothing is archived, so a form with none renders exactly as before. */\nfunction liveFields(fields: FieldSchema[]): FieldSchema[] {\n let changed = false;\n const out: FieldSchema[] = [];\n for (const f of fields) {\n if (f.archived) {\n changed = true;\n continue;\n }\n let g = f;\n if (f.fields) {\n const n = liveFields(f.fields);\n if (n !== f.fields) g = { ...g, fields: n };\n }\n if (Array.isArray(f.of)) {\n const n = liveFields(f.of);\n if (n !== f.of) g = { ...g, of: n };\n }\n if (f.slotSettings) {\n const n = liveFields(f.slotSettings);\n if (n !== f.slotSettings) g = { ...g, slotSettings: n };\n }\n if (g !== f) changed = true;\n out.push(g);\n }\n return changed ? out : fields;\n}\nfunction liveSchema(schema: TypeSchema): TypeSchema {\n const fields = liveFields(schema.fields);\n return fields === schema.fields ? schema : { ...schema, fields };\n}\n\n/* ── hiddenLine: hidden fields kept in place as the host's line ──────── */\nexport type HiddenWhy = \"rule\" | \"access\";\nconst GHOST = \"__ghost\";\ntype Ghost = { why: HiddenWhy; field: FieldSchema; failed: Condition[] };\ntype GhostField = FieldSchema & { [GHOST]?: Ghost };\nconst HiddenLineCtx = React.createContext<SchemaFormProps[\"hiddenLine\"]>(undefined);\n\n/** A stand-in that keeps a hidden field's place: no value rules, no condition, nothing to validate or drill into. */\nfunction ghostOf(f: FieldSchema, why: HiddenWhy, failed: Condition[] = []): GhostField {\n return { name: f.name, title: f.title, type: f.type === \"object\" || f.type === \"array\" || f.type === \"slot\" ? \"string\" : f.type, fieldset: f.fieldset, group: f.group, readOnly: true, [GHOST]: { why, field: f, failed } };\n}\n\n/** `visibleSchema`, except that a field the lens can't view stays as a ghost (top level and inside objects). */\nfunction lensGhosts(schema: TypeSchema, can: KitEnv[\"can\"]): TypeSchema {\n const walk = (fields: FieldSchema[]): FieldSchema[] =>\n fields.map((f) => {\n const a = fieldAccessOf(f);\n if (a?.view && !can(a.view)) return ghostOf(f, \"access\");\n return f.type === \"object\" && f.fields ? { ...f, fields: walk(f.fields) } : f;\n });\n return { ...schema, fields: walk(schema.fields) };\n}\n\n/** The frame's field list with condition-hidden fields kept as ghosts, every ghost drawn by the host's line. */\nfunction GhostFieldList(props: FieldListProps) {\n const form = useForm()!;\n const line = React.useContext(HiddenLineCtx)!;\n const raw = form.getAt(props.basePath);\n const parent = isObj(raw) ? raw : {};\n const cc = condCtx(form, props.basePath);\n const fields = props.fields.map((f) => ((f as GhostField)[GHOST] || f.hidden === true || !isHidden(f, parent, cc) ? f : ghostOf(f, \"rule\", failingRules(f, parent, cc))));\n return (\n <GroupedFieldList\n {...props}\n fields={fields}\n renderField={(f, path, p) => {\n const g = (f as GhostField)[GHOST];\n return g ? (\n <div data-field-key={pathKey(path)} data-ghost={g.why}>\n {line(g.field, path, g.why, g.failed)}\n </div>\n ) : (\n <KitField field={f} path={path} parent={p} />\n );\n }}\n />\n );\n}\nconst GHOST_SLOTS: FrameSlots = {\n get FieldList() {\n return GhostFieldList;\n },\n get FieldSection() {\n return FieldSection;\n },\n get TableFrame() {\n return TableFrame;\n },\n get ButtonScreen() {\n return ButtonScreen;\n },\n normLink: buttonLabel,\n};\n\nexport function SchemaForm({\n schema: schemaIn,\n value,\n onChange,\n path: controlledPath,\n defaultPath,\n onPathChange,\n variant = \"panel\",\n resolveSchema: resolveIn,\n blockLibrary,\n published,\n inherited,\n presence,\n comments,\n onComment,\n onOpenReference,\n review,\n onFieldHistory,\n readOnly,\n showErrors = false,\n env: envIn,\n scroll,\n header,\n rootLabel,\n onCrumbs,\n onIssuesChange,\n navRef,\n className,\n can: canIn,\n hiddenLine,\n extraIssues,\n uniquePeers,\n}: SchemaFormProps) {\n const outerCan = useKitEnv().can;\n const can = envIn?.can ?? canIn ?? outerCan; // a nested form (dialog object, article block) inherits its host form's check\n /* D58: fields the lens can't view are dropped from the schema here, once: not rendered, not validated (with\n `hiddenLine`, they stay as ghosts: a place and a line, still nothing to validate) */\n const schema = React.useMemo(() => {\n const live = liveSchema(schemaIn);\n return hiddenLine ? lensGhosts(live, can) : visibleSchema(live, can);\n }, [schemaIn, can, hiddenLine]);\n const resolveSchema = React.useMemo(\n () =>\n resolveIn\n ? (t: string) => {\n const s = resolveIn(t);\n return s && visibleSchema(liveSchema(s), can);\n }\n : undefined,\n [resolveIn, can],\n );\n const docId = envIn?.docId ?? schema.name;\n const ownScroll = scroll ?? variant === \"panel\";\n\n /* value + baseline */\n const valueRef = React.useRef(value);\n valueRef.current = value;\n const [baseline, setBaseline] = React.useState(value);\n const stacks = React.useRef(new Map<string, { path: FieldPath; values: unknown[]; at: number }>());\n const log = React.useRef(new Map<string, HistoryEntry[]>());\n const memory = React.useRef(new Map<string, unknown>());\n const [aiKeys, setAiKeys] = React.useState<Set<string>>(() => new Set());\n const [touched, setTouched] = React.useState<Set<string>>(() => new Set());\n const editing = React.useRef(new Set<string>());\n const [, bump] = React.useReducer((x: number) => x + 1, 0);\n React.useEffect(() => {\n setBaseline(valueRef.current);\n stacks.current.clear();\n log.current.clear();\n memory.current.clear();\n setTouched(new Set());\n setAiKeys(new Set());\n }, [docId]);\n\n /* navigation */\n const [innerPath, setInnerPath] = React.useState<FieldPath>(defaultPath ?? []);\n const rawPath = controlledPath ?? innerPath;\n const { frames, path } = React.useMemo(() => resolveFrames(schema, value, rawPath, resolveSchema), [schema, value, rawPath, resolveSchema]);\n const navigate = React.useCallback(\n (p: FieldPath) => {\n if (controlledPath === undefined) setInnerPath(p);\n onPathChange?.(p);\n },\n [controlledPath, onPathChange],\n );\n /* a path that no longer resolves (a removed item, a hidden field) settles on the deepest frame that does */\n React.useEffect(() => {\n if (!pathEq(path, rawPath)) navigate(path);\n }, [path, rawPath, navigate]);\n /* V2: a new document starts at its root (an uncontrolled path never carries the last document's drill or history).\n Skips the mount run so `defaultPath` survives. */\n const lastDoc = React.useRef(docId);\n React.useEffect(() => {\n if (lastDoc.current === docId) return;\n lastDoc.current = docId;\n if (controlledPath === undefined) setInnerPath([]);\n }, [docId]); // eslint-disable-line react-hooks/exhaustive-deps\n\n /* writes */\n const setAt = React.useCallback<FormApi[\"setAt\"]>(\n (p, v, opts) => {\n const prev = getIn(valueRef.current, p);\n if (same(prev, v)) return;\n const key = pathKey(p);\n if (opts?.record !== false) {\n const now = Date.now();\n const st = stacks.current.get(key) ?? { path: p, values: [], at: 0 };\n if (!st.values.length || now - st.at > COALESCE_MS) st.values = [...st.values, prev].slice(-UNDO_STEPS);\n st.at = now;\n stacks.current.set(key, st);\n const h = log.current.get(key) ?? [];\n const entry: HistoryEntry = { value: v, at: now, by: \"You\", label: opts?.label };\n log.current.set(key, h.length && now - h[0].at < COALESCE_MS && !opts?.label ? [entry, ...h.slice(1)] : [entry, ...h].slice(0, HISTORY_ENTRIES));\n editing.current.add(key);\n }\n const next = setIn(valueRef.current, p, v);\n valueRef.current = next;\n onChange(next);\n },\n [onChange],\n );\n\n /* validation */\n const issueList = React.useMemo(() => {\n // the variant the form draws: the value's own, else the schema's first (as condCtx reads it for rendering)\n const variant = typeof value._variant === \"string\" ? value._variant : schema.variants?.[0]?.id;\n const own = collectIssues(schema.fields, value, [], resolveSchema, [], { root: value, variant }, uniquePeers);\n return extraIssues?.length ? [...own, ...extraIssues.filter((x) => !own.some((o) => o.key === x.key))] : own;\n }, [schema, value, resolveSchema, extraIssues, uniquePeers]);\n const issues = React.useMemo(() => new Map(issueList.map((i) => [i.key, i])), [issueList]);\n React.useEffect(() => onIssuesChange?.(issueList), [issueList, onIssuesChange]);\n const isVisible = React.useCallback(\n (i: KitIssue) => showErrors || !!i.live || touched.has(i.key) || (i.kind === \"rule\" && !editing.current.has(i.key)),\n [showErrors, touched],\n );\n\n const api: FormApi = {\n schema,\n value,\n setAt,\n getAt: (p) => getIn(value, p),\n baselineAt: (p) => getIn(baseline, p),\n publishedAt: (p) => getIn(published, p),\n hasPublished: !!published,\n inherited: inherited ? { from: inherited.from, isOverridden: (k) => inherited.overridden.includes(k), reset: inherited.onReset } : undefined,\n path,\n navigate,\n canNavigate: true,\n resolveSchema,\n blockLibrary,\n issues,\n visibleIssue: (k) => {\n const i = issues.get(k);\n return i && isVisible(i) ? i : undefined;\n },\n rollup: (prefix) => {\n const pk = pathKey(prefix);\n let errors = 0;\n let warnings = 0;\n for (const i of issueList) if (keyStartsWith(i.key, pk) && isVisible(i)) i.level === \"error\" ? errors++ : warnings++;\n return { errors, warnings };\n },\n touch: (k) => {\n editing.current.delete(k);\n if (!touched.has(k)) setTouched((s) => new Set(s).add(k));\n },\n showAllErrors: showErrors,\n canUndo: (k) => !!stacks.current.get(k)?.values.length,\n undo: (k) => {\n const st = stacks.current.get(k);\n if (!st?.values.length) return;\n const prev = st.values[st.values.length - 1];\n st.values = st.values.slice(0, -1);\n st.at = 0;\n const next = setIn(valueRef.current, st.path, prev);\n valueRef.current = next;\n onChange(next);\n bump();\n },\n history: (k) => log.current.get(k) ?? [],\n aiKeys,\n markAi: (k, on) =>\n setAiKeys((s) => {\n const n = new Set(s);\n if (on) n.add(k);\n else n.delete(k);\n return n;\n }),\n memory: memory.current,\n };\n\n const normPresence = React.useMemo(() => {\n const out: Record<string, KitPeer[]> = {};\n for (const [k, v] of Object.entries(presence ?? {})) out[k] = Array.isArray(v) ? v : [v];\n return out;\n }, [presence]);\n const env: KitEnv = React.useMemo(\n () => ({\n ...DEFAULT_ENV,\n variant,\n docId,\n docTitle: envIn?.docTitle,\n urlPrefix: envIn?.urlPrefix,\n /* a published copy proves \"live\"; its absence proves nothing (the dock has none), so it stays unknown */\n isPublished: envIn?.isPublished ?? (published ? true : undefined),\n slugIsAddress: envIn?.slugIsAddress,\n palette: envIn?.palette ?? DEFAULT_ENV.palette,\n readOnly: !!readOnly,\n can,\n presence: normPresence,\n comments: comments ?? {},\n onComment,\n onOpenReference,\n syncedFrom: envIn?.syncedFrom,\n helpDisplay: envIn?.helpDisplay,\n review,\n onFieldHistory,\n fieldChrome: envIn?.fieldChrome,\n controls: envIn?.controls,\n sectionSummary: envIn?.sectionSummary,\n }),\n [variant, docId, envIn?.docTitle, envIn?.urlPrefix, envIn?.isPublished, envIn?.slugIsAddress, envIn?.palette, envIn?.syncedFrom, envIn?.helpDisplay, envIn?.fieldChrome, envIn?.controls, envIn?.sectionSummary, published, readOnly, can, normPresence, comments, onComment, onOpenReference, review, onFieldHistory],\n );\n\n React.useImperativeHandle(\n navRef,\n () => ({\n back: () => {\n if (frames.length < 2) return false;\n navigate(frames[frames.length - 2].path);\n return true;\n },\n }),\n [frames, navigate],\n );\n\n /* drill-in stage: direction-aware slide, scroll memory, focus on the entering frame, Esc / Alt+Up/Down */\n const root = React.useRef<HTMLDivElement>(null);\n const scroller = React.useRef<HTMLDivElement>(null);\n const nav = useFrameNavigation({ frames, navigate, root, scroller });\n\n const crumbs = framesToCrumbs(frames, schema, api.rollup, rootLabel);\n const crumbSig = crumbSignature(crumbs);\n const onCrumbsRef = React.useRef(onCrumbs);\n onCrumbsRef.current = onCrumbs;\n React.useLayoutEffect(() => {\n onCrumbsRef.current?.(crumbs);\n }, [crumbSig]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const syncedNote = envIn?.syncedFrom ? (\n <p className=\"mb-5 flex items-start gap-2 rounded-kit-lg bg-kit-info-soft px-3 py-2 text-kit-xs text-kit-info-fg\">\n <span className=\"mt-0.5 size-1.5 shrink-0 rounded-full bg-kit-info\" aria-hidden />\n <span>\n Synced from <span className=\"font-medium\">{envIn.syncedFrom}</span>. Changes here apply on every page that uses it.\n </span>\n </p>\n ) : null;\n const body = <FrameStage review={!!review} frames={frames} frameKey={nav.frameKey} dir={nav.dir} rootLabel={rootLabel ?? schema.title} variant={variant} before={syncedNote} />;\n\n return (\n <KitEnvProvider value={env}>\n <FormProvider value={api}>\n <HiddenLineCtx.Provider value={hiddenLine}>\n <FrameSlotsProvider value={hiddenLine ? GHOST_SLOTS : FRAME_SLOTS}>\n <RowsHostContext.Provider value={ROWS_HOST}>\n <div\n ref={root}\n onKeyDown={(e) => {\n nav.onKeyDown(e);\n // DK-010: Backspace / Delete pressed on a control that is not a text box (a button, chip, switch, option)\n // ends here. A host that deletes its selection on those keys must never hear them from inside the form.\n const t = e.target as HTMLElement;\n if ((e.key === \"Backspace\" || e.key === \"Delete\") && !e.metaKey && !e.ctrlKey && !e.altKey && !(t.matches(\"input,textarea,select\") || t.isContentEditable)) e.stopPropagation();\n }}\n className={cn(\"flex min-h-0 min-w-0 flex-col\", ownScroll && \"h-full\", className)} data-kit-form={schema.name}>\n {header}\n {onCrumbs ? null : <FrameCrumbs crumbs={crumbs} onNavigate={navigate} variant={variant} />}\n {ownScroll ? (\n <div ref={scroller} className=\"@container min-h-0 flex-1 overflow-y-auto overscroll-contain\">\n {body}\n </div>\n ) : (\n <div className=\"@container\">{body}</div>\n )}\n </div>\n </RowsHostContext.Provider>\n </FrameSlotsProvider>\n </HiddenLineCtx.Provider>\n </FormProvider>\n </KitEnvProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4HA,IAAa,cAAc;AAC3B,IAAa,aAAa;AAC1B,IAAM,kBAAkB;AAOxB,IAAM,eAAe,OAAgB,EAAE,OAAO,MAAM,CAAC,KAAK,OAAO,EAAE,UAAU,WAAW,EAAE,QAAQ,KAAA,EAAU;AAC5G,IAAM,cAA0B;CAC9B,IAAI,YAAY;EACd,OAAO;CACT;CACA,IAAI,eAAe;EACjB,OAAO;CACT;CACA,IAAI,aAAa;EACf,OAAO;CACT;CACA,IAAI,eAAe;EACjB,OAAO;CACT;CACA,UAAU;AACZ;AACA,IAAM,YAAY,EAChB,IAAI,aAAa;CACf,OAAO;AACT,EACF;;;AAKA,SAAS,WAAW,QAAsC;CACxD,IAAI,UAAU;CACd,MAAM,MAAqB,CAAC;CAC5B,KAAK,MAAM,KAAK,QAAQ;EACtB,IAAI,EAAE,UAAU;GACd,UAAU;GACV;EACF;EACA,IAAI,IAAI;EACR,IAAI,EAAE,QAAQ;GACZ,MAAM,IAAI,WAAW,EAAE,MAAM;GAC7B,IAAI,MAAM,EAAE,QAAQ,IAAI;IAAE,GAAG;IAAG,QAAQ;GAAE;EAC5C;EACA,IAAI,MAAM,QAAQ,EAAE,EAAE,GAAG;GACvB,MAAM,IAAI,WAAW,EAAE,EAAE;GACzB,IAAI,MAAM,EAAE,IAAI,IAAI;IAAE,GAAG;IAAG,IAAI;GAAE;EACpC;EACA,IAAI,EAAE,cAAc;GAClB,MAAM,IAAI,WAAW,EAAE,YAAY;GACnC,IAAI,MA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],"sourcesContent":["/**\n * <SchemaForm> — the BetterCMS Block Kit form engine (V2 HEAD 9829bf1 kit/engine/schema-form.tsx). One schema in, one\n * value out; renders through the shared field chrome; owns validation visibility, per-field undo + history (coalesced\n * 900ms, 50 steps), the published baseline (changed dots, Reset to published) and the navigation path.\n *\n * <SchemaForm schema={faq} value={v} onChange={setV} variant=\"panel\" />\n *\n * `path` is controllable so a canvas can sync selection <-> breadcrumb both ways. Frames (root, drilled object, array\n * item, slot block, button, history) come from lib/frames `resolveFrames`; the drill-in stage, crumbs and keys\n * (Esc / Alt+Up/Down) from frame.tsx and breadcrumb.tsx; the layout of each frame from grouping.tsx through field-list.\n *\n * The host provides the kit scope (`data-kit-scope`) around the form; the form never declares one of its own, so a\n * dark host scope is never reset to light inside it.\n */\nimport * as React from \"react\";\nimport { cn } from \"../lib/cn\";\nimport type { Condition, FieldPath, FieldSchema, TypeSchema } from \"../schema/types\";\nimport { DEFAULT_ENV, fieldAccessOf, FormProvider, KitEnvProvider, useForm, useKitEnv, useKitLook, visibleSchema, type FormApi, type HistoryEntry, type KitEnv, type KitPeer, type Swatch } from \"../context\";\nimport { resolveFrames } from \"../lib/frames\";\nimport { getIn, isObj, keyStartsWith, pathEq, pathKey, same, setIn } from \"../lib/path\";\nimport { condCtx, failingRules, isHidden } from \"../lib/schema\";\nimport { collectIssues, type KitIssue, type UniquePeers } from \"../lib/validate\";\nimport { RowsHostContext } from \"./array\";\nimport { crumbSignature, FrameCrumbs, framesToCrumbs, type KitCrumb } from \"./breadcrumb\";\nimport { FieldList, type FieldListProps } from \"./field-list\";\nimport { FrameSlotsProvider, FrameStage, useFrameNavigation, type FrameSlots } from \"./frame\";\nimport { FieldList as GroupedFieldList, FieldSection } from \"./grouping\";\nimport { KitField, NestedForm } from \"./kit-field\";\nimport { TableFrame } from \"../controls/table/table\";\nimport { ButtonScreen } from \"../controls/button\";\n\nexport interface SchemaFormProps {\n schema: TypeSchema;\n value: Record<string, unknown>;\n onChange: (value: Record<string, unknown>) => void;\n /** controlled navigation path ([] = root). Omit for uncontrolled. */\n path?: FieldPath;\n defaultPath?: FieldPath;\n onPathChange?: (path: FieldPath) => void;\n /** \"panel\" = 320–420px inspector; \"document\" = the wide document editor column */\n variant?: \"panel\" | \"document\";\n /** resolve a block type (slot children) to its schema */\n resolveSchema?: (blockType: string) => TypeSchema | undefined;\n /** blocks offered by \"+ Add block\" (filtered by each slot's allow list) */\n blockLibrary?: TypeSchema[];\n /** the published version: enables changed dots and \"Reset to published\" */\n published?: Record<string, unknown>;\n /**\n * Component instance (CPO D28): values come from `from` unless a top-level key is in `overridden`. Overridden fields\n * get an accent dot + \"Reset\"; inherited ones read muted. `onReset(key)` drops one override.\n */\n inherited?: { from: string; overridden: string[]; onReset: (key: string) => void };\n /** pathKey → teammates in that field (\"items.1.answer\") */\n presence?: Record<string, KitPeer | KitPeer[]>;\n /** pathKey → open comment threads */\n comments?: Record<string, number>;\n /** host comment system. When set, the field comment chip opens the host's popover/panel instead of the kit's. */\n onComment?: KitEnv[\"onComment\"];\n /** \"Open {title}\" on a reference: the host opens the referenced entry (e.g. a stacked panel) */\n onOpenReference?: KitEnv[\"onOpenReference\"];\n /** D61: the host's Review changes markers (while its History panel is open) */\n review?: KitEnv[\"review\"];\n /** D61 field ⋯ › History: the host opens its History panel on this field (see `KitEnv.onFieldHistory`). Keep it stable. */\n onFieldHistory?: KitEnv[\"onFieldHistory\"];\n /** the whole form is read-only for the lens (fields with their own `access.edit` still follow `env.can`) */\n readOnly?: boolean;\n /** validate everything now (after a publish attempt) */\n showErrors?: boolean;\n /** document identity + site context */\n env?: {\n docId?: string;\n docTitle?: string;\n urlPrefix?: string;\n isPublished?: boolean;\n /** the slug is the document's address (KitEnv.slugIsAddress) */\n slugIsAddress?: boolean;\n palette?: Swatch[];\n syncedFrom?: string;\n /** D58: the host's access check (`useCan` at the host). Omitted → allow-all (staff tools, demos). */\n can?: KitEnv[\"can\"];\n /** CPO D39: \"tooltip\" moves help lines behind the ⓘ (dense hosts) */\n helpDisplay?: KitEnv[\"helpDisplay\"];\n /** \"quiet\" field chrome for meta-forms (see `KitEnv.fieldChrome`) */\n fieldChrome?: KitEnv[\"fieldChrome\"];\n /** the host's own controls by path key (see `KitEnv.controls`); keep it stable */\n controls?: KitEnv[\"controls\"];\n /** the host's chip summary for collapsed fieldsets (see `KitEnv.sectionSummary`); keep it stable */\n sectionSummary?: KitEnv[\"sectionSummary\"];\n };\n /**\n * Issues the host computes itself (a live check the schema can't express), merged with the form's own. A host issue on a\n * path the form already flags is dropped; `live` ones show while typing; `fix` adds one action after the message.\n */\n extraIssues?: KitIssue[];\n /** Root fields with `validation.unique`: the values the model's other records hold (V2). Absent: not checked. Keep it stable. */\n uniquePeers?: UniquePeers;\n /** The host's access check (V2 `KitEnv.can`), the same as `env.can`; `env.can` wins when both are set. */\n can?: KitEnv[\"can\"];\n /**\n * D70 (V2 `KitEnv.hiddenLine`): keep the fields that would leave the form in place as the host's line instead. `why`\n * says what hid it: \"rule\" (its condition doesn't hold for the current value) or \"access\" (the lens can't `view` it);\n * `failed` holds the rules that don't hold (\"Badge is not Sale\"), [] for access.\n * The schema preview draws its dashed \"Hidden for Editor\" / \"Hidden: …\" lines with it. Absent: hidden fields leave the\n * form, as in every editor. Keep it stable (a new function re-renders the form).\n */\n hiddenLine?: (field: FieldSchema, path: FieldPath, why: HiddenWhy, failed: Condition[]) => React.ReactNode;\n /** own scroll container (default: panel yes, document no) */\n scroll?: boolean;\n /** rendered above the breadcrumb (e.g. a block header) */\n header?: React.ReactNode;\n /** label of the root crumb (defaults to schema.title) */\n rootLabel?: string;\n /**\n * Host-owned trail (CPO D38): the form stops rendering its own breadcrumb and reports the drill-in crumbs\n * instead, so a host with its own path header shows ONE breadcrumb. Navigate with `onPathChange`. Called in a\n * layout effect, so the host header never lags a frame.\n */\n onCrumbs?: (crumbs: KitCrumb[]) => void;\n onIssuesChange?: (issues: KitIssue[]) => void;\n /** imperative navigation for hosts (e.g. a dialog's Escape: go up one level before closing) */\n navRef?: React.Ref<{ back: () => boolean }>;\n className?: string;\n}\n\nexport const COALESCE_MS = 900;\nexport const UNDO_STEPS = 50;\nconst HISTORY_ENTRIES = 30;\n\n/* The frame pieces other lanes own, handed to frame.tsx (which never imports them directly). ButtonScreen (link\n control) and TableFrame (table control) arrive with the controls lanes; until then the header title reads the\n button's label the way V2's `normLink(v).label` does.\n The getters read the imports at render, not at module evaluation: kit-field → array / field-list → schema-form →\n kit-field is a cycle, and an eager read would hit the TDZ the day one of them becomes a const or memo(). */\nconst buttonLabel = (v: unknown) => ({ label: isObj(v) && typeof v.label === \"string\" ? v.label : undefined });\nconst FRAME_SLOTS: FrameSlots = {\n get FieldList() {\n return FieldList;\n },\n get FieldSection() {\n return FieldSection;\n },\n get TableFrame() {\n return TableFrame;\n },\n get ButtonScreen() {\n return ButtonScreen;\n },\n normLink: buttonLabel,\n};\nconst ROWS_HOST = {\n get NestedForm() {\n return NestedForm;\n },\n};\n\n/* ── archived fields leave every form ───────────────────────────────── */\n/** Drop archived fields at every depth (V2 registry: \"What a form renders: archived fields left out (their values stay\n * stored)\"). Same object back when nothing is archived, so a form with none renders exactly as before. */\nfunction liveFields(fields: FieldSchema[]): FieldSchema[] {\n let changed = false;\n const out: FieldSchema[] = [];\n for (const f of fields) {\n if (f.archived) {\n changed = true;\n continue;\n }\n let g = f;\n if (f.fields) {\n const n = liveFields(f.fields);\n if (n !== f.fields) g = { ...g, fields: n };\n }\n if (Array.isArray(f.of)) {\n const n = liveFields(f.of);\n if (n !== f.of) g = { ...g, of: n };\n }\n if (f.slotSettings) {\n const n = liveFields(f.slotSettings);\n if (n !== f.slotSettings) g = { ...g, slotSettings: n };\n }\n if (g !== f) changed = true;\n out.push(g);\n }\n return changed ? out : fields;\n}\nfunction liveSchema(schema: TypeSchema): TypeSchema {\n const fields = liveFields(schema.fields);\n return fields === schema.fields ? schema : { ...schema, fields };\n}\n\n/* ── hiddenLine: hidden fields kept in place as the host's line ──────── */\nexport type HiddenWhy = \"rule\" | \"access\";\nconst GHOST = \"__ghost\";\ntype Ghost = { why: HiddenWhy; field: FieldSchema; failed: Condition[] };\ntype GhostField = FieldSchema & { [GHOST]?: Ghost };\nconst HiddenLineCtx = React.createContext<SchemaFormProps[\"hiddenLine\"]>(undefined);\n\n/** A stand-in that keeps a hidden field's place: no value rules, no condition, nothing to validate or drill into. */\nfunction ghostOf(f: FieldSchema, why: HiddenWhy, failed: Condition[] = []): GhostField {\n return { name: f.name, title: f.title, type: f.type === \"object\" || f.type === \"array\" || f.type === \"slot\" ? \"string\" : f.type, fieldset: f.fieldset, group: f.group, readOnly: true, [GHOST]: { why, field: f, failed } };\n}\n\n/** `visibleSchema`, except that a field the lens can't view stays as a ghost (top level and inside objects). */\nfunction lensGhosts(schema: TypeSchema, can: KitEnv[\"can\"]): TypeSchema {\n const walk = (fields: FieldSchema[]): FieldSchema[] =>\n fields.map((f) => {\n const a = fieldAccessOf(f);\n if (a?.view && !can(a.view)) return ghostOf(f, \"access\");\n return f.type === \"object\" && f.fields ? { ...f, fields: walk(f.fields) } : f;\n });\n return { ...schema, fields: walk(schema.fields) };\n}\n\n/** The frame's field list with condition-hidden fields kept as ghosts, every ghost drawn by the host's line. */\nfunction GhostFieldList(props: FieldListProps) {\n const form = useForm()!;\n const line = React.useContext(HiddenLineCtx)!;\n const raw = form.getAt(props.basePath);\n const parent = isObj(raw) ? raw : {};\n const cc = condCtx(form, props.basePath);\n const fields = props.fields.map((f) => ((f as GhostField)[GHOST] || f.hidden === true || !isHidden(f, parent, cc) ? f : ghostOf(f, \"rule\", failingRules(f, parent, cc))));\n return (\n <GroupedFieldList\n {...props}\n fields={fields}\n renderField={(f, path, p) => {\n const g = (f as GhostField)[GHOST];\n return g ? (\n <div data-field-key={pathKey(path)} data-ghost={g.why}>\n {line(g.field, path, g.why, g.failed)}\n </div>\n ) : (\n <KitField field={f} path={path} parent={p} />\n );\n }}\n />\n );\n}\nconst GHOST_SLOTS: FrameSlots = {\n get FieldList() {\n return GhostFieldList;\n },\n get FieldSection() {\n return FieldSection;\n },\n get TableFrame() {\n return TableFrame;\n },\n get ButtonScreen() {\n return ButtonScreen;\n },\n normLink: buttonLabel,\n};\n\nexport function SchemaForm({\n schema: schemaIn,\n value,\n onChange,\n path: controlledPath,\n defaultPath,\n onPathChange,\n variant = \"panel\",\n resolveSchema: resolveIn,\n blockLibrary,\n published,\n inherited,\n presence,\n comments,\n onComment,\n onOpenReference,\n review,\n onFieldHistory,\n readOnly,\n showErrors = false,\n env: envIn,\n scroll,\n header,\n rootLabel,\n onCrumbs,\n onIssuesChange,\n navRef,\n className,\n can: canIn,\n hiddenLine,\n extraIssues,\n uniquePeers,\n}: SchemaFormProps) {\n const outerCan = useKitEnv().can;\n const can = envIn?.can ?? canIn ?? outerCan; // a nested form (dialog object, article block) inherits its host form's check\n /* D58: fields the lens can't view are dropped from the schema here, once: not rendered, not validated (with\n `hiddenLine`, they stay as ghosts: a place and a line, still nothing to validate) */\n const schema = React.useMemo(() => {\n const live = liveSchema(schemaIn);\n return hiddenLine ? lensGhosts(live, can) : visibleSchema(live, can);\n }, [schemaIn, can, hiddenLine]);\n const resolveSchema = React.useMemo(\n () =>\n resolveIn\n ? (t: string) => {\n const s = resolveIn(t);\n return s && visibleSchema(liveSchema(s), can);\n }\n : undefined,\n [resolveIn, can],\n );\n const docId = envIn?.docId ?? schema.name;\n const ownScroll = scroll ?? variant === \"panel\";\n\n /* value + baseline */\n const valueRef = React.useRef(value);\n valueRef.current = value;\n const [baseline, setBaseline] = React.useState(value);\n const stacks = React.useRef(new Map<string, { path: FieldPath; values: unknown[]; at: number }>());\n const log = React.useRef(new Map<string, HistoryEntry[]>());\n const memory = React.useRef(new Map<string, unknown>());\n const [aiKeys, setAiKeys] = React.useState<Set<string>>(() => new Set());\n const [touched, setTouched] = React.useState<Set<string>>(() => new Set());\n const editing = React.useRef(new Set<string>());\n const [, bump] = React.useReducer((x: number) => x + 1, 0);\n React.useEffect(() => {\n setBaseline(valueRef.current);\n stacks.current.clear();\n log.current.clear();\n memory.current.clear();\n setTouched(new Set());\n setAiKeys(new Set());\n }, [docId]);\n\n /* navigation */\n const [innerPath, setInnerPath] = React.useState<FieldPath>(defaultPath ?? []);\n const rawPath = controlledPath ?? innerPath;\n const { frames, path } = React.useMemo(() => resolveFrames(schema, value, rawPath, resolveSchema), [schema, value, rawPath, resolveSchema]);\n const navigate = React.useCallback(\n (p: FieldPath) => {\n if (controlledPath === undefined) setInnerPath(p);\n onPathChange?.(p);\n },\n [controlledPath, onPathChange],\n );\n /* a path that no longer resolves (a removed item, a hidden field) settles on the deepest frame that does */\n React.useEffect(() => {\n if (!pathEq(path, rawPath)) navigate(path);\n }, [path, rawPath, navigate]);\n /* V2: a new document starts at its root (an uncontrolled path never carries the last document's drill or history).\n Skips the mount run so `defaultPath` survives. */\n const lastDoc = React.useRef(docId);\n React.useEffect(() => {\n if (lastDoc.current === docId) return;\n lastDoc.current = docId;\n if (controlledPath === undefined) setInnerPath([]);\n }, [docId]); // eslint-disable-line react-hooks/exhaustive-deps\n\n /* writes */\n const setAt = React.useCallback<FormApi[\"setAt\"]>(\n (p, v, opts) => {\n const prev = getIn(valueRef.current, p);\n if (same(prev, v)) return;\n const key = pathKey(p);\n if (opts?.record !== false) {\n const now = Date.now();\n const st = stacks.current.get(key) ?? { path: p, values: [], at: 0 };\n if (!st.values.length || now - st.at > COALESCE_MS) st.values = [...st.values, prev].slice(-UNDO_STEPS);\n st.at = now;\n stacks.current.set(key, st);\n const h = log.current.get(key) ?? [];\n const entry: HistoryEntry = { value: v, at: now, by: \"You\", label: opts?.label };\n log.current.set(key, h.length && now - h[0].at < COALESCE_MS && !opts?.label ? [entry, ...h.slice(1)] : [entry, ...h].slice(0, HISTORY_ENTRIES));\n editing.current.add(key);\n }\n const next = setIn(valueRef.current, p, v);\n valueRef.current = next;\n onChange(next);\n },\n [onChange],\n );\n\n /* validation */\n const issueList = React.useMemo(() => {\n // the variant the form draws: the value's own, else the schema's first (as condCtx reads it for rendering)\n const variant = typeof value._variant === \"string\" ? value._variant : schema.variants?.[0]?.id;\n const own = collectIssues(schema.fields, value, [], resolveSchema, [], { root: value, variant }, uniquePeers);\n return extraIssues?.length ? [...own, ...extraIssues.filter((x) => !own.some((o) => o.key === x.key))] : own;\n }, [schema, value, resolveSchema, extraIssues, uniquePeers]);\n const issues = React.useMemo(() => new Map(issueList.map((i) => [i.key, i])), [issueList]);\n React.useEffect(() => onIssuesChange?.(issueList), [issueList, onIssuesChange]);\n // look v16 (F1340, prototype content.jsx Field): \"{label} is required\" shows whenever the field is empty\n const v16 = useKitLook() === \"v16\";\n const isVisible = React.useCallback(\n (i: KitIssue) => showErrors || !!i.live || touched.has(i.key) || (i.kind === \"rule\" && !editing.current.has(i.key)) || (v16 && i.kind === \"required\"),\n [showErrors, touched, v16],\n );\n\n const api: FormApi = {\n schema,\n value,\n setAt,\n getAt: (p) => getIn(value, p),\n baselineAt: (p) => getIn(baseline, p),\n publishedAt: (p) => getIn(published, p),\n hasPublished: !!published,\n inherited: inherited ? { from: inherited.from, isOverridden: (k) => inherited.overridden.includes(k), reset: inherited.onReset } : undefined,\n path,\n navigate,\n canNavigate: true,\n resolveSchema,\n blockLibrary,\n issues,\n visibleIssue: (k) => {\n const i = issues.get(k);\n return i && isVisible(i) ? i : undefined;\n },\n rollup: (prefix) => {\n const pk = pathKey(prefix);\n let errors = 0;\n let warnings = 0;\n for (const i of issueList) if (keyStartsWith(i.key, pk) && isVisible(i)) i.level === \"error\" ? errors++ : warnings++;\n return { errors, warnings };\n },\n touch: (k) => {\n editing.current.delete(k);\n if (!touched.has(k)) setTouched((s) => new Set(s).add(k));\n },\n showAllErrors: showErrors,\n canUndo: (k) => !!stacks.current.get(k)?.values.length,\n undo: (k) => {\n const st = stacks.current.get(k);\n if (!st?.values.length) return;\n const prev = st.values[st.values.length - 1];\n st.values = st.values.slice(0, -1);\n st.at = 0;\n const next = setIn(valueRef.current, st.path, prev);\n valueRef.current = next;\n onChange(next);\n bump();\n },\n history: (k) => log.current.get(k) ?? [],\n aiKeys,\n markAi: (k, on) =>\n setAiKeys((s) => {\n const n = new Set(s);\n if (on) n.add(k);\n else n.delete(k);\n return n;\n }),\n memory: memory.current,\n };\n\n const normPresence = React.useMemo(() => {\n const out: Record<string, KitPeer[]> = {};\n for (const [k, v] of Object.entries(presence ?? {})) out[k] = Array.isArray(v) ? v : [v];\n return out;\n }, [presence]);\n const env: KitEnv = React.useMemo(\n () => ({\n ...DEFAULT_ENV,\n variant,\n docId,\n docTitle: envIn?.docTitle,\n urlPrefix: envIn?.urlPrefix,\n /* a published copy proves \"live\"; its absence proves nothing (the dock has none), so it stays unknown */\n isPublished: envIn?.isPublished ?? (published ? true : undefined),\n slugIsAddress: envIn?.slugIsAddress,\n palette: envIn?.palette ?? DEFAULT_ENV.palette,\n readOnly: !!readOnly,\n can,\n presence: normPresence,\n comments: comments ?? {},\n onComment,\n onOpenReference,\n syncedFrom: envIn?.syncedFrom,\n helpDisplay: envIn?.helpDisplay,\n review,\n onFieldHistory,\n fieldChrome: envIn?.fieldChrome,\n controls: envIn?.controls,\n sectionSummary: envIn?.sectionSummary,\n }),\n [variant, docId, envIn?.docTitle, envIn?.urlPrefix, envIn?.isPublished, envIn?.slugIsAddress, envIn?.palette, envIn?.syncedFrom, envIn?.helpDisplay, envIn?.fieldChrome, envIn?.controls, envIn?.sectionSummary, published, readOnly, can, normPresence, comments, onComment, onOpenReference, review, onFieldHistory],\n );\n\n React.useImperativeHandle(\n navRef,\n () => ({\n back: () => {\n if (frames.length < 2) return false;\n navigate(frames[frames.length - 2].path);\n return true;\n },\n }),\n [frames, navigate],\n );\n\n /* drill-in stage: direction-aware slide, scroll memory, focus on the entering frame, Esc / Alt+Up/Down */\n const root = React.useRef<HTMLDivElement>(null);\n const scroller = React.useRef<HTMLDivElement>(null);\n const nav = useFrameNavigation({ frames, navigate, root, scroller });\n\n const crumbs = framesToCrumbs(frames, schema, api.rollup, rootLabel);\n const crumbSig = crumbSignature(crumbs);\n const onCrumbsRef = React.useRef(onCrumbs);\n onCrumbsRef.current = onCrumbs;\n React.useLayoutEffect(() => {\n onCrumbsRef.current?.(crumbs);\n }, [crumbSig]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const syncedNote = envIn?.syncedFrom ? (\n <p className=\"mb-5 flex items-start gap-2 rounded-kit-lg bg-kit-info-soft px-3 py-2 text-kit-xs text-kit-info-fg\">\n <span className=\"mt-0.5 size-1.5 shrink-0 rounded-full bg-kit-info\" aria-hidden />\n <span>\n Synced from <span className=\"font-medium\">{envIn.syncedFrom}</span>. Changes here apply on every page that uses it.\n </span>\n </p>\n ) : null;\n const body = <FrameStage review={!!review} frames={frames} frameKey={nav.frameKey} dir={nav.dir} rootLabel={rootLabel ?? schema.title} variant={variant} before={syncedNote} />;\n\n return (\n <KitEnvProvider value={env}>\n <FormProvider value={api}>\n <HiddenLineCtx.Provider value={hiddenLine}>\n <FrameSlotsProvider value={hiddenLine ? GHOST_SLOTS : FRAME_SLOTS}>\n <RowsHostContext.Provider value={ROWS_HOST}>\n <div\n ref={root}\n onKeyDown={(e) => {\n nav.onKeyDown(e);\n // DK-010: Backspace / Delete pressed on a control that is not a text box (a button, chip, switch, option)\n // ends here. A host that deletes its selection on those keys must never hear them from inside the form.\n const t = e.target as HTMLElement;\n if ((e.key === \"Backspace\" || e.key === \"Delete\") && !e.metaKey && !e.ctrlKey && !e.altKey && !(t.matches(\"input,textarea,select\") || t.isContentEditable)) e.stopPropagation();\n }}\n className={cn(\"flex min-h-0 min-w-0 flex-col\", ownScroll && \"h-full\", className)} data-kit-form={schema.name}>\n {header}\n {onCrumbs ? null : <FrameCrumbs crumbs={crumbs} onNavigate={navigate} variant={variant} />}\n {ownScroll ? (\n <div ref={scroller} className=\"@container min-h-0 flex-1 overflow-y-auto overscroll-contain\">\n {body}\n </div>\n ) : (\n <div className=\"@container\">{body}</div>\n )}\n </div>\n </RowsHostContext.Provider>\n </FrameSlotsProvider>\n </Hidd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AAA,IAAA;CACJ,MAAM,OAAO,oBAAC,YAAD;EAAY,QAAQ,CAAC,CAAC;EAAgB;EAAQ,UAAU,IAAI;EAAU,KAAK,IAAI;EAAK,WAAW,aAAa,OAAO;EAAgB;EAAS,QAAQ;CAAa,CAAA;CAE9K,OACE,oBAAC,gBAAD;EAAgB,OAAO;EACrB,UAAA,oBAAC,cAAD;GAAc,OAAO;GACnB,UAAA,oBAAC,cAAc,UAAf;IAAwB,OAAO;IAC/B,UAAA,oBAAC,oBAAD;KAAoB,OAAO,aAAa,cAAc;KACpD,UAAA,oBAAC,gBAAgB,UAAjB;MAA0B,OAAO;MAC/B,UAAA,qBAAC,OAAD;OACE,KAAK;OACL,YAAY,MAAM;QAChB,IAAI,UAAU,CAAC;QAGf,MAAM,IAAI,EAAE;QACZ,KAAK,EAAE,QAAQ,eAAe,EAAE,QAAQ,aAAa,CAAC,EAAE,WAAW,CAAC,EAAE,WAAW,CAAC,EAAE,UAAU,EAAE,EAAE,QAAQ,uBAAuB,KAAK,EAAE,oBAAoB,EAAE,gBAAgB;OAChL;OACA,WAAW,GAAG,iCAAiC,aAAa,UAAU,SAAS;OAAG,iBAAe,OAAO;OAT1G,UAAA;QAUG;QACA,WAAW,OAAO,oBAAC,aAAD;SAAqB;SAAQ,YAAY;SAAmB;QAAU,CAAA;QACxF,YACC,oBAAC,OAAD;SAAK,KAAK;SAAU,WAAU;SAC3B,UAAA;QACE,CAAA,IAEL,oBAAC,OAAD;SAAK,WAAU;SAAc,UAAA;QAAU,CAAA;OAEtC;;KACmB,CAAA;IACR,CAAA;GACI,CAAA;EACZ,CAAA;CACA,CAAA;AAEpB"}
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ export * from "./engine/held";
17
17
  export * from "./engine/field-shell";
18
18
  export * from "./engine/bits";
19
19
  export * from "./engine/group-summary";
20
- export { RHYTHM, useRhythm, InsetScope, useInsetDepth, useGroupStatus, Appear, AnimatedFields, FieldSection, FieldInset, FieldUnit, FieldUnitRow, isBreakpointName, BreakpointGroup, arrangeFields, defaultGroup, GroupTabs, FieldsetSection, isShort, type GroupStatus, type RenderField, type GroupTabItem, type FieldSectionProps, } from "./engine/grouping";
20
+ export { RHYTHM, useRhythm, InsetScope, useInsetDepth, useGroupStatus, Appear, AnimatedFields, FieldSection, FieldInset, FieldUnit, FieldUnitRow, ObjectGroup, SubGroup, isBreakpointName, BreakpointGroup, arrangeFields, defaultGroup, GroupTabs, FieldsetSection, isShort, type GroupStatus, type RenderField, type GroupTabItem, type FieldSectionProps, type ObjectGroupProps, } from "./engine/grouping";
21
21
  export * from "./engine/field-list";
22
22
  export * from "./engine/array";
23
23
  export * from "./engine/item-list";
package/dist/index.js CHANGED
@@ -4,23 +4,25 @@ import { failingRules, isHidden, newBlock, newItem, plainText, previewOf, refFil
4
4
  import { buttonFromProd, buttonToProd, codeFromProd, codeToProd, cropPreset, cropRect, dateFromProd, dateToProd, datetimeFromProd, datetimeToProd, imageFromProd, imageToProd, isCropRect, isDockIcon, linkFromProd, linkToProd, listFromProd, listToProd, parseTargetTag, ratingFromProd, ratingToProd, referenceFromProd, referenceToProd, scaleFromProd, scaleToProd, tableFromProd, tableToProd, tagsFromProd, tagsToProd, targetTag, typedRowsFromProd, typedRowsToProd, videoFromProd, videoToProd, zoneListFromProd, zoneListToProd } from "./adapters/values.js";
5
5
  import { CATEGORY_TO_PROD, SHOPIFY_REF_LOCK, fromTypeSchema, leafValuePlan, planFromProd, planToProd, propsToTypeSchema, schemaSlugOf, toTypeSchema, variantFamilyFromTypeSchema, variantFamilyToTypeSchema, variantGroupV2 } from "./adapters/schema.js";
6
6
  import { cn } from "./lib/cn.js";
7
- import { AI_PRESETS, DEFAULT_ENV, FieldHeaderSlot, FormProvider, KitAddressContext, KitEnvProvider, KitSectionTitle, KitServicesProvider, SITE_PALETTE, fieldAccessOf, registerKitServices, resolveFieldAccess, seesDevSurfaces, useForm, useKitEnv, useKitServices, useRichTextRefs, visibleFields, visibleSchema } from "./context.js";
7
+ import { AI_COMMANDS, AI_PRESETS, AI_REWRITE_COMMANDS, AI_RUN_SEPARATOR, DEFAULT_ENV, FieldHeaderSlot, FormProvider, KitAddressContext, KitEnvProvider, KitFocusFieldProvider, KitLookProvider, KitSectionTitle, KitServicesProvider, SITE_PALETTE, fieldAccessOf, registerKitServices, resolveFieldAccess, seesDevSurfaces, useForm, useKitEnv, useKitFocusField, useKitLook, useKitServices, useRichTextRefs, visibleFields, visibleSchema } from "./context.js";
8
8
  import { KIT_ICONS, KitIcon, iconKey } from "./lib/icons.js";
9
9
  import { FieldDescribedByContext, FieldLabelledByContext, useFieldDescribedBy, useFieldId, useFieldLabelledBy } from "./ui/field-context.js";
10
10
  import { Spinner } from "./ui/spinner.js";
11
11
  import { Button, HintTooltip, IconButton, RevealLink, Sparkle, TooltipScope, buttonVariants, iconButtonVariants } from "./ui/button.js";
12
12
  import { ShortcutHint, ShortcutHintsProvider, platformKeys, shortcutHintsOn, useShortcutHints } from "./ui/shortcut-hint.js";
13
13
  import { Checkbox, ChoiceCard, ChoiceList, Progress, Radio, RadioGroup, Segmented, Slider, Switch, ToggleGroup, ToggleItem } from "./ui/controls.js";
14
+ import { CARD_TOOLTIP_CLASS, CardTooltip, InfoTooltip } from "./ui/tooltip-card.js";
14
15
  import { FLOATING_LAYER, FlowBody, FlowClose, FlowFooter, FlowHeader, FlowLabel, FlowModal, HeaderStatus, HoverCard, HoverCardContent, HoverCardTrigger, Menu, MenuCheckItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Modal, ModalBody, ModalClose, ModalContent, ModalFooter, ModalHeader, ModalTrigger, MoreOptions, OptionRow, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Sheet, SheetClose, SheetContent, SheetTrigger, Tooltip, TooltipProvider, useFocusReturn } from "./ui/overlay.js";
16
+ import { ColourSelect, CountRing, FieldCounter, FieldSweep, FocusDot, GroupHeader, INSPECTOR_EASE, ITEM_DELETE_CLASS, ITEM_LIST_ADD_CLASS, ITEM_ROW_CLASS, ITEM_ROW_GRIP_CLASS, ITEM_ROW_MORE_CLASS, ITEM_ROW_SUB_CLASS, ITEM_ROW_TITLE_CLASS, InfoGlyph, InlineRow, InspectorBody, InspectorCollapse, InspectorDivider, InspectorField, InspectorFields, InspectorGroup, InspectorLocked, InspectorNote, InspectorSeg, InspectorSwitch, ItemDeleteButton, ItemListAdd, ItemListCard, ItemListNote, ItemRow, ItemRowMore, LAYOUT_GLYPHS, LayoutOpt, OVER_LIMIT_CLASS, RollNumber, SectionHeader, SelectCompact, SelectField, StepRow, StepSlider, ToggleCard, ToggleRow, ValueSlider, counterState, itemListNote, overLimitText } from "./ui/inspector.js";
15
17
  import { IssueDot, Kbdish, RowChrome, Thumb, useLoadedFit } from "./engine/bits.js";
16
18
  import { Avatar, AvatarStack, Badge, Card, CardHeader, Dot, EmptyState, Kbd, PageHeader, Separator, SettingsSection, Skeleton, Stat, StatusMark, StatusPill, Table, Td, Th, Tr, avatarRingSpread, badgeVariants, colorFor, statusMap } from "./ui/display.js";
17
19
  import { AGENT_PRESENCE, presenceColor, presenceSlot, registerPresenceRoster } from "./ui/presence.js";
18
20
  import { DEV_FIELD, DEV_ONLY_FIELD, HISTORY_SEGMENT } from "./schema/types.js";
19
21
  import { HELP_STRINGS, conventionalHelp, resolveHelp } from "./schema/help.js";
20
22
  import { collectIssues, textLength, uniqueKey, validateValue } from "./lib/validate.js";
21
- import { FieldCommentRequest, FieldShell, LABEL_HINT_AT, PeerStack, apiName, resetFieldClipboard } from "./engine/field-shell.js";
23
+ import { FieldActionsMenu, FieldCommentRequest, FieldShell, KIT_OPEN_FIELD_COMMENTS, LABEL_HINT_AT, PeerStack, apiName, openFieldComments, resetFieldClipboard } from "./engine/field-shell.js";
22
24
  import { groupSummary } from "./engine/group-summary.js";
23
- import { AnimatedFields, Appear, BreakpointGroup, FieldInset, FieldSection, FieldUnit, FieldUnitRow, FieldsetSection, GroupTabs, InsetScope, RHYTHM, arrangeFields, defaultGroup, isBreakpointName, isShort, useGroupStatus, useInsetDepth, useRhythm } from "./engine/grouping.js";
25
+ import { AnimatedFields, Appear, BreakpointGroup, FieldInset, FieldSection, FieldUnit, FieldUnitRow, FieldsetSection, GroupTabs, InsetScope, ObjectGroup, RHYTHM, SubGroup, arrangeFields, defaultGroup, isBreakpointName, isShort, useGroupStatus, useInsetDepth, useRhythm } from "./engine/grouping.js";
24
26
  import { Field, HelpMore, Input, Label, SearchInput, Textarea } from "./ui/input.js";
25
27
  import { Highlight, SEARCH_THRESHOLD, Select, filterOptions, matchPositions, matchScore, nodeText, selectTriggerClass } from "./ui/select.js";
26
28
  import { Autocomplete } from "./ui/autocomplete.js";
@@ -28,7 +30,7 @@ import { LINK_TYPES, LinkControl, LinkField, LinkForm, LinkLine, LinkOptions, Li
28
30
  import { BUTTON_ICONS, ButtonControl, ButtonIconPicker, ButtonLinkEditor, ButtonPreview, ButtonScreen, ButtonStyleGrid, STYLE_ITEMS, StyleGlyph, lookLabel, lookOf, nextButton } from "./controls/button.js";
29
31
  import { FieldList } from "./engine/field-list.js";
30
32
  import { ItemList, OrderLockSlot, SharedSortProvider, arrayMove, useDragReorder, useSharedSort } from "./engine/item-list.js";
31
- import { ADD_SEARCH_AT, ARRAY_CONTROLS, ArrayField, RowList, RowsHostContext, belowMin, listMeta, rowToggleField, useDrill, useListOps } from "./engine/array.js";
33
+ import { ADD_SEARCH_AT, ARRAY_CONTROLS, ArrayField, RowList, RowsHostContext, V16StringList, belowMin, listMeta, rowToggleField, useDrill, useListOps } from "./engine/array.js";
32
34
  import { isDrillable, resolveFrames, rootFrame } from "./lib/frames.js";
33
35
  import { ExpandedEditorModal } from "./ui/expanded-editor-modal.js";
34
36
  import { FrameCrumbs, KitBreadcrumb, crumbSignature, framesToCrumbs, kitPathItems } from "./engine/breadcrumb.js";
@@ -41,10 +43,11 @@ import { CodeControl, CodeDialogField, CodeSurface, UnreadableValue, jsonProblem
41
43
  import { JsonControl } from "./controls/json.js";
42
44
  import { FieldBoundary, HeldField, HeldValue, KitErrorCard, heldLines } from "./engine/held.js";
43
45
  import { ACTIONS, ACTION_WHEN_READ_ONLY, CONTROLS, FallbackControl, KitField, NavRow, NestedForm, plainOf, useFieldAccess, withDefaultHelp } from "./engine/kit-field.js";
44
- import { EmailControl, SlugControl, SlugGenerate, StringControl, TEXT_FOCUS, TextControl, UrlControl, slugSource, slugTidy, slugTyping, str } from "./controls/text.js";
46
+ import { EmailControl, PrefixedInput, SlugControl, SlugGenerate, StringControl, TEXT_FOCUS, TextControl, UrlControl, V16_TEXT_SURFACE, slugSource, slugTidy, slugTyping, str } from "./controls/text.js";
45
47
  import { ColorControl, HEX_COLOR, pickerHex } from "./controls/color.js";
46
48
  import { NUMBER_SCALE, NumberControl, PlainNumber, RatingControl, ratingScale, snapRating, toNum, ungroupNumber } from "./controls/number.js";
47
49
  import { C1_ACTIONS, C1_CONTROLS, registerC1Controls } from "./controls/c1.js";
50
+ import { AuthorField, TagsInput } from "./ui/content-fields.js";
48
51
  import { UnknownValueNote } from "./controls/unknown-value.js";
49
52
  import { BooleanControl, MultiSelectControl, SelectControl, TagsControl, optionIcons, tagRefusal, useOwnDescription } from "./controls/choice.js";
50
53
  import { ScaleControl, ScaleSlider } from "./controls/scale.js";
@@ -59,8 +62,10 @@ import "./controls/form-picker-register.js";
59
62
  import { IconControl, IconPicker, IconValueGlyph } from "./controls/icon.js";
60
63
  import "./controls/icon-register.js";
61
64
  import { LocationControl, locationFromDraft } from "./controls/location.js";
65
+ import { V16ImageField, V16_IMAGE_ACCEPT } from "./controls/media-v16.js";
62
66
  import { FileControl, GalleryControl, ImageControl, ImageDetails, MediaPicker, NO_CROP_OUTSIDE_LIBRARY, VideoControl, VideoPreview, acceptsFile, cropChoice, fileNameFromUrl, formatBytes, fromAsset, isVideoUrl, normImage, useUpload, videoProvider, withCrop, youTubeId } from "./controls/media.js";
63
67
  import { ComponentSlotControl, SlotDepthContext, SlotPicker } from "./controls/slot.js";
68
+ import { CODE_LANGUAGE_NAMES, CodeLanguageMenu, CodeLanguagePopover } from "./ui/code-language-menu.js";
64
69
  import { RT_PROSE, RichTextEditor } from "./controls/rich-text/editor.js";
65
70
  import { RichTextControl, RichTextExpandAction } from "./controls/rich-text/control.js";
66
71
  import { registerKitControls } from "./controls/index.js";
@@ -75,11 +80,13 @@ import { blockDefToSchema, fieldDefToSchema, fieldDefsToSchema, inferField, prop
75
80
  import { ActionTray, TrayMeta, TrayMore, actionTrayClass } from "./ui/action-tray.js";
76
81
  import { ModeBar, ModeBarDot, ModeBarLink } from "./ui/mode-bar.js";
77
82
  import { Tab, TabList, TabPanel, Tabs } from "./ui/tab.js";
83
+ import { BUTTON_STYLES, BcmsMark, ButtonStylePicker, FoundationBadge, FoundationButton, FoundationCheckbox, FoundationTextField, InspectorPopover, ProBadge, SaveStatus, SearchClear, StatusIcon } from "./ui/foundations.js";
78
84
  import { KitToaster, kitToast, kitToastManager } from "./ui/toast.js";
85
+ import { BlockIconPicker, BlockIconPickerPopover } from "./ui/block-icon-picker.js";
79
86
  import "./kit.css";
80
87
  //#region src/index.ts
81
88
  registerKitControls();
82
89
  //#endregion
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, 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 };
90
+ export { ACTIONS, ACTION_WHEN_READ_ONLY, ADD_SEARCH_AT, AGENT_PRESENCE, AI_COMMANDS, AI_PRESETS, AI_REWRITE_COMMANDS, AI_RUN_SEPARATOR, ARRAY_CONTROLS, ActionTray, AnimatedFields, Appear, ArrayField, AuthorField, Autocomplete, Avatar, AvatarStack, BUTTON_ICONS, BUTTON_STYLES, Badge, BcmsMark, BlockIconPicker, BlockIconPickerPopover, BlockPicker, BooleanControl, BreakpointGroup, Button, ButtonControl, ButtonIconPicker, ButtonLinkEditor, ButtonPreview, ButtonScreen, ButtonStyleGrid, ButtonStylePicker, C1_ACTIONS, C1_CONTROLS, C2_CONTROLS, CAP_IDS, CARD_TOOLTIP_CLASS, CATEGORY_TO_PROD, COALESCE_MS, CODE_LANGUAGE_NAMES, CONTROLS, Card, CardHeader, CardTooltip, Checkbox, ChoiceCard, ChoiceList, ChoiceSwitch, CodeControl, CodeDialogField, CodeLanguageMenu, CodeLanguagePopover, CodeSurface, ColorControl, ColourSelect, ComponentSlotControl, CountRing, DEFAULT_ENV, DEV_FIELD, DEV_ONLY_FIELD, DateControl, Dot, EmailControl, EmptyState, ExpandedEditorModal, FLOATING_LAYER, FallbackControl, Field, FieldActionsMenu, FieldBoundary, FieldCommentRequest, FieldCounter, FieldDescribedByContext, FieldHeaderSlot, FieldInset, FieldLabelledByContext, FieldList, FieldSection, FieldShell, FieldSweep, FieldUnit, FieldUnitRow, FieldsetSection, FileControl, FlowBody, FlowClose, FlowFooter, FlowHeader, FlowLabel, FlowModal, FocusDot, FormPickerControl, FormProvider, FoundationBadge, FoundationButton, FoundationCheckbox, FoundationTextField, FrameCrumbs, FrameHeader, FrameSlotsProvider, FrameStage, FrameView, GalleryControl, GroupHeader, GroupTabs, HELP_STRINGS, HEX_COLOR, HISTORY_SEGMENT, HeaderStatus, HeldField, HeldValue, HelpMore, Highlight, HintTooltip, HoverCard, HoverCardContent, HoverCardTrigger, INSPECTOR_EASE, ITEM_DELETE_CLASS, ITEM_LIST_ADD_CLASS, ITEM_ROW_CLASS, ITEM_ROW_GRIP_CLASS, ITEM_ROW_MORE_CLASS, ITEM_ROW_SUB_CLASS, ITEM_ROW_TITLE_CLASS, IconButton, IconControl, IconPicker, IconValueGlyph, ImageControl, ImageDetails, InfoGlyph, InfoTooltip, InlineRow, Input, InsetScope, InspectorBody, InspectorCollapse, InspectorDivider, InspectorField, InspectorFields, InspectorGroup, InspectorLocked, InspectorNote, InspectorPopover, InspectorSeg, InspectorSwitch, IssueDot, ItemDeleteButton, ItemList, ItemListAdd, ItemListCard, ItemListNote, ItemRow, ItemRowMore, JsonControl, KIT_ICONS, KIT_OPEN_FIELD_COMMENTS, Kbd, Kbdish, KitAddressContext, KitBreadcrumb, KitEnvProvider, KitErrorCard, KitField, KitFocusFieldProvider, KitIcon, KitLookProvider, KitSectionTitle, KitServicesProvider, KitToaster, LABEL_HINT_AT, LAYOUT_GLYPHS, LINK_TYPES, Label, LayoutOpt, 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, OVER_LIMIT_CLASS, ObjectGroup, OptionRow, OrderLockSlot, PageHeader, PeerStack, PlainNumber, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, PrefixedInput, ProBadge, Progress, REL_ITEMS, RHYTHM, RT_PROSE, Radio, RadioGroup, RatingControl, RefThumb, ReferenceControl, ReferencesControl, RevealLink, RichTextControl, RichTextEditor, RichTextExpandAction, RollNumber, RowChrome, RowList, RowsHostContext, SEARCH_THRESHOLD, SEGMENTED_MAX, SEGMENTED_MAX_LABEL, SHOPIFY_REF_LOCK, SITE_PALETTE, STYLE_ITEMS, SaveStatus, ScaleControl, ScaleSlider, SchemaForm, SearchClear, SearchInput, SectionAnchorsProvider, SectionHeader, Segmented, Select, SelectCompact, SelectControl, SelectField, Separator, SettingsSection, SharedSortProvider, Sheet, SheetClose, SheetContent, SheetTrigger, ShortcutHint, ShortcutHintsProvider, Skeleton, Slider, SlotDepthContext, SlotField, SlotPicker, SlugControl, SlugGenerate, Sparkle, Spinner, Stat, StatusIcon, StatusMark, StatusPill, StepRow, StepSlider, StringControl, StyleGlyph, SubGroup, Switch, TARGET_KEYS, TEXT_FOCUS, Tab, TabList, TabPanel, Table, TableControl, TableFrame, TableFullScreenAction, Tabs, TagsControl, TagsInput, Td, TextControl, Textarea, Th, Thumb, ToggleCard, ToggleGroup, ToggleItem, ToggleRow, Tooltip, TooltipProvider, TooltipScope, Tr, TrayMeta, TrayMore, UNDO_STEPS, UnknownValueNote, UnreadableValue, UrlControl, V16ImageField, V16StringList, V16_IMAGE_ACCEPT, V16_TEXT_SURFACE, ValueSlider, VideoControl, VideoPreview, acceptsFile, actionTrayClass, apiName, arrangeFields, arrayMove, avatarRingSpread, badgeVariants, belowMin, blockDefToSchema, buttonFromProd, buttonToProd, buttonVariants, cn, codeFromProd, codeToProd, collectIssues, colorFor, conventionalHelp, counterState, 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, itemListNote, 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, openFieldComments, optionIcons, overLimitText, 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, useKitFocusField, useKitLook, 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 };
84
91
 
85
92
  //# 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/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"}
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 ObjectGroup, SubGroup, isBreakpointName, BreakpointGroup, arrangeFields, defaultGroup, GroupTabs, FieldsetSection, isShort,\n type GroupStatus, type RenderField, type GroupTabItem, type FieldSectionProps, type ObjectGroupProps,\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"}
package/dist/kit.css CHANGED
@@ -65,3 +65,88 @@
65
65
  0%, 100% { opacity: 1; transform: scale(1); }
66
66
  50% { opacity: 0.45; transform: scale(0.85); }
67
67
  }
68
+
69
+ /* Inspector foundation · V1.6 (editor-v16 kit.css:506-515, editor.css:454): the field sweep a canvas click starts
70
+ (wipes in from the left, leaves to the right), its reduced-motion fade, the 6px focus dot, and the group flash. */
71
+ @keyframes kit-insp-sweep {
72
+ 0% { clip-path: inset(0 100% 0 0 round 6px); opacity: 1; }
73
+ 36% { clip-path: inset(0 0 0 0 round 6px); opacity: 1; }
74
+ 100% { clip-path: inset(0 0 0 100% round 6px); opacity: 0; }
75
+ }
76
+
77
+ @keyframes kit-insp-fade {
78
+ 0%, 40% { opacity: 1; }
79
+ 100% { opacity: 0; }
80
+ }
81
+
82
+ @keyframes kit-insp-dot {
83
+ from { opacity: 0; transform: scale(0.4); }
84
+ }
85
+
86
+ @keyframes kit-insp-group-flash {
87
+ 0%, 30% { background: var(--kit-insp-flash-c); }
88
+ 100% { background: transparent; }
89
+ }
90
+
91
+ /* Inspector foundation · V1.6 (editor-v16 content.css:619): a field shakes once as its count goes over the limit */
92
+ @keyframes kit-insp-shake {
93
+ 20% { transform: translateX(-4px); }
94
+ 40% { transform: translateX(4px); }
95
+ 60% { transform: translateX(-3px); }
96
+ 80% { transform: translateX(2px); }
97
+ }
98
+
99
+ /* Body editor · V1.6 (editor-v16 content.css:626, 687): the code Copy tick pops in; a block toolbar appears */
100
+ @keyframes kit-insp-pop {
101
+ 0% { transform: scale(0.8); opacity: 0.4; }
102
+ 60% { transform: scale(1.06); opacity: 1; }
103
+ 100% { transform: none; }
104
+ }
105
+ @keyframes kit-insp-appear {
106
+ from { opacity: 0; translate: 0 6px; scale: 0.96; filter: blur(4px); }
107
+ to { opacity: 1; translate: 0 0; scale: 1; filter: none; }
108
+ }
109
+
110
+ /* Modal · V1.6 (editor-v16 editor.css:462-466, 496-499): scrim fades, the dialog rises, scales and un-blurs in, and
111
+ plays the reverse on close (Base UI waits for the ending animation before it unmounts). */
112
+ @keyframes kit-insp-scrim-in { from { opacity: 0; } }
113
+ @keyframes kit-insp-scrim-out { to { opacity: 0; } }
114
+ @keyframes kit-insp-modal-in { from { opacity: 0; transform: translateY(8px) scale(0.97); filter: blur(4px); } }
115
+ @keyframes kit-insp-modal-out { to { opacity: 0; transform: translateY(4px) scale(0.98); filter: blur(3px); } }
116
+
117
+ /* Slash menu AI icons · V1.6 (editor-v16 content.css:247-278): each stroke of the icon moves once when its row is
118
+ highlighted (the row is the `[aria-selected="true"]` option). */
119
+ @keyframes kit-ai-move { 40% { transform: translate(var(--dx), var(--dy)); } }
120
+ @keyframes kit-ai-breathe { 35% { transform: scale(0.86); } }
121
+ @keyframes kit-ai-blink { 40% { opacity: 0.2; } }
122
+ @keyframes kit-ai-tilt { 35% { transform: rotate(8deg); } }
123
+ @keyframes kit-ai-pop { 40% { transform: scale(1.3); } }
124
+ @keyframes kit-ai-draw { 0% { stroke-dashoffset: 0.8; } 100% { stroke-dashoffset: 0; } }
125
+ @keyframes kit-ai-grow { 0% { stroke-dashoffset: 0.45; } 100% { stroke-dashoffset: 0; } }
126
+ .kit-aii path { transform-box: fill-box; transform-origin: center; }
127
+ .kit-aii .ul, .kit-aii .l3, .kit-aii .ck { stroke-dasharray: 1 1; }
128
+ [aria-selected="true"] .kit-aii-ai .star { animation: kit-ai-breathe 0.5s ease-out; }
129
+ [aria-selected="true"] .kit-aii-ai .p1 { animation: kit-ai-blink 0.4s ease-out 0.05s; }
130
+ [aria-selected="true"] .kit-aii-ai .p2 { animation: kit-ai-blink 0.4s ease-out 0.15s; }
131
+ [aria-selected="true"] .kit-aii-prompt .pen { animation: kit-ai-move 0.55s ease-out; --dx: 1.7px; --dy: -1.7px; }
132
+ [aria-selected="true"] .kit-aii-prompt .ul { animation: kit-ai-draw 0.5s ease-out; }
133
+ [aria-selected="true"] .kit-aii-continue .arr { animation: kit-ai-move 0.5s ease-out; --dx: 2.5px; --dy: 0px; }
134
+ [aria-selected="true"] .kit-aii-continue .l3 { animation: kit-ai-grow 0.45s ease-out; }
135
+ [aria-selected="true"] .kit-aii-improve .wand { animation: kit-ai-tilt 0.55s ease-out; }
136
+ [aria-selected="true"] .kit-aii-improve .s1 { animation: kit-ai-pop 0.4s ease-out; }
137
+ [aria-selected="true"] .kit-aii-improve .s2 { animation: kit-ai-pop 0.4s ease-out 0.08s; }
138
+ [aria-selected="true"] .kit-aii-improve .s3 { animation: kit-ai-pop 0.4s ease-out 0.16s; }
139
+ [aria-selected="true"] .kit-aii-shorter .tr { animation: kit-ai-move 0.5s ease-out; --dx: -1.7px; --dy: 1.7px; }
140
+ [aria-selected="true"] .kit-aii-shorter .bl { animation: kit-ai-move 0.5s ease-out; --dx: 1.7px; --dy: -1.7px; }
141
+ [aria-selected="true"] .kit-aii-summarize .l1 { animation: kit-ai-move 0.5s ease-out; --dx: 0px; --dy: -1.7px; }
142
+ [aria-selected="true"] .kit-aii-summarize .l2 { animation: kit-ai-move 0.5s ease-out 0.03s; --dx: 0px; --dy: -1.7px; }
143
+ [aria-selected="true"] .kit-aii-summarize .l3 { animation: kit-ai-move 0.5s ease-out 0.06s; --dx: 0px; --dy: -1.7px; }
144
+ [aria-selected="true"] .kit-aii-summarize .l4 { animation: kit-ai-move 0.5s ease-out 0.09s; --dx: 0px; --dy: -1.7px; }
145
+ [aria-selected="true"] .kit-aii-summarize .arr { animation: kit-ai-move 0.5s ease-out; --dx: 0px; --dy: 2px; }
146
+ [aria-selected="true"] .kit-aii-translate .g { animation: kit-ai-move 0.5s ease-out; --dx: -1px; --dy: -1.7px; }
147
+ [aria-selected="true"] .kit-aii-translate .a { animation: kit-ai-move 0.5s ease-out 0.06s; --dx: 1px; --dy: 1.7px; }
148
+ [aria-selected="true"] .kit-aii-spelling .a { animation: kit-ai-move 0.4s ease-out; --dx: 0px; --dy: -1.4px; }
149
+ [aria-selected="true"] .kit-aii-spelling .ck { animation: kit-ai-draw 0.45s ease-out 0.08s both; }
150
+ @media (prefers-reduced-motion: reduce) {
151
+ .kit-aii path { animation: none !important; }
152
+ }