@everymatrix/casino-tournament-duration 1.31.2 → 1.32.4

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