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