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