@ionic/core 7.8.1-dev.11710856611.1a76ae36 → 7.8.1-dev.11710859149.114e57ae

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