@rindo/core 4.26.0 → 4.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.cjs +4 -4
- package/cli/index.js +1 -1
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +1518 -1472
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +4 -4
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +4 -4
- package/internal/app-data/index.cjs +3 -14
- package/internal/app-data/index.js +0 -11
- package/internal/app-data/package.json +1 -1
- package/internal/client/index.js +304 -263
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +3 -3
- package/internal/hydrate/index.js +308 -266
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +110 -111
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +6 -13
- package/internal/testing/index.js +299 -266
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +231 -231
- package/mock-doc/index.js +228 -228
- package/mock-doc/package.json +1 -1
- package/package.json +2 -2
- package/screenshot/index.js +4 -4
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +3 -3
- package/sys/node/index.js +9 -9
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +9 -16
- package/testing/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rindo Hydrate Platform v4.
|
|
2
|
+
Rindo Hydrate Platform v4.27.1 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -59,9 +59,9 @@ var isComplexType = (o) => {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
// src/utils/query-nonce-meta-tag-content.ts
|
|
62
|
-
function queryNonceMetaTagContent(
|
|
62
|
+
function queryNonceMetaTagContent(doc) {
|
|
63
63
|
var _a, _b, _c;
|
|
64
|
-
return (_c = (_b = (_a =
|
|
64
|
+
return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// src/utils/regular-expression.ts
|
|
@@ -157,12 +157,11 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
|
|
157
157
|
|
|
158
158
|
// src/runtime/slot-polyfill-utils.ts
|
|
159
159
|
var updateFallbackSlotVisibility = (elm) => {
|
|
160
|
-
const childNodes = elm
|
|
160
|
+
const childNodes = internalCall(elm, "childNodes");
|
|
161
161
|
if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
|
|
162
162
|
getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
|
|
163
|
-
var _a;
|
|
164
163
|
if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
|
|
165
|
-
if ((
|
|
164
|
+
if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
|
|
166
165
|
slotNode.hidden = true;
|
|
167
166
|
} else {
|
|
168
167
|
slotNode.hidden = false;
|
|
@@ -170,8 +169,10 @@ var updateFallbackSlotVisibility = (elm) => {
|
|
|
170
169
|
}
|
|
171
170
|
});
|
|
172
171
|
}
|
|
173
|
-
|
|
174
|
-
|
|
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) {
|
|
175
176
|
updateFallbackSlotVisibility(childNode);
|
|
176
177
|
}
|
|
177
178
|
}
|
|
@@ -192,7 +193,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
192
193
|
let childNode;
|
|
193
194
|
for (; i2 < childNodes.length; i2++) {
|
|
194
195
|
childNode = childNodes[i2];
|
|
195
|
-
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)) {
|
|
196
197
|
slottedNodes.push(childNode);
|
|
197
198
|
if (typeof slotName !== "undefined") return slottedNodes;
|
|
198
199
|
}
|
|
@@ -200,11 +201,12 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
200
201
|
}
|
|
201
202
|
return slottedNodes;
|
|
202
203
|
}
|
|
203
|
-
var
|
|
204
|
+
var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
|
|
204
205
|
const childNodes = [];
|
|
205
|
-
if (includeSlot &&
|
|
206
|
-
|
|
207
|
-
|
|
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);
|
|
208
210
|
}
|
|
209
211
|
return childNodes;
|
|
210
212
|
};
|
|
@@ -224,38 +226,73 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
|
|
|
224
226
|
return slotName === "";
|
|
225
227
|
};
|
|
226
228
|
var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
|
|
227
|
-
let slottedNodeLocation;
|
|
228
229
|
if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
|
|
229
|
-
|
|
230
|
-
} else {
|
|
231
|
-
slottedNodeLocation = document.createTextNode("");
|
|
232
|
-
slottedNodeLocation["s-nr"] = newChild;
|
|
230
|
+
return;
|
|
233
231
|
}
|
|
232
|
+
const slottedNodeLocation = document.createTextNode("");
|
|
233
|
+
slottedNodeLocation["s-nr"] = newChild;
|
|
234
234
|
if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
|
|
235
235
|
const parent = slotNode["s-cr"].parentNode;
|
|
236
|
-
const appendMethod = prepend ? parent
|
|
237
|
-
if (typeof position !== "undefined") {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
|
|
251
|
-
}
|
|
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));
|
|
252
250
|
} else {
|
|
253
251
|
appendMethod.call(parent, slottedNodeLocation);
|
|
254
252
|
}
|
|
255
253
|
newChild["s-ol"] = slottedNodeLocation;
|
|
256
254
|
newChild["s-sh"] = slotNode["s-hn"];
|
|
257
255
|
};
|
|
258
|
-
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
|
+
}
|
|
259
296
|
|
|
260
297
|
// src/runtime/dom-extras.ts
|
|
261
298
|
var patchPseudoShadowDom = (hostElementPrototype) => {
|
|
@@ -319,19 +356,14 @@ var patchCloneNode = (HostElementPrototype) => {
|
|
|
319
356
|
var patchSlotAppendChild = (HostElementPrototype) => {
|
|
320
357
|
HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
|
|
321
358
|
HostElementPrototype.appendChild = function(newChild) {
|
|
322
|
-
const slotName
|
|
323
|
-
const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
|
|
359
|
+
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
324
360
|
if (slotNode) {
|
|
325
361
|
addSlotRelocateNode(newChild, slotNode);
|
|
326
|
-
const slotChildNodes =
|
|
362
|
+
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
327
363
|
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
328
|
-
const parent =
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
insertedNode = parent.__insertBefore(newChild, appendAfter.nextSibling);
|
|
332
|
-
} else {
|
|
333
|
-
insertedNode = parent.insertBefore(newChild, appendAfter.nextSibling);
|
|
334
|
-
}
|
|
364
|
+
const parent = internalCall(appendAfter, "parentNode");
|
|
365
|
+
const insertedNode = internalCall(parent, "insertBefore")(newChild, appendAfter.nextSibling);
|
|
366
|
+
dispatchSlotChangeEvent(slotNode);
|
|
335
367
|
updateFallbackSlotVisibility(this);
|
|
336
368
|
return insertedNode;
|
|
337
369
|
}
|
|
@@ -360,19 +392,17 @@ var patchSlotPrepend = (HostElementPrototype) => {
|
|
|
360
392
|
if (typeof newChild === "string") {
|
|
361
393
|
newChild = this.ownerDocument.createTextNode(newChild);
|
|
362
394
|
}
|
|
363
|
-
const slotName = newChild["s-sn"] = getSlotName(newChild);
|
|
364
|
-
const childNodes = this
|
|
395
|
+
const slotName = (newChild["s-sn"] = getSlotName(newChild)) || "";
|
|
396
|
+
const childNodes = internalCall(this, "childNodes");
|
|
365
397
|
const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
|
|
366
398
|
if (slotNode) {
|
|
367
399
|
addSlotRelocateNode(newChild, slotNode, true);
|
|
368
|
-
const slotChildNodes =
|
|
400
|
+
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
369
401
|
const appendAfter = slotChildNodes[0];
|
|
370
|
-
const parent =
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
return parent.insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
|
|
375
|
-
}
|
|
402
|
+
const parent = internalCall(appendAfter, "parentNode");
|
|
403
|
+
const toReturn = internalCall(parent, "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
|
|
404
|
+
dispatchSlotChangeEvent(slotNode);
|
|
405
|
+
return toReturn;
|
|
376
406
|
}
|
|
377
407
|
if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
|
|
378
408
|
newChild.hidden = true;
|
|
@@ -422,8 +452,7 @@ var patchInsertBefore = (HostElementPrototype) => {
|
|
|
422
452
|
if (eleProto.__insertBefore) return;
|
|
423
453
|
eleProto.__insertBefore = HostElementPrototype.insertBefore;
|
|
424
454
|
HostElementPrototype.insertBefore = function(newChild, currentChild) {
|
|
425
|
-
const slotName
|
|
426
|
-
const slotNode = getHostSlotNodes(this.__childNodes, this.tagName, slotName)[0];
|
|
455
|
+
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
427
456
|
const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
|
|
428
457
|
if (slotNode) {
|
|
429
458
|
let found = false;
|
|
@@ -436,18 +465,19 @@ var patchInsertBefore = (HostElementPrototype) => {
|
|
|
436
465
|
}
|
|
437
466
|
if (slotName === currentChild["s-sn"]) {
|
|
438
467
|
addSlotRelocateNode(newChild, slotNode);
|
|
439
|
-
const parent =
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
} else {
|
|
443
|
-
parent.insertBefore(newChild, currentChild);
|
|
444
|
-
}
|
|
468
|
+
const parent = internalCall(currentChild, "parentNode");
|
|
469
|
+
internalCall(parent, "insertBefore")(newChild, currentChild);
|
|
470
|
+
dispatchSlotChangeEvent(slotNode);
|
|
445
471
|
}
|
|
446
472
|
return;
|
|
447
473
|
}
|
|
448
474
|
});
|
|
449
475
|
if (found) return newChild;
|
|
450
476
|
}
|
|
477
|
+
const parentNode = currentChild == null ? void 0 : currentChild.__parentNode;
|
|
478
|
+
if (parentNode && !this.isSameNode(parentNode)) {
|
|
479
|
+
return this.appendChild(newChild);
|
|
480
|
+
}
|
|
451
481
|
return this.__insertBefore(newChild, currentChild);
|
|
452
482
|
};
|
|
453
483
|
};
|
|
@@ -525,7 +555,7 @@ var patchChildSlotNodes = (elm) => {
|
|
|
525
555
|
});
|
|
526
556
|
};
|
|
527
557
|
var patchSlottedNode = (node) => {
|
|
528
|
-
if (!node || node.__nextSibling || !globalThis.Node) return;
|
|
558
|
+
if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
|
|
529
559
|
patchNextSibling(node);
|
|
530
560
|
patchPreviousSibling(node);
|
|
531
561
|
patchParentNode(node);
|
|
@@ -629,11 +659,14 @@ function patchHostOriginalAccessor(accessorName, node) {
|
|
|
629
659
|
}
|
|
630
660
|
if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
|
|
631
661
|
}
|
|
632
|
-
function
|
|
662
|
+
function internalCall(node, method) {
|
|
633
663
|
if ("__" + method in node) {
|
|
634
|
-
|
|
664
|
+
const toReturn = node["__" + method];
|
|
665
|
+
if (typeof toReturn !== "function") return toReturn;
|
|
666
|
+
return toReturn.bind(node);
|
|
635
667
|
} else {
|
|
636
|
-
return node[method];
|
|
668
|
+
if (typeof node[method] !== "function") return node[method];
|
|
669
|
+
return node[method].bind(node);
|
|
637
670
|
}
|
|
638
671
|
}
|
|
639
672
|
|
|
@@ -883,8 +916,8 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
883
916
|
delete hostElm["s-sc"];
|
|
884
917
|
}
|
|
885
918
|
}
|
|
886
|
-
if (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size) {
|
|
887
|
-
initializeDocumentHydrate(
|
|
919
|
+
if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
|
|
920
|
+
initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
|
|
888
921
|
}
|
|
889
922
|
hostElm[HYDRATE_ID] = hostId;
|
|
890
923
|
hostElm.removeAttribute(HYDRATE_ID);
|
|
@@ -1210,8 +1243,8 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
|
|
|
1210
1243
|
childVNode.$name$ = slotName || null;
|
|
1211
1244
|
childVNode.$tag$ = "slot";
|
|
1212
1245
|
const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
|
|
1213
|
-
if (BUILD6.shadowDom && shadowRootNodes) {
|
|
1214
|
-
const slot = childVNode.$elm$ =
|
|
1246
|
+
if (BUILD6.shadowDom && shadowRootNodes && win.document) {
|
|
1247
|
+
const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
|
|
1215
1248
|
if (childVNode.$name$) {
|
|
1216
1249
|
childVNode.$elm$.setAttribute("name", slotName);
|
|
1217
1250
|
}
|
|
@@ -1229,6 +1262,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
|
|
|
1229
1262
|
const slot = childVNode.$elm$;
|
|
1230
1263
|
const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
|
|
1231
1264
|
addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
|
|
1265
|
+
patchSlotNode(node);
|
|
1232
1266
|
if (shouldMove) {
|
|
1233
1267
|
parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
|
|
1234
1268
|
}
|
|
@@ -1693,10 +1727,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1693
1727
|
var _a;
|
|
1694
1728
|
const scopeId2 = getScopeId(cmpMeta, mode);
|
|
1695
1729
|
const style = styles.get(scopeId2);
|
|
1696
|
-
if (!BUILD10.attachStyles) {
|
|
1730
|
+
if (!BUILD10.attachStyles || !win.document) {
|
|
1697
1731
|
return scopeId2;
|
|
1698
1732
|
}
|
|
1699
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode :
|
|
1733
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
|
|
1700
1734
|
if (style) {
|
|
1701
1735
|
if (typeof style === "string") {
|
|
1702
1736
|
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
@@ -1709,9 +1743,9 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1709
1743
|
if (BUILD10.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
|
|
1710
1744
|
styleElm.innerHTML = style;
|
|
1711
1745
|
} else {
|
|
1712
|
-
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) ||
|
|
1746
|
+
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
|
|
1713
1747
|
styleElm.innerHTML = style;
|
|
1714
|
-
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(
|
|
1748
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
1715
1749
|
if (nonce != null) {
|
|
1716
1750
|
styleElm.setAttribute("nonce", nonce);
|
|
1717
1751
|
}
|
|
@@ -1779,7 +1813,10 @@ var attachStyles = (hostRef) => {
|
|
|
1779
1813
|
var getScopeId = (cmp, mode) => "sc-" + (BUILD10.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
|
|
1780
1814
|
var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
|
|
1781
1815
|
var hydrateScopedToShadow = () => {
|
|
1782
|
-
|
|
1816
|
+
if (!win.document) {
|
|
1817
|
+
return;
|
|
1818
|
+
}
|
|
1819
|
+
const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
|
1783
1820
|
let i2 = 0;
|
|
1784
1821
|
for (; i2 < styles2.length; i2++) {
|
|
1785
1822
|
registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
|
|
@@ -1795,112 +1832,113 @@ import { BUILD as BUILD12 } from "@rindo/core/internal/app-data";
|
|
|
1795
1832
|
// src/runtime/vdom/set-accessor.ts
|
|
1796
1833
|
import { BUILD as BUILD11 } from "@rindo/core/internal/app-data";
|
|
1797
1834
|
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
1798
|
-
if (oldValue
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
} else {
|
|
1823
|
-
elm.style[prop] = "";
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
for (const prop in newValue) {
|
|
1829
|
-
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
1835
|
+
if (oldValue === newValue) {
|
|
1836
|
+
return;
|
|
1837
|
+
}
|
|
1838
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
1839
|
+
let ln = memberName.toLowerCase();
|
|
1840
|
+
if (BUILD11.vdomClass && memberName === "class") {
|
|
1841
|
+
const classList = elm.classList;
|
|
1842
|
+
const oldClasses = parseClassList(oldValue);
|
|
1843
|
+
let newClasses = parseClassList(newValue);
|
|
1844
|
+
if (BUILD11.hydrateClientSide && elm["s-si"] && initialRender) {
|
|
1845
|
+
newClasses.push(elm["s-si"]);
|
|
1846
|
+
oldClasses.forEach((c) => {
|
|
1847
|
+
if (c.startsWith(elm["s-si"])) newClasses.push(c);
|
|
1848
|
+
});
|
|
1849
|
+
newClasses = [...new Set(newClasses)];
|
|
1850
|
+
classList.add(...newClasses);
|
|
1851
|
+
} else {
|
|
1852
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
1853
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
1854
|
+
}
|
|
1855
|
+
} else if (BUILD11.vdomStyle && memberName === "style") {
|
|
1856
|
+
if (BUILD11.updatable) {
|
|
1857
|
+
for (const prop in oldValue) {
|
|
1858
|
+
if (!newValue || newValue[prop] == null) {
|
|
1830
1859
|
if (!BUILD11.hydrateServerSide && prop.includes("-")) {
|
|
1831
|
-
elm.style.
|
|
1860
|
+
elm.style.removeProperty(prop);
|
|
1832
1861
|
} else {
|
|
1833
|
-
elm.style[prop] =
|
|
1862
|
+
elm.style[prop] = "";
|
|
1834
1863
|
}
|
|
1835
1864
|
}
|
|
1836
1865
|
}
|
|
1837
|
-
}
|
|
1838
|
-
|
|
1839
|
-
if (newValue) {
|
|
1840
|
-
|
|
1866
|
+
}
|
|
1867
|
+
for (const prop in newValue) {
|
|
1868
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
1869
|
+
if (!BUILD11.hydrateServerSide && prop.includes("-")) {
|
|
1870
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
1871
|
+
} else {
|
|
1872
|
+
elm.style[prop] = newValue[prop];
|
|
1873
|
+
}
|
|
1841
1874
|
}
|
|
1842
|
-
}
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1875
|
+
}
|
|
1876
|
+
} else if (BUILD11.vdomKey && memberName === "key") {
|
|
1877
|
+
} else if (BUILD11.vdomRef && memberName === "ref") {
|
|
1878
|
+
if (newValue) {
|
|
1879
|
+
newValue(elm);
|
|
1880
|
+
}
|
|
1881
|
+
} else if (BUILD11.vdomListener && (BUILD11.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
|
|
1882
|
+
if (memberName[2] === "-") {
|
|
1883
|
+
memberName = memberName.slice(3);
|
|
1884
|
+
} else if (isMemberInElement(win, ln)) {
|
|
1885
|
+
memberName = ln.slice(2);
|
|
1886
|
+
} else {
|
|
1887
|
+
memberName = ln[2] + memberName.slice(3);
|
|
1888
|
+
}
|
|
1889
|
+
if (oldValue || newValue) {
|
|
1890
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
1891
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
1892
|
+
if (oldValue) {
|
|
1893
|
+
plt.rel(elm, memberName, oldValue, capture);
|
|
1849
1894
|
}
|
|
1850
|
-
if (
|
|
1851
|
-
|
|
1852
|
-
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
1853
|
-
if (oldValue) {
|
|
1854
|
-
plt.rel(elm, memberName, oldValue, capture);
|
|
1855
|
-
}
|
|
1856
|
-
if (newValue) {
|
|
1857
|
-
plt.ael(elm, memberName, newValue, capture);
|
|
1858
|
-
}
|
|
1895
|
+
if (newValue) {
|
|
1896
|
+
plt.ael(elm, memberName, newValue, capture);
|
|
1859
1897
|
}
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1898
|
+
}
|
|
1899
|
+
} else if (BUILD11.vdomPropOrAttr) {
|
|
1900
|
+
const isComplex = isComplexType(newValue);
|
|
1901
|
+
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
1902
|
+
try {
|
|
1903
|
+
if (!elm.tagName.includes("-")) {
|
|
1904
|
+
const n = newValue == null ? "" : newValue;
|
|
1905
|
+
if (memberName === "list") {
|
|
1906
|
+
isProp = false;
|
|
1907
|
+
} else if (oldValue == null || elm[memberName] != n) {
|
|
1908
|
+
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
1909
|
+
elm[memberName] = n;
|
|
1910
|
+
} else {
|
|
1911
|
+
elm.setAttribute(memberName, n);
|
|
1874
1912
|
}
|
|
1875
|
-
} else if (elm[memberName] !== newValue) {
|
|
1876
|
-
elm[memberName] = newValue;
|
|
1877
1913
|
}
|
|
1878
|
-
}
|
|
1914
|
+
} else if (elm[memberName] !== newValue) {
|
|
1915
|
+
elm[memberName] = newValue;
|
|
1879
1916
|
}
|
|
1917
|
+
} catch (e) {
|
|
1880
1918
|
}
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1919
|
+
}
|
|
1920
|
+
let xlink = false;
|
|
1921
|
+
if (BUILD11.vdomXlink) {
|
|
1922
|
+
if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
|
|
1923
|
+
memberName = ln;
|
|
1924
|
+
xlink = true;
|
|
1887
1925
|
}
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
1892
|
-
} else {
|
|
1893
|
-
elm.removeAttribute(memberName);
|
|
1894
|
-
}
|
|
1895
|
-
}
|
|
1896
|
-
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
1897
|
-
newValue = newValue === true ? "" : newValue;
|
|
1926
|
+
}
|
|
1927
|
+
if (newValue == null || newValue === false) {
|
|
1928
|
+
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
|
1898
1929
|
if (BUILD11.vdomXlink && xlink) {
|
|
1899
|
-
elm.
|
|
1930
|
+
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
1900
1931
|
} else {
|
|
1901
|
-
elm.
|
|
1932
|
+
elm.removeAttribute(memberName);
|
|
1902
1933
|
}
|
|
1903
1934
|
}
|
|
1935
|
+
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
|
|
1936
|
+
newValue = newValue === true ? "" : newValue;
|
|
1937
|
+
if (BUILD11.vdomXlink && xlink) {
|
|
1938
|
+
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
1939
|
+
} else {
|
|
1940
|
+
elm.setAttribute(memberName, newValue);
|
|
1941
|
+
}
|
|
1904
1942
|
}
|
|
1905
1943
|
}
|
|
1906
1944
|
};
|
|
@@ -1995,17 +2033,25 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
1995
2033
|
);
|
|
1996
2034
|
}
|
|
1997
2035
|
if (BUILD13.vdomText && newVNode2.$text$ !== null) {
|
|
1998
|
-
elm = newVNode2.$elm$ =
|
|
2036
|
+
elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
|
|
1999
2037
|
} else if (BUILD13.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
|
|
2000
|
-
elm = newVNode2.$elm$ = BUILD13.isDebug || BUILD13.hydrateServerSide ? slotReferenceDebugNode(newVNode2) :
|
|
2038
|
+
elm = newVNode2.$elm$ = BUILD13.isDebug || BUILD13.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : win.document.createTextNode("");
|
|
2039
|
+
if (BUILD13.vdomAttribute) {
|
|
2040
|
+
updateElement(null, newVNode2, isSvgMode);
|
|
2041
|
+
}
|
|
2001
2042
|
} else {
|
|
2002
2043
|
if (BUILD13.svg && !isSvgMode) {
|
|
2003
2044
|
isSvgMode = newVNode2.$tag$ === "svg";
|
|
2004
2045
|
}
|
|
2005
|
-
|
|
2046
|
+
if (!win.document) {
|
|
2047
|
+
throw new Error(
|
|
2048
|
+
"You are trying to render a Rindo component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
|
|
2049
|
+
);
|
|
2050
|
+
}
|
|
2051
|
+
elm = newVNode2.$elm$ = BUILD13.svg ? win.document.createElementNS(
|
|
2006
2052
|
isSvgMode ? SVG_NS : HTML_NS,
|
|
2007
2053
|
!useNativeShadowDom && BUILD13.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
2008
|
-
) :
|
|
2054
|
+
) : win.document.createElement(
|
|
2009
2055
|
!useNativeShadowDom && BUILD13.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
2010
2056
|
);
|
|
2011
2057
|
if (BUILD13.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
|
|
@@ -2040,6 +2086,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2040
2086
|
elm["s-cr"] = contentRef;
|
|
2041
2087
|
elm["s-sn"] = newVNode2.$name$ || "";
|
|
2042
2088
|
elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
|
|
2089
|
+
patchSlotNode(elm);
|
|
2043
2090
|
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
2044
2091
|
if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
|
|
2045
2092
|
if (BUILD13.experimentalSlotFixes) {
|
|
@@ -2266,9 +2313,8 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
2266
2313
|
newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
|
|
2267
2314
|
relocateToHostRoot(newVNode2.$elm$.parentElement);
|
|
2268
2315
|
}
|
|
2269
|
-
} else {
|
|
2270
|
-
updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
|
|
2271
2316
|
}
|
|
2317
|
+
updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
|
|
2272
2318
|
}
|
|
2273
2319
|
if (BUILD13.updatable && oldChildren !== null && newChildren !== null) {
|
|
2274
2320
|
updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
|
|
@@ -2355,7 +2401,10 @@ var insertBefore = (parent, newNode, reference) => {
|
|
|
2355
2401
|
if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
|
|
2356
2402
|
patchParentNode(newNode);
|
|
2357
2403
|
}
|
|
2358
|
-
|
|
2404
|
+
parent.insertBefore(newNode, reference);
|
|
2405
|
+
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
2406
|
+
if (slotNode) dispatchSlotChangeEvent(slotNode);
|
|
2407
|
+
return newNode;
|
|
2359
2408
|
}
|
|
2360
2409
|
if (BUILD13.experimentalSlotFixes && parent.__insertBefore) {
|
|
2361
2410
|
return parent.__insertBefore(newNode, reference);
|
|
@@ -2437,8 +2486,8 @@ render() {
|
|
|
2437
2486
|
markSlotContentForRelocation(rootVnode.$elm$);
|
|
2438
2487
|
for (const relocateData of relocateNodes) {
|
|
2439
2488
|
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
2440
|
-
if (!nodeToRelocate["s-ol"]) {
|
|
2441
|
-
const orgLocationNode = BUILD13.isDebug || BUILD13.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) :
|
|
2489
|
+
if (!nodeToRelocate["s-ol"] && win.document) {
|
|
2490
|
+
const orgLocationNode = BUILD13.isDebug || BUILD13.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : win.document.createTextNode("");
|
|
2442
2491
|
orgLocationNode["s-nr"] = nodeToRelocate;
|
|
2443
2492
|
insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
|
|
2444
2493
|
}
|
|
@@ -2479,7 +2528,7 @@ render() {
|
|
|
2479
2528
|
}
|
|
2480
2529
|
}
|
|
2481
2530
|
}
|
|
2482
|
-
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](
|
|
2531
|
+
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
|
|
2483
2532
|
} else {
|
|
2484
2533
|
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
2485
2534
|
if (isInitialLoad) {
|
|
@@ -2509,10 +2558,10 @@ render() {
|
|
|
2509
2558
|
}
|
|
2510
2559
|
contentRef = void 0;
|
|
2511
2560
|
};
|
|
2512
|
-
var slotReferenceDebugNode = (slotVNode) =>
|
|
2561
|
+
var slotReferenceDebugNode = (slotVNode) => win.document.createComment(
|
|
2513
2562
|
`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
|
|
2514
2563
|
);
|
|
2515
|
-
var originalLocationDebugNode = (nodeToRelocate) =>
|
|
2564
|
+
var originalLocationDebugNode = (nodeToRelocate) => win.document.createComment(
|
|
2516
2565
|
`org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
|
|
2517
2566
|
);
|
|
2518
2567
|
|
|
@@ -2560,19 +2609,13 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
2560
2609
|
}
|
|
2561
2610
|
}
|
|
2562
2611
|
emitLifecycleEvent(elm, "componentWillLoad");
|
|
2563
|
-
|
|
2564
|
-
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
2565
|
-
}
|
|
2612
|
+
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
2566
2613
|
} else {
|
|
2567
2614
|
emitLifecycleEvent(elm, "componentWillUpdate");
|
|
2568
|
-
|
|
2569
|
-
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
2570
|
-
}
|
|
2615
|
+
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
2571
2616
|
}
|
|
2572
2617
|
emitLifecycleEvent(elm, "componentWillRender");
|
|
2573
|
-
|
|
2574
|
-
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
2575
|
-
}
|
|
2618
|
+
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
2576
2619
|
endSchedule();
|
|
2577
2620
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
2578
2621
|
};
|
|
@@ -2680,14 +2723,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2680
2723
|
const endPostUpdate = createTime("postUpdate", tagName);
|
|
2681
2724
|
const instance = BUILD14.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
2682
2725
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
2683
|
-
if (BUILD14.
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2690
|
-
}
|
|
2726
|
+
if (BUILD14.isDev) {
|
|
2727
|
+
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
2728
|
+
}
|
|
2729
|
+
safeCall(instance, "componentDidRender", void 0, elm);
|
|
2730
|
+
if (BUILD14.isDev) {
|
|
2731
|
+
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2691
2732
|
}
|
|
2692
2733
|
emitLifecycleEvent(elm, "componentDidRender");
|
|
2693
2734
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
@@ -2695,14 +2736,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2695
2736
|
if (BUILD14.asyncLoading && BUILD14.cssAnnotations) {
|
|
2696
2737
|
addHydratedFlag(elm);
|
|
2697
2738
|
}
|
|
2698
|
-
if (BUILD14.
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
|
|
2705
|
-
}
|
|
2739
|
+
if (BUILD14.isDev) {
|
|
2740
|
+
hostRef.$flags$ |= 2048 /* devOnDidLoad */;
|
|
2741
|
+
}
|
|
2742
|
+
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
2743
|
+
if (BUILD14.isDev) {
|
|
2744
|
+
hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
|
|
2706
2745
|
}
|
|
2707
2746
|
emitLifecycleEvent(elm, "componentDidLoad");
|
|
2708
2747
|
endPostUpdate();
|
|
@@ -2713,14 +2752,12 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2713
2752
|
}
|
|
2714
2753
|
}
|
|
2715
2754
|
} else {
|
|
2716
|
-
if (BUILD14.
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2723
|
-
}
|
|
2755
|
+
if (BUILD14.isDev) {
|
|
2756
|
+
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
2757
|
+
}
|
|
2758
|
+
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
2759
|
+
if (BUILD14.isDev) {
|
|
2760
|
+
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2724
2761
|
}
|
|
2725
2762
|
emitLifecycleEvent(elm, "componentDidUpdate");
|
|
2726
2763
|
endPostUpdate();
|
|
@@ -2852,7 +2889,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2852
2889
|
}
|
|
2853
2890
|
}
|
|
2854
2891
|
if (BUILD15.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
2855
|
-
if (
|
|
2892
|
+
if (instance.componentShouldUpdate) {
|
|
2856
2893
|
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
2857
2894
|
return;
|
|
2858
2895
|
}
|
|
@@ -3134,7 +3171,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3134
3171
|
}
|
|
3135
3172
|
};
|
|
3136
3173
|
var fireConnectedCallback = (instance, elm) => {
|
|
3137
|
-
if (BUILD17.lazyLoad
|
|
3174
|
+
if (BUILD17.lazyLoad) {
|
|
3138
3175
|
safeCall(instance, "connectedCallback", void 0, elm);
|
|
3139
3176
|
}
|
|
3140
3177
|
};
|
|
@@ -3205,7 +3242,10 @@ var connectedCallback = (elm) => {
|
|
|
3205
3242
|
}
|
|
3206
3243
|
};
|
|
3207
3244
|
var setContentReference = (elm) => {
|
|
3208
|
-
|
|
3245
|
+
if (!win.document) {
|
|
3246
|
+
return;
|
|
3247
|
+
}
|
|
3248
|
+
const contentRefElm = elm["s-cr"] = win.document.createComment(
|
|
3209
3249
|
BUILD18.isDebug ? `content-ref (host=${elm.localName})` : ""
|
|
3210
3250
|
);
|
|
3211
3251
|
contentRefElm["s-cn"] = true;
|
|
@@ -3215,12 +3255,9 @@ var setContentReference = (elm) => {
|
|
|
3215
3255
|
// src/runtime/disconnected-callback.ts
|
|
3216
3256
|
import { BUILD as BUILD19 } from "@rindo/core/internal/app-data";
|
|
3217
3257
|
var disconnectInstance = (instance, elm) => {
|
|
3218
|
-
if (BUILD19.lazyLoad
|
|
3258
|
+
if (BUILD19.lazyLoad) {
|
|
3219
3259
|
safeCall(instance, "disconnectedCallback", void 0, elm || instance);
|
|
3220
3260
|
}
|
|
3221
|
-
if (BUILD19.cmpDidUnload) {
|
|
3222
|
-
safeCall(instance, "componentDidUnload", void 0, elm || instance);
|
|
3223
|
-
}
|
|
3224
3261
|
};
|
|
3225
3262
|
var disconnectedCallback = async (elm) => {
|
|
3226
3263
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
@@ -3306,25 +3343,15 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3306
3343
|
this.__hasHostListenerAttached = true;
|
|
3307
3344
|
}
|
|
3308
3345
|
connectedCallback(this);
|
|
3309
|
-
if (
|
|
3346
|
+
if (originalConnectedCallback) {
|
|
3310
3347
|
originalConnectedCallback.call(this);
|
|
3311
3348
|
}
|
|
3312
3349
|
},
|
|
3313
3350
|
disconnectedCallback() {
|
|
3314
3351
|
disconnectedCallback(this);
|
|
3315
|
-
if (
|
|
3352
|
+
if (originalDisconnectedCallback) {
|
|
3316
3353
|
originalDisconnectedCallback.call(this);
|
|
3317
3354
|
}
|
|
3318
|
-
plt.raf(() => {
|
|
3319
|
-
var _a;
|
|
3320
|
-
const hostRef = getHostRef(this);
|
|
3321
|
-
if (((_a = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
|
|
3322
|
-
delete hostRef.$vnode$;
|
|
3323
|
-
}
|
|
3324
|
-
if (this instanceof Node && !this.isConnected) {
|
|
3325
|
-
deleteHostRef(this);
|
|
3326
|
-
}
|
|
3327
|
-
});
|
|
3328
3355
|
},
|
|
3329
3356
|
__attachShadow() {
|
|
3330
3357
|
if (supportsShadow) {
|
|
@@ -3392,18 +3419,22 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3392
3419
|
performance.mark("st:app:start");
|
|
3393
3420
|
}
|
|
3394
3421
|
installDevTools();
|
|
3422
|
+
if (!win.document) {
|
|
3423
|
+
console.warn("Rindo: No document found. Skipping bootstrapping lazy components.");
|
|
3424
|
+
return;
|
|
3425
|
+
}
|
|
3395
3426
|
const endBootstrap = createTime("bootstrapLazy");
|
|
3396
3427
|
const cmpTags = [];
|
|
3397
3428
|
const exclude = options.exclude || [];
|
|
3398
3429
|
const customElements2 = win.customElements;
|
|
3399
|
-
const head =
|
|
3430
|
+
const head = win.document.head;
|
|
3400
3431
|
const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
|
|
3401
|
-
const dataStyles = /* @__PURE__ */
|
|
3432
|
+
const dataStyles = /* @__PURE__ */ win.document.createElement("style");
|
|
3402
3433
|
const deferredConnectedCallbacks = [];
|
|
3403
3434
|
let appLoadFallback;
|
|
3404
3435
|
let isBootstrapping = true;
|
|
3405
3436
|
Object.assign(plt, options);
|
|
3406
|
-
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./",
|
|
3437
|
+
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
|
|
3407
3438
|
if (BUILD21.asyncQueue) {
|
|
3408
3439
|
if (options.syncQueue) {
|
|
3409
3440
|
plt.$flags$ |= 4 /* queueSync */;
|
|
@@ -3553,7 +3584,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3553
3584
|
}
|
|
3554
3585
|
if (dataStyles.innerHTML.length) {
|
|
3555
3586
|
dataStyles.setAttribute("data-styles", "");
|
|
3556
|
-
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(
|
|
3587
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
3557
3588
|
if (nonce != null) {
|
|
3558
3589
|
dataStyles.setAttribute("nonce", nonce);
|
|
3559
3590
|
}
|
|
@@ -3579,7 +3610,7 @@ var Fragment = (_, children) => children;
|
|
|
3579
3610
|
// src/runtime/host-listener.ts
|
|
3580
3611
|
import { BUILD as BUILD22 } from "@rindo/core/internal/app-data";
|
|
3581
3612
|
var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
3582
|
-
if (BUILD22.hostListener && listeners) {
|
|
3613
|
+
if (BUILD22.hostListener && listeners && win.document) {
|
|
3583
3614
|
if (BUILD22.hostListenerTargetParent) {
|
|
3584
3615
|
if (attachParentListeners) {
|
|
3585
3616
|
listeners = listeners.filter(([flags]) => flags & 32 /* TargetParent */);
|
|
@@ -3588,7 +3619,7 @@ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =>
|
|
|
3588
3619
|
}
|
|
3589
3620
|
}
|
|
3590
3621
|
listeners.map(([flags, name, method]) => {
|
|
3591
|
-
const target = BUILD22.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
|
|
3622
|
+
const target = BUILD22.hostListenerTarget ? getHostListenerTarget(win.document, elm, flags) : elm;
|
|
3592
3623
|
const handler = hostListenerProxy(hostRef, method);
|
|
3593
3624
|
const opts = hostListenerOpts(flags);
|
|
3594
3625
|
plt.ael(target, name, handler, opts);
|
|
@@ -3612,12 +3643,19 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
3612
3643
|
consoleError(e, hostRef.$hostElement$);
|
|
3613
3644
|
}
|
|
3614
3645
|
};
|
|
3615
|
-
var getHostListenerTarget = (elm, flags) => {
|
|
3616
|
-
if (BUILD22.hostListenerTargetDocument && flags & 4 /* TargetDocument */)
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
if (BUILD22.
|
|
3646
|
+
var getHostListenerTarget = (doc, elm, flags) => {
|
|
3647
|
+
if (BUILD22.hostListenerTargetDocument && flags & 4 /* TargetDocument */) {
|
|
3648
|
+
return doc;
|
|
3649
|
+
}
|
|
3650
|
+
if (BUILD22.hostListenerTargetWindow && flags & 8 /* TargetWindow */) {
|
|
3651
|
+
return win;
|
|
3652
|
+
}
|
|
3653
|
+
if (BUILD22.hostListenerTargetBody && flags & 16 /* TargetBody */) {
|
|
3654
|
+
return doc.body;
|
|
3655
|
+
}
|
|
3656
|
+
if (BUILD22.hostListenerTargetParent && flags & 32 /* TargetParent */ && elm.parentElement) {
|
|
3620
3657
|
return elm.parentElement;
|
|
3658
|
+
}
|
|
3621
3659
|
return elm;
|
|
3622
3660
|
};
|
|
3623
3661
|
var hostListenerOpts = (flags) => supportsListenerOptions ? {
|
|
@@ -3629,12 +3667,12 @@ var hostListenerOpts = (flags) => supportsListenerOptions ? {
|
|
|
3629
3667
|
var setNonce = (nonce) => plt.$nonce$ = nonce;
|
|
3630
3668
|
|
|
3631
3669
|
// src/runtime/vdom/vdom-annotations.ts
|
|
3632
|
-
var insertVdomAnnotations = (
|
|
3633
|
-
if (
|
|
3634
|
-
const docData = RINDO_DOC_DATA in
|
|
3670
|
+
var insertVdomAnnotations = (doc, staticComponents) => {
|
|
3671
|
+
if (doc != null) {
|
|
3672
|
+
const docData = RINDO_DOC_DATA in doc ? doc[RINDO_DOC_DATA] : { ...DEFAULT_DOC_DATA };
|
|
3635
3673
|
docData.staticComponents = new Set(staticComponents);
|
|
3636
3674
|
const orgLocationNodes = [];
|
|
3637
|
-
parseVNodeAnnotations(
|
|
3675
|
+
parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
|
|
3638
3676
|
orgLocationNodes.forEach((orgLocationNode) => {
|
|
3639
3677
|
var _a;
|
|
3640
3678
|
if (orgLocationNode != null && orgLocationNode["s-nr"]) {
|
|
@@ -3660,11 +3698,11 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
|
|
|
3660
3698
|
return;
|
|
3661
3699
|
}
|
|
3662
3700
|
}
|
|
3663
|
-
const commentBeforeTextNode =
|
|
3701
|
+
const commentBeforeTextNode = doc.createComment(childId);
|
|
3664
3702
|
commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
|
|
3665
3703
|
insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
|
|
3666
3704
|
} else if (nodeRef.nodeType === 8 /* CommentNode */) {
|
|
3667
|
-
const commentBeforeTextNode =
|
|
3705
|
+
const commentBeforeTextNode = doc.createComment(childId);
|
|
3668
3706
|
commentBeforeTextNode.nodeValue = `${COMMENT_NODE_ID}.${childId}`;
|
|
3669
3707
|
nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
|
|
3670
3708
|
}
|
|
@@ -3683,7 +3721,7 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
|
|
|
3683
3721
|
});
|
|
3684
3722
|
}
|
|
3685
3723
|
};
|
|
3686
|
-
var parseVNodeAnnotations = (
|
|
3724
|
+
var parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
|
|
3687
3725
|
var _a;
|
|
3688
3726
|
if (node == null) {
|
|
3689
3727
|
return;
|
|
@@ -3699,13 +3737,13 @@ var parseVNodeAnnotations = (doc2, node, docData, orgLocationNodes) => {
|
|
|
3699
3737
|
const cmpData = {
|
|
3700
3738
|
nodeIds: 0
|
|
3701
3739
|
};
|
|
3702
|
-
insertVNodeAnnotations(
|
|
3740
|
+
insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
|
|
3703
3741
|
}
|
|
3704
|
-
parseVNodeAnnotations(
|
|
3742
|
+
parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
|
|
3705
3743
|
});
|
|
3706
3744
|
}
|
|
3707
3745
|
};
|
|
3708
|
-
var insertVNodeAnnotations = (
|
|
3746
|
+
var insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
|
|
3709
3747
|
if (vnode != null) {
|
|
3710
3748
|
const hostId = ++docData.hostIds;
|
|
3711
3749
|
hostElm.setAttribute(HYDRATE_ID, hostId);
|
|
@@ -3715,7 +3753,7 @@ var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
|
|
|
3715
3753
|
if (vnode.$children$ != null) {
|
|
3716
3754
|
const depth = 0;
|
|
3717
3755
|
vnode.$children$.forEach((vnodeChild, index) => {
|
|
3718
|
-
insertChildVNodeAnnotations(
|
|
3756
|
+
insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
|
|
3719
3757
|
});
|
|
3720
3758
|
}
|
|
3721
3759
|
if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute(HYDRATE_CHILD_ID)) {
|
|
@@ -3736,7 +3774,7 @@ var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
|
|
|
3736
3774
|
}
|
|
3737
3775
|
}
|
|
3738
3776
|
};
|
|
3739
|
-
var insertChildVNodeAnnotations = (
|
|
3777
|
+
var insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
|
|
3740
3778
|
const childElm = vnodeChild.$elm$;
|
|
3741
3779
|
if (childElm == null) {
|
|
3742
3780
|
return;
|
|
@@ -3755,7 +3793,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
|
|
|
3755
3793
|
const nodeName = parentNode == null ? void 0 : parentNode.nodeName;
|
|
3756
3794
|
if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
|
|
3757
3795
|
const textNodeId = `${TEXT_NODE_ID}.${childId}`;
|
|
3758
|
-
const commentBeforeTextNode =
|
|
3796
|
+
const commentBeforeTextNode = doc.createComment(textNodeId);
|
|
3759
3797
|
insertBefore(parentNode, commentBeforeTextNode, childElm);
|
|
3760
3798
|
}
|
|
3761
3799
|
} else if (childElm.nodeType === 8 /* CommentNode */) {
|
|
@@ -3768,7 +3806,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
|
|
|
3768
3806
|
if (vnodeChild.$children$ != null) {
|
|
3769
3807
|
const childDepth = depth + 1;
|
|
3770
3808
|
vnodeChild.$children$.forEach((vnode, index2) => {
|
|
3771
|
-
insertChildVNodeAnnotations(
|
|
3809
|
+
insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index2);
|
|
3772
3810
|
});
|
|
3773
3811
|
}
|
|
3774
3812
|
};
|
|
@@ -3844,16 +3882,18 @@ function proxyHostElement(elm, cstr) {
|
|
|
3844
3882
|
}
|
|
3845
3883
|
(_a = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _a.set(memberName, attrPropVal);
|
|
3846
3884
|
}
|
|
3847
|
-
|
|
3885
|
+
const getterSetterDescriptor = {
|
|
3848
3886
|
get: function() {
|
|
3849
3887
|
return getValue(this, memberName);
|
|
3850
3888
|
},
|
|
3851
|
-
set(newValue) {
|
|
3889
|
+
set: function(newValue) {
|
|
3852
3890
|
setValue(this, memberName, newValue, cmpMeta);
|
|
3853
3891
|
},
|
|
3854
3892
|
configurable: true,
|
|
3855
3893
|
enumerable: true
|
|
3856
|
-
}
|
|
3894
|
+
};
|
|
3895
|
+
Object.defineProperty(elm, memberName, getterSetterDescriptor);
|
|
3896
|
+
Object.defineProperty(elm, metaAttributeName, getterSetterDescriptor);
|
|
3857
3897
|
if (!cstr.prototype.__rindoAugmented) {
|
|
3858
3898
|
Object.defineProperty(cstr.prototype, memberName, {
|
|
3859
3899
|
get: function() {
|
|
@@ -3997,7 +4037,7 @@ function hydrateApp(win2, opts, results, afterHydrate, resolve) {
|
|
|
3997
4037
|
return elm;
|
|
3998
4038
|
};
|
|
3999
4039
|
tmrId = globalThis.setTimeout(timeoutExceeded, opts.timeout);
|
|
4000
|
-
plt.$resourcesUrl$ = new URL(opts.resourcesUrl || "./",
|
|
4040
|
+
plt.$resourcesUrl$ = new URL(opts.resourcesUrl || "./", win2.document.baseURI).href;
|
|
4001
4041
|
globalScripts();
|
|
4002
4042
|
patchChild2(win2.document.body);
|
|
4003
4043
|
waitLoop2().then(hydratedComplete).catch(hydratedError);
|
|
@@ -4211,7 +4251,6 @@ var registerComponents = (Cstrs) => {
|
|
|
4211
4251
|
}
|
|
4212
4252
|
};
|
|
4213
4253
|
var win = window;
|
|
4214
|
-
var doc = win.document;
|
|
4215
4254
|
var readTask = (cb) => {
|
|
4216
4255
|
nextTick(() => {
|
|
4217
4256
|
try {
|
|
@@ -4260,15 +4299,19 @@ var setPlatformHelpers = (helpers) => {
|
|
|
4260
4299
|
var supportsShadow = BUILD24.shadowDom;
|
|
4261
4300
|
var supportsListenerOptions = false;
|
|
4262
4301
|
var supportsConstructableStylesheets = false;
|
|
4263
|
-
var
|
|
4264
|
-
|
|
4265
|
-
|
|
4302
|
+
var getHostRef = (ref) => {
|
|
4303
|
+
if (ref.__rindo__getHostRef) {
|
|
4304
|
+
return ref.__rindo__getHostRef();
|
|
4305
|
+
}
|
|
4306
|
+
return void 0;
|
|
4307
|
+
};
|
|
4266
4308
|
var registerInstance = (lazyInstance, hostRef) => {
|
|
4267
|
-
|
|
4309
|
+
lazyInstance.__rindo__getHostRef = () => hostRef;
|
|
4310
|
+
hostRef.$lazyInstance$ = lazyInstance;
|
|
4268
4311
|
if (BUILD24.modernPropertyDecls && (BUILD24.state || BUILD24.prop)) {
|
|
4269
4312
|
reWireGetterSetter(lazyInstance, hostRef);
|
|
4270
4313
|
}
|
|
4271
|
-
return
|
|
4314
|
+
return hostRef;
|
|
4272
4315
|
};
|
|
4273
4316
|
var registerHost = (elm, cmpMeta) => {
|
|
4274
4317
|
const hostRef = {
|
|
@@ -4282,7 +4325,8 @@ var registerHost = (elm, cmpMeta) => {
|
|
|
4282
4325
|
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
|
|
4283
4326
|
elm["s-p"] = [];
|
|
4284
4327
|
elm["s-rc"] = [];
|
|
4285
|
-
|
|
4328
|
+
elm.__rindo__getHostRef = () => hostRef;
|
|
4329
|
+
return hostRef;
|
|
4286
4330
|
};
|
|
4287
4331
|
var Build = {
|
|
4288
4332
|
isDev: false,
|
|
@@ -4309,9 +4353,7 @@ export {
|
|
|
4309
4353
|
consoleError,
|
|
4310
4354
|
createEvent,
|
|
4311
4355
|
defineCustomElement,
|
|
4312
|
-
deleteHostRef,
|
|
4313
4356
|
disconnectedCallback,
|
|
4314
|
-
doc,
|
|
4315
4357
|
forceModeUpdate,
|
|
4316
4358
|
forceUpdate,
|
|
4317
4359
|
getAssetPath,
|