@quilltap/theme-storybook 1.0.0
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/CHANGELOG.md +26 -0
- package/README.md +331 -0
- package/dist/chunk-JPWYYYKX.mjs +1202 -0
- package/dist/chunk-WUKYLWAZ.mjs +0 -0
- package/dist/index.css +583 -0
- package/dist/index.d.mts +30 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +1306 -0
- package/dist/index.mjs +96 -0
- package/dist/preset/index.d.mts +40 -0
- package/dist/preset/index.d.ts +40 -0
- package/dist/preset/index.js +52 -0
- package/dist/preset/index.mjs +27 -0
- package/dist/stories/index.d.mts +112 -0
- package/dist/stories/index.d.ts +112 -0
- package/dist/stories/index.js +1241 -0
- package/dist/stories/index.mjs +33 -0
- package/package.json +81 -0
- package/src/css/qt-components.css +580 -0
- package/src/css/quilltap-defaults.css +178 -0
- package/src/stories/components/Avatars.tsx +183 -0
- package/src/stories/components/Badges.tsx +113 -0
- package/src/stories/components/Buttons.tsx +94 -0
- package/src/stories/components/Cards.tsx +97 -0
- package/src/stories/components/Chat.tsx +248 -0
- package/src/stories/components/ColorPalette.tsx +103 -0
- package/src/stories/components/Dialogs.tsx +203 -0
- package/src/stories/components/Inputs.tsx +114 -0
- package/src/stories/components/Spacing.tsx +138 -0
- package/src/stories/components/Tabs.tsx +183 -0
- package/src/stories/components/ThemeComparison.tsx +228 -0
- package/src/stories/components/Typography.tsx +105 -0
- package/src/stories/index.ts +20 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@quilltap/theme-storybook` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.0.0] - 2025-12-31
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Initial release of `@quilltap/theme-storybook`
|
|
9
|
+
- Storybook preset for theme development
|
|
10
|
+
- Default Quilltap theme tokens CSS (`quilltap-defaults.css`)
|
|
11
|
+
- Complete qt-* component classes CSS (`qt-components.css`)
|
|
12
|
+
- ThemeDecorator for applying themes in Storybook
|
|
13
|
+
- Default preview configuration with theme/color mode toggles
|
|
14
|
+
- Comprehensive story components:
|
|
15
|
+
- `ColorPalette` - Theme color token visualization
|
|
16
|
+
- `Typography` - Font families, headings, text styles
|
|
17
|
+
- `Spacing` - Border radius, spacing scale, shadows
|
|
18
|
+
- `Buttons` - All button variants and states
|
|
19
|
+
- `Cards` - Card variants, entity cards, panels
|
|
20
|
+
- `Inputs` - Text inputs, textareas, selects, forms
|
|
21
|
+
- `Badges` - Badge variants including provider badges
|
|
22
|
+
- `Avatars` - Avatar sizes, shapes, status indicators
|
|
23
|
+
- `Dialogs` - Modal/dialog variants with interactions
|
|
24
|
+
- `Tabs` - Tab navigation patterns
|
|
25
|
+
- `Chat` - Chat messages, input, typing indicator
|
|
26
|
+
- `ThemeComparison` - Side-by-side theme comparison
|
package/README.md
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
# @quilltap/theme-storybook
|
|
2
|
+
|
|
3
|
+
A comprehensive Storybook package for developing and testing Quilltap theme plugins. This package provides everything needed to preview themes against Quilltap's default styling without requiring the full Quilltap application.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev @quilltap/theme-storybook @storybook/react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### 1. Add the Preset to Your Storybook Configuration
|
|
14
|
+
|
|
15
|
+
In your `.storybook/main.ts`:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import type { StorybookConfig } from '@storybook/react-vite';
|
|
19
|
+
|
|
20
|
+
const config: StorybookConfig = {
|
|
21
|
+
stories: ['../src/**/*.stories.@(ts|tsx)'],
|
|
22
|
+
addons: [
|
|
23
|
+
'@storybook/addon-essentials',
|
|
24
|
+
'@quilltap/theme-storybook/preset', // Add this line
|
|
25
|
+
],
|
|
26
|
+
framework: {
|
|
27
|
+
name: '@storybook/react-vite',
|
|
28
|
+
options: {},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default config;
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 2. Configure the Preview
|
|
36
|
+
|
|
37
|
+
In your `.storybook/preview.tsx`:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import type { Preview } from '@storybook/react';
|
|
41
|
+
import { defaultPreviewConfig, ThemeDecorator } from '@quilltap/theme-storybook';
|
|
42
|
+
|
|
43
|
+
// Import your theme's CSS
|
|
44
|
+
import '../src/styles.css';
|
|
45
|
+
|
|
46
|
+
const preview: Preview = {
|
|
47
|
+
...defaultPreviewConfig,
|
|
48
|
+
decorators: [ThemeDecorator],
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default preview;
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 3. Import the Default Styles
|
|
55
|
+
|
|
56
|
+
The package provides two CSS files:
|
|
57
|
+
- `quilltap-defaults.css` - Default theme tokens (colors, fonts, spacing)
|
|
58
|
+
- `qt-components.css` - Component class definitions
|
|
59
|
+
|
|
60
|
+
Import them in your preview or let the preset handle it:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import '@quilltap/theme-storybook/css/quilltap-defaults.css';
|
|
64
|
+
import '@quilltap/theme-storybook/css/qt-components.css';
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Using Story Components
|
|
68
|
+
|
|
69
|
+
The package exports reusable story components to showcase your theme:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import {
|
|
73
|
+
ColorPalette,
|
|
74
|
+
Typography,
|
|
75
|
+
Spacing,
|
|
76
|
+
Buttons,
|
|
77
|
+
Cards,
|
|
78
|
+
Inputs,
|
|
79
|
+
Badges,
|
|
80
|
+
Avatars,
|
|
81
|
+
Dialogs,
|
|
82
|
+
Tabs,
|
|
83
|
+
Chat,
|
|
84
|
+
ThemeComparison,
|
|
85
|
+
} from '@quilltap/theme-storybook/stories';
|
|
86
|
+
|
|
87
|
+
// Use in your stories
|
|
88
|
+
export const ColorsStory = () => <ColorPalette />;
|
|
89
|
+
export const ButtonsStory = () => <Buttons />;
|
|
90
|
+
export const ChatStory = () => <Chat />;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Available Components
|
|
94
|
+
|
|
95
|
+
| Component | Description |
|
|
96
|
+
|-----------|-------------|
|
|
97
|
+
| `ColorPalette` | Displays all theme color tokens with swatches |
|
|
98
|
+
| `Typography` | Font families, headings, body text, and text colors |
|
|
99
|
+
| `Spacing` | Border radius, spacing scale, and shadow tokens |
|
|
100
|
+
| `Buttons` | All button variants, sizes, and states |
|
|
101
|
+
| `Cards` | Card variants, entity cards, and panels |
|
|
102
|
+
| `Inputs` | Text inputs, textareas, selects, and form examples |
|
|
103
|
+
| `Badges` | Badge variants including provider badges |
|
|
104
|
+
| `Avatars` | Avatar sizes, shapes, status indicators, and groups |
|
|
105
|
+
| `Dialogs` | Modal/dialog variants with interactive examples |
|
|
106
|
+
| `Tabs` | Tab navigation patterns including pill and vertical tabs |
|
|
107
|
+
| `Chat` | Chat messages, input, typing indicator, and chat list |
|
|
108
|
+
| `ThemeComparison` | Side-by-side comparison view for theme development |
|
|
109
|
+
|
|
110
|
+
## Creating a Theme Plugin
|
|
111
|
+
|
|
112
|
+
### Basic Theme Structure
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
my-quilltap-theme/
|
|
116
|
+
├── package.json
|
|
117
|
+
├── manifest.json
|
|
118
|
+
├── tokens.json
|
|
119
|
+
├── styles.css (optional)
|
|
120
|
+
├── src/
|
|
121
|
+
│ └── index.ts
|
|
122
|
+
└── .storybook/
|
|
123
|
+
├── main.ts
|
|
124
|
+
└── preview.tsx
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### manifest.json
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"id": "my-custom-theme",
|
|
132
|
+
"name": "My Custom Theme",
|
|
133
|
+
"version": "1.0.0",
|
|
134
|
+
"capabilities": ["theme"],
|
|
135
|
+
"theme": {
|
|
136
|
+
"type": "complete",
|
|
137
|
+
"displayName": "My Custom Theme",
|
|
138
|
+
"description": "A beautiful custom theme for Quilltap",
|
|
139
|
+
"tokensFile": "tokens.json"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### tokens.json
|
|
145
|
+
|
|
146
|
+
Override any of the default tokens:
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"colors": {
|
|
151
|
+
"light": {
|
|
152
|
+
"--theme-background": "#ffffff",
|
|
153
|
+
"--theme-foreground": "#1a1a1a",
|
|
154
|
+
"--theme-primary": "#3b82f6",
|
|
155
|
+
"--theme-primary-foreground": "#ffffff"
|
|
156
|
+
},
|
|
157
|
+
"dark": {
|
|
158
|
+
"--theme-background": "#0a0a0a",
|
|
159
|
+
"--theme-foreground": "#fafafa",
|
|
160
|
+
"--theme-primary": "#60a5fa",
|
|
161
|
+
"--theme-primary-foreground": "#0a0a0a"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"fonts": {
|
|
165
|
+
"--font-sans": "Inter, system-ui, sans-serif"
|
|
166
|
+
},
|
|
167
|
+
"radius": {
|
|
168
|
+
"--radius-sm": "0.25rem",
|
|
169
|
+
"--radius-md": "0.5rem",
|
|
170
|
+
"--radius-lg": "0.75rem"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Theme Entry Point (src/index.ts)
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
import type { ThemePlugin } from '@quilltap/plugin-types';
|
|
179
|
+
import { createPluginLogger } from '@quilltap/plugin-utils';
|
|
180
|
+
import manifest from '../manifest.json';
|
|
181
|
+
import tokens from '../tokens.json';
|
|
182
|
+
|
|
183
|
+
const logger = createPluginLogger(manifest.id);
|
|
184
|
+
|
|
185
|
+
const plugin: ThemePlugin = {
|
|
186
|
+
manifest,
|
|
187
|
+
|
|
188
|
+
async initialize() {
|
|
189
|
+
logger.info('Theme initialized');
|
|
190
|
+
return { success: true };
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
async getTokens() {
|
|
194
|
+
return tokens;
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
async getStyles() {
|
|
198
|
+
// Return additional CSS if needed
|
|
199
|
+
return '';
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export default plugin;
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Theme Token Reference
|
|
207
|
+
|
|
208
|
+
### Color Tokens
|
|
209
|
+
|
|
210
|
+
Theme plugins should define these `--theme-*` tokens, which are automatically aliased to `--color-*`:
|
|
211
|
+
|
|
212
|
+
| Token | Description |
|
|
213
|
+
|-------|-------------|
|
|
214
|
+
| `--theme-background` | Page/app background |
|
|
215
|
+
| `--theme-foreground` | Primary text color |
|
|
216
|
+
| `--theme-card` | Card background |
|
|
217
|
+
| `--theme-card-foreground` | Card text color |
|
|
218
|
+
| `--theme-primary` | Primary action color |
|
|
219
|
+
| `--theme-primary-foreground` | Text on primary color |
|
|
220
|
+
| `--theme-secondary` | Secondary elements |
|
|
221
|
+
| `--theme-muted` | Muted backgrounds |
|
|
222
|
+
| `--theme-muted-foreground` | Secondary text |
|
|
223
|
+
| `--theme-accent` | Accent highlights |
|
|
224
|
+
| `--theme-border` | Border color |
|
|
225
|
+
| `--theme-destructive` | Error/delete actions |
|
|
226
|
+
| `--theme-success` | Success states |
|
|
227
|
+
| `--theme-warning` | Warning states |
|
|
228
|
+
|
|
229
|
+
### Font Tokens
|
|
230
|
+
|
|
231
|
+
| Token | Description |
|
|
232
|
+
|-------|-------------|
|
|
233
|
+
| `--font-sans` | Primary sans-serif font stack |
|
|
234
|
+
| `--font-serif` | Serif font stack |
|
|
235
|
+
| `--font-mono` | Monospace font stack |
|
|
236
|
+
|
|
237
|
+
### Radius Tokens
|
|
238
|
+
|
|
239
|
+
| Token | Description |
|
|
240
|
+
|-------|-------------|
|
|
241
|
+
| `--radius-sm` | Small border radius |
|
|
242
|
+
| `--radius-md` | Medium border radius |
|
|
243
|
+
| `--radius-lg` | Large border radius |
|
|
244
|
+
|
|
245
|
+
## Component Classes
|
|
246
|
+
|
|
247
|
+
All Quilltap components use `qt-*` prefixed classes. Your theme CSS can override these classes to customize component appearance beyond color tokens.
|
|
248
|
+
|
|
249
|
+
### Buttons
|
|
250
|
+
- `.qt-button` - Base button styles
|
|
251
|
+
- `.qt-button-primary` - Primary action button
|
|
252
|
+
- `.qt-button-secondary` - Secondary button
|
|
253
|
+
- `.qt-button-ghost` - Ghost/text button
|
|
254
|
+
- `.qt-button-destructive` - Destructive action
|
|
255
|
+
- `.qt-button-sm`, `.qt-button-lg` - Size variants
|
|
256
|
+
- `.qt-button-icon` - Icon-only button
|
|
257
|
+
|
|
258
|
+
### Cards
|
|
259
|
+
- `.qt-card` - Card container
|
|
260
|
+
- `.qt-card-header`, `.qt-card-body`, `.qt-card-footer` - Card sections
|
|
261
|
+
- `.qt-card-title`, `.qt-card-description` - Card text
|
|
262
|
+
- `.qt-card-interactive` - Hoverable card
|
|
263
|
+
- `.qt-entity-card` - Character/entity list card
|
|
264
|
+
- `.qt-panel` - Panel variant
|
|
265
|
+
|
|
266
|
+
### Inputs
|
|
267
|
+
- `.qt-input` - Text input styling
|
|
268
|
+
- `.qt-textarea` - Textarea variant
|
|
269
|
+
- `.qt-select` - Select dropdown
|
|
270
|
+
|
|
271
|
+
### Badges
|
|
272
|
+
- `.qt-badge` - Base badge
|
|
273
|
+
- `.qt-badge-primary`, `.qt-badge-secondary`, etc. - Variants
|
|
274
|
+
- `.qt-badge-outline-*` - Outline variants
|
|
275
|
+
|
|
276
|
+
### Chat
|
|
277
|
+
- `.qt-chat-message` - Message container
|
|
278
|
+
- `.qt-chat-bubble` - Message bubble
|
|
279
|
+
- `.qt-chat-bubble-user`, `.qt-chat-bubble-assistant` - Role variants
|
|
280
|
+
- `.qt-chat-input` - Chat input field
|
|
281
|
+
- `.qt-typing-indicator` - Typing animation
|
|
282
|
+
|
|
283
|
+
### Dialogs
|
|
284
|
+
- `.qt-dialog-overlay` - Modal backdrop
|
|
285
|
+
- `.qt-dialog` - Dialog container
|
|
286
|
+
- `.qt-dialog-header`, `.qt-dialog-content`, `.qt-dialog-footer` - Sections
|
|
287
|
+
|
|
288
|
+
### Navigation
|
|
289
|
+
- `.qt-tabs`, `.qt-tab` - Tab components
|
|
290
|
+
- `.qt-navbar`, `.qt-nav-link` - Navigation bar
|
|
291
|
+
|
|
292
|
+
## Development Workflow
|
|
293
|
+
|
|
294
|
+
1. **Start Storybook**: `npm run storybook`
|
|
295
|
+
2. **Edit tokens.json**: Modify colors, fonts, or radius values
|
|
296
|
+
3. **Preview changes**: Hot reload shows changes instantly
|
|
297
|
+
4. **Test both modes**: Use the toolbar to switch between light/dark
|
|
298
|
+
5. **Build plugin**: `npm run build`
|
|
299
|
+
6. **Test in Quilltap**: Install your theme plugin
|
|
300
|
+
|
|
301
|
+
## API Reference
|
|
302
|
+
|
|
303
|
+
### ThemeDecorator
|
|
304
|
+
|
|
305
|
+
A Storybook decorator that applies theme classes and handles dark mode:
|
|
306
|
+
|
|
307
|
+
```typescript
|
|
308
|
+
import { ThemeDecorator } from '@quilltap/theme-storybook';
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### defaultPreviewConfig
|
|
312
|
+
|
|
313
|
+
Default Storybook preview configuration with theme/color mode toggles:
|
|
314
|
+
|
|
315
|
+
```typescript
|
|
316
|
+
import { defaultPreviewConfig } from '@quilltap/theme-storybook';
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### CSS Imports
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
// Default theme tokens
|
|
323
|
+
import '@quilltap/theme-storybook/css/quilltap-defaults.css';
|
|
324
|
+
|
|
325
|
+
// Component class definitions
|
|
326
|
+
import '@quilltap/theme-storybook/css/qt-components.css';
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
## License
|
|
330
|
+
|
|
331
|
+
MIT - Part of the Quilltap project by Foundry-9 LLC
|