@storybook/tanstack-react 10.6.0 → 10.6.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.
@@ -1,4 +1,5 @@
1
1
  // src/routing/path-utils.ts
2
+ import { interpolatePath } from "@tanstack/react-router";
2
3
  var possiblyNestedRouteGroupPatternRegex = /\([^/]+\)\/?/g;
3
4
  function removeGroups(s) {
4
5
  return s.replace(possiblyNestedRouteGroupPatternRegex, "");
@@ -20,8 +21,15 @@ function isPathlessFileRouteId(id) {
20
21
  let segments = id.split("/").filter(Boolean), lastSegment = segments[segments.length - 1];
21
22
  return lastSegment != null && isPathlessSegment(lastSegment);
22
23
  }
24
+ function interpolateStoryPath(path, params) {
25
+ return interpolatePath.length >= 2 ? interpolatePath(path, toPathInterpolationSegments(path), params) : interpolatePath({ path, params }).interpolatedPath;
26
+ }
27
+ function toPathInterpolationSegments(path) {
28
+ return path.split("/").filter(Boolean).map((part) => part === "$" ? [2, "_splat", "/", void 0] : part.startsWith("$") ? [1, part.slice(1), "/", ""] : `/${part}`);
29
+ }
23
30
 
24
31
  export {
25
32
  normalizeFileRoutePath,
26
- isPathlessFileRouteId
33
+ isPathlessFileRouteId,
34
+ interpolateStoryPath
27
35
  };
@@ -1,6 +1,7 @@
1
1
  import {
2
+ interpolateStoryPath,
2
3
  normalizeFileRoutePath
3
- } from "./chunk-LTDGLEVR.js";
4
+ } from "./chunk-NGWBYAM4.js";
4
5
  import {
5
6
  __export
6
7
  } from "./chunk-4BE7D4DS.js";
@@ -23,7 +24,6 @@ import {
23
24
  createRoute as createRoute2,
24
25
  createRouter,
25
26
  defaultStringifySearch,
26
- interpolatePath as interpolatePath2,
27
27
  RouterProvider
28
28
  } from "@tanstack/react-router";
29
29
  import React from "react";
@@ -33,7 +33,6 @@ import {
33
33
  createRoute,
34
34
  RootRoute,
35
35
  createRootRouteWithContext,
36
- interpolatePath,
37
36
  joinPaths
38
37
  } from "@tanstack/react-router";
39
38
  var MAX_PARENT_WALK = 50;
@@ -122,7 +121,7 @@ function resolveStoryLeaf(tree, {
122
121
  if (path) {
123
122
  let bound = boundRouteId ? byId.get(boundRouteId) : void 0;
124
123
  if (bound) {
125
- let boundCandidate = mountPathFor(bound), boundInterpolated = params ? interpolatePath({ path: boundCandidate, params }).interpolatedPath : boundCandidate;
124
+ let boundCandidate = mountPathFor(bound), boundInterpolated = params ? interpolateStoryPath(boundCandidate, params) : boundCandidate;
126
125
  if (boundCandidate === path || boundInterpolated === path)
127
126
  return bound;
128
127
  }
@@ -130,7 +129,7 @@ function resolveStoryLeaf(tree, {
130
129
  for (let route of byId.values()) {
131
130
  if (route === root)
132
131
  continue;
133
- let candidate = mountPathFor(route), isLiteral = candidate === path, interpolated = params ? interpolatePath({ path: candidate, params }).interpolatedPath : candidate;
132
+ let candidate = mountPathFor(route), isLiteral = candidate === path, interpolated = params ? interpolateStoryPath(candidate, params) : candidate;
134
133
  if (!isLiteral && interpolated !== path)
135
134
  continue;
136
135
  (isLiteral === bestLiteral ? candidate.length > bestMatchLength : isLiteral) && (bestMatch = route, bestLiteral = isLiteral, bestMatchLength = candidate.length);
@@ -178,10 +177,7 @@ function createStoryRouter({
178
177
  context,
179
178
  routerContext
180
179
  }) {
181
- let routerParameters = context.parameters.tanstack?.router ?? {}, { tree, leaf } = resolveTree(Story, context), routeTree = tree.root, inferredPath = routerParameters?.path || leaf.fullPath || (leaf.id ? normalizeFileRoutePath(leaf.id) : void 0) || mountPathFor(leaf), resolvedPath = interpolatePath2({
182
- path: inferredPath,
183
- params: routerParameters?.params ?? {}
184
- }).interpolatedPath, search = routerParameters?.query ? defaultStringifySearch(routerParameters.query) : "";
180
+ let routerParameters = context.parameters.tanstack?.router ?? {}, { tree, leaf } = resolveTree(Story, context), routeTree = tree.root, inferredPath = routerParameters?.path || leaf.fullPath || (leaf.id ? normalizeFileRoutePath(leaf.id) : void 0) || mountPathFor(leaf), resolvedPath = interpolateStoryPath(inferredPath, routerParameters?.params ?? {}), search = routerParameters?.query ? defaultStringifySearch(routerParameters.query) : "";
185
181
  search && (resolvedPath += search);
186
182
  let history = createMemoryHistory({
187
183
  initialEntries: [resolvedPath]
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isPathlessFileRouteId,
3
3
  normalizeFileRoutePath
4
- } from "../_browser-chunks/chunk-LTDGLEVR.js";
4
+ } from "../_browser-chunks/chunk-NGWBYAM4.js";
5
5
  import {
6
6
  onNavigate
7
7
  } from "../_browser-chunks/chunk-4CKCBIXI.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  preview_exports
3
- } from "./_browser-chunks/chunk-HRV4LMK3.js";
4
- import "./_browser-chunks/chunk-LTDGLEVR.js";
3
+ } from "./_browser-chunks/chunk-O6D7CVOG.js";
4
+ import "./_browser-chunks/chunk-NGWBYAM4.js";
5
5
  import "./_browser-chunks/chunk-4BE7D4DS.js";
6
6
 
7
7
  // src/index.ts
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_lwgsdkaxdh from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_lwgsdkaxdh from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_lwgsdkaxdh from "node:module";
1
+ import CJS_COMPAT_NODE_URL_eef6c53as6q from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_eef6c53as6q from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_eef6c53as6q from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_lwgsdkaxdh.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_lwgsdkaxdh.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_lwgsdkaxdh.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_eef6c53as6q.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_eef6c53as6q.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_eef6c53as6q.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_lwgsdkaxdh from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_lwgsdkaxdh from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_lwgsdkaxdh from "node:module";
1
+ import CJS_COMPAT_NODE_URL_eef6c53as6q from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_eef6c53as6q from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_eef6c53as6q from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_lwgsdkaxdh.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_lwgsdkaxdh.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_lwgsdkaxdh.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_eef6c53as6q.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_eef6c53as6q.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_eef6c53as6q.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/dist/preview.js CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  loaders,
5
5
  optimizeDeps,
6
6
  parameters
7
- } from "./_browser-chunks/chunk-HRV4LMK3.js";
8
- import "./_browser-chunks/chunk-LTDGLEVR.js";
7
+ } from "./_browser-chunks/chunk-O6D7CVOG.js";
8
+ import "./_browser-chunks/chunk-NGWBYAM4.js";
9
9
  import "./_browser-chunks/chunk-4BE7D4DS.js";
10
10
  export {
11
11
  applyDecorators,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/tanstack-react",
3
- "version": "10.6.0",
3
+ "version": "10.6.1",
4
4
  "description": "Storybook for TanStack (React, Vite): Router and Start ready Storybook framework",
5
5
  "keywords": [
6
6
  "storybook",
@@ -75,9 +75,9 @@
75
75
  "!src/**/*"
76
76
  ],
77
77
  "dependencies": {
78
- "@storybook/builder-vite": "10.6.0",
79
- "@storybook/react": "10.6.0",
80
- "@storybook/react-vite": "10.6.0"
78
+ "@storybook/builder-vite": "10.6.1",
79
+ "@storybook/react": "10.6.1",
80
+ "@storybook/react-vite": "10.6.1"
81
81
  },
82
82
  "devDependencies": {
83
83
  "@tanstack/react-router": "^1.168.10",
@@ -95,7 +95,7 @@
95
95
  "@tanstack/start-client-core": "^1.167.9",
96
96
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
97
97
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
98
- "storybook": "^10.6.0",
98
+ "storybook": "^10.6.1",
99
99
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
100
100
  },
101
101
  "peerDependenciesMeta": {