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.
@@ -1,4 +1,4 @@
1
1
  import type { ToolInvocationCardProps as RegistryToolInvocationCardProps, ToolInvocationStatus } from '../../../../registry/chat/tool-invocation-card';
2
2
  export type { ToolInvocationStatus };
3
- export type ToolInvocationCardProps = Omit<RegistryToolInvocationCardProps, 'timeIcon' | 'checkboxCircleIcon' | 'closeCircleIcon' | 'arrowRightIcon' | 'runningText' | 'ranText' | 'failedText' | 'responseLabel'>;
3
+ export type ToolInvocationCardProps = Omit<RegistryToolInvocationCardProps, 'timeIcon' | 'checkboxCircleIcon' | 'closeCircleIcon' | 'arrowDownIcon' | 'runningText' | 'ranText' | 'failedText' | 'responseLabel'>;
4
4
  export declare const ToolInvocationCard: import("react").NamedExoticComponent<ToolInvocationCardProps>;
@@ -133,6 +133,6 @@ export type { AskUserPartProps } from './chat/AskUserPart';
133
133
  export { IconsProvider, useIcons, useIcon } from '../icons/context';
134
134
  export type { IconKey, IconComponent, IconProps } from '../icons/types';
135
135
  export type { IconsContextValue } from '../icons/context';
136
- export { ThemeStyleProvider, useThemeStyle, type ThemeStyleValue, } from '../lib/ThemeStyleContext';
136
+ export { ThemeStyleProvider, useThemeStyle, type Appearance, type ThemePreset, type CustomTheme, type Theme, type StylePreset, type CustomStyle, type Style, type ThemeStyleContextValue, type ThemeStyleProviderProps, type ThemeStyleValue, } from '../lib/ThemeStyleContext';
137
137
  export { MOTION_DURATION, MOTION_EASE, MOTION_SPRING } from '../lib/motion';
138
138
  export { FILE_TYPE_MAP, SETI_CHAR_MAP, SETI_COLOR_MAP, TYPE_TO_TOKEN_CLASS, getSetiIconType, getSetiIcon, getSetiIconColor, getFileIconColorClass, } from '../lib';
@@ -5,17 +5,130 @@
5
5
  *
6
6
  * [PROTOCOL]:
7
7
  * 1. 用于 DropdownMenu、Tooltip 等挂到 body 的浮层,使其与当前页面的 data-style/data-theme 一致
8
- * 2. 应用层在根节点用 ThemeStyleProvider 包裹并传入 style/theme,浮层内组件通过 useThemeStyle 读取并包一层 div
8
+ * 2. 应用层在根节点用 ThemeStyleProvider 包裹并传入 appearance/theme/style
9
+ * 3. 三维度独立设计:appearance(亮暗) × theme(颜色) × style(尺度)
10
+ * 4. 支持预设字符串或自定义对象
9
11
  */
10
12
  import { type ReactNode } from 'react';
13
+ /** 亮暗色 */
14
+ export type Appearance = 'light' | 'dark';
15
+ /** 颜色主题预设 */
16
+ export type ThemePreset = 'qoder' | 'parchment';
17
+ /** 自定义颜色主题 */
18
+ export interface CustomTheme {
19
+ name: string;
20
+ /** 任意 token 覆盖,键为 CSS 变量名(不含 --) */
21
+ tokens: {
22
+ 'color-primary'?: string;
23
+ 'color-primary-hover'?: string;
24
+ 'color-primary-active'?: string;
25
+ 'color-primary-bg'?: string;
26
+ 'color-primary-bg-hover'?: string;
27
+ 'color-primary-border'?: string;
28
+ 'color-primary-border-hover'?: string;
29
+ 'color-text-on-primary'?: string;
30
+ 'color-text'?: string;
31
+ 'color-text-secondary'?: string;
32
+ 'color-text-tertiary'?: string;
33
+ 'color-text-quaternary'?: string;
34
+ 'color-text-base'?: string;
35
+ 'color-border'?: string;
36
+ 'color-border-secondary'?: string;
37
+ 'color-border-tertiary'?: string;
38
+ 'color-fill'?: string;
39
+ 'color-fill-secondary'?: string;
40
+ 'color-fill-tertiary'?: string;
41
+ 'color-fill-quaternary'?: string;
42
+ 'color-fill-disable'?: string;
43
+ 'color-bg-container'?: string;
44
+ 'color-bg-elevated'?: string;
45
+ 'color-bg-layout'?: string;
46
+ 'color-bg-spotlight'?: string;
47
+ 'color-bg-mask'?: string;
48
+ 'color-bg-base'?: string;
49
+ 'color-bg-highlight'?: string;
50
+ 'color-bg-highlight-hover'?: string;
51
+ 'color-link'?: string;
52
+ 'color-error'?: string;
53
+ 'color-error-hover'?: string;
54
+ 'color-error-bg'?: string;
55
+ 'color-error-border'?: string;
56
+ 'color-info'?: string;
57
+ 'color-info-hover'?: string;
58
+ 'color-info-bg'?: string;
59
+ 'color-info-border'?: string;
60
+ 'color-success'?: string;
61
+ 'color-success-hover'?: string;
62
+ 'color-success-bg'?: string;
63
+ 'color-success-border'?: string;
64
+ 'color-warning'?: string;
65
+ 'color-warning-hover'?: string;
66
+ 'color-warning-bg'?: string;
67
+ 'color-warning-border'?: string;
68
+ [key: string]: string | undefined;
69
+ };
70
+ }
71
+ /** 颜色主题:预设或自定义 */
72
+ export type Theme = ThemePreset | CustomTheme;
73
+ /** 布局尺度预设 */
74
+ export type StylePreset = 'neutral' | 'compact' | 'soft' | 'sharp' | 'dense';
75
+ /** 自定义布局尺度 */
76
+ export interface CustomStyle {
77
+ name: string;
78
+ radius?: {
79
+ sm?: string;
80
+ default?: string;
81
+ md?: string;
82
+ lg?: string;
83
+ xl?: string;
84
+ '2xl'?: string;
85
+ '3xl'?: string;
86
+ };
87
+ spacing?: {
88
+ '3'?: string;
89
+ '4'?: string;
90
+ '9'?: string;
91
+ '11'?: string;
92
+ };
93
+ fontSize?: {
94
+ sm?: string;
95
+ lg?: string;
96
+ xl?: string;
97
+ '2xl'?: string;
98
+ '3xl'?: string;
99
+ };
100
+ }
101
+ /** 布局尺度:预设或自定义 */
102
+ export type Style = StylePreset | CustomStyle;
103
+ export interface ThemeStyleContextValue {
104
+ /** 亮暗色 */
105
+ appearance: Appearance;
106
+ /** 颜色主题(原始值) */
107
+ themeConfig: Theme;
108
+ /** 布局尺度(原始值) */
109
+ styleConfig: Style;
110
+ /** 计算后的 data-theme 属性值 */
111
+ dataTheme: string;
112
+ /** 计算后的 data-style 属性值 */
113
+ dataStyle: string;
114
+ /** @deprecated 兼容旧 API,等于 dataTheme */
115
+ theme?: string;
116
+ /** @deprecated 兼容旧 API,等于 dataStyle */
117
+ style?: string;
118
+ }
119
+ export interface ThemeStyleProviderProps {
120
+ children: ReactNode;
121
+ /** 亮暗色,默认 'light' */
122
+ appearance?: Appearance;
123
+ /** 颜色主题,默认 'qoder' */
124
+ theme?: Theme;
125
+ /** 布局尺度,默认 'neutral' */
126
+ style?: Style;
127
+ }
128
+ export declare function ThemeStyleProvider({ children, appearance, theme, style, }: ThemeStyleProviderProps): import("react/jsx-runtime").JSX.Element;
129
+ export declare function useThemeStyle(): ThemeStyleContextValue;
130
+ /** @deprecated 使用新的 ThemeStyleProvider props 代替 */
11
131
  export interface ThemeStyleValue {
12
- /** 布局风格:neutral | compact | soft | sharp | dense,对应 scale.css */
13
132
  style?: string;
14
- /** 颜色主题:light | dark | custom,对应 theme.css */
15
133
  theme?: string;
16
134
  }
17
- export declare function ThemeStyleProvider({ children, value, }: {
18
- children: ReactNode;
19
- value: ThemeStyleValue;
20
- }): import("react/jsx-runtime").JSX.Element;
21
- export declare function useThemeStyle(): ThemeStyleValue;
@@ -6,5 +6,5 @@
6
6
  export { getFileIconByFilename } from './file-icon';
7
7
  export { FILE_TYPE_MAP, SETI_CHAR_MAP, SETI_COLOR_MAP, TYPE_TO_TOKEN_CLASS, getSetiIconType, getSetiIcon, getSetiIconColor, getFileIconColorClass, } from '../../registry/lib/file-icon-maps';
8
8
  export { default as i18n } from './i18n';
9
- export { ThemeStyleProvider, useThemeStyle, type ThemeStyleValue, } from './ThemeStyleContext';
9
+ export { ThemeStyleProvider, useThemeStyle, type Appearance, type ThemePreset, type CustomTheme, type Theme, type StylePreset, type CustomStyle, type Style, type ThemeStyleContextValue, type ThemeStyleProviderProps, type ThemeStyleValue, } from './ThemeStyleContext';
10
10
  export { MOTION_DURATION, MOTION_EASE, MOTION_SPRING } from './motion';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sparkdesign",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "type": "module",
5
5
  "description": "Modern React Design System with dual-dimension theme system",
6
6
  "keywords": [
@@ -45,6 +45,8 @@
45
45
  ],
46
46
  "scripts": {
47
47
  "dev": "vite",
48
+ "gen:registry-meta": "node scripts/generate-registry-meta.mjs",
49
+ "check:registry-meta": "node scripts/generate-registry-meta.mjs --check && node scripts/validate-registry-meta.mjs registry && node scripts/validate-registry-meta.mjs cli",
48
50
  "check:registry": "node scripts/check-registry-sync.mjs",
49
51
  "check:showcase": "node scripts/check-showcase-sync.mjs",
50
52
  "gen:demo": "node scripts/gen-demo.mjs",
@@ -62,7 +64,7 @@
62
64
  "test:e2e:ui": "playwright test --ui",
63
65
  "size": "size-limit",
64
66
  "size:why": "size-limit --why",
65
- "prepublishOnly": "npm run build && node scripts/sync-registry-to-cli.mjs"
67
+ "prepublishOnly": "node scripts/generate-registry-meta.mjs && npm run build && node scripts/sync-registry-to-cli.mjs && npm run check:registry-meta"
66
68
  },
67
69
  "peerDependencies": {
68
70
  "react": ">=18.0.0",