@storybook/react-dom-shim 7.0.6 → 7.0.8
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/react-16.mjs +5 -1
- package/dist/react-18.mjs +6 -1
- package/package.json +11 -12
- package/dist/preset.mjs +0 -1
package/dist/react-16.mjs
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import ReactDOM from
|
|
1
|
+
import ReactDOM from 'react-dom';
|
|
2
|
+
|
|
3
|
+
var renderElement=async(node,el)=>new Promise(resolve=>{ReactDOM.render(node,el,()=>resolve(null));}),unmountElement=el=>{ReactDOM.unmountComponentAtNode(el);};
|
|
4
|
+
|
|
5
|
+
export { renderElement, unmountElement };
|
package/dist/react-18.mjs
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
import React,
|
|
1
|
+
import React, { useRef, useLayoutEffect } from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom/client';
|
|
3
|
+
|
|
4
|
+
var nodes=new Map,WithCallback=({callback,children})=>{let once=useRef();return useLayoutEffect(()=>{once.current!==callback&&(once.current=callback,callback());},[callback]),children},renderElement=async(node,el)=>{let root=await getReactRoot(el);return new Promise(resolve=>{root.render(React.createElement(WithCallback,{callback:()=>resolve(null)},node));})},unmountElement=(el,shouldUseNewRootApi)=>{let root=nodes.get(el);root&&(root.unmount(),nodes.delete(el));},getReactRoot=async el=>{let root=nodes.get(el);return root||(root=ReactDOM.createRoot(el),nodes.set(el,root)),root};
|
|
5
|
+
|
|
6
|
+
export { renderElement, unmountElement };
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-dom-shim",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
7
7
|
],
|
|
8
|
-
"homepage": "https://github.com/storybookjs/storybook/tree/
|
|
8
|
+
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/lib/react-dom-shim",
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/storybookjs/storybook/issues"
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
14
|
"url": "https://github.com/storybookjs/storybook.git",
|
|
15
|
-
"directory": "lib/react-dom-shim"
|
|
15
|
+
"directory": "code/lib/react-dom-shim"
|
|
16
16
|
},
|
|
17
17
|
"funding": {
|
|
18
18
|
"type": "opencollective",
|
|
@@ -22,21 +22,20 @@
|
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
|
+
"types": "./dist/react-16.d.ts",
|
|
25
26
|
"node": "./dist/react-16.js",
|
|
26
27
|
"require": "./dist/react-16.js",
|
|
27
|
-
"import": "./dist/react-16.mjs"
|
|
28
|
-
"types": "./dist/react-16.d.ts"
|
|
28
|
+
"import": "./dist/react-16.mjs"
|
|
29
29
|
},
|
|
30
30
|
"./dist/react-18": {
|
|
31
|
+
"types": "./dist/react-18.d.ts",
|
|
31
32
|
"node": "./dist/react-18.js",
|
|
32
33
|
"require": "./dist/react-18.js",
|
|
33
|
-
"import": "./dist/react-18.mjs"
|
|
34
|
-
"types": "./dist/react-18.d.ts"
|
|
34
|
+
"import": "./dist/react-18.mjs"
|
|
35
35
|
},
|
|
36
36
|
"./dist/preset": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"types": "./dist/preset.d.ts"
|
|
37
|
+
"types": "./dist/preset.d.ts",
|
|
38
|
+
"require": "./dist/preset.js"
|
|
40
39
|
},
|
|
41
40
|
"./package.json": "./package.json"
|
|
42
41
|
},
|
|
@@ -54,7 +53,7 @@
|
|
|
54
53
|
"prep": "../../../scripts/prepare/bundle.ts"
|
|
55
54
|
},
|
|
56
55
|
"devDependencies": {
|
|
57
|
-
"@storybook/types": "7.0.
|
|
56
|
+
"@storybook/types": "7.0.8",
|
|
58
57
|
"typescript": "~4.9.3"
|
|
59
58
|
},
|
|
60
59
|
"peerDependencies": {
|
|
@@ -71,5 +70,5 @@
|
|
|
71
70
|
"./src/react-18.tsx"
|
|
72
71
|
]
|
|
73
72
|
},
|
|
74
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "9991b68c7d0cd1543c974f358cae9e0d02b29e7e"
|
|
75
74
|
}
|
package/dist/preset.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{version}from"react-dom/package.json";var webpackFinal=async(config,options)=>{let{legacyRootApi}=await options.presets.apply("frameworkOptions")||{},isReact18=version.startsWith("18")||version.startsWith("0.0.0");return legacyRootApi??!isReact18?config:{...config,resolve:{...config.resolve,alias:{...config.resolve?.alias,"@storybook/react-dom-shim":"@storybook/react-dom-shim/dist/react-18"}}}},viteFinal=async(config,options)=>{let{legacyRootApi}=await options.presets.apply("frameworkOptions")||{},isReact18=version.startsWith("18")||version.startsWith("0.0.0");if(legacyRootApi||!isReact18)return config;let alias=Array.isArray(config.resolve?.alias)?config.resolve.alias.concat({find:/^@storybook\/react-dom-shim$/,replacement:"@storybook/react-dom-shim/dist/react-18"}):{...config.resolve?.alias,"@storybook/react-dom-shim":"@storybook/react-dom-shim/dist/react-18"};return{...config,resolve:{...config.resolve,alias}}};export{viteFinal,webpackFinal};
|