@sankhyalabs/ezui 1.1.4 → 1.1.8

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 (186) hide show
  1. package/README.md +72 -72
  2. package/dist/{ezui/DataUnit-285bec19.js → cjs/DataUnit-28b290cb.js} +382 -369
  3. package/dist/{ezui/index-919090de.js → cjs/RequestMetadata-2cd01e8a.js} +4 -383
  4. package/dist/cjs/ez-action-chip.cjs.entry.js +52 -0
  5. package/dist/cjs/ez-button_14.cjs.entry.js +3341 -0
  6. package/dist/cjs/ez-label-chip.cjs.entry.js +131 -0
  7. package/dist/cjs/ez-modal.cjs.entry.js +115 -0
  8. package/dist/cjs/ez-number-input.cjs.entry.js +248 -0
  9. package/dist/cjs/ez-time-input.cjs.entry.js +180 -0
  10. package/dist/cjs/ezui.cjs.js +19 -0
  11. package/dist/cjs/form-metadata.cjs.entry.js +74 -0
  12. package/dist/cjs/index-9403fe8f.js +1322 -0
  13. package/dist/cjs/index.cjs.js +2 -0
  14. package/dist/cjs/loader.cjs.js +21 -0
  15. package/dist/collection/collection-manifest.json +31 -0
  16. package/dist/collection/components/ez-action-chip/ez-action-chip.css +82 -0
  17. package/dist/collection/components/ez-action-chip/ez-action-chip.js +109 -0
  18. package/dist/collection/components/ez-button/ez-button.css +94 -0
  19. package/dist/collection/components/ez-button/ez-button.js +125 -0
  20. package/dist/collection/components/ez-calendar/ez-calendar.css +210 -0
  21. package/dist/collection/components/ez-calendar/ez-calendar.js +215 -0
  22. package/dist/collection/components/ez-check/ez-check.css +266 -0
  23. package/dist/collection/components/ez-check/ez-check.js +168 -0
  24. package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.css +68 -0
  25. package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.js +108 -0
  26. package/dist/collection/components/ez-combo-box/ez-combo-box-interfaces.js +2 -0
  27. package/dist/collection/components/ez-combo-box/ez-combo-box.css +167 -0
  28. package/dist/collection/components/ez-combo-box/ez-combo-box.js +363 -0
  29. package/dist/collection/components/ez-date-input/ez-date-input.css +39 -0
  30. package/dist/collection/components/ez-date-input/ez-date-input.js +172 -0
  31. package/dist/collection/components/ez-form/ez-form.css +19 -0
  32. package/dist/collection/components/ez-form/ez-form.js +368 -0
  33. package/dist/collection/components/ez-form/store/Form.actions.js +132 -0
  34. package/dist/collection/components/ez-form/store/Form.reducer.js +194 -0
  35. package/dist/collection/components/ez-form/store/Form.selectors.js +44 -0
  36. package/dist/collection/components/ez-form/subcomponents/DataUnit.js +207 -0
  37. package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +16 -0
  38. package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +24 -0
  39. package/dist/collection/components/ez-form/subcomponents/form-metadata.js +173 -0
  40. package/dist/collection/components/ez-form/subcomponents/place-holder.js +14 -0
  41. package/dist/collection/components/ez-form/subcomponents/structure/Field.js +71 -0
  42. package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +27 -0
  43. package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +40 -0
  44. package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +27 -0
  45. package/dist/collection/components/ez-icon/ez-icon.css +37 -0
  46. package/dist/collection/components/ez-icon/ez-icon.js +56 -0
  47. package/dist/collection/components/ez-label-chip/ez-label-chip.css +117 -0
  48. package/dist/collection/components/ez-label-chip/ez-label-chip.js +276 -0
  49. package/dist/collection/components/ez-modal/ez-modal.css +87 -0
  50. package/dist/collection/components/ez-modal/ez-modal.js +224 -0
  51. package/dist/collection/components/ez-number-input/ez-number-input.css +144 -0
  52. package/dist/collection/components/ez-number-input/ez-number-input.js +465 -0
  53. package/dist/collection/components/ez-popover/ez-popover.css +39 -0
  54. package/dist/collection/components/ez-popover/ez-popover.js +323 -0
  55. package/dist/collection/components/ez-search/ez-search.css +296 -0
  56. package/dist/{ezui/ez-search.entry.js → collection/components/ez-search/ez-search.js} +527 -334
  57. package/dist/collection/components/ez-tabselector/ez-tabselector.css +126 -0
  58. package/dist/{ezui/ez-tabselector.entry.js → collection/components/ez-tabselector/ez-tabselector.js} +283 -209
  59. package/dist/collection/components/ez-text-area/ez-text-area.css +140 -0
  60. package/dist/collection/components/ez-text-area/ez-text-area.js +267 -0
  61. package/dist/collection/components/ez-text-input/ez-text-input.css +170 -0
  62. package/dist/collection/components/ez-text-input/ez-text-input.js +395 -0
  63. package/dist/collection/components/ez-time-input/ez-time-input.css +155 -0
  64. package/dist/collection/components/ez-time-input/ez-time-input.js +326 -0
  65. package/dist/collection/index.js +1 -0
  66. package/dist/collection/servidor.js +101 -0
  67. package/dist/collection/utils/FloatingManager.js +16 -0
  68. package/dist/collection/utils/utils.js +6 -0
  69. package/dist/custom-elements/index.js +5071 -0
  70. package/dist/esm/DataUnit-69e518fa.js +378 -0
  71. package/dist/esm/RequestMetadata-c265c9d5.js +527 -0
  72. package/dist/{ezui → esm}/ez-action-chip.entry.js +42 -42
  73. package/dist/esm/ez-button_14.entry.js +3324 -0
  74. package/dist/{ezui → esm}/ez-label-chip.entry.js +121 -121
  75. package/dist/{ezui → esm}/ez-modal.entry.js +105 -96
  76. package/dist/{ezui → esm}/ez-number-input.entry.js +238 -238
  77. package/dist/{ezui → esm}/ez-time-input.entry.js +170 -170
  78. package/dist/esm/ezui.js +17 -0
  79. package/dist/{ezui → esm}/form-metadata.entry.js +66 -66
  80. package/dist/esm/index-95bb3fd9.js +1293 -0
  81. package/dist/esm/index.js +1 -0
  82. package/dist/esm/loader.js +17 -0
  83. package/dist/esm/polyfills/core-js.js +11 -0
  84. package/dist/esm/polyfills/css-shim.js +1 -0
  85. package/dist/esm/polyfills/dom.js +79 -0
  86. package/dist/esm/polyfills/es5-html-element.js +1 -0
  87. package/dist/esm/polyfills/index.js +34 -0
  88. package/dist/esm/polyfills/system.js +6 -0
  89. package/dist/ezui/ezui.esm.js +1 -122
  90. package/dist/ezui/index.esm.js +0 -1
  91. package/dist/ezui/p-10ef58b3.js +1 -0
  92. package/dist/ezui/p-185c57f4.js +1 -0
  93. package/dist/ezui/p-22b82efb.entry.js +1 -0
  94. package/dist/ezui/p-77fdb4fd.entry.js +1 -0
  95. package/dist/ezui/p-9dfccb16.js +1 -0
  96. package/dist/ezui/p-b0974f4f.entry.js +1 -0
  97. package/dist/ezui/p-db11c600.entry.js +1 -0
  98. package/dist/ezui/p-dd4331b7.entry.js +1 -0
  99. package/dist/ezui/p-f6fd31ab.entry.js +1 -0
  100. package/dist/ezui/p-fa260f22.entry.js +1 -0
  101. package/dist/index.cjs.js +1 -0
  102. package/dist/index.js +1 -0
  103. package/dist/types/components/ez-action-chip/ez-action-chip.d.ts +16 -16
  104. package/dist/types/components/ez-button/ez-button.d.ts +20 -20
  105. package/dist/types/components/ez-calendar/ez-calendar.d.ts +42 -42
  106. package/dist/types/components/ez-check/ez-check.d.ts +32 -32
  107. package/dist/types/components/ez-collapsable-box/ez-collapsable-box.d.ts +18 -18
  108. package/dist/types/components/ez-combo-box/ez-combo-box-interfaces.d.ts +4 -4
  109. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +68 -68
  110. package/dist/types/components/ez-date-input/ez-date-input.d.ts +31 -31
  111. package/dist/types/components/ez-form/ez-form.d.ts +31 -27
  112. package/dist/types/components/ez-form/store/Form.actions.d.ts +111 -104
  113. package/dist/types/components/ez-form/store/Form.reducer.d.ts +20 -11
  114. package/dist/types/components/ez-form/store/Form.selectors.d.ts +14 -13
  115. package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +55 -48
  116. package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +41 -41
  117. package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +15 -15
  118. package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +3 -3
  119. package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +10 -10
  120. package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +12 -12
  121. package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +13 -13
  122. package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +17 -7
  123. package/dist/types/components/ez-icon/ez-icon.d.ts +5 -5
  124. package/dist/types/components/ez-label-chip/ez-label-chip.d.ts +40 -40
  125. package/dist/types/components/ez-modal/ez-modal.d.ts +32 -26
  126. package/dist/types/components/ez-number-input/ez-number-input.d.ts +73 -73
  127. package/dist/types/components/ez-popover/ez-popover.d.ts +52 -52
  128. package/dist/types/components/ez-search/ez-search.d.ts +95 -95
  129. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +31 -31
  130. package/dist/types/components/ez-text-area/ez-text-area.d.ts +49 -49
  131. package/dist/types/components/ez-text-input/ez-text-input.d.ts +64 -64
  132. package/dist/types/components/ez-time-input/ez-time-input.d.ts +53 -53
  133. package/dist/types/components.d.ts +8 -0
  134. package/dist/types/index.d.ts +1 -1
  135. package/dist/types/utils/utils.d.ts +2 -2
  136. package/loader/cdn.js +3 -0
  137. package/loader/index.cjs.js +3 -0
  138. package/loader/index.d.ts +13 -0
  139. package/loader/index.es2017.js +3 -0
  140. package/loader/index.js +4 -0
  141. package/loader/package.json +10 -0
  142. package/package.json +114 -114
  143. package/react/components.d.ts +22 -0
  144. package/react/components.js +25 -0
  145. package/react/components.js.map +1 -0
  146. package/react/react-component-lib/createComponent.d.ts +10 -0
  147. package/react/react-component-lib/createComponent.js +59 -0
  148. package/react/react-component-lib/createComponent.js.map +1 -0
  149. package/react/react-component-lib/createOverlayComponent.d.ts +20 -0
  150. package/react/react-component-lib/createOverlayComponent.js +89 -0
  151. package/react/react-component-lib/createOverlayComponent.js.map +1 -0
  152. package/react/react-component-lib/index.d.ts +2 -0
  153. package/react/react-component-lib/index.js +3 -0
  154. package/react/react-component-lib/index.js.map +1 -0
  155. package/react/react-component-lib/interfaces.d.ts +29 -0
  156. package/react/react-component-lib/interfaces.js +1 -0
  157. package/react/react-component-lib/interfaces.js.map +1 -0
  158. package/react/react-component-lib/utils/attachProps.d.ts +12 -0
  159. package/react/react-component-lib/utils/attachProps.js +96 -0
  160. package/react/react-component-lib/utils/attachProps.js.map +1 -0
  161. package/react/react-component-lib/utils/case.d.ts +2 -0
  162. package/react/react-component-lib/utils/case.js +7 -0
  163. package/react/react-component-lib/utils/case.js.map +1 -0
  164. package/react/react-component-lib/utils/dev.d.ts +2 -0
  165. package/react/react-component-lib/utils/dev.js +13 -0
  166. package/react/react-component-lib/utils/dev.js.map +1 -0
  167. package/react/react-component-lib/utils/index.d.ts +7 -0
  168. package/react/react-component-lib/utils/index.js +21 -0
  169. package/react/react-component-lib/utils/index.js.map +1 -0
  170. package/dist/ezui/app-globals-0f993ce5.js +0 -3
  171. package/dist/ezui/css-shim-003e9264.js +0 -4
  172. package/dist/ezui/dom-1b195079.js +0 -73
  173. package/dist/ezui/ez-button.entry.js +0 -47
  174. package/dist/ezui/ez-calendar.entry.js +0 -102
  175. package/dist/ezui/ez-check.entry.js +0 -62
  176. package/dist/ezui/ez-collapsable-box.entry.js +0 -32
  177. package/dist/ezui/ez-combo-box.entry.js +0 -181
  178. package/dist/ezui/ez-date-input.entry.js +0 -77
  179. package/dist/ezui/ez-form.entry.js +0 -1907
  180. package/dist/ezui/ez-icon.entry.js +0 -17
  181. package/dist/ezui/ez-popover.entry.js +0 -112
  182. package/dist/ezui/ez-text-area.entry.js +0 -105
  183. package/dist/ezui/ez-text-input.entry.js +0 -202
  184. package/dist/ezui/index-39044be2.js +0 -2832
  185. package/dist/ezui/place-holder.entry.js +0 -15
  186. package/dist/ezui/shadow-css-c1ad5fdc.js +0 -383
@@ -0,0 +1,1322 @@
1
+ 'use strict';
2
+
3
+ function _interopNamespace(e) {
4
+ if (e && e.__esModule) return e;
5
+ var n = Object.create(null);
6
+ if (e) {
7
+ Object.keys(e).forEach(function (k) {
8
+ if (k !== 'default') {
9
+ var d = Object.getOwnPropertyDescriptor(e, k);
10
+ Object.defineProperty(n, k, d.get ? d : {
11
+ enumerable: true,
12
+ get: function () {
13
+ return e[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n['default'] = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ const NAMESPACE = 'ezui';
24
+
25
+ let scopeId;
26
+ let hostTagName;
27
+ let isSvgMode = false;
28
+ let queuePending = false;
29
+ const win = typeof window !== 'undefined' ? window : {};
30
+ const doc = win.document || { head: {} };
31
+ const plt = {
32
+ $flags$: 0,
33
+ $resourcesUrl$: '',
34
+ jmp: h => h(),
35
+ raf: h => requestAnimationFrame(h),
36
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
37
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
38
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
39
+ };
40
+ const promiseResolve = (v) => Promise.resolve(v);
41
+ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
42
+ try {
43
+ new CSSStyleSheet();
44
+ return typeof (new CSSStyleSheet()).replace === 'function';
45
+ }
46
+ catch (e) { }
47
+ return false;
48
+ })()
49
+ ;
50
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
51
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
52
+ const createTime = (fnName, tagName = '') => {
53
+ {
54
+ return () => {
55
+ return;
56
+ };
57
+ }
58
+ };
59
+ const uniqueTime = (key, measureText) => {
60
+ {
61
+ return () => {
62
+ return;
63
+ };
64
+ }
65
+ };
66
+ const rootAppliedStyles = new WeakMap();
67
+ const registerStyle = (scopeId, cssText, allowCS) => {
68
+ let style = styles.get(scopeId);
69
+ if (supportsConstructibleStylesheets && allowCS) {
70
+ style = (style || new CSSStyleSheet());
71
+ style.replace(cssText);
72
+ }
73
+ else {
74
+ style = cssText;
75
+ }
76
+ styles.set(scopeId, style);
77
+ };
78
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
79
+ let scopeId = getScopeId(cmpMeta);
80
+ let style = styles.get(scopeId);
81
+ // if an element is NOT connected then getRootNode() will return the wrong root node
82
+ // so the fallback is to always use the document for the root node in those cases
83
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
84
+ if (style) {
85
+ if (typeof style === 'string') {
86
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
87
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
88
+ let styleElm;
89
+ if (!appliedStyles) {
90
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
91
+ }
92
+ if (!appliedStyles.has(scopeId)) {
93
+ {
94
+ {
95
+ styleElm = doc.createElement('style');
96
+ styleElm.innerHTML = style;
97
+ }
98
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
99
+ }
100
+ if (appliedStyles) {
101
+ appliedStyles.add(scopeId);
102
+ }
103
+ }
104
+ }
105
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
106
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
107
+ }
108
+ }
109
+ return scopeId;
110
+ };
111
+ const attachStyles = (hostRef) => {
112
+ const cmpMeta = hostRef.$cmpMeta$;
113
+ const elm = hostRef.$hostElement$;
114
+ const flags = cmpMeta.$flags$;
115
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
116
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
117
+ if (flags & 10 /* needsScopedEncapsulation */) {
118
+ // only required when we're NOT using native shadow dom (slot)
119
+ // or this browser doesn't support native shadow dom
120
+ // and this host element was NOT created with SSR
121
+ // let's pick out the inner content for slot projection
122
+ // create a node to represent where the original
123
+ // content was first placed, which is useful later on
124
+ // DOM WRITE!!
125
+ elm['s-sc'] = scopeId;
126
+ elm.classList.add(scopeId + '-h');
127
+ }
128
+ endAttachStyles();
129
+ };
130
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
131
+ /**
132
+ * Default style mode id
133
+ */
134
+ /**
135
+ * Reusable empty obj/array
136
+ * Don't add values to these!!
137
+ */
138
+ const EMPTY_OBJ = {};
139
+ /**
140
+ * Namespaces
141
+ */
142
+ const SVG_NS = 'http://www.w3.org/2000/svg';
143
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
144
+ const isDef = (v) => v != null;
145
+ const isComplexType = (o) => {
146
+ // https://jsperf.com/typeof-fn-object/5
147
+ o = typeof o;
148
+ return o === 'object' || o === 'function';
149
+ };
150
+ /**
151
+ * Production h() function based on Preact by
152
+ * Jason Miller (@developit)
153
+ * Licensed under the MIT License
154
+ * https://github.com/developit/preact/blob/master/LICENSE
155
+ *
156
+ * Modified for Stencil's compiler and vdom
157
+ */
158
+ // const stack: any[] = [];
159
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
160
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
161
+ const h = (nodeName, vnodeData, ...children) => {
162
+ let child = null;
163
+ let key = null;
164
+ let simple = false;
165
+ let lastSimple = false;
166
+ let vNodeChildren = [];
167
+ const walk = (c) => {
168
+ for (let i = 0; i < c.length; i++) {
169
+ child = c[i];
170
+ if (Array.isArray(child)) {
171
+ walk(child);
172
+ }
173
+ else if (child != null && typeof child !== 'boolean') {
174
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
175
+ child = String(child);
176
+ }
177
+ if (simple && lastSimple) {
178
+ // If the previous child was simple (string), we merge both
179
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
180
+ }
181
+ else {
182
+ // Append a new vNode, if it's text, we create a text vNode
183
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
184
+ }
185
+ lastSimple = simple;
186
+ }
187
+ }
188
+ };
189
+ walk(children);
190
+ if (vnodeData) {
191
+ // normalize class / classname attributes
192
+ if (vnodeData.key) {
193
+ key = vnodeData.key;
194
+ }
195
+ {
196
+ const classData = vnodeData.className || vnodeData.class;
197
+ if (classData) {
198
+ vnodeData.class =
199
+ typeof classData !== 'object'
200
+ ? classData
201
+ : Object.keys(classData)
202
+ .filter(k => classData[k])
203
+ .join(' ');
204
+ }
205
+ }
206
+ }
207
+ if (typeof nodeName === 'function') {
208
+ // nodeName is a functional component
209
+ return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
210
+ }
211
+ const vnode = newVNode(nodeName, null);
212
+ vnode.$attrs$ = vnodeData;
213
+ if (vNodeChildren.length > 0) {
214
+ vnode.$children$ = vNodeChildren;
215
+ }
216
+ {
217
+ vnode.$key$ = key;
218
+ }
219
+ return vnode;
220
+ };
221
+ const newVNode = (tag, text) => {
222
+ const vnode = {
223
+ $flags$: 0,
224
+ $tag$: tag,
225
+ $text$: text,
226
+ $elm$: null,
227
+ $children$: null,
228
+ };
229
+ {
230
+ vnode.$attrs$ = null;
231
+ }
232
+ {
233
+ vnode.$key$ = null;
234
+ }
235
+ return vnode;
236
+ };
237
+ const Host = {};
238
+ const isHost = (node) => node && node.$tag$ === Host;
239
+ const vdomFnUtils = {
240
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
241
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
242
+ };
243
+ const convertToPublic = (node) => ({
244
+ vattrs: node.$attrs$,
245
+ vchildren: node.$children$,
246
+ vkey: node.$key$,
247
+ vname: node.$name$,
248
+ vtag: node.$tag$,
249
+ vtext: node.$text$,
250
+ });
251
+ const convertToPrivate = (node) => {
252
+ if (typeof node.vtag === 'function') {
253
+ const vnodeData = Object.assign({}, node.vattrs);
254
+ if (node.vkey) {
255
+ vnodeData.key = node.vkey;
256
+ }
257
+ if (node.vname) {
258
+ vnodeData.name = node.vname;
259
+ }
260
+ return h(node.vtag, vnodeData, ...(node.vchildren || []));
261
+ }
262
+ const vnode = newVNode(node.vtag, node.vtext);
263
+ vnode.$attrs$ = node.vattrs;
264
+ vnode.$children$ = node.vchildren;
265
+ vnode.$key$ = node.vkey;
266
+ vnode.$name$ = node.vname;
267
+ return vnode;
268
+ };
269
+ /**
270
+ * Production setAccessor() function based on Preact by
271
+ * Jason Miller (@developit)
272
+ * Licensed under the MIT License
273
+ * https://github.com/developit/preact/blob/master/LICENSE
274
+ *
275
+ * Modified for Stencil's compiler and vdom
276
+ */
277
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
278
+ if (oldValue !== newValue) {
279
+ let isProp = isMemberInElement(elm, memberName);
280
+ let ln = memberName.toLowerCase();
281
+ if (memberName === 'class') {
282
+ const classList = elm.classList;
283
+ const oldClasses = parseClassList(oldValue);
284
+ const newClasses = parseClassList(newValue);
285
+ classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
286
+ classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
287
+ }
288
+ else if (memberName === 'style') {
289
+ // update style attribute, css properties and values
290
+ {
291
+ for (const prop in oldValue) {
292
+ if (!newValue || newValue[prop] == null) {
293
+ if (prop.includes('-')) {
294
+ elm.style.removeProperty(prop);
295
+ }
296
+ else {
297
+ elm.style[prop] = '';
298
+ }
299
+ }
300
+ }
301
+ }
302
+ for (const prop in newValue) {
303
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
304
+ if (prop.includes('-')) {
305
+ elm.style.setProperty(prop, newValue[prop]);
306
+ }
307
+ else {
308
+ elm.style[prop] = newValue[prop];
309
+ }
310
+ }
311
+ }
312
+ }
313
+ else if (memberName === 'key')
314
+ ;
315
+ else if (memberName === 'ref') {
316
+ // minifier will clean this up
317
+ if (newValue) {
318
+ newValue(elm);
319
+ }
320
+ }
321
+ else if ((!isProp ) && memberName[0] === 'o' && memberName[1] === 'n') {
322
+ // Event Handlers
323
+ // so if the member name starts with "on" and the 3rd characters is
324
+ // a capital letter, and it's not already a member on the element,
325
+ // then we're assuming it's an event listener
326
+ if (memberName[2] === '-') {
327
+ // on- prefixed events
328
+ // allows to be explicit about the dom event to listen without any magic
329
+ // under the hood:
330
+ // <my-cmp on-click> // listens for "click"
331
+ // <my-cmp on-Click> // listens for "Click"
332
+ // <my-cmp on-ionChange> // listens for "ionChange"
333
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
334
+ memberName = memberName.slice(3);
335
+ }
336
+ else if (isMemberInElement(win, ln)) {
337
+ // standard event
338
+ // the JSX attribute could have been "onMouseOver" and the
339
+ // member name "onmouseover" is on the window's prototype
340
+ // so let's add the listener "mouseover", which is all lowercased
341
+ memberName = ln.slice(2);
342
+ }
343
+ else {
344
+ // custom event
345
+ // the JSX attribute could have been "onMyCustomEvent"
346
+ // so let's trim off the "on" prefix and lowercase the first character
347
+ // and add the listener "myCustomEvent"
348
+ // except for the first character, we keep the event name case
349
+ memberName = ln[2] + memberName.slice(3);
350
+ }
351
+ if (oldValue) {
352
+ plt.rel(elm, memberName, oldValue, false);
353
+ }
354
+ if (newValue) {
355
+ plt.ael(elm, memberName, newValue, false);
356
+ }
357
+ }
358
+ else {
359
+ // Set property if it exists and it's not a SVG
360
+ const isComplex = isComplexType(newValue);
361
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
362
+ try {
363
+ if (!elm.tagName.includes('-')) {
364
+ let n = newValue == null ? '' : newValue;
365
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
366
+ if (memberName === 'list') {
367
+ isProp = false;
368
+ // tslint:disable-next-line: triple-equals
369
+ }
370
+ else if (oldValue == null || elm[memberName] != n) {
371
+ elm[memberName] = n;
372
+ }
373
+ }
374
+ else {
375
+ elm[memberName] = newValue;
376
+ }
377
+ }
378
+ catch (e) { }
379
+ }
380
+ /**
381
+ * Need to manually update attribute if:
382
+ * - memberName is not an attribute
383
+ * - if we are rendering the host element in order to reflect attribute
384
+ * - if it's a SVG, since properties might not work in <svg>
385
+ * - if the newValue is null/undefined or 'false'.
386
+ */
387
+ let xlink = false;
388
+ {
389
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
390
+ memberName = ln;
391
+ xlink = true;
392
+ }
393
+ }
394
+ if (newValue == null || newValue === false) {
395
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
396
+ if (xlink) {
397
+ elm.removeAttributeNS(XLINK_NS, memberName);
398
+ }
399
+ else {
400
+ elm.removeAttribute(memberName);
401
+ }
402
+ }
403
+ }
404
+ else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
405
+ newValue = newValue === true ? '' : newValue;
406
+ if (xlink) {
407
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
408
+ }
409
+ else {
410
+ elm.setAttribute(memberName, newValue);
411
+ }
412
+ }
413
+ }
414
+ }
415
+ };
416
+ const parseClassListRegex = /\s/;
417
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
418
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
419
+ // if the element passed in is a shadow root, which is a document fragment
420
+ // then we want to be adding attrs/props to the shadow root's "host" element
421
+ // if it's not a shadow root, then we add attrs/props to the same element
422
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
423
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
424
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
425
+ {
426
+ // remove attributes no longer present on the vnode by setting them to undefined
427
+ for (memberName in oldVnodeAttrs) {
428
+ if (!(memberName in newVnodeAttrs)) {
429
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
430
+ }
431
+ }
432
+ }
433
+ // add new & update changed attributes
434
+ for (memberName in newVnodeAttrs) {
435
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
436
+ }
437
+ };
438
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
439
+ // tslint:disable-next-line: prefer-const
440
+ let newVNode = newParentVNode.$children$[childIndex];
441
+ let i = 0;
442
+ let elm;
443
+ let childNode;
444
+ if (newVNode.$text$ !== null) {
445
+ // create text node
446
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
447
+ }
448
+ else {
449
+ if (!isSvgMode) {
450
+ isSvgMode = newVNode.$tag$ === 'svg';
451
+ }
452
+ // create element
453
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
454
+ );
455
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
456
+ isSvgMode = false;
457
+ }
458
+ // add css classes, attrs, props, listeners, etc.
459
+ {
460
+ updateElement(null, newVNode, isSvgMode);
461
+ }
462
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
463
+ // if there is a scopeId and this is the initial render
464
+ // then let's add the scopeId as a css class
465
+ elm.classList.add((elm['s-si'] = scopeId));
466
+ }
467
+ if (newVNode.$children$) {
468
+ for (i = 0; i < newVNode.$children$.length; ++i) {
469
+ // create the node
470
+ childNode = createElm(oldParentVNode, newVNode, i);
471
+ // return node could have been null
472
+ if (childNode) {
473
+ // append our new node
474
+ elm.appendChild(childNode);
475
+ }
476
+ }
477
+ }
478
+ {
479
+ if (newVNode.$tag$ === 'svg') {
480
+ // Only reset the SVG context when we're exiting <svg> element
481
+ isSvgMode = false;
482
+ }
483
+ else if (elm.tagName === 'foreignObject') {
484
+ // Reenter SVG context when we're exiting <foreignObject> element
485
+ isSvgMode = true;
486
+ }
487
+ }
488
+ }
489
+ return elm;
490
+ };
491
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
492
+ let containerElm = (parentElm);
493
+ let childNode;
494
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
495
+ containerElm = containerElm.shadowRoot;
496
+ }
497
+ for (; startIdx <= endIdx; ++startIdx) {
498
+ if (vnodes[startIdx]) {
499
+ childNode = createElm(null, parentVNode, startIdx);
500
+ if (childNode) {
501
+ vnodes[startIdx].$elm$ = childNode;
502
+ containerElm.insertBefore(childNode, before);
503
+ }
504
+ }
505
+ }
506
+ };
507
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
508
+ for (; startIdx <= endIdx; ++startIdx) {
509
+ if ((vnode = vnodes[startIdx])) {
510
+ elm = vnode.$elm$;
511
+ callNodeRefs(vnode);
512
+ // remove the vnode's element from the dom
513
+ elm.remove();
514
+ }
515
+ }
516
+ };
517
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
518
+ let oldStartIdx = 0;
519
+ let newStartIdx = 0;
520
+ let idxInOld = 0;
521
+ let i = 0;
522
+ let oldEndIdx = oldCh.length - 1;
523
+ let oldStartVnode = oldCh[0];
524
+ let oldEndVnode = oldCh[oldEndIdx];
525
+ let newEndIdx = newCh.length - 1;
526
+ let newStartVnode = newCh[0];
527
+ let newEndVnode = newCh[newEndIdx];
528
+ let node;
529
+ let elmToMove;
530
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
531
+ if (oldStartVnode == null) {
532
+ // Vnode might have been moved left
533
+ oldStartVnode = oldCh[++oldStartIdx];
534
+ }
535
+ else if (oldEndVnode == null) {
536
+ oldEndVnode = oldCh[--oldEndIdx];
537
+ }
538
+ else if (newStartVnode == null) {
539
+ newStartVnode = newCh[++newStartIdx];
540
+ }
541
+ else if (newEndVnode == null) {
542
+ newEndVnode = newCh[--newEndIdx];
543
+ }
544
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
545
+ patch(oldStartVnode, newStartVnode);
546
+ oldStartVnode = oldCh[++oldStartIdx];
547
+ newStartVnode = newCh[++newStartIdx];
548
+ }
549
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
550
+ patch(oldEndVnode, newEndVnode);
551
+ oldEndVnode = oldCh[--oldEndIdx];
552
+ newEndVnode = newCh[--newEndIdx];
553
+ }
554
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
555
+ patch(oldStartVnode, newEndVnode);
556
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
557
+ oldStartVnode = oldCh[++oldStartIdx];
558
+ newEndVnode = newCh[--newEndIdx];
559
+ }
560
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
561
+ patch(oldEndVnode, newStartVnode);
562
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
563
+ oldEndVnode = oldCh[--oldEndIdx];
564
+ newStartVnode = newCh[++newStartIdx];
565
+ }
566
+ else {
567
+ // createKeyToOldIdx
568
+ idxInOld = -1;
569
+ {
570
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
571
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
572
+ idxInOld = i;
573
+ break;
574
+ }
575
+ }
576
+ }
577
+ if (idxInOld >= 0) {
578
+ elmToMove = oldCh[idxInOld];
579
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
580
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
581
+ }
582
+ else {
583
+ patch(elmToMove, newStartVnode);
584
+ oldCh[idxInOld] = undefined;
585
+ node = elmToMove.$elm$;
586
+ }
587
+ newStartVnode = newCh[++newStartIdx];
588
+ }
589
+ else {
590
+ // new element
591
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
592
+ newStartVnode = newCh[++newStartIdx];
593
+ }
594
+ if (node) {
595
+ {
596
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
597
+ }
598
+ }
599
+ }
600
+ }
601
+ if (oldStartIdx > oldEndIdx) {
602
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
603
+ }
604
+ else if (newStartIdx > newEndIdx) {
605
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
606
+ }
607
+ };
608
+ const isSameVnode = (vnode1, vnode2) => {
609
+ // compare if two vnode to see if they're "technically" the same
610
+ // need to have the same element tag, and same key to be the same
611
+ if (vnode1.$tag$ === vnode2.$tag$) {
612
+ {
613
+ return vnode1.$key$ === vnode2.$key$;
614
+ }
615
+ }
616
+ return false;
617
+ };
618
+ const patch = (oldVNode, newVNode) => {
619
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
620
+ const oldChildren = oldVNode.$children$;
621
+ const newChildren = newVNode.$children$;
622
+ const tag = newVNode.$tag$;
623
+ const text = newVNode.$text$;
624
+ if (text === null) {
625
+ {
626
+ // test if we're rendering an svg element, or still rendering nodes inside of one
627
+ // only add this to the when the compiler sees we're using an svg somewhere
628
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
629
+ }
630
+ // element node
631
+ {
632
+ if (tag === 'slot')
633
+ ;
634
+ else {
635
+ // either this is the first render of an element OR it's an update
636
+ // AND we already know it's possible it could have changed
637
+ // this updates the element's css classes, attrs, props, listeners, etc.
638
+ updateElement(oldVNode, newVNode, isSvgMode);
639
+ }
640
+ }
641
+ if (oldChildren !== null && newChildren !== null) {
642
+ // looks like there's child vnodes for both the old and new vnodes
643
+ updateChildren(elm, oldChildren, newVNode, newChildren);
644
+ }
645
+ else if (newChildren !== null) {
646
+ // no old child vnodes, but there are new child vnodes to add
647
+ if (oldVNode.$text$ !== null) {
648
+ // the old vnode was text, so be sure to clear it out
649
+ elm.textContent = '';
650
+ }
651
+ // add the new vnode children
652
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
653
+ }
654
+ else if (oldChildren !== null) {
655
+ // no new child vnodes, but there are old child vnodes to remove
656
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
657
+ }
658
+ if (isSvgMode && tag === 'svg') {
659
+ isSvgMode = false;
660
+ }
661
+ }
662
+ else if (oldVNode.$text$ !== text) {
663
+ // update the text content for the text only vnode
664
+ // and also only if the text is different than before
665
+ elm.data = text;
666
+ }
667
+ };
668
+ const callNodeRefs = (vNode) => {
669
+ {
670
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
671
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
672
+ }
673
+ };
674
+ const renderVdom = (hostRef, renderFnResults) => {
675
+ const hostElm = hostRef.$hostElement$;
676
+ const cmpMeta = hostRef.$cmpMeta$;
677
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
678
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
679
+ hostTagName = hostElm.tagName;
680
+ if (cmpMeta.$attrsToReflect$) {
681
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
682
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
683
+ }
684
+ rootVnode.$tag$ = null;
685
+ rootVnode.$flags$ |= 4 /* isHost */;
686
+ hostRef.$vnode$ = rootVnode;
687
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
688
+ {
689
+ scopeId = hostElm['s-sc'];
690
+ }
691
+ // synchronous patch
692
+ patch(oldVNode, rootVnode);
693
+ };
694
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
695
+ const createEvent = (ref, name, flags) => {
696
+ const elm = getElement(ref);
697
+ return {
698
+ emit: (detail) => {
699
+ return emitEvent(elm, name, {
700
+ bubbles: !!(flags & 4 /* Bubbles */),
701
+ composed: !!(flags & 2 /* Composed */),
702
+ cancelable: !!(flags & 1 /* Cancellable */),
703
+ detail,
704
+ });
705
+ },
706
+ };
707
+ };
708
+ const emitEvent = (elm, name, opts) => {
709
+ const ev = plt.ce(name, opts);
710
+ elm.dispatchEvent(ev);
711
+ return ev;
712
+ };
713
+ const attachToAncestor = (hostRef, ancestorComponent) => {
714
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
715
+ ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r)));
716
+ }
717
+ };
718
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
719
+ {
720
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
721
+ }
722
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
723
+ hostRef.$flags$ |= 512 /* needsRerender */;
724
+ return;
725
+ }
726
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
727
+ // there is no ancestor component or the ancestor component
728
+ // has already fired off its lifecycle update then
729
+ // fire off the initial update
730
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
731
+ return writeTask(dispatch) ;
732
+ };
733
+ const dispatchHooks = (hostRef, isInitialLoad) => {
734
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
735
+ const instance = hostRef.$lazyInstance$ ;
736
+ let promise;
737
+ if (isInitialLoad) {
738
+ {
739
+ promise = safeCall(instance, 'componentWillLoad');
740
+ }
741
+ }
742
+ {
743
+ promise = then(promise, () => safeCall(instance, 'componentWillRender'));
744
+ }
745
+ endSchedule();
746
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
747
+ };
748
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
749
+ // updateComponent
750
+ const elm = hostRef.$hostElement$;
751
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
752
+ const rc = elm['s-rc'];
753
+ if (isInitialLoad) {
754
+ // DOM WRITE!
755
+ attachStyles(hostRef);
756
+ }
757
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
758
+ {
759
+ callRender(hostRef, instance);
760
+ }
761
+ if (rc) {
762
+ // ok, so turns out there are some child host elements
763
+ // waiting on this parent element to load
764
+ // let's fire off all update callbacks waiting
765
+ rc.map(cb => cb());
766
+ elm['s-rc'] = undefined;
767
+ }
768
+ endRender();
769
+ endUpdate();
770
+ {
771
+ const childrenPromises = elm['s-p'];
772
+ const postUpdate = () => postUpdateComponent(hostRef);
773
+ if (childrenPromises.length === 0) {
774
+ postUpdate();
775
+ }
776
+ else {
777
+ Promise.all(childrenPromises).then(postUpdate);
778
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
779
+ childrenPromises.length = 0;
780
+ }
781
+ }
782
+ };
783
+ const callRender = (hostRef, instance, elm) => {
784
+ try {
785
+ instance = instance.render() ;
786
+ {
787
+ hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
788
+ }
789
+ {
790
+ hostRef.$flags$ |= 2 /* hasRendered */;
791
+ }
792
+ {
793
+ {
794
+ // looks like we've got child nodes to render into this host element
795
+ // or we need to update the css class/attrs on the host element
796
+ // DOM WRITE!
797
+ {
798
+ renderVdom(hostRef, instance);
799
+ }
800
+ }
801
+ }
802
+ }
803
+ catch (e) {
804
+ consoleError(e, hostRef.$hostElement$);
805
+ }
806
+ return null;
807
+ };
808
+ const postUpdateComponent = (hostRef) => {
809
+ const tagName = hostRef.$cmpMeta$.$tagName$;
810
+ const elm = hostRef.$hostElement$;
811
+ const endPostUpdate = createTime('postUpdate', tagName);
812
+ const instance = hostRef.$lazyInstance$ ;
813
+ const ancestorComponent = hostRef.$ancestorComponent$;
814
+ {
815
+ safeCall(instance, 'componentDidRender');
816
+ }
817
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
818
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
819
+ {
820
+ // DOM WRITE!
821
+ addHydratedFlag(elm);
822
+ }
823
+ {
824
+ safeCall(instance, 'componentDidLoad');
825
+ }
826
+ endPostUpdate();
827
+ {
828
+ hostRef.$onReadyResolve$(elm);
829
+ if (!ancestorComponent) {
830
+ appDidLoad();
831
+ }
832
+ }
833
+ }
834
+ else {
835
+ endPostUpdate();
836
+ }
837
+ {
838
+ hostRef.$onInstanceResolve$(elm);
839
+ }
840
+ // load events fire from bottom to top
841
+ // the deepest elements load first then bubbles up
842
+ {
843
+ if (hostRef.$onRenderResolve$) {
844
+ hostRef.$onRenderResolve$();
845
+ hostRef.$onRenderResolve$ = undefined;
846
+ }
847
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
848
+ nextTick(() => scheduleUpdate(hostRef, false));
849
+ }
850
+ hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
851
+ }
852
+ // ( •_•)
853
+ // ( •_•)>⌐■-■
854
+ // (⌐■_■)
855
+ };
856
+ const forceUpdate = (ref) => {
857
+ {
858
+ const hostRef = getHostRef(ref);
859
+ const isConnected = hostRef.$hostElement$.isConnected;
860
+ if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
861
+ scheduleUpdate(hostRef, false);
862
+ }
863
+ // Returns "true" when the forced update was successfully scheduled
864
+ return isConnected;
865
+ }
866
+ };
867
+ const appDidLoad = (who) => {
868
+ // on appload
869
+ // we have finish the first big initial render
870
+ {
871
+ addHydratedFlag(doc.documentElement);
872
+ }
873
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
874
+ };
875
+ const safeCall = (instance, method, arg) => {
876
+ if (instance && instance[method]) {
877
+ try {
878
+ return instance[method](arg);
879
+ }
880
+ catch (e) {
881
+ consoleError(e);
882
+ }
883
+ }
884
+ return undefined;
885
+ };
886
+ const then = (promise, thenFn) => {
887
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
888
+ };
889
+ const addHydratedFlag = (elm) => (elm.classList.add('hydrated') );
890
+ const parsePropertyValue = (propValue, propType) => {
891
+ // ensure this value is of the correct prop type
892
+ if (propValue != null && !isComplexType(propValue)) {
893
+ if (propType & 4 /* Boolean */) {
894
+ // per the HTML spec, any string value means it is a boolean true value
895
+ // but we'll cheat here and say that the string "false" is the boolean false
896
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
897
+ }
898
+ if (propType & 2 /* Number */) {
899
+ // force it to be a number
900
+ return parseFloat(propValue);
901
+ }
902
+ if (propType & 1 /* String */) {
903
+ // could have been passed as a number or boolean
904
+ // but we still want it as a string
905
+ return String(propValue);
906
+ }
907
+ // redundant return here for better minification
908
+ return propValue;
909
+ }
910
+ // not sure exactly what type we want
911
+ // so no need to change to a different type
912
+ return propValue;
913
+ };
914
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
915
+ const setValue = (ref, propName, newVal, cmpMeta) => {
916
+ // check our new property value against our internal value
917
+ const hostRef = getHostRef(ref);
918
+ const elm = hostRef.$hostElement$ ;
919
+ const oldVal = hostRef.$instanceValues$.get(propName);
920
+ const flags = hostRef.$flags$;
921
+ const instance = hostRef.$lazyInstance$ ;
922
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
923
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
924
+ // gadzooks! the property's value has changed!!
925
+ // set our new value!
926
+ hostRef.$instanceValues$.set(propName, newVal);
927
+ if (instance) {
928
+ // get an array of method names of watch functions to call
929
+ if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
930
+ const watchMethods = cmpMeta.$watchers$[propName];
931
+ if (watchMethods) {
932
+ // this instance is watching for when this property changed
933
+ watchMethods.map(watchMethodName => {
934
+ try {
935
+ // fire off each of the watch methods that are watching this property
936
+ instance[watchMethodName](newVal, oldVal, propName);
937
+ }
938
+ catch (e) {
939
+ consoleError(e, elm);
940
+ }
941
+ });
942
+ }
943
+ }
944
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
945
+ // looks like this value actually changed, so we've got work to do!
946
+ // but only if we've already rendered, otherwise just chill out
947
+ // queue that we need to do an update, but don't worry about queuing
948
+ // up millions cuz this function ensures it only runs once
949
+ scheduleUpdate(hostRef, false);
950
+ }
951
+ }
952
+ }
953
+ };
954
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
955
+ if (cmpMeta.$members$) {
956
+ if (Cstr.watchers) {
957
+ cmpMeta.$watchers$ = Cstr.watchers;
958
+ }
959
+ // It's better to have a const than two Object.entries()
960
+ const members = Object.entries(cmpMeta.$members$);
961
+ const prototype = Cstr.prototype;
962
+ members.map(([memberName, [memberFlags]]) => {
963
+ if ((memberFlags & 31 /* Prop */ || ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
964
+ // proxyComponent - prop
965
+ Object.defineProperty(prototype, memberName, {
966
+ get() {
967
+ // proxyComponent, get value
968
+ return getValue(this, memberName);
969
+ },
970
+ set(newValue) {
971
+ // proxyComponent, set value
972
+ setValue(this, memberName, newValue, cmpMeta);
973
+ },
974
+ configurable: true,
975
+ enumerable: true,
976
+ });
977
+ }
978
+ else if (flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
979
+ // proxyComponent - method
980
+ Object.defineProperty(prototype, memberName, {
981
+ value(...args) {
982
+ const ref = getHostRef(this);
983
+ return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
984
+ },
985
+ });
986
+ }
987
+ });
988
+ if ((flags & 1 /* isElementConstructor */)) {
989
+ const attrNameToPropName = new Map();
990
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
991
+ plt.jmp(() => {
992
+ const propName = attrNameToPropName.get(attrName);
993
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
994
+ });
995
+ };
996
+ // create an array of attributes to observe
997
+ // and also create a map of html attribute name to js property name
998
+ Cstr.observedAttributes = members
999
+ .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1000
+ .map(([propName, m]) => {
1001
+ const attrName = m[1] || propName;
1002
+ attrNameToPropName.set(attrName, propName);
1003
+ if (m[0] & 512 /* ReflectAttr */) {
1004
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
1005
+ }
1006
+ return attrName;
1007
+ });
1008
+ }
1009
+ }
1010
+ return Cstr;
1011
+ };
1012
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1013
+ // initializeComponent
1014
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1015
+ {
1016
+ // we haven't initialized this element yet
1017
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1018
+ // lazy loaded components
1019
+ // request the component's implementation to be
1020
+ // wired up with the host element
1021
+ Cstr = loadModule(cmpMeta);
1022
+ if (Cstr.then) {
1023
+ // Await creates a micro-task avoid if possible
1024
+ const endLoad = uniqueTime();
1025
+ Cstr = await Cstr;
1026
+ endLoad();
1027
+ }
1028
+ if (!Cstr.isProxied) {
1029
+ // we'eve never proxied this Constructor before
1030
+ // let's add the getters/setters to its prototype before
1031
+ // the first time we create an instance of the implementation
1032
+ {
1033
+ cmpMeta.$watchers$ = Cstr.watchers;
1034
+ }
1035
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1036
+ Cstr.isProxied = true;
1037
+ }
1038
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1039
+ // ok, time to construct the instance
1040
+ // but let's keep track of when we start and stop
1041
+ // so that the getters/setters don't incorrectly step on data
1042
+ {
1043
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
1044
+ }
1045
+ // construct the lazy-loaded component implementation
1046
+ // passing the hostRef is very important during
1047
+ // construction in order to directly wire together the
1048
+ // host element and the lazy-loaded instance
1049
+ try {
1050
+ new Cstr(hostRef);
1051
+ }
1052
+ catch (e) {
1053
+ consoleError(e);
1054
+ }
1055
+ {
1056
+ hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1057
+ }
1058
+ {
1059
+ hostRef.$flags$ |= 128 /* isWatchReady */;
1060
+ }
1061
+ endNewInstance();
1062
+ }
1063
+ if (Cstr.style) {
1064
+ // this component has styles but we haven't registered them yet
1065
+ let style = Cstr.style;
1066
+ const scopeId = getScopeId(cmpMeta);
1067
+ if (!styles.has(scopeId)) {
1068
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1069
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1070
+ endRegisterStyles();
1071
+ }
1072
+ }
1073
+ }
1074
+ // we've successfully created a lazy instance
1075
+ const ancestorComponent = hostRef.$ancestorComponent$;
1076
+ const schedule = () => scheduleUpdate(hostRef, true);
1077
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1078
+ // this is the intial load and this component it has an ancestor component
1079
+ // but the ancestor component has NOT fired its will update lifecycle yet
1080
+ // so let's just cool our jets and wait for the ancestor to continue first
1081
+ // this will get fired off when the ancestor component
1082
+ // finally gets around to rendering its lazy self
1083
+ // fire off the initial update
1084
+ ancestorComponent['s-rc'].push(schedule);
1085
+ }
1086
+ else {
1087
+ schedule();
1088
+ }
1089
+ };
1090
+ const connectedCallback = (elm) => {
1091
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1092
+ const hostRef = getHostRef(elm);
1093
+ const cmpMeta = hostRef.$cmpMeta$;
1094
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1095
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1096
+ // first time this component has connected
1097
+ hostRef.$flags$ |= 1 /* hasConnected */;
1098
+ {
1099
+ // find the first ancestor component (if there is one) and register
1100
+ // this component as one of the actively loading child components for its ancestor
1101
+ let ancestorComponent = elm;
1102
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1103
+ // climb up the ancestors looking for the first
1104
+ // component that hasn't finished its lifecycle update yet
1105
+ if (ancestorComponent['s-p']) {
1106
+ // we found this components first ancestor component
1107
+ // keep a reference to this component's ancestor component
1108
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1109
+ break;
1110
+ }
1111
+ }
1112
+ }
1113
+ // Lazy properties
1114
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1115
+ if (cmpMeta.$members$) {
1116
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1117
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1118
+ const value = elm[memberName];
1119
+ delete elm[memberName];
1120
+ elm[memberName] = value;
1121
+ }
1122
+ });
1123
+ }
1124
+ {
1125
+ initializeComponent(elm, hostRef, cmpMeta);
1126
+ }
1127
+ }
1128
+ endConnected();
1129
+ }
1130
+ };
1131
+ const disconnectedCallback = (elm) => {
1132
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1133
+ getHostRef(elm);
1134
+ }
1135
+ };
1136
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1137
+ const endBootstrap = createTime();
1138
+ const cmpTags = [];
1139
+ const exclude = options.exclude || [];
1140
+ const customElements = win.customElements;
1141
+ const head = doc.head;
1142
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1143
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1144
+ const deferredConnectedCallbacks = [];
1145
+ let appLoadFallback;
1146
+ let isBootstrapping = true;
1147
+ Object.assign(plt, options);
1148
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1149
+ lazyBundles.map(lazyBundle => lazyBundle[1].map(compactMeta => {
1150
+ const cmpMeta = {
1151
+ $flags$: compactMeta[0],
1152
+ $tagName$: compactMeta[1],
1153
+ $members$: compactMeta[2],
1154
+ $listeners$: compactMeta[3],
1155
+ };
1156
+ {
1157
+ cmpMeta.$members$ = compactMeta[2];
1158
+ }
1159
+ {
1160
+ cmpMeta.$attrsToReflect$ = [];
1161
+ }
1162
+ {
1163
+ cmpMeta.$watchers$ = {};
1164
+ }
1165
+ const tagName = cmpMeta.$tagName$;
1166
+ const HostElement = class extends HTMLElement {
1167
+ // StencilLazyHost
1168
+ constructor(self) {
1169
+ // @ts-ignore
1170
+ super(self);
1171
+ self = this;
1172
+ registerHost(self, cmpMeta);
1173
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1174
+ // this component is using shadow dom
1175
+ // and this browser supports shadow dom
1176
+ // add the read-only property "shadowRoot" to the host element
1177
+ // adding the shadow root build conditionals to minimize runtime
1178
+ {
1179
+ {
1180
+ self.attachShadow({ mode: 'open' });
1181
+ }
1182
+ }
1183
+ }
1184
+ }
1185
+ connectedCallback() {
1186
+ if (appLoadFallback) {
1187
+ clearTimeout(appLoadFallback);
1188
+ appLoadFallback = null;
1189
+ }
1190
+ if (isBootstrapping) {
1191
+ // connectedCallback will be processed once all components have been registered
1192
+ deferredConnectedCallbacks.push(this);
1193
+ }
1194
+ else {
1195
+ plt.jmp(() => connectedCallback(this));
1196
+ }
1197
+ }
1198
+ disconnectedCallback() {
1199
+ plt.jmp(() => disconnectedCallback(this));
1200
+ }
1201
+ componentOnReady() {
1202
+ return getHostRef(this).$onReadyPromise$;
1203
+ }
1204
+ };
1205
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1206
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1207
+ cmpTags.push(tagName);
1208
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1209
+ }
1210
+ }));
1211
+ {
1212
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1213
+ visibilityStyle.setAttribute('data-styles', '');
1214
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1215
+ }
1216
+ // Process deferred connectedCallbacks now all components have been registered
1217
+ isBootstrapping = false;
1218
+ if (deferredConnectedCallbacks.length) {
1219
+ deferredConnectedCallbacks.map(host => host.connectedCallback());
1220
+ }
1221
+ else {
1222
+ {
1223
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1224
+ }
1225
+ }
1226
+ // Fallback appLoad event
1227
+ endBootstrap();
1228
+ };
1229
+ const hostRefs = new WeakMap();
1230
+ const getHostRef = (ref) => hostRefs.get(ref);
1231
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1232
+ const registerHost = (elm, cmpMeta) => {
1233
+ const hostRef = {
1234
+ $flags$: 0,
1235
+ $hostElement$: elm,
1236
+ $cmpMeta$: cmpMeta,
1237
+ $instanceValues$: new Map(),
1238
+ };
1239
+ {
1240
+ hostRef.$onInstancePromise$ = new Promise(r => (hostRef.$onInstanceResolve$ = r));
1241
+ }
1242
+ {
1243
+ hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
1244
+ elm['s-p'] = [];
1245
+ elm['s-rc'] = [];
1246
+ }
1247
+ return hostRefs.set(elm, hostRef);
1248
+ };
1249
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1250
+ const consoleError = (e, el) => (0, console.error)(e, el);
1251
+ const cmpModules = /*@__PURE__*/ new Map();
1252
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1253
+ // loadModuleImport
1254
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1255
+ const bundleId = cmpMeta.$lazyBundleId$;
1256
+ const module = cmpModules.get(bundleId) ;
1257
+ if (module) {
1258
+ return module[exportName];
1259
+ }
1260
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1261
+ /* webpackInclude: /\.entry\.js$/ */
1262
+ /* webpackExclude: /\.system\.entry\.js$/ */
1263
+ /* webpackMode: "lazy" */
1264
+ `./${bundleId}.entry.js${''}`)); }).then(importedModule => {
1265
+ {
1266
+ cmpModules.set(bundleId, importedModule);
1267
+ }
1268
+ return importedModule[exportName];
1269
+ }, consoleError);
1270
+ };
1271
+ const styles = new Map();
1272
+ const queueDomReads = [];
1273
+ const queueDomWrites = [];
1274
+ const queueTask = (queue, write) => (cb) => {
1275
+ queue.push(cb);
1276
+ if (!queuePending) {
1277
+ queuePending = true;
1278
+ if (write && plt.$flags$ & 4 /* queueSync */) {
1279
+ nextTick(flush);
1280
+ }
1281
+ else {
1282
+ plt.raf(flush);
1283
+ }
1284
+ }
1285
+ };
1286
+ const consume = (queue) => {
1287
+ for (let i = 0; i < queue.length; i++) {
1288
+ try {
1289
+ queue[i](performance.now());
1290
+ }
1291
+ catch (e) {
1292
+ consoleError(e);
1293
+ }
1294
+ }
1295
+ queue.length = 0;
1296
+ };
1297
+ const flush = () => {
1298
+ // always force a bunch of medium callbacks to run, but still have
1299
+ // a throttle on how many can run in a certain time
1300
+ // DOM READS!!!
1301
+ consume(queueDomReads);
1302
+ // DOM WRITES!!!
1303
+ {
1304
+ consume(queueDomWrites);
1305
+ if ((queuePending = queueDomReads.length > 0)) {
1306
+ // still more to do yet, but we've run out of time
1307
+ // let's let this thing cool off and try again in the next tick
1308
+ plt.raf(flush);
1309
+ }
1310
+ }
1311
+ };
1312
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1313
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1314
+
1315
+ exports.Host = Host;
1316
+ exports.bootstrapLazy = bootstrapLazy;
1317
+ exports.createEvent = createEvent;
1318
+ exports.forceUpdate = forceUpdate;
1319
+ exports.getElement = getElement;
1320
+ exports.h = h;
1321
+ exports.promiseResolve = promiseResolve;
1322
+ exports.registerInstance = registerInstance;