@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
@@ -32,8 +32,6 @@ let isSvgMode = false;
32
32
  let queuePending = false;
33
33
  const win = typeof window !== 'undefined' ? window : {};
34
34
  const doc = win.document || { head: {} };
35
- const H = (win.HTMLElement || class {
36
- });
37
35
  const plt = {
38
36
  $flags$: 0,
39
37
  $resourcesUrl$: '',
@@ -43,7 +41,6 @@ const plt = {
43
41
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
44
42
  ce: (eventName, opts) => new CustomEvent(eventName, opts),
45
43
  };
46
- const supportsShadow = true;
47
44
  const promiseResolve = (v) => Promise.resolve(v);
48
45
  const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
49
46
  try {
@@ -68,7 +65,7 @@ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =
68
65
  const hostListenerProxy = (hostRef, methodName) => (ev) => {
69
66
  try {
70
67
  {
71
- if (hostRef.$flags$ & 256 /* isListenReady */) {
68
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
72
69
  // instance is ready, let's call it's member method for this event
73
70
  hostRef.$lazyInstance$[methodName](ev);
74
71
  }
@@ -82,12 +79,12 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
82
79
  }
83
80
  };
84
81
  const getHostListenerTarget = (elm, flags) => {
85
- if (flags & 8 /* TargetWindow */)
82
+ if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
86
83
  return win;
87
84
  return elm;
88
85
  };
89
86
  // prettier-ignore
90
- const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
87
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
91
88
  const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
92
89
  const createTime = (fnName, tagName = '') => {
93
90
  {
@@ -103,7 +100,7 @@ const uniqueTime = (key, measureText) => {
103
100
  };
104
101
  }
105
102
  };
106
- const rootAppliedStyles = new WeakMap();
103
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
107
104
  const registerStyle = (scopeId, cssText, allowCS) => {
108
105
  let style = styles.get(scopeId);
109
106
  if (supportsConstructableStylesheets && allowCS) {
@@ -125,7 +122,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
125
122
  const style = styles.get(scopeId);
126
123
  // if an element is NOT connected then getRootNode() will return the wrong root node
127
124
  // so the fallback is to always use the document for the root node in those cases
128
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
125
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
129
126
  if (style) {
130
127
  if (typeof style === 'string') {
131
128
  styleContainerNode = styleContainerNode.head || styleContainerNode;
@@ -159,7 +156,7 @@ const attachStyles = (hostRef) => {
159
156
  const flags = cmpMeta.$flags$;
160
157
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
161
158
  const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
162
- if (flags & 10 /* needsScopedEncapsulation */) {
159
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
163
160
  // only required when we're NOT using native shadow dom (slot)
164
161
  // or this browser doesn't support native shadow dom
165
162
  // and this host element was NOT created with SSR
@@ -169,7 +166,7 @@ const attachStyles = (hostRef) => {
169
166
  // DOM WRITE!!
170
167
  elm['s-sc'] = scopeId;
171
168
  elm.classList.add(scopeId + '-h');
172
- if (flags & 2 /* scopedCssEncapsulation */) {
169
+ if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
173
170
  elm.classList.add(scopeId + '-s');
174
171
  }
175
172
  }
@@ -430,7 +427,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
430
427
  }
431
428
  }
432
429
  }
433
- else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
430
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
434
431
  newValue = newValue === true ? '' : newValue;
435
432
  {
436
433
  elm.setAttribute(memberName, newValue);
@@ -445,7 +442,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
445
442
  // if the element passed in is a shadow root, which is a document fragment
446
443
  // then we want to be adding attrs/props to the shadow root's "host" element
447
444
  // if it's not a shadow root, then we add attrs/props to the same element
448
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
445
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
449
446
  ? newVnode.$elm$.host
450
447
  : newVnode.$elm$;
451
448
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
@@ -463,6 +460,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
463
460
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
464
461
  }
465
462
  };
463
+ /**
464
+ * Create a DOM Node corresponding to one of the children of a given VNode.
465
+ *
466
+ * @param oldParentVNode the parent VNode from the previous render
467
+ * @param newParentVNode the parent VNode from the current render
468
+ * @param childIndex the index of the VNode, in the _new_ parent node's
469
+ * children, for which we will create a new DOM node
470
+ * @param parentElm the parent DOM node which our new node will be a child of
471
+ * @returns the newly created node
472
+ */
466
473
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
467
474
  // tslint:disable-next-line: prefer-const
468
475
  const newVNode = newParentVNode.$children$[childIndex];
@@ -480,16 +487,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
480
487
  }
481
488
  newVNode.$flags$ |= newVNode.$children$
482
489
  ? // slot element has fallback content
483
- 2 /* isSlotFallback */
490
+ 2 /* VNODE_FLAGS.isSlotFallback */
484
491
  : // slot element does not have fallback content
485
- 1 /* isSlotReference */;
492
+ 1 /* VNODE_FLAGS.isSlotReference */;
486
493
  }
487
494
  }
488
495
  if (newVNode.$text$ !== null) {
489
496
  // create text node
490
497
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
491
498
  }
492
- else if (newVNode.$flags$ & 1 /* isSlotReference */) {
499
+ else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
493
500
  // create a slot reference node
494
501
  elm = newVNode.$elm$ =
495
502
  doc.createTextNode('');
@@ -499,7 +506,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
499
506
  isSvgMode = newVNode.$tag$ === 'svg';
500
507
  }
501
508
  // create element
502
- elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
509
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
503
510
  ? 'slot-fb'
504
511
  : newVNode.$tag$)
505
512
  );
@@ -539,7 +546,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
539
546
  }
540
547
  {
541
548
  elm['s-hn'] = hostTagName;
542
- if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
549
+ if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
543
550
  // remember the content reference comment
544
551
  elm['s-sr'] = true;
545
552
  // remember the content reference comment
@@ -558,7 +565,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
558
565
  return elm;
559
566
  };
560
567
  const putBackInOriginalLocation = (parentElm, recursive) => {
561
- plt.$flags$ |= 1 /* isTmpDisconnected */;
568
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
562
569
  const oldSlotChildNodes = parentElm.childNodes;
563
570
  for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
564
571
  const childNode = oldSlotChildNodes[i];
@@ -579,7 +586,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
579
586
  putBackInOriginalLocation(childNode, recursive);
580
587
  }
581
588
  }
582
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
589
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
583
590
  };
584
591
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
585
592
  let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
@@ -621,6 +628,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
621
628
  }
622
629
  }
623
630
  };
631
+ /**
632
+ * Reconcile the children of a new VNode with the children of an old VNode by
633
+ * traversing the two collections of children, identifying nodes that are
634
+ * conserved or changed, calling out to `patch` to make any necessary
635
+ * updates to the DOM, and rearranging DOM nodes as needed.
636
+ *
637
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
638
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
639
+ * 'windows' by storing start and end indices and references to the
640
+ * corresponding array entries. Initially the two 'windows' are basically equal
641
+ * to the entire array, but we progressively narrow the windows until there are
642
+ * no children left to update by doing the following:
643
+ *
644
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
645
+ * that if we have an initial array like the following we'll end up dealing
646
+ * only with a window bounded by the highlighted elements:
647
+ *
648
+ * [null, null, VNode1 , ... , VNode2, null, null]
649
+ * ^^^^^^ ^^^^^^
650
+ *
651
+ * 2. Check to see if the elements at the head and tail positions are equal
652
+ * across the windows. This will basically detect elements which haven't
653
+ * been added, removed, or changed position, i.e. if you had the following
654
+ * VNode elements (represented as HTML):
655
+ *
656
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
657
+ * newVNode: `<div><p><span>THERE</span></p></div>`
658
+ *
659
+ * Then when comparing the children of the `<div>` tag we check the equality
660
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
661
+ * same tag in the same position, we'd be able to avoid completely
662
+ * re-rendering the subtree under them with a new DOM element and would just
663
+ * call out to `patch` to handle reconciling their children and so on.
664
+ *
665
+ * 3. Check, for both windows, to see if the element at the beginning of the
666
+ * window corresponds to the element at the end of the other window. This is
667
+ * a heuristic which will let us identify _some_ situations in which
668
+ * elements have changed position, for instance it _should_ detect that the
669
+ * children nodes themselves have not changed but merely moved in the
670
+ * following example:
671
+ *
672
+ * oldVNode: `<div><element-one /><element-two /></div>`
673
+ * newVNode: `<div><element-two /><element-one /></div>`
674
+ *
675
+ * If we find cases like this then we also need to move the concrete DOM
676
+ * elements corresponding to the moved children to write the re-order to the
677
+ * DOM.
678
+ *
679
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
680
+ * nodes in the old children which have the same key as the first element in
681
+ * our window on the new children. If we find such a node we handle calling
682
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
683
+ * what we find.
684
+ *
685
+ * Finally, once we've narrowed our 'windows' to the point that either of them
686
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
687
+ * insertion or deletion that needs to happen to get a DOM state that correctly
688
+ * reflects the new child VNodes. If, for instance, after our window on the old
689
+ * children has collapsed we still have more nodes on the new children that
690
+ * we haven't dealt with yet then we need to add them, or if the new children
691
+ * collapse but we still have unhandled _old_ children then we need to make
692
+ * sure the corresponding DOM nodes are removed.
693
+ *
694
+ * @param parentElm the node into which the parent VNode is rendered
695
+ * @param oldCh the old children of the parent node
696
+ * @param newVNode the new VNode which will replace the parent
697
+ * @param newCh the new children of the parent node
698
+ */
624
699
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
625
700
  let oldStartIdx = 0;
626
701
  let newStartIdx = 0;
@@ -633,7 +708,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
633
708
  let node;
634
709
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
635
710
  if (oldStartVnode == null) {
636
- // Vnode might have been moved left
711
+ // VNode might have been moved left
637
712
  oldStartVnode = oldCh[++oldStartIdx];
638
713
  }
639
714
  else if (oldEndVnode == null) {
@@ -646,42 +721,102 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
646
721
  newEndVnode = newCh[--newEndIdx];
647
722
  }
648
723
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
724
+ // if the start nodes are the same then we should patch the new VNode
725
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
726
+ // indices to reflect that. We don't need to move any DOM Nodes around
727
+ // since things are matched up in order.
649
728
  patch(oldStartVnode, newStartVnode);
650
729
  oldStartVnode = oldCh[++oldStartIdx];
651
730
  newStartVnode = newCh[++newStartIdx];
652
731
  }
653
732
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
733
+ // likewise, if the end nodes are the same we patch new onto old and
734
+ // decrement our end indices, and also likewise in this case we don't
735
+ // need to move any DOM Nodes.
654
736
  patch(oldEndVnode, newEndVnode);
655
737
  oldEndVnode = oldCh[--oldEndIdx];
656
738
  newEndVnode = newCh[--newEndIdx];
657
739
  }
658
740
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
659
- // Vnode moved right
741
+ // case: "Vnode moved right"
742
+ //
743
+ // We've found that the last node in our window on the new children is
744
+ // the same VNode as the _first_ node in our window on the old children
745
+ // we're dealing with now. Visually, this is the layout of these two
746
+ // nodes:
747
+ //
748
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
749
+ // ^^^^^^^^^^^
750
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
751
+ // ^^^^^^^^^^^^^
752
+ //
753
+ // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
754
+ // and move the DOM element for `oldStartVnode`.
660
755
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
661
756
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
662
757
  }
663
758
  patch(oldStartVnode, newEndVnode);
759
+ // We need to move the element for `oldStartVnode` into a position which
760
+ // will be appropriate for `newEndVnode`. For this we can use
761
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
762
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
763
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
764
+ //
765
+ // <old-start-node />
766
+ // <some-intervening-node />
767
+ // <old-end-node />
768
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
769
+ // <next-sibling />
770
+ //
771
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
772
+ // the node for `oldStartVnode` at the end of the children of
773
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
774
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
775
+ // append it to the children of the parent element.
664
776
  parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
665
777
  oldStartVnode = oldCh[++oldStartIdx];
666
778
  newEndVnode = newCh[--newEndIdx];
667
779
  }
668
780
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
669
- // Vnode moved left
781
+ // case: "Vnode moved left"
782
+ //
783
+ // We've found that the first node in our window on the new children is
784
+ // the same VNode as the _last_ node in our window on the old children.
785
+ // Visually, this is the layout of these two nodes:
786
+ //
787
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
788
+ // ^^^^^^^^^^^^^
789
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
790
+ // ^^^^^^^^^^^
791
+ //
792
+ // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
793
+ // (which will handle updating any changed attributes, reconciling their
794
+ // children etc) but we also need to move the DOM node to which
795
+ // `oldEndVnode` corresponds.
670
796
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
671
797
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
672
798
  }
673
799
  patch(oldEndVnode, newStartVnode);
800
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
801
+ // the same node, so since we're here we know that they are not. Thus we
802
+ // can move the element for `oldEndVnode` _before_ the element for
803
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
804
+ // future.
674
805
  parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
675
806
  oldEndVnode = oldCh[--oldEndIdx];
676
807
  newStartVnode = newCh[++newStartIdx];
677
808
  }
678
809
  else {
679
810
  {
680
- // new element
811
+ // We either didn't find an element in the old children that matches
812
+ // the key of the first new child OR the build is not using `key`
813
+ // attributes at all. In either case we need to create a new element
814
+ // for the new node.
681
815
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
682
816
  newStartVnode = newCh[++newStartIdx];
683
817
  }
684
818
  if (node) {
819
+ // if we created a new node then handle inserting it to the DOM
685
820
  {
686
821
  parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
687
822
  }
@@ -689,18 +824,39 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
689
824
  }
690
825
  }
691
826
  if (oldStartIdx > oldEndIdx) {
827
+ // we have some more new nodes to add which don't match up with old nodes
692
828
  addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
693
829
  }
694
830
  else if (newStartIdx > newEndIdx) {
831
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
832
+ // in the new array, so lets remove them (which entails cleaning up the
833
+ // relevant DOM nodes)
695
834
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
696
835
  }
697
836
  };
698
- const isSameVnode = (vnode1, vnode2) => {
837
+ /**
838
+ * Compare two VNodes to determine if they are the same
839
+ *
840
+ * **NB**: This function is an equality _heuristic_ based on the available
841
+ * information set on the two VNodes and can be misleading under certain
842
+ * circumstances. In particular, if the two nodes do not have `key` attrs
843
+ * (available under `$key$` on VNodes) then the function falls back on merely
844
+ * checking that they have the same tag.
845
+ *
846
+ * So, in other words, if `key` attrs are not set on VNodes which may be
847
+ * changing order within a `children` array or something along those lines then
848
+ * we could obtain a false positive and then have to do needless re-rendering.
849
+ *
850
+ * @param leftVNode the first VNode to check
851
+ * @param rightVNode the second VNode to check
852
+ * @returns whether they're equal or not
853
+ */
854
+ const isSameVnode = (leftVNode, rightVNode) => {
699
855
  // compare if two vnode to see if they're "technically" the same
700
856
  // need to have the same element tag, and same key to be the same
701
- if (vnode1.$tag$ === vnode2.$tag$) {
702
- if (vnode1.$tag$ === 'slot') {
703
- return vnode1.$name$ === vnode2.$name$;
857
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
858
+ if (leftVNode.$tag$ === 'slot') {
859
+ return leftVNode.$name$ === rightVNode.$name$;
704
860
  }
705
861
  return true;
706
862
  }
@@ -714,6 +870,14 @@ const referenceNode = (node) => {
714
870
  return (node && node['s-ol']) || node;
715
871
  };
716
872
  const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
873
+ /**
874
+ * Handle reconciling an outdated VNode with a new one which corresponds to
875
+ * it. This function handles flushing updates to the DOM and reconciling the
876
+ * children of the two nodes (if any).
877
+ *
878
+ * @param oldVNode an old VNode whose DOM element and children we want to update
879
+ * @param newVNode a new VNode representing an updated version of the old one
880
+ */
717
881
  const patch = (oldVNode, newVNode) => {
718
882
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
719
883
  const oldChildren = oldVNode.$children$;
@@ -727,7 +891,6 @@ const patch = (oldVNode, newVNode) => {
727
891
  // only add this to the when the compiler sees we're using an svg somewhere
728
892
  isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
729
893
  }
730
- // element node
731
894
  {
732
895
  if (tag === 'slot')
733
896
  ;
@@ -740,6 +903,7 @@ const patch = (oldVNode, newVNode) => {
740
903
  }
741
904
  if (oldChildren !== null && newChildren !== null) {
742
905
  // looks like there's child vnodes for both the old and new vnodes
906
+ // so we need to call `updateChildren` to reconcile them
743
907
  updateChildren(elm, oldChildren, newVNode, newChildren);
744
908
  }
745
909
  else if (newChildren !== null) {
@@ -780,7 +944,7 @@ const updateFallbackSlotVisibility = (elm) => {
780
944
  let nodeType;
781
945
  for (i = 0, ilen = childNodes.length; i < ilen; i++) {
782
946
  childNode = childNodes[i];
783
- if (childNode.nodeType === 1 /* ElementNode */) {
947
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
784
948
  if (childNode['s-sr']) {
785
949
  // this is a slot fallback node
786
950
  // get the slot name for this slot reference node
@@ -792,7 +956,7 @@ const updateFallbackSlotVisibility = (elm) => {
792
956
  nodeType = childNodes[j].nodeType;
793
957
  if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
794
958
  // this sibling node is from a different component OR is a named fallback slot node
795
- if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
959
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
796
960
  childNode.hidden = true;
797
961
  break;
798
962
  }
@@ -801,8 +965,8 @@ const updateFallbackSlotVisibility = (elm) => {
801
965
  // this is a default fallback slot node
802
966
  // any element or text node (with content)
803
967
  // should hide the default fallback slot node
804
- if (nodeType === 1 /* ElementNode */ ||
805
- (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
968
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
969
+ (nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
806
970
  childNode.hidden = true;
807
971
  break;
808
972
  }
@@ -880,13 +1044,13 @@ const relocateSlotContent = (elm) => {
880
1044
  }
881
1045
  }
882
1046
  }
883
- if (childNode.nodeType === 1 /* ElementNode */) {
1047
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
884
1048
  relocateSlotContent(childNode);
885
1049
  }
886
1050
  }
887
1051
  };
888
1052
  const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
889
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1053
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
890
1054
  if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
891
1055
  return true;
892
1056
  }
@@ -917,7 +1081,7 @@ const renderVdom = (hostRef, renderFnResults) => {
917
1081
  cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
918
1082
  }
919
1083
  rootVnode.$tag$ = null;
920
- rootVnode.$flags$ |= 4 /* isHost */;
1084
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
921
1085
  hostRef.$vnode$ = rootVnode;
922
1086
  rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
923
1087
  {
@@ -925,7 +1089,7 @@ const renderVdom = (hostRef, renderFnResults) => {
925
1089
  }
926
1090
  {
927
1091
  contentRef = hostElm['s-cr'];
928
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1092
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
929
1093
  // always reset
930
1094
  checkSlotFallbackVisibility = false;
931
1095
  }
@@ -934,7 +1098,7 @@ const renderVdom = (hostRef, renderFnResults) => {
934
1098
  {
935
1099
  // while we're moving nodes around existing nodes, temporarily disable
936
1100
  // the disconnectCallback from working
937
- plt.$flags$ |= 1 /* isTmpDisconnected */;
1101
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
938
1102
  if (checkSlotRelocate) {
939
1103
  relocateSlotContent(rootVnode.$elm$);
940
1104
  let relocateData;
@@ -992,7 +1156,7 @@ const renderVdom = (hostRef, renderFnResults) => {
992
1156
  }
993
1157
  else {
994
1158
  // this node doesn't have a slot home to go to, so let's hide it
995
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1159
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
996
1160
  nodeToRelocate.hidden = true;
997
1161
  }
998
1162
  }
@@ -1003,7 +1167,7 @@ const renderVdom = (hostRef, renderFnResults) => {
1003
1167
  }
1004
1168
  // done moving nodes around
1005
1169
  // allow the disconnect callback to work again
1006
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1170
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1007
1171
  // always reset
1008
1172
  relocateNodes.length = 0;
1009
1173
  }
@@ -1014,9 +1178,9 @@ const createEvent = (ref, name, flags) => {
1014
1178
  return {
1015
1179
  emit: (detail) => {
1016
1180
  return emitEvent(elm, name, {
1017
- bubbles: !!(flags & 4 /* Bubbles */),
1018
- composed: !!(flags & 2 /* Composed */),
1019
- cancelable: !!(flags & 1 /* Cancellable */),
1181
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
1182
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
1183
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
1020
1184
  detail,
1021
1185
  });
1022
1186
  },
@@ -1041,10 +1205,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
1041
1205
  };
1042
1206
  const scheduleUpdate = (hostRef, isInitialLoad) => {
1043
1207
  {
1044
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1208
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1045
1209
  }
1046
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1047
- hostRef.$flags$ |= 512 /* needsRerender */;
1210
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1211
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1048
1212
  return;
1049
1213
  }
1050
1214
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
@@ -1060,7 +1224,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
1060
1224
  let promise;
1061
1225
  if (isInitialLoad) {
1062
1226
  {
1063
- hostRef.$flags$ |= 256 /* isListenReady */;
1227
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1064
1228
  if (hostRef.$queuedListeners$) {
1065
1229
  hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1066
1230
  hostRef.$queuedListeners$ = null;
@@ -1103,7 +1267,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1103
1267
  }
1104
1268
  else {
1105
1269
  Promise.all(childrenPromises).then(postUpdate);
1106
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1270
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1107
1271
  childrenPromises.length = 0;
1108
1272
  }
1109
1273
  }
@@ -1112,10 +1276,10 @@ const callRender = (hostRef, instance, elm) => {
1112
1276
  try {
1113
1277
  instance = instance.render() ;
1114
1278
  {
1115
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1279
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1116
1280
  }
1117
1281
  {
1118
- hostRef.$flags$ |= 2 /* hasRendered */;
1282
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1119
1283
  }
1120
1284
  {
1121
1285
  {
@@ -1142,8 +1306,8 @@ const postUpdateComponent = (hostRef) => {
1142
1306
  {
1143
1307
  safeCall(instance, 'componentDidRender');
1144
1308
  }
1145
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1146
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1309
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1310
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1147
1311
  {
1148
1312
  // DOM WRITE!
1149
1313
  addHydratedFlag(elm);
@@ -1172,10 +1336,10 @@ const postUpdateComponent = (hostRef) => {
1172
1336
  hostRef.$onRenderResolve$();
1173
1337
  hostRef.$onRenderResolve$ = undefined;
1174
1338
  }
1175
- if (hostRef.$flags$ & 512 /* needsRerender */) {
1339
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1176
1340
  nextTick(() => scheduleUpdate(hostRef, false));
1177
1341
  }
1178
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1342
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1179
1343
  }
1180
1344
  // ( •_•)
1181
1345
  // ( •_•)>⌐■-■
@@ -1231,16 +1395,16 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1231
1395
  const parsePropertyValue = (propValue, propType) => {
1232
1396
  // ensure this value is of the correct prop type
1233
1397
  if (propValue != null && !isComplexType(propValue)) {
1234
- if (propType & 4 /* Boolean */) {
1398
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
1235
1399
  // per the HTML spec, any string value means it is a boolean true value
1236
1400
  // but we'll cheat here and say that the string "false" is the boolean false
1237
1401
  return propValue === 'false' ? false : propValue === '' || !!propValue;
1238
1402
  }
1239
- if (propType & 2 /* Number */) {
1403
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
1240
1404
  // force it to be a number
1241
1405
  return parseFloat(propValue);
1242
1406
  }
1243
- if (propType & 1 /* String */) {
1407
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
1244
1408
  // could have been passed as a number or boolean
1245
1409
  // but we still want it as a string
1246
1410
  return String(propValue);
@@ -1264,13 +1428,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1264
1428
  // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1265
1429
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1266
1430
  const didValueChange = newVal !== oldVal && !areBothNaN;
1267
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1431
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1268
1432
  // gadzooks! the property's value has changed!!
1269
1433
  // set our new value!
1270
1434
  hostRef.$instanceValues$.set(propName, newVal);
1271
1435
  if (instance) {
1272
1436
  // get an array of method names of watch functions to call
1273
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1437
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1274
1438
  const watchMethods = cmpMeta.$watchers$[propName];
1275
1439
  if (watchMethods) {
1276
1440
  // this instance is watching for when this property changed
@@ -1285,7 +1449,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1285
1449
  });
1286
1450
  }
1287
1451
  }
1288
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1452
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1289
1453
  // looks like this value actually changed, so we've got work to do!
1290
1454
  // but only if we've already rendered, otherwise just chill out
1291
1455
  // queue that we need to do an update, but don't worry about queuing
@@ -1304,8 +1468,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1304
1468
  const members = Object.entries(cmpMeta.$members$);
1305
1469
  const prototype = Cstr.prototype;
1306
1470
  members.map(([memberName, [memberFlags]]) => {
1307
- if ((memberFlags & 31 /* Prop */ ||
1308
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1471
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1472
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1309
1473
  // proxyComponent - prop
1310
1474
  Object.defineProperty(prototype, memberName, {
1311
1475
  get() {
@@ -1320,8 +1484,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1320
1484
  enumerable: true,
1321
1485
  });
1322
1486
  }
1323
- else if (flags & 1 /* isElementConstructor */ &&
1324
- memberFlags & 64 /* Method */) {
1487
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1488
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1325
1489
  // proxyComponent - method
1326
1490
  Object.defineProperty(prototype, memberName, {
1327
1491
  value(...args) {
@@ -1331,7 +1495,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1331
1495
  });
1332
1496
  }
1333
1497
  });
1334
- if ((flags & 1 /* isElementConstructor */)) {
1498
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1335
1499
  const attrNameToPropName = new Map();
1336
1500
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1337
1501
  plt.jmp(() => {
@@ -1387,11 +1551,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1387
1551
  // create an array of attributes to observe
1388
1552
  // and also create a map of html attribute name to js property name
1389
1553
  Cstr.observedAttributes = members
1390
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1554
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1391
1555
  .map(([propName, m]) => {
1392
1556
  const attrName = m[1] || propName;
1393
1557
  attrNameToPropName.set(attrName, propName);
1394
- if (m[0] & 512 /* ReflectAttr */) {
1558
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1395
1559
  cmpMeta.$attrsToReflect$.push([propName, attrName]);
1396
1560
  }
1397
1561
  return attrName;
@@ -1402,10 +1566,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1402
1566
  };
1403
1567
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1404
1568
  // initializeComponent
1405
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1569
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1406
1570
  {
1407
1571
  // we haven't initialized this element yet
1408
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1572
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1409
1573
  // lazy loaded components
1410
1574
  // request the component's implementation to be
1411
1575
  // wired up with the host element
@@ -1423,7 +1587,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1423
1587
  {
1424
1588
  cmpMeta.$watchers$ = Cstr.watchers;
1425
1589
  }
1426
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1590
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1427
1591
  Cstr.isProxied = true;
1428
1592
  }
1429
1593
  const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
@@ -1431,7 +1595,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1431
1595
  // but let's keep track of when we start and stop
1432
1596
  // so that the getters/setters don't incorrectly step on data
1433
1597
  {
1434
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1598
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1435
1599
  }
1436
1600
  // construct the lazy-loaded component implementation
1437
1601
  // passing the hostRef is very important during
@@ -1444,10 +1608,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1444
1608
  consoleError(e);
1445
1609
  }
1446
1610
  {
1447
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1611
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1448
1612
  }
1449
1613
  {
1450
- hostRef.$flags$ |= 128 /* isWatchReady */;
1614
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1451
1615
  }
1452
1616
  endNewInstance();
1453
1617
  }
@@ -1457,7 +1621,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1457
1621
  const scopeId = getScopeId(cmpMeta);
1458
1622
  if (!styles.has(scopeId)) {
1459
1623
  const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1460
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1624
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1461
1625
  endRegisterStyles();
1462
1626
  }
1463
1627
  }
@@ -1479,19 +1643,19 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1479
1643
  }
1480
1644
  };
1481
1645
  const connectedCallback = (elm) => {
1482
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1646
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1483
1647
  const hostRef = getHostRef(elm);
1484
1648
  const cmpMeta = hostRef.$cmpMeta$;
1485
1649
  const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1486
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1650
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1487
1651
  // first time this component has connected
1488
- hostRef.$flags$ |= 1 /* hasConnected */;
1652
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1489
1653
  {
1490
1654
  // initUpdate
1491
1655
  // if the slot polyfill is required we'll need to put some nodes
1492
1656
  // in here to act as original content anchors as we move nodes around
1493
1657
  // host element has been connected to the DOM
1494
- if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1658
+ if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
1495
1659
  setContentReference(elm);
1496
1660
  }
1497
1661
  }
@@ -1514,7 +1678,7 @@ const connectedCallback = (elm) => {
1514
1678
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1515
1679
  if (cmpMeta.$members$) {
1516
1680
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1517
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1681
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1518
1682
  const value = elm[memberName];
1519
1683
  delete elm[memberName];
1520
1684
  elm[memberName] = value;
@@ -1546,7 +1710,7 @@ const setContentReference = (elm) => {
1546
1710
  elm.insertBefore(contentRefElm, elm.firstChild);
1547
1711
  };
1548
1712
  const disconnectedCallback = (elm) => {
1549
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1713
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1550
1714
  const hostRef = getHostRef(elm);
1551
1715
  {
1552
1716
  if (hostRef.$rmListeners$) {
@@ -1556,46 +1720,6 @@ const disconnectedCallback = (elm) => {
1556
1720
  }
1557
1721
  }
1558
1722
  };
1559
- const patchCloneNode = (HostElementPrototype) => {
1560
- const orgCloneNode = HostElementPrototype.cloneNode;
1561
- HostElementPrototype.cloneNode = function (deep) {
1562
- const srcNode = this;
1563
- const isShadowDom = srcNode.shadowRoot && supportsShadow ;
1564
- const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
1565
- if (!isShadowDom && deep) {
1566
- let i = 0;
1567
- let slotted, nonStencilNode;
1568
- const stencilPrivates = [
1569
- 's-id',
1570
- 's-cr',
1571
- 's-lr',
1572
- 's-rc',
1573
- 's-sc',
1574
- 's-p',
1575
- 's-cn',
1576
- 's-sr',
1577
- 's-sn',
1578
- 's-hn',
1579
- 's-ol',
1580
- 's-nr',
1581
- 's-si',
1582
- ];
1583
- for (; i < srcNode.childNodes.length; i++) {
1584
- slotted = srcNode.childNodes[i]['s-nr'];
1585
- nonStencilNode = stencilPrivates.every((privateField) => !srcNode.childNodes[i][privateField]);
1586
- if (slotted) {
1587
- {
1588
- clonedNode.appendChild(slotted.cloneNode(true));
1589
- }
1590
- }
1591
- if (nonStencilNode) {
1592
- clonedNode.appendChild(srcNode.childNodes[i].cloneNode(true));
1593
- }
1594
- }
1595
- }
1596
- return clonedNode;
1597
- };
1598
- };
1599
1723
  const bootstrapLazy = (lazyBundles, options = {}) => {
1600
1724
  const endBootstrap = createTime();
1601
1725
  const cmpTags = [];
@@ -1637,7 +1761,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1637
1761
  super(self);
1638
1762
  self = this;
1639
1763
  registerHost(self, cmpMeta);
1640
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1764
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1641
1765
  // this component is using shadow dom
1642
1766
  // and this browser supports shadow dom
1643
1767
  // add the read-only property "shadowRoot" to the host element
@@ -1669,13 +1793,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1669
1793
  return getHostRef(this).$onReadyPromise$;
1670
1794
  }
1671
1795
  };
1672
- {
1673
- patchCloneNode(HostElement.prototype);
1674
- }
1675
1796
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1676
1797
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1677
1798
  cmpTags.push(tagName);
1678
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1799
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1679
1800
  }
1680
1801
  });
1681
1802
  });
@@ -1697,7 +1818,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1697
1818
  // Fallback appLoad event
1698
1819
  endBootstrap();
1699
1820
  };
1700
- const hostRefs = new WeakMap();
1821
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1701
1822
  const getHostRef = (ref) => hostRefs.get(ref);
1702
1823
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1703
1824
  const registerHost = (elm, cmpMeta) => {
@@ -1742,14 +1863,14 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1742
1863
  return importedModule[exportName];
1743
1864
  }, consoleError);
1744
1865
  };
1745
- const styles = new Map();
1866
+ const styles = /*@__PURE__*/ new Map();
1746
1867
  const queueDomReads = [];
1747
1868
  const queueDomWrites = [];
1748
1869
  const queueTask = (queue, write) => (cb) => {
1749
1870
  queue.push(cb);
1750
1871
  if (!queuePending) {
1751
1872
  queuePending = true;
1752
- if (write && plt.$flags$ & 4 /* queueSync */) {
1873
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1753
1874
  nextTick(flush);
1754
1875
  }
1755
1876
  else {
@@ -1786,7 +1907,6 @@ const flush = () => {
1786
1907
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1787
1908
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1788
1909
 
1789
- exports.H = H;
1790
1910
  exports.Host = Host;
1791
1911
  exports.bootstrapLazy = bootstrapLazy;
1792
1912
  exports.createEvent = createEvent;