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