@particle-academy/react-fancy 5.61.1 → 5.62.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 +42 -0
- package/dist/autocomplete.cjs +3 -3
- package/dist/autocomplete.js +2 -2
- package/dist/breadcrumbs.cjs +3 -3
- package/dist/breadcrumbs.js +2 -2
- package/dist/{chunk-KNKOSMOQ.cjs → chunk-35S5BTZH.cjs} +4 -4
- package/dist/{chunk-KNKOSMOQ.cjs.map → chunk-35S5BTZH.cjs.map} +1 -1
- package/dist/{chunk-X6TGRSVH.cjs → chunk-4GOOSZEK.cjs} +7 -18
- package/dist/chunk-4GOOSZEK.cjs.map +1 -0
- package/dist/{chunk-3I6PE2US.cjs → chunk-4XHG6Q42.cjs} +11 -11
- package/dist/{chunk-3I6PE2US.cjs.map → chunk-4XHG6Q42.cjs.map} +1 -1
- package/dist/{chunk-3AYRLFNO.js → chunk-A67EDGC7.js} +3 -3
- package/dist/{chunk-3AYRLFNO.js.map → chunk-A67EDGC7.js.map} +1 -1
- package/dist/{chunk-4HUD33OP.cjs → chunk-A6HWKQ4D.cjs} +4 -4
- package/dist/{chunk-4HUD33OP.cjs.map → chunk-A6HWKQ4D.cjs.map} +1 -1
- package/dist/{chunk-P6V4QWJK.cjs → chunk-AJPYGRLA.cjs} +4 -4
- package/dist/{chunk-P6V4QWJK.cjs.map → chunk-AJPYGRLA.cjs.map} +1 -1
- package/dist/{chunk-LMOPAY7Q.js → chunk-ARO2DNGS.js} +3 -3
- package/dist/{chunk-LMOPAY7Q.js.map → chunk-ARO2DNGS.js.map} +1 -1
- package/dist/{chunk-N7KUGFRG.js → chunk-BTNF3QBR.js} +4 -4
- package/dist/{chunk-N7KUGFRG.js.map → chunk-BTNF3QBR.js.map} +1 -1
- package/dist/{chunk-K6NADZ7O.cjs → chunk-CMC2TOEQ.cjs} +6 -6
- package/dist/{chunk-K6NADZ7O.cjs.map → chunk-CMC2TOEQ.cjs.map} +1 -1
- package/dist/{chunk-NDLESFUH.js → chunk-ELFTEJBT.js} +3 -3
- package/dist/{chunk-NDLESFUH.js.map → chunk-ELFTEJBT.js.map} +1 -1
- package/dist/{chunk-PKFEJWVI.js → chunk-EUVWYDFN.js} +3 -3
- package/dist/{chunk-PKFEJWVI.js.map → chunk-EUVWYDFN.js.map} +1 -1
- package/dist/{chunk-BLS2IGPY.js → chunk-EVIHLWPG.js} +4 -4
- package/dist/{chunk-BLS2IGPY.js.map → chunk-EVIHLWPG.js.map} +1 -1
- package/dist/{chunk-ULG4OA2T.js → chunk-FVI4JDLA.js} +3 -3
- package/dist/{chunk-ULG4OA2T.js.map → chunk-FVI4JDLA.js.map} +1 -1
- package/dist/{chunk-IY6LVALS.js → chunk-GEQKNV7E.js} +3 -3
- package/dist/{chunk-IY6LVALS.js.map → chunk-GEQKNV7E.js.map} +1 -1
- package/dist/{chunk-4FJWHVC7.js → chunk-GR2WKBER.js} +4 -2
- package/dist/chunk-GR2WKBER.js.map +1 -0
- package/dist/{chunk-NFTTNFQR.js → chunk-GZ5Z56QK.js} +4 -4
- package/dist/{chunk-NFTTNFQR.js.map → chunk-GZ5Z56QK.js.map} +1 -1
- package/dist/{chunk-Z5OTOYWI.cjs → chunk-HANQYZW2.cjs} +4 -4
- package/dist/{chunk-Z5OTOYWI.cjs.map → chunk-HANQYZW2.cjs.map} +1 -1
- package/dist/{chunk-UBEOB55O.js → chunk-JG2DJK5A.js} +3 -3
- package/dist/{chunk-UBEOB55O.js.map → chunk-JG2DJK5A.js.map} +1 -1
- package/dist/{chunk-J4FKJ4IR.cjs → chunk-LFC2DL6H.cjs} +4 -4
- package/dist/{chunk-J4FKJ4IR.cjs.map → chunk-LFC2DL6H.cjs.map} +1 -1
- package/dist/{chunk-FU6K7XXZ.cjs → chunk-MKGWHSNV.cjs} +4 -4
- package/dist/{chunk-FU6K7XXZ.cjs.map → chunk-MKGWHSNV.cjs.map} +1 -1
- package/dist/{chunk-BHUSI56C.js → chunk-MVVHUTXA.js} +3 -3
- package/dist/{chunk-BHUSI56C.js.map → chunk-MVVHUTXA.js.map} +1 -1
- package/dist/{chunk-UJZJBHMH.js → chunk-NILA2LZY.js} +3 -3
- package/dist/{chunk-UJZJBHMH.js.map → chunk-NILA2LZY.js.map} +1 -1
- package/dist/{chunk-SHF44YGG.js → chunk-NSJBVV7R.js} +3 -3
- package/dist/{chunk-SHF44YGG.js.map → chunk-NSJBVV7R.js.map} +1 -1
- package/dist/{chunk-QXMQVLRQ.cjs → chunk-OASSZI6M.cjs} +4 -2
- package/dist/chunk-OASSZI6M.cjs.map +1 -0
- package/dist/chunk-OUYC6EIL.cjs +66 -0
- package/dist/chunk-OUYC6EIL.cjs.map +1 -0
- package/dist/{chunk-5JFA7NYE.js → chunk-PXZRYL5I.js} +3 -3
- package/dist/{chunk-5JFA7NYE.js.map → chunk-PXZRYL5I.js.map} +1 -1
- package/dist/{chunk-TYTENEJQ.cjs → chunk-QNQNGARW.cjs} +6 -6
- package/dist/{chunk-TYTENEJQ.cjs.map → chunk-QNQNGARW.cjs.map} +1 -1
- package/dist/{chunk-74MEJWMH.js → chunk-QP35Z2WB.js} +3 -3
- package/dist/{chunk-74MEJWMH.js.map → chunk-QP35Z2WB.js.map} +1 -1
- package/dist/{chunk-NORVXHRU.js → chunk-QTS4Q2NK.js} +3 -3
- package/dist/{chunk-NORVXHRU.js.map → chunk-QTS4Q2NK.js.map} +1 -1
- package/dist/{chunk-BMVYOVSW.cjs → chunk-QWNZZPFL.cjs} +8 -8
- package/dist/{chunk-BMVYOVSW.cjs.map → chunk-QWNZZPFL.cjs.map} +1 -1
- package/dist/{chunk-7KTBVKNO.cjs → chunk-R6URPHEP.cjs} +4 -4
- package/dist/{chunk-7KTBVKNO.cjs.map → chunk-R6URPHEP.cjs.map} +1 -1
- package/dist/{chunk-4JLFIPHZ.js → chunk-RP43ZFZP.js} +8 -3
- package/dist/chunk-RP43ZFZP.js.map +1 -0
- package/dist/{chunk-RRMQGTVB.cjs → chunk-SYEHWUM5.cjs} +6 -6
- package/dist/{chunk-RRMQGTVB.cjs.map → chunk-SYEHWUM5.cjs.map} +1 -1
- package/dist/{chunk-IHQHTJNN.js → chunk-SZH7TFME.js} +4 -4
- package/dist/{chunk-IHQHTJNN.js.map → chunk-SZH7TFME.js.map} +1 -1
- package/dist/{chunk-JOWAS5A5.cjs → chunk-TQGRXJ74.cjs} +9 -9
- package/dist/{chunk-JOWAS5A5.cjs.map → chunk-TQGRXJ74.cjs.map} +1 -1
- package/dist/{chunk-6GBO7R25.cjs → chunk-UJRMY54A.cjs} +4 -4
- package/dist/{chunk-6GBO7R25.cjs.map → chunk-UJRMY54A.cjs.map} +1 -1
- package/dist/{chunk-ZPBCZPMD.cjs → chunk-VQJ5LJJH.cjs} +8 -3
- package/dist/chunk-VQJ5LJJH.cjs.map +1 -0
- package/dist/{chunk-MSGKIWYX.js → chunk-VZNBTCGA.js} +3 -3
- package/dist/{chunk-MSGKIWYX.js.map → chunk-VZNBTCGA.js.map} +1 -1
- package/dist/{chunk-M6MGQI6G.cjs → chunk-WKPBCB67.cjs} +4 -4
- package/dist/{chunk-M6MGQI6G.cjs.map → chunk-WKPBCB67.cjs.map} +1 -1
- package/dist/{chunk-645CRPU6.cjs → chunk-WVSHAJKI.cjs} +7 -7
- package/dist/{chunk-645CRPU6.cjs.map → chunk-WVSHAJKI.cjs.map} +1 -1
- package/dist/chunk-YX6FTJ6N.js +62 -0
- package/dist/chunk-YX6FTJ6N.js.map +1 -0
- package/dist/{chunk-HRYM76ZE.cjs → chunk-Z6LYBL5L.cjs} +9 -9
- package/dist/{chunk-HRYM76ZE.cjs.map → chunk-Z6LYBL5L.cjs.map} +1 -1
- package/dist/{chunk-3DMVK74Q.cjs → chunk-Z7SQMQTF.cjs} +4 -4
- package/dist/{chunk-3DMVK74Q.cjs.map → chunk-Z7SQMQTF.cjs.map} +1 -1
- package/dist/{chunk-CHQH6M67.js → chunk-ZQ3VXRUY.js} +7 -18
- package/dist/chunk-ZQ3VXRUY.js.map +1 -0
- package/dist/command.cjs +4 -4
- package/dist/command.js +2 -2
- package/dist/composer.cjs +6 -6
- package/dist/composer.js +4 -4
- package/dist/context-menu.cjs +4 -4
- package/dist/context-menu.js +2 -2
- package/dist/drawer.cjs +4 -4
- package/dist/drawer.js +2 -2
- package/dist/dropdown.cjs +4 -4
- package/dist/dropdown.js +2 -2
- package/dist/editor.cjs +6 -6
- package/dist/editor.d.cts +1 -1
- package/dist/editor.d.ts +1 -1
- package/dist/editor.js +4 -4
- package/dist/full-screen.cjs +10 -9
- package/dist/full-screen.d.cts +5 -2
- package/dist/full-screen.d.ts +5 -2
- package/dist/full-screen.js +4 -3
- package/dist/index.cjs +81 -73
- package/dist/index.d.cts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +22 -22
- package/dist/input.cjs +5 -5
- package/dist/input.js +4 -4
- package/dist/inputs.cjs +7 -7
- package/dist/inputs.js +5 -5
- package/dist/json-editor.cjs +17 -17
- package/dist/json-editor.js +6 -6
- package/dist/mobile-menu.cjs +5 -5
- package/dist/mobile-menu.js +3 -3
- package/dist/modal.cjs +4 -4
- package/dist/modal.js +2 -2
- package/dist/paste-pills.cjs +16 -16
- package/dist/paste-pills.js +3 -3
- package/dist/popover.cjs +4 -4
- package/dist/popover.js +2 -2
- package/dist/prompt-input.cjs +6 -6
- package/dist/prompt-input.js +5 -5
- package/dist/reason-tag.cjs +4 -4
- package/dist/reason-tag.js +3 -3
- package/dist/select.cjs +3 -3
- package/dist/select.js +2 -2
- package/dist/sidebar.cjs +2 -2
- package/dist/sidebar.js +2 -2
- package/dist/tooltip.cjs +3 -2
- package/dist/tooltip.js +2 -1
- package/dist/{use-full-screen-BUJ1ujG4.d.ts → use-full-screen-BUke36LI.d.cts} +27 -1
- package/dist/{use-full-screen-BUJ1ujG4.d.cts → use-full-screen-BUke36LI.d.ts} +27 -1
- package/docs/FullScreen.md +1 -1
- package/docs/hooks.md +9 -3
- package/package.json +1 -1
- package/dist/chunk-4FJWHVC7.js.map +0 -1
- package/dist/chunk-4JLFIPHZ.js.map +0 -1
- package/dist/chunk-CHQH6M67.js.map +0 -1
- package/dist/chunk-JXE5XID6.js +0 -19
- package/dist/chunk-JXE5XID6.js.map +0 -1
- package/dist/chunk-QXMQVLRQ.cjs.map +0 -1
- package/dist/chunk-RXDRYWVD.cjs +0 -21
- package/dist/chunk-RXDRYWVD.cjs.map +0 -1
- package/dist/chunk-X6TGRSVH.cjs.map +0 -1
- package/dist/chunk-ZPBCZPMD.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/platform.ts","../src/components/PromptInput/PromptInput.tsx"],"names":["useState","useRef","useInlinePaste","useEffect","useMemo","jsxs","cn","jsx","Icon","Fragment","InlinePasteEditor","PastedFilesInput","Tooltip","Button"],"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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AN,cAAA;AAAA,cAACM,wBAAA;AAAA,cAAA;AAAA,gBACC,KAAA,EAAM,QAAA;AAAA,gBACN,IAAA,EAAK,IAAA;AAAA,gBACL,YAAA,EAAa,aAAA;AAAA,gBACb,SAAA,EAAU,UAAA;AAAA,gBACV,oCAAA,EAAmC,EAAA;AAAA,gBACnC,OAAA,EAAS,MAAA;AAAA,gBACV,QAAA,EAAA;AAAA;AAAA;AAED,WAAA,EAEJ;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-HRYM76ZE.cjs","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 InlinePasteEditor,\n PastedFilesInput,\n useInlinePaste,\n type ComposerPasteClassNames,\n type ComposerPastePreview,\n type InlinePasteEditorHandle,\n} from \"../PastePills\";\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 * Hold a paste of at least this many characters as a pill IN the message,\n * where it was pasted: on a line of its own, its full text put back in place\n * when clicked, and expanded where it sits when sent. Omit it and paste is\n * unchanged. Setting this (or `pasteImages`) swaps the textarea for an inline\n * editor that keeps the `/` and `@` pickers and the send key.\n */\n pasteThreshold?: number;\n /**\n * A pasted image becomes an inline `Pasted image N` pill AND reaches\n * `onSubmit`'s attachments, with its File, in message order; the text marks\n * where it sat as `[Pasted image N]`. Without it a pasted image is an\n * ordinary attachment chip, as before.\n */\n pasteImages?: boolean;\n /** Characters of a held paste shown at EACH end of its hover preview. Default 20. */\n previewChars?: number;\n /** Replace the paste pills' hover popover content. */\n renderPastePreview?: (preview: ComposerPastePreview) => ReactNode;\n /** Restyle the paste pills, their popover and the inline editor. Merged onto the defaults. */\n pasteClassNames?: ComposerPasteClassNames;\n /**\n * Submit pasted images with an enclosing `<form>`, under this field name: a\n * hidden `<input type=\"file\" multiple>` holds the images still in the message,\n * in message order. Needs `pasteImages`. They reach `onSubmit` either way.\n */\n pasteFilesName?: string;\n /** `\"icon\"`: an icon-only attach button whose tooltip says what it does. Default `\"label\"`. */\n attachButton?: \"label\" | \"icon\";\n /**\n * `\"icon\"`: a compact icon send button whose tooltip carries the shortcut —\n * replacing the inline `Ctrl + Enter to send` hint. Default `\"label\"`.\n */\n sendButton?: \"label\" | \"icon\";\n /**\n * Tokens already used — the caller's REAL value, e.g. an agent's context\n * usage. The meter shows this plus the estimate for the draft. Without it the\n * meter estimates the draft alone, as before.\n */\n usedTokens?: number;\n /**\n * `\"always\"` (default) — as before. `\"near-limit\"` — hidden until usage passes\n * `meterShowAt`, muted until `meterWarnAt`, warning colour past that.\n * `\"hidden\"` — never shown.\n */\n meter?: \"always\" | \"near-limit\" | \"hidden\";\n /** Fraction of `budgetTokens` at which a `\"near-limit\"` meter appears. Default 0.75. */\n meterShowAt?: number;\n /** Fraction of `budgetTokens` past which a `\"near-limit\"` meter takes the warning colour. Default 0.9. */\n meterWarnAt?: number;\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 pasteThreshold,\n pasteImages = false,\n previewChars = 20,\n renderPastePreview,\n pasteClassNames,\n pasteFilesName,\n attachButton = \"label\",\n sendButton = \"label\",\n usedTokens,\n meter = \"always\",\n meterShowAt = 0.75,\n meterWarnAt = 0.9,\n ...rest\n}: PromptInputProps) {\n const [text, setText] = useState(\"\");\n /** Inline pills need an editor that can hold them; a textarea cannot. */\n const inline = pasteThreshold !== undefined || pasteImages;\n const editorRef = useRef<InlinePasteEditorHandle>(null);\n const paste = useInlinePaste({\n pasteThreshold,\n pasteImages,\n previewChars,\n renderPastePreview,\n classNames: pasteClassNames,\n disabled: false,\n editorRef,\n });\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 // Estimated from what will actually be SENT — pills expanded — so a held\n // paste counts for its text, not for the few characters of its marker.\n const draftTokens = useMemo(\n () =>\n Math.ceil((inline ? paste.expand(text) : text).length / Math.max(1, charsPerToken)),\n [text, inline, paste, charsPerToken],\n );\n const tokens = (usedTokens ?? 0) + draftTokens;\n const ratio = Math.min(1, tokens / budgetTokens);\n const meterLevel: \"ok\" | \"caution\" | \"warn\" | \"muted\" | null =\n meter === \"hidden\"\n ? null\n : meter === \"near-limit\"\n ? ratio < meterShowAt\n ? null\n : ratio >= meterWarnAt\n ? \"warn\"\n : \"muted\"\n : ratio < 0.6\n ? \"ok\"\n : ratio < 0.85\n ? \"caution\"\n : \"warn\";\n const meterColor =\n meterLevel === \"ok\"\n ? \"#10b981\"\n : meterLevel === \"caution\"\n ? \"#f59e0b\"\n : meterLevel === \"warn\"\n ? \"#ef4444\"\n : \"#a1a1aa\";\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 if (inline) {\n // The editor rebuilds from the value and puts the caret back itself.\n editorRef.current?.setValue(next, before.length + insert.length);\n return;\n }\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 // A message that is only a paste counts: its marker is in `text`.\n if (!text.trim() && attachments.length === 0) return;\n\n if (inline) {\n // Every pill goes out where it sits; pasted images join the attachments\n // in message order, with their Files, so a host sends them like any other.\n const pastedImages: PromptAttachment[] = paste.imagesIn(text).map((image) => ({\n id: image.id,\n name: image.file.name,\n bytes: image.file.size,\n file: image.file,\n type: image.file.type,\n }));\n onSubmit(paste.expand(text), [...attachments, ...pastedImages]);\n paste.clear();\n } else {\n onSubmit(text, attachments);\n }\n setText(\"\");\n setAttachments([]);\n setPicker(null);\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\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 // Tab completes, as Enter does: the autocomplete key people expect from a\n // shell or Claude Code. Only while a menu is open; otherwise Tab moves\n // focus as usual.\n if (((e.key === \"Enter\" && !e.metaKey && !e.ctrlKey) || (e.key === \"Tab\" && !e.shiftKey)) && 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-[color:var(--fancy-surface,var(--color-white))] transition dark:bg-[color:var(--fancy-surface-dark,var(--color-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-[color:var(--fancy-surface-muted,var(--color-zinc-100))] px-2 py-0.5 text-[11px] dark:bg-[color:var(--fancy-surface-muted-dark,var(--color-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 {inline ? (\n <>\n <InlinePasteEditor\n ref={editorRef}\n value={text}\n known={paste.known}\n onChange={(next, caret) => {\n updateText(next, caret);\n paste.prune(next);\n }}\n onSubmit={submit}\n submitKey=\"mod-enter\"\n onKeyDown={onKeyDown}\n onPaste={paste.decidePaste}\n onHostsChange={paste.onHostsChange}\n placeholder={resolvedPlaceholder}\n disabled={false}\n maxHeight={maxHeight}\n placeholderClassName=\"left-3 top-2.5 text-[14px] leading-relaxed\"\n className={cn(\n \"block min-h-[5.5rem] px-3 py-2.5 text-[14px] leading-relaxed\",\n pasteClassNames?.input,\n )}\n />\n {paste.portals}\n {pasteImages && pasteFilesName && (\n <PastedFilesInput\n name={pasteFilesName}\n files={paste.imagesIn(text).map((i) => i.file)}\n />\n )}\n </>\n ) : (\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\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-[color:var(--fancy-border,var(--color-zinc-200))] bg-[color:var(--fancy-surface,var(--color-white))] shadow-lg dark:border-[color:var(--fancy-border-dark,var(--color-zinc-700))] dark:bg-[color:var(--fancy-surface-dark,var(--color-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={attachButton === \"icon\" ? \"Attach files — or drop them here\" : \"Drop files here, or click\"}>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n icon=\"paperclip\"\n className=\"shrink-0\"\n data-react-fancy-prompt-input-attach=\"\"\n // An icon alone has no name; the tooltip is not one a screen reader reads.\n aria-label={attachButton === \"icon\" ? \"Attach files\" : undefined}\n onClick={() => fileRef.current?.click()}\n >\n {attachButton === \"icon\" ? null : \"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 {meterLevel !== null && (\n <div\n data-react-fancy-prompt-input-meter=\"\"\n data-level={meterLevel}\n className=\"ml-2 flex min-w-0 items-center gap-1.5 overflow-hidden\"\n >\n <div className=\"h-1.5 w-24 shrink overflow-hidden rounded-full bg-[color:var(--fancy-border,var(--color-zinc-200))] dark:bg-[color:var(--fancy-border-dark,var(--color-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 )}\n <div className=\"ml-auto flex shrink-0 items-center gap-2\">\n {/* With an icon send button the shortcut lives in its tooltip instead. */}\n {showHint && sendButton !== \"icon\" && (\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-[color:var(--fancy-border-strong,var(--color-zinc-300))] bg-zinc-50 px-1 py-0.5 font-mono text-[9px] text-[color:var(--fancy-text-soft,var(--color-zinc-700))] dark:border-[color:var(--fancy-border-strong-dark,var(--color-zinc-700))] dark:bg-zinc-800 dark:text-[color:var(--fancy-text-soft-dark,var(--color-zinc-300))]\">\n {modKey}\n </kbd>{\" \"}\n +{\" \"}\n <kbd className=\"rounded border border-[color:var(--fancy-border-strong,var(--color-zinc-300))] bg-zinc-50 px-1 py-0.5 font-mono text-[9px] text-[color:var(--fancy-text-soft,var(--color-zinc-700))] dark:border-[color:var(--fancy-border-strong-dark,var(--color-zinc-700))] dark:bg-zinc-800 dark:text-[color:var(--fancy-text-soft-dark,var(--color-zinc-300))]\">\n Enter\n </kbd>{\" \"}\n to send\n </span>\n )}\n {sendButton === \"icon\" ? (\n <Tooltip content={`Send · ${modKey}+Enter`}>\n <Button\n color=\"violet\"\n size=\"sm\"\n icon=\"arrow-up\"\n className=\"shrink-0\"\n data-react-fancy-prompt-input-send=\"\"\n aria-label=\"Send\"\n onClick={submit}\n />\n </Tooltip>\n ) : (\n <Button\n color=\"violet\"\n size=\"sm\"\n iconTrailing=\"arrow-right\"\n className=\"shrink-0\"\n data-react-fancy-prompt-input-send=\"\"\n onClick={submit}\n >\n send\n </Button>\n )}\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
|
+
{"version":3,"sources":["../src/utils/platform.ts","../src/components/PromptInput/PromptInput.tsx"],"names":["useState","useRef","useInlinePaste","useEffect","useMemo","jsxs","cn","jsx","Icon","Fragment","InlinePasteEditor","PastedFilesInput","Tooltip","Button"],"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;AA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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-Z6LYBL5L.cjs","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 InlinePasteEditor,\n PastedFilesInput,\n useInlinePaste,\n type ComposerPasteClassNames,\n type ComposerPastePreview,\n type InlinePasteEditorHandle,\n} from \"../PastePills\";\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 * Hold a paste of at least this many characters as a pill IN the message,\n * where it was pasted: on a line of its own, its full text put back in place\n * when clicked, and expanded where it sits when sent. Omit it and paste is\n * unchanged. Setting this (or `pasteImages`) swaps the textarea for an inline\n * editor that keeps the `/` and `@` pickers and the send key.\n */\n pasteThreshold?: number;\n /**\n * A pasted image becomes an inline `Pasted image N` pill AND reaches\n * `onSubmit`'s attachments, with its File, in message order; the text marks\n * where it sat as `[Pasted image N]`. Without it a pasted image is an\n * ordinary attachment chip, as before.\n */\n pasteImages?: boolean;\n /** Characters of a held paste shown at EACH end of its hover preview. Default 20. */\n previewChars?: number;\n /** Replace the paste pills' hover popover content. */\n renderPastePreview?: (preview: ComposerPastePreview) => ReactNode;\n /** Restyle the paste pills, their popover and the inline editor. Merged onto the defaults. */\n pasteClassNames?: ComposerPasteClassNames;\n /**\n * Submit pasted images with an enclosing `<form>`, under this field name: a\n * hidden `<input type=\"file\" multiple>` holds the images still in the message,\n * in message order. Needs `pasteImages`. They reach `onSubmit` either way.\n */\n pasteFilesName?: string;\n /** `\"icon\"`: an icon-only attach button whose tooltip says what it does. Default `\"label\"`. */\n attachButton?: \"label\" | \"icon\";\n /**\n * `\"icon\"`: a compact icon send button whose tooltip carries the shortcut —\n * replacing the inline `Ctrl + Enter to send` hint. Default `\"label\"`.\n */\n sendButton?: \"label\" | \"icon\";\n /**\n * Tokens already used — the caller's REAL value, e.g. an agent's context\n * usage. The meter shows this plus the estimate for the draft. Without it the\n * meter estimates the draft alone, as before.\n */\n usedTokens?: number;\n /**\n * `\"always\"` (default) — as before. `\"near-limit\"` — hidden until usage passes\n * `meterShowAt`, muted until `meterWarnAt`, warning colour past that.\n * `\"hidden\"` — never shown.\n */\n meter?: \"always\" | \"near-limit\" | \"hidden\";\n /** Fraction of `budgetTokens` at which a `\"near-limit\"` meter appears. Default 0.75. */\n meterShowAt?: number;\n /** Fraction of `budgetTokens` past which a `\"near-limit\"` meter takes the warning colour. Default 0.9. */\n meterWarnAt?: number;\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 pasteThreshold,\n pasteImages = false,\n previewChars = 20,\n renderPastePreview,\n pasteClassNames,\n pasteFilesName,\n attachButton = \"label\",\n sendButton = \"label\",\n usedTokens,\n meter = \"always\",\n meterShowAt = 0.75,\n meterWarnAt = 0.9,\n ...rest\n}: PromptInputProps) {\n const [text, setText] = useState(\"\");\n /** Inline pills need an editor that can hold them; a textarea cannot. */\n const inline = pasteThreshold !== undefined || pasteImages;\n const editorRef = useRef<InlinePasteEditorHandle>(null);\n const paste = useInlinePaste({\n pasteThreshold,\n pasteImages,\n previewChars,\n renderPastePreview,\n classNames: pasteClassNames,\n disabled: false,\n editorRef,\n });\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 // Estimated from what will actually be SENT — pills expanded — so a held\n // paste counts for its text, not for the few characters of its marker.\n const draftTokens = useMemo(\n () =>\n Math.ceil((inline ? paste.expand(text) : text).length / Math.max(1, charsPerToken)),\n [text, inline, paste, charsPerToken],\n );\n const tokens = (usedTokens ?? 0) + draftTokens;\n const ratio = Math.min(1, tokens / budgetTokens);\n const meterLevel: \"ok\" | \"caution\" | \"warn\" | \"muted\" | null =\n meter === \"hidden\"\n ? null\n : meter === \"near-limit\"\n ? ratio < meterShowAt\n ? null\n : ratio >= meterWarnAt\n ? \"warn\"\n : \"muted\"\n : ratio < 0.6\n ? \"ok\"\n : ratio < 0.85\n ? \"caution\"\n : \"warn\";\n const meterColor =\n meterLevel === \"ok\"\n ? \"#10b981\"\n : meterLevel === \"caution\"\n ? \"#f59e0b\"\n : meterLevel === \"warn\"\n ? \"#ef4444\"\n : \"#a1a1aa\";\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 if (inline) {\n // The editor rebuilds from the value and puts the caret back itself.\n editorRef.current?.setValue(next, before.length + insert.length);\n return;\n }\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 // A message that is only a paste counts: its marker is in `text`.\n if (!text.trim() && attachments.length === 0) return;\n\n if (inline) {\n // Every pill goes out where it sits; pasted images join the attachments\n // in message order, with their Files, so a host sends them like any other.\n const pastedImages: PromptAttachment[] = paste.imagesIn(text).map((image) => ({\n id: image.id,\n name: image.file.name,\n bytes: image.file.size,\n file: image.file,\n type: image.file.type,\n }));\n onSubmit(paste.expand(text), [...attachments, ...pastedImages]);\n paste.clear();\n } else {\n onSubmit(text, attachments);\n }\n setText(\"\");\n setAttachments([]);\n setPicker(null);\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\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 // Tab completes, as Enter does: the autocomplete key people expect from a\n // shell or Claude Code. Only while a menu is open; otherwise Tab moves\n // focus as usual.\n if (((e.key === \"Enter\" && !e.metaKey && !e.ctrlKey) || (e.key === \"Tab\" && !e.shiftKey)) && 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-[color:var(--fancy-surface,var(--color-white))] transition dark:bg-[color:var(--fancy-surface-dark,var(--color-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-[color:var(--fancy-surface-muted,var(--color-zinc-100))] px-2 py-0.5 text-[11px] dark:bg-[color:var(--fancy-surface-muted-dark,var(--color-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 {inline ? (\n <>\n <InlinePasteEditor\n ref={editorRef}\n value={text}\n known={paste.known}\n onChange={(next, caret) => {\n updateText(next, caret);\n paste.prune(next);\n }}\n onSubmit={submit}\n submitKey=\"mod-enter\"\n onKeyDown={onKeyDown}\n onPaste={paste.decidePaste}\n onHostsChange={paste.onHostsChange}\n placeholder={resolvedPlaceholder}\n disabled={false}\n maxHeight={maxHeight}\n placeholderClassName=\"left-3 top-2.5 text-[14px] leading-relaxed\"\n className={cn(\n \"block min-h-[5.5rem] px-3 py-2.5 text-[14px] leading-relaxed\",\n pasteClassNames?.input,\n )}\n />\n {paste.portals}\n {pasteImages && pasteFilesName && (\n <PastedFilesInput\n name={pasteFilesName}\n files={paste.imagesIn(text).map((i) => i.file)}\n />\n )}\n </>\n ) : (\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\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-[color:var(--fancy-border,var(--color-zinc-200))] bg-[color:var(--fancy-surface,var(--color-white))] shadow-lg dark:border-[color:var(--fancy-border-dark,var(--color-zinc-700))] dark:bg-[color:var(--fancy-surface-dark,var(--color-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={attachButton === \"icon\" ? \"Attach files — or drop them here\" : \"Drop files here, or click\"}>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n icon=\"paperclip\"\n className=\"shrink-0\"\n data-react-fancy-prompt-input-attach=\"\"\n // An icon alone has no name; the tooltip is not one a screen reader reads.\n aria-label={attachButton === \"icon\" ? \"Attach files\" : undefined}\n onClick={() => fileRef.current?.click()}\n >\n {attachButton === \"icon\" ? null : \"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 {meterLevel !== null && (\n <div\n data-react-fancy-prompt-input-meter=\"\"\n data-level={meterLevel}\n className=\"ml-2 flex min-w-0 items-center gap-1.5 overflow-hidden\"\n >\n <div className=\"h-1.5 w-24 shrink overflow-hidden rounded-full bg-[color:var(--fancy-border,var(--color-zinc-200))] dark:bg-[color:var(--fancy-border-dark,var(--color-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 )}\n <div className=\"ml-auto flex shrink-0 items-center gap-2\">\n {/* With an icon send button the shortcut lives in its tooltip instead. */}\n {showHint && sendButton !== \"icon\" && (\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-[color:var(--fancy-border-strong,var(--color-zinc-300))] bg-zinc-50 px-1 py-0.5 font-mono text-[9px] text-[color:var(--fancy-text-soft,var(--color-zinc-700))] dark:border-[color:var(--fancy-border-strong-dark,var(--color-zinc-700))] dark:bg-zinc-800 dark:text-[color:var(--fancy-text-soft-dark,var(--color-zinc-300))]\">\n {modKey}\n </kbd>{\" \"}\n +{\" \"}\n <kbd className=\"rounded border border-[color:var(--fancy-border-strong,var(--color-zinc-300))] bg-zinc-50 px-1 py-0.5 font-mono text-[9px] text-[color:var(--fancy-text-soft,var(--color-zinc-700))] dark:border-[color:var(--fancy-border-strong-dark,var(--color-zinc-700))] dark:bg-zinc-800 dark:text-[color:var(--fancy-text-soft-dark,var(--color-zinc-300))]\">\n Enter\n </kbd>{\" \"}\n to send\n </span>\n )}\n {sendButton === \"icon\" ? (\n <Tooltip content={`Send · ${modKey}+Enter`}>\n <Button\n color=\"violet\"\n size=\"sm\"\n icon=\"arrow-up\"\n className=\"shrink-0\"\n data-react-fancy-prompt-input-send=\"\"\n aria-label=\"Send\"\n onClick={submit}\n />\n </Tooltip>\n ) : (\n <Button\n color=\"violet\"\n size=\"sm\"\n iconTrailing=\"arrow-right\"\n className=\"shrink-0\"\n data-react-fancy-prompt-input-send=\"\"\n onClick={submit}\n >\n send\n </Button>\n )}\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"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var chunkFQZE5N2N_cjs = require('./chunk-FQZE5N2N.cjs');
|
|
4
4
|
var chunkTI7D4QDM_cjs = require('./chunk-TI7D4QDM.cjs');
|
|
5
5
|
var chunk57FQGQJK_cjs = require('./chunk-57FQGQJK.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkOUYC6EIL_cjs = require('./chunk-OUYC6EIL.cjs');
|
|
7
7
|
var chunkZU5Q77OT_cjs = require('./chunk-ZU5Q77OT.cjs');
|
|
8
8
|
var react = require('react');
|
|
9
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -174,7 +174,7 @@ function ContextMenuContent({
|
|
|
174
174
|
const [adjusted, setAdjusted] = react.useState(position);
|
|
175
175
|
const close = react.useCallback(() => setOpen(false), [setOpen]);
|
|
176
176
|
chunk57FQGQJK_cjs.useOutsideClick(menuRef, close, open);
|
|
177
|
-
|
|
177
|
+
chunkOUYC6EIL_cjs.useEscapeKey(close, open);
|
|
178
178
|
react.useEffect(() => {
|
|
179
179
|
const node = menuRef.current;
|
|
180
180
|
if (!open || !node) {
|
|
@@ -283,5 +283,5 @@ var ContextMenu = Object.assign(ContextMenuRoot, {
|
|
|
283
283
|
|
|
284
284
|
exports.ContextMenu = ContextMenu;
|
|
285
285
|
exports.useContextMenu = useContextMenu;
|
|
286
|
-
//# sourceMappingURL=chunk-
|
|
287
|
-
//# sourceMappingURL=chunk-
|
|
286
|
+
//# sourceMappingURL=chunk-Z7SQMQTF.cjs.map
|
|
287
|
+
//# sourceMappingURL=chunk-Z7SQMQTF.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ContextMenu/ContextMenu.context.ts","../src/components/ContextMenu/ContextMenuTrigger.tsx","../src/components/ContextMenu/ContextMenuSub.tsx","../src/components/ContextMenu/ContextMenuContent.tsx","../src/components/ContextMenu/ContextMenuItem.tsx","../src/components/ContextMenu/ContextMenuSeparator.tsx","../src/components/ContextMenu/ContextMenu.tsx"],"names":["createContext","useContext","useCallback","jsx","cn","useState","useId","useRef","useEffect","jsxs","useOutsideClick","useEscapeKey","useAnimation","Portal","useMemo"],"mappings":";;;;;;;;;;AAGO,IAAM,kBAAA,GACXA,oBAA8C,IAAI,CAAA;AAE7C,SAAS,cAAA,GAA0C;AACxD,EAAA,MAAM,GAAA,GAAMC,iBAAW,kBAAkB,CAAA;AACzC,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AAAA,EACF;AACA,EAAA,OAAO,GAAA;AACT;ACTO,SAAS,kBAAA,CAAmB;AAAA,EACjC,QAAA;AAAA,EACA;AACF,CAAA,EAA4B;AAC1B,EAAA,MAAM,MAAM,cAAA,EAAe;AAE3B,EAAA,MAAM,iBAAA,GAAoBC,iBAAA;AAAA,IACxB,CAAC,CAAA,KAAkB;AACjB,MAAA,CAAA,CAAE,cAAA,EAAe;AACjB,MAAC,GAAA,CAA+C,QAAA,CAAS,CAAA,GAAI,CAAA,CAAE,OAAA;AAC/D,MAAC,GAAA,CAA+C,QAAA,CAAS,CAAA,GAAI,CAAA,CAAE,OAAA;AAC/D,MAAA,GAAA,CAAI,QAAQ,IAAI,CAAA;AAAA,IAClB,CAAA;AAAA,IACA,CAAC,GAAG;AAAA,GACN;AAEA,EAAA,uBACEC,cAAA,CAAC,KAAA,EAAA,EAAI,uCAAA,EAAsC,EAAA,EAAG,aAAA,EAAe,mBAAmB,SAAA,EAAWC,oBAAA,CAAG,SAAS,CAAA,EACpG,QAAA,EACH,CAAA;AAEJ;AAEA,kBAAA,CAAmB,WAAA,GAAc,oBAAA;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,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAIC,eAAS,KAAK,CAAA;AACtC,EAAA,MAAM,cAAcE,YAAAA,CAAO,EAAE,GAAG,CAAA,EAAG,CAAA,EAAG,GAAG,CAAA;AAEzC,EAAA,MAAM,GAAA,GAAMO,aAAA;AAAA,IACV,OAAO,EAAE,IAAA,EAAM,OAAA,EAAS,QAAA,EAAU,YAAY,OAAA,EAAQ,CAAA;AAAA,IACtD,CAAC,IAAI;AAAA,GACP;AAEA,EAAA,uBACEX,cAAAA,CAAC,kBAAA,CAAmB,UAAnB,EAA4B,KAAA,EAAO,KACjC,QAAA,EACH,CAAA;AAEJ;AAEO,IAAM,WAAA,GAAc,MAAA,CAAO,MAAA,CAAO,eAAA,EAAiB;AAAA,EACxD,OAAA,EAAS,kBAAA;AAAA,EACT,OAAA,EAAS,kBAAA;AAAA,EACT,IAAA,EAAM,eAAA;AAAA,EACN,SAAA,EAAW,oBAAA;AAAA,EACX,GAAA,EAAK,cAAA;AAAA,EACL,UAAA,EAAY,qBAAA;AAAA,EACZ,UAAA,EAAY;AACd,CAAC","file":"chunk-3DMVK74Q.cjs","sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { ContextMenuContextValue } from \"./ContextMenu.types\";\n\nexport const ContextMenuContext =\n createContext<ContextMenuContextValue | null>(null);\n\nexport function useContextMenu(): ContextMenuContextValue {\n const ctx = useContext(ContextMenuContext);\n if (!ctx) {\n throw new Error(\n \"ContextMenu compound components must be used within <ContextMenu>\",\n );\n }\n return ctx;\n}\n","import { useCallback, type MouseEvent } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { useContextMenu } from \"./ContextMenu.context\";\nimport type { ContextMenuTriggerProps } from \"./ContextMenu.types\";\n\nexport function ContextMenuTrigger({\n children,\n className,\n}: ContextMenuTriggerProps) {\n const ctx = useContextMenu();\n\n const handleContextMenu = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n (ctx as { position: { x: number; y: number } }).position.x = e.clientX;\n (ctx as { position: { x: number; y: number } }).position.y = e.clientY;\n ctx.setOpen(true);\n },\n [ctx],\n );\n\n return (\n <div data-react-fancy-context-menu-trigger=\"\" onContextMenu={handleContextMenu} className={cn(className)}>\n {children}\n </div>\n );\n}\n\nContextMenuTrigger.displayName = \"ContextMenuTrigger\";\n","import { createContext, useCallback, useContext, useEffect, useId, useRef, useState } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport type { ContextMenuSubProps, ContextMenuSubTriggerProps, ContextMenuSubContentProps } from \"./ContextMenu.types\";\n\n// ---------------------------------------------------------------------------\n// Sibling coordination: parent tracks which sub is active so opening one\n// immediately closes any previously-open sibling.\n// ---------------------------------------------------------------------------\n\ninterface MenuGroupContextValue {\n activeSubId: string | null;\n setActiveSub: (id: string | null) => void;\n}\n\nconst MenuGroupContext = createContext<MenuGroupContextValue>({\n activeSubId: null,\n setActiveSub: () => {},\n});\n\n/** Wrap sibling Subs so only one is open at a time. Placed inside Content/SubContent. */\nexport function MenuGroupProvider({ children }: { children: React.ReactNode }) {\n const [activeSubId, setActiveSub] = useState<string | null>(null);\n return (\n <MenuGroupContext.Provider value={{ activeSubId, setActiveSub }}>\n {children}\n </MenuGroupContext.Provider>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Sub components\n// ---------------------------------------------------------------------------\n\ninterface SubContextValue {\n open: boolean;\n setOpen: (open: boolean) => void;\n cancelClose: () => void;\n}\n\nconst ContextMenuSubContext = createContext<SubContextValue>({\n open: false,\n setOpen: () => {},\n cancelClose: () => {},\n});\n\nexport function ContextMenuSub({ children }: ContextMenuSubProps) {\n const id = useId();\n const { activeSubId, setActiveSub } = useContext(MenuGroupContext);\n const open = activeSubId === id;\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const activeRef = useRef(activeSubId);\n activeRef.current = activeSubId;\n\n const setOpen = useCallback((v: boolean) => {\n if (closeTimer.current) { clearTimeout(closeTimer.current); closeTimer.current = null; }\n setActiveSub(v ? id : null);\n }, [id, setActiveSub]);\n\n const scheduleClose = useCallback(() => {\n if (closeTimer.current) clearTimeout(closeTimer.current);\n closeTimer.current = setTimeout(() => {\n if (activeRef.current === id) setActiveSub(null);\n }, 150);\n }, [id, setActiveSub]);\n\n const cancelClose = useCallback(() => {\n if (closeTimer.current) { clearTimeout(closeTimer.current); closeTimer.current = null; }\n }, []);\n\n useEffect(() => () => {\n if (closeTimer.current) clearTimeout(closeTimer.current);\n }, []);\n\n return (\n <div\n className=\"relative\"\n onMouseEnter={cancelClose}\n onMouseLeave={scheduleClose}\n data-react-fancy-context-menu-sub=\"\"\n >\n <ContextMenuSubContext.Provider value={{ open, setOpen, cancelClose }}>\n {children}\n </ContextMenuSubContext.Provider>\n </div>\n );\n}\n\nContextMenuSub.displayName = \"ContextMenuSub\";\n\nexport function ContextMenuSubTrigger({ children, className }: ContextMenuSubTriggerProps) {\n const { open, setOpen, cancelClose } = useContext(ContextMenuSubContext);\n\n return (\n <button\n type=\"button\"\n data-react-fancy-context-menu-sub-trigger=\"\"\n role=\"menuitem\"\n aria-haspopup=\"menu\"\n aria-expanded={open}\n className={cn(\n \"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-sm transition-colors\",\n \"text-[color:var(--fancy-text-soft,var(--color-zinc-700))] hover:bg-[color:var(--fancy-surface-muted,var(--color-zinc-100))] dark:text-[color:var(--fancy-text-soft-dark,var(--color-zinc-300))] dark:hover:bg-[color:var(--fancy-surface-muted-dark,var(--color-zinc-800))]\",\n open && \"bg-[color:var(--fancy-surface-muted,var(--color-zinc-100))] dark:bg-[color:var(--fancy-surface-muted-dark,var(--color-zinc-800))]\",\n className,\n )}\n onMouseEnter={() => {\n cancelClose();\n setOpen(true);\n }}\n onClick={() => setOpen(!open)}\n >\n <span>{children}</span>\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" className=\"ml-2 opacity-50\">\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n </button>\n );\n}\n\nContextMenuSubTrigger.displayName = \"ContextMenuSubTrigger\";\n\nexport function ContextMenuSubContent({ children, className }: ContextMenuSubContentProps) {\n const { open } = useContext(ContextMenuSubContext);\n const ref = useRef<HTMLDivElement>(null);\n const [flipLeft, setFlipLeft] = useState(false);\n const [topOffset, setTopOffset] = useState(0);\n const [maxH, setMaxH] = useState<number | undefined>(undefined);\n\n useEffect(() => {\n if (!open || !ref.current) return;\n const pad = 8;\n const rect = ref.current.getBoundingClientRect();\n\n // Horizontal: flip left if overflowing right\n setFlipLeft(rect.right > window.innerWidth - pad);\n\n // Vertical: shift up if overflowing bottom, cap height if still too tall\n const overflow = rect.bottom - (window.innerHeight - pad);\n if (overflow > 0) {\n const shifted = Math.min(overflow, rect.top - pad);\n setTopOffset(-shifted);\n if (overflow > shifted) {\n setMaxH(window.innerHeight - pad * 2);\n } else {\n setMaxH(undefined);\n }\n } else {\n setTopOffset(0);\n setMaxH(undefined);\n }\n }, [open]);\n\n if (!open) return null;\n\n return (\n <div\n ref={ref}\n data-react-fancy-context-menu-sub-content=\"\"\n role=\"menu\"\n className={cn(\n \"absolute z-50 min-w-[8rem] rounded-xl border border-[color:var(--fancy-border,var(--color-zinc-200))] bg-[color:var(--fancy-surface,var(--color-white))] p-1 shadow-lg dark:border-[color:var(--fancy-border-dark,var(--color-zinc-700))] dark:bg-[color:var(--fancy-surface-dark,var(--color-zinc-900))]\",\n flipLeft ? \"right-full mr-1\" : \"left-full ml-1\",\n maxH && \"overflow-y-auto\",\n className,\n )}\n style={{ top: topOffset, maxHeight: maxH }}\n >\n <MenuGroupProvider>\n {children}\n </MenuGroupProvider>\n </div>\n );\n}\n\nContextMenuSubContent.displayName = \"ContextMenuSubContent\";\n","import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Portal } from \"../Portal\";\nimport { useContextMenu } from \"./ContextMenu.context\";\nimport { useOutsideClick } from \"../../hooks/use-outside-click\";\nimport { useEscapeKey } from \"../../hooks/use-escape-key\";\nimport { useAnimation } from \"../../hooks/use-animation\";\nimport { MenuGroupProvider } from \"./ContextMenuSub\";\nimport type { ContextMenuContentProps } from \"./ContextMenu.types\";\n\nexport function ContextMenuContent({\n children,\n className,\n}: ContextMenuContentProps) {\n const { open, setOpen, position } = useContextMenu();\n const menuRef = useRef<HTMLDivElement>(null);\n const [adjusted, setAdjusted] = useState<{ x: number; y: number }>(position);\n\n const close = useCallback(() => setOpen(false), [setOpen]);\n useOutsideClick(menuRef, close, open);\n useEscapeKey(close, open);\n\n // Clamp position to viewport after mount\n useEffect(() => {\n const node = menuRef.current;\n if (!open || !node) {\n setAdjusted(position);\n return;\n }\n requestAnimationFrame(() => {\n const rect = node.getBoundingClientRect();\n const pad = 8;\n let x = position.x;\n let y = position.y;\n if (x + rect.width > window.innerWidth - pad) x = window.innerWidth - rect.width - pad;\n if (y + rect.height > window.innerHeight - pad) y = window.innerHeight - rect.height - pad;\n if (x < pad) x = pad;\n if (y < pad) y = pad;\n setAdjusted({ x, y });\n });\n }, [open, position]);\n\n const { mounted, className: animClass, ref: animRef } = useAnimation({\n open,\n enterClass: \"fancy-scale-in\",\n exitClass: \"fancy-fade-out\",\n });\n\n if (!mounted) return null;\n\n return (\n <Portal>\n <div\n ref={(node) => {\n menuRef.current = node;\n (animRef as React.MutableRefObject<HTMLElement | null>).current = node;\n }}\n data-react-fancy-context-menu=\"\"\n role=\"menu\"\n className={cn(\n \"fixed z-50 min-w-[8rem] rounded-xl border border-[color:var(--fancy-border,var(--color-zinc-200))] bg-[color:var(--fancy-surface,var(--color-white))] p-1 shadow-lg dark:border-[color:var(--fancy-border-dark,var(--color-zinc-700))] dark:bg-[color:var(--fancy-surface-dark,var(--color-zinc-900))]\",\n animClass,\n className,\n )}\n style={{ left: adjusted.x, top: adjusted.y }}\n >\n <MenuGroupProvider>\n {children}\n </MenuGroupProvider>\n </div>\n </Portal>\n );\n}\n\nContextMenuContent.displayName = \"ContextMenuContent\";\n","import { cn } from \"../../utils/cn\";\nimport { useContextMenu } from \"./ContextMenu.context\";\nimport type { ContextMenuItemProps } from \"./ContextMenu.types\";\n\nexport function ContextMenuItem({\n children,\n onClick,\n disabled = false,\n danger = false,\n className,\n}: ContextMenuItemProps) {\n const { setOpen } = useContextMenu();\n\n return (\n <button\n type=\"button\"\n data-react-fancy-context-menu-item=\"\"\n role=\"menuitem\"\n disabled={disabled}\n aria-disabled={disabled}\n className={cn(\n \"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm transition-colors\",\n danger\n ? \"text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950\"\n : \"text-[color:var(--fancy-text-soft,var(--color-zinc-700))] hover:bg-[color:var(--fancy-surface-muted,var(--color-zinc-100))] dark:text-[color:var(--fancy-text-soft-dark,var(--color-zinc-300))] dark:hover:bg-[color:var(--fancy-surface-muted-dark,var(--color-zinc-800))]\",\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n onClick={() => {\n if (disabled) return;\n onClick?.();\n setOpen(false);\n }}\n >\n {children}\n </button>\n );\n}\n\nContextMenuItem.displayName = \"ContextMenuItem\";\n","import { cn } from \"../../utils/cn\";\nimport type { ContextMenuSeparatorProps } from \"./ContextMenu.types\";\n\nexport function ContextMenuSeparator({ className }: ContextMenuSeparatorProps) {\n return (\n <div\n data-react-fancy-context-menu-separator=\"\"\n role=\"separator\"\n className={cn(\"my-1 h-px bg-[color:var(--fancy-border,var(--color-zinc-200))] dark:bg-[color:var(--fancy-border-dark,var(--color-zinc-700))]\", className)}\n />\n );\n}\n\nContextMenuSeparator.displayName = \"ContextMenuSeparator\";\n","import { useMemo, useRef, useState } from \"react\";\nimport { ContextMenuContext } from \"./ContextMenu.context\";\nimport { ContextMenuTrigger } from \"./ContextMenuTrigger\";\nimport { ContextMenuContent } from \"./ContextMenuContent\";\nimport { ContextMenuItem } from \"./ContextMenuItem\";\nimport { ContextMenuSeparator } from \"./ContextMenuSeparator\";\nimport { ContextMenuSub, ContextMenuSubTrigger, ContextMenuSubContent } from \"./ContextMenuSub\";\nimport type { ContextMenuProps } from \"./ContextMenu.types\";\n\nfunction ContextMenuRoot({ children }: ContextMenuProps) {\n const [open, setOpen] = useState(false);\n const positionRef = useRef({ x: 0, y: 0 });\n\n const ctx = useMemo(\n () => ({ open, setOpen, position: positionRef.current }),\n [open],\n );\n\n return (\n <ContextMenuContext.Provider value={ctx}>\n {children}\n </ContextMenuContext.Provider>\n );\n}\n\nexport const ContextMenu = Object.assign(ContextMenuRoot, {\n Trigger: ContextMenuTrigger,\n Content: ContextMenuContent,\n Item: ContextMenuItem,\n Separator: ContextMenuSeparator,\n Sub: ContextMenuSub,\n SubTrigger: ContextMenuSubTrigger,\n SubContent: ContextMenuSubContent,\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/ContextMenu/ContextMenu.context.ts","../src/components/ContextMenu/ContextMenuTrigger.tsx","../src/components/ContextMenu/ContextMenuSub.tsx","../src/components/ContextMenu/ContextMenuContent.tsx","../src/components/ContextMenu/ContextMenuItem.tsx","../src/components/ContextMenu/ContextMenuSeparator.tsx","../src/components/ContextMenu/ContextMenu.tsx"],"names":["createContext","useContext","useCallback","jsx","cn","useState","useId","useRef","useEffect","jsxs","useOutsideClick","useEscapeKey","useAnimation","Portal","useMemo"],"mappings":";;;;;;;;;;AAGO,IAAM,kBAAA,GACXA,oBAA8C,IAAI,CAAA;AAE7C,SAAS,cAAA,GAA0C;AACxD,EAAA,MAAM,GAAA,GAAMC,iBAAW,kBAAkB,CAAA;AACzC,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AAAA,EACF;AACA,EAAA,OAAO,GAAA;AACT;ACTO,SAAS,kBAAA,CAAmB;AAAA,EACjC,QAAA;AAAA,EACA;AACF,CAAA,EAA4B;AAC1B,EAAA,MAAM,MAAM,cAAA,EAAe;AAE3B,EAAA,MA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QTF.cjs","sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { ContextMenuContextValue } from \"./ContextMenu.types\";\n\nexport const ContextMenuContext =\n createContext<ContextMenuContextValue | null>(null);\n\nexport function useContextMenu(): ContextMenuContextValue {\n const ctx = useContext(ContextMenuContext);\n if (!ctx) {\n throw new Error(\n \"ContextMenu compound components must be used within <ContextMenu>\",\n );\n }\n return ctx;\n}\n","import { useCallback, type MouseEvent } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { useContextMenu } from \"./ContextMenu.context\";\nimport type { ContextMenuTriggerProps } from \"./ContextMenu.types\";\n\nexport function ContextMenuTrigger({\n children,\n className,\n}: ContextMenuTriggerProps) {\n const ctx = useContextMenu();\n\n const handleContextMenu = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n (ctx as { position: { x: number; y: number } }).position.x = e.clientX;\n (ctx as { position: { x: number; y: number } }).position.y = e.clientY;\n ctx.setOpen(true);\n },\n [ctx],\n );\n\n return (\n <div data-react-fancy-context-menu-trigger=\"\" onContextMenu={handleContextMenu} className={cn(className)}>\n {children}\n </div>\n );\n}\n\nContextMenuTrigger.displayName = \"ContextMenuTrigger\";\n","import { createContext, useCallback, useContext, useEffect, useId, useRef, useState } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport type { ContextMenuSubProps, ContextMenuSubTriggerProps, ContextMenuSubContentProps } from \"./ContextMenu.types\";\n\n// ---------------------------------------------------------------------------\n// Sibling coordination: parent tracks which sub is active so opening one\n// immediately closes any previously-open sibling.\n// ---------------------------------------------------------------------------\n\ninterface MenuGroupContextValue {\n activeSubId: string | null;\n setActiveSub: (id: string | null) => void;\n}\n\nconst MenuGroupContext = createContext<MenuGroupContextValue>({\n activeSubId: null,\n setActiveSub: () => {},\n});\n\n/** Wrap sibling Subs so only one is open at a time. Placed inside Content/SubContent. */\nexport function MenuGroupProvider({ children }: { children: React.ReactNode }) {\n const [activeSubId, setActiveSub] = useState<string | null>(null);\n return (\n <MenuGroupContext.Provider value={{ activeSubId, setActiveSub }}>\n {children}\n </MenuGroupContext.Provider>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Sub components\n// ---------------------------------------------------------------------------\n\ninterface SubContextValue {\n open: boolean;\n setOpen: (open: boolean) => void;\n cancelClose: () => void;\n}\n\nconst ContextMenuSubContext = createContext<SubContextValue>({\n open: false,\n setOpen: () => {},\n cancelClose: () => {},\n});\n\nexport function ContextMenuSub({ children }: ContextMenuSubProps) {\n const id = useId();\n const { activeSubId, setActiveSub } = useContext(MenuGroupContext);\n const open = activeSubId === id;\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const activeRef = useRef(activeSubId);\n activeRef.current = activeSubId;\n\n const setOpen = useCallback((v: boolean) => {\n if (closeTimer.current) { clearTimeout(closeTimer.current); closeTimer.current = null; }\n setActiveSub(v ? id : null);\n }, [id, setActiveSub]);\n\n const scheduleClose = useCallback(() => {\n if (closeTimer.current) clearTimeout(closeTimer.current);\n closeTimer.current = setTimeout(() => {\n if (activeRef.current === id) setActiveSub(null);\n }, 150);\n }, [id, setActiveSub]);\n\n const cancelClose = useCallback(() => {\n if (closeTimer.current) { clearTimeout(closeTimer.current); closeTimer.current = null; }\n }, []);\n\n useEffect(() => () => {\n if (closeTimer.current) clearTimeout(closeTimer.current);\n }, []);\n\n return (\n <div\n className=\"relative\"\n onMouseEnter={cancelClose}\n onMouseLeave={scheduleClose}\n data-react-fancy-context-menu-sub=\"\"\n >\n <ContextMenuSubContext.Provider value={{ open, setOpen, cancelClose }}>\n {children}\n </ContextMenuSubContext.Provider>\n </div>\n );\n}\n\nContextMenuSub.displayName = \"ContextMenuSub\";\n\nexport function ContextMenuSubTrigger({ children, className }: ContextMenuSubTriggerProps) {\n const { open, setOpen, cancelClose } = useContext(ContextMenuSubContext);\n\n return (\n <button\n type=\"button\"\n data-react-fancy-context-menu-sub-trigger=\"\"\n role=\"menuitem\"\n aria-haspopup=\"menu\"\n aria-expanded={open}\n className={cn(\n \"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-sm transition-colors\",\n \"text-[color:var(--fancy-text-soft,var(--color-zinc-700))] hover:bg-[color:var(--fancy-surface-muted,var(--color-zinc-100))] dark:text-[color:var(--fancy-text-soft-dark,var(--color-zinc-300))] dark:hover:bg-[color:var(--fancy-surface-muted-dark,var(--color-zinc-800))]\",\n open && \"bg-[color:var(--fancy-surface-muted,var(--color-zinc-100))] dark:bg-[color:var(--fancy-surface-muted-dark,var(--color-zinc-800))]\",\n className,\n )}\n onMouseEnter={() => {\n cancelClose();\n setOpen(true);\n }}\n onClick={() => setOpen(!open)}\n >\n <span>{children}</span>\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" className=\"ml-2 opacity-50\">\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n </button>\n );\n}\n\nContextMenuSubTrigger.displayName = \"ContextMenuSubTrigger\";\n\nexport function ContextMenuSubContent({ children, className }: ContextMenuSubContentProps) {\n const { open } = useContext(ContextMenuSubContext);\n const ref = useRef<HTMLDivElement>(null);\n const [flipLeft, setFlipLeft] = useState(false);\n const [topOffset, setTopOffset] = useState(0);\n const [maxH, setMaxH] = useState<number | undefined>(undefined);\n\n useEffect(() => {\n if (!open || !ref.current) return;\n const pad = 8;\n const rect = ref.current.getBoundingClientRect();\n\n // Horizontal: flip left if overflowing right\n setFlipLeft(rect.right > window.innerWidth - pad);\n\n // Vertical: shift up if overflowing bottom, cap height if still too tall\n const overflow = rect.bottom - (window.innerHeight - pad);\n if (overflow > 0) {\n const shifted = Math.min(overflow, rect.top - pad);\n setTopOffset(-shifted);\n if (overflow > shifted) {\n setMaxH(window.innerHeight - pad * 2);\n } else {\n setMaxH(undefined);\n }\n } else {\n setTopOffset(0);\n setMaxH(undefined);\n }\n }, [open]);\n\n if (!open) return null;\n\n return (\n <div\n ref={ref}\n data-react-fancy-context-menu-sub-content=\"\"\n role=\"menu\"\n className={cn(\n \"absolute z-50 min-w-[8rem] rounded-xl border border-[color:var(--fancy-border,var(--color-zinc-200))] bg-[color:var(--fancy-surface,var(--color-white))] p-1 shadow-lg dark:border-[color:var(--fancy-border-dark,var(--color-zinc-700))] dark:bg-[color:var(--fancy-surface-dark,var(--color-zinc-900))]\",\n flipLeft ? \"right-full mr-1\" : \"left-full ml-1\",\n maxH && \"overflow-y-auto\",\n className,\n )}\n style={{ top: topOffset, maxHeight: maxH }}\n >\n <MenuGroupProvider>\n {children}\n </MenuGroupProvider>\n </div>\n );\n}\n\nContextMenuSubContent.displayName = \"ContextMenuSubContent\";\n","import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Portal } from \"../Portal\";\nimport { useContextMenu } from \"./ContextMenu.context\";\nimport { useOutsideClick } from \"../../hooks/use-outside-click\";\nimport { useEscapeKey } from \"../../hooks/use-escape-key\";\nimport { useAnimation } from \"../../hooks/use-animation\";\nimport { MenuGroupProvider } from \"./ContextMenuSub\";\nimport type { ContextMenuContentProps } from \"./ContextMenu.types\";\n\nexport function ContextMenuContent({\n children,\n className,\n}: ContextMenuContentProps) {\n const { open, setOpen, position } = useContextMenu();\n const menuRef = useRef<HTMLDivElement>(null);\n const [adjusted, setAdjusted] = useState<{ x: number; y: number }>(position);\n\n const close = useCallback(() => setOpen(false), [setOpen]);\n useOutsideClick(menuRef, close, open);\n useEscapeKey(close, open);\n\n // Clamp position to viewport after mount\n useEffect(() => {\n const node = menuRef.current;\n if (!open || !node) {\n setAdjusted(position);\n return;\n }\n requestAnimationFrame(() => {\n const rect = node.getBoundingClientRect();\n const pad = 8;\n let x = position.x;\n let y = position.y;\n if (x + rect.width > window.innerWidth - pad) x = window.innerWidth - rect.width - pad;\n if (y + rect.height > window.innerHeight - pad) y = window.innerHeight - rect.height - pad;\n if (x < pad) x = pad;\n if (y < pad) y = pad;\n setAdjusted({ x, y });\n });\n }, [open, position]);\n\n const { mounted, className: animClass, ref: animRef } = useAnimation({\n open,\n enterClass: \"fancy-scale-in\",\n exitClass: \"fancy-fade-out\",\n });\n\n if (!mounted) return null;\n\n return (\n <Portal>\n <div\n ref={(node) => {\n menuRef.current = node;\n (animRef as React.MutableRefObject<HTMLElement | null>).current = node;\n }}\n data-react-fancy-context-menu=\"\"\n role=\"menu\"\n className={cn(\n \"fixed z-50 min-w-[8rem] rounded-xl border border-[color:var(--fancy-border,var(--color-zinc-200))] bg-[color:var(--fancy-surface,var(--color-white))] p-1 shadow-lg dark:border-[color:var(--fancy-border-dark,var(--color-zinc-700))] dark:bg-[color:var(--fancy-surface-dark,var(--color-zinc-900))]\",\n animClass,\n className,\n )}\n style={{ left: adjusted.x, top: adjusted.y }}\n >\n <MenuGroupProvider>\n {children}\n </MenuGroupProvider>\n </div>\n </Portal>\n );\n}\n\nContextMenuContent.displayName = \"ContextMenuContent\";\n","import { cn } from \"../../utils/cn\";\nimport { useContextMenu } from \"./ContextMenu.context\";\nimport type { ContextMenuItemProps } from \"./ContextMenu.types\";\n\nexport function ContextMenuItem({\n children,\n onClick,\n disabled = false,\n danger = false,\n className,\n}: ContextMenuItemProps) {\n const { setOpen } = useContextMenu();\n\n return (\n <button\n type=\"button\"\n data-react-fancy-context-menu-item=\"\"\n role=\"menuitem\"\n disabled={disabled}\n aria-disabled={disabled}\n className={cn(\n \"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm transition-colors\",\n danger\n ? \"text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950\"\n : \"text-[color:var(--fancy-text-soft,var(--color-zinc-700))] hover:bg-[color:var(--fancy-surface-muted,var(--color-zinc-100))] dark:text-[color:var(--fancy-text-soft-dark,var(--color-zinc-300))] dark:hover:bg-[color:var(--fancy-surface-muted-dark,var(--color-zinc-800))]\",\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n onClick={() => {\n if (disabled) return;\n onClick?.();\n setOpen(false);\n }}\n >\n {children}\n </button>\n );\n}\n\nContextMenuItem.displayName = \"ContextMenuItem\";\n","import { cn } from \"../../utils/cn\";\nimport type { ContextMenuSeparatorProps } from \"./ContextMenu.types\";\n\nexport function ContextMenuSeparator({ className }: ContextMenuSeparatorProps) {\n return (\n <div\n data-react-fancy-context-menu-separator=\"\"\n role=\"separator\"\n className={cn(\"my-1 h-px bg-[color:var(--fancy-border,var(--color-zinc-200))] dark:bg-[color:var(--fancy-border-dark,var(--color-zinc-700))]\", className)}\n />\n );\n}\n\nContextMenuSeparator.displayName = \"ContextMenuSeparator\";\n","import { useMemo, useRef, useState } from \"react\";\nimport { ContextMenuContext } from \"./ContextMenu.context\";\nimport { ContextMenuTrigger } from \"./ContextMenuTrigger\";\nimport { ContextMenuContent } from \"./ContextMenuContent\";\nimport { ContextMenuItem } from \"./ContextMenuItem\";\nimport { ContextMenuSeparator } from \"./ContextMenuSeparator\";\nimport { ContextMenuSub, ContextMenuSubTrigger, ContextMenuSubContent } from \"./ContextMenuSub\";\nimport type { ContextMenuProps } from \"./ContextMenu.types\";\n\nfunction ContextMenuRoot({ children }: ContextMenuProps) {\n const [open, setOpen] = useState(false);\n const positionRef = useRef({ x: 0, y: 0 });\n\n const ctx = useMemo(\n () => ({ open, setOpen, position: positionRef.current }),\n [open],\n );\n\n return (\n <ContextMenuContext.Provider value={ctx}>\n {children}\n </ContextMenuContext.Provider>\n );\n}\n\nexport const ContextMenu = Object.assign(ContextMenuRoot, {\n Trigger: ContextMenuTrigger,\n Content: ContextMenuContent,\n Item: ContextMenuItem,\n Separator: ContextMenuSeparator,\n Sub: ContextMenuSub,\n SubTrigger: ContextMenuSubTrigger,\n SubContent: ContextMenuSubContent,\n});\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useEscapeLayer } from './chunk-YX6FTJ6N.js';
|
|
1
2
|
import { useControllableState } from './chunk-EDYAXGUM.js';
|
|
2
3
|
import { useRef, useState, useCallback, useLayoutEffect, useEffect } from 'react';
|
|
3
4
|
|
|
@@ -29,7 +30,6 @@ var FOCUSABLE = [
|
|
|
29
30
|
"[contenteditable]:not([contenteditable='false'])",
|
|
30
31
|
"[tabindex]:not([tabindex='-1'])"
|
|
31
32
|
].join(", ");
|
|
32
|
-
var activeStack = [];
|
|
33
33
|
var OVERLAY_STYLE = {
|
|
34
34
|
position: "fixed",
|
|
35
35
|
top: 0,
|
|
@@ -146,14 +146,11 @@ function useFullScreen(options = {}) {
|
|
|
146
146
|
const winX = window.scrollX;
|
|
147
147
|
const winY = window.scrollY;
|
|
148
148
|
const release = lockScroll ? lockBodyScroll() : null;
|
|
149
|
-
activeStack.push(token.current);
|
|
150
149
|
setPortalContainer(el);
|
|
151
150
|
setApplied(true);
|
|
152
151
|
const native = mode === "native" && typeof el.requestFullscreen === "function" && document.fullscreenEnabled !== false;
|
|
153
152
|
if (!native) promote(el);
|
|
154
153
|
return () => {
|
|
155
|
-
const i = activeStack.indexOf(token.current);
|
|
156
|
-
if (i >= 0) activeStack.splice(i, 1);
|
|
157
154
|
demote();
|
|
158
155
|
setLayer("fixed");
|
|
159
156
|
release?.();
|
|
@@ -221,18 +218,7 @@ function useFullScreen(options = {}) {
|
|
|
221
218
|
setNativeActive(false);
|
|
222
219
|
};
|
|
223
220
|
}, [fullScreen, mode, setFullScreen]);
|
|
224
|
-
|
|
225
|
-
if (!fullScreen || !closeOnEscape) return;
|
|
226
|
-
const onKey = (e) => {
|
|
227
|
-
if (e.key !== "Escape" || e.defaultPrevented) return;
|
|
228
|
-
const t = e.target;
|
|
229
|
-
if (t !== document.body && t !== document.documentElement && t !== document) return;
|
|
230
|
-
if (activeStack[activeStack.length - 1] !== token.current) return;
|
|
231
|
-
setFullScreen(false);
|
|
232
|
-
};
|
|
233
|
-
document.addEventListener("keydown", onKey);
|
|
234
|
-
return () => document.removeEventListener("keydown", onKey);
|
|
235
|
-
}, [fullScreen, closeOnEscape, setFullScreen]);
|
|
221
|
+
const escapeLayer = useEscapeLayer(() => setFullScreen(false), fullScreen && closeOnEscape, token.current);
|
|
236
222
|
const onKeyDown = useCallback(
|
|
237
223
|
(e) => {
|
|
238
224
|
if (!current.current || e.defaultPrevented) return;
|
|
@@ -254,12 +240,14 @@ function useFullScreen(options = {}) {
|
|
|
254
240
|
return;
|
|
255
241
|
}
|
|
256
242
|
if (e.key !== "Escape" || !closeOnEscape) return;
|
|
243
|
+
if (!escapeLayer.isInnermost()) return;
|
|
257
244
|
const layer2 = e.target.closest?.("[data-react-fancy-portal]");
|
|
258
245
|
if (layer2 && !layer2.contains(el)) return;
|
|
259
246
|
e.preventDefault();
|
|
260
247
|
e.stopPropagation();
|
|
261
248
|
setFullScreen(false);
|
|
262
249
|
},
|
|
250
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
263
251
|
[closeOnEscape, setFullScreen]
|
|
264
252
|
);
|
|
265
253
|
const activeMode = fullScreen ? nativeActive ? "native" : "overlay" : null;
|
|
@@ -273,6 +261,7 @@ function useFullScreen(options = {}) {
|
|
|
273
261
|
layer: activeMode ? layer : null,
|
|
274
262
|
ref,
|
|
275
263
|
portalContainer,
|
|
264
|
+
escapeScope: token.current,
|
|
276
265
|
targetProps: {
|
|
277
266
|
ref,
|
|
278
267
|
"data-fullscreen": fullScreen ? "true" : "false",
|
|
@@ -293,5 +282,5 @@ function useFullScreen(options = {}) {
|
|
|
293
282
|
}
|
|
294
283
|
|
|
295
284
|
export { useFullScreen };
|
|
296
|
-
//# sourceMappingURL=chunk-
|
|
297
|
-
//# sourceMappingURL=chunk-
|
|
285
|
+
//# sourceMappingURL=chunk-ZQ3VXRUY.js.map
|
|
286
|
+
//# sourceMappingURL=chunk-ZQ3VXRUY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/scroll-lock.ts","../src/hooks/use-full-screen.ts"],"names":["layer"],"mappings":";;;;;AAYA,IAAI,OAAA,GAAU,CAAA;AACd,IAAI,KAAA,GAAQ,EAAA;AAEL,SAAS,cAAA,GAA6B;AAC3C,EAA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AAmB,aAAa,MAAA,GAAS;AAAA;AAC3C,GACF;AACF","file":"chunk-ZQ3VXRUY.js","sourcesContent":["/**\n * Reference-counted body scroll lock.\n *\n * Two surfaces locking independently with the save-and-restore pattern\n * (`const original = body.style.overflow`) only unwind correctly in strict LIFO\n * order. Exit them out of order and the first one out restores `\"\"` while the\n * second is still covering the viewport, so the page scrolls behind it. Counting\n * holders keeps the lock until the last one lets go, and restores the value that\n * was there before the FIRST took it.\n *\n * Call only from an effect: it touches `document`.\n */\nlet holders = 0;\nlet saved = \"\";\n\nexport function lockBodyScroll(): () => void {\n if (holders === 0) {\n saved = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n }\n holders++;\n\n let released = false;\n return () => {\n if (released) return;\n released = true;\n holders--;\n if (holders === 0) document.body.style.overflow = saved;\n };\n}\n","import {\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent as ReactKeyboardEvent,\n type RefObject,\n} from \"react\";\nimport { useControllableState } from \"./use-controllable-state\";\nimport { lockBodyScroll } from \"../utils/scroll-lock\";\nimport { useEscapeLayer, type EscapeScope } from \"./use-escape-key\";\n\n/**\n * How a surface goes full screen.\n *\n * - `\"overlay\"` (default): the element itself becomes `position: fixed` over the\n * viewport, in place. It always works: inside an iframe without\n * `allow=\"fullscreen\"`, inside a dialog, without a user gesture. Nothing is\n * reparented, so an editor keeps its caret, undo stack and DOM.\n * - `\"native\"`: the browser Fullscreen API (`element.requestFullscreen()`),\n * which hides the browser chrome too. The overlay is applied first and stays\n * if the request is rejected or the API is missing, so the user gets full\n * screen either way; `activeMode` reports which one took.\n */\nexport type FullScreenMode = \"overlay\" | \"native\";\n\nexport interface UseFullScreenOptions {\n /** Controlled flag. Pair with `onFullScreenChange`. */\n fullScreen?: boolean;\n /** Initial flag when uncontrolled. @default false */\n defaultFullScreen?: boolean;\n /**\n * Fired with the requested state — from the toggle, Escape, an agent calling\n * `setFullScreen`, or the user leaving the browser's own full screen.\n */\n onFullScreenChange?: (fullScreen: boolean) => void;\n /** @default \"overlay\" */\n mode?: FullScreenMode;\n /** Leave full screen on Escape. @default true */\n closeOnEscape?: boolean;\n /** Stop the page behind from scrolling while active. @default true */\n lockScroll?: boolean;\n /** Stacking order of the overlay. Matches `Modal`. @default 50 */\n zIndex?: number;\n /** Accessible names for the toggle. */\n labels?: { enter?: string; exit?: string };\n}\n\nexport interface FullScreenTargetProps<T extends HTMLElement> {\n ref: RefObject<T | null>;\n \"data-fullscreen\": \"true\" | \"false\";\n \"data-fullscreen-mode\"?: FullScreenMode;\n \"data-fullscreen-layer\"?: FullScreenLayer;\n style?: CSSProperties;\n onKeyDown: (event: ReactKeyboardEvent<T>) => void;\n}\n\nexport interface FullScreenToggleProps {\n type: \"button\";\n onClick: () => void;\n \"aria-pressed\": boolean;\n \"aria-label\": string;\n title: string;\n \"data-react-fancy-fullscreen-toggle\": \"\";\n \"data-fullscreen\": \"true\" | \"false\";\n}\n\nexport interface UseFullScreenResult<T extends HTMLElement = HTMLElement> {\n fullScreen: boolean;\n setFullScreen: (fullScreen: boolean) => void;\n toggle: () => void;\n /** The mechanism in effect while active; `null` when not full screen. */\n activeMode: FullScreenMode | null;\n /**\n * `\"top\"` while the surface is in the browser's top layer (a manual popover,\n * or the native full screen), `\"fixed\"` while it relies on `position: fixed`\n * (no popover API, or the browser refused). `null` when not full screen.\n */\n layer: FullScreenLayer | null;\n /** Attach to the element that goes full screen. Also inside `targetProps`. */\n ref: RefObject<T | null>;\n /**\n * Spread onto the surface's root. Carries the ref, the `data-fullscreen`\n * handle, the overlay style and the Escape/Tab handler. Merge your own\n * `style` / `onKeyDown` if the root has them.\n */\n targetProps: FullScreenTargetProps<T>;\n /** Spread onto a `<button>` to make it the toggle. */\n toggleProps: FullScreenToggleProps;\n /**\n * The element to portal into while active, else `null`. Provide it through\n * `PortalContainerContext` so menus opened inside stay visible.\n */\n portalContainer: HTMLElement | null;\n /**\n * Identity of this surface for Escape routing. Provide it through\n * `EscapeLayerContext` (FullScreenProvider does) so a menu opened inside\n * gets Escape before the surface does.\n */\n escapeScope: EscapeScope;\n}\n\nconst FOCUSABLE = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"textarea:not([disabled])\",\n \"select:not([disabled])\",\n \"[contenteditable]:not([contenteditable='false'])\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\", \");\n\n\nconst OVERLAY_STYLE: CSSProperties = {\n position: \"fixed\",\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n maxWidth: \"none\",\n maxHeight: \"none\",\n margin: 0,\n borderRadius: 0,\n boxSizing: \"border-box\",\n};\n\n/**\n * Lift `el` into the browser's top layer with `popover=\"manual\"`.\n *\n * Why: `position: fixed` is only fixed to the viewport while no ancestor has a\n * transform, filter, perspective or paint containment. With one, the overlay\n * is fixed to THAT box. In the showcase a surface in a Tabs panel came out\n * 1248x95, because `.fancy-fade-in` held `transform: matrix(1,0,0,1,0,0)` via\n * `animation-fill-mode: both`. Transform-centred dialogs do the same. A\n * top-layer element's containing block is the viewport whatever its ancestors\n * do, and the popover API gets it there without moving it in the DOM.\n *\n * `manual` because `auto` light-dismisses on an outside click and on Escape;\n * Escape stays with the surface's own handler.\n *\n * Returns a release function, or `null` where the API is missing or refuses\n * (the caller keeps the fixed overlay). `onLost` fires if something else\n * closes the popover: a `[popover]` that is not open is `display: none`, so the\n * attribute must go at once or the surface vanishes while still \"full screen\".\n */\n/** Surfaces currently in the top layer through a popover, with a \"re-show\" each. */\nconst promoted = new Map<HTMLElement, () => void>();\n\nfunction promoteToTopLayer(el: HTMLElement, onLost: () => void): (() => void) | null {\n const p = el as HTMLElement & { showPopover?: () => void; hidePopover?: () => void };\n if (typeof p.showPopover !== \"function\" || typeof p.hidePopover !== \"function\") return null;\n // The consumer made it a popover themselves; do not fight over it.\n if (el.hasAttribute(\"popover\")) return null;\n\n el.setAttribute(\"popover\", \"manual\");\n try {\n p.showPopover();\n } catch {\n el.removeAttribute(\"popover\");\n return null;\n }\n\n let open = true;\n let raising = false;\n const onToggle = (e: Event) => {\n if (raising || (e as Event & { newState?: string }).newState !== \"closed\" || !open) return;\n open = false;\n promoted.delete(el);\n el.removeEventListener(\"toggle\", onToggle);\n el.removeAttribute(\"popover\");\n onLost();\n };\n el.addEventListener(\"toggle\", onToggle);\n\n // The top layer stacks in SHOW order. React runs a child's layout effects\n // before its parent's, so a surface nested in another that goes full screen\n // in the same commit is shown first and then buried by its parent. Re-show\n // any promoted descendant so the innermost stays on top.\n for (const [other, raise] of promoted) {\n if (other !== el && el.contains(other)) raise();\n }\n promoted.set(el, () => {\n raising = true;\n try {\n p.hidePopover!();\n p.showPopover!();\n } catch {\n /* leave it where it is */\n } finally {\n raising = false;\n }\n });\n\n return () => {\n promoted.delete(el);\n el.removeEventListener(\"toggle\", onToggle);\n if (open) {\n open = false;\n try {\n p.hidePopover!();\n } catch {\n /* already hidden, e.g. removed from the document */\n }\n }\n el.removeAttribute(\"popover\");\n };\n}\n\n/** Which mechanism keeps the surface over the page. */\nexport type FullScreenLayer = \"top\" | \"fixed\";\n\ninterface ScrollMemo {\n el: Element;\n top: number;\n left: number;\n}\n\n/**\n * A controlled full-screen state for any surface: Editor today, DeckEditor and\n * SheetWorkbook next. Render-time output is pure (no `window`/`document`), so it\n * server-renders; everything that touches the DOM runs in effects.\n */\nexport function useFullScreen<T extends HTMLElement = HTMLElement>(\n options: UseFullScreenOptions = {},\n): UseFullScreenResult<T> {\n const {\n fullScreen: controlled,\n defaultFullScreen = false,\n onFullScreenChange,\n mode = \"overlay\",\n closeOnEscape = true,\n lockScroll = true,\n zIndex = 50,\n labels,\n } = options;\n\n const [fullScreen, setState] = useControllableState(controlled, defaultFullScreen, onFullScreenChange);\n const ref = useRef<T | null>(null);\n const token = useRef({});\n const [nativeActive, setNativeActive] = useState(false);\n const [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);\n // Whether the overlay STYLE is on. It trails `fullScreen` by one synchronous\n // commit on entry, so the layout effect below reads scroll offsets while the\n // surface is still in flow. Read after the style lands and the browser has\n // already clamped every scroll container around it: a panel at 569 read as\n // 342 in Chromium, and that is where the user was sent back to. The re-render\n // happens inside the layout phase, before paint, so nothing flashes.\n // Initialised from `fullScreen` so a surface that starts full screen renders\n // the overlay on the server and on hydration alike.\n const [applied, setApplied] = useState(fullScreen);\n // \"fixed\" until a layout effect has actually promoted the surface, so the\n // server and the hydrating client agree, and a refused promotion reads true.\n const [layer, setLayer] = useState<FullScreenLayer>(\"fixed\");\n const topRelease = useRef<(() => void) | null>(null);\n\n const promote = (el: HTMLElement) => {\n if (topRelease.current) return;\n topRelease.current = promoteToTopLayer(el, () => {\n topRelease.current = null;\n setLayer(\"fixed\");\n });\n setLayer(topRelease.current ? \"top\" : \"fixed\");\n };\n const demote = () => {\n topRelease.current?.();\n topRelease.current = null;\n };\n\n const current = useRef(fullScreen);\n current.current = fullScreen;\n\n // Only report real transitions: Escape on an inactive surface, or a second\n // click racing a re-render, must not fire `onFullScreenChange(false)` twice.\n const setFullScreen = useCallback(\n (next: boolean) => {\n if (current.current === next) return;\n current.current = next;\n setState(next);\n },\n [setState],\n );\n const toggle = useCallback(() => setFullScreen(!current.current), [setFullScreen]);\n\n // Enter / exit bookkeeping. A LAYOUT effect so the cleanup runs after the\n // overlay style has been removed from the DOM but before paint: scroll offsets\n // restored there never flash, and the surface is back in flow to measure.\n useLayoutEffect(() => {\n if (!fullScreen) return;\n const el = ref.current;\n if (!el) return;\n\n // Taking the surface out of flow shrinks every scroll container around it,\n // which clamps their scrollTop. Remember them so exit lands where it began.\n const scrolled: ScrollMemo[] = [];\n for (let p = el.parentElement; p && p !== document.body && p !== document.documentElement; p = p.parentElement) {\n if (p.scrollTop || p.scrollLeft) scrolled.push({ el: p, top: p.scrollTop, left: p.scrollLeft });\n }\n const winX = window.scrollX;\n const winY = window.scrollY;\n\n const release = lockScroll ? lockBodyScroll() : null;\n setPortalContainer(el);\n setApplied(true);\n\n // Native mode asks the browser first: Chromium rejects requestFullscreen()\n // on an element that is already an open popover (\"already open as a\n // Popover, and therefore cannot be opened via the fullscreen API\"). The\n // native effect promotes on refusal instead.\n const native = mode === \"native\" && typeof el.requestFullscreen === \"function\" && document.fullscreenEnabled !== false;\n if (!native) promote(el);\n\n return () => {\n // Out of the top layer first, so the surface is back in flow before the\n // scroll offsets are put back.\n demote();\n setLayer(\"fixed\");\n release?.();\n for (const m of scrolled) {\n if (m.el.scrollTop !== m.top) m.el.scrollTop = m.top;\n if (m.el.scrollLeft !== m.left) m.el.scrollLeft = m.left;\n }\n if (window.scrollX !== winX || window.scrollY !== winY) window.scrollTo(winX, winY);\n setPortalContainer(null);\n setApplied(false);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fullScreen, lockScroll, mode]);\n\n // Focus in and back out. A PASSIVE effect on purpose: React re-focuses\n // whatever had focus before a commit once the commit's mutations finish, so a\n // focus() issued from a layout-effect cleanup is silently undone.\n useEffect(() => {\n if (!fullScreen) return;\n const el = ref.current;\n if (!el) return;\n\n const opener =\n document.activeElement instanceof HTMLElement && document.activeElement !== document.body\n ? document.activeElement\n : null;\n\n // Focus must not stay behind the overlay, where the user cannot see it.\n if (!el.contains(document.activeElement)) {\n el.querySelector<HTMLElement>(FOCUSABLE)?.focus({ preventScroll: true });\n }\n\n return () => {\n // Give focus back only if it is still ours to give: inside the surface,\n // or lost to <body>. A user who clicked elsewhere keeps their choice.\n const active = document.activeElement;\n if (opener?.isConnected && (!active || active === document.body || el.contains(active))) {\n opener.focus({ preventScroll: true });\n }\n };\n }, [fullScreen]);\n\n // The browser Fullscreen API, on top of the overlay.\n useEffect(() => {\n if (!fullScreen || mode !== \"native\") return;\n const el = ref.current;\n if (!el || typeof el.requestFullscreen !== \"function\" || document.fullscreenEnabled === false) return;\n\n let cancelled = false;\n let entered = false;\n\n const onChange = () => {\n if (document.fullscreenElement === el) {\n entered = true;\n setNativeActive(true);\n // The browser's full screen is the top layer too.\n setLayer(\"top\");\n } else if (entered) {\n // The user left through the browser's own UI (Esc, F11, the close\n // pill). Keep the controlled state honest rather than leaving an\n // overlay up that they believe they dismissed.\n entered = false;\n setNativeActive(false);\n setLayer(\"fixed\");\n if (!cancelled) setFullScreen(false);\n }\n };\n document.addEventListener(\"fullscreenchange\", onChange);\n\n // Blocked requests (iframe without allow=\"fullscreen\", no user gesture, a\n // permissions policy) reject, and some engines throw instead. Either way\n // the user stays full screen in the overlay, lifted into the top layer.\n const refused = () => {\n if (!cancelled && current.current && ref.current === el) promote(el);\n };\n try {\n Promise.resolve(el.requestFullscreen()).then(onChange, refused);\n } catch {\n refused();\n }\n\n return () => {\n cancelled = true;\n document.removeEventListener(\"fullscreenchange\", onChange);\n if (document.fullscreenElement === el) {\n try {\n Promise.resolve(document.exitFullscreen()).catch(() => {});\n } catch {\n /* already left */\n }\n }\n setNativeActive(false);\n };\n }, [fullScreen, mode, setFullScreen]);\n\n // The surface is an Escape LAYER while active, in the same stack as every\n // Dropdown, Select, Popover, Modal and Tooltip. Layers opened inside it\n // register under `token.current` (through EscapeLayerContext, which crosses\n // portals), so the stack knows they are inside and hands them Escape first,\n // whatever order the listeners run in. With nothing focused, or focus\n // outside the surface, the stack's document listener delivers it here.\n const escapeLayer = useEscapeLayer(() => setFullScreen(false), fullScreen && closeOnEscape, token.current);\n\n const onKeyDown = useCallback(\n (e: ReactKeyboardEvent<T>) => {\n if (!current.current || e.defaultPrevented) return;\n const el = ref.current;\n if (!el) return;\n\n if (e.key === \"Tab\") {\n // Keep Tab inside the surface; what is behind the overlay is invisible.\n const items = Array.from(el.querySelectorAll<HTMLElement>(FOCUSABLE));\n if (items.length === 0) return;\n const first = items[0];\n const last = items[items.length - 1];\n const active = document.activeElement;\n if (e.shiftKey && (active === first || active === el)) {\n e.preventDefault();\n last.focus();\n } else if (!e.shiftKey && active === last) {\n e.preventDefault();\n first.focus();\n }\n return;\n }\n\n if (e.key !== \"Escape\" || !closeOnEscape) return;\n // A layer opened from inside this surface is open (a menu, a listbox, a\n // popover, a tooltip, a dialog): it owns this Escape. Let the event go on\n // to the stack's document listener, which closes that layer only. This\n // is a lookup, not a race: in 5.61.1 the surface asked\n // `defaultPrevented`, which a document-level menu had not set yet.\n if (!escapeLayer.isInnermost()) return;\n // Portal content that never registered as a layer (a consumer's own\n // menu in a react-fancy Portal) still gets the benefit of the doubt.\n // React bubbles portal events through the component tree, so check the\n // DOM: a portal wrapper that does not contain this surface is inside it.\n const layer = (e.target as Element).closest?.(\"[data-react-fancy-portal]\");\n if (layer && !layer.contains(el)) return;\n // Stop it here so an enclosing dialog's document listener does not also\n // close: one Escape, one step back.\n e.preventDefault();\n e.stopPropagation();\n setFullScreen(false);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [closeOnEscape, setFullScreen],\n );\n\n const activeMode: FullScreenMode | null = fullScreen ? (nativeActive ? \"native\" : \"overlay\") : null;\n const enterLabel = labels?.enter ?? \"Enter full screen\";\n const exitLabel = labels?.exit ?? \"Exit full screen\";\n\n return {\n fullScreen,\n setFullScreen,\n toggle,\n activeMode,\n layer: activeMode ? layer : null,\n ref,\n portalContainer,\n escapeScope: token.current,\n targetProps: {\n ref,\n \"data-fullscreen\": fullScreen ? \"true\" : \"false\",\n ...(activeMode ? { \"data-fullscreen-mode\": activeMode, \"data-fullscreen-layer\": layer } : {}),\n ...(fullScreen && applied ? { style: { ...OVERLAY_STYLE, zIndex } } : {}),\n onKeyDown,\n },\n toggleProps: {\n type: \"button\",\n onClick: toggle,\n \"aria-pressed\": fullScreen,\n \"aria-label\": fullScreen ? exitLabel : enterLabel,\n title: fullScreen ? exitLabel : enterLabel,\n \"data-react-fancy-fullscreen-toggle\": \"\",\n \"data-fullscreen\": fullScreen ? \"true\" : \"false\",\n },\n };\n}\n"]}
|
package/dist/command.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkUJRMY54A_cjs = require('./chunk-UJRMY54A.cjs');
|
|
4
4
|
require('./chunk-TXTRTTG7.cjs');
|
|
5
5
|
require('./chunk-FQZE5N2N.cjs');
|
|
6
6
|
require('./chunk-MKHYENKR.cjs');
|
|
7
7
|
require('./chunk-TI7D4QDM.cjs');
|
|
8
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-OUYC6EIL.cjs');
|
|
9
9
|
require('./chunk-SNHU2AI4.cjs');
|
|
10
10
|
require('./chunk-ZU5Q77OT.cjs');
|
|
11
11
|
|
|
@@ -13,11 +13,11 @@ require('./chunk-ZU5Q77OT.cjs');
|
|
|
13
13
|
|
|
14
14
|
Object.defineProperty(exports, "Command", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkUJRMY54A_cjs.Command; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "useCommand", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkUJRMY54A_cjs.useCommand; }
|
|
21
21
|
});
|
|
22
22
|
//# sourceMappingURL=command.cjs.map
|
|
23
23
|
//# sourceMappingURL=command.cjs.map
|
package/dist/command.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { Command, useCommand } from './chunk-
|
|
1
|
+
export { Command, useCommand } from './chunk-ARO2DNGS.js';
|
|
2
2
|
import './chunk-5U2DZ7AV.js';
|
|
3
3
|
import './chunk-3K2CEAI7.js';
|
|
4
4
|
import './chunk-5VMILVWD.js';
|
|
5
5
|
import './chunk-RBCMKPBX.js';
|
|
6
|
-
import './chunk-
|
|
6
|
+
import './chunk-YX6FTJ6N.js';
|
|
7
7
|
import './chunk-EDYAXGUM.js';
|
|
8
8
|
import './chunk-MMW2JGKZ.js';
|
|
9
9
|
//# sourceMappingURL=command.js.map
|