@dfosco/storyboard-core 4.2.2 → 4.2.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.
Files changed (57) hide show
  1. package/dist/storyboard-ui.css +1 -1
  2. package/dist/storyboard-ui.js +7973 -8418
  3. package/dist/storyboard-ui.js.map +1 -1
  4. package/package.json +2 -12
  5. package/scaffold/AGENTS.md +432 -0
  6. package/scaffold/gitignore +64 -0
  7. package/scaffold/manifest.json +13 -8
  8. package/src/ActionMenuButton.jsx +1 -1
  9. package/src/AutosyncMenuButton.jsx +1 -1
  10. package/src/CanvasAgentsMenu.jsx +1 -1
  11. package/src/CanvasCreateMenu.jsx +1 -1
  12. package/src/CanvasSnap.jsx +1 -1
  13. package/src/CanvasZoomToFit.jsx +1 -1
  14. package/src/CommandMenu.jsx +2 -2
  15. package/src/CommandPalette.jsx +1 -1
  16. package/src/CommandPaletteTrigger.jsx +1 -1
  17. package/src/CommentsMenuButton.jsx +1 -1
  18. package/src/CoreUIBar.jsx +18 -2
  19. package/src/CreateMenuButton.jsx +1 -1
  20. package/src/HideChromeTrigger.jsx +1 -1
  21. package/src/{svelte-plugin-ui/components/Icon.jsx → Icon.jsx} +8 -10
  22. package/src/ThemeMenuButton.jsx +1 -1
  23. package/src/comments/ui/authModal.js +1 -1
  24. package/src/configSchema.js +2 -0
  25. package/src/configStore.js +1 -1
  26. package/src/devtools-consumer.js +2 -2
  27. package/src/index.js +3 -3
  28. package/src/mountStoryboardCore.js +3 -3
  29. package/src/sidepanel.css +1 -1
  30. package/src/toolbarConfigStore.js +1 -1
  31. package/src/ui/design-modes.ts +4 -51
  32. package/src/ui/viewfinder.ts +4 -55
  33. package/src/ui-entry.js +5 -5
  34. package/src/vite/server-plugin.js +9 -0
  35. package/src/workshop/features/createFlow/index.js +1 -1
  36. package/src/workshop/features/createPrototype/index.js +1 -1
  37. package/src/workshop/features/registry-server.js +1 -1
  38. package/src/workshop/ui/mount.ts +3 -65
  39. package/scaffold/svelte.config.js +0 -1
  40. package/src/svelte-plugin-ui/__tests__/ModeSwitch.test.ts +0 -75
  41. package/src/svelte-plugin-ui/__tests__/ToolbarShell.test.ts +0 -126
  42. package/src/svelte-plugin-ui/__tests__/designModes.test.ts +0 -58
  43. package/src/svelte-plugin-ui/__tests__/modeStore.test.ts +0 -53
  44. package/src/svelte-plugin-ui/__tests__/mount.test.ts +0 -29
  45. package/src/svelte-plugin-ui/components/Icon.css +0 -11
  46. package/src/svelte-plugin-ui/components/ModeSwitch.css +0 -90
  47. package/src/svelte-plugin-ui/components/ModeSwitch.jsx +0 -47
  48. package/src/svelte-plugin-ui/components/ToolbarShell.css +0 -80
  49. package/src/svelte-plugin-ui/components/ToolbarShell.jsx +0 -84
  50. package/src/svelte-plugin-ui/components/Viewfinder.css +0 -412
  51. package/src/svelte-plugin-ui/components/Viewfinder.jsx +0 -513
  52. package/src/svelte-plugin-ui/index.ts +0 -20
  53. package/src/svelte-plugin-ui/mount.ts +0 -120
  54. package/src/svelte-plugin-ui/stores/modeStore.ts +0 -91
  55. package/src/svelte-plugin-ui/stores/toolStore.ts +0 -71
  56. package/src/svelte-plugin-ui/stores/types.ts +0 -55
  57. package/src/svelte-plugin-ui/styles/base.css +0 -69
@@ -1,91 +0,0 @@
1
- /**
2
- * Svelte store that wraps the core modes.js API.
3
- *
4
- * Provides a readable store whose value updates whenever the active mode
5
- * or the set of registered modes changes. Uses subscribeToMode() from
6
- * @dfosco/storyboard-core so it stays in sync with any other consumer
7
- * (React hooks, vanilla JS, etc.).
8
- */
9
-
10
- import { writable, type Readable } from 'svelte/store'
11
- import {
12
- getCurrentMode,
13
- getRegisteredModes,
14
- activateMode,
15
- subscribeToMode,
16
- isModeSwitcherVisible,
17
- } from './types.js'
18
- import type { ModeConfig } from './types.js'
19
-
20
- export interface ModeState {
21
- /** Currently active mode name */
22
- mode: string
23
- /** All registered modes */
24
- modes: ModeConfig[]
25
- /** Config object for the active mode */
26
- currentModeConfig: ModeConfig | undefined
27
- /** Whether the mode switcher should be visible */
28
- switcherVisible: boolean
29
- }
30
-
31
- function snapshot(): ModeState {
32
- const mode = getCurrentMode()
33
- const modes = getRegisteredModes()
34
- return {
35
- mode,
36
- modes,
37
- currentModeConfig: modes.find((m) => m.name === mode),
38
- switcherVisible: isModeSwitcherVisible(),
39
- }
40
- }
41
-
42
- /**
43
- * Create the mode state store.
44
- *
45
- * Uses a writable internally but exposes only a readable interface.
46
- * Subscribes to the core modes API whenever there are active subscribers,
47
- * and always provides a fresh snapshot on subscribe.
48
- */
49
- function createModeStore(): Readable<ModeState> {
50
- const { subscribe: rawSubscribe, set } = writable<ModeState>(snapshot())
51
-
52
- const subscribe: Readable<ModeState>['subscribe'] = (run, invalidate) => {
53
- // Always give the subscriber the latest snapshot immediately
54
- set(snapshot())
55
-
56
- // Subscribe to core mode changes while there are Svelte subscribers
57
- const unsubCore = subscribeToMode(() => set(snapshot()))
58
-
59
- const unsubStore = rawSubscribe(run, invalidate)
60
-
61
- return () => {
62
- unsubStore()
63
- unsubCore()
64
- }
65
- }
66
-
67
- return { subscribe }
68
- }
69
-
70
- /**
71
- * Readable Svelte store for the design-mode system.
72
- *
73
- * ```svelte
74
- * <script>
75
- * import { modeState, switchMode } from '@dfosco/storyboard-core/svelte-plugin-ui'
76
- * </script>
77
- *
78
- * {#each $modeState.modes as m}
79
- * <button on:click={() => switchMode(m.name)}>{m.label}</button>
80
- * {/each}
81
- * ```
82
- */
83
- export const modeState: Readable<ModeState> = createModeStore()
84
-
85
- /**
86
- * Switch to a registered mode. Thin wrapper around activateMode —
87
- * the store updates automatically via the subscription.
88
- */
89
- export function switchMode(name: string, options?: Record<string, unknown>): void {
90
- activateMode(name, options)
91
- }
@@ -1,71 +0,0 @@
1
- /**
2
- * Svelte store that wraps the core tool registry API.
3
- *
4
- * Provides a readable store whose value updates whenever:
5
- * - The active mode changes (different tools for each mode)
6
- * - Tool state or actions change (setToolState, setToolAction)
7
- *
8
- * Groups tools into { tools, devTools } for the toolbar to consume.
9
- */
10
-
11
- import { writable, type Readable } from 'svelte/store'
12
- import {
13
- getCurrentMode,
14
- getToolsForMode,
15
- subscribeToMode,
16
- subscribeToTools,
17
- } from './types.js'
18
- import type { ResolvedTool } from './types.js'
19
-
20
- export interface ToolStoreState {
21
- /** Tools in the 'tools' group for the current mode */
22
- tools: ResolvedTool[]
23
- /** Tools in the 'dev' group for the current mode */
24
- devTools: ResolvedTool[]
25
- }
26
-
27
- function snapshot(): ToolStoreState {
28
- const mode = getCurrentMode()
29
- const allTools = getToolsForMode(mode)
30
- return {
31
- tools: allTools.filter((t) => t.group === 'tools'),
32
- devTools: allTools.filter((t) => t.group === 'dev'),
33
- }
34
- }
35
-
36
- function createToolStore(): Readable<ToolStoreState> {
37
- const { subscribe: rawSubscribe, set } = writable<ToolStoreState>(snapshot())
38
-
39
- const subscribe: Readable<ToolStoreState>['subscribe'] = (run, invalidate) => {
40
- set(snapshot())
41
-
42
- // Re-snapshot on mode changes OR tool state/action changes
43
- const unsubMode = subscribeToMode(() => set(snapshot()))
44
- const unsubTools = subscribeToTools(() => set(snapshot()))
45
-
46
- const unsubStore = rawSubscribe(run, invalidate)
47
-
48
- return () => {
49
- unsubStore()
50
- unsubMode()
51
- unsubTools()
52
- }
53
- }
54
-
55
- return { subscribe }
56
- }
57
-
58
- /**
59
- * Readable Svelte store for the tool registry.
60
- *
61
- * ```svelte
62
- * <script>
63
- * import { toolState } from '../stores/toolStore.js'
64
- * </script>
65
- *
66
- * {#each $toolState.tools as tool}
67
- * <button onclick={tool.action} disabled={!tool.state.enabled}>{tool.label}</button>
68
- * {/each}
69
- * ```
70
- */
71
- export const toolState: Readable<ToolStoreState> = createToolStore()
@@ -1,55 +0,0 @@
1
- /**
2
- * Type declarations for the core modes API.
3
- *
4
- * Re-exports the core functions with proper TypeScript signatures
5
- * so Svelte components and stores get full type safety.
6
- */
7
-
8
- // Re-export from core modes (sibling module within @dfosco/storyboard-core)
9
- export {
10
- getCurrentMode,
11
- getRegisteredModes,
12
- activateMode,
13
- deactivateMode,
14
- subscribeToMode,
15
- getModeSnapshot,
16
- registerMode,
17
- unregisterMode,
18
- syncModeClasses,
19
- on,
20
- off,
21
- emit,
22
- getToolsForMode,
23
- subscribeToTools,
24
- getToolsSnapshot,
25
- getLockedMode,
26
- isModeSwitcherVisible,
27
- } from '../../modes.js'
28
-
29
- export interface ModeConfig {
30
- name: string
31
- label: string
32
- icon?: string
33
- className?: string | string[]
34
- onActivate?: (options?: Record<string, unknown>) => void
35
- onDeactivate?: () => void
36
- }
37
-
38
- export interface ToolState {
39
- enabled: boolean
40
- active: boolean
41
- busy: boolean
42
- hidden: boolean
43
- badge: string | number | null
44
- }
45
-
46
- export interface ResolvedTool {
47
- id: string
48
- label: string
49
- group: 'tools' | 'dev'
50
- icon: string | null
51
- order: number
52
- modes: string[]
53
- state: ToolState
54
- action: (() => void) | null
55
- }
@@ -1,69 +0,0 @@
1
- /**
2
- * Shared plugin UI styles.
3
- *
4
- * sb-* custom properties switch based on [data-sb-theme] on <html>.
5
- * Themes starting with "dark" get dark tokens; everything else gets light.
6
- *
7
- * These are consumed by all core plugin UIs (design-modes, comments, etc.)
8
- */
9
-
10
- /* --- Light theme (default) --- */
11
- :root {
12
- --sb--bg: #ffffff;
13
- --sb--bg-inset: #f6f8fa;
14
- --sb--bg-muted: #f3f4f6;
15
- --sb--border: #d1d5db;
16
- --sb--border-muted: #e5e7eb;
17
- --sb--fg: #1f2328;
18
- --sb--fg-muted: #656d76;
19
- --sb--fg-accent: #0969da;
20
- --sb--fg-success: #1a7f37;
21
- --sb--fg-danger: #d1242f;
22
- --sb--btn-success: #1a7f37;
23
- }
24
-
25
- /* --- Dark theme (any dark-* variant) --- */
26
- [data-sb-theme^="dark"] {
27
- --sb--bg: #161b22;
28
- --sb--bg-inset: #0d1117;
29
- --sb--bg-muted: #21262d;
30
- --sb--border: #30363d;
31
- --sb--border-muted: #21262d;
32
- --sb--fg: #e6edf3;
33
- --sb--fg-muted: #8b949e;
34
- --sb--fg-accent: #58a6ff;
35
- --sb--fg-success: #3fb950;
36
- --sb--fg-danger: #f85149;
37
- --sb--btn-success: #238636;
38
- }
39
-
40
- /* --- Semantic utility classes (supplement Tachyons) --- */
41
- .sb-bg { background-color: var(--sb--bg); }
42
- .sb-bg-inset { background-color: var(--sb--bg-inset); }
43
- .sb-bg-muted { background-color: var(--sb--bg-muted); }
44
- .sb-b-default { border-color: var(--sb--border); }
45
- .sb-b-muted { border-color: var(--sb--border-muted); }
46
- .sb-fg { color: var(--sb--fg); }
47
- .sb-fg-muted { color: var(--sb--fg-muted); }
48
- .sb-fg-accent { color: var(--sb--fg-accent); }
49
- .sb-fg-success { color: var(--sb--fg-success); }
50
- .sb-fg-danger { color: var(--sb--fg-danger); }
51
- .sb-btn-success { background-color: var(--sb--btn-success); color: #fff; }
52
- .sb-btn-success:hover { filter: brightness(1.15); }
53
- .sb-btn-cancel { background-color: var(--sb--bg-muted); border: 1px solid var(--sb--border); color: var(--sb--fg); }
54
- .sb-btn-cancel:hover { background-color: var(--sb--border-muted); }
55
-
56
- .sb-input {
57
- background: var(--sb--bg-inset);
58
- border: 1px solid var(--sb--border);
59
- color: var(--sb--fg);
60
- outline: none;
61
- }
62
- .sb-input:focus {
63
- border-color: var(--sb--fg-accent);
64
- box-shadow: 0 0 0 3px color-mix(in srgb, var(--sb--fg-accent) 15%, transparent);
65
- }
66
- .sb-input::placeholder { color: var(--sb--fg-muted); }
67
-
68
- .sb-shadow { box-shadow: 0 8px 24px rgba(0,0,0,0.15), 0 2px 6px rgba(0,0,0,0.1); }
69
- [data-sb-theme^="dark"] .sb-shadow { box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.3); }