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