@everymatrix/lottery-grid 1.44.0 → 1.45.0

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