sparkdesign 0.4.5 → 0.4.7
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/AI_README.md +60 -0
- package/README.md +74 -22
- package/cli/dist/commands/add.js +23 -13
- package/cli/dist/commands/diff.js +8 -4
- package/cli/dist/commands/init.js +85 -10
- package/cli/dist/commands/list.js +8 -4
- package/cli/dist/index.js +9 -6
- package/cli/dist/utils/config.js +16 -8
- package/cli/dist/utils/package-manager.js +75 -0
- package/cli/dist/utils/registry.js +8 -4
- package/cli/dist/utils/tokens.js +33 -25
- package/cli/dist/utils/transform.js +9 -5
- package/cli/dist/utils/tsconfig.js +182 -0
- package/cli/registry/AGENTS.md +25 -0
- package/cli/registry/__tests__/chat/thinking-indicator.test.tsx +2 -2
- package/cli/registry/agent-manifest.json +794 -0
- package/cli/registry/basic/alert.tsx +76 -0
- package/cli/registry/basic/aspect-ratio.tsx +8 -0
- package/cli/registry/basic/breadcrumb.tsx +117 -0
- package/cli/registry/basic/button-group.tsx +79 -0
- package/cli/registry/basic/button.tsx +1 -1
- package/cli/registry/basic/calendar.tsx +221 -0
- package/cli/registry/basic/card.tsx +103 -0
- package/cli/registry/basic/carousel.tsx +241 -0
- package/cli/registry/basic/chart.tsx +372 -0
- package/cli/registry/basic/checkbox.tsx +42 -0
- package/cli/registry/basic/collapsible-card.tsx +2 -2
- package/cli/registry/basic/combobox.tsx +75 -0
- package/cli/registry/basic/command.tsx +184 -0
- package/cli/registry/basic/context-menu.tsx +239 -0
- package/cli/registry/basic/data-table.tsx +73 -0
- package/cli/registry/basic/date-picker.tsx +13 -0
- package/cli/registry/basic/dialog.tsx +169 -0
- package/cli/registry/basic/direction.tsx +25 -0
- package/cli/registry/basic/drawer.tsx +164 -0
- package/cli/registry/basic/dropdown-menu.tsx +0 -4
- package/cli/registry/basic/empty.tsx +104 -0
- package/cli/registry/basic/field.tsx +248 -0
- package/cli/registry/basic/hover-card.tsx +58 -0
- package/cli/registry/basic/input-group.tsx +168 -0
- package/cli/registry/basic/input-otp.tsx +75 -0
- package/cli/registry/basic/input.tsx +27 -0
- package/cli/registry/basic/item.tsx +204 -0
- package/cli/registry/basic/label.tsx +24 -0
- package/cli/registry/basic/menubar.tsx +274 -0
- package/cli/registry/basic/native-select.tsx +62 -0
- package/cli/registry/basic/navigation-menu.tsx +168 -0
- package/cli/registry/basic/popover.tsx +59 -0
- package/cli/registry/basic/scroll-area.tsx +58 -0
- package/cli/registry/basic/select.tsx +2 -1
- package/cli/registry/basic/separator.tsx +26 -0
- package/cli/registry/basic/sheet.tsx +18 -0
- package/cli/registry/basic/textarea.tsx +25 -0
- package/cli/registry/basic/toggle.tsx +1 -1
- package/cli/registry/basic/typography.tsx +1 -1
- package/cli/registry/chat/chat-input/chat-input-folder-selector.tsx +1 -1
- package/cli/registry/chat/chat-input/chat-input-textarea.tsx +1 -1
- package/cli/registry/chat/chat-input/compound.tsx +4 -3
- package/cli/registry/chat/chat-input/context.tsx +4 -1
- package/cli/registry/chat/chat-input/folder-permission-dialog.tsx +2 -2
- package/cli/registry/chat/code-block-part.tsx +1 -1
- package/cli/registry/chat/conversation-anchor-nav.tsx +349 -0
- package/cli/registry/chat/file-attachment.tsx +2 -1
- package/cli/registry/chat/file-review-part.tsx +21 -21
- package/cli/registry/chat/image-generating.tsx +1 -1
- package/cli/registry/chat/markdown.tsx +2 -2
- package/cli/registry/chat/queue-indicator.tsx +1 -0
- package/cli/registry/chat/response/context.tsx +1 -1
- package/cli/registry/chat/streaming-markdown-block.tsx +12 -8
- package/cli/registry/chat/thinking-indicator.tsx +1 -1
- package/cli/registry/chat/tool-invocation-card.tsx +4 -1
- package/cli/registry/lib/file-icon-maps.ts +22 -22
- package/cli/registry/meta.json +518 -0
- package/cli/registry/tokens/index.css +8 -5
- package/cli/registry/tokens/ontology.json +404 -0
- package/cli/registry/tokens/scale/presets/compact.css +16 -5
- package/cli/registry/tokens/scale/presets/dense.css +13 -2
- package/cli/registry/tokens/scale/presets/sharp.css +18 -6
- package/cli/registry/tokens/scale/presets/soft.css +23 -1
- package/cli/registry/tokens/theme-base.css +235 -0
- package/{dist/tokens/themes/dark-qoder.css → cli/registry/tokens/themes/dark-mint.css} +1 -1
- package/cli/registry/tokens/themes/dark-parchment.css +104 -103
- package/{dist/tokens/themes/light-qoder.css → cli/registry/tokens/themes/light-mint.css} +1 -1
- package/cli/registry/tokens/themes/light-parchment.css +103 -102
- package/dist/registry/basic/alert-dialog.d.ts +7 -5
- package/dist/registry/basic/alert.d.ts +24 -0
- package/dist/registry/basic/aspect-ratio.d.ts +16 -0
- package/dist/registry/basic/avatar.d.ts +7 -5
- package/dist/registry/basic/breadcrumb.d.ts +24 -0
- package/dist/registry/basic/button-group.d.ts +26 -0
- package/dist/registry/basic/button.d.ts +1 -1
- package/dist/registry/basic/calendar.d.ts +22 -0
- package/dist/registry/basic/card.d.ts +27 -0
- package/dist/registry/basic/carousel.d.ts +19 -0
- package/dist/registry/basic/chart.d.ts +55 -0
- package/dist/registry/basic/checkbox.d.ts +21 -0
- package/dist/registry/basic/collapse.d.ts +7 -5
- package/dist/registry/basic/collapsible-card.d.ts +7 -6
- package/dist/registry/basic/collapsible.d.ts +7 -5
- package/dist/registry/basic/combobox.d.ts +26 -0
- package/dist/registry/basic/command.d.ts +18 -0
- package/dist/registry/basic/context-menu.d.ts +44 -0
- package/dist/registry/basic/data-table.d.ts +26 -0
- package/dist/registry/basic/date-picker.d.ts +18 -0
- package/dist/registry/basic/dialog.d.ts +39 -0
- package/dist/registry/basic/direction.d.ts +19 -0
- package/dist/registry/basic/drawer.d.ts +37 -0
- package/dist/registry/basic/dropdown-menu.d.ts +7 -5
- package/dist/registry/basic/empty.d.ts +22 -0
- package/dist/registry/basic/field.d.ts +24 -0
- package/dist/registry/basic/hover-card.d.ts +22 -0
- package/dist/registry/basic/icons-inline.d.ts +7 -5
- package/dist/registry/basic/input-group.d.ts +27 -0
- package/dist/registry/basic/input-otp.d.ts +22 -0
- package/dist/registry/basic/input.d.ts +15 -0
- package/dist/registry/basic/item.d.ts +34 -0
- package/dist/registry/basic/kbd.d.ts +7 -5
- package/dist/registry/basic/label.d.ts +16 -0
- package/dist/registry/basic/menubar.d.ts +37 -0
- package/dist/registry/basic/native-select.d.ts +18 -0
- package/dist/registry/basic/navigation-menu.d.ts +25 -0
- package/dist/registry/basic/pagination.d.ts +7 -5
- package/dist/registry/basic/popover.d.ts +23 -0
- package/dist/registry/basic/progress.d.ts +7 -5
- package/dist/registry/basic/radio-group.d.ts +7 -5
- package/dist/registry/basic/resizable.d.ts +7 -5
- package/dist/registry/basic/scroll-area.d.ts +5 -0
- package/dist/registry/basic/select.d.ts +7 -5
- package/dist/registry/basic/separator.d.ts +16 -0
- package/dist/registry/basic/sheet.d.ts +13 -0
- package/dist/registry/basic/slider.d.ts +7 -5
- package/dist/registry/basic/sonner.d.ts +7 -5
- package/dist/registry/basic/switch.d.ts +7 -5
- package/dist/registry/basic/tabs.d.ts +7 -5
- package/dist/registry/basic/tag.d.ts +7 -5
- package/dist/registry/basic/textarea.d.ts +15 -0
- package/dist/registry/basic/theme-from-document.d.ts +7 -5
- package/dist/registry/basic/toggle.d.ts +1 -1
- package/dist/registry/basic/tooltip.d.ts +7 -5
- package/dist/registry/basic/typography.d.ts +7 -5
- package/dist/registry/chat/ask-user-part.d.ts +9 -3
- package/dist/registry/chat/browser-action-part.d.ts +9 -3
- package/dist/registry/chat/chat-input/compound.d.ts +7 -5
- package/dist/registry/chat/chat-input/context.d.ts +10 -6
- package/dist/registry/chat/chat-input/index.d.ts +7 -5
- package/dist/registry/chat/chat-input/types.d.ts +9 -3
- package/dist/registry/chat/chat-input/useAutoResizeTextarea.d.ts +9 -3
- package/dist/registry/chat/code-block-part.d.ts +9 -3
- package/dist/registry/chat/conversation-anchor-nav.d.ts +72 -0
- package/dist/registry/chat/file-attachment.d.ts +7 -5
- package/dist/registry/chat/file-review-part.d.ts +9 -4
- package/dist/registry/chat/generated-images-grid.d.ts +9 -3
- package/dist/registry/chat/generation-status-bar.d.ts +8 -4
- package/dist/registry/chat/hint-banner.d.ts +9 -3
- package/dist/registry/chat/mermaid-part.d.ts +9 -3
- package/dist/registry/chat/plan-part.d.ts +9 -3
- package/dist/registry/chat/reasoning-step/index.d.ts +8 -6
- package/dist/registry/chat/reasoning-step/types.d.ts +9 -3
- package/dist/registry/chat/related-prompts.d.ts +9 -3
- package/dist/registry/chat/response/index.d.ts +8 -6
- package/dist/registry/chat/response/types.d.ts +9 -3
- package/dist/registry/chat/task-part.d.ts +9 -3
- package/dist/registry/chat/terminal-code-block-part.d.ts +9 -3
- package/dist/registry/chat/tool-invocation-card.d.ts +2 -0
- package/dist/registry/chat/user-question/UserQuestionCard.d.ts +9 -3
- package/dist/registry/chat/user-question/UserQuestionFooter.d.ts +9 -3
- package/dist/registry/chat/user-question/UserQuestionHeader.d.ts +9 -3
- package/dist/registry/chat/user-question/types.d.ts +8 -5
- package/dist/registry/lib/file-icon-maps.d.ts +7 -7
- package/dist/registry/lib/utils.d.ts +8 -6
- package/dist/scale/presets/compact.css +16 -5
- package/dist/scale/presets/dense.css +13 -2
- package/dist/scale/presets/sharp.css +18 -6
- package/dist/scale/presets/soft.css +23 -1
- package/dist/spark-design.cjs.js +40 -36
- package/dist/spark-design.es.js +8653 -8663
- package/dist/sparkdesign.css +2 -0
- package/dist/src/components/basic/Alert/index.d.ts +13 -0
- package/dist/src/components/basic/AlertDialog/index.d.ts +7 -5
- package/dist/src/components/basic/AspectRatio/index.d.ts +13 -0
- package/dist/src/components/basic/Avatar/index.d.ts +9 -3
- package/dist/src/components/basic/Breadcrumb/index.d.ts +12 -0
- package/dist/src/components/basic/Button/index.d.ts +9 -3
- package/dist/src/components/basic/ButtonGroup/index.d.ts +13 -0
- package/dist/src/components/basic/Calendar/index.d.ts +13 -0
- package/dist/src/components/basic/Card/index.d.ts +13 -0
- package/dist/src/components/basic/Carousel/index.d.ts +12 -0
- package/dist/src/components/basic/Chart/index.d.ts +13 -0
- package/dist/src/components/basic/Checkbox/index.d.ts +13 -0
- package/dist/src/components/basic/Collapse/index.d.ts +7 -4
- package/dist/src/components/basic/Collapsible/index.d.ts +9 -4
- package/dist/src/components/basic/CollapsibleCard/index.d.ts +9 -3
- package/dist/src/components/basic/CollapsibleSection/index.d.ts +7 -7
- package/dist/src/components/basic/Combobox/index.d.ts +13 -0
- package/dist/src/components/basic/Command/index.d.ts +12 -0
- package/dist/src/components/basic/ContextMenu/index.d.ts +19 -0
- package/dist/src/components/basic/DataTable/index.d.ts +13 -0
- package/dist/src/components/basic/DatePicker/index.d.ts +13 -0
- package/dist/src/components/basic/Dialog/index.d.ts +16 -0
- package/dist/src/components/basic/Direction/index.d.ts +13 -0
- package/dist/src/components/basic/Drawer/index.d.ts +16 -0
- package/dist/src/components/basic/DropdownMenu/index.d.ts +7 -5
- package/dist/src/components/basic/EllipsisText/index.d.ts +7 -15
- package/dist/src/components/basic/Empty/index.d.ts +12 -0
- package/dist/src/components/basic/Field/index.d.ts +12 -0
- package/dist/src/components/basic/HoverCard/index.d.ts +16 -0
- package/dist/src/components/basic/IconButton/index.d.ts +9 -3
- package/dist/src/components/basic/Input/index.d.ts +13 -0
- package/dist/src/components/basic/InputGroup/index.d.ts +12 -0
- package/dist/src/components/basic/InputOTP/index.d.ts +12 -0
- package/dist/src/components/basic/Item/index.d.ts +12 -0
- package/dist/src/components/basic/Kbd/index.d.ts +9 -3
- package/dist/src/components/basic/Label/index.d.ts +13 -0
- package/dist/src/components/basic/Menubar/index.d.ts +12 -0
- package/dist/src/components/basic/NativeSelect/index.d.ts +12 -0
- package/dist/src/components/basic/NavigationMenu/index.d.ts +12 -0
- package/dist/src/components/basic/OptionList/index.d.ts +9 -3
- package/dist/src/components/basic/Pagination/index.d.ts +9 -3
- package/dist/src/components/basic/Popover/index.d.ts +16 -0
- package/dist/src/components/basic/Progress/index.d.ts +9 -3
- package/dist/src/components/basic/RadioGroup/index.d.ts +9 -3
- package/dist/src/components/basic/Resizable/index.d.ts +9 -3
- package/dist/src/components/basic/ScrollArea/index.d.ts +12 -0
- package/dist/src/components/basic/Scrollbar/index.d.ts +9 -3
- package/dist/src/components/basic/Select/index.d.ts +7 -4
- package/dist/src/components/basic/Separator/index.d.ts +13 -0
- package/dist/src/components/basic/Sheet/index.d.ts +13 -0
- package/dist/src/components/basic/ShimmeringText/index.d.ts +9 -3
- package/dist/src/components/basic/Skeleton/index.d.ts +9 -3
- package/dist/src/components/basic/Slider/index.d.ts +9 -3
- package/dist/src/components/basic/Spinner/index.d.ts +9 -3
- package/dist/src/components/basic/Switch/index.d.ts +8 -5
- package/dist/src/components/basic/Table/index.d.ts +9 -3
- package/dist/src/components/basic/Tabs/index.d.ts +9 -3
- package/dist/src/components/basic/Tag/index.d.ts +7 -4
- package/dist/src/components/basic/Textarea/index.d.ts +13 -0
- package/dist/src/components/basic/Toggle/index.d.ts +9 -3
- package/dist/src/components/basic/Tooltip/index.d.ts +7 -4
- package/dist/src/components/basic/Typography/index.d.ts +9 -3
- package/dist/src/components/chat/ConversationAnchorNav/index.d.ts +13 -0
- package/dist/src/components/chat/GeneratedImagesGrid/index.d.ts +9 -3
- package/dist/src/components/chat/GenerationStatusBar/index.d.ts +9 -3
- package/dist/src/components/chat/Markdown/demo-content.d.ts +1 -1
- package/dist/src/components/chat/Markdown/index.d.ts +9 -3
- package/dist/src/components/chat/Response/StreamingMarkdownBlock.d.ts +9 -3
- package/dist/src/components/chat/Response/index.d.ts +8 -6
- package/dist/src/components/chat/StreamingMarkdownBlock/index.d.ts +13 -0
- package/dist/src/components/chat/UserMessage/index.d.ts +9 -3
- package/dist/src/components/index.d.ts +64 -9
- package/dist/src/icons/context.d.ts +7 -6
- package/dist/src/icons/types.d.ts +7 -5
- package/dist/src/lib/ThemeStyleContext.d.ts +9 -9
- package/dist/src/lib/file-icon.d.ts +7 -6
- package/dist/src/lib/i18n.d.ts +7 -6
- package/dist/src/lib/index.d.ts +9 -3
- package/dist/src/lib/utils.d.ts +7 -5
- package/dist/theme-base.css +7 -8
- package/dist/theme.css +2 -2
- package/dist/themes/{dark-qoder.css → dark-mint.css} +1 -1
- package/dist/themes/{light-qoder.css → light-mint.css} +1 -1
- package/dist/tokens/AGENTS.md +48 -0
- package/dist/tokens/index.css +10 -19
- package/dist/tokens/scale/presets/compact.css +16 -5
- package/dist/tokens/scale/presets/dense.css +13 -2
- package/dist/tokens/scale/presets/sharp.css +18 -6
- package/dist/tokens/scale/presets/soft.css +23 -1
- package/dist/tokens/theme-base.css +7 -8
- package/dist/tokens/theme.css +2 -2
- package/dist/tokens/themes/dark-mint.css +133 -0
- package/dist/tokens/themes/light-mint.css +132 -0
- package/docs/agent/component-selection.md +60 -0
- package/docs/agent/token-ontology.md +37 -0
- package/package.json +41 -9
- package/registry/agent-manifest.json +794 -0
- package/registry/tokens/ontology.json +404 -0
- package/cli/registry/tokens/themes/dark-qoder.css +0 -132
- package/cli/registry/tokens/themes/light-qoder.css +0 -131
- package/dist/_basePickBy-DnQN8w3y.js +0 -151
- package/dist/_basePickBy-a-kPMlkg.cjs +0 -1
- package/dist/_baseUniq-B-N2NQ50.js +0 -614
- package/dist/_baseUniq-Cc_zbSif.cjs +0 -1
- package/dist/arc-BQBhijZ6.js +0 -83
- package/dist/arc-mWQt0Yph.cjs +0 -1
- package/dist/architectureDiagram-VXUJARFQ-BMZEucno.cjs +0 -36
- package/dist/architectureDiagram-VXUJARFQ-DTdjD3Bp.js +0 -4661
- package/dist/blockDiagram-VD42YOAC-CzHn0yob.js +0 -2256
- package/dist/blockDiagram-VD42YOAC-DDxdHAlz.cjs +0 -122
- package/dist/c4Diagram-YG6GDRKO-4Gz0I4gj.cjs +0 -10
- package/dist/c4Diagram-YG6GDRKO-BIy--yVN.js +0 -1580
- package/dist/channel-BQn0o8bs.js +0 -5
- package/dist/channel-DaN7XniJ.cjs +0 -1
- package/dist/chunk-4BX2VUAB-BlQFTQqz.cjs +0 -1
- package/dist/chunk-4BX2VUAB-Czitj3Kc.js +0 -8
- package/dist/chunk-55IACEB6-DXacNZbO.js +0 -8
- package/dist/chunk-55IACEB6-DnDxpye9.cjs +0 -1
- package/dist/chunk-B4BG7PRW-CBdN0q_V.js +0 -1375
- package/dist/chunk-B4BG7PRW-DbGvUkGO.cjs +0 -165
- package/dist/chunk-DI55MBZ5-D1YJMs6x.cjs +0 -220
- package/dist/chunk-DI55MBZ5-NCQTvayw.js +0 -1370
- package/dist/chunk-FMBD7UC4-CsGMbrtr.js +0 -19
- package/dist/chunk-FMBD7UC4-Di7cUUh5.cjs +0 -15
- package/dist/chunk-QN33PNHL-0j5LC8Lm.cjs +0 -1
- package/dist/chunk-QN33PNHL-3GERZBRm.js +0 -19
- package/dist/chunk-QZHKN3VN-AVEY9ImQ.js +0 -15
- package/dist/chunk-QZHKN3VN-s8Z0a8mc.cjs +0 -1
- package/dist/chunk-TZMSLE5B-CAf87HPt.cjs +0 -1
- package/dist/chunk-TZMSLE5B-sbiflal0.js +0 -64
- package/dist/classDiagram-2ON5EDUG-Ct9JLIN2.cjs +0 -1
- package/dist/classDiagram-2ON5EDUG-Dzfrft3a.js +0 -16
- package/dist/classDiagram-v2-WZHVMYZB-Ct9JLIN2.cjs +0 -1
- package/dist/classDiagram-v2-WZHVMYZB-Dzfrft3a.js +0 -16
- package/dist/clone-Cde_NQ8V.js +0 -8
- package/dist/clone-DCNjWuM2.cjs +0 -1
- package/dist/cose-bilkent-S5V4N54A-0uLijMro.cjs +0 -1
- package/dist/cose-bilkent-S5V4N54A-Bb08N431.js +0 -2608
- package/dist/cytoscape.esm-CNUX3VTg.cjs +0 -321
- package/dist/cytoscape.esm-Cvf3sx9F.js +0 -18704
- package/dist/dagre-6UL2VRFP-CY_Wz5Zd.js +0 -444
- package/dist/dagre-6UL2VRFP-Dxe7_qZc.cjs +0 -4
- package/dist/defaultLocale-BgPVtth8.js +0 -171
- package/dist/defaultLocale-C4wbwF1n.cjs +0 -1
- package/dist/diagram-PSM6KHXK-D2bdb7MT.js +0 -531
- package/dist/diagram-PSM6KHXK-YF69SUjY.cjs +0 -24
- package/dist/diagram-QEK2KX5R-BpUSoh0-.js +0 -217
- package/dist/diagram-QEK2KX5R-DZPGteon.cjs +0 -43
- package/dist/diagram-S2PKOQOG-ht-zdvFG.cjs +0 -24
- package/dist/diagram-S2PKOQOG-zFeLJ50Z.js +0 -142
- package/dist/erDiagram-Q2GNP2WA-B38iJ6ts.js +0 -841
- package/dist/erDiagram-Q2GNP2WA-RgS80DDU.cjs +0 -60
- package/dist/flowDiagram-NV44I4VS-BHilOs2p.cjs +0 -162
- package/dist/flowDiagram-NV44I4VS-BrBJcoce.js +0 -1620
- package/dist/ganttDiagram-JELNMOA3-pZiJeFio.cjs +0 -267
- package/dist/ganttDiagram-JELNMOA3-tw6FhkWJ.js +0 -2670
- package/dist/gitGraphDiagram-V2S2FVAM-BWn5uIK5.js +0 -699
- package/dist/gitGraphDiagram-V2S2FVAM-DKKeG-9R.cjs +0 -65
- package/dist/graph-DIbblrZP.cjs +0 -1
- package/dist/graph-DPcK91G3.js +0 -247
- package/dist/infoDiagram-HS3SLOUP-B8gwwhct.cjs +0 -2
- package/dist/infoDiagram-HS3SLOUP-D47PNcP_.js +0 -24
- package/dist/init-CHZsXQcr.cjs +0 -1
- package/dist/init-DjUOC4st.js +0 -16
- package/dist/journeyDiagram-XKPGCS4Q-BG3cfhyU.js +0 -834
- package/dist/journeyDiagram-XKPGCS4Q-D8DVLJof.cjs +0 -139
- package/dist/kanban-definition-3W4ZIXB7-4OCnEouP.cjs +0 -89
- package/dist/kanban-definition-3W4ZIXB7-CWi_ssF9.js +0 -719
- package/dist/layout-Byuh8f-J.cjs +0 -1
- package/dist/layout-CdLdvj1j.js +0 -1335
- package/dist/linear-C2Q_PI9B.js +0 -259
- package/dist/linear-C69aPBW1.cjs +0 -1
- package/dist/mermaid.core-DBwAx_jp.cjs +0 -249
- package/dist/mermaid.core-gFR0XUlD.js +0 -15300
- package/dist/mindmap-definition-VGOIOE7T-8P7obVV4.cjs +0 -68
- package/dist/mindmap-definition-VGOIOE7T-DnOa7WJ9.js +0 -784
- package/dist/ordinal-B6-f3MAq.js +0 -61
- package/dist/ordinal-CagbB1m8.cjs +0 -1
- package/dist/pieDiagram-ADFJNKIX-5NAlvhMo.js +0 -161
- package/dist/pieDiagram-ADFJNKIX-CQBG4yR9.cjs +0 -30
- package/dist/qoder-design.css +0 -2
- package/dist/quadrantDiagram-AYHSOK5B-Oe4y7RZ0.cjs +0 -7
- package/dist/quadrantDiagram-AYHSOK5B-rh2DPEP1.js +0 -1022
- package/dist/requirementDiagram-UZGBJVZJ-DcWaCuXr.js +0 -850
- package/dist/requirementDiagram-UZGBJVZJ-gfdlrFiq.cjs +0 -64
- package/dist/sankeyDiagram-TZEHDZUN-CQIKFwD0.js +0 -810
- package/dist/sankeyDiagram-TZEHDZUN-DvPtzQvC.cjs +0 -10
- package/dist/sequenceDiagram-WL72ISMW-BNrsMagL.cjs +0 -145
- package/dist/sequenceDiagram-WL72ISMW-iCX3ckKx.js +0 -2511
- package/dist/stateDiagram-FKZM4ZOC-DBvJ_eeL.cjs +0 -1
- package/dist/stateDiagram-FKZM4ZOC-ZVsJlaHJ.js +0 -263
- package/dist/stateDiagram-v2-4FDKWEC3-CB_nTHcE.js +0 -16
- package/dist/stateDiagram-v2-4FDKWEC3-Xkx17v6T.cjs +0 -1
- package/dist/timeline-definition-IT6M3QCI-BmGkYQiz.cjs +0 -61
- package/dist/timeline-definition-IT6M3QCI-Ck8zTt6w.js +0 -795
- package/dist/tokens/CLAUDE.md +0 -305
- package/dist/treemap-GDKQZRPO-B9sfERx8.js +0 -17922
- package/dist/treemap-GDKQZRPO-BVfJRs0Z.cjs +0 -160
- package/dist/xychartDiagram-PRI3JC2R-By_S8NzN.js +0 -1340
- package/dist/xychartDiagram-PRI3JC2R-CNfDrGxM.cjs +0 -7
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [WHO]: Public exports from this file (see implementation below).
|
|
3
|
+
* [FROM]: See the import block immediately after this header.
|
|
4
|
+
* [TO]: sparkdesign package consumers; output of CLI `add` when applicable.
|
|
5
|
+
* [HERE]: cli/src/utils/package-manager.ts — Spark Design source; keep aligned with the main library.
|
|
6
|
+
*
|
|
7
|
+
* [PROTOCOL]:
|
|
8
|
+
* 1. Keep this P3 header in sync when the public contract changes.
|
|
9
|
+
* 2. Update module AGENTS.md (P2) and root AGENTS.md (P1) when boundaries change.
|
|
10
|
+
* 3. Follow design tokens and explicit type exports.
|
|
11
|
+
*/
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import fs from 'fs-extra';
|
|
14
|
+
import { execa } from 'execa';
|
|
15
|
+
const LOCKFILE_TO_PM = [
|
|
16
|
+
{ file: 'pnpm-lock.yaml', pm: 'pnpm' },
|
|
17
|
+
{ file: 'yarn.lock', pm: 'yarn' },
|
|
18
|
+
{ file: 'bun.lockb', pm: 'bun' },
|
|
19
|
+
{ file: 'bun.lock', pm: 'bun' },
|
|
20
|
+
{ file: 'package-lock.json', pm: 'npm' },
|
|
21
|
+
];
|
|
22
|
+
function parsePackageManagerField(value) {
|
|
23
|
+
if (typeof value !== 'string') {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
if (value.startsWith('pnpm@'))
|
|
27
|
+
return 'pnpm';
|
|
28
|
+
if (value.startsWith('yarn@'))
|
|
29
|
+
return 'yarn';
|
|
30
|
+
if (value.startsWith('bun@'))
|
|
31
|
+
return 'bun';
|
|
32
|
+
if (value.startsWith('npm@'))
|
|
33
|
+
return 'npm';
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
export async function detectPackageManager(cwd) {
|
|
37
|
+
const packageJsonPath = path.join(cwd, 'package.json');
|
|
38
|
+
if (await fs.pathExists(packageJsonPath)) {
|
|
39
|
+
try {
|
|
40
|
+
const packageJson = await fs.readJson(packageJsonPath);
|
|
41
|
+
const fromField = parsePackageManagerField(packageJson.packageManager);
|
|
42
|
+
if (fromField) {
|
|
43
|
+
return fromField;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// Ignore malformed package.json and continue to lockfile detection.
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
for (const candidate of LOCKFILE_TO_PM) {
|
|
51
|
+
if (await fs.pathExists(path.join(cwd, candidate.file))) {
|
|
52
|
+
return candidate.pm;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return 'npm';
|
|
56
|
+
}
|
|
57
|
+
export function getInstallCommand(pm, dependencies) {
|
|
58
|
+
switch (pm) {
|
|
59
|
+
case 'pnpm':
|
|
60
|
+
return { command: 'pnpm', args: ['add', ...dependencies], display: `pnpm add ${dependencies.join(' ')}` };
|
|
61
|
+
case 'yarn':
|
|
62
|
+
return { command: 'yarn', args: ['add', ...dependencies], display: `yarn add ${dependencies.join(' ')}` };
|
|
63
|
+
case 'bun':
|
|
64
|
+
return { command: 'bun', args: ['add', ...dependencies], display: `bun add ${dependencies.join(' ')}` };
|
|
65
|
+
case 'npm':
|
|
66
|
+
default:
|
|
67
|
+
return { command: 'npm', args: ['install', ...dependencies], display: `npm install ${dependencies.join(' ')}` };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export async function installDependencies(cwd, dependencies) {
|
|
71
|
+
const pm = await detectPackageManager(cwd);
|
|
72
|
+
const install = getInstallCommand(pm, dependencies);
|
|
73
|
+
await execa(install.command, install.args, { cwd, stdio: 'inherit' });
|
|
74
|
+
return { pm, display: install.display };
|
|
75
|
+
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* [
|
|
3
|
-
* [
|
|
4
|
-
* [
|
|
2
|
+
* [WHO]: Public exports from this file (see implementation below).
|
|
3
|
+
* [FROM]: See the import block immediately after this header.
|
|
4
|
+
* [TO]: sparkdesign package consumers; output of CLI `add` when applicable.
|
|
5
|
+
* [HERE]: cli/src/utils/registry.ts — Spark Design source; keep aligned with the main library.
|
|
5
6
|
*
|
|
6
|
-
* [PROTOCOL]:
|
|
7
|
+
* [PROTOCOL]:
|
|
8
|
+
* 1. Keep this P3 header in sync when the public contract changes.
|
|
9
|
+
* 2. Update module AGENTS.md (P2) and root AGENTS.md (P1) when boundaries change.
|
|
10
|
+
* 3. Follow design tokens and explicit type exports.
|
|
7
11
|
*/
|
|
8
12
|
import path from 'node:path';
|
|
9
13
|
import fs from 'fs-extra';
|
package/cli/dist/utils/tokens.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* [
|
|
3
|
-
* [
|
|
4
|
-
* [
|
|
2
|
+
* [WHO]: Public exports from this file (see implementation below).
|
|
3
|
+
* [FROM]: See the import block immediately after this header.
|
|
4
|
+
* [TO]: sparkdesign package consumers; output of CLI `add` when applicable.
|
|
5
|
+
* [HERE]: cli/src/utils/tokens.ts — Spark Design source; keep aligned with the main library.
|
|
5
6
|
*
|
|
6
|
-
* [PROTOCOL]:
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* [PROTOCOL]:
|
|
8
|
+
* 1. Keep this P3 header in sync when the public contract changes.
|
|
9
|
+
* 2. Update module AGENTS.md (P2) and root AGENTS.md (P1) when boundaries change.
|
|
10
|
+
* 3. Follow design tokens and explicit type exports.
|
|
9
11
|
*/
|
|
10
12
|
import path from 'node:path';
|
|
11
13
|
import fs from 'fs-extra';
|
|
@@ -45,7 +47,8 @@ async function readScaleContents(registryRoot) {
|
|
|
45
47
|
}
|
|
46
48
|
return '';
|
|
47
49
|
}
|
|
48
|
-
|
|
50
|
+
const PRIMARY_TOKENS_FILE = 'sparkdesign-tokens.css';
|
|
51
|
+
/** 项目里是否已有 token(入口 CSS 内联了变量、或已 import tokens 文件) */
|
|
49
52
|
export async function projectHasTokens(cwd) {
|
|
50
53
|
const candidates = [
|
|
51
54
|
path.join(cwd, 'src', 'app', 'globals.css'),
|
|
@@ -58,7 +61,7 @@ export async function projectHasTokens(cwd) {
|
|
|
58
61
|
const content = await fs.readFile(p, 'utf-8');
|
|
59
62
|
if (content.includes('--color-primary:') ||
|
|
60
63
|
content.includes(TOKEN_MARKER) ||
|
|
61
|
-
content.includes(
|
|
64
|
+
content.includes(PRIMARY_TOKENS_FILE)) {
|
|
62
65
|
return true;
|
|
63
66
|
}
|
|
64
67
|
}
|
|
@@ -73,6 +76,7 @@ export async function ensureDesignTokens(cwd, registryRoot) {
|
|
|
73
76
|
const themePath = path.join(registryRoot, 'tokens', 'theme.css');
|
|
74
77
|
const scalePath = path.join(registryRoot, 'tokens', 'scale.css');
|
|
75
78
|
const scrollbarPath = path.join(registryRoot, 'tokens', 'scrollbar-utility.css');
|
|
79
|
+
const themeBasePath = path.join(registryRoot, 'tokens', 'theme-base.css');
|
|
76
80
|
const themesDir = path.join(registryRoot, 'tokens', 'themes');
|
|
77
81
|
// 检查是否有可用的 tokens 文件
|
|
78
82
|
const hasNewStructure = await fs.pathExists(indexPath);
|
|
@@ -95,18 +99,20 @@ export async function ensureDesignTokens(cwd, registryRoot) {
|
|
|
95
99
|
if (hasNewStructure && (await fs.pathExists(themesDir))) {
|
|
96
100
|
// 新结构:读取拆分的主题文件并内联
|
|
97
101
|
const scaleContent = await readScaleContents(registryRoot);
|
|
98
|
-
const lightContent = await readFileIfExists(path.join(themesDir, 'light-
|
|
99
|
-
const darkContent = await readFileIfExists(path.join(themesDir, 'dark-
|
|
102
|
+
const lightContent = await readFileIfExists(path.join(themesDir, 'light-mint.css'));
|
|
103
|
+
const darkContent = await readFileIfExists(path.join(themesDir, 'dark-mint.css'));
|
|
100
104
|
const lightParchmentContent = await readFileIfExists(path.join(themesDir, 'light-parchment.css'));
|
|
101
105
|
const darkParchmentContent = await readFileIfExists(path.join(themesDir, 'dark-parchment.css'));
|
|
102
106
|
const scrollbarContent = await readFileIfExists(scrollbarPath);
|
|
107
|
+
const themeBaseContent = await readFileIfExists(themeBasePath);
|
|
103
108
|
tokensBlock = `/* ${TOKEN_MARKER} - 由 npx sparkdesign init 写入,驱动组件样式 */\n` +
|
|
104
109
|
`${scaleContent}\n\n` +
|
|
105
110
|
`${lightContent}\n\n` +
|
|
106
111
|
`${darkContent}\n\n` +
|
|
107
112
|
`${lightParchmentContent}\n\n` +
|
|
108
113
|
`${darkParchmentContent}\n` +
|
|
109
|
-
(scrollbarContent ? `\n${scrollbarContent}\n` : '')
|
|
114
|
+
(scrollbarContent ? `\n${scrollbarContent}\n` : '') +
|
|
115
|
+
(themeBaseContent ? `\n${themeBaseContent}\n` : '');
|
|
110
116
|
}
|
|
111
117
|
else {
|
|
112
118
|
// 兼容旧结构
|
|
@@ -124,39 +130,41 @@ export async function ensureDesignTokens(cwd, registryRoot) {
|
|
|
124
130
|
await fs.writeFile(cssEntry, newContent, 'utf-8');
|
|
125
131
|
return cssEntry;
|
|
126
132
|
}
|
|
127
|
-
const DEDICATED_TOKENS_FILE = 'qoder-tokens.css';
|
|
128
133
|
/** 仅 add 使用:在 src 下生成独立 token 文件,不修改用户入口。若已存在则不覆盖。返回路径及是否本次创建。 */
|
|
129
|
-
export async function
|
|
134
|
+
export async function writeSparkTokensFile(cwd, registryRoot) {
|
|
130
135
|
const indexPath = path.join(registryRoot, 'tokens', 'index.css');
|
|
131
136
|
const themePath = path.join(registryRoot, 'tokens', 'theme.css');
|
|
132
137
|
const scalePath = path.join(registryRoot, 'tokens', 'scale.css');
|
|
133
138
|
const scrollbarPath = path.join(registryRoot, 'tokens', 'scrollbar-utility.css');
|
|
139
|
+
const themeBasePath = path.join(registryRoot, 'tokens', 'theme-base.css');
|
|
134
140
|
const themesDir = path.join(registryRoot, 'tokens', 'themes');
|
|
135
|
-
const
|
|
136
|
-
if (await fs.pathExists(
|
|
137
|
-
return { path:
|
|
141
|
+
const primaryPath = path.join(cwd, 'src', PRIMARY_TOKENS_FILE);
|
|
142
|
+
if (await fs.pathExists(primaryPath)) {
|
|
143
|
+
return { path: primaryPath, created: false };
|
|
138
144
|
}
|
|
139
145
|
const hasNewStructure = await fs.pathExists(indexPath);
|
|
140
146
|
const hasLegacyStructure = (await fs.pathExists(themePath)) && (await fs.pathExists(scalePath));
|
|
141
147
|
if (!hasNewStructure && !hasLegacyStructure) {
|
|
142
|
-
return { path:
|
|
148
|
+
return { path: primaryPath, created: false };
|
|
143
149
|
}
|
|
144
150
|
let content;
|
|
145
151
|
if (hasNewStructure && (await fs.pathExists(themesDir))) {
|
|
146
152
|
// 新结构:读取拆分的主题文件并内联
|
|
147
153
|
const scaleContent = await readScaleContents(registryRoot);
|
|
148
|
-
const lightContent = await readFileIfExists(path.join(themesDir, 'light-
|
|
149
|
-
const darkContent = await readFileIfExists(path.join(themesDir, 'dark-
|
|
154
|
+
const lightContent = await readFileIfExists(path.join(themesDir, 'light-mint.css'));
|
|
155
|
+
const darkContent = await readFileIfExists(path.join(themesDir, 'dark-mint.css'));
|
|
150
156
|
const lightParchmentContent = await readFileIfExists(path.join(themesDir, 'light-parchment.css'));
|
|
151
157
|
const darkParchmentContent = await readFileIfExists(path.join(themesDir, 'dark-parchment.css'));
|
|
152
158
|
const scrollbarContent = await readFileIfExists(scrollbarPath);
|
|
159
|
+
const themeBaseContent = await readFileIfExists(themeBasePath);
|
|
153
160
|
content = `/* ${TOKEN_MARKER} - 在应用入口 import 此文件以驱动组件样式 */\n` +
|
|
154
161
|
`${scaleContent}\n\n` +
|
|
155
162
|
`${lightContent}\n\n` +
|
|
156
163
|
`${darkContent}\n\n` +
|
|
157
164
|
`${lightParchmentContent}\n\n` +
|
|
158
165
|
`${darkParchmentContent}\n` +
|
|
159
|
-
(scrollbarContent ? `\n${scrollbarContent}\n` : '')
|
|
166
|
+
(scrollbarContent ? `\n${scrollbarContent}\n` : '') +
|
|
167
|
+
(themeBaseContent ? `\n${themeBaseContent}\n` : '');
|
|
160
168
|
}
|
|
161
169
|
else {
|
|
162
170
|
// 兼容旧结构
|
|
@@ -167,10 +175,10 @@ export async function writeQoderTokensFile(cwd, registryRoot) {
|
|
|
167
175
|
`/* ${TOKEN_MARKER} - 在应用入口 import 此文件以驱动组件样式 */\n${scaleContent}\n\n${themeContent}\n` +
|
|
168
176
|
(scrollbarContent ? `\n${scrollbarContent}\n` : '');
|
|
169
177
|
}
|
|
170
|
-
await fs.ensureDir(path.dirname(
|
|
171
|
-
await fs.writeFile(
|
|
172
|
-
return { path:
|
|
178
|
+
await fs.ensureDir(path.dirname(primaryPath));
|
|
179
|
+
await fs.writeFile(primaryPath, content, 'utf-8');
|
|
180
|
+
return { path: primaryPath, created: true };
|
|
173
181
|
}
|
|
174
|
-
export function
|
|
175
|
-
return `./${
|
|
182
|
+
export function getSparkTokensImportPath() {
|
|
183
|
+
return `./${PRIMARY_TOKENS_FILE}`;
|
|
176
184
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* [
|
|
3
|
-
* [
|
|
4
|
-
* [
|
|
2
|
+
* [WHO]: Public exports from this file (see implementation below).
|
|
3
|
+
* [FROM]: See the import block immediately after this header.
|
|
4
|
+
* [TO]: sparkdesign package consumers; output of CLI `add` when applicable.
|
|
5
|
+
* [HERE]: cli/src/utils/transform.ts — Spark Design source; keep aligned with the main library.
|
|
5
6
|
*
|
|
6
|
-
* [PROTOCOL]:
|
|
7
|
+
* [PROTOCOL]:
|
|
8
|
+
* 1. Keep this P3 header in sync when the public contract changes.
|
|
9
|
+
* 2. Update module AGENTS.md (P2) and root AGENTS.md (P1) when boundaries change.
|
|
10
|
+
* 3. Follow design tokens and explicit type exports.
|
|
7
11
|
*/
|
|
8
|
-
/** 移除文件开头的
|
|
12
|
+
/** 移除文件开头的 P3(DIP)协议块注释,使按需引入到用户项目的代码不包含内部导航头。 */
|
|
9
13
|
export function stripL3Header(source) {
|
|
10
14
|
return source.replace(/^\s*\/\*\*[\s\S]*?\*\/\s*/, '').trimStart();
|
|
11
15
|
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [WHO]: Public exports from this file (see implementation below).
|
|
3
|
+
* [FROM]: See the import block immediately after this header.
|
|
4
|
+
* [TO]: sparkdesign package consumers; output of CLI `add` when applicable.
|
|
5
|
+
* [HERE]: cli/src/utils/tsconfig.ts — Spark Design source; keep aligned with the main library.
|
|
6
|
+
*
|
|
7
|
+
* [PROTOCOL]:
|
|
8
|
+
* 1. Keep this P3 header in sync when the public contract changes.
|
|
9
|
+
* 2. Update module AGENTS.md (P2) and root AGENTS.md (P1) when boundaries change.
|
|
10
|
+
* 3. Follow design tokens and explicit type exports.
|
|
11
|
+
*/
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import fs from 'fs-extra';
|
|
14
|
+
import chalk from 'chalk';
|
|
15
|
+
export function stripJsonComments(raw) {
|
|
16
|
+
return raw.replace(/\/\*[\s\S]*?\*\//g, '').replace(/\/\/.*$/gm, '').replace(/,(\s*[}\]])/g, '$1');
|
|
17
|
+
}
|
|
18
|
+
/** 检查 / 修复 tsconfig 的 @/* 路径别名,返回是否已存在(含本次写入) */
|
|
19
|
+
async function ensureTsPaths(cwd) {
|
|
20
|
+
for (const name of ['tsconfig.json', 'tsconfig.app.json']) {
|
|
21
|
+
const configPath = path.join(cwd, name);
|
|
22
|
+
if (!(await fs.pathExists(configPath)))
|
|
23
|
+
continue;
|
|
24
|
+
const raw = await fs.readFile(configPath, 'utf-8');
|
|
25
|
+
let config = null;
|
|
26
|
+
try {
|
|
27
|
+
config = JSON.parse(raw);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
try {
|
|
31
|
+
config = JSON.parse(stripJsonComments(raw));
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const co = config?.compilerOptions;
|
|
38
|
+
if (co?.paths && co.paths['@/*'])
|
|
39
|
+
return true;
|
|
40
|
+
if (!co || !config)
|
|
41
|
+
continue;
|
|
42
|
+
// 无论原文件是否含注释,都写回有效 JSON(注释丢失可接受,alias 能用更重要)
|
|
43
|
+
const paths = (co.paths ?? {});
|
|
44
|
+
paths['@/*'] = ['./src/*'];
|
|
45
|
+
co.paths = paths;
|
|
46
|
+
if (!co.baseUrl)
|
|
47
|
+
co.baseUrl = '.';
|
|
48
|
+
await fs.writeJson(configPath, config, { spaces: 2 });
|
|
49
|
+
console.log(chalk.green('✓'), `Added @/* → ./src/* to ${name}`);
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
console.log(chalk.yellow('⚠'), '未找到 tsconfig.json。Spark 组件使用 @/ 导入别名,请确保配置:');
|
|
53
|
+
console.log(chalk.cyan(' "compilerOptions": { "paths": { "@/*": ["./src/*"] } }'));
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
async function detectBundler(cwd) {
|
|
57
|
+
const pkgPath = path.join(cwd, 'package.json');
|
|
58
|
+
if (!(await fs.pathExists(pkgPath)))
|
|
59
|
+
return 'unknown';
|
|
60
|
+
const pkg = await fs.readJson(pkgPath);
|
|
61
|
+
const allDeps = { ...(pkg.dependencies ?? {}), ...(pkg.devDependencies ?? {}) };
|
|
62
|
+
if (allDeps['next'])
|
|
63
|
+
return 'next';
|
|
64
|
+
if (allDeps['vite'] || allDeps['@vitejs/plugin-react'] || allDeps['@vitejs/plugin-react-swc'])
|
|
65
|
+
return 'vite';
|
|
66
|
+
return 'unknown';
|
|
67
|
+
}
|
|
68
|
+
/** Vite 配置文件路径(按优先级) */
|
|
69
|
+
const VITE_CONFIGS = ['vite.config.ts', 'vite.config.js', 'vite.config.mts', 'vite.config.mjs'];
|
|
70
|
+
/** 检查 Vite resolve.alias 是否已包含 @ 别名 */
|
|
71
|
+
async function viteHasAtAlias(cwd) {
|
|
72
|
+
for (const name of VITE_CONFIGS) {
|
|
73
|
+
const configPath = path.join(cwd, name);
|
|
74
|
+
if (!(await fs.pathExists(configPath)))
|
|
75
|
+
continue;
|
|
76
|
+
const content = await fs.readFile(configPath, 'utf-8');
|
|
77
|
+
// 常见写法检测:
|
|
78
|
+
// 1) resolve: { alias: { '@': ... } }
|
|
79
|
+
// 2) resolve: { alias: [{ find: '@', ... }] }
|
|
80
|
+
// 3) '@': path.resolve(...) 或 "@": ...
|
|
81
|
+
const hasAlias = /['"]@['"]/.test(content) && /alias/.test(content);
|
|
82
|
+
return { found: hasAlias, configFile: name };
|
|
83
|
+
}
|
|
84
|
+
return { found: false, configFile: null };
|
|
85
|
+
}
|
|
86
|
+
/** 尝试自动向 Vite 配置追加 resolve.alias(仅限简单场景) */
|
|
87
|
+
async function tryPatchViteAlias(cwd, configFile) {
|
|
88
|
+
const configPath = path.join(cwd, configFile);
|
|
89
|
+
const content = await fs.readFile(configPath, 'utf-8');
|
|
90
|
+
// 检查是否已 import path
|
|
91
|
+
const hasPathImport = /import\s+path\s+from\s+['"](?:node:)?path['"]/.test(content) ||
|
|
92
|
+
/import\s*\{\s*resolve\s*\}\s*from\s*['"](?:node:)?path['"]/.test(content) ||
|
|
93
|
+
/const\s+path\s*=\s*require/.test(content) ||
|
|
94
|
+
/import\s+\*\s+as\s+path\s+from/.test(content);
|
|
95
|
+
const pathRef = hasPathImport ? 'path.resolve(__dirname, "./src")' : 'fileURLToPath(new URL("./src", import.meta.url))';
|
|
96
|
+
const pathImportLine = hasPathImport ? '' : "import { fileURLToPath, URL } from 'node:url'\n";
|
|
97
|
+
// 场景 1:已有 resolve: { alias: { ... } } 对象形式,追加 '@' 键
|
|
98
|
+
const aliasObjMatch = content.match(/(resolve\s*:\s*\{[^}]*alias\s*:\s*\{)([^}]*)\}/);
|
|
99
|
+
if (aliasObjMatch) {
|
|
100
|
+
const existingAliases = aliasObjMatch[2];
|
|
101
|
+
if (existingAliases.includes("'@'") || existingAliases.includes('"@"'))
|
|
102
|
+
return true; // 已有
|
|
103
|
+
const separator = existingAliases.trim().endsWith(',') || existingAliases.trim() === '' ? '' : ',';
|
|
104
|
+
let patched = content.replace(aliasObjMatch[0], `${aliasObjMatch[1]}${existingAliases}${separator}\n '@': ${pathRef},\n }`);
|
|
105
|
+
if (pathImportLine && !hasPathImport)
|
|
106
|
+
patched = pathImportLine + patched;
|
|
107
|
+
await fs.writeFile(configPath, patched, 'utf-8');
|
|
108
|
+
console.log(chalk.green('✓'), `Added resolve.alias['@'] → src/ to ${configFile}`);
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
// 场景 2:没有 resolve.alias 块 —— 在 defineConfig({...}) 或 export default {...} 内注入
|
|
112
|
+
const resolveBlock = ` resolve: {\n alias: {\n '@': ${pathRef},\n },\n },`;
|
|
113
|
+
// 2a: defineConfig({ ... })
|
|
114
|
+
const defineMatch = content.match(/(defineConfig\s*\(\s*\{)/);
|
|
115
|
+
if (defineMatch) {
|
|
116
|
+
let patched = content.replace(defineMatch[0], `${defineMatch[0]}\n${resolveBlock}`);
|
|
117
|
+
if (pathImportLine && !hasPathImport)
|
|
118
|
+
patched = pathImportLine + patched;
|
|
119
|
+
await fs.writeFile(configPath, patched, 'utf-8');
|
|
120
|
+
console.log(chalk.green('✓'), `Added resolve.alias['@'] → src/ to ${configFile}`);
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
// 2b: export default { ... }
|
|
124
|
+
const exportMatch = content.match(/(export\s+default\s*\{)/);
|
|
125
|
+
if (exportMatch) {
|
|
126
|
+
let patched = content.replace(exportMatch[0], `${exportMatch[0]}\n${resolveBlock}`);
|
|
127
|
+
if (pathImportLine && !hasPathImport)
|
|
128
|
+
patched = pathImportLine + patched;
|
|
129
|
+
await fs.writeFile(configPath, patched, 'utf-8');
|
|
130
|
+
console.log(chalk.green('✓'), `Added resolve.alias['@'] → src/ to ${configFile}`);
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
/** 输出 Vite alias 缺失的修复提示 */
|
|
136
|
+
function printViteAliasHint(configFile) {
|
|
137
|
+
const file = configFile ?? 'vite.config.ts';
|
|
138
|
+
console.log(chalk.yellow('⚠'), `${file} 缺少 @/ 运行时别名,组件导入将在启动时报错。请添加:`);
|
|
139
|
+
console.log(chalk.cyan(`
|
|
140
|
+
// ${file}
|
|
141
|
+
import path from 'node:path'
|
|
142
|
+
|
|
143
|
+
export default defineConfig({
|
|
144
|
+
resolve: {
|
|
145
|
+
alias: {
|
|
146
|
+
'@': path.resolve(__dirname, './src'),
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
// ...其余配置
|
|
150
|
+
})
|
|
151
|
+
`));
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* 一站式 alias 检查:TS 层 + bundler 运行时层。
|
|
155
|
+
* 在 init / add 中调用。
|
|
156
|
+
*/
|
|
157
|
+
export async function ensureTsAlias(cwd) {
|
|
158
|
+
// 1. TS 层
|
|
159
|
+
await ensureTsPaths(cwd);
|
|
160
|
+
// 2. Bundler 运行时层
|
|
161
|
+
const bundler = await detectBundler(cwd);
|
|
162
|
+
if (bundler === 'next') {
|
|
163
|
+
// Next.js 自动读取 tsconfig.json paths,无需额外 alias 配置
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (bundler === 'vite') {
|
|
167
|
+
const { found, configFile } = await viteHasAtAlias(cwd);
|
|
168
|
+
if (found)
|
|
169
|
+
return;
|
|
170
|
+
// 没有找到 Vite alias —— 尝试自动 patch
|
|
171
|
+
if (configFile) {
|
|
172
|
+
const patched = await tryPatchViteAlias(cwd, configFile);
|
|
173
|
+
if (patched)
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
// 自动 patch 失败或没找到配置文件 —— 输出手动提示
|
|
177
|
+
printViteAliasHint(configFile);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
// 未知 bundler —— 给出通用提示
|
|
181
|
+
console.log(chalk.gray(' 提示: 如果使用 webpack/Rspack 等打包器,请确保 resolve.alias 中配置了 @ → src/'));
|
|
182
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# registry/
|
|
2
|
+
|
|
3
|
+
> **P2** | Parent: [Root AGENTS.md](../AGENTS.md)
|
|
4
|
+
|
|
5
|
+
## Member list
|
|
6
|
+
|
|
7
|
+
- `basic/` — alert, alert-dialog, aspect-ratio, avatar, breadcrumb, button, button-group, calendar, card, carousel, chart, checkbox, collapse, collapsible, collapsible-card, combobox, command, context-menu, data-table, date-picker, dialog, direction, drawer, dropdown-menu, empty, field, hover-card, icon-button, input, input-group, input-otp, item, kbd, label, menubar, native-select, navigation-menu, option-list, pagination, popover, progress, radio-group, resizable, scroll-area, scrollbar, select, separator, sheet, shimmering-text, sidebar-menu, skeleton, slider, sonner, spinner, switch, table, tabs, tag, textarea, toggle, tooltip, typography.
|
|
8
|
+
- `chat/` — ask-user-part, browser-action-part, chat-input, code-block-part, conversation-anchor-nav, file-attachment, file-card, file-review-part, folder-button, generated-images-grid, generation-status-bar, hint-banner, image-attachment, image-generating, markdown, mermaid-part, permission-card, plan-part, queue-indicator, reasoning-step, related-prompts, response, send-button, streaming-markdown-block, task-part, terminal-code-block-part, thinking-indicator, tool-invocation-card, user-message, user-question, user-question-answer.
|
|
9
|
+
- `lib/` — file-icon-maps, use-mermaid-render, utils; helper modules copied with registry components when needed.
|
|
10
|
+
- `tokens/` — index.css, theme.css, theme-base.css, scale.css, ontology.json, scrollbar utility, theme presets, and scale token packs.
|
|
11
|
+
- `meta.json` — generated component dependency/file manifest; validate with `npm run check:registry-meta`.
|
|
12
|
+
- `agent-manifest.json` — hand-authored component intent, constraints, and recipes for design/coding agents; validate with `npm run check:agent-manifest`.
|
|
13
|
+
- `__tests__/` — registry-level component tests for basic and chat components.
|
|
14
|
+
|
|
15
|
+
## Submodules
|
|
16
|
+
|
|
17
|
+
- `basic/`, `chat/` — component source files consumed by the library and CLI
|
|
18
|
+
- `lib/` — shared helpers bundled with registry copies
|
|
19
|
+
- `tokens/` — CSS token packs and token ontology synced to `cli/registry`
|
|
20
|
+
- `__tests__/` — component tests
|
|
21
|
+
- `agent-manifest.json` — machine-readable AI consumption protocol
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
**Covenant:** update this file whenever you add/remove registry files or change global publishing behavior.
|
|
@@ -21,9 +21,9 @@ describe('ThinkingIndicator', () => {
|
|
|
21
21
|
// 文案测试
|
|
22
22
|
// ============================================================
|
|
23
23
|
describe('text 文案', () => {
|
|
24
|
-
it('应显示默认文案 "
|
|
24
|
+
it('应显示默认文案 "Spark is Thinking..."', () => {
|
|
25
25
|
render(<ThinkingIndicator />)
|
|
26
|
-
expect(screen.getByText('
|
|
26
|
+
expect(screen.getByText('Spark is Thinking...')).toBeInTheDocument()
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
it('应显示自定义文案', () => {
|