@dfosco/storyboard 0.6.1 → 0.6.2

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",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Storyboard prototyping framework — core engine, React integration, and canvas",
@@ -68,6 +68,11 @@ function parseDataFile(filePath, opts = {}) {
68
68
  const folderDirMatch = normalized.match(/(?:^|\/)src\/prototypes\/([^/]+)\.folder\//)
69
69
  const folderName = folderDirMatch ? folderDirMatch[1] : null
70
70
 
71
+ // Strip leading `~` from each path segment when building the public URL,
72
+ // so locally-gitignored canvases (e.g. ~notes.canvas.jsonl) are reachable
73
+ // at the same route as their non-prefixed counterpart. The on-disk `name`
74
+ // and `id` keep the `~` so they remain unique vs a sibling without it.
75
+ const stripTilde = (p) => p.split('/').map(seg => seg.replace(/^~/, '')).join('/')
71
76
  const canvasCheck = normalized.match(/(?:^|\/)src\/canvas\//)
72
77
  if (canvasCheck) {
73
78
  const dirPath = normalized.substring(0, normalized.lastIndexOf('/'))
@@ -79,7 +84,7 @@ function parseDataFile(filePath, opts = {}) {
79
84
  .replace(/\/+/g, '/')
80
85
  .replace(/\/$/, '')
81
86
  name = idBase ? `${idBase}/${baseName}` : baseName
82
- inferredRoute = '/canvas/' + name
87
+ inferredRoute = '/canvas/' + stripTilde(name)
83
88
  inferredRoute = inferredRoute.replace(/\/+/g, '/').replace(/\/$/, '') || '/canvas'
84
89
  }
85
90
  const protoCheck = normalized.match(/(?:^|\/)src\/prototypes\//)
@@ -92,7 +97,7 @@ function parseDataFile(filePath, opts = {}) {
92
97
  .replace(/\/+/g, '/')
93
98
  .replace(/\/$/, '')
94
99
  name = idBase ? `${idBase}/${baseName}` : baseName
95
- inferredRoute = '/canvas/' + name
100
+ inferredRoute = '/canvas/' + stripTilde(name)
96
101
  inferredRoute = inferredRoute.replace(/\/+/g, '/').replace(/\/$/, '') || '/canvas'
97
102
  }
98
103
  // Derive group: canvases sharing a directory form a group
@@ -1214,10 +1214,17 @@ describe('parseDataFile — canvas path-based IDs', () => {
1214
1214
  const file = parseDataFile('src/canvas/~scratch.canvas.jsonl', { includeTilde: true })
1215
1215
  expect(file).not.toBeNull()
1216
1216
  expect(file.name).toBe('~scratch')
1217
- expect(file.inferredRoute).toBe('/canvas/~scratch')
1217
+ // Public route strips the `~` so locally-gitignored canvases reuse the
1218
+ // same URL as their non-prefixed counterpart.
1219
+ expect(file.inferredRoute).toBe('/canvas/scratch')
1218
1220
  const inDir = parseDataFile('src/canvas/~private/notes.canvas.jsonl', { includeTilde: true })
1219
1221
  expect(inDir).not.toBeNull()
1220
1222
  expect(inDir.name).toBe('~private/notes')
1223
+ expect(inDir.inferredRoute).toBe('/canvas/private/notes')
1224
+ const inSubdir = parseDataFile('src/canvas/dfosco-explorations/~notes.canvas.jsonl', { includeTilde: true })
1225
+ expect(inSubdir).not.toBeNull()
1226
+ expect(inSubdir.name).toBe('dfosco-explorations/~notes')
1227
+ expect(inSubdir.inferredRoute).toBe('/canvas/dfosco-explorations/notes')
1221
1228
  })
1222
1229
 
1223
1230
  it('canvas outside known directories gets basename-only ID', () => {