@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.
Files changed (43) hide show
  1. package/cli/index.cjs +4 -4
  2. package/cli/index.js +1 -1
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/rindo.js +1545 -1475
  6. package/dev-server/client/index.js +1 -1
  7. package/dev-server/client/package.json +1 -1
  8. package/dev-server/connector.html +2 -2
  9. package/dev-server/index.js +4 -4
  10. package/dev-server/package.json +1 -1
  11. package/dev-server/server-process.js +4 -4
  12. package/internal/app-data/index.cjs +3 -14
  13. package/internal/app-data/index.js +0 -11
  14. package/internal/app-data/package.json +1 -1
  15. package/internal/client/index.js +639 -228
  16. package/internal/client/package.json +1 -1
  17. package/internal/client/patch-browser.js +1 -1
  18. package/internal/client/shadow-css.js +30 -6
  19. package/internal/hydrate/index.js +674 -233
  20. package/internal/hydrate/package.json +1 -1
  21. package/internal/hydrate/runner.d.ts +22 -5
  22. package/internal/hydrate/runner.js +34 -9
  23. package/internal/package.json +1 -1
  24. package/internal/rindo-private.d.ts +6 -13
  25. package/internal/rindo-public-compiler.d.ts +23 -6
  26. package/internal/testing/index.js +637 -242
  27. package/internal/testing/package.json +1 -1
  28. package/mock-doc/index.cjs +233 -233
  29. package/mock-doc/index.d.ts +5 -1
  30. package/mock-doc/index.js +230 -230
  31. package/mock-doc/package.json +1 -1
  32. package/package.json +2 -2
  33. package/screenshot/index.js +4 -4
  34. package/screenshot/package.json +1 -1
  35. package/screenshot/pixel-match.js +3 -3
  36. package/sys/node/index.js +9 -9
  37. package/sys/node/package.json +1 -1
  38. package/sys/node/worker.js +1 -1
  39. package/testing/index.js +9 -16
  40. package/testing/jest/jest-27-and-under/matchers/html.d.ts +2 -1
  41. package/testing/jest/jest-28/matchers/html.d.ts +2 -1
  42. package/testing/jest/jest-29/matchers/html.d.ts +2 -1
  43. package/testing/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Rindo Client Platform v4.25.3 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Client Platform v4.27.0 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -51,11 +51,15 @@ var reWireGetterSetter = (instance, hostRef) => {
51
51
  };
52
52
 
53
53
  // src/client/client-host-ref.ts
54
- var hostRefs = BUILD3.hotModuleReplacement ? window.__RINDO_HOSTREFS__ || (window.__RINDO_HOSTREFS__ = /* @__PURE__ */ new WeakMap()) : /* @__PURE__ */ new WeakMap();
55
- var deleteHostRef = (ref) => hostRefs.delete(ref);
56
- var getHostRef = (ref) => hostRefs.get(ref);
54
+ var getHostRef = (ref) => {
55
+ if (ref.__rindo__getHostRef) {
56
+ return ref.__rindo__getHostRef();
57
+ }
58
+ return void 0;
59
+ };
57
60
  var registerInstance = (lazyInstance, hostRef) => {
58
- hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
61
+ lazyInstance.__rindo__getHostRef = () => hostRef;
62
+ hostRef.$lazyInstance$ = lazyInstance;
59
63
  if (BUILD3.modernPropertyDecls && (BUILD3.state || BUILD3.prop)) {
60
64
  reWireGetterSetter(lazyInstance, hostRef);
61
65
  }
@@ -78,7 +82,8 @@ var registerHost = (hostElement, cmpMeta) => {
78
82
  hostElement["s-p"] = [];
79
83
  hostElement["s-rc"] = [];
80
84
  }
81
- const ref = hostRefs.set(hostElement, hostRef);
85
+ const ref = hostRef;
86
+ hostElement.__rindo__getHostRef = () => ref;
82
87
  if (!BUILD3.lazyLoad && BUILD3.modernPropertyDecls && (BUILD3.state || BUILD3.prop)) {
83
88
  reWireGetterSetter(hostElement, hostRef);
84
89
  }
@@ -315,6 +320,11 @@ function queryNonceMetaTagContent(doc2) {
315
320
  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;
316
321
  }
317
322
 
323
+ // src/utils/regular-expression.ts
324
+ var escapeRegExpSpecialCharacters = (text) => {
325
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
326
+ };
327
+
318
328
  // src/utils/result.ts
319
329
  var result_exports = {};
320
330
  __export(result_exports, {
@@ -376,12 +386,11 @@ import { BUILD as BUILD9 } from "@rindo/core/internal/app-data";
376
386
  // src/runtime/slot-polyfill-utils.ts
377
387
  import { BUILD as BUILD8 } from "@rindo/core/internal/app-data";
378
388
  var updateFallbackSlotVisibility = (elm) => {
379
- const childNodes = elm.__childNodes || elm.childNodes;
389
+ const childNodes = internalCall(elm, "childNodes");
380
390
  if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
381
391
  getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
382
- var _a;
383
392
  if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
384
- if ((_a = getHostSlotChildNodes(slotNode, slotNode["s-sn"], false)) == null ? void 0 : _a.length) {
393
+ if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
385
394
  slotNode.hidden = true;
386
395
  } else {
387
396
  slotNode.hidden = false;
@@ -389,8 +398,10 @@ var updateFallbackSlotVisibility = (elm) => {
389
398
  }
390
399
  });
391
400
  }
392
- for (const childNode of childNodes) {
393
- if (childNode.nodeType === 1 /* ElementNode */ && (childNode.__childNodes || childNode.childNodes).length) {
401
+ let i2 = 0;
402
+ for (i2 = 0; i2 < childNodes.length; i2++) {
403
+ const childNode = childNodes[i2];
404
+ if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
394
405
  updateFallbackSlotVisibility(childNode);
395
406
  }
396
407
  }
@@ -411,7 +422,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
411
422
  let childNode;
412
423
  for (; i2 < childNodes.length; i2++) {
413
424
  childNode = childNodes[i2];
414
- if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode["s-sn"] === slotName)) {
425
+ if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
415
426
  slottedNodes.push(childNode);
416
427
  if (typeof slotName !== "undefined") return slottedNodes;
417
428
  }
@@ -419,11 +430,12 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
419
430
  }
420
431
  return slottedNodes;
421
432
  }
422
- var getHostSlotChildNodes = (node, slotName, includeSlot = true) => {
433
+ var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
423
434
  const childNodes = [];
424
- if (includeSlot && node["s-sr"] || !node["s-sr"]) childNodes.push(node);
425
- while ((node = node.nextSibling) && node["s-sn"] === slotName) {
426
- childNodes.push(node);
435
+ if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
436
+ let node = slot;
437
+ while (node = node.nextSibling) {
438
+ if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
427
439
  }
428
440
  return childNodes;
429
441
  };
@@ -443,38 +455,73 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
443
455
  return slotName === "";
444
456
  };
445
457
  var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
446
- let slottedNodeLocation;
447
458
  if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
448
- slottedNodeLocation = newChild["s-ol"];
449
- } else {
450
- slottedNodeLocation = document.createTextNode("");
451
- slottedNodeLocation["s-nr"] = newChild;
459
+ return;
452
460
  }
461
+ const slottedNodeLocation = document.createTextNode("");
462
+ slottedNodeLocation["s-nr"] = newChild;
453
463
  if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
454
464
  const parent = slotNode["s-cr"].parentNode;
455
- const appendMethod = prepend ? parent.__prepend || parent.prepend : parent.__appendChild || parent.appendChild;
456
- if (typeof position !== "undefined") {
457
- if (BUILD8.hydrateClientSide) {
458
- slottedNodeLocation["s-oo"] = position;
459
- const childNodes = parent.__childNodes || parent.childNodes;
460
- const slotRelocateNodes = [slottedNodeLocation];
461
- childNodes.forEach((n) => {
462
- if (n["s-nr"]) slotRelocateNodes.push(n);
463
- });
464
- slotRelocateNodes.sort((a, b) => {
465
- if (!a["s-oo"] || a["s-oo"] < b["s-oo"]) return -1;
466
- else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
467
- return 0;
468
- });
469
- slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
470
- }
465
+ const appendMethod = prepend ? internalCall(parent, "prepend") : internalCall(parent, "appendChild");
466
+ if (BUILD8.hydrateClientSide && typeof position !== "undefined") {
467
+ slottedNodeLocation["s-oo"] = position;
468
+ const childNodes = internalCall(parent, "childNodes");
469
+ const slotRelocateNodes = [slottedNodeLocation];
470
+ childNodes.forEach((n) => {
471
+ if (n["s-nr"]) slotRelocateNodes.push(n);
472
+ });
473
+ slotRelocateNodes.sort((a, b) => {
474
+ if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
475
+ else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
476
+ return 0;
477
+ });
478
+ slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
471
479
  } else {
472
480
  appendMethod.call(parent, slottedNodeLocation);
473
481
  }
474
482
  newChild["s-ol"] = slottedNodeLocation;
475
483
  newChild["s-sh"] = slotNode["s-hn"];
476
484
  };
477
- var getSlotName = (node) => node["s-sn"] || node.nodeType === 1 && node.getAttribute("slot") || "";
485
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
486
+ function patchSlotNode(node) {
487
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
488
+ const assignedFactory = (elementsOnly) => (function(opts) {
489
+ const toReturn = [];
490
+ const slotName = this["s-sn"];
491
+ if (opts == null ? void 0 : opts.flatten) {
492
+ console.error(`
493
+ Flattening is not supported for Rindo non-shadow slots.
494
+ You can use \`.childNodes\` to nested slot fallback content.
495
+ If you have a particular use case, please open an issue on the Rindo repo.
496
+ `);
497
+ }
498
+ const parent = this["s-cr"].parentElement;
499
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
500
+ slottedNodes.forEach((n) => {
501
+ if (slotName === getSlotName(n)) {
502
+ toReturn.push(n);
503
+ }
504
+ });
505
+ if (elementsOnly) {
506
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
507
+ }
508
+ return toReturn;
509
+ }).bind(node);
510
+ node.assignedElements = assignedFactory(true);
511
+ node.assignedNodes = assignedFactory(false);
512
+ }
513
+ function dispatchSlotChangeEvent(elm) {
514
+ elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
515
+ }
516
+ function findSlotFromSlottedNode(slottedNode, parentHost) {
517
+ var _a;
518
+ parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
519
+ if (!parentHost) return { slotNode: null, slotName: "" };
520
+ const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
521
+ const childNodes = internalCall(parentHost, "childNodes");
522
+ const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
523
+ return { slotNode, slotName };
524
+ }
478
525
 
479
526
  // src/runtime/dom-extras.ts
480
527
  var patchPseudoShadowDom = (hostElementPrototype) => {
@@ -538,19 +585,14 @@ var patchCloneNode = (HostElementPrototype) => {
538
585
  var patchSlotAppendChild = (HostElementPrototype) => {
539
586
  HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
540
587
  HostElementPrototype.appendChild = function(newChild) {
541
- const slotName = newChild["s-sn"] = getSlotName(newChild);
542
- const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
588
+ const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
543
589
  if (slotNode) {
544
590
  addSlotRelocateNode(newChild, slotNode);
545
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
591
+ const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
546
592
  const appendAfter = slotChildNodes[slotChildNodes.length - 1];
547
- const parent = intrnlCall(appendAfter, "parentNode");
548
- let insertedNode;
549
- if (parent.__insertBefore) {
550
- insertedNode = parent.__insertBefore(newChild, appendAfter.nextSibling);
551
- } else {
552
- insertedNode = parent.insertBefore(newChild, appendAfter.nextSibling);
553
- }
593
+ const parent = internalCall(appendAfter, "parentNode");
594
+ const insertedNode = internalCall(parent, "insertBefore")(newChild, appendAfter.nextSibling);
595
+ dispatchSlotChangeEvent(slotNode);
554
596
  updateFallbackSlotVisibility(this);
555
597
  return insertedNode;
556
598
  }
@@ -579,19 +621,17 @@ var patchSlotPrepend = (HostElementPrototype) => {
579
621
  if (typeof newChild === "string") {
580
622
  newChild = this.ownerDocument.createTextNode(newChild);
581
623
  }
582
- const slotName = newChild["s-sn"] = getSlotName(newChild);
583
- const childNodes = this.__childNodes || this.childNodes;
624
+ const slotName = (newChild["s-sn"] = getSlotName(newChild)) || "";
625
+ const childNodes = internalCall(this, "childNodes");
584
626
  const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
585
627
  if (slotNode) {
586
628
  addSlotRelocateNode(newChild, slotNode, true);
587
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
629
+ const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
588
630
  const appendAfter = slotChildNodes[0];
589
- const parent = intrnlCall(appendAfter, "parentNode");
590
- if (parent.__insertBefore) {
591
- return parent.__insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
592
- } else {
593
- return parent.insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
594
- }
631
+ const parent = internalCall(appendAfter, "parentNode");
632
+ const toReturn = internalCall(parent, "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
633
+ dispatchSlotChangeEvent(slotNode);
634
+ return toReturn;
595
635
  }
596
636
  if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
597
637
  newChild.hidden = true;
@@ -641,8 +681,7 @@ var patchInsertBefore = (HostElementPrototype) => {
641
681
  if (eleProto.__insertBefore) return;
642
682
  eleProto.__insertBefore = HostElementPrototype.insertBefore;
643
683
  HostElementPrototype.insertBefore = function(newChild, currentChild) {
644
- const slotName = newChild["s-sn"] = getSlotName(newChild);
645
- const slotNode = getHostSlotNodes(this.__childNodes, this.tagName, slotName)[0];
684
+ const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
646
685
  const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
647
686
  if (slotNode) {
648
687
  let found = false;
@@ -655,18 +694,19 @@ var patchInsertBefore = (HostElementPrototype) => {
655
694
  }
656
695
  if (slotName === currentChild["s-sn"]) {
657
696
  addSlotRelocateNode(newChild, slotNode);
658
- const parent = intrnlCall(currentChild, "parentNode");
659
- if (parent.__insertBefore) {
660
- parent.__insertBefore(newChild, currentChild);
661
- } else {
662
- parent.insertBefore(newChild, currentChild);
663
- }
697
+ const parent = internalCall(currentChild, "parentNode");
698
+ internalCall(parent, "insertBefore")(newChild, currentChild);
699
+ dispatchSlotChangeEvent(slotNode);
664
700
  }
665
701
  return;
666
702
  }
667
703
  });
668
704
  if (found) return newChild;
669
705
  }
706
+ const parentNode = currentChild == null ? void 0 : currentChild.__parentNode;
707
+ if (parentNode && !this.isSameNode(parentNode)) {
708
+ return this.appendChild(newChild);
709
+ }
670
710
  return this.__insertBefore(newChild, currentChild);
671
711
  };
672
712
  };
@@ -744,7 +784,7 @@ var patchChildSlotNodes = (elm) => {
744
784
  });
745
785
  };
746
786
  var patchSlottedNode = (node) => {
747
- if (!node || node.__nextSibling || !globalThis.Node) return;
787
+ if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
748
788
  patchNextSibling(node);
749
789
  patchPreviousSibling(node);
750
790
  patchParentNode(node);
@@ -848,11 +888,14 @@ function patchHostOriginalAccessor(accessorName, node) {
848
888
  }
849
889
  if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
850
890
  }
851
- function intrnlCall(node, method) {
891
+ function internalCall(node, method) {
852
892
  if ("__" + method in node) {
853
- return node["__" + method];
893
+ const toReturn = node["__" + method];
894
+ if (typeof toReturn !== "function") return toReturn;
895
+ return toReturn.bind(node);
854
896
  } else {
855
- return node[method];
897
+ if (typeof node[method] !== "function") return node[method];
898
+ return node[method].bind(node);
856
899
  }
857
900
  }
858
901
 
@@ -1102,7 +1145,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1102
1145
  delete hostElm["s-sc"];
1103
1146
  }
1104
1147
  }
1105
- if (!plt.$orgLocNodes$) {
1148
+ if (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size) {
1106
1149
  initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
1107
1150
  }
1108
1151
  hostElm[HYDRATE_ID] = hostId;
@@ -1196,13 +1239,25 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1196
1239
  slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
1197
1240
  });
1198
1241
  }
1199
- if (BUILD12.shadowDom && shadowRoot) {
1242
+ if (BUILD12.shadowDom && shadowRoot && !shadowRoot.childNodes.length) {
1200
1243
  let rnIdex = 0;
1201
1244
  const rnLen = shadowRootNodes.length;
1202
- for (rnIdex; rnIdex < rnLen; rnIdex++) {
1203
- shadowRoot.appendChild(shadowRootNodes[rnIdex]);
1245
+ if (rnLen) {
1246
+ for (rnIdex; rnIdex < rnLen; rnIdex++) {
1247
+ shadowRoot.appendChild(shadowRootNodes[rnIdex]);
1248
+ }
1249
+ Array.from(hostElm.childNodes).forEach((node) => {
1250
+ if (typeof node["s-sn"] !== "string") {
1251
+ if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
1252
+ node.removeAttribute("hidden");
1253
+ } else if (node.nodeType === 8 /* CommentNode */ || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1254
+ node.parentNode.removeChild(node);
1255
+ }
1256
+ }
1257
+ });
1204
1258
  }
1205
1259
  }
1260
+ plt.$orgLocNodes$.delete(hostElm["s-id"]);
1206
1261
  hostRef.$hostElement$ = hostElm;
1207
1262
  endHydrate();
1208
1263
  };
@@ -1313,7 +1368,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1313
1368
  $text$: null
1314
1369
  });
1315
1370
  if (childNodeType === TEXT_NODE_ID) {
1316
- childVNode.$elm$ = node.nextSibling;
1371
+ childVNode.$elm$ = findCorrespondingNode(node, 3 /* TextNode */);
1317
1372
  if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
1318
1373
  childVNode.$text$ = childVNode.$elm$.textContent;
1319
1374
  childRenderNodes.push(childVNode);
@@ -1329,7 +1384,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1329
1384
  }
1330
1385
  }
1331
1386
  } else if (childNodeType === COMMENT_NODE_ID) {
1332
- childVNode.$elm$ = node.nextSibling;
1387
+ childVNode.$elm$ = findCorrespondingNode(node, 8 /* CommentNode */);
1333
1388
  if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
1334
1389
  childRenderNodes.push(childVNode);
1335
1390
  node.remove();
@@ -1363,6 +1418,10 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1363
1418
  vnode.$elm$ = node;
1364
1419
  vnode.$index$ = "0";
1365
1420
  parentVNode.$children$ = [vnode];
1421
+ } else {
1422
+ if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1423
+ node.remove();
1424
+ }
1366
1425
  }
1367
1426
  return parentVNode;
1368
1427
  };
@@ -1432,6 +1491,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1432
1491
  const slot = childVNode.$elm$;
1433
1492
  const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
1434
1493
  addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
1494
+ patchSlotNode(node);
1435
1495
  if (shouldMove) {
1436
1496
  parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1437
1497
  }
@@ -1452,10 +1512,367 @@ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) =>
1452
1512
  slottedNode = slottedNode.nextSibling;
1453
1513
  }
1454
1514
  };
1515
+ var findCorrespondingNode = (node, type) => {
1516
+ let sibling = node;
1517
+ do {
1518
+ sibling = sibling.nextSibling;
1519
+ } while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
1520
+ return sibling;
1521
+ };
1455
1522
 
1456
1523
  // src/runtime/initialize-component.ts
1457
1524
  import { BUILD as BUILD23 } from "@rindo/core/internal/app-data";
1458
1525
 
1526
+ // src/utils/shadow-css.ts
1527
+ /**
1528
+ * @license
1529
+ * Copyright Google Inc. All Rights Reserved.
1530
+ *
1531
+ * Use of this source code is governed by an MIT-style license that can be
1532
+ * found in the LICENSE file at https://angular.io/license
1533
+ *
1534
+ * This file is a port of shadowCSS from `webcomponents.js` to TypeScript.
1535
+ * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
1536
+ * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
1537
+ */
1538
+ var safeSelector = (selector) => {
1539
+ const placeholders = [];
1540
+ let index = 0;
1541
+ selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
1542
+ const replaceBy = `__ph-${index}__`;
1543
+ placeholders.push(keep);
1544
+ index++;
1545
+ return replaceBy;
1546
+ });
1547
+ const content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
1548
+ const replaceBy = `__ph-${index}__`;
1549
+ placeholders.push(exp);
1550
+ index++;
1551
+ return pseudo + replaceBy;
1552
+ });
1553
+ const ss = {
1554
+ content,
1555
+ placeholders
1556
+ };
1557
+ return ss;
1558
+ };
1559
+ var restoreSafeSelector = (placeholders, content) => {
1560
+ return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
1561
+ };
1562
+ var _polyfillHost = "-shadowcsshost";
1563
+ var _polyfillSlotted = "-shadowcssslotted";
1564
+ var _polyfillHostContext = "-shadowcsscontext";
1565
+ var _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
1566
+ var _cssColonHostRe = new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
1567
+ var _cssColonHostContextRe = new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
1568
+ var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
1569
+ var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
1570
+ var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
1571
+ var _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
1572
+ var _selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$";
1573
+ var _polyfillHostRe = /-shadowcsshost/gim;
1574
+ var createSupportsRuleRe = (selector) => new RegExp(`((?<!(^@supports(.*)))|(?<={.*))(${selector}\\b)`, "gim");
1575
+ var _colonSlottedRe = createSupportsRuleRe("::slotted");
1576
+ var _colonHostRe = createSupportsRuleRe(":host");
1577
+ var _colonHostContextRe = createSupportsRuleRe(":host-context");
1578
+ var _commentRe = /\/\*\s*[\s\S]*?\*\//g;
1579
+ var stripComments = (input) => {
1580
+ return input.replace(_commentRe, "");
1581
+ };
1582
+ var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
1583
+ var extractCommentsWithHash = (input) => {
1584
+ return input.match(_commentWithHashRe) || [];
1585
+ };
1586
+ var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
1587
+ var _curlyRe = /([{}])/g;
1588
+ var _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/;
1589
+ var OPEN_CURLY = "{";
1590
+ var CLOSE_CURLY = "}";
1591
+ var BLOCK_PLACEHOLDER = "%BLOCK%";
1592
+ var processRules = (input, ruleCallback) => {
1593
+ const inputWithEscapedBlocks = escapeBlocks(input);
1594
+ let nextBlockIndex = 0;
1595
+ return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
1596
+ const selector = m[2];
1597
+ let content = "";
1598
+ let suffix = m[4];
1599
+ let contentPrefix = "";
1600
+ if (suffix && suffix.startsWith("{" + BLOCK_PLACEHOLDER)) {
1601
+ content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
1602
+ suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
1603
+ contentPrefix = "{";
1604
+ }
1605
+ const cssRule = {
1606
+ selector,
1607
+ content
1608
+ };
1609
+ const rule = ruleCallback(cssRule);
1610
+ return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
1611
+ });
1612
+ };
1613
+ var escapeBlocks = (input) => {
1614
+ const inputParts = input.split(_curlyRe);
1615
+ const resultParts = [];
1616
+ const escapedBlocks = [];
1617
+ let bracketCount = 0;
1618
+ let currentBlockParts = [];
1619
+ for (let partIndex = 0; partIndex < inputParts.length; partIndex++) {
1620
+ const part = inputParts[partIndex];
1621
+ if (part === CLOSE_CURLY) {
1622
+ bracketCount--;
1623
+ }
1624
+ if (bracketCount > 0) {
1625
+ currentBlockParts.push(part);
1626
+ } else {
1627
+ if (currentBlockParts.length > 0) {
1628
+ escapedBlocks.push(currentBlockParts.join(""));
1629
+ resultParts.push(BLOCK_PLACEHOLDER);
1630
+ currentBlockParts = [];
1631
+ }
1632
+ resultParts.push(part);
1633
+ }
1634
+ if (part === OPEN_CURLY) {
1635
+ bracketCount++;
1636
+ }
1637
+ }
1638
+ if (currentBlockParts.length > 0) {
1639
+ escapedBlocks.push(currentBlockParts.join(""));
1640
+ resultParts.push(BLOCK_PLACEHOLDER);
1641
+ }
1642
+ const strEscapedBlocks = {
1643
+ escapedString: resultParts.join(""),
1644
+ blocks: escapedBlocks
1645
+ };
1646
+ return strEscapedBlocks;
1647
+ };
1648
+ var insertPolyfillHostInCssText = (cssText) => {
1649
+ cssText = cssText.replace(_colonHostContextRe, `$1${_polyfillHostContext}`).replace(_colonHostRe, `$1${_polyfillHost}`).replace(_colonSlottedRe, `$1${_polyfillSlotted}`);
1650
+ return cssText;
1651
+ };
1652
+ var convertColonRule = (cssText, regExp, partReplacer) => {
1653
+ return cssText.replace(regExp, (...m) => {
1654
+ if (m[2]) {
1655
+ const parts = m[2].split(",");
1656
+ const r = [];
1657
+ for (let i2 = 0; i2 < parts.length; i2++) {
1658
+ const p = parts[i2].trim();
1659
+ if (!p) break;
1660
+ r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
1661
+ }
1662
+ return r.join(",");
1663
+ } else {
1664
+ return _polyfillHostNoCombinator + m[3];
1665
+ }
1666
+ });
1667
+ };
1668
+ var colonHostPartReplacer = (host, part, suffix) => {
1669
+ return host + part.replace(_polyfillHost, "") + suffix;
1670
+ };
1671
+ var convertColonHost = (cssText) => {
1672
+ return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer);
1673
+ };
1674
+ var colonHostContextPartReplacer = (host, part, suffix) => {
1675
+ if (part.indexOf(_polyfillHost) > -1) {
1676
+ return colonHostPartReplacer(host, part, suffix);
1677
+ } else {
1678
+ return host + part + suffix + ", " + part + " " + host + suffix;
1679
+ }
1680
+ };
1681
+ var convertColonSlotted = (cssText, slotScopeId) => {
1682
+ const slotClass = "." + slotScopeId + " > ";
1683
+ const selectors = [];
1684
+ cssText = cssText.replace(_cssColonSlottedRe, (...m) => {
1685
+ if (m[2]) {
1686
+ const compound = m[2].trim();
1687
+ const suffix = m[3];
1688
+ const slottedSelector = slotClass + compound + suffix;
1689
+ let prefixSelector = "";
1690
+ for (let i2 = m[4] - 1; i2 >= 0; i2--) {
1691
+ const char = m[5][i2];
1692
+ if (char === "}" || char === ",") {
1693
+ break;
1694
+ }
1695
+ prefixSelector = char + prefixSelector;
1696
+ }
1697
+ const orgSelector = (prefixSelector + slottedSelector).trim();
1698
+ const addedSelector = `${prefixSelector.trimEnd()}${slottedSelector.trim()}`.trim();
1699
+ if (orgSelector !== addedSelector) {
1700
+ const updatedSelector = `${addedSelector}, ${orgSelector}`;
1701
+ selectors.push({
1702
+ orgSelector,
1703
+ updatedSelector
1704
+ });
1705
+ }
1706
+ return slottedSelector;
1707
+ } else {
1708
+ return _polyfillHostNoCombinator + m[3];
1709
+ }
1710
+ });
1711
+ return {
1712
+ selectors,
1713
+ cssText
1714
+ };
1715
+ };
1716
+ var convertColonHostContext = (cssText) => {
1717
+ return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer);
1718
+ };
1719
+ var convertShadowDOMSelectors = (cssText) => {
1720
+ return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, " "), cssText);
1721
+ };
1722
+ var makeScopeMatcher = (scopeSelector2) => {
1723
+ const lre = /\[/g;
1724
+ const rre = /\]/g;
1725
+ scopeSelector2 = scopeSelector2.replace(lre, "\\[").replace(rre, "\\]");
1726
+ return new RegExp("^(" + scopeSelector2 + ")" + _selectorReSuffix, "m");
1727
+ };
1728
+ var selectorNeedsScoping = (selector, scopeSelector2) => {
1729
+ const re = makeScopeMatcher(scopeSelector2);
1730
+ return !re.test(selector);
1731
+ };
1732
+ var injectScopingSelector = (selector, scopingSelector) => {
1733
+ return selector.replace(_selectorPartsRe, (_, before = "", _colonGroup, colon = "", after = "") => {
1734
+ return before + scopingSelector + colon + after;
1735
+ });
1736
+ };
1737
+ var applySimpleSelectorScope = (selector, scopeSelector2, hostSelector) => {
1738
+ _polyfillHostRe.lastIndex = 0;
1739
+ if (_polyfillHostRe.test(selector)) {
1740
+ const replaceBy = `.${hostSelector}`;
1741
+ return selector.replace(_polyfillHostNoCombinatorRe, (_, selector2) => injectScopingSelector(selector2, replaceBy)).replace(_polyfillHostRe, replaceBy + " ");
1742
+ }
1743
+ return scopeSelector2 + " " + selector;
1744
+ };
1745
+ var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
1746
+ const isRe = /\[is=([^\]]*)\]/g;
1747
+ scopeSelector2 = scopeSelector2.replace(isRe, (_, ...parts) => parts[0]);
1748
+ const className = "." + scopeSelector2;
1749
+ const _scopeSelectorPart = (p) => {
1750
+ let scopedP = p.trim();
1751
+ if (!scopedP) {
1752
+ return "";
1753
+ }
1754
+ if (p.indexOf(_polyfillHostNoCombinator) > -1) {
1755
+ scopedP = applySimpleSelectorScope(p, scopeSelector2, hostSelector);
1756
+ } else {
1757
+ const t = p.replace(_polyfillHostRe, "");
1758
+ if (t.length > 0) {
1759
+ scopedP = injectScopingSelector(t, className);
1760
+ }
1761
+ }
1762
+ return scopedP;
1763
+ };
1764
+ const safeContent = safeSelector(selector);
1765
+ selector = safeContent.content;
1766
+ let scopedSelector = "";
1767
+ let startIndex = 0;
1768
+ let res;
1769
+ const sep = /( |>|\+|~(?!=))\s*/g;
1770
+ const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
1771
+ let shouldScope = !hasHost;
1772
+ while ((res = sep.exec(selector)) !== null) {
1773
+ const separator = res[1];
1774
+ const part2 = selector.slice(startIndex, res.index).trim();
1775
+ shouldScope = shouldScope || part2.indexOf(_polyfillHostNoCombinator) > -1;
1776
+ const scopedPart = shouldScope ? _scopeSelectorPart(part2) : part2;
1777
+ scopedSelector += `${scopedPart} ${separator} `;
1778
+ startIndex = sep.lastIndex;
1779
+ }
1780
+ const part = selector.substring(startIndex);
1781
+ shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
1782
+ scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
1783
+ return restoreSafeSelector(safeContent.placeholders, scopedSelector);
1784
+ };
1785
+ var scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => {
1786
+ return selector.split(",").map((shallowPart) => {
1787
+ if (slotSelector && shallowPart.indexOf("." + slotSelector) > -1) {
1788
+ return shallowPart.trim();
1789
+ }
1790
+ if (selectorNeedsScoping(shallowPart, scopeSelectorText)) {
1791
+ return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim();
1792
+ } else {
1793
+ return shallowPart.trim();
1794
+ }
1795
+ }).join(", ");
1796
+ };
1797
+ var scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
1798
+ return processRules(cssText, (rule) => {
1799
+ let selector = rule.selector;
1800
+ let content = rule.content;
1801
+ if (rule.selector[0] !== "@") {
1802
+ selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
1803
+ } else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) {
1804
+ content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
1805
+ }
1806
+ const cssRule = {
1807
+ selector: selector.replace(/\s{2,}/g, " ").trim(),
1808
+ content
1809
+ };
1810
+ return cssRule;
1811
+ });
1812
+ };
1813
+ var scopeCssText = (cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector) => {
1814
+ cssText = insertPolyfillHostInCssText(cssText);
1815
+ cssText = convertColonHost(cssText);
1816
+ cssText = convertColonHostContext(cssText);
1817
+ const slotted = convertColonSlotted(cssText, slotScopeId);
1818
+ cssText = slotted.cssText;
1819
+ cssText = convertShadowDOMSelectors(cssText);
1820
+ if (scopeId2) {
1821
+ cssText = scopeSelectors(cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector);
1822
+ }
1823
+ cssText = replaceShadowCssHost(cssText, hostScopeId);
1824
+ cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, " $1 ");
1825
+ return {
1826
+ cssText: cssText.trim(),
1827
+ // We need to replace the shadow CSS host string in each of these selectors since we created
1828
+ // them prior to the replacement happening in the components CSS text.
1829
+ slottedSelectors: slotted.selectors.map((ref) => ({
1830
+ orgSelector: replaceShadowCssHost(ref.orgSelector, hostScopeId),
1831
+ updatedSelector: replaceShadowCssHost(ref.updatedSelector, hostScopeId)
1832
+ }))
1833
+ };
1834
+ };
1835
+ var replaceShadowCssHost = (cssText, hostScopeId) => {
1836
+ return cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
1837
+ };
1838
+ var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
1839
+ const hostScopeId = scopeId2 + "-h";
1840
+ const slotScopeId = scopeId2 + "-s";
1841
+ const commentsWithHash = extractCommentsWithHash(cssText);
1842
+ cssText = stripComments(cssText);
1843
+ const orgSelectors = [];
1844
+ if (commentOriginalSelector) {
1845
+ const processCommentedSelector = (rule) => {
1846
+ const placeholder = `/*!@___${orgSelectors.length}___*/`;
1847
+ const comment = `/*!@${rule.selector}*/`;
1848
+ orgSelectors.push({ placeholder, comment });
1849
+ rule.selector = placeholder + rule.selector;
1850
+ return rule;
1851
+ };
1852
+ cssText = processRules(cssText, (rule) => {
1853
+ if (rule.selector[0] !== "@") {
1854
+ return processCommentedSelector(rule);
1855
+ } else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) {
1856
+ rule.content = processRules(rule.content, processCommentedSelector);
1857
+ return rule;
1858
+ }
1859
+ return rule;
1860
+ });
1861
+ }
1862
+ const scoped = scopeCssText(cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector);
1863
+ cssText = [scoped.cssText, ...commentsWithHash].join("\n");
1864
+ if (commentOriginalSelector) {
1865
+ orgSelectors.forEach(({ placeholder, comment }) => {
1866
+ cssText = cssText.replace(placeholder, comment);
1867
+ });
1868
+ }
1869
+ scoped.slottedSelectors.forEach((slottedSelector) => {
1870
+ const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector), "g");
1871
+ cssText = cssText.replace(regex, slottedSelector.updatedSelector);
1872
+ });
1873
+ return cssText;
1874
+ };
1875
+
1459
1876
  // src/runtime/mode.ts
1460
1877
  var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
1461
1878
  var setMode = (handler) => modeResolutionChain.push(handler);
@@ -1561,7 +1978,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1561
1978
  if (nonce != null) {
1562
1979
  styleElm.setAttribute("nonce", nonce);
1563
1980
  }
1564
- if ((BUILD16.hydrateServerSide || BUILD16.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1981
+ if ((BUILD16.hydrateServerSide || BUILD16.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
1565
1982
  styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
1566
1983
  }
1567
1984
  if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
@@ -1589,7 +2006,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1589
2006
  styleContainerNode.append(styleElm);
1590
2007
  }
1591
2008
  }
1592
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
2009
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1593
2010
  styleContainerNode.insertBefore(styleElm, null);
1594
2011
  }
1595
2012
  }
@@ -1616,13 +2033,21 @@ var attachStyles = (hostRef) => {
1616
2033
  cmpMeta,
1617
2034
  hostRef.$modeName$
1618
2035
  );
1619
- if ((BUILD16.shadowDom || BUILD16.scoped) && BUILD16.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
2036
+ if ((BUILD16.shadowDom || BUILD16.scoped) && BUILD16.cssAnnotations && (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */ || flags & 128 /* shadowNeedsScopedCss */)) {
1620
2037
  elm["s-sc"] = scopeId2;
1621
2038
  elm.classList.add(scopeId2 + "-h");
1622
2039
  }
1623
2040
  endAttachStyles();
1624
2041
  };
1625
2042
  var getScopeId = (cmp, mode) => "sc-" + (BUILD16.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
2043
+ var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
2044
+ var hydrateScopedToShadow = () => {
2045
+ const styles2 = doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2046
+ let i2 = 0;
2047
+ for (; i2 < styles2.length; i2++) {
2048
+ registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
2049
+ }
2050
+ };
1626
2051
 
1627
2052
  // src/runtime/vdom/vdom-render.ts
1628
2053
  import { BUILD as BUILD19 } from "@rindo/core/internal/app-data";
@@ -1633,112 +2058,113 @@ import { BUILD as BUILD18 } from "@rindo/core/internal/app-data";
1633
2058
  // src/runtime/vdom/set-accessor.ts
1634
2059
  import { BUILD as BUILD17 } from "@rindo/core/internal/app-data";
1635
2060
  var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
1636
- if (oldValue !== newValue) {
1637
- let isProp = isMemberInElement(elm, memberName);
1638
- let ln = memberName.toLowerCase();
1639
- if (BUILD17.vdomClass && memberName === "class") {
1640
- const classList = elm.classList;
1641
- const oldClasses = parseClassList(oldValue);
1642
- let newClasses = parseClassList(newValue);
1643
- if (BUILD17.hydrateClientSide && elm["s-si"] && initialRender) {
1644
- newClasses.push(elm["s-si"]);
1645
- oldClasses.forEach((c) => {
1646
- if (c.startsWith(elm["s-si"])) newClasses.push(c);
1647
- });
1648
- newClasses = [...new Set(newClasses)];
1649
- classList.add(...newClasses);
1650
- } else {
1651
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
1652
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
1653
- }
1654
- } else if (BUILD17.vdomStyle && memberName === "style") {
1655
- if (BUILD17.updatable) {
1656
- for (const prop in oldValue) {
1657
- if (!newValue || newValue[prop] == null) {
1658
- if (!BUILD17.hydrateServerSide && prop.includes("-")) {
1659
- elm.style.removeProperty(prop);
1660
- } else {
1661
- elm.style[prop] = "";
1662
- }
1663
- }
1664
- }
1665
- }
1666
- for (const prop in newValue) {
1667
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
2061
+ if (oldValue === newValue) {
2062
+ return;
2063
+ }
2064
+ let isProp = isMemberInElement(elm, memberName);
2065
+ let ln = memberName.toLowerCase();
2066
+ if (BUILD17.vdomClass && memberName === "class") {
2067
+ const classList = elm.classList;
2068
+ const oldClasses = parseClassList(oldValue);
2069
+ let newClasses = parseClassList(newValue);
2070
+ if (BUILD17.hydrateClientSide && elm["s-si"] && initialRender) {
2071
+ newClasses.push(elm["s-si"]);
2072
+ oldClasses.forEach((c) => {
2073
+ if (c.startsWith(elm["s-si"])) newClasses.push(c);
2074
+ });
2075
+ newClasses = [...new Set(newClasses)];
2076
+ classList.add(...newClasses);
2077
+ } else {
2078
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
2079
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
2080
+ }
2081
+ } else if (BUILD17.vdomStyle && memberName === "style") {
2082
+ if (BUILD17.updatable) {
2083
+ for (const prop in oldValue) {
2084
+ if (!newValue || newValue[prop] == null) {
1668
2085
  if (!BUILD17.hydrateServerSide && prop.includes("-")) {
1669
- elm.style.setProperty(prop, newValue[prop]);
2086
+ elm.style.removeProperty(prop);
1670
2087
  } else {
1671
- elm.style[prop] = newValue[prop];
2088
+ elm.style[prop] = "";
1672
2089
  }
1673
2090
  }
1674
2091
  }
1675
- } else if (BUILD17.vdomKey && memberName === "key") {
1676
- } else if (BUILD17.vdomRef && memberName === "ref") {
2092
+ }
2093
+ for (const prop in newValue) {
2094
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
2095
+ if (!BUILD17.hydrateServerSide && prop.includes("-")) {
2096
+ elm.style.setProperty(prop, newValue[prop]);
2097
+ } else {
2098
+ elm.style[prop] = newValue[prop];
2099
+ }
2100
+ }
2101
+ }
2102
+ } else if (BUILD17.vdomKey && memberName === "key") {
2103
+ } else if (BUILD17.vdomRef && memberName === "ref") {
2104
+ if (newValue) {
2105
+ newValue(elm);
2106
+ }
2107
+ } else if (BUILD17.vdomListener && (BUILD17.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
2108
+ if (memberName[2] === "-") {
2109
+ memberName = memberName.slice(3);
2110
+ } else if (isMemberInElement(win, ln)) {
2111
+ memberName = ln.slice(2);
2112
+ } else {
2113
+ memberName = ln[2] + memberName.slice(3);
2114
+ }
2115
+ if (oldValue || newValue) {
2116
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
2117
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
2118
+ if (oldValue) {
2119
+ plt.rel(elm, memberName, oldValue, capture);
2120
+ }
1677
2121
  if (newValue) {
1678
- newValue(elm);
2122
+ plt.ael(elm, memberName, newValue, capture);
1679
2123
  }
1680
- } else if (BUILD17.vdomListener && (BUILD17.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
1681
- if (memberName[2] === "-") {
1682
- memberName = memberName.slice(3);
1683
- } else if (isMemberInElement(win, ln)) {
1684
- memberName = ln.slice(2);
1685
- } else {
1686
- memberName = ln[2] + memberName.slice(3);
1687
- }
1688
- if (oldValue || newValue) {
1689
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
1690
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
1691
- if (oldValue) {
1692
- plt.rel(elm, memberName, oldValue, capture);
1693
- }
1694
- if (newValue) {
1695
- plt.ael(elm, memberName, newValue, capture);
1696
- }
1697
- }
1698
- } else if (BUILD17.vdomPropOrAttr) {
1699
- const isComplex = isComplexType(newValue);
1700
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
1701
- try {
1702
- if (!elm.tagName.includes("-")) {
1703
- const n = newValue == null ? "" : newValue;
1704
- if (memberName === "list") {
1705
- isProp = false;
1706
- } else if (oldValue == null || elm[memberName] != n) {
1707
- if (typeof elm.__lookupSetter__(memberName) === "function") {
1708
- elm[memberName] = n;
1709
- } else {
1710
- elm.setAttribute(memberName, n);
1711
- }
2124
+ }
2125
+ } else if (BUILD17.vdomPropOrAttr) {
2126
+ const isComplex = isComplexType(newValue);
2127
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
2128
+ try {
2129
+ if (!elm.tagName.includes("-")) {
2130
+ const n = newValue == null ? "" : newValue;
2131
+ if (memberName === "list") {
2132
+ isProp = false;
2133
+ } else if (oldValue == null || elm[memberName] != n) {
2134
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
2135
+ elm[memberName] = n;
2136
+ } else {
2137
+ elm.setAttribute(memberName, n);
1712
2138
  }
1713
- } else if (elm[memberName] !== newValue) {
1714
- elm[memberName] = newValue;
1715
2139
  }
1716
- } catch (e) {
2140
+ } else if (elm[memberName] !== newValue) {
2141
+ elm[memberName] = newValue;
1717
2142
  }
2143
+ } catch (e) {
1718
2144
  }
1719
- let xlink = false;
1720
- if (BUILD17.vdomXlink) {
1721
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
1722
- memberName = ln;
1723
- xlink = true;
1724
- }
2145
+ }
2146
+ let xlink = false;
2147
+ if (BUILD17.vdomXlink) {
2148
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
2149
+ memberName = ln;
2150
+ xlink = true;
1725
2151
  }
1726
- if (newValue == null || newValue === false) {
1727
- if (newValue !== false || elm.getAttribute(memberName) === "") {
1728
- if (BUILD17.vdomXlink && xlink) {
1729
- elm.removeAttributeNS(XLINK_NS, memberName);
1730
- } else {
1731
- elm.removeAttribute(memberName);
1732
- }
1733
- }
1734
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
1735
- newValue = newValue === true ? "" : newValue;
2152
+ }
2153
+ if (newValue == null || newValue === false) {
2154
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
1736
2155
  if (BUILD17.vdomXlink && xlink) {
1737
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
2156
+ elm.removeAttributeNS(XLINK_NS, memberName);
1738
2157
  } else {
1739
- elm.setAttribute(memberName, newValue);
2158
+ elm.removeAttribute(memberName);
1740
2159
  }
1741
2160
  }
2161
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
2162
+ newValue = newValue === true ? "" : newValue;
2163
+ if (BUILD17.vdomXlink && xlink) {
2164
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
2165
+ } else {
2166
+ elm.setAttribute(memberName, newValue);
2167
+ }
1742
2168
  }
1743
2169
  }
1744
2170
  };
@@ -1836,6 +2262,9 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
1836
2262
  elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
1837
2263
  } else if (BUILD19.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
1838
2264
  elm = newVNode2.$elm$ = BUILD19.isDebug || BUILD19.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
2265
+ if (BUILD19.vdomAttribute) {
2266
+ updateElement(null, newVNode2, isSvgMode);
2267
+ }
1839
2268
  } else {
1840
2269
  if (BUILD19.svg && !isSvgMode) {
1841
2270
  isSvgMode = newVNode2.$tag$ === "svg";
@@ -1878,6 +2307,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
1878
2307
  elm["s-cr"] = contentRef;
1879
2308
  elm["s-sn"] = newVNode2.$name$ || "";
1880
2309
  elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
2310
+ patchSlotNode(elm);
1881
2311
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
1882
2312
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
1883
2313
  if (BUILD19.experimentalSlotFixes) {
@@ -2104,9 +2534,8 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
2104
2534
  newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
2105
2535
  relocateToHostRoot(newVNode2.$elm$.parentElement);
2106
2536
  }
2107
- } else {
2108
- updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
2109
2537
  }
2538
+ updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
2110
2539
  }
2111
2540
  if (BUILD19.updatable && oldChildren !== null && newChildren !== null) {
2112
2541
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -2193,7 +2622,10 @@ var insertBefore = (parent, newNode, reference) => {
2193
2622
  if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
2194
2623
  patchParentNode(newNode);
2195
2624
  }
2196
- return parent.insertBefore(newNode, reference);
2625
+ parent.insertBefore(newNode, reference);
2626
+ const { slotNode } = findSlotFromSlottedNode(newNode);
2627
+ if (slotNode) dispatchSlotChangeEvent(slotNode);
2628
+ return newNode;
2197
2629
  }
2198
2630
  if (BUILD19.experimentalSlotFixes && parent.__insertBefore) {
2199
2631
  return parent.__insertBefore(newNode, reference);
@@ -2263,7 +2695,7 @@ render() {
2263
2695
  if (BUILD19.scoped || BUILD19.shadowDom) {
2264
2696
  scopeId = hostElm["s-sc"];
2265
2697
  }
2266
- useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
2698
+ useNativeShadowDom = supportsShadow && !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
2267
2699
  if (BUILD19.slotRelocation) {
2268
2700
  contentRef = hostElm["s-cr"];
2269
2701
  checkSlotFallbackVisibility = false;
@@ -2317,7 +2749,7 @@ render() {
2317
2749
  }
2318
2750
  }
2319
2751
  }
2320
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
2752
+ nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
2321
2753
  } else {
2322
2754
  if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
2323
2755
  if (isInitialLoad) {
@@ -2398,19 +2830,13 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
2398
2830
  }
2399
2831
  }
2400
2832
  emitLifecycleEvent(elm, "componentWillLoad");
2401
- if (BUILD20.cmpWillLoad) {
2402
- maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
2403
- }
2833
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
2404
2834
  } else {
2405
2835
  emitLifecycleEvent(elm, "componentWillUpdate");
2406
- if (BUILD20.cmpWillUpdate) {
2407
- maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
2408
- }
2836
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
2409
2837
  }
2410
2838
  emitLifecycleEvent(elm, "componentWillRender");
2411
- if (BUILD20.cmpWillRender) {
2412
- maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
2413
- }
2839
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
2414
2840
  endSchedule();
2415
2841
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
2416
2842
  };
@@ -2518,14 +2944,12 @@ var postUpdateComponent = (hostRef) => {
2518
2944
  const endPostUpdate = createTime("postUpdate", tagName);
2519
2945
  const instance = BUILD20.lazyLoad ? hostRef.$lazyInstance$ : elm;
2520
2946
  const ancestorComponent = hostRef.$ancestorComponent$;
2521
- if (BUILD20.cmpDidRender) {
2522
- if (BUILD20.isDev) {
2523
- hostRef.$flags$ |= 1024 /* devOnRender */;
2524
- }
2525
- safeCall(instance, "componentDidRender", void 0, elm);
2526
- if (BUILD20.isDev) {
2527
- hostRef.$flags$ &= ~1024 /* devOnRender */;
2528
- }
2947
+ if (BUILD20.isDev) {
2948
+ hostRef.$flags$ |= 1024 /* devOnRender */;
2949
+ }
2950
+ safeCall(instance, "componentDidRender", void 0, elm);
2951
+ if (BUILD20.isDev) {
2952
+ hostRef.$flags$ &= ~1024 /* devOnRender */;
2529
2953
  }
2530
2954
  emitLifecycleEvent(elm, "componentDidRender");
2531
2955
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
@@ -2533,14 +2957,12 @@ var postUpdateComponent = (hostRef) => {
2533
2957
  if (BUILD20.asyncLoading && BUILD20.cssAnnotations) {
2534
2958
  addHydratedFlag(elm);
2535
2959
  }
2536
- if (BUILD20.cmpDidLoad) {
2537
- if (BUILD20.isDev) {
2538
- hostRef.$flags$ |= 2048 /* devOnDidLoad */;
2539
- }
2540
- safeCall(instance, "componentDidLoad", void 0, elm);
2541
- if (BUILD20.isDev) {
2542
- hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
2543
- }
2960
+ if (BUILD20.isDev) {
2961
+ hostRef.$flags$ |= 2048 /* devOnDidLoad */;
2962
+ }
2963
+ safeCall(instance, "componentDidLoad", void 0, elm);
2964
+ if (BUILD20.isDev) {
2965
+ hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
2544
2966
  }
2545
2967
  emitLifecycleEvent(elm, "componentDidLoad");
2546
2968
  endPostUpdate();
@@ -2551,14 +2973,12 @@ var postUpdateComponent = (hostRef) => {
2551
2973
  }
2552
2974
  }
2553
2975
  } else {
2554
- if (BUILD20.cmpDidUpdate) {
2555
- if (BUILD20.isDev) {
2556
- hostRef.$flags$ |= 1024 /* devOnRender */;
2557
- }
2558
- safeCall(instance, "componentDidUpdate", void 0, elm);
2559
- if (BUILD20.isDev) {
2560
- hostRef.$flags$ &= ~1024 /* devOnRender */;
2561
- }
2976
+ if (BUILD20.isDev) {
2977
+ hostRef.$flags$ |= 1024 /* devOnRender */;
2978
+ }
2979
+ safeCall(instance, "componentDidUpdate", void 0, elm);
2980
+ if (BUILD20.isDev) {
2981
+ hostRef.$flags$ &= ~1024 /* devOnRender */;
2562
2982
  }
2563
2983
  emitLifecycleEvent(elm, "componentDidUpdate");
2564
2984
  endPostUpdate();
@@ -2690,7 +3110,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
2690
3110
  }
2691
3111
  }
2692
3112
  if (BUILD21.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
2693
- if (BUILD21.cmpShouldUpdate && instance.componentShouldUpdate) {
3113
+ if (instance.componentShouldUpdate) {
2694
3114
  if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
2695
3115
  return;
2696
3116
  }
@@ -2955,9 +3375,8 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2955
3375
  const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
2956
3376
  if (!styles.has(scopeId2)) {
2957
3377
  const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
2958
- if (!BUILD23.hydrateServerSide && BUILD23.shadowDom && // TODO(RINDO-854): Remove code related to legacy shadowDomShim field
2959
- BUILD23.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2960
- style = await import("./shadow-css.js").then((m) => m.scopeCss(style, scopeId2));
3378
+ if (BUILD23.hydrateServerSide && BUILD23.shadowDom && cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
3379
+ style = scopeCss(style, scopeId2, true);
2961
3380
  }
2962
3381
  registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
2963
3382
  endRegisterStyles();
@@ -2973,7 +3392,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2973
3392
  }
2974
3393
  };
2975
3394
  var fireConnectedCallback = (instance, elm) => {
2976
- if (BUILD23.lazyLoad && BUILD23.connectedCallback) {
3395
+ if (BUILD23.lazyLoad) {
2977
3396
  safeCall(instance, "connectedCallback", void 0, elm);
2978
3397
  }
2979
3398
  };
@@ -3054,12 +3473,9 @@ var setContentReference = (elm) => {
3054
3473
  // src/runtime/disconnected-callback.ts
3055
3474
  import { BUILD as BUILD25 } from "@rindo/core/internal/app-data";
3056
3475
  var disconnectInstance = (instance, elm) => {
3057
- if (BUILD25.lazyLoad && BUILD25.disconnectedCallback) {
3476
+ if (BUILD25.lazyLoad) {
3058
3477
  safeCall(instance, "disconnectedCallback", void 0, elm || instance);
3059
3478
  }
3060
- if (BUILD25.cmpDidUnload) {
3061
- safeCall(instance, "componentDidUnload", void 0, elm || instance);
3062
- }
3063
3479
  };
3064
3480
  var disconnectedCallback = async (elm) => {
3065
3481
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
@@ -3128,6 +3544,9 @@ var proxyCustomElement = (Cstr, compactMeta) => {
3128
3544
  patchTextContent(Cstr.prototype);
3129
3545
  }
3130
3546
  }
3547
+ if (BUILD26.hydrateClientSide && BUILD26.shadowDom) {
3548
+ hydrateScopedToShadow();
3549
+ }
3131
3550
  const originalConnectedCallback = Cstr.prototype.connectedCallback;
3132
3551
  const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
3133
3552
  Object.assign(Cstr.prototype, {
@@ -3142,25 +3561,15 @@ var proxyCustomElement = (Cstr, compactMeta) => {
3142
3561
  this.__hasHostListenerAttached = true;
3143
3562
  }
3144
3563
  connectedCallback(this);
3145
- if (BUILD26.connectedCallback && originalConnectedCallback) {
3564
+ if (originalConnectedCallback) {
3146
3565
  originalConnectedCallback.call(this);
3147
3566
  }
3148
3567
  },
3149
3568
  disconnectedCallback() {
3150
3569
  disconnectedCallback(this);
3151
- if (BUILD26.disconnectedCallback && originalDisconnectedCallback) {
3570
+ if (originalDisconnectedCallback) {
3152
3571
  originalDisconnectedCallback.call(this);
3153
3572
  }
3154
- plt.raf(() => {
3155
- var _a;
3156
- const hostRef = getHostRef(this);
3157
- if (((_a = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
3158
- delete hostRef.$vnode$;
3159
- }
3160
- if (this instanceof Node && !this.isConnected) {
3161
- deleteHostRef(this);
3162
- }
3163
- });
3164
3573
  },
3165
3574
  __attachShadow() {
3166
3575
  if (supportsShadow) {
@@ -3248,6 +3657,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3248
3657
  if (BUILD27.hydrateClientSide) {
3249
3658
  plt.$flags$ |= 2 /* appLoaded */;
3250
3659
  }
3660
+ if (BUILD27.hydrateClientSide && BUILD27.shadowDom) {
3661
+ hydrateScopedToShadow();
3662
+ }
3251
3663
  let hasSlotRelocation = false;
3252
3664
  lazyBundles.map((lazyBundle) => {
3253
3665
  lazyBundle[1].map((compactMeta) => {
@@ -3628,7 +4040,6 @@ export {
3628
4040
  consoleError,
3629
4041
  createEvent,
3630
4042
  defineCustomElement,
3631
- deleteHostRef,
3632
4043
  disconnectedCallback,
3633
4044
  doc,
3634
4045
  forceModeUpdate,