@everymatrix/lottery-grid 1.44.0 → 1.45.2

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,1223 +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 cmpMeta = hostRef.$cmpMeta$;
539
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
540
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
541
- hostTagName = hostElm.tagName;
542
- if (cmpMeta.$attrsToReflect$) {
543
- rootVnode.$attrs$ = rootVnode.$attrs$ || {};
544
- cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
545
- }
546
- rootVnode.$tag$ = null;
547
- rootVnode.$flags$ |= 4 /* isHost */;
548
- hostRef.$vnode$ = rootVnode;
549
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
550
- {
551
- scopeId = hostElm['s-sc'];
552
- }
553
- // synchronous patch
554
- patch(oldVNode, rootVnode);
555
- };
556
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
557
- const createEvent = (ref, name, flags) => {
558
- const elm = getElement(ref);
559
- return {
560
- emit: (detail) => {
561
- return emitEvent(elm, name, {
562
- bubbles: !!(flags & 4 /* Bubbles */),
563
- composed: !!(flags & 2 /* Composed */),
564
- cancelable: !!(flags & 1 /* Cancellable */),
565
- detail,
566
- });
567
- },
568
- };
569
- };
570
- /**
571
- * Helper function to create & dispatch a custom Event on a provided target
572
- * @param elm the target of the Event
573
- * @param name the name to give the custom Event
574
- * @param opts options for configuring a custom Event
575
- * @returns the custom Event
576
- */
577
- const emitEvent = (elm, name, opts) => {
578
- const ev = plt.ce(name, opts);
579
- elm.dispatchEvent(ev);
580
- return ev;
581
- };
582
- const attachToAncestor = (hostRef, ancestorComponent) => {
583
- if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
584
- ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
585
- }
586
- };
587
- const scheduleUpdate = (hostRef, isInitialLoad) => {
588
- {
589
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
590
- }
591
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
592
- hostRef.$flags$ |= 512 /* needsRerender */;
593
- return;
594
- }
595
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
596
- // there is no ancestor component or the ancestor component
597
- // has already fired off its lifecycle update then
598
- // fire off the initial update
599
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
600
- return writeTask(dispatch) ;
601
- };
602
- const dispatchHooks = (hostRef, isInitialLoad) => {
603
- const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
604
- const instance = hostRef.$lazyInstance$ ;
605
- let promise;
606
- if (isInitialLoad) {
607
- {
608
- hostRef.$flags$ |= 256 /* isListenReady */;
609
- if (hostRef.$queuedListeners$) {
610
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
611
- hostRef.$queuedListeners$ = null;
612
- }
613
- }
614
- }
615
- endSchedule();
616
- return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
617
- };
618
- const updateComponent = async (hostRef, instance, isInitialLoad) => {
619
- // updateComponent
620
- const elm = hostRef.$hostElement$;
621
- const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
622
- const rc = elm['s-rc'];
623
- if (isInitialLoad) {
624
- // DOM WRITE!
625
- attachStyles(hostRef);
626
- }
627
- const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
628
- {
629
- callRender(hostRef, instance);
630
- }
631
- if (rc) {
632
- // ok, so turns out there are some child host elements
633
- // waiting on this parent element to load
634
- // let's fire off all update callbacks waiting
635
- rc.map((cb) => cb());
636
- elm['s-rc'] = undefined;
637
- }
638
- endRender();
639
- endUpdate();
640
- {
641
- const childrenPromises = elm['s-p'];
642
- const postUpdate = () => postUpdateComponent(hostRef);
643
- if (childrenPromises.length === 0) {
644
- postUpdate();
645
- }
646
- else {
647
- Promise.all(childrenPromises).then(postUpdate);
648
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
649
- childrenPromises.length = 0;
650
- }
651
- }
652
- };
653
- const callRender = (hostRef, instance, elm) => {
654
- try {
655
- instance = instance.render() ;
656
- {
657
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
658
- }
659
- {
660
- hostRef.$flags$ |= 2 /* hasRendered */;
661
- }
662
- {
663
- {
664
- // looks like we've got child nodes to render into this host element
665
- // or we need to update the css class/attrs on the host element
666
- // DOM WRITE!
667
- {
668
- renderVdom(hostRef, instance);
669
- }
670
- }
671
- }
672
- }
673
- catch (e) {
674
- consoleError(e, hostRef.$hostElement$);
675
- }
676
- return null;
677
- };
678
- const postUpdateComponent = (hostRef) => {
679
- const tagName = hostRef.$cmpMeta$.$tagName$;
680
- const elm = hostRef.$hostElement$;
681
- const endPostUpdate = createTime('postUpdate', tagName);
682
- const instance = hostRef.$lazyInstance$ ;
683
- const ancestorComponent = hostRef.$ancestorComponent$;
684
- {
685
- safeCall(instance, 'componentDidRender');
686
- }
687
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
688
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
689
- {
690
- // DOM WRITE!
691
- addHydratedFlag(elm);
692
- }
693
- endPostUpdate();
694
- {
695
- hostRef.$onReadyResolve$(elm);
696
- if (!ancestorComponent) {
697
- appDidLoad();
698
- }
699
- }
700
- }
701
- else {
702
- endPostUpdate();
703
- }
704
- // load events fire from bottom to top
705
- // the deepest elements load first then bubbles up
706
- {
707
- if (hostRef.$onRenderResolve$) {
708
- hostRef.$onRenderResolve$();
709
- hostRef.$onRenderResolve$ = undefined;
710
- }
711
- if (hostRef.$flags$ & 512 /* needsRerender */) {
712
- nextTick(() => scheduleUpdate(hostRef, false));
713
- }
714
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
715
- }
716
- // ( •_•)
717
- // ( •_•)>⌐■-■
718
- // (⌐■_■)
719
- };
720
- const appDidLoad = (who) => {
721
- // on appload
722
- // we have finish the first big initial render
723
- {
724
- addHydratedFlag(doc.documentElement);
725
- }
726
- nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
727
- };
728
- const safeCall = (instance, method, arg) => {
729
- if (instance && instance[method]) {
730
- try {
731
- return instance[method](arg);
732
- }
733
- catch (e) {
734
- consoleError(e);
735
- }
736
- }
737
- return undefined;
738
- };
739
- const then = (promise, thenFn) => {
740
- return promise && promise.then ? promise.then(thenFn) : thenFn();
741
- };
742
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
743
- ;
744
- /**
745
- * Parse a new property value for a given property type.
746
- *
747
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
748
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
749
- * 1. `any`, the type given to `propValue` in the function signature
750
- * 2. the type stored from `propType`.
751
- *
752
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
753
- *
754
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
755
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
756
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
757
- * ```tsx
758
- * <my-cmp prop-val={0}></my-cmp>
759
- * ```
760
- *
761
- * HTML prop values on the other hand, will always a string
762
- *
763
- * @param propValue the new value to coerce to some type
764
- * @param propType the type of the prop, expressed as a binary number
765
- * @returns the parsed/coerced value
766
- */
767
- const parsePropertyValue = (propValue, propType) => {
768
- // ensure this value is of the correct prop type
769
- if (propValue != null && !isComplexType(propValue)) {
770
- if (propType & 4 /* Boolean */) {
771
- // per the HTML spec, any string value means it is a boolean true value
772
- // but we'll cheat here and say that the string "false" is the boolean false
773
- return propValue === 'false' ? false : propValue === '' || !!propValue;
774
- }
775
- if (propType & 2 /* Number */) {
776
- // force it to be a number
777
- return parseFloat(propValue);
778
- }
779
- if (propType & 1 /* String */) {
780
- // could have been passed as a number or boolean
781
- // but we still want it as a string
782
- return String(propValue);
783
- }
784
- // redundant return here for better minification
785
- return propValue;
786
- }
787
- // not sure exactly what type we want
788
- // so no need to change to a different type
789
- return propValue;
790
- };
791
- const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
792
- const setValue = (ref, propName, newVal, cmpMeta) => {
793
- // check our new property value against our internal value
794
- const hostRef = getHostRef(ref);
795
- const oldVal = hostRef.$instanceValues$.get(propName);
796
- const flags = hostRef.$flags$;
797
- const instance = hostRef.$lazyInstance$ ;
798
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
799
- // explicitly check for NaN on both sides, as `NaN === NaN` is always false
800
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
801
- const didValueChange = newVal !== oldVal && !areBothNaN;
802
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
803
- // gadzooks! the property's value has changed!!
804
- // set our new value!
805
- hostRef.$instanceValues$.set(propName, newVal);
806
- if (instance) {
807
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
808
- // looks like this value actually changed, so we've got work to do!
809
- // but only if we've already rendered, otherwise just chill out
810
- // queue that we need to do an update, but don't worry about queuing
811
- // up millions cuz this function ensures it only runs once
812
- scheduleUpdate(hostRef, false);
813
- }
814
- }
815
- }
816
- };
817
- const proxyComponent = (Cstr, cmpMeta, flags) => {
818
- if (cmpMeta.$members$) {
819
- // It's better to have a const than two Object.entries()
820
- const members = Object.entries(cmpMeta.$members$);
821
- const prototype = Cstr.prototype;
822
- members.map(([memberName, [memberFlags]]) => {
823
- if ((memberFlags & 31 /* Prop */ ||
824
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
825
- // proxyComponent - prop
826
- Object.defineProperty(prototype, memberName, {
827
- get() {
828
- // proxyComponent, get value
829
- return getValue(this, memberName);
830
- },
831
- set(newValue) {
832
- // proxyComponent, set value
833
- setValue(this, memberName, newValue, cmpMeta);
834
- },
835
- configurable: true,
836
- enumerable: true,
837
- });
838
- }
839
- });
840
- if ((flags & 1 /* isElementConstructor */)) {
841
- const attrNameToPropName = new Map();
842
- prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
843
- plt.jmp(() => {
844
- const propName = attrNameToPropName.get(attrName);
845
- // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
846
- // in the case where an attribute was set inline.
847
- // ```html
848
- // <my-component some-attribute="some-value"></my-component>
849
- // ```
850
- //
851
- // There is an edge case where a developer sets the attribute inline on a custom element and then
852
- // programmatically changes it before it has been upgraded as shown below:
853
- //
854
- // ```html
855
- // <!-- this component has _not_ been upgraded yet -->
856
- // <my-component id="test" some-attribute="some-value"></my-component>
857
- // <script>
858
- // // grab non-upgraded component
859
- // el = document.querySelector("#test");
860
- // el.someAttribute = "another-value";
861
- // // upgrade component
862
- // customElements.define('my-component', MyComponent);
863
- // </script>
864
- // ```
865
- // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
866
- // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
867
- // to the value that was set inline i.e. "some-value" from above example. When
868
- // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
869
- //
870
- // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
871
- // by connectedCallback as this attributeChangedCallback will not fire.
872
- //
873
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
874
- //
875
- // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
876
- // properties here given that this goes against best practices outlined here
877
- // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
878
- if (this.hasOwnProperty(propName)) {
879
- newValue = this[propName];
880
- delete this[propName];
881
- }
882
- else if (prototype.hasOwnProperty(propName) &&
883
- typeof this[propName] === 'number' &&
884
- this[propName] == newValue) {
885
- // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
886
- // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
887
- // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
888
- return;
889
- }
890
- this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
891
- });
892
- };
893
- // create an array of attributes to observe
894
- // and also create a map of html attribute name to js property name
895
- Cstr.observedAttributes = members
896
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
897
- .map(([propName, m]) => {
898
- const attrName = m[1] || propName;
899
- attrNameToPropName.set(attrName, propName);
900
- if (m[0] & 512 /* ReflectAttr */) {
901
- cmpMeta.$attrsToReflect$.push([propName, attrName]);
902
- }
903
- return attrName;
904
- });
905
- }
906
- }
907
- return Cstr;
908
- };
909
- const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
910
- // initializeComponent
911
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
912
- {
913
- // we haven't initialized this element yet
914
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
915
- // lazy loaded components
916
- // request the component's implementation to be
917
- // wired up with the host element
918
- Cstr = loadModule(cmpMeta);
919
- if (Cstr.then) {
920
- // Await creates a micro-task avoid if possible
921
- const endLoad = uniqueTime();
922
- Cstr = await Cstr;
923
- endLoad();
924
- }
925
- if (!Cstr.isProxied) {
926
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
927
- Cstr.isProxied = true;
928
- }
929
- const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
930
- // ok, time to construct the instance
931
- // but let's keep track of when we start and stop
932
- // so that the getters/setters don't incorrectly step on data
933
- {
934
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
935
- }
936
- // construct the lazy-loaded component implementation
937
- // passing the hostRef is very important during
938
- // construction in order to directly wire together the
939
- // host element and the lazy-loaded instance
940
- try {
941
- new Cstr(hostRef);
942
- }
943
- catch (e) {
944
- consoleError(e);
945
- }
946
- {
947
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
948
- }
949
- endNewInstance();
950
- fireConnectedCallback(hostRef.$lazyInstance$);
951
- }
952
- if (Cstr.style) {
953
- // this component has styles but we haven't registered them yet
954
- let style = Cstr.style;
955
- const scopeId = getScopeId(cmpMeta);
956
- if (!styles.has(scopeId)) {
957
- const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
958
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
959
- endRegisterStyles();
960
- }
961
- }
962
- }
963
- // we've successfully created a lazy instance
964
- const ancestorComponent = hostRef.$ancestorComponent$;
965
- const schedule = () => scheduleUpdate(hostRef, true);
966
- if (ancestorComponent && ancestorComponent['s-rc']) {
967
- // this is the initial load and this component it has an ancestor component
968
- // but the ancestor component has NOT fired its will update lifecycle yet
969
- // so let's just cool our jets and wait for the ancestor to continue first
970
- // this will get fired off when the ancestor component
971
- // finally gets around to rendering its lazy self
972
- // fire off the initial update
973
- ancestorComponent['s-rc'].push(schedule);
974
- }
975
- else {
976
- schedule();
977
- }
978
- };
979
- const fireConnectedCallback = (instance) => {
980
- {
981
- safeCall(instance, 'connectedCallback');
982
- }
983
- };
984
- const connectedCallback = (elm) => {
985
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
986
- const hostRef = getHostRef(elm);
987
- const cmpMeta = hostRef.$cmpMeta$;
988
- const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
989
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
990
- // first time this component has connected
991
- hostRef.$flags$ |= 1 /* hasConnected */;
992
- {
993
- // find the first ancestor component (if there is one) and register
994
- // this component as one of the actively loading child components for its ancestor
995
- let ancestorComponent = elm;
996
- while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
997
- // climb up the ancestors looking for the first
998
- // component that hasn't finished its lifecycle update yet
999
- if (ancestorComponent['s-p']) {
1000
- // we found this components first ancestor component
1001
- // keep a reference to this component's ancestor component
1002
- attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1003
- break;
1004
- }
1005
- }
1006
- }
1007
- // Lazy properties
1008
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1009
- if (cmpMeta.$members$) {
1010
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1011
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1012
- const value = elm[memberName];
1013
- delete elm[memberName];
1014
- elm[memberName] = value;
1015
- }
1016
- });
1017
- }
1018
- {
1019
- initializeComponent(elm, hostRef, cmpMeta);
1020
- }
1021
- }
1022
- else {
1023
- // not the first time this has connected
1024
- // reattach any event listeners to the host
1025
- // since they would have been removed when disconnected
1026
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1027
- // fire off connectedCallback() on component instance
1028
- fireConnectedCallback(hostRef.$lazyInstance$);
1029
- }
1030
- endConnected();
1031
- }
1032
- };
1033
- const disconnectedCallback = (elm) => {
1034
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1035
- const hostRef = getHostRef(elm);
1036
- {
1037
- if (hostRef.$rmListeners$) {
1038
- hostRef.$rmListeners$.map((rmListener) => rmListener());
1039
- hostRef.$rmListeners$ = undefined;
1040
- }
1041
- }
1042
- }
1043
- };
1044
- const bootstrapLazy = (lazyBundles, options = {}) => {
1045
- const endBootstrap = createTime();
1046
- const cmpTags = [];
1047
- const exclude = options.exclude || [];
1048
- const customElements = win.customElements;
1049
- const head = doc.head;
1050
- const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1051
- const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1052
- const deferredConnectedCallbacks = [];
1053
- let appLoadFallback;
1054
- let isBootstrapping = true;
1055
- Object.assign(plt, options);
1056
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1057
- lazyBundles.map((lazyBundle) => {
1058
- lazyBundle[1].map((compactMeta) => {
1059
- const cmpMeta = {
1060
- $flags$: compactMeta[0],
1061
- $tagName$: compactMeta[1],
1062
- $members$: compactMeta[2],
1063
- $listeners$: compactMeta[3],
1064
- };
1065
- {
1066
- cmpMeta.$members$ = compactMeta[2];
1067
- }
1068
- {
1069
- cmpMeta.$listeners$ = compactMeta[3];
1070
- }
1071
- {
1072
- cmpMeta.$attrsToReflect$ = [];
1073
- }
1074
- const tagName = cmpMeta.$tagName$;
1075
- const HostElement = class extends HTMLElement {
1076
- // StencilLazyHost
1077
- constructor(self) {
1078
- // @ts-ignore
1079
- super(self);
1080
- self = this;
1081
- registerHost(self, cmpMeta);
1082
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1083
- // this component is using shadow dom
1084
- // and this browser supports shadow dom
1085
- // add the read-only property "shadowRoot" to the host element
1086
- // adding the shadow root build conditionals to minimize runtime
1087
- {
1088
- {
1089
- self.attachShadow({ mode: 'open' });
1090
- }
1091
- }
1092
- }
1093
- }
1094
- connectedCallback() {
1095
- if (appLoadFallback) {
1096
- clearTimeout(appLoadFallback);
1097
- appLoadFallback = null;
1098
- }
1099
- if (isBootstrapping) {
1100
- // connectedCallback will be processed once all components have been registered
1101
- deferredConnectedCallbacks.push(this);
1102
- }
1103
- else {
1104
- plt.jmp(() => connectedCallback(this));
1105
- }
1106
- }
1107
- disconnectedCallback() {
1108
- plt.jmp(() => disconnectedCallback(this));
1109
- }
1110
- componentOnReady() {
1111
- return getHostRef(this).$onReadyPromise$;
1112
- }
1113
- };
1114
- cmpMeta.$lazyBundleId$ = lazyBundle[0];
1115
- if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1116
- cmpTags.push(tagName);
1117
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1118
- }
1119
- });
1120
- });
1121
- {
1122
- visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1123
- visibilityStyle.setAttribute('data-styles', '');
1124
- head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1125
- }
1126
- // Process deferred connectedCallbacks now all components have been registered
1127
- isBootstrapping = false;
1128
- if (deferredConnectedCallbacks.length) {
1129
- deferredConnectedCallbacks.map((host) => host.connectedCallback());
1130
- }
1131
- else {
1132
- {
1133
- plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1134
- }
1135
- }
1136
- // Fallback appLoad event
1137
- endBootstrap();
1138
- };
1139
- const hostRefs = new WeakMap();
1140
- const getHostRef = (ref) => hostRefs.get(ref);
1141
- const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1142
- const registerHost = (elm, cmpMeta) => {
1143
- const hostRef = {
1144
- $flags$: 0,
1145
- $hostElement$: elm,
1146
- $cmpMeta$: cmpMeta,
1147
- $instanceValues$: new Map(),
1148
- };
1149
- {
1150
- hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1151
- elm['s-p'] = [];
1152
- elm['s-rc'] = [];
1153
- }
1154
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1155
- return hostRefs.set(elm, hostRef);
1156
- };
1157
- const isMemberInElement = (elm, memberName) => memberName in elm;
1158
- const consoleError = (e, el) => (0, console.error)(e, el);
1159
- const cmpModules = /*@__PURE__*/ new Map();
1160
- const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1161
- // loadModuleImport
1162
- const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1163
- const bundleId = cmpMeta.$lazyBundleId$;
1164
- const module = cmpModules.get(bundleId) ;
1165
- if (module) {
1166
- return module[exportName];
1167
- }
1168
- return import(
1169
- /* webpackInclude: /\.entry\.js$/ */
1170
- /* webpackExclude: /\.system\.entry\.js$/ */
1171
- /* webpackMode: "lazy" */
1172
- `./${bundleId}.entry.js${''}`).then((importedModule) => {
1173
- {
1174
- cmpModules.set(bundleId, importedModule);
1175
- }
1176
- return importedModule[exportName];
1177
- }, consoleError);
1178
- };
1179
- const styles = new Map();
1180
- const queueDomReads = [];
1181
- const queueDomWrites = [];
1182
- const queueTask = (queue, write) => (cb) => {
1183
- queue.push(cb);
1184
- if (!queuePending) {
1185
- queuePending = true;
1186
- if (write && plt.$flags$ & 4 /* queueSync */) {
1187
- nextTick(flush);
1188
- }
1189
- else {
1190
- plt.raf(flush);
1191
- }
1192
- }
1193
- };
1194
- const consume = (queue) => {
1195
- for (let i = 0; i < queue.length; i++) {
1196
- try {
1197
- queue[i](performance.now());
1198
- }
1199
- catch (e) {
1200
- consoleError(e);
1201
- }
1202
- }
1203
- queue.length = 0;
1204
- };
1205
- const flush = () => {
1206
- // always force a bunch of medium callbacks to run, but still have
1207
- // a throttle on how many can run in a certain time
1208
- // DOM READS!!!
1209
- consume(queueDomReads);
1210
- // DOM WRITES!!!
1211
- {
1212
- consume(queueDomWrites);
1213
- if ((queuePending = queueDomReads.length > 0)) {
1214
- // still more to do yet, but we've run out of time
1215
- // let's let this thing cool off and try again in the next tick
1216
- plt.raf(flush);
1217
- }
1218
- }
1219
- };
1220
- const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1221
- const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1222
-
1223
- export { bootstrapLazy as b, createEvent as c, h, promiseResolve as p, registerInstance as r };