@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dfosco/storyboard-core",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -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
- export { mountDevTools } from './devtools.js'
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
- const [{ createHighlighterCore }, { createOnigurumaEngine }, tsx, jsx, javascript, typescript, githubDark, wasm] =
10
- await Promise.all([
11
- import('shiki/core'),
12
- import('shiki/engine/oniguruma'),
13
- import('shiki/dist/langs/tsx.mjs'),
14
- import('shiki/dist/langs/jsx.mjs'),
15
- import('shiki/dist/langs/javascript.mjs'),
16
- import('shiki/dist/langs/typescript.mjs'),
17
- import('shiki/dist/themes/github-dark.mjs'),
18
- import('shiki/wasm'),
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
- return createHighlighterCore({
22
- themes: [githubDark.default],
23
- langs: [tsx.default, jsx.default, javascript.default, typescript.default],
24
- engine: createOnigurumaEngine(wasm),
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
  }