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