@storybook/react 10.4.1 → 10.4.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-CMP5DLKH.js → chunk-2AEMMVD7.js} +25 -2
- package/dist/_browser-chunks/{chunk-GUVY6QMW.js → chunk-G4UOHMOB.js} +1 -1
- package/dist/entry-preview-docs.js +1 -1
- package/dist/index.d.ts +770 -163
- package/dist/index.js +2 -2
- package/dist/preset.js +6 -6
- package/dist/preview.d.ts +770 -163
- package/dist/preview.js +2 -2
- package/package.json +4 -4
|
@@ -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)
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
applyDecorators,
|
|
3
3
|
decorators,
|
|
4
4
|
parameters
|
|
5
|
-
} from "./_browser-chunks/chunk-
|
|
5
|
+
} from "./_browser-chunks/chunk-2AEMMVD7.js";
|
|
6
6
|
import "./_browser-chunks/chunk-DDIRQRCA.js";
|
|
7
7
|
import "./_browser-chunks/chunk-E4YOXNOQ.js";
|
|
8
8
|
import "./_browser-chunks/chunk-SL3VIQZ3.js";
|