@everymatrix/gamification-dropdown 1.44.0 → 1.54.4

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 (77) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/gamification-dropdown-0fd9c5b8.js +186 -0
  3. package/dist/cjs/gamification-dropdown.cjs.js +17 -11
  4. package/dist/cjs/gamification-dropdown_4.cjs.entry.js +408 -528
  5. package/dist/cjs/index-c535ed72.js +1796 -0
  6. package/dist/cjs/index.cjs.js +8 -0
  7. package/dist/cjs/loader.cjs.js +7 -13
  8. package/dist/cjs/{player-elevate-card-items-1cb6488c.js → player-elevate-card-items-42538012.js} +195 -180
  9. package/dist/cjs/player-elevate-card.cjs.entry.js +71 -70
  10. package/dist/cjs/player-elevate-pointcard.cjs.entry.js +79 -78
  11. package/dist/collection/collection-manifest.json +3 -3
  12. package/dist/collection/components/gamification-dropdown/gamification-dropdown.js +272 -257
  13. package/dist/collection/components/gamification-dropdown/index.js +1 -0
  14. package/dist/collection/index.js +1 -1
  15. package/dist/collection/utils/locale.utils.js +34 -34
  16. package/dist/collection/utils/utils.js +1 -1
  17. package/dist/esm/app-globals-0f993ce5.js +3 -0
  18. package/dist/esm/gamification-dropdown-ae7b7c69.js +184 -0
  19. package/dist/esm/gamification-dropdown.js +14 -11
  20. package/dist/esm/gamification-dropdown_4.entry.js +408 -528
  21. package/dist/esm/index-ea7720e4.js +1766 -0
  22. package/dist/esm/index.js +2 -1
  23. package/dist/esm/loader.js +7 -13
  24. package/dist/esm/{player-elevate-card-items-5bf07fe3.js → player-elevate-card-items-9d490a3b.js} +196 -180
  25. package/dist/esm/player-elevate-card.entry.js +71 -70
  26. package/dist/esm/player-elevate-pointcard.entry.js +79 -78
  27. package/dist/gamification-dropdown/gamification-dropdown.esm.js +1 -1
  28. package/dist/gamification-dropdown/index.esm.js +1 -0
  29. package/dist/gamification-dropdown/p-10486e5b.entry.js +1 -0
  30. package/dist/gamification-dropdown/p-21507480.js +1 -0
  31. package/dist/gamification-dropdown/p-3f7623db.js +2 -0
  32. package/dist/gamification-dropdown/p-422d11f7.entry.js +1 -0
  33. package/dist/gamification-dropdown/p-4b1d42b5.entry.js +1 -0
  34. package/dist/gamification-dropdown/p-c5998a81.js +1 -0
  35. package/dist/gamification-dropdown/p-e1255160.js +1 -0
  36. package/dist/stencil.config.dev.js +15 -0
  37. package/dist/stencil.config.js +14 -19
  38. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/gamification-dropdown/.stencil/packages/stencil/gamification-dropdown/stencil.config.d.ts +2 -0
  39. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/gamification-dropdown/.stencil/packages/stencil/gamification-dropdown/stencil.config.dev.d.ts +2 -0
  40. package/dist/types/components/gamification-dropdown/gamification-dropdown.d.ts +41 -41
  41. package/dist/types/components/gamification-dropdown/index.d.ts +1 -0
  42. package/dist/types/index.d.ts +1 -1
  43. package/dist/types/stencil-public-runtime.d.ts +148 -33
  44. package/loader/cdn.js +1 -3
  45. package/loader/index.cjs.js +1 -3
  46. package/loader/index.d.ts +13 -1
  47. package/loader/index.es2017.js +1 -3
  48. package/loader/index.js +1 -3
  49. package/loader/package.json +1 -0
  50. package/package.json +11 -4
  51. package/dist/cjs/index-4aa14dda.js +0 -1717
  52. package/dist/components/gamification-dropdown.d.ts +0 -11
  53. package/dist/components/gamification-dropdown.js +0 -230
  54. package/dist/components/general-styling-wrapper.js +0 -6
  55. package/dist/components/general-styling-wrapper2.js +0 -103
  56. package/dist/components/index.d.ts +0 -26
  57. package/dist/components/index.js +0 -1
  58. package/dist/components/player-elevate-card-data.js +0 -6
  59. package/dist/components/player-elevate-card-data2.js +0 -635
  60. package/dist/components/player-elevate-card-items.js +0 -2149
  61. package/dist/components/player-elevate-card.js +0 -126
  62. package/dist/components/player-elevate-loyaltycard.js +0 -6
  63. package/dist/components/player-elevate-loyaltycard2.js +0 -129
  64. package/dist/components/player-elevate-pointcard.js +0 -135
  65. package/dist/esm/index-a803f08b.js +0 -1688
  66. package/dist/esm/polyfills/core-js.js +0 -11
  67. package/dist/esm/polyfills/css-shim.js +0 -1
  68. package/dist/esm/polyfills/dom.js +0 -79
  69. package/dist/esm/polyfills/es5-html-element.js +0 -1
  70. package/dist/esm/polyfills/index.js +0 -34
  71. package/dist/esm/polyfills/system.js +0 -6
  72. package/dist/gamification-dropdown/p-118adbd3.entry.js +0 -1
  73. package/dist/gamification-dropdown/p-1bea1936.js +0 -1
  74. package/dist/gamification-dropdown/p-727c8663.js +0 -1
  75. package/dist/gamification-dropdown/p-bf29bfd4.entry.js +0 -1
  76. package/dist/gamification-dropdown/p-cdf41413.entry.js +0 -1
  77. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/gamification-dropdown/.stencil/packages/gamification-dropdown/stencil.config.d.ts +0 -2
@@ -1,1688 +0,0 @@
1
- const NAMESPACE = 'gamification-dropdown';
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
- endSchedule();
1041
- return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1042
- };
1043
- const updateComponent = async (hostRef, instance, isInitialLoad) => {
1044
- // updateComponent
1045
- const elm = hostRef.$hostElement$;
1046
- const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1047
- const rc = elm['s-rc'];
1048
- if (isInitialLoad) {
1049
- // DOM WRITE!
1050
- attachStyles(hostRef);
1051
- }
1052
- const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1053
- {
1054
- callRender(hostRef, instance);
1055
- }
1056
- if (rc) {
1057
- // ok, so turns out there are some child host elements
1058
- // waiting on this parent element to load
1059
- // let's fire off all update callbacks waiting
1060
- rc.map((cb) => cb());
1061
- elm['s-rc'] = undefined;
1062
- }
1063
- endRender();
1064
- endUpdate();
1065
- {
1066
- const childrenPromises = elm['s-p'];
1067
- const postUpdate = () => postUpdateComponent(hostRef);
1068
- if (childrenPromises.length === 0) {
1069
- postUpdate();
1070
- }
1071
- else {
1072
- Promise.all(childrenPromises).then(postUpdate);
1073
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1074
- childrenPromises.length = 0;
1075
- }
1076
- }
1077
- };
1078
- const callRender = (hostRef, instance, elm) => {
1079
- try {
1080
- instance = instance.render && instance.render();
1081
- {
1082
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1083
- }
1084
- {
1085
- hostRef.$flags$ |= 2 /* hasRendered */;
1086
- }
1087
- {
1088
- {
1089
- // looks like we've got child nodes to render into this host element
1090
- // or we need to update the css class/attrs on the host element
1091
- // DOM WRITE!
1092
- {
1093
- renderVdom(hostRef, instance);
1094
- }
1095
- }
1096
- }
1097
- }
1098
- catch (e) {
1099
- consoleError(e, hostRef.$hostElement$);
1100
- }
1101
- return null;
1102
- };
1103
- const postUpdateComponent = (hostRef) => {
1104
- const tagName = hostRef.$cmpMeta$.$tagName$;
1105
- const elm = hostRef.$hostElement$;
1106
- const endPostUpdate = createTime('postUpdate', tagName);
1107
- const instance = hostRef.$lazyInstance$ ;
1108
- const ancestorComponent = hostRef.$ancestorComponent$;
1109
- {
1110
- safeCall(instance, 'componentDidRender');
1111
- }
1112
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1113
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1114
- {
1115
- // DOM WRITE!
1116
- addHydratedFlag(elm);
1117
- }
1118
- endPostUpdate();
1119
- {
1120
- hostRef.$onReadyResolve$(elm);
1121
- if (!ancestorComponent) {
1122
- appDidLoad();
1123
- }
1124
- }
1125
- }
1126
- else {
1127
- endPostUpdate();
1128
- }
1129
- // load events fire from bottom to top
1130
- // the deepest elements load first then bubbles up
1131
- {
1132
- if (hostRef.$onRenderResolve$) {
1133
- hostRef.$onRenderResolve$();
1134
- hostRef.$onRenderResolve$ = undefined;
1135
- }
1136
- if (hostRef.$flags$ & 512 /* needsRerender */) {
1137
- nextTick(() => scheduleUpdate(hostRef, false));
1138
- }
1139
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1140
- }
1141
- // ( •_•)
1142
- // ( •_•)>⌐■-■
1143
- // (⌐■_■)
1144
- };
1145
- const appDidLoad = (who) => {
1146
- // on appload
1147
- // we have finish the first big initial render
1148
- {
1149
- addHydratedFlag(doc.documentElement);
1150
- }
1151
- nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1152
- };
1153
- const safeCall = (instance, method, arg) => {
1154
- if (instance && instance[method]) {
1155
- try {
1156
- return instance[method](arg);
1157
- }
1158
- catch (e) {
1159
- consoleError(e);
1160
- }
1161
- }
1162
- return undefined;
1163
- };
1164
- const then = (promise, thenFn) => {
1165
- return promise && promise.then ? promise.then(thenFn) : thenFn();
1166
- };
1167
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1168
- ;
1169
- /**
1170
- * Parse a new property value for a given property type.
1171
- *
1172
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
1173
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
1174
- * 1. `any`, the type given to `propValue` in the function signature
1175
- * 2. the type stored from `propType`.
1176
- *
1177
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
1178
- *
1179
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
1180
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
1181
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
1182
- * ```tsx
1183
- * <my-cmp prop-val={0}></my-cmp>
1184
- * ```
1185
- *
1186
- * HTML prop values on the other hand, will always a string
1187
- *
1188
- * @param propValue the new value to coerce to some type
1189
- * @param propType the type of the prop, expressed as a binary number
1190
- * @returns the parsed/coerced value
1191
- */
1192
- const parsePropertyValue = (propValue, propType) => {
1193
- // ensure this value is of the correct prop type
1194
- if (propValue != null && !isComplexType(propValue)) {
1195
- if (propType & 1 /* String */) {
1196
- // could have been passed as a number or boolean
1197
- // but we still want it as a string
1198
- return String(propValue);
1199
- }
1200
- // redundant return here for better minification
1201
- return propValue;
1202
- }
1203
- // not sure exactly what type we want
1204
- // so no need to change to a different type
1205
- return propValue;
1206
- };
1207
- const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1208
- const setValue = (ref, propName, newVal, cmpMeta) => {
1209
- // check our new property value against our internal value
1210
- const hostRef = getHostRef(ref);
1211
- const elm = hostRef.$hostElement$ ;
1212
- const oldVal = hostRef.$instanceValues$.get(propName);
1213
- const flags = hostRef.$flags$;
1214
- const instance = hostRef.$lazyInstance$ ;
1215
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1216
- // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1217
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1218
- const didValueChange = newVal !== oldVal && !areBothNaN;
1219
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1220
- // gadzooks! the property's value has changed!!
1221
- // set our new value!
1222
- hostRef.$instanceValues$.set(propName, newVal);
1223
- if (instance) {
1224
- // get an array of method names of watch functions to call
1225
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1226
- const watchMethods = cmpMeta.$watchers$[propName];
1227
- if (watchMethods) {
1228
- // this instance is watching for when this property changed
1229
- watchMethods.map((watchMethodName) => {
1230
- try {
1231
- // fire off each of the watch methods that are watching this property
1232
- instance[watchMethodName](newVal, oldVal, propName);
1233
- }
1234
- catch (e) {
1235
- consoleError(e, elm);
1236
- }
1237
- });
1238
- }
1239
- }
1240
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1241
- // looks like this value actually changed, so we've got work to do!
1242
- // but only if we've already rendered, otherwise just chill out
1243
- // queue that we need to do an update, but don't worry about queuing
1244
- // up millions cuz this function ensures it only runs once
1245
- scheduleUpdate(hostRef, false);
1246
- }
1247
- }
1248
- }
1249
- };
1250
- const proxyComponent = (Cstr, cmpMeta, flags) => {
1251
- if (cmpMeta.$members$) {
1252
- if (Cstr.watchers) {
1253
- cmpMeta.$watchers$ = Cstr.watchers;
1254
- }
1255
- // It's better to have a const than two Object.entries()
1256
- const members = Object.entries(cmpMeta.$members$);
1257
- const prototype = Cstr.prototype;
1258
- members.map(([memberName, [memberFlags]]) => {
1259
- if ((memberFlags & 31 /* Prop */ ||
1260
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1261
- // proxyComponent - prop
1262
- Object.defineProperty(prototype, memberName, {
1263
- get() {
1264
- // proxyComponent, get value
1265
- return getValue(this, memberName);
1266
- },
1267
- set(newValue) {
1268
- // proxyComponent, set value
1269
- setValue(this, memberName, newValue, cmpMeta);
1270
- },
1271
- configurable: true,
1272
- enumerable: true,
1273
- });
1274
- }
1275
- });
1276
- if ((flags & 1 /* isElementConstructor */)) {
1277
- const attrNameToPropName = new Map();
1278
- prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1279
- plt.jmp(() => {
1280
- const propName = attrNameToPropName.get(attrName);
1281
- // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1282
- // in the case where an attribute was set inline.
1283
- // ```html
1284
- // <my-component some-attribute="some-value"></my-component>
1285
- // ```
1286
- //
1287
- // There is an edge case where a developer sets the attribute inline on a custom element and then
1288
- // programmatically changes it before it has been upgraded as shown below:
1289
- //
1290
- // ```html
1291
- // <!-- this component has _not_ been upgraded yet -->
1292
- // <my-component id="test" some-attribute="some-value"></my-component>
1293
- // <script>
1294
- // // grab non-upgraded component
1295
- // el = document.querySelector("#test");
1296
- // el.someAttribute = "another-value";
1297
- // // upgrade component
1298
- // customElements.define('my-component', MyComponent);
1299
- // </script>
1300
- // ```
1301
- // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1302
- // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1303
- // to the value that was set inline i.e. "some-value" from above example. When
1304
- // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
1305
- //
1306
- // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1307
- // by connectedCallback as this attributeChangedCallback will not fire.
1308
- //
1309
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1310
- //
1311
- // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1312
- // properties here given that this goes against best practices outlined here
1313
- // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1314
- if (this.hasOwnProperty(propName)) {
1315
- newValue = this[propName];
1316
- delete this[propName];
1317
- }
1318
- else if (prototype.hasOwnProperty(propName) &&
1319
- typeof this[propName] === 'number' &&
1320
- this[propName] == newValue) {
1321
- // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1322
- // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1323
- // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1324
- return;
1325
- }
1326
- this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1327
- });
1328
- };
1329
- // create an array of attributes to observe
1330
- // and also create a map of html attribute name to js property name
1331
- Cstr.observedAttributes = members
1332
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1333
- .map(([propName, m]) => {
1334
- const attrName = m[1] || propName;
1335
- attrNameToPropName.set(attrName, propName);
1336
- if (m[0] & 512 /* ReflectAttr */) {
1337
- cmpMeta.$attrsToReflect$.push([propName, attrName]);
1338
- }
1339
- return attrName;
1340
- });
1341
- }
1342
- }
1343
- return Cstr;
1344
- };
1345
- const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1346
- // initializeComponent
1347
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1348
- {
1349
- // we haven't initialized this element yet
1350
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1351
- // lazy loaded components
1352
- // request the component's implementation to be
1353
- // wired up with the host element
1354
- Cstr = loadModule(cmpMeta);
1355
- if (Cstr.then) {
1356
- // Await creates a micro-task avoid if possible
1357
- const endLoad = uniqueTime();
1358
- Cstr = await Cstr;
1359
- endLoad();
1360
- }
1361
- if (!Cstr.isProxied) {
1362
- // we've never proxied this Constructor before
1363
- // let's add the getters/setters to its prototype before
1364
- // the first time we create an instance of the implementation
1365
- {
1366
- cmpMeta.$watchers$ = Cstr.watchers;
1367
- }
1368
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1369
- Cstr.isProxied = true;
1370
- }
1371
- const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1372
- // ok, time to construct the instance
1373
- // but let's keep track of when we start and stop
1374
- // so that the getters/setters don't incorrectly step on data
1375
- {
1376
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1377
- }
1378
- // construct the lazy-loaded component implementation
1379
- // passing the hostRef is very important during
1380
- // construction in order to directly wire together the
1381
- // host element and the lazy-loaded instance
1382
- try {
1383
- new Cstr(hostRef);
1384
- }
1385
- catch (e) {
1386
- consoleError(e);
1387
- }
1388
- {
1389
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1390
- }
1391
- {
1392
- hostRef.$flags$ |= 128 /* isWatchReady */;
1393
- }
1394
- endNewInstance();
1395
- }
1396
- if (Cstr.style) {
1397
- // this component has styles but we haven't registered them yet
1398
- let style = Cstr.style;
1399
- const scopeId = getScopeId(cmpMeta);
1400
- if (!styles.has(scopeId)) {
1401
- const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1402
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1403
- endRegisterStyles();
1404
- }
1405
- }
1406
- }
1407
- // we've successfully created a lazy instance
1408
- const ancestorComponent = hostRef.$ancestorComponent$;
1409
- const schedule = () => scheduleUpdate(hostRef, true);
1410
- if (ancestorComponent && ancestorComponent['s-rc']) {
1411
- // this is the initial load and this component it has an ancestor component
1412
- // but the ancestor component has NOT fired its will update lifecycle yet
1413
- // so let's just cool our jets and wait for the ancestor to continue first
1414
- // this will get fired off when the ancestor component
1415
- // finally gets around to rendering its lazy self
1416
- // fire off the initial update
1417
- ancestorComponent['s-rc'].push(schedule);
1418
- }
1419
- else {
1420
- schedule();
1421
- }
1422
- };
1423
- const connectedCallback = (elm) => {
1424
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1425
- const hostRef = getHostRef(elm);
1426
- const cmpMeta = hostRef.$cmpMeta$;
1427
- const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1428
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1429
- // first time this component has connected
1430
- hostRef.$flags$ |= 1 /* hasConnected */;
1431
- {
1432
- // initUpdate
1433
- // if the slot polyfill is required we'll need to put some nodes
1434
- // in here to act as original content anchors as we move nodes around
1435
- // host element has been connected to the DOM
1436
- if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1437
- setContentReference(elm);
1438
- }
1439
- }
1440
- {
1441
- // find the first ancestor component (if there is one) and register
1442
- // this component as one of the actively loading child components for its ancestor
1443
- let ancestorComponent = elm;
1444
- while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1445
- // climb up the ancestors looking for the first
1446
- // component that hasn't finished its lifecycle update yet
1447
- if (ancestorComponent['s-p']) {
1448
- // we found this components first ancestor component
1449
- // keep a reference to this component's ancestor component
1450
- attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1451
- break;
1452
- }
1453
- }
1454
- }
1455
- // Lazy properties
1456
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1457
- if (cmpMeta.$members$) {
1458
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1459
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1460
- const value = elm[memberName];
1461
- delete elm[memberName];
1462
- elm[memberName] = value;
1463
- }
1464
- });
1465
- }
1466
- {
1467
- initializeComponent(elm, hostRef, cmpMeta);
1468
- }
1469
- }
1470
- else {
1471
- // not the first time this has connected
1472
- // reattach any event listeners to the host
1473
- // since they would have been removed when disconnected
1474
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1475
- }
1476
- endConnected();
1477
- }
1478
- };
1479
- const setContentReference = (elm) => {
1480
- // only required when we're NOT using native shadow dom (slot)
1481
- // or this browser doesn't support native shadow dom
1482
- // and this host element was NOT created with SSR
1483
- // let's pick out the inner content for slot projection
1484
- // create a node to represent where the original
1485
- // content was first placed, which is useful later on
1486
- const contentRefElm = (elm['s-cr'] = doc.createComment(''));
1487
- contentRefElm['s-cn'] = true;
1488
- elm.insertBefore(contentRefElm, elm.firstChild);
1489
- };
1490
- const disconnectedCallback = (elm) => {
1491
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1492
- const hostRef = getHostRef(elm);
1493
- {
1494
- if (hostRef.$rmListeners$) {
1495
- hostRef.$rmListeners$.map((rmListener) => rmListener());
1496
- hostRef.$rmListeners$ = undefined;
1497
- }
1498
- }
1499
- }
1500
- };
1501
- const bootstrapLazy = (lazyBundles, options = {}) => {
1502
- const endBootstrap = createTime();
1503
- const cmpTags = [];
1504
- const exclude = options.exclude || [];
1505
- const customElements = win.customElements;
1506
- const head = doc.head;
1507
- const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1508
- const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1509
- const deferredConnectedCallbacks = [];
1510
- let appLoadFallback;
1511
- let isBootstrapping = true;
1512
- Object.assign(plt, options);
1513
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1514
- lazyBundles.map((lazyBundle) => {
1515
- lazyBundle[1].map((compactMeta) => {
1516
- const cmpMeta = {
1517
- $flags$: compactMeta[0],
1518
- $tagName$: compactMeta[1],
1519
- $members$: compactMeta[2],
1520
- $listeners$: compactMeta[3],
1521
- };
1522
- {
1523
- cmpMeta.$members$ = compactMeta[2];
1524
- }
1525
- {
1526
- cmpMeta.$listeners$ = compactMeta[3];
1527
- }
1528
- {
1529
- cmpMeta.$attrsToReflect$ = [];
1530
- }
1531
- {
1532
- cmpMeta.$watchers$ = {};
1533
- }
1534
- const tagName = cmpMeta.$tagName$;
1535
- const HostElement = class extends HTMLElement {
1536
- // StencilLazyHost
1537
- constructor(self) {
1538
- // @ts-ignore
1539
- super(self);
1540
- self = this;
1541
- registerHost(self, cmpMeta);
1542
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1543
- // this component is using shadow dom
1544
- // and this browser supports shadow dom
1545
- // add the read-only property "shadowRoot" to the host element
1546
- // adding the shadow root build conditionals to minimize runtime
1547
- {
1548
- {
1549
- self.attachShadow({ mode: 'open' });
1550
- }
1551
- }
1552
- }
1553
- }
1554
- connectedCallback() {
1555
- if (appLoadFallback) {
1556
- clearTimeout(appLoadFallback);
1557
- appLoadFallback = null;
1558
- }
1559
- if (isBootstrapping) {
1560
- // connectedCallback will be processed once all components have been registered
1561
- deferredConnectedCallbacks.push(this);
1562
- }
1563
- else {
1564
- plt.jmp(() => connectedCallback(this));
1565
- }
1566
- }
1567
- disconnectedCallback() {
1568
- plt.jmp(() => disconnectedCallback(this));
1569
- }
1570
- componentOnReady() {
1571
- return getHostRef(this).$onReadyPromise$;
1572
- }
1573
- };
1574
- cmpMeta.$lazyBundleId$ = lazyBundle[0];
1575
- if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1576
- cmpTags.push(tagName);
1577
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1578
- }
1579
- });
1580
- });
1581
- {
1582
- visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1583
- visibilityStyle.setAttribute('data-styles', '');
1584
- head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1585
- }
1586
- // Process deferred connectedCallbacks now all components have been registered
1587
- isBootstrapping = false;
1588
- if (deferredConnectedCallbacks.length) {
1589
- deferredConnectedCallbacks.map((host) => host.connectedCallback());
1590
- }
1591
- else {
1592
- {
1593
- plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1594
- }
1595
- }
1596
- // Fallback appLoad event
1597
- endBootstrap();
1598
- };
1599
- const getAssetPath = (path) => {
1600
- const assetUrl = new URL(path, plt.$resourcesUrl$);
1601
- return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
1602
- };
1603
- const Fragment = (_, children) => children;
1604
- const hostRefs = new WeakMap();
1605
- const getHostRef = (ref) => hostRefs.get(ref);
1606
- const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1607
- const registerHost = (elm, cmpMeta) => {
1608
- const hostRef = {
1609
- $flags$: 0,
1610
- $hostElement$: elm,
1611
- $cmpMeta$: cmpMeta,
1612
- $instanceValues$: new Map(),
1613
- };
1614
- {
1615
- hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1616
- elm['s-p'] = [];
1617
- elm['s-rc'] = [];
1618
- }
1619
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1620
- return hostRefs.set(elm, hostRef);
1621
- };
1622
- const isMemberInElement = (elm, memberName) => memberName in elm;
1623
- const consoleError = (e, el) => (0, console.error)(e, el);
1624
- const cmpModules = /*@__PURE__*/ new Map();
1625
- const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1626
- // loadModuleImport
1627
- const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1628
- const bundleId = cmpMeta.$lazyBundleId$;
1629
- const module = cmpModules.get(bundleId) ;
1630
- if (module) {
1631
- return module[exportName];
1632
- }
1633
- return import(
1634
- /* webpackInclude: /\.entry\.js$/ */
1635
- /* webpackExclude: /\.system\.entry\.js$/ */
1636
- /* webpackMode: "lazy" */
1637
- `./${bundleId}.entry.js${''}`).then((importedModule) => {
1638
- {
1639
- cmpModules.set(bundleId, importedModule);
1640
- }
1641
- return importedModule[exportName];
1642
- }, consoleError);
1643
- };
1644
- const styles = new Map();
1645
- const queueDomReads = [];
1646
- const queueDomWrites = [];
1647
- const queueTask = (queue, write) => (cb) => {
1648
- queue.push(cb);
1649
- if (!queuePending) {
1650
- queuePending = true;
1651
- if (write && plt.$flags$ & 4 /* queueSync */) {
1652
- nextTick(flush);
1653
- }
1654
- else {
1655
- plt.raf(flush);
1656
- }
1657
- }
1658
- };
1659
- const consume = (queue) => {
1660
- for (let i = 0; i < queue.length; i++) {
1661
- try {
1662
- queue[i](performance.now());
1663
- }
1664
- catch (e) {
1665
- consoleError(e);
1666
- }
1667
- }
1668
- queue.length = 0;
1669
- };
1670
- const flush = () => {
1671
- // always force a bunch of medium callbacks to run, but still have
1672
- // a throttle on how many can run in a certain time
1673
- // DOM READS!!!
1674
- consume(queueDomReads);
1675
- // DOM WRITES!!!
1676
- {
1677
- consume(queueDomWrites);
1678
- if ((queuePending = queueDomReads.length > 0)) {
1679
- // still more to do yet, but we've run out of time
1680
- // let's let this thing cool off and try again in the next tick
1681
- plt.raf(flush);
1682
- }
1683
- }
1684
- };
1685
- const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1686
- const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1687
-
1688
- export { Fragment as F, getAssetPath as a, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };