@dfosco/storyboard-react 3.3.1 → 3.4.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 +2 -2
- package/src/canvas/CanvasPage.jsx +3 -2
- package/src/vite/data-plugin.js +26 -0
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dfosco/storyboard-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dfosco/storyboard-core": "3.
|
|
6
|
+
"@dfosco/storyboard-core": "3.4.0",
|
|
7
7
|
"@dfosco/tiny-canvas": "^1.1.0",
|
|
8
8
|
"@neodrag/react": "^2.3.1",
|
|
9
9
|
"glob": "^11.0.0",
|
|
@@ -283,15 +283,16 @@ export default function CanvasPage({ name }) {
|
|
|
283
283
|
|
|
284
284
|
useEffect(() => {
|
|
285
285
|
function handleKeyDown(e) {
|
|
286
|
-
if (e.key === ' '
|
|
286
|
+
if (e.key === ' ') {
|
|
287
287
|
const tag = e.target.tagName
|
|
288
288
|
if (tag === 'INPUT' || tag === 'TEXTAREA' || e.target.isContentEditable) return
|
|
289
289
|
e.preventDefault()
|
|
290
|
-
setSpaceHeld(true)
|
|
290
|
+
if (!e.repeat) setSpaceHeld(true)
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
function handleKeyUp(e) {
|
|
294
294
|
if (e.key === ' ') {
|
|
295
|
+
e.preventDefault()
|
|
295
296
|
setSpaceHeld(false)
|
|
296
297
|
isPanning.current = false
|
|
297
298
|
setPanningActive(false)
|
package/src/vite/data-plugin.js
CHANGED
|
@@ -369,6 +369,21 @@ function generateModule({ index, protoFolders, flowRoutes, canvasRoutes }, root)
|
|
|
369
369
|
parsed = { ...parsed, folder: protoFolders[name] }
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
+
// Load toolbar.config.json from prototype directory if present
|
|
373
|
+
if (suffix === 'prototype') {
|
|
374
|
+
const protoDir = path.dirname(absPath)
|
|
375
|
+
const toolbarConfigPath = path.join(protoDir, 'toolbar.config.json')
|
|
376
|
+
if (fs.existsSync(toolbarConfigPath)) {
|
|
377
|
+
try {
|
|
378
|
+
const toolbarRaw = fs.readFileSync(toolbarConfigPath, 'utf-8')
|
|
379
|
+
const toolbarConfig = parseJsonc(toolbarRaw)
|
|
380
|
+
if (toolbarConfig) {
|
|
381
|
+
parsed = { ...parsed, toolbarConfig }
|
|
382
|
+
}
|
|
383
|
+
} catch { /* skip invalid toolbar config */ }
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
372
387
|
// Inject inferred _route into flow data (explicit route takes precedence)
|
|
373
388
|
if (suffix === 'flow' && flowRoutes[name] && !parsed?.route) {
|
|
374
389
|
parsed = { ...parsed, _route: flowRoutes[name] }
|
|
@@ -566,6 +581,17 @@ export default function storyboardDataPlugin() {
|
|
|
566
581
|
// a feedback loop (save → file change → reload → lose editing state).
|
|
567
582
|
if (/\.canvas\.jsonl$/.test(normalized)) return
|
|
568
583
|
|
|
584
|
+
// Invalidate when toolbar.config.json inside a prototype changes
|
|
585
|
+
if (normalized.endsWith('/toolbar.config.json') && normalized.includes('/prototypes/')) {
|
|
586
|
+
buildResult = null
|
|
587
|
+
const mod = server.moduleGraph.getModuleById(RESOLVED_ID)
|
|
588
|
+
if (mod) {
|
|
589
|
+
server.moduleGraph.invalidateModule(mod)
|
|
590
|
+
server.ws.send({ type: 'full-reload' })
|
|
591
|
+
}
|
|
592
|
+
return
|
|
593
|
+
}
|
|
594
|
+
|
|
569
595
|
const parsed = parseDataFile(filePath)
|
|
570
596
|
// Also invalidate when files are added/removed inside .folder/ directories
|
|
571
597
|
const inFolder = normalized.includes('.folder/')
|