@rindo/core 4.26.0 → 4.27.1
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 +4 -4
- package/cli/index.js +1 -1
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +1518 -1472
- 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 +4 -4
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +4 -4
- package/internal/app-data/index.cjs +3 -14
- package/internal/app-data/index.js +0 -11
- package/internal/app-data/package.json +1 -1
- package/internal/client/index.js +304 -263
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +3 -3
- package/internal/hydrate/index.js +308 -266
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +110 -111
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +6 -13
- package/internal/testing/index.js +299 -266
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +231 -231
- package/mock-doc/index.js +228 -228
- package/mock-doc/package.json +1 -1
- package/package.json +2 -2
- package/screenshot/index.js +4 -4
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +3 -3
- package/sys/node/index.js +9 -9
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +9 -16
- 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.27.1 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -51,11 +51,15 @@ var reWireGetterSetter = (instance, hostRef) => {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
// src/client/client-host-ref.ts
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
var getHostRef = (ref) => {
|
|
55
|
+
if (ref.__rindo__getHostRef) {
|
|
56
|
+
return ref.__rindo__getHostRef();
|
|
57
|
+
}
|
|
58
|
+
return void 0;
|
|
59
|
+
};
|
|
57
60
|
var registerInstance = (lazyInstance, hostRef) => {
|
|
58
|
-
|
|
61
|
+
lazyInstance.__rindo__getHostRef = () => hostRef;
|
|
62
|
+
hostRef.$lazyInstance$ = lazyInstance;
|
|
59
63
|
if (BUILD3.modernPropertyDecls && (BUILD3.state || BUILD3.prop)) {
|
|
60
64
|
reWireGetterSetter(lazyInstance, hostRef);
|
|
61
65
|
}
|
|
@@ -78,7 +82,8 @@ var registerHost = (hostElement, cmpMeta) => {
|
|
|
78
82
|
hostElement["s-p"] = [];
|
|
79
83
|
hostElement["s-rc"] = [];
|
|
80
84
|
}
|
|
81
|
-
const ref =
|
|
85
|
+
const ref = hostRef;
|
|
86
|
+
hostElement.__rindo__getHostRef = () => ref;
|
|
82
87
|
if (!BUILD3.lazyLoad && BUILD3.modernPropertyDecls && (BUILD3.state || BUILD3.prop)) {
|
|
83
88
|
reWireGetterSetter(hostElement, hostRef);
|
|
84
89
|
}
|
|
@@ -175,7 +180,6 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
|
|
175
180
|
// src/client/client-window.ts
|
|
176
181
|
import { BUILD as BUILD6 } from "@rindo/core/internal/app-data";
|
|
177
182
|
var win = typeof window !== "undefined" ? window : {};
|
|
178
|
-
var doc = win.document || { head: {} };
|
|
179
183
|
var H = win.HTMLElement || class {
|
|
180
184
|
};
|
|
181
185
|
var plt = {
|
|
@@ -192,9 +196,10 @@ var setPlatformHelpers = (helpers) => {
|
|
|
192
196
|
};
|
|
193
197
|
var supportsShadow = BUILD6.shadowDom;
|
|
194
198
|
var supportsListenerOptions = /* @__PURE__ */ (() => {
|
|
199
|
+
var _a;
|
|
195
200
|
let supportsListenerOptions2 = false;
|
|
196
201
|
try {
|
|
197
|
-
|
|
202
|
+
(_a = win.document) == null ? void 0 : _a.addEventListener(
|
|
198
203
|
"e",
|
|
199
204
|
null,
|
|
200
205
|
Object.defineProperty({}, "passive", {
|
|
@@ -310,9 +315,9 @@ var isComplexType = (o) => {
|
|
|
310
315
|
};
|
|
311
316
|
|
|
312
317
|
// src/utils/query-nonce-meta-tag-content.ts
|
|
313
|
-
function queryNonceMetaTagContent(
|
|
318
|
+
function queryNonceMetaTagContent(doc) {
|
|
314
319
|
var _a, _b, _c;
|
|
315
|
-
return (_c = (_b = (_a =
|
|
320
|
+
return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
|
|
316
321
|
}
|
|
317
322
|
|
|
318
323
|
// src/utils/regular-expression.ts
|
|
@@ -381,12 +386,11 @@ import { BUILD as BUILD9 } from "@rindo/core/internal/app-data";
|
|
|
381
386
|
// src/runtime/slot-polyfill-utils.ts
|
|
382
387
|
import { BUILD as BUILD8 } from "@rindo/core/internal/app-data";
|
|
383
388
|
var updateFallbackSlotVisibility = (elm) => {
|
|
384
|
-
const childNodes = elm
|
|
389
|
+
const childNodes = internalCall(elm, "childNodes");
|
|
385
390
|
if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
|
|
386
391
|
getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
|
|
387
|
-
var _a;
|
|
388
392
|
if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
|
|
389
|
-
if ((
|
|
393
|
+
if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
|
|
390
394
|
slotNode.hidden = true;
|
|
391
395
|
} else {
|
|
392
396
|
slotNode.hidden = false;
|
|
@@ -394,8 +398,10 @@ var updateFallbackSlotVisibility = (elm) => {
|
|
|
394
398
|
}
|
|
395
399
|
});
|
|
396
400
|
}
|
|
397
|
-
|
|
398
|
-
|
|
401
|
+
let i2 = 0;
|
|
402
|
+
for (i2 = 0; i2 < childNodes.length; i2++) {
|
|
403
|
+
const childNode = childNodes[i2];
|
|
404
|
+
if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
|
|
399
405
|
updateFallbackSlotVisibility(childNode);
|
|
400
406
|
}
|
|
401
407
|
}
|
|
@@ -416,7 +422,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
416
422
|
let childNode;
|
|
417
423
|
for (; i2 < childNodes.length; i2++) {
|
|
418
424
|
childNode = childNodes[i2];
|
|
419
|
-
if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode
|
|
425
|
+
if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
|
|
420
426
|
slottedNodes.push(childNode);
|
|
421
427
|
if (typeof slotName !== "undefined") return slottedNodes;
|
|
422
428
|
}
|
|
@@ -424,11 +430,12 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
424
430
|
}
|
|
425
431
|
return slottedNodes;
|
|
426
432
|
}
|
|
427
|
-
var
|
|
433
|
+
var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
|
|
428
434
|
const childNodes = [];
|
|
429
|
-
if (includeSlot &&
|
|
430
|
-
|
|
431
|
-
|
|
435
|
+
if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
|
|
436
|
+
let node = slot;
|
|
437
|
+
while (node = node.nextSibling) {
|
|
438
|
+
if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
|
|
432
439
|
}
|
|
433
440
|
return childNodes;
|
|
434
441
|
};
|
|
@@ -448,38 +455,73 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
|
|
|
448
455
|
return slotName === "";
|
|
449
456
|
};
|
|
450
457
|
var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
|
|
451
|
-
let slottedNodeLocation;
|
|
452
458
|
if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
|
|
453
|
-
|
|
454
|
-
} else {
|
|
455
|
-
slottedNodeLocation = document.createTextNode("");
|
|
456
|
-
slottedNodeLocation["s-nr"] = newChild;
|
|
459
|
+
return;
|
|
457
460
|
}
|
|
461
|
+
const slottedNodeLocation = document.createTextNode("");
|
|
462
|
+
slottedNodeLocation["s-nr"] = newChild;
|
|
458
463
|
if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
|
|
459
464
|
const parent = slotNode["s-cr"].parentNode;
|
|
460
|
-
const appendMethod = prepend ? parent
|
|
461
|
-
if (typeof position !== "undefined") {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
|
|
475
|
-
}
|
|
465
|
+
const appendMethod = prepend ? internalCall(parent, "prepend") : internalCall(parent, "appendChild");
|
|
466
|
+
if (BUILD8.hydrateClientSide && typeof position !== "undefined") {
|
|
467
|
+
slottedNodeLocation["s-oo"] = position;
|
|
468
|
+
const childNodes = internalCall(parent, "childNodes");
|
|
469
|
+
const slotRelocateNodes = [slottedNodeLocation];
|
|
470
|
+
childNodes.forEach((n) => {
|
|
471
|
+
if (n["s-nr"]) slotRelocateNodes.push(n);
|
|
472
|
+
});
|
|
473
|
+
slotRelocateNodes.sort((a, b) => {
|
|
474
|
+
if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
|
|
475
|
+
else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
|
|
476
|
+
return 0;
|
|
477
|
+
});
|
|
478
|
+
slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
|
|
476
479
|
} else {
|
|
477
480
|
appendMethod.call(parent, slottedNodeLocation);
|
|
478
481
|
}
|
|
479
482
|
newChild["s-ol"] = slottedNodeLocation;
|
|
480
483
|
newChild["s-sh"] = slotNode["s-hn"];
|
|
481
484
|
};
|
|
482
|
-
var getSlotName = (node) => node["s-sn"]
|
|
485
|
+
var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
|
|
486
|
+
function patchSlotNode(node) {
|
|
487
|
+
if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
|
|
488
|
+
const assignedFactory = (elementsOnly) => (function(opts) {
|
|
489
|
+
const toReturn = [];
|
|
490
|
+
const slotName = this["s-sn"];
|
|
491
|
+
if (opts == null ? void 0 : opts.flatten) {
|
|
492
|
+
console.error(`
|
|
493
|
+
Flattening is not supported for Rindo non-shadow slots.
|
|
494
|
+
You can use \`.childNodes\` to nested slot fallback content.
|
|
495
|
+
If you have a particular use case, please open an issue on the Rindo repo.
|
|
496
|
+
`);
|
|
497
|
+
}
|
|
498
|
+
const parent = this["s-cr"].parentElement;
|
|
499
|
+
const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
|
|
500
|
+
slottedNodes.forEach((n) => {
|
|
501
|
+
if (slotName === getSlotName(n)) {
|
|
502
|
+
toReturn.push(n);
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
if (elementsOnly) {
|
|
506
|
+
return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
|
|
507
|
+
}
|
|
508
|
+
return toReturn;
|
|
509
|
+
}).bind(node);
|
|
510
|
+
node.assignedElements = assignedFactory(true);
|
|
511
|
+
node.assignedNodes = assignedFactory(false);
|
|
512
|
+
}
|
|
513
|
+
function dispatchSlotChangeEvent(elm) {
|
|
514
|
+
elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
|
|
515
|
+
}
|
|
516
|
+
function findSlotFromSlottedNode(slottedNode, parentHost) {
|
|
517
|
+
var _a;
|
|
518
|
+
parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
|
|
519
|
+
if (!parentHost) return { slotNode: null, slotName: "" };
|
|
520
|
+
const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
|
|
521
|
+
const childNodes = internalCall(parentHost, "childNodes");
|
|
522
|
+
const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
|
|
523
|
+
return { slotNode, slotName };
|
|
524
|
+
}
|
|
483
525
|
|
|
484
526
|
// src/runtime/dom-extras.ts
|
|
485
527
|
var patchPseudoShadowDom = (hostElementPrototype) => {
|
|
@@ -543,19 +585,14 @@ var patchCloneNode = (HostElementPrototype) => {
|
|
|
543
585
|
var patchSlotAppendChild = (HostElementPrototype) => {
|
|
544
586
|
HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
|
|
545
587
|
HostElementPrototype.appendChild = function(newChild) {
|
|
546
|
-
const slotName
|
|
547
|
-
const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
|
|
588
|
+
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
548
589
|
if (slotNode) {
|
|
549
590
|
addSlotRelocateNode(newChild, slotNode);
|
|
550
|
-
const slotChildNodes =
|
|
591
|
+
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
551
592
|
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
552
|
-
const parent =
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
insertedNode = parent.__insertBefore(newChild, appendAfter.nextSibling);
|
|
556
|
-
} else {
|
|
557
|
-
insertedNode = parent.insertBefore(newChild, appendAfter.nextSibling);
|
|
558
|
-
}
|
|
593
|
+
const parent = internalCall(appendAfter, "parentNode");
|
|
594
|
+
const insertedNode = internalCall(parent, "insertBefore")(newChild, appendAfter.nextSibling);
|
|
595
|
+
dispatchSlotChangeEvent(slotNode);
|
|
559
596
|
updateFallbackSlotVisibility(this);
|
|
560
597
|
return insertedNode;
|
|
561
598
|
}
|
|
@@ -584,19 +621,17 @@ var patchSlotPrepend = (HostElementPrototype) => {
|
|
|
584
621
|
if (typeof newChild === "string") {
|
|
585
622
|
newChild = this.ownerDocument.createTextNode(newChild);
|
|
586
623
|
}
|
|
587
|
-
const slotName = newChild["s-sn"] = getSlotName(newChild);
|
|
588
|
-
const childNodes = this
|
|
624
|
+
const slotName = (newChild["s-sn"] = getSlotName(newChild)) || "";
|
|
625
|
+
const childNodes = internalCall(this, "childNodes");
|
|
589
626
|
const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
|
|
590
627
|
if (slotNode) {
|
|
591
628
|
addSlotRelocateNode(newChild, slotNode, true);
|
|
592
|
-
const slotChildNodes =
|
|
629
|
+
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
593
630
|
const appendAfter = slotChildNodes[0];
|
|
594
|
-
const parent =
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
return parent.insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
|
|
599
|
-
}
|
|
631
|
+
const parent = internalCall(appendAfter, "parentNode");
|
|
632
|
+
const toReturn = internalCall(parent, "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
|
|
633
|
+
dispatchSlotChangeEvent(slotNode);
|
|
634
|
+
return toReturn;
|
|
600
635
|
}
|
|
601
636
|
if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
|
|
602
637
|
newChild.hidden = true;
|
|
@@ -646,8 +681,7 @@ var patchInsertBefore = (HostElementPrototype) => {
|
|
|
646
681
|
if (eleProto.__insertBefore) return;
|
|
647
682
|
eleProto.__insertBefore = HostElementPrototype.insertBefore;
|
|
648
683
|
HostElementPrototype.insertBefore = function(newChild, currentChild) {
|
|
649
|
-
const slotName
|
|
650
|
-
const slotNode = getHostSlotNodes(this.__childNodes, this.tagName, slotName)[0];
|
|
684
|
+
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
651
685
|
const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
|
|
652
686
|
if (slotNode) {
|
|
653
687
|
let found = false;
|
|
@@ -660,18 +694,19 @@ var patchInsertBefore = (HostElementPrototype) => {
|
|
|
660
694
|
}
|
|
661
695
|
if (slotName === currentChild["s-sn"]) {
|
|
662
696
|
addSlotRelocateNode(newChild, slotNode);
|
|
663
|
-
const parent =
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
} else {
|
|
667
|
-
parent.insertBefore(newChild, currentChild);
|
|
668
|
-
}
|
|
697
|
+
const parent = internalCall(currentChild, "parentNode");
|
|
698
|
+
internalCall(parent, "insertBefore")(newChild, currentChild);
|
|
699
|
+
dispatchSlotChangeEvent(slotNode);
|
|
669
700
|
}
|
|
670
701
|
return;
|
|
671
702
|
}
|
|
672
703
|
});
|
|
673
704
|
if (found) return newChild;
|
|
674
705
|
}
|
|
706
|
+
const parentNode = currentChild == null ? void 0 : currentChild.__parentNode;
|
|
707
|
+
if (parentNode && !this.isSameNode(parentNode)) {
|
|
708
|
+
return this.appendChild(newChild);
|
|
709
|
+
}
|
|
675
710
|
return this.__insertBefore(newChild, currentChild);
|
|
676
711
|
};
|
|
677
712
|
};
|
|
@@ -749,7 +784,7 @@ var patchChildSlotNodes = (elm) => {
|
|
|
749
784
|
});
|
|
750
785
|
};
|
|
751
786
|
var patchSlottedNode = (node) => {
|
|
752
|
-
if (!node || node.__nextSibling || !globalThis.Node) return;
|
|
787
|
+
if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
|
|
753
788
|
patchNextSibling(node);
|
|
754
789
|
patchPreviousSibling(node);
|
|
755
790
|
patchParentNode(node);
|
|
@@ -853,11 +888,14 @@ function patchHostOriginalAccessor(accessorName, node) {
|
|
|
853
888
|
}
|
|
854
889
|
if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
|
|
855
890
|
}
|
|
856
|
-
function
|
|
891
|
+
function internalCall(node, method) {
|
|
857
892
|
if ("__" + method in node) {
|
|
858
|
-
|
|
893
|
+
const toReturn = node["__" + method];
|
|
894
|
+
if (typeof toReturn !== "function") return toReturn;
|
|
895
|
+
return toReturn.bind(node);
|
|
859
896
|
} else {
|
|
860
|
-
return node[method];
|
|
897
|
+
if (typeof node[method] !== "function") return node[method];
|
|
898
|
+
return node[method].bind(node);
|
|
861
899
|
}
|
|
862
900
|
}
|
|
863
901
|
|
|
@@ -1107,8 +1145,8 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1107
1145
|
delete hostElm["s-sc"];
|
|
1108
1146
|
}
|
|
1109
1147
|
}
|
|
1110
|
-
if (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size) {
|
|
1111
|
-
initializeDocumentHydrate(
|
|
1148
|
+
if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
|
|
1149
|
+
initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
|
|
1112
1150
|
}
|
|
1113
1151
|
hostElm[HYDRATE_ID] = hostId;
|
|
1114
1152
|
hostElm.removeAttribute(HYDRATE_ID);
|
|
@@ -1434,8 +1472,8 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
|
|
|
1434
1472
|
childVNode.$name$ = slotName || null;
|
|
1435
1473
|
childVNode.$tag$ = "slot";
|
|
1436
1474
|
const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
|
|
1437
|
-
if (BUILD12.shadowDom && shadowRootNodes) {
|
|
1438
|
-
const slot = childVNode.$elm$ =
|
|
1475
|
+
if (BUILD12.shadowDom && shadowRootNodes && win.document) {
|
|
1476
|
+
const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
|
|
1439
1477
|
if (childVNode.$name$) {
|
|
1440
1478
|
childVNode.$elm$.setAttribute("name", slotName);
|
|
1441
1479
|
}
|
|
@@ -1453,6 +1491,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
|
|
|
1453
1491
|
const slot = childVNode.$elm$;
|
|
1454
1492
|
const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
|
|
1455
1493
|
addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
|
|
1494
|
+
patchSlotNode(node);
|
|
1456
1495
|
if (shouldMove) {
|
|
1457
1496
|
parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
|
|
1458
1497
|
}
|
|
@@ -1917,10 +1956,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1917
1956
|
var _a;
|
|
1918
1957
|
const scopeId2 = getScopeId(cmpMeta, mode);
|
|
1919
1958
|
const style = styles.get(scopeId2);
|
|
1920
|
-
if (!BUILD16.attachStyles) {
|
|
1959
|
+
if (!BUILD16.attachStyles || !win.document) {
|
|
1921
1960
|
return scopeId2;
|
|
1922
1961
|
}
|
|
1923
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode :
|
|
1962
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
|
|
1924
1963
|
if (style) {
|
|
1925
1964
|
if (typeof style === "string") {
|
|
1926
1965
|
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
@@ -1933,9 +1972,9 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1933
1972
|
if (BUILD16.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
|
|
1934
1973
|
styleElm.innerHTML = style;
|
|
1935
1974
|
} else {
|
|
1936
|
-
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) ||
|
|
1975
|
+
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
|
|
1937
1976
|
styleElm.innerHTML = style;
|
|
1938
|
-
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(
|
|
1977
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
1939
1978
|
if (nonce != null) {
|
|
1940
1979
|
styleElm.setAttribute("nonce", nonce);
|
|
1941
1980
|
}
|
|
@@ -2003,7 +2042,10 @@ var attachStyles = (hostRef) => {
|
|
|
2003
2042
|
var getScopeId = (cmp, mode) => "sc-" + (BUILD16.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
|
|
2004
2043
|
var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
|
|
2005
2044
|
var hydrateScopedToShadow = () => {
|
|
2006
|
-
|
|
2045
|
+
if (!win.document) {
|
|
2046
|
+
return;
|
|
2047
|
+
}
|
|
2048
|
+
const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
|
2007
2049
|
let i2 = 0;
|
|
2008
2050
|
for (; i2 < styles2.length; i2++) {
|
|
2009
2051
|
registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
|
|
@@ -2019,112 +2061,113 @@ import { BUILD as BUILD18 } from "@rindo/core/internal/app-data";
|
|
|
2019
2061
|
// src/runtime/vdom/set-accessor.ts
|
|
2020
2062
|
import { BUILD as BUILD17 } from "@rindo/core/internal/app-data";
|
|
2021
2063
|
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
2022
|
-
if (oldValue
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
} else {
|
|
2047
|
-
elm.style[prop] = "";
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
}
|
|
2052
|
-
for (const prop in newValue) {
|
|
2053
|
-
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
2064
|
+
if (oldValue === newValue) {
|
|
2065
|
+
return;
|
|
2066
|
+
}
|
|
2067
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
2068
|
+
let ln = memberName.toLowerCase();
|
|
2069
|
+
if (BUILD17.vdomClass && memberName === "class") {
|
|
2070
|
+
const classList = elm.classList;
|
|
2071
|
+
const oldClasses = parseClassList(oldValue);
|
|
2072
|
+
let newClasses = parseClassList(newValue);
|
|
2073
|
+
if (BUILD17.hydrateClientSide && elm["s-si"] && initialRender) {
|
|
2074
|
+
newClasses.push(elm["s-si"]);
|
|
2075
|
+
oldClasses.forEach((c) => {
|
|
2076
|
+
if (c.startsWith(elm["s-si"])) newClasses.push(c);
|
|
2077
|
+
});
|
|
2078
|
+
newClasses = [...new Set(newClasses)];
|
|
2079
|
+
classList.add(...newClasses);
|
|
2080
|
+
} else {
|
|
2081
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
2082
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
2083
|
+
}
|
|
2084
|
+
} else if (BUILD17.vdomStyle && memberName === "style") {
|
|
2085
|
+
if (BUILD17.updatable) {
|
|
2086
|
+
for (const prop in oldValue) {
|
|
2087
|
+
if (!newValue || newValue[prop] == null) {
|
|
2054
2088
|
if (!BUILD17.hydrateServerSide && prop.includes("-")) {
|
|
2055
|
-
elm.style.
|
|
2089
|
+
elm.style.removeProperty(prop);
|
|
2056
2090
|
} else {
|
|
2057
|
-
elm.style[prop] =
|
|
2091
|
+
elm.style[prop] = "";
|
|
2058
2092
|
}
|
|
2059
2093
|
}
|
|
2060
2094
|
}
|
|
2061
|
-
}
|
|
2062
|
-
|
|
2095
|
+
}
|
|
2096
|
+
for (const prop in newValue) {
|
|
2097
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
2098
|
+
if (!BUILD17.hydrateServerSide && prop.includes("-")) {
|
|
2099
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
2100
|
+
} else {
|
|
2101
|
+
elm.style[prop] = newValue[prop];
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
} else if (BUILD17.vdomKey && memberName === "key") {
|
|
2106
|
+
} else if (BUILD17.vdomRef && memberName === "ref") {
|
|
2107
|
+
if (newValue) {
|
|
2108
|
+
newValue(elm);
|
|
2109
|
+
}
|
|
2110
|
+
} else if (BUILD17.vdomListener && (BUILD17.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
|
|
2111
|
+
if (memberName[2] === "-") {
|
|
2112
|
+
memberName = memberName.slice(3);
|
|
2113
|
+
} else if (isMemberInElement(win, ln)) {
|
|
2114
|
+
memberName = ln.slice(2);
|
|
2115
|
+
} else {
|
|
2116
|
+
memberName = ln[2] + memberName.slice(3);
|
|
2117
|
+
}
|
|
2118
|
+
if (oldValue || newValue) {
|
|
2119
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
2120
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
2121
|
+
if (oldValue) {
|
|
2122
|
+
plt.rel(elm, memberName, oldValue, capture);
|
|
2123
|
+
}
|
|
2063
2124
|
if (newValue) {
|
|
2064
|
-
|
|
2125
|
+
plt.ael(elm, memberName, newValue, capture);
|
|
2065
2126
|
}
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
if (newValue) {
|
|
2081
|
-
plt.ael(elm, memberName, newValue, capture);
|
|
2082
|
-
}
|
|
2083
|
-
}
|
|
2084
|
-
} else if (BUILD17.vdomPropOrAttr) {
|
|
2085
|
-
const isComplex = isComplexType(newValue);
|
|
2086
|
-
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
2087
|
-
try {
|
|
2088
|
-
if (!elm.tagName.includes("-")) {
|
|
2089
|
-
const n = newValue == null ? "" : newValue;
|
|
2090
|
-
if (memberName === "list") {
|
|
2091
|
-
isProp = false;
|
|
2092
|
-
} else if (oldValue == null || elm[memberName] != n) {
|
|
2093
|
-
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
2094
|
-
elm[memberName] = n;
|
|
2095
|
-
} else {
|
|
2096
|
-
elm.setAttribute(memberName, n);
|
|
2097
|
-
}
|
|
2127
|
+
}
|
|
2128
|
+
} else if (BUILD17.vdomPropOrAttr) {
|
|
2129
|
+
const isComplex = isComplexType(newValue);
|
|
2130
|
+
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
2131
|
+
try {
|
|
2132
|
+
if (!elm.tagName.includes("-")) {
|
|
2133
|
+
const n = newValue == null ? "" : newValue;
|
|
2134
|
+
if (memberName === "list") {
|
|
2135
|
+
isProp = false;
|
|
2136
|
+
} else if (oldValue == null || elm[memberName] != n) {
|
|
2137
|
+
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
2138
|
+
elm[memberName] = n;
|
|
2139
|
+
} else {
|
|
2140
|
+
elm.setAttribute(memberName, n);
|
|
2098
2141
|
}
|
|
2099
|
-
} else if (elm[memberName] !== newValue) {
|
|
2100
|
-
elm[memberName] = newValue;
|
|
2101
2142
|
}
|
|
2102
|
-
}
|
|
2143
|
+
} else if (elm[memberName] !== newValue) {
|
|
2144
|
+
elm[memberName] = newValue;
|
|
2103
2145
|
}
|
|
2146
|
+
} catch (e) {
|
|
2104
2147
|
}
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2148
|
+
}
|
|
2149
|
+
let xlink = false;
|
|
2150
|
+
if (BUILD17.vdomXlink) {
|
|
2151
|
+
if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
|
|
2152
|
+
memberName = ln;
|
|
2153
|
+
xlink = true;
|
|
2111
2154
|
}
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
2116
|
-
} else {
|
|
2117
|
-
elm.removeAttribute(memberName);
|
|
2118
|
-
}
|
|
2119
|
-
}
|
|
2120
|
-
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
2121
|
-
newValue = newValue === true ? "" : newValue;
|
|
2155
|
+
}
|
|
2156
|
+
if (newValue == null || newValue === false) {
|
|
2157
|
+
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
|
2122
2158
|
if (BUILD17.vdomXlink && xlink) {
|
|
2123
|
-
elm.
|
|
2159
|
+
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
2124
2160
|
} else {
|
|
2125
|
-
elm.
|
|
2161
|
+
elm.removeAttribute(memberName);
|
|
2126
2162
|
}
|
|
2127
2163
|
}
|
|
2164
|
+
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
|
|
2165
|
+
newValue = newValue === true ? "" : newValue;
|
|
2166
|
+
if (BUILD17.vdomXlink && xlink) {
|
|
2167
|
+
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
2168
|
+
} else {
|
|
2169
|
+
elm.setAttribute(memberName, newValue);
|
|
2170
|
+
}
|
|
2128
2171
|
}
|
|
2129
2172
|
}
|
|
2130
2173
|
};
|
|
@@ -2219,17 +2262,25 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2219
2262
|
);
|
|
2220
2263
|
}
|
|
2221
2264
|
if (BUILD19.vdomText && newVNode2.$text$ !== null) {
|
|
2222
|
-
elm = newVNode2.$elm$ =
|
|
2265
|
+
elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
|
|
2223
2266
|
} else if (BUILD19.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
|
|
2224
|
-
elm = newVNode2.$elm$ = BUILD19.isDebug || BUILD19.hydrateServerSide ? slotReferenceDebugNode(newVNode2) :
|
|
2267
|
+
elm = newVNode2.$elm$ = BUILD19.isDebug || BUILD19.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : win.document.createTextNode("");
|
|
2268
|
+
if (BUILD19.vdomAttribute) {
|
|
2269
|
+
updateElement(null, newVNode2, isSvgMode);
|
|
2270
|
+
}
|
|
2225
2271
|
} else {
|
|
2226
2272
|
if (BUILD19.svg && !isSvgMode) {
|
|
2227
2273
|
isSvgMode = newVNode2.$tag$ === "svg";
|
|
2228
2274
|
}
|
|
2229
|
-
|
|
2275
|
+
if (!win.document) {
|
|
2276
|
+
throw new Error(
|
|
2277
|
+
"You are trying to render a Rindo component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
|
|
2278
|
+
);
|
|
2279
|
+
}
|
|
2280
|
+
elm = newVNode2.$elm$ = BUILD19.svg ? win.document.createElementNS(
|
|
2230
2281
|
isSvgMode ? SVG_NS : HTML_NS,
|
|
2231
2282
|
!useNativeShadowDom && BUILD19.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
2232
|
-
) :
|
|
2283
|
+
) : win.document.createElement(
|
|
2233
2284
|
!useNativeShadowDom && BUILD19.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
2234
2285
|
);
|
|
2235
2286
|
if (BUILD19.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
|
|
@@ -2264,6 +2315,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2264
2315
|
elm["s-cr"] = contentRef;
|
|
2265
2316
|
elm["s-sn"] = newVNode2.$name$ || "";
|
|
2266
2317
|
elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
|
|
2318
|
+
patchSlotNode(elm);
|
|
2267
2319
|
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
2268
2320
|
if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
|
|
2269
2321
|
if (BUILD19.experimentalSlotFixes) {
|
|
@@ -2490,9 +2542,8 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
2490
2542
|
newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
|
|
2491
2543
|
relocateToHostRoot(newVNode2.$elm$.parentElement);
|
|
2492
2544
|
}
|
|
2493
|
-
} else {
|
|
2494
|
-
updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
|
|
2495
2545
|
}
|
|
2546
|
+
updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
|
|
2496
2547
|
}
|
|
2497
2548
|
if (BUILD19.updatable && oldChildren !== null && newChildren !== null) {
|
|
2498
2549
|
updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
|
|
@@ -2579,7 +2630,10 @@ var insertBefore = (parent, newNode, reference) => {
|
|
|
2579
2630
|
if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
|
|
2580
2631
|
patchParentNode(newNode);
|
|
2581
2632
|
}
|
|
2582
|
-
|
|
2633
|
+
parent.insertBefore(newNode, reference);
|
|
2634
|
+
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
2635
|
+
if (slotNode) dispatchSlotChangeEvent(slotNode);
|
|
2636
|
+
return newNode;
|
|
2583
2637
|
}
|
|
2584
2638
|
if (BUILD19.experimentalSlotFixes && parent.__insertBefore) {
|
|
2585
2639
|
return parent.__insertBefore(newNode, reference);
|
|
@@ -2661,8 +2715,8 @@ render() {
|
|
|
2661
2715
|
markSlotContentForRelocation(rootVnode.$elm$);
|
|
2662
2716
|
for (const relocateData of relocateNodes) {
|
|
2663
2717
|
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
2664
|
-
if (!nodeToRelocate["s-ol"]) {
|
|
2665
|
-
const orgLocationNode = BUILD19.isDebug || BUILD19.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) :
|
|
2718
|
+
if (!nodeToRelocate["s-ol"] && win.document) {
|
|
2719
|
+
const orgLocationNode = BUILD19.isDebug || BUILD19.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : win.document.createTextNode("");
|
|
2666
2720
|
orgLocationNode["s-nr"] = nodeToRelocate;
|
|
2667
2721
|
insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
|
|
2668
2722
|
}
|
|
@@ -2703,7 +2757,7 @@ render() {
|
|
|
2703
2757
|
}
|
|
2704
2758
|
}
|
|
2705
2759
|
}
|
|
2706
|
-
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](
|
|
2760
|
+
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
|
|
2707
2761
|
} else {
|
|
2708
2762
|
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
2709
2763
|
if (isInitialLoad) {
|
|
@@ -2733,10 +2787,10 @@ render() {
|
|
|
2733
2787
|
}
|
|
2734
2788
|
contentRef = void 0;
|
|
2735
2789
|
};
|
|
2736
|
-
var slotReferenceDebugNode = (slotVNode) =>
|
|
2790
|
+
var slotReferenceDebugNode = (slotVNode) => win.document.createComment(
|
|
2737
2791
|
`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
|
|
2738
2792
|
);
|
|
2739
|
-
var originalLocationDebugNode = (nodeToRelocate) =>
|
|
2793
|
+
var originalLocationDebugNode = (nodeToRelocate) => win.document.createComment(
|
|
2740
2794
|
`org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
|
|
2741
2795
|
);
|
|
2742
2796
|
|
|
@@ -2784,19 +2838,13 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
2784
2838
|
}
|
|
2785
2839
|
}
|
|
2786
2840
|
emitLifecycleEvent(elm, "componentWillLoad");
|
|
2787
|
-
|
|
2788
|
-
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
2789
|
-
}
|
|
2841
|
+
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
2790
2842
|
} else {
|
|
2791
2843
|
emitLifecycleEvent(elm, "componentWillUpdate");
|
|
2792
|
-
|
|
2793
|
-
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
2794
|
-
}
|
|
2844
|
+
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
2795
2845
|
}
|
|
2796
2846
|
emitLifecycleEvent(elm, "componentWillRender");
|
|
2797
|
-
|
|
2798
|
-
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
2799
|
-
}
|
|
2847
|
+
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
2800
2848
|
endSchedule();
|
|
2801
2849
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
2802
2850
|
};
|
|
@@ -2904,14 +2952,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2904
2952
|
const endPostUpdate = createTime("postUpdate", tagName);
|
|
2905
2953
|
const instance = BUILD20.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
2906
2954
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
2907
|
-
if (BUILD20.
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2914
|
-
}
|
|
2955
|
+
if (BUILD20.isDev) {
|
|
2956
|
+
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
2957
|
+
}
|
|
2958
|
+
safeCall(instance, "componentDidRender", void 0, elm);
|
|
2959
|
+
if (BUILD20.isDev) {
|
|
2960
|
+
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2915
2961
|
}
|
|
2916
2962
|
emitLifecycleEvent(elm, "componentDidRender");
|
|
2917
2963
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
@@ -2919,14 +2965,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2919
2965
|
if (BUILD20.asyncLoading && BUILD20.cssAnnotations) {
|
|
2920
2966
|
addHydratedFlag(elm);
|
|
2921
2967
|
}
|
|
2922
|
-
if (BUILD20.
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
|
|
2929
|
-
}
|
|
2968
|
+
if (BUILD20.isDev) {
|
|
2969
|
+
hostRef.$flags$ |= 2048 /* devOnDidLoad */;
|
|
2970
|
+
}
|
|
2971
|
+
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
2972
|
+
if (BUILD20.isDev) {
|
|
2973
|
+
hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
|
|
2930
2974
|
}
|
|
2931
2975
|
emitLifecycleEvent(elm, "componentDidLoad");
|
|
2932
2976
|
endPostUpdate();
|
|
@@ -2937,14 +2981,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2937
2981
|
}
|
|
2938
2982
|
}
|
|
2939
2983
|
} else {
|
|
2940
|
-
if (BUILD20.
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2947
|
-
}
|
|
2984
|
+
if (BUILD20.isDev) {
|
|
2985
|
+
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
2986
|
+
}
|
|
2987
|
+
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
2988
|
+
if (BUILD20.isDev) {
|
|
2989
|
+
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2948
2990
|
}
|
|
2949
2991
|
emitLifecycleEvent(elm, "componentDidUpdate");
|
|
2950
2992
|
endPostUpdate();
|
|
@@ -3076,7 +3118,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3076
3118
|
}
|
|
3077
3119
|
}
|
|
3078
3120
|
if (BUILD21.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
3079
|
-
if (
|
|
3121
|
+
if (instance.componentShouldUpdate) {
|
|
3080
3122
|
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
3081
3123
|
return;
|
|
3082
3124
|
}
|
|
@@ -3358,7 +3400,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3358
3400
|
}
|
|
3359
3401
|
};
|
|
3360
3402
|
var fireConnectedCallback = (instance, elm) => {
|
|
3361
|
-
if (BUILD23.lazyLoad
|
|
3403
|
+
if (BUILD23.lazyLoad) {
|
|
3362
3404
|
safeCall(instance, "connectedCallback", void 0, elm);
|
|
3363
3405
|
}
|
|
3364
3406
|
};
|
|
@@ -3429,7 +3471,10 @@ var connectedCallback = (elm) => {
|
|
|
3429
3471
|
}
|
|
3430
3472
|
};
|
|
3431
3473
|
var setContentReference = (elm) => {
|
|
3432
|
-
|
|
3474
|
+
if (!win.document) {
|
|
3475
|
+
return;
|
|
3476
|
+
}
|
|
3477
|
+
const contentRefElm = elm["s-cr"] = win.document.createComment(
|
|
3433
3478
|
BUILD24.isDebug ? `content-ref (host=${elm.localName})` : ""
|
|
3434
3479
|
);
|
|
3435
3480
|
contentRefElm["s-cn"] = true;
|
|
@@ -3439,12 +3484,9 @@ var setContentReference = (elm) => {
|
|
|
3439
3484
|
// src/runtime/disconnected-callback.ts
|
|
3440
3485
|
import { BUILD as BUILD25 } from "@rindo/core/internal/app-data";
|
|
3441
3486
|
var disconnectInstance = (instance, elm) => {
|
|
3442
|
-
if (BUILD25.lazyLoad
|
|
3487
|
+
if (BUILD25.lazyLoad) {
|
|
3443
3488
|
safeCall(instance, "disconnectedCallback", void 0, elm || instance);
|
|
3444
3489
|
}
|
|
3445
|
-
if (BUILD25.cmpDidUnload) {
|
|
3446
|
-
safeCall(instance, "componentDidUnload", void 0, elm || instance);
|
|
3447
|
-
}
|
|
3448
3490
|
};
|
|
3449
3491
|
var disconnectedCallback = async (elm) => {
|
|
3450
3492
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
@@ -3530,25 +3572,15 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3530
3572
|
this.__hasHostListenerAttached = true;
|
|
3531
3573
|
}
|
|
3532
3574
|
connectedCallback(this);
|
|
3533
|
-
if (
|
|
3575
|
+
if (originalConnectedCallback) {
|
|
3534
3576
|
originalConnectedCallback.call(this);
|
|
3535
3577
|
}
|
|
3536
3578
|
},
|
|
3537
3579
|
disconnectedCallback() {
|
|
3538
3580
|
disconnectedCallback(this);
|
|
3539
|
-
if (
|
|
3581
|
+
if (originalDisconnectedCallback) {
|
|
3540
3582
|
originalDisconnectedCallback.call(this);
|
|
3541
3583
|
}
|
|
3542
|
-
plt.raf(() => {
|
|
3543
|
-
var _a;
|
|
3544
|
-
const hostRef = getHostRef(this);
|
|
3545
|
-
if (((_a = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
|
|
3546
|
-
delete hostRef.$vnode$;
|
|
3547
|
-
}
|
|
3548
|
-
if (this instanceof Node && !this.isConnected) {
|
|
3549
|
-
deleteHostRef(this);
|
|
3550
|
-
}
|
|
3551
|
-
});
|
|
3552
3584
|
},
|
|
3553
3585
|
__attachShadow() {
|
|
3554
3586
|
if (supportsShadow) {
|
|
@@ -3616,18 +3648,22 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3616
3648
|
performance.mark("st:app:start");
|
|
3617
3649
|
}
|
|
3618
3650
|
installDevTools();
|
|
3651
|
+
if (!win.document) {
|
|
3652
|
+
console.warn("Rindo: No document found. Skipping bootstrapping lazy components.");
|
|
3653
|
+
return;
|
|
3654
|
+
}
|
|
3619
3655
|
const endBootstrap = createTime("bootstrapLazy");
|
|
3620
3656
|
const cmpTags = [];
|
|
3621
3657
|
const exclude = options.exclude || [];
|
|
3622
3658
|
const customElements2 = win.customElements;
|
|
3623
|
-
const head =
|
|
3659
|
+
const head = win.document.head;
|
|
3624
3660
|
const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
|
|
3625
|
-
const dataStyles = /* @__PURE__ */
|
|
3661
|
+
const dataStyles = /* @__PURE__ */ win.document.createElement("style");
|
|
3626
3662
|
const deferredConnectedCallbacks = [];
|
|
3627
3663
|
let appLoadFallback;
|
|
3628
3664
|
let isBootstrapping = true;
|
|
3629
3665
|
Object.assign(plt, options);
|
|
3630
|
-
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./",
|
|
3666
|
+
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
|
|
3631
3667
|
if (BUILD27.asyncQueue) {
|
|
3632
3668
|
if (options.syncQueue) {
|
|
3633
3669
|
plt.$flags$ |= 4 /* queueSync */;
|
|
@@ -3777,7 +3813,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3777
3813
|
}
|
|
3778
3814
|
if (dataStyles.innerHTML.length) {
|
|
3779
3815
|
dataStyles.setAttribute("data-styles", "");
|
|
3780
|
-
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(
|
|
3816
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
3781
3817
|
if (nonce != null) {
|
|
3782
3818
|
dataStyles.setAttribute("nonce", nonce);
|
|
3783
3819
|
}
|
|
@@ -3803,7 +3839,7 @@ var Fragment = (_, children) => children;
|
|
|
3803
3839
|
// src/runtime/host-listener.ts
|
|
3804
3840
|
import { BUILD as BUILD28 } from "@rindo/core/internal/app-data";
|
|
3805
3841
|
var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
3806
|
-
if (BUILD28.hostListener && listeners) {
|
|
3842
|
+
if (BUILD28.hostListener && listeners && win.document) {
|
|
3807
3843
|
if (BUILD28.hostListenerTargetParent) {
|
|
3808
3844
|
if (attachParentListeners) {
|
|
3809
3845
|
listeners = listeners.filter(([flags]) => flags & 32 /* TargetParent */);
|
|
@@ -3812,7 +3848,7 @@ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =>
|
|
|
3812
3848
|
}
|
|
3813
3849
|
}
|
|
3814
3850
|
listeners.map(([flags, name, method]) => {
|
|
3815
|
-
const target = BUILD28.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
|
|
3851
|
+
const target = BUILD28.hostListenerTarget ? getHostListenerTarget(win.document, elm, flags) : elm;
|
|
3816
3852
|
const handler = hostListenerProxy(hostRef, method);
|
|
3817
3853
|
const opts = hostListenerOpts(flags);
|
|
3818
3854
|
plt.ael(target, name, handler, opts);
|
|
@@ -3836,12 +3872,19 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
3836
3872
|
consoleError(e, hostRef.$hostElement$);
|
|
3837
3873
|
}
|
|
3838
3874
|
};
|
|
3839
|
-
var getHostListenerTarget = (elm, flags) => {
|
|
3840
|
-
if (BUILD28.hostListenerTargetDocument && flags & 4 /* TargetDocument */)
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
if (BUILD28.
|
|
3875
|
+
var getHostListenerTarget = (doc, elm, flags) => {
|
|
3876
|
+
if (BUILD28.hostListenerTargetDocument && flags & 4 /* TargetDocument */) {
|
|
3877
|
+
return doc;
|
|
3878
|
+
}
|
|
3879
|
+
if (BUILD28.hostListenerTargetWindow && flags & 8 /* TargetWindow */) {
|
|
3880
|
+
return win;
|
|
3881
|
+
}
|
|
3882
|
+
if (BUILD28.hostListenerTargetBody && flags & 16 /* TargetBody */) {
|
|
3883
|
+
return doc.body;
|
|
3884
|
+
}
|
|
3885
|
+
if (BUILD28.hostListenerTargetParent && flags & 32 /* TargetParent */ && elm.parentElement) {
|
|
3844
3886
|
return elm.parentElement;
|
|
3887
|
+
}
|
|
3845
3888
|
return elm;
|
|
3846
3889
|
};
|
|
3847
3890
|
var hostListenerOpts = (flags) => supportsListenerOptions ? {
|
|
@@ -3856,12 +3899,12 @@ var setNonce = (nonce) => plt.$nonce$ = nonce;
|
|
|
3856
3899
|
var setPlatformOptions = (opts) => Object.assign(plt, opts);
|
|
3857
3900
|
|
|
3858
3901
|
// src/runtime/vdom/vdom-annotations.ts
|
|
3859
|
-
var insertVdomAnnotations = (
|
|
3860
|
-
if (
|
|
3861
|
-
const docData = RINDO_DOC_DATA in
|
|
3902
|
+
var insertVdomAnnotations = (doc, staticComponents) => {
|
|
3903
|
+
if (doc != null) {
|
|
3904
|
+
const docData = RINDO_DOC_DATA in doc ? doc[RINDO_DOC_DATA] : { ...DEFAULT_DOC_DATA };
|
|
3862
3905
|
docData.staticComponents = new Set(staticComponents);
|
|
3863
3906
|
const orgLocationNodes = [];
|
|
3864
|
-
parseVNodeAnnotations(
|
|
3907
|
+
parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
|
|
3865
3908
|
orgLocationNodes.forEach((orgLocationNode) => {
|
|
3866
3909
|
var _a;
|
|
3867
3910
|
if (orgLocationNode != null && orgLocationNode["s-nr"]) {
|
|
@@ -3887,11 +3930,11 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
|
|
|
3887
3930
|
return;
|
|
3888
3931
|
}
|
|
3889
3932
|
}
|
|
3890
|
-
const commentBeforeTextNode =
|
|
3933
|
+
const commentBeforeTextNode = doc.createComment(childId);
|
|
3891
3934
|
commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
|
|
3892
3935
|
insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
|
|
3893
3936
|
} else if (nodeRef.nodeType === 8 /* CommentNode */) {
|
|
3894
|
-
const commentBeforeTextNode =
|
|
3937
|
+
const commentBeforeTextNode = doc.createComment(childId);
|
|
3895
3938
|
commentBeforeTextNode.nodeValue = `${COMMENT_NODE_ID}.${childId}`;
|
|
3896
3939
|
nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
|
|
3897
3940
|
}
|
|
@@ -3910,7 +3953,7 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
|
|
|
3910
3953
|
});
|
|
3911
3954
|
}
|
|
3912
3955
|
};
|
|
3913
|
-
var parseVNodeAnnotations = (
|
|
3956
|
+
var parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
|
|
3914
3957
|
var _a;
|
|
3915
3958
|
if (node == null) {
|
|
3916
3959
|
return;
|
|
@@ -3926,13 +3969,13 @@ var parseVNodeAnnotations = (doc2, node, docData, orgLocationNodes) => {
|
|
|
3926
3969
|
const cmpData = {
|
|
3927
3970
|
nodeIds: 0
|
|
3928
3971
|
};
|
|
3929
|
-
insertVNodeAnnotations(
|
|
3972
|
+
insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
|
|
3930
3973
|
}
|
|
3931
|
-
parseVNodeAnnotations(
|
|
3974
|
+
parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
|
|
3932
3975
|
});
|
|
3933
3976
|
}
|
|
3934
3977
|
};
|
|
3935
|
-
var insertVNodeAnnotations = (
|
|
3978
|
+
var insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
|
|
3936
3979
|
if (vnode != null) {
|
|
3937
3980
|
const hostId = ++docData.hostIds;
|
|
3938
3981
|
hostElm.setAttribute(HYDRATE_ID, hostId);
|
|
@@ -3942,7 +3985,7 @@ var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
|
|
|
3942
3985
|
if (vnode.$children$ != null) {
|
|
3943
3986
|
const depth = 0;
|
|
3944
3987
|
vnode.$children$.forEach((vnodeChild, index) => {
|
|
3945
|
-
insertChildVNodeAnnotations(
|
|
3988
|
+
insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
|
|
3946
3989
|
});
|
|
3947
3990
|
}
|
|
3948
3991
|
if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute(HYDRATE_CHILD_ID)) {
|
|
@@ -3963,7 +4006,7 @@ var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
|
|
|
3963
4006
|
}
|
|
3964
4007
|
}
|
|
3965
4008
|
};
|
|
3966
|
-
var insertChildVNodeAnnotations = (
|
|
4009
|
+
var insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
|
|
3967
4010
|
const childElm = vnodeChild.$elm$;
|
|
3968
4011
|
if (childElm == null) {
|
|
3969
4012
|
return;
|
|
@@ -3982,7 +4025,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
|
|
|
3982
4025
|
const nodeName = parentNode == null ? void 0 : parentNode.nodeName;
|
|
3983
4026
|
if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
|
|
3984
4027
|
const textNodeId = `${TEXT_NODE_ID}.${childId}`;
|
|
3985
|
-
const commentBeforeTextNode =
|
|
4028
|
+
const commentBeforeTextNode = doc.createComment(textNodeId);
|
|
3986
4029
|
insertBefore(parentNode, commentBeforeTextNode, childElm);
|
|
3987
4030
|
}
|
|
3988
4031
|
} else if (childElm.nodeType === 8 /* CommentNode */) {
|
|
@@ -3995,7 +4038,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
|
|
|
3995
4038
|
if (vnodeChild.$children$ != null) {
|
|
3996
4039
|
const childDepth = depth + 1;
|
|
3997
4040
|
vnodeChild.$children$.forEach((vnode, index2) => {
|
|
3998
|
-
insertChildVNodeAnnotations(
|
|
4041
|
+
insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index2);
|
|
3999
4042
|
});
|
|
4000
4043
|
}
|
|
4001
4044
|
};
|
|
@@ -4019,9 +4062,7 @@ export {
|
|
|
4019
4062
|
consoleError,
|
|
4020
4063
|
createEvent,
|
|
4021
4064
|
defineCustomElement,
|
|
4022
|
-
deleteHostRef,
|
|
4023
4065
|
disconnectedCallback,
|
|
4024
|
-
doc,
|
|
4025
4066
|
forceModeUpdate,
|
|
4026
4067
|
forceUpdate,
|
|
4027
4068
|
getAssetPath,
|