@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.
- package/dist/context.d.ts +8 -0
- package/dist/context.js.map +1 -1
- package/dist/controls/rich-text/block-tool.d.ts +1 -1
- package/dist/controls/rich-text/block-tool.js +1 -1
- package/dist/controls/rich-text/block-tool.js.map +1 -1
- package/dist/controls/rich-text/blocks.js +3 -1
- package/dist/controls/rich-text/blocks.js.map +1 -1
- package/dist/controls/rich-text/catalog.d.ts +26 -3
- package/dist/controls/rich-text/catalog.js +239 -58
- package/dist/controls/rich-text/catalog.js.map +1 -1
- package/dist/controls/rich-text/codec.d.ts +1 -1
- package/dist/controls/rich-text/codec.js +2 -1
- package/dist/controls/rich-text/codec.js.map +1 -1
- package/dist/controls/rich-text/dom.js +8 -3
- package/dist/controls/rich-text/dom.js.map +1 -1
- package/dist/controls/rich-text/editor.js +32 -6
- package/dist/controls/rich-text/editor.js.map +1 -1
- package/dist/controls/rich-text/rewriteSelection.d.ts +25 -0
- package/dist/controls/rich-text/rewriteSelection.js +28 -0
- package/dist/controls/rich-text/rewriteSelection.js.map +1 -0
- package/dist/controls/rich-text/slash-preview.js +18 -5
- package/dist/controls/rich-text/slash-preview.js.map +1 -1
- package/dist/controls/rich-text/table-grid.js +26 -21
- package/dist/controls/rich-text/table-grid.js.map +1 -1
- package/dist/controls/rich-text/toolbar.js +1 -0
- package/dist/controls/rich-text/toolbar.js.map +1 -1
- package/dist/controls/text.js +1 -1
- package/dist/controls/text.js.map +1 -1
- package/dist/engine/field-shell.js +8 -4
- package/dist/engine/field-shell.js.map +1 -1
- package/dist/engine/frame.js +3 -2
- package/dist/engine/frame.js.map +1 -1
- package/dist/engine/grouping.js +4 -3
- package/dist/engine/grouping.js.map +1 -1
- package/dist/engine/item-list.js +2 -2
- package/dist/engine/item-list.js.map +1 -1
- package/dist/engine/schema-form.d.ts +2 -0
- package/dist/engine/schema-form.js +2 -0
- package/dist/engine/schema-form.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/kit.css +6 -32
- package/dist/lib/reduced-motion.d.ts +1 -0
- package/dist/lib/reduced-motion.js +19 -0
- package/dist/lib/reduced-motion.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/theme.css +100 -0
- package/dist/tokens.css +6 -0
- package/dist/ui/content-fields.js +3 -2
- package/dist/ui/content-fields.js.map +1 -1
- package/dist/ui/controls.js +3 -2
- package/dist/ui/controls.js.map +1 -1
- package/dist/ui/floating-panel.js +3 -2
- package/dist/ui/floating-panel.js.map +1 -1
- package/dist/ui/foundations.js +3 -2
- package/dist/ui/foundations.js.map +1 -1
- package/dist/ui/index.js +2 -2
- package/dist/ui/inspector.d.ts +22 -4
- package/dist/ui/inspector.js +72 -27
- package/dist/ui/inspector.js.map +1 -1
- package/dist/ui/tab.js +3 -2
- package/dist/ui/tab.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","names":[],"sources":["../../src/controls/text.tsx"],"sourcesContent":["/**\n * TEXT — string · text · email · url · slug (V2 HEAD 9829bf1 kit/controls/text.tsx, DESIGN §8.2–8.3).\n * Founder rule: text grows to show its whole value, never clipped. Text entry gets NO focus ring or halo — the border\n * steps rest → hover → focus on the box only (prod CPO-069).\n *\n * Stored shapes (prod): string / longtext / email / slug / url (text + inputType \"url\") all store a plain string.\n * Slug keeps the backend's `^[a-z0-9]+(?:-[a-z0-9]+)*$`: keystrokes are filtered, and the stray hyphens typing leaves\n * (a trailing \"-\" before the next word) are tidied on blur.\n */\nimport * as React from \"react\";\nimport { IconAlertTriangle, IconExternalLink, IconMail, IconWorld } from \"@tabler/icons-react\";\nimport { cn } from \"../lib/cn\";\nimport { slugify } from \"../lib/utils\";\nimport { plainText } from \"../lib/schema\";\nimport { KitAddressContext, useForm, useKitEnv, useKitLook, useKitServices } from \"../context\";\nimport { Button, IconButton } from \"../ui/button\";\nimport { Input, Textarea } from \"../ui/input\";\nimport { Tooltip } from \"../ui/overlay\";\nimport { Checkbox } from \"../ui/controls\";\nimport type { ControlProps } from \"../types\";\n\nexport const str = (v: unknown) => (typeof v === \"string\" ? v : v == null ? \"\" : String(v));\n/** border-only focus (no halo) for text entry */\nexport const TEXT_FOCUS = \"focus:shadow-none focus-visible:shadow-none\";\n/** look \"v16\" text entry (F1342, prototype inspector.jsx:94, editor.css:416-418): #F5F5F5, radius 6, no edge at rest,\n * 13/18 -0.1625px #171717, placeholder #707070; hover #E9E9E9; focus #FAFAFA with the violet edge; red edge invalid */\nexport const V16_TEXT_SURFACE =\n \"rounded-[6px] border border-transparent bg-kit-insp-card px-2.5 text-[13px] leading-[18px] tracking-[-0.1625px] text-kit-insp-tip-title shadow-none placeholder:text-kit-group-sub transition-[background-color,border-color] duration-[120ms] ease-out hover:border-transparent hover:bg-kit-insp-field-hover focus:border-kit-insp-accent focus:bg-kit-insp-card-focus aria-[invalid=true]:border-kit-insp-error\";\n\n/** `FieldSchema.prefix` (F1344, F1215, F1217): the prototype `.inp-url`, 34 high, grey fill, the prefix 13/18 #A3A3A3\n * right before the value; violet edge while focused, red when invalid. A scheme prefix drops a typed scheme. */\nexport function PrefixedInput({ field, value, onChange, readOnly, id, invalid, onBlur }: Omit<ControlProps, \"path\" | \"parent\">) {\n const prefix = field.prefix ?? \"\";\n const scheme = /^[a-z][a-z0-9+.-]*:\\/\\/$/i.test(prefix);\n return (\n <label\n className={cn(\n \"flex h-[34px] w-full cursor-text items-center rounded-[6px] border border-transparent bg-kit-insp-card px-2.5 text-[13px] leading-[18px] text-kit-insp-ink transition-[background-color,border-color] duration-[120ms] ease-out\",\n \"hover:bg-kit-insp-field-hover focus-within:border-kit-insp-accent focus-within:bg-kit-insp-card-focus\",\n invalid && \"!border-kit-insp-error bg-kit-insp-card-focus\",\n readOnly && \"cursor-default\",\n )}\n >\n <span aria-hidden className=\"shrink-0 select-none whitespace-nowrap text-kit-insp-faint\">\n {prefix}\n </span>\n <input\n id={id}\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n spellCheck={false}\n placeholder={field.placeholder}\n onBlur={onBlur}\n onChange={(e) => {\n const v = e.target.value.replace(/\\r?\\n/g, \" \");\n onChange(scheme ? v.replace(/^[a-z][a-z0-9+.-]*:\\/\\//i, \"\") : v);\n }}\n className=\"min-w-0 flex-1 border-0 bg-transparent p-0 text-inherit outline-none placeholder:text-kit-fg-3\"\n />\n </label>\n );\n}\n\nexport function StringControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const { variant } = useKitEnv();\n const v16 = useKitLook() === \"v16\";\n if (field.prefix) return <PrefixedInput field={field} value={value} onChange={onChange} readOnly={readOnly} id={id} invalid={invalid} onBlur={onBlur} />;\n return (\n <Textarea\n id={id}\n rows={1}\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder={field.placeholder}\n onBlur={onBlur}\n onKeyDown={(e) => e.key === \"Enter\" && e.preventDefault()}\n onChange={(e) => onChange(e.target.value.replace(/\\r?\\n/g, \" \"))}\n className={cn(TEXT_FOCUS, \"min-h-8 py-1.5 leading-5\", variant === \"document\" && \"min-h-9 py-2\", v16 && cn(V16_TEXT_SURFACE, \"min-h-[34px] py-[7px]\"))}\n />\n );\n}\n\nexport function TextControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n // look v16 (F1343): 3 rows (72) at least, grows to 8 (162), scrolls after\n const v16 = useKitLook() === \"v16\";\n return (\n <Textarea\n id={id}\n rows={field.rows ?? 3}\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder={field.placeholder}\n onBlur={onBlur}\n onChange={(e) => onChange(e.target.value)}\n className={cn(TEXT_FOCUS, \"leading-5\", v16 && cn(V16_TEXT_SURFACE, \"max-h-[162px] min-h-[72px] overflow-y-auto py-2 transition-[height,background-color,border-color] duration-[160ms]\"))}\n />\n );\n}\n\nexport function EmailControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const { variant } = useKitEnv();\n return (\n <Input\n id={id}\n size={variant === \"document\" ? \"lg\" : \"md\"}\n type=\"email\"\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n onBlur={onBlur}\n placeholder={field.placeholder ?? \"name@company.com\"}\n leading={<IconMail stroke={1.5} />}\n onChange={(e) => onChange(e.target.value.trim())}\n className={TEXT_FOCUS}\n />\n );\n}\n\nexport function UrlControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const v = str(value);\n const { variant } = useKitEnv();\n if (field.prefix) return <PrefixedInput field={field} value={value} onChange={onChange} readOnly={readOnly} id={id} invalid={invalid} onBlur={onBlur} />;\n const open = /^https?:\\/\\/\\S+/.test(v);\n return (\n <Input\n id={id}\n size={variant === \"document\" ? \"lg\" : \"md\"}\n value={v}\n readOnly={readOnly}\n aria-invalid={invalid}\n onBlur={onBlur}\n placeholder={field.placeholder ?? \"https://example.com\"}\n onChange={(e) => onChange(e.target.value.trim())}\n leading={<IconWorld stroke={1.5} />}\n className={cn(TEXT_FOCUS, \"[&_input]:text-kit-accent-fg\")}\n trailing={\n open ? (\n <Tooltip content=\"Open link in a new tab\">\n <button\n type=\"button\"\n aria-label=\"Open link\"\n className=\"pointer-events-auto flex rounded-kit-md p-0.5 hover:bg-kit-selected hover:text-kit-fg\"\n onClick={() => window.open(v, \"_blank\", \"noopener\")}\n >\n <IconExternalLink className=\"size-4\" stroke={1.5} />\n </button>\n </Tooltip>\n ) : undefined\n }\n />\n );\n}\n\n/* ── Slug ──────────────────────────────────────────────────────────── */\nconst TITLE_KEYS = [\"title\", \"name\", \"heading\", \"question\", \"label\"];\n/** The text a slug follows: the first title-like sibling, else the document title. */\nexport function slugSource(parent: Record<string, unknown> | undefined, docTitle?: string) {\n for (const k of TITLE_KEYS) {\n const t = plainText(parent?.[k]);\n if (t) return t;\n }\n return docTitle ?? \"\";\n}\n/** What a keystroke may leave in a slug: lowercase letters, digits and hyphens (spaces become hyphens). */\nexport const slugTyping = (s: string) => s.toLowerCase().replace(/\\s+/g, \"-\").replace(/[^a-z0-9-]/g, \"\");\n/** The stored slug: no leading, trailing or doubled hyphens (the backend's pattern). */\nexport const slugTidy = (s: string) => slugTyping(s).replace(/-+/g, \"-\").replace(/^-|-$/g, \"\");\n\n/** Label-row \"Generate\" for slug fields (ACTIONS.slug; prod: ghost button in the label row). */\nexport function SlugGenerate({ parent, value, onChange, readOnly }: Pick<ControlProps, \"parent\" | \"value\" | \"onChange\" | \"readOnly\">) {\n const { docTitle } = useKitEnv();\n const src = slugSource(parent, docTitle);\n if (readOnly || !src) return null;\n const next = slugify(src);\n if (!next) return null;\n return (\n <Tooltip content={`Generate from “${src.length > 32 ? `${src.slice(0, 30)}…` : src}”`}>\n <Button size=\"xs\" variant=\"ghost\" className=\"h-5 px-1.5 text-kit-xs text-kit-fg-2\" disabled={next === value} onClick={() => onChange(next)}>\n Generate\n </Button>\n </Tooltip>\n );\n}\n\nexport function SlugControl({ value, onChange, readOnly, id, invalid, parent, path, onBlur }: ControlProps) {\n const v = str(value);\n const env = useKitEnv();\n const form = useForm();\n const { toast, redirectSlug, saveSlug } = useKitServices();\n const address = React.useContext(KitAddressContext);\n const src = slugSource(parent, env.docTitle);\n /* Follows the title until someone edits it or the document is published (CPO-087), V2's rule (`!env.isPublished`):\n a host that passes no isPublished (the dock) follows too, as the help line says. It reacts to a title edit, never\n to mounting, so opening a form writes nothing. */\n const following = React.useRef(!env.isPublished && (v === \"\" || v === slugify(src)));\n const seenSrc = React.useRef(src);\n React.useEffect(() => {\n if (seenSrc.current === src) return;\n seenSrc.current = src;\n if (!following.current || readOnly) return;\n const next = slugify(src);\n if (next && next !== v) onChange(next);\n }, [src]); // eslint-disable-line react-hooks/exhaustive-deps\n\n /* the address the site serves today: the published value, else (published doc, no published copy) the mount value.\n Only where the host says the slug IS the address: a slug prop or a key has no address to break. */\n const live = !env.slugIsAddress ? \"\" : form?.hasPublished ? str(form.publishedAt(path)) : env.isPublished ? str(form?.baselineAt(path) ?? \"\") : \"\";\n const [saving, setSaving] = React.useState(false);\n const [redirect, setRedirect] = React.useState(true);\n const [confirmed, setConfirmed] = React.useState<string | null>(null);\n const changedLive = !!live && live !== v && confirmed !== v;\n const host = env.urlPrefix?.replace(/^https?:\\/\\//, \"\");\n const url = host ? `https://${host}${v}` : \"\";\n /* REQ-5-7 (prototype inspector.jsx:994-998, editor.css:416-432): where the slug IS the address and the host knows\n the site's address, the field is the prototype's URL input: the host grey before \"/slug\", the stored value\n slash-less, and a typed character the address cannot hold kept on screen with the error under the field (the\n stored slug changes only to a valid one). */\n const urlField = !!(env.slugIsAddress && host);\n const [typed, setTyped] = React.useState<string | null>(null);\n const shown = typed ?? v;\n const slugBad = typed !== null && !/^[a-z0-9-]*$/.test(typed);\n\n return (\n <div className=\"flex flex-col gap-1.5\">\n {urlField ? (\n <div className=\"flex flex-col gap-1.5\">\n <label\n className={cn(\n \"flex h-[34px] w-full cursor-text items-center rounded-[6px] border border-transparent bg-kit-insp-card px-2.5 text-[13px] leading-[18px] text-kit-insp-ink transition-[background-color,border-color] duration-[120ms] ease-out\",\n \"focus-within:border-kit-insp-accent focus-within:bg-kit-insp-card-focus\",\n (slugBad || invalid) && \"!border-kit-insp-error bg-kit-insp-card-focus\",\n )}\n >\n <span aria-hidden className=\"shrink-0 select-none whitespace-nowrap text-kit-insp-faint\">\n {host!.replace(/\\/+$/, \"\")}\n </span>\n <input\n id={id}\n value={`/${shown}`}\n readOnly={readOnly}\n aria-invalid={slugBad || invalid}\n spellCheck={false}\n placeholder=\"/page-slug\"\n onChange={(e) => {\n following.current = false;\n const next = e.target.value.replace(/^\\/+/, \"\");\n if (/^[a-z0-9-]*$/.test(next)) {\n setTyped(null);\n onChange(next);\n } else setTyped(next);\n }}\n onBlur={() => {\n if (typed === null) {\n const tidy = slugTidy(v);\n if (tidy !== v) onChange(tidy);\n }\n onBlur?.();\n }}\n className=\"min-w-0 flex-1 border-0 bg-transparent p-0 text-inherit outline-none placeholder:text-kit-fg-3\"\n />\n </label>\n {slugBad ? <p className=\"text-[12px] leading-4 text-kit-insp-error\">Use lowercase letters, numbers and hyphens</p> : null}\n </div>\n ) : (\n <Input\n id={id}\n value={v}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder=\"empty-is-the-home-page\"\n className={cn(TEXT_FOCUS, \"font-kit-mono [&_input]:font-kit-mono\")}\n onChange={(e) => {\n following.current = false;\n onChange(slugTyping(e.target.value));\n }}\n onBlur={() => {\n const tidy = slugTidy(v);\n if (tidy !== v) onChange(tidy);\n onBlur?.();\n }}\n />\n )}\n {changedLive ? (\n <div className=\"flex flex-col gap-2 rounded-kit-md border border-kit-warning-line bg-kit-warning-soft px-3 py-2.5 text-kit-sm\">\n <p className=\"flex items-start gap-1.5 text-kit-warning-fg\">\n <IconAlertTriangle className=\"mt-0.5 size-4 shrink-0\" stroke={1.5} />\n <span>\n The old address <span className=\"font-kit-mono\">/{live}</span> will stop working.\n </span>\n </p>\n {/* only where the host files the redirect: the box must not promise one nothing creates */}\n {redirectSlug ? (\n <label className=\"flex items-center gap-2 text-kit-fg-2\">\n <Checkbox checked={redirect} onCheckedChange={(c) => setRedirect(c === true)} nativeButton render={<button type=\"button\" />} />\n Redirect it to the new address\n </label>\n ) : null}\n <div className=\"flex gap-1.5\">\n <Button\n size=\"xs\"\n variant=\"primary\"\n disabled={saving}\n onClick={async () => {\n const from = live;\n const to = v;\n const redirected = redirect && !!redirectSlug;\n setSaving(true);\n try {\n if (saveSlug) await saveSlug(to);\n } catch (err) {\n setSaving(false);\n toast?.(\"Couldn't save the new address\", { description: errorText(err) });\n return;\n }\n setSaving(false);\n setConfirmed(to);\n if (redirected) {\n try {\n await redirectSlug(from, to);\n } catch (err) {\n toast?.(\"New address saved. The redirect wasn't created\", { description: errorText(err) });\n return;\n }\n }\n toast?.success(\"New address saved\", { description: redirected ? `/${from} now redirects to /${to}` : `/${from} will return “Not found”` });\n }}\n >\n Save new address\n </Button>\n <Button\n size=\"xs\"\n variant=\"ghost\"\n onClick={() => {\n following.current = false;\n onChange(live);\n }}\n >\n Keep the old slug\n </Button>\n </div>\n </div>\n ) : null}\n {address ? (\n address(v)\n ) : url && host ? (\n <AddressLine\n url={url}\n domain={host.replace(/\\/.*$/, \"\")}\n status={env.isPublished === undefined ? undefined : env.isPublished ? { live: true, label: \"Live\" } : { live: false, label: \"Not live yet\" }}\n onCopy={() => {\n void navigator.clipboard?.writeText(url).then(\n () => toast?.success(\"Address copied\", { description: url }),\n () => toast?.(\"Couldn't copy the address\", { description: \"The browser blocked clipboard access.\" }),\n );\n }}\n >\n {env.isPublished ? (\n <IconButton size=\"xs\" label=\"Open live\" onClick={() => window.open(url, \"_blank\", \"noopener\")}>\n <IconExternalLink stroke={1.5} />\n </IconButton>\n ) : null}\n </AddressLine>\n ) : null}\n </div>\n );\n}\n\n/** A host's refusal as one line (an Error's message, else the value itself). */\nconst errorText = (err: unknown) => (err instanceof Error ? err.message : String(err));\n\n/* V2 features/hosting/address-line.tsx (D66): one calm line under the slug — the mono URL (middle-truncated so the slug\n end stays; full URL in the tooltip; copies on click) · the live state as a dot and a word · trailing icon buttons. */\nfunction splitTail(display: string): [string, string] {\n const cut = display.indexOf(\"/\") >= 0 ? display.lastIndexOf(\"/\") : -1;\n let tail = cut > 0 ? display.slice(cut) : \"\";\n if (tail.length > 18) tail = tail.slice(-14);\n return [display.slice(0, display.length - tail.length), tail];\n}\n\nfunction AddressLine({ url, domain, status, onCopy, children }: { url: string; domain: string; status?: { live: boolean; label: string }; onCopy: () => void; children?: React.ReactNode }) {\n const display = url.replace(/^https?:\\/\\//, \"\");\n const [head, tail] = splitTail(display);\n const domainPart = head.startsWith(domain) ? domain : \"\";\n return (\n <div className=\"flex h-6 min-w-0 items-center gap-2\">\n <Tooltip content={<span className=\"font-kit-mono\">{display}</span>}>\n <button\n type=\"button\"\n onClick={onCopy}\n aria-label={`Copy address ${url}`}\n className=\"-ml-1 flex h-6 min-w-0 items-center rounded-kit-md px-1 font-kit-mono text-kit-xs text-kit-fg-2 transition-colors hover:bg-kit-hover hover:text-kit-fg\"\n >\n <span className=\"min-w-0 truncate\">\n {domainPart ? <span className=\"text-kit-fg-3\">{domainPart}</span> : null}\n {head.slice(domainPart.length)}\n </span>\n {tail ? <span className=\"shrink-0 whitespace-pre\">{tail}</span> : null}\n </button>\n </Tooltip>\n <span className=\"ml-auto flex shrink-0 items-center gap-1.5\">\n {status ? (\n <span className=\"mr-0.5 inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap text-kit-xs text-kit-fg-2\">\n <span aria-hidden className={cn(\"size-1.5 shrink-0 rounded-full\", status.live ? \"bg-kit-success\" : \"bg-kit-fg-4\")} />\n {status.label}\n </span>\n ) : null}\n {children ? <span className=\"flex items-center gap-0.5\">{children}</span> : null}\n </span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,OAAO,MAAgB,OAAO,MAAM,WAAW,IAAI,KAAK,OAAO,KAAK,OAAO,CAAC;;AAEzF,IAAa,aAAa;;;AAG1B,IAAa,mBACX;;;AAIF,SAAgB,cAAc,EAAE,OAAO,OAAO,UAAU,UAAU,IAAI,SAAS,UAAiD;CAC9H,MAAM,SAAS,MAAM,UAAU;CAC/B,MAAM,SAAS,4BAA4B,KAAK,MAAM;CACtD,OACE,qBAAC,SAAD;EACE,WAAW,GACT,mOACA,yGACA,WAAW,iDACX,YAAY,gBACd;EANF,UAAA,CAQE,oBAAC,QAAD;GAAM,eAAA;GAAY,WAAU;GACzB,UAAA;EACG,CAAA,GACN,oBAAC,SAAD;GACM;GACJ,OAAO,IAAI,KAAK;GACN;GACV,gBAAc;GACd,YAAY;GACZ,aAAa,MAAM;GACX;GACR,WAAW,MAAM;IACf,MAAM,IAAI,EAAE,OAAO,MAAM,QAAQ,UAAU,GAAG;IAC9C,SAAS,SAAS,EAAE,QAAQ,4BAA4B,EAAE,IAAI,CAAC;GACjE;GACA,WAAU;EACX,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· slug (V2 HEAD 9829bf1 kit/controls/text.tsx, DESIGN §8.2–8.3).\n * Founder rule: text grows to show its whole value, never clipped. Text entry gets NO focus ring or halo — the border\n * steps rest → hover → focus on the box only (prod CPO-069).\n *\n * Stored shapes (prod): string / longtext / email / slug / url (text + inputType \"url\") all store a plain string.\n * Slug keeps the backend's `^[a-z0-9]+(?:-[a-z0-9]+)*$`: keystrokes are filtered, and the stray hyphens typing leaves\n * (a trailing \"-\" before the next word) are tidied on blur.\n */\nimport * as React from \"react\";\nimport { IconAlertTriangle, IconExternalLink, IconMail, IconWorld } from \"@tabler/icons-react\";\nimport { cn } from \"../lib/cn\";\nimport { slugify } from \"../lib/utils\";\nimport { plainText } from \"../lib/schema\";\nimport { KitAddressContext, useForm, useKitEnv, useKitLook, useKitServices } from \"../context\";\nimport { Button, IconButton } from \"../ui/button\";\nimport { Input, Textarea } from \"../ui/input\";\nimport { Tooltip } from \"../ui/overlay\";\nimport { Checkbox } from \"../ui/controls\";\nimport type { ControlProps } from \"../types\";\n\nexport const str = (v: unknown) => (typeof v === \"string\" ? v : v == null ? \"\" : String(v));\n/** border-only focus (no halo) for text entry */\nexport const TEXT_FOCUS = \"focus:shadow-none focus-visible:shadow-none\";\n/** look \"v16\" text entry (F1342, prototype inspector.jsx:94, editor.css:416-418): #F5F5F5, radius 6, no edge at rest,\n * 13/18 -0.1625px #171717, placeholder #707070; hover #E9E9E9; focus #FAFAFA with the violet edge; red edge invalid */\nexport const V16_TEXT_SURFACE =\n \"rounded-[6px] border border-transparent bg-kit-insp-card px-2.5 text-[13px] leading-[18px] tracking-[-0.1625px] text-kit-insp-tip-title shadow-none placeholder:text-kit-group-sub transition-[background-color,border-color] duration-[120ms] ease-out hover:border-transparent hover:bg-kit-insp-field-hover focus:border-kit-insp-accent focus:bg-kit-insp-card-focus aria-[invalid=true]:border-kit-insp-error\";\n\n/** `FieldSchema.prefix` (F1344, F1215, F1217): the prototype `.inp-url`, 34 high, grey fill, the prefix 13/18 #A3A3A3\n * right before the value; violet edge while focused, red when invalid. A scheme prefix drops a typed scheme. */\nexport function PrefixedInput({ field, value, onChange, readOnly, id, invalid, onBlur }: Omit<ControlProps, \"path\" | \"parent\">) {\n const prefix = field.prefix ?? \"\";\n const scheme = /^[a-z][a-z0-9+.-]*:\\/\\/$/i.test(prefix);\n return (\n <label\n className={cn(\n \"flex h-[34px] w-full cursor-text items-center rounded-[6px] border border-transparent bg-kit-insp-card px-2.5 text-[13px] leading-[18px] text-kit-insp-ink transition-[background-color,border-color] duration-[120ms] ease-out\",\n \"hover:bg-kit-insp-field-hover focus-within:border-kit-insp-accent focus-within:bg-kit-insp-card-focus\",\n invalid && \"!border-kit-insp-error bg-kit-insp-card-focus\",\n readOnly && \"cursor-default\",\n )}\n >\n <span aria-hidden className=\"shrink-0 select-none whitespace-nowrap text-kit-insp-faint\">\n {prefix}\n </span>\n <input\n id={id}\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n spellCheck={false}\n placeholder={field.placeholder}\n onBlur={onBlur}\n onChange={(e) => {\n const v = e.target.value.replace(/\\r?\\n/g, \" \");\n onChange(scheme ? v.replace(/^[a-z][a-z0-9+.-]*:\\/\\//i, \"\") : v);\n }}\n className=\"min-w-0 flex-1 border-0 bg-transparent p-0 text-inherit outline-none placeholder:text-kit-fg-3\"\n />\n </label>\n );\n}\n\nexport function StringControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const { variant } = useKitEnv();\n const v16 = useKitLook() === \"v16\";\n if (field.prefix) return <PrefixedInput field={field} value={value} onChange={onChange} readOnly={readOnly} id={id} invalid={invalid} onBlur={onBlur} />;\n return (\n <Textarea\n id={id}\n rows={1}\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder={field.placeholder}\n onBlur={onBlur}\n onKeyDown={(e) => e.key === \"Enter\" && e.preventDefault()}\n onChange={(e) => onChange(e.target.value.replace(/\\r?\\n/g, \" \"))}\n className={cn(TEXT_FOCUS, \"min-h-8 py-1.5 leading-5\", variant === \"document\" && \"min-h-9 py-2\", v16 && cn(V16_TEXT_SURFACE, \"min-h-[34px] py-[7px]\"))}\n />\n );\n}\n\nexport function TextControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n // look v16 (F1343): 3 rows (72) at least, grows to 8 (162), scrolls after. The autosize snaps (height is never\n // transitioned: a layout animation per keystroke); only the fill and the edge ease.\n const v16 = useKitLook() === \"v16\";\n return (\n <Textarea\n id={id}\n rows={field.rows ?? 3}\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder={field.placeholder}\n onBlur={onBlur}\n onChange={(e) => onChange(e.target.value)}\n className={cn(TEXT_FOCUS, \"leading-5\", v16 && cn(V16_TEXT_SURFACE, \"max-h-[162px] min-h-[72px] overflow-y-auto py-2 transition-[background-color,border-color] duration-[160ms]\"))}\n />\n );\n}\n\nexport function EmailControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const { variant } = useKitEnv();\n return (\n <Input\n id={id}\n size={variant === \"document\" ? \"lg\" : \"md\"}\n type=\"email\"\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n onBlur={onBlur}\n placeholder={field.placeholder ?? \"name@company.com\"}\n leading={<IconMail stroke={1.5} />}\n onChange={(e) => onChange(e.target.value.trim())}\n className={TEXT_FOCUS}\n />\n );\n}\n\nexport function UrlControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const v = str(value);\n const { variant } = useKitEnv();\n if (field.prefix) return <PrefixedInput field={field} value={value} onChange={onChange} readOnly={readOnly} id={id} invalid={invalid} onBlur={onBlur} />;\n const open = /^https?:\\/\\/\\S+/.test(v);\n return (\n <Input\n id={id}\n size={variant === \"document\" ? \"lg\" : \"md\"}\n value={v}\n readOnly={readOnly}\n aria-invalid={invalid}\n onBlur={onBlur}\n placeholder={field.placeholder ?? \"https://example.com\"}\n onChange={(e) => onChange(e.target.value.trim())}\n leading={<IconWorld stroke={1.5} />}\n className={cn(TEXT_FOCUS, \"[&_input]:text-kit-accent-fg\")}\n trailing={\n open ? (\n <Tooltip content=\"Open link in a new tab\">\n <button\n type=\"button\"\n aria-label=\"Open link\"\n className=\"pointer-events-auto flex rounded-kit-md p-0.5 hover:bg-kit-selected hover:text-kit-fg\"\n onClick={() => window.open(v, \"_blank\", \"noopener\")}\n >\n <IconExternalLink className=\"size-4\" stroke={1.5} />\n </button>\n </Tooltip>\n ) : undefined\n }\n />\n );\n}\n\n/* ── Slug ──────────────────────────────────────────────────────────── */\nconst TITLE_KEYS = [\"title\", \"name\", \"heading\", \"question\", \"label\"];\n/** The text a slug follows: the first title-like sibling, else the document title. */\nexport function slugSource(parent: Record<string, unknown> | undefined, docTitle?: string) {\n for (const k of TITLE_KEYS) {\n const t = plainText(parent?.[k]);\n if (t) return t;\n }\n return docTitle ?? \"\";\n}\n/** What a keystroke may leave in a slug: lowercase letters, digits and hyphens (spaces become hyphens). */\nexport const slugTyping = (s: string) => s.toLowerCase().replace(/\\s+/g, \"-\").replace(/[^a-z0-9-]/g, \"\");\n/** The stored slug: no leading, trailing or doubled hyphens (the backend's pattern). */\nexport const slugTidy = (s: string) => slugTyping(s).replace(/-+/g, \"-\").replace(/^-|-$/g, \"\");\n\n/** Label-row \"Generate\" for slug fields (ACTIONS.slug; prod: ghost button in the label row). */\nexport function SlugGenerate({ parent, value, onChange, readOnly }: Pick<ControlProps, \"parent\" | \"value\" | \"onChange\" | \"readOnly\">) {\n const { docTitle } = useKitEnv();\n const src = slugSource(parent, docTitle);\n if (readOnly || !src) return null;\n const next = slugify(src);\n if (!next) return null;\n return (\n <Tooltip content={`Generate from “${src.length > 32 ? `${src.slice(0, 30)}…` : src}”`}>\n <Button size=\"xs\" variant=\"ghost\" className=\"h-5 px-1.5 text-kit-xs text-kit-fg-2\" disabled={next === value} onClick={() => onChange(next)}>\n Generate\n </Button>\n </Tooltip>\n );\n}\n\nexport function SlugControl({ value, onChange, readOnly, id, invalid, parent, path, onBlur }: ControlProps) {\n const v = str(value);\n const env = useKitEnv();\n const form = useForm();\n const { toast, redirectSlug, saveSlug } = useKitServices();\n const address = React.useContext(KitAddressContext);\n const src = slugSource(parent, env.docTitle);\n /* Follows the title until someone edits it or the document is published (CPO-087), V2's rule (`!env.isPublished`):\n a host that passes no isPublished (the dock) follows too, as the help line says. It reacts to a title edit, never\n to mounting, so opening a form writes nothing. */\n const following = React.useRef(!env.isPublished && (v === \"\" || v === slugify(src)));\n const seenSrc = React.useRef(src);\n React.useEffect(() => {\n if (seenSrc.current === src) return;\n seenSrc.current = src;\n if (!following.current || readOnly) return;\n const next = slugify(src);\n if (next && next !== v) onChange(next);\n }, [src]); // eslint-disable-line react-hooks/exhaustive-deps\n\n /* the address the site serves today: the published value, else (published doc, no published copy) the mount value.\n Only where the host says the slug IS the address: a slug prop or a key has no address to break. */\n const live = !env.slugIsAddress ? \"\" : form?.hasPublished ? str(form.publishedAt(path)) : env.isPublished ? str(form?.baselineAt(path) ?? \"\") : \"\";\n const [saving, setSaving] = React.useState(false);\n const [redirect, setRedirect] = React.useState(true);\n const [confirmed, setConfirmed] = React.useState<string | null>(null);\n const changedLive = !!live && live !== v && confirmed !== v;\n const host = env.urlPrefix?.replace(/^https?:\\/\\//, \"\");\n const url = host ? `https://${host}${v}` : \"\";\n /* REQ-5-7 (prototype inspector.jsx:994-998, editor.css:416-432): where the slug IS the address and the host knows\n the site's address, the field is the prototype's URL input: the host grey before \"/slug\", the stored value\n slash-less, and a typed character the address cannot hold kept on screen with the error under the field (the\n stored slug changes only to a valid one). */\n const urlField = !!(env.slugIsAddress && host);\n const [typed, setTyped] = React.useState<string | null>(null);\n const shown = typed ?? v;\n const slugBad = typed !== null && !/^[a-z0-9-]*$/.test(typed);\n\n return (\n <div className=\"flex flex-col gap-1.5\">\n {urlField ? (\n <div className=\"flex flex-col gap-1.5\">\n <label\n className={cn(\n \"flex h-[34px] w-full cursor-text items-center rounded-[6px] border border-transparent bg-kit-insp-card px-2.5 text-[13px] leading-[18px] text-kit-insp-ink transition-[background-color,border-color] duration-[120ms] ease-out\",\n \"focus-within:border-kit-insp-accent focus-within:bg-kit-insp-card-focus\",\n (slugBad || invalid) && \"!border-kit-insp-error bg-kit-insp-card-focus\",\n )}\n >\n <span aria-hidden className=\"shrink-0 select-none whitespace-nowrap text-kit-insp-faint\">\n {host!.replace(/\\/+$/, \"\")}\n </span>\n <input\n id={id}\n value={`/${shown}`}\n readOnly={readOnly}\n aria-invalid={slugBad || invalid}\n spellCheck={false}\n placeholder=\"/page-slug\"\n onChange={(e) => {\n following.current = false;\n const next = e.target.value.replace(/^\\/+/, \"\");\n if (/^[a-z0-9-]*$/.test(next)) {\n setTyped(null);\n onChange(next);\n } else setTyped(next);\n }}\n onBlur={() => {\n if (typed === null) {\n const tidy = slugTidy(v);\n if (tidy !== v) onChange(tidy);\n }\n onBlur?.();\n }}\n className=\"min-w-0 flex-1 border-0 bg-transparent p-0 text-inherit outline-none placeholder:text-kit-fg-3\"\n />\n </label>\n {slugBad ? <p className=\"text-[12px] leading-4 text-kit-insp-error\">Use lowercase letters, numbers and hyphens</p> : null}\n </div>\n ) : (\n <Input\n id={id}\n value={v}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder=\"empty-is-the-home-page\"\n className={cn(TEXT_FOCUS, \"font-kit-mono [&_input]:font-kit-mono\")}\n onChange={(e) => {\n following.current = false;\n onChange(slugTyping(e.target.value));\n }}\n onBlur={() => {\n const tidy = slugTidy(v);\n if (tidy !== v) onChange(tidy);\n onBlur?.();\n }}\n />\n )}\n {changedLive ? (\n <div className=\"flex flex-col gap-2 rounded-kit-md border border-kit-warning-line bg-kit-warning-soft px-3 py-2.5 text-kit-sm\">\n <p className=\"flex items-start gap-1.5 text-kit-warning-fg\">\n <IconAlertTriangle className=\"mt-0.5 size-4 shrink-0\" stroke={1.5} />\n <span>\n The old address <span className=\"font-kit-mono\">/{live}</span> will stop working.\n </span>\n </p>\n {/* only where the host files the redirect: the box must not promise one nothing creates */}\n {redirectSlug ? (\n <label className=\"flex items-center gap-2 text-kit-fg-2\">\n <Checkbox checked={redirect} onCheckedChange={(c) => setRedirect(c === true)} nativeButton render={<button type=\"button\" />} />\n Redirect it to the new address\n </label>\n ) : null}\n <div className=\"flex gap-1.5\">\n <Button\n size=\"xs\"\n variant=\"primary\"\n disabled={saving}\n onClick={async () => {\n const from = live;\n const to = v;\n const redirected = redirect && !!redirectSlug;\n setSaving(true);\n try {\n if (saveSlug) await saveSlug(to);\n } catch (err) {\n setSaving(false);\n toast?.(\"Couldn't save the new address\", { description: errorText(err) });\n return;\n }\n setSaving(false);\n setConfirmed(to);\n if (redirected) {\n try {\n await redirectSlug(from, to);\n } catch (err) {\n toast?.(\"New address saved. The redirect wasn't created\", { description: errorText(err) });\n return;\n }\n }\n toast?.success(\"New address saved\", { description: redirected ? `/${from} now redirects to /${to}` : `/${from} will return “Not found”` });\n }}\n >\n Save new address\n </Button>\n <Button\n size=\"xs\"\n variant=\"ghost\"\n onClick={() => {\n following.current = false;\n onChange(live);\n }}\n >\n Keep the old slug\n </Button>\n </div>\n </div>\n ) : null}\n {address ? (\n address(v)\n ) : url && host ? (\n <AddressLine\n url={url}\n domain={host.replace(/\\/.*$/, \"\")}\n status={env.isPublished === undefined ? undefined : env.isPublished ? { live: true, label: \"Live\" } : { live: false, label: \"Not live yet\" }}\n onCopy={() => {\n void navigator.clipboard?.writeText(url).then(\n () => toast?.success(\"Address copied\", { description: url }),\n () => toast?.(\"Couldn't copy the address\", { description: \"The browser blocked clipboard access.\" }),\n );\n }}\n >\n {env.isPublished ? (\n <IconButton size=\"xs\" label=\"Open live\" onClick={() => window.open(url, \"_blank\", \"noopener\")}>\n <IconExternalLink stroke={1.5} />\n </IconButton>\n ) : null}\n </AddressLine>\n ) : null}\n </div>\n );\n}\n\n/** A host's refusal as one line (an Error's message, else the value itself). */\nconst errorText = (err: unknown) => (err instanceof Error ? err.message : String(err));\n\n/* V2 features/hosting/address-line.tsx (D66): one calm line under the slug — the mono URL (middle-truncated so the slug\n end stays; full URL in the tooltip; copies on click) · the live state as a dot and a word · trailing icon buttons. */\nfunction splitTail(display: string): [string, string] {\n const cut = display.indexOf(\"/\") >= 0 ? display.lastIndexOf(\"/\") : -1;\n let tail = cut > 0 ? display.slice(cut) : \"\";\n if (tail.length > 18) tail = tail.slice(-14);\n return [display.slice(0, display.length - tail.length), tail];\n}\n\nfunction AddressLine({ url, domain, status, onCopy, children }: { url: string; domain: string; status?: { live: boolean; label: string }; onCopy: () => void; children?: React.ReactNode }) {\n const display = url.replace(/^https?:\\/\\//, \"\");\n const [head, tail] = splitTail(display);\n const domainPart = head.startsWith(domain) ? domain : \"\";\n return (\n <div className=\"flex h-6 min-w-0 items-center gap-2\">\n <Tooltip content={<span className=\"font-kit-mono\">{display}</span>}>\n <button\n type=\"button\"\n onClick={onCopy}\n aria-label={`Copy address ${url}`}\n className=\"-ml-1 flex h-6 min-w-0 items-center rounded-kit-md px-1 font-kit-mono text-kit-xs text-kit-fg-2 transition-colors hover:bg-kit-hover hover:text-kit-fg\"\n >\n <span className=\"min-w-0 truncate\">\n {domainPart ? <span className=\"text-kit-fg-3\">{domainPart}</span> : null}\n {head.slice(domainPart.length)}\n </span>\n {tail ? <span className=\"shrink-0 whitespace-pre\">{tail}</span> : null}\n </button>\n </Tooltip>\n <span className=\"ml-auto flex shrink-0 items-center gap-1.5\">\n {status ? (\n <span className=\"mr-0.5 inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap text-kit-xs text-kit-fg-2\">\n <span aria-hidden className={cn(\"size-1.5 shrink-0 rounded-full\", status.live ? \"bg-kit-success\" : \"bg-kit-fg-4\")} />\n {status.label}\n </span>\n ) : null}\n {children ? <span className=\"flex items-center gap-0.5\">{children}</span> : null}\n </span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,OAAO,MAAgB,OAAO,MAAM,WAAW,IAAI,KAAK,OAAO,KAAK,OAAO,CAAC;;AAEz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AM,WAAU;MAAiB,UAAA;KAAiB,CAAA,IAAI,MACnE,KAAK,MAAM,WAAW,MAAM,CACzB;IACL,CAAA,GAAA,OAAO,oBAAC,QAAD;KAAM,WAAU;KAA2B,UAAA;IAAW,CAAA,IAAI,IAC5D;;EACD,CAAA,GACT,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACG,SACC,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,oBAAC,QAAD;KAAM,eAAA;KAAY,WAAW,GAAG,kCAAkC,OAAO,OAAO,mBAAmB,aAAa;IAAI,CAAA,GACnH,OAAO,KACJ;GACJ,CAAA,IAAA,MACH,WAAW,oBAAC,QAAD;IAAM,WAAU;IAA6B;GAAe,CAAA,IAAI,IACxE;EACH,CAAA,CAAA;;AAET"}
|
|
@@ -5,7 +5,7 @@ import { AI_PRESETS, FieldHeaderSlot, KitSectionTitle, seesDevSurfaces, useForm,
|
|
|
5
5
|
import { Button, Sparkle } from "../ui/button.js";
|
|
6
6
|
import { InfoTooltip } from "../ui/tooltip-card.js";
|
|
7
7
|
import { Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Popover, PopoverAnchor, PopoverContent, Tooltip } from "../ui/overlay.js";
|
|
8
|
-
import { FieldCounter, FieldSweep, FocusDot, counterState, overLimitText } from "../ui/inspector.js";
|
|
8
|
+
import { FieldCounter, FieldSweep, FocusDot, counterState, overLimitText, useOverLimit } from "../ui/inspector.js";
|
|
9
9
|
import { RowChrome } from "./bits.js";
|
|
10
10
|
import { Avatar, avatarRingSpread } from "../ui/display.js";
|
|
11
11
|
import { presenceColor } from "../ui/presence.js";
|
|
@@ -156,9 +156,12 @@ function FieldShell({ field, path, id, value, onChange, readOnly, issue, action,
|
|
|
156
156
|
const limit = field.validation?.max ?? field.validation?.recommendedMax;
|
|
157
157
|
const len = textLength(value);
|
|
158
158
|
const near = !!limit && len >= limit * .8;
|
|
159
|
-
const
|
|
159
|
+
const counted = !!limit && (field.type === "string" || field.type === "text" || field.type === "richtext");
|
|
160
|
+
const overLimit = useOverLimit(v16 && counted && counterState(len, limit) === "over");
|
|
161
|
+
const counter = counted ? v16 ? counterState(len, limit) === "ok" ? null : /* @__PURE__ */ jsx(FieldCounter, {
|
|
160
162
|
value: len,
|
|
161
|
-
max: limit
|
|
163
|
+
max: limit,
|
|
164
|
+
size: env.counterSize ?? 11
|
|
162
165
|
}) : /* @__PURE__ */ jsxs("span", {
|
|
163
166
|
"data-slot": "field-counter",
|
|
164
167
|
className: cn("tabular-nums text-kit-xs", !near && "hidden group-focus-within/field:inline", field.validation?.max && len > field.validation.max ? "text-kit-danger-fg" : field.validation?.recommendedMax && len > field.validation.recommendedMax ? "text-kit-warning-fg" : "text-kit-fg-3"),
|
|
@@ -363,7 +366,8 @@ function FieldShell({ field, path, id, value, onChange, readOnly, issue, action,
|
|
|
363
366
|
})
|
|
364
367
|
] });
|
|
365
368
|
const control = /* @__PURE__ */ jsx("div", {
|
|
366
|
-
className: cn("relative", editor && "[&_.border-kit-field-border]:border-[var(--peer)]"),
|
|
369
|
+
className: cn("relative", editor && "[&_.border-kit-field-border]:border-[var(--peer)]", overLimit.className),
|
|
370
|
+
onAnimationEnd: overLimit.onAnimationEnd,
|
|
367
371
|
style: editor ? { "--peer": editor.color ?? presenceColor(editor.id ?? editor.name) } : void 0,
|
|
368
372
|
children
|
|
369
373
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-shell.js","names":[],"sources":["../../src/engine/field-shell.tsx"],"sourcesContent":["/**\n * FIELD SHELL — the one field chrome (V2 HEAD 9829bf1 kit/engine/field-shell.tsx; production FieldShell + CPO D8).\n *\n * [Label *] [ⓘ] [override dot] [changed dot] [synced] [EN] …… [42 / 60] [action] [Reset] [undo] [comments] [presence] [⋯]\n * help text (CPO D39: 12/16 --fg-3, 4px under the label, 1–2 lines; hidden while an error shows)\n * ┌ control ───────────────────────────────┐ ← peer editing: the control's border in their colour\n * └────────────────────────────────────────┘\n * error / warning message ……………………… meta (42 / 60)\n *\n * Accessories (add-comment, ⋯) take NO space at rest; they appear on hover/focus (always on touch). A comment\n * COUNT chip is always visible. AI lives in ⋯ (\"Rewrite with AI\"), never as a label sparkle (CPO-142).\n *\n * Services (toast, AI rewrite, in-place comments) come from KitServices; a missing service hides its surface.\n */\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport {\n IconAlertCircle, IconAlertTriangle, IconArrowBackUp, IconBraces, IconClipboard, IconCopy, IconDots, IconHistory, IconInfoCircle,\n IconLock, IconMessage, IconMessagePlus, IconRefresh, IconRotate, IconWorld,\n} from \"@tabler/icons-react\";\nimport { IconEraser as IconClearField, IconLink as IconFieldLink, IconRestore as IconResetDefault } from \"@tabler/icons-react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { Button, Sparkle } from \"../ui/button\";\nimport { Avatar, avatarRingSpread } from \"../ui/display\";\nimport { Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Popover, PopoverAnchor, PopoverContent, Tooltip } from \"../ui/overlay\";\nimport { presenceColor } from \"../ui/presence\";\nimport { cn } from \"../lib/cn\";\nimport { HISTORY_SEGMENT, type FieldPath, type FieldSchema } from \"../schema/types\";\nimport { resolveHelp } from \"../schema/help\";\nimport { AI_PRESETS, FieldHeaderSlot, KitSectionTitle, seesDevSurfaces, useForm, useKitEnv, useKitFocusField, useKitLook, useKitServices, type AiPreset, type KitCommentSelection, type KitPeer } from \"../context\";\nimport { FieldCounter, FieldSweep, FocusDot, counterState, overLimitText } from \"../ui/inspector\";\nimport { InfoTooltip } from \"../ui/tooltip-card\";\nimport { pathKey, same } from \"../lib/path\";\nimport { emptyFor, initialFor, isEmptyValue, isTextual, plainText } from \"../lib/schema\";\nimport { textLength, type KitIssue } from \"../lib/validate\";\nimport { RowChrome } from \"./bits\";\n\n/* ── Clipboard shared by every field (typed, so Paste can refuse with a reason) ── */\n/** `html`: a rich text value as its editor html (read through the host's codec), so Paste re-stores it for the target field. */\nlet clip: { type: string; value: unknown; label: string; html?: string } | null = null;\n/** Test seam: forget the shared field clipboard. */\nexport const resetFieldClipboard = () => {\n clip = null;\n};\nconst KIND: Record<string, string> = { image: \"an image\", file: \"a file\", video: \"a video\", reference: \"a reference\", link: \"a link\", button: \"a button\", array: \"a list\", slot: \"blocks\", object: \"a group of fields\", boolean: \"an on/off value\", number: \"a number\", color: \"a colour\" };\nconst kindOf = (t: string) => (isTextual(t as FieldSchema[\"type\"]) ? \"text\" : KIND[t] ?? t);\n\ntype RichTextCodec = NonNullable<ReturnType<typeof useKitServices>[\"richText\"]>;\nconst escHtml = (s: string) => s.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\n/** Plain text as editor html: one escaped paragraph per line. */\nconst paragraphs = (text: string) =>\n text\n .split(/\\n+/)\n .map((l) => l.trim())\n .filter(Boolean)\n .map((l) => `<p>${escHtml(l)}</p>`)\n .join(\"\");\n/**\n * Html into a rich text field, stored in the field's own shape through the host's codec. A write that would drop\n * something is refused with the words the codec names; nothing is stored.\n */\nfunction richTextWrite(codec: RichTextCodec, field: FieldSchema, path: FieldPath, html: string, prev: unknown): { value: unknown } | { refused: string } {\n try {\n const out = codec.write(html, { field, path }, prev);\n return out.losses.length ? { refused: `${field.title} can't keep ${out.losses.join(\", \")}` } : { value: out.value };\n } catch (err) {\n return { refused: `${field.title} could not store this text (${err instanceof Error ? err.message : String(err)})` };\n }\n}\n/** A rich text value as editor html, when the host's codec reads it. */\nfunction richTextHtml(codec: RichTextCodec | undefined, field: FieldSchema, path: FieldPath, value: unknown): string | undefined {\n if (!codec || field.type !== \"richtext\") return undefined;\n try {\n return codec.read(value, { field, path }).html;\n } catch {\n return undefined; // Paste falls back to the value's words\n }\n}\n\nexport const apiName = (schemaName: string, path: FieldPath) =>\n [schemaName, ...path.filter((s) => s !== HISTORY_SEGMENT)].reduce<string>((a, s) => (typeof s === \"number\" ? `${a}[${s}]` : a ? `${a}.${s}` : String(s)), \"\");\n\n/** A long label truncates on one line; past this many characters a native `title` carries the full label (DESIGN 4.4). */\nexport const LABEL_HINT_AT = 28;\n\n/**\n * GAP-004: comment on words selected in this field. Set only where the field's comments open in place (the host's\n * `FieldComments`, no `env.onComment`): the field's comments popover opens with the selection, so the new thread is\n * about those words. Null where the host owns comments (`env.onComment`) or there are none.\n */\nexport const FieldCommentRequest = React.createContext<((sel: KitCommentSelection) => void) | null>(null);\n\n/* D63: add-comment and ⋯ are hidden at rest and show on THIS field's hover or focus (not a parent group's), always on\n touch, and while their menu or popover is open. The rule lives in tokens.css ([data-field-reveal]) because a Tailwind\n group variant matches every ancestor field, so hovering a group used to reveal the chrome of all its children. */\n\nexport interface FieldShellProps {\n field: FieldSchema;\n path: FieldPath;\n id: string;\n value: unknown;\n onChange: (v: unknown) => void;\n readOnly?: boolean;\n issue?: KitIssue;\n /** label-row action (e.g. slug \"Generate\") */\n action?: React.ReactNode;\n /** \"card\" = the boolean switch card · \"row\" = the control IS a labelled row (a drill-in object, CPO D45): no label row,\n * the chrome goes into the row through `RowChrome` */\n layout?: \"stack\" | \"card\" | \"row\";\n /** layout fields get no comment control */\n noComments?: boolean;\n /** right side of the message line (counters, \"3 items · max 6\") */\n meta?: React.ReactNode;\n className?: string;\n children: React.ReactNode;\n}\n\nexport function FieldShell({ field, path, id, value, onChange, readOnly, issue, action, layout = \"stack\", noComments, meta, className, children }: FieldShellProps) {\n const env = useKitEnv();\n const form = useForm();\n const services = useKitServices();\n const key = pathKey(path);\n /* A host can lift this field's chrome into its own header (All fields: a block whose only field is \"Stats\" under a\n \"Stats\" section) — then there is no label row at all; the label stays for screen readers. */\n const slot = React.useContext(FieldHeaderSlot);\n const lifted = slot && slot.key === key && layout === \"stack\" ? slot.el : null;\n const [ai, setAi] = React.useState(false);\n const [commentsOpen, setCommentsOpen] = React.useState(false);\n /* V2 fieldPopoverCollision: the comments popover stays inside the scrolling area the field sits in */\n const [commentArea, setCommentArea] = React.useState<CommentCollision>({ collisionPadding: 12 });\n const peers = env.presence[key] ?? [];\n const editor = peers.find((p) => p.status !== \"viewing\");\n const InPlaceComments = services.FieldComments;\n /* a meta-form (the schema editor's field settings) shows no comment, ⋯ or per-field undo chrome (KitEnv.fieldChrome) */\n const quiet = env.fieldChrome === \"quiet\";\n const bare = quiet || env.fieldChrome === \"preview\";\n const canComment = !noComments && !bare && (!!env.onComment || !!InPlaceComments);\n /* GAP-004: the selection a rich-text Comment opened the popover with (cleared when it closes) */\n const [commentSel, setCommentSel] = React.useState<KitCommentSelection | null>(null);\n const requestComment = React.useMemo(\n () =>\n canComment && !env.onComment && InPlaceComments\n ? (sel: KitCommentSelection) => {\n setCommentSel(sel);\n setCommentArea(fieldPopoverCollision(document.getElementById(id)?.closest(\"[data-field-key]\") ?? null));\n setCommentsOpen(true);\n }\n : null,\n [canComment, env.onComment, InPlaceComments, id],\n );\n const closeComments = () => {\n setCommentsOpen(false);\n setCommentSel(null);\n };\n /* REQ-2-6: the host opens this field's comments (with the words a plain field's selection quoted) by dispatching\n `openFieldComments(box, selection)` on the field's `[data-field-key]` box */\n const openRef = React.useRef<(sel?: KitCommentSelection) => void>(() => {});\n openRef.current = (sel) => {\n if (!canComment) return;\n if (env.onComment) return env.onComment(path, field);\n setCommentSel(sel ?? null);\n setCommentArea(fieldPopoverCollision(document.getElementById(id)?.closest(\"[data-field-key]\") ?? null));\n setCommentsOpen(true);\n };\n React.useEffect(() => {\n const box = document.getElementById(id)?.closest(\"[data-field-key]\");\n if (!box) return;\n const on = (e: Event) => {\n e.stopPropagation();\n openRef.current((e as CustomEvent<KitCommentSelection | undefined>).detail);\n };\n box.addEventListener(KIT_OPEN_FIELD_COMMENTS, on);\n return () => box.removeEventListener(KIT_OPEN_FIELD_COMMENTS, on);\n }, [id]);\n /* Look \"v16\" (prototype inspector.jsx:67-70, editor.css:414): the hover strip is link · comment · ⋯ */\n const v16 = useKitLook() === \"v16\";\n const openCount = env.comments[key] ?? 0; // with no env.onComment and a count hook, CommentButton reads the store\n const useStoreCount = env.onComment ? undefined : services.useFieldCommentCount;\n const changed = !!form?.hasPublished && !same(value, form.publishedAt(path));\n /* component instance (D28): a top-level field either inherits the component's value or overrides it */\n const inh = form?.inherited && path.length === 1 ? form.inherited : undefined;\n const overridden = !!inh && inh.isOverridden(key);\n /* D61: while the host's History is open, a changed field gets the host's 2px author-colour bar at its left edge\n (with its hover card) instead of the quiet \"changed\" dot. At rest (History closed) the dot stays. */\n const reviewing = !!env.review;\n const bar = env.review && env.review.count(path) > 0 ? env.review.bar(path, field) : null;\n const sectionTitle = React.useContext(KitSectionTitle);\n /* \"Options\" in a section called \"Options\": the section heading already names the field (the label stays for readers) */\n const repeatsSection = quiet && layout === \"stack\" && !!sectionTitle && sectionTitle.trim().toLowerCase() === field.title.trim().toLowerCase();\n const canUndo = !bare && !!form?.canUndo(key) && !readOnly;\n const synced = field.synced?.from; // a whole synced form shows one notice at its root, not a chip per field\n const limit = field.validation?.max ?? field.validation?.recommendedMax;\n const len = textLength(value);\n /* counters stay quiet: shown while the field has focus, or when the value nears its limit */\n const near = !!limit && len >= limit * 0.8;\n const counter =\n limit && (field.type === \"string\" || field.type === \"text\" || field.type === \"richtext\") ? (\n v16 ? (\n // look v16 (prototype content.jsx:319, insp.css:30): no counter while the value is far from its limit; near it\n // (above 91%) the 11/14 amber \"n / max\" with its ring, over it red; the number rolls\n counterState(len, limit) === \"ok\" ? null : <FieldCounter value={len} max={limit} />\n ) : (\n <span\n data-slot=\"field-counter\"\n className={cn(\n \"tabular-nums text-kit-xs\",\n !near && \"hidden group-focus-within/field:inline\",\n field.validation?.max && len > field.validation.max ? \"text-kit-danger-fg\" : field.validation?.recommendedMax && len > field.validation.recommendedMax ? \"text-kit-warning-fg\" : \"text-kit-fg-3\",\n )}\n >\n {len} / {limit}\n </span>\n )\n ) : null;\n\n /* ── Help (CPO D39) ── one line under the label; longer text behind ⓘ. Dense hosts (env.helpDisplay \"tooltip\")\n move the line into the ⓘ too. An error REPLACES the help (warnings keep it: they're advice, not a block). */\n const dense = env.helpDisplay === \"tooltip\";\n /* D70: a field locked for this person (its own edit cap, in a form they can otherwise change) says so: a small lock glyph\n before the reason. A whole read-only form (Viewer, view as) stays plain text with no glyphs (D58). A read-only field\n that carries its own lockReason is locked the same way, cap or no cap, so a dense host shows the reason too (DK-019). */\n const lockedHere = !!readOnly && !env.readOnly && (!!field.lockReason?.trim() || (!!field.access?.edit && !env.can(field.access.edit)));\n const help = lockedHere ? (field.lockReason?.trim() || \"Set by developers\").replace(/\\.?$/, \".\") : resolveHelp(field); // arrays / slots / objects reach the shell without KitField: conventions apply here too\n const helpNode = lockedHere ? (\n <span data-locked=\"\" className=\"inline-flex items-start gap-1\">\n <IconLock className=\"mt-px size-3 shrink-0\" stroke={1.75} aria-hidden />\n <span>\n <span className=\"sr-only\">Locked. </span>\n {help}\n </span>\n </span>\n ) : (\n help\n );\n const more = field.helpMore || undefined;\n const erroring = issue?.level === \"error\";\n // a lock's reason stays on the field even in a dense host: it says why the value can't change\n const helpInline = !!help && (!dense || lockedHere) && !erroring;\n const tip = dense && !lockedHere ? [help, more].filter(Boolean).join(\" \") : more;\n const helpId = `${id}-help`;\n const moreId = `${id}-more`;\n const msgId = `${id}-msg`;\n const describedBy = [helpInline && helpId, tip && moreId, issue && msgId].filter(Boolean).join(\" \");\n /* Controls are many (input, textarea, contenteditable, pickers); the shell owns the ids, so it wires\n aria-describedby onto whatever element carries the field id, keeping any ids the control set itself. */\n React.useEffect(() => {\n const el = document.getElementById(id);\n if (!el) return;\n const own = (el.getAttribute(\"aria-describedby\") ?? \"\").split(\" \").filter((t) => t && !t.startsWith(`${id}-`));\n const next = [...own, ...describedBy.split(\" \").filter(Boolean)].join(\" \");\n if (next) el.setAttribute(\"aria-describedby\", next);\n else el.removeAttribute(\"aria-describedby\");\n }, [id, describedBy]);\n const info = tip ? (\n v16 ? (\n // look v16 (F1324, prototype inspector.jsx Info): the white card, the label as its title, 240 wide, 250ms\n <>\n <InfoTooltip title={field.title}>{tip}</InfoTooltip>\n <span id={moreId} className=\"sr-only\">\n {tip}\n </span>\n </>\n ) : (\n <Tooltip content={<span className=\"block max-w-[260px] whitespace-normal font-normal leading-4\">{tip}</span>}>\n <button type=\"button\" aria-label={`About ${field.title}`} className=\"-my-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded-kit-sm text-kit-fg-4 hover:text-kit-fg-2\">\n <IconInfoCircle className=\"size-3.5\" stroke={1.5} aria-hidden />\n <span id={moreId} className=\"sr-only\">{tip}</span>\n </button>\n </Tooltip>\n )\n ) : null;\n\n // KP-029/223: a long label truncates on one line with a native title; the boolean card's label wraps under its switch.\n const longTitle = field.title.length > LABEL_HINT_AT ? field.title : undefined;\n const labelOf = (wrap: boolean) => (\n <>\n <span className={wrap ? \"min-w-0 break-words\" : \"truncate\"}>{field.title}</span>\n {field.validation?.required ? (\n <>\n {/* look v16 (F1323): \" *\" is part of the label text, in the label's own ink */}\n <span aria-hidden className={v16 ? \"whitespace-pre\" : \"text-kit-fg-2\"}>\n {v16 ? \" *\" : \"*\"}\n </span>\n <span className=\"sr-only\">(required)</span>\n </>\n ) : null}\n </>\n );\n const label = labelOf(false);\n const badges = (\n <>\n {overridden ? (\n <Tooltip content={`Overrides ${inh!.from}. Changes to the block no longer reach this field.`}>\n <span role=\"img\" className=\"size-1.5 shrink-0 rounded-full bg-kit-accent\" aria-label={`Overrides ${inh!.from}`} />\n </Tooltip>\n ) : null}\n {changed && !reviewing ? (\n <Tooltip content=\"Changed since publish\">\n <span role=\"img\" className=\"size-1.5 shrink-0 rounded-full bg-kit-warning\" aria-label=\"Changed since publish\" />\n </Tooltip>\n ) : null}\n {synced ? (\n <Tooltip content={`Synced from ${synced}. Changes apply on every page that uses it.`}>\n <span className=\"inline-flex h-4 shrink-0 items-center gap-0.5 rounded-kit-md bg-kit-info-soft px-1 text-kit-2xs font-medium text-kit-info-fg\">\n <IconRefresh className=\"size-2.5\" stroke={2} aria-hidden />\n Synced\n </span>\n </Tooltip>\n ) : null}\n {field.localized ? (\n <Tooltip content=\"Translatable: this field can hold a value for each of the site's languages.\">\n <span className=\"inline-flex h-4 shrink-0 items-center gap-0.5 rounded-kit-md bg-kit-muted px-1 text-kit-2xs font-medium text-kit-fg-3\">\n <IconWorld className=\"size-2.5\" stroke={2} aria-hidden />\n EN\n </span>\n </Tooltip>\n ) : null}\n </>\n );\n const accessories = (\n <>\n {action}\n {overridden && !readOnly ? (\n <Tooltip content={`Use ${inh!.from}'s value again`}>\n <button\n type=\"button\"\n onClick={(e) => {\n const box = (e.currentTarget as HTMLElement).closest<HTMLElement>(\"[data-field-key]\");\n inh!.reset(key);\n // the button goes away with the override: keep focus in the field, never on <body>\n requestAnimationFrame(() => (document.getElementById(id) ?? box?.querySelector<HTMLElement>(\"textarea, input, [contenteditable=true], button\"))?.focus({ preventScroll: true }));\n }}\n aria-label={`Reset ${field.title} to ${inh!.from}`}\n className=\"inline-flex h-5 items-center rounded-kit-md px-1 text-kit-xs text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg\"\n >\n Reset\n </button>\n </Tooltip>\n ) : null}\n {canUndo ? (\n <Tooltip content={`Undo last change to ${field.title}`}>\n <button type=\"button\" aria-label={`Undo last change to ${field.title}`}\n onClick={(e) => {\n const btn = e.currentTarget as HTMLElement;\n const box = btn.closest<HTMLElement>(\"[data-field-key]\");\n form?.undo(key);\n // KB-006: the last undo takes the button away; keep focus in the field, never on <body>\n requestAnimationFrame(() => {\n if (!btn.isConnected) (document.getElementById(id) ?? box?.querySelector<HTMLElement>(\"textarea, input, [contenteditable=true], button\"))?.focus({ preventScroll: true });\n });\n }}\n className=\"inline-flex size-5 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg\">\n <IconArrowBackUp className=\"size-3.5\" stroke={1.5} aria-hidden />\n </button>\n </Tooltip>\n ) : null}\n {v16 && !bare ? (\n <Tooltip content=\"Copy link to field\">\n <button\n type=\"button\"\n data-field-reveal=\"\"\n aria-label={`Copy link to ${field.title}`}\n className=\"-my-0.5 size-5 items-center justify-center rounded-[4px] text-kit-fg-3 hover:bg-kit-insp-track hover:text-kit-fg focus-visible:outline-2 focus-visible:outline-offset-1 [&_svg]:size-4\"\n onClick={() => {\n // prototype inspector.jsx:68: this address without its hash, then \"#\" and the field\n const href = `${window.location.href.split(\"#\")[0]}#${encodeURIComponent(key)}`;\n const w = navigator.clipboard?.writeText(href);\n if (!w) return services.toast?.(\"Copy is not available in this browser\");\n w.then(\n () => services.toast?.(\"Link to field copied\"),\n () => services.toast?.(\"The browser refused to copy the link\"),\n );\n }}\n >\n <IconFieldLink stroke={1.5} aria-hidden />\n </button>\n </Tooltip>\n ) : null}\n {canComment ? (\n <CommentButton\n count={openCount}\n useCount={useStoreCount ? () => useStoreCount(env.docId, key) : undefined}\n label={field.title}\n open={commentsOpen}\n onThreads={!env.onComment && services.onOpenFieldThreads ? () => services.onOpenFieldThreads!(env.docId, key) : undefined}\n onOpen={(el) => {\n if (env.onComment) return env.onComment(path, field); // the host owns comments (e.g. the document editor)\n setCommentSel(null);\n setCommentArea(fieldPopoverCollision(el.closest(\"[data-field-key]\")));\n setCommentsOpen(true);\n }}\n />\n ) : null}\n <PeerStack peers={peers} />\n {bare ? null : <FieldMenu field={field} path={path} value={value} onChange={onChange} readOnly={!!readOnly} changed={changed} onAi={() => setAi(true)} />}\n </>\n );\n\n // Peer editing (Figma / Notion / Sanity): only the field's own input border takes their --presence-n colour (full strength:\n // the old 70% mix read as a validation error at 1.96:1) —\n // no outline around the input + preview, no name tag over the border, no layout shift. Who it is: the face in the label row.\n const control = (\n <div\n className={cn(\"relative\", editor && \"[&_.border-kit-field-border]:border-[var(--peer)]\")}\n style={editor ? ({ \"--peer\": editor.color ?? presenceColor(editor.id ?? editor.name) } as React.CSSProperties) : undefined}\n >\n {children}\n </div>\n );\n\n const message =\n issue || meta ? (\n <div className=\"flex min-h-4 items-start justify-between gap-3\">\n <AnimatePresence initial={false}>\n {issue ? (\n <motion.p\n key={issue.message}\n id={msgId}\n initial={{ opacity: 0, y: -2 }}\n animate={{ opacity: 1, y: 0 }}\n role={issue.level === \"error\" ? \"alert\" : \"status\"}\n className={cn(\"flex min-w-0 items-start gap-1 text-kit-xs\", issue.level === \"error\" ? \"text-kit-danger-fg\" : \"text-kit-warning-fg\")}\n >\n {issue.level === \"error\" ? <IconAlertCircle className=\"mt-px size-3.5 shrink-0\" stroke={1.5} aria-hidden /> : <IconAlertTriangle className=\"mt-px size-3.5 shrink-0\" stroke={1.5} aria-hidden />}\n <span className=\"min-w-0\">\n {/* look v16 (F1339, prototype content.jsx Field): the over-limit line is \"Over the N-character limit\" */}\n {v16 && issue.kind === \"rule\" && limit && len > limit && /^Keep it under \\d+ characters/.test(issue.message) ? overLimitText(limit) : issue.message}\n {issue.fix && !readOnly ? (\n <>\n {\" \"}\n <button type=\"button\" onClick={issue.fix.apply} className=\"font-medium text-kit-fg underline-offset-2 hover:underline\">\n {issue.fix.label}\n </button>\n </>\n ) : null}\n </span>\n </motion.p>\n ) : (\n <span />\n )}\n </AnimatePresence>\n {meta ? <span className=\"flex shrink-0 items-center gap-2\">{meta}</span> : null}\n </div>\n ) : null;\n\n /* P-FDOT: the host names the field a canvas click opened; its label takes the focus dot, the field the sweep */\n const focus = useKitFocusField();\n const focused = !!focus && focus.key === key;\n const labelEl = (\n <label\n htmlFor={id}\n id={`${id}-label`}\n className=\"flex min-w-0 items-center gap-1 text-kit-sm font-medium text-kit-fg-2 transition-colors group-focus-within/field:text-kit-fg\"\n title={longTitle}\n >\n {label}\n {focused ? <FocusDot /> : null}\n </label>\n );\n\n const body =\n layout === \"row\" ? (\n <div className={cn(\"group/field relative flex min-w-0 flex-col gap-1.5\", className)} data-field-key={key} data-field={path.length === 1 ? key : undefined} data-slot=\"kit-field\">\n {bar}\n <RowChrome.Provider value={<>{info}{badges}{accessories}</>}>{control}</RowChrome.Provider>\n {message}\n </div>\n ) : layout === \"card\" && quiet ? (\n /* the inspector's PRow: label left, switch right, no card (a meta-form's Required, Unique, Tuck into Advanced) */\n <div className={cn(\"group/field relative flex flex-col gap-1\", className)} data-field-key={key} data-field={path.length === 1 ? key : undefined} data-slot=\"kit-field\">\n {bar}\n <div data-field-head=\"\" className=\"flex min-h-8 items-center gap-3\">\n <label htmlFor={id} id={`${id}-label`} className=\"min-w-0 flex-1 cursor-pointer\" title={longTitle}>\n <span className=\"flex min-w-0 items-center gap-1 text-kit-sm font-medium text-kit-fg-2 transition-colors group-focus-within/field:text-kit-fg\">\n {label}\n {info}\n {badges}\n </span>\n {helpInline ? (\n <span id={helpId} data-slot=\"field-help\" className=\"mt-0.5 block text-kit-xs leading-4 text-kit-fg-3\">\n {helpNode}\n </span>\n ) : null}\n </label>\n <span className=\"flex shrink-0 items-center gap-0.5 empty:hidden\">{accessories}</span>\n <span className=\"flex shrink-0 items-center\">{readOnly ? <span className=\"text-kit-sm text-kit-fg-2\">{value ? \"On\" : \"Off\"}</span> : control}</span>\n </div>\n {message}\n </div>\n ) : layout === \"card\" ? (\n <div className={cn(\"group/field relative flex flex-col gap-1.5\", className)} data-field-key={key} data-field={path.length === 1 ? key : undefined} data-slot=\"kit-field\">\n {bar}\n <div data-field-head=\"\" className={cn(\"flex items-center gap-3 rounded-kit-lg border bg-kit-surface px-3 py-2.5 transition-colors\", issue?.level === \"error\" ? \"border-[var(--kit-field-invalid)]\" : \"border-kit-line-strong hover:border-[var(--kit-emphasis-line)]\")}>\n {control}\n <label htmlFor={id} id={`${id}-label`} className=\"min-w-0 flex-1 cursor-pointer\" title={longTitle}>\n <span className=\"flex min-w-0 items-center gap-1.5 text-kit-sm font-medium text-kit-fg\">\n {labelOf(true)}\n {info}\n {badges}\n </span>\n {helpInline ? (\n <span id={helpId} data-slot=\"field-help\" className=\"block text-kit-xs leading-4 text-kit-fg-3\">\n {helpNode}\n </span>\n ) : null}\n </label>\n <span className=\"shrink-0 text-kit-xs text-kit-fg-3\">{value ? \"On\" : \"Off\"}</span>\n <span className=\"flex shrink-0 items-center gap-0.5 empty:hidden\">{accessories}</span>\n </div>\n {message}\n </div>\n ) : (\n <div\n className={cn(\"group/field relative flex min-w-0 flex-col gap-1.5\", focused && \"isolate\", className)}\n data-field-key={key}\n data-field={path.length === 1 ? key : undefined}\n data-slot=\"kit-field\"\n data-inherited={inh && !overridden ? \"\" : undefined}\n data-overridden={overridden ? \"\" : undefined}\n data-cur={focused ? \"\" : undefined}\n >\n {focused && focus?.flash != null ? <FieldSweep key={String(focus.flash)} /> : null}\n {bar}\n {repeatsSection ? (\n <label htmlFor={id} id={`${id}-label`} className=\"sr-only\">\n {label}\n </label>\n ) : lifted ? (\n <>\n <label htmlFor={id} id={`${id}-label`} className=\"sr-only\">\n {label}\n </label>\n {createPortal(\n <span className=\"flex items-center gap-0.5 [&>button]:!inline-flex\">\n {info}\n {badges}\n {counter}\n {accessories}\n </span>,\n lifted,\n )}\n </>\n ) : (\n <div data-slot=\"field-label-row\" data-field-head=\"\" className=\"flex min-h-5 min-w-0 items-center gap-1.5\">\n {labelEl}\n {info}\n {badges}\n <span className=\"flex-1\" />\n {counter}\n <span className=\"flex shrink-0 items-center gap-0.5\">{accessories}</span>\n </div>\n )}\n {helpInline ? (\n <p id={helpId} data-slot=\"field-help\" className=\"-mt-0.5 text-kit-xs leading-4 text-kit-fg-3\">\n {helpNode}\n </p>\n ) : null}\n {control}\n {message}\n </div>\n );\n\n // the host says how its comments body sits on the field (REQ-3-7); absent, the kit's own popover\n const commentPop = commentsOpen && services.fieldCommentsPopover ? services.fieldCommentsPopover({ selection: !!commentSel }) : null;\n /* The AI popover and the comments popover both anchor to the field (two stacked anchor divs). */\n return (\n <FieldCommentRequest.Provider value={requestComment}>\n <Popover open={ai} onOpenChange={setAi}>\n <PopoverAnchor className=\"min-w-0\">\n <Popover\n open={commentsOpen}\n onOpenChange={(open, d) => {\n /* V2 guardEscape: Escape inside the composer (data-esc-owner) belongs to the draft, not the popover */\n if (!open && d.reason === \"escape-key\" && (document.activeElement as HTMLElement | null)?.hasAttribute(\"data-esc-owner\")) return d.cancel();\n setCommentsOpen(open);\n if (!open) setCommentSel(null);\n }}\n >\n <PopoverAnchor className=\"min-w-0\">{body}</PopoverAnchor>\n {commentsOpen && InPlaceComments ? (\n <PopoverContent\n align=\"start\"\n sideOffset={commentPop?.sideOffset ?? 8}\n alignOffset={commentPop?.alignOffset}\n {...commentArea}\n initialFocus={false}\n className={cn(\"p-0\", commentPop?.className ?? \"w-[clamp(280px,var(--anchor-width),420px)]\")}\n >\n <InPlaceComments\n docId={env.docId}\n fieldKey={key}\n label={field.title}\n quote={plainText(value).slice(0, 80) || undefined}\n selection={commentSel ?? undefined}\n onClose={closeComments}\n onOpenPanel={\n env.onComment\n ? () => {\n env.onComment?.(path, field);\n setCommentsOpen(false);\n }\n : undefined\n }\n />\n </PopoverContent>\n ) : null}\n </Popover>\n </PopoverAnchor>\n {ai ? (\n <PopoverContent align=\"start\" sideOffset={8} className=\"w-[clamp(300px,var(--anchor-width),440px)] p-0\">\n <AiRewrite field={field} path={path} value={value} onChange={onChange} onClose={() => setAi(false)} />\n </PopoverContent>\n ) : null}\n </Popover>\n </FieldCommentRequest.Provider>\n );\n}\n\n/** REQ-2-6: the event a field's box answers by opening its comments (`detail`: the quoted selection, or none). */\nexport const KIT_OPEN_FIELD_COMMENTS = \"kit:open-field-comments\";\n/** Opens the comments of the field whose `[data-field-key]` box is `box` (a plain field's selected words as `selection`). */\nexport function openFieldComments(box: Element, selection?: KitCommentSelection) {\n box.dispatchEvent(new CustomEvent(KIT_OPEN_FIELD_COMMENTS, { detail: selection }));\n}\n\ntype CommentCollision = { collisionBoundary?: Element; collisionPadding: number | Partial<Record<\"top\" | \"right\" | \"bottom\" | \"left\", number>> };\n/** V2 features/comments fieldPopoverCollision: inside a scrolling panel, collide with that panel below its sticky header. */\nfunction fieldPopoverCollision(anchor: Element | null): CommentCollision {\n let area = anchor?.parentElement ?? null;\n while (area && !/(auto|scroll)/.test(getComputedStyle(area).overflowY)) area = area.parentElement;\n if (!area || area === document.scrollingElement) return { collisionPadding: 12 };\n const sticky = parseFloat(getComputedStyle(area).getPropertyValue(\"--kit-sticky-top\")) || 0;\n return { collisionBoundary: area, collisionPadding: { top: sticky + 8, right: 8, bottom: 8, left: 8 } };\n}\n\n/** Comment count chip (always visible) or the hover-revealed \"Add comment\" icon. `useCount` (the host's store hook)\n * replaces `count` when the kit draws the comments in place. */\nfunction CommentButton({ useCount, ...props }: CommentButtonProps & { useCount?: () => number }) {\n return useCount ? <StoreCommentButton useCount={useCount} {...props} /> : <CountedCommentButton {...props} />;\n}\ninterface CommentButtonProps {\n count: number;\n label: string;\n open: boolean;\n onOpen: (el: HTMLElement) => void;\n /** with open threads: the host's panel opens on this field instead of the popover */\n onThreads?: () => void;\n}\nfunction StoreCommentButton({ useCount, ...props }: CommentButtonProps & { useCount: () => number }) {\n return <CountedCommentButton {...props} count={useCount()} />;\n}\nfunction CountedCommentButton({ count, label, open, onOpen, onThreads }: CommentButtonProps) {\n // look v16 copy (prototype comments.jsx:177-205): \"Comment\" / \"{n} comments · open thread\"\n const v16 = useKitLook() === \"v16\";\n const n = `${count} comment${count === 1 ? \"\" : \"s\"}`;\n if (count > 0)\n return (\n <Tooltip content={v16 ? `${n} · open thread` : `${count} open comment${count === 1 ? \"\" : \"s\"} on ${label}`}>\n <button\n type=\"button\"\n onClick={(e) => (onThreads ? onThreads() : onOpen(e.currentTarget))}\n data-state={open ? \"open\" : \"closed\"}\n aria-label={v16 ? `${n} on ${label} · open thread` : `${count} open comments on ${label}`}\n className=\"-my-0.5 inline-flex h-5 items-center gap-0.5 rounded-kit-md px-1 text-kit-2xs font-medium text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg data-[state=open]:bg-kit-hover data-[state=open]:text-kit-fg\"\n >\n <IconMessage className=\"size-3.5\" stroke={1.5} aria-hidden />\n <span className=\"tabular-nums\">{count}</span>\n </button>\n </Tooltip>\n );\n return (\n <Tooltip content={v16 ? \"Comment\" : \"Add comment\"}>\n <button\n type=\"button\"\n onClick={(e) => onOpen(e.currentTarget)}\n data-state={open ? \"open\" : \"closed\"}\n aria-label={v16 ? `Comment on ${label}` : `Add comment to ${label}`}\n data-field-reveal=\"\" className={cn(\"-my-0.5 size-6 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg\")}\n >\n <IconMessagePlus className=\"size-3.5\" stroke={1.5} aria-hidden />\n </button>\n </Tooltip>\n );\n}\n\n/** Who is in this field: 16px faces in the label row's action slot (no overlap with the label or the input), name on hover. */\nexport function PeerStack({ peers, size = 16 }: { peers: KitPeer[]; size?: number }) {\n const shown = peers.slice(0, 3);\n const rest = peers.length - shown.length;\n // Each slot reserves the ring band (1px surface gap + 1px presence colour) on every side, so the ring sits inside\n // the slot: a clipping ancestor or the row's edge can never shave it. Faces still overlap by 25% of their size.\n const ring = \"var(--kit-avatar-ring, var(--kit-surface))\";\n const band = avatarRingSpread({ ring, ringWidth: 1, ringAccent: \"x\" });\n const box = size + band * 2;\n const overlap = -(Math.round(size * 0.25) + band * 2);\n return (\n <AnimatePresence initial={false}>\n {shown.length ? (\n <motion.span key=\"peers\" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={{ duration: 0.25 }} className=\"flex h-5 items-center\" data-slot=\"field-presence\">\n {/* D34 stack rules: same size, 25% overlap, first face on top; the ring is box-shadow (surface gap + the\n peer's presence colour) so the photo keeps its full size. */}\n {shown.map((p, i) => (\n <Tooltip key={p.name + i} content={`${p.name} · ${p.status === \"viewing\" ? \"Viewing\" : \"Editing\"} this field`}>\n <span\n style={{ marginLeft: i ? overlap : 0, zIndex: shown.length - i + 1, width: box, height: box }}\n className={cn(\"relative inline-flex shrink-0 rounded-full transition-transform duration-150 hover:!z-30 hover:-translate-y-px\", p.status === \"viewing\" && \"opacity-60\")}\n >\n <Avatar name={p.name} src={p.avatar} size={size} ring={ring} ringWidth={1} ringAccent={p.color ?? presenceColor(p.id ?? p.name)} decorative />\n </span>\n </Tooltip>\n ))}\n {rest > 0 ? (\n <Tooltip content={peers.slice(shown.length).map((p) => p.name).join(\", \")}>\n <span style={{ marginLeft: overlap, width: box, height: box, padding: band }} className=\"relative z-[1] inline-flex shrink-0\">\n <span\n style={{ width: size, height: size, boxShadow: `0 0 0 ${band}px var(--kit-surface)`, fontSize: Math.max(8, Math.round(size * 0.5)) }}\n className=\"inline-flex items-center justify-center rounded-full bg-kit-muted font-medium leading-none tabular-nums text-kit-fg-2\"\n >\n +{rest}\n </span>\n </span>\n </Tooltip>\n ) : null}\n </motion.span>\n ) : null}\n </AnimatePresence>\n );\n}\n\n/** The field ⋯ menu alone, for a field drawn without its shell (a top-level Object group's header, look v16). */\nexport function FieldActionsMenu({ field, path, value, onChange, readOnly }: { field: FieldSchema; path: FieldPath; value: unknown; onChange: (v: unknown) => void; readOnly?: boolean }) {\n const form = useForm();\n const changed = !!form?.hasPublished && !same(value, form.publishedAt(path));\n return <FieldMenu field={field} path={path} value={value} onChange={onChange} readOnly={!!readOnly} changed={changed} onAi={() => {}} />;\n}\n\n/* ── ⋯ Field actions (DESIGN 8.25) ─────────────────────────────────── */\nfunction FieldMenu({ field, path, value, onChange, readOnly, changed, onAi }: { field: FieldSchema; path: FieldPath; value: unknown; onChange: (v: unknown) => void; readOnly: boolean; changed: boolean; onAi: () => void }) {\n const form = useForm();\n const env = useKitEnv();\n const { toast, aiRewrite, richText, FieldMenuExtras } = useKitServices();\n const key = pathKey(path);\n const api = apiName(form?.schema.name ?? \"doc\", path);\n const textual = isTextual(field.type);\n // rich text is rewritten only where the host's codec can store the result in the field's own shape\n const prose = field.type === \"string\" || field.type === \"text\" || (field.type === \"richtext\" && !!richText);\n const editable = !readOnly;\n const dev = seesDevSurfaces(env);\n /* Look \"v16\" (prototype inspector.jsx Field ⋯ menu): the rows are named for the field (\"Copy field\", \"Paste field\",\n \"View field history\"), and the menu gains \"Reset to default\" (the schema's initial value) and a red \"Clear field\". */\n const v16 = useKitLook() === \"v16\";\n const copyField = () => {\n const html = richTextHtml(richText, field, path, value);\n clip = { type: field.type, value: structuredCloneish(value), label: field.title, ...(html !== undefined ? { html } : {}) };\n const text = textual ? plainText(value) || \"\" : typeof value === \"string\" ? value : JSON.stringify(value ?? null, null, 2);\n void navigator.clipboard?.writeText(text).catch(() => {});\n toast?.success(`${field.title} copied`);\n };\n const copyApi = () => {\n void navigator.clipboard?.writeText(api).catch(() => {});\n toast?.success(`Copied ${api}`);\n };\n const resetPublished =\n editable && form?.hasPublished && changed ? (\n <MenuItem\n icon={<IconRotate stroke={1.5} />}\n onClick={() => {\n const prev = value;\n onChange(form.publishedAt(path));\n toast?.(`${field.title} reset to published`, { action: { label: \"Undo\", onClick: () => onChange(prev) }, duration: 10_000 });\n }}\n >\n Reset to published\n </MenuItem>\n ) : null;\n const aiRows =\n editable && prose && aiRewrite ? (\n <>\n <MenuSeparator />\n {form?.aiKeys.has(key) ? (\n <MenuItem\n icon={<IconArrowBackUp stroke={1.5} />}\n onClick={() => {\n form.undo(key);\n form.markAi(key, false);\n }}\n >\n Undo AI change\n </MenuItem>\n ) : null}\n <MenuItem icon={<Sparkle size={16} />} onClick={() => window.setTimeout(onAi, 0)}>\n Rewrite with AI\n </MenuItem>\n </>\n ) : null;\n return (\n <Menu>\n <Tooltip content=\"Field actions\">\n <MenuTrigger\n aria-label={`${field.title} actions`}\n data-field-reveal=\"\" className={cn(\"-my-0.5 size-6 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg data-[popup-open]:bg-kit-hover data-[popup-open]:text-kit-fg\")}\n >\n <IconDots className=\"size-3.5\" stroke={1.5} aria-hidden />\n </MenuTrigger>\n </Tooltip>\n <MenuContent align=\"end\" className=\"w-60\">\n {v16 ? (\n /* prototype inspector.jsx:54-61: Copy field · Copy API name · Paste field | Reset to default · View field\n history | Clear field (the host's extras and the AI rows follow) */\n <>\n <MenuItem icon={<IconCopy stroke={1.5} />} shortcut=\"⌘C\" onClick={copyField}>\n Copy field\n </MenuItem>\n <MenuItem icon={<IconBraces stroke={1.5} />} onClick={copyApi}>\n <span className=\"flex w-full items-center justify-between gap-3\">\n Copy API name\n <span className=\"truncate text-[12px] leading-4 text-kit-insp-faint\">{api.length > 22 ? `…${api.slice(-20)}` : api}</span>\n </span>\n </MenuItem>\n {editable ? <PasteItem field={field} path={path} value={value} onChange={onChange} /> : null}\n {editable || env.onFieldHistory ? <MenuSeparator /> : null}\n {editable ? (\n <MenuItem\n icon={<IconResetDefault stroke={1.5} />}\n onClick={() => {\n const prev = value;\n onChange(initialFor(field));\n toast?.(`${field.title} reset to default`, { action: { label: \"Undo\", onClick: () => onChange(prev) }, duration: 10_000 });\n }}\n >\n Reset to default\n </MenuItem>\n ) : null}\n {resetPublished}\n {env.onFieldHistory ? (\n <MenuItem icon={<IconHistory stroke={1.5} />} onClick={() => env.onFieldHistory!(path, field)}>\n View field history\n </MenuItem>\n ) : null}\n {editable ? (\n <>\n <MenuSeparator />\n <MenuItem\n danger\n icon={<IconClearField stroke={1.5} />}\n disabled={isEmptyValue(value)}\n onClick={() => {\n const prev = value;\n onChange(emptyFor(field));\n toast?.(`${field.title} cleared`, { action: { label: \"Undo\", onClick: () => onChange(prev) }, duration: 10_000 });\n }}\n >\n Clear field\n </MenuItem>\n </>\n ) : null}\n {FieldMenuExtras ? <FieldMenuExtras field={field} path={path} readOnly={readOnly} /> : null}\n {aiRows}\n </>\n ) : (\n <>\n <MenuItem icon={<IconCopy stroke={1.5} />} onClick={copyField}>\n Copy value\n </MenuItem>\n {editable ? <PasteItem field={field} path={path} value={value} onChange={onChange} /> : null}\n {resetPublished}\n {env.onFieldHistory ? (\n <MenuItem icon={<IconHistory stroke={1.5} />} onClick={() => env.onFieldHistory!(path, field)}>\n History\n </MenuItem>\n ) : null}\n {FieldMenuExtras ? <FieldMenuExtras field={field} path={path} readOnly={readOnly} /> : null}\n {aiRows}\n {dev ? <MenuSeparator /> : null}\n {dev ? (\n <MenuItem icon={<IconBraces stroke={1.5} />} onClick={copyApi}>\n <span className=\"flex w-full items-center justify-between gap-3\">\n Copy API name\n <span className=\"truncate font-kit-mono text-kit-2xs text-kit-fg-3\">{api.length > 22 ? `…${api.slice(-20)}` : api}</span>\n </span>\n </MenuItem>\n ) : null}\n </>\n )}\n </MenuContent>\n </Menu>\n );\n}\n/** Reads the shared clipboard when the menu opens (it mounts with the popup), so a copy in another field is seen. */\nfunction PasteItem({ field, path, value, onChange }: { field: FieldSchema; path: FieldPath; value: unknown; onChange: (v: unknown) => void }) {\n const { toast, richText } = useKitServices();\n const v16 = useKitLook() === \"v16\";\n const textual = isTextual(field.type);\n // text into rich text needs the host's codec to store it in the field's shape\n const needsCodec = !!clip && field.type === \"richtext\" && clip.type !== \"richtext\" && !richText;\n const pasteOk = clip && !needsCodec && (clip.type === field.type || (textual && isTextual(clip.type as FieldSchema[\"type\"])));\n const pasteReason = !clip\n ? v16 ? \"Copy a field first\" : \"Copy a value from a field first.\"\n : needsCodec\n ? \"This rich text field takes a copied rich text value only.\"\n : pasteOk\n ? null\n : `Clipboard holds ${kindOf(clip.type)}. This field takes ${kindOf(field.type)}.`;\n return (\n <MenuItem\n icon={<IconClipboard stroke={1.5} />}\n disabled={!pasteOk}\n className={cn(pasteReason && \"h-auto py-1.5\")}\n onClick={() => {\n if (!clip) return;\n const prev = value;\n let next: unknown;\n if (field.type === \"richtext\" && richText && (clip.type !== \"richtext\" || clip.html !== undefined)) {\n // through the codec: the target field's own shape and Accept list, refused by name when it would drop something\n const out = richTextWrite(richText, field, path, clip.html ?? paragraphs(plainText(clip.value)), prev);\n if (\"refused\" in out) {\n toast?.(`Not pasted: ${out.refused}.`);\n return;\n }\n next = out.value;\n } else next = textual && clip.type === \"richtext\" && field.type !== \"richtext\" ? plainText(clip.value) : structuredCloneish(clip.value);\n onChange(next);\n toast?.(`Pasted into ${field.title}`, { action: { label: \"Undo\", onClick: () => onChange(prev) }, duration: 10_000 });\n }}\n >\n <span className=\"flex flex-col\">\n {v16 ? \"Paste field\" : \"Paste value\"}\n {pasteReason ? <span className=\"whitespace-normal text-kit-xs text-kit-fg-3\">{pasteReason}</span> : null}\n </span>\n </MenuItem>\n );\n}\nfunction structuredCloneish<T>(v: T): T {\n try {\n return structuredClone(v);\n } catch {\n return v;\n }\n}\n\n/* ── Rewrite with AI (preview before apply) ────────────────────────── */\nfunction AiRewrite({ field, path, value, onChange, onClose }: { field: FieldSchema; path: FieldPath; value: unknown; onChange: (v: unknown) => void; onClose: () => void }) {\n const form = useForm();\n const { toast, aiRewrite, richText } = useKitServices();\n const key = pathKey(path);\n const [preset, setPreset] = React.useState<AiPreset | null>(null);\n const [out, setOut] = React.useState<string | null>(null);\n const [failed, setFailed] = React.useState(false);\n const attempt = React.useRef(0);\n const latest = React.useRef(0);\n const source = plainText(value);\n const run = (p: AiPreset) => {\n if (!aiRewrite) return;\n setPreset(p);\n setOut(null);\n setFailed(false);\n const ticket = ++latest.current;\n Promise.resolve()\n .then(() => aiRewrite(source, p, attempt.current++))\n .then(\n (result) => {\n if (latest.current === ticket) setOut(result);\n },\n () => {\n if (latest.current === ticket) setFailed(true);\n },\n );\n };\n const apply = () => {\n if (!out) return;\n const prev = value;\n let next: unknown = out;\n if (field.type === \"richtext\") {\n const stored = richText ? richTextWrite(richText, field, path, paragraphs(out), prev) : { refused: `${field.title} has no rich text storage here` };\n if (\"refused\" in stored) {\n toast?.(`Not applied: ${stored.refused}.`);\n return;\n }\n next = stored.value;\n }\n onChange(next);\n form?.markAi(key, true);\n toast?.(\"Rewritten with AI\", {\n icon: <Sparkle size={14} />,\n action: {\n label: \"Undo\",\n onClick: () => {\n onChange(prev);\n form?.markAi(key, false);\n },\n },\n duration: 10_000,\n });\n onClose();\n };\n return (\n <div className=\"flex flex-col\">\n <div className=\"flex items-center gap-2 border-b border-kit-line px-3 py-2.5\">\n <Sparkle size={16} />\n <span className=\"text-kit-sm font-medium text-kit-fg\">Rewrite {field.title.toLowerCase()}</span>\n </div>\n <div className=\"flex flex-wrap gap-1 px-3 pt-2.5\">\n {AI_PRESETS.map((p) => (\n <button\n key={p.id}\n type=\"button\"\n onClick={() => run(p.id)}\n className={cn(\"h-6 rounded-full border px-2 text-kit-xs transition-colors\", preset === p.id ? \"border-[var(--kit-emphasis-line)] bg-kit-surface text-kit-fg\" : \"border-kit-line text-kit-fg-2 hover:border-kit-line-strong hover:text-kit-fg\")}\n >\n {p.label}\n </button>\n ))}\n </div>\n <div className=\"px-3 py-3\">\n {!preset ? (\n <p className=\"text-kit-xs text-kit-fg-3\">Pick a direction. You'll see the suggestion before anything changes.</p>\n ) : failed ? (\n <p role=\"alert\" className=\"text-kit-xs text-kit-danger-fg\">\n Couldn't rewrite {field.title.toLowerCase()}. Try again.\n </p>\n ) : out == null ? (\n <p className=\"text-kit-sm\">\n <Shimmer>Rewriting {field.title.toLowerCase()}…</Shimmer>\n </p>\n ) : (\n <div className=\"rounded-kit-lg bg-kit-subtle p-2.5 text-kit-sm leading-5 text-kit-fg\">\n <TypeOut text={out} />\n </div>\n )}\n </div>\n <div className=\"flex items-center justify-between gap-2 border-t border-kit-line px-3 py-2\">\n <Button size=\"xs\" variant=\"ghost\" onClick={onClose}>\n Discard\n </Button>\n <div className=\"flex gap-1\">\n {out || failed ? (\n <Button size=\"xs\" variant=\"ghost\" leftIcon={<IconRefresh stroke={1.5} />} onClick={() => preset && run(preset)}>\n Try again\n </Button>\n ) : null}\n <Button size=\"xs\" variant=\"primary\" disabled={!out} onClick={apply}>\n Apply\n </Button>\n </div>\n </div>\n </div>\n );\n}\n\n/* V2 components/motion.tsx Shimmer + TypeOut, kept local to the AI popover (their only kit user). */\nfunction Shimmer({ children }: { children: React.ReactNode }) {\n return (\n <span className=\"bg-[linear-gradient(90deg,var(--kit-fg-3)_0%,var(--kit-fg)_45%,var(--kit-fg-3)_90%)] bg-[length:200%_100%] bg-clip-text text-transparent [animation:kit-shimmer-text_1.6s_linear_infinite] motion-reduce:[animation:none]\">\n {children}\n </span>\n );\n}\n/**\n * Reduced motion as the app reads it: the OS query or the in-app preference (which stamps `data-reduce-motion` on\n * <html>; the kit cannot import the app's hook). Read per render, so a toggle applies to the next answer.\n */\nfunction motionReduced(): boolean {\n if (typeof window === \"undefined\") return false;\n return document.documentElement.hasAttribute(\"data-reduce-motion\") || !!window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;\n}\n\n/** Reduced: the whole answer at once, with no caret (canvas revamp V701, lib/motion TypeOut semantics). */\nfunction TypeOut({ text, speed = 14 }: { text: string; speed?: number }) {\n const reduce = motionReduced();\n const [n, setN] = React.useState(reduce ? text.length : 0);\n React.useEffect(() => {\n if (reduce) {\n setN(text.length);\n return;\n }\n setN(0);\n const id = setInterval(() => {\n setN((x) => {\n const next = Math.min(text.length, x + Math.max(1, Math.round(text.length / 120)));\n if (next >= text.length) clearInterval(id);\n return next;\n });\n }, speed);\n return () => clearInterval(id);\n }, [text, speed, reduce]);\n return (\n <span>\n {text.slice(0, n)}\n {n < text.length ? <span data-typeout-caret className=\"ml-0.5 inline-block h-[1em] w-[2px] translate-y-[2px] bg-kit-fg motion-safe:animate-pulse\" /> : null}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAI,OAA8E;;AAElF,IAAa,4BAA4B;CACvC,OAAO;AACT;AACA,IAAM,OAA+B;CAAE,OAAO;CAAY,MAAM;CAAU,OAAO;CAAW,WAAW;CAAe,MAAM;CAAU,QAAQ;CAAY,OAAO;CAAU,MAAM;CAAU,QAAQ;CAAqB,SAAS;CAAmB,QAAQ;CAAY,OAAO;AAAW;AAC1R,IAAM,UAAU,MAAe,UAAU,CAAwB,IAAI,SAAS,KAAK,MAAM;AAGzF,IAAM,WAAW,MAAc,EAAE,QAAQ,MAAM,OAAO,CAAC,CAAC,QAAQ,MAAM,MAAM,CAAC,CAAC,QAAQ,MAAM,MAAM;;AAElG,IAAM,cAAc,SAClB,KACG,MAAM,KAAK,CAAC,CACZ,KAAK,MAAM,EAAE,KAAK,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ACF;EACA,KAAK,CAAC;EACN,MAAM,KAAK,kBAAkB;GAC3B,MAAM,MAAM;IACV,MAAM,OAAO,KAAK,IAAI,KAAK,QAAQ,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,SAAS,GAAG,CAAC,CAAC;IACjF,IAAI,QAAQ,KAAK,QAAQ,cAAc,EAAE;IACzC,OAAO;GACT,CAAC;EACH,GAAG,KAAK;EACR,aAAa,cAAc,EAAE;CAC/B,GAAG;EAAC;EAAM;EAAO;CAAM,CAAC;CACxB,OACE,qBAAC,QAAD,EAAA,UAAA,CACG,KAAK,MAAM,GAAG,CAAC,GACf,IAAI,KAAK,SAAS,oBAAC,QAAD;EAAM,sBAAA;EAAmB,WAAU;CAA6F,CAAA,IAAI,IACnJ,EAAA,CAAA;AAEV"}
|
|
1
|
+
{"version":3,"file":"field-shell.js","names":[],"sources":["../../src/engine/field-shell.tsx"],"sourcesContent":["/**\n * FIELD SHELL — the one field chrome (V2 HEAD 9829bf1 kit/engine/field-shell.tsx; production FieldShell + CPO D8).\n *\n * [Label *] [ⓘ] [override dot] [changed dot] [synced] [EN] …… [42 / 60] [action] [Reset] [undo] [comments] [presence] [⋯]\n * help text (CPO D39: 12/16 --fg-3, 4px under the label, 1–2 lines; hidden while an error shows)\n * ┌ control ───────────────────────────────┐ ← peer editing: the control's border in their colour\n * └────────────────────────────────────────┘\n * error / warning message ……………………… meta (42 / 60)\n *\n * Accessories (add-comment, ⋯) take NO space at rest; they appear on hover/focus (always on touch). A comment\n * COUNT chip is always visible. AI lives in ⋯ (\"Rewrite with AI\"), never as a label sparkle (CPO-142).\n *\n * Services (toast, AI rewrite, in-place comments) come from KitServices; a missing service hides its surface.\n */\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport {\n IconAlertCircle, IconAlertTriangle, IconArrowBackUp, IconBraces, IconClipboard, IconCopy, IconDots, IconHistory, IconInfoCircle,\n IconLock, IconMessage, IconMessagePlus, IconRefresh, IconRotate, IconWorld,\n} from \"@tabler/icons-react\";\nimport { IconEraser as IconClearField, IconLink as IconFieldLink, IconRestore as IconResetDefault } from \"@tabler/icons-react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { Button, Sparkle } from \"../ui/button\";\nimport { Avatar, avatarRingSpread } from \"../ui/display\";\nimport { Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Popover, PopoverAnchor, PopoverContent, Tooltip } from \"../ui/overlay\";\nimport { presenceColor } from \"../ui/presence\";\nimport { cn } from \"../lib/cn\";\nimport { HISTORY_SEGMENT, type FieldPath, type FieldSchema } from \"../schema/types\";\nimport { resolveHelp } from \"../schema/help\";\nimport { AI_PRESETS, FieldHeaderSlot, KitSectionTitle, seesDevSurfaces, useForm, useKitEnv, useKitFocusField, useKitLook, useKitServices, type AiPreset, type KitCommentSelection, type KitPeer } from \"../context\";\nimport { FieldCounter, FieldSweep, FocusDot, counterState, overLimitText, useOverLimit } from \"../ui/inspector\";\nimport { InfoTooltip } from \"../ui/tooltip-card\";\nimport { pathKey, same } from \"../lib/path\";\nimport { emptyFor, initialFor, isEmptyValue, isTextual, plainText } from \"../lib/schema\";\nimport { textLength, type KitIssue } from \"../lib/validate\";\nimport { RowChrome } from \"./bits\";\n\n/* ── Clipboard shared by every field (typed, so Paste can refuse with a reason) ── */\n/** `html`: a rich text value as its editor html (read through the host's codec), so Paste re-stores it for the target field. */\nlet clip: { type: string; value: unknown; label: string; html?: string } | null = null;\n/** Test seam: forget the shared field clipboard. */\nexport const resetFieldClipboard = () => {\n clip = null;\n};\nconst KIND: Record<string, string> = { image: \"an image\", file: \"a file\", video: \"a video\", reference: \"a reference\", link: \"a link\", button: \"a button\", array: \"a list\", slot: \"blocks\", object: \"a group of fields\", boolean: \"an on/off value\", number: \"a number\", color: \"a colour\" };\nconst kindOf = (t: string) => (isTextual(t as FieldSchema[\"type\"]) ? \"text\" : KIND[t] ?? t);\n\ntype RichTextCodec = NonNullable<ReturnType<typeof useKitServices>[\"richText\"]>;\nconst escHtml = (s: string) => s.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\n/** Plain text as editor html: one escaped paragraph per line. */\nconst paragraphs = (text: string) =>\n text\n .split(/\\n+/)\n .map((l) => l.trim())\n .filter(Boolean)\n .map((l) => `<p>${escHtml(l)}</p>`)\n .join(\"\");\n/**\n * Html into a rich text field, stored in the field's own shape through the host's codec. A write that would drop\n * something is refused with the words the codec names; nothing is stored.\n */\nfunction richTextWrite(codec: RichTextCodec, field: FieldSchema, path: FieldPath, html: string, prev: unknown): { value: unknown } | { refused: string } {\n try {\n const out = codec.write(html, { field, path }, prev);\n return out.losses.length ? { refused: `${field.title} can't keep ${out.losses.join(\", \")}` } : { value: out.value };\n } catch (err) {\n return { refused: `${field.title} could not store this text (${err instanceof Error ? err.message : String(err)})` };\n }\n}\n/** A rich text value as editor html, when the host's codec reads it. */\nfunction richTextHtml(codec: RichTextCodec | undefined, field: FieldSchema, path: FieldPath, value: unknown): string | undefined {\n if (!codec || field.type !== \"richtext\") return undefined;\n try {\n return codec.read(value, { field, path }).html;\n } catch {\n return undefined; // Paste falls back to the value's words\n }\n}\n\nexport const apiName = (schemaName: string, path: FieldPath) =>\n [schemaName, ...path.filter((s) => s !== HISTORY_SEGMENT)].reduce<string>((a, s) => (typeof s === \"number\" ? `${a}[${s}]` : a ? `${a}.${s}` : String(s)), \"\");\n\n/** A long label truncates on one line; past this many characters a native `title` carries the full label (DESIGN 4.4). */\nexport const LABEL_HINT_AT = 28;\n\n/**\n * GAP-004: comment on words selected in this field. Set only where the field's comments open in place (the host's\n * `FieldComments`, no `env.onComment`): the field's comments popover opens with the selection, so the new thread is\n * about those words. Null where the host owns comments (`env.onComment`) or there are none.\n */\nexport const FieldCommentRequest = React.createContext<((sel: KitCommentSelection) => void) | null>(null);\n\n/* D63: add-comment and ⋯ are hidden at rest and show on THIS field's hover or focus (not a parent group's), always on\n touch, and while their menu or popover is open. The rule lives in tokens.css ([data-field-reveal]) because a Tailwind\n group variant matches every ancestor field, so hovering a group used to reveal the chrome of all its children. */\n\nexport interface FieldShellProps {\n field: FieldSchema;\n path: FieldPath;\n id: string;\n value: unknown;\n onChange: (v: unknown) => void;\n readOnly?: boolean;\n issue?: KitIssue;\n /** label-row action (e.g. slug \"Generate\") */\n action?: React.ReactNode;\n /** \"card\" = the boolean switch card · \"row\" = the control IS a labelled row (a drill-in object, CPO D45): no label row,\n * the chrome goes into the row through `RowChrome` */\n layout?: \"stack\" | \"card\" | \"row\";\n /** layout fields get no comment control */\n noComments?: boolean;\n /** right side of the message line (counters, \"3 items · max 6\") */\n meta?: React.ReactNode;\n className?: string;\n children: React.ReactNode;\n}\n\nexport function FieldShell({ field, path, id, value, onChange, readOnly, issue, action, layout = \"stack\", noComments, meta, className, children }: FieldShellProps) {\n const env = useKitEnv();\n const form = useForm();\n const services = useKitServices();\n const key = pathKey(path);\n /* A host can lift this field's chrome into its own header (All fields: a block whose only field is \"Stats\" under a\n \"Stats\" section) — then there is no label row at all; the label stays for screen readers. */\n const slot = React.useContext(FieldHeaderSlot);\n const lifted = slot && slot.key === key && layout === \"stack\" ? slot.el : null;\n const [ai, setAi] = React.useState(false);\n const [commentsOpen, setCommentsOpen] = React.useState(false);\n /* V2 fieldPopoverCollision: the comments popover stays inside the scrolling area the field sits in */\n const [commentArea, setCommentArea] = React.useState<CommentCollision>({ collisionPadding: 12 });\n const peers = env.presence[key] ?? [];\n const editor = peers.find((p) => p.status !== \"viewing\");\n const InPlaceComments = services.FieldComments;\n /* a meta-form (the schema editor's field settings) shows no comment, ⋯ or per-field undo chrome (KitEnv.fieldChrome) */\n const quiet = env.fieldChrome === \"quiet\";\n const bare = quiet || env.fieldChrome === \"preview\";\n const canComment = !noComments && !bare && (!!env.onComment || !!InPlaceComments);\n /* GAP-004: the selection a rich-text Comment opened the popover with (cleared when it closes) */\n const [commentSel, setCommentSel] = React.useState<KitCommentSelection | null>(null);\n const requestComment = React.useMemo(\n () =>\n canComment && !env.onComment && InPlaceComments\n ? (sel: KitCommentSelection) => {\n setCommentSel(sel);\n setCommentArea(fieldPopoverCollision(document.getElementById(id)?.closest(\"[data-field-key]\") ?? null));\n setCommentsOpen(true);\n }\n : null,\n [canComment, env.onComment, InPlaceComments, id],\n );\n const closeComments = () => {\n setCommentsOpen(false);\n setCommentSel(null);\n };\n /* REQ-2-6: the host opens this field's comments (with the words a plain field's selection quoted) by dispatching\n `openFieldComments(box, selection)` on the field's `[data-field-key]` box */\n const openRef = React.useRef<(sel?: KitCommentSelection) => void>(() => {});\n openRef.current = (sel) => {\n if (!canComment) return;\n if (env.onComment) return env.onComment(path, field);\n setCommentSel(sel ?? null);\n setCommentArea(fieldPopoverCollision(document.getElementById(id)?.closest(\"[data-field-key]\") ?? null));\n setCommentsOpen(true);\n };\n React.useEffect(() => {\n const box = document.getElementById(id)?.closest(\"[data-field-key]\");\n if (!box) return;\n const on = (e: Event) => {\n e.stopPropagation();\n openRef.current((e as CustomEvent<KitCommentSelection | undefined>).detail);\n };\n box.addEventListener(KIT_OPEN_FIELD_COMMENTS, on);\n return () => box.removeEventListener(KIT_OPEN_FIELD_COMMENTS, on);\n }, [id]);\n /* Look \"v16\" (prototype inspector.jsx:67-70, editor.css:414): the hover strip is link · comment · ⋯ */\n const v16 = useKitLook() === \"v16\";\n const openCount = env.comments[key] ?? 0; // with no env.onComment and a count hook, CommentButton reads the store\n const useStoreCount = env.onComment ? undefined : services.useFieldCommentCount;\n const changed = !!form?.hasPublished && !same(value, form.publishedAt(path));\n /* component instance (D28): a top-level field either inherits the component's value or overrides it */\n const inh = form?.inherited && path.length === 1 ? form.inherited : undefined;\n const overridden = !!inh && inh.isOverridden(key);\n /* D61: while the host's History is open, a changed field gets the host's 2px author-colour bar at its left edge\n (with its hover card) instead of the quiet \"changed\" dot. At rest (History closed) the dot stays. */\n const reviewing = !!env.review;\n const bar = env.review && env.review.count(path) > 0 ? env.review.bar(path, field) : null;\n const sectionTitle = React.useContext(KitSectionTitle);\n /* \"Options\" in a section called \"Options\": the section heading already names the field (the label stays for readers) */\n const repeatsSection = quiet && layout === \"stack\" && !!sectionTitle && sectionTitle.trim().toLowerCase() === field.title.trim().toLowerCase();\n const canUndo = !bare && !!form?.canUndo(key) && !readOnly;\n const synced = field.synced?.from; // a whole synced form shows one notice at its root, not a chip per field\n const limit = field.validation?.max ?? field.validation?.recommendedMax;\n const len = textLength(value);\n /* counters stay quiet: shown while the field has focus, or when the value nears its limit */\n const near = !!limit && len >= limit * 0.8;\n const counted = !!limit && (field.type === \"string\" || field.type === \"text\" || field.type === \"richtext\");\n /* look v16 M20 (content.css:618): over the limit the control box gets the red edge, and shakes once as it crosses */\n const overLimit = useOverLimit(v16 && counted && counterState(len, limit) === \"over\");\n const counter =\n counted ? (\n v16 ? (\n // look v16 (prototype content.jsx:319, insp.css:30): no counter while the value is far from its limit; near it\n // (above 91%) the amber \"n / max\" with its ring, over it red; the number rolls. 11/14 unless the host asks 12/16.\n counterState(len, limit) === \"ok\" ? null : <FieldCounter value={len} max={limit} size={env.counterSize ?? 11} />\n ) : (\n <span\n data-slot=\"field-counter\"\n className={cn(\n \"tabular-nums text-kit-xs\",\n !near && \"hidden group-focus-within/field:inline\",\n field.validation?.max && len > field.validation.max ? \"text-kit-danger-fg\" : field.validation?.recommendedMax && len > field.validation.recommendedMax ? \"text-kit-warning-fg\" : \"text-kit-fg-3\",\n )}\n >\n {len} / {limit}\n </span>\n )\n ) : null;\n\n /* ── Help (CPO D39) ── one line under the label; longer text behind ⓘ. Dense hosts (env.helpDisplay \"tooltip\")\n move the line into the ⓘ too. An error REPLACES the help (warnings keep it: they're advice, not a block). */\n const dense = env.helpDisplay === \"tooltip\";\n /* D70: a field locked for this person (its own edit cap, in a form they can otherwise change) says so: a small lock glyph\n before the reason. A whole read-only form (Viewer, view as) stays plain text with no glyphs (D58). A read-only field\n that carries its own lockReason is locked the same way, cap or no cap, so a dense host shows the reason too (DK-019). */\n const lockedHere = !!readOnly && !env.readOnly && (!!field.lockReason?.trim() || (!!field.access?.edit && !env.can(field.access.edit)));\n const help = lockedHere ? (field.lockReason?.trim() || \"Set by developers\").replace(/\\.?$/, \".\") : resolveHelp(field); // arrays / slots / objects reach the shell without KitField: conventions apply here too\n const helpNode = lockedHere ? (\n <span data-locked=\"\" className=\"inline-flex items-start gap-1\">\n <IconLock className=\"mt-px size-3 shrink-0\" stroke={1.75} aria-hidden />\n <span>\n <span className=\"sr-only\">Locked. </span>\n {help}\n </span>\n </span>\n ) : (\n help\n );\n const more = field.helpMore || undefined;\n const erroring = issue?.level === \"error\";\n // a lock's reason stays on the field even in a dense host: it says why the value can't change\n const helpInline = !!help && (!dense || lockedHere) && !erroring;\n const tip = dense && !lockedHere ? [help, more].filter(Boolean).join(\" \") : more;\n const helpId = `${id}-help`;\n const moreId = `${id}-more`;\n const msgId = `${id}-msg`;\n const describedBy = [helpInline && helpId, tip && moreId, issue && msgId].filter(Boolean).join(\" \");\n /* Controls are many (input, textarea, contenteditable, pickers); the shell owns the ids, so it wires\n aria-describedby onto whatever element carries the field id, keeping any ids the control set itself. */\n React.useEffect(() => {\n const el = document.getElementById(id);\n if (!el) return;\n const own = (el.getAttribute(\"aria-describedby\") ?? \"\").split(\" \").filter((t) => t && !t.startsWith(`${id}-`));\n const next = [...own, ...describedBy.split(\" \").filter(Boolean)].join(\" \");\n if (next) el.setAttribute(\"aria-describedby\", next);\n else el.removeAttribute(\"aria-describedby\");\n }, [id, describedBy]);\n const info = tip ? (\n v16 ? (\n // look v16 (F1324, prototype inspector.jsx Info): the white card, the label as its title, 240 wide, 250ms\n <>\n <InfoTooltip title={field.title}>{tip}</InfoTooltip>\n <span id={moreId} className=\"sr-only\">\n {tip}\n </span>\n </>\n ) : (\n <Tooltip content={<span className=\"block max-w-[260px] whitespace-normal font-normal leading-4\">{tip}</span>}>\n <button type=\"button\" aria-label={`About ${field.title}`} className=\"-my-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded-kit-sm text-kit-fg-4 hover:text-kit-fg-2\">\n <IconInfoCircle className=\"size-3.5\" stroke={1.5} aria-hidden />\n <span id={moreId} className=\"sr-only\">{tip}</span>\n </button>\n </Tooltip>\n )\n ) : null;\n\n // KP-029/223: a long label truncates on one line with a native title; the boolean card's label wraps under its switch.\n const longTitle = field.title.length > LABEL_HINT_AT ? field.title : undefined;\n const labelOf = (wrap: boolean) => (\n <>\n <span className={wrap ? \"min-w-0 break-words\" : \"truncate\"}>{field.title}</span>\n {field.validation?.required ? (\n <>\n {/* look v16 (F1323): \" *\" is part of the label text, in the label's own ink */}\n <span aria-hidden className={v16 ? \"whitespace-pre\" : \"text-kit-fg-2\"}>\n {v16 ? \" *\" : \"*\"}\n </span>\n <span className=\"sr-only\">(required)</span>\n </>\n ) : null}\n </>\n );\n const label = labelOf(false);\n const badges = (\n <>\n {overridden ? (\n <Tooltip content={`Overrides ${inh!.from}. Changes to the block no longer reach this field.`}>\n <span role=\"img\" className=\"size-1.5 shrink-0 rounded-full bg-kit-accent\" aria-label={`Overrides ${inh!.from}`} />\n </Tooltip>\n ) : null}\n {changed && !reviewing ? (\n <Tooltip content=\"Changed since publish\">\n <span role=\"img\" className=\"size-1.5 shrink-0 rounded-full bg-kit-warning\" aria-label=\"Changed since publish\" />\n </Tooltip>\n ) : null}\n {synced ? (\n <Tooltip content={`Synced from ${synced}. Changes apply on every page that uses it.`}>\n <span className=\"inline-flex h-4 shrink-0 items-center gap-0.5 rounded-kit-md bg-kit-info-soft px-1 text-kit-2xs font-medium text-kit-info-fg\">\n <IconRefresh className=\"size-2.5\" stroke={2} aria-hidden />\n Synced\n </span>\n </Tooltip>\n ) : null}\n {field.localized ? (\n <Tooltip content=\"Translatable: this field can hold a value for each of the site's languages.\">\n <span className=\"inline-flex h-4 shrink-0 items-center gap-0.5 rounded-kit-md bg-kit-muted px-1 text-kit-2xs font-medium text-kit-fg-3\">\n <IconWorld className=\"size-2.5\" stroke={2} aria-hidden />\n EN\n </span>\n </Tooltip>\n ) : null}\n </>\n );\n const accessories = (\n <>\n {action}\n {overridden && !readOnly ? (\n <Tooltip content={`Use ${inh!.from}'s value again`}>\n <button\n type=\"button\"\n onClick={(e) => {\n const box = (e.currentTarget as HTMLElement).closest<HTMLElement>(\"[data-field-key]\");\n inh!.reset(key);\n // the button goes away with the override: keep focus in the field, never on <body>\n requestAnimationFrame(() => (document.getElementById(id) ?? box?.querySelector<HTMLElement>(\"textarea, input, [contenteditable=true], button\"))?.focus({ preventScroll: true }));\n }}\n aria-label={`Reset ${field.title} to ${inh!.from}`}\n className=\"inline-flex h-5 items-center rounded-kit-md px-1 text-kit-xs text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg\"\n >\n Reset\n </button>\n </Tooltip>\n ) : null}\n {canUndo ? (\n <Tooltip content={`Undo last change to ${field.title}`}>\n <button type=\"button\" aria-label={`Undo last change to ${field.title}`}\n onClick={(e) => {\n const btn = e.currentTarget as HTMLElement;\n const box = btn.closest<HTMLElement>(\"[data-field-key]\");\n form?.undo(key);\n // KB-006: the last undo takes the button away; keep focus in the field, never on <body>\n requestAnimationFrame(() => {\n if (!btn.isConnected) (document.getElementById(id) ?? box?.querySelector<HTMLElement>(\"textarea, input, [contenteditable=true], button\"))?.focus({ preventScroll: true });\n });\n }}\n className=\"inline-flex size-5 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg\">\n <IconArrowBackUp className=\"size-3.5\" stroke={1.5} aria-hidden />\n </button>\n </Tooltip>\n ) : null}\n {v16 && !bare ? (\n <Tooltip content=\"Copy link to field\">\n <button\n type=\"button\"\n data-field-reveal=\"\"\n aria-label={`Copy link to ${field.title}`}\n className=\"-my-0.5 size-5 items-center justify-center rounded-[4px] text-kit-fg-3 hover:bg-kit-insp-track hover:text-kit-fg focus-visible:outline-2 focus-visible:outline-offset-1 [&_svg]:size-4\"\n onClick={() => {\n // prototype inspector.jsx:68: this address without its hash, then \"#\" and the field\n const href = `${window.location.href.split(\"#\")[0]}#${encodeURIComponent(key)}`;\n const w = navigator.clipboard?.writeText(href);\n if (!w) return services.toast?.(\"Copy is not available in this browser\");\n w.then(\n () => services.toast?.(\"Link to field copied\"),\n () => services.toast?.(\"The browser refused to copy the link\"),\n );\n }}\n >\n <IconFieldLink stroke={1.5} aria-hidden />\n </button>\n </Tooltip>\n ) : null}\n {canComment ? (\n <CommentButton\n count={openCount}\n useCount={useStoreCount ? () => useStoreCount(env.docId, key) : undefined}\n label={field.title}\n open={commentsOpen}\n onThreads={!env.onComment && services.onOpenFieldThreads ? () => services.onOpenFieldThreads!(env.docId, key) : undefined}\n onOpen={(el) => {\n if (env.onComment) return env.onComment(path, field); // the host owns comments (e.g. the document editor)\n setCommentSel(null);\n setCommentArea(fieldPopoverCollision(el.closest(\"[data-field-key]\")));\n setCommentsOpen(true);\n }}\n />\n ) : null}\n <PeerStack peers={peers} />\n {bare ? null : <FieldMenu field={field} path={path} value={value} onChange={onChange} readOnly={!!readOnly} changed={changed} onAi={() => setAi(true)} />}\n </>\n );\n\n // Peer editing (Figma / Notion / Sanity): only the field's own input border takes their --presence-n colour (full strength:\n // the old 70% mix read as a validation error at 1.96:1) —\n // no outline around the input + preview, no name tag over the border, no layout shift. Who it is: the face in the label row.\n const control = (\n <div\n className={cn(\"relative\", editor && \"[&_.border-kit-field-border]:border-[var(--peer)]\", overLimit.className)}\n onAnimationEnd={overLimit.onAnimationEnd}\n style={editor ? ({ \"--peer\": editor.color ?? presenceColor(editor.id ?? editor.name) } as React.CSSProperties) : undefined}\n >\n {children}\n </div>\n );\n\n const message =\n issue || meta ? (\n <div className=\"flex min-h-4 items-start justify-between gap-3\">\n <AnimatePresence initial={false}>\n {issue ? (\n <motion.p\n key={issue.message}\n id={msgId}\n initial={{ opacity: 0, y: -2 }}\n animate={{ opacity: 1, y: 0 }}\n role={issue.level === \"error\" ? \"alert\" : \"status\"}\n className={cn(\"flex min-w-0 items-start gap-1 text-kit-xs\", issue.level === \"error\" ? \"text-kit-danger-fg\" : \"text-kit-warning-fg\")}\n >\n {issue.level === \"error\" ? <IconAlertCircle className=\"mt-px size-3.5 shrink-0\" stroke={1.5} aria-hidden /> : <IconAlertTriangle className=\"mt-px size-3.5 shrink-0\" stroke={1.5} aria-hidden />}\n <span className=\"min-w-0\">\n {/* look v16 (F1339, prototype content.jsx Field): the over-limit line is \"Over the N-character limit\" */}\n {v16 && issue.kind === \"rule\" && limit && len > limit && /^Keep it under \\d+ characters/.test(issue.message) ? overLimitText(limit) : issue.message}\n {issue.fix && !readOnly ? (\n <>\n {\" \"}\n <button type=\"button\" onClick={issue.fix.apply} className=\"font-medium text-kit-fg underline-offset-2 hover:underline\">\n {issue.fix.label}\n </button>\n </>\n ) : null}\n </span>\n </motion.p>\n ) : (\n <span />\n )}\n </AnimatePresence>\n {meta ? <span className=\"flex shrink-0 items-center gap-2\">{meta}</span> : null}\n </div>\n ) : null;\n\n /* P-FDOT: the host names the field a canvas click opened; its label takes the focus dot, the field the sweep */\n const focus = useKitFocusField();\n const focused = !!focus && focus.key === key;\n const labelEl = (\n <label\n htmlFor={id}\n id={`${id}-label`}\n className=\"flex min-w-0 items-center gap-1 text-kit-sm font-medium text-kit-fg-2 transition-colors group-focus-within/field:text-kit-fg\"\n title={longTitle}\n >\n {label}\n {focused ? <FocusDot /> : null}\n </label>\n );\n\n const body =\n layout === \"row\" ? (\n <div className={cn(\"group/field relative flex min-w-0 flex-col gap-1.5\", className)} data-field-key={key} data-field={path.length === 1 ? key : undefined} data-slot=\"kit-field\">\n {bar}\n <RowChrome.Provider value={<>{info}{badges}{accessories}</>}>{control}</RowChrome.Provider>\n {message}\n </div>\n ) : layout === \"card\" && quiet ? (\n /* the inspector's PRow: label left, switch right, no card (a meta-form's Required, Unique, Tuck into Advanced) */\n <div className={cn(\"group/field relative flex flex-col gap-1\", className)} data-field-key={key} data-field={path.length === 1 ? key : undefined} data-slot=\"kit-field\">\n {bar}\n <div data-field-head=\"\" className=\"flex min-h-8 items-center gap-3\">\n <label htmlFor={id} id={`${id}-label`} className=\"min-w-0 flex-1 cursor-pointer\" title={longTitle}>\n <span className=\"flex min-w-0 items-center gap-1 text-kit-sm font-medium text-kit-fg-2 transition-colors group-focus-within/field:text-kit-fg\">\n {label}\n {info}\n {badges}\n </span>\n {helpInline ? (\n <span id={helpId} data-slot=\"field-help\" className=\"mt-0.5 block text-kit-xs leading-4 text-kit-fg-3\">\n {helpNode}\n </span>\n ) : null}\n </label>\n <span className=\"flex shrink-0 items-center gap-0.5 empty:hidden\">{accessories}</span>\n <span className=\"flex shrink-0 items-center\">{readOnly ? <span className=\"text-kit-sm text-kit-fg-2\">{value ? \"On\" : \"Off\"}</span> : control}</span>\n </div>\n {message}\n </div>\n ) : layout === \"card\" ? (\n <div className={cn(\"group/field relative flex flex-col gap-1.5\", className)} data-field-key={key} data-field={path.length === 1 ? key : undefined} data-slot=\"kit-field\">\n {bar}\n <div data-field-head=\"\" className={cn(\"flex items-center gap-3 rounded-kit-lg border bg-kit-surface px-3 py-2.5 transition-colors\", issue?.level === \"error\" ? \"border-[var(--kit-field-invalid)]\" : \"border-kit-line-strong hover:border-[var(--kit-emphasis-line)]\")}>\n {control}\n <label htmlFor={id} id={`${id}-label`} className=\"min-w-0 flex-1 cursor-pointer\" title={longTitle}>\n <span className=\"flex min-w-0 items-center gap-1.5 text-kit-sm font-medium text-kit-fg\">\n {labelOf(true)}\n {info}\n {badges}\n </span>\n {helpInline ? (\n <span id={helpId} data-slot=\"field-help\" className=\"block text-kit-xs leading-4 text-kit-fg-3\">\n {helpNode}\n </span>\n ) : null}\n </label>\n <span className=\"shrink-0 text-kit-xs text-kit-fg-3\">{value ? \"On\" : \"Off\"}</span>\n <span className=\"flex shrink-0 items-center gap-0.5 empty:hidden\">{accessories}</span>\n </div>\n {message}\n </div>\n ) : (\n <div\n className={cn(\"group/field relative flex min-w-0 flex-col gap-1.5\", focused && \"isolate\", className)}\n data-field-key={key}\n data-field={path.length === 1 ? key : undefined}\n data-slot=\"kit-field\"\n data-inherited={inh && !overridden ? \"\" : undefined}\n data-overridden={overridden ? \"\" : undefined}\n data-cur={focused ? \"\" : undefined}\n >\n {focused && focus?.flash != null ? <FieldSweep key={String(focus.flash)} /> : null}\n {bar}\n {repeatsSection ? (\n <label htmlFor={id} id={`${id}-label`} className=\"sr-only\">\n {label}\n </label>\n ) : lifted ? (\n <>\n <label htmlFor={id} id={`${id}-label`} className=\"sr-only\">\n {label}\n </label>\n {createPortal(\n <span className=\"flex items-center gap-0.5 [&>button]:!inline-flex\">\n {info}\n {badges}\n {counter}\n {accessories}\n </span>,\n lifted,\n )}\n </>\n ) : (\n <div data-slot=\"field-label-row\" data-field-head=\"\" className=\"flex min-h-5 min-w-0 items-center gap-1.5\">\n {labelEl}\n {info}\n {badges}\n <span className=\"flex-1\" />\n {counter}\n <span className=\"flex shrink-0 items-center gap-0.5\">{accessories}</span>\n </div>\n )}\n {helpInline ? (\n <p id={helpId} data-slot=\"field-help\" className=\"-mt-0.5 text-kit-xs leading-4 text-kit-fg-3\">\n {helpNode}\n </p>\n ) : null}\n {control}\n {message}\n </div>\n );\n\n // the host says how its comments body sits on the field (REQ-3-7); absent, the kit's own popover\n const commentPop = commentsOpen && services.fieldCommentsPopover ? services.fieldCommentsPopover({ selection: !!commentSel }) : null;\n /* The AI popover and the comments popover both anchor to the field (two stacked anchor divs). */\n return (\n <FieldCommentRequest.Provider value={requestComment}>\n <Popover open={ai} onOpenChange={setAi}>\n <PopoverAnchor className=\"min-w-0\">\n <Popover\n open={commentsOpen}\n onOpenChange={(open, d) => {\n /* V2 guardEscape: Escape inside the composer (data-esc-owner) belongs to the draft, not the popover */\n if (!open && d.reason === \"escape-key\" && (document.activeElement as HTMLElement | null)?.hasAttribute(\"data-esc-owner\")) return d.cancel();\n setCommentsOpen(open);\n if (!open) setCommentSel(null);\n }}\n >\n <PopoverAnchor className=\"min-w-0\">{body}</PopoverAnchor>\n {commentsOpen && InPlaceComments ? (\n <PopoverContent\n align=\"start\"\n sideOffset={commentPop?.sideOffset ?? 8}\n alignOffset={commentPop?.alignOffset}\n {...commentArea}\n initialFocus={false}\n className={cn(\"p-0\", commentPop?.className ?? \"w-[clamp(280px,var(--anchor-width),420px)]\")}\n >\n <InPlaceComments\n docId={env.docId}\n fieldKey={key}\n label={field.title}\n quote={plainText(value).slice(0, 80) || undefined}\n selection={commentSel ?? undefined}\n onClose={closeComments}\n onOpenPanel={\n env.onComment\n ? () => {\n env.onComment?.(path, field);\n setCommentsOpen(false);\n }\n : undefined\n }\n />\n </PopoverContent>\n ) : null}\n </Popover>\n </PopoverAnchor>\n {ai ? (\n <PopoverContent align=\"start\" sideOffset={8} className=\"w-[clamp(300px,var(--anchor-width),440px)] p-0\">\n <AiRewrite field={field} path={path} value={value} onChange={onChange} onClose={() => setAi(false)} />\n </PopoverContent>\n ) : null}\n </Popover>\n </FieldCommentRequest.Provider>\n );\n}\n\n/** REQ-2-6: the event a field's box answers by opening its comments (`detail`: the quoted selection, or none). */\nexport const KIT_OPEN_FIELD_COMMENTS = \"kit:open-field-comments\";\n/** Opens the comments of the field whose `[data-field-key]` box is `box` (a plain field's selected words as `selection`). */\nexport function openFieldComments(box: Element, selection?: KitCommentSelection) {\n box.dispatchEvent(new CustomEvent(KIT_OPEN_FIELD_COMMENTS, { detail: selection }));\n}\n\ntype CommentCollision = { collisionBoundary?: Element; collisionPadding: number | Partial<Record<\"top\" | \"right\" | \"bottom\" | \"left\", number>> };\n/** V2 features/comments fieldPopoverCollision: inside a scrolling panel, collide with that panel below its sticky header. */\nfunction fieldPopoverCollision(anchor: Element | null): CommentCollision {\n let area = anchor?.parentElement ?? null;\n while (area && !/(auto|scroll)/.test(getComputedStyle(area).overflowY)) area = area.parentElement;\n if (!area || area === document.scrollingElement) return { collisionPadding: 12 };\n const sticky = parseFloat(getComputedStyle(area).getPropertyValue(\"--kit-sticky-top\")) || 0;\n return { collisionBoundary: area, collisionPadding: { top: sticky + 8, right: 8, bottom: 8, left: 8 } };\n}\n\n/** Comment count chip (always visible) or the hover-revealed \"Add comment\" icon. `useCount` (the host's store hook)\n * replaces `count` when the kit draws the comments in place. */\nfunction CommentButton({ useCount, ...props }: CommentButtonProps & { useCount?: () => number }) {\n return useCount ? <StoreCommentButton useCount={useCount} {...props} /> : <CountedCommentButton {...props} />;\n}\ninterface CommentButtonProps {\n count: number;\n label: string;\n open: boolean;\n onOpen: (el: HTMLElement) => void;\n /** with open threads: the host's panel opens on this field instead of the popover */\n onThreads?: () => void;\n}\nfunction StoreCommentButton({ useCount, ...props }: CommentButtonProps & { useCount: () => number }) {\n return <CountedCommentButton {...props} count={useCount()} />;\n}\nfunction CountedCommentButton({ count, label, open, onOpen, onThreads }: CommentButtonProps) {\n // look v16 copy (prototype comments.jsx:177-205): \"Comment\" / \"{n} comments · open thread\"\n const v16 = useKitLook() === \"v16\";\n const n = `${count} comment${count === 1 ? \"\" : \"s\"}`;\n if (count > 0)\n return (\n <Tooltip content={v16 ? `${n} · open thread` : `${count} open comment${count === 1 ? \"\" : \"s\"} on ${label}`}>\n <button\n type=\"button\"\n onClick={(e) => (onThreads ? onThreads() : onOpen(e.currentTarget))}\n data-state={open ? \"open\" : \"closed\"}\n aria-label={v16 ? `${n} on ${label} · open thread` : `${count} open comments on ${label}`}\n className=\"-my-0.5 inline-flex h-5 items-center gap-0.5 rounded-kit-md px-1 text-kit-2xs font-medium text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg data-[state=open]:bg-kit-hover data-[state=open]:text-kit-fg\"\n >\n <IconMessage className=\"size-3.5\" stroke={1.5} aria-hidden />\n <span className=\"tabular-nums\">{count}</span>\n </button>\n </Tooltip>\n );\n return (\n <Tooltip content={v16 ? \"Comment\" : \"Add comment\"}>\n <button\n type=\"button\"\n onClick={(e) => onOpen(e.currentTarget)}\n data-state={open ? \"open\" : \"closed\"}\n aria-label={v16 ? `Comment on ${label}` : `Add comment to ${label}`}\n data-field-reveal=\"\" className={cn(\"-my-0.5 size-6 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg\")}\n >\n <IconMessagePlus className=\"size-3.5\" stroke={1.5} aria-hidden />\n </button>\n </Tooltip>\n );\n}\n\n/** Who is in this field: 16px faces in the label row's action slot (no overlap with the label or the input), name on hover. */\nexport function PeerStack({ peers, size = 16 }: { peers: KitPeer[]; size?: number }) {\n const shown = peers.slice(0, 3);\n const rest = peers.length - shown.length;\n // Each slot reserves the ring band (1px surface gap + 1px presence colour) on every side, so the ring sits inside\n // the slot: a clipping ancestor or the row's edge can never shave it. Faces still overlap by 25% of their size.\n const ring = \"var(--kit-avatar-ring, var(--kit-surface))\";\n const band = avatarRingSpread({ ring, ringWidth: 1, ringAccent: \"x\" });\n const box = size + band * 2;\n const overlap = -(Math.round(size * 0.25) + band * 2);\n return (\n <AnimatePresence initial={false}>\n {shown.length ? (\n <motion.span key=\"peers\" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={{ duration: 0.25 }} className=\"flex h-5 items-center\" data-slot=\"field-presence\">\n {/* D34 stack rules: same size, 25% overlap, first face on top; the ring is box-shadow (surface gap + the\n peer's presence colour) so the photo keeps its full size. */}\n {shown.map((p, i) => (\n <Tooltip key={p.name + i} content={`${p.name} · ${p.status === \"viewing\" ? \"Viewing\" : \"Editing\"} this field`}>\n <span\n style={{ marginLeft: i ? overlap : 0, zIndex: shown.length - i + 1, width: box, height: box }}\n className={cn(\"relative inline-flex shrink-0 rounded-full transition-transform duration-150 hover:!z-30 hover:-translate-y-px\", p.status === \"viewing\" && \"opacity-60\")}\n >\n <Avatar name={p.name} src={p.avatar} size={size} ring={ring} ringWidth={1} ringAccent={p.color ?? presenceColor(p.id ?? p.name)} decorative />\n </span>\n </Tooltip>\n ))}\n {rest > 0 ? (\n <Tooltip content={peers.slice(shown.length).map((p) => p.name).join(\", \")}>\n <span style={{ marginLeft: overlap, width: box, height: box, padding: band }} className=\"relative z-[1] inline-flex shrink-0\">\n <span\n style={{ width: size, height: size, boxShadow: `0 0 0 ${band}px var(--kit-surface)`, fontSize: Math.max(8, Math.round(size * 0.5)) }}\n className=\"inline-flex items-center justify-center rounded-full bg-kit-muted font-medium leading-none tabular-nums text-kit-fg-2\"\n >\n +{rest}\n </span>\n </span>\n </Tooltip>\n ) : null}\n </motion.span>\n ) : null}\n </AnimatePresence>\n );\n}\n\n/** The field ⋯ menu alone, for a field drawn without its shell (a top-level Object group's header, look v16). */\nexport function FieldActionsMenu({ field, path, value, onChange, readOnly }: { field: FieldSchema; path: FieldPath; value: unknown; onChange: (v: unknown) => void; readOnly?: boolean }) {\n const form = useForm();\n const changed = !!form?.hasPublished && !same(value, form.publishedAt(path));\n return <FieldMenu field={field} path={path} value={value} onChange={onChange} readOnly={!!readOnly} changed={changed} onAi={() => {}} />;\n}\n\n/* ── ⋯ Field actions (DESIGN 8.25) ─────────────────────────────────── */\nfunction FieldMenu({ field, path, value, onChange, readOnly, changed, onAi }: { field: FieldSchema; path: FieldPath; value: unknown; onChange: (v: unknown) => void; readOnly: boolean; changed: boolean; onAi: () => void }) {\n const form = useForm();\n const env = useKitEnv();\n const { toast, aiRewrite, richText, FieldMenuExtras } = useKitServices();\n const key = pathKey(path);\n const api = apiName(form?.schema.name ?? \"doc\", path);\n const textual = isTextual(field.type);\n // rich text is rewritten only where the host's codec can store the result in the field's own shape\n const prose = field.type === \"string\" || field.type === \"text\" || (field.type === \"richtext\" && !!richText);\n const editable = !readOnly;\n const dev = seesDevSurfaces(env);\n /* Look \"v16\" (prototype inspector.jsx Field ⋯ menu): the rows are named for the field (\"Copy field\", \"Paste field\",\n \"View field history\"), and the menu gains \"Reset to default\" (the schema's initial value) and a red \"Clear field\". */\n const v16 = useKitLook() === \"v16\";\n const copyField = () => {\n const html = richTextHtml(richText, field, path, value);\n clip = { type: field.type, value: structuredCloneish(value), label: field.title, ...(html !== undefined ? { html } : {}) };\n const text = textual ? plainText(value) || \"\" : typeof value === \"string\" ? value : JSON.stringify(value ?? null, null, 2);\n void navigator.clipboard?.writeText(text).catch(() => {});\n toast?.success(`${field.title} copied`);\n };\n const copyApi = () => {\n void navigator.clipboard?.writeText(api).catch(() => {});\n toast?.success(`Copied ${api}`);\n };\n const resetPublished =\n editable && form?.hasPublished && changed ? (\n <MenuItem\n icon={<IconRotate stroke={1.5} />}\n onClick={() => {\n const prev = value;\n onChange(form.publishedAt(path));\n toast?.(`${field.title} reset to published`, { action: { label: \"Undo\", onClick: () => onChange(prev) }, duration: 10_000 });\n }}\n >\n Reset to published\n </MenuItem>\n ) : null;\n const aiRows =\n editable && prose && aiRewrite ? (\n <>\n <MenuSeparator />\n {form?.aiKeys.has(key) ? (\n <MenuItem\n icon={<IconArrowBackUp stroke={1.5} />}\n onClick={() => {\n form.undo(key);\n form.markAi(key, false);\n }}\n >\n Undo AI change\n </MenuItem>\n ) : null}\n <MenuItem icon={<Sparkle size={16} />} onClick={() => window.setTimeout(onAi, 0)}>\n Rewrite with AI\n </MenuItem>\n </>\n ) : null;\n return (\n <Menu>\n <Tooltip content=\"Field actions\">\n <MenuTrigger\n aria-label={`${field.title} actions`}\n data-field-reveal=\"\" className={cn(\"-my-0.5 size-6 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg data-[popup-open]:bg-kit-hover data-[popup-open]:text-kit-fg\")}\n >\n <IconDots className=\"size-3.5\" stroke={1.5} aria-hidden />\n </MenuTrigger>\n </Tooltip>\n <MenuContent align=\"end\" className=\"w-60\">\n {v16 ? (\n /* prototype inspector.jsx:54-61: Copy field · Copy API name · Paste field | Reset to default · View field\n history | Clear field (the host's extras and the AI rows follow) */\n <>\n <MenuItem icon={<IconCopy stroke={1.5} />} shortcut=\"⌘C\" onClick={copyField}>\n Copy field\n </MenuItem>\n <MenuItem icon={<IconBraces stroke={1.5} />} onClick={copyApi}>\n <span className=\"flex w-full items-center justify-between gap-3\">\n Copy API name\n <span className=\"truncate text-[12px] leading-4 text-kit-insp-faint\">{api.length > 22 ? `…${api.slice(-20)}` : api}</span>\n </span>\n </MenuItem>\n {editable ? <PasteItem field={field} path={path} value={value} onChange={onChange} /> : null}\n {editable || env.onFieldHistory ? <MenuSeparator /> : null}\n {editable ? (\n <MenuItem\n icon={<IconResetDefault stroke={1.5} />}\n onClick={() => {\n const prev = value;\n onChange(initialFor(field));\n toast?.(`${field.title} reset to default`, { action: { label: \"Undo\", onClick: () => onChange(prev) }, duration: 10_000 });\n }}\n >\n Reset to default\n </MenuItem>\n ) : null}\n {resetPublished}\n {env.onFieldHistory ? (\n <MenuItem icon={<IconHistory stroke={1.5} />} onClick={() => env.onFieldHistory!(path, field)}>\n View field history\n </MenuItem>\n ) : null}\n {editable ? (\n <>\n <MenuSeparator />\n <MenuItem\n danger\n icon={<IconClearField stroke={1.5} />}\n disabled={isEmptyValue(value)}\n onClick={() => {\n const prev = value;\n onChange(emptyFor(field));\n toast?.(`${field.title} cleared`, { action: { label: \"Undo\", onClick: () => onChange(prev) }, duration: 10_000 });\n }}\n >\n Clear field\n </MenuItem>\n </>\n ) : null}\n {FieldMenuExtras ? <FieldMenuExtras field={field} path={path} readOnly={readOnly} /> : null}\n {aiRows}\n </>\n ) : (\n <>\n <MenuItem icon={<IconCopy stroke={1.5} />} onClick={copyField}>\n Copy value\n </MenuItem>\n {editable ? <PasteItem field={field} path={path} value={value} onChange={onChange} /> : null}\n {resetPublished}\n {env.onFieldHistory ? (\n <MenuItem icon={<IconHistory stroke={1.5} />} onClick={() => env.onFieldHistory!(path, field)}>\n History\n </MenuItem>\n ) : null}\n {FieldMenuExtras ? <FieldMenuExtras field={field} path={path} readOnly={readOnly} /> : null}\n {aiRows}\n {dev ? <MenuSeparator /> : null}\n {dev ? (\n <MenuItem icon={<IconBraces stroke={1.5} />} onClick={copyApi}>\n <span className=\"flex w-full items-center justify-between gap-3\">\n Copy API name\n <span className=\"truncate font-kit-mono text-kit-2xs text-kit-fg-3\">{api.length > 22 ? `…${api.slice(-20)}` : api}</span>\n </span>\n </MenuItem>\n ) : null}\n </>\n )}\n </MenuContent>\n </Menu>\n );\n}\n/** Reads the shared clipboard when the menu opens (it mounts with the popup), so a copy in another field is seen. */\nfunction PasteItem({ field, path, value, onChange }: { field: FieldSchema; path: FieldPath; value: unknown; onChange: (v: unknown) => void }) {\n const { toast, richText } = useKitServices();\n const v16 = useKitLook() === \"v16\";\n const textual = isTextual(field.type);\n // text into rich text needs the host's codec to store it in the field's shape\n const needsCodec = !!clip && field.type === \"richtext\" && clip.type !== \"richtext\" && !richText;\n const pasteOk = clip && !needsCodec && (clip.type === field.type || (textual && isTextual(clip.type as FieldSchema[\"type\"])));\n const pasteReason = !clip\n ? v16 ? \"Copy a field first\" : \"Copy a value from a field first.\"\n : needsCodec\n ? \"This rich text field takes a copied rich text value only.\"\n : pasteOk\n ? null\n : `Clipboard holds ${kindOf(clip.type)}. This field takes ${kindOf(field.type)}.`;\n return (\n <MenuItem\n icon={<IconClipboard stroke={1.5} />}\n disabled={!pasteOk}\n className={cn(pasteReason && \"h-auto py-1.5\")}\n onClick={() => {\n if (!clip) return;\n const prev = value;\n let next: unknown;\n if (field.type === \"richtext\" && richText && (clip.type !== \"richtext\" || clip.html !== undefined)) {\n // through the codec: the target field's own shape and Accept list, refused by name when it would drop something\n const out = richTextWrite(richText, field, path, clip.html ?? paragraphs(plainText(clip.value)), prev);\n if (\"refused\" in out) {\n toast?.(`Not pasted: ${out.refused}.`);\n return;\n }\n next = out.value;\n } else next = textual && clip.type === \"richtext\" && field.type !== \"richtext\" ? plainText(clip.value) : structuredCloneish(clip.value);\n onChange(next);\n toast?.(`Pasted into ${field.title}`, { action: { label: \"Undo\", onClick: () => onChange(prev) }, duration: 10_000 });\n }}\n >\n <span className=\"flex flex-col\">\n {v16 ? \"Paste field\" : \"Paste value\"}\n {pasteReason ? <span className=\"whitespace-normal text-kit-xs text-kit-fg-3\">{pasteReason}</span> : null}\n </span>\n </MenuItem>\n );\n}\nfunction structuredCloneish<T>(v: T): T {\n try {\n return structuredClone(v);\n } catch {\n return v;\n }\n}\n\n/* ── Rewrite with AI (preview before apply) ────────────────────────── */\nfunction AiRewrite({ field, path, value, onChange, onClose }: { field: FieldSchema; path: FieldPath; value: unknown; onChange: (v: unknown) => void; onClose: () => void }) {\n const form = useForm();\n const { toast, aiRewrite, richText } = useKitServices();\n const key = pathKey(path);\n const [preset, setPreset] = React.useState<AiPreset | null>(null);\n const [out, setOut] = React.useState<string | null>(null);\n const [failed, setFailed] = React.useState(false);\n const attempt = React.useRef(0);\n const latest = React.useRef(0);\n const source = plainText(value);\n const run = (p: AiPreset) => {\n if (!aiRewrite) return;\n setPreset(p);\n setOut(null);\n setFailed(false);\n const ticket = ++latest.current;\n Promise.resolve()\n .then(() => aiRewrite(source, p, attempt.current++))\n .then(\n (result) => {\n if (latest.current === ticket) setOut(result);\n },\n () => {\n if (latest.current === ticket) setFailed(true);\n },\n );\n };\n const apply = () => {\n if (!out) return;\n const prev = value;\n let next: unknown = out;\n if (field.type === \"richtext\") {\n const stored = richText ? richTextWrite(richText, field, path, paragraphs(out), prev) : { refused: `${field.title} has no rich text storage here` };\n if (\"refused\" in stored) {\n toast?.(`Not applied: ${stored.refused}.`);\n return;\n }\n next = stored.value;\n }\n onChange(next);\n form?.markAi(key, true);\n toast?.(\"Rewritten with AI\", {\n icon: <Sparkle size={14} />,\n action: {\n label: \"Undo\",\n onClick: () => {\n onChange(prev);\n form?.markAi(key, false);\n },\n },\n duration: 10_000,\n });\n onClose();\n };\n return (\n <div className=\"flex flex-col\">\n <div className=\"flex items-center gap-2 border-b border-kit-line px-3 py-2.5\">\n <Sparkle size={16} />\n <span className=\"text-kit-sm font-medium text-kit-fg\">Rewrite {field.title.toLowerCase()}</span>\n </div>\n <div className=\"flex flex-wrap gap-1 px-3 pt-2.5\">\n {AI_PRESETS.map((p) => (\n <button\n key={p.id}\n type=\"button\"\n onClick={() => run(p.id)}\n className={cn(\"h-6 rounded-full border px-2 text-kit-xs transition-colors\", preset === p.id ? \"border-[var(--kit-emphasis-line)] bg-kit-surface text-kit-fg\" : \"border-kit-line text-kit-fg-2 hover:border-kit-line-strong hover:text-kit-fg\")}\n >\n {p.label}\n </button>\n ))}\n </div>\n <div className=\"px-3 py-3\">\n {!preset ? (\n <p className=\"text-kit-xs text-kit-fg-3\">Pick a direction. You'll see the suggestion before anything changes.</p>\n ) : failed ? (\n <p role=\"alert\" className=\"text-kit-xs text-kit-danger-fg\">\n Couldn't rewrite {field.title.toLowerCase()}. Try again.\n </p>\n ) : out == null ? (\n <p className=\"text-kit-sm\">\n <Shimmer>Rewriting {field.title.toLowerCase()}…</Shimmer>\n </p>\n ) : (\n <div className=\"rounded-kit-lg bg-kit-subtle p-2.5 text-kit-sm leading-5 text-kit-fg\">\n <TypeOut text={out} />\n </div>\n )}\n </div>\n <div className=\"flex items-center justify-between gap-2 border-t border-kit-line px-3 py-2\">\n <Button size=\"xs\" variant=\"ghost\" onClick={onClose}>\n Discard\n </Button>\n <div className=\"flex gap-1\">\n {out || failed ? (\n <Button size=\"xs\" variant=\"ghost\" leftIcon={<IconRefresh stroke={1.5} />} onClick={() => preset && run(preset)}>\n Try again\n </Button>\n ) : null}\n <Button size=\"xs\" variant=\"primary\" disabled={!out} onClick={apply}>\n Apply\n </Button>\n </div>\n </div>\n </div>\n );\n}\n\n/* V2 components/motion.tsx Shimmer + TypeOut, kept local to the AI popover (their only kit user). */\nfunction Shimmer({ children }: { children: React.ReactNode }) {\n return (\n <span className=\"bg-[linear-gradient(90deg,var(--kit-fg-3)_0%,var(--kit-fg)_45%,var(--kit-fg-3)_90%)] bg-[length:200%_100%] bg-clip-text text-transparent [animation:kit-shimmer-text_1.6s_linear_infinite] motion-reduce:[animation:none]\">\n {children}\n </span>\n );\n}\n/**\n * Reduced motion as the app reads it: the OS query or the in-app preference (which stamps `data-reduce-motion` on\n * <html>; the kit cannot import the app's hook). Read per render, so a toggle applies to the next answer.\n */\nfunction motionReduced(): boolean {\n if (typeof window === \"undefined\") return false;\n return document.documentElement.hasAttribute(\"data-reduce-motion\") || !!window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;\n}\n\n/** Reduced: the whole answer at once, with no caret (canvas revamp V701, lib/motion TypeOut semantics). */\nfunction TypeOut({ text, speed = 14 }: { text: string; speed?: number }) {\n const reduce = motionReduced();\n const [n, setN] = React.useState(reduce ? text.length : 0);\n React.useEffect(() => {\n if (reduce) {\n setN(text.length);\n return;\n }\n setN(0);\n const id = setInterval(() => {\n setN((x) => {\n const next = Math.min(text.length, x + Math.max(1, Math.round(text.length / 120)));\n if (next >= text.length) clearInterval(id);\n return next;\n });\n }, speed);\n return () => clearInterval(id);\n }, [text, speed, reduce]);\n return (\n <span>\n {text.slice(0, n)}\n {n < text.length ? <span data-typeout-caret className=\"ml-0.5 inline-block h-[1em] w-[2px] translate-y-[2px] bg-kit-fg motion-safe:animate-pulse\" /> : null}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAI,OAA8E;;AAElF,IAAa,4BAA4B;CACvC,OAAO;AACT;AACA,IAAM,OAA+B;CAAE,OAAO;CAAY,MAAM;CAAU,OAAO;CAAW,WAAW;CAAe,MAAM;CAAU,QAAQ;CAAY,OAAO;CAAU,MAAM;CAAU,QAAQ;CAAqB,SAAS;CAAmB,QAAQ;CAAY,OAAO;AAAW;AAC1R,IAAM,UAAU,MAAe,UAAU,CAAwB,IAAI,SAAS,KAAK,MAAM;AAGzF,IAAM,WAAW,MAAc,EAAE,QAAQ,MAAM,OAAO,CAAC,CAAC,QAAQ,MAAM,MAAM,CAAC,CAAC,QAAQ,MAAM,MAAM;;AAElG,IAAM,cAAc,SAClB,KACG,MAAM,KAAK,CAAC,CACZ,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,CACpB,OAAO,OAAO,CAAC,CACf,KAAK,MAAM,MAAM,QAAQ,CAAC,EAAE,KAAK,CAAC,CAClC,KAAK,EAAE;;;;;AAKZ,SAAS,cAAc,OAAsB,OAAoB,MAAiB,MAAc,MAAyD;CACvJ,IAAI;EACF,M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