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