voyager-ionic-core 8.0.0-rc.0 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (623) hide show
  1. package/components/action-sheet.js +3 -3
  2. package/components/alert.js +2 -2
  3. package/components/backdrop.js +1 -1
  4. package/components/button.js +4 -4
  5. package/components/buttons.js +2 -2
  6. package/components/checkbox.js +5 -5
  7. package/components/input-shims.js +5 -5
  8. package/components/ion-app.js +1 -1
  9. package/components/ion-avatar.js +1 -1
  10. package/components/ion-back-button.js +2 -2
  11. package/components/ion-badge.js +2 -2
  12. package/components/ion-breadcrumb.js +4 -4
  13. package/components/ion-breadcrumbs.js +2 -2
  14. package/components/ion-card-content.js +1 -1
  15. package/components/ion-card-header.js +2 -2
  16. package/components/ion-card-subtitle.js +2 -2
  17. package/components/ion-card-title.js +2 -2
  18. package/components/ion-card.js +1 -1
  19. package/components/ion-chip.js +2 -2
  20. package/components/ion-col.js +2 -2
  21. package/components/ion-content.js +3 -3
  22. package/components/ion-datetime-button.js +2 -2
  23. package/components/ion-datetime.js +2 -2
  24. package/components/ion-fab-button.js +2 -2
  25. package/components/ion-fab-list.js +2 -2
  26. package/components/ion-fab.js +2 -2
  27. package/components/ion-footer.js +2 -2
  28. package/components/ion-grid.js +2 -2
  29. package/components/ion-header.js +2 -2
  30. package/components/ion-img.js +1 -1
  31. package/components/ion-infinite-scroll-content.js +2 -2
  32. package/components/ion-infinite-scroll.js +1 -1
  33. package/components/ion-input-password-toggle.js +3 -3
  34. package/components/ion-input.js +12 -3
  35. package/components/ion-item-divider.js +2 -2
  36. package/components/ion-item-group.js +1 -1
  37. package/components/ion-item-option.js +2 -2
  38. package/components/ion-item-options.js +1 -1
  39. package/components/ion-item-sliding.js +1 -1
  40. package/components/ion-loading.js +2 -2
  41. package/components/ion-menu-button.js +2 -2
  42. package/components/ion-menu-toggle.js +2 -2
  43. package/components/ion-menu.js +2 -2
  44. package/components/ion-modal.js +47 -23
  45. package/components/ion-nav-link.js +1 -1
  46. package/components/ion-nav.js +1 -1
  47. package/components/ion-note.js +2 -2
  48. package/components/ion-picker-legacy.js +2 -2
  49. package/components/ion-progress-bar.js +1 -1
  50. package/components/ion-range.js +3 -3
  51. package/components/ion-refresher-content.js +1 -1
  52. package/components/ion-refresher.js +1 -1
  53. package/components/ion-reorder-group.js +1 -1
  54. package/components/ion-reorder.js +1 -1
  55. package/components/ion-router-link.js +2 -2
  56. package/components/ion-router-outlet.js +1 -1
  57. package/components/ion-row.js +1 -1
  58. package/components/ion-searchbar.js +4 -4
  59. package/components/ion-segment-button.js +3 -3
  60. package/components/ion-segment.js +2 -2
  61. package/components/ion-select-option.js +1 -1
  62. package/components/ion-select.js +2 -2
  63. package/components/ion-skeleton-text.js +2 -2
  64. package/components/ion-split-pane.js +2 -2
  65. package/components/ion-tab-bar.js +2 -2
  66. package/components/ion-tab-button.js +2 -2
  67. package/components/ion-tab.js +2 -2
  68. package/components/ion-tabs.js +1 -1
  69. package/components/ion-text.js +2 -2
  70. package/components/ion-textarea.js +2 -2
  71. package/components/ion-thumbnail.js +1 -1
  72. package/components/ion-title.js +2 -2
  73. package/components/ion-toast.js +2 -2
  74. package/components/ion-toggle.js +5 -5
  75. package/components/ion-toolbar.js +2 -2
  76. package/components/item.js +1 -1
  77. package/components/label.js +2 -2
  78. package/components/list-header.js +2 -2
  79. package/components/list.js +1 -1
  80. package/components/picker-column-option.js +2 -2
  81. package/components/picker-column.js +3 -3
  82. package/components/picker-column2.js +2 -2
  83. package/components/picker.js +2 -2
  84. package/components/popover.js +4 -4
  85. package/components/radio-group.js +1 -1
  86. package/components/radio.js +5 -5
  87. package/components/ripple-effect.js +1 -1
  88. package/components/select-popover.js +1 -1
  89. package/components/spinner.js +1 -1
  90. package/css/core.css +1 -624
  91. package/css/core.css.map +1 -1
  92. package/css/display.css +1 -131
  93. package/css/display.css.map +1 -1
  94. package/css/flex-utils.css +1 -81
  95. package/css/flex-utils.css.map +1 -1
  96. package/css/float-elements.css +1 -293
  97. package/css/float-elements.css.map +1 -1
  98. package/css/global.bundle.css +1 -457
  99. package/css/global.bundle.css.map +1 -1
  100. package/css/ionic-swiper.css +1 -127
  101. package/css/ionic-swiper.css.map +1 -1
  102. package/css/ionic.bundle.css +1 -1
  103. package/css/ionic.bundle.css.map +1 -1
  104. package/css/normalize.css +1 -150
  105. package/css/normalize.css.map +1 -1
  106. package/css/padding.css +1 -202
  107. package/css/padding.css.map +1 -1
  108. package/css/palettes/dark.always.css +1 -160
  109. package/css/palettes/dark.always.css.map +1 -1
  110. package/css/palettes/dark.class.css +1 -160
  111. package/css/palettes/dark.class.css.map +1 -1
  112. package/css/palettes/dark.css +0 -2
  113. package/css/palettes/dark.system.css +1 -162
  114. package/css/palettes/dark.system.css.map +1 -1
  115. package/css/palettes/high-contrast-dark.always.css +1 -180
  116. package/css/palettes/high-contrast-dark.always.css.map +1 -1
  117. package/css/palettes/high-contrast-dark.class.css +1 -180
  118. package/css/palettes/high-contrast-dark.class.css.map +1 -1
  119. package/css/palettes/high-contrast-dark.css +0 -2
  120. package/css/palettes/high-contrast-dark.system.css +1 -182
  121. package/css/palettes/high-contrast-dark.system.css.map +1 -1
  122. package/css/palettes/high-contrast.always.css +1 -101
  123. package/css/palettes/high-contrast.always.css.map +1 -1
  124. package/css/palettes/high-contrast.class.css +1 -101
  125. package/css/palettes/high-contrast.class.css.map +1 -1
  126. package/css/palettes/high-contrast.css +0 -2
  127. package/css/palettes/high-contrast.system.css +1 -103
  128. package/css/palettes/high-contrast.system.css.map +1 -1
  129. package/css/structure.css +1 -152
  130. package/css/structure.css.map +1 -1
  131. package/css/text-alignment.css +1 -243
  132. package/css/text-alignment.css.map +1 -1
  133. package/css/text-transformation.css +1 -158
  134. package/css/text-transformation.css.map +1 -1
  135. package/css/typography.css +1 -157
  136. package/css/typography.css.map +1 -1
  137. package/css/utils.bundle.css +1 -1100
  138. package/css/utils.bundle.css.map +1 -1
  139. package/dist/cjs/{app-globals-63aebf89.js → app-globals-542c4d91.js} +1 -1
  140. package/dist/cjs/{button-active-bd13859e.js → button-active-47528f4c.js} +1 -1
  141. package/dist/cjs/{hardware-back-button-ad9299b4.js → hardware-back-button-06ae4d9c.js} +2 -2
  142. package/dist/cjs/index-1437d080.js +11980 -0
  143. package/dist/cjs/{index-5cf05f94.js → index-57b504ac.js} +2 -2
  144. package/dist/cjs/{index-ff66cc7c.js → index-c76a1d14.js} +3 -3
  145. package/dist/cjs/index.cjs.js +8 -8
  146. package/dist/cjs/{input-shims-20d639e6.js → input-shims-9e59ef62.js} +5 -5
  147. package/dist/cjs/ion-accordion_2.cjs.entry.js +2 -2
  148. package/dist/cjs/ion-action-sheet.cjs.entry.js +8 -8
  149. package/dist/cjs/ion-alert.cjs.entry.js +7 -7
  150. package/dist/cjs/ion-app_8.cjs.entry.js +22 -22
  151. package/dist/cjs/ion-avatar_3.cjs.entry.js +6 -6
  152. package/dist/cjs/ion-back-button.cjs.entry.js +4 -4
  153. package/dist/cjs/ion-backdrop.cjs.entry.js +3 -3
  154. package/dist/cjs/ion-breadcrumb_2.cjs.entry.js +8 -8
  155. package/dist/cjs/ion-button_2.cjs.entry.js +6 -6
  156. package/dist/cjs/ion-card_5.cjs.entry.js +10 -10
  157. package/dist/cjs/ion-checkbox.cjs.entry.js +7 -7
  158. package/dist/cjs/ion-chip.cjs.entry.js +4 -4
  159. package/dist/cjs/ion-col_3.cjs.entry.js +7 -7
  160. package/dist/cjs/ion-datetime-button.cjs.entry.js +4 -4
  161. package/dist/cjs/ion-datetime_3.cjs.entry.js +10 -10
  162. package/dist/cjs/ion-fab_3.cjs.entry.js +8 -8
  163. package/dist/cjs/ion-img.cjs.entry.js +3 -3
  164. package/dist/cjs/ion-infinite-scroll_2.cjs.entry.js +5 -5
  165. package/dist/cjs/ion-input-password-toggle.cjs.entry.js +5 -5
  166. package/dist/cjs/ion-input.cjs.entry.js +14 -5
  167. package/dist/cjs/ion-item-option_3.cjs.entry.js +6 -6
  168. package/dist/cjs/ion-item_8.cjs.entry.js +15 -15
  169. package/dist/cjs/ion-loading.cjs.entry.js +6 -6
  170. package/dist/cjs/ion-menu_3.cjs.entry.js +11 -11
  171. package/dist/cjs/ion-modal.cjs.entry.js +52 -28
  172. package/dist/cjs/ion-nav_2.cjs.entry.js +5 -5
  173. package/dist/cjs/ion-picker-column-option.cjs.entry.js +4 -4
  174. package/dist/cjs/ion-picker-column.cjs.entry.js +5 -5
  175. package/dist/cjs/ion-picker.cjs.entry.js +3 -3
  176. package/dist/cjs/ion-popover.cjs.entry.js +9 -9
  177. package/dist/cjs/ion-progress-bar.cjs.entry.js +3 -3
  178. package/dist/cjs/ion-radio_2.cjs.entry.js +8 -8
  179. package/dist/cjs/ion-range.cjs.entry.js +5 -5
  180. package/dist/cjs/ion-refresher_2.cjs.entry.js +4 -4
  181. package/dist/cjs/ion-reorder_2.cjs.entry.js +4 -4
  182. package/dist/cjs/ion-ripple-effect.cjs.entry.js +3 -3
  183. package/dist/cjs/ion-route_4.cjs.entry.js +4 -4
  184. package/dist/cjs/ion-searchbar.cjs.entry.js +6 -6
  185. package/dist/cjs/ion-segment_2.cjs.entry.js +7 -7
  186. package/dist/cjs/ion-select_3.cjs.entry.js +8 -8
  187. package/dist/cjs/ion-spinner.cjs.entry.js +3 -3
  188. package/dist/cjs/ion-split-pane.cjs.entry.js +4 -4
  189. package/dist/cjs/ion-tab-bar_2.cjs.entry.js +6 -6
  190. package/dist/cjs/ion-tab_2.cjs.entry.js +4 -4
  191. package/dist/cjs/ion-text.cjs.entry.js +4 -4
  192. package/dist/cjs/ion-textarea.cjs.entry.js +4 -4
  193. package/dist/cjs/ion-toast.cjs.entry.js +6 -6
  194. package/dist/cjs/ion-toggle.cjs.entry.js +7 -7
  195. package/dist/cjs/{ionic-global-1adf9bc4.js → ionic-global-f3622afe.js} +1 -1
  196. package/dist/cjs/ionic.cjs.js +30 -32
  197. package/dist/cjs/{ios.transition-06673f18.js → ios.transition-288dfa83.js} +2 -2
  198. package/dist/cjs/loader.cjs.js +3 -3
  199. package/dist/cjs/{md.transition-4d7bb4b1.js → md.transition-6e5f6a8d.js} +2 -2
  200. package/dist/cjs/{overlays-6487955a.js → overlays-32cfd236.js} +2 -2
  201. package/dist/cjs/{status-tap-0be20572.js → status-tap-c47ff5f5.js} +1 -1
  202. package/dist/collection/collection-manifest.json +2 -2
  203. package/dist/collection/components/action-sheet/action-sheet.js +3 -3
  204. package/dist/collection/components/alert/alert.js +2 -2
  205. package/dist/collection/components/app/app.js +1 -1
  206. package/dist/collection/components/avatar/avatar.js +1 -1
  207. package/dist/collection/components/back-button/back-button.js +2 -2
  208. package/dist/collection/components/backdrop/backdrop.js +1 -1
  209. package/dist/collection/components/badge/badge.js +2 -2
  210. package/dist/collection/components/breadcrumb/breadcrumb.js +4 -4
  211. package/dist/collection/components/breadcrumbs/breadcrumbs.js +2 -2
  212. package/dist/collection/components/button/button.ios.css +47 -8
  213. package/dist/collection/components/button/button.js +2 -2
  214. package/dist/collection/components/button/button.md.css +49 -8
  215. package/dist/collection/components/buttons/buttons.js +2 -2
  216. package/dist/collection/components/card/card.js +1 -1
  217. package/dist/collection/components/card-content/card-content.js +1 -1
  218. package/dist/collection/components/card-header/card-header.js +2 -2
  219. package/dist/collection/components/card-subtitle/card-subtitle.js +2 -2
  220. package/dist/collection/components/card-title/card-title.js +2 -2
  221. package/dist/collection/components/checkbox/checkbox.ios.css +1 -0
  222. package/dist/collection/components/checkbox/checkbox.js +3 -3
  223. package/dist/collection/components/checkbox/checkbox.md.css +1 -0
  224. package/dist/collection/components/chip/chip.js +2 -2
  225. package/dist/collection/components/col/col.js +2 -2
  226. package/dist/collection/components/content/content.js +3 -3
  227. package/dist/collection/components/datetime/datetime.js +2 -2
  228. package/dist/collection/components/datetime/test/color/datetime.e2e.js +14 -7
  229. package/dist/collection/components/datetime-button/datetime-button.js +2 -2
  230. package/dist/collection/components/fab/fab.js +2 -2
  231. package/dist/collection/components/fab-button/fab-button.js +2 -2
  232. package/dist/collection/components/fab-list/fab-list.js +2 -2
  233. package/dist/collection/components/footer/footer.js +2 -2
  234. package/dist/collection/components/grid/grid.js +2 -2
  235. package/dist/collection/components/header/header.js +2 -2
  236. package/dist/collection/components/img/img.js +1 -1
  237. package/dist/collection/components/infinite-scroll/infinite-scroll.js +1 -1
  238. package/dist/collection/components/infinite-scroll-content/infinite-scroll-content.js +2 -2
  239. package/dist/collection/components/input/input.js +13 -4
  240. package/dist/collection/components/input-password-toggle/input-password-toggle.js +3 -3
  241. package/dist/collection/components/item/item.js +1 -1
  242. package/dist/collection/components/item-divider/item-divider.js +2 -2
  243. package/dist/collection/components/item-group/item-group.js +1 -1
  244. package/dist/collection/components/item-option/item-option.js +2 -2
  245. package/dist/collection/components/item-options/item-options.js +1 -1
  246. package/dist/collection/components/item-sliding/item-sliding.js +1 -1
  247. package/dist/collection/components/label/label.js +2 -2
  248. package/dist/collection/components/list/list.js +1 -1
  249. package/dist/collection/components/list-header/list-header.js +2 -2
  250. package/dist/collection/components/loading/loading.js +2 -2
  251. package/dist/collection/components/menu/menu.js +2 -2
  252. package/dist/collection/components/menu-button/menu-button.js +2 -2
  253. package/dist/collection/components/menu-toggle/menu-toggle.js +2 -2
  254. package/dist/collection/components/modal/gestures/sheet.js +45 -20
  255. package/dist/collection/components/modal/modal.js +4 -4
  256. package/dist/collection/components/nav/nav.js +1 -1
  257. package/dist/collection/components/nav-link/nav-link.js +1 -1
  258. package/dist/collection/components/note/note.js +2 -2
  259. package/dist/collection/components/picker/picker.js +2 -2
  260. package/dist/collection/components/picker-column/picker-column.js +3 -3
  261. package/dist/collection/components/picker-column-option/picker-column-option.js +2 -2
  262. package/dist/collection/components/picker-legacy/picker.js +2 -2
  263. package/dist/collection/components/picker-legacy-column/picker-column.js +2 -2
  264. package/dist/collection/components/popover/popover.ios.css +0 -1
  265. package/dist/collection/components/popover/popover.js +2 -2
  266. package/dist/collection/components/popover/popover.md.css +0 -1
  267. package/dist/collection/components/popover/test/basic/popover.e2e.js +76 -0
  268. package/dist/collection/components/progress-bar/progress-bar.js +1 -1
  269. package/dist/collection/components/radio/radio.ios.css +1 -0
  270. package/dist/collection/components/radio/radio.js +3 -3
  271. package/dist/collection/components/radio/radio.md.css +1 -0
  272. package/dist/collection/components/radio-group/radio-group.js +1 -1
  273. package/dist/collection/components/range/range.js +3 -3
  274. package/dist/collection/components/refresher/refresher.js +1 -1
  275. package/dist/collection/components/refresher-content/refresher-content.js +1 -1
  276. package/dist/collection/components/reorder/reorder.js +1 -1
  277. package/dist/collection/components/reorder-group/reorder-group.js +1 -1
  278. package/dist/collection/components/ripple-effect/ripple-effect.js +1 -1
  279. package/dist/collection/components/router-link/router-link.js +2 -2
  280. package/dist/collection/components/router-outlet/router-outlet.js +1 -1
  281. package/dist/collection/components/row/row.js +1 -1
  282. package/dist/collection/components/searchbar/searchbar.js +5 -5
  283. package/dist/collection/components/segment/segment.js +2 -2
  284. package/dist/collection/components/segment-button/segment-button.js +3 -3
  285. package/dist/collection/components/select/select.js +2 -2
  286. package/dist/collection/components/select-option/select-option.js +1 -1
  287. package/dist/collection/components/select-popover/select-popover.js +1 -1
  288. package/dist/collection/components/skeleton-text/skeleton-text.js +2 -2
  289. package/dist/collection/components/spinner/spinner.js +1 -1
  290. package/dist/collection/components/split-pane/split-pane.js +2 -2
  291. package/dist/collection/components/tab/tab.js +2 -2
  292. package/dist/collection/components/tab-bar/tab-bar.js +2 -2
  293. package/dist/collection/components/tab-button/tab-button.js +2 -2
  294. package/dist/collection/components/tabs/tabs.js +1 -1
  295. package/dist/collection/components/text/text.js +2 -2
  296. package/dist/collection/components/textarea/textarea.js +2 -2
  297. package/dist/collection/components/thumbnail/thumbnail.js +1 -1
  298. package/dist/collection/components/title/title.js +2 -2
  299. package/dist/collection/components/toast/toast.js +2 -2
  300. package/dist/collection/components/toggle/test/enable-on-off-labels/toggle.e2e.js +51 -31
  301. package/dist/collection/components/toggle/toggle.ios.css +1 -0
  302. package/dist/collection/components/toggle/toggle.js +3 -3
  303. package/dist/collection/components/toggle/toggle.md.css +1 -0
  304. package/dist/collection/components/toolbar/test/basic/toolbar.e2e.js +133 -5
  305. package/dist/collection/components/toolbar/toolbar.js +2 -2
  306. package/dist/collection/utils/input-shims/hacks/scroll-assist.js +5 -5
  307. package/dist/collection/utils/test/playwright/page/utils/goto.js +12 -3
  308. package/dist/docs.json +31 -31
  309. package/dist/esm/{app-globals-b8e5e7fa.js → app-globals-3cbaf9d9.js} +1 -1
  310. package/dist/esm/{button-active-a411da52.js → button-active-9e3c1f3b.js} +1 -1
  311. package/dist/esm/{hardware-back-button-329c81fd.js → hardware-back-button-804f43bb.js} +2 -2
  312. package/dist/esm/index-5dc2b88e.js +11942 -0
  313. package/dist/esm/{index-10916999.js → index-8dbae644.js} +2 -2
  314. package/dist/esm/{index-f1f5de26.js → index-f7fbe1fb.js} +3 -3
  315. package/dist/esm/index.js +8 -8
  316. package/dist/esm/{input-shims-4530285e.js → input-shims-0314bbe5.js} +5 -5
  317. package/dist/esm/ion-accordion_2.entry.js +2 -2
  318. package/dist/esm/ion-action-sheet.entry.js +8 -8
  319. package/dist/esm/ion-alert.entry.js +7 -7
  320. package/dist/esm/ion-app_8.entry.js +22 -22
  321. package/dist/esm/ion-avatar_3.entry.js +6 -6
  322. package/dist/esm/ion-back-button.entry.js +4 -4
  323. package/dist/esm/ion-backdrop.entry.js +3 -3
  324. package/dist/esm/ion-breadcrumb_2.entry.js +8 -8
  325. package/dist/esm/ion-button_2.entry.js +6 -6
  326. package/dist/esm/ion-card_5.entry.js +10 -10
  327. package/dist/esm/ion-checkbox.entry.js +7 -7
  328. package/dist/esm/ion-chip.entry.js +4 -4
  329. package/dist/esm/ion-col_3.entry.js +7 -7
  330. package/dist/esm/ion-datetime-button.entry.js +4 -4
  331. package/dist/esm/ion-datetime_3.entry.js +10 -10
  332. package/dist/esm/ion-fab_3.entry.js +8 -8
  333. package/dist/esm/ion-img.entry.js +3 -3
  334. package/dist/esm/ion-infinite-scroll_2.entry.js +5 -5
  335. package/dist/esm/ion-input-password-toggle.entry.js +5 -5
  336. package/dist/esm/ion-input.entry.js +14 -5
  337. package/dist/esm/ion-item-option_3.entry.js +6 -6
  338. package/dist/esm/ion-item_8.entry.js +15 -15
  339. package/dist/esm/ion-loading.entry.js +6 -6
  340. package/dist/esm/ion-menu_3.entry.js +11 -11
  341. package/dist/esm/ion-modal.entry.js +52 -28
  342. package/dist/esm/ion-nav_2.entry.js +5 -5
  343. package/dist/esm/ion-picker-column-option.entry.js +4 -4
  344. package/dist/esm/ion-picker-column.entry.js +5 -5
  345. package/dist/esm/ion-picker.entry.js +3 -3
  346. package/dist/esm/ion-popover.entry.js +9 -9
  347. package/dist/esm/ion-progress-bar.entry.js +3 -3
  348. package/dist/esm/ion-radio_2.entry.js +8 -8
  349. package/dist/esm/ion-range.entry.js +5 -5
  350. package/dist/esm/ion-refresher_2.entry.js +4 -4
  351. package/dist/esm/ion-reorder_2.entry.js +4 -4
  352. package/dist/esm/ion-ripple-effect.entry.js +3 -3
  353. package/dist/esm/ion-route_4.entry.js +4 -4
  354. package/dist/esm/ion-searchbar.entry.js +6 -6
  355. package/dist/esm/ion-segment_2.entry.js +7 -7
  356. package/dist/esm/ion-select_3.entry.js +8 -8
  357. package/dist/esm/ion-spinner.entry.js +3 -3
  358. package/dist/esm/ion-split-pane.entry.js +4 -4
  359. package/dist/esm/ion-tab-bar_2.entry.js +6 -6
  360. package/dist/esm/ion-tab_2.entry.js +4 -4
  361. package/dist/esm/ion-text.entry.js +4 -4
  362. package/dist/esm/ion-textarea.entry.js +4 -4
  363. package/dist/esm/ion-toast.entry.js +6 -6
  364. package/dist/esm/ion-toggle.entry.js +7 -7
  365. package/dist/esm/{ionic-global-c4e0c089.js → ionic-global-d2d8f882.js} +1 -1
  366. package/dist/esm/ionic.js +31 -33
  367. package/dist/esm/{ios.transition-8e181a7e.js → ios.transition-a0041e41.js} +2 -2
  368. package/dist/esm/loader.js +4 -4
  369. package/dist/esm/{md.transition-f1c3c737.js → md.transition-0c0602d9.js} +2 -2
  370. package/dist/esm/{overlays-9472c98b.js → overlays-696d25f5.js} +2 -2
  371. package/dist/esm/{status-tap-39da9160.js → status-tap-37a74d1c.js} +1 -1
  372. package/dist/esm-es5/app-globals-3cbaf9d9.js +4 -0
  373. package/dist/esm-es5/{button-active-a411da52.js → button-active-9e3c1f3b.js} +1 -1
  374. package/dist/esm-es5/{hardware-back-button-329c81fd.js → hardware-back-button-804f43bb.js} +1 -1
  375. package/dist/esm-es5/index-5dc2b88e.js +18 -0
  376. package/dist/esm-es5/{index-10916999.js → index-8dbae644.js} +1 -1
  377. package/dist/esm-es5/{index-f1f5de26.js → index-f7fbe1fb.js} +1 -1
  378. package/dist/esm-es5/index.js +1 -1
  379. package/dist/esm-es5/input-shims-0314bbe5.js +4 -0
  380. package/dist/esm-es5/ion-accordion_2.entry.js +1 -1
  381. package/dist/esm-es5/ion-action-sheet.entry.js +1 -1
  382. package/dist/esm-es5/ion-alert.entry.js +1 -1
  383. package/dist/esm-es5/ion-app_8.entry.js +1 -1
  384. package/dist/esm-es5/ion-avatar_3.entry.js +1 -1
  385. package/dist/esm-es5/ion-back-button.entry.js +1 -1
  386. package/dist/esm-es5/ion-backdrop.entry.js +1 -1
  387. package/dist/esm-es5/ion-breadcrumb_2.entry.js +1 -1
  388. package/dist/esm-es5/ion-button_2.entry.js +1 -1
  389. package/dist/esm-es5/ion-card_5.entry.js +1 -1
  390. package/dist/esm-es5/ion-checkbox.entry.js +1 -1
  391. package/dist/esm-es5/ion-chip.entry.js +1 -1
  392. package/dist/esm-es5/ion-col_3.entry.js +1 -1
  393. package/dist/esm-es5/ion-datetime-button.entry.js +1 -1
  394. package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
  395. package/dist/esm-es5/ion-fab_3.entry.js +1 -1
  396. package/dist/esm-es5/ion-img.entry.js +1 -1
  397. package/dist/esm-es5/ion-infinite-scroll_2.entry.js +1 -1
  398. package/dist/esm-es5/ion-input-password-toggle.entry.js +1 -1
  399. package/dist/esm-es5/ion-input.entry.js +1 -1
  400. package/dist/esm-es5/ion-item-option_3.entry.js +1 -1
  401. package/dist/esm-es5/ion-item_8.entry.js +1 -1
  402. package/dist/esm-es5/ion-loading.entry.js +1 -1
  403. package/dist/esm-es5/ion-menu_3.entry.js +1 -1
  404. package/dist/esm-es5/ion-modal.entry.js +1 -1
  405. package/dist/esm-es5/ion-nav_2.entry.js +1 -1
  406. package/dist/esm-es5/ion-picker-column-option.entry.js +1 -1
  407. package/dist/esm-es5/ion-picker-column.entry.js +1 -1
  408. package/dist/esm-es5/ion-picker.entry.js +1 -1
  409. package/dist/esm-es5/ion-popover.entry.js +1 -1
  410. package/dist/esm-es5/ion-progress-bar.entry.js +1 -1
  411. package/dist/esm-es5/ion-radio_2.entry.js +1 -1
  412. package/dist/esm-es5/ion-range.entry.js +1 -1
  413. package/dist/esm-es5/ion-refresher_2.entry.js +1 -1
  414. package/dist/esm-es5/ion-reorder_2.entry.js +1 -1
  415. package/dist/esm-es5/ion-ripple-effect.entry.js +1 -1
  416. package/dist/esm-es5/ion-route_4.entry.js +1 -1
  417. package/dist/esm-es5/ion-searchbar.entry.js +1 -1
  418. package/dist/esm-es5/ion-segment_2.entry.js +1 -1
  419. package/dist/esm-es5/ion-select_3.entry.js +1 -1
  420. package/dist/esm-es5/ion-spinner.entry.js +1 -1
  421. package/dist/esm-es5/ion-split-pane.entry.js +1 -1
  422. package/dist/esm-es5/ion-tab-bar_2.entry.js +1 -1
  423. package/dist/esm-es5/ion-tab_2.entry.js +1 -1
  424. package/dist/esm-es5/ion-text.entry.js +1 -1
  425. package/dist/esm-es5/ion-textarea.entry.js +1 -1
  426. package/dist/esm-es5/ion-toast.entry.js +1 -1
  427. package/dist/esm-es5/ion-toggle.entry.js +1 -1
  428. package/dist/esm-es5/{ionic-global-c4e0c089.js → ionic-global-d2d8f882.js} +1 -1
  429. package/dist/esm-es5/ionic.js +1 -1
  430. package/dist/esm-es5/{ios.transition-8e181a7e.js → ios.transition-a0041e41.js} +1 -1
  431. package/dist/esm-es5/loader.js +1 -1
  432. package/dist/esm-es5/md.transition-0c0602d9.js +4 -0
  433. package/dist/esm-es5/{overlays-9472c98b.js → overlays-696d25f5.js} +1 -1
  434. package/dist/esm-es5/{status-tap-39da9160.js → status-tap-37a74d1c.js} +1 -1
  435. package/dist/html.html-data.json +18 -18
  436. package/dist/ionic/index.esm.js +1 -1
  437. package/dist/ionic/ionic.esm.js +1 -1
  438. package/dist/ionic/ionic.js +1 -1
  439. package/dist/ionic/{p-6a7eac5a.js → p-051d2d23.js} +1 -1
  440. package/dist/ionic/p-057b5866.entry.js +4 -0
  441. package/dist/ionic/{p-546433d2.js → p-06d5221c.js} +1 -1
  442. package/dist/ionic/{p-266fc56e.system.js → p-06fad524.system.js} +1 -1
  443. package/dist/ionic/p-08c4d048.entry.js +4 -0
  444. package/dist/ionic/p-0af79ebd.entry.js +4 -0
  445. package/dist/ionic/{p-04070329.system.entry.js → p-0b12d1ee.system.entry.js} +1 -1
  446. package/dist/ionic/p-0d56dea9.entry.js +4 -0
  447. package/dist/ionic/p-0d960144.system.entry.js +4 -0
  448. package/dist/ionic/{p-4511ba0e.system.entry.js → p-13bfcef4.system.entry.js} +1 -1
  449. package/dist/ionic/{p-25575222.system.js → p-16016625.system.js} +1 -1
  450. package/dist/ionic/{p-d98c0112.entry.js → p-1930d8e7.entry.js} +1 -1
  451. package/dist/ionic/{p-5033128d.system.js → p-1980c728.system.js} +2 -2
  452. package/dist/ionic/{p-49b6fee0.system.entry.js → p-1a5227b3.system.entry.js} +1 -1
  453. package/dist/ionic/{p-9d7fc908.system.js → p-1e4d7975.system.js} +1 -1
  454. package/dist/ionic/{p-75cddcc9.js → p-20304962.js} +1 -1
  455. package/dist/ionic/p-23e440b6.entry.js +4 -0
  456. package/dist/ionic/{p-46111310.js → p-2690b1de.js} +1 -1
  457. package/dist/ionic/{p-58ea73f7.system.entry.js → p-26d33af2.system.entry.js} +1 -1
  458. package/dist/ionic/{p-2f6cedaf.system.entry.js → p-283fd4e1.system.entry.js} +1 -1
  459. package/dist/ionic/{p-4429fc97.system.entry.js → p-2a3e98fb.system.entry.js} +1 -1
  460. package/dist/ionic/{p-07ae133d.system.entry.js → p-2ab5db0d.system.entry.js} +1 -1
  461. package/dist/ionic/{p-c9c39c98.system.entry.js → p-2b1e669d.system.entry.js} +1 -1
  462. package/dist/ionic/{p-51b68ec9.system.entry.js → p-2c3c7cb9.system.entry.js} +2 -2
  463. package/dist/ionic/p-2dfdda15.system.entry.js +4 -0
  464. package/dist/ionic/{p-1672c4fd.system.entry.js → p-2f308f7f.system.entry.js} +2 -2
  465. package/dist/ionic/p-2fa34b5c.entry.js +4 -0
  466. package/dist/ionic/p-32048e4c.system.js +18 -0
  467. package/dist/ionic/{p-fbd30ec7.entry.js → p-320cfcab.entry.js} +1 -1
  468. package/dist/ionic/{p-88cff52d.entry.js → p-33d926c3.entry.js} +1 -1
  469. package/dist/ionic/{p-6994c97a.js → p-34511b1d.js} +1 -1
  470. package/dist/ionic/{p-75280815.entry.js → p-385964e6.entry.js} +1 -1
  471. package/dist/ionic/{p-0f2d99a6.entry.js → p-3f5b86b4.entry.js} +1 -1
  472. package/dist/ionic/{p-fb02eeec.system.entry.js → p-42f00e72.system.entry.js} +1 -1
  473. package/dist/ionic/{p-7df2c495.entry.js → p-4324e8a4.entry.js} +1 -1
  474. package/dist/ionic/{p-716ab5f8.system.entry.js → p-45034312.system.entry.js} +1 -1
  475. package/dist/ionic/{p-d79542bd.system.js → p-45664cb9.system.js} +1 -1
  476. package/dist/ionic/{p-c04d5a75.entry.js → p-470f73c4.entry.js} +1 -1
  477. package/dist/ionic/{p-fab4ecad.system.entry.js → p-48888af6.system.entry.js} +2 -2
  478. package/dist/ionic/p-49cdc4f2.entry.js +4 -0
  479. package/dist/ionic/p-4ad48ec9.system.entry.js +4 -0
  480. package/dist/ionic/p-4af0b730.js +8 -0
  481. package/dist/ionic/{p-3c70b01b.entry.js → p-4c153abb.entry.js} +1 -1
  482. package/dist/ionic/{p-71215c1d.system.js → p-4e5288de.system.js} +1 -1
  483. package/dist/ionic/{p-ac4e2a74.system.entry.js → p-4e548bd7.system.entry.js} +1 -1
  484. package/dist/ionic/p-4fcef939.entry.js +4 -0
  485. package/dist/ionic/{p-ff2323ba.system.entry.js → p-53a3b33c.system.entry.js} +1 -1
  486. package/dist/ionic/{p-049fa018.system.entry.js → p-567a21a2.system.entry.js} +1 -1
  487. package/dist/ionic/{p-100bedc4.system.entry.js → p-576786c0.system.entry.js} +1 -1
  488. package/dist/ionic/{p-76907c2f.system.entry.js → p-583f8865.system.entry.js} +1 -1
  489. package/dist/ionic/p-58f89707.js +4 -0
  490. package/dist/ionic/p-5a3a3373.entry.js +4 -0
  491. package/dist/ionic/{p-5e7c32e8.system.entry.js → p-5d3a8503.system.entry.js} +1 -1
  492. package/dist/ionic/p-5d4d89e0.system.entry.js +4 -0
  493. package/dist/ionic/p-5d80b741.entry.js +4 -0
  494. package/dist/ionic/{p-510578f3.system.entry.js → p-5fbc2eae.system.entry.js} +1 -1
  495. package/dist/ionic/{p-71688099.system.entry.js → p-5ff497dc.system.entry.js} +1 -1
  496. package/dist/ionic/p-63265e00.system.entry.js +4 -0
  497. package/dist/ionic/{p-cae889f9.entry.js → p-6730a2f1.entry.js} +1 -1
  498. package/dist/ionic/{p-3e3b34f7.system.entry.js → p-6e9bd6ba.system.entry.js} +1 -1
  499. package/dist/ionic/p-70181008.entry.js +4 -0
  500. package/dist/ionic/p-720927ad.entry.js +4 -0
  501. package/dist/ionic/p-748e6b2b.system.entry.js +4 -0
  502. package/dist/ionic/{p-ea4be6ac.system.js → p-7536b4b3.system.js} +1 -1
  503. package/dist/ionic/{p-c222f76a.js → p-77ce6034.js} +1 -1
  504. package/dist/ionic/{p-b689b8d4.entry.js → p-7ef5bb32.entry.js} +1 -1
  505. package/dist/ionic/p-7f59064a.entry.js +4 -0
  506. package/dist/ionic/{p-d2544865.system.js → p-806aad8f.system.js} +1 -1
  507. package/dist/ionic/{p-a1b4e619.system.entry.js → p-80f85095.system.entry.js} +1 -1
  508. package/dist/ionic/{p-d8067ea4.system.entry.js → p-819e8479.system.entry.js} +1 -1
  509. package/dist/ionic/p-8627f783.system.entry.js +4 -0
  510. package/dist/ionic/{p-df48edd6.entry.js → p-8664c316.entry.js} +1 -1
  511. package/dist/ionic/{p-7d9eefb3.system.js → p-8c4fc85f.system.js} +1 -1
  512. package/dist/ionic/{p-fb97326f.system.entry.js → p-8caca06c.system.entry.js} +1 -1
  513. package/dist/ionic/{p-a88fdfac.entry.js → p-8e031d97.entry.js} +1 -1
  514. package/dist/ionic/p-8f48c966.system.entry.js +4 -0
  515. package/dist/ionic/p-9384565a.entry.js +4 -0
  516. package/dist/ionic/{p-d5f48185.system.entry.js → p-93e43f42.system.entry.js} +1 -1
  517. package/dist/ionic/{p-e8a0e731.entry.js → p-94180ecc.entry.js} +1 -1
  518. package/dist/ionic/p-94731a92.system.entry.js +4 -0
  519. package/dist/ionic/p-9b31ebfa.entry.js +4 -0
  520. package/dist/ionic/{p-43505ff8.system.entry.js → p-a592f1b8.system.entry.js} +1 -1
  521. package/dist/ionic/p-a801da4b.system.entry.js +4 -0
  522. package/dist/ionic/{p-c1d1d004.system.entry.js → p-aa0ed22b.system.entry.js} +1 -1
  523. package/dist/ionic/{p-a8f02173.system.js → p-aa0f60b2.system.js} +1 -1
  524. package/dist/ionic/p-adb896a0.entry.js +4 -0
  525. package/dist/ionic/{p-a7ba2dcc.system.js → p-b0093947.system.js} +1 -1
  526. package/dist/ionic/{p-99daf8b7.entry.js → p-b571cab1.entry.js} +1 -1
  527. package/dist/ionic/{p-0bbb6edf.system.entry.js → p-b76bcd9e.system.entry.js} +1 -1
  528. package/dist/ionic/{p-d8f66669.entry.js → p-b799a007.entry.js} +1 -1
  529. package/dist/ionic/{p-3d6e882f.system.entry.js → p-bbbe3138.system.entry.js} +1 -1
  530. package/dist/ionic/p-bd6d9610.entry.js +4 -0
  531. package/dist/ionic/{p-fda4872f.entry.js → p-bdd3053f.entry.js} +1 -1
  532. package/dist/ionic/{p-8e9ac22d.entry.js → p-c07e7a5d.entry.js} +1 -1
  533. package/dist/ionic/{p-5da04d11.entry.js → p-c23627c3.entry.js} +1 -1
  534. package/dist/ionic/{p-0ebb1fe7.system.entry.js → p-c3ca0292.system.entry.js} +1 -1
  535. package/dist/ionic/p-c4676693.entry.js +4 -0
  536. package/dist/ionic/p-c62571da.entry.js +4 -0
  537. package/dist/ionic/{p-3040730e.js → p-c671b28e.js} +1 -1
  538. package/dist/ionic/p-c7e0b81a.entry.js +4 -0
  539. package/dist/ionic/p-c9ba1908.entry.js +4 -0
  540. package/dist/ionic/{p-4dd82d9d.system.js → p-cb4f96f3.system.js} +1 -1
  541. package/dist/ionic/p-cc856712.entry.js +4 -0
  542. package/dist/ionic/{p-f4cb521c.js → p-cd1b9056.js} +1 -1
  543. package/dist/ionic/{p-ea2c16b5.system.entry.js → p-cdee3a44.system.entry.js} +2 -2
  544. package/dist/ionic/{p-54f76ced.js → p-d11c336d.js} +1 -1
  545. package/dist/ionic/{p-83321ee8.entry.js → p-d1a8f599.entry.js} +1 -1
  546. package/dist/ionic/{p-68a1e274.system.entry.js → p-d6229f05.system.entry.js} +1 -1
  547. package/dist/ionic/p-d918e7ef.system.entry.js +4 -0
  548. package/dist/ionic/p-df062892.system.entry.js +4 -0
  549. package/dist/ionic/p-dfb78785.system.js +4 -0
  550. package/dist/ionic/{p-105f7d62.system.entry.js → p-e3005be4.system.entry.js} +1 -1
  551. package/dist/ionic/p-e49099b0.entry.js +4 -0
  552. package/dist/ionic/p-e885f3c4.entry.js +4 -0
  553. package/dist/ionic/{p-8bd567ba.system.entry.js → p-e9ef13be.system.entry.js} +1 -1
  554. package/dist/ionic/p-ebe0aa6d.entry.js +4 -0
  555. package/dist/ionic/p-ee3bbaf2.entry.js +4 -0
  556. package/dist/ionic/p-f0be340f.entry.js +4 -0
  557. package/dist/ionic/p-f5c42f72.entry.js +4 -0
  558. package/dist/ionic/p-fc94e18f.entry.js +4 -0
  559. package/dist/ionic/p-fd392e7f.system.entry.js +4 -0
  560. package/dist/ionic/p-fdf40b09.js +4 -0
  561. package/dist/types/components/datetime/utils/manipulation.d.ts +7 -7
  562. package/dist/types/components/datetime/utils/state.d.ts +2 -2
  563. package/dist/types/components/input/input.utils.d.ts +1 -1
  564. package/dist/types/components/modal/animations/sheet.d.ts +4 -4
  565. package/dist/types/components/refresher/refresher.utils.d.ts +2 -2
  566. package/dist/types/utils/framework-delegate.d.ts +1 -1
  567. package/dist/types/utils/keyboard/keyboard-controller.d.ts +1 -1
  568. package/hydrate/index.d.ts +1 -1
  569. package/hydrate/index.js +13690 -8472
  570. package/package.json +7 -7
  571. package/dist/cjs/index-af6d0fbb.js +0 -3300
  572. package/dist/esm/index-6e4709ff.js +0 -3262
  573. package/dist/esm-es5/app-globals-b8e5e7fa.js +0 -4
  574. package/dist/esm-es5/index-6e4709ff.js +0 -5
  575. package/dist/esm-es5/input-shims-4530285e.js +0 -4
  576. package/dist/esm-es5/md.transition-f1c3c737.js +0 -4
  577. package/dist/ionic/p-0aa4682e.entry.js +0 -4
  578. package/dist/ionic/p-0de546bb.entry.js +0 -4
  579. package/dist/ionic/p-17978fce.entry.js +0 -4
  580. package/dist/ionic/p-1b235142.entry.js +0 -4
  581. package/dist/ionic/p-1cff9cad.entry.js +0 -4
  582. package/dist/ionic/p-1f9cdee2.entry.js +0 -4
  583. package/dist/ionic/p-23b89985.entry.js +0 -4
  584. package/dist/ionic/p-2e12bda2.entry.js +0 -4
  585. package/dist/ionic/p-3391d9a3.entry.js +0 -4
  586. package/dist/ionic/p-352f7037.system.entry.js +0 -4
  587. package/dist/ionic/p-35b9e842.entry.js +0 -4
  588. package/dist/ionic/p-3f70bfba.entry.js +0 -4
  589. package/dist/ionic/p-46f407f0.system.js +0 -4
  590. package/dist/ionic/p-4a615fea.entry.js +0 -4
  591. package/dist/ionic/p-51ff648c.entry.js +0 -4
  592. package/dist/ionic/p-56c3b69c.entry.js +0 -4
  593. package/dist/ionic/p-596e0cf8.system.entry.js +0 -4
  594. package/dist/ionic/p-5ae49f12.entry.js +0 -4
  595. package/dist/ionic/p-5b1273f4.system.entry.js +0 -4
  596. package/dist/ionic/p-5d3f6707.entry.js +0 -4
  597. package/dist/ionic/p-65d26d94.system.entry.js +0 -4
  598. package/dist/ionic/p-6744e460.entry.js +0 -4
  599. package/dist/ionic/p-69bc14fd.entry.js +0 -4
  600. package/dist/ionic/p-6f4db5ce.system.entry.js +0 -4
  601. package/dist/ionic/p-74a9cafe.system.js +0 -5
  602. package/dist/ionic/p-7fc505bf.entry.js +0 -4
  603. package/dist/ionic/p-896111fa.entry.js +0 -4
  604. package/dist/ionic/p-9ad82dba.js +0 -5
  605. package/dist/ionic/p-a1f9f629.system.entry.js +0 -4
  606. package/dist/ionic/p-aa110ca0.system.entry.js +0 -4
  607. package/dist/ionic/p-aa4f2703.system.entry.js +0 -4
  608. package/dist/ionic/p-ab85debb.entry.js +0 -4
  609. package/dist/ionic/p-ac9f44a8.system.entry.js +0 -4
  610. package/dist/ionic/p-bb835b4d.system.entry.js +0 -4
  611. package/dist/ionic/p-c198e1e1.system.entry.js +0 -4
  612. package/dist/ionic/p-c41af68a.entry.js +0 -4
  613. package/dist/ionic/p-c80d05c9.js +0 -4
  614. package/dist/ionic/p-c8510ca2.entry.js +0 -4
  615. package/dist/ionic/p-c8f2b769.entry.js +0 -4
  616. package/dist/ionic/p-c99ccdc9.entry.js +0 -4
  617. package/dist/ionic/p-dc1372e0.entry.js +0 -4
  618. package/dist/ionic/p-df6fa126.entry.js +0 -4
  619. package/dist/ionic/p-eb3da535.system.entry.js +0 -4
  620. package/dist/ionic/p-ec2d3928.system.entry.js +0 -4
  621. package/dist/ionic/p-f0392d49.entry.js +0 -4
  622. package/dist/ionic/p-f818b01a.entry.js +0 -4
  623. package/dist/ionic/p-f94cbfe9.js +0 -4
@@ -1,3300 +0,0 @@
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: true, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: true, 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: true, experimentalSlotFixes: true, 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: true, scriptDataOpts: false, shadowDelegatesFocus: true, shadowDom: true, slot: true, slotChildNodesFix: true, 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
- var _a;
912
- // tslint:disable-next-line: prefer-const
913
- const newVNode = newParentVNode.$children$[childIndex];
914
- let i = 0;
915
- let elm;
916
- let childNode;
917
- let oldVNode;
918
- if (!useNativeShadowDom) {
919
- // remember for later we need to check to relocate nodes
920
- checkSlotRelocate = true;
921
- if (newVNode.$tag$ === 'slot') {
922
- if (scopeId) {
923
- // scoped css needs to add its scoped id to the parent element
924
- parentElm.classList.add(scopeId + '-s');
925
- }
926
- newVNode.$flags$ |= newVNode.$children$
927
- ? // slot element has fallback content
928
- 2 /* VNODE_FLAGS.isSlotFallback */
929
- : // slot element does not have fallback content
930
- 1 /* VNODE_FLAGS.isSlotReference */;
931
- }
932
- }
933
- if (newVNode.$text$ !== null) {
934
- // create text node
935
- elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
936
- }
937
- else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
938
- // create a slot reference node
939
- elm = newVNode.$elm$ =
940
- doc.createTextNode('');
941
- }
942
- else {
943
- if (!isSvgMode) {
944
- isSvgMode = newVNode.$tag$ === 'svg';
945
- }
946
- // create element
947
- elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
948
- ? 'slot-fb'
949
- : newVNode.$tag$)
950
- );
951
- if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
952
- isSvgMode = false;
953
- }
954
- // add css classes, attrs, props, listeners, etc.
955
- {
956
- updateElement(null, newVNode, isSvgMode);
957
- }
958
- if (isDef(scopeId) && elm['s-si'] !== scopeId) {
959
- // if there is a scopeId and this is the initial render
960
- // then let's add the scopeId as a css class
961
- elm.classList.add((elm['s-si'] = scopeId));
962
- }
963
- if (newVNode.$children$) {
964
- for (i = 0; i < newVNode.$children$.length; ++i) {
965
- // create the node
966
- childNode = createElm(oldParentVNode, newVNode, i, elm);
967
- // return node could have been null
968
- if (childNode) {
969
- // append our new node
970
- elm.appendChild(childNode);
971
- }
972
- }
973
- }
974
- {
975
- if (newVNode.$tag$ === 'svg') {
976
- // Only reset the SVG context when we're exiting <svg> element
977
- isSvgMode = false;
978
- }
979
- else if (elm.tagName === 'foreignObject') {
980
- // Reenter SVG context when we're exiting <foreignObject> element
981
- isSvgMode = true;
982
- }
983
- }
984
- }
985
- // This needs to always happen so we can hide nodes that are projected
986
- // to another component but don't end up in a slot
987
- elm['s-hn'] = hostTagName;
988
- {
989
- if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
990
- // remember the content reference comment
991
- elm['s-sr'] = true;
992
- // remember the content reference comment
993
- elm['s-cr'] = contentRef;
994
- // remember the slot name, or empty string for default slot
995
- elm['s-sn'] = newVNode.$name$ || '';
996
- // remember the ref callback function
997
- elm['s-rf'] = (_a = newVNode.$attrs$) === null || _a === void 0 ? void 0 : _a.ref;
998
- // check if we've got an old vnode for this slot
999
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
1000
- if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
1001
- {
1002
- // we've got an old slot vnode and the wrapper is being replaced
1003
- // so let's move the old slot content to the root of the element currently being rendered
1004
- relocateToHostRoot(oldParentVNode.$elm$);
1005
- }
1006
- }
1007
- }
1008
- }
1009
- return elm;
1010
- };
1011
- /**
1012
- * Relocates all child nodes of an element that were a part of a previous slot relocation
1013
- * to the root of the Stencil component currently being rendered. This happens when a parent
1014
- * element of a slot reference node dynamically changes and triggers a re-render. We cannot use
1015
- * `putBackInOriginalLocation()` because that may relocate nodes to elements that will not be re-rendered
1016
- * and so they will not be relocated again.
1017
- *
1018
- * @param parentElm The element potentially containing relocated nodes.
1019
- */
1020
- const relocateToHostRoot = (parentElm) => {
1021
- plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1022
- const host = parentElm.closest(hostTagName.toLowerCase());
1023
- if (host != null) {
1024
- const contentRefNode = Array.from(host.childNodes).find((ref) => ref['s-cr']);
1025
- const childNodeArray = Array.from(parentElm.childNodes);
1026
- // If we have a content ref, we need to invert the order of the nodes we're relocating
1027
- // to preserve the correct order of elements in the DOM on future relocations
1028
- for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
1029
- // Only relocate nodes that were slotted in
1030
- if (childNode['s-sh'] != null) {
1031
- host.insertBefore(childNode, contentRefNode !== null && contentRefNode !== void 0 ? contentRefNode : null);
1032
- // Reset so we can correctly move the node around again.
1033
- childNode['s-sh'] = undefined;
1034
- // Need to tell the render pipeline to check to relocate slot content again
1035
- checkSlotRelocate = true;
1036
- }
1037
- }
1038
- }
1039
- plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1040
- };
1041
- const putBackInOriginalLocation = (parentElm, recursive) => {
1042
- plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1043
- const oldSlotChildNodes = Array.from(parentElm.childNodes);
1044
- if (parentElm['s-sr'] && BUILD.experimentalSlotFixes) {
1045
- let node = parentElm;
1046
- while ((node = node.nextSibling)) {
1047
- if (node && node['s-sn'] === parentElm['s-sn'] && node['s-sh'] === hostTagName) {
1048
- oldSlotChildNodes.push(node);
1049
- }
1050
- }
1051
- }
1052
- for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
1053
- const childNode = oldSlotChildNodes[i];
1054
- if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
1055
- // and relocate it back to it's original location
1056
- parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
1057
- // remove the old original location comment entirely
1058
- // later on the patch function will know what to do
1059
- // and move this to the correct spot if need be
1060
- childNode['s-ol'].remove();
1061
- childNode['s-ol'] = undefined;
1062
- // Reset so we can correctly move the node around again.
1063
- childNode['s-sh'] = undefined;
1064
- checkSlotRelocate = true;
1065
- }
1066
- if (recursive) {
1067
- putBackInOriginalLocation(childNode, recursive);
1068
- }
1069
- }
1070
- plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1071
- };
1072
- /**
1073
- * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
1074
- * add them to the DOM in the appropriate place.
1075
- *
1076
- * @param parentElm the DOM node which should be used as a parent for the new
1077
- * DOM nodes
1078
- * @param before a child of the `parentElm` which the new children should be
1079
- * inserted before (optional)
1080
- * @param parentVNode the parent virtual DOM node
1081
- * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
1082
- * @param startIdx the index in the child virtual DOM nodes at which to start
1083
- * creating DOM nodes (inclusive)
1084
- * @param endIdx the index in the child virtual DOM nodes at which to stop
1085
- * creating DOM nodes (inclusive)
1086
- */
1087
- const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
1088
- let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
1089
- let childNode;
1090
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
1091
- containerElm = containerElm.shadowRoot;
1092
- }
1093
- for (; startIdx <= endIdx; ++startIdx) {
1094
- if (vnodes[startIdx]) {
1095
- childNode = createElm(null, parentVNode, startIdx, parentElm);
1096
- if (childNode) {
1097
- vnodes[startIdx].$elm$ = childNode;
1098
- containerElm.insertBefore(childNode, referenceNode(before) );
1099
- }
1100
- }
1101
- }
1102
- };
1103
- /**
1104
- * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
1105
- * This can be used to, for instance, clean up after a list of children which
1106
- * should no longer be shown.
1107
- *
1108
- * This function also handles some of Stencil's slot relocation logic.
1109
- *
1110
- * @param vnodes a list of virtual DOM nodes to remove
1111
- * @param startIdx the index at which to start removing nodes (inclusive)
1112
- * @param endIdx the index at which to stop removing nodes (inclusive)
1113
- */
1114
- const removeVnodes = (vnodes, startIdx, endIdx) => {
1115
- for (let index = startIdx; index <= endIdx; ++index) {
1116
- const vnode = vnodes[index];
1117
- if (vnode) {
1118
- const elm = vnode.$elm$;
1119
- nullifyVNodeRefs(vnode);
1120
- if (elm) {
1121
- {
1122
- // we're removing this element
1123
- // so it's possible we need to show slot fallback content now
1124
- checkSlotFallbackVisibility = true;
1125
- if (elm['s-ol']) {
1126
- // remove the original location comment
1127
- elm['s-ol'].remove();
1128
- }
1129
- else {
1130
- // it's possible that child nodes of the node
1131
- // that's being removed are slot nodes
1132
- putBackInOriginalLocation(elm, true);
1133
- }
1134
- }
1135
- // remove the vnode's element from the dom
1136
- elm.remove();
1137
- }
1138
- }
1139
- }
1140
- };
1141
- /**
1142
- * Reconcile the children of a new VNode with the children of an old VNode by
1143
- * traversing the two collections of children, identifying nodes that are
1144
- * conserved or changed, calling out to `patch` to make any necessary
1145
- * updates to the DOM, and rearranging DOM nodes as needed.
1146
- *
1147
- * The algorithm for reconciling children works by analyzing two 'windows' onto
1148
- * the two arrays of children (`oldCh` and `newCh`). We keep track of the
1149
- * 'windows' by storing start and end indices and references to the
1150
- * corresponding array entries. Initially the two 'windows' are basically equal
1151
- * to the entire array, but we progressively narrow the windows until there are
1152
- * no children left to update by doing the following:
1153
- *
1154
- * 1. Skip any `null` entries at the beginning or end of the two arrays, so
1155
- * that if we have an initial array like the following we'll end up dealing
1156
- * only with a window bounded by the highlighted elements:
1157
- *
1158
- * [null, null, VNode1 , ... , VNode2, null, null]
1159
- * ^^^^^^ ^^^^^^
1160
- *
1161
- * 2. Check to see if the elements at the head and tail positions are equal
1162
- * across the windows. This will basically detect elements which haven't
1163
- * been added, removed, or changed position, i.e. if you had the following
1164
- * VNode elements (represented as HTML):
1165
- *
1166
- * oldVNode: `<div><p><span>HEY</span></p></div>`
1167
- * newVNode: `<div><p><span>THERE</span></p></div>`
1168
- *
1169
- * Then when comparing the children of the `<div>` tag we check the equality
1170
- * of the VNodes corresponding to the `<p>` tags and, since they are the
1171
- * same tag in the same position, we'd be able to avoid completely
1172
- * re-rendering the subtree under them with a new DOM element and would just
1173
- * call out to `patch` to handle reconciling their children and so on.
1174
- *
1175
- * 3. Check, for both windows, to see if the element at the beginning of the
1176
- * window corresponds to the element at the end of the other window. This is
1177
- * a heuristic which will let us identify _some_ situations in which
1178
- * elements have changed position, for instance it _should_ detect that the
1179
- * children nodes themselves have not changed but merely moved in the
1180
- * following example:
1181
- *
1182
- * oldVNode: `<div><element-one /><element-two /></div>`
1183
- * newVNode: `<div><element-two /><element-one /></div>`
1184
- *
1185
- * If we find cases like this then we also need to move the concrete DOM
1186
- * elements corresponding to the moved children to write the re-order to the
1187
- * DOM.
1188
- *
1189
- * 4. Finally, if VNodes have the `key` attribute set on them we check for any
1190
- * nodes in the old children which have the same key as the first element in
1191
- * our window on the new children. If we find such a node we handle calling
1192
- * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
1193
- * what we find.
1194
- *
1195
- * Finally, once we've narrowed our 'windows' to the point that either of them
1196
- * collapse (i.e. they have length 0) we then handle any remaining VNode
1197
- * insertion or deletion that needs to happen to get a DOM state that correctly
1198
- * reflects the new child VNodes. If, for instance, after our window on the old
1199
- * children has collapsed we still have more nodes on the new children that
1200
- * we haven't dealt with yet then we need to add them, or if the new children
1201
- * collapse but we still have unhandled _old_ children then we need to make
1202
- * sure the corresponding DOM nodes are removed.
1203
- *
1204
- * @param parentElm the node into which the parent VNode is rendered
1205
- * @param oldCh the old children of the parent node
1206
- * @param newVNode the new VNode which will replace the parent
1207
- * @param newCh the new children of the parent node
1208
- * @param isInitialRender whether or not this is the first render of the vdom
1209
- */
1210
- const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
1211
- let oldStartIdx = 0;
1212
- let newStartIdx = 0;
1213
- let idxInOld = 0;
1214
- let i = 0;
1215
- let oldEndIdx = oldCh.length - 1;
1216
- let oldStartVnode = oldCh[0];
1217
- let oldEndVnode = oldCh[oldEndIdx];
1218
- let newEndIdx = newCh.length - 1;
1219
- let newStartVnode = newCh[0];
1220
- let newEndVnode = newCh[newEndIdx];
1221
- let node;
1222
- let elmToMove;
1223
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
1224
- if (oldStartVnode == null) {
1225
- // VNode might have been moved left
1226
- oldStartVnode = oldCh[++oldStartIdx];
1227
- }
1228
- else if (oldEndVnode == null) {
1229
- oldEndVnode = oldCh[--oldEndIdx];
1230
- }
1231
- else if (newStartVnode == null) {
1232
- newStartVnode = newCh[++newStartIdx];
1233
- }
1234
- else if (newEndVnode == null) {
1235
- newEndVnode = newCh[--newEndIdx];
1236
- }
1237
- else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
1238
- // if the start nodes are the same then we should patch the new VNode
1239
- // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
1240
- // indices to reflect that. We don't need to move any DOM Nodes around
1241
- // since things are matched up in order.
1242
- patch(oldStartVnode, newStartVnode, isInitialRender);
1243
- oldStartVnode = oldCh[++oldStartIdx];
1244
- newStartVnode = newCh[++newStartIdx];
1245
- }
1246
- else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
1247
- // likewise, if the end nodes are the same we patch new onto old and
1248
- // decrement our end indices, and also likewise in this case we don't
1249
- // need to move any DOM Nodes.
1250
- patch(oldEndVnode, newEndVnode, isInitialRender);
1251
- oldEndVnode = oldCh[--oldEndIdx];
1252
- newEndVnode = newCh[--newEndIdx];
1253
- }
1254
- else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
1255
- // case: "Vnode moved right"
1256
- //
1257
- // We've found that the last node in our window on the new children is
1258
- // the same VNode as the _first_ node in our window on the old children
1259
- // we're dealing with now. Visually, this is the layout of these two
1260
- // nodes:
1261
- //
1262
- // newCh: [..., newStartVnode , ... , newEndVnode , ...]
1263
- // ^^^^^^^^^^^
1264
- // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
1265
- // ^^^^^^^^^^^^^
1266
- //
1267
- // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
1268
- // and move the DOM element for `oldStartVnode`.
1269
- if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1270
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
1271
- }
1272
- patch(oldStartVnode, newEndVnode, isInitialRender);
1273
- // We need to move the element for `oldStartVnode` into a position which
1274
- // will be appropriate for `newEndVnode`. For this we can use
1275
- // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
1276
- // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
1277
- // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
1278
- //
1279
- // <old-start-node />
1280
- // <some-intervening-node />
1281
- // <old-end-node />
1282
- // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
1283
- // <next-sibling />
1284
- //
1285
- // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
1286
- // the node for `oldStartVnode` at the end of the children of
1287
- // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
1288
- // aren't any siblings, and passing `null` to `Node.insertBefore` will
1289
- // append it to the children of the parent element.
1290
- parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1291
- oldStartVnode = oldCh[++oldStartIdx];
1292
- newEndVnode = newCh[--newEndIdx];
1293
- }
1294
- else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
1295
- // case: "Vnode moved left"
1296
- //
1297
- // We've found that the first node in our window on the new children is
1298
- // the same VNode as the _last_ node in our window on the old children.
1299
- // Visually, this is the layout of these two nodes:
1300
- //
1301
- // newCh: [..., newStartVnode , ... , newEndVnode , ...]
1302
- // ^^^^^^^^^^^^^
1303
- // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
1304
- // ^^^^^^^^^^^
1305
- //
1306
- // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
1307
- // (which will handle updating any changed attributes, reconciling their
1308
- // children etc) but we also need to move the DOM node to which
1309
- // `oldEndVnode` corresponds.
1310
- if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1311
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1312
- }
1313
- patch(oldEndVnode, newStartVnode, isInitialRender);
1314
- // We've already checked above if `oldStartVnode` and `newStartVnode` are
1315
- // the same node, so since we're here we know that they are not. Thus we
1316
- // can move the element for `oldEndVnode` _before_ the element for
1317
- // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
1318
- // future.
1319
- parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
1320
- oldEndVnode = oldCh[--oldEndIdx];
1321
- newStartVnode = newCh[++newStartIdx];
1322
- }
1323
- else {
1324
- // Here we do some checks to match up old and new nodes based on the
1325
- // `$key$` attribute, which is set by putting a `key="my-key"` attribute
1326
- // in the JSX for a DOM element in the implementation of a Stencil
1327
- // component.
1328
- //
1329
- // First we check to see if there are any nodes in the array of old
1330
- // children which have the same key as the first node in the new
1331
- // children.
1332
- idxInOld = -1;
1333
- {
1334
- for (i = oldStartIdx; i <= oldEndIdx; ++i) {
1335
- if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
1336
- idxInOld = i;
1337
- break;
1338
- }
1339
- }
1340
- }
1341
- if (idxInOld >= 0) {
1342
- // We found a node in the old children which matches up with the first
1343
- // node in the new children! So let's deal with that
1344
- elmToMove = oldCh[idxInOld];
1345
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1346
- // the tag doesn't match so we'll need a new DOM element
1347
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
1348
- }
1349
- else {
1350
- patch(elmToMove, newStartVnode, isInitialRender);
1351
- // invalidate the matching old node so that we won't try to update it
1352
- // again later on
1353
- oldCh[idxInOld] = undefined;
1354
- node = elmToMove.$elm$;
1355
- }
1356
- newStartVnode = newCh[++newStartIdx];
1357
- }
1358
- else {
1359
- // We either didn't find an element in the old children that matches
1360
- // the key of the first new child OR the build is not using `key`
1361
- // attributes at all. In either case we need to create a new element
1362
- // for the new node.
1363
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
1364
- newStartVnode = newCh[++newStartIdx];
1365
- }
1366
- if (node) {
1367
- // if we created a new node then handle inserting it to the DOM
1368
- {
1369
- parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
1370
- }
1371
- }
1372
- }
1373
- }
1374
- if (oldStartIdx > oldEndIdx) {
1375
- // we have some more new nodes to add which don't match up with old nodes
1376
- addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
1377
- }
1378
- else if (newStartIdx > newEndIdx) {
1379
- // there are nodes in the `oldCh` array which no longer correspond to nodes
1380
- // in the new array, so lets remove them (which entails cleaning up the
1381
- // relevant DOM nodes)
1382
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1383
- }
1384
- };
1385
- /**
1386
- * Compare two VNodes to determine if they are the same
1387
- *
1388
- * **NB**: This function is an equality _heuristic_ based on the available
1389
- * information set on the two VNodes and can be misleading under certain
1390
- * circumstances. In particular, if the two nodes do not have `key` attrs
1391
- * (available under `$key$` on VNodes) then the function falls back on merely
1392
- * checking that they have the same tag.
1393
- *
1394
- * So, in other words, if `key` attrs are not set on VNodes which may be
1395
- * changing order within a `children` array or something along those lines then
1396
- * we could obtain a false negative and then have to do needless re-rendering
1397
- * (i.e. we'd say two VNodes aren't equal when in fact they should be).
1398
- *
1399
- * @param leftVNode the first VNode to check
1400
- * @param rightVNode the second VNode to check
1401
- * @param isInitialRender whether or not this is the first render of the vdom
1402
- * @returns whether they're equal or not
1403
- */
1404
- const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
1405
- // compare if two vnode to see if they're "technically" the same
1406
- // need to have the same element tag, and same key to be the same
1407
- if (leftVNode.$tag$ === rightVNode.$tag$) {
1408
- if (leftVNode.$tag$ === 'slot') {
1409
- return leftVNode.$name$ === rightVNode.$name$;
1410
- }
1411
- // this will be set if JSX tags in the build have `key` attrs set on them
1412
- // we only want to check this if we're not on the first render since on
1413
- // first render `leftVNode.$key$` will always be `null`, so we can be led
1414
- // astray and, for instance, accidentally delete a DOM node that we want to
1415
- // keep around.
1416
- if (!isInitialRender) {
1417
- return leftVNode.$key$ === rightVNode.$key$;
1418
- }
1419
- return true;
1420
- }
1421
- return false;
1422
- };
1423
- const referenceNode = (node) => {
1424
- // this node was relocated to a new location in the dom
1425
- // because of some other component's slot
1426
- // but we still have an html comment in place of where
1427
- // it's original location was according to it's original vdom
1428
- return (node && node['s-ol']) || node;
1429
- };
1430
- const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
1431
- /**
1432
- * Handle reconciling an outdated VNode with a new one which corresponds to
1433
- * it. This function handles flushing updates to the DOM and reconciling the
1434
- * children of the two nodes (if any).
1435
- *
1436
- * @param oldVNode an old VNode whose DOM element and children we want to update
1437
- * @param newVNode a new VNode representing an updated version of the old one
1438
- * @param isInitialRender whether or not this is the first render of the vdom
1439
- */
1440
- const patch = (oldVNode, newVNode, isInitialRender = false) => {
1441
- const elm = (newVNode.$elm$ = oldVNode.$elm$);
1442
- const oldChildren = oldVNode.$children$;
1443
- const newChildren = newVNode.$children$;
1444
- const tag = newVNode.$tag$;
1445
- const text = newVNode.$text$;
1446
- let defaultHolder;
1447
- if (text === null) {
1448
- {
1449
- // test if we're rendering an svg element, or still rendering nodes inside of one
1450
- // only add this to the when the compiler sees we're using an svg somewhere
1451
- isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
1452
- }
1453
- {
1454
- if (tag === 'slot' && !useNativeShadowDom) {
1455
- if (oldVNode.$name$ !== newVNode.$name$) {
1456
- newVNode.$elm$['s-sn'] = newVNode.$name$ || '';
1457
- relocateToHostRoot(newVNode.$elm$.parentElement);
1458
- }
1459
- }
1460
- else {
1461
- // either this is the first render of an element OR it's an update
1462
- // AND we already know it's possible it could have changed
1463
- // this updates the element's css classes, attrs, props, listeners, etc.
1464
- updateElement(oldVNode, newVNode, isSvgMode);
1465
- }
1466
- }
1467
- if (oldChildren !== null && newChildren !== null) {
1468
- // looks like there's child vnodes for both the old and new vnodes
1469
- // so we need to call `updateChildren` to reconcile them
1470
- updateChildren(elm, oldChildren, newVNode, newChildren, isInitialRender);
1471
- }
1472
- else if (newChildren !== null) {
1473
- // no old child vnodes, but there are new child vnodes to add
1474
- if (oldVNode.$text$ !== null) {
1475
- // the old vnode was text, so be sure to clear it out
1476
- elm.textContent = '';
1477
- }
1478
- // add the new vnode children
1479
- addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
1480
- }
1481
- else if (oldChildren !== null) {
1482
- // no new child vnodes, but there are old child vnodes to remove
1483
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
1484
- }
1485
- if (isSvgMode && tag === 'svg') {
1486
- isSvgMode = false;
1487
- }
1488
- }
1489
- else if ((defaultHolder = elm['s-cr'])) {
1490
- // this element has slotted content
1491
- defaultHolder.parentNode.textContent = text;
1492
- }
1493
- else if (oldVNode.$text$ !== text) {
1494
- // update the text content for the text only vnode
1495
- // and also only if the text is different than before
1496
- elm.data = text;
1497
- }
1498
- };
1499
- /**
1500
- * Adjust the `.hidden` property as-needed on any nodes in a DOM subtree which
1501
- * are slot fallbacks nodes.
1502
- *
1503
- * A slot fallback node should be visible by default. Then, it should be
1504
- * conditionally hidden if:
1505
- *
1506
- * - it has a sibling with a `slot` property set to its slot name or if
1507
- * - it is a default fallback slot node, in which case we hide if it has any
1508
- * content
1509
- *
1510
- * @param elm the element of interest
1511
- */
1512
- const updateFallbackSlotVisibility = (elm) => {
1513
- const childNodes = elm.childNodes;
1514
- for (const childNode of childNodes) {
1515
- if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1516
- if (childNode['s-sr']) {
1517
- // this is a slot fallback node
1518
- // get the slot name for this slot reference node
1519
- const slotName = childNode['s-sn'];
1520
- // by default always show a fallback slot node
1521
- // then hide it if there are other slots in the light dom
1522
- childNode.hidden = false;
1523
- // we need to check all of its sibling nodes in order to see if
1524
- // `childNode` should be hidden
1525
- for (const siblingNode of childNodes) {
1526
- // Don't check the node against itself
1527
- if (siblingNode !== childNode) {
1528
- if (siblingNode['s-hn'] !== childNode['s-hn'] || slotName !== '') {
1529
- // this sibling node is from a different component OR is a named
1530
- // fallback slot node
1531
- if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
1532
- (slotName === siblingNode.getAttribute('slot') || slotName === siblingNode['s-sn'])) {
1533
- childNode.hidden = true;
1534
- break;
1535
- }
1536
- }
1537
- else {
1538
- // this is a default fallback slot node
1539
- // any element or text node (with content)
1540
- // should hide the default fallback slot node
1541
- if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ ||
1542
- (siblingNode.nodeType === 3 /* NODE_TYPE.TextNode */ && siblingNode.textContent.trim() !== '')) {
1543
- childNode.hidden = true;
1544
- break;
1545
- }
1546
- }
1547
- }
1548
- }
1549
- }
1550
- // keep drilling down
1551
- updateFallbackSlotVisibility(childNode);
1552
- }
1553
- }
1554
- };
1555
- /**
1556
- * Component-global information about nodes which are either currently being
1557
- * relocated or will be shortly.
1558
- */
1559
- const relocateNodes = [];
1560
- /**
1561
- * Mark the contents of a slot for relocation via adding references to them to
1562
- * the {@link relocateNodes} data structure. The actual work of relocating them
1563
- * will then be handled in {@link renderVdom}.
1564
- *
1565
- * @param elm a render node whose child nodes need to be relocated
1566
- */
1567
- const markSlotContentForRelocation = (elm) => {
1568
- // tslint:disable-next-line: prefer-const
1569
- let node;
1570
- let hostContentNodes;
1571
- let j;
1572
- for (const childNode of elm.childNodes) {
1573
- // we need to find child nodes which are slot references so we can then try
1574
- // to match them up with nodes that need to be relocated
1575
- if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
1576
- // first get the content reference comment node ('s-cr'), then we get
1577
- // its parent, which is where all the host content is now
1578
- hostContentNodes = node.parentNode.childNodes;
1579
- const slotName = childNode['s-sn'];
1580
- // iterate through all the nodes under the location where the host was
1581
- // originally rendered
1582
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
1583
- node = hostContentNodes[j];
1584
- // check that the node is not a content reference node or a node
1585
- // reference and then check that the host name does not match that of
1586
- // childNode.
1587
- // In addition, check that the slot either has not already been relocated, or
1588
- // that its current location's host is not childNode's host. This is essentially
1589
- // a check so that we don't try to relocate (and then hide) a node that is already
1590
- // where it should be.
1591
- if (!node['s-cn'] &&
1592
- !node['s-nr'] &&
1593
- node['s-hn'] !== childNode['s-hn'] &&
1594
- (!node['s-sh'] || node['s-sh'] !== childNode['s-hn'])) {
1595
- // if `node` is located in the slot that `childNode` refers to (via the
1596
- // `'s-sn'` property) then we need to relocate it from it's current spot
1597
- // (under the host element parent) to the right slot location
1598
- if (isNodeLocatedInSlot(node, slotName)) {
1599
- // it's possible we've already decided to relocate this node
1600
- let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1601
- // made some changes to slots
1602
- // let's make sure we also double check
1603
- // fallbacks are correctly hidden or shown
1604
- checkSlotFallbackVisibility = true;
1605
- // ensure that the slot-name attr is correct
1606
- node['s-sn'] = node['s-sn'] || slotName;
1607
- if (relocateNodeData) {
1608
- relocateNodeData.$nodeToRelocate$['s-sh'] = childNode['s-hn'];
1609
- // we marked this node for relocation previously but didn't find
1610
- // out the slot reference node to which it needs to be relocated
1611
- // so write it down now!
1612
- relocateNodeData.$slotRefNode$ = childNode;
1613
- }
1614
- else {
1615
- node['s-sh'] = childNode['s-hn'];
1616
- // add to our list of nodes to relocate
1617
- relocateNodes.push({
1618
- $slotRefNode$: childNode,
1619
- $nodeToRelocate$: node,
1620
- });
1621
- }
1622
- if (node['s-sr']) {
1623
- relocateNodes.map((relocateNode) => {
1624
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
1625
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1626
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
1627
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1628
- }
1629
- }
1630
- });
1631
- }
1632
- }
1633
- else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1634
- // the node is not found within the slot (`childNode`) that we're
1635
- // currently looking at, so we stick it into `relocateNodes` to
1636
- // handle later. If we never find a home for this element then
1637
- // we'll need to hide it
1638
- relocateNodes.push({
1639
- $nodeToRelocate$: node,
1640
- });
1641
- }
1642
- }
1643
- }
1644
- }
1645
- // if we're dealing with any type of element (capable of itself being a
1646
- // slot reference or containing one) then we recur
1647
- if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1648
- markSlotContentForRelocation(childNode);
1649
- }
1650
- }
1651
- };
1652
- /**
1653
- * Check whether a node is located in a given named slot.
1654
- *
1655
- * @param nodeToRelocate the node of interest
1656
- * @param slotName the slot name to check
1657
- * @returns whether the node is located in the slot or not
1658
- */
1659
- const isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
1660
- if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1661
- if (nodeToRelocate.getAttribute('slot') === null && slotName === '') {
1662
- // if the node doesn't have a slot attribute, and the slot we're checking
1663
- // is not a named slot, then we assume the node should be within the slot
1664
- return true;
1665
- }
1666
- if (nodeToRelocate.getAttribute('slot') === slotName) {
1667
- return true;
1668
- }
1669
- return false;
1670
- }
1671
- if (nodeToRelocate['s-sn'] === slotName) {
1672
- return true;
1673
- }
1674
- return slotName === '';
1675
- };
1676
- /**
1677
- * 'Nullify' any VDom `ref` callbacks on a VDom node or its children by calling
1678
- * them with `null`. This signals that the DOM element corresponding to the VDom
1679
- * node has been removed from the DOM.
1680
- *
1681
- * @param vNode a virtual DOM node
1682
- */
1683
- const nullifyVNodeRefs = (vNode) => {
1684
- {
1685
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1686
- vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1687
- }
1688
- };
1689
- /**
1690
- * The main entry point for Stencil's virtual DOM-based rendering engine
1691
- *
1692
- * Given a {@link d.HostRef} container and some virtual DOM nodes, this
1693
- * function will handle creating a virtual DOM tree with a single root, patching
1694
- * the current virtual DOM tree onto an old one (if any), dealing with slot
1695
- * relocation, and reflecting attributes.
1696
- *
1697
- * @param hostRef data needed to root and render the virtual DOM tree, such as
1698
- * the DOM node into which it should be rendered.
1699
- * @param renderFnResults the virtual DOM nodes to be rendered
1700
- * @param isInitialLoad whether or not this is the first call after page load
1701
- */
1702
- const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1703
- var _a, _b, _c, _d, _e;
1704
- const hostElm = hostRef.$hostElement$;
1705
- const cmpMeta = hostRef.$cmpMeta$;
1706
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1707
- // if `renderFnResults` is a Host node then we can use it directly. If not,
1708
- // we need to call `h` again to wrap the children of our component in a
1709
- // 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
1710
- // implicitly that the top-level vdom node is 1) an only child and 2)
1711
- // contains attrs that need to be set on the host element.
1712
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1713
- hostTagName = hostElm.tagName;
1714
- if (cmpMeta.$attrsToReflect$) {
1715
- rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1716
- cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
1717
- }
1718
- // On the first render and *only* on the first render we want to check for
1719
- // any attributes set on the host element which are also set on the vdom
1720
- // node. If we find them, we override the value on the VDom node attrs with
1721
- // the value from the host element, which allows developers building apps
1722
- // with Stencil components to override e.g. the `role` attribute on a
1723
- // component even if it's already set on the `Host`.
1724
- if (isInitialLoad && rootVnode.$attrs$) {
1725
- for (const key of Object.keys(rootVnode.$attrs$)) {
1726
- // We have a special implementation in `setAccessor` for `style` and
1727
- // `class` which reconciles values coming from the VDom with values
1728
- // already present on the DOM element, so we don't want to override those
1729
- // attributes on the VDom tree with values from the host element if they
1730
- // are present.
1731
- //
1732
- // Likewise, `ref` and `key` are special internal values for the Stencil
1733
- // runtime and we don't want to override those either.
1734
- if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
1735
- rootVnode.$attrs$[key] = hostElm[key];
1736
- }
1737
- }
1738
- }
1739
- rootVnode.$tag$ = null;
1740
- rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1741
- hostRef.$vnode$ = rootVnode;
1742
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
1743
- {
1744
- scopeId = hostElm['s-sc'];
1745
- }
1746
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1747
- {
1748
- contentRef = hostElm['s-cr'];
1749
- // always reset
1750
- checkSlotFallbackVisibility = false;
1751
- }
1752
- // synchronous patch
1753
- patch(oldVNode, rootVnode, isInitialLoad);
1754
- {
1755
- // while we're moving nodes around existing nodes, temporarily disable
1756
- // the disconnectCallback from working
1757
- plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1758
- if (checkSlotRelocate) {
1759
- markSlotContentForRelocation(rootVnode.$elm$);
1760
- for (const relocateData of relocateNodes) {
1761
- const nodeToRelocate = relocateData.$nodeToRelocate$;
1762
- if (!nodeToRelocate['s-ol']) {
1763
- // add a reference node marking this node's original location
1764
- // keep a reference to this node for later lookups
1765
- const orgLocationNode = doc.createTextNode('');
1766
- orgLocationNode['s-nr'] = nodeToRelocate;
1767
- nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1768
- }
1769
- }
1770
- for (const relocateData of relocateNodes) {
1771
- const nodeToRelocate = relocateData.$nodeToRelocate$;
1772
- const slotRefNode = relocateData.$slotRefNode$;
1773
- if (slotRefNode) {
1774
- const parentNodeRef = slotRefNode.parentNode;
1775
- // When determining where to insert content, the most simple case would be
1776
- // to relocate the node immediately following the slot reference node. We do this
1777
- // by getting a reference to the node immediately following the slot reference node
1778
- // since we will use `insertBefore` to manipulate the DOM.
1779
- //
1780
- // If there is no node immediately following the slot reference node, then we will just
1781
- // end up appending the node as the last child of the parent.
1782
- let insertBeforeNode = slotRefNode.nextSibling;
1783
- // If the node we're currently planning on inserting the new node before is an element,
1784
- // we need to do some additional checks to make sure we're inserting the node in the correct order.
1785
- // The use case here would be that we have multiple nodes being relocated to the same slot. So, we want
1786
- // to make sure they get inserted into their new home in the same order they were declared in their original location.
1787
- //
1788
- // TODO(STENCIL-914): Remove `experimentalSlotFixes` check
1789
- if ((insertBeforeNode && insertBeforeNode.nodeType === 1 /* NODE_TYPE.ElementNode */)) {
1790
- let orgLocationNode = (_a = nodeToRelocate['s-ol']) === null || _a === void 0 ? void 0 : _a.previousSibling;
1791
- while (orgLocationNode) {
1792
- let refNode = (_b = orgLocationNode['s-nr']) !== null && _b !== void 0 ? _b : null;
1793
- if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1794
- refNode = refNode.nextSibling;
1795
- if (!refNode || !refNode['s-nr']) {
1796
- insertBeforeNode = refNode;
1797
- break;
1798
- }
1799
- }
1800
- orgLocationNode = orgLocationNode.previousSibling;
1801
- }
1802
- }
1803
- if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1804
- nodeToRelocate.nextSibling !== insertBeforeNode) {
1805
- // we've checked that it's worth while to relocate
1806
- // since that the node to relocate
1807
- // has a different next sibling or parent relocated
1808
- if (nodeToRelocate !== insertBeforeNode) {
1809
- // Add it back to the dom but in its new home
1810
- // If we get to this point and `insertBeforeNode` is `null`, that means
1811
- // we're just going to append the node as the last child of the parent. Passing
1812
- // `null` as the second arg here will trigger that behavior.
1813
- parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1814
- // Reset the `hidden` value back to what it was defined as originally
1815
- // This solves a problem where a `slot` is dynamically rendered and `hidden` may have
1816
- // been set on content originally, but now it has a slot to go to so it should have
1817
- // the value it was defined as having in the DOM, not what we overrode it to.
1818
- if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1819
- nodeToRelocate.hidden = (_c = nodeToRelocate['s-ih']) !== null && _c !== void 0 ? _c : false;
1820
- }
1821
- }
1822
- }
1823
- nodeToRelocate && typeof slotRefNode['s-rf'] === 'function' && slotRefNode['s-rf'](nodeToRelocate);
1824
- }
1825
- else {
1826
- // this node doesn't have a slot home to go to, so let's hide it
1827
- if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1828
- // Store the initial value of `hidden` so we can reset it later when
1829
- // moving nodes around.
1830
- if (isInitialLoad) {
1831
- nodeToRelocate['s-ih'] = (_d = nodeToRelocate.hidden) !== null && _d !== void 0 ? _d : false;
1832
- }
1833
- nodeToRelocate.hidden = true;
1834
- }
1835
- }
1836
- }
1837
- }
1838
- if (checkSlotFallbackVisibility) {
1839
- updateFallbackSlotVisibility(rootVnode.$elm$);
1840
- }
1841
- // done moving nodes around
1842
- // allow the disconnect callback to work again
1843
- plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1844
- // always reset
1845
- relocateNodes.length = 0;
1846
- }
1847
- // Hide any elements that were projected through, but don't have a slot to go to.
1848
- // Only an issue if there were no "slots" rendered. Otherwise, nodes are hidden correctly.
1849
- // This _only_ happens for `scoped` components!
1850
- if (cmpMeta.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
1851
- for (const childNode of rootVnode.$elm$.childNodes) {
1852
- if (childNode['s-hn'] !== hostTagName && !childNode['s-sh']) {
1853
- // Store the initial value of `hidden` so we can reset it later when
1854
- // moving nodes around.
1855
- if (isInitialLoad && childNode['s-ih'] == null) {
1856
- childNode['s-ih'] = (_e = childNode.hidden) !== null && _e !== void 0 ? _e : false;
1857
- }
1858
- childNode.hidden = true;
1859
- }
1860
- }
1861
- }
1862
- // Clear the content ref so we don't create a memory leak
1863
- contentRef = undefined;
1864
- };
1865
- const attachToAncestor = (hostRef, ancestorComponent) => {
1866
- if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1867
- ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1868
- }
1869
- };
1870
- const scheduleUpdate = (hostRef, isInitialLoad) => {
1871
- {
1872
- hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1873
- }
1874
- if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1875
- hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1876
- return;
1877
- }
1878
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1879
- // there is no ancestor component or the ancestor component
1880
- // has already fired off its lifecycle update then
1881
- // fire off the initial update
1882
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1883
- return writeTask(dispatch) ;
1884
- };
1885
- /**
1886
- * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
1887
- * component lifecycle methods like `componentWillLoad` as well as
1888
- * {@link updateComponent}, which will kick off the virtual DOM re-render.
1889
- *
1890
- * @param hostRef a reference to a host DOM node
1891
- * @param isInitialLoad whether we're on the initial load or not
1892
- * @returns an empty Promise which is used to enqueue a series of operations for
1893
- * the component
1894
- */
1895
- const dispatchHooks = (hostRef, isInitialLoad) => {
1896
- const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1897
- const instance = hostRef.$lazyInstance$ ;
1898
- // We're going to use this variable together with `enqueue` to implement a
1899
- // little promise-based queue. We start out with it `undefined`. When we add
1900
- // the first function to the queue we'll set this variable to be that
1901
- // function's return value. When we attempt to add subsequent values to the
1902
- // queue we'll check that value and, if it was a `Promise`, we'll then chain
1903
- // the new function off of that `Promise` using `.then()`. This will give our
1904
- // queue two nice properties:
1905
- //
1906
- // 1. If all functions added to the queue are synchronous they'll be called
1907
- // synchronously right away.
1908
- // 2. If all functions added to the queue are asynchronous they'll all be
1909
- // called in order after `dispatchHooks` exits.
1910
- let maybePromise;
1911
- if (isInitialLoad) {
1912
- {
1913
- hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1914
- if (hostRef.$queuedListeners$) {
1915
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1916
- hostRef.$queuedListeners$ = undefined;
1917
- }
1918
- }
1919
- {
1920
- // If `componentWillLoad` returns a `Promise` then we want to wait on
1921
- // whatever's going on in that `Promise` before we launch into
1922
- // rendering the component, doing other lifecycle stuff, etc. So
1923
- // in that case we assign the returned promise to the variable we
1924
- // declared above to hold a possible 'queueing' Promise
1925
- maybePromise = safeCall(instance, 'componentWillLoad');
1926
- }
1927
- }
1928
- {
1929
- maybePromise = enqueue(maybePromise, () => safeCall(instance, 'componentWillRender'));
1930
- }
1931
- endSchedule();
1932
- return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1933
- };
1934
- /**
1935
- * This function uses a Promise to implement a simple first-in, first-out queue
1936
- * of functions to be called.
1937
- *
1938
- * The queue is ordered on the basis of the first argument. If it's
1939
- * `undefined`, then nothing is on the queue yet, so the provided function can
1940
- * be called synchronously (although note that this function may return a
1941
- * `Promise`). The idea is that then the return value of that enqueueing
1942
- * operation is kept around, so that if it was a `Promise` then subsequent
1943
- * functions can be enqueued by calling this function again with that `Promise`
1944
- * as the first argument.
1945
- *
1946
- * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
1947
- * @param fn a function to enqueue
1948
- * @returns either a `Promise` or the return value of the provided function
1949
- */
1950
- const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
1951
- /**
1952
- * Check that a value is a `Promise`. To check, we first see if the value is an
1953
- * instance of the `Promise` global. In a few circumstances, in particular if
1954
- * the global has been overwritten, this is could be misleading, so we also do
1955
- * a little 'duck typing' check to see if the `.then` property of the value is
1956
- * defined and a function.
1957
- *
1958
- * @param maybePromise it might be a promise!
1959
- * @returns whether it is or not
1960
- */
1961
- const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
1962
- (maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
1963
- /**
1964
- * Update a component given reference to its host elements and so on.
1965
- *
1966
- * @param hostRef an object containing references to the element's host node,
1967
- * VDom nodes, and other metadata
1968
- * @param instance a reference to the underlying host element where it will be
1969
- * rendered
1970
- * @param isInitialLoad whether or not this function is being called as part of
1971
- * the first render cycle
1972
- */
1973
- const updateComponent = async (hostRef, instance, isInitialLoad) => {
1974
- var _a;
1975
- const elm = hostRef.$hostElement$;
1976
- const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1977
- const rc = elm['s-rc'];
1978
- if (isInitialLoad) {
1979
- // DOM WRITE!
1980
- attachStyles(hostRef);
1981
- }
1982
- const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1983
- {
1984
- callRender(hostRef, instance, elm, isInitialLoad);
1985
- }
1986
- if (rc) {
1987
- // ok, so turns out there are some child host elements
1988
- // waiting on this parent element to load
1989
- // let's fire off all update callbacks waiting
1990
- rc.map((cb) => cb());
1991
- elm['s-rc'] = undefined;
1992
- }
1993
- endRender();
1994
- endUpdate();
1995
- {
1996
- const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
1997
- const postUpdate = () => postUpdateComponent(hostRef);
1998
- if (childrenPromises.length === 0) {
1999
- postUpdate();
2000
- }
2001
- else {
2002
- Promise.all(childrenPromises).then(postUpdate);
2003
- hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
2004
- childrenPromises.length = 0;
2005
- }
2006
- }
2007
- };
2008
- /**
2009
- * Handle making the call to the VDom renderer with the proper context given
2010
- * various build variables
2011
- *
2012
- * @param hostRef an object containing references to the element's host node,
2013
- * VDom nodes, and other metadata
2014
- * @param instance a reference to the underlying host element where it will be
2015
- * rendered
2016
- * @param elm the Host element for the component
2017
- * @param isInitialLoad whether or not this function is being called as part of
2018
- * @returns an empty promise
2019
- */
2020
- const callRender = (hostRef, instance, elm, isInitialLoad) => {
2021
- try {
2022
- /**
2023
- * minification optimization: `allRenderFn` is `true` if all components have a `render`
2024
- * method, so we can call the method immediately. If not, check before calling it.
2025
- */
2026
- instance = instance.render && instance.render();
2027
- {
2028
- hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
2029
- }
2030
- {
2031
- hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
2032
- }
2033
- {
2034
- {
2035
- // looks like we've got child nodes to render into this host element
2036
- // or we need to update the css class/attrs on the host element
2037
- // DOM WRITE!
2038
- {
2039
- renderVdom(hostRef, instance, isInitialLoad);
2040
- }
2041
- }
2042
- }
2043
- }
2044
- catch (e) {
2045
- consoleError(e, hostRef.$hostElement$);
2046
- }
2047
- return null;
2048
- };
2049
- const postUpdateComponent = (hostRef) => {
2050
- const tagName = hostRef.$cmpMeta$.$tagName$;
2051
- const elm = hostRef.$hostElement$;
2052
- const endPostUpdate = createTime('postUpdate', tagName);
2053
- const instance = hostRef.$lazyInstance$ ;
2054
- const ancestorComponent = hostRef.$ancestorComponent$;
2055
- {
2056
- safeCall(instance, 'componentDidRender');
2057
- }
2058
- if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
2059
- hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
2060
- {
2061
- // DOM WRITE!
2062
- addHydratedFlag(elm);
2063
- }
2064
- {
2065
- safeCall(instance, 'componentDidLoad');
2066
- }
2067
- endPostUpdate();
2068
- {
2069
- hostRef.$onReadyResolve$(elm);
2070
- if (!ancestorComponent) {
2071
- appDidLoad();
2072
- }
2073
- }
2074
- }
2075
- else {
2076
- {
2077
- safeCall(instance, 'componentDidUpdate');
2078
- }
2079
- endPostUpdate();
2080
- }
2081
- {
2082
- hostRef.$onInstanceResolve$(elm);
2083
- }
2084
- // load events fire from bottom to top
2085
- // the deepest elements load first then bubbles up
2086
- {
2087
- if (hostRef.$onRenderResolve$) {
2088
- hostRef.$onRenderResolve$();
2089
- hostRef.$onRenderResolve$ = undefined;
2090
- }
2091
- if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
2092
- nextTick(() => scheduleUpdate(hostRef, false));
2093
- }
2094
- hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
2095
- }
2096
- // ( •_•)
2097
- // ( •_•)>⌐■-■
2098
- // (⌐■_■)
2099
- };
2100
- const forceUpdate = (ref) => {
2101
- {
2102
- const hostRef = getHostRef(ref);
2103
- const isConnected = hostRef.$hostElement$.isConnected;
2104
- if (isConnected &&
2105
- (hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
2106
- scheduleUpdate(hostRef, false);
2107
- }
2108
- // Returns "true" when the forced update was successfully scheduled
2109
- return isConnected;
2110
- }
2111
- };
2112
- const appDidLoad = (who) => {
2113
- // on appload
2114
- // we have finish the first big initial render
2115
- {
2116
- addHydratedFlag(doc.documentElement);
2117
- }
2118
- nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
2119
- };
2120
- /**
2121
- * Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
2122
- * e.g. custom element node. If a build figures out that e.g. no component
2123
- * has a `componentDidLoad` method, the instance method gets removed from the
2124
- * output bundle and this function returns `undefined`.
2125
- * @param instance any object that may or may not contain methods
2126
- * @param method method name
2127
- * @param arg single arbitrary argument
2128
- * @returns result of method call if it exists, otherwise `undefined`
2129
- */
2130
- const safeCall = (instance, method, arg) => {
2131
- if (instance && instance[method]) {
2132
- try {
2133
- return instance[method](arg);
2134
- }
2135
- catch (e) {
2136
- consoleError(e);
2137
- }
2138
- }
2139
- return undefined;
2140
- };
2141
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
2142
- ;
2143
- const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
2144
- const setValue = (ref, propName, newVal, cmpMeta) => {
2145
- // check our new property value against our internal value
2146
- const hostRef = getHostRef(ref);
2147
- const elm = hostRef.$hostElement$ ;
2148
- const oldVal = hostRef.$instanceValues$.get(propName);
2149
- const flags = hostRef.$flags$;
2150
- const instance = hostRef.$lazyInstance$ ;
2151
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
2152
- // explicitly check for NaN on both sides, as `NaN === NaN` is always false
2153
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
2154
- const didValueChange = newVal !== oldVal && !areBothNaN;
2155
- if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
2156
- // gadzooks! the property's value has changed!!
2157
- // set our new value!
2158
- hostRef.$instanceValues$.set(propName, newVal);
2159
- if (instance) {
2160
- // get an array of method names of watch functions to call
2161
- if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
2162
- const watchMethods = cmpMeta.$watchers$[propName];
2163
- if (watchMethods) {
2164
- // this instance is watching for when this property changed
2165
- watchMethods.map((watchMethodName) => {
2166
- try {
2167
- // fire off each of the watch methods that are watching this property
2168
- instance[watchMethodName](newVal, oldVal, propName);
2169
- }
2170
- catch (e) {
2171
- consoleError(e, elm);
2172
- }
2173
- });
2174
- }
2175
- }
2176
- if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
2177
- // looks like this value actually changed, so we've got work to do!
2178
- // but only if we've already rendered, otherwise just chill out
2179
- // queue that we need to do an update, but don't worry about queuing
2180
- // up millions cuz this function ensures it only runs once
2181
- scheduleUpdate(hostRef, false);
2182
- }
2183
- }
2184
- }
2185
- };
2186
- /**
2187
- * Attach a series of runtime constructs to a compiled Stencil component
2188
- * constructor, including getters and setters for the `@Prop` and `@State`
2189
- * decorators, callbacks for when attributes change, and so on.
2190
- *
2191
- * @param Cstr the constructor for a component that we need to process
2192
- * @param cmpMeta metadata collected previously about the component
2193
- * @param flags a number used to store a series of bit flags
2194
- * @returns a reference to the same constructor passed in (but now mutated)
2195
- */
2196
- const proxyComponent = (Cstr, cmpMeta, flags) => {
2197
- var _a;
2198
- const prototype = Cstr.prototype;
2199
- if (cmpMeta.$members$) {
2200
- if (Cstr.watchers) {
2201
- cmpMeta.$watchers$ = Cstr.watchers;
2202
- }
2203
- // It's better to have a const than two Object.entries()
2204
- const members = Object.entries(cmpMeta.$members$);
2205
- members.map(([memberName, [memberFlags]]) => {
2206
- if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
2207
- ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
2208
- // proxyComponent - prop
2209
- Object.defineProperty(prototype, memberName, {
2210
- get() {
2211
- // proxyComponent, get value
2212
- return getValue(this, memberName);
2213
- },
2214
- set(newValue) {
2215
- // proxyComponent, set value
2216
- setValue(this, memberName, newValue, cmpMeta);
2217
- },
2218
- configurable: true,
2219
- enumerable: true,
2220
- });
2221
- }
2222
- else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
2223
- memberFlags & 64 /* MEMBER_FLAGS.Method */) {
2224
- // proxyComponent - method
2225
- Object.defineProperty(prototype, memberName, {
2226
- value(...args) {
2227
- var _a;
2228
- const ref = getHostRef(this);
2229
- 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); });
2230
- },
2231
- });
2232
- }
2233
- });
2234
- if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
2235
- const attrNameToPropName = new Map();
2236
- prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
2237
- plt.jmp(() => {
2238
- var _a;
2239
- const propName = attrNameToPropName.get(attrName);
2240
- // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
2241
- // in the case where an attribute was set inline.
2242
- // ```html
2243
- // <my-component some-attribute="some-value"></my-component>
2244
- // ```
2245
- //
2246
- // There is an edge case where a developer sets the attribute inline on a custom element and then
2247
- // programmatically changes it before it has been upgraded as shown below:
2248
- //
2249
- // ```html
2250
- // <!-- this component has _not_ been upgraded yet -->
2251
- // <my-component id="test" some-attribute="some-value"></my-component>
2252
- // <script>
2253
- // // grab non-upgraded component
2254
- // el = document.querySelector("#test");
2255
- // el.someAttribute = "another-value";
2256
- // // upgrade component
2257
- // customElements.define('my-component', MyComponent);
2258
- // </script>
2259
- // ```
2260
- // In this case if we do not un-shadow here and use the value of the shadowing property, attributeChangedCallback
2261
- // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
2262
- // to the value that was set inline i.e. "some-value" from above example. When
2263
- // the connectedCallback attempts to un-shadow it will use "some-value" as the initial value rather than "another-value"
2264
- //
2265
- // The case where the attribute was NOT set inline but was not set programmatically shall be handled/un-shadowed
2266
- // by connectedCallback as this attributeChangedCallback will not fire.
2267
- //
2268
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
2269
- //
2270
- // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
2271
- // properties here given that this goes against best practices outlined here
2272
- // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
2273
- if (this.hasOwnProperty(propName)) {
2274
- newValue = this[propName];
2275
- delete this[propName];
2276
- }
2277
- else if (prototype.hasOwnProperty(propName) &&
2278
- typeof this[propName] === 'number' &&
2279
- this[propName] == newValue) {
2280
- // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
2281
- // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
2282
- // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
2283
- return;
2284
- }
2285
- else if (propName == null) {
2286
- // At this point we should know this is not a "member", so we can treat it like watching an attribute
2287
- // on a vanilla web component
2288
- const hostRef = getHostRef(this);
2289
- const flags = hostRef === null || hostRef === void 0 ? void 0 : hostRef.$flags$;
2290
- // We only want to trigger the callback(s) if:
2291
- // 1. The instance is ready
2292
- // 2. The watchers are ready
2293
- // 3. The value has changed
2294
- if (flags &&
2295
- !(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
2296
- flags & 128 /* HOST_FLAGS.isWatchReady */ &&
2297
- newValue !== oldValue) {
2298
- const instance = hostRef.$lazyInstance$ ;
2299
- const entry = (_a = cmpMeta.$watchers$) === null || _a === void 0 ? void 0 : _a[attrName];
2300
- entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
2301
- if (instance[callbackName] != null) {
2302
- instance[callbackName].call(instance, newValue, oldValue, attrName);
2303
- }
2304
- });
2305
- }
2306
- return;
2307
- }
2308
- this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
2309
- });
2310
- };
2311
- // Create an array of attributes to observe
2312
- // This list in comprised of all strings used within a `@Watch()` decorator
2313
- // on a component as well as any Stencil-specific "members" (`@Prop()`s and `@State()`s).
2314
- // As such, there is no way to guarantee type-safety here that a user hasn't entered
2315
- // an invalid attribute.
2316
- Cstr.observedAttributes = Array.from(new Set([
2317
- ...Object.keys((_a = cmpMeta.$watchers$) !== null && _a !== void 0 ? _a : {}),
2318
- ...members
2319
- .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */)
2320
- .map(([propName, m]) => {
2321
- var _a;
2322
- const attrName = m[1] || propName;
2323
- attrNameToPropName.set(attrName, propName);
2324
- if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
2325
- (_a = cmpMeta.$attrsToReflect$) === null || _a === void 0 ? void 0 : _a.push([propName, attrName]);
2326
- }
2327
- return attrName;
2328
- }),
2329
- ]));
2330
- }
2331
- }
2332
- return Cstr;
2333
- };
2334
- /**
2335
- * Initialize a Stencil component given a reference to its host element, its
2336
- * runtime bookkeeping data structure, runtime metadata about the component,
2337
- * and (optionally) an HMR version ID.
2338
- *
2339
- * @param elm a host element
2340
- * @param hostRef the element's runtime bookkeeping object
2341
- * @param cmpMeta runtime metadata for the Stencil component
2342
- * @param hmrVersionId an (optional) HMR version ID
2343
- */
2344
- const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2345
- let Cstr;
2346
- // initializeComponent
2347
- if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
2348
- // Let the runtime know that the component has been initialized
2349
- hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
2350
- const bundleId = cmpMeta.$lazyBundleId$;
2351
- if (bundleId) {
2352
- // lazy loaded components
2353
- // request the component's implementation to be
2354
- // wired up with the host element
2355
- Cstr = loadModule(cmpMeta);
2356
- if (Cstr.then) {
2357
- // Await creates a micro-task avoid if possible
2358
- const endLoad = uniqueTime();
2359
- Cstr = await Cstr;
2360
- endLoad();
2361
- }
2362
- if (!Cstr.isProxied) {
2363
- // we've never proxied this Constructor before
2364
- // let's add the getters/setters to its prototype before
2365
- // the first time we create an instance of the implementation
2366
- {
2367
- cmpMeta.$watchers$ = Cstr.watchers;
2368
- }
2369
- proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
2370
- Cstr.isProxied = true;
2371
- }
2372
- const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
2373
- // ok, time to construct the instance
2374
- // but let's keep track of when we start and stop
2375
- // so that the getters/setters don't incorrectly step on data
2376
- {
2377
- hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
2378
- }
2379
- // construct the lazy-loaded component implementation
2380
- // passing the hostRef is very important during
2381
- // construction in order to directly wire together the
2382
- // host element and the lazy-loaded instance
2383
- try {
2384
- new Cstr(hostRef);
2385
- }
2386
- catch (e) {
2387
- consoleError(e);
2388
- }
2389
- {
2390
- hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
2391
- }
2392
- {
2393
- hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
2394
- }
2395
- endNewInstance();
2396
- fireConnectedCallback(hostRef.$lazyInstance$);
2397
- }
2398
- else {
2399
- // sync constructor component
2400
- Cstr = elm.constructor;
2401
- // wait for the CustomElementRegistry to mark the component as ready before setting `isWatchReady`. Otherwise,
2402
- // watchers may fire prematurely if `customElements.get()`/`customElements.whenDefined()` resolves _before_
2403
- // Stencil has completed instantiating the component.
2404
- customElements.whenDefined(cmpMeta.$tagName$).then(() => (hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */));
2405
- }
2406
- if (Cstr.style) {
2407
- // this component has styles but we haven't registered them yet
2408
- let style = Cstr.style;
2409
- if (typeof style !== 'string') {
2410
- style = style[(hostRef.$modeName$ = computeMode(elm))];
2411
- }
2412
- const scopeId = getScopeId(cmpMeta, hostRef.$modeName$);
2413
- if (!styles.has(scopeId)) {
2414
- const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
2415
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
2416
- endRegisterStyles();
2417
- }
2418
- }
2419
- }
2420
- // we've successfully created a lazy instance
2421
- const ancestorComponent = hostRef.$ancestorComponent$;
2422
- const schedule = () => scheduleUpdate(hostRef, true);
2423
- if (ancestorComponent && ancestorComponent['s-rc']) {
2424
- // this is the initial load and this component it has an ancestor component
2425
- // but the ancestor component has NOT fired its will update lifecycle yet
2426
- // so let's just cool our jets and wait for the ancestor to continue first
2427
- // this will get fired off when the ancestor component
2428
- // finally gets around to rendering its lazy self
2429
- // fire off the initial update
2430
- ancestorComponent['s-rc'].push(schedule);
2431
- }
2432
- else {
2433
- schedule();
2434
- }
2435
- };
2436
- const fireConnectedCallback = (instance) => {
2437
- {
2438
- safeCall(instance, 'connectedCallback');
2439
- }
2440
- };
2441
- const connectedCallback = (elm) => {
2442
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
2443
- const hostRef = getHostRef(elm);
2444
- const cmpMeta = hostRef.$cmpMeta$;
2445
- const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
2446
- if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
2447
- // first time this component has connected
2448
- hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
2449
- let hostId;
2450
- {
2451
- hostId = elm.getAttribute(HYDRATE_ID);
2452
- if (hostId) {
2453
- if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2454
- const scopeId = addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute('s-mode'))
2455
- ;
2456
- elm.classList.remove(scopeId + '-h', scopeId + '-s');
2457
- }
2458
- initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
2459
- }
2460
- }
2461
- if (!hostId) {
2462
- // initUpdate
2463
- // if the slot polyfill is required we'll need to put some nodes
2464
- // in here to act as original content anchors as we move nodes around
2465
- // host element has been connected to the DOM
2466
- if ((// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
2467
- cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
2468
- setContentReference(elm);
2469
- }
2470
- }
2471
- {
2472
- // find the first ancestor component (if there is one) and register
2473
- // this component as one of the actively loading child components for its ancestor
2474
- let ancestorComponent = elm;
2475
- while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
2476
- // climb up the ancestors looking for the first
2477
- // component that hasn't finished its lifecycle update yet
2478
- if ((ancestorComponent.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
2479
- ancestorComponent.hasAttribute('s-id') &&
2480
- ancestorComponent['s-p']) ||
2481
- ancestorComponent['s-p']) {
2482
- // we found this components first ancestor component
2483
- // keep a reference to this component's ancestor component
2484
- attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
2485
- break;
2486
- }
2487
- }
2488
- }
2489
- // Lazy properties
2490
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
2491
- if (cmpMeta.$members$) {
2492
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
2493
- if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
2494
- const value = elm[memberName];
2495
- delete elm[memberName];
2496
- elm[memberName] = value;
2497
- }
2498
- });
2499
- }
2500
- {
2501
- initializeComponent(elm, hostRef, cmpMeta);
2502
- }
2503
- }
2504
- else {
2505
- // not the first time this has connected
2506
- // reattach any event listeners to the host
2507
- // since they would have been removed when disconnected
2508
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
2509
- // fire off connectedCallback() on component instance
2510
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
2511
- fireConnectedCallback(hostRef.$lazyInstance$);
2512
- }
2513
- else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
2514
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
2515
- }
2516
- }
2517
- endConnected();
2518
- }
2519
- };
2520
- const setContentReference = (elm) => {
2521
- // only required when we're NOT using native shadow dom (slot)
2522
- // or this browser doesn't support native shadow dom
2523
- // and this host element was NOT created with SSR
2524
- // let's pick out the inner content for slot projection
2525
- // create a node to represent where the original
2526
- // content was first placed, which is useful later on
2527
- const contentRefElm = (elm['s-cr'] = doc.createComment(''));
2528
- contentRefElm['s-cn'] = true;
2529
- elm.insertBefore(contentRefElm, elm.firstChild);
2530
- };
2531
- const disconnectInstance = (instance) => {
2532
- {
2533
- safeCall(instance, 'disconnectedCallback');
2534
- }
2535
- };
2536
- const disconnectedCallback = async (elm) => {
2537
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
2538
- const hostRef = getHostRef(elm);
2539
- {
2540
- if (hostRef.$rmListeners$) {
2541
- hostRef.$rmListeners$.map((rmListener) => rmListener());
2542
- hostRef.$rmListeners$ = undefined;
2543
- }
2544
- }
2545
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
2546
- disconnectInstance(hostRef.$lazyInstance$);
2547
- }
2548
- else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
2549
- hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
2550
- }
2551
- }
2552
- };
2553
- const patchPseudoShadowDom = (hostElementPrototype, descriptorPrototype) => {
2554
- patchCloneNode(hostElementPrototype);
2555
- patchSlotAppendChild(hostElementPrototype);
2556
- patchSlotAppend(hostElementPrototype);
2557
- patchSlotPrepend(hostElementPrototype);
2558
- patchSlotInsertAdjacentElement(hostElementPrototype);
2559
- patchSlotInsertAdjacentHTML(hostElementPrototype);
2560
- patchSlotInsertAdjacentText(hostElementPrototype);
2561
- patchTextContent(hostElementPrototype);
2562
- patchChildSlotNodes(hostElementPrototype, descriptorPrototype);
2563
- patchSlotRemoveChild(hostElementPrototype);
2564
- };
2565
- const patchCloneNode = (HostElementPrototype) => {
2566
- const orgCloneNode = HostElementPrototype.cloneNode;
2567
- HostElementPrototype.cloneNode = function (deep) {
2568
- const srcNode = this;
2569
- const isShadowDom = srcNode.shadowRoot && supportsShadow ;
2570
- const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
2571
- if (!isShadowDom && deep) {
2572
- let i = 0;
2573
- let slotted, nonStencilNode;
2574
- const stencilPrivates = [
2575
- 's-id',
2576
- 's-cr',
2577
- 's-lr',
2578
- 's-rc',
2579
- 's-sc',
2580
- 's-p',
2581
- 's-cn',
2582
- 's-sr',
2583
- 's-sn',
2584
- 's-hn',
2585
- 's-ol',
2586
- 's-nr',
2587
- 's-si',
2588
- 's-rf',
2589
- ];
2590
- for (; i < srcNode.childNodes.length; i++) {
2591
- slotted = srcNode.childNodes[i]['s-nr'];
2592
- nonStencilNode = stencilPrivates.every((privateField) => !srcNode.childNodes[i][privateField]);
2593
- if (slotted) {
2594
- if (clonedNode.__appendChild) {
2595
- clonedNode.__appendChild(slotted.cloneNode(true));
2596
- }
2597
- else {
2598
- clonedNode.appendChild(slotted.cloneNode(true));
2599
- }
2600
- }
2601
- if (nonStencilNode) {
2602
- clonedNode.appendChild(srcNode.childNodes[i].cloneNode(true));
2603
- }
2604
- }
2605
- }
2606
- return clonedNode;
2607
- };
2608
- };
2609
- /**
2610
- * Patches the `appendChild` method on a `scoped` Stencil component.
2611
- * The patch will attempt to find a slot with the same name as the node being appended
2612
- * and insert it into the slot reference if found. Otherwise, it falls-back to the original
2613
- * `appendChild` method.
2614
- *
2615
- * @param HostElementPrototype The Stencil component to be patched
2616
- */
2617
- const patchSlotAppendChild = (HostElementPrototype) => {
2618
- HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
2619
- HostElementPrototype.appendChild = function (newChild) {
2620
- const slotName = (newChild['s-sn'] = getSlotName(newChild));
2621
- const slotNode = getHostSlotNode(this.childNodes, slotName);
2622
- if (slotNode) {
2623
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2624
- const appendAfter = slotChildNodes[slotChildNodes.length - 1];
2625
- const insertedNode = appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
2626
- // Check if there is fallback content that should be hidden
2627
- updateFallbackSlotVisibility(this);
2628
- return insertedNode;
2629
- }
2630
- return this.__appendChild(newChild);
2631
- };
2632
- };
2633
- /**
2634
- * Patches the `removeChild` method on a `scoped` Stencil component.
2635
- * This patch attempts to remove the specified node from a slot reference
2636
- * if the slot exists. Otherwise, it falls-back to the original `removeChild` method.
2637
- *
2638
- * @param ElementPrototype The Stencil component to be patched
2639
- */
2640
- const patchSlotRemoveChild = (ElementPrototype) => {
2641
- ElementPrototype.__removeChild = ElementPrototype.removeChild;
2642
- ElementPrototype.removeChild = function (toRemove) {
2643
- if (toRemove && typeof toRemove['s-sn'] !== 'undefined') {
2644
- const slotNode = getHostSlotNode(this.childNodes, toRemove['s-sn']);
2645
- if (slotNode) {
2646
- // Get all slot content
2647
- const slotChildNodes = getHostSlotChildNodes(slotNode, toRemove['s-sn']);
2648
- // See if any of the slotted content matches the node to remove
2649
- const existingNode = slotChildNodes.find((n) => n === toRemove);
2650
- if (existingNode) {
2651
- existingNode.remove();
2652
- // Check if there is fallback content that should be displayed if that
2653
- // was the last node in the slot
2654
- updateFallbackSlotVisibility(this);
2655
- return;
2656
- }
2657
- }
2658
- }
2659
- return this.__removeChild(toRemove);
2660
- };
2661
- };
2662
- /**
2663
- * Patches the `prepend` method for a slotted node inside a scoped component.
2664
- *
2665
- * @param HostElementPrototype the `Element` to be patched
2666
- */
2667
- const patchSlotPrepend = (HostElementPrototype) => {
2668
- const originalPrepend = HostElementPrototype.prepend;
2669
- HostElementPrototype.prepend = function (...newChildren) {
2670
- newChildren.forEach((newChild) => {
2671
- if (typeof newChild === 'string') {
2672
- newChild = this.ownerDocument.createTextNode(newChild);
2673
- }
2674
- const slotName = (newChild['s-sn'] = getSlotName(newChild));
2675
- const slotNode = getHostSlotNode(this.childNodes, slotName);
2676
- if (slotNode) {
2677
- const slotPlaceholder = document.createTextNode('');
2678
- slotPlaceholder['s-nr'] = newChild;
2679
- slotNode['s-cr'].parentNode.__appendChild(slotPlaceholder);
2680
- newChild['s-ol'] = slotPlaceholder;
2681
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2682
- const appendAfter = slotChildNodes[0];
2683
- return appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
2684
- }
2685
- if (newChild.nodeType === 1 && !!newChild.getAttribute('slot')) {
2686
- newChild.hidden = true;
2687
- }
2688
- return originalPrepend.call(this, newChild);
2689
- });
2690
- };
2691
- };
2692
- /**
2693
- * Patches the `append` method for a slotted node inside a scoped component. The patched method uses
2694
- * `appendChild` under-the-hood while creating text nodes for any new children that passed as bare strings.
2695
- *
2696
- * @param HostElementPrototype the `Element` to be patched
2697
- */
2698
- const patchSlotAppend = (HostElementPrototype) => {
2699
- HostElementPrototype.append = function (...newChildren) {
2700
- newChildren.forEach((newChild) => {
2701
- if (typeof newChild === 'string') {
2702
- newChild = this.ownerDocument.createTextNode(newChild);
2703
- }
2704
- this.appendChild(newChild);
2705
- });
2706
- };
2707
- };
2708
- /**
2709
- * Patches the `insertAdjacentHTML` method for a slotted node inside a scoped component. Specifically,
2710
- * we only need to patch the behavior for the specific `beforeend` and `afterbegin` positions so the element
2711
- * gets inserted into the DOM in the correct location.
2712
- *
2713
- * @param HostElementPrototype the `Element` to be patched
2714
- */
2715
- const patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
2716
- const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
2717
- HostElementPrototype.insertAdjacentHTML = function (position, text) {
2718
- if (position !== 'afterbegin' && position !== 'beforeend') {
2719
- return originalInsertAdjacentHtml.call(this, position, text);
2720
- }
2721
- const container = this.ownerDocument.createElement('_');
2722
- let node;
2723
- container.innerHTML = text;
2724
- if (position === 'afterbegin') {
2725
- while ((node = container.firstChild)) {
2726
- this.prepend(node);
2727
- }
2728
- }
2729
- else if (position === 'beforeend') {
2730
- while ((node = container.firstChild)) {
2731
- this.append(node);
2732
- }
2733
- }
2734
- };
2735
- };
2736
- /**
2737
- * Patches the `insertAdjacentText` method for a slotted node inside a scoped component. Specifically,
2738
- * we only need to patch the behavior for the specific `beforeend` and `afterbegin` positions so the text node
2739
- * gets inserted into the DOM in the correct location.
2740
- *
2741
- * @param HostElementPrototype the `Element` to be patched
2742
- */
2743
- const patchSlotInsertAdjacentText = (HostElementPrototype) => {
2744
- HostElementPrototype.insertAdjacentText = function (position, text) {
2745
- this.insertAdjacentHTML(position, text);
2746
- };
2747
- };
2748
- /**
2749
- * Patches the `insertAdjacentElement` method for a slotted node inside a scoped component. Specifically,
2750
- * we only need to patch the behavior for the specific `beforeend` and `afterbegin` positions so the element
2751
- * gets inserted into the DOM in the correct location.
2752
- *
2753
- * @param HostElementPrototype the `Element` to be patched
2754
- */
2755
- const patchSlotInsertAdjacentElement = (HostElementPrototype) => {
2756
- const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
2757
- HostElementPrototype.insertAdjacentElement = function (position, element) {
2758
- if (position !== 'afterbegin' && position !== 'beforeend') {
2759
- return originalInsertAdjacentElement.call(this, position, element);
2760
- }
2761
- if (position === 'afterbegin') {
2762
- this.prepend(element);
2763
- return element;
2764
- }
2765
- else if (position === 'beforeend') {
2766
- this.append(element);
2767
- return element;
2768
- }
2769
- return element;
2770
- };
2771
- };
2772
- /**
2773
- * Patches the text content of an unnamed slotted node inside a scoped component
2774
- * @param hostElementPrototype the `Element` to be patched
2775
- */
2776
- const patchTextContent = (hostElementPrototype) => {
2777
- const descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent');
2778
- Object.defineProperty(hostElementPrototype, '__textContent', descriptor);
2779
- {
2780
- // Patch `textContent` to mimic shadow root behavior
2781
- Object.defineProperty(hostElementPrototype, 'textContent', {
2782
- // To mimic shadow root behavior, we need to return the text content of all
2783
- // nodes in a slot reference node
2784
- get() {
2785
- const slotRefNodes = getAllChildSlotNodes(this.childNodes);
2786
- const textContent = slotRefNodes
2787
- .map((node) => {
2788
- var _a, _b;
2789
- const text = [];
2790
- // Need to get the text content of all nodes in the slot reference node
2791
- let slotContent = node.nextSibling;
2792
- while (slotContent && slotContent['s-sn'] === node['s-sn']) {
2793
- if (slotContent.nodeType === 3 /* NODE_TYPES.TEXT_NODE */ || slotContent.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
2794
- text.push((_b = (_a = slotContent.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '');
2795
- }
2796
- slotContent = slotContent.nextSibling;
2797
- }
2798
- return text.filter((ref) => ref !== '').join(' ');
2799
- })
2800
- .filter((text) => text !== '')
2801
- .join(' ');
2802
- // Pad the string to return
2803
- return ' ' + textContent + ' ';
2804
- },
2805
- // To mimic shadow root behavior, we need to overwrite all nodes in a slot
2806
- // reference node. If a default slot reference node exists, the text content will be
2807
- // placed there. Otherwise, the new text node will be hidden
2808
- set(value) {
2809
- const slotRefNodes = getAllChildSlotNodes(this.childNodes);
2810
- slotRefNodes.forEach((node) => {
2811
- // Remove the existing content of the slot
2812
- let slotContent = node.nextSibling;
2813
- while (slotContent && slotContent['s-sn'] === node['s-sn']) {
2814
- const tmp = slotContent;
2815
- slotContent = slotContent.nextSibling;
2816
- tmp.remove();
2817
- }
2818
- // If this is a default slot, add the text node in the slot location.
2819
- // Otherwise, destroy the slot reference node
2820
- if (node['s-sn'] === '') {
2821
- const textNode = this.ownerDocument.createTextNode(value);
2822
- textNode['s-sn'] = '';
2823
- node.parentElement.insertBefore(textNode, node.nextSibling);
2824
- }
2825
- else {
2826
- node.remove();
2827
- }
2828
- });
2829
- },
2830
- });
2831
- }
2832
- };
2833
- const patchChildSlotNodes = (elm, cmpMeta) => {
2834
- class FakeNodeList extends Array {
2835
- item(n) {
2836
- return this[n];
2837
- }
2838
- }
2839
- // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
2840
- if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
2841
- const childNodesFn = elm.__lookupGetter__('childNodes');
2842
- Object.defineProperty(elm, 'children', {
2843
- get() {
2844
- return this.childNodes.map((n) => n.nodeType === 1);
2845
- },
2846
- });
2847
- Object.defineProperty(elm, 'childElementCount', {
2848
- get() {
2849
- return elm.children.length;
2850
- },
2851
- });
2852
- Object.defineProperty(elm, 'childNodes', {
2853
- get() {
2854
- const childNodes = childNodesFn.call(this);
2855
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0 &&
2856
- getHostRef(this).$flags$ & 2 /* HOST_FLAGS.hasRendered */) {
2857
- const result = new FakeNodeList();
2858
- for (let i = 0; i < childNodes.length; i++) {
2859
- const slot = childNodes[i]['s-nr'];
2860
- if (slot) {
2861
- result.push(slot);
2862
- }
2863
- }
2864
- return result;
2865
- }
2866
- return FakeNodeList.from(childNodes);
2867
- },
2868
- });
2869
- }
2870
- };
2871
- /**
2872
- * Recursively finds all slot reference nodes ('s-sr') in a series of child nodes.
2873
- *
2874
- * @param childNodes The set of child nodes to search for slot reference nodes.
2875
- * @returns An array of slot reference nodes.
2876
- */
2877
- const getAllChildSlotNodes = (childNodes) => {
2878
- const slotRefNodes = [];
2879
- for (const childNode of Array.from(childNodes)) {
2880
- if (childNode['s-sr']) {
2881
- slotRefNodes.push(childNode);
2882
- }
2883
- slotRefNodes.push(...getAllChildSlotNodes(childNode.childNodes));
2884
- }
2885
- return slotRefNodes;
2886
- };
2887
- const getSlotName = (node) => node['s-sn'] || (node.nodeType === 1 && node.getAttribute('slot')) || '';
2888
- /**
2889
- * Recursively searches a series of child nodes for a slot with the provided name.
2890
- * @param childNodes the nodes to search for a slot with a specific name.
2891
- * @param slotName the name of the slot to match on.
2892
- * @returns a reference to the slot node that matches the provided name, `null` otherwise
2893
- */
2894
- const getHostSlotNode = (childNodes, slotName) => {
2895
- let i = 0;
2896
- let childNode;
2897
- for (; i < childNodes.length; i++) {
2898
- childNode = childNodes[i];
2899
- if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
2900
- return childNode;
2901
- }
2902
- childNode = getHostSlotNode(childNode.childNodes, slotName);
2903
- if (childNode) {
2904
- return childNode;
2905
- }
2906
- }
2907
- return null;
2908
- };
2909
- const getHostSlotChildNodes = (n, slotName) => {
2910
- const childNodes = [n];
2911
- while ((n = n.nextSibling) && n['s-sn'] === slotName) {
2912
- childNodes.push(n);
2913
- }
2914
- return childNodes;
2915
- };
2916
- const bootstrapLazy = (lazyBundles, options = {}) => {
2917
- var _a;
2918
- const endBootstrap = createTime();
2919
- const cmpTags = [];
2920
- const exclude = options.exclude || [];
2921
- const customElements = win.customElements;
2922
- const head = doc.head;
2923
- const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
2924
- const dataStyles = /*@__PURE__*/ doc.createElement('style');
2925
- const deferredConnectedCallbacks = [];
2926
- const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2927
- let appLoadFallback;
2928
- let isBootstrapping = true;
2929
- let i = 0;
2930
- Object.assign(plt, options);
2931
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
2932
- {
2933
- // If the app is already hydrated there is not point to disable the
2934
- // async queue. This will improve the first input delay
2935
- plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
2936
- }
2937
- {
2938
- for (; i < styles.length; i++) {
2939
- registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
2940
- }
2941
- }
2942
- let hasSlotRelocation = false;
2943
- lazyBundles.map((lazyBundle) => {
2944
- lazyBundle[1].map((compactMeta) => {
2945
- var _a;
2946
- const cmpMeta = {
2947
- $flags$: compactMeta[0],
2948
- $tagName$: compactMeta[1],
2949
- $members$: compactMeta[2],
2950
- $listeners$: compactMeta[3],
2951
- };
2952
- // Check if we are using slots outside the shadow DOM in this component.
2953
- // We'll use this information later to add styles for `slot-fb` elements
2954
- if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
2955
- hasSlotRelocation = true;
2956
- }
2957
- {
2958
- cmpMeta.$members$ = compactMeta[2];
2959
- }
2960
- {
2961
- cmpMeta.$listeners$ = compactMeta[3];
2962
- }
2963
- {
2964
- cmpMeta.$attrsToReflect$ = [];
2965
- }
2966
- {
2967
- cmpMeta.$watchers$ = (_a = compactMeta[4]) !== null && _a !== void 0 ? _a : {};
2968
- }
2969
- const tagName = cmpMeta.$tagName$;
2970
- const HostElement = class extends HTMLElement {
2971
- // StencilLazyHost
2972
- constructor(self) {
2973
- // @ts-ignore
2974
- super(self);
2975
- self = this;
2976
- registerHost(self, cmpMeta);
2977
- if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2978
- // this component is using shadow dom
2979
- // and this browser supports shadow dom
2980
- // add the read-only property "shadowRoot" to the host element
2981
- // adding the shadow root build conditionals to minimize runtime
2982
- {
2983
- {
2984
- self.attachShadow({
2985
- mode: 'open',
2986
- delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
2987
- });
2988
- }
2989
- }
2990
- }
2991
- }
2992
- connectedCallback() {
2993
- if (appLoadFallback) {
2994
- clearTimeout(appLoadFallback);
2995
- appLoadFallback = null;
2996
- }
2997
- if (isBootstrapping) {
2998
- // connectedCallback will be processed once all components have been registered
2999
- deferredConnectedCallbacks.push(this);
3000
- }
3001
- else {
3002
- plt.jmp(() => connectedCallback(this));
3003
- }
3004
- }
3005
- disconnectedCallback() {
3006
- plt.jmp(() => disconnectedCallback(this));
3007
- }
3008
- componentOnReady() {
3009
- return getHostRef(this).$onReadyPromise$;
3010
- }
3011
- };
3012
- // TODO(STENCIL-914): this check and `else` block can go away and be replaced by just the `scoped` check
3013
- {
3014
- // This check is intentionally not combined with the surrounding `experimentalSlotFixes` check
3015
- // since, moving forward, we only want to patch the pseudo shadow DOM when the component is scoped
3016
- if (cmpMeta.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
3017
- patchPseudoShadowDom(HostElement.prototype, cmpMeta);
3018
- }
3019
- }
3020
- cmpMeta.$lazyBundleId$ = lazyBundle[0];
3021
- if (!exclude.includes(tagName) && !customElements.get(tagName)) {
3022
- cmpTags.push(tagName);
3023
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
3024
- }
3025
- });
3026
- });
3027
- // Only bother generating CSS if we have components
3028
- // TODO(STENCIL-1118): Add test cases for CSS content based on conditionals
3029
- if (cmpTags.length > 0) {
3030
- // Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
3031
- if (hasSlotRelocation) {
3032
- dataStyles.textContent += SLOT_FB_CSS;
3033
- }
3034
- // Add hydration styles
3035
- {
3036
- dataStyles.textContent += cmpTags + HYDRATED_CSS;
3037
- }
3038
- // If we have styles, add them to the DOM
3039
- if (dataStyles.innerHTML.length) {
3040
- dataStyles.setAttribute('data-styles', '');
3041
- // Apply CSP nonce to the style tag if it exists
3042
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
3043
- if (nonce != null) {
3044
- dataStyles.setAttribute('nonce', nonce);
3045
- }
3046
- // Insert the styles into the document head
3047
- // NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
3048
- head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
3049
- }
3050
- }
3051
- // Process deferred connectedCallbacks now all components have been registered
3052
- isBootstrapping = false;
3053
- if (deferredConnectedCallbacks.length) {
3054
- deferredConnectedCallbacks.map((host) => host.connectedCallback());
3055
- }
3056
- else {
3057
- {
3058
- plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
3059
- }
3060
- }
3061
- // Fallback appLoad event
3062
- endBootstrap();
3063
- };
3064
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
3065
- if (listeners) {
3066
- listeners.map(([flags, name, method]) => {
3067
- const target = getHostListenerTarget(elm, flags) ;
3068
- const handler = hostListenerProxy(hostRef, method);
3069
- const opts = hostListenerOpts(flags);
3070
- plt.ael(target, name, handler, opts);
3071
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
3072
- });
3073
- }
3074
- };
3075
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
3076
- try {
3077
- {
3078
- if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
3079
- // instance is ready, let's call it's member method for this event
3080
- hostRef.$lazyInstance$[methodName](ev);
3081
- }
3082
- else {
3083
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
3084
- }
3085
- }
3086
- }
3087
- catch (e) {
3088
- consoleError(e);
3089
- }
3090
- };
3091
- const getHostListenerTarget = (elm, flags) => {
3092
- if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
3093
- return doc;
3094
- if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
3095
- return win;
3096
- if (flags & 16 /* LISTENER_FLAGS.TargetBody */)
3097
- return doc.body;
3098
- return elm;
3099
- };
3100
- // prettier-ignore
3101
- const hostListenerOpts = (flags) => supportsListenerOptions
3102
- ? ({
3103
- passive: (flags & 1 /* LISTENER_FLAGS.Passive */) !== 0,
3104
- capture: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0,
3105
- })
3106
- : (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
3107
- /**
3108
- * Assigns the given value to the nonce property on the runtime platform object.
3109
- * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
3110
- * @param nonce The value to be assigned to the platform nonce property.
3111
- * @returns void
3112
- */
3113
- const setNonce = (nonce) => (plt.$nonce$ = nonce);
3114
- /**
3115
- * A WeakMap mapping runtime component references to their corresponding host reference
3116
- * instances.
3117
- *
3118
- * **Note**: If we're in an HMR context we need to store a reference to this
3119
- * value on `window` in order to maintain the mapping of {@link d.RuntimeRef}
3120
- * to {@link d.HostRef} across HMR updates.
3121
- *
3122
- * This is necessary because when HMR updates for a component are processed by
3123
- * the browser-side dev server client the JS bundle for that component is
3124
- * re-fetched. Since the module containing {@link hostRefs} is included in
3125
- * that bundle, if we do not store a reference to it the new iteration of the
3126
- * component will not have access to the previous hostRef map, leading to a
3127
- * bug where the new version of the component cannot properly initialize.
3128
- */
3129
- const hostRefs = new WeakMap();
3130
- /**
3131
- * Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
3132
- *
3133
- * @param ref the runtime ref of interest
3134
- * @returns the Host reference (if found) or undefined
3135
- */
3136
- const getHostRef = (ref) => hostRefs.get(ref);
3137
- /**
3138
- * Register a lazy instance with the {@link hostRefs} object so it's
3139
- * corresponding {@link d.HostRef} can be retrieved later.
3140
- *
3141
- * @param lazyInstance the lazy instance of interest
3142
- * @param hostRef that instances `HostRef` object
3143
- * @returns a reference to the host ref WeakMap
3144
- */
3145
- const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
3146
- /**
3147
- * Register a host element for a Stencil component, setting up various metadata
3148
- * and callbacks based on {@link BUILD} flags as well as the component's runtime
3149
- * metadata.
3150
- *
3151
- * @param hostElement the host element to register
3152
- * @param cmpMeta runtime metadata for that component
3153
- * @returns a reference to the host ref WeakMap
3154
- */
3155
- const registerHost = (hostElement, cmpMeta) => {
3156
- const hostRef = {
3157
- $flags$: 0,
3158
- $hostElement$: hostElement,
3159
- $cmpMeta$: cmpMeta,
3160
- $instanceValues$: new Map(),
3161
- };
3162
- {
3163
- hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
3164
- }
3165
- {
3166
- hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
3167
- hostElement['s-p'] = [];
3168
- hostElement['s-rc'] = [];
3169
- }
3170
- addHostEventListeners(hostElement, hostRef, cmpMeta.$listeners$);
3171
- return hostRefs.set(hostElement, hostRef);
3172
- };
3173
- const isMemberInElement = (elm, memberName) => memberName in elm;
3174
- const consoleError = (e, el) => (0, console.error)(e, el);
3175
- const cmpModules = /*@__PURE__*/ new Map();
3176
- const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
3177
- // loadModuleImport
3178
- const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
3179
- const bundleId = cmpMeta.$lazyBundleId$;
3180
- const module = cmpModules.get(bundleId) ;
3181
- if (module) {
3182
- return module[exportName];
3183
- }
3184
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
3185
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3186
- /* @vite-ignore */
3187
- /* webpackInclude: /\.entry\.js$/ */
3188
- /* webpackExclude: /\.system\.entry\.js$/ */
3189
- /* webpackMode: "lazy" */
3190
- `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
3191
- {
3192
- cmpModules.set(bundleId, importedModule);
3193
- }
3194
- return importedModule[exportName];
3195
- }, consoleError);
3196
- };
3197
- const styles = /*@__PURE__*/ new Map();
3198
- const modeResolutionChain = [];
3199
- const win = typeof window !== 'undefined' ? window : {};
3200
- const doc = win.document || { head: {} };
3201
- const H = (win.HTMLElement || class {
3202
- });
3203
- const plt = {
3204
- $flags$: 0,
3205
- $resourcesUrl$: '',
3206
- jmp: (h) => h(),
3207
- raf: (h) => requestAnimationFrame(h),
3208
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
3209
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
3210
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
3211
- };
3212
- const setPlatformHelpers = (helpers) => {
3213
- Object.assign(plt, helpers);
3214
- };
3215
- const supportsShadow =
3216
- // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
3217
- true;
3218
- const supportsListenerOptions = /*@__PURE__*/ (() => {
3219
- let supportsListenerOptions = false;
3220
- try {
3221
- doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
3222
- get() {
3223
- supportsListenerOptions = true;
3224
- },
3225
- }));
3226
- }
3227
- catch (e) { }
3228
- return supportsListenerOptions;
3229
- })();
3230
- const promiseResolve = (v) => Promise.resolve(v);
3231
- const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
3232
- try {
3233
- new CSSStyleSheet();
3234
- return typeof new CSSStyleSheet().replaceSync === 'function';
3235
- }
3236
- catch (e) { }
3237
- return false;
3238
- })()
3239
- ;
3240
- const queueDomReads = [];
3241
- const queueDomWrites = [];
3242
- const queueTask = (queue, write) => (cb) => {
3243
- queue.push(cb);
3244
- if (!queuePending) {
3245
- queuePending = true;
3246
- if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
3247
- nextTick(flush);
3248
- }
3249
- else {
3250
- plt.raf(flush);
3251
- }
3252
- }
3253
- };
3254
- const consume = (queue) => {
3255
- for (let i = 0; i < queue.length; i++) {
3256
- try {
3257
- queue[i](performance.now());
3258
- }
3259
- catch (e) {
3260
- consoleError(e);
3261
- }
3262
- }
3263
- queue.length = 0;
3264
- };
3265
- const flush = () => {
3266
- // always force a bunch of medium callbacks to run, but still have
3267
- // a throttle on how many can run in a certain time
3268
- // DOM READS!!!
3269
- consume(queueDomReads);
3270
- // DOM WRITES!!!
3271
- {
3272
- consume(queueDomWrites);
3273
- if ((queuePending = queueDomReads.length > 0)) {
3274
- // still more to do yet, but we've run out of time
3275
- // let's let this thing cool off and try again in the next tick
3276
- plt.raf(flush);
3277
- }
3278
- }
3279
- };
3280
- const nextTick = (cb) => promiseResolve().then(cb);
3281
- const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
3282
- const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
3283
-
3284
- exports.Build = Build;
3285
- exports.H = H;
3286
- exports.Host = Host;
3287
- exports.bootstrapLazy = bootstrapLazy;
3288
- exports.createEvent = createEvent;
3289
- exports.forceUpdate = forceUpdate;
3290
- exports.getAssetPath = getAssetPath;
3291
- exports.getElement = getElement;
3292
- exports.getMode = getMode;
3293
- exports.h = h;
3294
- exports.promiseResolve = promiseResolve;
3295
- exports.readTask = readTask;
3296
- exports.registerInstance = registerInstance;
3297
- exports.setMode = setMode;
3298
- exports.setNonce = setNonce;
3299
- exports.setPlatformHelpers = setPlatformHelpers;
3300
- exports.writeTask = writeTask;