@dfosco/storyboard-core 1.19.0 → 1.20.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dfosco/storyboard-core",
3
- "version": "1.19.0",
3
+ "version": "1.20.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/devtools.js CHANGED
@@ -17,7 +17,7 @@ import { loadScene } from './loader.js'
17
17
  import { isCommentsEnabled } from './comments/config.js'
18
18
  import { isHideMode, activateHideMode, deactivateHideMode } from './hideMode.js'
19
19
  import { getAllFlags, toggleFlag, getFlagKeys } from './featureFlags.js'
20
- import { isPluginEnabled } from './plugins.js'
20
+ import { isPluginEnabled, initPlugins } from './plugins.js'
21
21
 
22
22
  const STYLES = `
23
23
  .sb-devtools-wrapper {
@@ -190,8 +190,13 @@ function getSceneName() {
190
190
  *
191
191
  * @param {object} [options]
192
192
  * @param {HTMLElement} [options.container=document.body] - Where to mount
193
+ * @param {Record<string, boolean>} [options.plugins] - Plugin config from storyboard.config.json
193
194
  */
194
195
  export function mountDevTools(options = {}) {
196
+ // Allow callers to pass plugins config directly (avoids timing issues
197
+ // where mountDevTools runs before the Vite virtual module calls initPlugins)
198
+ if (options.plugins) initPlugins(options.plugins)
199
+
195
200
  // Skip when devtools plugin is disabled via storyboard.config.json
196
201
  if (!isPluginEnabled('devtools')) return
197
202
 
@@ -97,4 +97,11 @@ describe('mountDevTools', () => {
97
97
  const wrapper = document.body.querySelector('.sb-devtools-wrapper')
98
98
  expect(wrapper).not.toBeNull()
99
99
  })
100
+
101
+ it('does not mount when plugins option disables devtools', () => {
102
+ mountDevTools({ plugins: { devtools: false } })
103
+
104
+ const wrapper = document.body.querySelector('.sb-devtools-wrapper')
105
+ expect(wrapper).toBeNull()
106
+ })
100
107
  })