sparkdesign 0.0.1 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +279 -5
- package/cli/dist/commands/add.js +84 -0
- package/cli/dist/commands/diff.js +54 -0
- package/cli/dist/commands/init.js +96 -0
- package/cli/dist/commands/list.js +25 -0
- package/cli/dist/index.js +37 -0
- package/cli/dist/utils/config.js +53 -0
- package/cli/dist/utils/registry.js +34 -0
- package/cli/dist/utils/tokens.js +90 -0
- package/cli/dist/utils/transform.js +19 -0
- package/cli/registry/basic/alert-dialog.tsx +180 -0
- package/cli/registry/basic/avatar.tsx +120 -0
- package/cli/registry/basic/button.tsx +100 -0
- package/cli/registry/basic/collapse.tsx +94 -0
- package/cli/registry/basic/collapsible-card.tsx +230 -0
- package/cli/registry/basic/collapsible.tsx +21 -0
- package/cli/registry/basic/dropdown-menu.tsx +254 -0
- package/cli/registry/basic/icon-button.tsx +66 -0
- package/cli/registry/basic/icons-inline.tsx +206 -0
- package/cli/registry/basic/kbd.tsx +50 -0
- package/cli/registry/basic/option-list.tsx +125 -0
- package/cli/registry/basic/pagination.tsx +132 -0
- package/cli/registry/basic/progress.tsx +42 -0
- package/cli/registry/basic/radio-group.tsx +69 -0
- package/cli/registry/basic/resizable.tsx +67 -0
- package/cli/registry/basic/scrollbar.tsx +114 -0
- package/cli/registry/basic/select.tsx +177 -0
- package/cli/registry/basic/skeleton.tsx +33 -0
- package/cli/registry/basic/slider.tsx +55 -0
- package/cli/registry/basic/sonner.tsx +104 -0
- package/cli/registry/basic/spinner.tsx +17 -0
- package/cli/registry/basic/switch.tsx +49 -0
- package/cli/registry/basic/table.tsx +117 -0
- package/cli/registry/basic/tabs.tsx +85 -0
- package/cli/registry/basic/tag.tsx +161 -0
- package/cli/registry/basic/theme-from-document.ts +10 -0
- package/cli/registry/basic/toggle.tsx +223 -0
- package/cli/registry/basic/tooltip.tsx +80 -0
- package/cli/registry/basic/typography.tsx +201 -0
- package/cli/registry/chat/browser-use-part.tsx +166 -0
- package/cli/registry/chat/chat-input/chat-input-folder-selector.tsx +185 -0
- package/cli/registry/chat/chat-input/chat-input-model-switcher.tsx +131 -0
- package/cli/registry/chat/chat-input/chat-input-textarea.tsx +67 -0
- package/cli/registry/chat/chat-input/compound.tsx +334 -0
- package/cli/registry/chat/chat-input/context.tsx +189 -0
- package/cli/registry/chat/chat-input/folder-permission-dialog.tsx +61 -0
- package/cli/registry/chat/chat-input/index.tsx +123 -0
- package/cli/registry/chat/chat-input/types.ts +77 -0
- package/cli/registry/chat/chat-input/useAutoResizeTextarea.ts +20 -0
- package/cli/registry/chat/code-block-part.tsx +151 -0
- package/cli/registry/chat/file-attachment.tsx +44 -0
- package/cli/registry/chat/file-card.tsx +68 -0
- package/cli/registry/chat/file-review-part.tsx +259 -0
- package/cli/registry/chat/folder-button.tsx +169 -0
- package/cli/registry/chat/generated-images-grid.tsx +56 -0
- package/cli/registry/chat/generation-status-bar.tsx +72 -0
- package/cli/registry/chat/image-attachment.tsx +166 -0
- package/cli/registry/chat/image-generating.tsx +281 -0
- package/cli/registry/chat/markdown.tsx +146 -0
- package/cli/registry/chat/mermaid-part.tsx +90 -0
- package/cli/registry/chat/permission-card.tsx +178 -0
- package/cli/registry/chat/plan-part.tsx +168 -0
- package/cli/registry/chat/question-part.tsx +70 -0
- package/cli/registry/chat/queue-indicator.tsx +234 -0
- package/cli/registry/chat/reasoning-step.tsx +358 -0
- package/cli/registry/chat/related-prompts.tsx +91 -0
- package/cli/registry/chat/request.tsx +38 -0
- package/cli/registry/chat/response.tsx +271 -0
- package/cli/registry/chat/send-button.tsx +94 -0
- package/cli/registry/chat/sidebar-menu.tsx +177 -0
- package/cli/registry/chat/streaming-markdown-block.tsx +111 -0
- package/cli/registry/chat/suggestion-part.tsx +165 -0
- package/cli/registry/chat/task-part.tsx +109 -0
- package/cli/registry/chat/terminal-code-block-part.tsx +69 -0
- package/cli/registry/chat/thinking-indicator.tsx +91 -0
- package/cli/registry/chat/tool-invocation-card.tsx +132 -0
- package/cli/registry/chat/user-question/UserQuestionCard.tsx +198 -0
- package/cli/registry/chat/user-question/UserQuestionFooter.tsx +66 -0
- package/cli/registry/chat/user-question/UserQuestionHeader.tsx +64 -0
- package/cli/registry/chat/user-question/index.tsx +340 -0
- package/cli/registry/chat/user-question/types.ts +61 -0
- package/cli/registry/chat/user-question/useUserQuestionKeyboard.ts +127 -0
- package/cli/registry/chat/user-question/useUserQuestionState.ts +165 -0
- package/cli/registry/chat/user-question-answer.tsx +62 -0
- package/cli/registry/lib/file-icon-maps.ts +150 -0
- package/cli/registry/lib/use-mermaid-render.ts +76 -0
- package/cli/registry/lib/utils.ts +6 -0
- package/cli/registry/meta.json +1 -0
- package/cli/registry/tokens/scale.css +299 -0
- package/cli/registry/tokens/theme.css +633 -0
- package/dist/_basePickBy-DnQN8w3y.js +151 -0
- package/dist/_basePickBy-a-kPMlkg.cjs +1 -0
- package/dist/_baseUniq-B-N2NQ50.js +614 -0
- package/dist/_baseUniq-Cc_zbSif.cjs +1 -0
- package/dist/arc-BQBhijZ6.js +83 -0
- package/dist/arc-mWQt0Yph.cjs +1 -0
- package/dist/architectureDiagram-VXUJARFQ-BMZEucno.cjs +36 -0
- package/dist/architectureDiagram-VXUJARFQ-DTdjD3Bp.js +4661 -0
- package/dist/blockDiagram-VD42YOAC-CzHn0yob.js +2256 -0
- package/dist/blockDiagram-VD42YOAC-DDxdHAlz.cjs +122 -0
- package/dist/c4Diagram-YG6GDRKO-4Gz0I4gj.cjs +10 -0
- package/dist/c4Diagram-YG6GDRKO-BIy--yVN.js +1580 -0
- package/dist/channel-BQn0o8bs.js +5 -0
- package/dist/channel-DaN7XniJ.cjs +1 -0
- package/dist/chunk-4BX2VUAB-BlQFTQqz.cjs +1 -0
- package/dist/chunk-4BX2VUAB-Czitj3Kc.js +8 -0
- package/dist/chunk-55IACEB6-DXacNZbO.js +8 -0
- package/dist/chunk-55IACEB6-DnDxpye9.cjs +1 -0
- package/dist/chunk-B4BG7PRW-CBdN0q_V.js +1375 -0
- package/dist/chunk-B4BG7PRW-DbGvUkGO.cjs +165 -0
- package/dist/chunk-DI55MBZ5-D1YJMs6x.cjs +220 -0
- package/dist/chunk-DI55MBZ5-NCQTvayw.js +1370 -0
- package/dist/chunk-FMBD7UC4-CsGMbrtr.js +19 -0
- package/dist/chunk-FMBD7UC4-Di7cUUh5.cjs +15 -0
- package/dist/chunk-QN33PNHL-0j5LC8Lm.cjs +1 -0
- package/dist/chunk-QN33PNHL-3GERZBRm.js +19 -0
- package/dist/chunk-QZHKN3VN-AVEY9ImQ.js +15 -0
- package/dist/chunk-QZHKN3VN-s8Z0a8mc.cjs +1 -0
- package/dist/chunk-TZMSLE5B-CAf87HPt.cjs +1 -0
- package/dist/chunk-TZMSLE5B-sbiflal0.js +64 -0
- package/dist/classDiagram-2ON5EDUG-Ct9JLIN2.cjs +1 -0
- package/dist/classDiagram-2ON5EDUG-Dzfrft3a.js +16 -0
- package/dist/classDiagram-v2-WZHVMYZB-Ct9JLIN2.cjs +1 -0
- package/dist/classDiagram-v2-WZHVMYZB-Dzfrft3a.js +16 -0
- package/dist/clone-Cde_NQ8V.js +8 -0
- package/dist/clone-DCNjWuM2.cjs +1 -0
- package/dist/cose-bilkent-S5V4N54A-0uLijMro.cjs +1 -0
- package/dist/cose-bilkent-S5V4N54A-Bb08N431.js +2608 -0
- package/dist/cytoscape.esm-CNUX3VTg.cjs +321 -0
- package/dist/cytoscape.esm-Cvf3sx9F.js +18704 -0
- package/dist/dagre-6UL2VRFP-CY_Wz5Zd.js +444 -0
- package/dist/dagre-6UL2VRFP-Dxe7_qZc.cjs +4 -0
- package/dist/defaultLocale-BgPVtth8.js +171 -0
- package/dist/defaultLocale-C4wbwF1n.cjs +1 -0
- package/dist/diagram-PSM6KHXK-D2bdb7MT.js +531 -0
- package/dist/diagram-PSM6KHXK-YF69SUjY.cjs +24 -0
- package/dist/diagram-QEK2KX5R-BpUSoh0-.js +217 -0
- package/dist/diagram-QEK2KX5R-DZPGteon.cjs +43 -0
- package/dist/diagram-S2PKOQOG-ht-zdvFG.cjs +24 -0
- package/dist/diagram-S2PKOQOG-zFeLJ50Z.js +142 -0
- package/dist/erDiagram-Q2GNP2WA-B38iJ6ts.js +841 -0
- package/dist/erDiagram-Q2GNP2WA-RgS80DDU.cjs +60 -0
- package/dist/flowDiagram-NV44I4VS-BHilOs2p.cjs +162 -0
- package/dist/flowDiagram-NV44I4VS-BrBJcoce.js +1620 -0
- package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/ganttDiagram-JELNMOA3-pZiJeFio.cjs +267 -0
- package/dist/ganttDiagram-JELNMOA3-tw6FhkWJ.js +2670 -0
- package/dist/gitGraphDiagram-V2S2FVAM-BWn5uIK5.js +699 -0
- package/dist/gitGraphDiagram-V2S2FVAM-DKKeG-9R.cjs +65 -0
- package/dist/graph-DIbblrZP.cjs +1 -0
- package/dist/graph-DPcK91G3.js +247 -0
- package/dist/infoDiagram-HS3SLOUP-B8gwwhct.cjs +2 -0
- package/dist/infoDiagram-HS3SLOUP-D47PNcP_.js +24 -0
- package/dist/init-CHZsXQcr.cjs +1 -0
- package/dist/init-DjUOC4st.js +16 -0
- package/dist/journeyDiagram-XKPGCS4Q-BG3cfhyU.js +834 -0
- package/dist/journeyDiagram-XKPGCS4Q-D8DVLJof.cjs +139 -0
- package/dist/kanban-definition-3W4ZIXB7-4OCnEouP.cjs +89 -0
- package/dist/kanban-definition-3W4ZIXB7-CWi_ssF9.js +719 -0
- package/dist/katex.css +1 -0
- package/dist/layout-Byuh8f-J.cjs +1 -0
- package/dist/layout-CdLdvj1j.js +1335 -0
- package/dist/linear-C2Q_PI9B.js +259 -0
- package/dist/linear-C69aPBW1.cjs +1 -0
- package/dist/mermaid.core-DBwAx_jp.cjs +249 -0
- package/dist/mermaid.core-gFR0XUlD.js +15300 -0
- package/dist/mindmap-definition-VGOIOE7T-8P7obVV4.cjs +68 -0
- package/dist/mindmap-definition-VGOIOE7T-DnOa7WJ9.js +784 -0
- package/dist/ordinal-B6-f3MAq.js +61 -0
- package/dist/ordinal-CagbB1m8.cjs +1 -0
- package/dist/pieDiagram-ADFJNKIX-5NAlvhMo.js +161 -0
- package/dist/pieDiagram-ADFJNKIX-CQBG4yR9.cjs +30 -0
- package/dist/qoder-design.css +2 -0
- package/dist/quadrantDiagram-AYHSOK5B-Oe4y7RZ0.cjs +7 -0
- package/dist/quadrantDiagram-AYHSOK5B-rh2DPEP1.js +1022 -0
- package/dist/registry/basic/alert-dialog.d.ts +40 -0
- package/dist/registry/basic/avatar.d.ts +30 -0
- package/dist/registry/basic/button.d.ts +16 -0
- package/dist/registry/basic/collapse.d.ts +22 -0
- package/dist/registry/basic/collapsible-card.d.ts +34 -0
- package/dist/registry/basic/collapsible.d.ts +15 -0
- package/dist/registry/basic/dropdown-menu.d.ts +52 -0
- package/dist/registry/basic/icon-button.d.ts +12 -0
- package/dist/registry/basic/icons-inline.d.ts +51 -0
- package/dist/registry/basic/kbd.d.ts +23 -0
- package/dist/registry/basic/option-list.d.ts +16 -0
- package/dist/registry/basic/pagination.d.ts +33 -0
- package/dist/registry/basic/progress.d.ts +18 -0
- package/dist/registry/basic/radio-group.d.ts +25 -0
- package/dist/registry/basic/resizable.d.ts +318 -0
- package/dist/registry/basic/scrollbar.d.ts +12 -0
- package/dist/registry/basic/select.d.ts +35 -0
- package/dist/registry/basic/skeleton.d.ts +10 -0
- package/dist/registry/basic/slider.d.ts +16 -0
- package/dist/registry/basic/sonner.d.ts +23 -0
- package/dist/registry/basic/spinner.d.ts +5 -0
- package/dist/registry/basic/switch.d.ts +20 -0
- package/dist/registry/basic/table.d.ts +18 -0
- package/dist/registry/basic/tabs.d.ts +29 -0
- package/dist/registry/basic/tag.d.ts +23 -0
- package/dist/registry/basic/theme-from-document.d.ts +10 -0
- package/dist/registry/basic/toggle.d.ts +29 -0
- package/dist/registry/basic/tooltip.d.ts +34 -0
- package/dist/registry/basic/typography.d.ts +76 -0
- package/dist/registry/chat/browser-use-part.d.ts +28 -0
- package/dist/registry/chat/chat-input/chat-input-folder-selector.d.ts +22 -0
- package/dist/registry/chat/chat-input/chat-input-model-switcher.d.ts +12 -0
- package/dist/registry/chat/chat-input/chat-input-textarea.d.ts +9 -0
- package/dist/registry/chat/chat-input/compound.d.ts +97 -0
- package/dist/registry/chat/chat-input/context.d.ts +64 -0
- package/dist/registry/chat/chat-input/folder-permission-dialog.d.ts +11 -0
- package/dist/registry/chat/chat-input/index.d.ts +34 -0
- package/dist/registry/chat/chat-input/types.d.ts +79 -0
- package/dist/registry/chat/chat-input/useAutoResizeTextarea.d.ts +7 -0
- package/dist/registry/chat/code-block-part.d.ts +23 -0
- package/dist/registry/chat/file-attachment.d.ts +19 -0
- package/dist/registry/chat/file-card.d.ts +10 -0
- package/dist/registry/chat/file-review-part.d.ts +30 -0
- package/dist/registry/chat/folder-button.d.ts +20 -0
- package/dist/registry/chat/generated-images-grid.d.ts +15 -0
- package/dist/registry/chat/generation-status-bar.d.ts +19 -0
- package/dist/registry/chat/image-attachment.d.ts +19 -0
- package/dist/registry/chat/image-generating.d.ts +15 -0
- package/dist/registry/chat/markdown.d.ts +8 -0
- package/dist/registry/chat/mermaid-part.d.ts +17 -0
- package/dist/registry/chat/permission-card.d.ts +24 -0
- package/dist/registry/chat/plan-part.d.ts +30 -0
- package/dist/registry/chat/question-part.d.ts +24 -0
- package/dist/registry/chat/queue-indicator.d.ts +27 -0
- package/dist/registry/chat/reasoning-step.d.ts +35 -0
- package/dist/registry/chat/related-prompts.d.ts +23 -0
- package/dist/registry/chat/request.d.ts +6 -0
- package/dist/registry/chat/response.d.ts +28 -0
- package/dist/registry/chat/send-button.d.ts +17 -0
- package/dist/registry/chat/sidebar-menu.d.ts +23 -0
- package/dist/registry/chat/streaming-markdown-block.d.ts +8 -0
- package/dist/registry/chat/suggestion-part.d.ts +28 -0
- package/dist/registry/chat/task-part.d.ts +28 -0
- package/dist/registry/chat/terminal-code-block-part.d.ts +18 -0
- package/dist/registry/chat/thinking-indicator.d.ts +14 -0
- package/dist/registry/chat/tool-invocation-card.d.ts +20 -0
- package/dist/registry/chat/user-question/UserQuestionCard.d.ts +30 -0
- package/dist/registry/chat/user-question/UserQuestionFooter.d.ts +18 -0
- package/dist/registry/chat/user-question/UserQuestionHeader.d.ts +20 -0
- package/dist/registry/chat/user-question/index.d.ts +7 -0
- package/dist/registry/chat/user-question/types.d.ts +52 -0
- package/dist/registry/chat/user-question/useUserQuestionKeyboard.d.ts +18 -0
- package/dist/registry/chat/user-question/useUserQuestionState.d.ts +26 -0
- package/dist/registry/chat/user-question-answer.d.ts +13 -0
- package/dist/registry/lib/file-icon-maps.d.ts +20 -0
- package/dist/registry/lib/use-mermaid-render.d.ts +5 -0
- package/dist/registry/lib/utils.d.ts +11 -0
- package/dist/requirementDiagram-UZGBJVZJ-DcWaCuXr.js +850 -0
- package/dist/requirementDiagram-UZGBJVZJ-gfdlrFiq.cjs +64 -0
- package/dist/sankeyDiagram-TZEHDZUN-CQIKFwD0.js +810 -0
- package/dist/sankeyDiagram-TZEHDZUN-DvPtzQvC.cjs +10 -0
- package/dist/scale.css +307 -0
- package/dist/sequenceDiagram-WL72ISMW-BNrsMagL.cjs +145 -0
- package/dist/sequenceDiagram-WL72ISMW-iCX3ckKx.js +2511 -0
- package/dist/spark-design.cjs.js +265 -0
- package/dist/spark-design.es.js +13207 -0
- package/dist/src/components/chat/BrowserUsePart/index.d.ts +7 -0
- package/dist/src/components/chat/ChatInput/index.d.ts +29 -0
- package/dist/src/components/chat/CodeBlockPart/index.d.ts +7 -0
- package/dist/src/components/chat/CollapsibleCard/index.d.ts +7 -0
- package/dist/src/components/chat/FileAttachment/index.d.ts +3 -0
- package/dist/src/components/chat/FileCard/index.d.ts +3 -0
- package/dist/src/components/chat/FileReviewPart/index.d.ts +7 -0
- package/dist/src/components/chat/FolderButton/index.d.ts +5 -0
- package/dist/src/components/chat/GeneratedImagesGrid/index.d.ts +7 -0
- package/dist/src/components/chat/GenerationStatusBar/index.d.ts +7 -0
- package/dist/src/components/chat/ImageAttachment/index.d.ts +3 -0
- package/dist/src/components/chat/ImageGenerating/index.d.ts +6 -0
- package/dist/src/components/chat/Markdown/demo-content.d.ts +1 -0
- package/dist/src/components/chat/Markdown/index.d.ts +7 -0
- package/dist/src/components/chat/MermaidPart/index.d.ts +6 -0
- package/dist/src/components/chat/PermissionCard/index.d.ts +4 -0
- package/dist/src/components/chat/PlanPart/index.d.ts +6 -0
- package/dist/src/components/chat/QuestionPart/index.d.ts +6 -0
- package/dist/src/components/chat/QueueIndicator/index.d.ts +4 -0
- package/dist/src/components/chat/ReasoningStep/index.d.ts +7 -0
- package/dist/src/components/chat/RelatedPrompts/index.d.ts +6 -0
- package/dist/src/components/chat/Request/index.d.ts +7 -0
- package/dist/src/components/chat/Response/StreamingMarkdownBlock.d.ts +6 -0
- package/dist/src/components/chat/Response/index.d.ts +6 -0
- package/dist/src/components/chat/SendButton/index.d.ts +5 -0
- package/dist/src/components/chat/SidebarMenu/index.d.ts +4 -0
- package/dist/src/components/chat/SuggestionPart/index.d.ts +6 -0
- package/dist/src/components/chat/TaskPart/index.d.ts +7 -0
- package/dist/src/components/chat/TerminalCodeBlockPart/index.d.ts +6 -0
- package/dist/src/components/chat/ThinkingIndicator/index.d.ts +6 -0
- package/dist/src/components/chat/ToolInvocationCard/index.d.ts +4 -0
- package/dist/src/components/chat/UserQuestion/index.d.ts +5 -0
- package/dist/src/components/chat/UserQuestionAnswer/index.d.ts +3 -0
- package/dist/src/components/foundation/AlertDialog/index.d.ts +20 -0
- package/dist/src/components/foundation/Avatar/index.d.ts +7 -0
- package/dist/src/components/foundation/Button/index.d.ts +7 -0
- package/dist/src/components/foundation/Collapse/index.d.ts +15 -0
- package/dist/src/components/foundation/Collapsible/index.d.ts +7 -0
- package/dist/src/components/foundation/CollapsibleSection/index.d.ts +43 -0
- package/dist/src/components/foundation/DropdownMenu/index.d.ts +19 -0
- package/dist/src/components/foundation/EllipsisText/index.d.ts +53 -0
- package/dist/src/components/foundation/IconButton/index.d.ts +7 -0
- package/dist/src/components/foundation/Kbd/index.d.ts +7 -0
- package/dist/src/components/foundation/OptionList/index.d.ts +7 -0
- package/dist/src/components/foundation/Pagination/index.d.ts +7 -0
- package/dist/src/components/foundation/Progress/index.d.ts +7 -0
- package/dist/src/components/foundation/RadioGroup/index.d.ts +7 -0
- package/dist/src/components/foundation/Resizable/index.d.ts +7 -0
- package/dist/src/components/foundation/Scrollbar/index.d.ts +7 -0
- package/dist/src/components/foundation/Select/index.d.ts +17 -0
- package/dist/src/components/foundation/Skeleton/index.d.ts +7 -0
- package/dist/src/components/foundation/Slider/index.d.ts +7 -0
- package/dist/src/components/foundation/Spinner/index.d.ts +7 -0
- package/dist/src/components/foundation/Switch/index.d.ts +38 -0
- package/dist/src/components/foundation/Table/index.d.ts +7 -0
- package/dist/src/components/foundation/Tabs/index.d.ts +7 -0
- package/dist/src/components/foundation/Tag/index.d.ts +10 -0
- package/dist/src/components/foundation/Toast/index.d.ts +12 -0
- package/dist/src/components/foundation/Toggle/index.d.ts +7 -0
- package/dist/src/components/foundation/Tooltip/index.d.ts +21 -0
- package/dist/src/components/foundation/Typography/index.d.ts +7 -0
- package/dist/src/components/index.d.ts +136 -0
- package/dist/src/icons/context.d.ts +26 -0
- package/dist/src/icons/types.d.ts +18 -0
- package/dist/src/lib/ThemeStyleContext.d.ts +21 -0
- package/dist/src/lib/file-icon.d.ts +16 -0
- package/dist/src/lib/i18n.d.ts +12 -0
- package/dist/src/lib/index.d.ts +10 -0
- package/dist/src/lib/motion.d.ts +22 -0
- package/dist/src/lib/utils.d.ts +11 -0
- package/dist/stateDiagram-FKZM4ZOC-DBvJ_eeL.cjs +1 -0
- package/dist/stateDiagram-FKZM4ZOC-ZVsJlaHJ.js +263 -0
- package/dist/stateDiagram-v2-4FDKWEC3-CB_nTHcE.js +16 -0
- package/dist/stateDiagram-v2-4FDKWEC3-Xkx17v6T.cjs +1 -0
- package/dist/theme.css +804 -0
- package/dist/timeline-definition-IT6M3QCI-BmGkYQiz.cjs +61 -0
- package/dist/timeline-definition-IT6M3QCI-Ck8zTt6w.js +795 -0
- package/dist/treemap-GDKQZRPO-B9sfERx8.js +17922 -0
- package/dist/treemap-GDKQZRPO-BVfJRs0Z.cjs +160 -0
- package/dist/xychartDiagram-PRI3JC2R-By_S8NzN.js +1340 -0
- package/dist/xychartDiagram-PRI3JC2R-CNfDrGxM.cjs +7 -0
- package/package.json +111 -9
- package/index.js +0 -5
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { Group, Panel, Separator } from 'react-resizable-panels'
|
|
3
|
+
import type { GroupProps, PanelProps, SeparatorProps } from 'react-resizable-panels'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
export interface ResizablePanelGroupProps
|
|
7
|
+
extends Omit<GroupProps, 'orientation'> {
|
|
8
|
+
direction?: 'horizontal' | 'vertical'
|
|
9
|
+
className?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const ResizablePanelGroup = React.forwardRef<HTMLDivElement, ResizablePanelGroupProps>(
|
|
13
|
+
function ResizablePanelGroup({ direction = 'horizontal', className, ...props }, ref) {
|
|
14
|
+
return (
|
|
15
|
+
<Group
|
|
16
|
+
elementRef={ref}
|
|
17
|
+
orientation={direction}
|
|
18
|
+
className={cn('flex h-full w-full', direction === 'vertical' && 'flex-col', className)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
ResizablePanelGroup.displayName = 'ResizablePanelGroup'
|
|
25
|
+
|
|
26
|
+
export type ResizablePanelProps = PanelProps
|
|
27
|
+
|
|
28
|
+
const ResizablePanel = React.forwardRef<HTMLDivElement, ResizablePanelProps>(
|
|
29
|
+
function ResizablePanel({ className, ...props }, ref) {
|
|
30
|
+
return <Panel elementRef={ref} className={cn(className)} {...props} />
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
ResizablePanel.displayName = 'ResizablePanel'
|
|
34
|
+
|
|
35
|
+
export interface ResizableHandleProps extends SeparatorProps {
|
|
36
|
+
withHandle?: boolean
|
|
37
|
+
className?: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const ResizableHandle = React.forwardRef<HTMLDivElement, ResizableHandleProps>(
|
|
41
|
+
function ResizableHandle({ withHandle = false, className, ...props }, ref) {
|
|
42
|
+
return (
|
|
43
|
+
<Separator
|
|
44
|
+
elementRef={ref}
|
|
45
|
+
className={cn(
|
|
46
|
+
'relative flex shrink-0 items-center justify-center bg-border-tertiary',
|
|
47
|
+
'after:absolute after:inset-0 after:transition-colors',
|
|
48
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1',
|
|
49
|
+
'data-[resize-handle-active]:bg-border-secondary',
|
|
50
|
+
'aria-[orientation=vertical]:h-full aria-[orientation=vertical]:w-px aria-[orientation=vertical]:cursor-col-resize',
|
|
51
|
+
'aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:cursor-row-resize',
|
|
52
|
+
'[&[aria-orientation=vertical]>div]:h-6 [&[aria-orientation=vertical]>div]:w-1',
|
|
53
|
+
'[&[aria-orientation=horizontal]>div]:h-1 [&[aria-orientation=horizontal]>div]:w-6',
|
|
54
|
+
className
|
|
55
|
+
)}
|
|
56
|
+
{...props}
|
|
57
|
+
>
|
|
58
|
+
{withHandle && (
|
|
59
|
+
<div className="z-10 shrink-0 rounded-lg bg-border-secondary" data-resize-handle />
|
|
60
|
+
)}
|
|
61
|
+
</Separator>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
ResizableHandle.displayName = 'ResizableHandle'
|
|
66
|
+
|
|
67
|
+
export { ResizablePanelGroup, ResizablePanel, ResizableHandle }
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { forwardRef, useId, useRef, useState, useCallback, useEffect } from 'react'
|
|
2
|
+
import type { ReactNode, CSSProperties } from 'react'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
export type ScrollbarVisibility = 'auto' | 'always' | 'hidden'
|
|
6
|
+
|
|
7
|
+
export interface ScrollbarProps {
|
|
8
|
+
children: ReactNode
|
|
9
|
+
className?: string
|
|
10
|
+
style?: CSSProperties
|
|
11
|
+
maxHeight?: number | string
|
|
12
|
+
/** auto: 默认透明,滚动时与 hover 时可见;always: 始终可见;hidden: 隐藏 */
|
|
13
|
+
scrollbarVisibility?: ScrollbarVisibility
|
|
14
|
+
scrollbarWidth?: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const Scrollbar = forwardRef<HTMLDivElement, ScrollbarProps>(
|
|
18
|
+
function Scrollbar(
|
|
19
|
+
{
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
style,
|
|
23
|
+
maxHeight,
|
|
24
|
+
scrollbarVisibility = 'auto',
|
|
25
|
+
scrollbarWidth = 6,
|
|
26
|
+
},
|
|
27
|
+
ref
|
|
28
|
+
) {
|
|
29
|
+
const scrollId = useId().replace(/:/g, '')
|
|
30
|
+
const scrollClassName = `Scrollbar-${scrollId}`
|
|
31
|
+
const scrollEndTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
32
|
+
const [isScrolling, setIsScrolling] = useState(false)
|
|
33
|
+
|
|
34
|
+
const handleScroll = useCallback(() => {
|
|
35
|
+
if (scrollbarVisibility !== 'auto') return
|
|
36
|
+
setIsScrolling(true)
|
|
37
|
+
if (scrollEndTimerRef.current) clearTimeout(scrollEndTimerRef.current)
|
|
38
|
+
scrollEndTimerRef.current = setTimeout(() => {
|
|
39
|
+
scrollEndTimerRef.current = null
|
|
40
|
+
setIsScrolling(false)
|
|
41
|
+
}, 800)
|
|
42
|
+
}, [scrollbarVisibility])
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
return () => {
|
|
46
|
+
if (scrollEndTimerRef.current) clearTimeout(scrollEndTimerRef.current)
|
|
47
|
+
}
|
|
48
|
+
}, [])
|
|
49
|
+
|
|
50
|
+
const getScrollbarStyles = () => {
|
|
51
|
+
if (scrollbarVisibility === 'hidden') {
|
|
52
|
+
return `
|
|
53
|
+
.${scrollClassName}::-webkit-scrollbar { display: none; }
|
|
54
|
+
.${scrollClassName} { scrollbar-width: none; }
|
|
55
|
+
`
|
|
56
|
+
}
|
|
57
|
+
const isAuto = scrollbarVisibility === 'auto'
|
|
58
|
+
const thumbColor =
|
|
59
|
+
scrollbarVisibility === 'always'
|
|
60
|
+
? 'var(--color-fill-secondary)'
|
|
61
|
+
: 'transparent'
|
|
62
|
+
const thumbHoverColor = 'var(--color-fill-secondary)'
|
|
63
|
+
const autoVisible = isAuto
|
|
64
|
+
? `
|
|
65
|
+
.${scrollClassName}:hover::-webkit-scrollbar-thumb,
|
|
66
|
+
.${scrollClassName}.Scrollbar-isScrolling::-webkit-scrollbar-thumb {
|
|
67
|
+
background-color: ${thumbHoverColor};
|
|
68
|
+
}
|
|
69
|
+
`
|
|
70
|
+
: `
|
|
71
|
+
.${scrollClassName}:hover::-webkit-scrollbar-thumb {
|
|
72
|
+
background-color: ${thumbHoverColor};
|
|
73
|
+
}
|
|
74
|
+
`
|
|
75
|
+
return `
|
|
76
|
+
.${scrollClassName}::-webkit-scrollbar {
|
|
77
|
+
width: ${scrollbarWidth}px !important;
|
|
78
|
+
height: ${scrollbarWidth}px !important;
|
|
79
|
+
}
|
|
80
|
+
.${scrollClassName}::-webkit-scrollbar-track { background: transparent; }
|
|
81
|
+
.${scrollClassName}::-webkit-scrollbar-thumb {
|
|
82
|
+
background-color: ${thumbColor};
|
|
83
|
+
border-radius: ${Math.max(scrollbarWidth / 2, 2)}px;
|
|
84
|
+
min-height: var(--spacing-8);
|
|
85
|
+
transition: background-color 0.2s ease;
|
|
86
|
+
}
|
|
87
|
+
${autoVisible}
|
|
88
|
+
.${scrollClassName}::-webkit-scrollbar-corner { background: transparent; }
|
|
89
|
+
`
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const computedStyle: CSSProperties = { ...style, maxHeight }
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<>
|
|
96
|
+
<style>{getScrollbarStyles()}</style>
|
|
97
|
+
<div
|
|
98
|
+
ref={ref}
|
|
99
|
+
className={cn(
|
|
100
|
+
scrollClassName,
|
|
101
|
+
'overflow-y-auto',
|
|
102
|
+
isScrolling && 'Scrollbar-isScrolling',
|
|
103
|
+
className
|
|
104
|
+
)}
|
|
105
|
+
style={computedStyle}
|
|
106
|
+
onScroll={scrollbarVisibility === 'auto' ? handleScroll : undefined}
|
|
107
|
+
>
|
|
108
|
+
{children}
|
|
109
|
+
</div>
|
|
110
|
+
</>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
Scrollbar.displayName = 'Scrollbar'
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as SelectPrimitive from '@radix-ui/react-select'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { ArrowDownSLine, ArrowUpLine, CheckLine } from './icons-inline'
|
|
5
|
+
import { getThemeFromDocument } from './theme-from-document'
|
|
6
|
+
|
|
7
|
+
/** 取消 outline/ring,避免与全局 *:focus-visible 冲突产生偶现 focus 环;用 !important 压过全局 */
|
|
8
|
+
const FOCUS_RESET =
|
|
9
|
+
'outline-none focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0 focus-visible:!outline-none focus-visible:!ring-0 focus-visible:outline-offset-0 focus-visible:!outline-offset-0 focus-visible:ring-offset-0 focus-visible:!ring-offset-0'
|
|
10
|
+
|
|
11
|
+
const Select = SelectPrimitive.Root
|
|
12
|
+
const SelectGroup = SelectPrimitive.Group
|
|
13
|
+
const SelectValue = SelectPrimitive.Value
|
|
14
|
+
|
|
15
|
+
export interface SelectTriggerProps
|
|
16
|
+
extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> {
|
|
17
|
+
triggerIcon?: React.ReactNode
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const SelectTrigger = React.forwardRef<
|
|
21
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
22
|
+
SelectTriggerProps
|
|
23
|
+
>(({ className, children, disabled, triggerIcon, ...props }, ref) => (
|
|
24
|
+
<SelectPrimitive.Trigger
|
|
25
|
+
ref={ref}
|
|
26
|
+
disabled={disabled}
|
|
27
|
+
className={cn(
|
|
28
|
+
'flex h-9 w-full items-center justify-between gap-2 whitespace-nowrap rounded-lg border border-border-tertiary bg-bg-container px-3 py-2 text-sm text-text placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
|
|
29
|
+
FOCUS_RESET,
|
|
30
|
+
className
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
<SelectPrimitive.Icon asChild>
|
|
36
|
+
<span className="pointer-events-none flex shrink-0 text-current [&>svg]:text-current">
|
|
37
|
+
{triggerIcon ?? <ArrowDownSLine className="h-[1em] w-[1em] shrink-0" />}
|
|
38
|
+
</span>
|
|
39
|
+
</SelectPrimitive.Icon>
|
|
40
|
+
</SelectPrimitive.Trigger>
|
|
41
|
+
))
|
|
42
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
|
|
43
|
+
|
|
44
|
+
const SelectScrollUpButton = React.forwardRef<
|
|
45
|
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
46
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton> & { scrollUpIcon?: React.ReactNode }
|
|
47
|
+
>(({ className, scrollUpIcon, ...rest }, ref) => (
|
|
48
|
+
<SelectPrimitive.ScrollUpButton
|
|
49
|
+
ref={ref}
|
|
50
|
+
className={cn('flex cursor-default items-center justify-center py-1', FOCUS_RESET, className)}
|
|
51
|
+
{...rest}
|
|
52
|
+
>
|
|
53
|
+
{scrollUpIcon ?? <ArrowUpLine className="h-[1em] w-[1em]" />}
|
|
54
|
+
</SelectPrimitive.ScrollUpButton>
|
|
55
|
+
))
|
|
56
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
|
|
57
|
+
|
|
58
|
+
const SelectScrollDownButton = React.forwardRef<
|
|
59
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
60
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton> & { scrollDownIcon?: React.ReactNode }
|
|
61
|
+
>(({ className, scrollDownIcon, ...rest }, ref) => (
|
|
62
|
+
<SelectPrimitive.ScrollDownButton
|
|
63
|
+
ref={ref}
|
|
64
|
+
className={cn('flex cursor-default items-center justify-center py-1', FOCUS_RESET, className)}
|
|
65
|
+
{...rest}
|
|
66
|
+
>
|
|
67
|
+
{scrollDownIcon ?? <ArrowDownSLine className="h-[1em] w-[1em]" />}
|
|
68
|
+
</SelectPrimitive.ScrollDownButton>
|
|
69
|
+
))
|
|
70
|
+
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName
|
|
71
|
+
|
|
72
|
+
const SelectContent = React.forwardRef<
|
|
73
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
74
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & {
|
|
75
|
+
/** When provided (e.g. from ThemeStyleProvider), used for portal wrapper */
|
|
76
|
+
dataStyle?: string
|
|
77
|
+
dataTheme?: string
|
|
78
|
+
}
|
|
79
|
+
>(({ className, children, position = 'popper', sideOffset = 4, dataStyle, dataTheme, ...props }, ref) => {
|
|
80
|
+
const fromDoc = getThemeFromDocument()
|
|
81
|
+
const dataProps =
|
|
82
|
+
dataStyle !== undefined
|
|
83
|
+
? { 'data-style': dataStyle, 'data-theme': dataTheme ?? fromDoc['data-theme'] ?? '' }
|
|
84
|
+
: fromDoc
|
|
85
|
+
return (
|
|
86
|
+
<SelectPrimitive.Portal>
|
|
87
|
+
<SelectPrimitive.Content
|
|
88
|
+
ref={ref}
|
|
89
|
+
className={cn(
|
|
90
|
+
'relative z-[60] max-h-96 min-w-32 overflow-hidden rounded-lg border border-border-tertiary bg-bg-container p-1 text-text shadow-lg',
|
|
91
|
+
FOCUS_RESET,
|
|
92
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
93
|
+
className
|
|
94
|
+
)}
|
|
95
|
+
position={position}
|
|
96
|
+
sideOffset={sideOffset}
|
|
97
|
+
{...dataProps}
|
|
98
|
+
{...props}
|
|
99
|
+
>
|
|
100
|
+
<SelectScrollUpButton />
|
|
101
|
+
<SelectPrimitive.Viewport
|
|
102
|
+
className={cn(
|
|
103
|
+
FOCUS_RESET,
|
|
104
|
+
position === 'popper' &&
|
|
105
|
+
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'
|
|
106
|
+
)}
|
|
107
|
+
>
|
|
108
|
+
{children}
|
|
109
|
+
</SelectPrimitive.Viewport>
|
|
110
|
+
<SelectScrollDownButton />
|
|
111
|
+
</SelectPrimitive.Content>
|
|
112
|
+
</SelectPrimitive.Portal>
|
|
113
|
+
)
|
|
114
|
+
})
|
|
115
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName
|
|
116
|
+
|
|
117
|
+
const SelectLabel = React.forwardRef<
|
|
118
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
119
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
120
|
+
>(({ className, ...props }, ref) => (
|
|
121
|
+
<SelectPrimitive.Label
|
|
122
|
+
ref={ref}
|
|
123
|
+
className={cn('flex h-9 items-center px-3 text-sm font-semibold text-text-secondary', className)}
|
|
124
|
+
{...props}
|
|
125
|
+
/>
|
|
126
|
+
))
|
|
127
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName
|
|
128
|
+
|
|
129
|
+
const SelectItem = React.forwardRef<
|
|
130
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
131
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> & { itemIndicatorIcon?: React.ReactNode }
|
|
132
|
+
>(({ className, children, itemIndicatorIcon, ...rest }, ref) => (
|
|
133
|
+
<SelectPrimitive.Item
|
|
134
|
+
ref={ref}
|
|
135
|
+
className={cn(
|
|
136
|
+
'relative flex h-9 w-full min-w-0 cursor-pointer select-none items-center gap-2 rounded-sm pl-3 pr-8 text-sm transition-colors',
|
|
137
|
+
FOCUS_RESET,
|
|
138
|
+
'hover:bg-fill-secondary data-[highlighted]:bg-fill-secondary data-[highlighted]:text-text data-[state=checked]:bg-fill-secondary data-[state=checked]:text-text',
|
|
139
|
+
'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
140
|
+
className
|
|
141
|
+
)}
|
|
142
|
+
{...rest}
|
|
143
|
+
>
|
|
144
|
+
<span className="absolute right-3 flex h-[1em] w-[1em] items-center justify-center">
|
|
145
|
+
<SelectPrimitive.ItemIndicator>
|
|
146
|
+
{itemIndicatorIcon ?? <CheckLine className="h-[1em] w-[1em]" />}
|
|
147
|
+
</SelectPrimitive.ItemIndicator>
|
|
148
|
+
</span>
|
|
149
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
150
|
+
</SelectPrimitive.Item>
|
|
151
|
+
))
|
|
152
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName
|
|
153
|
+
|
|
154
|
+
const SelectSeparator = React.forwardRef<
|
|
155
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
156
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
157
|
+
>(({ className, ...props }, ref) => (
|
|
158
|
+
<SelectPrimitive.Separator
|
|
159
|
+
ref={ref}
|
|
160
|
+
className={cn('my-1 mx-1 h-px bg-border-tertiary', className)}
|
|
161
|
+
{...props}
|
|
162
|
+
/>
|
|
163
|
+
))
|
|
164
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
|
|
165
|
+
|
|
166
|
+
export {
|
|
167
|
+
Select,
|
|
168
|
+
SelectGroup,
|
|
169
|
+
SelectValue,
|
|
170
|
+
SelectTrigger,
|
|
171
|
+
SelectContent,
|
|
172
|
+
SelectLabel,
|
|
173
|
+
SelectItem,
|
|
174
|
+
SelectSeparator,
|
|
175
|
+
SelectScrollUpButton,
|
|
176
|
+
SelectScrollDownButton,
|
|
177
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes } from 'react'
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
const skeletonVariants = cva('animate-pulse bg-fill-tertiary', {
|
|
7
|
+
variants: {
|
|
8
|
+
rounded: {
|
|
9
|
+
default: 'rounded-md',
|
|
10
|
+
circle: 'rounded-full',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: { rounded: 'default' },
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export interface SkeletonProps
|
|
17
|
+
extends HTMLAttributes<HTMLDivElement>,
|
|
18
|
+
VariantProps<typeof skeletonVariants> {
|
|
19
|
+
rounded?: 'default' | 'circle'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(
|
|
23
|
+
({ className, rounded = 'default', ...props }, ref) => (
|
|
24
|
+
<div
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={cn(skeletonVariants({ rounded }), className)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
Skeleton.displayName = 'Skeleton'
|
|
32
|
+
|
|
33
|
+
export { skeletonVariants }
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as SliderPrimitive from '@radix-ui/react-slider'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
export interface SliderProps
|
|
6
|
+
extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {
|
|
7
|
+
className?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const Slider = React.forwardRef<
|
|
11
|
+
React.ElementRef<typeof SliderPrimitive.Root>,
|
|
12
|
+
SliderProps
|
|
13
|
+
>(({ className, ...props }, ref) => {
|
|
14
|
+
const value = props.value ?? props.defaultValue ?? [50]
|
|
15
|
+
return (
|
|
16
|
+
<SliderPrimitive.Root
|
|
17
|
+
ref={ref}
|
|
18
|
+
className={cn(
|
|
19
|
+
'relative flex w-full touch-none select-none cursor-pointer items-center',
|
|
20
|
+
'data-[orientation=vertical]:flex-col data-[orientation=vertical]:w-auto data-[orientation=vertical]:h-full',
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
25
|
+
<SliderPrimitive.Track
|
|
26
|
+
className={cn(
|
|
27
|
+
'relative grow overflow-hidden rounded-full bg-fill-secondary',
|
|
28
|
+
'data-[orientation=horizontal]:h-2 data-[orientation=horizontal]:w-full',
|
|
29
|
+
'data-[orientation=vertical]:w-2 data-[orientation=vertical]:h-full'
|
|
30
|
+
)}
|
|
31
|
+
>
|
|
32
|
+
<SliderPrimitive.Range
|
|
33
|
+
className={cn(
|
|
34
|
+
'absolute rounded-full bg-primary',
|
|
35
|
+
'data-[orientation=horizontal]:h-full',
|
|
36
|
+
'data-[orientation=vertical]:w-full'
|
|
37
|
+
)}
|
|
38
|
+
/>
|
|
39
|
+
</SliderPrimitive.Track>
|
|
40
|
+
{value.map((_, i) => (
|
|
41
|
+
<SliderPrimitive.Thumb
|
|
42
|
+
key={i}
|
|
43
|
+
className={cn(
|
|
44
|
+
'block size-5 rounded-full border-2 border-primary bg-bg-base shadow-sm',
|
|
45
|
+
'transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-border focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base',
|
|
46
|
+
'disabled:pointer-events-none disabled:opacity-50'
|
|
47
|
+
)}
|
|
48
|
+
/>
|
|
49
|
+
))}
|
|
50
|
+
</SliderPrimitive.Root>
|
|
51
|
+
)
|
|
52
|
+
})
|
|
53
|
+
Slider.displayName = 'Slider'
|
|
54
|
+
|
|
55
|
+
export { Slider }
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { createPortal } from 'react-dom'
|
|
3
|
+
import { Toaster as SonnerToaster } from 'sonner'
|
|
4
|
+
import type { ToasterProps as SonnerToasterProps } from 'sonner'
|
|
5
|
+
import { getThemeFromDocument } from './theme-from-document'
|
|
6
|
+
|
|
7
|
+
export { toast } from 'sonner'
|
|
8
|
+
|
|
9
|
+
export type ToasterProps = Omit<SonnerToasterProps, 'theme'> & {
|
|
10
|
+
theme?: 'light' | 'dark'
|
|
11
|
+
/** 可选:Portal 根节点 data-style,主库可传入 useThemeStyle 的值 */
|
|
12
|
+
dataStyle?: string
|
|
13
|
+
/** 可选:Portal 根节点 data-theme,主库可传入 useThemeStyle 的值 */
|
|
14
|
+
dataTheme?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** 图标/文字用 2px;按钮与容器边缘、按钮之间用固定 8px */
|
|
18
|
+
const TOAST_INNER_GAP_PX = '2px'
|
|
19
|
+
const TOAST_EDGE_PADDING_PX = '8px'
|
|
20
|
+
const TOAST_BUTTON_GAP_PX = '8px'
|
|
21
|
+
|
|
22
|
+
/** 强制 toast 四边内边距 + 根节点 text-sm 变量 + 非首个按钮左间距;选择器带 data-styled 以覆盖 sonner */
|
|
23
|
+
const TOAST_PADDING_TOP_BOTTOM_PX = '12px'
|
|
24
|
+
/** 根节点用设计系统 text-sm 变量;[data-content] 撑满中间;非首个按钮左间距 */
|
|
25
|
+
const TOAST_LAYOUT_FIX_CSS = `[data-sonner-toaster] [data-sonner-toast][data-styled="true"] { padding-left: ${TOAST_EDGE_PADDING_PX} !important; padding-right: ${TOAST_EDGE_PADDING_PX} !important; padding-top: ${TOAST_PADDING_TOP_BOTTOM_PX} !important; padding-bottom: ${TOAST_PADDING_TOP_BOTTOM_PX} !important; font-size: var(--font-size-sm) !important; line-height: var(--font-size-sm--line-height) !important; }
|
|
26
|
+
[data-sonner-toaster] [data-sonner-toast] [data-content] { flex: 1 !important; min-width: 0 !important; }
|
|
27
|
+
[data-sonner-toaster] [data-sonner-toast] [data-button]:not(:first-of-type) { margin-left: ${TOAST_BUTTON_GAP_PX} !important; }`
|
|
28
|
+
|
|
29
|
+
const defaultToastOptions: NonNullable<SonnerToasterProps['toastOptions']> = {
|
|
30
|
+
className: 'text-sm',
|
|
31
|
+
style: {
|
|
32
|
+
padding: `var(--spacing-3) ${TOAST_EDGE_PADDING_PX}`,
|
|
33
|
+
gap: TOAST_INNER_GAP_PX,
|
|
34
|
+
background: 'var(--color-bg-container)',
|
|
35
|
+
borderColor: 'var(--color-border-tertiary)',
|
|
36
|
+
color: 'var(--color-text)',
|
|
37
|
+
},
|
|
38
|
+
descriptionClassName: 'text-xs text-text-secondary',
|
|
39
|
+
actionButtonStyle: {
|
|
40
|
+
borderRadius: 'var(--radius)',
|
|
41
|
+
paddingLeft: 'var(--spacing-2)',
|
|
42
|
+
paddingRight: 'var(--spacing-2)',
|
|
43
|
+
height: 'var(--spacing-7)',
|
|
44
|
+
fontSize: 'var(--font-size-xs)',
|
|
45
|
+
},
|
|
46
|
+
cancelButtonStyle: {
|
|
47
|
+
borderRadius: 'var(--radius)',
|
|
48
|
+
paddingLeft: 'var(--spacing-2)',
|
|
49
|
+
paddingRight: 'var(--spacing-2)',
|
|
50
|
+
height: 'var(--spacing-7)',
|
|
51
|
+
fontSize: 'var(--font-size-xs)',
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const SONNER_GAP = 14
|
|
56
|
+
const SONNER_VISIBLE_TOASTS = 3
|
|
57
|
+
/** toaster 距视口右侧默认 24px,改为 8px 使按钮到屏幕边缘不会过大 */
|
|
58
|
+
const DEFAULT_OFFSET = { right: 8, left: 8, top: 24, bottom: 24 }
|
|
59
|
+
|
|
60
|
+
export function Toaster({ theme, toastOptions, dataStyle, dataTheme, icons, gap = SONNER_GAP, visibleToasts = SONNER_VISIBLE_TOASTS, offset = DEFAULT_OFFSET, ...props }: ToasterProps) {
|
|
61
|
+
const fromDocument = getThemeFromDocument()
|
|
62
|
+
const dataProps =
|
|
63
|
+
dataStyle !== undefined || dataTheme !== undefined
|
|
64
|
+
? { 'data-style': dataStyle, 'data-theme': dataTheme }
|
|
65
|
+
: fromDocument
|
|
66
|
+
const resolvedTheme = theme ?? (typeof document !== 'undefined' && document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light')
|
|
67
|
+
|
|
68
|
+
const content = (
|
|
69
|
+
<>
|
|
70
|
+
<style dangerouslySetInnerHTML={{ __html: TOAST_LAYOUT_FIX_CSS }} />
|
|
71
|
+
<div style={{ display: 'contents' }} {...dataProps}>
|
|
72
|
+
<SonnerToaster
|
|
73
|
+
theme={resolvedTheme}
|
|
74
|
+
closeButton
|
|
75
|
+
icons={icons}
|
|
76
|
+
gap={gap}
|
|
77
|
+
visibleToasts={visibleToasts}
|
|
78
|
+
offset={offset}
|
|
79
|
+
toastOptions={{
|
|
80
|
+
...defaultToastOptions,
|
|
81
|
+
...toastOptions,
|
|
82
|
+
style: { ...defaultToastOptions.style, ...toastOptions?.style },
|
|
83
|
+
}}
|
|
84
|
+
style={
|
|
85
|
+
{
|
|
86
|
+
'--border-radius': 'var(--radius-lg)',
|
|
87
|
+
fontFamily: 'inherit',
|
|
88
|
+
'--gap': `${gap}px`,
|
|
89
|
+
'--toast-icon-margin-start': '0',
|
|
90
|
+
'--toast-icon-margin-end': TOAST_INNER_GAP_PX,
|
|
91
|
+
/* 控制 action/cancel 按钮间距:按钮间仅靠 toast 根 gap,不再额外 margin */
|
|
92
|
+
'--toast-button-margin-start': 'auto',
|
|
93
|
+
'--toast-button-margin-end': '0',
|
|
94
|
+
} as React.CSSProperties
|
|
95
|
+
}
|
|
96
|
+
{...props}
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
</>
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
return typeof document !== 'undefined' ? createPortal(content, document.body) : null
|
|
103
|
+
}
|
|
104
|
+
Toaster.displayName = 'Toaster'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes } from 'react'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { LoaderLine } from './icons-inline'
|
|
5
|
+
|
|
6
|
+
export interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {
|
|
7
|
+
className?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Spinner = forwardRef<HTMLSpanElement, SpinnerProps>(
|
|
11
|
+
({ className, ...props }, ref) => (
|
|
12
|
+
<span ref={ref} role="status" aria-label="Loading" {...props}>
|
|
13
|
+
<LoaderLine className={cn('size-4 animate-spin', className)} />
|
|
14
|
+
</span>
|
|
15
|
+
)
|
|
16
|
+
)
|
|
17
|
+
Spinner.displayName = 'Spinner'
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as SwitchPrimitives from '@radix-ui/react-switch'
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
const rootVariants = cva(
|
|
7
|
+
'peer inline-flex shrink-0 cursor-pointer items-center rounded-full overflow-hidden border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-border focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-fill-secondary',
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
size: { md: 'h-5 w-9', lg: 'h-6 w-11' },
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: { size: 'md' },
|
|
13
|
+
}
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
const thumbVariants = cva(
|
|
17
|
+
'pointer-events-none block rounded-full bg-text-on-primary ring-0 transition-transform data-[state=unchecked]:translate-x-0',
|
|
18
|
+
{
|
|
19
|
+
variants: {
|
|
20
|
+
size: {
|
|
21
|
+
md: 'h-4 w-4 data-[state=checked]:translate-x-4',
|
|
22
|
+
lg: 'h-5 w-5 data-[state=checked]:translate-x-4.5',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: { size: 'md' },
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
export interface SwitchProps
|
|
30
|
+
extends Omit<React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>, 'onChange'>,
|
|
31
|
+
VariantProps<typeof rootVariants> {
|
|
32
|
+
size?: 'md' | 'lg'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const Switch = React.forwardRef<HTMLButtonElement, SwitchProps>(
|
|
36
|
+
({ className, size = 'md', disabled = false, ...rest }, ref) => (
|
|
37
|
+
<SwitchPrimitives.Root
|
|
38
|
+
ref={ref}
|
|
39
|
+
className={cn(rootVariants({ size }), className)}
|
|
40
|
+
disabled={disabled}
|
|
41
|
+
{...rest}
|
|
42
|
+
>
|
|
43
|
+
<SwitchPrimitives.Thumb className={thumbVariants({ size })} />
|
|
44
|
+
</SwitchPrimitives.Root>
|
|
45
|
+
)
|
|
46
|
+
)
|
|
47
|
+
Switch.displayName = 'Switch'
|
|
48
|
+
|
|
49
|
+
export { Switch }
|