xv-webcomponents 0.1.9 → 0.1.11

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 (94) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/{index-888a60d0.js → index-4d938647.js} +291 -6
  3. package/dist/cjs/index-4d938647.js.map +1 -0
  4. package/dist/cjs/index.cjs.js +4 -4
  5. package/dist/cjs/index.cjs.js.map +1 -1
  6. package/dist/cjs/loader.cjs.js +2 -2
  7. package/dist/cjs/utils-c7652b74.js +13 -0
  8. package/dist/cjs/utils-c7652b74.js.map +1 -0
  9. package/dist/cjs/xv-accordion_10.cjs.entry.js +263 -0
  10. package/dist/cjs/xv-accordion_10.cjs.entry.js.map +1 -0
  11. package/dist/cjs/xv-breadcrumbs.cjs.entry.js +22 -0
  12. package/dist/cjs/xv-breadcrumbs.cjs.entry.js.map +1 -0
  13. package/dist/cjs/xv-webcomponents.cjs.js +2 -2
  14. package/dist/collection/collection-manifest.json +10 -1
  15. package/dist/collection/components/xv-accordion/xv-accordion.css +3 -0
  16. package/dist/collection/components/xv-accordion/xv-accordion.js +163 -0
  17. package/dist/collection/components/xv-accordion/xv-accordion.js.map +1 -0
  18. package/dist/collection/components/xv-accordion-item/xv-accordion-item.css +68 -0
  19. package/dist/collection/components/xv-accordion-item/xv-accordion-item.js +132 -0
  20. package/dist/collection/components/xv-accordion-item/xv-accordion-item.js.map +1 -0
  21. package/dist/collection/components/xv-breadcrumbs/xv-breadcrumbs.css +3 -0
  22. package/dist/collection/components/xv-breadcrumbs/xv-breadcrumbs.js +19 -0
  23. package/dist/collection/components/xv-breadcrumbs/xv-breadcrumbs.js.map +1 -0
  24. package/dist/collection/components/xv-button/xv-button-v2.css +150 -0
  25. package/dist/collection/components/xv-button/xv-button.js +12 -15
  26. package/dist/collection/components/xv-button/xv-button.js.map +1 -1
  27. package/dist/collection/components/xv-card/xv-card.css +63 -0
  28. package/dist/collection/components/xv-card/xv-card.js +122 -0
  29. package/dist/collection/components/xv-card/xv-card.js.map +1 -0
  30. package/dist/collection/components/xv-checkbox/xv-checkbox.js +1 -1
  31. package/dist/collection/components/xv-link/xv-link.css +60 -0
  32. package/dist/collection/components/xv-link/xv-link.js +132 -0
  33. package/dist/collection/components/xv-link/xv-link.js.map +1 -0
  34. package/dist/collection/components/xv-progress-indicator/xv-progress-indicator.css +6 -0
  35. package/dist/collection/components/xv-progress-indicator/xv-progress-indicator.js +70 -0
  36. package/dist/collection/components/xv-progress-indicator/xv-progress-indicator.js.map +1 -0
  37. package/dist/collection/components/xv-progress-indicator-item/xv-progress-indicator-item.css +66 -0
  38. package/dist/collection/components/xv-progress-indicator-item/xv-progress-indicator-item.js +47 -0
  39. package/dist/collection/components/xv-progress-indicator-item/xv-progress-indicator-item.js.map +1 -0
  40. package/dist/collection/components/xv-tag/xv-tag.css +97 -0
  41. package/dist/collection/components/xv-tag/xv-tag.js +158 -0
  42. package/dist/collection/components/xv-tag/xv-tag.js.map +1 -0
  43. package/dist/collection/components/xv-tooltip/xv-tooltip.css +153 -0
  44. package/dist/collection/components/xv-tooltip/xv-tooltip.js +70 -0
  45. package/dist/collection/components/xv-tooltip/xv-tooltip.js.map +1 -0
  46. package/dist/collection/utils/utils.js +3 -0
  47. package/dist/collection/utils/utils.js.map +1 -1
  48. package/dist/esm/{index-5147034e.js → index-60f5a964.js} +291 -7
  49. package/dist/esm/index-60f5a964.js.map +1 -0
  50. package/dist/esm/index.js +1 -5
  51. package/dist/esm/index.js.map +1 -1
  52. package/dist/esm/loader.js +3 -3
  53. package/dist/esm/utils-9bb6333b.js +10 -0
  54. package/dist/esm/utils-9bb6333b.js.map +1 -0
  55. package/dist/esm/xv-accordion_10.entry.js +250 -0
  56. package/dist/esm/xv-accordion_10.entry.js.map +1 -0
  57. package/dist/esm/xv-breadcrumbs.entry.js +18 -0
  58. package/dist/esm/xv-breadcrumbs.entry.js.map +1 -0
  59. package/dist/esm/xv-webcomponents.js +3 -3
  60. package/dist/types/components/xv-accordion/xv-accordion.d.ts +20 -0
  61. package/dist/types/components/xv-accordion-item/xv-accordion-item.d.ts +15 -0
  62. package/dist/types/components/xv-breadcrumbs/xv-breadcrumbs.d.ts +3 -0
  63. package/dist/types/components/xv-button/xv-button.d.ts +0 -3
  64. package/dist/types/components/xv-card/xv-card.d.ts +8 -0
  65. package/dist/types/components/xv-link/xv-link.d.ts +9 -0
  66. package/dist/types/components/xv-progress-indicator/xv-progress-indicator.d.ts +7 -0
  67. package/dist/types/components/xv-progress-indicator-item/xv-progress-indicator-item.d.ts +5 -0
  68. package/dist/types/components/xv-tag/xv-tag.d.ts +11 -0
  69. package/dist/types/components/xv-tooltip/xv-tooltip.d.ts +11 -0
  70. package/dist/types/components.d.ts +236 -0
  71. package/dist/types/utils/utils.d.ts +1 -0
  72. package/dist/xv-webcomponents/index.esm.js +1 -1
  73. package/dist/xv-webcomponents/index.esm.js.map +1 -1
  74. package/dist/xv-webcomponents/p-41bd284c.entry.js +2 -0
  75. package/dist/xv-webcomponents/p-41bd284c.entry.js.map +1 -0
  76. package/dist/xv-webcomponents/p-543fe755.js +3 -0
  77. package/dist/xv-webcomponents/p-543fe755.js.map +1 -0
  78. package/dist/xv-webcomponents/p-6f058b7f.entry.js +2 -0
  79. package/dist/xv-webcomponents/p-6f058b7f.entry.js.map +1 -0
  80. package/dist/xv-webcomponents/p-a0b74d3c.js +2 -0
  81. package/dist/xv-webcomponents/p-a0b74d3c.js.map +1 -0
  82. package/dist/xv-webcomponents/xv-webcomponents.esm.js +1 -1
  83. package/dist/xv-webcomponents/xv-webcomponents.esm.js.map +1 -1
  84. package/package.json +3 -1
  85. package/dist/cjs/index-888a60d0.js.map +0 -1
  86. package/dist/cjs/xv-button-v2_2.cjs.entry.js +0 -68
  87. package/dist/cjs/xv-button-v2_2.cjs.entry.js.map +0 -1
  88. package/dist/esm/index-5147034e.js.map +0 -1
  89. package/dist/esm/xv-button-v2_2.entry.js +0 -63
  90. package/dist/esm/xv-button-v2_2.entry.js.map +0 -1
  91. package/dist/xv-webcomponents/p-186c04ea.entry.js +0 -2
  92. package/dist/xv-webcomponents/p-186c04ea.entry.js.map +0 -1
  93. package/dist/xv-webcomponents/p-b6c1c52d.js +0 -3
  94. package/dist/xv-webcomponents/p-b6c1c52d.js.map +0 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @xv/webcomponents-base
1
+ # @xv/webcomponents
2
2
 
3
3
  **Reusable Web Components for XV Applications**
4
4
  This repository contains Web Components built with Stencil.js to provide a modular and reusable UI across multiple applications.
@@ -18,7 +18,7 @@ This repository contains Web Components built with Stencil.js to provide a modul
18
18
  ## Folder Structure
19
19
 
20
20
  ```
21
- xv-webcomponents-base/
21
+ xv-webcomponents/
22
22
  │── src/
23
23
  │ ├── components/ # Web Component source files
24
24
  │ │ ├── button/
@@ -21,7 +21,7 @@ function _interopNamespace(e) {
21
21
  }
22
22
 
23
23
  const NAMESPACE = 'xv-webcomponents';
24
- const BUILD = /* xv-webcomponents */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, constructableCSS: true, cssAnnotations: true, devTools: 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: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: 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: true, slot: true, slotChildNodesFix: false, slotRelocation: false, state: false, style: false, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: false };
24
+ const BUILD = /* xv-webcomponents */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, constructableCSS: true, cssAnnotations: true, devTools: false, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: true, 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: true, lifecycleDOMEvents: false, member: true, method: true, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: false, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
25
25
 
26
26
  /*
27
27
  Stencil Client Platform v4.27.1 | MIT Licensed | https://stenciljs.com
@@ -32,6 +32,10 @@ var __export = (target, all) => {
32
32
  __defProp(target, name, { get: all[name], enumerable: true });
33
33
  };
34
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
+
35
39
  // src/client/client-host-ref.ts
36
40
  var getHostRef = (ref) => {
37
41
  if (ref.__stencil__getHostRef) {
@@ -50,6 +54,9 @@ var registerHost = (hostElement, cmpMeta) => {
50
54
  $cmpMeta$: cmpMeta,
51
55
  $instanceValues$: /* @__PURE__ */ new Map()
52
56
  };
57
+ {
58
+ hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
59
+ }
53
60
  {
54
61
  hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
55
62
  hostElement["s-p"] = [];
@@ -93,6 +100,10 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
93
100
  }
94
101
  );
95
102
  };
103
+
104
+ // src/client/client-style.ts
105
+ var styles = /* @__PURE__ */ new Map();
106
+ var HYDRATED_STYLE_ID = "sty-id";
96
107
  var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
97
108
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
98
109
  var win = typeof window !== "undefined" ? window : {};
@@ -105,7 +116,32 @@ var plt = {
105
116
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
106
117
  ce: (eventName, opts) => new CustomEvent(eventName, opts)
107
118
  };
119
+ var supportsListenerOptions = /* @__PURE__ */ (() => {
120
+ var _a;
121
+ let supportsListenerOptions2 = false;
122
+ try {
123
+ (_a = win.document) == null ? void 0 : _a.addEventListener(
124
+ "e",
125
+ null,
126
+ Object.defineProperty({}, "passive", {
127
+ get() {
128
+ supportsListenerOptions2 = true;
129
+ }
130
+ })
131
+ );
132
+ } catch (e) {
133
+ }
134
+ return supportsListenerOptions2;
135
+ })();
108
136
  var promiseResolve = (v) => Promise.resolve(v);
137
+ var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
138
+ try {
139
+ new CSSStyleSheet();
140
+ return typeof new CSSStyleSheet().replaceSync === "function";
141
+ } catch (e) {
142
+ }
143
+ return false;
144
+ })() ;
109
145
  var queuePending = false;
110
146
  var queueDomReads = [];
111
147
  var queueDomWrites = [];
@@ -283,6 +319,9 @@ var parsePropertyValue = (propValue, propType) => {
283
319
  if (propType & 4 /* Boolean */) {
284
320
  return propValue === "false" ? false : propValue === "" || !!propValue;
285
321
  }
322
+ if (propType & 2 /* Number */) {
323
+ return parseFloat(propValue);
324
+ }
286
325
  if (propType & 1 /* String */) {
287
326
  return String(propValue);
288
327
  }
@@ -312,6 +351,101 @@ var emitEvent = (elm, name, opts) => {
312
351
  return ev;
313
352
  };
314
353
  var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
354
+ var registerStyle = (scopeId2, cssText, allowCS) => {
355
+ let style = styles.get(scopeId2);
356
+ if (supportsConstructableStylesheets && allowCS) {
357
+ style = style || new CSSStyleSheet();
358
+ if (typeof style === "string") {
359
+ style = cssText;
360
+ } else {
361
+ style.replaceSync(cssText);
362
+ }
363
+ } else {
364
+ style = cssText;
365
+ }
366
+ styles.set(scopeId2, style);
367
+ };
368
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
369
+ var _a;
370
+ const scopeId2 = getScopeId(cmpMeta);
371
+ const style = styles.get(scopeId2);
372
+ if (!win.document) {
373
+ return scopeId2;
374
+ }
375
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
376
+ if (style) {
377
+ if (typeof style === "string") {
378
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
379
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
380
+ let styleElm;
381
+ if (!appliedStyles) {
382
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
383
+ }
384
+ if (!appliedStyles.has(scopeId2)) {
385
+ {
386
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
387
+ styleElm.innerHTML = style;
388
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
389
+ if (nonce != null) {
390
+ styleElm.setAttribute("nonce", nonce);
391
+ }
392
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
393
+ if (styleContainerNode.nodeName === "HEAD") {
394
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
395
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
396
+ styleContainerNode.insertBefore(
397
+ styleElm,
398
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
399
+ );
400
+ } else if ("host" in styleContainerNode) {
401
+ if (supportsConstructableStylesheets) {
402
+ const stylesheet = new CSSStyleSheet();
403
+ stylesheet.replaceSync(style);
404
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
405
+ } else {
406
+ const existingStyleContainer = styleContainerNode.querySelector("style");
407
+ if (existingStyleContainer) {
408
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
409
+ } else {
410
+ styleContainerNode.prepend(styleElm);
411
+ }
412
+ }
413
+ } else {
414
+ styleContainerNode.append(styleElm);
415
+ }
416
+ }
417
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
418
+ styleContainerNode.insertBefore(styleElm, null);
419
+ }
420
+ }
421
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
422
+ styleElm.innerHTML += SLOT_FB_CSS;
423
+ }
424
+ if (appliedStyles) {
425
+ appliedStyles.add(scopeId2);
426
+ }
427
+ }
428
+ } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
429
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
430
+ }
431
+ }
432
+ return scopeId2;
433
+ };
434
+ var attachStyles = (hostRef) => {
435
+ const cmpMeta = hostRef.$cmpMeta$;
436
+ const elm = hostRef.$hostElement$;
437
+ const flags = cmpMeta.$flags$;
438
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
439
+ const scopeId2 = addStyle(
440
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
441
+ cmpMeta);
442
+ if ((flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */ || flags & 128 /* shadowNeedsScopedCss */)) {
443
+ elm["s-sc"] = scopeId2;
444
+ elm.classList.add(scopeId2 + "-h");
445
+ }
446
+ endAttachStyles();
447
+ };
448
+ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
315
449
  var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
316
450
  if (oldValue === newValue) {
317
451
  return;
@@ -326,6 +460,27 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
326
460
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
327
461
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
328
462
  }
463
+ } else if (memberName === "style") {
464
+ {
465
+ for (const prop in oldValue) {
466
+ if (!newValue || newValue[prop] == null) {
467
+ if (prop.includes("-")) {
468
+ elm.style.removeProperty(prop);
469
+ } else {
470
+ elm.style[prop] = "";
471
+ }
472
+ }
473
+ }
474
+ }
475
+ for (const prop in newValue) {
476
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
477
+ if (prop.includes("-")) {
478
+ elm.style.setProperty(prop, newValue[prop]);
479
+ } else {
480
+ elm.style[prop] = newValue[prop];
481
+ }
482
+ }
483
+ }
329
484
  } else if (memberName === "key") ; else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
330
485
  if (memberName[2] === "-") {
331
486
  memberName = memberName.slice(3);
@@ -440,14 +595,21 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
440
595
  if (newVNode2.$text$ !== null) {
441
596
  elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
442
597
  } else {
598
+ if (!isSvgMode) {
599
+ isSvgMode = newVNode2.$tag$ === "svg";
600
+ }
443
601
  if (!win.document) {
444
602
  throw new Error(
445
603
  "You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
446
604
  );
447
605
  }
448
- elm = newVNode2.$elm$ = win.document.createElement(
606
+ elm = newVNode2.$elm$ = win.document.createElementNS(
607
+ isSvgMode ? SVG_NS : HTML_NS,
449
608
  !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
450
- );
609
+ ) ;
610
+ if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
611
+ isSvgMode = false;
612
+ }
451
613
  {
452
614
  updateElement(null, newVNode2, isSvgMode);
453
615
  }
@@ -459,6 +621,13 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
459
621
  }
460
622
  }
461
623
  }
624
+ {
625
+ if (newVNode2.$tag$ === "svg") {
626
+ isSvgMode = false;
627
+ } else if (elm.tagName === "foreignObject") {
628
+ isSvgMode = true;
629
+ }
630
+ }
462
631
  }
463
632
  elm["s-hn"] = hostTagName;
464
633
  return elm;
@@ -590,8 +759,12 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
590
759
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
591
760
  const oldChildren = oldVNode.$children$;
592
761
  const newChildren = newVNode2.$children$;
762
+ const tag = newVNode2.$tag$;
593
763
  const text = newVNode2.$text$;
594
764
  if (text === null) {
765
+ {
766
+ isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
767
+ }
595
768
  {
596
769
  updateElement(oldVNode, newVNode2, isSvgMode);
597
770
  }
@@ -608,6 +781,9 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
608
781
  ) {
609
782
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
610
783
  }
784
+ if (isSvgMode && tag === "svg") {
785
+ isSvgMode = false;
786
+ }
611
787
  } else if (oldVNode.$text$ !== text) {
612
788
  elm.data = text;
613
789
  }
@@ -674,6 +850,13 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
674
850
  }
675
851
  let maybePromise;
676
852
  if (isInitialLoad) {
853
+ {
854
+ hostRef.$flags$ |= 256 /* isListenReady */;
855
+ if (hostRef.$queuedListeners$) {
856
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event, elm));
857
+ hostRef.$queuedListeners$ = void 0;
858
+ }
859
+ }
677
860
  maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
678
861
  } else {
679
862
  maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
@@ -692,6 +875,9 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
692
875
  const elm = hostRef.$hostElement$;
693
876
  const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
694
877
  const rc = elm["s-rc"];
878
+ if (isInitialLoad) {
879
+ attachStyles(hostRef);
880
+ }
695
881
  const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
696
882
  {
697
883
  callRender(hostRef, instance, elm, isInitialLoad);
@@ -759,6 +945,9 @@ var postUpdateComponent = (hostRef) => {
759
945
  safeCall(instance, "componentDidUpdate", void 0, elm);
760
946
  endPostUpdate();
761
947
  }
948
+ {
949
+ hostRef.$onInstanceResolve$(elm);
950
+ }
762
951
  {
763
952
  if (hostRef.$onRenderResolve$) {
764
953
  hostRef.$onRenderResolve$();
@@ -797,6 +986,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
797
986
  `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`
798
987
  );
799
988
  }
989
+ const elm = hostRef.$hostElement$ ;
800
990
  const oldVal = hostRef.$instanceValues$.get(propName);
801
991
  const flags = hostRef.$flags$;
802
992
  const instance = hostRef.$lazyInstance$ ;
@@ -806,6 +996,18 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
806
996
  if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
807
997
  hostRef.$instanceValues$.set(propName, newVal);
808
998
  if (instance) {
999
+ if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1000
+ const watchMethods = cmpMeta.$watchers$[propName];
1001
+ if (watchMethods) {
1002
+ watchMethods.map((watchMethodName) => {
1003
+ try {
1004
+ instance[watchMethodName](newVal, oldVal, propName);
1005
+ } catch (e) {
1006
+ consoleError(e, elm);
1007
+ }
1008
+ });
1009
+ }
1010
+ }
809
1011
  if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
810
1012
  if (instance.componentShouldUpdate) {
811
1013
  if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
@@ -822,7 +1024,10 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
822
1024
  var proxyComponent = (Cstr, cmpMeta, flags) => {
823
1025
  var _a, _b;
824
1026
  const prototype = Cstr.prototype;
825
- if (cmpMeta.$members$ || BUILD.watchCallback ) {
1027
+ if (cmpMeta.$members$ || (cmpMeta.$watchers$ || Cstr.watchers)) {
1028
+ if (Cstr.watchers && !cmpMeta.$watchers$) {
1029
+ cmpMeta.$watchers$ = Cstr.watchers;
1030
+ }
826
1031
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
827
1032
  members.map(([memberName, [memberFlags]]) => {
828
1033
  if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
@@ -889,6 +1094,17 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
889
1094
  }
890
1095
  }
891
1096
  });
1097
+ } else if (flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
1098
+ Object.defineProperty(prototype, memberName, {
1099
+ value(...args) {
1100
+ var _a2;
1101
+ const ref = getHostRef(this);
1102
+ return (_a2 = ref == null ? void 0 : ref.$onInstancePromise$) == null ? void 0 : _a2.then(() => {
1103
+ var _a3;
1104
+ return (_a3 = ref.$lazyInstance$) == null ? void 0 : _a3[memberName](...args);
1105
+ });
1106
+ }
1107
+ });
892
1108
  }
893
1109
  });
894
1110
  if ((flags & 1 /* isElementConstructor */)) {
@@ -958,6 +1174,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
958
1174
  throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
959
1175
  }
960
1176
  if (!Cstr.isProxied) {
1177
+ {
1178
+ cmpMeta.$watchers$ = Cstr.watchers;
1179
+ }
961
1180
  proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
962
1181
  Cstr.isProxied = true;
963
1182
  }
@@ -973,6 +1192,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
973
1192
  {
974
1193
  hostRef.$flags$ &= ~8 /* isConstructingInstance */;
975
1194
  }
1195
+ {
1196
+ hostRef.$flags$ |= 128 /* isWatchReady */;
1197
+ }
976
1198
  endNewInstance();
977
1199
  fireConnectedCallback(hostRef.$lazyInstance$, elm);
978
1200
  } else {
@@ -980,6 +1202,18 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
980
1202
  const cmpTag = elm.localName;
981
1203
  customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
982
1204
  }
1205
+ if (Cstr && Cstr.style) {
1206
+ let style;
1207
+ if (typeof Cstr.style === "string") {
1208
+ style = Cstr.style;
1209
+ }
1210
+ const scopeId2 = getScopeId(cmpMeta);
1211
+ if (!styles.has(scopeId2)) {
1212
+ const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
1213
+ registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1214
+ endRegisterStyles();
1215
+ }
1216
+ }
983
1217
  }
984
1218
  const ancestorComponent = hostRef.$ancestorComponent$;
985
1219
  const schedule = () => scheduleUpdate(hostRef, true);
@@ -1025,6 +1259,7 @@ var connectedCallback = (elm) => {
1025
1259
  initializeComponent(elm, hostRef, cmpMeta);
1026
1260
  }
1027
1261
  } else {
1262
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1028
1263
  if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1029
1264
  fireConnectedCallback(hostRef.$lazyInstance$, elm);
1030
1265
  } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
@@ -1042,6 +1277,12 @@ var disconnectInstance = (instance, elm) => {
1042
1277
  var disconnectedCallback = async (elm) => {
1043
1278
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1044
1279
  const hostRef = getHostRef(elm);
1280
+ {
1281
+ if (hostRef.$rmListeners$) {
1282
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
1283
+ hostRef.$rmListeners$ = void 0;
1284
+ }
1285
+ }
1045
1286
  if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1046
1287
  disconnectInstance(hostRef.$lazyInstance$, elm);
1047
1288
  } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
@@ -1078,6 +1319,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1078
1319
  let hasSlotRelocation = false;
1079
1320
  lazyBundles.map((lazyBundle) => {
1080
1321
  lazyBundle[1].map((compactMeta) => {
1322
+ var _a2;
1081
1323
  const cmpMeta = {
1082
1324
  $flags$: compactMeta[0],
1083
1325
  $tagName$: compactMeta[1],
@@ -1090,6 +1332,12 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1090
1332
  {
1091
1333
  cmpMeta.$members$ = compactMeta[2];
1092
1334
  }
1335
+ {
1336
+ cmpMeta.$listeners$ = compactMeta[3];
1337
+ }
1338
+ {
1339
+ cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
1340
+ }
1093
1341
  const tagName = cmpMeta.$tagName$;
1094
1342
  const HostElement = class extends HTMLElement {
1095
1343
  // StencilLazyHost
@@ -1115,9 +1363,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1115
1363
  }
1116
1364
  }
1117
1365
  connectedCallback() {
1118
- getHostRef(this);
1366
+ const hostRef = getHostRef(this);
1119
1367
  if (!this.hasRegisteredEventListeners) {
1120
1368
  this.hasRegisteredEventListeners = true;
1369
+ addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
1121
1370
  }
1122
1371
  if (appLoadFallback) {
1123
1372
  clearTimeout(appLoadFallback);
@@ -1183,10 +1432,46 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1183
1432
  }
1184
1433
  endBootstrap();
1185
1434
  };
1435
+ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1436
+ if (listeners && win.document) {
1437
+ listeners.map(([flags, name, method]) => {
1438
+ const target = getHostListenerTarget(win.document, elm, flags) ;
1439
+ const handler = hostListenerProxy(hostRef, method);
1440
+ const opts = hostListenerOpts(flags);
1441
+ plt.ael(target, name, handler, opts);
1442
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1443
+ });
1444
+ }
1445
+ };
1446
+ var hostListenerProxy = (hostRef, methodName) => (ev) => {
1447
+ var _a;
1448
+ try {
1449
+ {
1450
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
1451
+ (_a = hostRef.$lazyInstance$) == null ? void 0 : _a[methodName](ev);
1452
+ } else {
1453
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1454
+ }
1455
+ }
1456
+ } catch (e) {
1457
+ consoleError(e, hostRef.$hostElement$);
1458
+ }
1459
+ };
1460
+ var getHostListenerTarget = (doc, elm, flags) => {
1461
+ if (flags & 16 /* TargetBody */) {
1462
+ return doc.body;
1463
+ }
1464
+ return elm;
1465
+ };
1466
+ var hostListenerOpts = (flags) => supportsListenerOptions ? {
1467
+ passive: (flags & 1 /* Passive */) !== 0,
1468
+ capture: (flags & 2 /* Capture */) !== 0
1469
+ } : (flags & 2 /* Capture */) !== 0;
1186
1470
 
1187
1471
  // src/runtime/nonce.ts
1188
1472
  var setNonce = (nonce) => plt.$nonce$ = nonce;
1189
1473
 
1474
+ exports.Host = Host;
1190
1475
  exports.bootstrapLazy = bootstrapLazy;
1191
1476
  exports.createEvent = createEvent;
1192
1477
  exports.getElement = getElement;
@@ -1195,4 +1480,4 @@ exports.promiseResolve = promiseResolve;
1195
1480
  exports.registerInstance = registerInstance;
1196
1481
  exports.setNonce = setNonce;
1197
1482
 
1198
- //# sourceMappingURL=index-888a60d0.js.map
1483
+ //# sourceMappingURL=index-4d938647.js.map