@everymatrix/bonus-pagination-limits 1.43.4 → 1.45.0

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