@rindo/core 4.25.3 → 4.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.cjs +4 -4
- package/cli/index.js +1 -1
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +1545 -1475
- 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 +639 -228
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/shadow-css.js +30 -6
- package/internal/hydrate/index.js +674 -233
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.d.ts +22 -5
- package/internal/hydrate/runner.js +34 -9
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +6 -13
- package/internal/rindo-public-compiler.d.ts +23 -6
- package/internal/testing/index.js +637 -242
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +233 -233
- package/mock-doc/index.d.ts +5 -1
- package/mock-doc/index.js +230 -230
- 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/jest/jest-27-and-under/matchers/html.d.ts +2 -1
- package/testing/jest/jest-28/matchers/html.d.ts +2 -1
- package/testing/jest/jest-29/matchers/html.d.ts +2 -1
- package/testing/package.json +1 -1
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,19 +15,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/testing/platform/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
33
23
|
Build: () => Build,
|
|
34
24
|
Env: () => import_app_data22.Env,
|
|
35
25
|
Fragment: () => Fragment,
|
|
@@ -43,7 +33,6 @@ __export(platform_exports, {
|
|
|
43
33
|
consoleError: () => consoleError,
|
|
44
34
|
createEvent: () => createEvent,
|
|
45
35
|
defineCustomElement: () => defineCustomElement,
|
|
46
|
-
deleteHostRef: () => deleteHostRef,
|
|
47
36
|
disconnectedCallback: () => disconnectedCallback,
|
|
48
37
|
doc: () => doc,
|
|
49
38
|
flushAll: () => flushAll,
|
|
@@ -92,7 +81,7 @@ __export(platform_exports, {
|
|
|
92
81
|
win: () => win,
|
|
93
82
|
writeTask: () => writeTask
|
|
94
83
|
});
|
|
95
|
-
module.exports = __toCommonJS(
|
|
84
|
+
module.exports = __toCommonJS(index_exports);
|
|
96
85
|
|
|
97
86
|
// src/testing/platform/testing-build.ts
|
|
98
87
|
var Build = {
|
|
@@ -112,13 +101,14 @@ var queuedReadTasks = [];
|
|
|
112
101
|
var moduleLoaded = /* @__PURE__ */ new Map();
|
|
113
102
|
var queuedLoadModules = [];
|
|
114
103
|
var caughtErrors = [];
|
|
115
|
-
var hostRefs = /* @__PURE__ */ new Map();
|
|
116
104
|
|
|
117
105
|
// src/testing/platform/testing-host-ref.ts
|
|
118
106
|
var getHostRef = (elm) => {
|
|
119
|
-
|
|
107
|
+
if (elm.__rindo__getHostRef) {
|
|
108
|
+
return elm.__rindo__getHostRef();
|
|
109
|
+
}
|
|
110
|
+
return void 0;
|
|
120
111
|
};
|
|
121
|
-
var deleteHostRef = (ref) => hostRefs.delete(ref);
|
|
122
112
|
var registerInstance = (lazyInstance, hostRef) => {
|
|
123
113
|
if (lazyInstance == null || lazyInstance.constructor == null) {
|
|
124
114
|
throw new Error(`Invalid component constructor`);
|
|
@@ -130,8 +120,8 @@ var registerInstance = (lazyInstance, hostRef) => {
|
|
|
130
120
|
registerHost(elm, { $flags$: 0, $tagName$: tagName });
|
|
131
121
|
hostRef = getHostRef(elm);
|
|
132
122
|
}
|
|
123
|
+
lazyInstance.__rindo__getHostRef = () => hostRef;
|
|
133
124
|
hostRef.$lazyInstance$ = lazyInstance;
|
|
134
|
-
return hostRefs.set(lazyInstance, hostRef);
|
|
135
125
|
};
|
|
136
126
|
var registerHost = (elm, cmpMeta) => {
|
|
137
127
|
const hostRef = {
|
|
@@ -145,7 +135,7 @@ var registerHost = (elm, cmpMeta) => {
|
|
|
145
135
|
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
|
|
146
136
|
elm["s-p"] = [];
|
|
147
137
|
elm["s-rc"] = [];
|
|
148
|
-
|
|
138
|
+
elm.__rindo__getHostRef = () => hostRef;
|
|
149
139
|
};
|
|
150
140
|
|
|
151
141
|
// src/testing/platform/testing-log.ts
|
|
@@ -325,7 +315,6 @@ function resetPlatform(defaults = {}) {
|
|
|
325
315
|
if (win && typeof win.close === "function") {
|
|
326
316
|
win.close();
|
|
327
317
|
}
|
|
328
|
-
hostRefs.clear();
|
|
329
318
|
styles.clear();
|
|
330
319
|
plt.$flags$ = 0;
|
|
331
320
|
Object.assign(plt, defaults);
|
|
@@ -411,6 +400,11 @@ function queryNonceMetaTagContent(doc2) {
|
|
|
411
400
|
return (_c = (_b = (_a = doc2.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
|
|
412
401
|
}
|
|
413
402
|
|
|
403
|
+
// src/utils/regular-expression.ts
|
|
404
|
+
var escapeRegExpSpecialCharacters = (text) => {
|
|
405
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
406
|
+
};
|
|
407
|
+
|
|
414
408
|
// src/utils/result.ts
|
|
415
409
|
var result_exports = {};
|
|
416
410
|
__export(result_exports, {
|
|
@@ -499,12 +493,11 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
|
|
499
493
|
|
|
500
494
|
// src/runtime/slot-polyfill-utils.ts
|
|
501
495
|
var updateFallbackSlotVisibility = (elm) => {
|
|
502
|
-
const childNodes = elm
|
|
496
|
+
const childNodes = internalCall(elm, "childNodes");
|
|
503
497
|
if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
|
|
504
498
|
getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
|
|
505
|
-
var _a;
|
|
506
499
|
if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
|
|
507
|
-
if ((
|
|
500
|
+
if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
|
|
508
501
|
slotNode.hidden = true;
|
|
509
502
|
} else {
|
|
510
503
|
slotNode.hidden = false;
|
|
@@ -512,8 +505,10 @@ var updateFallbackSlotVisibility = (elm) => {
|
|
|
512
505
|
}
|
|
513
506
|
});
|
|
514
507
|
}
|
|
515
|
-
|
|
516
|
-
|
|
508
|
+
let i2 = 0;
|
|
509
|
+
for (i2 = 0; i2 < childNodes.length; i2++) {
|
|
510
|
+
const childNode = childNodes[i2];
|
|
511
|
+
if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
|
|
517
512
|
updateFallbackSlotVisibility(childNode);
|
|
518
513
|
}
|
|
519
514
|
}
|
|
@@ -534,7 +529,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
534
529
|
let childNode;
|
|
535
530
|
for (; i2 < childNodes.length; i2++) {
|
|
536
531
|
childNode = childNodes[i2];
|
|
537
|
-
if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode
|
|
532
|
+
if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
|
|
538
533
|
slottedNodes.push(childNode);
|
|
539
534
|
if (typeof slotName !== "undefined") return slottedNodes;
|
|
540
535
|
}
|
|
@@ -542,11 +537,12 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
542
537
|
}
|
|
543
538
|
return slottedNodes;
|
|
544
539
|
}
|
|
545
|
-
var
|
|
540
|
+
var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
|
|
546
541
|
const childNodes = [];
|
|
547
|
-
if (includeSlot &&
|
|
548
|
-
|
|
549
|
-
|
|
542
|
+
if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
|
|
543
|
+
let node = slot;
|
|
544
|
+
while (node = node.nextSibling) {
|
|
545
|
+
if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
|
|
550
546
|
}
|
|
551
547
|
return childNodes;
|
|
552
548
|
};
|
|
@@ -566,38 +562,73 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
|
|
|
566
562
|
return slotName === "";
|
|
567
563
|
};
|
|
568
564
|
var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
|
|
569
|
-
let slottedNodeLocation;
|
|
570
565
|
if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
|
|
571
|
-
|
|
572
|
-
} else {
|
|
573
|
-
slottedNodeLocation = document.createTextNode("");
|
|
574
|
-
slottedNodeLocation["s-nr"] = newChild;
|
|
566
|
+
return;
|
|
575
567
|
}
|
|
568
|
+
const slottedNodeLocation = document.createTextNode("");
|
|
569
|
+
slottedNodeLocation["s-nr"] = newChild;
|
|
576
570
|
if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
|
|
577
571
|
const parent = slotNode["s-cr"].parentNode;
|
|
578
|
-
const appendMethod = prepend ? parent
|
|
579
|
-
if (typeof position !== "undefined") {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
|
|
593
|
-
}
|
|
572
|
+
const appendMethod = prepend ? internalCall(parent, "prepend") : internalCall(parent, "appendChild");
|
|
573
|
+
if (import_app_data.BUILD.hydrateClientSide && typeof position !== "undefined") {
|
|
574
|
+
slottedNodeLocation["s-oo"] = position;
|
|
575
|
+
const childNodes = internalCall(parent, "childNodes");
|
|
576
|
+
const slotRelocateNodes = [slottedNodeLocation];
|
|
577
|
+
childNodes.forEach((n) => {
|
|
578
|
+
if (n["s-nr"]) slotRelocateNodes.push(n);
|
|
579
|
+
});
|
|
580
|
+
slotRelocateNodes.sort((a, b) => {
|
|
581
|
+
if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
|
|
582
|
+
else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
|
|
583
|
+
return 0;
|
|
584
|
+
});
|
|
585
|
+
slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
|
|
594
586
|
} else {
|
|
595
587
|
appendMethod.call(parent, slottedNodeLocation);
|
|
596
588
|
}
|
|
597
589
|
newChild["s-ol"] = slottedNodeLocation;
|
|
598
590
|
newChild["s-sh"] = slotNode["s-hn"];
|
|
599
591
|
};
|
|
600
|
-
var getSlotName = (node) => node["s-sn"]
|
|
592
|
+
var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
|
|
593
|
+
function patchSlotNode(node) {
|
|
594
|
+
if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
|
|
595
|
+
const assignedFactory = (elementsOnly) => (function(opts) {
|
|
596
|
+
const toReturn = [];
|
|
597
|
+
const slotName = this["s-sn"];
|
|
598
|
+
if (opts == null ? void 0 : opts.flatten) {
|
|
599
|
+
console.error(`
|
|
600
|
+
Flattening is not supported for Rindo non-shadow slots.
|
|
601
|
+
You can use \`.childNodes\` to nested slot fallback content.
|
|
602
|
+
If you have a particular use case, please open an issue on the Rindo repo.
|
|
603
|
+
`);
|
|
604
|
+
}
|
|
605
|
+
const parent = this["s-cr"].parentElement;
|
|
606
|
+
const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
|
|
607
|
+
slottedNodes.forEach((n) => {
|
|
608
|
+
if (slotName === getSlotName(n)) {
|
|
609
|
+
toReturn.push(n);
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
if (elementsOnly) {
|
|
613
|
+
return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
|
|
614
|
+
}
|
|
615
|
+
return toReturn;
|
|
616
|
+
}).bind(node);
|
|
617
|
+
node.assignedElements = assignedFactory(true);
|
|
618
|
+
node.assignedNodes = assignedFactory(false);
|
|
619
|
+
}
|
|
620
|
+
function dispatchSlotChangeEvent(elm) {
|
|
621
|
+
elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
|
|
622
|
+
}
|
|
623
|
+
function findSlotFromSlottedNode(slottedNode, parentHost) {
|
|
624
|
+
var _a;
|
|
625
|
+
parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
|
|
626
|
+
if (!parentHost) return { slotNode: null, slotName: "" };
|
|
627
|
+
const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
|
|
628
|
+
const childNodes = internalCall(parentHost, "childNodes");
|
|
629
|
+
const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
|
|
630
|
+
return { slotNode, slotName };
|
|
631
|
+
}
|
|
601
632
|
|
|
602
633
|
// src/runtime/dom-extras.ts
|
|
603
634
|
var patchPseudoShadowDom = (hostElementPrototype) => {
|
|
@@ -661,19 +692,14 @@ var patchCloneNode = (HostElementPrototype) => {
|
|
|
661
692
|
var patchSlotAppendChild = (HostElementPrototype) => {
|
|
662
693
|
HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
|
|
663
694
|
HostElementPrototype.appendChild = function(newChild) {
|
|
664
|
-
const slotName
|
|
665
|
-
const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
|
|
695
|
+
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
666
696
|
if (slotNode) {
|
|
667
697
|
addSlotRelocateNode(newChild, slotNode);
|
|
668
|
-
const slotChildNodes =
|
|
698
|
+
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
669
699
|
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
670
|
-
const parent =
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
insertedNode = parent.__insertBefore(newChild, appendAfter.nextSibling);
|
|
674
|
-
} else {
|
|
675
|
-
insertedNode = parent.insertBefore(newChild, appendAfter.nextSibling);
|
|
676
|
-
}
|
|
700
|
+
const parent = internalCall(appendAfter, "parentNode");
|
|
701
|
+
const insertedNode = internalCall(parent, "insertBefore")(newChild, appendAfter.nextSibling);
|
|
702
|
+
dispatchSlotChangeEvent(slotNode);
|
|
677
703
|
updateFallbackSlotVisibility(this);
|
|
678
704
|
return insertedNode;
|
|
679
705
|
}
|
|
@@ -702,19 +728,17 @@ var patchSlotPrepend = (HostElementPrototype) => {
|
|
|
702
728
|
if (typeof newChild === "string") {
|
|
703
729
|
newChild = this.ownerDocument.createTextNode(newChild);
|
|
704
730
|
}
|
|
705
|
-
const slotName = newChild["s-sn"] = getSlotName(newChild);
|
|
706
|
-
const childNodes = this
|
|
731
|
+
const slotName = (newChild["s-sn"] = getSlotName(newChild)) || "";
|
|
732
|
+
const childNodes = internalCall(this, "childNodes");
|
|
707
733
|
const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
|
|
708
734
|
if (slotNode) {
|
|
709
735
|
addSlotRelocateNode(newChild, slotNode, true);
|
|
710
|
-
const slotChildNodes =
|
|
736
|
+
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
711
737
|
const appendAfter = slotChildNodes[0];
|
|
712
|
-
const parent =
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
return parent.insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
|
|
717
|
-
}
|
|
738
|
+
const parent = internalCall(appendAfter, "parentNode");
|
|
739
|
+
const toReturn = internalCall(parent, "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
|
|
740
|
+
dispatchSlotChangeEvent(slotNode);
|
|
741
|
+
return toReturn;
|
|
718
742
|
}
|
|
719
743
|
if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
|
|
720
744
|
newChild.hidden = true;
|
|
@@ -764,8 +788,7 @@ var patchInsertBefore = (HostElementPrototype) => {
|
|
|
764
788
|
if (eleProto.__insertBefore) return;
|
|
765
789
|
eleProto.__insertBefore = HostElementPrototype.insertBefore;
|
|
766
790
|
HostElementPrototype.insertBefore = function(newChild, currentChild) {
|
|
767
|
-
const slotName
|
|
768
|
-
const slotNode = getHostSlotNodes(this.__childNodes, this.tagName, slotName)[0];
|
|
791
|
+
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
769
792
|
const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
|
|
770
793
|
if (slotNode) {
|
|
771
794
|
let found = false;
|
|
@@ -778,18 +801,19 @@ var patchInsertBefore = (HostElementPrototype) => {
|
|
|
778
801
|
}
|
|
779
802
|
if (slotName === currentChild["s-sn"]) {
|
|
780
803
|
addSlotRelocateNode(newChild, slotNode);
|
|
781
|
-
const parent =
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
} else {
|
|
785
|
-
parent.insertBefore(newChild, currentChild);
|
|
786
|
-
}
|
|
804
|
+
const parent = internalCall(currentChild, "parentNode");
|
|
805
|
+
internalCall(parent, "insertBefore")(newChild, currentChild);
|
|
806
|
+
dispatchSlotChangeEvent(slotNode);
|
|
787
807
|
}
|
|
788
808
|
return;
|
|
789
809
|
}
|
|
790
810
|
});
|
|
791
811
|
if (found) return newChild;
|
|
792
812
|
}
|
|
813
|
+
const parentNode = currentChild == null ? void 0 : currentChild.__parentNode;
|
|
814
|
+
if (parentNode && !this.isSameNode(parentNode)) {
|
|
815
|
+
return this.appendChild(newChild);
|
|
816
|
+
}
|
|
793
817
|
return this.__insertBefore(newChild, currentChild);
|
|
794
818
|
};
|
|
795
819
|
};
|
|
@@ -867,7 +891,7 @@ var patchChildSlotNodes = (elm) => {
|
|
|
867
891
|
});
|
|
868
892
|
};
|
|
869
893
|
var patchSlottedNode = (node) => {
|
|
870
|
-
if (!node || node.__nextSibling || !globalThis.Node) return;
|
|
894
|
+
if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
|
|
871
895
|
patchNextSibling(node);
|
|
872
896
|
patchPreviousSibling(node);
|
|
873
897
|
patchParentNode(node);
|
|
@@ -971,11 +995,14 @@ function patchHostOriginalAccessor(accessorName, node) {
|
|
|
971
995
|
}
|
|
972
996
|
if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
|
|
973
997
|
}
|
|
974
|
-
function
|
|
998
|
+
function internalCall(node, method) {
|
|
975
999
|
if ("__" + method in node) {
|
|
976
|
-
|
|
1000
|
+
const toReturn = node["__" + method];
|
|
1001
|
+
if (typeof toReturn !== "function") return toReturn;
|
|
1002
|
+
return toReturn.bind(node);
|
|
977
1003
|
} else {
|
|
978
|
-
return node[method];
|
|
1004
|
+
if (typeof node[method] !== "function") return node[method];
|
|
1005
|
+
return node[method].bind(node);
|
|
979
1006
|
}
|
|
980
1007
|
}
|
|
981
1008
|
|
|
@@ -1225,7 +1252,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1225
1252
|
delete hostElm["s-sc"];
|
|
1226
1253
|
}
|
|
1227
1254
|
}
|
|
1228
|
-
if (!plt.$orgLocNodes$) {
|
|
1255
|
+
if (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size) {
|
|
1229
1256
|
initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
|
|
1230
1257
|
}
|
|
1231
1258
|
hostElm[HYDRATE_ID] = hostId;
|
|
@@ -1319,13 +1346,25 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1319
1346
|
slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
|
|
1320
1347
|
});
|
|
1321
1348
|
}
|
|
1322
|
-
if (import_app_data5.BUILD.shadowDom && shadowRoot) {
|
|
1349
|
+
if (import_app_data5.BUILD.shadowDom && shadowRoot && !shadowRoot.childNodes.length) {
|
|
1323
1350
|
let rnIdex = 0;
|
|
1324
1351
|
const rnLen = shadowRootNodes.length;
|
|
1325
|
-
|
|
1326
|
-
|
|
1352
|
+
if (rnLen) {
|
|
1353
|
+
for (rnIdex; rnIdex < rnLen; rnIdex++) {
|
|
1354
|
+
shadowRoot.appendChild(shadowRootNodes[rnIdex]);
|
|
1355
|
+
}
|
|
1356
|
+
Array.from(hostElm.childNodes).forEach((node) => {
|
|
1357
|
+
if (typeof node["s-sn"] !== "string") {
|
|
1358
|
+
if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
|
|
1359
|
+
node.removeAttribute("hidden");
|
|
1360
|
+
} else if (node.nodeType === 8 /* CommentNode */ || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
|
|
1361
|
+
node.parentNode.removeChild(node);
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1327
1365
|
}
|
|
1328
1366
|
}
|
|
1367
|
+
plt.$orgLocNodes$.delete(hostElm["s-id"]);
|
|
1329
1368
|
hostRef.$hostElement$ = hostElm;
|
|
1330
1369
|
endHydrate();
|
|
1331
1370
|
};
|
|
@@ -1436,7 +1475,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1436
1475
|
$text$: null
|
|
1437
1476
|
});
|
|
1438
1477
|
if (childNodeType === TEXT_NODE_ID) {
|
|
1439
|
-
childVNode.$elm$ = node
|
|
1478
|
+
childVNode.$elm$ = findCorrespondingNode(node, 3 /* TextNode */);
|
|
1440
1479
|
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
|
|
1441
1480
|
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
1442
1481
|
childRenderNodes.push(childVNode);
|
|
@@ -1452,7 +1491,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1452
1491
|
}
|
|
1453
1492
|
}
|
|
1454
1493
|
} else if (childNodeType === COMMENT_NODE_ID) {
|
|
1455
|
-
childVNode.$elm$ = node
|
|
1494
|
+
childVNode.$elm$ = findCorrespondingNode(node, 8 /* CommentNode */);
|
|
1456
1495
|
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
|
|
1457
1496
|
childRenderNodes.push(childVNode);
|
|
1458
1497
|
node.remove();
|
|
@@ -1486,6 +1525,10 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1486
1525
|
vnode.$elm$ = node;
|
|
1487
1526
|
vnode.$index$ = "0";
|
|
1488
1527
|
parentVNode.$children$ = [vnode];
|
|
1528
|
+
} else {
|
|
1529
|
+
if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
|
|
1530
|
+
node.remove();
|
|
1531
|
+
}
|
|
1489
1532
|
}
|
|
1490
1533
|
return parentVNode;
|
|
1491
1534
|
};
|
|
@@ -1555,6 +1598,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
|
|
|
1555
1598
|
const slot = childVNode.$elm$;
|
|
1556
1599
|
const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
|
|
1557
1600
|
addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
|
|
1601
|
+
patchSlotNode(node);
|
|
1558
1602
|
if (shouldMove) {
|
|
1559
1603
|
parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
|
|
1560
1604
|
}
|
|
@@ -1575,10 +1619,367 @@ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) =>
|
|
|
1575
1619
|
slottedNode = slottedNode.nextSibling;
|
|
1576
1620
|
}
|
|
1577
1621
|
};
|
|
1622
|
+
var findCorrespondingNode = (node, type) => {
|
|
1623
|
+
let sibling = node;
|
|
1624
|
+
do {
|
|
1625
|
+
sibling = sibling.nextSibling;
|
|
1626
|
+
} while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
|
|
1627
|
+
return sibling;
|
|
1628
|
+
};
|
|
1578
1629
|
|
|
1579
1630
|
// src/runtime/initialize-component.ts
|
|
1580
1631
|
var import_app_data16 = require("@rindo/core/internal/app-data");
|
|
1581
1632
|
|
|
1633
|
+
// src/utils/shadow-css.ts
|
|
1634
|
+
/**
|
|
1635
|
+
* @license
|
|
1636
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
1637
|
+
*
|
|
1638
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1639
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1640
|
+
*
|
|
1641
|
+
* This file is a port of shadowCSS from `webcomponents.js` to TypeScript.
|
|
1642
|
+
* https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
|
|
1643
|
+
* https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
|
|
1644
|
+
*/
|
|
1645
|
+
var safeSelector = (selector) => {
|
|
1646
|
+
const placeholders = [];
|
|
1647
|
+
let index = 0;
|
|
1648
|
+
selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
|
|
1649
|
+
const replaceBy = `__ph-${index}__`;
|
|
1650
|
+
placeholders.push(keep);
|
|
1651
|
+
index++;
|
|
1652
|
+
return replaceBy;
|
|
1653
|
+
});
|
|
1654
|
+
const content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
|
|
1655
|
+
const replaceBy = `__ph-${index}__`;
|
|
1656
|
+
placeholders.push(exp);
|
|
1657
|
+
index++;
|
|
1658
|
+
return pseudo + replaceBy;
|
|
1659
|
+
});
|
|
1660
|
+
const ss = {
|
|
1661
|
+
content,
|
|
1662
|
+
placeholders
|
|
1663
|
+
};
|
|
1664
|
+
return ss;
|
|
1665
|
+
};
|
|
1666
|
+
var restoreSafeSelector = (placeholders, content) => {
|
|
1667
|
+
return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
|
|
1668
|
+
};
|
|
1669
|
+
var _polyfillHost = "-shadowcsshost";
|
|
1670
|
+
var _polyfillSlotted = "-shadowcssslotted";
|
|
1671
|
+
var _polyfillHostContext = "-shadowcsscontext";
|
|
1672
|
+
var _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
|
|
1673
|
+
var _cssColonHostRe = new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
|
|
1674
|
+
var _cssColonHostContextRe = new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
|
|
1675
|
+
var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
|
|
1676
|
+
var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
|
|
1677
|
+
var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
1678
|
+
var _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
|
|
1679
|
+
var _selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$";
|
|
1680
|
+
var _polyfillHostRe = /-shadowcsshost/gim;
|
|
1681
|
+
var createSupportsRuleRe = (selector) => new RegExp(`((?<!(^@supports(.*)))|(?<={.*))(${selector}\\b)`, "gim");
|
|
1682
|
+
var _colonSlottedRe = createSupportsRuleRe("::slotted");
|
|
1683
|
+
var _colonHostRe = createSupportsRuleRe(":host");
|
|
1684
|
+
var _colonHostContextRe = createSupportsRuleRe(":host-context");
|
|
1685
|
+
var _commentRe = /\/\*\s*[\s\S]*?\*\//g;
|
|
1686
|
+
var stripComments = (input) => {
|
|
1687
|
+
return input.replace(_commentRe, "");
|
|
1688
|
+
};
|
|
1689
|
+
var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
|
|
1690
|
+
var extractCommentsWithHash = (input) => {
|
|
1691
|
+
return input.match(_commentWithHashRe) || [];
|
|
1692
|
+
};
|
|
1693
|
+
var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
|
|
1694
|
+
var _curlyRe = /([{}])/g;
|
|
1695
|
+
var _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/;
|
|
1696
|
+
var OPEN_CURLY = "{";
|
|
1697
|
+
var CLOSE_CURLY = "}";
|
|
1698
|
+
var BLOCK_PLACEHOLDER = "%BLOCK%";
|
|
1699
|
+
var processRules = (input, ruleCallback) => {
|
|
1700
|
+
const inputWithEscapedBlocks = escapeBlocks(input);
|
|
1701
|
+
let nextBlockIndex = 0;
|
|
1702
|
+
return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
|
|
1703
|
+
const selector = m[2];
|
|
1704
|
+
let content = "";
|
|
1705
|
+
let suffix = m[4];
|
|
1706
|
+
let contentPrefix = "";
|
|
1707
|
+
if (suffix && suffix.startsWith("{" + BLOCK_PLACEHOLDER)) {
|
|
1708
|
+
content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
|
|
1709
|
+
suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
|
|
1710
|
+
contentPrefix = "{";
|
|
1711
|
+
}
|
|
1712
|
+
const cssRule = {
|
|
1713
|
+
selector,
|
|
1714
|
+
content
|
|
1715
|
+
};
|
|
1716
|
+
const rule = ruleCallback(cssRule);
|
|
1717
|
+
return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
|
|
1718
|
+
});
|
|
1719
|
+
};
|
|
1720
|
+
var escapeBlocks = (input) => {
|
|
1721
|
+
const inputParts = input.split(_curlyRe);
|
|
1722
|
+
const resultParts = [];
|
|
1723
|
+
const escapedBlocks = [];
|
|
1724
|
+
let bracketCount = 0;
|
|
1725
|
+
let currentBlockParts = [];
|
|
1726
|
+
for (let partIndex = 0; partIndex < inputParts.length; partIndex++) {
|
|
1727
|
+
const part = inputParts[partIndex];
|
|
1728
|
+
if (part === CLOSE_CURLY) {
|
|
1729
|
+
bracketCount--;
|
|
1730
|
+
}
|
|
1731
|
+
if (bracketCount > 0) {
|
|
1732
|
+
currentBlockParts.push(part);
|
|
1733
|
+
} else {
|
|
1734
|
+
if (currentBlockParts.length > 0) {
|
|
1735
|
+
escapedBlocks.push(currentBlockParts.join(""));
|
|
1736
|
+
resultParts.push(BLOCK_PLACEHOLDER);
|
|
1737
|
+
currentBlockParts = [];
|
|
1738
|
+
}
|
|
1739
|
+
resultParts.push(part);
|
|
1740
|
+
}
|
|
1741
|
+
if (part === OPEN_CURLY) {
|
|
1742
|
+
bracketCount++;
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
if (currentBlockParts.length > 0) {
|
|
1746
|
+
escapedBlocks.push(currentBlockParts.join(""));
|
|
1747
|
+
resultParts.push(BLOCK_PLACEHOLDER);
|
|
1748
|
+
}
|
|
1749
|
+
const strEscapedBlocks = {
|
|
1750
|
+
escapedString: resultParts.join(""),
|
|
1751
|
+
blocks: escapedBlocks
|
|
1752
|
+
};
|
|
1753
|
+
return strEscapedBlocks;
|
|
1754
|
+
};
|
|
1755
|
+
var insertPolyfillHostInCssText = (cssText) => {
|
|
1756
|
+
cssText = cssText.replace(_colonHostContextRe, `$1${_polyfillHostContext}`).replace(_colonHostRe, `$1${_polyfillHost}`).replace(_colonSlottedRe, `$1${_polyfillSlotted}`);
|
|
1757
|
+
return cssText;
|
|
1758
|
+
};
|
|
1759
|
+
var convertColonRule = (cssText, regExp, partReplacer) => {
|
|
1760
|
+
return cssText.replace(regExp, (...m) => {
|
|
1761
|
+
if (m[2]) {
|
|
1762
|
+
const parts = m[2].split(",");
|
|
1763
|
+
const r = [];
|
|
1764
|
+
for (let i2 = 0; i2 < parts.length; i2++) {
|
|
1765
|
+
const p = parts[i2].trim();
|
|
1766
|
+
if (!p) break;
|
|
1767
|
+
r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
|
|
1768
|
+
}
|
|
1769
|
+
return r.join(",");
|
|
1770
|
+
} else {
|
|
1771
|
+
return _polyfillHostNoCombinator + m[3];
|
|
1772
|
+
}
|
|
1773
|
+
});
|
|
1774
|
+
};
|
|
1775
|
+
var colonHostPartReplacer = (host, part, suffix) => {
|
|
1776
|
+
return host + part.replace(_polyfillHost, "") + suffix;
|
|
1777
|
+
};
|
|
1778
|
+
var convertColonHost = (cssText) => {
|
|
1779
|
+
return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer);
|
|
1780
|
+
};
|
|
1781
|
+
var colonHostContextPartReplacer = (host, part, suffix) => {
|
|
1782
|
+
if (part.indexOf(_polyfillHost) > -1) {
|
|
1783
|
+
return colonHostPartReplacer(host, part, suffix);
|
|
1784
|
+
} else {
|
|
1785
|
+
return host + part + suffix + ", " + part + " " + host + suffix;
|
|
1786
|
+
}
|
|
1787
|
+
};
|
|
1788
|
+
var convertColonSlotted = (cssText, slotScopeId) => {
|
|
1789
|
+
const slotClass = "." + slotScopeId + " > ";
|
|
1790
|
+
const selectors = [];
|
|
1791
|
+
cssText = cssText.replace(_cssColonSlottedRe, (...m) => {
|
|
1792
|
+
if (m[2]) {
|
|
1793
|
+
const compound = m[2].trim();
|
|
1794
|
+
const suffix = m[3];
|
|
1795
|
+
const slottedSelector = slotClass + compound + suffix;
|
|
1796
|
+
let prefixSelector = "";
|
|
1797
|
+
for (let i2 = m[4] - 1; i2 >= 0; i2--) {
|
|
1798
|
+
const char = m[5][i2];
|
|
1799
|
+
if (char === "}" || char === ",") {
|
|
1800
|
+
break;
|
|
1801
|
+
}
|
|
1802
|
+
prefixSelector = char + prefixSelector;
|
|
1803
|
+
}
|
|
1804
|
+
const orgSelector = (prefixSelector + slottedSelector).trim();
|
|
1805
|
+
const addedSelector = `${prefixSelector.trimEnd()}${slottedSelector.trim()}`.trim();
|
|
1806
|
+
if (orgSelector !== addedSelector) {
|
|
1807
|
+
const updatedSelector = `${addedSelector}, ${orgSelector}`;
|
|
1808
|
+
selectors.push({
|
|
1809
|
+
orgSelector,
|
|
1810
|
+
updatedSelector
|
|
1811
|
+
});
|
|
1812
|
+
}
|
|
1813
|
+
return slottedSelector;
|
|
1814
|
+
} else {
|
|
1815
|
+
return _polyfillHostNoCombinator + m[3];
|
|
1816
|
+
}
|
|
1817
|
+
});
|
|
1818
|
+
return {
|
|
1819
|
+
selectors,
|
|
1820
|
+
cssText
|
|
1821
|
+
};
|
|
1822
|
+
};
|
|
1823
|
+
var convertColonHostContext = (cssText) => {
|
|
1824
|
+
return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer);
|
|
1825
|
+
};
|
|
1826
|
+
var convertShadowDOMSelectors = (cssText) => {
|
|
1827
|
+
return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, " "), cssText);
|
|
1828
|
+
};
|
|
1829
|
+
var makeScopeMatcher = (scopeSelector2) => {
|
|
1830
|
+
const lre = /\[/g;
|
|
1831
|
+
const rre = /\]/g;
|
|
1832
|
+
scopeSelector2 = scopeSelector2.replace(lre, "\\[").replace(rre, "\\]");
|
|
1833
|
+
return new RegExp("^(" + scopeSelector2 + ")" + _selectorReSuffix, "m");
|
|
1834
|
+
};
|
|
1835
|
+
var selectorNeedsScoping = (selector, scopeSelector2) => {
|
|
1836
|
+
const re = makeScopeMatcher(scopeSelector2);
|
|
1837
|
+
return !re.test(selector);
|
|
1838
|
+
};
|
|
1839
|
+
var injectScopingSelector = (selector, scopingSelector) => {
|
|
1840
|
+
return selector.replace(_selectorPartsRe, (_, before = "", _colonGroup, colon = "", after = "") => {
|
|
1841
|
+
return before + scopingSelector + colon + after;
|
|
1842
|
+
});
|
|
1843
|
+
};
|
|
1844
|
+
var applySimpleSelectorScope = (selector, scopeSelector2, hostSelector) => {
|
|
1845
|
+
_polyfillHostRe.lastIndex = 0;
|
|
1846
|
+
if (_polyfillHostRe.test(selector)) {
|
|
1847
|
+
const replaceBy = `.${hostSelector}`;
|
|
1848
|
+
return selector.replace(_polyfillHostNoCombinatorRe, (_, selector2) => injectScopingSelector(selector2, replaceBy)).replace(_polyfillHostRe, replaceBy + " ");
|
|
1849
|
+
}
|
|
1850
|
+
return scopeSelector2 + " " + selector;
|
|
1851
|
+
};
|
|
1852
|
+
var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
|
|
1853
|
+
const isRe = /\[is=([^\]]*)\]/g;
|
|
1854
|
+
scopeSelector2 = scopeSelector2.replace(isRe, (_, ...parts) => parts[0]);
|
|
1855
|
+
const className = "." + scopeSelector2;
|
|
1856
|
+
const _scopeSelectorPart = (p) => {
|
|
1857
|
+
let scopedP = p.trim();
|
|
1858
|
+
if (!scopedP) {
|
|
1859
|
+
return "";
|
|
1860
|
+
}
|
|
1861
|
+
if (p.indexOf(_polyfillHostNoCombinator) > -1) {
|
|
1862
|
+
scopedP = applySimpleSelectorScope(p, scopeSelector2, hostSelector);
|
|
1863
|
+
} else {
|
|
1864
|
+
const t = p.replace(_polyfillHostRe, "");
|
|
1865
|
+
if (t.length > 0) {
|
|
1866
|
+
scopedP = injectScopingSelector(t, className);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
return scopedP;
|
|
1870
|
+
};
|
|
1871
|
+
const safeContent = safeSelector(selector);
|
|
1872
|
+
selector = safeContent.content;
|
|
1873
|
+
let scopedSelector = "";
|
|
1874
|
+
let startIndex = 0;
|
|
1875
|
+
let res;
|
|
1876
|
+
const sep = /( |>|\+|~(?!=))\s*/g;
|
|
1877
|
+
const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
|
|
1878
|
+
let shouldScope = !hasHost;
|
|
1879
|
+
while ((res = sep.exec(selector)) !== null) {
|
|
1880
|
+
const separator = res[1];
|
|
1881
|
+
const part2 = selector.slice(startIndex, res.index).trim();
|
|
1882
|
+
shouldScope = shouldScope || part2.indexOf(_polyfillHostNoCombinator) > -1;
|
|
1883
|
+
const scopedPart = shouldScope ? _scopeSelectorPart(part2) : part2;
|
|
1884
|
+
scopedSelector += `${scopedPart} ${separator} `;
|
|
1885
|
+
startIndex = sep.lastIndex;
|
|
1886
|
+
}
|
|
1887
|
+
const part = selector.substring(startIndex);
|
|
1888
|
+
shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
|
|
1889
|
+
scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
|
|
1890
|
+
return restoreSafeSelector(safeContent.placeholders, scopedSelector);
|
|
1891
|
+
};
|
|
1892
|
+
var scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => {
|
|
1893
|
+
return selector.split(",").map((shallowPart) => {
|
|
1894
|
+
if (slotSelector && shallowPart.indexOf("." + slotSelector) > -1) {
|
|
1895
|
+
return shallowPart.trim();
|
|
1896
|
+
}
|
|
1897
|
+
if (selectorNeedsScoping(shallowPart, scopeSelectorText)) {
|
|
1898
|
+
return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim();
|
|
1899
|
+
} else {
|
|
1900
|
+
return shallowPart.trim();
|
|
1901
|
+
}
|
|
1902
|
+
}).join(", ");
|
|
1903
|
+
};
|
|
1904
|
+
var scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
1905
|
+
return processRules(cssText, (rule) => {
|
|
1906
|
+
let selector = rule.selector;
|
|
1907
|
+
let content = rule.content;
|
|
1908
|
+
if (rule.selector[0] !== "@") {
|
|
1909
|
+
selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
|
|
1910
|
+
} else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) {
|
|
1911
|
+
content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
|
|
1912
|
+
}
|
|
1913
|
+
const cssRule = {
|
|
1914
|
+
selector: selector.replace(/\s{2,}/g, " ").trim(),
|
|
1915
|
+
content
|
|
1916
|
+
};
|
|
1917
|
+
return cssRule;
|
|
1918
|
+
});
|
|
1919
|
+
};
|
|
1920
|
+
var scopeCssText = (cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector) => {
|
|
1921
|
+
cssText = insertPolyfillHostInCssText(cssText);
|
|
1922
|
+
cssText = convertColonHost(cssText);
|
|
1923
|
+
cssText = convertColonHostContext(cssText);
|
|
1924
|
+
const slotted = convertColonSlotted(cssText, slotScopeId);
|
|
1925
|
+
cssText = slotted.cssText;
|
|
1926
|
+
cssText = convertShadowDOMSelectors(cssText);
|
|
1927
|
+
if (scopeId2) {
|
|
1928
|
+
cssText = scopeSelectors(cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
1929
|
+
}
|
|
1930
|
+
cssText = replaceShadowCssHost(cssText, hostScopeId);
|
|
1931
|
+
cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, " $1 ");
|
|
1932
|
+
return {
|
|
1933
|
+
cssText: cssText.trim(),
|
|
1934
|
+
// We need to replace the shadow CSS host string in each of these selectors since we created
|
|
1935
|
+
// them prior to the replacement happening in the components CSS text.
|
|
1936
|
+
slottedSelectors: slotted.selectors.map((ref) => ({
|
|
1937
|
+
orgSelector: replaceShadowCssHost(ref.orgSelector, hostScopeId),
|
|
1938
|
+
updatedSelector: replaceShadowCssHost(ref.updatedSelector, hostScopeId)
|
|
1939
|
+
}))
|
|
1940
|
+
};
|
|
1941
|
+
};
|
|
1942
|
+
var replaceShadowCssHost = (cssText, hostScopeId) => {
|
|
1943
|
+
return cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
|
|
1944
|
+
};
|
|
1945
|
+
var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
|
|
1946
|
+
const hostScopeId = scopeId2 + "-h";
|
|
1947
|
+
const slotScopeId = scopeId2 + "-s";
|
|
1948
|
+
const commentsWithHash = extractCommentsWithHash(cssText);
|
|
1949
|
+
cssText = stripComments(cssText);
|
|
1950
|
+
const orgSelectors = [];
|
|
1951
|
+
if (commentOriginalSelector) {
|
|
1952
|
+
const processCommentedSelector = (rule) => {
|
|
1953
|
+
const placeholder = `/*!@___${orgSelectors.length}___*/`;
|
|
1954
|
+
const comment = `/*!@${rule.selector}*/`;
|
|
1955
|
+
orgSelectors.push({ placeholder, comment });
|
|
1956
|
+
rule.selector = placeholder + rule.selector;
|
|
1957
|
+
return rule;
|
|
1958
|
+
};
|
|
1959
|
+
cssText = processRules(cssText, (rule) => {
|
|
1960
|
+
if (rule.selector[0] !== "@") {
|
|
1961
|
+
return processCommentedSelector(rule);
|
|
1962
|
+
} else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) {
|
|
1963
|
+
rule.content = processRules(rule.content, processCommentedSelector);
|
|
1964
|
+
return rule;
|
|
1965
|
+
}
|
|
1966
|
+
return rule;
|
|
1967
|
+
});
|
|
1968
|
+
}
|
|
1969
|
+
const scoped = scopeCssText(cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
1970
|
+
cssText = [scoped.cssText, ...commentsWithHash].join("\n");
|
|
1971
|
+
if (commentOriginalSelector) {
|
|
1972
|
+
orgSelectors.forEach(({ placeholder, comment }) => {
|
|
1973
|
+
cssText = cssText.replace(placeholder, comment);
|
|
1974
|
+
});
|
|
1975
|
+
}
|
|
1976
|
+
scoped.slottedSelectors.forEach((slottedSelector) => {
|
|
1977
|
+
const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector), "g");
|
|
1978
|
+
cssText = cssText.replace(regex, slottedSelector.updatedSelector);
|
|
1979
|
+
});
|
|
1980
|
+
return cssText;
|
|
1981
|
+
};
|
|
1982
|
+
|
|
1582
1983
|
// src/runtime/mode.ts
|
|
1583
1984
|
var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
|
|
1584
1985
|
var setMode = (handler) => modeResolutionChain.push(handler);
|
|
@@ -1684,7 +2085,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1684
2085
|
if (nonce != null) {
|
|
1685
2086
|
styleElm.setAttribute("nonce", nonce);
|
|
1686
2087
|
}
|
|
1687
|
-
if ((import_app_data9.BUILD.hydrateServerSide || import_app_data9.BUILD.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
2088
|
+
if ((import_app_data9.BUILD.hydrateServerSide || import_app_data9.BUILD.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
|
|
1688
2089
|
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
|
|
1689
2090
|
}
|
|
1690
2091
|
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
@@ -1712,7 +2113,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1712
2113
|
styleContainerNode.append(styleElm);
|
|
1713
2114
|
}
|
|
1714
2115
|
}
|
|
1715
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */
|
|
2116
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1716
2117
|
styleContainerNode.insertBefore(styleElm, null);
|
|
1717
2118
|
}
|
|
1718
2119
|
}
|
|
@@ -1739,13 +2140,21 @@ var attachStyles = (hostRef) => {
|
|
|
1739
2140
|
cmpMeta,
|
|
1740
2141
|
hostRef.$modeName$
|
|
1741
2142
|
);
|
|
1742
|
-
if ((import_app_data9.BUILD.shadowDom || import_app_data9.BUILD.scoped) && import_app_data9.BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
|
|
2143
|
+
if ((import_app_data9.BUILD.shadowDom || import_app_data9.BUILD.scoped) && import_app_data9.BUILD.cssAnnotations && (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */ || flags & 128 /* shadowNeedsScopedCss */)) {
|
|
1743
2144
|
elm["s-sc"] = scopeId2;
|
|
1744
2145
|
elm.classList.add(scopeId2 + "-h");
|
|
1745
2146
|
}
|
|
1746
2147
|
endAttachStyles();
|
|
1747
2148
|
};
|
|
1748
2149
|
var getScopeId = (cmp, mode) => "sc-" + (import_app_data9.BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
|
|
2150
|
+
var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
|
|
2151
|
+
var hydrateScopedToShadow = () => {
|
|
2152
|
+
const styles2 = doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
|
2153
|
+
let i2 = 0;
|
|
2154
|
+
for (; i2 < styles2.length; i2++) {
|
|
2155
|
+
registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
|
|
2156
|
+
}
|
|
2157
|
+
};
|
|
1749
2158
|
|
|
1750
2159
|
// src/runtime/vdom/vdom-render.ts
|
|
1751
2160
|
var import_app_data12 = require("@rindo/core/internal/app-data");
|
|
@@ -1756,112 +2165,113 @@ var import_app_data11 = require("@rindo/core/internal/app-data");
|
|
|
1756
2165
|
// src/runtime/vdom/set-accessor.ts
|
|
1757
2166
|
var import_app_data10 = require("@rindo/core/internal/app-data");
|
|
1758
2167
|
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
1759
|
-
if (oldValue
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
} else {
|
|
1784
|
-
elm.style[prop] = "";
|
|
1785
|
-
}
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
for (const prop in newValue) {
|
|
1790
|
-
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
2168
|
+
if (oldValue === newValue) {
|
|
2169
|
+
return;
|
|
2170
|
+
}
|
|
2171
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
2172
|
+
let ln = memberName.toLowerCase();
|
|
2173
|
+
if (import_app_data10.BUILD.vdomClass && memberName === "class") {
|
|
2174
|
+
const classList = elm.classList;
|
|
2175
|
+
const oldClasses = parseClassList(oldValue);
|
|
2176
|
+
let newClasses = parseClassList(newValue);
|
|
2177
|
+
if (import_app_data10.BUILD.hydrateClientSide && elm["s-si"] && initialRender) {
|
|
2178
|
+
newClasses.push(elm["s-si"]);
|
|
2179
|
+
oldClasses.forEach((c) => {
|
|
2180
|
+
if (c.startsWith(elm["s-si"])) newClasses.push(c);
|
|
2181
|
+
});
|
|
2182
|
+
newClasses = [...new Set(newClasses)];
|
|
2183
|
+
classList.add(...newClasses);
|
|
2184
|
+
} else {
|
|
2185
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
2186
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
2187
|
+
}
|
|
2188
|
+
} else if (import_app_data10.BUILD.vdomStyle && memberName === "style") {
|
|
2189
|
+
if (import_app_data10.BUILD.updatable) {
|
|
2190
|
+
for (const prop in oldValue) {
|
|
2191
|
+
if (!newValue || newValue[prop] == null) {
|
|
1791
2192
|
if (!import_app_data10.BUILD.hydrateServerSide && prop.includes("-")) {
|
|
1792
|
-
elm.style.
|
|
2193
|
+
elm.style.removeProperty(prop);
|
|
1793
2194
|
} else {
|
|
1794
|
-
elm.style[prop] =
|
|
2195
|
+
elm.style[prop] = "";
|
|
1795
2196
|
}
|
|
1796
2197
|
}
|
|
1797
2198
|
}
|
|
1798
|
-
}
|
|
1799
|
-
|
|
2199
|
+
}
|
|
2200
|
+
for (const prop in newValue) {
|
|
2201
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
2202
|
+
if (!import_app_data10.BUILD.hydrateServerSide && prop.includes("-")) {
|
|
2203
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
2204
|
+
} else {
|
|
2205
|
+
elm.style[prop] = newValue[prop];
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
} else if (import_app_data10.BUILD.vdomKey && memberName === "key") {
|
|
2210
|
+
} else if (import_app_data10.BUILD.vdomRef && memberName === "ref") {
|
|
2211
|
+
if (newValue) {
|
|
2212
|
+
newValue(elm);
|
|
2213
|
+
}
|
|
2214
|
+
} else if (import_app_data10.BUILD.vdomListener && (import_app_data10.BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
|
|
2215
|
+
if (memberName[2] === "-") {
|
|
2216
|
+
memberName = memberName.slice(3);
|
|
2217
|
+
} else if (isMemberInElement(win, ln)) {
|
|
2218
|
+
memberName = ln.slice(2);
|
|
2219
|
+
} else {
|
|
2220
|
+
memberName = ln[2] + memberName.slice(3);
|
|
2221
|
+
}
|
|
2222
|
+
if (oldValue || newValue) {
|
|
2223
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
2224
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
2225
|
+
if (oldValue) {
|
|
2226
|
+
plt.rel(elm, memberName, oldValue, capture);
|
|
2227
|
+
}
|
|
1800
2228
|
if (newValue) {
|
|
1801
|
-
|
|
2229
|
+
plt.ael(elm, memberName, newValue, capture);
|
|
1802
2230
|
}
|
|
1803
|
-
}
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
if (newValue) {
|
|
1818
|
-
plt.ael(elm, memberName, newValue, capture);
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
} else if (import_app_data10.BUILD.vdomPropOrAttr) {
|
|
1822
|
-
const isComplex = isComplexType(newValue);
|
|
1823
|
-
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
1824
|
-
try {
|
|
1825
|
-
if (!elm.tagName.includes("-")) {
|
|
1826
|
-
const n = newValue == null ? "" : newValue;
|
|
1827
|
-
if (memberName === "list") {
|
|
1828
|
-
isProp = false;
|
|
1829
|
-
} else if (oldValue == null || elm[memberName] != n) {
|
|
1830
|
-
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
1831
|
-
elm[memberName] = n;
|
|
1832
|
-
} else {
|
|
1833
|
-
elm.setAttribute(memberName, n);
|
|
1834
|
-
}
|
|
2231
|
+
}
|
|
2232
|
+
} else if (import_app_data10.BUILD.vdomPropOrAttr) {
|
|
2233
|
+
const isComplex = isComplexType(newValue);
|
|
2234
|
+
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
2235
|
+
try {
|
|
2236
|
+
if (!elm.tagName.includes("-")) {
|
|
2237
|
+
const n = newValue == null ? "" : newValue;
|
|
2238
|
+
if (memberName === "list") {
|
|
2239
|
+
isProp = false;
|
|
2240
|
+
} else if (oldValue == null || elm[memberName] != n) {
|
|
2241
|
+
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
2242
|
+
elm[memberName] = n;
|
|
2243
|
+
} else {
|
|
2244
|
+
elm.setAttribute(memberName, n);
|
|
1835
2245
|
}
|
|
1836
|
-
} else if (elm[memberName] !== newValue) {
|
|
1837
|
-
elm[memberName] = newValue;
|
|
1838
2246
|
}
|
|
1839
|
-
}
|
|
2247
|
+
} else if (elm[memberName] !== newValue) {
|
|
2248
|
+
elm[memberName] = newValue;
|
|
1840
2249
|
}
|
|
2250
|
+
} catch (e) {
|
|
1841
2251
|
}
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
2252
|
+
}
|
|
2253
|
+
let xlink = false;
|
|
2254
|
+
if (import_app_data10.BUILD.vdomXlink) {
|
|
2255
|
+
if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
|
|
2256
|
+
memberName = ln;
|
|
2257
|
+
xlink = true;
|
|
1848
2258
|
}
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
1853
|
-
} else {
|
|
1854
|
-
elm.removeAttribute(memberName);
|
|
1855
|
-
}
|
|
1856
|
-
}
|
|
1857
|
-
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
1858
|
-
newValue = newValue === true ? "" : newValue;
|
|
2259
|
+
}
|
|
2260
|
+
if (newValue == null || newValue === false) {
|
|
2261
|
+
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
|
1859
2262
|
if (import_app_data10.BUILD.vdomXlink && xlink) {
|
|
1860
|
-
elm.
|
|
2263
|
+
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
1861
2264
|
} else {
|
|
1862
|
-
elm.
|
|
2265
|
+
elm.removeAttribute(memberName);
|
|
1863
2266
|
}
|
|
1864
2267
|
}
|
|
2268
|
+
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
|
|
2269
|
+
newValue = newValue === true ? "" : newValue;
|
|
2270
|
+
if (import_app_data10.BUILD.vdomXlink && xlink) {
|
|
2271
|
+
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
2272
|
+
} else {
|
|
2273
|
+
elm.setAttribute(memberName, newValue);
|
|
2274
|
+
}
|
|
1865
2275
|
}
|
|
1866
2276
|
}
|
|
1867
2277
|
};
|
|
@@ -1959,6 +2369,9 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
1959
2369
|
elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
|
|
1960
2370
|
} else if (import_app_data12.BUILD.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
|
|
1961
2371
|
elm = newVNode2.$elm$ = import_app_data12.BUILD.isDebug || import_app_data12.BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
|
|
2372
|
+
if (import_app_data12.BUILD.vdomAttribute) {
|
|
2373
|
+
updateElement(null, newVNode2, isSvgMode);
|
|
2374
|
+
}
|
|
1962
2375
|
} else {
|
|
1963
2376
|
if (import_app_data12.BUILD.svg && !isSvgMode) {
|
|
1964
2377
|
isSvgMode = newVNode2.$tag$ === "svg";
|
|
@@ -2001,6 +2414,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2001
2414
|
elm["s-cr"] = contentRef;
|
|
2002
2415
|
elm["s-sn"] = newVNode2.$name$ || "";
|
|
2003
2416
|
elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
|
|
2417
|
+
patchSlotNode(elm);
|
|
2004
2418
|
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
2005
2419
|
if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
|
|
2006
2420
|
if (import_app_data12.BUILD.experimentalSlotFixes) {
|
|
@@ -2227,9 +2641,8 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
2227
2641
|
newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
|
|
2228
2642
|
relocateToHostRoot(newVNode2.$elm$.parentElement);
|
|
2229
2643
|
}
|
|
2230
|
-
} else {
|
|
2231
|
-
updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
|
|
2232
2644
|
}
|
|
2645
|
+
updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
|
|
2233
2646
|
}
|
|
2234
2647
|
if (import_app_data12.BUILD.updatable && oldChildren !== null && newChildren !== null) {
|
|
2235
2648
|
updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
|
|
@@ -2316,7 +2729,10 @@ var insertBefore = (parent, newNode, reference) => {
|
|
|
2316
2729
|
if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
|
|
2317
2730
|
patchParentNode(newNode);
|
|
2318
2731
|
}
|
|
2319
|
-
|
|
2732
|
+
parent.insertBefore(newNode, reference);
|
|
2733
|
+
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
2734
|
+
if (slotNode) dispatchSlotChangeEvent(slotNode);
|
|
2735
|
+
return newNode;
|
|
2320
2736
|
}
|
|
2321
2737
|
if (import_app_data12.BUILD.experimentalSlotFixes && parent.__insertBefore) {
|
|
2322
2738
|
return parent.__insertBefore(newNode, reference);
|
|
@@ -2386,7 +2802,7 @@ render() {
|
|
|
2386
2802
|
if (import_app_data12.BUILD.scoped || import_app_data12.BUILD.shadowDom) {
|
|
2387
2803
|
scopeId = hostElm["s-sc"];
|
|
2388
2804
|
}
|
|
2389
|
-
useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)
|
|
2805
|
+
useNativeShadowDom = supportsShadow && !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
|
|
2390
2806
|
if (import_app_data12.BUILD.slotRelocation) {
|
|
2391
2807
|
contentRef = hostElm["s-cr"];
|
|
2392
2808
|
checkSlotFallbackVisibility = false;
|
|
@@ -2440,7 +2856,7 @@ render() {
|
|
|
2440
2856
|
}
|
|
2441
2857
|
}
|
|
2442
2858
|
}
|
|
2443
|
-
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](
|
|
2859
|
+
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
|
|
2444
2860
|
} else {
|
|
2445
2861
|
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
2446
2862
|
if (isInitialLoad) {
|
|
@@ -2521,19 +2937,13 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
2521
2937
|
}
|
|
2522
2938
|
}
|
|
2523
2939
|
emitLifecycleEvent(elm, "componentWillLoad");
|
|
2524
|
-
|
|
2525
|
-
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
2526
|
-
}
|
|
2940
|
+
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
2527
2941
|
} else {
|
|
2528
2942
|
emitLifecycleEvent(elm, "componentWillUpdate");
|
|
2529
|
-
|
|
2530
|
-
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
2531
|
-
}
|
|
2943
|
+
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
2532
2944
|
}
|
|
2533
2945
|
emitLifecycleEvent(elm, "componentWillRender");
|
|
2534
|
-
|
|
2535
|
-
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
2536
|
-
}
|
|
2946
|
+
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
2537
2947
|
endSchedule();
|
|
2538
2948
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
2539
2949
|
};
|
|
@@ -2641,14 +3051,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2641
3051
|
const endPostUpdate = createTime("postUpdate", tagName);
|
|
2642
3052
|
const instance = import_app_data13.BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
2643
3053
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
2644
|
-
if (import_app_data13.BUILD.
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2651
|
-
}
|
|
3054
|
+
if (import_app_data13.BUILD.isDev) {
|
|
3055
|
+
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
3056
|
+
}
|
|
3057
|
+
safeCall(instance, "componentDidRender", void 0, elm);
|
|
3058
|
+
if (import_app_data13.BUILD.isDev) {
|
|
3059
|
+
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2652
3060
|
}
|
|
2653
3061
|
emitLifecycleEvent(elm, "componentDidRender");
|
|
2654
3062
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
@@ -2656,14 +3064,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2656
3064
|
if (import_app_data13.BUILD.asyncLoading && import_app_data13.BUILD.cssAnnotations) {
|
|
2657
3065
|
addHydratedFlag(elm);
|
|
2658
3066
|
}
|
|
2659
|
-
if (import_app_data13.BUILD.
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
|
|
2666
|
-
}
|
|
3067
|
+
if (import_app_data13.BUILD.isDev) {
|
|
3068
|
+
hostRef.$flags$ |= 2048 /* devOnDidLoad */;
|
|
3069
|
+
}
|
|
3070
|
+
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
3071
|
+
if (import_app_data13.BUILD.isDev) {
|
|
3072
|
+
hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
|
|
2667
3073
|
}
|
|
2668
3074
|
emitLifecycleEvent(elm, "componentDidLoad");
|
|
2669
3075
|
endPostUpdate();
|
|
@@ -2674,14 +3080,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2674
3080
|
}
|
|
2675
3081
|
}
|
|
2676
3082
|
} else {
|
|
2677
|
-
if (import_app_data13.BUILD.
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2684
|
-
}
|
|
3083
|
+
if (import_app_data13.BUILD.isDev) {
|
|
3084
|
+
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
3085
|
+
}
|
|
3086
|
+
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
3087
|
+
if (import_app_data13.BUILD.isDev) {
|
|
3088
|
+
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2685
3089
|
}
|
|
2686
3090
|
emitLifecycleEvent(elm, "componentDidUpdate");
|
|
2687
3091
|
endPostUpdate();
|
|
@@ -2813,7 +3217,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2813
3217
|
}
|
|
2814
3218
|
}
|
|
2815
3219
|
if (import_app_data14.BUILD.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
2816
|
-
if (
|
|
3220
|
+
if (instance.componentShouldUpdate) {
|
|
2817
3221
|
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
2818
3222
|
return;
|
|
2819
3223
|
}
|
|
@@ -3078,9 +3482,8 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3078
3482
|
const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
|
|
3079
3483
|
if (!styles.has(scopeId2)) {
|
|
3080
3484
|
const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
|
|
3081
|
-
if (
|
|
3082
|
-
|
|
3083
|
-
style = await import("../client/shadow-css.js").then((m) => m.scopeCss(style, scopeId2));
|
|
3485
|
+
if (import_app_data16.BUILD.hydrateServerSide && import_app_data16.BUILD.shadowDom && cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
|
|
3486
|
+
style = scopeCss(style, scopeId2, true);
|
|
3084
3487
|
}
|
|
3085
3488
|
registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
3086
3489
|
endRegisterStyles();
|
|
@@ -3096,7 +3499,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3096
3499
|
}
|
|
3097
3500
|
};
|
|
3098
3501
|
var fireConnectedCallback = (instance, elm) => {
|
|
3099
|
-
if (import_app_data16.BUILD.lazyLoad
|
|
3502
|
+
if (import_app_data16.BUILD.lazyLoad) {
|
|
3100
3503
|
safeCall(instance, "connectedCallback", void 0, elm);
|
|
3101
3504
|
}
|
|
3102
3505
|
};
|
|
@@ -3177,12 +3580,9 @@ var setContentReference = (elm) => {
|
|
|
3177
3580
|
// src/runtime/disconnected-callback.ts
|
|
3178
3581
|
var import_app_data18 = require("@rindo/core/internal/app-data");
|
|
3179
3582
|
var disconnectInstance = (instance, elm) => {
|
|
3180
|
-
if (import_app_data18.BUILD.lazyLoad
|
|
3583
|
+
if (import_app_data18.BUILD.lazyLoad) {
|
|
3181
3584
|
safeCall(instance, "disconnectedCallback", void 0, elm || instance);
|
|
3182
3585
|
}
|
|
3183
|
-
if (import_app_data18.BUILD.cmpDidUnload) {
|
|
3184
|
-
safeCall(instance, "componentDidUnload", void 0, elm || instance);
|
|
3185
|
-
}
|
|
3186
3586
|
};
|
|
3187
3587
|
var disconnectedCallback = async (elm) => {
|
|
3188
3588
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
@@ -3251,6 +3651,9 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3251
3651
|
patchTextContent(Cstr.prototype);
|
|
3252
3652
|
}
|
|
3253
3653
|
}
|
|
3654
|
+
if (import_app_data19.BUILD.hydrateClientSide && import_app_data19.BUILD.shadowDom) {
|
|
3655
|
+
hydrateScopedToShadow();
|
|
3656
|
+
}
|
|
3254
3657
|
const originalConnectedCallback = Cstr.prototype.connectedCallback;
|
|
3255
3658
|
const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
|
|
3256
3659
|
Object.assign(Cstr.prototype, {
|
|
@@ -3265,25 +3668,15 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3265
3668
|
this.__hasHostListenerAttached = true;
|
|
3266
3669
|
}
|
|
3267
3670
|
connectedCallback(this);
|
|
3268
|
-
if (
|
|
3671
|
+
if (originalConnectedCallback) {
|
|
3269
3672
|
originalConnectedCallback.call(this);
|
|
3270
3673
|
}
|
|
3271
3674
|
},
|
|
3272
3675
|
disconnectedCallback() {
|
|
3273
3676
|
disconnectedCallback(this);
|
|
3274
|
-
if (
|
|
3677
|
+
if (originalDisconnectedCallback) {
|
|
3275
3678
|
originalDisconnectedCallback.call(this);
|
|
3276
3679
|
}
|
|
3277
|
-
plt.raf(() => {
|
|
3278
|
-
var _a;
|
|
3279
|
-
const hostRef = getHostRef(this);
|
|
3280
|
-
if (((_a = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
|
|
3281
|
-
delete hostRef.$vnode$;
|
|
3282
|
-
}
|
|
3283
|
-
if (this instanceof Node && !this.isConnected) {
|
|
3284
|
-
deleteHostRef(this);
|
|
3285
|
-
}
|
|
3286
|
-
});
|
|
3287
3680
|
},
|
|
3288
3681
|
__attachShadow() {
|
|
3289
3682
|
if (supportsShadow) {
|
|
@@ -3371,6 +3764,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3371
3764
|
if (import_app_data20.BUILD.hydrateClientSide) {
|
|
3372
3765
|
plt.$flags$ |= 2 /* appLoaded */;
|
|
3373
3766
|
}
|
|
3767
|
+
if (import_app_data20.BUILD.hydrateClientSide && import_app_data20.BUILD.shadowDom) {
|
|
3768
|
+
hydrateScopedToShadow();
|
|
3769
|
+
}
|
|
3374
3770
|
let hasSlotRelocation = false;
|
|
3375
3771
|
lazyBundles.map((lazyBundle) => {
|
|
3376
3772
|
lazyBundle[1].map((compactMeta) => {
|
|
@@ -3746,7 +4142,6 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
|
|
|
3746
4142
|
consoleError,
|
|
3747
4143
|
createEvent,
|
|
3748
4144
|
defineCustomElement,
|
|
3749
|
-
deleteHostRef,
|
|
3750
4145
|
disconnectedCallback,
|
|
3751
4146
|
doc,
|
|
3752
4147
|
flushAll,
|