@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,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rindo Hydrate Platform v4.
|
|
2
|
+
Rindo Hydrate Platform v4.27.0 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -64,6 +64,11 @@ function queryNonceMetaTagContent(doc2) {
|
|
|
64
64
|
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;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
// src/utils/regular-expression.ts
|
|
68
|
+
var escapeRegExpSpecialCharacters = (text) => {
|
|
69
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
70
|
+
};
|
|
71
|
+
|
|
67
72
|
// src/utils/result.ts
|
|
68
73
|
var result_exports = {};
|
|
69
74
|
__export(result_exports, {
|
|
@@ -152,12 +157,11 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
|
|
152
157
|
|
|
153
158
|
// src/runtime/slot-polyfill-utils.ts
|
|
154
159
|
var updateFallbackSlotVisibility = (elm) => {
|
|
155
|
-
const childNodes = elm
|
|
160
|
+
const childNodes = internalCall(elm, "childNodes");
|
|
156
161
|
if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
|
|
157
162
|
getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
|
|
158
|
-
var _a;
|
|
159
163
|
if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
|
|
160
|
-
if ((
|
|
164
|
+
if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
|
|
161
165
|
slotNode.hidden = true;
|
|
162
166
|
} else {
|
|
163
167
|
slotNode.hidden = false;
|
|
@@ -165,8 +169,10 @@ var updateFallbackSlotVisibility = (elm) => {
|
|
|
165
169
|
}
|
|
166
170
|
});
|
|
167
171
|
}
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
let i2 = 0;
|
|
173
|
+
for (i2 = 0; i2 < childNodes.length; i2++) {
|
|
174
|
+
const childNode = childNodes[i2];
|
|
175
|
+
if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
|
|
170
176
|
updateFallbackSlotVisibility(childNode);
|
|
171
177
|
}
|
|
172
178
|
}
|
|
@@ -187,7 +193,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
187
193
|
let childNode;
|
|
188
194
|
for (; i2 < childNodes.length; i2++) {
|
|
189
195
|
childNode = childNodes[i2];
|
|
190
|
-
if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode
|
|
196
|
+
if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
|
|
191
197
|
slottedNodes.push(childNode);
|
|
192
198
|
if (typeof slotName !== "undefined") return slottedNodes;
|
|
193
199
|
}
|
|
@@ -195,11 +201,12 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
195
201
|
}
|
|
196
202
|
return slottedNodes;
|
|
197
203
|
}
|
|
198
|
-
var
|
|
204
|
+
var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
|
|
199
205
|
const childNodes = [];
|
|
200
|
-
if (includeSlot &&
|
|
201
|
-
|
|
202
|
-
|
|
206
|
+
if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
|
|
207
|
+
let node = slot;
|
|
208
|
+
while (node = node.nextSibling) {
|
|
209
|
+
if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
|
|
203
210
|
}
|
|
204
211
|
return childNodes;
|
|
205
212
|
};
|
|
@@ -219,38 +226,73 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
|
|
|
219
226
|
return slotName === "";
|
|
220
227
|
};
|
|
221
228
|
var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
|
|
222
|
-
let slottedNodeLocation;
|
|
223
229
|
if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
|
|
224
|
-
|
|
225
|
-
} else {
|
|
226
|
-
slottedNodeLocation = document.createTextNode("");
|
|
227
|
-
slottedNodeLocation["s-nr"] = newChild;
|
|
230
|
+
return;
|
|
228
231
|
}
|
|
232
|
+
const slottedNodeLocation = document.createTextNode("");
|
|
233
|
+
slottedNodeLocation["s-nr"] = newChild;
|
|
229
234
|
if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
|
|
230
235
|
const parent = slotNode["s-cr"].parentNode;
|
|
231
|
-
const appendMethod = prepend ? parent
|
|
232
|
-
if (typeof position !== "undefined") {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
|
|
246
|
-
}
|
|
236
|
+
const appendMethod = prepend ? internalCall(parent, "prepend") : internalCall(parent, "appendChild");
|
|
237
|
+
if (BUILD2.hydrateClientSide && typeof position !== "undefined") {
|
|
238
|
+
slottedNodeLocation["s-oo"] = position;
|
|
239
|
+
const childNodes = internalCall(parent, "childNodes");
|
|
240
|
+
const slotRelocateNodes = [slottedNodeLocation];
|
|
241
|
+
childNodes.forEach((n) => {
|
|
242
|
+
if (n["s-nr"]) slotRelocateNodes.push(n);
|
|
243
|
+
});
|
|
244
|
+
slotRelocateNodes.sort((a, b) => {
|
|
245
|
+
if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
|
|
246
|
+
else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
|
|
247
|
+
return 0;
|
|
248
|
+
});
|
|
249
|
+
slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
|
|
247
250
|
} else {
|
|
248
251
|
appendMethod.call(parent, slottedNodeLocation);
|
|
249
252
|
}
|
|
250
253
|
newChild["s-ol"] = slottedNodeLocation;
|
|
251
254
|
newChild["s-sh"] = slotNode["s-hn"];
|
|
252
255
|
};
|
|
253
|
-
var getSlotName = (node) => node["s-sn"]
|
|
256
|
+
var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
|
|
257
|
+
function patchSlotNode(node) {
|
|
258
|
+
if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
|
|
259
|
+
const assignedFactory = (elementsOnly) => (function(opts) {
|
|
260
|
+
const toReturn = [];
|
|
261
|
+
const slotName = this["s-sn"];
|
|
262
|
+
if (opts == null ? void 0 : opts.flatten) {
|
|
263
|
+
console.error(`
|
|
264
|
+
Flattening is not supported for Rindo non-shadow slots.
|
|
265
|
+
You can use \`.childNodes\` to nested slot fallback content.
|
|
266
|
+
If you have a particular use case, please open an issue on the Rindo repo.
|
|
267
|
+
`);
|
|
268
|
+
}
|
|
269
|
+
const parent = this["s-cr"].parentElement;
|
|
270
|
+
const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
|
|
271
|
+
slottedNodes.forEach((n) => {
|
|
272
|
+
if (slotName === getSlotName(n)) {
|
|
273
|
+
toReturn.push(n);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
if (elementsOnly) {
|
|
277
|
+
return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
|
|
278
|
+
}
|
|
279
|
+
return toReturn;
|
|
280
|
+
}).bind(node);
|
|
281
|
+
node.assignedElements = assignedFactory(true);
|
|
282
|
+
node.assignedNodes = assignedFactory(false);
|
|
283
|
+
}
|
|
284
|
+
function dispatchSlotChangeEvent(elm) {
|
|
285
|
+
elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
|
|
286
|
+
}
|
|
287
|
+
function findSlotFromSlottedNode(slottedNode, parentHost) {
|
|
288
|
+
var _a;
|
|
289
|
+
parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
|
|
290
|
+
if (!parentHost) return { slotNode: null, slotName: "" };
|
|
291
|
+
const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
|
|
292
|
+
const childNodes = internalCall(parentHost, "childNodes");
|
|
293
|
+
const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
|
|
294
|
+
return { slotNode, slotName };
|
|
295
|
+
}
|
|
254
296
|
|
|
255
297
|
// src/runtime/dom-extras.ts
|
|
256
298
|
var patchPseudoShadowDom = (hostElementPrototype) => {
|
|
@@ -314,19 +356,14 @@ var patchCloneNode = (HostElementPrototype) => {
|
|
|
314
356
|
var patchSlotAppendChild = (HostElementPrototype) => {
|
|
315
357
|
HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
|
|
316
358
|
HostElementPrototype.appendChild = function(newChild) {
|
|
317
|
-
const slotName
|
|
318
|
-
const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
|
|
359
|
+
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
319
360
|
if (slotNode) {
|
|
320
361
|
addSlotRelocateNode(newChild, slotNode);
|
|
321
|
-
const slotChildNodes =
|
|
362
|
+
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
322
363
|
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
323
|
-
const parent =
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
insertedNode = parent.__insertBefore(newChild, appendAfter.nextSibling);
|
|
327
|
-
} else {
|
|
328
|
-
insertedNode = parent.insertBefore(newChild, appendAfter.nextSibling);
|
|
329
|
-
}
|
|
364
|
+
const parent = internalCall(appendAfter, "parentNode");
|
|
365
|
+
const insertedNode = internalCall(parent, "insertBefore")(newChild, appendAfter.nextSibling);
|
|
366
|
+
dispatchSlotChangeEvent(slotNode);
|
|
330
367
|
updateFallbackSlotVisibility(this);
|
|
331
368
|
return insertedNode;
|
|
332
369
|
}
|
|
@@ -355,19 +392,17 @@ var patchSlotPrepend = (HostElementPrototype) => {
|
|
|
355
392
|
if (typeof newChild === "string") {
|
|
356
393
|
newChild = this.ownerDocument.createTextNode(newChild);
|
|
357
394
|
}
|
|
358
|
-
const slotName = newChild["s-sn"] = getSlotName(newChild);
|
|
359
|
-
const childNodes = this
|
|
395
|
+
const slotName = (newChild["s-sn"] = getSlotName(newChild)) || "";
|
|
396
|
+
const childNodes = internalCall(this, "childNodes");
|
|
360
397
|
const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
|
|
361
398
|
if (slotNode) {
|
|
362
399
|
addSlotRelocateNode(newChild, slotNode, true);
|
|
363
|
-
const slotChildNodes =
|
|
400
|
+
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
364
401
|
const appendAfter = slotChildNodes[0];
|
|
365
|
-
const parent =
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
return parent.insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
|
|
370
|
-
}
|
|
402
|
+
const parent = internalCall(appendAfter, "parentNode");
|
|
403
|
+
const toReturn = internalCall(parent, "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
|
|
404
|
+
dispatchSlotChangeEvent(slotNode);
|
|
405
|
+
return toReturn;
|
|
371
406
|
}
|
|
372
407
|
if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
|
|
373
408
|
newChild.hidden = true;
|
|
@@ -417,8 +452,7 @@ var patchInsertBefore = (HostElementPrototype) => {
|
|
|
417
452
|
if (eleProto.__insertBefore) return;
|
|
418
453
|
eleProto.__insertBefore = HostElementPrototype.insertBefore;
|
|
419
454
|
HostElementPrototype.insertBefore = function(newChild, currentChild) {
|
|
420
|
-
const slotName
|
|
421
|
-
const slotNode = getHostSlotNodes(this.__childNodes, this.tagName, slotName)[0];
|
|
455
|
+
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
422
456
|
const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
|
|
423
457
|
if (slotNode) {
|
|
424
458
|
let found = false;
|
|
@@ -431,18 +465,19 @@ var patchInsertBefore = (HostElementPrototype) => {
|
|
|
431
465
|
}
|
|
432
466
|
if (slotName === currentChild["s-sn"]) {
|
|
433
467
|
addSlotRelocateNode(newChild, slotNode);
|
|
434
|
-
const parent =
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
} else {
|
|
438
|
-
parent.insertBefore(newChild, currentChild);
|
|
439
|
-
}
|
|
468
|
+
const parent = internalCall(currentChild, "parentNode");
|
|
469
|
+
internalCall(parent, "insertBefore")(newChild, currentChild);
|
|
470
|
+
dispatchSlotChangeEvent(slotNode);
|
|
440
471
|
}
|
|
441
472
|
return;
|
|
442
473
|
}
|
|
443
474
|
});
|
|
444
475
|
if (found) return newChild;
|
|
445
476
|
}
|
|
477
|
+
const parentNode = currentChild == null ? void 0 : currentChild.__parentNode;
|
|
478
|
+
if (parentNode && !this.isSameNode(parentNode)) {
|
|
479
|
+
return this.appendChild(newChild);
|
|
480
|
+
}
|
|
446
481
|
return this.__insertBefore(newChild, currentChild);
|
|
447
482
|
};
|
|
448
483
|
};
|
|
@@ -520,7 +555,7 @@ var patchChildSlotNodes = (elm) => {
|
|
|
520
555
|
});
|
|
521
556
|
};
|
|
522
557
|
var patchSlottedNode = (node) => {
|
|
523
|
-
if (!node || node.__nextSibling || !globalThis.Node) return;
|
|
558
|
+
if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
|
|
524
559
|
patchNextSibling(node);
|
|
525
560
|
patchPreviousSibling(node);
|
|
526
561
|
patchParentNode(node);
|
|
@@ -624,11 +659,14 @@ function patchHostOriginalAccessor(accessorName, node) {
|
|
|
624
659
|
}
|
|
625
660
|
if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
|
|
626
661
|
}
|
|
627
|
-
function
|
|
662
|
+
function internalCall(node, method) {
|
|
628
663
|
if ("__" + method in node) {
|
|
629
|
-
|
|
664
|
+
const toReturn = node["__" + method];
|
|
665
|
+
if (typeof toReturn !== "function") return toReturn;
|
|
666
|
+
return toReturn.bind(node);
|
|
630
667
|
} else {
|
|
631
|
-
return node[method];
|
|
668
|
+
if (typeof node[method] !== "function") return node[method];
|
|
669
|
+
return node[method].bind(node);
|
|
632
670
|
}
|
|
633
671
|
}
|
|
634
672
|
|
|
@@ -878,7 +916,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
878
916
|
delete hostElm["s-sc"];
|
|
879
917
|
}
|
|
880
918
|
}
|
|
881
|
-
if (!plt.$orgLocNodes$) {
|
|
919
|
+
if (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size) {
|
|
882
920
|
initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
|
|
883
921
|
}
|
|
884
922
|
hostElm[HYDRATE_ID] = hostId;
|
|
@@ -972,13 +1010,25 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
972
1010
|
slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
|
|
973
1011
|
});
|
|
974
1012
|
}
|
|
975
|
-
if (BUILD6.shadowDom && shadowRoot) {
|
|
1013
|
+
if (BUILD6.shadowDom && shadowRoot && !shadowRoot.childNodes.length) {
|
|
976
1014
|
let rnIdex = 0;
|
|
977
1015
|
const rnLen = shadowRootNodes.length;
|
|
978
|
-
|
|
979
|
-
|
|
1016
|
+
if (rnLen) {
|
|
1017
|
+
for (rnIdex; rnIdex < rnLen; rnIdex++) {
|
|
1018
|
+
shadowRoot.appendChild(shadowRootNodes[rnIdex]);
|
|
1019
|
+
}
|
|
1020
|
+
Array.from(hostElm.childNodes).forEach((node) => {
|
|
1021
|
+
if (typeof node["s-sn"] !== "string") {
|
|
1022
|
+
if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
|
|
1023
|
+
node.removeAttribute("hidden");
|
|
1024
|
+
} else if (node.nodeType === 8 /* CommentNode */ || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
|
|
1025
|
+
node.parentNode.removeChild(node);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
});
|
|
980
1029
|
}
|
|
981
1030
|
}
|
|
1031
|
+
plt.$orgLocNodes$.delete(hostElm["s-id"]);
|
|
982
1032
|
hostRef.$hostElement$ = hostElm;
|
|
983
1033
|
endHydrate();
|
|
984
1034
|
};
|
|
@@ -1089,7 +1139,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1089
1139
|
$text$: null
|
|
1090
1140
|
});
|
|
1091
1141
|
if (childNodeType === TEXT_NODE_ID) {
|
|
1092
|
-
childVNode.$elm$ = node
|
|
1142
|
+
childVNode.$elm$ = findCorrespondingNode(node, 3 /* TextNode */);
|
|
1093
1143
|
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
|
|
1094
1144
|
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
1095
1145
|
childRenderNodes.push(childVNode);
|
|
@@ -1105,7 +1155,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1105
1155
|
}
|
|
1106
1156
|
}
|
|
1107
1157
|
} else if (childNodeType === COMMENT_NODE_ID) {
|
|
1108
|
-
childVNode.$elm$ = node
|
|
1158
|
+
childVNode.$elm$ = findCorrespondingNode(node, 8 /* CommentNode */);
|
|
1109
1159
|
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
|
|
1110
1160
|
childRenderNodes.push(childVNode);
|
|
1111
1161
|
node.remove();
|
|
@@ -1139,6 +1189,10 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1139
1189
|
vnode.$elm$ = node;
|
|
1140
1190
|
vnode.$index$ = "0";
|
|
1141
1191
|
parentVNode.$children$ = [vnode];
|
|
1192
|
+
} else {
|
|
1193
|
+
if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
|
|
1194
|
+
node.remove();
|
|
1195
|
+
}
|
|
1142
1196
|
}
|
|
1143
1197
|
return parentVNode;
|
|
1144
1198
|
};
|
|
@@ -1208,6 +1262,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
|
|
|
1208
1262
|
const slot = childVNode.$elm$;
|
|
1209
1263
|
const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
|
|
1210
1264
|
addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
|
|
1265
|
+
patchSlotNode(node);
|
|
1211
1266
|
if (shouldMove) {
|
|
1212
1267
|
parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
|
|
1213
1268
|
}
|
|
@@ -1228,10 +1283,367 @@ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) =>
|
|
|
1228
1283
|
slottedNode = slottedNode.nextSibling;
|
|
1229
1284
|
}
|
|
1230
1285
|
};
|
|
1286
|
+
var findCorrespondingNode = (node, type) => {
|
|
1287
|
+
let sibling = node;
|
|
1288
|
+
do {
|
|
1289
|
+
sibling = sibling.nextSibling;
|
|
1290
|
+
} while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
|
|
1291
|
+
return sibling;
|
|
1292
|
+
};
|
|
1231
1293
|
|
|
1232
1294
|
// src/runtime/initialize-component.ts
|
|
1233
1295
|
import { BUILD as BUILD17 } from "@rindo/core/internal/app-data";
|
|
1234
1296
|
|
|
1297
|
+
// src/utils/shadow-css.ts
|
|
1298
|
+
/**
|
|
1299
|
+
* @license
|
|
1300
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
1301
|
+
*
|
|
1302
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1303
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1304
|
+
*
|
|
1305
|
+
* This file is a port of shadowCSS from `webcomponents.js` to TypeScript.
|
|
1306
|
+
* https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
|
|
1307
|
+
* https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
|
|
1308
|
+
*/
|
|
1309
|
+
var safeSelector = (selector) => {
|
|
1310
|
+
const placeholders = [];
|
|
1311
|
+
let index = 0;
|
|
1312
|
+
selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
|
|
1313
|
+
const replaceBy = `__ph-${index}__`;
|
|
1314
|
+
placeholders.push(keep);
|
|
1315
|
+
index++;
|
|
1316
|
+
return replaceBy;
|
|
1317
|
+
});
|
|
1318
|
+
const content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
|
|
1319
|
+
const replaceBy = `__ph-${index}__`;
|
|
1320
|
+
placeholders.push(exp);
|
|
1321
|
+
index++;
|
|
1322
|
+
return pseudo + replaceBy;
|
|
1323
|
+
});
|
|
1324
|
+
const ss = {
|
|
1325
|
+
content,
|
|
1326
|
+
placeholders
|
|
1327
|
+
};
|
|
1328
|
+
return ss;
|
|
1329
|
+
};
|
|
1330
|
+
var restoreSafeSelector = (placeholders, content) => {
|
|
1331
|
+
return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
|
|
1332
|
+
};
|
|
1333
|
+
var _polyfillHost = "-shadowcsshost";
|
|
1334
|
+
var _polyfillSlotted = "-shadowcssslotted";
|
|
1335
|
+
var _polyfillHostContext = "-shadowcsscontext";
|
|
1336
|
+
var _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
|
|
1337
|
+
var _cssColonHostRe = new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
|
|
1338
|
+
var _cssColonHostContextRe = new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
|
|
1339
|
+
var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
|
|
1340
|
+
var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
|
|
1341
|
+
var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
1342
|
+
var _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
|
|
1343
|
+
var _selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$";
|
|
1344
|
+
var _polyfillHostRe = /-shadowcsshost/gim;
|
|
1345
|
+
var createSupportsRuleRe = (selector) => new RegExp(`((?<!(^@supports(.*)))|(?<={.*))(${selector}\\b)`, "gim");
|
|
1346
|
+
var _colonSlottedRe = createSupportsRuleRe("::slotted");
|
|
1347
|
+
var _colonHostRe = createSupportsRuleRe(":host");
|
|
1348
|
+
var _colonHostContextRe = createSupportsRuleRe(":host-context");
|
|
1349
|
+
var _commentRe = /\/\*\s*[\s\S]*?\*\//g;
|
|
1350
|
+
var stripComments = (input) => {
|
|
1351
|
+
return input.replace(_commentRe, "");
|
|
1352
|
+
};
|
|
1353
|
+
var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
|
|
1354
|
+
var extractCommentsWithHash = (input) => {
|
|
1355
|
+
return input.match(_commentWithHashRe) || [];
|
|
1356
|
+
};
|
|
1357
|
+
var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
|
|
1358
|
+
var _curlyRe = /([{}])/g;
|
|
1359
|
+
var _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/;
|
|
1360
|
+
var OPEN_CURLY = "{";
|
|
1361
|
+
var CLOSE_CURLY = "}";
|
|
1362
|
+
var BLOCK_PLACEHOLDER = "%BLOCK%";
|
|
1363
|
+
var processRules = (input, ruleCallback) => {
|
|
1364
|
+
const inputWithEscapedBlocks = escapeBlocks(input);
|
|
1365
|
+
let nextBlockIndex = 0;
|
|
1366
|
+
return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
|
|
1367
|
+
const selector = m[2];
|
|
1368
|
+
let content = "";
|
|
1369
|
+
let suffix = m[4];
|
|
1370
|
+
let contentPrefix = "";
|
|
1371
|
+
if (suffix && suffix.startsWith("{" + BLOCK_PLACEHOLDER)) {
|
|
1372
|
+
content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
|
|
1373
|
+
suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
|
|
1374
|
+
contentPrefix = "{";
|
|
1375
|
+
}
|
|
1376
|
+
const cssRule = {
|
|
1377
|
+
selector,
|
|
1378
|
+
content
|
|
1379
|
+
};
|
|
1380
|
+
const rule = ruleCallback(cssRule);
|
|
1381
|
+
return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
|
|
1382
|
+
});
|
|
1383
|
+
};
|
|
1384
|
+
var escapeBlocks = (input) => {
|
|
1385
|
+
const inputParts = input.split(_curlyRe);
|
|
1386
|
+
const resultParts = [];
|
|
1387
|
+
const escapedBlocks = [];
|
|
1388
|
+
let bracketCount = 0;
|
|
1389
|
+
let currentBlockParts = [];
|
|
1390
|
+
for (let partIndex = 0; partIndex < inputParts.length; partIndex++) {
|
|
1391
|
+
const part = inputParts[partIndex];
|
|
1392
|
+
if (part === CLOSE_CURLY) {
|
|
1393
|
+
bracketCount--;
|
|
1394
|
+
}
|
|
1395
|
+
if (bracketCount > 0) {
|
|
1396
|
+
currentBlockParts.push(part);
|
|
1397
|
+
} else {
|
|
1398
|
+
if (currentBlockParts.length > 0) {
|
|
1399
|
+
escapedBlocks.push(currentBlockParts.join(""));
|
|
1400
|
+
resultParts.push(BLOCK_PLACEHOLDER);
|
|
1401
|
+
currentBlockParts = [];
|
|
1402
|
+
}
|
|
1403
|
+
resultParts.push(part);
|
|
1404
|
+
}
|
|
1405
|
+
if (part === OPEN_CURLY) {
|
|
1406
|
+
bracketCount++;
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
if (currentBlockParts.length > 0) {
|
|
1410
|
+
escapedBlocks.push(currentBlockParts.join(""));
|
|
1411
|
+
resultParts.push(BLOCK_PLACEHOLDER);
|
|
1412
|
+
}
|
|
1413
|
+
const strEscapedBlocks = {
|
|
1414
|
+
escapedString: resultParts.join(""),
|
|
1415
|
+
blocks: escapedBlocks
|
|
1416
|
+
};
|
|
1417
|
+
return strEscapedBlocks;
|
|
1418
|
+
};
|
|
1419
|
+
var insertPolyfillHostInCssText = (cssText) => {
|
|
1420
|
+
cssText = cssText.replace(_colonHostContextRe, `$1${_polyfillHostContext}`).replace(_colonHostRe, `$1${_polyfillHost}`).replace(_colonSlottedRe, `$1${_polyfillSlotted}`);
|
|
1421
|
+
return cssText;
|
|
1422
|
+
};
|
|
1423
|
+
var convertColonRule = (cssText, regExp, partReplacer) => {
|
|
1424
|
+
return cssText.replace(regExp, (...m) => {
|
|
1425
|
+
if (m[2]) {
|
|
1426
|
+
const parts = m[2].split(",");
|
|
1427
|
+
const r = [];
|
|
1428
|
+
for (let i2 = 0; i2 < parts.length; i2++) {
|
|
1429
|
+
const p = parts[i2].trim();
|
|
1430
|
+
if (!p) break;
|
|
1431
|
+
r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
|
|
1432
|
+
}
|
|
1433
|
+
return r.join(",");
|
|
1434
|
+
} else {
|
|
1435
|
+
return _polyfillHostNoCombinator + m[3];
|
|
1436
|
+
}
|
|
1437
|
+
});
|
|
1438
|
+
};
|
|
1439
|
+
var colonHostPartReplacer = (host, part, suffix) => {
|
|
1440
|
+
return host + part.replace(_polyfillHost, "") + suffix;
|
|
1441
|
+
};
|
|
1442
|
+
var convertColonHost = (cssText) => {
|
|
1443
|
+
return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer);
|
|
1444
|
+
};
|
|
1445
|
+
var colonHostContextPartReplacer = (host, part, suffix) => {
|
|
1446
|
+
if (part.indexOf(_polyfillHost) > -1) {
|
|
1447
|
+
return colonHostPartReplacer(host, part, suffix);
|
|
1448
|
+
} else {
|
|
1449
|
+
return host + part + suffix + ", " + part + " " + host + suffix;
|
|
1450
|
+
}
|
|
1451
|
+
};
|
|
1452
|
+
var convertColonSlotted = (cssText, slotScopeId) => {
|
|
1453
|
+
const slotClass = "." + slotScopeId + " > ";
|
|
1454
|
+
const selectors = [];
|
|
1455
|
+
cssText = cssText.replace(_cssColonSlottedRe, (...m) => {
|
|
1456
|
+
if (m[2]) {
|
|
1457
|
+
const compound = m[2].trim();
|
|
1458
|
+
const suffix = m[3];
|
|
1459
|
+
const slottedSelector = slotClass + compound + suffix;
|
|
1460
|
+
let prefixSelector = "";
|
|
1461
|
+
for (let i2 = m[4] - 1; i2 >= 0; i2--) {
|
|
1462
|
+
const char = m[5][i2];
|
|
1463
|
+
if (char === "}" || char === ",") {
|
|
1464
|
+
break;
|
|
1465
|
+
}
|
|
1466
|
+
prefixSelector = char + prefixSelector;
|
|
1467
|
+
}
|
|
1468
|
+
const orgSelector = (prefixSelector + slottedSelector).trim();
|
|
1469
|
+
const addedSelector = `${prefixSelector.trimEnd()}${slottedSelector.trim()}`.trim();
|
|
1470
|
+
if (orgSelector !== addedSelector) {
|
|
1471
|
+
const updatedSelector = `${addedSelector}, ${orgSelector}`;
|
|
1472
|
+
selectors.push({
|
|
1473
|
+
orgSelector,
|
|
1474
|
+
updatedSelector
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
return slottedSelector;
|
|
1478
|
+
} else {
|
|
1479
|
+
return _polyfillHostNoCombinator + m[3];
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
return {
|
|
1483
|
+
selectors,
|
|
1484
|
+
cssText
|
|
1485
|
+
};
|
|
1486
|
+
};
|
|
1487
|
+
var convertColonHostContext = (cssText) => {
|
|
1488
|
+
return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer);
|
|
1489
|
+
};
|
|
1490
|
+
var convertShadowDOMSelectors = (cssText) => {
|
|
1491
|
+
return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, " "), cssText);
|
|
1492
|
+
};
|
|
1493
|
+
var makeScopeMatcher = (scopeSelector2) => {
|
|
1494
|
+
const lre = /\[/g;
|
|
1495
|
+
const rre = /\]/g;
|
|
1496
|
+
scopeSelector2 = scopeSelector2.replace(lre, "\\[").replace(rre, "\\]");
|
|
1497
|
+
return new RegExp("^(" + scopeSelector2 + ")" + _selectorReSuffix, "m");
|
|
1498
|
+
};
|
|
1499
|
+
var selectorNeedsScoping = (selector, scopeSelector2) => {
|
|
1500
|
+
const re = makeScopeMatcher(scopeSelector2);
|
|
1501
|
+
return !re.test(selector);
|
|
1502
|
+
};
|
|
1503
|
+
var injectScopingSelector = (selector, scopingSelector) => {
|
|
1504
|
+
return selector.replace(_selectorPartsRe, (_, before = "", _colonGroup, colon = "", after = "") => {
|
|
1505
|
+
return before + scopingSelector + colon + after;
|
|
1506
|
+
});
|
|
1507
|
+
};
|
|
1508
|
+
var applySimpleSelectorScope = (selector, scopeSelector2, hostSelector) => {
|
|
1509
|
+
_polyfillHostRe.lastIndex = 0;
|
|
1510
|
+
if (_polyfillHostRe.test(selector)) {
|
|
1511
|
+
const replaceBy = `.${hostSelector}`;
|
|
1512
|
+
return selector.replace(_polyfillHostNoCombinatorRe, (_, selector2) => injectScopingSelector(selector2, replaceBy)).replace(_polyfillHostRe, replaceBy + " ");
|
|
1513
|
+
}
|
|
1514
|
+
return scopeSelector2 + " " + selector;
|
|
1515
|
+
};
|
|
1516
|
+
var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
|
|
1517
|
+
const isRe = /\[is=([^\]]*)\]/g;
|
|
1518
|
+
scopeSelector2 = scopeSelector2.replace(isRe, (_, ...parts) => parts[0]);
|
|
1519
|
+
const className = "." + scopeSelector2;
|
|
1520
|
+
const _scopeSelectorPart = (p) => {
|
|
1521
|
+
let scopedP = p.trim();
|
|
1522
|
+
if (!scopedP) {
|
|
1523
|
+
return "";
|
|
1524
|
+
}
|
|
1525
|
+
if (p.indexOf(_polyfillHostNoCombinator) > -1) {
|
|
1526
|
+
scopedP = applySimpleSelectorScope(p, scopeSelector2, hostSelector);
|
|
1527
|
+
} else {
|
|
1528
|
+
const t = p.replace(_polyfillHostRe, "");
|
|
1529
|
+
if (t.length > 0) {
|
|
1530
|
+
scopedP = injectScopingSelector(t, className);
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
return scopedP;
|
|
1534
|
+
};
|
|
1535
|
+
const safeContent = safeSelector(selector);
|
|
1536
|
+
selector = safeContent.content;
|
|
1537
|
+
let scopedSelector = "";
|
|
1538
|
+
let startIndex = 0;
|
|
1539
|
+
let res;
|
|
1540
|
+
const sep = /( |>|\+|~(?!=))\s*/g;
|
|
1541
|
+
const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
|
|
1542
|
+
let shouldScope = !hasHost;
|
|
1543
|
+
while ((res = sep.exec(selector)) !== null) {
|
|
1544
|
+
const separator = res[1];
|
|
1545
|
+
const part2 = selector.slice(startIndex, res.index).trim();
|
|
1546
|
+
shouldScope = shouldScope || part2.indexOf(_polyfillHostNoCombinator) > -1;
|
|
1547
|
+
const scopedPart = shouldScope ? _scopeSelectorPart(part2) : part2;
|
|
1548
|
+
scopedSelector += `${scopedPart} ${separator} `;
|
|
1549
|
+
startIndex = sep.lastIndex;
|
|
1550
|
+
}
|
|
1551
|
+
const part = selector.substring(startIndex);
|
|
1552
|
+
shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
|
|
1553
|
+
scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
|
|
1554
|
+
return restoreSafeSelector(safeContent.placeholders, scopedSelector);
|
|
1555
|
+
};
|
|
1556
|
+
var scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => {
|
|
1557
|
+
return selector.split(",").map((shallowPart) => {
|
|
1558
|
+
if (slotSelector && shallowPart.indexOf("." + slotSelector) > -1) {
|
|
1559
|
+
return shallowPart.trim();
|
|
1560
|
+
}
|
|
1561
|
+
if (selectorNeedsScoping(shallowPart, scopeSelectorText)) {
|
|
1562
|
+
return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim();
|
|
1563
|
+
} else {
|
|
1564
|
+
return shallowPart.trim();
|
|
1565
|
+
}
|
|
1566
|
+
}).join(", ");
|
|
1567
|
+
};
|
|
1568
|
+
var scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
1569
|
+
return processRules(cssText, (rule) => {
|
|
1570
|
+
let selector = rule.selector;
|
|
1571
|
+
let content = rule.content;
|
|
1572
|
+
if (rule.selector[0] !== "@") {
|
|
1573
|
+
selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
|
|
1574
|
+
} else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) {
|
|
1575
|
+
content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
|
|
1576
|
+
}
|
|
1577
|
+
const cssRule = {
|
|
1578
|
+
selector: selector.replace(/\s{2,}/g, " ").trim(),
|
|
1579
|
+
content
|
|
1580
|
+
};
|
|
1581
|
+
return cssRule;
|
|
1582
|
+
});
|
|
1583
|
+
};
|
|
1584
|
+
var scopeCssText = (cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector) => {
|
|
1585
|
+
cssText = insertPolyfillHostInCssText(cssText);
|
|
1586
|
+
cssText = convertColonHost(cssText);
|
|
1587
|
+
cssText = convertColonHostContext(cssText);
|
|
1588
|
+
const slotted = convertColonSlotted(cssText, slotScopeId);
|
|
1589
|
+
cssText = slotted.cssText;
|
|
1590
|
+
cssText = convertShadowDOMSelectors(cssText);
|
|
1591
|
+
if (scopeId2) {
|
|
1592
|
+
cssText = scopeSelectors(cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
1593
|
+
}
|
|
1594
|
+
cssText = replaceShadowCssHost(cssText, hostScopeId);
|
|
1595
|
+
cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, " $1 ");
|
|
1596
|
+
return {
|
|
1597
|
+
cssText: cssText.trim(),
|
|
1598
|
+
// We need to replace the shadow CSS host string in each of these selectors since we created
|
|
1599
|
+
// them prior to the replacement happening in the components CSS text.
|
|
1600
|
+
slottedSelectors: slotted.selectors.map((ref) => ({
|
|
1601
|
+
orgSelector: replaceShadowCssHost(ref.orgSelector, hostScopeId),
|
|
1602
|
+
updatedSelector: replaceShadowCssHost(ref.updatedSelector, hostScopeId)
|
|
1603
|
+
}))
|
|
1604
|
+
};
|
|
1605
|
+
};
|
|
1606
|
+
var replaceShadowCssHost = (cssText, hostScopeId) => {
|
|
1607
|
+
return cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
|
|
1608
|
+
};
|
|
1609
|
+
var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
|
|
1610
|
+
const hostScopeId = scopeId2 + "-h";
|
|
1611
|
+
const slotScopeId = scopeId2 + "-s";
|
|
1612
|
+
const commentsWithHash = extractCommentsWithHash(cssText);
|
|
1613
|
+
cssText = stripComments(cssText);
|
|
1614
|
+
const orgSelectors = [];
|
|
1615
|
+
if (commentOriginalSelector) {
|
|
1616
|
+
const processCommentedSelector = (rule) => {
|
|
1617
|
+
const placeholder = `/*!@___${orgSelectors.length}___*/`;
|
|
1618
|
+
const comment = `/*!@${rule.selector}*/`;
|
|
1619
|
+
orgSelectors.push({ placeholder, comment });
|
|
1620
|
+
rule.selector = placeholder + rule.selector;
|
|
1621
|
+
return rule;
|
|
1622
|
+
};
|
|
1623
|
+
cssText = processRules(cssText, (rule) => {
|
|
1624
|
+
if (rule.selector[0] !== "@") {
|
|
1625
|
+
return processCommentedSelector(rule);
|
|
1626
|
+
} else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) {
|
|
1627
|
+
rule.content = processRules(rule.content, processCommentedSelector);
|
|
1628
|
+
return rule;
|
|
1629
|
+
}
|
|
1630
|
+
return rule;
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
const scoped = scopeCssText(cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
1634
|
+
cssText = [scoped.cssText, ...commentsWithHash].join("\n");
|
|
1635
|
+
if (commentOriginalSelector) {
|
|
1636
|
+
orgSelectors.forEach(({ placeholder, comment }) => {
|
|
1637
|
+
cssText = cssText.replace(placeholder, comment);
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
scoped.slottedSelectors.forEach((slottedSelector) => {
|
|
1641
|
+
const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector), "g");
|
|
1642
|
+
cssText = cssText.replace(regex, slottedSelector.updatedSelector);
|
|
1643
|
+
});
|
|
1644
|
+
return cssText;
|
|
1645
|
+
};
|
|
1646
|
+
|
|
1235
1647
|
// src/runtime/mode.ts
|
|
1236
1648
|
var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
|
|
1237
1649
|
var setMode = (handler) => modeResolutionChain.push(handler);
|
|
@@ -1337,7 +1749,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1337
1749
|
if (nonce != null) {
|
|
1338
1750
|
styleElm.setAttribute("nonce", nonce);
|
|
1339
1751
|
}
|
|
1340
|
-
if ((BUILD10.hydrateServerSide || BUILD10.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
1752
|
+
if ((BUILD10.hydrateServerSide || BUILD10.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
|
|
1341
1753
|
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
|
|
1342
1754
|
}
|
|
1343
1755
|
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
@@ -1365,7 +1777,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1365
1777
|
styleContainerNode.append(styleElm);
|
|
1366
1778
|
}
|
|
1367
1779
|
}
|
|
1368
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */
|
|
1780
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1369
1781
|
styleContainerNode.insertBefore(styleElm, null);
|
|
1370
1782
|
}
|
|
1371
1783
|
}
|
|
@@ -1392,13 +1804,21 @@ var attachStyles = (hostRef) => {
|
|
|
1392
1804
|
cmpMeta,
|
|
1393
1805
|
hostRef.$modeName$
|
|
1394
1806
|
);
|
|
1395
|
-
if ((BUILD10.shadowDom || BUILD10.scoped) && BUILD10.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
|
|
1807
|
+
if ((BUILD10.shadowDom || BUILD10.scoped) && BUILD10.cssAnnotations && (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */ || flags & 128 /* shadowNeedsScopedCss */)) {
|
|
1396
1808
|
elm["s-sc"] = scopeId2;
|
|
1397
1809
|
elm.classList.add(scopeId2 + "-h");
|
|
1398
1810
|
}
|
|
1399
1811
|
endAttachStyles();
|
|
1400
1812
|
};
|
|
1401
1813
|
var getScopeId = (cmp, mode) => "sc-" + (BUILD10.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
|
|
1814
|
+
var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
|
|
1815
|
+
var hydrateScopedToShadow = () => {
|
|
1816
|
+
const styles2 = doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
|
1817
|
+
let i2 = 0;
|
|
1818
|
+
for (; i2 < styles2.length; i2++) {
|
|
1819
|
+
registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
|
|
1820
|
+
}
|
|
1821
|
+
};
|
|
1402
1822
|
|
|
1403
1823
|
// src/runtime/vdom/vdom-render.ts
|
|
1404
1824
|
import { BUILD as BUILD13 } from "@rindo/core/internal/app-data";
|
|
@@ -1409,112 +1829,113 @@ import { BUILD as BUILD12 } from "@rindo/core/internal/app-data";
|
|
|
1409
1829
|
// src/runtime/vdom/set-accessor.ts
|
|
1410
1830
|
import { BUILD as BUILD11 } from "@rindo/core/internal/app-data";
|
|
1411
1831
|
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
1412
|
-
if (oldValue
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
} else {
|
|
1437
|
-
elm.style[prop] = "";
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
for (const prop in newValue) {
|
|
1443
|
-
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
1832
|
+
if (oldValue === newValue) {
|
|
1833
|
+
return;
|
|
1834
|
+
}
|
|
1835
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
1836
|
+
let ln = memberName.toLowerCase();
|
|
1837
|
+
if (BUILD11.vdomClass && memberName === "class") {
|
|
1838
|
+
const classList = elm.classList;
|
|
1839
|
+
const oldClasses = parseClassList(oldValue);
|
|
1840
|
+
let newClasses = parseClassList(newValue);
|
|
1841
|
+
if (BUILD11.hydrateClientSide && elm["s-si"] && initialRender) {
|
|
1842
|
+
newClasses.push(elm["s-si"]);
|
|
1843
|
+
oldClasses.forEach((c) => {
|
|
1844
|
+
if (c.startsWith(elm["s-si"])) newClasses.push(c);
|
|
1845
|
+
});
|
|
1846
|
+
newClasses = [...new Set(newClasses)];
|
|
1847
|
+
classList.add(...newClasses);
|
|
1848
|
+
} else {
|
|
1849
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
1850
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
1851
|
+
}
|
|
1852
|
+
} else if (BUILD11.vdomStyle && memberName === "style") {
|
|
1853
|
+
if (BUILD11.updatable) {
|
|
1854
|
+
for (const prop in oldValue) {
|
|
1855
|
+
if (!newValue || newValue[prop] == null) {
|
|
1444
1856
|
if (!BUILD11.hydrateServerSide && prop.includes("-")) {
|
|
1445
|
-
elm.style.
|
|
1857
|
+
elm.style.removeProperty(prop);
|
|
1446
1858
|
} else {
|
|
1447
|
-
elm.style[prop] =
|
|
1859
|
+
elm.style[prop] = "";
|
|
1448
1860
|
}
|
|
1449
1861
|
}
|
|
1450
1862
|
}
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1863
|
+
}
|
|
1864
|
+
for (const prop in newValue) {
|
|
1865
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
1866
|
+
if (!BUILD11.hydrateServerSide && prop.includes("-")) {
|
|
1867
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
1868
|
+
} else {
|
|
1869
|
+
elm.style[prop] = newValue[prop];
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
} else if (BUILD11.vdomKey && memberName === "key") {
|
|
1874
|
+
} else if (BUILD11.vdomRef && memberName === "ref") {
|
|
1875
|
+
if (newValue) {
|
|
1876
|
+
newValue(elm);
|
|
1877
|
+
}
|
|
1878
|
+
} else if (BUILD11.vdomListener && (BUILD11.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
|
|
1879
|
+
if (memberName[2] === "-") {
|
|
1880
|
+
memberName = memberName.slice(3);
|
|
1881
|
+
} else if (isMemberInElement(win, ln)) {
|
|
1882
|
+
memberName = ln.slice(2);
|
|
1883
|
+
} else {
|
|
1884
|
+
memberName = ln[2] + memberName.slice(3);
|
|
1885
|
+
}
|
|
1886
|
+
if (oldValue || newValue) {
|
|
1887
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
1888
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
1889
|
+
if (oldValue) {
|
|
1890
|
+
plt.rel(elm, memberName, oldValue, capture);
|
|
1891
|
+
}
|
|
1453
1892
|
if (newValue) {
|
|
1454
|
-
|
|
1893
|
+
plt.ael(elm, memberName, newValue, capture);
|
|
1455
1894
|
}
|
|
1456
|
-
}
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
if (newValue) {
|
|
1471
|
-
plt.ael(elm, memberName, newValue, capture);
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
} else if (BUILD11.vdomPropOrAttr) {
|
|
1475
|
-
const isComplex = isComplexType(newValue);
|
|
1476
|
-
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
1477
|
-
try {
|
|
1478
|
-
if (!elm.tagName.includes("-")) {
|
|
1479
|
-
const n = newValue == null ? "" : newValue;
|
|
1480
|
-
if (memberName === "list") {
|
|
1481
|
-
isProp = false;
|
|
1482
|
-
} else if (oldValue == null || elm[memberName] != n) {
|
|
1483
|
-
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
1484
|
-
elm[memberName] = n;
|
|
1485
|
-
} else {
|
|
1486
|
-
elm.setAttribute(memberName, n);
|
|
1487
|
-
}
|
|
1895
|
+
}
|
|
1896
|
+
} else if (BUILD11.vdomPropOrAttr) {
|
|
1897
|
+
const isComplex = isComplexType(newValue);
|
|
1898
|
+
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
1899
|
+
try {
|
|
1900
|
+
if (!elm.tagName.includes("-")) {
|
|
1901
|
+
const n = newValue == null ? "" : newValue;
|
|
1902
|
+
if (memberName === "list") {
|
|
1903
|
+
isProp = false;
|
|
1904
|
+
} else if (oldValue == null || elm[memberName] != n) {
|
|
1905
|
+
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
1906
|
+
elm[memberName] = n;
|
|
1907
|
+
} else {
|
|
1908
|
+
elm.setAttribute(memberName, n);
|
|
1488
1909
|
}
|
|
1489
|
-
} else if (elm[memberName] !== newValue) {
|
|
1490
|
-
elm[memberName] = newValue;
|
|
1491
1910
|
}
|
|
1492
|
-
}
|
|
1911
|
+
} else if (elm[memberName] !== newValue) {
|
|
1912
|
+
elm[memberName] = newValue;
|
|
1493
1913
|
}
|
|
1914
|
+
} catch (e) {
|
|
1494
1915
|
}
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1916
|
+
}
|
|
1917
|
+
let xlink = false;
|
|
1918
|
+
if (BUILD11.vdomXlink) {
|
|
1919
|
+
if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
|
|
1920
|
+
memberName = ln;
|
|
1921
|
+
xlink = true;
|
|
1501
1922
|
}
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
1506
|
-
} else {
|
|
1507
|
-
elm.removeAttribute(memberName);
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
1511
|
-
newValue = newValue === true ? "" : newValue;
|
|
1923
|
+
}
|
|
1924
|
+
if (newValue == null || newValue === false) {
|
|
1925
|
+
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
|
1512
1926
|
if (BUILD11.vdomXlink && xlink) {
|
|
1513
|
-
elm.
|
|
1927
|
+
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
1514
1928
|
} else {
|
|
1515
|
-
elm.
|
|
1929
|
+
elm.removeAttribute(memberName);
|
|
1516
1930
|
}
|
|
1517
1931
|
}
|
|
1932
|
+
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
|
|
1933
|
+
newValue = newValue === true ? "" : newValue;
|
|
1934
|
+
if (BUILD11.vdomXlink && xlink) {
|
|
1935
|
+
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
1936
|
+
} else {
|
|
1937
|
+
elm.setAttribute(memberName, newValue);
|
|
1938
|
+
}
|
|
1518
1939
|
}
|
|
1519
1940
|
}
|
|
1520
1941
|
};
|
|
@@ -1612,6 +2033,9 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
1612
2033
|
elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
|
|
1613
2034
|
} else if (BUILD13.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
|
|
1614
2035
|
elm = newVNode2.$elm$ = BUILD13.isDebug || BUILD13.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
|
|
2036
|
+
if (BUILD13.vdomAttribute) {
|
|
2037
|
+
updateElement(null, newVNode2, isSvgMode);
|
|
2038
|
+
}
|
|
1615
2039
|
} else {
|
|
1616
2040
|
if (BUILD13.svg && !isSvgMode) {
|
|
1617
2041
|
isSvgMode = newVNode2.$tag$ === "svg";
|
|
@@ -1654,6 +2078,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
1654
2078
|
elm["s-cr"] = contentRef;
|
|
1655
2079
|
elm["s-sn"] = newVNode2.$name$ || "";
|
|
1656
2080
|
elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
|
|
2081
|
+
patchSlotNode(elm);
|
|
1657
2082
|
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
1658
2083
|
if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
|
|
1659
2084
|
if (BUILD13.experimentalSlotFixes) {
|
|
@@ -1880,9 +2305,8 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
1880
2305
|
newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
|
|
1881
2306
|
relocateToHostRoot(newVNode2.$elm$.parentElement);
|
|
1882
2307
|
}
|
|
1883
|
-
} else {
|
|
1884
|
-
updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
|
|
1885
2308
|
}
|
|
2309
|
+
updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
|
|
1886
2310
|
}
|
|
1887
2311
|
if (BUILD13.updatable && oldChildren !== null && newChildren !== null) {
|
|
1888
2312
|
updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
|
|
@@ -1969,7 +2393,10 @@ var insertBefore = (parent, newNode, reference) => {
|
|
|
1969
2393
|
if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
|
|
1970
2394
|
patchParentNode(newNode);
|
|
1971
2395
|
}
|
|
1972
|
-
|
|
2396
|
+
parent.insertBefore(newNode, reference);
|
|
2397
|
+
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
2398
|
+
if (slotNode) dispatchSlotChangeEvent(slotNode);
|
|
2399
|
+
return newNode;
|
|
1973
2400
|
}
|
|
1974
2401
|
if (BUILD13.experimentalSlotFixes && parent.__insertBefore) {
|
|
1975
2402
|
return parent.__insertBefore(newNode, reference);
|
|
@@ -2039,7 +2466,7 @@ render() {
|
|
|
2039
2466
|
if (BUILD13.scoped || BUILD13.shadowDom) {
|
|
2040
2467
|
scopeId = hostElm["s-sc"];
|
|
2041
2468
|
}
|
|
2042
|
-
useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)
|
|
2469
|
+
useNativeShadowDom = supportsShadow && !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
|
|
2043
2470
|
if (BUILD13.slotRelocation) {
|
|
2044
2471
|
contentRef = hostElm["s-cr"];
|
|
2045
2472
|
checkSlotFallbackVisibility = false;
|
|
@@ -2093,7 +2520,7 @@ render() {
|
|
|
2093
2520
|
}
|
|
2094
2521
|
}
|
|
2095
2522
|
}
|
|
2096
|
-
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](
|
|
2523
|
+
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
|
|
2097
2524
|
} else {
|
|
2098
2525
|
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
2099
2526
|
if (isInitialLoad) {
|
|
@@ -2174,19 +2601,13 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
2174
2601
|
}
|
|
2175
2602
|
}
|
|
2176
2603
|
emitLifecycleEvent(elm, "componentWillLoad");
|
|
2177
|
-
|
|
2178
|
-
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
2179
|
-
}
|
|
2604
|
+
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
2180
2605
|
} else {
|
|
2181
2606
|
emitLifecycleEvent(elm, "componentWillUpdate");
|
|
2182
|
-
|
|
2183
|
-
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
2184
|
-
}
|
|
2607
|
+
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
2185
2608
|
}
|
|
2186
2609
|
emitLifecycleEvent(elm, "componentWillRender");
|
|
2187
|
-
|
|
2188
|
-
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
2189
|
-
}
|
|
2610
|
+
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
2190
2611
|
endSchedule();
|
|
2191
2612
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
2192
2613
|
};
|
|
@@ -2294,14 +2715,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2294
2715
|
const endPostUpdate = createTime("postUpdate", tagName);
|
|
2295
2716
|
const instance = BUILD14.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
2296
2717
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
2297
|
-
if (BUILD14.
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2304
|
-
}
|
|
2718
|
+
if (BUILD14.isDev) {
|
|
2719
|
+
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
2720
|
+
}
|
|
2721
|
+
safeCall(instance, "componentDidRender", void 0, elm);
|
|
2722
|
+
if (BUILD14.isDev) {
|
|
2723
|
+
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2305
2724
|
}
|
|
2306
2725
|
emitLifecycleEvent(elm, "componentDidRender");
|
|
2307
2726
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
@@ -2309,14 +2728,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2309
2728
|
if (BUILD14.asyncLoading && BUILD14.cssAnnotations) {
|
|
2310
2729
|
addHydratedFlag(elm);
|
|
2311
2730
|
}
|
|
2312
|
-
if (BUILD14.
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
|
|
2319
|
-
}
|
|
2731
|
+
if (BUILD14.isDev) {
|
|
2732
|
+
hostRef.$flags$ |= 2048 /* devOnDidLoad */;
|
|
2733
|
+
}
|
|
2734
|
+
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
2735
|
+
if (BUILD14.isDev) {
|
|
2736
|
+
hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
|
|
2320
2737
|
}
|
|
2321
2738
|
emitLifecycleEvent(elm, "componentDidLoad");
|
|
2322
2739
|
endPostUpdate();
|
|
@@ -2327,14 +2744,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2327
2744
|
}
|
|
2328
2745
|
}
|
|
2329
2746
|
} else {
|
|
2330
|
-
if (BUILD14.
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2337
|
-
}
|
|
2747
|
+
if (BUILD14.isDev) {
|
|
2748
|
+
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
2749
|
+
}
|
|
2750
|
+
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
2751
|
+
if (BUILD14.isDev) {
|
|
2752
|
+
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2338
2753
|
}
|
|
2339
2754
|
emitLifecycleEvent(elm, "componentDidUpdate");
|
|
2340
2755
|
endPostUpdate();
|
|
@@ -2466,7 +2881,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2466
2881
|
}
|
|
2467
2882
|
}
|
|
2468
2883
|
if (BUILD15.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
2469
|
-
if (
|
|
2884
|
+
if (instance.componentShouldUpdate) {
|
|
2470
2885
|
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
2471
2886
|
return;
|
|
2472
2887
|
}
|
|
@@ -2731,9 +3146,8 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
2731
3146
|
const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
|
|
2732
3147
|
if (!styles.has(scopeId2)) {
|
|
2733
3148
|
const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
|
|
2734
|
-
if (
|
|
2735
|
-
|
|
2736
|
-
style = await import("../client/shadow-css.js").then((m) => m.scopeCss(style, scopeId2));
|
|
3149
|
+
if (BUILD17.hydrateServerSide && BUILD17.shadowDom && cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
|
|
3150
|
+
style = scopeCss(style, scopeId2, true);
|
|
2737
3151
|
}
|
|
2738
3152
|
registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
2739
3153
|
endRegisterStyles();
|
|
@@ -2749,7 +3163,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
2749
3163
|
}
|
|
2750
3164
|
};
|
|
2751
3165
|
var fireConnectedCallback = (instance, elm) => {
|
|
2752
|
-
if (BUILD17.lazyLoad
|
|
3166
|
+
if (BUILD17.lazyLoad) {
|
|
2753
3167
|
safeCall(instance, "connectedCallback", void 0, elm);
|
|
2754
3168
|
}
|
|
2755
3169
|
};
|
|
@@ -2830,12 +3244,9 @@ var setContentReference = (elm) => {
|
|
|
2830
3244
|
// src/runtime/disconnected-callback.ts
|
|
2831
3245
|
import { BUILD as BUILD19 } from "@rindo/core/internal/app-data";
|
|
2832
3246
|
var disconnectInstance = (instance, elm) => {
|
|
2833
|
-
if (BUILD19.lazyLoad
|
|
3247
|
+
if (BUILD19.lazyLoad) {
|
|
2834
3248
|
safeCall(instance, "disconnectedCallback", void 0, elm || instance);
|
|
2835
3249
|
}
|
|
2836
|
-
if (BUILD19.cmpDidUnload) {
|
|
2837
|
-
safeCall(instance, "componentDidUnload", void 0, elm || instance);
|
|
2838
|
-
}
|
|
2839
3250
|
};
|
|
2840
3251
|
var disconnectedCallback = async (elm) => {
|
|
2841
3252
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
@@ -2904,6 +3315,9 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
2904
3315
|
patchTextContent(Cstr.prototype);
|
|
2905
3316
|
}
|
|
2906
3317
|
}
|
|
3318
|
+
if (BUILD20.hydrateClientSide && BUILD20.shadowDom) {
|
|
3319
|
+
hydrateScopedToShadow();
|
|
3320
|
+
}
|
|
2907
3321
|
const originalConnectedCallback = Cstr.prototype.connectedCallback;
|
|
2908
3322
|
const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
|
|
2909
3323
|
Object.assign(Cstr.prototype, {
|
|
@@ -2918,25 +3332,15 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
2918
3332
|
this.__hasHostListenerAttached = true;
|
|
2919
3333
|
}
|
|
2920
3334
|
connectedCallback(this);
|
|
2921
|
-
if (
|
|
3335
|
+
if (originalConnectedCallback) {
|
|
2922
3336
|
originalConnectedCallback.call(this);
|
|
2923
3337
|
}
|
|
2924
3338
|
},
|
|
2925
3339
|
disconnectedCallback() {
|
|
2926
3340
|
disconnectedCallback(this);
|
|
2927
|
-
if (
|
|
3341
|
+
if (originalDisconnectedCallback) {
|
|
2928
3342
|
originalDisconnectedCallback.call(this);
|
|
2929
3343
|
}
|
|
2930
|
-
plt.raf(() => {
|
|
2931
|
-
var _a;
|
|
2932
|
-
const hostRef = getHostRef(this);
|
|
2933
|
-
if (((_a = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
|
|
2934
|
-
delete hostRef.$vnode$;
|
|
2935
|
-
}
|
|
2936
|
-
if (this instanceof Node && !this.isConnected) {
|
|
2937
|
-
deleteHostRef(this);
|
|
2938
|
-
}
|
|
2939
|
-
});
|
|
2940
3344
|
},
|
|
2941
3345
|
__attachShadow() {
|
|
2942
3346
|
if (supportsShadow) {
|
|
@@ -3024,6 +3428,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3024
3428
|
if (BUILD21.hydrateClientSide) {
|
|
3025
3429
|
plt.$flags$ |= 2 /* appLoaded */;
|
|
3026
3430
|
}
|
|
3431
|
+
if (BUILD21.hydrateClientSide && BUILD21.shadowDom) {
|
|
3432
|
+
hydrateScopedToShadow();
|
|
3433
|
+
}
|
|
3027
3434
|
let hasSlotRelocation = false;
|
|
3028
3435
|
lazyBundles.map((lazyBundle) => {
|
|
3029
3436
|
lazyBundle[1].map((compactMeta) => {
|
|
@@ -3412,7 +3819,7 @@ function proxyHostElement(elm, cstr) {
|
|
|
3412
3819
|
if (typeof elm.forceUpdate !== "function") {
|
|
3413
3820
|
elm.forceUpdate = forceUpdate2;
|
|
3414
3821
|
}
|
|
3415
|
-
if (!elm.shadowRoot && !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
3822
|
+
if (!elm.shadowRoot && !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
|
|
3416
3823
|
if (BUILD23.shadowDelegatesFocus) {
|
|
3417
3824
|
elm.attachShadow({
|
|
3418
3825
|
mode: "open",
|
|
@@ -3453,16 +3860,18 @@ function proxyHostElement(elm, cstr) {
|
|
|
3453
3860
|
}
|
|
3454
3861
|
(_a = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _a.set(memberName, attrPropVal);
|
|
3455
3862
|
}
|
|
3456
|
-
|
|
3863
|
+
const getterSetterDescriptor = {
|
|
3457
3864
|
get: function() {
|
|
3458
3865
|
return getValue(this, memberName);
|
|
3459
3866
|
},
|
|
3460
|
-
set(newValue) {
|
|
3867
|
+
set: function(newValue) {
|
|
3461
3868
|
setValue(this, memberName, newValue, cmpMeta);
|
|
3462
3869
|
},
|
|
3463
3870
|
configurable: true,
|
|
3464
3871
|
enumerable: true
|
|
3465
|
-
}
|
|
3872
|
+
};
|
|
3873
|
+
Object.defineProperty(elm, memberName, getterSetterDescriptor);
|
|
3874
|
+
Object.defineProperty(elm, metaAttributeName, getterSetterDescriptor);
|
|
3466
3875
|
if (!cstr.prototype.__rindoAugmented) {
|
|
3467
3876
|
Object.defineProperty(cstr.prototype, memberName, {
|
|
3468
3877
|
get: function() {
|
|
@@ -3554,6 +3963,15 @@ function hydrateApp(win2, opts, results, afterHydrate, resolve) {
|
|
|
3554
3963
|
null
|
|
3555
3964
|
);
|
|
3556
3965
|
if (Cstr != null && Cstr.cmpMeta != null) {
|
|
3966
|
+
if (opts.serializeShadowRoot !== false && !!(Cstr.cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && tagRequiresScoped(elm.tagName, opts.serializeShadowRoot)) {
|
|
3967
|
+
const cmpMeta = Cstr.cmpMeta;
|
|
3968
|
+
cmpMeta.$flags$ |= 128 /* shadowNeedsScopedCss */;
|
|
3969
|
+
Object.defineProperty(Cstr, "cmpMeta", {
|
|
3970
|
+
get: function() {
|
|
3971
|
+
return cmpMeta;
|
|
3972
|
+
}
|
|
3973
|
+
});
|
|
3974
|
+
}
|
|
3557
3975
|
createdElements.add(elm);
|
|
3558
3976
|
elm.connectedCallback = patchedConnectedCallback2;
|
|
3559
3977
|
registerHost(elm, Cstr.cmpMeta);
|
|
@@ -3750,6 +4168,25 @@ ${indent}${ln}`;
|
|
|
3750
4168
|
function waitingOnElementsMsg(waitingElements) {
|
|
3751
4169
|
return Array.from(waitingElements).map(waitingOnElementMsg);
|
|
3752
4170
|
}
|
|
4171
|
+
function tagRequiresScoped(tagName, opts) {
|
|
4172
|
+
if (typeof opts === "string") {
|
|
4173
|
+
return opts === "scoped";
|
|
4174
|
+
}
|
|
4175
|
+
if (typeof opts === "boolean") {
|
|
4176
|
+
return opts === true ? false : true;
|
|
4177
|
+
}
|
|
4178
|
+
if (typeof opts === "object") {
|
|
4179
|
+
tagName = tagName.toLowerCase();
|
|
4180
|
+
if (Array.isArray(opts["declarative-shadow-dom"]) && opts["declarative-shadow-dom"].includes(tagName)) {
|
|
4181
|
+
return false;
|
|
4182
|
+
} else if ((!Array.isArray(opts.scoped) || !opts.scoped.includes(tagName)) && opts.default === "declarative-shadow-dom") {
|
|
4183
|
+
return false;
|
|
4184
|
+
} else {
|
|
4185
|
+
return true;
|
|
4186
|
+
}
|
|
4187
|
+
}
|
|
4188
|
+
return false;
|
|
4189
|
+
}
|
|
3753
4190
|
|
|
3754
4191
|
// src/hydrate/platform/index.ts
|
|
3755
4192
|
import { BUILD as BUILD25, Env, NAMESPACE as NAMESPACE2 } from "@rindo/core/internal/app-data";
|
|
@@ -3841,15 +4278,19 @@ var setPlatformHelpers = (helpers) => {
|
|
|
3841
4278
|
var supportsShadow = BUILD24.shadowDom;
|
|
3842
4279
|
var supportsListenerOptions = false;
|
|
3843
4280
|
var supportsConstructableStylesheets = false;
|
|
3844
|
-
var
|
|
3845
|
-
|
|
3846
|
-
|
|
4281
|
+
var getHostRef = (ref) => {
|
|
4282
|
+
if (ref.__rindo__getHostRef) {
|
|
4283
|
+
return ref.__rindo__getHostRef();
|
|
4284
|
+
}
|
|
4285
|
+
return void 0;
|
|
4286
|
+
};
|
|
3847
4287
|
var registerInstance = (lazyInstance, hostRef) => {
|
|
3848
|
-
|
|
4288
|
+
lazyInstance.__rindo__getHostRef = () => hostRef;
|
|
4289
|
+
hostRef.$lazyInstance$ = lazyInstance;
|
|
3849
4290
|
if (BUILD24.modernPropertyDecls && (BUILD24.state || BUILD24.prop)) {
|
|
3850
4291
|
reWireGetterSetter(lazyInstance, hostRef);
|
|
3851
4292
|
}
|
|
3852
|
-
return
|
|
4293
|
+
return hostRef;
|
|
3853
4294
|
};
|
|
3854
4295
|
var registerHost = (elm, cmpMeta) => {
|
|
3855
4296
|
const hostRef = {
|
|
@@ -3863,7 +4304,8 @@ var registerHost = (elm, cmpMeta) => {
|
|
|
3863
4304
|
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
|
|
3864
4305
|
elm["s-p"] = [];
|
|
3865
4306
|
elm["s-rc"] = [];
|
|
3866
|
-
|
|
4307
|
+
elm.__rindo__getHostRef = () => hostRef;
|
|
4308
|
+
return hostRef;
|
|
3867
4309
|
};
|
|
3868
4310
|
var Build = {
|
|
3869
4311
|
isDev: false,
|
|
@@ -3890,7 +4332,6 @@ export {
|
|
|
3890
4332
|
consoleError,
|
|
3891
4333
|
createEvent,
|
|
3892
4334
|
defineCustomElement,
|
|
3893
|
-
deleteHostRef,
|
|
3894
4335
|
disconnectedCallback,
|
|
3895
4336
|
doc,
|
|
3896
4337
|
forceModeUpdate,
|