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