@atmgrupomaggioli/iris-button 0.0.1 → 0.1.0-dev.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.
Files changed (40) hide show
  1. package/dist/cjs/{index-15a93aad.js → index-f786c569.js} +289 -384
  2. package/dist/cjs/index-f786c569.js.map +1 -0
  3. package/dist/cjs/iris-button.cjs.entry.js +66 -10
  4. package/dist/cjs/iris-button.cjs.entry.js.map +1 -1
  5. package/dist/cjs/iris-button.cjs.js +3 -3
  6. package/dist/cjs/iris-button.cjs.js.map +1 -1
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/collection/collection-manifest.json +1 -1
  9. package/dist/collection/components/iris-button/iris-button.css +40 -13
  10. package/dist/collection/components/iris-button/iris-button.js +161 -14
  11. package/dist/collection/components/iris-button/iris-button.js.map +1 -1
  12. package/dist/components/index.js +1 -1
  13. package/dist/components/iris-button.js +72 -14
  14. package/dist/components/iris-button.js.map +1 -1
  15. package/dist/components/{p-9678c037.js → p-913b636c.js} +248 -375
  16. package/dist/components/p-913b636c.js.map +1 -0
  17. package/dist/esm/{index-73dab88a.js → index-45a8db1c.js} +289 -385
  18. package/dist/esm/index-45a8db1c.js.map +1 -0
  19. package/dist/esm/iris-button.entry.js +66 -10
  20. package/dist/esm/iris-button.entry.js.map +1 -1
  21. package/dist/esm/iris-button.js +4 -4
  22. package/dist/esm/iris-button.js.map +1 -1
  23. package/dist/esm/loader.js +3 -3
  24. package/dist/iris-button/iris-button.css +1 -1
  25. package/dist/iris-button/iris-button.esm.js +1 -1
  26. package/dist/iris-button/iris-button.esm.js.map +1 -1
  27. package/dist/iris-button/p-705a656b.js +3 -0
  28. package/dist/iris-button/p-705a656b.js.map +1 -0
  29. package/dist/iris-button/p-cbf16ce7.entry.js +2 -0
  30. package/dist/iris-button/p-cbf16ce7.entry.js.map +1 -0
  31. package/dist/types/components/iris-button/iris-button.d.ts +32 -4
  32. package/dist/types/components.d.ts +49 -7
  33. package/package.json +6 -9
  34. package/dist/cjs/index-15a93aad.js.map +0 -1
  35. package/dist/components/p-9678c037.js.map +0 -1
  36. package/dist/esm/index-73dab88a.js.map +0 -1
  37. package/dist/iris-button/p-cc8752cf.entry.js +0 -2
  38. package/dist/iris-button/p-cc8752cf.entry.js.map +0 -1
  39. package/dist/iris-button/p-f582cc7a.js +0 -3
  40. package/dist/iris-button/p-f582cc7a.js.map +0 -1
@@ -1,15 +1,22 @@
1
1
  const NAMESPACE = 'iris-button';
2
- const BUILD = /* iris-button */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: false, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: false, lifecycle: false, lifecycleDOMEvents: false, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: false, propString: true, reflect: false, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: false, slot: true, slotChildNodesFix: false, slotRelocation: true, state: false, style: true, svg: false, taskQueue: true, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: false, vdomPropOrAttr: false, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: false };
2
+ const BUILD = /* iris-button */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: false, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: false, lifecycle: false, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: false, propString: true, reflect: false, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: false, style: true, svg: true, taskQueue: true, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: false, vdomListener: true, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: false };
3
3
 
4
4
  /*
5
- Stencil Client Platform v4.22.3 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Platform v4.25.1 | MIT Licensed | https://stenciljs.com
6
6
  */
7
7
  var __defProp = Object.defineProperty;
8
8
  var __export = (target, all) => {
9
9
  for (var name in all)
10
10
  __defProp(target, name, { get: all[name], enumerable: true });
11
11
  };
12
+
13
+ // src/utils/constants.ts
14
+ var SVG_NS = "http://www.w3.org/2000/svg";
15
+ var HTML_NS = "http://www.w3.org/1999/xhtml";
16
+
17
+ // src/client/client-host-ref.ts
12
18
  var hostRefs = /* @__PURE__ */ new WeakMap();
19
+ var deleteHostRef = (ref) => hostRefs.delete(ref);
13
20
  var getHostRef = (ref) => hostRefs.get(ref);
14
21
  var registerHost = (hostElement, cmpMeta) => {
15
22
  const hostRef = {
@@ -23,12 +30,15 @@ var registerHost = (hostElement, cmpMeta) => {
23
30
  hostElement["s-p"] = [];
24
31
  hostElement["s-rc"] = [];
25
32
  }
26
- return hostRefs.set(hostElement, hostRef);
33
+ const ref = hostRefs.set(hostElement, hostRef);
34
+ return ref;
27
35
  };
36
+ var isMemberInElement = (elm, memberName) => memberName in elm;
28
37
  var consoleError = (e, el) => (0, console.error)(e, el);
29
38
 
30
39
  // src/client/client-style.ts
31
40
  var styles = /* @__PURE__ */ new Map();
41
+ var HYDRATED_STYLE_ID = "sty-id";
32
42
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
33
43
  var win = typeof window !== "undefined" ? window : {};
34
44
  var doc = win.document || { head: {} };
@@ -43,7 +53,6 @@ var plt = {
43
53
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
44
54
  ce: (eventName, opts) => new CustomEvent(eventName, opts)
45
55
  };
46
- var supportsShadow = BUILD.shadowDom;
47
56
  var promiseResolve = (v) => Promise.resolve(v);
48
57
  var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
49
58
  try {
@@ -95,12 +104,6 @@ var getAssetPath = (path) => {
95
104
  return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
96
105
  };
97
106
  var setAssetPath = (path) => plt.$resourcesUrl$ = path;
98
-
99
- // src/utils/constants.ts
100
- var EMPTY_OBJ = {};
101
-
102
- // src/utils/helpers.ts
103
- var isDef = (v) => v != null;
104
107
  var isComplexType = (o) => {
105
108
  o = typeof o;
106
109
  return o === "object" || o === "function";
@@ -169,8 +172,6 @@ var createTime = (fnName, tagName = "") => {
169
172
  };
170
173
  var h = (nodeName, vnodeData, ...children) => {
171
174
  let child = null;
172
- let key = null;
173
- let slotName = null;
174
175
  let simple = false;
175
176
  let lastSimple = false;
176
177
  const vNodeChildren = [];
@@ -194,12 +195,6 @@ var h = (nodeName, vnodeData, ...children) => {
194
195
  };
195
196
  walk(children);
196
197
  if (vnodeData) {
197
- if (vnodeData.key) {
198
- key = vnodeData.key;
199
- }
200
- if (vnodeData.name) {
201
- slotName = vnodeData.name;
202
- }
203
198
  {
204
199
  const classData = vnodeData.className || vnodeData.class;
205
200
  if (classData) {
@@ -212,12 +207,6 @@ var h = (nodeName, vnodeData, ...children) => {
212
207
  if (vNodeChildren.length > 0) {
213
208
  vnode.$children$ = vNodeChildren;
214
209
  }
215
- {
216
- vnode.$key$ = key;
217
- }
218
- {
219
- vnode.$name$ = slotName;
220
- }
221
210
  return vnode;
222
211
  };
223
212
  var newVNode = (tag, text) => {
@@ -231,12 +220,6 @@ var newVNode = (tag, text) => {
231
220
  {
232
221
  vnode.$attrs$ = null;
233
222
  }
234
- {
235
- vnode.$key$ = null;
236
- }
237
- {
238
- vnode.$name$ = null;
239
- }
240
223
  return vnode;
241
224
  };
242
225
  var Host = {};
@@ -253,6 +236,22 @@ var parsePropertyValue = (propValue, propType) => {
253
236
  }
254
237
  return propValue;
255
238
  };
239
+ var getElement = (ref) => ref;
240
+
241
+ // src/runtime/event-emitter.ts
242
+ var createEvent = (ref, name, flags) => {
243
+ const elm = getElement(ref);
244
+ return {
245
+ emit: (detail) => {
246
+ return emitEvent(elm, name, {
247
+ bubbles: !!(flags & 4 /* Bubbles */),
248
+ composed: !!(flags & 2 /* Composed */),
249
+ cancelable: !!(flags & 1 /* Cancellable */),
250
+ detail
251
+ });
252
+ }
253
+ };
254
+ };
256
255
  var emitEvent = (elm, name, opts) => {
257
256
  const ev = plt.ce(name, opts);
258
257
  elm.dispatchEvent(ev);
@@ -288,7 +287,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
288
287
  }
289
288
  if (!appliedStyles.has(scopeId2)) {
290
289
  {
291
- styleElm = doc.createElement("style");
290
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
292
291
  styleElm.innerHTML = style;
293
292
  const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
294
293
  if (nonce != null) {
@@ -298,7 +297,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
298
297
  if (styleContainerNode.nodeName === "HEAD") {
299
298
  const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
300
299
  const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
301
- styleContainerNode.insertBefore(styleElm, referenceNode2);
300
+ styleContainerNode.insertBefore(
301
+ styleElm,
302
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
303
+ );
302
304
  } else if ("host" in styleContainerNode) {
303
305
  if (supportsConstructableStylesheets) {
304
306
  const stylesheet = new CSSStyleSheet();
@@ -336,42 +338,123 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
336
338
  var attachStyles = (hostRef) => {
337
339
  const cmpMeta = hostRef.$cmpMeta$;
338
340
  const elm = hostRef.$hostElement$;
341
+ const flags = cmpMeta.$flags$;
339
342
  const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
340
- addStyle(
341
- elm.getRootNode(),
343
+ const scopeId2 = addStyle(
344
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
342
345
  cmpMeta);
346
+ if (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
347
+ elm["s-sc"] = scopeId2;
348
+ elm.classList.add(scopeId2 + "-h");
349
+ }
343
350
  endAttachStyles();
344
351
  };
345
352
  var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
346
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
353
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
347
354
  if (oldValue !== newValue) {
348
- memberName.toLowerCase();
355
+ let isProp = isMemberInElement(elm, memberName);
356
+ let ln = memberName.toLowerCase();
349
357
  if (memberName === "class") {
350
358
  const classList = elm.classList;
351
359
  const oldClasses = parseClassList(oldValue);
352
- const newClasses = parseClassList(newValue);
353
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
354
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
360
+ let newClasses = parseClassList(newValue);
361
+ {
362
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
363
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
364
+ }
365
+ } else if ((!elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
366
+ if (memberName[2] === "-") {
367
+ memberName = memberName.slice(3);
368
+ } else if (isMemberInElement(win, ln)) {
369
+ memberName = ln.slice(2);
370
+ } else {
371
+ memberName = ln[2] + memberName.slice(3);
372
+ }
373
+ if (oldValue || newValue) {
374
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
375
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
376
+ if (oldValue) {
377
+ plt.rel(elm, memberName, oldValue, capture);
378
+ }
379
+ if (newValue) {
380
+ plt.ael(elm, memberName, newValue, capture);
381
+ }
382
+ }
383
+ } else {
384
+ const isComplex = isComplexType(newValue);
385
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
386
+ try {
387
+ if (!elm.tagName.includes("-")) {
388
+ const n = newValue == null ? "" : newValue;
389
+ if (memberName === "list") {
390
+ isProp = false;
391
+ } else if (oldValue == null || elm[memberName] != n) {
392
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
393
+ elm[memberName] = n;
394
+ } else {
395
+ elm.setAttribute(memberName, n);
396
+ }
397
+ }
398
+ } else if (elm[memberName] !== newValue) {
399
+ elm[memberName] = newValue;
400
+ }
401
+ } catch (e) {
402
+ }
403
+ }
404
+ if (newValue == null || newValue === false) {
405
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
406
+ {
407
+ elm.removeAttribute(memberName);
408
+ }
409
+ }
410
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
411
+ newValue = newValue === true ? "" : newValue;
412
+ {
413
+ elm.setAttribute(memberName, newValue);
414
+ }
415
+ }
355
416
  }
356
417
  }
357
418
  };
358
419
  var parseClassListRegex = /\s/;
359
- var parseClassList = (value) => !value ? [] : value.split(parseClassListRegex);
420
+ var parseClassList = (value) => {
421
+ if (typeof value === "object" && value && "baseVal" in value) {
422
+ value = value.baseVal;
423
+ }
424
+ if (!value || typeof value !== "string") {
425
+ return [];
426
+ }
427
+ return value.split(parseClassListRegex);
428
+ };
429
+ var CAPTURE_EVENT_SUFFIX = "Capture";
430
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
360
431
 
361
432
  // src/runtime/vdom/update-element.ts
362
- var updateElement = (oldVnode, newVnode, isSvgMode2) => {
433
+ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
363
434
  const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
364
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ;
365
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
435
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
436
+ const newVnodeAttrs = newVnode.$attrs$ || {};
366
437
  {
367
438
  for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
368
439
  if (!(memberName in newVnodeAttrs)) {
369
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0);
440
+ setAccessor(
441
+ elm,
442
+ memberName,
443
+ oldVnodeAttrs[memberName],
444
+ void 0,
445
+ isSvgMode2,
446
+ newVnode.$flags$);
370
447
  }
371
448
  }
372
449
  }
373
450
  for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
374
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName]);
451
+ setAccessor(
452
+ elm,
453
+ memberName,
454
+ oldVnodeAttrs[memberName],
455
+ newVnodeAttrs[memberName],
456
+ isSvgMode2,
457
+ newVnode.$flags$);
375
458
  }
376
459
  };
377
460
  function sortedAttrNames(attrNames) {
@@ -383,51 +466,29 @@ function sortedAttrNames(attrNames) {
383
466
  attrNames
384
467
  );
385
468
  }
386
-
387
- // src/runtime/vdom/vdom-render.ts
388
- var scopeId;
389
- var contentRef;
390
469
  var hostTagName;
391
470
  var useNativeShadowDom = false;
392
- var checkSlotFallbackVisibility = false;
393
- var checkSlotRelocate = false;
394
- var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
395
- var _a;
471
+ var isSvgMode = false;
472
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
396
473
  const newVNode2 = newParentVNode.$children$[childIndex];
397
474
  let i2 = 0;
398
475
  let elm;
399
476
  let childNode;
400
- let oldVNode;
401
- if (!useNativeShadowDom) {
402
- checkSlotRelocate = true;
403
- if (newVNode2.$tag$ === "slot") {
404
- newVNode2.$flags$ |= newVNode2.$children$ ? (
405
- // slot element has fallback content
406
- // still create an element that "mocks" the slot element
407
- 2 /* isSlotFallback */
408
- ) : (
409
- // slot element does not have fallback content
410
- // create an html comment we'll use to always reference
411
- // where actual slot content should sit next to
412
- 1 /* isSlotReference */
413
- );
414
- }
415
- }
416
477
  if (newVNode2.$text$ !== null) {
417
478
  elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
418
- } else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
419
- elm = newVNode2.$elm$ = doc.createTextNode("");
420
479
  } else {
421
- elm = newVNode2.$elm$ = doc.createElement(
480
+ if (!isSvgMode) {
481
+ isSvgMode = newVNode2.$tag$ === "svg";
482
+ }
483
+ elm = newVNode2.$elm$ = doc.createElementNS(
484
+ isSvgMode ? SVG_NS : HTML_NS,
422
485
  !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
423
- );
424
- {
425
- updateElement(null, newVNode2);
486
+ ) ;
487
+ if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
488
+ isSvgMode = false;
426
489
  }
427
- const rootNode = elm.getRootNode();
428
- const isElementWithinShadowRoot = !rootNode.querySelector("body");
429
- if (!isElementWithinShadowRoot && BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
430
- elm.classList.add(elm["s-si"] = scopeId);
490
+ {
491
+ updateElement(null, newVNode2, isSvgMode);
431
492
  }
432
493
  if (newVNode2.$children$) {
433
494
  for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
@@ -437,59 +498,29 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
437
498
  }
438
499
  }
439
500
  }
440
- }
441
- elm["s-hn"] = hostTagName;
442
- {
443
- if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
444
- elm["s-sr"] = true;
445
- elm["s-cr"] = contentRef;
446
- elm["s-sn"] = newVNode2.$name$ || "";
447
- elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
448
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
449
- if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
450
- {
451
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
452
- }
501
+ {
502
+ if (newVNode2.$tag$ === "svg") {
503
+ isSvgMode = false;
504
+ } else if (elm.tagName === "foreignObject") {
505
+ isSvgMode = true;
453
506
  }
454
507
  }
455
508
  }
509
+ elm["s-hn"] = hostTagName;
456
510
  return elm;
457
511
  };
458
- var putBackInOriginalLocation = (parentElm, recursive) => {
459
- plt.$flags$ |= 1 /* isTmpDisconnected */;
460
- const oldSlotChildNodes = Array.from(parentElm.childNodes);
461
- if (parentElm["s-sr"] && BUILD.experimentalSlotFixes) {
462
- let node = parentElm;
463
- while (node = node.nextSibling) {
464
- if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
465
- oldSlotChildNodes.push(node);
466
- }
467
- }
468
- }
469
- for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
470
- const childNode = oldSlotChildNodes[i2];
471
- if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
472
- insertBefore(parentReferenceNode(childNode), childNode, referenceNode(childNode));
473
- childNode["s-ol"].remove();
474
- childNode["s-ol"] = void 0;
475
- childNode["s-sh"] = void 0;
476
- checkSlotRelocate = true;
477
- }
478
- if (recursive) {
479
- putBackInOriginalLocation(childNode, recursive);
480
- }
481
- }
482
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
483
- };
484
512
  var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
485
- let containerElm = parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
513
+ let containerElm = parentElm;
486
514
  let childNode;
515
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
516
+ containerElm = containerElm.shadowRoot;
517
+ }
487
518
  for (; startIdx <= endIdx; ++startIdx) {
488
519
  if (vnodes[startIdx]) {
489
520
  childNode = createElm(null, parentVNode, startIdx);
490
521
  if (childNode) {
491
522
  vnodes[startIdx].$elm$ = childNode;
492
- insertBefore(containerElm, childNode, referenceNode(before) );
523
+ insertBefore(containerElm, childNode, before);
493
524
  }
494
525
  }
495
526
  }
@@ -500,14 +531,6 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
500
531
  if (vnode) {
501
532
  const elm = vnode.$elm$;
502
533
  if (elm) {
503
- {
504
- checkSlotFallbackVisibility = true;
505
- if (elm["s-ol"]) {
506
- elm["s-ol"].remove();
507
- } else {
508
- putBackInOriginalLocation(elm, true);
509
- }
510
- }
511
534
  elm.remove();
512
535
  }
513
536
  }
@@ -516,8 +539,6 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
516
539
  var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
517
540
  let oldStartIdx = 0;
518
541
  let newStartIdx = 0;
519
- let idxInOld = 0;
520
- let i2 = 0;
521
542
  let oldEndIdx = oldCh.length - 1;
522
543
  let oldStartVnode = oldCh[0];
523
544
  let oldEndVnode = oldCh[oldEndIdx];
@@ -525,7 +546,6 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
525
546
  let newStartVnode = newCh[0];
526
547
  let newEndVnode = newCh[newEndIdx];
527
548
  let node;
528
- let elmToMove;
529
549
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
530
550
  if (oldStartVnode == null) {
531
551
  oldStartVnode = oldCh[++oldStartIdx];
@@ -544,48 +564,23 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
544
564
  oldEndVnode = oldCh[--oldEndIdx];
545
565
  newEndVnode = newCh[--newEndIdx];
546
566
  } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
547
- if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
548
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
549
- }
550
567
  patch(oldStartVnode, newEndVnode, isInitialRender);
551
568
  insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
552
569
  oldStartVnode = oldCh[++oldStartIdx];
553
570
  newEndVnode = newCh[--newEndIdx];
554
571
  } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
555
- if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
556
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
557
- }
558
572
  patch(oldEndVnode, newStartVnode, isInitialRender);
559
573
  insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
560
574
  oldEndVnode = oldCh[--oldEndIdx];
561
575
  newStartVnode = newCh[++newStartIdx];
562
576
  } else {
563
- idxInOld = -1;
564
577
  {
565
- for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
566
- if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
567
- idxInOld = i2;
568
- break;
569
- }
570
- }
571
- }
572
- if (idxInOld >= 0) {
573
- elmToMove = oldCh[idxInOld];
574
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
575
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
576
- } else {
577
- patch(elmToMove, newStartVnode, isInitialRender);
578
- oldCh[idxInOld] = void 0;
579
- node = elmToMove.$elm$;
580
- }
581
- newStartVnode = newCh[++newStartIdx];
582
- } else {
583
578
  node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
584
579
  newStartVnode = newCh[++newStartIdx];
585
580
  }
586
581
  if (node) {
587
582
  {
588
- insertBefore(parentReferenceNode(oldStartVnode.$elm$), node, referenceNode(oldStartVnode.$elm$));
583
+ insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
589
584
  }
590
585
  }
591
586
  }
@@ -605,40 +600,26 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
605
600
  };
606
601
  var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
607
602
  if (leftVNode.$tag$ === rightVNode.$tag$) {
608
- if (leftVNode.$tag$ === "slot") {
609
- if (
610
- // The component gets hydrated and no VDOM has been initialized.
611
- // Here the comparison can't happen as $name$ property is not set for `leftNode`.
612
- "$nodeId$" in leftVNode && isInitialRender && // `leftNode` is not from type HTMLComment which would cause many
613
- // hydration comments to be removed
614
- leftVNode.$elm$.nodeType !== 8
615
- ) {
616
- return false;
617
- }
618
- return leftVNode.$name$ === rightVNode.$name$;
619
- }
620
- if (!isInitialRender) {
621
- return leftVNode.$key$ === rightVNode.$key$;
603
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
604
+ leftVNode.$key$ = rightVNode.$key$;
622
605
  }
623
606
  return true;
624
607
  }
625
608
  return false;
626
609
  };
627
- var referenceNode = (node) => {
628
- return node && node["s-ol"] || node;
629
- };
630
- var parentReferenceNode = (node) => (node["s-ol"] ? node["s-ol"] : node).parentNode;
631
610
  var patch = (oldVNode, newVNode2, isInitialRender = false) => {
632
611
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
633
612
  const oldChildren = oldVNode.$children$;
634
613
  const newChildren = newVNode2.$children$;
635
614
  const tag = newVNode2.$tag$;
636
615
  const text = newVNode2.$text$;
637
- let defaultHolder;
638
616
  if (text === null) {
639
617
  {
640
- if (tag === "slot" && !useNativeShadowDom) ; else {
641
- updateElement(oldVNode, newVNode2);
618
+ isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
619
+ }
620
+ {
621
+ {
622
+ updateElement(oldVNode, newVNode2, isSvgMode);
642
623
  }
643
624
  }
644
625
  if (oldChildren !== null && newChildren !== null) {
@@ -654,110 +635,21 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
654
635
  ) {
655
636
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
656
637
  }
657
- } else if ((defaultHolder = elm["s-cr"])) {
658
- defaultHolder.parentNode.textContent = text;
638
+ if (isSvgMode && tag === "svg") {
639
+ isSvgMode = false;
640
+ }
659
641
  } else if (oldVNode.$text$ !== text) {
660
642
  elm.data = text;
661
643
  }
662
644
  };
663
- var updateFallbackSlotVisibility = (elm) => {
664
- const childNodes = elm.childNodes;
665
- for (const childNode of childNodes) {
666
- if (childNode.nodeType === 1 /* ElementNode */) {
667
- if (childNode["s-sr"]) {
668
- const slotName = childNode["s-sn"];
669
- childNode.hidden = false;
670
- for (const siblingNode of childNodes) {
671
- if (siblingNode !== childNode) {
672
- if (siblingNode["s-hn"] !== childNode["s-hn"] || slotName !== "") {
673
- if (siblingNode.nodeType === 1 /* ElementNode */ && (slotName === siblingNode.getAttribute("slot") || slotName === siblingNode["s-sn"]) || siblingNode.nodeType === 3 /* TextNode */ && slotName === siblingNode["s-sn"]) {
674
- childNode.hidden = true;
675
- break;
676
- }
677
- } else {
678
- if (siblingNode.nodeType === 1 /* ElementNode */ || siblingNode.nodeType === 3 /* TextNode */ && siblingNode.textContent.trim() !== "") {
679
- childNode.hidden = true;
680
- break;
681
- }
682
- }
683
- }
684
- }
685
- }
686
- updateFallbackSlotVisibility(childNode);
687
- }
688
- }
689
- };
690
- var relocateNodes = [];
691
- var markSlotContentForRelocation = (elm) => {
692
- let node;
693
- let hostContentNodes;
694
- let j;
695
- for (const childNode of elm.childNodes) {
696
- if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
697
- hostContentNodes = node.parentNode.childNodes;
698
- const slotName = childNode["s-sn"];
699
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
700
- node = hostContentNodes[j];
701
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD.experimentalSlotFixes )) {
702
- if (isNodeLocatedInSlot(node, slotName)) {
703
- let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
704
- checkSlotFallbackVisibility = true;
705
- node["s-sn"] = node["s-sn"] || slotName;
706
- if (relocateNodeData) {
707
- relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
708
- relocateNodeData.$slotRefNode$ = childNode;
709
- } else {
710
- node["s-sh"] = childNode["s-hn"];
711
- relocateNodes.push({
712
- $slotRefNode$: childNode,
713
- $nodeToRelocate$: node
714
- });
715
- }
716
- if (node["s-sr"]) {
717
- relocateNodes.map((relocateNode) => {
718
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
719
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
720
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
721
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
722
- }
723
- }
724
- });
725
- }
726
- } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
727
- relocateNodes.push({
728
- $nodeToRelocate$: node
729
- });
730
- }
731
- }
732
- }
733
- }
734
- if (childNode.nodeType === 1 /* ElementNode */) {
735
- markSlotContentForRelocation(childNode);
736
- }
737
- }
738
- };
739
- var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
740
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
741
- if (nodeToRelocate.getAttribute("slot") === null && slotName === "") {
742
- return true;
743
- }
744
- if (nodeToRelocate.getAttribute("slot") === slotName) {
745
- return true;
746
- }
747
- return false;
748
- }
749
- if (nodeToRelocate["s-sn"] === slotName) {
750
- return true;
751
- }
752
- return slotName === "";
753
- };
754
645
  var insertBefore = (parent, newNode, reference) => {
755
- const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
756
- return inserted;
646
+ {
647
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
648
+ }
757
649
  };
758
650
  var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
759
- var _a, _b, _c, _d;
760
651
  const hostElm = hostRef.$hostElement$;
652
+ const cmpMeta = hostRef.$cmpMeta$;
761
653
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
762
654
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
763
655
  hostTagName = hostElm.tagName;
@@ -771,83 +663,22 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
771
663
  rootVnode.$tag$ = null;
772
664
  rootVnode.$flags$ |= 4 /* isHost */;
773
665
  hostRef.$vnode$ = rootVnode;
774
- rootVnode.$elm$ = oldVNode.$elm$ = hostElm;
775
- useNativeShadowDom = supportsShadow ;
776
- {
777
- contentRef = hostElm["s-cr"];
778
- checkSlotFallbackVisibility = false;
779
- }
666
+ rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
667
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
780
668
  patch(oldVNode, rootVnode, isInitialLoad);
781
- {
782
- plt.$flags$ |= 1 /* isTmpDisconnected */;
783
- if (checkSlotRelocate) {
784
- markSlotContentForRelocation(rootVnode.$elm$);
785
- for (const relocateData of relocateNodes) {
786
- const nodeToRelocate = relocateData.$nodeToRelocate$;
787
- if (!nodeToRelocate["s-ol"]) {
788
- const orgLocationNode = doc.createTextNode("");
789
- orgLocationNode["s-nr"] = nodeToRelocate;
790
- insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
791
- }
792
- }
793
- for (const relocateData of relocateNodes) {
794
- const nodeToRelocate = relocateData.$nodeToRelocate$;
795
- const slotRefNode = relocateData.$slotRefNode$;
796
- if (slotRefNode) {
797
- const parentNodeRef = slotRefNode.parentNode;
798
- let insertBeforeNode = slotRefNode.nextSibling;
799
- {
800
- let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
801
- while (orgLocationNode) {
802
- let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
803
- if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === refNode.parentNode) {
804
- refNode = refNode.nextSibling;
805
- while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
806
- refNode = refNode == null ? void 0 : refNode.nextSibling;
807
- }
808
- if (!refNode || !refNode["s-nr"]) {
809
- insertBeforeNode = refNode;
810
- break;
811
- }
812
- }
813
- orgLocationNode = orgLocationNode.previousSibling;
814
- }
815
- }
816
- if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
817
- if (nodeToRelocate !== insertBeforeNode) {
818
- if (!nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
819
- nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
820
- }
821
- insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
822
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
823
- nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
824
- }
825
- }
826
- }
827
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
828
- } else {
829
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
830
- if (isInitialLoad) {
831
- nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
832
- }
833
- nodeToRelocate.hidden = true;
834
- }
835
- }
836
- }
837
- }
838
- if (checkSlotFallbackVisibility) {
839
- updateFallbackSlotVisibility(rootVnode.$elm$);
840
- }
841
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
842
- relocateNodes.length = 0;
843
- }
844
- contentRef = void 0;
845
669
  };
846
670
 
847
671
  // src/runtime/update-component.ts
848
672
  var attachToAncestor = (hostRef, ancestorComponent) => {
849
673
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
850
- ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
674
+ const index = ancestorComponent["s-p"].push(
675
+ new Promise(
676
+ (r) => hostRef.$onRenderResolve$ = () => {
677
+ ancestorComponent["s-p"].splice(index - 1, 1);
678
+ r();
679
+ }
680
+ )
681
+ );
851
682
  }
852
683
  };
853
684
  var scheduleUpdate = (hostRef, isInitialLoad) => {
@@ -1000,15 +831,40 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1000
831
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
1001
832
  members.map(([memberName, [memberFlags]]) => {
1002
833
  if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
834
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
835
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
836
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
837
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
838
+ Object.defineProperty(prototype, memberName, {
839
+ get() {
840
+ {
841
+ return origGetter ? origGetter.apply(this) : getValue(this, memberName);
842
+ }
843
+ },
844
+ configurable: true,
845
+ enumerable: true
846
+ });
847
+ }
1003
848
  Object.defineProperty(prototype, memberName, {
1004
- get() {
1005
- return getValue(this, memberName);
1006
- },
1007
849
  set(newValue) {
1008
- setValue(this, memberName, newValue, cmpMeta);
1009
- },
1010
- configurable: true,
1011
- enumerable: true
850
+ const ref = getHostRef(this);
851
+ if (origSetter) {
852
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
853
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
854
+ newValue = ref.$instanceValues$.get(memberName);
855
+ } else if (!ref.$instanceValues$.get(memberName) && currentValue) {
856
+ ref.$instanceValues$.set(memberName, currentValue);
857
+ }
858
+ origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
859
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
860
+ setValue(this, memberName, newValue, cmpMeta);
861
+ return;
862
+ }
863
+ {
864
+ setValue(this, memberName, newValue, cmpMeta);
865
+ return;
866
+ }
867
+ }
1012
868
  });
1013
869
  }
1014
870
  });
@@ -1018,7 +874,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1018
874
  plt.jmp(() => {
1019
875
  var _a2;
1020
876
  const propName = attrNameToPropName.get(attrName);
1021
- if (this.hasOwnProperty(propName)) {
877
+ if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
1022
878
  newValue = this[propName];
1023
879
  delete this[propName];
1024
880
  } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
@@ -1039,7 +895,11 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1039
895
  }
1040
896
  return;
1041
897
  }
1042
- this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
898
+ const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
899
+ newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
900
+ if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
901
+ this[propName] = newValue;
902
+ }
1043
903
  });
1044
904
  };
1045
905
  Cstr.observedAttributes = Array.from(
@@ -1088,7 +948,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1088
948
  schedule();
1089
949
  }
1090
950
  };
1091
- var fireConnectedCallback = (instance) => {
951
+ var fireConnectedCallback = (instance, elm) => {
1092
952
  };
1093
953
 
1094
954
  // src/runtime/connected-callback.ts
@@ -1099,12 +959,6 @@ var connectedCallback = (elm) => {
1099
959
  const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1100
960
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1101
961
  hostRef.$flags$ |= 1 /* hasConnected */;
1102
- {
1103
- if (// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
1104
- cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
1105
- setContentReference(elm);
1106
- }
1107
- }
1108
962
  {
1109
963
  let ancestorComponent = elm;
1110
964
  while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
@@ -1134,17 +988,16 @@ var connectedCallback = (elm) => {
1134
988
  endConnected();
1135
989
  }
1136
990
  };
1137
- var setContentReference = (elm) => {
1138
- const contentRefElm = elm["s-cr"] = doc.createComment(
1139
- ""
1140
- );
1141
- contentRefElm["s-cn"] = true;
1142
- insertBefore(elm, contentRefElm, elm.firstChild);
1143
- };
1144
991
  var disconnectedCallback = async (elm) => {
1145
992
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1146
993
  getHostRef(elm);
1147
994
  }
995
+ if (rootAppliedStyles.has(elm)) {
996
+ rootAppliedStyles.delete(elm);
997
+ }
998
+ if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
999
+ rootAppliedStyles.delete(elm.shadowRoot);
1000
+ }
1148
1001
  };
1149
1002
  var proxyCustomElement = (Cstr, compactMeta) => {
1150
1003
  const cmpMeta = {
@@ -1154,29 +1007,49 @@ var proxyCustomElement = (Cstr, compactMeta) => {
1154
1007
  {
1155
1008
  cmpMeta.$members$ = compactMeta[2];
1156
1009
  }
1157
- let hasHostListenerAttached = false;
1158
1010
  Object.assign(Cstr.prototype, {
1011
+ __hasHostListenerAttached: false,
1159
1012
  __registerHost() {
1160
1013
  registerHost(this, cmpMeta);
1161
1014
  },
1162
1015
  connectedCallback() {
1163
- if (!hasHostListenerAttached) {
1016
+ if (!this.__hasHostListenerAttached) {
1164
1017
  getHostRef(this);
1165
- hasHostListenerAttached = true;
1018
+ this.__hasHostListenerAttached = true;
1166
1019
  }
1167
1020
  connectedCallback(this);
1168
1021
  },
1169
1022
  disconnectedCallback() {
1170
1023
  disconnectedCallback(this);
1024
+ plt.raf(() => {
1025
+ var _a;
1026
+ const hostRef = getHostRef(this);
1027
+ if (((_a = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
1028
+ delete hostRef.$vnode$;
1029
+ }
1030
+ if (this instanceof Node && !this.isConnected) {
1031
+ deleteHostRef(this);
1032
+ }
1033
+ });
1171
1034
  },
1172
1035
  __attachShadow() {
1173
1036
  {
1174
- this.shadowRoot = this;
1037
+ if (!this.shadowRoot) {
1038
+ {
1039
+ this.attachShadow({ mode: "open" });
1040
+ }
1041
+ } else {
1042
+ if (this.shadowRoot.mode !== "open") {
1043
+ throw new Error(
1044
+ `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`
1045
+ );
1046
+ }
1047
+ }
1175
1048
  }
1176
1049
  }
1177
1050
  });
1178
1051
  Cstr.is = cmpMeta.$tagName$;
1179
- return proxyComponent(Cstr, cmpMeta);
1052
+ return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
1180
1053
  };
1181
1054
 
1182
1055
  // src/runtime/nonce.ts
@@ -1185,6 +1058,6 @@ var setNonce = (nonce) => plt.$nonce$ = nonce;
1185
1058
  // src/runtime/platform-options.ts
1186
1059
  var setPlatformOptions = (opts) => Object.assign(plt, opts);
1187
1060
 
1188
- export { H, setNonce as a, setPlatformOptions as b, getAssetPath as g, h, proxyCustomElement as p, setAssetPath as s };
1061
+ export { H, setNonce as a, setPlatformOptions as b, createEvent as c, getAssetPath as g, h, proxyCustomElement as p, setAssetPath as s };
1189
1062
 
1190
- //# sourceMappingURL=p-9678c037.js.map
1063
+ //# sourceMappingURL=p-913b636c.js.map