@everymatrix/lottery-game-page 0.0.1 → 0.0.5

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