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