@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
|
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/testing/platform/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
Build: () => Build,
|
|
24
24
|
Env: () => import_app_data22.Env,
|
|
25
25
|
Fragment: () => Fragment,
|
|
@@ -33,9 +33,7 @@ __export(platform_exports, {
|
|
|
33
33
|
consoleError: () => consoleError,
|
|
34
34
|
createEvent: () => createEvent,
|
|
35
35
|
defineCustomElement: () => defineCustomElement,
|
|
36
|
-
deleteHostRef: () => deleteHostRef,
|
|
37
36
|
disconnectedCallback: () => disconnectedCallback,
|
|
38
|
-
doc: () => doc,
|
|
39
37
|
flushAll: () => flushAll,
|
|
40
38
|
flushLoadModule: () => flushLoadModule,
|
|
41
39
|
flushQueue: () => flushQueue,
|
|
@@ -82,7 +80,7 @@ __export(platform_exports, {
|
|
|
82
80
|
win: () => win,
|
|
83
81
|
writeTask: () => writeTask
|
|
84
82
|
});
|
|
85
|
-
module.exports = __toCommonJS(
|
|
83
|
+
module.exports = __toCommonJS(index_exports);
|
|
86
84
|
|
|
87
85
|
// src/testing/platform/testing-build.ts
|
|
88
86
|
var Build = {
|
|
@@ -102,13 +100,14 @@ var queuedReadTasks = [];
|
|
|
102
100
|
var moduleLoaded = /* @__PURE__ */ new Map();
|
|
103
101
|
var queuedLoadModules = [];
|
|
104
102
|
var caughtErrors = [];
|
|
105
|
-
var hostRefs = /* @__PURE__ */ new Map();
|
|
106
103
|
|
|
107
104
|
// src/testing/platform/testing-host-ref.ts
|
|
108
105
|
var getHostRef = (elm) => {
|
|
109
|
-
|
|
106
|
+
if (elm.__rindo__getHostRef) {
|
|
107
|
+
return elm.__rindo__getHostRef();
|
|
108
|
+
}
|
|
109
|
+
return void 0;
|
|
110
110
|
};
|
|
111
|
-
var deleteHostRef = (ref) => hostRefs.delete(ref);
|
|
112
111
|
var registerInstance = (lazyInstance, hostRef) => {
|
|
113
112
|
if (lazyInstance == null || lazyInstance.constructor == null) {
|
|
114
113
|
throw new Error(`Invalid component constructor`);
|
|
@@ -120,8 +119,8 @@ var registerInstance = (lazyInstance, hostRef) => {
|
|
|
120
119
|
registerHost(elm, { $flags$: 0, $tagName$: tagName });
|
|
121
120
|
hostRef = getHostRef(elm);
|
|
122
121
|
}
|
|
122
|
+
lazyInstance.__rindo__getHostRef = () => hostRef;
|
|
123
123
|
hostRef.$lazyInstance$ = lazyInstance;
|
|
124
|
-
return hostRefs.set(lazyInstance, hostRef);
|
|
125
124
|
};
|
|
126
125
|
var registerHost = (elm, cmpMeta) => {
|
|
127
126
|
const hostRef = {
|
|
@@ -135,7 +134,7 @@ var registerHost = (elm, cmpMeta) => {
|
|
|
135
134
|
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
|
|
136
135
|
elm["s-p"] = [];
|
|
137
136
|
elm["s-rc"] = [];
|
|
138
|
-
|
|
137
|
+
elm.__rindo__getHostRef = () => hostRef;
|
|
139
138
|
};
|
|
140
139
|
|
|
141
140
|
// src/testing/platform/testing-log.ts
|
|
@@ -290,7 +289,6 @@ function flushLoadModule(bundleId) {
|
|
|
290
289
|
// src/testing/platform/testing-window.ts
|
|
291
290
|
var import_mock_doc = require("../../mock-doc/index.cjs");
|
|
292
291
|
var win = (0, import_mock_doc.setupGlobal)(global);
|
|
293
|
-
var doc = win.document;
|
|
294
292
|
|
|
295
293
|
// src/testing/platform/testing-platform.ts
|
|
296
294
|
var supportsShadow = true;
|
|
@@ -315,7 +313,6 @@ function resetPlatform(defaults = {}) {
|
|
|
315
313
|
if (win && typeof win.close === "function") {
|
|
316
314
|
win.close();
|
|
317
315
|
}
|
|
318
|
-
hostRefs.clear();
|
|
319
316
|
styles.clear();
|
|
320
317
|
plt.$flags$ = 0;
|
|
321
318
|
Object.assign(plt, defaults);
|
|
@@ -396,9 +393,9 @@ var isComplexType = (o) => {
|
|
|
396
393
|
};
|
|
397
394
|
|
|
398
395
|
// src/utils/query-nonce-meta-tag-content.ts
|
|
399
|
-
function queryNonceMetaTagContent(
|
|
396
|
+
function queryNonceMetaTagContent(doc) {
|
|
400
397
|
var _a, _b, _c;
|
|
401
|
-
return (_c = (_b = (_a =
|
|
398
|
+
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;
|
|
402
399
|
}
|
|
403
400
|
|
|
404
401
|
// src/utils/regular-expression.ts
|
|
@@ -494,12 +491,11 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
|
|
494
491
|
|
|
495
492
|
// src/runtime/slot-polyfill-utils.ts
|
|
496
493
|
var updateFallbackSlotVisibility = (elm) => {
|
|
497
|
-
const childNodes = elm
|
|
494
|
+
const childNodes = internalCall(elm, "childNodes");
|
|
498
495
|
if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
|
|
499
496
|
getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
|
|
500
|
-
var _a;
|
|
501
497
|
if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
|
|
502
|
-
if ((
|
|
498
|
+
if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
|
|
503
499
|
slotNode.hidden = true;
|
|
504
500
|
} else {
|
|
505
501
|
slotNode.hidden = false;
|
|
@@ -507,8 +503,10 @@ var updateFallbackSlotVisibility = (elm) => {
|
|
|
507
503
|
}
|
|
508
504
|
});
|
|
509
505
|
}
|
|
510
|
-
|
|
511
|
-
|
|
506
|
+
let i2 = 0;
|
|
507
|
+
for (i2 = 0; i2 < childNodes.length; i2++) {
|
|
508
|
+
const childNode = childNodes[i2];
|
|
509
|
+
if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
|
|
512
510
|
updateFallbackSlotVisibility(childNode);
|
|
513
511
|
}
|
|
514
512
|
}
|
|
@@ -529,7 +527,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
529
527
|
let childNode;
|
|
530
528
|
for (; i2 < childNodes.length; i2++) {
|
|
531
529
|
childNode = childNodes[i2];
|
|
532
|
-
if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode
|
|
530
|
+
if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
|
|
533
531
|
slottedNodes.push(childNode);
|
|
534
532
|
if (typeof slotName !== "undefined") return slottedNodes;
|
|
535
533
|
}
|
|
@@ -537,11 +535,12 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
537
535
|
}
|
|
538
536
|
return slottedNodes;
|
|
539
537
|
}
|
|
540
|
-
var
|
|
538
|
+
var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
|
|
541
539
|
const childNodes = [];
|
|
542
|
-
if (includeSlot &&
|
|
543
|
-
|
|
544
|
-
|
|
540
|
+
if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
|
|
541
|
+
let node = slot;
|
|
542
|
+
while (node = node.nextSibling) {
|
|
543
|
+
if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
|
|
545
544
|
}
|
|
546
545
|
return childNodes;
|
|
547
546
|
};
|
|
@@ -561,38 +560,73 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
|
|
|
561
560
|
return slotName === "";
|
|
562
561
|
};
|
|
563
562
|
var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
|
|
564
|
-
let slottedNodeLocation;
|
|
565
563
|
if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
|
|
566
|
-
|
|
567
|
-
} else {
|
|
568
|
-
slottedNodeLocation = document.createTextNode("");
|
|
569
|
-
slottedNodeLocation["s-nr"] = newChild;
|
|
564
|
+
return;
|
|
570
565
|
}
|
|
566
|
+
const slottedNodeLocation = document.createTextNode("");
|
|
567
|
+
slottedNodeLocation["s-nr"] = newChild;
|
|
571
568
|
if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
|
|
572
569
|
const parent = slotNode["s-cr"].parentNode;
|
|
573
|
-
const appendMethod = prepend ? parent
|
|
574
|
-
if (typeof position !== "undefined") {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
|
|
588
|
-
}
|
|
570
|
+
const appendMethod = prepend ? internalCall(parent, "prepend") : internalCall(parent, "appendChild");
|
|
571
|
+
if (import_app_data.BUILD.hydrateClientSide && typeof position !== "undefined") {
|
|
572
|
+
slottedNodeLocation["s-oo"] = position;
|
|
573
|
+
const childNodes = internalCall(parent, "childNodes");
|
|
574
|
+
const slotRelocateNodes = [slottedNodeLocation];
|
|
575
|
+
childNodes.forEach((n) => {
|
|
576
|
+
if (n["s-nr"]) slotRelocateNodes.push(n);
|
|
577
|
+
});
|
|
578
|
+
slotRelocateNodes.sort((a, b) => {
|
|
579
|
+
if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
|
|
580
|
+
else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
|
|
581
|
+
return 0;
|
|
582
|
+
});
|
|
583
|
+
slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
|
|
589
584
|
} else {
|
|
590
585
|
appendMethod.call(parent, slottedNodeLocation);
|
|
591
586
|
}
|
|
592
587
|
newChild["s-ol"] = slottedNodeLocation;
|
|
593
588
|
newChild["s-sh"] = slotNode["s-hn"];
|
|
594
589
|
};
|
|
595
|
-
var getSlotName = (node) => node["s-sn"]
|
|
590
|
+
var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
|
|
591
|
+
function patchSlotNode(node) {
|
|
592
|
+
if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
|
|
593
|
+
const assignedFactory = (elementsOnly) => (function(opts) {
|
|
594
|
+
const toReturn = [];
|
|
595
|
+
const slotName = this["s-sn"];
|
|
596
|
+
if (opts == null ? void 0 : opts.flatten) {
|
|
597
|
+
console.error(`
|
|
598
|
+
Flattening is not supported for Rindo non-shadow slots.
|
|
599
|
+
You can use \`.childNodes\` to nested slot fallback content.
|
|
600
|
+
If you have a particular use case, please open an issue on the Rindo repo.
|
|
601
|
+
`);
|
|
602
|
+
}
|
|
603
|
+
const parent = this["s-cr"].parentElement;
|
|
604
|
+
const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
|
|
605
|
+
slottedNodes.forEach((n) => {
|
|
606
|
+
if (slotName === getSlotName(n)) {
|
|
607
|
+
toReturn.push(n);
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
if (elementsOnly) {
|
|
611
|
+
return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
|
|
612
|
+
}
|
|
613
|
+
return toReturn;
|
|
614
|
+
}).bind(node);
|
|
615
|
+
node.assignedElements = assignedFactory(true);
|
|
616
|
+
node.assignedNodes = assignedFactory(false);
|
|
617
|
+
}
|
|
618
|
+
function dispatchSlotChangeEvent(elm) {
|
|
619
|
+
elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
|
|
620
|
+
}
|
|
621
|
+
function findSlotFromSlottedNode(slottedNode, parentHost) {
|
|
622
|
+
var _a;
|
|
623
|
+
parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
|
|
624
|
+
if (!parentHost) return { slotNode: null, slotName: "" };
|
|
625
|
+
const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
|
|
626
|
+
const childNodes = internalCall(parentHost, "childNodes");
|
|
627
|
+
const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
|
|
628
|
+
return { slotNode, slotName };
|
|
629
|
+
}
|
|
596
630
|
|
|
597
631
|
// src/runtime/dom-extras.ts
|
|
598
632
|
var patchPseudoShadowDom = (hostElementPrototype) => {
|
|
@@ -656,19 +690,14 @@ var patchCloneNode = (HostElementPrototype) => {
|
|
|
656
690
|
var patchSlotAppendChild = (HostElementPrototype) => {
|
|
657
691
|
HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
|
|
658
692
|
HostElementPrototype.appendChild = function(newChild) {
|
|
659
|
-
const slotName
|
|
660
|
-
const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
|
|
693
|
+
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
661
694
|
if (slotNode) {
|
|
662
695
|
addSlotRelocateNode(newChild, slotNode);
|
|
663
|
-
const slotChildNodes =
|
|
696
|
+
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
664
697
|
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
665
|
-
const parent =
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
insertedNode = parent.__insertBefore(newChild, appendAfter.nextSibling);
|
|
669
|
-
} else {
|
|
670
|
-
insertedNode = parent.insertBefore(newChild, appendAfter.nextSibling);
|
|
671
|
-
}
|
|
698
|
+
const parent = internalCall(appendAfter, "parentNode");
|
|
699
|
+
const insertedNode = internalCall(parent, "insertBefore")(newChild, appendAfter.nextSibling);
|
|
700
|
+
dispatchSlotChangeEvent(slotNode);
|
|
672
701
|
updateFallbackSlotVisibility(this);
|
|
673
702
|
return insertedNode;
|
|
674
703
|
}
|
|
@@ -697,19 +726,17 @@ var patchSlotPrepend = (HostElementPrototype) => {
|
|
|
697
726
|
if (typeof newChild === "string") {
|
|
698
727
|
newChild = this.ownerDocument.createTextNode(newChild);
|
|
699
728
|
}
|
|
700
|
-
const slotName = newChild["s-sn"] = getSlotName(newChild);
|
|
701
|
-
const childNodes = this
|
|
729
|
+
const slotName = (newChild["s-sn"] = getSlotName(newChild)) || "";
|
|
730
|
+
const childNodes = internalCall(this, "childNodes");
|
|
702
731
|
const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
|
|
703
732
|
if (slotNode) {
|
|
704
733
|
addSlotRelocateNode(newChild, slotNode, true);
|
|
705
|
-
const slotChildNodes =
|
|
734
|
+
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
706
735
|
const appendAfter = slotChildNodes[0];
|
|
707
|
-
const parent =
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
return parent.insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
|
|
712
|
-
}
|
|
736
|
+
const parent = internalCall(appendAfter, "parentNode");
|
|
737
|
+
const toReturn = internalCall(parent, "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
|
|
738
|
+
dispatchSlotChangeEvent(slotNode);
|
|
739
|
+
return toReturn;
|
|
713
740
|
}
|
|
714
741
|
if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
|
|
715
742
|
newChild.hidden = true;
|
|
@@ -759,8 +786,7 @@ var patchInsertBefore = (HostElementPrototype) => {
|
|
|
759
786
|
if (eleProto.__insertBefore) return;
|
|
760
787
|
eleProto.__insertBefore = HostElementPrototype.insertBefore;
|
|
761
788
|
HostElementPrototype.insertBefore = function(newChild, currentChild) {
|
|
762
|
-
const slotName
|
|
763
|
-
const slotNode = getHostSlotNodes(this.__childNodes, this.tagName, slotName)[0];
|
|
789
|
+
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
764
790
|
const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
|
|
765
791
|
if (slotNode) {
|
|
766
792
|
let found = false;
|
|
@@ -773,18 +799,19 @@ var patchInsertBefore = (HostElementPrototype) => {
|
|
|
773
799
|
}
|
|
774
800
|
if (slotName === currentChild["s-sn"]) {
|
|
775
801
|
addSlotRelocateNode(newChild, slotNode);
|
|
776
|
-
const parent =
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
} else {
|
|
780
|
-
parent.insertBefore(newChild, currentChild);
|
|
781
|
-
}
|
|
802
|
+
const parent = internalCall(currentChild, "parentNode");
|
|
803
|
+
internalCall(parent, "insertBefore")(newChild, currentChild);
|
|
804
|
+
dispatchSlotChangeEvent(slotNode);
|
|
782
805
|
}
|
|
783
806
|
return;
|
|
784
807
|
}
|
|
785
808
|
});
|
|
786
809
|
if (found) return newChild;
|
|
787
810
|
}
|
|
811
|
+
const parentNode = currentChild == null ? void 0 : currentChild.__parentNode;
|
|
812
|
+
if (parentNode && !this.isSameNode(parentNode)) {
|
|
813
|
+
return this.appendChild(newChild);
|
|
814
|
+
}
|
|
788
815
|
return this.__insertBefore(newChild, currentChild);
|
|
789
816
|
};
|
|
790
817
|
};
|
|
@@ -862,7 +889,7 @@ var patchChildSlotNodes = (elm) => {
|
|
|
862
889
|
});
|
|
863
890
|
};
|
|
864
891
|
var patchSlottedNode = (node) => {
|
|
865
|
-
if (!node || node.__nextSibling || !globalThis.Node) return;
|
|
892
|
+
if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
|
|
866
893
|
patchNextSibling(node);
|
|
867
894
|
patchPreviousSibling(node);
|
|
868
895
|
patchParentNode(node);
|
|
@@ -966,11 +993,14 @@ function patchHostOriginalAccessor(accessorName, node) {
|
|
|
966
993
|
}
|
|
967
994
|
if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
|
|
968
995
|
}
|
|
969
|
-
function
|
|
996
|
+
function internalCall(node, method) {
|
|
970
997
|
if ("__" + method in node) {
|
|
971
|
-
|
|
998
|
+
const toReturn = node["__" + method];
|
|
999
|
+
if (typeof toReturn !== "function") return toReturn;
|
|
1000
|
+
return toReturn.bind(node);
|
|
972
1001
|
} else {
|
|
973
|
-
return node[method];
|
|
1002
|
+
if (typeof node[method] !== "function") return node[method];
|
|
1003
|
+
return node[method].bind(node);
|
|
974
1004
|
}
|
|
975
1005
|
}
|
|
976
1006
|
|
|
@@ -1220,8 +1250,8 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1220
1250
|
delete hostElm["s-sc"];
|
|
1221
1251
|
}
|
|
1222
1252
|
}
|
|
1223
|
-
if (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size) {
|
|
1224
|
-
initializeDocumentHydrate(
|
|
1253
|
+
if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
|
|
1254
|
+
initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
|
|
1225
1255
|
}
|
|
1226
1256
|
hostElm[HYDRATE_ID] = hostId;
|
|
1227
1257
|
hostElm.removeAttribute(HYDRATE_ID);
|
|
@@ -1547,8 +1577,8 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
|
|
|
1547
1577
|
childVNode.$name$ = slotName || null;
|
|
1548
1578
|
childVNode.$tag$ = "slot";
|
|
1549
1579
|
const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
|
|
1550
|
-
if (import_app_data5.BUILD.shadowDom && shadowRootNodes) {
|
|
1551
|
-
const slot = childVNode.$elm$ =
|
|
1580
|
+
if (import_app_data5.BUILD.shadowDom && shadowRootNodes && win.document) {
|
|
1581
|
+
const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
|
|
1552
1582
|
if (childVNode.$name$) {
|
|
1553
1583
|
childVNode.$elm$.setAttribute("name", slotName);
|
|
1554
1584
|
}
|
|
@@ -1566,6 +1596,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
|
|
|
1566
1596
|
const slot = childVNode.$elm$;
|
|
1567
1597
|
const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
|
|
1568
1598
|
addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
|
|
1599
|
+
patchSlotNode(node);
|
|
1569
1600
|
if (shouldMove) {
|
|
1570
1601
|
parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
|
|
1571
1602
|
}
|
|
@@ -2030,10 +2061,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
2030
2061
|
var _a;
|
|
2031
2062
|
const scopeId2 = getScopeId(cmpMeta, mode);
|
|
2032
2063
|
const style = styles.get(scopeId2);
|
|
2033
|
-
if (!import_app_data9.BUILD.attachStyles) {
|
|
2064
|
+
if (!import_app_data9.BUILD.attachStyles || !win.document) {
|
|
2034
2065
|
return scopeId2;
|
|
2035
2066
|
}
|
|
2036
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode :
|
|
2067
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
|
|
2037
2068
|
if (style) {
|
|
2038
2069
|
if (typeof style === "string") {
|
|
2039
2070
|
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
@@ -2046,9 +2077,9 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
2046
2077
|
if (import_app_data9.BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
|
|
2047
2078
|
styleElm.innerHTML = style;
|
|
2048
2079
|
} else {
|
|
2049
|
-
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) ||
|
|
2080
|
+
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
|
|
2050
2081
|
styleElm.innerHTML = style;
|
|
2051
|
-
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(
|
|
2082
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
2052
2083
|
if (nonce != null) {
|
|
2053
2084
|
styleElm.setAttribute("nonce", nonce);
|
|
2054
2085
|
}
|
|
@@ -2116,7 +2147,10 @@ var attachStyles = (hostRef) => {
|
|
|
2116
2147
|
var getScopeId = (cmp, mode) => "sc-" + (import_app_data9.BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
|
|
2117
2148
|
var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
|
|
2118
2149
|
var hydrateScopedToShadow = () => {
|
|
2119
|
-
|
|
2150
|
+
if (!win.document) {
|
|
2151
|
+
return;
|
|
2152
|
+
}
|
|
2153
|
+
const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
|
2120
2154
|
let i2 = 0;
|
|
2121
2155
|
for (; i2 < styles2.length; i2++) {
|
|
2122
2156
|
registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
|
|
@@ -2132,112 +2166,113 @@ var import_app_data11 = require("@rindo/core/internal/app-data");
|
|
|
2132
2166
|
// src/runtime/vdom/set-accessor.ts
|
|
2133
2167
|
var import_app_data10 = require("@rindo/core/internal/app-data");
|
|
2134
2168
|
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
2135
|
-
if (oldValue
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
} else {
|
|
2160
|
-
elm.style[prop] = "";
|
|
2161
|
-
}
|
|
2162
|
-
}
|
|
2163
|
-
}
|
|
2164
|
-
}
|
|
2165
|
-
for (const prop in newValue) {
|
|
2166
|
-
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
2169
|
+
if (oldValue === newValue) {
|
|
2170
|
+
return;
|
|
2171
|
+
}
|
|
2172
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
2173
|
+
let ln = memberName.toLowerCase();
|
|
2174
|
+
if (import_app_data10.BUILD.vdomClass && memberName === "class") {
|
|
2175
|
+
const classList = elm.classList;
|
|
2176
|
+
const oldClasses = parseClassList(oldValue);
|
|
2177
|
+
let newClasses = parseClassList(newValue);
|
|
2178
|
+
if (import_app_data10.BUILD.hydrateClientSide && elm["s-si"] && initialRender) {
|
|
2179
|
+
newClasses.push(elm["s-si"]);
|
|
2180
|
+
oldClasses.forEach((c) => {
|
|
2181
|
+
if (c.startsWith(elm["s-si"])) newClasses.push(c);
|
|
2182
|
+
});
|
|
2183
|
+
newClasses = [...new Set(newClasses)];
|
|
2184
|
+
classList.add(...newClasses);
|
|
2185
|
+
} else {
|
|
2186
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
2187
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
2188
|
+
}
|
|
2189
|
+
} else if (import_app_data10.BUILD.vdomStyle && memberName === "style") {
|
|
2190
|
+
if (import_app_data10.BUILD.updatable) {
|
|
2191
|
+
for (const prop in oldValue) {
|
|
2192
|
+
if (!newValue || newValue[prop] == null) {
|
|
2167
2193
|
if (!import_app_data10.BUILD.hydrateServerSide && prop.includes("-")) {
|
|
2168
|
-
elm.style.
|
|
2194
|
+
elm.style.removeProperty(prop);
|
|
2169
2195
|
} else {
|
|
2170
|
-
elm.style[prop] =
|
|
2196
|
+
elm.style[prop] = "";
|
|
2171
2197
|
}
|
|
2172
2198
|
}
|
|
2173
2199
|
}
|
|
2174
|
-
}
|
|
2175
|
-
|
|
2176
|
-
if (newValue) {
|
|
2177
|
-
|
|
2200
|
+
}
|
|
2201
|
+
for (const prop in newValue) {
|
|
2202
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
2203
|
+
if (!import_app_data10.BUILD.hydrateServerSide && prop.includes("-")) {
|
|
2204
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
2205
|
+
} else {
|
|
2206
|
+
elm.style[prop] = newValue[prop];
|
|
2207
|
+
}
|
|
2178
2208
|
}
|
|
2179
|
-
}
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2209
|
+
}
|
|
2210
|
+
} else if (import_app_data10.BUILD.vdomKey && memberName === "key") {
|
|
2211
|
+
} else if (import_app_data10.BUILD.vdomRef && memberName === "ref") {
|
|
2212
|
+
if (newValue) {
|
|
2213
|
+
newValue(elm);
|
|
2214
|
+
}
|
|
2215
|
+
} else if (import_app_data10.BUILD.vdomListener && (import_app_data10.BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
|
|
2216
|
+
if (memberName[2] === "-") {
|
|
2217
|
+
memberName = memberName.slice(3);
|
|
2218
|
+
} else if (isMemberInElement(win, ln)) {
|
|
2219
|
+
memberName = ln.slice(2);
|
|
2220
|
+
} else {
|
|
2221
|
+
memberName = ln[2] + memberName.slice(3);
|
|
2222
|
+
}
|
|
2223
|
+
if (oldValue || newValue) {
|
|
2224
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
2225
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
2226
|
+
if (oldValue) {
|
|
2227
|
+
plt.rel(elm, memberName, oldValue, capture);
|
|
2186
2228
|
}
|
|
2187
|
-
if (
|
|
2188
|
-
|
|
2189
|
-
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
2190
|
-
if (oldValue) {
|
|
2191
|
-
plt.rel(elm, memberName, oldValue, capture);
|
|
2192
|
-
}
|
|
2193
|
-
if (newValue) {
|
|
2194
|
-
plt.ael(elm, memberName, newValue, capture);
|
|
2195
|
-
}
|
|
2229
|
+
if (newValue) {
|
|
2230
|
+
plt.ael(elm, memberName, newValue, capture);
|
|
2196
2231
|
}
|
|
2197
|
-
}
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2232
|
+
}
|
|
2233
|
+
} else if (import_app_data10.BUILD.vdomPropOrAttr) {
|
|
2234
|
+
const isComplex = isComplexType(newValue);
|
|
2235
|
+
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
2236
|
+
try {
|
|
2237
|
+
if (!elm.tagName.includes("-")) {
|
|
2238
|
+
const n = newValue == null ? "" : newValue;
|
|
2239
|
+
if (memberName === "list") {
|
|
2240
|
+
isProp = false;
|
|
2241
|
+
} else if (oldValue == null || elm[memberName] != n) {
|
|
2242
|
+
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
2243
|
+
elm[memberName] = n;
|
|
2244
|
+
} else {
|
|
2245
|
+
elm.setAttribute(memberName, n);
|
|
2211
2246
|
}
|
|
2212
|
-
} else if (elm[memberName] !== newValue) {
|
|
2213
|
-
elm[memberName] = newValue;
|
|
2214
2247
|
}
|
|
2215
|
-
}
|
|
2248
|
+
} else if (elm[memberName] !== newValue) {
|
|
2249
|
+
elm[memberName] = newValue;
|
|
2216
2250
|
}
|
|
2251
|
+
} catch (e) {
|
|
2217
2252
|
}
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2253
|
+
}
|
|
2254
|
+
let xlink = false;
|
|
2255
|
+
if (import_app_data10.BUILD.vdomXlink) {
|
|
2256
|
+
if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
|
|
2257
|
+
memberName = ln;
|
|
2258
|
+
xlink = true;
|
|
2224
2259
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
2229
|
-
} else {
|
|
2230
|
-
elm.removeAttribute(memberName);
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
|
-
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
2234
|
-
newValue = newValue === true ? "" : newValue;
|
|
2260
|
+
}
|
|
2261
|
+
if (newValue == null || newValue === false) {
|
|
2262
|
+
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
|
2235
2263
|
if (import_app_data10.BUILD.vdomXlink && xlink) {
|
|
2236
|
-
elm.
|
|
2264
|
+
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
2237
2265
|
} else {
|
|
2238
|
-
elm.
|
|
2266
|
+
elm.removeAttribute(memberName);
|
|
2239
2267
|
}
|
|
2240
2268
|
}
|
|
2269
|
+
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
|
|
2270
|
+
newValue = newValue === true ? "" : newValue;
|
|
2271
|
+
if (import_app_data10.BUILD.vdomXlink && xlink) {
|
|
2272
|
+
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
2273
|
+
} else {
|
|
2274
|
+
elm.setAttribute(memberName, newValue);
|
|
2275
|
+
}
|
|
2241
2276
|
}
|
|
2242
2277
|
}
|
|
2243
2278
|
};
|
|
@@ -2332,17 +2367,25 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2332
2367
|
);
|
|
2333
2368
|
}
|
|
2334
2369
|
if (import_app_data12.BUILD.vdomText && newVNode2.$text$ !== null) {
|
|
2335
|
-
elm = newVNode2.$elm$ =
|
|
2370
|
+
elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
|
|
2336
2371
|
} else if (import_app_data12.BUILD.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
|
|
2337
|
-
elm = newVNode2.$elm$ = import_app_data12.BUILD.isDebug || import_app_data12.BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode2) :
|
|
2372
|
+
elm = newVNode2.$elm$ = import_app_data12.BUILD.isDebug || import_app_data12.BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : win.document.createTextNode("");
|
|
2373
|
+
if (import_app_data12.BUILD.vdomAttribute) {
|
|
2374
|
+
updateElement(null, newVNode2, isSvgMode);
|
|
2375
|
+
}
|
|
2338
2376
|
} else {
|
|
2339
2377
|
if (import_app_data12.BUILD.svg && !isSvgMode) {
|
|
2340
2378
|
isSvgMode = newVNode2.$tag$ === "svg";
|
|
2341
2379
|
}
|
|
2342
|
-
|
|
2380
|
+
if (!win.document) {
|
|
2381
|
+
throw new Error(
|
|
2382
|
+
"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."
|
|
2383
|
+
);
|
|
2384
|
+
}
|
|
2385
|
+
elm = newVNode2.$elm$ = import_app_data12.BUILD.svg ? win.document.createElementNS(
|
|
2343
2386
|
isSvgMode ? SVG_NS : HTML_NS,
|
|
2344
2387
|
!useNativeShadowDom && import_app_data12.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
2345
|
-
) :
|
|
2388
|
+
) : win.document.createElement(
|
|
2346
2389
|
!useNativeShadowDom && import_app_data12.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
2347
2390
|
);
|
|
2348
2391
|
if (import_app_data12.BUILD.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
|
|
@@ -2377,6 +2420,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2377
2420
|
elm["s-cr"] = contentRef;
|
|
2378
2421
|
elm["s-sn"] = newVNode2.$name$ || "";
|
|
2379
2422
|
elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
|
|
2423
|
+
patchSlotNode(elm);
|
|
2380
2424
|
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
2381
2425
|
if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
|
|
2382
2426
|
if (import_app_data12.BUILD.experimentalSlotFixes) {
|
|
@@ -2603,9 +2647,8 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
2603
2647
|
newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
|
|
2604
2648
|
relocateToHostRoot(newVNode2.$elm$.parentElement);
|
|
2605
2649
|
}
|
|
2606
|
-
} else {
|
|
2607
|
-
updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
|
|
2608
2650
|
}
|
|
2651
|
+
updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
|
|
2609
2652
|
}
|
|
2610
2653
|
if (import_app_data12.BUILD.updatable && oldChildren !== null && newChildren !== null) {
|
|
2611
2654
|
updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
|
|
@@ -2692,7 +2735,10 @@ var insertBefore = (parent, newNode, reference) => {
|
|
|
2692
2735
|
if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
|
|
2693
2736
|
patchParentNode(newNode);
|
|
2694
2737
|
}
|
|
2695
|
-
|
|
2738
|
+
parent.insertBefore(newNode, reference);
|
|
2739
|
+
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
2740
|
+
if (slotNode) dispatchSlotChangeEvent(slotNode);
|
|
2741
|
+
return newNode;
|
|
2696
2742
|
}
|
|
2697
2743
|
if (import_app_data12.BUILD.experimentalSlotFixes && parent.__insertBefore) {
|
|
2698
2744
|
return parent.__insertBefore(newNode, reference);
|
|
@@ -2774,8 +2820,8 @@ render() {
|
|
|
2774
2820
|
markSlotContentForRelocation(rootVnode.$elm$);
|
|
2775
2821
|
for (const relocateData of relocateNodes) {
|
|
2776
2822
|
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
2777
|
-
if (!nodeToRelocate["s-ol"]) {
|
|
2778
|
-
const orgLocationNode = import_app_data12.BUILD.isDebug || import_app_data12.BUILD.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) :
|
|
2823
|
+
if (!nodeToRelocate["s-ol"] && win.document) {
|
|
2824
|
+
const orgLocationNode = import_app_data12.BUILD.isDebug || import_app_data12.BUILD.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : win.document.createTextNode("");
|
|
2779
2825
|
orgLocationNode["s-nr"] = nodeToRelocate;
|
|
2780
2826
|
insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
|
|
2781
2827
|
}
|
|
@@ -2816,7 +2862,7 @@ render() {
|
|
|
2816
2862
|
}
|
|
2817
2863
|
}
|
|
2818
2864
|
}
|
|
2819
|
-
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](
|
|
2865
|
+
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
|
|
2820
2866
|
} else {
|
|
2821
2867
|
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
2822
2868
|
if (isInitialLoad) {
|
|
@@ -2846,10 +2892,10 @@ render() {
|
|
|
2846
2892
|
}
|
|
2847
2893
|
contentRef = void 0;
|
|
2848
2894
|
};
|
|
2849
|
-
var slotReferenceDebugNode = (slotVNode) =>
|
|
2895
|
+
var slotReferenceDebugNode = (slotVNode) => win.document.createComment(
|
|
2850
2896
|
`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
|
|
2851
2897
|
);
|
|
2852
|
-
var originalLocationDebugNode = (nodeToRelocate) =>
|
|
2898
|
+
var originalLocationDebugNode = (nodeToRelocate) => win.document.createComment(
|
|
2853
2899
|
`org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
|
|
2854
2900
|
);
|
|
2855
2901
|
|
|
@@ -2897,19 +2943,13 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
2897
2943
|
}
|
|
2898
2944
|
}
|
|
2899
2945
|
emitLifecycleEvent(elm, "componentWillLoad");
|
|
2900
|
-
|
|
2901
|
-
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
2902
|
-
}
|
|
2946
|
+
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
2903
2947
|
} else {
|
|
2904
2948
|
emitLifecycleEvent(elm, "componentWillUpdate");
|
|
2905
|
-
|
|
2906
|
-
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
2907
|
-
}
|
|
2949
|
+
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
2908
2950
|
}
|
|
2909
2951
|
emitLifecycleEvent(elm, "componentWillRender");
|
|
2910
|
-
|
|
2911
|
-
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
2912
|
-
}
|
|
2952
|
+
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
2913
2953
|
endSchedule();
|
|
2914
2954
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
2915
2955
|
};
|
|
@@ -3017,14 +3057,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
3017
3057
|
const endPostUpdate = createTime("postUpdate", tagName);
|
|
3018
3058
|
const instance = import_app_data13.BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
3019
3059
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
3020
|
-
if (import_app_data13.BUILD.
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
3027
|
-
}
|
|
3060
|
+
if (import_app_data13.BUILD.isDev) {
|
|
3061
|
+
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
3062
|
+
}
|
|
3063
|
+
safeCall(instance, "componentDidRender", void 0, elm);
|
|
3064
|
+
if (import_app_data13.BUILD.isDev) {
|
|
3065
|
+
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
3028
3066
|
}
|
|
3029
3067
|
emitLifecycleEvent(elm, "componentDidRender");
|
|
3030
3068
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
@@ -3032,14 +3070,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
3032
3070
|
if (import_app_data13.BUILD.asyncLoading && import_app_data13.BUILD.cssAnnotations) {
|
|
3033
3071
|
addHydratedFlag(elm);
|
|
3034
3072
|
}
|
|
3035
|
-
if (import_app_data13.BUILD.
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
|
|
3042
|
-
}
|
|
3073
|
+
if (import_app_data13.BUILD.isDev) {
|
|
3074
|
+
hostRef.$flags$ |= 2048 /* devOnDidLoad */;
|
|
3075
|
+
}
|
|
3076
|
+
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
3077
|
+
if (import_app_data13.BUILD.isDev) {
|
|
3078
|
+
hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
|
|
3043
3079
|
}
|
|
3044
3080
|
emitLifecycleEvent(elm, "componentDidLoad");
|
|
3045
3081
|
endPostUpdate();
|
|
@@ -3050,14 +3086,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
3050
3086
|
}
|
|
3051
3087
|
}
|
|
3052
3088
|
} else {
|
|
3053
|
-
if (import_app_data13.BUILD.
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
3060
|
-
}
|
|
3089
|
+
if (import_app_data13.BUILD.isDev) {
|
|
3090
|
+
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
3091
|
+
}
|
|
3092
|
+
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
3093
|
+
if (import_app_data13.BUILD.isDev) {
|
|
3094
|
+
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
3061
3095
|
}
|
|
3062
3096
|
emitLifecycleEvent(elm, "componentDidUpdate");
|
|
3063
3097
|
endPostUpdate();
|
|
@@ -3189,7 +3223,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3189
3223
|
}
|
|
3190
3224
|
}
|
|
3191
3225
|
if (import_app_data14.BUILD.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
3192
|
-
if (
|
|
3226
|
+
if (instance.componentShouldUpdate) {
|
|
3193
3227
|
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
3194
3228
|
return;
|
|
3195
3229
|
}
|
|
@@ -3471,7 +3505,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3471
3505
|
}
|
|
3472
3506
|
};
|
|
3473
3507
|
var fireConnectedCallback = (instance, elm) => {
|
|
3474
|
-
if (import_app_data16.BUILD.lazyLoad
|
|
3508
|
+
if (import_app_data16.BUILD.lazyLoad) {
|
|
3475
3509
|
safeCall(instance, "connectedCallback", void 0, elm);
|
|
3476
3510
|
}
|
|
3477
3511
|
};
|
|
@@ -3542,7 +3576,10 @@ var connectedCallback = (elm) => {
|
|
|
3542
3576
|
}
|
|
3543
3577
|
};
|
|
3544
3578
|
var setContentReference = (elm) => {
|
|
3545
|
-
|
|
3579
|
+
if (!win.document) {
|
|
3580
|
+
return;
|
|
3581
|
+
}
|
|
3582
|
+
const contentRefElm = elm["s-cr"] = win.document.createComment(
|
|
3546
3583
|
import_app_data17.BUILD.isDebug ? `content-ref (host=${elm.localName})` : ""
|
|
3547
3584
|
);
|
|
3548
3585
|
contentRefElm["s-cn"] = true;
|
|
@@ -3552,12 +3589,9 @@ var setContentReference = (elm) => {
|
|
|
3552
3589
|
// src/runtime/disconnected-callback.ts
|
|
3553
3590
|
var import_app_data18 = require("@rindo/core/internal/app-data");
|
|
3554
3591
|
var disconnectInstance = (instance, elm) => {
|
|
3555
|
-
if (import_app_data18.BUILD.lazyLoad
|
|
3592
|
+
if (import_app_data18.BUILD.lazyLoad) {
|
|
3556
3593
|
safeCall(instance, "disconnectedCallback", void 0, elm || instance);
|
|
3557
3594
|
}
|
|
3558
|
-
if (import_app_data18.BUILD.cmpDidUnload) {
|
|
3559
|
-
safeCall(instance, "componentDidUnload", void 0, elm || instance);
|
|
3560
|
-
}
|
|
3561
3595
|
};
|
|
3562
3596
|
var disconnectedCallback = async (elm) => {
|
|
3563
3597
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
@@ -3643,25 +3677,15 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3643
3677
|
this.__hasHostListenerAttached = true;
|
|
3644
3678
|
}
|
|
3645
3679
|
connectedCallback(this);
|
|
3646
|
-
if (
|
|
3680
|
+
if (originalConnectedCallback) {
|
|
3647
3681
|
originalConnectedCallback.call(this);
|
|
3648
3682
|
}
|
|
3649
3683
|
},
|
|
3650
3684
|
disconnectedCallback() {
|
|
3651
3685
|
disconnectedCallback(this);
|
|
3652
|
-
if (
|
|
3686
|
+
if (originalDisconnectedCallback) {
|
|
3653
3687
|
originalDisconnectedCallback.call(this);
|
|
3654
3688
|
}
|
|
3655
|
-
plt.raf(() => {
|
|
3656
|
-
var _a;
|
|
3657
|
-
const hostRef = getHostRef(this);
|
|
3658
|
-
if (((_a = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
|
|
3659
|
-
delete hostRef.$vnode$;
|
|
3660
|
-
}
|
|
3661
|
-
if (this instanceof Node && !this.isConnected) {
|
|
3662
|
-
deleteHostRef(this);
|
|
3663
|
-
}
|
|
3664
|
-
});
|
|
3665
3689
|
},
|
|
3666
3690
|
__attachShadow() {
|
|
3667
3691
|
if (supportsShadow) {
|
|
@@ -3729,18 +3753,22 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3729
3753
|
performance.mark("st:app:start");
|
|
3730
3754
|
}
|
|
3731
3755
|
installDevTools();
|
|
3756
|
+
if (!win.document) {
|
|
3757
|
+
console.warn("Rindo: No document found. Skipping bootstrapping lazy components.");
|
|
3758
|
+
return;
|
|
3759
|
+
}
|
|
3732
3760
|
const endBootstrap = createTime("bootstrapLazy");
|
|
3733
3761
|
const cmpTags = [];
|
|
3734
3762
|
const exclude = options.exclude || [];
|
|
3735
3763
|
const customElements2 = win.customElements;
|
|
3736
|
-
const head =
|
|
3764
|
+
const head = win.document.head;
|
|
3737
3765
|
const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
|
|
3738
|
-
const dataStyles = /* @__PURE__ */
|
|
3766
|
+
const dataStyles = /* @__PURE__ */ win.document.createElement("style");
|
|
3739
3767
|
const deferredConnectedCallbacks = [];
|
|
3740
3768
|
let appLoadFallback;
|
|
3741
3769
|
let isBootstrapping = true;
|
|
3742
3770
|
Object.assign(plt, options);
|
|
3743
|
-
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./",
|
|
3771
|
+
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
|
|
3744
3772
|
if (import_app_data20.BUILD.asyncQueue) {
|
|
3745
3773
|
if (options.syncQueue) {
|
|
3746
3774
|
plt.$flags$ |= 4 /* queueSync */;
|
|
@@ -3890,7 +3918,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3890
3918
|
}
|
|
3891
3919
|
if (dataStyles.innerHTML.length) {
|
|
3892
3920
|
dataStyles.setAttribute("data-styles", "");
|
|
3893
|
-
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(
|
|
3921
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
3894
3922
|
if (nonce != null) {
|
|
3895
3923
|
dataStyles.setAttribute("nonce", nonce);
|
|
3896
3924
|
}
|
|
@@ -3916,7 +3944,7 @@ var Fragment = (_, children) => children;
|
|
|
3916
3944
|
// src/runtime/host-listener.ts
|
|
3917
3945
|
var import_app_data21 = require("@rindo/core/internal/app-data");
|
|
3918
3946
|
var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
3919
|
-
if (import_app_data21.BUILD.hostListener && listeners) {
|
|
3947
|
+
if (import_app_data21.BUILD.hostListener && listeners && win.document) {
|
|
3920
3948
|
if (import_app_data21.BUILD.hostListenerTargetParent) {
|
|
3921
3949
|
if (attachParentListeners) {
|
|
3922
3950
|
listeners = listeners.filter(([flags]) => flags & 32 /* TargetParent */);
|
|
@@ -3925,7 +3953,7 @@ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =>
|
|
|
3925
3953
|
}
|
|
3926
3954
|
}
|
|
3927
3955
|
listeners.map(([flags, name, method]) => {
|
|
3928
|
-
const target = import_app_data21.BUILD.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
|
|
3956
|
+
const target = import_app_data21.BUILD.hostListenerTarget ? getHostListenerTarget(win.document, elm, flags) : elm;
|
|
3929
3957
|
const handler = hostListenerProxy(hostRef, method);
|
|
3930
3958
|
const opts = hostListenerOpts(flags);
|
|
3931
3959
|
plt.ael(target, name, handler, opts);
|
|
@@ -3949,12 +3977,19 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
3949
3977
|
consoleError(e, hostRef.$hostElement$);
|
|
3950
3978
|
}
|
|
3951
3979
|
};
|
|
3952
|
-
var getHostListenerTarget = (elm, flags) => {
|
|
3953
|
-
if (import_app_data21.BUILD.hostListenerTargetDocument && flags & 4 /* TargetDocument */)
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
if (import_app_data21.BUILD.
|
|
3980
|
+
var getHostListenerTarget = (doc, elm, flags) => {
|
|
3981
|
+
if (import_app_data21.BUILD.hostListenerTargetDocument && flags & 4 /* TargetDocument */) {
|
|
3982
|
+
return doc;
|
|
3983
|
+
}
|
|
3984
|
+
if (import_app_data21.BUILD.hostListenerTargetWindow && flags & 8 /* TargetWindow */) {
|
|
3985
|
+
return win;
|
|
3986
|
+
}
|
|
3987
|
+
if (import_app_data21.BUILD.hostListenerTargetBody && flags & 16 /* TargetBody */) {
|
|
3988
|
+
return doc.body;
|
|
3989
|
+
}
|
|
3990
|
+
if (import_app_data21.BUILD.hostListenerTargetParent && flags & 32 /* TargetParent */ && elm.parentElement) {
|
|
3957
3991
|
return elm.parentElement;
|
|
3992
|
+
}
|
|
3958
3993
|
return elm;
|
|
3959
3994
|
};
|
|
3960
3995
|
var hostListenerOpts = (flags) => supportsListenerOptions ? {
|
|
@@ -3969,12 +4004,12 @@ var setNonce = (nonce) => plt.$nonce$ = nonce;
|
|
|
3969
4004
|
var setPlatformOptions = (opts) => Object.assign(plt, opts);
|
|
3970
4005
|
|
|
3971
4006
|
// src/runtime/vdom/vdom-annotations.ts
|
|
3972
|
-
var insertVdomAnnotations = (
|
|
3973
|
-
if (
|
|
3974
|
-
const docData = RINDO_DOC_DATA in
|
|
4007
|
+
var insertVdomAnnotations = (doc, staticComponents) => {
|
|
4008
|
+
if (doc != null) {
|
|
4009
|
+
const docData = RINDO_DOC_DATA in doc ? doc[RINDO_DOC_DATA] : { ...DEFAULT_DOC_DATA };
|
|
3975
4010
|
docData.staticComponents = new Set(staticComponents);
|
|
3976
4011
|
const orgLocationNodes = [];
|
|
3977
|
-
parseVNodeAnnotations(
|
|
4012
|
+
parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
|
|
3978
4013
|
orgLocationNodes.forEach((orgLocationNode) => {
|
|
3979
4014
|
var _a;
|
|
3980
4015
|
if (orgLocationNode != null && orgLocationNode["s-nr"]) {
|
|
@@ -4000,11 +4035,11 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
|
|
|
4000
4035
|
return;
|
|
4001
4036
|
}
|
|
4002
4037
|
}
|
|
4003
|
-
const commentBeforeTextNode =
|
|
4038
|
+
const commentBeforeTextNode = doc.createComment(childId);
|
|
4004
4039
|
commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
|
|
4005
4040
|
insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
|
|
4006
4041
|
} else if (nodeRef.nodeType === 8 /* CommentNode */) {
|
|
4007
|
-
const commentBeforeTextNode =
|
|
4042
|
+
const commentBeforeTextNode = doc.createComment(childId);
|
|
4008
4043
|
commentBeforeTextNode.nodeValue = `${COMMENT_NODE_ID}.${childId}`;
|
|
4009
4044
|
nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
|
|
4010
4045
|
}
|
|
@@ -4023,7 +4058,7 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
|
|
|
4023
4058
|
});
|
|
4024
4059
|
}
|
|
4025
4060
|
};
|
|
4026
|
-
var parseVNodeAnnotations = (
|
|
4061
|
+
var parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
|
|
4027
4062
|
var _a;
|
|
4028
4063
|
if (node == null) {
|
|
4029
4064
|
return;
|
|
@@ -4039,13 +4074,13 @@ var parseVNodeAnnotations = (doc2, node, docData, orgLocationNodes) => {
|
|
|
4039
4074
|
const cmpData = {
|
|
4040
4075
|
nodeIds: 0
|
|
4041
4076
|
};
|
|
4042
|
-
insertVNodeAnnotations(
|
|
4077
|
+
insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
|
|
4043
4078
|
}
|
|
4044
|
-
parseVNodeAnnotations(
|
|
4079
|
+
parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
|
|
4045
4080
|
});
|
|
4046
4081
|
}
|
|
4047
4082
|
};
|
|
4048
|
-
var insertVNodeAnnotations = (
|
|
4083
|
+
var insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
|
|
4049
4084
|
if (vnode != null) {
|
|
4050
4085
|
const hostId = ++docData.hostIds;
|
|
4051
4086
|
hostElm.setAttribute(HYDRATE_ID, hostId);
|
|
@@ -4055,7 +4090,7 @@ var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
|
|
|
4055
4090
|
if (vnode.$children$ != null) {
|
|
4056
4091
|
const depth = 0;
|
|
4057
4092
|
vnode.$children$.forEach((vnodeChild, index) => {
|
|
4058
|
-
insertChildVNodeAnnotations(
|
|
4093
|
+
insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
|
|
4059
4094
|
});
|
|
4060
4095
|
}
|
|
4061
4096
|
if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute(HYDRATE_CHILD_ID)) {
|
|
@@ -4076,7 +4111,7 @@ var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
|
|
|
4076
4111
|
}
|
|
4077
4112
|
}
|
|
4078
4113
|
};
|
|
4079
|
-
var insertChildVNodeAnnotations = (
|
|
4114
|
+
var insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
|
|
4080
4115
|
const childElm = vnodeChild.$elm$;
|
|
4081
4116
|
if (childElm == null) {
|
|
4082
4117
|
return;
|
|
@@ -4095,7 +4130,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
|
|
|
4095
4130
|
const nodeName = parentNode == null ? void 0 : parentNode.nodeName;
|
|
4096
4131
|
if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
|
|
4097
4132
|
const textNodeId = `${TEXT_NODE_ID}.${childId}`;
|
|
4098
|
-
const commentBeforeTextNode =
|
|
4133
|
+
const commentBeforeTextNode = doc.createComment(textNodeId);
|
|
4099
4134
|
insertBefore(parentNode, commentBeforeTextNode, childElm);
|
|
4100
4135
|
}
|
|
4101
4136
|
} else if (childElm.nodeType === 8 /* CommentNode */) {
|
|
@@ -4108,7 +4143,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
|
|
|
4108
4143
|
if (vnodeChild.$children$ != null) {
|
|
4109
4144
|
const childDepth = depth + 1;
|
|
4110
4145
|
vnodeChild.$children$.forEach((vnode, index2) => {
|
|
4111
|
-
insertChildVNodeAnnotations(
|
|
4146
|
+
insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index2);
|
|
4112
4147
|
});
|
|
4113
4148
|
}
|
|
4114
4149
|
};
|
|
@@ -4127,9 +4162,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
|
|
|
4127
4162
|
consoleError,
|
|
4128
4163
|
createEvent,
|
|
4129
4164
|
defineCustomElement,
|
|
4130
|
-
deleteHostRef,
|
|
4131
4165
|
disconnectedCallback,
|
|
4132
|
-
doc,
|
|
4133
4166
|
flushAll,
|
|
4134
4167
|
flushLoadModule,
|
|
4135
4168
|
flushQueue,
|