@dfosco/storyboard-core 3.1.2 → 3.3.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.
Files changed (59) hide show
  1. package/dist/storyboard-ui.css +1 -0
  2. package/dist/storyboard-ui.js +26298 -0
  3. package/dist/storyboard-ui.js.map +1 -0
  4. package/dist/tailwind.css +1 -1
  5. package/package.json +24 -19
  6. package/scaffold/manifest.json +35 -0
  7. package/scaffold/scripts/link.sh +26 -0
  8. package/scaffold/scripts/unlink.sh +10 -0
  9. package/scaffold/skills/create/SKILL.md +501 -0
  10. package/scaffold/skills/storyboard/SKILL.md +360 -0
  11. package/scaffold/skills/update-storyboard/SKILL.md +16 -0
  12. package/scaffold/skills/update-storyboard/update-storyboard-packages.sh +26 -0
  13. package/scaffold/skills/vitest/GENERATION.md +5 -0
  14. package/scaffold/skills/vitest/SKILL.md +52 -0
  15. package/scaffold/skills/vitest/references/advanced-environments.md +264 -0
  16. package/scaffold/skills/vitest/references/advanced-projects.md +300 -0
  17. package/scaffold/skills/vitest/references/advanced-type-testing.md +237 -0
  18. package/scaffold/skills/vitest/references/advanced-vi.md +249 -0
  19. package/scaffold/skills/vitest/references/core-cli.md +166 -0
  20. package/scaffold/skills/vitest/references/core-config.md +174 -0
  21. package/scaffold/skills/vitest/references/core-describe.md +193 -0
  22. package/scaffold/skills/vitest/references/core-expect.md +219 -0
  23. package/scaffold/skills/vitest/references/core-hooks.md +244 -0
  24. package/scaffold/skills/vitest/references/core-test-api.md +233 -0
  25. package/scaffold/skills/vitest/references/features-concurrency.md +250 -0
  26. package/scaffold/skills/vitest/references/features-context.md +238 -0
  27. package/scaffold/skills/vitest/references/features-coverage.md +207 -0
  28. package/scaffold/skills/vitest/references/features-filtering.md +211 -0
  29. package/scaffold/skills/vitest/references/features-mocking.md +265 -0
  30. package/scaffold/skills/vitest/references/features-snapshots.md +207 -0
  31. package/scaffold/skills/worktree/SKILL.md +51 -0
  32. package/scaffold/storyboard.config.json +26 -0
  33. package/scaffold/svelte.config.js +1 -0
  34. package/scaffold/toolbar.config.json +4 -0
  35. package/src/ActionMenuButton.svelte +1 -1
  36. package/src/CanvasCreateMenu.svelte +1 -1
  37. package/src/CoreUIBar.svelte +20 -9
  38. package/src/CreateMenuButton.svelte +1 -1
  39. package/src/InspectorPanel.svelte +144 -49
  40. package/src/SidePanel.svelte +10 -10
  41. package/src/commandActions.js +1 -1
  42. package/src/comments/index.js +0 -3
  43. package/src/devtools.js +4 -1
  44. package/src/index.js +5 -2
  45. package/src/inspector/highlighter.js +3 -4
  46. package/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte +1 -1
  47. package/src/mountStoryboardCore.js +223 -0
  48. package/src/scaffold.js +100 -0
  49. package/src/stores/themeStore.ts +29 -8
  50. package/src/styles/tailwind.css +16 -0
  51. package/src/svelte-plugin-ui/components/Viewfinder.svelte +18 -0
  52. package/src/ui-entry.js +30 -0
  53. package/src/vite/server-plugin.js +8 -24
  54. package/src/workshop/features/createCanvas/CreateCanvasForm.svelte +24 -6
  55. package/src/workshop/features/createFlow/CreateFlowForm.svelte +1 -1
  56. package/src/workshop/features/createFlow/index.js +0 -1
  57. package/src/workshop/features/createPrototype/CreatePrototypeForm.svelte +1 -1
  58. package/src/workshop/features/createPrototype/index.js +0 -1
  59. /package/{core-ui.config.json → toolbar.config.json} +0 -0
@@ -0,0 +1,264 @@
1
+ ---
2
+ name: test-environments
3
+ description: Configure environments like jsdom, happy-dom for browser APIs
4
+ ---
5
+
6
+ # Test Environments
7
+
8
+ ## Available Environments
9
+
10
+ - `node` (default) - Node.js environment
11
+ - `jsdom` - Browser-like with DOM APIs
12
+ - `happy-dom` - Faster alternative to jsdom
13
+ - `edge-runtime` - Vercel Edge Runtime
14
+
15
+ ## Configuration
16
+
17
+ ```ts
18
+ // vitest.config.ts
19
+ defineConfig({
20
+ test: {
21
+ environment: 'jsdom',
22
+
23
+ // Environment-specific options
24
+ environmentOptions: {
25
+ jsdom: {
26
+ url: 'http://localhost',
27
+ },
28
+ },
29
+ },
30
+ })
31
+ ```
32
+
33
+ ## Installing Environment Packages
34
+
35
+ ```bash
36
+ # jsdom
37
+ npm i -D jsdom
38
+
39
+ # happy-dom (faster, fewer APIs)
40
+ npm i -D happy-dom
41
+ ```
42
+
43
+ ## Per-File Environment
44
+
45
+ Use magic comment at top of file:
46
+
47
+ ```ts
48
+ // @vitest-environment jsdom
49
+
50
+ import { expect, test } from 'vitest'
51
+
52
+ test('DOM test', () => {
53
+ const div = document.createElement('div')
54
+ expect(div).toBeInstanceOf(HTMLDivElement)
55
+ })
56
+ ```
57
+
58
+ ## jsdom Environment
59
+
60
+ Full browser environment simulation:
61
+
62
+ ```ts
63
+ // @vitest-environment jsdom
64
+
65
+ test('DOM manipulation', () => {
66
+ document.body.innerHTML = '<div id="app"></div>'
67
+
68
+ const app = document.getElementById('app')
69
+ app.textContent = 'Hello'
70
+
71
+ expect(app.textContent).toBe('Hello')
72
+ })
73
+
74
+ test('window APIs', () => {
75
+ expect(window.location.href).toBeDefined()
76
+ expect(localStorage).toBeDefined()
77
+ })
78
+ ```
79
+
80
+ ### jsdom Options
81
+
82
+ ```ts
83
+ defineConfig({
84
+ test: {
85
+ environmentOptions: {
86
+ jsdom: {
87
+ url: 'http://localhost:3000',
88
+ html: '<!DOCTYPE html><html><body></body></html>',
89
+ userAgent: 'custom-agent',
90
+ resources: 'usable',
91
+ },
92
+ },
93
+ },
94
+ })
95
+ ```
96
+
97
+ ## happy-dom Environment
98
+
99
+ Faster but fewer APIs:
100
+
101
+ ```ts
102
+ // @vitest-environment happy-dom
103
+
104
+ test('basic DOM', () => {
105
+ const el = document.createElement('div')
106
+ el.className = 'test'
107
+ expect(el.className).toBe('test')
108
+ })
109
+ ```
110
+
111
+ ## Multiple Environments per Project
112
+
113
+ Use projects for different environments:
114
+
115
+ ```ts
116
+ defineConfig({
117
+ test: {
118
+ projects: [
119
+ {
120
+ test: {
121
+ name: 'unit',
122
+ include: ['tests/unit/**/*.test.ts'],
123
+ environment: 'node',
124
+ },
125
+ },
126
+ {
127
+ test: {
128
+ name: 'dom',
129
+ include: ['tests/dom/**/*.test.ts'],
130
+ environment: 'jsdom',
131
+ },
132
+ },
133
+ ],
134
+ },
135
+ })
136
+ ```
137
+
138
+ ## Custom Environment
139
+
140
+ Create custom environment package:
141
+
142
+ ```ts
143
+ // vitest-environment-custom/index.ts
144
+ import type { Environment } from 'vitest/runtime'
145
+
146
+ export default <Environment>{
147
+ name: 'custom',
148
+ viteEnvironment: 'ssr', // or 'client'
149
+
150
+ setup() {
151
+ // Setup global state
152
+ globalThis.myGlobal = 'value'
153
+
154
+ return {
155
+ teardown() {
156
+ delete globalThis.myGlobal
157
+ },
158
+ }
159
+ },
160
+ }
161
+ ```
162
+
163
+ Use with:
164
+
165
+ ```ts
166
+ defineConfig({
167
+ test: {
168
+ environment: 'custom',
169
+ },
170
+ })
171
+ ```
172
+
173
+ ## Environment with VM
174
+
175
+ For full isolation:
176
+
177
+ ```ts
178
+ export default <Environment>{
179
+ name: 'isolated',
180
+ viteEnvironment: 'ssr',
181
+
182
+ async setupVM() {
183
+ const vm = await import('node:vm')
184
+ const context = vm.createContext()
185
+
186
+ return {
187
+ getVmContext() {
188
+ return context
189
+ },
190
+ teardown() {},
191
+ }
192
+ },
193
+
194
+ setup() {
195
+ return { teardown() {} }
196
+ },
197
+ }
198
+ ```
199
+
200
+ ## Browser Mode (Separate from Environments)
201
+
202
+ For real browser testing, use Vitest Browser Mode:
203
+
204
+ ```ts
205
+ defineConfig({
206
+ test: {
207
+ browser: {
208
+ enabled: true,
209
+ name: 'chromium', // or 'firefox', 'webkit'
210
+ provider: 'playwright',
211
+ },
212
+ },
213
+ })
214
+ ```
215
+
216
+ ## CSS and Assets
217
+
218
+ In jsdom/happy-dom, configure CSS handling:
219
+
220
+ ```ts
221
+ defineConfig({
222
+ test: {
223
+ css: true, // Process CSS
224
+
225
+ // Or with options
226
+ css: {
227
+ include: /\.module\.css$/,
228
+ modules: {
229
+ classNameStrategy: 'non-scoped',
230
+ },
231
+ },
232
+ },
233
+ })
234
+ ```
235
+
236
+ ## Fixing External Dependencies
237
+
238
+ If external deps fail with CSS/asset errors:
239
+
240
+ ```ts
241
+ defineConfig({
242
+ test: {
243
+ server: {
244
+ deps: {
245
+ inline: ['problematic-package'],
246
+ },
247
+ },
248
+ },
249
+ })
250
+ ```
251
+
252
+ ## Key Points
253
+
254
+ - Default is `node` - no browser APIs
255
+ - Use `jsdom` for full browser simulation
256
+ - Use `happy-dom` for faster tests with basic DOM
257
+ - Per-file environment via `// @vitest-environment` comment
258
+ - Use projects for multiple environment configurations
259
+ - Browser Mode is for real browser testing, not environment
260
+
261
+ <!--
262
+ Source references:
263
+ - https://vitest.dev/guide/environment.html
264
+ -->
@@ -0,0 +1,300 @@
1
+ ---
2
+ name: projects-workspaces
3
+ description: Multi-project configuration for monorepos and different test types
4
+ ---
5
+
6
+ # Projects
7
+
8
+ Run different test configurations in the same Vitest process.
9
+
10
+ ## Basic Projects Setup
11
+
12
+ ```ts
13
+ // vitest.config.ts
14
+ defineConfig({
15
+ test: {
16
+ projects: [
17
+ // Glob patterns for config files
18
+ 'packages/*',
19
+
20
+ // Inline config
21
+ {
22
+ test: {
23
+ name: 'unit',
24
+ include: ['tests/unit/**/*.test.ts'],
25
+ environment: 'node',
26
+ },
27
+ },
28
+ {
29
+ test: {
30
+ name: 'integration',
31
+ include: ['tests/integration/**/*.test.ts'],
32
+ environment: 'jsdom',
33
+ },
34
+ },
35
+ ],
36
+ },
37
+ })
38
+ ```
39
+
40
+ ## Monorepo Pattern
41
+
42
+ ```ts
43
+ defineConfig({
44
+ test: {
45
+ projects: [
46
+ // Each package has its own vitest.config.ts
47
+ 'packages/core',
48
+ 'packages/cli',
49
+ 'packages/utils',
50
+ ],
51
+ },
52
+ })
53
+ ```
54
+
55
+ Package config:
56
+
57
+ ```ts
58
+ // packages/core/vitest.config.ts
59
+ import { defineConfig } from 'vitest/config'
60
+
61
+ export default defineConfig({
62
+ test: {
63
+ name: 'core',
64
+ include: ['src/**/*.test.ts'],
65
+ environment: 'node',
66
+ },
67
+ })
68
+ ```
69
+
70
+ ## Different Environments
71
+
72
+ Run same tests in different environments:
73
+
74
+ ```ts
75
+ defineConfig({
76
+ test: {
77
+ projects: [
78
+ {
79
+ test: {
80
+ name: 'happy-dom',
81
+ root: './shared-tests',
82
+ environment: 'happy-dom',
83
+ setupFiles: ['./setup.happy-dom.ts'],
84
+ },
85
+ },
86
+ {
87
+ test: {
88
+ name: 'node',
89
+ root: './shared-tests',
90
+ environment: 'node',
91
+ setupFiles: ['./setup.node.ts'],
92
+ },
93
+ },
94
+ ],
95
+ },
96
+ })
97
+ ```
98
+
99
+ ## Browser + Node Projects
100
+
101
+ ```ts
102
+ defineConfig({
103
+ test: {
104
+ projects: [
105
+ {
106
+ test: {
107
+ name: 'unit',
108
+ include: ['tests/unit/**/*.test.ts'],
109
+ environment: 'node',
110
+ },
111
+ },
112
+ {
113
+ test: {
114
+ name: 'browser',
115
+ include: ['tests/browser/**/*.test.ts'],
116
+ browser: {
117
+ enabled: true,
118
+ name: 'chromium',
119
+ provider: 'playwright',
120
+ },
121
+ },
122
+ },
123
+ ],
124
+ },
125
+ })
126
+ ```
127
+
128
+ ## Shared Configuration
129
+
130
+ ```ts
131
+ // vitest.shared.ts
132
+ export const sharedConfig = {
133
+ testTimeout: 10000,
134
+ setupFiles: ['./tests/setup.ts'],
135
+ }
136
+
137
+ // vitest.config.ts
138
+ import { sharedConfig } from './vitest.shared'
139
+
140
+ defineConfig({
141
+ test: {
142
+ projects: [
143
+ {
144
+ test: {
145
+ ...sharedConfig,
146
+ name: 'unit',
147
+ include: ['tests/unit/**/*.test.ts'],
148
+ },
149
+ },
150
+ {
151
+ test: {
152
+ ...sharedConfig,
153
+ name: 'e2e',
154
+ include: ['tests/e2e/**/*.test.ts'],
155
+ },
156
+ },
157
+ ],
158
+ },
159
+ })
160
+ ```
161
+
162
+ ## Project-Specific Dependencies
163
+
164
+ Each project can have different dependencies inlined:
165
+
166
+ ```ts
167
+ defineConfig({
168
+ test: {
169
+ projects: [
170
+ {
171
+ test: {
172
+ name: 'project-a',
173
+ server: {
174
+ deps: {
175
+ inline: ['package-a'],
176
+ },
177
+ },
178
+ },
179
+ },
180
+ ],
181
+ },
182
+ })
183
+ ```
184
+
185
+ ## Running Specific Projects
186
+
187
+ ```bash
188
+ # Run specific project
189
+ vitest --project unit
190
+ vitest --project integration
191
+
192
+ # Multiple projects
193
+ vitest --project unit --project e2e
194
+
195
+ # Exclude project
196
+ vitest --project.ignore browser
197
+ ```
198
+
199
+ ## Providing Values to Projects
200
+
201
+ Share values from config to tests:
202
+
203
+ ```ts
204
+ // vitest.config.ts
205
+ defineConfig({
206
+ test: {
207
+ projects: [
208
+ {
209
+ test: {
210
+ name: 'staging',
211
+ provide: {
212
+ apiUrl: 'https://staging.api.com',
213
+ debug: true,
214
+ },
215
+ },
216
+ },
217
+ {
218
+ test: {
219
+ name: 'production',
220
+ provide: {
221
+ apiUrl: 'https://api.com',
222
+ debug: false,
223
+ },
224
+ },
225
+ },
226
+ ],
227
+ },
228
+ })
229
+
230
+ // In tests, use inject
231
+ import { inject } from 'vitest'
232
+
233
+ test('uses correct api', () => {
234
+ const url = inject('apiUrl')
235
+ expect(url).toContain('api.com')
236
+ })
237
+ ```
238
+
239
+ ## With Fixtures
240
+
241
+ ```ts
242
+ const test = base.extend({
243
+ apiUrl: ['/default', { injected: true }],
244
+ })
245
+
246
+ test('uses injected url', ({ apiUrl }) => {
247
+ // apiUrl comes from project's provide config
248
+ })
249
+ ```
250
+
251
+ ## Project Isolation
252
+
253
+ Each project runs in its own thread pool by default:
254
+
255
+ ```ts
256
+ defineConfig({
257
+ test: {
258
+ projects: [
259
+ {
260
+ test: {
261
+ name: 'isolated',
262
+ isolate: true, // Full isolation
263
+ pool: 'forks',
264
+ },
265
+ },
266
+ ],
267
+ },
268
+ })
269
+ ```
270
+
271
+ ## Global Setup per Project
272
+
273
+ ```ts
274
+ defineConfig({
275
+ test: {
276
+ projects: [
277
+ {
278
+ test: {
279
+ name: 'with-db',
280
+ globalSetup: ['./tests/db-setup.ts'],
281
+ },
282
+ },
283
+ ],
284
+ },
285
+ })
286
+ ```
287
+
288
+ ## Key Points
289
+
290
+ - Projects run in same Vitest process
291
+ - Each project can have different environment, config
292
+ - Use glob patterns for monorepo packages
293
+ - Run specific projects with `--project` flag
294
+ - Use `provide` to inject config values into tests
295
+ - Projects inherit from root config unless overridden
296
+
297
+ <!--
298
+ Source references:
299
+ - https://vitest.dev/guide/projects.html
300
+ -->