@dfosco/storyboard 0.6.12 → 0.6.13
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.css +1 -1
- package/dist/tailwind.css +1 -1
- package/package.json +6 -2
- package/src/core/canvas/materializer.js +39 -13
- package/src/core/canvas/server.js +245 -46
- package/src/core/canvas/server.test.js +226 -0
- package/src/core/canvas/undoRedo.js +174 -0
- package/src/core/canvas/undoRedo.test.js +250 -0
- package/src/core/cli/canvasRedo.js +44 -0
- package/src/core/cli/canvasUndo.js +40 -0
- package/src/core/cli/dev.js +5 -10
- package/src/core/cli/index.js +6 -0
- package/src/internals/canvas/CanvasPage.jsx +247 -124
- package/src/internals/canvas/CanvasPage.multiselect.test.jsx +39 -26
- package/src/internals/canvas/canvasApi.js +29 -0
- package/src/internals/canvas/prototypeRoutes.jsx +131 -0
- package/src/internals/canvas/prototypesEntry.jsx +66 -0
- package/src/internals/canvas/useUndoRedo.js +75 -60
- package/src/internals/canvas/useUndoRedo.test.js +46 -178
- package/src/internals/vite/data-plugin.js +72 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* storyboard canvas undo — append the inverse of a previously-applied event.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* storyboard canvas undo --canvas my-canvas --event evt_xxx
|
|
6
|
+
*
|
|
7
|
+
* Flags:
|
|
8
|
+
* -c, --canvas Canvas name (required)
|
|
9
|
+
* -e, --event Event ID to undo (required)
|
|
10
|
+
* --json Output as JSON
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { post, parseSimpleArgs, jsonOut, die } from './cliHelpers.js'
|
|
14
|
+
|
|
15
|
+
const args = process.argv.slice(4) // skip: node, sb, canvas, undo
|
|
16
|
+
|
|
17
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
18
|
+
console.log(`
|
|
19
|
+
canvas undo flags:
|
|
20
|
+
|
|
21
|
+
-c, --canvas Canvas name (required)
|
|
22
|
+
-e, --event Event ID to undo (required)
|
|
23
|
+
--json Output as JSON
|
|
24
|
+
`)
|
|
25
|
+
process.exit(0)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { flags } = parseSimpleArgs(args)
|
|
29
|
+
const canvas = flags.canvas || flags.c
|
|
30
|
+
const eventId = flags.event || flags.e
|
|
31
|
+
|
|
32
|
+
if (!canvas) die('--canvas is required')
|
|
33
|
+
if (!eventId) die('--event is required')
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
const result = await post('/_storyboard/canvas/undo', { name: canvas, eventId })
|
|
37
|
+
if (flags.json) { jsonOut(result) } else {
|
|
38
|
+
console.log(`Undid event ${eventId} → appended ${result.eventId} (${result.inverseEvent?.event})`)
|
|
39
|
+
}
|
|
40
|
+
} catch (err) { die(err.message) }
|
package/src/core/cli/dev.js
CHANGED
|
@@ -256,14 +256,11 @@ async function main() {
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
const renameWatcher = startRenameWatcher(targetCwd)
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
} catch { /* non-critical */ }
|
|
266
|
-
}, 15 * 60 * 1000)
|
|
259
|
+
// Note: no background compaction timer — the previous 15-min interval
|
|
260
|
+
// would silently wipe per-tab undo history mid-session. Files are now
|
|
261
|
+
// compacted on dev startup (above) and via a 2 MB hard-ceiling check
|
|
262
|
+
// inside the canvas server's appendEvent (kicks in only for runaway
|
|
263
|
+
// sessions that genuinely need it).
|
|
267
264
|
|
|
268
265
|
const npmBin = process.platform === 'win32' ? 'npx.cmd' : 'npx'
|
|
269
266
|
const viteArgs = ['vite', '--port', String(port)]
|
|
@@ -375,7 +372,6 @@ async function main() {
|
|
|
375
372
|
process.exit(130)
|
|
376
373
|
}
|
|
377
374
|
shuttingDown = true
|
|
378
|
-
clearInterval(compactInterval)
|
|
379
375
|
renameWatcher.close()
|
|
380
376
|
// Suppress Vite's shutdown-time esbuild noise ("Pre-transform error:
|
|
381
377
|
// The service was stopped" for every in-flight transform) AND the
|
|
@@ -397,7 +393,6 @@ async function main() {
|
|
|
397
393
|
process.on('SIGTERM', shutdown)
|
|
398
394
|
|
|
399
395
|
child.on('exit', (code) => {
|
|
400
|
-
clearInterval(compactInterval)
|
|
401
396
|
renameWatcher.close()
|
|
402
397
|
releasePort(worktreeName)
|
|
403
398
|
process.exit(code ?? 0)
|
package/src/core/cli/index.js
CHANGED
|
@@ -86,6 +86,8 @@ function helpScreen(version) {
|
|
|
86
86
|
cmd('canvas delete-canvas', 'Delete a canvas and its directory'),
|
|
87
87
|
cmd('canvas roles', 'List available hub roles'),
|
|
88
88
|
cmd('canvas batch', 'Execute multiple canvas operations in one call'),
|
|
89
|
+
cmd('canvas undo --event <id>', 'Undo a previously-applied canvas event'),
|
|
90
|
+
cmd('canvas redo --event <id>', 'Redo a previously-undone canvas event'),
|
|
89
91
|
cmd('compact [name]', 'Compact canvas JSONL files (removes bloat)'),
|
|
90
92
|
cmd('compact --all', 'Force compact all canvases'),
|
|
91
93
|
'',
|
|
@@ -196,6 +198,10 @@ switch (command) {
|
|
|
196
198
|
import('./canvasRoles.js')
|
|
197
199
|
} else if (process.argv[3] === 'batch') {
|
|
198
200
|
import('./canvasBatch.js')
|
|
201
|
+
} else if (process.argv[3] === 'undo') {
|
|
202
|
+
import('./canvasUndo.js')
|
|
203
|
+
} else if (process.argv[3] === 'redo') {
|
|
204
|
+
import('./canvasRedo.js')
|
|
199
205
|
} else {
|
|
200
206
|
const version = getVersion()
|
|
201
207
|
console.log(helpScreen(version))
|