@atmgrupomaggioli/iris-button 0.0.2 → 0.2.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-f882627f.js → index-f786c569.js} +391 -539
  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 +153 -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-f7558cea.js → p-913b636c.js} +341 -509
  16. package/dist/components/p-913b636c.js.map +1 -0
  17. package/dist/esm/{index-000f519f.js → index-45a8db1c.js} +391 -540
  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 +5 -8
  34. package/dist/cjs/index-f882627f.js.map +0 -1
  35. package/dist/components/p-f7558cea.js.map +0 -1
  36. package/dist/esm/index-000f519f.js.map +0 -1
  37. package/dist/iris-button/p-a8ef57f6.entry.js +0 -2
  38. package/dist/iris-button/p-a8ef57f6.entry.js.map +0 -1
  39. package/dist/iris-button/p-c58bb129.js +0 -3
  40. package/dist/iris-button/p-c58bb129.js.map +0 -1
@@ -1,17 +1,25 @@
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", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, 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, transformTagName: false, 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", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, 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, transformTagName: false, 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.23.0 | 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();
13
19
  var getHostRef = (ref) => hostRefs.get(ref);
14
- var registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
20
+ var registerInstance = (lazyInstance, hostRef) => {
21
+ hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
22
+ };
15
23
  var registerHost = (hostElement, cmpMeta) => {
16
24
  const hostRef = {
17
25
  $flags$: 0,
@@ -24,8 +32,10 @@ var registerHost = (hostElement, cmpMeta) => {
24
32
  hostElement["s-p"] = [];
25
33
  hostElement["s-rc"] = [];
26
34
  }
27
- return hostRefs.set(hostElement, hostRef);
35
+ const ref = hostRefs.set(hostElement, hostRef);
36
+ return ref;
28
37
  };
38
+ var isMemberInElement = (elm, memberName) => memberName in elm;
29
39
  var consoleError = (e, el) => (0, console.error)(e, el);
30
40
 
31
41
  // src/client/client-load-module.ts
@@ -47,16 +57,22 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
47
57
  /* webpackExclude: /\.system\.entry\.js$/ */
48
58
  /* webpackMode: "lazy" */
49
59
  `./${bundleId}.entry.js${""}`
50
- ).then((importedModule) => {
51
- {
52
- cmpModules.set(bundleId, importedModule);
60
+ ).then(
61
+ (importedModule) => {
62
+ {
63
+ cmpModules.set(bundleId, importedModule);
64
+ }
65
+ return importedModule[exportName];
66
+ },
67
+ (e) => {
68
+ consoleError(e, hostRef.$hostElement$);
53
69
  }
54
- return importedModule[exportName];
55
- }, consoleError);
70
+ );
56
71
  };
57
72
 
58
73
  // src/client/client-style.ts
59
74
  var styles = /* @__PURE__ */ new Map();
75
+ var HYDRATED_STYLE_ID = "sty-id";
60
76
  var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
61
77
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
62
78
  var win = typeof window !== "undefined" ? window : {};
@@ -70,7 +86,6 @@ var plt = {
70
86
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
71
87
  ce: (eventName, opts) => new CustomEvent(eventName, opts)
72
88
  };
73
- var supportsShadow = BUILD.shadowDom;
74
89
  var promiseResolve = (v) => Promise.resolve(v);
75
90
  var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
76
91
  try {
@@ -115,12 +130,6 @@ var flush = () => {
115
130
  };
116
131
  var nextTick = (cb) => promiseResolve().then(cb);
117
132
  var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
118
-
119
- // src/utils/constants.ts
120
- var EMPTY_OBJ = {};
121
-
122
- // src/utils/helpers.ts
123
- var isDef = (v) => v != null;
124
133
  var isComplexType = (o) => {
125
134
  o = typeof o;
126
135
  return o === "object" || o === "function";
@@ -180,10 +189,22 @@ var unwrapErr = (result) => {
180
189
  throw result.value;
181
190
  }
182
191
  };
192
+ var createTime = (fnName, tagName = "") => {
193
+ {
194
+ return () => {
195
+ return;
196
+ };
197
+ }
198
+ };
199
+ var uniqueTime = (key, measureText) => {
200
+ {
201
+ return () => {
202
+ return;
203
+ };
204
+ }
205
+ };
183
206
  var h = (nodeName, vnodeData, ...children) => {
184
207
  let child = null;
185
- let key = null;
186
- let slotName = null;
187
208
  let simple = false;
188
209
  let lastSimple = false;
189
210
  const vNodeChildren = [];
@@ -207,12 +228,6 @@ var h = (nodeName, vnodeData, ...children) => {
207
228
  };
208
229
  walk(children);
209
230
  if (vnodeData) {
210
- if (vnodeData.key) {
211
- key = vnodeData.key;
212
- }
213
- if (vnodeData.name) {
214
- slotName = vnodeData.name;
215
- }
216
231
  {
217
232
  const classData = vnodeData.className || vnodeData.class;
218
233
  if (classData) {
@@ -225,12 +240,6 @@ var h = (nodeName, vnodeData, ...children) => {
225
240
  if (vNodeChildren.length > 0) {
226
241
  vnode.$children$ = vNodeChildren;
227
242
  }
228
- {
229
- vnode.$key$ = key;
230
- }
231
- {
232
- vnode.$name$ = slotName;
233
- }
234
243
  return vnode;
235
244
  };
236
245
  var newVNode = (tag, text) => {
@@ -244,48 +253,241 @@ var newVNode = (tag, text) => {
244
253
  {
245
254
  vnode.$attrs$ = null;
246
255
  }
247
- {
248
- vnode.$key$ = null;
249
- }
250
- {
251
- vnode.$name$ = null;
252
- }
253
256
  return vnode;
254
257
  };
255
258
  var Host = {};
256
259
  var isHost = (node) => node && node.$tag$ === Host;
257
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
260
+ var parsePropertyValue = (propValue, propType) => {
261
+ if (propValue != null && !isComplexType(propValue)) {
262
+ if (propType & 4 /* Boolean */) {
263
+ return propValue === "false" ? false : propValue === "" || !!propValue;
264
+ }
265
+ if (propType & 1 /* String */) {
266
+ return String(propValue);
267
+ }
268
+ return propValue;
269
+ }
270
+ return propValue;
271
+ };
272
+ var getElement = (ref) => getHostRef(ref).$hostElement$ ;
273
+
274
+ // src/runtime/event-emitter.ts
275
+ var createEvent = (ref, name, flags) => {
276
+ const elm = getElement(ref);
277
+ return {
278
+ emit: (detail) => {
279
+ return emitEvent(elm, name, {
280
+ bubbles: !!(flags & 4 /* Bubbles */),
281
+ composed: !!(flags & 2 /* Composed */),
282
+ cancelable: !!(flags & 1 /* Cancellable */),
283
+ detail
284
+ });
285
+ }
286
+ };
287
+ };
288
+ var emitEvent = (elm, name, opts) => {
289
+ const ev = plt.ce(name, opts);
290
+ elm.dispatchEvent(ev);
291
+ return ev;
292
+ };
293
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
294
+ var registerStyle = (scopeId2, cssText, allowCS) => {
295
+ let style = styles.get(scopeId2);
296
+ if (supportsConstructableStylesheets && allowCS) {
297
+ style = style || new CSSStyleSheet();
298
+ if (typeof style === "string") {
299
+ style = cssText;
300
+ } else {
301
+ style.replaceSync(cssText);
302
+ }
303
+ } else {
304
+ style = cssText;
305
+ }
306
+ styles.set(scopeId2, style);
307
+ };
308
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
309
+ var _a;
310
+ const scopeId2 = getScopeId(cmpMeta);
311
+ const style = styles.get(scopeId2);
312
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
313
+ if (style) {
314
+ if (typeof style === "string") {
315
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
316
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
317
+ let styleElm;
318
+ if (!appliedStyles) {
319
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
320
+ }
321
+ if (!appliedStyles.has(scopeId2)) {
322
+ {
323
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
324
+ styleElm.innerHTML = style;
325
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
326
+ if (nonce != null) {
327
+ styleElm.setAttribute("nonce", nonce);
328
+ }
329
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
330
+ if (styleContainerNode.nodeName === "HEAD") {
331
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
332
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
333
+ styleContainerNode.insertBefore(
334
+ styleElm,
335
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
336
+ );
337
+ } else if ("host" in styleContainerNode) {
338
+ if (supportsConstructableStylesheets) {
339
+ const stylesheet = new CSSStyleSheet();
340
+ stylesheet.replaceSync(style);
341
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
342
+ } else {
343
+ const existingStyleContainer = styleContainerNode.querySelector("style");
344
+ if (existingStyleContainer) {
345
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
346
+ } else {
347
+ styleContainerNode.prepend(styleElm);
348
+ }
349
+ }
350
+ } else {
351
+ styleContainerNode.append(styleElm);
352
+ }
353
+ }
354
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
355
+ styleContainerNode.insertBefore(styleElm, null);
356
+ }
357
+ }
358
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
359
+ styleElm.innerHTML += SLOT_FB_CSS;
360
+ }
361
+ if (appliedStyles) {
362
+ appliedStyles.add(scopeId2);
363
+ }
364
+ }
365
+ } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
366
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
367
+ }
368
+ }
369
+ return scopeId2;
370
+ };
371
+ var attachStyles = (hostRef) => {
372
+ const cmpMeta = hostRef.$cmpMeta$;
373
+ const elm = hostRef.$hostElement$;
374
+ const flags = cmpMeta.$flags$;
375
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
376
+ const scopeId2 = addStyle(
377
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
378
+ cmpMeta);
379
+ if (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
380
+ elm["s-sc"] = scopeId2;
381
+ elm.classList.add(scopeId2 + "-h");
382
+ }
383
+ endAttachStyles();
384
+ };
385
+ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
386
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
258
387
  if (oldValue !== newValue) {
259
- memberName.toLowerCase();
388
+ let isProp = isMemberInElement(elm, memberName);
389
+ let ln = memberName.toLowerCase();
260
390
  if (memberName === "class") {
261
391
  const classList = elm.classList;
262
392
  const oldClasses = parseClassList(oldValue);
263
- const newClasses = parseClassList(newValue);
264
- if (elm["s-si"] && newClasses.indexOf(elm["s-si"]) < 0) {
265
- newClasses.push(elm["s-si"]);
393
+ let newClasses = parseClassList(newValue);
394
+ {
395
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
396
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
397
+ }
398
+ } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
399
+ if (memberName[2] === "-") {
400
+ memberName = memberName.slice(3);
401
+ } else if (isMemberInElement(win, ln)) {
402
+ memberName = ln.slice(2);
403
+ } else {
404
+ memberName = ln[2] + memberName.slice(3);
405
+ }
406
+ if (oldValue || newValue) {
407
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
408
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
409
+ if (oldValue) {
410
+ plt.rel(elm, memberName, oldValue, capture);
411
+ }
412
+ if (newValue) {
413
+ plt.ael(elm, memberName, newValue, capture);
414
+ }
415
+ }
416
+ } else {
417
+ const isComplex = isComplexType(newValue);
418
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
419
+ try {
420
+ if (!elm.tagName.includes("-")) {
421
+ const n = newValue == null ? "" : newValue;
422
+ if (memberName === "list") {
423
+ isProp = false;
424
+ } else if (oldValue == null || elm[memberName] != n) {
425
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
426
+ elm[memberName] = n;
427
+ } else {
428
+ elm.setAttribute(memberName, n);
429
+ }
430
+ }
431
+ } else if (elm[memberName] !== newValue) {
432
+ elm[memberName] = newValue;
433
+ }
434
+ } catch (e) {
435
+ }
436
+ }
437
+ if (newValue == null || newValue === false) {
438
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
439
+ {
440
+ elm.removeAttribute(memberName);
441
+ }
442
+ }
443
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
444
+ newValue = newValue === true ? "" : newValue;
445
+ {
446
+ elm.setAttribute(memberName, newValue);
447
+ }
266
448
  }
267
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
268
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
269
449
  }
270
450
  }
271
451
  };
272
452
  var parseClassListRegex = /\s/;
273
- var parseClassList = (value) => !value ? [] : value.split(parseClassListRegex);
453
+ var parseClassList = (value) => {
454
+ if (typeof value === "object" && value && "baseVal" in value) {
455
+ value = value.baseVal;
456
+ }
457
+ if (!value || typeof value !== "string") {
458
+ return [];
459
+ }
460
+ return value.split(parseClassListRegex);
461
+ };
462
+ var CAPTURE_EVENT_SUFFIX = "Capture";
463
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
274
464
 
275
465
  // src/runtime/vdom/update-element.ts
276
- var updateElement = (oldVnode, newVnode, isSvgMode2) => {
466
+ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
277
467
  const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
278
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ;
279
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
468
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
469
+ const newVnodeAttrs = newVnode.$attrs$ || {};
280
470
  {
281
471
  for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
282
472
  if (!(memberName in newVnodeAttrs)) {
283
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0);
473
+ setAccessor(
474
+ elm,
475
+ memberName,
476
+ oldVnodeAttrs[memberName],
477
+ void 0,
478
+ isSvgMode2,
479
+ newVnode.$flags$);
284
480
  }
285
481
  }
286
482
  }
287
483
  for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
288
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName]);
484
+ setAccessor(
485
+ elm,
486
+ memberName,
487
+ oldVnodeAttrs[memberName],
488
+ newVnodeAttrs[memberName],
489
+ isSvgMode2,
490
+ newVnode.$flags$);
289
491
  }
290
492
  };
291
493
  function sortedAttrNames(attrNames) {
@@ -297,51 +499,29 @@ function sortedAttrNames(attrNames) {
297
499
  attrNames
298
500
  );
299
501
  }
300
-
301
- // src/runtime/vdom/vdom-render.ts
302
- var scopeId;
303
- var contentRef;
304
502
  var hostTagName;
305
503
  var useNativeShadowDom = false;
306
- var checkSlotFallbackVisibility = false;
307
- var checkSlotRelocate = false;
308
- var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
309
- var _a;
504
+ var isSvgMode = false;
505
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
310
506
  const newVNode2 = newParentVNode.$children$[childIndex];
311
507
  let i2 = 0;
312
508
  let elm;
313
509
  let childNode;
314
- let oldVNode;
315
- if (!useNativeShadowDom) {
316
- checkSlotRelocate = true;
317
- if (newVNode2.$tag$ === "slot") {
318
- newVNode2.$flags$ |= newVNode2.$children$ ? (
319
- // slot element has fallback content
320
- // still create an element that "mocks" the slot element
321
- 2 /* isSlotFallback */
322
- ) : (
323
- // slot element does not have fallback content
324
- // create an html comment we'll use to always reference
325
- // where actual slot content should sit next to
326
- 1 /* isSlotReference */
327
- );
328
- }
329
- }
330
510
  if (newVNode2.$text$ !== null) {
331
511
  elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
332
- } else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
333
- elm = newVNode2.$elm$ = doc.createTextNode("");
334
512
  } else {
335
- elm = newVNode2.$elm$ = doc.createElement(
513
+ if (!isSvgMode) {
514
+ isSvgMode = newVNode2.$tag$ === "svg";
515
+ }
516
+ elm = newVNode2.$elm$ = doc.createElementNS(
517
+ isSvgMode ? SVG_NS : HTML_NS,
336
518
  !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
337
- );
338
- {
339
- updateElement(null, newVNode2);
519
+ ) ;
520
+ if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
521
+ isSvgMode = false;
340
522
  }
341
- const rootNode = elm.getRootNode();
342
- const isElementWithinShadowRoot = !rootNode.querySelector("body");
343
- if (!isElementWithinShadowRoot && BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
344
- elm.classList.add(elm["s-si"] = scopeId);
523
+ {
524
+ updateElement(null, newVNode2, isSvgMode);
345
525
  }
346
526
  if (newVNode2.$children$) {
347
527
  for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
@@ -351,59 +531,29 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
351
531
  }
352
532
  }
353
533
  }
354
- }
355
- elm["s-hn"] = hostTagName;
356
- {
357
- if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
358
- elm["s-sr"] = true;
359
- elm["s-cr"] = contentRef;
360
- elm["s-sn"] = newVNode2.$name$ || "";
361
- elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
362
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
363
- if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
364
- {
365
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
366
- }
534
+ {
535
+ if (newVNode2.$tag$ === "svg") {
536
+ isSvgMode = false;
537
+ } else if (elm.tagName === "foreignObject") {
538
+ isSvgMode = true;
367
539
  }
368
540
  }
369
541
  }
542
+ elm["s-hn"] = hostTagName;
370
543
  return elm;
371
544
  };
372
- var putBackInOriginalLocation = (parentElm, recursive) => {
373
- plt.$flags$ |= 1 /* isTmpDisconnected */;
374
- const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
375
- if (parentElm["s-sr"] && BUILD.experimentalSlotFixes) {
376
- let node = parentElm;
377
- while (node = node.nextSibling) {
378
- if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
379
- oldSlotChildNodes.push(node);
380
- }
381
- }
382
- }
383
- for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
384
- const childNode = oldSlotChildNodes[i2];
385
- if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
386
- insertBefore(parentReferenceNode(childNode), childNode, referenceNode(childNode));
387
- childNode["s-ol"].remove();
388
- childNode["s-ol"] = void 0;
389
- childNode["s-sh"] = void 0;
390
- checkSlotRelocate = true;
391
- }
392
- if (recursive) {
393
- putBackInOriginalLocation(childNode, recursive);
394
- }
395
- }
396
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
397
- };
398
545
  var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
399
- let containerElm = parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
546
+ let containerElm = parentElm;
400
547
  let childNode;
548
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
549
+ containerElm = containerElm.shadowRoot;
550
+ }
401
551
  for (; startIdx <= endIdx; ++startIdx) {
402
552
  if (vnodes[startIdx]) {
403
553
  childNode = createElm(null, parentVNode, startIdx);
404
554
  if (childNode) {
405
555
  vnodes[startIdx].$elm$ = childNode;
406
- insertBefore(containerElm, childNode, referenceNode(before) );
556
+ insertBefore(containerElm, childNode, before);
407
557
  }
408
558
  }
409
559
  }
@@ -414,14 +564,6 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
414
564
  if (vnode) {
415
565
  const elm = vnode.$elm$;
416
566
  if (elm) {
417
- {
418
- checkSlotFallbackVisibility = true;
419
- if (elm["s-ol"]) {
420
- elm["s-ol"].remove();
421
- } else {
422
- putBackInOriginalLocation(elm, true);
423
- }
424
- }
425
567
  elm.remove();
426
568
  }
427
569
  }
@@ -430,8 +572,6 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
430
572
  var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
431
573
  let oldStartIdx = 0;
432
574
  let newStartIdx = 0;
433
- let idxInOld = 0;
434
- let i2 = 0;
435
575
  let oldEndIdx = oldCh.length - 1;
436
576
  let oldStartVnode = oldCh[0];
437
577
  let oldEndVnode = oldCh[oldEndIdx];
@@ -439,7 +579,6 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
439
579
  let newStartVnode = newCh[0];
440
580
  let newEndVnode = newCh[newEndIdx];
441
581
  let node;
442
- let elmToMove;
443
582
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
444
583
  if (oldStartVnode == null) {
445
584
  oldStartVnode = oldCh[++oldStartIdx];
@@ -458,48 +597,23 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
458
597
  oldEndVnode = oldCh[--oldEndIdx];
459
598
  newEndVnode = newCh[--newEndIdx];
460
599
  } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
461
- if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
462
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
463
- }
464
600
  patch(oldStartVnode, newEndVnode, isInitialRender);
465
601
  insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
466
602
  oldStartVnode = oldCh[++oldStartIdx];
467
603
  newEndVnode = newCh[--newEndIdx];
468
604
  } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
469
- if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
470
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
471
- }
472
605
  patch(oldEndVnode, newStartVnode, isInitialRender);
473
606
  insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
474
607
  oldEndVnode = oldCh[--oldEndIdx];
475
608
  newStartVnode = newCh[++newStartIdx];
476
609
  } else {
477
- idxInOld = -1;
478
610
  {
479
- for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
480
- if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
481
- idxInOld = i2;
482
- break;
483
- }
484
- }
485
- }
486
- if (idxInOld >= 0) {
487
- elmToMove = oldCh[idxInOld];
488
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
489
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
490
- } else {
491
- patch(elmToMove, newStartVnode, isInitialRender);
492
- oldCh[idxInOld] = void 0;
493
- node = elmToMove.$elm$;
494
- }
495
- newStartVnode = newCh[++newStartIdx];
496
- } else {
497
611
  node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
498
612
  newStartVnode = newCh[++newStartIdx];
499
613
  }
500
614
  if (node) {
501
615
  {
502
- insertBefore(parentReferenceNode(oldStartVnode.$elm$), node, referenceNode(oldStartVnode.$elm$));
616
+ insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
503
617
  }
504
618
  }
505
619
  }
@@ -519,40 +633,26 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
519
633
  };
520
634
  var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
521
635
  if (leftVNode.$tag$ === rightVNode.$tag$) {
522
- if (leftVNode.$tag$ === "slot") {
523
- if (
524
- // The component gets hydrated and no VDOM has been initialized.
525
- // Here the comparison can't happen as $name$ property is not set for `leftNode`.
526
- "$nodeId$" in leftVNode && isInitialRender && // `leftNode` is not from type HTMLComment which would cause many
527
- // hydration comments to be removed
528
- leftVNode.$elm$.nodeType !== 8
529
- ) {
530
- return false;
531
- }
532
- return leftVNode.$name$ === rightVNode.$name$;
533
- }
534
- if (!isInitialRender) {
535
- return leftVNode.$key$ === rightVNode.$key$;
636
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
637
+ leftVNode.$key$ = rightVNode.$key$;
536
638
  }
537
639
  return true;
538
640
  }
539
641
  return false;
540
642
  };
541
- var referenceNode = (node) => {
542
- return node && node["s-ol"] || node;
543
- };
544
- var parentReferenceNode = (node) => (node["s-ol"] ? node["s-ol"] : node).parentNode;
545
643
  var patch = (oldVNode, newVNode2, isInitialRender = false) => {
546
644
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
547
645
  const oldChildren = oldVNode.$children$;
548
646
  const newChildren = newVNode2.$children$;
549
647
  const tag = newVNode2.$tag$;
550
648
  const text = newVNode2.$text$;
551
- let defaultHolder;
552
649
  if (text === null) {
553
650
  {
554
- if (tag === "slot" && !useNativeShadowDom) ; else {
555
- updateElement(oldVNode, newVNode2);
651
+ isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
652
+ }
653
+ {
654
+ {
655
+ updateElement(oldVNode, newVNode2, isSvgMode);
556
656
  }
557
657
  }
558
658
  if (oldChildren !== null && newChildren !== null) {
@@ -568,111 +668,21 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
568
668
  ) {
569
669
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
570
670
  }
571
- } else if ((defaultHolder = elm["s-cr"])) {
572
- defaultHolder.parentNode.textContent = text;
671
+ if (isSvgMode && tag === "svg") {
672
+ isSvgMode = false;
673
+ }
573
674
  } else if (oldVNode.$text$ !== text) {
574
675
  elm.data = text;
575
676
  }
576
677
  };
577
- var updateFallbackSlotVisibility = (elm) => {
578
- const childNodes = elm.__childNodes || elm.childNodes;
579
- for (const childNode of childNodes) {
580
- if (childNode.nodeType === 1 /* ElementNode */) {
581
- if (childNode["s-sr"]) {
582
- const slotName = childNode["s-sn"];
583
- childNode.hidden = false;
584
- for (const siblingNode of childNodes) {
585
- if (siblingNode !== childNode) {
586
- if (siblingNode["s-hn"] !== childNode["s-hn"] || slotName !== "") {
587
- if (siblingNode.nodeType === 1 /* ElementNode */ && (slotName === siblingNode.getAttribute("slot") || slotName === siblingNode["s-sn"]) || siblingNode.nodeType === 3 /* TextNode */ && slotName === siblingNode["s-sn"]) {
588
- childNode.hidden = true;
589
- break;
590
- }
591
- } else if (slotName === siblingNode["s-sn"]) {
592
- if (siblingNode.nodeType === 1 /* ElementNode */ || siblingNode.nodeType === 3 /* TextNode */ && siblingNode.textContent.trim() !== "") {
593
- childNode.hidden = true;
594
- break;
595
- }
596
- }
597
- }
598
- }
599
- }
600
- updateFallbackSlotVisibility(childNode);
601
- }
602
- }
603
- };
604
- var relocateNodes = [];
605
- var markSlotContentForRelocation = (elm) => {
606
- let node;
607
- let hostContentNodes;
608
- let j;
609
- const children = elm.__childNodes || elm.childNodes;
610
- for (const childNode of children) {
611
- if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
612
- hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
613
- const slotName = childNode["s-sn"];
614
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
615
- node = hostContentNodes[j];
616
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD.experimentalSlotFixes )) {
617
- if (isNodeLocatedInSlot(node, slotName)) {
618
- let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
619
- checkSlotFallbackVisibility = true;
620
- node["s-sn"] = node["s-sn"] || slotName;
621
- if (relocateNodeData) {
622
- relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
623
- relocateNodeData.$slotRefNode$ = childNode;
624
- } else {
625
- node["s-sh"] = childNode["s-hn"];
626
- relocateNodes.push({
627
- $slotRefNode$: childNode,
628
- $nodeToRelocate$: node
629
- });
630
- }
631
- if (node["s-sr"]) {
632
- relocateNodes.map((relocateNode) => {
633
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
634
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
635
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
636
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
637
- }
638
- }
639
- });
640
- }
641
- } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
642
- relocateNodes.push({
643
- $nodeToRelocate$: node
644
- });
645
- }
646
- }
647
- }
648
- }
649
- if (childNode.nodeType === 1 /* ElementNode */) {
650
- markSlotContentForRelocation(childNode);
651
- }
652
- }
653
- };
654
- var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
655
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
656
- if (nodeToRelocate.getAttribute("slot") === null && slotName === "") {
657
- return true;
658
- }
659
- if (nodeToRelocate.getAttribute("slot") === slotName) {
660
- return true;
661
- }
662
- return false;
663
- }
664
- if (nodeToRelocate["s-sn"] === slotName) {
665
- return true;
666
- }
667
- return slotName === "";
668
- };
669
678
  var insertBefore = (parent, newNode, reference) => {
670
- const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
671
- return inserted;
679
+ {
680
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
681
+ }
672
682
  };
673
683
  var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
674
- var _a, _b, _c, _d;
675
684
  const hostElm = hostRef.$hostElement$;
685
+ const cmpMeta = hostRef.$cmpMeta$;
676
686
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
677
687
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
678
688
  hostTagName = hostElm.tagName;
@@ -686,199 +696,22 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
686
696
  rootVnode.$tag$ = null;
687
697
  rootVnode.$flags$ |= 4 /* isHost */;
688
698
  hostRef.$vnode$ = rootVnode;
689
- rootVnode.$elm$ = oldVNode.$elm$ = hostElm;
690
- useNativeShadowDom = supportsShadow ;
691
- {
692
- contentRef = hostElm["s-cr"];
693
- checkSlotFallbackVisibility = false;
694
- }
699
+ rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
700
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
695
701
  patch(oldVNode, rootVnode, isInitialLoad);
696
- {
697
- plt.$flags$ |= 1 /* isTmpDisconnected */;
698
- if (checkSlotRelocate) {
699
- markSlotContentForRelocation(rootVnode.$elm$);
700
- for (const relocateData of relocateNodes) {
701
- const nodeToRelocate = relocateData.$nodeToRelocate$;
702
- if (!nodeToRelocate["s-ol"]) {
703
- const orgLocationNode = doc.createTextNode("");
704
- orgLocationNode["s-nr"] = nodeToRelocate;
705
- insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
706
- }
707
- }
708
- for (const relocateData of relocateNodes) {
709
- const nodeToRelocate = relocateData.$nodeToRelocate$;
710
- const slotRefNode = relocateData.$slotRefNode$;
711
- if (slotRefNode) {
712
- const parentNodeRef = slotRefNode.parentNode;
713
- let insertBeforeNode = slotRefNode.nextSibling;
714
- {
715
- let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
716
- while (orgLocationNode) {
717
- let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
718
- if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === refNode.parentNode) {
719
- refNode = refNode.nextSibling;
720
- while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
721
- refNode = refNode == null ? void 0 : refNode.nextSibling;
722
- }
723
- if (!refNode || !refNode["s-nr"]) {
724
- insertBeforeNode = refNode;
725
- break;
726
- }
727
- }
728
- orgLocationNode = orgLocationNode.previousSibling;
729
- }
730
- }
731
- if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
732
- if (nodeToRelocate !== insertBeforeNode) {
733
- if (!nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
734
- nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
735
- }
736
- insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
737
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
738
- nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
739
- }
740
- }
741
- }
742
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
743
- } else {
744
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
745
- if (isInitialLoad) {
746
- nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
747
- }
748
- nodeToRelocate.hidden = true;
749
- }
750
- }
751
- }
752
- }
753
- if (checkSlotFallbackVisibility) {
754
- updateFallbackSlotVisibility(rootVnode.$elm$);
755
- }
756
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
757
- relocateNodes.length = 0;
758
- }
759
- contentRef = void 0;
760
702
  };
761
- var createTime = (fnName, tagName = "") => {
762
- {
763
- return () => {
764
- return;
765
- };
766
- }
767
- };
768
- var uniqueTime = (key, measureText) => {
769
- {
770
- return () => {
771
- return;
772
- };
773
- }
774
- };
775
- var parsePropertyValue = (propValue, propType) => {
776
- if (propValue != null && !isComplexType(propValue)) {
777
- if (propType & 4 /* Boolean */) {
778
- return propValue === "false" ? false : propValue === "" || !!propValue;
779
- }
780
- if (propType & 1 /* String */) {
781
- return String(propValue);
782
- }
783
- return propValue;
784
- }
785
- return propValue;
786
- };
787
- var emitEvent = (elm, name, opts) => {
788
- const ev = plt.ce(name, opts);
789
- elm.dispatchEvent(ev);
790
- return ev;
791
- };
792
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
793
- var registerStyle = (scopeId2, cssText, allowCS) => {
794
- let style = styles.get(scopeId2);
795
- if (supportsConstructableStylesheets && allowCS) {
796
- style = style || new CSSStyleSheet();
797
- if (typeof style === "string") {
798
- style = cssText;
799
- } else {
800
- style.replaceSync(cssText);
801
- }
802
- } else {
803
- style = cssText;
804
- }
805
- styles.set(scopeId2, style);
806
- };
807
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
808
- var _a;
809
- const scopeId2 = getScopeId(cmpMeta);
810
- const style = styles.get(scopeId2);
811
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
812
- if (style) {
813
- if (typeof style === "string") {
814
- styleContainerNode = styleContainerNode.head || styleContainerNode;
815
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
816
- let styleElm;
817
- if (!appliedStyles) {
818
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
819
- }
820
- if (!appliedStyles.has(scopeId2)) {
821
- {
822
- styleElm = doc.createElement("style");
823
- styleElm.innerHTML = style;
824
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
825
- if (nonce != null) {
826
- styleElm.setAttribute("nonce", nonce);
827
- }
828
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
829
- if (styleContainerNode.nodeName === "HEAD") {
830
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
831
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
832
- styleContainerNode.insertBefore(styleElm, referenceNode2);
833
- } else if ("host" in styleContainerNode) {
834
- if (supportsConstructableStylesheets) {
835
- const stylesheet = new CSSStyleSheet();
836
- stylesheet.replaceSync(style);
837
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
838
- } else {
839
- const existingStyleContainer = styleContainerNode.querySelector("style");
840
- if (existingStyleContainer) {
841
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
842
- } else {
843
- styleContainerNode.prepend(styleElm);
844
- }
845
- }
846
- } else {
847
- styleContainerNode.append(styleElm);
848
- }
849
- }
850
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
851
- styleContainerNode.insertBefore(styleElm, null);
852
- }
853
- }
854
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
855
- styleElm.innerHTML += SLOT_FB_CSS;
856
- }
857
- if (appliedStyles) {
858
- appliedStyles.add(scopeId2);
859
- }
860
- }
861
- } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
862
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
863
- }
864
- }
865
- return scopeId2;
866
- };
867
- var attachStyles = (hostRef) => {
868
- const cmpMeta = hostRef.$cmpMeta$;
869
- const elm = hostRef.$hostElement$;
870
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
871
- addStyle(
872
- elm.getRootNode(),
873
- cmpMeta);
874
- endAttachStyles();
875
- };
876
- var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
877
703
 
878
704
  // src/runtime/update-component.ts
879
705
  var attachToAncestor = (hostRef, ancestorComponent) => {
880
706
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
881
- ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
707
+ const index = ancestorComponent["s-p"].push(
708
+ new Promise(
709
+ (r) => hostRef.$onRenderResolve$ = () => {
710
+ ancestorComponent["s-p"].splice(index - 1, 1);
711
+ r();
712
+ }
713
+ )
714
+ );
882
715
  }
883
716
  };
884
717
  var scheduleUpdate = (hostRef, isInitialLoad) => {
@@ -1037,62 +870,69 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1037
870
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
1038
871
  members.map(([memberName, [memberFlags]]) => {
1039
872
  if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
1040
- if ((memberFlags & 2048 /* Getter */) === 0) {
873
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
874
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
875
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
876
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
1041
877
  Object.defineProperty(prototype, memberName, {
1042
878
  get() {
1043
- return getValue(this, memberName);
1044
- },
1045
- set(newValue) {
1046
- setValue(this, memberName, newValue, cmpMeta);
1047
- },
1048
- configurable: true,
1049
- enumerable: true
1050
- });
1051
- } else if (flags & 1 /* isElementConstructor */ && memberFlags & 2048 /* Getter */) {
1052
- {
1053
- Object.defineProperty(prototype, memberName, {
1054
- get() {
879
+ {
880
+ if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
881
+ return getValue(this, memberName);
882
+ }
1055
883
  const ref = getHostRef(this);
1056
884
  const instance = ref ? ref.$lazyInstance$ : prototype;
1057
885
  if (!instance) return;
1058
886
  return instance[memberName];
1059
- },
1060
- configurable: true,
1061
- enumerable: true
1062
- });
1063
- }
1064
- if (memberFlags & 4096 /* Setter */) {
1065
- const origSetter = Object.getOwnPropertyDescriptor(prototype, memberName).set;
1066
- Object.defineProperty(prototype, memberName, {
1067
- set(newValue) {
1068
- const ref = getHostRef(this);
1069
- if (origSetter) {
1070
- const currentValue = ref.$hostElement$[memberName];
1071
- if (!ref.$instanceValues$.get(memberName) && currentValue) {
1072
- ref.$instanceValues$.set(memberName, currentValue);
1073
- }
1074
- origSetter.apply(this, [parsePropertyValue(newValue, cmpMeta.$members$[memberName][0])]);
1075
- setValue(this, memberName, ref.$hostElement$[memberName], cmpMeta);
1076
- return;
887
+ }
888
+ },
889
+ configurable: true,
890
+ enumerable: true
891
+ });
892
+ }
893
+ Object.defineProperty(prototype, memberName, {
894
+ set(newValue) {
895
+ const ref = getHostRef(this);
896
+ if (origSetter) {
897
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
898
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
899
+ newValue = ref.$instanceValues$.get(memberName);
900
+ } else if (!ref.$instanceValues$.get(memberName) && currentValue) {
901
+ ref.$instanceValues$.set(memberName, currentValue);
902
+ }
903
+ origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
904
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
905
+ setValue(this, memberName, newValue, cmpMeta);
906
+ return;
907
+ }
908
+ {
909
+ if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
910
+ setValue(this, memberName, newValue, cmpMeta);
911
+ if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
912
+ ref.$onReadyPromise$.then(() => {
913
+ if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
914
+ ref.$lazyInstance$[memberName] = newValue;
915
+ }
916
+ });
1077
917
  }
1078
- if (!ref) return;
1079
- const setterSetVal = () => {
1080
- const currentValue = ref.$lazyInstance$[memberName];
1081
- if (!ref.$instanceValues$.get(memberName) && currentValue) {
1082
- ref.$instanceValues$.set(memberName, currentValue);
1083
- }
1084
- ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, cmpMeta.$members$[memberName][0]);
1085
- setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
1086
- };
1087
- if (ref.$lazyInstance$) {
1088
- setterSetVal();
1089
- } else {
1090
- ref.$onReadyPromise$.then(() => setterSetVal());
918
+ return;
919
+ }
920
+ const setterSetVal = () => {
921
+ const currentValue = ref.$lazyInstance$[memberName];
922
+ if (!ref.$instanceValues$.get(memberName) && currentValue) {
923
+ ref.$instanceValues$.set(memberName, currentValue);
1091
924
  }
925
+ ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags);
926
+ setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
927
+ };
928
+ if (ref.$lazyInstance$) {
929
+ setterSetVal();
930
+ } else {
931
+ ref.$onReadyPromise$.then(() => setterSetVal());
1092
932
  }
1093
- });
933
+ }
1094
934
  }
1095
- }
935
+ });
1096
936
  }
1097
937
  });
1098
938
  if ((flags & 1 /* isElementConstructor */)) {
@@ -1101,7 +941,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1101
941
  plt.jmp(() => {
1102
942
  var _a2;
1103
943
  const propName = attrNameToPropName.get(attrName);
1104
- if (this.hasOwnProperty(propName)) {
944
+ if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
1105
945
  newValue = this[propName];
1106
946
  delete this[propName];
1107
947
  } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
@@ -1122,8 +962,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1122
962
  return;
1123
963
  }
1124
964
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
1125
- if (!propDesc.get || !!propDesc.set) {
1126
- this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
965
+ newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
966
+ if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
967
+ this[propName] = newValue;
1127
968
  }
1128
969
  });
1129
970
  };
@@ -1147,9 +988,8 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1147
988
  let Cstr;
1148
989
  if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1149
990
  hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1150
- const bundleId = cmpMeta.$lazyBundleId$;
1151
- if (bundleId) {
1152
- const CstrImport = loadModule(cmpMeta);
991
+ {
992
+ const CstrImport = loadModule(cmpMeta, hostRef);
1153
993
  if (CstrImport && "then" in CstrImport) {
1154
994
  const endLoad = uniqueTime();
1155
995
  Cstr = await CstrImport;
@@ -1171,16 +1011,12 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1171
1011
  try {
1172
1012
  new Cstr(hostRef);
1173
1013
  } catch (e) {
1174
- consoleError(e);
1014
+ consoleError(e, elm);
1175
1015
  }
1176
1016
  {
1177
1017
  hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1178
1018
  }
1179
1019
  endNewInstance();
1180
- } else {
1181
- Cstr = elm.constructor;
1182
- const cmpTag = elm.localName;
1183
- customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
1184
1020
  }
1185
1021
  if (Cstr && Cstr.style) {
1186
1022
  let style;
@@ -1203,7 +1039,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1203
1039
  schedule();
1204
1040
  }
1205
1041
  };
1206
- var fireConnectedCallback = (instance) => {
1042
+ var fireConnectedCallback = (instance, elm) => {
1207
1043
  };
1208
1044
 
1209
1045
  // src/runtime/connected-callback.ts
@@ -1214,12 +1050,6 @@ var connectedCallback = (elm) => {
1214
1050
  const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1215
1051
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1216
1052
  hostRef.$flags$ |= 1 /* hasConnected */;
1217
- {
1218
- if (// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
1219
- cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
1220
- setContentReference(elm);
1221
- }
1222
- }
1223
1053
  {
1224
1054
  let ancestorComponent = elm;
1225
1055
  while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
@@ -1249,14 +1079,7 @@ var connectedCallback = (elm) => {
1249
1079
  endConnected();
1250
1080
  }
1251
1081
  };
1252
- var setContentReference = (elm) => {
1253
- const contentRefElm = elm["s-cr"] = doc.createComment(
1254
- ""
1255
- );
1256
- contentRefElm["s-cn"] = true;
1257
- insertBefore(elm, contentRefElm, elm.firstChild);
1258
- };
1259
- var disconnectInstance = (instance) => {
1082
+ var disconnectInstance = (instance, elm) => {
1260
1083
  };
1261
1084
  var disconnectedCallback = async (elm) => {
1262
1085
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
@@ -1265,6 +1088,12 @@ var disconnectedCallback = async (elm) => {
1265
1088
  hostRef.$onReadyPromise$.then(() => disconnectInstance());
1266
1089
  }
1267
1090
  }
1091
+ if (rootAppliedStyles.has(elm)) {
1092
+ rootAppliedStyles.delete(elm);
1093
+ }
1094
+ if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
1095
+ rootAppliedStyles.delete(elm.shadowRoot);
1096
+ }
1268
1097
  };
1269
1098
 
1270
1099
  // src/runtime/bootstrap-lazy.ts
@@ -1305,6 +1134,21 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1305
1134
  this.hasRegisteredEventListeners = false;
1306
1135
  self = this;
1307
1136
  registerHost(self, cmpMeta);
1137
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1138
+ {
1139
+ if (!self.shadowRoot) {
1140
+ {
1141
+ self.attachShadow({ mode: "open" });
1142
+ }
1143
+ } else {
1144
+ if (self.shadowRoot.mode !== "open") {
1145
+ throw new Error(
1146
+ `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${self.shadowRoot.mode} but Stencil only supports open shadow roots.`
1147
+ );
1148
+ }
1149
+ }
1150
+ }
1151
+ }
1308
1152
  }
1309
1153
  connectedCallback() {
1310
1154
  getHostRef(this);
@@ -1323,6 +1167,13 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1323
1167
  }
1324
1168
  disconnectedCallback() {
1325
1169
  plt.jmp(() => disconnectedCallback(this));
1170
+ plt.raf(() => {
1171
+ var _a3;
1172
+ const hostRef = getHostRef(this);
1173
+ if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
1174
+ delete hostRef.$vnode$.$elm$;
1175
+ }
1176
+ });
1326
1177
  }
1327
1178
  componentOnReady() {
1328
1179
  return getHostRef(this).$onReadyPromise$;
@@ -1368,6 +1219,6 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1368
1219
  // src/runtime/nonce.ts
1369
1220
  var setNonce = (nonce) => plt.$nonce$ = nonce;
1370
1221
 
1371
- export { bootstrapLazy as b, h, promiseResolve as p, registerInstance as r, setNonce as s };
1222
+ export { bootstrapLazy as b, createEvent as c, h, promiseResolve as p, registerInstance as r, setNonce as s };
1372
1223
 
1373
- //# sourceMappingURL=index-000f519f.js.map
1224
+ //# sourceMappingURL=index-45a8db1c.js.map