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,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [INPUT]: cwd, registryRoot
|
|
3
|
+
* [OUTPUT]: 见各函数
|
|
4
|
+
* [POS]: cli/src/utils/tokens.ts
|
|
5
|
+
*
|
|
6
|
+
* [PROTOCOL]: 文件逻辑变更时同步更新此 Header
|
|
7
|
+
* - init:ensureDesignTokens 注入到用户入口 CSS(globals/index.css)
|
|
8
|
+
* - add:不改入口;writeQoderTokensFile 生成独立 qoder-tokens.css,由用户自行 import
|
|
9
|
+
*/
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
import fs from 'fs-extra';
|
|
12
|
+
const TOKEN_MARKER = 'Spark Design tokens';
|
|
13
|
+
/** 项目里是否已有 token(入口 CSS 内联了变量、或已 import qoder-tokens.css) */
|
|
14
|
+
export async function projectHasTokens(cwd) {
|
|
15
|
+
const candidates = [
|
|
16
|
+
path.join(cwd, 'src', 'app', 'globals.css'),
|
|
17
|
+
path.join(cwd, 'src', 'index.css'),
|
|
18
|
+
path.join(cwd, 'src', 'main.css'),
|
|
19
|
+
path.join(cwd, 'src', 'App.css'),
|
|
20
|
+
];
|
|
21
|
+
for (const p of candidates) {
|
|
22
|
+
if (await fs.pathExists(p)) {
|
|
23
|
+
const content = await fs.readFile(p, 'utf-8');
|
|
24
|
+
if (content.includes('--color-primary:') ||
|
|
25
|
+
content.includes(TOKEN_MARKER) ||
|
|
26
|
+
content.includes('qoder-tokens.css')) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
/** 仅 init 使用:把 theme+scale+scrollbar-utility 注入到用户入口 CSS(globals.css / index.css) */
|
|
34
|
+
export async function ensureDesignTokens(cwd, registryRoot) {
|
|
35
|
+
const themePath = path.join(registryRoot, 'tokens', 'theme.css');
|
|
36
|
+
const scalePath = path.join(registryRoot, 'tokens', 'scale.css');
|
|
37
|
+
const scrollbarPath = path.join(registryRoot, 'tokens', 'scrollbar-utility.css');
|
|
38
|
+
if (!(await fs.pathExists(themePath)) || !(await fs.pathExists(scalePath))) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
if (await projectHasTokens(cwd)) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
let cssEntry = path.join(cwd, 'src', 'app', 'globals.css');
|
|
45
|
+
if (!(await fs.pathExists(cssEntry))) {
|
|
46
|
+
cssEntry = path.join(cwd, 'src', 'index.css');
|
|
47
|
+
}
|
|
48
|
+
if (!(await fs.pathExists(cssEntry))) {
|
|
49
|
+
cssEntry = path.join(cwd, 'src', 'index.css');
|
|
50
|
+
await fs.ensureDir(path.dirname(cssEntry));
|
|
51
|
+
}
|
|
52
|
+
const themeContent = await fs.readFile(themePath, 'utf-8');
|
|
53
|
+
const scaleContent = await fs.readFile(scalePath, 'utf-8');
|
|
54
|
+
const scrollbarContent = (await fs.pathExists(scrollbarPath))
|
|
55
|
+
? await fs.readFile(scrollbarPath, 'utf-8')
|
|
56
|
+
: '';
|
|
57
|
+
const tokensBlock = `/* ${TOKEN_MARKER} - 由 npx sparkdesign init 写入,驱动组件样式 */\n${scaleContent}\n\n${themeContent}\n` +
|
|
58
|
+
(scrollbarContent ? `\n${scrollbarContent}\n` : '');
|
|
59
|
+
const existing = (await fs.pathExists(cssEntry)) ? await fs.readFile(cssEntry, 'utf-8') : '';
|
|
60
|
+
const newContent = tokensBlock + (existing ? '\n' + existing : '');
|
|
61
|
+
await fs.writeFile(cssEntry, newContent, 'utf-8');
|
|
62
|
+
return cssEntry;
|
|
63
|
+
}
|
|
64
|
+
const DEDICATED_TOKENS_FILE = 'qoder-tokens.css';
|
|
65
|
+
/** 仅 add 使用:在 src 下生成独立 token 文件,不修改用户入口。若已存在则不覆盖。返回路径及是否本次创建。 */
|
|
66
|
+
export async function writeQoderTokensFile(cwd, registryRoot) {
|
|
67
|
+
const themePath = path.join(registryRoot, 'tokens', 'theme.css');
|
|
68
|
+
const scalePath = path.join(registryRoot, 'tokens', 'scale.css');
|
|
69
|
+
const scrollbarPath = path.join(registryRoot, 'tokens', 'scrollbar-utility.css');
|
|
70
|
+
const targetPath = path.join(cwd, 'src', DEDICATED_TOKENS_FILE);
|
|
71
|
+
if (await fs.pathExists(targetPath)) {
|
|
72
|
+
return { path: targetPath, created: false };
|
|
73
|
+
}
|
|
74
|
+
if (!(await fs.pathExists(themePath)) || !(await fs.pathExists(scalePath))) {
|
|
75
|
+
return { path: targetPath, created: false };
|
|
76
|
+
}
|
|
77
|
+
const themeContent = await fs.readFile(themePath, 'utf-8');
|
|
78
|
+
const scaleContent = await fs.readFile(scalePath, 'utf-8');
|
|
79
|
+
const scrollbarContent = (await fs.pathExists(scrollbarPath))
|
|
80
|
+
? await fs.readFile(scrollbarPath, 'utf-8')
|
|
81
|
+
: '';
|
|
82
|
+
const content = `/* ${TOKEN_MARKER} - 在应用入口 import 此文件以驱动组件样式 */\n${scaleContent}\n\n${themeContent}\n` +
|
|
83
|
+
(scrollbarContent ? `\n${scrollbarContent}\n` : '');
|
|
84
|
+
await fs.ensureDir(path.dirname(targetPath));
|
|
85
|
+
await fs.writeFile(targetPath, content, 'utf-8');
|
|
86
|
+
return { path: targetPath, created: true };
|
|
87
|
+
}
|
|
88
|
+
export function getQoderTokensImportPath() {
|
|
89
|
+
return `./${DEDICATED_TOKENS_FILE}`;
|
|
90
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [INPUT]: 模板源码 + 用户 aliases
|
|
3
|
+
* [OUTPUT]: 替换别名后的源码字符串
|
|
4
|
+
* [POS]: cli/src/utils/transform.ts
|
|
5
|
+
*
|
|
6
|
+
* [PROTOCOL]: 文件逻辑变更时同步更新此 Header
|
|
7
|
+
*/
|
|
8
|
+
/** 移除文件开头的 L3 协议块注释,使按需引入到用户项目的代码不包含内部文档。 */
|
|
9
|
+
export function stripL3Header(source) {
|
|
10
|
+
return source.replace(/^\s*\/\*\*[\s\S]*?\*\/\s*/, '').trimStart();
|
|
11
|
+
}
|
|
12
|
+
export function transformImports(source, aliases) {
|
|
13
|
+
let result = source;
|
|
14
|
+
result = result.replace(/from ['"]@\/lib\/utils['"]/g, `from '${aliases.utils}'`);
|
|
15
|
+
if (aliases.components) {
|
|
16
|
+
result = result.replace(/from ['"]@\/components\//g, `from '${aliases.components}/`);
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { motion } from 'framer-motion'
|
|
3
|
+
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'
|
|
4
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
5
|
+
import { cn } from '@/lib/utils'
|
|
6
|
+
import { getThemeFromDocument } from './theme-from-document'
|
|
7
|
+
|
|
8
|
+
const AlertDialog = AlertDialogPrimitive.Root
|
|
9
|
+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
|
|
10
|
+
const AlertDialogPortal = AlertDialogPrimitive.Portal
|
|
11
|
+
|
|
12
|
+
const AlertDialogOverlay = React.forwardRef<
|
|
13
|
+
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
|
14
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
|
15
|
+
>(({ className, ...props }, ref) => (
|
|
16
|
+
<AlertDialogPrimitive.Overlay ref={ref} asChild {...props}>
|
|
17
|
+
<motion.div
|
|
18
|
+
className={cn('fixed inset-0 z-50 bg-bg-mask/60', className)}
|
|
19
|
+
initial={{ opacity: 0 }}
|
|
20
|
+
animate={{ opacity: 1 }}
|
|
21
|
+
transition={{ duration: 0.15 }}
|
|
22
|
+
/>
|
|
23
|
+
</AlertDialogPrimitive.Overlay>
|
|
24
|
+
))
|
|
25
|
+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
|
|
26
|
+
|
|
27
|
+
const contentVariants = cva(
|
|
28
|
+
'font-sans fixed left-1/2 top-1/2 z-50 w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-bg-base text-text shadow-lg p-6',
|
|
29
|
+
{
|
|
30
|
+
variants: {
|
|
31
|
+
size: { default: 'max-w-lg', sm: 'max-w-sm' },
|
|
32
|
+
},
|
|
33
|
+
defaultVariants: { size: 'default' },
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
export interface AlertDialogContentProps
|
|
38
|
+
extends React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>,
|
|
39
|
+
VariantProps<typeof contentVariants> {
|
|
40
|
+
size?: 'default' | 'sm'
|
|
41
|
+
/** When provided (e.g. from ThemeStyleProvider), used for portal wrapper */
|
|
42
|
+
dataStyle?: string
|
|
43
|
+
dataTheme?: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const AlertDialogContent = React.forwardRef<
|
|
47
|
+
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
|
48
|
+
AlertDialogContentProps
|
|
49
|
+
>(({ className, children, size = 'default', dataStyle, dataTheme, ...props }, ref) => {
|
|
50
|
+
const fromDoc = getThemeFromDocument()
|
|
51
|
+
const dataProps =
|
|
52
|
+
dataStyle !== undefined
|
|
53
|
+
? { 'data-style': dataStyle, 'data-theme': dataTheme ?? fromDoc['data-theme'] ?? '' }
|
|
54
|
+
: fromDoc
|
|
55
|
+
return (
|
|
56
|
+
<AlertDialogPortal>
|
|
57
|
+
<div style={{ display: 'contents' }} {...dataProps}>
|
|
58
|
+
<AlertDialogOverlay />
|
|
59
|
+
<AlertDialogPrimitive.Content ref={ref} asChild {...props}>
|
|
60
|
+
<motion.div
|
|
61
|
+
className={cn(contentVariants({ size }), className)}
|
|
62
|
+
initial={{ opacity: 0, y: 8 }}
|
|
63
|
+
animate={{ opacity: 1, y: 0 }}
|
|
64
|
+
transition={{ duration: 0.2, ease: [0.4, 0, 0.2, 1] }}
|
|
65
|
+
>
|
|
66
|
+
{children}
|
|
67
|
+
</motion.div>
|
|
68
|
+
</AlertDialogPrimitive.Content>
|
|
69
|
+
</div>
|
|
70
|
+
</AlertDialogPortal>
|
|
71
|
+
)
|
|
72
|
+
})
|
|
73
|
+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
|
|
74
|
+
|
|
75
|
+
const AlertDialogHeader = React.forwardRef<
|
|
76
|
+
HTMLDivElement,
|
|
77
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
78
|
+
>(({ className, ...props }, ref) => (
|
|
79
|
+
<div ref={ref} className={cn('flex flex-col gap-2', className)} {...props} />
|
|
80
|
+
))
|
|
81
|
+
AlertDialogHeader.displayName = 'AlertDialogHeader'
|
|
82
|
+
|
|
83
|
+
const AlertDialogFooter = React.forwardRef<
|
|
84
|
+
HTMLDivElement,
|
|
85
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
86
|
+
>(({ className, ...props }, ref) => (
|
|
87
|
+
<div
|
|
88
|
+
ref={ref}
|
|
89
|
+
className={cn('mt-6 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
))
|
|
93
|
+
AlertDialogFooter.displayName = 'AlertDialogFooter'
|
|
94
|
+
|
|
95
|
+
const AlertDialogTitle = React.forwardRef<
|
|
96
|
+
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
|
97
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
|
98
|
+
>(({ className, ...props }, ref) => (
|
|
99
|
+
<AlertDialogPrimitive.Title
|
|
100
|
+
ref={ref}
|
|
101
|
+
className={cn('font-sans text-base font-medium leading-6 text-text', className)}
|
|
102
|
+
{...props}
|
|
103
|
+
/>
|
|
104
|
+
))
|
|
105
|
+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
|
|
106
|
+
|
|
107
|
+
const AlertDialogDescription = React.forwardRef<
|
|
108
|
+
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
|
109
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
|
110
|
+
>(({ className, ...props }, ref) => (
|
|
111
|
+
<AlertDialogPrimitive.Description
|
|
112
|
+
ref={ref}
|
|
113
|
+
className={cn('text-sm leading-6 text-text-tertiary', className)}
|
|
114
|
+
{...props}
|
|
115
|
+
/>
|
|
116
|
+
))
|
|
117
|
+
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName
|
|
118
|
+
|
|
119
|
+
const actionVariants = cva(
|
|
120
|
+
'inline-flex h-9 items-center justify-center rounded px-4 text-sm font-medium transition-colors focus:outline-none disabled:pointer-events-none disabled:opacity-50 cursor-pointer',
|
|
121
|
+
{
|
|
122
|
+
variants: {
|
|
123
|
+
destructive: {
|
|
124
|
+
true: 'bg-error text-text-on-primary hover:bg-error-hover active:bg-error',
|
|
125
|
+
false: 'bg-bg-highlight text-text-on-primary hover:bg-bg-highlight-hover',
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
defaultVariants: { destructive: false },
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
export interface AlertDialogActionProps
|
|
133
|
+
extends React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>,
|
|
134
|
+
VariantProps<typeof actionVariants> {
|
|
135
|
+
destructive?: boolean
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const AlertDialogAction = React.forwardRef<
|
|
139
|
+
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
|
140
|
+
AlertDialogActionProps
|
|
141
|
+
>(({ className, destructive = false, ...props }, ref) => (
|
|
142
|
+
<AlertDialogPrimitive.Action
|
|
143
|
+
ref={ref}
|
|
144
|
+
className={cn(actionVariants({ destructive }), className)}
|
|
145
|
+
{...props}
|
|
146
|
+
/>
|
|
147
|
+
))
|
|
148
|
+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
|
|
149
|
+
|
|
150
|
+
const AlertDialogCancel = React.forwardRef<
|
|
151
|
+
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
|
152
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
|
|
153
|
+
>(({ className, ...props }, ref) => (
|
|
154
|
+
<AlertDialogPrimitive.Cancel
|
|
155
|
+
ref={ref}
|
|
156
|
+
className={cn(
|
|
157
|
+
'inline-flex h-9 items-center justify-center rounded px-4 text-sm font-medium cursor-pointer',
|
|
158
|
+
'bg-transparent text-text-secondary hover:bg-fill-secondary hover:text-text',
|
|
159
|
+
'transition-colors focus:outline-none',
|
|
160
|
+
className
|
|
161
|
+
)}
|
|
162
|
+
{...props}
|
|
163
|
+
/>
|
|
164
|
+
))
|
|
165
|
+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
|
|
166
|
+
|
|
167
|
+
export {
|
|
168
|
+
AlertDialog,
|
|
169
|
+
AlertDialogTrigger,
|
|
170
|
+
AlertDialogPortal,
|
|
171
|
+
AlertDialogOverlay,
|
|
172
|
+
AlertDialogContent,
|
|
173
|
+
AlertDialogHeader,
|
|
174
|
+
AlertDialogFooter,
|
|
175
|
+
AlertDialogTitle,
|
|
176
|
+
AlertDialogDescription,
|
|
177
|
+
AlertDialogAction,
|
|
178
|
+
AlertDialogCancel,
|
|
179
|
+
}
|
|
180
|
+
export { contentVariants as alertDialogContentVariants, actionVariants as alertDialogActionVariants }
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar'
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
const avatarVariants = cva('relative flex shrink-0 rounded-full', {
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
sm: 'h-8 w-8',
|
|
10
|
+
default: 'h-10 w-10',
|
|
11
|
+
lg: 'h-12 w-12',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: { size: 'default' },
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export interface AvatarProps
|
|
18
|
+
extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>,
|
|
19
|
+
VariantProps<typeof avatarVariants> {}
|
|
20
|
+
|
|
21
|
+
const Avatar = React.forwardRef<
|
|
22
|
+
React.ElementRef<typeof AvatarPrimitive.Root>,
|
|
23
|
+
AvatarProps
|
|
24
|
+
>(({ className, size = 'default', ...props }, ref) => (
|
|
25
|
+
<AvatarPrimitive.Root
|
|
26
|
+
ref={ref}
|
|
27
|
+
className={cn(avatarVariants({ size }), className)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
))
|
|
31
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName
|
|
32
|
+
|
|
33
|
+
export type AvatarImageProps = React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
|
34
|
+
|
|
35
|
+
const AvatarImage = React.forwardRef<
|
|
36
|
+
React.ElementRef<typeof AvatarPrimitive.Image>,
|
|
37
|
+
AvatarImageProps
|
|
38
|
+
>(({ className, ...props }, ref) => (
|
|
39
|
+
<AvatarPrimitive.Image
|
|
40
|
+
ref={ref}
|
|
41
|
+
className={cn(
|
|
42
|
+
'aspect-square h-full w-full overflow-hidden rounded-full object-cover',
|
|
43
|
+
className
|
|
44
|
+
)}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
))
|
|
48
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName
|
|
49
|
+
|
|
50
|
+
export type AvatarFallbackProps = React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
|
51
|
+
|
|
52
|
+
const AvatarFallback = React.forwardRef<
|
|
53
|
+
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
|
54
|
+
AvatarFallbackProps
|
|
55
|
+
>(({ className, ...props }, ref) => (
|
|
56
|
+
<AvatarPrimitive.Fallback
|
|
57
|
+
ref={ref}
|
|
58
|
+
className={cn(
|
|
59
|
+
'flex h-full w-full items-center justify-center overflow-hidden rounded-full bg-fill-tertiary text-sm font-medium text-text',
|
|
60
|
+
className
|
|
61
|
+
)}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
))
|
|
65
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
|
|
66
|
+
|
|
67
|
+
export type AvatarBadgeProps = React.HTMLAttributes<HTMLSpanElement>
|
|
68
|
+
|
|
69
|
+
const AvatarBadge = React.forwardRef<HTMLSpanElement, AvatarBadgeProps>(
|
|
70
|
+
({ className, ...props }, ref) => (
|
|
71
|
+
<span
|
|
72
|
+
ref={ref}
|
|
73
|
+
className={cn(
|
|
74
|
+
'absolute bottom-0 right-0 z-10 block h-3 w-3 rounded-full border-2 border-bg-base bg-success',
|
|
75
|
+
className
|
|
76
|
+
)}
|
|
77
|
+
{...props}
|
|
78
|
+
/>
|
|
79
|
+
)
|
|
80
|
+
)
|
|
81
|
+
AvatarBadge.displayName = 'AvatarBadge'
|
|
82
|
+
|
|
83
|
+
export type AvatarGroupProps = React.HTMLAttributes<HTMLDivElement>
|
|
84
|
+
|
|
85
|
+
const AvatarGroup = React.forwardRef<HTMLDivElement, AvatarGroupProps>(
|
|
86
|
+
({ className, ...props }, ref) => (
|
|
87
|
+
<div
|
|
88
|
+
ref={ref}
|
|
89
|
+
className={cn('flex -space-x-2 [&>*]:ring-2 [&>*]:ring-bg-base', className)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
)
|
|
93
|
+
)
|
|
94
|
+
AvatarGroup.displayName = 'AvatarGroup'
|
|
95
|
+
|
|
96
|
+
export type AvatarGroupCountProps = React.HTMLAttributes<HTMLSpanElement>
|
|
97
|
+
|
|
98
|
+
const AvatarGroupCount = React.forwardRef<HTMLSpanElement, AvatarGroupCountProps>(
|
|
99
|
+
({ className, ...props }, ref) => (
|
|
100
|
+
<span
|
|
101
|
+
ref={ref}
|
|
102
|
+
className={cn(
|
|
103
|
+
'inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full border-2 border-bg-base bg-fill-tertiary text-sm font-medium text-text',
|
|
104
|
+
className
|
|
105
|
+
)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
)
|
|
109
|
+
)
|
|
110
|
+
AvatarGroupCount.displayName = 'AvatarGroupCount'
|
|
111
|
+
|
|
112
|
+
export {
|
|
113
|
+
Avatar,
|
|
114
|
+
AvatarImage,
|
|
115
|
+
AvatarFallback,
|
|
116
|
+
AvatarBadge,
|
|
117
|
+
AvatarGroup,
|
|
118
|
+
AvatarGroupCount,
|
|
119
|
+
}
|
|
120
|
+
export { avatarVariants }
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { forwardRef } from 'react'
|
|
2
|
+
import type { ButtonHTMLAttributes, ReactNode } from 'react'
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
const buttonVariants = cva(
|
|
7
|
+
'inline-flex items-center justify-center gap-1.5 font-medium transition-colors duration-200 focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer',
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
primary: 'bg-primary text-text-on-primary hover:bg-primary-hover',
|
|
12
|
+
secondary: 'bg-bg-highlight text-text-on-primary hover:bg-bg-highlight-hover',
|
|
13
|
+
tertiary: 'bg-fill-secondary text-text hover:bg-fill',
|
|
14
|
+
ghost: 'bg-transparent text-text-secondary hover:bg-fill-secondary hover:text-text',
|
|
15
|
+
text: 'bg-transparent text-text-secondary hover:text-text',
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
sm: 'h-7 px-2 text-xs',
|
|
19
|
+
md: 'h-9 px-3 text-sm',
|
|
20
|
+
lg: 'h-11 px-4 text-base',
|
|
21
|
+
},
|
|
22
|
+
rounded: {
|
|
23
|
+
square: 'rounded',
|
|
24
|
+
pill: 'rounded-full',
|
|
25
|
+
},
|
|
26
|
+
textOnly: {
|
|
27
|
+
true: 'h-auto px-0 py-0.5',
|
|
28
|
+
false: '',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
compoundVariants: [
|
|
32
|
+
{ textOnly: true, size: 'sm', className: 'text-xs' },
|
|
33
|
+
{ textOnly: true, size: 'md', className: 'text-sm' },
|
|
34
|
+
{ textOnly: true, size: 'lg', className: 'text-base' },
|
|
35
|
+
],
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
variant: 'ghost',
|
|
38
|
+
size: 'md',
|
|
39
|
+
rounded: 'square',
|
|
40
|
+
textOnly: false,
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
export interface ButtonProps
|
|
46
|
+
extends ButtonHTMLAttributes<HTMLButtonElement>,
|
|
47
|
+
VariantProps<typeof buttonVariants> {
|
|
48
|
+
children: ReactNode
|
|
49
|
+
textButton?: boolean
|
|
50
|
+
prefixIcon?: ReactNode
|
|
51
|
+
suffixIcon?: ReactNode
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
55
|
+
(
|
|
56
|
+
{
|
|
57
|
+
variant = 'ghost',
|
|
58
|
+
children,
|
|
59
|
+
size = 'md',
|
|
60
|
+
textButton = false,
|
|
61
|
+
prefixIcon,
|
|
62
|
+
suffixIcon,
|
|
63
|
+
rounded = 'square',
|
|
64
|
+
disabled = false,
|
|
65
|
+
className,
|
|
66
|
+
...props
|
|
67
|
+
},
|
|
68
|
+
ref
|
|
69
|
+
) => {
|
|
70
|
+
return (
|
|
71
|
+
<button
|
|
72
|
+
ref={ref}
|
|
73
|
+
className={buttonVariants({
|
|
74
|
+
variant: textButton ? 'text' : variant,
|
|
75
|
+
size,
|
|
76
|
+
rounded,
|
|
77
|
+
textOnly: textButton,
|
|
78
|
+
className,
|
|
79
|
+
})}
|
|
80
|
+
disabled={disabled}
|
|
81
|
+
{...props}
|
|
82
|
+
>
|
|
83
|
+
{prefixIcon && (
|
|
84
|
+
<span className="inline-flex shrink-0 items-center justify-center [&>*]:block [&>*]:leading-none">
|
|
85
|
+
{prefixIcon}
|
|
86
|
+
</span>
|
|
87
|
+
)}
|
|
88
|
+
{children}
|
|
89
|
+
{suffixIcon && (
|
|
90
|
+
<span className="inline-flex shrink-0 items-center justify-center [&>*]:block [&>*]:leading-none">
|
|
91
|
+
{suffixIcon}
|
|
92
|
+
</span>
|
|
93
|
+
)}
|
|
94
|
+
</button>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
Button.displayName = 'Button'
|
|
99
|
+
|
|
100
|
+
export { Button, buttonVariants }
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { ArrowDownSLine } from './icons-inline'
|
|
5
|
+
|
|
6
|
+
const Collapse = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof AccordionPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Root>
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<AccordionPrimitive.Root
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn('w-full font-sans', className)}
|
|
13
|
+
data-slot="collapse"
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
))
|
|
17
|
+
Collapse.displayName = 'Collapse'
|
|
18
|
+
|
|
19
|
+
const CollapseItem = React.forwardRef<
|
|
20
|
+
React.ElementRef<typeof AccordionPrimitive.Item>,
|
|
21
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
|
|
22
|
+
>(({ className, ...props }, ref) => (
|
|
23
|
+
<AccordionPrimitive.Item
|
|
24
|
+
ref={ref}
|
|
25
|
+
className={cn(
|
|
26
|
+
'border-b border-border-tertiary last:border-b-0 data-[orientation=horizontal]:border-b-0 data-[orientation=horizontal]:border-r data-[orientation=horizontal]:border-border-tertiary data-[orientation=horizontal]:last:border-r-0',
|
|
27
|
+
className
|
|
28
|
+
)}
|
|
29
|
+
data-slot="collapse-item"
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
))
|
|
33
|
+
CollapseItem.displayName = 'CollapseItem'
|
|
34
|
+
|
|
35
|
+
export interface CollapseTriggerProps
|
|
36
|
+
extends React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> {
|
|
37
|
+
chevronIcon?: React.ReactNode
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const CollapseTrigger = React.forwardRef<
|
|
41
|
+
React.ElementRef<typeof AccordionPrimitive.Trigger>,
|
|
42
|
+
CollapseTriggerProps
|
|
43
|
+
>(({ className, children, chevronIcon, ...rest }, ref) => (
|
|
44
|
+
<AccordionPrimitive.Header className="flex font-sans">
|
|
45
|
+
<AccordionPrimitive.Trigger
|
|
46
|
+
ref={ref}
|
|
47
|
+
className={cn(
|
|
48
|
+
'group flex flex-1 items-center justify-between gap-2 py-3 text-left text-sm font-medium text-text font-sans transition-colors outline-none',
|
|
49
|
+
'hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-primary-border focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base',
|
|
50
|
+
'disabled:pointer-events-none disabled:opacity-50',
|
|
51
|
+
'data-[orientation=horizontal]:flex-col data-[orientation=horizontal]:justify-between data-[orientation=horizontal]:py-4 data-[orientation=horizontal]:text-left',
|
|
52
|
+
className
|
|
53
|
+
)}
|
|
54
|
+
data-slot="collapse-trigger"
|
|
55
|
+
{...rest}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
<span
|
|
59
|
+
className="shrink-0 inline-flex transition-transform duration-200 group-data-[state=open]:rotate-180"
|
|
60
|
+
aria-hidden
|
|
61
|
+
>
|
|
62
|
+
{chevronIcon ?? <ArrowDownSLine className="size-4 text-text-secondary" />}
|
|
63
|
+
</span>
|
|
64
|
+
</AccordionPrimitive.Trigger>
|
|
65
|
+
</AccordionPrimitive.Header>
|
|
66
|
+
))
|
|
67
|
+
CollapseTrigger.displayName = 'CollapseTrigger'
|
|
68
|
+
|
|
69
|
+
const CollapseContent = React.forwardRef<
|
|
70
|
+
React.ElementRef<typeof AccordionPrimitive.Content>,
|
|
71
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
|
|
72
|
+
>(({ className, children, ...props }, ref) => (
|
|
73
|
+
<AccordionPrimitive.Content
|
|
74
|
+
ref={ref}
|
|
75
|
+
className={cn(
|
|
76
|
+
'overflow-hidden text-sm text-text-secondary font-sans data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down',
|
|
77
|
+
'data-[orientation=horizontal]:data-[state=closed]:animate-accordion-left data-[orientation=horizontal]:data-[state=open]:animate-accordion-right',
|
|
78
|
+
className
|
|
79
|
+
)}
|
|
80
|
+
data-slot="collapse-content"
|
|
81
|
+
{...props}
|
|
82
|
+
>
|
|
83
|
+
<div className="pb-3 pt-0 data-[orientation=horizontal]:pb-0 data-[orientation=horizontal]:pl-0 data-[orientation=horizontal]:pr-3">
|
|
84
|
+
{children}
|
|
85
|
+
</div>
|
|
86
|
+
</AccordionPrimitive.Content>
|
|
87
|
+
))
|
|
88
|
+
CollapseContent.displayName = 'CollapseContent'
|
|
89
|
+
|
|
90
|
+
export type CollapseProps = React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Root>
|
|
91
|
+
export type CollapseItemProps = React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
|
|
92
|
+
export type CollapseContentProps = React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
|
|
93
|
+
|
|
94
|
+
export { Collapse, CollapseItem, CollapseTrigger, CollapseContent }
|