@maggioli-design-system/mds-paginator 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/cjs/{index-970ace02.js → index-90936275.js} +369 -193
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/mds-paginator.cjs.entry.js +3 -9
  4. package/dist/cjs/mds-paginator.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +2 -2
  6. package/dist/collection/common/aria.js +19 -0
  7. package/dist/collection/components/mds-paginator/mds-paginator.js +71 -74
  8. package/dist/collection/dictionary/typography.js +3 -3
  9. package/dist/components/mds-paginator.js +2 -8
  10. package/dist/esm/{index-2c9f4cc7.js → index-43f8698e.js} +369 -193
  11. package/dist/esm/loader.js +2 -2
  12. package/dist/esm/mds-paginator.entry.js +3 -9
  13. package/dist/esm/mds-paginator.js +2 -2
  14. package/dist/esm/polyfills/css-shim.js +1 -1
  15. package/dist/esm-es5/index-43f8698e.js +2 -0
  16. package/dist/esm-es5/loader.js +1 -1
  17. package/dist/esm-es5/mds-paginator.entry.js +1 -1
  18. package/dist/esm-es5/mds-paginator.js +1 -1
  19. package/dist/mds-paginator/mds-paginator.esm.js +1 -1
  20. package/dist/mds-paginator/mds-paginator.js +2 -1
  21. package/dist/mds-paginator/{p-628f5264.system.js → p-0334c01a.system.js} +1 -1
  22. package/dist/mds-paginator/p-558993d8.system.js +2 -0
  23. package/dist/mds-paginator/{p-d71311fc.system.entry.js → p-9a34701d.system.entry.js} +1 -1
  24. package/dist/mds-paginator/p-aad97286.js +2 -0
  25. package/{www/build/p-1af6182a.entry.js → dist/mds-paginator/p-fc9943b7.entry.js} +1 -1
  26. package/dist/stats.json +37 -35
  27. package/dist/types/common/aria.d.ts +4 -0
  28. package/dist/types/stencil-public-runtime.d.ts +20 -4
  29. package/dist/types/types/typography.d.ts +3 -3
  30. package/loader/package.json +1 -0
  31. package/package.json +4 -3
  32. package/src/common/aria.ts +27 -0
  33. package/src/components/mds-paginator/.gitlab-ci.yml +2 -2
  34. package/src/dictionary/typography.ts +3 -3
  35. package/src/fixtures/icons.json +2 -3
  36. package/src/types/typography.ts +3 -3
  37. package/www/build/mds-paginator.esm.js +1 -1
  38. package/www/build/mds-paginator.js +2 -1
  39. package/www/build/{p-628f5264.system.js → p-0334c01a.system.js} +1 -1
  40. package/www/build/p-558993d8.system.js +2 -0
  41. package/www/build/{p-d71311fc.system.entry.js → p-9a34701d.system.entry.js} +1 -1
  42. package/www/build/p-aad97286.js +2 -0
  43. package/{dist/mds-paginator/p-1af6182a.entry.js → www/build/p-fc9943b7.entry.js} +1 -1
  44. package/dist/esm-es5/index-2c9f4cc7.js +0 -2
  45. package/dist/mds-paginator/p-4e602610.js +0 -2
  46. package/dist/mds-paginator/p-580a8708.system.js +0 -2
  47. package/www/build/p-4e602610.js +0 -2
  48. package/www/build/p-580a8708.system.js +0 -2
@@ -22,32 +22,18 @@ function _interopNamespace(e) {
22
22
 
23
23
  const NAMESPACE = 'mds-paginator';
24
24
 
25
+ /**
26
+ * Virtual DOM patching algorithm based on Snabbdom by
27
+ * Simon Friis Vindum (@paldepind)
28
+ * Licensed under the MIT License
29
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
30
+ *
31
+ * Modified for Stencil's renderer and slot projection
32
+ */
25
33
  let scopeId;
26
34
  let hostTagName;
27
35
  let isSvgMode = false;
28
36
  let queuePending = false;
29
- const win = typeof window !== 'undefined' ? window : {};
30
- const doc = win.document || { head: {} };
31
- const plt = {
32
- $flags$: 0,
33
- $resourcesUrl$: '',
34
- jmp: (h) => h(),
35
- raf: (h) => requestAnimationFrame(h),
36
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
37
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
38
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
39
- };
40
- const promiseResolve = (v) => Promise.resolve(v);
41
- const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
42
- try {
43
- new CSSStyleSheet();
44
- return typeof new CSSStyleSheet().replace === 'function';
45
- }
46
- catch (e) { }
47
- return false;
48
- })()
49
- ;
50
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
51
37
  const createTime = (fnName, tagName = '') => {
52
38
  {
53
39
  return () => {
@@ -62,71 +48,7 @@ const uniqueTime = (key, measureText) => {
62
48
  };
63
49
  }
64
50
  };
65
- const rootAppliedStyles = new WeakMap();
66
- const registerStyle = (scopeId, cssText, allowCS) => {
67
- let style = styles.get(scopeId);
68
- if (supportsConstructibleStylesheets && allowCS) {
69
- style = (style || new CSSStyleSheet());
70
- style.replace(cssText);
71
- }
72
- else {
73
- style = cssText;
74
- }
75
- styles.set(scopeId, style);
76
- };
77
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
78
- let scopeId = getScopeId(cmpMeta);
79
- const style = styles.get(scopeId);
80
- // if an element is NOT connected then getRootNode() will return the wrong root node
81
- // so the fallback is to always use the document for the root node in those cases
82
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
83
- if (style) {
84
- if (typeof style === 'string') {
85
- styleContainerNode = styleContainerNode.head || styleContainerNode;
86
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
87
- let styleElm;
88
- if (!appliedStyles) {
89
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
90
- }
91
- if (!appliedStyles.has(scopeId)) {
92
- {
93
- {
94
- styleElm = doc.createElement('style');
95
- styleElm.innerHTML = style;
96
- }
97
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
98
- }
99
- if (appliedStyles) {
100
- appliedStyles.add(scopeId);
101
- }
102
- }
103
- }
104
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
105
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
106
- }
107
- }
108
- return scopeId;
109
- };
110
- const attachStyles = (hostRef) => {
111
- const cmpMeta = hostRef.$cmpMeta$;
112
- const elm = hostRef.$hostElement$;
113
- const flags = cmpMeta.$flags$;
114
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
115
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
116
- if (flags & 10 /* needsScopedEncapsulation */) {
117
- // only required when we're NOT using native shadow dom (slot)
118
- // or this browser doesn't support native shadow dom
119
- // and this host element was NOT created with SSR
120
- // let's pick out the inner content for slot projection
121
- // create a node to represent where the original
122
- // content was first placed, which is useful later on
123
- // DOM WRITE!!
124
- elm['s-sc'] = scopeId;
125
- elm.classList.add(scopeId + '-h');
126
- }
127
- endAttachStyles();
128
- };
129
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
51
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
130
52
  /**
131
53
  * Default style mode id
132
54
  */
@@ -226,6 +148,139 @@ const newVNode = (tag, text) => {
226
148
  };
227
149
  const Host = {};
228
150
  const isHost = (node) => node && node.$tag$ === Host;
151
+ /**
152
+ * Parse a new property value for a given property type.
153
+ *
154
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
155
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
156
+ * 1. `any`, the type given to `propValue` in the function signature
157
+ * 2. the type stored from `propType`.
158
+ *
159
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
160
+ *
161
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
162
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
163
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
164
+ * ```tsx
165
+ * <my-cmp prop-val={0}></my-cmp>
166
+ * ```
167
+ *
168
+ * HTML prop values on the other hand, will always a string
169
+ *
170
+ * @param propValue the new value to coerce to some type
171
+ * @param propType the type of the prop, expressed as a binary number
172
+ * @returns the parsed/coerced value
173
+ */
174
+ const parsePropertyValue = (propValue, propType) => {
175
+ // ensure this value is of the correct prop type
176
+ if (propValue != null && !isComplexType(propValue)) {
177
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
178
+ // force it to be a number
179
+ return parseFloat(propValue);
180
+ }
181
+ // redundant return here for better minification
182
+ return propValue;
183
+ }
184
+ // not sure exactly what type we want
185
+ // so no need to change to a different type
186
+ return propValue;
187
+ };
188
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
189
+ const createEvent = (ref, name, flags) => {
190
+ const elm = getElement(ref);
191
+ return {
192
+ emit: (detail) => {
193
+ return emitEvent(elm, name, {
194
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
195
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
196
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
197
+ detail,
198
+ });
199
+ },
200
+ };
201
+ };
202
+ /**
203
+ * Helper function to create & dispatch a custom Event on a provided target
204
+ * @param elm the target of the Event
205
+ * @param name the name to give the custom Event
206
+ * @param opts options for configuring a custom Event
207
+ * @returns the custom Event
208
+ */
209
+ const emitEvent = (elm, name, opts) => {
210
+ const ev = plt.ce(name, opts);
211
+ elm.dispatchEvent(ev);
212
+ return ev;
213
+ };
214
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
215
+ const registerStyle = (scopeId, cssText, allowCS) => {
216
+ let style = styles.get(scopeId);
217
+ if (supportsConstructableStylesheets && allowCS) {
218
+ style = (style || new CSSStyleSheet());
219
+ if (typeof style === 'string') {
220
+ style = cssText;
221
+ }
222
+ else {
223
+ style.replaceSync(cssText);
224
+ }
225
+ }
226
+ else {
227
+ style = cssText;
228
+ }
229
+ styles.set(scopeId, style);
230
+ };
231
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
232
+ let scopeId = getScopeId(cmpMeta);
233
+ const style = styles.get(scopeId);
234
+ // if an element is NOT connected then getRootNode() will return the wrong root node
235
+ // so the fallback is to always use the document for the root node in those cases
236
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
237
+ if (style) {
238
+ if (typeof style === 'string') {
239
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
240
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
241
+ let styleElm;
242
+ if (!appliedStyles) {
243
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
244
+ }
245
+ if (!appliedStyles.has(scopeId)) {
246
+ {
247
+ {
248
+ styleElm = doc.createElement('style');
249
+ styleElm.innerHTML = style;
250
+ }
251
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
252
+ }
253
+ if (appliedStyles) {
254
+ appliedStyles.add(scopeId);
255
+ }
256
+ }
257
+ }
258
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
259
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
260
+ }
261
+ }
262
+ return scopeId;
263
+ };
264
+ const attachStyles = (hostRef) => {
265
+ const cmpMeta = hostRef.$cmpMeta$;
266
+ const elm = hostRef.$hostElement$;
267
+ const flags = cmpMeta.$flags$;
268
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
269
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
270
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
271
+ // only required when we're NOT using native shadow dom (slot)
272
+ // or this browser doesn't support native shadow dom
273
+ // and this host element was NOT created with SSR
274
+ // let's pick out the inner content for slot projection
275
+ // create a node to represent where the original
276
+ // content was first placed, which is useful later on
277
+ // DOM WRITE!!
278
+ elm['s-sc'] = scopeId;
279
+ elm.classList.add(scopeId + '-h');
280
+ }
281
+ endAttachStyles();
282
+ };
283
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
229
284
  /**
230
285
  * Production setAccessor() function based on Preact by
231
286
  * Jason Miller (@developit)
@@ -314,7 +369,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
314
369
  }
315
370
  }
316
371
  }
317
- else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
372
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
318
373
  newValue = newValue === true ? '' : newValue;
319
374
  {
320
375
  elm.setAttribute(memberName, newValue);
@@ -329,7 +384,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
329
384
  // if the element passed in is a shadow root, which is a document fragment
330
385
  // then we want to be adding attrs/props to the shadow root's "host" element
331
386
  // if it's not a shadow root, then we add attrs/props to the same element
332
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
387
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
333
388
  ? newVnode.$elm$.host
334
389
  : newVnode.$elm$;
335
390
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
@@ -347,6 +402,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
347
402
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
348
403
  }
349
404
  };
405
+ /**
406
+ * Create a DOM Node corresponding to one of the children of a given VNode.
407
+ *
408
+ * @param oldParentVNode the parent VNode from the previous render
409
+ * @param newParentVNode the parent VNode from the current render
410
+ * @param childIndex the index of the VNode, in the _new_ parent node's
411
+ * children, for which we will create a new DOM node
412
+ * @param parentElm the parent DOM node which our new node will be a child of
413
+ * @returns the newly created node
414
+ */
350
415
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
351
416
  // tslint:disable-next-line: prefer-const
352
417
  const newVNode = newParentVNode.$children$[childIndex];
@@ -408,6 +473,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
408
473
  }
409
474
  }
410
475
  };
476
+ /**
477
+ * Reconcile the children of a new VNode with the children of an old VNode by
478
+ * traversing the two collections of children, identifying nodes that are
479
+ * conserved or changed, calling out to `patch` to make any necessary
480
+ * updates to the DOM, and rearranging DOM nodes as needed.
481
+ *
482
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
483
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
484
+ * 'windows' by storing start and end indices and references to the
485
+ * corresponding array entries. Initially the two 'windows' are basically equal
486
+ * to the entire array, but we progressively narrow the windows until there are
487
+ * no children left to update by doing the following:
488
+ *
489
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
490
+ * that if we have an initial array like the following we'll end up dealing
491
+ * only with a window bounded by the highlighted elements:
492
+ *
493
+ * [null, null, VNode1 , ... , VNode2, null, null]
494
+ * ^^^^^^ ^^^^^^
495
+ *
496
+ * 2. Check to see if the elements at the head and tail positions are equal
497
+ * across the windows. This will basically detect elements which haven't
498
+ * been added, removed, or changed position, i.e. if you had the following
499
+ * VNode elements (represented as HTML):
500
+ *
501
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
502
+ * newVNode: `<div><p><span>THERE</span></p></div>`
503
+ *
504
+ * Then when comparing the children of the `<div>` tag we check the equality
505
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
506
+ * same tag in the same position, we'd be able to avoid completely
507
+ * re-rendering the subtree under them with a new DOM element and would just
508
+ * call out to `patch` to handle reconciling their children and so on.
509
+ *
510
+ * 3. Check, for both windows, to see if the element at the beginning of the
511
+ * window corresponds to the element at the end of the other window. This is
512
+ * a heuristic which will let us identify _some_ situations in which
513
+ * elements have changed position, for instance it _should_ detect that the
514
+ * children nodes themselves have not changed but merely moved in the
515
+ * following example:
516
+ *
517
+ * oldVNode: `<div><element-one /><element-two /></div>`
518
+ * newVNode: `<div><element-two /><element-one /></div>`
519
+ *
520
+ * If we find cases like this then we also need to move the concrete DOM
521
+ * elements corresponding to the moved children to write the re-order to the
522
+ * DOM.
523
+ *
524
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
525
+ * nodes in the old children which have the same key as the first element in
526
+ * our window on the new children. If we find such a node we handle calling
527
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
528
+ * what we find.
529
+ *
530
+ * Finally, once we've narrowed our 'windows' to the point that either of them
531
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
532
+ * insertion or deletion that needs to happen to get a DOM state that correctly
533
+ * reflects the new child VNodes. If, for instance, after our window on the old
534
+ * children has collapsed we still have more nodes on the new children that
535
+ * we haven't dealt with yet then we need to add them, or if the new children
536
+ * collapse but we still have unhandled _old_ children then we need to make
537
+ * sure the corresponding DOM nodes are removed.
538
+ *
539
+ * @param parentElm the node into which the parent VNode is rendered
540
+ * @param oldCh the old children of the parent node
541
+ * @param newVNode the new VNode which will replace the parent
542
+ * @param newCh the new children of the parent node
543
+ */
411
544
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
412
545
  let oldStartIdx = 0;
413
546
  let newStartIdx = 0;
@@ -423,7 +556,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
423
556
  let elmToMove;
424
557
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
425
558
  if (oldStartVnode == null) {
426
- // Vnode might have been moved left
559
+ // VNode might have been moved left
427
560
  oldStartVnode = oldCh[++oldStartIdx];
428
561
  }
429
562
  else if (oldEndVnode == null) {
@@ -436,29 +569,65 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
436
569
  newEndVnode = newCh[--newEndIdx];
437
570
  }
438
571
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
572
+ // if the start nodes are the same then we should patch the new VNode
573
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
574
+ // indices to reflect that. We don't need to move any DOM Nodes around
575
+ // since things are matched up in order.
439
576
  patch(oldStartVnode, newStartVnode);
440
577
  oldStartVnode = oldCh[++oldStartIdx];
441
578
  newStartVnode = newCh[++newStartIdx];
442
579
  }
443
580
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
581
+ // likewise, if the end nodes are the same we patch new onto old and
582
+ // decrement our end indices, and also likewise in this case we don't
583
+ // need to move any DOM Nodes.
444
584
  patch(oldEndVnode, newEndVnode);
445
585
  oldEndVnode = oldCh[--oldEndIdx];
446
586
  newEndVnode = newCh[--newEndIdx];
447
587
  }
448
588
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
449
589
  patch(oldStartVnode, newEndVnode);
590
+ // We need to move the element for `oldStartVnode` into a position which
591
+ // will be appropriate for `newEndVnode`. For this we can use
592
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
593
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
594
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
595
+ //
596
+ // <old-start-node />
597
+ // <some-intervening-node />
598
+ // <old-end-node />
599
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
600
+ // <next-sibling />
601
+ //
602
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
603
+ // the node for `oldStartVnode` at the end of the children of
604
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
605
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
606
+ // append it to the children of the parent element.
450
607
  parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
451
608
  oldStartVnode = oldCh[++oldStartIdx];
452
609
  newEndVnode = newCh[--newEndIdx];
453
610
  }
454
611
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
455
612
  patch(oldEndVnode, newStartVnode);
613
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
614
+ // the same node, so since we're here we know that they are not. Thus we
615
+ // can move the element for `oldEndVnode` _before_ the element for
616
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
617
+ // future.
456
618
  parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
457
619
  oldEndVnode = oldCh[--oldEndIdx];
458
620
  newStartVnode = newCh[++newStartIdx];
459
621
  }
460
622
  else {
461
- // createKeyToOldIdx
623
+ // Here we do some checks to match up old and new nodes based on the
624
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
625
+ // in the JSX for a DOM element in the implementation of a Stencil
626
+ // component.
627
+ //
628
+ // First we check to see if there are any nodes in the array of old
629
+ // children which have the same key as the first node in the new
630
+ // children.
462
631
  idxInOld = -1;
463
632
  {
464
633
  for (i = oldStartIdx; i <= oldEndIdx; ++i) {
@@ -469,23 +638,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
469
638
  }
470
639
  }
471
640
  if (idxInOld >= 0) {
641
+ // We found a node in the old children which matches up with the first
642
+ // node in the new children! So let's deal with that
472
643
  elmToMove = oldCh[idxInOld];
473
644
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
645
+ // the tag doesn't match so we'll need a new DOM element
474
646
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
475
647
  }
476
648
  else {
477
649
  patch(elmToMove, newStartVnode);
650
+ // invalidate the matching old node so that we won't try to update it
651
+ // again later on
478
652
  oldCh[idxInOld] = undefined;
479
653
  node = elmToMove.$elm$;
480
654
  }
481
655
  newStartVnode = newCh[++newStartIdx];
482
656
  }
483
657
  else {
484
- // new element
658
+ // We either didn't find an element in the old children that matches
659
+ // the key of the first new child OR the build is not using `key`
660
+ // attributes at all. In either case we need to create a new element
661
+ // for the new node.
485
662
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
486
663
  newStartVnode = newCh[++newStartIdx];
487
664
  }
488
665
  if (node) {
666
+ // if we created a new node then handle inserting it to the DOM
489
667
  {
490
668
  oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
491
669
  }
@@ -493,29 +671,58 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
493
671
  }
494
672
  }
495
673
  if (oldStartIdx > oldEndIdx) {
674
+ // we have some more new nodes to add which don't match up with old nodes
496
675
  addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
497
676
  }
498
677
  else if (newStartIdx > newEndIdx) {
678
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
679
+ // in the new array, so lets remove them (which entails cleaning up the
680
+ // relevant DOM nodes)
499
681
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
500
682
  }
501
683
  };
502
- const isSameVnode = (vnode1, vnode2) => {
684
+ /**
685
+ * Compare two VNodes to determine if they are the same
686
+ *
687
+ * **NB**: This function is an equality _heuristic_ based on the available
688
+ * information set on the two VNodes and can be misleading under certain
689
+ * circumstances. In particular, if the two nodes do not have `key` attrs
690
+ * (available under `$key$` on VNodes) then the function falls back on merely
691
+ * checking that they have the same tag.
692
+ *
693
+ * So, in other words, if `key` attrs are not set on VNodes which may be
694
+ * changing order within a `children` array or something along those lines then
695
+ * we could obtain a false positive and then have to do needless re-rendering.
696
+ *
697
+ * @param leftVNode the first VNode to check
698
+ * @param rightVNode the second VNode to check
699
+ * @returns whether they're equal or not
700
+ */
701
+ const isSameVnode = (leftVNode, rightVNode) => {
503
702
  // compare if two vnode to see if they're "technically" the same
504
703
  // need to have the same element tag, and same key to be the same
505
- if (vnode1.$tag$ === vnode2.$tag$) {
704
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
705
+ // this will be set if components in the build have `key` attrs set on them
506
706
  {
507
- return vnode1.$key$ === vnode2.$key$;
707
+ return leftVNode.$key$ === rightVNode.$key$;
508
708
  }
509
709
  }
510
710
  return false;
511
711
  };
712
+ /**
713
+ * Handle reconciling an outdated VNode with a new one which corresponds to
714
+ * it. This function handles flushing updates to the DOM and reconciling the
715
+ * children of the two nodes (if any).
716
+ *
717
+ * @param oldVNode an old VNode whose DOM element and children we want to update
718
+ * @param newVNode a new VNode representing an updated version of the old one
719
+ */
512
720
  const patch = (oldVNode, newVNode) => {
513
721
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
514
722
  const oldChildren = oldVNode.$children$;
515
723
  const newChildren = newVNode.$children$;
516
724
  const text = newVNode.$text$;
517
725
  if (text === null) {
518
- // element node
519
726
  {
520
727
  {
521
728
  // either this is the first render of an element OR it's an update
@@ -526,6 +733,7 @@ const patch = (oldVNode, newVNode) => {
526
733
  }
527
734
  if (oldChildren !== null && newChildren !== null) {
528
735
  // looks like there's child vnodes for both the old and new vnodes
736
+ // so we need to call `updateChildren` to reconcile them
529
737
  updateChildren(elm, oldChildren, newVNode, newChildren);
530
738
  }
531
739
  else if (newChildren !== null) {
@@ -559,7 +767,7 @@ const renderVdom = (hostRef, renderFnResults) => {
559
767
  cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
560
768
  }
561
769
  rootVnode.$tag$ = null;
562
- rootVnode.$flags$ |= 4 /* isHost */;
770
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
563
771
  hostRef.$vnode$ = rootVnode;
564
772
  rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
565
773
  {
@@ -568,32 +776,6 @@ const renderVdom = (hostRef, renderFnResults) => {
568
776
  // synchronous patch
569
777
  patch(oldVNode, rootVnode);
570
778
  };
571
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
572
- const createEvent = (ref, name, flags) => {
573
- const elm = getElement(ref);
574
- return {
575
- emit: (detail) => {
576
- return emitEvent(elm, name, {
577
- bubbles: !!(flags & 4 /* Bubbles */),
578
- composed: !!(flags & 2 /* Composed */),
579
- cancelable: !!(flags & 1 /* Cancellable */),
580
- detail,
581
- });
582
- },
583
- };
584
- };
585
- /**
586
- * Helper function to create & dispatch a custom Event on a provided target
587
- * @param elm the target of the Event
588
- * @param name the name to give the custom Event
589
- * @param opts options for configuring a custom Event
590
- * @returns the custom Event
591
- */
592
- const emitEvent = (elm, name, opts) => {
593
- const ev = plt.ce(name, opts);
594
- elm.dispatchEvent(ev);
595
- return ev;
596
- };
597
779
  const attachToAncestor = (hostRef, ancestorComponent) => {
598
780
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
599
781
  ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
@@ -601,10 +783,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
601
783
  };
602
784
  const scheduleUpdate = (hostRef, isInitialLoad) => {
603
785
  {
604
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
786
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
605
787
  }
606
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
607
- hostRef.$flags$ |= 512 /* needsRerender */;
788
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
789
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
608
790
  return;
609
791
  }
610
792
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
@@ -651,7 +833,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
651
833
  }
652
834
  else {
653
835
  Promise.all(childrenPromises).then(postUpdate);
654
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
836
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
655
837
  childrenPromises.length = 0;
656
838
  }
657
839
  }
@@ -660,10 +842,10 @@ const callRender = (hostRef, instance, elm) => {
660
842
  try {
661
843
  instance = instance.render() ;
662
844
  {
663
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
845
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
664
846
  }
665
847
  {
666
- hostRef.$flags$ |= 2 /* hasRendered */;
848
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
667
849
  }
668
850
  {
669
851
  {
@@ -687,8 +869,8 @@ const postUpdateComponent = (hostRef) => {
687
869
  const endPostUpdate = createTime('postUpdate', tagName);
688
870
  const instance = hostRef.$lazyInstance$ ;
689
871
  const ancestorComponent = hostRef.$ancestorComponent$;
690
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
691
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
872
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
873
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
692
874
  {
693
875
  // DOM WRITE!
694
876
  addHydratedFlag(elm);
@@ -714,10 +896,10 @@ const postUpdateComponent = (hostRef) => {
714
896
  hostRef.$onRenderResolve$();
715
897
  hostRef.$onRenderResolve$ = undefined;
716
898
  }
717
- if (hostRef.$flags$ & 512 /* needsRerender */) {
899
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
718
900
  nextTick(() => scheduleUpdate(hostRef, false));
719
901
  }
720
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
902
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
721
903
  }
722
904
  // ( •_•)
723
905
  // ( •_•)>⌐■-■
@@ -747,43 +929,6 @@ const then = (promise, thenFn) => {
747
929
  };
748
930
  const addHydratedFlag = (elm) => elm.classList.add('hydrated')
749
931
  ;
750
- /**
751
- * Parse a new property value for a given property type.
752
- *
753
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
754
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
755
- * 1. `any`, the type given to `propValue` in the function signature
756
- * 2. the type stored from `propType`.
757
- *
758
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
759
- *
760
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
761
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
762
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
763
- * ```tsx
764
- * <my-cmp prop-val={0}></my-cmp>
765
- * ```
766
- *
767
- * HTML prop values on the other hand, will always a string
768
- *
769
- * @param propValue the new value to coerce to some type
770
- * @param propType the type of the prop, expressed as a binary number
771
- * @returns the parsed/coerced value
772
- */
773
- const parsePropertyValue = (propValue, propType) => {
774
- // ensure this value is of the correct prop type
775
- if (propValue != null && !isComplexType(propValue)) {
776
- if (propType & 2 /* Number */) {
777
- // force it to be a number
778
- return parseFloat(propValue);
779
- }
780
- // redundant return here for better minification
781
- return propValue;
782
- }
783
- // not sure exactly what type we want
784
- // so no need to change to a different type
785
- return propValue;
786
- };
787
932
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
788
933
  const setValue = (ref, propName, newVal, cmpMeta) => {
789
934
  // check our new property value against our internal value
@@ -795,12 +940,12 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
795
940
  // explicitly check for NaN on both sides, as `NaN === NaN` is always false
796
941
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
797
942
  const didValueChange = newVal !== oldVal && !areBothNaN;
798
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
943
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
799
944
  // gadzooks! the property's value has changed!!
800
945
  // set our new value!
801
946
  hostRef.$instanceValues$.set(propName, newVal);
802
947
  if (instance) {
803
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
948
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
804
949
  // looks like this value actually changed, so we've got work to do!
805
950
  // but only if we've already rendered, otherwise just chill out
806
951
  // queue that we need to do an update, but don't worry about queuing
@@ -810,14 +955,24 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
810
955
  }
811
956
  }
812
957
  };
958
+ /**
959
+ * Attach a series of runtime constructs to a compiled Stencil component
960
+ * constructor, including getters and setters for the `@Prop` and `@State`
961
+ * decorators, callbacks for when attributes change, and so on.
962
+ *
963
+ * @param Cstr the constructor for a component that we need to process
964
+ * @param cmpMeta metadata collected previously about the component
965
+ * @param flags a number used to store a series of bit flags
966
+ * @returns a reference to the same constructor passed in (but now mutated)
967
+ */
813
968
  const proxyComponent = (Cstr, cmpMeta, flags) => {
814
969
  if (cmpMeta.$members$) {
815
970
  // It's better to have a const than two Object.entries()
816
971
  const members = Object.entries(cmpMeta.$members$);
817
972
  const prototype = Cstr.prototype;
818
973
  members.map(([memberName, [memberFlags]]) => {
819
- if ((memberFlags & 31 /* Prop */ ||
820
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
974
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
975
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
821
976
  // proxyComponent - prop
822
977
  Object.defineProperty(prototype, memberName, {
823
978
  get() {
@@ -833,7 +988,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
833
988
  });
834
989
  }
835
990
  });
836
- if ((flags & 1 /* isElementConstructor */)) {
991
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
837
992
  const attrNameToPropName = new Map();
838
993
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
839
994
  plt.jmp(() => {
@@ -889,11 +1044,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
889
1044
  // create an array of attributes to observe
890
1045
  // and also create a map of html attribute name to js property name
891
1046
  Cstr.observedAttributes = members
892
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1047
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
893
1048
  .map(([propName, m]) => {
894
1049
  const attrName = m[1] || propName;
895
1050
  attrNameToPropName.set(attrName, propName);
896
- if (m[0] & 512 /* ReflectAttr */) {
1051
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
897
1052
  cmpMeta.$attrsToReflect$.push([propName, attrName]);
898
1053
  }
899
1054
  return attrName;
@@ -904,10 +1059,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
904
1059
  };
905
1060
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
906
1061
  // initializeComponent
907
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1062
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
908
1063
  {
909
1064
  // we haven't initialized this element yet
910
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1065
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
911
1066
  // lazy loaded components
912
1067
  // request the component's implementation to be
913
1068
  // wired up with the host element
@@ -919,7 +1074,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
919
1074
  endLoad();
920
1075
  }
921
1076
  if (!Cstr.isProxied) {
922
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1077
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
923
1078
  Cstr.isProxied = true;
924
1079
  }
925
1080
  const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
@@ -927,7 +1082,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
927
1082
  // but let's keep track of when we start and stop
928
1083
  // so that the getters/setters don't incorrectly step on data
929
1084
  {
930
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1085
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
931
1086
  }
932
1087
  // construct the lazy-loaded component implementation
933
1088
  // passing the hostRef is very important during
@@ -940,7 +1095,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
940
1095
  consoleError(e);
941
1096
  }
942
1097
  {
943
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1098
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
944
1099
  }
945
1100
  endNewInstance();
946
1101
  }
@@ -950,7 +1105,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
950
1105
  const scopeId = getScopeId(cmpMeta);
951
1106
  if (!styles.has(scopeId)) {
952
1107
  const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
953
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1108
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
954
1109
  endRegisterStyles();
955
1110
  }
956
1111
  }
@@ -972,13 +1127,13 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
972
1127
  }
973
1128
  };
974
1129
  const connectedCallback = (elm) => {
975
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1130
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
976
1131
  const hostRef = getHostRef(elm);
977
1132
  const cmpMeta = hostRef.$cmpMeta$;
978
1133
  const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
979
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1134
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
980
1135
  // first time this component has connected
981
- hostRef.$flags$ |= 1 /* hasConnected */;
1136
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
982
1137
  {
983
1138
  // find the first ancestor component (if there is one) and register
984
1139
  // this component as one of the actively loading child components for its ancestor
@@ -998,7 +1153,7 @@ const connectedCallback = (elm) => {
998
1153
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
999
1154
  if (cmpMeta.$members$) {
1000
1155
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1001
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1156
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1002
1157
  const value = elm[memberName];
1003
1158
  delete elm[memberName];
1004
1159
  elm[memberName] = value;
@@ -1013,7 +1168,7 @@ const connectedCallback = (elm) => {
1013
1168
  }
1014
1169
  };
1015
1170
  const disconnectedCallback = (elm) => {
1016
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1171
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1017
1172
  getHostRef(elm);
1018
1173
  }
1019
1174
  };
@@ -1052,7 +1207,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1052
1207
  super(self);
1053
1208
  self = this;
1054
1209
  registerHost(self, cmpMeta);
1055
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1210
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1056
1211
  // this component is using shadow dom
1057
1212
  // and this browser supports shadow dom
1058
1213
  // add the read-only property "shadowRoot" to the host element
@@ -1087,7 +1242,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1087
1242
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1088
1243
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1089
1244
  cmpTags.push(tagName);
1090
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1245
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1091
1246
  }
1092
1247
  });
1093
1248
  });
@@ -1109,7 +1264,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1109
1264
  // Fallback appLoad event
1110
1265
  endBootstrap();
1111
1266
  };
1112
- const hostRefs = new WeakMap();
1267
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1113
1268
  const getHostRef = (ref) => hostRefs.get(ref);
1114
1269
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1115
1270
  const registerHost = (elm, cmpMeta) => {
@@ -1150,14 +1305,35 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1150
1305
  return importedModule[exportName];
1151
1306
  }, consoleError);
1152
1307
  };
1153
- const styles = new Map();
1308
+ const styles = /*@__PURE__*/ new Map();
1309
+ const win = typeof window !== 'undefined' ? window : {};
1310
+ const doc = win.document || { head: {} };
1311
+ const plt = {
1312
+ $flags$: 0,
1313
+ $resourcesUrl$: '',
1314
+ jmp: (h) => h(),
1315
+ raf: (h) => requestAnimationFrame(h),
1316
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1317
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1318
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1319
+ };
1320
+ const promiseResolve = (v) => Promise.resolve(v);
1321
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1322
+ try {
1323
+ new CSSStyleSheet();
1324
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1325
+ }
1326
+ catch (e) { }
1327
+ return false;
1328
+ })()
1329
+ ;
1154
1330
  const queueDomReads = [];
1155
1331
  const queueDomWrites = [];
1156
1332
  const queueTask = (queue, write) => (cb) => {
1157
1333
  queue.push(cb);
1158
1334
  if (!queuePending) {
1159
1335
  queuePending = true;
1160
- if (write && plt.$flags$ & 4 /* queueSync */) {
1336
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1161
1337
  nextTick(flush);
1162
1338
  }
1163
1339
  else {