@stencil/core 4.18.3-dev.1718859699.dac3e33 → 4.18.3-dev.1719000800.2790882
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 +53 -48
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +3 -3
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +2 -2
- package/dev-server/ws.js +1 -1
- package/internal/app-data/package.json +1 -1
- package/internal/client/index.js +515 -497
- package/internal/client/package.json +3 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +82 -33
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.d.ts +29 -11
- package/internal/hydrate/runner.js +235 -258
- package/internal/package.json +1 -1
- package/internal/stencil-private.d.ts +21 -11
- package/internal/stencil-public-compiler.d.ts +13 -0
- package/internal/stencil-public-runtime.d.ts +0 -1
- package/internal/testing/index.js +416 -393
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +133 -129
- package/mock-doc/index.d.ts +18 -4
- package/mock-doc/index.js +133 -129
- package/mock-doc/package.json +1 -1
- package/package.json +30 -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 +10 -10
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +64 -1
- package/testing/jest/jest-27-and-under/matchers/events.d.ts +4 -0
- package/testing/jest/jest-27-and-under/matchers/index.d.ts +2 -1
- package/testing/jest/jest-28/matchers/events.d.ts +4 -0
- package/testing/jest/jest-28/matchers/index.d.ts +2 -1
- package/testing/jest/jest-29/matchers/events.d.ts +4 -0
- package/testing/jest/jest-29/matchers/index.d.ts +2 -1
- package/testing/package.json +1 -1
|
@@ -113,6 +113,275 @@ var queuedLoadModules = [];
|
|
|
113
113
|
var caughtErrors = [];
|
|
114
114
|
var hostRefs = /* @__PURE__ */ new Map();
|
|
115
115
|
|
|
116
|
+
// src/testing/platform/testing-host-ref.ts
|
|
117
|
+
var getHostRef = (elm) => {
|
|
118
|
+
return hostRefs.get(elm);
|
|
119
|
+
};
|
|
120
|
+
var registerInstance = (lazyInstance, hostRef) => {
|
|
121
|
+
if (lazyInstance == null || lazyInstance.constructor == null) {
|
|
122
|
+
throw new Error(`Invalid component constructor`);
|
|
123
|
+
}
|
|
124
|
+
if (hostRef == null) {
|
|
125
|
+
const Cstr = lazyInstance.constructor;
|
|
126
|
+
const tagName = Cstr.COMPILER_META && Cstr.COMPILER_META.tagName ? Cstr.COMPILER_META.tagName : "div";
|
|
127
|
+
const elm = document.createElement(tagName);
|
|
128
|
+
registerHost(elm, { $flags$: 0, $tagName$: tagName });
|
|
129
|
+
hostRef = getHostRef(elm);
|
|
130
|
+
}
|
|
131
|
+
hostRef.$lazyInstance$ = lazyInstance;
|
|
132
|
+
return hostRefs.set(lazyInstance, hostRef);
|
|
133
|
+
};
|
|
134
|
+
var registerHost = (elm, cmpMeta) => {
|
|
135
|
+
const hostRef = {
|
|
136
|
+
$flags$: 0,
|
|
137
|
+
$hostElement$: elm,
|
|
138
|
+
$cmpMeta$: cmpMeta,
|
|
139
|
+
$instanceValues$: /* @__PURE__ */ new Map(),
|
|
140
|
+
$renderCount$: 0
|
|
141
|
+
};
|
|
142
|
+
hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
|
|
143
|
+
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
|
|
144
|
+
elm["s-p"] = [];
|
|
145
|
+
elm["s-rc"] = [];
|
|
146
|
+
hostRefs.set(elm, hostRef);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// src/testing/platform/testing-log.ts
|
|
150
|
+
var customError;
|
|
151
|
+
var defaultConsoleError = (e) => {
|
|
152
|
+
caughtErrors.push(e);
|
|
153
|
+
};
|
|
154
|
+
var consoleError = (e, el) => (customError || defaultConsoleError)(e, el);
|
|
155
|
+
var consoleDevError = (...e) => {
|
|
156
|
+
caughtErrors.push(new Error(e.join(", ")));
|
|
157
|
+
};
|
|
158
|
+
var consoleDevWarn = (...args) => {
|
|
159
|
+
const params = args.filter((a) => typeof a === "string" || typeof a === "number" || typeof a === "boolean");
|
|
160
|
+
console.warn(...params);
|
|
161
|
+
};
|
|
162
|
+
var consoleDevInfo = (..._) => {
|
|
163
|
+
};
|
|
164
|
+
var setErrorHandler = (handler) => customError = handler;
|
|
165
|
+
|
|
166
|
+
// src/testing/platform/testing-task-queue.ts
|
|
167
|
+
function resetTaskQueue() {
|
|
168
|
+
queuedTicks.length = 0;
|
|
169
|
+
queuedWriteTasks.length = 0;
|
|
170
|
+
queuedReadTasks.length = 0;
|
|
171
|
+
moduleLoaded.clear();
|
|
172
|
+
queuedLoadModules.length = 0;
|
|
173
|
+
caughtErrors.length = 0;
|
|
174
|
+
}
|
|
175
|
+
var nextTick = (cb) => {
|
|
176
|
+
queuedTicks.push(cb);
|
|
177
|
+
};
|
|
178
|
+
function flushTicks() {
|
|
179
|
+
return new Promise((resolve, reject) => {
|
|
180
|
+
function drain() {
|
|
181
|
+
try {
|
|
182
|
+
if (queuedTicks.length > 0) {
|
|
183
|
+
const writeTasks = queuedTicks.slice();
|
|
184
|
+
queuedTicks.length = 0;
|
|
185
|
+
let cb;
|
|
186
|
+
while (cb = writeTasks.shift()) {
|
|
187
|
+
cb(Date.now());
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (queuedTicks.length > 0) {
|
|
191
|
+
process.nextTick(drain);
|
|
192
|
+
} else {
|
|
193
|
+
resolve();
|
|
194
|
+
}
|
|
195
|
+
} catch (e) {
|
|
196
|
+
reject(`flushTicks: ${e}`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
process.nextTick(drain);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function writeTask(cb) {
|
|
203
|
+
queuedWriteTasks.push(cb);
|
|
204
|
+
}
|
|
205
|
+
function readTask(cb) {
|
|
206
|
+
queuedReadTasks.push(cb);
|
|
207
|
+
}
|
|
208
|
+
function flushQueue() {
|
|
209
|
+
return new Promise((resolve, reject) => {
|
|
210
|
+
async function drain() {
|
|
211
|
+
try {
|
|
212
|
+
if (queuedReadTasks.length > 0) {
|
|
213
|
+
const readTasks = queuedReadTasks.slice();
|
|
214
|
+
queuedReadTasks.length = 0;
|
|
215
|
+
let cb;
|
|
216
|
+
while (cb = readTasks.shift()) {
|
|
217
|
+
const result = cb(Date.now());
|
|
218
|
+
if (result != null && typeof result.then === "function") {
|
|
219
|
+
await result;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (queuedWriteTasks.length > 0) {
|
|
224
|
+
const writeTasks = queuedWriteTasks.slice();
|
|
225
|
+
queuedWriteTasks.length = 0;
|
|
226
|
+
let cb;
|
|
227
|
+
while (cb = writeTasks.shift()) {
|
|
228
|
+
const result = cb(Date.now());
|
|
229
|
+
if (result != null && typeof result.then === "function") {
|
|
230
|
+
await result;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (queuedReadTasks.length + queuedWriteTasks.length > 0) {
|
|
235
|
+
process.nextTick(drain);
|
|
236
|
+
} else {
|
|
237
|
+
resolve();
|
|
238
|
+
}
|
|
239
|
+
} catch (e) {
|
|
240
|
+
reject(`flushQueue: ${e}`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
process.nextTick(drain);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
async function flushAll() {
|
|
247
|
+
while (queuedTicks.length + queuedLoadModules.length + queuedWriteTasks.length + queuedReadTasks.length > 0) {
|
|
248
|
+
await flushTicks();
|
|
249
|
+
await flushLoadModule();
|
|
250
|
+
await flushQueue();
|
|
251
|
+
}
|
|
252
|
+
if (caughtErrors.length > 0) {
|
|
253
|
+
const err2 = caughtErrors[0];
|
|
254
|
+
if (err2 == null) {
|
|
255
|
+
throw new Error("Error!");
|
|
256
|
+
}
|
|
257
|
+
if (typeof err2 === "string") {
|
|
258
|
+
throw new Error(err2);
|
|
259
|
+
}
|
|
260
|
+
throw err2;
|
|
261
|
+
}
|
|
262
|
+
return new Promise((resolve) => process.nextTick(resolve));
|
|
263
|
+
}
|
|
264
|
+
function loadModule(cmpMeta, _hostRef, _hmrVersionId) {
|
|
265
|
+
return new Promise((resolve) => {
|
|
266
|
+
queuedLoadModules.push({
|
|
267
|
+
bundleId: cmpMeta.$lazyBundleId$,
|
|
268
|
+
resolve: () => resolve(moduleLoaded.get(cmpMeta.$lazyBundleId$))
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
function flushLoadModule(bundleId) {
|
|
273
|
+
return new Promise((resolve, reject) => {
|
|
274
|
+
try {
|
|
275
|
+
process.nextTick(() => {
|
|
276
|
+
if (bundleId != null) {
|
|
277
|
+
for (let i2 = 0; i2 < queuedLoadModules.length; i2++) {
|
|
278
|
+
if (queuedLoadModules[i2].bundleId === bundleId) {
|
|
279
|
+
queuedLoadModules[i2].resolve();
|
|
280
|
+
queuedLoadModules.splice(i2, 1);
|
|
281
|
+
i2--;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
} else {
|
|
285
|
+
let queuedLoadModule;
|
|
286
|
+
while (queuedLoadModule = queuedLoadModules.shift()) {
|
|
287
|
+
queuedLoadModule.resolve();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
resolve();
|
|
291
|
+
});
|
|
292
|
+
} catch (e) {
|
|
293
|
+
reject(`flushLoadModule: ${e}`);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// src/testing/platform/testing-window.ts
|
|
299
|
+
var import_mock_doc = require("../../mock-doc/index.cjs");
|
|
300
|
+
var win = (0, import_mock_doc.setupGlobal)(global);
|
|
301
|
+
var doc = win.document;
|
|
302
|
+
|
|
303
|
+
// src/testing/platform/testing-platform.ts
|
|
304
|
+
var supportsShadow = true;
|
|
305
|
+
var plt = {
|
|
306
|
+
$flags$: 0,
|
|
307
|
+
$resourcesUrl$: "",
|
|
308
|
+
jmp: (h2) => h2(),
|
|
309
|
+
raf: (h2) => requestAnimationFrame(h2),
|
|
310
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
311
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
312
|
+
ce: (eventName, opts) => new win.CustomEvent(eventName, opts)
|
|
313
|
+
};
|
|
314
|
+
var setPlatformHelpers = (helpers) => {
|
|
315
|
+
Object.assign(plt, helpers);
|
|
316
|
+
};
|
|
317
|
+
var supportsListenerOptions = true;
|
|
318
|
+
var supportsConstructableStylesheets = false;
|
|
319
|
+
var setSupportsShadowDom = (supports) => {
|
|
320
|
+
supportsShadow = supports;
|
|
321
|
+
};
|
|
322
|
+
function resetPlatform(defaults = {}) {
|
|
323
|
+
if (win && typeof win.close === "function") {
|
|
324
|
+
win.close();
|
|
325
|
+
}
|
|
326
|
+
hostRefs.clear();
|
|
327
|
+
styles.clear();
|
|
328
|
+
plt.$flags$ = 0;
|
|
329
|
+
Object.assign(plt, defaults);
|
|
330
|
+
if (plt.$orgLocNodes$ != null) {
|
|
331
|
+
plt.$orgLocNodes$.clear();
|
|
332
|
+
plt.$orgLocNodes$ = void 0;
|
|
333
|
+
}
|
|
334
|
+
win.location.href = plt.$resourcesUrl$ = `http://testing.stenciljs.com/`;
|
|
335
|
+
resetTaskQueue();
|
|
336
|
+
stopAutoApplyChanges();
|
|
337
|
+
cstrs.clear();
|
|
338
|
+
}
|
|
339
|
+
var isAutoApplyingChanges = false;
|
|
340
|
+
var autoApplyTimer = void 0;
|
|
341
|
+
function stopAutoApplyChanges() {
|
|
342
|
+
isAutoApplyingChanges = false;
|
|
343
|
+
if (autoApplyTimer) {
|
|
344
|
+
clearTimeout(autoApplyTimer);
|
|
345
|
+
autoApplyTimer = void 0;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
async function startAutoApplyChanges() {
|
|
349
|
+
isAutoApplyingChanges = true;
|
|
350
|
+
flushAll().then(() => {
|
|
351
|
+
if (isAutoApplyingChanges) {
|
|
352
|
+
autoApplyTimer = setTimeout(() => {
|
|
353
|
+
startAutoApplyChanges();
|
|
354
|
+
}, 100);
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
var registerComponents = (Cstrs) => {
|
|
359
|
+
Cstrs.filter((Cstr) => Cstr.COMPILER_META).forEach((Cstr) => {
|
|
360
|
+
cstrs.set(Cstr.COMPILER_META.tagName, Cstr);
|
|
361
|
+
});
|
|
362
|
+
};
|
|
363
|
+
function registerModule(bundleId, Cstr) {
|
|
364
|
+
moduleLoaded.set(bundleId, Cstr);
|
|
365
|
+
}
|
|
366
|
+
var isMemberInElement = (elm, memberName) => {
|
|
367
|
+
if (elm != null) {
|
|
368
|
+
if (memberName in elm) {
|
|
369
|
+
return true;
|
|
370
|
+
}
|
|
371
|
+
const nodeName = elm.nodeName;
|
|
372
|
+
if (nodeName) {
|
|
373
|
+
const cstr = cstrs.get(nodeName.toLowerCase());
|
|
374
|
+
if (cstr != null && cstr.COMPILER_META != null && cstr.COMPILER_META.properties != null) {
|
|
375
|
+
return cstr.COMPILER_META.properties.some((p) => p.name === memberName);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return false;
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
// src/testing/platform/index.ts
|
|
383
|
+
var import_app_data21 = require("@stencil/core/internal/app-data");
|
|
384
|
+
|
|
116
385
|
// src/runtime/asset-path.ts
|
|
117
386
|
var getAssetPath = (path) => {
|
|
118
387
|
const assetUrl = new URL(path, plt.$resourcesUrl$);
|
|
@@ -968,9 +1237,9 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
968
1237
|
}
|
|
969
1238
|
elm = newVNode2.$elm$ = import_app_data10.BUILD.svg ? doc.createElementNS(
|
|
970
1239
|
isSvgMode ? SVG_NS : HTML_NS,
|
|
971
|
-
import_app_data10.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
1240
|
+
!useNativeShadowDom && import_app_data10.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
972
1241
|
) : doc.createElement(
|
|
973
|
-
import_app_data10.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
1242
|
+
!useNativeShadowDom && import_app_data10.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
974
1243
|
);
|
|
975
1244
|
if (import_app_data10.BUILD.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
|
|
976
1245
|
isSvgMode = false;
|
|
@@ -2514,6 +2783,8 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
2514
2783
|
registerHost(this, cmpMeta);
|
|
2515
2784
|
},
|
|
2516
2785
|
connectedCallback() {
|
|
2786
|
+
const hostRef = getHostRef(this);
|
|
2787
|
+
addHostEventListeners(this, hostRef, cmpMeta.$listeners$, false);
|
|
2517
2788
|
connectedCallback(this);
|
|
2518
2789
|
if (import_app_data18.BUILD.connectedCallback && originalConnectedCallback) {
|
|
2519
2790
|
originalConnectedCallback.call(this);
|
|
@@ -2527,13 +2798,21 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
2527
2798
|
},
|
|
2528
2799
|
__attachShadow() {
|
|
2529
2800
|
if (supportsShadow) {
|
|
2530
|
-
if (
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2801
|
+
if (!this.shadowRoot) {
|
|
2802
|
+
if (import_app_data18.BUILD.shadowDelegatesFocus) {
|
|
2803
|
+
this.attachShadow({
|
|
2804
|
+
mode: "open",
|
|
2805
|
+
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
|
|
2806
|
+
});
|
|
2807
|
+
} else {
|
|
2808
|
+
this.attachShadow({ mode: "open" });
|
|
2809
|
+
}
|
|
2535
2810
|
} else {
|
|
2536
|
-
this.
|
|
2811
|
+
if (this.shadowRoot.mode !== "open") {
|
|
2812
|
+
throw new Error(
|
|
2813
|
+
`Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`
|
|
2814
|
+
);
|
|
2815
|
+
}
|
|
2537
2816
|
}
|
|
2538
2817
|
} else {
|
|
2539
2818
|
this.shadowRoot = this;
|
|
@@ -2643,17 +2922,26 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2643
2922
|
// StencilLazyHost
|
|
2644
2923
|
constructor(self) {
|
|
2645
2924
|
super(self);
|
|
2925
|
+
this.hasRegisteredEventListeners = false;
|
|
2646
2926
|
self = this;
|
|
2647
2927
|
registerHost(self, cmpMeta);
|
|
2648
2928
|
if (import_app_data19.BUILD.shadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2649
2929
|
if (supportsShadow) {
|
|
2650
|
-
if (
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2930
|
+
if (!self.shadowRoot) {
|
|
2931
|
+
if (import_app_data19.BUILD.shadowDelegatesFocus) {
|
|
2932
|
+
self.attachShadow({
|
|
2933
|
+
mode: "open",
|
|
2934
|
+
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
|
|
2935
|
+
});
|
|
2936
|
+
} else {
|
|
2937
|
+
self.attachShadow({ mode: "open" });
|
|
2938
|
+
}
|
|
2655
2939
|
} else {
|
|
2656
|
-
self.
|
|
2940
|
+
if (self.shadowRoot.mode !== "open") {
|
|
2941
|
+
throw new Error(
|
|
2942
|
+
`Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${self.shadowRoot.mode} but Stencil only supports open shadow roots.`
|
|
2943
|
+
);
|
|
2944
|
+
}
|
|
2657
2945
|
}
|
|
2658
2946
|
} else if (!import_app_data19.BUILD.hydrateServerSide && !("shadowRoot" in self)) {
|
|
2659
2947
|
self.shadowRoot = self;
|
|
@@ -2661,6 +2949,11 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2661
2949
|
}
|
|
2662
2950
|
}
|
|
2663
2951
|
connectedCallback() {
|
|
2952
|
+
const hostRef = getHostRef(this);
|
|
2953
|
+
if (!this.hasRegisteredEventListeners) {
|
|
2954
|
+
this.hasRegisteredEventListeners = true;
|
|
2955
|
+
addHostEventListeners(this, hostRef, cmpMeta.$listeners$, false);
|
|
2956
|
+
}
|
|
2664
2957
|
if (appLoadFallback) {
|
|
2665
2958
|
clearTimeout(appLoadFallback);
|
|
2666
2959
|
appLoadFallback = null;
|
|
@@ -2810,402 +3103,132 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
|
|
|
2810
3103
|
staticComponents: new Set(staticComponents)
|
|
2811
3104
|
};
|
|
2812
3105
|
const orgLocationNodes = [];
|
|
2813
|
-
parseVNodeAnnotations(doc2, doc2.body, docData, orgLocationNodes);
|
|
2814
|
-
orgLocationNodes.forEach((orgLocationNode) => {
|
|
2815
|
-
var _a;
|
|
2816
|
-
if (orgLocationNode != null && orgLocationNode["s-nr"]) {
|
|
2817
|
-
const nodeRef = orgLocationNode["s-nr"];
|
|
2818
|
-
let hostId = nodeRef["s-host-id"];
|
|
2819
|
-
let nodeId = nodeRef["s-node-id"];
|
|
2820
|
-
let childId = `${hostId}.${nodeId}`;
|
|
2821
|
-
if (hostId == null) {
|
|
2822
|
-
hostId = 0;
|
|
2823
|
-
docData.rootLevelIds++;
|
|
2824
|
-
nodeId = docData.rootLevelIds;
|
|
2825
|
-
childId = `${hostId}.${nodeId}`;
|
|
2826
|
-
if (nodeRef.nodeType === 1 /* ElementNode */) {
|
|
2827
|
-
nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
2828
|
-
} else if (nodeRef.nodeType === 3 /* TextNode */) {
|
|
2829
|
-
if (hostId === 0) {
|
|
2830
|
-
const textContent = (_a = nodeRef.nodeValue) == null ? void 0 : _a.trim();
|
|
2831
|
-
if (textContent === "") {
|
|
2832
|
-
orgLocationNode.remove();
|
|
2833
|
-
return;
|
|
2834
|
-
}
|
|
2835
|
-
}
|
|
2836
|
-
const commentBeforeTextNode = doc2.createComment(childId);
|
|
2837
|
-
commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
|
|
2838
|
-
insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
|
|
2839
|
-
}
|
|
2840
|
-
}
|
|
2841
|
-
let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
|
|
2842
|
-
const orgLocationParentNode = orgLocationNode.parentElement;
|
|
2843
|
-
if (orgLocationParentNode) {
|
|
2844
|
-
if (orgLocationParentNode["s-en"] === "") {
|
|
2845
|
-
orgLocationNodeId += `.`;
|
|
2846
|
-
} else if (orgLocationParentNode["s-en"] === "c") {
|
|
2847
|
-
orgLocationNodeId += `.c`;
|
|
2848
|
-
}
|
|
2849
|
-
}
|
|
2850
|
-
orgLocationNode.nodeValue = orgLocationNodeId;
|
|
2851
|
-
}
|
|
2852
|
-
});
|
|
2853
|
-
}
|
|
2854
|
-
};
|
|
2855
|
-
var parseVNodeAnnotations = (doc2, node, docData, orgLocationNodes) => {
|
|
2856
|
-
if (node == null) {
|
|
2857
|
-
return;
|
|
2858
|
-
}
|
|
2859
|
-
if (node["s-nr"] != null) {
|
|
2860
|
-
orgLocationNodes.push(node);
|
|
2861
|
-
}
|
|
2862
|
-
if (node.nodeType === 1 /* ElementNode */) {
|
|
2863
|
-
node.childNodes.forEach((childNode) => {
|
|
2864
|
-
const hostRef = getHostRef(childNode);
|
|
2865
|
-
if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
|
|
2866
|
-
const cmpData = {
|
|
2867
|
-
nodeIds: 0
|
|
2868
|
-
};
|
|
2869
|
-
insertVNodeAnnotations(doc2, childNode, hostRef.$vnode$, docData, cmpData);
|
|
2870
|
-
}
|
|
2871
|
-
parseVNodeAnnotations(doc2, childNode, docData, orgLocationNodes);
|
|
2872
|
-
});
|
|
2873
|
-
}
|
|
2874
|
-
};
|
|
2875
|
-
var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
|
|
2876
|
-
if (vnode != null) {
|
|
2877
|
-
const hostId = ++docData.hostIds;
|
|
2878
|
-
hostElm.setAttribute(HYDRATE_ID, hostId);
|
|
2879
|
-
if (hostElm["s-cr"] != null) {
|
|
2880
|
-
hostElm["s-cr"].nodeValue = `${CONTENT_REF_ID}.${hostId}`;
|
|
2881
|
-
}
|
|
2882
|
-
if (vnode.$children$ != null) {
|
|
2883
|
-
const depth = 0;
|
|
2884
|
-
vnode.$children$.forEach((vnodeChild, index) => {
|
|
2885
|
-
insertChildVNodeAnnotations(doc2, vnodeChild, cmpData, hostId, depth, index);
|
|
2886
|
-
});
|
|
2887
|
-
}
|
|
2888
|
-
if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute(HYDRATE_CHILD_ID)) {
|
|
2889
|
-
const parent = hostElm.parentElement;
|
|
2890
|
-
if (parent && parent.childNodes) {
|
|
2891
|
-
const parentChildNodes = Array.from(parent.childNodes);
|
|
2892
|
-
const comment = parentChildNodes.find(
|
|
2893
|
-
(node) => node.nodeType === 8 /* CommentNode */ && node["s-sr"]
|
|
2894
|
-
);
|
|
2895
|
-
if (comment) {
|
|
2896
|
-
const index = parentChildNodes.indexOf(hostElm) - 1;
|
|
2897
|
-
vnode.$elm$.setAttribute(
|
|
2898
|
-
HYDRATE_CHILD_ID,
|
|
2899
|
-
`${comment["s-host-id"]}.${comment["s-node-id"]}.0.${index}`
|
|
2900
|
-
);
|
|
2901
|
-
}
|
|
2902
|
-
}
|
|
2903
|
-
}
|
|
2904
|
-
}
|
|
2905
|
-
};
|
|
2906
|
-
var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, index) => {
|
|
2907
|
-
const childElm = vnodeChild.$elm$;
|
|
2908
|
-
if (childElm == null) {
|
|
2909
|
-
return;
|
|
2910
|
-
}
|
|
2911
|
-
const nodeId = cmpData.nodeIds++;
|
|
2912
|
-
const childId = `${hostId}.${nodeId}.${depth}.${index}`;
|
|
2913
|
-
childElm["s-host-id"] = hostId;
|
|
2914
|
-
childElm["s-node-id"] = nodeId;
|
|
2915
|
-
if (childElm.nodeType === 1 /* ElementNode */) {
|
|
2916
|
-
childElm.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
2917
|
-
} else if (childElm.nodeType === 3 /* TextNode */) {
|
|
2918
|
-
const parentNode = childElm.parentNode;
|
|
2919
|
-
const nodeName = parentNode == null ? void 0 : parentNode.nodeName;
|
|
2920
|
-
if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
|
|
2921
|
-
const textNodeId = `${TEXT_NODE_ID}.${childId}`;
|
|
2922
|
-
const commentBeforeTextNode = doc2.createComment(textNodeId);
|
|
2923
|
-
insertBefore(parentNode, commentBeforeTextNode, childElm);
|
|
2924
|
-
}
|
|
2925
|
-
} else if (childElm.nodeType === 8 /* CommentNode */) {
|
|
2926
|
-
if (childElm["s-sr"]) {
|
|
2927
|
-
const slotName = childElm["s-sn"] || "";
|
|
2928
|
-
const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`;
|
|
2929
|
-
childElm.nodeValue = slotNodeId;
|
|
2930
|
-
}
|
|
2931
|
-
}
|
|
2932
|
-
if (vnodeChild.$children$ != null) {
|
|
2933
|
-
const childDepth = depth + 1;
|
|
2934
|
-
vnodeChild.$children$.forEach((vnode, index2) => {
|
|
2935
|
-
insertChildVNodeAnnotations(doc2, vnode, cmpData, hostId, childDepth, index2);
|
|
2936
|
-
});
|
|
2937
|
-
}
|
|
2938
|
-
};
|
|
2939
|
-
|
|
2940
|
-
// src/testing/platform/testing-host-ref.ts
|
|
2941
|
-
var getHostRef = (elm) => {
|
|
2942
|
-
return hostRefs.get(elm);
|
|
2943
|
-
};
|
|
2944
|
-
var registerInstance = (lazyInstance, hostRef) => {
|
|
2945
|
-
if (lazyInstance == null || lazyInstance.constructor == null) {
|
|
2946
|
-
throw new Error(`Invalid component constructor`);
|
|
2947
|
-
}
|
|
2948
|
-
if (hostRef == null) {
|
|
2949
|
-
const Cstr = lazyInstance.constructor;
|
|
2950
|
-
const tagName = Cstr.COMPILER_META && Cstr.COMPILER_META.tagName ? Cstr.COMPILER_META.tagName : "div";
|
|
2951
|
-
const elm = document.createElement(tagName);
|
|
2952
|
-
registerHost(elm, { $flags$: 0, $tagName$: tagName });
|
|
2953
|
-
hostRef = getHostRef(elm);
|
|
2954
|
-
}
|
|
2955
|
-
hostRef.$lazyInstance$ = lazyInstance;
|
|
2956
|
-
return hostRefs.set(lazyInstance, hostRef);
|
|
2957
|
-
};
|
|
2958
|
-
var registerHost = (elm, cmpMeta) => {
|
|
2959
|
-
const hostRef = {
|
|
2960
|
-
$flags$: 0,
|
|
2961
|
-
$hostElement$: elm,
|
|
2962
|
-
$cmpMeta$: cmpMeta,
|
|
2963
|
-
$instanceValues$: /* @__PURE__ */ new Map(),
|
|
2964
|
-
$renderCount$: 0
|
|
2965
|
-
};
|
|
2966
|
-
hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
|
|
2967
|
-
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
|
|
2968
|
-
elm["s-p"] = [];
|
|
2969
|
-
elm["s-rc"] = [];
|
|
2970
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
|
|
2971
|
-
hostRefs.set(elm, hostRef);
|
|
2972
|
-
};
|
|
2973
|
-
|
|
2974
|
-
// src/testing/platform/testing-log.ts
|
|
2975
|
-
var customError;
|
|
2976
|
-
var defaultConsoleError = (e) => {
|
|
2977
|
-
caughtErrors.push(e);
|
|
2978
|
-
};
|
|
2979
|
-
var consoleError = (e, el) => (customError || defaultConsoleError)(e, el);
|
|
2980
|
-
var consoleDevError = (...e) => {
|
|
2981
|
-
caughtErrors.push(new Error(e.join(", ")));
|
|
2982
|
-
};
|
|
2983
|
-
var consoleDevWarn = (...args) => {
|
|
2984
|
-
const params = args.filter((a) => typeof a === "string" || typeof a === "number" || typeof a === "boolean");
|
|
2985
|
-
console.warn(...params);
|
|
2986
|
-
};
|
|
2987
|
-
var consoleDevInfo = (..._) => {
|
|
2988
|
-
};
|
|
2989
|
-
var setErrorHandler = (handler) => customError = handler;
|
|
2990
|
-
|
|
2991
|
-
// src/testing/platform/testing-task-queue.ts
|
|
2992
|
-
function resetTaskQueue() {
|
|
2993
|
-
queuedTicks.length = 0;
|
|
2994
|
-
queuedWriteTasks.length = 0;
|
|
2995
|
-
queuedReadTasks.length = 0;
|
|
2996
|
-
moduleLoaded.clear();
|
|
2997
|
-
queuedLoadModules.length = 0;
|
|
2998
|
-
caughtErrors.length = 0;
|
|
2999
|
-
}
|
|
3000
|
-
var nextTick = (cb) => {
|
|
3001
|
-
queuedTicks.push(cb);
|
|
3002
|
-
};
|
|
3003
|
-
function flushTicks() {
|
|
3004
|
-
return new Promise((resolve, reject) => {
|
|
3005
|
-
function drain() {
|
|
3006
|
-
try {
|
|
3007
|
-
if (queuedTicks.length > 0) {
|
|
3008
|
-
const writeTasks = queuedTicks.slice();
|
|
3009
|
-
queuedTicks.length = 0;
|
|
3010
|
-
let cb;
|
|
3011
|
-
while (cb = writeTasks.shift()) {
|
|
3012
|
-
cb(Date.now());
|
|
3013
|
-
}
|
|
3014
|
-
}
|
|
3015
|
-
if (queuedTicks.length > 0) {
|
|
3016
|
-
process.nextTick(drain);
|
|
3017
|
-
} else {
|
|
3018
|
-
resolve();
|
|
3019
|
-
}
|
|
3020
|
-
} catch (e) {
|
|
3021
|
-
reject(`flushTicks: ${e}`);
|
|
3022
|
-
}
|
|
3023
|
-
}
|
|
3024
|
-
process.nextTick(drain);
|
|
3025
|
-
});
|
|
3026
|
-
}
|
|
3027
|
-
function writeTask(cb) {
|
|
3028
|
-
queuedWriteTasks.push(cb);
|
|
3029
|
-
}
|
|
3030
|
-
function readTask(cb) {
|
|
3031
|
-
queuedReadTasks.push(cb);
|
|
3032
|
-
}
|
|
3033
|
-
function flushQueue() {
|
|
3034
|
-
return new Promise((resolve, reject) => {
|
|
3035
|
-
async function drain() {
|
|
3036
|
-
try {
|
|
3037
|
-
if (queuedReadTasks.length > 0) {
|
|
3038
|
-
const readTasks = queuedReadTasks.slice();
|
|
3039
|
-
queuedReadTasks.length = 0;
|
|
3040
|
-
let cb;
|
|
3041
|
-
while (cb = readTasks.shift()) {
|
|
3042
|
-
const result = cb(Date.now());
|
|
3043
|
-
if (result != null && typeof result.then === "function") {
|
|
3044
|
-
await result;
|
|
3106
|
+
parseVNodeAnnotations(doc2, doc2.body, docData, orgLocationNodes);
|
|
3107
|
+
orgLocationNodes.forEach((orgLocationNode) => {
|
|
3108
|
+
var _a;
|
|
3109
|
+
if (orgLocationNode != null && orgLocationNode["s-nr"]) {
|
|
3110
|
+
const nodeRef = orgLocationNode["s-nr"];
|
|
3111
|
+
let hostId = nodeRef["s-host-id"];
|
|
3112
|
+
let nodeId = nodeRef["s-node-id"];
|
|
3113
|
+
let childId = `${hostId}.${nodeId}`;
|
|
3114
|
+
if (hostId == null) {
|
|
3115
|
+
hostId = 0;
|
|
3116
|
+
docData.rootLevelIds++;
|
|
3117
|
+
nodeId = docData.rootLevelIds;
|
|
3118
|
+
childId = `${hostId}.${nodeId}`;
|
|
3119
|
+
if (nodeRef.nodeType === 1 /* ElementNode */) {
|
|
3120
|
+
nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
3121
|
+
} else if (nodeRef.nodeType === 3 /* TextNode */) {
|
|
3122
|
+
if (hostId === 0) {
|
|
3123
|
+
const textContent = (_a = nodeRef.nodeValue) == null ? void 0 : _a.trim();
|
|
3124
|
+
if (textContent === "") {
|
|
3125
|
+
orgLocationNode.remove();
|
|
3126
|
+
return;
|
|
3127
|
+
}
|
|
3045
3128
|
}
|
|
3129
|
+
const commentBeforeTextNode = doc2.createComment(childId);
|
|
3130
|
+
commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
|
|
3131
|
+
insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
|
|
3046
3132
|
}
|
|
3047
3133
|
}
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
await result;
|
|
3056
|
-
}
|
|
3134
|
+
let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
|
|
3135
|
+
const orgLocationParentNode = orgLocationNode.parentElement;
|
|
3136
|
+
if (orgLocationParentNode) {
|
|
3137
|
+
if (orgLocationParentNode["s-en"] === "") {
|
|
3138
|
+
orgLocationNodeId += `.`;
|
|
3139
|
+
} else if (orgLocationParentNode["s-en"] === "c") {
|
|
3140
|
+
orgLocationNodeId += `.c`;
|
|
3057
3141
|
}
|
|
3058
3142
|
}
|
|
3059
|
-
|
|
3060
|
-
process.nextTick(drain);
|
|
3061
|
-
} else {
|
|
3062
|
-
resolve();
|
|
3063
|
-
}
|
|
3064
|
-
} catch (e) {
|
|
3065
|
-
reject(`flushQueue: ${e}`);
|
|
3143
|
+
orgLocationNode.nodeValue = orgLocationNodeId;
|
|
3066
3144
|
}
|
|
3067
|
-
}
|
|
3068
|
-
process.nextTick(drain);
|
|
3069
|
-
});
|
|
3070
|
-
}
|
|
3071
|
-
async function flushAll() {
|
|
3072
|
-
while (queuedTicks.length + queuedLoadModules.length + queuedWriteTasks.length + queuedReadTasks.length > 0) {
|
|
3073
|
-
await flushTicks();
|
|
3074
|
-
await flushLoadModule();
|
|
3075
|
-
await flushQueue();
|
|
3076
|
-
}
|
|
3077
|
-
if (caughtErrors.length > 0) {
|
|
3078
|
-
const err2 = caughtErrors[0];
|
|
3079
|
-
if (err2 == null) {
|
|
3080
|
-
throw new Error("Error!");
|
|
3081
|
-
}
|
|
3082
|
-
if (typeof err2 === "string") {
|
|
3083
|
-
throw new Error(err2);
|
|
3084
|
-
}
|
|
3085
|
-
throw err2;
|
|
3086
|
-
}
|
|
3087
|
-
return new Promise((resolve) => process.nextTick(resolve));
|
|
3088
|
-
}
|
|
3089
|
-
function loadModule(cmpMeta, _hostRef, _hmrVersionId) {
|
|
3090
|
-
return new Promise((resolve) => {
|
|
3091
|
-
queuedLoadModules.push({
|
|
3092
|
-
bundleId: cmpMeta.$lazyBundleId$,
|
|
3093
|
-
resolve: () => resolve(moduleLoaded.get(cmpMeta.$lazyBundleId$))
|
|
3094
3145
|
});
|
|
3095
|
-
}
|
|
3096
|
-
}
|
|
3097
|
-
function flushLoadModule(bundleId) {
|
|
3098
|
-
return new Promise((resolve, reject) => {
|
|
3099
|
-
try {
|
|
3100
|
-
process.nextTick(() => {
|
|
3101
|
-
if (bundleId != null) {
|
|
3102
|
-
for (let i2 = 0; i2 < queuedLoadModules.length; i2++) {
|
|
3103
|
-
if (queuedLoadModules[i2].bundleId === bundleId) {
|
|
3104
|
-
queuedLoadModules[i2].resolve();
|
|
3105
|
-
queuedLoadModules.splice(i2, 1);
|
|
3106
|
-
i2--;
|
|
3107
|
-
}
|
|
3108
|
-
}
|
|
3109
|
-
} else {
|
|
3110
|
-
let queuedLoadModule;
|
|
3111
|
-
while (queuedLoadModule = queuedLoadModules.shift()) {
|
|
3112
|
-
queuedLoadModule.resolve();
|
|
3113
|
-
}
|
|
3114
|
-
}
|
|
3115
|
-
resolve();
|
|
3116
|
-
});
|
|
3117
|
-
} catch (e) {
|
|
3118
|
-
reject(`flushLoadModule: ${e}`);
|
|
3119
|
-
}
|
|
3120
|
-
});
|
|
3121
|
-
}
|
|
3122
|
-
|
|
3123
|
-
// src/testing/platform/testing-window.ts
|
|
3124
|
-
var import_mock_doc = require("../../mock-doc/index.cjs");
|
|
3125
|
-
var win = (0, import_mock_doc.setupGlobal)(global);
|
|
3126
|
-
var doc = win.document;
|
|
3127
|
-
|
|
3128
|
-
// src/testing/platform/testing-platform.ts
|
|
3129
|
-
var supportsShadow = true;
|
|
3130
|
-
var plt = {
|
|
3131
|
-
$flags$: 0,
|
|
3132
|
-
$resourcesUrl$: "",
|
|
3133
|
-
jmp: (h2) => h2(),
|
|
3134
|
-
raf: (h2) => requestAnimationFrame(h2),
|
|
3135
|
-
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
3136
|
-
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
3137
|
-
ce: (eventName, opts) => new win.CustomEvent(eventName, opts)
|
|
3138
|
-
};
|
|
3139
|
-
var setPlatformHelpers = (helpers) => {
|
|
3140
|
-
Object.assign(plt, helpers);
|
|
3141
|
-
};
|
|
3142
|
-
var supportsListenerOptions = true;
|
|
3143
|
-
var supportsConstructableStylesheets = false;
|
|
3144
|
-
var setSupportsShadowDom = (supports) => {
|
|
3145
|
-
supportsShadow = supports;
|
|
3146
|
+
}
|
|
3146
3147
|
};
|
|
3147
|
-
|
|
3148
|
-
if (
|
|
3149
|
-
|
|
3148
|
+
var parseVNodeAnnotations = (doc2, node, docData, orgLocationNodes) => {
|
|
3149
|
+
if (node == null) {
|
|
3150
|
+
return;
|
|
3150
3151
|
}
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
plt.$flags$ = 0;
|
|
3154
|
-
Object.assign(plt, defaults);
|
|
3155
|
-
if (plt.$orgLocNodes$ != null) {
|
|
3156
|
-
plt.$orgLocNodes$.clear();
|
|
3157
|
-
plt.$orgLocNodes$ = void 0;
|
|
3152
|
+
if (node["s-nr"] != null) {
|
|
3153
|
+
orgLocationNodes.push(node);
|
|
3158
3154
|
}
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
autoApplyTimer = void 0;
|
|
3155
|
+
if (node.nodeType === 1 /* ElementNode */) {
|
|
3156
|
+
node.childNodes.forEach((childNode) => {
|
|
3157
|
+
const hostRef = getHostRef(childNode);
|
|
3158
|
+
if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
|
|
3159
|
+
const cmpData = {
|
|
3160
|
+
nodeIds: 0
|
|
3161
|
+
};
|
|
3162
|
+
insertVNodeAnnotations(doc2, childNode, hostRef.$vnode$, docData, cmpData);
|
|
3163
|
+
}
|
|
3164
|
+
parseVNodeAnnotations(doc2, childNode, docData, orgLocationNodes);
|
|
3165
|
+
});
|
|
3171
3166
|
}
|
|
3172
|
-
}
|
|
3173
|
-
async function startAutoApplyChanges() {
|
|
3174
|
-
isAutoApplyingChanges = true;
|
|
3175
|
-
flushAll().then(() => {
|
|
3176
|
-
if (isAutoApplyingChanges) {
|
|
3177
|
-
autoApplyTimer = setTimeout(() => {
|
|
3178
|
-
startAutoApplyChanges();
|
|
3179
|
-
}, 100);
|
|
3180
|
-
}
|
|
3181
|
-
});
|
|
3182
|
-
}
|
|
3183
|
-
var registerComponents = (Cstrs) => {
|
|
3184
|
-
Cstrs.filter((Cstr) => Cstr.COMPILER_META).forEach((Cstr) => {
|
|
3185
|
-
cstrs.set(Cstr.COMPILER_META.tagName, Cstr);
|
|
3186
|
-
});
|
|
3187
3167
|
};
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
return true;
|
|
3168
|
+
var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
|
|
3169
|
+
if (vnode != null) {
|
|
3170
|
+
const hostId = ++docData.hostIds;
|
|
3171
|
+
hostElm.setAttribute(HYDRATE_ID, hostId);
|
|
3172
|
+
if (hostElm["s-cr"] != null) {
|
|
3173
|
+
hostElm["s-cr"].nodeValue = `${CONTENT_REF_ID}.${hostId}`;
|
|
3195
3174
|
}
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3175
|
+
if (vnode.$children$ != null) {
|
|
3176
|
+
const depth = 0;
|
|
3177
|
+
vnode.$children$.forEach((vnodeChild, index) => {
|
|
3178
|
+
insertChildVNodeAnnotations(doc2, vnodeChild, cmpData, hostId, depth, index);
|
|
3179
|
+
});
|
|
3180
|
+
}
|
|
3181
|
+
if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute(HYDRATE_CHILD_ID)) {
|
|
3182
|
+
const parent = hostElm.parentElement;
|
|
3183
|
+
if (parent && parent.childNodes) {
|
|
3184
|
+
const parentChildNodes = Array.from(parent.childNodes);
|
|
3185
|
+
const comment = parentChildNodes.find(
|
|
3186
|
+
(node) => node.nodeType === 8 /* CommentNode */ && node["s-sr"]
|
|
3187
|
+
);
|
|
3188
|
+
if (comment) {
|
|
3189
|
+
const index = parentChildNodes.indexOf(hostElm) - 1;
|
|
3190
|
+
vnode.$elm$.setAttribute(
|
|
3191
|
+
HYDRATE_CHILD_ID,
|
|
3192
|
+
`${comment["s-host-id"]}.${comment["s-node-id"]}.0.${index}`
|
|
3193
|
+
);
|
|
3194
|
+
}
|
|
3201
3195
|
}
|
|
3202
3196
|
}
|
|
3203
3197
|
}
|
|
3204
|
-
return false;
|
|
3205
3198
|
};
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3199
|
+
var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, index) => {
|
|
3200
|
+
const childElm = vnodeChild.$elm$;
|
|
3201
|
+
if (childElm == null) {
|
|
3202
|
+
return;
|
|
3203
|
+
}
|
|
3204
|
+
const nodeId = cmpData.nodeIds++;
|
|
3205
|
+
const childId = `${hostId}.${nodeId}.${depth}.${index}`;
|
|
3206
|
+
childElm["s-host-id"] = hostId;
|
|
3207
|
+
childElm["s-node-id"] = nodeId;
|
|
3208
|
+
if (childElm.nodeType === 1 /* ElementNode */) {
|
|
3209
|
+
childElm.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
3210
|
+
} else if (childElm.nodeType === 3 /* TextNode */) {
|
|
3211
|
+
const parentNode = childElm.parentNode;
|
|
3212
|
+
const nodeName = parentNode == null ? void 0 : parentNode.nodeName;
|
|
3213
|
+
if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
|
|
3214
|
+
const textNodeId = `${TEXT_NODE_ID}.${childId}`;
|
|
3215
|
+
const commentBeforeTextNode = doc2.createComment(textNodeId);
|
|
3216
|
+
insertBefore(parentNode, commentBeforeTextNode, childElm);
|
|
3217
|
+
}
|
|
3218
|
+
} else if (childElm.nodeType === 8 /* CommentNode */) {
|
|
3219
|
+
if (childElm["s-sr"]) {
|
|
3220
|
+
const slotName = childElm["s-sn"] || "";
|
|
3221
|
+
const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`;
|
|
3222
|
+
childElm.nodeValue = slotNodeId;
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
if (vnodeChild.$children$ != null) {
|
|
3226
|
+
const childDepth = depth + 1;
|
|
3227
|
+
vnodeChild.$children$.forEach((vnode, index2) => {
|
|
3228
|
+
insertChildVNodeAnnotations(doc2, vnode, cmpData, hostId, childDepth, index2);
|
|
3229
|
+
});
|
|
3230
|
+
}
|
|
3231
|
+
};
|
|
3209
3232
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3210
3233
|
0 && (module.exports = {
|
|
3211
3234
|
Build,
|