@everymatrix/player-elevate-level 1.44.0 → 1.45.2

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