@everymatrix/casino-play-random-game 1.43.4 → 1.45.0

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