@storybook/tanstack-react 10.6.0-alpha.2 → 10.6.0-alpha.3
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/dist/_browser-chunks/{chunk-FF4C4TUQ.js → chunk-XY6TESST.js} +15 -4
- package/dist/{chunk-B2-fTWlC.d.ts → chunk-CT6Edisg.d.ts} +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.js +6 -6
- package/dist/preset.js +6 -6
- package/dist/preview.d.ts +1 -1
- package/dist/preview.js +1 -1
- package/package.json +5 -5
|
@@ -101,6 +101,11 @@ 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
|
+
}
|
|
104
109
|
function resolveStoryLeaf(tree, { path, boundRouteId }) {
|
|
105
110
|
let { root, byId } = tree;
|
|
106
111
|
if (path) {
|
|
@@ -203,7 +208,7 @@ function resolveTree(Story, context) {
|
|
|
203
208
|
path: routerParameters.path,
|
|
204
209
|
boundRouteId: resolvedRoute && resolvedRoute !== rootRoute ? resolvedRoute.id : void 0
|
|
205
210
|
});
|
|
206
|
-
injectStoryComponent(leaf, Story, routeOverrides, leaf.id);
|
|
211
|
+
injectStoryComponent(leaf, Story, routeOverrides, originalRouteId(tree, leaf) ?? leaf.id);
|
|
207
212
|
let renderLeaf = ensureMatchableLeaf(tree, leaf);
|
|
208
213
|
return { tree, leaf: renderLeaf };
|
|
209
214
|
}
|
|
@@ -213,7 +218,7 @@ function resolveTree(Story, context) {
|
|
|
213
218
|
);
|
|
214
219
|
routerParameterRoute.update({ getParentRoute: () => syntheticRoot2 }), syntheticRoot2.addChildren([routerParameterRoute]);
|
|
215
220
|
let tree = duplicateRouteTree(syntheticRoot2, { overrides: routeOverrides }), leaf = tree.byId.get(routerParameterRoute.id) ?? tree.root;
|
|
216
|
-
injectStoryComponent(leaf, Story, routeOverrides,
|
|
221
|
+
injectStoryComponent(leaf, Story, routeOverrides, routerParameterRoute.id);
|
|
217
222
|
let renderLeaf = ensureMatchableLeaf(tree, leaf);
|
|
218
223
|
return { tree, leaf: renderLeaf };
|
|
219
224
|
}
|
|
@@ -223,14 +228,20 @@ function resolveTree(Story, context) {
|
|
|
223
228
|
...plainRouteRest
|
|
224
229
|
} = plainOptions, syntheticRouteId = plainRoutePath ? void 0 : plainRouteId ?? "storybook-story", syntheticRoot = createRootRoute(
|
|
225
230
|
routeOverrides?.__root__ ?? {}
|
|
226
|
-
), syntheticChild = createRoute2({
|
|
231
|
+
), leafOverrideKey = syntheticRouteId ?? plainRoutePath, leafOverride = leafOverrideKey ? routeOverrides?.[leafOverrideKey] ?? {} : {}, syntheticChild = createRoute2({
|
|
227
232
|
component: () => React.createElement(Story, null),
|
|
228
233
|
id: syntheticRouteId,
|
|
229
234
|
path: plainRoutePath,
|
|
230
235
|
...plainRouteRest,
|
|
236
|
+
...leafOverride,
|
|
231
237
|
getParentRoute: () => syntheticRoot
|
|
232
238
|
});
|
|
233
|
-
return syntheticRoot.addChildren([syntheticChild]), injectStoryComponent(
|
|
239
|
+
return syntheticRoot.addChildren([syntheticChild]), injectStoryComponent(
|
|
240
|
+
syntheticChild,
|
|
241
|
+
Story,
|
|
242
|
+
routeOverrides,
|
|
243
|
+
syntheticRouteId ?? plainRoutePath ?? syntheticChild.id
|
|
244
|
+
), {
|
|
234
245
|
tree: { root: syntheticRoot, byId: /* @__PURE__ */ new Map([[syntheticChild.id, syntheticChild]]) },
|
|
235
246
|
leaf: syntheticChild
|
|
236
247
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ComponentType } from "react";
|
|
1
2
|
import { CompatibleString } from "storybook/internal/types";
|
|
2
3
|
import { AnyRoute, FileRoutesByPath, Register } from "@tanstack/react-router";
|
|
3
4
|
import { Decorator } from "@storybook/react";
|
|
@@ -29,6 +30,8 @@ type StoryRouteOptions<TRoute = undefined> = CreateStoryRouteOptions<TRoute> | (
|
|
|
29
30
|
* Users can override `loader`, `beforeLoad`, etc. for a specific route.
|
|
30
31
|
*/
|
|
31
32
|
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;
|
|
32
35
|
/** Override the route's loader function. */
|
|
33
36
|
loader?: TRoute extends FileRoutesByPath[keyof FileRoutesByPath]['preLoaderRoute'] ? TRoute['options']['loader'] | ((ctx: unknown) => Promise<unknown> | unknown) : (ctx: unknown) => Promise<unknown> | unknown;
|
|
34
37
|
/** 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-
|
|
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";
|
|
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
package/dist/node/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as StorybookConfig } from "../chunk-
|
|
1
|
+
import { r as StorybookConfig } from "../chunk-CT6Edisg.js";
|
|
2
2
|
|
|
3
3
|
//#region code/frameworks/tanstack-react/.dts-emit/code/frameworks/tanstack-react/src/node/index.d.ts
|
|
4
4
|
declare function defineMain(config: StorybookConfig): StorybookConfig;
|
package/dist/node/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0sqooo0adxx9 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0sqooo0adxx9 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0sqooo0adxx9 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0sqooo0adxx9.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0sqooo0adxx9.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0sqooo0adxx9.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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0sqooo0adxx9 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0sqooo0adxx9 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0sqooo0adxx9 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0sqooo0adxx9.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0sqooo0adxx9.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0sqooo0adxx9.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
package/dist/preview.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as TanStackParameters } from "./chunk-
|
|
1
|
+
import { i as TanStackParameters } from "./chunk-CT6Edisg.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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/tanstack-react",
|
|
3
|
-
"version": "10.6.0-alpha.
|
|
3
|
+
"version": "10.6.0-alpha.3",
|
|
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-alpha.
|
|
79
|
-
"@storybook/react": "10.6.0-alpha.
|
|
80
|
-
"@storybook/react-vite": "10.6.0-alpha.
|
|
78
|
+
"@storybook/builder-vite": "10.6.0-alpha.3",
|
|
79
|
+
"@storybook/react": "10.6.0-alpha.3",
|
|
80
|
+
"@storybook/react-vite": "10.6.0-alpha.3"
|
|
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-alpha.
|
|
98
|
+
"storybook": "^10.6.0-alpha.3",
|
|
99
99
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
100
100
|
},
|
|
101
101
|
"peerDependenciesMeta": {
|