@storybook/react 11.0.0-alpha.1 → 11.0.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-PZ4OU6H4.js → chunk-A624C5GY.js} +2 -2
- package/dist/_browser-chunks/{chunk-5GZAZJC7.js → chunk-LGSTPTL6.js} +1 -2
- package/dist/_browser-chunks/{chunk-XACQAYAZ.js → chunk-XD4PMI7Q.js} +1 -1
- package/dist/_browser-chunks/react-dom-client-CF4ABZ4W.js +41 -0
- package/dist/_node-chunks/{chunk-GFBGFJ4J.js → chunk-ZB4I7IE4.js} +232 -286
- package/dist/chunk-DT7W2slC.d.ts +239 -0
- package/dist/docgen/docgen-worker.js +7 -7
- package/dist/entry-preview-argtypes.js +1 -1
- package/dist/entry-preview.js +1 -1
- package/dist/index.d.ts +866 -3
- package/dist/index.js +3 -3
- package/dist/preset.js +20 -19
- package/dist/preview.d.ts +1 -1
- package/dist/preview.js +3 -3
- package/package.json +7 -8
- package/dist/chunk-ojHmM-yX.d.ts +0 -1104
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
entry_preview_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XD4PMI7Q.js";
|
|
4
4
|
import {
|
|
5
5
|
entry_preview_argtypes_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LGSTPTL6.js";
|
|
7
7
|
import {
|
|
8
8
|
entry_preview_docs_exports
|
|
9
9
|
} from "./chunk-CS62LUFX.js";
|
|
@@ -6446,8 +6446,7 @@ import {
|
|
|
6446
6446
|
|
|
6447
6447
|
// ../../../node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
|
|
6448
6448
|
function isPlainObject(value) {
|
|
6449
|
-
if (!value || typeof value != "object")
|
|
6450
|
-
return !1;
|
|
6449
|
+
if (!value || typeof value != "object") return !1;
|
|
6451
6450
|
let proto = Object.getPrototypeOf(value);
|
|
6452
6451
|
return proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null ? Object.prototype.toString.call(value) === "[object Object]" : !1;
|
|
6453
6452
|
}
|
|
@@ -121,7 +121,7 @@ async function renderToCanvas({
|
|
|
121
121
|
showException,
|
|
122
122
|
forceRemount
|
|
123
123
|
}, canvasElement) {
|
|
124
|
-
let { renderElement, unmountElement } = await import("
|
|
124
|
+
let { renderElement, unmountElement } = await import("./react-dom-client-CF4ABZ4W.js"), Story = unboundStoryFn, isPortableStory = storyContext.parameters.__isPortableStory;
|
|
125
125
|
forceRemount && (isPortableStory ? unmountElement(canvasElement) : remountCounts.set(canvasElement, (remountCounts.get(canvasElement) ?? 0) + 1));
|
|
126
126
|
let content = isPortableStory ? React3.createElement(Story, { ...storyContext }) : React3.createElement(
|
|
127
127
|
ErrorBoundary,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import "./chunk-UAWMPV5J.js";
|
|
2
|
+
|
|
3
|
+
// src/react-dom-client.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import * as ReactDOM from "react-dom/client";
|
|
6
|
+
var nodes = /* @__PURE__ */ new Map(), WithCallback = ({
|
|
7
|
+
callback,
|
|
8
|
+
children
|
|
9
|
+
}) => {
|
|
10
|
+
let once = React.useRef();
|
|
11
|
+
return React.useLayoutEffect(() => {
|
|
12
|
+
once.current !== callback && (once.current = callback, callback());
|
|
13
|
+
}, [callback]), children;
|
|
14
|
+
}, createPromise = () => {
|
|
15
|
+
let resolve;
|
|
16
|
+
return { promise: new Promise((res) => {
|
|
17
|
+
resolve = res;
|
|
18
|
+
}), resolve };
|
|
19
|
+
}, settlePendingRenders = ({ pendingRenders }) => {
|
|
20
|
+
pendingRenders.forEach((resolve) => resolve()), pendingRenders.clear();
|
|
21
|
+
}, renderElement = async (node, el, rootOptions) => {
|
|
22
|
+
let state = nodes.get(el);
|
|
23
|
+
if (state || (state = {
|
|
24
|
+
root: ReactDOM.createRoot(el, rootOptions),
|
|
25
|
+
pendingRenders: /* @__PURE__ */ new Set()
|
|
26
|
+
}, nodes.set(el, state)), settlePendingRenders(state), globalThis.IS_REACT_ACT_ENVIRONMENT) {
|
|
27
|
+
state.root.render(node);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let { promise, resolve } = createPromise(), onCommit = () => {
|
|
31
|
+
state.pendingRenders.delete(onCommit), resolve();
|
|
32
|
+
};
|
|
33
|
+
return state.pendingRenders.add(onCommit), state.root.render(React.createElement(WithCallback, { callback: onCommit }, node)), promise;
|
|
34
|
+
}, unmountElement = (el) => {
|
|
35
|
+
let state = nodes.get(el);
|
|
36
|
+
state && (state.root.unmount(), settlePendingRenders(state), nodes.delete(el));
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
renderElement,
|
|
40
|
+
unmountElement
|
|
41
|
+
};
|