@mgdis/mg-components 4.2.0 → 4.2.1

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 (50) hide show
  1. package/dist/cjs/{index-64cee0c8.js → index-94497267.js} +220 -202
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/mg-badge_23.cjs.entry.js +21 -9
  4. package/dist/cjs/mg-components.cjs.js +2 -2
  5. package/dist/cjs/mg-modal.cjs.entry.js +9 -3
  6. package/dist/cjs/mg-popover.cjs.entry.js +3 -3
  7. package/dist/cjs/{popper-71bf3058.js → popper-11d5f714.js} +60 -49
  8. package/dist/collection/collection-manifest.json +1 -1
  9. package/dist/collection/components/atoms/mg-badge/mg-badge.js +3 -1
  10. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +3 -1
  11. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +3 -1
  12. package/dist/collection/components/molecules/inputs/MgInput.js +3 -1
  13. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
  14. package/dist/collection/components/molecules/mg-modal/mg-modal.css +2 -2
  15. package/dist/collection/components/molecules/mg-modal/mg-modal.js +7 -1
  16. package/dist/collection/components/molecules/mg-panel/mg-panel.js +3 -1
  17. package/dist/collection/components/molecules/mg-popover/mg-popover.css +3 -5
  18. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +3 -1
  19. package/dist/components/MgInput.js +3 -1
  20. package/dist/components/mg-badge2.js +3 -1
  21. package/dist/components/mg-input-numeric.js +1 -1
  22. package/dist/components/mg-input-title2.js +3 -1
  23. package/dist/components/mg-modal.js +8 -2
  24. package/dist/components/mg-panel.js +3 -1
  25. package/dist/components/mg-popover.js +1 -1
  26. package/dist/components/mg-tabs.js +3 -1
  27. package/dist/components/mg-tooltip2.js +3 -1
  28. package/dist/components/popper.js +60 -49
  29. package/dist/esm/{index-120f47fd.js → index-aad0184c.js} +220 -202
  30. package/dist/esm/loader.js +2 -2
  31. package/dist/esm/mg-badge_23.entry.js +21 -9
  32. package/dist/esm/mg-components.js +2 -2
  33. package/dist/esm/mg-modal.entry.js +9 -3
  34. package/dist/esm/mg-popover.entry.js +3 -3
  35. package/dist/esm/polyfills/css-shim.js +1 -1
  36. package/dist/esm/{popper-93ecb064.js → popper-f860750c.js} +60 -49
  37. package/dist/mg-components/mg-components.css +1 -1
  38. package/dist/mg-components/mg-components.esm.js +1 -1
  39. package/dist/mg-components/p-25452f60.entry.js +1 -0
  40. package/dist/mg-components/p-3899d5d2.js +2 -0
  41. package/dist/mg-components/p-a20fc541.entry.js +1 -0
  42. package/dist/mg-components/{p-b380a0df.entry.js → p-e08bc19a.entry.js} +1 -1
  43. package/dist/mg-components/p-ec26fc38.js +1 -0
  44. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +1 -0
  45. package/dist/types/stencil-public-runtime.d.ts +15 -4
  46. package/package.json +2 -2
  47. package/dist/mg-components/p-21991be8.entry.js +0 -1
  48. package/dist/mg-components/p-36a64f8c.entry.js +0 -1
  49. package/dist/mg-components/p-4c66f794.js +0 -1
  50. package/dist/mg-components/p-7bc32a2f.js +0 -2
@@ -158,38 +158,57 @@ var max = Math.max;
158
158
  var min = Math.min;
159
159
  var round = Math.round;
160
160
 
161
- function getBoundingClientRect(element, includeScale) {
161
+ function getUAString() {
162
+ var uaData = navigator.userAgentData;
163
+
164
+ if (uaData != null && uaData.brands) {
165
+ return uaData.brands.map(function (item) {
166
+ return item.brand + "/" + item.version;
167
+ }).join(' ');
168
+ }
169
+
170
+ return navigator.userAgent;
171
+ }
172
+
173
+ function isLayoutViewport() {
174
+ return !/^((?!chrome|android).)*safari/i.test(getUAString());
175
+ }
176
+
177
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
162
178
  if (includeScale === void 0) {
163
179
  includeScale = false;
164
180
  }
165
181
 
166
- var rect = element.getBoundingClientRect();
182
+ if (isFixedStrategy === void 0) {
183
+ isFixedStrategy = false;
184
+ }
185
+
186
+ var clientRect = element.getBoundingClientRect();
167
187
  var scaleX = 1;
168
188
  var scaleY = 1;
169
189
 
170
- if (isHTMLElement(element) && includeScale) {
171
- var offsetHeight = element.offsetHeight;
172
- var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
173
- // Fallback to 1 in case both values are `0`
174
-
175
- if (offsetWidth > 0) {
176
- scaleX = round(rect.width) / offsetWidth || 1;
177
- }
178
-
179
- if (offsetHeight > 0) {
180
- scaleY = round(rect.height) / offsetHeight || 1;
181
- }
190
+ if (includeScale && isHTMLElement(element)) {
191
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
192
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
182
193
  }
183
194
 
195
+ var _ref = isElement(element) ? getWindow(element) : window,
196
+ visualViewport = _ref.visualViewport;
197
+
198
+ var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
199
+ var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
200
+ var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
201
+ var width = clientRect.width / scaleX;
202
+ var height = clientRect.height / scaleY;
184
203
  return {
185
- width: rect.width / scaleX,
186
- height: rect.height / scaleY,
187
- top: rect.top / scaleY,
188
- right: rect.right / scaleX,
189
- bottom: rect.bottom / scaleY,
190
- left: rect.left / scaleX,
191
- x: rect.left / scaleX,
192
- y: rect.top / scaleY
204
+ width: width,
205
+ height: height,
206
+ top: y,
207
+ right: x + width,
208
+ bottom: y + height,
209
+ left: x,
210
+ x: x,
211
+ y: y
193
212
  };
194
213
  }
195
214
 
@@ -284,8 +303,8 @@ function getTrueOffsetParent(element) {
284
303
 
285
304
 
286
305
  function getContainingBlock(element) {
287
- var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
288
- var isIE = navigator.userAgent.indexOf('Trident') !== -1;
306
+ var isFirefox = /firefox/i.test(getUAString());
307
+ var isIE = /Trident/i.test(getUAString());
289
308
 
290
309
  if (isIE && isHTMLElement(element)) {
291
310
  // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
@@ -706,31 +725,21 @@ function getWindowScrollBarX(element) {
706
725
  return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
707
726
  }
708
727
 
709
- function getViewportRect(element) {
728
+ function getViewportRect(element, strategy) {
710
729
  var win = getWindow(element);
711
730
  var html = getDocumentElement(element);
712
731
  var visualViewport = win.visualViewport;
713
732
  var width = html.clientWidth;
714
733
  var height = html.clientHeight;
715
734
  var x = 0;
716
- var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
717
- // can be obscured underneath it.
718
- // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
719
- // if it isn't open, so if this isn't available, the popper will be detected
720
- // to overflow the bottom of the screen too early.
735
+ var y = 0;
721
736
 
722
737
  if (visualViewport) {
723
738
  width = visualViewport.width;
724
- height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
725
- // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
726
- // errors due to floating point numbers, so we need to check precision.
727
- // Safari returns a number <= 0, usually < -1 when pinch-zoomed
728
- // Feature detection fails in mobile emulation mode in Chrome.
729
- // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
730
- // 0.001
731
- // Fallback here: "Not Safari" userAgent
732
-
733
- if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
739
+ height = visualViewport.height;
740
+ var layoutViewport = isLayoutViewport();
741
+
742
+ if (layoutViewport || !layoutViewport && strategy === 'fixed') {
734
743
  x = visualViewport.offsetLeft;
735
744
  y = visualViewport.offsetTop;
736
745
  }
@@ -824,8 +833,8 @@ function rectToClientRect(rect) {
824
833
  });
825
834
  }
826
835
 
827
- function getInnerBoundingClientRect(element) {
828
- var rect = getBoundingClientRect(element);
836
+ function getInnerBoundingClientRect(element, strategy) {
837
+ var rect = getBoundingClientRect(element, false, strategy === 'fixed');
829
838
  rect.top = rect.top + element.clientTop;
830
839
  rect.left = rect.left + element.clientLeft;
831
840
  rect.bottom = rect.top + element.clientHeight;
@@ -837,8 +846,8 @@ function getInnerBoundingClientRect(element) {
837
846
  return rect;
838
847
  }
839
848
 
840
- function getClientRectFromMixedType(element, clippingParent) {
841
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
849
+ function getClientRectFromMixedType(element, clippingParent, strategy) {
850
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
842
851
  } // A "clipping parent" is an overflowable container with the characteristic of
843
852
  // clipping (or hiding) overflowing elements with a position different from
844
853
  // `initial`
@@ -861,18 +870,18 @@ function getClippingParents(element) {
861
870
  // clipping parents
862
871
 
863
872
 
864
- function getClippingRect(element, boundary, rootBoundary) {
873
+ function getClippingRect(element, boundary, rootBoundary, strategy) {
865
874
  var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
866
875
  var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
867
876
  var firstClippingParent = clippingParents[0];
868
877
  var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
869
- var rect = getClientRectFromMixedType(element, clippingParent);
878
+ var rect = getClientRectFromMixedType(element, clippingParent, strategy);
870
879
  accRect.top = max(rect.top, accRect.top);
871
880
  accRect.right = min(rect.right, accRect.right);
872
881
  accRect.bottom = min(rect.bottom, accRect.bottom);
873
882
  accRect.left = max(rect.left, accRect.left);
874
883
  return accRect;
875
- }, getClientRectFromMixedType(element, firstClippingParent));
884
+ }, getClientRectFromMixedType(element, firstClippingParent, strategy));
876
885
  clippingRect.width = clippingRect.right - clippingRect.left;
877
886
  clippingRect.height = clippingRect.bottom - clippingRect.top;
878
887
  clippingRect.x = clippingRect.left;
@@ -953,6 +962,8 @@ function detectOverflow(state, options) {
953
962
  var _options = options,
954
963
  _options$placement = _options.placement,
955
964
  placement = _options$placement === void 0 ? state.placement : _options$placement,
965
+ _options$strategy = _options.strategy,
966
+ strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
956
967
  _options$boundary = _options.boundary,
957
968
  boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
958
969
  _options$rootBoundary = _options.rootBoundary,
@@ -967,7 +978,7 @@ function detectOverflow(state, options) {
967
978
  var altContext = elementContext === popper ? reference : popper;
968
979
  var popperRect = state.rects.popper;
969
980
  var element = state.elements[altBoundary ? altContext : elementContext];
970
- var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
981
+ var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
971
982
  var referenceClientRect = getBoundingClientRect(state.elements.reference);
972
983
  var popperOffsets = computeOffsets({
973
984
  reference: referenceClientRect,
@@ -1481,7 +1492,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1481
1492
  var isOffsetParentAnElement = isHTMLElement(offsetParent);
1482
1493
  var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1483
1494
  var documentElement = getDocumentElement(offsetParent);
1484
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1495
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
1485
1496
  var scroll = {
1486
1497
  scrollLeft: 0,
1487
1498
  scrollTop: 0
@@ -1,5 +1,13 @@
1
1
  const NAMESPACE = 'mg-components';
2
2
 
3
+ /**
4
+ * Virtual DOM patching algorithm based on Snabbdom by
5
+ * Simon Friis Vindum (@paldepind)
6
+ * Licensed under the MIT License
7
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
8
+ *
9
+ * Modified for Stencil's renderer and slot projection
10
+ */
3
11
  let scopeId;
4
12
  let contentRef;
5
13
  let hostTagName;
@@ -8,62 +16,6 @@ let checkSlotFallbackVisibility = false;
8
16
  let checkSlotRelocate = false;
9
17
  let isSvgMode = false;
10
18
  let queuePending = false;
11
- const win = typeof window !== 'undefined' ? window : {};
12
- const doc = win.document || { head: {} };
13
- const plt = {
14
- $flags$: 0,
15
- $resourcesUrl$: '',
16
- jmp: (h) => h(),
17
- raf: (h) => requestAnimationFrame(h),
18
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
19
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
20
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
21
- };
22
- const promiseResolve = (v) => Promise.resolve(v);
23
- const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
24
- try {
25
- new CSSStyleSheet();
26
- return typeof new CSSStyleSheet().replaceSync === 'function';
27
- }
28
- catch (e) { }
29
- return false;
30
- })()
31
- ;
32
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
33
- if (listeners) {
34
- listeners.map(([flags, name, method]) => {
35
- const target = getHostListenerTarget(elm, flags) ;
36
- const handler = hostListenerProxy(hostRef, method);
37
- const opts = hostListenerOpts(flags);
38
- plt.ael(target, name, handler, opts);
39
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
40
- });
41
- }
42
- };
43
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
44
- try {
45
- {
46
- if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
47
- // instance is ready, let's call it's member method for this event
48
- hostRef.$lazyInstance$[methodName](ev);
49
- }
50
- else {
51
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
52
- }
53
- }
54
- }
55
- catch (e) {
56
- consoleError(e);
57
- }
58
- };
59
- const getHostListenerTarget = (elm, flags) => {
60
- if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
61
- return win;
62
- return elm;
63
- };
64
- // prettier-ignore
65
- const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
66
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
67
19
  const createTime = (fnName, tagName = '') => {
68
20
  {
69
21
  return () => {
@@ -78,79 +30,7 @@ const uniqueTime = (key, measureText) => {
78
30
  };
79
31
  }
80
32
  };
81
- const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
82
- const registerStyle = (scopeId, cssText, allowCS) => {
83
- let style = styles.get(scopeId);
84
- if (supportsConstructableStylesheets && allowCS) {
85
- style = (style || new CSSStyleSheet());
86
- if (typeof style === 'string') {
87
- style = cssText;
88
- }
89
- else {
90
- style.replaceSync(cssText);
91
- }
92
- }
93
- else {
94
- style = cssText;
95
- }
96
- styles.set(scopeId, style);
97
- };
98
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
99
- let scopeId = getScopeId(cmpMeta);
100
- const style = styles.get(scopeId);
101
- // if an element is NOT connected then getRootNode() will return the wrong root node
102
- // so the fallback is to always use the document for the root node in those cases
103
- styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
104
- if (style) {
105
- if (typeof style === 'string') {
106
- styleContainerNode = styleContainerNode.head || styleContainerNode;
107
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
108
- let styleElm;
109
- if (!appliedStyles) {
110
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
111
- }
112
- if (!appliedStyles.has(scopeId)) {
113
- {
114
- {
115
- styleElm = doc.createElement('style');
116
- styleElm.innerHTML = style;
117
- }
118
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
119
- }
120
- if (appliedStyles) {
121
- appliedStyles.add(scopeId);
122
- }
123
- }
124
- }
125
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
126
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
127
- }
128
- }
129
- return scopeId;
130
- };
131
- const attachStyles = (hostRef) => {
132
- const cmpMeta = hostRef.$cmpMeta$;
133
- const elm = hostRef.$hostElement$;
134
- const flags = cmpMeta.$flags$;
135
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
136
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
137
- if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
138
- // only required when we're NOT using native shadow dom (slot)
139
- // or this browser doesn't support native shadow dom
140
- // and this host element was NOT created with SSR
141
- // let's pick out the inner content for slot projection
142
- // create a node to represent where the original
143
- // content was first placed, which is useful later on
144
- // DOM WRITE!!
145
- elm['s-sc'] = scopeId;
146
- elm.classList.add(scopeId + '-h');
147
- if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
148
- elm.classList.add(scopeId + '-s');
149
- }
150
- }
151
- endAttachStyles();
152
- };
153
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
33
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
154
34
  /**
155
35
  * Default style mode id
156
36
  */
@@ -288,6 +168,152 @@ const convertToPrivate = (node) => {
288
168
  vnode.$name$ = node.vname;
289
169
  return vnode;
290
170
  };
171
+ /**
172
+ * Parse a new property value for a given property type.
173
+ *
174
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
175
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
176
+ * 1. `any`, the type given to `propValue` in the function signature
177
+ * 2. the type stored from `propType`.
178
+ *
179
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
180
+ *
181
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
182
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
183
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
184
+ * ```tsx
185
+ * <my-cmp prop-val={0}></my-cmp>
186
+ * ```
187
+ *
188
+ * HTML prop values on the other hand, will always a string
189
+ *
190
+ * @param propValue the new value to coerce to some type
191
+ * @param propType the type of the prop, expressed as a binary number
192
+ * @returns the parsed/coerced value
193
+ */
194
+ const parsePropertyValue = (propValue, propType) => {
195
+ // ensure this value is of the correct prop type
196
+ if (propValue != null && !isComplexType(propValue)) {
197
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
198
+ // per the HTML spec, any string value means it is a boolean true value
199
+ // but we'll cheat here and say that the string "false" is the boolean false
200
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
201
+ }
202
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
203
+ // force it to be a number
204
+ return parseFloat(propValue);
205
+ }
206
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
207
+ // could have been passed as a number or boolean
208
+ // but we still want it as a string
209
+ return String(propValue);
210
+ }
211
+ // redundant return here for better minification
212
+ return propValue;
213
+ }
214
+ // not sure exactly what type we want
215
+ // so no need to change to a different type
216
+ return propValue;
217
+ };
218
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
219
+ const createEvent = (ref, name, flags) => {
220
+ const elm = getElement(ref);
221
+ return {
222
+ emit: (detail) => {
223
+ return emitEvent(elm, name, {
224
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
225
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
226
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
227
+ detail,
228
+ });
229
+ },
230
+ };
231
+ };
232
+ /**
233
+ * Helper function to create & dispatch a custom Event on a provided target
234
+ * @param elm the target of the Event
235
+ * @param name the name to give the custom Event
236
+ * @param opts options for configuring a custom Event
237
+ * @returns the custom Event
238
+ */
239
+ const emitEvent = (elm, name, opts) => {
240
+ const ev = plt.ce(name, opts);
241
+ elm.dispatchEvent(ev);
242
+ return ev;
243
+ };
244
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
245
+ const registerStyle = (scopeId, cssText, allowCS) => {
246
+ let style = styles.get(scopeId);
247
+ if (supportsConstructableStylesheets && allowCS) {
248
+ style = (style || new CSSStyleSheet());
249
+ if (typeof style === 'string') {
250
+ style = cssText;
251
+ }
252
+ else {
253
+ style.replaceSync(cssText);
254
+ }
255
+ }
256
+ else {
257
+ style = cssText;
258
+ }
259
+ styles.set(scopeId, style);
260
+ };
261
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
262
+ let scopeId = getScopeId(cmpMeta);
263
+ const style = styles.get(scopeId);
264
+ // if an element is NOT connected then getRootNode() will return the wrong root node
265
+ // so the fallback is to always use the document for the root node in those cases
266
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
267
+ if (style) {
268
+ if (typeof style === 'string') {
269
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
270
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
271
+ let styleElm;
272
+ if (!appliedStyles) {
273
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
274
+ }
275
+ if (!appliedStyles.has(scopeId)) {
276
+ {
277
+ {
278
+ styleElm = doc.createElement('style');
279
+ styleElm.innerHTML = style;
280
+ }
281
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
282
+ }
283
+ if (appliedStyles) {
284
+ appliedStyles.add(scopeId);
285
+ }
286
+ }
287
+ }
288
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
289
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
290
+ }
291
+ }
292
+ return scopeId;
293
+ };
294
+ const attachStyles = (hostRef) => {
295
+ const cmpMeta = hostRef.$cmpMeta$;
296
+ const elm = hostRef.$hostElement$;
297
+ const flags = cmpMeta.$flags$;
298
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
299
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
300
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
301
+ // only required when we're NOT using native shadow dom (slot)
302
+ // or this browser doesn't support native shadow dom
303
+ // and this host element was NOT created with SSR
304
+ // let's pick out the inner content for slot projection
305
+ // create a node to represent where the original
306
+ // content was first placed, which is useful later on
307
+ // DOM WRITE!!
308
+ elm['s-sc'] = scopeId;
309
+ elm.classList.add(scopeId + '-h');
310
+ if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
311
+ elm.classList.add(scopeId + '-s');
312
+ }
313
+ }
314
+ endAttachStyles();
315
+ };
316
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
291
317
  /**
292
318
  * Production setAccessor() function based on Preact by
293
319
  * Jason Miller (@developit)
@@ -1150,32 +1176,6 @@ const renderVdom = (hostRef, renderFnResults) => {
1150
1176
  relocateNodes.length = 0;
1151
1177
  }
1152
1178
  };
1153
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
1154
- const createEvent = (ref, name, flags) => {
1155
- const elm = getElement(ref);
1156
- return {
1157
- emit: (detail) => {
1158
- return emitEvent(elm, name, {
1159
- bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
1160
- composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
1161
- cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
1162
- detail,
1163
- });
1164
- },
1165
- };
1166
- };
1167
- /**
1168
- * Helper function to create & dispatch a custom Event on a provided target
1169
- * @param elm the target of the Event
1170
- * @param name the name to give the custom Event
1171
- * @param opts options for configuring a custom Event
1172
- * @returns the custom Event
1173
- */
1174
- const emitEvent = (elm, name, opts) => {
1175
- const ev = plt.ce(name, opts);
1176
- elm.dispatchEvent(ev);
1177
- return ev;
1178
- };
1179
1179
  const attachToAncestor = (hostRef, ancestorComponent) => {
1180
1180
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1181
1181
  ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
@@ -1347,53 +1347,6 @@ const then = (promise, thenFn) => {
1347
1347
  };
1348
1348
  const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1349
1349
  ;
1350
- /**
1351
- * Parse a new property value for a given property type.
1352
- *
1353
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
1354
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
1355
- * 1. `any`, the type given to `propValue` in the function signature
1356
- * 2. the type stored from `propType`.
1357
- *
1358
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
1359
- *
1360
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
1361
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
1362
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
1363
- * ```tsx
1364
- * <my-cmp prop-val={0}></my-cmp>
1365
- * ```
1366
- *
1367
- * HTML prop values on the other hand, will always a string
1368
- *
1369
- * @param propValue the new value to coerce to some type
1370
- * @param propType the type of the prop, expressed as a binary number
1371
- * @returns the parsed/coerced value
1372
- */
1373
- const parsePropertyValue = (propValue, propType) => {
1374
- // ensure this value is of the correct prop type
1375
- if (propValue != null && !isComplexType(propValue)) {
1376
- if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
1377
- // per the HTML spec, any string value means it is a boolean true value
1378
- // but we'll cheat here and say that the string "false" is the boolean false
1379
- return propValue === 'false' ? false : propValue === '' || !!propValue;
1380
- }
1381
- if (propType & 2 /* MEMBER_FLAGS.Number */) {
1382
- // force it to be a number
1383
- return parseFloat(propValue);
1384
- }
1385
- if (propType & 1 /* MEMBER_FLAGS.String */) {
1386
- // could have been passed as a number or boolean
1387
- // but we still want it as a string
1388
- return String(propValue);
1389
- }
1390
- // redundant return here for better minification
1391
- return propValue;
1392
- }
1393
- // not sure exactly what type we want
1394
- // so no need to change to a different type
1395
- return propValue;
1396
- };
1397
1350
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1398
1351
  const setValue = (ref, propName, newVal, cmpMeta) => {
1399
1352
  // check our new property value against our internal value
@@ -1437,6 +1390,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1437
1390
  }
1438
1391
  }
1439
1392
  };
1393
+ /**
1394
+ * Attach a series of runtime constructs to a compiled Stencil component
1395
+ * constructor, including getters and setters for the `@Prop` and `@State`
1396
+ * decorators, callbacks for when attributes change, and so on.
1397
+ *
1398
+ * @param Cstr the constructor for a component that we need to process
1399
+ * @param cmpMeta metadata collected previously about the component
1400
+ * @param flags a number used to store a series of bit flags
1401
+ * @returns a reference to the same constructor passed in (but now mutated)
1402
+ */
1440
1403
  const proxyComponent = (Cstr, cmpMeta, flags) => {
1441
1404
  if (cmpMeta.$members$) {
1442
1405
  if (Cstr.watchers) {
@@ -1796,6 +1759,40 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1796
1759
  // Fallback appLoad event
1797
1760
  endBootstrap();
1798
1761
  };
1762
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1763
+ if (listeners) {
1764
+ listeners.map(([flags, name, method]) => {
1765
+ const target = getHostListenerTarget(elm, flags) ;
1766
+ const handler = hostListenerProxy(hostRef, method);
1767
+ const opts = hostListenerOpts(flags);
1768
+ plt.ael(target, name, handler, opts);
1769
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1770
+ });
1771
+ }
1772
+ };
1773
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1774
+ try {
1775
+ {
1776
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
1777
+ // instance is ready, let's call it's member method for this event
1778
+ hostRef.$lazyInstance$[methodName](ev);
1779
+ }
1780
+ else {
1781
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1782
+ }
1783
+ }
1784
+ }
1785
+ catch (e) {
1786
+ consoleError(e);
1787
+ }
1788
+ };
1789
+ const getHostListenerTarget = (elm, flags) => {
1790
+ if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
1791
+ return win;
1792
+ return elm;
1793
+ };
1794
+ // prettier-ignore
1795
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1799
1796
  const hostRefs = /*@__PURE__*/ new WeakMap();
1800
1797
  const getHostRef = (ref) => hostRefs.get(ref);
1801
1798
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1842,6 +1839,27 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1842
1839
  }, consoleError);
1843
1840
  };
1844
1841
  const styles = /*@__PURE__*/ new Map();
1842
+ const win = typeof window !== 'undefined' ? window : {};
1843
+ const doc = win.document || { head: {} };
1844
+ const plt = {
1845
+ $flags$: 0,
1846
+ $resourcesUrl$: '',
1847
+ jmp: (h) => h(),
1848
+ raf: (h) => requestAnimationFrame(h),
1849
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1850
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1851
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1852
+ };
1853
+ const promiseResolve = (v) => Promise.resolve(v);
1854
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1855
+ try {
1856
+ new CSSStyleSheet();
1857
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1858
+ }
1859
+ catch (e) { }
1860
+ return false;
1861
+ })()
1862
+ ;
1845
1863
  const queueDomReads = [];
1846
1864
  const queueDomWrites = [];
1847
1865
  const queueTask = (queue, write) => (cb) => {
@@ -1,7 +1,7 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-120f47fd.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-aad0184c.js';
2
2
 
3
3
  /*
4
- Stencil Client Patch Esm v2.18.0 | MIT Licensed | https://stenciljs.com
4
+ Stencil Client Patch Esm v2.18.1 | MIT Licensed | https://stenciljs.com
5
5
  */
6
6
  const patchEsm = () => {
7
7
  return promiseResolve();