@everymatrix/casino-play-random-game 1.31.1 → 1.32.4

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