@stencil/core 4.26.0 → 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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Client Platform v4.26.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Client Platform v4.27.0 | MIT Licensed | https://stenciljs.com
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.__STENCIL_HOSTREFS__ || (window.__STENCIL_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.__stencil__getHostRef) {
56
+ return ref.__stencil__getHostRef();
57
+ }
58
+ return void 0;
59
+ };
57
60
  var registerInstance = (lazyInstance, hostRef) => {
58
- hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
61
+ lazyInstance.__stencil__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.__stencil__getHostRef = () => ref;
82
87
  if (!BUILD3.lazyLoad && BUILD3.modernPropertyDecls && (BUILD3.state || BUILD3.prop)) {
83
88
  reWireGetterSetter(hostElement, hostRef);
84
89
  }
@@ -381,12 +386,11 @@ import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
381
386
  // src/runtime/slot-polyfill-utils.ts
382
387
  import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
383
388
  var updateFallbackSlotVisibility = (elm) => {
384
- const childNodes = elm.__childNodes || elm.childNodes;
389
+ const childNodes = internalCall(elm, "childNodes");
385
390
  if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
386
391
  getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
387
- var _a;
388
392
  if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
389
- if ((_a = getHostSlotChildNodes(slotNode, slotNode["s-sn"], false)) == null ? void 0 : _a.length) {
393
+ if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
390
394
  slotNode.hidden = true;
391
395
  } else {
392
396
  slotNode.hidden = false;
@@ -394,8 +398,10 @@ var updateFallbackSlotVisibility = (elm) => {
394
398
  }
395
399
  });
396
400
  }
397
- for (const childNode of childNodes) {
398
- 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) {
399
405
  updateFallbackSlotVisibility(childNode);
400
406
  }
401
407
  }
@@ -416,7 +422,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
416
422
  let childNode;
417
423
  for (; i2 < childNodes.length; i2++) {
418
424
  childNode = childNodes[i2];
419
- 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)) {
420
426
  slottedNodes.push(childNode);
421
427
  if (typeof slotName !== "undefined") return slottedNodes;
422
428
  }
@@ -424,11 +430,12 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
424
430
  }
425
431
  return slottedNodes;
426
432
  }
427
- var getHostSlotChildNodes = (node, slotName, includeSlot = true) => {
433
+ var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
428
434
  const childNodes = [];
429
- if (includeSlot && node["s-sr"] || !node["s-sr"]) childNodes.push(node);
430
- while ((node = node.nextSibling) && node["s-sn"] === slotName) {
431
- 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);
432
439
  }
433
440
  return childNodes;
434
441
  };
@@ -448,38 +455,73 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
448
455
  return slotName === "";
449
456
  };
450
457
  var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
451
- let slottedNodeLocation;
452
458
  if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
453
- slottedNodeLocation = newChild["s-ol"];
454
- } else {
455
- slottedNodeLocation = document.createTextNode("");
456
- slottedNodeLocation["s-nr"] = newChild;
459
+ return;
457
460
  }
461
+ const slottedNodeLocation = document.createTextNode("");
462
+ slottedNodeLocation["s-nr"] = newChild;
458
463
  if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
459
464
  const parent = slotNode["s-cr"].parentNode;
460
- const appendMethod = prepend ? parent.__prepend || parent.prepend : parent.__appendChild || parent.appendChild;
461
- if (typeof position !== "undefined") {
462
- if (BUILD8.hydrateClientSide) {
463
- slottedNodeLocation["s-oo"] = position;
464
- const childNodes = parent.__childNodes || parent.childNodes;
465
- const slotRelocateNodes = [slottedNodeLocation];
466
- childNodes.forEach((n) => {
467
- if (n["s-nr"]) slotRelocateNodes.push(n);
468
- });
469
- slotRelocateNodes.sort((a, b) => {
470
- if (!a["s-oo"] || a["s-oo"] < b["s-oo"]) return -1;
471
- else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
472
- return 0;
473
- });
474
- slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
475
- }
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));
476
479
  } else {
477
480
  appendMethod.call(parent, slottedNodeLocation);
478
481
  }
479
482
  newChild["s-ol"] = slottedNodeLocation;
480
483
  newChild["s-sh"] = slotNode["s-hn"];
481
484
  };
482
- 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 Stencil 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 Stencil 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
+ }
483
525
 
484
526
  // src/runtime/dom-extras.ts
485
527
  var patchPseudoShadowDom = (hostElementPrototype) => {
@@ -543,19 +585,14 @@ var patchCloneNode = (HostElementPrototype) => {
543
585
  var patchSlotAppendChild = (HostElementPrototype) => {
544
586
  HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
545
587
  HostElementPrototype.appendChild = function(newChild) {
546
- const slotName = newChild["s-sn"] = getSlotName(newChild);
547
- const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
588
+ const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
548
589
  if (slotNode) {
549
590
  addSlotRelocateNode(newChild, slotNode);
550
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
591
+ const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
551
592
  const appendAfter = slotChildNodes[slotChildNodes.length - 1];
552
- const parent = intrnlCall(appendAfter, "parentNode");
553
- let insertedNode;
554
- if (parent.__insertBefore) {
555
- insertedNode = parent.__insertBefore(newChild, appendAfter.nextSibling);
556
- } else {
557
- insertedNode = parent.insertBefore(newChild, appendAfter.nextSibling);
558
- }
593
+ const parent = internalCall(appendAfter, "parentNode");
594
+ const insertedNode = internalCall(parent, "insertBefore")(newChild, appendAfter.nextSibling);
595
+ dispatchSlotChangeEvent(slotNode);
559
596
  updateFallbackSlotVisibility(this);
560
597
  return insertedNode;
561
598
  }
@@ -584,19 +621,17 @@ var patchSlotPrepend = (HostElementPrototype) => {
584
621
  if (typeof newChild === "string") {
585
622
  newChild = this.ownerDocument.createTextNode(newChild);
586
623
  }
587
- const slotName = newChild["s-sn"] = getSlotName(newChild);
588
- const childNodes = this.__childNodes || this.childNodes;
624
+ const slotName = (newChild["s-sn"] = getSlotName(newChild)) || "";
625
+ const childNodes = internalCall(this, "childNodes");
589
626
  const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
590
627
  if (slotNode) {
591
628
  addSlotRelocateNode(newChild, slotNode, true);
592
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
629
+ const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
593
630
  const appendAfter = slotChildNodes[0];
594
- const parent = intrnlCall(appendAfter, "parentNode");
595
- if (parent.__insertBefore) {
596
- return parent.__insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
597
- } else {
598
- return parent.insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
599
- }
631
+ const parent = internalCall(appendAfter, "parentNode");
632
+ const toReturn = internalCall(parent, "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
633
+ dispatchSlotChangeEvent(slotNode);
634
+ return toReturn;
600
635
  }
601
636
  if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
602
637
  newChild.hidden = true;
@@ -646,8 +681,7 @@ var patchInsertBefore = (HostElementPrototype) => {
646
681
  if (eleProto.__insertBefore) return;
647
682
  eleProto.__insertBefore = HostElementPrototype.insertBefore;
648
683
  HostElementPrototype.insertBefore = function(newChild, currentChild) {
649
- const slotName = newChild["s-sn"] = getSlotName(newChild);
650
- const slotNode = getHostSlotNodes(this.__childNodes, this.tagName, slotName)[0];
684
+ const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
651
685
  const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
652
686
  if (slotNode) {
653
687
  let found = false;
@@ -660,18 +694,19 @@ var patchInsertBefore = (HostElementPrototype) => {
660
694
  }
661
695
  if (slotName === currentChild["s-sn"]) {
662
696
  addSlotRelocateNode(newChild, slotNode);
663
- const parent = intrnlCall(currentChild, "parentNode");
664
- if (parent.__insertBefore) {
665
- parent.__insertBefore(newChild, currentChild);
666
- } else {
667
- parent.insertBefore(newChild, currentChild);
668
- }
697
+ const parent = internalCall(currentChild, "parentNode");
698
+ internalCall(parent, "insertBefore")(newChild, currentChild);
699
+ dispatchSlotChangeEvent(slotNode);
669
700
  }
670
701
  return;
671
702
  }
672
703
  });
673
704
  if (found) return newChild;
674
705
  }
706
+ const parentNode = currentChild == null ? void 0 : currentChild.__parentNode;
707
+ if (parentNode && !this.isSameNode(parentNode)) {
708
+ return this.appendChild(newChild);
709
+ }
675
710
  return this.__insertBefore(newChild, currentChild);
676
711
  };
677
712
  };
@@ -749,7 +784,7 @@ var patchChildSlotNodes = (elm) => {
749
784
  });
750
785
  };
751
786
  var patchSlottedNode = (node) => {
752
- if (!node || node.__nextSibling || !globalThis.Node) return;
787
+ if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
753
788
  patchNextSibling(node);
754
789
  patchPreviousSibling(node);
755
790
  patchParentNode(node);
@@ -853,11 +888,14 @@ function patchHostOriginalAccessor(accessorName, node) {
853
888
  }
854
889
  if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
855
890
  }
856
- function intrnlCall(node, method) {
891
+ function internalCall(node, method) {
857
892
  if ("__" + method in node) {
858
- return node["__" + method];
893
+ const toReturn = node["__" + method];
894
+ if (typeof toReturn !== "function") return toReturn;
895
+ return toReturn.bind(node);
859
896
  } else {
860
- return node[method];
897
+ if (typeof node[method] !== "function") return node[method];
898
+ return node[method].bind(node);
861
899
  }
862
900
  }
863
901
 
@@ -1453,6 +1491,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1453
1491
  const slot = childVNode.$elm$;
1454
1492
  const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
1455
1493
  addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
1494
+ patchSlotNode(node);
1456
1495
  if (shouldMove) {
1457
1496
  parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1458
1497
  }
@@ -2019,112 +2058,113 @@ import { BUILD as BUILD18 } from "@stencil/core/internal/app-data";
2019
2058
  // src/runtime/vdom/set-accessor.ts
2020
2059
  import { BUILD as BUILD17 } from "@stencil/core/internal/app-data";
2021
2060
  var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
2022
- if (oldValue !== newValue) {
2023
- let isProp = isMemberInElement(elm, memberName);
2024
- let ln = memberName.toLowerCase();
2025
- if (BUILD17.vdomClass && memberName === "class") {
2026
- const classList = elm.classList;
2027
- const oldClasses = parseClassList(oldValue);
2028
- let newClasses = parseClassList(newValue);
2029
- if (BUILD17.hydrateClientSide && elm["s-si"] && initialRender) {
2030
- newClasses.push(elm["s-si"]);
2031
- oldClasses.forEach((c) => {
2032
- if (c.startsWith(elm["s-si"])) newClasses.push(c);
2033
- });
2034
- newClasses = [...new Set(newClasses)];
2035
- classList.add(...newClasses);
2036
- } else {
2037
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
2038
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
2039
- }
2040
- } else if (BUILD17.vdomStyle && memberName === "style") {
2041
- if (BUILD17.updatable) {
2042
- for (const prop in oldValue) {
2043
- if (!newValue || newValue[prop] == null) {
2044
- if (!BUILD17.hydrateServerSide && prop.includes("-")) {
2045
- elm.style.removeProperty(prop);
2046
- } else {
2047
- elm.style[prop] = "";
2048
- }
2049
- }
2050
- }
2051
- }
2052
- for (const prop in newValue) {
2053
- 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) {
2054
2085
  if (!BUILD17.hydrateServerSide && prop.includes("-")) {
2055
- elm.style.setProperty(prop, newValue[prop]);
2086
+ elm.style.removeProperty(prop);
2056
2087
  } else {
2057
- elm.style[prop] = newValue[prop];
2088
+ elm.style[prop] = "";
2058
2089
  }
2059
2090
  }
2060
2091
  }
2061
- } else if (BUILD17.vdomKey && memberName === "key") {
2062
- } 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
+ }
2063
2121
  if (newValue) {
2064
- newValue(elm);
2122
+ plt.ael(elm, memberName, newValue, capture);
2065
2123
  }
2066
- } else if (BUILD17.vdomListener && (BUILD17.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
2067
- if (memberName[2] === "-") {
2068
- memberName = memberName.slice(3);
2069
- } else if (isMemberInElement(win, ln)) {
2070
- memberName = ln.slice(2);
2071
- } else {
2072
- memberName = ln[2] + memberName.slice(3);
2073
- }
2074
- if (oldValue || newValue) {
2075
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
2076
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
2077
- if (oldValue) {
2078
- plt.rel(elm, memberName, oldValue, capture);
2079
- }
2080
- if (newValue) {
2081
- plt.ael(elm, memberName, newValue, capture);
2082
- }
2083
- }
2084
- } else if (BUILD17.vdomPropOrAttr) {
2085
- const isComplex = isComplexType(newValue);
2086
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
2087
- try {
2088
- if (!elm.tagName.includes("-")) {
2089
- const n = newValue == null ? "" : newValue;
2090
- if (memberName === "list") {
2091
- isProp = false;
2092
- } else if (oldValue == null || elm[memberName] != n) {
2093
- if (typeof elm.__lookupSetter__(memberName) === "function") {
2094
- elm[memberName] = n;
2095
- } else {
2096
- elm.setAttribute(memberName, n);
2097
- }
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);
2098
2138
  }
2099
- } else if (elm[memberName] !== newValue) {
2100
- elm[memberName] = newValue;
2101
2139
  }
2102
- } catch (e) {
2140
+ } else if (elm[memberName] !== newValue) {
2141
+ elm[memberName] = newValue;
2103
2142
  }
2143
+ } catch (e) {
2104
2144
  }
2105
- let xlink = false;
2106
- if (BUILD17.vdomXlink) {
2107
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
2108
- memberName = ln;
2109
- xlink = true;
2110
- }
2145
+ }
2146
+ let xlink = false;
2147
+ if (BUILD17.vdomXlink) {
2148
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
2149
+ memberName = ln;
2150
+ xlink = true;
2111
2151
  }
2112
- if (newValue == null || newValue === false) {
2113
- if (newValue !== false || elm.getAttribute(memberName) === "") {
2114
- if (BUILD17.vdomXlink && xlink) {
2115
- elm.removeAttributeNS(XLINK_NS, memberName);
2116
- } else {
2117
- elm.removeAttribute(memberName);
2118
- }
2119
- }
2120
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
2121
- newValue = newValue === true ? "" : newValue;
2152
+ }
2153
+ if (newValue == null || newValue === false) {
2154
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
2122
2155
  if (BUILD17.vdomXlink && xlink) {
2123
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
2156
+ elm.removeAttributeNS(XLINK_NS, memberName);
2124
2157
  } else {
2125
- elm.setAttribute(memberName, newValue);
2158
+ elm.removeAttribute(memberName);
2126
2159
  }
2127
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
+ }
2128
2168
  }
2129
2169
  }
2130
2170
  };
@@ -2222,6 +2262,9 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2222
2262
  elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
2223
2263
  } else if (BUILD19.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
2224
2264
  elm = newVNode2.$elm$ = BUILD19.isDebug || BUILD19.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
2265
+ if (BUILD19.vdomAttribute) {
2266
+ updateElement(null, newVNode2, isSvgMode);
2267
+ }
2225
2268
  } else {
2226
2269
  if (BUILD19.svg && !isSvgMode) {
2227
2270
  isSvgMode = newVNode2.$tag$ === "svg";
@@ -2264,6 +2307,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2264
2307
  elm["s-cr"] = contentRef;
2265
2308
  elm["s-sn"] = newVNode2.$name$ || "";
2266
2309
  elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
2310
+ patchSlotNode(elm);
2267
2311
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
2268
2312
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
2269
2313
  if (BUILD19.experimentalSlotFixes) {
@@ -2490,9 +2534,8 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
2490
2534
  newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
2491
2535
  relocateToHostRoot(newVNode2.$elm$.parentElement);
2492
2536
  }
2493
- } else {
2494
- updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
2495
2537
  }
2538
+ updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
2496
2539
  }
2497
2540
  if (BUILD19.updatable && oldChildren !== null && newChildren !== null) {
2498
2541
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -2579,7 +2622,10 @@ var insertBefore = (parent, newNode, reference) => {
2579
2622
  if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
2580
2623
  patchParentNode(newNode);
2581
2624
  }
2582
- return parent.insertBefore(newNode, reference);
2625
+ parent.insertBefore(newNode, reference);
2626
+ const { slotNode } = findSlotFromSlottedNode(newNode);
2627
+ if (slotNode) dispatchSlotChangeEvent(slotNode);
2628
+ return newNode;
2583
2629
  }
2584
2630
  if (BUILD19.experimentalSlotFixes && parent.__insertBefore) {
2585
2631
  return parent.__insertBefore(newNode, reference);
@@ -2703,7 +2749,7 @@ render() {
2703
2749
  }
2704
2750
  }
2705
2751
  }
2706
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
2752
+ nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
2707
2753
  } else {
2708
2754
  if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
2709
2755
  if (isInitialLoad) {
@@ -2784,19 +2830,13 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
2784
2830
  }
2785
2831
  }
2786
2832
  emitLifecycleEvent(elm, "componentWillLoad");
2787
- if (BUILD20.cmpWillLoad) {
2788
- maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
2789
- }
2833
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
2790
2834
  } else {
2791
2835
  emitLifecycleEvent(elm, "componentWillUpdate");
2792
- if (BUILD20.cmpWillUpdate) {
2793
- maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
2794
- }
2836
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
2795
2837
  }
2796
2838
  emitLifecycleEvent(elm, "componentWillRender");
2797
- if (BUILD20.cmpWillRender) {
2798
- maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
2799
- }
2839
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
2800
2840
  endSchedule();
2801
2841
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
2802
2842
  };
@@ -2904,14 +2944,12 @@ var postUpdateComponent = (hostRef) => {
2904
2944
  const endPostUpdate = createTime("postUpdate", tagName);
2905
2945
  const instance = BUILD20.lazyLoad ? hostRef.$lazyInstance$ : elm;
2906
2946
  const ancestorComponent = hostRef.$ancestorComponent$;
2907
- if (BUILD20.cmpDidRender) {
2908
- if (BUILD20.isDev) {
2909
- hostRef.$flags$ |= 1024 /* devOnRender */;
2910
- }
2911
- safeCall(instance, "componentDidRender", void 0, elm);
2912
- if (BUILD20.isDev) {
2913
- hostRef.$flags$ &= ~1024 /* devOnRender */;
2914
- }
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 */;
2915
2953
  }
2916
2954
  emitLifecycleEvent(elm, "componentDidRender");
2917
2955
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
@@ -2919,14 +2957,12 @@ var postUpdateComponent = (hostRef) => {
2919
2957
  if (BUILD20.asyncLoading && BUILD20.cssAnnotations) {
2920
2958
  addHydratedFlag(elm);
2921
2959
  }
2922
- if (BUILD20.cmpDidLoad) {
2923
- if (BUILD20.isDev) {
2924
- hostRef.$flags$ |= 2048 /* devOnDidLoad */;
2925
- }
2926
- safeCall(instance, "componentDidLoad", void 0, elm);
2927
- if (BUILD20.isDev) {
2928
- hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
2929
- }
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 */;
2930
2966
  }
2931
2967
  emitLifecycleEvent(elm, "componentDidLoad");
2932
2968
  endPostUpdate();
@@ -2937,14 +2973,12 @@ var postUpdateComponent = (hostRef) => {
2937
2973
  }
2938
2974
  }
2939
2975
  } else {
2940
- if (BUILD20.cmpDidUpdate) {
2941
- if (BUILD20.isDev) {
2942
- hostRef.$flags$ |= 1024 /* devOnRender */;
2943
- }
2944
- safeCall(instance, "componentDidUpdate", void 0, elm);
2945
- if (BUILD20.isDev) {
2946
- hostRef.$flags$ &= ~1024 /* devOnRender */;
2947
- }
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 */;
2948
2982
  }
2949
2983
  emitLifecycleEvent(elm, "componentDidUpdate");
2950
2984
  endPostUpdate();
@@ -3076,7 +3110,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
3076
3110
  }
3077
3111
  }
3078
3112
  if (BUILD21.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
3079
- if (BUILD21.cmpShouldUpdate && instance.componentShouldUpdate) {
3113
+ if (instance.componentShouldUpdate) {
3080
3114
  if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
3081
3115
  return;
3082
3116
  }
@@ -3358,7 +3392,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
3358
3392
  }
3359
3393
  };
3360
3394
  var fireConnectedCallback = (instance, elm) => {
3361
- if (BUILD23.lazyLoad && BUILD23.connectedCallback) {
3395
+ if (BUILD23.lazyLoad) {
3362
3396
  safeCall(instance, "connectedCallback", void 0, elm);
3363
3397
  }
3364
3398
  };
@@ -3439,12 +3473,9 @@ var setContentReference = (elm) => {
3439
3473
  // src/runtime/disconnected-callback.ts
3440
3474
  import { BUILD as BUILD25 } from "@stencil/core/internal/app-data";
3441
3475
  var disconnectInstance = (instance, elm) => {
3442
- if (BUILD25.lazyLoad && BUILD25.disconnectedCallback) {
3476
+ if (BUILD25.lazyLoad) {
3443
3477
  safeCall(instance, "disconnectedCallback", void 0, elm || instance);
3444
3478
  }
3445
- if (BUILD25.cmpDidUnload) {
3446
- safeCall(instance, "componentDidUnload", void 0, elm || instance);
3447
- }
3448
3479
  };
3449
3480
  var disconnectedCallback = async (elm) => {
3450
3481
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
@@ -3530,25 +3561,15 @@ var proxyCustomElement = (Cstr, compactMeta) => {
3530
3561
  this.__hasHostListenerAttached = true;
3531
3562
  }
3532
3563
  connectedCallback(this);
3533
- if (BUILD26.connectedCallback && originalConnectedCallback) {
3564
+ if (originalConnectedCallback) {
3534
3565
  originalConnectedCallback.call(this);
3535
3566
  }
3536
3567
  },
3537
3568
  disconnectedCallback() {
3538
3569
  disconnectedCallback(this);
3539
- if (BUILD26.disconnectedCallback && originalDisconnectedCallback) {
3570
+ if (originalDisconnectedCallback) {
3540
3571
  originalDisconnectedCallback.call(this);
3541
3572
  }
3542
- plt.raf(() => {
3543
- var _a;
3544
- const hostRef = getHostRef(this);
3545
- if (((_a = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
3546
- delete hostRef.$vnode$;
3547
- }
3548
- if (this instanceof Node && !this.isConnected) {
3549
- deleteHostRef(this);
3550
- }
3551
- });
3552
3573
  },
3553
3574
  __attachShadow() {
3554
3575
  if (supportsShadow) {
@@ -4019,7 +4040,6 @@ export {
4019
4040
  consoleError,
4020
4041
  createEvent,
4021
4042
  defineCustomElement,
4022
- deleteHostRef,
4023
4043
  disconnectedCallback,
4024
4044
  doc,
4025
4045
  forceModeUpdate,