@particle-academy/react-fancy 5.38.0 → 5.40.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/CHANGELOG.md +76 -0
- package/dist/{index-CazpqSsk.d.ts → Composer.types-CuSPnaOt.d.cts} +1 -4
- package/dist/{index-CazpqSsk.d.cts → Composer.types-CuSPnaOt.d.ts} +1 -4
- package/dist/{chunk-Z4GO6N6N.js → chunk-2JOWGYAJ.js} +322 -408
- package/dist/chunk-2JOWGYAJ.js.map +1 -0
- package/dist/{chunk-TZHK3LEW.cjs → chunk-35TZQIIN.cjs} +17 -8
- package/dist/chunk-35TZQIIN.cjs.map +1 -0
- package/dist/{chunk-RYKPYILS.cjs → chunk-6TZPM43Q.cjs} +325 -408
- package/dist/chunk-6TZPM43Q.cjs.map +1 -0
- package/dist/chunk-BZOU7VJQ.cjs +231 -0
- package/dist/chunk-BZOU7VJQ.cjs.map +1 -0
- package/dist/{chunk-QLL7MWAU.cjs → chunk-FJ2GMQLC.cjs} +116 -26
- package/dist/chunk-FJ2GMQLC.cjs.map +1 -0
- package/dist/{chunk-YCV43A7D.js → chunk-H6WSJL2X.js} +17 -8
- package/dist/chunk-H6WSJL2X.js.map +1 -0
- package/dist/chunk-MXAVGOHW.js +229 -0
- package/dist/chunk-MXAVGOHW.js.map +1 -0
- package/dist/{chunk-WUV3XDJH.js → chunk-YLPVTEUH.js} +117 -27
- package/dist/chunk-YLPVTEUH.js.map +1 -0
- package/dist/command.cjs +4 -3
- package/dist/command.d.cts +12 -1
- package/dist/command.d.ts +12 -1
- package/dist/command.js +2 -1
- package/dist/composer.cjs +4 -3
- package/dist/composer.d.cts +7 -2
- package/dist/composer.d.ts +7 -2
- package/dist/composer.js +2 -1
- package/dist/{index-DXUAAZzE.d.ts → index-BsIBOwaK.d.cts} +46 -1
- package/dist/{index-DXUAAZzE.d.cts → index-S4FC1yFK.d.ts} +46 -1
- package/dist/index.cjs +13 -12
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -3
- package/dist/prompt-input.cjs +4 -2
- package/dist/prompt-input.d.cts +2 -1
- package/dist/prompt-input.d.ts +2 -1
- package/dist/prompt-input.js +3 -1
- package/package.json +1 -1
- package/dist/chunk-QLL7MWAU.cjs.map +0 -1
- package/dist/chunk-RYKPYILS.cjs.map +0 -1
- package/dist/chunk-TZHK3LEW.cjs.map +0 -1
- package/dist/chunk-WUV3XDJH.js.map +0 -1
- package/dist/chunk-YCV43A7D.js.map +0 -1
- package/dist/chunk-Z4GO6N6N.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/platform.ts","../src/components/PromptInput/PromptInput.tsx"],"names":[],"mappings":";;;;;;;;AA2CA,IAAM,0CAA0B,IAAI,GAAA,CAAI,CAAC,OAAA,EAAS,KAAA,EAAO,QAAQ,CAAC,CAAA;AAOlE,IAAM,eAAA,GAAkB,4CAAA;AAGjB,SAAS,eAAe,KAAA,EAA6C;AAC1E,EAAA,IAAI,CAAC,OAAO,OAAO,SAAA;AAEnB,EAAA,MAAM,MAAA,GAAS,MAAM,aAAA,EAAe,QAAA;AACpC,EAAA,IAAI,OAAO,MAAA,KAAW,QAAA,IAAY,MAAA,CAAO,SAAS,CAAA,EAAG;AAInD,IAAA,OAAO,uBAAA,CAAwB,IAAI,MAAA,CAAO,IAAA,GAAO,WAAA,EAAa,IAAI,OAAA,GAAU,SAAA;AAAA,EAC9E;AAEA,EAAA,KAAA,MAAW,SAAS,CAAC,KAAA,CAAM,QAAA,EAAU,KAAA,CAAM,SAAS,CAAA,EAAG;AACrD,IAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,gBAAgB,IAAA,CAAK,KAAK,GAAG,OAAO,OAAA;AAAA,EACvE;AAEA,EAAA,OAAO,SAAA;AACT;AASO,SAAS,iBAAiB,QAAA,EAAuC;AACtE,EAAA,OAAO,QAAA,KAAa,UAAU,QAAA,GAAM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AAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,mJAAA,EAAoJ,QAAA,EAAA,OAAA,EAEnK,CAAA;AAAA,kBAAO,GAAA;AAAA,kBAAI;AAAA;AAAA;AAAA,aAEb;AAAA,4BAEF,GAAA;AAAA,cAAC,MAAA;AAAA,cAAA;AAAA,gBACC,KAAA,EAAM,QAAA;AAAA,gBACN,IAAA,EAAK,IAAA;AAAA,gBACL,YAAA,EAAa,aAAA;AAAA,gBACb,SAAA,EAAU,UAAA;AAAA,gBACV,OAAA,EAAS,MAAA;AAAA,gBACV,QAAA,EAAA;AAAA;AAAA;AAED,WAAA,EACF;AAAA,SAAA,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;AAEA,SAAS,UAAU,CAAA,EAAmB;AACpC,EAAA,IAAI,CAAA,GAAI,GAAA,EAAM,OAAO,CAAA,EAAG,CAAC,CAAA,CAAA;AACzB,EAAA,OAAO,CAAA,EAAA,CAAI,CAAA,GAAI,GAAA,EAAM,OAAA,CAAQ,CAAC,CAAC,CAAA,CAAA,CAAA;AACjC;AAEA,SAAS,QAAQ,CAAA,EAAmB;AAClC,EAAA,IAAI,CAAA,GAAI,IAAA,EAAM,OAAO,CAAA,EAAG,CAAC,CAAA,EAAA,CAAA;AACzB,EAAA,IAAI,CAAA,GAAI,OAAO,IAAA,EAAM,OAAO,IAAI,CAAA,GAAI,IAAA,EAAM,OAAA,CAAQ,CAAC,CAAC,CAAA,GAAA,CAAA;AACpD,EAAA,OAAO,IAAI,CAAA,GAAI,IAAA,GAAO,IAAA,EAAM,OAAA,CAAQ,CAAC,CAAC,CAAA,GAAA,CAAA;AACxC","file":"chunk-WUV3XDJH.js","sourcesContent":["/**\n * Which modifier key the user actually has.\n *\n * This exists because a keyboard hint is a CLAIM about the reader's hardware.\n * `⌘ + Enter to send` on Windows or Linux names a key that is not on the\n * keyboard, and a reader who cannot act on a hint learns to ignore hints — so\n * the cost is not one wrong glyph, it is the credibility of every hint beside\n * it. (Reported from a real Electron app running on Linux, where the glyph had\n * no font behind it either and rendered as tofu.)\n *\n * Two deliberate choices:\n *\n * 1. **The platform is an ARGUMENT, never a global read.** `detectPlatform`\n * takes the hints; `modifierKeyLabel` takes the verdict. Both branches are\n * therefore reachable from one machine, which is the only way a test can\n * cover the platform you are not sitting at. A function that reads\n * `navigator` internally can only ever be tested on the developer's own OS.\n * 2. **`generic` is the fallback, and that is not arbitrary.** Every Fancy\n * surface that submits on a modifier accepts `metaKey || ctrlKey`, so\n * `Ctrl` is a TRUE label on an Apple keyboard while `⌘` is a FALSE one\n * everywhere else. The honest default is the one that is pressable on all\n * of them.\n */\nexport type FancyPlatform = \"apple\" | \"generic\";\n\n/**\n * The parts of `navigator` the detection reads — nothing more, so a caller can\n * hand it a literal (a test, an Electron main process forwarding `process.platform`,\n * a server with a stored preference).\n */\nexport interface PlatformHints {\n /** `navigator.userAgentData` — the modern, non-spoofed answer where it exists. */\n userAgentData?: { platform?: string } | null;\n /** `navigator.platform` — deprecated, still the most reliable legacy signal. */\n platform?: string | null;\n /** `navigator.userAgent` — last resort. */\n userAgent?: string | null;\n}\n\n/**\n * `userAgentData.platform` is a short enumerated token (\"macOS\", \"Windows\",\n * \"Linux\", \"Android\", \"iOS\"), so it is matched exactly rather than by substring.\n */\nconst APPLE_UA_DATA_PLATFORMS = new Set([\"macos\", \"ios\", \"ipados\"]);\n\n/**\n * Legacy `platform` / `userAgent` are free text. iPadOS reports `MacIntel`, and\n * iOS user agents say \"like Mac OS X\" — both are Apple, so a Mac match is\n * correct for them too.\n */\nconst APPLE_FREE_TEXT = /\\b(mac|macintosh|iphone|ipad|ipod|darwin)/i;\n\n/** Resolve a platform from navigator-shaped hints. Unknown or absent ⇒ `generic`. */\nexport function detectPlatform(hints?: PlatformHints | null): FancyPlatform {\n if (!hints) return \"generic\";\n\n const uaData = hints.userAgentData?.platform;\n if (typeof uaData === \"string\" && uaData.length > 0) {\n // When the browser gives an enumerated answer, TRUST IT and stop. Falling\n // through to the free-text test would let a Windows UA string containing\n // the word \"Mac\" (a font name, a device model) overturn it.\n return APPLE_UA_DATA_PLATFORMS.has(uaData.trim().toLowerCase()) ? \"apple\" : \"generic\";\n }\n\n for (const value of [hints.platform, hints.userAgent]) {\n if (typeof value === \"string\" && APPLE_FREE_TEXT.test(value)) return \"apple\";\n }\n\n return \"generic\";\n}\n\n/**\n * The modifier key to NAME for a platform.\n *\n * `⌘` is emitted for `apple` and nothing else. A test enumerates the platform\n * values and counts that no other one can produce it, because a hint that names\n * the wrong key is worse than no hint.\n */\nexport function modifierKeyLabel(platform: FancyPlatform): \"⌘\" | \"Ctrl\" {\n return platform === \"apple\" ? \"⌘\" : \"Ctrl\";\n}\n\n/** SSR-safe read of the live browser hints. `null` off a browser. */\nexport function browserPlatformHints(): PlatformHints | null {\n if (typeof navigator === \"undefined\") return null;\n return navigator as PlatformHints;\n}\n","import {\n useEffect,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { Tooltip } from \"../Tooltip\";\nimport {\n browserPlatformHints,\n detectPlatform,\n modifierKeyLabel,\n type FancyPlatform,\n} from \"../../utils/platform\";\n\n/**\n * PromptInput — the chat composer every AI app rebuilds. Auto-growing\n * multi-line input with:\n *\n * • slash-command picker (`/` triggers a filtered command palette,\n * ↑/↓ navigate, Enter inserts)\n * • mention picker (`@` triggers, filtered against `mentions`)\n * • drop-to-attach (drag files anywhere on the surface), paste-to-attach\n * (a pasted screenshot becomes an attachment) + chip bar\n * • submit on ⌘/Ctrl+Enter (plain Enter inserts a newline)\n * • live token-budget meter (green → amber → red as headroom drops)\n *\n * Wire it up:\n *\n * <PromptInput\n * budgetTokens={32000}\n * commands={[{ name: \"/rewrite\", hint: \"rewrite the selection\" }]}\n * mentions={[{ id: \"ada\", name: \"Ada\", kind: \"person\" }]}\n * onSubmit={(text, attachments) => sendToAgent(text, attachments)}\n * />\n */\nexport type PromptCmd = { name: string; hint: string };\nexport type PromptMention = {\n id: string;\n name: string;\n kind: \"agent\" | \"file\" | \"person\" | string;\n};\nexport type PromptAttachment = {\n id: string;\n name: string;\n bytes: number;\n /**\n * The file the user actually attached.\n *\n * Optional because an attachment restored from a server has no File — but for\n * anything the user dropped or picked it is always present. Without it a host\n * can render a chip and nothing else: no POST, no FormData, no send-to-model.\n */\n file?: File;\n /** MIME type. Hosts branch on this to decide whether a file can be sent as-is. */\n type?: string;\n};\n\n/**\n * `...rest` reaches the root surface, so a consumer or a bridge can tag the\n * composer with its own `data-*` handle. The component named every prop it\n * used and had no rest spread, which means a `data-handle` put on it was\n * DROPPED — silently, since React discards unknown props and the component\n * still renders perfectly. That is issue #22 all over again, and the contract\n * calls it out: \"Each interactive element has a stable identity. Agents never\n * guess DOM.\"\n */\nexport interface PromptInputProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"onSubmit\" | \"className\"> {\n /** Extra classes on the root surface. MERGED, never replaced. */\n className?: string;\n /** Token budget for the meter. */\n budgetTokens: number;\n /** Slash-commands. Names must start with `/`. */\n commands?: PromptCmd[];\n /** @-mentions. */\n mentions?: PromptMention[];\n /** Show the keyboard hint (\"Ctrl + Enter to send\", \"⌘ + Enter\" on a Mac). */\n showHint?: boolean;\n /**\n * Which modifier the hint and the default placeholder NAME. Omit it and the\n * component reads the platform after mount, which is the right answer for an\n * ordinary web app.\n *\n * Pass it when the host knows better than `navigator` does — an Electron\n * renderer forwarding `process.platform`, a remote session where the\n * keyboard is not the one running the browser, or a test that needs the\n * branch it is not sitting on. The pressed keys are unaffected either way:\n * submit is `⌘/Ctrl+Enter` on every platform, so this only decides which\n * true key gets named.\n */\n platform?: FancyPlatform;\n /** Called on ⌘/Ctrl+Enter or send button. */\n onSubmit: (text: string, attachments: PromptAttachment[]) => void;\n /**\n * Placeholder text. Defaults to a hint naming the modifier THIS platform\n * actually has, so leaving it unset is the better option — a hardcoded\n * placeholder is the other place a `⌘` ends up in front of a Windows user.\n */\n placeholder?: string;\n /** Rough estimator: chars-per-token. Defaults to 4. */\n charsPerToken?: number;\n /** Color → CSS chip mapping for mention kinds. */\n mentionColor?: Record<string, string>;\n /** Optional max textarea height in px. Defaults to 280. */\n maxHeight?: number;\n /**\n * Rendered INSIDE the rounded shell, ABOVE the attachments bar and\n * textarea. Use this slot for a drawer of tools/files/prompts/etc. so\n * the drawer and composer share one visual panel. See {@link ChatDrawer}.\n */\n aboveInput?: ReactNode;\n}\n\nconst DEFAULT_MENTION_COLOR: Record<string, string> = {\n agent: \"#a855f7\",\n file: \"#10b981\",\n person: \"#3b82f6\",\n};\n\nexport function PromptInput({\n budgetTokens,\n commands = [],\n mentions = [],\n showHint = true,\n platform,\n onSubmit,\n placeholder,\n charsPerToken = 4,\n mentionColor,\n maxHeight = 280,\n aboveInput,\n className,\n ...rest\n}: PromptInputProps) {\n const [text, setText] = useState(\"\");\n const [attachments, setAttachments] = useState<PromptAttachment[]>([]);\n const [picker, setPicker] = useState<null | {\n kind: \"cmd\" | \"mention\";\n start: number;\n query: string;\n cursor: number;\n }>(null);\n const taRef = useRef<HTMLTextAreaElement>(null);\n const fileRef = useRef<HTMLInputElement>(null);\n const [dragOver, setDragOver] = useState(false);\n\n const colors = mentionColor ?? DEFAULT_MENTION_COLOR;\n\n /**\n * Resolved AFTER mount, never during render.\n *\n * `navigator` read during render disagrees with the server's HTML and\n * hydration patches it — so the fix for a wrong label would have introduced a\n * hydration mismatch instead. The first paint names `Ctrl`, which is\n * pressable on every platform including a Mac, and an Apple client swaps to\n * `⌘` on the next tick. A prop, when given, wins outright and no detection\n * runs at all.\n */\n const [detected, setDetected] = useState<FancyPlatform>(\"generic\");\n useEffect(() => {\n if (platform) return;\n setDetected(detectPlatform(browserPlatformHints()));\n }, [platform]);\n const modKey = modifierKeyLabel(platform ?? detected);\n\n const resolvedPlaceholder =\n placeholder ??\n `Ask anything. Type / for commands, @ for mentions. ${modKey}+Enter to send.`;\n\n const tokens = useMemo(\n () => Math.ceil(text.length / Math.max(1, charsPerToken)),\n [text, charsPerToken],\n );\n const ratio = Math.min(1, tokens / budgetTokens);\n const meterColor = ratio < 0.6 ? \"#10b981\" : ratio < 0.85 ? \"#f59e0b\" : \"#ef4444\";\n\n const filteredCmds = useMemo(\n () =>\n picker?.kind === \"cmd\"\n ? commands.filter((c) =>\n c.name.slice(1).toLowerCase().startsWith(picker.query.toLowerCase()),\n )\n : [],\n [picker, commands],\n );\n const filteredMentions = useMemo(\n () =>\n picker?.kind === \"mention\"\n ? mentions.filter((m) =>\n m.name.toLowerCase().includes(picker.query.toLowerCase()),\n )\n : [],\n [picker, mentions],\n );\n const items: Array<PromptCmd | PromptMention> =\n picker?.kind === \"cmd\"\n ? filteredCmds\n : picker?.kind === \"mention\"\n ? filteredMentions\n : [];\n\n useEffect(() => {\n const ta = taRef.current;\n if (!ta) return;\n ta.style.height = \"auto\";\n ta.style.height = Math.min(maxHeight, ta.scrollHeight) + \"px\";\n }, [text, maxHeight]);\n\n const updateText = (next: string, caret: number) => {\n setText(next);\n let triggerIdx = -1;\n let triggerKind: \"cmd\" | \"mention\" | null = null;\n for (let i = caret - 1; i >= 0; i--) {\n const ch = next[i];\n if (ch === \"@\") {\n triggerKind = \"mention\";\n triggerIdx = i;\n break;\n }\n if (ch === \"/\" && (i === 0 || /\\s/.test(next[i - 1] ?? \"\"))) {\n triggerKind = \"cmd\";\n triggerIdx = i;\n break;\n }\n if (/\\s/.test(ch)) break;\n }\n if (triggerKind !== null && triggerIdx >= 0) {\n const query = next.slice(triggerIdx + 1, caret);\n setPicker({ kind: triggerKind, start: triggerIdx, query, cursor: 0 });\n } else {\n setPicker(null);\n }\n };\n\n const insertChoice = (i: number) => {\n if (!picker || items.length === 0) return;\n const choice = items[i] ?? items[0];\n const insert =\n picker.kind === \"cmd\"\n ? (choice as PromptCmd).name + \" \"\n : `@${(choice as PromptMention).id} `;\n const before = text.slice(0, picker.start);\n const after = text.slice(picker.start + 1 + picker.query.length);\n const next = before + insert + after;\n setText(next);\n setPicker(null);\n requestAnimationFrame(() => {\n const ta = taRef.current;\n if (!ta) return;\n ta.focus();\n const pos = before.length + insert.length;\n ta.setSelectionRange(pos, pos);\n });\n };\n\n const submit = () => {\n if (!text.trim() && attachments.length === 0) return;\n onSubmit(text, attachments);\n setText(\"\");\n setAttachments([]);\n setPicker(null);\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (picker) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setPicker((p) =>\n p ? { ...p, cursor: Math.min(items.length - 1, p.cursor + 1) } : p,\n );\n return;\n }\n if (e.key === \"ArrowUp\") {\n e.preventDefault();\n setPicker((p) => (p ? { ...p, cursor: Math.max(0, p.cursor - 1) } : p));\n return;\n }\n if (e.key === \"Enter\" && !e.metaKey && !e.ctrlKey && items.length > 0) {\n e.preventDefault();\n insertChoice(picker.cursor);\n return;\n }\n if (e.key === \"Escape\") {\n e.preventDefault();\n setPicker(null);\n return;\n }\n }\n if (e.key === \"Enter\" && (e.metaKey || e.ctrlKey)) {\n e.preventDefault();\n submit();\n }\n };\n\n /**\n * Build attachments from a FileList, KEEPING the File.\n *\n * Shared by the drop handler and the picker so the two cannot drift — the\n * picker being a second, subtly different copy of this is exactly how one of\n * them would end up dropping the File again.\n */\n const attach = (list: FileList | File[] | null) => {\n const files = Array.from(list ?? []);\n if (files.length === 0) return;\n\n setAttachments((cur) => [\n ...cur,\n ...files.map((f) => ({\n id: crypto.randomUUID(),\n name: f.name,\n bytes: f.size,\n file: f,\n type: f.type,\n })),\n ]);\n };\n\n const onDrop = (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n setDragOver(false);\n attach(e.dataTransfer.files);\n };\n\n /**\n * Paste a screenshot, get an attachment.\n *\n * There was no paste handler at all, so a pasted image did nothing — no chip,\n * no error — and a host that had swapped its own paste-capable textarea for\n * this component lost the feature without noticing.\n *\n * Files attach only when the clipboard carries NO plain text. Word, Excel and\n * most editors put a picture of the selection beside the text; attaching that\n * would turn every pasted sentence into a screenshot of the sentence. A pure\n * image paste has nothing for the browser to insert, so the default is\n * prevented only then, and a text paste is never touched.\n */\n const onPaste = (e: React.ClipboardEvent<HTMLTextAreaElement>) => {\n const data = e.clipboardData;\n const files = Array.from(data?.files ?? []);\n\n if (files.length === 0 || (data?.getData(\"text/plain\") ?? \"\") !== \"\") return;\n\n e.preventDefault();\n attach(files);\n };\n\n return (\n <div\n // Spread FIRST so an internal handler or data attribute cannot be\n // clobbered from outside, and so a missing one fails loudly here rather\n // than at a consumer's selector. `className` is merged below instead.\n {...rest}\n // The component had no root handle at all, so an agent reading the\n // composer had to guess at classes. The drag state is on it too: a bridge\n // that wants to know whether a drop is in flight should not have to infer\n // it from Tailwind colours.\n data-react-fancy-prompt-input=\"\"\n data-react-fancy-prompt-input-drag={dragOver ? \"over\" : \"idle\"}\n onDragOver={(e) => {\n e.preventDefault();\n setDragOver(true);\n }}\n onDragLeave={() => setDragOver(false)}\n onDrop={onDrop}\n className={cn(\n \"relative rounded-md border bg-white transition dark:bg-zinc-900\",\n dragOver\n ? \"border-violet-400 bg-violet-50/50 dark:border-violet-600 dark:bg-violet-950/30\"\n : \"border-zinc-200 dark:border-zinc-800\",\n className,\n )}\n >\n {aboveInput && (\n <div className=\"border-b border-zinc-200 dark:border-zinc-800\">\n {aboveInput}\n </div>\n )}\n {attachments.length > 0 && (\n <div className=\"flex flex-wrap gap-1.5 border-b border-zinc-200 px-3 py-2 dark:border-zinc-800\">\n {attachments.map((a) => (\n <span\n key={a.id}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-zinc-100 px-2 py-0.5 text-[11px] dark:bg-zinc-800\"\n >\n <Icon name=\"paperclip\" size=\"xs\" className=\"text-zinc-400\" />\n <span className=\"font-mono\">{a.name}</span>\n <span className=\"text-zinc-400\">{fmtSize(a.bytes)}</span>\n <button\n onClick={() =>\n setAttachments((cur) => cur.filter((x) => x.id !== a.id))\n }\n className=\"opacity-50 hover:opacity-100\"\n aria-label=\"Remove attachment\"\n >\n ×\n </button>\n </span>\n ))}\n </div>\n )}\n\n <div className=\"relative\">\n <textarea\n ref={taRef}\n value={text}\n onChange={(e) => updateText(e.target.value, e.target.selectionStart)}\n onKeyDown={onKeyDown}\n onPaste={onPaste}\n placeholder={resolvedPlaceholder}\n spellCheck={false}\n className=\"block w-full resize-none bg-transparent px-3 py-2.5 text-[14px] leading-relaxed outline-none placeholder:text-zinc-400\"\n rows={3}\n />\n\n {picker && items.length > 0 && (\n <div className=\"absolute bottom-full left-2 z-10 mb-1 w-72 overflow-hidden rounded-md border border-zinc-200 bg-white shadow-lg dark:border-zinc-700 dark:bg-zinc-900\">\n <div className=\"border-b border-zinc-100 bg-zinc-50 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-zinc-500 dark:border-zinc-800 dark:bg-zinc-950\">\n {picker.kind === \"cmd\" ? \"Commands\" : \"Mention\"} · {items.length}\n </div>\n <ul className=\"max-h-56 overflow-y-auto\">\n {items.map((item, i) => {\n const active = i === picker.cursor;\n if (picker.kind === \"cmd\") {\n const c = item as PromptCmd;\n return (\n <li\n key={c.name}\n onMouseDown={(e) => {\n e.preventDefault();\n insertChoice(i);\n }}\n onMouseEnter={() =>\n setPicker((p) => (p ? { ...p, cursor: i } : p))\n }\n className={`cursor-pointer px-2 py-1.5 text-[12px] ${\n active\n ? \"bg-violet-100 dark:bg-violet-900/30\"\n : \"hover:bg-zinc-50 dark:hover:bg-zinc-800\"\n }`}\n >\n <div className=\"font-mono font-medium text-violet-700 dark:text-violet-300\">\n {c.name}\n </div>\n <div className=\"text-[11px] text-zinc-500\">{c.hint}</div>\n </li>\n );\n }\n const m = item as PromptMention;\n return (\n <li\n key={m.id}\n onMouseDown={(e) => {\n e.preventDefault();\n insertChoice(i);\n }}\n onMouseEnter={() =>\n setPicker((p) => (p ? { ...p, cursor: i } : p))\n }\n className={`flex cursor-pointer items-center gap-2 px-2 py-1.5 text-[12px] ${\n active\n ? \"bg-violet-100 dark:bg-violet-900/30\"\n : \"hover:bg-zinc-50 dark:hover:bg-zinc-800\"\n }`}\n >\n <span\n className=\"h-2 w-2 rounded-full\"\n style={{ backgroundColor: colors[m.kind] ?? \"#71717a\" }}\n />\n <span className=\"font-medium\">{m.name}</span>\n <span className=\"ml-auto text-[10px] uppercase tracking-wider text-zinc-400\">\n {m.kind}\n </span>\n </li>\n );\n })}\n </ul>\n </div>\n )}\n </div>\n\n <div className=\"flex items-center gap-2 border-t border-zinc-200 bg-zinc-50/60 px-3 py-2 dark:border-zinc-800 dark:bg-zinc-900/40\">\n <Tooltip content=\"Drop files here, or click\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n icon=\"paperclip\"\n className=\"shrink-0\"\n onClick={() => fileRef.current?.click()}\n >\n attach\n </Button>\n </Tooltip>\n {/*\n The button above shipped with a no-op onClick and a tooltip reading\n \"Drop files here, or click\" — an affordance that lied. Drop-only also\n meant keyboard and touch users could not attach at all.\n\n It then shipped with a literal paperclip EMOJI as its icon, which\n needs a COLOUR\n EMOJI FONT — not merely broad coverage — so a lean container renders a\n tofu box where the affordance should be. `icon=\"paperclip\"` draws an\n SVG from the kit's own icon layer, which is the same reason the rest of\n the suite does not hand-roll iconography.\n */}\n <input\n ref={fileRef}\n type=\"file\"\n multiple\n className=\"hidden\"\n onChange={(e) => {\n attach(e.target.files);\n // Let the same file be picked twice in a row.\n e.target.value = \"\";\n }}\n />\n <div className=\"ml-2 flex min-w-0 items-center gap-1.5 overflow-hidden\">\n <div className=\"h-1.5 w-24 shrink overflow-hidden rounded-full bg-zinc-200 dark:bg-zinc-700\">\n <div\n className=\"h-full rounded-full transition-all\"\n style={{ width: `${ratio * 100}%`, backgroundColor: meterColor }}\n />\n </div>\n <span className=\"font-mono text-[11px]\" style={{ color: meterColor }}>\n {fmtTokens(tokens)} / {fmtTokens(budgetTokens)}\n </span>\n </div>\n <div className=\"ml-auto flex shrink-0 items-center gap-2\">\n {showHint && (\n <span\n className=\"hidden text-[10px] text-zinc-500 sm:inline\"\n data-react-fancy-prompt-input-hint={modKey === \"⌘\" ? \"apple\" : \"generic\"}\n >\n <kbd className=\"rounded border border-zinc-300 bg-zinc-50 px-1 py-0.5 font-mono text-[9px] text-zinc-700 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-300\">\n {modKey}\n </kbd>{\" \"}\n +{\" \"}\n <kbd className=\"rounded border border-zinc-300 bg-zinc-50 px-1 py-0.5 font-mono text-[9px] text-zinc-700 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-300\">\n Enter\n </kbd>{\" \"}\n to send\n </span>\n )}\n <Button\n color=\"violet\"\n size=\"sm\"\n iconTrailing=\"arrow-right\"\n className=\"shrink-0\"\n onClick={submit}\n >\n send\n </Button>\n </div>\n </div>\n </div>\n );\n}\n\nfunction fmtTokens(n: number): string {\n if (n < 1000) return `${n}`;\n return `${(n / 1000).toFixed(1)}k`;\n}\n\nfunction fmtSize(b: number): string {\n if (b < 1024) return `${b} B`;\n if (b < 1024 * 1024) return `${(b / 1024).toFixed(0)} KB`;\n return `${(b / 1024 / 1024).toFixed(1)} MB`;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Command/Command.context.ts","../src/components/Command/CommandInput.tsx","../src/components/Command/CommandList.tsx","../src/components/Command/CommandItem.tsx","../src/components/Command/CommandGroup.tsx","../src/components/Command/CommandEmpty.tsx","../src/components/Command/Command.tsx"],"names":["jsx","jsxs"],"mappings":";;;;;;;;;AAGO,IAAM,cAAA,GAAiB,cAA0C,IAAI,CAAA;AAErE,SAAS,UAAA,GAAkC;AAChD,EAAA,MAAM,GAAA,GAAM,WAAW,cAAc,CAAA;AACrC,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AAAA,EACF;AACA,EAAA,OAAO,GAAA;AACT;ACRO,SAAS,YAAA,CAAa;AAAA,EAC3B,WA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C,cAAA,CAAe,QAAA,EAAf,EAAwB,KAAA,EAAO,GAAA,EAC9B,QAAA,kBAAAA,GAAAA,CAAC,MAAA,EAAA,EACC,QAAA,kBAAAC,IAAAA,CAAC,KAAA,EAAA,EAAI,WAAU,8DAAA,EACb,QAAA,EAAA;AAAA,oBAAAD,GAAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAU,+CAAA;AAAA,QACV,OAAA,EAAS,KAAA;AAAA,QACT,aAAA,EAAY;AAAA;AAAA,KACd;AAAA,oBACAA,GAAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA,EAAK,CAAC,IAAA,KAAS;AACb,UAAA,QAAA,CAAS,OAAA,GAAU,IAAA;AACnB,UAAC,QAAuD,OAAA,GACtD,IAAA;AAAA,QACJ,CAAA;AAAA,QACA,0BAAA,EAAyB,EAAA;AAAA,QACzB,SAAA,EAAW,EAAA;AAAA,UACT,uIAAA;AAAA,UACA,SAAA;AAAA,UACA;AAAA,SACF;AAAA,QAEC;AAAA;AAAA;AACH,GAAA,EACF,GACF,CAAA,EACF,CAAA;AAEJ;AAEO,IAAM,OAAA,GAAU,MAAA,CAAO,MAAA,CAAO,WAAA,EAAa;AAAA,EAChD,KAAA,EAAO,YAAA;AAAA,EACP,IAAA,EAAM,WAAA;AAAA,EACN,IAAA,EAAM,WAAA;AAAA,EACN,KAAA,EAAO,YAAA;AAAA,EACP,KAAA,EAAO;AACT,CAAC","file":"chunk-YCV43A7D.js","sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { CommandContextValue } from \"./Command.types\";\n\nexport const CommandContext = createContext<CommandContextValue | null>(null);\n\nexport function useCommand(): CommandContextValue {\n const ctx = useContext(CommandContext);\n if (!ctx) {\n throw new Error(\n \"Command compound components must be used within <Command>\",\n );\n }\n return ctx;\n}\n","import { Search } from \"lucide-react\";\nimport { cn } from \"../../utils/cn\";\nimport { useCommand } from \"./Command.context\";\nimport type { CommandInputProps } from \"./Command.types\";\n\nexport function CommandInput({\n placeholder = \"Type a command or search...\",\n className,\n}: CommandInputProps) {\n const { query, setQuery } = useCommand();\n\n return (\n <div data-react-fancy-command-input=\"\" className=\"flex items-center border-b border-zinc-200 px-4 dark:border-zinc-700\">\n <Search size={16} className=\"shrink-0 text-zinc-400\" />\n <input\n type=\"text\"\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder={placeholder}\n className={cn(\n \"flex-1 bg-transparent px-3 py-3 text-sm outline-none placeholder:text-zinc-400\",\n className,\n )}\n autoFocus\n />\n </div>\n );\n}\n\nCommandInput.displayName = \"CommandInput\";\n","import { cn } from \"../../utils/cn\";\nimport type { CommandListProps } from \"./Command.types\";\n\nexport function CommandList({ children, className }: CommandListProps) {\n return (\n <div\n data-react-fancy-command-list=\"\"\n role=\"listbox\"\n className={cn(\"max-h-72 overflow-y-auto p-2\", className)}\n >\n {children}\n </div>\n );\n}\n\nCommandList.displayName = \"CommandList\";\n","import { cn } from \"../../utils/cn\";\nimport { useCommand } from \"./Command.context\";\nimport type { CommandItemProps } from \"./Command.types\";\n\nexport function CommandItem({\n children,\n value,\n onSelect,\n className,\n}: CommandItemProps) {\n const { query, close } = useCommand();\n\n // Filter by query\n const text = value ?? (typeof children === \"string\" ? children : \"\");\n if (query && !text.toLowerCase().includes(query.toLowerCase())) {\n return null;\n }\n\n return (\n <button\n data-react-fancy-command-item=\"\"\n type=\"button\"\n role=\"option\"\n className={cn(\n \"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm transition-colors\",\n \"text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800\",\n className,\n )}\n onClick={() => {\n onSelect?.();\n close();\n }}\n >\n {children}\n </button>\n );\n}\n\nCommandItem.displayName = \"CommandItem\";\n","import { cn } from \"../../utils/cn\";\nimport type { CommandGroupProps } from \"./Command.types\";\n\nexport function CommandGroup({\n children,\n heading,\n className,\n}: CommandGroupProps) {\n return (\n <div data-react-fancy-command-group=\"\" role=\"group\" className={cn(\"py-1\", className)}>\n {heading && (\n <div className=\"px-3 py-1.5 text-xs font-medium text-zinc-400\">\n {heading}\n </div>\n )}\n {children}\n </div>\n );\n}\n\nCommandGroup.displayName = \"CommandGroup\";\n","import { cn } from \"../../utils/cn\";\nimport type { CommandEmptyProps } from \"./Command.types\";\n\nexport function CommandEmpty({\n children = \"No results found.\",\n className,\n}: CommandEmptyProps) {\n return (\n <div\n data-react-fancy-command-empty=\"\"\n className={cn(\n \"py-6 text-center text-sm text-zinc-500 dark:text-zinc-400\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\nCommandEmpty.displayName = \"CommandEmpty\";\n","import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Portal } from \"../Portal\";\nimport { CommandContext } from \"./Command.context\";\nimport { CommandInput } from \"./CommandInput\";\nimport { CommandList } from \"./CommandList\";\nimport { CommandItem } from \"./CommandItem\";\nimport { CommandGroup } from \"./CommandGroup\";\nimport { CommandEmpty } from \"./CommandEmpty\";\nimport { useFocusTrap } from \"../../hooks/use-focus-trap\";\nimport { useEscapeKey } from \"../../hooks/use-escape-key\";\nimport { useAnimation } from \"../../hooks/use-animation\";\nimport type { CommandProps } from \"./Command.types\";\n\nfunction CommandRoot({ children, open, onClose, className }: CommandProps) {\n const [query, setQuery] = useState(\"\");\n const [activeIndex, setActiveIndex] = useState(-1);\n const panelRef = useRef<HTMLDivElement>(null);\n\n const close = useCallback(() => {\n onClose();\n setQuery(\"\");\n setActiveIndex(-1);\n }, [onClose]);\n\n useEscapeKey(close, open);\n useFocusTrap(panelRef, open);\n\n // Cmd+K global shortcut is handled by the consumer\n useEffect(() => {\n if (open) {\n const original = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n return () => {\n document.body.style.overflow = original;\n };\n }\n }, [open]);\n\n // Keyboard navigation\n useEffect(() => {\n if (!open) return;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n const items = panelRef.current?.querySelectorAll<HTMLElement>(\n '[role=\"option\"]',\n );\n if (!items?.length) return;\n\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n const next = activeIndex < items.length - 1 ? activeIndex + 1 : 0;\n setActiveIndex(next);\n items[next]?.focus();\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n const prev = activeIndex > 0 ? activeIndex - 1 : items.length - 1;\n setActiveIndex(prev);\n items[prev]?.focus();\n }\n };\n\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => document.removeEventListener(\"keydown\", handleKeyDown);\n }, [open, activeIndex]);\n\n const { mounted, className: animClass, ref: animRef } = useAnimation({\n open,\n enterClass: \"fancy-slide-up\",\n exitClass: \"fancy-fade-out\",\n });\n\n const ctx = useMemo(\n () => ({ open, close, query, setQuery, activeIndex, setActiveIndex }),\n [open, close, query, activeIndex],\n );\n\n if (!mounted) return null;\n\n return (\n <CommandContext.Provider value={ctx}>\n <Portal>\n <div className=\"fixed inset-0 z-50 flex items-start justify-center pt-[20vh]\">\n <div\n className=\"absolute inset-0 bg-black/50 backdrop-blur-sm\"\n onClick={close}\n aria-hidden=\"true\"\n />\n <div\n ref={(node) => {\n panelRef.current = node;\n (animRef as React.MutableRefObject<HTMLElement | null>).current =\n node;\n }}\n data-react-fancy-command=\"\"\n className={cn(\n \"relative w-full max-w-lg overflow-hidden rounded-2xl border border-zinc-200 bg-white shadow-2xl dark:border-zinc-700 dark:bg-zinc-900\",\n animClass,\n className,\n )}\n >\n {children}\n </div>\n </div>\n </Portal>\n </CommandContext.Provider>\n );\n}\n\nexport const Command = Object.assign(CommandRoot, {\n Input: CommandInput,\n List: CommandList,\n Item: CommandItem,\n Group: CommandGroup,\n Empty: CommandEmpty,\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/use-paste-pills.ts","../src/components/Composer/paste-markers.ts","../src/components/Composer/InlinePasteEditor.tsx","../src/components/Composer/Composer.tsx"],"names":["InlinePasteEditor","useRef","useC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AAA;AAAA,cAAC,QAAA;AAAA,cAAA;AAAA,gBACC,IAAA,EAAK,QAAA;AAAA,gBACL,OAAA,EAAS,YAAA;AAAA,gBACT,QAAA,EAAU,YAAY,CAAC,UAAA;AAAA,gBACvB,SAAA,EAAU,mLAAA;AAAA,gBACX,QAAA,EAAA;AAAA;AAAA;AAED,WAAA,EACF;AAAA;AAAA;AAAA,KACF;AAAA,EAEJ;AACF;AAEA,QAAA,CAAS,WAAA,GAAc,UAAA","file":"chunk-Z4GO6N6N.js","sourcesContent":["import { useCallback, useRef } from \"react\";\nimport { useControllableState } from \"./use-controllable-state\";\n\n/**\n * A paste held beside a composer rather than inserted into it.\n *\n * There is deliberately **no `length` field.** It would be `text.length` and\n * nothing else, and a derived value stored beside its source is a value that can\n * disagree with it — the two drift the moment anything edits one. Read\n * `paste.text.length`.\n */\nexport interface HeldPaste {\n id: string;\n text: string;\n}\n\n/**\n * The minimum of a clipboard event this hook touches.\n *\n * Structural rather than `React.ClipboardEvent` so a host can call it from a\n * native listener, a synthetic one, or a test double. React's own event satisfies\n * it.\n */\nexport interface PasteEventLike {\n clipboardData?: { getData(type: string): string } | null;\n preventDefault(): void;\n}\n\nexport interface UsePastePillsOptions {\n /**\n * Hold a paste of at least this many characters. Try 500 — about a long\n * paragraph.\n *\n * **No default, on purpose.** Paste is a fundamental interaction, so holding one\n * is something a host asks for rather than something it discovers. Omit this and\n * `handlePaste` always returns `false` and touches nothing.\n */\n threshold?: number;\n /** Own the list yourself. Omit to let the hook keep it. */\n heldPastes?: HeldPaste[];\n onHeldPastesChange?: (pastes: HeldPaste[]) => void;\n}\n\nexport interface UsePastePillsResult {\n heldPastes: HeldPaste[];\n /**\n * Call this from your OWN paste handler. Returns `true` if it took the paste —\n * in which case it has already called `preventDefault()` — and `false` if it\n * declined, having touched nothing.\n *\n * Composable on purpose: a host whose handler already intercepts paste for its\n * own reasons needs to ask \"did you want this?\" rather than hand over the event.\n *\n * function onPaste(e) {\n * if (pills.handlePaste(e)) return;\n * // ...your own handling\n * }\n */\n handlePaste: (event: PasteEventLike) => boolean;\n /**\n * Hold `text` unconditionally and return the new pill's id.\n *\n * For a host that decides for itself what to hold and needs to know WHICH pill\n * it made — `Composer`'s inline placement puts the pill at the caret, so it needs\n * the id at paste time. Ignores `threshold`; the caller has already decided.\n */\n hold: (text: string) => string;\n /**\n * Removes the paste and returns its text, for the host to insert into its own\n * surface. `undefined` if there is no such id.\n *\n * The hook cannot insert it — it owns no DOM and does not know what a host's\n * surface is. That is the point.\n */\n expand: (id: string) => string | undefined;\n /** Discard one without returning it. */\n remove: (id: string) => void;\n /** Empty the list, e.g. after a send. */\n clear: () => void;\n}\n\n/**\n * Hold a large paste as state, so a composer can show it as a pill instead of\n * turning itself into a scrolling wall.\n *\n * ---------------------------------------------------------------------------\n * Why this is a hook and not just a feature of `Composer`\n * ---------------------------------------------------------------------------\n *\n * `Composer` shipped the behaviour in 5.31.0 and the MOIC estate, who specified it,\n * then established something I had missed: their chat input is a contenteditable\n * rendering inline `[deal:42|Acme]` badges, so they **cannot** adopt `Composer` (a\n * plain textarea) however much they want its behaviour. Their plan to delete their\n * own composer when ours landed could never have worked.\n *\n * So the logic lives here and **`Composer` is its first caller.** One\n * implementation rather than two, which matters more than the convenience: two\n * copies of a rule drift, and the copy nobody reads is the one that rots. The rule\n * that must not drift is the one in `Composer`'s own tests — a send with pills\n * still closed carries the text.\n *\n * It owns no DOM. The host renders the pills.\n *\n * ---------------------------------------------------------------------------\n * Who actually calls this (as of 5.32.0): `Composer`, and nothing else\n * ---------------------------------------------------------------------------\n *\n * The estate that specified it **withdrew before adopting it**, hours after it\n * shipped — their design moved the pill INTO the message as a `[paste:id|label]`\n * marker in the same grammar as their other object tags, which makes the message\n * itself the record of what is attached. A parallel `heldPastes` array would then be\n * a second place answering \"what am I sending?\", and the two would disagree the\n * moment someone backspaced a badge. Their reasoning was better than the spec.\n *\n * Recorded because a reader should not infer an extension point under active\n * external use. It is kept rather than withdrawn for two reasons that are about\n * cost, not optimism: it is published API on a 5.x package, so removing it needs a\n * major; and `Composer` calls it, so it is exercised by that component's tests on\n * every run and cannot rot unnoticed.\n *\n * **It gets no further surface without a real caller.** No extra options, no second\n * hook. An API with one hypothetical consumer is how a package accumulates surface\n * nobody uses.\n *\n * `hold` (5.38.0) met that bar: `Composer`'s inline placement — MOIC's\n * pill-inside-the-message design, built into the component — needs the id of the\n * pill it just made so it can put it at the caret.\n */\nexport function usePastePills({\n threshold,\n heldPastes: controlledHeldPastes,\n onHeldPastesChange,\n}: UsePastePillsOptions = {}): UsePastePillsResult {\n const [heldPastes, setHeldPastes] = useControllableState<HeldPaste[]>(\n controlledHeldPastes,\n [],\n onHeldPastesChange,\n );\n\n /*\n * A counter rather than `crypto.randomUUID()` or an index.\n *\n * An index is not an id — removing the first pill renumbers the rest, and a host\n * keying its DOM on that remounts every pill and loses hover state. A counter in\n * a ref is stable for the life of the component and needs no platform API that a\n * server renderer might lack.\n */\n const nextId = useRef(0);\n\n const hold = useCallback(\n (text: string): string => {\n /*\n * Skip any id the list already holds. A controlled list can arrive seeded\n * (restored drafts, an agent attaching a paste) before this counter has\n * counted anything, and minting `paste-1` beside an existing `paste-1` gives\n * two pills one id — expanding either then takes both.\n */\n let id: string;\n do {\n nextId.current += 1;\n id = `paste-${nextId.current}`;\n } while (heldPastes.some((p) => p.id === id));\n\n setHeldPastes((current) => [...current, { id, text }]);\n\n return id;\n },\n [heldPastes, setHeldPastes],\n );\n\n const handlePaste = useCallback(\n (event: PasteEventLike): boolean => {\n if (!threshold || threshold <= 0) return false;\n\n const text = event.clipboardData?.getData(\"text/plain\") ?? \"\";\n\n // Below the threshold, decline WITHOUT touching the event. A host calling\n // this from inside its own handler has to be able to carry on as if the hook\n // were not there.\n if (text.length < threshold) return false;\n\n event.preventDefault();\n hold(text);\n\n return true;\n },\n [threshold, hold],\n );\n\n const expand = useCallback(\n (id: string): string | undefined => {\n const found = heldPastes.find((p) => p.id === id);\n\n if (found === undefined) return undefined;\n\n setHeldPastes((current) => current.filter((p) => p.id !== id));\n\n return found.text;\n },\n [heldPastes, setHeldPastes],\n );\n\n const remove = useCallback(\n (id: string) => setHeldPastes((current) => current.filter((p) => p.id !== id)),\n [setHeldPastes],\n );\n\n const clear = useCallback(() => setHeldPastes([]), [setHeldPastes]);\n\n return { heldPastes, handlePaste, hold, expand, remove, clear };\n}\n","import type { HeldPaste } from \"../../hooks/use-paste-pills\";\n\n/**\n * An image pasted into a `Composer` and held as a pill.\n *\n * `label` is stored rather than derived because the number in it is the order of\n * ARRIVAL: \"Pasted image 2\" must stay 2 after image 1 is deleted, and nothing left\n * in the list could recompute that.\n */\nexport interface HeldImage {\n id: string;\n file: File;\n label: string;\n}\n\n/**\n * U+FFFC OBJECT REPLACEMENT CHARACTER — Unicode's own \"an embedded object sits\n * here\". A marker is the id wrapped in a pair of them.\n *\n * Why the message carries a marker at all: with inline placement the message\n * ITSELF is the record of what is attached and where, so there is one answer to\n * \"what am I sending?\" rather than a text plus a parallel list that can disagree\n * the moment someone backspaces a pill. This is the MOIC estate's design for their\n * own composer, and the reason they withdrew from the beside-the-input layout.\n *\n * Only a marker whose id the composer actually holds is a pill; anything else is\n * left as text, so a stray U+FFFC in pasted content cannot invent an attachment.\n */\nexport const PILL_MARK = \"\\uFFFC\";\n\nconst MARKER = /\\uFFFC([^\\uFFFC\\n]+)\\uFFFC/g;\n\n/** The marker for a held paste or image, for a host or agent writing `value` itself. */\nexport function pasteMarker(id: string): string {\n return `${PILL_MARK}${id}${PILL_MARK}`;\n}\n\nexport type ValueSegment =\n | { type: \"text\"; text: string }\n | { type: \"pill\"; id: string };\n\n/** Split a value into text and pills. Markers for ids not in `known` stay text. */\nexport function segmentValue(value: string, known: ReadonlySet<string>): ValueSegment[] {\n const out: ValueSegment[] = [];\n let last = 0;\n\n for (const match of value.matchAll(MARKER)) {\n const id = match[1];\n if (!known.has(id)) continue;\n\n const start = match.index ?? 0;\n if (start > last) out.push({ type: \"text\", text: value.slice(last, start) });\n out.push({ type: \"pill\", id });\n last = start + match[0].length;\n }\n\n if (last < value.length) out.push({ type: \"text\", text: value.slice(last) });\n\n return out;\n}\n\n/** The id of every marker the value contains, in order, held or not. */\nexport function markedIds(value: string): string[] {\n return Array.from(value.matchAll(MARKER), (m) => m[1]);\n}\n\n/**\n * What actually gets sent: every text pill replaced by its full text, every image\n * pill by `[Pasted image N]` so the reader of the message can see where the image\n * sat. The images themselves go to `onSubmit`'s second argument.\n */\nexport function expandMarkers(\n value: string,\n pastes: readonly HeldPaste[],\n images: readonly HeldImage[],\n): string {\n const text = new Map(pastes.map((p) => [p.id, p.text]));\n const image = new Map(images.map((i) => [i.id, `[${i.label}]`]));\n\n return value.replace(MARKER, (whole, id: string) => text.get(id) ?? image.get(id) ?? whole);\n}\n","import {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n} from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { PILL_MARK, pasteMarker, segmentValue } from \"./paste-markers\";\n\n/** The attribute on the placeholder span a pill is portalled into. */\nexport const HOST_ATTR = \"data-react-fancy-composer-paste-host\";\n\n/** What a paste becomes, as decided by `Composer`. `block` pills get their own line. */\nexport interface PillToInsert {\n id: string;\n block: boolean;\n}\n\nexport interface InlinePasteEditorHandle {\n focus(): void;\n /** Swap a pill for plain text, where it sits. */\n replacePill(id: string, text: string): void;\n}\n\ninterface InlinePasteEditorProps {\n value: string;\n /** Ids the composer holds. A marker for anything else stays text. */\n known: ReadonlySet<string>;\n onChange(value: string): void;\n onSubmit(): void;\n /** Return the pills a paste becomes, or null to insert its text as typed. */\n onPaste(data: DataTransfer | null): PillToInsert[] | null;\n /** Every pill placeholder currently in the editor, for the composer to portal into. */\n onHostsChange(hosts: ReadonlyMap<string, HTMLElement>): void;\n placeholder: string;\n disabled: boolean;\n className?: string;\n}\n\n/**\n * Walk a node's children back into a value string.\n *\n * `<br>` as the LAST child of its parent is filler — browsers put one in an empty\n * line, and this editor puts one after a trailing newline so the caret has a line\n * to sit on — so it counts for nothing. Block elements a browser invents count as\n * a line break before them. Non-breaking spaces become spaces: a browser inserts\n * them for typed spaces it fears would collapse, not because anyone asked.\n */\nfunction serialize(parent: Node, keep: (id: string) => boolean): string {\n let out = \"\";\n const children = Array.from(parent.childNodes);\n\n children.forEach((node, i) => {\n if (node.nodeType === Node.TEXT_NODE) {\n out += (node.textContent ?? \"\").replace(/\\u00A0/g, \" \");\n return;\n }\n if (!(node instanceof HTMLElement)) return;\n\n const id = node.getAttribute(HOST_ATTR);\n if (id !== null) {\n if (keep(id)) out += pasteMarker(id);\n return;\n }\n if (node.tagName === \"BR\") {\n if (i !== children.length - 1) out += \"\\n\";\n return;\n }\n if (/^(DIV|P)$/.test(node.tagName) && out.length > 0 && !out.endsWith(\"\\n\")) {\n out += \"\\n\";\n }\n out += serialize(node, keep);\n });\n\n return out;\n}\n\nfunction makeHost(id: string): HTMLElement {\n const host = document.createElement(\"span\");\n host.setAttribute(\"contenteditable\", \"false\");\n host.setAttribute(HOST_ATTR, id);\n host.className = \"inline-block align-baseline\";\n return host;\n}\n\n/** A value ending in a newline needs a `<br>` after it, or the caret has no line to sit on. */\nfunction ensureTrailingBreak(root: HTMLElement, value: string) {\n const last = root.lastChild;\n const hasBreak = last instanceof HTMLElement && last.tagName === \"BR\";\n\n if (value.endsWith(\"\\n\") && !hasBreak) root.append(document.createElement(\"br\"));\n if (!value.endsWith(\"\\n\") && hasBreak && value.length > 0) last.remove();\n}\n\nfunction placeCaretAfter(node: Node) {\n const selection = window.getSelection();\n if (!selection) return;\n\n const range = document.createRange();\n range.setStartAfter(node);\n range.collapse(true);\n selection.removeAllRanges();\n selection.addRange(range);\n}\n\n/**\n * The plain-text-plus-pills surface behind `Composer`'s inline placement.\n *\n * The DOM is the source of truth WHILE TYPING and `value` is its serialisation;\n * the DOM is rebuilt from `value` only when `value` changes from outside (a send,\n * a host, an agent). Rebuilding on every keystroke would throw the caret away.\n *\n * Every insertion is done here by hand, never by the browser: a paste is always\n * intercepted, so no foreign HTML ever lands in the editor, and Enter is handled\n * so a browser never invents a `<div>` per line.\n */\nexport const InlinePasteEditor = forwardRef<InlinePasteEditorHandle, InlinePasteEditorProps>(\n function InlinePasteEditor(\n { value, known, onChange, onSubmit, onPaste, onHostsChange, placeholder, disabled, className },\n ref,\n ) {\n const rootRef = useRef<HTMLDivElement>(null);\n /** The last value this editor produced or rendered. Anything else came from outside. */\n const lastValue = useRef<string | null>(null);\n /**\n * Ids inserted here whose hold has not reached `known` yet. A pill is held and\n * placed in the same event, and the composer's state lands a render later.\n */\n const pending = useRef(new Set<string>());\n const knownRef = useRef(known);\n knownRef.current = known;\n\n const keep = useCallback(\n (id: string) => knownRef.current.has(id) || pending.current.has(id),\n [],\n );\n\n const reportHosts = useCallback(() => {\n const root = rootRef.current;\n if (!root) return;\n\n const hosts = new Map<string, HTMLElement>();\n root.querySelectorAll<HTMLElement>(`[${HOST_ATTR}]`).forEach((el) => {\n const id = el.getAttribute(HOST_ATTR)!;\n if (keep(id)) hosts.set(id, el);\n });\n onHostsChange(hosts);\n }, [keep, onHostsChange]);\n\n /** Read the DOM back into a value and tell the composer. */\n const emit = useCallback(() => {\n const root = rootRef.current;\n if (!root) return;\n\n const next = serialize(root, keep);\n ensureTrailingBreak(root, next);\n reportHosts();\n\n if (next !== lastValue.current) {\n lastValue.current = next;\n onChange(next);\n }\n }, [keep, onChange, reportHosts]);\n\n /** The caret's range, or the end of the editor if the caret is elsewhere. */\n const caret = useCallback((): Range => {\n const root = rootRef.current!;\n const selection = window.getSelection();\n\n if (selection && selection.rangeCount > 0) {\n const range = selection.getRangeAt(0);\n if (root.contains(range.commonAncestorContainer)) return range;\n }\n\n const range = document.createRange();\n range.selectNodeContents(root);\n range.collapse(false);\n const last = root.lastChild;\n if (last instanceof HTMLElement && last.tagName === \"BR\") {\n range.setStartBefore(last);\n range.collapse(true);\n }\n return range;\n }, []);\n\n /** Replace the selection with `nodes` and leave the caret after them. */\n const insert = useCallback(\n (build: (before: string, after: string) => Node[]) => {\n const root = rootRef.current!;\n const range = caret();\n range.deleteContents();\n\n const head = document.createRange();\n head.selectNodeContents(root);\n head.setEnd(range.startContainer, range.startOffset);\n const tail = document.createRange();\n tail.selectNodeContents(root);\n tail.setStart(range.endContainer, range.endOffset);\n\n const nodes = build(\n serialize(head.cloneContents(), () => true),\n serialize(tail.cloneContents(), () => true),\n );\n if (nodes.length === 0) return;\n\n const fragment = document.createDocumentFragment();\n nodes.forEach((n) => fragment.append(n));\n range.insertNode(fragment);\n placeCaretAfter(nodes[nodes.length - 1]);\n emit();\n },\n [caret, emit],\n );\n\n const insertText = useCallback(\n (text: string) => insert(() => (text ? [document.createTextNode(text)] : [])),\n [insert],\n );\n\n /*\n * Rebuild from `value` when it changed from outside — or when `known` now\n * disagrees with the pills on screen, e.g. a host set a marker and then the\n * paste it names. Never on our own edits: that would discard the caret.\n */\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!root) return;\n\n for (const id of pending.current) if (known.has(id)) pending.current.delete(id);\n\n const wanted = segmentValue(value, known)\n .flatMap((s) => (s.type === \"pill\" ? [s.id] : []))\n .join(PILL_MARK);\n const onScreen = Array.from(root.querySelectorAll(`[${HOST_ATTR}]`))\n .map((el) => el.getAttribute(HOST_ATTR))\n .filter((id): id is string => id !== null && keep(id))\n .join(PILL_MARK);\n\n if (value === lastValue.current && wanted === onScreen) return;\n\n root.replaceChildren();\n for (const segment of segmentValue(value, known)) {\n if (segment.type === \"text\") {\n root.append(document.createTextNode(segment.text));\n } else {\n root.append(makeHost(segment.id));\n }\n }\n ensureTrailingBreak(root, value);\n lastValue.current = value;\n reportHosts();\n }, [value, known, keep, reportHosts]);\n\n useImperativeHandle(\n ref,\n () => ({\n focus() {\n const root = rootRef.current;\n if (!root) return;\n root.focus();\n const range = caret();\n const selection = window.getSelection();\n selection?.removeAllRanges();\n selection?.addRange(range);\n },\n replacePill(id, text) {\n const root = rootRef.current;\n const host = Array.from(\n root?.querySelectorAll(`[${HOST_ATTR}]`) ?? [],\n ).find((el) => el.getAttribute(HOST_ATTR) === id);\n if (!root || !host) return;\n\n const node = document.createTextNode(text);\n host.replaceWith(node);\n root.focus();\n placeCaretAfter(node);\n emit();\n },\n }),\n [caret, emit],\n );\n\n const handlePaste = (e: React.ClipboardEvent<HTMLDivElement>) => {\n // ALWAYS intercepted: a browser left to paste into a contenteditable inserts\n // the clipboard's HTML, styles and all.\n e.preventDefault();\n if (disabled) return;\n\n const pills = onPaste(e.clipboardData);\n\n if (pills === null) {\n insertText((e.clipboardData?.getData(\"text/plain\") ?? \"\").replace(/\\r\\n?/g, \"\\n\"));\n return;\n }\n\n for (const { id } of pills) pending.current.add(id);\n\n insert((before, after) => {\n const nodes: Node[] = [];\n\n for (const { id, block } of pills) {\n if (block) {\n // A text pill gets a line to itself: a newline above unless it is\n // already at the start of one, and below unless one follows.\n const precededByBreak =\n nodes.length === 0\n ? before === \"\" || before.endsWith(\"\\n\")\n : nodes[nodes.length - 1].textContent === \"\\n\";\n if (!precededByBreak) nodes.push(document.createTextNode(\"\\n\"));\n nodes.push(makeHost(id));\n nodes.push(document.createTextNode(\"\\n\"));\n } else {\n nodes.push(makeHost(id));\n }\n }\n\n // The trailing newline of a block pill is redundant if one already follows.\n const last = nodes[nodes.length - 1];\n if (last.textContent === \"\\n\" && after.startsWith(\"\\n\")) nodes.pop();\n\n return nodes;\n });\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key !== \"Enter\" || e.nativeEvent.isComposing) return;\n\n e.preventDefault();\n if (e.shiftKey) {\n insertText(\"\\n\");\n } else {\n onSubmit();\n }\n };\n\n return (\n <div className=\"relative\">\n {value === \"\" && (\n <span\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute left-4 top-3 text-sm text-zinc-400\"\n >\n {placeholder}\n </span>\n )}\n <div\n ref={rootRef}\n data-react-fancy-composer-input=\"\"\n role=\"textbox\"\n aria-multiline=\"true\"\n aria-placeholder={placeholder}\n aria-disabled={disabled || undefined}\n contentEditable={!disabled}\n suppressContentEditableWarning\n onInput={emit}\n onPaste={handlePaste}\n onKeyDown={handleKeyDown}\n className={cn(\n \"max-h-72 min-h-[4.5rem] w-full overflow-y-auto whitespace-pre-wrap break-words bg-transparent px-4 pt-3 text-sm outline-none\",\n className,\n )}\n />\n </div>\n );\n },\n);\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../../utils/cn\";\nimport { useControllableState } from \"../../hooks/use-controllable-state\";\nimport { usePastePills, type HeldPaste } from \"../../hooks/use-paste-pills\";\nimport { Tooltip } from \"../Tooltip\";\nimport {\n InlinePasteEditor,\n type InlinePasteEditorHandle,\n type PillToInsert,\n} from \"./InlinePasteEditor\";\nimport { expandMarkers, markedIds, type HeldImage } from \"./paste-markers\";\nimport type {\n ComposerPasteClassNames,\n ComposerPastePreview,\n ComposerProps,\n} from \"./Composer.types\";\n\n/** Characters of a held paste shown at each end of the hover preview, unless `previewChars` says otherwise. */\nconst PREVIEW_CHARS = 20;\n\n/**\n * Thousands separators, written out rather than left to `toLocaleString()`.\n *\n * The number exists so someone can size the paste at a glance, and `2,036` sizes\n * faster than `2036`. It is not left to the runtime locale because the label beside\n * it (\"Pasted text\") is not localised either, so a locale-formatted number next to\n * an English noun would be half a translation.\n */\nfunction withSeparators(n: number): string {\n return String(n).replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n}\n\n/** First and last N characters, middle elided. The ends say WHICH paste this is. */\nfunction endsOf(text: string, chars: number): string {\n if (text.length <= chars * 2) return text;\n\n return `${text.slice(0, chars)} … ${text.slice(-chars)}`;\n}\n\nconst PILL_BASE =\n \"inline-flex select-none items-center rounded-md px-2 py-0.5 text-xs leading-5 transition-colors\";\nconst TEXT_PILL =\n \"cursor-pointer bg-zinc-100 text-zinc-700 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-200 dark:hover:bg-zinc-700\";\nconst IMAGE_PILL =\n \"bg-rose-100 font-medium text-rose-600 dark:bg-rose-500/20 dark:text-rose-300\";\nconst PREVIEW_BASE = \"max-w-xs whitespace-pre-wrap break-all text-xs\";\n\n/** An image's thumbnail, made from the File only while the preview is open. */\nfunction ImageThumb({ file }: { file: File }) {\n const [url, setUrl] = useState<string | null>(null);\n\n useEffect(() => {\n if (typeof URL.createObjectURL !== \"function\") return;\n const made = URL.createObjectURL(file);\n setUrl(made);\n return () => URL.revokeObjectURL(made);\n }, [file]);\n\n return url ? (\n <img src={url} alt=\"\" className=\"max-h-40 max-w-[16rem] rounded\" />\n ) : (\n <span>{file.name}</span>\n );\n}\n\ninterface InlinePillProps {\n preview: ComposerPastePreview;\n previewChars: number;\n renderPastePreview?: (preview: ComposerPastePreview) => ReactNode;\n classNames?: ComposerPasteClassNames;\n disabled: boolean;\n onExpand: (id: string) => void;\n}\n\n/**\n * One pill inside the message. The hover preview is a portalled `Tooltip`, so the\n * scrolling input cannot clip it.\n */\nfunction InlinePill({\n preview,\n previewChars,\n renderPastePreview,\n classNames,\n disabled,\n onExpand,\n}: InlinePillProps) {\n const id = preview.kind === \"text\" ? preview.paste.id : preview.image.id;\n const content = (\n <span data-react-fancy-composer-paste-pill-preview={id}>\n {renderPastePreview?.(preview) ??\n (preview.kind === \"text\" ? (\n endsOf(preview.paste.text, previewChars)\n ) : (\n <ImageThumb file={preview.image.file} />\n ))}\n </span>\n );\n const tooltipClass = cn(PREVIEW_BASE, classNames?.preview);\n\n if (preview.kind === \"image\") {\n return (\n <Tooltip content={content} className={tooltipClass}>\n <span\n data-react-fancy-composer-image-pill={id}\n role=\"img\"\n aria-label={preview.image.label}\n className={cn(PILL_BASE, IMAGE_PILL, classNames?.pill, classNames?.imagePill)}\n >\n {preview.image.label}\n </span>\n </Tooltip>\n );\n }\n\n const count = withSeparators(preview.paste.text.length);\n\n return (\n <Tooltip content={content} className={tooltipClass}>\n <button\n type=\"button\"\n data-react-fancy-composer-paste-pill={id}\n onClick={() => onExpand(id)}\n disabled={disabled}\n aria-label={`Insert this pasted text, ${count} characters`}\n className={cn(PILL_BASE, TEXT_PILL, classNames?.pill, classNames?.textPill)}\n >\n Pasted text · {count} characters\n </button>\n </Tooltip>\n );\n}\n\nexport const Composer = forwardRef<HTMLDivElement, ComposerProps>(\n function Composer(\n {\n value: controlledValue,\n defaultValue = \"\",\n onChange,\n onSubmit,\n placeholder = \"Type a message...\",\n actions,\n disabled = false,\n className,\n pasteThreshold,\n pastePlacement = \"above\",\n pasteImages = false,\n previewChars = PREVIEW_CHARS,\n renderPastePreview,\n classNames,\n heldPastes: controlledHeldPastes,\n onHeldPastesChange,\n heldImages: controlledHeldImages,\n onHeldImagesChange,\n },\n ref,\n ) {\n const inline = pastePlacement === \"inline\";\n const [value, setValue] = useControllableState(\n controlledValue,\n defaultValue,\n onChange,\n );\n /*\n * The holding logic lives in `usePastePills` and this is its first caller.\n *\n * It moved out in 5.32.0 because the estate that specified the feature cannot\n * use this component at all — their chat input is a contenteditable rendering\n * inline tag badges, which a textarea cannot do. One implementation rather than\n * two: two copies of a rule drift, and the copy nobody reads is the one that\n * rots. The rule that must not drift is the one below — a send with pills still\n * closed carries the text.\n */\n const pills = usePastePills({\n threshold: pasteThreshold,\n heldPastes: controlledHeldPastes,\n onHeldPastesChange,\n });\n const heldPastes = pills.heldPastes;\n const [heldImages, setHeldImages] = useControllableState<HeldImage[]>(\n controlledHeldImages,\n [],\n onHeldImagesChange,\n );\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const editorRef = useRef<InlinePasteEditorHandle>(null);\n const imageCount = useRef(0);\n\n const known = useMemo(\n () => new Set([...heldPastes.map((p) => p.id), ...heldImages.map((i) => i.id)]),\n [heldPastes, heldImages],\n );\n\n const handlePaste = useCallback(\n (e: React.ClipboardEvent<HTMLTextAreaElement>) => {\n // Composable by design, so this reads as a question rather than a handover.\n // Nothing else here wants the paste, so the answer is simply ignored.\n pills.handlePaste(e);\n },\n [pills],\n );\n\n const holdImage = useCallback(\n (file: File): string => {\n let id: string;\n do {\n imageCount.current += 1;\n id = `image-${imageCount.current}`;\n } while (heldImages.some((i) => i.id === id));\n\n const image = { id, file, label: `Pasted image ${imageCount.current}` };\n setHeldImages((current) => [...current, image]);\n\n return id;\n },\n [heldImages, setHeldImages],\n );\n\n /** Inline placement: decide what a paste becomes. `null` means \"just text\". */\n const decidePaste = useCallback(\n (data: DataTransfer | null): PillToInsert[] | null => {\n const text = data?.getData(\"text/plain\") ?? \"\";\n\n // Only a PURE image paste: a clipboard with text as well usually carries a\n // picture OF that text (copying from a document), and holding it would turn\n // every pasted sentence into a screenshot of the sentence.\n if (pasteImages && text === \"\") {\n const files = Array.from(data?.files ?? []).filter((f) =>\n f.type.startsWith(\"image/\"),\n );\n if (files.length > 0) {\n return files.map((file) => ({ id: holdImage(file), block: false }));\n }\n }\n\n if (pasteThreshold && pasteThreshold > 0 && text.length >= pasteThreshold) {\n return [{ id: pills.hold(text), block: true }];\n }\n\n return null;\n },\n [pasteImages, pasteThreshold, holdImage, pills],\n );\n\n /*\n * Inline placement: the message is the record of what is attached. A pill\n * backspaced out of it is no longer attached, so its held entry goes too —\n * otherwise state would say \"attached\" about something the message no longer\n * contains, which is the second-place-to-answer problem markers exist to end.\n */\n const handleInlineChange = useCallback(\n (next: string) => {\n setValue(next);\n\n const present = new Set(markedIds(next));\n for (const paste of heldPastes) if (!present.has(paste.id)) pills.remove(paste.id);\n if (heldImages.some((i) => !present.has(i.id))) {\n setHeldImages((current) => current.filter((i) => present.has(i.id)));\n }\n },\n [setValue, heldPastes, heldImages, pills, setHeldImages],\n );\n\n const [hosts, setHosts] = useState<ReadonlyMap<string, HTMLElement>>(new Map());\n const handleHostsChange = useCallback((next: ReadonlyMap<string, HTMLElement>) => {\n setHosts((prev) => {\n if (prev.size === next.size && [...next].every(([id, el]) => prev.get(id) === el)) {\n return prev;\n }\n return next;\n });\n }, []);\n\n /** Everything the person believes they are sending, in the order they built it. */\n const composeOutgoing = useCallback(() => {\n if (inline) return expandMarkers(value, heldPastes, heldImages);\n\n return [value, ...heldPastes.map((p) => p.text)].filter(Boolean).join(\"\\n\\n\");\n }, [inline, value, heldPastes, heldImages]);\n\n const hasContent = value.trim().length > 0 || (!inline && heldPastes.length > 0);\n\n const focusInput = useCallback(() => {\n if (inline) editorRef.current?.focus();\n else textareaRef.current?.focus();\n }, [inline]);\n\n const handleSubmit = useCallback(() => {\n if (!hasContent || disabled) return;\n\n /*\n * THE DANGEROUS STATE, and the reason this feature needed a spec rather than\n * a guess. A pill reads as \"your paste is attached\" — so a send that drops it\n * means asking a question about a document without the document, and nobody\n * can tell: the sender believes it went, the receiver sees a question about\n * nothing.\n *\n * Above the input, held pastes go out in arrival order after what was typed,\n * because people type the question BEFORE pasting the thing it is about.\n * Inline, every pill goes out exactly where it sits.\n */\n const order = markedIds(value);\n const images = inline\n ? order.flatMap((id) => heldImages.filter((i) => i.id === id))\n : [];\n\n onSubmit?.(composeOutgoing(), { images });\n setValue(\"\");\n pills.clear();\n setHeldImages([]);\n focusInput();\n }, [\n hasContent,\n disabled,\n value,\n inline,\n heldImages,\n onSubmit,\n composeOutgoing,\n setValue,\n pills,\n setHeldImages,\n focusInput,\n ]);\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n handleSubmit();\n }\n };\n\n /** Above the input: click a pill to dump it in, APPENDED to what is already typed. */\n const insertPaste = useCallback(\n (paste: HeldPaste) => {\n // `expand` removes it and hands back the text; inserting is this\n // component's job because the hook owns no DOM.\n const text = pills.expand(paste.id);\n\n if (text === undefined) return;\n\n setValue((current) => (current ? `${current}\\n\\n${text}` : text));\n textareaRef.current?.focus();\n },\n [pills, setValue],\n );\n\n /** Inline: click a text pill and its full text takes the pill's place. */\n const expandInline = useCallback(\n (id: string) => {\n const text = pills.expand(id);\n\n if (text === undefined) return;\n\n editorRef.current?.replacePill(id, text);\n },\n [pills],\n );\n\n return (\n <div\n data-react-fancy-composer=\"\"\n ref={ref}\n className={cn(\n \"rounded-xl border border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-900\",\n disabled && \"opacity-50\",\n className,\n )}\n >\n {!inline && heldPastes.length > 0 && (\n <div\n data-react-fancy-composer-paste-pills=\"\"\n className=\"flex flex-wrap gap-1.5 px-3 pt-3\"\n >\n {heldPastes.map((paste) => (\n // `group` + `group-hover` rather than hover state: the preview is\n // presentation, and a useState for it would be one more thing an\n // agent could desynchronise.\n <span key={paste.id} className=\"group relative inline-flex\">\n <button\n type=\"button\"\n data-react-fancy-composer-paste-pill={paste.id}\n onClick={() => insertPaste(paste)}\n disabled={disabled}\n // No `title`. A native tooltip plus the hover preview below\n // renders TWO tooltips on the same hover, at different delays.\n // The label says what clicking does; the preview says what the\n // text is, and it is linked rather than merely adjacent so a\n // screen reader reaches it too.\n aria-label={`Insert this pasted text, ${withSeparators(paste.text.length)} characters`}\n aria-describedby={`${paste.id}-preview`}\n // `pr-7` leaves room for the absolutely-positioned × that sits\n // over this button's right edge. With a smaller right padding the\n // × lands on top of the label.\n className={cn(\n \"inline-flex items-center gap-1.5 rounded-full border border-zinc-200 bg-zinc-50 py-1 pl-2.5 pr-7 text-xs text-zinc-700 transition-colors hover:bg-zinc-100 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-200 dark:hover:bg-zinc-700\",\n classNames?.pill,\n classNames?.textPill,\n )}\n >\n <span>\n Pasted text · {withSeparators(paste.text.length)} characters\n </span>\n </button>\n\n <button\n type=\"button\"\n data-react-fancy-composer-paste-pill-remove={paste.id}\n onClick={() => pills.remove(paste.id)}\n disabled={disabled}\n aria-label=\"Discard this pasted text\"\n className={cn(\n \"absolute right-1 top-1/2 -translate-y-1/2 rounded-full px-1 text-xs text-zinc-400 transition-colors hover:text-zinc-700 dark:hover:text-zinc-100\",\n classNames?.remove,\n )}\n >\n ×\n </button>\n\n <span\n id={`${paste.id}-preview`}\n data-react-fancy-composer-paste-pill-preview={paste.id}\n role=\"tooltip\"\n className={cn(\n \"pointer-events-none absolute bottom-full left-0 z-10 mb-1 hidden max-w-xs whitespace-pre-wrap break-all rounded-md bg-zinc-900 px-2 py-1 text-xs text-white group-hover:block dark:bg-zinc-100 dark:text-zinc-900\",\n classNames?.preview,\n )}\n >\n {renderPastePreview?.({ kind: \"text\", paste }) ??\n endsOf(paste.text, previewChars)}\n </span>\n </span>\n ))}\n </div>\n )}\n\n {inline ? (\n <>\n <InlinePasteEditor\n ref={editorRef}\n value={value}\n known={known}\n onChange={handleInlineChange}\n onSubmit={handleSubmit}\n onPaste={decidePaste}\n onHostsChange={handleHostsChange}\n placeholder={placeholder}\n disabled={disabled}\n className={classNames?.input}\n />\n {Array.from(hosts, ([id, host]) => {\n const paste = heldPastes.find((p) => p.id === id);\n const image = paste ? undefined : heldImages.find((i) => i.id === id);\n const preview: ComposerPastePreview | null = paste\n ? { kind: \"text\", paste }\n : image\n ? { kind: \"image\", image }\n : null;\n\n return preview\n ? createPortal(\n <InlinePill\n preview={preview}\n previewChars={previewChars}\n renderPastePreview={renderPastePreview}\n classNames={classNames}\n disabled={disabled}\n onExpand={expandInline}\n />,\n host,\n id,\n )\n : null;\n })}\n </>\n ) : (\n <textarea\n ref={textareaRef}\n value={value}\n onChange={(e) => setValue(e.target.value)}\n onKeyDown={handleKeyDown}\n onPaste={handlePaste}\n placeholder={placeholder}\n disabled={disabled}\n rows={3}\n className={cn(\n \"w-full resize-none bg-transparent px-4 pt-3 text-sm outline-none placeholder:text-zinc-400\",\n classNames?.input,\n )}\n />\n )}\n <div className=\"flex items-center justify-between border-t border-zinc-100 px-3 py-2 dark:border-zinc-800\">\n <div className=\"flex items-center gap-1\">{actions}</div>\n <button\n type=\"button\"\n onClick={handleSubmit}\n disabled={disabled || !hasContent}\n className=\"rounded-lg bg-zinc-900 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-zinc-800 disabled:opacity-50 dark:bg-white dark:text-zinc-900 dark:hover:bg-zinc-100\"\n >\n Send\n </button>\n </div>\n </div>\n );\n },\n);\n\nComposer.displayName = \"Composer\";\n"]}
|