@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
@@ -21,19 +21,27 @@ function _interopNamespace(e) {
21
21
  }
22
22
 
23
23
  const NAMESPACE = 'iris-button';
24
- 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 };
24
+ 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 };
25
25
 
26
26
  /*
27
- Stencil Client Platform v4.23.0 | MIT Licensed | https://stenciljs.com
27
+ Stencil Client Platform v4.25.1 | MIT Licensed | https://stenciljs.com
28
28
  */
29
29
  var __defProp = Object.defineProperty;
30
30
  var __export = (target, all) => {
31
31
  for (var name in all)
32
32
  __defProp(target, name, { get: all[name], enumerable: true });
33
33
  };
34
+
35
+ // src/utils/constants.ts
36
+ var SVG_NS = "http://www.w3.org/2000/svg";
37
+ var HTML_NS = "http://www.w3.org/1999/xhtml";
38
+
39
+ // src/client/client-host-ref.ts
34
40
  var hostRefs = /* @__PURE__ */ new WeakMap();
35
41
  var getHostRef = (ref) => hostRefs.get(ref);
36
- var registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
42
+ var registerInstance = (lazyInstance, hostRef) => {
43
+ hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
44
+ };
37
45
  var registerHost = (hostElement, cmpMeta) => {
38
46
  const hostRef = {
39
47
  $flags$: 0,
@@ -46,8 +54,10 @@ var registerHost = (hostElement, cmpMeta) => {
46
54
  hostElement["s-p"] = [];
47
55
  hostElement["s-rc"] = [];
48
56
  }
49
- return hostRefs.set(hostElement, hostRef);
57
+ const ref = hostRefs.set(hostElement, hostRef);
58
+ return ref;
50
59
  };
60
+ var isMemberInElement = (elm, memberName) => memberName in elm;
51
61
  var consoleError = (e, el) => (0, console.error)(e, el);
52
62
 
53
63
  // src/client/client-load-module.ts
@@ -69,16 +79,22 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
69
79
  /* webpackExclude: /\.system\.entry\.js$/ */
70
80
  /* webpackMode: "lazy" */
71
81
  `./${bundleId}.entry.js${""}`
72
- )); }).then((importedModule) => {
73
- {
74
- cmpModules.set(bundleId, importedModule);
82
+ )); }).then(
83
+ (importedModule) => {
84
+ {
85
+ cmpModules.set(bundleId, importedModule);
86
+ }
87
+ return importedModule[exportName];
88
+ },
89
+ (e) => {
90
+ consoleError(e, hostRef.$hostElement$);
75
91
  }
76
- return importedModule[exportName];
77
- }, consoleError);
92
+ );
78
93
  };
79
94
 
80
95
  // src/client/client-style.ts
81
96
  var styles = /* @__PURE__ */ new Map();
97
+ var HYDRATED_STYLE_ID = "sty-id";
82
98
  var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
83
99
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
84
100
  var win = typeof window !== "undefined" ? window : {};
@@ -92,7 +108,6 @@ var plt = {
92
108
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
93
109
  ce: (eventName, opts) => new CustomEvent(eventName, opts)
94
110
  };
95
- var supportsShadow = BUILD.shadowDom;
96
111
  var promiseResolve = (v) => Promise.resolve(v);
97
112
  var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
98
113
  try {
@@ -137,12 +152,6 @@ var flush = () => {
137
152
  };
138
153
  var nextTick = (cb) => promiseResolve().then(cb);
139
154
  var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
140
-
141
- // src/utils/constants.ts
142
- var EMPTY_OBJ = {};
143
-
144
- // src/utils/helpers.ts
145
- var isDef = (v) => v != null;
146
155
  var isComplexType = (o) => {
147
156
  o = typeof o;
148
157
  return o === "object" || o === "function";
@@ -202,10 +211,22 @@ var unwrapErr = (result) => {
202
211
  throw result.value;
203
212
  }
204
213
  };
214
+ var createTime = (fnName, tagName = "") => {
215
+ {
216
+ return () => {
217
+ return;
218
+ };
219
+ }
220
+ };
221
+ var uniqueTime = (key, measureText) => {
222
+ {
223
+ return () => {
224
+ return;
225
+ };
226
+ }
227
+ };
205
228
  var h = (nodeName, vnodeData, ...children) => {
206
229
  let child = null;
207
- let key = null;
208
- let slotName = null;
209
230
  let simple = false;
210
231
  let lastSimple = false;
211
232
  const vNodeChildren = [];
@@ -229,12 +250,6 @@ var h = (nodeName, vnodeData, ...children) => {
229
250
  };
230
251
  walk(children);
231
252
  if (vnodeData) {
232
- if (vnodeData.key) {
233
- key = vnodeData.key;
234
- }
235
- if (vnodeData.name) {
236
- slotName = vnodeData.name;
237
- }
238
253
  {
239
254
  const classData = vnodeData.className || vnodeData.class;
240
255
  if (classData) {
@@ -247,12 +262,6 @@ var h = (nodeName, vnodeData, ...children) => {
247
262
  if (vNodeChildren.length > 0) {
248
263
  vnode.$children$ = vNodeChildren;
249
264
  }
250
- {
251
- vnode.$key$ = key;
252
- }
253
- {
254
- vnode.$name$ = slotName;
255
- }
256
265
  return vnode;
257
266
  };
258
267
  var newVNode = (tag, text) => {
@@ -266,48 +275,241 @@ var newVNode = (tag, text) => {
266
275
  {
267
276
  vnode.$attrs$ = null;
268
277
  }
269
- {
270
- vnode.$key$ = null;
271
- }
272
- {
273
- vnode.$name$ = null;
274
- }
275
278
  return vnode;
276
279
  };
277
280
  var Host = {};
278
281
  var isHost = (node) => node && node.$tag$ === Host;
279
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
282
+ var parsePropertyValue = (propValue, propType) => {
283
+ if (propValue != null && !isComplexType(propValue)) {
284
+ if (propType & 4 /* Boolean */) {
285
+ return propValue === "false" ? false : propValue === "" || !!propValue;
286
+ }
287
+ if (propType & 1 /* String */) {
288
+ return String(propValue);
289
+ }
290
+ return propValue;
291
+ }
292
+ return propValue;
293
+ };
294
+ var getElement = (ref) => getHostRef(ref).$hostElement$ ;
295
+
296
+ // src/runtime/event-emitter.ts
297
+ var createEvent = (ref, name, flags) => {
298
+ const elm = getElement(ref);
299
+ return {
300
+ emit: (detail) => {
301
+ return emitEvent(elm, name, {
302
+ bubbles: !!(flags & 4 /* Bubbles */),
303
+ composed: !!(flags & 2 /* Composed */),
304
+ cancelable: !!(flags & 1 /* Cancellable */),
305
+ detail
306
+ });
307
+ }
308
+ };
309
+ };
310
+ var emitEvent = (elm, name, opts) => {
311
+ const ev = plt.ce(name, opts);
312
+ elm.dispatchEvent(ev);
313
+ return ev;
314
+ };
315
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
316
+ var registerStyle = (scopeId2, cssText, allowCS) => {
317
+ let style = styles.get(scopeId2);
318
+ if (supportsConstructableStylesheets && allowCS) {
319
+ style = style || new CSSStyleSheet();
320
+ if (typeof style === "string") {
321
+ style = cssText;
322
+ } else {
323
+ style.replaceSync(cssText);
324
+ }
325
+ } else {
326
+ style = cssText;
327
+ }
328
+ styles.set(scopeId2, style);
329
+ };
330
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
331
+ var _a;
332
+ const scopeId2 = getScopeId(cmpMeta);
333
+ const style = styles.get(scopeId2);
334
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
335
+ if (style) {
336
+ if (typeof style === "string") {
337
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
338
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
339
+ let styleElm;
340
+ if (!appliedStyles) {
341
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
342
+ }
343
+ if (!appliedStyles.has(scopeId2)) {
344
+ {
345
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
346
+ styleElm.innerHTML = style;
347
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
348
+ if (nonce != null) {
349
+ styleElm.setAttribute("nonce", nonce);
350
+ }
351
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
352
+ if (styleContainerNode.nodeName === "HEAD") {
353
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
354
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
355
+ styleContainerNode.insertBefore(
356
+ styleElm,
357
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
358
+ );
359
+ } else if ("host" in styleContainerNode) {
360
+ if (supportsConstructableStylesheets) {
361
+ const stylesheet = new CSSStyleSheet();
362
+ stylesheet.replaceSync(style);
363
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
364
+ } else {
365
+ const existingStyleContainer = styleContainerNode.querySelector("style");
366
+ if (existingStyleContainer) {
367
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
368
+ } else {
369
+ styleContainerNode.prepend(styleElm);
370
+ }
371
+ }
372
+ } else {
373
+ styleContainerNode.append(styleElm);
374
+ }
375
+ }
376
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
377
+ styleContainerNode.insertBefore(styleElm, null);
378
+ }
379
+ }
380
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
381
+ styleElm.innerHTML += SLOT_FB_CSS;
382
+ }
383
+ if (appliedStyles) {
384
+ appliedStyles.add(scopeId2);
385
+ }
386
+ }
387
+ } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
388
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
389
+ }
390
+ }
391
+ return scopeId2;
392
+ };
393
+ var attachStyles = (hostRef) => {
394
+ const cmpMeta = hostRef.$cmpMeta$;
395
+ const elm = hostRef.$hostElement$;
396
+ const flags = cmpMeta.$flags$;
397
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
398
+ const scopeId2 = addStyle(
399
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
400
+ cmpMeta);
401
+ if (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
402
+ elm["s-sc"] = scopeId2;
403
+ elm.classList.add(scopeId2 + "-h");
404
+ }
405
+ endAttachStyles();
406
+ };
407
+ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
408
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
280
409
  if (oldValue !== newValue) {
281
- memberName.toLowerCase();
410
+ let isProp = isMemberInElement(elm, memberName);
411
+ let ln = memberName.toLowerCase();
282
412
  if (memberName === "class") {
283
413
  const classList = elm.classList;
284
414
  const oldClasses = parseClassList(oldValue);
285
- const newClasses = parseClassList(newValue);
286
- if (elm["s-si"] && newClasses.indexOf(elm["s-si"]) < 0) {
287
- newClasses.push(elm["s-si"]);
415
+ let newClasses = parseClassList(newValue);
416
+ {
417
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
418
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
419
+ }
420
+ } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
421
+ if (memberName[2] === "-") {
422
+ memberName = memberName.slice(3);
423
+ } else if (isMemberInElement(win, ln)) {
424
+ memberName = ln.slice(2);
425
+ } else {
426
+ memberName = ln[2] + memberName.slice(3);
427
+ }
428
+ if (oldValue || newValue) {
429
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
430
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
431
+ if (oldValue) {
432
+ plt.rel(elm, memberName, oldValue, capture);
433
+ }
434
+ if (newValue) {
435
+ plt.ael(elm, memberName, newValue, capture);
436
+ }
437
+ }
438
+ } else {
439
+ const isComplex = isComplexType(newValue);
440
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
441
+ try {
442
+ if (!elm.tagName.includes("-")) {
443
+ const n = newValue == null ? "" : newValue;
444
+ if (memberName === "list") {
445
+ isProp = false;
446
+ } else if (oldValue == null || elm[memberName] != n) {
447
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
448
+ elm[memberName] = n;
449
+ } else {
450
+ elm.setAttribute(memberName, n);
451
+ }
452
+ }
453
+ } else if (elm[memberName] !== newValue) {
454
+ elm[memberName] = newValue;
455
+ }
456
+ } catch (e) {
457
+ }
458
+ }
459
+ if (newValue == null || newValue === false) {
460
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
461
+ {
462
+ elm.removeAttribute(memberName);
463
+ }
464
+ }
465
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
466
+ newValue = newValue === true ? "" : newValue;
467
+ {
468
+ elm.setAttribute(memberName, newValue);
469
+ }
288
470
  }
289
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
290
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
291
471
  }
292
472
  }
293
473
  };
294
474
  var parseClassListRegex = /\s/;
295
- var parseClassList = (value) => !value ? [] : value.split(parseClassListRegex);
475
+ var parseClassList = (value) => {
476
+ if (typeof value === "object" && value && "baseVal" in value) {
477
+ value = value.baseVal;
478
+ }
479
+ if (!value || typeof value !== "string") {
480
+ return [];
481
+ }
482
+ return value.split(parseClassListRegex);
483
+ };
484
+ var CAPTURE_EVENT_SUFFIX = "Capture";
485
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
296
486
 
297
487
  // src/runtime/vdom/update-element.ts
298
- var updateElement = (oldVnode, newVnode, isSvgMode2) => {
488
+ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
299
489
  const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
300
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ;
301
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
490
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
491
+ const newVnodeAttrs = newVnode.$attrs$ || {};
302
492
  {
303
493
  for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
304
494
  if (!(memberName in newVnodeAttrs)) {
305
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0);
495
+ setAccessor(
496
+ elm,
497
+ memberName,
498
+ oldVnodeAttrs[memberName],
499
+ void 0,
500
+ isSvgMode2,
501
+ newVnode.$flags$);
306
502
  }
307
503
  }
308
504
  }
309
505
  for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
310
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName]);
506
+ setAccessor(
507
+ elm,
508
+ memberName,
509
+ oldVnodeAttrs[memberName],
510
+ newVnodeAttrs[memberName],
511
+ isSvgMode2,
512
+ newVnode.$flags$);
311
513
  }
312
514
  };
313
515
  function sortedAttrNames(attrNames) {
@@ -319,51 +521,29 @@ function sortedAttrNames(attrNames) {
319
521
  attrNames
320
522
  );
321
523
  }
322
-
323
- // src/runtime/vdom/vdom-render.ts
324
- var scopeId;
325
- var contentRef;
326
524
  var hostTagName;
327
525
  var useNativeShadowDom = false;
328
- var checkSlotFallbackVisibility = false;
329
- var checkSlotRelocate = false;
330
- var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
331
- var _a;
526
+ var isSvgMode = false;
527
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
332
528
  const newVNode2 = newParentVNode.$children$[childIndex];
333
529
  let i2 = 0;
334
530
  let elm;
335
531
  let childNode;
336
- let oldVNode;
337
- if (!useNativeShadowDom) {
338
- checkSlotRelocate = true;
339
- if (newVNode2.$tag$ === "slot") {
340
- newVNode2.$flags$ |= newVNode2.$children$ ? (
341
- // slot element has fallback content
342
- // still create an element that "mocks" the slot element
343
- 2 /* isSlotFallback */
344
- ) : (
345
- // slot element does not have fallback content
346
- // create an html comment we'll use to always reference
347
- // where actual slot content should sit next to
348
- 1 /* isSlotReference */
349
- );
350
- }
351
- }
352
532
  if (newVNode2.$text$ !== null) {
353
533
  elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
354
- } else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
355
- elm = newVNode2.$elm$ = doc.createTextNode("");
356
534
  } else {
357
- elm = newVNode2.$elm$ = doc.createElement(
535
+ if (!isSvgMode) {
536
+ isSvgMode = newVNode2.$tag$ === "svg";
537
+ }
538
+ elm = newVNode2.$elm$ = doc.createElementNS(
539
+ isSvgMode ? SVG_NS : HTML_NS,
358
540
  !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
359
- );
360
- {
361
- updateElement(null, newVNode2);
541
+ ) ;
542
+ if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
543
+ isSvgMode = false;
362
544
  }
363
- const rootNode = elm.getRootNode();
364
- const isElementWithinShadowRoot = !rootNode.querySelector("body");
365
- if (!isElementWithinShadowRoot && BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
366
- elm.classList.add(elm["s-si"] = scopeId);
545
+ {
546
+ updateElement(null, newVNode2, isSvgMode);
367
547
  }
368
548
  if (newVNode2.$children$) {
369
549
  for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
@@ -373,59 +553,29 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
373
553
  }
374
554
  }
375
555
  }
376
- }
377
- elm["s-hn"] = hostTagName;
378
- {
379
- if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
380
- elm["s-sr"] = true;
381
- elm["s-cr"] = contentRef;
382
- elm["s-sn"] = newVNode2.$name$ || "";
383
- elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
384
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
385
- if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
386
- {
387
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
388
- }
556
+ {
557
+ if (newVNode2.$tag$ === "svg") {
558
+ isSvgMode = false;
559
+ } else if (elm.tagName === "foreignObject") {
560
+ isSvgMode = true;
389
561
  }
390
562
  }
391
563
  }
564
+ elm["s-hn"] = hostTagName;
392
565
  return elm;
393
566
  };
394
- var putBackInOriginalLocation = (parentElm, recursive) => {
395
- plt.$flags$ |= 1 /* isTmpDisconnected */;
396
- const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
397
- if (parentElm["s-sr"] && BUILD.experimentalSlotFixes) {
398
- let node = parentElm;
399
- while (node = node.nextSibling) {
400
- if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
401
- oldSlotChildNodes.push(node);
402
- }
403
- }
404
- }
405
- for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
406
- const childNode = oldSlotChildNodes[i2];
407
- if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
408
- insertBefore(parentReferenceNode(childNode), childNode, referenceNode(childNode));
409
- childNode["s-ol"].remove();
410
- childNode["s-ol"] = void 0;
411
- childNode["s-sh"] = void 0;
412
- checkSlotRelocate = true;
413
- }
414
- if (recursive) {
415
- putBackInOriginalLocation(childNode, recursive);
416
- }
417
- }
418
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
419
- };
420
567
  var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
421
- let containerElm = parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
568
+ let containerElm = parentElm;
422
569
  let childNode;
570
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
571
+ containerElm = containerElm.shadowRoot;
572
+ }
423
573
  for (; startIdx <= endIdx; ++startIdx) {
424
574
  if (vnodes[startIdx]) {
425
575
  childNode = createElm(null, parentVNode, startIdx);
426
576
  if (childNode) {
427
577
  vnodes[startIdx].$elm$ = childNode;
428
- insertBefore(containerElm, childNode, referenceNode(before) );
578
+ insertBefore(containerElm, childNode, before);
429
579
  }
430
580
  }
431
581
  }
@@ -436,14 +586,6 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
436
586
  if (vnode) {
437
587
  const elm = vnode.$elm$;
438
588
  if (elm) {
439
- {
440
- checkSlotFallbackVisibility = true;
441
- if (elm["s-ol"]) {
442
- elm["s-ol"].remove();
443
- } else {
444
- putBackInOriginalLocation(elm, true);
445
- }
446
- }
447
589
  elm.remove();
448
590
  }
449
591
  }
@@ -452,8 +594,6 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
452
594
  var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
453
595
  let oldStartIdx = 0;
454
596
  let newStartIdx = 0;
455
- let idxInOld = 0;
456
- let i2 = 0;
457
597
  let oldEndIdx = oldCh.length - 1;
458
598
  let oldStartVnode = oldCh[0];
459
599
  let oldEndVnode = oldCh[oldEndIdx];
@@ -461,7 +601,6 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
461
601
  let newStartVnode = newCh[0];
462
602
  let newEndVnode = newCh[newEndIdx];
463
603
  let node;
464
- let elmToMove;
465
604
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
466
605
  if (oldStartVnode == null) {
467
606
  oldStartVnode = oldCh[++oldStartIdx];
@@ -480,48 +619,23 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
480
619
  oldEndVnode = oldCh[--oldEndIdx];
481
620
  newEndVnode = newCh[--newEndIdx];
482
621
  } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
483
- if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
484
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
485
- }
486
622
  patch(oldStartVnode, newEndVnode, isInitialRender);
487
623
  insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
488
624
  oldStartVnode = oldCh[++oldStartIdx];
489
625
  newEndVnode = newCh[--newEndIdx];
490
626
  } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
491
- if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
492
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
493
- }
494
627
  patch(oldEndVnode, newStartVnode, isInitialRender);
495
628
  insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
496
629
  oldEndVnode = oldCh[--oldEndIdx];
497
630
  newStartVnode = newCh[++newStartIdx];
498
631
  } else {
499
- idxInOld = -1;
500
632
  {
501
- for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
502
- if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
503
- idxInOld = i2;
504
- break;
505
- }
506
- }
507
- }
508
- if (idxInOld >= 0) {
509
- elmToMove = oldCh[idxInOld];
510
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
511
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
512
- } else {
513
- patch(elmToMove, newStartVnode, isInitialRender);
514
- oldCh[idxInOld] = void 0;
515
- node = elmToMove.$elm$;
516
- }
517
- newStartVnode = newCh[++newStartIdx];
518
- } else {
519
633
  node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
520
634
  newStartVnode = newCh[++newStartIdx];
521
635
  }
522
636
  if (node) {
523
637
  {
524
- insertBefore(parentReferenceNode(oldStartVnode.$elm$), node, referenceNode(oldStartVnode.$elm$));
638
+ insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
525
639
  }
526
640
  }
527
641
  }
@@ -541,40 +655,26 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
541
655
  };
542
656
  var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
543
657
  if (leftVNode.$tag$ === rightVNode.$tag$) {
544
- if (leftVNode.$tag$ === "slot") {
545
- if (
546
- // The component gets hydrated and no VDOM has been initialized.
547
- // Here the comparison can't happen as $name$ property is not set for `leftNode`.
548
- "$nodeId$" in leftVNode && isInitialRender && // `leftNode` is not from type HTMLComment which would cause many
549
- // hydration comments to be removed
550
- leftVNode.$elm$.nodeType !== 8
551
- ) {
552
- return false;
553
- }
554
- return leftVNode.$name$ === rightVNode.$name$;
555
- }
556
- if (!isInitialRender) {
557
- return leftVNode.$key$ === rightVNode.$key$;
658
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
659
+ leftVNode.$key$ = rightVNode.$key$;
558
660
  }
559
661
  return true;
560
662
  }
561
663
  return false;
562
664
  };
563
- var referenceNode = (node) => {
564
- return node && node["s-ol"] || node;
565
- };
566
- var parentReferenceNode = (node) => (node["s-ol"] ? node["s-ol"] : node).parentNode;
567
665
  var patch = (oldVNode, newVNode2, isInitialRender = false) => {
568
666
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
569
667
  const oldChildren = oldVNode.$children$;
570
668
  const newChildren = newVNode2.$children$;
571
669
  const tag = newVNode2.$tag$;
572
670
  const text = newVNode2.$text$;
573
- let defaultHolder;
574
671
  if (text === null) {
575
672
  {
576
- if (tag === "slot" && !useNativeShadowDom) ; else {
577
- updateElement(oldVNode, newVNode2);
673
+ isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
674
+ }
675
+ {
676
+ {
677
+ updateElement(oldVNode, newVNode2, isSvgMode);
578
678
  }
579
679
  }
580
680
  if (oldChildren !== null && newChildren !== null) {
@@ -590,111 +690,21 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
590
690
  ) {
591
691
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
592
692
  }
593
- } else if ((defaultHolder = elm["s-cr"])) {
594
- defaultHolder.parentNode.textContent = text;
693
+ if (isSvgMode && tag === "svg") {
694
+ isSvgMode = false;
695
+ }
595
696
  } else if (oldVNode.$text$ !== text) {
596
697
  elm.data = text;
597
698
  }
598
699
  };
599
- var updateFallbackSlotVisibility = (elm) => {
600
- const childNodes = elm.__childNodes || elm.childNodes;
601
- for (const childNode of childNodes) {
602
- if (childNode.nodeType === 1 /* ElementNode */) {
603
- if (childNode["s-sr"]) {
604
- const slotName = childNode["s-sn"];
605
- childNode.hidden = false;
606
- for (const siblingNode of childNodes) {
607
- if (siblingNode !== childNode) {
608
- if (siblingNode["s-hn"] !== childNode["s-hn"] || slotName !== "") {
609
- if (siblingNode.nodeType === 1 /* ElementNode */ && (slotName === siblingNode.getAttribute("slot") || slotName === siblingNode["s-sn"]) || siblingNode.nodeType === 3 /* TextNode */ && slotName === siblingNode["s-sn"]) {
610
- childNode.hidden = true;
611
- break;
612
- }
613
- } else if (slotName === siblingNode["s-sn"]) {
614
- if (siblingNode.nodeType === 1 /* ElementNode */ || siblingNode.nodeType === 3 /* TextNode */ && siblingNode.textContent.trim() !== "") {
615
- childNode.hidden = true;
616
- break;
617
- }
618
- }
619
- }
620
- }
621
- }
622
- updateFallbackSlotVisibility(childNode);
623
- }
624
- }
625
- };
626
- var relocateNodes = [];
627
- var markSlotContentForRelocation = (elm) => {
628
- let node;
629
- let hostContentNodes;
630
- let j;
631
- const children = elm.__childNodes || elm.childNodes;
632
- for (const childNode of children) {
633
- if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
634
- hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
635
- const slotName = childNode["s-sn"];
636
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
637
- node = hostContentNodes[j];
638
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD.experimentalSlotFixes )) {
639
- if (isNodeLocatedInSlot(node, slotName)) {
640
- let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
641
- checkSlotFallbackVisibility = true;
642
- node["s-sn"] = node["s-sn"] || slotName;
643
- if (relocateNodeData) {
644
- relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
645
- relocateNodeData.$slotRefNode$ = childNode;
646
- } else {
647
- node["s-sh"] = childNode["s-hn"];
648
- relocateNodes.push({
649
- $slotRefNode$: childNode,
650
- $nodeToRelocate$: node
651
- });
652
- }
653
- if (node["s-sr"]) {
654
- relocateNodes.map((relocateNode) => {
655
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
656
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
657
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
658
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
659
- }
660
- }
661
- });
662
- }
663
- } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
664
- relocateNodes.push({
665
- $nodeToRelocate$: node
666
- });
667
- }
668
- }
669
- }
670
- }
671
- if (childNode.nodeType === 1 /* ElementNode */) {
672
- markSlotContentForRelocation(childNode);
673
- }
674
- }
675
- };
676
- var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
677
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
678
- if (nodeToRelocate.getAttribute("slot") === null && slotName === "") {
679
- return true;
680
- }
681
- if (nodeToRelocate.getAttribute("slot") === slotName) {
682
- return true;
683
- }
684
- return false;
685
- }
686
- if (nodeToRelocate["s-sn"] === slotName) {
687
- return true;
688
- }
689
- return slotName === "";
690
- };
691
700
  var insertBefore = (parent, newNode, reference) => {
692
- const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
693
- return inserted;
701
+ {
702
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
703
+ }
694
704
  };
695
705
  var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
696
- var _a, _b, _c, _d;
697
706
  const hostElm = hostRef.$hostElement$;
707
+ const cmpMeta = hostRef.$cmpMeta$;
698
708
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
699
709
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
700
710
  hostTagName = hostElm.tagName;
@@ -708,199 +718,22 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
708
718
  rootVnode.$tag$ = null;
709
719
  rootVnode.$flags$ |= 4 /* isHost */;
710
720
  hostRef.$vnode$ = rootVnode;
711
- rootVnode.$elm$ = oldVNode.$elm$ = hostElm;
712
- useNativeShadowDom = supportsShadow ;
713
- {
714
- contentRef = hostElm["s-cr"];
715
- checkSlotFallbackVisibility = false;
716
- }
721
+ rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
722
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
717
723
  patch(oldVNode, rootVnode, isInitialLoad);
718
- {
719
- plt.$flags$ |= 1 /* isTmpDisconnected */;
720
- if (checkSlotRelocate) {
721
- markSlotContentForRelocation(rootVnode.$elm$);
722
- for (const relocateData of relocateNodes) {
723
- const nodeToRelocate = relocateData.$nodeToRelocate$;
724
- if (!nodeToRelocate["s-ol"]) {
725
- const orgLocationNode = doc.createTextNode("");
726
- orgLocationNode["s-nr"] = nodeToRelocate;
727
- insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
728
- }
729
- }
730
- for (const relocateData of relocateNodes) {
731
- const nodeToRelocate = relocateData.$nodeToRelocate$;
732
- const slotRefNode = relocateData.$slotRefNode$;
733
- if (slotRefNode) {
734
- const parentNodeRef = slotRefNode.parentNode;
735
- let insertBeforeNode = slotRefNode.nextSibling;
736
- {
737
- let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
738
- while (orgLocationNode) {
739
- let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
740
- if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === refNode.parentNode) {
741
- refNode = refNode.nextSibling;
742
- while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
743
- refNode = refNode == null ? void 0 : refNode.nextSibling;
744
- }
745
- if (!refNode || !refNode["s-nr"]) {
746
- insertBeforeNode = refNode;
747
- break;
748
- }
749
- }
750
- orgLocationNode = orgLocationNode.previousSibling;
751
- }
752
- }
753
- if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
754
- if (nodeToRelocate !== insertBeforeNode) {
755
- if (!nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
756
- nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
757
- }
758
- insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
759
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
760
- nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
761
- }
762
- }
763
- }
764
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
765
- } else {
766
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
767
- if (isInitialLoad) {
768
- nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
769
- }
770
- nodeToRelocate.hidden = true;
771
- }
772
- }
773
- }
774
- }
775
- if (checkSlotFallbackVisibility) {
776
- updateFallbackSlotVisibility(rootVnode.$elm$);
777
- }
778
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
779
- relocateNodes.length = 0;
780
- }
781
- contentRef = void 0;
782
724
  };
783
- var createTime = (fnName, tagName = "") => {
784
- {
785
- return () => {
786
- return;
787
- };
788
- }
789
- };
790
- var uniqueTime = (key, measureText) => {
791
- {
792
- return () => {
793
- return;
794
- };
795
- }
796
- };
797
- var parsePropertyValue = (propValue, propType) => {
798
- if (propValue != null && !isComplexType(propValue)) {
799
- if (propType & 4 /* Boolean */) {
800
- return propValue === "false" ? false : propValue === "" || !!propValue;
801
- }
802
- if (propType & 1 /* String */) {
803
- return String(propValue);
804
- }
805
- return propValue;
806
- }
807
- return propValue;
808
- };
809
- var emitEvent = (elm, name, opts) => {
810
- const ev = plt.ce(name, opts);
811
- elm.dispatchEvent(ev);
812
- return ev;
813
- };
814
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
815
- var registerStyle = (scopeId2, cssText, allowCS) => {
816
- let style = styles.get(scopeId2);
817
- if (supportsConstructableStylesheets && allowCS) {
818
- style = style || new CSSStyleSheet();
819
- if (typeof style === "string") {
820
- style = cssText;
821
- } else {
822
- style.replaceSync(cssText);
823
- }
824
- } else {
825
- style = cssText;
826
- }
827
- styles.set(scopeId2, style);
828
- };
829
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
830
- var _a;
831
- const scopeId2 = getScopeId(cmpMeta);
832
- const style = styles.get(scopeId2);
833
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
834
- if (style) {
835
- if (typeof style === "string") {
836
- styleContainerNode = styleContainerNode.head || styleContainerNode;
837
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
838
- let styleElm;
839
- if (!appliedStyles) {
840
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
841
- }
842
- if (!appliedStyles.has(scopeId2)) {
843
- {
844
- styleElm = doc.createElement("style");
845
- styleElm.innerHTML = style;
846
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
847
- if (nonce != null) {
848
- styleElm.setAttribute("nonce", nonce);
849
- }
850
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
851
- if (styleContainerNode.nodeName === "HEAD") {
852
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
853
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
854
- styleContainerNode.insertBefore(styleElm, referenceNode2);
855
- } else if ("host" in styleContainerNode) {
856
- if (supportsConstructableStylesheets) {
857
- const stylesheet = new CSSStyleSheet();
858
- stylesheet.replaceSync(style);
859
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
860
- } else {
861
- const existingStyleContainer = styleContainerNode.querySelector("style");
862
- if (existingStyleContainer) {
863
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
864
- } else {
865
- styleContainerNode.prepend(styleElm);
866
- }
867
- }
868
- } else {
869
- styleContainerNode.append(styleElm);
870
- }
871
- }
872
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
873
- styleContainerNode.insertBefore(styleElm, null);
874
- }
875
- }
876
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
877
- styleElm.innerHTML += SLOT_FB_CSS;
878
- }
879
- if (appliedStyles) {
880
- appliedStyles.add(scopeId2);
881
- }
882
- }
883
- } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
884
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
885
- }
886
- }
887
- return scopeId2;
888
- };
889
- var attachStyles = (hostRef) => {
890
- const cmpMeta = hostRef.$cmpMeta$;
891
- const elm = hostRef.$hostElement$;
892
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
893
- addStyle(
894
- elm.getRootNode(),
895
- cmpMeta);
896
- endAttachStyles();
897
- };
898
- var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
899
725
 
900
726
  // src/runtime/update-component.ts
901
727
  var attachToAncestor = (hostRef, ancestorComponent) => {
902
728
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
903
- ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
729
+ const index = ancestorComponent["s-p"].push(
730
+ new Promise(
731
+ (r) => hostRef.$onRenderResolve$ = () => {
732
+ ancestorComponent["s-p"].splice(index - 1, 1);
733
+ r();
734
+ }
735
+ )
736
+ );
904
737
  }
905
738
  };
906
739
  var scheduleUpdate = (hostRef, isInitialLoad) => {
@@ -1059,62 +892,69 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1059
892
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
1060
893
  members.map(([memberName, [memberFlags]]) => {
1061
894
  if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
1062
- if ((memberFlags & 2048 /* Getter */) === 0) {
895
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
896
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
897
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
898
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
1063
899
  Object.defineProperty(prototype, memberName, {
1064
900
  get() {
1065
- return getValue(this, memberName);
1066
- },
1067
- set(newValue) {
1068
- setValue(this, memberName, newValue, cmpMeta);
1069
- },
1070
- configurable: true,
1071
- enumerable: true
1072
- });
1073
- } else if (flags & 1 /* isElementConstructor */ && memberFlags & 2048 /* Getter */) {
1074
- {
1075
- Object.defineProperty(prototype, memberName, {
1076
- get() {
901
+ {
902
+ if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
903
+ return getValue(this, memberName);
904
+ }
1077
905
  const ref = getHostRef(this);
1078
906
  const instance = ref ? ref.$lazyInstance$ : prototype;
1079
907
  if (!instance) return;
1080
908
  return instance[memberName];
1081
- },
1082
- configurable: true,
1083
- enumerable: true
1084
- });
1085
- }
1086
- if (memberFlags & 4096 /* Setter */) {
1087
- const origSetter = Object.getOwnPropertyDescriptor(prototype, memberName).set;
1088
- Object.defineProperty(prototype, memberName, {
1089
- set(newValue) {
1090
- const ref = getHostRef(this);
1091
- if (origSetter) {
1092
- const currentValue = ref.$hostElement$[memberName];
1093
- if (!ref.$instanceValues$.get(memberName) && currentValue) {
1094
- ref.$instanceValues$.set(memberName, currentValue);
1095
- }
1096
- origSetter.apply(this, [parsePropertyValue(newValue, cmpMeta.$members$[memberName][0])]);
1097
- setValue(this, memberName, ref.$hostElement$[memberName], cmpMeta);
1098
- return;
909
+ }
910
+ },
911
+ configurable: true,
912
+ enumerable: true
913
+ });
914
+ }
915
+ Object.defineProperty(prototype, memberName, {
916
+ set(newValue) {
917
+ const ref = getHostRef(this);
918
+ if (origSetter) {
919
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
920
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
921
+ newValue = ref.$instanceValues$.get(memberName);
922
+ } else if (!ref.$instanceValues$.get(memberName) && currentValue) {
923
+ ref.$instanceValues$.set(memberName, currentValue);
924
+ }
925
+ origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
926
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
927
+ setValue(this, memberName, newValue, cmpMeta);
928
+ return;
929
+ }
930
+ {
931
+ if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
932
+ setValue(this, memberName, newValue, cmpMeta);
933
+ if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
934
+ ref.$onReadyPromise$.then(() => {
935
+ if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
936
+ ref.$lazyInstance$[memberName] = newValue;
937
+ }
938
+ });
1099
939
  }
1100
- if (!ref) return;
1101
- const setterSetVal = () => {
1102
- const currentValue = ref.$lazyInstance$[memberName];
1103
- if (!ref.$instanceValues$.get(memberName) && currentValue) {
1104
- ref.$instanceValues$.set(memberName, currentValue);
1105
- }
1106
- ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, cmpMeta.$members$[memberName][0]);
1107
- setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
1108
- };
1109
- if (ref.$lazyInstance$) {
1110
- setterSetVal();
1111
- } else {
1112
- ref.$onReadyPromise$.then(() => setterSetVal());
940
+ return;
941
+ }
942
+ const setterSetVal = () => {
943
+ const currentValue = ref.$lazyInstance$[memberName];
944
+ if (!ref.$instanceValues$.get(memberName) && currentValue) {
945
+ ref.$instanceValues$.set(memberName, currentValue);
1113
946
  }
947
+ ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags);
948
+ setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
949
+ };
950
+ if (ref.$lazyInstance$) {
951
+ setterSetVal();
952
+ } else {
953
+ ref.$onReadyPromise$.then(() => setterSetVal());
1114
954
  }
1115
- });
955
+ }
1116
956
  }
1117
- }
957
+ });
1118
958
  }
1119
959
  });
1120
960
  if ((flags & 1 /* isElementConstructor */)) {
@@ -1123,7 +963,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1123
963
  plt.jmp(() => {
1124
964
  var _a2;
1125
965
  const propName = attrNameToPropName.get(attrName);
1126
- if (this.hasOwnProperty(propName)) {
966
+ if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
1127
967
  newValue = this[propName];
1128
968
  delete this[propName];
1129
969
  } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
@@ -1144,8 +984,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1144
984
  return;
1145
985
  }
1146
986
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
1147
- if (!propDesc.get || !!propDesc.set) {
1148
- this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
987
+ newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
988
+ if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
989
+ this[propName] = newValue;
1149
990
  }
1150
991
  });
1151
992
  };
@@ -1169,9 +1010,8 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1169
1010
  let Cstr;
1170
1011
  if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1171
1012
  hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1172
- const bundleId = cmpMeta.$lazyBundleId$;
1173
- if (bundleId) {
1174
- const CstrImport = loadModule(cmpMeta);
1013
+ {
1014
+ const CstrImport = loadModule(cmpMeta, hostRef);
1175
1015
  if (CstrImport && "then" in CstrImport) {
1176
1016
  const endLoad = uniqueTime();
1177
1017
  Cstr = await CstrImport;
@@ -1193,16 +1033,12 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1193
1033
  try {
1194
1034
  new Cstr(hostRef);
1195
1035
  } catch (e) {
1196
- consoleError(e);
1036
+ consoleError(e, elm);
1197
1037
  }
1198
1038
  {
1199
1039
  hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1200
1040
  }
1201
1041
  endNewInstance();
1202
- } else {
1203
- Cstr = elm.constructor;
1204
- const cmpTag = elm.localName;
1205
- customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
1206
1042
  }
1207
1043
  if (Cstr && Cstr.style) {
1208
1044
  let style;
@@ -1225,7 +1061,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1225
1061
  schedule();
1226
1062
  }
1227
1063
  };
1228
- var fireConnectedCallback = (instance) => {
1064
+ var fireConnectedCallback = (instance, elm) => {
1229
1065
  };
1230
1066
 
1231
1067
  // src/runtime/connected-callback.ts
@@ -1236,12 +1072,6 @@ var connectedCallback = (elm) => {
1236
1072
  const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1237
1073
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1238
1074
  hostRef.$flags$ |= 1 /* hasConnected */;
1239
- {
1240
- if (// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
1241
- cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
1242
- setContentReference(elm);
1243
- }
1244
- }
1245
1075
  {
1246
1076
  let ancestorComponent = elm;
1247
1077
  while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
@@ -1271,14 +1101,7 @@ var connectedCallback = (elm) => {
1271
1101
  endConnected();
1272
1102
  }
1273
1103
  };
1274
- var setContentReference = (elm) => {
1275
- const contentRefElm = elm["s-cr"] = doc.createComment(
1276
- ""
1277
- );
1278
- contentRefElm["s-cn"] = true;
1279
- insertBefore(elm, contentRefElm, elm.firstChild);
1280
- };
1281
- var disconnectInstance = (instance) => {
1104
+ var disconnectInstance = (instance, elm) => {
1282
1105
  };
1283
1106
  var disconnectedCallback = async (elm) => {
1284
1107
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
@@ -1287,6 +1110,12 @@ var disconnectedCallback = async (elm) => {
1287
1110
  hostRef.$onReadyPromise$.then(() => disconnectInstance());
1288
1111
  }
1289
1112
  }
1113
+ if (rootAppliedStyles.has(elm)) {
1114
+ rootAppliedStyles.delete(elm);
1115
+ }
1116
+ if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
1117
+ rootAppliedStyles.delete(elm.shadowRoot);
1118
+ }
1290
1119
  };
1291
1120
 
1292
1121
  // src/runtime/bootstrap-lazy.ts
@@ -1327,6 +1156,21 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1327
1156
  this.hasRegisteredEventListeners = false;
1328
1157
  self = this;
1329
1158
  registerHost(self, cmpMeta);
1159
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1160
+ {
1161
+ if (!self.shadowRoot) {
1162
+ {
1163
+ self.attachShadow({ mode: "open" });
1164
+ }
1165
+ } else {
1166
+ if (self.shadowRoot.mode !== "open") {
1167
+ throw new Error(
1168
+ `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${self.shadowRoot.mode} but Stencil only supports open shadow roots.`
1169
+ );
1170
+ }
1171
+ }
1172
+ }
1173
+ }
1330
1174
  }
1331
1175
  connectedCallback() {
1332
1176
  getHostRef(this);
@@ -1345,6 +1189,13 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1345
1189
  }
1346
1190
  disconnectedCallback() {
1347
1191
  plt.jmp(() => disconnectedCallback(this));
1192
+ plt.raf(() => {
1193
+ var _a3;
1194
+ const hostRef = getHostRef(this);
1195
+ if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
1196
+ delete hostRef.$vnode$.$elm$;
1197
+ }
1198
+ });
1348
1199
  }
1349
1200
  componentOnReady() {
1350
1201
  return getHostRef(this).$onReadyPromise$;
@@ -1391,9 +1242,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1391
1242
  var setNonce = (nonce) => plt.$nonce$ = nonce;
1392
1243
 
1393
1244
  exports.bootstrapLazy = bootstrapLazy;
1245
+ exports.createEvent = createEvent;
1394
1246
  exports.h = h;
1395
1247
  exports.promiseResolve = promiseResolve;
1396
1248
  exports.registerInstance = registerInstance;
1397
1249
  exports.setNonce = setNonce;
1398
1250
 
1399
- //# sourceMappingURL=index-f882627f.js.map
1251
+ //# sourceMappingURL=index-f786c569.js.map