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,201 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { cn } from '@/lib/utils'
|
|
3
|
+
import { Scrollbar } from './scrollbar'
|
|
4
|
+
|
|
5
|
+
export type TypographyH1Props = React.ComponentProps<'h1'>
|
|
6
|
+
function TypographyH1({ className, ...props }: TypographyH1Props) {
|
|
7
|
+
return (
|
|
8
|
+
<h1
|
|
9
|
+
className={cn(
|
|
10
|
+
'font-sans scroll-m-20 text-4xl font-extrabold tracking-tight text-balance text-text',
|
|
11
|
+
className
|
|
12
|
+
)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
TypographyH1.displayName = 'TypographyH1'
|
|
18
|
+
|
|
19
|
+
export type TypographyH2Props = React.ComponentProps<'h2'>
|
|
20
|
+
function TypographyH2({ className, ...props }: TypographyH2Props) {
|
|
21
|
+
return (
|
|
22
|
+
<h2
|
|
23
|
+
className={cn(
|
|
24
|
+
'font-sans scroll-m-20 border-b border-border-tertiary pb-2 text-3xl font-semibold tracking-tight first:mt-0 text-text',
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
TypographyH2.displayName = 'TypographyH2'
|
|
32
|
+
|
|
33
|
+
export type TypographyH3Props = React.ComponentProps<'h3'>
|
|
34
|
+
function TypographyH3({ className, ...props }: TypographyH3Props) {
|
|
35
|
+
return (
|
|
36
|
+
<h3
|
|
37
|
+
className={cn(
|
|
38
|
+
'font-sans scroll-m-20 text-2xl font-semibold tracking-tight text-text',
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
TypographyH3.displayName = 'TypographyH3'
|
|
46
|
+
|
|
47
|
+
export type TypographyH4Props = React.ComponentProps<'h4'>
|
|
48
|
+
function TypographyH4({ className, ...props }: TypographyH4Props) {
|
|
49
|
+
return (
|
|
50
|
+
<h4
|
|
51
|
+
className={cn(
|
|
52
|
+
'font-sans scroll-m-20 text-xl font-semibold tracking-tight text-text',
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
TypographyH4.displayName = 'TypographyH4'
|
|
60
|
+
|
|
61
|
+
export type TypographyPProps = React.ComponentProps<'p'>
|
|
62
|
+
function TypographyP({ className, ...props }: TypographyPProps) {
|
|
63
|
+
return (
|
|
64
|
+
<p
|
|
65
|
+
className={cn(
|
|
66
|
+
'font-sans leading-7 text-text [&:not(:first-child)]:mt-6',
|
|
67
|
+
className
|
|
68
|
+
)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
TypographyP.displayName = 'TypographyP'
|
|
74
|
+
|
|
75
|
+
export type TypographyBlockquoteProps = React.ComponentProps<'blockquote'>
|
|
76
|
+
function TypographyBlockquote({ className, ...props }: TypographyBlockquoteProps) {
|
|
77
|
+
return (
|
|
78
|
+
<blockquote
|
|
79
|
+
className={cn(
|
|
80
|
+
'font-sans mt-6 border-l-2 border-border-tertiary pl-6 italic text-text-secondary',
|
|
81
|
+
className
|
|
82
|
+
)}
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
TypographyBlockquote.displayName = 'TypographyBlockquote'
|
|
88
|
+
|
|
89
|
+
export type TypographyTableProps = React.ComponentProps<'div'>
|
|
90
|
+
function TypographyTable({ className, children, ..._rest }: TypographyTableProps) {
|
|
91
|
+
void _rest
|
|
92
|
+
return (
|
|
93
|
+
<Scrollbar
|
|
94
|
+
scrollbarVisibility="auto"
|
|
95
|
+
className={cn('font-sans my-6 w-full', className)}
|
|
96
|
+
>
|
|
97
|
+
{children}
|
|
98
|
+
</Scrollbar>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
TypographyTable.displayName = 'TypographyTable'
|
|
102
|
+
|
|
103
|
+
export type TypographyListProps = React.ComponentProps<'ul'>
|
|
104
|
+
function TypographyList({ className, ...props }: TypographyListProps) {
|
|
105
|
+
return (
|
|
106
|
+
<ul
|
|
107
|
+
className={cn(
|
|
108
|
+
'font-sans my-6 ml-6 list-disc text-text [&>li]:mt-2',
|
|
109
|
+
className
|
|
110
|
+
)}
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
TypographyList.displayName = 'TypographyList'
|
|
116
|
+
|
|
117
|
+
export type TypographyInlineCodeProps = React.ComponentProps<'code'>
|
|
118
|
+
function TypographyInlineCode({ className, ...props }: TypographyInlineCodeProps) {
|
|
119
|
+
return (
|
|
120
|
+
<code
|
|
121
|
+
className={cn(
|
|
122
|
+
'relative rounded bg-fill-secondary px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold text-text',
|
|
123
|
+
className
|
|
124
|
+
)}
|
|
125
|
+
{...props}
|
|
126
|
+
/>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
TypographyInlineCode.displayName = 'TypographyInlineCode'
|
|
130
|
+
|
|
131
|
+
export type TypographyLeadProps = React.ComponentProps<'p'>
|
|
132
|
+
function TypographyLead({ className, ...props }: TypographyLeadProps) {
|
|
133
|
+
return (
|
|
134
|
+
<p
|
|
135
|
+
className={cn(
|
|
136
|
+
'font-sans text-xl text-muted-foreground',
|
|
137
|
+
className
|
|
138
|
+
)}
|
|
139
|
+
{...props}
|
|
140
|
+
/>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
TypographyLead.displayName = 'TypographyLead'
|
|
144
|
+
|
|
145
|
+
export type TypographyLargeProps = React.ComponentProps<'div'>
|
|
146
|
+
function TypographyLarge({ className, ...props }: TypographyLargeProps) {
|
|
147
|
+
return (
|
|
148
|
+
<div
|
|
149
|
+
className={cn(
|
|
150
|
+
'font-sans text-lg font-semibold text-text',
|
|
151
|
+
className
|
|
152
|
+
)}
|
|
153
|
+
{...props}
|
|
154
|
+
/>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
TypographyLarge.displayName = 'TypographyLarge'
|
|
158
|
+
|
|
159
|
+
export type TypographySmallProps = React.ComponentProps<'small'>
|
|
160
|
+
function TypographySmall({ className, ...props }: TypographySmallProps) {
|
|
161
|
+
return (
|
|
162
|
+
<small
|
|
163
|
+
className={cn(
|
|
164
|
+
'font-sans text-sm font-medium leading-none text-text',
|
|
165
|
+
className
|
|
166
|
+
)}
|
|
167
|
+
{...props}
|
|
168
|
+
/>
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
TypographySmall.displayName = 'TypographySmall'
|
|
172
|
+
|
|
173
|
+
export type TypographyMutedProps = React.ComponentProps<'p'>
|
|
174
|
+
function TypographyMuted({ className, ...props }: TypographyMutedProps) {
|
|
175
|
+
return (
|
|
176
|
+
<p
|
|
177
|
+
className={cn(
|
|
178
|
+
'font-sans text-sm text-muted-foreground',
|
|
179
|
+
className
|
|
180
|
+
)}
|
|
181
|
+
{...props}
|
|
182
|
+
/>
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
TypographyMuted.displayName = 'TypographyMuted'
|
|
186
|
+
|
|
187
|
+
export {
|
|
188
|
+
TypographyH1,
|
|
189
|
+
TypographyH2,
|
|
190
|
+
TypographyH3,
|
|
191
|
+
TypographyH4,
|
|
192
|
+
TypographyP,
|
|
193
|
+
TypographyBlockquote,
|
|
194
|
+
TypographyTable,
|
|
195
|
+
TypographyList,
|
|
196
|
+
TypographyInlineCode,
|
|
197
|
+
TypographyLead,
|
|
198
|
+
TypographyLarge,
|
|
199
|
+
TypographySmall,
|
|
200
|
+
TypographyMuted,
|
|
201
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { useState, type ReactNode } from 'react'
|
|
2
|
+
import { CollapsibleCard } from '../basic/collapsible-card'
|
|
3
|
+
import { Button } from '../basic/button'
|
|
4
|
+
import {
|
|
5
|
+
Select,
|
|
6
|
+
SelectContent,
|
|
7
|
+
SelectItem,
|
|
8
|
+
SelectTrigger,
|
|
9
|
+
SelectValue,
|
|
10
|
+
} from '../basic/select'
|
|
11
|
+
import { GlobalLine, WarningLine, Forbid2Line } from '../basic/icons-inline'
|
|
12
|
+
|
|
13
|
+
const ICON_CLASS = 'w-[var(--font-size-sm)] h-[var(--font-size-sm)] shrink-0'
|
|
14
|
+
|
|
15
|
+
export type BrowserUseStatus = 'normal' | 'failed' | 'skipped'
|
|
16
|
+
|
|
17
|
+
export interface BrowserUsePartProps {
|
|
18
|
+
description?: string
|
|
19
|
+
content?: string
|
|
20
|
+
status?: BrowserUseStatus
|
|
21
|
+
onRun?: () => void
|
|
22
|
+
onSkip?: () => void
|
|
23
|
+
onViewDetail?: () => void
|
|
24
|
+
onAskEveryTimeChange?: (value: string) => void
|
|
25
|
+
className?: string
|
|
26
|
+
/** 供 Select 下拉浮层继承布局风格(如 dense),不传则从 document 读取 */
|
|
27
|
+
dataStyle?: string
|
|
28
|
+
/** 供 Select 下拉浮层继承颜色主题,不传则从 document 读取 */
|
|
29
|
+
dataTheme?: string
|
|
30
|
+
normalIcon?: ReactNode
|
|
31
|
+
failedIcon?: ReactNode
|
|
32
|
+
skippedIcon?: ReactNode
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const defaultNormalIcon = <GlobalLine className={`${ICON_CLASS} text-text-secondary`} />
|
|
36
|
+
const defaultFailedIcon = <WarningLine className={`${ICON_CLASS} text-warning`} />
|
|
37
|
+
const defaultSkippedIcon = <Forbid2Line className={`${ICON_CLASS} text-text-secondary`} />
|
|
38
|
+
|
|
39
|
+
function BrowserFooter({
|
|
40
|
+
askValue,
|
|
41
|
+
onAskChange,
|
|
42
|
+
onSkip,
|
|
43
|
+
onRun,
|
|
44
|
+
dataStyle,
|
|
45
|
+
dataTheme,
|
|
46
|
+
}: {
|
|
47
|
+
askValue: string
|
|
48
|
+
onAskChange: (value: string) => void
|
|
49
|
+
onSkip: () => void
|
|
50
|
+
onRun: () => void
|
|
51
|
+
dataStyle?: string
|
|
52
|
+
dataTheme?: string
|
|
53
|
+
}) {
|
|
54
|
+
return (
|
|
55
|
+
<div className="flex items-center gap-2 flex-1 min-w-0">
|
|
56
|
+
<div className="shrink-0 w-fit">
|
|
57
|
+
<Select value={askValue} onValueChange={onAskChange}>
|
|
58
|
+
<SelectTrigger
|
|
59
|
+
className="h-7 w-auto min-w-0 border-0 bg-transparent px-2 py-0 text-xs text-text-tertiary hover:text-text [&>svg]:w-[var(--font-size-sm)] [&>svg]:h-[var(--font-size-sm)]"
|
|
60
|
+
onClick={(e) => e.stopPropagation()}
|
|
61
|
+
>
|
|
62
|
+
<SelectValue />
|
|
63
|
+
</SelectTrigger>
|
|
64
|
+
<SelectContent
|
|
65
|
+
dataStyle={dataStyle}
|
|
66
|
+
dataTheme={dataTheme}
|
|
67
|
+
onClick={(e) => e.stopPropagation()}
|
|
68
|
+
>
|
|
69
|
+
<SelectItem value="Ask every time">Ask every time</SelectItem>
|
|
70
|
+
<SelectItem value="Always allow">Always allow</SelectItem>
|
|
71
|
+
<SelectItem value="Always deny">Always deny</SelectItem>
|
|
72
|
+
</SelectContent>
|
|
73
|
+
</Select>
|
|
74
|
+
</div>
|
|
75
|
+
<div className="flex-1 h-4 border-l border-border-tertiary opacity-10" />
|
|
76
|
+
<Button variant="ghost" size="sm" onClick={(e) => { e.stopPropagation(); onSkip() }}>
|
|
77
|
+
Skip ⌘⌫
|
|
78
|
+
</Button>
|
|
79
|
+
<Button variant="secondary" size="sm" onClick={(e) => { e.stopPropagation(); onRun() }}>
|
|
80
|
+
Run ⌘⏎
|
|
81
|
+
</Button>
|
|
82
|
+
</div>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function BrowserUsePart({
|
|
87
|
+
description,
|
|
88
|
+
content,
|
|
89
|
+
status = 'normal',
|
|
90
|
+
onRun,
|
|
91
|
+
onSkip,
|
|
92
|
+
onViewDetail,
|
|
93
|
+
onAskEveryTimeChange,
|
|
94
|
+
className,
|
|
95
|
+
dataStyle,
|
|
96
|
+
dataTheme,
|
|
97
|
+
normalIcon,
|
|
98
|
+
failedIcon,
|
|
99
|
+
skippedIcon,
|
|
100
|
+
}: BrowserUsePartProps) {
|
|
101
|
+
const [askValue, setAskValue] = useState('Ask every time')
|
|
102
|
+
|
|
103
|
+
const handleAskChange = (value: string) => {
|
|
104
|
+
setAskValue(value)
|
|
105
|
+
onAskEveryTimeChange?.(value)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const headerIcon =
|
|
109
|
+
status === 'failed'
|
|
110
|
+
? (failedIcon ?? defaultFailedIcon)
|
|
111
|
+
: status === 'skipped'
|
|
112
|
+
? (skippedIcon ?? defaultSkippedIcon)
|
|
113
|
+
: (normalIcon ?? defaultNormalIcon)
|
|
114
|
+
|
|
115
|
+
const headerTitle =
|
|
116
|
+
status === 'failed' ? (
|
|
117
|
+
<span>Browser Failed</span>
|
|
118
|
+
) : status === 'skipped' ? (
|
|
119
|
+
<span>Browser Skipped</span>
|
|
120
|
+
) : (
|
|
121
|
+
<div className="flex items-center gap-2 flex-1 min-w-0">
|
|
122
|
+
<span className="shrink-0">Browser</span>
|
|
123
|
+
{description != null && (
|
|
124
|
+
<span className="flex-1 min-w-0 truncate text-text-tertiary">{description}</span>
|
|
125
|
+
)}
|
|
126
|
+
</div>
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
const headerRight =
|
|
130
|
+
status === 'failed' ? (
|
|
131
|
+
<Button variant="text" size="sm" onClick={(e) => { e.stopPropagation(); onViewDetail?.() }}>
|
|
132
|
+
View Detail
|
|
133
|
+
</Button>
|
|
134
|
+
) : undefined
|
|
135
|
+
|
|
136
|
+
const footer =
|
|
137
|
+
status === 'normal' ? (
|
|
138
|
+
<BrowserFooter
|
|
139
|
+
askValue={askValue}
|
|
140
|
+
onAskChange={handleAskChange}
|
|
141
|
+
onSkip={() => onSkip?.()}
|
|
142
|
+
onRun={() => onRun?.()}
|
|
143
|
+
dataStyle={dataStyle}
|
|
144
|
+
dataTheme={dataTheme}
|
|
145
|
+
/>
|
|
146
|
+
) : undefined
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<CollapsibleCard
|
|
150
|
+
headerIcon={headerIcon}
|
|
151
|
+
headerTitle={headerTitle}
|
|
152
|
+
headerRight={headerRight}
|
|
153
|
+
contentPadding="var(--spacing-1\.5) var(--spacing-2)"
|
|
154
|
+
defaultExpanded={status === 'normal'}
|
|
155
|
+
collapsible={status === 'normal'}
|
|
156
|
+
footer={footer}
|
|
157
|
+
className={className}
|
|
158
|
+
>
|
|
159
|
+
{content != null && content !== '' && (
|
|
160
|
+
<span className="text-xs leading-xs text-text whitespace-pre-wrap break-words">{content}</span>
|
|
161
|
+
)}
|
|
162
|
+
</CollapsibleCard>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
BrowserUsePart.displayName = 'BrowserUsePart'
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { useState, useCallback, useRef } from 'react'
|
|
2
|
+
import { FolderButton } from '../folder-button'
|
|
3
|
+
import {
|
|
4
|
+
DropdownMenu,
|
|
5
|
+
DropdownMenuTrigger,
|
|
6
|
+
DropdownMenuContent,
|
|
7
|
+
DropdownMenuItem,
|
|
8
|
+
DropdownMenuSub,
|
|
9
|
+
DropdownMenuSubTrigger,
|
|
10
|
+
DropdownMenuSubContent,
|
|
11
|
+
} from '../../basic/dropdown-menu'
|
|
12
|
+
import { FolderPermissionDialog } from './folder-permission-dialog'
|
|
13
|
+
import { FolderLine, FolderFillLine, TimeLine } from '../../basic/icons-inline'
|
|
14
|
+
import type { FolderPermissionConfig, InputPropsWithWebkitDirectory } from './types'
|
|
15
|
+
|
|
16
|
+
const MOCK_HISTORY_FOLDERS = ['~/Projects/qoder-work-ui', '~/Documents/workspace', '~/Desktop/demo', '~/code/my-app']
|
|
17
|
+
|
|
18
|
+
const iconClass = 'mr-2 w-4 h-4 shrink-0'
|
|
19
|
+
|
|
20
|
+
export interface ChatInputFolderSelectorProps {
|
|
21
|
+
disabled: boolean
|
|
22
|
+
folderButtonLabel: string
|
|
23
|
+
folderPermission?: FolderPermissionConfig
|
|
24
|
+
onFolderButtonClick?: () => void
|
|
25
|
+
onFolderClear?: () => void
|
|
26
|
+
onFolderSelect: (files: FileList) => void
|
|
27
|
+
hasFolderSelected: boolean
|
|
28
|
+
dataStyle?: string
|
|
29
|
+
dataTheme?: string
|
|
30
|
+
folderIcon?: React.ReactNode
|
|
31
|
+
folderOpenIcon?: React.ReactNode
|
|
32
|
+
historyIcon?: React.ReactNode
|
|
33
|
+
subMenuArrowIcon?: React.ReactNode
|
|
34
|
+
folderFillIcon?: React.ReactNode
|
|
35
|
+
closeIcon?: React.ReactNode
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function ChatInputFolderSelector({
|
|
39
|
+
disabled,
|
|
40
|
+
folderButtonLabel,
|
|
41
|
+
folderPermission,
|
|
42
|
+
onFolderButtonClick,
|
|
43
|
+
onFolderClear,
|
|
44
|
+
onFolderSelect,
|
|
45
|
+
hasFolderSelected,
|
|
46
|
+
dataStyle,
|
|
47
|
+
dataTheme,
|
|
48
|
+
folderIcon = <FolderLine className={iconClass} />,
|
|
49
|
+
folderOpenIcon = <FolderFillLine className={iconClass} />,
|
|
50
|
+
historyIcon = <TimeLine className={iconClass} />,
|
|
51
|
+
subMenuArrowIcon,
|
|
52
|
+
folderFillIcon,
|
|
53
|
+
closeIcon,
|
|
54
|
+
}: ChatInputFolderSelectorProps) {
|
|
55
|
+
const enableFolderPermissionDialog = folderPermission?.enable ?? false
|
|
56
|
+
const folderPermissionProjectName = folderPermission?.projectName ?? '04_代码'
|
|
57
|
+
const [folderPermissionOpen, setFolderPermissionOpen] = useState(false)
|
|
58
|
+
const [folderPermissionAlwaysAllow, setFolderPermissionAlwaysAllow] = useState(false)
|
|
59
|
+
const [folderMenuOpen, setFolderMenuOpen] = useState(false)
|
|
60
|
+
const folderInputRef = useRef<HTMLInputElement>(null)
|
|
61
|
+
|
|
62
|
+
const handleFolderButtonClick = onFolderButtonClick ?? (() => {})
|
|
63
|
+
|
|
64
|
+
const openFolderPicker = () => {
|
|
65
|
+
folderInputRef.current?.click()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const handleFolderClear = () => {
|
|
69
|
+
if (folderInputRef.current) folderInputRef.current.value = ''
|
|
70
|
+
onFolderClear?.()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const requestFolderPermission = useCallback((mode: 'once' | 'always') => {
|
|
74
|
+
if (mode === 'always') setFolderPermissionAlwaysAllow(true)
|
|
75
|
+
setFolderPermissionOpen(false)
|
|
76
|
+
setFolderMenuOpen(true)
|
|
77
|
+
}, [])
|
|
78
|
+
|
|
79
|
+
const handleFolderMenuOpenChange = (next: boolean) => {
|
|
80
|
+
if (!enableFolderPermissionDialog) {
|
|
81
|
+
setFolderMenuOpen(next)
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
if (!next) {
|
|
85
|
+
setFolderMenuOpen(false)
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
if (folderPermissionAlwaysAllow) {
|
|
89
|
+
setFolderMenuOpen(true)
|
|
90
|
+
return
|
|
91
|
+
}
|
|
92
|
+
setFolderPermissionOpen(true)
|
|
93
|
+
setFolderMenuOpen(false)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const handleFolderInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
97
|
+
const files = e.target.files
|
|
98
|
+
if (files && files.length > 0) onFolderSelect(files)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (onFolderButtonClick) {
|
|
102
|
+
return (
|
|
103
|
+
<FolderButton
|
|
104
|
+
label={folderButtonLabel}
|
|
105
|
+
onClick={handleFolderButtonClick}
|
|
106
|
+
disabled={disabled}
|
|
107
|
+
folderIcon={folderIcon}
|
|
108
|
+
folderFillIcon={folderFillIcon}
|
|
109
|
+
/>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<>
|
|
115
|
+
<DropdownMenu open={folderMenuOpen} onOpenChange={handleFolderMenuOpenChange}>
|
|
116
|
+
<DropdownMenuTrigger asChild>
|
|
117
|
+
<FolderButton
|
|
118
|
+
label={folderButtonLabel}
|
|
119
|
+
disabled={disabled}
|
|
120
|
+
selected={hasFolderSelected}
|
|
121
|
+
onClear={handleFolderClear}
|
|
122
|
+
folderIcon={folderIcon}
|
|
123
|
+
folderFillIcon={folderFillIcon}
|
|
124
|
+
closeIcon={closeIcon}
|
|
125
|
+
className="focus:outline-none focus-visible:outline-none focus:ring-0 focus-visible:ring-0"
|
|
126
|
+
/>
|
|
127
|
+
</DropdownMenuTrigger>
|
|
128
|
+
<DropdownMenuContent
|
|
129
|
+
align="start"
|
|
130
|
+
side="top"
|
|
131
|
+
className="min-w-50"
|
|
132
|
+
dataStyle={dataStyle}
|
|
133
|
+
dataTheme={dataTheme}
|
|
134
|
+
>
|
|
135
|
+
<DropdownMenuItem onClick={openFolderPicker}>
|
|
136
|
+
{folderIcon}
|
|
137
|
+
Add folder
|
|
138
|
+
</DropdownMenuItem>
|
|
139
|
+
{hasFolderSelected && (
|
|
140
|
+
<DropdownMenuItem onClick={openFolderPicker}>
|
|
141
|
+
{folderOpenIcon}
|
|
142
|
+
Replace folder
|
|
143
|
+
</DropdownMenuItem>
|
|
144
|
+
)}
|
|
145
|
+
<DropdownMenuSub>
|
|
146
|
+
<DropdownMenuSubTrigger subTriggerIcon={subMenuArrowIcon}>
|
|
147
|
+
{historyIcon}
|
|
148
|
+
Recent folders
|
|
149
|
+
</DropdownMenuSubTrigger>
|
|
150
|
+
<DropdownMenuSubContent
|
|
151
|
+
collisionPadding={{ bottom: 24, left: 8 }}
|
|
152
|
+
dataStyle={dataStyle}
|
|
153
|
+
dataTheme={dataTheme}
|
|
154
|
+
>
|
|
155
|
+
{MOCK_HISTORY_FOLDERS.map((path) => (
|
|
156
|
+
<DropdownMenuItem key={path} onClick={() => {}}>
|
|
157
|
+
{path}
|
|
158
|
+
</DropdownMenuItem>
|
|
159
|
+
))}
|
|
160
|
+
</DropdownMenuSubContent>
|
|
161
|
+
</DropdownMenuSub>
|
|
162
|
+
</DropdownMenuContent>
|
|
163
|
+
</DropdownMenu>
|
|
164
|
+
<input
|
|
165
|
+
ref={folderInputRef}
|
|
166
|
+
type="file"
|
|
167
|
+
{...({ webkitdirectory: '' } as InputPropsWithWebkitDirectory)}
|
|
168
|
+
multiple
|
|
169
|
+
style={{ display: 'none' }}
|
|
170
|
+
onChange={handleFolderInputChange}
|
|
171
|
+
/>
|
|
172
|
+
{enableFolderPermissionDialog && (
|
|
173
|
+
<FolderPermissionDialog
|
|
174
|
+
open={folderPermissionOpen}
|
|
175
|
+
onOpenChange={setFolderPermissionOpen}
|
|
176
|
+
projectName={folderPermissionProjectName}
|
|
177
|
+
onAllowOnce={() => requestFolderPermission('once')}
|
|
178
|
+
onAllowAlways={() => requestFolderPermission('always')}
|
|
179
|
+
/>
|
|
180
|
+
)}
|
|
181
|
+
</>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
ChatInputFolderSelector.displayName = 'ChatInputFolderSelector'
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DropdownMenu,
|
|
3
|
+
DropdownMenuTrigger,
|
|
4
|
+
DropdownMenuContent,
|
|
5
|
+
DropdownMenuItem,
|
|
6
|
+
} from '../../basic/dropdown-menu'
|
|
7
|
+
import { ArrowDownSLine, CheckLine } from '../../basic/icons-inline'
|
|
8
|
+
import type { FooterLeftModelSwitchConfig } from './types'
|
|
9
|
+
|
|
10
|
+
export interface ChatInputModelSwitcherProps {
|
|
11
|
+
config: FooterLeftModelSwitchConfig
|
|
12
|
+
disabled: boolean
|
|
13
|
+
arrowDownIcon?: React.ReactNode
|
|
14
|
+
dataStyle?: string
|
|
15
|
+
dataTheme?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function ChatInputModelSwitcher({
|
|
19
|
+
config,
|
|
20
|
+
disabled,
|
|
21
|
+
dataStyle,
|
|
22
|
+
dataTheme,
|
|
23
|
+
arrowDownIcon = <ArrowDownSLine className="h-3.5 w-3.5 shrink-0 text-text-secondary" />,
|
|
24
|
+
}: ChatInputModelSwitcherProps) {
|
|
25
|
+
const currentModeOption = config.modeSwitch.options.find((o) => o.value === config.modeSwitch.value)
|
|
26
|
+
const modeTriggerIcon = currentModeOption?.icon ?? config.modeSwitch.icon
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className="flex items-center gap-3 text-sm leading-sm text-text-secondary">
|
|
30
|
+
<DropdownMenu>
|
|
31
|
+
<DropdownMenuTrigger asChild>
|
|
32
|
+
<button
|
|
33
|
+
type="button"
|
|
34
|
+
className="inline-flex items-center gap-1.5 rounded-md bg-fill-secondary px-2.5 py-1.5 text-sm leading-sm text-text hover:bg-fill focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50"
|
|
35
|
+
disabled={disabled}
|
|
36
|
+
>
|
|
37
|
+
{modeTriggerIcon != null && (
|
|
38
|
+
<span className="flex shrink-0 items-center [&>*]:block [&>*]:leading-none">
|
|
39
|
+
{modeTriggerIcon}
|
|
40
|
+
</span>
|
|
41
|
+
)}
|
|
42
|
+
<span>{config.modeSwitch.label}</span>
|
|
43
|
+
{arrowDownIcon}
|
|
44
|
+
</button>
|
|
45
|
+
</DropdownMenuTrigger>
|
|
46
|
+
<DropdownMenuContent align="start" side="top" className="min-w-30" dataStyle={dataStyle} dataTheme={dataTheme}>
|
|
47
|
+
{config.modeSwitch.options.map((opt) => (
|
|
48
|
+
<DropdownMenuItem
|
|
49
|
+
key={opt.value}
|
|
50
|
+
onClick={() => config.modeSwitch.onChange(opt.value)}
|
|
51
|
+
className="flex items-center justify-between gap-2"
|
|
52
|
+
>
|
|
53
|
+
<span className="flex items-center gap-2">
|
|
54
|
+
{opt.icon != null && (
|
|
55
|
+
<span className="flex shrink-0 [&>*]:block [&>*]:leading-none [&>*]:size-4">
|
|
56
|
+
{opt.icon}
|
|
57
|
+
</span>
|
|
58
|
+
)}
|
|
59
|
+
{opt.label}
|
|
60
|
+
</span>
|
|
61
|
+
{config.modeSwitch.value === opt.value && (
|
|
62
|
+
<CheckLine className="h-4 w-4 shrink-0 text-primary" />
|
|
63
|
+
)}
|
|
64
|
+
</DropdownMenuItem>
|
|
65
|
+
))}
|
|
66
|
+
</DropdownMenuContent>
|
|
67
|
+
</DropdownMenu>
|
|
68
|
+
|
|
69
|
+
<DropdownMenu>
|
|
70
|
+
<DropdownMenuTrigger asChild>
|
|
71
|
+
<button
|
|
72
|
+
type="button"
|
|
73
|
+
className="inline-flex items-center gap-1 text-text-secondary hover:text-text focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded px-1 py-0.5 disabled:opacity-50"
|
|
74
|
+
disabled={disabled}
|
|
75
|
+
>
|
|
76
|
+
<span>{config.modelSwitch.label}</span>
|
|
77
|
+
{arrowDownIcon}
|
|
78
|
+
</button>
|
|
79
|
+
</DropdownMenuTrigger>
|
|
80
|
+
<DropdownMenuContent align="start" side="top" className="min-w-25" dataStyle={dataStyle} dataTheme={dataTheme}>
|
|
81
|
+
{config.modelSwitch.options.map((opt) => (
|
|
82
|
+
<DropdownMenuItem
|
|
83
|
+
key={opt.value}
|
|
84
|
+
onClick={() => config.modelSwitch.onChange(opt.value)}
|
|
85
|
+
className="flex items-center justify-between gap-2"
|
|
86
|
+
>
|
|
87
|
+
{opt.label}
|
|
88
|
+
{config.modelSwitch.value === opt.value && (
|
|
89
|
+
<CheckLine className="h-4 w-4 shrink-0 text-primary" />
|
|
90
|
+
)}
|
|
91
|
+
</DropdownMenuItem>
|
|
92
|
+
))}
|
|
93
|
+
</DropdownMenuContent>
|
|
94
|
+
</DropdownMenu>
|
|
95
|
+
|
|
96
|
+
{config.consumptionMultiplier.options != null &&
|
|
97
|
+
config.consumptionMultiplier.options.length > 0 &&
|
|
98
|
+
config.consumptionMultiplier.onChange != null ? (
|
|
99
|
+
<DropdownMenu>
|
|
100
|
+
<DropdownMenuTrigger asChild>
|
|
101
|
+
<button
|
|
102
|
+
type="button"
|
|
103
|
+
className="inline-flex items-center text-text-secondary hover:text-text focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded px-1 py-0.5 disabled:opacity-50"
|
|
104
|
+
disabled={disabled}
|
|
105
|
+
>
|
|
106
|
+
{config.consumptionMultiplier.value}
|
|
107
|
+
</button>
|
|
108
|
+
</DropdownMenuTrigger>
|
|
109
|
+
<DropdownMenuContent align="start" side="top" className="min-w-20" dataStyle={dataStyle} dataTheme={dataTheme}>
|
|
110
|
+
{config.consumptionMultiplier.options.map((opt) => (
|
|
111
|
+
<DropdownMenuItem
|
|
112
|
+
key={opt.value}
|
|
113
|
+
onClick={() => config.consumptionMultiplier.onChange?.(opt.value)}
|
|
114
|
+
className="flex items-center justify-between gap-2"
|
|
115
|
+
>
|
|
116
|
+
{opt.label}
|
|
117
|
+
{config.consumptionMultiplier.value === opt.value && (
|
|
118
|
+
<CheckLine className="h-4 w-4 shrink-0 text-primary" />
|
|
119
|
+
)}
|
|
120
|
+
</DropdownMenuItem>
|
|
121
|
+
))}
|
|
122
|
+
</DropdownMenuContent>
|
|
123
|
+
</DropdownMenu>
|
|
124
|
+
) : (
|
|
125
|
+
<span className="text-text-secondary">{config.consumptionMultiplier.value}</span>
|
|
126
|
+
)}
|
|
127
|
+
</div>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
ChatInputModelSwitcher.displayName = 'ChatInputModelSwitcher'
|