@storybook/react 11.0.0-beta.1 → 11.0.0-beta.2
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-2TQVKMJE.js → chunk-EA5DV32Q.js} +36 -1
- package/dist/_browser-chunks/{chunk-6MBKXM7O.js → chunk-U7XUEUFQ.js} +2 -2
- package/dist/_browser-chunks/{chunk-LGSTPTL6.js → chunk-WWHCZJWM.js} +10 -9
- package/dist/_node-chunks/{chunk-37XDLJI5.js → chunk-2DNUEB5U.js} +18 -17
- package/dist/_node-chunks/{chunk-RVHW3VEA.js → chunk-ASUAJQT5.js} +6 -6
- package/dist/_node-chunks/{chunk-FCIBS77S.js → chunk-BWU7O3KC.js} +7 -7
- package/dist/_node-chunks/{chunk-IYZUDUNZ.js → chunk-DW2HJ23M.js} +7 -7
- package/dist/_node-chunks/{chunk-U53ZMSA3.js → chunk-PXKXGEPO.js} +1716 -515
- package/dist/_node-chunks/{chunk-YNIH7TZQ.js → chunk-QRCEILHM.js} +8 -8
- package/dist/_node-chunks/chunk-TP7UUO2M.js +18 -0
- package/dist/_node-chunks/{chunk-GQOGANUK.js → chunk-VQBUQHU3.js} +11 -13
- package/dist/_node-chunks/{chunk-PPFRYFMF.js → chunk-XIFLZILW.js} +16 -8
- package/dist/_node-chunks/{chunk-FUHORIY7.js → chunk-XQPV7U3R.js} +9 -9
- package/dist/_node-chunks/{extractArgTypesFromComponentFile-EQEZZAHL.js → extractArgTypesFromComponentFile-PKEIPQGN.js} +17 -15
- package/dist/_node-chunks/{extractReactDocgenInfo-COAPYCG6.js → extractReactDocgenInfo-J6CKNSQN.js} +11 -11
- package/dist/_node-chunks/{extractReactTypescriptDocgenInfo-7FFDIBEA.js → extractReactTypescriptDocgenInfo-AJTC3KA3.js} +9 -9
- package/dist/_node-chunks/reactDocgen-YAGNM6ZQ.js +26 -0
- package/dist/builder-docgen.d.ts +2 -2
- package/dist/builder-docgen.js +9 -8
- package/dist/docgen/docgen-worker.js +22 -18
- package/dist/entry-preview-argtypes.js +1 -1
- package/dist/entry-preview-docs.js +1 -1
- package/dist/index.js +3 -3
- package/dist/preset.js +35 -25
- package/dist/preview.js +3 -3
- package/package.json +5 -3
- package/dist/_node-chunks/reactDocgen-6ZJPM2YE.js +0 -26
|
@@ -18,6 +18,40 @@ __export(entry_preview_docs_exports, {
|
|
|
18
18
|
parameters: () => parameters
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
+
// src/docs/print-hole.ts
|
|
22
|
+
import { printValue, unknownHoleKind } from "storybook/internal/docs-tools";
|
|
23
|
+
|
|
24
|
+
// src/snippet-values.ts
|
|
25
|
+
var unmarked = (_, text) => text, isAttributeName = (name) => /^[A-Za-z_][A-Za-z0-9_:-]*$/.test(name), isAttributeText = (text) => !/["&\r\n]/.test(text), isChildText = (text) => !/[{}<>&\r\n]/.test(text), valueCode = (value) => value.kind === "boolean" ? String(value.value) : value.code, printAttribute = (name, value) => value.kind === "boolean" ? value.value ? name : `${name}={false}` : value.kind === "string" && isAttributeText(value.value) ? `${name}="${value.value}"` : `${name}={${value.code}}`, printAttributes = (args, mark = unmarked) => {
|
|
26
|
+
let unnamed = args.filter(([name]) => !isAttributeName(name)), attributes = args.filter(([name]) => isAttributeName(name)).map(([name, value]) => mark({ kind: "attr", arg: name }, printAttribute(name, value)));
|
|
27
|
+
if (unnamed.length !== 0) {
|
|
28
|
+
let members = unnamed.map(
|
|
29
|
+
([name, value]) => `${JSON.stringify(name)}: ${mark({ kind: "value", arg: name }, valueCode(value))}`
|
|
30
|
+
);
|
|
31
|
+
attributes.push(`{...{ ${members.join(", ")} }}`);
|
|
32
|
+
}
|
|
33
|
+
return attributes;
|
|
34
|
+
}, printChildren = (value) => value.kind === "string" && isChildText(value.value) ? value.value : value.kind === "jsx" ? value.code : `{${valueCode(value)}}`;
|
|
35
|
+
|
|
36
|
+
// src/docs/print-hole.ts
|
|
37
|
+
var printHole = (hole, value) => {
|
|
38
|
+
let arg = hole.arg ?? "";
|
|
39
|
+
switch (hole.kind) {
|
|
40
|
+
case "attr":
|
|
41
|
+
return value === void 0 ? "" : printAttribute(hole.name ?? arg, toJsxValue(arg, value));
|
|
42
|
+
case "text":
|
|
43
|
+
return value === void 0 ? "" : printChildren(toJsxValue(arg, value));
|
|
44
|
+
case "value":
|
|
45
|
+
return printValue(value, arg);
|
|
46
|
+
case "attrs":
|
|
47
|
+
return printAttributes(
|
|
48
|
+
Object.entries(value).filter(([name]) => !hole.except.includes(name)).map(([name, item]) => [name, toJsxValue(name, item)])
|
|
49
|
+
).map((attribute) => ` ${attribute}`).join("");
|
|
50
|
+
default:
|
|
51
|
+
return unknownHoleKind(hole);
|
|
52
|
+
}
|
|
53
|
+
}, toJsxValue = (name, value) => typeof value == "boolean" ? { kind: "boolean", value } : typeof value == "string" ? { kind: "string", value, code: printValue(value, name) } : { kind: "code", code: printValue(value, name) };
|
|
54
|
+
|
|
21
55
|
// src/docs/jsxDecorator.tsx
|
|
22
56
|
import React, { createElement, isValidElement } from "react";
|
|
23
57
|
import { logger } from "storybook/internal/client-logger";
|
|
@@ -131,7 +165,8 @@ var applyDecorators2 = (storyFn, decorators2) => {
|
|
|
131
165
|
// src/entry-preview-docs.ts
|
|
132
166
|
var useStaticServiceSnippets = "FEATURES" in globalThis && globalThis?.FEATURES?.docgenServer, useCompileTimeSnippets = "FEATURES" in globalThis && globalThis?.FEATURES?.experimentalCodeExamples, decorators = useStaticServiceSnippets || useCompileTimeSnippets ? [] : [jsxDecorator], parameters = {
|
|
133
167
|
docs: {
|
|
134
|
-
story: { inline: !0 }
|
|
168
|
+
story: { inline: !0 },
|
|
169
|
+
...useStaticServiceSnippets ? { source: { printHole } } : {}
|
|
135
170
|
}
|
|
136
171
|
};
|
|
137
172
|
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-I62VTYU3.js";
|
|
4
4
|
import {
|
|
5
5
|
entry_preview_argtypes_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WWHCZJWM.js";
|
|
7
7
|
import {
|
|
8
8
|
entry_preview_docs_exports
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EA5DV32Q.js";
|
|
10
10
|
|
|
11
11
|
// src/preview.tsx
|
|
12
12
|
import { definePreview as definePreviewBase } from "storybook/internal/csf";
|
|
@@ -5949,22 +5949,23 @@ function generateCode(ast, compact = !1) {
|
|
|
5949
5949
|
return (0, import_escodegen.generate)(ast, compact ? COMPACT_OPTIONS : PRETTY_OPTIONS);
|
|
5950
5950
|
}
|
|
5951
5951
|
function generateObjectCode(ast, compact = !1) {
|
|
5952
|
-
return compact ?
|
|
5953
|
-
}
|
|
5954
|
-
function generateCompactObjectCode(ast) {
|
|
5955
|
-
let result = generateCode(ast, !0);
|
|
5956
|
-
return result.endsWith(" }") || (result = `${result.slice(0, -1)} }`), result;
|
|
5952
|
+
return compact ? generateCompactCode(ast) : generateCode(ast);
|
|
5957
5953
|
}
|
|
5958
5954
|
function generateArrayCode(ast, compact = !1) {
|
|
5959
|
-
return compact ?
|
|
5955
|
+
return compact ? generateCompactCode(ast) : generateMultilineArrayCode(ast);
|
|
5960
5956
|
}
|
|
5961
5957
|
function generateMultilineArrayCode(ast) {
|
|
5962
5958
|
let result = generateCode(ast);
|
|
5963
5959
|
return result.endsWith(" }]") && (result = dedent(result)), result;
|
|
5964
5960
|
}
|
|
5965
|
-
function
|
|
5966
|
-
|
|
5967
|
-
|
|
5961
|
+
function generateCompactCode(ast) {
|
|
5962
|
+
return ast.type === "ArrayExpression" ? `[${ast.elements.map(generateCompactCode).join(", ")}]` : ast.type === "ObjectExpression" ? `{ ${ast.properties.map(generateCompactProperty).join(", ")} }` : generateCode(ast, !0);
|
|
5963
|
+
}
|
|
5964
|
+
function generateCompactProperty(property) {
|
|
5965
|
+
if (property.type !== "Property" || property.kind !== "init" || property.method || property.shorthand)
|
|
5966
|
+
return generateCode(property, !0);
|
|
5967
|
+
let key = generateCode(property.key, !0);
|
|
5968
|
+
return `${property.computed ? `[${key}]` : key}: ${generateCompactCode(property.value)}`;
|
|
5968
5969
|
}
|
|
5969
5970
|
|
|
5970
5971
|
// src/docs/lib/inspection/acornParser.ts
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0pbco1v5vos from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0pbco1v5vos from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0pbco1v5vos from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0pbco1v5vos.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0pbco1v5vos.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0pbco1v5vos.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
|
import {
|
|
13
13
|
require_dist
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-BWU7O3KC.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
17
|
__esm,
|
|
18
18
|
__export,
|
|
19
19
|
__toCommonJS,
|
|
20
20
|
__toESM
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-ASUAJQT5.js";
|
|
22
22
|
|
|
23
23
|
// ../../../node_modules/estraverse/estraverse.js
|
|
24
24
|
var require_estraverse = __commonJS({
|
|
@@ -7191,22 +7191,23 @@ function generateCode(ast, compact = !1) {
|
|
|
7191
7191
|
return (0, import_escodegen.generate)(ast, compact ? COMPACT_OPTIONS : PRETTY_OPTIONS);
|
|
7192
7192
|
}
|
|
7193
7193
|
function generateObjectCode(ast, compact = !1) {
|
|
7194
|
-
return compact ?
|
|
7195
|
-
}
|
|
7196
|
-
function generateCompactObjectCode(ast) {
|
|
7197
|
-
let result = generateCode(ast, !0);
|
|
7198
|
-
return result.endsWith(" }") || (result = `${result.slice(0, -1)} }`), result;
|
|
7194
|
+
return compact ? generateCompactCode(ast) : generateCode(ast);
|
|
7199
7195
|
}
|
|
7200
7196
|
function generateArrayCode(ast, compact = !1) {
|
|
7201
|
-
return compact ?
|
|
7197
|
+
return compact ? generateCompactCode(ast) : generateMultilineArrayCode(ast);
|
|
7202
7198
|
}
|
|
7203
7199
|
function generateMultilineArrayCode(ast) {
|
|
7204
7200
|
let result = generateCode(ast);
|
|
7205
7201
|
return result.endsWith(" }]") && (result = (0, import_ts_dedent.dedent)(result)), result;
|
|
7206
7202
|
}
|
|
7207
|
-
function
|
|
7208
|
-
|
|
7209
|
-
|
|
7203
|
+
function generateCompactCode(ast) {
|
|
7204
|
+
return ast.type === "ArrayExpression" ? `[${ast.elements.map(generateCompactCode).join(", ")}]` : ast.type === "ObjectExpression" ? `{ ${ast.properties.map(generateCompactProperty).join(", ")} }` : generateCode(ast, !0);
|
|
7205
|
+
}
|
|
7206
|
+
function generateCompactProperty(property) {
|
|
7207
|
+
if (property.type !== "Property" || property.kind !== "init" || property.method || property.shorthand)
|
|
7208
|
+
return generateCode(property, !0);
|
|
7209
|
+
let key = generateCode(property.key, !0);
|
|
7210
|
+
return `${property.computed ? `[${key}]` : key}: ${generateCompactCode(property.value)}`;
|
|
7210
7211
|
}
|
|
7211
7212
|
|
|
7212
7213
|
// src/docs/lib/inspection/acornParser.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0pbco1v5vos from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0pbco1v5vos from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0pbco1v5vos from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0pbco1v5vos.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0pbco1v5vos.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0pbco1v5vos.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0pbco1v5vos from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0pbco1v5vos from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0pbco1v5vos from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0pbco1v5vos.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0pbco1v5vos.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0pbco1v5vos.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
|
import {
|
|
13
13
|
__commonJS
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ASUAJQT5.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/ts-dedent/dist/index.js
|
|
17
17
|
var require_dist = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0pbco1v5vos from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0pbco1v5vos from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0pbco1v5vos from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0pbco1v5vos.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0pbco1v5vos.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0pbco1v5vos.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
__commonJS,
|
|
14
14
|
__require,
|
|
15
15
|
__toESM
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ASUAJQT5.js";
|
|
17
17
|
|
|
18
18
|
// ../../../node_modules/tsconfig-paths/lib/filesystem.js
|
|
19
19
|
var require_filesystem = __commonJS({
|