@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 Hydrate Platform v4.26.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Platform v4.27.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -157,12 +157,11 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
157
157
 
158
158
  // src/runtime/slot-polyfill-utils.ts
159
159
  var updateFallbackSlotVisibility = (elm) => {
160
- const childNodes = elm.__childNodes || elm.childNodes;
160
+ const childNodes = internalCall(elm, "childNodes");
161
161
  if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
162
162
  getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
163
- var _a;
164
163
  if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
165
- if ((_a = getHostSlotChildNodes(slotNode, slotNode["s-sn"], false)) == null ? void 0 : _a.length) {
164
+ if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
166
165
  slotNode.hidden = true;
167
166
  } else {
168
167
  slotNode.hidden = false;
@@ -170,8 +169,10 @@ var updateFallbackSlotVisibility = (elm) => {
170
169
  }
171
170
  });
172
171
  }
173
- for (const childNode of childNodes) {
174
- if (childNode.nodeType === 1 /* ElementNode */ && (childNode.__childNodes || childNode.childNodes).length) {
172
+ let i2 = 0;
173
+ for (i2 = 0; i2 < childNodes.length; i2++) {
174
+ const childNode = childNodes[i2];
175
+ if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
175
176
  updateFallbackSlotVisibility(childNode);
176
177
  }
177
178
  }
@@ -192,7 +193,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
192
193
  let childNode;
193
194
  for (; i2 < childNodes.length; i2++) {
194
195
  childNode = childNodes[i2];
195
- if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode["s-sn"] === slotName)) {
196
+ if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
196
197
  slottedNodes.push(childNode);
197
198
  if (typeof slotName !== "undefined") return slottedNodes;
198
199
  }
@@ -200,11 +201,12 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
200
201
  }
201
202
  return slottedNodes;
202
203
  }
203
- var getHostSlotChildNodes = (node, slotName, includeSlot = true) => {
204
+ var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
204
205
  const childNodes = [];
205
- if (includeSlot && node["s-sr"] || !node["s-sr"]) childNodes.push(node);
206
- while ((node = node.nextSibling) && node["s-sn"] === slotName) {
207
- childNodes.push(node);
206
+ if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
207
+ let node = slot;
208
+ while (node = node.nextSibling) {
209
+ if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
208
210
  }
209
211
  return childNodes;
210
212
  };
@@ -224,38 +226,73 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
224
226
  return slotName === "";
225
227
  };
226
228
  var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
227
- let slottedNodeLocation;
228
229
  if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
229
- slottedNodeLocation = newChild["s-ol"];
230
- } else {
231
- slottedNodeLocation = document.createTextNode("");
232
- slottedNodeLocation["s-nr"] = newChild;
230
+ return;
233
231
  }
232
+ const slottedNodeLocation = document.createTextNode("");
233
+ slottedNodeLocation["s-nr"] = newChild;
234
234
  if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
235
235
  const parent = slotNode["s-cr"].parentNode;
236
- const appendMethod = prepend ? parent.__prepend || parent.prepend : parent.__appendChild || parent.appendChild;
237
- if (typeof position !== "undefined") {
238
- if (BUILD2.hydrateClientSide) {
239
- slottedNodeLocation["s-oo"] = position;
240
- const childNodes = parent.__childNodes || parent.childNodes;
241
- const slotRelocateNodes = [slottedNodeLocation];
242
- childNodes.forEach((n) => {
243
- if (n["s-nr"]) slotRelocateNodes.push(n);
244
- });
245
- slotRelocateNodes.sort((a, b) => {
246
- if (!a["s-oo"] || a["s-oo"] < b["s-oo"]) return -1;
247
- else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
248
- return 0;
249
- });
250
- slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
251
- }
236
+ const appendMethod = prepend ? internalCall(parent, "prepend") : internalCall(parent, "appendChild");
237
+ if (BUILD2.hydrateClientSide && typeof position !== "undefined") {
238
+ slottedNodeLocation["s-oo"] = position;
239
+ const childNodes = internalCall(parent, "childNodes");
240
+ const slotRelocateNodes = [slottedNodeLocation];
241
+ childNodes.forEach((n) => {
242
+ if (n["s-nr"]) slotRelocateNodes.push(n);
243
+ });
244
+ slotRelocateNodes.sort((a, b) => {
245
+ if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
246
+ else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
247
+ return 0;
248
+ });
249
+ slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
252
250
  } else {
253
251
  appendMethod.call(parent, slottedNodeLocation);
254
252
  }
255
253
  newChild["s-ol"] = slottedNodeLocation;
256
254
  newChild["s-sh"] = slotNode["s-hn"];
257
255
  };
258
- var getSlotName = (node) => node["s-sn"] || node.nodeType === 1 && node.getAttribute("slot") || "";
256
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
257
+ function patchSlotNode(node) {
258
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
259
+ const assignedFactory = (elementsOnly) => (function(opts) {
260
+ const toReturn = [];
261
+ const slotName = this["s-sn"];
262
+ if (opts == null ? void 0 : opts.flatten) {
263
+ console.error(`
264
+ Flattening is not supported for Stencil non-shadow slots.
265
+ You can use \`.childNodes\` to nested slot fallback content.
266
+ If you have a particular use case, please open an issue on the Stencil repo.
267
+ `);
268
+ }
269
+ const parent = this["s-cr"].parentElement;
270
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
271
+ slottedNodes.forEach((n) => {
272
+ if (slotName === getSlotName(n)) {
273
+ toReturn.push(n);
274
+ }
275
+ });
276
+ if (elementsOnly) {
277
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
278
+ }
279
+ return toReturn;
280
+ }).bind(node);
281
+ node.assignedElements = assignedFactory(true);
282
+ node.assignedNodes = assignedFactory(false);
283
+ }
284
+ function dispatchSlotChangeEvent(elm) {
285
+ elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
286
+ }
287
+ function findSlotFromSlottedNode(slottedNode, parentHost) {
288
+ var _a;
289
+ parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
290
+ if (!parentHost) return { slotNode: null, slotName: "" };
291
+ const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
292
+ const childNodes = internalCall(parentHost, "childNodes");
293
+ const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
294
+ return { slotNode, slotName };
295
+ }
259
296
 
260
297
  // src/runtime/dom-extras.ts
261
298
  var patchPseudoShadowDom = (hostElementPrototype) => {
@@ -319,19 +356,14 @@ var patchCloneNode = (HostElementPrototype) => {
319
356
  var patchSlotAppendChild = (HostElementPrototype) => {
320
357
  HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
321
358
  HostElementPrototype.appendChild = function(newChild) {
322
- const slotName = newChild["s-sn"] = getSlotName(newChild);
323
- const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
359
+ const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
324
360
  if (slotNode) {
325
361
  addSlotRelocateNode(newChild, slotNode);
326
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
362
+ const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
327
363
  const appendAfter = slotChildNodes[slotChildNodes.length - 1];
328
- const parent = intrnlCall(appendAfter, "parentNode");
329
- let insertedNode;
330
- if (parent.__insertBefore) {
331
- insertedNode = parent.__insertBefore(newChild, appendAfter.nextSibling);
332
- } else {
333
- insertedNode = parent.insertBefore(newChild, appendAfter.nextSibling);
334
- }
364
+ const parent = internalCall(appendAfter, "parentNode");
365
+ const insertedNode = internalCall(parent, "insertBefore")(newChild, appendAfter.nextSibling);
366
+ dispatchSlotChangeEvent(slotNode);
335
367
  updateFallbackSlotVisibility(this);
336
368
  return insertedNode;
337
369
  }
@@ -360,19 +392,17 @@ var patchSlotPrepend = (HostElementPrototype) => {
360
392
  if (typeof newChild === "string") {
361
393
  newChild = this.ownerDocument.createTextNode(newChild);
362
394
  }
363
- const slotName = newChild["s-sn"] = getSlotName(newChild);
364
- const childNodes = this.__childNodes || this.childNodes;
395
+ const slotName = (newChild["s-sn"] = getSlotName(newChild)) || "";
396
+ const childNodes = internalCall(this, "childNodes");
365
397
  const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
366
398
  if (slotNode) {
367
399
  addSlotRelocateNode(newChild, slotNode, true);
368
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
400
+ const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
369
401
  const appendAfter = slotChildNodes[0];
370
- const parent = intrnlCall(appendAfter, "parentNode");
371
- if (parent.__insertBefore) {
372
- return parent.__insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
373
- } else {
374
- return parent.insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
375
- }
402
+ const parent = internalCall(appendAfter, "parentNode");
403
+ const toReturn = internalCall(parent, "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
404
+ dispatchSlotChangeEvent(slotNode);
405
+ return toReturn;
376
406
  }
377
407
  if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
378
408
  newChild.hidden = true;
@@ -422,8 +452,7 @@ var patchInsertBefore = (HostElementPrototype) => {
422
452
  if (eleProto.__insertBefore) return;
423
453
  eleProto.__insertBefore = HostElementPrototype.insertBefore;
424
454
  HostElementPrototype.insertBefore = function(newChild, currentChild) {
425
- const slotName = newChild["s-sn"] = getSlotName(newChild);
426
- const slotNode = getHostSlotNodes(this.__childNodes, this.tagName, slotName)[0];
455
+ const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
427
456
  const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
428
457
  if (slotNode) {
429
458
  let found = false;
@@ -436,18 +465,19 @@ var patchInsertBefore = (HostElementPrototype) => {
436
465
  }
437
466
  if (slotName === currentChild["s-sn"]) {
438
467
  addSlotRelocateNode(newChild, slotNode);
439
- const parent = intrnlCall(currentChild, "parentNode");
440
- if (parent.__insertBefore) {
441
- parent.__insertBefore(newChild, currentChild);
442
- } else {
443
- parent.insertBefore(newChild, currentChild);
444
- }
468
+ const parent = internalCall(currentChild, "parentNode");
469
+ internalCall(parent, "insertBefore")(newChild, currentChild);
470
+ dispatchSlotChangeEvent(slotNode);
445
471
  }
446
472
  return;
447
473
  }
448
474
  });
449
475
  if (found) return newChild;
450
476
  }
477
+ const parentNode = currentChild == null ? void 0 : currentChild.__parentNode;
478
+ if (parentNode && !this.isSameNode(parentNode)) {
479
+ return this.appendChild(newChild);
480
+ }
451
481
  return this.__insertBefore(newChild, currentChild);
452
482
  };
453
483
  };
@@ -525,7 +555,7 @@ var patchChildSlotNodes = (elm) => {
525
555
  });
526
556
  };
527
557
  var patchSlottedNode = (node) => {
528
- if (!node || node.__nextSibling || !globalThis.Node) return;
558
+ if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
529
559
  patchNextSibling(node);
530
560
  patchPreviousSibling(node);
531
561
  patchParentNode(node);
@@ -629,11 +659,14 @@ function patchHostOriginalAccessor(accessorName, node) {
629
659
  }
630
660
  if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
631
661
  }
632
- function intrnlCall(node, method) {
662
+ function internalCall(node, method) {
633
663
  if ("__" + method in node) {
634
- return node["__" + method];
664
+ const toReturn = node["__" + method];
665
+ if (typeof toReturn !== "function") return toReturn;
666
+ return toReturn.bind(node);
635
667
  } else {
636
- return node[method];
668
+ if (typeof node[method] !== "function") return node[method];
669
+ return node[method].bind(node);
637
670
  }
638
671
  }
639
672
 
@@ -1229,6 +1262,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1229
1262
  const slot = childVNode.$elm$;
1230
1263
  const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
1231
1264
  addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
1265
+ patchSlotNode(node);
1232
1266
  if (shouldMove) {
1233
1267
  parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1234
1268
  }
@@ -1795,112 +1829,113 @@ import { BUILD as BUILD12 } from "@stencil/core/internal/app-data";
1795
1829
  // src/runtime/vdom/set-accessor.ts
1796
1830
  import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
1797
1831
  var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
1798
- if (oldValue !== newValue) {
1799
- let isProp = isMemberInElement(elm, memberName);
1800
- let ln = memberName.toLowerCase();
1801
- if (BUILD11.vdomClass && memberName === "class") {
1802
- const classList = elm.classList;
1803
- const oldClasses = parseClassList(oldValue);
1804
- let newClasses = parseClassList(newValue);
1805
- if (BUILD11.hydrateClientSide && elm["s-si"] && initialRender) {
1806
- newClasses.push(elm["s-si"]);
1807
- oldClasses.forEach((c) => {
1808
- if (c.startsWith(elm["s-si"])) newClasses.push(c);
1809
- });
1810
- newClasses = [...new Set(newClasses)];
1811
- classList.add(...newClasses);
1812
- } else {
1813
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
1814
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
1815
- }
1816
- } else if (BUILD11.vdomStyle && memberName === "style") {
1817
- if (BUILD11.updatable) {
1818
- for (const prop in oldValue) {
1819
- if (!newValue || newValue[prop] == null) {
1820
- if (!BUILD11.hydrateServerSide && prop.includes("-")) {
1821
- elm.style.removeProperty(prop);
1822
- } else {
1823
- elm.style[prop] = "";
1824
- }
1825
- }
1826
- }
1827
- }
1828
- for (const prop in newValue) {
1829
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
1832
+ if (oldValue === newValue) {
1833
+ return;
1834
+ }
1835
+ let isProp = isMemberInElement(elm, memberName);
1836
+ let ln = memberName.toLowerCase();
1837
+ if (BUILD11.vdomClass && memberName === "class") {
1838
+ const classList = elm.classList;
1839
+ const oldClasses = parseClassList(oldValue);
1840
+ let newClasses = parseClassList(newValue);
1841
+ if (BUILD11.hydrateClientSide && elm["s-si"] && initialRender) {
1842
+ newClasses.push(elm["s-si"]);
1843
+ oldClasses.forEach((c) => {
1844
+ if (c.startsWith(elm["s-si"])) newClasses.push(c);
1845
+ });
1846
+ newClasses = [...new Set(newClasses)];
1847
+ classList.add(...newClasses);
1848
+ } else {
1849
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
1850
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
1851
+ }
1852
+ } else if (BUILD11.vdomStyle && memberName === "style") {
1853
+ if (BUILD11.updatable) {
1854
+ for (const prop in oldValue) {
1855
+ if (!newValue || newValue[prop] == null) {
1830
1856
  if (!BUILD11.hydrateServerSide && prop.includes("-")) {
1831
- elm.style.setProperty(prop, newValue[prop]);
1857
+ elm.style.removeProperty(prop);
1832
1858
  } else {
1833
- elm.style[prop] = newValue[prop];
1859
+ elm.style[prop] = "";
1834
1860
  }
1835
1861
  }
1836
1862
  }
1837
- } else if (BUILD11.vdomKey && memberName === "key") {
1838
- } else if (BUILD11.vdomRef && memberName === "ref") {
1839
- if (newValue) {
1840
- newValue(elm);
1863
+ }
1864
+ for (const prop in newValue) {
1865
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
1866
+ if (!BUILD11.hydrateServerSide && prop.includes("-")) {
1867
+ elm.style.setProperty(prop, newValue[prop]);
1868
+ } else {
1869
+ elm.style[prop] = newValue[prop];
1870
+ }
1841
1871
  }
1842
- } else if (BUILD11.vdomListener && (BUILD11.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
1843
- if (memberName[2] === "-") {
1844
- memberName = memberName.slice(3);
1845
- } else if (isMemberInElement(win, ln)) {
1846
- memberName = ln.slice(2);
1847
- } else {
1848
- memberName = ln[2] + memberName.slice(3);
1872
+ }
1873
+ } else if (BUILD11.vdomKey && memberName === "key") {
1874
+ } else if (BUILD11.vdomRef && memberName === "ref") {
1875
+ if (newValue) {
1876
+ newValue(elm);
1877
+ }
1878
+ } else if (BUILD11.vdomListener && (BUILD11.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
1879
+ if (memberName[2] === "-") {
1880
+ memberName = memberName.slice(3);
1881
+ } else if (isMemberInElement(win, ln)) {
1882
+ memberName = ln.slice(2);
1883
+ } else {
1884
+ memberName = ln[2] + memberName.slice(3);
1885
+ }
1886
+ if (oldValue || newValue) {
1887
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
1888
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
1889
+ if (oldValue) {
1890
+ plt.rel(elm, memberName, oldValue, capture);
1849
1891
  }
1850
- if (oldValue || newValue) {
1851
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
1852
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
1853
- if (oldValue) {
1854
- plt.rel(elm, memberName, oldValue, capture);
1855
- }
1856
- if (newValue) {
1857
- plt.ael(elm, memberName, newValue, capture);
1858
- }
1892
+ if (newValue) {
1893
+ plt.ael(elm, memberName, newValue, capture);
1859
1894
  }
1860
- } else if (BUILD11.vdomPropOrAttr) {
1861
- const isComplex = isComplexType(newValue);
1862
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
1863
- try {
1864
- if (!elm.tagName.includes("-")) {
1865
- const n = newValue == null ? "" : newValue;
1866
- if (memberName === "list") {
1867
- isProp = false;
1868
- } else if (oldValue == null || elm[memberName] != n) {
1869
- if (typeof elm.__lookupSetter__(memberName) === "function") {
1870
- elm[memberName] = n;
1871
- } else {
1872
- elm.setAttribute(memberName, n);
1873
- }
1895
+ }
1896
+ } else if (BUILD11.vdomPropOrAttr) {
1897
+ const isComplex = isComplexType(newValue);
1898
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
1899
+ try {
1900
+ if (!elm.tagName.includes("-")) {
1901
+ const n = newValue == null ? "" : newValue;
1902
+ if (memberName === "list") {
1903
+ isProp = false;
1904
+ } else if (oldValue == null || elm[memberName] != n) {
1905
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
1906
+ elm[memberName] = n;
1907
+ } else {
1908
+ elm.setAttribute(memberName, n);
1874
1909
  }
1875
- } else if (elm[memberName] !== newValue) {
1876
- elm[memberName] = newValue;
1877
1910
  }
1878
- } catch (e) {
1911
+ } else if (elm[memberName] !== newValue) {
1912
+ elm[memberName] = newValue;
1879
1913
  }
1914
+ } catch (e) {
1880
1915
  }
1881
- let xlink = false;
1882
- if (BUILD11.vdomXlink) {
1883
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
1884
- memberName = ln;
1885
- xlink = true;
1886
- }
1916
+ }
1917
+ let xlink = false;
1918
+ if (BUILD11.vdomXlink) {
1919
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
1920
+ memberName = ln;
1921
+ xlink = true;
1887
1922
  }
1888
- if (newValue == null || newValue === false) {
1889
- if (newValue !== false || elm.getAttribute(memberName) === "") {
1890
- if (BUILD11.vdomXlink && xlink) {
1891
- elm.removeAttributeNS(XLINK_NS, memberName);
1892
- } else {
1893
- elm.removeAttribute(memberName);
1894
- }
1895
- }
1896
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
1897
- newValue = newValue === true ? "" : newValue;
1923
+ }
1924
+ if (newValue == null || newValue === false) {
1925
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
1898
1926
  if (BUILD11.vdomXlink && xlink) {
1899
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
1927
+ elm.removeAttributeNS(XLINK_NS, memberName);
1900
1928
  } else {
1901
- elm.setAttribute(memberName, newValue);
1929
+ elm.removeAttribute(memberName);
1902
1930
  }
1903
1931
  }
1932
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
1933
+ newValue = newValue === true ? "" : newValue;
1934
+ if (BUILD11.vdomXlink && xlink) {
1935
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
1936
+ } else {
1937
+ elm.setAttribute(memberName, newValue);
1938
+ }
1904
1939
  }
1905
1940
  }
1906
1941
  };
@@ -1998,6 +2033,9 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
1998
2033
  elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
1999
2034
  } else if (BUILD13.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
2000
2035
  elm = newVNode2.$elm$ = BUILD13.isDebug || BUILD13.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
2036
+ if (BUILD13.vdomAttribute) {
2037
+ updateElement(null, newVNode2, isSvgMode);
2038
+ }
2001
2039
  } else {
2002
2040
  if (BUILD13.svg && !isSvgMode) {
2003
2041
  isSvgMode = newVNode2.$tag$ === "svg";
@@ -2040,6 +2078,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2040
2078
  elm["s-cr"] = contentRef;
2041
2079
  elm["s-sn"] = newVNode2.$name$ || "";
2042
2080
  elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
2081
+ patchSlotNode(elm);
2043
2082
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
2044
2083
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
2045
2084
  if (BUILD13.experimentalSlotFixes) {
@@ -2266,9 +2305,8 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
2266
2305
  newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
2267
2306
  relocateToHostRoot(newVNode2.$elm$.parentElement);
2268
2307
  }
2269
- } else {
2270
- updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
2271
2308
  }
2309
+ updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
2272
2310
  }
2273
2311
  if (BUILD13.updatable && oldChildren !== null && newChildren !== null) {
2274
2312
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -2355,7 +2393,10 @@ var insertBefore = (parent, newNode, reference) => {
2355
2393
  if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
2356
2394
  patchParentNode(newNode);
2357
2395
  }
2358
- return parent.insertBefore(newNode, reference);
2396
+ parent.insertBefore(newNode, reference);
2397
+ const { slotNode } = findSlotFromSlottedNode(newNode);
2398
+ if (slotNode) dispatchSlotChangeEvent(slotNode);
2399
+ return newNode;
2359
2400
  }
2360
2401
  if (BUILD13.experimentalSlotFixes && parent.__insertBefore) {
2361
2402
  return parent.__insertBefore(newNode, reference);
@@ -2479,7 +2520,7 @@ render() {
2479
2520
  }
2480
2521
  }
2481
2522
  }
2482
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
2523
+ nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
2483
2524
  } else {
2484
2525
  if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
2485
2526
  if (isInitialLoad) {
@@ -2560,19 +2601,13 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
2560
2601
  }
2561
2602
  }
2562
2603
  emitLifecycleEvent(elm, "componentWillLoad");
2563
- if (BUILD14.cmpWillLoad) {
2564
- maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
2565
- }
2604
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
2566
2605
  } else {
2567
2606
  emitLifecycleEvent(elm, "componentWillUpdate");
2568
- if (BUILD14.cmpWillUpdate) {
2569
- maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
2570
- }
2607
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
2571
2608
  }
2572
2609
  emitLifecycleEvent(elm, "componentWillRender");
2573
- if (BUILD14.cmpWillRender) {
2574
- maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
2575
- }
2610
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
2576
2611
  endSchedule();
2577
2612
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
2578
2613
  };
@@ -2680,14 +2715,12 @@ var postUpdateComponent = (hostRef) => {
2680
2715
  const endPostUpdate = createTime("postUpdate", tagName);
2681
2716
  const instance = BUILD14.lazyLoad ? hostRef.$lazyInstance$ : elm;
2682
2717
  const ancestorComponent = hostRef.$ancestorComponent$;
2683
- if (BUILD14.cmpDidRender) {
2684
- if (BUILD14.isDev) {
2685
- hostRef.$flags$ |= 1024 /* devOnRender */;
2686
- }
2687
- safeCall(instance, "componentDidRender", void 0, elm);
2688
- if (BUILD14.isDev) {
2689
- hostRef.$flags$ &= ~1024 /* devOnRender */;
2690
- }
2718
+ if (BUILD14.isDev) {
2719
+ hostRef.$flags$ |= 1024 /* devOnRender */;
2720
+ }
2721
+ safeCall(instance, "componentDidRender", void 0, elm);
2722
+ if (BUILD14.isDev) {
2723
+ hostRef.$flags$ &= ~1024 /* devOnRender */;
2691
2724
  }
2692
2725
  emitLifecycleEvent(elm, "componentDidRender");
2693
2726
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
@@ -2695,14 +2728,12 @@ var postUpdateComponent = (hostRef) => {
2695
2728
  if (BUILD14.asyncLoading && BUILD14.cssAnnotations) {
2696
2729
  addHydratedFlag(elm);
2697
2730
  }
2698
- if (BUILD14.cmpDidLoad) {
2699
- if (BUILD14.isDev) {
2700
- hostRef.$flags$ |= 2048 /* devOnDidLoad */;
2701
- }
2702
- safeCall(instance, "componentDidLoad", void 0, elm);
2703
- if (BUILD14.isDev) {
2704
- hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
2705
- }
2731
+ if (BUILD14.isDev) {
2732
+ hostRef.$flags$ |= 2048 /* devOnDidLoad */;
2733
+ }
2734
+ safeCall(instance, "componentDidLoad", void 0, elm);
2735
+ if (BUILD14.isDev) {
2736
+ hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
2706
2737
  }
2707
2738
  emitLifecycleEvent(elm, "componentDidLoad");
2708
2739
  endPostUpdate();
@@ -2713,14 +2744,12 @@ var postUpdateComponent = (hostRef) => {
2713
2744
  }
2714
2745
  }
2715
2746
  } else {
2716
- if (BUILD14.cmpDidUpdate) {
2717
- if (BUILD14.isDev) {
2718
- hostRef.$flags$ |= 1024 /* devOnRender */;
2719
- }
2720
- safeCall(instance, "componentDidUpdate", void 0, elm);
2721
- if (BUILD14.isDev) {
2722
- hostRef.$flags$ &= ~1024 /* devOnRender */;
2723
- }
2747
+ if (BUILD14.isDev) {
2748
+ hostRef.$flags$ |= 1024 /* devOnRender */;
2749
+ }
2750
+ safeCall(instance, "componentDidUpdate", void 0, elm);
2751
+ if (BUILD14.isDev) {
2752
+ hostRef.$flags$ &= ~1024 /* devOnRender */;
2724
2753
  }
2725
2754
  emitLifecycleEvent(elm, "componentDidUpdate");
2726
2755
  endPostUpdate();
@@ -2852,7 +2881,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
2852
2881
  }
2853
2882
  }
2854
2883
  if (BUILD15.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
2855
- if (BUILD15.cmpShouldUpdate && instance.componentShouldUpdate) {
2884
+ if (instance.componentShouldUpdate) {
2856
2885
  if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
2857
2886
  return;
2858
2887
  }
@@ -3134,7 +3163,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
3134
3163
  }
3135
3164
  };
3136
3165
  var fireConnectedCallback = (instance, elm) => {
3137
- if (BUILD17.lazyLoad && BUILD17.connectedCallback) {
3166
+ if (BUILD17.lazyLoad) {
3138
3167
  safeCall(instance, "connectedCallback", void 0, elm);
3139
3168
  }
3140
3169
  };
@@ -3215,12 +3244,9 @@ var setContentReference = (elm) => {
3215
3244
  // src/runtime/disconnected-callback.ts
3216
3245
  import { BUILD as BUILD19 } from "@stencil/core/internal/app-data";
3217
3246
  var disconnectInstance = (instance, elm) => {
3218
- if (BUILD19.lazyLoad && BUILD19.disconnectedCallback) {
3247
+ if (BUILD19.lazyLoad) {
3219
3248
  safeCall(instance, "disconnectedCallback", void 0, elm || instance);
3220
3249
  }
3221
- if (BUILD19.cmpDidUnload) {
3222
- safeCall(instance, "componentDidUnload", void 0, elm || instance);
3223
- }
3224
3250
  };
3225
3251
  var disconnectedCallback = async (elm) => {
3226
3252
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
@@ -3306,25 +3332,15 @@ var proxyCustomElement = (Cstr, compactMeta) => {
3306
3332
  this.__hasHostListenerAttached = true;
3307
3333
  }
3308
3334
  connectedCallback(this);
3309
- if (BUILD20.connectedCallback && originalConnectedCallback) {
3335
+ if (originalConnectedCallback) {
3310
3336
  originalConnectedCallback.call(this);
3311
3337
  }
3312
3338
  },
3313
3339
  disconnectedCallback() {
3314
3340
  disconnectedCallback(this);
3315
- if (BUILD20.disconnectedCallback && originalDisconnectedCallback) {
3341
+ if (originalDisconnectedCallback) {
3316
3342
  originalDisconnectedCallback.call(this);
3317
3343
  }
3318
- plt.raf(() => {
3319
- var _a;
3320
- const hostRef = getHostRef(this);
3321
- if (((_a = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
3322
- delete hostRef.$vnode$;
3323
- }
3324
- if (this instanceof Node && !this.isConnected) {
3325
- deleteHostRef(this);
3326
- }
3327
- });
3328
3344
  },
3329
3345
  __attachShadow() {
3330
3346
  if (supportsShadow) {
@@ -3844,16 +3860,18 @@ function proxyHostElement(elm, cstr) {
3844
3860
  }
3845
3861
  (_a = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _a.set(memberName, attrPropVal);
3846
3862
  }
3847
- Object.defineProperty(elm, memberName, {
3863
+ const getterSetterDescriptor = {
3848
3864
  get: function() {
3849
3865
  return getValue(this, memberName);
3850
3866
  },
3851
- set(newValue) {
3867
+ set: function(newValue) {
3852
3868
  setValue(this, memberName, newValue, cmpMeta);
3853
3869
  },
3854
3870
  configurable: true,
3855
3871
  enumerable: true
3856
- });
3872
+ };
3873
+ Object.defineProperty(elm, memberName, getterSetterDescriptor);
3874
+ Object.defineProperty(elm, metaAttributeName, getterSetterDescriptor);
3857
3875
  if (!cstr.prototype.__stencilAugmented) {
3858
3876
  Object.defineProperty(cstr.prototype, memberName, {
3859
3877
  get: function() {
@@ -4260,15 +4278,19 @@ var setPlatformHelpers = (helpers) => {
4260
4278
  var supportsShadow = BUILD24.shadowDom;
4261
4279
  var supportsListenerOptions = false;
4262
4280
  var supportsConstructableStylesheets = false;
4263
- var hostRefs = /* @__PURE__ */ new WeakMap();
4264
- var getHostRef = (ref) => hostRefs.get(ref);
4265
- var deleteHostRef = (ref) => hostRefs.delete(ref);
4281
+ var getHostRef = (ref) => {
4282
+ if (ref.__stencil__getHostRef) {
4283
+ return ref.__stencil__getHostRef();
4284
+ }
4285
+ return void 0;
4286
+ };
4266
4287
  var registerInstance = (lazyInstance, hostRef) => {
4267
- const ref = hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
4288
+ lazyInstance.__stencil__getHostRef = () => hostRef;
4289
+ hostRef.$lazyInstance$ = lazyInstance;
4268
4290
  if (BUILD24.modernPropertyDecls && (BUILD24.state || BUILD24.prop)) {
4269
4291
  reWireGetterSetter(lazyInstance, hostRef);
4270
4292
  }
4271
- return ref;
4293
+ return hostRef;
4272
4294
  };
4273
4295
  var registerHost = (elm, cmpMeta) => {
4274
4296
  const hostRef = {
@@ -4282,7 +4304,8 @@ var registerHost = (elm, cmpMeta) => {
4282
4304
  hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
4283
4305
  elm["s-p"] = [];
4284
4306
  elm["s-rc"] = [];
4285
- return hostRefs.set(elm, hostRef);
4307
+ elm.__stencil__getHostRef = () => hostRef;
4308
+ return hostRef;
4286
4309
  };
4287
4310
  var Build = {
4288
4311
  isDev: false,
@@ -4309,7 +4332,6 @@ export {
4309
4332
  consoleError,
4310
4333
  createEvent,
4311
4334
  defineCustomElement,
4312
- deleteHostRef,
4313
4335
  disconnectedCallback,
4314
4336
  doc,
4315
4337
  forceModeUpdate,