@stencil/core 4.22.3 → 4.23.0
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/cli/index.cjs +1 -1
- package/cli/index.js +1 -1
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +1610 -30
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +2 -2
- package/internal/app-data/package.json +1 -1
- package/internal/client/index.js +1213 -1019
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +1213 -1019
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +41 -35
- package/internal/package.json +1 -1
- package/internal/stencil-private.d.ts +13 -0
- package/internal/stencil-public-docs.d.ts +8 -0
- package/internal/testing/index.js +1215 -1021
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +15 -9
- package/mock-doc/index.js +15 -9
- package/mock-doc/package.json +1 -1
- package/package.json +2 -2
- package/screenshot/index.js +1 -1
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/index.js +13 -13
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +11 -3
- package/testing/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Hydrate Platform v4.
|
|
2
|
+
Stencil Hydrate Platform v4.23.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -88,102 +88,20 @@ var unwrapErr = (result) => {
|
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
// src/runtime/connected-callback.ts
|
|
91
|
-
import { BUILD as
|
|
91
|
+
import { BUILD as BUILD16 } from "@stencil/core/internal/app-data";
|
|
92
92
|
|
|
93
93
|
// src/runtime/client-hydrate.ts
|
|
94
|
-
import { BUILD as
|
|
94
|
+
import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
|
|
95
95
|
|
|
96
|
-
// src/runtime/
|
|
97
|
-
import { BUILD } from "@stencil/core/internal/app-data";
|
|
98
|
-
var i = 0;
|
|
99
|
-
var createTime = (fnName, tagName = "") => {
|
|
100
|
-
if (BUILD.profile && performance.mark) {
|
|
101
|
-
const key = `st:${fnName}:${tagName}:${i++}`;
|
|
102
|
-
performance.mark(key);
|
|
103
|
-
return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
|
|
104
|
-
} else {
|
|
105
|
-
return () => {
|
|
106
|
-
return;
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
var uniqueTime = (key, measureText) => {
|
|
111
|
-
if (BUILD.profile && performance.mark) {
|
|
112
|
-
if (performance.getEntriesByName(key, "mark").length === 0) {
|
|
113
|
-
performance.mark(key);
|
|
114
|
-
}
|
|
115
|
-
return () => {
|
|
116
|
-
if (performance.getEntriesByName(measureText, "measure").length === 0) {
|
|
117
|
-
performance.measure(measureText, key);
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
} else {
|
|
121
|
-
return () => {
|
|
122
|
-
return;
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
var inspect = (ref) => {
|
|
127
|
-
const hostRef = getHostRef(ref);
|
|
128
|
-
if (!hostRef) {
|
|
129
|
-
return void 0;
|
|
130
|
-
}
|
|
131
|
-
const flags = hostRef.$flags$;
|
|
132
|
-
const hostElement = hostRef.$hostElement$;
|
|
133
|
-
return {
|
|
134
|
-
renderCount: hostRef.$renderCount$,
|
|
135
|
-
flags: {
|
|
136
|
-
hasRendered: !!(flags & 2 /* hasRendered */),
|
|
137
|
-
hasConnected: !!(flags & 1 /* hasConnected */),
|
|
138
|
-
isWaitingForChildren: !!(flags & 4 /* isWaitingForChildren */),
|
|
139
|
-
isConstructingInstance: !!(flags & 8 /* isConstructingInstance */),
|
|
140
|
-
isQueuedForUpdate: !!(flags & 16 /* isQueuedForUpdate */),
|
|
141
|
-
hasInitializedComponent: !!(flags & 32 /* hasInitializedComponent */),
|
|
142
|
-
hasLoadedComponent: !!(flags & 64 /* hasLoadedComponent */),
|
|
143
|
-
isWatchReady: !!(flags & 128 /* isWatchReady */),
|
|
144
|
-
isListenReady: !!(flags & 256 /* isListenReady */),
|
|
145
|
-
needsRerender: !!(flags & 512 /* needsRerender */)
|
|
146
|
-
},
|
|
147
|
-
instanceValues: hostRef.$instanceValues$,
|
|
148
|
-
ancestorComponent: hostRef.$ancestorComponent$,
|
|
149
|
-
hostElement,
|
|
150
|
-
lazyInstance: hostRef.$lazyInstance$,
|
|
151
|
-
vnode: hostRef.$vnode$,
|
|
152
|
-
modeName: hostRef.$modeName$,
|
|
153
|
-
onReadyPromise: hostRef.$onReadyPromise$,
|
|
154
|
-
onReadyResolve: hostRef.$onReadyResolve$,
|
|
155
|
-
onInstancePromise: hostRef.$onInstancePromise$,
|
|
156
|
-
onInstanceResolve: hostRef.$onInstanceResolve$,
|
|
157
|
-
onRenderResolve: hostRef.$onRenderResolve$,
|
|
158
|
-
queuedListeners: hostRef.$queuedListeners$,
|
|
159
|
-
rmListeners: hostRef.$rmListeners$,
|
|
160
|
-
["s-id"]: hostElement["s-id"],
|
|
161
|
-
["s-cr"]: hostElement["s-cr"],
|
|
162
|
-
["s-lr"]: hostElement["s-lr"],
|
|
163
|
-
["s-p"]: hostElement["s-p"],
|
|
164
|
-
["s-rc"]: hostElement["s-rc"],
|
|
165
|
-
["s-sc"]: hostElement["s-sc"]
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
var installDevTools = () => {
|
|
169
|
-
if (BUILD.devTools) {
|
|
170
|
-
const stencil = win.stencil = win.stencil || {};
|
|
171
|
-
const originalInspect = stencil.inspect;
|
|
172
|
-
stencil.inspect = (ref) => {
|
|
173
|
-
let result = inspect(ref);
|
|
174
|
-
if (!result && typeof originalInspect === "function") {
|
|
175
|
-
result = originalInspect(ref);
|
|
176
|
-
}
|
|
177
|
-
return result;
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
};
|
|
96
|
+
// src/runtime/dom-extras.ts
|
|
97
|
+
import { BUILD as BUILD5 } from "@stencil/core/internal/app-data";
|
|
181
98
|
|
|
182
99
|
// src/runtime/runtime-constants.ts
|
|
183
100
|
var CONTENT_REF_ID = "r";
|
|
184
101
|
var ORG_LOCATION_ID = "o";
|
|
185
102
|
var SLOT_NODE_ID = "s";
|
|
186
103
|
var TEXT_NODE_ID = "t";
|
|
104
|
+
var COMMENT_NODE_ID = "c";
|
|
187
105
|
var HYDRATE_ID = "s-id";
|
|
188
106
|
var HYDRATED_STYLE_ID = "sty-id";
|
|
189
107
|
var HYDRATE_CHILD_ID = "c-id";
|
|
@@ -203,8 +121,11 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
|
|
203
121
|
"formStateRestoreCallback"
|
|
204
122
|
];
|
|
205
123
|
|
|
124
|
+
// src/runtime/vdom/vdom-render.ts
|
|
125
|
+
import { BUILD as BUILD4 } from "@stencil/core/internal/app-data";
|
|
126
|
+
|
|
206
127
|
// src/runtime/vdom/h.ts
|
|
207
|
-
import { BUILD
|
|
128
|
+
import { BUILD } from "@stencil/core/internal/app-data";
|
|
208
129
|
var h = (nodeName, vnodeData, ...children) => {
|
|
209
130
|
let child = null;
|
|
210
131
|
let key = null;
|
|
@@ -220,7 +141,7 @@ var h = (nodeName, vnodeData, ...children) => {
|
|
|
220
141
|
} else if (child != null && typeof child !== "boolean") {
|
|
221
142
|
if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
|
|
222
143
|
child = String(child);
|
|
223
|
-
} else if (
|
|
144
|
+
} else if (BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
|
|
224
145
|
consoleDevError(`vNode passed as children has unexpected type.
|
|
225
146
|
Make sure it's using the correct h() function.
|
|
226
147
|
Empty objects can also be the cause, look for JSX comments that became objects.`);
|
|
@@ -236,28 +157,28 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
|
|
|
236
157
|
};
|
|
237
158
|
walk(children);
|
|
238
159
|
if (vnodeData) {
|
|
239
|
-
if (
|
|
160
|
+
if (BUILD.isDev && nodeName === "input") {
|
|
240
161
|
validateInputProperties(vnodeData);
|
|
241
162
|
}
|
|
242
|
-
if (
|
|
163
|
+
if (BUILD.vdomKey && vnodeData.key) {
|
|
243
164
|
key = vnodeData.key;
|
|
244
165
|
}
|
|
245
|
-
if (
|
|
166
|
+
if (BUILD.slotRelocation && vnodeData.name) {
|
|
246
167
|
slotName = vnodeData.name;
|
|
247
168
|
}
|
|
248
|
-
if (
|
|
169
|
+
if (BUILD.vdomClass) {
|
|
249
170
|
const classData = vnodeData.className || vnodeData.class;
|
|
250
171
|
if (classData) {
|
|
251
172
|
vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
|
|
252
173
|
}
|
|
253
174
|
}
|
|
254
175
|
}
|
|
255
|
-
if (
|
|
176
|
+
if (BUILD.isDev && vNodeChildren.some(isHost)) {
|
|
256
177
|
consoleDevError(`The <Host> must be the single root component. Make sure:
|
|
257
178
|
- You are NOT using hostData() and <Host> in the same component.
|
|
258
179
|
- <Host> is used once, and it's the single root component of the render() function.`);
|
|
259
180
|
}
|
|
260
|
-
if (
|
|
181
|
+
if (BUILD.vdomFunctional && typeof nodeName === "function") {
|
|
261
182
|
return nodeName(
|
|
262
183
|
vnodeData === null ? {} : vnodeData,
|
|
263
184
|
vNodeChildren,
|
|
@@ -269,10 +190,10 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
|
|
|
269
190
|
if (vNodeChildren.length > 0) {
|
|
270
191
|
vnode.$children$ = vNodeChildren;
|
|
271
192
|
}
|
|
272
|
-
if (
|
|
193
|
+
if (BUILD.vdomKey) {
|
|
273
194
|
vnode.$key$ = key;
|
|
274
195
|
}
|
|
275
|
-
if (
|
|
196
|
+
if (BUILD.slotRelocation) {
|
|
276
197
|
vnode.$name$ = slotName;
|
|
277
198
|
}
|
|
278
199
|
return vnode;
|
|
@@ -285,13 +206,13 @@ var newVNode = (tag, text) => {
|
|
|
285
206
|
$elm$: null,
|
|
286
207
|
$children$: null
|
|
287
208
|
};
|
|
288
|
-
if (
|
|
209
|
+
if (BUILD.vdomAttribute) {
|
|
289
210
|
vnode.$attrs$ = null;
|
|
290
211
|
}
|
|
291
|
-
if (
|
|
212
|
+
if (BUILD.vdomKey) {
|
|
292
213
|
vnode.$key$ = null;
|
|
293
214
|
}
|
|
294
|
-
if (
|
|
215
|
+
if (BUILD.slotRelocation) {
|
|
295
216
|
vnode.$name$ = null;
|
|
296
217
|
}
|
|
297
218
|
return vnode;
|
|
@@ -343,416 +264,51 @@ var validateInputProperties = (inputElm) => {
|
|
|
343
264
|
}
|
|
344
265
|
};
|
|
345
266
|
|
|
346
|
-
// src/runtime/
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
const orgLocationId = c.$hostId$ + "." + c.$nodeId$;
|
|
362
|
-
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
|
363
|
-
const node = c.$elm$;
|
|
364
|
-
if (orgLocationNode && supportsShadow && orgLocationNode["s-en"] === "") {
|
|
365
|
-
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
|
366
|
-
}
|
|
367
|
-
if (!shadowRoot) {
|
|
368
|
-
node["s-hn"] = tagName;
|
|
369
|
-
if (orgLocationNode) {
|
|
370
|
-
node["s-ol"] = orgLocationNode;
|
|
371
|
-
node["s-ol"]["s-nr"] = node;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
plt.$orgLocNodes$.delete(orgLocationId);
|
|
375
|
-
});
|
|
376
|
-
if (BUILD3.shadowDom && shadowRoot) {
|
|
377
|
-
shadowRootNodes.map((shadowRootNode) => {
|
|
378
|
-
if (shadowRootNode) {
|
|
379
|
-
shadowRoot.appendChild(shadowRootNode);
|
|
380
|
-
}
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
endHydrate();
|
|
384
|
-
};
|
|
385
|
-
var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
|
|
386
|
-
let childNodeType;
|
|
387
|
-
let childIdSplt;
|
|
388
|
-
let childVNode;
|
|
389
|
-
let i2;
|
|
390
|
-
if (node.nodeType === 1 /* ElementNode */) {
|
|
391
|
-
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
|
392
|
-
if (childNodeType) {
|
|
393
|
-
childIdSplt = childNodeType.split(".");
|
|
394
|
-
if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
|
|
395
|
-
childVNode = {
|
|
396
|
-
$flags$: 0,
|
|
397
|
-
$hostId$: childIdSplt[0],
|
|
398
|
-
$nodeId$: childIdSplt[1],
|
|
399
|
-
$depth$: childIdSplt[2],
|
|
400
|
-
$index$: childIdSplt[3],
|
|
401
|
-
$tag$: node.tagName.toLowerCase(),
|
|
402
|
-
$elm$: node,
|
|
403
|
-
$attrs$: null,
|
|
404
|
-
$children$: null,
|
|
405
|
-
$key$: null,
|
|
406
|
-
$name$: null,
|
|
407
|
-
$text$: null
|
|
408
|
-
};
|
|
409
|
-
childRenderNodes.push(childVNode);
|
|
410
|
-
node.removeAttribute(HYDRATE_CHILD_ID);
|
|
411
|
-
if (!parentVNode.$children$) {
|
|
412
|
-
parentVNode.$children$ = [];
|
|
413
|
-
}
|
|
414
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
415
|
-
parentVNode = childVNode;
|
|
416
|
-
if (shadowRootNodes && childVNode.$depth$ === "0") {
|
|
417
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
if (node.shadowRoot) {
|
|
422
|
-
for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
|
|
423
|
-
clientHydrate(
|
|
424
|
-
parentVNode,
|
|
425
|
-
childRenderNodes,
|
|
426
|
-
slotNodes,
|
|
427
|
-
shadowRootNodes,
|
|
428
|
-
hostElm,
|
|
429
|
-
node.shadowRoot.childNodes[i2],
|
|
430
|
-
hostId
|
|
431
|
-
);
|
|
267
|
+
// src/runtime/vdom/update-element.ts
|
|
268
|
+
import { BUILD as BUILD3 } from "@stencil/core/internal/app-data";
|
|
269
|
+
|
|
270
|
+
// src/runtime/vdom/set-accessor.ts
|
|
271
|
+
import { BUILD as BUILD2 } from "@stencil/core/internal/app-data";
|
|
272
|
+
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
273
|
+
if (oldValue !== newValue) {
|
|
274
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
275
|
+
let ln = memberName.toLowerCase();
|
|
276
|
+
if (BUILD2.vdomClass && memberName === "class") {
|
|
277
|
+
const classList = elm.classList;
|
|
278
|
+
const oldClasses = parseClassList(oldValue);
|
|
279
|
+
const newClasses = parseClassList(newValue);
|
|
280
|
+
if (elm["s-si"] && newClasses.indexOf(elm["s-si"]) < 0) {
|
|
281
|
+
newClasses.push(elm["s-si"]);
|
|
432
282
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
}
|
|
445
|
-
} else if (node.nodeType === 8 /* CommentNode */) {
|
|
446
|
-
childIdSplt = node.nodeValue.split(".");
|
|
447
|
-
if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
|
|
448
|
-
childNodeType = childIdSplt[0];
|
|
449
|
-
childVNode = {
|
|
450
|
-
$flags$: 0,
|
|
451
|
-
$hostId$: childIdSplt[1],
|
|
452
|
-
$nodeId$: childIdSplt[2],
|
|
453
|
-
$depth$: childIdSplt[3],
|
|
454
|
-
$index$: childIdSplt[4],
|
|
455
|
-
$elm$: node,
|
|
456
|
-
$attrs$: null,
|
|
457
|
-
$children$: null,
|
|
458
|
-
$key$: null,
|
|
459
|
-
$name$: null,
|
|
460
|
-
$tag$: null,
|
|
461
|
-
$text$: null
|
|
462
|
-
};
|
|
463
|
-
if (childNodeType === TEXT_NODE_ID) {
|
|
464
|
-
childVNode.$elm$ = node.nextSibling;
|
|
465
|
-
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
|
|
466
|
-
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
467
|
-
childRenderNodes.push(childVNode);
|
|
468
|
-
node.remove();
|
|
469
|
-
if (!parentVNode.$children$) {
|
|
470
|
-
parentVNode.$children$ = [];
|
|
471
|
-
}
|
|
472
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
473
|
-
if (shadowRootNodes && childVNode.$depth$ === "0") {
|
|
474
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
283
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
284
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
285
|
+
} else if (BUILD2.vdomStyle && memberName === "style") {
|
|
286
|
+
if (BUILD2.updatable) {
|
|
287
|
+
for (const prop in oldValue) {
|
|
288
|
+
if (!newValue || newValue[prop] == null) {
|
|
289
|
+
if (!BUILD2.hydrateServerSide && prop.includes("-")) {
|
|
290
|
+
elm.style.removeProperty(prop);
|
|
291
|
+
} else {
|
|
292
|
+
elm.style[prop] = "";
|
|
293
|
+
}
|
|
475
294
|
}
|
|
476
295
|
}
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
if (
|
|
481
|
-
|
|
296
|
+
}
|
|
297
|
+
for (const prop in newValue) {
|
|
298
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
299
|
+
if (!BUILD2.hydrateServerSide && prop.includes("-")) {
|
|
300
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
482
301
|
} else {
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
node["s-sr"] = true;
|
|
486
|
-
if (BUILD3.shadowDom && shadowRootNodes) {
|
|
487
|
-
childVNode.$elm$ = doc.createElement(childVNode.$tag$);
|
|
488
|
-
if (childVNode.$name$) {
|
|
489
|
-
childVNode.$elm$.setAttribute("name", childVNode.$name$);
|
|
490
|
-
}
|
|
491
|
-
node.parentNode.insertBefore(childVNode.$elm$, node);
|
|
492
|
-
node.remove();
|
|
493
|
-
if (childVNode.$depth$ === "0") {
|
|
494
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
slotNodes.push(childVNode);
|
|
498
|
-
if (!parentVNode.$children$) {
|
|
499
|
-
parentVNode.$children$ = [];
|
|
500
|
-
}
|
|
501
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
502
|
-
} else if (childNodeType === CONTENT_REF_ID) {
|
|
503
|
-
if (BUILD3.shadowDom && shadowRootNodes) {
|
|
504
|
-
node.remove();
|
|
505
|
-
} else if (BUILD3.slotRelocation) {
|
|
506
|
-
hostElm["s-cr"] = node;
|
|
507
|
-
node["s-cn"] = true;
|
|
302
|
+
elm.style[prop] = newValue[prop];
|
|
508
303
|
}
|
|
509
304
|
}
|
|
510
305
|
}
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
vnode.$index$ = "0";
|
|
516
|
-
parentVNode.$children$ = [vnode];
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
var initializeDocumentHydrate = (node, orgLocNodes) => {
|
|
520
|
-
if (node.nodeType === 1 /* ElementNode */) {
|
|
521
|
-
let i2 = 0;
|
|
522
|
-
if (node.shadowRoot) {
|
|
523
|
-
for (; i2 < node.shadowRoot.childNodes.length; i2++) {
|
|
524
|
-
initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
|
|
306
|
+
} else if (BUILD2.vdomKey && memberName === "key") {
|
|
307
|
+
} else if (BUILD2.vdomRef && memberName === "ref") {
|
|
308
|
+
if (newValue) {
|
|
309
|
+
newValue(elm);
|
|
525
310
|
}
|
|
526
|
-
}
|
|
527
|
-
for (i2 = 0; i2 < node.childNodes.length; i2++) {
|
|
528
|
-
initializeDocumentHydrate(node.childNodes[i2], orgLocNodes);
|
|
529
|
-
}
|
|
530
|
-
} else if (node.nodeType === 8 /* CommentNode */) {
|
|
531
|
-
const childIdSplt = node.nodeValue.split(".");
|
|
532
|
-
if (childIdSplt[0] === ORG_LOCATION_ID) {
|
|
533
|
-
orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
|
|
534
|
-
node.nodeValue = "";
|
|
535
|
-
node["s-en"] = childIdSplt[3];
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
// src/runtime/initialize-component.ts
|
|
541
|
-
import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
|
|
542
|
-
|
|
543
|
-
// src/runtime/mode.ts
|
|
544
|
-
var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
|
|
545
|
-
var setMode = (handler) => modeResolutionChain.push(handler);
|
|
546
|
-
var getMode = (ref) => getHostRef(ref).$modeName$;
|
|
547
|
-
|
|
548
|
-
// src/runtime/proxy-component.ts
|
|
549
|
-
import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
|
|
550
|
-
|
|
551
|
-
// src/runtime/set-value.ts
|
|
552
|
-
import { BUILD as BUILD12 } from "@stencil/core/internal/app-data";
|
|
553
|
-
|
|
554
|
-
// src/runtime/parse-property-value.ts
|
|
555
|
-
import { BUILD as BUILD4 } from "@stencil/core/internal/app-data";
|
|
556
|
-
var parsePropertyValue = (propValue, propType) => {
|
|
557
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
558
|
-
if (BUILD4.propBoolean && propType & 4 /* Boolean */) {
|
|
559
|
-
return propValue === "false" ? false : propValue === "" || !!propValue;
|
|
560
|
-
}
|
|
561
|
-
if (BUILD4.propNumber && propType & 2 /* Number */) {
|
|
562
|
-
return parseFloat(propValue);
|
|
563
|
-
}
|
|
564
|
-
if (BUILD4.propString && propType & 1 /* String */) {
|
|
565
|
-
return String(propValue);
|
|
566
|
-
}
|
|
567
|
-
return propValue;
|
|
568
|
-
}
|
|
569
|
-
return propValue;
|
|
570
|
-
};
|
|
571
|
-
|
|
572
|
-
// src/runtime/update-component.ts
|
|
573
|
-
import { BUILD as BUILD11, NAMESPACE } from "@stencil/core/internal/app-data";
|
|
574
|
-
|
|
575
|
-
// src/runtime/event-emitter.ts
|
|
576
|
-
import { BUILD as BUILD6 } from "@stencil/core/internal/app-data";
|
|
577
|
-
|
|
578
|
-
// src/runtime/element.ts
|
|
579
|
-
import { BUILD as BUILD5 } from "@stencil/core/internal/app-data";
|
|
580
|
-
var getElement = (ref) => BUILD5.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
|
|
581
|
-
|
|
582
|
-
// src/runtime/event-emitter.ts
|
|
583
|
-
var createEvent = (ref, name, flags) => {
|
|
584
|
-
const elm = getElement(ref);
|
|
585
|
-
return {
|
|
586
|
-
emit: (detail) => {
|
|
587
|
-
if (BUILD6.isDev && !elm.isConnected) {
|
|
588
|
-
consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
|
|
589
|
-
}
|
|
590
|
-
return emitEvent(elm, name, {
|
|
591
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
|
592
|
-
composed: !!(flags & 2 /* Composed */),
|
|
593
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
|
594
|
-
detail
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
};
|
|
598
|
-
};
|
|
599
|
-
var emitEvent = (elm, name, opts) => {
|
|
600
|
-
const ev = plt.ce(name, opts);
|
|
601
|
-
elm.dispatchEvent(ev);
|
|
602
|
-
return ev;
|
|
603
|
-
};
|
|
604
|
-
|
|
605
|
-
// src/runtime/styles.ts
|
|
606
|
-
import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
|
|
607
|
-
var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
|
|
608
|
-
var registerStyle = (scopeId2, cssText, allowCS) => {
|
|
609
|
-
let style = styles.get(scopeId2);
|
|
610
|
-
if (supportsConstructableStylesheets && allowCS) {
|
|
611
|
-
style = style || new CSSStyleSheet();
|
|
612
|
-
if (typeof style === "string") {
|
|
613
|
-
style = cssText;
|
|
614
|
-
} else {
|
|
615
|
-
style.replaceSync(cssText);
|
|
616
|
-
}
|
|
617
|
-
} else {
|
|
618
|
-
style = cssText;
|
|
619
|
-
}
|
|
620
|
-
styles.set(scopeId2, style);
|
|
621
|
-
};
|
|
622
|
-
var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
623
|
-
var _a;
|
|
624
|
-
const scopeId2 = getScopeId(cmpMeta, mode);
|
|
625
|
-
const style = styles.get(scopeId2);
|
|
626
|
-
if (!BUILD7.attachStyles) {
|
|
627
|
-
return scopeId2;
|
|
628
|
-
}
|
|
629
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
630
|
-
if (style) {
|
|
631
|
-
if (typeof style === "string") {
|
|
632
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
633
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
634
|
-
let styleElm;
|
|
635
|
-
if (!appliedStyles) {
|
|
636
|
-
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
|
637
|
-
}
|
|
638
|
-
if (!appliedStyles.has(scopeId2)) {
|
|
639
|
-
if (BUILD7.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
|
|
640
|
-
styleElm.innerHTML = style;
|
|
641
|
-
} else {
|
|
642
|
-
styleElm = doc.createElement("style");
|
|
643
|
-
styleElm.innerHTML = style;
|
|
644
|
-
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
|
|
645
|
-
if (nonce != null) {
|
|
646
|
-
styleElm.setAttribute("nonce", nonce);
|
|
647
|
-
}
|
|
648
|
-
if ((BUILD7.hydrateServerSide || BUILD7.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
649
|
-
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
|
|
650
|
-
}
|
|
651
|
-
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
652
|
-
if (styleContainerNode.nodeName === "HEAD") {
|
|
653
|
-
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
|
654
|
-
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
|
655
|
-
styleContainerNode.insertBefore(styleElm, referenceNode2);
|
|
656
|
-
} else if ("host" in styleContainerNode) {
|
|
657
|
-
if (supportsConstructableStylesheets) {
|
|
658
|
-
const stylesheet = new CSSStyleSheet();
|
|
659
|
-
stylesheet.replaceSync(style);
|
|
660
|
-
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
|
661
|
-
} else {
|
|
662
|
-
const existingStyleContainer = styleContainerNode.querySelector("style");
|
|
663
|
-
if (existingStyleContainer) {
|
|
664
|
-
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
|
665
|
-
} else {
|
|
666
|
-
styleContainerNode.prepend(styleElm);
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
} else {
|
|
670
|
-
styleContainerNode.append(styleElm);
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
|
|
674
|
-
styleContainerNode.insertBefore(styleElm, null);
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
|
678
|
-
styleElm.innerHTML += SLOT_FB_CSS;
|
|
679
|
-
}
|
|
680
|
-
if (appliedStyles) {
|
|
681
|
-
appliedStyles.add(scopeId2);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
} else if (BUILD7.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
685
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
return scopeId2;
|
|
689
|
-
};
|
|
690
|
-
var attachStyles = (hostRef) => {
|
|
691
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
692
|
-
const elm = hostRef.$hostElement$;
|
|
693
|
-
const flags = cmpMeta.$flags$;
|
|
694
|
-
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
|
695
|
-
const scopeId2 = addStyle(
|
|
696
|
-
BUILD7.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
|
|
697
|
-
cmpMeta,
|
|
698
|
-
hostRef.$modeName$
|
|
699
|
-
);
|
|
700
|
-
if ((BUILD7.shadowDom || BUILD7.scoped) && BUILD7.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
|
|
701
|
-
elm["s-sc"] = scopeId2;
|
|
702
|
-
elm.classList.add(scopeId2 + "-h");
|
|
703
|
-
if (BUILD7.scoped && flags & 2 /* scopedCssEncapsulation */) {
|
|
704
|
-
elm.classList.add(scopeId2 + "-s");
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
endAttachStyles();
|
|
708
|
-
};
|
|
709
|
-
var getScopeId = (cmp, mode) => "sc-" + (BUILD7.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
|
|
710
|
-
|
|
711
|
-
// src/runtime/vdom/vdom-render.ts
|
|
712
|
-
import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
|
|
713
|
-
|
|
714
|
-
// src/runtime/vdom/update-element.ts
|
|
715
|
-
import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
|
|
716
|
-
|
|
717
|
-
// src/runtime/vdom/set-accessor.ts
|
|
718
|
-
import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
|
|
719
|
-
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
720
|
-
if (oldValue !== newValue) {
|
|
721
|
-
let isProp = isMemberInElement(elm, memberName);
|
|
722
|
-
let ln = memberName.toLowerCase();
|
|
723
|
-
if (BUILD8.vdomClass && memberName === "class") {
|
|
724
|
-
const classList = elm.classList;
|
|
725
|
-
const oldClasses = parseClassList(oldValue);
|
|
726
|
-
const newClasses = parseClassList(newValue);
|
|
727
|
-
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
728
|
-
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
729
|
-
} else if (BUILD8.vdomStyle && memberName === "style") {
|
|
730
|
-
if (BUILD8.updatable) {
|
|
731
|
-
for (const prop in oldValue) {
|
|
732
|
-
if (!newValue || newValue[prop] == null) {
|
|
733
|
-
if (!BUILD8.hydrateServerSide && prop.includes("-")) {
|
|
734
|
-
elm.style.removeProperty(prop);
|
|
735
|
-
} else {
|
|
736
|
-
elm.style[prop] = "";
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
for (const prop in newValue) {
|
|
742
|
-
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
743
|
-
if (!BUILD8.hydrateServerSide && prop.includes("-")) {
|
|
744
|
-
elm.style.setProperty(prop, newValue[prop]);
|
|
745
|
-
} else {
|
|
746
|
-
elm.style[prop] = newValue[prop];
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
} else if (BUILD8.vdomKey && memberName === "key") {
|
|
751
|
-
} else if (BUILD8.vdomRef && memberName === "ref") {
|
|
752
|
-
if (newValue) {
|
|
753
|
-
newValue(elm);
|
|
754
|
-
}
|
|
755
|
-
} else if (BUILD8.vdomListener && (BUILD8.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
|
|
311
|
+
} else if (BUILD2.vdomListener && (BUILD2.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
|
|
756
312
|
if (memberName[2] === "-") {
|
|
757
313
|
memberName = memberName.slice(3);
|
|
758
314
|
} else if (isMemberInElement(win, ln)) {
|
|
@@ -770,7 +326,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
770
326
|
plt.ael(elm, memberName, newValue, capture);
|
|
771
327
|
}
|
|
772
328
|
}
|
|
773
|
-
} else if (
|
|
329
|
+
} else if (BUILD2.vdomPropOrAttr) {
|
|
774
330
|
const isComplex = isComplexType(newValue);
|
|
775
331
|
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
776
332
|
try {
|
|
@@ -792,7 +348,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
792
348
|
}
|
|
793
349
|
}
|
|
794
350
|
let xlink = false;
|
|
795
|
-
if (
|
|
351
|
+
if (BUILD2.vdomXlink) {
|
|
796
352
|
if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
|
|
797
353
|
memberName = ln;
|
|
798
354
|
xlink = true;
|
|
@@ -800,7 +356,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
800
356
|
}
|
|
801
357
|
if (newValue == null || newValue === false) {
|
|
802
358
|
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
|
803
|
-
if (
|
|
359
|
+
if (BUILD2.vdomXlink && xlink) {
|
|
804
360
|
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
805
361
|
} else {
|
|
806
362
|
elm.removeAttribute(memberName);
|
|
@@ -808,7 +364,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
808
364
|
}
|
|
809
365
|
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
810
366
|
newValue = newValue === true ? "" : newValue;
|
|
811
|
-
if (
|
|
367
|
+
if (BUILD2.vdomXlink && xlink) {
|
|
812
368
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
813
369
|
} else {
|
|
814
370
|
elm.setAttribute(memberName, newValue);
|
|
@@ -827,7 +383,7 @@ var updateElement = (oldVnode, newVnode, isSvgMode2) => {
|
|
|
827
383
|
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
|
|
828
384
|
const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ;
|
|
829
385
|
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
830
|
-
if (
|
|
386
|
+
if (BUILD3.updatable) {
|
|
831
387
|
for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
|
|
832
388
|
if (!(memberName in newVnodeAttrs)) {
|
|
833
389
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
|
|
@@ -863,7 +419,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
863
419
|
let elm;
|
|
864
420
|
let childNode;
|
|
865
421
|
let oldVNode;
|
|
866
|
-
if (
|
|
422
|
+
if (BUILD4.slotRelocation && !useNativeShadowDom) {
|
|
867
423
|
checkSlotRelocate = true;
|
|
868
424
|
if (newVNode2.$tag$ === "slot") {
|
|
869
425
|
if (scopeId) {
|
|
@@ -881,37 +437,37 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
881
437
|
);
|
|
882
438
|
}
|
|
883
439
|
}
|
|
884
|
-
if (
|
|
440
|
+
if (BUILD4.isDev && newVNode2.$elm$) {
|
|
885
441
|
consoleDevError(
|
|
886
442
|
`The JSX ${newVNode2.$text$ !== null ? `"${newVNode2.$text$}" text` : `"${newVNode2.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`
|
|
887
443
|
);
|
|
888
444
|
}
|
|
889
|
-
if (
|
|
445
|
+
if (BUILD4.vdomText && newVNode2.$text$ !== null) {
|
|
890
446
|
elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
|
|
891
|
-
} else if (
|
|
892
|
-
elm = newVNode2.$elm$ =
|
|
447
|
+
} else if (BUILD4.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
|
|
448
|
+
elm = newVNode2.$elm$ = BUILD4.isDebug || BUILD4.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
|
|
893
449
|
} else {
|
|
894
|
-
if (
|
|
450
|
+
if (BUILD4.svg && !isSvgMode) {
|
|
895
451
|
isSvgMode = newVNode2.$tag$ === "svg";
|
|
896
452
|
}
|
|
897
|
-
elm = newVNode2.$elm$ =
|
|
453
|
+
elm = newVNode2.$elm$ = BUILD4.svg ? doc.createElementNS(
|
|
898
454
|
isSvgMode ? SVG_NS : HTML_NS,
|
|
899
|
-
!useNativeShadowDom &&
|
|
455
|
+
!useNativeShadowDom && BUILD4.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
900
456
|
) : doc.createElement(
|
|
901
|
-
!useNativeShadowDom &&
|
|
457
|
+
!useNativeShadowDom && BUILD4.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
902
458
|
);
|
|
903
|
-
if (
|
|
459
|
+
if (BUILD4.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
|
|
904
460
|
isSvgMode = false;
|
|
905
461
|
}
|
|
906
|
-
if (
|
|
462
|
+
if (BUILD4.vdomAttribute) {
|
|
907
463
|
updateElement(null, newVNode2, isSvgMode);
|
|
908
464
|
}
|
|
909
465
|
const rootNode = elm.getRootNode();
|
|
910
466
|
const isElementWithinShadowRoot = !rootNode.querySelector("body");
|
|
911
|
-
if (!isElementWithinShadowRoot &&
|
|
467
|
+
if (!isElementWithinShadowRoot && BUILD4.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
|
|
912
468
|
elm.classList.add(elm["s-si"] = scopeId);
|
|
913
469
|
}
|
|
914
|
-
if (
|
|
470
|
+
if (BUILD4.scoped) {
|
|
915
471
|
updateElementScopeIds(elm, parentElm);
|
|
916
472
|
}
|
|
917
473
|
if (newVNode2.$children$) {
|
|
@@ -922,7 +478,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
922
478
|
}
|
|
923
479
|
}
|
|
924
480
|
}
|
|
925
|
-
if (
|
|
481
|
+
if (BUILD4.svg) {
|
|
926
482
|
if (newVNode2.$tag$ === "svg") {
|
|
927
483
|
isSvgMode = false;
|
|
928
484
|
} else if (elm.tagName === "foreignObject") {
|
|
@@ -931,7 +487,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
931
487
|
}
|
|
932
488
|
}
|
|
933
489
|
elm["s-hn"] = hostTagName;
|
|
934
|
-
if (
|
|
490
|
+
if (BUILD4.slotRelocation) {
|
|
935
491
|
if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
936
492
|
elm["s-sr"] = true;
|
|
937
493
|
elm["s-cr"] = contentRef;
|
|
@@ -939,7 +495,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
939
495
|
elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
|
|
940
496
|
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
941
497
|
if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
|
|
942
|
-
if (
|
|
498
|
+
if (BUILD4.experimentalSlotFixes) {
|
|
943
499
|
relocateToHostRoot(oldParentVNode.$elm$);
|
|
944
500
|
} else {
|
|
945
501
|
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
@@ -953,8 +509,12 @@ var relocateToHostRoot = (parentElm) => {
|
|
|
953
509
|
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
954
510
|
const host = parentElm.closest(hostTagName.toLowerCase());
|
|
955
511
|
if (host != null) {
|
|
956
|
-
const contentRefNode = Array.from(host.childNodes).find(
|
|
957
|
-
|
|
512
|
+
const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
|
|
513
|
+
(ref) => ref["s-cr"]
|
|
514
|
+
);
|
|
515
|
+
const childNodeArray = Array.from(
|
|
516
|
+
parentElm.__childNodes || parentElm.childNodes
|
|
517
|
+
);
|
|
958
518
|
for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
|
|
959
519
|
if (childNode["s-sh"] != null) {
|
|
960
520
|
insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
|
|
@@ -967,8 +527,8 @@ var relocateToHostRoot = (parentElm) => {
|
|
|
967
527
|
};
|
|
968
528
|
var putBackInOriginalLocation = (parentElm, recursive) => {
|
|
969
529
|
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
970
|
-
const oldSlotChildNodes = Array.from(parentElm.childNodes);
|
|
971
|
-
if (parentElm["s-sr"] &&
|
|
530
|
+
const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
|
|
531
|
+
if (parentElm["s-sr"] && BUILD4.experimentalSlotFixes) {
|
|
972
532
|
let node = parentElm;
|
|
973
533
|
while (node = node.nextSibling) {
|
|
974
534
|
if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
|
|
@@ -992,9 +552,9 @@ var putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
992
552
|
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
993
553
|
};
|
|
994
554
|
var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
995
|
-
let containerElm =
|
|
555
|
+
let containerElm = BUILD4.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
|
|
996
556
|
let childNode;
|
|
997
|
-
if (
|
|
557
|
+
if (BUILD4.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
998
558
|
containerElm = containerElm.shadowRoot;
|
|
999
559
|
}
|
|
1000
560
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
@@ -1002,7 +562,7 @@ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
|
1002
562
|
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
|
1003
563
|
if (childNode) {
|
|
1004
564
|
vnodes[startIdx].$elm$ = childNode;
|
|
1005
|
-
insertBefore(containerElm, childNode,
|
|
565
|
+
insertBefore(containerElm, childNode, BUILD4.slotRelocation ? referenceNode(before) : before);
|
|
1006
566
|
}
|
|
1007
567
|
}
|
|
1008
568
|
}
|
|
@@ -1014,7 +574,7 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
|
1014
574
|
const elm = vnode.$elm$;
|
|
1015
575
|
nullifyVNodeRefs(vnode);
|
|
1016
576
|
if (elm) {
|
|
1017
|
-
if (
|
|
577
|
+
if (BUILD4.slotRelocation) {
|
|
1018
578
|
checkSlotFallbackVisibility = true;
|
|
1019
579
|
if (elm["s-ol"]) {
|
|
1020
580
|
elm["s-ol"].remove();
|
|
@@ -1058,7 +618,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
1058
618
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
1059
619
|
newEndVnode = newCh[--newEndIdx];
|
|
1060
620
|
} else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
|
|
1061
|
-
if (
|
|
621
|
+
if (BUILD4.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
|
|
1062
622
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
1063
623
|
}
|
|
1064
624
|
patch(oldStartVnode, newEndVnode, isInitialRender);
|
|
@@ -1066,7 +626,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
1066
626
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
1067
627
|
newEndVnode = newCh[--newEndIdx];
|
|
1068
628
|
} else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
|
|
1069
|
-
if (
|
|
629
|
+
if (BUILD4.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
|
|
1070
630
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
1071
631
|
}
|
|
1072
632
|
patch(oldEndVnode, newStartVnode, isInitialRender);
|
|
@@ -1075,7 +635,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
1075
635
|
newStartVnode = newCh[++newStartIdx];
|
|
1076
636
|
} else {
|
|
1077
637
|
idxInOld = -1;
|
|
1078
|
-
if (
|
|
638
|
+
if (BUILD4.vdomKey) {
|
|
1079
639
|
for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
|
|
1080
640
|
if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
|
|
1081
641
|
idxInOld = i2;
|
|
@@ -1083,7 +643,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
1083
643
|
}
|
|
1084
644
|
}
|
|
1085
645
|
}
|
|
1086
|
-
if (
|
|
646
|
+
if (BUILD4.vdomKey && idxInOld >= 0) {
|
|
1087
647
|
elmToMove = oldCh[idxInOld];
|
|
1088
648
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
1089
649
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld, parentElm);
|
|
@@ -1098,7 +658,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
1098
658
|
newStartVnode = newCh[++newStartIdx];
|
|
1099
659
|
}
|
|
1100
660
|
if (node) {
|
|
1101
|
-
if (
|
|
661
|
+
if (BUILD4.slotRelocation) {
|
|
1102
662
|
insertBefore(parentReferenceNode(oldStartVnode.$elm$), node, referenceNode(oldStartVnode.$elm$));
|
|
1103
663
|
} else {
|
|
1104
664
|
insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
|
|
@@ -1115,13 +675,13 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
1115
675
|
newStartIdx,
|
|
1116
676
|
newEndIdx
|
|
1117
677
|
);
|
|
1118
|
-
} else if (
|
|
678
|
+
} else if (BUILD4.updatable && newStartIdx > newEndIdx) {
|
|
1119
679
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
1120
680
|
}
|
|
1121
681
|
};
|
|
1122
682
|
var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
|
|
1123
683
|
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
1124
|
-
if (
|
|
684
|
+
if (BUILD4.slotRelocation && leftVNode.$tag$ === "slot") {
|
|
1125
685
|
if (
|
|
1126
686
|
// The component gets hydrated and no VDOM has been initialized.
|
|
1127
687
|
// Here the comparison can't happen as $name$ property is not set for `leftNode`.
|
|
@@ -1133,7 +693,7 @@ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
|
|
|
1133
693
|
}
|
|
1134
694
|
return leftVNode.$name$ === rightVNode.$name$;
|
|
1135
695
|
}
|
|
1136
|
-
if (
|
|
696
|
+
if (BUILD4.vdomKey && !isInitialRender) {
|
|
1137
697
|
return leftVNode.$key$ === rightVNode.$key$;
|
|
1138
698
|
}
|
|
1139
699
|
return true;
|
|
@@ -1151,13 +711,13 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
1151
711
|
const tag = newVNode2.$tag$;
|
|
1152
712
|
const text = newVNode2.$text$;
|
|
1153
713
|
let defaultHolder;
|
|
1154
|
-
if (!
|
|
1155
|
-
if (
|
|
714
|
+
if (!BUILD4.vdomText || text === null) {
|
|
715
|
+
if (BUILD4.svg) {
|
|
1156
716
|
isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
|
|
1157
717
|
}
|
|
1158
|
-
if (
|
|
1159
|
-
if (
|
|
1160
|
-
if (
|
|
718
|
+
if (BUILD4.vdomAttribute || BUILD4.reflect) {
|
|
719
|
+
if (BUILD4.slot && tag === "slot" && !useNativeShadowDom) {
|
|
720
|
+
if (BUILD4.experimentalSlotFixes && oldVNode.$name$ !== newVNode2.$name$) {
|
|
1161
721
|
newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
|
|
1162
722
|
relocateToHostRoot(newVNode2.$elm$.parentElement);
|
|
1163
723
|
}
|
|
@@ -1165,30 +725,30 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
1165
725
|
updateElement(oldVNode, newVNode2, isSvgMode);
|
|
1166
726
|
}
|
|
1167
727
|
}
|
|
1168
|
-
if (
|
|
728
|
+
if (BUILD4.updatable && oldChildren !== null && newChildren !== null) {
|
|
1169
729
|
updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
|
|
1170
730
|
} else if (newChildren !== null) {
|
|
1171
|
-
if (
|
|
731
|
+
if (BUILD4.updatable && BUILD4.vdomText && oldVNode.$text$ !== null) {
|
|
1172
732
|
elm.textContent = "";
|
|
1173
733
|
}
|
|
1174
734
|
addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
|
|
1175
735
|
} else if (
|
|
1176
736
|
// don't do this on initial render as it can cause non-hydrated content to be removed
|
|
1177
|
-
!isInitialRender &&
|
|
737
|
+
!isInitialRender && BUILD4.updatable && oldChildren !== null
|
|
1178
738
|
) {
|
|
1179
739
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
1180
740
|
}
|
|
1181
|
-
if (
|
|
741
|
+
if (BUILD4.svg && isSvgMode && tag === "svg") {
|
|
1182
742
|
isSvgMode = false;
|
|
1183
743
|
}
|
|
1184
|
-
} else if (
|
|
744
|
+
} else if (BUILD4.vdomText && BUILD4.slotRelocation && (defaultHolder = elm["s-cr"])) {
|
|
1185
745
|
defaultHolder.parentNode.textContent = text;
|
|
1186
|
-
} else if (
|
|
746
|
+
} else if (BUILD4.vdomText && oldVNode.$text$ !== text) {
|
|
1187
747
|
elm.data = text;
|
|
1188
748
|
}
|
|
1189
749
|
};
|
|
1190
750
|
var updateFallbackSlotVisibility = (elm) => {
|
|
1191
|
-
const childNodes = elm.childNodes;
|
|
751
|
+
const childNodes = elm.__childNodes || elm.childNodes;
|
|
1192
752
|
for (const childNode of childNodes) {
|
|
1193
753
|
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
1194
754
|
if (childNode["s-sr"]) {
|
|
@@ -1201,7 +761,7 @@ var updateFallbackSlotVisibility = (elm) => {
|
|
|
1201
761
|
childNode.hidden = true;
|
|
1202
762
|
break;
|
|
1203
763
|
}
|
|
1204
|
-
} else {
|
|
764
|
+
} else if (slotName === siblingNode["s-sn"]) {
|
|
1205
765
|
if (siblingNode.nodeType === 1 /* ElementNode */ || siblingNode.nodeType === 3 /* TextNode */ && siblingNode.textContent.trim() !== "") {
|
|
1206
766
|
childNode.hidden = true;
|
|
1207
767
|
break;
|
|
@@ -1219,13 +779,14 @@ var markSlotContentForRelocation = (elm) => {
|
|
|
1219
779
|
let node;
|
|
1220
780
|
let hostContentNodes;
|
|
1221
781
|
let j;
|
|
1222
|
-
|
|
782
|
+
const children = elm.__childNodes || elm.childNodes;
|
|
783
|
+
for (const childNode of children) {
|
|
1223
784
|
if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
|
|
1224
|
-
hostContentNodes = node.parentNode.childNodes;
|
|
785
|
+
hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
|
|
1225
786
|
const slotName = childNode["s-sn"];
|
|
1226
787
|
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
1227
788
|
node = hostContentNodes[j];
|
|
1228
|
-
if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!
|
|
789
|
+
if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD4.experimentalSlotFixes || !node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
|
|
1229
790
|
if (isNodeLocatedInSlot(node, slotName)) {
|
|
1230
791
|
let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1231
792
|
checkSlotFallbackVisibility = true;
|
|
@@ -1279,14 +840,14 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
|
|
|
1279
840
|
return slotName === "";
|
|
1280
841
|
};
|
|
1281
842
|
var nullifyVNodeRefs = (vNode) => {
|
|
1282
|
-
if (
|
|
843
|
+
if (BUILD4.vdomRef) {
|
|
1283
844
|
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
1284
845
|
vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
|
|
1285
846
|
}
|
|
1286
847
|
};
|
|
1287
848
|
var insertBefore = (parent, newNode, reference) => {
|
|
1288
849
|
const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
|
|
1289
|
-
if (
|
|
850
|
+
if (BUILD4.scoped) {
|
|
1290
851
|
updateElementScopeIds(newNode, parent);
|
|
1291
852
|
}
|
|
1292
853
|
return inserted;
|
|
@@ -1310,7 +871,7 @@ var updateElementScopeIds = (element, parent, iterateChildNodes = false) => {
|
|
|
1310
871
|
if (scopeIds.size) {
|
|
1311
872
|
(_a = element.classList) == null ? void 0 : _a.add(...element["s-scs"] = Array.from(scopeIds));
|
|
1312
873
|
if (element["s-ol"] || iterateChildNodes) {
|
|
1313
|
-
for (const childNode of Array.from(element.childNodes)) {
|
|
874
|
+
for (const childNode of Array.from(element.__childNodes || element.childNodes)) {
|
|
1314
875
|
updateElementScopeIds(childNode, element, true);
|
|
1315
876
|
}
|
|
1316
877
|
}
|
|
@@ -1324,7 +885,7 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
1324
885
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
1325
886
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
1326
887
|
hostTagName = hostElm.tagName;
|
|
1327
|
-
if (
|
|
888
|
+
if (BUILD4.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
|
|
1328
889
|
throw new Error(`The <Host> must be the single root component.
|
|
1329
890
|
Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
|
|
1330
891
|
|
|
@@ -1338,7 +899,7 @@ render() {
|
|
|
1338
899
|
}
|
|
1339
900
|
`);
|
|
1340
901
|
}
|
|
1341
|
-
if (
|
|
902
|
+
if (BUILD4.reflect && cmpMeta.$attrsToReflect$) {
|
|
1342
903
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
1343
904
|
cmpMeta.$attrsToReflect$.map(
|
|
1344
905
|
([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]
|
|
@@ -1354,24 +915,24 @@ render() {
|
|
|
1354
915
|
rootVnode.$tag$ = null;
|
|
1355
916
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
1356
917
|
hostRef.$vnode$ = rootVnode;
|
|
1357
|
-
rootVnode.$elm$ = oldVNode.$elm$ =
|
|
1358
|
-
if (
|
|
918
|
+
rootVnode.$elm$ = oldVNode.$elm$ = BUILD4.shadowDom ? hostElm.shadowRoot || hostElm : hostElm;
|
|
919
|
+
if (BUILD4.scoped || BUILD4.shadowDom) {
|
|
1359
920
|
scopeId = hostElm["s-sc"];
|
|
1360
921
|
}
|
|
1361
922
|
useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
1362
|
-
if (
|
|
923
|
+
if (BUILD4.slotRelocation) {
|
|
1363
924
|
contentRef = hostElm["s-cr"];
|
|
1364
925
|
checkSlotFallbackVisibility = false;
|
|
1365
926
|
}
|
|
1366
927
|
patch(oldVNode, rootVnode, isInitialLoad);
|
|
1367
|
-
if (
|
|
928
|
+
if (BUILD4.slotRelocation) {
|
|
1368
929
|
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
1369
930
|
if (checkSlotRelocate) {
|
|
1370
931
|
markSlotContentForRelocation(rootVnode.$elm$);
|
|
1371
932
|
for (const relocateData of relocateNodes) {
|
|
1372
933
|
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1373
934
|
if (!nodeToRelocate["s-ol"]) {
|
|
1374
|
-
const orgLocationNode =
|
|
935
|
+
const orgLocationNode = BUILD4.isDebug || BUILD4.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
|
|
1375
936
|
orgLocationNode["s-nr"] = nodeToRelocate;
|
|
1376
937
|
insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
|
|
1377
938
|
}
|
|
@@ -1382,7 +943,7 @@ render() {
|
|
|
1382
943
|
if (slotRefNode) {
|
|
1383
944
|
const parentNodeRef = slotRefNode.parentNode;
|
|
1384
945
|
let insertBeforeNode = slotRefNode.nextSibling;
|
|
1385
|
-
if (!
|
|
946
|
+
if (!BUILD4.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */) {
|
|
1386
947
|
let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
|
|
1387
948
|
while (orgLocationNode) {
|
|
1388
949
|
let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
|
|
@@ -1401,7 +962,7 @@ render() {
|
|
|
1401
962
|
}
|
|
1402
963
|
if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
1403
964
|
if (nodeToRelocate !== insertBeforeNode) {
|
|
1404
|
-
if (!
|
|
965
|
+
if (!BUILD4.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
|
|
1405
966
|
nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
|
|
1406
967
|
}
|
|
1407
968
|
insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
|
|
@@ -1427,8 +988,9 @@ render() {
|
|
|
1427
988
|
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
1428
989
|
relocateNodes.length = 0;
|
|
1429
990
|
}
|
|
1430
|
-
if (
|
|
1431
|
-
|
|
991
|
+
if (BUILD4.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
992
|
+
const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
|
|
993
|
+
for (const childNode of children) {
|
|
1432
994
|
if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
|
|
1433
995
|
if (isInitialLoad && childNode["s-ih"] == null) {
|
|
1434
996
|
childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
|
|
@@ -1437,37 +999,926 @@ render() {
|
|
|
1437
999
|
}
|
|
1438
1000
|
}
|
|
1439
1001
|
}
|
|
1440
|
-
contentRef = void 0;
|
|
1002
|
+
contentRef = void 0;
|
|
1003
|
+
};
|
|
1004
|
+
var slotReferenceDebugNode = (slotVNode) => doc.createComment(
|
|
1005
|
+
`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
|
|
1006
|
+
);
|
|
1007
|
+
var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(
|
|
1008
|
+
`org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
|
|
1009
|
+
);
|
|
1010
|
+
|
|
1011
|
+
// src/runtime/dom-extras.ts
|
|
1012
|
+
var patchPseudoShadowDom = (hostElementPrototype) => {
|
|
1013
|
+
patchCloneNode(hostElementPrototype);
|
|
1014
|
+
patchSlotAppendChild(hostElementPrototype);
|
|
1015
|
+
patchSlotAppend(hostElementPrototype);
|
|
1016
|
+
patchSlotPrepend(hostElementPrototype);
|
|
1017
|
+
patchSlotInsertAdjacentElement(hostElementPrototype);
|
|
1018
|
+
patchSlotInsertAdjacentHTML(hostElementPrototype);
|
|
1019
|
+
patchSlotInsertAdjacentText(hostElementPrototype);
|
|
1020
|
+
patchTextContent(hostElementPrototype);
|
|
1021
|
+
patchChildSlotNodes(hostElementPrototype);
|
|
1022
|
+
patchSlotRemoveChild(hostElementPrototype);
|
|
1023
|
+
};
|
|
1024
|
+
var patchCloneNode = (HostElementPrototype) => {
|
|
1025
|
+
const orgCloneNode = HostElementPrototype.cloneNode;
|
|
1026
|
+
HostElementPrototype.cloneNode = function(deep) {
|
|
1027
|
+
const srcNode = this;
|
|
1028
|
+
const isShadowDom = BUILD5.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
|
|
1029
|
+
const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
|
|
1030
|
+
if (BUILD5.slot && !isShadowDom && deep) {
|
|
1031
|
+
let i2 = 0;
|
|
1032
|
+
let slotted, nonStencilNode;
|
|
1033
|
+
const stencilPrivates = [
|
|
1034
|
+
"s-id",
|
|
1035
|
+
"s-cr",
|
|
1036
|
+
"s-lr",
|
|
1037
|
+
"s-rc",
|
|
1038
|
+
"s-sc",
|
|
1039
|
+
"s-p",
|
|
1040
|
+
"s-cn",
|
|
1041
|
+
"s-sr",
|
|
1042
|
+
"s-sn",
|
|
1043
|
+
"s-hn",
|
|
1044
|
+
"s-ol",
|
|
1045
|
+
"s-nr",
|
|
1046
|
+
"s-si",
|
|
1047
|
+
"s-rf",
|
|
1048
|
+
"s-scs"
|
|
1049
|
+
];
|
|
1050
|
+
const childNodes = this.__childNodes || this.childNodes;
|
|
1051
|
+
for (; i2 < childNodes.length; i2++) {
|
|
1052
|
+
slotted = childNodes[i2]["s-nr"];
|
|
1053
|
+
nonStencilNode = stencilPrivates.every((privateField) => !childNodes[i2][privateField]);
|
|
1054
|
+
if (slotted) {
|
|
1055
|
+
if (BUILD5.appendChildSlotFix && clonedNode.__appendChild) {
|
|
1056
|
+
clonedNode.__appendChild(slotted.cloneNode(true));
|
|
1057
|
+
} else {
|
|
1058
|
+
clonedNode.appendChild(slotted.cloneNode(true));
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
if (nonStencilNode) {
|
|
1062
|
+
clonedNode.appendChild(childNodes[i2].cloneNode(true));
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
return clonedNode;
|
|
1067
|
+
};
|
|
1068
|
+
};
|
|
1069
|
+
var patchSlotAppendChild = (HostElementPrototype) => {
|
|
1070
|
+
HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
|
|
1071
|
+
HostElementPrototype.appendChild = function(newChild) {
|
|
1072
|
+
const slotName = newChild["s-sn"] = getSlotName(newChild);
|
|
1073
|
+
const slotNode = getHostSlotNode(this.__childNodes || this.childNodes, slotName, this.tagName);
|
|
1074
|
+
if (slotNode) {
|
|
1075
|
+
addSlotRelocateNode(newChild, slotNode);
|
|
1076
|
+
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
|
1077
|
+
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
1078
|
+
const insertedNode = insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
|
|
1079
|
+
updateFallbackSlotVisibility(this);
|
|
1080
|
+
return insertedNode;
|
|
1081
|
+
}
|
|
1082
|
+
return this.__appendChild(newChild);
|
|
1083
|
+
};
|
|
1084
|
+
};
|
|
1085
|
+
var patchSlotRemoveChild = (ElementPrototype) => {
|
|
1086
|
+
ElementPrototype.__removeChild = ElementPrototype.removeChild;
|
|
1087
|
+
ElementPrototype.removeChild = function(toRemove) {
|
|
1088
|
+
if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
|
|
1089
|
+
const childNodes = this.__childNodes || this.childNodes;
|
|
1090
|
+
const slotNode = getHostSlotNode(childNodes, toRemove["s-sn"], this.tagName);
|
|
1091
|
+
if (slotNode && toRemove.isConnected) {
|
|
1092
|
+
toRemove.remove();
|
|
1093
|
+
updateFallbackSlotVisibility(this);
|
|
1094
|
+
return;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
return this.__removeChild(toRemove);
|
|
1098
|
+
};
|
|
1099
|
+
};
|
|
1100
|
+
var patchSlotPrepend = (HostElementPrototype) => {
|
|
1101
|
+
HostElementPrototype.__prepend = HostElementPrototype.prepend;
|
|
1102
|
+
HostElementPrototype.prepend = function(...newChildren) {
|
|
1103
|
+
newChildren.forEach((newChild) => {
|
|
1104
|
+
if (typeof newChild === "string") {
|
|
1105
|
+
newChild = this.ownerDocument.createTextNode(newChild);
|
|
1106
|
+
}
|
|
1107
|
+
const slotName = newChild["s-sn"] = getSlotName(newChild);
|
|
1108
|
+
const childNodes = this.__childNodes || this.childNodes;
|
|
1109
|
+
const slotNode = getHostSlotNode(childNodes, slotName, this.tagName);
|
|
1110
|
+
if (slotNode) {
|
|
1111
|
+
addSlotRelocateNode(newChild, slotNode, true);
|
|
1112
|
+
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
|
1113
|
+
const appendAfter = slotChildNodes[0];
|
|
1114
|
+
return insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
|
|
1115
|
+
}
|
|
1116
|
+
if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
|
|
1117
|
+
newChild.hidden = true;
|
|
1118
|
+
}
|
|
1119
|
+
return HostElementPrototype.__prepend(newChild);
|
|
1120
|
+
});
|
|
1121
|
+
};
|
|
1122
|
+
};
|
|
1123
|
+
var patchSlotAppend = (HostElementPrototype) => {
|
|
1124
|
+
HostElementPrototype.__append = HostElementPrototype.append;
|
|
1125
|
+
HostElementPrototype.append = function(...newChildren) {
|
|
1126
|
+
newChildren.forEach((newChild) => {
|
|
1127
|
+
if (typeof newChild === "string") {
|
|
1128
|
+
newChild = this.ownerDocument.createTextNode(newChild);
|
|
1129
|
+
}
|
|
1130
|
+
this.appendChild(newChild);
|
|
1131
|
+
});
|
|
1132
|
+
};
|
|
1133
|
+
};
|
|
1134
|
+
var patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
|
|
1135
|
+
const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
|
|
1136
|
+
HostElementPrototype.insertAdjacentHTML = function(position, text) {
|
|
1137
|
+
if (position !== "afterbegin" && position !== "beforeend") {
|
|
1138
|
+
return originalInsertAdjacentHtml.call(this, position, text);
|
|
1139
|
+
}
|
|
1140
|
+
const container = this.ownerDocument.createElement("_");
|
|
1141
|
+
let node;
|
|
1142
|
+
container.innerHTML = text;
|
|
1143
|
+
if (position === "afterbegin") {
|
|
1144
|
+
while (node = container.firstChild) {
|
|
1145
|
+
this.prepend(node);
|
|
1146
|
+
}
|
|
1147
|
+
} else if (position === "beforeend") {
|
|
1148
|
+
while (node = container.firstChild) {
|
|
1149
|
+
this.append(node);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
};
|
|
1154
|
+
var patchSlotInsertAdjacentText = (HostElementPrototype) => {
|
|
1155
|
+
HostElementPrototype.insertAdjacentText = function(position, text) {
|
|
1156
|
+
this.insertAdjacentHTML(position, text);
|
|
1157
|
+
};
|
|
1158
|
+
};
|
|
1159
|
+
var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
|
|
1160
|
+
const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
|
|
1161
|
+
HostElementPrototype.insertAdjacentElement = function(position, element) {
|
|
1162
|
+
if (position !== "afterbegin" && position !== "beforeend") {
|
|
1163
|
+
return originalInsertAdjacentElement.call(this, position, element);
|
|
1164
|
+
}
|
|
1165
|
+
if (position === "afterbegin") {
|
|
1166
|
+
this.prepend(element);
|
|
1167
|
+
return element;
|
|
1168
|
+
} else if (position === "beforeend") {
|
|
1169
|
+
this.append(element);
|
|
1170
|
+
return element;
|
|
1171
|
+
}
|
|
1172
|
+
return element;
|
|
1173
|
+
};
|
|
1174
|
+
};
|
|
1175
|
+
var patchTextContent = (hostElementPrototype) => {
|
|
1176
|
+
let descriptor = globalThis.Node && Object.getOwnPropertyDescriptor(Node.prototype, "textContent");
|
|
1177
|
+
if (!descriptor) {
|
|
1178
|
+
descriptor = Object.getOwnPropertyDescriptor(hostElementPrototype, "textContent");
|
|
1179
|
+
}
|
|
1180
|
+
if (descriptor) Object.defineProperty(hostElementPrototype, "__textContent", descriptor);
|
|
1181
|
+
Object.defineProperty(hostElementPrototype, "textContent", {
|
|
1182
|
+
get: function() {
|
|
1183
|
+
let text = "";
|
|
1184
|
+
const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
|
|
1185
|
+
childNodes.forEach((node) => text += node.textContent || "");
|
|
1186
|
+
return text;
|
|
1187
|
+
},
|
|
1188
|
+
set: function(value) {
|
|
1189
|
+
const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
|
|
1190
|
+
childNodes.forEach((node) => {
|
|
1191
|
+
if (node["s-ol"]) node["s-ol"].remove();
|
|
1192
|
+
node.remove();
|
|
1193
|
+
});
|
|
1194
|
+
this.insertAdjacentHTML("beforeend", value);
|
|
1195
|
+
}
|
|
1196
|
+
});
|
|
1197
|
+
};
|
|
1198
|
+
var patchChildSlotNodes = (elm) => {
|
|
1199
|
+
class FakeNodeList extends Array {
|
|
1200
|
+
item(n) {
|
|
1201
|
+
return this[n];
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
let childNodesFn = globalThis.Node && Object.getOwnPropertyDescriptor(Node.prototype, "childNodes");
|
|
1205
|
+
if (!childNodesFn) {
|
|
1206
|
+
childNodesFn = Object.getOwnPropertyDescriptor(elm, "childNodes");
|
|
1207
|
+
}
|
|
1208
|
+
if (childNodesFn) Object.defineProperty(elm, "__childNodes", childNodesFn);
|
|
1209
|
+
let childrenFn = Object.getOwnPropertyDescriptor(Element.prototype, "children");
|
|
1210
|
+
if (!childrenFn) {
|
|
1211
|
+
childrenFn = Object.getOwnPropertyDescriptor(elm, "children");
|
|
1212
|
+
}
|
|
1213
|
+
if (childrenFn) Object.defineProperty(elm, "__children", childrenFn);
|
|
1214
|
+
Object.defineProperty(elm, "children", {
|
|
1215
|
+
get() {
|
|
1216
|
+
return this.childNodes.filter((n) => n.nodeType === 1);
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
Object.defineProperty(elm, "childElementCount", {
|
|
1220
|
+
get() {
|
|
1221
|
+
return this.children.length;
|
|
1222
|
+
}
|
|
1223
|
+
});
|
|
1224
|
+
if (!childNodesFn) return;
|
|
1225
|
+
Object.defineProperty(elm, "childNodes", {
|
|
1226
|
+
get() {
|
|
1227
|
+
var _a, _b;
|
|
1228
|
+
if (!plt.$flags$ || !((_a = getHostRef(this)) == null ? void 0 : _a.$flags$) || (plt.$flags$ & 1 /* isTmpDisconnected */) === 0 && ((_b = getHostRef(this)) == null ? void 0 : _b.$flags$) & 2 /* hasRendered */) {
|
|
1229
|
+
const result = new FakeNodeList();
|
|
1230
|
+
const nodes = getSlottedChildNodes(this.__childNodes);
|
|
1231
|
+
result.push(...nodes);
|
|
1232
|
+
return result;
|
|
1233
|
+
}
|
|
1234
|
+
return FakeNodeList.from(this.__childNodes);
|
|
1235
|
+
}
|
|
1236
|
+
});
|
|
1237
|
+
};
|
|
1238
|
+
var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
|
|
1239
|
+
let slottedNodeLocation;
|
|
1240
|
+
if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
|
|
1241
|
+
slottedNodeLocation = newChild["s-ol"];
|
|
1242
|
+
} else {
|
|
1243
|
+
slottedNodeLocation = document.createTextNode("");
|
|
1244
|
+
slottedNodeLocation["s-nr"] = newChild;
|
|
1245
|
+
}
|
|
1246
|
+
if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
|
|
1247
|
+
const parent = slotNode["s-cr"].parentNode;
|
|
1248
|
+
const appendMethod = prepend ? parent.__prepend || parent.prepend : parent.__appendChild || parent.appendChild;
|
|
1249
|
+
if (typeof position !== "undefined") {
|
|
1250
|
+
if (BUILD5.hydrateClientSide) {
|
|
1251
|
+
slottedNodeLocation["s-oo"] = position;
|
|
1252
|
+
const childNodes = parent.__childNodes || parent.childNodes;
|
|
1253
|
+
const slotRelocateNodes = [slottedNodeLocation];
|
|
1254
|
+
childNodes.forEach((n) => {
|
|
1255
|
+
if (n["s-nr"]) slotRelocateNodes.push(n);
|
|
1256
|
+
});
|
|
1257
|
+
slotRelocateNodes.sort((a, b) => {
|
|
1258
|
+
if (!a["s-oo"] || a["s-oo"] < b["s-oo"]) return -1;
|
|
1259
|
+
else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
|
|
1260
|
+
return 0;
|
|
1261
|
+
});
|
|
1262
|
+
slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
|
|
1263
|
+
}
|
|
1264
|
+
} else {
|
|
1265
|
+
appendMethod.call(parent, slottedNodeLocation);
|
|
1266
|
+
}
|
|
1267
|
+
newChild["s-ol"] = slottedNodeLocation;
|
|
1268
|
+
newChild["s-sh"] = slotNode["s-hn"];
|
|
1269
|
+
};
|
|
1270
|
+
var getSlottedChildNodes = (childNodes) => {
|
|
1271
|
+
const result = [];
|
|
1272
|
+
for (let i2 = 0; i2 < childNodes.length; i2++) {
|
|
1273
|
+
const slottedNode = childNodes[i2]["s-nr"];
|
|
1274
|
+
if (slottedNode && slottedNode.isConnected) {
|
|
1275
|
+
result.push(slottedNode);
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
return result;
|
|
1279
|
+
};
|
|
1280
|
+
var getSlotName = (node) => node["s-sn"] || node.nodeType === 1 && node.getAttribute("slot") || "";
|
|
1281
|
+
var getHostSlotNode = (childNodes, slotName, hostName) => {
|
|
1282
|
+
let i2 = 0;
|
|
1283
|
+
let childNode;
|
|
1284
|
+
for (; i2 < childNodes.length; i2++) {
|
|
1285
|
+
childNode = childNodes[i2];
|
|
1286
|
+
if (childNode["s-sr"] && childNode["s-sn"] === slotName && childNode["s-hn"] === hostName) {
|
|
1287
|
+
return childNode;
|
|
1288
|
+
}
|
|
1289
|
+
childNode = getHostSlotNode(childNode.childNodes, slotName, hostName);
|
|
1290
|
+
if (childNode) {
|
|
1291
|
+
return childNode;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
return null;
|
|
1295
|
+
};
|
|
1296
|
+
var getHostSlotChildNodes = (n, slotName) => {
|
|
1297
|
+
const childNodes = [n];
|
|
1298
|
+
while ((n = n.nextSibling) && n["s-sn"] === slotName) {
|
|
1299
|
+
childNodes.push(n);
|
|
1300
|
+
}
|
|
1301
|
+
return childNodes;
|
|
1302
|
+
};
|
|
1303
|
+
|
|
1304
|
+
// src/runtime/profile.ts
|
|
1305
|
+
import { BUILD as BUILD6 } from "@stencil/core/internal/app-data";
|
|
1306
|
+
var i = 0;
|
|
1307
|
+
var createTime = (fnName, tagName = "") => {
|
|
1308
|
+
if (BUILD6.profile && performance.mark) {
|
|
1309
|
+
const key = `st:${fnName}:${tagName}:${i++}`;
|
|
1310
|
+
performance.mark(key);
|
|
1311
|
+
return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
|
|
1312
|
+
} else {
|
|
1313
|
+
return () => {
|
|
1314
|
+
return;
|
|
1315
|
+
};
|
|
1316
|
+
}
|
|
1317
|
+
};
|
|
1318
|
+
var uniqueTime = (key, measureText) => {
|
|
1319
|
+
if (BUILD6.profile && performance.mark) {
|
|
1320
|
+
if (performance.getEntriesByName(key, "mark").length === 0) {
|
|
1321
|
+
performance.mark(key);
|
|
1322
|
+
}
|
|
1323
|
+
return () => {
|
|
1324
|
+
if (performance.getEntriesByName(measureText, "measure").length === 0) {
|
|
1325
|
+
performance.measure(measureText, key);
|
|
1326
|
+
}
|
|
1327
|
+
};
|
|
1328
|
+
} else {
|
|
1329
|
+
return () => {
|
|
1330
|
+
return;
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
};
|
|
1334
|
+
var inspect = (ref) => {
|
|
1335
|
+
const hostRef = getHostRef(ref);
|
|
1336
|
+
if (!hostRef) {
|
|
1337
|
+
return void 0;
|
|
1338
|
+
}
|
|
1339
|
+
const flags = hostRef.$flags$;
|
|
1340
|
+
const hostElement = hostRef.$hostElement$;
|
|
1341
|
+
return {
|
|
1342
|
+
renderCount: hostRef.$renderCount$,
|
|
1343
|
+
flags: {
|
|
1344
|
+
hasRendered: !!(flags & 2 /* hasRendered */),
|
|
1345
|
+
hasConnected: !!(flags & 1 /* hasConnected */),
|
|
1346
|
+
isWaitingForChildren: !!(flags & 4 /* isWaitingForChildren */),
|
|
1347
|
+
isConstructingInstance: !!(flags & 8 /* isConstructingInstance */),
|
|
1348
|
+
isQueuedForUpdate: !!(flags & 16 /* isQueuedForUpdate */),
|
|
1349
|
+
hasInitializedComponent: !!(flags & 32 /* hasInitializedComponent */),
|
|
1350
|
+
hasLoadedComponent: !!(flags & 64 /* hasLoadedComponent */),
|
|
1351
|
+
isWatchReady: !!(flags & 128 /* isWatchReady */),
|
|
1352
|
+
isListenReady: !!(flags & 256 /* isListenReady */),
|
|
1353
|
+
needsRerender: !!(flags & 512 /* needsRerender */)
|
|
1354
|
+
},
|
|
1355
|
+
instanceValues: hostRef.$instanceValues$,
|
|
1356
|
+
ancestorComponent: hostRef.$ancestorComponent$,
|
|
1357
|
+
hostElement,
|
|
1358
|
+
lazyInstance: hostRef.$lazyInstance$,
|
|
1359
|
+
vnode: hostRef.$vnode$,
|
|
1360
|
+
modeName: hostRef.$modeName$,
|
|
1361
|
+
onReadyPromise: hostRef.$onReadyPromise$,
|
|
1362
|
+
onReadyResolve: hostRef.$onReadyResolve$,
|
|
1363
|
+
onInstancePromise: hostRef.$onInstancePromise$,
|
|
1364
|
+
onInstanceResolve: hostRef.$onInstanceResolve$,
|
|
1365
|
+
onRenderResolve: hostRef.$onRenderResolve$,
|
|
1366
|
+
queuedListeners: hostRef.$queuedListeners$,
|
|
1367
|
+
rmListeners: hostRef.$rmListeners$,
|
|
1368
|
+
["s-id"]: hostElement["s-id"],
|
|
1369
|
+
["s-cr"]: hostElement["s-cr"],
|
|
1370
|
+
["s-lr"]: hostElement["s-lr"],
|
|
1371
|
+
["s-p"]: hostElement["s-p"],
|
|
1372
|
+
["s-rc"]: hostElement["s-rc"],
|
|
1373
|
+
["s-sc"]: hostElement["s-sc"]
|
|
1374
|
+
};
|
|
1375
|
+
};
|
|
1376
|
+
var installDevTools = () => {
|
|
1377
|
+
if (BUILD6.devTools) {
|
|
1378
|
+
const stencil = win.stencil = win.stencil || {};
|
|
1379
|
+
const originalInspect = stencil.inspect;
|
|
1380
|
+
stencil.inspect = (ref) => {
|
|
1381
|
+
let result = inspect(ref);
|
|
1382
|
+
if (!result && typeof originalInspect === "function") {
|
|
1383
|
+
result = originalInspect(ref);
|
|
1384
|
+
}
|
|
1385
|
+
return result;
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
|
|
1390
|
+
// src/runtime/client-hydrate.ts
|
|
1391
|
+
var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
1392
|
+
const endHydrate = createTime("hydrateClient", tagName);
|
|
1393
|
+
const shadowRoot = hostElm.shadowRoot;
|
|
1394
|
+
const childRenderNodes = [];
|
|
1395
|
+
const slotNodes = [];
|
|
1396
|
+
const slottedNodes = [];
|
|
1397
|
+
const shadowRootNodes = BUILD7.shadowDom && shadowRoot ? [] : null;
|
|
1398
|
+
const vnode = newVNode(tagName, null);
|
|
1399
|
+
vnode.$elm$ = hostElm;
|
|
1400
|
+
if (!plt.$orgLocNodes$) {
|
|
1401
|
+
initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
|
|
1402
|
+
}
|
|
1403
|
+
hostElm[HYDRATE_ID] = hostId;
|
|
1404
|
+
hostElm.removeAttribute(HYDRATE_ID);
|
|
1405
|
+
hostRef.$vnode$ = clientHydrate(
|
|
1406
|
+
vnode,
|
|
1407
|
+
childRenderNodes,
|
|
1408
|
+
slotNodes,
|
|
1409
|
+
shadowRootNodes,
|
|
1410
|
+
hostElm,
|
|
1411
|
+
hostElm,
|
|
1412
|
+
hostId,
|
|
1413
|
+
slottedNodes
|
|
1414
|
+
);
|
|
1415
|
+
let crIndex = 0;
|
|
1416
|
+
const crLength = childRenderNodes.length;
|
|
1417
|
+
let childRenderNode;
|
|
1418
|
+
for (crIndex; crIndex < crLength; crIndex++) {
|
|
1419
|
+
childRenderNode = childRenderNodes[crIndex];
|
|
1420
|
+
const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
|
|
1421
|
+
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
|
1422
|
+
const node = childRenderNode.$elm$;
|
|
1423
|
+
if (!shadowRoot) {
|
|
1424
|
+
node["s-hn"] = tagName.toUpperCase();
|
|
1425
|
+
if (childRenderNode.$tag$ === "slot") {
|
|
1426
|
+
node["s-cr"] = hostElm["s-cr"];
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
if (orgLocationNode && orgLocationNode.isConnected) {
|
|
1430
|
+
if (shadowRoot && orgLocationNode["s-en"] === "") {
|
|
1431
|
+
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
|
1432
|
+
}
|
|
1433
|
+
orgLocationNode.parentNode.removeChild(orgLocationNode);
|
|
1434
|
+
if (!shadowRoot) {
|
|
1435
|
+
node["s-oo"] = parseInt(childRenderNode.$nodeId$);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
plt.$orgLocNodes$.delete(orgLocationId);
|
|
1439
|
+
}
|
|
1440
|
+
const hosts = [];
|
|
1441
|
+
let snIndex = 0;
|
|
1442
|
+
const snLen = slottedNodes.length;
|
|
1443
|
+
let slotGroup;
|
|
1444
|
+
let snGroupIdx;
|
|
1445
|
+
let snGroupLen;
|
|
1446
|
+
let slottedItem;
|
|
1447
|
+
for (snIndex; snIndex < snLen; snIndex++) {
|
|
1448
|
+
slotGroup = slottedNodes[snIndex];
|
|
1449
|
+
if (!slotGroup || !slotGroup.length) continue;
|
|
1450
|
+
snGroupLen = slotGroup.length;
|
|
1451
|
+
snGroupIdx = 0;
|
|
1452
|
+
for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
|
|
1453
|
+
slottedItem = slotGroup[snGroupIdx];
|
|
1454
|
+
if (!hosts[slottedItem.hostId]) {
|
|
1455
|
+
hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
|
|
1456
|
+
}
|
|
1457
|
+
if (!hosts[slottedItem.hostId]) continue;
|
|
1458
|
+
const hostEle = hosts[slottedItem.hostId];
|
|
1459
|
+
if (!hostEle.shadowRoot || !shadowRoot) {
|
|
1460
|
+
slottedItem.slot["s-cr"] = hostEle["s-cr"];
|
|
1461
|
+
if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
|
|
1462
|
+
slottedItem.slot["s-cr"] = hostEle;
|
|
1463
|
+
} else {
|
|
1464
|
+
const hostChildren = hostEle.__childNodes || hostEle.childNodes;
|
|
1465
|
+
slottedItem.slot["s-cr"] = hostChildren[0];
|
|
1466
|
+
}
|
|
1467
|
+
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
|
|
1468
|
+
}
|
|
1469
|
+
if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
|
|
1470
|
+
hostEle.appendChild(slottedItem.node);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
if (BUILD7.shadowDom && shadowRoot) {
|
|
1475
|
+
let rnIdex = 0;
|
|
1476
|
+
const rnLen = shadowRootNodes.length;
|
|
1477
|
+
for (rnIdex; rnIdex < rnLen; rnIdex++) {
|
|
1478
|
+
shadowRoot.appendChild(shadowRootNodes[rnIdex]);
|
|
1479
|
+
}
|
|
1480
|
+
Array.from(hostElm.childNodes).forEach((node) => {
|
|
1481
|
+
if (node.nodeType === 8 /* CommentNode */ && typeof node["s-sn"] !== "string") {
|
|
1482
|
+
node.parentNode.removeChild(node);
|
|
1483
|
+
}
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1486
|
+
hostRef.$hostElement$ = hostElm;
|
|
1487
|
+
endHydrate();
|
|
1488
|
+
};
|
|
1489
|
+
var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
|
|
1490
|
+
let childNodeType;
|
|
1491
|
+
let childIdSplt;
|
|
1492
|
+
let childVNode;
|
|
1493
|
+
let i2;
|
|
1494
|
+
const scopeId2 = hostElm["s-sc"];
|
|
1495
|
+
if (node.nodeType === 1 /* ElementNode */) {
|
|
1496
|
+
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
|
1497
|
+
if (childNodeType) {
|
|
1498
|
+
childIdSplt = childNodeType.split(".");
|
|
1499
|
+
if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
|
|
1500
|
+
childVNode = createSimpleVNode({
|
|
1501
|
+
$flags$: 0,
|
|
1502
|
+
$hostId$: childIdSplt[0],
|
|
1503
|
+
$nodeId$: childIdSplt[1],
|
|
1504
|
+
$depth$: childIdSplt[2],
|
|
1505
|
+
$index$: childIdSplt[3],
|
|
1506
|
+
$tag$: node.tagName.toLowerCase(),
|
|
1507
|
+
$elm$: node,
|
|
1508
|
+
// If we don't add the initial classes to the VNode, the first `vdom-render.ts` reconciliation will fail:
|
|
1509
|
+
// client side changes before componentDidLoad will be ignored, `set-accessor.ts` will just take the element's initial classes
|
|
1510
|
+
$attrs$: { class: node.className }
|
|
1511
|
+
});
|
|
1512
|
+
childRenderNodes.push(childVNode);
|
|
1513
|
+
node.removeAttribute(HYDRATE_CHILD_ID);
|
|
1514
|
+
if (!parentVNode.$children$) {
|
|
1515
|
+
parentVNode.$children$ = [];
|
|
1516
|
+
}
|
|
1517
|
+
const slotName = childVNode.$elm$.getAttribute("s-sn");
|
|
1518
|
+
if (typeof slotName === "string") {
|
|
1519
|
+
if (childVNode.$tag$ === "slot-fb") {
|
|
1520
|
+
addSlot(
|
|
1521
|
+
slotName,
|
|
1522
|
+
childIdSplt[2],
|
|
1523
|
+
childVNode,
|
|
1524
|
+
node,
|
|
1525
|
+
parentVNode,
|
|
1526
|
+
childRenderNodes,
|
|
1527
|
+
slotNodes,
|
|
1528
|
+
shadowRootNodes,
|
|
1529
|
+
slottedNodes
|
|
1530
|
+
);
|
|
1531
|
+
}
|
|
1532
|
+
childVNode.$elm$["s-sn"] = slotName;
|
|
1533
|
+
childVNode.$elm$.removeAttribute("s-sn");
|
|
1534
|
+
}
|
|
1535
|
+
if (childVNode.$index$ !== void 0) {
|
|
1536
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1537
|
+
}
|
|
1538
|
+
if (scopeId2) node["s-si"] = scopeId2;
|
|
1539
|
+
parentVNode = childVNode;
|
|
1540
|
+
if (shadowRootNodes && childVNode.$depth$ === "0") {
|
|
1541
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
if (node.shadowRoot) {
|
|
1546
|
+
for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
|
|
1547
|
+
clientHydrate(
|
|
1548
|
+
parentVNode,
|
|
1549
|
+
childRenderNodes,
|
|
1550
|
+
slotNodes,
|
|
1551
|
+
shadowRootNodes,
|
|
1552
|
+
hostElm,
|
|
1553
|
+
node.shadowRoot.childNodes[i2],
|
|
1554
|
+
hostId,
|
|
1555
|
+
slottedNodes
|
|
1556
|
+
);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
const nonShadowNodes = node.__childNodes || node.childNodes;
|
|
1560
|
+
for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
|
|
1561
|
+
clientHydrate(
|
|
1562
|
+
parentVNode,
|
|
1563
|
+
childRenderNodes,
|
|
1564
|
+
slotNodes,
|
|
1565
|
+
shadowRootNodes,
|
|
1566
|
+
hostElm,
|
|
1567
|
+
nonShadowNodes[i2],
|
|
1568
|
+
hostId,
|
|
1569
|
+
slottedNodes
|
|
1570
|
+
);
|
|
1571
|
+
}
|
|
1572
|
+
} else if (node.nodeType === 8 /* CommentNode */) {
|
|
1573
|
+
childIdSplt = node.nodeValue.split(".");
|
|
1574
|
+
if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
|
|
1575
|
+
childNodeType = childIdSplt[0];
|
|
1576
|
+
childVNode = createSimpleVNode({
|
|
1577
|
+
$hostId$: childIdSplt[1],
|
|
1578
|
+
$nodeId$: childIdSplt[2],
|
|
1579
|
+
$depth$: childIdSplt[3],
|
|
1580
|
+
$index$: childIdSplt[4] || "0",
|
|
1581
|
+
$elm$: node,
|
|
1582
|
+
$attrs$: null,
|
|
1583
|
+
$children$: null,
|
|
1584
|
+
$key$: null,
|
|
1585
|
+
$name$: null,
|
|
1586
|
+
$tag$: null,
|
|
1587
|
+
$text$: null
|
|
1588
|
+
});
|
|
1589
|
+
if (childNodeType === TEXT_NODE_ID) {
|
|
1590
|
+
childVNode.$elm$ = node.nextSibling;
|
|
1591
|
+
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
|
|
1592
|
+
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
1593
|
+
childRenderNodes.push(childVNode);
|
|
1594
|
+
node.remove();
|
|
1595
|
+
if (hostId === childVNode.$hostId$) {
|
|
1596
|
+
if (!parentVNode.$children$) {
|
|
1597
|
+
parentVNode.$children$ = [];
|
|
1598
|
+
}
|
|
1599
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1600
|
+
}
|
|
1601
|
+
if (shadowRootNodes && childVNode.$depth$ === "0") {
|
|
1602
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
} else if (childNodeType === COMMENT_NODE_ID) {
|
|
1606
|
+
childVNode.$elm$ = node.nextSibling;
|
|
1607
|
+
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
|
|
1608
|
+
childRenderNodes.push(childVNode);
|
|
1609
|
+
node.remove();
|
|
1610
|
+
}
|
|
1611
|
+
} else if (childVNode.$hostId$ === hostId) {
|
|
1612
|
+
if (childNodeType === SLOT_NODE_ID) {
|
|
1613
|
+
childVNode.$tag$ = "slot";
|
|
1614
|
+
const slotName = node["s-sn"] = childVNode.$name$ = childIdSplt[5] || "";
|
|
1615
|
+
addSlot(
|
|
1616
|
+
slotName,
|
|
1617
|
+
childIdSplt[2],
|
|
1618
|
+
childVNode,
|
|
1619
|
+
node,
|
|
1620
|
+
parentVNode,
|
|
1621
|
+
childRenderNodes,
|
|
1622
|
+
slotNodes,
|
|
1623
|
+
shadowRootNodes,
|
|
1624
|
+
slottedNodes
|
|
1625
|
+
);
|
|
1626
|
+
} else if (childNodeType === CONTENT_REF_ID) {
|
|
1627
|
+
if (BUILD7.shadowDom && shadowRootNodes) {
|
|
1628
|
+
node.remove();
|
|
1629
|
+
} else if (BUILD7.slotRelocation) {
|
|
1630
|
+
hostElm["s-cr"] = node;
|
|
1631
|
+
node["s-cn"] = true;
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
} else if (parentVNode && parentVNode.$tag$ === "style") {
|
|
1637
|
+
const vnode = newVNode(null, node.textContent);
|
|
1638
|
+
vnode.$elm$ = node;
|
|
1639
|
+
vnode.$index$ = "0";
|
|
1640
|
+
parentVNode.$children$ = [vnode];
|
|
1641
|
+
}
|
|
1642
|
+
return parentVNode;
|
|
1643
|
+
};
|
|
1644
|
+
var initializeDocumentHydrate = (node, orgLocNodes) => {
|
|
1645
|
+
if (node.nodeType === 1 /* ElementNode */) {
|
|
1646
|
+
const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
|
|
1647
|
+
if (componentId) {
|
|
1648
|
+
orgLocNodes.set(componentId, node);
|
|
1649
|
+
}
|
|
1650
|
+
let i2 = 0;
|
|
1651
|
+
if (node.shadowRoot) {
|
|
1652
|
+
for (; i2 < node.shadowRoot.childNodes.length; i2++) {
|
|
1653
|
+
initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
const nonShadowNodes = node.__childNodes || node.childNodes;
|
|
1657
|
+
for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
|
|
1658
|
+
initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
|
|
1659
|
+
}
|
|
1660
|
+
} else if (node.nodeType === 8 /* CommentNode */) {
|
|
1661
|
+
const childIdSplt = node.nodeValue.split(".");
|
|
1662
|
+
if (childIdSplt[0] === ORG_LOCATION_ID) {
|
|
1663
|
+
orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
|
|
1664
|
+
node.nodeValue = "";
|
|
1665
|
+
node["s-en"] = childIdSplt[3];
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
};
|
|
1669
|
+
var createSimpleVNode = (vnode) => {
|
|
1670
|
+
const defaultVNode = {
|
|
1671
|
+
$flags$: 0,
|
|
1672
|
+
$hostId$: null,
|
|
1673
|
+
$nodeId$: null,
|
|
1674
|
+
$depth$: null,
|
|
1675
|
+
$index$: "0",
|
|
1676
|
+
$elm$: null,
|
|
1677
|
+
$attrs$: null,
|
|
1678
|
+
$children$: null,
|
|
1679
|
+
$key$: null,
|
|
1680
|
+
$name$: null,
|
|
1681
|
+
$tag$: null,
|
|
1682
|
+
$text$: null
|
|
1683
|
+
};
|
|
1684
|
+
return { ...defaultVNode, ...vnode };
|
|
1685
|
+
};
|
|
1686
|
+
function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
|
|
1687
|
+
node["s-sr"] = true;
|
|
1688
|
+
const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
|
|
1689
|
+
if (BUILD7.shadowDom && shadowRootNodes) {
|
|
1690
|
+
const slot = childVNode.$elm$ = doc.createElement(childVNode.$tag$);
|
|
1691
|
+
if (childVNode.$name$) {
|
|
1692
|
+
childVNode.$elm$.setAttribute("name", slotName);
|
|
1693
|
+
}
|
|
1694
|
+
if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
|
|
1695
|
+
parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
|
|
1696
|
+
} else {
|
|
1697
|
+
node.parentNode.insertBefore(childVNode.$elm$, node);
|
|
1698
|
+
}
|
|
1699
|
+
addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
|
|
1700
|
+
node.remove();
|
|
1701
|
+
if (childVNode.$depth$ === "0") {
|
|
1702
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1703
|
+
}
|
|
1704
|
+
} else {
|
|
1705
|
+
const slot = childVNode.$elm$;
|
|
1706
|
+
const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
|
|
1707
|
+
addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
|
|
1708
|
+
if (shouldMove) {
|
|
1709
|
+
parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
|
|
1710
|
+
}
|
|
1711
|
+
childRenderNodes.push(childVNode);
|
|
1712
|
+
}
|
|
1713
|
+
slotNodes.push(childVNode);
|
|
1714
|
+
if (!parentVNode.$children$) {
|
|
1715
|
+
parentVNode.$children$ = [];
|
|
1716
|
+
}
|
|
1717
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1718
|
+
}
|
|
1719
|
+
var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
|
|
1720
|
+
let slottedNode = slotNode.nextSibling;
|
|
1721
|
+
slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
|
|
1722
|
+
while (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (slottedNode.nodeType === 8 /* CommentNode */ && slottedNode.nodeValue.indexOf(".") !== 1 || slottedNode.nodeType === 3 /* TextNode */))) {
|
|
1723
|
+
slottedNode["s-sn"] = slotName;
|
|
1724
|
+
slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
|
|
1725
|
+
slottedNode = slottedNode.nextSibling;
|
|
1726
|
+
}
|
|
1727
|
+
};
|
|
1728
|
+
|
|
1729
|
+
// src/runtime/initialize-component.ts
|
|
1730
|
+
import { BUILD as BUILD15 } from "@stencil/core/internal/app-data";
|
|
1731
|
+
|
|
1732
|
+
// src/runtime/mode.ts
|
|
1733
|
+
var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
|
|
1734
|
+
var setMode = (handler) => modeResolutionChain.push(handler);
|
|
1735
|
+
var getMode = (ref) => getHostRef(ref).$modeName$;
|
|
1736
|
+
|
|
1737
|
+
// src/runtime/proxy-component.ts
|
|
1738
|
+
import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
|
|
1739
|
+
|
|
1740
|
+
// src/runtime/set-value.ts
|
|
1741
|
+
import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
|
|
1742
|
+
|
|
1743
|
+
// src/runtime/parse-property-value.ts
|
|
1744
|
+
import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
|
|
1745
|
+
var parsePropertyValue = (propValue, propType) => {
|
|
1746
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
1747
|
+
if (BUILD8.propBoolean && propType & 4 /* Boolean */) {
|
|
1748
|
+
return propValue === "false" ? false : propValue === "" || !!propValue;
|
|
1749
|
+
}
|
|
1750
|
+
if (BUILD8.propNumber && propType & 2 /* Number */) {
|
|
1751
|
+
return parseFloat(propValue);
|
|
1752
|
+
}
|
|
1753
|
+
if (BUILD8.propString && propType & 1 /* String */) {
|
|
1754
|
+
return String(propValue);
|
|
1755
|
+
}
|
|
1756
|
+
return propValue;
|
|
1757
|
+
}
|
|
1758
|
+
return propValue;
|
|
1759
|
+
};
|
|
1760
|
+
|
|
1761
|
+
// src/runtime/update-component.ts
|
|
1762
|
+
import { BUILD as BUILD12, NAMESPACE } from "@stencil/core/internal/app-data";
|
|
1763
|
+
|
|
1764
|
+
// src/runtime/event-emitter.ts
|
|
1765
|
+
import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
|
|
1766
|
+
|
|
1767
|
+
// src/runtime/element.ts
|
|
1768
|
+
import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
|
|
1769
|
+
var getElement = (ref) => BUILD9.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
|
|
1770
|
+
|
|
1771
|
+
// src/runtime/event-emitter.ts
|
|
1772
|
+
var createEvent = (ref, name, flags) => {
|
|
1773
|
+
const elm = getElement(ref);
|
|
1774
|
+
return {
|
|
1775
|
+
emit: (detail) => {
|
|
1776
|
+
if (BUILD10.isDev && !elm.isConnected) {
|
|
1777
|
+
consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
|
|
1778
|
+
}
|
|
1779
|
+
return emitEvent(elm, name, {
|
|
1780
|
+
bubbles: !!(flags & 4 /* Bubbles */),
|
|
1781
|
+
composed: !!(flags & 2 /* Composed */),
|
|
1782
|
+
cancelable: !!(flags & 1 /* Cancellable */),
|
|
1783
|
+
detail
|
|
1784
|
+
});
|
|
1785
|
+
}
|
|
1786
|
+
};
|
|
1787
|
+
};
|
|
1788
|
+
var emitEvent = (elm, name, opts) => {
|
|
1789
|
+
const ev = plt.ce(name, opts);
|
|
1790
|
+
elm.dispatchEvent(ev);
|
|
1791
|
+
return ev;
|
|
1792
|
+
};
|
|
1793
|
+
|
|
1794
|
+
// src/runtime/styles.ts
|
|
1795
|
+
import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
|
|
1796
|
+
var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
|
|
1797
|
+
var registerStyle = (scopeId2, cssText, allowCS) => {
|
|
1798
|
+
let style = styles.get(scopeId2);
|
|
1799
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
1800
|
+
style = style || new CSSStyleSheet();
|
|
1801
|
+
if (typeof style === "string") {
|
|
1802
|
+
style = cssText;
|
|
1803
|
+
} else {
|
|
1804
|
+
style.replaceSync(cssText);
|
|
1805
|
+
}
|
|
1806
|
+
} else {
|
|
1807
|
+
style = cssText;
|
|
1808
|
+
}
|
|
1809
|
+
styles.set(scopeId2, style);
|
|
1810
|
+
};
|
|
1811
|
+
var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
1812
|
+
var _a;
|
|
1813
|
+
const scopeId2 = getScopeId(cmpMeta, mode);
|
|
1814
|
+
const style = styles.get(scopeId2);
|
|
1815
|
+
if (!BUILD11.attachStyles) {
|
|
1816
|
+
return scopeId2;
|
|
1817
|
+
}
|
|
1818
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
1819
|
+
if (style) {
|
|
1820
|
+
if (typeof style === "string") {
|
|
1821
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
1822
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
1823
|
+
let styleElm;
|
|
1824
|
+
if (!appliedStyles) {
|
|
1825
|
+
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
|
1826
|
+
}
|
|
1827
|
+
if (!appliedStyles.has(scopeId2)) {
|
|
1828
|
+
if (BUILD11.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
|
|
1829
|
+
styleElm.innerHTML = style;
|
|
1830
|
+
} else {
|
|
1831
|
+
styleElm = doc.createElement("style");
|
|
1832
|
+
styleElm.innerHTML = style;
|
|
1833
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
|
|
1834
|
+
if (nonce != null) {
|
|
1835
|
+
styleElm.setAttribute("nonce", nonce);
|
|
1836
|
+
}
|
|
1837
|
+
if ((BUILD11.hydrateServerSide || BUILD11.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
1838
|
+
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
|
|
1839
|
+
}
|
|
1840
|
+
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
1841
|
+
if (styleContainerNode.nodeName === "HEAD") {
|
|
1842
|
+
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
|
1843
|
+
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
|
1844
|
+
styleContainerNode.insertBefore(styleElm, referenceNode2);
|
|
1845
|
+
} else if ("host" in styleContainerNode) {
|
|
1846
|
+
if (supportsConstructableStylesheets) {
|
|
1847
|
+
const stylesheet = new CSSStyleSheet();
|
|
1848
|
+
stylesheet.replaceSync(style);
|
|
1849
|
+
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
|
1850
|
+
} else {
|
|
1851
|
+
const existingStyleContainer = styleContainerNode.querySelector("style");
|
|
1852
|
+
if (existingStyleContainer) {
|
|
1853
|
+
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
|
1854
|
+
} else {
|
|
1855
|
+
styleContainerNode.prepend(styleElm);
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
} else {
|
|
1859
|
+
styleContainerNode.append(styleElm);
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
|
|
1863
|
+
styleContainerNode.insertBefore(styleElm, null);
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
|
1867
|
+
styleElm.innerHTML += SLOT_FB_CSS;
|
|
1868
|
+
}
|
|
1869
|
+
if (appliedStyles) {
|
|
1870
|
+
appliedStyles.add(scopeId2);
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
} else if (BUILD11.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
1874
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
return scopeId2;
|
|
1878
|
+
};
|
|
1879
|
+
var attachStyles = (hostRef) => {
|
|
1880
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
1881
|
+
const elm = hostRef.$hostElement$;
|
|
1882
|
+
const flags = cmpMeta.$flags$;
|
|
1883
|
+
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
|
1884
|
+
const scopeId2 = addStyle(
|
|
1885
|
+
BUILD11.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
|
|
1886
|
+
cmpMeta,
|
|
1887
|
+
hostRef.$modeName$
|
|
1888
|
+
);
|
|
1889
|
+
if ((BUILD11.shadowDom || BUILD11.scoped) && BUILD11.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
|
|
1890
|
+
elm["s-sc"] = scopeId2;
|
|
1891
|
+
elm.classList.add(scopeId2 + "-h");
|
|
1892
|
+
if (BUILD11.scoped && flags & 2 /* scopedCssEncapsulation */) {
|
|
1893
|
+
elm.classList.add(scopeId2 + "-s");
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
endAttachStyles();
|
|
1441
1897
|
};
|
|
1442
|
-
var
|
|
1443
|
-
`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
|
|
1444
|
-
);
|
|
1445
|
-
var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(
|
|
1446
|
-
`org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
|
|
1447
|
-
);
|
|
1898
|
+
var getScopeId = (cmp, mode) => "sc-" + (BUILD11.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
|
|
1448
1899
|
|
|
1449
1900
|
// src/runtime/update-component.ts
|
|
1450
1901
|
var attachToAncestor = (hostRef, ancestorComponent) => {
|
|
1451
|
-
if (
|
|
1902
|
+
if (BUILD12.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
|
|
1452
1903
|
ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
|
|
1453
1904
|
}
|
|
1454
1905
|
};
|
|
1455
1906
|
var scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
1456
|
-
if (
|
|
1907
|
+
if (BUILD12.taskQueue && BUILD12.updatable) {
|
|
1457
1908
|
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
1458
1909
|
}
|
|
1459
|
-
if (
|
|
1910
|
+
if (BUILD12.asyncLoading && hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
1460
1911
|
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
1461
1912
|
return;
|
|
1462
1913
|
}
|
|
1463
1914
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
1464
1915
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
1465
|
-
return
|
|
1916
|
+
return BUILD12.taskQueue ? writeTask(dispatch) : dispatch();
|
|
1466
1917
|
};
|
|
1467
1918
|
var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
1468
1919
|
const elm = hostRef.$hostElement$;
|
|
1469
1920
|
const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
|
|
1470
|
-
const instance =
|
|
1921
|
+
const instance = BUILD12.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
1471
1922
|
if (!instance) {
|
|
1472
1923
|
throw new Error(
|
|
1473
1924
|
`Can't render component <${elm.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`
|
|
@@ -1475,7 +1926,7 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1475
1926
|
}
|
|
1476
1927
|
let maybePromise;
|
|
1477
1928
|
if (isInitialLoad) {
|
|
1478
|
-
if (
|
|
1929
|
+
if (BUILD12.lazyLoad && BUILD12.hostListener) {
|
|
1479
1930
|
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
1480
1931
|
if (hostRef.$queuedListeners$) {
|
|
1481
1932
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
@@ -1483,17 +1934,17 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1483
1934
|
}
|
|
1484
1935
|
}
|
|
1485
1936
|
emitLifecycleEvent(elm, "componentWillLoad");
|
|
1486
|
-
if (
|
|
1937
|
+
if (BUILD12.cmpWillLoad) {
|
|
1487
1938
|
maybePromise = safeCall(instance, "componentWillLoad");
|
|
1488
1939
|
}
|
|
1489
1940
|
} else {
|
|
1490
1941
|
emitLifecycleEvent(elm, "componentWillUpdate");
|
|
1491
|
-
if (
|
|
1942
|
+
if (BUILD12.cmpWillUpdate) {
|
|
1492
1943
|
maybePromise = safeCall(instance, "componentWillUpdate");
|
|
1493
1944
|
}
|
|
1494
1945
|
}
|
|
1495
1946
|
emitLifecycleEvent(elm, "componentWillRender");
|
|
1496
|
-
if (
|
|
1947
|
+
if (BUILD12.cmpWillRender) {
|
|
1497
1948
|
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender"));
|
|
1498
1949
|
}
|
|
1499
1950
|
endSchedule();
|
|
@@ -1509,23 +1960,23 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1509
1960
|
const elm = hostRef.$hostElement$;
|
|
1510
1961
|
const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
|
|
1511
1962
|
const rc = elm["s-rc"];
|
|
1512
|
-
if (
|
|
1963
|
+
if (BUILD12.style && isInitialLoad) {
|
|
1513
1964
|
attachStyles(hostRef);
|
|
1514
1965
|
}
|
|
1515
1966
|
const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
|
|
1516
|
-
if (
|
|
1967
|
+
if (BUILD12.isDev) {
|
|
1517
1968
|
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
1518
1969
|
}
|
|
1519
|
-
if (
|
|
1970
|
+
if (BUILD12.hydrateServerSide) {
|
|
1520
1971
|
await callRender(hostRef, instance, elm, isInitialLoad);
|
|
1521
1972
|
} else {
|
|
1522
1973
|
callRender(hostRef, instance, elm, isInitialLoad);
|
|
1523
1974
|
}
|
|
1524
|
-
if (
|
|
1975
|
+
if (BUILD12.isDev) {
|
|
1525
1976
|
hostRef.$renderCount$ = hostRef.$renderCount$ === void 0 ? 1 : hostRef.$renderCount$ + 1;
|
|
1526
1977
|
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
1527
1978
|
}
|
|
1528
|
-
if (
|
|
1979
|
+
if (BUILD12.hydrateServerSide) {
|
|
1529
1980
|
try {
|
|
1530
1981
|
serverSideConnected(elm);
|
|
1531
1982
|
if (isInitialLoad) {
|
|
@@ -1539,13 +1990,13 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1539
1990
|
consoleError(e, elm);
|
|
1540
1991
|
}
|
|
1541
1992
|
}
|
|
1542
|
-
if (
|
|
1993
|
+
if (BUILD12.asyncLoading && rc) {
|
|
1543
1994
|
rc.map((cb) => cb());
|
|
1544
1995
|
elm["s-rc"] = void 0;
|
|
1545
1996
|
}
|
|
1546
1997
|
endRender();
|
|
1547
1998
|
endUpdate();
|
|
1548
|
-
if (
|
|
1999
|
+
if (BUILD12.asyncLoading) {
|
|
1549
2000
|
const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
|
|
1550
2001
|
const postUpdate = () => postUpdateComponent(hostRef);
|
|
1551
2002
|
if (childrenPromises.length === 0) {
|
|
@@ -1561,10 +2012,10 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1561
2012
|
};
|
|
1562
2013
|
var renderingRef = null;
|
|
1563
2014
|
var callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
1564
|
-
const allRenderFn =
|
|
1565
|
-
const lazyLoad =
|
|
1566
|
-
const taskQueue =
|
|
1567
|
-
const updatable =
|
|
2015
|
+
const allRenderFn = BUILD12.allRenderFn ? true : false;
|
|
2016
|
+
const lazyLoad = BUILD12.lazyLoad ? true : false;
|
|
2017
|
+
const taskQueue = BUILD12.taskQueue ? true : false;
|
|
2018
|
+
const updatable = BUILD12.updatable ? true : false;
|
|
1568
2019
|
try {
|
|
1569
2020
|
renderingRef = instance;
|
|
1570
2021
|
instance = allRenderFn ? instance.render() : instance.render && instance.render();
|
|
@@ -1574,9 +2025,9 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
|
1574
2025
|
if (updatable || lazyLoad) {
|
|
1575
2026
|
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
1576
2027
|
}
|
|
1577
|
-
if (
|
|
1578
|
-
if (
|
|
1579
|
-
if (
|
|
2028
|
+
if (BUILD12.hasRenderFn || BUILD12.reflect) {
|
|
2029
|
+
if (BUILD12.vdomRender || BUILD12.reflect) {
|
|
2030
|
+
if (BUILD12.hydrateServerSide) {
|
|
1580
2031
|
return Promise.resolve(instance).then((value) => renderVdom(hostRef, value, isInitialLoad));
|
|
1581
2032
|
} else {
|
|
1582
2033
|
renderVdom(hostRef, instance, isInitialLoad);
|
|
@@ -1601,57 +2052,57 @@ var postUpdateComponent = (hostRef) => {
|
|
|
1601
2052
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
1602
2053
|
const elm = hostRef.$hostElement$;
|
|
1603
2054
|
const endPostUpdate = createTime("postUpdate", tagName);
|
|
1604
|
-
const instance =
|
|
2055
|
+
const instance = BUILD12.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
1605
2056
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1606
|
-
if (
|
|
1607
|
-
if (
|
|
2057
|
+
if (BUILD12.cmpDidRender) {
|
|
2058
|
+
if (BUILD12.isDev) {
|
|
1608
2059
|
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
1609
2060
|
}
|
|
1610
2061
|
safeCall(instance, "componentDidRender");
|
|
1611
|
-
if (
|
|
2062
|
+
if (BUILD12.isDev) {
|
|
1612
2063
|
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
1613
2064
|
}
|
|
1614
2065
|
}
|
|
1615
2066
|
emitLifecycleEvent(elm, "componentDidRender");
|
|
1616
2067
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1617
2068
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1618
|
-
if (
|
|
2069
|
+
if (BUILD12.asyncLoading && BUILD12.cssAnnotations) {
|
|
1619
2070
|
addHydratedFlag(elm);
|
|
1620
2071
|
}
|
|
1621
|
-
if (
|
|
1622
|
-
if (
|
|
2072
|
+
if (BUILD12.cmpDidLoad) {
|
|
2073
|
+
if (BUILD12.isDev) {
|
|
1623
2074
|
hostRef.$flags$ |= 2048 /* devOnDidLoad */;
|
|
1624
2075
|
}
|
|
1625
2076
|
safeCall(instance, "componentDidLoad");
|
|
1626
|
-
if (
|
|
2077
|
+
if (BUILD12.isDev) {
|
|
1627
2078
|
hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
|
|
1628
2079
|
}
|
|
1629
2080
|
}
|
|
1630
2081
|
emitLifecycleEvent(elm, "componentDidLoad");
|
|
1631
2082
|
endPostUpdate();
|
|
1632
|
-
if (
|
|
2083
|
+
if (BUILD12.asyncLoading) {
|
|
1633
2084
|
hostRef.$onReadyResolve$(elm);
|
|
1634
2085
|
if (!ancestorComponent) {
|
|
1635
2086
|
appDidLoad(tagName);
|
|
1636
2087
|
}
|
|
1637
2088
|
}
|
|
1638
2089
|
} else {
|
|
1639
|
-
if (
|
|
1640
|
-
if (
|
|
2090
|
+
if (BUILD12.cmpDidUpdate) {
|
|
2091
|
+
if (BUILD12.isDev) {
|
|
1641
2092
|
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
1642
2093
|
}
|
|
1643
2094
|
safeCall(instance, "componentDidUpdate");
|
|
1644
|
-
if (
|
|
2095
|
+
if (BUILD12.isDev) {
|
|
1645
2096
|
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
1646
2097
|
}
|
|
1647
2098
|
}
|
|
1648
2099
|
emitLifecycleEvent(elm, "componentDidUpdate");
|
|
1649
2100
|
endPostUpdate();
|
|
1650
2101
|
}
|
|
1651
|
-
if (
|
|
2102
|
+
if (BUILD12.method && BUILD12.lazyLoad) {
|
|
1652
2103
|
hostRef.$onInstanceResolve$(elm);
|
|
1653
2104
|
}
|
|
1654
|
-
if (
|
|
2105
|
+
if (BUILD12.asyncLoading) {
|
|
1655
2106
|
if (hostRef.$onRenderResolve$) {
|
|
1656
2107
|
hostRef.$onRenderResolve$();
|
|
1657
2108
|
hostRef.$onRenderResolve$ = void 0;
|
|
@@ -1663,7 +2114,7 @@ var postUpdateComponent = (hostRef) => {
|
|
|
1663
2114
|
}
|
|
1664
2115
|
};
|
|
1665
2116
|
var forceUpdate = (ref) => {
|
|
1666
|
-
if (
|
|
2117
|
+
if (BUILD12.updatable && (Build.isBrowser || Build.isTesting)) {
|
|
1667
2118
|
const hostRef = getHostRef(ref);
|
|
1668
2119
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1669
2120
|
if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
@@ -1674,14 +2125,14 @@ var forceUpdate = (ref) => {
|
|
|
1674
2125
|
return false;
|
|
1675
2126
|
};
|
|
1676
2127
|
var appDidLoad = (who) => {
|
|
1677
|
-
if (
|
|
2128
|
+
if (BUILD12.cssAnnotations) {
|
|
1678
2129
|
addHydratedFlag(doc.documentElement);
|
|
1679
2130
|
}
|
|
1680
|
-
if (
|
|
2131
|
+
if (BUILD12.asyncQueue) {
|
|
1681
2132
|
plt.$flags$ |= 2 /* appLoaded */;
|
|
1682
2133
|
}
|
|
1683
2134
|
nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
|
|
1684
|
-
if (
|
|
2135
|
+
if (BUILD12.profile && performance.measure) {
|
|
1685
2136
|
performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, "st:app:start");
|
|
1686
2137
|
}
|
|
1687
2138
|
};
|
|
@@ -1696,7 +2147,7 @@ var safeCall = (instance, method, arg) => {
|
|
|
1696
2147
|
return void 0;
|
|
1697
2148
|
};
|
|
1698
2149
|
var emitLifecycleEvent = (elm, lifecycleName) => {
|
|
1699
|
-
if (
|
|
2150
|
+
if (BUILD12.lifecycleDOMEvents) {
|
|
1700
2151
|
emitEvent(elm, "stencil_" + lifecycleName, {
|
|
1701
2152
|
bubbles: true,
|
|
1702
2153
|
composed: true,
|
|
@@ -1708,7 +2159,7 @@ var emitLifecycleEvent = (elm, lifecycleName) => {
|
|
|
1708
2159
|
};
|
|
1709
2160
|
var addHydratedFlag = (elm) => {
|
|
1710
2161
|
var _a, _b;
|
|
1711
|
-
return
|
|
2162
|
+
return BUILD12.hydratedClass ? elm.classList.add((_a = BUILD12.hydratedSelectorName) != null ? _a : "hydrated") : BUILD12.hydratedAttribute ? elm.setAttribute((_b = BUILD12.hydratedSelectorName) != null ? _b : "hydrated", "") : void 0;
|
|
1712
2163
|
};
|
|
1713
2164
|
var serverSideConnected = (elm) => {
|
|
1714
2165
|
const children = elm.children;
|
|
@@ -1727,21 +2178,21 @@ var serverSideConnected = (elm) => {
|
|
|
1727
2178
|
var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
1728
2179
|
var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1729
2180
|
const hostRef = getHostRef(ref);
|
|
1730
|
-
if (
|
|
2181
|
+
if (BUILD13.lazyLoad && !hostRef) {
|
|
1731
2182
|
throw new Error(
|
|
1732
2183
|
`Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`
|
|
1733
2184
|
);
|
|
1734
2185
|
}
|
|
1735
|
-
const elm =
|
|
2186
|
+
const elm = BUILD13.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
1736
2187
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
1737
2188
|
const flags = hostRef.$flags$;
|
|
1738
|
-
const instance =
|
|
2189
|
+
const instance = BUILD13.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
1739
2190
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
1740
2191
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
1741
2192
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
1742
|
-
if ((!
|
|
2193
|
+
if ((!BUILD13.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
|
|
1743
2194
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1744
|
-
if (
|
|
2195
|
+
if (BUILD13.isDev) {
|
|
1745
2196
|
if (hostRef.$flags$ & 1024 /* devOnRender */) {
|
|
1746
2197
|
consoleDevWarn(
|
|
1747
2198
|
`The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`,
|
|
@@ -1764,8 +2215,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1764
2215
|
);
|
|
1765
2216
|
}
|
|
1766
2217
|
}
|
|
1767
|
-
if (!
|
|
1768
|
-
if (
|
|
2218
|
+
if (!BUILD13.lazyLoad || instance) {
|
|
2219
|
+
if (BUILD13.watchCallback && cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1769
2220
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1770
2221
|
if (watchMethods) {
|
|
1771
2222
|
watchMethods.map((watchMethodName) => {
|
|
@@ -1777,8 +2228,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1777
2228
|
});
|
|
1778
2229
|
}
|
|
1779
2230
|
}
|
|
1780
|
-
if (
|
|
1781
|
-
if (
|
|
2231
|
+
if (BUILD13.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
2232
|
+
if (BUILD13.cmpShouldUpdate && instance.componentShouldUpdate) {
|
|
1782
2233
|
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
1783
2234
|
return;
|
|
1784
2235
|
}
|
|
@@ -1793,59 +2244,105 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1793
2244
|
var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1794
2245
|
var _a, _b;
|
|
1795
2246
|
const prototype = Cstr.prototype;
|
|
1796
|
-
if (
|
|
2247
|
+
if (BUILD14.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */ && flags & 1 /* isElementConstructor */) {
|
|
1797
2248
|
FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS.forEach((cbName) => {
|
|
1798
2249
|
const originalFormAssociatedCallback = prototype[cbName];
|
|
1799
2250
|
Object.defineProperty(prototype, cbName, {
|
|
1800
2251
|
value(...args) {
|
|
1801
2252
|
const hostRef = getHostRef(this);
|
|
1802
|
-
const instance =
|
|
2253
|
+
const instance = BUILD14.lazyLoad ? hostRef.$lazyInstance$ : this;
|
|
1803
2254
|
if (!instance) {
|
|
1804
2255
|
hostRef.$onReadyPromise$.then((asyncInstance) => {
|
|
1805
2256
|
const cb = asyncInstance[cbName];
|
|
1806
2257
|
typeof cb === "function" && cb.call(asyncInstance, ...args);
|
|
1807
2258
|
});
|
|
1808
2259
|
} else {
|
|
1809
|
-
const cb =
|
|
2260
|
+
const cb = BUILD14.lazyLoad ? instance[cbName] : originalFormAssociatedCallback;
|
|
1810
2261
|
typeof cb === "function" && cb.call(instance, ...args);
|
|
1811
2262
|
}
|
|
1812
2263
|
}
|
|
1813
2264
|
});
|
|
1814
2265
|
});
|
|
1815
2266
|
}
|
|
1816
|
-
if (
|
|
1817
|
-
if (
|
|
2267
|
+
if (BUILD14.member && cmpMeta.$members$ || BUILD14.watchCallback && (cmpMeta.$watchers$ || Cstr.watchers)) {
|
|
2268
|
+
if (BUILD14.watchCallback && Cstr.watchers && !cmpMeta.$watchers$) {
|
|
1818
2269
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1819
2270
|
}
|
|
1820
2271
|
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
|
|
1821
2272
|
members.map(([memberName, [memberFlags]]) => {
|
|
1822
|
-
if ((
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
2273
|
+
if ((BUILD14.prop || BUILD14.state) && (memberFlags & 31 /* Prop */ || (!BUILD14.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
|
|
2274
|
+
if ((memberFlags & 2048 /* Getter */) === 0) {
|
|
2275
|
+
Object.defineProperty(prototype, memberName, {
|
|
2276
|
+
get() {
|
|
2277
|
+
return getValue(this, memberName);
|
|
2278
|
+
},
|
|
2279
|
+
set(newValue) {
|
|
2280
|
+
if (BUILD14.isDev) {
|
|
2281
|
+
const ref = getHostRef(this);
|
|
2282
|
+
if (
|
|
2283
|
+
// we are proxying the instance (not element)
|
|
2284
|
+
(flags & 1 /* isElementConstructor */) === 0 && // the element is not constructing
|
|
2285
|
+
(ref && ref.$flags$ & 8 /* isConstructingInstance */) === 0 && // the member is a prop
|
|
2286
|
+
(memberFlags & 31 /* Prop */) !== 0 && // the member is not mutable
|
|
2287
|
+
(memberFlags & 1024 /* Mutable */) === 0
|
|
2288
|
+
) {
|
|
2289
|
+
consoleDevWarn(
|
|
2290
|
+
`@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.
|
|
1839
2291
|
More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
1840
|
-
|
|
2292
|
+
);
|
|
2293
|
+
}
|
|
1841
2294
|
}
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
})
|
|
1848
|
-
|
|
2295
|
+
setValue(this, memberName, newValue, cmpMeta);
|
|
2296
|
+
},
|
|
2297
|
+
configurable: true,
|
|
2298
|
+
enumerable: true
|
|
2299
|
+
});
|
|
2300
|
+
} else if (flags & 1 /* isElementConstructor */ && memberFlags & 2048 /* Getter */) {
|
|
2301
|
+
if (BUILD14.lazyLoad) {
|
|
2302
|
+
Object.defineProperty(prototype, memberName, {
|
|
2303
|
+
get() {
|
|
2304
|
+
const ref = getHostRef(this);
|
|
2305
|
+
const instance = BUILD14.lazyLoad && ref ? ref.$lazyInstance$ : prototype;
|
|
2306
|
+
if (!instance) return;
|
|
2307
|
+
return instance[memberName];
|
|
2308
|
+
},
|
|
2309
|
+
configurable: true,
|
|
2310
|
+
enumerable: true
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2313
|
+
if (memberFlags & 4096 /* Setter */) {
|
|
2314
|
+
const origSetter = Object.getOwnPropertyDescriptor(prototype, memberName).set;
|
|
2315
|
+
Object.defineProperty(prototype, memberName, {
|
|
2316
|
+
set(newValue) {
|
|
2317
|
+
const ref = getHostRef(this);
|
|
2318
|
+
if (origSetter) {
|
|
2319
|
+
const currentValue = ref.$hostElement$[memberName];
|
|
2320
|
+
if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
|
2321
|
+
ref.$instanceValues$.set(memberName, currentValue);
|
|
2322
|
+
}
|
|
2323
|
+
origSetter.apply(this, [parsePropertyValue(newValue, cmpMeta.$members$[memberName][0])]);
|
|
2324
|
+
setValue(this, memberName, ref.$hostElement$[memberName], cmpMeta);
|
|
2325
|
+
return;
|
|
2326
|
+
}
|
|
2327
|
+
if (!ref) return;
|
|
2328
|
+
const setterSetVal = () => {
|
|
2329
|
+
const currentValue = ref.$lazyInstance$[memberName];
|
|
2330
|
+
if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
|
2331
|
+
ref.$instanceValues$.set(memberName, currentValue);
|
|
2332
|
+
}
|
|
2333
|
+
ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, cmpMeta.$members$[memberName][0]);
|
|
2334
|
+
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
2335
|
+
};
|
|
2336
|
+
if (ref.$lazyInstance$) {
|
|
2337
|
+
setterSetVal();
|
|
2338
|
+
} else {
|
|
2339
|
+
ref.$onReadyPromise$.then(() => setterSetVal());
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
});
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2345
|
+
} else if (BUILD14.lazyLoad && BUILD14.method && flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
|
|
1849
2346
|
Object.defineProperty(prototype, memberName, {
|
|
1850
2347
|
value(...args) {
|
|
1851
2348
|
var _a2;
|
|
@@ -1858,7 +2355,7 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
1858
2355
|
});
|
|
1859
2356
|
}
|
|
1860
2357
|
});
|
|
1861
|
-
if (
|
|
2358
|
+
if (BUILD14.observeAttribute && (!BUILD14.lazyLoad || flags & 1 /* isElementConstructor */)) {
|
|
1862
2359
|
const attrNameToPropName = /* @__PURE__ */ new Map();
|
|
1863
2360
|
prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
|
|
1864
2361
|
plt.jmp(() => {
|
|
@@ -1874,8 +2371,8 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
1874
2371
|
const hostRef = getHostRef(this);
|
|
1875
2372
|
const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
|
|
1876
2373
|
if (flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
|
|
1877
|
-
const elm =
|
|
1878
|
-
const instance =
|
|
2374
|
+
const elm = BUILD14.lazyLoad ? hostRef.$hostElement$ : this;
|
|
2375
|
+
const instance = BUILD14.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
1879
2376
|
const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
|
|
1880
2377
|
entry == null ? void 0 : entry.forEach((callbackName) => {
|
|
1881
2378
|
if (instance[callbackName] != null) {
|
|
@@ -1885,7 +2382,10 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
1885
2382
|
}
|
|
1886
2383
|
return;
|
|
1887
2384
|
}
|
|
1888
|
-
|
|
2385
|
+
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
2386
|
+
if (!propDesc.get || !!propDesc.set) {
|
|
2387
|
+
this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
|
|
2388
|
+
}
|
|
1889
2389
|
});
|
|
1890
2390
|
};
|
|
1891
2391
|
Cstr.observedAttributes = Array.from(
|
|
@@ -1895,7 +2395,7 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
1895
2395
|
var _a2;
|
|
1896
2396
|
const attrName = m[1] || propName;
|
|
1897
2397
|
attrNameToPropName.set(attrName, propName);
|
|
1898
|
-
if (
|
|
2398
|
+
if (BUILD14.reflect && m[0] & 512 /* ReflectAttr */) {
|
|
1899
2399
|
(_a2 = cmpMeta.$attrsToReflect$) == null ? void 0 : _a2.push([propName, attrName]);
|
|
1900
2400
|
}
|
|
1901
2401
|
return attrName;
|
|
@@ -1913,7 +2413,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1913
2413
|
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1914
2414
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1915
2415
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
1916
|
-
if ((
|
|
2416
|
+
if ((BUILD15.lazyLoad || BUILD15.hydrateClientSide) && bundleId) {
|
|
1917
2417
|
const CstrImport = loadModule(cmpMeta, hostRef, hmrVersionId);
|
|
1918
2418
|
if (CstrImport && "then" in CstrImport) {
|
|
1919
2419
|
const endLoad = uniqueTime(
|
|
@@ -1928,15 +2428,15 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1928
2428
|
if (!Cstr) {
|
|
1929
2429
|
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
|
1930
2430
|
}
|
|
1931
|
-
if (
|
|
1932
|
-
if (
|
|
2431
|
+
if (BUILD15.member && !Cstr.isProxied) {
|
|
2432
|
+
if (BUILD15.watchCallback) {
|
|
1933
2433
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1934
2434
|
}
|
|
1935
2435
|
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1936
2436
|
Cstr.isProxied = true;
|
|
1937
2437
|
}
|
|
1938
2438
|
const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
|
|
1939
|
-
if (
|
|
2439
|
+
if (BUILD15.member) {
|
|
1940
2440
|
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1941
2441
|
}
|
|
1942
2442
|
try {
|
|
@@ -1944,10 +2444,10 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1944
2444
|
} catch (e) {
|
|
1945
2445
|
consoleError(e);
|
|
1946
2446
|
}
|
|
1947
|
-
if (
|
|
2447
|
+
if (BUILD15.member) {
|
|
1948
2448
|
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1949
2449
|
}
|
|
1950
|
-
if (
|
|
2450
|
+
if (BUILD15.watchCallback) {
|
|
1951
2451
|
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1952
2452
|
}
|
|
1953
2453
|
endNewInstance();
|
|
@@ -1957,24 +2457,24 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1957
2457
|
const cmpTag = elm.localName;
|
|
1958
2458
|
customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
|
|
1959
2459
|
}
|
|
1960
|
-
if (
|
|
2460
|
+
if (BUILD15.style && Cstr && Cstr.style) {
|
|
1961
2461
|
let style;
|
|
1962
2462
|
if (typeof Cstr.style === "string") {
|
|
1963
2463
|
style = Cstr.style;
|
|
1964
|
-
} else if (
|
|
2464
|
+
} else if (BUILD15.mode && typeof Cstr.style !== "string") {
|
|
1965
2465
|
hostRef.$modeName$ = computeMode(elm);
|
|
1966
2466
|
if (hostRef.$modeName$) {
|
|
1967
2467
|
style = Cstr.style[hostRef.$modeName$];
|
|
1968
2468
|
}
|
|
1969
|
-
if (
|
|
2469
|
+
if (BUILD15.hydrateServerSide && hostRef.$modeName$) {
|
|
1970
2470
|
elm.setAttribute("s-mode", hostRef.$modeName$);
|
|
1971
2471
|
}
|
|
1972
2472
|
}
|
|
1973
2473
|
const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
|
|
1974
2474
|
if (!styles.has(scopeId2)) {
|
|
1975
2475
|
const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
|
|
1976
|
-
if (!
|
|
1977
|
-
|
|
2476
|
+
if (!BUILD15.hydrateServerSide && BUILD15.shadowDom && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
|
2477
|
+
BUILD15.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
1978
2478
|
style = await import("../client/shadow-css.js").then((m) => m.scopeCss(style, scopeId2));
|
|
1979
2479
|
}
|
|
1980
2480
|
registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
@@ -1984,14 +2484,14 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1984
2484
|
}
|
|
1985
2485
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1986
2486
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
1987
|
-
if (
|
|
2487
|
+
if (BUILD15.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
|
|
1988
2488
|
ancestorComponent["s-rc"].push(schedule);
|
|
1989
2489
|
} else {
|
|
1990
2490
|
schedule();
|
|
1991
2491
|
}
|
|
1992
2492
|
};
|
|
1993
2493
|
var fireConnectedCallback = (instance) => {
|
|
1994
|
-
if (
|
|
2494
|
+
if (BUILD15.lazyLoad && BUILD15.connectedCallback) {
|
|
1995
2495
|
safeCall(instance, "connectedCallback");
|
|
1996
2496
|
}
|
|
1997
2497
|
};
|
|
@@ -2002,38 +2502,41 @@ var connectedCallback = (elm) => {
|
|
|
2002
2502
|
const hostRef = getHostRef(elm);
|
|
2003
2503
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
2004
2504
|
const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
|
|
2005
|
-
if (
|
|
2505
|
+
if (BUILD16.hostListenerTargetParent) {
|
|
2006
2506
|
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
|
|
2007
2507
|
}
|
|
2008
2508
|
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
2009
2509
|
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
2010
2510
|
let hostId;
|
|
2011
|
-
if (
|
|
2511
|
+
if (BUILD16.hydrateClientSide) {
|
|
2012
2512
|
hostId = elm.getAttribute(HYDRATE_ID);
|
|
2013
2513
|
if (hostId) {
|
|
2014
|
-
if (
|
|
2015
|
-
const scopeId2 =
|
|
2514
|
+
if (BUILD16.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2515
|
+
const scopeId2 = BUILD16.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(elm.shadowRoot, cmpMeta);
|
|
2016
2516
|
elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
|
|
2517
|
+
} else if (BUILD16.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
2518
|
+
const scopeId2 = getScopeId(cmpMeta, BUILD16.mode ? elm.getAttribute("s-mode") : void 0);
|
|
2519
|
+
elm["s-sc"] = scopeId2;
|
|
2017
2520
|
}
|
|
2018
2521
|
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
2019
2522
|
}
|
|
2020
2523
|
}
|
|
2021
|
-
if (
|
|
2022
|
-
if (
|
|
2524
|
+
if (BUILD16.slotRelocation && !hostId) {
|
|
2525
|
+
if (BUILD16.hydrateServerSide || (BUILD16.slot || BUILD16.shadowDom) && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
|
2023
2526
|
cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
|
|
2024
2527
|
setContentReference(elm);
|
|
2025
2528
|
}
|
|
2026
2529
|
}
|
|
2027
|
-
if (
|
|
2530
|
+
if (BUILD16.asyncLoading) {
|
|
2028
2531
|
let ancestorComponent = elm;
|
|
2029
2532
|
while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
|
|
2030
|
-
if (
|
|
2533
|
+
if (BUILD16.hydrateClientSide && ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
|
|
2031
2534
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
|
|
2032
2535
|
break;
|
|
2033
2536
|
}
|
|
2034
2537
|
}
|
|
2035
2538
|
}
|
|
2036
|
-
if (
|
|
2539
|
+
if (BUILD16.prop && !BUILD16.hydrateServerSide && cmpMeta.$members$) {
|
|
2037
2540
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
2038
2541
|
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
2039
2542
|
const value = elm[memberName];
|
|
@@ -2042,7 +2545,7 @@ var connectedCallback = (elm) => {
|
|
|
2042
2545
|
}
|
|
2043
2546
|
});
|
|
2044
2547
|
}
|
|
2045
|
-
if (
|
|
2548
|
+
if (BUILD16.initializeNextTick) {
|
|
2046
2549
|
nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
|
|
2047
2550
|
} else {
|
|
2048
2551
|
initializeComponent(elm, hostRef, cmpMeta);
|
|
@@ -2060,32 +2563,32 @@ var connectedCallback = (elm) => {
|
|
|
2060
2563
|
};
|
|
2061
2564
|
var setContentReference = (elm) => {
|
|
2062
2565
|
const contentRefElm = elm["s-cr"] = doc.createComment(
|
|
2063
|
-
|
|
2566
|
+
BUILD16.isDebug ? `content-ref (host=${elm.localName})` : ""
|
|
2064
2567
|
);
|
|
2065
2568
|
contentRefElm["s-cn"] = true;
|
|
2066
2569
|
insertBefore(elm, contentRefElm, elm.firstChild);
|
|
2067
2570
|
};
|
|
2068
2571
|
|
|
2069
2572
|
// src/runtime/disconnected-callback.ts
|
|
2070
|
-
import { BUILD as
|
|
2573
|
+
import { BUILD as BUILD17 } from "@stencil/core/internal/app-data";
|
|
2071
2574
|
var disconnectInstance = (instance) => {
|
|
2072
|
-
if (
|
|
2575
|
+
if (BUILD17.lazyLoad && BUILD17.disconnectedCallback) {
|
|
2073
2576
|
safeCall(instance, "disconnectedCallback");
|
|
2074
2577
|
}
|
|
2075
|
-
if (
|
|
2578
|
+
if (BUILD17.cmpDidUnload) {
|
|
2076
2579
|
safeCall(instance, "componentDidUnload");
|
|
2077
2580
|
}
|
|
2078
2581
|
};
|
|
2079
2582
|
var disconnectedCallback = async (elm) => {
|
|
2080
2583
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
2081
2584
|
const hostRef = getHostRef(elm);
|
|
2082
|
-
if (
|
|
2585
|
+
if (BUILD17.hostListener) {
|
|
2083
2586
|
if (hostRef.$rmListeners$) {
|
|
2084
2587
|
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
2085
2588
|
hostRef.$rmListeners$ = void 0;
|
|
2086
2589
|
}
|
|
2087
2590
|
}
|
|
2088
|
-
if (!
|
|
2591
|
+
if (!BUILD17.lazyLoad) {
|
|
2089
2592
|
disconnectInstance(elm);
|
|
2090
2593
|
} else if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
|
|
2091
2594
|
disconnectInstance(hostRef.$lazyInstance$);
|
|
@@ -2095,325 +2598,6 @@ var disconnectedCallback = async (elm) => {
|
|
|
2095
2598
|
}
|
|
2096
2599
|
};
|
|
2097
2600
|
|
|
2098
|
-
// src/runtime/dom-extras.ts
|
|
2099
|
-
import { BUILD as BUILD17 } from "@stencil/core/internal/app-data";
|
|
2100
|
-
var patchPseudoShadowDom = (hostElementPrototype, descriptorPrototype) => {
|
|
2101
|
-
patchCloneNode(hostElementPrototype);
|
|
2102
|
-
patchSlotAppendChild(hostElementPrototype);
|
|
2103
|
-
patchSlotAppend(hostElementPrototype);
|
|
2104
|
-
patchSlotPrepend(hostElementPrototype);
|
|
2105
|
-
patchSlotInsertAdjacentElement(hostElementPrototype);
|
|
2106
|
-
patchSlotInsertAdjacentHTML(hostElementPrototype);
|
|
2107
|
-
patchSlotInsertAdjacentText(hostElementPrototype);
|
|
2108
|
-
patchTextContent(hostElementPrototype);
|
|
2109
|
-
patchChildSlotNodes(hostElementPrototype, descriptorPrototype);
|
|
2110
|
-
patchSlotRemoveChild(hostElementPrototype);
|
|
2111
|
-
};
|
|
2112
|
-
var patchCloneNode = (HostElementPrototype) => {
|
|
2113
|
-
const orgCloneNode = HostElementPrototype.cloneNode;
|
|
2114
|
-
HostElementPrototype.cloneNode = function(deep) {
|
|
2115
|
-
const srcNode = this;
|
|
2116
|
-
const isShadowDom = BUILD17.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
|
|
2117
|
-
const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
|
|
2118
|
-
if (BUILD17.slot && !isShadowDom && deep) {
|
|
2119
|
-
let i2 = 0;
|
|
2120
|
-
let slotted, nonStencilNode;
|
|
2121
|
-
const stencilPrivates = [
|
|
2122
|
-
"s-id",
|
|
2123
|
-
"s-cr",
|
|
2124
|
-
"s-lr",
|
|
2125
|
-
"s-rc",
|
|
2126
|
-
"s-sc",
|
|
2127
|
-
"s-p",
|
|
2128
|
-
"s-cn",
|
|
2129
|
-
"s-sr",
|
|
2130
|
-
"s-sn",
|
|
2131
|
-
"s-hn",
|
|
2132
|
-
"s-ol",
|
|
2133
|
-
"s-nr",
|
|
2134
|
-
"s-si",
|
|
2135
|
-
"s-rf",
|
|
2136
|
-
"s-scs"
|
|
2137
|
-
];
|
|
2138
|
-
for (; i2 < srcNode.childNodes.length; i2++) {
|
|
2139
|
-
slotted = srcNode.childNodes[i2]["s-nr"];
|
|
2140
|
-
nonStencilNode = stencilPrivates.every((privateField) => !srcNode.childNodes[i2][privateField]);
|
|
2141
|
-
if (slotted) {
|
|
2142
|
-
if (BUILD17.appendChildSlotFix && clonedNode.__appendChild) {
|
|
2143
|
-
clonedNode.__appendChild(slotted.cloneNode(true));
|
|
2144
|
-
} else {
|
|
2145
|
-
clonedNode.appendChild(slotted.cloneNode(true));
|
|
2146
|
-
}
|
|
2147
|
-
}
|
|
2148
|
-
if (nonStencilNode) {
|
|
2149
|
-
clonedNode.appendChild(srcNode.childNodes[i2].cloneNode(true));
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
}
|
|
2153
|
-
return clonedNode;
|
|
2154
|
-
};
|
|
2155
|
-
};
|
|
2156
|
-
var patchSlotAppendChild = (HostElementPrototype) => {
|
|
2157
|
-
HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
|
|
2158
|
-
HostElementPrototype.appendChild = function(newChild) {
|
|
2159
|
-
const slotName = newChild["s-sn"] = getSlotName(newChild);
|
|
2160
|
-
const slotNode = getHostSlotNode(this.childNodes, slotName, this.tagName);
|
|
2161
|
-
if (slotNode) {
|
|
2162
|
-
const slotPlaceholder = document.createTextNode("");
|
|
2163
|
-
slotPlaceholder["s-nr"] = newChild;
|
|
2164
|
-
slotNode["s-cr"].parentNode.__appendChild(slotPlaceholder);
|
|
2165
|
-
newChild["s-ol"] = slotPlaceholder;
|
|
2166
|
-
newChild["s-sh"] = slotNode["s-hn"];
|
|
2167
|
-
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
|
2168
|
-
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
2169
|
-
const insertedNode = insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
|
|
2170
|
-
updateFallbackSlotVisibility(this);
|
|
2171
|
-
return insertedNode;
|
|
2172
|
-
}
|
|
2173
|
-
return this.__appendChild(newChild);
|
|
2174
|
-
};
|
|
2175
|
-
};
|
|
2176
|
-
var patchSlotRemoveChild = (ElementPrototype) => {
|
|
2177
|
-
ElementPrototype.__removeChild = ElementPrototype.removeChild;
|
|
2178
|
-
ElementPrototype.removeChild = function(toRemove) {
|
|
2179
|
-
if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
|
|
2180
|
-
const slotNode = getHostSlotNode(this.childNodes, toRemove["s-sn"], this.tagName);
|
|
2181
|
-
if (slotNode) {
|
|
2182
|
-
const slotChildNodes = getHostSlotChildNodes(slotNode, toRemove["s-sn"]);
|
|
2183
|
-
const existingNode = slotChildNodes.find((n) => n === toRemove);
|
|
2184
|
-
if (existingNode) {
|
|
2185
|
-
existingNode.remove();
|
|
2186
|
-
updateFallbackSlotVisibility(this);
|
|
2187
|
-
return;
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
}
|
|
2191
|
-
return this.__removeChild(toRemove);
|
|
2192
|
-
};
|
|
2193
|
-
};
|
|
2194
|
-
var patchSlotPrepend = (HostElementPrototype) => {
|
|
2195
|
-
const originalPrepend = HostElementPrototype.prepend;
|
|
2196
|
-
HostElementPrototype.prepend = function(...newChildren) {
|
|
2197
|
-
newChildren.forEach((newChild) => {
|
|
2198
|
-
if (typeof newChild === "string") {
|
|
2199
|
-
newChild = this.ownerDocument.createTextNode(newChild);
|
|
2200
|
-
}
|
|
2201
|
-
const slotName = newChild["s-sn"] = getSlotName(newChild);
|
|
2202
|
-
const slotNode = getHostSlotNode(this.childNodes, slotName, this.tagName);
|
|
2203
|
-
if (slotNode) {
|
|
2204
|
-
const slotPlaceholder = document.createTextNode("");
|
|
2205
|
-
slotPlaceholder["s-nr"] = newChild;
|
|
2206
|
-
slotNode["s-cr"].parentNode.__appendChild(slotPlaceholder);
|
|
2207
|
-
newChild["s-ol"] = slotPlaceholder;
|
|
2208
|
-
newChild["s-sh"] = slotNode["s-hn"];
|
|
2209
|
-
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
|
2210
|
-
const appendAfter = slotChildNodes[0];
|
|
2211
|
-
return insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
|
|
2212
|
-
}
|
|
2213
|
-
if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
|
|
2214
|
-
newChild.hidden = true;
|
|
2215
|
-
}
|
|
2216
|
-
return originalPrepend.call(this, newChild);
|
|
2217
|
-
});
|
|
2218
|
-
};
|
|
2219
|
-
};
|
|
2220
|
-
var patchSlotAppend = (HostElementPrototype) => {
|
|
2221
|
-
HostElementPrototype.append = function(...newChildren) {
|
|
2222
|
-
newChildren.forEach((newChild) => {
|
|
2223
|
-
if (typeof newChild === "string") {
|
|
2224
|
-
newChild = this.ownerDocument.createTextNode(newChild);
|
|
2225
|
-
}
|
|
2226
|
-
this.appendChild(newChild);
|
|
2227
|
-
});
|
|
2228
|
-
};
|
|
2229
|
-
};
|
|
2230
|
-
var patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
|
|
2231
|
-
const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
|
|
2232
|
-
HostElementPrototype.insertAdjacentHTML = function(position, text) {
|
|
2233
|
-
if (position !== "afterbegin" && position !== "beforeend") {
|
|
2234
|
-
return originalInsertAdjacentHtml.call(this, position, text);
|
|
2235
|
-
}
|
|
2236
|
-
const container = this.ownerDocument.createElement("_");
|
|
2237
|
-
let node;
|
|
2238
|
-
container.innerHTML = text;
|
|
2239
|
-
if (position === "afterbegin") {
|
|
2240
|
-
while (node = container.firstChild) {
|
|
2241
|
-
this.prepend(node);
|
|
2242
|
-
}
|
|
2243
|
-
} else if (position === "beforeend") {
|
|
2244
|
-
while (node = container.firstChild) {
|
|
2245
|
-
this.append(node);
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
};
|
|
2249
|
-
};
|
|
2250
|
-
var patchSlotInsertAdjacentText = (HostElementPrototype) => {
|
|
2251
|
-
HostElementPrototype.insertAdjacentText = function(position, text) {
|
|
2252
|
-
this.insertAdjacentHTML(position, text);
|
|
2253
|
-
};
|
|
2254
|
-
};
|
|
2255
|
-
var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
|
|
2256
|
-
const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
|
|
2257
|
-
HostElementPrototype.insertAdjacentElement = function(position, element) {
|
|
2258
|
-
if (position !== "afterbegin" && position !== "beforeend") {
|
|
2259
|
-
return originalInsertAdjacentElement.call(this, position, element);
|
|
2260
|
-
}
|
|
2261
|
-
if (position === "afterbegin") {
|
|
2262
|
-
this.prepend(element);
|
|
2263
|
-
return element;
|
|
2264
|
-
} else if (position === "beforeend") {
|
|
2265
|
-
this.append(element);
|
|
2266
|
-
return element;
|
|
2267
|
-
}
|
|
2268
|
-
return element;
|
|
2269
|
-
};
|
|
2270
|
-
};
|
|
2271
|
-
var patchTextContent = (hostElementPrototype) => {
|
|
2272
|
-
const descriptor = Object.getOwnPropertyDescriptor(Node.prototype, "textContent");
|
|
2273
|
-
Object.defineProperty(hostElementPrototype, "__textContent", descriptor);
|
|
2274
|
-
if (BUILD17.experimentalScopedSlotChanges) {
|
|
2275
|
-
Object.defineProperty(hostElementPrototype, "textContent", {
|
|
2276
|
-
// To mimic shadow root behavior, we need to return the text content of all
|
|
2277
|
-
// nodes in a slot reference node
|
|
2278
|
-
get() {
|
|
2279
|
-
const slotRefNodes = getAllChildSlotNodes(this.childNodes);
|
|
2280
|
-
const textContent = slotRefNodes.map((node) => {
|
|
2281
|
-
var _a, _b;
|
|
2282
|
-
const text = [];
|
|
2283
|
-
let slotContent = node.nextSibling;
|
|
2284
|
-
while (slotContent && slotContent["s-sn"] === node["s-sn"]) {
|
|
2285
|
-
if (slotContent.nodeType === 3 /* TEXT_NODE */ || slotContent.nodeType === 1 /* ELEMENT_NODE */) {
|
|
2286
|
-
text.push((_b = (_a = slotContent.textContent) == null ? void 0 : _a.trim()) != null ? _b : "");
|
|
2287
|
-
}
|
|
2288
|
-
slotContent = slotContent.nextSibling;
|
|
2289
|
-
}
|
|
2290
|
-
return text.filter((ref) => ref !== "").join(" ");
|
|
2291
|
-
}).filter((text) => text !== "").join(" ");
|
|
2292
|
-
return " " + textContent + " ";
|
|
2293
|
-
},
|
|
2294
|
-
// To mimic shadow root behavior, we need to overwrite all nodes in a slot
|
|
2295
|
-
// reference node. If a default slot reference node exists, the text content will be
|
|
2296
|
-
// placed there. Otherwise, the new text node will be hidden
|
|
2297
|
-
set(value) {
|
|
2298
|
-
const slotRefNodes = getAllChildSlotNodes(this.childNodes);
|
|
2299
|
-
slotRefNodes.forEach((node) => {
|
|
2300
|
-
let slotContent = node.nextSibling;
|
|
2301
|
-
while (slotContent && slotContent["s-sn"] === node["s-sn"]) {
|
|
2302
|
-
const tmp = slotContent;
|
|
2303
|
-
slotContent = slotContent.nextSibling;
|
|
2304
|
-
tmp.remove();
|
|
2305
|
-
}
|
|
2306
|
-
if (node["s-sn"] === "") {
|
|
2307
|
-
const textNode = this.ownerDocument.createTextNode(value);
|
|
2308
|
-
textNode["s-sn"] = "";
|
|
2309
|
-
insertBefore(node.parentElement, textNode, node.nextSibling);
|
|
2310
|
-
} else {
|
|
2311
|
-
node.remove();
|
|
2312
|
-
}
|
|
2313
|
-
});
|
|
2314
|
-
}
|
|
2315
|
-
});
|
|
2316
|
-
} else {
|
|
2317
|
-
Object.defineProperty(hostElementPrototype, "textContent", {
|
|
2318
|
-
get() {
|
|
2319
|
-
var _a;
|
|
2320
|
-
const slotNode = getHostSlotNode(this.childNodes, "", this.tagName);
|
|
2321
|
-
if (((_a = slotNode == null ? void 0 : slotNode.nextSibling) == null ? void 0 : _a.nodeType) === 3 /* TEXT_NODE */) {
|
|
2322
|
-
return slotNode.nextSibling.textContent;
|
|
2323
|
-
} else if (slotNode) {
|
|
2324
|
-
return slotNode.textContent;
|
|
2325
|
-
} else {
|
|
2326
|
-
return this.__textContent;
|
|
2327
|
-
}
|
|
2328
|
-
},
|
|
2329
|
-
set(value) {
|
|
2330
|
-
var _a;
|
|
2331
|
-
const slotNode = getHostSlotNode(this.childNodes, "", this.tagName);
|
|
2332
|
-
if (((_a = slotNode == null ? void 0 : slotNode.nextSibling) == null ? void 0 : _a.nodeType) === 3 /* TEXT_NODE */) {
|
|
2333
|
-
slotNode.nextSibling.textContent = value;
|
|
2334
|
-
} else if (slotNode) {
|
|
2335
|
-
slotNode.textContent = value;
|
|
2336
|
-
} else {
|
|
2337
|
-
this.__textContent = value;
|
|
2338
|
-
const contentRefElm = this["s-cr"];
|
|
2339
|
-
if (contentRefElm) {
|
|
2340
|
-
insertBefore(this, contentRefElm, this.firstChild);
|
|
2341
|
-
}
|
|
2342
|
-
}
|
|
2343
|
-
}
|
|
2344
|
-
});
|
|
2345
|
-
}
|
|
2346
|
-
};
|
|
2347
|
-
var patchChildSlotNodes = (elm, cmpMeta) => {
|
|
2348
|
-
class FakeNodeList extends Array {
|
|
2349
|
-
item(n) {
|
|
2350
|
-
return this[n];
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
2354
|
-
const childNodesFn = elm.__lookupGetter__("childNodes");
|
|
2355
|
-
Object.defineProperty(elm, "children", {
|
|
2356
|
-
get() {
|
|
2357
|
-
return this.childNodes.map((n) => n.nodeType === 1);
|
|
2358
|
-
}
|
|
2359
|
-
});
|
|
2360
|
-
Object.defineProperty(elm, "childElementCount", {
|
|
2361
|
-
get() {
|
|
2362
|
-
return elm.children.length;
|
|
2363
|
-
}
|
|
2364
|
-
});
|
|
2365
|
-
Object.defineProperty(elm, "childNodes", {
|
|
2366
|
-
get() {
|
|
2367
|
-
const childNodes = childNodesFn.call(this);
|
|
2368
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0 && getHostRef(this).$flags$ & 2 /* hasRendered */) {
|
|
2369
|
-
const result = new FakeNodeList();
|
|
2370
|
-
for (let i2 = 0; i2 < childNodes.length; i2++) {
|
|
2371
|
-
const slot = childNodes[i2]["s-nr"];
|
|
2372
|
-
if (slot) {
|
|
2373
|
-
result.push(slot);
|
|
2374
|
-
}
|
|
2375
|
-
}
|
|
2376
|
-
return result;
|
|
2377
|
-
}
|
|
2378
|
-
return FakeNodeList.from(childNodes);
|
|
2379
|
-
}
|
|
2380
|
-
});
|
|
2381
|
-
}
|
|
2382
|
-
};
|
|
2383
|
-
var getAllChildSlotNodes = (childNodes) => {
|
|
2384
|
-
const slotRefNodes = [];
|
|
2385
|
-
for (const childNode of Array.from(childNodes)) {
|
|
2386
|
-
if (childNode["s-sr"]) {
|
|
2387
|
-
slotRefNodes.push(childNode);
|
|
2388
|
-
}
|
|
2389
|
-
slotRefNodes.push(...getAllChildSlotNodes(childNode.childNodes));
|
|
2390
|
-
}
|
|
2391
|
-
return slotRefNodes;
|
|
2392
|
-
};
|
|
2393
|
-
var getSlotName = (node) => node["s-sn"] || node.nodeType === 1 && node.getAttribute("slot") || "";
|
|
2394
|
-
var getHostSlotNode = (childNodes, slotName, hostName) => {
|
|
2395
|
-
let i2 = 0;
|
|
2396
|
-
let childNode;
|
|
2397
|
-
for (; i2 < childNodes.length; i2++) {
|
|
2398
|
-
childNode = childNodes[i2];
|
|
2399
|
-
if (childNode["s-sr"] && childNode["s-sn"] === slotName && childNode["s-hn"] === hostName) {
|
|
2400
|
-
return childNode;
|
|
2401
|
-
}
|
|
2402
|
-
childNode = getHostSlotNode(childNode.childNodes, slotName, hostName);
|
|
2403
|
-
if (childNode) {
|
|
2404
|
-
return childNode;
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
return null;
|
|
2408
|
-
};
|
|
2409
|
-
var getHostSlotChildNodes = (n, slotName) => {
|
|
2410
|
-
const childNodes = [n];
|
|
2411
|
-
while ((n = n.nextSibling) && n["s-sn"] === slotName) {
|
|
2412
|
-
childNodes.push(n);
|
|
2413
|
-
}
|
|
2414
|
-
return childNodes;
|
|
2415
|
-
};
|
|
2416
|
-
|
|
2417
2601
|
// src/runtime/bootstrap-custom-element.ts
|
|
2418
2602
|
var defineCustomElement = (Cstr, compactMeta) => {
|
|
2419
2603
|
customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
|
|
@@ -2440,11 +2624,11 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
2440
2624
|
}
|
|
2441
2625
|
if (BUILD18.experimentalSlotFixes) {
|
|
2442
2626
|
if (BUILD18.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
2443
|
-
patchPseudoShadowDom(Cstr.prototype
|
|
2627
|
+
patchPseudoShadowDom(Cstr.prototype);
|
|
2444
2628
|
}
|
|
2445
2629
|
} else {
|
|
2446
2630
|
if (BUILD18.slotChildNodesFix) {
|
|
2447
|
-
patchChildSlotNodes(Cstr.prototype
|
|
2631
|
+
patchChildSlotNodes(Cstr.prototype);
|
|
2448
2632
|
}
|
|
2449
2633
|
if (BUILD18.cloneNodeFix) {
|
|
2450
2634
|
patchCloneNode(Cstr.prototype);
|
|
@@ -2458,16 +2642,16 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
2458
2642
|
}
|
|
2459
2643
|
const originalConnectedCallback = Cstr.prototype.connectedCallback;
|
|
2460
2644
|
const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
|
|
2461
|
-
let hasHostListenerAttached = false;
|
|
2462
2645
|
Object.assign(Cstr.prototype, {
|
|
2646
|
+
__hasHostListenerAttached: false,
|
|
2463
2647
|
__registerHost() {
|
|
2464
2648
|
registerHost(this, cmpMeta);
|
|
2465
2649
|
},
|
|
2466
2650
|
connectedCallback() {
|
|
2467
|
-
if (!
|
|
2651
|
+
if (!this.__hasHostListenerAttached) {
|
|
2468
2652
|
const hostRef = getHostRef(this);
|
|
2469
2653
|
addHostEventListeners(this, hostRef, cmpMeta.$listeners$, false);
|
|
2470
|
-
|
|
2654
|
+
this.__hasHostListenerAttached = true;
|
|
2471
2655
|
}
|
|
2472
2656
|
connectedCallback(this);
|
|
2473
2657
|
if (BUILD18.connectedCallback && originalConnectedCallback) {
|
|
@@ -2650,11 +2834,11 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2650
2834
|
};
|
|
2651
2835
|
if (BUILD19.experimentalSlotFixes) {
|
|
2652
2836
|
if (BUILD19.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
2653
|
-
patchPseudoShadowDom(HostElement.prototype
|
|
2837
|
+
patchPseudoShadowDom(HostElement.prototype);
|
|
2654
2838
|
}
|
|
2655
2839
|
} else {
|
|
2656
2840
|
if (BUILD19.slotChildNodesFix) {
|
|
2657
|
-
patchChildSlotNodes(HostElement.prototype
|
|
2841
|
+
patchChildSlotNodes(HostElement.prototype);
|
|
2658
2842
|
}
|
|
2659
2843
|
if (BUILD19.cloneNodeFix) {
|
|
2660
2844
|
patchCloneNode(HostElement.prototype);
|
|
@@ -2789,6 +2973,9 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
|
|
|
2789
2973
|
childId = `${hostId}.${nodeId}`;
|
|
2790
2974
|
if (nodeRef.nodeType === 1 /* ElementNode */) {
|
|
2791
2975
|
nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
2976
|
+
if (typeof nodeRef["s-sn"] === "string" && !nodeRef.getAttribute("slot")) {
|
|
2977
|
+
nodeRef.setAttribute("s-sn", nodeRef["s-sn"]);
|
|
2978
|
+
}
|
|
2792
2979
|
} else if (nodeRef.nodeType === 3 /* TextNode */) {
|
|
2793
2980
|
if (hostId === 0) {
|
|
2794
2981
|
const textContent = (_a = nodeRef.nodeValue) == null ? void 0 : _a.trim();
|
|
@@ -2800,6 +2987,10 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
|
|
|
2800
2987
|
const commentBeforeTextNode = doc2.createComment(childId);
|
|
2801
2988
|
commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
|
|
2802
2989
|
insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
|
|
2990
|
+
} else if (nodeRef.nodeType === 8 /* CommentNode */) {
|
|
2991
|
+
const commentBeforeTextNode = doc2.createComment(childId);
|
|
2992
|
+
commentBeforeTextNode.nodeValue = `${COMMENT_NODE_ID}.${childId}`;
|
|
2993
|
+
nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
|
|
2803
2994
|
}
|
|
2804
2995
|
}
|
|
2805
2996
|
let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
|
|
@@ -2880,6 +3071,9 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
|
|
|
2880
3071
|
childElm["s-node-id"] = nodeId;
|
|
2881
3072
|
if (childElm.nodeType === 1 /* ElementNode */) {
|
|
2882
3073
|
childElm.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
3074
|
+
if (typeof childElm["s-sn"] === "string" && !childElm.getAttribute("slot")) {
|
|
3075
|
+
childElm.setAttribute("s-sn", childElm["s-sn"]);
|
|
3076
|
+
}
|
|
2883
3077
|
} else if (childElm.nodeType === 3 /* TextNode */) {
|
|
2884
3078
|
const parentNode = childElm.parentNode;
|
|
2885
3079
|
const nodeName = parentNode == null ? void 0 : parentNode.nodeName;
|