@everymatrix/lottery-ticket 0.1.24 → 1.0.69

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