sparkdesign 0.0.1 → 0.2.6
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/README.md +279 -5
- package/cli/dist/commands/add.js +84 -0
- package/cli/dist/commands/diff.js +54 -0
- package/cli/dist/commands/init.js +96 -0
- package/cli/dist/commands/list.js +25 -0
- package/cli/dist/index.js +37 -0
- package/cli/dist/utils/config.js +53 -0
- package/cli/dist/utils/registry.js +34 -0
- package/cli/dist/utils/tokens.js +90 -0
- package/cli/dist/utils/transform.js +19 -0
- package/cli/registry/basic/alert-dialog.tsx +180 -0
- package/cli/registry/basic/avatar.tsx +120 -0
- package/cli/registry/basic/button.tsx +100 -0
- package/cli/registry/basic/collapse.tsx +94 -0
- package/cli/registry/basic/collapsible-card.tsx +230 -0
- package/cli/registry/basic/collapsible.tsx +21 -0
- package/cli/registry/basic/dropdown-menu.tsx +254 -0
- package/cli/registry/basic/icon-button.tsx +66 -0
- package/cli/registry/basic/icons-inline.tsx +206 -0
- package/cli/registry/basic/kbd.tsx +50 -0
- package/cli/registry/basic/option-list.tsx +125 -0
- package/cli/registry/basic/pagination.tsx +132 -0
- package/cli/registry/basic/progress.tsx +42 -0
- package/cli/registry/basic/radio-group.tsx +69 -0
- package/cli/registry/basic/resizable.tsx +67 -0
- package/cli/registry/basic/scrollbar.tsx +114 -0
- package/cli/registry/basic/select.tsx +177 -0
- package/cli/registry/basic/skeleton.tsx +33 -0
- package/cli/registry/basic/slider.tsx +55 -0
- package/cli/registry/basic/sonner.tsx +104 -0
- package/cli/registry/basic/spinner.tsx +17 -0
- package/cli/registry/basic/switch.tsx +49 -0
- package/cli/registry/basic/table.tsx +117 -0
- package/cli/registry/basic/tabs.tsx +85 -0
- package/cli/registry/basic/tag.tsx +161 -0
- package/cli/registry/basic/theme-from-document.ts +10 -0
- package/cli/registry/basic/toggle.tsx +223 -0
- package/cli/registry/basic/tooltip.tsx +80 -0
- package/cli/registry/basic/typography.tsx +201 -0
- package/cli/registry/chat/browser-use-part.tsx +166 -0
- package/cli/registry/chat/chat-input/chat-input-folder-selector.tsx +185 -0
- package/cli/registry/chat/chat-input/chat-input-model-switcher.tsx +131 -0
- package/cli/registry/chat/chat-input/chat-input-textarea.tsx +67 -0
- package/cli/registry/chat/chat-input/compound.tsx +334 -0
- package/cli/registry/chat/chat-input/context.tsx +189 -0
- package/cli/registry/chat/chat-input/folder-permission-dialog.tsx +61 -0
- package/cli/registry/chat/chat-input/index.tsx +123 -0
- package/cli/registry/chat/chat-input/types.ts +77 -0
- package/cli/registry/chat/chat-input/useAutoResizeTextarea.ts +20 -0
- package/cli/registry/chat/code-block-part.tsx +151 -0
- package/cli/registry/chat/file-attachment.tsx +44 -0
- package/cli/registry/chat/file-card.tsx +68 -0
- package/cli/registry/chat/file-review-part.tsx +259 -0
- package/cli/registry/chat/folder-button.tsx +169 -0
- package/cli/registry/chat/generated-images-grid.tsx +56 -0
- package/cli/registry/chat/generation-status-bar.tsx +72 -0
- package/cli/registry/chat/image-attachment.tsx +166 -0
- package/cli/registry/chat/image-generating.tsx +281 -0
- package/cli/registry/chat/markdown.tsx +146 -0
- package/cli/registry/chat/mermaid-part.tsx +90 -0
- package/cli/registry/chat/permission-card.tsx +178 -0
- package/cli/registry/chat/plan-part.tsx +168 -0
- package/cli/registry/chat/question-part.tsx +70 -0
- package/cli/registry/chat/queue-indicator.tsx +234 -0
- package/cli/registry/chat/reasoning-step.tsx +358 -0
- package/cli/registry/chat/related-prompts.tsx +91 -0
- package/cli/registry/chat/request.tsx +38 -0
- package/cli/registry/chat/response.tsx +271 -0
- package/cli/registry/chat/send-button.tsx +94 -0
- package/cli/registry/chat/sidebar-menu.tsx +177 -0
- package/cli/registry/chat/streaming-markdown-block.tsx +111 -0
- package/cli/registry/chat/suggestion-part.tsx +165 -0
- package/cli/registry/chat/task-part.tsx +109 -0
- package/cli/registry/chat/terminal-code-block-part.tsx +69 -0
- package/cli/registry/chat/thinking-indicator.tsx +91 -0
- package/cli/registry/chat/tool-invocation-card.tsx +132 -0
- package/cli/registry/chat/user-question/UserQuestionCard.tsx +198 -0
- package/cli/registry/chat/user-question/UserQuestionFooter.tsx +66 -0
- package/cli/registry/chat/user-question/UserQuestionHeader.tsx +64 -0
- package/cli/registry/chat/user-question/index.tsx +340 -0
- package/cli/registry/chat/user-question/types.ts +61 -0
- package/cli/registry/chat/user-question/useUserQuestionKeyboard.ts +127 -0
- package/cli/registry/chat/user-question/useUserQuestionState.ts +165 -0
- package/cli/registry/chat/user-question-answer.tsx +62 -0
- package/cli/registry/lib/file-icon-maps.ts +150 -0
- package/cli/registry/lib/use-mermaid-render.ts +76 -0
- package/cli/registry/lib/utils.ts +6 -0
- package/cli/registry/meta.json +1 -0
- package/cli/registry/tokens/scale.css +299 -0
- package/cli/registry/tokens/theme.css +633 -0
- package/dist/_basePickBy-DnQN8w3y.js +151 -0
- package/dist/_basePickBy-a-kPMlkg.cjs +1 -0
- package/dist/_baseUniq-B-N2NQ50.js +614 -0
- package/dist/_baseUniq-Cc_zbSif.cjs +1 -0
- package/dist/arc-BQBhijZ6.js +83 -0
- package/dist/arc-mWQt0Yph.cjs +1 -0
- package/dist/architectureDiagram-VXUJARFQ-BMZEucno.cjs +36 -0
- package/dist/architectureDiagram-VXUJARFQ-DTdjD3Bp.js +4661 -0
- package/dist/blockDiagram-VD42YOAC-CzHn0yob.js +2256 -0
- package/dist/blockDiagram-VD42YOAC-DDxdHAlz.cjs +122 -0
- package/dist/c4Diagram-YG6GDRKO-4Gz0I4gj.cjs +10 -0
- package/dist/c4Diagram-YG6GDRKO-BIy--yVN.js +1580 -0
- package/dist/channel-BQn0o8bs.js +5 -0
- package/dist/channel-DaN7XniJ.cjs +1 -0
- package/dist/chunk-4BX2VUAB-BlQFTQqz.cjs +1 -0
- package/dist/chunk-4BX2VUAB-Czitj3Kc.js +8 -0
- package/dist/chunk-55IACEB6-DXacNZbO.js +8 -0
- package/dist/chunk-55IACEB6-DnDxpye9.cjs +1 -0
- package/dist/chunk-B4BG7PRW-CBdN0q_V.js +1375 -0
- package/dist/chunk-B4BG7PRW-DbGvUkGO.cjs +165 -0
- package/dist/chunk-DI55MBZ5-D1YJMs6x.cjs +220 -0
- package/dist/chunk-DI55MBZ5-NCQTvayw.js +1370 -0
- package/dist/chunk-FMBD7UC4-CsGMbrtr.js +19 -0
- package/dist/chunk-FMBD7UC4-Di7cUUh5.cjs +15 -0
- package/dist/chunk-QN33PNHL-0j5LC8Lm.cjs +1 -0
- package/dist/chunk-QN33PNHL-3GERZBRm.js +19 -0
- package/dist/chunk-QZHKN3VN-AVEY9ImQ.js +15 -0
- package/dist/chunk-QZHKN3VN-s8Z0a8mc.cjs +1 -0
- package/dist/chunk-TZMSLE5B-CAf87HPt.cjs +1 -0
- package/dist/chunk-TZMSLE5B-sbiflal0.js +64 -0
- package/dist/classDiagram-2ON5EDUG-Ct9JLIN2.cjs +1 -0
- package/dist/classDiagram-2ON5EDUG-Dzfrft3a.js +16 -0
- package/dist/classDiagram-v2-WZHVMYZB-Ct9JLIN2.cjs +1 -0
- package/dist/classDiagram-v2-WZHVMYZB-Dzfrft3a.js +16 -0
- package/dist/clone-Cde_NQ8V.js +8 -0
- package/dist/clone-DCNjWuM2.cjs +1 -0
- package/dist/cose-bilkent-S5V4N54A-0uLijMro.cjs +1 -0
- package/dist/cose-bilkent-S5V4N54A-Bb08N431.js +2608 -0
- package/dist/cytoscape.esm-CNUX3VTg.cjs +321 -0
- package/dist/cytoscape.esm-Cvf3sx9F.js +18704 -0
- package/dist/dagre-6UL2VRFP-CY_Wz5Zd.js +444 -0
- package/dist/dagre-6UL2VRFP-Dxe7_qZc.cjs +4 -0
- package/dist/defaultLocale-BgPVtth8.js +171 -0
- package/dist/defaultLocale-C4wbwF1n.cjs +1 -0
- package/dist/diagram-PSM6KHXK-D2bdb7MT.js +531 -0
- package/dist/diagram-PSM6KHXK-YF69SUjY.cjs +24 -0
- package/dist/diagram-QEK2KX5R-BpUSoh0-.js +217 -0
- package/dist/diagram-QEK2KX5R-DZPGteon.cjs +43 -0
- package/dist/diagram-S2PKOQOG-ht-zdvFG.cjs +24 -0
- package/dist/diagram-S2PKOQOG-zFeLJ50Z.js +142 -0
- package/dist/erDiagram-Q2GNP2WA-B38iJ6ts.js +841 -0
- package/dist/erDiagram-Q2GNP2WA-RgS80DDU.cjs +60 -0
- package/dist/flowDiagram-NV44I4VS-BHilOs2p.cjs +162 -0
- package/dist/flowDiagram-NV44I4VS-BrBJcoce.js +1620 -0
- package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/ganttDiagram-JELNMOA3-pZiJeFio.cjs +267 -0
- package/dist/ganttDiagram-JELNMOA3-tw6FhkWJ.js +2670 -0
- package/dist/gitGraphDiagram-V2S2FVAM-BWn5uIK5.js +699 -0
- package/dist/gitGraphDiagram-V2S2FVAM-DKKeG-9R.cjs +65 -0
- package/dist/graph-DIbblrZP.cjs +1 -0
- package/dist/graph-DPcK91G3.js +247 -0
- package/dist/infoDiagram-HS3SLOUP-B8gwwhct.cjs +2 -0
- package/dist/infoDiagram-HS3SLOUP-D47PNcP_.js +24 -0
- package/dist/init-CHZsXQcr.cjs +1 -0
- package/dist/init-DjUOC4st.js +16 -0
- package/dist/journeyDiagram-XKPGCS4Q-BG3cfhyU.js +834 -0
- package/dist/journeyDiagram-XKPGCS4Q-D8DVLJof.cjs +139 -0
- package/dist/kanban-definition-3W4ZIXB7-4OCnEouP.cjs +89 -0
- package/dist/kanban-definition-3W4ZIXB7-CWi_ssF9.js +719 -0
- package/dist/katex.css +1 -0
- package/dist/layout-Byuh8f-J.cjs +1 -0
- package/dist/layout-CdLdvj1j.js +1335 -0
- package/dist/linear-C2Q_PI9B.js +259 -0
- package/dist/linear-C69aPBW1.cjs +1 -0
- package/dist/mermaid.core-DBwAx_jp.cjs +249 -0
- package/dist/mermaid.core-gFR0XUlD.js +15300 -0
- package/dist/mindmap-definition-VGOIOE7T-8P7obVV4.cjs +68 -0
- package/dist/mindmap-definition-VGOIOE7T-DnOa7WJ9.js +784 -0
- package/dist/ordinal-B6-f3MAq.js +61 -0
- package/dist/ordinal-CagbB1m8.cjs +1 -0
- package/dist/pieDiagram-ADFJNKIX-5NAlvhMo.js +161 -0
- package/dist/pieDiagram-ADFJNKIX-CQBG4yR9.cjs +30 -0
- package/dist/qoder-design.css +2 -0
- package/dist/quadrantDiagram-AYHSOK5B-Oe4y7RZ0.cjs +7 -0
- package/dist/quadrantDiagram-AYHSOK5B-rh2DPEP1.js +1022 -0
- package/dist/registry/basic/alert-dialog.d.ts +40 -0
- package/dist/registry/basic/avatar.d.ts +30 -0
- package/dist/registry/basic/button.d.ts +16 -0
- package/dist/registry/basic/collapse.d.ts +22 -0
- package/dist/registry/basic/collapsible-card.d.ts +34 -0
- package/dist/registry/basic/collapsible.d.ts +15 -0
- package/dist/registry/basic/dropdown-menu.d.ts +52 -0
- package/dist/registry/basic/icon-button.d.ts +12 -0
- package/dist/registry/basic/icons-inline.d.ts +51 -0
- package/dist/registry/basic/kbd.d.ts +23 -0
- package/dist/registry/basic/option-list.d.ts +16 -0
- package/dist/registry/basic/pagination.d.ts +33 -0
- package/dist/registry/basic/progress.d.ts +18 -0
- package/dist/registry/basic/radio-group.d.ts +25 -0
- package/dist/registry/basic/resizable.d.ts +318 -0
- package/dist/registry/basic/scrollbar.d.ts +12 -0
- package/dist/registry/basic/select.d.ts +35 -0
- package/dist/registry/basic/skeleton.d.ts +10 -0
- package/dist/registry/basic/slider.d.ts +16 -0
- package/dist/registry/basic/sonner.d.ts +23 -0
- package/dist/registry/basic/spinner.d.ts +5 -0
- package/dist/registry/basic/switch.d.ts +20 -0
- package/dist/registry/basic/table.d.ts +18 -0
- package/dist/registry/basic/tabs.d.ts +29 -0
- package/dist/registry/basic/tag.d.ts +23 -0
- package/dist/registry/basic/theme-from-document.d.ts +10 -0
- package/dist/registry/basic/toggle.d.ts +29 -0
- package/dist/registry/basic/tooltip.d.ts +34 -0
- package/dist/registry/basic/typography.d.ts +76 -0
- package/dist/registry/chat/browser-use-part.d.ts +28 -0
- package/dist/registry/chat/chat-input/chat-input-folder-selector.d.ts +22 -0
- package/dist/registry/chat/chat-input/chat-input-model-switcher.d.ts +12 -0
- package/dist/registry/chat/chat-input/chat-input-textarea.d.ts +9 -0
- package/dist/registry/chat/chat-input/compound.d.ts +97 -0
- package/dist/registry/chat/chat-input/context.d.ts +64 -0
- package/dist/registry/chat/chat-input/folder-permission-dialog.d.ts +11 -0
- package/dist/registry/chat/chat-input/index.d.ts +34 -0
- package/dist/registry/chat/chat-input/types.d.ts +79 -0
- package/dist/registry/chat/chat-input/useAutoResizeTextarea.d.ts +7 -0
- package/dist/registry/chat/code-block-part.d.ts +23 -0
- package/dist/registry/chat/file-attachment.d.ts +19 -0
- package/dist/registry/chat/file-card.d.ts +10 -0
- package/dist/registry/chat/file-review-part.d.ts +30 -0
- package/dist/registry/chat/folder-button.d.ts +20 -0
- package/dist/registry/chat/generated-images-grid.d.ts +15 -0
- package/dist/registry/chat/generation-status-bar.d.ts +19 -0
- package/dist/registry/chat/image-attachment.d.ts +19 -0
- package/dist/registry/chat/image-generating.d.ts +15 -0
- package/dist/registry/chat/markdown.d.ts +8 -0
- package/dist/registry/chat/mermaid-part.d.ts +17 -0
- package/dist/registry/chat/permission-card.d.ts +24 -0
- package/dist/registry/chat/plan-part.d.ts +30 -0
- package/dist/registry/chat/question-part.d.ts +24 -0
- package/dist/registry/chat/queue-indicator.d.ts +27 -0
- package/dist/registry/chat/reasoning-step.d.ts +35 -0
- package/dist/registry/chat/related-prompts.d.ts +23 -0
- package/dist/registry/chat/request.d.ts +6 -0
- package/dist/registry/chat/response.d.ts +28 -0
- package/dist/registry/chat/send-button.d.ts +17 -0
- package/dist/registry/chat/sidebar-menu.d.ts +23 -0
- package/dist/registry/chat/streaming-markdown-block.d.ts +8 -0
- package/dist/registry/chat/suggestion-part.d.ts +28 -0
- package/dist/registry/chat/task-part.d.ts +28 -0
- package/dist/registry/chat/terminal-code-block-part.d.ts +18 -0
- package/dist/registry/chat/thinking-indicator.d.ts +14 -0
- package/dist/registry/chat/tool-invocation-card.d.ts +20 -0
- package/dist/registry/chat/user-question/UserQuestionCard.d.ts +30 -0
- package/dist/registry/chat/user-question/UserQuestionFooter.d.ts +18 -0
- package/dist/registry/chat/user-question/UserQuestionHeader.d.ts +20 -0
- package/dist/registry/chat/user-question/index.d.ts +7 -0
- package/dist/registry/chat/user-question/types.d.ts +52 -0
- package/dist/registry/chat/user-question/useUserQuestionKeyboard.d.ts +18 -0
- package/dist/registry/chat/user-question/useUserQuestionState.d.ts +26 -0
- package/dist/registry/chat/user-question-answer.d.ts +13 -0
- package/dist/registry/lib/file-icon-maps.d.ts +20 -0
- package/dist/registry/lib/use-mermaid-render.d.ts +5 -0
- package/dist/registry/lib/utils.d.ts +11 -0
- package/dist/requirementDiagram-UZGBJVZJ-DcWaCuXr.js +850 -0
- package/dist/requirementDiagram-UZGBJVZJ-gfdlrFiq.cjs +64 -0
- package/dist/sankeyDiagram-TZEHDZUN-CQIKFwD0.js +810 -0
- package/dist/sankeyDiagram-TZEHDZUN-DvPtzQvC.cjs +10 -0
- package/dist/scale.css +307 -0
- package/dist/sequenceDiagram-WL72ISMW-BNrsMagL.cjs +145 -0
- package/dist/sequenceDiagram-WL72ISMW-iCX3ckKx.js +2511 -0
- package/dist/spark-design.cjs.js +265 -0
- package/dist/spark-design.es.js +13207 -0
- package/dist/src/components/chat/BrowserUsePart/index.d.ts +7 -0
- package/dist/src/components/chat/ChatInput/index.d.ts +29 -0
- package/dist/src/components/chat/CodeBlockPart/index.d.ts +7 -0
- package/dist/src/components/chat/CollapsibleCard/index.d.ts +7 -0
- package/dist/src/components/chat/FileAttachment/index.d.ts +3 -0
- package/dist/src/components/chat/FileCard/index.d.ts +3 -0
- package/dist/src/components/chat/FileReviewPart/index.d.ts +7 -0
- package/dist/src/components/chat/FolderButton/index.d.ts +5 -0
- package/dist/src/components/chat/GeneratedImagesGrid/index.d.ts +7 -0
- package/dist/src/components/chat/GenerationStatusBar/index.d.ts +7 -0
- package/dist/src/components/chat/ImageAttachment/index.d.ts +3 -0
- package/dist/src/components/chat/ImageGenerating/index.d.ts +6 -0
- package/dist/src/components/chat/Markdown/demo-content.d.ts +1 -0
- package/dist/src/components/chat/Markdown/index.d.ts +7 -0
- package/dist/src/components/chat/MermaidPart/index.d.ts +6 -0
- package/dist/src/components/chat/PermissionCard/index.d.ts +4 -0
- package/dist/src/components/chat/PlanPart/index.d.ts +6 -0
- package/dist/src/components/chat/QuestionPart/index.d.ts +6 -0
- package/dist/src/components/chat/QueueIndicator/index.d.ts +4 -0
- package/dist/src/components/chat/ReasoningStep/index.d.ts +7 -0
- package/dist/src/components/chat/RelatedPrompts/index.d.ts +6 -0
- package/dist/src/components/chat/Request/index.d.ts +7 -0
- package/dist/src/components/chat/Response/StreamingMarkdownBlock.d.ts +6 -0
- package/dist/src/components/chat/Response/index.d.ts +6 -0
- package/dist/src/components/chat/SendButton/index.d.ts +5 -0
- package/dist/src/components/chat/SidebarMenu/index.d.ts +4 -0
- package/dist/src/components/chat/SuggestionPart/index.d.ts +6 -0
- package/dist/src/components/chat/TaskPart/index.d.ts +7 -0
- package/dist/src/components/chat/TerminalCodeBlockPart/index.d.ts +6 -0
- package/dist/src/components/chat/ThinkingIndicator/index.d.ts +6 -0
- package/dist/src/components/chat/ToolInvocationCard/index.d.ts +4 -0
- package/dist/src/components/chat/UserQuestion/index.d.ts +5 -0
- package/dist/src/components/chat/UserQuestionAnswer/index.d.ts +3 -0
- package/dist/src/components/foundation/AlertDialog/index.d.ts +20 -0
- package/dist/src/components/foundation/Avatar/index.d.ts +7 -0
- package/dist/src/components/foundation/Button/index.d.ts +7 -0
- package/dist/src/components/foundation/Collapse/index.d.ts +15 -0
- package/dist/src/components/foundation/Collapsible/index.d.ts +7 -0
- package/dist/src/components/foundation/CollapsibleSection/index.d.ts +43 -0
- package/dist/src/components/foundation/DropdownMenu/index.d.ts +19 -0
- package/dist/src/components/foundation/EllipsisText/index.d.ts +53 -0
- package/dist/src/components/foundation/IconButton/index.d.ts +7 -0
- package/dist/src/components/foundation/Kbd/index.d.ts +7 -0
- package/dist/src/components/foundation/OptionList/index.d.ts +7 -0
- package/dist/src/components/foundation/Pagination/index.d.ts +7 -0
- package/dist/src/components/foundation/Progress/index.d.ts +7 -0
- package/dist/src/components/foundation/RadioGroup/index.d.ts +7 -0
- package/dist/src/components/foundation/Resizable/index.d.ts +7 -0
- package/dist/src/components/foundation/Scrollbar/index.d.ts +7 -0
- package/dist/src/components/foundation/Select/index.d.ts +17 -0
- package/dist/src/components/foundation/Skeleton/index.d.ts +7 -0
- package/dist/src/components/foundation/Slider/index.d.ts +7 -0
- package/dist/src/components/foundation/Spinner/index.d.ts +7 -0
- package/dist/src/components/foundation/Switch/index.d.ts +38 -0
- package/dist/src/components/foundation/Table/index.d.ts +7 -0
- package/dist/src/components/foundation/Tabs/index.d.ts +7 -0
- package/dist/src/components/foundation/Tag/index.d.ts +10 -0
- package/dist/src/components/foundation/Toast/index.d.ts +12 -0
- package/dist/src/components/foundation/Toggle/index.d.ts +7 -0
- package/dist/src/components/foundation/Tooltip/index.d.ts +21 -0
- package/dist/src/components/foundation/Typography/index.d.ts +7 -0
- package/dist/src/components/index.d.ts +136 -0
- package/dist/src/icons/context.d.ts +26 -0
- package/dist/src/icons/types.d.ts +18 -0
- package/dist/src/lib/ThemeStyleContext.d.ts +21 -0
- package/dist/src/lib/file-icon.d.ts +16 -0
- package/dist/src/lib/i18n.d.ts +12 -0
- package/dist/src/lib/index.d.ts +10 -0
- package/dist/src/lib/motion.d.ts +22 -0
- package/dist/src/lib/utils.d.ts +11 -0
- package/dist/stateDiagram-FKZM4ZOC-DBvJ_eeL.cjs +1 -0
- package/dist/stateDiagram-FKZM4ZOC-ZVsJlaHJ.js +263 -0
- package/dist/stateDiagram-v2-4FDKWEC3-CB_nTHcE.js +16 -0
- package/dist/stateDiagram-v2-4FDKWEC3-Xkx17v6T.cjs +1 -0
- package/dist/theme.css +804 -0
- package/dist/timeline-definition-IT6M3QCI-BmGkYQiz.cjs +61 -0
- package/dist/timeline-definition-IT6M3QCI-Ck8zTt6w.js +795 -0
- package/dist/treemap-GDKQZRPO-B9sfERx8.js +17922 -0
- package/dist/treemap-GDKQZRPO-BVfJRs0Z.cjs +160 -0
- package/dist/xychartDiagram-PRI3JC2R-By_S8NzN.js +1340 -0
- package/dist/xychartDiagram-PRI3JC2R-CNfDrGxM.cjs +7 -0
- package/package.json +111 -9
- package/index.js +0 -5
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { forwardRef, useCallback, useRef } from 'react'
|
|
2
|
+
import { useAutoResizeTextarea } from './useAutoResizeTextarea'
|
|
3
|
+
|
|
4
|
+
export interface ChatInputTextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'onChange'> {
|
|
5
|
+
value: string
|
|
6
|
+
onChange?: (value: string) => void
|
|
7
|
+
placeholder?: string
|
|
8
|
+
disabled?: boolean
|
|
9
|
+
maxRows?: number
|
|
10
|
+
onKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const ChatInputTextarea = forwardRef<HTMLTextAreaElement, ChatInputTextareaProps>(
|
|
14
|
+
(
|
|
15
|
+
{
|
|
16
|
+
value,
|
|
17
|
+
onChange,
|
|
18
|
+
placeholder = 'What can I help you with today?',
|
|
19
|
+
disabled = false,
|
|
20
|
+
maxRows = 6,
|
|
21
|
+
onKeyDown,
|
|
22
|
+
className,
|
|
23
|
+
style,
|
|
24
|
+
...props
|
|
25
|
+
},
|
|
26
|
+
ref
|
|
27
|
+
) => {
|
|
28
|
+
const innerRef = useRef<HTMLTextAreaElement>(null)
|
|
29
|
+
useAutoResizeTextarea(innerRef, value, maxRows)
|
|
30
|
+
|
|
31
|
+
const setRef = useCallback(
|
|
32
|
+
(node: HTMLTextAreaElement | null) => {
|
|
33
|
+
(innerRef as React.MutableRefObject<HTMLTextAreaElement | null>).current = node
|
|
34
|
+
if (typeof ref === 'function') ref(node)
|
|
35
|
+
else if (ref) (ref as React.MutableRefObject<HTMLTextAreaElement | null>).current = node
|
|
36
|
+
},
|
|
37
|
+
[ref]
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
const handleChange = useCallback(
|
|
41
|
+
(e: React.ChangeEvent<HTMLTextAreaElement>) => onChange?.(e.target.value),
|
|
42
|
+
[onChange]
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
const textareaNoFocusStyle = { outline: 'none', border: 'none', boxShadow: 'none' } as const
|
|
46
|
+
const textareaStyles =
|
|
47
|
+
'w-full resize-none border-none bg-transparent text-sm leading-sm font-normal placeholder:text-text-tertiary overflow-y-auto scrollbar-auto outline-none shadow-none focus:outline-none focus:ring-0 focus:shadow-none focus-visible:outline-none focus-visible:ring-0 focus-visible:shadow-none [&:focus-visible]:outline-none [&:focus-visible]:ring-0 [&:focus-visible]:ring-offset-0 [&:focus-visible]:shadow-none ' +
|
|
48
|
+
(value?.trim() ? 'text-text' : 'text-text-quaternary')
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<textarea
|
|
52
|
+
ref={setRef}
|
|
53
|
+
value={value}
|
|
54
|
+
onChange={handleChange}
|
|
55
|
+
onKeyDown={onKeyDown}
|
|
56
|
+
placeholder={placeholder}
|
|
57
|
+
disabled={disabled}
|
|
58
|
+
rows={1}
|
|
59
|
+
className={textareaStyles}
|
|
60
|
+
{...props}
|
|
61
|
+
style={{ ...(style ?? {}), ...textareaNoFocusStyle }}
|
|
62
|
+
/>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
ChatInputTextarea.displayName = 'ChatInputTextarea'
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import React, { forwardRef, useCallback } from 'react'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
import { cva } from 'class-variance-authority'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
import { SendButton } from '../send-button'
|
|
6
|
+
import { IconButton } from '../../basic/icon-button'
|
|
7
|
+
import { MoreLine } from '../../basic/icons-inline'
|
|
8
|
+
import { GenerationStatusBar } from '../generation-status-bar'
|
|
9
|
+
import { ChatInputTextarea } from './chat-input-textarea'
|
|
10
|
+
import { ChatInputFolderSelector } from './chat-input-folder-selector'
|
|
11
|
+
import { ChatInputModelSwitcher } from './chat-input-model-switcher'
|
|
12
|
+
import { useChatInputContext } from './context'
|
|
13
|
+
|
|
14
|
+
const chatInputContainerVariants = cva(
|
|
15
|
+
[
|
|
16
|
+
'flex flex-col w-full bg-bg-base border border-primary-border rounded-xl transition-all duration-200',
|
|
17
|
+
/* 参考 Claude 输入框:2 级阴影默认,4 级 focus,使用本项目 1~4 级 shadow token */
|
|
18
|
+
'shadow-[0_0.25rem_1.25rem_var(--color-shadow-secondary)]',
|
|
19
|
+
'hover:shadow-[0_0.25rem_1.25rem_var(--color-shadow-secondary)]',
|
|
20
|
+
'focus-within:shadow-[0_0.25rem_1.25rem_var(--color-shadow-quaternary)]',
|
|
21
|
+
'hover:focus-within:shadow-[0_0.25rem_1.25rem_var(--color-shadow-quaternary)]',
|
|
22
|
+
].join(' '),
|
|
23
|
+
{
|
|
24
|
+
variants: { disabled: { true: 'opacity-50 cursor-not-allowed', false: '' } },
|
|
25
|
+
defaultVariants: { disabled: false },
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
// Box 使用 rounded-xl (= --radius-xl)
|
|
29
|
+
|
|
30
|
+
const attachmentRowStyles = 'flex flex-wrap items-center gap-2 px-3 pt-3 pb-2'
|
|
31
|
+
const contentStyles = 'flex flex-1 items-center min-h-6 p-3'
|
|
32
|
+
const footerStyles = 'flex shrink-0 items-center justify-between w-full self-stretch gap-2 p-3'
|
|
33
|
+
|
|
34
|
+
// ----- 框外 -----
|
|
35
|
+
// Above 高度 = 主题下 md 按钮高度(h-9),文字 text-sm;宽度 = Box 宽度 - 2*圆角,居中;无水平 padding
|
|
36
|
+
export interface ChatInputAboveProps {
|
|
37
|
+
className?: string
|
|
38
|
+
style?: React.CSSProperties
|
|
39
|
+
children?: ReactNode
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function ChatInputAbove({ className, style, children }: ChatInputAboveProps) {
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
className={cn(
|
|
46
|
+
'flex min-h-9 h-9 w-[calc(100%-2*var(--radius-xl))] mx-auto items-center overflow-hidden rounded-t-xl text-sm leading-sm',
|
|
47
|
+
className
|
|
48
|
+
)}
|
|
49
|
+
style={style}
|
|
50
|
+
>
|
|
51
|
+
{children}
|
|
52
|
+
</div>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
ChatInputAbove.displayName = 'ChatInputAbove'
|
|
56
|
+
|
|
57
|
+
// ----- 框容器 -----
|
|
58
|
+
export interface ChatInputBoxProps {
|
|
59
|
+
className?: string
|
|
60
|
+
children?: ReactNode
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function ChatInputBox({ className, children }: ChatInputBoxProps) {
|
|
64
|
+
const ctx = useChatInputContext()
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
className={chatInputContainerVariants({
|
|
68
|
+
disabled: ctx.disabled,
|
|
69
|
+
className: cn('relative', className),
|
|
70
|
+
})}
|
|
71
|
+
>
|
|
72
|
+
{children}
|
|
73
|
+
</div>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
ChatInputBox.displayName = 'ChatInputBox'
|
|
77
|
+
|
|
78
|
+
// ----- 框内·第一层 附件区 -----
|
|
79
|
+
export interface ChatInputAttachmentsProps {
|
|
80
|
+
className?: string
|
|
81
|
+
children?: ReactNode
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function ChatInputAttachments({ className, children }: ChatInputAttachmentsProps) {
|
|
85
|
+
if (!children) return null
|
|
86
|
+
return <div className={cn(attachmentRowStyles, className)}>{children}</div>
|
|
87
|
+
}
|
|
88
|
+
ChatInputAttachments.displayName = 'ChatInputAttachments'
|
|
89
|
+
|
|
90
|
+
// ----- 框内·第二层 输入区 -----
|
|
91
|
+
export interface ChatInputInputProps extends Omit<React.ComponentProps<typeof ChatInputTextarea>, 'value' | 'onChange' | 'onKeyDown'> {
|
|
92
|
+
placeholder?: string
|
|
93
|
+
maxRows?: number
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const ChatInputInput = forwardRef<HTMLTextAreaElement, ChatInputInputProps>(
|
|
97
|
+
({ placeholder = 'What can I help you with today?', maxRows = 6, ...props }, ref) => {
|
|
98
|
+
const ctx = useChatInputContext()
|
|
99
|
+
const setRef = useCallback(
|
|
100
|
+
(node: HTMLTextAreaElement | null) => {
|
|
101
|
+
ctx.setTextareaRef(node)
|
|
102
|
+
if (typeof ref === 'function') ref(node)
|
|
103
|
+
else if (ref) (ref as React.MutableRefObject<HTMLTextAreaElement | null>).current = node
|
|
104
|
+
},
|
|
105
|
+
[ctx, ref]
|
|
106
|
+
)
|
|
107
|
+
return (
|
|
108
|
+
<div className={contentStyles}>
|
|
109
|
+
<ChatInputTextarea
|
|
110
|
+
ref={setRef}
|
|
111
|
+
value={ctx.value}
|
|
112
|
+
onChange={ctx.onChange}
|
|
113
|
+
onKeyDown={ctx.handleKeyDown}
|
|
114
|
+
placeholder={placeholder}
|
|
115
|
+
disabled={ctx.disabled}
|
|
116
|
+
maxRows={maxRows}
|
|
117
|
+
{...props}
|
|
118
|
+
/>
|
|
119
|
+
</div>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
ChatInputInput.displayName = 'ChatInputInput'
|
|
124
|
+
|
|
125
|
+
// ----- 框内·第三层 操作区 -----
|
|
126
|
+
export interface ChatInputActionsProps {
|
|
127
|
+
className?: string
|
|
128
|
+
children?: ReactNode
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function ChatInputActions({ className, children }: ChatInputActionsProps) {
|
|
132
|
+
return <div className={cn(footerStyles, className)}>{children}</div>
|
|
133
|
+
}
|
|
134
|
+
ChatInputActions.displayName = 'ChatInputActions'
|
|
135
|
+
|
|
136
|
+
export interface ChatInputActionsLeftProps {
|
|
137
|
+
className?: string
|
|
138
|
+
children?: ReactNode
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function ChatInputActionsLeft({ className, children }: ChatInputActionsLeftProps) {
|
|
142
|
+
return <div className={cn('flex items-center gap-2', className)}>{children}</div>
|
|
143
|
+
}
|
|
144
|
+
ChatInputActionsLeft.displayName = 'ChatInputActionsLeft'
|
|
145
|
+
|
|
146
|
+
export interface ChatInputActionsRightProps {
|
|
147
|
+
className?: string
|
|
148
|
+
children?: ReactNode
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function ChatInputActionsRight({ className, children }: ChatInputActionsRightProps) {
|
|
152
|
+
return <div className={cn('flex items-center gap-2', className)}>{children}</div>
|
|
153
|
+
}
|
|
154
|
+
ChatInputActionsRight.displayName = 'ChatInputActionsRight'
|
|
155
|
+
|
|
156
|
+
// ----- 固定·框内右上角放大按钮 -----
|
|
157
|
+
export interface ChatInputExpandButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
158
|
+
children?: ReactNode
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function ChatInputExpandButton({ className, style, ...props }: ChatInputExpandButtonProps) {
|
|
162
|
+
return (
|
|
163
|
+
<button
|
|
164
|
+
type="button"
|
|
165
|
+
className={cn(
|
|
166
|
+
'absolute top-2 right-2 z-10 flex h-8 w-8 items-center justify-center rounded-lg text-text-secondary hover:bg-fill-secondary hover:text-text focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50',
|
|
167
|
+
className
|
|
168
|
+
)}
|
|
169
|
+
style={{ ...style }}
|
|
170
|
+
{...props}
|
|
171
|
+
/>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
ChatInputExpandButton.displayName = 'ChatInputExpandButton'
|
|
175
|
+
|
|
176
|
+
// ----- 操作区子组件(从 Context 消费) -----
|
|
177
|
+
export function ChatInputFolderButton() {
|
|
178
|
+
const ctx = useChatInputContext()
|
|
179
|
+
if (!ctx.showFolderButton) return null
|
|
180
|
+
return (
|
|
181
|
+
<ChatInputFolderSelector
|
|
182
|
+
disabled={ctx.disabled}
|
|
183
|
+
folderButtonLabel={ctx.folderButtonLabel}
|
|
184
|
+
folderPermission={ctx.folderPermission}
|
|
185
|
+
onFolderButtonClick={ctx.onFolderButtonClick}
|
|
186
|
+
onFolderClear={ctx.handleFolderClear}
|
|
187
|
+
onFolderSelect={ctx.handleFolderSelect}
|
|
188
|
+
hasFolderSelected={ctx.hasFolderSelected}
|
|
189
|
+
dataStyle={ctx.dataStyle}
|
|
190
|
+
dataTheme={ctx.dataTheme}
|
|
191
|
+
folderIcon={ctx.folderIcon}
|
|
192
|
+
folderOpenIcon={ctx.folderOpenIcon}
|
|
193
|
+
historyIcon={ctx.historyIcon}
|
|
194
|
+
subMenuArrowIcon={ctx.subMenuArrowIcon}
|
|
195
|
+
folderFillIcon={ctx.folderFillIcon}
|
|
196
|
+
closeIcon={ctx.closeIcon}
|
|
197
|
+
/>
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
ChatInputFolderButton.displayName = 'ChatInputFolderButton'
|
|
201
|
+
|
|
202
|
+
export function ChatInputMoreButton() {
|
|
203
|
+
const ctx = useChatInputContext()
|
|
204
|
+
if (!ctx.showMoreButton) return null
|
|
205
|
+
return (
|
|
206
|
+
<IconButton
|
|
207
|
+
variant="ghost"
|
|
208
|
+
icon={ctx.addLargeIcon ?? <MoreLine className="h-5 w-5" />}
|
|
209
|
+
onClick={ctx.onMoreButtonClick}
|
|
210
|
+
disabled={ctx.disabled}
|
|
211
|
+
/>
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
ChatInputMoreButton.displayName = 'ChatInputMoreButton'
|
|
215
|
+
|
|
216
|
+
// 使用 chat 内共用的 SendButton,仅从 Context 注入 disabled/status/onClick|form
|
|
217
|
+
export function ChatInputSendButton() {
|
|
218
|
+
const ctx = useChatInputContext()
|
|
219
|
+
return (
|
|
220
|
+
<SendButton
|
|
221
|
+
disabled={!ctx.canSend || ctx.disabled}
|
|
222
|
+
status={ctx.sendButtonStatus}
|
|
223
|
+
{...(ctx.form ? { type: 'submit' as const, form: ctx.form } : { onClick: ctx.handleSend })}
|
|
224
|
+
/>
|
|
225
|
+
)
|
|
226
|
+
}
|
|
227
|
+
ChatInputSendButton.displayName = 'ChatInputSendButton'
|
|
228
|
+
|
|
229
|
+
// 左侧操作区默认内容:有 footerLeftConfig 时渲染模式/模型切换,否则渲染 FolderButton + MoreButton
|
|
230
|
+
export function ChatInputFooterLeft() {
|
|
231
|
+
const ctx = useChatInputContext()
|
|
232
|
+
if (ctx.footerLeftConfig) {
|
|
233
|
+
return (
|
|
234
|
+
<ChatInputModelSwitcher
|
|
235
|
+
config={ctx.footerLeftConfig}
|
|
236
|
+
disabled={ctx.disabled}
|
|
237
|
+
arrowDownIcon={ctx.arrowDownIcon}
|
|
238
|
+
dataStyle={ctx.dataStyle}
|
|
239
|
+
dataTheme={ctx.dataTheme}
|
|
240
|
+
/>
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
return (
|
|
244
|
+
<>
|
|
245
|
+
<ChatInputFolderButton />
|
|
246
|
+
<ChatInputMoreButton />
|
|
247
|
+
</>
|
|
248
|
+
)
|
|
249
|
+
}
|
|
250
|
+
ChatInputFooterLeft.displayName = 'ChatInputFooterLeft'
|
|
251
|
+
|
|
252
|
+
// ----- 默认布局(ChatInput 便捷导出使用) -----
|
|
253
|
+
export interface ChatInputDefaultLayoutProps {
|
|
254
|
+
className?: string
|
|
255
|
+
hasAbove?: boolean
|
|
256
|
+
hasAttachments?: boolean
|
|
257
|
+
hasFooter?: boolean
|
|
258
|
+
aboveOverlap?: boolean
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export const ChatInputDefaultLayout = forwardRef<HTMLTextAreaElement, ChatInputDefaultLayoutProps>(
|
|
262
|
+
function ChatInputDefaultLayout(
|
|
263
|
+
{ className, hasAbove = false, hasAttachments = false, hasFooter = true, aboveOverlap = true },
|
|
264
|
+
ref
|
|
265
|
+
) {
|
|
266
|
+
const ctx = useChatInputContext()
|
|
267
|
+
|
|
268
|
+
const renderAttachments = () => {
|
|
269
|
+
if (!hasAttachments || ctx.attachments == null || ctx.attachments === false) return null
|
|
270
|
+
const att = ctx.attachments
|
|
271
|
+
if (typeof att === 'object' && !React.isValidElement(att) && ('files' in att || 'images' in att)) {
|
|
272
|
+
return (
|
|
273
|
+
<>
|
|
274
|
+
{(att as { files?: ReactNode }).files && (
|
|
275
|
+
<div className={attachmentRowStyles}>{(att as { files?: ReactNode }).files}</div>
|
|
276
|
+
)}
|
|
277
|
+
{(att as { images?: ReactNode }).images && (
|
|
278
|
+
<div className={attachmentRowStyles}>{(att as { images?: ReactNode }).images}</div>
|
|
279
|
+
)}
|
|
280
|
+
</>
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
return <div className={attachmentRowStyles}>{att as ReactNode}</div>
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const renderFooterLeft = () => <ChatInputFooterLeft />
|
|
287
|
+
|
|
288
|
+
const boxContent = (
|
|
289
|
+
<ChatInputBox className={cn(!hasFooter && !hasAttachments && 'min-h-14')}>
|
|
290
|
+
{renderAttachments()}
|
|
291
|
+
<ChatInputInput ref={ref} />
|
|
292
|
+
{/* 始终保留操作区右侧 SendButton:hasFooter 时显示完整 footer,否则仅显示右侧发送按钮(Minimal 模式) */}
|
|
293
|
+
<ChatInputActions>
|
|
294
|
+
{hasFooter ? (
|
|
295
|
+
<>
|
|
296
|
+
<ChatInputActionsLeft>{renderFooterLeft()}</ChatInputActionsLeft>
|
|
297
|
+
<div className="flex-1 h-5" />
|
|
298
|
+
<ChatInputActionsRight>
|
|
299
|
+
<ChatInputSendButton />
|
|
300
|
+
</ChatInputActionsRight>
|
|
301
|
+
</>
|
|
302
|
+
) : (
|
|
303
|
+
<>
|
|
304
|
+
<div className="flex-1 h-5" />
|
|
305
|
+
<ChatInputActionsRight>
|
|
306
|
+
<ChatInputSendButton />
|
|
307
|
+
</ChatInputActionsRight>
|
|
308
|
+
</>
|
|
309
|
+
)}
|
|
310
|
+
</ChatInputActions>
|
|
311
|
+
</ChatInputBox>
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
if (hasAbove && ctx.showGenerationStatus && ctx.generationStatus) {
|
|
315
|
+
return (
|
|
316
|
+
<div className={cn('flex flex-col w-full', className)}>
|
|
317
|
+
<ChatInputAbove>
|
|
318
|
+
<GenerationStatusBar
|
|
319
|
+
status={typeof ctx.generationStatus?.content === 'string' ? ctx.generationStatus.content : undefined}
|
|
320
|
+
icon={ctx.generationStatus?.icon}
|
|
321
|
+
time={ctx.generationStatus?.time}
|
|
322
|
+
>
|
|
323
|
+
{ctx.generationStatus?.content}
|
|
324
|
+
</GenerationStatusBar>
|
|
325
|
+
</ChatInputAbove>
|
|
326
|
+
{boxContent}
|
|
327
|
+
</div>
|
|
328
|
+
)
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return <div className={className}>{boxContent}</div>
|
|
332
|
+
}
|
|
333
|
+
)
|
|
334
|
+
ChatInputDefaultLayout.displayName = 'ChatInputDefaultLayout'
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import React, { createContext, useContext, useCallback, useRef, useState } from 'react'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
import type { ChatInputProps, FolderPermissionConfig, GenerationStatusConfig, FooterLeftModelSwitchConfig } from './types'
|
|
4
|
+
|
|
5
|
+
export interface ChatInputContextValue {
|
|
6
|
+
// Portal 主题透传(供 DropdownMenuContent/SubContent 等弹层继承)
|
|
7
|
+
dataStyle?: string
|
|
8
|
+
dataTheme?: string
|
|
9
|
+
// 输入与发送
|
|
10
|
+
value: string
|
|
11
|
+
onChange: (value: string) => void
|
|
12
|
+
onSend?: (value: string) => void
|
|
13
|
+
disabled: boolean
|
|
14
|
+
form?: string
|
|
15
|
+
textareaRef: React.RefObject<HTMLTextAreaElement | null>
|
|
16
|
+
setTextareaRef: (node: HTMLTextAreaElement | null) => void
|
|
17
|
+
handleSend: () => void
|
|
18
|
+
handleKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void
|
|
19
|
+
sendButtonStatus: 'normal' | 'generating'
|
|
20
|
+
canSend: boolean
|
|
21
|
+
// 文件夹 / 更多 / 模式切换(默认操作区左侧)
|
|
22
|
+
hasFolderSelected: boolean
|
|
23
|
+
setHasFolderSelected: (v: boolean) => void
|
|
24
|
+
handleFolderSelect: (files: FileList) => void
|
|
25
|
+
handleFolderClear: () => void
|
|
26
|
+
folderPermission?: FolderPermissionConfig
|
|
27
|
+
footerLeftConfig?: FooterLeftModelSwitchConfig
|
|
28
|
+
showFolderButton: boolean
|
|
29
|
+
showMoreButton: boolean
|
|
30
|
+
folderButtonLabel: string
|
|
31
|
+
onFolderButtonClick?: () => void
|
|
32
|
+
onFolderClear?: () => void
|
|
33
|
+
onMoreButtonClick?: () => void
|
|
34
|
+
addLargeIcon?: ReactNode
|
|
35
|
+
folderIcon?: ReactNode
|
|
36
|
+
folderOpenIcon?: ReactNode
|
|
37
|
+
historyIcon?: ReactNode
|
|
38
|
+
arrowDownIcon?: ReactNode
|
|
39
|
+
subMenuArrowIcon?: ReactNode
|
|
40
|
+
folderFillIcon?: ReactNode
|
|
41
|
+
closeIcon?: ReactNode
|
|
42
|
+
// 框外 / 框内显隐(默认布局用)
|
|
43
|
+
showGenerationStatus?: boolean
|
|
44
|
+
generationStatus?: GenerationStatusConfig
|
|
45
|
+
attachments?: { files?: ReactNode; images?: ReactNode } | ReactNode
|
|
46
|
+
showFooter?: boolean
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const ChatInputContext = createContext<ChatInputContextValue | null>(null)
|
|
50
|
+
|
|
51
|
+
export function useChatInputContext() {
|
|
52
|
+
const ctx = useContext(ChatInputContext)
|
|
53
|
+
if (!ctx) throw new Error('ChatInput compound components must be used within ChatInput.Root')
|
|
54
|
+
return ctx
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type ChatInputRootProps = ChatInputProps & { children?: ReactNode }
|
|
58
|
+
|
|
59
|
+
export function ChatInputRootProvider({
|
|
60
|
+
value: controlledValue,
|
|
61
|
+
onChange,
|
|
62
|
+
onSend,
|
|
63
|
+
placeholder = 'What can I help you with today?',
|
|
64
|
+
disabled = false,
|
|
65
|
+
maxRows = 6,
|
|
66
|
+
form,
|
|
67
|
+
sendButtonStatus = 'normal',
|
|
68
|
+
showFooter = true,
|
|
69
|
+
showFolderButton = true,
|
|
70
|
+
folderButtonLabel = 'Work in a Folder',
|
|
71
|
+
onFolderButtonClick,
|
|
72
|
+
onFolderClear,
|
|
73
|
+
folderPermission,
|
|
74
|
+
showMoreButton = true,
|
|
75
|
+
onMoreButtonClick,
|
|
76
|
+
footerLeftConfig,
|
|
77
|
+
showGenerationStatus = false,
|
|
78
|
+
generationStatus,
|
|
79
|
+
attachments,
|
|
80
|
+
addLargeIcon,
|
|
81
|
+
folderIcon,
|
|
82
|
+
folderOpenIcon,
|
|
83
|
+
historyIcon,
|
|
84
|
+
arrowDownIcon,
|
|
85
|
+
subMenuArrowIcon,
|
|
86
|
+
folderFillIcon,
|
|
87
|
+
closeIcon,
|
|
88
|
+
dataStyle,
|
|
89
|
+
dataTheme,
|
|
90
|
+
className,
|
|
91
|
+
children,
|
|
92
|
+
...rest
|
|
93
|
+
}: ChatInputRootProps) {
|
|
94
|
+
const [internalValue, setInternalValue] = useState('')
|
|
95
|
+
const textareaRef = useRef<HTMLTextAreaElement | null>(null)
|
|
96
|
+
const [hasFolderSelected, setHasFolderSelected] = useState(false)
|
|
97
|
+
const isControlled = controlledValue !== undefined
|
|
98
|
+
const value = isControlled ? controlledValue : internalValue
|
|
99
|
+
|
|
100
|
+
const setTextareaRef = useCallback((node: HTMLTextAreaElement | null) => {
|
|
101
|
+
(textareaRef as React.MutableRefObject<HTMLTextAreaElement | null>).current = node
|
|
102
|
+
}, [])
|
|
103
|
+
|
|
104
|
+
const handleChange = useCallback(
|
|
105
|
+
(v: string) => {
|
|
106
|
+
if (!isControlled) setInternalValue(v)
|
|
107
|
+
onChange?.(v)
|
|
108
|
+
},
|
|
109
|
+
[isControlled, onChange]
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
const handleSend = useCallback(() => {
|
|
113
|
+
const raw = textareaRef.current?.value ?? value
|
|
114
|
+
const trimmed = (raw ?? '').trim()
|
|
115
|
+
if (!trimmed || disabled || !onSend) return
|
|
116
|
+
onSend(trimmed)
|
|
117
|
+
if (!isControlled) setInternalValue('')
|
|
118
|
+
if (textareaRef.current) textareaRef.current.style.height = 'auto'
|
|
119
|
+
}, [value, disabled, onSend, isControlled])
|
|
120
|
+
|
|
121
|
+
const handleKeyDown = useCallback(
|
|
122
|
+
(e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
|
123
|
+
if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
|
|
124
|
+
e.preventDefault()
|
|
125
|
+
handleSend()
|
|
126
|
+
}
|
|
127
|
+
rest.onKeyDown?.(e)
|
|
128
|
+
},
|
|
129
|
+
[handleSend, rest]
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
const handleFolderSelect = useCallback(() => setHasFolderSelected(true), [])
|
|
133
|
+
const handleFolderClear = useCallback(() => {
|
|
134
|
+
setHasFolderSelected(false)
|
|
135
|
+
onFolderClear?.()
|
|
136
|
+
}, [onFolderClear])
|
|
137
|
+
|
|
138
|
+
const canSend = value.trim().length > 0 && !disabled
|
|
139
|
+
|
|
140
|
+
const ctxValue: ChatInputContextValue = {
|
|
141
|
+
dataStyle,
|
|
142
|
+
dataTheme,
|
|
143
|
+
value,
|
|
144
|
+
onChange: handleChange,
|
|
145
|
+
onSend,
|
|
146
|
+
disabled,
|
|
147
|
+
form,
|
|
148
|
+
textareaRef,
|
|
149
|
+
setTextareaRef,
|
|
150
|
+
handleSend,
|
|
151
|
+
handleKeyDown,
|
|
152
|
+
sendButtonStatus,
|
|
153
|
+
canSend,
|
|
154
|
+
hasFolderSelected,
|
|
155
|
+
setHasFolderSelected,
|
|
156
|
+
handleFolderSelect,
|
|
157
|
+
handleFolderClear,
|
|
158
|
+
folderPermission,
|
|
159
|
+
footerLeftConfig,
|
|
160
|
+
showFolderButton,
|
|
161
|
+
showMoreButton,
|
|
162
|
+
folderButtonLabel,
|
|
163
|
+
onFolderButtonClick,
|
|
164
|
+
onFolderClear,
|
|
165
|
+
onMoreButtonClick,
|
|
166
|
+
addLargeIcon,
|
|
167
|
+
folderIcon,
|
|
168
|
+
folderOpenIcon,
|
|
169
|
+
historyIcon,
|
|
170
|
+
arrowDownIcon,
|
|
171
|
+
subMenuArrowIcon,
|
|
172
|
+
folderFillIcon,
|
|
173
|
+
closeIcon,
|
|
174
|
+
showGenerationStatus,
|
|
175
|
+
generationStatus,
|
|
176
|
+
attachments,
|
|
177
|
+
showFooter,
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<ChatInputContext.Provider value={ctxValue}>
|
|
182
|
+
{children}
|
|
183
|
+
</ChatInputContext.Provider>
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
ChatInputRootProvider.displayName = 'ChatInputRootProvider'
|
|
188
|
+
|
|
189
|
+
export { ChatInputContext }
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AlertDialog,
|
|
3
|
+
AlertDialogContent,
|
|
4
|
+
AlertDialogHeader,
|
|
5
|
+
AlertDialogTitle,
|
|
6
|
+
AlertDialogDescription,
|
|
7
|
+
AlertDialogFooter,
|
|
8
|
+
AlertDialogCancel,
|
|
9
|
+
} from '../../basic/alert-dialog'
|
|
10
|
+
|
|
11
|
+
export interface FolderPermissionDialogProps {
|
|
12
|
+
open: boolean
|
|
13
|
+
onOpenChange: (open: boolean) => void
|
|
14
|
+
projectName: string
|
|
15
|
+
onAllowOnce: () => void
|
|
16
|
+
onAllowAlways: () => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function FolderPermissionDialog({
|
|
20
|
+
open,
|
|
21
|
+
onOpenChange,
|
|
22
|
+
projectName,
|
|
23
|
+
onAllowOnce,
|
|
24
|
+
onAllowAlways,
|
|
25
|
+
}: FolderPermissionDialogProps) {
|
|
26
|
+
return (
|
|
27
|
+
<AlertDialog open={open} onOpenChange={onOpenChange}>
|
|
28
|
+
<AlertDialogContent className="p-6">
|
|
29
|
+
<AlertDialogHeader>
|
|
30
|
+
<AlertDialogTitle className="text-xl leading-xl font-semibold text-text">
|
|
31
|
+
Allow Qoder Work to access and modify files in "{projectName}"?
|
|
32
|
+
</AlertDialogTitle>
|
|
33
|
+
<AlertDialogDescription className="mt-2 text-sm leading-sm text-text-tertiary">
|
|
34
|
+
This permission applies to all files and subfolders in this directory. Qoder Work may read, update, and
|
|
35
|
+
permanently delete files here, and may share relevant file contents with connected tools when needed.
|
|
36
|
+
Only allow access to folders you trust.
|
|
37
|
+
</AlertDialogDescription>
|
|
38
|
+
</AlertDialogHeader>
|
|
39
|
+
<AlertDialogFooter className="mt-6 flex flex-row justify-end gap-2">
|
|
40
|
+
<AlertDialogCancel className="h-9 rounded-full px-4">Cancel</AlertDialogCancel>
|
|
41
|
+
<button
|
|
42
|
+
type="button"
|
|
43
|
+
className="inline-flex h-9 items-center justify-center rounded-full px-4 text-sm leading-sm font-medium border border-border bg-bg-base text-text transition-colors hover:bg-fill-tertiary active:bg-fill-secondary"
|
|
44
|
+
onClick={onAllowAlways}
|
|
45
|
+
>
|
|
46
|
+
Always Allow
|
|
47
|
+
</button>
|
|
48
|
+
<button
|
|
49
|
+
type="button"
|
|
50
|
+
className="inline-flex h-9 items-center justify-center rounded-full px-4 text-sm leading-sm font-medium bg-text text-text-on-primary transition-opacity hover:opacity-90 active:opacity-95"
|
|
51
|
+
onClick={onAllowOnce}
|
|
52
|
+
>
|
|
53
|
+
Allow
|
|
54
|
+
</button>
|
|
55
|
+
</AlertDialogFooter>
|
|
56
|
+
</AlertDialogContent>
|
|
57
|
+
</AlertDialog>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
FolderPermissionDialog.displayName = 'FolderPermissionDialog'
|