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