@storybook/react 11.0.0-alpha.0 → 11.0.0-alpha.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-64GECWYS.js → chunk-A624C5GY.js} +2 -2
- package/dist/_browser-chunks/{chunk-5GZAZJC7.js → chunk-LGSTPTL6.js} +1 -2
- package/dist/_browser-chunks/{chunk-7HUHAOMV.js → chunk-XD4PMI7Q.js} +12 -4
- package/dist/_browser-chunks/react-dom-client-CF4ABZ4W.js +41 -0
- package/dist/_node-chunks/{chunk-R6ESE7F3.js → chunk-T4O4UWGP.js} +234 -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 +1213 -20
- 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
|
}
|
|
@@ -107,7 +107,7 @@ var { FRAMEWORK_OPTIONS } = global, ErrorBoundary = class extends ReactComponent
|
|
|
107
107
|
let { hasError } = this.state, { children } = this.props;
|
|
108
108
|
return hasError ? null : children;
|
|
109
109
|
}
|
|
110
|
-
}, Wrapper = FRAMEWORK_OPTIONS?.strictMode ? StrictMode : Fragment, actQueue = [], isActing = !1, processActQueue = async () => {
|
|
110
|
+
}, Wrapper = FRAMEWORK_OPTIONS?.strictMode ? StrictMode : Fragment, actQueue = [], isActing = !1, remountCounts = /* @__PURE__ */ new WeakMap(), processActQueue = async () => {
|
|
111
111
|
if (isActing || actQueue.length === 0)
|
|
112
112
|
return;
|
|
113
113
|
isActing = !0;
|
|
@@ -121,9 +121,17 @@ async function renderToCanvas({
|
|
|
121
121
|
showException,
|
|
122
122
|
forceRemount
|
|
123
123
|
}, canvasElement) {
|
|
124
|
-
let { renderElement, unmountElement } = await import("
|
|
125
|
-
forceRemount && unmountElement(canvasElement);
|
|
126
|
-
let
|
|
124
|
+
let { renderElement, unmountElement } = await import("./react-dom-client-CF4ABZ4W.js"), Story = unboundStoryFn, isPortableStory = storyContext.parameters.__isPortableStory;
|
|
125
|
+
forceRemount && (isPortableStory ? unmountElement(canvasElement) : remountCounts.set(canvasElement, (remountCounts.get(canvasElement) ?? 0) + 1));
|
|
126
|
+
let content = isPortableStory ? React3.createElement(Story, { ...storyContext }) : React3.createElement(
|
|
127
|
+
ErrorBoundary,
|
|
128
|
+
{
|
|
129
|
+
key: `${storyContext.id}-${remountCounts.get(canvasElement) ?? 0}`,
|
|
130
|
+
showMain,
|
|
131
|
+
showException
|
|
132
|
+
},
|
|
133
|
+
React3.createElement(Story, { ...storyContext })
|
|
134
|
+
), element = Wrapper ? React3.createElement(Wrapper, null, content) : content, act = await getAct({ disableAct: storyContext.viewMode === "docs" });
|
|
127
135
|
return await new Promise(async (resolve, reject) => {
|
|
128
136
|
actQueue.push(async () => {
|
|
129
137
|
try {
|
|
@@ -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
|
+
};
|