sparkdesign 0.4.2 → 0.4.4

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  现代化 React 设计系统,支持双维度主题(颜色 theme + 布局 scale),5 种内置布局风格,提供 Basic 基础组件与 Chat 对话流组件,可扩展颜色主题。
4
4
 
5
- **当前版本**:`0.3.1`([变更说明](docs/NPM发布指南.md))
5
+ **当前版本**:`0.4.4`([变更说明](docs/NPM发布指南.md))
6
6
 
7
7
  > 🌟 **纯新手?** 查看 [快速上手指南-新手版](docs/快速上手指南-新手版.md),一步步带你跑起来!
8
8
 
@@ -24,6 +24,8 @@
24
24
  | **npm 安装** | 直接引用、不改源码 | `npm install sparkdesign` |
25
25
  | **CLI 按需引入** | 复制源码到项目、可自由修改 | `npx sparkdesign init` → `npx sparkdesign add button` |
26
26
 
27
+ **发布模型**:`sparkdesign` 是唯一发布到 npm 的包。CLI 不是第二个独立 npm 包,而是根包中的 `bin` 入口;因此用户侧既可以 `npm install sparkdesign`,也可以直接 `npx sparkdesign@latest add button`。
28
+
27
29
  ---
28
30
 
29
31
  ## 安装(npm 包)
@@ -34,7 +36,7 @@ npm install sparkdesign
34
36
 
35
37
  **依赖**:需自行安装 `react`、`react-dom`(>=18)。
36
38
 
37
- ### 按需引入(CLI
39
+ ### 按需引入(CLI,推荐)
38
40
 
39
41
  若希望**将组件源码复制到项目中**并自由修改,可使用 CLI:
40
42
 
@@ -8,6 +8,7 @@
8
8
  import path from 'node:path';
9
9
  import fs from 'fs-extra';
10
10
  import chalk from 'chalk';
11
+ import { execa } from 'execa';
11
12
  import { readConfig, writeConfig, getComponentsBaseAlias, resolveTargetDir } from '../utils/config.js';
12
13
  import { getRegistryRoot, getComponentMeta, getComponentSource } from '../utils/registry.js';
13
14
  import { stripL3Header, transformImports } from '../utils/transform.js';
@@ -78,7 +79,15 @@ export async function add(components, options = {}) {
78
79
  }
79
80
  if (allDeps.size > 0) {
80
81
  console.log('');
81
- console.log(chalk.cyan('Dependencies (install if needed):'));
82
- console.log(' npm install', Array.from(allDeps).join(' '));
82
+ console.log(chalk.cyan('Installing dependencies...'));
83
+ const depsArray = Array.from(allDeps);
84
+ try {
85
+ await execa('npm', ['install', ...depsArray], { cwd, stdio: 'inherit' });
86
+ console.log(chalk.green('✓'), 'Installed', depsArray.length, 'dependencies');
87
+ }
88
+ catch {
89
+ console.log(chalk.yellow('○'), 'Auto-install failed. Run manually:');
90
+ console.log(' npm install', depsArray.join(' '));
91
+ }
83
92
  }
84
93
  }
@@ -134,7 +134,7 @@ export function MarkdownBody({ children, className }: MarkdownBodyProps) {
134
134
  <div className={cn('markdown-body text-sm leading-sm text-text', className)}>
135
135
  <ReactMarkdown
136
136
  remarkPlugins={[remarkGfm, remarkMath]}
137
- rehypePlugins={[rehypeKatex]}
137
+ rehypePlugins={[rehypeKatex as any]}
138
138
  components={markdownComponents}
139
139
  >
140
140
  {children}
@@ -1,7 +1,7 @@
1
1
  import { memo, useState } from 'react'
2
2
  import { cn } from '@/lib/utils'
3
3
  import type { ReactNode } from 'react'
4
- import { TimeLine, CheckboxCircleLine, CloseCircleLine, ArrowRightLine } from '../basic/icons-inline'
4
+ import { TimeLine, CheckboxCircleLine, CloseCircleLine, ArrowDownSLine } from '../basic/icons-inline'
5
5
  import { Scrollbar } from '../basic/scrollbar'
6
6
 
7
7
  export type ToolInvocationStatus = 'running' | 'success' | 'error'
@@ -17,7 +17,7 @@ export interface ToolInvocationCardProps {
17
17
  timeIcon?: ReactNode
18
18
  checkboxCircleIcon?: ReactNode
19
19
  closeCircleIcon?: ReactNode
20
- arrowRightIcon?: ReactNode
20
+ arrowDownIcon?: ReactNode
21
21
  runningText?: string
22
22
  ranText?: string
23
23
  failedText?: string
@@ -42,7 +42,7 @@ export const ToolInvocationCard = memo(function ToolInvocationCard({
42
42
  timeIcon,
43
43
  checkboxCircleIcon,
44
44
  closeCircleIcon,
45
- arrowRightIcon,
45
+ arrowDownIcon,
46
46
  runningText = 'Running',
47
47
  ranText = 'Ran',
48
48
  failedText = 'Failed',
@@ -62,7 +62,7 @@ export const ToolInvocationCard = memo(function ToolInvocationCard({
62
62
  const defaultTime = timeIcon ?? <TimeLine className={timeClass} />
63
63
  const defaultCheck = checkboxCircleIcon ?? <CheckboxCircleLine className={checkboxClass} />
64
64
  const defaultCloseCircle = closeCircleIcon ?? <CloseCircleLine className={closeCircleClass} />
65
- const defaultArrow = arrowRightIcon ?? <ArrowRightLine className={arrowClass} />
65
+ const defaultArrow = arrowDownIcon ?? <ArrowDownSLine className={arrowClass} />
66
66
 
67
67
  return (
68
68
  <div className={cn('flex flex-col', className)}>
@@ -96,7 +96,7 @@ export const ToolInvocationCard = memo(function ToolInvocationCard({
96
96
  'shrink-0 inline-flex items-center justify-center',
97
97
  'opacity-0 group-hover:opacity-100',
98
98
  isExpanded && '!opacity-100',
99
- isExpanded ? 'rotate-90' : 'rotate-0'
99
+ isExpanded ? 'rotate-180' : 'rotate-0'
100
100
  )}
101
101
  >
102
102
  {defaultArrow}