@storybook/tanstack-react 0.0.0-pr-35586-sha-3cb2db1c → 0.0.0-pr-35247-sha-ecae3f60

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.
@@ -55,12 +55,12 @@ function initSourceTree(route, counter) {
55
55
  initSourceTree(child, counter);
56
56
  }
57
57
  function cloneChild(oldRoute, parent, overrides, byId) {
58
- let options = oldRoute.options ?? {}, { id: originalId, getParentRoute: _g, ...rest } = options, override = getOverrideFor(overrides, oldRoute.id), { id: overrideId, ...overrideRest } = override, merged = { ...rest, ...overrideRest }, explicitId = "id" in override ? overrideId : originalId, cloned = createRoute({
59
- ...!merged.path && explicitId != null ? { id: explicitId } : {},
58
+ let options = oldRoute.options ?? {}, { id: originalId, getParentRoute: _g, ...rest } = options, override = getOverrideFor(overrides, oldRoute.id), merged = { ...rest, ...override }, cloned = createRoute({
59
+ ...!merged.path && originalId != null ? { id: originalId } : {},
60
60
  ...merged,
61
61
  getParentRoute: () => parent
62
62
  });
63
- merged.path && explicitId != null && cloned.update({ id: explicitId }), byId.set(oldRoute.id, cloned);
63
+ byId.set(oldRoute.id, cloned);
64
64
  let children = oldRoute.children;
65
65
  if (children?.length) {
66
66
  let clonedChildren = children.map(
@@ -101,11 +101,6 @@ function mountPathFor(route) {
101
101
  }
102
102
  return joinPaths(["/", ...segments]);
103
103
  }
104
- function originalRouteId(tree, route) {
105
- for (let [id, cloned] of tree.byId)
106
- if (cloned === route)
107
- return id;
108
- }
109
104
  function resolveStoryLeaf(tree, { path, boundRouteId }) {
110
105
  let { root, byId } = tree;
111
106
  if (path) {
@@ -208,7 +203,7 @@ function resolveTree(Story, context) {
208
203
  path: routerParameters.path,
209
204
  boundRouteId: resolvedRoute && resolvedRoute !== rootRoute ? resolvedRoute.id : void 0
210
205
  });
211
- injectStoryComponent(leaf, Story, routeOverrides, originalRouteId(tree, leaf) ?? leaf.id);
206
+ injectStoryComponent(leaf, Story, routeOverrides, leaf.id);
212
207
  let renderLeaf = ensureMatchableLeaf(tree, leaf);
213
208
  return { tree, leaf: renderLeaf };
214
209
  }
@@ -218,7 +213,7 @@ function resolveTree(Story, context) {
218
213
  );
219
214
  routerParameterRoute.update({ getParentRoute: () => syntheticRoot2 }), syntheticRoot2.addChildren([routerParameterRoute]);
220
215
  let tree = duplicateRouteTree(syntheticRoot2, { overrides: routeOverrides }), leaf = tree.byId.get(routerParameterRoute.id) ?? tree.root;
221
- injectStoryComponent(leaf, Story, routeOverrides, routerParameterRoute.id);
216
+ injectStoryComponent(leaf, Story, routeOverrides, leaf.id);
222
217
  let renderLeaf = ensureMatchableLeaf(tree, leaf);
223
218
  return { tree, leaf: renderLeaf };
224
219
  }
@@ -228,20 +223,14 @@ function resolveTree(Story, context) {
228
223
  ...plainRouteRest
229
224
  } = plainOptions, syntheticRouteId = plainRoutePath ? void 0 : plainRouteId ?? "storybook-story", syntheticRoot = createRootRoute(
230
225
  routeOverrides?.__root__ ?? {}
231
- ), leafOverrideKey = syntheticRouteId ?? plainRoutePath, leafOverride = leafOverrideKey ? routeOverrides?.[leafOverrideKey] ?? {} : {}, syntheticChild = createRoute2({
226
+ ), syntheticChild = createRoute2({
232
227
  component: () => React.createElement(Story, null),
233
228
  id: syntheticRouteId,
234
229
  path: plainRoutePath,
235
230
  ...plainRouteRest,
236
- ...leafOverride,
237
231
  getParentRoute: () => syntheticRoot
238
232
  });
239
- return syntheticRoot.addChildren([syntheticChild]), injectStoryComponent(
240
- syntheticChild,
241
- Story,
242
- routeOverrides,
243
- syntheticRouteId ?? plainRoutePath ?? syntheticChild.id
244
- ), {
233
+ return syntheticRoot.addChildren([syntheticChild]), injectStoryComponent(syntheticChild, Story, routeOverrides, syntheticChild.id), {
245
234
  tree: { root: syntheticRoot, byId: /* @__PURE__ */ new Map([[syntheticChild.id, syntheticChild]]) },
246
235
  leaf: syntheticChild
247
236
  };
@@ -1,4 +1,3 @@
1
- import { ComponentType } from "react";
2
1
  import { CompatibleString } from "storybook/internal/types";
3
2
  import { AnyRoute, FileRoutesByPath, Register } from "@tanstack/react-router";
4
3
  import { Decorator } from "@storybook/react";
@@ -30,8 +29,6 @@ type StoryRouteOptions<TRoute = undefined> = CreateStoryRouteOptions<TRoute> | (
30
29
  * Users can override `loader`, `beforeLoad`, etc. for a specific route.
31
30
  */
32
31
  interface RouteOverrideOptions<TRoute extends FileRoutesByPath[keyof FileRoutesByPath]['preLoaderRoute'] | undefined = undefined> {
33
- /** Override the route's component. */
34
- component?: TRoute extends FileRoutesByPath[keyof FileRoutesByPath]['preLoaderRoute'] ? TRoute['options']['component'] | ComponentType : ComponentType;
35
32
  /** Override the route's loader function. */
36
33
  loader?: TRoute extends FileRoutesByPath[keyof FileRoutesByPath]['preLoaderRoute'] ? TRoute['options']['loader'] | ((ctx: unknown) => Promise<unknown> | unknown) : (ctx: unknown) => Promise<unknown> | unknown;
37
34
  /** Override the route's beforeLoad function. */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as TanStackPreviewOptions, c as IsRoute, d as StoryRouteOptions, i as TanStackParameters, l as RouterParameters, n as FrameworkOptions, o as TanStackTypes, r as StorybookConfig, s as CreateStoryRouteOptions, t as DefaultStoryPath, u as StoryRouteFileOptions } from "./chunk-CT6Edisg.js";
1
+ import { a as TanStackPreviewOptions, c as IsRoute, d as StoryRouteOptions, i as TanStackParameters, l as RouterParameters, n as FrameworkOptions, o as TanStackTypes, r as StorybookConfig, s as CreateStoryRouteOptions, t as DefaultStoryPath, u as StoryRouteFileOptions } from "./chunk-B2-fTWlC.js";
2
2
  import { ComponentType } from "react";
3
3
  import { AddonTypes, InferTypes, PreviewAddon } from "storybook/internal/csf";
4
4
  import { Args, ArgsStoryFn, ComponentAnnotations, DecoratorFunction, Parameters, ProjectAnnotations, Renderer, StoryAnnotations } from "storybook/internal/types";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  preview_exports
3
- } from "./_browser-chunks/chunk-S5HUOLAJ.js";
3
+ } from "./_browser-chunks/chunk-FF4C4TUQ.js";
4
4
  import "./_browser-chunks/chunk-LTDGLEVR.js";
5
5
  import "./_browser-chunks/chunk-4BE7D4DS.js";
6
6
 
@@ -1,6 +1,7 @@
1
- import { r as StorybookConfig } from "../chunk-CT6Edisg.js";
1
+ import { r as StorybookConfig } from "../chunk-B2-fTWlC.js";
2
+ import { experimental_VitePluginUserOptions, experimental_vitePlugin } from "@storybook/builder-vite";
2
3
 
3
4
  //#region code/frameworks/tanstack-react/.dts-emit/code/frameworks/tanstack-react/src/node/index.d.ts
4
5
  declare function defineMain(config: StorybookConfig): StorybookConfig;
5
6
  //#endregion
6
- export { type StorybookConfig, defineMain };
7
+ export { type StorybookConfig, defineMain, type experimental_VitePluginUserOptions, experimental_vitePlugin };
@@ -1,19 +1,21 @@
1
- import CJS_COMPAT_NODE_URL_3i9tnkemw5v from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_3i9tnkemw5v from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_3i9tnkemw5v from "node:module";
1
+ import CJS_COMPAT_NODE_URL_1r39zuo7f7c from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_1r39zuo7f7c from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_1r39zuo7f7c from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_3i9tnkemw5v.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_3i9tnkemw5v.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_3i9tnkemw5v.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_1r39zuo7f7c.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_1r39zuo7f7c.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_1r39zuo7f7c.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
 
13
13
  // src/node/index.ts
14
+ import { experimental_vitePlugin } from "@storybook/builder-vite";
14
15
  function defineMain(config) {
15
16
  return config;
16
17
  }
17
18
  export {
18
- defineMain
19
+ defineMain,
20
+ experimental_vitePlugin
19
21
  };
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_3i9tnkemw5v from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_3i9tnkemw5v from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_3i9tnkemw5v from "node:module";
1
+ import CJS_COMPAT_NODE_URL_1r39zuo7f7c from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_1r39zuo7f7c from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_1r39zuo7f7c from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_3i9tnkemw5v.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_3i9tnkemw5v.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_3i9tnkemw5v.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_1r39zuo7f7c.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_1r39zuo7f7c.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_1r39zuo7f7c.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -360,17 +360,16 @@ function moduleInterceptionPlugin({
360
360
  enforce: "pre",
361
361
  resolveId: {
362
362
  order: "pre",
363
- async handler(id, importer) {
364
- let resolveMock = async (mockPath) => await this.resolve(mockPath, importer, { skipSelf: !0 }) ?? mockPath;
363
+ handler(id, importer) {
365
364
  if ((id === "@tanstack/react-router" || id.startsWith("@tanstack/react-router/")) && importer && !importer.includes("export-mocks"))
366
- return resolveMock(routerMockPath);
365
+ return routerMockPath;
367
366
  if (START_SERVER_MODULES.includes(id) || id === "@tanstack/react-start")
368
- return resolveMock(startMockPath);
367
+ return startMockPath;
369
368
  if (id === "@tanstack/start-storage-context")
370
- return resolveMock(startStorageContextMockPath);
369
+ return startStorageContextMockPath;
371
370
  for (let pattern of INTERCEPTED_PATTERNS)
372
371
  if (id.includes(pattern))
373
- return resolveMock(startMockPath);
372
+ return startMockPath;
374
373
  return null;
375
374
  }
376
375
  },
package/dist/preview.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as TanStackParameters } from "./chunk-CT6Edisg.js";
1
+ import { i as TanStackParameters } from "./chunk-B2-fTWlC.js";
2
2
  import { DecoratorFunction, LoaderFunction, Renderer } from "storybook/internal/types";
3
3
  import { applyDecorators as applyDecorators$1 } from "@storybook/react/entry-preview-docs";
4
4
 
package/dist/preview.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  loaders,
4
4
  optimizeDeps,
5
5
  parameters
6
- } from "./_browser-chunks/chunk-S5HUOLAJ.js";
6
+ } from "./_browser-chunks/chunk-FF4C4TUQ.js";
7
7
  import "./_browser-chunks/chunk-LTDGLEVR.js";
8
8
  import "./_browser-chunks/chunk-4BE7D4DS.js";
9
9
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/tanstack-react",
3
- "version": "0.0.0-pr-35586-sha-3cb2db1c",
3
+ "version": "0.0.0-pr-35247-sha-ecae3f60",
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": "0.0.0-pr-35586-sha-3cb2db1c",
79
- "@storybook/react": "0.0.0-pr-35586-sha-3cb2db1c",
80
- "@storybook/react-vite": "0.0.0-pr-35586-sha-3cb2db1c"
78
+ "@storybook/builder-vite": "0.0.0-pr-35247-sha-ecae3f60",
79
+ "@storybook/react": "0.0.0-pr-35247-sha-ecae3f60",
80
+ "@storybook/react-vite": "0.0.0-pr-35247-sha-ecae3f60"
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": "^0.0.0-pr-35586-sha-3cb2db1c",
98
+ "storybook": "^0.0.0-pr-35247-sha-ecae3f60",
99
99
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
100
100
  },
101
101
  "peerDependenciesMeta": {