q2-tecton-elements 1.18.0 → 1.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/dist/cjs/click-elsewhere.cjs.entry.js +1 -1
  2. package/dist/cjs/{icons-e2bc9ee9.js → icons-afbdf88a.js} +1 -1
  3. package/dist/cjs/{index-eccd5617.js → index-3518c78c.js} +1 -1
  4. package/dist/cjs/{index-0128397d.js → index-734296a7.js} +476 -271
  5. package/dist/cjs/loader.cjs.js +3 -3
  6. package/dist/cjs/q2-avatar.cjs.entry.js +9 -6
  7. package/dist/cjs/q2-badge_2.cjs.entry.js +46 -7
  8. package/dist/cjs/q2-btn_2.cjs.entry.js +30 -5
  9. package/dist/cjs/q2-calendar.cjs.entry.js +102 -63
  10. package/dist/cjs/q2-card.cjs.entry.js +17 -6
  11. package/dist/cjs/q2-carousel-pane.cjs.entry.js +7 -3
  12. package/dist/cjs/q2-carousel.cjs.entry.js +196 -285
  13. package/dist/cjs/q2-chart-donut.cjs.entry.js +583 -504
  14. package/dist/cjs/q2-checkbox-group.cjs.entry.js +9 -7
  15. package/dist/cjs/q2-checkbox.cjs.entry.js +17 -4
  16. package/dist/cjs/q2-dropdown-item.cjs.entry.js +9 -3
  17. package/dist/cjs/q2-dropdown.cjs.entry.js +16 -5
  18. package/dist/cjs/q2-editable-field.cjs.entry.js +16 -6
  19. package/dist/cjs/q2-icon.cjs.entry.js +6 -4
  20. package/dist/cjs/q2-loading-element.cjs.entry.js +6 -2
  21. package/dist/cjs/q2-loc.cjs.entry.js +5 -3
  22. package/dist/cjs/q2-message.cjs.entry.js +4 -3
  23. package/dist/cjs/q2-month-picker.cjs.entry.js +9 -7
  24. package/dist/cjs/q2-optgroup.cjs.entry.js +6 -5
  25. package/dist/cjs/q2-option-list_2.cjs.entry.js +21 -7
  26. package/dist/cjs/q2-option.cjs.entry.js +12 -2
  27. package/dist/cjs/q2-pagination.cjs.entry.js +11 -3
  28. package/dist/cjs/q2-pill.cjs.entry.js +25 -7
  29. package/dist/cjs/q2-radio-group.cjs.entry.js +13 -6
  30. package/dist/cjs/q2-radio.cjs.entry.js +13 -8
  31. package/dist/cjs/q2-section.cjs.entry.js +44 -11
  32. package/dist/cjs/q2-select.cjs.entry.js +26 -17
  33. package/dist/cjs/q2-stepper-pane.cjs.entry.js +8 -3
  34. package/dist/cjs/q2-stepper-vertical.cjs.entry.js +5 -4
  35. package/dist/cjs/q2-stepper.cjs.entry.js +9 -7
  36. package/dist/cjs/q2-tab-container.cjs.entry.js +14 -9
  37. package/dist/cjs/q2-tab-pane.cjs.entry.js +10 -2
  38. package/dist/cjs/q2-tag.cjs.entry.js +20 -7
  39. package/dist/cjs/q2-tecton-elements.cjs.js +3 -3
  40. package/dist/cjs/q2-textarea.cjs.entry.js +20 -4
  41. package/dist/cjs/q2-tooltip.cjs.entry.js +9 -3
  42. package/dist/cjs/{shapes-c1a60d46.js → shapes-aad2b98f.js} +1 -1
  43. package/dist/cjs/tecton-tab-pane.cjs.entry.js +17 -2
  44. package/dist/collection/collection-manifest.json +2 -2
  45. package/dist/collection/components/click-elsewhere/index.js +18 -17
  46. package/dist/collection/components/q2-avatar/index.js +100 -92
  47. package/dist/collection/components/q2-avatar/styles.css +1 -1
  48. package/dist/collection/components/q2-badge/index.js +119 -111
  49. package/dist/collection/components/q2-badge/styles.css +1 -1
  50. package/dist/collection/components/q2-btn/index.js +349 -322
  51. package/dist/collection/components/q2-btn/styles.css +7 -7
  52. package/dist/collection/components/q2-calendar/index.js +578 -552
  53. package/dist/collection/components/q2-calendar/q2-month-picker.css +1 -1
  54. package/dist/collection/components/q2-calendar/q2-month-picker.js +112 -116
  55. package/dist/collection/components/q2-calendar/styles.css +1 -1
  56. package/dist/collection/components/q2-card/index.js +262 -244
  57. package/dist/collection/components/q2-card/styles.css +9 -2
  58. package/dist/collection/components/q2-carousel/index.js +249 -253
  59. package/dist/collection/components/q2-carousel/styles.css +1 -1
  60. package/dist/collection/components/q2-carousel-pane/index.js +108 -96
  61. package/dist/collection/components/q2-carousel-pane/styles.css +5 -4
  62. package/dist/collection/components/q2-chart-donut/index.js +350 -334
  63. package/dist/collection/components/q2-chart-donut/styles.css +3 -3
  64. package/dist/collection/components/q2-checkbox/index.js +296 -287
  65. package/dist/collection/components/q2-checkbox/styles.css +2 -2
  66. package/dist/collection/components/q2-checkbox-group/index.js +156 -152
  67. package/dist/collection/components/q2-checkbox-group/styles.css +1 -1
  68. package/dist/collection/components/q2-dropdown/index.js +255 -240
  69. package/dist/collection/components/q2-dropdown/styles.css +1 -1
  70. package/dist/collection/components/q2-dropdown-item/index.js +134 -123
  71. package/dist/collection/components/q2-dropdown-item/styles.css +12 -10
  72. package/dist/collection/components/q2-editable-field/index.js +300 -293
  73. package/dist/collection/components/q2-editable-field/styles.css +1 -1
  74. package/dist/collection/components/q2-icon/icons.js +358 -2158
  75. package/dist/collection/components/q2-icon/index.js +59 -49
  76. package/dist/collection/components/q2-icon/styles.css +1 -1
  77. package/dist/collection/components/q2-input/index.js +729 -705
  78. package/dist/collection/components/q2-input/styles.css +2 -2
  79. package/dist/collection/components/q2-loading/index.js +143 -132
  80. package/dist/collection/components/q2-loading/skeleton/q2-loading-element/index.js +85 -74
  81. package/dist/collection/components/q2-loading/skeleton/shapes.js +23 -36
  82. package/dist/collection/components/q2-loading/styles.css +1 -1
  83. package/dist/collection/components/q2-loc/index.js +49 -39
  84. package/dist/collection/components/q2-loc/styles.css +1 -1
  85. package/dist/collection/components/q2-message/index.js +101 -92
  86. package/dist/collection/components/q2-message/styles.css +1 -1
  87. package/dist/collection/components/q2-optgroup/index.js +64 -56
  88. package/dist/collection/components/q2-optgroup/styles.css +1 -1
  89. package/dist/collection/components/q2-option/index.js +244 -229
  90. package/dist/collection/components/q2-option/styles.css +5 -1
  91. package/dist/collection/components/q2-option-list/index.js +291 -270
  92. package/dist/collection/components/q2-option-list/styles.css +1 -1
  93. package/dist/collection/components/q2-pagination/index.js +183 -179
  94. package/dist/collection/components/q2-pagination/styles.css +1 -1
  95. package/dist/collection/components/q2-pill/index.js +260 -208
  96. package/dist/collection/components/q2-pill/styles.css +1 -1
  97. package/dist/collection/components/q2-popover/index.js +169 -151
  98. package/dist/collection/components/q2-popover/styles.css +2 -2
  99. package/dist/collection/components/q2-radio/index.js +233 -224
  100. package/dist/collection/components/q2-radio/styles.css +3 -3
  101. package/dist/collection/components/q2-radio-group/index.js +252 -244
  102. package/dist/collection/components/q2-radio-group/styles.css +1 -1
  103. package/dist/collection/components/q2-section/index.js +169 -131
  104. package/dist/collection/components/q2-section/styles.css +8 -6
  105. package/dist/collection/components/q2-select/index.js +393 -381
  106. package/dist/collection/components/q2-select/styles.css +1 -1
  107. package/dist/collection/components/q2-stepper/index.js +124 -126
  108. package/dist/collection/components/q2-stepper/styles.css +2 -1
  109. package/dist/collection/components/q2-stepper-pane/index.js +165 -149
  110. package/dist/collection/components/q2-stepper-pane/styles.css +1 -1
  111. package/dist/collection/components/q2-stepper-vertical/index.js +86 -85
  112. package/dist/collection/components/q2-stepper-vertical/styles.css +1 -1
  113. package/dist/collection/components/q2-tab-container/index.js +189 -184
  114. package/dist/collection/components/q2-tab-container/styles.css +1 -1
  115. package/dist/collection/components/q2-tab-pane/index.js +185 -166
  116. package/dist/collection/components/q2-tab-pane/styles.css +1 -1
  117. package/dist/collection/components/q2-tag/index.js +168 -116
  118. package/dist/collection/components/q2-tag/styles.css +1 -1
  119. package/dist/collection/components/q2-textarea/index.js +344 -327
  120. package/dist/collection/components/q2-textarea/styles.css +2 -2
  121. package/dist/collection/components/q2-tooltip/index.js +147 -133
  122. package/dist/collection/components/q2-tooltip/styles.css +1 -1
  123. package/dist/collection/components/tecton-tab-pane/index.js +287 -266
  124. package/dist/collection/components/tecton-tab-pane/styles.css +1 -1
  125. package/dist/collection/utils/index.js +2 -6
  126. package/dist/esm/click-elsewhere.entry.js +1 -1
  127. package/dist/esm/{icons-ed54e307.js → icons-78da5dd2.js} +1 -1
  128. package/dist/esm/{index-eac6b89e.js → index-9c591682.js} +1 -1
  129. package/dist/esm/{index-6d5ed7cc.js → index-bb1c8c7f.js} +476 -271
  130. package/dist/esm/loader.js +3 -3
  131. package/dist/esm/polyfills/css-shim.js +1 -1
  132. package/dist/esm/q2-avatar.entry.js +9 -6
  133. package/dist/esm/q2-badge_2.entry.js +46 -7
  134. package/dist/esm/q2-btn_2.entry.js +30 -5
  135. package/dist/esm/q2-calendar.entry.js +102 -63
  136. package/dist/esm/q2-card.entry.js +17 -6
  137. package/dist/esm/q2-carousel-pane.entry.js +7 -3
  138. package/dist/esm/q2-carousel.entry.js +196 -285
  139. package/dist/esm/q2-chart-donut.entry.js +583 -504
  140. package/dist/esm/q2-checkbox-group.entry.js +9 -7
  141. package/dist/esm/q2-checkbox.entry.js +17 -4
  142. package/dist/esm/q2-dropdown-item.entry.js +9 -3
  143. package/dist/esm/q2-dropdown.entry.js +16 -5
  144. package/dist/esm/q2-editable-field.entry.js +16 -6
  145. package/dist/esm/q2-icon.entry.js +6 -4
  146. package/dist/esm/q2-loading-element.entry.js +6 -2
  147. package/dist/esm/q2-loc.entry.js +5 -3
  148. package/dist/esm/q2-message.entry.js +4 -3
  149. package/dist/esm/q2-month-picker.entry.js +9 -7
  150. package/dist/esm/q2-optgroup.entry.js +6 -5
  151. package/dist/esm/q2-option-list_2.entry.js +21 -7
  152. package/dist/esm/q2-option.entry.js +12 -2
  153. package/dist/esm/q2-pagination.entry.js +11 -3
  154. package/dist/esm/q2-pill.entry.js +25 -7
  155. package/dist/esm/q2-radio-group.entry.js +13 -6
  156. package/dist/esm/q2-radio.entry.js +13 -8
  157. package/dist/esm/q2-section.entry.js +44 -11
  158. package/dist/esm/q2-select.entry.js +26 -17
  159. package/dist/esm/q2-stepper-pane.entry.js +8 -3
  160. package/dist/esm/q2-stepper-vertical.entry.js +5 -4
  161. package/dist/esm/q2-stepper.entry.js +9 -7
  162. package/dist/esm/q2-tab-container.entry.js +14 -9
  163. package/dist/esm/q2-tab-pane.entry.js +10 -2
  164. package/dist/esm/q2-tag.entry.js +20 -7
  165. package/dist/esm/q2-tecton-elements.js +3 -3
  166. package/dist/esm/q2-textarea.entry.js +20 -4
  167. package/dist/esm/q2-tooltip.entry.js +9 -3
  168. package/dist/esm/{shapes-c32e3ba2.js → shapes-62b8a431.js} +1 -1
  169. package/dist/esm/tecton-tab-pane.entry.js +17 -2
  170. package/dist/loader/package.json +1 -0
  171. package/dist/q2-tecton-elements/p-0ba564b1.entry.js +1 -0
  172. package/dist/q2-tecton-elements/p-0fad9c5a.entry.js +1 -0
  173. package/dist/q2-tecton-elements/{p-73154834.js → p-13a639cf.js} +1 -1
  174. package/dist/q2-tecton-elements/p-16c11d74.entry.js +1 -0
  175. package/dist/q2-tecton-elements/p-17e0cbf1.entry.js +1 -0
  176. package/dist/q2-tecton-elements/p-2c9b1308.entry.js +1 -0
  177. package/dist/q2-tecton-elements/p-2e832e42.entry.js +1 -0
  178. package/dist/q2-tecton-elements/p-315fdb74.entry.js +1 -0
  179. package/dist/q2-tecton-elements/{p-c608e3c9.entry.js → p-444415b5.entry.js} +1 -1
  180. package/dist/q2-tecton-elements/p-4d700630.entry.js +1 -0
  181. package/dist/q2-tecton-elements/p-54e792bd.entry.js +1 -0
  182. package/dist/q2-tecton-elements/{p-80014da0.js → p-5e374fbd.js} +1 -1
  183. package/dist/q2-tecton-elements/p-5f064e1e.entry.js +39 -0
  184. package/dist/q2-tecton-elements/p-692f2d09.entry.js +1 -0
  185. package/dist/q2-tecton-elements/p-6e6b5b80.entry.js +1 -0
  186. package/dist/q2-tecton-elements/p-74136b15.entry.js +1 -0
  187. package/dist/q2-tecton-elements/p-7e8f43d1.entry.js +1 -0
  188. package/dist/q2-tecton-elements/p-8e380edf.entry.js +1 -0
  189. package/dist/q2-tecton-elements/p-926a3e80.js +2 -0
  190. package/dist/q2-tecton-elements/{p-93c00587.js → p-92e1faf8.js} +1 -1
  191. package/dist/q2-tecton-elements/p-9772b15f.entry.js +1 -0
  192. package/dist/q2-tecton-elements/p-97aa8423.entry.js +1 -0
  193. package/dist/q2-tecton-elements/{p-17cffd7d.entry.js → p-a987402e.entry.js} +1 -1
  194. package/dist/q2-tecton-elements/p-aaf42539.entry.js +1 -0
  195. package/dist/q2-tecton-elements/p-ac674c20.entry.js +1 -0
  196. package/dist/q2-tecton-elements/p-b8b00394.entry.js +1 -0
  197. package/dist/q2-tecton-elements/p-c444a60b.entry.js +1 -0
  198. package/dist/q2-tecton-elements/p-c6c489fe.entry.js +1 -0
  199. package/dist/q2-tecton-elements/p-ce015552.entry.js +1 -0
  200. package/dist/q2-tecton-elements/p-d464fccc.entry.js +1 -0
  201. package/dist/q2-tecton-elements/p-de164483.entry.js +1 -0
  202. package/dist/q2-tecton-elements/p-df91e954.entry.js +1 -0
  203. package/dist/q2-tecton-elements/p-e6d26f39.entry.js +1 -0
  204. package/dist/q2-tecton-elements/p-e8e113c2.entry.js +1 -0
  205. package/dist/q2-tecton-elements/p-f1d06917.entry.js +1 -0
  206. package/dist/q2-tecton-elements/p-f219fe9d.entry.js +1 -0
  207. package/dist/q2-tecton-elements/p-f800fd1e.entry.js +1 -0
  208. package/dist/q2-tecton-elements/p-fb37e67e.entry.js +1 -0
  209. package/dist/q2-tecton-elements/p-fc134a5d.entry.js +1 -0
  210. package/dist/q2-tecton-elements/p-fe88e979.entry.js +1 -0
  211. package/dist/q2-tecton-elements/p-ffb48ccc.entry.js +1 -0
  212. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
  213. package/dist/test/helpers.js +6 -0
  214. package/dist/types/components/q2-pill/index.d.ts +3 -0
  215. package/dist/types/components/q2-section/index.d.ts +3 -0
  216. package/dist/types/components/q2-tag/index.d.ts +3 -0
  217. package/dist/types/components.d.ts +154 -38
  218. package/dist/types/stencil-public-runtime.d.ts +20 -4
  219. package/dist/types/workspace/workspace/{Tecton_tecton-production_master → tecton-production_release_1.19.x}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +2 -0
  220. package/package.json +6 -6
  221. package/dist/q2-tecton-elements/p-02c1b7fd.entry.js +0 -1
  222. package/dist/q2-tecton-elements/p-04c743f2.entry.js +0 -1
  223. package/dist/q2-tecton-elements/p-07dc509c.entry.js +0 -1
  224. package/dist/q2-tecton-elements/p-12caa479.entry.js +0 -1
  225. package/dist/q2-tecton-elements/p-160dd1c2.entry.js +0 -1
  226. package/dist/q2-tecton-elements/p-1a3de749.entry.js +0 -1
  227. package/dist/q2-tecton-elements/p-2061c3fd.entry.js +0 -1
  228. package/dist/q2-tecton-elements/p-2a217895.entry.js +0 -1
  229. package/dist/q2-tecton-elements/p-2b94ae62.entry.js +0 -1
  230. package/dist/q2-tecton-elements/p-2e54f9a0.entry.js +0 -1
  231. package/dist/q2-tecton-elements/p-375569ff.entry.js +0 -1
  232. package/dist/q2-tecton-elements/p-3766cc6c.entry.js +0 -1
  233. package/dist/q2-tecton-elements/p-3eda2714.entry.js +0 -1
  234. package/dist/q2-tecton-elements/p-421af42d.entry.js +0 -1
  235. package/dist/q2-tecton-elements/p-4c53713d.entry.js +0 -1
  236. package/dist/q2-tecton-elements/p-4fd405f5.entry.js +0 -1
  237. package/dist/q2-tecton-elements/p-509c8924.entry.js +0 -1
  238. package/dist/q2-tecton-elements/p-55dc3dc1.entry.js +0 -1
  239. package/dist/q2-tecton-elements/p-5fffb28a.entry.js +0 -1
  240. package/dist/q2-tecton-elements/p-612e9974.entry.js +0 -1
  241. package/dist/q2-tecton-elements/p-64ca8c59.entry.js +0 -1
  242. package/dist/q2-tecton-elements/p-796c2bb5.entry.js +0 -1
  243. package/dist/q2-tecton-elements/p-86887866.entry.js +0 -1
  244. package/dist/q2-tecton-elements/p-9204c34d.entry.js +0 -1
  245. package/dist/q2-tecton-elements/p-9725d55f.entry.js +0 -1
  246. package/dist/q2-tecton-elements/p-a0fa416d.entry.js +0 -39
  247. package/dist/q2-tecton-elements/p-bd83e8e2.entry.js +0 -1
  248. package/dist/q2-tecton-elements/p-be0f2539.entry.js +0 -1
  249. package/dist/q2-tecton-elements/p-c05b0b55.entry.js +0 -1
  250. package/dist/q2-tecton-elements/p-c5691700.js +0 -1
  251. package/dist/q2-tecton-elements/p-d826d7ad.entry.js +0 -1
  252. package/dist/q2-tecton-elements/p-d9e9340c.entry.js +0 -1
  253. package/dist/q2-tecton-elements/p-e5757895.entry.js +0 -1
  254. package/dist/q2-tecton-elements/p-e68c9ef0.entry.js +0 -1
  255. package/dist/q2-tecton-elements/p-eb33bda4.entry.js +0 -1
  256. package/dist/q2-tecton-elements/p-f319549d.entry.js +0 -1
@@ -22,6 +22,14 @@ function _interopNamespace(e) {
22
22
 
23
23
  const NAMESPACE = 'q2-tecton-elements';
24
24
 
25
+ /**
26
+ * Virtual DOM patching algorithm based on Snabbdom by
27
+ * Simon Friis Vindum (@paldepind)
28
+ * Licensed under the MIT License
29
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
30
+ *
31
+ * Modified for Stencil's renderer and slot projection
32
+ */
25
33
  let scopeId;
26
34
  let contentRef;
27
35
  let hostTagName;
@@ -30,63 +38,6 @@ let checkSlotFallbackVisibility = false;
30
38
  let checkSlotRelocate = false;
31
39
  let isSvgMode = false;
32
40
  let queuePending = false;
33
- const win = typeof window !== 'undefined' ? window : {};
34
- const doc = win.document || { head: {} };
35
- const plt = {
36
- $flags$: 0,
37
- $resourcesUrl$: '',
38
- jmp: (h) => h(),
39
- raf: (h) => requestAnimationFrame(h),
40
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
41
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
42
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
43
- };
44
- const promiseResolve = (v) => Promise.resolve(v);
45
- const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
46
- try {
47
- new CSSStyleSheet();
48
- return typeof new CSSStyleSheet().replace === 'function';
49
- }
50
- catch (e) { }
51
- return false;
52
- })()
53
- ;
54
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
55
- if (listeners) {
56
- listeners.map(([flags, name, method]) => {
57
- const target = getHostListenerTarget(elm, flags) ;
58
- const handler = hostListenerProxy(hostRef, method);
59
- const opts = hostListenerOpts(flags);
60
- plt.ael(target, name, handler, opts);
61
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
62
- });
63
- }
64
- };
65
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
66
- try {
67
- {
68
- if (hostRef.$flags$ & 256 /* isListenReady */) {
69
- // instance is ready, let's call it's member method for this event
70
- hostRef.$lazyInstance$[methodName](ev);
71
- }
72
- else {
73
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
74
- }
75
- }
76
- }
77
- catch (e) {
78
- consoleError(e);
79
- }
80
- };
81
- const getHostListenerTarget = (elm, flags) => {
82
- if (flags & 8 /* TargetWindow */)
83
- return win;
84
- return elm;
85
- };
86
- // prettier-ignore
87
- const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
88
- const HYDRATED_CSS = '{visibility:hidden}[stencil-hydrated]{visibility:inherit}';
89
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
90
41
  const createTime = (fnName, tagName = '') => {
91
42
  {
92
43
  return () => {
@@ -101,71 +52,8 @@ const uniqueTime = (key, measureText) => {
101
52
  };
102
53
  }
103
54
  };
104
- const rootAppliedStyles = new WeakMap();
105
- const registerStyle = (scopeId, cssText, allowCS) => {
106
- let style = styles.get(scopeId);
107
- if (supportsConstructibleStylesheets && allowCS) {
108
- style = (style || new CSSStyleSheet());
109
- style.replace(cssText);
110
- }
111
- else {
112
- style = cssText;
113
- }
114
- styles.set(scopeId, style);
115
- };
116
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
117
- let scopeId = getScopeId(cmpMeta);
118
- let style = styles.get(scopeId);
119
- // if an element is NOT connected then getRootNode() will return the wrong root node
120
- // so the fallback is to always use the document for the root node in those cases
121
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
122
- if (style) {
123
- if (typeof style === 'string') {
124
- styleContainerNode = styleContainerNode.head || styleContainerNode;
125
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
126
- let styleElm;
127
- if (!appliedStyles) {
128
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
129
- }
130
- if (!appliedStyles.has(scopeId)) {
131
- {
132
- {
133
- styleElm = doc.createElement('style');
134
- styleElm.innerHTML = style;
135
- }
136
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
137
- }
138
- if (appliedStyles) {
139
- appliedStyles.add(scopeId);
140
- }
141
- }
142
- }
143
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
144
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
145
- }
146
- }
147
- return scopeId;
148
- };
149
- const attachStyles = (hostRef) => {
150
- const cmpMeta = hostRef.$cmpMeta$;
151
- const elm = hostRef.$hostElement$;
152
- const flags = cmpMeta.$flags$;
153
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
154
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
155
- if (flags & 10 /* needsScopedEncapsulation */) {
156
- // only required when we're NOT using native shadow dom (slot)
157
- // or this browser doesn't support native shadow dom
158
- // and this host element was NOT created with SSR
159
- // let's pick out the inner content for slot projection
160
- // create a node to represent where the original
161
- // content was first placed, which is useful later on
162
- // DOM WRITE!!
163
- elm['s-sc'] = scopeId;
164
- elm.classList.add(scopeId + '-h');
165
- }
166
- endAttachStyles();
167
- };
168
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
55
+ const HYDRATED_CSS = '{visibility:hidden}[stencil-hydrated]{visibility:inherit}';
56
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
169
57
  /**
170
58
  * Default style mode id
171
59
  */
@@ -202,7 +90,7 @@ const h = (nodeName, vnodeData, ...children) => {
202
90
  let slotName = null;
203
91
  let simple = false;
204
92
  let lastSimple = false;
205
- let vNodeChildren = [];
93
+ const vNodeChildren = [];
206
94
  const walk = (c) => {
207
95
  for (let i = 0; i < c.length; i++) {
208
96
  child = c[i];
@@ -314,6 +202,149 @@ const convertToPrivate = (node) => {
314
202
  vnode.$name$ = node.vname;
315
203
  return vnode;
316
204
  };
205
+ /**
206
+ * Parse a new property value for a given property type.
207
+ *
208
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
209
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
210
+ * 1. `any`, the type given to `propValue` in the function signature
211
+ * 2. the type stored from `propType`.
212
+ *
213
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
214
+ *
215
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
216
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
217
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
218
+ * ```tsx
219
+ * <my-cmp prop-val={0}></my-cmp>
220
+ * ```
221
+ *
222
+ * HTML prop values on the other hand, will always a string
223
+ *
224
+ * @param propValue the new value to coerce to some type
225
+ * @param propType the type of the prop, expressed as a binary number
226
+ * @returns the parsed/coerced value
227
+ */
228
+ const parsePropertyValue = (propValue, propType) => {
229
+ // ensure this value is of the correct prop type
230
+ if (propValue != null && !isComplexType(propValue)) {
231
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
232
+ // per the HTML spec, any string value means it is a boolean true value
233
+ // but we'll cheat here and say that the string "false" is the boolean false
234
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
235
+ }
236
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
237
+ // force it to be a number
238
+ return parseFloat(propValue);
239
+ }
240
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
241
+ // could have been passed as a number or boolean
242
+ // but we still want it as a string
243
+ return String(propValue);
244
+ }
245
+ // redundant return here for better minification
246
+ return propValue;
247
+ }
248
+ // not sure exactly what type we want
249
+ // so no need to change to a different type
250
+ return propValue;
251
+ };
252
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
253
+ const createEvent = (ref, name, flags) => {
254
+ const elm = getElement(ref);
255
+ return {
256
+ emit: (detail) => {
257
+ return emitEvent(elm, name, {
258
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
259
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
260
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
261
+ detail,
262
+ });
263
+ },
264
+ };
265
+ };
266
+ /**
267
+ * Helper function to create & dispatch a custom Event on a provided target
268
+ * @param elm the target of the Event
269
+ * @param name the name to give the custom Event
270
+ * @param opts options for configuring a custom Event
271
+ * @returns the custom Event
272
+ */
273
+ const emitEvent = (elm, name, opts) => {
274
+ const ev = plt.ce(name, opts);
275
+ elm.dispatchEvent(ev);
276
+ return ev;
277
+ };
278
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
279
+ const registerStyle = (scopeId, cssText, allowCS) => {
280
+ let style = styles.get(scopeId);
281
+ if (supportsConstructableStylesheets && allowCS) {
282
+ style = (style || new CSSStyleSheet());
283
+ if (typeof style === 'string') {
284
+ style = cssText;
285
+ }
286
+ else {
287
+ style.replaceSync(cssText);
288
+ }
289
+ }
290
+ else {
291
+ style = cssText;
292
+ }
293
+ styles.set(scopeId, style);
294
+ };
295
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
296
+ let scopeId = getScopeId(cmpMeta);
297
+ const style = styles.get(scopeId);
298
+ // if an element is NOT connected then getRootNode() will return the wrong root node
299
+ // so the fallback is to always use the document for the root node in those cases
300
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
301
+ if (style) {
302
+ if (typeof style === 'string') {
303
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
304
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
305
+ let styleElm;
306
+ if (!appliedStyles) {
307
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
308
+ }
309
+ if (!appliedStyles.has(scopeId)) {
310
+ {
311
+ {
312
+ styleElm = doc.createElement('style');
313
+ styleElm.innerHTML = style;
314
+ }
315
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
316
+ }
317
+ if (appliedStyles) {
318
+ appliedStyles.add(scopeId);
319
+ }
320
+ }
321
+ }
322
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
323
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
324
+ }
325
+ }
326
+ return scopeId;
327
+ };
328
+ const attachStyles = (hostRef) => {
329
+ const cmpMeta = hostRef.$cmpMeta$;
330
+ const elm = hostRef.$hostElement$;
331
+ const flags = cmpMeta.$flags$;
332
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
333
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
334
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
335
+ // only required when we're NOT using native shadow dom (slot)
336
+ // or this browser doesn't support native shadow dom
337
+ // and this host element was NOT created with SSR
338
+ // let's pick out the inner content for slot projection
339
+ // create a node to represent where the original
340
+ // content was first placed, which is useful later on
341
+ // DOM WRITE!!
342
+ elm['s-sc'] = scopeId;
343
+ elm.classList.add(scopeId + '-h');
344
+ }
345
+ endAttachStyles();
346
+ };
347
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
317
348
  /**
318
349
  * Production setAccessor() function based on Preact by
319
350
  * Jason Miller (@developit)
@@ -411,7 +442,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
411
442
  if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
412
443
  try {
413
444
  if (!elm.tagName.includes('-')) {
414
- let n = newValue == null ? '' : newValue;
445
+ const n = newValue == null ? '' : newValue;
415
446
  // Workaround for Safari, moving the <input> caret when re-assigning the same valued
416
447
  if (memberName === 'list') {
417
448
  isProp = false;
@@ -450,7 +481,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
450
481
  }
451
482
  }
452
483
  }
453
- else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
484
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
454
485
  newValue = newValue === true ? '' : newValue;
455
486
  if (xlink) {
456
487
  elm.setAttributeNS(XLINK_NS, memberName, newValue);
@@ -468,7 +499,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
468
499
  // if the element passed in is a shadow root, which is a document fragment
469
500
  // then we want to be adding attrs/props to the shadow root's "host" element
470
501
  // if it's not a shadow root, then we add attrs/props to the same element
471
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
502
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
472
503
  ? newVnode.$elm$.host
473
504
  : newVnode.$elm$;
474
505
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
@@ -486,9 +517,19 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
486
517
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
487
518
  }
488
519
  };
520
+ /**
521
+ * Create a DOM Node corresponding to one of the children of a given VNode.
522
+ *
523
+ * @param oldParentVNode the parent VNode from the previous render
524
+ * @param newParentVNode the parent VNode from the current render
525
+ * @param childIndex the index of the VNode, in the _new_ parent node's
526
+ * children, for which we will create a new DOM node
527
+ * @param parentElm the parent DOM node which our new node will be a child of
528
+ * @returns the newly created node
529
+ */
489
530
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
490
531
  // tslint:disable-next-line: prefer-const
491
- let newVNode = newParentVNode.$children$[childIndex];
532
+ const newVNode = newParentVNode.$children$[childIndex];
492
533
  let i = 0;
493
534
  let elm;
494
535
  let childNode;
@@ -503,16 +544,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
503
544
  }
504
545
  newVNode.$flags$ |= newVNode.$children$
505
546
  ? // slot element has fallback content
506
- 2 /* isSlotFallback */
547
+ 2 /* VNODE_FLAGS.isSlotFallback */
507
548
  : // slot element does not have fallback content
508
- 1 /* isSlotReference */;
549
+ 1 /* VNODE_FLAGS.isSlotReference */;
509
550
  }
510
551
  }
511
552
  if (newVNode.$text$ !== null) {
512
553
  // create text node
513
554
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
514
555
  }
515
- else if (newVNode.$flags$ & 1 /* isSlotReference */) {
556
+ else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
516
557
  // create a slot reference node
517
558
  elm = newVNode.$elm$ =
518
559
  doc.createTextNode('');
@@ -522,7 +563,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
522
563
  isSvgMode = newVNode.$tag$ === 'svg';
523
564
  }
524
565
  // create element
525
- elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
566
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
526
567
  ? 'slot-fb'
527
568
  : newVNode.$tag$)
528
569
  );
@@ -562,7 +603,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
562
603
  }
563
604
  {
564
605
  elm['s-hn'] = hostTagName;
565
- if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
606
+ if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
566
607
  // remember the content reference comment
567
608
  elm['s-sr'] = true;
568
609
  // remember the content reference comment
@@ -581,7 +622,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
581
622
  return elm;
582
623
  };
583
624
  const putBackInOriginalLocation = (parentElm, recursive) => {
584
- plt.$flags$ |= 1 /* isTmpDisconnected */;
625
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
585
626
  const oldSlotChildNodes = parentElm.childNodes;
586
627
  for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
587
628
  const childNode = oldSlotChildNodes[i];
@@ -602,7 +643,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
602
643
  putBackInOriginalLocation(childNode, recursive);
603
644
  }
604
645
  }
605
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
646
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
606
647
  };
607
648
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
608
649
  let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
@@ -644,6 +685,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
644
685
  }
645
686
  }
646
687
  };
688
+ /**
689
+ * Reconcile the children of a new VNode with the children of an old VNode by
690
+ * traversing the two collections of children, identifying nodes that are
691
+ * conserved or changed, calling out to `patch` to make any necessary
692
+ * updates to the DOM, and rearranging DOM nodes as needed.
693
+ *
694
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
695
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
696
+ * 'windows' by storing start and end indices and references to the
697
+ * corresponding array entries. Initially the two 'windows' are basically equal
698
+ * to the entire array, but we progressively narrow the windows until there are
699
+ * no children left to update by doing the following:
700
+ *
701
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
702
+ * that if we have an initial array like the following we'll end up dealing
703
+ * only with a window bounded by the highlighted elements:
704
+ *
705
+ * [null, null, VNode1 , ... , VNode2, null, null]
706
+ * ^^^^^^ ^^^^^^
707
+ *
708
+ * 2. Check to see if the elements at the head and tail positions are equal
709
+ * across the windows. This will basically detect elements which haven't
710
+ * been added, removed, or changed position, i.e. if you had the following
711
+ * VNode elements (represented as HTML):
712
+ *
713
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
714
+ * newVNode: `<div><p><span>THERE</span></p></div>`
715
+ *
716
+ * Then when comparing the children of the `<div>` tag we check the equality
717
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
718
+ * same tag in the same position, we'd be able to avoid completely
719
+ * re-rendering the subtree under them with a new DOM element and would just
720
+ * call out to `patch` to handle reconciling their children and so on.
721
+ *
722
+ * 3. Check, for both windows, to see if the element at the beginning of the
723
+ * window corresponds to the element at the end of the other window. This is
724
+ * a heuristic which will let us identify _some_ situations in which
725
+ * elements have changed position, for instance it _should_ detect that the
726
+ * children nodes themselves have not changed but merely moved in the
727
+ * following example:
728
+ *
729
+ * oldVNode: `<div><element-one /><element-two /></div>`
730
+ * newVNode: `<div><element-two /><element-one /></div>`
731
+ *
732
+ * If we find cases like this then we also need to move the concrete DOM
733
+ * elements corresponding to the moved children to write the re-order to the
734
+ * DOM.
735
+ *
736
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
737
+ * nodes in the old children which have the same key as the first element in
738
+ * our window on the new children. If we find such a node we handle calling
739
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
740
+ * what we find.
741
+ *
742
+ * Finally, once we've narrowed our 'windows' to the point that either of them
743
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
744
+ * insertion or deletion that needs to happen to get a DOM state that correctly
745
+ * reflects the new child VNodes. If, for instance, after our window on the old
746
+ * children has collapsed we still have more nodes on the new children that
747
+ * we haven't dealt with yet then we need to add them, or if the new children
748
+ * collapse but we still have unhandled _old_ children then we need to make
749
+ * sure the corresponding DOM nodes are removed.
750
+ *
751
+ * @param parentElm the node into which the parent VNode is rendered
752
+ * @param oldCh the old children of the parent node
753
+ * @param newVNode the new VNode which will replace the parent
754
+ * @param newCh the new children of the parent node
755
+ */
647
756
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
648
757
  let oldStartIdx = 0;
649
758
  let newStartIdx = 0;
@@ -659,7 +768,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
659
768
  let elmToMove;
660
769
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
661
770
  if (oldStartVnode == null) {
662
- // Vnode might have been moved left
771
+ // VNode might have been moved left
663
772
  oldStartVnode = oldCh[++oldStartIdx];
664
773
  }
665
774
  else if (oldEndVnode == null) {
@@ -672,37 +781,100 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
672
781
  newEndVnode = newCh[--newEndIdx];
673
782
  }
674
783
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
784
+ // if the start nodes are the same then we should patch the new VNode
785
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
786
+ // indices to reflect that. We don't need to move any DOM Nodes around
787
+ // since things are matched up in order.
675
788
  patch(oldStartVnode, newStartVnode);
676
789
  oldStartVnode = oldCh[++oldStartIdx];
677
790
  newStartVnode = newCh[++newStartIdx];
678
791
  }
679
792
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
793
+ // likewise, if the end nodes are the same we patch new onto old and
794
+ // decrement our end indices, and also likewise in this case we don't
795
+ // need to move any DOM Nodes.
680
796
  patch(oldEndVnode, newEndVnode);
681
797
  oldEndVnode = oldCh[--oldEndIdx];
682
798
  newEndVnode = newCh[--newEndIdx];
683
799
  }
684
800
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
685
- // Vnode moved right
801
+ // case: "Vnode moved right"
802
+ //
803
+ // We've found that the last node in our window on the new children is
804
+ // the same VNode as the _first_ node in our window on the old children
805
+ // we're dealing with now. Visually, this is the layout of these two
806
+ // nodes:
807
+ //
808
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
809
+ // ^^^^^^^^^^^
810
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
811
+ // ^^^^^^^^^^^^^
812
+ //
813
+ // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
814
+ // and move the DOM element for `oldStartVnode`.
686
815
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
687
816
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
688
817
  }
689
818
  patch(oldStartVnode, newEndVnode);
819
+ // We need to move the element for `oldStartVnode` into a position which
820
+ // will be appropriate for `newEndVnode`. For this we can use
821
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
822
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
823
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
824
+ //
825
+ // <old-start-node />
826
+ // <some-intervening-node />
827
+ // <old-end-node />
828
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
829
+ // <next-sibling />
830
+ //
831
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
832
+ // the node for `oldStartVnode` at the end of the children of
833
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
834
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
835
+ // append it to the children of the parent element.
690
836
  parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
691
837
  oldStartVnode = oldCh[++oldStartIdx];
692
838
  newEndVnode = newCh[--newEndIdx];
693
839
  }
694
840
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
695
- // Vnode moved left
841
+ // case: "Vnode moved left"
842
+ //
843
+ // We've found that the first node in our window on the new children is
844
+ // the same VNode as the _last_ node in our window on the old children.
845
+ // Visually, this is the layout of these two nodes:
846
+ //
847
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
848
+ // ^^^^^^^^^^^^^
849
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
850
+ // ^^^^^^^^^^^
851
+ //
852
+ // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
853
+ // (which will handle updating any changed attributes, reconciling their
854
+ // children etc) but we also need to move the DOM node to which
855
+ // `oldEndVnode` corresponds.
696
856
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
697
857
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
698
858
  }
699
859
  patch(oldEndVnode, newStartVnode);
860
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
861
+ // the same node, so since we're here we know that they are not. Thus we
862
+ // can move the element for `oldEndVnode` _before_ the element for
863
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
864
+ // future.
700
865
  parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
701
866
  oldEndVnode = oldCh[--oldEndIdx];
702
867
  newStartVnode = newCh[++newStartIdx];
703
868
  }
704
869
  else {
705
- // createKeyToOldIdx
870
+ // Here we do some checks to match up old and new nodes based on the
871
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
872
+ // in the JSX for a DOM element in the implementation of a Stencil
873
+ // component.
874
+ //
875
+ // First we check to see if there are any nodes in the array of old
876
+ // children which have the same key as the first node in the new
877
+ // children.
706
878
  idxInOld = -1;
707
879
  {
708
880
  for (i = oldStartIdx; i <= oldEndIdx; ++i) {
@@ -713,23 +885,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
713
885
  }
714
886
  }
715
887
  if (idxInOld >= 0) {
888
+ // We found a node in the old children which matches up with the first
889
+ // node in the new children! So let's deal with that
716
890
  elmToMove = oldCh[idxInOld];
717
891
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
892
+ // the tag doesn't match so we'll need a new DOM element
718
893
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
719
894
  }
720
895
  else {
721
896
  patch(elmToMove, newStartVnode);
897
+ // invalidate the matching old node so that we won't try to update it
898
+ // again later on
722
899
  oldCh[idxInOld] = undefined;
723
900
  node = elmToMove.$elm$;
724
901
  }
725
902
  newStartVnode = newCh[++newStartIdx];
726
903
  }
727
904
  else {
728
- // new element
905
+ // We either didn't find an element in the old children that matches
906
+ // the key of the first new child OR the build is not using `key`
907
+ // attributes at all. In either case we need to create a new element
908
+ // for the new node.
729
909
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
730
910
  newStartVnode = newCh[++newStartIdx];
731
911
  }
732
912
  if (node) {
913
+ // if we created a new node then handle inserting it to the DOM
733
914
  {
734
915
  parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
735
916
  }
@@ -737,21 +918,43 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
737
918
  }
738
919
  }
739
920
  if (oldStartIdx > oldEndIdx) {
921
+ // we have some more new nodes to add which don't match up with old nodes
740
922
  addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
741
923
  }
742
924
  else if (newStartIdx > newEndIdx) {
925
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
926
+ // in the new array, so lets remove them (which entails cleaning up the
927
+ // relevant DOM nodes)
743
928
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
744
929
  }
745
930
  };
746
- const isSameVnode = (vnode1, vnode2) => {
931
+ /**
932
+ * Compare two VNodes to determine if they are the same
933
+ *
934
+ * **NB**: This function is an equality _heuristic_ based on the available
935
+ * information set on the two VNodes and can be misleading under certain
936
+ * circumstances. In particular, if the two nodes do not have `key` attrs
937
+ * (available under `$key$` on VNodes) then the function falls back on merely
938
+ * checking that they have the same tag.
939
+ *
940
+ * So, in other words, if `key` attrs are not set on VNodes which may be
941
+ * changing order within a `children` array or something along those lines then
942
+ * we could obtain a false positive and then have to do needless re-rendering.
943
+ *
944
+ * @param leftVNode the first VNode to check
945
+ * @param rightVNode the second VNode to check
946
+ * @returns whether they're equal or not
947
+ */
948
+ const isSameVnode = (leftVNode, rightVNode) => {
747
949
  // compare if two vnode to see if they're "technically" the same
748
950
  // need to have the same element tag, and same key to be the same
749
- if (vnode1.$tag$ === vnode2.$tag$) {
750
- if (vnode1.$tag$ === 'slot') {
751
- return vnode1.$name$ === vnode2.$name$;
951
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
952
+ if (leftVNode.$tag$ === 'slot') {
953
+ return leftVNode.$name$ === rightVNode.$name$;
752
954
  }
955
+ // this will be set if components in the build have `key` attrs set on them
753
956
  {
754
- return vnode1.$key$ === vnode2.$key$;
957
+ return leftVNode.$key$ === rightVNode.$key$;
755
958
  }
756
959
  }
757
960
  return false;
@@ -764,6 +967,14 @@ const referenceNode = (node) => {
764
967
  return (node && node['s-ol']) || node;
765
968
  };
766
969
  const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
970
+ /**
971
+ * Handle reconciling an outdated VNode with a new one which corresponds to
972
+ * it. This function handles flushing updates to the DOM and reconciling the
973
+ * children of the two nodes (if any).
974
+ *
975
+ * @param oldVNode an old VNode whose DOM element and children we want to update
976
+ * @param newVNode a new VNode representing an updated version of the old one
977
+ */
767
978
  const patch = (oldVNode, newVNode) => {
768
979
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
769
980
  const oldChildren = oldVNode.$children$;
@@ -777,7 +988,6 @@ const patch = (oldVNode, newVNode) => {
777
988
  // only add this to the when the compiler sees we're using an svg somewhere
778
989
  isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
779
990
  }
780
- // element node
781
991
  {
782
992
  if (tag === 'slot')
783
993
  ;
@@ -790,6 +1000,7 @@ const patch = (oldVNode, newVNode) => {
790
1000
  }
791
1001
  if (oldChildren !== null && newChildren !== null) {
792
1002
  // looks like there's child vnodes for both the old and new vnodes
1003
+ // so we need to call `updateChildren` to reconcile them
793
1004
  updateChildren(elm, oldChildren, newVNode, newChildren);
794
1005
  }
795
1006
  else if (newChildren !== null) {
@@ -821,7 +1032,7 @@ const patch = (oldVNode, newVNode) => {
821
1032
  };
822
1033
  const updateFallbackSlotVisibility = (elm) => {
823
1034
  // tslint:disable-next-line: prefer-const
824
- let childNodes = elm.childNodes;
1035
+ const childNodes = elm.childNodes;
825
1036
  let childNode;
826
1037
  let i;
827
1038
  let ilen;
@@ -830,7 +1041,7 @@ const updateFallbackSlotVisibility = (elm) => {
830
1041
  let nodeType;
831
1042
  for (i = 0, ilen = childNodes.length; i < ilen; i++) {
832
1043
  childNode = childNodes[i];
833
- if (childNode.nodeType === 1 /* ElementNode */) {
1044
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
834
1045
  if (childNode['s-sr']) {
835
1046
  // this is a slot fallback node
836
1047
  // get the slot name for this slot reference node
@@ -842,7 +1053,7 @@ const updateFallbackSlotVisibility = (elm) => {
842
1053
  nodeType = childNodes[j].nodeType;
843
1054
  if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
844
1055
  // this sibling node is from a different component OR is a named fallback slot node
845
- if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
1056
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
846
1057
  childNode.hidden = true;
847
1058
  break;
848
1059
  }
@@ -851,8 +1062,8 @@ const updateFallbackSlotVisibility = (elm) => {
851
1062
  // this is a default fallback slot node
852
1063
  // any element or text node (with content)
853
1064
  // should hide the default fallback slot node
854
- if (nodeType === 1 /* ElementNode */ ||
855
- (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
1065
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
1066
+ (nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
856
1067
  childNode.hidden = true;
857
1068
  break;
858
1069
  }
@@ -874,8 +1085,8 @@ const relocateSlotContent = (elm) => {
874
1085
  let relocateNodeData;
875
1086
  let j;
876
1087
  let i = 0;
877
- let childNodes = elm.childNodes;
878
- let ilen = childNodes.length;
1088
+ const childNodes = elm.childNodes;
1089
+ const ilen = childNodes.length;
879
1090
  for (; i < ilen; i++) {
880
1091
  childNode = childNodes[i];
881
1092
  if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
@@ -930,13 +1141,13 @@ const relocateSlotContent = (elm) => {
930
1141
  }
931
1142
  }
932
1143
  }
933
- if (childNode.nodeType === 1 /* ElementNode */) {
1144
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
934
1145
  relocateSlotContent(childNode);
935
1146
  }
936
1147
  }
937
1148
  };
938
1149
  const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
939
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1150
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
940
1151
  if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
941
1152
  return true;
942
1153
  }
@@ -967,7 +1178,7 @@ const renderVdom = (hostRef, renderFnResults) => {
967
1178
  cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
968
1179
  }
969
1180
  rootVnode.$tag$ = null;
970
- rootVnode.$flags$ |= 4 /* isHost */;
1181
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
971
1182
  hostRef.$vnode$ = rootVnode;
972
1183
  rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
973
1184
  {
@@ -975,7 +1186,7 @@ const renderVdom = (hostRef, renderFnResults) => {
975
1186
  }
976
1187
  {
977
1188
  contentRef = hostElm['s-cr'];
978
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1189
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
979
1190
  // always reset
980
1191
  checkSlotFallbackVisibility = false;
981
1192
  }
@@ -984,7 +1195,7 @@ const renderVdom = (hostRef, renderFnResults) => {
984
1195
  {
985
1196
  // while we're moving nodes around existing nodes, temporarily disable
986
1197
  // the disconnectCallback from working
987
- plt.$flags$ |= 1 /* isTmpDisconnected */;
1198
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
988
1199
  if (checkSlotRelocate) {
989
1200
  relocateSlotContent(rootVnode.$elm$);
990
1201
  let relocateData;
@@ -1042,7 +1253,7 @@ const renderVdom = (hostRef, renderFnResults) => {
1042
1253
  }
1043
1254
  else {
1044
1255
  // this node doesn't have a slot home to go to, so let's hide it
1045
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1256
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1046
1257
  nodeToRelocate.hidden = true;
1047
1258
  }
1048
1259
  }
@@ -1053,37 +1264,11 @@ const renderVdom = (hostRef, renderFnResults) => {
1053
1264
  }
1054
1265
  // done moving nodes around
1055
1266
  // allow the disconnect callback to work again
1056
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1267
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1057
1268
  // always reset
1058
1269
  relocateNodes.length = 0;
1059
1270
  }
1060
1271
  };
1061
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
1062
- const createEvent = (ref, name, flags) => {
1063
- const elm = getElement(ref);
1064
- return {
1065
- emit: (detail) => {
1066
- return emitEvent(elm, name, {
1067
- bubbles: !!(flags & 4 /* Bubbles */),
1068
- composed: !!(flags & 2 /* Composed */),
1069
- cancelable: !!(flags & 1 /* Cancellable */),
1070
- detail,
1071
- });
1072
- },
1073
- };
1074
- };
1075
- /**
1076
- * Helper function to create & dispatch a custom Event on a provided target
1077
- * @param elm the target of the Event
1078
- * @param name the name to give the custom Event
1079
- * @param opts options for configuring a custom Event
1080
- * @returns the custom Event
1081
- */
1082
- const emitEvent = (elm, name, opts) => {
1083
- const ev = plt.ce(name, opts);
1084
- elm.dispatchEvent(ev);
1085
- return ev;
1086
- };
1087
1272
  const attachToAncestor = (hostRef, ancestorComponent) => {
1088
1273
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1089
1274
  ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
@@ -1091,10 +1276,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
1091
1276
  };
1092
1277
  const scheduleUpdate = (hostRef, isInitialLoad) => {
1093
1278
  {
1094
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1279
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1095
1280
  }
1096
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1097
- hostRef.$flags$ |= 512 /* needsRerender */;
1281
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1282
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1098
1283
  return;
1099
1284
  }
1100
1285
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
@@ -1110,7 +1295,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
1110
1295
  let promise;
1111
1296
  if (isInitialLoad) {
1112
1297
  {
1113
- hostRef.$flags$ |= 256 /* isListenReady */;
1298
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1114
1299
  if (hostRef.$queuedListeners$) {
1115
1300
  hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1116
1301
  hostRef.$queuedListeners$ = null;
@@ -1161,7 +1346,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1161
1346
  }
1162
1347
  else {
1163
1348
  Promise.all(childrenPromises).then(postUpdate);
1164
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1349
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1165
1350
  childrenPromises.length = 0;
1166
1351
  }
1167
1352
  }
@@ -1170,10 +1355,10 @@ const callRender = (hostRef, instance, elm) => {
1170
1355
  try {
1171
1356
  instance = instance.render && instance.render();
1172
1357
  {
1173
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1358
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1174
1359
  }
1175
1360
  {
1176
- hostRef.$flags$ |= 2 /* hasRendered */;
1361
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1177
1362
  }
1178
1363
  {
1179
1364
  {
@@ -1200,8 +1385,8 @@ const postUpdateComponent = (hostRef) => {
1200
1385
  {
1201
1386
  safeCall(instance, 'componentDidRender');
1202
1387
  }
1203
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1204
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1388
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1389
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1205
1390
  {
1206
1391
  // DOM WRITE!
1207
1392
  addHydratedFlag(elm);
@@ -1230,10 +1415,10 @@ const postUpdateComponent = (hostRef) => {
1230
1415
  hostRef.$onRenderResolve$();
1231
1416
  hostRef.$onRenderResolve$ = undefined;
1232
1417
  }
1233
- if (hostRef.$flags$ & 512 /* needsRerender */) {
1418
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1234
1419
  nextTick(() => scheduleUpdate(hostRef, false));
1235
1420
  }
1236
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1421
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1237
1422
  }
1238
1423
  // ( •_•)
1239
1424
  // ( •_•)>⌐■-■
@@ -1263,53 +1448,6 @@ const then = (promise, thenFn) => {
1263
1448
  };
1264
1449
  const addHydratedFlag = (elm) => elm.setAttribute('stencil-hydrated', '')
1265
1450
  ;
1266
- /**
1267
- * Parse a new property value for a given property type.
1268
- *
1269
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
1270
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
1271
- * 1. `any`, the type given to `propValue` in the function signature
1272
- * 2. the type stored from `propType`.
1273
- *
1274
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
1275
- *
1276
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
1277
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
1278
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
1279
- * ```tsx
1280
- * <my-cmp prop-val={0}></my-cmp>
1281
- * ```
1282
- *
1283
- * HTML prop values on the other hand, will always a string
1284
- *
1285
- * @param propValue the new value to coerce to some type
1286
- * @param propType the type of the prop, expressed as a binary number
1287
- * @returns the parsed/coerced value
1288
- */
1289
- const parsePropertyValue = (propValue, propType) => {
1290
- // ensure this value is of the correct prop type
1291
- if (propValue != null && !isComplexType(propValue)) {
1292
- if (propType & 4 /* Boolean */) {
1293
- // per the HTML spec, any string value means it is a boolean true value
1294
- // but we'll cheat here and say that the string "false" is the boolean false
1295
- return propValue === 'false' ? false : propValue === '' || !!propValue;
1296
- }
1297
- if (propType & 2 /* Number */) {
1298
- // force it to be a number
1299
- return parseFloat(propValue);
1300
- }
1301
- if (propType & 1 /* String */) {
1302
- // could have been passed as a number or boolean
1303
- // but we still want it as a string
1304
- return String(propValue);
1305
- }
1306
- // redundant return here for better minification
1307
- return propValue;
1308
- }
1309
- // not sure exactly what type we want
1310
- // so no need to change to a different type
1311
- return propValue;
1312
- };
1313
1451
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1314
1452
  const setValue = (ref, propName, newVal, cmpMeta) => {
1315
1453
  // check our new property value against our internal value
@@ -1322,13 +1460,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1322
1460
  // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1323
1461
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1324
1462
  const didValueChange = newVal !== oldVal && !areBothNaN;
1325
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1463
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1326
1464
  // gadzooks! the property's value has changed!!
1327
1465
  // set our new value!
1328
1466
  hostRef.$instanceValues$.set(propName, newVal);
1329
1467
  if (instance) {
1330
1468
  // get an array of method names of watch functions to call
1331
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1469
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1332
1470
  const watchMethods = cmpMeta.$watchers$[propName];
1333
1471
  if (watchMethods) {
1334
1472
  // this instance is watching for when this property changed
@@ -1343,7 +1481,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1343
1481
  });
1344
1482
  }
1345
1483
  }
1346
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1484
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1347
1485
  // looks like this value actually changed, so we've got work to do!
1348
1486
  // but only if we've already rendered, otherwise just chill out
1349
1487
  // queue that we need to do an update, but don't worry about queuing
@@ -1353,6 +1491,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1353
1491
  }
1354
1492
  }
1355
1493
  };
1494
+ /**
1495
+ * Attach a series of runtime constructs to a compiled Stencil component
1496
+ * constructor, including getters and setters for the `@Prop` and `@State`
1497
+ * decorators, callbacks for when attributes change, and so on.
1498
+ *
1499
+ * @param Cstr the constructor for a component that we need to process
1500
+ * @param cmpMeta metadata collected previously about the component
1501
+ * @param flags a number used to store a series of bit flags
1502
+ * @returns a reference to the same constructor passed in (but now mutated)
1503
+ */
1356
1504
  const proxyComponent = (Cstr, cmpMeta, flags) => {
1357
1505
  if (cmpMeta.$members$) {
1358
1506
  if (Cstr.watchers) {
@@ -1362,8 +1510,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1362
1510
  const members = Object.entries(cmpMeta.$members$);
1363
1511
  const prototype = Cstr.prototype;
1364
1512
  members.map(([memberName, [memberFlags]]) => {
1365
- if ((memberFlags & 31 /* Prop */ ||
1366
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1513
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1514
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1367
1515
  // proxyComponent - prop
1368
1516
  Object.defineProperty(prototype, memberName, {
1369
1517
  get() {
@@ -1378,8 +1526,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1378
1526
  enumerable: true,
1379
1527
  });
1380
1528
  }
1381
- else if (flags & 1 /* isElementConstructor */ &&
1382
- memberFlags & 64 /* Method */) {
1529
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1530
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1383
1531
  // proxyComponent - method
1384
1532
  Object.defineProperty(prototype, memberName, {
1385
1533
  value(...args) {
@@ -1389,7 +1537,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1389
1537
  });
1390
1538
  }
1391
1539
  });
1392
- if ((flags & 1 /* isElementConstructor */)) {
1540
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1393
1541
  const attrNameToPropName = new Map();
1394
1542
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1395
1543
  plt.jmp(() => {
@@ -1445,11 +1593,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1445
1593
  // create an array of attributes to observe
1446
1594
  // and also create a map of html attribute name to js property name
1447
1595
  Cstr.observedAttributes = members
1448
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1596
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1449
1597
  .map(([propName, m]) => {
1450
1598
  const attrName = m[1] || propName;
1451
1599
  attrNameToPropName.set(attrName, propName);
1452
- if (m[0] & 512 /* ReflectAttr */) {
1600
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1453
1601
  cmpMeta.$attrsToReflect$.push([propName, attrName]);
1454
1602
  }
1455
1603
  return attrName;
@@ -1460,10 +1608,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1460
1608
  };
1461
1609
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1462
1610
  // initializeComponent
1463
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1611
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1464
1612
  {
1465
1613
  // we haven't initialized this element yet
1466
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1614
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1467
1615
  // lazy loaded components
1468
1616
  // request the component's implementation to be
1469
1617
  // wired up with the host element
@@ -1481,7 +1629,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1481
1629
  {
1482
1630
  cmpMeta.$watchers$ = Cstr.watchers;
1483
1631
  }
1484
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1632
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1485
1633
  Cstr.isProxied = true;
1486
1634
  }
1487
1635
  const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
@@ -1489,7 +1637,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1489
1637
  // but let's keep track of when we start and stop
1490
1638
  // so that the getters/setters don't incorrectly step on data
1491
1639
  {
1492
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1640
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1493
1641
  }
1494
1642
  // construct the lazy-loaded component implementation
1495
1643
  // passing the hostRef is very important during
@@ -1502,10 +1650,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1502
1650
  consoleError(e);
1503
1651
  }
1504
1652
  {
1505
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1653
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1506
1654
  }
1507
1655
  {
1508
- hostRef.$flags$ |= 128 /* isWatchReady */;
1656
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1509
1657
  }
1510
1658
  endNewInstance();
1511
1659
  fireConnectedCallback(hostRef.$lazyInstance$);
@@ -1516,7 +1664,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1516
1664
  const scopeId = getScopeId(cmpMeta);
1517
1665
  if (!styles.has(scopeId)) {
1518
1666
  const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1519
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1667
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1520
1668
  endRegisterStyles();
1521
1669
  }
1522
1670
  }
@@ -1543,19 +1691,19 @@ const fireConnectedCallback = (instance) => {
1543
1691
  }
1544
1692
  };
1545
1693
  const connectedCallback = (elm) => {
1546
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1694
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1547
1695
  const hostRef = getHostRef(elm);
1548
1696
  const cmpMeta = hostRef.$cmpMeta$;
1549
1697
  const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1550
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1698
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1551
1699
  // first time this component has connected
1552
- hostRef.$flags$ |= 1 /* hasConnected */;
1700
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1553
1701
  {
1554
1702
  // initUpdate
1555
1703
  // if the slot polyfill is required we'll need to put some nodes
1556
1704
  // in here to act as original content anchors as we move nodes around
1557
1705
  // host element has been connected to the DOM
1558
- if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1706
+ if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
1559
1707
  setContentReference(elm);
1560
1708
  }
1561
1709
  }
@@ -1578,7 +1726,7 @@ const connectedCallback = (elm) => {
1578
1726
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1579
1727
  if (cmpMeta.$members$) {
1580
1728
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1581
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1729
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1582
1730
  const value = elm[memberName];
1583
1731
  delete elm[memberName];
1584
1732
  elm[memberName] = value;
@@ -1612,7 +1760,7 @@ const setContentReference = (elm) => {
1612
1760
  elm.insertBefore(contentRefElm, elm.firstChild);
1613
1761
  };
1614
1762
  const disconnectedCallback = (elm) => {
1615
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1763
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1616
1764
  const hostRef = getHostRef(elm);
1617
1765
  const instance = hostRef.$lazyInstance$ ;
1618
1766
  {
@@ -1667,7 +1815,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1667
1815
  super(self);
1668
1816
  self = this;
1669
1817
  registerHost(self, cmpMeta);
1670
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1818
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1671
1819
  // this component is using shadow dom
1672
1820
  // and this browser supports shadow dom
1673
1821
  // add the read-only property "shadowRoot" to the host element
@@ -1702,7 +1850,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1702
1850
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1703
1851
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1704
1852
  cmpTags.push(tagName);
1705
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1853
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1706
1854
  }
1707
1855
  });
1708
1856
  });
@@ -1725,7 +1873,41 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1725
1873
  endBootstrap();
1726
1874
  };
1727
1875
  const Fragment = (_, children) => children;
1728
- const hostRefs = new WeakMap();
1876
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1877
+ if (listeners) {
1878
+ listeners.map(([flags, name, method]) => {
1879
+ const target = getHostListenerTarget(elm, flags) ;
1880
+ const handler = hostListenerProxy(hostRef, method);
1881
+ const opts = hostListenerOpts(flags);
1882
+ plt.ael(target, name, handler, opts);
1883
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1884
+ });
1885
+ }
1886
+ };
1887
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1888
+ try {
1889
+ {
1890
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
1891
+ // instance is ready, let's call it's member method for this event
1892
+ hostRef.$lazyInstance$[methodName](ev);
1893
+ }
1894
+ else {
1895
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1896
+ }
1897
+ }
1898
+ }
1899
+ catch (e) {
1900
+ consoleError(e);
1901
+ }
1902
+ };
1903
+ const getHostListenerTarget = (elm, flags) => {
1904
+ if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
1905
+ return win;
1906
+ return elm;
1907
+ };
1908
+ // prettier-ignore
1909
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1910
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1729
1911
  const getHostRef = (ref) => hostRefs.get(ref);
1730
1912
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1731
1913
  const registerHost = (elm, cmpMeta) => {
@@ -1757,7 +1939,9 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1757
1939
  if (module) {
1758
1940
  return module[exportName];
1759
1941
  }
1942
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1760
1943
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1944
+ /* @vite-ignore */
1761
1945
  /* webpackInclude: /\.entry\.js$/ */
1762
1946
  /* webpackExclude: /\.system\.entry\.js$/ */
1763
1947
  /* webpackMode: "lazy" */
@@ -1768,14 +1952,35 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1768
1952
  return importedModule[exportName];
1769
1953
  }, consoleError);
1770
1954
  };
1771
- const styles = new Map();
1955
+ const styles = /*@__PURE__*/ new Map();
1956
+ const win = typeof window !== 'undefined' ? window : {};
1957
+ const doc = win.document || { head: {} };
1958
+ const plt = {
1959
+ $flags$: 0,
1960
+ $resourcesUrl$: '',
1961
+ jmp: (h) => h(),
1962
+ raf: (h) => requestAnimationFrame(h),
1963
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1964
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1965
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1966
+ };
1967
+ const promiseResolve = (v) => Promise.resolve(v);
1968
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1969
+ try {
1970
+ new CSSStyleSheet();
1971
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1972
+ }
1973
+ catch (e) { }
1974
+ return false;
1975
+ })()
1976
+ ;
1772
1977
  const queueDomReads = [];
1773
1978
  const queueDomWrites = [];
1774
1979
  const queueTask = (queue, write) => (cb) => {
1775
1980
  queue.push(cb);
1776
1981
  if (!queuePending) {
1777
1982
  queuePending = true;
1778
- if (write && plt.$flags$ & 4 /* queueSync */) {
1983
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1779
1984
  nextTick(flush);
1780
1985
  }
1781
1986
  else {