@storybook/react 10.5.0-alpha.3 → 10.5.0-alpha.5
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-E4YOXNOQ.js → chunk-GOMPYXOS.js} +1 -1
- package/dist/_browser-chunks/{chunk-CMP5DLKH.js → chunk-JQJMT7FV.js} +26 -3
- package/dist/_browser-chunks/{chunk-77RIPXG7.js → chunk-K2MYE2K3.js} +1 -1
- package/dist/_browser-chunks/{chunk-GUVY6QMW.js → chunk-SKX2IJJR.js} +2 -2
- package/dist/entry-preview-argtypes.js +2 -2
- package/dist/entry-preview-docs.js +2 -2
- package/dist/index.js +4 -4
- package/dist/preset.js +2344 -2171
- package/dist/preview.js +4 -4
- package/package.json +4 -4
- package/template/cli/js/Button.stories.js +1 -1
- package/template/cli/ts/Button.stories.ts +1 -1
|
@@ -538,7 +538,7 @@ var defaultFunctionValue = inlineFunction, formatFunction = (function(fn, option
|
|
|
538
538
|
var usedValue = hasValue ? value : defaultValue, useBooleanShorthandSyntax = options.useBooleanShorthandSyntax, tabStop = options.tabStop, formattedPropValue = formatPropValue(usedValue, inline, lvl, options), attributeFormattedInline = " ", attributeFormattedMultiline = `
|
|
539
539
|
`.concat(spacer(lvl + 1, tabStop)), isMultilineAttribute = formattedPropValue.includes(`
|
|
540
540
|
`);
|
|
541
|
-
return useBooleanShorthandSyntax && formattedPropValue === "{
|
|
541
|
+
return useBooleanShorthandSyntax && formattedPropValue === "{true}" ? (attributeFormattedInline += "".concat(name), attributeFormattedMultiline += "".concat(name)) : (attributeFormattedInline += "".concat(name, "=").concat(formattedPropValue), attributeFormattedMultiline += "".concat(name, "=").concat(formattedPropValue)), {
|
|
542
542
|
attributeFormattedInline,
|
|
543
543
|
attributeFormattedMultiline,
|
|
544
544
|
isMultilineAttribute
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
isForwardRef,
|
|
6
6
|
isMemo,
|
|
7
7
|
reactElementToJsxString
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GOMPYXOS.js";
|
|
9
9
|
import {
|
|
10
10
|
__export
|
|
11
11
|
} from "./chunk-SL3VIQZ3.js";
|
|
@@ -50,7 +50,29 @@ var renderJsx = (code, options) => {
|
|
|
50
50
|
let displayNameDefaults;
|
|
51
51
|
typeof options?.displayName == "string" ? displayNameDefaults = { showFunctions: !0, displayName: () => options.displayName } : displayNameDefaults = {
|
|
52
52
|
// To get exotic component names resolving properly
|
|
53
|
-
displayName: (el) =>
|
|
53
|
+
displayName: (el) => {
|
|
54
|
+
if (el.type.displayName)
|
|
55
|
+
return el.type.displayName;
|
|
56
|
+
if (getDocgenSection(el.type, "displayName"))
|
|
57
|
+
return getDocgenSection(el.type, "displayName");
|
|
58
|
+
if (el.type.render?.displayName)
|
|
59
|
+
return el.type.render.displayName;
|
|
60
|
+
if (typeof el.type == "symbol" || el.type.$$typeof && typeof el.type.$$typeof == "symbol")
|
|
61
|
+
return getReactSymbolName(el.type);
|
|
62
|
+
if (el.type.name && el.type.name !== "_default")
|
|
63
|
+
return el.type.name;
|
|
64
|
+
if (typeof el.type == "function") {
|
|
65
|
+
let parent = options?.parentComponent;
|
|
66
|
+
if (parent) {
|
|
67
|
+
for (let key of Object.keys(parent))
|
|
68
|
+
if (/^[A-Z]/.test(key) && parent[key] === el.type) {
|
|
69
|
+
let parentName = parent.displayName || parent.name || "";
|
|
70
|
+
return parentName ? `${parentName}.${key}` : key;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return "No Display Name";
|
|
74
|
+
} else return isForwardRef(el.type) ? el.type.render.name : isMemo(el.type) ? el.type.type.name : el.type;
|
|
75
|
+
}
|
|
54
76
|
};
|
|
55
77
|
let opts = {
|
|
56
78
|
...displayNameDefaults,
|
|
@@ -89,7 +111,8 @@ var renderJsx = (code, options) => {
|
|
|
89
111
|
}, jsxDecorator = (storyFn, context) => {
|
|
90
112
|
let jsx = useRef(void 0), story = storyFn(), skip = skipJsxRender(context), options = {
|
|
91
113
|
...defaultOpts,
|
|
92
|
-
...context?.parameters.jsx || {}
|
|
114
|
+
...context?.parameters.jsx || {},
|
|
115
|
+
parentComponent: context?.component
|
|
93
116
|
}, storyJsx = context.originalStoryFn(context.args, context);
|
|
94
117
|
return useEffect(() => {
|
|
95
118
|
if (skip)
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-L3JF7GGZ.js";
|
|
4
4
|
import {
|
|
5
5
|
entry_preview_argtypes_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-K2MYE2K3.js";
|
|
7
7
|
import {
|
|
8
8
|
entry_preview_docs_exports
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JQJMT7FV.js";
|
|
10
10
|
|
|
11
11
|
// src/preview.tsx
|
|
12
12
|
import { definePreview as definePreviewBase } from "storybook/internal/csf";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
argTypesEnhancers,
|
|
3
3
|
parameters
|
|
4
|
-
} from "./_browser-chunks/chunk-
|
|
5
|
-
import "./_browser-chunks/chunk-
|
|
4
|
+
} from "./_browser-chunks/chunk-K2MYE2K3.js";
|
|
5
|
+
import "./_browser-chunks/chunk-GOMPYXOS.js";
|
|
6
6
|
import "./_browser-chunks/chunk-SL3VIQZ3.js";
|
|
7
7
|
export {
|
|
8
8
|
argTypesEnhancers,
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
applyDecorators,
|
|
3
3
|
decorators,
|
|
4
4
|
parameters
|
|
5
|
-
} from "./_browser-chunks/chunk-
|
|
5
|
+
} from "./_browser-chunks/chunk-JQJMT7FV.js";
|
|
6
6
|
import "./_browser-chunks/chunk-DDIRQRCA.js";
|
|
7
|
-
import "./_browser-chunks/chunk-
|
|
7
|
+
import "./_browser-chunks/chunk-GOMPYXOS.js";
|
|
8
8
|
import "./_browser-chunks/chunk-SL3VIQZ3.js";
|
|
9
9
|
export {
|
|
10
10
|
applyDecorators,
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__definePreview
|
|
3
|
-
} from "./_browser-chunks/chunk-
|
|
3
|
+
} from "./_browser-chunks/chunk-SKX2IJJR.js";
|
|
4
4
|
import {
|
|
5
5
|
entry_preview_exports,
|
|
6
6
|
renderToCanvas
|
|
7
7
|
} from "./_browser-chunks/chunk-L3JF7GGZ.js";
|
|
8
8
|
import {
|
|
9
9
|
entry_preview_argtypes_exports
|
|
10
|
-
} from "./_browser-chunks/chunk-
|
|
11
|
-
import "./_browser-chunks/chunk-
|
|
10
|
+
} from "./_browser-chunks/chunk-K2MYE2K3.js";
|
|
11
|
+
import "./_browser-chunks/chunk-JQJMT7FV.js";
|
|
12
12
|
import "./_browser-chunks/chunk-DDIRQRCA.js";
|
|
13
|
-
import "./_browser-chunks/chunk-
|
|
13
|
+
import "./_browser-chunks/chunk-GOMPYXOS.js";
|
|
14
14
|
import "./_browser-chunks/chunk-SL3VIQZ3.js";
|
|
15
15
|
|
|
16
16
|
// src/globals.ts
|