@stencil/core 4.26.0-dev.1739854908.eafe1f9 → 4.26.0-dev.1739941303.2a1038e

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-dev.1739854908.eafe1f9 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Platform v4.26.0-dev.1739941303.2a1038e | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -157,12 +157,12 @@ 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
163
  var _a;
164
164
  if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
165
- if ((_a = getHostSlotChildNodes(slotNode, slotNode["s-sn"], false)) == null ? void 0 : _a.length) {
165
+ if ((_a = getSlotChildSiblings(slotNode, getSlotName(slotNode), false)) == null ? void 0 : _a.length) {
166
166
  slotNode.hidden = true;
167
167
  } else {
168
168
  slotNode.hidden = false;
@@ -170,8 +170,10 @@ var updateFallbackSlotVisibility = (elm) => {
170
170
  }
171
171
  });
172
172
  }
173
- for (const childNode of childNodes) {
174
- if (childNode.nodeType === 1 /* ElementNode */ && (childNode.__childNodes || childNode.childNodes).length) {
173
+ let i2 = 0;
174
+ for (i2 = 0; i2 < childNodes.length; i2++) {
175
+ const childNode = childNodes[i2];
176
+ if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
175
177
  updateFallbackSlotVisibility(childNode);
176
178
  }
177
179
  }
@@ -192,7 +194,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
192
194
  let childNode;
193
195
  for (; i2 < childNodes.length; i2++) {
194
196
  childNode = childNodes[i2];
195
- if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode["s-sn"] === slotName)) {
197
+ if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
196
198
  slottedNodes.push(childNode);
197
199
  if (typeof slotName !== "undefined") return slottedNodes;
198
200
  }
@@ -200,11 +202,12 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
200
202
  }
201
203
  return slottedNodes;
202
204
  }
203
- var getHostSlotChildNodes = (node, slotName, includeSlot = true) => {
205
+ var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
204
206
  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);
207
+ if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
208
+ let node = slot;
209
+ while (node = node.nextSibling) {
210
+ if (getSlotName(node) === slotName) childNodes.push(node);
208
211
  }
209
212
  return childNodes;
210
213
  };
@@ -224,38 +227,73 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
224
227
  return slotName === "";
225
228
  };
226
229
  var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
227
- let slottedNodeLocation;
228
230
  if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
229
- slottedNodeLocation = newChild["s-ol"];
230
- } else {
231
- slottedNodeLocation = document.createTextNode("");
232
- slottedNodeLocation["s-nr"] = newChild;
231
+ return;
233
232
  }
233
+ const slottedNodeLocation = document.createTextNode("");
234
+ slottedNodeLocation["s-nr"] = newChild;
234
235
  if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
235
236
  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
- }
237
+ const appendMethod = prepend ? internalCall(parent, "prepend") : internalCall(parent, "appendChild");
238
+ if (BUILD2.hydrateClientSide && typeof position !== "undefined") {
239
+ slottedNodeLocation["s-oo"] = position;
240
+ const childNodes = internalCall(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"] || 0)) 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));
252
251
  } else {
253
252
  appendMethod.call(parent, slottedNodeLocation);
254
253
  }
255
254
  newChild["s-ol"] = slottedNodeLocation;
256
255
  newChild["s-sh"] = slotNode["s-hn"];
257
256
  };
258
- var getSlotName = (node) => node["s-sn"] || node.nodeType === 1 && node.getAttribute("slot") || "";
257
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
258
+ function patchSlotNode(node) {
259
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
260
+ const assignedFactory = (elementsOnly) => (function(opts) {
261
+ const toReturn = [];
262
+ const slotName = this["s-sn"];
263
+ if (opts == null ? void 0 : opts.flatten) {
264
+ console.error(`
265
+ Flattening is not supported for Stencil non-shadow slots.
266
+ You can use \`.childNodes\` to nested slot fallback content.
267
+ If you have a particular use case, please open an issue on the Stencil repo.
268
+ `);
269
+ }
270
+ const parent = this["s-cr"].parentElement;
271
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
272
+ slottedNodes.forEach((n) => {
273
+ if (slotName === getSlotName(n)) {
274
+ toReturn.push(n);
275
+ }
276
+ });
277
+ if (elementsOnly) {
278
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
279
+ }
280
+ return toReturn;
281
+ }).bind(node);
282
+ node.assignedElements = assignedFactory(true);
283
+ node.assignedNodes = assignedFactory(false);
284
+ }
285
+ function dispatchSlotChangeEvent(elm) {
286
+ elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
287
+ }
288
+ function findSlotFromSlottedNode(slottedNode, parentHost) {
289
+ var _a;
290
+ parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
291
+ if (!parentHost) return { slotNode: null, slotName: "" };
292
+ const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
293
+ const childNodes = internalCall(parentHost, "childNodes");
294
+ const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
295
+ return { slotNode, slotName };
296
+ }
259
297
 
260
298
  // src/runtime/dom-extras.ts
261
299
  var patchPseudoShadowDom = (hostElementPrototype) => {
@@ -319,19 +357,14 @@ var patchCloneNode = (HostElementPrototype) => {
319
357
  var patchSlotAppendChild = (HostElementPrototype) => {
320
358
  HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
321
359
  HostElementPrototype.appendChild = function(newChild) {
322
- const slotName = newChild["s-sn"] = getSlotName(newChild);
323
- const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
360
+ const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
324
361
  if (slotNode) {
325
362
  addSlotRelocateNode(newChild, slotNode);
326
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
363
+ const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
327
364
  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
- }
365
+ const parent = internalCall(appendAfter, "parentNode");
366
+ const insertedNode = internalCall(parent, "insertBefore")(newChild, appendAfter.nextSibling);
367
+ dispatchSlotChangeEvent(slotNode);
335
368
  updateFallbackSlotVisibility(this);
336
369
  return insertedNode;
337
370
  }
@@ -360,19 +393,17 @@ var patchSlotPrepend = (HostElementPrototype) => {
360
393
  if (typeof newChild === "string") {
361
394
  newChild = this.ownerDocument.createTextNode(newChild);
362
395
  }
363
- const slotName = newChild["s-sn"] = getSlotName(newChild);
364
- const childNodes = this.__childNodes || this.childNodes;
396
+ const slotName = (newChild["s-sn"] = getSlotName(newChild)) || "";
397
+ const childNodes = internalCall(this, "childNodes");
365
398
  const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
366
399
  if (slotNode) {
367
400
  addSlotRelocateNode(newChild, slotNode, true);
368
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
401
+ const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
369
402
  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
- }
403
+ const parent = internalCall(appendAfter, "parentNode");
404
+ const toReturn = internalCall(parent, "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
405
+ dispatchSlotChangeEvent(slotNode);
406
+ return toReturn;
376
407
  }
377
408
  if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
378
409
  newChild.hidden = true;
@@ -422,8 +453,7 @@ var patchInsertBefore = (HostElementPrototype) => {
422
453
  if (eleProto.__insertBefore) return;
423
454
  eleProto.__insertBefore = HostElementPrototype.insertBefore;
424
455
  HostElementPrototype.insertBefore = function(newChild, currentChild) {
425
- const slotName = newChild["s-sn"] = getSlotName(newChild);
426
- const slotNode = getHostSlotNodes(this.__childNodes, this.tagName, slotName)[0];
456
+ const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
427
457
  const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
428
458
  if (slotNode) {
429
459
  let found = false;
@@ -436,12 +466,9 @@ var patchInsertBefore = (HostElementPrototype) => {
436
466
  }
437
467
  if (slotName === currentChild["s-sn"]) {
438
468
  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
- }
469
+ const parent = internalCall(currentChild, "parentNode");
470
+ internalCall(parent, "insertBefore")(newChild, currentChild);
471
+ dispatchSlotChangeEvent(slotNode);
445
472
  }
446
473
  return;
447
474
  }
@@ -529,7 +556,7 @@ var patchChildSlotNodes = (elm) => {
529
556
  });
530
557
  };
531
558
  var patchSlottedNode = (node) => {
532
- if (!node || node.__nextSibling || !globalThis.Node) return;
559
+ if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
533
560
  patchNextSibling(node);
534
561
  patchPreviousSibling(node);
535
562
  patchParentNode(node);
@@ -633,11 +660,14 @@ function patchHostOriginalAccessor(accessorName, node) {
633
660
  }
634
661
  if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
635
662
  }
636
- function intrnlCall(node, method) {
663
+ function internalCall(node, method) {
637
664
  if ("__" + method in node) {
638
- return node["__" + method];
665
+ const toReturn = node["__" + method];
666
+ if (typeof toReturn !== "function") return toReturn;
667
+ return toReturn.bind(node);
639
668
  } else {
640
- return node[method];
669
+ if (typeof node[method] !== "function") return node[method];
670
+ return node[method].bind(node);
641
671
  }
642
672
  }
643
673
 
@@ -1233,6 +1263,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1233
1263
  const slot = childVNode.$elm$;
1234
1264
  const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
1235
1265
  addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
1266
+ patchSlotNode(node);
1236
1267
  if (shouldMove) {
1237
1268
  parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1238
1269
  }
@@ -1897,7 +1928,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
1897
1928
  elm.removeAttribute(memberName);
1898
1929
  }
1899
1930
  }
1900
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
1931
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
1901
1932
  newValue = newValue === true ? "" : newValue;
1902
1933
  if (BUILD11.vdomXlink && xlink) {
1903
1934
  elm.setAttributeNS(XLINK_NS, memberName, newValue);
@@ -2002,6 +2033,9 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2002
2033
  elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
2003
2034
  } else if (BUILD13.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
2004
2035
  elm = newVNode2.$elm$ = BUILD13.isDebug || BUILD13.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
2036
+ if (BUILD13.vdomAttribute) {
2037
+ updateElement(null, newVNode2, isSvgMode);
2038
+ }
2005
2039
  } else {
2006
2040
  if (BUILD13.svg && !isSvgMode) {
2007
2041
  isSvgMode = newVNode2.$tag$ === "svg";
@@ -2044,6 +2078,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2044
2078
  elm["s-cr"] = contentRef;
2045
2079
  elm["s-sn"] = newVNode2.$name$ || "";
2046
2080
  elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
2081
+ patchSlotNode(elm);
2047
2082
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
2048
2083
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
2049
2084
  if (BUILD13.experimentalSlotFixes) {
@@ -2270,9 +2305,8 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
2270
2305
  newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
2271
2306
  relocateToHostRoot(newVNode2.$elm$.parentElement);
2272
2307
  }
2273
- } else {
2274
- updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
2275
2308
  }
2309
+ updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
2276
2310
  }
2277
2311
  if (BUILD13.updatable && oldChildren !== null && newChildren !== null) {
2278
2312
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -2359,7 +2393,10 @@ var insertBefore = (parent, newNode, reference) => {
2359
2393
  if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
2360
2394
  patchParentNode(newNode);
2361
2395
  }
2362
- return parent.insertBefore(newNode, reference);
2396
+ parent.insertBefore(newNode, reference);
2397
+ const { slotNode } = findSlotFromSlottedNode(newNode);
2398
+ if (slotNode) dispatchSlotChangeEvent(slotNode);
2399
+ return newNode;
2363
2400
  }
2364
2401
  if (BUILD13.experimentalSlotFixes && parent.__insertBefore) {
2365
2402
  return parent.__insertBefore(newNode, reference);
@@ -2483,7 +2520,7 @@ render() {
2483
2520
  }
2484
2521
  }
2485
2522
  }
2486
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
2523
+ nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
2487
2524
  } else {
2488
2525
  if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
2489
2526
  if (isInitialLoad) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/hydrate",
3
- "version": "4.26.0-dev.1739854908.eafe1f9",
3
+ "version": "4.26.0-dev.1739941303.2a1038e",
4
4
  "description": "Stencil internal hydrate platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "private": true
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Hydrate Runner v4.26.0-dev.1739854908.eafe1f9 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Runner v4.26.0-dev.1739941303.2a1038e | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal",
3
- "version": "4.26.0-dev.1739854908.eafe1f9",
3
+ "version": "4.26.0-dev.1739941303.2a1038e",
4
4
  "description": "Stencil internals only to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -1246,7 +1246,7 @@ export interface RenderNode extends HostElement {
1246
1246
  ['s-ol']?: RenderNode;
1247
1247
  /**
1248
1248
  * Node reference:
1249
- * This is a reference for a original location node
1249
+ * This is a reference from an original location node
1250
1250
  * back to the node that's been moved around.
1251
1251
  */
1252
1252
  ['s-nr']?: PatchedSlotNode | RenderNode;