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