@fluid-app/widget-runtime 0.1.281 → 0.1.283
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/index.cjs +2 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/{remote-dom-renderer-BGIZ0FRi.d.mts → remote-dom-renderer-BnqVsw6k.d.mts} +4 -8
- package/dist/remote-dom-renderer-BnqVsw6k.d.mts.map +1 -0
- package/dist/remote-dom-renderer-CMpuJrkw.cjs +471 -0
- package/dist/remote-dom-renderer-CMpuJrkw.cjs.map +1 -0
- package/dist/remote-dom-renderer-D2FspToS.mjs +466 -0
- package/dist/remote-dom-renderer-D2FspToS.mjs.map +1 -0
- package/dist/{remote-dom-renderer-BoB9jd3B.d.cts → remote-dom-renderer-D3Jz1sOH.d.cts} +4 -8
- package/dist/remote-dom-renderer-D3Jz1sOH.d.cts.map +1 -0
- package/dist/{remote-dom-renderer-m5bn0hcE.mjs → remote-dom-styles-CmHfrrKz.mjs} +261 -702
- package/dist/remote-dom-styles-CmHfrrKz.mjs.map +1 -0
- package/dist/{remote-dom-renderer-VA5axIKk.cjs → remote-dom-styles-RV40tYyt.cjs} +328 -698
- package/dist/remote-dom-styles-RV40tYyt.cjs.map +1 -0
- package/dist/{remote-dom-ui-contract-B140dMly.d.mts → remote-dom-ui-contract-Dr0q3O4E.d.cts} +75 -77
- package/dist/remote-dom-ui-contract-Dr0q3O4E.d.cts.map +1 -0
- package/dist/{remote-dom-ui-contract-BLOyWbT2.d.cts → remote-dom-ui-contract-Dr0q3O4E.d.mts} +75 -77
- package/dist/remote-dom-ui-contract-Dr0q3O4E.d.mts.map +1 -0
- package/dist/remote-dom-values-BBN5u_Mj.mjs +1358 -0
- package/dist/remote-dom-values-BBN5u_Mj.mjs.map +1 -0
- package/dist/{remote-dom-values-D4AgBNWr.d.cts → remote-dom-values-BR8Qnhg9.d.cts} +1 -3
- package/dist/remote-dom-values-BR8Qnhg9.d.cts.map +1 -0
- package/dist/remote-dom-values-D1Fi2ibn.cjs +1441 -0
- package/dist/remote-dom-values-D1Fi2ibn.cjs.map +1 -0
- package/dist/{remote-dom-values-EwoLXnSn.d.mts → remote-dom-values-D8qikv8I.d.mts} +2 -3
- package/dist/remote-dom-values-D8qikv8I.d.mts.map +1 -0
- package/dist/remote-dom.cjs +2 -2
- package/dist/remote-dom.d.cts +2 -2
- package/dist/remote-dom.d.mts +2 -2
- package/dist/remote-dom.mjs +2 -2
- package/dist/site-host.cjs +372 -0
- package/dist/site-host.cjs.map +1 -0
- package/dist/site-host.d.cts +61 -0
- package/dist/site-host.d.cts.map +1 -0
- package/dist/site-host.d.mts +61 -0
- package/dist/site-host.d.mts.map +1 -0
- package/dist/site-host.mjs +369 -0
- package/dist/site-host.mjs.map +1 -0
- package/dist/{worker-react-bootstrap-C7tCMYGA.mjs → worker-react-bootstrap-CwlNMpMT.mjs} +2 -3
- package/dist/{worker-react-bootstrap-C7tCMYGA.mjs.map → worker-react-bootstrap-CwlNMpMT.mjs.map} +1 -1
- package/dist/{worker-react-bootstrap-N8jcWZ3L.cjs → worker-react-bootstrap-Dbq9hU1k.cjs} +2 -3
- package/dist/{worker-react-bootstrap-N8jcWZ3L.cjs.map → worker-react-bootstrap-Dbq9hU1k.cjs.map} +1 -1
- package/dist/{worker-react-renderer-ByjjgyrY.cjs → worker-react-renderer-CsI-dsP5.cjs} +5 -6
- package/dist/worker-react-renderer-CsI-dsP5.cjs.map +1 -0
- package/dist/{worker-react-renderer-ggcPIDLl.mjs → worker-react-renderer-LC2Dr-gj.mjs} +5 -5
- package/dist/{worker-react-renderer-ggcPIDLl.mjs.map → worker-react-renderer-LC2Dr-gj.mjs.map} +1 -1
- package/dist/worker.cjs +12 -17
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +15 -13
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +16 -14
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +9 -13
- package/dist/worker.mjs.map +1 -1
- package/package.json +11 -6
- package/dist/Thread-0eUyc0Hw.cjs +0 -591
- package/dist/Thread-0eUyc0Hw.cjs.map +0 -1
- package/dist/Thread-BiW7rXts.mjs +0 -574
- package/dist/Thread-BiW7rXts.mjs.map +0 -1
- package/dist/remote-dom-renderer-BGIZ0FRi.d.mts.map +0 -1
- package/dist/remote-dom-renderer-BoB9jd3B.d.cts.map +0 -1
- package/dist/remote-dom-renderer-VA5axIKk.cjs.map +0 -1
- package/dist/remote-dom-renderer-m5bn0hcE.mjs.map +0 -1
- package/dist/remote-dom-ui-contract-B140dMly.d.mts.map +0 -1
- package/dist/remote-dom-ui-contract-BLOyWbT2.d.cts.map +0 -1
- package/dist/remote-dom-values-B5UZPDRy.cjs +0 -849
- package/dist/remote-dom-values-B5UZPDRy.cjs.map +0 -1
- package/dist/remote-dom-values-D4AgBNWr.d.cts.map +0 -1
- package/dist/remote-dom-values-EwoLXnSn.d.mts.map +0 -1
- package/dist/remote-dom-values-wEbrw5iW.mjs +0 -790
- package/dist/remote-dom-values-wEbrw5iW.mjs.map +0 -1
- package/dist/worker-react-renderer-ByjjgyrY.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -15,24 +15,18 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
}
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
19
19
|
value: mod,
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
const require_Thread = require("./Thread-0eUyc0Hw.cjs");
|
|
24
|
-
const require_remote_dom_values = require("./remote-dom-values-B5UZPDRy.cjs");
|
|
22
|
+
const require_remote_dom_values = require("./remote-dom-values-D1Fi2ibn.cjs");
|
|
25
23
|
let _remote_dom_core = require("@remote-dom/core");
|
|
26
|
-
let _remote_dom_react_host = require("@remote-dom/react/host");
|
|
27
|
-
let react = require("react");
|
|
28
|
-
let react_dom = require("react-dom");
|
|
29
|
-
let react_dom_client = require("react-dom/client");
|
|
30
24
|
let postcss_lib_parse = require("postcss/lib/parse");
|
|
31
|
-
postcss_lib_parse = __toESM(postcss_lib_parse);
|
|
25
|
+
postcss_lib_parse = __toESM(postcss_lib_parse, 1);
|
|
32
26
|
let postcss_value_parser = require("postcss-value-parser");
|
|
33
|
-
postcss_value_parser = __toESM(postcss_value_parser);
|
|
34
|
-
|
|
35
|
-
const REMOTE_DOM_DENIED_TAG_NAMES = new Set([
|
|
27
|
+
postcss_value_parser = __toESM(postcss_value_parser, 1);
|
|
28
|
+
// src/remote-dom-sanitizer.ts
|
|
29
|
+
const REMOTE_DOM_DENIED_TAG_NAMES = /* @__PURE__ */ new Set([
|
|
36
30
|
"applet",
|
|
37
31
|
"base",
|
|
38
32
|
"body",
|
|
@@ -54,7 +48,7 @@ const REMOTE_DOM_DENIED_TAG_NAMES = new Set([
|
|
|
54
48
|
"title"
|
|
55
49
|
]);
|
|
56
50
|
const REMOTE_DOM_ALLOWED_TAG_NAME_SET = new Set(require_remote_dom_values.REMOTE_DOM_ALLOWED_TAG_NAMES);
|
|
57
|
-
const GLOBAL_ALLOWED_ATTRIBUTES = new Set([
|
|
51
|
+
const GLOBAL_ALLOWED_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
58
52
|
"aria-activedescendant",
|
|
59
53
|
"aria-atomic",
|
|
60
54
|
"aria-autocomplete",
|
|
@@ -116,7 +110,7 @@ const GLOBAL_ALLOWED_ATTRIBUTES = new Set([
|
|
|
116
110
|
"translate"
|
|
117
111
|
]);
|
|
118
112
|
const TAG_ALLOWED_ATTRIBUTES = {
|
|
119
|
-
a: new Set([
|
|
113
|
+
a: /* @__PURE__ */ new Set([
|
|
120
114
|
"download",
|
|
121
115
|
"href",
|
|
122
116
|
"hreflang",
|
|
@@ -124,7 +118,7 @@ const TAG_ALLOWED_ATTRIBUTES = {
|
|
|
124
118
|
"target",
|
|
125
119
|
"type"
|
|
126
120
|
]),
|
|
127
|
-
audio: new Set([
|
|
121
|
+
audio: /* @__PURE__ */ new Set([
|
|
128
122
|
"autoplay",
|
|
129
123
|
"controls",
|
|
130
124
|
"loop",
|
|
@@ -132,21 +126,21 @@ const TAG_ALLOWED_ATTRIBUTES = {
|
|
|
132
126
|
"preload",
|
|
133
127
|
"src"
|
|
134
128
|
]),
|
|
135
|
-
blockquote: new Set(["cite"]),
|
|
136
|
-
button: new Set([
|
|
129
|
+
blockquote: /* @__PURE__ */ new Set(["cite"]),
|
|
130
|
+
button: /* @__PURE__ */ new Set([
|
|
137
131
|
"disabled",
|
|
138
132
|
"name",
|
|
139
133
|
"type",
|
|
140
134
|
"value"
|
|
141
135
|
]),
|
|
142
|
-
col: new Set(["span"]),
|
|
143
|
-
colgroup: new Set(["span"]),
|
|
144
|
-
data: new Set(["value"]),
|
|
145
|
-
del: new Set(["cite", "datetime"]),
|
|
146
|
-
details: new Set(["open"]),
|
|
147
|
-
dialog: new Set(["open"]),
|
|
148
|
-
form: new Set(["autocomplete", "name"]),
|
|
149
|
-
img: new Set([
|
|
136
|
+
col: /* @__PURE__ */ new Set(["span"]),
|
|
137
|
+
colgroup: /* @__PURE__ */ new Set(["span"]),
|
|
138
|
+
data: /* @__PURE__ */ new Set(["value"]),
|
|
139
|
+
del: /* @__PURE__ */ new Set(["cite", "datetime"]),
|
|
140
|
+
details: /* @__PURE__ */ new Set(["open"]),
|
|
141
|
+
dialog: /* @__PURE__ */ new Set(["open"]),
|
|
142
|
+
form: /* @__PURE__ */ new Set(["autocomplete", "name"]),
|
|
143
|
+
img: /* @__PURE__ */ new Set([
|
|
150
144
|
"alt",
|
|
151
145
|
"decoding",
|
|
152
146
|
"height",
|
|
@@ -154,7 +148,7 @@ const TAG_ALLOWED_ATTRIBUTES = {
|
|
|
154
148
|
"src",
|
|
155
149
|
"width"
|
|
156
150
|
]),
|
|
157
|
-
input: new Set([
|
|
151
|
+
input: /* @__PURE__ */ new Set([
|
|
158
152
|
"accept",
|
|
159
153
|
"autocomplete",
|
|
160
154
|
"checked",
|
|
@@ -172,9 +166,9 @@ const TAG_ALLOWED_ATTRIBUTES = {
|
|
|
172
166
|
"type",
|
|
173
167
|
"value"
|
|
174
168
|
]),
|
|
175
|
-
ins: new Set(["cite", "datetime"]),
|
|
176
|
-
label: new Set(["for"]),
|
|
177
|
-
meter: new Set([
|
|
169
|
+
ins: /* @__PURE__ */ new Set(["cite", "datetime"]),
|
|
170
|
+
label: /* @__PURE__ */ new Set(["for"]),
|
|
171
|
+
meter: /* @__PURE__ */ new Set([
|
|
178
172
|
"high",
|
|
179
173
|
"low",
|
|
180
174
|
"max",
|
|
@@ -182,17 +176,17 @@ const TAG_ALLOWED_ATTRIBUTES = {
|
|
|
182
176
|
"optimum",
|
|
183
177
|
"value"
|
|
184
178
|
]),
|
|
185
|
-
optgroup: new Set(["disabled", "label"]),
|
|
186
|
-
option: new Set([
|
|
179
|
+
optgroup: /* @__PURE__ */ new Set(["disabled", "label"]),
|
|
180
|
+
option: /* @__PURE__ */ new Set([
|
|
187
181
|
"disabled",
|
|
188
182
|
"label",
|
|
189
183
|
"selected",
|
|
190
184
|
"value"
|
|
191
185
|
]),
|
|
192
|
-
output: new Set(["for", "name"]),
|
|
193
|
-
progress: new Set(["max", "value"]),
|
|
194
|
-
q: new Set(["cite"]),
|
|
195
|
-
select: new Set([
|
|
186
|
+
output: /* @__PURE__ */ new Set(["for", "name"]),
|
|
187
|
+
progress: /* @__PURE__ */ new Set(["max", "value"]),
|
|
188
|
+
q: /* @__PURE__ */ new Set(["cite"]),
|
|
189
|
+
select: /* @__PURE__ */ new Set([
|
|
196
190
|
"autocomplete",
|
|
197
191
|
"disabled",
|
|
198
192
|
"multiple",
|
|
@@ -200,7 +194,7 @@ const TAG_ALLOWED_ATTRIBUTES = {
|
|
|
200
194
|
"required",
|
|
201
195
|
"size"
|
|
202
196
|
]),
|
|
203
|
-
source: new Set([
|
|
197
|
+
source: /* @__PURE__ */ new Set([
|
|
204
198
|
"height",
|
|
205
199
|
"media",
|
|
206
200
|
"sizes",
|
|
@@ -208,12 +202,12 @@ const TAG_ALLOWED_ATTRIBUTES = {
|
|
|
208
202
|
"type",
|
|
209
203
|
"width"
|
|
210
204
|
]),
|
|
211
|
-
td: new Set([
|
|
205
|
+
td: /* @__PURE__ */ new Set([
|
|
212
206
|
"colspan",
|
|
213
207
|
"headers",
|
|
214
208
|
"rowspan"
|
|
215
209
|
]),
|
|
216
|
-
textarea: new Set([
|
|
210
|
+
textarea: /* @__PURE__ */ new Set([
|
|
217
211
|
"autocomplete",
|
|
218
212
|
"cols",
|
|
219
213
|
"disabled",
|
|
@@ -227,22 +221,22 @@ const TAG_ALLOWED_ATTRIBUTES = {
|
|
|
227
221
|
"value",
|
|
228
222
|
"wrap"
|
|
229
223
|
]),
|
|
230
|
-
th: new Set([
|
|
224
|
+
th: /* @__PURE__ */ new Set([
|
|
231
225
|
"abbr",
|
|
232
226
|
"colspan",
|
|
233
227
|
"headers",
|
|
234
228
|
"rowspan",
|
|
235
229
|
"scope"
|
|
236
230
|
]),
|
|
237
|
-
time: new Set(["datetime"]),
|
|
238
|
-
track: new Set([
|
|
231
|
+
time: /* @__PURE__ */ new Set(["datetime"]),
|
|
232
|
+
track: /* @__PURE__ */ new Set([
|
|
239
233
|
"default",
|
|
240
234
|
"kind",
|
|
241
235
|
"label",
|
|
242
236
|
"src",
|
|
243
237
|
"srclang"
|
|
244
238
|
]),
|
|
245
|
-
video: new Set([
|
|
239
|
+
video: /* @__PURE__ */ new Set([
|
|
246
240
|
"autoplay",
|
|
247
241
|
"controls",
|
|
248
242
|
"height",
|
|
@@ -255,7 +249,7 @@ const TAG_ALLOWED_ATTRIBUTES = {
|
|
|
255
249
|
"width"
|
|
256
250
|
])
|
|
257
251
|
};
|
|
258
|
-
const BOOLEAN_ATTRIBUTES = new Set([
|
|
252
|
+
const BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
259
253
|
"autoplay",
|
|
260
254
|
"checked",
|
|
261
255
|
"controls",
|
|
@@ -272,7 +266,7 @@ const BOOLEAN_ATTRIBUTES = new Set([
|
|
|
272
266
|
"required",
|
|
273
267
|
"selected"
|
|
274
268
|
]);
|
|
275
|
-
const SAFE_INPUT_TYPES = new Set([
|
|
269
|
+
const SAFE_INPUT_TYPES = /* @__PURE__ */ new Set([
|
|
276
270
|
"button",
|
|
277
271
|
"checkbox",
|
|
278
272
|
"color",
|
|
@@ -295,36 +289,36 @@ const SAFE_INPUT_TYPES = new Set([
|
|
|
295
289
|
"url",
|
|
296
290
|
"week"
|
|
297
291
|
]);
|
|
298
|
-
const SAFE_BUTTON_TYPES = new Set([
|
|
292
|
+
const SAFE_BUTTON_TYPES = /* @__PURE__ */ new Set([
|
|
299
293
|
"button",
|
|
300
294
|
"reset",
|
|
301
295
|
"submit"
|
|
302
296
|
]);
|
|
303
|
-
const SAFE_LOADING_VALUES = new Set(["eager", "lazy"]);
|
|
304
|
-
const SAFE_DECODING_VALUES = new Set([
|
|
297
|
+
const SAFE_LOADING_VALUES = /* @__PURE__ */ new Set(["eager", "lazy"]);
|
|
298
|
+
const SAFE_DECODING_VALUES = /* @__PURE__ */ new Set([
|
|
305
299
|
"async",
|
|
306
300
|
"auto",
|
|
307
301
|
"sync"
|
|
308
302
|
]);
|
|
309
|
-
const SAFE_PRELOAD_VALUES = new Set([
|
|
303
|
+
const SAFE_PRELOAD_VALUES = /* @__PURE__ */ new Set([
|
|
310
304
|
"auto",
|
|
311
305
|
"metadata",
|
|
312
306
|
"none"
|
|
313
307
|
]);
|
|
314
|
-
const SAFE_TRACK_KIND_VALUES = new Set([
|
|
308
|
+
const SAFE_TRACK_KIND_VALUES = /* @__PURE__ */ new Set([
|
|
315
309
|
"captions",
|
|
316
310
|
"chapters",
|
|
317
311
|
"descriptions",
|
|
318
312
|
"metadata",
|
|
319
313
|
"subtitles"
|
|
320
314
|
]);
|
|
321
|
-
const URL_VALUED_ATTRIBUTES = new Set([
|
|
315
|
+
const URL_VALUED_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
322
316
|
"cite",
|
|
323
317
|
"href",
|
|
324
318
|
"poster",
|
|
325
319
|
"src"
|
|
326
320
|
]);
|
|
327
|
-
const MEDIA_SOURCE_TAGS = new Set([
|
|
321
|
+
const MEDIA_SOURCE_TAGS = /* @__PURE__ */ new Set([
|
|
328
322
|
"audio",
|
|
329
323
|
"img",
|
|
330
324
|
"source",
|
|
@@ -616,7 +610,7 @@ function escapeCssString(value) {
|
|
|
616
610
|
}
|
|
617
611
|
const CSS_URL_FUNCTION_NAME = "url";
|
|
618
612
|
const CSS_IMPORT_RULE_NAME = "import";
|
|
619
|
-
const CSS_REJECTED_URL_FUNCTION_NAMES = new Set(["image-set", "-webkit-image-set"]);
|
|
613
|
+
const CSS_REJECTED_URL_FUNCTION_NAMES = /* @__PURE__ */ new Set(["image-set", "-webkit-image-set"]);
|
|
620
614
|
function sanitizeCssTextUrlReferences(cssText, originPolicy) {
|
|
621
615
|
let stylesheet;
|
|
622
616
|
try {
|
|
@@ -872,8 +866,7 @@ function readPointerState(event) {
|
|
|
872
866
|
function isObjectRecord$1(value) {
|
|
873
867
|
return typeof value === "object" && value !== null;
|
|
874
868
|
}
|
|
875
|
-
|
|
876
|
-
//#region src/remote-dom-sanitizing-connection.ts
|
|
869
|
+
// src/remote-dom-sanitizing-connection.ts
|
|
877
870
|
var RemoteDomConnectionCallDeniedError = class extends Error {
|
|
878
871
|
constructor(method) {
|
|
879
872
|
super(`Remote DOM element method "${method}" was blocked; host method calls are denied.`);
|
|
@@ -881,7 +874,7 @@ var RemoteDomConnectionCallDeniedError = class extends Error {
|
|
|
881
874
|
}
|
|
882
875
|
};
|
|
883
876
|
function createSanitizingRemoteConnection(options) {
|
|
884
|
-
const state = { nodes: new Map([[_remote_dom_core.ROOT_ID, {
|
|
877
|
+
const state = { nodes: /* @__PURE__ */ new Map([[_remote_dom_core.ROOT_ID, {
|
|
885
878
|
kind: "element",
|
|
886
879
|
localName: "",
|
|
887
880
|
childIds: []
|
|
@@ -959,7 +952,7 @@ function normalizeMutationRecordForHost(options, state, mutation, pendingEventLi
|
|
|
959
952
|
ok: false,
|
|
960
953
|
message: "Remote DOM insertChild index was invalid."
|
|
961
954
|
};
|
|
962
|
-
const normalized = normalizeRemoteNodeForHost(options,
|
|
955
|
+
const normalized = normalizeRemoteNodeForHost(options, child, new Set(state.nodes.keys()), pendingEventListenerUpdates);
|
|
963
956
|
if (!normalized.ok) return normalized;
|
|
964
957
|
if (Math.max(0, state.nodes.size - 1) + normalized.nodeCount > options.maxDomNodeCount) return {
|
|
965
958
|
ok: false,
|
|
@@ -1098,7 +1091,7 @@ function normalizeUpdatePropertyRecordForHost(options, state, mutation, pendingE
|
|
|
1098
1091
|
]
|
|
1099
1092
|
};
|
|
1100
1093
|
}
|
|
1101
|
-
function normalizeRemoteNodeForHost(options,
|
|
1094
|
+
function normalizeRemoteNodeForHost(options, value, seen, pendingEventListenerUpdates) {
|
|
1102
1095
|
if (!isObjectRecord(value)) return {
|
|
1103
1096
|
ok: false,
|
|
1104
1097
|
message: "Remote DOM render payload was not a node."
|
|
@@ -1140,7 +1133,7 @@ function normalizeRemoteNodeForHost(options, state, value, seen, pendingEventLis
|
|
|
1140
1133
|
const children = [];
|
|
1141
1134
|
let nodeCount = 1;
|
|
1142
1135
|
for (const child of value.children) {
|
|
1143
|
-
const normalized = normalizeRemoteNodeForHost(options,
|
|
1136
|
+
const normalized = normalizeRemoteNodeForHost(options, child, seen, pendingEventListenerUpdates);
|
|
1144
1137
|
if (!normalized.ok) return normalized;
|
|
1145
1138
|
children.push(normalized.node);
|
|
1146
1139
|
nodeCount += normalized.nodeCount;
|
|
@@ -1258,8 +1251,215 @@ function parseRemoteMutationRecord(value) {
|
|
|
1258
1251
|
function isObjectRecord(value) {
|
|
1259
1252
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1260
1253
|
}
|
|
1261
|
-
|
|
1262
|
-
|
|
1254
|
+
// src/remote-dom-host-shared.ts
|
|
1255
|
+
const REMOTE_DOM_NODE_ID_ATTRIBUTE = "data-fluid-remote-dom-node-id";
|
|
1256
|
+
/** Serializes a DOM event and hands it to the worker's listener. */
|
|
1257
|
+
function deliverRemoteDomEvent({ event, eventName, currentTargetId, currentTargetTagName, listener, reporter, isDisposed }) {
|
|
1258
|
+
if (eventName === "submit" && event.cancelable) event.preventDefault();
|
|
1259
|
+
const targetId = resolveRenderedRemoteNodeId(event) ?? currentTargetId;
|
|
1260
|
+
const payload = serializeRemoteDomEvent(event, targetId, currentTargetId, currentTargetTagName);
|
|
1261
|
+
if (!payload) return;
|
|
1262
|
+
try {
|
|
1263
|
+
const result = listener({
|
|
1264
|
+
targetId,
|
|
1265
|
+
detail: toSerializableEventPayload(payload)
|
|
1266
|
+
});
|
|
1267
|
+
if (isPromiseLike(result)) result.catch((error) => {
|
|
1268
|
+
if (!isDisposed()) reportHostError(reporter, "Remote DOM event delivery failed", error);
|
|
1269
|
+
});
|
|
1270
|
+
} catch (error) {
|
|
1271
|
+
if (!isDisposed()) reportHostError(reporter, "Remote DOM event delivery failed", error);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* True when an element between the event's target and `currentTargetId`
|
|
1276
|
+
* has its own listener for the event, so the closer one handles it.
|
|
1277
|
+
*/
|
|
1278
|
+
function hasCloserRemoteEventListener(event, currentTargetId, hasListener) {
|
|
1279
|
+
for (const pathTarget of event.composedPath()) {
|
|
1280
|
+
if (!(pathTarget instanceof Element)) continue;
|
|
1281
|
+
const id = pathTarget.getAttribute(REMOTE_DOM_NODE_ID_ATTRIBUTE);
|
|
1282
|
+
if (!id) continue;
|
|
1283
|
+
if (id === currentTargetId) return false;
|
|
1284
|
+
if (hasListener(id)) return true;
|
|
1285
|
+
}
|
|
1286
|
+
return false;
|
|
1287
|
+
}
|
|
1288
|
+
function resolveRenderedRemoteNodeId(event) {
|
|
1289
|
+
for (const pathTarget of event.composedPath()) {
|
|
1290
|
+
if (!(pathTarget instanceof Element)) continue;
|
|
1291
|
+
const id = pathTarget.getAttribute(REMOTE_DOM_NODE_ID_ATTRIBUTE);
|
|
1292
|
+
if (id) return id;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
/** Answers a worker's capability call, checked against what it declared. */
|
|
1296
|
+
function callRemoteDomCapability(context, capability, method, payload) {
|
|
1297
|
+
if (context.isDisposed()) return Promise.reject(/* @__PURE__ */ new Error("Remote DOM widget has been disposed"));
|
|
1298
|
+
if (!context.declared.some((declaration) => declaration.name === capability)) return Promise.reject(/* @__PURE__ */ new Error(`Remote DOM capability "${capability}" was not declared`));
|
|
1299
|
+
if (payload !== void 0 && !require_remote_dom_values.isRemoteDomSerializableValue(payload)) return Promise.reject(/* @__PURE__ */ new Error("Remote DOM capability payload was not serializable"));
|
|
1300
|
+
if (capability === "fullscreen" && context.onFullscreen) return Promise.resolve().then(() => context.onFullscreen?.({
|
|
1301
|
+
method,
|
|
1302
|
+
...payload === void 0 ? {} : { payload },
|
|
1303
|
+
host: context.host,
|
|
1304
|
+
shadowRoot: context.shadowRoot
|
|
1305
|
+
})).then((result) => {
|
|
1306
|
+
if (result === void 0) throw new Error("Remote DOM fullscreen handler returned no result");
|
|
1307
|
+
return assertSerializableCapabilityResult(result);
|
|
1308
|
+
});
|
|
1309
|
+
if (!context.callCapability) return Promise.reject(/* @__PURE__ */ new Error(`No host handler is configured for capability "${capability}"`));
|
|
1310
|
+
return Promise.resolve().then(() => context.callCapability?.(capability, method, payload)).then((result) => {
|
|
1311
|
+
if (result === void 0) throw new Error(`Capability handler for "${capability}" returned no result`);
|
|
1312
|
+
return assertSerializableCapabilityResult(result);
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
function assertSerializableCapabilityResult(result) {
|
|
1316
|
+
if (!require_remote_dom_values.isRemoteDomSerializableValue(result)) throw new Error("Remote DOM capability result was not serializable");
|
|
1317
|
+
return result;
|
|
1318
|
+
}
|
|
1319
|
+
/** Routes a click on a drawn anchor to the host's navigation handler. */
|
|
1320
|
+
function handleRemoteDomNavigationIntent(context, event) {
|
|
1321
|
+
if (!(event instanceof MouseEvent)) return;
|
|
1322
|
+
const anchor = (event.target instanceof Element ? event.target : event.target instanceof Text ? event.target.parentElement : null)?.closest("a[href]");
|
|
1323
|
+
if (!(anchor instanceof HTMLAnchorElement)) return;
|
|
1324
|
+
if (!context.shadowRoot.contains(anchor)) return;
|
|
1325
|
+
if (resolveAllowedAnchorUrl(anchor.getAttribute("href"), context.allowedAnchorUrls)) {
|
|
1326
|
+
enforceAllowedAnchorSafetyAttributes(anchor);
|
|
1327
|
+
return;
|
|
1328
|
+
}
|
|
1329
|
+
if (event.cancelable) event.preventDefault();
|
|
1330
|
+
const href = sanitizeRemoteDomUrl(anchor.getAttribute("href"), {
|
|
1331
|
+
allowHashOnly: true,
|
|
1332
|
+
allowMailTo: false,
|
|
1333
|
+
allowRelative: true,
|
|
1334
|
+
allowTel: false,
|
|
1335
|
+
allowedHttpOriginGroups: ["navigation"],
|
|
1336
|
+
originPolicy: context.urlOriginPolicy,
|
|
1337
|
+
relativeUrlBase: "navigation"
|
|
1338
|
+
});
|
|
1339
|
+
const url = href ? resolveInternalNavigationUrl(href, context.navigationOrigin) : void 0;
|
|
1340
|
+
if (!href || !url || !context.onNavigate) {
|
|
1341
|
+
reportHostError(context, "Remote DOM navigation was blocked because no allowed internal route handler was available");
|
|
1342
|
+
return;
|
|
1343
|
+
}
|
|
1344
|
+
const targetId = anchor.closest(`[data-fluid-remote-dom-node-id]`)?.getAttribute("data-fluid-remote-dom-node-id") ?? void 0;
|
|
1345
|
+
Promise.resolve(context.onNavigate({
|
|
1346
|
+
href,
|
|
1347
|
+
url,
|
|
1348
|
+
source: "anchor",
|
|
1349
|
+
...targetId === void 0 ? {} : { targetId },
|
|
1350
|
+
altKey: event.altKey,
|
|
1351
|
+
button: event.button,
|
|
1352
|
+
ctrlKey: event.ctrlKey,
|
|
1353
|
+
metaKey: event.metaKey,
|
|
1354
|
+
shiftKey: event.shiftKey
|
|
1355
|
+
})).catch((error) => {
|
|
1356
|
+
if (!context.isDisposed()) reportHostError(context, "Remote DOM navigation handler failed", error);
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
function resolveAllowedAnchorUrl(href, allowedAnchorUrls) {
|
|
1360
|
+
if (!href || !allowedAnchorUrls) return void 0;
|
|
1361
|
+
let parsed;
|
|
1362
|
+
try {
|
|
1363
|
+
parsed = new URL(href);
|
|
1364
|
+
} catch {
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return;
|
|
1368
|
+
return allowedAnchorUrls.has(parsed.href) ? parsed.href : void 0;
|
|
1369
|
+
}
|
|
1370
|
+
/** Forces new-tab safety on every drawn anchor whose URL is allowed. */
|
|
1371
|
+
function enforceAllowedAnchorSafety(root, allowedAnchorUrls) {
|
|
1372
|
+
if (!allowedAnchorUrls) return;
|
|
1373
|
+
for (const anchor of root.querySelectorAll("a[href]")) if (resolveAllowedAnchorUrl(anchor.getAttribute("href"), allowedAnchorUrls)) enforceAllowedAnchorSafetyAttributes(anchor);
|
|
1374
|
+
}
|
|
1375
|
+
function enforceAllowedAnchorSafetyAttributes(anchor) {
|
|
1376
|
+
anchor.target = "_blank";
|
|
1377
|
+
const relTokens = new Set(anchor.rel.split(/\s+/u).filter(Boolean));
|
|
1378
|
+
relTokens.add("noopener");
|
|
1379
|
+
relTokens.add("noreferrer");
|
|
1380
|
+
anchor.rel = Array.from(relTokens).join(" ");
|
|
1381
|
+
anchor.removeAttribute("download");
|
|
1382
|
+
}
|
|
1383
|
+
function normalizeNavigationOrigin(value) {
|
|
1384
|
+
if (!value) return void 0;
|
|
1385
|
+
try {
|
|
1386
|
+
const url = new URL(value);
|
|
1387
|
+
return url.protocol === "http:" || url.protocol === "https:" ? url.origin : void 0;
|
|
1388
|
+
} catch {
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
function resolveInternalNavigationUrl(href, navigationOrigin) {
|
|
1393
|
+
if (href.startsWith("#")) return href;
|
|
1394
|
+
if (href.startsWith("//") || /^https?:(?!\/\/)/iu.test(href)) return;
|
|
1395
|
+
try {
|
|
1396
|
+
const url = new URL(href, navigationOrigin ?? "https://fluid.local");
|
|
1397
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") return;
|
|
1398
|
+
if (/^[a-z][a-z\d+.-]*:/iu.test(href) && (!navigationOrigin || url.origin !== navigationOrigin)) return;
|
|
1399
|
+
return `${url.pathname}${url.search}${url.hash}`;
|
|
1400
|
+
} catch {
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
function createSubmitPreventionListener() {
|
|
1405
|
+
return (event) => {
|
|
1406
|
+
if (event.cancelable) event.preventDefault();
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
function toSerializableEventPayload(payload) {
|
|
1410
|
+
const result = {
|
|
1411
|
+
bubbles: payload.bubbles,
|
|
1412
|
+
cancelable: payload.cancelable,
|
|
1413
|
+
currentTargetId: payload.currentTargetId,
|
|
1414
|
+
defaultPrevented: payload.defaultPrevented,
|
|
1415
|
+
targetId: payload.targetId,
|
|
1416
|
+
type: payload.type
|
|
1417
|
+
};
|
|
1418
|
+
for (const key of [
|
|
1419
|
+
"altKey",
|
|
1420
|
+
"button",
|
|
1421
|
+
"buttons",
|
|
1422
|
+
"checked",
|
|
1423
|
+
"clientX",
|
|
1424
|
+
"clientY",
|
|
1425
|
+
"code",
|
|
1426
|
+
"ctrlKey",
|
|
1427
|
+
"detailJson",
|
|
1428
|
+
"isPrimary",
|
|
1429
|
+
"key",
|
|
1430
|
+
"metaKey",
|
|
1431
|
+
"pointerId",
|
|
1432
|
+
"pointerType",
|
|
1433
|
+
"shiftKey",
|
|
1434
|
+
"value"
|
|
1435
|
+
]) {
|
|
1436
|
+
const value = payload[key];
|
|
1437
|
+
if (value !== void 0) result[key] = value;
|
|
1438
|
+
}
|
|
1439
|
+
return result;
|
|
1440
|
+
}
|
|
1441
|
+
function isPromiseLike(value) {
|
|
1442
|
+
return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
|
|
1443
|
+
}
|
|
1444
|
+
function reportHostError(reporter, message, cause) {
|
|
1445
|
+
try {
|
|
1446
|
+
reporter.onError?.(new Error(message, cause === void 0 ? {} : { cause }));
|
|
1447
|
+
} catch {}
|
|
1448
|
+
}
|
|
1449
|
+
function collectCleanupErrors(cleanupSteps) {
|
|
1450
|
+
const errors = [];
|
|
1451
|
+
for (const cleanup of cleanupSteps) try {
|
|
1452
|
+
cleanup();
|
|
1453
|
+
} catch (error) {
|
|
1454
|
+
errors.push(error);
|
|
1455
|
+
}
|
|
1456
|
+
return errors;
|
|
1457
|
+
}
|
|
1458
|
+
function reportCleanupErrors(reporter, message, errors) {
|
|
1459
|
+
if (errors.length === 0) return;
|
|
1460
|
+
reportHostError(reporter, message, errors.length === 1 ? errors[0] : new AggregateError(errors, "Multiple cleanup operations failed"));
|
|
1461
|
+
}
|
|
1462
|
+
// src/remote-dom-styles.ts
|
|
1263
1463
|
const remoteDomCssArtifactCache = /* @__PURE__ */ new Map();
|
|
1264
1464
|
const DEFAULT_THEME_DATA_ATTRIBUTES = [
|
|
1265
1465
|
"data-theme",
|
|
@@ -1275,7 +1475,7 @@ function attachRemoteDomStyles({ artifact, root, cssText, widgetCssText, cssUrls
|
|
|
1275
1475
|
const acquiredArtifacts = [];
|
|
1276
1476
|
let disposed = false;
|
|
1277
1477
|
let failureReported = false;
|
|
1278
|
-
const resolvedUrlOriginPolicy = urlOriginPolicy ?? require_remote_dom_values.createRemoteDomUrlOriginPolicy({ artifactUrls: collectArtifactUrls
|
|
1478
|
+
const resolvedUrlOriginPolicy = urlOriginPolicy ?? require_remote_dom_values.createRemoteDomUrlOriginPolicy({ artifactUrls: collectArtifactUrls(artifact) });
|
|
1279
1479
|
const { sources, failedSourceCount: rejectedSourceCount } = createStyleSources({
|
|
1280
1480
|
artifact,
|
|
1281
1481
|
cssText,
|
|
@@ -1445,7 +1645,7 @@ function createRemoteDomThemeBridge(options) {
|
|
|
1445
1645
|
}
|
|
1446
1646
|
};
|
|
1447
1647
|
}
|
|
1448
|
-
function collectArtifactUrls
|
|
1648
|
+
function collectArtifactUrls(artifact) {
|
|
1449
1649
|
return [
|
|
1450
1650
|
artifact.workerEntryUrl,
|
|
1451
1651
|
...artifact.cssUrls,
|
|
@@ -1758,659 +1958,89 @@ function mirrorClasses({ host, sourceElement, classNames, managedClasses, origin
|
|
|
1758
1958
|
host.classList.add(className);
|
|
1759
1959
|
}
|
|
1760
1960
|
}
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
const BOOLEAN_ATTRIBUTE_REACT_PROPERTIES = new Map([
|
|
1766
|
-
["allowfullscreen", "allowFullScreen"],
|
|
1767
|
-
["async", "async"],
|
|
1768
|
-
["autofocus", "autoFocus"],
|
|
1769
|
-
["autoplay", "autoPlay"],
|
|
1770
|
-
["checked", "checked"],
|
|
1771
|
-
["controls", "controls"],
|
|
1772
|
-
["default", "default"],
|
|
1773
|
-
["defer", "defer"],
|
|
1774
|
-
["disabled", "disabled"],
|
|
1775
|
-
["disablepictureinpicture", "disablePictureInPicture"],
|
|
1776
|
-
["disableremoteplayback", "disableRemotePlayback"],
|
|
1777
|
-
["formnovalidate", "formNoValidate"],
|
|
1778
|
-
["hidden", "hidden"],
|
|
1779
|
-
["inert", "inert"],
|
|
1780
|
-
["itemscope", "itemScope"],
|
|
1781
|
-
["loop", "loop"],
|
|
1782
|
-
["multiple", "multiple"],
|
|
1783
|
-
["muted", "muted"],
|
|
1784
|
-
["nomodule", "noModule"],
|
|
1785
|
-
["novalidate", "noValidate"],
|
|
1786
|
-
["open", "open"],
|
|
1787
|
-
["playsinline", "playsInline"],
|
|
1788
|
-
["readonly", "readOnly"],
|
|
1789
|
-
["required", "required"],
|
|
1790
|
-
["reversed", "reversed"],
|
|
1791
|
-
["selected", "selected"]
|
|
1792
|
-
]);
|
|
1793
|
-
function createRemoteComponentRenderers(options, isDisposed) {
|
|
1794
|
-
const renderers = /* @__PURE__ */ new Map();
|
|
1795
|
-
const fluidTags = new Set(require_remote_dom_values.REMOTE_DOM_UI_COMPONENTS.map(({ tagName }) => tagName));
|
|
1796
|
-
for (const tagName of require_remote_dom_values.REMOTE_DOM_ALLOWED_TAG_NAMES) {
|
|
1797
|
-
if (fluidTags.has(tagName)) continue;
|
|
1798
|
-
renderers.set(tagName, createNativeRemoteComponentRenderer(tagName, options, isDisposed));
|
|
1799
|
-
}
|
|
1800
|
-
for (const definition of require_remote_dom_values.REMOTE_DOM_UI_COMPONENTS) {
|
|
1801
|
-
if (definition.contractVersion !== "1") continue;
|
|
1802
|
-
renderers.set(definition.tagName, createNativeRemoteComponentRenderer(definition.tagName, options, isDisposed));
|
|
1803
|
-
}
|
|
1804
|
-
renderers.set("remote-fragment", _remote_dom_react_host.RemoteFragmentRenderer);
|
|
1805
|
-
for (const [tagName, renderer] of options.componentRenderers ?? []) {
|
|
1806
|
-
if (!fluidTags.has(tagName)) continue;
|
|
1807
|
-
renderers.set(tagName, renderer);
|
|
1808
|
-
}
|
|
1809
|
-
return renderers;
|
|
1810
|
-
}
|
|
1811
|
-
function createNativeRemoteComponentRenderer(tagName, options, isDisposed) {
|
|
1812
|
-
function NativeRemoteComponent({ element, receiver, components }) {
|
|
1813
|
-
const attachedElement = (0, _remote_dom_react_host.useRemoteReceived)(element, receiver);
|
|
1814
|
-
const elementRef = (0, react.useRef)(null);
|
|
1815
|
-
(0, react.useEffect)(() => {
|
|
1816
|
-
const hostElement = elementRef.current;
|
|
1817
|
-
if (!hostElement || !attachedElement) return;
|
|
1818
|
-
const cleanup = [];
|
|
1819
|
-
for (const [eventName, listener] of Object.entries(attachedElement.eventListeners)) {
|
|
1820
|
-
if (typeof listener !== "function") continue;
|
|
1821
|
-
const handleEvent = (event) => {
|
|
1822
|
-
if (hasCloserRemoteEventListener(receiver, event, attachedElement.id, eventName)) return;
|
|
1823
|
-
deliverRemoteDomEvent({
|
|
1824
|
-
event,
|
|
1825
|
-
eventName,
|
|
1826
|
-
currentTargetId: attachedElement.id,
|
|
1827
|
-
currentTargetTagName: tagName,
|
|
1828
|
-
listener,
|
|
1829
|
-
options,
|
|
1830
|
-
isDisposed
|
|
1831
|
-
});
|
|
1832
|
-
};
|
|
1833
|
-
hostElement.addEventListener(eventName, handleEvent);
|
|
1834
|
-
cleanup.push(() => hostElement.removeEventListener(eventName, handleEvent));
|
|
1835
|
-
}
|
|
1836
|
-
return () => {
|
|
1837
|
-
for (const dispose of cleanup) dispose();
|
|
1838
|
-
};
|
|
1839
|
-
}, [
|
|
1840
|
-
attachedElement,
|
|
1841
|
-
attachedElement?.version,
|
|
1842
|
-
receiver
|
|
1843
|
-
]);
|
|
1844
|
-
(0, react.useLayoutEffect)(() => {
|
|
1845
|
-
const hostElement = elementRef.current;
|
|
1846
|
-
if (!(hostElement instanceof HTMLInputElement) || !attachedElement) return;
|
|
1847
|
-
const value = attachedElement.properties.value;
|
|
1848
|
-
if (typeof value === "string" && hostElement.value !== value) hostElement.value = value;
|
|
1849
|
-
const checked = attachedElement.properties.checked;
|
|
1850
|
-
if (typeof checked === "boolean" && hostElement.checked !== checked) hostElement.checked = checked;
|
|
1851
|
-
}, [attachedElement, attachedElement?.version]);
|
|
1852
|
-
if (!attachedElement) return null;
|
|
1853
|
-
const domProps = {};
|
|
1854
|
-
for (const [name, value] of Object.entries({
|
|
1855
|
-
...attachedElement.attributes,
|
|
1856
|
-
...attachedElement.properties
|
|
1857
|
-
})) {
|
|
1858
|
-
if (tagName === "input" && (name === "checked" || name === "value")) continue;
|
|
1859
|
-
const booleanProperty = BOOLEAN_ATTRIBUTE_REACT_PROPERTIES.get(name);
|
|
1860
|
-
domProps[booleanProperty ?? toReactDomPropertyName(name)] = booleanProperty && typeof value === "string" ? true : value;
|
|
1861
|
-
}
|
|
1862
|
-
domProps["data-fluid-remote-dom-node-id"] = attachedElement.id;
|
|
1863
|
-
domProps.ref = elementRef;
|
|
1864
|
-
const renderOptions = {
|
|
1865
|
-
receiver,
|
|
1866
|
-
components
|
|
1867
|
-
};
|
|
1868
|
-
return (0, react.createElement)(tagName, domProps, ...attachedElement.children.map((child) => (0, _remote_dom_react_host.renderRemoteNode)(child, renderOptions)));
|
|
1869
|
-
}
|
|
1870
|
-
NativeRemoteComponent.displayName = `RemoteDomNative(${tagName})`;
|
|
1871
|
-
return NativeRemoteComponent;
|
|
1872
|
-
}
|
|
1873
|
-
function RemoteRootEventBoundary({ receiver, container, options, isDisposed, children }) {
|
|
1874
|
-
const root = (0, _remote_dom_react_host.useRemoteReceived)(receiver.root, receiver);
|
|
1875
|
-
(0, react.useEffect)(() => {
|
|
1876
|
-
if (!root) return;
|
|
1877
|
-
const cleanup = [];
|
|
1878
|
-
for (const [eventName, listener] of Object.entries(root.eventListeners)) {
|
|
1879
|
-
if (typeof listener !== "function") continue;
|
|
1880
|
-
const handleEvent = (event) => {
|
|
1881
|
-
if (hasCloserRemoteEventListener(receiver, event, _remote_dom_core.ROOT_ID, eventName)) return;
|
|
1882
|
-
deliverRemoteDomEvent({
|
|
1883
|
-
event,
|
|
1884
|
-
eventName,
|
|
1885
|
-
currentTargetId: _remote_dom_core.ROOT_ID,
|
|
1886
|
-
listener,
|
|
1887
|
-
options,
|
|
1888
|
-
isDisposed
|
|
1889
|
-
});
|
|
1890
|
-
};
|
|
1891
|
-
container.addEventListener(eventName, handleEvent, { capture: true });
|
|
1892
|
-
cleanup.push(() => container.removeEventListener(eventName, handleEvent, { capture: true }));
|
|
1893
|
-
}
|
|
1894
|
-
return () => {
|
|
1895
|
-
for (const dispose of cleanup) dispose();
|
|
1896
|
-
};
|
|
1897
|
-
}, [
|
|
1898
|
-
container,
|
|
1899
|
-
isDisposed,
|
|
1900
|
-
options,
|
|
1901
|
-
receiver,
|
|
1902
|
-
root,
|
|
1903
|
-
root?.version
|
|
1904
|
-
]);
|
|
1905
|
-
return children;
|
|
1906
|
-
}
|
|
1907
|
-
function deliverRemoteDomEvent({ event, eventName, currentTargetId, currentTargetTagName, listener, options, isDisposed }) {
|
|
1908
|
-
if (eventName === "submit" && event.cancelable) event.preventDefault();
|
|
1909
|
-
const targetId = resolveRenderedRemoteNodeId(event) ?? currentTargetId;
|
|
1910
|
-
const payload = serializeRemoteDomEvent(event, targetId, currentTargetId, currentTargetTagName);
|
|
1911
|
-
if (!payload) return;
|
|
1912
|
-
try {
|
|
1913
|
-
const result = listener({
|
|
1914
|
-
targetId,
|
|
1915
|
-
detail: toSerializableEventPayload(payload)
|
|
1916
|
-
});
|
|
1917
|
-
if (isPromiseLike(result)) result.catch((error) => {
|
|
1918
|
-
if (!isDisposed()) reportError(options, "Remote DOM event delivery failed", error);
|
|
1919
|
-
});
|
|
1920
|
-
} catch (error) {
|
|
1921
|
-
if (!isDisposed()) reportError(options, "Remote DOM event delivery failed", error);
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1924
|
-
function hasCloserRemoteEventListener(receiver, event, currentTargetId, eventName) {
|
|
1925
|
-
for (const pathTarget of event.composedPath()) {
|
|
1926
|
-
if (!(pathTarget instanceof Element)) continue;
|
|
1927
|
-
const id = pathTarget.getAttribute("data-fluid-remote-dom-node-id");
|
|
1928
|
-
if (!id) continue;
|
|
1929
|
-
if (id === currentTargetId) return false;
|
|
1930
|
-
const remoteNode = receiver.get({ id });
|
|
1931
|
-
if (remoteNode && "eventListeners" in remoteNode && typeof remoteNode.eventListeners[eventName] === "function") return true;
|
|
1932
|
-
}
|
|
1933
|
-
return false;
|
|
1934
|
-
}
|
|
1935
|
-
function resolveRenderedRemoteNodeId(event) {
|
|
1936
|
-
for (const pathTarget of event.composedPath()) {
|
|
1937
|
-
if (!(pathTarget instanceof Element)) continue;
|
|
1938
|
-
const id = pathTarget.getAttribute("data-fluid-remote-dom-node-id");
|
|
1939
|
-
if (id) return id;
|
|
1940
|
-
}
|
|
1941
|
-
}
|
|
1942
|
-
function toReactDomPropertyName(name) {
|
|
1943
|
-
switch (name) {
|
|
1944
|
-
case "class": return "className";
|
|
1945
|
-
case "for": return "htmlFor";
|
|
1946
|
-
case "readonly": return "readOnly";
|
|
1947
|
-
case "tabindex": return "tabIndex";
|
|
1948
|
-
default: return name;
|
|
1949
|
-
}
|
|
1950
|
-
}
|
|
1951
|
-
function getSupportedUiContractVersions(componentRenderers) {
|
|
1952
|
-
return require_remote_dom_values.REMOTE_DOM_UI_COMPONENTS.every(({ contractVersion, tagName }) => contractVersion !== "2" || componentRenderers.has(tagName)) ? require_remote_dom_values.REMOTE_DOM_SUPPORTED_UI_CONTRACT_VERSIONS : require_remote_dom_values.REMOTE_DOM_SUPPORTED_UI_CONTRACT_VERSIONS.filter((version) => version !== "2");
|
|
1953
|
-
}
|
|
1954
|
-
/**
|
|
1955
|
-
* Mounts one Remote DOM widget worker into an isolated shadow root.
|
|
1956
|
-
*
|
|
1957
|
-
* The low-level runtime supports native Remote DOM elements by default. A host
|
|
1958
|
-
* that supports worker-facing Fluid UI components must also provide the full
|
|
1959
|
-
* reviewed {@link MountRemoteDomWidgetOptions.componentRenderers} map, a
|
|
1960
|
-
* containment-aware {@link MountRemoteDomWidgetOptions.wrapRemoteRoot}, and
|
|
1961
|
-
* the matching Fluid component CSS. The runtime advertises Fluid UI contract
|
|
1962
|
-
* v2 only when every v2 renderer is present.
|
|
1963
|
-
*/
|
|
1964
|
-
function mountRemoteDomWidget(options) {
|
|
1965
|
-
const initialProps = options.props ?? null;
|
|
1966
|
-
assertSerializable(initialProps, "Initial widget props");
|
|
1967
|
-
const shadowRoot = createShadowRoot(options.host);
|
|
1968
|
-
const navigationOrigin = normalizeNavigationOrigin(options.hostOrigin);
|
|
1969
|
-
const urlOriginPolicy = require_remote_dom_values.createRemoteDomUrlOriginPolicy({
|
|
1970
|
-
artifactUrls: collectArtifactUrls(options.artifact),
|
|
1971
|
-
...options.mediaOrigins === void 0 ? {} : { mediaOrigins: options.mediaOrigins },
|
|
1972
|
-
...navigationOrigin === void 0 ? {} : { navigationOrigin }
|
|
1973
|
-
});
|
|
1974
|
-
const styles = attachRemoteDomStyles({
|
|
1975
|
-
artifact: options.artifact,
|
|
1976
|
-
root: shadowRoot,
|
|
1977
|
-
urlOriginPolicy,
|
|
1978
|
-
onFailure: (count) => {
|
|
1979
|
-
reportError(options, `${count} Remote DOM widget styles failed to load`);
|
|
1980
|
-
},
|
|
1981
|
-
...options.cssText === void 0 ? {} : { cssText: options.cssText },
|
|
1982
|
-
...options.widgetCssText === void 0 ? {} : { widgetCssText: options.widgetCssText },
|
|
1983
|
-
...options.cssUrls === void 0 ? {} : { cssUrls: options.cssUrls },
|
|
1984
|
-
...options.fluidComponentCssText === void 0 ? {} : { fluidComponentCssText: options.fluidComponentCssText },
|
|
1985
|
-
...options.fluidComponentCssUrls === void 0 ? {} : { fluidComponentCssUrls: options.fluidComponentCssUrls },
|
|
1986
|
-
...options.themeBridgeCssText === void 0 ? {} : { themeBridgeCssText: options.themeBridgeCssText },
|
|
1987
|
-
...options.themeBridge === void 0 ? {} : { themeBridge: options.themeBridge },
|
|
1988
|
-
...options.fetchCss === void 0 ? {} : { fetchCss: options.fetchCss },
|
|
1989
|
-
...options.useConstructableStylesheets === void 0 ? {} : { useConstructableStylesheets: options.useConstructableStylesheets }
|
|
1990
|
-
});
|
|
1991
|
-
let worker;
|
|
1992
|
-
try {
|
|
1993
|
-
worker = (options.workerFactory ?? createDefaultWorker)(options.artifact.workerEntryUrl, { type: "module" });
|
|
1994
|
-
} catch (error) {
|
|
1995
|
-
reportCleanupErrors(options, "Remote DOM widget setup cleanup failed", collectCleanupErrors([() => styles.dispose(), () => clearRenderedRemoteDomNodes(shadowRoot)]));
|
|
1996
|
-
throw error;
|
|
1997
|
-
}
|
|
1998
|
-
let thread;
|
|
1999
|
-
try {
|
|
2000
|
-
thread = new require_Thread.Thread(createWorkerMessageTarget(worker));
|
|
2001
|
-
} catch (error) {
|
|
2002
|
-
reportCleanupErrors(options, "Remote DOM widget setup cleanup failed", collectCleanupErrors([
|
|
2003
|
-
() => styles.dispose(),
|
|
2004
|
-
() => worker.terminate(),
|
|
2005
|
-
() => clearRenderedRemoteDomNodes(shadowRoot)
|
|
2006
|
-
]));
|
|
2007
|
-
throw error;
|
|
2008
|
-
}
|
|
2009
|
-
let state;
|
|
2010
|
-
const receiver = new _remote_dom_react_host.RemoteReceiver({
|
|
2011
|
-
retain: require_Thread.retain,
|
|
2012
|
-
release: require_Thread.release
|
|
2013
|
-
});
|
|
2014
|
-
const renderContainer = document.createElement("div");
|
|
2015
|
-
renderContainer.setAttribute("data-fluid-remote-dom-render-root", "");
|
|
2016
|
-
const portalContainer = document.createElement("div");
|
|
2017
|
-
portalContainer.setAttribute("data-fluid-remote-dom-portal-container", "");
|
|
2018
|
-
shadowRoot.append(renderContainer, portalContainer);
|
|
2019
|
-
const submitListener = createSubmitPreventionListener();
|
|
2020
|
-
const navigationListener = (event) => {
|
|
2021
|
-
handleNavigationIntent(state, event);
|
|
2022
|
-
};
|
|
2023
|
-
const reactRoot = (0, react_dom_client.createRoot)(renderContainer, { onUncaughtError(error) {
|
|
2024
|
-
reportError(options, "Remote DOM host rendering failed", error);
|
|
2025
|
-
queueMicrotask(() => {
|
|
2026
|
-
if (!state.disposed) disposeAfterFailure(state, false);
|
|
2027
|
-
});
|
|
2028
|
-
} });
|
|
2029
|
-
state = {
|
|
2030
|
-
options,
|
|
2031
|
-
shadowRoot,
|
|
2032
|
-
worker,
|
|
2033
|
-
thread,
|
|
2034
|
-
styles,
|
|
2035
|
-
urlOriginPolicy,
|
|
2036
|
-
navigationOrigin,
|
|
2037
|
-
receiver,
|
|
2038
|
-
reactRoot,
|
|
2039
|
-
renderContainer,
|
|
2040
|
-
portalContainer,
|
|
2041
|
-
submitListener,
|
|
2042
|
-
navigationListener,
|
|
2043
|
-
disposed: false,
|
|
2044
|
-
cleanupStarted: false
|
|
2045
|
-
};
|
|
2046
|
-
const componentRenderers = createRemoteComponentRenderers(options, () => state.disposed);
|
|
2047
|
-
const remoteRoot = (0, react.createElement)(RemoteRootEventBoundary, {
|
|
2048
|
-
receiver,
|
|
2049
|
-
container: renderContainer,
|
|
2050
|
-
options,
|
|
2051
|
-
isDisposed: () => state?.disposed ?? false
|
|
2052
|
-
}, (0, react.createElement)(_remote_dom_react_host.RemoteRootRenderer, {
|
|
2053
|
-
receiver,
|
|
2054
|
-
components: componentRenderers
|
|
2055
|
-
}));
|
|
2056
|
-
(0, react_dom.flushSync)(() => {
|
|
2057
|
-
reactRoot.render(options.wrapRemoteRoot ? options.wrapRemoteRoot(remoteRoot, portalContainer) : remoteRoot);
|
|
2058
|
-
});
|
|
2059
|
-
const connection = createSanitizingRemoteConnection({
|
|
2060
|
-
connection: receiver.connection,
|
|
2061
|
-
...options.allowedAnchorUrls ? { allowedAnchorUrls: options.allowedAnchorUrls } : {},
|
|
2062
|
-
urlOriginPolicy,
|
|
2063
|
-
maxMutationBatchSize: options.maxMutationBatchSize ?? DEFAULT_MAX_MUTATION_BATCH_SIZE,
|
|
2064
|
-
maxDomNodeCount: options.maxDomNodeCount ?? DEFAULT_MAX_DOM_NODE_COUNT,
|
|
2065
|
-
onNodeLimitExceeded: () => {
|
|
2066
|
-
reportError(options, "Remote DOM widget exceeded its DOM node limit");
|
|
2067
|
-
},
|
|
2068
|
-
onInvalidRecord: (message) => reportError(options, message),
|
|
2069
|
-
onMutateError: (error) => reportError(options, "Remote DOM mutation could not be applied", error)
|
|
2070
|
-
});
|
|
2071
|
-
shadowRoot.addEventListener("submit", submitListener, { capture: true });
|
|
2072
|
-
shadowRoot.addEventListener("click", navigationListener, { capture: true });
|
|
2073
|
-
worker.onerror = (event) => {
|
|
2074
|
-
event.preventDefault?.();
|
|
2075
|
-
if (state.disposed) return;
|
|
2076
|
-
reportError(options, event.message || "Remote DOM widget worker failed", event.error);
|
|
2077
|
-
disposeAfterFailure(state, false);
|
|
2078
|
-
};
|
|
2079
|
-
const hostApi = {
|
|
2080
|
-
mutate(records) {
|
|
2081
|
-
if (state.disposed) return;
|
|
2082
|
-
(0, react_dom.flushSync)(() => connection.mutate(records));
|
|
2083
|
-
enforceAllowedAnchorSafety(state);
|
|
2084
|
-
},
|
|
2085
|
-
callCapability(capability, method, payload) {
|
|
2086
|
-
return callCapability(state, capability, method, payload);
|
|
2087
|
-
},
|
|
2088
|
-
reportError(error) {
|
|
2089
|
-
reportError(options, error.message);
|
|
2090
|
-
}
|
|
2091
|
-
};
|
|
2092
|
-
const ready = Promise.all([styles.ready, thread.imports.mount({
|
|
2093
|
-
widgetType: options.artifact.widgetType,
|
|
2094
|
-
props: initialProps,
|
|
2095
|
-
supportedUiContractVersions: getSupportedUiContractVersions(componentRenderers),
|
|
2096
|
-
...options.artifact.networkAccessGranted === true ? {
|
|
2097
|
-
networkAccessGranted: true,
|
|
2098
|
-
hostOrigin: options.hostOrigin
|
|
2099
|
-
} : {}
|
|
2100
|
-
}, hostApi)]).then(() => void 0);
|
|
2101
|
-
ready.catch((error) => {
|
|
2102
|
-
if (state.disposed) return;
|
|
2103
|
-
reportError(options, "Remote DOM widget failed to mount", error);
|
|
2104
|
-
disposeAfterFailure(state);
|
|
2105
|
-
});
|
|
2106
|
-
return {
|
|
2107
|
-
shadowRoot,
|
|
2108
|
-
styles,
|
|
2109
|
-
ready,
|
|
2110
|
-
updateProps(props) {
|
|
2111
|
-
if (state.disposed) return;
|
|
2112
|
-
assertSerializable(props, "Widget props");
|
|
2113
|
-
state.thread.imports.updateProps(props).catch((error) => {
|
|
2114
|
-
if (!state.disposed) reportError(options, "Remote DOM widget props update failed", error);
|
|
2115
|
-
});
|
|
2116
|
-
},
|
|
2117
|
-
dispose() {
|
|
2118
|
-
disposeMount(state);
|
|
2119
|
-
}
|
|
2120
|
-
};
|
|
2121
|
-
}
|
|
2122
|
-
function callCapability(state, capability, method, payload) {
|
|
2123
|
-
if (state.disposed) return Promise.reject(/* @__PURE__ */ new Error("Remote DOM widget has been disposed"));
|
|
2124
|
-
if (!state.options.artifact.capabilities.some((declaration) => declaration.name === capability)) return Promise.reject(/* @__PURE__ */ new Error(`Remote DOM capability "${capability}" was not declared`));
|
|
2125
|
-
if (payload !== void 0 && !require_remote_dom_values.isRemoteDomSerializableValue(payload)) return Promise.reject(/* @__PURE__ */ new Error("Remote DOM capability payload was not serializable"));
|
|
2126
|
-
if (capability === "fullscreen" && state.options.onFullscreen) return Promise.resolve().then(() => state.options.onFullscreen?.({
|
|
2127
|
-
method,
|
|
2128
|
-
...payload === void 0 ? {} : { payload },
|
|
2129
|
-
host: state.options.host,
|
|
2130
|
-
shadowRoot: state.shadowRoot
|
|
2131
|
-
})).then((result) => {
|
|
2132
|
-
if (result === void 0) throw new Error("Remote DOM fullscreen handler returned no result");
|
|
2133
|
-
return assertSerializableCapabilityResult(result);
|
|
2134
|
-
});
|
|
2135
|
-
if (!state.options.callCapability) return Promise.reject(/* @__PURE__ */ new Error(`No host handler is configured for capability "${capability}"`));
|
|
2136
|
-
return Promise.resolve().then(() => state.options.callCapability?.(capability, method, payload)).then((result) => {
|
|
2137
|
-
if (result === void 0) throw new Error(`Capability handler for "${capability}" returned no result`);
|
|
2138
|
-
return assertSerializableCapabilityResult(result);
|
|
2139
|
-
});
|
|
2140
|
-
}
|
|
2141
|
-
function assertSerializableCapabilityResult(result) {
|
|
2142
|
-
if (!require_remote_dom_values.isRemoteDomSerializableValue(result)) throw new Error("Remote DOM capability result was not serializable");
|
|
2143
|
-
return result;
|
|
2144
|
-
}
|
|
2145
|
-
function handleNavigationIntent(state, event) {
|
|
2146
|
-
if (!(event instanceof MouseEvent)) return;
|
|
2147
|
-
const anchor = (event.target instanceof Element ? event.target : event.target instanceof Text ? event.target.parentElement : null)?.closest("a[href]");
|
|
2148
|
-
if (!(anchor instanceof HTMLAnchorElement)) return;
|
|
2149
|
-
if (!state.shadowRoot.contains(anchor)) return;
|
|
2150
|
-
if (resolveAllowedAnchorUrl(anchor.getAttribute("href"), state.options.allowedAnchorUrls)) {
|
|
2151
|
-
enforceAllowedAnchorSafetyAttributes(anchor);
|
|
2152
|
-
return;
|
|
1961
|
+
Object.defineProperty(exports, "REMOTE_DOM_NODE_ID_ATTRIBUTE", {
|
|
1962
|
+
enumerable: true,
|
|
1963
|
+
get: function() {
|
|
1964
|
+
return REMOTE_DOM_NODE_ID_ATTRIBUTE;
|
|
2153
1965
|
}
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
allowTel: false,
|
|
2160
|
-
allowedHttpOriginGroups: ["navigation"],
|
|
2161
|
-
originPolicy: state.urlOriginPolicy,
|
|
2162
|
-
relativeUrlBase: "navigation"
|
|
2163
|
-
});
|
|
2164
|
-
const url = href ? resolveInternalNavigationUrl(href, state.navigationOrigin) : void 0;
|
|
2165
|
-
if (!href || !url || !state.options.onNavigate) {
|
|
2166
|
-
reportError(state.options, "Remote DOM navigation was blocked because no allowed internal route handler was available");
|
|
2167
|
-
return;
|
|
1966
|
+
});
|
|
1967
|
+
Object.defineProperty(exports, "REMOTE_DOM_WIDGET_STYLE_ATTRIBUTE", {
|
|
1968
|
+
enumerable: true,
|
|
1969
|
+
get: function() {
|
|
1970
|
+
return REMOTE_DOM_WIDGET_STYLE_ATTRIBUTE;
|
|
2168
1971
|
}
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
...targetId === void 0 ? {} : { targetId },
|
|
2175
|
-
altKey: event.altKey,
|
|
2176
|
-
button: event.button,
|
|
2177
|
-
ctrlKey: event.ctrlKey,
|
|
2178
|
-
metaKey: event.metaKey,
|
|
2179
|
-
shiftKey: event.shiftKey
|
|
2180
|
-
})).catch((error) => {
|
|
2181
|
-
if (!state.disposed) reportError(state.options, "Remote DOM navigation handler failed", error);
|
|
2182
|
-
});
|
|
2183
|
-
}
|
|
2184
|
-
function disposeMount(state, notifyWorker = true) {
|
|
2185
|
-
if (state.cleanupStarted) return;
|
|
2186
|
-
state.cleanupStarted = true;
|
|
2187
|
-
state.disposed = true;
|
|
2188
|
-
const cleanupSteps = [
|
|
2189
|
-
() => {
|
|
2190
|
-
state.worker.onerror = null;
|
|
2191
|
-
},
|
|
2192
|
-
() => {
|
|
2193
|
-
state.shadowRoot.removeEventListener("submit", state.submitListener, { capture: true });
|
|
2194
|
-
},
|
|
2195
|
-
() => {
|
|
2196
|
-
state.shadowRoot.removeEventListener("click", state.navigationListener, { capture: true });
|
|
2197
|
-
}
|
|
2198
|
-
];
|
|
2199
|
-
cleanupSteps.push(() => (0, react_dom.flushSync)(() => state.reactRoot.unmount()), () => clearRemoteReceiver(state.receiver), () => state.styles.dispose(), () => clearRenderedRemoteDomNodes(state.shadowRoot));
|
|
2200
|
-
const cleanupErrors = collectCleanupErrors(cleanupSteps);
|
|
2201
|
-
if (notifyWorker) Promise.resolve(state.thread.imports.dispose()).catch(() => void 0);
|
|
2202
|
-
queueMicrotask(() => {
|
|
2203
|
-
reportCleanupErrors(state.options, "Remote DOM widget asynchronous cleanup failed", collectCleanupErrors([() => state.thread.close(), () => state.worker.terminate()]));
|
|
2204
|
-
});
|
|
2205
|
-
if (cleanupErrors.length > 0) throw new AggregateError(cleanupErrors, "Remote DOM widget cleanup failed");
|
|
2206
|
-
}
|
|
2207
|
-
function disposeAfterFailure(state, notifyWorker = true) {
|
|
2208
|
-
try {
|
|
2209
|
-
disposeMount(state, notifyWorker);
|
|
2210
|
-
} catch (cleanupError) {
|
|
2211
|
-
reportError(state.options, "Remote DOM widget cleanup failed after an earlier error", cleanupError);
|
|
1972
|
+
});
|
|
1973
|
+
Object.defineProperty(exports, "attachRemoteDomStyles", {
|
|
1974
|
+
enumerable: true,
|
|
1975
|
+
get: function() {
|
|
1976
|
+
return attachRemoteDomStyles;
|
|
2212
1977
|
}
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
return
|
|
1978
|
+
});
|
|
1979
|
+
Object.defineProperty(exports, "callRemoteDomCapability", {
|
|
1980
|
+
enumerable: true,
|
|
1981
|
+
get: function() {
|
|
1982
|
+
return callRemoteDomCapability;
|
|
2218
1983
|
}
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
};
|
|
2225
|
-
}
|
|
2226
|
-
function collectArtifactUrls(artifact) {
|
|
2227
|
-
return [
|
|
2228
|
-
artifact.workerEntryUrl,
|
|
2229
|
-
...artifact.cssUrls,
|
|
2230
|
-
...artifact.assetUrls
|
|
2231
|
-
];
|
|
2232
|
-
}
|
|
2233
|
-
function normalizeNavigationOrigin(value) {
|
|
2234
|
-
if (!value) return void 0;
|
|
2235
|
-
try {
|
|
2236
|
-
const url = new URL(value);
|
|
2237
|
-
return url.protocol === "http:" || url.protocol === "https:" ? url.origin : void 0;
|
|
2238
|
-
} catch {
|
|
2239
|
-
return;
|
|
1984
|
+
});
|
|
1985
|
+
Object.defineProperty(exports, "collectCleanupErrors", {
|
|
1986
|
+
enumerable: true,
|
|
1987
|
+
get: function() {
|
|
1988
|
+
return collectCleanupErrors;
|
|
2240
1989
|
}
|
|
2241
|
-
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
parsed = new URL(href);
|
|
2247
|
-
} catch {
|
|
2248
|
-
return;
|
|
1990
|
+
});
|
|
1991
|
+
Object.defineProperty(exports, "createSanitizingRemoteConnection", {
|
|
1992
|
+
enumerable: true,
|
|
1993
|
+
get: function() {
|
|
1994
|
+
return createSanitizingRemoteConnection;
|
|
2249
1995
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
function
|
|
2254
|
-
|
|
2255
|
-
if (!resolveAllowedAnchorUrl(anchor.getAttribute("href"), state.options.allowedAnchorUrls)) continue;
|
|
2256
|
-
enforceAllowedAnchorSafetyAttributes(anchor);
|
|
1996
|
+
});
|
|
1997
|
+
Object.defineProperty(exports, "createSubmitPreventionListener", {
|
|
1998
|
+
enumerable: true,
|
|
1999
|
+
get: function() {
|
|
2000
|
+
return createSubmitPreventionListener;
|
|
2257
2001
|
}
|
|
2258
|
-
}
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
relTokens.add("noreferrer");
|
|
2264
|
-
anchor.rel = Array.from(relTokens).join(" ");
|
|
2265
|
-
anchor.removeAttribute("download");
|
|
2266
|
-
}
|
|
2267
|
-
function resolveInternalNavigationUrl(href, navigationOrigin) {
|
|
2268
|
-
if (href.startsWith("#")) return href;
|
|
2269
|
-
if (href.startsWith("//") || /^https?:(?!\/\/)/iu.test(href)) return;
|
|
2270
|
-
try {
|
|
2271
|
-
const url = new URL(href, navigationOrigin ?? "https://fluid.local");
|
|
2272
|
-
if (url.protocol !== "http:" && url.protocol !== "https:") return;
|
|
2273
|
-
if (/^[a-z][a-z\d+.-]*:/iu.test(href) && (!navigationOrigin || url.origin !== navigationOrigin)) return;
|
|
2274
|
-
return `${url.pathname}${url.search}${url.hash}`;
|
|
2275
|
-
} catch {
|
|
2276
|
-
return;
|
|
2002
|
+
});
|
|
2003
|
+
Object.defineProperty(exports, "deliverRemoteDomEvent", {
|
|
2004
|
+
enumerable: true,
|
|
2005
|
+
get: function() {
|
|
2006
|
+
return deliverRemoteDomEvent;
|
|
2277
2007
|
}
|
|
2278
|
-
}
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
return node instanceof HTMLStyleElement && node.hasAttribute("data-fluid-widget-style");
|
|
2284
|
-
}
|
|
2285
|
-
function clearRenderedRemoteDomNodes(shadowRoot) {
|
|
2286
|
-
for (const child of Array.from(shadowRoot.childNodes)) if (!isWidgetStyleNode(child)) child.remove();
|
|
2287
|
-
}
|
|
2288
|
-
function clearRemoteReceiver(receiver) {
|
|
2289
|
-
while (receiver.root.children.length > 0) receiver.connection.mutate([[
|
|
2290
|
-
_remote_dom_core.MUTATION_TYPE_REMOVE_CHILD,
|
|
2291
|
-
_remote_dom_core.ROOT_ID,
|
|
2292
|
-
0
|
|
2293
|
-
]]);
|
|
2294
|
-
}
|
|
2295
|
-
function toSerializableEventPayload(payload) {
|
|
2296
|
-
const result = {
|
|
2297
|
-
bubbles: payload.bubbles,
|
|
2298
|
-
cancelable: payload.cancelable,
|
|
2299
|
-
currentTargetId: payload.currentTargetId,
|
|
2300
|
-
defaultPrevented: payload.defaultPrevented,
|
|
2301
|
-
targetId: payload.targetId,
|
|
2302
|
-
type: payload.type
|
|
2303
|
-
};
|
|
2304
|
-
for (const key of [
|
|
2305
|
-
"altKey",
|
|
2306
|
-
"button",
|
|
2307
|
-
"buttons",
|
|
2308
|
-
"checked",
|
|
2309
|
-
"clientX",
|
|
2310
|
-
"clientY",
|
|
2311
|
-
"code",
|
|
2312
|
-
"ctrlKey",
|
|
2313
|
-
"detailJson",
|
|
2314
|
-
"isPrimary",
|
|
2315
|
-
"key",
|
|
2316
|
-
"metaKey",
|
|
2317
|
-
"pointerId",
|
|
2318
|
-
"pointerType",
|
|
2319
|
-
"shiftKey",
|
|
2320
|
-
"value"
|
|
2321
|
-
]) {
|
|
2322
|
-
const value = payload[key];
|
|
2323
|
-
if (value !== void 0) result[key] = value;
|
|
2008
|
+
});
|
|
2009
|
+
Object.defineProperty(exports, "enforceAllowedAnchorSafety", {
|
|
2010
|
+
enumerable: true,
|
|
2011
|
+
get: function() {
|
|
2012
|
+
return enforceAllowedAnchorSafety;
|
|
2324
2013
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
function createWorkerMessageTarget(worker) {
|
|
2331
|
-
return {
|
|
2332
|
-
send(message, transferables) {
|
|
2333
|
-
worker.postMessage(message, transferables ?? []);
|
|
2334
|
-
},
|
|
2335
|
-
listen(listener, { signal }) {
|
|
2336
|
-
const onMessage = (event) => {
|
|
2337
|
-
listener(event.data);
|
|
2338
|
-
};
|
|
2339
|
-
if (worker.addEventListener) worker.addEventListener("message", onMessage, { signal });
|
|
2340
|
-
else {
|
|
2341
|
-
worker.onmessage = onMessage;
|
|
2342
|
-
signal?.addEventListener("abort", () => {
|
|
2343
|
-
worker.onmessage = null;
|
|
2344
|
-
}, { once: true });
|
|
2345
|
-
}
|
|
2346
|
-
}
|
|
2347
|
-
};
|
|
2348
|
-
}
|
|
2349
|
-
function createDefaultWorker(workerEntryUrl, options) {
|
|
2350
|
-
if (typeof Worker === "undefined") throw new Error("Remote DOM Worker is not available in this environment");
|
|
2351
|
-
if (!shouldWrapWorkerEntryUrl(workerEntryUrl)) return new Worker(workerEntryUrl, options);
|
|
2352
|
-
return createBlobWrappedWorker(workerEntryUrl, options);
|
|
2353
|
-
}
|
|
2354
|
-
function shouldWrapWorkerEntryUrl(workerEntryUrl) {
|
|
2355
|
-
if (typeof location === "undefined" || typeof Blob === "undefined" || typeof URL.createObjectURL !== "function") return false;
|
|
2356
|
-
try {
|
|
2357
|
-
return new URL(workerEntryUrl, location.href).origin !== location.origin;
|
|
2358
|
-
} catch {
|
|
2359
|
-
return false;
|
|
2014
|
+
});
|
|
2015
|
+
Object.defineProperty(exports, "handleRemoteDomNavigationIntent", {
|
|
2016
|
+
enumerable: true,
|
|
2017
|
+
get: function() {
|
|
2018
|
+
return handleRemoteDomNavigationIntent;
|
|
2360
2019
|
}
|
|
2361
|
-
}
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
worker = new Worker(blobUrl, options);
|
|
2367
|
-
} catch (error) {
|
|
2368
|
-
URL.revokeObjectURL(blobUrl);
|
|
2369
|
-
throw error;
|
|
2020
|
+
});
|
|
2021
|
+
Object.defineProperty(exports, "hasCloserRemoteEventListener", {
|
|
2022
|
+
enumerable: true,
|
|
2023
|
+
get: function() {
|
|
2024
|
+
return hasCloserRemoteEventListener;
|
|
2370
2025
|
}
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
URL.revokeObjectURL(blobUrl);
|
|
2377
|
-
}
|
|
2378
|
-
};
|
|
2379
|
-
return worker;
|
|
2380
|
-
}
|
|
2381
|
-
function reportError(options, message, cause) {
|
|
2382
|
-
try {
|
|
2383
|
-
options.onError?.(new Error(message, cause === void 0 ? {} : { cause }));
|
|
2384
|
-
} catch {}
|
|
2385
|
-
}
|
|
2386
|
-
function collectCleanupErrors(cleanupSteps) {
|
|
2387
|
-
const errors = [];
|
|
2388
|
-
for (const cleanup of cleanupSteps) try {
|
|
2389
|
-
cleanup();
|
|
2390
|
-
} catch (error) {
|
|
2391
|
-
errors.push(error);
|
|
2026
|
+
});
|
|
2027
|
+
Object.defineProperty(exports, "normalizeNavigationOrigin", {
|
|
2028
|
+
enumerable: true,
|
|
2029
|
+
get: function() {
|
|
2030
|
+
return normalizeNavigationOrigin;
|
|
2392
2031
|
}
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
function reportCleanupErrors(options, message, errors) {
|
|
2396
|
-
if (errors.length === 0) return;
|
|
2397
|
-
reportError(options, message, errors.length === 1 ? errors[0] : new AggregateError(errors, "Multiple cleanup operations failed"));
|
|
2398
|
-
}
|
|
2399
|
-
function isPromiseLike(value) {
|
|
2400
|
-
return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
|
|
2401
|
-
}
|
|
2402
|
-
//#endregion
|
|
2403
|
-
Object.defineProperty(exports, "__toESM", {
|
|
2032
|
+
});
|
|
2033
|
+
Object.defineProperty(exports, "reportCleanupErrors", {
|
|
2404
2034
|
enumerable: true,
|
|
2405
2035
|
get: function() {
|
|
2406
|
-
return
|
|
2036
|
+
return reportCleanupErrors;
|
|
2407
2037
|
}
|
|
2408
2038
|
});
|
|
2409
|
-
Object.defineProperty(exports, "
|
|
2039
|
+
Object.defineProperty(exports, "reportHostError", {
|
|
2410
2040
|
enumerable: true,
|
|
2411
2041
|
get: function() {
|
|
2412
|
-
return
|
|
2042
|
+
return reportHostError;
|
|
2413
2043
|
}
|
|
2414
2044
|
});
|
|
2415
2045
|
|
|
2416
|
-
//# sourceMappingURL=remote-dom-
|
|
2046
|
+
//# sourceMappingURL=remote-dom-styles-RV40tYyt.cjs.map
|