@everymatrix/casino-engagement-suite-tournament 1.44.0 → 1.45.5

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 (71) hide show
  1. package/dist/casino-engagement-suite-tournament/casino-engagement-suite-tournament.esm.js +1 -1
  2. package/dist/casino-engagement-suite-tournament/index.esm.js +1 -0
  3. package/dist/casino-engagement-suite-tournament/p-0f4e94ab.entry.js +1 -0
  4. package/dist/casino-engagement-suite-tournament/p-1bf11325.js +2 -0
  5. package/dist/casino-engagement-suite-tournament/p-5df3ac81.js +1 -0
  6. package/dist/casino-engagement-suite-tournament/p-e1255160.js +1 -0
  7. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  8. package/dist/cjs/casino-engagement-suite-progress-bar_3.cjs.entry.js +119 -807
  9. package/dist/cjs/casino-engagement-suite-tournament-1b738bb2.js +560 -0
  10. package/dist/cjs/casino-engagement-suite-tournament.cjs.js +16 -10
  11. package/dist/cjs/index-16d5d7c3.js +1642 -0
  12. package/dist/cjs/index.cjs.js +8 -0
  13. package/dist/cjs/loader.cjs.js +6 -12
  14. package/dist/collection/collection-manifest.json +3 -3
  15. package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.css +17 -17
  16. package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.js +492 -582
  17. package/dist/collection/components/casino-engagement-suite-tournament/index.js +1 -0
  18. package/dist/collection/index.js +1 -1
  19. package/dist/collection/shared/GradientRoundedButton.js +6 -7
  20. package/dist/collection/shared/renderBar.js +11 -11
  21. package/dist/collection/utils/api.apdater.js +30 -30
  22. package/dist/collection/utils/translations.js +19 -19
  23. package/dist/collection/utils/types.js +9 -9
  24. package/dist/collection/utils/util.date.js +26 -26
  25. package/dist/collection/utils/utils.js +16 -16
  26. package/dist/esm/app-globals-0f993ce5.js +3 -0
  27. package/dist/esm/casino-engagement-suite-progress-bar_3.entry.js +119 -807
  28. package/dist/esm/casino-engagement-suite-tournament-d8471680.js +558 -0
  29. package/dist/esm/casino-engagement-suite-tournament.js +13 -10
  30. package/dist/esm/index-3962add4.js +1612 -0
  31. package/dist/esm/index.js +2 -1
  32. package/dist/esm/loader.js +6 -12
  33. package/dist/stencil.config.dev.js +14 -0
  34. package/dist/stencil.config.js +14 -19
  35. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.d.ts +2 -0
  36. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.dev.d.ts +2 -0
  37. package/dist/types/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.d.ts +120 -123
  38. package/dist/types/components/casino-engagement-suite-tournament/index.d.ts +1 -0
  39. package/dist/types/components.d.ts +17 -1
  40. package/dist/types/index.d.ts +1 -1
  41. package/dist/types/shared/GradientRoundedButton.d.ts +3 -3
  42. package/dist/types/stencil-public-runtime.d.ts +142 -33
  43. package/dist/types/utils/api.apdater.d.ts +2 -30
  44. package/dist/types/utils/translations.d.ts +35 -35
  45. package/dist/types/utils/types.d.ts +77 -77
  46. package/loader/cdn.js +1 -3
  47. package/loader/index.cjs.js +1 -3
  48. package/loader/index.d.ts +13 -1
  49. package/loader/index.es2017.js +1 -3
  50. package/loader/index.js +1 -3
  51. package/loader/package.json +1 -0
  52. package/package.json +8 -8
  53. package/dist/casino-engagement-suite-tournament/p-023f3dc7.entry.js +0 -1
  54. package/dist/casino-engagement-suite-tournament/p-86ce7485.js +0 -1
  55. package/dist/cjs/index-e778ddd2.js +0 -1733
  56. package/dist/components/casino-engagement-suite-progress-bar.js +0 -6
  57. package/dist/components/casino-engagement-suite-progress-bar2.js +0 -107
  58. package/dist/components/casino-engagement-suite-tournament.d.ts +0 -11
  59. package/dist/components/casino-engagement-suite-tournament.js +0 -716
  60. package/dist/components/general-styling-wrapper.js +0 -6
  61. package/dist/components/general-styling-wrapper2.js +0 -103
  62. package/dist/components/index.d.ts +0 -26
  63. package/dist/components/index.js +0 -1
  64. package/dist/esm/index-4e611d33.js +0 -1704
  65. package/dist/esm/polyfills/core-js.js +0 -11
  66. package/dist/esm/polyfills/css-shim.js +0 -1
  67. package/dist/esm/polyfills/dom.js +0 -79
  68. package/dist/esm/polyfills/es5-html-element.js +0 -1
  69. package/dist/esm/polyfills/index.js +0 -34
  70. package/dist/esm/polyfills/system.js +0 -6
  71. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-engagement-suite-tournament/.stencil/packages/casino-engagement-suite-tournament/stencil.config.d.ts +0 -2
@@ -1,1704 +0,0 @@
1
- const NAMESPACE = 'casino-engagement-suite-tournament';
2
-
3
- let scopeId;
4
- let contentRef;
5
- let hostTagName;
6
- let useNativeShadowDom = false;
7
- let checkSlotFallbackVisibility = false;
8
- let checkSlotRelocate = false;
9
- let isSvgMode = false;
10
- let queuePending = false;
11
- const win = typeof window !== 'undefined' ? window : {};
12
- const doc = win.document || { head: {} };
13
- const plt = {
14
- $flags$: 0,
15
- $resourcesUrl$: '',
16
- jmp: (h) => h(),
17
- raf: (h) => requestAnimationFrame(h),
18
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
19
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
20
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
21
- };
22
- const promiseResolve = (v) => Promise.resolve(v);
23
- const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
24
- try {
25
- new CSSStyleSheet();
26
- return typeof new CSSStyleSheet().replace === 'function';
27
- }
28
- catch (e) { }
29
- return false;
30
- })()
31
- ;
32
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
33
- if (listeners) {
34
- listeners.map(([flags, name, method]) => {
35
- const target = getHostListenerTarget(elm, flags) ;
36
- const handler = hostListenerProxy(hostRef, method);
37
- const opts = hostListenerOpts(flags);
38
- plt.ael(target, name, handler, opts);
39
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
40
- });
41
- }
42
- };
43
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
44
- try {
45
- {
46
- if (hostRef.$flags$ & 256 /* isListenReady */) {
47
- // instance is ready, let's call it's member method for this event
48
- hostRef.$lazyInstance$[methodName](ev);
49
- }
50
- else {
51
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
52
- }
53
- }
54
- }
55
- catch (e) {
56
- consoleError(e);
57
- }
58
- };
59
- const getHostListenerTarget = (elm, flags) => {
60
- if (flags & 8 /* TargetWindow */)
61
- return win;
62
- return elm;
63
- };
64
- // prettier-ignore
65
- const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
66
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
67
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
68
- const createTime = (fnName, tagName = '') => {
69
- {
70
- return () => {
71
- return;
72
- };
73
- }
74
- };
75
- const uniqueTime = (key, measureText) => {
76
- {
77
- return () => {
78
- return;
79
- };
80
- }
81
- };
82
- const rootAppliedStyles = new WeakMap();
83
- const registerStyle = (scopeId, cssText, allowCS) => {
84
- let style = styles.get(scopeId);
85
- if (supportsConstructibleStylesheets && allowCS) {
86
- style = (style || new CSSStyleSheet());
87
- style.replace(cssText);
88
- }
89
- else {
90
- style = cssText;
91
- }
92
- styles.set(scopeId, style);
93
- };
94
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
95
- let scopeId = getScopeId(cmpMeta);
96
- let style = styles.get(scopeId);
97
- // if an element is NOT connected then getRootNode() will return the wrong root node
98
- // so the fallback is to always use the document for the root node in those cases
99
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
100
- if (style) {
101
- if (typeof style === 'string') {
102
- styleContainerNode = styleContainerNode.head || styleContainerNode;
103
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
104
- let styleElm;
105
- if (!appliedStyles) {
106
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
107
- }
108
- if (!appliedStyles.has(scopeId)) {
109
- {
110
- {
111
- styleElm = doc.createElement('style');
112
- styleElm.innerHTML = style;
113
- }
114
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
115
- }
116
- if (appliedStyles) {
117
- appliedStyles.add(scopeId);
118
- }
119
- }
120
- }
121
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
122
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
123
- }
124
- }
125
- return scopeId;
126
- };
127
- const attachStyles = (hostRef) => {
128
- const cmpMeta = hostRef.$cmpMeta$;
129
- const elm = hostRef.$hostElement$;
130
- const flags = cmpMeta.$flags$;
131
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
132
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
133
- if (flags & 10 /* needsScopedEncapsulation */) {
134
- // only required when we're NOT using native shadow dom (slot)
135
- // or this browser doesn't support native shadow dom
136
- // and this host element was NOT created with SSR
137
- // let's pick out the inner content for slot projection
138
- // create a node to represent where the original
139
- // content was first placed, which is useful later on
140
- // DOM WRITE!!
141
- elm['s-sc'] = scopeId;
142
- elm.classList.add(scopeId + '-h');
143
- }
144
- endAttachStyles();
145
- };
146
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
147
- /**
148
- * Default style mode id
149
- */
150
- /**
151
- * Reusable empty obj/array
152
- * Don't add values to these!!
153
- */
154
- const EMPTY_OBJ = {};
155
- const isDef = (v) => v != null;
156
- const isComplexType = (o) => {
157
- // https://jsperf.com/typeof-fn-object/5
158
- o = typeof o;
159
- return o === 'object' || o === 'function';
160
- };
161
- /**
162
- * Production h() function based on Preact by
163
- * Jason Miller (@developit)
164
- * Licensed under the MIT License
165
- * https://github.com/developit/preact/blob/master/LICENSE
166
- *
167
- * Modified for Stencil's compiler and vdom
168
- */
169
- // const stack: any[] = [];
170
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
171
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
172
- const h = (nodeName, vnodeData, ...children) => {
173
- let child = null;
174
- let key = null;
175
- let slotName = null;
176
- let simple = false;
177
- let lastSimple = false;
178
- let vNodeChildren = [];
179
- const walk = (c) => {
180
- for (let i = 0; i < c.length; i++) {
181
- child = c[i];
182
- if (Array.isArray(child)) {
183
- walk(child);
184
- }
185
- else if (child != null && typeof child !== 'boolean') {
186
- if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
187
- child = String(child);
188
- }
189
- if (simple && lastSimple) {
190
- // If the previous child was simple (string), we merge both
191
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
192
- }
193
- else {
194
- // Append a new vNode, if it's text, we create a text vNode
195
- vNodeChildren.push(simple ? newVNode(null, child) : child);
196
- }
197
- lastSimple = simple;
198
- }
199
- }
200
- };
201
- walk(children);
202
- if (vnodeData) {
203
- // normalize class / classname attributes
204
- if (vnodeData.key) {
205
- key = vnodeData.key;
206
- }
207
- if (vnodeData.name) {
208
- slotName = vnodeData.name;
209
- }
210
- {
211
- const classData = vnodeData.className || vnodeData.class;
212
- if (classData) {
213
- vnodeData.class =
214
- typeof classData !== 'object'
215
- ? classData
216
- : Object.keys(classData)
217
- .filter((k) => classData[k])
218
- .join(' ');
219
- }
220
- }
221
- }
222
- if (typeof nodeName === 'function') {
223
- // nodeName is a functional component
224
- return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
225
- }
226
- const vnode = newVNode(nodeName, null);
227
- vnode.$attrs$ = vnodeData;
228
- if (vNodeChildren.length > 0) {
229
- vnode.$children$ = vNodeChildren;
230
- }
231
- {
232
- vnode.$key$ = key;
233
- }
234
- {
235
- vnode.$name$ = slotName;
236
- }
237
- return vnode;
238
- };
239
- const newVNode = (tag, text) => {
240
- const vnode = {
241
- $flags$: 0,
242
- $tag$: tag,
243
- $text$: text,
244
- $elm$: null,
245
- $children$: null,
246
- };
247
- {
248
- vnode.$attrs$ = null;
249
- }
250
- {
251
- vnode.$key$ = null;
252
- }
253
- {
254
- vnode.$name$ = null;
255
- }
256
- return vnode;
257
- };
258
- const Host = {};
259
- const isHost = (node) => node && node.$tag$ === Host;
260
- const vdomFnUtils = {
261
- forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
262
- map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
263
- };
264
- const convertToPublic = (node) => ({
265
- vattrs: node.$attrs$,
266
- vchildren: node.$children$,
267
- vkey: node.$key$,
268
- vname: node.$name$,
269
- vtag: node.$tag$,
270
- vtext: node.$text$,
271
- });
272
- const convertToPrivate = (node) => {
273
- if (typeof node.vtag === 'function') {
274
- const vnodeData = Object.assign({}, node.vattrs);
275
- if (node.vkey) {
276
- vnodeData.key = node.vkey;
277
- }
278
- if (node.vname) {
279
- vnodeData.name = node.vname;
280
- }
281
- return h(node.vtag, vnodeData, ...(node.vchildren || []));
282
- }
283
- const vnode = newVNode(node.vtag, node.vtext);
284
- vnode.$attrs$ = node.vattrs;
285
- vnode.$children$ = node.vchildren;
286
- vnode.$key$ = node.vkey;
287
- vnode.$name$ = node.vname;
288
- return vnode;
289
- };
290
- /**
291
- * Production setAccessor() function based on Preact by
292
- * Jason Miller (@developit)
293
- * Licensed under the MIT License
294
- * https://github.com/developit/preact/blob/master/LICENSE
295
- *
296
- * Modified for Stencil's compiler and vdom
297
- */
298
- const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
299
- if (oldValue !== newValue) {
300
- let isProp = isMemberInElement(elm, memberName);
301
- let ln = memberName.toLowerCase();
302
- if (memberName === 'class') {
303
- const classList = elm.classList;
304
- const oldClasses = parseClassList(oldValue);
305
- const newClasses = parseClassList(newValue);
306
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
307
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
308
- }
309
- else if (memberName === 'style') {
310
- // update style attribute, css properties and values
311
- {
312
- for (const prop in oldValue) {
313
- if (!newValue || newValue[prop] == null) {
314
- if (prop.includes('-')) {
315
- elm.style.removeProperty(prop);
316
- }
317
- else {
318
- elm.style[prop] = '';
319
- }
320
- }
321
- }
322
- }
323
- for (const prop in newValue) {
324
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
325
- if (prop.includes('-')) {
326
- elm.style.setProperty(prop, newValue[prop]);
327
- }
328
- else {
329
- elm.style[prop] = newValue[prop];
330
- }
331
- }
332
- }
333
- }
334
- else if (memberName === 'key')
335
- ;
336
- else if (memberName === 'ref') {
337
- // minifier will clean this up
338
- if (newValue) {
339
- newValue(elm);
340
- }
341
- }
342
- else if ((!isProp ) &&
343
- memberName[0] === 'o' &&
344
- memberName[1] === 'n') {
345
- // Event Handlers
346
- // so if the member name starts with "on" and the 3rd characters is
347
- // a capital letter, and it's not already a member on the element,
348
- // then we're assuming it's an event listener
349
- if (memberName[2] === '-') {
350
- // on- prefixed events
351
- // allows to be explicit about the dom event to listen without any magic
352
- // under the hood:
353
- // <my-cmp on-click> // listens for "click"
354
- // <my-cmp on-Click> // listens for "Click"
355
- // <my-cmp on-ionChange> // listens for "ionChange"
356
- // <my-cmp on-EVENTS> // listens for "EVENTS"
357
- memberName = memberName.slice(3);
358
- }
359
- else if (isMemberInElement(win, ln)) {
360
- // standard event
361
- // the JSX attribute could have been "onMouseOver" and the
362
- // member name "onmouseover" is on the window's prototype
363
- // so let's add the listener "mouseover", which is all lowercased
364
- memberName = ln.slice(2);
365
- }
366
- else {
367
- // custom event
368
- // the JSX attribute could have been "onMyCustomEvent"
369
- // so let's trim off the "on" prefix and lowercase the first character
370
- // and add the listener "myCustomEvent"
371
- // except for the first character, we keep the event name case
372
- memberName = ln[2] + memberName.slice(3);
373
- }
374
- if (oldValue) {
375
- plt.rel(elm, memberName, oldValue, false);
376
- }
377
- if (newValue) {
378
- plt.ael(elm, memberName, newValue, false);
379
- }
380
- }
381
- else {
382
- // Set property if it exists and it's not a SVG
383
- const isComplex = isComplexType(newValue);
384
- if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
385
- try {
386
- if (!elm.tagName.includes('-')) {
387
- let n = newValue == null ? '' : newValue;
388
- // Workaround for Safari, moving the <input> caret when re-assigning the same valued
389
- if (memberName === 'list') {
390
- isProp = false;
391
- }
392
- else if (oldValue == null || elm[memberName] != n) {
393
- elm[memberName] = n;
394
- }
395
- }
396
- else {
397
- elm[memberName] = newValue;
398
- }
399
- }
400
- catch (e) { }
401
- }
402
- /**
403
- * Need to manually update attribute if:
404
- * - memberName is not an attribute
405
- * - if we are rendering the host element in order to reflect attribute
406
- * - if it's a SVG, since properties might not work in <svg>
407
- * - if the newValue is null/undefined or 'false'.
408
- */
409
- let xlink = false;
410
- {
411
- if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
412
- memberName = ln;
413
- xlink = true;
414
- }
415
- }
416
- if (newValue == null || newValue === false) {
417
- if (newValue !== false || elm.getAttribute(memberName) === '') {
418
- if (xlink) {
419
- elm.removeAttributeNS(XLINK_NS, memberName);
420
- }
421
- else {
422
- elm.removeAttribute(memberName);
423
- }
424
- }
425
- }
426
- else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
427
- newValue = newValue === true ? '' : newValue;
428
- if (xlink) {
429
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
430
- }
431
- else {
432
- elm.setAttribute(memberName, newValue);
433
- }
434
- }
435
- }
436
- }
437
- };
438
- const parseClassListRegex = /\s/;
439
- const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
440
- const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
441
- // if the element passed in is a shadow root, which is a document fragment
442
- // then we want to be adding attrs/props to the shadow root's "host" element
443
- // if it's not a shadow root, then we add attrs/props to the same element
444
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
445
- ? newVnode.$elm$.host
446
- : newVnode.$elm$;
447
- const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
448
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
449
- {
450
- // remove attributes no longer present on the vnode by setting them to undefined
451
- for (memberName in oldVnodeAttrs) {
452
- if (!(memberName in newVnodeAttrs)) {
453
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
454
- }
455
- }
456
- }
457
- // add new & update changed attributes
458
- for (memberName in newVnodeAttrs) {
459
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
460
- }
461
- };
462
- const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
463
- // tslint:disable-next-line: prefer-const
464
- let newVNode = newParentVNode.$children$[childIndex];
465
- let i = 0;
466
- let elm;
467
- let childNode;
468
- let oldVNode;
469
- if (!useNativeShadowDom) {
470
- // remember for later we need to check to relocate nodes
471
- checkSlotRelocate = true;
472
- if (newVNode.$tag$ === 'slot') {
473
- if (scopeId) {
474
- // scoped css needs to add its scoped id to the parent element
475
- parentElm.classList.add(scopeId + '-s');
476
- }
477
- newVNode.$flags$ |= newVNode.$children$
478
- ? // slot element has fallback content
479
- 2 /* isSlotFallback */
480
- : // slot element does not have fallback content
481
- 1 /* isSlotReference */;
482
- }
483
- }
484
- if (newVNode.$text$ !== null) {
485
- // create text node
486
- elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
487
- }
488
- else if (newVNode.$flags$ & 1 /* isSlotReference */) {
489
- // create a slot reference node
490
- elm = newVNode.$elm$ =
491
- doc.createTextNode('');
492
- }
493
- else {
494
- // create element
495
- elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* isSlotFallback */
496
- ? 'slot-fb'
497
- : newVNode.$tag$));
498
- // add css classes, attrs, props, listeners, etc.
499
- {
500
- updateElement(null, newVNode, isSvgMode);
501
- }
502
- if (isDef(scopeId) && elm['s-si'] !== scopeId) {
503
- // if there is a scopeId and this is the initial render
504
- // then let's add the scopeId as a css class
505
- elm.classList.add((elm['s-si'] = scopeId));
506
- }
507
- if (newVNode.$children$) {
508
- for (i = 0; i < newVNode.$children$.length; ++i) {
509
- // create the node
510
- childNode = createElm(oldParentVNode, newVNode, i, elm);
511
- // return node could have been null
512
- if (childNode) {
513
- // append our new node
514
- elm.appendChild(childNode);
515
- }
516
- }
517
- }
518
- }
519
- {
520
- elm['s-hn'] = hostTagName;
521
- if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
522
- // remember the content reference comment
523
- elm['s-sr'] = true;
524
- // remember the content reference comment
525
- elm['s-cr'] = contentRef;
526
- // remember the slot name, or empty string for default slot
527
- elm['s-sn'] = newVNode.$name$ || '';
528
- // check if we've got an old vnode for this slot
529
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
530
- if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
531
- // we've got an old slot vnode and the wrapper is being replaced
532
- // so let's move the old slot content back to it's original location
533
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
534
- }
535
- }
536
- }
537
- return elm;
538
- };
539
- const putBackInOriginalLocation = (parentElm, recursive) => {
540
- plt.$flags$ |= 1 /* isTmpDisconnected */;
541
- const oldSlotChildNodes = parentElm.childNodes;
542
- for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
543
- const childNode = oldSlotChildNodes[i];
544
- if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
545
- // // this child node in the old element is from another component
546
- // // remove this node from the old slot's parent
547
- // childNode.remove();
548
- // and relocate it back to it's original location
549
- parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
550
- // remove the old original location comment entirely
551
- // later on the patch function will know what to do
552
- // and move this to the correct spot in need be
553
- childNode['s-ol'].remove();
554
- childNode['s-ol'] = undefined;
555
- checkSlotRelocate = true;
556
- }
557
- if (recursive) {
558
- putBackInOriginalLocation(childNode, recursive);
559
- }
560
- }
561
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
562
- };
563
- const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
564
- let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
565
- let childNode;
566
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
567
- containerElm = containerElm.shadowRoot;
568
- }
569
- for (; startIdx <= endIdx; ++startIdx) {
570
- if (vnodes[startIdx]) {
571
- childNode = createElm(null, parentVNode, startIdx, parentElm);
572
- if (childNode) {
573
- vnodes[startIdx].$elm$ = childNode;
574
- containerElm.insertBefore(childNode, referenceNode(before) );
575
- }
576
- }
577
- }
578
- };
579
- const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
580
- for (; startIdx <= endIdx; ++startIdx) {
581
- if ((vnode = vnodes[startIdx])) {
582
- elm = vnode.$elm$;
583
- callNodeRefs(vnode);
584
- {
585
- // we're removing this element
586
- // so it's possible we need to show slot fallback content now
587
- checkSlotFallbackVisibility = true;
588
- if (elm['s-ol']) {
589
- // remove the original location comment
590
- elm['s-ol'].remove();
591
- }
592
- else {
593
- // it's possible that child nodes of the node
594
- // that's being removed are slot nodes
595
- putBackInOriginalLocation(elm, true);
596
- }
597
- }
598
- // remove the vnode's element from the dom
599
- elm.remove();
600
- }
601
- }
602
- };
603
- const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
604
- let oldStartIdx = 0;
605
- let newStartIdx = 0;
606
- let idxInOld = 0;
607
- let i = 0;
608
- let oldEndIdx = oldCh.length - 1;
609
- let oldStartVnode = oldCh[0];
610
- let oldEndVnode = oldCh[oldEndIdx];
611
- let newEndIdx = newCh.length - 1;
612
- let newStartVnode = newCh[0];
613
- let newEndVnode = newCh[newEndIdx];
614
- let node;
615
- let elmToMove;
616
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
617
- if (oldStartVnode == null) {
618
- // Vnode might have been moved left
619
- oldStartVnode = oldCh[++oldStartIdx];
620
- }
621
- else if (oldEndVnode == null) {
622
- oldEndVnode = oldCh[--oldEndIdx];
623
- }
624
- else if (newStartVnode == null) {
625
- newStartVnode = newCh[++newStartIdx];
626
- }
627
- else if (newEndVnode == null) {
628
- newEndVnode = newCh[--newEndIdx];
629
- }
630
- else if (isSameVnode(oldStartVnode, newStartVnode)) {
631
- patch(oldStartVnode, newStartVnode);
632
- oldStartVnode = oldCh[++oldStartIdx];
633
- newStartVnode = newCh[++newStartIdx];
634
- }
635
- else if (isSameVnode(oldEndVnode, newEndVnode)) {
636
- patch(oldEndVnode, newEndVnode);
637
- oldEndVnode = oldCh[--oldEndIdx];
638
- newEndVnode = newCh[--newEndIdx];
639
- }
640
- else if (isSameVnode(oldStartVnode, newEndVnode)) {
641
- // Vnode moved right
642
- if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
643
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
644
- }
645
- patch(oldStartVnode, newEndVnode);
646
- parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
647
- oldStartVnode = oldCh[++oldStartIdx];
648
- newEndVnode = newCh[--newEndIdx];
649
- }
650
- else if (isSameVnode(oldEndVnode, newStartVnode)) {
651
- // Vnode moved left
652
- if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
653
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
654
- }
655
- patch(oldEndVnode, newStartVnode);
656
- parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
657
- oldEndVnode = oldCh[--oldEndIdx];
658
- newStartVnode = newCh[++newStartIdx];
659
- }
660
- else {
661
- // createKeyToOldIdx
662
- idxInOld = -1;
663
- {
664
- for (i = oldStartIdx; i <= oldEndIdx; ++i) {
665
- if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
666
- idxInOld = i;
667
- break;
668
- }
669
- }
670
- }
671
- if (idxInOld >= 0) {
672
- elmToMove = oldCh[idxInOld];
673
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
674
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
675
- }
676
- else {
677
- patch(elmToMove, newStartVnode);
678
- oldCh[idxInOld] = undefined;
679
- node = elmToMove.$elm$;
680
- }
681
- newStartVnode = newCh[++newStartIdx];
682
- }
683
- else {
684
- // new element
685
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
686
- newStartVnode = newCh[++newStartIdx];
687
- }
688
- if (node) {
689
- {
690
- parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
691
- }
692
- }
693
- }
694
- }
695
- if (oldStartIdx > oldEndIdx) {
696
- addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
697
- }
698
- else if (newStartIdx > newEndIdx) {
699
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
700
- }
701
- };
702
- const isSameVnode = (vnode1, vnode2) => {
703
- // compare if two vnode to see if they're "technically" the same
704
- // need to have the same element tag, and same key to be the same
705
- if (vnode1.$tag$ === vnode2.$tag$) {
706
- if (vnode1.$tag$ === 'slot') {
707
- return vnode1.$name$ === vnode2.$name$;
708
- }
709
- {
710
- return vnode1.$key$ === vnode2.$key$;
711
- }
712
- }
713
- return false;
714
- };
715
- const referenceNode = (node) => {
716
- // this node was relocated to a new location in the dom
717
- // because of some other component's slot
718
- // but we still have an html comment in place of where
719
- // it's original location was according to it's original vdom
720
- return (node && node['s-ol']) || node;
721
- };
722
- const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
723
- const patch = (oldVNode, newVNode) => {
724
- const elm = (newVNode.$elm$ = oldVNode.$elm$);
725
- const oldChildren = oldVNode.$children$;
726
- const newChildren = newVNode.$children$;
727
- const tag = newVNode.$tag$;
728
- const text = newVNode.$text$;
729
- let defaultHolder;
730
- if (text === null) {
731
- // element node
732
- {
733
- if (tag === 'slot')
734
- ;
735
- else {
736
- // either this is the first render of an element OR it's an update
737
- // AND we already know it's possible it could have changed
738
- // this updates the element's css classes, attrs, props, listeners, etc.
739
- updateElement(oldVNode, newVNode, isSvgMode);
740
- }
741
- }
742
- if (oldChildren !== null && newChildren !== null) {
743
- // looks like there's child vnodes for both the old and new vnodes
744
- updateChildren(elm, oldChildren, newVNode, newChildren);
745
- }
746
- else if (newChildren !== null) {
747
- // no old child vnodes, but there are new child vnodes to add
748
- if (oldVNode.$text$ !== null) {
749
- // the old vnode was text, so be sure to clear it out
750
- elm.textContent = '';
751
- }
752
- // add the new vnode children
753
- addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
754
- }
755
- else if (oldChildren !== null) {
756
- // no new child vnodes, but there are old child vnodes to remove
757
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
758
- }
759
- }
760
- else if ((defaultHolder = elm['s-cr'])) {
761
- // this element has slotted content
762
- defaultHolder.parentNode.textContent = text;
763
- }
764
- else if (oldVNode.$text$ !== text) {
765
- // update the text content for the text only vnode
766
- // and also only if the text is different than before
767
- elm.data = text;
768
- }
769
- };
770
- const updateFallbackSlotVisibility = (elm) => {
771
- // tslint:disable-next-line: prefer-const
772
- let childNodes = elm.childNodes;
773
- let childNode;
774
- let i;
775
- let ilen;
776
- let j;
777
- let slotNameAttr;
778
- let nodeType;
779
- for (i = 0, ilen = childNodes.length; i < ilen; i++) {
780
- childNode = childNodes[i];
781
- if (childNode.nodeType === 1 /* ElementNode */) {
782
- if (childNode['s-sr']) {
783
- // this is a slot fallback node
784
- // get the slot name for this slot reference node
785
- slotNameAttr = childNode['s-sn'];
786
- // by default always show a fallback slot node
787
- // then hide it if there are other slots in the light dom
788
- childNode.hidden = false;
789
- for (j = 0; j < ilen; j++) {
790
- nodeType = childNodes[j].nodeType;
791
- if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
792
- // this sibling node is from a different component OR is a named fallback slot node
793
- if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
794
- childNode.hidden = true;
795
- break;
796
- }
797
- }
798
- else {
799
- // this is a default fallback slot node
800
- // any element or text node (with content)
801
- // should hide the default fallback slot node
802
- if (nodeType === 1 /* ElementNode */ ||
803
- (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
804
- childNode.hidden = true;
805
- break;
806
- }
807
- }
808
- }
809
- }
810
- // keep drilling down
811
- updateFallbackSlotVisibility(childNode);
812
- }
813
- }
814
- };
815
- const relocateNodes = [];
816
- const relocateSlotContent = (elm) => {
817
- // tslint:disable-next-line: prefer-const
818
- let childNode;
819
- let node;
820
- let hostContentNodes;
821
- let slotNameAttr;
822
- let relocateNodeData;
823
- let j;
824
- let i = 0;
825
- let childNodes = elm.childNodes;
826
- let ilen = childNodes.length;
827
- for (; i < ilen; i++) {
828
- childNode = childNodes[i];
829
- if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
830
- // first got the content reference comment node
831
- // then we got it's parent, which is where all the host content is in now
832
- hostContentNodes = node.parentNode.childNodes;
833
- slotNameAttr = childNode['s-sn'];
834
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
835
- node = hostContentNodes[j];
836
- if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
837
- // let's do some relocating to its new home
838
- // but never relocate a content reference node
839
- // that is suppose to always represent the original content location
840
- if (isNodeLocatedInSlot(node, slotNameAttr)) {
841
- // it's possible we've already decided to relocate this node
842
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
843
- // made some changes to slots
844
- // let's make sure we also double check
845
- // fallbacks are correctly hidden or shown
846
- checkSlotFallbackVisibility = true;
847
- node['s-sn'] = node['s-sn'] || slotNameAttr;
848
- if (relocateNodeData) {
849
- // previously we never found a slot home for this node
850
- // but turns out we did, so let's remember it now
851
- relocateNodeData.$slotRefNode$ = childNode;
852
- }
853
- else {
854
- // add to our list of nodes to relocate
855
- relocateNodes.push({
856
- $slotRefNode$: childNode,
857
- $nodeToRelocate$: node,
858
- });
859
- }
860
- if (node['s-sr']) {
861
- relocateNodes.map((relocateNode) => {
862
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
863
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
864
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
865
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
866
- }
867
- }
868
- });
869
- }
870
- }
871
- else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
872
- // so far this element does not have a slot home, not setting slotRefNode on purpose
873
- // if we never find a home for this element then we'll need to hide it
874
- relocateNodes.push({
875
- $nodeToRelocate$: node,
876
- });
877
- }
878
- }
879
- }
880
- }
881
- if (childNode.nodeType === 1 /* ElementNode */) {
882
- relocateSlotContent(childNode);
883
- }
884
- }
885
- };
886
- const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
887
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
888
- if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
889
- return true;
890
- }
891
- if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
892
- return true;
893
- }
894
- return false;
895
- }
896
- if (nodeToRelocate['s-sn'] === slotNameAttr) {
897
- return true;
898
- }
899
- return slotNameAttr === '';
900
- };
901
- const callNodeRefs = (vNode) => {
902
- {
903
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
904
- vNode.$children$ && vNode.$children$.map(callNodeRefs);
905
- }
906
- };
907
- const renderVdom = (hostRef, renderFnResults) => {
908
- const hostElm = hostRef.$hostElement$;
909
- const cmpMeta = hostRef.$cmpMeta$;
910
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
911
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
912
- hostTagName = hostElm.tagName;
913
- if (cmpMeta.$attrsToReflect$) {
914
- rootVnode.$attrs$ = rootVnode.$attrs$ || {};
915
- cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
916
- }
917
- rootVnode.$tag$ = null;
918
- rootVnode.$flags$ |= 4 /* isHost */;
919
- hostRef.$vnode$ = rootVnode;
920
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
921
- {
922
- scopeId = hostElm['s-sc'];
923
- }
924
- {
925
- contentRef = hostElm['s-cr'];
926
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
927
- // always reset
928
- checkSlotFallbackVisibility = false;
929
- }
930
- // synchronous patch
931
- patch(oldVNode, rootVnode);
932
- {
933
- // while we're moving nodes around existing nodes, temporarily disable
934
- // the disconnectCallback from working
935
- plt.$flags$ |= 1 /* isTmpDisconnected */;
936
- if (checkSlotRelocate) {
937
- relocateSlotContent(rootVnode.$elm$);
938
- let relocateData;
939
- let nodeToRelocate;
940
- let orgLocationNode;
941
- let parentNodeRef;
942
- let insertBeforeNode;
943
- let refNode;
944
- let i = 0;
945
- for (; i < relocateNodes.length; i++) {
946
- relocateData = relocateNodes[i];
947
- nodeToRelocate = relocateData.$nodeToRelocate$;
948
- if (!nodeToRelocate['s-ol']) {
949
- // add a reference node marking this node's original location
950
- // keep a reference to this node for later lookups
951
- orgLocationNode =
952
- doc.createTextNode('');
953
- orgLocationNode['s-nr'] = nodeToRelocate;
954
- nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
955
- }
956
- }
957
- for (i = 0; i < relocateNodes.length; i++) {
958
- relocateData = relocateNodes[i];
959
- nodeToRelocate = relocateData.$nodeToRelocate$;
960
- if (relocateData.$slotRefNode$) {
961
- // by default we're just going to insert it directly
962
- // after the slot reference node
963
- parentNodeRef = relocateData.$slotRefNode$.parentNode;
964
- insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
965
- orgLocationNode = nodeToRelocate['s-ol'];
966
- while ((orgLocationNode = orgLocationNode.previousSibling)) {
967
- refNode = orgLocationNode['s-nr'];
968
- if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
969
- refNode = refNode.nextSibling;
970
- if (!refNode || !refNode['s-nr']) {
971
- insertBeforeNode = refNode;
972
- break;
973
- }
974
- }
975
- }
976
- if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
977
- nodeToRelocate.nextSibling !== insertBeforeNode) {
978
- // we've checked that it's worth while to relocate
979
- // since that the node to relocate
980
- // has a different next sibling or parent relocated
981
- if (nodeToRelocate !== insertBeforeNode) {
982
- if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
983
- // probably a component in the index.html that doesn't have it's hostname set
984
- nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
985
- }
986
- // add it back to the dom but in its new home
987
- parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
988
- }
989
- }
990
- }
991
- else {
992
- // this node doesn't have a slot home to go to, so let's hide it
993
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
994
- nodeToRelocate.hidden = true;
995
- }
996
- }
997
- }
998
- }
999
- if (checkSlotFallbackVisibility) {
1000
- updateFallbackSlotVisibility(rootVnode.$elm$);
1001
- }
1002
- // done moving nodes around
1003
- // allow the disconnect callback to work again
1004
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1005
- // always reset
1006
- relocateNodes.length = 0;
1007
- }
1008
- };
1009
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
1010
- const createEvent = (ref, name, flags) => {
1011
- const elm = getElement(ref);
1012
- return {
1013
- emit: (detail) => {
1014
- return emitEvent(elm, name, {
1015
- bubbles: !!(flags & 4 /* Bubbles */),
1016
- composed: !!(flags & 2 /* Composed */),
1017
- cancelable: !!(flags & 1 /* Cancellable */),
1018
- detail,
1019
- });
1020
- },
1021
- };
1022
- };
1023
- /**
1024
- * Helper function to create & dispatch a custom Event on a provided target
1025
- * @param elm the target of the Event
1026
- * @param name the name to give the custom Event
1027
- * @param opts options for configuring a custom Event
1028
- * @returns the custom Event
1029
- */
1030
- const emitEvent = (elm, name, opts) => {
1031
- const ev = plt.ce(name, opts);
1032
- elm.dispatchEvent(ev);
1033
- return ev;
1034
- };
1035
- const attachToAncestor = (hostRef, ancestorComponent) => {
1036
- if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1037
- ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1038
- }
1039
- };
1040
- const scheduleUpdate = (hostRef, isInitialLoad) => {
1041
- {
1042
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1043
- }
1044
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1045
- hostRef.$flags$ |= 512 /* needsRerender */;
1046
- return;
1047
- }
1048
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1049
- // there is no ancestor component or the ancestor component
1050
- // has already fired off its lifecycle update then
1051
- // fire off the initial update
1052
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1053
- return writeTask(dispatch) ;
1054
- };
1055
- const dispatchHooks = (hostRef, isInitialLoad) => {
1056
- const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1057
- const instance = hostRef.$lazyInstance$ ;
1058
- let promise;
1059
- if (isInitialLoad) {
1060
- {
1061
- hostRef.$flags$ |= 256 /* isListenReady */;
1062
- if (hostRef.$queuedListeners$) {
1063
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1064
- hostRef.$queuedListeners$ = null;
1065
- }
1066
- }
1067
- {
1068
- promise = safeCall(instance, 'componentWillLoad');
1069
- }
1070
- }
1071
- endSchedule();
1072
- return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1073
- };
1074
- const updateComponent = async (hostRef, instance, isInitialLoad) => {
1075
- // updateComponent
1076
- const elm = hostRef.$hostElement$;
1077
- const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1078
- const rc = elm['s-rc'];
1079
- if (isInitialLoad) {
1080
- // DOM WRITE!
1081
- attachStyles(hostRef);
1082
- }
1083
- const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1084
- {
1085
- callRender(hostRef, instance);
1086
- }
1087
- if (rc) {
1088
- // ok, so turns out there are some child host elements
1089
- // waiting on this parent element to load
1090
- // let's fire off all update callbacks waiting
1091
- rc.map((cb) => cb());
1092
- elm['s-rc'] = undefined;
1093
- }
1094
- endRender();
1095
- endUpdate();
1096
- {
1097
- const childrenPromises = elm['s-p'];
1098
- const postUpdate = () => postUpdateComponent(hostRef);
1099
- if (childrenPromises.length === 0) {
1100
- postUpdate();
1101
- }
1102
- else {
1103
- Promise.all(childrenPromises).then(postUpdate);
1104
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1105
- childrenPromises.length = 0;
1106
- }
1107
- }
1108
- };
1109
- const callRender = (hostRef, instance, elm) => {
1110
- try {
1111
- instance = instance.render() ;
1112
- {
1113
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1114
- }
1115
- {
1116
- hostRef.$flags$ |= 2 /* hasRendered */;
1117
- }
1118
- {
1119
- {
1120
- // looks like we've got child nodes to render into this host element
1121
- // or we need to update the css class/attrs on the host element
1122
- // DOM WRITE!
1123
- {
1124
- renderVdom(hostRef, instance);
1125
- }
1126
- }
1127
- }
1128
- }
1129
- catch (e) {
1130
- consoleError(e, hostRef.$hostElement$);
1131
- }
1132
- return null;
1133
- };
1134
- const postUpdateComponent = (hostRef) => {
1135
- const tagName = hostRef.$cmpMeta$.$tagName$;
1136
- const elm = hostRef.$hostElement$;
1137
- const endPostUpdate = createTime('postUpdate', tagName);
1138
- const instance = hostRef.$lazyInstance$ ;
1139
- const ancestorComponent = hostRef.$ancestorComponent$;
1140
- {
1141
- safeCall(instance, 'componentDidRender');
1142
- }
1143
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1144
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1145
- {
1146
- // DOM WRITE!
1147
- addHydratedFlag(elm);
1148
- }
1149
- endPostUpdate();
1150
- {
1151
- hostRef.$onReadyResolve$(elm);
1152
- if (!ancestorComponent) {
1153
- appDidLoad();
1154
- }
1155
- }
1156
- }
1157
- else {
1158
- endPostUpdate();
1159
- }
1160
- // load events fire from bottom to top
1161
- // the deepest elements load first then bubbles up
1162
- {
1163
- if (hostRef.$onRenderResolve$) {
1164
- hostRef.$onRenderResolve$();
1165
- hostRef.$onRenderResolve$ = undefined;
1166
- }
1167
- if (hostRef.$flags$ & 512 /* needsRerender */) {
1168
- nextTick(() => scheduleUpdate(hostRef, false));
1169
- }
1170
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1171
- }
1172
- // ( •_•)
1173
- // ( •_•)>⌐■-■
1174
- // (⌐■_■)
1175
- };
1176
- const appDidLoad = (who) => {
1177
- // on appload
1178
- // we have finish the first big initial render
1179
- {
1180
- addHydratedFlag(doc.documentElement);
1181
- }
1182
- nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1183
- };
1184
- const safeCall = (instance, method, arg) => {
1185
- if (instance && instance[method]) {
1186
- try {
1187
- return instance[method](arg);
1188
- }
1189
- catch (e) {
1190
- consoleError(e);
1191
- }
1192
- }
1193
- return undefined;
1194
- };
1195
- const then = (promise, thenFn) => {
1196
- return promise && promise.then ? promise.then(thenFn) : thenFn();
1197
- };
1198
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1199
- ;
1200
- /**
1201
- * Parse a new property value for a given property type.
1202
- *
1203
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
1204
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
1205
- * 1. `any`, the type given to `propValue` in the function signature
1206
- * 2. the type stored from `propType`.
1207
- *
1208
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
1209
- *
1210
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
1211
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
1212
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
1213
- * ```tsx
1214
- * <my-cmp prop-val={0}></my-cmp>
1215
- * ```
1216
- *
1217
- * HTML prop values on the other hand, will always a string
1218
- *
1219
- * @param propValue the new value to coerce to some type
1220
- * @param propType the type of the prop, expressed as a binary number
1221
- * @returns the parsed/coerced value
1222
- */
1223
- const parsePropertyValue = (propValue, propType) => {
1224
- // ensure this value is of the correct prop type
1225
- if (propValue != null && !isComplexType(propValue)) {
1226
- if (propType & 4 /* Boolean */) {
1227
- // per the HTML spec, any string value means it is a boolean true value
1228
- // but we'll cheat here and say that the string "false" is the boolean false
1229
- return propValue === 'false' ? false : propValue === '' || !!propValue;
1230
- }
1231
- if (propType & 2 /* Number */) {
1232
- // force it to be a number
1233
- return parseFloat(propValue);
1234
- }
1235
- if (propType & 1 /* String */) {
1236
- // could have been passed as a number or boolean
1237
- // but we still want it as a string
1238
- return String(propValue);
1239
- }
1240
- // redundant return here for better minification
1241
- return propValue;
1242
- }
1243
- // not sure exactly what type we want
1244
- // so no need to change to a different type
1245
- return propValue;
1246
- };
1247
- const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1248
- const setValue = (ref, propName, newVal, cmpMeta) => {
1249
- // check our new property value against our internal value
1250
- const hostRef = getHostRef(ref);
1251
- const oldVal = hostRef.$instanceValues$.get(propName);
1252
- const flags = hostRef.$flags$;
1253
- const instance = hostRef.$lazyInstance$ ;
1254
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1255
- // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1256
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1257
- const didValueChange = newVal !== oldVal && !areBothNaN;
1258
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1259
- // gadzooks! the property's value has changed!!
1260
- // set our new value!
1261
- hostRef.$instanceValues$.set(propName, newVal);
1262
- if (instance) {
1263
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1264
- // looks like this value actually changed, so we've got work to do!
1265
- // but only if we've already rendered, otherwise just chill out
1266
- // queue that we need to do an update, but don't worry about queuing
1267
- // up millions cuz this function ensures it only runs once
1268
- scheduleUpdate(hostRef, false);
1269
- }
1270
- }
1271
- }
1272
- };
1273
- const proxyComponent = (Cstr, cmpMeta, flags) => {
1274
- if (cmpMeta.$members$) {
1275
- // It's better to have a const than two Object.entries()
1276
- const members = Object.entries(cmpMeta.$members$);
1277
- const prototype = Cstr.prototype;
1278
- members.map(([memberName, [memberFlags]]) => {
1279
- if ((memberFlags & 31 /* Prop */ ||
1280
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1281
- // proxyComponent - prop
1282
- Object.defineProperty(prototype, memberName, {
1283
- get() {
1284
- // proxyComponent, get value
1285
- return getValue(this, memberName);
1286
- },
1287
- set(newValue) {
1288
- // proxyComponent, set value
1289
- setValue(this, memberName, newValue, cmpMeta);
1290
- },
1291
- configurable: true,
1292
- enumerable: true,
1293
- });
1294
- }
1295
- });
1296
- if ((flags & 1 /* isElementConstructor */)) {
1297
- const attrNameToPropName = new Map();
1298
- prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1299
- plt.jmp(() => {
1300
- const propName = attrNameToPropName.get(attrName);
1301
- // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1302
- // in the case where an attribute was set inline.
1303
- // ```html
1304
- // <my-component some-attribute="some-value"></my-component>
1305
- // ```
1306
- //
1307
- // There is an edge case where a developer sets the attribute inline on a custom element and then
1308
- // programmatically changes it before it has been upgraded as shown below:
1309
- //
1310
- // ```html
1311
- // <!-- this component has _not_ been upgraded yet -->
1312
- // <my-component id="test" some-attribute="some-value"></my-component>
1313
- // <script>
1314
- // // grab non-upgraded component
1315
- // el = document.querySelector("#test");
1316
- // el.someAttribute = "another-value";
1317
- // // upgrade component
1318
- // customElements.define('my-component', MyComponent);
1319
- // </script>
1320
- // ```
1321
- // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1322
- // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1323
- // to the value that was set inline i.e. "some-value" from above example. When
1324
- // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
1325
- //
1326
- // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1327
- // by connectedCallback as this attributeChangedCallback will not fire.
1328
- //
1329
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1330
- //
1331
- // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1332
- // properties here given that this goes against best practices outlined here
1333
- // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1334
- if (this.hasOwnProperty(propName)) {
1335
- newValue = this[propName];
1336
- delete this[propName];
1337
- }
1338
- else if (prototype.hasOwnProperty(propName) &&
1339
- typeof this[propName] === 'number' &&
1340
- this[propName] == newValue) {
1341
- // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1342
- // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1343
- // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1344
- return;
1345
- }
1346
- this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1347
- });
1348
- };
1349
- // create an array of attributes to observe
1350
- // and also create a map of html attribute name to js property name
1351
- Cstr.observedAttributes = members
1352
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1353
- .map(([propName, m]) => {
1354
- const attrName = m[1] || propName;
1355
- attrNameToPropName.set(attrName, propName);
1356
- if (m[0] & 512 /* ReflectAttr */) {
1357
- cmpMeta.$attrsToReflect$.push([propName, attrName]);
1358
- }
1359
- return attrName;
1360
- });
1361
- }
1362
- }
1363
- return Cstr;
1364
- };
1365
- const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1366
- // initializeComponent
1367
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1368
- {
1369
- // we haven't initialized this element yet
1370
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1371
- // lazy loaded components
1372
- // request the component's implementation to be
1373
- // wired up with the host element
1374
- Cstr = loadModule(cmpMeta);
1375
- if (Cstr.then) {
1376
- // Await creates a micro-task avoid if possible
1377
- const endLoad = uniqueTime();
1378
- Cstr = await Cstr;
1379
- endLoad();
1380
- }
1381
- if (!Cstr.isProxied) {
1382
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1383
- Cstr.isProxied = true;
1384
- }
1385
- const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1386
- // ok, time to construct the instance
1387
- // but let's keep track of when we start and stop
1388
- // so that the getters/setters don't incorrectly step on data
1389
- {
1390
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1391
- }
1392
- // construct the lazy-loaded component implementation
1393
- // passing the hostRef is very important during
1394
- // construction in order to directly wire together the
1395
- // host element and the lazy-loaded instance
1396
- try {
1397
- new Cstr(hostRef);
1398
- }
1399
- catch (e) {
1400
- consoleError(e);
1401
- }
1402
- {
1403
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1404
- }
1405
- endNewInstance();
1406
- fireConnectedCallback(hostRef.$lazyInstance$);
1407
- }
1408
- if (Cstr.style) {
1409
- // this component has styles but we haven't registered them yet
1410
- let style = Cstr.style;
1411
- const scopeId = getScopeId(cmpMeta);
1412
- if (!styles.has(scopeId)) {
1413
- const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1414
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1415
- endRegisterStyles();
1416
- }
1417
- }
1418
- }
1419
- // we've successfully created a lazy instance
1420
- const ancestorComponent = hostRef.$ancestorComponent$;
1421
- const schedule = () => scheduleUpdate(hostRef, true);
1422
- if (ancestorComponent && ancestorComponent['s-rc']) {
1423
- // this is the initial load and this component it has an ancestor component
1424
- // but the ancestor component has NOT fired its will update lifecycle yet
1425
- // so let's just cool our jets and wait for the ancestor to continue first
1426
- // this will get fired off when the ancestor component
1427
- // finally gets around to rendering its lazy self
1428
- // fire off the initial update
1429
- ancestorComponent['s-rc'].push(schedule);
1430
- }
1431
- else {
1432
- schedule();
1433
- }
1434
- };
1435
- const fireConnectedCallback = (instance) => {
1436
- {
1437
- safeCall(instance, 'connectedCallback');
1438
- }
1439
- };
1440
- const connectedCallback = (elm) => {
1441
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1442
- const hostRef = getHostRef(elm);
1443
- const cmpMeta = hostRef.$cmpMeta$;
1444
- const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1445
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1446
- // first time this component has connected
1447
- hostRef.$flags$ |= 1 /* hasConnected */;
1448
- {
1449
- // initUpdate
1450
- // if the slot polyfill is required we'll need to put some nodes
1451
- // in here to act as original content anchors as we move nodes around
1452
- // host element has been connected to the DOM
1453
- if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1454
- setContentReference(elm);
1455
- }
1456
- }
1457
- {
1458
- // find the first ancestor component (if there is one) and register
1459
- // this component as one of the actively loading child components for its ancestor
1460
- let ancestorComponent = elm;
1461
- while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1462
- // climb up the ancestors looking for the first
1463
- // component that hasn't finished its lifecycle update yet
1464
- if (ancestorComponent['s-p']) {
1465
- // we found this components first ancestor component
1466
- // keep a reference to this component's ancestor component
1467
- attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1468
- break;
1469
- }
1470
- }
1471
- }
1472
- // Lazy properties
1473
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1474
- if (cmpMeta.$members$) {
1475
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1476
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1477
- const value = elm[memberName];
1478
- delete elm[memberName];
1479
- elm[memberName] = value;
1480
- }
1481
- });
1482
- }
1483
- {
1484
- initializeComponent(elm, hostRef, cmpMeta);
1485
- }
1486
- }
1487
- else {
1488
- // not the first time this has connected
1489
- // reattach any event listeners to the host
1490
- // since they would have been removed when disconnected
1491
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1492
- // fire off connectedCallback() on component instance
1493
- fireConnectedCallback(hostRef.$lazyInstance$);
1494
- }
1495
- endConnected();
1496
- }
1497
- };
1498
- const setContentReference = (elm) => {
1499
- // only required when we're NOT using native shadow dom (slot)
1500
- // or this browser doesn't support native shadow dom
1501
- // and this host element was NOT created with SSR
1502
- // let's pick out the inner content for slot projection
1503
- // create a node to represent where the original
1504
- // content was first placed, which is useful later on
1505
- const contentRefElm = (elm['s-cr'] = doc.createComment(''));
1506
- contentRefElm['s-cn'] = true;
1507
- elm.insertBefore(contentRefElm, elm.firstChild);
1508
- };
1509
- const disconnectedCallback = (elm) => {
1510
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1511
- const hostRef = getHostRef(elm);
1512
- const instance = hostRef.$lazyInstance$ ;
1513
- {
1514
- if (hostRef.$rmListeners$) {
1515
- hostRef.$rmListeners$.map((rmListener) => rmListener());
1516
- hostRef.$rmListeners$ = undefined;
1517
- }
1518
- }
1519
- {
1520
- safeCall(instance, 'disconnectedCallback');
1521
- }
1522
- }
1523
- };
1524
- const bootstrapLazy = (lazyBundles, options = {}) => {
1525
- const endBootstrap = createTime();
1526
- const cmpTags = [];
1527
- const exclude = options.exclude || [];
1528
- const customElements = win.customElements;
1529
- const head = doc.head;
1530
- const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1531
- const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1532
- const deferredConnectedCallbacks = [];
1533
- let appLoadFallback;
1534
- let isBootstrapping = true;
1535
- Object.assign(plt, options);
1536
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1537
- lazyBundles.map((lazyBundle) => {
1538
- lazyBundle[1].map((compactMeta) => {
1539
- const cmpMeta = {
1540
- $flags$: compactMeta[0],
1541
- $tagName$: compactMeta[1],
1542
- $members$: compactMeta[2],
1543
- $listeners$: compactMeta[3],
1544
- };
1545
- {
1546
- cmpMeta.$members$ = compactMeta[2];
1547
- }
1548
- {
1549
- cmpMeta.$listeners$ = compactMeta[3];
1550
- }
1551
- {
1552
- cmpMeta.$attrsToReflect$ = [];
1553
- }
1554
- const tagName = cmpMeta.$tagName$;
1555
- const HostElement = class extends HTMLElement {
1556
- // StencilLazyHost
1557
- constructor(self) {
1558
- // @ts-ignore
1559
- super(self);
1560
- self = this;
1561
- registerHost(self, cmpMeta);
1562
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1563
- // this component is using shadow dom
1564
- // and this browser supports shadow dom
1565
- // add the read-only property "shadowRoot" to the host element
1566
- // adding the shadow root build conditionals to minimize runtime
1567
- {
1568
- {
1569
- self.attachShadow({ mode: 'open' });
1570
- }
1571
- }
1572
- }
1573
- }
1574
- connectedCallback() {
1575
- if (appLoadFallback) {
1576
- clearTimeout(appLoadFallback);
1577
- appLoadFallback = null;
1578
- }
1579
- if (isBootstrapping) {
1580
- // connectedCallback will be processed once all components have been registered
1581
- deferredConnectedCallbacks.push(this);
1582
- }
1583
- else {
1584
- plt.jmp(() => connectedCallback(this));
1585
- }
1586
- }
1587
- disconnectedCallback() {
1588
- plt.jmp(() => disconnectedCallback(this));
1589
- }
1590
- componentOnReady() {
1591
- return getHostRef(this).$onReadyPromise$;
1592
- }
1593
- };
1594
- cmpMeta.$lazyBundleId$ = lazyBundle[0];
1595
- if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1596
- cmpTags.push(tagName);
1597
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1598
- }
1599
- });
1600
- });
1601
- {
1602
- visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1603
- visibilityStyle.setAttribute('data-styles', '');
1604
- head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1605
- }
1606
- // Process deferred connectedCallbacks now all components have been registered
1607
- isBootstrapping = false;
1608
- if (deferredConnectedCallbacks.length) {
1609
- deferredConnectedCallbacks.map((host) => host.connectedCallback());
1610
- }
1611
- else {
1612
- {
1613
- plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1614
- }
1615
- }
1616
- // Fallback appLoad event
1617
- endBootstrap();
1618
- };
1619
- const Fragment = (_, children) => children;
1620
- const hostRefs = new WeakMap();
1621
- const getHostRef = (ref) => hostRefs.get(ref);
1622
- const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1623
- const registerHost = (elm, cmpMeta) => {
1624
- const hostRef = {
1625
- $flags$: 0,
1626
- $hostElement$: elm,
1627
- $cmpMeta$: cmpMeta,
1628
- $instanceValues$: new Map(),
1629
- };
1630
- {
1631
- hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1632
- elm['s-p'] = [];
1633
- elm['s-rc'] = [];
1634
- }
1635
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1636
- return hostRefs.set(elm, hostRef);
1637
- };
1638
- const isMemberInElement = (elm, memberName) => memberName in elm;
1639
- const consoleError = (e, el) => (0, console.error)(e, el);
1640
- const cmpModules = /*@__PURE__*/ new Map();
1641
- const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1642
- // loadModuleImport
1643
- const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1644
- const bundleId = cmpMeta.$lazyBundleId$;
1645
- const module = cmpModules.get(bundleId) ;
1646
- if (module) {
1647
- return module[exportName];
1648
- }
1649
- return import(
1650
- /* webpackInclude: /\.entry\.js$/ */
1651
- /* webpackExclude: /\.system\.entry\.js$/ */
1652
- /* webpackMode: "lazy" */
1653
- `./${bundleId}.entry.js${''}`).then((importedModule) => {
1654
- {
1655
- cmpModules.set(bundleId, importedModule);
1656
- }
1657
- return importedModule[exportName];
1658
- }, consoleError);
1659
- };
1660
- const styles = new Map();
1661
- const queueDomReads = [];
1662
- const queueDomWrites = [];
1663
- const queueTask = (queue, write) => (cb) => {
1664
- queue.push(cb);
1665
- if (!queuePending) {
1666
- queuePending = true;
1667
- if (write && plt.$flags$ & 4 /* queueSync */) {
1668
- nextTick(flush);
1669
- }
1670
- else {
1671
- plt.raf(flush);
1672
- }
1673
- }
1674
- };
1675
- const consume = (queue) => {
1676
- for (let i = 0; i < queue.length; i++) {
1677
- try {
1678
- queue[i](performance.now());
1679
- }
1680
- catch (e) {
1681
- consoleError(e);
1682
- }
1683
- }
1684
- queue.length = 0;
1685
- };
1686
- const flush = () => {
1687
- // always force a bunch of medium callbacks to run, but still have
1688
- // a throttle on how many can run in a certain time
1689
- // DOM READS!!!
1690
- consume(queueDomReads);
1691
- // DOM WRITES!!!
1692
- {
1693
- consume(queueDomWrites);
1694
- if ((queuePending = queueDomReads.length > 0)) {
1695
- // still more to do yet, but we've run out of time
1696
- // let's let this thing cool off and try again in the next tick
1697
- plt.raf(flush);
1698
- }
1699
- }
1700
- };
1701
- const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1702
- const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1703
-
1704
- export { Fragment as F, Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };