@everymatrix/casino-tournament-duration 1.44.0 → 1.45.2

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