@siemens/ix-aggrid 1.0.0-beta.2

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