@dfosco/storyboard-core 3.3.0 → 3.3.1
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/dist/storyboard-ui.js +4982 -4976
- package/dist/storyboard-ui.js.map +1 -1
- package/package.json +1 -1
- package/src/CoreUIBar.svelte +7 -7
- package/src/devtools-consumer.js +28 -0
- package/src/index.js +3 -1
- package/src/inspector/highlighter.js +28 -16
package/package.json
CHANGED
package/src/CoreUIBar.svelte
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
let canvasActive = $state(false)
|
|
49
49
|
let activeCanvasName = $state('')
|
|
50
50
|
let canvasZoom = $state(100)
|
|
51
|
-
const canvasToolbarConfig = (config as any).canvasToolbar || {}
|
|
51
|
+
const canvasToolbarConfig = $derived((config as any).canvasToolbar || {})
|
|
52
52
|
|
|
53
53
|
const ZOOM_STEP = 10
|
|
54
54
|
const ZOOM_MIN = 25
|
|
@@ -57,18 +57,18 @@
|
|
|
57
57
|
// Roving tabindex: only one button in the toolbar is tabbable at a time
|
|
58
58
|
let activeToolbarIndex = $state(-1)
|
|
59
59
|
|
|
60
|
-
const commandMenuConfig = isMenuHidden('command') ? null : config.menus?.command
|
|
61
|
-
const shortcutsConfig = (config as any).shortcuts || {}
|
|
60
|
+
const commandMenuConfig = $derived(isMenuHidden('command') ? null : config.menus?.command)
|
|
61
|
+
const shortcutsConfig = $derived((config as any).shortcuts || {})
|
|
62
62
|
|
|
63
63
|
// Build ordered menu list from JSON key order (excluding command, which is always rightmost)
|
|
64
|
-
const allMenus = (config.menus || {}) as Record<string, any>
|
|
65
|
-
const orderedMenus = Object.entries(allMenus)
|
|
64
|
+
const allMenus = $derived((config.menus || {}) as Record<string, any>)
|
|
65
|
+
const orderedMenus = $derived(Object.entries(allMenus)
|
|
66
66
|
.filter(([key]) => key !== 'command')
|
|
67
67
|
.filter(([key]) => !isMenuHidden(key))
|
|
68
|
-
.map(([key, menu]) => ({ key, ...menu }))
|
|
68
|
+
.map(([key, menu]) => ({ key, ...menu })))
|
|
69
69
|
|
|
70
70
|
// Discover menus with sidepanel property
|
|
71
|
-
const sidepanelMenus = orderedMenus.filter(menu => menu.sidepanel)
|
|
71
|
+
const sidepanelMenus = $derived(orderedMenus.filter(menu => menu.sidepanel))
|
|
72
72
|
|
|
73
73
|
function menuVisibleInMode(menu: any, mode: string): boolean {
|
|
74
74
|
if (!menu?.modes) return false
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consumer-safe proxy for mountDevTools.
|
|
3
|
+
*
|
|
4
|
+
* Delegates to the compiled UI bundle (@dfosco/storyboard-core/ui-runtime)
|
|
5
|
+
* so consumers don't need svelte installed. The real mountDevTools in
|
|
6
|
+
* devtools.js imports svelte directly and is only usable in the source repo
|
|
7
|
+
* or via the compiled UI bundle.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export async function mountDevTools(options = {}) {
|
|
11
|
+
const ui = await import('@dfosco/storyboard-core/ui-runtime')
|
|
12
|
+
return ui.mountDevTools(options)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function unmountDevTools() {
|
|
16
|
+
const ui = await import('@dfosco/storyboard-core/ui-runtime')
|
|
17
|
+
return ui.unmountDevTools()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** @deprecated Use mountDevTools instead. */
|
|
21
|
+
export function mountFlowDebug(options = {}) {
|
|
22
|
+
return mountDevTools(options)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** @deprecated Use mountDevTools instead. */
|
|
26
|
+
export function mountSceneDebug(options = {}) {
|
|
27
|
+
return mountDevTools(options)
|
|
28
|
+
}
|
package/src/index.js
CHANGED
|
@@ -49,7 +49,9 @@ export { registerMode, unregisterMode, getRegisteredModes, getCurrentMode, activ
|
|
|
49
49
|
export { initTools, setToolAction, setToolState, getToolState, getToolsForMode, subscribeToTools, getToolsSnapshot } from './modes.js'
|
|
50
50
|
|
|
51
51
|
// Dev tools (vanilla JS, framework-agnostic)
|
|
52
|
-
|
|
52
|
+
// mountDevTools delegates to the compiled UI bundle so consumers
|
|
53
|
+
// don't need svelte installed — svelte is bundled into ui-runtime.
|
|
54
|
+
export { mountDevTools } from './devtools-consumer.js'
|
|
53
55
|
export { mountFlowDebug } from './sceneDebug.js'
|
|
54
56
|
// Deprecated alias
|
|
55
57
|
export { mountSceneDebug } from './sceneDebug.js'
|
|
@@ -4,23 +4,35 @@
|
|
|
4
4
|
* Uses shiki/core with only the four languages the inspector needs,
|
|
5
5
|
* avoiding the full shiki bundle that registers 200+ lazy-loaded
|
|
6
6
|
* language chunks (which break in deployed/static environments).
|
|
7
|
+
*
|
|
8
|
+
* Each import() has .catch() so consumer bundlers (esbuild dep optimizer)
|
|
9
|
+
* treat them as runtime-fallible and don't fail at build time when shiki
|
|
10
|
+
* isn't installed. Returns null when shiki is unavailable.
|
|
7
11
|
*/
|
|
8
12
|
export async function createInspectorHighlighter() {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
try {
|
|
14
|
+
const [shikiCore, oniguruma, tsx, jsx, javascript, typescript, githubDark, wasm] =
|
|
15
|
+
await Promise.all([
|
|
16
|
+
import('shiki/core').catch(() => null),
|
|
17
|
+
import('shiki/engine/oniguruma').catch(() => null),
|
|
18
|
+
import('shiki/dist/langs/tsx.mjs').catch(() => null),
|
|
19
|
+
import('shiki/dist/langs/jsx.mjs').catch(() => null),
|
|
20
|
+
import('shiki/dist/langs/javascript.mjs').catch(() => null),
|
|
21
|
+
import('shiki/dist/langs/typescript.mjs').catch(() => null),
|
|
22
|
+
import('shiki/dist/themes/github-dark.mjs').catch(() => null),
|
|
23
|
+
import('shiki/wasm').catch(() => null),
|
|
24
|
+
])
|
|
25
|
+
|
|
26
|
+
if (!shikiCore || !oniguruma || !tsx || !jsx || !javascript || !typescript || !githubDark || !wasm) {
|
|
27
|
+
return null
|
|
28
|
+
}
|
|
20
29
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
return shikiCore.createHighlighterCore({
|
|
31
|
+
themes: [githubDark.default],
|
|
32
|
+
langs: [tsx.default, jsx.default, javascript.default, typescript.default],
|
|
33
|
+
engine: oniguruma.createOnigurumaEngine(wasm),
|
|
34
|
+
})
|
|
35
|
+
} catch {
|
|
36
|
+
return null
|
|
37
|
+
}
|
|
26
38
|
}
|