@dfosco/storyboard-react 4.2.0 → 4.2.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,11 +1,11 @@
1
1
  {
2
2
  "name": "@dfosco/storyboard-react",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@base-ui/react": "^1.4.0",
7
- "@dfosco/storyboard-core": "4.2.0",
8
- "@dfosco/tiny-canvas": "4.2.0",
7
+ "@dfosco/storyboard-core": "4.2.1",
8
+ "@dfosco/tiny-canvas": "4.2.1",
9
9
  "@neodrag/react": "^2.3.1",
10
10
  "@radix-ui/react-dialog": "^1.1.15",
11
11
  "@radix-ui/react-visually-hidden": "^1.2.4",
@@ -639,12 +639,6 @@ function buildUnifiedConfig(root) {
639
639
  }
640
640
 
641
641
  // 7. Build the unified config object
642
- coreCPSections: coreCommandPalette?.sections?.length,
643
- afterSbCPSections: afterSbCommandPalette?.sections?.length,
644
- finalCPSections: finalCommandPalette?.sections?.length,
645
- rawSbHasCP: !!rawSbConfig.commandPalette,
646
- userHasCP: !!userConfigs.commandPalette,
647
- })
648
642
  const unified = {
649
643
  toolbar: finalToolbar,
650
644
  commandPalette: finalCommandPalette,
@@ -1385,6 +1379,56 @@ export default function storyboardDataPlugin() {
1385
1379
  buildStart() {
1386
1380
  buildResult = null
1387
1381
  },
1382
+
1383
+ // Emit terminal snapshots into the build so TerminalReadWidget can
1384
+ // fetch them as static files in production (no dev-server API).
1385
+ generateBundle() {
1386
+ const emittedIds = new Set()
1387
+
1388
+ // 1. New public snapshots (flat structure) — .json and .txt
1389
+ const publicDir = path.resolve('assets/.storyboard-public/terminal-snapshots')
1390
+ if (fs.existsSync(publicDir)) {
1391
+ for (const file of fs.readdirSync(publicDir)) {
1392
+ if (file.startsWith('~') || file.startsWith('.')) continue
1393
+ const isJson = file.endsWith('.snapshot.json')
1394
+ const isTxt = file.endsWith('.snapshot.txt')
1395
+ if (!isJson && !isTxt) continue
1396
+ if (isJson) {
1397
+ const widgetId = file.replace(/\.snapshot\.json$/, '')
1398
+ if (widgetId) emittedIds.add(widgetId)
1399
+ }
1400
+ this.emitFile({
1401
+ type: 'asset',
1402
+ fileName: `_storyboard/terminal-snapshots/${file}`,
1403
+ source: fs.readFileSync(path.join(publicDir, file), 'utf-8'),
1404
+ })
1405
+ }
1406
+ }
1407
+
1408
+ // 2. Legacy snapshots (nested by canvas dir) — skip if already emitted
1409
+ const legacyDir = path.resolve('.storyboard/terminal-snapshots')
1410
+ if (fs.existsSync(legacyDir)) {
1411
+ const walk = (dir) => {
1412
+ const entries = fs.readdirSync(dir, { withFileTypes: true })
1413
+ for (const entry of entries) {
1414
+ const full = path.join(dir, entry.name)
1415
+ if (entry.isDirectory()) {
1416
+ walk(full)
1417
+ } else if (entry.name.endsWith('.json') && !entry.name.startsWith('~')) {
1418
+ const widgetId = entry.name.replace(/\.json$/, '')
1419
+ if (emittedIds.has(widgetId)) continue
1420
+ const rel = path.relative(legacyDir, full).replace(/\\/g, '/')
1421
+ this.emitFile({
1422
+ type: 'asset',
1423
+ fileName: `_storyboard/terminal-snapshots/${rel}`,
1424
+ source: fs.readFileSync(full, 'utf-8'),
1425
+ })
1426
+ }
1427
+ }
1428
+ }
1429
+ walk(legacyDir)
1430
+ }
1431
+ },
1388
1432
  }
1389
1433
  }
1390
1434