@dfosco/storyboard-core 3.8.0 → 3.8.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-core",
3
- "version": "3.8.0",
3
+ "version": "3.8.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -169,7 +169,15 @@
169
169
  {@const itemState = action.toolKey ? getToolbarToolState(action.toolKey) : 'active'}
170
170
  {@const itemLocalOnly = action.toolKey ? isToolbarToolLocalOnly(action.toolKey) : false}
171
171
  <DropdownMenu.Item
172
- onclick={() => { open = false; window.location.href = action.url }}
172
+ onclick={() => {
173
+ open = false
174
+ if (action.url.startsWith('/') && !action.url.startsWith('//')) {
175
+ const base = (basePath || '/').replace(/\/+$/, '')
176
+ window.location.href = (base === '/' ? '' : base) + action.url
177
+ } else {
178
+ window.location.href = action.url
179
+ }
180
+ }}
173
181
  disabled={itemState === 'inactive'}
174
182
  class={itemState === 'dimmed' ? 'opacity-50' : ''}
175
183
  >
@@ -9,7 +9,7 @@
9
9
  import Icon from './svelte-plugin-ui/components/Icon.svelte'
10
10
  import { inspectElement, inspectElementChain } from './inspector/fiberWalker.js'
11
11
  import { createMouseMode } from './inspector/mouseMode.js'
12
- import { getColors } from './inspector/highlighter.js'
12
+ import { getColors, createInspectorHighlighter } from './inspector/highlighter.js'
13
13
 
14
14
  /** @type {{ name: string, props: object, source: { fileName: string, lineNumber: number, columnNumber?: number } | null, owner: string | null } | null} */
15
15
  let componentInfo = $state(null)
@@ -255,7 +255,6 @@
255
255
 
256
256
  async function getHighlighter() {
257
257
  if (highlighter) return highlighter
258
- const { createInspectorHighlighter } = await import('./inspector/highlighter.js')
259
258
  highlighter = await createInspectorHighlighter()
260
259
  return highlighter
261
260
  }
@@ -146,8 +146,15 @@
146
146
  setLocal(EXPANDED_KEY, JSON.stringify(expanded))
147
147
  }
148
148
 
149
+ function withBase(route: string): string {
150
+ const normalizedRoute = route.startsWith('/') ? route : `/${route}`
151
+ const normalizedBase = (basePath || '/').replace(/\/+$/, '')
152
+ if (!normalizedBase || normalizedBase === '/') return normalizedRoute
153
+ return `${normalizedBase}${normalizedRoute}`.replace(/\/+/g, '/')
154
+ }
155
+
149
156
  function protoRoute(dirName: string): string {
150
- return `/${dirName}`
157
+ return withBase(`/${dirName}`)
151
158
  }
152
159
 
153
160
  function formatName(name: string): string {
@@ -342,7 +349,7 @@
342
349
  </a>
343
350
  {:else if proto.hideFlows && proto.flows.length === 1}
344
351
  <!-- Single flow, hidden — navigates directly to the flow -->
345
- <a class="listItem" href={proto.flows[0].route}>
352
+ <a class="listItem" href={withBase(proto.flows[0].route)}>
346
353
  <div class="cardBody">
347
354
  <p class="protoName" class:otherflows={proto.dirName === '__global__'}>
348
355
  {#if proto.icon}<span class="protoIcon">{proto.icon}</span>{/if}
@@ -446,7 +453,7 @@
446
453
  {#if !(proto.hideFlows && proto.flows.length === 1) && isExpanded(proto.dirName) && proto.flows.length > 0}
447
454
  <div class="flowList">
448
455
  {#each proto.flows as flow (flow.key)}
449
- <a href={flow.route} class="listItem flowItem">
456
+ <a href={withBase(flow.route)} class="listItem flowItem">
450
457
  {#if showThumbnails}
451
458
  <div class="thumbnail">
452
459
  {@html placeholderSvg(flow.key)}
@@ -467,7 +474,7 @@
467
474
 
468
475
  {#snippet canvasEntry(canvas)}
469
476
  <section class="protoGroup">
470
- <a class="listItem" href={canvas.route}>
477
+ <a class="listItem" href={withBase(canvas.route)}>
471
478
  <div class="cardBody">
472
479
  <p class="protoName">
473
480
  <span class="protoIcon">{canvas.icon || ''}</span>
@@ -577,6 +584,8 @@
577
584
  background-color: var(--bgColor-default, #0d1117);
578
585
  color: var(--fgColor-default, #e6edf3);
579
586
  padding: 80px 32px 48px;
587
+ max-width: 960px;
588
+ margin: 0 auto;
580
589
  }
581
590
 
582
591
  .header {