@planningcenter/tapestry 1.3.0-rc.0 → 1.3.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/components/page-header/index.js +2 -4
  2. package/dist/components/page-header/index.js.map +1 -1
  3. package/dist/components/sidenav/index.js +5 -5
  4. package/dist/{packages/tapestry-wc/dist/components/index2.js → tapestry-wc/dist/components/p--zp1K4fh.js} +2 -2
  5. package/dist/tapestry-wc/dist/components/p--zp1K4fh.js.map +1 -0
  6. package/dist/{packages/tapestry-wc/dist/components/sidenav-popover.js → tapestry-wc/dist/components/p-BLhrmYWr.js} +5 -5
  7. package/dist/tapestry-wc/dist/components/p-BLhrmYWr.js.map +1 -0
  8. package/dist/{ext/@stencil/core/internal/client/index.js → tapestry-wc/dist/components/p-Coiv0Cdq.js} +404 -402
  9. package/dist/tapestry-wc/dist/components/p-Coiv0Cdq.js.map +1 -0
  10. package/dist/{packages/tapestry-wc/dist/components/popover-container.js → tapestry-wc/dist/components/p-DSuzRI9T.js} +4 -4
  11. package/dist/tapestry-wc/dist/components/p-DSuzRI9T.js.map +1 -0
  12. package/dist/{packages/tapestry-wc/dist/components/sidenav-responsive-header.js → tapestry-wc/dist/components/p-DqO-ucHK.js} +4 -4
  13. package/dist/tapestry-wc/dist/components/p-DqO-ucHK.js.map +1 -0
  14. package/dist/{packages/tapestry-wc → tapestry-wc}/dist/components/tds-page-header.js +3 -9
  15. package/dist/tapestry-wc/dist/components/tds-page-header.js.map +1 -0
  16. package/dist/{packages/tapestry-wc → tapestry-wc}/dist/components/tds-sidenav-item.js +8 -8
  17. package/dist/tapestry-wc/dist/components/tds-sidenav-item.js.map +1 -0
  18. package/dist/{packages/tapestry-wc → tapestry-wc}/dist/components/tds-sidenav-responsive-header.js +2 -2
  19. package/dist/tapestry-wc/dist/components/tds-sidenav-responsive-header.js.map +1 -0
  20. package/dist/{packages/tapestry-wc → tapestry-wc}/dist/components/tds-sidenav-section.js +4 -4
  21. package/dist/tapestry-wc/dist/components/tds-sidenav-section.js.map +1 -0
  22. package/dist/{packages/tapestry-wc → tapestry-wc}/dist/components/tds-sidenav.js +7 -7
  23. package/dist/tapestry-wc/dist/components/tds-sidenav.js.map +1 -0
  24. package/dist/unstable.css +357 -357
  25. package/dist/unstable.css.map +1 -1
  26. package/dist/webComponents.css +357 -357
  27. package/dist/webComponents.css.map +1 -1
  28. package/package.json +3 -3
  29. package/react-types/index.d.ts +0 -12
  30. package/dist/ext/@stencil/core/internal/app-data/index.js +0 -87
  31. package/dist/ext/@stencil/core/internal/app-data/index.js.map +0 -1
  32. package/dist/ext/@stencil/core/internal/client/index.js.map +0 -1
  33. package/dist/packages/tapestry-wc/dist/components/index2.js.map +0 -1
  34. package/dist/packages/tapestry-wc/dist/components/page-header-nav.js +0 -51
  35. package/dist/packages/tapestry-wc/dist/components/page-header-nav.js.map +0 -1
  36. package/dist/packages/tapestry-wc/dist/components/popover-container.js.map +0 -1
  37. package/dist/packages/tapestry-wc/dist/components/sidenav-popover.js.map +0 -1
  38. package/dist/packages/tapestry-wc/dist/components/sidenav-responsive-header.js.map +0 -1
  39. package/dist/packages/tapestry-wc/dist/components/tds-page-header-nav.js +0 -10
  40. package/dist/packages/tapestry-wc/dist/components/tds-page-header-nav.js.map +0 -1
  41. package/dist/packages/tapestry-wc/dist/components/tds-page-header.js.map +0 -1
  42. package/dist/packages/tapestry-wc/dist/components/tds-sidenav-item.js.map +0 -1
  43. package/dist/packages/tapestry-wc/dist/components/tds-sidenav-responsive-header.js.map +0 -1
  44. package/dist/packages/tapestry-wc/dist/components/tds-sidenav-section.js.map +0 -1
  45. package/dist/packages/tapestry-wc/dist/components/tds-sidenav.js.map +0 -1
@@ -1,4 +1,9 @@
1
- import { BUILD, NAMESPACE } from '../app-data/index.js';
1
+ /*!
2
+ * Planning Center Tapestry Web Components
3
+ * Version: 1.3.0-rc.1
4
+ */
5
+ const NAMESPACE = 'tapestry';
6
+ const BUILD = /* tapestry */ { experimentalSlotFixes: true, hydratedSelectorName: "hydrated", lazyLoad: false, shadowDom: false, slotRelocation: true, updatable: true, watchCallback: false };
2
7
 
3
8
  /*
4
9
  Stencil Client Platform v4.30.0 | MIT Licensed | https://stenciljs.com
@@ -13,30 +18,6 @@ var __export = (target, all) => {
13
18
  var SVG_NS = "http://www.w3.org/2000/svg";
14
19
  var HTML_NS = "http://www.w3.org/1999/xhtml";
15
20
 
16
- // src/utils/es2022-rewire-class-members.ts
17
- var reWireGetterSetter = (instance, hostRef) => {
18
- var _a;
19
- const cmpMeta = hostRef.$cmpMeta$;
20
- const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
21
- members.map(([memberName, [memberFlags]]) => {
22
- if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
23
- const ogValue = instance[memberName];
24
- const ogDescriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(instance), memberName);
25
- Object.defineProperty(instance, memberName, {
26
- get() {
27
- return ogDescriptor.get.call(this);
28
- },
29
- set(newValue) {
30
- ogDescriptor.set.call(this, newValue);
31
- },
32
- configurable: true,
33
- enumerable: true
34
- });
35
- instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
36
- }
37
- });
38
- };
39
-
40
21
  // src/client/client-host-ref.ts
41
22
  var getHostRef = (ref) => {
42
23
  if (ref.__stencil__getHostRef) {
@@ -58,20 +39,10 @@ var registerHost = (hostElement, cmpMeta) => {
58
39
  }
59
40
  const ref = hostRef;
60
41
  hostElement.__stencil__getHostRef = () => ref;
61
- if (BUILD.modernPropertyDecls && (BUILD.state)) {
62
- reWireGetterSetter(hostElement, hostRef);
63
- }
64
42
  return ref;
65
43
  };
66
44
  var isMemberInElement = (elm, memberName) => memberName in elm;
67
45
  var consoleError = (e, el) => (0, console.error)(e, el);
68
-
69
- // src/client/client-style.ts
70
- var styles = /* @__PURE__ */ new Map();
71
- var modeResolutionChain = [];
72
- var HYDRATED_STYLE_ID = "sty-id";
73
- var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
74
- var XLINK_NS = "http://www.w3.org/1999/xlink";
75
46
  var win = typeof window !== "undefined" ? window : {};
76
47
  var H = win.HTMLElement || class {
77
48
  };
@@ -84,32 +55,8 @@ var plt = {
84
55
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
85
56
  ce: (eventName, opts) => new CustomEvent(eventName, opts)
86
57
  };
87
- var supportsListenerOptions = /* @__PURE__ */ (() => {
88
- var _a;
89
- let supportsListenerOptions2 = false;
90
- try {
91
- (_a = win.document) == null ? void 0 : _a.addEventListener(
92
- "e",
93
- null,
94
- Object.defineProperty({}, "passive", {
95
- get() {
96
- supportsListenerOptions2 = true;
97
- }
98
- })
99
- );
100
- } catch (e) {
101
- }
102
- return supportsListenerOptions2;
103
- })();
58
+ var supportsShadow = BUILD.shadowDom;
104
59
  var promiseResolve = (v) => Promise.resolve(v);
105
- var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
106
- try {
107
- new CSSStyleSheet();
108
- return typeof new CSSStyleSheet().replaceSync === "function";
109
- } catch (e) {
110
- }
111
- return false;
112
- })() ;
113
60
  var queuePending = false;
114
61
  var queueDomReads = [];
115
62
  var queueDomWrites = [];
@@ -117,7 +64,7 @@ var queueTask = (queue, write) => (cb) => {
117
64
  queue.push(cb);
118
65
  if (!queuePending) {
119
66
  queuePending = true;
120
- if (write && plt.$flags$ & 4 /* queueSync */) {
67
+ if (plt.$flags$ & 4 /* queueSync */) {
121
68
  nextTick(flush);
122
69
  } else {
123
70
  plt.raf(flush);
@@ -144,7 +91,7 @@ var flush = () => {
144
91
  }
145
92
  };
146
93
  var nextTick = (cb) => promiseResolve().then(cb);
147
- var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
94
+ var writeTask = /* @__PURE__ */ queueTask(queueDomWrites);
148
95
 
149
96
  // src/utils/helpers.ts
150
97
  var isDef = (v) => v != null && v !== void 0;
@@ -153,12 +100,6 @@ var isComplexType = (o) => {
153
100
  return o === "object" || o === "function";
154
101
  };
155
102
 
156
- // src/utils/query-nonce-meta-tag-content.ts
157
- function queryNonceMetaTagContent(doc) {
158
- var _a, _b, _c;
159
- return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
160
- }
161
-
162
103
  // src/utils/regular-expression.ts
163
104
  var escapeRegExpSpecialCharacters = (text) => {
164
105
  return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -249,8 +190,9 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
249
190
  let childNode;
250
191
  for (; i2 < childNodes.length; i2++) {
251
192
  childNode = childNodes[i2];
252
- if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0)) {
193
+ if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
253
194
  slottedNodes.push(childNode);
195
+ if (typeof slotName !== "undefined") return slottedNodes;
254
196
  }
255
197
  slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
256
198
  }
@@ -280,6 +222,21 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
280
222
  }
281
223
  return slotName === "";
282
224
  };
225
+ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
226
+ if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
227
+ return;
228
+ }
229
+ const slottedNodeLocation = document.createTextNode("");
230
+ slottedNodeLocation["s-nr"] = newChild;
231
+ if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
232
+ const parent = slotNode["s-cr"].parentNode;
233
+ const appendMethod = prepend ? internalCall(parent, "prepend") : internalCall(parent, "appendChild");
234
+ {
235
+ appendMethod.call(parent, slottedNodeLocation);
236
+ }
237
+ newChild["s-ol"] = slottedNodeLocation;
238
+ newChild["s-sh"] = slotNode["s-hn"];
239
+ };
283
240
  var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
284
241
  function patchSlotNode(node) {
285
242
  if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
@@ -308,6 +265,313 @@ function patchSlotNode(node) {
308
265
  node.assignedElements = assignedFactory(true);
309
266
  node.assignedNodes = assignedFactory(false);
310
267
  }
268
+ function dispatchSlotChangeEvent(elm) {
269
+ elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
270
+ }
271
+ function findSlotFromSlottedNode(slottedNode, parentHost) {
272
+ var _a;
273
+ parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
274
+ if (!parentHost) return { slotNode: null, slotName: "" };
275
+ const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
276
+ const childNodes = internalCall(parentHost, "childNodes");
277
+ const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
278
+ return { slotNode, slotName };
279
+ }
280
+
281
+ // src/runtime/dom-extras.ts
282
+ var patchPseudoShadowDom = (hostElementPrototype) => {
283
+ patchCloneNode(hostElementPrototype);
284
+ patchSlotAppendChild(hostElementPrototype);
285
+ patchSlotAppend(hostElementPrototype);
286
+ patchSlotPrepend(hostElementPrototype);
287
+ patchSlotInsertAdjacentElement(hostElementPrototype);
288
+ patchSlotInsertAdjacentHTML(hostElementPrototype);
289
+ patchSlotInsertAdjacentText(hostElementPrototype);
290
+ patchInsertBefore(hostElementPrototype);
291
+ patchTextContent(hostElementPrototype);
292
+ patchChildSlotNodes(hostElementPrototype);
293
+ patchSlotRemoveChild(hostElementPrototype);
294
+ };
295
+ var patchCloneNode = (HostElementPrototype) => {
296
+ const orgCloneNode = HostElementPrototype.cloneNode;
297
+ HostElementPrototype.cloneNode = function(deep) {
298
+ const srcNode = this;
299
+ const clonedNode = orgCloneNode.call(srcNode, false);
300
+ if (deep) {
301
+ let i2 = 0;
302
+ let slotted, nonStencilNode;
303
+ const stencilPrivates = [
304
+ "s-id",
305
+ "s-cr",
306
+ "s-lr",
307
+ "s-rc",
308
+ "s-sc",
309
+ "s-p",
310
+ "s-cn",
311
+ "s-sr",
312
+ "s-sn",
313
+ "s-hn",
314
+ "s-ol",
315
+ "s-nr",
316
+ "s-si",
317
+ "s-rf",
318
+ "s-scs"
319
+ ];
320
+ const childNodes = this.__childNodes || this.childNodes;
321
+ for (; i2 < childNodes.length; i2++) {
322
+ slotted = childNodes[i2]["s-nr"];
323
+ nonStencilNode = stencilPrivates.every((privateField) => !childNodes[i2][privateField]);
324
+ if (slotted) {
325
+ if (clonedNode.__appendChild) {
326
+ clonedNode.__appendChild(slotted.cloneNode(true));
327
+ } else {
328
+ clonedNode.appendChild(slotted.cloneNode(true));
329
+ }
330
+ }
331
+ if (nonStencilNode) {
332
+ clonedNode.appendChild(childNodes[i2].cloneNode(true));
333
+ }
334
+ }
335
+ }
336
+ return clonedNode;
337
+ };
338
+ };
339
+ var patchSlotAppendChild = (HostElementPrototype) => {
340
+ HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
341
+ HostElementPrototype.appendChild = function(newChild) {
342
+ const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
343
+ if (slotNode) {
344
+ addSlotRelocateNode(newChild, slotNode);
345
+ const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
346
+ const appendAfter = slotChildNodes[slotChildNodes.length - 1];
347
+ const parent = internalCall(appendAfter, "parentNode");
348
+ const insertedNode = internalCall(parent, "insertBefore")(newChild, appendAfter.nextSibling);
349
+ dispatchSlotChangeEvent(slotNode);
350
+ updateFallbackSlotVisibility(this);
351
+ return insertedNode;
352
+ }
353
+ return this.__appendChild(newChild);
354
+ };
355
+ };
356
+ var patchSlotRemoveChild = (ElementPrototype) => {
357
+ ElementPrototype.__removeChild = ElementPrototype.removeChild;
358
+ ElementPrototype.removeChild = function(toRemove) {
359
+ if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
360
+ const childNodes = this.__childNodes || this.childNodes;
361
+ const slotNode = getHostSlotNodes(childNodes, this.tagName, toRemove["s-sn"]);
362
+ if (slotNode && toRemove.isConnected) {
363
+ toRemove.remove();
364
+ updateFallbackSlotVisibility(this);
365
+ return;
366
+ }
367
+ }
368
+ return this.__removeChild(toRemove);
369
+ };
370
+ };
371
+ var patchSlotPrepend = (HostElementPrototype) => {
372
+ HostElementPrototype.__prepend = HostElementPrototype.prepend;
373
+ HostElementPrototype.prepend = function(...newChildren) {
374
+ newChildren.forEach((newChild) => {
375
+ if (typeof newChild === "string") {
376
+ newChild = this.ownerDocument.createTextNode(newChild);
377
+ }
378
+ const slotName = (newChild["s-sn"] = getSlotName(newChild)) || "";
379
+ const childNodes = internalCall(this, "childNodes");
380
+ const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
381
+ if (slotNode) {
382
+ addSlotRelocateNode(newChild, slotNode, true);
383
+ const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
384
+ const appendAfter = slotChildNodes[0];
385
+ const parent = internalCall(appendAfter, "parentNode");
386
+ const toReturn = internalCall(parent, "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
387
+ dispatchSlotChangeEvent(slotNode);
388
+ return toReturn;
389
+ }
390
+ if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
391
+ newChild.hidden = true;
392
+ }
393
+ return HostElementPrototype.__prepend(newChild);
394
+ });
395
+ };
396
+ };
397
+ var patchSlotAppend = (HostElementPrototype) => {
398
+ HostElementPrototype.__append = HostElementPrototype.append;
399
+ HostElementPrototype.append = function(...newChildren) {
400
+ newChildren.forEach((newChild) => {
401
+ if (typeof newChild === "string") {
402
+ newChild = this.ownerDocument.createTextNode(newChild);
403
+ }
404
+ this.appendChild(newChild);
405
+ });
406
+ };
407
+ };
408
+ var patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
409
+ const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
410
+ HostElementPrototype.insertAdjacentHTML = function(position, text) {
411
+ if (position !== "afterbegin" && position !== "beforeend") {
412
+ return originalInsertAdjacentHtml.call(this, position, text);
413
+ }
414
+ const container = this.ownerDocument.createElement("_");
415
+ let node;
416
+ container.innerHTML = text;
417
+ if (position === "afterbegin") {
418
+ while (node = container.firstChild) {
419
+ this.prepend(node);
420
+ }
421
+ } else if (position === "beforeend") {
422
+ while (node = container.firstChild) {
423
+ this.append(node);
424
+ }
425
+ }
426
+ };
427
+ };
428
+ var patchSlotInsertAdjacentText = (HostElementPrototype) => {
429
+ HostElementPrototype.insertAdjacentText = function(position, text) {
430
+ this.insertAdjacentHTML(position, text);
431
+ };
432
+ };
433
+ var patchInsertBefore = (HostElementPrototype) => {
434
+ const eleProto = HostElementPrototype;
435
+ if (eleProto.__insertBefore) return;
436
+ eleProto.__insertBefore = HostElementPrototype.insertBefore;
437
+ HostElementPrototype.insertBefore = function(newChild, currentChild) {
438
+ const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
439
+ const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
440
+ if (slotNode) {
441
+ let found = false;
442
+ slottedNodes.forEach((childNode) => {
443
+ if (childNode === currentChild || currentChild === null) {
444
+ found = true;
445
+ if (currentChild === null || slotName !== currentChild["s-sn"]) {
446
+ this.appendChild(newChild);
447
+ return;
448
+ }
449
+ if (slotName === currentChild["s-sn"]) {
450
+ addSlotRelocateNode(newChild, slotNode);
451
+ const parent = internalCall(currentChild, "parentNode");
452
+ internalCall(parent, "insertBefore")(newChild, currentChild);
453
+ dispatchSlotChangeEvent(slotNode);
454
+ }
455
+ return;
456
+ }
457
+ });
458
+ if (found) return newChild;
459
+ }
460
+ const parentNode = currentChild == null ? void 0 : currentChild.__parentNode;
461
+ if (parentNode && !this.isSameNode(parentNode)) {
462
+ return this.appendChild(newChild);
463
+ }
464
+ return this.__insertBefore(newChild, currentChild);
465
+ };
466
+ };
467
+ var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
468
+ const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
469
+ HostElementPrototype.insertAdjacentElement = function(position, element) {
470
+ if (position !== "afterbegin" && position !== "beforeend") {
471
+ return originalInsertAdjacentElement.call(this, position, element);
472
+ }
473
+ if (position === "afterbegin") {
474
+ this.prepend(element);
475
+ return element;
476
+ } else if (position === "beforeend") {
477
+ this.append(element);
478
+ return element;
479
+ }
480
+ return element;
481
+ };
482
+ };
483
+ var patchTextContent = (hostElementPrototype) => {
484
+ patchHostOriginalAccessor("textContent", hostElementPrototype);
485
+ Object.defineProperty(hostElementPrototype, "textContent", {
486
+ get: function() {
487
+ let text = "";
488
+ const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
489
+ childNodes.forEach((node) => text += node.textContent || "");
490
+ return text;
491
+ },
492
+ set: function(value) {
493
+ const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
494
+ childNodes.forEach((node) => {
495
+ if (node["s-ol"]) node["s-ol"].remove();
496
+ node.remove();
497
+ });
498
+ this.insertAdjacentHTML("beforeend", value);
499
+ }
500
+ });
501
+ };
502
+ var patchChildSlotNodes = (elm) => {
503
+ class FakeNodeList extends Array {
504
+ item(n) {
505
+ return this[n];
506
+ }
507
+ }
508
+ patchHostOriginalAccessor("children", elm);
509
+ Object.defineProperty(elm, "children", {
510
+ get() {
511
+ return this.childNodes.filter((n) => n.nodeType === 1);
512
+ }
513
+ });
514
+ Object.defineProperty(elm, "childElementCount", {
515
+ get() {
516
+ return this.children.length;
517
+ }
518
+ });
519
+ patchHostOriginalAccessor("firstChild", elm);
520
+ Object.defineProperty(elm, "firstChild", {
521
+ get() {
522
+ return this.childNodes[0];
523
+ }
524
+ });
525
+ patchHostOriginalAccessor("lastChild", elm);
526
+ Object.defineProperty(elm, "lastChild", {
527
+ get() {
528
+ return this.childNodes[this.childNodes.length - 1];
529
+ }
530
+ });
531
+ patchHostOriginalAccessor("childNodes", elm);
532
+ Object.defineProperty(elm, "childNodes", {
533
+ get() {
534
+ const result = new FakeNodeList();
535
+ result.push(...getSlottedChildNodes(this.__childNodes));
536
+ return result;
537
+ }
538
+ });
539
+ };
540
+ var patchParentNode = (node) => {
541
+ if (!node || node.__parentNode) return;
542
+ patchHostOriginalAccessor("parentNode", node);
543
+ Object.defineProperty(node, "parentNode", {
544
+ get: function() {
545
+ var _a;
546
+ return ((_a = this["s-ol"]) == null ? void 0 : _a.parentNode) || this.__parentNode;
547
+ },
548
+ set: function(value) {
549
+ this.__parentNode = value;
550
+ }
551
+ });
552
+ };
553
+ var validElementPatches = ["children", "nextElementSibling", "previousElementSibling"];
554
+ var validNodesPatches = [
555
+ "childNodes",
556
+ "firstChild",
557
+ "lastChild",
558
+ "nextSibling",
559
+ "previousSibling",
560
+ "textContent",
561
+ "parentNode"
562
+ ];
563
+ function patchHostOriginalAccessor(accessorName, node) {
564
+ let accessor;
565
+ if (validElementPatches.includes(accessorName)) {
566
+ accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName);
567
+ } else if (validNodesPatches.includes(accessorName)) {
568
+ accessor = Object.getOwnPropertyDescriptor(Node.prototype, accessorName);
569
+ }
570
+ if (!accessor) {
571
+ accessor = Object.getOwnPropertyDescriptor(node, accessorName);
572
+ }
573
+ if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
574
+ }
311
575
  function internalCall(node, method) {
312
576
  if ("__" + method in node) {
313
577
  const toReturn = node["__" + method];
@@ -365,13 +629,6 @@ var h = (nodeName, vnodeData, ...children) => {
365
629
  }
366
630
  }
367
631
  }
368
- if (typeof nodeName === "function") {
369
- return nodeName(
370
- vnodeData === null ? {} : vnodeData,
371
- vNodeChildren,
372
- vdomFnUtils
373
- );
374
- }
375
632
  const vnode = newVNode(nodeName, null);
376
633
  vnode.$attrs$ = vnodeData;
377
634
  if (vNodeChildren.length > 0) {
@@ -406,36 +663,6 @@ var newVNode = (tag, text) => {
406
663
  };
407
664
  var Host = {};
408
665
  var isHost = (node) => node && node.$tag$ === Host;
409
- var vdomFnUtils = {
410
- forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
411
- map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
412
- };
413
- var convertToPublic = (node) => ({
414
- vattrs: node.$attrs$,
415
- vchildren: node.$children$,
416
- vkey: node.$key$,
417
- vname: node.$name$,
418
- vtag: node.$tag$,
419
- vtext: node.$text$
420
- });
421
- var convertToPrivate = (node) => {
422
- if (typeof node.vtag === "function") {
423
- const vnodeData = { ...node.vattrs };
424
- if (node.vkey) {
425
- vnodeData.key = node.vkey;
426
- }
427
- if (node.vname) {
428
- vnodeData.name = node.vname;
429
- }
430
- return h(node.vtag, vnodeData, ...node.vchildren || []);
431
- }
432
- const vnode = newVNode(node.vtag, node.vtext);
433
- vnode.$attrs$ = node.vattrs;
434
- vnode.$children$ = node.vchildren;
435
- vnode.$key$ = node.vkey;
436
- vnode.$name$ = node.vname;
437
- return vnode;
438
- };
439
666
  var createSupportsRuleRe = (selector) => {
440
667
  const safeSelector2 = escapeRegExpSpecialCharacters(selector);
441
668
  return new RegExp(
@@ -448,17 +675,11 @@ var createSupportsRuleRe = (selector) => {
448
675
  createSupportsRuleRe("::slotted");
449
676
  createSupportsRuleRe(":host");
450
677
  createSupportsRuleRe(":host-context");
451
-
452
- // src/runtime/mode.ts
453
- var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
454
678
  var parsePropertyValue = (propValue, propType) => {
455
679
  if (propValue != null && !isComplexType(propValue)) {
456
680
  if (propType & 4 /* Boolean */) {
457
681
  return propValue === "false" ? false : propValue === "" || !!propValue;
458
682
  }
459
- if (propType & 2 /* Number */) {
460
- return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
461
- }
462
683
  if (propType & 1 /* String */) {
463
684
  return String(propValue);
464
685
  }
@@ -472,103 +693,6 @@ var emitEvent = (elm, name, opts) => {
472
693
  return ev;
473
694
  };
474
695
  var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
475
- var registerStyle = (scopeId2, cssText, allowCS) => {
476
- let style = styles.get(scopeId2);
477
- if (supportsConstructableStylesheets && allowCS) {
478
- style = style || new CSSStyleSheet();
479
- if (typeof style === "string") {
480
- style = cssText;
481
- } else {
482
- style.replaceSync(cssText);
483
- }
484
- } else {
485
- style = cssText;
486
- }
487
- styles.set(scopeId2, style);
488
- };
489
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
490
- var _a;
491
- const scopeId2 = getScopeId(cmpMeta, mode);
492
- const style = styles.get(scopeId2);
493
- if (!win.document) {
494
- return scopeId2;
495
- }
496
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
497
- if (style) {
498
- if (typeof style === "string") {
499
- styleContainerNode = styleContainerNode.head || styleContainerNode;
500
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
501
- let styleElm;
502
- if (!appliedStyles) {
503
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
504
- }
505
- if (!appliedStyles.has(scopeId2)) {
506
- {
507
- styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
508
- styleElm.innerHTML = style;
509
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
510
- if (nonce != null) {
511
- styleElm.setAttribute("nonce", nonce);
512
- }
513
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
514
- if (styleContainerNode.nodeName === "HEAD") {
515
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
516
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
517
- styleContainerNode.insertBefore(
518
- styleElm,
519
- (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
520
- );
521
- } else if ("host" in styleContainerNode) {
522
- if (supportsConstructableStylesheets) {
523
- const stylesheet = new CSSStyleSheet();
524
- stylesheet.replaceSync(style);
525
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
526
- } else {
527
- const existingStyleContainer = styleContainerNode.querySelector("style");
528
- if (existingStyleContainer) {
529
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
530
- } else {
531
- styleContainerNode.prepend(styleElm);
532
- }
533
- }
534
- } else {
535
- styleContainerNode.append(styleElm);
536
- }
537
- }
538
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
539
- styleContainerNode.insertBefore(styleElm, null);
540
- }
541
- }
542
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
543
- styleElm.innerHTML += SLOT_FB_CSS;
544
- }
545
- if (appliedStyles) {
546
- appliedStyles.add(scopeId2);
547
- }
548
- }
549
- } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
550
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
551
- }
552
- }
553
- return scopeId2;
554
- };
555
- var attachStyles = (hostRef) => {
556
- const cmpMeta = hostRef.$cmpMeta$;
557
- const elm = hostRef.$hostElement$;
558
- const flags = cmpMeta.$flags$;
559
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
560
- const scopeId2 = addStyle(
561
- elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
562
- cmpMeta,
563
- hostRef.$modeName$
564
- );
565
- if (flags & 10 /* needsScopedEncapsulation */) {
566
- elm["s-sc"] = scopeId2;
567
- elm.classList.add(scopeId2 + "-h");
568
- }
569
- endAttachStyles();
570
- };
571
- var getScopeId = (cmp, mode) => "sc-" + (mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
572
696
  var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
573
697
  if (oldValue === newValue) {
574
698
  return;
@@ -583,27 +707,6 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
583
707
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
584
708
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
585
709
  }
586
- } else if (memberName === "style") {
587
- {
588
- for (const prop in oldValue) {
589
- if (!newValue || newValue[prop] == null) {
590
- if (prop.includes("-")) {
591
- elm.style.removeProperty(prop);
592
- } else {
593
- elm.style[prop] = "";
594
- }
595
- }
596
- }
597
- }
598
- for (const prop in newValue) {
599
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
600
- if (prop.includes("-")) {
601
- elm.style.setProperty(prop, newValue[prop]);
602
- } else {
603
- elm.style[prop] = newValue[prop];
604
- }
605
- }
606
- }
607
710
  } else if (memberName === "key") ; else if (memberName === "ref") {
608
711
  if (newValue) {
609
712
  newValue(elm);
@@ -647,26 +750,15 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
647
750
  } catch (e) {
648
751
  }
649
752
  }
650
- let xlink = false;
651
- {
652
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
653
- memberName = ln;
654
- xlink = true;
655
- }
656
- }
657
753
  if (newValue == null || newValue === false) {
658
754
  if (newValue !== false || elm.getAttribute(memberName) === "") {
659
- if (xlink) {
660
- elm.removeAttributeNS(XLINK_NS, memberName);
661
- } else {
755
+ {
662
756
  elm.removeAttribute(memberName);
663
757
  }
664
758
  }
665
759
  } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
666
760
  newValue = newValue === true ? "" : newValue;
667
- if (xlink) {
668
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
669
- } else {
761
+ {
670
762
  elm.setAttribute(memberName, newValue);
671
763
  }
672
764
  }
@@ -809,7 +901,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
809
901
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
810
902
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
811
903
  {
812
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
904
+ relocateToHostRoot(oldParentVNode.$elm$);
813
905
  }
814
906
  }
815
907
  {
@@ -819,6 +911,26 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
819
911
  }
820
912
  return elm;
821
913
  };
914
+ var relocateToHostRoot = (parentElm) => {
915
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
916
+ const host = parentElm.closest(hostTagName.toLowerCase());
917
+ if (host != null) {
918
+ const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
919
+ (ref) => ref["s-cr"]
920
+ );
921
+ const childNodeArray = Array.from(
922
+ parentElm.__childNodes || parentElm.childNodes
923
+ );
924
+ for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
925
+ if (childNode["s-sh"] != null) {
926
+ insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
927
+ childNode["s-sh"] = void 0;
928
+ checkSlotRelocate = true;
929
+ }
930
+ }
931
+ }
932
+ plt.$flags$ &= -2 /* isTmpDisconnected */;
933
+ };
822
934
  var putBackInOriginalLocation = (parentElm, recursive) => {
823
935
  plt.$flags$ |= 1 /* isTmpDisconnected */;
824
936
  const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
@@ -843,14 +955,11 @@ var putBackInOriginalLocation = (parentElm, recursive) => {
843
955
  putBackInOriginalLocation(childNode, recursive);
844
956
  }
845
957
  }
846
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
958
+ plt.$flags$ &= -2 /* isTmpDisconnected */;
847
959
  };
848
960
  var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
849
961
  let containerElm = parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
850
962
  let childNode;
851
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
852
- containerElm = containerElm.shadowRoot;
853
- }
854
963
  for (; startIdx <= endIdx; ++startIdx) {
855
964
  if (vnodes[startIdx]) {
856
965
  childNode = createElm(null, parentVNode, startIdx);
@@ -1003,6 +1112,12 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1003
1112
  isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
1004
1113
  }
1005
1114
  {
1115
+ if (tag === "slot" && !useNativeShadowDom) {
1116
+ if (oldVNode.$name$ !== newVNode2.$name$) {
1117
+ newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
1118
+ relocateToHostRoot(newVNode2.$elm$.parentElement);
1119
+ }
1120
+ }
1006
1121
  updateElement(oldVNode, newVNode2, isSvgMode);
1007
1122
  }
1008
1123
  if (oldChildren !== null && newChildren !== null) {
@@ -1039,7 +1154,7 @@ var markSlotContentForRelocation = (elm) => {
1039
1154
  const slotName = childNode["s-sn"];
1040
1155
  for (j = hostContentNodes.length - 1; j >= 0; j--) {
1041
1156
  node = hostContentNodes[j];
1042
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD.experimentalSlotFixes)) {
1157
+ if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
1043
1158
  if (isNodeLocatedInSlot(node, slotName)) {
1044
1159
  let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1045
1160
  checkSlotFallbackVisibility = true;
@@ -1086,8 +1201,18 @@ var nullifyVNodeRefs = (vNode) => {
1086
1201
  var insertBefore = (parent, newNode, reference) => {
1087
1202
  if (typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
1088
1203
  addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
1204
+ } else if (typeof newNode["s-sn"] === "string") {
1205
+ if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
1206
+ patchParentNode(newNode);
1207
+ }
1208
+ parent.insertBefore(newNode, reference);
1209
+ const { slotNode } = findSlotFromSlottedNode(newNode);
1210
+ if (slotNode) dispatchSlotChangeEvent(slotNode);
1211
+ return newNode;
1089
1212
  }
1090
- {
1213
+ if (parent.__insertBefore) {
1214
+ return parent.__insertBefore(newNode, reference);
1215
+ } else {
1091
1216
  return parent == null ? void 0 : parent.insertBefore(newNode, reference);
1092
1217
  }
1093
1218
  };
@@ -1120,12 +1245,6 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1120
1245
  const isHostElement = isHost(renderFnResults);
1121
1246
  const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
1122
1247
  hostTagName = hostElm.tagName;
1123
- if (cmpMeta.$attrsToReflect$) {
1124
- rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1125
- cmpMeta.$attrsToReflect$.map(
1126
- ([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]
1127
- );
1128
- }
1129
1248
  if (isInitialLoad && rootVnode.$attrs$) {
1130
1249
  for (const key of Object.keys(rootVnode.$attrs$)) {
1131
1250
  if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
@@ -1136,11 +1255,11 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1136
1255
  rootVnode.$tag$ = null;
1137
1256
  rootVnode.$flags$ |= 4 /* isHost */;
1138
1257
  hostRef.$vnode$ = rootVnode;
1139
- rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
1258
+ rootVnode.$elm$ = oldVNode.$elm$ = hostElm;
1140
1259
  {
1141
1260
  scopeId = hostElm["s-sc"];
1142
1261
  }
1143
- useNativeShadowDom = !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
1262
+ useNativeShadowDom = supportsShadow;
1144
1263
  {
1145
1264
  contentRef = hostElm["s-cr"];
1146
1265
  checkSlotFallbackVisibility = false;
@@ -1164,7 +1283,7 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1164
1283
  if (slotRefNode) {
1165
1284
  const parentNodeRef = slotRefNode.parentNode;
1166
1285
  let insertBeforeNode = slotRefNode.nextSibling;
1167
- {
1286
+ if ((insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */)) {
1168
1287
  let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
1169
1288
  while (orgLocationNode) {
1170
1289
  let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
@@ -1185,9 +1304,6 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1185
1304
  const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling;
1186
1305
  if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) {
1187
1306
  if (nodeToRelocate !== insertBeforeNode) {
1188
- if (!nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
1189
- nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
1190
- }
1191
1307
  insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
1192
1308
  if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
1193
1309
  nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
@@ -1208,10 +1324,10 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1208
1324
  if (checkSlotFallbackVisibility) {
1209
1325
  updateFallbackSlotVisibility(rootVnode.$elm$);
1210
1326
  }
1211
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1327
+ plt.$flags$ &= -2 /* isTmpDisconnected */;
1212
1328
  relocateNodes.length = 0;
1213
1329
  }
1214
- if (BUILD.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1330
+ if (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1215
1331
  const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
1216
1332
  for (const childNode of children) {
1217
1333
  if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
@@ -1279,9 +1395,6 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
1279
1395
  const elm = hostRef.$hostElement$;
1280
1396
  const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
1281
1397
  const rc = elm["s-rc"];
1282
- if (isInitialLoad) {
1283
- attachStyles(hostRef);
1284
- }
1285
1398
  const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
1286
1399
  {
1287
1400
  callRender(hostRef, instance, elm, isInitialLoad);
@@ -1304,24 +1417,18 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
1304
1417
  }
1305
1418
  }
1306
1419
  };
1307
- var renderingRef = null;
1308
1420
  var callRender = (hostRef, instance, elm, isInitialLoad) => {
1309
- const allRenderFn = false;
1310
- const lazyLoad = false;
1311
- const taskQueue = true ;
1312
- const updatable = true ;
1313
1421
  try {
1314
- renderingRef = instance;
1315
- instance = allRenderFn ? instance.render() : instance.render && instance.render();
1316
- if (updatable && taskQueue) {
1317
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1422
+ instance = instance.render() ;
1423
+ {
1424
+ hostRef.$flags$ &= -17 /* isQueuedForUpdate */;
1318
1425
  }
1319
- if (updatable || lazyLoad) {
1426
+ {
1320
1427
  hostRef.$flags$ |= 2 /* hasRendered */;
1321
1428
  }
1322
- if (BUILD.hasRenderFn || BUILD.reflect) {
1323
- if (BUILD.vdomRender || BUILD.reflect) {
1324
- if (BUILD.hydrateServerSide) ; else {
1429
+ {
1430
+ {
1431
+ {
1325
1432
  renderVdom(hostRef, instance, isInitialLoad);
1326
1433
  }
1327
1434
  }
@@ -1329,7 +1436,6 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
1329
1436
  } catch (e) {
1330
1437
  consoleError(e, hostRef.$hostElement$);
1331
1438
  }
1332
- renderingRef = null;
1333
1439
  return null;
1334
1440
  };
1335
1441
  var postUpdateComponent = (hostRef) => {
@@ -1364,7 +1470,7 @@ var postUpdateComponent = (hostRef) => {
1364
1470
  if (hostRef.$flags$ & 512 /* needsRerender */) {
1365
1471
  nextTick(() => scheduleUpdate(hostRef, false));
1366
1472
  }
1367
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1473
+ hostRef.$flags$ &= -517;
1368
1474
  }
1369
1475
  };
1370
1476
  var appDidLoad = (who) => {
@@ -1399,18 +1505,6 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1399
1505
  if (didValueChange) {
1400
1506
  hostRef.$instanceValues$.set(propName, newVal);
1401
1507
  {
1402
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1403
- const watchMethods = cmpMeta.$watchers$[propName];
1404
- if (watchMethods) {
1405
- watchMethods.map((watchMethodName) => {
1406
- try {
1407
- instance[watchMethodName](newVal, oldVal, propName);
1408
- } catch (e) {
1409
- consoleError(e, elm);
1410
- }
1411
- });
1412
- }
1413
- }
1414
1508
  if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1415
1509
  if (instance.componentShouldUpdate) {
1416
1510
  if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
@@ -1427,10 +1521,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1427
1521
  var proxyComponent = (Cstr, cmpMeta, flags) => {
1428
1522
  var _a, _b;
1429
1523
  const prototype = Cstr.prototype;
1430
- if (cmpMeta.$members$ || (cmpMeta.$watchers$ || Cstr.watchers)) {
1431
- if (Cstr.watchers && !cmpMeta.$watchers$) {
1432
- cmpMeta.$watchers$ = Cstr.watchers;
1433
- }
1524
+ if (cmpMeta.$members$ || BUILD.watchCallback) {
1434
1525
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
1435
1526
  members.map(([memberName, [memberFlags]]) => {
1436
1527
  if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
@@ -1477,10 +1568,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1477
1568
  plt.jmp(() => {
1478
1569
  var _a2;
1479
1570
  const propName = attrNameToPropName.get(attrName);
1480
- if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
1481
- newValue = this[propName];
1482
- delete this[propName];
1483
- } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
1571
+ if (this.hasOwnProperty(propName) && BUILD.lazyLoad) ; else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
1484
1572
  this[propName] == newValue) {
1485
1573
  return;
1486
1574
  } else if (propName == null) {
@@ -1509,12 +1597,8 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1509
1597
  /* @__PURE__ */ new Set([
1510
1598
  ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
1511
1599
  ...members.filter(([_, m]) => m[0] & 15 /* HasAttribute */).map(([propName, m]) => {
1512
- var _a2;
1513
1600
  const attrName = m[1] || propName;
1514
1601
  attrNameToPropName.set(attrName, propName);
1515
- if (m[0] & 512 /* ReflectAttr */) {
1516
- (_a2 = cmpMeta.$attrsToReflect$) == null ? void 0 : _a2.push([propName, attrName]);
1517
- }
1518
1602
  return attrName;
1519
1603
  })
1520
1604
  ])
@@ -1526,32 +1610,12 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1526
1610
 
1527
1611
  // src/runtime/initialize-component.ts
1528
1612
  var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1529
- let Cstr;
1530
1613
  if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1531
1614
  hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1532
- cmpMeta.$lazyBundleId$;
1533
1615
  {
1534
- Cstr = elm.constructor;
1535
1616
  const cmpTag = elm.localName;
1536
1617
  customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
1537
1618
  }
1538
- if (Cstr && Cstr.style) {
1539
- let style;
1540
- if (typeof Cstr.style === "string") {
1541
- style = Cstr.style;
1542
- } else if (typeof Cstr.style !== "string") {
1543
- hostRef.$modeName$ = computeMode(elm);
1544
- if (hostRef.$modeName$) {
1545
- style = Cstr.style[hostRef.$modeName$];
1546
- }
1547
- }
1548
- const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
1549
- if (!styles.has(scopeId2)) {
1550
- const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
1551
- registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1552
- endRegisterStyles();
1553
- }
1554
- }
1555
1619
  }
1556
1620
  const ancestorComponent = hostRef.$ancestorComponent$;
1557
1621
  const schedule = () => scheduleUpdate(hostRef, true);
@@ -1596,15 +1660,14 @@ var connectedCallback = (elm) => {
1596
1660
  }
1597
1661
  });
1598
1662
  }
1599
- {
1600
- initializeComponent(elm, hostRef, cmpMeta);
1663
+ if (BUILD.initializeNextTick) {
1664
+ nextTick(() => initializeComponent(elm, hostRef));
1665
+ } else {
1666
+ initializeComponent(elm, hostRef);
1601
1667
  }
1602
1668
  } else {
1603
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1604
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1605
- fireConnectedCallback(hostRef.$lazyInstance$);
1606
- } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1607
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
1669
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1670
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1608
1671
  }
1609
1672
  }
1610
1673
  endConnected();
@@ -1622,13 +1685,7 @@ var setContentReference = (elm) => {
1622
1685
  };
1623
1686
  var disconnectedCallback = async (elm) => {
1624
1687
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1625
- const hostRef = getHostRef(elm);
1626
- {
1627
- if (hostRef.$rmListeners$) {
1628
- hostRef.$rmListeners$.map((rmListener) => rmListener());
1629
- hostRef.$rmListeners$ = void 0;
1630
- }
1631
- }
1688
+ getHostRef(elm);
1632
1689
  }
1633
1690
  if (rootAppliedStyles.has(elm)) {
1634
1691
  rootAppliedStyles.delete(elm);
@@ -1646,13 +1703,9 @@ var proxyCustomElement = (Cstr, compactMeta) => {
1646
1703
  cmpMeta.$members$ = compactMeta[2];
1647
1704
  }
1648
1705
  {
1649
- cmpMeta.$listeners$ = compactMeta[3];
1650
- }
1651
- {
1652
- cmpMeta.$watchers$ = Cstr.$watchers$;
1653
- }
1654
- {
1655
- cmpMeta.$attrsToReflect$ = [];
1706
+ if (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1707
+ patchPseudoShadowDom(Cstr.prototype);
1708
+ }
1656
1709
  }
1657
1710
  const originalConnectedCallback = Cstr.prototype.connectedCallback;
1658
1711
  const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
@@ -1663,8 +1716,7 @@ var proxyCustomElement = (Cstr, compactMeta) => {
1663
1716
  },
1664
1717
  connectedCallback() {
1665
1718
  if (!this.__hasHostListenerAttached) {
1666
- const hostRef = getHostRef(this);
1667
- addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
1719
+ getHostRef(this);
1668
1720
  this.__hasHostListenerAttached = true;
1669
1721
  }
1670
1722
  connectedCallback(this);
@@ -1680,63 +1732,13 @@ var proxyCustomElement = (Cstr, compactMeta) => {
1680
1732
  },
1681
1733
  __attachShadow() {
1682
1734
  {
1683
- if (!this.shadowRoot) {
1684
- {
1685
- this.attachShadow({
1686
- mode: "open",
1687
- delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
1688
- });
1689
- }
1690
- } else {
1691
- if (this.shadowRoot.mode !== "open") {
1692
- throw new Error(
1693
- `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`
1694
- );
1695
- }
1696
- }
1735
+ this.shadowRoot = this;
1697
1736
  }
1698
1737
  }
1699
1738
  });
1700
1739
  Cstr.is = cmpMeta.$tagName$;
1701
1740
  return proxyComponent(Cstr, cmpMeta);
1702
1741
  };
1703
- var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1704
- if (listeners && win.document) {
1705
- listeners.map(([flags, name, method]) => {
1706
- const target = getHostListenerTarget(win.document, elm, flags) ;
1707
- const handler = hostListenerProxy(hostRef, method);
1708
- const opts = hostListenerOpts(flags);
1709
- plt.ael(target, name, handler, opts);
1710
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1711
- });
1712
- }
1713
- };
1714
- var hostListenerProxy = (hostRef, methodName) => (ev) => {
1715
- var _a;
1716
- try {
1717
- if (BUILD.lazyLoad) ; else {
1718
- hostRef.$hostElement$[methodName](ev);
1719
- }
1720
- } catch (e) {
1721
- consoleError(e, hostRef.$hostElement$);
1722
- }
1723
- };
1724
- var getHostListenerTarget = (doc, elm, flags) => {
1725
- if (flags & 4 /* TargetDocument */) {
1726
- return doc;
1727
- }
1728
- if (flags & 8 /* TargetWindow */) {
1729
- return win;
1730
- }
1731
- if (flags & 16 /* TargetBody */) {
1732
- return doc.body;
1733
- }
1734
- return elm;
1735
- };
1736
- var hostListenerOpts = (flags) => supportsListenerOptions ? {
1737
- passive: (flags & 1 /* Passive */) !== 0,
1738
- capture: (flags & 2 /* Capture */) !== 0
1739
- } : (flags & 2 /* Capture */) !== 0;
1740
1742
 
1741
- export { BUILD, H, H as HTMLElement, Host, NAMESPACE, addHostEventListeners, connectedCallback, consoleError, disconnectedCallback, getHostRef, getValue, h, isMemberInElement, modeResolutionChain, nextTick, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, registerHost, renderVdom, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, win, writeTask };
1742
- //# sourceMappingURL=index.js.map
1743
+ export { H, Host as c, h, proxyCustomElement as p };
1744
+ //# sourceMappingURL=p-Coiv0Cdq.js.map