sparkdesign 0.4.8 → 0.4.9

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.
Files changed (44) hide show
  1. package/cli/registry/AGENTS.md +1 -1
  2. package/cli/registry/agent-manifest.json +3996 -67
  3. package/cli/registry/basic/accordion.tsx +79 -0
  4. package/cli/registry/basic/badge.tsx +49 -0
  5. package/cli/registry/basic/button.tsx +19 -14
  6. package/cli/registry/basic/collapsible-card.tsx +10 -1
  7. package/cli/registry/basic/ellipsis-text.tsx +151 -0
  8. package/cli/registry/basic/form.tsx +186 -0
  9. package/cli/registry/basic/icon-button.tsx +12 -4
  10. package/cli/registry/basic/sidebar.tsx +665 -0
  11. package/cli/registry/basic/sonner.tsx +10 -10
  12. package/cli/registry/chat/chat-input/compound.tsx +1 -0
  13. package/cli/registry/chat/user-question/compound.tsx +2 -0
  14. package/cli/registry/meta.json +153 -0
  15. package/dist/registry/basic/accordion.d.ts +15 -0
  16. package/dist/registry/basic/badge.d.ts +23 -0
  17. package/dist/registry/basic/ellipsis-text.d.ts +45 -0
  18. package/dist/registry/basic/form.d.ts +23 -0
  19. package/dist/registry/basic/icon-button.d.ts +15 -2
  20. package/dist/registry/basic/item.d.ts +1 -1
  21. package/dist/registry/basic/sidebar.d.ts +72 -0
  22. package/dist/registry/basic/tag.d.ts +1 -1
  23. package/dist/spark-design.cjs.js +24 -27
  24. package/dist/spark-design.es.js +5353 -4470
  25. package/dist/sparkdesign.css +1 -1
  26. package/dist/src/components/basic/Accordion/index.d.ts +13 -0
  27. package/dist/src/components/basic/Badge/index.d.ts +13 -0
  28. package/dist/src/components/basic/EllipsisText/index.d.ts +4 -36
  29. package/dist/src/components/basic/Form/index.d.ts +12 -0
  30. package/dist/src/components/basic/Sidebar/index.d.ts +13 -0
  31. package/dist/src/components/index.d.ts +6 -2
  32. package/docs/agent/component-selection.md +106 -4
  33. package/package.json +8 -3
  34. package/registry/agent-manifest.json +3996 -67
  35. package/cli/registry/chat/user-question/UserQuestionCard.tsx +0 -198
  36. package/cli/registry/chat/user-question/UserQuestionFooter.tsx +0 -66
  37. package/cli/registry/chat/user-question/UserQuestionHeader.tsx +0 -64
  38. package/cli/registry/chat/user-question/useUserQuestionState.ts +0 -165
  39. package/dist/registry/chat/user-question/UserQuestionCard.d.ts +0 -36
  40. package/dist/registry/chat/user-question/UserQuestionFooter.d.ts +0 -24
  41. package/dist/registry/chat/user-question/UserQuestionHeader.d.ts +0 -26
  42. package/dist/registry/chat/user-question/useUserQuestionState.d.ts +0 -26
  43. package/dist/src/components/basic/CollapsibleSection/index.d.ts +0 -43
  44. package/dist/src/components/chat/Response/StreamingMarkdownBlock.d.ts +0 -12
@@ -0,0 +1,13 @@
1
+ /**
2
+ * [WHO]: Accordion and sub-parts re-export from registry.
3
+ * [FROM]: registry/basic/accordion.
4
+ * [TO]: sparkdesign package consumers; src/components barrel.
5
+ * [HERE]: src/components/basic/Accordion/index.tsx — published Accordion wrapper.
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
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent, } from '../../../../registry/basic/accordion';
13
+ export type { AccordionProps, AccordionItemProps, AccordionTriggerProps, AccordionContentProps, } from '../../../../registry/basic/accordion';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * [WHO]: Badge re-export from registry.
3
+ * [FROM]: registry/basic/badge.
4
+ * [TO]: sparkdesign package consumers; src/components barrel.
5
+ * [HERE]: src/components/basic/Badge/index.tsx — published Badge wrapper.
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
+ export { Badge, badgeVariants } from '../../../../registry/basic/badge';
13
+ export type { BadgeProps } from '../../../../registry/basic/badge';
@@ -1,45 +1,13 @@
1
1
  /**
2
2
  * [WHO]: Public exports from this file (see implementation below).
3
- * [FROM]: See the import block immediately after this header.
3
+ * [FROM]: registry/basic/ellipsis-text.
4
4
  * [TO]: sparkdesign package consumers; output of CLI `add` when applicable.
5
- * [HERE]: src/components/basic/EllipsisText/index.tsx — Spark Design source; keep aligned with the main library.
5
+ * [HERE]: src/components/basic/EllipsisText/index.tsx — packaged wrapper for EllipsisText.
6
6
  *
7
7
  * [PROTOCOL]:
8
8
  * 1. Keep this P3 header in sync when the public contract changes.
9
9
  * 2. Update module AGENTS.md (P2) and root AGENTS.md (P1) when boundaries change.
10
10
  * 3. Follow design tokens and explicit type exports.
11
11
  */
12
- import { type ReactNode, type CSSProperties } from 'react';
13
- export interface EllipsisTextProps {
14
- /** 要显示的文本内容 */
15
- children: ReactNode;
16
- /**
17
- * 最大显示行数,超出会显示省略号
18
- * @default 1
19
- */
20
- lines?: number;
21
- /** 容器额外类名 */
22
- className?: string;
23
- /**
24
- * Tooltip 弹出方向
25
- * @default 'top'
26
- */
27
- placement?: 'top' | 'bottom' | 'left' | 'right';
28
- /** Tooltip 内容额外类名 */
29
- tooltipClassName?: string;
30
- /** 自定义 tooltip 内容,默认使用 children */
31
- tooltipContent?: ReactNode;
32
- /**
33
- * 是否禁用 tooltip
34
- * @default false
35
- */
36
- disabled?: boolean;
37
- /** 容器行内样式 */
38
- style?: CSSProperties;
39
- /**
40
- * 文本元素的标签类型
41
- * @default 'span'
42
- */
43
- as?: 'span' | 'div' | 'p';
44
- }
45
- export declare const EllipsisText: import("react").ForwardRefExoticComponent<EllipsisTextProps & import("react").RefAttributes<HTMLElement>>;
12
+ export { EllipsisText } from '../../../../registry/basic/ellipsis-text';
13
+ export type { EllipsisTextProps } from '../../../../registry/basic/ellipsis-text';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * [WHO]: Form helpers re-export from registry.
3
+ * [FROM]: registry/basic/form.
4
+ * [TO]: sparkdesign package consumers; src/components barrel.
5
+ * [HERE]: src/components/basic/Form/index.tsx — published React Hook Form helper wrapper.
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
+ export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, } from '../../../../registry/basic/form';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * [WHO]: Sidebar primitives re-export from registry.
3
+ * [FROM]: registry/basic/sidebar.
4
+ * [TO]: sparkdesign package consumers; src/components barrel.
5
+ * [HERE]: src/components/basic/Sidebar/index.tsx — published Sidebar wrapper.
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
+ export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, sidebarMenuButtonVariants, useSidebar, } from '../../../../registry/basic/sidebar';
13
+ export { SidebarMenu as SidebarNavMenu, SidebarMenuItem as SidebarNavMenuItem, } from '../../../../registry/basic/sidebar';
@@ -13,6 +13,8 @@ export { Button } from './basic/Button';
13
13
  export type { ButtonProps } from './basic/Button';
14
14
  export { ButtonGroup, ButtonGroupText, ButtonGroupSeparator, buttonGroupVariants, } from './basic/ButtonGroup';
15
15
  export type { ButtonGroupProps, ButtonGroupTextProps, ButtonGroupSeparatorProps, } from './basic/ButtonGroup';
16
+ export { Badge, badgeVariants } from './basic/Badge';
17
+ export type { BadgeProps } from './basic/Badge';
16
18
  export { IconButton } from './basic/IconButton';
17
19
  export type { IconButtonProps } from './basic/IconButton';
18
20
  export { Tooltip } from './basic/Tooltip';
@@ -33,8 +35,6 @@ export { Toggle, ToggleGroup, ToggleGroupItem } from './basic/Toggle';
33
35
  export type { ToggleProps, ToggleGroupProps, ToggleGroupItemProps } from './basic/Toggle';
34
36
  export { RadioGroup, RadioGroupItem } from './basic/RadioGroup';
35
37
  export type { RadioGroupProps, RadioGroupItemProps } from './basic/RadioGroup';
36
- export { CollapsibleSection } from './basic/CollapsibleSection';
37
- export type { CollapsibleSectionProps } from './basic/CollapsibleSection';
38
38
  export { Collapsible, CollapsibleTrigger, CollapsibleContent } from './basic/Collapsible';
39
39
  export { ResizablePanelGroup, ResizablePanel, ResizableHandle, } from './basic/Resizable';
40
40
  export type { ResizablePanelGroupProps, ResizablePanelProps, ResizableHandleProps, } from './basic/Resizable';
@@ -56,6 +56,8 @@ export { Select, SelectTrigger, SelectValue, SelectContent, SelectLabel, SelectS
56
56
  export type { SelectProps, SelectTriggerProps, SelectValueProps, SelectContentProps, SelectLabelProps, SelectSeparatorProps, SelectGroupProps, SelectItemProps, } from './basic/Select';
57
57
  export { Tabs, TabsList, TabsTrigger, TabsContent, } from './basic/Tabs';
58
58
  export type { TabsProps, TabsListProps, TabsTriggerProps, TabsContentProps, } from './basic/Tabs';
59
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent, } from './basic/Accordion';
60
+ export type { AccordionProps, AccordionItemProps, AccordionTriggerProps, AccordionContentProps, } from './basic/Accordion';
59
61
  export { Collapse, CollapseItem, CollapseTrigger, CollapseContent, } from './basic/Collapse';
60
62
  export type { CollapseProps, CollapseItemProps, CollapseTriggerProps, CollapseContentProps, } from './basic/Collapse';
61
63
  export { TypographyH1, TypographyH2, TypographyH3, TypographyH4, TypographyP, TypographyBlockquote, TypographyTable, TypographyList, TypographyInlineCode, TypographyLead, TypographyLarge, TypographySmall, TypographyMuted, } from './basic/Typography';
@@ -72,6 +74,7 @@ export { CollapsibleCard } from './basic/CollapsibleCard';
72
74
  export type { CollapsibleCardProps } from './basic/CollapsibleCard';
73
75
  export { SidebarMenu } from './basic/SidebarMenu';
74
76
  export type { SidebarMenuProps, SidebarMenuItem, SidebarMenuItemAction } from './basic/SidebarMenu';
77
+ export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SidebarNavMenu, SidebarNavMenuItem, sidebarMenuButtonVariants, useSidebar, } from './basic/Sidebar';
75
78
  export { Input } from './basic/Input';
76
79
  export type { InputProps } from './basic/Input';
77
80
  export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupTextarea, InputGroupText, } from './basic/InputGroup';
@@ -79,6 +82,7 @@ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator, } from './bas
79
82
  export { Textarea } from './basic/Textarea';
80
83
  export type { TextareaProps } from './basic/Textarea';
81
84
  export { Field, FieldLabel, FieldDescription, FieldError, FieldContent, FieldTitle, FieldSeparator, FieldSet, FieldLegend, FieldGroup, } from './basic/Field';
85
+ export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, } from './basic/Form';
82
86
  export { Label } from './basic/Label';
83
87
  export type { LabelProps } from './basic/Label';
84
88
  export { Checkbox, checkboxVariants } from './basic/Checkbox';
@@ -9,6 +9,8 @@ details are needed.
9
9
  - `sparkdesign/agent-manifest.json` — package export for agent-facing component semantics.
10
10
  - `registry/agent-manifest.json` — source of truth in this repository.
11
11
  - `npm run check:agent-manifest` — validates required semantic fields and recipe references.
12
+ - `npm run report:agent-coverage` — reports manifest coverage against `registry/meta.json`.
13
+ - `npm run check:agent-coverage` — fails if manifest coverage drops below 100%.
12
14
 
13
15
  ## Decision Order
14
16
 
@@ -18,28 +20,126 @@ details are needed.
18
20
  4. Use `cliAdd` when the target app should own copied component source.
19
21
  5. Use `packageImport` only when the app already consumes `sparkdesign` as a package.
20
22
 
23
+ ## Common Name Boundaries
24
+
25
+ - `sidebar` is the full app-shell primitive set: provider state, trigger, responsive collapse, mobile sheet, and inset content. Package imports expose its menu list as `SidebarNavMenu` / `SidebarNavMenuItem`.
26
+ - `sidebar-menu` is the lightweight data-driven list component exported as `SidebarMenu`; use it when a full app shell would be overkill.
27
+ - `form` is for React Hook Form validation wiring; `field` is for layout-only form rows.
28
+ - `toast` and `sonner` share the same runtime toaster API. Prefer `toast` for Spark semantic naming and `sonner` only when matching that install target.
29
+
21
30
  ## Current High-Confidence Coverage
22
31
 
23
- The first manifest version covers the components most likely to be selected by
24
- design/coding agents:
32
+ The manifest covers the components most likely to be selected by design/coding
33
+ agents. Use `npm run report:agent-coverage` for the current full coverage
34
+ snapshot.
25
35
 
26
36
  - `button`
27
37
  - `alert`
38
+ - `alert-dialog`
39
+ - `accordion`
40
+ - `aspect-ratio`
41
+ - `avatar`
42
+ - `badge`
43
+ - `breadcrumb`
44
+ - `button-group`
45
+ - `calendar`
28
46
  - `card`
47
+ - `carousel`
48
+ - `chart`
49
+ - `checkbox`
50
+ - `collapse`
51
+ - `collapsible`
52
+ - `collapsible-card`
53
+ - `combobox`
54
+ - `command`
55
+ - `context-menu`
56
+ - `data-table`
57
+ - `date-picker`
29
58
  - `dialog`
59
+ - `direction`
60
+ - `dropdown-menu`
30
61
  - `drawer`
31
- - `file-review-part`
62
+ - `ellipsis-text`
63
+ - `empty`
64
+ - `field`
65
+ - `form`
66
+ - `hover-card`
67
+ - `icon-button`
68
+ - `input`
69
+ - `input-group`
70
+ - `input-otp`
71
+ - `item`
72
+ - `kbd`
73
+ - `label`
74
+ - `menubar`
75
+ - `native-select`
76
+ - `navigation-menu`
77
+ - `option-list`
78
+ - `pagination`
79
+ - `popover`
80
+ - `progress`
81
+ - `radio-group`
82
+ - `resizable`
83
+ - `scroll-area`
84
+ - `scrollbar`
85
+ - `select`
86
+ - `separator`
87
+ - `sheet`
88
+ - `sidebar`
89
+ - `sidebar-menu`
90
+ - `shimmering-text`
91
+ - `slider`
92
+ - `skeleton`
93
+ - `spinner`
94
+ - `sonner`
95
+ - `switch`
96
+ - `table`
97
+ - `tag`
98
+ - `tabs`
99
+ - `textarea`
100
+ - `toast`
101
+ - `tooltip`
102
+ - `toggle`
103
+ - `toggle-group`
104
+ - `typography`
105
+ - `ask-user-part`
106
+ - `browser-action-part`
32
107
  - `chat-input`
33
- - `response`
108
+ - `code-block-part`
109
+ - `conversation-anchor-nav`
110
+ - `file-attachment`
111
+ - `file-card`
112
+ - `file-review-part`
113
+ - `folder-button`
114
+ - `generation-status-bar`
115
+ - `generated-images-grid`
116
+ - `hint-banner`
117
+ - `image-attachment`
118
+ - `image-generating`
34
119
  - `markdown`
120
+ - `mermaid-part`
35
121
  - `permission-card`
122
+ - `plan-part`
123
+ - `queue-indicator`
124
+ - `reasoning-step`
125
+ - `related-prompts`
126
+ - `response`
127
+ - `send-button`
128
+ - `streaming-markdown-block`
129
+ - `task-part`
130
+ - `terminal-code-block-part`
131
+ - `thinking-indicator`
36
132
  - `tool-invocation-card`
133
+ - `user-message`
134
+ - `user-question-answer`
135
+ - `user-question-part`
37
136
 
38
137
  ## Recipe Usage
39
138
 
40
139
  Recipes are intended to prevent agents from flattening rich AI interfaces into
41
140
  generic cards and Markdown.
42
141
 
142
+ - `structured-form` — deterministic forms/settings with labels, controls, validation, and actions.
43
143
  - `assistant-composer` — prompt entry, attachments, send, and permissions.
44
144
  - `assistant-response-stream` — generated answer, tools, Markdown, and errors.
45
145
  - `focused-task-modal` — compact blocking task or confirmation flow.
@@ -58,3 +158,5 @@ When adding a component to the manifest:
58
158
  4. Ensure `cliAdd` installs the same component id as the manifest key.
59
159
  5. Add or update recipes if the component changes how agents should compose screens.
60
160
  6. Run `npm run check:agent-manifest`.
161
+ 7. Run `npm run check:agent-coverage` so new registry components cannot ship without agent semantics.
162
+ 8. Run `npm run report:agent-coverage` when planning broader semantic coverage or reviewing drift.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sparkdesign",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "type": "module",
5
5
  "description": "Modern React Design System with dual-dimension theme system",
6
6
  "keywords": [
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "homepage": "https://spark.design",
19
19
  "bin": {
20
- "sparkdesign": "./cli/dist/index.js"
20
+ "sparkdesign": "cli/dist/index.js"
21
21
  },
22
22
  "exports": {
23
23
  ".": {
@@ -60,6 +60,8 @@
60
60
  "check:token-antipatterns": "node scripts/check-token-antipatterns.mjs",
61
61
  "check:registry": "node scripts/check-registry-sync.mjs",
62
62
  "check:showcase": "node scripts/check-showcase-sync.mjs",
63
+ "report:agent-coverage": "node scripts/report-agent-manifest-coverage.mjs",
64
+ "check:agent-coverage": "node scripts/report-agent-manifest-coverage.mjs --fail-under=100",
63
65
  "gen:demo": "node scripts/gen-demo.mjs",
64
66
  "build": "vite build && npx @tailwindcss/cli -i src/lib.css -o dist/sparkdesign.css --minify && tsc -p tsconfig.lib.json && npm run build:cli",
65
67
  "build:cli": "cd cli && npm run build",
@@ -79,7 +81,7 @@
79
81
  "test:smoke:vite": "node scripts/smoke-test-cli.mjs vite",
80
82
  "test:smoke:next": "node scripts/smoke-test-cli.mjs nextjs",
81
83
  "test:smoke:add": "node scripts/smoke-test-cli.mjs pure-add",
82
- "prepublishOnly": "node scripts/generate-registry-meta.mjs && npm run check:agent-manifest && npm run check:token-ontology && npm run check:token-antipatterns && npm run build && node scripts/sync-registry-to-cli.mjs && npm run check:registry-meta"
84
+ "prepublishOnly": "node scripts/generate-registry-meta.mjs && npm run check:agent-manifest && npm run check:agent-coverage && npm run check:token-ontology && npm run check:token-antipatterns && npm run build && node scripts/sync-registry-to-cli.mjs && npm run check:registry-meta"
83
85
  },
84
86
  "peerDependencies": {
85
87
  "react": ">=18.0.0",
@@ -106,6 +108,7 @@
106
108
  "@radix-ui/react-select": "^2.2.6",
107
109
  "@radix-ui/react-separator": "^1.1.8",
108
110
  "@radix-ui/react-slider": "^1.3.6",
111
+ "@radix-ui/react-slot": "^1.2.4",
109
112
  "@radix-ui/react-switch": "^1.2.6",
110
113
  "@radix-ui/react-tabs": "^1.1.2",
111
114
  "@radix-ui/react-toggle": "^1.1.10",
@@ -132,6 +135,7 @@
132
135
  "prompts": "^2.4.2",
133
136
  "radix-ui": "^1.4.3",
134
137
  "react-day-picker": "^9.14.0",
138
+ "react-hook-form": "^7.76.0",
135
139
  "react-i18next": "^16.5.4",
136
140
  "react-markdown": "^10.1.0",
137
141
  "react-resizable-panels": "^4.6.2",
@@ -163,6 +167,7 @@
163
167
  "eslint-plugin-react-hooks": "^7.0.1",
164
168
  "eslint-plugin-react-refresh": "^0.4.24",
165
169
  "globals": "^16.5.0",
170
+ "jsdom": "^29.1.1",
166
171
  "size-limit": "^12.0.0",
167
172
  "typescript": "~5.9.3",
168
173
  "typescript-eslint": "^8.48.0",