canvas-ui-sdk 0.3.12 → 0.3.14
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 +58 -71
- package/dist/index.js +248 -331
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/prompts/CLAUDE.md +85 -0
- package/prompts/bake-theme.md +194 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Canvas UI SDK
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A themeable React component library with a shadcn-style CLI for copying components into consumer projects, a visual theme editor, and an MCP server for Claude Code.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -8,57 +8,34 @@ A comprehensive UI component library with design tokens for building beautiful i
|
|
|
8
8
|
npm install canvas-ui-sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## CLI
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
import { Button, DashboardShell, DataTable } from 'canvas-ui-sdk';
|
|
15
|
-
|
|
16
|
-
export default function MyPage() {
|
|
17
|
-
return (
|
|
18
|
-
<DashboardShell>
|
|
19
|
-
<Button variant="primary">Click me</Button>
|
|
20
|
-
<DataTable data={myData} columns={myColumns} />
|
|
21
|
-
</DashboardShell>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
```
|
|
13
|
+
Components are copied as editable source files into your project. Dependencies are auto-resolved and npm packages auto-installed.
|
|
25
14
|
|
|
26
|
-
|
|
15
|
+
```bash
|
|
16
|
+
# See all 140+ available components
|
|
17
|
+
npx canvas-ui list
|
|
27
18
|
|
|
28
|
-
|
|
19
|
+
# Copy components into your project
|
|
20
|
+
npx canvas-ui add <component-name>
|
|
29
21
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
--canvas-secondary: #64748b;
|
|
35
|
-
--canvas-background: #ffffff;
|
|
36
|
-
--canvas-foreground: #0f172a;
|
|
37
|
-
--canvas-border: #e2e8f0;
|
|
38
|
-
|
|
39
|
-
/* Typography */
|
|
40
|
-
--typo-font-primary: 'Inter', sans-serif;
|
|
41
|
-
--typo-base-size: 16px;
|
|
42
|
-
|
|
43
|
-
/* Spacing */
|
|
44
|
-
--spacing-xs: 4px;
|
|
45
|
-
--spacing-sm: 8px;
|
|
46
|
-
--spacing-md: 16px;
|
|
47
|
-
--spacing-lg: 24px;
|
|
48
|
-
--spacing-xl: 32px;
|
|
49
|
-
|
|
50
|
-
/* Border Radius */
|
|
51
|
-
--radius-sm: 4px;
|
|
52
|
-
--radius-md: 8px;
|
|
53
|
-
--radius-lg: 12px;
|
|
54
|
-
}
|
|
22
|
+
# Examples:
|
|
23
|
+
npx canvas-ui add button # Copies button + utils
|
|
24
|
+
npx canvas-ui add dashboard-shell # Copies shell + sidebar + header + 15 deps
|
|
25
|
+
npx canvas-ui add standard-data-table # Copies table + pagination + deps
|
|
55
26
|
```
|
|
56
27
|
|
|
57
|
-
|
|
28
|
+
Then import from local paths:
|
|
58
29
|
|
|
59
|
-
|
|
30
|
+
```tsx
|
|
31
|
+
import { DashboardShell } from "@/components/layout/dashboard-shell";
|
|
32
|
+
import { StandardDataTable } from "@/components/blocks/data-tables/standard-data-table";
|
|
33
|
+
import { Button } from "@/components/ui/button";
|
|
34
|
+
```
|
|
60
35
|
|
|
61
|
-
|
|
36
|
+
## CSS Setup
|
|
37
|
+
|
|
38
|
+
Add these imports to your `globals.css` (Tailwind v4):
|
|
62
39
|
|
|
63
40
|
```css
|
|
64
41
|
@import "tailwindcss";
|
|
@@ -67,43 +44,53 @@ If you're using Tailwind CSS v4, add these imports to your CSS file:
|
|
|
67
44
|
@source "../../node_modules/canvas-ui-sdk/dist";
|
|
68
45
|
```
|
|
69
46
|
|
|
70
|
-
- `canvas-ui-sdk/tailwind` maps
|
|
47
|
+
- `canvas-ui-sdk/tailwind` maps design tokens to Tailwind's semantic color names (`bg-muted`, `text-primary`, etc.)
|
|
48
|
+
- `canvas-ui-sdk/styles` loads the design system's CSS variables (colors, typography, spacing, etc.)
|
|
71
49
|
- `@source` tells Tailwind to scan the SDK's compiled output for utility classes — adjust the relative path based on your `globals.css` location
|
|
72
50
|
|
|
51
|
+
## CSS Variables
|
|
52
|
+
|
|
53
|
+
Override design tokens in your `globals.css`:
|
|
54
|
+
|
|
55
|
+
```css
|
|
56
|
+
:root {
|
|
57
|
+
--canvas-primary: #16a34a;
|
|
58
|
+
--canvas-primary-dark: #15803d;
|
|
59
|
+
--canvas-primary-foreground: #ffffff;
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
See `styles/tokens.reference.css` for the full list of available CSS variables.
|
|
64
|
+
|
|
65
|
+
## MCP Server (Claude Code)
|
|
66
|
+
|
|
67
|
+
Connect the MCP server so Claude Code can discover all components, templates, and design tokens:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
claude mcp add canvas-ui-sdk node node_modules/canvas-ui-sdk/mcp/dist/index.js
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Live Theme Editor
|
|
74
|
+
|
|
75
|
+
The `<ThemeDrawer>` component provides a visual editor for customizing colors, typography, button sizes, input styles, and branding in real-time. When you're happy with your theme, bake it into source code with `prompts/bake-theme.md`.
|
|
76
|
+
|
|
73
77
|
## Components
|
|
74
78
|
|
|
75
|
-
### UI
|
|
76
|
-
|
|
77
|
-
- Dialog, Popover, Dropdown
|
|
78
|
-
- Avatar, Badge, Card
|
|
79
|
-
- And more...
|
|
79
|
+
### UI Primitives
|
|
80
|
+
Button, Input, Select, Checkbox, Switch, Dialog, Popover, Dropdown, Avatar, Tabs, Tooltip, and more.
|
|
80
81
|
|
|
81
82
|
### Blocks
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
### Layouts
|
|
88
|
-
- DashboardShell
|
|
89
|
-
- IconSidebarShell
|
|
90
|
-
- DoubleSidebarShell
|
|
91
|
-
- StandardPageShell
|
|
92
|
-
- AccountSettingsShell
|
|
93
|
-
- MultistepShell
|
|
94
|
-
- MobileMenuShell
|
|
83
|
+
Data tables, social feeds, charts, metric tiles, chat widgets, forms, calendars, and more.
|
|
84
|
+
|
|
85
|
+
### Layout Shells
|
|
86
|
+
DashboardShell, IconSidebarShell, DoubleSidebarShell, StandardPageShell, AccountSettingsShell, MultistepShell, MobileMenuShell.
|
|
95
87
|
|
|
96
88
|
## Development
|
|
97
89
|
|
|
98
90
|
```bash
|
|
99
|
-
# Install dependencies
|
|
100
|
-
npm
|
|
101
|
-
|
|
102
|
-
# Build the package
|
|
103
|
-
npm run build
|
|
104
|
-
|
|
105
|
-
# Watch mode for development
|
|
106
|
-
npm run dev
|
|
91
|
+
npm install # Install dependencies
|
|
92
|
+
npm run build # Build dist + registry + CLI
|
|
93
|
+
npm run dev # Watch mode
|
|
107
94
|
```
|
|
108
95
|
|
|
109
96
|
## License
|