@dfosco/storyboard-react 4.2.3 → 4.2.4

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.3",
3
+ "version": "4.2.4",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@base-ui/react": "^1.4.0",
7
- "@dfosco/storyboard-core": "4.2.3",
8
- "@dfosco/tiny-canvas": "4.2.3",
7
+ "@dfosco/storyboard-core": "4.2.4",
8
+ "@dfosco/tiny-canvas": "4.2.4",
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",
@@ -545,9 +545,28 @@ function buildDynamicSection(section, prefix, onNavigateToPage, onCreateAction)
545
545
  if (f.canvases) for (const c of f.canvases) sourceItems.push({ name: c.name, route: `${prefix}${c.route}`, id: c.dirName, type: 'canvas' })
546
546
  }
547
547
  } else if (section.source === 'prototypes') {
548
- for (const p of index.prototypes) sourceItems.push({ name: p.name, route: `${prefix}/${p.dirName}`, id: p.dirName, type: 'prototype' })
548
+ const formatFlowName = (name) => name.replace(/[-_]/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase())
549
+ const pushProtoFlows = (p) => {
550
+ if (p.isExternal) {
551
+ sourceItems.push({ name: p.name, route: p.externalUrl, id: p.dirName, type: 'prototype', isExternal: true })
552
+ } else if (p.hideFlows || p.flows.length <= 1) {
553
+ const route = p.flows.length === 1 ? `${prefix}${p.flows[0].route}` : `${prefix}/${p.dirName}`
554
+ sourceItems.push({ name: p.name, route, id: p.dirName, type: 'prototype' })
555
+ } else {
556
+ for (const flow of p.flows) {
557
+ const flowLabel = flow.meta?.title || formatFlowName(flow.name)
558
+ sourceItems.push({
559
+ name: `${p.name} – ${flowLabel}`,
560
+ route: `${prefix}${flow.route}`,
561
+ id: `${p.dirName}/${flow.name}`,
562
+ type: 'prototype',
563
+ })
564
+ }
565
+ }
566
+ }
567
+ for (const p of index.prototypes) pushProtoFlows(p)
549
568
  for (const f of index.folders) {
550
- for (const p of f.prototypes) sourceItems.push({ name: p.name, route: `${prefix}/${p.dirName}`, id: p.dirName, type: 'prototype' })
569
+ for (const p of f.prototypes) pushProtoFlows(p)
551
570
  }
552
571
  } else if (section.source === 'stories') {
553
572
  for (const name of listStories()) {
@@ -588,7 +607,11 @@ function buildDynamicSection(section, prefix, onNavigateToPage, onCreateAction)
588
607
  url: item.route,
589
608
  onClick: () => {
590
609
  trackRecent(item.type, item.id, item.name)
591
- window.location.href = item.route
610
+ if (item.isExternal) {
611
+ window.open(item.route, '_blank')
612
+ } else {
613
+ window.location.href = item.route
614
+ }
592
615
  },
593
616
  })),
594
617
  },