@dfosco/storyboard-core 4.2.0-beta.2 → 4.2.0-beta.21
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/commandpalette.config.json +109 -24
- package/dist/storyboard-ui.css +1 -1
- package/dist/storyboard-ui.js +17379 -28568
- package/dist/storyboard-ui.js.map +1 -1
- package/dist/tailwind.css +1 -1
- package/package.json +5 -2
- package/scaffold/agents/prompt-agent.agent.md +181 -0
- package/scaffold/agents/terminal-agent.agent.md +351 -0
- package/scaffold/codex/config.toml +246 -0
- package/scaffold/manifest.json +5 -0
- package/scaffold/skills/canvas/SKILL.md +5 -4
- package/scaffold/skills/ship/SKILL.md +1 -1
- package/scaffold/storyboard.config.json +14 -1
- package/scaffold/toolbar.config.json +1 -1
- package/src/ActionMenuButton.jsx +100 -0
- package/src/AutosyncMenuButton.css +67 -0
- package/src/AutosyncMenuButton.jsx +241 -0
- package/src/BranchSelect.jsx +29 -0
- package/src/BranchSelect.module.css +30 -0
- package/src/CanvasAgentsMenu.jsx +87 -0
- package/src/CanvasCreateMenu.jsx +609 -0
- package/src/CanvasSnap.css +27 -0
- package/src/CanvasSnap.jsx +51 -0
- package/src/CanvasUndoRedo.css +36 -0
- package/src/CanvasUndoRedo.jsx +62 -0
- package/src/CanvasZoomControl.css +53 -0
- package/src/CanvasZoomControl.jsx +49 -0
- package/src/CanvasZoomToFit.css +18 -0
- package/src/CanvasZoomToFit.jsx +26 -0
- package/src/CommandMenu.css +8 -0
- package/src/CommandMenu.jsx +286 -0
- package/src/CommandPalette.jsx +35 -0
- package/src/CommandPaletteTrigger.jsx +25 -0
- package/src/CommentsMenuButton.jsx +38 -0
- package/src/CoreUIBar.css +47 -0
- package/src/CoreUIBar.jsx +855 -0
- package/src/CreateMenuButton.jsx +116 -0
- package/src/HideChromeTrigger.jsx +40 -0
- package/src/InspectorPanel.css +109 -0
- package/src/InspectorPanel.jsx +629 -0
- package/src/PwaInstallBanner.css +42 -0
- package/src/PwaInstallBanner.jsx +124 -0
- package/src/SidePanel.jsx +260 -0
- package/src/ThemeMenuButton.jsx +136 -0
- package/src/autosync/server.js +202 -5
- package/src/autosync/server.test.js +112 -0
- package/src/canvas/__tests__/agent-integration.test.js +593 -0
- package/src/canvas/__tests__/helpers/browser.js +95 -0
- package/src/canvas/__tests__/helpers/canvas-api.js +129 -0
- package/src/canvas/__tests__/helpers/perf.js +118 -0
- package/src/canvas/__tests__/helpers/setup.js +176 -0
- package/src/canvas/__tests__/helpers/tmux.js +130 -0
- package/src/canvas/__tests__/helpers/transcript.js +129 -0
- package/src/canvas/__tests__/terminal-integration.test.js +175 -0
- package/src/canvas/hot-pool.js +757 -0
- package/src/canvas/materializer.js +31 -0
- package/src/canvas/materializer.test.js +56 -0
- package/src/canvas/selectedWidgets.js +65 -7
- package/src/canvas/server.js +1801 -22
- package/src/canvas/server.test.js +239 -0
- package/src/canvas/terminal-config.js +331 -0
- package/src/canvas/terminal-registry.js +38 -0
- package/src/canvas/terminal-server.js +1037 -29
- package/src/canvas/writeGuard.js +51 -3
- package/src/canvasConfig.js +67 -1
- package/src/canvasConfig.test.js +79 -1
- package/src/cli/agent.js +85 -0
- package/src/cli/branch.js +232 -0
- package/src/cli/canvasAdd.js +59 -12
- package/src/cli/canvasBatch.js +98 -0
- package/src/cli/canvasBounds.js +1 -1
- package/src/cli/canvasRead.js +1 -1
- package/src/cli/canvasUpdate.js +179 -0
- package/src/cli/create.js +38 -14
- package/src/cli/dev.js +157 -83
- package/src/cli/exit.js +23 -24
- package/src/cli/index.js +55 -2
- package/src/cli/proxy.js +96 -37
- package/src/cli/schemas.js +22 -4
- package/src/cli/server.js +148 -25
- package/src/cli/serverUrl.js +8 -3
- package/src/cli/sessions.js +131 -5
- package/src/cli/setup.js +109 -11
- package/src/cli/terminal-commands.js +16 -8
- package/src/cli/terminal-messaging.js +231 -0
- package/src/cli/terminal-welcome.js +365 -33
- package/src/commandActions.js +1 -0
- package/src/commandPaletteConfig.js +9 -0
- package/src/comments/auth.js +2 -1
- package/src/comments/ui/AuthModal.jsx +114 -0
- package/src/comments/ui/CommentWindow.jsx +329 -0
- package/src/comments/ui/CommentsDrawer.jsx +102 -0
- package/src/comments/ui/Composer.jsx +64 -0
- package/src/comments/ui/authModal.test.js +1 -1
- package/src/comments/ui/commentWindow.js +16 -17
- package/src/comments/ui/commentsDrawer.js +25 -26
- package/src/comments/ui/composer.js +23 -24
- package/src/comments/ui/index.js +2 -3
- package/src/configSchema.js +59 -1
- package/src/configStore.js +161 -0
- package/src/core-ui-colors.css +12 -0
- package/src/devtools.js +17 -19
- package/src/devtools.test.js +18 -9
- package/src/featureFlags.js +12 -5
- package/src/fuzzySearch.test.js +10 -0
- package/src/index.js +14 -2
- package/src/lib/components/ui/alert/alert-action.jsx +11 -0
- package/src/lib/components/ui/alert/alert-description.jsx +11 -0
- package/src/lib/components/ui/alert/alert-title.jsx +11 -0
- package/src/lib/components/ui/alert/alert.jsx +25 -0
- package/src/lib/components/ui/alert/index.js +15 -15
- package/src/lib/components/ui/avatar/avatar-badge.jsx +22 -0
- package/src/lib/components/ui/avatar/avatar-fallback.jsx +18 -0
- package/src/lib/components/ui/avatar/avatar-group-count.jsx +19 -0
- package/src/lib/components/ui/avatar/avatar-group.jsx +19 -0
- package/src/lib/components/ui/avatar/avatar-image.jsx +15 -0
- package/src/lib/components/ui/avatar/avatar.jsx +19 -0
- package/src/lib/components/ui/avatar/index.js +20 -20
- package/src/lib/components/ui/badge/badge.jsx +31 -0
- package/src/lib/components/ui/badge/index.js +2 -2
- package/src/lib/components/ui/button/button.jsx +100 -0
- package/src/lib/components/ui/button/index.js +9 -9
- package/src/lib/components/ui/card/card-action.jsx +11 -0
- package/src/lib/components/ui/card/card-content.jsx +11 -0
- package/src/lib/components/ui/card/card-description.jsx +11 -0
- package/src/lib/components/ui/card/card-footer.jsx +11 -0
- package/src/lib/components/ui/card/card-header.jsx +19 -0
- package/src/lib/components/ui/card/card-title.jsx +11 -0
- package/src/lib/components/ui/card/card.jsx +17 -0
- package/src/lib/components/ui/card/index.js +23 -23
- package/src/lib/components/ui/checkbox/checkbox.jsx +29 -0
- package/src/lib/components/ui/checkbox/index.js +5 -5
- package/src/lib/components/ui/collapsible/collapsible-content.jsx +7 -0
- package/src/lib/components/ui/collapsible/collapsible-trigger.jsx +7 -0
- package/src/lib/components/ui/collapsible/collapsible.jsx +7 -0
- package/src/lib/components/ui/collapsible/index.js +11 -11
- package/src/lib/components/ui/dialog/dialog-close.jsx +7 -0
- package/src/lib/components/ui/dialog/dialog-content.jsx +34 -0
- package/src/lib/components/ui/dialog/dialog-description.jsx +15 -0
- package/src/lib/components/ui/dialog/dialog-footer.jsx +23 -0
- package/src/lib/components/ui/dialog/dialog-header.jsx +11 -0
- package/src/lib/components/ui/dialog/dialog-overlay.jsx +15 -0
- package/src/lib/components/ui/dialog/dialog-portal.jsx +4 -0
- package/src/lib/components/ui/dialog/dialog-title.jsx +15 -0
- package/src/lib/components/ui/dialog/dialog-trigger.jsx +7 -0
- package/src/lib/components/ui/dialog/dialog.jsx +4 -0
- package/src/lib/components/ui/dialog/index.js +32 -32
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-group.jsx +8 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.jsx +30 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-content.jsx +22 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.jsx +16 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-group.jsx +7 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-item.jsx +20 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-label.jsx +17 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-portal.jsx +4 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.jsx +7 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.jsx +29 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.jsx +15 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.jsx +16 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.jsx +15 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.jsx +23 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub.jsx +4 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-trigger.jsx +7 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu.jsx +4 -0
- package/src/lib/components/ui/dropdown-menu/index.js +52 -52
- package/src/lib/components/ui/input/index.js +5 -5
- package/src/lib/components/ui/input/input.jsx +19 -0
- package/src/lib/components/ui/label/index.js +5 -5
- package/src/lib/components/ui/label/label.jsx +19 -0
- package/src/lib/components/ui/panel/index.js +21 -21
- package/src/lib/components/ui/panel/panel-body.jsx +11 -0
- package/src/lib/components/ui/panel/panel-close.jsx +16 -0
- package/src/lib/components/ui/panel/panel-content.jsx +29 -0
- package/src/lib/components/ui/panel/panel-footer.jsx +11 -0
- package/src/lib/components/ui/panel/panel-header.jsx +11 -0
- package/src/lib/components/ui/panel/panel-title.jsx +12 -0
- package/src/lib/components/ui/panel/panel.jsx +4 -0
- package/src/lib/components/ui/popover/index.js +26 -26
- package/src/lib/components/ui/popover/popover-close.jsx +7 -0
- package/src/lib/components/ui/popover/popover-content.jsx +22 -0
- package/src/lib/components/ui/popover/popover-description.jsx +11 -0
- package/src/lib/components/ui/popover/popover-header.jsx +11 -0
- package/src/lib/components/ui/popover/popover-portal.jsx +4 -0
- package/src/lib/components/ui/popover/popover-title.jsx +11 -0
- package/src/lib/components/ui/popover/popover-trigger.jsx +8 -0
- package/src/lib/components/ui/popover/popover.jsx +4 -0
- package/src/lib/components/ui/searchable-list.jsx +159 -0
- package/src/lib/components/ui/select/index.js +35 -35
- package/src/lib/components/ui/select/select-content.jsx +30 -0
- package/src/lib/components/ui/select/select-group-heading.jsx +17 -0
- package/src/lib/components/ui/select/select-group.jsx +15 -0
- package/src/lib/components/ui/select/select-item.jsx +26 -0
- package/src/lib/components/ui/select/select-label.jsx +11 -0
- package/src/lib/components/ui/select/select-portal.jsx +4 -0
- package/src/lib/components/ui/select/select-scroll-down-button.jsx +18 -0
- package/src/lib/components/ui/select/select-scroll-up-button.jsx +18 -0
- package/src/lib/components/ui/select/select-separator.jsx +15 -0
- package/src/lib/components/ui/select/select-trigger.jsx +25 -0
- package/src/lib/components/ui/select/select.jsx +4 -0
- package/src/lib/components/ui/separator/index.js +5 -5
- package/src/lib/components/ui/separator/separator.jsx +22 -0
- package/src/lib/components/ui/sheet/index.js +32 -32
- package/src/lib/components/ui/sheet/sheet-close.jsx +7 -0
- package/src/lib/components/ui/sheet/sheet-content.jsx +35 -0
- package/src/lib/components/ui/sheet/sheet-description.jsx +15 -0
- package/src/lib/components/ui/sheet/sheet-footer.jsx +11 -0
- package/src/lib/components/ui/sheet/sheet-header.jsx +11 -0
- package/src/lib/components/ui/sheet/sheet-overlay.jsx +15 -0
- package/src/lib/components/ui/sheet/sheet-portal.jsx +4 -0
- package/src/lib/components/ui/sheet/sheet-title.jsx +15 -0
- package/src/lib/components/ui/sheet/sheet-trigger.jsx +7 -0
- package/src/lib/components/ui/sheet/sheet.jsx +4 -0
- package/src/lib/components/ui/textarea/index.js +5 -5
- package/src/lib/components/ui/textarea/textarea.jsx +18 -0
- package/src/lib/components/ui/toggle/index.js +6 -9
- package/src/lib/components/ui/toggle/toggle.jsx +36 -0
- package/src/lib/components/ui/toggle-group/index.js +8 -8
- package/src/lib/components/ui/toggle-group/toggle-group-item.jsx +29 -0
- package/src/lib/components/ui/toggle-group/toggle-group.jsx +43 -0
- package/src/lib/components/ui/tooltip/index.js +3 -3
- package/src/lib/components/ui/tooltip/tooltip-content.jsx +21 -0
- package/src/lib/components/ui/tooltip/tooltip-trigger.jsx +23 -0
- package/src/lib/components/ui/tooltip/tooltip.jsx +11 -0
- package/src/lib/components/ui/trigger-button/index.js +3 -3
- package/src/lib/components/ui/trigger-button/trigger-button.css +38 -0
- package/src/lib/components/ui/trigger-button/trigger-button.jsx +63 -0
- package/src/logger/devLogger.js +238 -0
- package/src/logger/devLogger.test.js +193 -0
- package/src/modes.test.js +4 -4
- package/src/mountStoryboardCore.js +123 -27
- package/src/paletteProviders.js +3 -0
- package/src/paletteProviders.test.js +2 -2
- package/src/server/index.js +98 -36
- package/src/sidepanel.css +214 -0
- package/src/styles/tailwind.css +1 -1
- package/src/svelte-plugin-ui/__tests__/ModeSwitch.test.ts +8 -8
- package/src/svelte-plugin-ui/__tests__/ToolbarShell.test.ts +11 -10
- package/src/svelte-plugin-ui/components/Icon.css +11 -0
- package/src/svelte-plugin-ui/components/Icon.jsx +281 -0
- package/src/svelte-plugin-ui/components/ModeSwitch.css +90 -0
- package/src/svelte-plugin-ui/components/ModeSwitch.jsx +47 -0
- package/src/svelte-plugin-ui/components/ToolbarShell.css +80 -0
- package/src/svelte-plugin-ui/components/ToolbarShell.jsx +84 -0
- package/src/svelte-plugin-ui/components/Viewfinder.css +412 -0
- package/src/svelte-plugin-ui/components/Viewfinder.jsx +512 -0
- package/src/svelte-plugin-ui/mount.ts +12 -16
- package/src/toolRegistry.js +4 -4
- package/src/toolbarConfigStore.js +30 -0
- package/src/tools/handlers/autosync.js +1 -1
- package/src/tools/handlers/canvasAddWidget.js +1 -1
- package/src/tools/handlers/canvasAgents.js +19 -0
- package/src/tools/handlers/canvasToolbar.js +8 -8
- package/src/tools/handlers/commandPalette.js +9 -0
- package/src/tools/handlers/comments.js +1 -1
- package/src/tools/handlers/create.js +1 -1
- package/src/tools/handlers/devtools.js +16 -0
- package/src/tools/handlers/devtools.test.js +38 -0
- package/src/tools/handlers/flows.js +1 -1
- package/src/tools/handlers/hideChrome.js +9 -0
- package/src/tools/handlers/paletteTheme.js +35 -0
- package/src/tools/handlers/theme.js +1 -1
- package/src/tools/registry.js +4 -1
- package/src/tools/surfaces/commandList.js +3 -3
- package/src/tools/surfaces/mainToolbar.js +3 -3
- package/src/tools/surfaces/registry.js +4 -4
- package/src/ui/design-modes.ts +2 -2
- package/src/ui/viewfinder.ts +1 -1
- package/src/vite/server-plugin.js +242 -60
- package/src/workshop/features/createCanvas/CreateCanvasForm.jsx +260 -0
- package/src/workshop/features/createCanvas/index.js +1 -1
- package/src/workshop/features/createFlow/CreateFlowForm.jsx +334 -0
- package/src/workshop/features/createFlow/index.js +1 -1
- package/src/workshop/features/createPage/CreatePageForm.jsx +304 -0
- package/src/workshop/features/createPage/index.js +1 -1
- package/src/workshop/features/createPrototype/CreatePrototypeForm.jsx +289 -0
- package/src/workshop/features/createPrototype/index.js +1 -1
- package/src/workshop/features/createPrototype/server.js +98 -0
- package/src/workshop/features/createStory/CreateStoryForm.jsx +208 -0
- package/src/workshop/features/createStory/index.js +1 -1
- package/src/workshop/ui/WorkshopPanel.jsx +98 -0
- package/src/workshop/ui/mount.ts +1 -1
- package/src/worktree/port.js +48 -0
- package/src/worktree/serverRegistry.js +120 -0
- package/toolbar.config.json +93 -42
- package/widgets.config.json +580 -12
- package/src/ActionMenuButton.svelte +0 -119
- package/src/AutosyncMenuButton.svelte +0 -397
- package/src/CanvasCreateMenu.svelte +0 -295
- package/src/CanvasSnap.svelte +0 -87
- package/src/CanvasUndoRedo.svelte +0 -108
- package/src/CanvasZoomControl.svelte +0 -111
- package/src/CanvasZoomToFit.svelte +0 -52
- package/src/CommandMenu.svelte +0 -249
- package/src/CommandPalette.svelte +0 -33
- package/src/CommentsMenuButton.svelte +0 -53
- package/src/CoreUIBar.svelte +0 -847
- package/src/CreateMenuButton.svelte +0 -133
- package/src/DocPanel.svelte +0 -299
- package/src/InspectorPanel.svelte +0 -745
- package/src/PwaInstallBanner.svelte +0 -124
- package/src/SidePanel.svelte +0 -480
- package/src/ThemeMenuButton.svelte +0 -132
- package/src/comments/ui/AuthModal.svelte +0 -108
- package/src/comments/ui/CommentWindow.svelte +0 -333
- package/src/comments/ui/CommentsDrawer.svelte +0 -96
- package/src/comments/ui/Composer.svelte +0 -65
- package/src/lib/components/ui/alert/alert-action.svelte +0 -19
- package/src/lib/components/ui/alert/alert-description.svelte +0 -22
- package/src/lib/components/ui/alert/alert-title.svelte +0 -22
- package/src/lib/components/ui/alert/alert.svelte +0 -38
- package/src/lib/components/ui/avatar/avatar-badge.svelte +0 -25
- package/src/lib/components/ui/avatar/avatar-fallback.svelte +0 -20
- package/src/lib/components/ui/avatar/avatar-group-count.svelte +0 -22
- package/src/lib/components/ui/avatar/avatar-group.svelte +0 -22
- package/src/lib/components/ui/avatar/avatar-image.svelte +0 -17
- package/src/lib/components/ui/avatar/avatar.svelte +0 -24
- package/src/lib/components/ui/badge/badge.svelte +0 -44
- package/src/lib/components/ui/button/button.svelte +0 -108
- package/src/lib/components/ui/card/card-action.svelte +0 -21
- package/src/lib/components/ui/card/card-content.svelte +0 -19
- package/src/lib/components/ui/card/card-description.svelte +0 -19
- package/src/lib/components/ui/card/card-footer.svelte +0 -18
- package/src/lib/components/ui/card/card-header.svelte +0 -21
- package/src/lib/components/ui/card/card-title.svelte +0 -14
- package/src/lib/components/ui/card/card.svelte +0 -21
- package/src/lib/components/ui/checkbox/checkbox.svelte +0 -39
- package/src/lib/components/ui/collapsible/collapsible-content.svelte +0 -7
- package/src/lib/components/ui/collapsible/collapsible-trigger.svelte +0 -7
- package/src/lib/components/ui/collapsible/collapsible.svelte +0 -11
- package/src/lib/components/ui/dialog/dialog-close.svelte +0 -11
- package/src/lib/components/ui/dialog/dialog-content.svelte +0 -42
- package/src/lib/components/ui/dialog/dialog-description.svelte +0 -17
- package/src/lib/components/ui/dialog/dialog-footer.svelte +0 -29
- package/src/lib/components/ui/dialog/dialog-header.svelte +0 -19
- package/src/lib/components/ui/dialog/dialog-overlay.svelte +0 -17
- package/src/lib/components/ui/dialog/dialog-portal.svelte +0 -7
- package/src/lib/components/ui/dialog/dialog-title.svelte +0 -17
- package/src/lib/components/ui/dialog/dialog-trigger.svelte +0 -11
- package/src/lib/components/ui/dialog/dialog.svelte +0 -7
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte +0 -16
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +0 -40
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte +0 -27
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +0 -18
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-group.svelte +0 -7
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte +0 -24
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte +0 -20
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-portal.svelte +0 -7
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte +0 -16
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +0 -34
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte +0 -17
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +0 -19
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +0 -17
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +0 -27
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub.svelte +0 -7
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-trigger.svelte +0 -7
- package/src/lib/components/ui/dropdown-menu/dropdown-menu.svelte +0 -7
- package/src/lib/components/ui/input/input.svelte +0 -40
- package/src/lib/components/ui/label/label.svelte +0 -20
- package/src/lib/components/ui/panel/panel-body.svelte +0 -13
- package/src/lib/components/ui/panel/panel-close.svelte +0 -16
- package/src/lib/components/ui/panel/panel-content.svelte +0 -33
- package/src/lib/components/ui/panel/panel-footer.svelte +0 -13
- package/src/lib/components/ui/panel/panel-header.svelte +0 -16
- package/src/lib/components/ui/panel/panel-title.svelte +0 -14
- package/src/lib/components/ui/panel/panel.svelte +0 -15
- package/src/lib/components/ui/popover/popover-close.svelte +0 -7
- package/src/lib/components/ui/popover/popover-content.svelte +0 -27
- package/src/lib/components/ui/popover/popover-description.svelte +0 -19
- package/src/lib/components/ui/popover/popover-header.svelte +0 -19
- package/src/lib/components/ui/popover/popover-portal.svelte +0 -7
- package/src/lib/components/ui/popover/popover-title.svelte +0 -19
- package/src/lib/components/ui/popover/popover-trigger.svelte +0 -17
- package/src/lib/components/ui/popover/popover.svelte +0 -7
- package/src/lib/components/ui/select/select-content.svelte +0 -40
- package/src/lib/components/ui/select/select-group-heading.svelte +0 -19
- package/src/lib/components/ui/select/select-group.svelte +0 -17
- package/src/lib/components/ui/select/select-item.svelte +0 -38
- package/src/lib/components/ui/select/select-label.svelte +0 -18
- package/src/lib/components/ui/select/select-portal.svelte +0 -7
- package/src/lib/components/ui/select/select-scroll-down-button.svelte +0 -20
- package/src/lib/components/ui/select/select-scroll-up-button.svelte +0 -20
- package/src/lib/components/ui/select/select-separator.svelte +0 -17
- package/src/lib/components/ui/select/select-trigger.svelte +0 -27
- package/src/lib/components/ui/select/select.svelte +0 -11
- package/src/lib/components/ui/separator/separator.svelte +0 -23
- package/src/lib/components/ui/sheet/sheet-close.svelte +0 -7
- package/src/lib/components/ui/sheet/sheet-content.svelte +0 -43
- package/src/lib/components/ui/sheet/sheet-description.svelte +0 -17
- package/src/lib/components/ui/sheet/sheet-footer.svelte +0 -18
- package/src/lib/components/ui/sheet/sheet-header.svelte +0 -19
- package/src/lib/components/ui/sheet/sheet-overlay.svelte +0 -17
- package/src/lib/components/ui/sheet/sheet-portal.svelte +0 -7
- package/src/lib/components/ui/sheet/sheet-title.svelte +0 -17
- package/src/lib/components/ui/sheet/sheet-trigger.svelte +0 -7
- package/src/lib/components/ui/sheet/sheet.svelte +0 -7
- package/src/lib/components/ui/textarea/textarea.svelte +0 -21
- package/src/lib/components/ui/toggle/toggle.svelte +0 -45
- package/src/lib/components/ui/toggle-group/toggle-group-item.svelte +0 -35
- package/src/lib/components/ui/toggle-group/toggle-group.svelte +0 -63
- package/src/lib/components/ui/tooltip/tooltip-content.svelte +0 -24
- package/src/lib/components/ui/tooltip/tooltip-trigger.svelte +0 -27
- package/src/lib/components/ui/tooltip/tooltip.svelte +0 -9
- package/src/lib/components/ui/trigger-button/trigger-button.svelte +0 -106
- package/src/svelte-plugin-ui/components/Icon.svelte +0 -181
- package/src/svelte-plugin-ui/components/ModeSwitch.svelte +0 -121
- package/src/svelte-plugin-ui/components/ToolbarShell.svelte +0 -150
- package/src/svelte-plugin-ui/components/Viewfinder.svelte +0 -1001
- package/src/tools/handlers/docs.js +0 -11
- package/src/workshop/features/createCanvas/CreateCanvasForm.svelte +0 -139
- package/src/workshop/features/createFlow/CreateFlowForm.svelte +0 -314
- package/src/workshop/features/createPage/CreatePageForm.svelte +0 -249
- package/src/workshop/features/createPrototype/CreatePrototypeForm.svelte +0 -287
- package/src/workshop/features/createStory/CreateStoryForm.svelte +0 -161
- package/src/workshop/ui/WorkshopPanel.svelte +0 -97
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_comment": "Client toolbar overrides. Deep-merged with core defaults. See @dfosco/storyboard-core/toolbar.config.json for all options. Tools use 'surface' to target where they render (
|
|
2
|
+
"_comment": "Client toolbar overrides. Deep-merged with core defaults. See @dfosco/storyboard-core/toolbar.config.json for all options. Tools use 'surface' to target where they render (command-toolbar, canvas-toolbar, command-palette) and 'handler' to reference their logic (core:name for built-in, custom:name for custom handlers).",
|
|
3
3
|
"tools": {}
|
|
4
4
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback } from 'react'
|
|
2
|
+
import { TriggerButton } from './lib/components/ui/trigger-button/index.js'
|
|
3
|
+
import * as DropdownMenu from './lib/components/ui/dropdown-menu/index.js'
|
|
4
|
+
import Icon from './svelte-plugin-ui/components/Icon.jsx'
|
|
5
|
+
import { getActionChildren, subscribeToCommandActions } from './commandActions.js'
|
|
6
|
+
|
|
7
|
+
export default function ActionMenuButton({ config = {}, data, localOnly, tabindex = -1 }) {
|
|
8
|
+
const [menuOpen, setMenuOpen] = useState(false)
|
|
9
|
+
const [actionsVersion, setActionsVersion] = useState(0)
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const unsub = subscribeToCommandActions(() => { setActionsVersion((v) => v + 1) })
|
|
13
|
+
return unsub
|
|
14
|
+
}, [])
|
|
15
|
+
|
|
16
|
+
const children = config.action ? getActionChildren(config.action) : []
|
|
17
|
+
const hasRadio = children.some((c) => c.type === 'radio')
|
|
18
|
+
const activeValue = children.find((c) => c.type === 'radio' && c.active)?.id || ''
|
|
19
|
+
|
|
20
|
+
const handleOpenChange = useCallback((open) => {
|
|
21
|
+
setMenuOpen(open)
|
|
22
|
+
if (open) setActionsVersion((v) => v + 1)
|
|
23
|
+
}, [])
|
|
24
|
+
|
|
25
|
+
if (children.length === 0) return null
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<DropdownMenu.Root open={menuOpen} onOpenChange={handleOpenChange}>
|
|
29
|
+
<DropdownMenu.Trigger>
|
|
30
|
+
<TriggerButton
|
|
31
|
+
active={menuOpen}
|
|
32
|
+
size="icon-xl"
|
|
33
|
+
aria-label={config.ariaLabel || config.label || 'Menu'}
|
|
34
|
+
tabIndex={tabindex}
|
|
35
|
+
>
|
|
36
|
+
<Icon name={config.icon || 'primer/gear'} size={16} {...(config.meta || {})} />
|
|
37
|
+
</TriggerButton>
|
|
38
|
+
</DropdownMenu.Trigger>
|
|
39
|
+
|
|
40
|
+
<DropdownMenu.Content
|
|
41
|
+
side="top"
|
|
42
|
+
align="end"
|
|
43
|
+
sideOffset={16}
|
|
44
|
+
style={config.menuWidth ? { minWidth: config.menuWidth } : undefined}
|
|
45
|
+
className={config.menuWidth ? '' : 'min-w-[200px]'}
|
|
46
|
+
>
|
|
47
|
+
{config.label && <DropdownMenu.Label>{config.label}</DropdownMenu.Label>}
|
|
48
|
+
|
|
49
|
+
{hasRadio ? (
|
|
50
|
+
<DropdownMenu.RadioGroup value={activeValue}>
|
|
51
|
+
{children.map((child) => {
|
|
52
|
+
if (child.type !== 'radio') return null
|
|
53
|
+
return (
|
|
54
|
+
<DropdownMenu.RadioItem
|
|
55
|
+
key={child.id || child.label}
|
|
56
|
+
value={child.id}
|
|
57
|
+
onClick={(e) => {
|
|
58
|
+
if (child.href && (e.metaKey || e.ctrlKey)) {
|
|
59
|
+
e.preventDefault(); window.open(child.href, '_blank'); setMenuOpen(false); return
|
|
60
|
+
}
|
|
61
|
+
if (child.execute) child.execute(); setMenuOpen(false)
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
{child.label}
|
|
65
|
+
</DropdownMenu.RadioItem>
|
|
66
|
+
)
|
|
67
|
+
})}
|
|
68
|
+
</DropdownMenu.RadioGroup>
|
|
69
|
+
) : (
|
|
70
|
+
children.map((child) => {
|
|
71
|
+
if (child.type === 'toggle') {
|
|
72
|
+
return (
|
|
73
|
+
<DropdownMenu.CheckboxItem
|
|
74
|
+
key={child.id || child.label}
|
|
75
|
+
checked={child.active}
|
|
76
|
+
onSelect={(e) => { e.preventDefault(); if (child.execute) child.execute(); setActionsVersion((v) => v + 1) }}
|
|
77
|
+
>
|
|
78
|
+
{child.label}
|
|
79
|
+
</DropdownMenu.CheckboxItem>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
return (
|
|
83
|
+
<DropdownMenu.Item
|
|
84
|
+
key={child.id || child.label}
|
|
85
|
+
onClick={(e) => {
|
|
86
|
+
if (child.href && (e.metaKey || e.ctrlKey)) {
|
|
87
|
+
e.preventDefault(); window.open(child.href, '_blank'); setMenuOpen(false); return
|
|
88
|
+
}
|
|
89
|
+
if (child.execute) child.execute(); setMenuOpen(false)
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
{child.label}
|
|
93
|
+
</DropdownMenu.Item>
|
|
94
|
+
)
|
|
95
|
+
})
|
|
96
|
+
)}
|
|
97
|
+
</DropdownMenu.Content>
|
|
98
|
+
</DropdownMenu.Root>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
.menuTitle {
|
|
2
|
+
font-size: 13px;
|
|
3
|
+
font-weight: 500;
|
|
4
|
+
color: var(--fgColor-default, #e6edf3);
|
|
5
|
+
padding: 6px 6px 0;
|
|
6
|
+
margin: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.description {
|
|
10
|
+
font-size: 12px;
|
|
11
|
+
color: var(--fgColor-muted, #848d97);
|
|
12
|
+
padding: 0 6px 4px;
|
|
13
|
+
margin: 0;
|
|
14
|
+
line-height: 1.4;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.branchRow {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
gap: 6px;
|
|
21
|
+
padding: 6px 6px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.branchLabel {
|
|
25
|
+
font-size: 13px;
|
|
26
|
+
font-weight: 500;
|
|
27
|
+
color: var(--fgColor-default, #e6edf3);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.statusRow {
|
|
31
|
+
padding: 4px 6px 2px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.scopeHint {
|
|
35
|
+
font-size: 11px;
|
|
36
|
+
color: var(--fgColor-muted, #848d97);
|
|
37
|
+
padding: 4px 0;
|
|
38
|
+
margin: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.statusError {
|
|
42
|
+
font-size: 11px;
|
|
43
|
+
color: var(--fgColor-danger, #f85149);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.statusOk {
|
|
47
|
+
font-size: 11px;
|
|
48
|
+
color: var(--fgColor-muted, #848d97);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.footer {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
gap: 6px;
|
|
55
|
+
font-size: 12px;
|
|
56
|
+
color: var(--fgColor-muted, #848d97);
|
|
57
|
+
padding: 2px 6px 0;
|
|
58
|
+
margin: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.footerDot {
|
|
62
|
+
width: 8px;
|
|
63
|
+
height: 8px;
|
|
64
|
+
background: hsl(212, 92%, 45%);
|
|
65
|
+
border-radius: 50%;
|
|
66
|
+
flex-shrink: 0;
|
|
67
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import './AutosyncMenuButton.css';
|
|
2
|
+
import { useState, useEffect, useRef, useCallback } from 'react'
|
|
3
|
+
import { TriggerButton } from './lib/components/ui/trigger-button/index.js'
|
|
4
|
+
import * as DropdownMenu from './lib/components/ui/dropdown-menu/index.js'
|
|
5
|
+
import Icon from './svelte-plugin-ui/components/Icon.jsx'
|
|
6
|
+
import BranchSelect from './BranchSelect.jsx'
|
|
7
|
+
|
|
8
|
+
export default function AutosyncMenuButton({ config = {}, basePath = '/', tabindex = -1 }) {
|
|
9
|
+
const apiBase = (basePath === '/' ? '' : basePath.replace(/\/$/, '')) + '/_storyboard/autosync'
|
|
10
|
+
|
|
11
|
+
const [menuOpen, setMenuOpen] = useState(false)
|
|
12
|
+
const [branches, setBranches] = useState([])
|
|
13
|
+
const [currentBranch, setCurrentBranch] = useState('')
|
|
14
|
+
const [selectedBranch, setSelectedBranch] = useState('')
|
|
15
|
+
const [enabledScopes, setEnabledScopes] = useState({ canvas: false, prototype: false })
|
|
16
|
+
const [lastSyncTime, setLastSyncTime] = useState(null)
|
|
17
|
+
const [lastError, setLastError] = useState(null)
|
|
18
|
+
const [lastErrorByScope, setLastErrorByScope] = useState({ canvas: null, prototype: null })
|
|
19
|
+
const [syncing, setSyncing] = useState(false)
|
|
20
|
+
const [syncingScope, setSyncingScope] = useState(null)
|
|
21
|
+
const [loading, setLoading] = useState(false)
|
|
22
|
+
|
|
23
|
+
const pollRef = useRef(null)
|
|
24
|
+
const enabledScopesRef = useRef(enabledScopes)
|
|
25
|
+
enabledScopesRef.current = enabledScopes
|
|
26
|
+
|
|
27
|
+
function isProtectedBranch(name) {
|
|
28
|
+
const normalized = String(name || '').toLowerCase()
|
|
29
|
+
return normalized === 'main' || normalized === 'master'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function hasEnabled(scopes) {
|
|
33
|
+
return scopes?.canvas || scopes?.prototype
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const applyStatus = useCallback((data) => {
|
|
37
|
+
const incomingScopes = data.enabledScopes
|
|
38
|
+
let newScopes
|
|
39
|
+
if (incomingScopes && typeof incomingScopes === 'object') {
|
|
40
|
+
newScopes = { canvas: incomingScopes.canvas === true, prototype: incomingScopes.prototype === true }
|
|
41
|
+
} else {
|
|
42
|
+
newScopes = {
|
|
43
|
+
canvas: data.enabled === true && data.scope === 'canvas',
|
|
44
|
+
prototype: data.enabled === true && data.scope === 'prototype',
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
setEnabledScopes(newScopes)
|
|
48
|
+
|
|
49
|
+
if (data.branch) setCurrentBranch(data.branch)
|
|
50
|
+
if (data.targetBranch) setSelectedBranch(data.targetBranch)
|
|
51
|
+
setLastSyncTime(data.lastSyncTime || null)
|
|
52
|
+
setLastError(data.lastError || null)
|
|
53
|
+
setSyncing(data.syncing === true)
|
|
54
|
+
setSyncingScope(
|
|
55
|
+
data.syncingScope === 'prototype' || data.syncingScope === 'canvas' ? data.syncingScope : null,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
const incomingErrorByScope = data.lastErrorByScope
|
|
59
|
+
if (incomingErrorByScope && typeof incomingErrorByScope === 'object') {
|
|
60
|
+
setLastErrorByScope({ canvas: incomingErrorByScope.canvas || null, prototype: incomingErrorByScope.prototype || null })
|
|
61
|
+
}
|
|
62
|
+
}, [])
|
|
63
|
+
|
|
64
|
+
const fetchStatus = useCallback(async () => {
|
|
65
|
+
try {
|
|
66
|
+
const res = await fetch(`${apiBase}/status`)
|
|
67
|
+
const data = await res.json()
|
|
68
|
+
applyStatus(data)
|
|
69
|
+
} catch { /* ignore */ }
|
|
70
|
+
}, [apiBase, applyStatus])
|
|
71
|
+
|
|
72
|
+
function startPolling() {
|
|
73
|
+
if (pollRef.current) return
|
|
74
|
+
pollRef.current = setInterval(fetchStatus, 5000)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function stopPolling() {
|
|
78
|
+
if (pollRef.current) { clearInterval(pollRef.current); pollRef.current = null }
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async function fetchBranches() {
|
|
82
|
+
try {
|
|
83
|
+
const res = await fetch(`${apiBase}/branches`)
|
|
84
|
+
const data = await res.json()
|
|
85
|
+
const branchList = data.branches || []
|
|
86
|
+
const current = data.current || ''
|
|
87
|
+
setBranches(branchList)
|
|
88
|
+
setCurrentBranch(current)
|
|
89
|
+
setSelectedBranch((prev) => {
|
|
90
|
+
if (!prev || isProtectedBranch(prev) || !branchList.includes(prev)) {
|
|
91
|
+
return branchList.includes(current) ? current : (branchList[0] || '')
|
|
92
|
+
}
|
|
93
|
+
return prev
|
|
94
|
+
})
|
|
95
|
+
} catch { /* ignore */ }
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async function setAutosyncScope(scope, shouldEnable, e) {
|
|
99
|
+
e.preventDefault()
|
|
100
|
+
setLoading(true)
|
|
101
|
+
setLastError(null)
|
|
102
|
+
try {
|
|
103
|
+
if (shouldEnable && !selectedBranch) {
|
|
104
|
+
setLastError('Select a non-main branch first')
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
const res = await fetch(
|
|
108
|
+
shouldEnable ? `${apiBase}/enable` : `${apiBase}/disable`,
|
|
109
|
+
{
|
|
110
|
+
method: 'POST',
|
|
111
|
+
headers: { 'Content-Type': 'application/json' },
|
|
112
|
+
body: JSON.stringify(shouldEnable ? { branch: selectedBranch, scope } : { scope }),
|
|
113
|
+
},
|
|
114
|
+
)
|
|
115
|
+
const data = await res.json()
|
|
116
|
+
if (!res.ok) {
|
|
117
|
+
setLastError(data.error || (shouldEnable ? 'Failed to enable' : 'Failed to disable'))
|
|
118
|
+
} else {
|
|
119
|
+
applyStatus(data)
|
|
120
|
+
}
|
|
121
|
+
} catch (err) {
|
|
122
|
+
setLastError(err.message || 'Request failed')
|
|
123
|
+
} finally {
|
|
124
|
+
setLoading(false)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const branchSelectRef = useRef(null)
|
|
129
|
+
|
|
130
|
+
function handleOpenChange(open) {
|
|
131
|
+
setMenuOpen(open)
|
|
132
|
+
if (open) {
|
|
133
|
+
fetchBranches()
|
|
134
|
+
fetchStatus()
|
|
135
|
+
startPolling()
|
|
136
|
+
// Focus the branch selector after the menu mounts
|
|
137
|
+
requestAnimationFrame(() => branchSelectRef.current?.focus())
|
|
138
|
+
} else if (!hasEnabled(enabledScopesRef.current)) {
|
|
139
|
+
stopPolling()
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Allow command palette to open this menu via custom event
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
const open = () => handleOpenChange(true)
|
|
146
|
+
document.addEventListener('storyboard:open-autosync', open)
|
|
147
|
+
return () => document.removeEventListener('storyboard:open-autosync', open)
|
|
148
|
+
}, [])
|
|
149
|
+
|
|
150
|
+
function formatSyncTime(iso) {
|
|
151
|
+
if (!iso) return ''
|
|
152
|
+
try {
|
|
153
|
+
return new Date(iso).toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit', hour12: true })
|
|
154
|
+
} catch { return iso }
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
fetchStatus()
|
|
159
|
+
return () => stopPolling()
|
|
160
|
+
}, [fetchStatus])
|
|
161
|
+
|
|
162
|
+
const isScopeEnabled = (target) => enabledScopes[target] === true
|
|
163
|
+
const showStatus = hasEnabled(enabledScopes) || lastError || lastSyncTime || lastErrorByScope.canvas || lastErrorByScope.prototype
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<DropdownMenu.Root open={menuOpen} onOpenChange={handleOpenChange}>
|
|
167
|
+
<DropdownMenu.Trigger>
|
|
168
|
+
<TriggerButton
|
|
169
|
+
active={menuOpen || hasEnabled(enabledScopes)}
|
|
170
|
+
size="icon-xl"
|
|
171
|
+
aria-label={config.ariaLabel || 'Autosync'}
|
|
172
|
+
tabIndex={tabindex}
|
|
173
|
+
>
|
|
174
|
+
<Icon name={config.icon || 'primer/sync'} size={16} {...(config.meta || {})} />
|
|
175
|
+
</TriggerButton>
|
|
176
|
+
</DropdownMenu.Trigger>
|
|
177
|
+
|
|
178
|
+
<DropdownMenu.Content
|
|
179
|
+
side="top"
|
|
180
|
+
align="end"
|
|
181
|
+
sideOffset={16}
|
|
182
|
+
style={config.menuWidth ? { minWidth: config.menuWidth } : undefined}
|
|
183
|
+
className="min-w-[280px]"
|
|
184
|
+
>
|
|
185
|
+
<p className="menuTitle">{config.label || 'Autosync'}</p>
|
|
186
|
+
<p className="description">Automatically commit and push changes every 30s</p>
|
|
187
|
+
|
|
188
|
+
<DropdownMenu.Separator />
|
|
189
|
+
|
|
190
|
+
{/* Branch selector */}
|
|
191
|
+
<div className="branchRow">
|
|
192
|
+
<label className="branchLabel" htmlFor="autosync-branch">Branch</label>
|
|
193
|
+
<BranchSelect
|
|
194
|
+
id="autosync-branch"
|
|
195
|
+
ref={branchSelectRef}
|
|
196
|
+
branches={branches}
|
|
197
|
+
value={selectedBranch}
|
|
198
|
+
onChange={(e) => setSelectedBranch(e.target.value)}
|
|
199
|
+
disabled={hasEnabled(enabledScopes) || loading}
|
|
200
|
+
placeholder="No non-main branches available"
|
|
201
|
+
/>
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
<DropdownMenu.Separator />
|
|
205
|
+
|
|
206
|
+
<DropdownMenu.CheckboxItem
|
|
207
|
+
checked={isScopeEnabled('canvas')}
|
|
208
|
+
onSelect={(e) => setAutosyncScope('canvas', !isScopeEnabled('canvas'), e)}
|
|
209
|
+
disabled={loading || (!isScopeEnabled('canvas') && !selectedBranch)}
|
|
210
|
+
>
|
|
211
|
+
{isScopeEnabled('canvas') ? 'Disable autosync for canvas changes' : 'Enable autosync for canvas changes'}
|
|
212
|
+
</DropdownMenu.CheckboxItem>
|
|
213
|
+
<DropdownMenu.CheckboxItem
|
|
214
|
+
checked={isScopeEnabled('prototype')}
|
|
215
|
+
onSelect={(e) => setAutosyncScope('prototype', !isScopeEnabled('prototype'), e)}
|
|
216
|
+
disabled={loading || (!isScopeEnabled('prototype') && !selectedBranch)}
|
|
217
|
+
>
|
|
218
|
+
{isScopeEnabled('prototype') ? 'Disable autosync for prototype changes' : 'Enable autosync for prototype changes'}
|
|
219
|
+
</DropdownMenu.CheckboxItem>
|
|
220
|
+
|
|
221
|
+
{showStatus && (
|
|
222
|
+
<>
|
|
223
|
+
<DropdownMenu.Separator />
|
|
224
|
+
<div className="statusRow">
|
|
225
|
+
{syncing && syncingScope && (
|
|
226
|
+
<p className="scopeHint">Syncing <strong>{syncingScope}</strong> changes</p>
|
|
227
|
+
)}
|
|
228
|
+
{lastError && <span className="statusError">⚠ {lastError}</span>}
|
|
229
|
+
{lastErrorByScope.canvas && <span className="statusError">⚠ Canvas: {lastErrorByScope.canvas}</span>}
|
|
230
|
+
{lastErrorByScope.prototype && <span className="statusError">⚠ Prototype: {lastErrorByScope.prototype}</span>}
|
|
231
|
+
{!syncing && lastSyncTime && <span className="statusOk">Last sync: {formatSyncTime(lastSyncTime)}</span>}
|
|
232
|
+
</div>
|
|
233
|
+
</>
|
|
234
|
+
)}
|
|
235
|
+
|
|
236
|
+
<DropdownMenu.Separator />
|
|
237
|
+
<p className="footer"><span className="footerDot" /> Only available in dev environment</p>
|
|
238
|
+
</DropdownMenu.Content>
|
|
239
|
+
</DropdownMenu.Root>
|
|
240
|
+
)
|
|
241
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import css from './BranchSelect.module.css'
|
|
2
|
+
|
|
3
|
+
export default function BranchSelect({
|
|
4
|
+
branches = [],
|
|
5
|
+
value,
|
|
6
|
+
onChange,
|
|
7
|
+
disabled,
|
|
8
|
+
id,
|
|
9
|
+
placeholder,
|
|
10
|
+
ref,
|
|
11
|
+
}) {
|
|
12
|
+
return (
|
|
13
|
+
<select
|
|
14
|
+
ref={ref}
|
|
15
|
+
id={id}
|
|
16
|
+
className={css.select}
|
|
17
|
+
value={value}
|
|
18
|
+
onChange={onChange}
|
|
19
|
+
disabled={disabled}
|
|
20
|
+
>
|
|
21
|
+
{branches.length === 0 && (
|
|
22
|
+
<option value="" disabled>{placeholder || 'No branches available'}</option>
|
|
23
|
+
)}
|
|
24
|
+
{branches.map((branch) => (
|
|
25
|
+
<option key={branch} value={branch}>{branch}</option>
|
|
26
|
+
))}
|
|
27
|
+
</select>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.select {
|
|
2
|
+
width: 100%;
|
|
3
|
+
appearance: none;
|
|
4
|
+
background-color: var(--bgColor-default, #0d1117);
|
|
5
|
+
color: var(--fgColor-default, #e6edf3);
|
|
6
|
+
border: 1px solid var(--borderColor-default, #30363d);
|
|
7
|
+
border-radius: 8px;
|
|
8
|
+
padding: 8px 32px 8px 12px;
|
|
9
|
+
font-size: 13px;
|
|
10
|
+
font-family: inherit;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23848d97'%3E%3Cpath d='M6 8.5L1.5 4h9L6 8.5z'/%3E%3C/svg%3E");
|
|
13
|
+
background-repeat: no-repeat;
|
|
14
|
+
background-position: right 10px center;
|
|
15
|
+
transition: border-color 0.15s ease;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.select:hover:not(:disabled) {
|
|
19
|
+
border-color: var(--fgColor-muted, #848d97);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.select:focus-visible {
|
|
23
|
+
outline: 2px solid var(--borderColor-accent-emphasis, #1f6feb);
|
|
24
|
+
outline-offset: -1px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.select:disabled {
|
|
28
|
+
opacity: 0.5;
|
|
29
|
+
cursor: not-allowed;
|
|
30
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CanvasAgentsMenu — CoreUIBar dropdown for adding agent widgets to the active canvas.
|
|
3
|
+
* Reads agent definitions from canvas.agents config and dispatches add-widget events.
|
|
4
|
+
* Only visible when a canvas page is active and agents are configured.
|
|
5
|
+
*/
|
|
6
|
+
import { useState, useMemo } from 'react'
|
|
7
|
+
import { TriggerButton } from './lib/components/ui/trigger-button/index.js'
|
|
8
|
+
import * as DropdownMenu from './lib/components/ui/dropdown-menu/index.js'
|
|
9
|
+
import Icon from './svelte-plugin-ui/components/Icon.jsx'
|
|
10
|
+
import { getConfig } from './configStore.js'
|
|
11
|
+
|
|
12
|
+
export default function CanvasAgentsMenu({ config = {}, data, canvasName = '', zoom, tabindex }) {
|
|
13
|
+
const [menuOpen, setMenuOpen] = useState(false)
|
|
14
|
+
|
|
15
|
+
const agents = useMemo(() => {
|
|
16
|
+
const canvasConfig = getConfig('canvas')
|
|
17
|
+
const agentsConfig = canvasConfig?.agents
|
|
18
|
+
if (!agentsConfig || typeof agentsConfig !== 'object') return []
|
|
19
|
+
return Object.entries(agentsConfig).map(([id, cfg]) => ({
|
|
20
|
+
id,
|
|
21
|
+
label: cfg.label || id,
|
|
22
|
+
icon: cfg.icon,
|
|
23
|
+
startupCommand: cfg.startupCommand || id,
|
|
24
|
+
defaultWidth: cfg.defaultWidth,
|
|
25
|
+
defaultHeight: cfg.defaultHeight,
|
|
26
|
+
}))
|
|
27
|
+
}, [])
|
|
28
|
+
|
|
29
|
+
function addAgent(agent) {
|
|
30
|
+
document.dispatchEvent(new CustomEvent('storyboard:canvas:add-widget', {
|
|
31
|
+
detail: {
|
|
32
|
+
type: 'agent',
|
|
33
|
+
canvasName,
|
|
34
|
+
props: {
|
|
35
|
+
agentId: agent.id,
|
|
36
|
+
startupCommand: agent.startupCommand,
|
|
37
|
+
...(agent.defaultWidth ? { width: agent.defaultWidth } : {}),
|
|
38
|
+
...(agent.defaultHeight ? { height: agent.defaultHeight } : {}),
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
}))
|
|
42
|
+
setMenuOpen(false)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (agents.length === 0) return null
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<DropdownMenu.Root open={menuOpen} onOpenChange={setMenuOpen}>
|
|
49
|
+
<DropdownMenu.Trigger asChild>
|
|
50
|
+
<TriggerButton
|
|
51
|
+
active={menuOpen}
|
|
52
|
+
size="icon-xl"
|
|
53
|
+
aria-label={config.ariaLabel || 'Add agent'}
|
|
54
|
+
tabIndex={tabindex}
|
|
55
|
+
>
|
|
56
|
+
{config.icon ? (
|
|
57
|
+
<Icon name={config.icon} size={16} {...(config.meta || {})} />
|
|
58
|
+
) : (
|
|
59
|
+
<Icon name="agents" size={16} />
|
|
60
|
+
)}
|
|
61
|
+
</TriggerButton>
|
|
62
|
+
</DropdownMenu.Trigger>
|
|
63
|
+
|
|
64
|
+
<DropdownMenu.Content
|
|
65
|
+
side="top"
|
|
66
|
+
align="start"
|
|
67
|
+
sideOffset={16}
|
|
68
|
+
className="min-w-[180px]"
|
|
69
|
+
>
|
|
70
|
+
<DropdownMenu.Label>Add agent</DropdownMenu.Label>
|
|
71
|
+
{agents.map((agent) => (
|
|
72
|
+
<DropdownMenu.Item key={agent.id} onClick={() => addAgent(agent)}>
|
|
73
|
+
<span style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
74
|
+
<Icon name={agent.icon || 'agents'} size={16} />
|
|
75
|
+
{agent.label}
|
|
76
|
+
</span>
|
|
77
|
+
</DropdownMenu.Item>
|
|
78
|
+
))}
|
|
79
|
+
<DropdownMenu.Separator />
|
|
80
|
+
<div className="px-2 py-1.5 text-xs text-muted-foreground flex flex-row items-baseline">
|
|
81
|
+
<span className="inline-flex w-2 h-2 rounded-full mr-1.5" style={{ background: 'hsl(212, 92%, 45%)' }}></span>
|
|
82
|
+
Only available in dev environment
|
|
83
|
+
</div>
|
|
84
|
+
</DropdownMenu.Content>
|
|
85
|
+
</DropdownMenu.Root>
|
|
86
|
+
)
|
|
87
|
+
}
|