remote-components 0.3.4 → 0.3.6
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/app-63L5THIQ.js +12 -0
- package/dist/app-63L5THIQ.js.map +1 -0
- package/dist/app-A5QE7XRH.cjs +12 -0
- package/dist/app-A5QE7XRH.cjs.map +1 -0
- package/dist/chunk-2VQGCACH.js +190 -0
- package/dist/chunk-2VQGCACH.js.map +1 -0
- package/dist/chunk-42N2ZLE2.js +703 -0
- package/dist/chunk-42N2ZLE2.js.map +1 -0
- package/dist/chunk-6IUP26UK.cjs +57 -0
- package/dist/chunk-6IUP26UK.cjs.map +1 -0
- package/dist/chunk-7MVFHOIP.cjs +60 -0
- package/dist/chunk-7MVFHOIP.cjs.map +1 -0
- package/dist/chunk-CREXMFMF.cjs +155 -0
- package/dist/chunk-CREXMFMF.cjs.map +1 -0
- package/dist/chunk-CTUJSWCM.js +215 -0
- package/dist/chunk-CTUJSWCM.js.map +1 -0
- package/dist/chunk-ENYGL5CO.js +11 -0
- package/dist/chunk-ENYGL5CO.js.map +1 -0
- package/dist/chunk-ER73O65F.cjs +703 -0
- package/dist/chunk-ER73O65F.cjs.map +1 -0
- package/dist/chunk-F44NODUS.cjs +709 -0
- package/dist/chunk-F44NODUS.cjs.map +1 -0
- package/dist/chunk-GAXJTFBV.js +20 -0
- package/dist/chunk-GAXJTFBV.js.map +1 -0
- package/dist/chunk-HNZVEIKN.js +358 -0
- package/dist/chunk-HNZVEIKN.js.map +1 -0
- package/dist/chunk-KE7QPAQ4.cjs +21 -0
- package/dist/chunk-KE7QPAQ4.cjs.map +1 -0
- package/dist/chunk-KEPHL25S.js +60 -0
- package/dist/chunk-KEPHL25S.js.map +1 -0
- package/dist/chunk-KKBEMQU7.cjs +670 -0
- package/dist/chunk-KKBEMQU7.cjs.map +1 -0
- package/dist/chunk-KYJWRZ2B.js +709 -0
- package/dist/chunk-KYJWRZ2B.js.map +1 -0
- package/dist/chunk-N5VQR2PW.cjs +215 -0
- package/dist/chunk-N5VQR2PW.cjs.map +1 -0
- package/dist/chunk-OO4AMJWO.js +155 -0
- package/dist/chunk-OO4AMJWO.js.map +1 -0
- package/dist/chunk-R4QFK5TN.cjs +358 -0
- package/dist/chunk-R4QFK5TN.cjs.map +1 -0
- package/dist/chunk-RUWR74XQ.cjs +152 -0
- package/dist/chunk-RUWR74XQ.cjs.map +1 -0
- package/dist/chunk-S2A4TFLS.js +152 -0
- package/dist/chunk-S2A4TFLS.js.map +1 -0
- package/dist/chunk-SHFJ5OQA.cjs +11 -0
- package/dist/chunk-SHFJ5OQA.cjs.map +1 -0
- package/dist/chunk-TCFLEBQM.cjs +20 -0
- package/dist/chunk-TCFLEBQM.cjs.map +1 -0
- package/dist/chunk-W5ESPGHH.js +670 -0
- package/dist/chunk-W5ESPGHH.js.map +1 -0
- package/dist/chunk-X6YKUJKH.js +21 -0
- package/dist/chunk-X6YKUJKH.js.map +1 -0
- package/dist/chunk-XCFYWSLD.cjs +190 -0
- package/dist/chunk-XCFYWSLD.cjs.map +1 -0
- package/dist/chunk-ZPMTZ3KJ.js +57 -0
- package/dist/chunk-ZPMTZ3KJ.js.map +1 -0
- package/dist/config/nextjs.cjs +76 -351
- package/dist/config/nextjs.cjs.map +1 -1
- package/dist/config/nextjs.js +26 -266
- package/dist/config/nextjs.js.map +1 -1
- package/dist/config/webpack.cjs +12 -240
- package/dist/config/webpack.cjs.map +1 -1
- package/dist/config/webpack.js +6 -207
- package/dist/config/webpack.js.map +1 -1
- package/dist/host/html.cjs +139 -2447
- package/dist/host/html.cjs.map +1 -1
- package/dist/host/html.js +66 -2345
- package/dist/host/html.js.map +1 -1
- package/dist/host/nextjs/app/client-only.cjs +53 -2825
- package/dist/host/nextjs/app/client-only.cjs.map +1 -1
- package/dist/host/nextjs/app/client-only.js +31 -2780
- package/dist/host/nextjs/app/client-only.js.map +1 -1
- package/dist/host/nextjs/app.cjs +34 -2
- package/dist/host/nextjs/app.cjs.map +1 -1
- package/dist/host/nextjs/app.js +35 -3
- package/dist/host/nextjs/app.js.map +1 -1
- package/dist/host/proxy/client.cjs +8 -38
- package/dist/host/proxy/client.cjs.map +1 -1
- package/dist/host/proxy/client.js +4 -7
- package/dist/host/proxy/client.js.map +1 -1
- package/dist/host/proxy.cjs +19 -56
- package/dist/host/proxy.cjs.map +1 -1
- package/dist/host/proxy.js +8 -20
- package/dist/host/proxy.js.map +1 -1
- package/dist/host/react.cjs +17 -2756
- package/dist/host/react.cjs.map +1 -1
- package/dist/host/react.js +13 -2723
- package/dist/host/react.js.map +1 -1
- package/dist/internal/host/nextjs/app-client.cjs +38 -24
- package/dist/internal/host/nextjs/app-client.cjs.map +1 -1
- package/dist/internal/host/nextjs/app-client.js +38 -24
- package/dist/internal/host/nextjs/app-client.js.map +1 -1
- package/dist/internal/host/nextjs/remote-component-links.cjs +24 -13
- package/dist/internal/host/nextjs/remote-component-links.cjs.map +1 -1
- package/dist/internal/host/nextjs/remote-component-links.d.ts +3 -0
- package/dist/internal/host/nextjs/remote-component-links.js +24 -13
- package/dist/internal/host/nextjs/remote-component-links.js.map +1 -1
- package/dist/internal/host/server/fetch-remote-component.cjs +1 -18
- package/dist/internal/host/server/fetch-remote-component.cjs.map +1 -1
- package/dist/internal/host/server/fetch-remote-component.js +1 -18
- package/dist/internal/host/server/fetch-remote-component.js.map +1 -1
- package/dist/internal/host/shared/lifecycle.cjs +69 -0
- package/dist/internal/host/shared/lifecycle.cjs.map +1 -0
- package/dist/internal/host/shared/lifecycle.d.ts +34 -0
- package/dist/internal/host/shared/lifecycle.js +44 -0
- package/dist/internal/host/shared/lifecycle.js.map +1 -0
- package/dist/internal/host/shared/pipeline.cjs +222 -0
- package/dist/internal/host/shared/pipeline.cjs.map +1 -0
- package/dist/internal/host/shared/pipeline.d.ts +153 -0
- package/dist/internal/host/shared/pipeline.js +200 -0
- package/dist/internal/host/shared/pipeline.js.map +1 -0
- package/dist/internal/runtime/loaders/component-loader.cjs +5 -2
- package/dist/internal/runtime/loaders/component-loader.cjs.map +1 -1
- package/dist/internal/runtime/loaders/component-loader.js +5 -2
- package/dist/internal/runtime/loaders/component-loader.js.map +1 -1
- package/dist/internal/runtime/turbopack/patterns.cjs +1 -1
- package/dist/internal/runtime/turbopack/patterns.cjs.map +1 -1
- package/dist/internal/runtime/turbopack/patterns.js +1 -1
- package/dist/internal/runtime/turbopack/patterns.js.map +1 -1
- package/dist/internal/runtime/turbopack/remote-scope-setup.cjs.map +1 -1
- package/dist/internal/runtime/turbopack/remote-scope-setup.js.map +1 -1
- package/dist/internal/runtime/turbopack/remote-scope.cjs +1 -5
- package/dist/internal/runtime/turbopack/remote-scope.cjs.map +1 -1
- package/dist/internal/runtime/turbopack/remote-scope.js +1 -5
- package/dist/internal/runtime/turbopack/remote-scope.js.map +1 -1
- package/dist/internal/utils.cjs +1 -1
- package/dist/internal/utils.cjs.map +1 -1
- package/dist/internal/utils.d.ts +5 -5
- package/dist/internal/utils.js +1 -1
- package/dist/internal/utils.js.map +1 -1
- package/dist/remote/html.cjs +15 -314
- package/dist/remote/html.cjs.map +1 -1
- package/dist/remote/html.js +7 -305
- package/dist/remote/html.js.map +1 -1
- package/dist/remote/middleware.cjs +16 -41
- package/dist/remote/middleware.cjs.map +1 -1
- package/dist/script-6W5JRBZK.cjs +26 -0
- package/dist/script-6W5JRBZK.cjs.map +1 -0
- package/dist/script-IFEBOLIA.js +26 -0
- package/dist/script-IFEBOLIA.js.map +1 -0
- package/dist/static-loader-X4TSF5KW.js +11 -0
- package/dist/static-loader-X4TSF5KW.js.map +1 -0
- package/dist/static-loader-ZYD5BO4D.cjs +11 -0
- package/dist/static-loader-ZYD5BO4D.cjs.map +1 -0
- package/dist/turbopack-NPGO3MWS.js +55 -0
- package/dist/turbopack-NPGO3MWS.js.map +1 -0
- package/dist/turbopack-WRMKPNN4.cjs +55 -0
- package/dist/turbopack-WRMKPNN4.cjs.map +1 -0
- package/dist/webpack-DUBHPYD6.js +92 -0
- package/dist/webpack-DUBHPYD6.js.map +1 -0
- package/dist/webpack-KSCMCL7M.cjs +92 -0
- package/dist/webpack-KSCMCL7M.cjs.map +1 -0
- package/package.json +10 -3
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkER73O65Fcjs = require('./chunk-ER73O65F.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _chunkCREXMFMFcjs = require('./chunk-CREXMFMF.cjs');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunkR4QFK5TNcjs = require('./chunk-R4QFK5TN.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
var _chunk7MVFHOIPcjs = require('./chunk-7MVFHOIP.cjs');
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
var _chunkRUWR74XQcjs = require('./chunk-RUWR74XQ.cjs');
|
|
30
|
+
|
|
31
|
+
// src/host/react/index.tsx
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
var _react = require('react');
|
|
41
|
+
var _reactdom = require('react-dom');
|
|
42
|
+
var _context = require('#internal/host/react/context');
|
|
43
|
+
|
|
44
|
+
// src/runtime/html/set-attributes-from-props.ts
|
|
45
|
+
var DOMAttributeNames = {
|
|
46
|
+
acceptCharset: "accept-charset",
|
|
47
|
+
className: "class",
|
|
48
|
+
htmlFor: "for",
|
|
49
|
+
httpEquiv: "http-equiv",
|
|
50
|
+
noModule: "noModule"
|
|
51
|
+
};
|
|
52
|
+
var ignoreProps = [
|
|
53
|
+
"onLoad",
|
|
54
|
+
"onReady",
|
|
55
|
+
"dangerouslySetInnerHTML",
|
|
56
|
+
"children",
|
|
57
|
+
"onError",
|
|
58
|
+
"strategy",
|
|
59
|
+
"stylesheets"
|
|
60
|
+
];
|
|
61
|
+
function isBooleanScriptAttribute(attr) {
|
|
62
|
+
return ["async", "defer", "noModule"].includes(attr);
|
|
63
|
+
}
|
|
64
|
+
function setAttributesFromProps(el, props) {
|
|
65
|
+
for (const [p, value] of Object.entries(props)) {
|
|
66
|
+
if (!Object.hasOwn(props, p))
|
|
67
|
+
continue;
|
|
68
|
+
if (ignoreProps.includes(p))
|
|
69
|
+
continue;
|
|
70
|
+
if (value === void 0) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const attr = DOMAttributeNames[p] || p.toLowerCase();
|
|
74
|
+
if (el.tagName === "SCRIPT" && isBooleanScriptAttribute(attr)) {
|
|
75
|
+
el[attr] = Boolean(value);
|
|
76
|
+
} else {
|
|
77
|
+
el.setAttribute(attr, String(value));
|
|
78
|
+
}
|
|
79
|
+
if (value === false || el.tagName === "SCRIPT" && isBooleanScriptAttribute(attr) && (!value || value === "false")) {
|
|
80
|
+
el.setAttribute(attr, "");
|
|
81
|
+
el.removeAttribute(attr);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/host/react/hooks/use-resolve-client-url.ts
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
function useResolveClientUrl(prop, urlHref) {
|
|
90
|
+
const { resolveClientUrl: contextValue } = _context.useRemoteComponentsContext.call(void 0, );
|
|
91
|
+
const raw = _nullishCoalesce(prop, () => ( contextValue));
|
|
92
|
+
return _react.useMemo.call(void 0, () => _chunkER73O65Fcjs.bindResolveClientUrl.call(void 0, raw, urlHref), [raw, urlHref]);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// src/host/react/hooks/use-shadow-root.ts
|
|
96
|
+
|
|
97
|
+
function useShadowRoot({
|
|
98
|
+
isolate,
|
|
99
|
+
mode,
|
|
100
|
+
keySuffix
|
|
101
|
+
}) {
|
|
102
|
+
const shadowRootContainerRef = _react.useRef.call(void 0, null);
|
|
103
|
+
const [shadowRoot, setShadowRoot] = _react.useState.call(void 0, () => {
|
|
104
|
+
const shadowRoots = _chunk7MVFHOIPcjs.getNamespace.call(void 0, ).shadowRoots;
|
|
105
|
+
const ssrShadowRoot = typeof document !== "undefined" ? _nullishCoalesce(_nullishCoalesce(_optionalChain([document, 'access', _ => _.querySelector, 'call', _2 => _2(
|
|
106
|
+
`[data-remote-component-id="shadowroot_${keySuffix}"]`
|
|
107
|
+
), 'optionalAccess', _3 => _3.shadowRoot]), () => ( shadowRoots[keySuffix])), () => ( null)) : null;
|
|
108
|
+
shadowRoots[keySuffix] = null;
|
|
109
|
+
return ssrShadowRoot;
|
|
110
|
+
});
|
|
111
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
112
|
+
const shadowRoots = _chunk7MVFHOIPcjs.getNamespace.call(void 0, ).shadowRoots;
|
|
113
|
+
if (isolate !== false && typeof document !== "undefined" && (!shadowRoot || !shadowRoot.isConnected)) {
|
|
114
|
+
let shadowRootElement = null;
|
|
115
|
+
const element = document.querySelector(
|
|
116
|
+
`[data-remote-component-id="shadowroot_${keySuffix}"]`
|
|
117
|
+
);
|
|
118
|
+
shadowRootElement = _nullishCoalesce(_nullishCoalesce(shadowRoots[keySuffix], () => ( _optionalChain([element, 'optionalAccess', _4 => _4.shadowRoot]))), () => ( null));
|
|
119
|
+
if (!shadowRootElement && element) {
|
|
120
|
+
try {
|
|
121
|
+
shadowRootElement = element.attachShadow({ mode });
|
|
122
|
+
shadowRoots[keySuffix] = shadowRootElement;
|
|
123
|
+
} catch (e2) {
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (shadowRootElement) {
|
|
127
|
+
shadowRootElement.querySelectorAll("*:not(link)").forEach((node) => {
|
|
128
|
+
node.remove();
|
|
129
|
+
});
|
|
130
|
+
setShadowRoot(shadowRootElement);
|
|
131
|
+
}
|
|
132
|
+
} else if (isolate === false && shadowRoot) {
|
|
133
|
+
shadowRoots[keySuffix] = null;
|
|
134
|
+
setShadowRoot(null);
|
|
135
|
+
}
|
|
136
|
+
}, [isolate, shadowRoot, mode, keySuffix]);
|
|
137
|
+
return { shadowRoot, shadowRootContainerRef };
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// src/host/react/utils/extract-remote-html.ts
|
|
141
|
+
var DUMMY_FALLBACK = "http://remote-components-dummy-fallback";
|
|
142
|
+
function getRemoteComponentHtml(html) {
|
|
143
|
+
if (typeof document === "undefined")
|
|
144
|
+
return html;
|
|
145
|
+
const parser = new DOMParser();
|
|
146
|
+
const temp = parser.parseFromString(html, "text/html");
|
|
147
|
+
const ssrRemoteComponentContainer = temp.querySelector(
|
|
148
|
+
'div[id^="__REMOTE_COMPONENT"]'
|
|
149
|
+
);
|
|
150
|
+
if (ssrRemoteComponentContainer) {
|
|
151
|
+
return ssrRemoteComponentContainer.innerHTML;
|
|
152
|
+
}
|
|
153
|
+
const remoteComponentContainer = temp.querySelectorAll(
|
|
154
|
+
`div[data-bundle][data-route][data-runtime][id^="${_chunkR4QFK5TNcjs.DEFAULT_COMPONENT_NAME}"],div[data-bundle][data-route],div#__next,remote-component:not([src])`
|
|
155
|
+
);
|
|
156
|
+
if (remoteComponentContainer.length > 0) {
|
|
157
|
+
return `${Array.from(temp.querySelectorAll("link,script")).map((link) => link.outerHTML).join("")}${Array.from(remoteComponentContainer).map((container) => container.outerHTML).join("")}`;
|
|
158
|
+
}
|
|
159
|
+
return "";
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// src/host/react/index.tsx
|
|
163
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
164
|
+
|
|
165
|
+
function ConsumeRemoteComponent({
|
|
166
|
+
src,
|
|
167
|
+
isolate,
|
|
168
|
+
mode = "open",
|
|
169
|
+
reset,
|
|
170
|
+
credentials: credentialsProp,
|
|
171
|
+
name: nameProp = _chunkR4QFK5TNcjs.DEFAULT_COMPONENT_NAME,
|
|
172
|
+
shared: sharedProp,
|
|
173
|
+
children,
|
|
174
|
+
onBeforeLoad,
|
|
175
|
+
onLoad,
|
|
176
|
+
onError,
|
|
177
|
+
onChange,
|
|
178
|
+
onRequest,
|
|
179
|
+
onResponse,
|
|
180
|
+
resolveClientUrl: resolveClientUrlProp
|
|
181
|
+
}) {
|
|
182
|
+
const instanceId = _react.useId.call(void 0, );
|
|
183
|
+
const { credentials: contextCredentials, shared: contextShared } = _context.useRemoteComponentsContext.call(void 0, );
|
|
184
|
+
const credentials = _nullishCoalesce(_nullishCoalesce(credentialsProp, () => ( contextCredentials)), () => ( "same-origin"));
|
|
185
|
+
const shared = _nullishCoalesce(_nullishCoalesce(sharedProp, () => ( contextShared)), () => ( {}));
|
|
186
|
+
const emitter = _react.useMemo.call(void 0,
|
|
187
|
+
() => _chunkER73O65Fcjs.makeReactEmitter.call(void 0, { onBeforeLoad, onLoad, onError, onChange }),
|
|
188
|
+
[onBeforeLoad, onLoad, onError, onChange]
|
|
189
|
+
);
|
|
190
|
+
const name = _react.useMemo.call(void 0,
|
|
191
|
+
() => _chunkER73O65Fcjs.resolveNameFromSrc.call(void 0, src, nameProp),
|
|
192
|
+
[src, nameProp]
|
|
193
|
+
);
|
|
194
|
+
const [data, setData] = _react.useState.call(void 0,
|
|
195
|
+
null
|
|
196
|
+
);
|
|
197
|
+
const url = _react.useMemo.call(void 0, () => _chunkER73O65Fcjs.getClientOrServerUrl.call(void 0, src, DUMMY_FALLBACK), [src]);
|
|
198
|
+
const resolveClientUrl = useResolveClientUrl(resolveClientUrlProp, url.href);
|
|
199
|
+
const id = url.origin === (typeof location !== "undefined" ? location.origin : DUMMY_FALLBACK) ? url.pathname : url.href;
|
|
200
|
+
const keySuffix = `${_chunkR4QFK5TNcjs.escapeString.call(void 0, id)}_${_chunkR4QFK5TNcjs.escapeString.call(void 0,
|
|
201
|
+
_nullishCoalesce(_optionalChain([data, 'optionalAccess', _5 => _5.name]), () => ( name))
|
|
202
|
+
)}_${_chunkR4QFK5TNcjs.escapeString.call(void 0, instanceId)}`;
|
|
203
|
+
const [remoteComponent, setRemoteComponent] = _react.useState.call(void 0, null);
|
|
204
|
+
const { shadowRoot, shadowRootContainerRef } = useShadowRoot({
|
|
205
|
+
isolate,
|
|
206
|
+
mode,
|
|
207
|
+
keySuffix
|
|
208
|
+
});
|
|
209
|
+
const htmlRef = _react.useRef.call(void 0,
|
|
210
|
+
typeof document !== "undefined" ? _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([document, 'access', _6 => _6.querySelector, 'call', _7 => _7(
|
|
211
|
+
`[data-remote-component-id="shadowroot_${keySuffix}"]`
|
|
212
|
+
), 'optionalAccess', _8 => _8.shadowRoot, 'optionalAccess', _9 => _9.innerHTML]), () => ( _optionalChain([document, 'access', _10 => _10.getElementById, 'call', _11 => _11(`__REMOTE_COMPONENT${name}`), 'optionalAccess', _12 => _12.innerHTML]))), () => ( _optionalChain([document, 'access', _13 => _13.querySelector, 'call', _14 => _14(`div[data-bundle][data-route][id^="${name}"]`), 'optionalAccess', _15 => _15.innerHTML]))), () => ( _optionalChain([document, 'access', _16 => _16.querySelector, 'call', _17 => _17("div[data-bundle][data-route]"), 'optionalAccess', _18 => _18.innerHTML]))) : null
|
|
213
|
+
);
|
|
214
|
+
const endTemplateRef = _react.useRef.call(void 0, null);
|
|
215
|
+
const childrenRef = _react.useRef.call(void 0,
|
|
216
|
+
typeof document !== "undefined" ? (() => {
|
|
217
|
+
let el = document.querySelector(`template[id="${name}_start"]`);
|
|
218
|
+
const elements = [];
|
|
219
|
+
while (el && el.id !== `${name}_end`) {
|
|
220
|
+
if (el.id !== `${name}_start` && !el.getAttribute("data-remote-component")) {
|
|
221
|
+
elements.push(el);
|
|
222
|
+
}
|
|
223
|
+
el = el.nextElementSibling;
|
|
224
|
+
}
|
|
225
|
+
return elements;
|
|
226
|
+
})() : []
|
|
227
|
+
);
|
|
228
|
+
const hostStateRef = _react.useRef.call(void 0, _chunkER73O65Fcjs.createHostState.call(void 0, ));
|
|
229
|
+
const componentHydrationHtml = _react.useRef.call(void 0, null);
|
|
230
|
+
const prevRemoteComponentContainerRef = _react.useRef.call(void 0, null);
|
|
231
|
+
const unmountRef = _react.useRef.call(void 0, null);
|
|
232
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
233
|
+
return () => {
|
|
234
|
+
delete _chunk7MVFHOIPcjs.getNamespace.call(void 0, ).shadowRoots[keySuffix];
|
|
235
|
+
};
|
|
236
|
+
}, [keySuffix]);
|
|
237
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
238
|
+
if (childrenRef.current.length > 0 && remoteComponent) {
|
|
239
|
+
childrenRef.current.forEach((el) => {
|
|
240
|
+
el.remove();
|
|
241
|
+
});
|
|
242
|
+
childrenRef.current = [];
|
|
243
|
+
}
|
|
244
|
+
}, [remoteComponent]);
|
|
245
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
246
|
+
if (shadowRoot && remoteComponent) {
|
|
247
|
+
const resetStyles = shadowRoot.querySelectorAll(
|
|
248
|
+
"style[data-remote-components-reset]"
|
|
249
|
+
);
|
|
250
|
+
if (resetStyles.length > 1) {
|
|
251
|
+
resetStyles.forEach((style, index) => {
|
|
252
|
+
if (index > 0 && style.getAttribute("data-remote-components-reset") !== "react") {
|
|
253
|
+
style.remove();
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
htmlRef.current = null;
|
|
258
|
+
let el = _nullishCoalesce(shadowRoot.childNodes[0], () => ( null));
|
|
259
|
+
while (el && (!("id" in el) || el.id !== `${name}_start`)) {
|
|
260
|
+
const nextEl = el.nextSibling;
|
|
261
|
+
if (el.nodeName !== "LINK" && el.nodeName !== "STYLE") {
|
|
262
|
+
_optionalChain([el, 'access', _19 => _19.parentNode, 'optionalAccess', _20 => _20.removeChild, 'call', _21 => _21(el)]);
|
|
263
|
+
}
|
|
264
|
+
el = nextEl;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}, [shadowRoot, remoteComponent, name]);
|
|
268
|
+
_react.useEffect.call(void 0, () => {
|
|
269
|
+
if (src && src !== hostStateRef.current.prevSrc) {
|
|
270
|
+
const previousSrc = hostStateRef.current.prevSrc;
|
|
271
|
+
const previousName = hostStateRef.current.prevName;
|
|
272
|
+
hostStateRef.current.prevSrc = src;
|
|
273
|
+
if (previousSrc !== null) {
|
|
274
|
+
htmlRef.current = null;
|
|
275
|
+
}
|
|
276
|
+
_optionalChain([hostStateRef, 'access', _22 => _22.current, 'access', _23 => _23.abortController, 'optionalAccess', _24 => _24.abort, 'call', _25 => _25()]);
|
|
277
|
+
hostStateRef.current.abortController = new AbortController();
|
|
278
|
+
const { signal } = hostStateRef.current.abortController;
|
|
279
|
+
emitter.beforeLoad(src);
|
|
280
|
+
hostStateRef.current.stage = "loading";
|
|
281
|
+
_react.startTransition.call(void 0, async () => {
|
|
282
|
+
try {
|
|
283
|
+
let html = getRemoteComponentHtml(
|
|
284
|
+
_nullishCoalesce(htmlRef.current, () => ( (_optionalChain([endTemplateRef, 'access', _26 => _26.current, 'optionalAccess', _27 => _27.previousElementSibling, 'optionalAccess', _28 => _28.tagName]) === "div" ? endTemplateRef.current.previousElementSibling.innerHTML : "")))
|
|
285
|
+
);
|
|
286
|
+
if (!html && src) {
|
|
287
|
+
const fetchInit = {
|
|
288
|
+
credentials
|
|
289
|
+
};
|
|
290
|
+
const resolvedUrl = new URL(
|
|
291
|
+
_nullishCoalesce(_optionalChain([resolveClientUrl, 'optionalCall', _29 => _29(url.href)]), () => ( url.href)),
|
|
292
|
+
location.href
|
|
293
|
+
);
|
|
294
|
+
const res = await _chunkER73O65Fcjs.fetchWithHooks.call(void 0, resolvedUrl, fetchInit, {
|
|
295
|
+
onRequest,
|
|
296
|
+
onResponse,
|
|
297
|
+
abortController: hostStateRef.current.abortController
|
|
298
|
+
});
|
|
299
|
+
if (!res || !res.ok) {
|
|
300
|
+
throw await _chunkRUWR74XQcjs.errorFromFailedFetch.call(void 0, url.href, resolvedUrl, res);
|
|
301
|
+
}
|
|
302
|
+
const remoteHtml = await res.text();
|
|
303
|
+
if (signal.aborted)
|
|
304
|
+
return;
|
|
305
|
+
htmlRef.current = remoteHtml;
|
|
306
|
+
html = getRemoteComponentHtml(remoteHtml);
|
|
307
|
+
}
|
|
308
|
+
if (signal.aborted)
|
|
309
|
+
return;
|
|
310
|
+
const userShared = await shared;
|
|
311
|
+
if (signal.aborted)
|
|
312
|
+
return;
|
|
313
|
+
const prepared = _chunkER73O65Fcjs.preparePipeline.call(void 0, {
|
|
314
|
+
html,
|
|
315
|
+
name,
|
|
316
|
+
url,
|
|
317
|
+
shared: userShared,
|
|
318
|
+
resolveClientUrl
|
|
319
|
+
});
|
|
320
|
+
const { doc, parsed } = prepared;
|
|
321
|
+
const {
|
|
322
|
+
component,
|
|
323
|
+
name: remoteName,
|
|
324
|
+
isRemoteComponent,
|
|
325
|
+
metadata,
|
|
326
|
+
rsc,
|
|
327
|
+
remoteShared,
|
|
328
|
+
links: linkElements
|
|
329
|
+
} = parsed;
|
|
330
|
+
if (hostStateRef.current.prevIsRemoteComponent) {
|
|
331
|
+
if (shadowRoot) {
|
|
332
|
+
shadowRoot.innerHTML = "";
|
|
333
|
+
}
|
|
334
|
+
const prevUrl = hostStateRef.current.prevUrl;
|
|
335
|
+
if (prevUrl && _chunk7MVFHOIPcjs.getNamespace.call(void 0, ).unmountFns[prevUrl.href]) {
|
|
336
|
+
const unmountPromises = Promise.all(
|
|
337
|
+
Array.from(_nullishCoalesce(unmountRef.current, () => ( []))).map(
|
|
338
|
+
async (unmount) => unmount(
|
|
339
|
+
_nullishCoalesce(shadowRoot, () => ( prevRemoteComponentContainerRef.current))
|
|
340
|
+
)
|
|
341
|
+
)
|
|
342
|
+
);
|
|
343
|
+
unmountRef.current = null;
|
|
344
|
+
await unmountPromises;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
hostStateRef.current.prevIsRemoteComponent = isRemoteComponent;
|
|
348
|
+
hostStateRef.current.prevUrl = url;
|
|
349
|
+
hostStateRef.current.prevName = remoteName;
|
|
350
|
+
const links = linkElements.map((link) => ({
|
|
351
|
+
href: new URL(_nullishCoalesce(link.getAttribute("href"), () => ( link.href)), url).href,
|
|
352
|
+
...link.getAttributeNames().reduce((acc, key) => {
|
|
353
|
+
if (key !== "href") {
|
|
354
|
+
acc[_nullishCoalesce(_chunkR4QFK5TNcjs.attrToProp[key], () => ( key))] = _nullishCoalesce(link.getAttribute(key), () => ( ""));
|
|
355
|
+
}
|
|
356
|
+
return acc;
|
|
357
|
+
}, {})
|
|
358
|
+
}));
|
|
359
|
+
const inlineScripts = (isRemoteComponent ? component : doc).querySelectorAll(
|
|
360
|
+
"script:not([src]):not([data-src]):not([id*='_rsc']):not([id='__NEXT_DATA__']):not([id='__REMOTE_NEXT_DATA__'])"
|
|
361
|
+
);
|
|
362
|
+
if (!isRemoteComponent) {
|
|
363
|
+
const self = globalThis;
|
|
364
|
+
const prevNextScripts = self.__next_s;
|
|
365
|
+
const nextScripts = [];
|
|
366
|
+
self.__next_s = nextScripts;
|
|
367
|
+
await Promise.all(
|
|
368
|
+
Array.from(inlineScripts).filter(
|
|
369
|
+
(script) => !(script.id.endsWith("_shared") && script.getAttribute("type") === "application/json" && typeof script.getAttribute(
|
|
370
|
+
"data-remote-components-shared"
|
|
371
|
+
) === "string")
|
|
372
|
+
).map((script) => {
|
|
373
|
+
return new Promise((resolve) => {
|
|
374
|
+
if (script.textContent && !script.textContent.includes("self.__next_f=") && !script.textContent.includes("self.__next_f.push")) {
|
|
375
|
+
if (!script.getAttribute("type") || script.getAttribute("type") === "text/javascript" || script.getAttribute("type") === "application/javascript") {
|
|
376
|
+
const newScript = document.createElement("script");
|
|
377
|
+
const blob = new Blob([script.textContent], {
|
|
378
|
+
type: "application/javascript"
|
|
379
|
+
});
|
|
380
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
381
|
+
newScript.onload = () => {
|
|
382
|
+
resolve(void 0);
|
|
383
|
+
URL.revokeObjectURL(blobUrl);
|
|
384
|
+
newScript.remove();
|
|
385
|
+
};
|
|
386
|
+
newScript.onerror = () => {
|
|
387
|
+
URL.revokeObjectURL(blobUrl);
|
|
388
|
+
newScript.remove();
|
|
389
|
+
resolve(void 0);
|
|
390
|
+
};
|
|
391
|
+
newScript.src = blobUrl;
|
|
392
|
+
document.body.appendChild(newScript);
|
|
393
|
+
} else {
|
|
394
|
+
resolve(void 0);
|
|
395
|
+
document.body.appendChild(script);
|
|
396
|
+
}
|
|
397
|
+
} else {
|
|
398
|
+
resolve(void 0);
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
})
|
|
402
|
+
);
|
|
403
|
+
nextScripts.forEach(([scriptSrc, props]) => {
|
|
404
|
+
const script = document.createElement("script");
|
|
405
|
+
if (scriptSrc) {
|
|
406
|
+
script.src = scriptSrc;
|
|
407
|
+
}
|
|
408
|
+
if (typeof props.children === "string") {
|
|
409
|
+
script.textContent = props.children;
|
|
410
|
+
}
|
|
411
|
+
setAttributesFromProps(script, props);
|
|
412
|
+
document.head.appendChild(script);
|
|
413
|
+
});
|
|
414
|
+
self.__next_s = prevNextScripts;
|
|
415
|
+
}
|
|
416
|
+
const rscName = rsc ? `__remote_component_rsc_${_chunkR4QFK5TNcjs.escapeString.call(void 0, id)}_${_chunkR4QFK5TNcjs.escapeString.call(void 0,
|
|
417
|
+
remoteName
|
|
418
|
+
)}` : void 0;
|
|
419
|
+
if (rsc) {
|
|
420
|
+
rsc.textContent = _nullishCoalesce(_optionalChain([rsc, 'access', _30 => _30.textContent, 'optionalAccess', _31 => _31.replace, 'call', _32 => _32(
|
|
421
|
+
new RegExp(`self\\["${remoteName}"\\]`, "g"),
|
|
422
|
+
`self["${rscName}"]`
|
|
423
|
+
)]), () => ( ""));
|
|
424
|
+
document.body.appendChild(rsc);
|
|
425
|
+
}
|
|
426
|
+
const newData = {
|
|
427
|
+
...metadata,
|
|
428
|
+
links,
|
|
429
|
+
remoteShared,
|
|
430
|
+
src: typeof src === "string" ? src : src.href,
|
|
431
|
+
serverUrl: url.href,
|
|
432
|
+
data: rsc ? (rsc.textContent || "").split("\n").filter(Boolean) : []
|
|
433
|
+
};
|
|
434
|
+
componentHydrationHtml.current = `${Array.from(
|
|
435
|
+
doc.querySelectorAll("link,style")
|
|
436
|
+
).map((link) => link.outerHTML).join("")}${reset ? `<style data-remote-components-reset="">:host { all: initial; }</style>` : ""}${component.innerHTML}`;
|
|
437
|
+
if (isRemoteComponent) {
|
|
438
|
+
if (previousSrc !== void 0) {
|
|
439
|
+
emitter.change({
|
|
440
|
+
previousSrc: _nullishCoalesce(previousSrc, () => ( null)),
|
|
441
|
+
nextSrc: src,
|
|
442
|
+
previousName,
|
|
443
|
+
nextName: remoteName
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
setData(newData);
|
|
447
|
+
if (shadowRoot) {
|
|
448
|
+
const shadowRootHtml = reset ? `<style data-remote-components-reset="">:host { all: initial; }</style>${component.innerHTML}` : component.innerHTML;
|
|
449
|
+
shadowRoot.innerHTML = shadowRootHtml;
|
|
450
|
+
htmlRef.current = null;
|
|
451
|
+
setRemoteComponent(null);
|
|
452
|
+
const { mount, unmount } = await _chunkCREXMFMFcjs.loadStaticRemoteComponent.call(void 0,
|
|
453
|
+
Array.from(shadowRoot.querySelectorAll("script")),
|
|
454
|
+
url,
|
|
455
|
+
resolveClientUrl
|
|
456
|
+
);
|
|
457
|
+
unmountRef.current = unmount;
|
|
458
|
+
await Promise.all(
|
|
459
|
+
Array.from(mount).map((mountFn) => mountFn(shadowRoot))
|
|
460
|
+
);
|
|
461
|
+
emitter.load(src);
|
|
462
|
+
} else if (isolate === false) {
|
|
463
|
+
setRemoteComponent(
|
|
464
|
+
// TODO: remove wrapper div by converting HTML to RSC or React tree
|
|
465
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
466
|
+
"div",
|
|
467
|
+
{
|
|
468
|
+
dangerouslySetInnerHTML: { __html: component.innerHTML },
|
|
469
|
+
ref: prevRemoteComponentContainerRef
|
|
470
|
+
}
|
|
471
|
+
)
|
|
472
|
+
);
|
|
473
|
+
htmlRef.current = null;
|
|
474
|
+
const { mount, unmount } = await _chunkCREXMFMFcjs.loadStaticRemoteComponent.call(void 0,
|
|
475
|
+
Array.from(component.querySelectorAll("script")),
|
|
476
|
+
url,
|
|
477
|
+
resolveClientUrl
|
|
478
|
+
);
|
|
479
|
+
unmountRef.current = unmount;
|
|
480
|
+
await Promise.all(
|
|
481
|
+
Array.from(mount).map(
|
|
482
|
+
(mountFn) => mountFn(prevRemoteComponentContainerRef.current)
|
|
483
|
+
)
|
|
484
|
+
);
|
|
485
|
+
emitter.load(src);
|
|
486
|
+
}
|
|
487
|
+
hostStateRef.current.stage = "loaded";
|
|
488
|
+
} else {
|
|
489
|
+
const result = await _chunkER73O65Fcjs.loadPrepared.call(void 0, {
|
|
490
|
+
prepared,
|
|
491
|
+
url,
|
|
492
|
+
signal,
|
|
493
|
+
shared: userShared,
|
|
494
|
+
resolveClientUrl,
|
|
495
|
+
container: shadowRoot,
|
|
496
|
+
rscName
|
|
497
|
+
});
|
|
498
|
+
if (rsc) {
|
|
499
|
+
rsc.remove();
|
|
500
|
+
}
|
|
501
|
+
setData(newData);
|
|
502
|
+
if (previousSrc !== void 0) {
|
|
503
|
+
emitter.change({
|
|
504
|
+
previousSrc: _nullishCoalesce(previousSrc, () => ( null)),
|
|
505
|
+
nextSrc: src,
|
|
506
|
+
previousName,
|
|
507
|
+
nextName: remoteName
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
if (result.status === "aborted") {
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
if (result.status === "error") {
|
|
514
|
+
hostStateRef.current.stage = "error";
|
|
515
|
+
setRemoteComponent(result.error);
|
|
516
|
+
emitter.error(result.error);
|
|
517
|
+
} else if (result.status === "loaded") {
|
|
518
|
+
hostStateRef.current.stage = "loaded";
|
|
519
|
+
setRemoteComponent(result.component);
|
|
520
|
+
emitter.load(src);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
} catch (error) {
|
|
524
|
+
if (_chunkRUWR74XQcjs.isAbortError.call(void 0, error)) {
|
|
525
|
+
hostStateRef.current.stage = "idle";
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
hostStateRef.current.stage = "error";
|
|
529
|
+
setRemoteComponent(error);
|
|
530
|
+
emitter.error(error);
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
}, [
|
|
535
|
+
url,
|
|
536
|
+
src,
|
|
537
|
+
isolate,
|
|
538
|
+
credentials,
|
|
539
|
+
name,
|
|
540
|
+
shared,
|
|
541
|
+
shadowRoot,
|
|
542
|
+
reset,
|
|
543
|
+
id,
|
|
544
|
+
emitter.beforeLoad,
|
|
545
|
+
emitter.load,
|
|
546
|
+
emitter.error,
|
|
547
|
+
emitter.change,
|
|
548
|
+
onRequest,
|
|
549
|
+
onResponse,
|
|
550
|
+
resolveClientUrl
|
|
551
|
+
]);
|
|
552
|
+
if (remoteComponent instanceof Error) {
|
|
553
|
+
throw remoteComponent;
|
|
554
|
+
}
|
|
555
|
+
const metadataJson = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "script", { "data-remote-component": true, type: "application/json", children: JSON.stringify({
|
|
556
|
+
name: _optionalChain([data, 'optionalAccess', _33 => _33.name]) || name,
|
|
557
|
+
bundle: _optionalChain([data, 'optionalAccess', _34 => _34.bundle]) || "default",
|
|
558
|
+
route: _optionalChain([data, 'optionalAccess', _35 => _35.route]) || _chunkR4QFK5TNcjs.DEFAULT_ROUTE,
|
|
559
|
+
runtime: hostStateRef.current.prevIsRemoteComponent ? _chunkR4QFK5TNcjs.RUNTIME_SCRIPT : _optionalChain([data, 'optionalAccess', _36 => _36.runtime]) || _chunkR4QFK5TNcjs.RUNTIME_WEBPACK
|
|
560
|
+
}) });
|
|
561
|
+
const resetStyle = reset ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { "data-remote-components-reset": "react", children: `:host { all: initial; }` }) : null;
|
|
562
|
+
const linksToRender = _optionalChain([data, 'optionalAccess', _37 => _37.links, 'optionalAccess', _38 => _38.map, 'call', _39 => _39((link) => /* @__PURE__ */ _react.createElement.call(void 0,
|
|
563
|
+
"link",
|
|
564
|
+
{
|
|
565
|
+
...link,
|
|
566
|
+
href: new URL(link.href, url).href,
|
|
567
|
+
key: JSON.stringify(link)
|
|
568
|
+
}
|
|
569
|
+
))]) || null;
|
|
570
|
+
const componentToRender = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
571
|
+
resetStyle,
|
|
572
|
+
linksToRender,
|
|
573
|
+
_nullishCoalesce(remoteComponent, () => ( children))
|
|
574
|
+
] });
|
|
575
|
+
if (componentHydrationHtml.current && shadowRoot && !shadowRoot.innerHTML) {
|
|
576
|
+
shadowRoot.innerHTML = componentHydrationHtml.current;
|
|
577
|
+
componentHydrationHtml.current = null;
|
|
578
|
+
if (hostStateRef.current.prevIsRemoteComponent) {
|
|
579
|
+
_chunkCREXMFMFcjs.loadStaticRemoteComponent.call(void 0,
|
|
580
|
+
Array.from(shadowRoot.querySelectorAll("script")),
|
|
581
|
+
url,
|
|
582
|
+
resolveClientUrl
|
|
583
|
+
).then(({ mount }) => {
|
|
584
|
+
return Promise.all(
|
|
585
|
+
Array.from(mount).map((mountFn) => mountFn(shadowRoot))
|
|
586
|
+
);
|
|
587
|
+
}).then(() => {
|
|
588
|
+
if (src) {
|
|
589
|
+
emitter.load(src);
|
|
590
|
+
}
|
|
591
|
+
}).catch((e) => {
|
|
592
|
+
const error = new (0, _chunkRUWR74XQcjs.RemoteComponentsError)(
|
|
593
|
+
`Error mounting remote component from "${url.href}"`,
|
|
594
|
+
{
|
|
595
|
+
cause: e
|
|
596
|
+
}
|
|
597
|
+
);
|
|
598
|
+
setRemoteComponent(error);
|
|
599
|
+
emitter.error(error);
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
if (isolate !== false) {
|
|
604
|
+
const shadowRemoteComponentHtml = _nullishCoalesce(_optionalChain([shadowRoot, 'optionalAccess', _40 => _40.querySelector, 'call', _41 => _41(`#__REMOTE_COMPONENT${name}`)]), () => ( _optionalChain([shadowRoot, 'optionalAccess', _42 => _42.querySelector, 'call', _43 => _43("div[data-bundle][data-route]")])));
|
|
605
|
+
if (shadowRemoteComponentHtml) {
|
|
606
|
+
shadowRemoteComponentHtml.remove();
|
|
607
|
+
}
|
|
608
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
609
|
+
metadataJson,
|
|
610
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
611
|
+
"div",
|
|
612
|
+
{
|
|
613
|
+
"data-remote-component-id": `shadowroot_${keySuffix}`,
|
|
614
|
+
id: `shadowroot_${_nullishCoalesce(_optionalChain([data, 'optionalAccess', _44 => _44.name]), () => ( name))}`,
|
|
615
|
+
ref: shadowRootContainerRef,
|
|
616
|
+
children: [
|
|
617
|
+
typeof document === "undefined" ? (
|
|
618
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
619
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "template", { shadowrootmode: mode, children: [
|
|
620
|
+
typeof document === "undefined" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
621
|
+
"div",
|
|
622
|
+
{
|
|
623
|
+
dangerouslySetInnerHTML: {
|
|
624
|
+
__html: `<img
|
|
625
|
+
alt="" decoding="async" style="display:none"
|
|
626
|
+
src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="
|
|
627
|
+
onload="(function(el){
|
|
628
|
+
// Capture the shadow root during SSR hydration so the client-side
|
|
629
|
+
// useShadowRoot hook can find it.
|
|
630
|
+
const root = el.getRootNode();
|
|
631
|
+
globalThis.__remote_components_shadowroot_${keySuffix}=root;
|
|
632
|
+
el.parentElement.remove();
|
|
633
|
+
})(this)"
|
|
634
|
+
/>`
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
) : null,
|
|
638
|
+
resetStyle,
|
|
639
|
+
linksToRender,
|
|
640
|
+
children
|
|
641
|
+
] })
|
|
642
|
+
) : null,
|
|
643
|
+
shadowRoot && remoteComponent ? _reactdom.createPortal.call(void 0,
|
|
644
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
645
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "template", { id: `${name}_start` }),
|
|
646
|
+
resetStyle,
|
|
647
|
+
linksToRender,
|
|
648
|
+
remoteComponent,
|
|
649
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "template", { id: `${name}_end`, ref: endTemplateRef })
|
|
650
|
+
] }),
|
|
651
|
+
shadowRoot
|
|
652
|
+
) : null
|
|
653
|
+
]
|
|
654
|
+
}
|
|
655
|
+
)
|
|
656
|
+
] });
|
|
657
|
+
}
|
|
658
|
+
htmlRef.current = null;
|
|
659
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
660
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "template", { id: `${name}_start` }),
|
|
661
|
+
metadataJson,
|
|
662
|
+
componentToRender,
|
|
663
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "template", { id: `${name}_end`, ref: endTemplateRef })
|
|
664
|
+
] });
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
exports.ConsumeRemoteComponent = ConsumeRemoteComponent;
|
|
670
|
+
//# sourceMappingURL=chunk-KKBEMQU7.cjs.map
|