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