@storybook/react 11.0.0-beta.5 → 11.0.0-rc.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.
- package/dist/_browser-chunks/{chunk-I62VTYU3.js → chunk-MB4PPIXP.js} +2 -4
- package/dist/_browser-chunks/{chunk-LK5PKCYS.js → chunk-RHGZ5MD3.js} +1 -1
- package/dist/_node-chunks/{chunk-2DC27WWN.js → chunk-2I5WCK5H.js} +22 -3
- package/dist/_node-chunks/{chunk-2NYPPHY3.js → chunk-ITCF7APG.js} +1 -1
- package/dist/_node-chunks/{chunk-WSXDRG6X.js → chunk-LZBEMUVF.js} +15 -4
- package/dist/_node-chunks/chunk-PQZIOGBY.js +1 -1
- package/dist/_node-chunks/{extractArgTypesFromComponentFile-E3P24DW4.js → extractArgTypesFromComponentFile-BBV3XDO4.js} +3 -3
- package/dist/docgen/docgen-worker.js +2 -2
- package/dist/entry-preview.js +1 -1
- package/dist/index.js +3 -5
- package/dist/preset.js +3 -3
- package/dist/preview.js +2 -2
- package/package.json +3 -6
- package/template/components/index.js +0 -2
|
@@ -18,7 +18,6 @@ __export(entry_preview_exports, {
|
|
|
18
18
|
});
|
|
19
19
|
import * as React4 from "react";
|
|
20
20
|
import { Tag } from "storybook/internal/preview-api";
|
|
21
|
-
import { global as global2 } from "@storybook/global";
|
|
22
21
|
import { configure } from "storybook/test";
|
|
23
22
|
|
|
24
23
|
// src/act-compat.ts
|
|
@@ -102,8 +101,7 @@ var render = (args, context) => {
|
|
|
102
101
|
|
|
103
102
|
// src/renderToCanvas.tsx
|
|
104
103
|
import React3, { Fragment, Component as ReactComponent, StrictMode } from "react";
|
|
105
|
-
|
|
106
|
-
var { FRAMEWORK_OPTIONS } = global, ErrorBoundary = class extends ReactComponent {
|
|
104
|
+
var { FRAMEWORK_OPTIONS } = globalThis, ErrorBoundary = class extends ReactComponent {
|
|
107
105
|
constructor() {
|
|
108
106
|
super(...arguments);
|
|
109
107
|
this.state = { hasError: !1 };
|
|
@@ -181,7 +179,7 @@ var decorators = [
|
|
|
181
179
|
return React4.createElement(React4.Suspense, null, story());
|
|
182
180
|
},
|
|
183
181
|
(story, context) => {
|
|
184
|
-
if (context.tags?.includes(Tag.TEST_FN) && !
|
|
182
|
+
if (context.tags?.includes(Tag.TEST_FN) && !globalThis.FEATURES?.experimentalTestSyntax)
|
|
185
183
|
throw new Error(
|
|
186
184
|
"To use the experimental test function, you must enable the experimentalTestSyntax feature flag. See https://storybook.js.org/docs/api/main-config/main-config-features#experimentaltestsyntax"
|
|
187
185
|
);
|
|
@@ -4202,7 +4202,7 @@ import { logger as logger2 } from "storybook/internal/node-logger";
|
|
|
4202
4202
|
|
|
4203
4203
|
// src/componentManifest/componentMeta/componentMetaExtractor.ts
|
|
4204
4204
|
import { extractComponentJsDocInfo } from "storybook/internal/component-meta";
|
|
4205
|
-
var LARGE_SOURCE_THRESHOLD = 30, MAX_UNWRAP_DEPTH = 5, MAX_SERIALIZATION_DEPTH = 5;
|
|
4205
|
+
var LARGE_SOURCE_THRESHOLD = 30, MAX_UNWRAP_DEPTH = 5, MAX_SERIALIZATION_DEPTH = 5, ARRAY_SYMBOL_NAMES = /* @__PURE__ */ new Set(["Array", "ReadonlyArray"]);
|
|
4206
4206
|
function isLiteralType(type) {
|
|
4207
4207
|
return type.isStringLiteral() || type.isNumberLiteral();
|
|
4208
4208
|
}
|
|
@@ -4526,10 +4526,29 @@ function serializeType(typescript, checker, type, isRequired, depth = 0, declare
|
|
|
4526
4526
|
}))
|
|
4527
4527
|
};
|
|
4528
4528
|
if (!isRequired && nonUndefinedTypes.length === 1 && nonUndefinedTypes.length < type.types.length)
|
|
4529
|
-
return
|
|
4529
|
+
return serializeLeaf(typescript, checker, nonUndefinedTypes[0], depth);
|
|
4530
|
+
let nonNullishTypes = nonUndefinedTypes.filter(
|
|
4531
|
+
(t) => !(t.getFlags() & typescript.TypeFlags.Null)
|
|
4532
|
+
);
|
|
4533
|
+
if (nonNullishTypes.length === 1 && isArrayType(nonNullishTypes[0]))
|
|
4534
|
+
return {
|
|
4535
|
+
name: checker.typeToString(type),
|
|
4536
|
+
element: serializeElement(typescript, checker, nonNullishTypes[0], depth)
|
|
4537
|
+
};
|
|
4530
4538
|
}
|
|
4531
4539
|
let constraint = type.getConstraint?.();
|
|
4532
|
-
return constraint && constraint !== type ? serializeType(typescript, checker, constraint, isRequired, depth + 1) :
|
|
4540
|
+
return constraint && constraint !== type ? serializeType(typescript, checker, constraint, isRequired, depth + 1) : serializeLeaf(typescript, checker, type, depth);
|
|
4541
|
+
}
|
|
4542
|
+
function isArrayType(type) {
|
|
4543
|
+
return ARRAY_SYMBOL_NAMES.has(type.getSymbol()?.getName() ?? "");
|
|
4544
|
+
}
|
|
4545
|
+
function serializeLeaf(typescript, checker, type, depth) {
|
|
4546
|
+
let name = checker.typeToString(type);
|
|
4547
|
+
return isArrayType(type) ? { name, element: serializeElement(typescript, checker, type, depth) } : { name };
|
|
4548
|
+
}
|
|
4549
|
+
function serializeElement(typescript, checker, arrayType, depth) {
|
|
4550
|
+
let [element] = checker.getTypeArguments(arrayType);
|
|
4551
|
+
return serializeType(typescript, checker, element, !0, depth + 1);
|
|
4533
4552
|
}
|
|
4534
4553
|
function unwrapToFunction(typescript, node, depth = 0, checker) {
|
|
4535
4554
|
if (!(depth > MAX_UNWRAP_DEPTH)) {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
isExtractable,
|
|
4
4
|
posix,
|
|
5
5
|
resolveStoryFileComponents
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2I5WCK5H.js";
|
|
7
7
|
import {
|
|
8
8
|
extractArgTypes
|
|
9
9
|
} from "./chunk-SC3QXTHH.js";
|
|
@@ -15,16 +15,27 @@ var REACT_ATTRIBUTE_INTERFACES = /* @__PURE__ */ new Set(["Attributes", "RefAttr
|
|
|
15
15
|
function isReactAttribute(prop) {
|
|
16
16
|
return !!prop.parent && REACT_ATTRIBUTE_INTERFACES.has(prop.parent.name) && /(^|[\\/])node_modules[\\/]/.test(prop.parent.fileName);
|
|
17
17
|
}
|
|
18
|
+
function toDocgenType({ element, ...type }) {
|
|
19
|
+
return element ? { name: "array", raw: type.name, value: toDocgenType(element) } : type;
|
|
20
|
+
}
|
|
18
21
|
function extractArgTypesFromComponentMeta(componentMeta) {
|
|
19
22
|
if (!componentMeta)
|
|
20
23
|
return;
|
|
21
24
|
let props = Object.fromEntries(
|
|
22
25
|
Object.entries(componentMeta.props).filter(([, prop]) => !isReactAttribute(prop)).map(([name, prop]) => [
|
|
23
26
|
name,
|
|
24
|
-
|
|
27
|
+
{
|
|
28
|
+
...prop,
|
|
29
|
+
type: toDocgenType(prop.type),
|
|
30
|
+
defaultValue: prop.defaultValue && { ...prop.defaultValue, computed: !1 }
|
|
31
|
+
}
|
|
25
32
|
])
|
|
26
|
-
);
|
|
27
|
-
|
|
33
|
+
), argTypes = extractArgTypes({ __docgenInfo: { ...componentMeta, props } }) ?? void 0;
|
|
34
|
+
for (let [name, prop] of Object.entries(componentMeta.props)) {
|
|
35
|
+
let table = argTypes?.[name]?.table;
|
|
36
|
+
prop.type.element && table && (table.type = { summary: prop.type.name });
|
|
37
|
+
}
|
|
38
|
+
return argTypes;
|
|
28
39
|
}
|
|
29
40
|
function addArgTypesFromComponentMeta(payload) {
|
|
30
41
|
let argTypes = extractArgTypesFromComponentMeta(payload.reactComponentMeta), subcomponents = payload.subcomponents ? Object.fromEntries(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRequire as
|
|
1
|
+
import { createRequire as CJS_COMPAT_CREATE_REQUIRE_juebbzyx8w } from "node:module";var require = CJS_COMPAT_CREATE_REQUIRE_juebbzyx8w(import.meta.url);
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSharedComponentMetaManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ITCF7APG.js";
|
|
4
4
|
import {
|
|
5
5
|
extractArgTypesFromComponentMeta
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-LZBEMUVF.js";
|
|
7
|
+
import "./chunk-2I5WCK5H.js";
|
|
8
8
|
import "./chunk-MYBSMCSW.js";
|
|
9
9
|
import "./chunk-CJ2XYAXX.js";
|
|
10
10
|
import "./chunk-SC3QXTHH.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildDocgenPayloads
|
|
3
|
-
} from "../_node-chunks/chunk-
|
|
3
|
+
} from "../_node-chunks/chunk-LZBEMUVF.js";
|
|
4
4
|
import {
|
|
5
5
|
ComponentMetaManager,
|
|
6
6
|
loadDocgenTypeScript
|
|
7
|
-
} from "../_node-chunks/chunk-
|
|
7
|
+
} from "../_node-chunks/chunk-2I5WCK5H.js";
|
|
8
8
|
import "../_node-chunks/chunk-MYBSMCSW.js";
|
|
9
9
|
import "../_node-chunks/chunk-CJ2XYAXX.js";
|
|
10
10
|
import "../_node-chunks/chunk-SC3QXTHH.js";
|
package/dist/entry-preview.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__definePreview
|
|
3
|
-
} from "./_browser-chunks/chunk-
|
|
3
|
+
} from "./_browser-chunks/chunk-RHGZ5MD3.js";
|
|
4
4
|
import {
|
|
5
5
|
entry_preview_exports,
|
|
6
6
|
renderToCanvas
|
|
7
|
-
} from "./_browser-chunks/chunk-
|
|
7
|
+
} from "./_browser-chunks/chunk-MB4PPIXP.js";
|
|
8
8
|
import {
|
|
9
9
|
entry_preview_argtypes_exports
|
|
10
10
|
} from "./_browser-chunks/chunk-WWHCZJWM.js";
|
|
@@ -14,9 +14,7 @@ import "./_browser-chunks/chunk-B3FR4PBN.js";
|
|
|
14
14
|
import "./_browser-chunks/chunk-UAWMPV5J.js";
|
|
15
15
|
|
|
16
16
|
// src/globals.ts
|
|
17
|
-
|
|
18
|
-
var { window: globalWindow } = global;
|
|
19
|
-
globalWindow && (globalWindow.STORYBOOK_ENV = "react");
|
|
17
|
+
globalThis.STORYBOOK_ENV = "react";
|
|
20
18
|
|
|
21
19
|
// src/portable-stories.tsx
|
|
22
20
|
import * as React from "react";
|
package/dist/preset.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./_node-chunks/chunk-HRHJMJC7.js";
|
|
4
4
|
import {
|
|
5
5
|
getSharedComponentMetaManager
|
|
6
|
-
} from "./_node-chunks/chunk-
|
|
6
|
+
} from "./_node-chunks/chunk-ITCF7APG.js";
|
|
7
7
|
import {
|
|
8
8
|
buildReactComponentDocgenFromResolved,
|
|
9
9
|
buildStoryDocsFromResolved,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
join,
|
|
14
14
|
posix,
|
|
15
15
|
resolveStoryFileComponents
|
|
16
|
-
} from "./_node-chunks/chunk-
|
|
16
|
+
} from "./_node-chunks/chunk-2I5WCK5H.js";
|
|
17
17
|
import {
|
|
18
18
|
REACT_DOCGEN_TYPESCRIPT_APIS
|
|
19
19
|
} from "./_node-chunks/chunk-MYBSMCSW.js";
|
|
@@ -379,7 +379,7 @@ async function internal_getArgTypesData(_input, options) {
|
|
|
379
379
|
return null;
|
|
380
380
|
let absoluteComponentFilePath = path2.isAbsolute(componentFilePath) ? componentFilePath : join3(getProjectRoot(), componentFilePath);
|
|
381
381
|
if ((await presets?.apply("features", {}))?.docgenServer) {
|
|
382
|
-
let { extractArgTypesFromComponentFile } = await import("./_node-chunks/extractArgTypesFromComponentFile-
|
|
382
|
+
let { extractArgTypesFromComponentFile } = await import("./_node-chunks/extractArgTypesFromComponentFile-BBV3XDO4.js");
|
|
383
383
|
return extractArgTypesFromComponentFile({
|
|
384
384
|
componentFilePath: absoluteComponentFilePath,
|
|
385
385
|
componentExportName,
|
package/dist/preview.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__definePreview
|
|
3
|
-
} from "./_browser-chunks/chunk-
|
|
4
|
-
import "./_browser-chunks/chunk-
|
|
3
|
+
} from "./_browser-chunks/chunk-RHGZ5MD3.js";
|
|
4
|
+
import "./_browser-chunks/chunk-MB4PPIXP.js";
|
|
5
5
|
import "./_browser-chunks/chunk-WWHCZJWM.js";
|
|
6
6
|
import "./_browser-chunks/chunk-XQNZ5YRO.js";
|
|
7
7
|
import "./_browser-chunks/chunk-DDIRQRCA.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react",
|
|
3
|
-
"version": "11.0.0-
|
|
3
|
+
"version": "11.0.0-rc.1",
|
|
4
4
|
"description": "Storybook React renderer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -52,11 +52,8 @@
|
|
|
52
52
|
"*.d.ts",
|
|
53
53
|
"!src/**/*"
|
|
54
54
|
],
|
|
55
|
-
"dependencies": {
|
|
56
|
-
"@storybook/global": "^5.0.0"
|
|
57
|
-
},
|
|
58
55
|
"devDependencies": {
|
|
59
|
-
"@storybook/component-meta-typescript": "11.0.0-
|
|
56
|
+
"@storybook/component-meta-typescript": "11.0.0-rc.1",
|
|
60
57
|
"@types/babel-plugin-react-docgen": "^4.2.3",
|
|
61
58
|
"@types/escodegen": "^0.0.6",
|
|
62
59
|
"@types/estree": "^1.0.6",
|
|
@@ -90,7 +87,7 @@
|
|
|
90
87
|
"react-docgen": "^8.0.2",
|
|
91
88
|
"react-docgen-typescript": "^2.2.2",
|
|
92
89
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
93
|
-
"storybook": "^11.0.0-
|
|
90
|
+
"storybook": "^11.0.0-rc.1",
|
|
94
91
|
"typescript": "^5.9.0 || ^6.0.0 || ^7.0.0"
|
|
95
92
|
},
|
|
96
93
|
"peerDependenciesMeta": {
|