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