@everymatrix/lottery-game-page 1.43.4 → 1.45.0

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