@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.
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/testing/platform/index.ts
21
- var platform_exports = {};
22
- __export(platform_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  Build: () => Build,
24
24
  Env: () => import_app_data22.Env,
25
25
  Fragment: () => Fragment,
@@ -33,7 +33,6 @@ __export(platform_exports, {
33
33
  consoleError: () => consoleError,
34
34
  createEvent: () => createEvent,
35
35
  defineCustomElement: () => defineCustomElement,
36
- deleteHostRef: () => deleteHostRef,
37
36
  disconnectedCallback: () => disconnectedCallback,
38
37
  doc: () => doc,
39
38
  flushAll: () => flushAll,
@@ -82,7 +81,7 @@ __export(platform_exports, {
82
81
  win: () => win,
83
82
  writeTask: () => writeTask
84
83
  });
85
- module.exports = __toCommonJS(platform_exports);
84
+ module.exports = __toCommonJS(index_exports);
86
85
 
87
86
  // src/testing/platform/testing-build.ts
88
87
  var Build = {
@@ -102,13 +101,14 @@ var queuedReadTasks = [];
102
101
  var moduleLoaded = /* @__PURE__ */ new Map();
103
102
  var queuedLoadModules = [];
104
103
  var caughtErrors = [];
105
- var hostRefs = /* @__PURE__ */ new Map();
106
104
 
107
105
  // src/testing/platform/testing-host-ref.ts
108
106
  var getHostRef = (elm) => {
109
- return hostRefs.get(elm);
107
+ if (elm.__stencil__getHostRef) {
108
+ return elm.__stencil__getHostRef();
109
+ }
110
+ return void 0;
110
111
  };
111
- var deleteHostRef = (ref) => hostRefs.delete(ref);
112
112
  var registerInstance = (lazyInstance, hostRef) => {
113
113
  if (lazyInstance == null || lazyInstance.constructor == null) {
114
114
  throw new Error(`Invalid component constructor`);
@@ -120,8 +120,8 @@ var registerInstance = (lazyInstance, hostRef) => {
120
120
  registerHost(elm, { $flags$: 0, $tagName$: tagName });
121
121
  hostRef = getHostRef(elm);
122
122
  }
123
+ lazyInstance.__stencil__getHostRef = () => hostRef;
123
124
  hostRef.$lazyInstance$ = lazyInstance;
124
- return hostRefs.set(lazyInstance, hostRef);
125
125
  };
126
126
  var registerHost = (elm, cmpMeta) => {
127
127
  const hostRef = {
@@ -135,7 +135,7 @@ var registerHost = (elm, cmpMeta) => {
135
135
  hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
136
136
  elm["s-p"] = [];
137
137
  elm["s-rc"] = [];
138
- hostRefs.set(elm, hostRef);
138
+ elm.__stencil__getHostRef = () => hostRef;
139
139
  };
140
140
 
141
141
  // src/testing/platform/testing-log.ts
@@ -315,7 +315,6 @@ function resetPlatform(defaults = {}) {
315
315
  if (win && typeof win.close === "function") {
316
316
  win.close();
317
317
  }
318
- hostRefs.clear();
319
318
  styles.clear();
320
319
  plt.$flags$ = 0;
321
320
  Object.assign(plt, defaults);
@@ -494,12 +493,11 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
494
493
 
495
494
  // src/runtime/slot-polyfill-utils.ts
496
495
  var updateFallbackSlotVisibility = (elm) => {
497
- const childNodes = elm.__childNodes || elm.childNodes;
496
+ const childNodes = internalCall(elm, "childNodes");
498
497
  if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
499
498
  getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
500
- var _a;
501
499
  if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
502
- if ((_a = getHostSlotChildNodes(slotNode, slotNode["s-sn"], false)) == null ? void 0 : _a.length) {
500
+ if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
503
501
  slotNode.hidden = true;
504
502
  } else {
505
503
  slotNode.hidden = false;
@@ -507,8 +505,10 @@ var updateFallbackSlotVisibility = (elm) => {
507
505
  }
508
506
  });
509
507
  }
510
- for (const childNode of childNodes) {
511
- if (childNode.nodeType === 1 /* ElementNode */ && (childNode.__childNodes || childNode.childNodes).length) {
508
+ let i2 = 0;
509
+ for (i2 = 0; i2 < childNodes.length; i2++) {
510
+ const childNode = childNodes[i2];
511
+ if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
512
512
  updateFallbackSlotVisibility(childNode);
513
513
  }
514
514
  }
@@ -529,7 +529,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
529
529
  let childNode;
530
530
  for (; i2 < childNodes.length; i2++) {
531
531
  childNode = childNodes[i2];
532
- if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode["s-sn"] === slotName)) {
532
+ if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
533
533
  slottedNodes.push(childNode);
534
534
  if (typeof slotName !== "undefined") return slottedNodes;
535
535
  }
@@ -537,11 +537,12 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
537
537
  }
538
538
  return slottedNodes;
539
539
  }
540
- var getHostSlotChildNodes = (node, slotName, includeSlot = true) => {
540
+ var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
541
541
  const childNodes = [];
542
- if (includeSlot && node["s-sr"] || !node["s-sr"]) childNodes.push(node);
543
- while ((node = node.nextSibling) && node["s-sn"] === slotName) {
544
- childNodes.push(node);
542
+ if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
543
+ let node = slot;
544
+ while (node = node.nextSibling) {
545
+ if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
545
546
  }
546
547
  return childNodes;
547
548
  };
@@ -561,38 +562,73 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
561
562
  return slotName === "";
562
563
  };
563
564
  var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
564
- let slottedNodeLocation;
565
565
  if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
566
- slottedNodeLocation = newChild["s-ol"];
567
- } else {
568
- slottedNodeLocation = document.createTextNode("");
569
- slottedNodeLocation["s-nr"] = newChild;
566
+ return;
570
567
  }
568
+ const slottedNodeLocation = document.createTextNode("");
569
+ slottedNodeLocation["s-nr"] = newChild;
571
570
  if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
572
571
  const parent = slotNode["s-cr"].parentNode;
573
- const appendMethod = prepend ? parent.__prepend || parent.prepend : parent.__appendChild || parent.appendChild;
574
- if (typeof position !== "undefined") {
575
- if (import_app_data.BUILD.hydrateClientSide) {
576
- slottedNodeLocation["s-oo"] = position;
577
- const childNodes = parent.__childNodes || parent.childNodes;
578
- const slotRelocateNodes = [slottedNodeLocation];
579
- childNodes.forEach((n) => {
580
- if (n["s-nr"]) slotRelocateNodes.push(n);
581
- });
582
- slotRelocateNodes.sort((a, b) => {
583
- if (!a["s-oo"] || a["s-oo"] < b["s-oo"]) return -1;
584
- else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
585
- return 0;
586
- });
587
- slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
588
- }
572
+ const appendMethod = prepend ? internalCall(parent, "prepend") : internalCall(parent, "appendChild");
573
+ if (import_app_data.BUILD.hydrateClientSide && typeof position !== "undefined") {
574
+ slottedNodeLocation["s-oo"] = position;
575
+ const childNodes = internalCall(parent, "childNodes");
576
+ const slotRelocateNodes = [slottedNodeLocation];
577
+ childNodes.forEach((n) => {
578
+ if (n["s-nr"]) slotRelocateNodes.push(n);
579
+ });
580
+ slotRelocateNodes.sort((a, b) => {
581
+ if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
582
+ else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
583
+ return 0;
584
+ });
585
+ slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
589
586
  } else {
590
587
  appendMethod.call(parent, slottedNodeLocation);
591
588
  }
592
589
  newChild["s-ol"] = slottedNodeLocation;
593
590
  newChild["s-sh"] = slotNode["s-hn"];
594
591
  };
595
- var getSlotName = (node) => node["s-sn"] || node.nodeType === 1 && node.getAttribute("slot") || "";
592
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
593
+ function patchSlotNode(node) {
594
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
595
+ const assignedFactory = (elementsOnly) => (function(opts) {
596
+ const toReturn = [];
597
+ const slotName = this["s-sn"];
598
+ if (opts == null ? void 0 : opts.flatten) {
599
+ console.error(`
600
+ Flattening is not supported for Stencil non-shadow slots.
601
+ You can use \`.childNodes\` to nested slot fallback content.
602
+ If you have a particular use case, please open an issue on the Stencil repo.
603
+ `);
604
+ }
605
+ const parent = this["s-cr"].parentElement;
606
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
607
+ slottedNodes.forEach((n) => {
608
+ if (slotName === getSlotName(n)) {
609
+ toReturn.push(n);
610
+ }
611
+ });
612
+ if (elementsOnly) {
613
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
614
+ }
615
+ return toReturn;
616
+ }).bind(node);
617
+ node.assignedElements = assignedFactory(true);
618
+ node.assignedNodes = assignedFactory(false);
619
+ }
620
+ function dispatchSlotChangeEvent(elm) {
621
+ elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
622
+ }
623
+ function findSlotFromSlottedNode(slottedNode, parentHost) {
624
+ var _a;
625
+ parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
626
+ if (!parentHost) return { slotNode: null, slotName: "" };
627
+ const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
628
+ const childNodes = internalCall(parentHost, "childNodes");
629
+ const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
630
+ return { slotNode, slotName };
631
+ }
596
632
 
597
633
  // src/runtime/dom-extras.ts
598
634
  var patchPseudoShadowDom = (hostElementPrototype) => {
@@ -656,19 +692,14 @@ var patchCloneNode = (HostElementPrototype) => {
656
692
  var patchSlotAppendChild = (HostElementPrototype) => {
657
693
  HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
658
694
  HostElementPrototype.appendChild = function(newChild) {
659
- const slotName = newChild["s-sn"] = getSlotName(newChild);
660
- const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
695
+ const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
661
696
  if (slotNode) {
662
697
  addSlotRelocateNode(newChild, slotNode);
663
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
698
+ const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
664
699
  const appendAfter = slotChildNodes[slotChildNodes.length - 1];
665
- const parent = intrnlCall(appendAfter, "parentNode");
666
- let insertedNode;
667
- if (parent.__insertBefore) {
668
- insertedNode = parent.__insertBefore(newChild, appendAfter.nextSibling);
669
- } else {
670
- insertedNode = parent.insertBefore(newChild, appendAfter.nextSibling);
671
- }
700
+ const parent = internalCall(appendAfter, "parentNode");
701
+ const insertedNode = internalCall(parent, "insertBefore")(newChild, appendAfter.nextSibling);
702
+ dispatchSlotChangeEvent(slotNode);
672
703
  updateFallbackSlotVisibility(this);
673
704
  return insertedNode;
674
705
  }
@@ -697,19 +728,17 @@ var patchSlotPrepend = (HostElementPrototype) => {
697
728
  if (typeof newChild === "string") {
698
729
  newChild = this.ownerDocument.createTextNode(newChild);
699
730
  }
700
- const slotName = newChild["s-sn"] = getSlotName(newChild);
701
- const childNodes = this.__childNodes || this.childNodes;
731
+ const slotName = (newChild["s-sn"] = getSlotName(newChild)) || "";
732
+ const childNodes = internalCall(this, "childNodes");
702
733
  const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
703
734
  if (slotNode) {
704
735
  addSlotRelocateNode(newChild, slotNode, true);
705
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
736
+ const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
706
737
  const appendAfter = slotChildNodes[0];
707
- const parent = intrnlCall(appendAfter, "parentNode");
708
- if (parent.__insertBefore) {
709
- return parent.__insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
710
- } else {
711
- return parent.insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
712
- }
738
+ const parent = internalCall(appendAfter, "parentNode");
739
+ const toReturn = internalCall(parent, "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
740
+ dispatchSlotChangeEvent(slotNode);
741
+ return toReturn;
713
742
  }
714
743
  if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
715
744
  newChild.hidden = true;
@@ -759,8 +788,7 @@ var patchInsertBefore = (HostElementPrototype) => {
759
788
  if (eleProto.__insertBefore) return;
760
789
  eleProto.__insertBefore = HostElementPrototype.insertBefore;
761
790
  HostElementPrototype.insertBefore = function(newChild, currentChild) {
762
- const slotName = newChild["s-sn"] = getSlotName(newChild);
763
- const slotNode = getHostSlotNodes(this.__childNodes, this.tagName, slotName)[0];
791
+ const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
764
792
  const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
765
793
  if (slotNode) {
766
794
  let found = false;
@@ -773,18 +801,19 @@ var patchInsertBefore = (HostElementPrototype) => {
773
801
  }
774
802
  if (slotName === currentChild["s-sn"]) {
775
803
  addSlotRelocateNode(newChild, slotNode);
776
- const parent = intrnlCall(currentChild, "parentNode");
777
- if (parent.__insertBefore) {
778
- parent.__insertBefore(newChild, currentChild);
779
- } else {
780
- parent.insertBefore(newChild, currentChild);
781
- }
804
+ const parent = internalCall(currentChild, "parentNode");
805
+ internalCall(parent, "insertBefore")(newChild, currentChild);
806
+ dispatchSlotChangeEvent(slotNode);
782
807
  }
783
808
  return;
784
809
  }
785
810
  });
786
811
  if (found) return newChild;
787
812
  }
813
+ const parentNode = currentChild == null ? void 0 : currentChild.__parentNode;
814
+ if (parentNode && !this.isSameNode(parentNode)) {
815
+ return this.appendChild(newChild);
816
+ }
788
817
  return this.__insertBefore(newChild, currentChild);
789
818
  };
790
819
  };
@@ -862,7 +891,7 @@ var patchChildSlotNodes = (elm) => {
862
891
  });
863
892
  };
864
893
  var patchSlottedNode = (node) => {
865
- if (!node || node.__nextSibling || !globalThis.Node) return;
894
+ if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
866
895
  patchNextSibling(node);
867
896
  patchPreviousSibling(node);
868
897
  patchParentNode(node);
@@ -966,11 +995,14 @@ function patchHostOriginalAccessor(accessorName, node) {
966
995
  }
967
996
  if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
968
997
  }
969
- function intrnlCall(node, method) {
998
+ function internalCall(node, method) {
970
999
  if ("__" + method in node) {
971
- return node["__" + method];
1000
+ const toReturn = node["__" + method];
1001
+ if (typeof toReturn !== "function") return toReturn;
1002
+ return toReturn.bind(node);
972
1003
  } else {
973
- return node[method];
1004
+ if (typeof node[method] !== "function") return node[method];
1005
+ return node[method].bind(node);
974
1006
  }
975
1007
  }
976
1008
 
@@ -1566,6 +1598,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1566
1598
  const slot = childVNode.$elm$;
1567
1599
  const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
1568
1600
  addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
1601
+ patchSlotNode(node);
1569
1602
  if (shouldMove) {
1570
1603
  parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1571
1604
  }
@@ -2132,112 +2165,113 @@ var import_app_data11 = require("@stencil/core/internal/app-data");
2132
2165
  // src/runtime/vdom/set-accessor.ts
2133
2166
  var import_app_data10 = require("@stencil/core/internal/app-data");
2134
2167
  var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
2135
- if (oldValue !== newValue) {
2136
- let isProp = isMemberInElement(elm, memberName);
2137
- let ln = memberName.toLowerCase();
2138
- if (import_app_data10.BUILD.vdomClass && memberName === "class") {
2139
- const classList = elm.classList;
2140
- const oldClasses = parseClassList(oldValue);
2141
- let newClasses = parseClassList(newValue);
2142
- if (import_app_data10.BUILD.hydrateClientSide && elm["s-si"] && initialRender) {
2143
- newClasses.push(elm["s-si"]);
2144
- oldClasses.forEach((c) => {
2145
- if (c.startsWith(elm["s-si"])) newClasses.push(c);
2146
- });
2147
- newClasses = [...new Set(newClasses)];
2148
- classList.add(...newClasses);
2149
- } else {
2150
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
2151
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
2152
- }
2153
- } else if (import_app_data10.BUILD.vdomStyle && memberName === "style") {
2154
- if (import_app_data10.BUILD.updatable) {
2155
- for (const prop in oldValue) {
2156
- if (!newValue || newValue[prop] == null) {
2157
- if (!import_app_data10.BUILD.hydrateServerSide && prop.includes("-")) {
2158
- elm.style.removeProperty(prop);
2159
- } else {
2160
- elm.style[prop] = "";
2161
- }
2162
- }
2163
- }
2164
- }
2165
- for (const prop in newValue) {
2166
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
2168
+ if (oldValue === newValue) {
2169
+ return;
2170
+ }
2171
+ let isProp = isMemberInElement(elm, memberName);
2172
+ let ln = memberName.toLowerCase();
2173
+ if (import_app_data10.BUILD.vdomClass && memberName === "class") {
2174
+ const classList = elm.classList;
2175
+ const oldClasses = parseClassList(oldValue);
2176
+ let newClasses = parseClassList(newValue);
2177
+ if (import_app_data10.BUILD.hydrateClientSide && elm["s-si"] && initialRender) {
2178
+ newClasses.push(elm["s-si"]);
2179
+ oldClasses.forEach((c) => {
2180
+ if (c.startsWith(elm["s-si"])) newClasses.push(c);
2181
+ });
2182
+ newClasses = [...new Set(newClasses)];
2183
+ classList.add(...newClasses);
2184
+ } else {
2185
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
2186
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
2187
+ }
2188
+ } else if (import_app_data10.BUILD.vdomStyle && memberName === "style") {
2189
+ if (import_app_data10.BUILD.updatable) {
2190
+ for (const prop in oldValue) {
2191
+ if (!newValue || newValue[prop] == null) {
2167
2192
  if (!import_app_data10.BUILD.hydrateServerSide && prop.includes("-")) {
2168
- elm.style.setProperty(prop, newValue[prop]);
2193
+ elm.style.removeProperty(prop);
2169
2194
  } else {
2170
- elm.style[prop] = newValue[prop];
2195
+ elm.style[prop] = "";
2171
2196
  }
2172
2197
  }
2173
2198
  }
2174
- } else if (import_app_data10.BUILD.vdomKey && memberName === "key") {
2175
- } else if (import_app_data10.BUILD.vdomRef && memberName === "ref") {
2176
- if (newValue) {
2177
- newValue(elm);
2199
+ }
2200
+ for (const prop in newValue) {
2201
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
2202
+ if (!import_app_data10.BUILD.hydrateServerSide && prop.includes("-")) {
2203
+ elm.style.setProperty(prop, newValue[prop]);
2204
+ } else {
2205
+ elm.style[prop] = newValue[prop];
2206
+ }
2178
2207
  }
2179
- } else if (import_app_data10.BUILD.vdomListener && (import_app_data10.BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
2180
- if (memberName[2] === "-") {
2181
- memberName = memberName.slice(3);
2182
- } else if (isMemberInElement(win, ln)) {
2183
- memberName = ln.slice(2);
2184
- } else {
2185
- memberName = ln[2] + memberName.slice(3);
2208
+ }
2209
+ } else if (import_app_data10.BUILD.vdomKey && memberName === "key") {
2210
+ } else if (import_app_data10.BUILD.vdomRef && memberName === "ref") {
2211
+ if (newValue) {
2212
+ newValue(elm);
2213
+ }
2214
+ } else if (import_app_data10.BUILD.vdomListener && (import_app_data10.BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
2215
+ if (memberName[2] === "-") {
2216
+ memberName = memberName.slice(3);
2217
+ } else if (isMemberInElement(win, ln)) {
2218
+ memberName = ln.slice(2);
2219
+ } else {
2220
+ memberName = ln[2] + memberName.slice(3);
2221
+ }
2222
+ if (oldValue || newValue) {
2223
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
2224
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
2225
+ if (oldValue) {
2226
+ plt.rel(elm, memberName, oldValue, capture);
2186
2227
  }
2187
- if (oldValue || newValue) {
2188
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
2189
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
2190
- if (oldValue) {
2191
- plt.rel(elm, memberName, oldValue, capture);
2192
- }
2193
- if (newValue) {
2194
- plt.ael(elm, memberName, newValue, capture);
2195
- }
2228
+ if (newValue) {
2229
+ plt.ael(elm, memberName, newValue, capture);
2196
2230
  }
2197
- } else if (import_app_data10.BUILD.vdomPropOrAttr) {
2198
- const isComplex = isComplexType(newValue);
2199
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
2200
- try {
2201
- if (!elm.tagName.includes("-")) {
2202
- const n = newValue == null ? "" : newValue;
2203
- if (memberName === "list") {
2204
- isProp = false;
2205
- } else if (oldValue == null || elm[memberName] != n) {
2206
- if (typeof elm.__lookupSetter__(memberName) === "function") {
2207
- elm[memberName] = n;
2208
- } else {
2209
- elm.setAttribute(memberName, n);
2210
- }
2231
+ }
2232
+ } else if (import_app_data10.BUILD.vdomPropOrAttr) {
2233
+ const isComplex = isComplexType(newValue);
2234
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
2235
+ try {
2236
+ if (!elm.tagName.includes("-")) {
2237
+ const n = newValue == null ? "" : newValue;
2238
+ if (memberName === "list") {
2239
+ isProp = false;
2240
+ } else if (oldValue == null || elm[memberName] != n) {
2241
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
2242
+ elm[memberName] = n;
2243
+ } else {
2244
+ elm.setAttribute(memberName, n);
2211
2245
  }
2212
- } else if (elm[memberName] !== newValue) {
2213
- elm[memberName] = newValue;
2214
2246
  }
2215
- } catch (e) {
2247
+ } else if (elm[memberName] !== newValue) {
2248
+ elm[memberName] = newValue;
2216
2249
  }
2250
+ } catch (e) {
2217
2251
  }
2218
- let xlink = false;
2219
- if (import_app_data10.BUILD.vdomXlink) {
2220
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
2221
- memberName = ln;
2222
- xlink = true;
2223
- }
2252
+ }
2253
+ let xlink = false;
2254
+ if (import_app_data10.BUILD.vdomXlink) {
2255
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
2256
+ memberName = ln;
2257
+ xlink = true;
2224
2258
  }
2225
- if (newValue == null || newValue === false) {
2226
- if (newValue !== false || elm.getAttribute(memberName) === "") {
2227
- if (import_app_data10.BUILD.vdomXlink && xlink) {
2228
- elm.removeAttributeNS(XLINK_NS, memberName);
2229
- } else {
2230
- elm.removeAttribute(memberName);
2231
- }
2232
- }
2233
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
2234
- newValue = newValue === true ? "" : newValue;
2259
+ }
2260
+ if (newValue == null || newValue === false) {
2261
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
2235
2262
  if (import_app_data10.BUILD.vdomXlink && xlink) {
2236
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
2263
+ elm.removeAttributeNS(XLINK_NS, memberName);
2237
2264
  } else {
2238
- elm.setAttribute(memberName, newValue);
2265
+ elm.removeAttribute(memberName);
2239
2266
  }
2240
2267
  }
2268
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
2269
+ newValue = newValue === true ? "" : newValue;
2270
+ if (import_app_data10.BUILD.vdomXlink && xlink) {
2271
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
2272
+ } else {
2273
+ elm.setAttribute(memberName, newValue);
2274
+ }
2241
2275
  }
2242
2276
  }
2243
2277
  };
@@ -2335,6 +2369,9 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2335
2369
  elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
2336
2370
  } else if (import_app_data12.BUILD.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
2337
2371
  elm = newVNode2.$elm$ = import_app_data12.BUILD.isDebug || import_app_data12.BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
2372
+ if (import_app_data12.BUILD.vdomAttribute) {
2373
+ updateElement(null, newVNode2, isSvgMode);
2374
+ }
2338
2375
  } else {
2339
2376
  if (import_app_data12.BUILD.svg && !isSvgMode) {
2340
2377
  isSvgMode = newVNode2.$tag$ === "svg";
@@ -2377,6 +2414,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2377
2414
  elm["s-cr"] = contentRef;
2378
2415
  elm["s-sn"] = newVNode2.$name$ || "";
2379
2416
  elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
2417
+ patchSlotNode(elm);
2380
2418
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
2381
2419
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
2382
2420
  if (import_app_data12.BUILD.experimentalSlotFixes) {
@@ -2603,9 +2641,8 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
2603
2641
  newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
2604
2642
  relocateToHostRoot(newVNode2.$elm$.parentElement);
2605
2643
  }
2606
- } else {
2607
- updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
2608
2644
  }
2645
+ updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
2609
2646
  }
2610
2647
  if (import_app_data12.BUILD.updatable && oldChildren !== null && newChildren !== null) {
2611
2648
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -2692,7 +2729,10 @@ var insertBefore = (parent, newNode, reference) => {
2692
2729
  if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
2693
2730
  patchParentNode(newNode);
2694
2731
  }
2695
- return parent.insertBefore(newNode, reference);
2732
+ parent.insertBefore(newNode, reference);
2733
+ const { slotNode } = findSlotFromSlottedNode(newNode);
2734
+ if (slotNode) dispatchSlotChangeEvent(slotNode);
2735
+ return newNode;
2696
2736
  }
2697
2737
  if (import_app_data12.BUILD.experimentalSlotFixes && parent.__insertBefore) {
2698
2738
  return parent.__insertBefore(newNode, reference);
@@ -2816,7 +2856,7 @@ render() {
2816
2856
  }
2817
2857
  }
2818
2858
  }
2819
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
2859
+ nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
2820
2860
  } else {
2821
2861
  if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
2822
2862
  if (isInitialLoad) {
@@ -2897,19 +2937,13 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
2897
2937
  }
2898
2938
  }
2899
2939
  emitLifecycleEvent(elm, "componentWillLoad");
2900
- if (import_app_data13.BUILD.cmpWillLoad) {
2901
- maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
2902
- }
2940
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
2903
2941
  } else {
2904
2942
  emitLifecycleEvent(elm, "componentWillUpdate");
2905
- if (import_app_data13.BUILD.cmpWillUpdate) {
2906
- maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
2907
- }
2943
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
2908
2944
  }
2909
2945
  emitLifecycleEvent(elm, "componentWillRender");
2910
- if (import_app_data13.BUILD.cmpWillRender) {
2911
- maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
2912
- }
2946
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
2913
2947
  endSchedule();
2914
2948
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
2915
2949
  };
@@ -3017,14 +3051,12 @@ var postUpdateComponent = (hostRef) => {
3017
3051
  const endPostUpdate = createTime("postUpdate", tagName);
3018
3052
  const instance = import_app_data13.BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
3019
3053
  const ancestorComponent = hostRef.$ancestorComponent$;
3020
- if (import_app_data13.BUILD.cmpDidRender) {
3021
- if (import_app_data13.BUILD.isDev) {
3022
- hostRef.$flags$ |= 1024 /* devOnRender */;
3023
- }
3024
- safeCall(instance, "componentDidRender", void 0, elm);
3025
- if (import_app_data13.BUILD.isDev) {
3026
- hostRef.$flags$ &= ~1024 /* devOnRender */;
3027
- }
3054
+ if (import_app_data13.BUILD.isDev) {
3055
+ hostRef.$flags$ |= 1024 /* devOnRender */;
3056
+ }
3057
+ safeCall(instance, "componentDidRender", void 0, elm);
3058
+ if (import_app_data13.BUILD.isDev) {
3059
+ hostRef.$flags$ &= ~1024 /* devOnRender */;
3028
3060
  }
3029
3061
  emitLifecycleEvent(elm, "componentDidRender");
3030
3062
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
@@ -3032,14 +3064,12 @@ var postUpdateComponent = (hostRef) => {
3032
3064
  if (import_app_data13.BUILD.asyncLoading && import_app_data13.BUILD.cssAnnotations) {
3033
3065
  addHydratedFlag(elm);
3034
3066
  }
3035
- if (import_app_data13.BUILD.cmpDidLoad) {
3036
- if (import_app_data13.BUILD.isDev) {
3037
- hostRef.$flags$ |= 2048 /* devOnDidLoad */;
3038
- }
3039
- safeCall(instance, "componentDidLoad", void 0, elm);
3040
- if (import_app_data13.BUILD.isDev) {
3041
- hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
3042
- }
3067
+ if (import_app_data13.BUILD.isDev) {
3068
+ hostRef.$flags$ |= 2048 /* devOnDidLoad */;
3069
+ }
3070
+ safeCall(instance, "componentDidLoad", void 0, elm);
3071
+ if (import_app_data13.BUILD.isDev) {
3072
+ hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
3043
3073
  }
3044
3074
  emitLifecycleEvent(elm, "componentDidLoad");
3045
3075
  endPostUpdate();
@@ -3050,14 +3080,12 @@ var postUpdateComponent = (hostRef) => {
3050
3080
  }
3051
3081
  }
3052
3082
  } else {
3053
- if (import_app_data13.BUILD.cmpDidUpdate) {
3054
- if (import_app_data13.BUILD.isDev) {
3055
- hostRef.$flags$ |= 1024 /* devOnRender */;
3056
- }
3057
- safeCall(instance, "componentDidUpdate", void 0, elm);
3058
- if (import_app_data13.BUILD.isDev) {
3059
- hostRef.$flags$ &= ~1024 /* devOnRender */;
3060
- }
3083
+ if (import_app_data13.BUILD.isDev) {
3084
+ hostRef.$flags$ |= 1024 /* devOnRender */;
3085
+ }
3086
+ safeCall(instance, "componentDidUpdate", void 0, elm);
3087
+ if (import_app_data13.BUILD.isDev) {
3088
+ hostRef.$flags$ &= ~1024 /* devOnRender */;
3061
3089
  }
3062
3090
  emitLifecycleEvent(elm, "componentDidUpdate");
3063
3091
  endPostUpdate();
@@ -3189,7 +3217,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
3189
3217
  }
3190
3218
  }
3191
3219
  if (import_app_data14.BUILD.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
3192
- if (import_app_data14.BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
3220
+ if (instance.componentShouldUpdate) {
3193
3221
  if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
3194
3222
  return;
3195
3223
  }
@@ -3471,7 +3499,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
3471
3499
  }
3472
3500
  };
3473
3501
  var fireConnectedCallback = (instance, elm) => {
3474
- if (import_app_data16.BUILD.lazyLoad && import_app_data16.BUILD.connectedCallback) {
3502
+ if (import_app_data16.BUILD.lazyLoad) {
3475
3503
  safeCall(instance, "connectedCallback", void 0, elm);
3476
3504
  }
3477
3505
  };
@@ -3552,12 +3580,9 @@ var setContentReference = (elm) => {
3552
3580
  // src/runtime/disconnected-callback.ts
3553
3581
  var import_app_data18 = require("@stencil/core/internal/app-data");
3554
3582
  var disconnectInstance = (instance, elm) => {
3555
- if (import_app_data18.BUILD.lazyLoad && import_app_data18.BUILD.disconnectedCallback) {
3583
+ if (import_app_data18.BUILD.lazyLoad) {
3556
3584
  safeCall(instance, "disconnectedCallback", void 0, elm || instance);
3557
3585
  }
3558
- if (import_app_data18.BUILD.cmpDidUnload) {
3559
- safeCall(instance, "componentDidUnload", void 0, elm || instance);
3560
- }
3561
3586
  };
3562
3587
  var disconnectedCallback = async (elm) => {
3563
3588
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
@@ -3643,25 +3668,15 @@ var proxyCustomElement = (Cstr, compactMeta) => {
3643
3668
  this.__hasHostListenerAttached = true;
3644
3669
  }
3645
3670
  connectedCallback(this);
3646
- if (import_app_data19.BUILD.connectedCallback && originalConnectedCallback) {
3671
+ if (originalConnectedCallback) {
3647
3672
  originalConnectedCallback.call(this);
3648
3673
  }
3649
3674
  },
3650
3675
  disconnectedCallback() {
3651
3676
  disconnectedCallback(this);
3652
- if (import_app_data19.BUILD.disconnectedCallback && originalDisconnectedCallback) {
3677
+ if (originalDisconnectedCallback) {
3653
3678
  originalDisconnectedCallback.call(this);
3654
3679
  }
3655
- plt.raf(() => {
3656
- var _a;
3657
- const hostRef = getHostRef(this);
3658
- if (((_a = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
3659
- delete hostRef.$vnode$;
3660
- }
3661
- if (this instanceof Node && !this.isConnected) {
3662
- deleteHostRef(this);
3663
- }
3664
- });
3665
3680
  },
3666
3681
  __attachShadow() {
3667
3682
  if (supportsShadow) {
@@ -4127,7 +4142,6 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
4127
4142
  consoleError,
4128
4143
  createEvent,
4129
4144
  defineCustomElement,
4130
- deleteHostRef,
4131
4145
  disconnectedCallback,
4132
4146
  doc,
4133
4147
  flushAll,