@mgdis/mg-components 4.1.1 → 4.2.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 (124) hide show
  1. package/dist/cjs/{index-dd2c7f7b.js → index-64cee0c8.js} +248 -128
  2. package/dist/cjs/loader.cjs.js +3 -3
  3. package/dist/cjs/{mg-badge_24.cjs.entry.js → mg-badge_23.cjs.entry.js} +206 -2180
  4. package/dist/cjs/mg-components.cjs.js +3 -26
  5. package/dist/cjs/mg-modal.cjs.entry.js +8 -1
  6. package/dist/cjs/mg-popover.cjs.entry.js +171 -0
  7. package/dist/cjs/popper-71bf3058.js +1790 -0
  8. package/dist/collection/collection-manifest.json +2 -2
  9. package/dist/collection/components/atoms/mg-badge/mg-badge.js +116 -99
  10. package/dist/collection/components/atoms/mg-button/mg-button.js +221 -220
  11. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +72 -69
  12. package/dist/collection/components/atoms/mg-icon/doc/mg-icon.stories.js +1 -2
  13. package/dist/collection/components/atoms/mg-icon/mg-icon.js +102 -92
  14. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +83 -67
  15. package/dist/collection/components/atoms/mg-tag/mg-tag.js +64 -55
  16. package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +3 -6
  17. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +120 -106
  18. package/dist/collection/components/molecules/inputs/MgInput.js +8 -17
  19. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +323 -318
  20. package/dist/collection/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.js +3 -2
  21. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +356 -361
  22. package/dist/collection/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.js +1 -2
  23. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +462 -456
  24. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +347 -340
  25. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +348 -343
  26. package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +4 -3
  27. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +406 -401
  28. package/dist/collection/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.js +12 -15
  29. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +2 -0
  30. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +476 -473
  31. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +461 -456
  32. package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +2 -8
  33. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +1 -0
  34. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +299 -298
  35. package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +1 -3
  36. package/dist/collection/components/molecules/mg-details/mg-details.js +95 -93
  37. package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +13 -27
  38. package/dist/collection/components/molecules/mg-form/mg-form.js +175 -166
  39. package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +2 -6
  40. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +37 -37
  41. package/dist/collection/components/molecules/mg-message/doc/mg-message.stories.js +1 -3
  42. package/dist/collection/components/molecules/mg-message/mg-message.js +154 -153
  43. package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +11 -15
  44. package/dist/collection/components/molecules/mg-modal/mg-modal.js +147 -134
  45. package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +5 -6
  46. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +112 -117
  47. package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +1 -8
  48. package/dist/collection/components/molecules/mg-panel/mg-panel.css +2 -2
  49. package/dist/collection/components/molecules/mg-panel/mg-panel.js +192 -189
  50. package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +1 -4
  51. package/dist/collection/components/molecules/mg-popover/mg-popover.js +129 -127
  52. package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +1 -5
  53. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +1 -0
  54. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +150 -135
  55. package/dist/collection/fonts/OpenSans-Bold.ttf +0 -0
  56. package/dist/collection/locales/en/messages.json +50 -0
  57. package/dist/collection/locales/fr/messages.json +50 -0
  58. package/dist/collection/stories/grids.stories.js +1 -44
  59. package/dist/collection/stories/helpers.stories.js +1 -19
  60. package/dist/collection/stories/icons.stories.js +1 -4
  61. package/dist/collection/stories/typography.stories.js +1 -12
  62. package/dist/collection/variables.css +3 -2
  63. package/dist/collection/variables.scss +3 -2
  64. package/dist/components/MgInput.js +6 -3
  65. package/dist/components/mg-badge2.js +7 -0
  66. package/dist/components/mg-button2.js +2 -7
  67. package/dist/components/mg-input-checkbox.js +1 -6
  68. package/dist/components/mg-input-date.js +10 -27
  69. package/dist/components/mg-input-numeric.js +1 -6
  70. package/dist/components/mg-input-password.js +1 -6
  71. package/dist/components/mg-input-radio.js +1 -6
  72. package/dist/components/mg-input-select2.js +1 -6
  73. package/dist/components/mg-input-text2.js +3 -8
  74. package/dist/components/mg-input-textarea.js +2 -7
  75. package/dist/components/mg-input-title2.js +9 -0
  76. package/dist/components/mg-input-toggle.js +2 -7
  77. package/dist/components/mg-modal.js +7 -0
  78. package/dist/components/mg-pagination.js +3 -3
  79. package/dist/components/mg-panel.js +8 -4
  80. package/dist/components/mg-tabs.js +8 -1
  81. package/dist/components/mg-tooltip2.js +7 -0
  82. package/dist/esm/{index-f58b769f.js → index-120f47fd.js} +249 -128
  83. package/dist/esm/loader.js +3 -3
  84. package/dist/esm/{mg-badge_24.entry.js → mg-badge_23.entry.js} +207 -2180
  85. package/dist/esm/mg-components.js +3 -26
  86. package/dist/esm/mg-modal.entry.js +8 -1
  87. package/dist/esm/mg-popover.entry.js +167 -0
  88. package/dist/esm/popper-93ecb064.js +1788 -0
  89. package/dist/mg-components/fonts/OpenSans-Bold.ttf +0 -0
  90. package/dist/mg-components/locales/en/messages.json +50 -0
  91. package/dist/mg-components/locales/fr/messages.json +50 -0
  92. package/dist/mg-components/mg-components.css +1 -1
  93. package/dist/mg-components/mg-components.esm.js +1 -1
  94. package/dist/mg-components/p-21991be8.entry.js +1 -0
  95. package/dist/mg-components/p-36a64f8c.entry.js +1 -0
  96. package/dist/mg-components/p-4c66f794.js +1 -0
  97. package/dist/mg-components/p-7bc32a2f.js +2 -0
  98. package/dist/mg-components/p-b380a0df.entry.js +1 -0
  99. package/dist/mg-components/variables.css +3 -2
  100. package/dist/mg-components/variables.scss +3 -2
  101. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +1 -0
  102. package/dist/types/components/atoms/mg-button/mg-button.d.ts +0 -1
  103. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -0
  104. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +1 -0
  105. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +0 -1
  106. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +1 -10
  107. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +0 -1
  108. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +0 -1
  109. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +0 -1
  110. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -1
  111. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +0 -1
  112. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +0 -1
  113. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +0 -1
  114. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +1 -0
  115. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +1 -1
  116. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +1 -0
  117. package/dist/types/components.d.ts +29 -29
  118. package/loader/package.json +1 -0
  119. package/package.json +8 -8
  120. package/dist/collection/fonts/Poppins-Bold.ttf +0 -0
  121. package/dist/mg-components/fonts/Poppins-Bold.ttf +0 -0
  122. package/dist/mg-components/p-2a3d8f60.entry.js +0 -1
  123. package/dist/mg-components/p-b6df1cac.js +0 -2
  124. package/dist/mg-components/p-c8779533.entry.js +0 -1
@@ -10,8 +10,6 @@ let isSvgMode = false;
10
10
  let queuePending = false;
11
11
  const win = typeof window !== 'undefined' ? window : {};
12
12
  const doc = win.document || { head: {} };
13
- const H = (win.HTMLElement || class {
14
- });
15
13
  const plt = {
16
14
  $flags$: 0,
17
15
  $resourcesUrl$: '',
@@ -21,7 +19,6 @@ const plt = {
21
19
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
22
20
  ce: (eventName, opts) => new CustomEvent(eventName, opts),
23
21
  };
24
- const supportsShadow = true;
25
22
  const promiseResolve = (v) => Promise.resolve(v);
26
23
  const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
27
24
  try {
@@ -46,7 +43,7 @@ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =
46
43
  const hostListenerProxy = (hostRef, methodName) => (ev) => {
47
44
  try {
48
45
  {
49
- if (hostRef.$flags$ & 256 /* isListenReady */) {
46
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
50
47
  // instance is ready, let's call it's member method for this event
51
48
  hostRef.$lazyInstance$[methodName](ev);
52
49
  }
@@ -60,12 +57,12 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
60
57
  }
61
58
  };
62
59
  const getHostListenerTarget = (elm, flags) => {
63
- if (flags & 8 /* TargetWindow */)
60
+ if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
64
61
  return win;
65
62
  return elm;
66
63
  };
67
64
  // prettier-ignore
68
- const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
65
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
69
66
  const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
70
67
  const createTime = (fnName, tagName = '') => {
71
68
  {
@@ -81,7 +78,7 @@ const uniqueTime = (key, measureText) => {
81
78
  };
82
79
  }
83
80
  };
84
- const rootAppliedStyles = new WeakMap();
81
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
85
82
  const registerStyle = (scopeId, cssText, allowCS) => {
86
83
  let style = styles.get(scopeId);
87
84
  if (supportsConstructableStylesheets && allowCS) {
@@ -103,7 +100,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
103
100
  const style = styles.get(scopeId);
104
101
  // if an element is NOT connected then getRootNode() will return the wrong root node
105
102
  // so the fallback is to always use the document for the root node in those cases
106
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
103
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
107
104
  if (style) {
108
105
  if (typeof style === 'string') {
109
106
  styleContainerNode = styleContainerNode.head || styleContainerNode;
@@ -137,7 +134,7 @@ const attachStyles = (hostRef) => {
137
134
  const flags = cmpMeta.$flags$;
138
135
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
139
136
  const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
140
- if (flags & 10 /* needsScopedEncapsulation */) {
137
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
141
138
  // only required when we're NOT using native shadow dom (slot)
142
139
  // or this browser doesn't support native shadow dom
143
140
  // and this host element was NOT created with SSR
@@ -147,7 +144,7 @@ const attachStyles = (hostRef) => {
147
144
  // DOM WRITE!!
148
145
  elm['s-sc'] = scopeId;
149
146
  elm.classList.add(scopeId + '-h');
150
- if (flags & 2 /* scopedCssEncapsulation */) {
147
+ if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
151
148
  elm.classList.add(scopeId + '-s');
152
149
  }
153
150
  }
@@ -408,7 +405,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
408
405
  }
409
406
  }
410
407
  }
411
- else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
408
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
412
409
  newValue = newValue === true ? '' : newValue;
413
410
  {
414
411
  elm.setAttribute(memberName, newValue);
@@ -423,7 +420,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
423
420
  // if the element passed in is a shadow root, which is a document fragment
424
421
  // then we want to be adding attrs/props to the shadow root's "host" element
425
422
  // if it's not a shadow root, then we add attrs/props to the same element
426
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
423
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
427
424
  ? newVnode.$elm$.host
428
425
  : newVnode.$elm$;
429
426
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
@@ -441,6 +438,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
441
438
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
442
439
  }
443
440
  };
441
+ /**
442
+ * Create a DOM Node corresponding to one of the children of a given VNode.
443
+ *
444
+ * @param oldParentVNode the parent VNode from the previous render
445
+ * @param newParentVNode the parent VNode from the current render
446
+ * @param childIndex the index of the VNode, in the _new_ parent node's
447
+ * children, for which we will create a new DOM node
448
+ * @param parentElm the parent DOM node which our new node will be a child of
449
+ * @returns the newly created node
450
+ */
444
451
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
445
452
  // tslint:disable-next-line: prefer-const
446
453
  const newVNode = newParentVNode.$children$[childIndex];
@@ -458,16 +465,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
458
465
  }
459
466
  newVNode.$flags$ |= newVNode.$children$
460
467
  ? // slot element has fallback content
461
- 2 /* isSlotFallback */
468
+ 2 /* VNODE_FLAGS.isSlotFallback */
462
469
  : // slot element does not have fallback content
463
- 1 /* isSlotReference */;
470
+ 1 /* VNODE_FLAGS.isSlotReference */;
464
471
  }
465
472
  }
466
473
  if (newVNode.$text$ !== null) {
467
474
  // create text node
468
475
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
469
476
  }
470
- else if (newVNode.$flags$ & 1 /* isSlotReference */) {
477
+ else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
471
478
  // create a slot reference node
472
479
  elm = newVNode.$elm$ =
473
480
  doc.createTextNode('');
@@ -477,7 +484,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
477
484
  isSvgMode = newVNode.$tag$ === 'svg';
478
485
  }
479
486
  // create element
480
- elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
487
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
481
488
  ? 'slot-fb'
482
489
  : newVNode.$tag$)
483
490
  );
@@ -517,7 +524,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
517
524
  }
518
525
  {
519
526
  elm['s-hn'] = hostTagName;
520
- if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
527
+ if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
521
528
  // remember the content reference comment
522
529
  elm['s-sr'] = true;
523
530
  // remember the content reference comment
@@ -536,7 +543,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
536
543
  return elm;
537
544
  };
538
545
  const putBackInOriginalLocation = (parentElm, recursive) => {
539
- plt.$flags$ |= 1 /* isTmpDisconnected */;
546
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
540
547
  const oldSlotChildNodes = parentElm.childNodes;
541
548
  for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
542
549
  const childNode = oldSlotChildNodes[i];
@@ -557,7 +564,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
557
564
  putBackInOriginalLocation(childNode, recursive);
558
565
  }
559
566
  }
560
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
567
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
561
568
  };
562
569
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
563
570
  let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
@@ -599,6 +606,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
599
606
  }
600
607
  }
601
608
  };
609
+ /**
610
+ * Reconcile the children of a new VNode with the children of an old VNode by
611
+ * traversing the two collections of children, identifying nodes that are
612
+ * conserved or changed, calling out to `patch` to make any necessary
613
+ * updates to the DOM, and rearranging DOM nodes as needed.
614
+ *
615
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
616
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
617
+ * 'windows' by storing start and end indices and references to the
618
+ * corresponding array entries. Initially the two 'windows' are basically equal
619
+ * to the entire array, but we progressively narrow the windows until there are
620
+ * no children left to update by doing the following:
621
+ *
622
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
623
+ * that if we have an initial array like the following we'll end up dealing
624
+ * only with a window bounded by the highlighted elements:
625
+ *
626
+ * [null, null, VNode1 , ... , VNode2, null, null]
627
+ * ^^^^^^ ^^^^^^
628
+ *
629
+ * 2. Check to see if the elements at the head and tail positions are equal
630
+ * across the windows. This will basically detect elements which haven't
631
+ * been added, removed, or changed position, i.e. if you had the following
632
+ * VNode elements (represented as HTML):
633
+ *
634
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
635
+ * newVNode: `<div><p><span>THERE</span></p></div>`
636
+ *
637
+ * Then when comparing the children of the `<div>` tag we check the equality
638
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
639
+ * same tag in the same position, we'd be able to avoid completely
640
+ * re-rendering the subtree under them with a new DOM element and would just
641
+ * call out to `patch` to handle reconciling their children and so on.
642
+ *
643
+ * 3. Check, for both windows, to see if the element at the beginning of the
644
+ * window corresponds to the element at the end of the other window. This is
645
+ * a heuristic which will let us identify _some_ situations in which
646
+ * elements have changed position, for instance it _should_ detect that the
647
+ * children nodes themselves have not changed but merely moved in the
648
+ * following example:
649
+ *
650
+ * oldVNode: `<div><element-one /><element-two /></div>`
651
+ * newVNode: `<div><element-two /><element-one /></div>`
652
+ *
653
+ * If we find cases like this then we also need to move the concrete DOM
654
+ * elements corresponding to the moved children to write the re-order to the
655
+ * DOM.
656
+ *
657
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
658
+ * nodes in the old children which have the same key as the first element in
659
+ * our window on the new children. If we find such a node we handle calling
660
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
661
+ * what we find.
662
+ *
663
+ * Finally, once we've narrowed our 'windows' to the point that either of them
664
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
665
+ * insertion or deletion that needs to happen to get a DOM state that correctly
666
+ * reflects the new child VNodes. If, for instance, after our window on the old
667
+ * children has collapsed we still have more nodes on the new children that
668
+ * we haven't dealt with yet then we need to add them, or if the new children
669
+ * collapse but we still have unhandled _old_ children then we need to make
670
+ * sure the corresponding DOM nodes are removed.
671
+ *
672
+ * @param parentElm the node into which the parent VNode is rendered
673
+ * @param oldCh the old children of the parent node
674
+ * @param newVNode the new VNode which will replace the parent
675
+ * @param newCh the new children of the parent node
676
+ */
602
677
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
603
678
  let oldStartIdx = 0;
604
679
  let newStartIdx = 0;
@@ -611,7 +686,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
611
686
  let node;
612
687
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
613
688
  if (oldStartVnode == null) {
614
- // Vnode might have been moved left
689
+ // VNode might have been moved left
615
690
  oldStartVnode = oldCh[++oldStartIdx];
616
691
  }
617
692
  else if (oldEndVnode == null) {
@@ -624,42 +699,102 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
624
699
  newEndVnode = newCh[--newEndIdx];
625
700
  }
626
701
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
702
+ // if the start nodes are the same then we should patch the new VNode
703
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
704
+ // indices to reflect that. We don't need to move any DOM Nodes around
705
+ // since things are matched up in order.
627
706
  patch(oldStartVnode, newStartVnode);
628
707
  oldStartVnode = oldCh[++oldStartIdx];
629
708
  newStartVnode = newCh[++newStartIdx];
630
709
  }
631
710
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
711
+ // likewise, if the end nodes are the same we patch new onto old and
712
+ // decrement our end indices, and also likewise in this case we don't
713
+ // need to move any DOM Nodes.
632
714
  patch(oldEndVnode, newEndVnode);
633
715
  oldEndVnode = oldCh[--oldEndIdx];
634
716
  newEndVnode = newCh[--newEndIdx];
635
717
  }
636
718
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
637
- // Vnode moved right
719
+ // case: "Vnode moved right"
720
+ //
721
+ // We've found that the last node in our window on the new children is
722
+ // the same VNode as the _first_ node in our window on the old children
723
+ // we're dealing with now. Visually, this is the layout of these two
724
+ // nodes:
725
+ //
726
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
727
+ // ^^^^^^^^^^^
728
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
729
+ // ^^^^^^^^^^^^^
730
+ //
731
+ // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
732
+ // and move the DOM element for `oldStartVnode`.
638
733
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
639
734
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
640
735
  }
641
736
  patch(oldStartVnode, newEndVnode);
737
+ // We need to move the element for `oldStartVnode` into a position which
738
+ // will be appropriate for `newEndVnode`. For this we can use
739
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
740
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
741
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
742
+ //
743
+ // <old-start-node />
744
+ // <some-intervening-node />
745
+ // <old-end-node />
746
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
747
+ // <next-sibling />
748
+ //
749
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
750
+ // the node for `oldStartVnode` at the end of the children of
751
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
752
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
753
+ // append it to the children of the parent element.
642
754
  parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
643
755
  oldStartVnode = oldCh[++oldStartIdx];
644
756
  newEndVnode = newCh[--newEndIdx];
645
757
  }
646
758
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
647
- // Vnode moved left
759
+ // case: "Vnode moved left"
760
+ //
761
+ // We've found that the first node in our window on the new children is
762
+ // the same VNode as the _last_ node in our window on the old children.
763
+ // Visually, this is the layout of these two nodes:
764
+ //
765
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
766
+ // ^^^^^^^^^^^^^
767
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
768
+ // ^^^^^^^^^^^
769
+ //
770
+ // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
771
+ // (which will handle updating any changed attributes, reconciling their
772
+ // children etc) but we also need to move the DOM node to which
773
+ // `oldEndVnode` corresponds.
648
774
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
649
775
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
650
776
  }
651
777
  patch(oldEndVnode, newStartVnode);
778
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
779
+ // the same node, so since we're here we know that they are not. Thus we
780
+ // can move the element for `oldEndVnode` _before_ the element for
781
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
782
+ // future.
652
783
  parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
653
784
  oldEndVnode = oldCh[--oldEndIdx];
654
785
  newStartVnode = newCh[++newStartIdx];
655
786
  }
656
787
  else {
657
788
  {
658
- // new element
789
+ // We either didn't find an element in the old children that matches
790
+ // the key of the first new child OR the build is not using `key`
791
+ // attributes at all. In either case we need to create a new element
792
+ // for the new node.
659
793
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
660
794
  newStartVnode = newCh[++newStartIdx];
661
795
  }
662
796
  if (node) {
797
+ // if we created a new node then handle inserting it to the DOM
663
798
  {
664
799
  parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
665
800
  }
@@ -667,18 +802,39 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
667
802
  }
668
803
  }
669
804
  if (oldStartIdx > oldEndIdx) {
805
+ // we have some more new nodes to add which don't match up with old nodes
670
806
  addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
671
807
  }
672
808
  else if (newStartIdx > newEndIdx) {
809
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
810
+ // in the new array, so lets remove them (which entails cleaning up the
811
+ // relevant DOM nodes)
673
812
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
674
813
  }
675
814
  };
676
- const isSameVnode = (vnode1, vnode2) => {
815
+ /**
816
+ * Compare two VNodes to determine if they are the same
817
+ *
818
+ * **NB**: This function is an equality _heuristic_ based on the available
819
+ * information set on the two VNodes and can be misleading under certain
820
+ * circumstances. In particular, if the two nodes do not have `key` attrs
821
+ * (available under `$key$` on VNodes) then the function falls back on merely
822
+ * checking that they have the same tag.
823
+ *
824
+ * So, in other words, if `key` attrs are not set on VNodes which may be
825
+ * changing order within a `children` array or something along those lines then
826
+ * we could obtain a false positive and then have to do needless re-rendering.
827
+ *
828
+ * @param leftVNode the first VNode to check
829
+ * @param rightVNode the second VNode to check
830
+ * @returns whether they're equal or not
831
+ */
832
+ const isSameVnode = (leftVNode, rightVNode) => {
677
833
  // compare if two vnode to see if they're "technically" the same
678
834
  // need to have the same element tag, and same key to be the same
679
- if (vnode1.$tag$ === vnode2.$tag$) {
680
- if (vnode1.$tag$ === 'slot') {
681
- return vnode1.$name$ === vnode2.$name$;
835
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
836
+ if (leftVNode.$tag$ === 'slot') {
837
+ return leftVNode.$name$ === rightVNode.$name$;
682
838
  }
683
839
  return true;
684
840
  }
@@ -692,6 +848,14 @@ const referenceNode = (node) => {
692
848
  return (node && node['s-ol']) || node;
693
849
  };
694
850
  const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
851
+ /**
852
+ * Handle reconciling an outdated VNode with a new one which corresponds to
853
+ * it. This function handles flushing updates to the DOM and reconciling the
854
+ * children of the two nodes (if any).
855
+ *
856
+ * @param oldVNode an old VNode whose DOM element and children we want to update
857
+ * @param newVNode a new VNode representing an updated version of the old one
858
+ */
695
859
  const patch = (oldVNode, newVNode) => {
696
860
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
697
861
  const oldChildren = oldVNode.$children$;
@@ -705,7 +869,6 @@ const patch = (oldVNode, newVNode) => {
705
869
  // only add this to the when the compiler sees we're using an svg somewhere
706
870
  isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
707
871
  }
708
- // element node
709
872
  {
710
873
  if (tag === 'slot')
711
874
  ;
@@ -718,6 +881,7 @@ const patch = (oldVNode, newVNode) => {
718
881
  }
719
882
  if (oldChildren !== null && newChildren !== null) {
720
883
  // looks like there's child vnodes for both the old and new vnodes
884
+ // so we need to call `updateChildren` to reconcile them
721
885
  updateChildren(elm, oldChildren, newVNode, newChildren);
722
886
  }
723
887
  else if (newChildren !== null) {
@@ -758,7 +922,7 @@ const updateFallbackSlotVisibility = (elm) => {
758
922
  let nodeType;
759
923
  for (i = 0, ilen = childNodes.length; i < ilen; i++) {
760
924
  childNode = childNodes[i];
761
- if (childNode.nodeType === 1 /* ElementNode */) {
925
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
762
926
  if (childNode['s-sr']) {
763
927
  // this is a slot fallback node
764
928
  // get the slot name for this slot reference node
@@ -770,7 +934,7 @@ const updateFallbackSlotVisibility = (elm) => {
770
934
  nodeType = childNodes[j].nodeType;
771
935
  if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
772
936
  // this sibling node is from a different component OR is a named fallback slot node
773
- if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
937
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
774
938
  childNode.hidden = true;
775
939
  break;
776
940
  }
@@ -779,8 +943,8 @@ const updateFallbackSlotVisibility = (elm) => {
779
943
  // this is a default fallback slot node
780
944
  // any element or text node (with content)
781
945
  // should hide the default fallback slot node
782
- if (nodeType === 1 /* ElementNode */ ||
783
- (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
946
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
947
+ (nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
784
948
  childNode.hidden = true;
785
949
  break;
786
950
  }
@@ -858,13 +1022,13 @@ const relocateSlotContent = (elm) => {
858
1022
  }
859
1023
  }
860
1024
  }
861
- if (childNode.nodeType === 1 /* ElementNode */) {
1025
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
862
1026
  relocateSlotContent(childNode);
863
1027
  }
864
1028
  }
865
1029
  };
866
1030
  const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
867
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1031
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
868
1032
  if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
869
1033
  return true;
870
1034
  }
@@ -895,7 +1059,7 @@ const renderVdom = (hostRef, renderFnResults) => {
895
1059
  cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
896
1060
  }
897
1061
  rootVnode.$tag$ = null;
898
- rootVnode.$flags$ |= 4 /* isHost */;
1062
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
899
1063
  hostRef.$vnode$ = rootVnode;
900
1064
  rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
901
1065
  {
@@ -903,7 +1067,7 @@ const renderVdom = (hostRef, renderFnResults) => {
903
1067
  }
904
1068
  {
905
1069
  contentRef = hostElm['s-cr'];
906
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1070
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
907
1071
  // always reset
908
1072
  checkSlotFallbackVisibility = false;
909
1073
  }
@@ -912,7 +1076,7 @@ const renderVdom = (hostRef, renderFnResults) => {
912
1076
  {
913
1077
  // while we're moving nodes around existing nodes, temporarily disable
914
1078
  // the disconnectCallback from working
915
- plt.$flags$ |= 1 /* isTmpDisconnected */;
1079
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
916
1080
  if (checkSlotRelocate) {
917
1081
  relocateSlotContent(rootVnode.$elm$);
918
1082
  let relocateData;
@@ -970,7 +1134,7 @@ const renderVdom = (hostRef, renderFnResults) => {
970
1134
  }
971
1135
  else {
972
1136
  // this node doesn't have a slot home to go to, so let's hide it
973
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1137
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
974
1138
  nodeToRelocate.hidden = true;
975
1139
  }
976
1140
  }
@@ -981,7 +1145,7 @@ const renderVdom = (hostRef, renderFnResults) => {
981
1145
  }
982
1146
  // done moving nodes around
983
1147
  // allow the disconnect callback to work again
984
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1148
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
985
1149
  // always reset
986
1150
  relocateNodes.length = 0;
987
1151
  }
@@ -992,9 +1156,9 @@ const createEvent = (ref, name, flags) => {
992
1156
  return {
993
1157
  emit: (detail) => {
994
1158
  return emitEvent(elm, name, {
995
- bubbles: !!(flags & 4 /* Bubbles */),
996
- composed: !!(flags & 2 /* Composed */),
997
- cancelable: !!(flags & 1 /* Cancellable */),
1159
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
1160
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
1161
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
998
1162
  detail,
999
1163
  });
1000
1164
  },
@@ -1019,10 +1183,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
1019
1183
  };
1020
1184
  const scheduleUpdate = (hostRef, isInitialLoad) => {
1021
1185
  {
1022
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1186
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1023
1187
  }
1024
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1025
- hostRef.$flags$ |= 512 /* needsRerender */;
1188
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1189
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1026
1190
  return;
1027
1191
  }
1028
1192
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
@@ -1038,7 +1202,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
1038
1202
  let promise;
1039
1203
  if (isInitialLoad) {
1040
1204
  {
1041
- hostRef.$flags$ |= 256 /* isListenReady */;
1205
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1042
1206
  if (hostRef.$queuedListeners$) {
1043
1207
  hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1044
1208
  hostRef.$queuedListeners$ = null;
@@ -1081,7 +1245,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1081
1245
  }
1082
1246
  else {
1083
1247
  Promise.all(childrenPromises).then(postUpdate);
1084
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1248
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1085
1249
  childrenPromises.length = 0;
1086
1250
  }
1087
1251
  }
@@ -1090,10 +1254,10 @@ const callRender = (hostRef, instance, elm) => {
1090
1254
  try {
1091
1255
  instance = instance.render() ;
1092
1256
  {
1093
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1257
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1094
1258
  }
1095
1259
  {
1096
- hostRef.$flags$ |= 2 /* hasRendered */;
1260
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1097
1261
  }
1098
1262
  {
1099
1263
  {
@@ -1120,8 +1284,8 @@ const postUpdateComponent = (hostRef) => {
1120
1284
  {
1121
1285
  safeCall(instance, 'componentDidRender');
1122
1286
  }
1123
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1124
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1287
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1288
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1125
1289
  {
1126
1290
  // DOM WRITE!
1127
1291
  addHydratedFlag(elm);
@@ -1150,10 +1314,10 @@ const postUpdateComponent = (hostRef) => {
1150
1314
  hostRef.$onRenderResolve$();
1151
1315
  hostRef.$onRenderResolve$ = undefined;
1152
1316
  }
1153
- if (hostRef.$flags$ & 512 /* needsRerender */) {
1317
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1154
1318
  nextTick(() => scheduleUpdate(hostRef, false));
1155
1319
  }
1156
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1320
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1157
1321
  }
1158
1322
  // ( •_•)
1159
1323
  // ( •_•)>⌐■-■
@@ -1209,16 +1373,16 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1209
1373
  const parsePropertyValue = (propValue, propType) => {
1210
1374
  // ensure this value is of the correct prop type
1211
1375
  if (propValue != null && !isComplexType(propValue)) {
1212
- if (propType & 4 /* Boolean */) {
1376
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
1213
1377
  // per the HTML spec, any string value means it is a boolean true value
1214
1378
  // but we'll cheat here and say that the string "false" is the boolean false
1215
1379
  return propValue === 'false' ? false : propValue === '' || !!propValue;
1216
1380
  }
1217
- if (propType & 2 /* Number */) {
1381
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
1218
1382
  // force it to be a number
1219
1383
  return parseFloat(propValue);
1220
1384
  }
1221
- if (propType & 1 /* String */) {
1385
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
1222
1386
  // could have been passed as a number or boolean
1223
1387
  // but we still want it as a string
1224
1388
  return String(propValue);
@@ -1242,13 +1406,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1242
1406
  // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1243
1407
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1244
1408
  const didValueChange = newVal !== oldVal && !areBothNaN;
1245
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1409
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1246
1410
  // gadzooks! the property's value has changed!!
1247
1411
  // set our new value!
1248
1412
  hostRef.$instanceValues$.set(propName, newVal);
1249
1413
  if (instance) {
1250
1414
  // get an array of method names of watch functions to call
1251
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1415
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1252
1416
  const watchMethods = cmpMeta.$watchers$[propName];
1253
1417
  if (watchMethods) {
1254
1418
  // this instance is watching for when this property changed
@@ -1263,7 +1427,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1263
1427
  });
1264
1428
  }
1265
1429
  }
1266
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1430
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1267
1431
  // looks like this value actually changed, so we've got work to do!
1268
1432
  // but only if we've already rendered, otherwise just chill out
1269
1433
  // queue that we need to do an update, but don't worry about queuing
@@ -1282,8 +1446,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1282
1446
  const members = Object.entries(cmpMeta.$members$);
1283
1447
  const prototype = Cstr.prototype;
1284
1448
  members.map(([memberName, [memberFlags]]) => {
1285
- if ((memberFlags & 31 /* Prop */ ||
1286
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1449
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1450
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1287
1451
  // proxyComponent - prop
1288
1452
  Object.defineProperty(prototype, memberName, {
1289
1453
  get() {
@@ -1298,8 +1462,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1298
1462
  enumerable: true,
1299
1463
  });
1300
1464
  }
1301
- else if (flags & 1 /* isElementConstructor */ &&
1302
- memberFlags & 64 /* Method */) {
1465
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1466
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1303
1467
  // proxyComponent - method
1304
1468
  Object.defineProperty(prototype, memberName, {
1305
1469
  value(...args) {
@@ -1309,7 +1473,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1309
1473
  });
1310
1474
  }
1311
1475
  });
1312
- if ((flags & 1 /* isElementConstructor */)) {
1476
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1313
1477
  const attrNameToPropName = new Map();
1314
1478
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1315
1479
  plt.jmp(() => {
@@ -1365,11 +1529,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1365
1529
  // create an array of attributes to observe
1366
1530
  // and also create a map of html attribute name to js property name
1367
1531
  Cstr.observedAttributes = members
1368
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1532
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1369
1533
  .map(([propName, m]) => {
1370
1534
  const attrName = m[1] || propName;
1371
1535
  attrNameToPropName.set(attrName, propName);
1372
- if (m[0] & 512 /* ReflectAttr */) {
1536
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1373
1537
  cmpMeta.$attrsToReflect$.push([propName, attrName]);
1374
1538
  }
1375
1539
  return attrName;
@@ -1380,10 +1544,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1380
1544
  };
1381
1545
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1382
1546
  // initializeComponent
1383
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1547
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1384
1548
  {
1385
1549
  // we haven't initialized this element yet
1386
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1550
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1387
1551
  // lazy loaded components
1388
1552
  // request the component's implementation to be
1389
1553
  // wired up with the host element
@@ -1401,7 +1565,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1401
1565
  {
1402
1566
  cmpMeta.$watchers$ = Cstr.watchers;
1403
1567
  }
1404
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1568
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1405
1569
  Cstr.isProxied = true;
1406
1570
  }
1407
1571
  const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
@@ -1409,7 +1573,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1409
1573
  // but let's keep track of when we start and stop
1410
1574
  // so that the getters/setters don't incorrectly step on data
1411
1575
  {
1412
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1576
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1413
1577
  }
1414
1578
  // construct the lazy-loaded component implementation
1415
1579
  // passing the hostRef is very important during
@@ -1422,10 +1586,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1422
1586
  consoleError(e);
1423
1587
  }
1424
1588
  {
1425
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1589
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1426
1590
  }
1427
1591
  {
1428
- hostRef.$flags$ |= 128 /* isWatchReady */;
1592
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1429
1593
  }
1430
1594
  endNewInstance();
1431
1595
  }
@@ -1435,7 +1599,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1435
1599
  const scopeId = getScopeId(cmpMeta);
1436
1600
  if (!styles.has(scopeId)) {
1437
1601
  const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1438
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1602
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1439
1603
  endRegisterStyles();
1440
1604
  }
1441
1605
  }
@@ -1457,19 +1621,19 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1457
1621
  }
1458
1622
  };
1459
1623
  const connectedCallback = (elm) => {
1460
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1624
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1461
1625
  const hostRef = getHostRef(elm);
1462
1626
  const cmpMeta = hostRef.$cmpMeta$;
1463
1627
  const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1464
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1628
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1465
1629
  // first time this component has connected
1466
- hostRef.$flags$ |= 1 /* hasConnected */;
1630
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1467
1631
  {
1468
1632
  // initUpdate
1469
1633
  // if the slot polyfill is required we'll need to put some nodes
1470
1634
  // in here to act as original content anchors as we move nodes around
1471
1635
  // host element has been connected to the DOM
1472
- if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1636
+ if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
1473
1637
  setContentReference(elm);
1474
1638
  }
1475
1639
  }
@@ -1492,7 +1656,7 @@ const connectedCallback = (elm) => {
1492
1656
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1493
1657
  if (cmpMeta.$members$) {
1494
1658
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1495
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1659
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1496
1660
  const value = elm[memberName];
1497
1661
  delete elm[memberName];
1498
1662
  elm[memberName] = value;
@@ -1524,7 +1688,7 @@ const setContentReference = (elm) => {
1524
1688
  elm.insertBefore(contentRefElm, elm.firstChild);
1525
1689
  };
1526
1690
  const disconnectedCallback = (elm) => {
1527
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1691
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1528
1692
  const hostRef = getHostRef(elm);
1529
1693
  {
1530
1694
  if (hostRef.$rmListeners$) {
@@ -1534,46 +1698,6 @@ const disconnectedCallback = (elm) => {
1534
1698
  }
1535
1699
  }
1536
1700
  };
1537
- const patchCloneNode = (HostElementPrototype) => {
1538
- const orgCloneNode = HostElementPrototype.cloneNode;
1539
- HostElementPrototype.cloneNode = function (deep) {
1540
- const srcNode = this;
1541
- const isShadowDom = srcNode.shadowRoot && supportsShadow ;
1542
- const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
1543
- if (!isShadowDom && deep) {
1544
- let i = 0;
1545
- let slotted, nonStencilNode;
1546
- const stencilPrivates = [
1547
- 's-id',
1548
- 's-cr',
1549
- 's-lr',
1550
- 's-rc',
1551
- 's-sc',
1552
- 's-p',
1553
- 's-cn',
1554
- 's-sr',
1555
- 's-sn',
1556
- 's-hn',
1557
- 's-ol',
1558
- 's-nr',
1559
- 's-si',
1560
- ];
1561
- for (; i < srcNode.childNodes.length; i++) {
1562
- slotted = srcNode.childNodes[i]['s-nr'];
1563
- nonStencilNode = stencilPrivates.every((privateField) => !srcNode.childNodes[i][privateField]);
1564
- if (slotted) {
1565
- {
1566
- clonedNode.appendChild(slotted.cloneNode(true));
1567
- }
1568
- }
1569
- if (nonStencilNode) {
1570
- clonedNode.appendChild(srcNode.childNodes[i].cloneNode(true));
1571
- }
1572
- }
1573
- }
1574
- return clonedNode;
1575
- };
1576
- };
1577
1701
  const bootstrapLazy = (lazyBundles, options = {}) => {
1578
1702
  const endBootstrap = createTime();
1579
1703
  const cmpTags = [];
@@ -1615,7 +1739,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1615
1739
  super(self);
1616
1740
  self = this;
1617
1741
  registerHost(self, cmpMeta);
1618
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1742
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1619
1743
  // this component is using shadow dom
1620
1744
  // and this browser supports shadow dom
1621
1745
  // add the read-only property "shadowRoot" to the host element
@@ -1647,13 +1771,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1647
1771
  return getHostRef(this).$onReadyPromise$;
1648
1772
  }
1649
1773
  };
1650
- {
1651
- patchCloneNode(HostElement.prototype);
1652
- }
1653
1774
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1654
1775
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1655
1776
  cmpTags.push(tagName);
1656
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1777
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1657
1778
  }
1658
1779
  });
1659
1780
  });
@@ -1675,7 +1796,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1675
1796
  // Fallback appLoad event
1676
1797
  endBootstrap();
1677
1798
  };
1678
- const hostRefs = new WeakMap();
1799
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1679
1800
  const getHostRef = (ref) => hostRefs.get(ref);
1680
1801
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1681
1802
  const registerHost = (elm, cmpMeta) => {
@@ -1720,14 +1841,14 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1720
1841
  return importedModule[exportName];
1721
1842
  }, consoleError);
1722
1843
  };
1723
- const styles = new Map();
1844
+ const styles = /*@__PURE__*/ new Map();
1724
1845
  const queueDomReads = [];
1725
1846
  const queueDomWrites = [];
1726
1847
  const queueTask = (queue, write) => (cb) => {
1727
1848
  queue.push(cb);
1728
1849
  if (!queuePending) {
1729
1850
  queuePending = true;
1730
- if (write && plt.$flags$ & 4 /* queueSync */) {
1851
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1731
1852
  nextTick(flush);
1732
1853
  }
1733
1854
  else {
@@ -1764,4 +1885,4 @@ const flush = () => {
1764
1885
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1765
1886
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1766
1887
 
1767
- export { H, Host as a, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };
1888
+ export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };