sparkdesign 0.0.1 → 0.2.5
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-qoder-design.cjs.js +265 -0
- package/dist/spark-qoder-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,165 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { cn } from '@/lib/utils'
|
|
3
|
+
import { Button } from '../basic/button'
|
|
4
|
+
import {
|
|
5
|
+
DropdownMenu,
|
|
6
|
+
DropdownMenuContent,
|
|
7
|
+
DropdownMenuItem,
|
|
8
|
+
DropdownMenuTrigger,
|
|
9
|
+
} from '../basic/dropdown-menu'
|
|
10
|
+
import { CloseLine, ArrowDownSLine, WarningLine, SparklingLine } from '../basic/icons-inline'
|
|
11
|
+
import { Scrollbar } from '../basic/scrollbar'
|
|
12
|
+
|
|
13
|
+
export interface SuggestionPartProps {
|
|
14
|
+
type?: 'wiki' | 'credits'
|
|
15
|
+
title?: string
|
|
16
|
+
description?: string
|
|
17
|
+
highlightText?: string
|
|
18
|
+
language?: string
|
|
19
|
+
rechargeText?: string
|
|
20
|
+
onClose?: () => void
|
|
21
|
+
onGenerate?: () => void
|
|
22
|
+
onRecharge?: () => void
|
|
23
|
+
onLanguageChange?: (language: string) => void
|
|
24
|
+
closeIcon?: ReactNode
|
|
25
|
+
arrowDownSIcon?: ReactNode
|
|
26
|
+
suggestionIcon?: ReactNode
|
|
27
|
+
/** 供 Portal 浮层继承(与 ChatInput FolderButton 一致),不传则由 dropdown-menu 使用 getThemeFromDocument() 兜底 */
|
|
28
|
+
dataStyle?: string
|
|
29
|
+
dataTheme?: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const DEFAULT_HIGHLIGHT = 'Repo Wiki'
|
|
33
|
+
const LANGUAGES = ['English', '中文', '日本語', '한국어']
|
|
34
|
+
|
|
35
|
+
const closeClass = 'h-3.5 w-3.5'
|
|
36
|
+
const arrowClass = 'h-3 w-3'
|
|
37
|
+
const suggestionClass = 'h-4 w-4'
|
|
38
|
+
|
|
39
|
+
export function SuggestionPart({
|
|
40
|
+
type = 'wiki',
|
|
41
|
+
title,
|
|
42
|
+
description,
|
|
43
|
+
highlightText = DEFAULT_HIGHLIGHT,
|
|
44
|
+
language = 'English',
|
|
45
|
+
rechargeText,
|
|
46
|
+
onClose,
|
|
47
|
+
onGenerate,
|
|
48
|
+
onRecharge,
|
|
49
|
+
onLanguageChange,
|
|
50
|
+
closeIcon,
|
|
51
|
+
arrowDownSIcon,
|
|
52
|
+
suggestionIcon,
|
|
53
|
+
dataStyle,
|
|
54
|
+
dataTheme,
|
|
55
|
+
}: SuggestionPartProps) {
|
|
56
|
+
const isCreditsType = type === 'credits'
|
|
57
|
+
const defaultClose = closeIcon ?? <CloseLine className={closeClass} />
|
|
58
|
+
const defaultArrow = arrowDownSIcon ?? <ArrowDownSLine className={arrowClass} />
|
|
59
|
+
const defaultSuggestion =
|
|
60
|
+
suggestionIcon ?? (isCreditsType ? <WarningLine className={suggestionClass} /> : <SparklingLine className={suggestionClass} />)
|
|
61
|
+
|
|
62
|
+
const displayTitle =
|
|
63
|
+
title ?? (isCreditsType ? 'Credits Exhausted' : 'Free Wiki Generation Available')
|
|
64
|
+
|
|
65
|
+
const descriptionTemplate = isCreditsType
|
|
66
|
+
? 'Your credits have been exhausted. Please recharge to continue using.'
|
|
67
|
+
: `Generate ${highlightText} for this repository to boost AI agent with structured context.`
|
|
68
|
+
const displayDescription = description ?? descriptionTemplate
|
|
69
|
+
|
|
70
|
+
const renderDescription = (): ReactNode => {
|
|
71
|
+
if (!displayDescription.includes(highlightText)) {
|
|
72
|
+
return <span>{displayDescription}</span>
|
|
73
|
+
}
|
|
74
|
+
const parts = displayDescription.split(highlightText)
|
|
75
|
+
const result: ReactNode[] = []
|
|
76
|
+
for (let i = 0; i < parts.length; i++) {
|
|
77
|
+
if (parts[i]) {
|
|
78
|
+
result.push(<span key={`text-${i}`}>{parts[i]}</span>)
|
|
79
|
+
}
|
|
80
|
+
if (i < parts.length - 1) {
|
|
81
|
+
result.push(
|
|
82
|
+
<span key={`highlight-${i}`} className="text-[var(--color-link)]">
|
|
83
|
+
{highlightText}
|
|
84
|
+
</span>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return <>{result}</>
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<div className="relative rounded-lg border border-border-tertiary bg-bg-base p-3">
|
|
93
|
+
{onClose && (
|
|
94
|
+
<button
|
|
95
|
+
type="button"
|
|
96
|
+
onClick={onClose}
|
|
97
|
+
className="absolute top-3 right-3 flex h-4 w-4 cursor-pointer items-center justify-center text-text-secondary transition-colors duration-200 hover:text-text"
|
|
98
|
+
aria-label="Close"
|
|
99
|
+
>
|
|
100
|
+
{defaultClose}
|
|
101
|
+
</button>
|
|
102
|
+
)}
|
|
103
|
+
|
|
104
|
+
<div className="mb-1 flex items-center gap-2">
|
|
105
|
+
<div
|
|
106
|
+
className={cn(
|
|
107
|
+
'flex h-4 w-4 shrink-0 items-center justify-center',
|
|
108
|
+
isCreditsType ? 'text-warning' : 'text-primary'
|
|
109
|
+
)}
|
|
110
|
+
>
|
|
111
|
+
{defaultSuggestion}
|
|
112
|
+
</div>
|
|
113
|
+
<h3 className="min-w-0 flex-1 text-base leading-base font-semibold text-text">
|
|
114
|
+
{displayTitle}
|
|
115
|
+
</h3>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<>
|
|
119
|
+
<Scrollbar
|
|
120
|
+
scrollbarVisibility="auto"
|
|
121
|
+
maxHeight={96}
|
|
122
|
+
className="mb-2 ml-6 text-xs leading-xs text-text-tertiary"
|
|
123
|
+
>
|
|
124
|
+
{renderDescription()}
|
|
125
|
+
</Scrollbar>
|
|
126
|
+
</>
|
|
127
|
+
|
|
128
|
+
<div className="flex items-center justify-end gap-2">
|
|
129
|
+
{isCreditsType ? (
|
|
130
|
+
rechargeText && (
|
|
131
|
+
<Button variant="secondary" onClick={onRecharge}>
|
|
132
|
+
{rechargeText ?? '前往充值'}
|
|
133
|
+
</Button>
|
|
134
|
+
)
|
|
135
|
+
) : (
|
|
136
|
+
<>
|
|
137
|
+
<DropdownMenu>
|
|
138
|
+
<DropdownMenuTrigger asChild>
|
|
139
|
+
<Button variant="ghost" className="flex items-center gap-1">
|
|
140
|
+
<span>{language}</span>
|
|
141
|
+
{defaultArrow}
|
|
142
|
+
</Button>
|
|
143
|
+
</DropdownMenuTrigger>
|
|
144
|
+
<DropdownMenuContent dataStyle={dataStyle} dataTheme={dataTheme}>
|
|
145
|
+
{LANGUAGES.map((lang) => (
|
|
146
|
+
<DropdownMenuItem
|
|
147
|
+
key={lang}
|
|
148
|
+
onSelect={() => onLanguageChange?.(lang)}
|
|
149
|
+
>
|
|
150
|
+
{lang}
|
|
151
|
+
</DropdownMenuItem>
|
|
152
|
+
))}
|
|
153
|
+
</DropdownMenuContent>
|
|
154
|
+
</DropdownMenu>
|
|
155
|
+
<Button variant="secondary" onClick={onGenerate}>
|
|
156
|
+
Generate
|
|
157
|
+
</Button>
|
|
158
|
+
</>
|
|
159
|
+
)}
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
SuggestionPart.displayName = 'SuggestionPart'
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { cn } from '@/lib/utils'
|
|
3
|
+
import { CollapsibleCard } from '../basic/collapsible-card'
|
|
4
|
+
import { CatalogLine, CircleLine, CheckboxCircleLine, IndeterminateCircleLine, ArrowRightCircleFillLine } from '../basic/icons-inline'
|
|
5
|
+
|
|
6
|
+
const ICON_CLASS = 'w-[var(--font-size-sm)] h-[var(--font-size-sm)] shrink-0'
|
|
7
|
+
|
|
8
|
+
export type TaskStatus = 'completed' | 'uncompleted' | 'skipped' | 'cancelled'
|
|
9
|
+
|
|
10
|
+
export interface TaskPartTask {
|
|
11
|
+
id?: string
|
|
12
|
+
text: string
|
|
13
|
+
status?: TaskStatus
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface TaskPartProps {
|
|
17
|
+
tasks?: TaskPartTask[]
|
|
18
|
+
title?: string
|
|
19
|
+
currentTaskId?: string
|
|
20
|
+
defaultExpanded?: boolean
|
|
21
|
+
className?: string
|
|
22
|
+
headerIcon?: ReactNode
|
|
23
|
+
uncompletedIcon?: ReactNode
|
|
24
|
+
completedIcon?: ReactNode
|
|
25
|
+
skippedIcon?: ReactNode
|
|
26
|
+
loaderIcon?: ReactNode
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const defaultHeaderIcon = <CatalogLine className={cn(ICON_CLASS, 'text-text-secondary')} />
|
|
30
|
+
const defaultUncompleted = <CircleLine className={cn(ICON_CLASS, 'text-text-tertiary')} />
|
|
31
|
+
const defaultCompleted = <CheckboxCircleLine className={cn(ICON_CLASS, 'text-text-quaternary')} />
|
|
32
|
+
const defaultSkipped = <IndeterminateCircleLine className={cn(ICON_CLASS, 'text-text-tertiary')} />
|
|
33
|
+
const defaultLoader = <ArrowRightCircleFillLine className={cn(ICON_CLASS, 'text-text')} />
|
|
34
|
+
|
|
35
|
+
function getStatusIcon(
|
|
36
|
+
task: TaskPartTask,
|
|
37
|
+
isCurrent: boolean,
|
|
38
|
+
icons: {
|
|
39
|
+
loaderIcon?: ReactNode
|
|
40
|
+
completedIcon?: ReactNode
|
|
41
|
+
skippedIcon?: ReactNode
|
|
42
|
+
uncompletedIcon?: ReactNode
|
|
43
|
+
}
|
|
44
|
+
): ReactNode {
|
|
45
|
+
if (isCurrent) return icons.loaderIcon ?? defaultLoader
|
|
46
|
+
if (task.status === 'completed') return icons.completedIcon ?? defaultCompleted
|
|
47
|
+
if (task.status === 'skipped' || task.status === 'cancelled') return icons.skippedIcon ?? defaultSkipped
|
|
48
|
+
return icons.uncompletedIcon ?? defaultUncompleted
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function TaskPart({
|
|
52
|
+
tasks = [],
|
|
53
|
+
title = 'To-dos',
|
|
54
|
+
currentTaskId,
|
|
55
|
+
defaultExpanded = true,
|
|
56
|
+
className,
|
|
57
|
+
headerIcon,
|
|
58
|
+
uncompletedIcon,
|
|
59
|
+
completedIcon,
|
|
60
|
+
skippedIcon,
|
|
61
|
+
loaderIcon,
|
|
62
|
+
}: TaskPartProps) {
|
|
63
|
+
return (
|
|
64
|
+
<CollapsibleCard
|
|
65
|
+
headerIcon={headerIcon ?? defaultHeaderIcon}
|
|
66
|
+
headerTitle={<span className="text-left">{title}</span>}
|
|
67
|
+
defaultExpanded={defaultExpanded}
|
|
68
|
+
contentPadding="var(--spacing-1\.5) var(--spacing-2)"
|
|
69
|
+
showExpandAllBar
|
|
70
|
+
maxHeight={124}
|
|
71
|
+
className={className}
|
|
72
|
+
>
|
|
73
|
+
<div className="flex flex-col gap-2">
|
|
74
|
+
{tasks.map((task, index) => {
|
|
75
|
+
const taskId = task.id ?? index
|
|
76
|
+
const isCurrent = currentTaskId != null && currentTaskId === String(taskId)
|
|
77
|
+
const statusIcon = getStatusIcon(task, isCurrent, {
|
|
78
|
+
loaderIcon,
|
|
79
|
+
completedIcon,
|
|
80
|
+
skippedIcon,
|
|
81
|
+
uncompletedIcon,
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<div key={taskId} className="flex flex-row gap-2 items-start">
|
|
86
|
+
<div className="flex items-center justify-center shrink-0 pt-0.5 [&>svg]:w-[var(--font-size-sm)] [&>svg]:h-[var(--font-size-sm)]">
|
|
87
|
+
{statusIcon}
|
|
88
|
+
</div>
|
|
89
|
+
<span
|
|
90
|
+
className={cn(
|
|
91
|
+
'text-xs leading-xs flex-1 text-left',
|
|
92
|
+
isCurrent
|
|
93
|
+
? 'text-text'
|
|
94
|
+
: task.status === 'completed'
|
|
95
|
+
? 'text-text-quaternary line-through'
|
|
96
|
+
: 'text-text-tertiary'
|
|
97
|
+
)}
|
|
98
|
+
>
|
|
99
|
+
{task.text}
|
|
100
|
+
</span>
|
|
101
|
+
</div>
|
|
102
|
+
)
|
|
103
|
+
})}
|
|
104
|
+
</div>
|
|
105
|
+
</CollapsibleCard>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
TaskPart.displayName = 'TaskPart'
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { CollapsibleCard } from '../basic/collapsible-card'
|
|
3
|
+
import { IconButton } from '../basic/icon-button'
|
|
4
|
+
import { TerminalBoxLine, ExternalLinkLine } from '../basic/icons-inline'
|
|
5
|
+
|
|
6
|
+
const ICON_CLASS = 'w-[var(--font-size-sm)] h-[var(--font-size-sm)] shrink-0 text-text-secondary'
|
|
7
|
+
|
|
8
|
+
export interface TerminalCodeBlockPartProps {
|
|
9
|
+
command?: string
|
|
10
|
+
output?: string
|
|
11
|
+
autoRanCommand?: string
|
|
12
|
+
className?: string
|
|
13
|
+
headerIcon?: ReactNode
|
|
14
|
+
externalLinkIcon?: ReactNode
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const defaultHeaderIcon = <TerminalBoxLine className={ICON_CLASS} />
|
|
18
|
+
const defaultExternalLinkIcon = <ExternalLinkLine className={ICON_CLASS} />
|
|
19
|
+
|
|
20
|
+
export function TerminalCodeBlockPart({
|
|
21
|
+
command,
|
|
22
|
+
output,
|
|
23
|
+
autoRanCommand,
|
|
24
|
+
className,
|
|
25
|
+
headerIcon,
|
|
26
|
+
externalLinkIcon,
|
|
27
|
+
}: TerminalCodeBlockPartProps) {
|
|
28
|
+
const displayCommand = autoRanCommand ?? (command != null ? `Auto-Ran command: ${command}` : 'Terminal')
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<CollapsibleCard
|
|
32
|
+
headerIcon={headerIcon ?? defaultHeaderIcon}
|
|
33
|
+
headerTitle={<span className="font-normal">{displayCommand}</span>}
|
|
34
|
+
headerRight={
|
|
35
|
+
<IconButton
|
|
36
|
+
variant="iconOnly"
|
|
37
|
+
size="sm"
|
|
38
|
+
icon={externalLinkIcon ?? defaultExternalLinkIcon}
|
|
39
|
+
aria-label="Open in terminal"
|
|
40
|
+
className="!min-h-0 !min-w-0 h-[var(--font-size-sm)] w-[var(--font-size-sm)] text-text-secondary hover:text-text [&_svg]:w-[var(--font-size-sm)] [&_svg]:h-[var(--font-size-sm)]"
|
|
41
|
+
/>
|
|
42
|
+
}
|
|
43
|
+
contentPadding="0"
|
|
44
|
+
className={className}
|
|
45
|
+
>
|
|
46
|
+
<div className="flex flex-col gap-0">
|
|
47
|
+
{command != null && command !== '' && (
|
|
48
|
+
<div className="px-2 py-1.5">
|
|
49
|
+
<div className="flex items-start gap-2">
|
|
50
|
+
<span className="font-mono text-xs text-text shrink-0">$</span>
|
|
51
|
+
<pre className="m-0 flex-1 overflow-x-auto text-left font-mono text-xs leading-xs whitespace-pre text-text bg-transparent scrollbar-auto">
|
|
52
|
+
<code>{command}</code>
|
|
53
|
+
</pre>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
)}
|
|
57
|
+
{output != null && output !== '' && (
|
|
58
|
+
<div className="px-2 py-1.5 overflow-x-auto text-left scrollbar-auto">
|
|
59
|
+
<pre className="m-0 p-0 font-mono text-xs leading-xs whitespace-pre-wrap break-all text-text-tertiary bg-transparent">
|
|
60
|
+
{output}
|
|
61
|
+
</pre>
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
65
|
+
</CollapsibleCard>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
TerminalCodeBlockPart.displayName = 'TerminalCodeBlockPart'
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { useMemo } from 'react'
|
|
2
|
+
import type { HTMLAttributes, ReactNode } from 'react'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { motion } from 'framer-motion'
|
|
5
|
+
|
|
6
|
+
export interface ThinkingIndicatorProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
text?: string
|
|
8
|
+
textClassName?: string
|
|
9
|
+
shimmer?: boolean
|
|
10
|
+
shimmerDuration?: number
|
|
11
|
+
shimmerSpread?: number
|
|
12
|
+
/** 主库可注入 Lottie 等自定义动画;不传则用 CSS 三点脉动 */
|
|
13
|
+
loader?: ReactNode
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** 默认:CSS 三点脉动,无 Lottie 依赖 */
|
|
17
|
+
function DefaultLoader() {
|
|
18
|
+
return (
|
|
19
|
+
<span className="relative block w-5 h-5 shrink-0 flex items-center justify-center" aria-hidden>
|
|
20
|
+
<style>{`
|
|
21
|
+
.thinking-dots span { animation: thinking-dot 1.4s ease-in-out infinite both; }
|
|
22
|
+
.thinking-dots span:nth-child(1) { animation-delay: 0s; }
|
|
23
|
+
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
|
|
24
|
+
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
|
|
25
|
+
@keyframes thinking-dot {
|
|
26
|
+
0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
|
|
27
|
+
40% { transform: scale(1); opacity: 1; }
|
|
28
|
+
}
|
|
29
|
+
`}</style>
|
|
30
|
+
<span className="thinking-dots inline-flex gap-0.5">
|
|
31
|
+
<span className="w-1 h-1 rounded-full bg-current opacity-70" />
|
|
32
|
+
<span className="w-1 h-1 rounded-full bg-current opacity-70" />
|
|
33
|
+
<span className="w-1 h-1 rounded-full bg-current opacity-70" />
|
|
34
|
+
</span>
|
|
35
|
+
</span>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function ThinkingIndicator({
|
|
40
|
+
text = 'Qoder is Thinking...',
|
|
41
|
+
textClassName,
|
|
42
|
+
shimmer = true,
|
|
43
|
+
shimmerDuration = 2,
|
|
44
|
+
shimmerSpread = 2,
|
|
45
|
+
className,
|
|
46
|
+
loader,
|
|
47
|
+
...props
|
|
48
|
+
}: ThinkingIndicatorProps) {
|
|
49
|
+
const dynamicSpread = useMemo(() => {
|
|
50
|
+
const textToUse = text || ''
|
|
51
|
+
return textToUse.length * shimmerSpread
|
|
52
|
+
}, [text, shimmerSpread])
|
|
53
|
+
|
|
54
|
+
const loaderContent = loader ?? <DefaultLoader />
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div
|
|
58
|
+
className={cn('inline-flex items-center gap-1.5 max-w-full', className)}
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
<span className="shrink-0 -translate-x-0.5" aria-hidden>
|
|
62
|
+
{loaderContent}
|
|
63
|
+
</span>
|
|
64
|
+
<div className="flex-1 min-w-0 flex items-center">
|
|
65
|
+
{shimmer ? (
|
|
66
|
+
<motion.span
|
|
67
|
+
className={cn(
|
|
68
|
+
'text-sm leading-sm relative inline-block bg-clip-text text-transparent',
|
|
69
|
+
'bg-[length:250%_100%,auto] bg-no-repeat truncate',
|
|
70
|
+
textClassName
|
|
71
|
+
)}
|
|
72
|
+
style={{
|
|
73
|
+
backgroundImage: `linear-gradient(90deg, transparent calc(50% - ${dynamicSpread}px), var(--color-text), transparent calc(50% + ${dynamicSpread}px)), linear-gradient(var(--color-text-secondary), var(--color-text-secondary))`,
|
|
74
|
+
}}
|
|
75
|
+
initial={{ backgroundPosition: '100% center' }}
|
|
76
|
+
animate={{ backgroundPosition: '0% center' }}
|
|
77
|
+
transition={{ repeat: Infinity, duration: shimmerDuration, ease: 'linear' }}
|
|
78
|
+
>
|
|
79
|
+
{text}
|
|
80
|
+
</motion.span>
|
|
81
|
+
) : (
|
|
82
|
+
<span className={cn('text-sm leading-sm text-text-secondary truncate', textClassName)}>
|
|
83
|
+
{text}
|
|
84
|
+
</span>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
ThinkingIndicator.displayName = 'ThinkingIndicator'
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { memo, useState } from 'react'
|
|
2
|
+
import { cn } from '@/lib/utils'
|
|
3
|
+
import type { ReactNode } from 'react'
|
|
4
|
+
import { TimeLine, CheckboxCircleLine, CloseCircleLine, ArrowRightLine } from '../basic/icons-inline'
|
|
5
|
+
import { Scrollbar } from '../basic/scrollbar'
|
|
6
|
+
|
|
7
|
+
export type ToolInvocationStatus = 'running' | 'success' | 'error'
|
|
8
|
+
|
|
9
|
+
export interface ToolInvocationCardProps {
|
|
10
|
+
toolName: string
|
|
11
|
+
params?: string
|
|
12
|
+
status: ToolInvocationStatus
|
|
13
|
+
response?: string
|
|
14
|
+
defaultExpanded?: boolean
|
|
15
|
+
statusText?: string
|
|
16
|
+
className?: string
|
|
17
|
+
timeIcon?: ReactNode
|
|
18
|
+
checkboxCircleIcon?: ReactNode
|
|
19
|
+
closeCircleIcon?: ReactNode
|
|
20
|
+
arrowRightIcon?: ReactNode
|
|
21
|
+
runningText?: string
|
|
22
|
+
ranText?: string
|
|
23
|
+
failedText?: string
|
|
24
|
+
responseLabel?: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* 左侧状态图标随 token:容器 text-xs 使 1em = var(--font-size-xs),图标 size-[1em] 继承 */
|
|
28
|
+
const statusIconClass = 'size-[1em] shrink-0'
|
|
29
|
+
const timeClass = `${statusIconClass} text-text-tertiary`
|
|
30
|
+
const checkboxClass = `${statusIconClass} text-success`
|
|
31
|
+
const closeCircleClass = `${statusIconClass} text-text-tertiary`
|
|
32
|
+
const arrowClass = 'w-3.5 h-3.5 text-text-tertiary transition-all duration-200'
|
|
33
|
+
|
|
34
|
+
export const ToolInvocationCard = memo(function ToolInvocationCard({
|
|
35
|
+
toolName,
|
|
36
|
+
params,
|
|
37
|
+
status,
|
|
38
|
+
response,
|
|
39
|
+
defaultExpanded = false,
|
|
40
|
+
statusText: statusTextProp,
|
|
41
|
+
className,
|
|
42
|
+
timeIcon,
|
|
43
|
+
checkboxCircleIcon,
|
|
44
|
+
closeCircleIcon,
|
|
45
|
+
arrowRightIcon,
|
|
46
|
+
runningText = 'Running',
|
|
47
|
+
ranText = 'Ran',
|
|
48
|
+
failedText = 'Failed',
|
|
49
|
+
responseLabel = 'Response',
|
|
50
|
+
}: ToolInvocationCardProps) {
|
|
51
|
+
const [isExpanded, setIsExpanded] = useState(defaultExpanded)
|
|
52
|
+
|
|
53
|
+
const hasResponse = response != null && response.length > 0
|
|
54
|
+
const isRunning = status === 'running'
|
|
55
|
+
const isSuccess = status === 'success'
|
|
56
|
+
const isError = status === 'error'
|
|
57
|
+
|
|
58
|
+
const defaultStatusText = isRunning ? runningText : isSuccess ? ranText : failedText
|
|
59
|
+
const statusText = statusTextProp !== undefined ? statusTextProp : defaultStatusText
|
|
60
|
+
const showStatusText = statusText !== ''
|
|
61
|
+
|
|
62
|
+
const defaultTime = timeIcon ?? <TimeLine className={timeClass} />
|
|
63
|
+
const defaultCheck = checkboxCircleIcon ?? <CheckboxCircleLine className={checkboxClass} />
|
|
64
|
+
const defaultCloseCircle = closeCircleIcon ?? <CloseCircleLine className={closeCircleClass} />
|
|
65
|
+
const defaultArrow = arrowRightIcon ?? <ArrowRightLine className={arrowClass} />
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div className={cn('flex flex-col', className)}>
|
|
69
|
+
<div
|
|
70
|
+
onClick={() => hasResponse && !isRunning && setIsExpanded(!isExpanded)}
|
|
71
|
+
className={cn(
|
|
72
|
+
'group flex items-center gap-1.5 min-h-5',
|
|
73
|
+
hasResponse && !isRunning && 'cursor-pointer hover:opacity-80 transition-opacity'
|
|
74
|
+
)}
|
|
75
|
+
>
|
|
76
|
+
<div className="shrink-0 flex items-center justify-center text-xs">
|
|
77
|
+
{isRunning && defaultTime}
|
|
78
|
+
{isSuccess && defaultCheck}
|
|
79
|
+
{isError && defaultCloseCircle}
|
|
80
|
+
</div>
|
|
81
|
+
{showStatusText && (
|
|
82
|
+
<span className="text-xs leading-xs text-text-tertiary shrink-0">{statusText}</span>
|
|
83
|
+
)}
|
|
84
|
+
<span className="text-xs leading-xs text-text-secondary shrink-0">{toolName}</span>
|
|
85
|
+
{params != null && params !== '' && (
|
|
86
|
+
<span
|
|
87
|
+
className="text-xs leading-xs text-text-tertiary min-w-0 shrink truncate"
|
|
88
|
+
title={params}
|
|
89
|
+
>
|
|
90
|
+
{params}
|
|
91
|
+
</span>
|
|
92
|
+
)}
|
|
93
|
+
{hasResponse && !isRunning && (
|
|
94
|
+
<div
|
|
95
|
+
className={cn(
|
|
96
|
+
'shrink-0 inline-flex items-center justify-center',
|
|
97
|
+
'opacity-0 group-hover:opacity-100',
|
|
98
|
+
isExpanded && '!opacity-100',
|
|
99
|
+
isExpanded ? 'rotate-90' : 'rotate-0'
|
|
100
|
+
)}
|
|
101
|
+
>
|
|
102
|
+
{defaultArrow}
|
|
103
|
+
</div>
|
|
104
|
+
)}
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
{hasResponse && isExpanded && (
|
|
108
|
+
<div className="mt-1 ml-4.5 rounded-md border border-border-tertiary bg-bg-base overflow-hidden font-mono text-xs leading-xs">
|
|
109
|
+
<div className="text-text-tertiary px-2 pt-1 pb-0 leading-xs">
|
|
110
|
+
{responseLabel}
|
|
111
|
+
</div>
|
|
112
|
+
<Scrollbar
|
|
113
|
+
scrollbarVisibility="auto"
|
|
114
|
+
maxHeight={208}
|
|
115
|
+
className="px-2 pb-1 leading-xs"
|
|
116
|
+
>
|
|
117
|
+
<pre
|
|
118
|
+
className={cn(
|
|
119
|
+
'whitespace-pre-wrap break-words leading-xs',
|
|
120
|
+
isError ? 'text-error' : 'text-text-tertiary'
|
|
121
|
+
)}
|
|
122
|
+
>
|
|
123
|
+
{response}
|
|
124
|
+
</pre>
|
|
125
|
+
</Scrollbar>
|
|
126
|
+
</div>
|
|
127
|
+
)}
|
|
128
|
+
</div>
|
|
129
|
+
)
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
ToolInvocationCard.displayName = 'ToolInvocationCard'
|