@watermarkinsights/ripple 5.5.0 → 5.5.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 (350) hide show
  1. package/dist/{esm/global-861eb453.js → cjs/app-globals-4dfe82d1.js} +10 -1
  2. package/dist/cjs/{chartFunctions-ce6c7c16.js → chartFunctions-878f8139.js} +3 -3
  3. package/dist/cjs/{functions-3be85c6d.js → functions-05e7ad5a.js} +104 -7
  4. package/dist/cjs/index-788526f5.js +1851 -0
  5. package/dist/cjs/{intl-567eb9d8.js → intl-2b550151.js} +1 -1
  6. package/dist/cjs/loader.cjs.js +4 -3
  7. package/dist/cjs/priv-calendar.cjs.entry.js +6 -5
  8. package/dist/cjs/priv-chart-popover.cjs.entry.js +6 -5
  9. package/dist/cjs/priv-navigator-button.cjs.entry.js +4 -3
  10. package/dist/cjs/priv-navigator-item.cjs.entry.js +4 -3
  11. package/dist/cjs/ripple.cjs.js +12 -11
  12. package/dist/cjs/wm-action-menu_2.cjs.entry.js +8 -6
  13. package/dist/cjs/wm-button.cjs.entry.js +5 -4
  14. package/dist/cjs/wm-chart-slice.cjs.entry.js +1 -1
  15. package/dist/cjs/wm-chart.cjs.entry.js +7 -6
  16. package/dist/cjs/wm-date-range.cjs.entry.js +9 -8
  17. package/dist/cjs/wm-datepicker.cjs.entry.js +13 -14
  18. package/dist/cjs/wm-file-list.cjs.entry.js +4 -3
  19. package/dist/cjs/wm-file.cjs.entry.js +5 -4
  20. package/dist/cjs/wm-input.cjs.entry.js +6 -5
  21. package/dist/cjs/wm-line-chart.cjs.entry.js +15 -14
  22. package/dist/cjs/wm-modal-footer.cjs.entry.js +4 -3
  23. package/dist/cjs/wm-modal-header.cjs.entry.js +6 -5
  24. package/dist/cjs/wm-modal.cjs.entry.js +6 -5
  25. package/dist/cjs/wm-navigation_3.cjs.entry.js +13 -10
  26. package/dist/cjs/wm-navigator.cjs.entry.js +4 -3
  27. package/dist/cjs/wm-option_2.cjs.entry.js +10 -8
  28. package/dist/cjs/wm-pagination.cjs.entry.js +5 -4
  29. package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +9 -7
  30. package/dist/cjs/wm-search.cjs.entry.js +7 -6
  31. package/dist/cjs/wm-snackbar.cjs.entry.js +7 -6
  32. package/dist/cjs/wm-tab-item_3.cjs.entry.js +11 -8
  33. package/dist/cjs/wm-tag-input.cjs.entry.js +8 -7
  34. package/dist/cjs/wm-tag-option.cjs.entry.js +2 -2
  35. package/dist/cjs/wm-textarea.cjs.entry.js +6 -5
  36. package/dist/cjs/wm-timepicker.cjs.entry.js +6 -5
  37. package/dist/cjs/wm-toggletip.cjs.entry.js +6 -5
  38. package/dist/cjs/wm-uploader.cjs.entry.js +7 -6
  39. package/dist/cjs/wm-wrapper.cjs.entry.js +1 -1
  40. package/dist/collection/collection-manifest.json +2 -2
  41. package/dist/collection/components/charts/chartFunctions.js +1 -1
  42. package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +2 -2
  43. package/dist/collection/components/charts/wm-chart/wm-chart.js +1 -1
  44. package/dist/collection/components/charts/wm-line-chart/wm-line-chart.js +9 -9
  45. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.js +1 -1
  46. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.js +1 -1
  47. package/dist/collection/components/datepickers/priv-calendar/priv-calendar.js +2 -2
  48. package/dist/collection/components/datepickers/wm-date-range.js +17 -13
  49. package/dist/collection/components/datepickers/wm-datepicker.js +21 -19
  50. package/dist/collection/components/wm-action-menu/wm-action-menu.js +1 -1
  51. package/dist/collection/components/wm-button/wm-button.js +1 -1
  52. package/dist/collection/components/wm-file/wm-file.js +1 -1
  53. package/dist/collection/components/wm-file-list/wm-file-list.js +1 -1
  54. package/dist/collection/components/wm-input/wm-input.js +1 -1
  55. package/dist/collection/components/wm-menuitem/wm-menuitem.js +1 -1
  56. package/dist/collection/components/wm-modal/wm-modal-footer.js +1 -1
  57. package/dist/collection/components/wm-modal/wm-modal-header.js +1 -1
  58. package/dist/collection/components/wm-modal/wm-modal.js +2 -2
  59. package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +1 -1
  60. package/dist/collection/components/wm-navigation/wm-navigation-item.js +1 -1
  61. package/dist/collection/components/wm-navigation/wm-navigation.js +2 -2
  62. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +1 -1
  63. package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +1 -1
  64. package/dist/collection/components/wm-option/wm-option.js +1 -1
  65. package/dist/collection/components/wm-pagination/wm-pagination.js +1 -1
  66. package/dist/collection/components/wm-search/wm-search.js +5 -4
  67. package/dist/collection/components/wm-select/wm-select.js +2 -2
  68. package/dist/collection/components/wm-snackbar/wm-snackbar.js +2 -2
  69. package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +1 -1
  70. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +1 -1
  71. package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +1 -1
  72. package/dist/collection/components/wm-tag-input/wm-tag-input.js +3 -3
  73. package/dist/collection/components/wm-textarea/wm-textarea.js +1 -1
  74. package/dist/collection/components/wm-timepicker/wm-timepicker.js +11 -8
  75. package/dist/collection/components/wm-toggletip/wm-toggletip.js +2 -2
  76. package/dist/collection/components/wm-uploader/wm-uploader.js +2 -2
  77. package/dist/{cjs/global-ad843e7f.js → esm/app-globals-b8b36bbb.js} +7 -2
  78. package/dist/esm/{chartFunctions-0ebf83f3.js → chartFunctions-00fd6f23.js} +3 -3
  79. package/dist/esm/{functions-46843ea0.js → functions-25781571.js} +105 -8
  80. package/dist/esm/index-130e07bb.js +1820 -0
  81. package/dist/esm/{intl-8b8740b9.js → intl-df3d34d1.js} +1 -1
  82. package/dist/esm/loader.js +5 -4
  83. package/dist/esm/priv-calendar.entry.js +6 -5
  84. package/dist/esm/priv-chart-popover.entry.js +6 -5
  85. package/dist/esm/priv-navigator-button.entry.js +4 -3
  86. package/dist/esm/priv-navigator-item.entry.js +4 -3
  87. package/dist/esm/ripple.js +13 -12
  88. package/dist/esm/wm-action-menu_2.entry.js +8 -6
  89. package/dist/esm/wm-button.entry.js +5 -4
  90. package/dist/esm/wm-chart-slice.entry.js +1 -1
  91. package/dist/esm/wm-chart.entry.js +7 -6
  92. package/dist/esm/wm-date-range.entry.js +9 -8
  93. package/dist/esm/wm-datepicker.entry.js +13 -14
  94. package/dist/esm/wm-file-list.entry.js +4 -3
  95. package/dist/esm/wm-file.entry.js +5 -4
  96. package/dist/esm/wm-input.entry.js +6 -5
  97. package/dist/esm/wm-line-chart.entry.js +15 -14
  98. package/dist/esm/wm-modal-footer.entry.js +4 -3
  99. package/dist/esm/wm-modal-header.entry.js +6 -5
  100. package/dist/esm/wm-modal.entry.js +6 -5
  101. package/dist/esm/wm-navigation_3.entry.js +13 -10
  102. package/dist/esm/wm-navigator.entry.js +4 -3
  103. package/dist/esm/wm-option_2.entry.js +10 -8
  104. package/dist/esm/wm-pagination.entry.js +5 -4
  105. package/dist/esm/wm-progress-indicator_3.entry.js +9 -7
  106. package/dist/esm/wm-search.entry.js +7 -6
  107. package/dist/esm/wm-snackbar.entry.js +7 -6
  108. package/dist/esm/wm-tab-item_3.entry.js +11 -8
  109. package/dist/esm/wm-tag-input.entry.js +8 -7
  110. package/dist/esm/wm-tag-option.entry.js +2 -2
  111. package/dist/esm/wm-textarea.entry.js +6 -5
  112. package/dist/esm/wm-timepicker.entry.js +6 -5
  113. package/dist/esm/wm-toggletip.entry.js +6 -5
  114. package/dist/esm/wm-uploader.entry.js +7 -6
  115. package/dist/esm/wm-wrapper.entry.js +1 -1
  116. package/dist/esm-es5/app-globals-b8b36bbb.js +1 -0
  117. package/dist/esm-es5/{chartFunctions-0ebf83f3.js → chartFunctions-00fd6f23.js} +1 -1
  118. package/dist/esm-es5/functions-25781571.js +1 -0
  119. package/dist/esm-es5/index-130e07bb.js +1 -0
  120. package/dist/esm-es5/{intl-8b8740b9.js → intl-df3d34d1.js} +1 -1
  121. package/dist/esm-es5/loader.js +1 -1
  122. package/dist/esm-es5/priv-calendar.entry.js +1 -1
  123. package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
  124. package/dist/esm-es5/priv-navigator-button.entry.js +1 -1
  125. package/dist/esm-es5/priv-navigator-item.entry.js +1 -1
  126. package/dist/esm-es5/ripple.js +1 -1
  127. package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
  128. package/dist/esm-es5/wm-button.entry.js +1 -1
  129. package/dist/esm-es5/wm-chart-slice.entry.js +1 -1
  130. package/dist/esm-es5/wm-chart.entry.js +1 -1
  131. package/dist/esm-es5/wm-date-range.entry.js +1 -1
  132. package/dist/esm-es5/wm-datepicker.entry.js +1 -1
  133. package/dist/esm-es5/wm-file-list.entry.js +1 -1
  134. package/dist/esm-es5/wm-file.entry.js +1 -1
  135. package/dist/esm-es5/wm-input.entry.js +1 -1
  136. package/dist/esm-es5/wm-line-chart.entry.js +1 -1
  137. package/dist/esm-es5/wm-modal-footer.entry.js +1 -1
  138. package/dist/esm-es5/wm-modal-header.entry.js +1 -1
  139. package/dist/esm-es5/wm-modal.entry.js +1 -1
  140. package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
  141. package/dist/esm-es5/wm-navigator.entry.js +1 -1
  142. package/dist/esm-es5/wm-option_2.entry.js +1 -1
  143. package/dist/esm-es5/wm-pagination.entry.js +1 -1
  144. package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
  145. package/dist/esm-es5/wm-search.entry.js +1 -1
  146. package/dist/esm-es5/wm-snackbar.entry.js +1 -1
  147. package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
  148. package/dist/esm-es5/wm-tag-input.entry.js +1 -1
  149. package/dist/esm-es5/wm-tag-option.entry.js +1 -1
  150. package/dist/esm-es5/wm-textarea.entry.js +1 -1
  151. package/dist/esm-es5/wm-timepicker.entry.js +1 -1
  152. package/dist/esm-es5/wm-toggletip.entry.js +1 -1
  153. package/dist/esm-es5/wm-uploader.entry.js +1 -1
  154. package/dist/esm-es5/wm-wrapper.entry.js +1 -1
  155. package/dist/loader/cdn.js +1 -2
  156. package/dist/loader/index.cjs.js +1 -2
  157. package/dist/loader/index.d.ts +3 -0
  158. package/dist/loader/index.es2017.js +1 -2
  159. package/dist/loader/index.js +1 -2
  160. package/dist/ripple/{p-99dd083d.system.js → p-03708b88.system.js} +1 -1
  161. package/dist/ripple/{p-45abd8fe.entry.js → p-041e579b.entry.js} +1 -1
  162. package/dist/ripple/{p-65d26233.system.entry.js → p-043901ab.system.entry.js} +1 -1
  163. package/dist/ripple/p-0af94825.entry.js +1 -0
  164. package/dist/ripple/p-0ff41567.system.entry.js +1 -0
  165. package/dist/ripple/p-1044e1dc.system.js +1 -0
  166. package/dist/ripple/{p-48e09589.entry.js → p-13b1d775.entry.js} +1 -1
  167. package/dist/ripple/p-13fc2164.entry.js +1 -0
  168. package/dist/ripple/p-155224a2.system.entry.js +1 -0
  169. package/dist/ripple/p-17bb1157.system.entry.js +1 -0
  170. package/dist/ripple/p-1f09134c.entry.js +1 -0
  171. package/dist/ripple/{p-204bdd73.entry.js → p-298bde1b.entry.js} +1 -1
  172. package/dist/ripple/p-298c2675.entry.js +1 -0
  173. package/dist/ripple/p-2d619f83.entry.js +1 -0
  174. package/dist/ripple/p-2ef49c84.entry.js +1 -0
  175. package/dist/ripple/p-2fd12dd9.entry.js +1 -0
  176. package/dist/ripple/p-3423a9b6.system.entry.js +1 -0
  177. package/dist/ripple/p-376efca9.entry.js +1 -0
  178. package/dist/ripple/p-38ccde69.system.js +1 -0
  179. package/dist/ripple/{p-e3241417.system.entry.js → p-3b4045f8.system.entry.js} +1 -1
  180. package/dist/ripple/p-3b5f4364.system.entry.js +1 -0
  181. package/dist/ripple/p-417c8e46.system.entry.js +1 -0
  182. package/dist/ripple/p-418ed08c.system.entry.js +1 -0
  183. package/dist/ripple/{p-28b70082.system.entry.js → p-41eb6a2e.system.entry.js} +1 -1
  184. package/dist/ripple/p-4670ccb4.system.js +1 -0
  185. package/dist/ripple/p-4baaf026.entry.js +1 -0
  186. package/dist/ripple/p-4ea1e503.entry.js +1 -0
  187. package/dist/ripple/p-5051034b.entry.js +1 -0
  188. package/dist/ripple/p-56766bb2.entry.js +1 -0
  189. package/dist/ripple/p-5caaf651.system.entry.js +1 -0
  190. package/dist/ripple/p-5ece78e5.system.entry.js +1 -0
  191. package/dist/ripple/{p-42d1c301.entry.js → p-672ae2cb.entry.js} +1 -1
  192. package/dist/ripple/{p-3a44e1c8.entry.js → p-67a7f0b0.entry.js} +1 -1
  193. package/dist/ripple/p-6d0e5159.system.entry.js +1 -0
  194. package/dist/ripple/p-6d56676e.system.entry.js +1 -0
  195. package/dist/ripple/{p-7326b62a.entry.js → p-6e60631a.entry.js} +1 -1
  196. package/dist/ripple/{p-b7ead395.system.entry.js → p-6fe35d1e.system.entry.js} +1 -1
  197. package/dist/ripple/p-748f8a97.system.entry.js +1 -0
  198. package/dist/ripple/p-7eab6bea.system.entry.js +1 -0
  199. package/dist/ripple/p-7fb95b89.entry.js +1 -0
  200. package/dist/ripple/{p-32bf3f5b.system.entry.js → p-823d7b4e.system.entry.js} +1 -1
  201. package/dist/ripple/p-830f8b3f.entry.js +1 -0
  202. package/dist/ripple/p-86fd68b3.system.entry.js +1 -0
  203. package/dist/ripple/p-88cfd58d.js +1 -0
  204. package/dist/ripple/p-89b27fbb.js +1 -0
  205. package/dist/ripple/p-8b56f9d8.system.entry.js +1 -0
  206. package/dist/ripple/{p-8159cdf5.entry.js → p-8e72de50.entry.js} +1 -1
  207. package/dist/ripple/{p-510679f8.system.entry.js → p-a1a2f8c9.system.entry.js} +1 -1
  208. package/dist/ripple/p-a62e7532.entry.js +1 -0
  209. package/dist/ripple/{p-f92bd0c1.js → p-a88bf1c5.js} +1 -1
  210. package/dist/ripple/{p-1ac66a15.system.js → p-a9d89ac8.system.js} +1 -1
  211. package/dist/ripple/{p-a152cf3a.system.entry.js → p-aab56a37.system.entry.js} +1 -1
  212. package/dist/ripple/{p-79106e23.system.entry.js → p-ac40417b.system.entry.js} +1 -1
  213. package/dist/ripple/{p-ffb31979.system.entry.js → p-b0c566b5.system.entry.js} +1 -1
  214. package/dist/ripple/p-b41ef3db.entry.js +1 -0
  215. package/dist/ripple/p-b7307be6.system.entry.js +1 -0
  216. package/dist/ripple/p-b80d9402.system.entry.js +1 -0
  217. package/dist/ripple/p-b8168f35.system.entry.js +1 -0
  218. package/dist/ripple/{p-dbc112a6.entry.js → p-bcff8b3a.entry.js} +1 -1
  219. package/dist/ripple/p-c2181de0.entry.js +1 -0
  220. package/dist/ripple/{p-88ebddd7.entry.js → p-cd0cc88d.entry.js} +1 -1
  221. package/dist/ripple/p-cef8a45b.system.js +2 -0
  222. package/dist/ripple/p-d5ba9de1.system.entry.js +1 -0
  223. package/dist/ripple/{p-df1a11f1.system.entry.js → p-d93c51dd.system.entry.js} +1 -1
  224. package/dist/ripple/p-d9da0502.js +2 -0
  225. package/dist/ripple/p-e2fe86a7.system.entry.js +1 -0
  226. package/dist/ripple/p-e85b1f40.entry.js +1 -0
  227. package/dist/ripple/p-ea0dfadf.system.entry.js +1 -0
  228. package/dist/ripple/p-eb14b354.entry.js +1 -0
  229. package/dist/ripple/p-ecb6c756.entry.js +1 -0
  230. package/dist/ripple/p-f09e2c22.entry.js +1 -0
  231. package/dist/ripple/p-f17fd62b.entry.js +1 -0
  232. package/dist/ripple/{p-d79fdf0b.js → p-f54e9ed0.js} +1 -1
  233. package/dist/ripple/p-fabe4ca4.entry.js +1 -0
  234. package/dist/ripple/{p-5d0e2006.system.entry.js → p-fc529ba1.system.entry.js} +1 -1
  235. package/dist/ripple/ripple.esm.js +1 -1
  236. package/dist/ripple/ripple.js +1 -1
  237. package/dist/types/stencil-public-runtime.d.ts +3 -10
  238. package/package.json +2 -2
  239. package/dist/cjs/index-e86c28b6.js +0 -2641
  240. package/dist/collection/components/charts/chartFunctions.spec.js +0 -16
  241. package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.e2e.js +0 -81
  242. package/dist/collection/components/charts/screenshots.e2e.js +0 -96
  243. package/dist/collection/components/charts/wm-chart/wm-chart.e2e.js +0 -213
  244. package/dist/collection/components/charts/wm-chart/wm-chart.spec.js +0 -37
  245. package/dist/collection/components/charts/wm-line-chart/wm-line-chart.e2e.js +0 -176
  246. package/dist/collection/components/charts/wm-line-chart/wm-line-chart.spec.js +0 -163
  247. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.e2e.js +0 -69
  248. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.spec.js +0 -79
  249. package/dist/collection/components/datepickers/priv-calendar/priv-calendar.spec.js +0 -89
  250. package/dist/collection/components/datepickers/wm-date-range.e2e.js +0 -443
  251. package/dist/collection/components/datepickers/wm-date-range.spec.js +0 -22
  252. package/dist/collection/components/datepickers/wm-datepicker.e2e.js +0 -382
  253. package/dist/collection/components/datepickers/wm-datepicker.spec.js +0 -21
  254. package/dist/collection/components/wm-action-menu/wm-action-menu.e2e.js +0 -200
  255. package/dist/collection/components/wm-action-menu/wm-action-menu.spec.js +0 -48
  256. package/dist/collection/components/wm-button/wm-button.e2e.js +0 -55
  257. package/dist/collection/components/wm-button/wm-button.spec.js +0 -74
  258. package/dist/collection/components/wm-file/wm-file.spec.js +0 -194
  259. package/dist/collection/components/wm-file-list/wm-file-list.spec.js +0 -69
  260. package/dist/collection/components/wm-input/wm-input.e2e.js +0 -32
  261. package/dist/collection/components/wm-input/wm-input.spec.js +0 -173
  262. package/dist/collection/components/wm-menuitem/wm-menuitem.e2e.js +0 -23
  263. package/dist/collection/components/wm-menuitem/wm-menuitem.spec.js +0 -54
  264. package/dist/collection/components/wm-modal/wm-modal-footer.spec.js +0 -11
  265. package/dist/collection/components/wm-modal/wm-modal-header.spec.js +0 -8
  266. package/dist/collection/components/wm-modal/wm-modal.e2e.js +0 -104
  267. package/dist/collection/components/wm-modal/wm-modal.spec.js +0 -30
  268. package/dist/collection/components/wm-navigation/wm-navigation.e2e.js +0 -102
  269. package/dist/collection/components/wm-navigation/wm-navigation.spec.js +0 -91
  270. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.e2e.js +0 -50
  271. package/dist/collection/components/wm-navigator/wm-navigator.e2e.js +0 -209
  272. package/dist/collection/components/wm-navigator/wm-navigator.spec.js +0 -177
  273. package/dist/collection/components/wm-option/wm-option.e2e.js +0 -22
  274. package/dist/collection/components/wm-option/wm-option.spec.js +0 -63
  275. package/dist/collection/components/wm-pagination/wm-pagination.e2e.js +0 -312
  276. package/dist/collection/components/wm-search/wm-search.e2e.js +0 -76
  277. package/dist/collection/components/wm-search/wm-search.spec.js +0 -71
  278. package/dist/collection/components/wm-select/wm-select.e2e.js +0 -521
  279. package/dist/collection/components/wm-select/wm-select.spec.js +0 -271
  280. package/dist/collection/components/wm-snackbar/wm-snackbar.e2e.js +0 -112
  281. package/dist/collection/components/wm-snackbar/wm-snackbar.spec.js +0 -9
  282. package/dist/collection/components/wm-tabs/wm-tabs.e2e.js +0 -91
  283. package/dist/collection/components/wm-tabs/wm-tabs.spec.js +0 -12
  284. package/dist/collection/components/wm-tag-input/wm-tag-input.e2e.js +0 -204
  285. package/dist/collection/components/wm-tag-input/wm-tag-input.spec.js +0 -195
  286. package/dist/collection/components/wm-textarea/wm-textarea.e2e.js +0 -41
  287. package/dist/collection/components/wm-textarea/wm-textarea.spec.js +0 -79
  288. package/dist/collection/components/wm-timepicker/wm-timepicker.e2e.js +0 -163
  289. package/dist/collection/components/wm-timepicker/wm-timepicker.spec.js +0 -147
  290. package/dist/collection/components/wm-toggletip/wm-toggletip.e2e.js +0 -69
  291. package/dist/collection/components/wm-toggletip/wm-toggletip.spec.js +0 -21
  292. package/dist/collection/components/wm-uploader/wm-uploader.e2e.js +0 -70
  293. package/dist/collection/components/wm-uploader/wm-uploader.spec.js +0 -234
  294. package/dist/collection/global/functions.spec.js +0 -126
  295. package/dist/collection/lang/lang.spec.js +0 -20
  296. package/dist/esm/index-558b5a82.js +0 -2610
  297. package/dist/esm-es5/functions-46843ea0.js +0 -1
  298. package/dist/esm-es5/global-861eb453.js +0 -1
  299. package/dist/esm-es5/index-558b5a82.js +0 -1
  300. package/dist/ripple/p-011477e2.entry.js +0 -1
  301. package/dist/ripple/p-021ff5fa.system.entry.js +0 -1
  302. package/dist/ripple/p-057ec1e4.js +0 -1
  303. package/dist/ripple/p-09a31f0c.entry.js +0 -1
  304. package/dist/ripple/p-0ea8609b.system.entry.js +0 -1
  305. package/dist/ripple/p-240124b0.system.entry.js +0 -1
  306. package/dist/ripple/p-26fbc7f5.system.entry.js +0 -1
  307. package/dist/ripple/p-294b38ca.system.entry.js +0 -1
  308. package/dist/ripple/p-2b05bf05.entry.js +0 -1
  309. package/dist/ripple/p-311923b2.system.entry.js +0 -1
  310. package/dist/ripple/p-31976813.entry.js +0 -1
  311. package/dist/ripple/p-33679b9d.entry.js +0 -1
  312. package/dist/ripple/p-34b5830f.system.js +0 -1
  313. package/dist/ripple/p-3568472c.entry.js +0 -1
  314. package/dist/ripple/p-3b8b1b44.system.entry.js +0 -1
  315. package/dist/ripple/p-4a6854d3.system.entry.js +0 -1
  316. package/dist/ripple/p-4c8db09c.system.entry.js +0 -1
  317. package/dist/ripple/p-4d0b1890.entry.js +0 -1
  318. package/dist/ripple/p-568c595f.js +0 -2
  319. package/dist/ripple/p-62a8f09c.entry.js +0 -1
  320. package/dist/ripple/p-6885d780.system.js +0 -1
  321. package/dist/ripple/p-7e6f5a1e.system.entry.js +0 -1
  322. package/dist/ripple/p-822618d7.entry.js +0 -1
  323. package/dist/ripple/p-825bd63b.entry.js +0 -1
  324. package/dist/ripple/p-884294c6.entry.js +0 -1
  325. package/dist/ripple/p-8fbddb6c.system.entry.js +0 -1
  326. package/dist/ripple/p-902a54c5.entry.js +0 -1
  327. package/dist/ripple/p-905dd4da.system.entry.js +0 -1
  328. package/dist/ripple/p-99c24568.system.entry.js +0 -1
  329. package/dist/ripple/p-a03f7141.entry.js +0 -1
  330. package/dist/ripple/p-a27d2177.entry.js +0 -1
  331. package/dist/ripple/p-a8524a48.entry.js +0 -1
  332. package/dist/ripple/p-ab8d78cc.system.js +0 -2
  333. package/dist/ripple/p-ade3d9a9.entry.js +0 -1
  334. package/dist/ripple/p-b2dac998.system.entry.js +0 -1
  335. package/dist/ripple/p-bc5e9d24.entry.js +0 -1
  336. package/dist/ripple/p-bd6b8cf2.system.js +0 -1
  337. package/dist/ripple/p-bf636261.entry.js +0 -1
  338. package/dist/ripple/p-c47811a2.entry.js +0 -1
  339. package/dist/ripple/p-c4b9d46d.entry.js +0 -1
  340. package/dist/ripple/p-c885c7f9.entry.js +0 -1
  341. package/dist/ripple/p-c9543950.system.entry.js +0 -1
  342. package/dist/ripple/p-cacfbaf1.system.entry.js +0 -1
  343. package/dist/ripple/p-d24882a7.system.entry.js +0 -1
  344. package/dist/ripple/p-d33d6e96.system.entry.js +0 -1
  345. package/dist/ripple/p-df2560f3.system.entry.js +0 -1
  346. package/dist/ripple/p-e3bcdde8.system.entry.js +0 -1
  347. package/dist/ripple/p-e83a98d3.entry.js +0 -1
  348. package/dist/ripple/p-e995f7f0.js +0 -1
  349. package/dist/ripple/p-eaac6bcd.entry.js +0 -1
  350. package/dist/ripple/p-fd0aae67.system.entry.js +0 -1
@@ -1,2610 +0,0 @@
1
- const NAMESPACE = 'ripple';
2
- const BUILD = /* ripple */ { allRenderFn: false, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: true, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: true, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: true, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: false, hostListenerTargetDocument: true, hostListenerTargetParent: false, hostListenerTargetWindow: true, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: true, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
3
-
4
- /**
5
- * Virtual DOM patching algorithm based on Snabbdom by
6
- * Simon Friis Vindum (@paldepind)
7
- * Licensed under the MIT License
8
- * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
9
- *
10
- * Modified for Stencil's renderer and slot projection
11
- */
12
- let scopeId;
13
- let contentRef;
14
- let hostTagName;
15
- let useNativeShadowDom = false;
16
- let checkSlotFallbackVisibility = false;
17
- let checkSlotRelocate = false;
18
- let isSvgMode = false;
19
- let queuePending = false;
20
- const createTime = (fnName, tagName = '') => {
21
- {
22
- return () => {
23
- return;
24
- };
25
- }
26
- };
27
- const uniqueTime = (key, measureText) => {
28
- {
29
- return () => {
30
- return;
31
- };
32
- }
33
- };
34
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
35
- /**
36
- * Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
37
- *
38
- * Two cascading rules must be used instead of a `:not()` selector due to Stencil browser
39
- * support as of Stencil v4.
40
- */
41
- const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
42
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
43
- /**
44
- * Default style mode id
45
- */
46
- /**
47
- * Reusable empty obj/array
48
- * Don't add values to these!!
49
- */
50
- const EMPTY_OBJ = {};
51
- /**
52
- * Namespaces
53
- */
54
- const SVG_NS = 'http://www.w3.org/2000/svg';
55
- const HTML_NS = 'http://www.w3.org/1999/xhtml';
56
- const isDef = (v) => v != null;
57
- /**
58
- * Check whether a value is a 'complex type', defined here as an object or a
59
- * function.
60
- *
61
- * @param o the value to check
62
- * @returns whether it's a complex type or not
63
- */
64
- const isComplexType = (o) => {
65
- // https://jsperf.com/typeof-fn-object/5
66
- o = typeof o;
67
- return o === 'object' || o === 'function';
68
- };
69
- /**
70
- * Helper method for querying a `meta` tag that contains a nonce value
71
- * out of a DOM's head.
72
- *
73
- * @param doc The DOM containing the `head` to query against
74
- * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
75
- * exists or the tag has no content.
76
- */
77
- function queryNonceMetaTagContent(doc) {
78
- var _a, _b, _c;
79
- return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
80
- }
81
- /**
82
- * Production h() function based on Preact by
83
- * Jason Miller (@developit)
84
- * Licensed under the MIT License
85
- * https://github.com/developit/preact/blob/master/LICENSE
86
- *
87
- * Modified for Stencil's compiler and vdom
88
- */
89
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
90
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
91
- const h = (nodeName, vnodeData, ...children) => {
92
- let child = null;
93
- let key = null;
94
- let slotName = null;
95
- let simple = false;
96
- let lastSimple = false;
97
- const vNodeChildren = [];
98
- const walk = (c) => {
99
- for (let i = 0; i < c.length; i++) {
100
- child = c[i];
101
- if (Array.isArray(child)) {
102
- walk(child);
103
- }
104
- else if (child != null && typeof child !== 'boolean') {
105
- if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
106
- child = String(child);
107
- }
108
- if (simple && lastSimple) {
109
- // If the previous child was simple (string), we merge both
110
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
111
- }
112
- else {
113
- // Append a new vNode, if it's text, we create a text vNode
114
- vNodeChildren.push(simple ? newVNode(null, child) : child);
115
- }
116
- lastSimple = simple;
117
- }
118
- }
119
- };
120
- walk(children);
121
- if (vnodeData) {
122
- if (vnodeData.key) {
123
- key = vnodeData.key;
124
- }
125
- if (vnodeData.name) {
126
- slotName = vnodeData.name;
127
- }
128
- // normalize class / className attributes
129
- {
130
- const classData = vnodeData.className || vnodeData.class;
131
- if (classData) {
132
- vnodeData.class =
133
- typeof classData !== 'object'
134
- ? classData
135
- : Object.keys(classData)
136
- .filter((k) => classData[k])
137
- .join(' ');
138
- }
139
- }
140
- }
141
- if (typeof nodeName === 'function') {
142
- // nodeName is a functional component
143
- return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
144
- }
145
- const vnode = newVNode(nodeName, null);
146
- vnode.$attrs$ = vnodeData;
147
- if (vNodeChildren.length > 0) {
148
- vnode.$children$ = vNodeChildren;
149
- }
150
- {
151
- vnode.$key$ = key;
152
- }
153
- {
154
- vnode.$name$ = slotName;
155
- }
156
- return vnode;
157
- };
158
- /**
159
- * A utility function for creating a virtual DOM node from a tag and some
160
- * possible text content.
161
- *
162
- * @param tag the tag for this element
163
- * @param text possible text content for the node
164
- * @returns a newly-minted virtual DOM node
165
- */
166
- const newVNode = (tag, text) => {
167
- const vnode = {
168
- $flags$: 0,
169
- $tag$: tag,
170
- $text$: text,
171
- $elm$: null,
172
- $children$: null,
173
- };
174
- {
175
- vnode.$attrs$ = null;
176
- }
177
- {
178
- vnode.$key$ = null;
179
- }
180
- {
181
- vnode.$name$ = null;
182
- }
183
- return vnode;
184
- };
185
- const Host = {};
186
- /**
187
- * Check whether a given node is a Host node or not
188
- *
189
- * @param node the virtual DOM node to check
190
- * @returns whether it's a Host node or not
191
- */
192
- const isHost = (node) => node && node.$tag$ === Host;
193
- /**
194
- * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
195
- *
196
- * Note that these functions convert from {@link d.VNode} to
197
- * {@link d.ChildNode} to give functional component developers a friendly
198
- * interface.
199
- */
200
- const vdomFnUtils = {
201
- forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
202
- map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
203
- };
204
- /**
205
- * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
206
- * friendlier public interface (hence, 'convertToPublic').
207
- *
208
- * @param node the virtual DOM node to convert
209
- * @returns a converted child node
210
- */
211
- const convertToPublic = (node) => ({
212
- vattrs: node.$attrs$,
213
- vchildren: node.$children$,
214
- vkey: node.$key$,
215
- vname: node.$name$,
216
- vtag: node.$tag$,
217
- vtext: node.$text$,
218
- });
219
- /**
220
- * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
221
- * order to use the resulting object in the virtual DOM. The initial object was
222
- * likely created as part of presenting a public API, so converting it back
223
- * involved making it 'private' again (hence, `convertToPrivate`).
224
- *
225
- * @param node the child node to convert
226
- * @returns a converted virtual DOM node
227
- */
228
- const convertToPrivate = (node) => {
229
- if (typeof node.vtag === 'function') {
230
- const vnodeData = Object.assign({}, node.vattrs);
231
- if (node.vkey) {
232
- vnodeData.key = node.vkey;
233
- }
234
- if (node.vname) {
235
- vnodeData.name = node.vname;
236
- }
237
- return h(node.vtag, vnodeData, ...(node.vchildren || []));
238
- }
239
- const vnode = newVNode(node.vtag, node.vtext);
240
- vnode.$attrs$ = node.vattrs;
241
- vnode.$children$ = node.vchildren;
242
- vnode.$key$ = node.vkey;
243
- vnode.$name$ = node.vname;
244
- return vnode;
245
- };
246
- /**
247
- * Parse a new property value for a given property type.
248
- *
249
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
250
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
251
- * 1. `any`, the type given to `propValue` in the function signature
252
- * 2. the type stored from `propType`.
253
- *
254
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
255
- *
256
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
257
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
258
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
259
- * ```tsx
260
- * <my-cmp prop-val={0}></my-cmp>
261
- * ```
262
- *
263
- * HTML prop values on the other hand, will always a string
264
- *
265
- * @param propValue the new value to coerce to some type
266
- * @param propType the type of the prop, expressed as a binary number
267
- * @returns the parsed/coerced value
268
- */
269
- const parsePropertyValue = (propValue, propType) => {
270
- // ensure this value is of the correct prop type
271
- if (propValue != null && !isComplexType(propValue)) {
272
- if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
273
- // per the HTML spec, any string value means it is a boolean true value
274
- // but we'll cheat here and say that the string "false" is the boolean false
275
- return propValue === 'false' ? false : propValue === '' || !!propValue;
276
- }
277
- if (propType & 2 /* MEMBER_FLAGS.Number */) {
278
- // force it to be a number
279
- return parseFloat(propValue);
280
- }
281
- if (propType & 1 /* MEMBER_FLAGS.String */) {
282
- // could have been passed as a number or boolean
283
- // but we still want it as a string
284
- return String(propValue);
285
- }
286
- // redundant return here for better minification
287
- return propValue;
288
- }
289
- // not sure exactly what type we want
290
- // so no need to change to a different type
291
- return propValue;
292
- };
293
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
294
- const createEvent = (ref, name, flags) => {
295
- const elm = getElement(ref);
296
- return {
297
- emit: (detail) => {
298
- return emitEvent(elm, name, {
299
- bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
300
- composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
301
- cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
302
- detail,
303
- });
304
- },
305
- };
306
- };
307
- /**
308
- * Helper function to create & dispatch a custom Event on a provided target
309
- * @param elm the target of the Event
310
- * @param name the name to give the custom Event
311
- * @param opts options for configuring a custom Event
312
- * @returns the custom Event
313
- */
314
- const emitEvent = (elm, name, opts) => {
315
- const ev = plt.ce(name, opts);
316
- elm.dispatchEvent(ev);
317
- return ev;
318
- };
319
- const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
320
- const registerStyle = (scopeId, cssText, allowCS) => {
321
- let style = styles.get(scopeId);
322
- if (supportsConstructableStylesheets && allowCS) {
323
- style = (style || new CSSStyleSheet());
324
- if (typeof style === 'string') {
325
- style = cssText;
326
- }
327
- else {
328
- style.replaceSync(cssText);
329
- }
330
- }
331
- else {
332
- style = cssText;
333
- }
334
- styles.set(scopeId, style);
335
- };
336
- const addStyle = (styleContainerNode, cmpMeta, mode) => {
337
- var _a;
338
- const scopeId = getScopeId(cmpMeta);
339
- const style = styles.get(scopeId);
340
- // if an element is NOT connected then getRootNode() will return the wrong root node
341
- // so the fallback is to always use the document for the root node in those cases
342
- styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
343
- if (style) {
344
- if (typeof style === 'string') {
345
- styleContainerNode = styleContainerNode.head || styleContainerNode;
346
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
347
- let styleElm;
348
- if (!appliedStyles) {
349
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
350
- }
351
- if (!appliedStyles.has(scopeId)) {
352
- {
353
- styleElm = doc.createElement('style');
354
- styleElm.innerHTML = style;
355
- // Apply CSP nonce to the style tag if it exists
356
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
357
- if (nonce != null) {
358
- styleElm.setAttribute('nonce', nonce);
359
- }
360
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
361
- }
362
- // Add styles for `slot-fb` elements if we're using slots outside the Shadow DOM
363
- if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
364
- styleElm.innerHTML += SLOT_FB_CSS;
365
- }
366
- if (appliedStyles) {
367
- appliedStyles.add(scopeId);
368
- }
369
- }
370
- }
371
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
372
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
373
- }
374
- }
375
- return scopeId;
376
- };
377
- const attachStyles = (hostRef) => {
378
- const cmpMeta = hostRef.$cmpMeta$;
379
- const elm = hostRef.$hostElement$;
380
- const flags = cmpMeta.$flags$;
381
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
382
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
383
- if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
384
- // only required when we're NOT using native shadow dom (slot)
385
- // or this browser doesn't support native shadow dom
386
- // and this host element was NOT created with SSR
387
- // let's pick out the inner content for slot projection
388
- // create a node to represent where the original
389
- // content was first placed, which is useful later on
390
- // DOM WRITE!!
391
- elm['s-sc'] = scopeId;
392
- elm.classList.add(scopeId + '-h');
393
- }
394
- endAttachStyles();
395
- };
396
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
397
- /**
398
- * Production setAccessor() function based on Preact by
399
- * Jason Miller (@developit)
400
- * Licensed under the MIT License
401
- * https://github.com/developit/preact/blob/master/LICENSE
402
- *
403
- * Modified for Stencil's compiler and vdom
404
- */
405
- /**
406
- * When running a VDom render set properties present on a VDom node onto the
407
- * corresponding HTML element.
408
- *
409
- * Note that this function has special functionality for the `class`,
410
- * `style`, `key`, and `ref` attributes, as well as event handlers (like
411
- * `onClick`, etc). All others are just passed through as-is.
412
- *
413
- * @param elm the HTMLElement onto which attributes should be set
414
- * @param memberName the name of the attribute to set
415
- * @param oldValue the old value for the attribute
416
- * @param newValue the new value for the attribute
417
- * @param isSvg whether we're in an svg context or not
418
- * @param flags bitflags for Vdom variables
419
- */
420
- const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
421
- if (oldValue !== newValue) {
422
- let isProp = isMemberInElement(elm, memberName);
423
- let ln = memberName.toLowerCase();
424
- if (memberName === 'class') {
425
- const classList = elm.classList;
426
- const oldClasses = parseClassList(oldValue);
427
- const newClasses = parseClassList(newValue);
428
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
429
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
430
- }
431
- else if (memberName === 'style') {
432
- // update style attribute, css properties and values
433
- {
434
- for (const prop in oldValue) {
435
- if (!newValue || newValue[prop] == null) {
436
- if (prop.includes('-')) {
437
- elm.style.removeProperty(prop);
438
- }
439
- else {
440
- elm.style[prop] = '';
441
- }
442
- }
443
- }
444
- }
445
- for (const prop in newValue) {
446
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
447
- if (prop.includes('-')) {
448
- elm.style.setProperty(prop, newValue[prop]);
449
- }
450
- else {
451
- elm.style[prop] = newValue[prop];
452
- }
453
- }
454
- }
455
- }
456
- else if (memberName === 'key')
457
- ;
458
- else if (memberName === 'ref') {
459
- // minifier will clean this up
460
- if (newValue) {
461
- newValue(elm);
462
- }
463
- }
464
- else if ((!isProp ) &&
465
- memberName[0] === 'o' &&
466
- memberName[1] === 'n') {
467
- // Event Handlers
468
- // so if the member name starts with "on" and the 3rd characters is
469
- // a capital letter, and it's not already a member on the element,
470
- // then we're assuming it's an event listener
471
- if (memberName[2] === '-') {
472
- // on- prefixed events
473
- // allows to be explicit about the dom event to listen without any magic
474
- // under the hood:
475
- // <my-cmp on-click> // listens for "click"
476
- // <my-cmp on-Click> // listens for "Click"
477
- // <my-cmp on-ionChange> // listens for "ionChange"
478
- // <my-cmp on-EVENTS> // listens for "EVENTS"
479
- memberName = memberName.slice(3);
480
- }
481
- else if (isMemberInElement(win, ln)) {
482
- // standard event
483
- // the JSX attribute could have been "onMouseOver" and the
484
- // member name "onmouseover" is on the window's prototype
485
- // so let's add the listener "mouseover", which is all lowercased
486
- memberName = ln.slice(2);
487
- }
488
- else {
489
- // custom event
490
- // the JSX attribute could have been "onMyCustomEvent"
491
- // so let's trim off the "on" prefix and lowercase the first character
492
- // and add the listener "myCustomEvent"
493
- // except for the first character, we keep the event name case
494
- memberName = ln[2] + memberName.slice(3);
495
- }
496
- if (oldValue || newValue) {
497
- // Need to account for "capture" events.
498
- // If the event name ends with "Capture", we'll update the name to remove
499
- // the "Capture" suffix and make sure the event listener is setup to handle the capture event.
500
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
501
- // Make sure we only replace the last instance of "Capture"
502
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, '');
503
- if (oldValue) {
504
- plt.rel(elm, memberName, oldValue, capture);
505
- }
506
- if (newValue) {
507
- plt.ael(elm, memberName, newValue, capture);
508
- }
509
- }
510
- }
511
- else {
512
- // Set property if it exists and it's not a SVG
513
- const isComplex = isComplexType(newValue);
514
- if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
515
- try {
516
- if (!elm.tagName.includes('-')) {
517
- const n = newValue == null ? '' : newValue;
518
- // Workaround for Safari, moving the <input> caret when re-assigning the same valued
519
- if (memberName === 'list') {
520
- isProp = false;
521
- }
522
- else if (oldValue == null || elm[memberName] != n) {
523
- elm[memberName] = n;
524
- }
525
- }
526
- else {
527
- elm[memberName] = newValue;
528
- }
529
- }
530
- catch (e) {
531
- /**
532
- * in case someone tries to set a read-only property, e.g. "namespaceURI", we just ignore it
533
- */
534
- }
535
- }
536
- /**
537
- * Need to manually update attribute if:
538
- * - memberName is not an attribute
539
- * - if we are rendering the host element in order to reflect attribute
540
- * - if it's a SVG, since properties might not work in <svg>
541
- * - if the newValue is null/undefined or 'false'.
542
- */
543
- let xlink = false;
544
- {
545
- if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
546
- memberName = ln;
547
- xlink = true;
548
- }
549
- }
550
- if (newValue == null || newValue === false) {
551
- if (newValue !== false || elm.getAttribute(memberName) === '') {
552
- if (xlink) {
553
- elm.removeAttributeNS(XLINK_NS, memberName);
554
- }
555
- else {
556
- elm.removeAttribute(memberName);
557
- }
558
- }
559
- }
560
- else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
561
- newValue = newValue === true ? '' : newValue;
562
- if (xlink) {
563
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
564
- }
565
- else {
566
- elm.setAttribute(memberName, newValue);
567
- }
568
- }
569
- }
570
- }
571
- };
572
- const parseClassListRegex = /\s/;
573
- /**
574
- * Parsed a string of classnames into an array
575
- * @param value className string, e.g. "foo bar baz"
576
- * @returns list of classes, e.g. ["foo", "bar", "baz"]
577
- */
578
- const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
579
- const CAPTURE_EVENT_SUFFIX = 'Capture';
580
- const CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + '$');
581
- const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
582
- // if the element passed in is a shadow root, which is a document fragment
583
- // then we want to be adding attrs/props to the shadow root's "host" element
584
- // if it's not a shadow root, then we add attrs/props to the same element
585
- const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
586
- ? newVnode.$elm$.host
587
- : newVnode.$elm$;
588
- const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
589
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
590
- {
591
- // remove attributes no longer present on the vnode by setting them to undefined
592
- for (memberName in oldVnodeAttrs) {
593
- if (!(memberName in newVnodeAttrs)) {
594
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
595
- }
596
- }
597
- }
598
- // add new & update changed attributes
599
- for (memberName in newVnodeAttrs) {
600
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
601
- }
602
- };
603
- /**
604
- * Create a DOM Node corresponding to one of the children of a given VNode.
605
- *
606
- * @param oldParentVNode the parent VNode from the previous render
607
- * @param newParentVNode the parent VNode from the current render
608
- * @param childIndex the index of the VNode, in the _new_ parent node's
609
- * children, for which we will create a new DOM node
610
- * @param parentElm the parent DOM node which our new node will be a child of
611
- * @returns the newly created node
612
- */
613
- const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
614
- var _a;
615
- // tslint:disable-next-line: prefer-const
616
- const newVNode = newParentVNode.$children$[childIndex];
617
- let i = 0;
618
- let elm;
619
- let childNode;
620
- let oldVNode;
621
- if (!useNativeShadowDom) {
622
- // remember for later we need to check to relocate nodes
623
- checkSlotRelocate = true;
624
- if (newVNode.$tag$ === 'slot') {
625
- if (scopeId) {
626
- // scoped css needs to add its scoped id to the parent element
627
- parentElm.classList.add(scopeId + '-s');
628
- }
629
- newVNode.$flags$ |= newVNode.$children$
630
- ? // slot element has fallback content
631
- 2 /* VNODE_FLAGS.isSlotFallback */
632
- : // slot element does not have fallback content
633
- 1 /* VNODE_FLAGS.isSlotReference */;
634
- }
635
- }
636
- if (newVNode.$text$ !== null) {
637
- // create text node
638
- elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
639
- }
640
- else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
641
- // create a slot reference node
642
- elm = newVNode.$elm$ =
643
- doc.createTextNode('');
644
- }
645
- else {
646
- if (!isSvgMode) {
647
- isSvgMode = newVNode.$tag$ === 'svg';
648
- }
649
- // create element
650
- elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
651
- ? 'slot-fb'
652
- : newVNode.$tag$)
653
- );
654
- if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
655
- isSvgMode = false;
656
- }
657
- // add css classes, attrs, props, listeners, etc.
658
- {
659
- updateElement(null, newVNode, isSvgMode);
660
- }
661
- if (isDef(scopeId) && elm['s-si'] !== scopeId) {
662
- // if there is a scopeId and this is the initial render
663
- // then let's add the scopeId as a css class
664
- elm.classList.add((elm['s-si'] = scopeId));
665
- }
666
- if (newVNode.$children$) {
667
- for (i = 0; i < newVNode.$children$.length; ++i) {
668
- // create the node
669
- childNode = createElm(oldParentVNode, newVNode, i, elm);
670
- // return node could have been null
671
- if (childNode) {
672
- // append our new node
673
- elm.appendChild(childNode);
674
- }
675
- }
676
- }
677
- {
678
- if (newVNode.$tag$ === 'svg') {
679
- // Only reset the SVG context when we're exiting <svg> element
680
- isSvgMode = false;
681
- }
682
- else if (elm.tagName === 'foreignObject') {
683
- // Reenter SVG context when we're exiting <foreignObject> element
684
- isSvgMode = true;
685
- }
686
- }
687
- }
688
- // This needs to always happen so we can hide nodes that are projected
689
- // to another component but don't end up in a slot
690
- elm['s-hn'] = hostTagName;
691
- {
692
- if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
693
- // remember the content reference comment
694
- elm['s-sr'] = true;
695
- // Persist the name of the slot that this slot was going to be projected into.
696
- elm['s-fs'] = (_a = newVNode.$attrs$) === null || _a === void 0 ? void 0 : _a.slot;
697
- // remember the content reference comment
698
- elm['s-cr'] = contentRef;
699
- // remember the slot name, or empty string for default slot
700
- elm['s-sn'] = newVNode.$name$ || '';
701
- // check if we've got an old vnode for this slot
702
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
703
- if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
704
- {
705
- // we've got an old slot vnode and the wrapper is being replaced
706
- // so let's move the old slot content back to its original location
707
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
708
- }
709
- }
710
- }
711
- }
712
- return elm;
713
- };
714
- const putBackInOriginalLocation = (parentElm, recursive) => {
715
- var _a;
716
- plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
717
- const oldSlotChildNodes = parentElm.childNodes;
718
- for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
719
- const childNode = oldSlotChildNodes[i];
720
- if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
721
- // and relocate it back to it's original location
722
- parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
723
- // remove the old original location comment entirely
724
- // later on the patch function will know what to do
725
- // and move this to the correct spot if need be
726
- childNode['s-ol'].remove();
727
- childNode['s-ol'] = undefined;
728
- // Reset so we can correctly move the node around again.
729
- childNode['s-sh'] = undefined;
730
- // When putting an element node back in its original location,
731
- // we need to reset the `slot` attribute back to the value it originally had
732
- // so we can correctly relocate it again in the future
733
- if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
734
- childNode.setAttribute('slot', (_a = childNode['s-sn']) !== null && _a !== void 0 ? _a : '');
735
- }
736
- checkSlotRelocate = true;
737
- }
738
- if (recursive) {
739
- putBackInOriginalLocation(childNode, recursive);
740
- }
741
- }
742
- plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
743
- };
744
- /**
745
- * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
746
- * add them to the DOM in the appropriate place.
747
- *
748
- * @param parentElm the DOM node which should be used as a parent for the new
749
- * DOM nodes
750
- * @param before a child of the `parentElm` which the new children should be
751
- * inserted before (optional)
752
- * @param parentVNode the parent virtual DOM node
753
- * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
754
- * @param startIdx the index in the child virtual DOM nodes at which to start
755
- * creating DOM nodes (inclusive)
756
- * @param endIdx the index in the child virtual DOM nodes at which to stop
757
- * creating DOM nodes (inclusive)
758
- */
759
- const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
760
- let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
761
- let childNode;
762
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
763
- containerElm = containerElm.shadowRoot;
764
- }
765
- for (; startIdx <= endIdx; ++startIdx) {
766
- if (vnodes[startIdx]) {
767
- childNode = createElm(null, parentVNode, startIdx, parentElm);
768
- if (childNode) {
769
- vnodes[startIdx].$elm$ = childNode;
770
- containerElm.insertBefore(childNode, referenceNode(before) );
771
- }
772
- }
773
- }
774
- };
775
- /**
776
- * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
777
- * This can be used to, for instance, clean up after a list of children which
778
- * should no longer be shown.
779
- *
780
- * This function also handles some of Stencil's slot relocation logic.
781
- *
782
- * @param vnodes a list of virtual DOM nodes to remove
783
- * @param startIdx the index at which to start removing nodes (inclusive)
784
- * @param endIdx the index at which to stop removing nodes (inclusive)
785
- */
786
- const removeVnodes = (vnodes, startIdx, endIdx) => {
787
- for (let index = startIdx; index <= endIdx; ++index) {
788
- const vnode = vnodes[index];
789
- if (vnode) {
790
- const elm = vnode.$elm$;
791
- nullifyVNodeRefs(vnode);
792
- if (elm) {
793
- {
794
- // we're removing this element
795
- // so it's possible we need to show slot fallback content now
796
- checkSlotFallbackVisibility = true;
797
- if (elm['s-ol']) {
798
- // remove the original location comment
799
- elm['s-ol'].remove();
800
- }
801
- else {
802
- // it's possible that child nodes of the node
803
- // that's being removed are slot nodes
804
- putBackInOriginalLocation(elm, true);
805
- }
806
- }
807
- // remove the vnode's element from the dom
808
- elm.remove();
809
- }
810
- }
811
- }
812
- };
813
- /**
814
- * Reconcile the children of a new VNode with the children of an old VNode by
815
- * traversing the two collections of children, identifying nodes that are
816
- * conserved or changed, calling out to `patch` to make any necessary
817
- * updates to the DOM, and rearranging DOM nodes as needed.
818
- *
819
- * The algorithm for reconciling children works by analyzing two 'windows' onto
820
- * the two arrays of children (`oldCh` and `newCh`). We keep track of the
821
- * 'windows' by storing start and end indices and references to the
822
- * corresponding array entries. Initially the two 'windows' are basically equal
823
- * to the entire array, but we progressively narrow the windows until there are
824
- * no children left to update by doing the following:
825
- *
826
- * 1. Skip any `null` entries at the beginning or end of the two arrays, so
827
- * that if we have an initial array like the following we'll end up dealing
828
- * only with a window bounded by the highlighted elements:
829
- *
830
- * [null, null, VNode1 , ... , VNode2, null, null]
831
- * ^^^^^^ ^^^^^^
832
- *
833
- * 2. Check to see if the elements at the head and tail positions are equal
834
- * across the windows. This will basically detect elements which haven't
835
- * been added, removed, or changed position, i.e. if you had the following
836
- * VNode elements (represented as HTML):
837
- *
838
- * oldVNode: `<div><p><span>HEY</span></p></div>`
839
- * newVNode: `<div><p><span>THERE</span></p></div>`
840
- *
841
- * Then when comparing the children of the `<div>` tag we check the equality
842
- * of the VNodes corresponding to the `<p>` tags and, since they are the
843
- * same tag in the same position, we'd be able to avoid completely
844
- * re-rendering the subtree under them with a new DOM element and would just
845
- * call out to `patch` to handle reconciling their children and so on.
846
- *
847
- * 3. Check, for both windows, to see if the element at the beginning of the
848
- * window corresponds to the element at the end of the other window. This is
849
- * a heuristic which will let us identify _some_ situations in which
850
- * elements have changed position, for instance it _should_ detect that the
851
- * children nodes themselves have not changed but merely moved in the
852
- * following example:
853
- *
854
- * oldVNode: `<div><element-one /><element-two /></div>`
855
- * newVNode: `<div><element-two /><element-one /></div>`
856
- *
857
- * If we find cases like this then we also need to move the concrete DOM
858
- * elements corresponding to the moved children to write the re-order to the
859
- * DOM.
860
- *
861
- * 4. Finally, if VNodes have the `key` attribute set on them we check for any
862
- * nodes in the old children which have the same key as the first element in
863
- * our window on the new children. If we find such a node we handle calling
864
- * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
865
- * what we find.
866
- *
867
- * Finally, once we've narrowed our 'windows' to the point that either of them
868
- * collapse (i.e. they have length 0) we then handle any remaining VNode
869
- * insertion or deletion that needs to happen to get a DOM state that correctly
870
- * reflects the new child VNodes. If, for instance, after our window on the old
871
- * children has collapsed we still have more nodes on the new children that
872
- * we haven't dealt with yet then we need to add them, or if the new children
873
- * collapse but we still have unhandled _old_ children then we need to make
874
- * sure the corresponding DOM nodes are removed.
875
- *
876
- * @param parentElm the node into which the parent VNode is rendered
877
- * @param oldCh the old children of the parent node
878
- * @param newVNode the new VNode which will replace the parent
879
- * @param newCh the new children of the parent node
880
- */
881
- const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
882
- let oldStartIdx = 0;
883
- let newStartIdx = 0;
884
- let idxInOld = 0;
885
- let i = 0;
886
- let oldEndIdx = oldCh.length - 1;
887
- let oldStartVnode = oldCh[0];
888
- let oldEndVnode = oldCh[oldEndIdx];
889
- let newEndIdx = newCh.length - 1;
890
- let newStartVnode = newCh[0];
891
- let newEndVnode = newCh[newEndIdx];
892
- let node;
893
- let elmToMove;
894
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
895
- if (oldStartVnode == null) {
896
- // VNode might have been moved left
897
- oldStartVnode = oldCh[++oldStartIdx];
898
- }
899
- else if (oldEndVnode == null) {
900
- oldEndVnode = oldCh[--oldEndIdx];
901
- }
902
- else if (newStartVnode == null) {
903
- newStartVnode = newCh[++newStartIdx];
904
- }
905
- else if (newEndVnode == null) {
906
- newEndVnode = newCh[--newEndIdx];
907
- }
908
- else if (isSameVnode(oldStartVnode, newStartVnode)) {
909
- // if the start nodes are the same then we should patch the new VNode
910
- // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
911
- // indices to reflect that. We don't need to move any DOM Nodes around
912
- // since things are matched up in order.
913
- patch(oldStartVnode, newStartVnode);
914
- oldStartVnode = oldCh[++oldStartIdx];
915
- newStartVnode = newCh[++newStartIdx];
916
- }
917
- else if (isSameVnode(oldEndVnode, newEndVnode)) {
918
- // likewise, if the end nodes are the same we patch new onto old and
919
- // decrement our end indices, and also likewise in this case we don't
920
- // need to move any DOM Nodes.
921
- patch(oldEndVnode, newEndVnode);
922
- oldEndVnode = oldCh[--oldEndIdx];
923
- newEndVnode = newCh[--newEndIdx];
924
- }
925
- else if (isSameVnode(oldStartVnode, newEndVnode)) {
926
- // case: "Vnode moved right"
927
- //
928
- // We've found that the last node in our window on the new children is
929
- // the same VNode as the _first_ node in our window on the old children
930
- // we're dealing with now. Visually, this is the layout of these two
931
- // nodes:
932
- //
933
- // newCh: [..., newStartVnode , ... , newEndVnode , ...]
934
- // ^^^^^^^^^^^
935
- // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
936
- // ^^^^^^^^^^^^^
937
- //
938
- // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
939
- // and move the DOM element for `oldStartVnode`.
940
- if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
941
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
942
- }
943
- patch(oldStartVnode, newEndVnode);
944
- // We need to move the element for `oldStartVnode` into a position which
945
- // will be appropriate for `newEndVnode`. For this we can use
946
- // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
947
- // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
948
- // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
949
- //
950
- // <old-start-node />
951
- // <some-intervening-node />
952
- // <old-end-node />
953
- // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
954
- // <next-sibling />
955
- //
956
- // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
957
- // the node for `oldStartVnode` at the end of the children of
958
- // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
959
- // aren't any siblings, and passing `null` to `Node.insertBefore` will
960
- // append it to the children of the parent element.
961
- parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
962
- oldStartVnode = oldCh[++oldStartIdx];
963
- newEndVnode = newCh[--newEndIdx];
964
- }
965
- else if (isSameVnode(oldEndVnode, newStartVnode)) {
966
- // case: "Vnode moved left"
967
- //
968
- // We've found that the first node in our window on the new children is
969
- // the same VNode as the _last_ node in our window on the old children.
970
- // Visually, this is the layout of these two nodes:
971
- //
972
- // newCh: [..., newStartVnode , ... , newEndVnode , ...]
973
- // ^^^^^^^^^^^^^
974
- // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
975
- // ^^^^^^^^^^^
976
- //
977
- // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
978
- // (which will handle updating any changed attributes, reconciling their
979
- // children etc) but we also need to move the DOM node to which
980
- // `oldEndVnode` corresponds.
981
- if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
982
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
983
- }
984
- patch(oldEndVnode, newStartVnode);
985
- // We've already checked above if `oldStartVnode` and `newStartVnode` are
986
- // the same node, so since we're here we know that they are not. Thus we
987
- // can move the element for `oldEndVnode` _before_ the element for
988
- // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
989
- // future.
990
- parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
991
- oldEndVnode = oldCh[--oldEndIdx];
992
- newStartVnode = newCh[++newStartIdx];
993
- }
994
- else {
995
- // Here we do some checks to match up old and new nodes based on the
996
- // `$key$` attribute, which is set by putting a `key="my-key"` attribute
997
- // in the JSX for a DOM element in the implementation of a Stencil
998
- // component.
999
- //
1000
- // First we check to see if there are any nodes in the array of old
1001
- // children which have the same key as the first node in the new
1002
- // children.
1003
- idxInOld = -1;
1004
- {
1005
- for (i = oldStartIdx; i <= oldEndIdx; ++i) {
1006
- if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
1007
- idxInOld = i;
1008
- break;
1009
- }
1010
- }
1011
- }
1012
- if (idxInOld >= 0) {
1013
- // We found a node in the old children which matches up with the first
1014
- // node in the new children! So let's deal with that
1015
- elmToMove = oldCh[idxInOld];
1016
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1017
- // the tag doesn't match so we'll need a new DOM element
1018
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
1019
- }
1020
- else {
1021
- patch(elmToMove, newStartVnode);
1022
- // invalidate the matching old node so that we won't try to update it
1023
- // again later on
1024
- oldCh[idxInOld] = undefined;
1025
- node = elmToMove.$elm$;
1026
- }
1027
- newStartVnode = newCh[++newStartIdx];
1028
- }
1029
- else {
1030
- // We either didn't find an element in the old children that matches
1031
- // the key of the first new child OR the build is not using `key`
1032
- // attributes at all. In either case we need to create a new element
1033
- // for the new node.
1034
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
1035
- newStartVnode = newCh[++newStartIdx];
1036
- }
1037
- if (node) {
1038
- // if we created a new node then handle inserting it to the DOM
1039
- {
1040
- parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
1041
- }
1042
- }
1043
- }
1044
- }
1045
- if (oldStartIdx > oldEndIdx) {
1046
- // we have some more new nodes to add which don't match up with old nodes
1047
- addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
1048
- }
1049
- else if (newStartIdx > newEndIdx) {
1050
- // there are nodes in the `oldCh` array which no longer correspond to nodes
1051
- // in the new array, so lets remove them (which entails cleaning up the
1052
- // relevant DOM nodes)
1053
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1054
- }
1055
- };
1056
- /**
1057
- * Compare two VNodes to determine if they are the same
1058
- *
1059
- * **NB**: This function is an equality _heuristic_ based on the available
1060
- * information set on the two VNodes and can be misleading under certain
1061
- * circumstances. In particular, if the two nodes do not have `key` attrs
1062
- * (available under `$key$` on VNodes) then the function falls back on merely
1063
- * checking that they have the same tag.
1064
- *
1065
- * So, in other words, if `key` attrs are not set on VNodes which may be
1066
- * changing order within a `children` array or something along those lines then
1067
- * we could obtain a false negative and then have to do needless re-rendering
1068
- * (i.e. we'd say two VNodes aren't equal when in fact they should be).
1069
- *
1070
- * @param leftVNode the first VNode to check
1071
- * @param rightVNode the second VNode to check
1072
- * @returns whether they're equal or not
1073
- */
1074
- const isSameVnode = (leftVNode, rightVNode) => {
1075
- // compare if two vnode to see if they're "technically" the same
1076
- // need to have the same element tag, and same key to be the same
1077
- if (leftVNode.$tag$ === rightVNode.$tag$) {
1078
- if (leftVNode.$tag$ === 'slot') {
1079
- return leftVNode.$name$ === rightVNode.$name$;
1080
- }
1081
- // this will be set if components in the build have `key` attrs set on them
1082
- {
1083
- return leftVNode.$key$ === rightVNode.$key$;
1084
- }
1085
- }
1086
- return false;
1087
- };
1088
- const referenceNode = (node) => {
1089
- // this node was relocated to a new location in the dom
1090
- // because of some other component's slot
1091
- // but we still have an html comment in place of where
1092
- // it's original location was according to it's original vdom
1093
- return (node && node['s-ol']) || node;
1094
- };
1095
- const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
1096
- /**
1097
- * Handle reconciling an outdated VNode with a new one which corresponds to
1098
- * it. This function handles flushing updates to the DOM and reconciling the
1099
- * children of the two nodes (if any).
1100
- *
1101
- * @param oldVNode an old VNode whose DOM element and children we want to update
1102
- * @param newVNode a new VNode representing an updated version of the old one
1103
- */
1104
- const patch = (oldVNode, newVNode) => {
1105
- const elm = (newVNode.$elm$ = oldVNode.$elm$);
1106
- const oldChildren = oldVNode.$children$;
1107
- const newChildren = newVNode.$children$;
1108
- const tag = newVNode.$tag$;
1109
- const text = newVNode.$text$;
1110
- let defaultHolder;
1111
- if (text === null) {
1112
- {
1113
- // test if we're rendering an svg element, or still rendering nodes inside of one
1114
- // only add this to the when the compiler sees we're using an svg somewhere
1115
- isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
1116
- }
1117
- {
1118
- if (tag === 'slot')
1119
- ;
1120
- else {
1121
- // either this is the first render of an element OR it's an update
1122
- // AND we already know it's possible it could have changed
1123
- // this updates the element's css classes, attrs, props, listeners, etc.
1124
- updateElement(oldVNode, newVNode, isSvgMode);
1125
- }
1126
- }
1127
- if (oldChildren !== null && newChildren !== null) {
1128
- // looks like there's child vnodes for both the old and new vnodes
1129
- // so we need to call `updateChildren` to reconcile them
1130
- updateChildren(elm, oldChildren, newVNode, newChildren);
1131
- }
1132
- else if (newChildren !== null) {
1133
- // no old child vnodes, but there are new child vnodes to add
1134
- if (oldVNode.$text$ !== null) {
1135
- // the old vnode was text, so be sure to clear it out
1136
- elm.textContent = '';
1137
- }
1138
- // add the new vnode children
1139
- addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
1140
- }
1141
- else if (oldChildren !== null) {
1142
- // no new child vnodes, but there are old child vnodes to remove
1143
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
1144
- }
1145
- if (isSvgMode && tag === 'svg') {
1146
- isSvgMode = false;
1147
- }
1148
- }
1149
- else if ((defaultHolder = elm['s-cr'])) {
1150
- // this element has slotted content
1151
- defaultHolder.parentNode.textContent = text;
1152
- }
1153
- else if (oldVNode.$text$ !== text) {
1154
- // update the text content for the text only vnode
1155
- // and also only if the text is different than before
1156
- elm.data = text;
1157
- }
1158
- };
1159
- /**
1160
- * Adjust the `.hidden` property as-needed on any nodes in a DOM subtree which
1161
- * are slot fallbacks nodes.
1162
- *
1163
- * A slot fallback node should be visible by default. Then, it should be
1164
- * conditionally hidden if:
1165
- *
1166
- * - it has a sibling with a `slot` property set to its slot name or if
1167
- * - it is a default fallback slot node, in which case we hide if it has any
1168
- * content
1169
- *
1170
- * @param elm the element of interest
1171
- */
1172
- const updateFallbackSlotVisibility = (elm) => {
1173
- const childNodes = elm.childNodes;
1174
- for (const childNode of childNodes) {
1175
- if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1176
- if (childNode['s-sr']) {
1177
- // this is a slot fallback node
1178
- // get the slot name for this slot reference node
1179
- const slotName = childNode['s-sn'];
1180
- // by default always show a fallback slot node
1181
- // then hide it if there are other slots in the light dom
1182
- childNode.hidden = false;
1183
- // we need to check all of its sibling nodes in order to see if
1184
- // `childNode` should be hidden
1185
- for (const siblingNode of childNodes) {
1186
- // Don't check the node against itself
1187
- if (siblingNode !== childNode) {
1188
- if (siblingNode['s-hn'] !== childNode['s-hn'] || slotName !== '') {
1189
- // this sibling node is from a different component OR is a named
1190
- // fallback slot node
1191
- if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
1192
- (slotName === siblingNode.getAttribute('slot') || slotName === siblingNode['s-sn'])) {
1193
- childNode.hidden = true;
1194
- break;
1195
- }
1196
- }
1197
- else {
1198
- // this is a default fallback slot node
1199
- // any element or text node (with content)
1200
- // should hide the default fallback slot node
1201
- if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ ||
1202
- (siblingNode.nodeType === 3 /* NODE_TYPE.TextNode */ && siblingNode.textContent.trim() !== '')) {
1203
- childNode.hidden = true;
1204
- break;
1205
- }
1206
- }
1207
- }
1208
- }
1209
- }
1210
- // keep drilling down
1211
- updateFallbackSlotVisibility(childNode);
1212
- }
1213
- }
1214
- };
1215
- /**
1216
- * Component-global information about nodes which are either currently being
1217
- * relocated or will be shortly.
1218
- */
1219
- const relocateNodes = [];
1220
- /**
1221
- * Mark the contents of a slot for relocation via adding references to them to
1222
- * the {@link relocateNodes} data structure. The actual work of relocating them
1223
- * will then be handled in {@link renderVdom}.
1224
- *
1225
- * @param elm a render node whose child nodes need to be relocated
1226
- */
1227
- const markSlotContentForRelocation = (elm) => {
1228
- // tslint:disable-next-line: prefer-const
1229
- let node;
1230
- let hostContentNodes;
1231
- let j;
1232
- for (const childNode of elm.childNodes) {
1233
- // we need to find child nodes which are slot references so we can then try
1234
- // to match them up with nodes that need to be relocated
1235
- if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
1236
- // first get the content reference comment node ('s-cr'), then we get
1237
- // its parent, which is where all the host content is now
1238
- hostContentNodes = node.parentNode.childNodes;
1239
- const slotName = childNode['s-sn'];
1240
- // iterate through all the nodes under the location where the host was
1241
- // originally rendered
1242
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
1243
- node = hostContentNodes[j];
1244
- // check that the node is not a content reference node or a node
1245
- // reference and then check that the host name does not match that of
1246
- // childNode.
1247
- // In addition, check that the slot either has not already been relocated, or
1248
- // that its current location's host is not childNode's host. This is essentially
1249
- // a check so that we don't try to relocate (and then hide) a node that is already
1250
- // where it should be.
1251
- if (!node['s-cn'] &&
1252
- !node['s-nr'] &&
1253
- node['s-hn'] !== childNode['s-hn'] &&
1254
- (!BUILD.experimentalSlotFixes )) {
1255
- // if `node` is located in the slot that `childNode` refers to (via the
1256
- // `'s-sn'` property) then we need to relocate it from it's current spot
1257
- // (under the host element parent) to the right slot location
1258
- if (isNodeLocatedInSlot(node, slotName)) {
1259
- // it's possible we've already decided to relocate this node
1260
- let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1261
- // made some changes to slots
1262
- // let's make sure we also double check
1263
- // fallbacks are correctly hidden or shown
1264
- checkSlotFallbackVisibility = true;
1265
- // ensure that the slot-name attr is correct
1266
- node['s-sn'] = node['s-sn'] || slotName;
1267
- if (relocateNodeData) {
1268
- relocateNodeData.$nodeToRelocate$['s-sh'] = childNode['s-hn'];
1269
- // we marked this node for relocation previously but didn't find
1270
- // out the slot reference node to which it needs to be relocated
1271
- // so write it down now!
1272
- relocateNodeData.$slotRefNode$ = childNode;
1273
- }
1274
- else {
1275
- node['s-sh'] = childNode['s-hn'];
1276
- // add to our list of nodes to relocate
1277
- relocateNodes.push({
1278
- $slotRefNode$: childNode,
1279
- $nodeToRelocate$: node,
1280
- });
1281
- }
1282
- if (node['s-sr']) {
1283
- relocateNodes.map((relocateNode) => {
1284
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
1285
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1286
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
1287
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1288
- }
1289
- }
1290
- });
1291
- }
1292
- }
1293
- else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1294
- // the node is not found within the slot (`childNode`) that we're
1295
- // currently looking at, so we stick it into `relocateNodes` to
1296
- // handle later. If we never find a home for this element then
1297
- // we'll need to hide it
1298
- relocateNodes.push({
1299
- $nodeToRelocate$: node,
1300
- });
1301
- }
1302
- }
1303
- }
1304
- }
1305
- // if we're dealing with any type of element (capable of itself being a
1306
- // slot reference or containing one) then we recur
1307
- if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1308
- markSlotContentForRelocation(childNode);
1309
- }
1310
- }
1311
- };
1312
- /**
1313
- * Check whether a node is located in a given named slot.
1314
- *
1315
- * @param nodeToRelocate the node of interest
1316
- * @param slotName the slot name to check
1317
- * @returns whether the node is located in the slot or not
1318
- */
1319
- const isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
1320
- if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1321
- if (nodeToRelocate.getAttribute('slot') === null && slotName === '') {
1322
- // if the node doesn't have a slot attribute, and the slot we're checking
1323
- // is not a named slot, then we assume the node should be within the slot
1324
- return true;
1325
- }
1326
- if (nodeToRelocate.getAttribute('slot') === slotName) {
1327
- return true;
1328
- }
1329
- return false;
1330
- }
1331
- if (nodeToRelocate['s-sn'] === slotName) {
1332
- return true;
1333
- }
1334
- return slotName === '';
1335
- };
1336
- /**
1337
- * 'Nullify' any VDom `ref` callbacks on a VDom node or its children by calling
1338
- * them with `null`. This signals that the DOM element corresponding to the VDom
1339
- * node has been removed from the DOM.
1340
- *
1341
- * @param vNode a virtual DOM node
1342
- */
1343
- const nullifyVNodeRefs = (vNode) => {
1344
- {
1345
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1346
- vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1347
- }
1348
- };
1349
- /**
1350
- * The main entry point for Stencil's virtual DOM-based rendering engine
1351
- *
1352
- * Given a {@link d.HostRef} container and some virtual DOM nodes, this
1353
- * function will handle creating a virtual DOM tree with a single root, patching
1354
- * the current virtual DOM tree onto an old one (if any), dealing with slot
1355
- * relocation, and reflecting attributes.
1356
- *
1357
- * @param hostRef data needed to root and render the virtual DOM tree, such as
1358
- * the DOM node into which it should be rendered.
1359
- * @param renderFnResults the virtual DOM nodes to be rendered
1360
- * @param isInitialLoad whether or not this is the first call after page load
1361
- */
1362
- const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1363
- var _a, _b, _c, _d;
1364
- const hostElm = hostRef.$hostElement$;
1365
- const cmpMeta = hostRef.$cmpMeta$;
1366
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1367
- // if `renderFnResults` is a Host node then we can use it directly. If not,
1368
- // we need to call `h` again to wrap the children of our component in a
1369
- // 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
1370
- // implicitly that the top-level vdom node is 1) an only child and 2)
1371
- // contains attrs that need to be set on the host element.
1372
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1373
- hostTagName = hostElm.tagName;
1374
- if (cmpMeta.$attrsToReflect$) {
1375
- rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1376
- cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
1377
- }
1378
- // On the first render and *only* on the first render we want to check for
1379
- // any attributes set on the host element which are also set on the vdom
1380
- // node. If we find them, we override the value on the VDom node attrs with
1381
- // the value from the host element, which allows developers building apps
1382
- // with Stencil components to override e.g. the `role` attribute on a
1383
- // component even if it's already set on the `Host`.
1384
- if (isInitialLoad && rootVnode.$attrs$) {
1385
- for (const key of Object.keys(rootVnode.$attrs$)) {
1386
- // We have a special implementation in `setAccessor` for `style` and
1387
- // `class` which reconciles values coming from the VDom with values
1388
- // already present on the DOM element, so we don't want to override those
1389
- // attributes on the VDom tree with values from the host element if they
1390
- // are present.
1391
- //
1392
- // Likewise, `ref` and `key` are special internal values for the Stencil
1393
- // runtime and we don't want to override those either.
1394
- if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
1395
- rootVnode.$attrs$[key] = hostElm[key];
1396
- }
1397
- }
1398
- }
1399
- rootVnode.$tag$ = null;
1400
- rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1401
- hostRef.$vnode$ = rootVnode;
1402
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
1403
- {
1404
- scopeId = hostElm['s-sc'];
1405
- }
1406
- {
1407
- contentRef = hostElm['s-cr'];
1408
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1409
- // always reset
1410
- checkSlotFallbackVisibility = false;
1411
- }
1412
- // synchronous patch
1413
- patch(oldVNode, rootVnode);
1414
- {
1415
- // while we're moving nodes around existing nodes, temporarily disable
1416
- // the disconnectCallback from working
1417
- plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1418
- if (checkSlotRelocate) {
1419
- markSlotContentForRelocation(rootVnode.$elm$);
1420
- for (const relocateData of relocateNodes) {
1421
- const nodeToRelocate = relocateData.$nodeToRelocate$;
1422
- if (!nodeToRelocate['s-ol']) {
1423
- // add a reference node marking this node's original location
1424
- // keep a reference to this node for later lookups
1425
- const orgLocationNode = doc.createTextNode('');
1426
- orgLocationNode['s-nr'] = nodeToRelocate;
1427
- nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1428
- }
1429
- }
1430
- for (const relocateData of relocateNodes) {
1431
- const nodeToRelocate = relocateData.$nodeToRelocate$;
1432
- const slotRefNode = relocateData.$slotRefNode$;
1433
- if (slotRefNode) {
1434
- const parentNodeRef = slotRefNode.parentNode;
1435
- // When determining where to insert content, the most simple case would be
1436
- // to relocate the node immediately following the slot reference node. We do this
1437
- // by getting a reference to the node immediately following the slot reference node
1438
- // since we will use `insertBefore` to manipulate the DOM.
1439
- //
1440
- // If there is no node immediately following the slot reference node, then we will just
1441
- // end up appending the node as the last child of the parent.
1442
- let insertBeforeNode = slotRefNode.nextSibling;
1443
- // If the node we're currently planning on inserting the new node before is an element,
1444
- // we need to do some additional checks to make sure we're inserting the node in the correct order.
1445
- // The use case here would be that we have multiple nodes being relocated to the same slot. So, we want
1446
- // to make sure they get inserted into their new how in the same order they were declared in their original location.
1447
- //
1448
- // TODO(STENCIL-914): Remove `experimentalSlotFixes` check
1449
- {
1450
- let orgLocationNode = (_a = nodeToRelocate['s-ol']) === null || _a === void 0 ? void 0 : _a.previousSibling;
1451
- while (orgLocationNode) {
1452
- let refNode = (_b = orgLocationNode['s-nr']) !== null && _b !== void 0 ? _b : null;
1453
- if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1454
- refNode = refNode.nextSibling;
1455
- if (!refNode || !refNode['s-nr']) {
1456
- insertBeforeNode = refNode;
1457
- break;
1458
- }
1459
- }
1460
- orgLocationNode = orgLocationNode.previousSibling;
1461
- }
1462
- }
1463
- if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1464
- nodeToRelocate.nextSibling !== insertBeforeNode) {
1465
- // we've checked that it's worth while to relocate
1466
- // since that the node to relocate
1467
- // has a different next sibling or parent relocated
1468
- if (nodeToRelocate !== insertBeforeNode) {
1469
- if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
1470
- // probably a component in the index.html that doesn't have its hostname set
1471
- nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
1472
- }
1473
- // Add it back to the dom but in its new home
1474
- // If we get to this point and `insertBeforeNode` is `null`, that means
1475
- // we're just going to append the node as the last child of the parent. Passing
1476
- // `null` as the second arg here will trigger that behavior.
1477
- parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1478
- // Reset the `hidden` value back to what it was defined as originally
1479
- // This solves a problem where a `slot` is dynamically rendered and `hidden` may have
1480
- // been set on content originally, but now it has a slot to go to so it should have
1481
- // the value it was defined as having in the DOM, not what we overrode it to.
1482
- if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1483
- nodeToRelocate.hidden = (_c = nodeToRelocate['s-ih']) !== null && _c !== void 0 ? _c : false;
1484
- }
1485
- }
1486
- }
1487
- }
1488
- else {
1489
- // this node doesn't have a slot home to go to, so let's hide it
1490
- if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1491
- // Store the initial value of `hidden` so we can reset it later when
1492
- // moving nodes around.
1493
- if (isInitialLoad) {
1494
- nodeToRelocate['s-ih'] = (_d = nodeToRelocate.hidden) !== null && _d !== void 0 ? _d : false;
1495
- }
1496
- nodeToRelocate.hidden = true;
1497
- }
1498
- }
1499
- }
1500
- }
1501
- if (checkSlotFallbackVisibility) {
1502
- updateFallbackSlotVisibility(rootVnode.$elm$);
1503
- }
1504
- // done moving nodes around
1505
- // allow the disconnect callback to work again
1506
- plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1507
- // always reset
1508
- relocateNodes.length = 0;
1509
- }
1510
- };
1511
- const attachToAncestor = (hostRef, ancestorComponent) => {
1512
- if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1513
- ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1514
- }
1515
- };
1516
- const scheduleUpdate = (hostRef, isInitialLoad) => {
1517
- {
1518
- hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1519
- }
1520
- if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1521
- hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1522
- return;
1523
- }
1524
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1525
- // there is no ancestor component or the ancestor component
1526
- // has already fired off its lifecycle update then
1527
- // fire off the initial update
1528
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1529
- return writeTask(dispatch) ;
1530
- };
1531
- /**
1532
- * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
1533
- * component lifecycle methods like `componentWillLoad` as well as
1534
- * {@link updateComponent}, which will kick off the virtual DOM re-render.
1535
- *
1536
- * @param hostRef a reference to a host DOM node
1537
- * @param isInitialLoad whether we're on the initial load or not
1538
- * @returns an empty Promise which is used to enqueue a series of operations for
1539
- * the component
1540
- */
1541
- const dispatchHooks = (hostRef, isInitialLoad) => {
1542
- const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1543
- const instance = hostRef.$lazyInstance$ ;
1544
- // We're going to use this variable together with `enqueue` to implement a
1545
- // little promise-based queue. We start out with it `undefined`. When we add
1546
- // the first function to the queue we'll set this variable to be that
1547
- // function's return value. When we attempt to add subsequent values to the
1548
- // queue we'll check that value and, if it was a `Promise`, we'll then chain
1549
- // the new function off of that `Promise` using `.then()`. This will give our
1550
- // queue two nice properties:
1551
- //
1552
- // 1. If all functions added to the queue are synchronous they'll be called
1553
- // synchronously right away.
1554
- // 2. If all functions added to the queue are asynchronous they'll all be
1555
- // called in order after `dispatchHooks` exits.
1556
- let maybePromise;
1557
- if (isInitialLoad) {
1558
- {
1559
- hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1560
- if (hostRef.$queuedListeners$) {
1561
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1562
- hostRef.$queuedListeners$ = undefined;
1563
- }
1564
- }
1565
- {
1566
- // If `componentWillLoad` returns a `Promise` then we want to wait on
1567
- // whatever's going on in that `Promise` before we launch into
1568
- // rendering the component, doing other lifecycle stuff, etc. So
1569
- // in that case we assign the returned promise to the variable we
1570
- // declared above to hold a possible 'queueing' Promise
1571
- maybePromise = safeCall(instance, 'componentWillLoad');
1572
- }
1573
- }
1574
- else {
1575
- {
1576
- // Like `componentWillLoad` above, we allow Stencil component
1577
- // authors to return a `Promise` from this lifecycle callback, and
1578
- // we specify that our runtime will wait for that `Promise` to
1579
- // resolve before the component re-renders. So if the method
1580
- // returns a `Promise` we need to keep it around!
1581
- maybePromise = safeCall(instance, 'componentWillUpdate');
1582
- }
1583
- }
1584
- endSchedule();
1585
- return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1586
- };
1587
- /**
1588
- * This function uses a Promise to implement a simple first-in, first-out queue
1589
- * of functions to be called.
1590
- *
1591
- * The queue is ordered on the basis of the first argument. If it's
1592
- * `undefined`, then nothing is on the queue yet, so the provided function can
1593
- * be called synchronously (although note that this function may return a
1594
- * `Promise`). The idea is that then the return value of that enqueueing
1595
- * operation is kept around, so that if it was a `Promise` then subsequent
1596
- * functions can be enqueued by calling this function again with that `Promise`
1597
- * as the first argument.
1598
- *
1599
- * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
1600
- * @param fn a function to enqueue
1601
- * @returns either a `Promise` or the return value of the provided function
1602
- */
1603
- const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
1604
- /**
1605
- * Check that a value is a `Promise`. To check, we first see if the value is an
1606
- * instance of the `Promise` global. In a few circumstances, in particular if
1607
- * the global has been overwritten, this is could be misleading, so we also do
1608
- * a little 'duck typing' check to see if the `.then` property of the value is
1609
- * defined and a function.
1610
- *
1611
- * @param maybePromise it might be a promise!
1612
- * @returns whether it is or not
1613
- */
1614
- const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
1615
- (maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
1616
- /**
1617
- * Update a component given reference to its host elements and so on.
1618
- *
1619
- * @param hostRef an object containing references to the element's host node,
1620
- * VDom nodes, and other metadata
1621
- * @param instance a reference to the underlying host element where it will be
1622
- * rendered
1623
- * @param isInitialLoad whether or not this function is being called as part of
1624
- * the first render cycle
1625
- */
1626
- const updateComponent = async (hostRef, instance, isInitialLoad) => {
1627
- var _a;
1628
- const elm = hostRef.$hostElement$;
1629
- const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1630
- const rc = elm['s-rc'];
1631
- if (isInitialLoad) {
1632
- // DOM WRITE!
1633
- attachStyles(hostRef);
1634
- }
1635
- const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1636
- {
1637
- callRender(hostRef, instance, elm, isInitialLoad);
1638
- }
1639
- if (rc) {
1640
- // ok, so turns out there are some child host elements
1641
- // waiting on this parent element to load
1642
- // let's fire off all update callbacks waiting
1643
- rc.map((cb) => cb());
1644
- elm['s-rc'] = undefined;
1645
- }
1646
- endRender();
1647
- endUpdate();
1648
- {
1649
- const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
1650
- const postUpdate = () => postUpdateComponent(hostRef);
1651
- if (childrenPromises.length === 0) {
1652
- postUpdate();
1653
- }
1654
- else {
1655
- Promise.all(childrenPromises).then(postUpdate);
1656
- hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1657
- childrenPromises.length = 0;
1658
- }
1659
- }
1660
- };
1661
- /**
1662
- * Handle making the call to the VDom renderer with the proper context given
1663
- * various build variables
1664
- *
1665
- * @param hostRef an object containing references to the element's host node,
1666
- * VDom nodes, and other metadata
1667
- * @param instance a reference to the underlying host element where it will be
1668
- * rendered
1669
- * @param elm the Host element for the component
1670
- * @param isInitialLoad whether or not this function is being called as part of
1671
- * @returns an empty promise
1672
- */
1673
- const callRender = (hostRef, instance, elm, isInitialLoad) => {
1674
- try {
1675
- /**
1676
- * minification optimization: `allRenderFn` is `true` if all components have a `render`
1677
- * method, so we can call the method immediately. If not, check before calling it.
1678
- */
1679
- instance = instance.render && instance.render();
1680
- {
1681
- hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1682
- }
1683
- {
1684
- hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1685
- }
1686
- {
1687
- {
1688
- // looks like we've got child nodes to render into this host element
1689
- // or we need to update the css class/attrs on the host element
1690
- // DOM WRITE!
1691
- {
1692
- renderVdom(hostRef, instance, isInitialLoad);
1693
- }
1694
- }
1695
- }
1696
- }
1697
- catch (e) {
1698
- consoleError(e, hostRef.$hostElement$);
1699
- }
1700
- return null;
1701
- };
1702
- const postUpdateComponent = (hostRef) => {
1703
- const tagName = hostRef.$cmpMeta$.$tagName$;
1704
- const elm = hostRef.$hostElement$;
1705
- const endPostUpdate = createTime('postUpdate', tagName);
1706
- const instance = hostRef.$lazyInstance$ ;
1707
- const ancestorComponent = hostRef.$ancestorComponent$;
1708
- {
1709
- safeCall(instance, 'componentDidRender');
1710
- }
1711
- if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1712
- hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1713
- {
1714
- // DOM WRITE!
1715
- addHydratedFlag(elm);
1716
- }
1717
- {
1718
- safeCall(instance, 'componentDidLoad');
1719
- }
1720
- endPostUpdate();
1721
- {
1722
- hostRef.$onReadyResolve$(elm);
1723
- if (!ancestorComponent) {
1724
- appDidLoad();
1725
- }
1726
- }
1727
- }
1728
- else {
1729
- {
1730
- safeCall(instance, 'componentDidUpdate');
1731
- }
1732
- endPostUpdate();
1733
- }
1734
- {
1735
- hostRef.$onInstanceResolve$(elm);
1736
- }
1737
- // load events fire from bottom to top
1738
- // the deepest elements load first then bubbles up
1739
- {
1740
- if (hostRef.$onRenderResolve$) {
1741
- hostRef.$onRenderResolve$();
1742
- hostRef.$onRenderResolve$ = undefined;
1743
- }
1744
- if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1745
- nextTick(() => scheduleUpdate(hostRef, false));
1746
- }
1747
- hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1748
- }
1749
- // ( •_•)
1750
- // ( •_•)>⌐■-■
1751
- // (⌐■_■)
1752
- };
1753
- const forceUpdate = (ref) => {
1754
- {
1755
- const hostRef = getHostRef(ref);
1756
- const isConnected = hostRef.$hostElement$.isConnected;
1757
- if (isConnected &&
1758
- (hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1759
- scheduleUpdate(hostRef, false);
1760
- }
1761
- // Returns "true" when the forced update was successfully scheduled
1762
- return isConnected;
1763
- }
1764
- };
1765
- const appDidLoad = (who) => {
1766
- // on appload
1767
- // we have finish the first big initial render
1768
- {
1769
- addHydratedFlag(doc.documentElement);
1770
- }
1771
- nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1772
- };
1773
- /**
1774
- * Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
1775
- * e.g. custom element node. If a build figures out that e.g. no component
1776
- * has a `componentDidLoad` method, the instance method gets removed from the
1777
- * output bundle and this function returns `undefined`.
1778
- * @param instance any object that may or may not contain methods
1779
- * @param method method name
1780
- * @param arg single arbitrary argument
1781
- * @returns result of method call if it exists, otherwise `undefined`
1782
- */
1783
- const safeCall = (instance, method, arg) => {
1784
- if (instance && instance[method]) {
1785
- try {
1786
- return instance[method](arg);
1787
- }
1788
- catch (e) {
1789
- consoleError(e);
1790
- }
1791
- }
1792
- return undefined;
1793
- };
1794
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1795
- ;
1796
- const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1797
- const setValue = (ref, propName, newVal, cmpMeta) => {
1798
- // check our new property value against our internal value
1799
- const hostRef = getHostRef(ref);
1800
- const elm = hostRef.$hostElement$ ;
1801
- const oldVal = hostRef.$instanceValues$.get(propName);
1802
- const flags = hostRef.$flags$;
1803
- const instance = hostRef.$lazyInstance$ ;
1804
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1805
- // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1806
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1807
- const didValueChange = newVal !== oldVal && !areBothNaN;
1808
- if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1809
- // gadzooks! the property's value has changed!!
1810
- // set our new value!
1811
- hostRef.$instanceValues$.set(propName, newVal);
1812
- if (instance) {
1813
- // get an array of method names of watch functions to call
1814
- if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1815
- const watchMethods = cmpMeta.$watchers$[propName];
1816
- if (watchMethods) {
1817
- // this instance is watching for when this property changed
1818
- watchMethods.map((watchMethodName) => {
1819
- try {
1820
- // fire off each of the watch methods that are watching this property
1821
- instance[watchMethodName](newVal, oldVal, propName);
1822
- }
1823
- catch (e) {
1824
- consoleError(e, elm);
1825
- }
1826
- });
1827
- }
1828
- }
1829
- if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1830
- // looks like this value actually changed, so we've got work to do!
1831
- // but only if we've already rendered, otherwise just chill out
1832
- // queue that we need to do an update, but don't worry about queuing
1833
- // up millions cuz this function ensures it only runs once
1834
- scheduleUpdate(hostRef, false);
1835
- }
1836
- }
1837
- }
1838
- };
1839
- /**
1840
- * Attach a series of runtime constructs to a compiled Stencil component
1841
- * constructor, including getters and setters for the `@Prop` and `@State`
1842
- * decorators, callbacks for when attributes change, and so on.
1843
- *
1844
- * @param Cstr the constructor for a component that we need to process
1845
- * @param cmpMeta metadata collected previously about the component
1846
- * @param flags a number used to store a series of bit flags
1847
- * @returns a reference to the same constructor passed in (but now mutated)
1848
- */
1849
- const proxyComponent = (Cstr, cmpMeta, flags) => {
1850
- var _a;
1851
- const prototype = Cstr.prototype;
1852
- if (cmpMeta.$members$) {
1853
- if (Cstr.watchers) {
1854
- cmpMeta.$watchers$ = Cstr.watchers;
1855
- }
1856
- // It's better to have a const than two Object.entries()
1857
- const members = Object.entries(cmpMeta.$members$);
1858
- members.map(([memberName, [memberFlags]]) => {
1859
- if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1860
- ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1861
- // proxyComponent - prop
1862
- Object.defineProperty(prototype, memberName, {
1863
- get() {
1864
- // proxyComponent, get value
1865
- return getValue(this, memberName);
1866
- },
1867
- set(newValue) {
1868
- // proxyComponent, set value
1869
- setValue(this, memberName, newValue, cmpMeta);
1870
- },
1871
- configurable: true,
1872
- enumerable: true,
1873
- });
1874
- }
1875
- else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1876
- memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1877
- // proxyComponent - method
1878
- Object.defineProperty(prototype, memberName, {
1879
- value(...args) {
1880
- var _a;
1881
- const ref = getHostRef(this);
1882
- return (_a = ref === null || ref === void 0 ? void 0 : ref.$onInstancePromise$) === null || _a === void 0 ? void 0 : _a.then(() => { var _a; return (_a = ref.$lazyInstance$) === null || _a === void 0 ? void 0 : _a[memberName](...args); });
1883
- },
1884
- });
1885
- }
1886
- });
1887
- if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1888
- const attrNameToPropName = new Map();
1889
- prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
1890
- plt.jmp(() => {
1891
- var _a;
1892
- const propName = attrNameToPropName.get(attrName);
1893
- // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1894
- // in the case where an attribute was set inline.
1895
- // ```html
1896
- // <my-component some-attribute="some-value"></my-component>
1897
- // ```
1898
- //
1899
- // There is an edge case where a developer sets the attribute inline on a custom element and then
1900
- // programmatically changes it before it has been upgraded as shown below:
1901
- //
1902
- // ```html
1903
- // <!-- this component has _not_ been upgraded yet -->
1904
- // <my-component id="test" some-attribute="some-value"></my-component>
1905
- // <script>
1906
- // // grab non-upgraded component
1907
- // el = document.querySelector("#test");
1908
- // el.someAttribute = "another-value";
1909
- // // upgrade component
1910
- // customElements.define('my-component', MyComponent);
1911
- // </script>
1912
- // ```
1913
- // In this case if we do not un-shadow here and use the value of the shadowing property, attributeChangedCallback
1914
- // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1915
- // to the value that was set inline i.e. "some-value" from above example. When
1916
- // the connectedCallback attempts to un-shadow it will use "some-value" as the initial value rather than "another-value"
1917
- //
1918
- // The case where the attribute was NOT set inline but was not set programmatically shall be handled/un-shadowed
1919
- // by connectedCallback as this attributeChangedCallback will not fire.
1920
- //
1921
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1922
- //
1923
- // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1924
- // properties here given that this goes against best practices outlined here
1925
- // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1926
- if (this.hasOwnProperty(propName)) {
1927
- newValue = this[propName];
1928
- delete this[propName];
1929
- }
1930
- else if (prototype.hasOwnProperty(propName) &&
1931
- typeof this[propName] === 'number' &&
1932
- this[propName] == newValue) {
1933
- // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1934
- // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1935
- // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1936
- return;
1937
- }
1938
- else if (propName == null) {
1939
- // At this point we should know this is not a "member", so we can treat it like watching an attribute
1940
- // on a vanilla web component
1941
- const hostRef = getHostRef(this);
1942
- const flags = hostRef === null || hostRef === void 0 ? void 0 : hostRef.$flags$;
1943
- // We only want to trigger the callback(s) if:
1944
- // 1. The instance is ready
1945
- // 2. The watchers are ready
1946
- // 3. The value has changed
1947
- if (flags &&
1948
- !(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
1949
- flags & 128 /* HOST_FLAGS.isWatchReady */ &&
1950
- newValue !== oldValue) {
1951
- const instance = hostRef.$lazyInstance$ ;
1952
- const entry = (_a = cmpMeta.$watchers$) === null || _a === void 0 ? void 0 : _a[attrName];
1953
- entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
1954
- if (instance[callbackName] != null) {
1955
- instance[callbackName].call(instance, newValue, oldValue, attrName);
1956
- }
1957
- });
1958
- }
1959
- return;
1960
- }
1961
- this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1962
- });
1963
- };
1964
- // Create an array of attributes to observe
1965
- // This list in comprised of all strings used within a `@Watch()` decorator
1966
- // on a component as well as any Stencil-specific "members" (`@Prop()`s and `@State()`s).
1967
- // As such, there is no way to guarantee type-safety here that a user hasn't entered
1968
- // an invalid attribute.
1969
- Cstr.observedAttributes = Array.from(new Set([
1970
- ...Object.keys((_a = cmpMeta.$watchers$) !== null && _a !== void 0 ? _a : {}),
1971
- ...members
1972
- .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */)
1973
- .map(([propName, m]) => {
1974
- var _a;
1975
- const attrName = m[1] || propName;
1976
- attrNameToPropName.set(attrName, propName);
1977
- if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1978
- (_a = cmpMeta.$attrsToReflect$) === null || _a === void 0 ? void 0 : _a.push([propName, attrName]);
1979
- }
1980
- return attrName;
1981
- }),
1982
- ]));
1983
- }
1984
- }
1985
- return Cstr;
1986
- };
1987
- /**
1988
- * Initialize a Stencil component given a reference to its host element, its
1989
- * runtime bookkeeping data structure, runtime metadata about the component,
1990
- * and (optionally) an HMR version ID.
1991
- *
1992
- * @param elm a host element
1993
- * @param hostRef the element's runtime bookkeeping object
1994
- * @param cmpMeta runtime metadata for the Stencil component
1995
- * @param hmrVersionId an (optional) HMR version ID
1996
- */
1997
- const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1998
- let Cstr;
1999
- // initializeComponent
2000
- if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
2001
- // Let the runtime know that the component has been initialized
2002
- hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
2003
- {
2004
- // lazy loaded components
2005
- // request the component's implementation to be
2006
- // wired up with the host element
2007
- Cstr = loadModule(cmpMeta);
2008
- if (Cstr.then) {
2009
- // Await creates a micro-task avoid if possible
2010
- const endLoad = uniqueTime();
2011
- Cstr = await Cstr;
2012
- endLoad();
2013
- }
2014
- if (!Cstr.isProxied) {
2015
- // we've never proxied this Constructor before
2016
- // let's add the getters/setters to its prototype before
2017
- // the first time we create an instance of the implementation
2018
- {
2019
- cmpMeta.$watchers$ = Cstr.watchers;
2020
- }
2021
- proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
2022
- Cstr.isProxied = true;
2023
- }
2024
- const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
2025
- // ok, time to construct the instance
2026
- // but let's keep track of when we start and stop
2027
- // so that the getters/setters don't incorrectly step on data
2028
- {
2029
- hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
2030
- }
2031
- // construct the lazy-loaded component implementation
2032
- // passing the hostRef is very important during
2033
- // construction in order to directly wire together the
2034
- // host element and the lazy-loaded instance
2035
- try {
2036
- new Cstr(hostRef);
2037
- }
2038
- catch (e) {
2039
- consoleError(e);
2040
- }
2041
- {
2042
- hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
2043
- }
2044
- {
2045
- hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
2046
- }
2047
- endNewInstance();
2048
- }
2049
- if (Cstr.style) {
2050
- // this component has styles but we haven't registered them yet
2051
- let style = Cstr.style;
2052
- const scopeId = getScopeId(cmpMeta);
2053
- if (!styles.has(scopeId)) {
2054
- const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
2055
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
2056
- endRegisterStyles();
2057
- }
2058
- }
2059
- }
2060
- // we've successfully created a lazy instance
2061
- const ancestorComponent = hostRef.$ancestorComponent$;
2062
- const schedule = () => scheduleUpdate(hostRef, true);
2063
- if (ancestorComponent && ancestorComponent['s-rc']) {
2064
- // this is the initial load and this component it has an ancestor component
2065
- // but the ancestor component has NOT fired its will update lifecycle yet
2066
- // so let's just cool our jets and wait for the ancestor to continue first
2067
- // this will get fired off when the ancestor component
2068
- // finally gets around to rendering its lazy self
2069
- // fire off the initial update
2070
- ancestorComponent['s-rc'].push(schedule);
2071
- }
2072
- else {
2073
- schedule();
2074
- }
2075
- };
2076
- const fireConnectedCallback = (instance) => {
2077
- };
2078
- const connectedCallback = (elm) => {
2079
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
2080
- const hostRef = getHostRef(elm);
2081
- const cmpMeta = hostRef.$cmpMeta$;
2082
- const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
2083
- if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
2084
- // first time this component has connected
2085
- hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
2086
- {
2087
- // initUpdate
2088
- // if the slot polyfill is required we'll need to put some nodes
2089
- // in here to act as original content anchors as we move nodes around
2090
- // host element has been connected to the DOM
2091
- if ((// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
2092
- cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
2093
- setContentReference(elm);
2094
- }
2095
- }
2096
- {
2097
- // find the first ancestor component (if there is one) and register
2098
- // this component as one of the actively loading child components for its ancestor
2099
- let ancestorComponent = elm;
2100
- while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
2101
- // climb up the ancestors looking for the first
2102
- // component that hasn't finished its lifecycle update yet
2103
- if (ancestorComponent['s-p']) {
2104
- // we found this components first ancestor component
2105
- // keep a reference to this component's ancestor component
2106
- attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
2107
- break;
2108
- }
2109
- }
2110
- }
2111
- // Lazy properties
2112
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
2113
- if (cmpMeta.$members$) {
2114
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
2115
- if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
2116
- const value = elm[memberName];
2117
- delete elm[memberName];
2118
- elm[memberName] = value;
2119
- }
2120
- });
2121
- }
2122
- {
2123
- initializeComponent(elm, hostRef, cmpMeta);
2124
- }
2125
- }
2126
- else {
2127
- // not the first time this has connected
2128
- // reattach any event listeners to the host
2129
- // since they would have been removed when disconnected
2130
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
2131
- // fire off connectedCallback() on component instance
2132
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
2133
- else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
2134
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
2135
- }
2136
- }
2137
- endConnected();
2138
- }
2139
- };
2140
- const setContentReference = (elm) => {
2141
- // only required when we're NOT using native shadow dom (slot)
2142
- // or this browser doesn't support native shadow dom
2143
- // and this host element was NOT created with SSR
2144
- // let's pick out the inner content for slot projection
2145
- // create a node to represent where the original
2146
- // content was first placed, which is useful later on
2147
- const contentRefElm = (elm['s-cr'] = doc.createComment(''));
2148
- contentRefElm['s-cn'] = true;
2149
- elm.insertBefore(contentRefElm, elm.firstChild);
2150
- };
2151
- const disconnectInstance = (instance) => {
2152
- };
2153
- const disconnectedCallback = async (elm) => {
2154
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
2155
- const hostRef = getHostRef(elm);
2156
- {
2157
- if (hostRef.$rmListeners$) {
2158
- hostRef.$rmListeners$.map((rmListener) => rmListener());
2159
- hostRef.$rmListeners$ = undefined;
2160
- }
2161
- }
2162
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
2163
- else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
2164
- hostRef.$onReadyPromise$.then(() => disconnectInstance());
2165
- }
2166
- }
2167
- };
2168
- const bootstrapLazy = (lazyBundles, options = {}) => {
2169
- var _a;
2170
- const endBootstrap = createTime();
2171
- const cmpTags = [];
2172
- const exclude = options.exclude || [];
2173
- const customElements = win.customElements;
2174
- const head = doc.head;
2175
- const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
2176
- const dataStyles = /*@__PURE__*/ doc.createElement('style');
2177
- const deferredConnectedCallbacks = [];
2178
- let appLoadFallback;
2179
- let isBootstrapping = true;
2180
- Object.assign(plt, options);
2181
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
2182
- let hasSlotRelocation = false;
2183
- lazyBundles.map((lazyBundle) => {
2184
- lazyBundle[1].map((compactMeta) => {
2185
- var _a;
2186
- const cmpMeta = {
2187
- $flags$: compactMeta[0],
2188
- $tagName$: compactMeta[1],
2189
- $members$: compactMeta[2],
2190
- $listeners$: compactMeta[3],
2191
- };
2192
- // Check if we are using slots outside the shadow DOM in this component.
2193
- // We'll use this information later to add styles for `slot-fb` elements
2194
- if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
2195
- hasSlotRelocation = true;
2196
- }
2197
- {
2198
- cmpMeta.$members$ = compactMeta[2];
2199
- }
2200
- {
2201
- cmpMeta.$listeners$ = compactMeta[3];
2202
- }
2203
- {
2204
- cmpMeta.$attrsToReflect$ = [];
2205
- }
2206
- {
2207
- cmpMeta.$watchers$ = (_a = compactMeta[4]) !== null && _a !== void 0 ? _a : {};
2208
- }
2209
- const tagName = cmpMeta.$tagName$;
2210
- const HostElement = class extends HTMLElement {
2211
- // StencilLazyHost
2212
- constructor(self) {
2213
- // @ts-ignore
2214
- super(self);
2215
- self = this;
2216
- registerHost(self, cmpMeta);
2217
- if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2218
- // this component is using shadow dom
2219
- // and this browser supports shadow dom
2220
- // add the read-only property "shadowRoot" to the host element
2221
- // adding the shadow root build conditionals to minimize runtime
2222
- {
2223
- {
2224
- self.attachShadow({
2225
- mode: 'open',
2226
- delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
2227
- });
2228
- }
2229
- }
2230
- }
2231
- }
2232
- connectedCallback() {
2233
- if (appLoadFallback) {
2234
- clearTimeout(appLoadFallback);
2235
- appLoadFallback = null;
2236
- }
2237
- if (isBootstrapping) {
2238
- // connectedCallback will be processed once all components have been registered
2239
- deferredConnectedCallbacks.push(this);
2240
- }
2241
- else {
2242
- plt.jmp(() => connectedCallback(this));
2243
- }
2244
- }
2245
- disconnectedCallback() {
2246
- plt.jmp(() => disconnectedCallback(this));
2247
- }
2248
- componentOnReady() {
2249
- return getHostRef(this).$onReadyPromise$;
2250
- }
2251
- };
2252
- cmpMeta.$lazyBundleId$ = lazyBundle[0];
2253
- if (!exclude.includes(tagName) && !customElements.get(tagName)) {
2254
- cmpTags.push(tagName);
2255
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
2256
- }
2257
- });
2258
- });
2259
- // Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
2260
- if (hasSlotRelocation) {
2261
- dataStyles.innerHTML += SLOT_FB_CSS;
2262
- }
2263
- // Add hydration styles
2264
- {
2265
- dataStyles.innerHTML += cmpTags + HYDRATED_CSS;
2266
- }
2267
- // If we have styles, add them to the DOM
2268
- if (dataStyles.innerHTML.length) {
2269
- dataStyles.setAttribute('data-styles', '');
2270
- // Apply CSP nonce to the style tag if it exists
2271
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
2272
- if (nonce != null) {
2273
- dataStyles.setAttribute('nonce', nonce);
2274
- }
2275
- // Insert the styles into the document head
2276
- // NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
2277
- head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
2278
- }
2279
- // Process deferred connectedCallbacks now all components have been registered
2280
- isBootstrapping = false;
2281
- if (deferredConnectedCallbacks.length) {
2282
- deferredConnectedCallbacks.map((host) => host.connectedCallback());
2283
- }
2284
- else {
2285
- {
2286
- plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
2287
- }
2288
- }
2289
- // Fallback appLoad event
2290
- endBootstrap();
2291
- };
2292
- const Fragment = (_, children) => children;
2293
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
2294
- if (listeners) {
2295
- listeners.map(([flags, name, method]) => {
2296
- const target = getHostListenerTarget(elm, flags) ;
2297
- const handler = hostListenerProxy(hostRef, method);
2298
- const opts = hostListenerOpts(flags);
2299
- plt.ael(target, name, handler, opts);
2300
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
2301
- });
2302
- }
2303
- };
2304
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
2305
- try {
2306
- {
2307
- if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
2308
- // instance is ready, let's call it's member method for this event
2309
- hostRef.$lazyInstance$[methodName](ev);
2310
- }
2311
- else {
2312
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
2313
- }
2314
- }
2315
- }
2316
- catch (e) {
2317
- consoleError(e);
2318
- }
2319
- };
2320
- const getHostListenerTarget = (elm, flags) => {
2321
- if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
2322
- return doc;
2323
- if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
2324
- return win;
2325
- return elm;
2326
- };
2327
- // prettier-ignore
2328
- const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
2329
- /**
2330
- * Assigns the given value to the nonce property on the runtime platform object.
2331
- * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
2332
- * @param nonce The value to be assigned to the platform nonce property.
2333
- * @returns void
2334
- */
2335
- const setNonce = (nonce) => (plt.$nonce$ = nonce);
2336
- /**
2337
- * A WeakMap mapping runtime component references to their corresponding host reference
2338
- * instances.
2339
- */
2340
- const hostRefs = /*@__PURE__*/ new WeakMap();
2341
- /**
2342
- * Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
2343
- *
2344
- * @param ref the runtime ref of interest
2345
- * @returns the Host reference (if found) or undefined
2346
- */
2347
- const getHostRef = (ref) => hostRefs.get(ref);
2348
- /**
2349
- * Register a lazy instance with the {@link hostRefs} object so it's
2350
- * corresponding {@link d.HostRef} can be retrieved later.
2351
- *
2352
- * @param lazyInstance the lazy instance of interest
2353
- * @param hostRef that instances `HostRef` object
2354
- * @returns a reference to the host ref WeakMap
2355
- */
2356
- const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
2357
- /**
2358
- * Register a host element for a Stencil component, setting up various metadata
2359
- * and callbacks based on {@link BUILD} flags as well as the component's runtime
2360
- * metadata.
2361
- *
2362
- * @param hostElement the host element to register
2363
- * @param cmpMeta runtime metadata for that component
2364
- * @returns a reference to the host ref WeakMap
2365
- */
2366
- const registerHost = (hostElement, cmpMeta) => {
2367
- const hostRef = {
2368
- $flags$: 0,
2369
- $hostElement$: hostElement,
2370
- $cmpMeta$: cmpMeta,
2371
- $instanceValues$: new Map(),
2372
- };
2373
- {
2374
- hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
2375
- }
2376
- {
2377
- hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
2378
- hostElement['s-p'] = [];
2379
- hostElement['s-rc'] = [];
2380
- }
2381
- addHostEventListeners(hostElement, hostRef, cmpMeta.$listeners$);
2382
- return hostRefs.set(hostElement, hostRef);
2383
- };
2384
- const isMemberInElement = (elm, memberName) => memberName in elm;
2385
- const consoleError = (e, el) => (0, console.error)(e, el);
2386
- const cmpModules = /*@__PURE__*/ new Map();
2387
- const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2388
- // loadModuleImport
2389
- const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
2390
- const bundleId = cmpMeta.$lazyBundleId$;
2391
- const module = cmpModules.get(bundleId) ;
2392
- if (module) {
2393
- return module[exportName];
2394
- }
2395
-
2396
- if (!hmrVersionId || !BUILD.hotModuleReplacement) {
2397
- const processMod = importedModule => {
2398
- cmpModules.set(bundleId, importedModule);
2399
- return importedModule[exportName];
2400
- }
2401
- switch(bundleId) {
2402
-
2403
- case 'wm-button':
2404
- return import(
2405
- /* webpackMode: "lazy" */
2406
- './wm-button.entry.js').then(processMod, consoleError);
2407
- case 'wm-chart':
2408
- return import(
2409
- /* webpackMode: "lazy" */
2410
- './wm-chart.entry.js').then(processMod, consoleError);
2411
- case 'wm-datepicker':
2412
- return import(
2413
- /* webpackMode: "lazy" */
2414
- './wm-datepicker.entry.js').then(processMod, consoleError);
2415
- case 'wm-file':
2416
- return import(
2417
- /* webpackMode: "lazy" */
2418
- './wm-file.entry.js').then(processMod, consoleError);
2419
- case 'wm-file-list':
2420
- return import(
2421
- /* webpackMode: "lazy" */
2422
- './wm-file-list.entry.js').then(processMod, consoleError);
2423
- case 'wm-input':
2424
- return import(
2425
- /* webpackMode: "lazy" */
2426
- './wm-input.entry.js').then(processMod, consoleError);
2427
- case 'wm-modal':
2428
- return import(
2429
- /* webpackMode: "lazy" */
2430
- './wm-modal.entry.js').then(processMod, consoleError);
2431
- case 'wm-navigator':
2432
- return import(
2433
- /* webpackMode: "lazy" */
2434
- './wm-navigator.entry.js').then(processMod, consoleError);
2435
- case 'wm-pagination':
2436
- return import(
2437
- /* webpackMode: "lazy" */
2438
- './wm-pagination.entry.js').then(processMod, consoleError);
2439
- case 'wm-search':
2440
- return import(
2441
- /* webpackMode: "lazy" */
2442
- './wm-search.entry.js').then(processMod, consoleError);
2443
- case 'wm-snackbar':
2444
- return import(
2445
- /* webpackMode: "lazy" */
2446
- './wm-snackbar.entry.js').then(processMod, consoleError);
2447
- case 'wm-timepicker':
2448
- return import(
2449
- /* webpackMode: "lazy" */
2450
- './wm-timepicker.entry.js').then(processMod, consoleError);
2451
- case 'wm-toggletip':
2452
- return import(
2453
- /* webpackMode: "lazy" */
2454
- './wm-toggletip.entry.js').then(processMod, consoleError);
2455
- case 'wm-tag-input':
2456
- return import(
2457
- /* webpackMode: "lazy" */
2458
- './wm-tag-input.entry.js').then(processMod, consoleError);
2459
- case 'wm-tag-option':
2460
- return import(
2461
- /* webpackMode: "lazy" */
2462
- './wm-tag-option.entry.js').then(processMod, consoleError);
2463
- case 'wm-textarea':
2464
- return import(
2465
- /* webpackMode: "lazy" */
2466
- './wm-textarea.entry.js').then(processMod, consoleError);
2467
- case 'wm-uploader':
2468
- return import(
2469
- /* webpackMode: "lazy" */
2470
- './wm-uploader.entry.js').then(processMod, consoleError);
2471
- case 'wm-wrapper':
2472
- return import(
2473
- /* webpackMode: "lazy" */
2474
- './wm-wrapper.entry.js').then(processMod, consoleError);
2475
- case 'wm-action-menu_2':
2476
- return import(
2477
- /* webpackMode: "lazy" */
2478
- './wm-action-menu_2.entry.js').then(processMod, consoleError);
2479
- case 'wm-option_2':
2480
- return import(
2481
- /* webpackMode: "lazy" */
2482
- './wm-option_2.entry.js').then(processMod, consoleError);
2483
- case 'wm-navigation_3':
2484
- return import(
2485
- /* webpackMode: "lazy" */
2486
- './wm-navigation_3.entry.js').then(processMod, consoleError);
2487
- case 'wm-progress-indicator_3':
2488
- return import(
2489
- /* webpackMode: "lazy" */
2490
- './wm-progress-indicator_3.entry.js').then(processMod, consoleError);
2491
- case 'wm-tab-item_3':
2492
- return import(
2493
- /* webpackMode: "lazy" */
2494
- './wm-tab-item_3.entry.js').then(processMod, consoleError);
2495
- case 'wm-chart-slice':
2496
- return import(
2497
- /* webpackMode: "lazy" */
2498
- './wm-chart-slice.entry.js').then(processMod, consoleError);
2499
- case 'wm-date-range':
2500
- return import(
2501
- /* webpackMode: "lazy" */
2502
- './wm-date-range.entry.js').then(processMod, consoleError);
2503
- case 'wm-line-chart':
2504
- return import(
2505
- /* webpackMode: "lazy" */
2506
- './wm-line-chart.entry.js').then(processMod, consoleError);
2507
- case 'wm-modal-footer':
2508
- return import(
2509
- /* webpackMode: "lazy" */
2510
- './wm-modal-footer.entry.js').then(processMod, consoleError);
2511
- case 'wm-modal-header':
2512
- return import(
2513
- /* webpackMode: "lazy" */
2514
- './wm-modal-header.entry.js').then(processMod, consoleError);
2515
- case 'priv-navigator-button':
2516
- return import(
2517
- /* webpackMode: "lazy" */
2518
- './priv-navigator-button.entry.js').then(processMod, consoleError);
2519
- case 'priv-navigator-item':
2520
- return import(
2521
- /* webpackMode: "lazy" */
2522
- './priv-navigator-item.entry.js').then(processMod, consoleError);
2523
- case 'priv-calendar':
2524
- return import(
2525
- /* webpackMode: "lazy" */
2526
- './priv-calendar.entry.js').then(processMod, consoleError);
2527
- case 'priv-chart-popover':
2528
- return import(
2529
- /* webpackMode: "lazy" */
2530
- './priv-chart-popover.entry.js').then(processMod, consoleError);
2531
- }
2532
- }
2533
- return import(
2534
- /* @vite-ignore */
2535
- /* webpackInclude: /\.entry\.js$/ */
2536
- /* webpackExclude: /\.system\.entry\.js$/ */
2537
- /* webpackMode: "lazy" */
2538
- `./${bundleId}.entry.js${''}`).then((importedModule) => {
2539
- {
2540
- cmpModules.set(bundleId, importedModule);
2541
- }
2542
- return importedModule[exportName];
2543
- }, consoleError);
2544
- };
2545
- const styles = /*@__PURE__*/ new Map();
2546
- const win = typeof window !== 'undefined' ? window : {};
2547
- const doc = win.document || { head: {} };
2548
- const plt = {
2549
- $flags$: 0,
2550
- $resourcesUrl$: '',
2551
- jmp: (h) => h(),
2552
- raf: (h) => requestAnimationFrame(h),
2553
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
2554
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
2555
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
2556
- };
2557
- const promiseResolve = (v) => Promise.resolve(v);
2558
- const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
2559
- try {
2560
- new CSSStyleSheet();
2561
- return typeof new CSSStyleSheet().replaceSync === 'function';
2562
- }
2563
- catch (e) { }
2564
- return false;
2565
- })()
2566
- ;
2567
- const queueDomReads = [];
2568
- const queueDomWrites = [];
2569
- const queueTask = (queue, write) => (cb) => {
2570
- queue.push(cb);
2571
- if (!queuePending) {
2572
- queuePending = true;
2573
- if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
2574
- nextTick(flush);
2575
- }
2576
- else {
2577
- plt.raf(flush);
2578
- }
2579
- }
2580
- };
2581
- const consume = (queue) => {
2582
- for (let i = 0; i < queue.length; i++) {
2583
- try {
2584
- queue[i](performance.now());
2585
- }
2586
- catch (e) {
2587
- consoleError(e);
2588
- }
2589
- }
2590
- queue.length = 0;
2591
- };
2592
- const flush = () => {
2593
- // always force a bunch of medium callbacks to run, but still have
2594
- // a throttle on how many can run in a certain time
2595
- // DOM READS!!!
2596
- consume(queueDomReads);
2597
- // DOM WRITES!!!
2598
- {
2599
- consume(queueDomWrites);
2600
- if ((queuePending = queueDomReads.length > 0)) {
2601
- // still more to do yet, but we've run out of time
2602
- // let's let this thing cool off and try again in the next tick
2603
- plt.raf(flush);
2604
- }
2605
- }
2606
- };
2607
- const nextTick = (cb) => promiseResolve().then(cb);
2608
- const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2609
-
2610
- export { Fragment as F, Host as H, bootstrapLazy as b, createEvent as c, forceUpdate as f, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };