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,358 @@
|
|
|
1
|
+
import { useState, useMemo, useCallback, memo, Fragment } from 'react'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
import { motion } from 'framer-motion'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
import { EyeLine, ArrowRightLine } from '../basic/icons-inline'
|
|
6
|
+
|
|
7
|
+
export type ReasoningStepDetail =
|
|
8
|
+
| { type: 'action'; action: string; desc?: string; details?: ReasoningStepDetail[] }
|
|
9
|
+
| {
|
|
10
|
+
type: 'file'
|
|
11
|
+
filename: string
|
|
12
|
+
lines?: string
|
|
13
|
+
path?: string
|
|
14
|
+
fileType?: string
|
|
15
|
+
details?: ReasoningStepDetail[]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ReasoningStepProps {
|
|
19
|
+
text: ReactNode
|
|
20
|
+
description?: string
|
|
21
|
+
status?: 'completed' | 'in-progress'
|
|
22
|
+
icon?: ReactNode
|
|
23
|
+
showIcon?: boolean
|
|
24
|
+
details?: ReasoningStepDetail[]
|
|
25
|
+
children?: ReactNode
|
|
26
|
+
duration?: number
|
|
27
|
+
spread?: number
|
|
28
|
+
disableExpandAnimation?: boolean
|
|
29
|
+
defaultExpanded?: boolean
|
|
30
|
+
expanded?: boolean
|
|
31
|
+
onExpandedChange?: (expanded: boolean) => void
|
|
32
|
+
eyeIcon?: ReactNode
|
|
33
|
+
arrowRightIcon?: ReactNode
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const FILE_ICON_COLOR_MAP: Record<string, string> = {
|
|
37
|
+
ts: 'text-info', tsx: 'text-info', js: 'text-info', jsx: 'text-info',
|
|
38
|
+
py: 'text-teal',
|
|
39
|
+
md: 'text-text-secondary', mdx: 'text-text-secondary',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function getFileIconColorClass(fileType?: string, filename?: string): string {
|
|
43
|
+
const ext = (fileType ?? filename?.split('.').pop() ?? '').toLowerCase()
|
|
44
|
+
return FILE_ICON_COLOR_MAP[ext] ?? 'text-text-tertiary'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* 与主文 text-xs 共用 token,图标与文字同尺度、随 data-style 一致缩放 */
|
|
48
|
+
const iconSizeStyle = { width: 'var(--font-size-xs)', height: 'var(--font-size-xs)' }
|
|
49
|
+
const eyeClass = 'w-full h-full text-text-tertiary transition-transform duration-200 ease-in-out'
|
|
50
|
+
const arrowClass = 'w-full h-full transition-transform duration-200 ease-in-out'
|
|
51
|
+
|
|
52
|
+
const FileIconPlaceholder = memo(function FileIconPlaceholder({ className }: { className?: string }) {
|
|
53
|
+
return (
|
|
54
|
+
<span
|
|
55
|
+
className={cn('inline-flex items-center justify-center text-xs leading-xs font-mono', className)}
|
|
56
|
+
style={iconSizeStyle}
|
|
57
|
+
aria-hidden
|
|
58
|
+
>
|
|
59
|
+
⎔
|
|
60
|
+
</span>
|
|
61
|
+
)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const InlineRow = memo(function InlineRow({
|
|
65
|
+
prefix,
|
|
66
|
+
primary,
|
|
67
|
+
secondary,
|
|
68
|
+
}: {
|
|
69
|
+
prefix?: ReactNode
|
|
70
|
+
primary: string
|
|
71
|
+
secondary?: string
|
|
72
|
+
}) {
|
|
73
|
+
return (
|
|
74
|
+
<div className="flex flex-row items-center gap-1.5 min-w-0 flex-1">
|
|
75
|
+
{prefix ? <div className="flex items-center justify-center shrink-0">{prefix}</div> : null}
|
|
76
|
+
<div className="flex flex-row items-center gap-1 min-w-0 overflow-hidden flex-1">
|
|
77
|
+
<span className="text-xs leading-xs font-normal text-text-tertiary truncate" title={primary}>
|
|
78
|
+
{primary}
|
|
79
|
+
</span>
|
|
80
|
+
{secondary ? (
|
|
81
|
+
<span className="text-xs leading-xs font-normal text-text-quaternary truncate" title={secondary}>
|
|
82
|
+
{secondary}
|
|
83
|
+
</span>
|
|
84
|
+
) : null}
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
)
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
interface DetailRowProps {
|
|
91
|
+
detail: ReasoningStepDetail
|
|
92
|
+
depth: number
|
|
93
|
+
pathKey: string
|
|
94
|
+
detailIndent: string
|
|
95
|
+
disableExpandAnimation: boolean
|
|
96
|
+
expandedNestedKeys: Set<string>
|
|
97
|
+
onToggleNested: (pathKey: string) => void
|
|
98
|
+
arrowRightIcon: ReactNode
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const DetailRow = memo(function DetailRow({
|
|
102
|
+
detail,
|
|
103
|
+
depth,
|
|
104
|
+
pathKey,
|
|
105
|
+
detailIndent,
|
|
106
|
+
disableExpandAnimation,
|
|
107
|
+
expandedNestedKeys,
|
|
108
|
+
onToggleNested,
|
|
109
|
+
arrowRightIcon,
|
|
110
|
+
}: DetailRowProps) {
|
|
111
|
+
const hasNested = detail.details != null && detail.details.length > 0
|
|
112
|
+
const isExpandedNested = expandedNestedKeys.has(pathKey)
|
|
113
|
+
const showIconOnRow = !hasNested
|
|
114
|
+
const primary = detail.type === 'action' ? detail.action : detail.filename
|
|
115
|
+
const secondary =
|
|
116
|
+
detail.type === 'action' ? detail.desc : [detail.lines, detail.path].filter(Boolean).join(' ')
|
|
117
|
+
const prefix =
|
|
118
|
+
showIconOnRow && detail.type === 'file' ? (
|
|
119
|
+
<FileIconPlaceholder className={getFileIconColorClass(detail.fileType, detail.filename)} />
|
|
120
|
+
) : undefined
|
|
121
|
+
|
|
122
|
+
const handleClick = useCallback(() => {
|
|
123
|
+
if (hasNested) onToggleNested(pathKey)
|
|
124
|
+
}, [hasNested, onToggleNested, pathKey])
|
|
125
|
+
|
|
126
|
+
const rowContent = (
|
|
127
|
+
<div
|
|
128
|
+
className={cn(
|
|
129
|
+
'flex flex-row items-center gap-1.5 self-stretch min-h-5 min-w-0',
|
|
130
|
+
hasNested && 'cursor-pointer'
|
|
131
|
+
)}
|
|
132
|
+
onClick={hasNested ? handleClick : undefined}
|
|
133
|
+
>
|
|
134
|
+
<InlineRow prefix={prefix} primary={primary} secondary={secondary} />
|
|
135
|
+
{hasNested && (
|
|
136
|
+
<div
|
|
137
|
+
className={cn(
|
|
138
|
+
'flex items-center justify-center shrink-0 text-text-tertiary',
|
|
139
|
+
isExpandedNested ? 'rotate-90' : 'rotate-0'
|
|
140
|
+
)}
|
|
141
|
+
style={iconSizeStyle}
|
|
142
|
+
>
|
|
143
|
+
{arrowRightIcon}
|
|
144
|
+
</div>
|
|
145
|
+
)}
|
|
146
|
+
</div>
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
const rowWithOptionalLine = (
|
|
150
|
+
<div
|
|
151
|
+
className="flex flex-row items-center gap-0 self-stretch"
|
|
152
|
+
style={{ marginLeft: detailIndent }}
|
|
153
|
+
>
|
|
154
|
+
<div className="shrink-0 w-[var(--font-size-xs)] h-5 border-l border-border-tertiary" />
|
|
155
|
+
{rowContent}
|
|
156
|
+
</div>
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
if (!hasNested) return <Fragment key={pathKey}>{rowWithOptionalLine}</Fragment>
|
|
160
|
+
|
|
161
|
+
const isThirdLevelContainer = depth === 1
|
|
162
|
+
const nestedWrapperClass = isThirdLevelContainer
|
|
163
|
+
? 'rounded-lg border border-border-tertiary bg-bg-base p-2 flex flex-col gap-0'
|
|
164
|
+
: 'flex flex-col'
|
|
165
|
+
|
|
166
|
+
return (
|
|
167
|
+
<div key={pathKey} className="flex flex-col self-stretch">
|
|
168
|
+
{rowWithOptionalLine}
|
|
169
|
+
<div
|
|
170
|
+
className={cn(
|
|
171
|
+
'grid transition-[grid-template-rows,opacity] duration-150 ease-out',
|
|
172
|
+
isExpandedNested ? 'grid-rows-[1fr] opacity-100' : 'grid-rows-[0fr] opacity-0'
|
|
173
|
+
)}
|
|
174
|
+
>
|
|
175
|
+
<div className="overflow-hidden">
|
|
176
|
+
<div className={cn(nestedWrapperClass)}>
|
|
177
|
+
{detail.details?.map((d, i) => (
|
|
178
|
+
<DetailRow
|
|
179
|
+
key={`${pathKey}-${i}`}
|
|
180
|
+
detail={d}
|
|
181
|
+
depth={depth + 1}
|
|
182
|
+
pathKey={`${pathKey}-${i}`}
|
|
183
|
+
detailIndent={detailIndent}
|
|
184
|
+
disableExpandAnimation={disableExpandAnimation}
|
|
185
|
+
expandedNestedKeys={expandedNestedKeys}
|
|
186
|
+
onToggleNested={onToggleNested}
|
|
187
|
+
arrowRightIcon={arrowRightIcon}
|
|
188
|
+
/>
|
|
189
|
+
))}
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
)
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
export function ReasoningStep({
|
|
198
|
+
text,
|
|
199
|
+
description,
|
|
200
|
+
status = 'completed',
|
|
201
|
+
icon,
|
|
202
|
+
showIcon = true,
|
|
203
|
+
details,
|
|
204
|
+
children,
|
|
205
|
+
duration = 2,
|
|
206
|
+
spread = 2,
|
|
207
|
+
disableExpandAnimation = false,
|
|
208
|
+
defaultExpanded,
|
|
209
|
+
expanded: expandedProp,
|
|
210
|
+
onExpandedChange,
|
|
211
|
+
eyeIcon,
|
|
212
|
+
arrowRightIcon,
|
|
213
|
+
}: ReasoningStepProps) {
|
|
214
|
+
const isControlled = expandedProp !== undefined
|
|
215
|
+
const [isExpandedInternal, setIsExpandedInternal] = useState(defaultExpanded ?? false)
|
|
216
|
+
const isExpanded = isControlled ? expandedProp : isExpandedInternal
|
|
217
|
+
const [isHovered, setIsHovered] = useState(false)
|
|
218
|
+
|
|
219
|
+
const effectiveExpanded = disableExpandAnimation && defaultExpanded !== undefined
|
|
220
|
+
? defaultExpanded
|
|
221
|
+
: isExpanded
|
|
222
|
+
|
|
223
|
+
const effectiveShowIcon = showIcon && typeof text === 'string'
|
|
224
|
+
|
|
225
|
+
const detailIndent = effectiveShowIcon ? 'var(--spacing-1.5)' : 'var(--spacing-2.5)'
|
|
226
|
+
|
|
227
|
+
const dynamicSpread = useMemo(() => {
|
|
228
|
+
if (typeof text === 'string') return text.length * spread
|
|
229
|
+
return 10 * spread
|
|
230
|
+
}, [text, spread])
|
|
231
|
+
|
|
232
|
+
const defaultEye = eyeIcon ?? <EyeLine className={eyeClass} />
|
|
233
|
+
const defaultArrow = arrowRightIcon ?? <ArrowRightLine className={arrowClass} />
|
|
234
|
+
|
|
235
|
+
const getIcon = () => (icon ? icon : defaultEye)
|
|
236
|
+
|
|
237
|
+
const renderPrimaryText = () => {
|
|
238
|
+
if (typeof text !== 'string') return text
|
|
239
|
+
if (status === 'in-progress') {
|
|
240
|
+
return (
|
|
241
|
+
<motion.span
|
|
242
|
+
className="text-xs leading-xs font-normal relative inline-block bg-clip-text text-transparent bg-[length:250%_100%,auto] bg-no-repeat truncate"
|
|
243
|
+
style={{
|
|
244
|
+
backgroundImage: `linear-gradient(90deg, transparent calc(50% - ${dynamicSpread}px), var(--color-text), transparent calc(50% + ${dynamicSpread}px)), linear-gradient(var(--color-text-tertiary), var(--color-text-tertiary))`,
|
|
245
|
+
}}
|
|
246
|
+
initial={{ backgroundPosition: '100% center' }}
|
|
247
|
+
animate={{ backgroundPosition: '0% center' }}
|
|
248
|
+
transition={{ repeat: Infinity, duration, ease: 'linear' }}
|
|
249
|
+
>
|
|
250
|
+
{text}
|
|
251
|
+
</motion.span>
|
|
252
|
+
)
|
|
253
|
+
}
|
|
254
|
+
return (
|
|
255
|
+
<span className="text-xs leading-xs font-normal text-text-tertiary truncate">
|
|
256
|
+
{text}
|
|
257
|
+
</span>
|
|
258
|
+
)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
const renderDescription = () => {
|
|
262
|
+
if (!description) return null
|
|
263
|
+
return (
|
|
264
|
+
<span className="text-xs leading-xs font-normal text-text-quaternary truncate">
|
|
265
|
+
{description}
|
|
266
|
+
</span>
|
|
267
|
+
)
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const [expandedNestedKeys, setExpandedNestedKeys] = useState<Set<string>>(new Set())
|
|
271
|
+
const toggleNested = useCallback((pathKey: string) => {
|
|
272
|
+
setExpandedNestedKeys((prev) => {
|
|
273
|
+
const next = new Set(prev)
|
|
274
|
+
if (next.has(pathKey)) next.delete(pathKey)
|
|
275
|
+
else next.add(pathKey)
|
|
276
|
+
return next
|
|
277
|
+
})
|
|
278
|
+
}, [])
|
|
279
|
+
|
|
280
|
+
const hasDetails = details != null && details.length > 0
|
|
281
|
+
const hasExpandableContent = hasDetails || children != null
|
|
282
|
+
|
|
283
|
+
const handleToggle = () => {
|
|
284
|
+
if (hasExpandableContent) {
|
|
285
|
+
if (isControlled) onExpandedChange?.(!expandedProp)
|
|
286
|
+
else setIsExpandedInternal((e) => !e)
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return (
|
|
291
|
+
<div
|
|
292
|
+
data-reasoning-step
|
|
293
|
+
className="flex flex-col gap-1 py-0.5"
|
|
294
|
+
onMouseEnter={() => setIsHovered(true)}
|
|
295
|
+
onMouseLeave={() => setIsHovered(false)}
|
|
296
|
+
>
|
|
297
|
+
<div
|
|
298
|
+
className={cn('flex flex-row items-center gap-1.5', hasExpandableContent && 'cursor-pointer')}
|
|
299
|
+
onClick={handleToggle}
|
|
300
|
+
>
|
|
301
|
+
{effectiveShowIcon && (
|
|
302
|
+
<div className="flex items-center justify-center shrink-0" style={iconSizeStyle}>
|
|
303
|
+
{getIcon()}
|
|
304
|
+
</div>
|
|
305
|
+
)}
|
|
306
|
+
<div className="flex flex-row items-center gap-1 flex-1 min-w-0">
|
|
307
|
+
{renderPrimaryText()}
|
|
308
|
+
{description ? renderDescription() : null}
|
|
309
|
+
{hasExpandableContent && (
|
|
310
|
+
<div
|
|
311
|
+
className={cn(
|
|
312
|
+
'flex items-center justify-center shrink-0 text-text-tertiary transition-opacity duration-200 ease-in-out',
|
|
313
|
+
effectiveExpanded ? 'opacity-100' : isHovered ? 'opacity-100' : 'opacity-0',
|
|
314
|
+
effectiveExpanded ? 'rotate-90' : 'rotate-0'
|
|
315
|
+
)}
|
|
316
|
+
style={iconSizeStyle}
|
|
317
|
+
>
|
|
318
|
+
{defaultArrow}
|
|
319
|
+
</div>
|
|
320
|
+
)}
|
|
321
|
+
</div>
|
|
322
|
+
</div>
|
|
323
|
+
|
|
324
|
+
{hasExpandableContent && (
|
|
325
|
+
<div
|
|
326
|
+
className={cn(
|
|
327
|
+
'grid transition-[grid-template-rows,opacity] duration-200 ease-out',
|
|
328
|
+
effectiveExpanded ? 'grid-rows-[1fr] opacity-100' : 'grid-rows-[0fr] opacity-0'
|
|
329
|
+
)}
|
|
330
|
+
>
|
|
331
|
+
<div className="overflow-hidden">
|
|
332
|
+
{hasDetails ? (
|
|
333
|
+
<div className="flex flex-col">
|
|
334
|
+
{details?.map((d, i) => (
|
|
335
|
+
<DetailRow
|
|
336
|
+
key={String(i)}
|
|
337
|
+
detail={d}
|
|
338
|
+
depth={0}
|
|
339
|
+
pathKey={String(i)}
|
|
340
|
+
detailIndent={detailIndent}
|
|
341
|
+
disableExpandAnimation={disableExpandAnimation}
|
|
342
|
+
expandedNestedKeys={expandedNestedKeys}
|
|
343
|
+
onToggleNested={toggleNested}
|
|
344
|
+
arrowRightIcon={defaultArrow}
|
|
345
|
+
/>
|
|
346
|
+
))}
|
|
347
|
+
</div>
|
|
348
|
+
) : (
|
|
349
|
+
children
|
|
350
|
+
)}
|
|
351
|
+
</div>
|
|
352
|
+
</div>
|
|
353
|
+
)}
|
|
354
|
+
</div>
|
|
355
|
+
)
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
ReasoningStep.displayName = 'ReasoningStep'
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { Fragment } from 'react'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { Tooltip } from '../basic/tooltip'
|
|
5
|
+
import { Chat3Line } from '../basic/icons-inline'
|
|
6
|
+
|
|
7
|
+
const iconClass = 'w-3.5 h-3.5 shrink-0 text-text-tertiary'
|
|
8
|
+
|
|
9
|
+
export interface RelatedPromptItem {
|
|
10
|
+
text: string
|
|
11
|
+
prompt: string
|
|
12
|
+
icon?: ReactNode
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface RelatedPromptsProps {
|
|
16
|
+
items: RelatedPromptItem[]
|
|
17
|
+
onSelect?: (item: RelatedPromptItem) => void
|
|
18
|
+
singleLineText?: boolean
|
|
19
|
+
className?: string
|
|
20
|
+
/** 主库可注入 useIcon('chat3');不传则用 Chat3Line */
|
|
21
|
+
defaultIcon?: ReactNode
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function RelatedPrompts({
|
|
25
|
+
items,
|
|
26
|
+
onSelect,
|
|
27
|
+
singleLineText = false,
|
|
28
|
+
className,
|
|
29
|
+
defaultIcon,
|
|
30
|
+
}: RelatedPromptsProps) {
|
|
31
|
+
const list = items.slice(0, 3)
|
|
32
|
+
const icon = defaultIcon ?? <Chat3Line className={iconClass} />
|
|
33
|
+
|
|
34
|
+
if (list.length === 0) return null
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
className={cn(
|
|
39
|
+
'flex flex-col gap-3 w-full min-w-0',
|
|
40
|
+
!singleLineText && 'max-w-lg',
|
|
41
|
+
className
|
|
42
|
+
)}
|
|
43
|
+
role="list"
|
|
44
|
+
aria-label="Related prompt suggestions"
|
|
45
|
+
>
|
|
46
|
+
{list.map((item, index) => {
|
|
47
|
+
const itemIcon = item.icon ?? icon
|
|
48
|
+
|
|
49
|
+
const itemContent = (
|
|
50
|
+
<button
|
|
51
|
+
type="button"
|
|
52
|
+
onClick={() => onSelect?.(item)}
|
|
53
|
+
className={cn(
|
|
54
|
+
'flex items-center gap-2 w-full min-w-0 text-left',
|
|
55
|
+
'rounded-md px-0 py-0 min-h-0',
|
|
56
|
+
'text-xs leading-xs font-normal text-text-tertiary',
|
|
57
|
+
'transition-colors',
|
|
58
|
+
onSelect && 'cursor-pointer hover:text-text',
|
|
59
|
+
!onSelect && 'cursor-default'
|
|
60
|
+
)}
|
|
61
|
+
role="listitem"
|
|
62
|
+
>
|
|
63
|
+
<span className="w-3.5 h-3.5 flex-shrink-0 flex items-center justify-center">
|
|
64
|
+
{itemIcon}
|
|
65
|
+
</span>
|
|
66
|
+
<span
|
|
67
|
+
className={cn(
|
|
68
|
+
'min-w-0 flex-1',
|
|
69
|
+
singleLineText ? 'truncate' : 'line-clamp-2'
|
|
70
|
+
)}
|
|
71
|
+
>
|
|
72
|
+
{item.text}
|
|
73
|
+
</span>
|
|
74
|
+
</button>
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
if (singleLineText) {
|
|
78
|
+
return (
|
|
79
|
+
<Tooltip key={`${item.prompt}-${index}`} content={item.text} side="top">
|
|
80
|
+
{itemContent}
|
|
81
|
+
</Tooltip>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return <Fragment key={`${item.prompt}-${index}`}>{itemContent}</Fragment>
|
|
86
|
+
})}
|
|
87
|
+
</div>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
RelatedPrompts.displayName = 'RelatedPrompts'
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes, ReactNode } from 'react'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
export interface RequestProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
6
|
+
children: ReactNode
|
|
7
|
+
maxWidth?: string | number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Request = forwardRef<HTMLDivElement, RequestProps>(
|
|
11
|
+
({ children, className, maxWidth = '752px', ...props }, ref) => {
|
|
12
|
+
const containerStyles = cn(
|
|
13
|
+
'w-full',
|
|
14
|
+
'bg-sage-bg',
|
|
15
|
+
'rounded-lg',
|
|
16
|
+
'p-3',
|
|
17
|
+
'text-sm leading-sm',
|
|
18
|
+
'font-normal',
|
|
19
|
+
'text-text',
|
|
20
|
+
className
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={containerStyles}
|
|
27
|
+
style={{
|
|
28
|
+
maxWidth: typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth,
|
|
29
|
+
}}
|
|
30
|
+
{...props}
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
Request.displayName = 'Request'
|