@coveops/abi 0.3.2 → 0.4.1

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