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