@everymatrix/lottery-game-page 1.44.0 → 1.45.2

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