@storybook/tanstack-react 10.6.0-alpha.1 → 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-4W5ZAMIP.js → chunk-XY6TESST.js} +21 -5
- 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
|
@@ -72,7 +72,12 @@ function cloneChild(oldRoute, parent, overrides, byId) {
|
|
|
72
72
|
}
|
|
73
73
|
function duplicateRouteTree(rootRoute, { overrides } = {}) {
|
|
74
74
|
initSourceTree(rootRoute, { i: 0 });
|
|
75
|
-
let byId = /* @__PURE__ */ new Map(), rootOptions = rootRoute.options ?? {}, rootOverride = getOverrideFor(overrides, "__root__"), {
|
|
75
|
+
let byId = /* @__PURE__ */ new Map(), rootOptions = rootRoute.options ?? {}, rootOverride = getOverrideFor(overrides, "__root__"), {
|
|
76
|
+
id: _rootId,
|
|
77
|
+
getParentRoute: _rootGetParent,
|
|
78
|
+
shellComponent: _rootShell,
|
|
79
|
+
...restRoot
|
|
80
|
+
} = rootOptions, newRoot = createRootRouteWithContext()({
|
|
76
81
|
...restRoot,
|
|
77
82
|
...rootOverride
|
|
78
83
|
});
|
|
@@ -96,6 +101,11 @@ function mountPathFor(route) {
|
|
|
96
101
|
}
|
|
97
102
|
return joinPaths(["/", ...segments]);
|
|
98
103
|
}
|
|
104
|
+
function originalRouteId(tree, route) {
|
|
105
|
+
for (let [id, cloned] of tree.byId)
|
|
106
|
+
if (cloned === route)
|
|
107
|
+
return id;
|
|
108
|
+
}
|
|
99
109
|
function resolveStoryLeaf(tree, { path, boundRouteId }) {
|
|
100
110
|
let { root, byId } = tree;
|
|
101
111
|
if (path) {
|
|
@@ -198,7 +208,7 @@ function resolveTree(Story, context) {
|
|
|
198
208
|
path: routerParameters.path,
|
|
199
209
|
boundRouteId: resolvedRoute && resolvedRoute !== rootRoute ? resolvedRoute.id : void 0
|
|
200
210
|
});
|
|
201
|
-
injectStoryComponent(leaf, Story, routeOverrides, leaf.id);
|
|
211
|
+
injectStoryComponent(leaf, Story, routeOverrides, originalRouteId(tree, leaf) ?? leaf.id);
|
|
202
212
|
let renderLeaf = ensureMatchableLeaf(tree, leaf);
|
|
203
213
|
return { tree, leaf: renderLeaf };
|
|
204
214
|
}
|
|
@@ -208,7 +218,7 @@ function resolveTree(Story, context) {
|
|
|
208
218
|
);
|
|
209
219
|
routerParameterRoute.update({ getParentRoute: () => syntheticRoot2 }), syntheticRoot2.addChildren([routerParameterRoute]);
|
|
210
220
|
let tree = duplicateRouteTree(syntheticRoot2, { overrides: routeOverrides }), leaf = tree.byId.get(routerParameterRoute.id) ?? tree.root;
|
|
211
|
-
injectStoryComponent(leaf, Story, routeOverrides,
|
|
221
|
+
injectStoryComponent(leaf, Story, routeOverrides, routerParameterRoute.id);
|
|
212
222
|
let renderLeaf = ensureMatchableLeaf(tree, leaf);
|
|
213
223
|
return { tree, leaf: renderLeaf };
|
|
214
224
|
}
|
|
@@ -218,14 +228,20 @@ function resolveTree(Story, context) {
|
|
|
218
228
|
...plainRouteRest
|
|
219
229
|
} = plainOptions, syntheticRouteId = plainRoutePath ? void 0 : plainRouteId ?? "storybook-story", syntheticRoot = createRootRoute(
|
|
220
230
|
routeOverrides?.__root__ ?? {}
|
|
221
|
-
), syntheticChild = createRoute2({
|
|
231
|
+
), leafOverrideKey = syntheticRouteId ?? plainRoutePath, leafOverride = leafOverrideKey ? routeOverrides?.[leafOverrideKey] ?? {} : {}, syntheticChild = createRoute2({
|
|
222
232
|
component: () => React.createElement(Story, null),
|
|
223
233
|
id: syntheticRouteId,
|
|
224
234
|
path: plainRoutePath,
|
|
225
235
|
...plainRouteRest,
|
|
236
|
+
...leafOverride,
|
|
226
237
|
getParentRoute: () => syntheticRoot
|
|
227
238
|
});
|
|
228
|
-
return syntheticRoot.addChildren([syntheticChild]), injectStoryComponent(
|
|
239
|
+
return syntheticRoot.addChildren([syntheticChild]), injectStoryComponent(
|
|
240
|
+
syntheticChild,
|
|
241
|
+
Story,
|
|
242
|
+
routeOverrides,
|
|
243
|
+
syntheticRouteId ?? plainRoutePath ?? syntheticChild.id
|
|
244
|
+
), {
|
|
229
245
|
tree: { root: syntheticRoot, byId: /* @__PURE__ */ new Map([[syntheticChild.id, syntheticChild]]) },
|
|
230
246
|
leaf: syntheticChild
|
|
231
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": {
|