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