chayns-api 2.1.3-1 → 2.1.3-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.
|
@@ -32,7 +32,10 @@ const withCompatMode = Component => {
|
|
|
32
32
|
ref: innerRef
|
|
33
33
|
})));
|
|
34
34
|
if (typeof ((_ReactDOMClient = ReactDOMClient) === null || _ReactDOMClient === void 0 ? void 0 : _ReactDOMClient.createRoot) === 'function') {
|
|
35
|
-
|
|
35
|
+
// TODO: use non-random value
|
|
36
|
+
this.root = ReactDOMClient.createRoot(this.ref.current, {
|
|
37
|
+
identifierPrefix: crypto.randomUUID()
|
|
38
|
+
});
|
|
36
39
|
this.root.render(component);
|
|
37
40
|
} else {
|
|
38
41
|
_reactDom.default.render(component, this.ref.current);
|
|
@@ -62,6 +62,7 @@ const loadComponent = (scope, module, url, skipCompatMode = false, preventSingle
|
|
|
62
62
|
}
|
|
63
63
|
if (!(module in componentMap[scope]) || registeredScopes[scope] !== url) {
|
|
64
64
|
const promise = loadModule(scope, module, url, preventSingleton).then(async Module => {
|
|
65
|
+
var _sharedReact$lib;
|
|
65
66
|
if (typeof Module.default === 'function') {
|
|
66
67
|
return Module;
|
|
67
68
|
}
|
|
@@ -80,15 +81,8 @@ const loadComponent = (scope, module, url, skipCompatMode = false, preventSingle
|
|
|
80
81
|
}
|
|
81
82
|
});
|
|
82
83
|
});
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
useIn,
|
|
86
|
-
version
|
|
87
|
-
}) => {
|
|
88
|
-
if (!useIn.includes(scope)) return false;
|
|
89
|
-
if (version !== _react.default.version) return false;
|
|
90
|
-
return (lib === null || lib === void 0 ? void 0 : lib()) === _react.default;
|
|
91
|
-
});
|
|
84
|
+
const sharedReact = shareScopes['chayns-api'].react[_react.default.version];
|
|
85
|
+
const matchReactVersion = sharedReact && sharedReact.useIn.includes(scope) && ((_sharedReact$lib = sharedReact.lib) === null || _sharedReact$lib === void 0 ? void 0 : _sharedReact$lib.call(sharedReact)) === _react.default;
|
|
92
86
|
if (!matchReactVersion || (Module.default.version || 1) < 2) {
|
|
93
87
|
const OriginalCompatComponent = (Module.default.version || 1) < 2.1 ? Module.default.CompatComponent.render({}).type.prototype : Module.default.CompatComponent.prototype;
|
|
94
88
|
class CompatComponent extends _react.default.Component {
|
|
@@ -25,7 +25,10 @@ export const withCompatMode = Component => {
|
|
|
25
25
|
ref: innerRef
|
|
26
26
|
})));
|
|
27
27
|
if (typeof ((_ReactDOMClient = ReactDOMClient) === null || _ReactDOMClient === void 0 ? void 0 : _ReactDOMClient.createRoot) === 'function') {
|
|
28
|
-
|
|
28
|
+
// TODO: use non-random value
|
|
29
|
+
this.root = ReactDOMClient.createRoot(this.ref.current, {
|
|
30
|
+
identifierPrefix: crypto.randomUUID()
|
|
31
|
+
});
|
|
29
32
|
this.root.render(component);
|
|
30
33
|
} else {
|
|
31
34
|
ReactDOM.render(component, this.ref.current);
|
|
@@ -57,6 +57,7 @@ const loadComponent = function (scope, module, url) {
|
|
|
57
57
|
}
|
|
58
58
|
if (!(module in componentMap[scope]) || registeredScopes[scope] !== url) {
|
|
59
59
|
const promise = loadModule(scope, module, url, preventSingleton).then(async Module => {
|
|
60
|
+
var _sharedReact$lib;
|
|
60
61
|
if (typeof Module.default === 'function') {
|
|
61
62
|
return Module;
|
|
62
63
|
}
|
|
@@ -75,16 +76,8 @@ const loadComponent = function (scope, module, url) {
|
|
|
75
76
|
}
|
|
76
77
|
});
|
|
77
78
|
});
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
lib,
|
|
81
|
-
useIn,
|
|
82
|
-
version
|
|
83
|
-
} = _ref;
|
|
84
|
-
if (!useIn.includes(scope)) return false;
|
|
85
|
-
if (version !== React.version) return false;
|
|
86
|
-
return (lib === null || lib === void 0 ? void 0 : lib()) === React;
|
|
87
|
-
});
|
|
79
|
+
const sharedReact = shareScopes['chayns-api'].react[React.version];
|
|
80
|
+
const matchReactVersion = sharedReact && sharedReact.useIn.includes(scope) && ((_sharedReact$lib = sharedReact.lib) === null || _sharedReact$lib === void 0 ? void 0 : _sharedReact$lib.call(sharedReact)) === React;
|
|
88
81
|
if (!matchReactVersion || (Module.default.version || 1) < 2) {
|
|
89
82
|
const OriginalCompatComponent = (Module.default.version || 1) < 2.1 ? Module.default.CompatComponent.render({}).type.prototype : Module.default.CompatComponent.prototype;
|
|
90
83
|
class CompatComponent extends React.Component {
|