@bettercms-ai/kit 4.1.1 → 4.2.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/context.d.ts +8 -0
  2. package/dist/context.js.map +1 -1
  3. package/dist/controls/rich-text/block-tool.d.ts +1 -1
  4. package/dist/controls/rich-text/block-tool.js +1 -1
  5. package/dist/controls/rich-text/block-tool.js.map +1 -1
  6. package/dist/controls/rich-text/blocks.js +3 -1
  7. package/dist/controls/rich-text/blocks.js.map +1 -1
  8. package/dist/controls/rich-text/catalog.d.ts +26 -3
  9. package/dist/controls/rich-text/catalog.js +239 -58
  10. package/dist/controls/rich-text/catalog.js.map +1 -1
  11. package/dist/controls/rich-text/codec.d.ts +1 -1
  12. package/dist/controls/rich-text/codec.js +2 -1
  13. package/dist/controls/rich-text/codec.js.map +1 -1
  14. package/dist/controls/rich-text/dom.js +8 -3
  15. package/dist/controls/rich-text/dom.js.map +1 -1
  16. package/dist/controls/rich-text/editor.js +32 -6
  17. package/dist/controls/rich-text/editor.js.map +1 -1
  18. package/dist/controls/rich-text/rewriteSelection.d.ts +25 -0
  19. package/dist/controls/rich-text/rewriteSelection.js +28 -0
  20. package/dist/controls/rich-text/rewriteSelection.js.map +1 -0
  21. package/dist/controls/rich-text/slash-preview.js +18 -5
  22. package/dist/controls/rich-text/slash-preview.js.map +1 -1
  23. package/dist/controls/rich-text/table-grid.js +26 -21
  24. package/dist/controls/rich-text/table-grid.js.map +1 -1
  25. package/dist/controls/rich-text/toolbar.js +1 -0
  26. package/dist/controls/rich-text/toolbar.js.map +1 -1
  27. package/dist/controls/text.js +1 -1
  28. package/dist/controls/text.js.map +1 -1
  29. package/dist/engine/field-shell.js +8 -4
  30. package/dist/engine/field-shell.js.map +1 -1
  31. package/dist/engine/frame.js +3 -2
  32. package/dist/engine/frame.js.map +1 -1
  33. package/dist/engine/grouping.js +4 -3
  34. package/dist/engine/grouping.js.map +1 -1
  35. package/dist/engine/item-list.js +2 -2
  36. package/dist/engine/item-list.js.map +1 -1
  37. package/dist/engine/schema-form.d.ts +2 -0
  38. package/dist/engine/schema-form.js +2 -0
  39. package/dist/engine/schema-form.js.map +1 -1
  40. package/dist/index.js +2 -2
  41. package/dist/kit.css +6 -32
  42. package/dist/lib/reduced-motion.d.ts +1 -0
  43. package/dist/lib/reduced-motion.js +19 -0
  44. package/dist/lib/reduced-motion.js.map +1 -0
  45. package/dist/styles.css +1 -1
  46. package/dist/theme.css +100 -0
  47. package/dist/tokens.css +6 -0
  48. package/dist/ui/content-fields.js +3 -2
  49. package/dist/ui/content-fields.js.map +1 -1
  50. package/dist/ui/controls.js +3 -2
  51. package/dist/ui/controls.js.map +1 -1
  52. package/dist/ui/floating-panel.js +3 -2
  53. package/dist/ui/floating-panel.js.map +1 -1
  54. package/dist/ui/foundations.js +3 -2
  55. package/dist/ui/foundations.js.map +1 -1
  56. package/dist/ui/index.js +2 -2
  57. package/dist/ui/inspector.d.ts +22 -4
  58. package/dist/ui/inspector.js +72 -27
  59. package/dist/ui/inspector.js.map +1 -1
  60. package/dist/ui/tab.js +3 -2
  61. package/dist/ui/tab.js.map +1 -1
  62. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"floating-panel.js","names":[],"sources":["../../src/ui/floating-panel.tsx"],"sourcesContent":["/**\n * FloatingPanel (CPO D54): ONE primitive for every non-modal window over the work surface. It owns drag, magnetic snap,\n * resize and \"remember where I put it\"; the ⌘J assistant (D30) and the component properties panel both use it.\n *\n * geometry track() · snapRect() · <SnapGuides> · <ResizeEdges> (4 edges + 4 corners) · <ResizeGrip> (keyboard)\n * (the low-level pieces, shared with the assistant's floating window)\n * <FloatingPanel> a small properties window anchored to the thing it edits:\n * float (≥768 with a mouse) docks in the editor column's right gutter (≥356px), else the left gutter, else it\n * overlays the right edge; avoids a floating assistant, the Publish tray and the 56px navbar. While docked\n * it follows the anchor's top (sticky between 72px from the top and 16px from the bottom); once dragged it\n * stays where it was put. 340 × auto (≤560), resizable 300×240 … 520 × (viewport − 96). Header = drag\n * handle; double-click resets it to its docked default. Side, offset and size persist per user and per\n * width bucket (≥1280 · 768–1279).\n * side (768–1279 on touch) a 340px right sheet, no scrim.\n * sheet (<768) a bottom sheet, 50% or 90% tall; drag the grabber down to close.\n * modal inside a D49 ExpandedEditorModal (`container`): docked into the modal's right 340px (the reading column\n * shifts left), or over the modal's edge when it is narrow.\n * Non-modal: `role=\"dialog\"` + `aria-modal=\"false\"`, no focus trap, outside clicks never close it. Esc closes (menus,\n * pickers and field drafts first), F6 moves focus between the panel and `focusBack()`. Marked `data-floating-layer`.\n * Layering: canvas toolbars < panel 52 (= the D30 window) < sheets 55 < dialogs 60 < menus 80 < tooltips 90.\n */\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { motion, useMotionValue, useReducedMotion, type MotionValue } from \"framer-motion\";\nimport { cn } from \"../lib/cn\";\nimport { eventKey } from \"../lib/key-event\";\nimport { KIT_SCOPE } from \"./surfaces\";\n\n/* ── Geometry (shared with the D30 assistant window) ─────────────────────────────────────────── */\nexport const NAV = 56;\nexport const SNAP = 16;\nexport const EDGE = 16;\nexport const Z_FLOAT = \"z-[var(--kit-z-float,52)]\";\nexport const EASE = [0.32, 0.72, 0, 1] as const;\n\nexport type Rect = { x: number; y: number; w: number; h: number };\n/** Where a window may sit and how big it may get. `top` is the smallest y (under the navbar), `pad` the inset elsewhere. */\nexport interface Bounds {\n minW: number;\n minH: number;\n maxW: () => number;\n maxH: () => number;\n top: number;\n pad: number;\n}\n/** Magnetic lines in viewport px: `v` = x positions (left/right edges snap to them), `h` = y positions. */\nexport interface SnapLines {\n v: number[];\n h: number[];\n}\n/** 1px guide lines to draw (viewport px). */\nexport interface Guides {\n v: number[];\n h: number[];\n}\nexport const NO_GUIDES: Guides = { v: [], h: [] };\nexport interface Geom {\n x: MotionValue<number>;\n y: MotionValue<number>;\n w: MotionValue<number>;\n h: MotionValue<number>;\n}\n\nexport const vw = () => window.innerWidth;\nexport const vh = () => window.innerHeight;\nexport const clampN = (n: number, lo: number, hi: number) => Math.max(lo, Math.min(hi, n));\n\nexport function fitRect(g: Rect, b: Bounds): Rect {\n const w = clampN(g.w, b.minW, Math.max(b.minW, b.maxW()));\n const h = clampN(g.h, b.minH, Math.max(b.minH, b.maxH()));\n return { w, h, x: clampN(g.x, b.pad, Math.max(b.pad, vw() - w - b.pad)), y: clampN(g.y, b.top, Math.max(b.top, vh() - h - b.pad)) };\n}\n\n/** Clamp to the viewport, then pull any edge within SNAP px of a line onto it (the nearest wins). */\nexport function snapRect(x: number, y: number, w: number, h: number, lines: SnapLines, b: Bounds): { x: number; y: number; g: Guides } {\n let nx = clampN(x, b.pad, Math.max(b.pad, vw() - w - b.pad));\n let ny = clampN(y, b.top, Math.max(b.top, vh() - h - b.pad));\n const g: Guides = { v: [], h: [] };\n let best = SNAP + 1;\n let gx: number | null = null;\n let sx = nx;\n for (const L of lines.v) {\n const a = Math.abs(nx - L);\n if (a <= SNAP && a < best) (best = a), (sx = L), (gx = L - 1);\n const z = Math.abs(nx + w - L);\n if (z <= SNAP && z < best) (best = z), (sx = L - w), (gx = L);\n }\n nx = sx;\n if (gx != null) g.v.push(gx);\n best = SNAP + 1;\n let gy: number | null = null;\n let sy = ny;\n for (const L of lines.h) {\n const a = Math.abs(ny - L);\n if (a <= SNAP && a < best) (best = a), (sy = L), (gy = L - 1);\n const z = Math.abs(ny + h - L);\n if (z <= SNAP && z < best) (best = z), (sy = L - h), (gy = L);\n }\n ny = sy;\n if (gy != null) g.h.push(gy);\n return { x: nx, y: ny, g };\n}\n\n/** Runs a pointer drag on window-level listeners (works from any handle, survives leaving the element). */\nexport function track(e: React.PointerEvent, onMove: (dx: number, dy: number) => void, onEnd: (moved: boolean) => void, cursor?: string) {\n const sx = e.clientX;\n const sy = e.clientY;\n let moved = false;\n if (cursor) document.body.style.cursor = cursor;\n document.body.style.userSelect = \"none\";\n const move = (ev: PointerEvent) => {\n const dx = ev.clientX - sx;\n const dy = ev.clientY - sy;\n if (!moved && Math.abs(dx) + Math.abs(dy) < 3) return;\n moved = true;\n onMove(dx, dy);\n };\n const up = () => {\n window.removeEventListener(\"pointermove\", move);\n window.removeEventListener(\"pointerup\", up);\n window.removeEventListener(\"pointercancel\", up);\n document.body.style.cursor = \"\";\n document.body.style.userSelect = \"\";\n onEnd(moved);\n };\n window.addEventListener(\"pointermove\", move);\n window.addEventListener(\"pointerup\", up);\n window.addEventListener(\"pointercancel\", up);\n}\n\n/** Magnetic guides: a 1px hairline along each line the window is snapped to. */\nexport function SnapGuides({ guides }: { guides: Guides }) {\n // --brand (V2): #a878d2, dark #b792db\n const line = cn(\"pointer-events-none fixed bg-[var(--kit-brand)]\", Z_FLOAT);\n return (\n <>\n {guides.v.map((p) => (\n <span key={`v${p}`} aria-hidden className={line} style={{ left: p, top: 8, bottom: 8, width: 1 }} />\n ))}\n {guides.h.map((p) => (\n <span key={`h${p}`} aria-hidden className={line} style={{ top: p, left: 8, right: 8, height: 1 }} />\n ))}\n </>\n );\n}\n\nexport type ResizeDir = \"n\" | \"s\" | \"e\" | \"w\" | \"nw\" | \"ne\" | \"sw\" | \"se\";\nconst HANDLES: { d: ResizeDir; cls: string; cursor: string }[] = [\n { d: \"n\", cls: \"inset-x-3 top-0 h-1.5\", cursor: \"ns-resize\" },\n { d: \"s\", cls: \"inset-x-3 bottom-0 h-1.5\", cursor: \"ns-resize\" },\n { d: \"w\", cls: \"inset-y-3 left-0 w-1.5\", cursor: \"ew-resize\" },\n { d: \"e\", cls: \"inset-y-3 right-0 w-1.5\", cursor: \"ew-resize\" },\n { d: \"nw\", cls: \"left-0 top-0 size-3\", cursor: \"nwse-resize\" },\n { d: \"se\", cls: \"bottom-0 right-0 size-3\", cursor: \"nwse-resize\" },\n { d: \"ne\", cls: \"right-0 top-0 size-3\", cursor: \"nesw-resize\" },\n { d: \"sw\", cls: \"bottom-0 left-0 size-3\", cursor: \"nesw-resize\" },\n];\n\n/** Resize from 4 edges and 4 corners. `onStart` runs before the first read (e.g. turn an auto height into a number). */\nexport function ResizeEdges({ geom, bounds, onStart, onEnd }: { geom: Geom; bounds: Bounds; onStart?: () => void; onEnd: (dir: ResizeDir) => void }) {\n const { x, y, w, h } = geom;\n return (\n <>\n {HANDLES.map((hd) => (\n <div\n key={hd.d}\n aria-hidden\n style={{ cursor: hd.cursor }}\n className={cn(\"absolute z-30 touch-none\", hd.cls)}\n onPointerDown={(e) => {\n if (e.button !== 0) return;\n e.preventDefault();\n e.stopPropagation();\n onStart?.();\n const o = { x: x.get(), y: y.get(), w: w.get(), h: h.get() };\n const maxW = bounds.maxW();\n const maxH = bounds.maxH();\n track(\n e,\n (dx, dy) => {\n let nw = o.w;\n let nh = o.h;\n if (hd.d.includes(\"e\")) nw = o.w + dx;\n if (hd.d.includes(\"w\")) nw = o.w - dx;\n if (hd.d.includes(\"s\")) nh = o.h + dy;\n if (hd.d.includes(\"n\")) nh = o.h - dy;\n nw = clampN(nw, bounds.minW, maxW);\n nh = clampN(nh, bounds.minH, maxH);\n const nx = clampN(hd.d.includes(\"w\") ? o.x + o.w - nw : o.x, bounds.pad, vw() - nw - bounds.pad);\n const ny = clampN(hd.d.includes(\"n\") ? o.y + o.h - nh : o.y, bounds.top, vh() - nh - bounds.pad);\n x.set(nx);\n y.set(ny);\n w.set(nw);\n h.set(nh);\n },\n (moved) => moved && onEnd(hd.d),\n hd.cursor,\n );\n }}\n />\n ))}\n </>\n );\n}\n\n/** Keyboard resize: a focusable grip (role=\"separator\"). ←/→ width, ↑/↓ height (±16, Shift ±64); grows toward the open side. */\nexport function ResizeGrip({ geom, bounds, label, onStart, onEnd, className }: { geom: Geom; bounds: Bounds; label: string; onStart?: () => void; onEnd: () => void; className?: string }) {\n const { x, y, w, h } = geom;\n const [size, setSize] = React.useState(() => ({ w: Math.round(w.get()), h: Math.round(h.get()) }));\n return (\n <div\n role=\"separator\"\n tabIndex={0}\n aria-label={label}\n aria-valuetext={`${size.w} by ${size.h} pixels`}\n aria-keyshortcuts=\"ArrowLeft ArrowRight ArrowUp ArrowDown\"\n onFocus={() => setSize({ w: Math.round(w.get()), h: Math.round(h.get()) })}\n onKeyDown={(e) => {\n const step = e.shiftKey ? 64 : 16;\n const dw = e.key === \"ArrowRight\" ? step : e.key === \"ArrowLeft\" ? -step : 0;\n const dh = e.key === \"ArrowDown\" ? step : e.key === \"ArrowUp\" ? -step : 0;\n if (!dw && !dh) return;\n e.preventDefault();\n e.stopPropagation();\n onStart?.();\n const nw = clampN(w.get() + dw, bounds.minW, bounds.maxW());\n const nh = clampN(h.get() + dh, bounds.minH, bounds.maxH());\n x.set(clampN(x.get(), bounds.pad, Math.max(bounds.pad, vw() - nw - bounds.pad)));\n y.set(clampN(y.get(), bounds.top, Math.max(bounds.top, vh() - nh - bounds.pad)));\n w.set(nw);\n h.set(nh);\n setSize({ w: Math.round(nw), h: Math.round(nh) });\n onEnd();\n }}\n className={cn(\n \"group/kgrip pointer-events-none absolute bottom-0.5 right-0.5 z-40 flex size-4 items-end justify-end rounded-kit-sm outline-none\",\n className,\n )}\n >\n <svg aria-hidden viewBox=\"0 0 10 10\" className=\"size-2.5 text-kit-fg-4 opacity-0 transition-opacity group-focus-visible/kgrip:opacity-100\">\n <path d=\"M9 3 3 9M9 6 6 9\" stroke=\"currentColor\" strokeWidth=\"1.2\" strokeLinecap=\"round\" />\n </svg>\n </div>\n );\n}\n\n/* ── Remembered placement: per user, per panel, per width bucket ─────────────────────────────── */\nexport interface PanelPref {\n side?: \"left\" | \"right\";\n /** set once the person drags it: the panel stays here instead of following its anchor */\n pos?: { x: number; y: number };\n w?: number;\n /** set once the person resizes the height; otherwise the height follows the content */\n h?: number;\n}\ninterface PanelPrefState {\n prefs: Record<string, PanelPref>;\n patch: (key: string, p: Partial<PanelPref> | null) => void;\n}\n/* Remembered per browser in localStorage (the kit carries no state library). A blocked or full storage only loses the\n memory: the panel still docks at its default. */\nconst PREFS_KEY = \"bcms-kit-floating-panel\";\nconst prefListeners = new Set<() => void>();\nfunction readPrefs(): Record<string, PanelPref> {\n try {\n const raw = typeof localStorage === \"undefined\" ? null : localStorage.getItem(PREFS_KEY);\n const parsed = raw ? (JSON.parse(raw) as unknown) : null;\n return parsed && typeof parsed === \"object\" ? (parsed as Record<string, PanelPref>) : {};\n } catch {\n return {};\n }\n}\nconst prefState: PanelPrefState = {\n prefs: readPrefs(),\n patch: (key, p) => {\n const next: PanelPref = p === null ? {} : { ...prefState.prefs[key], ...p };\n for (const k of Object.keys(next) as (keyof PanelPref)[]) if (next[k] === undefined) delete next[k];\n prefState.prefs = { ...prefState.prefs, [key]: next };\n try {\n localStorage.setItem(PREFS_KEY, JSON.stringify(prefState.prefs));\n } catch {\n /* storage blocked: placement is remembered for this session only */\n }\n prefListeners.forEach((l) => l());\n },\n};\nconst subscribePrefs = (l: () => void) => {\n prefListeners.add(l);\n return () => prefListeners.delete(l);\n};\n/** Read the remembered placements with a selector; `useFloatingPanelPrefs.getState()` for imperative reads and writes. */\nexport function useFloatingPanelPrefs<T>(select: (s: PanelPrefState) => T): T {\n return React.useSyncExternalStore(\n subscribePrefs,\n () => select(prefState),\n () => select(prefState),\n );\n}\nuseFloatingPanelPrefs.getState = (): PanelPrefState => prefState;\nexport type WidthBucket = \"wide\" | \"mid\";\nconst bucketNow = (): WidthBucket => (vw() >= 1280 ? \"wide\" : \"mid\");\n\nexport type PanelMode = \"float\" | \"side\" | \"sheet\" | \"modal\";\nfunction useMedia(q: string) {\n const [ok, setOk] = React.useState(() => typeof window !== \"undefined\" && window.matchMedia(q).matches);\n React.useEffect(() => {\n const m = window.matchMedia(q);\n const on = () => setOk(m.matches);\n on();\n m.addEventListener(\"change\", on);\n return () => m.removeEventListener(\"change\", on);\n }, [q]);\n return ok;\n}\n/** How a panel presents at this width and pointer: float · side (tablet touch) · sheet (phones) · modal (inside a D49 modal). */\nexport function usePanelMode(inModal?: boolean): PanelMode {\n const phone = useMedia(\"(max-width: 767px)\");\n const touchTablet = useMedia(\"(max-width: 1279px) and (pointer: coarse)\");\n if (inModal) return \"modal\";\n return phone ? \"sheet\" : touchTablet ? \"side\" : \"float\";\n}\n\n/* ── helpers ──────────────────────────────────────────────────────────────────────────────────── */\nfunction scrollParent(el: HTMLElement | null): HTMLElement | null {\n let p = el?.parentElement ?? null;\n while (p && p !== document.body && p !== document.documentElement) {\n const o = getComputedStyle(p).overflowY;\n if ((o === \"auto\" || o === \"scroll\") && p.scrollHeight > p.clientHeight) return p;\n p = p.parentElement;\n }\n return null;\n}\n/** Things a panel never covers by default: a floating or docked assistant, anything marked `data-floating-avoid`. */\nconst AVOID = \"#assistant-panel, [data-floating-avoid]\";\n/** Right-side panels of the page (the editor's Publishing · History · Comments): the panel takes the other side. */\nconst SIDE_PANELS = \"[data-doc-settings], [data-side-panel]\";\n/** A menu, picker, popover or another dialog is open: it takes Esc first. */\n/** An open Base UI popup (popover, menu, select, combobox): it carries data-open and data-side. Kit tooltips don't count. */\nconst POPUP_OPEN = \"[data-open][data-side]:not([data-kit-tooltip])\";\n/** A tooltip (the kit's, or the host's `data-slot=\"tooltip-content\"`), its positioner or arrow: a hint left open never takes Esc. */\nconst TOOLTIP = \"[data-kit-tooltip], [data-slot=tooltip-content]\";\nconst isTooltip = (n: Element) => !!n.closest(TOOLTIP) || !!n.querySelector(TOOLTIP);\nconst OWNS_ESCAPE = `[role=menu],[role=listbox],[data-cell-editing],${POPUP_OPEN}`;\nfunction layerOpen(self: HTMLElement | null) {\n // a popover, menu or select (tooltips don't count), a cell with a draft\n if (document.querySelector(\"[data-cell-editing]\") || Array.from(document.querySelectorAll(POPUP_OPEN)).some((n) => !isTooltip(n))) return true;\n // a floating menu or picker (the slash menu); page-level listboxes (a sidebar list) don't count\n const floating = (n: HTMLElement) => n.getAttribute(\"role\") === \"menu\" || !!n.closest(\"[data-floating-layer]:not([data-floating-panel])\");\n if (Array.from(document.querySelectorAll<HTMLElement>(\"[role=menu], [role=listbox]\")).some((n) => n.getClientRects().length && floating(n))) return true;\n return Array.from(document.querySelectorAll<HTMLElement>(\"[role=dialog]:is([data-open],[data-state=open])\")).some(\n (d) => d !== self && !d.hasAttribute(\"data-expanded-editor\") && !d.hasAttribute(\"data-floating-panel\") && d.id !== \"assistant-panel\" && !d.hasAttribute(\"data-doc-panel\"),\n );\n}\nconst FOCUSABLE = \"input:not([type=hidden]):not([disabled]), textarea:not([disabled]), [contenteditable=true], select:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex='-1'])\";\n\n/** Events from the panel never reach the React tree it was rendered from (the card, the editor around it). */\nconst stop = (e: React.SyntheticEvent) => e.stopPropagation();\nconst FENCE = {\n onFocus: stop, onBlur: stop, onClick: stop, onDoubleClick: stop, onMouseDown: stop, onMouseUp: stop, onMouseMove: stop,\n onInput: stop, onPaste: stop, onCut: stop, onCopy: stop, onKeyUp: stop, onContextMenu: stop,\n} as const;\n\n/* ── The panel ────────────────────────────────────────────────────────────────────────────────── */\nexport const PANEL_W = 340;\nconst PANEL_MAX_AUTO_H = 560;\nconst TOP_LIMIT = 72;\nconst BOTTOM_GAP = 16;\nconst FLOAT_BOUNDS: Bounds = { minW: 300, minH: 240, maxW: () => Math.min(520, vw() - 32), maxH: () => vh() - 96, top: NAV + 4, pad: 8 };\n\nexport interface FloatingPanelHandle {\n dock: (side: \"left\" | \"right\") => void;\n /** back to the docked default (position and size) */\n reset: () => void;\n /** keyboard move / resize: arrows ±16 (Shift ±64), Enter commits, Esc cancels */\n keyboard: (mode: \"move\" | \"resize\") => void;\n /** a polite announcement from the panel's own live region */\n announce: (text: string) => void;\n el: () => HTMLElement | null;\n}\nexport interface FloatingPanelProps {\n /** remembered placement key (one per kind of panel) */\n id: string;\n /** id of the element that names the panel (the header title) */\n labelledBy: string;\n /** the thing it edits: the panel follows it and docks beside its column (`[data-rt-editor]`) */\n anchor: HTMLElement | null;\n /** render inside this element instead of <body> (the D49 modal) */\n container?: HTMLElement | null;\n header: React.ReactNode;\n children: React.ReactNode;\n /** bottom-sheet footer (Done) */\n sheetFooter?: React.ReactNode;\n onClose: () => void;\n /** F6 / Esc: where focus goes back to (the card) */\n focusBack?: () => void;\n /** a refill (another component picked while open): no entrance animation */\n instant?: boolean;\n bodyClassName?: string;\n /** keys anywhere in the panel, before its own handling (⌘Z joins the host's undo) */\n onPanelKeyDown?: (e: KeyboardEvent) => void;\n}\n\nexport const FloatingPanel = React.forwardRef<FloatingPanelHandle, FloatingPanelProps>(function FloatingPanel(\n { id, labelledBy, anchor, container, header, children, sheetFooter, onClose, focusBack, instant, bodyClassName, onPanelKeyDown },\n handle,\n) {\n const reduce = useReducedMotion();\n const mode = usePanelMode(!!container);\n const root = React.useRef<HTMLDivElement>(null);\n const live = React.useRef<HTMLDivElement>(null);\n const [bucket, setBucket] = React.useState<WidthBucket>(bucketNow);\n const key = `${id}:${bucket}`;\n const pref = useFloatingPanelPrefs((s) => s.prefs[key]) ?? EMPTY;\n const patch = (p: Partial<PanelPref> | null) => {\n useFloatingPanelPrefs.getState().patch(key, p);\n // layout may run before React re-renders with the new prefs\n prefRef.current = useFloatingPanelPrefs.getState().prefs[key] ?? EMPTY;\n };\n const x = useMotionValue(-9999);\n const y = useMotionValue(-9999);\n const w = useMotionValue(pref.w ?? PANEL_W);\n const h = useMotionValue(pref.h ?? 0);\n const geom = React.useMemo<Geom>(() => ({ x, y, w, h }), [x, y, w, h]);\n const [explicitH, setExplicitH] = React.useState(!!pref.h);\n const [maxAuto, setMaxAuto] = React.useState(PANEL_MAX_AUTO_H);\n const [guides, setGuides] = React.useState<Guides>(NO_GUIDES);\n const [kbd, setKbd] = React.useState<null | { mode: \"move\" | \"resize\"; start: Rect; explicit: boolean }>(null);\n const [sheetH, setSheetH] = React.useState<50 | 90>(50);\n const busy = React.useRef(false); // dragging / resizing: layout pauses\n const prefRef = React.useRef(pref);\n prefRef.current = pref;\n const kbdRef = React.useRef(kbd);\n kbdRef.current = kbd;\n const closeRef = React.useRef(onClose);\n closeRef.current = onClose;\n const backRef = React.useRef(focusBack);\n backRef.current = focusBack;\n\n // a new width bucket brings its own remembered placement\n React.useEffect(() => {\n const on = () => setBucket(bucketNow());\n window.addEventListener(\"resize\", on);\n return () => window.removeEventListener(\"resize\", on);\n }, []);\n React.useEffect(() => {\n w.set(pref.w ?? PANEL_W);\n setExplicitH(!!pref.h);\n if (pref.h) h.set(pref.h);\n }, [key]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const column = React.useCallback(() => (anchor?.closest<HTMLElement>(\"[data-rt-editor]\") ?? anchor)?.getBoundingClientRect() ?? null, [anchor]);\n\n /** Where the panel sits now (float mode): its remembered spot, or docked beside the column, following the anchor. */\n const layout = React.useCallback(() => {\n const el = root.current;\n if (!el || !anchor || mode !== \"float\" || busy.current || kbdRef.current) return;\n const p = prefRef.current;\n const sc = scrollParent(anchor)?.getBoundingClientRect();\n const top = Math.max(TOP_LIMIT, (sc?.top ?? 0) + 8);\n let bottom = vh() - BOTTOM_GAP;\n const tray = document.querySelector<HTMLElement>(\"[data-action-tray]\")?.getBoundingClientRect();\n if (tray && tray.height && tray.top > top + 240) bottom = Math.min(bottom, tray.top - 8);\n if (sc && sc.bottom > top + 240) bottom = Math.min(bottom, sc.bottom - 8);\n const room = Math.max(FLOAT_BOUNDS.minH, bottom - top);\n const nextMax = Math.min(PANEL_MAX_AUTO_H, room);\n setMaxAuto((m) => (m === nextMax ? m : nextMax));\n const ww = w.get();\n const ph = Math.min(el.offsetHeight || 320, room);\n if (p.pos) {\n x.set(clampN(p.pos.x, 8, Math.max(8, vw() - ww - 8)));\n y.set(clampN(p.pos.y, NAV + 4, Math.max(NAV + 4, vh() - ph - 8)));\n return;\n }\n const col = column();\n const a = anchor.getBoundingClientRect();\n if (!col) return;\n let L = Math.max(8, sc?.left ?? 0);\n let R = Math.min(vw() - 8, sc?.right ?? vw());\n for (const o of Array.from(document.querySelectorAll<HTMLElement>(AVOID))) {\n if (o === el || el.contains(o)) continue;\n const r = o.getBoundingClientRect();\n if (!r.width || !r.height || r.bottom < top || r.top > bottom) continue;\n if (r.left + r.width / 2 < col.left + col.width / 2) L = Math.max(L, r.right);\n else R = Math.min(R, r.left);\n }\n const need = ww + 16;\n const fits = { right: R - col.right >= need, left: col.left - L >= need };\n // an open right-side panel (Publishing · History · Comments) sends it to the other side\n const rightBusy = Array.from(document.querySelectorAll<HTMLElement>(SIDE_PANELS)).some((n) => n.getBoundingClientRect().width > 40);\n const side = p.side ?? (rightBusy ? \"left\" : fits.right ? \"right\" : fits.left ? \"left\" : \"right\");\n const nx = side === \"right\" ? (fits.right ? col.right + 16 : R - ww - 8) : fits.left ? col.left - 16 - ww : L + 8;\n x.set(clampN(nx, 8, Math.max(8, vw() - ww - 8)));\n y.set(clampN(a.top, top, Math.max(top, bottom - ph)));\n }, [anchor, mode, column, w, x, y]);\n\n React.useLayoutEffect(() => {\n layout();\n }, [layout, pref.pos, pref.side, pref.w, explicitH]);\n React.useEffect(() => {\n if (mode !== \"float\") return;\n let raf = 0;\n let settle = 0;\n const on = () => {\n cancelAnimationFrame(raf);\n raf = requestAnimationFrame(layout);\n // once more after things stop moving (a side panel's exit animation ends after the last resize)\n window.clearTimeout(settle);\n settle = window.setTimeout(layout, 320);\n };\n window.addEventListener(\"scroll\", on, true);\n window.addEventListener(\"resize\", on);\n // something it avoids may have moved (the assistant window dropped somewhere else)\n window.addEventListener(\"pointerup\", on);\n const ro = new ResizeObserver(on);\n if (root.current) ro.observe(root.current);\n if (anchor) ro.observe(anchor);\n // the work surface narrowing (a side panel opening) moves the column without resizing the anchor\n const sc = scrollParent(anchor);\n if (sc) ro.observe(sc);\n return () => {\n cancelAnimationFrame(raf);\n window.clearTimeout(settle);\n window.removeEventListener(\"scroll\", on, true);\n window.removeEventListener(\"resize\", on);\n window.removeEventListener(\"pointerup\", on);\n ro.disconnect();\n };\n }, [mode, layout, anchor]);\n\n // modal: dock into the modal's right 340px (the reading column shifts left), or overlay its edge when narrow\n const [modalFit, setModalFit] = React.useState<\"dock\" | \"overlay\" | \"bottom\">(\"dock\");\n React.useLayoutEffect(() => {\n if (mode !== \"modal\" || !container) return;\n const fit = () => {\n const cw = container.clientWidth;\n const next = cw < 560 ? \"bottom\" : cw >= PANEL_W + 680 ? \"dock\" : \"overlay\";\n setModalFit(next);\n if (next === \"dock\") container.setAttribute(\"data-floating-dock\", \"right\");\n else container.removeAttribute(\"data-floating-dock\");\n };\n fit();\n const ro = new ResizeObserver(fit);\n ro.observe(container);\n return () => {\n ro.disconnect();\n container.removeAttribute(\"data-floating-dock\");\n };\n }, [mode, container]);\n\n const toExplicit = () => {\n if (explicitH || !root.current) return;\n h.set(root.current.offsetHeight);\n setExplicitH(true);\n };\n const say = (text: string) => {\n const el = live.current;\n if (!el) return;\n el.textContent = \"\";\n window.setTimeout(() => {\n if (live.current) live.current.textContent = text;\n }, 60);\n };\n\n const reset = () => {\n patch(null);\n setExplicitH(false);\n w.set(PANEL_W);\n };\n React.useImperativeHandle(handle, () => ({\n dock: (side) => patch({ side, pos: undefined }),\n reset,\n keyboard: (m) => {\n if (mode !== \"float\") return;\n if (m === \"resize\") toExplicit();\n setKbd({ mode: m, start: { x: x.get(), y: y.get(), w: w.get(), h: root.current?.offsetHeight ?? h.get() }, explicit: explicitH });\n // after the ⋯ menu has handed focus back to its trigger\n window.setTimeout(() => root.current?.focus({ preventScroll: true }), 80);\n say(m === \"move\" ? \"Moving the panel. Arrow keys move it, Enter keeps it there, Escape cancels.\" : \"Resizing the panel. Arrow keys resize it, Enter keeps the size, Escape cancels.\");\n },\n announce: say,\n el: () => root.current,\n }));\n\n /** Esc: keyboard mode cancels first, then the panel closes and focus goes back to the card. */\n const escape = React.useCallback(() => {\n const k = kbdRef.current;\n if (k) {\n x.set(k.start.x);\n y.set(k.start.y);\n w.set(k.start.w);\n if (!k.explicit) setExplicitH(false);\n else h.set(k.start.h);\n setKbd(null);\n say(\"Cancelled\");\n return;\n }\n closeRef.current();\n backRef.current?.();\n }, [x, y, w, h]);\n\n // Esc / F6 from OUTSIDE the panel (the text, the page); the modal forwards its Esc through \"floatingpanel:escape\"\n React.useEffect(() => {\n const el = root.current;\n const onKey = (e: KeyboardEvent) => {\n if (el?.contains(e.target as Node)) return;\n if (e.key === \"F6\") {\n e.preventDefault();\n const f = Array.from(el?.querySelectorAll<HTMLElement>(`[data-panel-body] :is(${FOCUSABLE})`) ?? []).find((n) => n.getClientRects().length) ?? el;\n f?.focus({ preventScroll: true });\n return;\n }\n if (e.key !== \"Escape\" || e.defaultPrevented || layerOpen(el)) return;\n if (!container && document.querySelector(\"[data-expanded-editor]\")) return; // a D49 modal over us owns Esc\n e.preventDefault();\n escape();\n };\n const onForward = () => escape();\n window.addEventListener(\"keydown\", onKey);\n el?.addEventListener(\"floatingpanel:escape\", onForward);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n el?.removeEventListener(\"floatingpanel:escape\", onForward);\n };\n }, [container, escape]);\n\n // Keys inside the panel\n /* Keys inside the panel run on a NATIVE listener on the panel itself: it sees them first, wherever the panel is\n portalled (inside a modal, React's own listeners sit on other containers). */\n const keyRef = React.useRef<(e: KeyboardEvent) => void>(() => {});\n keyRef.current = (e: KeyboardEvent) => {\n const native = e as KeyboardEvent & { bcmsPanelHandled?: boolean };\n onPanelKeyDown?.(e);\n const k = kbdRef.current;\n if (k) {\n const step = e.shiftKey ? 64 : 16;\n const dx = e.key === \"ArrowRight\" ? step : e.key === \"ArrowLeft\" ? -step : 0;\n const dy = e.key === \"ArrowDown\" ? step : e.key === \"ArrowUp\" ? -step : 0;\n if (dx || dy) {\n e.preventDefault();\n if (k.mode === \"move\") {\n x.set(clampN(x.get() + dx, 8, vw() - w.get() - 8));\n y.set(clampN(y.get() + dy, NAV + 4, vh() - h.get() - 8));\n } else {\n w.set(clampN(w.get() + dx, FLOAT_BOUNDS.minW, FLOAT_BOUNDS.maxW()));\n h.set(clampN(h.get() + dy, FLOAT_BOUNDS.minH, FLOAT_BOUNDS.maxH()));\n x.set(clampN(x.get(), 8, vw() - w.get() - 8));\n }\n return;\n }\n if (e.key === \"Enter\") {\n e.preventDefault();\n patch(k.mode === \"move\" ? { pos: { x: x.get(), y: y.get() } } : { w: w.get(), h: h.get(), pos: { x: x.get(), y: y.get() } });\n setKbd(null);\n say(k.mode === \"move\" ? \"Panel moved\" : \"Panel resized\");\n return;\n }\n }\n if (e.key === \"F6\") {\n e.preventDefault();\n backRef.current?.();\n } else if (e.key === \"Escape\" && !native.bcmsPanelHandled && !(e.target as HTMLElement).closest?.(OWNS_ESCAPE) && !layerOpen(root.current)) {\n e.preventDefault();\n native.bcmsPanelHandled = true;\n escape();\n }\n };\n React.useEffect(() => {\n const el = root.current;\n if (!el) return;\n const on = (e: KeyboardEvent) => keyRef.current(e);\n el.addEventListener(\"keydown\", on);\n return () => el.removeEventListener(\"keydown\", on);\n }, [mode]);\n // keep keys away from the card / editor this panel was rendered from (modified keys still reach app shortcuts)\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (!(e.metaKey || e.ctrlKey) || eventKey(e) === \"z\") e.stopPropagation();\n };\n\n const onHeaderDown = (e: React.PointerEvent) => {\n if (mode !== \"float\" || e.button !== 0 || (e.target as HTMLElement).closest(\"button, a, input, textarea, [role=menuitem], [contenteditable]\")) return;\n e.preventDefault();\n const ox = x.get();\n const oy = y.get();\n const ww = w.get();\n const hh = root.current?.offsetHeight ?? h.get();\n const col = column();\n const lines: SnapLines = { v: [EDGE, vw() - EDGE, ...(col ? [col.left, col.right] : [])], h: [TOP_LIMIT, vh() - EDGE] };\n busy.current = true;\n track(\n e,\n (dx, dy) => {\n const r = snapRect(ox + dx, oy + dy, ww, hh, lines, FLOAT_BOUNDS);\n x.set(r.x);\n y.set(r.y);\n setGuides((g) => (g.v.join() === r.g.v.join() && g.h.join() === r.g.h.join() ? g : r.g));\n },\n (moved) => {\n busy.current = false;\n setGuides(NO_GUIDES);\n if (moved) patch({ pos: { x: x.get(), y: y.get() } });\n },\n \"grabbing\",\n );\n };\n\n const headerEl = (\n <div\n data-panel-header=\"\"\n onPointerDown={onHeaderDown}\n onDoubleClick={(e) => {\n if (mode !== \"float\" || (e.target as HTMLElement).closest(\"button, a, input, [role=menuitem]\")) return;\n reset();\n }}\n className={cn(\"flex h-10 shrink-0 items-center gap-1 border-b border-kit-line-subtle pl-3 pr-1.5\", mode === \"float\" && \"cursor-grab touch-none select-none active:cursor-grabbing\")}\n >\n {header}\n </div>\n );\n const body = (\n <div data-panel-body=\"\" className={cn(\"min-h-0 flex-1 overflow-y-auto overscroll-contain\", bodyClassName)}>\n {children}\n </div>\n );\n const liveEl = <div ref={live} aria-live=\"polite\" className=\"sr-only\" />;\n const common = {\n ref: root,\n role: \"dialog\",\n \"aria-modal\": false as const,\n \"aria-labelledby\": labelledBy,\n tabIndex: -1,\n ...KIT_SCOPE,\n \"data-floating-layer\": \"\",\n \"data-floating-panel\": \"\",\n \"data-state\": \"open\",\n \"data-kbd\": kbd ? kbd.mode : undefined,\n onKeyDown,\n ...FENCE,\n };\n const fade = reduce || instant ? { duration: 0 } : { duration: 0.16, ease: EASE };\n\n let node: React.ReactNode;\n if (mode === \"sheet\") {\n node = (\n <motion.div\n {...common}\n initial={{ y: reduce || instant ? 0 : \"100%\" }}\n animate={{ y: 0 }}\n transition={reduce || instant ? { duration: 0 } : { duration: 0.24, ease: EASE }}\n style={{ height: `${sheetH}dvh` }}\n className=\"fixed inset-x-0 bottom-0 z-[var(--kit-z-sheet,55)] flex flex-col overflow-hidden rounded-t-kit-xl border-t border-kit-line bg-kit-surface-raised pb-[env(safe-area-inset-bottom)] shadow-kit-sheet-b outline-none\"\n >\n <SheetGrabber height={sheetH} onHeight={setSheetH} onClose={() => escape()} />\n {headerEl}\n {body}\n {sheetFooter ? <div className=\"flex shrink-0 justify-end border-t border-kit-line-subtle px-3 py-2\">{sheetFooter}</div> : null}\n {liveEl}\n </motion.div>\n );\n } else if (mode === \"side\") {\n node = (\n <motion.div\n {...common}\n initial={{ x: reduce || instant ? 0 : \"100%\" }}\n animate={{ x: 0 }}\n transition={reduce || instant ? { duration: 0 } : { duration: 0.22, ease: EASE }}\n style={{ width: PANEL_W, top: NAV }}\n className=\"fixed bottom-0 right-0 z-[var(--kit-z-sheet,55)] flex flex-col border-l border-kit-line bg-kit-surface-raised shadow-kit-sheet-r outline-none\"\n >\n {headerEl}\n {body}\n {liveEl}\n </motion.div>\n );\n } else if (mode === \"modal\") {\n node = (\n <motion.div\n {...common}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={fade}\n style={modalFit === \"dock\" ? { width: PANEL_W, top: 48, right: 0, bottom: 0 } : modalFit === \"overlay\" ? { width: PANEL_W, top: 56, right: 8, bottom: 8 } : { left: 0, right: 0, bottom: 0, height: \"55%\" }}\n className={cn(\n \"absolute z-[20] flex flex-col overflow-hidden bg-kit-surface-raised outline-none\",\n modalFit === \"dock\"\n ? \"border-l border-kit-line\"\n : modalFit === \"overlay\"\n ? \"rounded-kit-xl border border-kit-floating-line shadow-kit-lg\"\n : \"rounded-t-kit-xl border-t border-kit-line shadow-kit-sheet-b\",\n )}\n >\n {headerEl}\n {body}\n {liveEl}\n </motion.div>\n );\n } else {\n node = (\n <>\n <SnapGuides guides={guides} />\n <motion.div\n {...common}\n style={{ x, y, width: w, height: explicitH ? h : undefined, maxHeight: explicitH ? undefined : maxAuto, left: 0, top: 0 }}\n initial={{ opacity: 0, scale: reduce || instant ? 1 : 0.98 }}\n animate={{ opacity: 1, scale: 1 }}\n transition={fade}\n className={cn(\n \"fixed flex flex-col overflow-hidden rounded-kit-xl border bg-kit-surface-raised shadow-kit-xl outline-none\",\n // floating = level 2: --line in light, the stronger hairline in dark (DARK_MODE §5)\n kbd ? \"border-dashed border-[var(--kit-emphasis-line)]\" : \"border-kit-floating-line\",\n Z_FLOAT,\n )}\n >\n <ResizeEdges\n geom={geom}\n bounds={FLOAT_BOUNDS}\n onStart={() => {\n busy.current = true;\n toExplicit();\n }}\n onEnd={(dir) => {\n busy.current = false;\n const moved = dir.includes(\"w\") || dir.includes(\"n\") || !!prefRef.current.pos;\n patch({ w: w.get(), h: h.get(), ...(moved ? { pos: { x: x.get(), y: y.get() } } : {}) });\n }}\n />\n {headerEl}\n {body}\n <ResizeGrip\n geom={geom}\n bounds={FLOAT_BOUNDS}\n label=\"Resize panel\"\n onStart={toExplicit}\n onEnd={() => patch({ w: w.get(), h: h.get(), pos: { x: x.get(), y: y.get() } })}\n />\n {liveEl}\n </motion.div>\n </>\n );\n }\n return createPortal(node, container ?? document.body);\n});\nconst EMPTY: PanelPref = {};\n\n/** Bottom-sheet grabber: drag down to close, up for 90%; a tap toggles 50% ↔ 90%. */\nfunction SheetGrabber({ height, onHeight, onClose }: { height: 50 | 90; onHeight: (h: 50 | 90) => void; onClose: () => void }) {\n const dy = React.useRef(0);\n const dragged = React.useRef(false);\n return (\n <button\n type=\"button\"\n aria-label={height === 50 ? \"Expand panel\" : \"Shrink panel\"}\n onPointerDown={(e) => {\n dy.current = 0;\n dragged.current = false;\n track(\n e,\n (_dx, d) => {\n dy.current = d;\n dragged.current = true;\n },\n (moved) => {\n if (!moved) return;\n if (dy.current > 80) onClose();\n else if (dy.current < -40) onHeight(90);\n else if (dy.current > 40 && height === 90) onHeight(50);\n },\n );\n }}\n onClick={() => {\n if (dragged.current) return void (dragged.current = false);\n onHeight(height === 50 ? 90 : 50);\n }}\n className=\"flex h-5 w-full shrink-0 touch-none items-center justify-center\"\n >\n <span className=\"h-1 w-9 rounded-full bg-kit-line-strong\" />\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAa,MAAM;AACnB,IAAa,OAAO;AACpB,IAAa,OAAO;AACpB,IAAa,UAAU;AACvB,IAAa,OAAO;CAAC;CAAM;CAAM;CAAG;AAAC;AAsBrC,IAAa,YAAoB;CAAE,GAAG,CAAC;CAAG,GAAG,CAAC;AAAE;AAQhD,IAAa,WAAW,OAAO;AAC/B,IAAa,WAAW,OAAO;AAC/B,IAAa,UAAU,GAAW,IAAY,OAAe,KAA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,GAAG,EAAE,IAAI;KAAG,GAAG,EAAE,IAAI;KAAG,KAAK;MAAE,GAAG,EAAE,IAAI;MAAG,GAAG,EAAE,IAAI;KAAE;IAAE,CAAC;GAC/E,CAAA;GACA;EACS;CACZ,CAAA,CAAA,EAAA,CAAA;CAGN,OAAO,aAAa,MAAM,aAAa,SAAS,IAAI;AACtD,CAAC;AACD,IAAM,QAAmB,CAAC;;AAG1B,SAAS,aAAa,EAAE,QAAQ,UAAU,WAAqF;CAC7H,MAAM,KAAK,MAAM,OAAO,CAAC;CACzB,MAAM,UAAU,MAAM,OAAO,KAAK;CAClC,OACE,oBAAC,UAAD;EACE,MAAK;EACL,cAAY,WAAW,KAAK,iBAAiB;EAC7C,gBAAgB,MAAM;GACpB,GAAG,UAAU;GACb,QAAQ,UAAU;GAClB,MACE,IACC,KAAK,MAAM;IACV,GAAG,UAAU;IACb,QAAQ,UAAU;GACpB,IACC,UAAU;IACT,IAAI,CAAC,OAAO;IACZ,IAAI,GAAG,UAAU,IAAI,QAAQ;SACxB,IAAI,GAAG,UAAU,KAAK,SAAS,EAAE;SACjC,IAAI,GAAG,UAAU,MAAM,WAAW,IAAI,SAAS,EAAE;GACxD,CACF;EACF;EACA,eAAe;GACb,IAAI,QAAQ,SAAS,OAAO,MAAM,QAAQ,UAAU;GACpD,SAAS,WAAW,KAAK,KAAK,EAAE;EAClC;EACA,WAAU;EAEV,UAAA,oBAAC,QAAD,EAAM,WAAU,0CAA2C,CAAA;CACrD,CAAA;AAEZ"}
1
+ {"version":3,"file":"floating-panel.js","names":[],"sources":["../../src/ui/floating-panel.tsx"],"sourcesContent":["/**\n * FloatingPanel (CPO D54): ONE primitive for every non-modal window over the work surface. It owns drag, magnetic snap,\n * resize and \"remember where I put it\"; the ⌘J assistant (D30) and the component properties panel both use it.\n *\n * geometry track() · snapRect() · <SnapGuides> · <ResizeEdges> (4 edges + 4 corners) · <ResizeGrip> (keyboard)\n * (the low-level pieces, shared with the assistant's floating window)\n * <FloatingPanel> a small properties window anchored to the thing it edits:\n * float (≥768 with a mouse) docks in the editor column's right gutter (≥356px), else the left gutter, else it\n * overlays the right edge; avoids a floating assistant, the Publish tray and the 56px navbar. While docked\n * it follows the anchor's top (sticky between 72px from the top and 16px from the bottom); once dragged it\n * stays where it was put. 340 × auto (≤560), resizable 300×240 … 520 × (viewport − 96). Header = drag\n * handle; double-click resets it to its docked default. Side, offset and size persist per user and per\n * width bucket (≥1280 · 768–1279).\n * side (768–1279 on touch) a 340px right sheet, no scrim.\n * sheet (<768) a bottom sheet, 50% or 90% tall; drag the grabber down to close.\n * modal inside a D49 ExpandedEditorModal (`container`): docked into the modal's right 340px (the reading column\n * shifts left), or over the modal's edge when it is narrow.\n * Non-modal: `role=\"dialog\"` + `aria-modal=\"false\"`, no focus trap, outside clicks never close it. Esc closes (menus,\n * pickers and field drafts first), F6 moves focus between the panel and `focusBack()`. Marked `data-floating-layer`.\n * Layering: canvas toolbars < panel 52 (= the D30 window) < sheets 55 < dialogs 60 < menus 80 < tooltips 90.\n */\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { motion, useMotionValue, type MotionValue } from \"framer-motion\";\nimport { cn } from \"../lib/cn\";\nimport { eventKey } from \"../lib/key-event\";\nimport { KIT_SCOPE } from \"./surfaces\";\nimport { useKitReducedMotion } from \"../lib/reduced-motion\";\n\n/* ── Geometry (shared with the D30 assistant window) ─────────────────────────────────────────── */\nexport const NAV = 56;\nexport const SNAP = 16;\nexport const EDGE = 16;\nexport const Z_FLOAT = \"z-[var(--kit-z-float,52)]\";\nexport const EASE = [0.32, 0.72, 0, 1] as const;\n\nexport type Rect = { x: number; y: number; w: number; h: number };\n/** Where a window may sit and how big it may get. `top` is the smallest y (under the navbar), `pad` the inset elsewhere. */\nexport interface Bounds {\n minW: number;\n minH: number;\n maxW: () => number;\n maxH: () => number;\n top: number;\n pad: number;\n}\n/** Magnetic lines in viewport px: `v` = x positions (left/right edges snap to them), `h` = y positions. */\nexport interface SnapLines {\n v: number[];\n h: number[];\n}\n/** 1px guide lines to draw (viewport px). */\nexport interface Guides {\n v: number[];\n h: number[];\n}\nexport const NO_GUIDES: Guides = { v: [], h: [] };\nexport interface Geom {\n x: MotionValue<number>;\n y: MotionValue<number>;\n w: MotionValue<number>;\n h: MotionValue<number>;\n}\n\nexport const vw = () => window.innerWidth;\nexport const vh = () => window.innerHeight;\nexport const clampN = (n: number, lo: number, hi: number) => Math.max(lo, Math.min(hi, n));\n\nexport function fitRect(g: Rect, b: Bounds): Rect {\n const w = clampN(g.w, b.minW, Math.max(b.minW, b.maxW()));\n const h = clampN(g.h, b.minH, Math.max(b.minH, b.maxH()));\n return { w, h, x: clampN(g.x, b.pad, Math.max(b.pad, vw() - w - b.pad)), y: clampN(g.y, b.top, Math.max(b.top, vh() - h - b.pad)) };\n}\n\n/** Clamp to the viewport, then pull any edge within SNAP px of a line onto it (the nearest wins). */\nexport function snapRect(x: number, y: number, w: number, h: number, lines: SnapLines, b: Bounds): { x: number; y: number; g: Guides } {\n let nx = clampN(x, b.pad, Math.max(b.pad, vw() - w - b.pad));\n let ny = clampN(y, b.top, Math.max(b.top, vh() - h - b.pad));\n const g: Guides = { v: [], h: [] };\n let best = SNAP + 1;\n let gx: number | null = null;\n let sx = nx;\n for (const L of lines.v) {\n const a = Math.abs(nx - L);\n if (a <= SNAP && a < best) (best = a), (sx = L), (gx = L - 1);\n const z = Math.abs(nx + w - L);\n if (z <= SNAP && z < best) (best = z), (sx = L - w), (gx = L);\n }\n nx = sx;\n if (gx != null) g.v.push(gx);\n best = SNAP + 1;\n let gy: number | null = null;\n let sy = ny;\n for (const L of lines.h) {\n const a = Math.abs(ny - L);\n if (a <= SNAP && a < best) (best = a), (sy = L), (gy = L - 1);\n const z = Math.abs(ny + h - L);\n if (z <= SNAP && z < best) (best = z), (sy = L - h), (gy = L);\n }\n ny = sy;\n if (gy != null) g.h.push(gy);\n return { x: nx, y: ny, g };\n}\n\n/** Runs a pointer drag on window-level listeners (works from any handle, survives leaving the element). */\nexport function track(e: React.PointerEvent, onMove: (dx: number, dy: number) => void, onEnd: (moved: boolean) => void, cursor?: string) {\n const sx = e.clientX;\n const sy = e.clientY;\n let moved = false;\n if (cursor) document.body.style.cursor = cursor;\n document.body.style.userSelect = \"none\";\n const move = (ev: PointerEvent) => {\n const dx = ev.clientX - sx;\n const dy = ev.clientY - sy;\n if (!moved && Math.abs(dx) + Math.abs(dy) < 3) return;\n moved = true;\n onMove(dx, dy);\n };\n const up = () => {\n window.removeEventListener(\"pointermove\", move);\n window.removeEventListener(\"pointerup\", up);\n window.removeEventListener(\"pointercancel\", up);\n document.body.style.cursor = \"\";\n document.body.style.userSelect = \"\";\n onEnd(moved);\n };\n window.addEventListener(\"pointermove\", move);\n window.addEventListener(\"pointerup\", up);\n window.addEventListener(\"pointercancel\", up);\n}\n\n/** Magnetic guides: a 1px hairline along each line the window is snapped to. */\nexport function SnapGuides({ guides }: { guides: Guides }) {\n // --brand (V2): #a878d2, dark #b792db\n const line = cn(\"pointer-events-none fixed bg-[var(--kit-brand)]\", Z_FLOAT);\n return (\n <>\n {guides.v.map((p) => (\n <span key={`v${p}`} aria-hidden className={line} style={{ left: p, top: 8, bottom: 8, width: 1 }} />\n ))}\n {guides.h.map((p) => (\n <span key={`h${p}`} aria-hidden className={line} style={{ top: p, left: 8, right: 8, height: 1 }} />\n ))}\n </>\n );\n}\n\nexport type ResizeDir = \"n\" | \"s\" | \"e\" | \"w\" | \"nw\" | \"ne\" | \"sw\" | \"se\";\nconst HANDLES: { d: ResizeDir; cls: string; cursor: string }[] = [\n { d: \"n\", cls: \"inset-x-3 top-0 h-1.5\", cursor: \"ns-resize\" },\n { d: \"s\", cls: \"inset-x-3 bottom-0 h-1.5\", cursor: \"ns-resize\" },\n { d: \"w\", cls: \"inset-y-3 left-0 w-1.5\", cursor: \"ew-resize\" },\n { d: \"e\", cls: \"inset-y-3 right-0 w-1.5\", cursor: \"ew-resize\" },\n { d: \"nw\", cls: \"left-0 top-0 size-3\", cursor: \"nwse-resize\" },\n { d: \"se\", cls: \"bottom-0 right-0 size-3\", cursor: \"nwse-resize\" },\n { d: \"ne\", cls: \"right-0 top-0 size-3\", cursor: \"nesw-resize\" },\n { d: \"sw\", cls: \"bottom-0 left-0 size-3\", cursor: \"nesw-resize\" },\n];\n\n/** Resize from 4 edges and 4 corners. `onStart` runs before the first read (e.g. turn an auto height into a number). */\nexport function ResizeEdges({ geom, bounds, onStart, onEnd }: { geom: Geom; bounds: Bounds; onStart?: () => void; onEnd: (dir: ResizeDir) => void }) {\n const { x, y, w, h } = geom;\n return (\n <>\n {HANDLES.map((hd) => (\n <div\n key={hd.d}\n aria-hidden\n style={{ cursor: hd.cursor }}\n className={cn(\"absolute z-30 touch-none\", hd.cls)}\n onPointerDown={(e) => {\n if (e.button !== 0) return;\n e.preventDefault();\n e.stopPropagation();\n onStart?.();\n const o = { x: x.get(), y: y.get(), w: w.get(), h: h.get() };\n const maxW = bounds.maxW();\n const maxH = bounds.maxH();\n track(\n e,\n (dx, dy) => {\n let nw = o.w;\n let nh = o.h;\n if (hd.d.includes(\"e\")) nw = o.w + dx;\n if (hd.d.includes(\"w\")) nw = o.w - dx;\n if (hd.d.includes(\"s\")) nh = o.h + dy;\n if (hd.d.includes(\"n\")) nh = o.h - dy;\n nw = clampN(nw, bounds.minW, maxW);\n nh = clampN(nh, bounds.minH, maxH);\n const nx = clampN(hd.d.includes(\"w\") ? o.x + o.w - nw : o.x, bounds.pad, vw() - nw - bounds.pad);\n const ny = clampN(hd.d.includes(\"n\") ? o.y + o.h - nh : o.y, bounds.top, vh() - nh - bounds.pad);\n x.set(nx);\n y.set(ny);\n w.set(nw);\n h.set(nh);\n },\n (moved) => moved && onEnd(hd.d),\n hd.cursor,\n );\n }}\n />\n ))}\n </>\n );\n}\n\n/** Keyboard resize: a focusable grip (role=\"separator\"). ←/→ width, ↑/↓ height (±16, Shift ±64); grows toward the open side. */\nexport function ResizeGrip({ geom, bounds, label, onStart, onEnd, className }: { geom: Geom; bounds: Bounds; label: string; onStart?: () => void; onEnd: () => void; className?: string }) {\n const { x, y, w, h } = geom;\n const [size, setSize] = React.useState(() => ({ w: Math.round(w.get()), h: Math.round(h.get()) }));\n return (\n <div\n role=\"separator\"\n tabIndex={0}\n aria-label={label}\n aria-valuetext={`${size.w} by ${size.h} pixels`}\n aria-keyshortcuts=\"ArrowLeft ArrowRight ArrowUp ArrowDown\"\n onFocus={() => setSize({ w: Math.round(w.get()), h: Math.round(h.get()) })}\n onKeyDown={(e) => {\n const step = e.shiftKey ? 64 : 16;\n const dw = e.key === \"ArrowRight\" ? step : e.key === \"ArrowLeft\" ? -step : 0;\n const dh = e.key === \"ArrowDown\" ? step : e.key === \"ArrowUp\" ? -step : 0;\n if (!dw && !dh) return;\n e.preventDefault();\n e.stopPropagation();\n onStart?.();\n const nw = clampN(w.get() + dw, bounds.minW, bounds.maxW());\n const nh = clampN(h.get() + dh, bounds.minH, bounds.maxH());\n x.set(clampN(x.get(), bounds.pad, Math.max(bounds.pad, vw() - nw - bounds.pad)));\n y.set(clampN(y.get(), bounds.top, Math.max(bounds.top, vh() - nh - bounds.pad)));\n w.set(nw);\n h.set(nh);\n setSize({ w: Math.round(nw), h: Math.round(nh) });\n onEnd();\n }}\n className={cn(\n \"group/kgrip pointer-events-none absolute bottom-0.5 right-0.5 z-40 flex size-4 items-end justify-end rounded-kit-sm outline-none\",\n className,\n )}\n >\n <svg aria-hidden viewBox=\"0 0 10 10\" className=\"size-2.5 text-kit-fg-4 opacity-0 transition-opacity group-focus-visible/kgrip:opacity-100\">\n <path d=\"M9 3 3 9M9 6 6 9\" stroke=\"currentColor\" strokeWidth=\"1.2\" strokeLinecap=\"round\" />\n </svg>\n </div>\n );\n}\n\n/* ── Remembered placement: per user, per panel, per width bucket ─────────────────────────────── */\nexport interface PanelPref {\n side?: \"left\" | \"right\";\n /** set once the person drags it: the panel stays here instead of following its anchor */\n pos?: { x: number; y: number };\n w?: number;\n /** set once the person resizes the height; otherwise the height follows the content */\n h?: number;\n}\ninterface PanelPrefState {\n prefs: Record<string, PanelPref>;\n patch: (key: string, p: Partial<PanelPref> | null) => void;\n}\n/* Remembered per browser in localStorage (the kit carries no state library). A blocked or full storage only loses the\n memory: the panel still docks at its default. */\nconst PREFS_KEY = \"bcms-kit-floating-panel\";\nconst prefListeners = new Set<() => void>();\nfunction readPrefs(): Record<string, PanelPref> {\n try {\n const raw = typeof localStorage === \"undefined\" ? null : localStorage.getItem(PREFS_KEY);\n const parsed = raw ? (JSON.parse(raw) as unknown) : null;\n return parsed && typeof parsed === \"object\" ? (parsed as Record<string, PanelPref>) : {};\n } catch {\n return {};\n }\n}\nconst prefState: PanelPrefState = {\n prefs: readPrefs(),\n patch: (key, p) => {\n const next: PanelPref = p === null ? {} : { ...prefState.prefs[key], ...p };\n for (const k of Object.keys(next) as (keyof PanelPref)[]) if (next[k] === undefined) delete next[k];\n prefState.prefs = { ...prefState.prefs, [key]: next };\n try {\n localStorage.setItem(PREFS_KEY, JSON.stringify(prefState.prefs));\n } catch {\n /* storage blocked: placement is remembered for this session only */\n }\n prefListeners.forEach((l) => l());\n },\n};\nconst subscribePrefs = (l: () => void) => {\n prefListeners.add(l);\n return () => prefListeners.delete(l);\n};\n/** Read the remembered placements with a selector; `useFloatingPanelPrefs.getState()` for imperative reads and writes. */\nexport function useFloatingPanelPrefs<T>(select: (s: PanelPrefState) => T): T {\n return React.useSyncExternalStore(\n subscribePrefs,\n () => select(prefState),\n () => select(prefState),\n );\n}\nuseFloatingPanelPrefs.getState = (): PanelPrefState => prefState;\nexport type WidthBucket = \"wide\" | \"mid\";\nconst bucketNow = (): WidthBucket => (vw() >= 1280 ? \"wide\" : \"mid\");\n\nexport type PanelMode = \"float\" | \"side\" | \"sheet\" | \"modal\";\nfunction useMedia(q: string) {\n const [ok, setOk] = React.useState(() => typeof window !== \"undefined\" && window.matchMedia(q).matches);\n React.useEffect(() => {\n const m = window.matchMedia(q);\n const on = () => setOk(m.matches);\n on();\n m.addEventListener(\"change\", on);\n return () => m.removeEventListener(\"change\", on);\n }, [q]);\n return ok;\n}\n/** How a panel presents at this width and pointer: float · side (tablet touch) · sheet (phones) · modal (inside a D49 modal). */\nexport function usePanelMode(inModal?: boolean): PanelMode {\n const phone = useMedia(\"(max-width: 767px)\");\n const touchTablet = useMedia(\"(max-width: 1279px) and (pointer: coarse)\");\n if (inModal) return \"modal\";\n return phone ? \"sheet\" : touchTablet ? \"side\" : \"float\";\n}\n\n/* ── helpers ──────────────────────────────────────────────────────────────────────────────────── */\nfunction scrollParent(el: HTMLElement | null): HTMLElement | null {\n let p = el?.parentElement ?? null;\n while (p && p !== document.body && p !== document.documentElement) {\n const o = getComputedStyle(p).overflowY;\n if ((o === \"auto\" || o === \"scroll\") && p.scrollHeight > p.clientHeight) return p;\n p = p.parentElement;\n }\n return null;\n}\n/** Things a panel never covers by default: a floating or docked assistant, anything marked `data-floating-avoid`. */\nconst AVOID = \"#assistant-panel, [data-floating-avoid]\";\n/** Right-side panels of the page (the editor's Publishing · History · Comments): the panel takes the other side. */\nconst SIDE_PANELS = \"[data-doc-settings], [data-side-panel]\";\n/** A menu, picker, popover or another dialog is open: it takes Esc first. */\n/** An open Base UI popup (popover, menu, select, combobox): it carries data-open and data-side. Kit tooltips don't count. */\nconst POPUP_OPEN = \"[data-open][data-side]:not([data-kit-tooltip])\";\n/** A tooltip (the kit's, or the host's `data-slot=\"tooltip-content\"`), its positioner or arrow: a hint left open never takes Esc. */\nconst TOOLTIP = \"[data-kit-tooltip], [data-slot=tooltip-content]\";\nconst isTooltip = (n: Element) => !!n.closest(TOOLTIP) || !!n.querySelector(TOOLTIP);\nconst OWNS_ESCAPE = `[role=menu],[role=listbox],[data-cell-editing],${POPUP_OPEN}`;\nfunction layerOpen(self: HTMLElement | null) {\n // a popover, menu or select (tooltips don't count), a cell with a draft\n if (document.querySelector(\"[data-cell-editing]\") || Array.from(document.querySelectorAll(POPUP_OPEN)).some((n) => !isTooltip(n))) return true;\n // a floating menu or picker (the slash menu); page-level listboxes (a sidebar list) don't count\n const floating = (n: HTMLElement) => n.getAttribute(\"role\") === \"menu\" || !!n.closest(\"[data-floating-layer]:not([data-floating-panel])\");\n if (Array.from(document.querySelectorAll<HTMLElement>(\"[role=menu], [role=listbox]\")).some((n) => n.getClientRects().length && floating(n))) return true;\n return Array.from(document.querySelectorAll<HTMLElement>(\"[role=dialog]:is([data-open],[data-state=open])\")).some(\n (d) => d !== self && !d.hasAttribute(\"data-expanded-editor\") && !d.hasAttribute(\"data-floating-panel\") && d.id !== \"assistant-panel\" && !d.hasAttribute(\"data-doc-panel\"),\n );\n}\nconst FOCUSABLE = \"input:not([type=hidden]):not([disabled]), textarea:not([disabled]), [contenteditable=true], select:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex='-1'])\";\n\n/** Events from the panel never reach the React tree it was rendered from (the card, the editor around it). */\nconst stop = (e: React.SyntheticEvent) => e.stopPropagation();\nconst FENCE = {\n onFocus: stop, onBlur: stop, onClick: stop, onDoubleClick: stop, onMouseDown: stop, onMouseUp: stop, onMouseMove: stop,\n onInput: stop, onPaste: stop, onCut: stop, onCopy: stop, onKeyUp: stop, onContextMenu: stop,\n} as const;\n\n/* ── The panel ────────────────────────────────────────────────────────────────────────────────── */\nexport const PANEL_W = 340;\nconst PANEL_MAX_AUTO_H = 560;\nconst TOP_LIMIT = 72;\nconst BOTTOM_GAP = 16;\nconst FLOAT_BOUNDS: Bounds = { minW: 300, minH: 240, maxW: () => Math.min(520, vw() - 32), maxH: () => vh() - 96, top: NAV + 4, pad: 8 };\n\nexport interface FloatingPanelHandle {\n dock: (side: \"left\" | \"right\") => void;\n /** back to the docked default (position and size) */\n reset: () => void;\n /** keyboard move / resize: arrows ±16 (Shift ±64), Enter commits, Esc cancels */\n keyboard: (mode: \"move\" | \"resize\") => void;\n /** a polite announcement from the panel's own live region */\n announce: (text: string) => void;\n el: () => HTMLElement | null;\n}\nexport interface FloatingPanelProps {\n /** remembered placement key (one per kind of panel) */\n id: string;\n /** id of the element that names the panel (the header title) */\n labelledBy: string;\n /** the thing it edits: the panel follows it and docks beside its column (`[data-rt-editor]`) */\n anchor: HTMLElement | null;\n /** render inside this element instead of <body> (the D49 modal) */\n container?: HTMLElement | null;\n header: React.ReactNode;\n children: React.ReactNode;\n /** bottom-sheet footer (Done) */\n sheetFooter?: React.ReactNode;\n onClose: () => void;\n /** F6 / Esc: where focus goes back to (the card) */\n focusBack?: () => void;\n /** a refill (another component picked while open): no entrance animation */\n instant?: boolean;\n bodyClassName?: string;\n /** keys anywhere in the panel, before its own handling (⌘Z joins the host's undo) */\n onPanelKeyDown?: (e: KeyboardEvent) => void;\n}\n\nexport const FloatingPanel = React.forwardRef<FloatingPanelHandle, FloatingPanelProps>(function FloatingPanel(\n { id, labelledBy, anchor, container, header, children, sheetFooter, onClose, focusBack, instant, bodyClassName, onPanelKeyDown },\n handle,\n) {\n const reduce = useKitReducedMotion();\n const mode = usePanelMode(!!container);\n const root = React.useRef<HTMLDivElement>(null);\n const live = React.useRef<HTMLDivElement>(null);\n const [bucket, setBucket] = React.useState<WidthBucket>(bucketNow);\n const key = `${id}:${bucket}`;\n const pref = useFloatingPanelPrefs((s) => s.prefs[key]) ?? EMPTY;\n const patch = (p: Partial<PanelPref> | null) => {\n useFloatingPanelPrefs.getState().patch(key, p);\n // layout may run before React re-renders with the new prefs\n prefRef.current = useFloatingPanelPrefs.getState().prefs[key] ?? EMPTY;\n };\n const x = useMotionValue(-9999);\n const y = useMotionValue(-9999);\n const w = useMotionValue(pref.w ?? PANEL_W);\n const h = useMotionValue(pref.h ?? 0);\n const geom = React.useMemo<Geom>(() => ({ x, y, w, h }), [x, y, w, h]);\n const [explicitH, setExplicitH] = React.useState(!!pref.h);\n const [maxAuto, setMaxAuto] = React.useState(PANEL_MAX_AUTO_H);\n const [guides, setGuides] = React.useState<Guides>(NO_GUIDES);\n const [kbd, setKbd] = React.useState<null | { mode: \"move\" | \"resize\"; start: Rect; explicit: boolean }>(null);\n const [sheetH, setSheetH] = React.useState<50 | 90>(50);\n const busy = React.useRef(false); // dragging / resizing: layout pauses\n const prefRef = React.useRef(pref);\n prefRef.current = pref;\n const kbdRef = React.useRef(kbd);\n kbdRef.current = kbd;\n const closeRef = React.useRef(onClose);\n closeRef.current = onClose;\n const backRef = React.useRef(focusBack);\n backRef.current = focusBack;\n\n // a new width bucket brings its own remembered placement\n React.useEffect(() => {\n const on = () => setBucket(bucketNow());\n window.addEventListener(\"resize\", on);\n return () => window.removeEventListener(\"resize\", on);\n }, []);\n React.useEffect(() => {\n w.set(pref.w ?? PANEL_W);\n setExplicitH(!!pref.h);\n if (pref.h) h.set(pref.h);\n }, [key]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const column = React.useCallback(() => (anchor?.closest<HTMLElement>(\"[data-rt-editor]\") ?? anchor)?.getBoundingClientRect() ?? null, [anchor]);\n\n /** Where the panel sits now (float mode): its remembered spot, or docked beside the column, following the anchor. */\n const layout = React.useCallback(() => {\n const el = root.current;\n if (!el || !anchor || mode !== \"float\" || busy.current || kbdRef.current) return;\n const p = prefRef.current;\n const sc = scrollParent(anchor)?.getBoundingClientRect();\n const top = Math.max(TOP_LIMIT, (sc?.top ?? 0) + 8);\n let bottom = vh() - BOTTOM_GAP;\n const tray = document.querySelector<HTMLElement>(\"[data-action-tray]\")?.getBoundingClientRect();\n if (tray && tray.height && tray.top > top + 240) bottom = Math.min(bottom, tray.top - 8);\n if (sc && sc.bottom > top + 240) bottom = Math.min(bottom, sc.bottom - 8);\n const room = Math.max(FLOAT_BOUNDS.minH, bottom - top);\n const nextMax = Math.min(PANEL_MAX_AUTO_H, room);\n setMaxAuto((m) => (m === nextMax ? m : nextMax));\n const ww = w.get();\n const ph = Math.min(el.offsetHeight || 320, room);\n if (p.pos) {\n x.set(clampN(p.pos.x, 8, Math.max(8, vw() - ww - 8)));\n y.set(clampN(p.pos.y, NAV + 4, Math.max(NAV + 4, vh() - ph - 8)));\n return;\n }\n const col = column();\n const a = anchor.getBoundingClientRect();\n if (!col) return;\n let L = Math.max(8, sc?.left ?? 0);\n let R = Math.min(vw() - 8, sc?.right ?? vw());\n for (const o of Array.from(document.querySelectorAll<HTMLElement>(AVOID))) {\n if (o === el || el.contains(o)) continue;\n const r = o.getBoundingClientRect();\n if (!r.width || !r.height || r.bottom < top || r.top > bottom) continue;\n if (r.left + r.width / 2 < col.left + col.width / 2) L = Math.max(L, r.right);\n else R = Math.min(R, r.left);\n }\n const need = ww + 16;\n const fits = { right: R - col.right >= need, left: col.left - L >= need };\n // an open right-side panel (Publishing · History · Comments) sends it to the other side\n const rightBusy = Array.from(document.querySelectorAll<HTMLElement>(SIDE_PANELS)).some((n) => n.getBoundingClientRect().width > 40);\n const side = p.side ?? (rightBusy ? \"left\" : fits.right ? \"right\" : fits.left ? \"left\" : \"right\");\n const nx = side === \"right\" ? (fits.right ? col.right + 16 : R - ww - 8) : fits.left ? col.left - 16 - ww : L + 8;\n x.set(clampN(nx, 8, Math.max(8, vw() - ww - 8)));\n y.set(clampN(a.top, top, Math.max(top, bottom - ph)));\n }, [anchor, mode, column, w, x, y]);\n\n React.useLayoutEffect(() => {\n layout();\n }, [layout, pref.pos, pref.side, pref.w, explicitH]);\n React.useEffect(() => {\n if (mode !== \"float\") return;\n let raf = 0;\n let settle = 0;\n const on = () => {\n cancelAnimationFrame(raf);\n raf = requestAnimationFrame(layout);\n // once more after things stop moving (a side panel's exit animation ends after the last resize)\n window.clearTimeout(settle);\n settle = window.setTimeout(layout, 320);\n };\n window.addEventListener(\"scroll\", on, true);\n window.addEventListener(\"resize\", on);\n // something it avoids may have moved (the assistant window dropped somewhere else)\n window.addEventListener(\"pointerup\", on);\n const ro = new ResizeObserver(on);\n if (root.current) ro.observe(root.current);\n if (anchor) ro.observe(anchor);\n // the work surface narrowing (a side panel opening) moves the column without resizing the anchor\n const sc = scrollParent(anchor);\n if (sc) ro.observe(sc);\n return () => {\n cancelAnimationFrame(raf);\n window.clearTimeout(settle);\n window.removeEventListener(\"scroll\", on, true);\n window.removeEventListener(\"resize\", on);\n window.removeEventListener(\"pointerup\", on);\n ro.disconnect();\n };\n }, [mode, layout, anchor]);\n\n // modal: dock into the modal's right 340px (the reading column shifts left), or overlay its edge when narrow\n const [modalFit, setModalFit] = React.useState<\"dock\" | \"overlay\" | \"bottom\">(\"dock\");\n React.useLayoutEffect(() => {\n if (mode !== \"modal\" || !container) return;\n const fit = () => {\n const cw = container.clientWidth;\n const next = cw < 560 ? \"bottom\" : cw >= PANEL_W + 680 ? \"dock\" : \"overlay\";\n setModalFit(next);\n if (next === \"dock\") container.setAttribute(\"data-floating-dock\", \"right\");\n else container.removeAttribute(\"data-floating-dock\");\n };\n fit();\n const ro = new ResizeObserver(fit);\n ro.observe(container);\n return () => {\n ro.disconnect();\n container.removeAttribute(\"data-floating-dock\");\n };\n }, [mode, container]);\n\n const toExplicit = () => {\n if (explicitH || !root.current) return;\n h.set(root.current.offsetHeight);\n setExplicitH(true);\n };\n const say = (text: string) => {\n const el = live.current;\n if (!el) return;\n el.textContent = \"\";\n window.setTimeout(() => {\n if (live.current) live.current.textContent = text;\n }, 60);\n };\n\n const reset = () => {\n patch(null);\n setExplicitH(false);\n w.set(PANEL_W);\n };\n React.useImperativeHandle(handle, () => ({\n dock: (side) => patch({ side, pos: undefined }),\n reset,\n keyboard: (m) => {\n if (mode !== \"float\") return;\n if (m === \"resize\") toExplicit();\n setKbd({ mode: m, start: { x: x.get(), y: y.get(), w: w.get(), h: root.current?.offsetHeight ?? h.get() }, explicit: explicitH });\n // after the ⋯ menu has handed focus back to its trigger\n window.setTimeout(() => root.current?.focus({ preventScroll: true }), 80);\n say(m === \"move\" ? \"Moving the panel. Arrow keys move it, Enter keeps it there, Escape cancels.\" : \"Resizing the panel. Arrow keys resize it, Enter keeps the size, Escape cancels.\");\n },\n announce: say,\n el: () => root.current,\n }));\n\n /** Esc: keyboard mode cancels first, then the panel closes and focus goes back to the card. */\n const escape = React.useCallback(() => {\n const k = kbdRef.current;\n if (k) {\n x.set(k.start.x);\n y.set(k.start.y);\n w.set(k.start.w);\n if (!k.explicit) setExplicitH(false);\n else h.set(k.start.h);\n setKbd(null);\n say(\"Cancelled\");\n return;\n }\n closeRef.current();\n backRef.current?.();\n }, [x, y, w, h]);\n\n // Esc / F6 from OUTSIDE the panel (the text, the page); the modal forwards its Esc through \"floatingpanel:escape\"\n React.useEffect(() => {\n const el = root.current;\n const onKey = (e: KeyboardEvent) => {\n if (el?.contains(e.target as Node)) return;\n if (e.key === \"F6\") {\n e.preventDefault();\n const f = Array.from(el?.querySelectorAll<HTMLElement>(`[data-panel-body] :is(${FOCUSABLE})`) ?? []).find((n) => n.getClientRects().length) ?? el;\n f?.focus({ preventScroll: true });\n return;\n }\n if (e.key !== \"Escape\" || e.defaultPrevented || layerOpen(el)) return;\n if (!container && document.querySelector(\"[data-expanded-editor]\")) return; // a D49 modal over us owns Esc\n e.preventDefault();\n escape();\n };\n const onForward = () => escape();\n window.addEventListener(\"keydown\", onKey);\n el?.addEventListener(\"floatingpanel:escape\", onForward);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n el?.removeEventListener(\"floatingpanel:escape\", onForward);\n };\n }, [container, escape]);\n\n // Keys inside the panel\n /* Keys inside the panel run on a NATIVE listener on the panel itself: it sees them first, wherever the panel is\n portalled (inside a modal, React's own listeners sit on other containers). */\n const keyRef = React.useRef<(e: KeyboardEvent) => void>(() => {});\n keyRef.current = (e: KeyboardEvent) => {\n const native = e as KeyboardEvent & { bcmsPanelHandled?: boolean };\n onPanelKeyDown?.(e);\n const k = kbdRef.current;\n if (k) {\n const step = e.shiftKey ? 64 : 16;\n const dx = e.key === \"ArrowRight\" ? step : e.key === \"ArrowLeft\" ? -step : 0;\n const dy = e.key === \"ArrowDown\" ? step : e.key === \"ArrowUp\" ? -step : 0;\n if (dx || dy) {\n e.preventDefault();\n if (k.mode === \"move\") {\n x.set(clampN(x.get() + dx, 8, vw() - w.get() - 8));\n y.set(clampN(y.get() + dy, NAV + 4, vh() - h.get() - 8));\n } else {\n w.set(clampN(w.get() + dx, FLOAT_BOUNDS.minW, FLOAT_BOUNDS.maxW()));\n h.set(clampN(h.get() + dy, FLOAT_BOUNDS.minH, FLOAT_BOUNDS.maxH()));\n x.set(clampN(x.get(), 8, vw() - w.get() - 8));\n }\n return;\n }\n if (e.key === \"Enter\") {\n e.preventDefault();\n patch(k.mode === \"move\" ? { pos: { x: x.get(), y: y.get() } } : { w: w.get(), h: h.get(), pos: { x: x.get(), y: y.get() } });\n setKbd(null);\n say(k.mode === \"move\" ? \"Panel moved\" : \"Panel resized\");\n return;\n }\n }\n if (e.key === \"F6\") {\n e.preventDefault();\n backRef.current?.();\n } else if (e.key === \"Escape\" && !native.bcmsPanelHandled && !(e.target as HTMLElement).closest?.(OWNS_ESCAPE) && !layerOpen(root.current)) {\n e.preventDefault();\n native.bcmsPanelHandled = true;\n escape();\n }\n };\n React.useEffect(() => {\n const el = root.current;\n if (!el) return;\n const on = (e: KeyboardEvent) => keyRef.current(e);\n el.addEventListener(\"keydown\", on);\n return () => el.removeEventListener(\"keydown\", on);\n }, [mode]);\n // keep keys away from the card / editor this panel was rendered from (modified keys still reach app shortcuts)\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (!(e.metaKey || e.ctrlKey) || eventKey(e) === \"z\") e.stopPropagation();\n };\n\n const onHeaderDown = (e: React.PointerEvent) => {\n if (mode !== \"float\" || e.button !== 0 || (e.target as HTMLElement).closest(\"button, a, input, textarea, [role=menuitem], [contenteditable]\")) return;\n e.preventDefault();\n const ox = x.get();\n const oy = y.get();\n const ww = w.get();\n const hh = root.current?.offsetHeight ?? h.get();\n const col = column();\n const lines: SnapLines = { v: [EDGE, vw() - EDGE, ...(col ? [col.left, col.right] : [])], h: [TOP_LIMIT, vh() - EDGE] };\n busy.current = true;\n track(\n e,\n (dx, dy) => {\n const r = snapRect(ox + dx, oy + dy, ww, hh, lines, FLOAT_BOUNDS);\n x.set(r.x);\n y.set(r.y);\n setGuides((g) => (g.v.join() === r.g.v.join() && g.h.join() === r.g.h.join() ? g : r.g));\n },\n (moved) => {\n busy.current = false;\n setGuides(NO_GUIDES);\n if (moved) patch({ pos: { x: x.get(), y: y.get() } });\n },\n \"grabbing\",\n );\n };\n\n const headerEl = (\n <div\n data-panel-header=\"\"\n onPointerDown={onHeaderDown}\n onDoubleClick={(e) => {\n if (mode !== \"float\" || (e.target as HTMLElement).closest(\"button, a, input, [role=menuitem]\")) return;\n reset();\n }}\n className={cn(\"flex h-10 shrink-0 items-center gap-1 border-b border-kit-line-subtle pl-3 pr-1.5\", mode === \"float\" && \"cursor-grab touch-none select-none active:cursor-grabbing\")}\n >\n {header}\n </div>\n );\n const body = (\n <div data-panel-body=\"\" className={cn(\"min-h-0 flex-1 overflow-y-auto overscroll-contain\", bodyClassName)}>\n {children}\n </div>\n );\n const liveEl = <div ref={live} aria-live=\"polite\" className=\"sr-only\" />;\n const common = {\n ref: root,\n role: \"dialog\",\n \"aria-modal\": false as const,\n \"aria-labelledby\": labelledBy,\n tabIndex: -1,\n ...KIT_SCOPE,\n \"data-floating-layer\": \"\",\n \"data-floating-panel\": \"\",\n \"data-state\": \"open\",\n \"data-kbd\": kbd ? kbd.mode : undefined,\n onKeyDown,\n ...FENCE,\n };\n const fade = reduce || instant ? { duration: 0 } : { duration: 0.16, ease: EASE };\n\n let node: React.ReactNode;\n if (mode === \"sheet\") {\n node = (\n <motion.div\n {...common}\n initial={{ y: reduce || instant ? 0 : \"100%\" }}\n animate={{ y: 0 }}\n transition={reduce || instant ? { duration: 0 } : { duration: 0.24, ease: EASE }}\n style={{ height: `${sheetH}dvh` }}\n className=\"fixed inset-x-0 bottom-0 z-[var(--kit-z-sheet,55)] flex flex-col overflow-hidden rounded-t-kit-xl border-t border-kit-line bg-kit-surface-raised pb-[env(safe-area-inset-bottom)] shadow-kit-sheet-b outline-none\"\n >\n <SheetGrabber height={sheetH} onHeight={setSheetH} onClose={() => escape()} />\n {headerEl}\n {body}\n {sheetFooter ? <div className=\"flex shrink-0 justify-end border-t border-kit-line-subtle px-3 py-2\">{sheetFooter}</div> : null}\n {liveEl}\n </motion.div>\n );\n } else if (mode === \"side\") {\n node = (\n <motion.div\n {...common}\n initial={{ x: reduce || instant ? 0 : \"100%\" }}\n animate={{ x: 0 }}\n transition={reduce || instant ? { duration: 0 } : { duration: 0.22, ease: EASE }}\n style={{ width: PANEL_W, top: NAV }}\n className=\"fixed bottom-0 right-0 z-[var(--kit-z-sheet,55)] flex flex-col border-l border-kit-line bg-kit-surface-raised shadow-kit-sheet-r outline-none\"\n >\n {headerEl}\n {body}\n {liveEl}\n </motion.div>\n );\n } else if (mode === \"modal\") {\n node = (\n <motion.div\n {...common}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={fade}\n style={modalFit === \"dock\" ? { width: PANEL_W, top: 48, right: 0, bottom: 0 } : modalFit === \"overlay\" ? { width: PANEL_W, top: 56, right: 8, bottom: 8 } : { left: 0, right: 0, bottom: 0, height: \"55%\" }}\n className={cn(\n \"absolute z-[20] flex flex-col overflow-hidden bg-kit-surface-raised outline-none\",\n modalFit === \"dock\"\n ? \"border-l border-kit-line\"\n : modalFit === \"overlay\"\n ? \"rounded-kit-xl border border-kit-floating-line shadow-kit-lg\"\n : \"rounded-t-kit-xl border-t border-kit-line shadow-kit-sheet-b\",\n )}\n >\n {headerEl}\n {body}\n {liveEl}\n </motion.div>\n );\n } else {\n node = (\n <>\n <SnapGuides guides={guides} />\n <motion.div\n {...common}\n style={{ x, y, width: w, height: explicitH ? h : undefined, maxHeight: explicitH ? undefined : maxAuto, left: 0, top: 0 }}\n initial={{ opacity: 0, scale: reduce || instant ? 1 : 0.98 }}\n animate={{ opacity: 1, scale: 1 }}\n transition={fade}\n className={cn(\n \"fixed flex flex-col overflow-hidden rounded-kit-xl border bg-kit-surface-raised shadow-kit-xl outline-none\",\n // floating = level 2: --line in light, the stronger hairline in dark (DARK_MODE §5)\n kbd ? \"border-dashed border-[var(--kit-emphasis-line)]\" : \"border-kit-floating-line\",\n Z_FLOAT,\n )}\n >\n <ResizeEdges\n geom={geom}\n bounds={FLOAT_BOUNDS}\n onStart={() => {\n busy.current = true;\n toExplicit();\n }}\n onEnd={(dir) => {\n busy.current = false;\n const moved = dir.includes(\"w\") || dir.includes(\"n\") || !!prefRef.current.pos;\n patch({ w: w.get(), h: h.get(), ...(moved ? { pos: { x: x.get(), y: y.get() } } : {}) });\n }}\n />\n {headerEl}\n {body}\n <ResizeGrip\n geom={geom}\n bounds={FLOAT_BOUNDS}\n label=\"Resize panel\"\n onStart={toExplicit}\n onEnd={() => patch({ w: w.get(), h: h.get(), pos: { x: x.get(), y: y.get() } })}\n />\n {liveEl}\n </motion.div>\n </>\n );\n }\n return createPortal(node, container ?? document.body);\n});\nconst EMPTY: PanelPref = {};\n\n/** Bottom-sheet grabber: drag down to close, up for 90%; a tap toggles 50% ↔ 90%. */\nfunction SheetGrabber({ height, onHeight, onClose }: { height: 50 | 90; onHeight: (h: 50 | 90) => void; onClose: () => void }) {\n const dy = React.useRef(0);\n const dragged = React.useRef(false);\n return (\n <button\n type=\"button\"\n aria-label={height === 50 ? \"Expand panel\" : \"Shrink panel\"}\n onPointerDown={(e) => {\n dy.current = 0;\n dragged.current = false;\n track(\n e,\n (_dx, d) => {\n dy.current = d;\n dragged.current = true;\n },\n (moved) => {\n if (!moved) return;\n if (dy.current > 80) onClose();\n else if (dy.current < -40) onHeight(90);\n else if (dy.current > 40 && height === 90) onHeight(50);\n },\n );\n }}\n onClick={() => {\n if (dragged.current) return void (dragged.current = false);\n onHeight(height === 50 ? 90 : 50);\n }}\n className=\"flex h-5 w-full shrink-0 touch-none items-center justify-center\"\n >\n <span className=\"h-1 w-9 rounded-full bg-kit-line-strong\" />\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,MAAM;AACnB,IAAa,OAAO;AACpB,IAAa,OAAO;AACpB,IAAa,UAAU;AACvB,I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KAAK;OAAE,GAAG,EAAE,IAAI;OAAG,GAAG,EAAE,IAAI;MAAE,EAAE,IAAI,CAAC;KAAG,CAAC;IACzF;GACD,CAAA;GACA;GACA;GACD,oBAAC,YAAD;IACQ;IACN,QAAQ;IACR,OAAM;IACN,SAAS;IACT,aAAa,MAAM;KAAE,GAAG,EAAE,IAAI;KAAG,GAAG,EAAE,IAAI;KAAG,KAAK;MAAE,GAAG,EAAE,IAAI;MAAG,GAAG,EAAE,IAAI;KAAE;IAAE,CAAC;GAC/E,CAAA;GACA;EACS;CACZ,CAAA,CAAA,EAAA,CAAA;CAGN,OAAO,aAAa,MAAM,aAAa,SAAS,IAAI;AACtD,CAAC;AACD,IAAM,QAAmB,CAAC;;AAG1B,SAAS,aAAa,EAAE,QAAQ,UAAU,WAAqF;CAC7H,MAAM,KAAK,MAAM,OAAO,CAAC;CACzB,MAAM,UAAU,MAAM,OAAO,KAAK;CAClC,OACE,oBAAC,UAAD;EACE,MAAK;EACL,cAAY,WAAW,KAAK,iBAAiB;EAC7C,gBAAgB,MAAM;GACpB,GAAG,UAAU;GACb,QAAQ,UAAU;GAClB,MACE,IACC,KAAK,MAAM;IACV,GAAG,UAAU;IACb,QAAQ,UAAU;GACpB,IACC,UAAU;IACT,IAAI,CAAC,OAAO;IACZ,IAAI,GAAG,UAAU,IAAI,QAAQ;SACxB,IAAI,GAAG,UAAU,KAAK,SAAS,EAAE;SACjC,IAAI,GAAG,UAAU,MAAM,WAAW,IAAI,SAAS,EAAE;GACxD,CACF;EACF;EACA,eAAe;GACb,IAAI,QAAQ,SAAS,OAAO,MAAM,QAAQ,UAAU;GACpD,SAAS,WAAW,KAAK,KAAK,EAAE;EAClC;EACA,WAAU;EAEV,UAAA,oBAAC,QAAD,EAAM,WAAU,0CAA2C,CAAA;CACrD,CAAA;AAEZ"}
@@ -1,7 +1,8 @@
1
1
  import { cn } from "../lib/cn.js";
2
+ import { useKitReducedMotion } from "../lib/reduced-motion.js";
2
3
  import * as React from "react";
3
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- import { motion, useReducedMotion } from "framer-motion";
5
+ import { motion } from "framer-motion";
5
6
  import { createPortal } from "react-dom";
6
7
  //#region src/ui/foundations.tsx
7
8
  /**
@@ -327,7 +328,7 @@ function SaveStatus({ state, onRetry, savedTitle, className }) {
327
328
  */
328
329
  function InspectorPopover({ anchor, onClose, width = 300, align = "left", label, className, children }) {
329
330
  const ref = React.useRef(null);
330
- const reduce = useReducedMotion();
331
+ const reduce = useKitReducedMotion();
331
332
  const [pos, setPos] = React.useState({
332
333
  left: -9999,
333
334
  top: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"foundations.js","names":[],"sources":["../../src/ui/foundations.tsx"],"sourcesContent":["/**\n * FOUNDATIONS · V1.6 (prototype editor-v16 `Btn`, `Checkbox`, `StatusIcon`, `Badge`, `ProBadge`, `TextField`, `Popover`,\n * `ButtonStylePicker`, `SearchClear`, save status; kit.jsx:9-43, 255-296; ui.jsx:332-345, 393-398; foundations.css;\n * kit.css:112-131; shellx.css:2-16, 199-204; faq.css:99-101).\n *\n * New names, so nothing of the stock kit changes: the kit's own `Button`, `Checkbox`, `Badge` and `Input` stay as they\n * are. Colours are `--kit-insp-*` tokens (tokens.css). Every part is presentational: the host owns the state.\n *\n * <FoundationButton variant size icon> primary (ink) or secondary (grey), 28 / 32 / 34 high\n * <FoundationCheckbox on mixed onChange label> 16, radius 4, violet when on, a dash when mixed\n * <StatusIcon kind size> a 10% tint disc with a tick or an exclamation mark\n * <FoundationBadge tone dot size> 20 (24) high tag with a 5 tone dot\n * <ProBadge /> <BcmsMark size /> the white \"PRO\" pill with the gradient mark\n * <FoundationTextField icon error /> 34 high grey field, violet focus ring, red edge on error\n * <SearchClear show onClear /> the 16 round × that fades in when a search field has text\n * <SaveStatus state onRetry /> Saved · Saving… · Couldn’t save · Retry · Offline\n * <InspectorPopover anchor onClose label> anchored panel: 6 under the anchor, flips above, 8 from the edges\n * <ButtonStylePicker anchor value onPick> \"Button style\": five radio rows with a live button preview\n */\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { motion, useReducedMotion } from \"framer-motion\";\nimport { cn } from \"../lib/cn\";\n\nconst FOCUS_HALO = \"focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--kit-insp-accent)_30%,transparent)]\";\n\n/* ── Button (F1569) ───────────────────────────────────────────────── */\nexport interface FoundationButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: \"primary\" | \"secondary\";\n /** sm 28 · md 32 (default) · lg 34, beside a 34 high field */\n size?: \"sm\" | \"md\" | \"lg\";\n icon?: React.ReactNode;\n}\nexport const FoundationButton = React.forwardRef<HTMLButtonElement, FoundationButtonProps>(function FoundationButton(\n { variant = \"primary\", size = \"md\", icon, className, children, type = \"button\", ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type}\n data-slot=\"kit-fbtn\"\n className={cn(\n \"inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap rounded-[6px] font-medium outline-none transition-[background-color,color,opacity] duration-150\",\n size === \"sm\" ? \"h-7 px-2.5 text-[12px]\" : size === \"lg\" ? \"h-[34px] px-3.5 text-[13px]\" : \"h-8 px-3 text-[13px]\",\n variant === \"primary\"\n ? \"bg-kit-insp-tip-title text-kit-insp-tip-bg enabled:hover:bg-kit-insp-ink disabled:opacity-35\"\n : \"bg-kit-insp-card text-kit-insp-tip-title enabled:hover:bg-kit-insp-divider disabled:text-kit-insp-faint\",\n FOCUS_HALO,\n className,\n )}\n {...rest}\n >\n {icon}\n {children}\n </button>\n );\n});\n\n/* ── Checkbox (F1570) ─────────────────────────────────────────────── */\nexport function FoundationCheckbox({\n on, mixed, disabled, onChange, label, className, \"aria-labelledby\": labelledBy,\n}: { on?: boolean; mixed?: boolean; disabled?: boolean; onChange?: (on: boolean) => void; label?: string; className?: string; \"aria-labelledby\"?: string }) {\n const filled = !!on || !!mixed;\n return (\n <button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={mixed ? \"mixed\" : !!on}\n aria-label={label}\n aria-labelledby={labelledBy}\n disabled={disabled}\n data-slot=\"kit-fcb\"\n onClick={(e) => {\n e.stopPropagation();\n onChange?.(!on);\n }}\n className={cn(\n \"grid size-4 shrink-0 place-items-center rounded-[4px] outline-none transition-[background-color,box-shadow] duration-150 disabled:cursor-not-allowed disabled:opacity-40\",\n filled\n ? \"bg-kit-insp-accent-fg focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--kit-insp-accent-fg)_20%,transparent)]\"\n : \"bg-kit-insp-tip-bg shadow-[inset_0_0_0_1.5px_var(--kit-insp-line-strong)] focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--kit-insp-accent-fg)_20%,transparent),inset_0_0_0_1.5px_var(--kit-insp-line-strong)]\",\n className,\n )}\n >\n {filled ? (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden>\n {mixed ? <path d=\"M4.5 8h7\" stroke=\"#fff\" strokeWidth=\"1.8\" strokeLinecap=\"round\" /> : <path d=\"M3.6 8.3l2.7 2.7l6-6.2\" stroke=\"#fff\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />}\n </svg>\n ) : null}\n </button>\n );\n}\n\n/* ── Status icon (F1571) ──────────────────────────────────────────── */\nexport function StatusIcon({ kind = \"success\", size = 14, className }: { kind?: \"success\" | \"error\"; size?: number; className?: string }) {\n const tint = kind === \"success\" ? \"var(--kit-insp-ok-tint)\" : \"var(--kit-insp-err-tint)\";\n const ink = kind === \"success\" ? \"var(--kit-insp-ok)\" : \"var(--kit-insp-err)\";\n return (\n <svg width={size} height={size} viewBox=\"0 0 14 14\" fill=\"none\" aria-hidden className={cn(\"shrink-0\", className)}>\n <circle cx=\"7\" cy=\"7\" r=\"7\" fill={tint} />\n {kind === \"success\" ? (\n <path d=\"M4.4 7.2 6.2 9 9.7 5.3\" stroke={ink} strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n ) : (\n <>\n <path d=\"M7 4.2v3.4\" stroke={ink} strokeWidth=\"1.6\" strokeLinecap=\"round\" />\n <path d=\"M7 9.8h.01\" stroke={ink} strokeWidth=\"1.9\" strokeLinecap=\"round\" />\n </>\n )}\n </svg>\n );\n}\n\n/* ── Badge (F1572) ────────────────────────────────────────────────── */\nexport type FoundationBadgeTone = \"gray\" | \"green\" | \"amber\" | \"red\" | \"blue\" | \"violet\" | \"outline\";\nconst BADGE_TONE: Record<FoundationBadgeTone, { box: string; dot: string }> = {\n gray: { box: \"bg-kit-insp-card text-kit-insp-tip-body\", dot: \"bg-kit-group-sub\" },\n green: { box: \"bg-[var(--kit-insp-badge-green)] text-[var(--kit-insp-badge-green-fg)]\", dot: \"bg-[var(--kit-insp-badge-green-dot)]\" },\n amber: { box: \"bg-[var(--kit-insp-badge-amber)] text-kit-insp-count-near\", dot: \"bg-[var(--kit-insp-badge-amber-dot)]\" },\n red: { box: \"bg-kit-insp-delete-bg text-kit-insp-count-over\", dot: \"bg-kit-insp-ring-over\" },\n blue: { box: \"bg-kit-insp-card text-kit-insp-tip-body\", dot: \"bg-[var(--kit-insp-badge-blue-dot)]\" },\n violet: { box: \"bg-kit-insp-card text-kit-insp-tip-body\", dot: \"bg-kit-insp-accent\" },\n outline: { box: \"bg-kit-insp-tip-bg text-kit-insp-tip-body shadow-[inset_0_0_0_1px_var(--kit-insp-line)]\", dot: \"bg-kit-group-sub\" },\n};\nexport function FoundationBadge({\n tone = \"gray\", dot = true, size = \"sm\", className, children,\n}: { tone?: FoundationBadgeTone; dot?: boolean; size?: \"sm\" | \"md\"; className?: string; children: React.ReactNode }) {\n const t = BADGE_TONE[tone];\n return (\n <span\n data-slot=\"kit-fbadge\"\n className={cn(\"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap text-[12px] font-medium leading-4\", size === \"md\" ? \"h-6 rounded-[6px] pl-2 pr-2.5\" : \"h-5 rounded-[4px] pl-1.5 pr-2\", t.box, className)}\n >\n {dot ? <i aria-hidden className={cn(\"size-[5px] rounded-full\", t.dot)} /> : null}\n {children}\n </span>\n );\n}\n\n/* ── PRO badge (F1576) ────────────────────────────────────────────── */\nexport function BcmsMark({ size = 10 }: { size?: number }) {\n const id = React.useId();\n return (\n <svg width={size} height={(size * 28) / 24} viewBox=\"0 0 24 28\" fill=\"none\" aria-hidden>\n <defs>\n <linearGradient id={id} x1=\"8.8\" y1=\"-2.8\" x2=\"18.9\" y2=\"29.1\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\".08\" stopColor=\"#A878D2\" />\n <stop offset=\".48\" stopColor=\"#ED6262\" />\n <stop offset=\".92\" stopColor=\"#D13A3A\" />\n </linearGradient>\n </defs>\n <path fill={`url(#${id})`} d=\"M12.76 27L1.51 20.09A3.1 3.1 0 0 1 0 17.4V8.6c0-1.15.62-2.21 1.63-2.77L9.59 1.4a3.2 3.2 0 0 1 2.92-.09l11.32 5.43-9.48 5.42a2.8 2.8 0 0 0-1.6 2.75V27z\" />\n <path fill={`url(#${id})`} d=\"M14.34 16.02v2.85l7.88-5.01c.91-.58 1.47-1.59 1.47-2.67V8.3l-7.89 5.06a3.2 3.2 0 0 0-1.46 2.66zM14.34 22.26v2.85l7.88-5.01c.91-.58 1.47-1.59 1.47-2.67v-2.89l-7.89 5.06a3.2 3.2 0 0 0-1.46 2.66z\" />\n </svg>\n );\n}\nexport function ProBadge({ className }: { className?: string }) {\n return (\n <span data-slot=\"kit-fpro\" className={cn(\"inline-flex h-5 shrink-0 items-center gap-1 rounded-full bg-kit-insp-tip-bg pl-[5px] pr-[7px] text-[10px] font-semibold leading-3 text-kit-insp-tip-body shadow-[inset_0_0_0_1px_var(--kit-insp-line)]\", className)}>\n <BcmsMark size={10} />\n PRO\n </span>\n );\n}\n\n/* ── Text field (F1577) ───────────────────────────────────────────── */\nexport interface FoundationTextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\"> {\n icon?: React.ReactNode;\n error?: boolean;\n /** after the input: a `SearchClear`, a unit */\n trailing?: React.ReactNode;\n boxClassName?: string;\n}\nexport const FoundationTextField = React.forwardRef<HTMLInputElement, FoundationTextFieldProps>(function FoundationTextField(\n { icon, error, trailing, boxClassName, className, ...rest },\n ref,\n) {\n return (\n <label\n data-slot=\"kit-fin\"\n className={cn(\n \"flex h-[34px] min-w-0 flex-1 items-center gap-2 rounded-[6px] px-2.5 text-kit-insp-faint transition-[background-color,box-shadow] duration-150 [&>svg]:size-4 [&>svg]:shrink-0\",\n error\n ? \"bg-kit-insp-tip-bg shadow-[inset_0_0_0_1px_var(--kit-insp-error)]\"\n : \"bg-kit-insp-card focus-within:bg-kit-insp-tip-bg focus-within:shadow-[inset_0_0_0_1px_var(--kit-insp-accent),0_0_0_3px_color-mix(in_srgb,var(--kit-insp-accent)_15%,transparent)]\",\n boxClassName,\n )}\n >\n {icon}\n <input\n ref={ref}\n aria-invalid={error || undefined}\n className={cn(\"h-full min-w-0 flex-1 border-0 bg-transparent text-[13px] text-kit-insp-tip-title outline-none placeholder:text-kit-group-sub focus-visible:shadow-none\", className)}\n {...rest}\n />\n {trailing}\n </label>\n );\n});\n\n/* ── Search clear (F1596) ─────────────────────────────────────────── */\n/** Out of the tab order: Escape clears from the keyboard (the field's owner handles it). */\nexport function SearchClear({ show, onClear, className }: { show: boolean; onClear: () => void; className?: string }) {\n return (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label=\"Clear search\"\n aria-hidden={!show || undefined}\n data-slot=\"kit-search-clear\"\n onMouseDown={(e) => e.preventDefault()}\n onClick={onClear}\n className={cn(\n \"grid size-4 shrink-0 place-items-center rounded-full bg-kit-insp-chip text-kit-insp-label transition-[opacity,transform] duration-150 ease-out hover:bg-[var(--kit-insp-chip-hover)]\",\n show ? \"opacity-100\" : \"pointer-events-none scale-50 opacity-0\",\n className,\n )}\n >\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" aria-hidden>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n </button>\n );\n}\n\n/* ── Save status (F1597) ──────────────────────────────────────────── */\nexport type SaveState = \"saved\" | \"saving\" | \"error\" | \"offline\";\nconst SAVE_COPY: Record<SaveState, { label: string; title?: string }> = {\n saved: { label: \"Saved\", title: \"All changes saved\" },\n saving: { label: \"Saving…\" },\n error: { label: \"Couldn’t save · Retry\", title: \"Your latest changes didn’t reach the server. Try again\" },\n offline: { label: \"Offline · changes kept on this device\" },\n};\nconst SAVE_BOX = \"inline-flex h-7 min-w-0 items-center gap-[5px] whitespace-nowrap rounded-[6px] px-1.5 text-[12px] font-medium leading-[18px]\";\n/**\n * The save status chip. `error` makes the whole chip the Retry button. `savedTitle` overrides the hover text of Saved\n * (the prototype's reads \"All changes saved to main\": the branch is the host's to name).\n */\nexport function SaveStatus({ state, onRetry, savedTitle, className }: { state: SaveState; onRetry?: () => void; savedTitle?: string; className?: string }) {\n const copy = SAVE_COPY[state];\n const glyph = (\n <span aria-hidden className={cn(\"relative grid h-3.5 shrink-0 place-items-center transition-[width] duration-150\", state === \"error\" ? \"w-[18px]\" : \"w-3.5\")}>\n {state === \"saving\" ? (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\" className=\"animate-spin [animation-duration:0.8s] motion-reduce:animate-none\">\n <circle cx=\"7\" cy=\"7\" r=\"5.25\" stroke=\"currentColor\" strokeOpacity=\"0.25\" strokeWidth=\"1.5\" />\n <path d=\"M12.25 7A5.25 5.25 0 0 0 7 1.75\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n ) : state === \"error\" ? (\n <svg width=\"18\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M7 18a4.6 4.4 0 0 1 0-9 5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7H7M12 11v3M12 16.5h.01\" />\n </svg>\n ) : state === \"offline\" ? (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M3 3l18 18M9.6 5.6A5 4.5 0 0 1 18 11h1a3.5 3.5 0 0 1 2.2 6.2M16 18H7a4.6 4.4 0 0 1-1.3-8.6\" />\n </svg>\n ) : (\n <StatusIcon kind=\"success\" />\n )}\n </span>\n );\n const text = <span className=\"min-w-0 truncate\">{copy.label}</span>;\n if (state === \"error\")\n return (\n <button\n type=\"button\"\n data-slot=\"kit-save-status\"\n data-state={state}\n title={copy.title}\n onClick={onRetry}\n className={cn(SAVE_BOX, \"text-kit-insp-count-over outline-none transition-[background-color] duration-[120ms] hover:bg-kit-insp-delete-bg focus-visible:shadow-[0_0_0_2px_var(--kit-insp-tip-bg),0_0_0_4px_var(--kit-insp-accent)]\", className)}\n >\n {glyph}\n {text}\n </button>\n );\n return (\n <span data-slot=\"kit-save-status\" data-state={state} role=\"status\" aria-live=\"polite\" title={state === \"saved\" ? savedTitle ?? copy.title : copy.title} className={cn(SAVE_BOX, \"text-kit-insp-desc\", className)}>\n {glyph}\n {text}\n </span>\n );\n}\n\n/* ── Anchored popover (F1565) ─────────────────────────────────────── */\n/**\n * A panel on an anchor element: in a portal, 6 under the anchor (left edges aligned, or right with `align=\"right\"`),\n * above it when it would cross the window's bottom, never closer than 8 to the left or right edge. A press outside\n * the panel and its anchor closes it, and so does Escape (captured, so nothing behind it also reacts).\n */\nexport function InspectorPopover({\n anchor, onClose, width = 300, align = \"left\", label, className, children,\n}: { anchor: HTMLElement | null; onClose: () => void; width?: number; align?: \"left\" | \"right\"; label: string; className?: string; children: React.ReactNode }) {\n const ref = React.useRef<HTMLDivElement>(null);\n const reduce = useReducedMotion();\n const [pos, setPos] = React.useState({ left: -9999, top: 0, origin: \"top left\" });\n React.useLayoutEffect(() => {\n if (!anchor || !ref.current) return;\n const r = anchor.getBoundingClientRect();\n const h = ref.current.offsetHeight;\n const left = align === \"right\" ? r.right - width : r.left;\n let top = r.bottom + 6;\n let above = false;\n if (top + h > window.innerHeight - 8) {\n top = Math.max(8, r.top - h - 6);\n above = true;\n }\n setPos({ left: Math.max(8, Math.min(left, window.innerWidth - width - 8)), top, origin: `${above ? \"bottom\" : \"top\"} ${align}` });\n }, [anchor, width, align]);\n const close = React.useRef(onClose);\n close.current = onClose;\n React.useEffect(() => {\n const down = (e: MouseEvent) => {\n const t = e.target as Node;\n if (!ref.current?.contains(t) && !anchor?.contains(t)) close.current();\n };\n const key = (e: KeyboardEvent) => {\n if (e.key !== \"Escape\") return;\n e.stopPropagation();\n close.current();\n };\n document.addEventListener(\"mousedown\", down);\n document.addEventListener(\"keydown\", key, true);\n return () => {\n document.removeEventListener(\"mousedown\", down);\n document.removeEventListener(\"keydown\", key, true);\n };\n }, [anchor]);\n if (typeof document === \"undefined\") return null;\n return createPortal(\n <motion.div\n ref={ref}\n role=\"dialog\"\n aria-label={label}\n data-kit-scope=\"\"\n data-floating-layer=\"\"\n data-slot=\"kit-insp-popover\"\n className={cn(\n \"fixed z-[var(--kit-z-popover,84)] overflow-hidden rounded-[10px] border border-kit-insp-line bg-kit-insp-tip-bg shadow-[0_1px_1px_rgb(0_0_0/0.04),0_6px_24px_rgb(0_0_0/0.1),0_9px_48px_rgb(0_0_0/0.08)]\",\n className,\n )}\n style={{ left: pos.left, top: pos.top, width, transformOrigin: pos.origin }}\n initial={reduce ? false : { opacity: 0, scale: 0.95, filter: \"blur(2px)\" }}\n animate={{ opacity: 1, scale: 1, filter: \"blur(0px)\" }}\n transition={{ duration: 0.15, ease: \"easeOut\" }}\n >\n {children}\n </motion.div>,\n document.body,\n );\n}\n\n/* ── Button style picker (F1566-F1568) ────────────────────────────── */\nexport type ButtonStyleKey = \"primary\" | \"brand\" | \"secondary\" | \"outline\" | \"ghost\";\nexport const BUTTON_STYLES: { value: ButtonStyleKey; label: string; hint: string }[] = [\n { value: \"primary\", label: \"Solid\", hint: \"Main action\" },\n { value: \"brand\", label: \"Color\", hint: \"Brand colour\" },\n { value: \"secondary\", label: \"Soft\", hint: \"Quiet\" },\n { value: \"outline\", label: \"Outline\", hint: \"Low emphasis\" },\n { value: \"ghost\", label: \"Ghost\", hint: \"Text only\" },\n];\n/** How each style draws the preview button (the site's own button looks; `brand` is the site's brand colour). */\nconst previewStyle = (k: ButtonStyleKey, brand: string): React.CSSProperties =>\n k === \"primary\" ? { background: \"#101010\", color: \"#fff\" }\n : k === \"brand\" ? { background: brand, color: \"#fff\" }\n : k === \"secondary\" ? { background: \"#E8E8E6\", color: \"#101010\" }\n : k === \"outline\" ? { background: \"#fff\", color: \"#101010\", borderColor: \"#D4D4D2\" }\n : { background: \"transparent\", color: \"#101010\" };\n\n/**\n * \"Button style\": five radio rows, each a live preview of the button in that style, its name and a hint, a check on\n * the current one. `styles` narrows the list to what the site's button stores. The footer's \"Edit\" is drawn only when\n * the host says where it goes (`onEdit`). ↑ ↓ move between rows.\n */\nexport function ButtonStylePicker({\n anchor, value, label = \"Get Started\", brand = \"var(--kit-insp-accent-fg)\", styles, onPick, onClose, onEdit, align,\n}: {\n anchor: HTMLElement | null;\n value: ButtonStyleKey;\n /** the button's own text, drawn in every preview */\n label?: string;\n /** the site's brand colour (a CSS colour) for the Color row */\n brand?: string;\n styles?: ButtonStyleKey[];\n onPick: (value: ButtonStyleKey) => void;\n onClose: () => void;\n onEdit?: () => void;\n align?: \"left\" | \"right\";\n}) {\n const list = styles ? BUTTON_STYLES.filter((s) => styles.includes(s.value)) : BUTTON_STYLES;\n const rows = React.useRef<HTMLDivElement>(null);\n const move = (e: React.KeyboardEvent, i: number) => {\n if (e.key !== \"ArrowDown\" && e.key !== \"ArrowUp\") return;\n e.preventDefault();\n const next = Math.max(0, Math.min(list.length - 1, i + (e.key === \"ArrowDown\" ? 1 : -1)));\n rows.current?.querySelectorAll<HTMLButtonElement>(\"[role=radio]\")[next]?.focus();\n };\n return (\n <InspectorPopover anchor={anchor} onClose={onClose} width={300} label=\"Button style\" align={align}>\n <div className=\"flex items-center gap-2 border-b border-kit-insp-divider px-3 py-2.5\">\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden className=\"shrink-0 text-kit-insp-label\">\n <path d=\"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11ZM5 2l5 5M2 13h15M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z\" />\n </svg>\n <b className=\"flex-1 text-[13px] font-medium text-kit-insp-ink\">Button style</b>\n <kbd className=\"rounded-[4px] bg-[var(--kit-insp-kbd)] px-[5px] font-kit-sans text-[11px] font-medium leading-[18px] text-kit-insp-desc\">Esc</kbd>\n </div>\n <div ref={rows} role=\"radiogroup\" aria-label=\"Button style\" className=\"flex flex-col gap-1.5 p-2\">\n {list.map((o, i) => {\n const on = value === o.value;\n return (\n <button\n key={o.value}\n type=\"button\"\n role=\"radio\"\n aria-checked={on}\n tabIndex={on || (!list.some((x) => x.value === value) && i === 0) ? 0 : -1}\n onClick={() => onPick(o.value)}\n onKeyDown={(e) => move(e, i)}\n className={cn(\n \"flex items-center gap-3 rounded-[8px] border p-2 text-left outline-none transition-[background-color,border-color] duration-[120ms] focus-visible:shadow-[0_0_0_2px_var(--kit-focus-ring)]\",\n on ? \"border-[var(--kit-insp-opt-on-line)] bg-[var(--kit-insp-opt-on)]\" : \"border-transparent bg-kit-insp-card-focus hover:bg-[var(--kit-insp-opt-hover)]\",\n )}\n >\n <span aria-hidden className=\"pointer-events-none grid h-8 w-[112px] shrink-0 place-items-center truncate rounded-[6px] border border-transparent px-2 text-[12px] font-semibold leading-[18px]\" style={previewStyle(o.value, brand)}>\n {label}\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col gap-px\">\n <b className=\"text-[13px] font-medium text-kit-insp-ink\">{o.label}</b>\n <small className=\"text-[12px] text-kit-insp-quiet\">{o.hint}</small>\n </span>\n {on ? (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden className=\"shrink-0 text-kit-insp-label\">\n <path d=\"M5 12l5 5L20 7\" />\n </svg>\n ) : null}\n </button>\n );\n })}\n </div>\n <div className=\"flex items-center justify-between gap-3 border-t border-kit-insp-divider px-3 py-2.5 text-[12px] leading-[18px] text-kit-insp-quiet\">\n <span>Styles come from the site style guide</span>\n {onEdit ? (\n <button type=\"button\" onClick={onEdit} className=\"whitespace-nowrap rounded-[4px] text-[12px] font-medium text-kit-insp-accent-fg outline-none hover:underline hover:underline-offset-2 focus-visible:shadow-[0_0_0_2px_var(--kit-focus-ring)]\">\n Edit\n </button>\n ) : null}\n </div>\n </InspectorPopover>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,aAAa;AASnB,IAAa,mBAAmB,MAAM,WAAqD,SAAS,iBAClG,EAAE,UAAU,WAAW,OAAO,MAAM,MAAM,WAAW,UAAU,OAAO,UAAU,GAAG,QACnF,KACA;CACA,OACE,qBAAC,UAAD;EACO;EACC;EACN,aAAU;EACV,WAAW,GACT,8KACA,SAAS,OAAO,2BAA2B,SAAS,OAAO,gCAAgC,wBAC3F,YAAY,YACR,iGACA,2GACJ,YACA,SACF;EACA,GAAI;EAbN,UAAA,CAeG,MACA,QACK;;AAEZ,CAAC;AAGD,SAAgB,mBAAmB,EACjC,IAAI,OAAO,UAAU,UAAU,OAAO,WAAW,mBAAmB,cACsF;CAC1J,MAAM,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;CACzB,OACE,oBAAC,UAAD;EACE,MAAK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KAAK,GAAG,CAAC;MAC3B,WAAW,GACT,8LACA,KAAK,qEAAqE,gFAC5E;MAXF,UAAA;OAaE,oBAAC,QAAD;QAAM,eAAA;QAAY,WAAU;QAAoK,OAAO,aAAa,EAAE,OAAO,KAAK;QAC/N,UAAA;OACG,CAAA;OACN,qBAAC,QAAD;QAAM,WAAU;QAAhB,UAAA,CACE,oBAAC,KAAD;SAAG,WAAU;SAA6C,UAAA,EAAE;QAAS,CAAA,GACrE,oBAAC,SAAD;SAAO,WAAU;SAAmC,UAAA,EAAE;QAAY,CAAA,CAC9D;;OACL,KACC,oBAAC,OAAD;QAAK,OAAM;QAAK,QAAO;QAAK,SAAQ;QAAY,MAAK;QAAO,QAAO;QAAe,aAAY;QAAI,eAAc;QAAQ,gBAAe;QAAQ,eAAA;QAAY,WAAU;QACnK,UAAA,oBAAC,QAAD,EAAM,GAAE,iBAAkB,CAAA;OACvB,CAAA,IACH;MACE;KAxBD,GAAA,EAAE,KAwBD;IAEZ,CAAC;GACE,CAAA;GACL,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,QAAD,EAAA,UAAM,wCAA2C,CAAA,GAChD,SACC,oBAAC,UAAD;KAAQ,MAAK;KAAS,SAAS;KAAQ,WAAU;KAA+L,UAAA;IAExO,CAAA,IACN,IACD;;EACW;;AAEtB"}
1
+ {"version":3,"file":"foundations.js","names":[],"sources":["../../src/ui/foundations.tsx"],"sourcesContent":["/**\n * FOUNDATIONS · V1.6 (prototype editor-v16 `Btn`, `Checkbox`, `StatusIcon`, `Badge`, `ProBadge`, `TextField`, `Popover`,\n * `ButtonStylePicker`, `SearchClear`, save status; kit.jsx:9-43, 255-296; ui.jsx:332-345, 393-398; foundations.css;\n * kit.css:112-131; shellx.css:2-16, 199-204; faq.css:99-101).\n *\n * New names, so nothing of the stock kit changes: the kit's own `Button`, `Checkbox`, `Badge` and `Input` stay as they\n * are. Colours are `--kit-insp-*` tokens (tokens.css). Every part is presentational: the host owns the state.\n *\n * <FoundationButton variant size icon> primary (ink) or secondary (grey), 28 / 32 / 34 high\n * <FoundationCheckbox on mixed onChange label> 16, radius 4, violet when on, a dash when mixed\n * <StatusIcon kind size> a 10% tint disc with a tick or an exclamation mark\n * <FoundationBadge tone dot size> 20 (24) high tag with a 5 tone dot\n * <ProBadge /> <BcmsMark size /> the white \"PRO\" pill with the gradient mark\n * <FoundationTextField icon error /> 34 high grey field, violet focus ring, red edge on error\n * <SearchClear show onClear /> the 16 round × that fades in when a search field has text\n * <SaveStatus state onRetry /> Saved · Saving… · Couldn’t save · Retry · Offline\n * <InspectorPopover anchor onClose label> anchored panel: 6 under the anchor, flips above, 8 from the edges\n * <ButtonStylePicker anchor value onPick> \"Button style\": five radio rows with a live button preview\n */\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { motion } from \"framer-motion\";\nimport { cn } from \"../lib/cn\";\nimport { useKitReducedMotion } from \"../lib/reduced-motion\";\n\nconst FOCUS_HALO = \"focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--kit-insp-accent)_30%,transparent)]\";\n\n/* ── Button (F1569) ───────────────────────────────────────────────── */\nexport interface FoundationButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: \"primary\" | \"secondary\";\n /** sm 28 · md 32 (default) · lg 34, beside a 34 high field */\n size?: \"sm\" | \"md\" | \"lg\";\n icon?: React.ReactNode;\n}\nexport const FoundationButton = React.forwardRef<HTMLButtonElement, FoundationButtonProps>(function FoundationButton(\n { variant = \"primary\", size = \"md\", icon, className, children, type = \"button\", ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type}\n data-slot=\"kit-fbtn\"\n className={cn(\n \"inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap rounded-[6px] font-medium outline-none transition-[background-color,color,opacity] duration-150\",\n size === \"sm\" ? \"h-7 px-2.5 text-[12px]\" : size === \"lg\" ? \"h-[34px] px-3.5 text-[13px]\" : \"h-8 px-3 text-[13px]\",\n variant === \"primary\"\n ? \"bg-kit-insp-tip-title text-kit-insp-tip-bg enabled:hover:bg-kit-insp-ink disabled:opacity-35\"\n : \"bg-kit-insp-card text-kit-insp-tip-title enabled:hover:bg-kit-insp-divider disabled:text-kit-insp-faint\",\n FOCUS_HALO,\n className,\n )}\n {...rest}\n >\n {icon}\n {children}\n </button>\n );\n});\n\n/* ── Checkbox (F1570) ─────────────────────────────────────────────── */\nexport function FoundationCheckbox({\n on, mixed, disabled, onChange, label, className, \"aria-labelledby\": labelledBy,\n}: { on?: boolean; mixed?: boolean; disabled?: boolean; onChange?: (on: boolean) => void; label?: string; className?: string; \"aria-labelledby\"?: string }) {\n const filled = !!on || !!mixed;\n return (\n <button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={mixed ? \"mixed\" : !!on}\n aria-label={label}\n aria-labelledby={labelledBy}\n disabled={disabled}\n data-slot=\"kit-fcb\"\n onClick={(e) => {\n e.stopPropagation();\n onChange?.(!on);\n }}\n className={cn(\n \"grid size-4 shrink-0 place-items-center rounded-[4px] outline-none transition-[background-color,box-shadow] duration-150 disabled:cursor-not-allowed disabled:opacity-40\",\n filled\n ? \"bg-kit-insp-accent-fg focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--kit-insp-accent-fg)_20%,transparent)]\"\n : \"bg-kit-insp-tip-bg shadow-[inset_0_0_0_1.5px_var(--kit-insp-line-strong)] focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--kit-insp-accent-fg)_20%,transparent),inset_0_0_0_1.5px_var(--kit-insp-line-strong)]\",\n className,\n )}\n >\n {filled ? (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden>\n {mixed ? <path d=\"M4.5 8h7\" stroke=\"#fff\" strokeWidth=\"1.8\" strokeLinecap=\"round\" /> : <path d=\"M3.6 8.3l2.7 2.7l6-6.2\" stroke=\"#fff\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />}\n </svg>\n ) : null}\n </button>\n );\n}\n\n/* ── Status icon (F1571) ──────────────────────────────────────────── */\nexport function StatusIcon({ kind = \"success\", size = 14, className }: { kind?: \"success\" | \"error\"; size?: number; className?: string }) {\n const tint = kind === \"success\" ? \"var(--kit-insp-ok-tint)\" : \"var(--kit-insp-err-tint)\";\n const ink = kind === \"success\" ? \"var(--kit-insp-ok)\" : \"var(--kit-insp-err)\";\n return (\n <svg width={size} height={size} viewBox=\"0 0 14 14\" fill=\"none\" aria-hidden className={cn(\"shrink-0\", className)}>\n <circle cx=\"7\" cy=\"7\" r=\"7\" fill={tint} />\n {kind === \"success\" ? (\n <path d=\"M4.4 7.2 6.2 9 9.7 5.3\" stroke={ink} strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n ) : (\n <>\n <path d=\"M7 4.2v3.4\" stroke={ink} strokeWidth=\"1.6\" strokeLinecap=\"round\" />\n <path d=\"M7 9.8h.01\" stroke={ink} strokeWidth=\"1.9\" strokeLinecap=\"round\" />\n </>\n )}\n </svg>\n );\n}\n\n/* ── Badge (F1572) ────────────────────────────────────────────────── */\nexport type FoundationBadgeTone = \"gray\" | \"green\" | \"amber\" | \"red\" | \"blue\" | \"violet\" | \"outline\";\nconst BADGE_TONE: Record<FoundationBadgeTone, { box: string; dot: string }> = {\n gray: { box: \"bg-kit-insp-card text-kit-insp-tip-body\", dot: \"bg-kit-group-sub\" },\n green: { box: \"bg-[var(--kit-insp-badge-green)] text-[var(--kit-insp-badge-green-fg)]\", dot: \"bg-[var(--kit-insp-badge-green-dot)]\" },\n amber: { box: \"bg-[var(--kit-insp-badge-amber)] text-kit-insp-count-near\", dot: \"bg-[var(--kit-insp-badge-amber-dot)]\" },\n red: { box: \"bg-kit-insp-delete-bg text-kit-insp-count-over\", dot: \"bg-kit-insp-ring-over\" },\n blue: { box: \"bg-kit-insp-card text-kit-insp-tip-body\", dot: \"bg-[var(--kit-insp-badge-blue-dot)]\" },\n violet: { box: \"bg-kit-insp-card text-kit-insp-tip-body\", dot: \"bg-kit-insp-accent\" },\n outline: { box: \"bg-kit-insp-tip-bg text-kit-insp-tip-body shadow-[inset_0_0_0_1px_var(--kit-insp-line)]\", dot: \"bg-kit-group-sub\" },\n};\nexport function FoundationBadge({\n tone = \"gray\", dot = true, size = \"sm\", className, children,\n}: { tone?: FoundationBadgeTone; dot?: boolean; size?: \"sm\" | \"md\"; className?: string; children: React.ReactNode }) {\n const t = BADGE_TONE[tone];\n return (\n <span\n data-slot=\"kit-fbadge\"\n className={cn(\"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap text-[12px] font-medium leading-4\", size === \"md\" ? \"h-6 rounded-[6px] pl-2 pr-2.5\" : \"h-5 rounded-[4px] pl-1.5 pr-2\", t.box, className)}\n >\n {dot ? <i aria-hidden className={cn(\"size-[5px] rounded-full\", t.dot)} /> : null}\n {children}\n </span>\n );\n}\n\n/* ── PRO badge (F1576) ────────────────────────────────────────────── */\nexport function BcmsMark({ size = 10 }: { size?: number }) {\n const id = React.useId();\n return (\n <svg width={size} height={(size * 28) / 24} viewBox=\"0 0 24 28\" fill=\"none\" aria-hidden>\n <defs>\n <linearGradient id={id} x1=\"8.8\" y1=\"-2.8\" x2=\"18.9\" y2=\"29.1\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\".08\" stopColor=\"#A878D2\" />\n <stop offset=\".48\" stopColor=\"#ED6262\" />\n <stop offset=\".92\" stopColor=\"#D13A3A\" />\n </linearGradient>\n </defs>\n <path fill={`url(#${id})`} d=\"M12.76 27L1.51 20.09A3.1 3.1 0 0 1 0 17.4V8.6c0-1.15.62-2.21 1.63-2.77L9.59 1.4a3.2 3.2 0 0 1 2.92-.09l11.32 5.43-9.48 5.42a2.8 2.8 0 0 0-1.6 2.75V27z\" />\n <path fill={`url(#${id})`} d=\"M14.34 16.02v2.85l7.88-5.01c.91-.58 1.47-1.59 1.47-2.67V8.3l-7.89 5.06a3.2 3.2 0 0 0-1.46 2.66zM14.34 22.26v2.85l7.88-5.01c.91-.58 1.47-1.59 1.47-2.67v-2.89l-7.89 5.06a3.2 3.2 0 0 0-1.46 2.66z\" />\n </svg>\n );\n}\nexport function ProBadge({ className }: { className?: string }) {\n return (\n <span data-slot=\"kit-fpro\" className={cn(\"inline-flex h-5 shrink-0 items-center gap-1 rounded-full bg-kit-insp-tip-bg pl-[5px] pr-[7px] text-[10px] font-semibold leading-3 text-kit-insp-tip-body shadow-[inset_0_0_0_1px_var(--kit-insp-line)]\", className)}>\n <BcmsMark size={10} />\n PRO\n </span>\n );\n}\n\n/* ── Text field (F1577) ───────────────────────────────────────────── */\nexport interface FoundationTextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\"> {\n icon?: React.ReactNode;\n error?: boolean;\n /** after the input: a `SearchClear`, a unit */\n trailing?: React.ReactNode;\n boxClassName?: string;\n}\nexport const FoundationTextField = React.forwardRef<HTMLInputElement, FoundationTextFieldProps>(function FoundationTextField(\n { icon, error, trailing, boxClassName, className, ...rest },\n ref,\n) {\n return (\n <label\n data-slot=\"kit-fin\"\n className={cn(\n \"flex h-[34px] min-w-0 flex-1 items-center gap-2 rounded-[6px] px-2.5 text-kit-insp-faint transition-[background-color,box-shadow] duration-150 [&>svg]:size-4 [&>svg]:shrink-0\",\n error\n ? \"bg-kit-insp-tip-bg shadow-[inset_0_0_0_1px_var(--kit-insp-error)]\"\n : \"bg-kit-insp-card focus-within:bg-kit-insp-tip-bg focus-within:shadow-[inset_0_0_0_1px_var(--kit-insp-accent),0_0_0_3px_color-mix(in_srgb,var(--kit-insp-accent)_15%,transparent)]\",\n boxClassName,\n )}\n >\n {icon}\n <input\n ref={ref}\n aria-invalid={error || undefined}\n className={cn(\"h-full min-w-0 flex-1 border-0 bg-transparent text-[13px] text-kit-insp-tip-title outline-none placeholder:text-kit-group-sub focus-visible:shadow-none\", className)}\n {...rest}\n />\n {trailing}\n </label>\n );\n});\n\n/* ── Search clear (F1596) ─────────────────────────────────────────── */\n/** Out of the tab order: Escape clears from the keyboard (the field's owner handles it). */\nexport function SearchClear({ show, onClear, className }: { show: boolean; onClear: () => void; className?: string }) {\n return (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label=\"Clear search\"\n aria-hidden={!show || undefined}\n data-slot=\"kit-search-clear\"\n onMouseDown={(e) => e.preventDefault()}\n onClick={onClear}\n className={cn(\n \"grid size-4 shrink-0 place-items-center rounded-full bg-kit-insp-chip text-kit-insp-label transition-[opacity,transform] duration-150 ease-out hover:bg-[var(--kit-insp-chip-hover)]\",\n show ? \"opacity-100\" : \"pointer-events-none scale-50 opacity-0\",\n className,\n )}\n >\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" aria-hidden>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n </button>\n );\n}\n\n/* ── Save status (F1597) ──────────────────────────────────────────── */\nexport type SaveState = \"saved\" | \"saving\" | \"error\" | \"offline\";\nconst SAVE_COPY: Record<SaveState, { label: string; title?: string }> = {\n saved: { label: \"Saved\", title: \"All changes saved\" },\n saving: { label: \"Saving…\" },\n error: { label: \"Couldn’t save · Retry\", title: \"Your latest changes didn’t reach the server. Try again\" },\n offline: { label: \"Offline · changes kept on this device\" },\n};\nconst SAVE_BOX = \"inline-flex h-7 min-w-0 items-center gap-[5px] whitespace-nowrap rounded-[6px] px-1.5 text-[12px] font-medium leading-[18px]\";\n/**\n * The save status chip. `error` makes the whole chip the Retry button. `savedTitle` overrides the hover text of Saved\n * (the prototype's reads \"All changes saved to main\": the branch is the host's to name).\n */\nexport function SaveStatus({ state, onRetry, savedTitle, className }: { state: SaveState; onRetry?: () => void; savedTitle?: string; className?: string }) {\n const copy = SAVE_COPY[state];\n const glyph = (\n <span aria-hidden className={cn(\"relative grid h-3.5 shrink-0 place-items-center transition-[width] duration-150\", state === \"error\" ? \"w-[18px]\" : \"w-3.5\")}>\n {state === \"saving\" ? (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\" className=\"animate-spin [animation-duration:0.8s] motion-reduce:animate-none\">\n <circle cx=\"7\" cy=\"7\" r=\"5.25\" stroke=\"currentColor\" strokeOpacity=\"0.25\" strokeWidth=\"1.5\" />\n <path d=\"M12.25 7A5.25 5.25 0 0 0 7 1.75\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n ) : state === \"error\" ? (\n <svg width=\"18\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M7 18a4.6 4.4 0 0 1 0-9 5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7H7M12 11v3M12 16.5h.01\" />\n </svg>\n ) : state === \"offline\" ? (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M3 3l18 18M9.6 5.6A5 4.5 0 0 1 18 11h1a3.5 3.5 0 0 1 2.2 6.2M16 18H7a4.6 4.4 0 0 1-1.3-8.6\" />\n </svg>\n ) : (\n <StatusIcon kind=\"success\" />\n )}\n </span>\n );\n const text = <span className=\"min-w-0 truncate\">{copy.label}</span>;\n if (state === \"error\")\n return (\n <button\n type=\"button\"\n data-slot=\"kit-save-status\"\n data-state={state}\n title={copy.title}\n onClick={onRetry}\n className={cn(SAVE_BOX, \"text-kit-insp-count-over outline-none transition-[background-color] duration-[120ms] hover:bg-kit-insp-delete-bg focus-visible:shadow-[0_0_0_2px_var(--kit-insp-tip-bg),0_0_0_4px_var(--kit-insp-accent)]\", className)}\n >\n {glyph}\n {text}\n </button>\n );\n return (\n <span data-slot=\"kit-save-status\" data-state={state} role=\"status\" aria-live=\"polite\" title={state === \"saved\" ? savedTitle ?? copy.title : copy.title} className={cn(SAVE_BOX, \"text-kit-insp-desc\", className)}>\n {glyph}\n {text}\n </span>\n );\n}\n\n/* ── Anchored popover (F1565) ─────────────────────────────────────── */\n/**\n * A panel on an anchor element: in a portal, 6 under the anchor (left edges aligned, or right with `align=\"right\"`),\n * above it when it would cross the window's bottom, never closer than 8 to the left or right edge. A press outside\n * the panel and its anchor closes it, and so does Escape (captured, so nothing behind it also reacts).\n */\nexport function InspectorPopover({\n anchor, onClose, width = 300, align = \"left\", label, className, children,\n}: { anchor: HTMLElement | null; onClose: () => void; width?: number; align?: \"left\" | \"right\"; label: string; className?: string; children: React.ReactNode }) {\n const ref = React.useRef<HTMLDivElement>(null);\n const reduce = useKitReducedMotion();\n const [pos, setPos] = React.useState({ left: -9999, top: 0, origin: \"top left\" });\n React.useLayoutEffect(() => {\n if (!anchor || !ref.current) return;\n const r = anchor.getBoundingClientRect();\n const h = ref.current.offsetHeight;\n const left = align === \"right\" ? r.right - width : r.left;\n let top = r.bottom + 6;\n let above = false;\n if (top + h > window.innerHeight - 8) {\n top = Math.max(8, r.top - h - 6);\n above = true;\n }\n setPos({ left: Math.max(8, Math.min(left, window.innerWidth - width - 8)), top, origin: `${above ? \"bottom\" : \"top\"} ${align}` });\n }, [anchor, width, align]);\n const close = React.useRef(onClose);\n close.current = onClose;\n React.useEffect(() => {\n const down = (e: MouseEvent) => {\n const t = e.target as Node;\n if (!ref.current?.contains(t) && !anchor?.contains(t)) close.current();\n };\n const key = (e: KeyboardEvent) => {\n if (e.key !== \"Escape\") return;\n e.stopPropagation();\n close.current();\n };\n document.addEventListener(\"mousedown\", down);\n document.addEventListener(\"keydown\", key, true);\n return () => {\n document.removeEventListener(\"mousedown\", down);\n document.removeEventListener(\"keydown\", key, true);\n };\n }, [anchor]);\n if (typeof document === \"undefined\") return null;\n return createPortal(\n <motion.div\n ref={ref}\n role=\"dialog\"\n aria-label={label}\n data-kit-scope=\"\"\n data-floating-layer=\"\"\n data-slot=\"kit-insp-popover\"\n className={cn(\n \"fixed z-[var(--kit-z-popover,84)] overflow-hidden rounded-[10px] border border-kit-insp-line bg-kit-insp-tip-bg shadow-[0_1px_1px_rgb(0_0_0/0.04),0_6px_24px_rgb(0_0_0/0.1),0_9px_48px_rgb(0_0_0/0.08)]\",\n className,\n )}\n style={{ left: pos.left, top: pos.top, width, transformOrigin: pos.origin }}\n initial={reduce ? false : { opacity: 0, scale: 0.95, filter: \"blur(2px)\" }}\n animate={{ opacity: 1, scale: 1, filter: \"blur(0px)\" }}\n transition={{ duration: 0.15, ease: \"easeOut\" }}\n >\n {children}\n </motion.div>,\n document.body,\n );\n}\n\n/* ── Button style picker (F1566-F1568) ────────────────────────────── */\nexport type ButtonStyleKey = \"primary\" | \"brand\" | \"secondary\" | \"outline\" | \"ghost\";\nexport const BUTTON_STYLES: { value: ButtonStyleKey; label: string; hint: string }[] = [\n { value: \"primary\", label: \"Solid\", hint: \"Main action\" },\n { value: \"brand\", label: \"Color\", hint: \"Brand colour\" },\n { value: \"secondary\", label: \"Soft\", hint: \"Quiet\" },\n { value: \"outline\", label: \"Outline\", hint: \"Low emphasis\" },\n { value: \"ghost\", label: \"Ghost\", hint: \"Text only\" },\n];\n/** How each style draws the preview button (the site's own button looks; `brand` is the site's brand colour). */\nconst previewStyle = (k: ButtonStyleKey, brand: string): React.CSSProperties =>\n k === \"primary\" ? { background: \"#101010\", color: \"#fff\" }\n : k === \"brand\" ? { background: brand, color: \"#fff\" }\n : k === \"secondary\" ? { background: \"#E8E8E6\", color: \"#101010\" }\n : k === \"outline\" ? { background: \"#fff\", color: \"#101010\", borderColor: \"#D4D4D2\" }\n : { background: \"transparent\", color: \"#101010\" };\n\n/**\n * \"Button style\": five radio rows, each a live preview of the button in that style, its name and a hint, a check on\n * the current one. `styles` narrows the list to what the site's button stores. The footer's \"Edit\" is drawn only when\n * the host says where it goes (`onEdit`). ↑ ↓ move between rows.\n */\nexport function ButtonStylePicker({\n anchor, value, label = \"Get Started\", brand = \"var(--kit-insp-accent-fg)\", styles, onPick, onClose, onEdit, align,\n}: {\n anchor: HTMLElement | null;\n value: ButtonStyleKey;\n /** the button's own text, drawn in every preview */\n label?: string;\n /** the site's brand colour (a CSS colour) for the Color row */\n brand?: string;\n styles?: ButtonStyleKey[];\n onPick: (value: ButtonStyleKey) => void;\n onClose: () => void;\n onEdit?: () => void;\n align?: \"left\" | \"right\";\n}) {\n const list = styles ? BUTTON_STYLES.filter((s) => styles.includes(s.value)) : BUTTON_STYLES;\n const rows = React.useRef<HTMLDivElement>(null);\n const move = (e: React.KeyboardEvent, i: number) => {\n if (e.key !== \"ArrowDown\" && e.key !== \"ArrowUp\") return;\n e.preventDefault();\n const next = Math.max(0, Math.min(list.length - 1, i + (e.key === \"ArrowDown\" ? 1 : -1)));\n rows.current?.querySelectorAll<HTMLButtonElement>(\"[role=radio]\")[next]?.focus();\n };\n return (\n <InspectorPopover anchor={anchor} onClose={onClose} width={300} label=\"Button style\" align={align}>\n <div className=\"flex items-center gap-2 border-b border-kit-insp-divider px-3 py-2.5\">\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden className=\"shrink-0 text-kit-insp-label\">\n <path d=\"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11ZM5 2l5 5M2 13h15M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z\" />\n </svg>\n <b className=\"flex-1 text-[13px] font-medium text-kit-insp-ink\">Button style</b>\n <kbd className=\"rounded-[4px] bg-[var(--kit-insp-kbd)] px-[5px] font-kit-sans text-[11px] font-medium leading-[18px] text-kit-insp-desc\">Esc</kbd>\n </div>\n <div ref={rows} role=\"radiogroup\" aria-label=\"Button style\" className=\"flex flex-col gap-1.5 p-2\">\n {list.map((o, i) => {\n const on = value === o.value;\n return (\n <button\n key={o.value}\n type=\"button\"\n role=\"radio\"\n aria-checked={on}\n tabIndex={on || (!list.some((x) => x.value === value) && i === 0) ? 0 : -1}\n onClick={() => onPick(o.value)}\n onKeyDown={(e) => move(e, i)}\n className={cn(\n \"flex items-center gap-3 rounded-[8px] border p-2 text-left outline-none transition-[background-color,border-color] duration-[120ms] focus-visible:shadow-[0_0_0_2px_var(--kit-focus-ring)]\",\n on ? \"border-[var(--kit-insp-opt-on-line)] bg-[var(--kit-insp-opt-on)]\" : \"border-transparent bg-kit-insp-card-focus hover:bg-[var(--kit-insp-opt-hover)]\",\n )}\n >\n <span aria-hidden className=\"pointer-events-none grid h-8 w-[112px] shrink-0 place-items-center truncate rounded-[6px] border border-transparent px-2 text-[12px] font-semibold leading-[18px]\" style={previewStyle(o.value, brand)}>\n {label}\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col gap-px\">\n <b className=\"text-[13px] font-medium text-kit-insp-ink\">{o.label}</b>\n <small className=\"text-[12px] text-kit-insp-quiet\">{o.hint}</small>\n </span>\n {on ? (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden className=\"shrink-0 text-kit-insp-label\">\n <path d=\"M5 12l5 5L20 7\" />\n </svg>\n ) : null}\n </button>\n );\n })}\n </div>\n <div className=\"flex items-center justify-between gap-3 border-t border-kit-insp-divider px-3 py-2.5 text-[12px] leading-[18px] text-kit-insp-quiet\">\n <span>Styles come from the site style guide</span>\n {onEdit ? (\n <button type=\"button\" onClick={onEdit} className=\"whitespace-nowrap rounded-[4px] text-[12px] font-medium text-kit-insp-accent-fg outline-none hover:underline hover:underline-offset-2 focus-visible:shadow-[0_0_0_2px_var(--kit-focus-ring)]\">\n Edit\n </button>\n ) : null}\n </div>\n </InspectorPopover>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAM,aAAa;AASnB,IAAa,mBAAmB,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AAQ,WAAU;KAA+L,UAAA;IAExO,CAAA,IACN,IACD;;EACW;;AAEtB"}
package/dist/ui/index.js CHANGED
@@ -5,7 +5,7 @@ import { ShortcutHint, ShortcutHintsProvider, platformKeys, shortcutHintsOn, use
5
5
  import { Checkbox, ChoiceCard, ChoiceList, Progress, Radio, RadioGroup, Segmented, Slider, Switch, ToggleGroup, ToggleItem } from "./controls.js";
6
6
  import { CARD_TOOLTIP_CLASS, CardTooltip, InfoTooltip } from "./tooltip-card.js";
7
7
  import { FLOATING_LAYER, FlowBody, FlowClose, FlowFooter, FlowHeader, FlowLabel, FlowModal, HeaderStatus, HoverCard, HoverCardContent, HoverCardTrigger, Menu, MenuCheckItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Modal, ModalBody, ModalClose, ModalContent, ModalFooter, ModalHeader, ModalTrigger, MoreOptions, OptionRow, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Sheet, SheetClose, SheetContent, SheetTrigger, Tooltip, TooltipProvider, useFocusReturn } from "./overlay.js";
8
- import { ColourSelect, CountRing, FieldCounter, FieldSweep, FocusDot, GroupHeader, INSPECTOR_EASE, ITEM_DELETE_CLASS, ITEM_LIST_ADD_CLASS, ITEM_ROW_CLASS, ITEM_ROW_GRIP_CLASS, ITEM_ROW_MORE_CLASS, ITEM_ROW_SUB_CLASS, ITEM_ROW_TITLE_CLASS, InfoGlyph, InlineRow, InspectorBody, InspectorCollapse, InspectorDivider, InspectorField, InspectorFields, InspectorGroup, InspectorLocked, InspectorNote, InspectorSeg, InspectorSwitch, ItemDeleteButton, ItemListAdd, ItemListCard, ItemListNote, ItemRow, ItemRowMore, LAYOUT_GLYPHS, LayoutOpt, OVER_LIMIT_CLASS, RollNumber, SectionHeader, SelectCompact, SelectField, StepRow, StepSlider, ToggleCard, ToggleRow, ValueSlider, counterState, itemListNote, overLimitText } from "./inspector.js";
8
+ import { ColourSelect, CountRing, FieldCounter, FieldSweep, FocusDot, GroupHeader, INSPECTOR_EASE, ITEM_DELETE_CLASS, ITEM_LIST_ADD_CLASS, ITEM_ROW_CLASS, ITEM_ROW_GRIP_CLASS, ITEM_ROW_MORE_CLASS, ITEM_ROW_SUB_CLASS, ITEM_ROW_TITLE_CLASS, InfoGlyph, InlineRow, InspectorBody, InspectorCollapse, InspectorDivider, InspectorField, InspectorFields, InspectorGroup, InspectorLocked, InspectorNote, InspectorSeg, InspectorSwitch, ItemDeleteButton, ItemListAdd, ItemListCard, ItemListNote, ItemRow, ItemRowMore, LAYOUT_GLYPHS, LayoutOpt, OVER_LIMIT_CLASS, OVER_LIMIT_EDGE_CLASS, OVER_LIMIT_SHAKE_CLASS, RollNumber, SectionHeader, SelectCompact, SelectField, StepRow, StepSlider, ToggleCard, ToggleRow, ValueSlider, counterState, itemListNote, overLimitText, useOverLimit } from "./inspector.js";
9
9
  import { Avatar, AvatarStack, Badge, Card, CardHeader, Dot, EmptyState, Kbd, PageHeader, Separator, SettingsSection, Skeleton, Stat, StatusMark, StatusPill, Table, Td, Th, Tr, avatarRingSpread, badgeVariants, colorFor, statusMap } from "./display.js";
10
10
  import { AGENT_PRESENCE, presenceColor, presenceSlot, registerPresenceRoster } from "./presence.js";
11
11
  import { Field, HelpMore, Input, Label, SearchInput, Textarea } from "./input.js";
@@ -21,4 +21,4 @@ import { Tab, TabList, TabPanel, Tabs } from "./tab.js";
21
21
  import { BUTTON_STYLES, BcmsMark, ButtonStylePicker, FoundationBadge, FoundationButton, FoundationCheckbox, FoundationTextField, InspectorPopover, ProBadge, SaveStatus, SearchClear, StatusIcon } from "./foundations.js";
22
22
  import { KitToaster, kitToast, kitToastManager } from "./toast.js";
23
23
  import { BlockIconPicker, BlockIconPickerPopover } from "./block-icon-picker.js";
24
- export { AGENT_PRESENCE, ActionTray, AuthorField, Autocomplete, Avatar, AvatarStack, BUTTON_STYLES, Badge, BcmsMark, BlockIconPicker, BlockIconPickerPopover, Button, ButtonStylePicker, CARD_TOOLTIP_CLASS, CODE_LANGUAGE_NAMES, Card, CardHeader, CardTooltip, Checkbox, ChoiceCard, ChoiceList, ChoiceSwitch, CodeLanguageMenu, CodeLanguagePopover, ColourSelect, CountRing, Dot, EmptyState, ExpandedEditorModal, FLOATING_LAYER, Field, FieldCounter, FieldDescribedByContext, FieldLabelledByContext, FieldSweep, FlowBody, FlowClose, FlowFooter, FlowHeader, FlowLabel, FlowModal, FocusDot, FoundationBadge, FoundationButton, FoundationCheckbox, FoundationTextField, GroupHeader, HeaderStatus, HelpMore, Highlight, HintTooltip, HoverCard, HoverCardContent, HoverCardTrigger, INSPECTOR_EASE, ITEM_DELETE_CLASS, ITEM_LIST_ADD_CLASS, ITEM_ROW_CLASS, ITEM_ROW_GRIP_CLASS, ITEM_ROW_MORE_CLASS, ITEM_ROW_SUB_CLASS, ITEM_ROW_TITLE_CLASS, IconButton, InfoGlyph, InfoTooltip, InlineRow, Input, InspectorBody, InspectorCollapse, InspectorDivider, InspectorField, InspectorFields, InspectorGroup, InspectorLocked, InspectorNote, InspectorPopover, InspectorSeg, InspectorSwitch, ItemDeleteButton, ItemListAdd, ItemListCard, ItemListNote, ItemRow, ItemRowMore, Kbd, KitToaster, LAYOUT_GLYPHS, Label, LayoutOpt, Menu, MenuCheckItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Modal, ModalBody, ModalClose, ModalContent, ModalFooter, ModalHeader, ModalTrigger, ModeBar, ModeBarDot, ModeBarLink, MoreOptions, OVER_LIMIT_CLASS, OptionRow, PageHeader, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, ProBadge, Progress, Radio, RadioGroup, RevealLink, RollNumber, SEARCH_THRESHOLD, SEGMENTED_MAX, SEGMENTED_MAX_LABEL, SaveStatus, SearchClear, SearchInput, SectionHeader, Segmented, Select, SelectCompact, SelectField, Separator, SettingsSection, Sheet, SheetClose, SheetContent, SheetTrigger, ShortcutHint, ShortcutHintsProvider, Skeleton, Slider, Sparkle, Spinner, Stat, StatusIcon, StatusMark, StatusPill, StepRow, StepSlider, Switch, Tab, TabList, TabPanel, Table, Tabs, TagsInput, Td, Textarea, Th, ToggleCard, ToggleGroup, ToggleItem, ToggleRow, Tooltip, TooltipProvider, TooltipScope, Tr, TrayMeta, TrayMore, ValueSlider, actionTrayClass, avatarRingSpread, badgeVariants, buttonVariants, colorFor, counterState, filterOptions, fitsSegmented, iconButtonVariants, itemListNote, kitToast, kitToastManager, matchPositions, matchScore, nodeText, overLimitText, platformKeys, presenceColor, presenceSlot, registerPresenceRoster, selectTriggerClass, shortcutHintsOn, statusMap, useFieldDescribedBy, useFieldId, useFieldLabelledBy, useFocusReturn, useShortcutHints };
24
+ export { AGENT_PRESENCE, ActionTray, AuthorField, Autocomplete, Avatar, AvatarStack, BUTTON_STYLES, Badge, BcmsMark, BlockIconPicker, BlockIconPickerPopover, Button, ButtonStylePicker, CARD_TOOLTIP_CLASS, CODE_LANGUAGE_NAMES, Card, CardHeader, CardTooltip, Checkbox, ChoiceCard, ChoiceList, ChoiceSwitch, CodeLanguageMenu, CodeLanguagePopover, ColourSelect, CountRing, Dot, EmptyState, ExpandedEditorModal, FLOATING_LAYER, Field, FieldCounter, FieldDescribedByContext, FieldLabelledByContext, FieldSweep, FlowBody, FlowClose, FlowFooter, FlowHeader, FlowLabel, FlowModal, FocusDot, FoundationBadge, FoundationButton, FoundationCheckbox, FoundationTextField, GroupHeader, HeaderStatus, HelpMore, Highlight, HintTooltip, HoverCard, HoverCardContent, HoverCardTrigger, INSPECTOR_EASE, ITEM_DELETE_CLASS, ITEM_LIST_ADD_CLASS, ITEM_ROW_CLASS, ITEM_ROW_GRIP_CLASS, ITEM_ROW_MORE_CLASS, ITEM_ROW_SUB_CLASS, ITEM_ROW_TITLE_CLASS, IconButton, InfoGlyph, InfoTooltip, InlineRow, Input, InspectorBody, InspectorCollapse, InspectorDivider, InspectorField, InspectorFields, InspectorGroup, InspectorLocked, InspectorNote, InspectorPopover, InspectorSeg, InspectorSwitch, ItemDeleteButton, ItemListAdd, ItemListCard, ItemListNote, ItemRow, ItemRowMore, Kbd, KitToaster, LAYOUT_GLYPHS, Label, LayoutOpt, Menu, MenuCheckItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Modal, ModalBody, ModalClose, ModalContent, ModalFooter, ModalHeader, ModalTrigger, ModeBar, ModeBarDot, ModeBarLink, MoreOptions, OVER_LIMIT_CLASS, OVER_LIMIT_EDGE_CLASS, OVER_LIMIT_SHAKE_CLASS, OptionRow, PageHeader, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, ProBadge, Progress, Radio, RadioGroup, RevealLink, RollNumber, SEARCH_THRESHOLD, SEGMENTED_MAX, SEGMENTED_MAX_LABEL, SaveStatus, SearchClear, SearchInput, SectionHeader, Segmented, Select, SelectCompact, SelectField, Separator, SettingsSection, Sheet, SheetClose, SheetContent, SheetTrigger, ShortcutHint, ShortcutHintsProvider, Skeleton, Slider, Sparkle, Spinner, Stat, StatusIcon, StatusMark, StatusPill, StepRow, StepSlider, Switch, Tab, TabList, TabPanel, Table, Tabs, TagsInput, Td, Textarea, Th, ToggleCard, ToggleGroup, ToggleItem, ToggleRow, Tooltip, TooltipProvider, TooltipScope, Tr, TrayMeta, TrayMore, ValueSlider, actionTrayClass, avatarRingSpread, badgeVariants, buttonVariants, colorFor, counterState, filterOptions, fitsSegmented, iconButtonVariants, itemListNote, kitToast, kitToastManager, matchPositions, matchScore, nodeText, overLimitText, platformKeys, presenceColor, presenceSlot, registerPresenceRoster, selectTriggerClass, shortcutHintsOn, statusMap, useFieldDescribedBy, useFieldId, useFieldLabelledBy, useFocusReturn, useOverLimit, useShortcutHints };
@@ -166,16 +166,34 @@ export declare function FieldCounter({ value, max, ring, size, className }: {
166
166
  size?: 11 | 12;
167
167
  className?: string;
168
168
  }): import("react/jsx-runtime").JSX.Element;
169
- /** A number that rolls (ui.jsx:371-378 `Roll`, faq.css:90-91): the new figure rises in from 6 below while the old one
170
- * lifts out, both blurred 2, in 0.16s. Tabular, so the text beside it does not move. */
169
+ /** A number that rolls (ui.jsx:371-378 `Roll`, faq.css:90-91), digit by digit (M20): each digit sits in its own 1ch
170
+ * tabular cell, keyed by its place from the right, so only a digit that changed moves: the new one rises in from below
171
+ * while the old one lifts out (transform + opacity, 160ms in, 120ms out, no blur). The number itself never remounts,
172
+ * and fast typing never queues: the latest value is always the one entering. Reduced motion: an instant swap. */
171
173
  export declare function RollNumber({ value, className }: {
172
174
  value: number | string;
173
175
  className?: string;
174
176
  }): import("react/jsx-runtime").JSX.Element;
175
177
  /** The line under a field that is over its limit, in the prototype's words (content.jsx:318). */
176
178
  export declare const overLimitText: (max: number) => string;
177
- /** Put on the input of a field that just went over its limit: the red inset edge and one 0.32s shake (content.css:618). */
178
- export declare const OVER_LIMIT_CLASS = "shadow-[inset_0_0_0_1px_var(--kit-insp-ring-over)] animate-[kit-insp-shake_0.32s_ease] motion-reduce:animate-none";
179
+ /** The red inset edge over a field's control box while its count is over the limit (content.css:618). Drawn on the
180
+ * box's ::after, so the input's own focus border cannot hide it. The box must be `relative`. */
181
+ export declare const OVER_LIMIT_EDGE_CLASS = "after:pointer-events-none after:absolute after:inset-0 after:rounded-[6px] after:shadow-[inset_0_0_0_1px_var(--kit-insp-ring-over)]";
182
+ /** One 0.32s shake as the count goes over (content.css:618-619); none under reduced motion. */
183
+ export declare const OVER_LIMIT_SHAKE_CLASS = "motion-safe:animate-[kit-insp-shake_0.32s_ease] motion-reduce:animate-none";
184
+ /** The edge and the shake together, for a box that is known to have just gone over. Prefer `useOverLimit`. */
185
+ export declare const OVER_LIMIT_CLASS = "after:pointer-events-none after:absolute after:inset-0 after:rounded-[6px] after:shadow-[inset_0_0_0_1px_var(--kit-insp-ring-over)] motion-safe:animate-[kit-insp-shake_0.32s_ease] motion-reduce:animate-none";
186
+ /**
187
+ * M20: the props for a field's control box (spread them on it). The edge shows while `over`; the shake class is added
188
+ * only when the count CROSSES the limit after mount, and leaves when its animation ends, so the shake plays once per
189
+ * crossing: never per keystroke, and never again when the box is hidden and shown while still over. A field that
190
+ * mounts already over shows the edge with no shake (nothing animates on first paint). Reduced motion (the OS, or a
191
+ * host <MotionConfig reducedMotion="always">): the edge only.
192
+ */
193
+ export declare function useOverLimit(over: boolean): {
194
+ className: string | undefined;
195
+ onAnimationEnd: (e: React.AnimationEvent<HTMLElement>) => void;
196
+ };
179
197
  /** Label left, control right in a fixed 194 column (kit.jsx:137, kit.css:50-55, 501-502). `meta` is the quiet current
180
198
  * value after the label ("M · 8 px"); `info` adds the info tooltip. */
181
199
  export declare function InlineRow({ label, meta, info, labelId, className, children, }: {