@bettercms-ai/kit 3.1.27 → 3.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controls/media.js +7 -1
- package/dist/controls/media.js.map +1 -1
- package/dist/controls/reference.js +2 -2
- package/dist/controls/reference.js.map +1 -1
- package/dist/controls/slot.js +1 -1
- package/dist/controls/slot.js.map +1 -1
- package/dist/engine/frame.js +18 -7
- package/dist/engine/frame.js.map +1 -1
- package/dist/engine/kit-field.js +2 -0
- package/dist/engine/kit-field.js.map +1 -1
- package/dist/engine/slot.js +1 -1
- package/dist/engine/slot.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/engine/frame.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame.js","names":[],"sources":["../../src/engine/frame.tsx"],"sourcesContent":["/**\n * FrameView — what the panel shows for the current breadcrumb: the root fields, a drilled object / array item /\n * slot block (with \"2 of 4\" stepper, variant switcher and per-slot layout settings), the one button screen,\n * or a field's history as a stacked panel. Port of V2 engine/frame.tsx.\n *\n * FrameStage + useFrameNavigation — V2 schema-form's drill-in stage (direction-aware slide, scroll memory per frame,\n * focus on the entering frame, Esc / ⌥↑↓). Exported here so SchemaForm wires them without re-deriving the motion.\n *\n * FrameSlots — the frame draws other lanes' pieces (FieldList / FieldSection from grouping, ButtonScreen from link,\n * TableFrame from table). They arrive through context so this file never imports a module that does not exist yet;\n * a missing slot falls back to a plain field list (FieldList), the raw value (ButtonScreen, through\n * FallbackControl), a named note (TableFrame) or nothing (FieldSection). SchemaForm always hands ButtonScreen and TableFrame.\n */\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"framer-motion\";\nimport { IconArrowDown, IconArrowUp, IconCopy, IconDots, IconTrash } from \"@tabler/icons-react\";\nimport { IconButton } from \"../ui/button\";\nimport { Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Tooltip } from \"../ui/overlay\";\nimport { Segmented } from \"../ui/controls\";\nimport { fitsSegmented } from \"../ui/choice-switch\";\nimport { Select } from \"../ui/select\";\nimport { resolveFieldAccess, useForm, useKitEnv, useKitServices } from \"../context\";\nimport { cn } from \"../lib/cn\";\nimport { HISTORY_SEGMENT, type FieldGroup, type FieldPath, type FieldSchema, type Fieldset } from \"../schema/types\";\nimport type { Frame } from \"../lib/frames\";\nimport { frameKeyOf, isObj, newKey } from \"../lib/path\";\nimport { condCtx, isHidden, previewOf } from \"../lib/schema\";\nimport { Thumb } from \"./bits\";\nimport { FallbackControl, KitField } from \"./kit-field\";\n\n/* ── Slots (other lanes) ───────────────────────────────────────────── */\nexport interface FrameFieldListProps {\n fields: FieldSchema[];\n fieldsets?: Fieldset[];\n groups?: FieldGroup[];\n basePath: FieldPath;\n memoryKey: string;\n}\nexport interface FrameSlots {\n /** grouping lane: engine/field-list.tsx `FieldList` */\n FieldList?: React.ComponentType<FrameFieldListProps>;\n /** grouping lane: engine/grouping.tsx `FieldSection` (the slot-settings section of a slot block) */\n FieldSection?: React.ComponentType<{ title: string; description?: string; collapsible?: boolean; children: React.ReactNode }>;\n /** link lane: controls/link.tsx `ButtonScreen` + `normLink` (the \"button\" frame) */\n ButtonScreen?: React.ComponentType<{ value: unknown; onChange: (v: unknown) => void; title: string; readOnly?: boolean }>;\n normLink?: (v: unknown) => { label?: string };\n /** table lane: controls/table.tsx `TableFrame` (tableRow / tableColumn frames) */\n TableFrame?: React.ComponentType<{ frame: Frame }>;\n}\nconst SlotsCtx = React.createContext<FrameSlots>({});\nexport const FrameSlotsProvider = SlotsCtx.Provider;\nexport const useFrameSlots = () => React.useContext(SlotsCtx);\n\n/** Stand-in until the grouping lane's FieldList lands: the frame's visible fields in schema order. */\nfunction PlainFieldList({ fields, basePath }: FrameFieldListProps) {\n const form = useForm()!;\n const raw = basePath.length ? form.getAt(basePath) : form.value;\n const parent = isObj(raw) ? raw : {};\n const cc = condCtx(form, basePath);\n const shown = fields.filter((f) => !isHidden(f, parent, cc));\n return (\n <div className=\"flex flex-col gap-5\">\n {shown.map((f) => (\n <div key={f.name} className=\"min-w-0\">\n <KitField field={f} path={[...basePath, f.name]} parent={parent} />\n </div>\n ))}\n {shown.length === 0 ? <p className=\"py-6 text-center text-kit-sm text-kit-fg-3\">No fields here yet.</p> : null}\n </div>\n );\n}\n\n/** A button frame outside SchemaForm (no ButtonScreen slot) edits the button's raw value (FallbackControl), never an empty body. */\nfunction RawButtonScreen({ frame }: { frame: Frame }) {\n const form = useForm()!;\n const id = React.useId();\n const field = frame.field ?? { name: String(frame.path.at(-1) ?? \"button\"), title: frame.title, type: \"button\" as const };\n return <FallbackControl field={field} value={form.getAt(frame.path)} onChange={(n) => form.setAt(frame.path, n)} id={id} path={frame.path} />;\n}\n\n/** The button frame: header (the button's label) + the kit ButtonScreen, read-only when the lens can't edit the field. */\nfunction ButtonFrame({ frame, parentTitle }: { frame: Frame; parentTitle?: string }) {\n const form = useForm()!;\n const env = useKitEnv();\n const slots = useFrameSlots();\n const v = form.getAt(frame.path);\n const ButtonScreen = slots.ButtonScreen;\n const readOnly = frame.field ? resolveFieldAccess(frame.field, env).readOnly : !!env.readOnly;\n return (\n <div className=\"flex flex-col gap-5\">\n <FrameHeader frame={frame} context={parentTitle ? `${frame.title} in ${parentTitle}` : frame.title} title={slots.normLink?.(v).label || frame.title} />\n {ButtonScreen ? <ButtonScreen value={v} onChange={(n) => form.setAt(frame.path, n)} title={frame.title} readOnly={readOnly} /> : <RawButtonScreen frame={frame} />}\n </div>\n );\n}\n\n/* ── FrameView ─────────────────────────────────────────────────────── */\nexport function FrameView({ frame, parentTitle }: { frame: Frame; parentTitle?: string }) {\n const form = useForm()!;\n const slots = useFrameSlots();\n const FieldList = slots.FieldList ?? PlainFieldList;\n if (frame.kind === \"history\") return null; // D61: a field's history is the host's one History panel (onFieldHistory)\n if (frame.kind === \"button\") return <ButtonFrame frame={frame} parentTitle={parentTitle} />;\n // D50: a table row or column drills exactly like an array item: the same header (title, n of N, ↑ ↓ ⋯), its cells below\n if (frame.kind === \"tableRow\" || frame.kind === \"tableColumn\") {\n const it = frame.item!;\n const TableFrame = slots.TableFrame;\n return (\n <div className=\"flex flex-col gap-5\">\n <FrameHeader frame={frame} context={`${it.itemSchema?.title} ${it.index + 1} of ${it.count} in ${frame.field?.title ?? \"the table\"}`} title={frame.title} />\n {TableFrame ? (\n <TableFrame frame={frame} />\n ) : (\n /* Only the kit table control opens a row or column frame; until it is ported the table is the host's control,\n which edits rows in place. A path restored into one says so instead of drawing an empty body. */\n <p role=\"note\" data-kit-legacy=\"table\" className=\"text-kit-sm text-kit-fg-3\">\n This table's rows and columns are edited in the table itself.\n </p>\n )}\n </div>\n );\n }\n if (frame.kind === \"root\") return <FieldList fields={frame.fields} fieldsets={frame.fieldsets} groups={frame.groups} basePath={[]} memoryKey=\"root\" />;\n const it = frame.item;\n const block = it?.block;\n const variants = block?.variants ?? [];\n const raw = form.getAt(frame.path);\n const cur = isObj(raw) ? raw : {};\n const FieldSection = slots.FieldSection;\n return (\n <div className=\"flex flex-col gap-5\">\n <FrameHeader frame={frame} context={frameContext(frame, parentTitle)} title={frame.title} />\n {block && variants.length > 1 ? (\n <div className=\"flex flex-col gap-1.5\">\n <span className=\"text-kit-sm font-medium text-kit-fg-2\">Layout</span>\n {fitsSegmented(variants.map((v) => v.name)) ? (\n <Segmented\n aria-label=\"Layout\"\n value={String(cur._variant ?? variants[0].id)}\n onChange={(v) => form.setAt([...frame.path, \"_variant\"], v)}\n items={variants.map((v) => ({ value: v.id, label: v.name }))}\n className=\"w-full [&>button]:flex-1\"\n />\n ) : (\n <Select\n aria-label=\"Variant\"\n value={String(cur._variant ?? variants[0].id)}\n onValueChange={(v) => form.setAt([...frame.path, \"_variant\"], v)}\n options={variants.map((v) => ({ value: v.id, label: v.name, description: v.description }))}\n />\n )}\n </div>\n ) : null}\n <FieldList fields={frame.fields} fieldsets={frame.fieldsets} groups={frame.groups} basePath={frame.path} memoryKey={`f:${frame.kind}:${it?.block?.name ?? it?.itemSchema?.name ?? frame.field?.name ?? \"\"}`} />\n {it?.slotField?.slotSettings?.length && FieldSection ? (\n <FieldSection title={`Layout in ${it.slotField.title.toLowerCase()}`} description=\"How this block sits in its parent. The block's own content is above.\" collapsible={false}>\n <FieldList fields={it.slotField.slotSettings} basePath={[...frame.path, \"_settings\"]} memoryKey={`slotset:${it.slotField.name}`} />\n </FieldSection>\n ) : null}\n </div>\n );\n}\n\n/**\n * The context line under a drilled frame's title: \"Tier 1 of 3 in Tiers\" for an item (the item noun is the item\n * schema's title, which the adapter reads back from prod `ui.itemLabel`), \"Address in Author\" for an object.\n */\nexport function frameContext(frame: Frame, parentTitle?: string): string {\n const it = frame.item;\n if (it) {\n const noun = (frame.kind === \"block\" ? it.block?.title : it.itemSchema?.title) ?? \"Item\";\n const owner = (frame.kind === \"block\" ? it.slotField?.title : frame.field?.title) ?? \"the list\";\n return `${noun} ${it.index + 1} of ${it.count} in ${owner}`;\n }\n return parentTitle ? `${frame.field?.title ?? \"Group\"} in ${parentTitle}` : \"Group\";\n}\n\n/**\n * CPO D43 — the drilled frame's header answers \"what am I editing, and where does it live?\":\n * [media?] Starter [↑] [↓] [⋯]\n * Tier 1 of 3 in Tiers\n * The big title lives HERE only; the breadcrumb above is the path (its current crumb is small, D38). Prev / next are\n * labelled icon buttons whose tooltips name the sibling (\"Previous tier: Starter\"). No eyebrow, no duplicate counter.\n * Title 14/24 semibold (owner call). The native title= on the truncating h2 is V2 parity (kit-engine deviation from\n * the dashboard's no-title rule, see run ledger #32).\n */\nexport function FrameHeader({ frame, context, title }: { frame: Frame; context: string; title: string }) {\n const form = useForm()!;\n const { toast } = useKitServices();\n const it = frame.item;\n const media = it ? previewOf(it.block ?? it.itemSchema, form.getAt(frame.path), it.index).media : undefined;\n const step = (d: -1 | 1) => {\n if (!it) return;\n const n = it.index + d;\n if (n < 0 || n >= it.count) return;\n form.navigate([...it.arrayPath, n]);\n };\n const listRaw = it ? form.getAt(it.arrayPath) : undefined;\n const list = Array.isArray(listRaw) ? listRaw : [];\n const noun = (it?.block?.title ?? it?.itemSchema?.title ?? \"item\").toLowerCase();\n const sibling = (i: number) =>\n it && i >= 0 && i < it.count ? (it.titleAt ? it.titleAt(i) : previewOf(it.block ?? it.itemSchema, list[i], i, it.block?.title ?? it.itemSchema?.title).title) : \"\";\n const prev = it ? sibling(it.index - 1) : \"\";\n const next = it ? sibling(it.index + 1) : \"\";\n /* NEW-Q22-ROWLIMIT: the list's own bounds hold here as on its row menu (array.tsx): a duplicate past the maximum or a\n remove below the minimum only left a held, unsavable list */\n const bounds = frame.kind === \"item\" || frame.kind === \"block\" ? frame.field?.validation : undefined;\n const atMax = bounds?.max != null && list.length >= bounds.max;\n const atMin = bounds?.min != null && list.length <= bounds.min;\n /* Duplicate / Remove move to another frame: the menu must not hand focus back to its trigger in the exiting frame\n (it unmounts, focus would drop to <body>); the stage focuses the entering frame instead */\n const moved = React.useRef(false);\n return (\n <div className=\"flex items-start gap-2.5 outline-none\" data-frame-header tabIndex={-1}>\n {media ? <Thumb media={media} size={36} /> : null}\n <div className=\"min-w-0 flex-1\">\n <h2 className=\"truncate text-kit-base font-semibold leading-6 text-kit-fg\" title={title}>\n {title}\n </h2>\n <p className=\"truncate text-kit-xs leading-4 text-kit-fg-3\">{context}</p>\n </div>\n {it ? (\n <div className=\"-mr-1 flex shrink-0 items-center gap-0.5 pt-0.5\">\n <IconButton\n label={prev ? `Previous ${noun}: ${prev}` : `No previous ${noun}`}\n tooltip={prev ? `Previous ${noun}: ${prev}` : `First ${noun}`}\n size=\"sm\"\n disabled={it.index === 0}\n onClick={() => step(-1)}\n >\n <IconArrowUp stroke={1.5} />\n </IconButton>\n <IconButton\n label={next ? `Next ${noun}: ${next}` : `No next ${noun}`}\n tooltip={next ? `Next ${noun}: ${next}` : `Last ${noun}`}\n size=\"sm\"\n disabled={it.index >= it.count - 1}\n onClick={() => step(1)}\n >\n <IconArrowDown stroke={1.5} />\n </IconButton>\n <Menu>\n <Tooltip content={`${title} actions`}>\n <MenuTrigger\n render={\n <IconButton label={`${title} actions`} tooltip={false} size=\"sm\">\n <IconDots stroke={1.5} />\n </IconButton>\n }\n />\n </Tooltip>\n <MenuContent align=\"end\" className=\"w-48\" finalFocus={() => !moved.current}>\n <MenuItem\n icon={<IconCopy stroke={1.5} />}\n disabled={atMax}\n onClick={() => {\n moved.current = true;\n const copy = isObj(list[it.index]) ? { ...(structuredClone(list[it.index]) as object), _key: newKey() } : list[it.index];\n form.setAt(it.arrayPath, [...list.slice(0, it.index + 1), copy, ...list.slice(it.index + 1)]);\n form.navigate([...it.arrayPath, it.index + 1]);\n toast?.success(\"Duplicated\", { description: \"You're now editing the copy.\" });\n }}\n >\n {atMax ? \"Duplicate · limit reached\" : \"Duplicate\"}\n </MenuItem>\n <MenuSeparator />\n <MenuItem\n danger\n icon={<IconTrash stroke={1.5} />}\n disabled={atMin}\n onClick={() => {\n moved.current = true;\n const prevList = list;\n form.navigate(parentFramePath(it.arrayPath));\n form.setAt(it.arrayPath, list.filter((_, j) => j !== it.index));\n toast?.(`“${title}” removed`, { action: { label: \"Undo\", onClick: () => form.setAt(it.arrayPath, prevList) }, duration: 10_000 });\n }}\n >\n {atMin ? `Remove · at least ${bounds?.min} required` : \"Remove\"}\n </MenuItem>\n </MenuContent>\n </Menu>\n </div>\n ) : null}\n </div>\n );\n}\n/** The frame that owns an array: drop the array field name (and the item index above it, if any). */\nconst parentFramePath = (arrayPath: FieldPath): FieldPath => arrayPath.slice(0, -1);\n\n/* ── Stage: direction-aware slide, scroll memory, focus, keys (V2 schema-form) ───────────────── */\n/** The title shown as `parentTitle` for the current frame (the root crumb's label for depth 1). */\nexport function parentTitleOf(frames: Frame[], rootLabel: string): string | undefined {\n if (frames.length < 2) return undefined;\n return frames.length === 2 ? rootLabel : frames[frames.length - 2].title;\n}\n\n/** Floating layers (Base UI popups carry these roles); keys and focus coming from one belong to that layer. */\nconst LAYER = \"[role=dialog],[role=menu],[role=listbox]\";\n\n/** Slide direction for a frame change: deeper → 1, shallower → −1, a sibling step → by index. */\nexport function frameDirection(prev: { depth: number; index: number; key: string }, frames: Frame[], key: string): 0 | 1 | -1 {\n if (prev.key === key) return 0;\n const cur = frames[frames.length - 1];\n if (frames.length > prev.depth) return 1;\n if (frames.length < prev.depth) return -1;\n return (cur.item?.index ?? 0) >= prev.index ? 1 : -1;\n}\n\n/**\n * The drill-in stack's behaviour. `root` wraps the form (keys bubble to it), `scroller` is the scrolling element (or\n * null when the host scrolls). Returns the current frame, its key, the slide direction and the form's onKeyDown.\n */\nexport function useFrameNavigation({\n frames,\n navigate,\n root,\n scroller,\n}: {\n frames: Frame[];\n navigate: (path: FieldPath) => void;\n root: React.RefObject<HTMLElement | null>;\n scroller: React.RefObject<HTMLElement | null>;\n}) {\n const current = frames[frames.length - 1];\n const frameKey = frameKeyOf(current.path);\n const prev = React.useRef({ depth: frames.length, index: current.item?.index ?? 0, key: frameKey });\n const dir = frameDirection(prev.current, frames, frameKey);\n const dirRef = React.useRef<number>(1);\n if (dir) dirRef.current = dir;\n\n const scrollMem = React.useRef(new Map<string, number>());\n React.useLayoutEffect(() => {\n const was = prev.current.key;\n if (was === frameKey) return;\n if (scroller.current) scrollMem.current.set(was, scroller.current.scrollTop);\n prev.current = { depth: frames.length, index: current.item?.index ?? 0, key: frameKey };\n const el = scroller.current;\n if (el) el.scrollTop = scrollMem.current.get(frameKey) ?? 0;\n const active = document.activeElement;\n /* a move started from a portalled menu (FrameHeader ⋯ → Duplicate / Remove) leaves focus in that layer, outside root */\n const layer = active && active !== document.body ? active.closest(LAYER) : null;\n const fromLayer = !!layer && !layer.contains(root.current);\n if (root.current && (active === document.body || root.current.contains(active) || fromLayer)) {\n // the exiting frame is still mounted during its exit animation — focus the ENTERING one\n const target = root.current.querySelector<HTMLElement>(`[data-frame-body=\"${CSS.escape(frameKey)}\"]`);\n target?.focus({ preventScroll: true });\n }\n });\n\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (e.defaultPrevented) return;\n const t = e.target as HTMLElement;\n // ignore keys from floating layers opened by this form; a form INSIDE a dialog still handles its own keys\n // (V2 also listed Radix's popper wrapper; Base UI popups carry these roles themselves)\n const layer = t.closest(LAYER);\n if (layer && root.current && !layer.contains(root.current)) return;\n if (e.key === \"Escape\" && frames.length > 1 && !t.isContentEditable) {\n e.preventDefault();\n e.stopPropagation();\n navigate(frames[frames.length - 2].path);\n return;\n }\n const it = current.item;\n if (it && (e.key === \"ArrowUp\" || e.key === \"ArrowDown\")) {\n const typing = t.matches(\"input,textarea,select\") || t.isContentEditable;\n if (e.altKey || (!typing && t.matches(\"[data-frame-body],[data-frame-header]\"))) {\n const n = it.index + (e.key === \"ArrowUp\" ? -1 : 1);\n if (n >= 0 && n < it.count) {\n e.preventDefault();\n navigate([...it.arrayPath, n]);\n }\n }\n }\n };\n\n return { current, frameKey, dir: dirRef.current, onKeyDown };\n}\n\nconst EASE: [number, number, number, number] = [0.22, 1, 0.36, 1];\n\n/**\n * The frame body with V2's slide: 24px along the travel direction + fade, 220ms, ease [0.22, 1, 0.36, 1]; reduced\n * motion keeps only the fade. `before` renders inside the root frame above its fields (the synced-from note).\n */\nexport function FrameStage({\n frames,\n frameKey,\n dir,\n rootLabel,\n variant,\n before,\n review,\n}: {\n frames: Frame[];\n frameKey: string;\n dir: number;\n rootLabel: string;\n variant: \"panel\" | \"document\";\n before?: React.ReactNode;\n /** D61 Review changes is on: the clip leaves 16px on the left for the change bars */\n review?: boolean;\n}) {\n const reduce = useReducedMotion();\n const current = frames[frames.length - 1];\n return (\n // the drill slide is clipped sideways; with Review changes on (D61) the clip leaves 16px on the left for the change bars\n <div className=\"relative\" style={review ? { clipPath: \"inset(-100vh 0 -100vh -16px)\" } : { overflowX: \"clip\" }}>\n <AnimatePresence mode=\"popLayout\" initial={false} custom={dir}>\n <motion.div\n key={frameKey}\n custom={dir}\n variants={{\n enter: (d: number) => ({ x: reduce ? 0 : d * 24, opacity: 0 }),\n center: { x: 0, opacity: 1 },\n exit: (d: number) => ({ x: reduce ? 0 : d * -24, opacity: 0 }),\n }}\n initial=\"enter\"\n animate=\"center\"\n exit=\"exit\"\n transition={{ duration: 0.22, ease: EASE }}\n data-frame-body={frameKey}\n tabIndex={-1}\n className={cn(\"outline-none focus-visible:shadow-none\", variant === \"document\" ? \"py-1\" : \"px-4 py-4\")}\n >\n {current.kind === \"root\" ? before : null}\n <FrameView frame={current} parentTitle={parentTitleOf(frames, rootLabel)} />\n </motion.div>\n </AnimatePresence>\n </div>\n );\n}\n\nexport { HISTORY_SEGMENT };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAM,WAAW,MAAM,cAA0B,CAAC,CAAC;AACnD,IAAa,qBAAqB,SAAS;AAC3C,IAAa,sBAAsB,MAAM,WAAW,QAAQ;;AAG5D,SAAS,eAAe,EAAE,QAAQ,YAAiC;CACjE,MAAM,OAAO,QAAQ;CACrB,MAAM,MAAM,SAAS,SAAS,KAAK,MAAM,QAAQ,IAAI,KAAK;CAC1D,MAAM,SAAS,MAAM,GAAG,IAAI,MAAM,CAAC;CACnC,MAAM,KAAK,QAAQ,MAAM,QAAQ;CACjC,MAAM,QAAQ,OAAO,QAAQ,MAAM,CAAC,SAAS,GAAG,QAAQ,EAAE,CAAC;CAC3D,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACG,MAAM,KAAK,MACV,oBAAC,OAAD;GAAkB,WAAU;GAC1B,UAAA,oBAAC,UAAD;IAAU,OAAO;IAAG,MAAM,CAAC,GAAG,UAAU,EAAE,IAAI;IAAW;GAAS,CAAA;EAC/D,GAFK,EAAE,IAEP,CACN,GACA,MAAM,WAAW,IAAI,oBAAC,KAAD;GAAG,WAAU;GAA6C,UAAA;EAAsB,CAAA,IAAI,IACvG;;AAET;;AAGA,SAAS,gBAAgB,EAAE,SAA2B;CACpD,MAAM,OAAO,QAAQ;CACrB,MAAM,KAAK,MAAM,MAAM;CACvB,MA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AAQ;GACxD,UAAA,qBAAC,OAAO,KAAR;IAEE,QAAQ;IACR,UAAU;KACR,QAAQ,OAAe;MAAE,GAAG,SAAS,IAAI,IAAI;MAAI,SAAS;KAAE;KAC5D,QAAQ;MAAE,GAAG;MAAG,SAAS;KAAE;KAC3B,OAAO,OAAe;MAAE,GAAG,SAAS,IAAI,IAAI;MAAK,SAAS;KAAE;IAC9D;IACA,SAAQ;IACR,SAAQ;IACR,MAAK;IACL,YAAY;KAAE,UAAU;KAAM,MAAM;IAAK;IACzC,mBAAiB;IACjB,UAAU;IACV,WAAW,GAAG,0CAA0C,YAAY,aAAa,SAAS,WAAW;IAdvG,UAAA,CAgBG,QAAQ,SAAS,SAAS,SAAS,MACpC,oBAAC,WAAD;KAAW,OAAO;KAAS,aAAa,cAAc,QAAQ,SAAS;IAAI,CAAA,CACjE;GAjBL,GAAA,QAiBK;EACG,CAAA;CACd,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"frame.js","names":[],"sources":["../../src/engine/frame.tsx"],"sourcesContent":["/**\n * FrameView — what the panel shows for the current breadcrumb: the root fields, a drilled object / array item /\n * slot block (with \"2 of 4\" stepper, variant switcher and per-slot layout settings), the one button screen,\n * or a field's history as a stacked panel. Port of V2 engine/frame.tsx.\n *\n * FrameStage + useFrameNavigation — V2 schema-form's drill-in stage (direction-aware slide, scroll memory per frame,\n * focus on the entering frame, Esc / ⌥↑↓). Exported here so SchemaForm wires them without re-deriving the motion.\n *\n * FrameSlots — the frame draws other lanes' pieces (FieldList / FieldSection from grouping, ButtonScreen from link,\n * TableFrame from table). They arrive through context so this file never imports a module that does not exist yet;\n * a missing slot falls back to a plain field list (FieldList), the raw value (ButtonScreen, through\n * FallbackControl), a named note (TableFrame) or nothing (FieldSection). SchemaForm always hands ButtonScreen and TableFrame.\n */\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"framer-motion\";\nimport { IconArrowDown, IconArrowUp, IconCopy, IconDots, IconTrash } from \"@tabler/icons-react\";\nimport { IconButton } from \"../ui/button\";\nimport { Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Tooltip } from \"../ui/overlay\";\nimport { Segmented } from \"../ui/controls\";\nimport { fitsSegmented } from \"../ui/choice-switch\";\nimport { Select } from \"../ui/select\";\nimport { resolveFieldAccess, useForm, useKitEnv, useKitServices } from \"../context\";\nimport { cn } from \"../lib/cn\";\nimport { HISTORY_SEGMENT, type FieldGroup, type FieldPath, type FieldSchema, type Fieldset } from \"../schema/types\";\nimport type { Frame } from \"../lib/frames\";\nimport { frameKeyOf, isObj, newKey } from \"../lib/path\";\nimport { condCtx, isHidden, itemSchemaFor, previewOf } from \"../lib/schema\";\nimport { Thumb } from \"./bits\";\nimport { FallbackControl, KitField } from \"./kit-field\";\n\n/* ── Slots (other lanes) ───────────────────────────────────────────── */\nexport interface FrameFieldListProps {\n fields: FieldSchema[];\n fieldsets?: Fieldset[];\n groups?: FieldGroup[];\n basePath: FieldPath;\n memoryKey: string;\n}\nexport interface FrameSlots {\n /** grouping lane: engine/field-list.tsx `FieldList` */\n FieldList?: React.ComponentType<FrameFieldListProps>;\n /** grouping lane: engine/grouping.tsx `FieldSection` (the slot-settings section of a slot block) */\n FieldSection?: React.ComponentType<{ title: string; description?: string; collapsible?: boolean; children: React.ReactNode }>;\n /** link lane: controls/link.tsx `ButtonScreen` + `normLink` (the \"button\" frame) */\n ButtonScreen?: React.ComponentType<{ value: unknown; onChange: (v: unknown) => void; title: string; readOnly?: boolean }>;\n normLink?: (v: unknown) => { label?: string };\n /** table lane: controls/table.tsx `TableFrame` (tableRow / tableColumn frames) */\n TableFrame?: React.ComponentType<{ frame: Frame }>;\n}\nconst SlotsCtx = React.createContext<FrameSlots>({});\nexport const FrameSlotsProvider = SlotsCtx.Provider;\nexport const useFrameSlots = () => React.useContext(SlotsCtx);\n\n/** Stand-in until the grouping lane's FieldList lands: the frame's visible fields in schema order. */\nfunction PlainFieldList({ fields, basePath }: FrameFieldListProps) {\n const form = useForm()!;\n const raw = basePath.length ? form.getAt(basePath) : form.value;\n const parent = isObj(raw) ? raw : {};\n const cc = condCtx(form, basePath);\n const shown = fields.filter((f) => !isHidden(f, parent, cc));\n return (\n <div className=\"flex flex-col gap-5\">\n {shown.map((f) => (\n <div key={f.name} className=\"min-w-0\">\n <KitField field={f} path={[...basePath, f.name]} parent={parent} />\n </div>\n ))}\n {shown.length === 0 ? <p className=\"py-6 text-center text-kit-sm text-kit-fg-3\">No fields here yet.</p> : null}\n </div>\n );\n}\n\n/** A button frame outside SchemaForm (no ButtonScreen slot) edits the button's raw value (FallbackControl), never an empty body. */\nfunction RawButtonScreen({ frame }: { frame: Frame }) {\n const form = useForm()!;\n const id = React.useId();\n const field = frame.field ?? { name: String(frame.path.at(-1) ?? \"button\"), title: frame.title, type: \"button\" as const };\n return <FallbackControl field={field} value={form.getAt(frame.path)} onChange={(n) => form.setAt(frame.path, n)} id={id} path={frame.path} />;\n}\n\n/** The button frame: header (the button's label) + the kit ButtonScreen, read-only when the lens can't edit the field. */\nfunction ButtonFrame({ frame, parentTitle }: { frame: Frame; parentTitle?: string }) {\n const form = useForm()!;\n const env = useKitEnv();\n const slots = useFrameSlots();\n const v = form.getAt(frame.path);\n const ButtonScreen = slots.ButtonScreen;\n const readOnly = frame.field ? resolveFieldAccess(frame.field, env).readOnly : !!env.readOnly;\n return (\n <div className=\"flex flex-col gap-5\">\n <FrameHeader frame={frame} context={parentTitle ? `${frame.title} in ${parentTitle}` : frame.title} title={slots.normLink?.(v).label || frame.title} />\n {ButtonScreen ? <ButtonScreen value={v} onChange={(n) => form.setAt(frame.path, n)} title={frame.title} readOnly={readOnly} /> : <RawButtonScreen frame={frame} />}\n </div>\n );\n}\n\n/* ── FrameView ─────────────────────────────────────────────────────── */\nexport function FrameView({ frame, parentTitle }: { frame: Frame; parentTitle?: string }) {\n const form = useForm()!;\n const slots = useFrameSlots();\n const FieldList = slots.FieldList ?? PlainFieldList;\n if (frame.kind === \"history\") return null; // D61: a field's history is the host's one History panel (onFieldHistory)\n if (frame.kind === \"button\") return <ButtonFrame frame={frame} parentTitle={parentTitle} />;\n // D50: a table row or column drills exactly like an array item: the same header (title, n of N, ↑ ↓ ⋯), its cells below\n if (frame.kind === \"tableRow\" || frame.kind === \"tableColumn\") {\n const it = frame.item!;\n const TableFrame = slots.TableFrame;\n return (\n <div className=\"flex flex-col gap-5\">\n <FrameHeader frame={frame} context={`${it.itemSchema?.title} ${it.index + 1} of ${it.count} in ${frame.field?.title ?? \"the table\"}`} title={frame.title} />\n {TableFrame ? (\n <TableFrame frame={frame} />\n ) : (\n /* Only the kit table control opens a row or column frame; until it is ported the table is the host's control,\n which edits rows in place. A path restored into one says so instead of drawing an empty body. */\n <p role=\"note\" data-kit-legacy=\"table\" className=\"text-kit-sm text-kit-fg-3\">\n This table's rows and columns are edited in the table itself.\n </p>\n )}\n </div>\n );\n }\n if (frame.kind === \"root\") return <FieldList fields={frame.fields} fieldsets={frame.fieldsets} groups={frame.groups} basePath={[]} memoryKey=\"root\" />;\n const it = frame.item;\n const block = it?.block;\n const variants = block?.variants ?? [];\n const raw = form.getAt(frame.path);\n const cur = isObj(raw) ? raw : {};\n const FieldSection = slots.FieldSection;\n return (\n <div className=\"flex flex-col gap-5\">\n <FrameHeader frame={frame} context={frameContext(frame, parentTitle)} title={frame.title} />\n {block && variants.length > 1 ? (\n <div className=\"flex flex-col gap-1.5\">\n <span className=\"text-kit-sm font-medium text-kit-fg-2\">Layout</span>\n {fitsSegmented(variants.map((v) => v.name)) ? (\n <Segmented\n aria-label=\"Layout\"\n value={String(cur._variant ?? variants[0].id)}\n onChange={(v) => form.setAt([...frame.path, \"_variant\"], v)}\n items={variants.map((v) => ({ value: v.id, label: v.name }))}\n className=\"w-full [&>button]:flex-1\"\n />\n ) : (\n <Select\n aria-label=\"Variant\"\n value={String(cur._variant ?? variants[0].id)}\n onValueChange={(v) => form.setAt([...frame.path, \"_variant\"], v)}\n options={variants.map((v) => ({ value: v.id, label: v.name, description: v.description }))}\n />\n )}\n </div>\n ) : null}\n <FieldList fields={frame.fields} fieldsets={frame.fieldsets} groups={frame.groups} basePath={frame.path} memoryKey={`f:${frame.kind}:${it?.block?.name ?? it?.itemSchema?.name ?? frame.field?.name ?? \"\"}`} />\n {it?.slotField?.slotSettings?.length && FieldSection ? (\n <FieldSection title={`Layout in ${it.slotField.title.toLowerCase()}`} description=\"How this block sits in its parent. The block's own content is above.\" collapsible={false}>\n <FieldList fields={it.slotField.slotSettings} basePath={[...frame.path, \"_settings\"]} memoryKey={`slotset:${it.slotField.name}`} />\n </FieldSection>\n ) : null}\n </div>\n );\n}\n\n/**\n * The context line under a drilled frame's title: \"Tier 1 of 3 in Tiers\" for an item (the item noun is the item\n * schema's title, which the adapter reads back from prod `ui.itemLabel`), \"Address in Author\" for an object.\n */\nexport function frameContext(frame: Frame, parentTitle?: string): string {\n const it = frame.item;\n if (it) {\n const noun = (frame.kind === \"block\" ? it.block?.title : it.itemSchema?.title) ?? \"Item\";\n const owner = (frame.kind === \"block\" ? it.slotField?.title : frame.field?.title) ?? \"the list\";\n return `${noun} ${it.index + 1} of ${it.count} in ${owner}`;\n }\n return parentTitle ? `${frame.field?.title ?? \"Group\"} in ${parentTitle}` : \"Group\";\n}\n\n/**\n * CPO D43 — the drilled frame's header answers \"what am I editing, and where does it live?\":\n * [media?] Starter [↑] [↓] [⋯]\n * Tier 1 of 3 in Tiers\n * The big title lives HERE only; the breadcrumb above is the path (its current crumb is small, D38). Prev / next are\n * labelled icon buttons whose tooltips name the sibling (\"Previous tier: Starter\"). No eyebrow, no duplicate counter.\n * Title 14/24 semibold (owner call). The native title= on the truncating h2 is V2 parity (kit-engine deviation from\n * the dashboard's no-title rule, see run ledger #32).\n */\nexport function FrameHeader({ frame, context, title }: { frame: Frame; context: string; title: string }) {\n const form = useForm()!;\n const { toast } = useKitServices();\n const it = frame.item;\n const media = it ? previewOf(it.block ?? it.itemSchema, form.getAt(frame.path), it.index).media : undefined;\n const step = (d: -1 | 1) => {\n if (!it) return;\n const n = it.index + d;\n if (n < 0 || n >= it.count) return;\n form.navigate([...it.arrayPath, n]);\n };\n const listRaw = it ? form.getAt(it.arrayPath) : undefined;\n const list = Array.isArray(listRaw) ? listRaw : [];\n const noun = (it?.block?.title ?? it?.itemSchema?.title ?? \"item\").toLowerCase();\n /* NEW-Q49-POLYSIBLING: in a mixed list a neighbour is named and previewed by its OWN type, not the current item's\n (a photo post's URL read as \"Next store review: https://…\") */\n const schemaAt = (i: number) => {\n const v = list[i];\n if (frame.kind === \"item\" && frame.field) return itemSchemaFor(frame.field, v) ?? it?.itemSchema;\n if (frame.kind === \"block\") return (isObj(v) && typeof v._type === \"string\" ? form.resolveSchema?.(v._type) : undefined) ?? it?.block;\n return it?.block ?? it?.itemSchema;\n };\n const nounAt = (i: number) => (it?.titleAt ? noun : (schemaAt(i)?.title ?? \"item\").toLowerCase());\n const sibling = (i: number) =>\n it && i >= 0 && i < it.count ? (it.titleAt ? it.titleAt(i) : previewOf(schemaAt(i), list[i], i, schemaAt(i)?.title).title) : \"\";\n const prev = it ? sibling(it.index - 1) : \"\";\n const next = it ? sibling(it.index + 1) : \"\";\n const prevNoun = it ? nounAt(it.index - 1) : noun;\n const nextNoun = it ? nounAt(it.index + 1) : noun;\n /* NEW-Q22-ROWLIMIT: the list's own bounds hold here as on its row menu (array.tsx): a duplicate past the maximum or a\n remove below the minimum only left a held, unsavable list */\n const bounds = frame.kind === \"item\" || frame.kind === \"block\" ? frame.field?.validation : undefined;\n const atMax = bounds?.max != null && list.length >= bounds.max;\n const atMin = bounds?.min != null && list.length <= bounds.min;\n /* NEW-Q48-ITEMACTIONS: a read-only list (a locked section, a viewer) offers no Duplicate / Remove: the host drops the\n write, so the menu only announced a change that never happened */\n const env = useKitEnv();\n const readOnly = frame.field ? resolveFieldAccess(frame.field, env).readOnly : !!env.readOnly;\n /* Duplicate / Remove move to another frame: the menu must not hand focus back to its trigger in the exiting frame\n (it unmounts, focus would drop to <body>); the stage focuses the entering frame instead */\n const moved = React.useRef(false);\n return (\n <div className=\"flex items-start gap-2.5 outline-none\" data-frame-header tabIndex={-1}>\n {media ? <Thumb media={media} size={36} /> : null}\n <div className=\"min-w-0 flex-1\">\n <h2 className=\"truncate text-kit-base font-semibold leading-6 text-kit-fg\" title={title}>\n {title}\n </h2>\n <p className=\"truncate text-kit-xs leading-4 text-kit-fg-3\">{context}</p>\n </div>\n {it ? (\n <div className=\"-mr-1 flex shrink-0 items-center gap-0.5 pt-0.5\">\n <IconButton\n label={prev ? `Previous ${prevNoun}: ${prev}` : `No previous ${noun}`}\n tooltip={prev ? `Previous ${prevNoun}: ${prev}` : `First ${noun}`}\n size=\"sm\"\n disabled={it.index === 0}\n onClick={() => step(-1)}\n >\n <IconArrowUp stroke={1.5} />\n </IconButton>\n <IconButton\n label={next ? `Next ${nextNoun}: ${next}` : `No next ${noun}`}\n tooltip={next ? `Next ${nextNoun}: ${next}` : `Last ${noun}`}\n size=\"sm\"\n disabled={it.index >= it.count - 1}\n onClick={() => step(1)}\n >\n <IconArrowDown stroke={1.5} />\n </IconButton>\n {readOnly ? null : (\n <Menu>\n <Tooltip content={`${title} actions`}>\n <MenuTrigger\n render={\n <IconButton label={`${title} actions`} tooltip={false} size=\"sm\">\n <IconDots stroke={1.5} />\n </IconButton>\n }\n />\n </Tooltip>\n <MenuContent align=\"end\" className=\"w-48\" finalFocus={() => !moved.current}>\n <MenuItem\n icon={<IconCopy stroke={1.5} />}\n disabled={atMax}\n onClick={() => {\n moved.current = true;\n const copy = isObj(list[it.index]) ? { ...(structuredClone(list[it.index]) as object), _key: newKey() } : list[it.index];\n form.setAt(it.arrayPath, [...list.slice(0, it.index + 1), copy, ...list.slice(it.index + 1)]);\n form.navigate([...it.arrayPath, it.index + 1]);\n toast?.success(\"Duplicated\", { description: \"You're now editing the copy.\" });\n }}\n >\n {atMax ? \"Duplicate · limit reached\" : \"Duplicate\"}\n </MenuItem>\n <MenuSeparator />\n <MenuItem\n danger\n icon={<IconTrash stroke={1.5} />}\n disabled={atMin}\n onClick={() => {\n moved.current = true;\n const prevList = list;\n form.navigate(parentFramePath(it.arrayPath));\n form.setAt(it.arrayPath, list.filter((_, j) => j !== it.index));\n toast?.(`“${title}” removed`, { action: { label: \"Undo\", onClick: () => form.setAt(it.arrayPath, prevList) }, duration: 10_000 });\n }}\n >\n {atMin ? `Remove · at least ${bounds?.min} required` : \"Remove\"}\n </MenuItem>\n </MenuContent>\n </Menu>\n )}\n </div>\n ) : null}\n </div>\n );\n}\n/** The frame that owns an array: drop the array field name (and the item index above it, if any). */\nconst parentFramePath = (arrayPath: FieldPath): FieldPath => arrayPath.slice(0, -1);\n\n/* ── Stage: direction-aware slide, scroll memory, focus, keys (V2 schema-form) ───────────────── */\n/** The title shown as `parentTitle` for the current frame (the root crumb's label for depth 1). */\nexport function parentTitleOf(frames: Frame[], rootLabel: string): string | undefined {\n if (frames.length < 2) return undefined;\n return frames.length === 2 ? rootLabel : frames[frames.length - 2].title;\n}\n\n/** Floating layers (Base UI popups carry these roles); keys and focus coming from one belong to that layer. */\nconst LAYER = \"[role=dialog],[role=menu],[role=listbox]\";\n\n/** Slide direction for a frame change: deeper → 1, shallower → −1, a sibling step → by index. */\nexport function frameDirection(prev: { depth: number; index: number; key: string }, frames: Frame[], key: string): 0 | 1 | -1 {\n if (prev.key === key) return 0;\n const cur = frames[frames.length - 1];\n if (frames.length > prev.depth) return 1;\n if (frames.length < prev.depth) return -1;\n return (cur.item?.index ?? 0) >= prev.index ? 1 : -1;\n}\n\n/**\n * The drill-in stack's behaviour. `root` wraps the form (keys bubble to it), `scroller` is the scrolling element (or\n * null when the host scrolls). Returns the current frame, its key, the slide direction and the form's onKeyDown.\n */\nexport function useFrameNavigation({\n frames,\n navigate,\n root,\n scroller,\n}: {\n frames: Frame[];\n navigate: (path: FieldPath) => void;\n root: React.RefObject<HTMLElement | null>;\n scroller: React.RefObject<HTMLElement | null>;\n}) {\n const current = frames[frames.length - 1];\n const frameKey = frameKeyOf(current.path);\n const prev = React.useRef({ depth: frames.length, index: current.item?.index ?? 0, key: frameKey });\n const dir = frameDirection(prev.current, frames, frameKey);\n const dirRef = React.useRef<number>(1);\n if (dir) dirRef.current = dir;\n\n const scrollMem = React.useRef(new Map<string, number>());\n React.useLayoutEffect(() => {\n const was = prev.current.key;\n if (was === frameKey) return;\n if (scroller.current) scrollMem.current.set(was, scroller.current.scrollTop);\n prev.current = { depth: frames.length, index: current.item?.index ?? 0, key: frameKey };\n const el = scroller.current;\n if (el) el.scrollTop = scrollMem.current.get(frameKey) ?? 0;\n const active = document.activeElement;\n /* a move started from a portalled menu (FrameHeader ⋯ → Duplicate / Remove) leaves focus in that layer, outside root */\n const layer = active && active !== document.body ? active.closest(LAYER) : null;\n const fromLayer = !!layer && !layer.contains(root.current);\n if (root.current && (active === document.body || root.current.contains(active) || fromLayer)) {\n // the exiting frame is still mounted during its exit animation — focus the ENTERING one\n const target = root.current.querySelector<HTMLElement>(`[data-frame-body=\"${CSS.escape(frameKey)}\"]`);\n target?.focus({ preventScroll: true });\n }\n });\n\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (e.defaultPrevented) return;\n const t = e.target as HTMLElement;\n // ignore keys from floating layers opened by this form; a form INSIDE a dialog still handles its own keys\n // (V2 also listed Radix's popper wrapper; Base UI popups carry these roles themselves)\n const layer = t.closest(LAYER);\n if (layer && root.current && !layer.contains(root.current)) return;\n if (e.key === \"Escape\" && frames.length > 1 && !t.isContentEditable) {\n e.preventDefault();\n e.stopPropagation();\n navigate(frames[frames.length - 2].path);\n return;\n }\n const it = current.item;\n if (it && (e.key === \"ArrowUp\" || e.key === \"ArrowDown\")) {\n const typing = t.matches(\"input,textarea,select\") || t.isContentEditable;\n if (e.altKey || (!typing && t.matches(\"[data-frame-body],[data-frame-header]\"))) {\n const n = it.index + (e.key === \"ArrowUp\" ? -1 : 1);\n if (n >= 0 && n < it.count) {\n e.preventDefault();\n navigate([...it.arrayPath, n]);\n }\n }\n }\n };\n\n return { current, frameKey, dir: dirRef.current, onKeyDown };\n}\n\nconst EASE: [number, number, number, number] = [0.22, 1, 0.36, 1];\n\n/**\n * The frame body with V2's slide: 24px along the travel direction + fade, 220ms, ease [0.22, 1, 0.36, 1]; reduced\n * motion keeps only the fade. `before` renders inside the root frame above its fields (the synced-from note).\n */\nexport function FrameStage({\n frames,\n frameKey,\n dir,\n rootLabel,\n variant,\n before,\n review,\n}: {\n frames: Frame[];\n frameKey: string;\n dir: number;\n rootLabel: string;\n variant: \"panel\" | \"document\";\n before?: React.ReactNode;\n /** D61 Review changes is on: the clip leaves 16px on the left for the change bars */\n review?: boolean;\n}) {\n const reduce = useReducedMotion();\n const current = frames[frames.length - 1];\n return (\n // the drill slide is clipped sideways; with Review changes on (D61) the clip leaves 16px on the left for the change bars\n <div className=\"relative\" style={review ? { clipPath: \"inset(-100vh 0 -100vh -16px)\" } : { overflowX: \"clip\" }}>\n <AnimatePresence mode=\"popLayout\" initial={false} custom={dir}>\n <motion.div\n key={frameKey}\n custom={dir}\n variants={{\n enter: (d: number) => ({ x: reduce ? 0 : d * 24, opacity: 0 }),\n center: { x: 0, opacity: 1 },\n exit: (d: number) => ({ x: reduce ? 0 : d * -24, opacity: 0 }),\n }}\n initial=\"enter\"\n animate=\"center\"\n exit=\"exit\"\n transition={{ duration: 0.22, ease: EASE }}\n data-frame-body={frameKey}\n tabIndex={-1}\n className={cn(\"outline-none focus-visible:shadow-none\", variant === \"document\" ? \"py-1\" : \"px-4 py-4\")}\n >\n {current.kind === \"root\" ? before : null}\n <FrameView frame={current} parentTitle={parentTitleOf(frames, rootLabel)} />\n </motion.div>\n </AnimatePresence>\n </div>\n );\n}\n\nexport { HISTORY_SEGMENT };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAM,WAAW,MAAM,cAA0B,CAAC,CAAC;AACnD,IAAa,qBAAqB,SAAS;AAC3C,IAAa,sBAAsB,MAAM,WAAW,QAAQ;;AAG5D,SAAS,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A+B,IAAI,EAAE,WAAW,OAAO;EAC3G,UAAA,oBAAC,iBAAD;GAAiB,MAAK;GAAY,SAAS;GAAO,QAAQ;GACxD,UAAA,qBAAC,OAAO,KAAR;IAEE,QAAQ;IACR,UAAU;KACR,QAAQ,OAAe;MAAE,GAAG,SAAS,IAAI,IAAI;MAAI,SAAS;KAAE;KAC5D,QAAQ;MAAE,GAAG;MAAG,SAAS;KAAE;KAC3B,OAAO,OAAe;MAAE,GAAG,SAAS,IAAI,IAAI;MAAK,SAAS;KAAE;IAC9D;IACA,SAAQ;IACR,SAAQ;IACR,MAAK;IACL,YAAY;KAAE,UAAU;KAAM,MAAM;IAAK;IACzC,mBAAiB;IACjB,UAAU;IACV,WAAW,GAAG,0CAA0C,YAAY,aAAa,SAAS,WAAW;IAdvG,UAAA,CAgBG,QAAQ,SAAS,SAAS,SAAS,MACpC,oBAAC,WAAD;KAAW,OAAO;KAAS,aAAa,cAAc,QAAQ,SAAS;IAAI,CAAA,CACjE;GAjBL,GAAA,QAiBK;EACG,CAAA;CACd,CAAA;AAET"}
|
package/dist/engine/kit-field.js
CHANGED
|
@@ -463,6 +463,8 @@ function PlainValue({ field, value, id }) {
|
|
|
463
463
|
return /* @__PURE__ */ jsx("p", {
|
|
464
464
|
id,
|
|
465
465
|
tabIndex: 0,
|
|
466
|
+
role: "group",
|
|
467
|
+
"aria-labelledby": `${id}-label ${id}`,
|
|
466
468
|
"data-slot": "kit-plain",
|
|
467
469
|
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"),
|
|
468
470
|
children: text || /* @__PURE__ */ jsx("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit-field.js","names":[],"sources":["../../src/engine/kit-field.tsx"],"sourcesContent":["/**\n * KitField — renders ONE field of the schema at `path` (must be inside <SchemaForm>): the shell + the control for its\n * type (V2 HEAD 9829bf1 kit/engine/kit-field.tsx).\n *\n * Arrays (array.tsx) and slots (slot.tsx) get their rows; objects open inline (FieldInset), drill (NavRow -> a frame),\n * popover or dialog (NestedForm: its own navigation stack). Primitive types dispatch through the CONTROLS table, which\n * the controls lanes fill. Every SchemaType has a control there; a type that is none of them (a schema newer than this\n * kit) edits its raw value in the JSON control (FallbackControl), never nothing and never a stand-in.\n */\nimport * as React from \"react\";\nimport type { ComponentType } from \"react\";\nimport { IconChevronRight } from \"@tabler/icons-react\";\nimport { KitIcon } from \"../lib/icons\";\nimport { cn } from \"../lib/cn\";\nimport type { FieldPath, FieldSchema, PrimitiveType, SchemaType } from \"../schema/types\";\nimport { resolveHelp } from \"../schema/help\";\nimport type { ControlProps } from \"../types\";\nimport { resolveFieldAccess, useForm, useKitEnv, useKitServices, type KitPeer } from \"../context\";\nimport { Button } from \"../ui/button\";\nimport { Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, Popover, PopoverContent, PopoverTrigger } from \"../ui/overlay\";\nimport { isObj, pathKey } from \"../lib/path\";\nimport { condCtx, isHidden, objectOpenMode, plainText, summarize } from \"../lib/schema\";\nimport { isIconImage } from \"../lib/icon-image\";\nimport { ArrayField, type NestedFormProps } from \"./array\";\nimport { ExpandAction, ExpandedField, expandKey, expandSpecFor, isExpandShortcut, openExpanded } from \"./expand\";\nimport { FieldShell } from \"./field-shell\";\nimport { FieldList } from \"./field-list\";\nimport { IssueDot, RowChrome } from \"./bits\";\nimport { FieldInset, FieldRun, groupSummary, useInsetDepth } from \"./grouping\";\nimport { SchemaForm } from \"./schema-form\";\nimport { SlotField } from \"./slot\";\nimport { JsonControl } from \"../controls/json\";\n\nexport interface KitFieldProps {\n field: FieldSchema;\n path: (string | number)[];\n parent?: Record<string, unknown>;\n}\n\n/** Type → control. Registered by the controls lane; a type with no entry edits its raw value (FallbackControl). */\nexport const CONTROLS: Partial<Record<SchemaType, ComponentType<ControlProps>>> = {};\n\n/**\n * Type → label-row action (DESIGN 4.4: slug Generate, rich text expand, table Edit in full screen), registered by the\n * controls lane next to its control. It gets the control's props. V2 draws it only while the field is editable, except\n * the types in ACTION_WHEN_READ_ONLY, whose action takes `readOnly` and decides for itself (slug Generate).\n */\nexport const ACTIONS: Partial<Record<SchemaType, ComponentType<ControlProps>>> = {};\nexport const ACTION_WHEN_READ_ONLY = new Set<SchemaType>([\"slug\"]);\n\n/** D58: the field for the lens: read-only (plain text) when it can't edit it. Hidden fields never reach here\n * (SchemaForm drops them from the schema). */\nexport function useFieldAccess(field: FieldSchema) {\n const env = useKitEnv();\n return { readOnly: resolveFieldAccess(field, env).readOnly };\n}\n\n/** CPO D39: the field's help line — schema text first, then a line computed from its settings, then the house convention. */\nexport function withDefaultHelp(field: FieldSchema, isPublished?: boolean, readOnly?: boolean): FieldSchema {\n let computed: string | undefined;\n /* a value set elsewhere says where, in one plain line (never a lock or a key) */\n if (readOnly && field.lockReason) return { ...field, description: field.lockReason.replace(/\\.?$/, \".\") };\n if (field.type === \"slug\" && !isPublished) computed = \"Follows the title until you change it or publish.\";\n else if (field.type === \"number\" && !field.scale && field.layout !== \"slider\" && field.numeric?.unit) {\n /* D63: the unit sits in the input (\"/ 5\", \"min\"), so a line that only restates it or its range is noise. A range\n still earns a line when the unit does not already say it (\"Between 1 and 12 items.\"). */\n const { min, max, unit } = field.numeric;\n const said = unit.startsWith(\"/\") || (max != null && unit.includes(String(max)));\n computed = said || (min == null && max == null) ? \"\" : min != null && max != null ? `Between ${min} and ${max} ${unit}.` : min != null ? `${min} ${unit} or more.` : `Up to ${max} ${unit}.`;\n } else if (field.type === \"number\" && !field.scale && field.layout !== \"slider\" && (field.numeric?.min != null || field.numeric?.max != null)) {\n const { min, max } = field.numeric ?? {};\n computed = min != null && max != null ? `Between ${min} and ${max}.` : min != null ? `${min} or more.` : `Up to ${max}.`;\n }\n /* resolve here so the computed line wins over the house convention; \"\" survives as \"deliberately none\" */\n const help = resolveHelp(field, computed) ?? \"\";\n return help === field.description ? field : { ...field, description: help };\n}\n\nexport function KitField({ field, path, parent }: KitFieldProps) {\n const form = useForm();\n const env = useKitEnv();\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n if (!form) return null;\n\n /* a host's own control for this field (KitEnv.controls), inside the usual shell */\n const Custom = env.controls?.[pathKey(path)];\n if (Custom) {\n const ck = pathKey(path);\n const cissue = form.visibleIssue(ck);\n const cf = withDefaultHelp(field, env.isPublished, readOnly);\n return (\n <FieldShell field={cf} path={path} id={id} value={form.getAt(path)} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={cissue}>\n <div onBlur={() => form.touch(ck)} className=\"min-w-0\">\n <Custom field={cf} value={form.getAt(path)} onChange={(v) => form.setAt(path, v)} id={id} invalid={cissue?.level === \"error\"} readOnly={readOnly} path={path} parent={parent} onBlur={() => form.touch(ck)} />\n </div>\n </FieldShell>\n );\n }\n\n if (field.type === \"array\") return <ArrayField field={field} path={path} parent={parent} />;\n if (field.type === \"slot\") return <SlotField field={field} path={path} />;\n if (field.type === \"object\") return <ObjectField field={field} path={path} />;\n\n const key = pathKey(path);\n const value = form.getAt(path);\n const onChange = (v: unknown) => form.setAt(path, v);\n const onBlur = () => form.touch(key);\n const issue = form.visibleIssue(key);\n const Control = CONTROLS[field.type] ?? FallbackControl;\n const Action = ACTIONS[field.type];\n const f = withDefaultHelp(field, env.isPublished, readOnly);\n const plain = readOnly && PLAIN_TYPES.has(field.type as PrimitiveType);\n const card = field.type === \"boolean\" && field.layout !== \"checkbox\";\n /* an icon's row carries its own name (controls/media.tsx IconImageRow): no label above it as well */\n const iconRow = isIconImage(field, value);\n /* D49: rich text, code and tables open the shared expanded editor (expand.tsx). A lane that registers its\n own ACTIONS[type] owns its expansion too (rich text's editor modal, the table's spreadsheet): the engine draws no\n second modal and binds no second ⌘↵ for it. */\n const expand = plain || Action ? null : expandSpecFor(field, { readOnly, hasKitControl: !!CONTROLS[field.type], variant: env.variant });\n const action =\n Action && (!readOnly || ACTION_WHEN_READ_ONLY.has(field.type)) ? (\n <Action field={f} value={value} onChange={onChange} id={id} readOnly={readOnly} path={path} parent={parent} />\n ) : expand ? (\n <ExpandAction field={f} path={path} spec={expand} />\n ) : undefined;\n return (\n <FieldShell field={f} path={path} id={id} value={value} onChange={onChange} readOnly={readOnly} issue={issue} layout={card ? \"card\" : iconRow ? \"row\" : \"stack\"} action={action}>\n {plain ? (\n card ? null /* the switch card already reads On / Off */ : <PlainValue field={f} value={value} id={id} />\n ) : (\n <div\n onBlur={onBlur}\n onKeyDown={\n expand\n ? (e) => {\n if (!isExpandShortcut(e)) return;\n e.preventDefault();\n openExpanded(expandKey(env.docId, path));\n }\n : undefined\n }\n className=\"min-w-0\"\n >\n <Control field={f} value={value} onChange={onChange} id={id} invalid={issue?.level === \"error\"} readOnly={readOnly} path={path} parent={parent} onBlur={onBlur} />\n </div>\n )}\n {expand ? (\n <ExpandedField field={f} path={path} spec={expand} Control={Control} value={value} onChange={onChange} onBlur={onBlur} invalid={issue?.level === \"error\"} id={id} parent={parent} />\n ) : null}\n </FieldShell>\n );\n}\n\n/**\n * A row that opens something (V2 NavRow): type tile, title over a summary line, the field's chrome (from RowChrome),\n * the issue rollup and a chevron.\n * Like V2 it always draws its button and chevron, also with no `onClick` (a popover trigger around it opens on the\n * click). Only `inert` (the form draws no frames, so nothing can open) leaves both out.\n */\nexport function NavRow({\n icon,\n title,\n subtitle,\n path,\n onClick,\n inert,\n className,\n trailing,\n}: {\n icon?: string;\n title: string;\n subtitle?: string;\n path?: FieldPath;\n onClick?: () => void;\n inert?: boolean;\n className?: string;\n trailing?: React.ReactNode;\n}) {\n const form = useForm();\n const roll = path && form ? form.rollup(path) : { errors: 0, warnings: 0 };\n const subId = React.useId();\n const chrome = React.useContext(RowChrome);\n const text = (\n <>\n <span className=\"block truncate text-kit-sm text-kit-fg\">{title}</span>\n <span id={subId} className=\"block truncate text-kit-xs text-kit-fg-3\">\n {subtitle || \"Nothing set yet\"}\n </span>\n </>\n );\n return (\n <div\n className={cn(\n \"group/nav relative flex min-h-11 w-full min-w-0 items-center gap-2.5 rounded-kit-lg border border-kit-line-strong bg-kit-control-bg py-1.5 pl-2 pr-2 text-left transition-colors hover:border-[var(--kit-emphasis-line)] hover:bg-kit-subtle\",\n className,\n )}\n >\n <span className=\"flex size-7 shrink-0 items-center justify-center rounded-kit-md bg-kit-muted text-kit-fg-2\">\n <KitIcon name={icon} fallback=\"folder\" className=\"size-4\" />\n </span>\n {!inert ? (\n <button\n type=\"button\"\n data-nav-main\n onClick={onClick}\n aria-label={`Open ${title}${roll.errors ? `, ${roll.errors} ${roll.errors === 1 ? \"issue\" : \"issues\"}` : \"\"}`}\n aria-describedby={subId}\n className=\"min-w-0 flex-1 text-left outline-none after:absolute after:inset-0 after:rounded-kit-lg after:content-[''] focus-visible:after:outline-2 focus-visible:after:outline-offset-2 focus-visible:after:outline-kit-focus-ring focus-visible:after:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:after:outline-none\"\n >\n {text}\n </button>\n ) : (\n <div data-nav-main className=\"min-w-0 flex-1 text-left\">\n {text}\n </div>\n )}\n <IssueDot errors={roll.errors} warnings={roll.warnings} className=\"relative\" />\n {chrome ? <span className=\"relative z-[1] flex shrink-0 items-center gap-0.5 empty:hidden\">{chrome}</span> : null}\n {trailing}\n {!inert ? <IconChevronRight aria-hidden className=\"pointer-events-none size-4 shrink-0 text-kit-fg-3 transition-transform group-hover/nav:translate-x-0.5\" stroke={1.5} /> : null}\n </div>\n );\n}\n\n/* ── Object: inline · drill · popover · dialog (V2 ObjectField) ───── */\n\nfunction ObjectField({ field, path }: { field: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n const depth = useInsetDepth();\n const value = form.getAt(path);\n const obj = isObj(value) ? value : {};\n const fields = field.fields ?? [];\n /* D45 nesting rule: one container per level. Inside an inset (or an expanded row) an \"inline\" object would be a box in a\n box, so it drills instead — level 3+ is always a new frame, never more indentation. */\n const wanted = objectOpenMode(field);\n const mode = wanted === \"inline\" && depth > 0 ? \"drill\" : wanted;\n const [open, setOpen] = React.useState(false);\n const sum = groupSummary(fields, obj) || summarize(fields, obj);\n const nav = React.useRef<{ back: () => boolean }>(null);\n const shell = (control: React.ReactNode, layout?: \"row\") => (\n <FieldShell field={field} path={path} id={id} value={value} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={form.visibleIssue(pathKey(path))} layout={layout}>\n {control}\n </FieldShell>\n );\n if (mode === \"inline\") {\n const cc = condCtx(form, path);\n const visible = fields.filter((f) => !isHidden(f, obj, cc));\n /* D63: label, then the children behind one inset line; short neighbours pair up only on a wide form */\n return shell(\n <FieldInset label={field.title}>\n <FieldRun fields={visible} values={obj} render={(f) => <KitField field={f} path={[...path, f.name]} parent={obj} />} />\n </FieldInset>,\n );\n }\n const help = resolveHelp(field) ?? \"\";\n if (mode === \"popover\")\n /* V2: Radix <PopoverTrigger asChild><div> — the whole row is the trigger (aria-expanded, aria-haspopup=\"dialog\");\n NavRow gets no onClick but still draws its button (\"Open <title>\") and chevron, whose click opens the popover. */\n return shell(\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger nativeButton={false} render={<div />}>\n <NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} />\n </PopoverTrigger>\n <PopoverContent className=\"w-[340px] p-3\" align=\"start\">\n <FieldList fields={fields} basePath={path} memoryKey={`pop:${pathKey(path)}`} />\n </PopoverContent>\n </Popover>,\n \"row\",\n );\n if (mode === \"dialog\")\n return shell(\n <>\n <NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} onClick={() => setOpen(true)} />\n <Modal\n open={open}\n onOpenChange={(o, d) => {\n // Escape steps back inside the dialog's own frames first (V2: onEscapeKeyDown + nav.back())\n if (!o && d.reason === \"escape-key\" && nav.current?.back()) return d.cancel();\n setOpen(o);\n }}\n >\n <ModalContent size=\"lg\">\n <ModalHeader title={field.title} description={field.description} />\n <ModalBody className=\"flex min-h-[320px] flex-col gap-5\">\n <NestedForm fields={fields} title={field.title} icon={field.icon} path={path} navRef={nav} />\n </ModalBody>\n <ModalFooter>\n <span className=\"mr-auto text-kit-xs text-kit-fg-3\">Changes save as you type</span>\n <Button variant=\"primary\" onClick={() => setOpen(false)}>\n Done\n </Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n </>,\n \"row\",\n );\n return shell(<NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} onClick={() => form.navigate(path)} inert={!form.canNavigate} />, \"row\");\n}\n\n/**\n * A dialog gets its OWN navigation stack: lists inside it drill inside the dialog (breadcrumb, Esc, stepper), never the\n * panel behind. Writes go straight into the parent form at `path`.\n */\nexport function NestedForm({ fields, title, icon, path, navRef }: NestedFormProps) {\n const form = useForm()!;\n const env = useKitEnv();\n const key = pathKey(path);\n const schema = React.useMemo(() => ({ name: key || \"nested\", title, icon, kind: \"object\" as const, fields }), [key, title, icon, fields]);\n const raw = form.getAt(path);\n const pub = form.hasPublished ? form.publishedAt(path) : undefined;\n const presence = React.useMemo(() => {\n const out: Record<string, KitPeer[]> = {};\n for (const [k, v] of Object.entries(env.presence)) if (k.startsWith(`${key}.`)) out[k.slice(key.length + 1)] = v;\n return out;\n }, [env.presence, key]);\n return (\n <SchemaForm\n schema={schema}\n value={isObj(raw) ? raw : {}}\n onChange={(v) => form.setAt(path, v)}\n variant=\"document\"\n scroll={false}\n navRef={navRef}\n resolveSchema={form.resolveSchema}\n blockLibrary={form.blockLibrary}\n published={isObj(pub) ? pub : undefined}\n presence={presence}\n readOnly={env.readOnly}\n showErrors={form.showAllErrors}\n onOpenReference={env.onOpenReference}\n env={{ docId: `${env.docId}:${key}`, docTitle: env.docTitle, urlPrefix: env.urlPrefix, isPublished: env.isPublished, palette: env.palette, helpDisplay: env.helpDisplay }}\n />\n );\n}\n\n/* ── Read-only as plain text (D58 §0): no greyed input, just the value ── */\nconst PLAIN_TYPES = new Set<PrimitiveType>([\"string\", \"text\", \"richtext\", \"number\", \"slug\", \"url\", \"email\", \"date\", \"datetime\", \"select\", \"multiselect\", \"tags\", \"boolean\", \"rating\"]);\nexport function plainOf(field: FieldSchema, value: unknown): string {\n if (value == null || value === \"\") return \"\";\n const label = (v: unknown) => field.options?.find((o) => o.value === v)?.label ?? String(v);\n if (field.type === \"boolean\") return value ? \"On\" : \"Off\";\n if (field.type === \"select\") return label(value);\n // before the list arm: stored rich text may be a Portable Text block array\n if (field.type === \"richtext\") return plainText(value);\n if (Array.isArray(value)) return value.map(label).join(\", \");\n if (field.type === \"date\" || field.type === \"datetime\") {\n const d = new Date(String(value).replace(/\\[.*\\]$/, \"\"));\n return Number.isNaN(+d) ? String(value) : d.toLocaleString(\"en-US\", field.type === \"date\" ? { month: \"short\", day: \"numeric\", year: \"numeric\" } : { month: \"short\", day: \"numeric\", year: \"numeric\", hour: \"numeric\", minute: \"2-digit\" });\n }\n if (field.type === \"number\" && isObj(value)) return String((value as { value?: unknown }).value ?? \"\");\n return typeof value === \"object\" ? \"\" : String(value);\n}\nfunction PlainValue({ field, value, id }: { field: FieldSchema; value: unknown; id: string }) {\n const text = plainOf(field, value);\n return (\n <p id={id} tabIndex={0} data-slot=\"kit-plain\" className={cn(\"min-w-0 whitespace-pre-wrap break-words text-kit-sm leading-6 text-kit-fg outline-none\", (field.type === \"slug\" || field.type === \"url\") && \"font-kit-mono text-kit-xs leading-6\")}>\n {text || <span className=\"text-kit-fg-3\">Empty</span>}\n </p>\n );\n}\n\n/* ── Unknown type: the raw value, in the JSON control ── */\n/**\n * Every SchemaType has a kit control (kit-field.test checks CONTROLS against the type list in schema/types.ts). A field\n * whose type is none of them edits its raw stored value in the JSON control, tagged `data-kit-fallback=\"<type>\"`: the\n * value is shown and kept, and an edit is written only once it parses.\n */\nexport function FallbackControl(props: ControlProps) {\n return (\n <div data-kit-fallback={props.field.type} className=\"min-w-0\">\n <JsonControl {...props} />\n </div>\n );\n}\n\n/* ── Hand-off: the host's own control for a value the kit refuses ── */\n/**\n * A control that cannot carry a stored value unchanged (rich text holding formatting its editor would drop) hands that\n * value to the host's control for the type (KitServices.LegacyControl: the dashboard's FieldRenderer arm), bare inside\n * the kit FieldShell, which owns the label and the help; the control names its reason above it. The box carries\n * `data-kit-legacy=\"<type>\"`, so the parity harness counts it (mismatch class `legacy-control`). A host with no legacy\n * service, or a control that throws while rendering, says why in words; the form around it keeps working.\n */\nexport function LegacyFallback(props: ControlProps) {\n const { LegacyControl } = useKitServices();\n const { field, id } = props;\n return (\n <div data-kit-legacy={field.type} className=\"min-w-0\">\n {LegacyControl ? (\n // keyed by the schema's content: a schema edit remounts the control (KitField hands over a fresh field object on\n // every render, so identity would remount on every keystroke). A value change retries in place (componentDidUpdate).\n <LegacyBoundary key={JSON.stringify(field)} field={field} id={id} value={props.value}>\n <LegacyControl {...props} />\n </LegacyBoundary>\n ) : (\n <LegacyRefusal id={id}>This view has no control for {field.type} fields.</LegacyRefusal>\n )}\n </div>\n );\n}\n\n/**\n * An `<output>`: a labelable element, so the FieldShell label's `for` lands on it, and focusable, so a keyboard user\n * reaches the reason. The neutral focus ring shows under keyboard modality only.\n */\nfunction LegacyRefusal({ id, children }: { id: string; children: React.ReactNode }) {\n return (\n <output\n id={id}\n role=\"note\"\n tabIndex={0}\n data-slot=\"kit-legacy-refusal\"\n className=\"block rounded-kit-sm text-kit-xs text-kit-fg-3 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-kit-focus-ring focus-visible:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:outline-0\"\n >\n {children}\n </output>\n );\n}\n\n/** Retries the control once its field or value changes (a schema edit, a save from elsewhere, an undo). */\nclass LegacyBoundary extends React.Component<{ field: FieldSchema; id: string; value: unknown; children: React.ReactNode }, { reason: string | null }> {\n state = { reason: null as string | null };\n static getDerivedStateFromError(error: unknown) {\n return { reason: error instanceof Error ? error.message : String(error) };\n }\n componentDidUpdate(prev: { field: FieldSchema; value: unknown }) {\n if (this.state.reason === null) return;\n // by content: KitField hands over a fresh field object (withDefaultHelp) on every render\n if (prev.value !== this.props.value || JSON.stringify(prev.field) !== JSON.stringify(this.props.field)) this.setState({ reason: null });\n }\n render() {\n if (this.state.reason === null) return this.props.children;\n return (\n <LegacyRefusal id={this.props.id}>\n The {this.props.field.title} control could not load: {this.state.reason}\n </LegacyRefusal>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,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,OAAO,QAAQ,MAAM,SAAS,OAAO,OAAO;EAC7I,MAAM,EAAE,KAAK,QAAQ,MAAM,WAAW,CAAC;EACvC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,MAAM,KAAK,UAAU,KAAK,MAAM,KAAK,GAAG,KAAK,SAAS,EAAE,QAAQ,KAAK,CAAC;CACxI;CACA,SAAS;EACP,IAAI,KAAK,MAAM,WAAW,MAAM,OAAO,KAAK,MAAM;EAClD,OACE,qBAAC,eAAD;GAAe,IAAI,KAAK,MAAM;GAA9B,UAAA;IAAkC;IAC3B,KAAK,MAAM,MAAM;IAAM;IAA0B,KAAK,MAAM;GACpD;;CAEnB;AACF"}
|
|
1
|
+
{"version":3,"file":"kit-field.js","names":[],"sources":["../../src/engine/kit-field.tsx"],"sourcesContent":["/**\n * KitField — renders ONE field of the schema at `path` (must be inside <SchemaForm>): the shell + the control for its\n * type (V2 HEAD 9829bf1 kit/engine/kit-field.tsx).\n *\n * Arrays (array.tsx) and slots (slot.tsx) get their rows; objects open inline (FieldInset), drill (NavRow -> a frame),\n * popover or dialog (NestedForm: its own navigation stack). Primitive types dispatch through the CONTROLS table, which\n * the controls lanes fill. Every SchemaType has a control there; a type that is none of them (a schema newer than this\n * kit) edits its raw value in the JSON control (FallbackControl), never nothing and never a stand-in.\n */\nimport * as React from \"react\";\nimport type { ComponentType } from \"react\";\nimport { IconChevronRight } from \"@tabler/icons-react\";\nimport { KitIcon } from \"../lib/icons\";\nimport { cn } from \"../lib/cn\";\nimport type { FieldPath, FieldSchema, PrimitiveType, SchemaType } from \"../schema/types\";\nimport { resolveHelp } from \"../schema/help\";\nimport type { ControlProps } from \"../types\";\nimport { resolveFieldAccess, useForm, useKitEnv, useKitServices, type KitPeer } from \"../context\";\nimport { Button } from \"../ui/button\";\nimport { Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, Popover, PopoverContent, PopoverTrigger } from \"../ui/overlay\";\nimport { isObj, pathKey } from \"../lib/path\";\nimport { condCtx, isHidden, objectOpenMode, plainText, summarize } from \"../lib/schema\";\nimport { isIconImage } from \"../lib/icon-image\";\nimport { ArrayField, type NestedFormProps } from \"./array\";\nimport { ExpandAction, ExpandedField, expandKey, expandSpecFor, isExpandShortcut, openExpanded } from \"./expand\";\nimport { FieldShell } from \"./field-shell\";\nimport { FieldList } from \"./field-list\";\nimport { IssueDot, RowChrome } from \"./bits\";\nimport { FieldInset, FieldRun, groupSummary, useInsetDepth } from \"./grouping\";\nimport { SchemaForm } from \"./schema-form\";\nimport { SlotField } from \"./slot\";\nimport { JsonControl } from \"../controls/json\";\n\nexport interface KitFieldProps {\n field: FieldSchema;\n path: (string | number)[];\n parent?: Record<string, unknown>;\n}\n\n/** Type → control. Registered by the controls lane; a type with no entry edits its raw value (FallbackControl). */\nexport const CONTROLS: Partial<Record<SchemaType, ComponentType<ControlProps>>> = {};\n\n/**\n * Type → label-row action (DESIGN 4.4: slug Generate, rich text expand, table Edit in full screen), registered by the\n * controls lane next to its control. It gets the control's props. V2 draws it only while the field is editable, except\n * the types in ACTION_WHEN_READ_ONLY, whose action takes `readOnly` and decides for itself (slug Generate).\n */\nexport const ACTIONS: Partial<Record<SchemaType, ComponentType<ControlProps>>> = {};\nexport const ACTION_WHEN_READ_ONLY = new Set<SchemaType>([\"slug\"]);\n\n/** D58: the field for the lens: read-only (plain text) when it can't edit it. Hidden fields never reach here\n * (SchemaForm drops them from the schema). */\nexport function useFieldAccess(field: FieldSchema) {\n const env = useKitEnv();\n return { readOnly: resolveFieldAccess(field, env).readOnly };\n}\n\n/** CPO D39: the field's help line — schema text first, then a line computed from its settings, then the house convention. */\nexport function withDefaultHelp(field: FieldSchema, isPublished?: boolean, readOnly?: boolean): FieldSchema {\n let computed: string | undefined;\n /* a value set elsewhere says where, in one plain line (never a lock or a key) */\n if (readOnly && field.lockReason) return { ...field, description: field.lockReason.replace(/\\.?$/, \".\") };\n if (field.type === \"slug\" && !isPublished) computed = \"Follows the title until you change it or publish.\";\n else if (field.type === \"number\" && !field.scale && field.layout !== \"slider\" && field.numeric?.unit) {\n /* D63: the unit sits in the input (\"/ 5\", \"min\"), so a line that only restates it or its range is noise. A range\n still earns a line when the unit does not already say it (\"Between 1 and 12 items.\"). */\n const { min, max, unit } = field.numeric;\n const said = unit.startsWith(\"/\") || (max != null && unit.includes(String(max)));\n computed = said || (min == null && max == null) ? \"\" : min != null && max != null ? `Between ${min} and ${max} ${unit}.` : min != null ? `${min} ${unit} or more.` : `Up to ${max} ${unit}.`;\n } else if (field.type === \"number\" && !field.scale && field.layout !== \"slider\" && (field.numeric?.min != null || field.numeric?.max != null)) {\n const { min, max } = field.numeric ?? {};\n computed = min != null && max != null ? `Between ${min} and ${max}.` : min != null ? `${min} or more.` : `Up to ${max}.`;\n }\n /* resolve here so the computed line wins over the house convention; \"\" survives as \"deliberately none\" */\n const help = resolveHelp(field, computed) ?? \"\";\n return help === field.description ? field : { ...field, description: help };\n}\n\nexport function KitField({ field, path, parent }: KitFieldProps) {\n const form = useForm();\n const env = useKitEnv();\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n if (!form) return null;\n\n /* a host's own control for this field (KitEnv.controls), inside the usual shell */\n const Custom = env.controls?.[pathKey(path)];\n if (Custom) {\n const ck = pathKey(path);\n const cissue = form.visibleIssue(ck);\n const cf = withDefaultHelp(field, env.isPublished, readOnly);\n return (\n <FieldShell field={cf} path={path} id={id} value={form.getAt(path)} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={cissue}>\n <div onBlur={() => form.touch(ck)} className=\"min-w-0\">\n <Custom field={cf} value={form.getAt(path)} onChange={(v) => form.setAt(path, v)} id={id} invalid={cissue?.level === \"error\"} readOnly={readOnly} path={path} parent={parent} onBlur={() => form.touch(ck)} />\n </div>\n </FieldShell>\n );\n }\n\n if (field.type === \"array\") return <ArrayField field={field} path={path} parent={parent} />;\n if (field.type === \"slot\") return <SlotField field={field} path={path} />;\n if (field.type === \"object\") return <ObjectField field={field} path={path} />;\n\n const key = pathKey(path);\n const value = form.getAt(path);\n const onChange = (v: unknown) => form.setAt(path, v);\n const onBlur = () => form.touch(key);\n const issue = form.visibleIssue(key);\n const Control = CONTROLS[field.type] ?? FallbackControl;\n const Action = ACTIONS[field.type];\n const f = withDefaultHelp(field, env.isPublished, readOnly);\n const plain = readOnly && PLAIN_TYPES.has(field.type as PrimitiveType);\n const card = field.type === \"boolean\" && field.layout !== \"checkbox\";\n /* an icon's row carries its own name (controls/media.tsx IconImageRow): no label above it as well */\n const iconRow = isIconImage(field, value);\n /* D49: rich text, code and tables open the shared expanded editor (expand.tsx). A lane that registers its\n own ACTIONS[type] owns its expansion too (rich text's editor modal, the table's spreadsheet): the engine draws no\n second modal and binds no second ⌘↵ for it. */\n const expand = plain || Action ? null : expandSpecFor(field, { readOnly, hasKitControl: !!CONTROLS[field.type], variant: env.variant });\n const action =\n Action && (!readOnly || ACTION_WHEN_READ_ONLY.has(field.type)) ? (\n <Action field={f} value={value} onChange={onChange} id={id} readOnly={readOnly} path={path} parent={parent} />\n ) : expand ? (\n <ExpandAction field={f} path={path} spec={expand} />\n ) : undefined;\n return (\n <FieldShell field={f} path={path} id={id} value={value} onChange={onChange} readOnly={readOnly} issue={issue} layout={card ? \"card\" : iconRow ? \"row\" : \"stack\"} action={action}>\n {plain ? (\n card ? null /* the switch card already reads On / Off */ : <PlainValue field={f} value={value} id={id} />\n ) : (\n <div\n onBlur={onBlur}\n onKeyDown={\n expand\n ? (e) => {\n if (!isExpandShortcut(e)) return;\n e.preventDefault();\n openExpanded(expandKey(env.docId, path));\n }\n : undefined\n }\n className=\"min-w-0\"\n >\n <Control field={f} value={value} onChange={onChange} id={id} invalid={issue?.level === \"error\"} readOnly={readOnly} path={path} parent={parent} onBlur={onBlur} />\n </div>\n )}\n {expand ? (\n <ExpandedField field={f} path={path} spec={expand} Control={Control} value={value} onChange={onChange} onBlur={onBlur} invalid={issue?.level === \"error\"} id={id} parent={parent} />\n ) : null}\n </FieldShell>\n );\n}\n\n/**\n * A row that opens something (V2 NavRow): type tile, title over a summary line, the field's chrome (from RowChrome),\n * the issue rollup and a chevron.\n * Like V2 it always draws its button and chevron, also with no `onClick` (a popover trigger around it opens on the\n * click). Only `inert` (the form draws no frames, so nothing can open) leaves both out.\n */\nexport function NavRow({\n icon,\n title,\n subtitle,\n path,\n onClick,\n inert,\n className,\n trailing,\n}: {\n icon?: string;\n title: string;\n subtitle?: string;\n path?: FieldPath;\n onClick?: () => void;\n inert?: boolean;\n className?: string;\n trailing?: React.ReactNode;\n}) {\n const form = useForm();\n const roll = path && form ? form.rollup(path) : { errors: 0, warnings: 0 };\n const subId = React.useId();\n const chrome = React.useContext(RowChrome);\n const text = (\n <>\n <span className=\"block truncate text-kit-sm text-kit-fg\">{title}</span>\n <span id={subId} className=\"block truncate text-kit-xs text-kit-fg-3\">\n {subtitle || \"Nothing set yet\"}\n </span>\n </>\n );\n return (\n <div\n className={cn(\n \"group/nav relative flex min-h-11 w-full min-w-0 items-center gap-2.5 rounded-kit-lg border border-kit-line-strong bg-kit-control-bg py-1.5 pl-2 pr-2 text-left transition-colors hover:border-[var(--kit-emphasis-line)] hover:bg-kit-subtle\",\n className,\n )}\n >\n <span className=\"flex size-7 shrink-0 items-center justify-center rounded-kit-md bg-kit-muted text-kit-fg-2\">\n <KitIcon name={icon} fallback=\"folder\" className=\"size-4\" />\n </span>\n {!inert ? (\n <button\n type=\"button\"\n data-nav-main\n onClick={onClick}\n aria-label={`Open ${title}${roll.errors ? `, ${roll.errors} ${roll.errors === 1 ? \"issue\" : \"issues\"}` : \"\"}`}\n aria-describedby={subId}\n className=\"min-w-0 flex-1 text-left outline-none after:absolute after:inset-0 after:rounded-kit-lg after:content-[''] focus-visible:after:outline-2 focus-visible:after:outline-offset-2 focus-visible:after:outline-kit-focus-ring focus-visible:after:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:after:outline-none\"\n >\n {text}\n </button>\n ) : (\n <div data-nav-main className=\"min-w-0 flex-1 text-left\">\n {text}\n </div>\n )}\n <IssueDot errors={roll.errors} warnings={roll.warnings} className=\"relative\" />\n {chrome ? <span className=\"relative z-[1] flex shrink-0 items-center gap-0.5 empty:hidden\">{chrome}</span> : null}\n {trailing}\n {!inert ? <IconChevronRight aria-hidden className=\"pointer-events-none size-4 shrink-0 text-kit-fg-3 transition-transform group-hover/nav:translate-x-0.5\" stroke={1.5} /> : null}\n </div>\n );\n}\n\n/* ── Object: inline · drill · popover · dialog (V2 ObjectField) ───── */\n\nfunction ObjectField({ field, path }: { field: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n const depth = useInsetDepth();\n const value = form.getAt(path);\n const obj = isObj(value) ? value : {};\n const fields = field.fields ?? [];\n /* D45 nesting rule: one container per level. Inside an inset (or an expanded row) an \"inline\" object would be a box in a\n box, so it drills instead — level 3+ is always a new frame, never more indentation. */\n const wanted = objectOpenMode(field);\n const mode = wanted === \"inline\" && depth > 0 ? \"drill\" : wanted;\n const [open, setOpen] = React.useState(false);\n const sum = groupSummary(fields, obj) || summarize(fields, obj);\n const nav = React.useRef<{ back: () => boolean }>(null);\n const shell = (control: React.ReactNode, layout?: \"row\") => (\n <FieldShell field={field} path={path} id={id} value={value} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={form.visibleIssue(pathKey(path))} layout={layout}>\n {control}\n </FieldShell>\n );\n if (mode === \"inline\") {\n const cc = condCtx(form, path);\n const visible = fields.filter((f) => !isHidden(f, obj, cc));\n /* D63: label, then the children behind one inset line; short neighbours pair up only on a wide form */\n return shell(\n <FieldInset label={field.title}>\n <FieldRun fields={visible} values={obj} render={(f) => <KitField field={f} path={[...path, f.name]} parent={obj} />} />\n </FieldInset>,\n );\n }\n const help = resolveHelp(field) ?? \"\";\n if (mode === \"popover\")\n /* V2: Radix <PopoverTrigger asChild><div> — the whole row is the trigger (aria-expanded, aria-haspopup=\"dialog\");\n NavRow gets no onClick but still draws its button (\"Open <title>\") and chevron, whose click opens the popover. */\n return shell(\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger nativeButton={false} render={<div />}>\n <NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} />\n </PopoverTrigger>\n <PopoverContent className=\"w-[340px] p-3\" align=\"start\">\n <FieldList fields={fields} basePath={path} memoryKey={`pop:${pathKey(path)}`} />\n </PopoverContent>\n </Popover>,\n \"row\",\n );\n if (mode === \"dialog\")\n return shell(\n <>\n <NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} onClick={() => setOpen(true)} />\n <Modal\n open={open}\n onOpenChange={(o, d) => {\n // Escape steps back inside the dialog's own frames first (V2: onEscapeKeyDown + nav.back())\n if (!o && d.reason === \"escape-key\" && nav.current?.back()) return d.cancel();\n setOpen(o);\n }}\n >\n <ModalContent size=\"lg\">\n <ModalHeader title={field.title} description={field.description} />\n <ModalBody className=\"flex min-h-[320px] flex-col gap-5\">\n <NestedForm fields={fields} title={field.title} icon={field.icon} path={path} navRef={nav} />\n </ModalBody>\n <ModalFooter>\n <span className=\"mr-auto text-kit-xs text-kit-fg-3\">Changes save as you type</span>\n <Button variant=\"primary\" onClick={() => setOpen(false)}>\n Done\n </Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n </>,\n \"row\",\n );\n return shell(<NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} onClick={() => form.navigate(path)} inert={!form.canNavigate} />, \"row\");\n}\n\n/**\n * A dialog gets its OWN navigation stack: lists inside it drill inside the dialog (breadcrumb, Esc, stepper), never the\n * panel behind. Writes go straight into the parent form at `path`.\n */\nexport function NestedForm({ fields, title, icon, path, navRef }: NestedFormProps) {\n const form = useForm()!;\n const env = useKitEnv();\n const key = pathKey(path);\n const schema = React.useMemo(() => ({ name: key || \"nested\", title, icon, kind: \"object\" as const, fields }), [key, title, icon, fields]);\n const raw = form.getAt(path);\n const pub = form.hasPublished ? form.publishedAt(path) : undefined;\n const presence = React.useMemo(() => {\n const out: Record<string, KitPeer[]> = {};\n for (const [k, v] of Object.entries(env.presence)) if (k.startsWith(`${key}.`)) out[k.slice(key.length + 1)] = v;\n return out;\n }, [env.presence, key]);\n return (\n <SchemaForm\n schema={schema}\n value={isObj(raw) ? raw : {}}\n onChange={(v) => form.setAt(path, v)}\n variant=\"document\"\n scroll={false}\n navRef={navRef}\n resolveSchema={form.resolveSchema}\n blockLibrary={form.blockLibrary}\n published={isObj(pub) ? pub : undefined}\n presence={presence}\n readOnly={env.readOnly}\n showErrors={form.showAllErrors}\n onOpenReference={env.onOpenReference}\n env={{ docId: `${env.docId}:${key}`, docTitle: env.docTitle, urlPrefix: env.urlPrefix, isPublished: env.isPublished, palette: env.palette, helpDisplay: env.helpDisplay }}\n />\n );\n}\n\n/* ── Read-only as plain text (D58 §0): no greyed input, just the value ── */\nconst PLAIN_TYPES = new Set<PrimitiveType>([\"string\", \"text\", \"richtext\", \"number\", \"slug\", \"url\", \"email\", \"date\", \"datetime\", \"select\", \"multiselect\", \"tags\", \"boolean\", \"rating\"]);\nexport function plainOf(field: FieldSchema, value: unknown): string {\n if (value == null || value === \"\") return \"\";\n const label = (v: unknown) => field.options?.find((o) => o.value === v)?.label ?? String(v);\n if (field.type === \"boolean\") return value ? \"On\" : \"Off\";\n if (field.type === \"select\") return label(value);\n // before the list arm: stored rich text may be a Portable Text block array\n if (field.type === \"richtext\") return plainText(value);\n if (Array.isArray(value)) return value.map(label).join(\", \");\n if (field.type === \"date\" || field.type === \"datetime\") {\n const d = new Date(String(value).replace(/\\[.*\\]$/, \"\"));\n return Number.isNaN(+d) ? String(value) : d.toLocaleString(\"en-US\", field.type === \"date\" ? { month: \"short\", day: \"numeric\", year: \"numeric\" } : { month: \"short\", day: \"numeric\", year: \"numeric\", hour: \"numeric\", minute: \"2-digit\" });\n }\n if (field.type === \"number\" && isObj(value)) return String((value as { value?: unknown }).value ?? \"\");\n return typeof value === \"object\" ? \"\" : String(value);\n}\nfunction PlainValue({ field, value, id }: { field: FieldSchema; value: unknown; id: string }) {\n const text = plainOf(field, value);\n return (\n // NEW-Q48-PLAINLABEL: a <p> is not labelable, so label[for] named nothing; the group is named \"<field> <value>\"\n <p id={id} tabIndex={0} role=\"group\" aria-labelledby={`${id}-label ${id}`} data-slot=\"kit-plain\" className={cn(\"min-w-0 whitespace-pre-wrap break-words text-kit-sm leading-6 text-kit-fg outline-none\", (field.type === \"slug\" || field.type === \"url\") && \"font-kit-mono text-kit-xs leading-6\")}>\n {text || <span className=\"text-kit-fg-3\">Empty</span>}\n </p>\n );\n}\n\n/* ── Unknown type: the raw value, in the JSON control ── */\n/**\n * Every SchemaType has a kit control (kit-field.test checks CONTROLS against the type list in schema/types.ts). A field\n * whose type is none of them edits its raw stored value in the JSON control, tagged `data-kit-fallback=\"<type>\"`: the\n * value is shown and kept, and an edit is written only once it parses.\n */\nexport function FallbackControl(props: ControlProps) {\n return (\n <div data-kit-fallback={props.field.type} className=\"min-w-0\">\n <JsonControl {...props} />\n </div>\n );\n}\n\n/* ── Hand-off: the host's own control for a value the kit refuses ── */\n/**\n * A control that cannot carry a stored value unchanged (rich text holding formatting its editor would drop) hands that\n * value to the host's control for the type (KitServices.LegacyControl: the dashboard's FieldRenderer arm), bare inside\n * the kit FieldShell, which owns the label and the help; the control names its reason above it. The box carries\n * `data-kit-legacy=\"<type>\"`, so the parity harness counts it (mismatch class `legacy-control`). A host with no legacy\n * service, or a control that throws while rendering, says why in words; the form around it keeps working.\n */\nexport function LegacyFallback(props: ControlProps) {\n const { LegacyControl } = useKitServices();\n const { field, id } = props;\n return (\n <div data-kit-legacy={field.type} className=\"min-w-0\">\n {LegacyControl ? (\n // keyed by the schema's content: a schema edit remounts the control (KitField hands over a fresh field object on\n // every render, so identity would remount on every keystroke). A value change retries in place (componentDidUpdate).\n <LegacyBoundary key={JSON.stringify(field)} field={field} id={id} value={props.value}>\n <LegacyControl {...props} />\n </LegacyBoundary>\n ) : (\n <LegacyRefusal id={id}>This view has no control for {field.type} fields.</LegacyRefusal>\n )}\n </div>\n );\n}\n\n/**\n * An `<output>`: a labelable element, so the FieldShell label's `for` lands on it, and focusable, so a keyboard user\n * reaches the reason. The neutral focus ring shows under keyboard modality only.\n */\nfunction LegacyRefusal({ id, children }: { id: string; children: React.ReactNode }) {\n return (\n <output\n id={id}\n role=\"note\"\n tabIndex={0}\n data-slot=\"kit-legacy-refusal\"\n className=\"block rounded-kit-sm text-kit-xs text-kit-fg-3 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-kit-focus-ring focus-visible:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:outline-0\"\n >\n {children}\n </output>\n );\n}\n\n/** Retries the control once its field or value changes (a schema edit, a save from elsewhere, an undo). */\nclass LegacyBoundary extends React.Component<{ field: FieldSchema; id: string; value: unknown; children: React.ReactNode }, { reason: string | null }> {\n state = { reason: null as string | null };\n static getDerivedStateFromError(error: unknown) {\n return { reason: error instanceof Error ? error.message : String(error) };\n }\n componentDidUpdate(prev: { field: FieldSchema; value: unknown }) {\n if (this.state.reason === null) return;\n // by content: KitField hands over a fresh field object (withDefaultHelp) on every render\n if (prev.value !== this.props.value || JSON.stringify(prev.field) !== JSON.stringify(this.props.field)) this.setState({ reason: null });\n }\n render() {\n if (this.state.reason === null) return this.props.children;\n return (\n <LegacyRefusal id={this.props.id}>\n The {this.props.field.title} control could not load: {this.state.reason}\n </LegacyRefusal>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,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,MAA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,MAAQ,CAAA;EACb,GAFK,KAAK,UAAU,KAAK,CAEzB,IAEhB,qBAAC,eAAD;GAAmB;GAAnB,UAAA;IAAuB;IAA8B,MAAM;IAAK;GAAuB;;CAEtF,CAAA;AAET;;;;;AAMA,SAAS,cAAc,EAAE,IAAI,YAAuD;CAClF,OACE,oBAAC,UAAD;EACM;EACJ,MAAK;EACL,UAAU;EACV,aAAU;EACV,WAAU;EAET;CACK,CAAA;AAEZ;;AAGA,IAAM,iBAAN,cAA6B,MAAM,UAAoH;CACrJ,QAAQ,EAAE,QAAQ,KAAsB;CACxC,OAAO,yBAAyB,OAAgB;EAC9C,OAAO,EAAE,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE;CAC1E;CACA,mBAAmB,MAA8C;EAC/D,IAAI,KAAK,MAAM,WAAW,MAAM;EAEhC,IAAI,KAAK,UAAU,KAAK,MAAM,SAAS,KAAK,UAAU,KAAK,KAAK,MAAM,KAAK,UAAU,KAAK,MAAM,KAAK,GAAG,KAAK,SAAS,EAAE,QAAQ,KAAK,CAAC;CACxI;CACA,SAAS;EACP,IAAI,KAAK,MAAM,WAAW,MAAM,OAAO,KAAK,MAAM;EAClD,OACE,qBAAC,eAAD;GAAe,IAAI,KAAK,MAAM;GAA9B,UAAA;IAAkC;IAC3B,KAAK,MAAM,MAAM;IAAM;IAA0B,KAAK,MAAM;GACpD;;CAEnB;AACF"}
|
package/dist/engine/slot.js
CHANGED
|
@@ -76,7 +76,7 @@ function SlotField({ field, path }) {
|
|
|
76
76
|
className: "size-4"
|
|
77
77
|
})
|
|
78
78
|
}),
|
|
79
|
-
emptyLabel: "No blocks yet. Add one to start composing.",
|
|
79
|
+
emptyLabel: readOnly ? "No blocks yet." : "No blocks yet. Add one to start composing.",
|
|
80
80
|
addButton: /* @__PURE__ */ jsx(BlockPicker, {
|
|
81
81
|
blocks: available,
|
|
82
82
|
unavailable,
|
package/dist/engine/slot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.js","names":[],"sources":["../../src/engine/slot.tsx"],"sourcesContent":["/**\n * SLOTS — blocks inside blocks (tabs, columns, bento, carousels, mega-menu panels; V2 HEAD 9829bf1 kit/engine/slot.tsx).\n * Rows show the block icon, its name and a variant chip; \"+ Add block\" opens a compact, searchable block picker;\n * opening a row drills into THAT block's own schema (resolved with `resolveSchema(blockType)`).\n *\n * Drill rows call the RowsHostContext frame push (see array.tsx); with nothing to draw the frame they are inert.\n */\nimport * as React from \"react\";\nimport { IconPlus, IconSearch } from \"@tabler/icons-react\";\nimport { KitIcon } from \"../lib/icons\";\nimport { Button } from \"../ui/button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../ui/overlay\";\nimport { cn } from \"../lib/cn\";\nimport type { FieldPath, FieldSchema, TypeSchema } from \"../schema/types\";\nimport { useForm } from \"../context\";\nimport { ensureKeys, isObj, itemId, pathKey } from \"../lib/path\";\nimport { newBlock, slotAllow, slotRowOf } from \"../lib/schema\";\nimport { RowList, useDrill, useListOps, type RowModel } from \"./array\";\nimport { FieldShell } from \"./field-shell\";\nimport { useFieldAccess } from \"./kit-field\";\n\nexport function SlotField({ field, path }: { field: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const drill = useDrill();\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n const key = pathKey(path);\n const value = form.getAt(path);\n const list = Array.isArray(value) ? value : [];\n const write = (next: unknown[]) => form.setAt(path, ensureKeys(next));\n const ops = useListOps(field, path, list, write, (i) => drill?.([...path, i]));\n const available = useAvailableBlocks(field);\n const unavailable = useUnavailableBlocks(field);\n const rows: RowModel[] = list.map((it, i) => {\n const type = isObj(it) && typeof it._type === \"string\" ? it._type : \"\";\n return { id: itemId(it, i), index: i, item: it, path: [...path, i], ...slotRowOf(form.resolveSchema?.(type), it, i, list.length, field.slotSettings) };\n });\n return (\n <FieldShell\n field={field}\n path={path}\n id={id}\n value={list}\n onChange={(v) => form.setAt(path, v)}\n readOnly={readOnly}\n issue={form.visibleIssue(key)}\n meta={<span className=\"text-kit-xs text-kit-fg-3\">{list.length} {list.length === 1 ? \"block\" : \"blocks\"}{field.validation?.max != null ? ` · max ${field.validation.max}` : \"\"}</span>}\n >\n <RowList\n field={field}\n rows={rows}\n readOnly={readOnly}\n layout=\"list\"\n mode=\"drill\"\n openId={null}\n onOpen={drill && ((r) => drill(r.path))}\n onCloseInline={() => {}}\n ops={ops}\n renderInline={() => null}\n leading={(r) => (\n <span className=\"flex size-7 shrink-0 items-center justify-center rounded-kit-md border border-kit-line bg-kit-control-bg text-kit-fg-2 shadow-kit-xs\">\n <KitIcon name={r.preview.icon} className=\"size-4\" />\n </span>\n )}\n emptyLabel=\"No blocks yet. Add one to start composing.\"\n addButton={<BlockPicker blocks={available} unavailable={unavailable} disabled={readOnly || ops.atMax} onPick={(b) => ops.add(newBlock(b, field.slotSettings))} />}\n />\n </FieldShell>\n );\n}\n\n/** Blocks this slot accepts: its allow list resolved through `resolveSchema`, else the whole block library. */\nexport function useAvailableBlocks(field: FieldSchema): TypeSchema[] {\n const form = useForm()!;\n const allow = slotAllow(field);\n return React.useMemo(() => {\n const lib = form.blockLibrary ?? [];\n if (!allow?.length) return lib;\n return allow.map((t) => lib.find((b) => b.name === t) ?? form.resolveSchema?.(t)).filter((b): b is TypeSchema => !!b);\n }, [allow?.join(\"|\"), form.blockLibrary, form.resolveSchema]); // eslint-disable-line react-hooks/exhaustive-deps\n}\n\n/** BL-595: the allow list's names no library or resolver knows — listed in the picker, disabled, with why. */\nexport function useUnavailableBlocks(field: FieldSchema): UnavailableBlock[] {\n const form = useForm()!;\n const allow = slotAllow(field);\n return React.useMemo(() => {\n const lib = form.blockLibrary ?? [];\n return (allow ?? [])\n .filter((t) => !lib.some((b) => b.name === t) && !form.resolveSchema?.(t))\n .map((t) => ({ block: { name: t, title: t, kind: \"block\" as const, fields: [] }, reason: MISSING_BLOCK }));\n }, [allow?.join(\"|\"), form.blockLibrary, form.resolveSchema]); // eslint-disable-line react-hooks/exhaustive-deps\n}\nconst MISSING_BLOCK = \"This block isn't in the block library, so it can't be added here.\";\n\n/** A block the picker lists but cannot add here, and the sentence that says why (as controls/slot.tsx SlotPicker does). */\nexport interface UnavailableBlock {\n block: TypeSchema;\n reason: string;\n}\n\nexport function BlockPicker({\n blocks,\n unavailable = [],\n onPick,\n disabled,\n label = \"Add block\",\n}: {\n blocks: TypeSchema[];\n /** BL-595: blocks shown disabled with their reason, never picked, so an empty list is never a bare \"No blocks match\" */\n unavailable?: UnavailableBlock[];\n onPick: (b: TypeSchema) => void;\n disabled?: boolean;\n label?: string;\n}) {\n const [open, setOpen] = React.useState(false);\n const [q, setQ] = React.useState(\"\");\n const [active, setActive] = React.useState(0);\n const why = new Map(unavailable.map((u) => [u.block, u.reason]));\n const list = [...blocks, ...unavailable.map((u) => u.block)].filter((b) => !q || `${b.title} ${b.category ?? \"\"} ${b.description ?? \"\"}`.toLowerCase().includes(q.toLowerCase()));\n const cats = Array.from(new Set(list.map((b) => b.category ?? \"Blocks\")));\n const flat = cats.flatMap((c) => list.filter((b) => (b.category ?? \"Blocks\") === c));\n const pick = (b: TypeSchema) => {\n if (why.has(b)) return;\n onPick(b);\n setOpen(false);\n setQ(\"\");\n };\n return (\n <Popover open={open} onOpenChange={(o) => { setOpen(o); setQ(\"\"); setActive(0); }}>\n <PopoverTrigger render={<Button size=\"sm\" variant=\"ghost\" className=\"text-kit-fg-2\" leftIcon={<IconPlus stroke={1.5} />} disabled={disabled} />}>{label}</PopoverTrigger>\n <PopoverContent className=\"w-[300px] p-0\" align=\"start\">\n <label\n className=\"flex h-10 items-center gap-2 border-b border-kit-line px-3 text-kit-fg-3\"\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") { e.preventDefault(); setActive((a) => (a + 1) % Math.max(1, flat.length)); }\n if (e.key === \"ArrowUp\") { e.preventDefault(); setActive((a) => (a - 1 + flat.length) % Math.max(1, flat.length)); }\n if (e.key === \"Enter\" && flat[active]) { e.preventDefault(); pick(flat[active]); }\n }}\n >\n <IconSearch className=\"size-4 shrink-0\" stroke={1.5} />\n <input autoFocus value={q} onChange={(e) => { setQ(e.target.value); setActive(0); }} placeholder=\"Search blocks\" aria-label=\"Search blocks\" className=\"h-full min-w-0 flex-1 bg-transparent text-kit-sm text-kit-fg outline-none placeholder:text-kit-fg-3\" />\n </label>\n <div className=\"max-h-80 overflow-y-auto p-1\" role=\"listbox\">\n {flat.length === 0 ? <p className=\"px-3 py-6 text-center text-kit-sm text-kit-fg-3\">No blocks match</p> : null}\n {cats.map((c) => (\n <div key={c} className=\"pb-1\">\n <div className=\"px-2 pb-1 pt-1.5 text-kit-2xs font-medium text-kit-fg-3\">{c}</div>\n {list.filter((b) => (b.category ?? \"Blocks\") === c).map((b) => {\n const i = flat.indexOf(b);\n const reason = why.get(b);\n return (\n <button\n key={b.name}\n type=\"button\"\n role=\"option\"\n aria-selected={i === active}\n aria-disabled={reason !== undefined || undefined}\n onMouseEnter={() => setActive(i)}\n onClick={() => pick(b)}\n className={cn(\"flex w-full items-center gap-2.5 rounded-kit-md p-1.5 text-left\", reason !== undefined && \"cursor-not-allowed\", i === active && \"bg-kit-hover\")}\n >\n <span className={cn(\"flex size-8 shrink-0 items-center justify-center rounded-kit-md border border-kit-line bg-kit-surface text-kit-fg-2 shadow-kit-xs\", reason !== undefined && \"opacity-50\")}>\n <KitIcon name={b.icon} className=\"size-4\" />\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className={cn(\"block truncate text-kit-sm\", reason !== undefined ? \"text-kit-fg-3\" : \"text-kit-fg\")}>{b.title}</span>\n {reason !== undefined ? (\n <span className=\"block text-kit-xs text-kit-fg-3\">{reason}</span>\n ) : b.description ? (\n <span className=\"block truncate text-kit-xs text-kit-fg-3\">{b.description}</span>\n ) : null}\n </span>\n </button>\n );\n })}\n </div>\n ))}\n </div>\n <div data-hint=\"shortcuts\" className=\"border-t border-kit-line px-3 py-1.5 text-kit-2xs text-kit-fg-3\">↵ add · type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C,oBAAoB,UAAU,CAAC;QAC/B,eAAe,KAAK,CAAC;QACrB,WAAW,GAAG,mEAAmE,WAAW,KAAA,KAAa,sBAAsB,MAAM,UAAU,cAAc;QAR/J,UAAA,CAUE,oBAAC,QAAD;SAAM,WAAW,GAAG,qIAAqI,WAAW,KAAA,KAAa,YAAY;SAC3L,UAAA,oBAAC,SAAD;UAAS,MAAM,EAAE;UAAM,WAAU;SAAU,CAAA;QACvC,CAAA,GACN,qBAAC,QAAD;SAAM,WAAU;SAAhB,UAAA,CACE,oBAAC,QAAD;UAAM,WAAW,GAAG,8BAA8B,WAAW,KAAA,IAAY,kBAAkB,aAAa;UAAI,UAAA,EAAE;SAAY,CAAA,GACzH,WAAW,KAAA,IACV,oBAAC,QAAD;UAAM,WAAU;UAAmC,UAAA;SAAa,CAAA,IAC9D,EAAE,cACJ,oBAAC,QAAD;UAAM,WAAU;UAA4C,UAAA,EAAE;SAAkB,CAAA,IAC9E,IACA;QACA,CAAA,CAAA;OApBD,GAAA,EAAE,IAoBD;MAEZ,CAAC,CACE;KA9BK,GAAA,CA8BL,CACN,CACE;;IACL,oBAAC,OAAD;KAAK,aAAU;KAAY,WAAU;KAAkE,UAAA;IAA2B,CAAA;GACpH;EACT,CAAA,CAAA;;AAEb"}
|
|
1
|
+
{"version":3,"file":"slot.js","names":[],"sources":["../../src/engine/slot.tsx"],"sourcesContent":["/**\n * SLOTS — blocks inside blocks (tabs, columns, bento, carousels, mega-menu panels; V2 HEAD 9829bf1 kit/engine/slot.tsx).\n * Rows show the block icon, its name and a variant chip; \"+ Add block\" opens a compact, searchable block picker;\n * opening a row drills into THAT block's own schema (resolved with `resolveSchema(blockType)`).\n *\n * Drill rows call the RowsHostContext frame push (see array.tsx); with nothing to draw the frame they are inert.\n */\nimport * as React from \"react\";\nimport { IconPlus, IconSearch } from \"@tabler/icons-react\";\nimport { KitIcon } from \"../lib/icons\";\nimport { Button } from \"../ui/button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../ui/overlay\";\nimport { cn } from \"../lib/cn\";\nimport type { FieldPath, FieldSchema, TypeSchema } from \"../schema/types\";\nimport { useForm } from \"../context\";\nimport { ensureKeys, isObj, itemId, pathKey } from \"../lib/path\";\nimport { newBlock, slotAllow, slotRowOf } from \"../lib/schema\";\nimport { RowList, useDrill, useListOps, type RowModel } from \"./array\";\nimport { FieldShell } from \"./field-shell\";\nimport { useFieldAccess } from \"./kit-field\";\n\nexport function SlotField({ field, path }: { field: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const drill = useDrill();\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n const key = pathKey(path);\n const value = form.getAt(path);\n const list = Array.isArray(value) ? value : [];\n const write = (next: unknown[]) => form.setAt(path, ensureKeys(next));\n const ops = useListOps(field, path, list, write, (i) => drill?.([...path, i]));\n const available = useAvailableBlocks(field);\n const unavailable = useUnavailableBlocks(field);\n const rows: RowModel[] = list.map((it, i) => {\n const type = isObj(it) && typeof it._type === \"string\" ? it._type : \"\";\n return { id: itemId(it, i), index: i, item: it, path: [...path, i], ...slotRowOf(form.resolveSchema?.(type), it, i, list.length, field.slotSettings) };\n });\n return (\n <FieldShell\n field={field}\n path={path}\n id={id}\n value={list}\n onChange={(v) => form.setAt(path, v)}\n readOnly={readOnly}\n issue={form.visibleIssue(key)}\n meta={<span className=\"text-kit-xs text-kit-fg-3\">{list.length} {list.length === 1 ? \"block\" : \"blocks\"}{field.validation?.max != null ? ` · max ${field.validation.max}` : \"\"}</span>}\n >\n <RowList\n field={field}\n rows={rows}\n readOnly={readOnly}\n layout=\"list\"\n mode=\"drill\"\n openId={null}\n onOpen={drill && ((r) => drill(r.path))}\n onCloseInline={() => {}}\n ops={ops}\n renderInline={() => null}\n leading={(r) => (\n <span className=\"flex size-7 shrink-0 items-center justify-center rounded-kit-md border border-kit-line bg-kit-control-bg text-kit-fg-2 shadow-kit-xs\">\n <KitIcon name={r.preview.icon} className=\"size-4\" />\n </span>\n )}\n emptyLabel={readOnly ? \"No blocks yet.\" : \"No blocks yet. Add one to start composing.\"}\n addButton={<BlockPicker blocks={available} unavailable={unavailable} disabled={readOnly || ops.atMax} onPick={(b) => ops.add(newBlock(b, field.slotSettings))} />}\n />\n </FieldShell>\n );\n}\n\n/** Blocks this slot accepts: its allow list resolved through `resolveSchema`, else the whole block library. */\nexport function useAvailableBlocks(field: FieldSchema): TypeSchema[] {\n const form = useForm()!;\n const allow = slotAllow(field);\n return React.useMemo(() => {\n const lib = form.blockLibrary ?? [];\n if (!allow?.length) return lib;\n return allow.map((t) => lib.find((b) => b.name === t) ?? form.resolveSchema?.(t)).filter((b): b is TypeSchema => !!b);\n }, [allow?.join(\"|\"), form.blockLibrary, form.resolveSchema]); // eslint-disable-line react-hooks/exhaustive-deps\n}\n\n/** BL-595: the allow list's names no library or resolver knows — listed in the picker, disabled, with why. */\nexport function useUnavailableBlocks(field: FieldSchema): UnavailableBlock[] {\n const form = useForm()!;\n const allow = slotAllow(field);\n return React.useMemo(() => {\n const lib = form.blockLibrary ?? [];\n return (allow ?? [])\n .filter((t) => !lib.some((b) => b.name === t) && !form.resolveSchema?.(t))\n .map((t) => ({ block: { name: t, title: t, kind: \"block\" as const, fields: [] }, reason: MISSING_BLOCK }));\n }, [allow?.join(\"|\"), form.blockLibrary, form.resolveSchema]); // eslint-disable-line react-hooks/exhaustive-deps\n}\nconst MISSING_BLOCK = \"This block isn't in the block library, so it can't be added here.\";\n\n/** A block the picker lists but cannot add here, and the sentence that says why (as controls/slot.tsx SlotPicker does). */\nexport interface UnavailableBlock {\n block: TypeSchema;\n reason: string;\n}\n\nexport function BlockPicker({\n blocks,\n unavailable = [],\n onPick,\n disabled,\n label = \"Add block\",\n}: {\n blocks: TypeSchema[];\n /** BL-595: blocks shown disabled with their reason, never picked, so an empty list is never a bare \"No blocks match\" */\n unavailable?: UnavailableBlock[];\n onPick: (b: TypeSchema) => void;\n disabled?: boolean;\n label?: string;\n}) {\n const [open, setOpen] = React.useState(false);\n const [q, setQ] = React.useState(\"\");\n const [active, setActive] = React.useState(0);\n const why = new Map(unavailable.map((u) => [u.block, u.reason]));\n const list = [...blocks, ...unavailable.map((u) => u.block)].filter((b) => !q || `${b.title} ${b.category ?? \"\"} ${b.description ?? \"\"}`.toLowerCase().includes(q.toLowerCase()));\n const cats = Array.from(new Set(list.map((b) => b.category ?? \"Blocks\")));\n const flat = cats.flatMap((c) => list.filter((b) => (b.category ?? \"Blocks\") === c));\n const pick = (b: TypeSchema) => {\n if (why.has(b)) return;\n onPick(b);\n setOpen(false);\n setQ(\"\");\n };\n return (\n <Popover open={open} onOpenChange={(o) => { setOpen(o); setQ(\"\"); setActive(0); }}>\n <PopoverTrigger render={<Button size=\"sm\" variant=\"ghost\" className=\"text-kit-fg-2\" leftIcon={<IconPlus stroke={1.5} />} disabled={disabled} />}>{label}</PopoverTrigger>\n <PopoverContent className=\"w-[300px] p-0\" align=\"start\">\n <label\n className=\"flex h-10 items-center gap-2 border-b border-kit-line px-3 text-kit-fg-3\"\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") { e.preventDefault(); setActive((a) => (a + 1) % Math.max(1, flat.length)); }\n if (e.key === \"ArrowUp\") { e.preventDefault(); setActive((a) => (a - 1 + flat.length) % Math.max(1, flat.length)); }\n if (e.key === \"Enter\" && flat[active]) { e.preventDefault(); pick(flat[active]); }\n }}\n >\n <IconSearch className=\"size-4 shrink-0\" stroke={1.5} />\n <input autoFocus value={q} onChange={(e) => { setQ(e.target.value); setActive(0); }} placeholder=\"Search blocks\" aria-label=\"Search blocks\" className=\"h-full min-w-0 flex-1 bg-transparent text-kit-sm text-kit-fg outline-none placeholder:text-kit-fg-3\" />\n </label>\n <div className=\"max-h-80 overflow-y-auto p-1\" role=\"listbox\">\n {flat.length === 0 ? <p className=\"px-3 py-6 text-center text-kit-sm text-kit-fg-3\">No blocks match</p> : null}\n {cats.map((c) => (\n <div key={c} className=\"pb-1\">\n <div className=\"px-2 pb-1 pt-1.5 text-kit-2xs font-medium text-kit-fg-3\">{c}</div>\n {list.filter((b) => (b.category ?? \"Blocks\") === c).map((b) => {\n const i = flat.indexOf(b);\n const reason = why.get(b);\n return (\n <button\n key={b.name}\n type=\"button\"\n role=\"option\"\n aria-selected={i === active}\n aria-disabled={reason !== undefined || undefined}\n onMouseEnter={() => setActive(i)}\n onClick={() => pick(b)}\n className={cn(\"flex w-full items-center gap-2.5 rounded-kit-md p-1.5 text-left\", reason !== undefined && \"cursor-not-allowed\", i === active && \"bg-kit-hover\")}\n >\n <span className={cn(\"flex size-8 shrink-0 items-center justify-center rounded-kit-md border border-kit-line bg-kit-surface text-kit-fg-2 shadow-kit-xs\", reason !== undefined && \"opacity-50\")}>\n <KitIcon name={b.icon} className=\"size-4\" />\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className={cn(\"block truncate text-kit-sm\", reason !== undefined ? \"text-kit-fg-3\" : \"text-kit-fg\")}>{b.title}</span>\n {reason !== undefined ? (\n <span className=\"block text-kit-xs text-kit-fg-3\">{reason}</span>\n ) : b.description ? (\n <span className=\"block truncate text-kit-xs text-kit-fg-3\">{b.description}</span>\n ) : null}\n </span>\n </button>\n );\n })}\n </div>\n ))}\n </div>\n <div data-hint=\"shortcuts\" className=\"border-t border-kit-line px-3 py-1.5 text-kit-2xs text-kit-fg-3\">↵ add · type to search</div>\n </PopoverContent>\n </Popover>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,UAAU,EAAE,OAAO,QAAiD;CAClF,MAAM,OAAO,QAAQ;CACrB,MAAM,QAAQ,SAAS;CACvB,MAAM,KAAK,MAAM,MAAM;CACvB,MAAM,EAAE,aAAa,eAAe,KAAK;CACzC,MAAM,MAAM,QAAQ,IAAI;CACxB,MAAM,QAAQ,KAAK,MAAM,IAAI;CAC7B,MAAM,OAAO,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC;CAC7C,MAAM,SAAS,SAAoB,KAAK,MAAM,MAAM,WAAW,IAAI,CAAC;CACpE,M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