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,166 @@
|
|
|
1
|
+
import { forwardRef, useState, useCallback, useEffect } from 'react'
|
|
2
|
+
import type { HTMLAttributes } from 'react'
|
|
3
|
+
import { createPortal } from 'react-dom'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
import type { ReactNode } from 'react'
|
|
6
|
+
import { CloseLine, CloseLargeLine } from '../basic/icons-inline'
|
|
7
|
+
import { IconButton } from '../basic/icon-button'
|
|
8
|
+
|
|
9
|
+
const SIZE_CLASS = {
|
|
10
|
+
sm: 'w-12 h-12',
|
|
11
|
+
md: 'w-16 h-16',
|
|
12
|
+
lg: 'w-20 h-20',
|
|
13
|
+
} as const
|
|
14
|
+
|
|
15
|
+
const PREVIEW_MAX = 'max-w-[90vw] max-h-[90vh] object-contain'
|
|
16
|
+
const closeClass = 'h-2.5 w-2.5 text-text-secondary'
|
|
17
|
+
const closeLargeClass = 'h-4 w-4 text-text-secondary'
|
|
18
|
+
|
|
19
|
+
export interface ImageAttachmentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
20
|
+
src: string
|
|
21
|
+
alt?: string
|
|
22
|
+
onRemove?: (e: React.MouseEvent) => void
|
|
23
|
+
previewable?: boolean
|
|
24
|
+
onClick?: (e: React.MouseEvent) => void
|
|
25
|
+
size?: keyof typeof SIZE_CLASS
|
|
26
|
+
closeIcon?: ReactNode
|
|
27
|
+
closeLargeIcon?: ReactNode
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const ImageAttachment = forwardRef<HTMLDivElement, ImageAttachmentProps>(
|
|
31
|
+
(
|
|
32
|
+
{
|
|
33
|
+
src,
|
|
34
|
+
alt = '',
|
|
35
|
+
onRemove,
|
|
36
|
+
previewable = true,
|
|
37
|
+
onClick,
|
|
38
|
+
size = 'sm',
|
|
39
|
+
className,
|
|
40
|
+
closeIcon,
|
|
41
|
+
closeLargeIcon,
|
|
42
|
+
...props
|
|
43
|
+
},
|
|
44
|
+
ref
|
|
45
|
+
) => {
|
|
46
|
+
const [previewOpen, setPreviewOpen] = useState(false)
|
|
47
|
+
const defaultClose = closeIcon ?? <CloseLine className={closeClass} />
|
|
48
|
+
const defaultCloseLarge = closeLargeIcon ?? <CloseLargeLine className={closeLargeClass} />
|
|
49
|
+
const showClose = typeof onRemove === 'function'
|
|
50
|
+
|
|
51
|
+
const openPreview = useCallback(() => {
|
|
52
|
+
if (previewable) setPreviewOpen(true)
|
|
53
|
+
}, [previewable])
|
|
54
|
+
|
|
55
|
+
const closePreview = useCallback(() => setPreviewOpen(false), [])
|
|
56
|
+
|
|
57
|
+
const handleThumbClick = useCallback(
|
|
58
|
+
(e: React.MouseEvent) => {
|
|
59
|
+
onClick?.(e)
|
|
60
|
+
if (!e.defaultPrevented && previewable) openPreview()
|
|
61
|
+
},
|
|
62
|
+
[onClick, previewable, openPreview]
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
const handleRemove = useCallback(
|
|
66
|
+
(e: React.MouseEvent) => {
|
|
67
|
+
e.stopPropagation()
|
|
68
|
+
onRemove?.(e)
|
|
69
|
+
},
|
|
70
|
+
[onRemove]
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (!previewOpen) return
|
|
75
|
+
const onKeyDown = (e: KeyboardEvent) => {
|
|
76
|
+
if (e.key === 'Escape') closePreview()
|
|
77
|
+
}
|
|
78
|
+
window.addEventListener('keydown', onKeyDown)
|
|
79
|
+
return () => window.removeEventListener('keydown', onKeyDown)
|
|
80
|
+
}, [previewOpen, closePreview])
|
|
81
|
+
|
|
82
|
+
const previewPortal =
|
|
83
|
+
previewOpen && typeof document !== 'undefined'
|
|
84
|
+
? createPortal(
|
|
85
|
+
<div
|
|
86
|
+
className="fixed inset-0 z-[9999] flex items-center justify-center bg-bg-mask"
|
|
87
|
+
role="dialog"
|
|
88
|
+
aria-modal="true"
|
|
89
|
+
aria-label="图片预览"
|
|
90
|
+
onClick={(e) => {
|
|
91
|
+
if (e.target === e.currentTarget) closePreview()
|
|
92
|
+
}}
|
|
93
|
+
onKeyDown={(e) => e.key === 'Escape' && closePreview()}
|
|
94
|
+
>
|
|
95
|
+
<img
|
|
96
|
+
src={src}
|
|
97
|
+
alt={alt}
|
|
98
|
+
className={cn('rounded-lg shadow-xl', PREVIEW_MAX)}
|
|
99
|
+
onClick={(e) => e.stopPropagation()}
|
|
100
|
+
draggable={false}
|
|
101
|
+
/>
|
|
102
|
+
<IconButton
|
|
103
|
+
variant="tertiary"
|
|
104
|
+
size="md"
|
|
105
|
+
rounded="pill"
|
|
106
|
+
icon={defaultCloseLarge}
|
|
107
|
+
onClick={closePreview}
|
|
108
|
+
aria-label="关闭预览"
|
|
109
|
+
className="absolute top-4 right-4 bg-bg-base border border-border-tertiary shadow-sm"
|
|
110
|
+
/>
|
|
111
|
+
</div>,
|
|
112
|
+
document.body
|
|
113
|
+
)
|
|
114
|
+
: null
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<>
|
|
118
|
+
<div
|
|
119
|
+
ref={ref}
|
|
120
|
+
role={previewable ? 'button' : undefined}
|
|
121
|
+
tabIndex={previewable ? 0 : undefined}
|
|
122
|
+
className={cn(
|
|
123
|
+
'relative group shrink-0',
|
|
124
|
+
previewable && 'cursor-pointer',
|
|
125
|
+
className
|
|
126
|
+
)}
|
|
127
|
+
onClick={handleThumbClick}
|
|
128
|
+
onKeyDown={
|
|
129
|
+
previewable
|
|
130
|
+
? (e) => {
|
|
131
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
132
|
+
e.preventDefault()
|
|
133
|
+
openPreview()
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
: undefined
|
|
137
|
+
}
|
|
138
|
+
{...props}
|
|
139
|
+
>
|
|
140
|
+
<img
|
|
141
|
+
src={src}
|
|
142
|
+
alt={alt}
|
|
143
|
+
className={cn(
|
|
144
|
+
'rounded-lg object-cover border border-border-tertiary',
|
|
145
|
+
SIZE_CLASS[size]
|
|
146
|
+
)}
|
|
147
|
+
draggable={false}
|
|
148
|
+
/>
|
|
149
|
+
{showClose && (
|
|
150
|
+
<button
|
|
151
|
+
type="button"
|
|
152
|
+
onClick={handleRemove}
|
|
153
|
+
aria-label="移除"
|
|
154
|
+
className="absolute -top-0.5 -right-0.5 flex h-4 w-4 cursor-pointer items-center justify-center rounded-full bg-bg-base border border-border-tertiary shadow-sm opacity-0 group-hover:opacity-100 transition-opacity hover:bg-fill-secondary"
|
|
155
|
+
>
|
|
156
|
+
{defaultClose}
|
|
157
|
+
</button>
|
|
158
|
+
)}
|
|
159
|
+
</div>
|
|
160
|
+
{previewPortal}
|
|
161
|
+
</>
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
ImageAttachment.displayName = 'ImageAttachment'
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes, ReactNode } from 'react'
|
|
3
|
+
import { motion } from 'framer-motion'
|
|
4
|
+
import { SparklingLine } from '../basic/icons-inline'
|
|
5
|
+
|
|
6
|
+
export interface ImageGeneratingProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
width?: string
|
|
8
|
+
height?: string
|
|
9
|
+
speed?: number
|
|
10
|
+
caption?: string
|
|
11
|
+
captionClassName?: string
|
|
12
|
+
showOverlay?: boolean
|
|
13
|
+
overlayText?: string
|
|
14
|
+
sparklingIcon?: ReactNode
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function cn(...inputs: (string | undefined | false)[]): string {
|
|
18
|
+
return inputs.filter(Boolean).join(' ')
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const defaultSparkling = <SparklingLine className="h-5 w-5 text-text-on-primary" />
|
|
22
|
+
|
|
23
|
+
export function ImageGenerating({
|
|
24
|
+
width = 'var(--spacing-80)',
|
|
25
|
+
height = 'var(--spacing-60)',
|
|
26
|
+
speed = 1.0,
|
|
27
|
+
caption = 'Qoder is drawing...',
|
|
28
|
+
captionClassName,
|
|
29
|
+
className,
|
|
30
|
+
style: styleProp,
|
|
31
|
+
showOverlay = false,
|
|
32
|
+
overlayText,
|
|
33
|
+
sparklingIcon = defaultSparkling,
|
|
34
|
+
...props
|
|
35
|
+
}: ImageGeneratingProps) {
|
|
36
|
+
const containerRef = useRef<HTMLDivElement>(null)
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (typeof CSS !== 'undefined' && CSS.registerProperty) {
|
|
40
|
+
try {
|
|
41
|
+
CSS.registerProperty({ name: '--a', syntax: '<angle>', inherits: true, initialValue: '0deg' })
|
|
42
|
+
CSS.registerProperty({ name: '--l', syntax: '<number>', inherits: true, initialValue: '0' })
|
|
43
|
+
CSS.registerProperty({ name: '--x', syntax: '<length>', inherits: false, initialValue: '0' })
|
|
44
|
+
CSS.registerProperty({ name: '--y', syntax: '<length>', inherits: false, initialValue: '0' })
|
|
45
|
+
CSS.registerProperty({ name: '--o', syntax: '<number>', inherits: false, initialValue: '0' })
|
|
46
|
+
CSS.registerProperty({ name: '--value', syntax: '<angle>', inherits: true, initialValue: '0deg' })
|
|
47
|
+
CSS.registerProperty({ name: '--width-ratio', syntax: '<number>', inherits: true, initialValue: '0' })
|
|
48
|
+
CSS.registerProperty({ name: '--scale', syntax: '<number>', inherits: true, initialValue: '0' })
|
|
49
|
+
} catch {
|
|
50
|
+
// ignore
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, [])
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
const container = containerRef.current
|
|
57
|
+
if (!container) return
|
|
58
|
+
const updateSize = () => {
|
|
59
|
+
const rect = container.getBoundingClientRect()
|
|
60
|
+
if (rect.width > 0 && rect.height > 0) {
|
|
61
|
+
const size = Math.max(rect.width, rect.height)
|
|
62
|
+
container.style.setProperty('--actual-size', `${size}px`)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const isPercent = (typeof width === 'string' && width.includes('%')) || (typeof height === 'string' && height.includes('%'))
|
|
66
|
+
let resizeObserver: ResizeObserver | null = null
|
|
67
|
+
const setup = () => {
|
|
68
|
+
updateSize()
|
|
69
|
+
resizeObserver = new ResizeObserver(updateSize)
|
|
70
|
+
resizeObserver.observe(container)
|
|
71
|
+
}
|
|
72
|
+
if (isPercent) {
|
|
73
|
+
const id = requestAnimationFrame(() => setup())
|
|
74
|
+
return () => {
|
|
75
|
+
cancelAnimationFrame(id)
|
|
76
|
+
resizeObserver?.disconnect()
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
setup()
|
|
80
|
+
return () => resizeObserver?.disconnect()
|
|
81
|
+
}, [width, height])
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<>
|
|
85
|
+
<style>{`
|
|
86
|
+
@keyframes ai {
|
|
87
|
+
from { --a: 360deg; --l: 0.35; --o: 1; }
|
|
88
|
+
30% { --l: 1.5; }
|
|
89
|
+
70% { --o: 0.4; --l: 0.05; }
|
|
90
|
+
98% { --o: 0.7; }
|
|
91
|
+
to { --a: 0deg; --l: 0.35; --o: 1; }
|
|
92
|
+
}
|
|
93
|
+
@keyframes ring {
|
|
94
|
+
from { --value: var(--start); --scale: 1; }
|
|
95
|
+
50% { --scale: 1.2; --width-ratio: 1.5; }
|
|
96
|
+
70% { --scale: 1; --value: calc(var(--start) + 180deg); --width-ratio: 1; }
|
|
97
|
+
80% { --scale: 1.2; --width-ratio: 1.5; }
|
|
98
|
+
to { --value: calc(var(--start) + 360deg); --scale: 1; --width-ratio: 1; }
|
|
99
|
+
}
|
|
100
|
+
.image-generating-container {
|
|
101
|
+
--s: var(--actual-size, max(var(--container-width), var(--container-height)));
|
|
102
|
+
--p: calc(var(--s) / 4);
|
|
103
|
+
--radius: calc(var(--s) * 0.25);
|
|
104
|
+
--count: 4;
|
|
105
|
+
--width: calc(var(--s) * 0.025);
|
|
106
|
+
--duration: calc(8s / var(--image-generating-speed, 1));
|
|
107
|
+
--ai-duration: calc(5.5s / var(--image-generating-speed, 1));
|
|
108
|
+
width: var(--container-width);
|
|
109
|
+
height: var(--container-height);
|
|
110
|
+
--bg-color: color-mix(in srgb, var(--color-primary), transparent 92%);
|
|
111
|
+
background: radial-gradient(60% 75% at center, var(--bg-color) 50%, transparent 50%),
|
|
112
|
+
radial-gradient(75% 60% at center, var(--bg-color) 50%, transparent 50%);
|
|
113
|
+
overflow: hidden;
|
|
114
|
+
position: relative;
|
|
115
|
+
border-radius: var(--radius-xl);
|
|
116
|
+
}
|
|
117
|
+
.image-generating-container .fluid-inner {
|
|
118
|
+
overflow: hidden;
|
|
119
|
+
background: var(--color-bg-base);
|
|
120
|
+
width: 100%;
|
|
121
|
+
height: 100%;
|
|
122
|
+
position: relative;
|
|
123
|
+
display: grid;
|
|
124
|
+
place-items: center;
|
|
125
|
+
border-radius: var(--radius-xl);
|
|
126
|
+
}
|
|
127
|
+
.image-generating-container .c {
|
|
128
|
+
opacity: 0.9;
|
|
129
|
+
position: absolute;
|
|
130
|
+
width: calc(var(--s) * 0.4);
|
|
131
|
+
aspect-ratio: 1;
|
|
132
|
+
border-radius: 50%;
|
|
133
|
+
--offset-per-item: calc(360deg / var(--count));
|
|
134
|
+
--current-angle-offset: calc(var(--offset-per-item) * var(--i) + var(--a));
|
|
135
|
+
translate: calc(cos(var(--current-angle-offset)) * var(--radius) + var(--x, 0))
|
|
136
|
+
calc(sin(var(--current-angle-offset)) * var(--radius) * -1);
|
|
137
|
+
scale: calc(0.6 + var(--l));
|
|
138
|
+
animation: ai var(--ai-duration) cubic-bezier(0.45, -0.35, 0.16, 1.5) infinite;
|
|
139
|
+
transition: opacity 0.3s linear;
|
|
140
|
+
opacity: var(--o, 1);
|
|
141
|
+
}
|
|
142
|
+
.image-generating-container .c1 {
|
|
143
|
+
background: radial-gradient(50% 50% at center, var(--color-primary), color-mix(in srgb, var(--color-primary), transparent 30%));
|
|
144
|
+
--x: calc(var(--s) * 0.04);
|
|
145
|
+
width: calc(var(--s) * 0.6);
|
|
146
|
+
animation-timing-function: cubic-bezier(0.12, 0.32, 0.68, 0.24);
|
|
147
|
+
}
|
|
148
|
+
.image-generating-container .c2 {
|
|
149
|
+
background: radial-gradient(50% 50% at center, var(--color-primary-active), color-mix(in srgb, var(--color-primary-active), var(--color-bg-base) 45%));
|
|
150
|
+
width: calc(var(--s) * 0.55);
|
|
151
|
+
}
|
|
152
|
+
.image-generating-container .c3 {
|
|
153
|
+
background: radial-gradient(50% 50% at center, var(--color-primary-hover), transparent);
|
|
154
|
+
width: calc(var(--s) * 0.2);
|
|
155
|
+
opacity: 0.6;
|
|
156
|
+
--x: calc(var(--s) * -0.04);
|
|
157
|
+
}
|
|
158
|
+
.image-generating-container .c4 {
|
|
159
|
+
background: var(--color-primary-border-hover);
|
|
160
|
+
animation-timing-function: cubic-bezier(0.39, -0.03, 0.75, 0.47);
|
|
161
|
+
}
|
|
162
|
+
.image-generating-container .glass {
|
|
163
|
+
overflow: hidden;
|
|
164
|
+
position: absolute;
|
|
165
|
+
inset: 0;
|
|
166
|
+
backdrop-filter: blur(calc(var(--s) * 0.12));
|
|
167
|
+
box-shadow: 0 0 calc(var(--s) * 0.2) color-mix(in srgb, var(--color-text-base), transparent 70%);
|
|
168
|
+
border-radius: var(--radius-xl);
|
|
169
|
+
pointer-events: none;
|
|
170
|
+
}
|
|
171
|
+
.image-generating-container .glass::after {
|
|
172
|
+
content: "";
|
|
173
|
+
position: absolute;
|
|
174
|
+
inset: 0;
|
|
175
|
+
--c: color-mix(in srgb, var(--color-text-base), transparent 97%);
|
|
176
|
+
--w: 0.0625rem;
|
|
177
|
+
--g: 0.1875rem;
|
|
178
|
+
background: repeating-linear-gradient(
|
|
179
|
+
var(--c), var(--c), var(--w), transparent var(--w), transparent calc(var(--w) + var(--g))
|
|
180
|
+
);
|
|
181
|
+
border-radius: var(--radius-xl);
|
|
182
|
+
}
|
|
183
|
+
.image-generating-container .rings {
|
|
184
|
+
aspect-ratio: 1;
|
|
185
|
+
border-radius: 50%;
|
|
186
|
+
position: absolute;
|
|
187
|
+
inset: 0;
|
|
188
|
+
perspective: calc(var(--s) * 2.75);
|
|
189
|
+
opacity: 0.9;
|
|
190
|
+
}
|
|
191
|
+
.image-generating-container .rings::before,
|
|
192
|
+
.image-generating-container .rings::after {
|
|
193
|
+
content: "";
|
|
194
|
+
position: absolute;
|
|
195
|
+
inset: 0;
|
|
196
|
+
border-radius: 50%;
|
|
197
|
+
--width-ratio: 1;
|
|
198
|
+
border: calc(var(--width) * var(--width-ratio)) solid transparent;
|
|
199
|
+
mask: linear-gradient(var(--color-image-generating-mask, var(--color-bg-base)) 0 0) padding-box, linear-gradient(var(--color-image-generating-mask, var(--color-bg-base)) 0 0);
|
|
200
|
+
background: linear-gradient(
|
|
201
|
+
var(--color-bg-base),
|
|
202
|
+
var(--color-primary),
|
|
203
|
+
var(--color-primary-active),
|
|
204
|
+
var(--color-primary-hover)
|
|
205
|
+
) border-box;
|
|
206
|
+
mask-composite: exclude;
|
|
207
|
+
animation: ring var(--duration) ease-in-out infinite;
|
|
208
|
+
--start: 180deg;
|
|
209
|
+
--value: var(--start);
|
|
210
|
+
--scale: 1;
|
|
211
|
+
transform: rotateY(var(--value)) rotateX(var(--value)) rotateZ(var(--value)) scale(var(--scale));
|
|
212
|
+
}
|
|
213
|
+
.image-generating-container .rings::before { --start: 180deg; }
|
|
214
|
+
.image-generating-container .rings::after { --start: 90deg; }
|
|
215
|
+
.image-generating-container .content-overlay {
|
|
216
|
+
position: absolute;
|
|
217
|
+
inset: 0;
|
|
218
|
+
display: flex;
|
|
219
|
+
flex-direction: column;
|
|
220
|
+
align-items: center;
|
|
221
|
+
justify-content: center;
|
|
222
|
+
gap: var(--spacing-3);
|
|
223
|
+
z-index: 2;
|
|
224
|
+
pointer-events: none;
|
|
225
|
+
}
|
|
226
|
+
.image-generating-container .content-overlay .caption {
|
|
227
|
+
font-size: var(--font-size-xs);
|
|
228
|
+
font-weight: 500;
|
|
229
|
+
color: var(--color-text-on-primary);
|
|
230
|
+
}
|
|
231
|
+
.image-generating-container .remaining-overlay {
|
|
232
|
+
background: var(--color-bg-mask);
|
|
233
|
+
border-radius: var(--radius-xl);
|
|
234
|
+
}
|
|
235
|
+
.image-generating-container .remaining-text {
|
|
236
|
+
font-size: var(--font-size-3xl);
|
|
237
|
+
font-weight: 600;
|
|
238
|
+
color: var(--color-text-on-primary);
|
|
239
|
+
}
|
|
240
|
+
`}</style>
|
|
241
|
+
<div
|
|
242
|
+
ref={containerRef}
|
|
243
|
+
className={cn('image-generating-container', className)}
|
|
244
|
+
style={{
|
|
245
|
+
['--container-width' as string]: width,
|
|
246
|
+
['--container-height' as string]: height,
|
|
247
|
+
['--image-generating-speed' as string]: String(speed),
|
|
248
|
+
...(styleProp && typeof styleProp === 'object' ? styleProp : {}),
|
|
249
|
+
}}
|
|
250
|
+
{...props}
|
|
251
|
+
>
|
|
252
|
+
<div className="fluid-inner">
|
|
253
|
+
<div className="c c4" style={{ ['--i' as string]: 0 }} />
|
|
254
|
+
<div className="c c1" style={{ ['--i' as string]: 1 }} />
|
|
255
|
+
<div className="c c2" style={{ ['--i' as string]: 2 }} />
|
|
256
|
+
<div className="c c3" style={{ ['--i' as string]: 3 }} />
|
|
257
|
+
<div className="rings" />
|
|
258
|
+
</div>
|
|
259
|
+
<div className="glass" />
|
|
260
|
+
{showOverlay ? (
|
|
261
|
+
<div className="content-overlay remaining-overlay">
|
|
262
|
+
<span className="remaining-text">{overlayText}</span>
|
|
263
|
+
</div>
|
|
264
|
+
) : (
|
|
265
|
+
<div className="content-overlay">
|
|
266
|
+
<motion.span
|
|
267
|
+
className="inline-flex items-center justify-center"
|
|
268
|
+
animate={{ scale: [1, 1.08, 1], opacity: [0.9, 1, 0.9] }}
|
|
269
|
+
transition={{ duration: 1.2, repeat: Infinity, ease: [0.16, 1, 0.3, 1] as const }}
|
|
270
|
+
>
|
|
271
|
+
{sparklingIcon}
|
|
272
|
+
</motion.span>
|
|
273
|
+
<span className={cn('caption', captionClassName)}>{caption}</span>
|
|
274
|
+
</div>
|
|
275
|
+
)}
|
|
276
|
+
</div>
|
|
277
|
+
</>
|
|
278
|
+
)
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
ImageGenerating.displayName = 'ImageGenerating'
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { Components } from 'react-markdown'
|
|
2
|
+
import ReactMarkdown from 'react-markdown'
|
|
3
|
+
import remarkGfm from 'remark-gfm'
|
|
4
|
+
import remarkMath from 'remark-math'
|
|
5
|
+
import rehypeKatex from 'rehype-katex'
|
|
6
|
+
import { cn } from '@/lib/utils'
|
|
7
|
+
import { Scrollbar } from '../basic/scrollbar'
|
|
8
|
+
|
|
9
|
+
export interface MarkdownBodyProps {
|
|
10
|
+
children: string
|
|
11
|
+
className?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const markdownComponents: Components = {
|
|
15
|
+
p: ({ children }) => (
|
|
16
|
+
<p className="text-sm leading-sm text-text [&:not(:first-child)]:mt-6 last:mb-0">{children}</p>
|
|
17
|
+
),
|
|
18
|
+
h1: ({ children }) => (
|
|
19
|
+
<h1 className="scroll-m-20 text-4xl font-medium tracking-tight text-text">{children}</h1>
|
|
20
|
+
),
|
|
21
|
+
h2: ({ children }) => (
|
|
22
|
+
<h2 className="scroll-m-20 border-b border-border-secondary pb-2 text-3xl font-semibold tracking-tight text-text first:mt-0 [&:not(:first-child)]:mt-10">
|
|
23
|
+
{children}
|
|
24
|
+
</h2>
|
|
25
|
+
),
|
|
26
|
+
h3: ({ children }) => (
|
|
27
|
+
<h3 className="scroll-m-20 text-2xl font-semibold tracking-tight text-text [&:not(:first-child)]:mt-8">
|
|
28
|
+
{children}
|
|
29
|
+
</h3>
|
|
30
|
+
),
|
|
31
|
+
h4: ({ children }) => (
|
|
32
|
+
<h4 className="scroll-m-20 text-xl font-semibold tracking-tight text-text [&:not(:first-child)]:mt-6">
|
|
33
|
+
{children}
|
|
34
|
+
</h4>
|
|
35
|
+
),
|
|
36
|
+
h5: ({ children }) => (
|
|
37
|
+
<h5 className="scroll-m-20 text-lg font-semibold tracking-tight text-text-secondary [&:not(:first-child)]:mt-4">
|
|
38
|
+
{children}
|
|
39
|
+
</h5>
|
|
40
|
+
),
|
|
41
|
+
h6: ({ children }) => (
|
|
42
|
+
<h6 className="scroll-m-20 text-base font-semibold tracking-tight text-text-tertiary uppercase [&:not(:first-child)]:mt-4">
|
|
43
|
+
{children}
|
|
44
|
+
</h6>
|
|
45
|
+
),
|
|
46
|
+
blockquote: ({ children }) => (
|
|
47
|
+
<blockquote className="mt-6 border-l-2 border-border-secondary pl-6 italic text-text-secondary">
|
|
48
|
+
{children}
|
|
49
|
+
</blockquote>
|
|
50
|
+
),
|
|
51
|
+
ul: ({ className, children }) => (
|
|
52
|
+
<ul
|
|
53
|
+
className={cn(
|
|
54
|
+
'my-6 ml-6 text-text [&>li]:mt-2',
|
|
55
|
+
String(className ?? '').includes('contains-task-list') ? 'list-none' : 'list-disc'
|
|
56
|
+
)}
|
|
57
|
+
>
|
|
58
|
+
{children}
|
|
59
|
+
</ul>
|
|
60
|
+
),
|
|
61
|
+
ol: ({ children }) => (
|
|
62
|
+
<ol className="my-6 ml-6 list-decimal text-text [&>li]:mt-2">{children}</ol>
|
|
63
|
+
),
|
|
64
|
+
li: ({ className, children }) => (
|
|
65
|
+
<li
|
|
66
|
+
className={cn(
|
|
67
|
+
'leading-sm',
|
|
68
|
+
String(className ?? '').includes('task-list-item') &&
|
|
69
|
+
'list-none flex items-start gap-2 [&>input]:mt-0.5 [&>input]:shrink-0'
|
|
70
|
+
)}
|
|
71
|
+
>
|
|
72
|
+
{children}
|
|
73
|
+
</li>
|
|
74
|
+
),
|
|
75
|
+
pre: ({ children }) => (
|
|
76
|
+
<Scrollbar
|
|
77
|
+
scrollbarVisibility="auto"
|
|
78
|
+
className="my-6 rounded-lg border border-border-tertiary bg-bg-base p-4 font-mono text-sm leading-sm text-text"
|
|
79
|
+
>
|
|
80
|
+
<pre className="m-0 font-mono text-sm leading-sm text-text border-0 bg-transparent p-0">
|
|
81
|
+
{children}
|
|
82
|
+
</pre>
|
|
83
|
+
</Scrollbar>
|
|
84
|
+
),
|
|
85
|
+
code: ({ className, children, ...props }) => {
|
|
86
|
+
const isBlock = typeof className === 'string' && className.startsWith('language-')
|
|
87
|
+
if (!isBlock) {
|
|
88
|
+
return (
|
|
89
|
+
<code
|
|
90
|
+
className="relative rounded bg-fill-tertiary px-[0.3rem] py-[0.2rem] font-mono text-sm leading-sm font-semibold text-text"
|
|
91
|
+
{...props}
|
|
92
|
+
>
|
|
93
|
+
{children}
|
|
94
|
+
</code>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
return (
|
|
98
|
+
<code className={cn(className, 'font-mono text-sm leading-sm')} {...props}>
|
|
99
|
+
{children}
|
|
100
|
+
</code>
|
|
101
|
+
)
|
|
102
|
+
},
|
|
103
|
+
table: ({ children }) => (
|
|
104
|
+
<Scrollbar
|
|
105
|
+
scrollbarVisibility="auto"
|
|
106
|
+
className="my-6 w-full rounded-md border border-border-secondary"
|
|
107
|
+
>
|
|
108
|
+
<table className="w-full border-collapse text-sm leading-sm text-text">{children}</table>
|
|
109
|
+
</Scrollbar>
|
|
110
|
+
),
|
|
111
|
+
thead: ({ children }) => (
|
|
112
|
+
<thead className="border-b border-border-secondary bg-fill-tertiary">{children}</thead>
|
|
113
|
+
),
|
|
114
|
+
tbody: ({ children }) => (
|
|
115
|
+
<tbody className="[&>tr]:border-b [&>tr]:border-border-tertiary">{children}</tbody>
|
|
116
|
+
),
|
|
117
|
+
tr: ({ children }) => <tr>{children}</tr>,
|
|
118
|
+
th: ({ children }) => (
|
|
119
|
+
<th className="px-4 py-2 text-left font-semibold text-text">{children}</th>
|
|
120
|
+
),
|
|
121
|
+
td: ({ children }) => <td className="px-4 py-2 text-text">{children}</td>,
|
|
122
|
+
a: ({ href, children }) => (
|
|
123
|
+
<a href={href} target="_blank" rel="noopener noreferrer" className="text-primary hover:underline">
|
|
124
|
+
{children}
|
|
125
|
+
</a>
|
|
126
|
+
),
|
|
127
|
+
hr: () => <hr className="my-6 border-0 border-t border-border-secondary" />,
|
|
128
|
+
strong: ({ children }) => <strong className="font-semibold text-text">{children}</strong>,
|
|
129
|
+
em: ({ children }) => <em className="italic text-text">{children}</em>,
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function MarkdownBody({ children, className }: MarkdownBodyProps) {
|
|
133
|
+
return (
|
|
134
|
+
<div className={cn('markdown-body text-sm leading-sm text-text', className)}>
|
|
135
|
+
<ReactMarkdown
|
|
136
|
+
remarkPlugins={[remarkGfm, remarkMath]}
|
|
137
|
+
rehypePlugins={[rehypeKatex]}
|
|
138
|
+
components={markdownComponents}
|
|
139
|
+
>
|
|
140
|
+
{children}
|
|
141
|
+
</ReactMarkdown>
|
|
142
|
+
</div>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
MarkdownBody.displayName = 'MarkdownBody'
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { useEffect, useId, useMemo, useState, useRef, type ReactNode } from 'react'
|
|
2
|
+
import { CollapsibleCard } from '../basic/collapsible-card'
|
|
3
|
+
import { Button } from '../basic/button'
|
|
4
|
+
import { FileList2Line } from '../basic/icons-inline'
|
|
5
|
+
import { Scrollbar } from '../basic/scrollbar'
|
|
6
|
+
import { useMermaidRender } from '../lib/use-mermaid-render'
|
|
7
|
+
|
|
8
|
+
const ICON_CLASS = 'w-[var(--font-size-sm)] h-[var(--font-size-sm)] shrink-0 text-text-secondary'
|
|
9
|
+
|
|
10
|
+
export interface MermaidPartProps {
|
|
11
|
+
content?: string
|
|
12
|
+
className?: string
|
|
13
|
+
headerIcon?: ReactNode
|
|
14
|
+
/** 布局风格,与 data-style 一致(如 soft/neutral/sharp),用于图表节点圆角等;不传则从 document 读取 */
|
|
15
|
+
dataStyle?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const defaultHeaderIcon = <FileList2Line className={ICON_CLASS} />
|
|
19
|
+
|
|
20
|
+
export function MermaidPart({ content = '', className, headerIcon, dataStyle }: MermaidPartProps) {
|
|
21
|
+
const id = useId()
|
|
22
|
+
const normalized = useMemo(() => (content ?? '').trim(), [content])
|
|
23
|
+
const { svg, error } = useMermaidRender(normalized, id, dataStyle)
|
|
24
|
+
const [scale, setScale] = useState(1)
|
|
25
|
+
const containerRef = useRef<HTMLDivElement>(null)
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!svg || error || !containerRef.current) return
|
|
29
|
+
const el = containerRef.current
|
|
30
|
+
const handleWheel = (e: WheelEvent) => {
|
|
31
|
+
if (e.ctrlKey || e.metaKey) {
|
|
32
|
+
e.preventDefault()
|
|
33
|
+
const delta = e.deltaY > 0 ? -0.1 : 0.1
|
|
34
|
+
setScale((prev) => Math.max(0.5, Math.min(3, Math.round((prev + delta) * 10) / 10)))
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
el.addEventListener('wheel', handleWheel, { passive: false })
|
|
38
|
+
return () => el.removeEventListener('wheel', handleWheel)
|
|
39
|
+
}, [svg, error])
|
|
40
|
+
|
|
41
|
+
const zoomIn = () => setScale((s) => Math.min(3, Math.round((s + 0.1) * 10) / 10))
|
|
42
|
+
const zoomOut = () => setScale((s) => Math.max(0.5, Math.round((s - 0.1) * 10) / 10))
|
|
43
|
+
const reset = () => setScale(1)
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<CollapsibleCard
|
|
47
|
+
headerIcon={headerIcon ?? defaultHeaderIcon}
|
|
48
|
+
headerTitle={<span className="text-text-secondary">Mermaid</span>}
|
|
49
|
+
headerRight={
|
|
50
|
+
svg && !error ? (
|
|
51
|
+
<div className="flex items-center gap-1" onClick={(e) => e.stopPropagation()}>
|
|
52
|
+
<Button variant="ghost" size="sm" onClick={(e) => { e.stopPropagation(); zoomOut() }} className="shrink-0 px-1.5 py-0.5 text-xs text-text-secondary hover:text-text" aria-label="Zoom out">−</Button>
|
|
53
|
+
<span className="text-xs text-text-secondary min-w-[var(--spacing-10)] text-center">{Math.round(scale * 100)}%</span>
|
|
54
|
+
<Button variant="ghost" size="sm" onClick={(e) => { e.stopPropagation(); reset() }} className="shrink-0 px-1.5 py-0.5 text-xs text-text-secondary hover:text-text" aria-label="Reset">Reset</Button>
|
|
55
|
+
<Button variant="ghost" size="sm" onClick={(e) => { e.stopPropagation(); zoomIn() }} className="shrink-0 px-1.5 py-0.5 text-xs text-text-secondary hover:text-text" aria-label="Zoom in">+</Button>
|
|
56
|
+
</div>
|
|
57
|
+
) : undefined
|
|
58
|
+
}
|
|
59
|
+
contentPadding="var(--spacing-1\.5) var(--spacing-2)"
|
|
60
|
+
className={className}
|
|
61
|
+
>
|
|
62
|
+
{!normalized ? (
|
|
63
|
+
<div className="text-xs text-text-tertiary">Mermaid content is empty.</div>
|
|
64
|
+
) : error ? (
|
|
65
|
+
<div className="space-y-2">
|
|
66
|
+
<div className="text-xs text-text-secondary">Mermaid render unavailable.</div>
|
|
67
|
+
<div className="text-xs text-text-tertiary">{error}</div>
|
|
68
|
+
<pre className="m-0 whitespace-pre-wrap break-words font-mono text-xs text-text">{normalized}</pre>
|
|
69
|
+
</div>
|
|
70
|
+
) : (
|
|
71
|
+
<div className="relative" ref={containerRef}>
|
|
72
|
+
<Scrollbar
|
|
73
|
+
scrollbarVisibility="auto"
|
|
74
|
+
maxHeight={600}
|
|
75
|
+
className="overflow-x-auto"
|
|
76
|
+
>
|
|
77
|
+
<div
|
|
78
|
+
className="flex justify-center items-center"
|
|
79
|
+
style={{ transform: `scale(${scale})`, transformOrigin: 'center top', minHeight: scale > 1 ? '100%' : 'auto' }}
|
|
80
|
+
>
|
|
81
|
+
<div dangerouslySetInnerHTML={{ __html: svg }} />
|
|
82
|
+
</div>
|
|
83
|
+
</Scrollbar>
|
|
84
|
+
</div>
|
|
85
|
+
)}
|
|
86
|
+
</CollapsibleCard>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
MermaidPart.displayName = 'MermaidPart'
|