@nanoporetech-digital/components 3.7.1 → 3.8.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 (781) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/cjs/{algolia-data-9152d0ef.js → algolia-data-fb13160a.js} +2 -2
  3. package/dist/cjs/{algolia-data-9152d0ef.js.map → algolia-data-fb13160a.js.map} +1 -1
  4. package/dist/cjs/{algoliasearch.umd-7ee60729.js → algoliasearch.umd-689c1560.js} +3 -3
  5. package/dist/cjs/{algoliasearch.umd-7ee60729.js.map → algoliasearch.umd-689c1560.js.map} +1 -1
  6. package/dist/cjs/{component-store-d7c8c326.js → component-store-b80bdb26.js} +25 -12
  7. package/dist/cjs/component-store-b80bdb26.js.map +1 -0
  8. package/dist/cjs/{dom-d7c33f11.js → dom-7acf7afd.js} +15 -15
  9. package/dist/cjs/dom-7acf7afd.js.map +1 -0
  10. package/dist/cjs/{form-control-57c71246.js → form-control-845951ac.js} +4 -4
  11. package/dist/cjs/form-control-845951ac.js.map +1 -0
  12. package/dist/{esm/global-8047b4ff.js → cjs/global-3a6a7873.js} +5 -14
  13. package/dist/cjs/global-3a6a7873.js.map +1 -0
  14. package/dist/cjs/{index-bb2a6ab8.js → index-5e11be36.js} +2 -2
  15. package/dist/cjs/{index-bb2a6ab8.js.map → index-5e11be36.js.map} +1 -1
  16. package/dist/cjs/{index-ece1cb9e.js → index-72ee0363.js} +2 -10
  17. package/dist/cjs/index-72ee0363.js.map +1 -0
  18. package/dist/cjs/{index-41582c2a.js → index-e1b5c3ea.js} +1438 -516
  19. package/dist/cjs/index-e1b5c3ea.js.map +1 -0
  20. package/dist/cjs/index.cjs.js +18 -35
  21. package/dist/cjs/index.cjs.js.map +1 -1
  22. package/dist/cjs/loader.cjs.js +5 -4
  23. package/dist/cjs/loader.cjs.js.map +1 -1
  24. package/dist/cjs/{modal-e4defcc3.js → modal-5884a6de.js} +3 -2
  25. package/dist/cjs/modal-5884a6de.js.map +1 -0
  26. package/dist/cjs/nano-accordion.cjs.entry.js +4 -7
  27. package/dist/cjs/nano-accordion.cjs.entry.js.map +1 -1
  28. package/dist/cjs/nano-alert.cjs.entry.js +25 -19
  29. package/dist/cjs/nano-alert.cjs.entry.js.map +1 -1
  30. package/dist/cjs/nano-algolia-filter.cjs.entry.js +5 -5
  31. package/dist/cjs/nano-algolia-filter.cjs.entry.js.map +1 -1
  32. package/dist/cjs/nano-algolia-input.cjs.entry.js +4 -4
  33. package/dist/cjs/nano-algolia-input.cjs.entry.js.map +1 -1
  34. package/dist/cjs/nano-algolia-pagination.cjs.entry.js +2 -2
  35. package/dist/cjs/nano-algolia-results.cjs.entry.js +2 -2
  36. package/dist/cjs/nano-algolia.cjs.entry.js +8 -8
  37. package/dist/cjs/nano-algolia.cjs.entry.js.map +1 -1
  38. package/dist/cjs/nano-aspect-ratio.cjs.entry.js +1 -1
  39. package/dist/cjs/nano-checkbox-group.cjs.entry.js +52 -9
  40. package/dist/cjs/nano-checkbox-group.cjs.entry.js.map +1 -1
  41. package/dist/cjs/nano-checkbox.cjs.entry.js +8 -8
  42. package/dist/cjs/nano-checkbox.cjs.entry.js.map +1 -1
  43. package/dist/cjs/nano-components.cjs.js +8 -4
  44. package/dist/cjs/nano-components.cjs.js.map +1 -1
  45. package/dist/cjs/nano-datalist_3.cjs.entry.js +46 -36
  46. package/dist/cjs/nano-datalist_3.cjs.entry.js.map +1 -1
  47. package/dist/cjs/nano-date-input.cjs.entry.js +6 -6
  48. package/dist/cjs/nano-date-input.cjs.entry.js.map +1 -1
  49. package/dist/cjs/nano-date-picker.cjs.entry.js +4 -4
  50. package/dist/cjs/nano-date-picker.cjs.entry.js.map +1 -1
  51. package/dist/cjs/nano-demo.cjs.entry.js +13 -9
  52. package/dist/cjs/nano-demo.cjs.entry.js.map +1 -1
  53. package/dist/cjs/nano-details.cjs.entry.js +4 -4
  54. package/dist/cjs/nano-details.cjs.entry.js.map +1 -1
  55. package/dist/cjs/nano-dialog.cjs.entry.js +6 -6
  56. package/dist/cjs/nano-dialog.cjs.entry.js.map +1 -1
  57. package/dist/cjs/nano-drawer.cjs.entry.js +5 -5
  58. package/dist/cjs/nano-drawer.cjs.entry.js.map +1 -1
  59. package/dist/cjs/nano-dropdown.cjs.entry.js +9 -4
  60. package/dist/cjs/nano-dropdown.cjs.entry.js.map +1 -1
  61. package/dist/cjs/nano-field-validator.cjs.entry.js +4 -3
  62. package/dist/cjs/nano-field-validator.cjs.entry.js.map +1 -1
  63. package/dist/cjs/nano-file-upload.cjs.entry.js +5 -5
  64. package/dist/cjs/nano-file-upload.cjs.entry.js.map +1 -1
  65. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +54 -67
  66. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
  67. package/dist/cjs/nano-global-nav.cjs.entry.js +54 -26
  68. package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
  69. package/dist/cjs/nano-global-search-results.cjs.entry.js +6 -4
  70. package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
  71. package/dist/cjs/nano-grid_3.cjs.entry.js +8 -7
  72. package/dist/cjs/nano-grid_3.cjs.entry.js.map +1 -1
  73. package/dist/cjs/nano-hero.cjs.entry.js +4 -2
  74. package/dist/cjs/nano-hero.cjs.entry.js.map +1 -1
  75. package/dist/cjs/nano-icon-button.cjs.entry.js +2 -2
  76. package/dist/cjs/nano-icon-button.cjs.entry.js.map +1 -1
  77. package/dist/cjs/nano-icon.cjs.entry.js +7 -14
  78. package/dist/cjs/nano-icon.cjs.entry.js.map +1 -1
  79. package/dist/cjs/nano-input.cjs.entry.js +19 -33
  80. package/dist/cjs/nano-input.cjs.entry.js.map +1 -1
  81. package/dist/cjs/nano-menu-drawer.cjs.entry.js +3 -3
  82. package/dist/cjs/nano-menu-drawer.cjs.entry.js.map +1 -1
  83. package/dist/cjs/nano-progress-bar_2.cjs.entry.js +4 -4
  84. package/dist/cjs/nano-progress-bar_2.cjs.entry.js.map +1 -1
  85. package/dist/cjs/nano-range.cjs.entry.js +4 -4
  86. package/dist/cjs/nano-range.cjs.entry.js.map +1 -1
  87. package/dist/cjs/nano-rating.cjs.entry.js +2 -2
  88. package/dist/cjs/nano-rating.cjs.entry.js.map +1 -1
  89. package/dist/cjs/nano-resize-observe_2.cjs.entry.js +18 -10
  90. package/dist/cjs/nano-resize-observe_2.cjs.entry.js.map +1 -1
  91. package/dist/cjs/nano-slide.cjs.entry.js +1 -1
  92. package/dist/cjs/nano-slides.cjs.entry.js +11 -21
  93. package/dist/cjs/nano-slides.cjs.entry.js.map +1 -1
  94. package/dist/cjs/nano-spinner.cjs.entry.js +3 -3
  95. package/dist/cjs/nano-spinner.cjs.entry.js.map +1 -1
  96. package/dist/cjs/nano-split-pane.cjs.entry.js +15 -13
  97. package/dist/cjs/nano-split-pane.cjs.entry.js.map +1 -1
  98. package/dist/cjs/nano-sticker.cjs.entry.js +6 -4
  99. package/dist/cjs/nano-sticker.cjs.entry.js.map +1 -1
  100. package/dist/cjs/nano-tab-content.cjs.entry.js +9 -3
  101. package/dist/cjs/nano-tab-content.cjs.entry.js.map +1 -1
  102. package/dist/cjs/nano-tab-group.cjs.entry.js +18 -12
  103. package/dist/cjs/nano-tab-group.cjs.entry.js.map +1 -1
  104. package/dist/cjs/nano-tab.cjs.entry.js +2 -2
  105. package/dist/cjs/nano-tab.cjs.entry.js.map +1 -1
  106. package/dist/cjs/{nano-table-820b04d5.js → nano-table-e76a8dde.js} +115 -150
  107. package/dist/cjs/nano-table-e76a8dde.js.map +1 -0
  108. package/dist/cjs/nano-table.cjs.entry.js +3 -3
  109. package/dist/cjs/{popover-508bcedb.js → popover-088646b2.js} +61 -50
  110. package/dist/cjs/popover-088646b2.js.map +1 -0
  111. package/dist/cjs/{scroll-9bb5e060.js → scroll-a197d9c4.js} +2 -2
  112. package/dist/cjs/{scroll-9bb5e060.js.map → scroll-a197d9c4.js.map} +1 -1
  113. package/dist/cjs/{table.worker-9e238d16.js → table.worker-988d87da.js} +4 -4
  114. package/dist/cjs/table.worker-988d87da.js.map +1 -0
  115. package/dist/cjs/{theme-50275e1a.js → theme-9cbe28c5.js} +2 -7
  116. package/dist/cjs/theme-9cbe28c5.js.map +1 -0
  117. package/dist/collection/collection-manifest.json +2 -2
  118. package/dist/collection/components/accordion/accordion.js +1 -4
  119. package/dist/collection/components/accordion/accordion.js.map +1 -1
  120. package/dist/collection/components/alert/alert.css +4 -3
  121. package/dist/collection/components/alert/alert.helpers.js +6 -24
  122. package/dist/collection/components/alert/alert.helpers.js.map +1 -1
  123. package/dist/collection/components/alert/alert.js +19 -13
  124. package/dist/collection/components/alert/alert.js.map +1 -1
  125. package/dist/collection/components/algolia/algolia-filter.js +2 -2
  126. package/dist/collection/components/algolia/algolia-filter.js.map +1 -1
  127. package/dist/collection/components/algolia/algolia-input.js.map +1 -1
  128. package/dist/collection/components/algolia/algolia.css +2 -1
  129. package/dist/collection/components/algolia/algolia.js +3 -3
  130. package/dist/collection/components/algolia/algolia.js.map +1 -1
  131. package/dist/collection/components/checkbox/checkbox-group.css +16 -10
  132. package/dist/collection/components/checkbox/checkbox-group.js +91 -7
  133. package/dist/collection/components/checkbox/checkbox-group.js.map +1 -1
  134. package/dist/collection/components/checkbox/checkbox.css +14 -12
  135. package/dist/collection/components/checkbox/checkbox.js +5 -5
  136. package/dist/collection/components/checkbox/checkbox.js.map +1 -1
  137. package/dist/collection/components/datalist/datalist.js +39 -31
  138. package/dist/collection/components/datalist/datalist.js.map +1 -1
  139. package/dist/collection/components/date-input/date-input.css +3 -3
  140. package/dist/collection/components/date-input/date-input.js +3 -3
  141. package/dist/collection/components/date-input/date-input.js.map +1 -1
  142. package/dist/collection/components/date-picker/date-picker.css +15 -11
  143. package/dist/collection/components/date-picker/date-picker.js +1 -1
  144. package/dist/collection/components/date-picker/date-picker.js.map +1 -1
  145. package/dist/collection/components/demo/demo.js +12 -8
  146. package/dist/collection/components/demo/demo.js.map +1 -1
  147. package/dist/collection/components/details/details.css +2 -1
  148. package/dist/collection/components/details/details.js +1 -1
  149. package/dist/collection/components/details/details.js.map +1 -1
  150. package/dist/collection/components/dialog/dialog.css +8 -5
  151. package/dist/collection/components/dialog/dialog.helpers.js +3 -11
  152. package/dist/collection/components/dialog/dialog.helpers.js.map +1 -1
  153. package/dist/collection/components/drawer/drawer.css +2 -2
  154. package/dist/collection/components/dropdown/dropdown.css +1 -1
  155. package/dist/collection/components/dropdown/dropdown.js +6 -1
  156. package/dist/collection/components/dropdown/dropdown.js.map +1 -1
  157. package/dist/collection/components/field-validator/field-validator.js +2 -1
  158. package/dist/collection/components/field-validator/field-validator.js.map +1 -1
  159. package/dist/collection/components/file-upload/file-upload.css +35 -25
  160. package/dist/collection/components/file-upload/file-upload.js +4 -4
  161. package/dist/collection/components/file-upload/file-upload.js.map +1 -1
  162. package/dist/collection/components/form-control/form-control.js +2 -2
  163. package/dist/collection/components/form-control/form-control.js.map +1 -1
  164. package/dist/collection/components/global-nav/global-nav-user-profile.js +6 -7
  165. package/dist/collection/components/global-nav/global-nav-user-profile.js.map +1 -1
  166. package/dist/collection/components/global-nav/global-nav.js +61 -11
  167. package/dist/collection/components/global-nav/global-nav.js.map +1 -1
  168. package/dist/collection/components/global-nav/style/global-nav.css +92 -48
  169. package/dist/collection/components/global-search-results/global-search-results.css +83 -44
  170. package/dist/collection/components/global-search-results/global-search-results.js +4 -2
  171. package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
  172. package/dist/collection/components/grid/grid-item.css +1 -1
  173. package/dist/collection/components/grid/grid.css +1 -0
  174. package/dist/collection/components/grid/grid.js +2 -0
  175. package/dist/collection/components/grid/grid.js.map +1 -1
  176. package/dist/collection/components/hero/hero.css +110 -18
  177. package/dist/collection/components/hero/hero.js +2 -0
  178. package/dist/collection/components/hero/hero.js.map +1 -1
  179. package/dist/collection/components/icon/icon.css +2 -2
  180. package/dist/collection/components/icon/icon.js +3 -10
  181. package/dist/collection/components/icon/icon.js.map +1 -1
  182. package/dist/collection/components/icon-button/icon-button.css +1 -1
  183. package/dist/collection/components/img/img.css +0 -1
  184. package/dist/collection/components/img/img.js +3 -4
  185. package/dist/collection/components/img/img.js.map +1 -1
  186. package/dist/collection/components/input/input.css +54 -32
  187. package/dist/collection/components/input/input.js +14 -28
  188. package/dist/collection/components/input/input.js.map +1 -1
  189. package/dist/collection/components/menu/menu.js +4 -2
  190. package/dist/collection/components/menu/menu.js.map +1 -1
  191. package/dist/collection/components/menu-drawer/menu-drawer.css +20 -13
  192. package/dist/collection/components/menu-drawer/menu-drawer.js +1 -1
  193. package/dist/collection/components/menu-drawer/menu-drawer.js.map +1 -1
  194. package/dist/collection/components/nav-item/nav-item.css +31 -16
  195. package/dist/collection/components/nav-item/nav-item.js +4 -4
  196. package/dist/collection/components/nav-item/nav-item.js.map +1 -1
  197. package/dist/collection/components/option/option.css +4 -2
  198. package/dist/collection/components/progress-bar/progress-bar.css +4 -4
  199. package/dist/collection/components/range/range.css +11 -9
  200. package/dist/collection/components/rating/rating.css +9 -5
  201. package/dist/collection/components/resize-observe/resize-observe.js +17 -6
  202. package/dist/collection/components/resize-observe/resize-observe.js.map +1 -1
  203. package/dist/collection/components/select/select.css +59 -34
  204. package/dist/collection/components/select/select.js +42 -55
  205. package/dist/collection/components/select/select.js.map +1 -1
  206. package/dist/collection/components/skeleton/skeleton.css +5 -5
  207. package/dist/collection/components/slides/slides.css +4 -2
  208. package/dist/collection/components/slides/slides.js +9 -19
  209. package/dist/collection/components/slides/slides.js.map +1 -1
  210. package/dist/collection/components/spinner/spinner.css +13 -8
  211. package/dist/collection/components/spinner/spinner.js +1 -1
  212. package/dist/collection/components/spinner/spinner.js.map +1 -1
  213. package/dist/collection/components/split-pane/split-pane.css +1 -1
  214. package/dist/collection/components/split-pane/split-pane.js +13 -11
  215. package/dist/collection/components/split-pane/split-pane.js.map +1 -1
  216. package/dist/collection/components/sticker/sticker.js +4 -2
  217. package/dist/collection/components/sticker/sticker.js.map +1 -1
  218. package/dist/collection/components/table/table.cell.js +8 -8
  219. package/dist/collection/components/table/table.cell.js.map +1 -1
  220. package/dist/collection/components/table/table.css +46 -25
  221. package/dist/collection/components/table/table.header.js +6 -19
  222. package/dist/collection/components/table/table.header.js.map +1 -1
  223. package/dist/collection/components/table/table.js +85 -93
  224. package/dist/collection/components/table/table.js.map +1 -1
  225. package/dist/collection/components/table/table.row.js +8 -8
  226. package/dist/collection/components/table/table.row.js.map +1 -1
  227. package/dist/collection/components/table/table.store.js +2 -1
  228. package/dist/collection/components/table/table.store.js.map +1 -1
  229. package/dist/collection/components/table/table.utils.js +8 -7
  230. package/dist/collection/components/table/table.utils.js.map +1 -1
  231. package/dist/collection/components/tabs/tab-content.css +7 -2
  232. package/dist/collection/components/tabs/tab-content.js +12 -1
  233. package/dist/collection/components/tabs/tab-content.js.map +1 -1
  234. package/dist/collection/components/tabs/tab-group.css +13 -10
  235. package/dist/collection/components/tabs/tab-group.js +17 -7
  236. package/dist/collection/components/tabs/tab-group.js.map +1 -1
  237. package/dist/collection/components/tabs/tab.css +21 -12
  238. package/dist/collection/components/tooltip/tooltip.css +25 -16
  239. package/dist/collection/global/script/global.js +2 -13
  240. package/dist/collection/global/script/global.js.map +1 -1
  241. package/dist/collection/index.js +17 -0
  242. package/dist/collection/index.js.map +1 -1
  243. package/dist/collection/utils/dom.js +16 -15
  244. package/dist/collection/utils/dom.js.map +1 -1
  245. package/dist/collection/utils/fetch.js +15 -12
  246. package/dist/collection/utils/fetch.js.map +1 -1
  247. package/dist/collection/utils/gesture/index.js +1 -9
  248. package/dist/collection/utils/gesture/index.js.map +1 -1
  249. package/dist/collection/utils/modal.js +2 -1
  250. package/dist/collection/utils/modal.js.map +1 -1
  251. package/dist/collection/utils/store/get-set.js +1 -1
  252. package/dist/collection/utils/store/get-set.js.map +1 -1
  253. package/dist/collection/utils/testing/index.js +1 -0
  254. package/dist/collection/utils/testing/index.js.map +1 -1
  255. package/dist/collection/utils/theme.js +1 -6
  256. package/dist/collection/utils/theme.js.map +1 -1
  257. package/dist/components/algolia.js +3 -3
  258. package/dist/components/algolia.js.map +1 -1
  259. package/dist/components/algoliasearch.umd.js +2 -2
  260. package/dist/components/algoliasearch.umd.js.map +1 -1
  261. package/dist/components/component-store.js +23 -10
  262. package/dist/components/component-store.js.map +1 -1
  263. package/dist/components/datalist.js +39 -31
  264. package/dist/components/datalist.js.map +1 -1
  265. package/dist/components/date-picker.js +2 -2
  266. package/dist/components/date-picker.js.map +1 -1
  267. package/dist/components/dom.js +17 -15
  268. package/dist/components/dom.js.map +1 -1
  269. package/dist/components/dropdown.js +7 -2
  270. package/dist/components/dropdown.js.map +1 -1
  271. package/dist/components/form-control.js +2 -2
  272. package/dist/components/form-control.js.map +1 -1
  273. package/dist/components/global-nav-user-profile.js +4 -3
  274. package/dist/components/global-nav-user-profile.js.map +1 -1
  275. package/dist/components/grid-item.js +1 -1
  276. package/dist/components/grid-item.js.map +1 -1
  277. package/dist/components/grid.js +3 -1
  278. package/dist/components/grid.js.map +1 -1
  279. package/dist/components/icon-button.js +1 -1
  280. package/dist/components/icon-button.js.map +1 -1
  281. package/dist/components/icon.js +4 -11
  282. package/dist/components/icon.js.map +1 -1
  283. package/dist/components/img.js +4 -5
  284. package/dist/components/img.js.map +1 -1
  285. package/dist/components/index.d.ts +9 -0
  286. package/dist/components/index.js +23 -52
  287. package/dist/components/index.js.map +1 -1
  288. package/dist/components/index3.js +635 -1069
  289. package/dist/components/index3.js.map +1 -1
  290. package/dist/components/input.js +15 -29
  291. package/dist/components/input.js.map +1 -1
  292. package/dist/components/menu.js +4 -2
  293. package/dist/components/menu.js.map +1 -1
  294. package/dist/components/modal.js +2 -1
  295. package/dist/components/modal.js.map +1 -1
  296. package/dist/components/nano-accordion.js +1 -4
  297. package/dist/components/nano-accordion.js.map +1 -1
  298. package/dist/components/nano-alert.js +20 -14
  299. package/dist/components/nano-alert.js.map +1 -1
  300. package/dist/components/nano-algolia-filter.js +2 -2
  301. package/dist/components/nano-algolia-filter.js.map +1 -1
  302. package/dist/components/nano-algolia-input.js.map +1 -1
  303. package/dist/components/nano-checkbox-group.js +53 -9
  304. package/dist/components/nano-checkbox-group.js.map +1 -1
  305. package/dist/components/nano-checkbox.js +6 -6
  306. package/dist/components/nano-checkbox.js.map +1 -1
  307. package/dist/components/nano-date-input.js +4 -4
  308. package/dist/components/nano-date-input.js.map +1 -1
  309. package/dist/components/nano-demo.js +12 -8
  310. package/dist/components/nano-demo.js.map +1 -1
  311. package/dist/components/nano-details.js +2 -2
  312. package/dist/components/nano-details.js.map +1 -1
  313. package/dist/components/nano-dialog.js +1 -1
  314. package/dist/components/nano-dialog.js.map +1 -1
  315. package/dist/components/nano-drawer.js +1 -1
  316. package/dist/components/nano-drawer.js.map +1 -1
  317. package/dist/components/nano-field-validator.js +2 -1
  318. package/dist/components/nano-field-validator.js.map +1 -1
  319. package/dist/components/nano-file-upload.js +4 -4
  320. package/dist/components/nano-file-upload.js.map +1 -1
  321. package/dist/components/nano-global-nav.js +51 -22
  322. package/dist/components/nano-global-nav.js.map +1 -1
  323. package/dist/components/nano-global-search-results.js +5 -3
  324. package/dist/components/nano-global-search-results.js.map +1 -1
  325. package/dist/components/nano-hero.js +3 -1
  326. package/dist/components/nano-hero.js.map +1 -1
  327. package/dist/components/nano-menu-drawer.js +2 -2
  328. package/dist/components/nano-menu-drawer.js.map +1 -1
  329. package/dist/components/nano-range.js +2 -2
  330. package/dist/components/nano-range.js.map +1 -1
  331. package/dist/components/nano-rating.js +1 -1
  332. package/dist/components/nano-rating.js.map +1 -1
  333. package/dist/components/nano-slides.js +10 -20
  334. package/dist/components/nano-slides.js.map +1 -1
  335. package/dist/components/nano-split-pane.js +14 -12
  336. package/dist/components/nano-split-pane.js.map +1 -1
  337. package/dist/components/nano-tab-content.js +10 -3
  338. package/dist/components/nano-tab-content.js.map +1 -1
  339. package/dist/components/nano-tab-group.js +18 -8
  340. package/dist/components/nano-tab-group.js.map +1 -1
  341. package/dist/components/nano-tab.js +1 -1
  342. package/dist/components/nano-tab.js.map +1 -1
  343. package/dist/components/nav-item.js +5 -5
  344. package/dist/components/nav-item.js.map +1 -1
  345. package/dist/components/option.js +1 -1
  346. package/dist/components/option.js.map +1 -1
  347. package/dist/components/popover.js +60 -49
  348. package/dist/components/popover.js.map +1 -1
  349. package/dist/components/progress-bar.js +1 -1
  350. package/dist/components/progress-bar.js.map +1 -1
  351. package/dist/components/resize-observe.js +16 -8
  352. package/dist/components/resize-observe.js.map +1 -1
  353. package/dist/components/select.js +43 -56
  354. package/dist/components/select.js.map +1 -1
  355. package/dist/components/skeleton.js +1 -1
  356. package/dist/components/skeleton.js.map +1 -1
  357. package/dist/components/spinner.js +2 -2
  358. package/dist/components/spinner.js.map +1 -1
  359. package/dist/components/sticker.js +4 -2
  360. package/dist/components/sticker.js.map +1 -1
  361. package/dist/components/table.js +117 -152
  362. package/dist/components/table.js.map +1 -1
  363. package/dist/components/theme.js +1 -6
  364. package/dist/components/theme.js.map +1 -1
  365. package/dist/components/tooltip.js +1 -1
  366. package/dist/components/tooltip.js.map +1 -1
  367. package/dist/esm/{algolia-data-b5cd0c58.js → algolia-data-c4ed188c.js} +2 -2
  368. package/dist/esm/{algolia-data-b5cd0c58.js.map → algolia-data-c4ed188c.js.map} +1 -1
  369. package/dist/esm/{algoliasearch.umd-86359963.js → algoliasearch.umd-4f7efa84.js} +3 -3
  370. package/dist/esm/{algoliasearch.umd-86359963.js.map → algoliasearch.umd-4f7efa84.js.map} +1 -1
  371. package/dist/esm/{component-store-ec512820.js → component-store-6eccd724.js} +25 -12
  372. package/dist/esm/component-store-6eccd724.js.map +1 -0
  373. package/dist/esm/{dom-d3ad49e2.js → dom-311c9e1e.js} +15 -15
  374. package/dist/esm/dom-311c9e1e.js.map +1 -0
  375. package/dist/esm/{form-control-84bac7a2.js → form-control-3284c2c9.js} +4 -4
  376. package/dist/esm/form-control-3284c2c9.js.map +1 -0
  377. package/dist/{cjs/global-989678ec.js → esm/global-f6e05656.js} +3 -16
  378. package/dist/esm/global-f6e05656.js.map +1 -0
  379. package/dist/esm/{index-c752dae1.js → index-38484737.js} +2 -2
  380. package/dist/esm/{index-c752dae1.js.map → index-38484737.js.map} +1 -1
  381. package/dist/esm/{index-3c280603.js → index-b4e277ad.js} +1438 -517
  382. package/dist/esm/index-b4e277ad.js.map +1 -0
  383. package/dist/{components/index4.js → esm/index-f626f476.js} +2 -10
  384. package/dist/esm/index-f626f476.js.map +1 -0
  385. package/dist/esm/index.js +18 -36
  386. package/dist/esm/index.js.map +1 -1
  387. package/dist/esm/loader.js +5 -4
  388. package/dist/esm/loader.js.map +1 -1
  389. package/dist/esm/{modal-5c9ce466.js → modal-1f3223cd.js} +3 -2
  390. package/dist/esm/modal-1f3223cd.js.map +1 -0
  391. package/dist/esm/nano-accordion.entry.js +4 -7
  392. package/dist/esm/nano-accordion.entry.js.map +1 -1
  393. package/dist/esm/nano-alert.entry.js +25 -19
  394. package/dist/esm/nano-alert.entry.js.map +1 -1
  395. package/dist/esm/nano-algolia-filter.entry.js +5 -5
  396. package/dist/esm/nano-algolia-filter.entry.js.map +1 -1
  397. package/dist/esm/nano-algolia-input.entry.js +4 -4
  398. package/dist/esm/nano-algolia-input.entry.js.map +1 -1
  399. package/dist/esm/nano-algolia-pagination.entry.js +2 -2
  400. package/dist/esm/nano-algolia-results.entry.js +2 -2
  401. package/dist/esm/nano-algolia.entry.js +8 -8
  402. package/dist/esm/nano-algolia.entry.js.map +1 -1
  403. package/dist/esm/nano-aspect-ratio.entry.js +1 -1
  404. package/dist/esm/nano-checkbox-group.entry.js +52 -9
  405. package/dist/esm/nano-checkbox-group.entry.js.map +1 -1
  406. package/dist/esm/nano-checkbox.entry.js +8 -8
  407. package/dist/esm/nano-checkbox.entry.js.map +1 -1
  408. package/dist/esm/nano-components.js +5 -4
  409. package/dist/esm/nano-components.js.map +1 -1
  410. package/dist/esm/nano-datalist_3.entry.js +46 -36
  411. package/dist/esm/nano-datalist_3.entry.js.map +1 -1
  412. package/dist/esm/nano-date-input.entry.js +6 -6
  413. package/dist/esm/nano-date-input.entry.js.map +1 -1
  414. package/dist/esm/nano-date-picker.entry.js +4 -4
  415. package/dist/esm/nano-date-picker.entry.js.map +1 -1
  416. package/dist/esm/nano-demo.entry.js +13 -9
  417. package/dist/esm/nano-demo.entry.js.map +1 -1
  418. package/dist/esm/nano-details.entry.js +4 -4
  419. package/dist/esm/nano-details.entry.js.map +1 -1
  420. package/dist/esm/nano-dialog.entry.js +6 -6
  421. package/dist/esm/nano-dialog.entry.js.map +1 -1
  422. package/dist/esm/nano-drawer.entry.js +5 -5
  423. package/dist/esm/nano-drawer.entry.js.map +1 -1
  424. package/dist/esm/nano-dropdown.entry.js +9 -4
  425. package/dist/esm/nano-dropdown.entry.js.map +1 -1
  426. package/dist/esm/nano-field-validator.entry.js +4 -3
  427. package/dist/esm/nano-field-validator.entry.js.map +1 -1
  428. package/dist/esm/nano-file-upload.entry.js +5 -5
  429. package/dist/esm/nano-file-upload.entry.js.map +1 -1
  430. package/dist/esm/nano-global-nav-user-profile_3.entry.js +54 -67
  431. package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
  432. package/dist/esm/nano-global-nav.entry.js +54 -26
  433. package/dist/esm/nano-global-nav.entry.js.map +1 -1
  434. package/dist/esm/nano-global-search-results.entry.js +6 -4
  435. package/dist/esm/nano-global-search-results.entry.js.map +1 -1
  436. package/dist/esm/nano-grid_3.entry.js +8 -7
  437. package/dist/esm/nano-grid_3.entry.js.map +1 -1
  438. package/dist/esm/nano-hero.entry.js +4 -2
  439. package/dist/esm/nano-hero.entry.js.map +1 -1
  440. package/dist/esm/nano-icon-button.entry.js +2 -2
  441. package/dist/esm/nano-icon-button.entry.js.map +1 -1
  442. package/dist/esm/nano-icon.entry.js +7 -14
  443. package/dist/esm/nano-icon.entry.js.map +1 -1
  444. package/dist/esm/nano-input.entry.js +19 -33
  445. package/dist/esm/nano-input.entry.js.map +1 -1
  446. package/dist/esm/nano-menu-drawer.entry.js +3 -3
  447. package/dist/esm/nano-menu-drawer.entry.js.map +1 -1
  448. package/dist/esm/nano-progress-bar_2.entry.js +4 -4
  449. package/dist/esm/nano-progress-bar_2.entry.js.map +1 -1
  450. package/dist/esm/nano-range.entry.js +4 -4
  451. package/dist/esm/nano-range.entry.js.map +1 -1
  452. package/dist/esm/nano-rating.entry.js +2 -2
  453. package/dist/esm/nano-rating.entry.js.map +1 -1
  454. package/dist/esm/nano-resize-observe_2.entry.js +18 -10
  455. package/dist/esm/nano-resize-observe_2.entry.js.map +1 -1
  456. package/dist/esm/nano-slide.entry.js +1 -1
  457. package/dist/esm/nano-slides.entry.js +11 -21
  458. package/dist/esm/nano-slides.entry.js.map +1 -1
  459. package/dist/esm/nano-spinner.entry.js +3 -3
  460. package/dist/esm/nano-spinner.entry.js.map +1 -1
  461. package/dist/esm/nano-split-pane.entry.js +15 -13
  462. package/dist/esm/nano-split-pane.entry.js.map +1 -1
  463. package/dist/esm/nano-sticker.entry.js +6 -4
  464. package/dist/esm/nano-sticker.entry.js.map +1 -1
  465. package/dist/esm/nano-tab-content.entry.js +9 -3
  466. package/dist/esm/nano-tab-content.entry.js.map +1 -1
  467. package/dist/esm/nano-tab-group.entry.js +18 -12
  468. package/dist/esm/nano-tab-group.entry.js.map +1 -1
  469. package/dist/esm/nano-tab.entry.js +2 -2
  470. package/dist/esm/nano-tab.entry.js.map +1 -1
  471. package/dist/esm/{nano-table-1f4fe4ad.js → nano-table-5ff91f0f.js} +115 -150
  472. package/dist/esm/nano-table-5ff91f0f.js.map +1 -0
  473. package/dist/esm/nano-table.entry.js +3 -3
  474. package/dist/esm/polyfills/css-shim.js +1 -1
  475. package/dist/esm/{popover-e748bb61.js → popover-02e6714d.js} +61 -50
  476. package/dist/esm/popover-02e6714d.js.map +1 -0
  477. package/dist/esm/{scroll-a1e59d8c.js → scroll-e5825d8d.js} +2 -2
  478. package/dist/esm/{scroll-a1e59d8c.js.map → scroll-e5825d8d.js.map} +1 -1
  479. package/dist/esm/{table.worker-ddbd23c3.js → table.worker-5c1bb1ce.js} +4 -4
  480. package/dist/esm/table.worker-5c1bb1ce.js.map +1 -0
  481. package/dist/esm/{theme-931bd452.js → theme-82feb8cf.js} +2 -7
  482. package/dist/esm/theme-82feb8cf.js.map +1 -0
  483. package/dist/nano-components/index.esm.js +1 -1
  484. package/dist/nano-components/index.esm.js.map +1 -1
  485. package/dist/nano-components/nano-components.esm.js +1 -1
  486. package/dist/nano-components/nano-components.esm.js.map +1 -1
  487. package/dist/nano-components/{p-1a8e60c4.entry.js → p-0411f019.entry.js} +2 -2
  488. package/dist/nano-components/p-0411f019.entry.js.map +1 -0
  489. package/dist/nano-components/p-13b2d70c.entry.js +5 -0
  490. package/dist/nano-components/p-13b2d70c.entry.js.map +1 -0
  491. package/dist/nano-components/p-167b9165.js.map +1 -1
  492. package/dist/nano-components/p-1d21b2ce.entry.js +5 -0
  493. package/dist/nano-components/p-1d21b2ce.entry.js.map +1 -0
  494. package/dist/nano-components/p-2155fc2c.js.map +1 -1
  495. package/dist/nano-components/p-257432ff.js +5 -0
  496. package/dist/nano-components/p-257432ff.js.map +1 -0
  497. package/dist/nano-components/p-264903b5.entry.js +5 -0
  498. package/dist/nano-components/p-264903b5.entry.js.map +1 -0
  499. package/dist/nano-components/p-320366a2.entry.js +5 -0
  500. package/dist/nano-components/p-320366a2.entry.js.map +1 -0
  501. package/dist/nano-components/p-364434b4.entry.js +5 -0
  502. package/dist/nano-components/p-364434b4.entry.js.map +1 -0
  503. package/dist/nano-components/{p-3f25fc76.entry.js → p-36d5a41d.entry.js} +2 -2
  504. package/dist/nano-components/p-36d5a41d.entry.js.map +1 -0
  505. package/dist/nano-components/{p-1e709f87.entry.js → p-371fe61d.entry.js} +2 -2
  506. package/dist/nano-components/p-371fe61d.entry.js.map +1 -0
  507. package/dist/nano-components/p-3d658ce2.entry.js +5 -0
  508. package/dist/nano-components/p-3d658ce2.entry.js.map +1 -0
  509. package/dist/nano-components/p-3e95778d.entry.js +5 -0
  510. package/dist/nano-components/p-3e95778d.entry.js.map +1 -0
  511. package/dist/nano-components/p-400d698f.entry.js +5 -0
  512. package/dist/nano-components/p-400d698f.entry.js.map +1 -0
  513. package/dist/nano-components/p-411bb8f1.js +5 -0
  514. package/dist/nano-components/p-411bb8f1.js.map +1 -0
  515. package/dist/nano-components/p-41811365.js +5 -0
  516. package/dist/nano-components/p-41811365.js.map +1 -0
  517. package/dist/nano-components/p-45abbbdd.js.map +1 -1
  518. package/dist/nano-components/{p-885b6950.js → p-45b7682a.js} +2 -2
  519. package/dist/nano-components/p-45b7682a.js.map +1 -0
  520. package/dist/nano-components/p-4b1d73e9.entry.js +5 -0
  521. package/dist/nano-components/p-4b1d73e9.entry.js.map +1 -0
  522. package/dist/nano-components/{p-69e5a37d.entry.js → p-4e104cb1.entry.js} +2 -2
  523. package/dist/nano-components/p-4e104cb1.entry.js.map +1 -0
  524. package/dist/nano-components/p-51bc8b59.js +5 -0
  525. package/dist/nano-components/p-51bc8b59.js.map +1 -0
  526. package/dist/nano-components/p-5a466c9f.entry.js +5 -0
  527. package/dist/nano-components/p-5a466c9f.entry.js.map +1 -0
  528. package/dist/nano-components/{p-bd05b3aa.entry.js → p-5f1b94f0.entry.js} +2 -2
  529. package/dist/nano-components/{p-bd05b3aa.entry.js.map → p-5f1b94f0.entry.js.map} +1 -1
  530. package/dist/nano-components/p-60823325.entry.js +5 -0
  531. package/dist/nano-components/p-60823325.entry.js.map +1 -0
  532. package/dist/nano-components/p-6760e54a.entry.js +5 -0
  533. package/dist/nano-components/p-6760e54a.entry.js.map +1 -0
  534. package/dist/nano-components/p-69774e99.entry.js +5 -0
  535. package/dist/nano-components/p-69774e99.entry.js.map +1 -0
  536. package/dist/nano-components/p-69a3e911.js.map +1 -1
  537. package/dist/nano-components/p-6bca2d00.entry.js +5 -0
  538. package/dist/nano-components/p-6bca2d00.entry.js.map +1 -0
  539. package/dist/nano-components/p-74a7fc4f.js.map +1 -1
  540. package/dist/nano-components/{p-dba8a88d.entry.js → p-78169835.entry.js} +2 -2
  541. package/dist/nano-components/p-78169835.entry.js.map +1 -0
  542. package/dist/nano-components/p-817eda34.entry.js +5 -0
  543. package/dist/nano-components/p-817eda34.entry.js.map +1 -0
  544. package/dist/nano-components/p-866c73c0.entry.js +5 -0
  545. package/dist/nano-components/p-866c73c0.entry.js.map +1 -0
  546. package/dist/nano-components/p-87a76a81.entry.js +5 -0
  547. package/dist/nano-components/{p-41addb3a.entry.js.map → p-87a76a81.entry.js.map} +1 -1
  548. package/dist/nano-components/p-8907dd24.entry.js +5 -0
  549. package/dist/nano-components/p-8907dd24.entry.js.map +1 -0
  550. package/dist/nano-components/p-90365d7b.entry.js +5 -0
  551. package/dist/nano-components/p-90365d7b.entry.js.map +1 -0
  552. package/dist/nano-components/p-909a424c.js +5 -0
  553. package/dist/nano-components/p-909a424c.js.map +1 -0
  554. package/dist/nano-components/p-9746b0a5.js.map +1 -1
  555. package/dist/nano-components/p-9cf5fda3.entry.js +5 -0
  556. package/dist/nano-components/p-9cf5fda3.entry.js.map +1 -0
  557. package/dist/nano-components/p-9fcd383f.entry.js +5 -0
  558. package/dist/nano-components/p-9fcd383f.entry.js.map +1 -0
  559. package/dist/nano-components/p-9fda481b.entry.js +5 -0
  560. package/dist/nano-components/p-9fda481b.entry.js.map +1 -0
  561. package/dist/nano-components/p-abd6b774.entry.js +5 -0
  562. package/dist/nano-components/p-abd6b774.entry.js.map +1 -0
  563. package/dist/nano-components/p-b933f3c8.js.map +1 -1
  564. package/dist/nano-components/{p-2828788c.js → p-bb07c3d0.js} +2 -2
  565. package/dist/nano-components/p-bb07c3d0.js.map +1 -0
  566. package/dist/nano-components/p-bb6f7c39.js +5 -0
  567. package/dist/nano-components/p-bb6f7c39.js.map +1 -0
  568. package/dist/nano-components/p-bf91c50e.js +6 -0
  569. package/dist/nano-components/p-bf91c50e.js.map +1 -0
  570. package/dist/nano-components/{p-b40eedcb.entry.js → p-bfbfec85.entry.js} +2 -2
  571. package/dist/nano-components/p-bfbfec85.entry.js.map +1 -0
  572. package/dist/nano-components/{p-447a5910.entry.js → p-c0681b2b.entry.js} +2 -2
  573. package/dist/nano-components/p-c0681b2b.entry.js.map +1 -0
  574. package/dist/nano-components/p-c0ca353b.entry.js +5 -0
  575. package/dist/nano-components/p-c0ca353b.entry.js.map +1 -0
  576. package/dist/nano-components/p-c4e8d584.entry.js +5 -0
  577. package/dist/nano-components/p-c4e8d584.entry.js.map +1 -0
  578. package/dist/nano-components/p-cecb9af1.js.map +1 -1
  579. package/dist/nano-components/p-d4f6ec9f.js +5 -0
  580. package/dist/nano-components/p-d4f6ec9f.js.map +1 -0
  581. package/dist/nano-components/p-d753f35a.entry.js +5 -0
  582. package/dist/nano-components/p-d753f35a.entry.js.map +1 -0
  583. package/dist/nano-components/{p-651b3264.js → p-d7ff8f12.js} +2 -2
  584. package/dist/nano-components/p-d7ff8f12.js.map +1 -0
  585. package/dist/nano-components/{p-0582afcc.js → p-d92b762b.js} +2 -2
  586. package/dist/nano-components/p-d92b762b.js.map +1 -0
  587. package/dist/nano-components/p-de25ba80.entry.js +5 -0
  588. package/dist/nano-components/p-de25ba80.entry.js.map +1 -0
  589. package/dist/nano-components/{p-c9a7c7ea.js → p-e04f2333.js} +2 -2
  590. package/dist/nano-components/p-e04f2333.js.map +1 -0
  591. package/dist/nano-components/p-e19d6a92.entry.js +5 -0
  592. package/dist/nano-components/p-e19d6a92.entry.js.map +1 -0
  593. package/dist/nano-components/{p-63834d50.js → p-ed2e6f32.js} +2 -2
  594. package/dist/nano-components/p-ed2e6f32.js.map +1 -0
  595. package/dist/nano-components/p-ed69b27b.entry.js +5 -0
  596. package/dist/nano-components/p-ed69b27b.entry.js.map +1 -0
  597. package/dist/nano-components/{p-a0b93616.js → p-ed6adde2.js} +3 -3
  598. package/dist/nano-components/p-ed6adde2.js.map +1 -0
  599. package/dist/nano-components/p-ee045579.js.map +1 -1
  600. package/dist/nano-components/{p-151aad1e.entry.js → p-f2875bf0.entry.js} +4 -4
  601. package/dist/nano-components/p-f2875bf0.entry.js.map +1 -0
  602. package/dist/nano-components/p-f28c802d.entry.js +5 -0
  603. package/dist/nano-components/p-f28c802d.entry.js.map +1 -0
  604. package/dist/nano-components/{p-a2d0d7b9.entry.js → p-f47776fd.entry.js} +2 -2
  605. package/dist/nano-components/p-f47776fd.entry.js.map +1 -0
  606. package/dist/nano-components/p-f8f89998.js.map +1 -1
  607. package/dist/nano-components/p-fccd59e4.entry.js +5 -0
  608. package/dist/nano-components/p-fccd59e4.entry.js.map +1 -0
  609. package/dist/nano-components/p-fe1446cd.entry.js +5 -0
  610. package/dist/nano-components/p-fe1446cd.entry.js.map +1 -0
  611. package/dist/themes/london-calling.css +1 -1
  612. package/dist/themes/london-calling.css.map +1 -1
  613. package/dist/themes/nanopore.css +1 -1
  614. package/dist/themes/nanopore.css.map +1 -1
  615. package/dist/types/components/alert/alert-interface.d.ts +1 -1
  616. package/dist/types/components/algolia/algolia-input.d.ts +1 -1
  617. package/dist/types/components/algolia/algolia.d.ts +2 -2
  618. package/dist/types/components/checkbox/checkbox-group.d.ts +11 -0
  619. package/dist/types/components/date-picker/date-picker-interface.d.ts +2 -2
  620. package/dist/types/components/date-picker/duet-date-picker/date-adapter.d.ts +3 -3
  621. package/dist/types/components/date-picker/duet-date-picker/date-localization.d.ts +3 -3
  622. package/dist/types/components/date-picker/duet-date-picker/date-picker-day.d.ts +1 -1
  623. package/dist/types/components/date-picker/duet-date-picker/date-picker-month.d.ts +1 -1
  624. package/dist/types/components/field-validator/field-validator-interface.d.ts +4 -4
  625. package/dist/types/components/file-upload/file-upload.d.ts +1 -1
  626. package/dist/types/components/global-nav/global-nav.d.ts +12 -6
  627. package/dist/types/components/icon/icon.d.ts +3 -3
  628. package/dist/types/components/menu/menu.d.ts +1 -1
  629. package/dist/types/components/nav-item/nav-item.d.ts +1 -1
  630. package/dist/types/components/range/range-interface.d.ts +2 -2
  631. package/dist/types/components/resize-observe/resize-observe.d.ts +1 -0
  632. package/dist/types/components/slides/slides-interface.d.ts +2 -2
  633. package/dist/types/components/slides/slides.d.ts +0 -2
  634. package/dist/types/components/table/table.cell.d.ts +1 -1
  635. package/dist/types/components/table/table.d.ts +9 -14
  636. package/dist/types/components/table/table.header.d.ts +1 -1
  637. package/dist/types/components/table/table.row.d.ts +2 -2
  638. package/dist/types/components/table/table.utils.d.ts +2 -1
  639. package/dist/types/components/tabs/tab-content.d.ts +2 -0
  640. package/dist/types/components.d.ts +829 -9
  641. package/dist/types/index.d.ts +5 -0
  642. package/dist/types/stencil-public-runtime.d.ts +48 -3
  643. package/dist/types/utils/dom.d.ts +9 -0
  644. package/dist/types/utils/gesture/index.d.ts +1 -1
  645. package/dist/types/utils/popover.d.ts +1 -1
  646. package/dist/types/utils/store/component-store.d.ts +2 -2
  647. package/dist/types/utils/testing/index.d.ts +1 -1
  648. package/docs-json.json +89 -50
  649. package/docs-vscode.json +8 -4
  650. package/hydrate/index.d.ts +853 -0
  651. package/{dist/custom-elements → hydrate}/index.js +11476 -7950
  652. package/hydrate/package.json +6 -0
  653. package/loader/index.d.ts +9 -0
  654. package/package.json +24 -16
  655. package/dist/cjs/component-store-d7c8c326.js.map +0 -1
  656. package/dist/cjs/dom-d7c33f11.js.map +0 -1
  657. package/dist/cjs/form-control-57c71246.js.map +0 -1
  658. package/dist/cjs/global-989678ec.js.map +0 -1
  659. package/dist/cjs/index-41582c2a.js.map +0 -1
  660. package/dist/cjs/index-75b61776.js +0 -1077
  661. package/dist/cjs/index-75b61776.js.map +0 -1
  662. package/dist/cjs/index-ece1cb9e.js.map +0 -1
  663. package/dist/cjs/modal-e4defcc3.js.map +0 -1
  664. package/dist/cjs/nano-table-820b04d5.js.map +0 -1
  665. package/dist/cjs/popover-508bcedb.js.map +0 -1
  666. package/dist/cjs/table.worker-9e238d16.js.map +0 -1
  667. package/dist/cjs/theme-50275e1a.js.map +0 -1
  668. package/dist/components/index4.js.map +0 -1
  669. package/dist/custom-elements/index.d.ts +0 -339
  670. package/dist/custom-elements/index.js.map +0 -1
  671. package/dist/esm/component-store-ec512820.js.map +0 -1
  672. package/dist/esm/dom-d3ad49e2.js.map +0 -1
  673. package/dist/esm/form-control-84bac7a2.js.map +0 -1
  674. package/dist/esm/global-8047b4ff.js.map +0 -1
  675. package/dist/esm/index-3bbaffe4.js +0 -1075
  676. package/dist/esm/index-3bbaffe4.js.map +0 -1
  677. package/dist/esm/index-3c280603.js.map +0 -1
  678. package/dist/esm/index-dc076ea6.js +0 -649
  679. package/dist/esm/index-dc076ea6.js.map +0 -1
  680. package/dist/esm/modal-5c9ce466.js.map +0 -1
  681. package/dist/esm/nano-table-1f4fe4ad.js.map +0 -1
  682. package/dist/esm/popover-e748bb61.js.map +0 -1
  683. package/dist/esm/table.worker-ddbd23c3.js.map +0 -1
  684. package/dist/esm/theme-931bd452.js.map +0 -1
  685. package/dist/nano-components/p-0582afcc.js.map +0 -1
  686. package/dist/nano-components/p-135fed16.entry.js +0 -5
  687. package/dist/nano-components/p-135fed16.entry.js.map +0 -1
  688. package/dist/nano-components/p-151aad1e.entry.js.map +0 -1
  689. package/dist/nano-components/p-15543295.entry.js +0 -5
  690. package/dist/nano-components/p-15543295.entry.js.map +0 -1
  691. package/dist/nano-components/p-1a8e60c4.entry.js.map +0 -1
  692. package/dist/nano-components/p-1e709f87.entry.js.map +0 -1
  693. package/dist/nano-components/p-1f347342.entry.js +0 -5
  694. package/dist/nano-components/p-1f347342.entry.js.map +0 -1
  695. package/dist/nano-components/p-1fe12320.js +0 -6
  696. package/dist/nano-components/p-1fe12320.js.map +0 -1
  697. package/dist/nano-components/p-23575705.entry.js +0 -5
  698. package/dist/nano-components/p-23575705.entry.js.map +0 -1
  699. package/dist/nano-components/p-2828788c.js.map +0 -1
  700. package/dist/nano-components/p-284dd9a2.entry.js +0 -5
  701. package/dist/nano-components/p-284dd9a2.entry.js.map +0 -1
  702. package/dist/nano-components/p-2a97ef51.entry.js +0 -5
  703. package/dist/nano-components/p-2a97ef51.entry.js.map +0 -1
  704. package/dist/nano-components/p-36842a50.entry.js +0 -5
  705. package/dist/nano-components/p-36842a50.entry.js.map +0 -1
  706. package/dist/nano-components/p-3a1026d1.entry.js +0 -5
  707. package/dist/nano-components/p-3a1026d1.entry.js.map +0 -1
  708. package/dist/nano-components/p-3f25fc76.entry.js.map +0 -1
  709. package/dist/nano-components/p-41addb3a.entry.js +0 -5
  710. package/dist/nano-components/p-447a5910.entry.js.map +0 -1
  711. package/dist/nano-components/p-4b69178e.entry.js +0 -5
  712. package/dist/nano-components/p-4b69178e.entry.js.map +0 -1
  713. package/dist/nano-components/p-559a6492.entry.js +0 -5
  714. package/dist/nano-components/p-559a6492.entry.js.map +0 -1
  715. package/dist/nano-components/p-5d149792.entry.js +0 -5
  716. package/dist/nano-components/p-5d149792.entry.js.map +0 -1
  717. package/dist/nano-components/p-63834d50.js.map +0 -1
  718. package/dist/nano-components/p-651b3264.js.map +0 -1
  719. package/dist/nano-components/p-69e5a37d.entry.js.map +0 -1
  720. package/dist/nano-components/p-6ad194e4.entry.js +0 -5
  721. package/dist/nano-components/p-6ad194e4.entry.js.map +0 -1
  722. package/dist/nano-components/p-6cb77d5c.entry.js +0 -5
  723. package/dist/nano-components/p-6cb77d5c.entry.js.map +0 -1
  724. package/dist/nano-components/p-73860775.js +0 -5
  725. package/dist/nano-components/p-73860775.js.map +0 -1
  726. package/dist/nano-components/p-77cad8d1.js +0 -5
  727. package/dist/nano-components/p-77cad8d1.js.map +0 -1
  728. package/dist/nano-components/p-793588d1.js +0 -5
  729. package/dist/nano-components/p-793588d1.js.map +0 -1
  730. package/dist/nano-components/p-7b3638b7.js +0 -5
  731. package/dist/nano-components/p-7b3638b7.js.map +0 -1
  732. package/dist/nano-components/p-845ae77e.js +0 -5
  733. package/dist/nano-components/p-845ae77e.js.map +0 -1
  734. package/dist/nano-components/p-885b6950.js.map +0 -1
  735. package/dist/nano-components/p-8d747891.js +0 -5
  736. package/dist/nano-components/p-8d747891.js.map +0 -1
  737. package/dist/nano-components/p-9059c8c1.entry.js +0 -5
  738. package/dist/nano-components/p-9059c8c1.entry.js.map +0 -1
  739. package/dist/nano-components/p-92504f7f.entry.js +0 -5
  740. package/dist/nano-components/p-92504f7f.entry.js.map +0 -1
  741. package/dist/nano-components/p-99fbae74.entry.js +0 -5
  742. package/dist/nano-components/p-99fbae74.entry.js.map +0 -1
  743. package/dist/nano-components/p-9a4297e1.entry.js +0 -5
  744. package/dist/nano-components/p-9a4297e1.entry.js.map +0 -1
  745. package/dist/nano-components/p-9eeed8f5.entry.js +0 -5
  746. package/dist/nano-components/p-9eeed8f5.entry.js.map +0 -1
  747. package/dist/nano-components/p-a0b93616.js.map +0 -1
  748. package/dist/nano-components/p-a183e3c7.entry.js +0 -5
  749. package/dist/nano-components/p-a183e3c7.entry.js.map +0 -1
  750. package/dist/nano-components/p-a2d0d7b9.entry.js.map +0 -1
  751. package/dist/nano-components/p-a5abfed9.entry.js +0 -5
  752. package/dist/nano-components/p-a5abfed9.entry.js.map +0 -1
  753. package/dist/nano-components/p-b25e79b8.entry.js +0 -5
  754. package/dist/nano-components/p-b25e79b8.entry.js.map +0 -1
  755. package/dist/nano-components/p-b40eedcb.entry.js.map +0 -1
  756. package/dist/nano-components/p-b55ffa92.entry.js +0 -5
  757. package/dist/nano-components/p-b55ffa92.entry.js.map +0 -1
  758. package/dist/nano-components/p-b87539f0.entry.js +0 -5
  759. package/dist/nano-components/p-b87539f0.entry.js.map +0 -1
  760. package/dist/nano-components/p-c9a7c7ea.js.map +0 -1
  761. package/dist/nano-components/p-ca567f01.entry.js +0 -5
  762. package/dist/nano-components/p-ca567f01.entry.js.map +0 -1
  763. package/dist/nano-components/p-cc5e7acb.entry.js +0 -5
  764. package/dist/nano-components/p-cc5e7acb.entry.js.map +0 -1
  765. package/dist/nano-components/p-d5303933.entry.js +0 -5
  766. package/dist/nano-components/p-d5303933.entry.js.map +0 -1
  767. package/dist/nano-components/p-d565991d.entry.js +0 -5
  768. package/dist/nano-components/p-d565991d.entry.js.map +0 -1
  769. package/dist/nano-components/p-dba8a88d.entry.js.map +0 -1
  770. package/dist/nano-components/p-dc50b93c.entry.js +0 -5
  771. package/dist/nano-components/p-dc50b93c.entry.js.map +0 -1
  772. package/dist/nano-components/p-e3860f00.js +0 -5
  773. package/dist/nano-components/p-e3860f00.js.map +0 -1
  774. package/dist/nano-components/p-e5408bc8.entry.js +0 -5
  775. package/dist/nano-components/p-e5408bc8.entry.js.map +0 -1
  776. package/dist/nano-components/p-ea2de992.js +0 -19
  777. package/dist/nano-components/p-ea2de992.js.map +0 -1
  778. package/dist/nano-components/p-f7471cca.entry.js +0 -5
  779. package/dist/nano-components/p-f7471cca.entry.js.map +0 -1
  780. package/dist/nano-components/p-fe94eeff.entry.js +0 -5
  781. package/dist/nano-components/p-fe94eeff.entry.js.map +0 -1
@@ -44,7 +44,15 @@ const uniqueTime = (key, measureText) => {
44
44
  };
45
45
  }
46
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';
47
54
  const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
55
+ const HYDRATED_SLOT_FALLBACK_ID = 'sf-id';
48
56
  const XLINK_NS = 'http://www.w3.org/1999/xlink';
49
57
  /**
50
58
  * Default style mode id
@@ -60,6 +68,18 @@ const isComplexType = (o) => {
60
68
  o = typeof o;
61
69
  return o === 'object' || o === 'function';
62
70
  };
71
+ /**
72
+ * Helper method for querying a `meta` tag that contains a nonce value
73
+ * out of a DOM's head.
74
+ *
75
+ * @param doc The DOM containing the `head` to query against
76
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
77
+ * exists or the tag has no content.
78
+ */
79
+ function queryNonceMetaTagContent(doc) {
80
+ var _a, _b, _c;
81
+ 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;
82
+ }
63
83
  /**
64
84
  * Production h() function based on Preact by
65
85
  * Jason Miller (@developit)
@@ -68,7 +88,6 @@ const isComplexType = (o) => {
68
88
  *
69
89
  * Modified for Stencil's compiler and vdom
70
90
  */
71
- // const stack: any[] = [];
72
91
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
73
92
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
74
93
  const h = (nodeName, vnodeData, ...children) => {
@@ -159,6 +178,13 @@ const newVNode = (tag, text) => {
159
178
  };
160
179
  const Host = {};
161
180
  const isHost = (node) => node && node.$tag$ === Host;
181
+ /**
182
+ * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
183
+ *
184
+ * Note that these functions convert from {@link d.VNode} to
185
+ * {@link d.ChildNode} to give functional component developers a friendly
186
+ * interface.
187
+ */
162
188
  const vdomFnUtils = {
163
189
  forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
164
190
  map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
@@ -190,394 +216,204 @@ const convertToPrivate = (node) => {
190
216
  return vnode;
191
217
  };
192
218
  /**
193
- * Parse a new property value for a given property type.
194
- *
195
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
196
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
197
- * 1. `any`, the type given to `propValue` in the function signature
198
- * 2. the type stored from `propType`.
199
- *
200
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
201
- *
202
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
203
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
204
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
205
- * ```tsx
206
- * <my-cmp prop-val={0}></my-cmp>
207
- * ```
208
- *
209
- * HTML prop values on the other hand, will always a string
210
- *
211
- * @param propValue the new value to coerce to some type
212
- * @param propType the type of the prop, expressed as a binary number
213
- * @returns the parsed/coerced value
219
+ * Show or hide a slot nodes children
220
+ * @param slotNode a slot node, the 'children' of which should be shown or hidden
221
+ * @param hide whether to hide the slot node 'children'
222
+ * @returns
214
223
  */
215
- const parsePropertyValue = (propValue, propType) => {
216
- // ensure this value is of the correct prop type
217
- if (propValue != null && !isComplexType(propValue)) {
218
- if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
219
- // per the HTML spec, any string value means it is a boolean true value
220
- // but we'll cheat here and say that the string "false" is the boolean false
221
- return propValue === 'false' ? false : propValue === '' || !!propValue;
224
+ const renderSlotFallbackContent = (slotNode, hide) => {
225
+ // if this slot doesn't have fallback content, return
226
+ if (!slotNode['s-hsf'] || !slotNode.parentNode)
227
+ return;
228
+ // in non-shadow component, slot nodes are just empty text nodes or comment nodes
229
+ // the 'children' nodes are therefore placed next to it.
230
+ // let's loop through those now
231
+ let childNodes = (slotNode.parentNode.__childNodes ||
232
+ slotNode.parentNode.childNodes);
233
+ let childNode;
234
+ const childNodesLen = childNodes.length;
235
+ let i = 0;
236
+ for (i; i < childNodesLen; i++) {
237
+ childNode = childNodes[i];
238
+ if (childNode['s-sr'] && hide && childNode['s-psn'] === slotNode['s-sn']) {
239
+ // if this child node is a nested slot
240
+ // drill into it's children to hide them in-turn
241
+ renderSlotFallbackContent(childNode, true);
242
+ continue;
222
243
  }
223
- if (propType & 2 /* MEMBER_FLAGS.Number */) {
224
- // force it to be a number
225
- return parseFloat(propValue);
244
+ // this child node doesn't relate to this slot?
245
+ if (childNode['s-sn'] !== slotNode['s-sn'])
246
+ continue;
247
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */ && childNode['s-sf']) {
248
+ // we found an fallback element. Hide or show
249
+ childNode.hidden = hide;
250
+ childNode.style.display = hide ? 'none' : '';
226
251
  }
227
- if (propType & 1 /* MEMBER_FLAGS.String */) {
228
- // could have been passed as a number or boolean
229
- // but we still want it as a string
230
- return String(propValue);
252
+ else if (!!childNode['s-sfc']) {
253
+ // this child has fallback text. Add or remove it
254
+ if (hide) {
255
+ childNode['s-sfc'] = childNode.textContent || undefined;
256
+ childNode.textContent = '';
257
+ }
258
+ else if (!childNode.textContent || childNode.textContent.trim() === '') {
259
+ childNode.textContent = childNode['s-sfc'];
260
+ }
231
261
  }
232
- // redundant return here for better minification
233
- return propValue;
234
262
  }
235
- // not sure exactly what type we want
236
- // so no need to change to a different type
237
- return propValue;
238
- };
239
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
240
- const createEvent = (ref, name, flags) => {
241
- const elm = getElement(ref);
242
- return {
243
- emit: (detail) => {
244
- return emitEvent(elm, name, {
245
- bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
246
- composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
247
- cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
248
- detail,
249
- });
250
- },
251
- };
252
263
  };
253
264
  /**
254
- * Helper function to create & dispatch a custom Event on a provided target
255
- * @param elm the target of the Event
256
- * @param name the name to give the custom Event
257
- * @param opts options for configuring a custom Event
258
- * @returns the custom Event
265
+ * Function applied to non-shadow component nodes to mimic native shadowDom behaviour:
266
+ * - When slotted node/s are not present, show `<slot>` node children
267
+ * - When slotted node/s *are* present, hide `<slot>` node children
268
+ * @param node an entry whose children to iterate over
259
269
  */
260
- const emitEvent = (elm, name, opts) => {
261
- const ev = plt.ce(name, opts);
262
- elm.dispatchEvent(ev);
263
- return ev;
264
- };
265
- const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
266
- const registerStyle = (scopeId, cssText, allowCS) => {
267
- let style = styles.get(scopeId);
268
- if (supportsConstructableStylesheets && allowCS) {
269
- style = (style || new CSSStyleSheet());
270
- if (typeof style === 'string') {
271
- style = cssText;
272
- }
273
- else {
274
- style.replaceSync(cssText);
275
- }
276
- }
277
- else {
278
- style = cssText;
279
- }
280
- styles.set(scopeId, style);
281
- };
282
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
283
- let scopeId = getScopeId(cmpMeta);
284
- const style = styles.get(scopeId);
285
- // if an element is NOT connected then getRootNode() will return the wrong root node
286
- // so the fallback is to always use the document for the root node in those cases
287
- styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
288
- if (style) {
289
- if (typeof style === 'string') {
290
- styleContainerNode = styleContainerNode.head || styleContainerNode;
291
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
292
- let styleElm;
293
- if (!appliedStyles) {
294
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
295
- }
296
- if (!appliedStyles.has(scopeId)) {
297
- {
298
- {
299
- styleElm = doc.createElement('style');
300
- styleElm.innerHTML = style;
270
+ const updateFallbackSlotVisibility = (node) => {
271
+ if (!node)
272
+ return;
273
+ const childNodes = node.__childNodes || node.childNodes;
274
+ let slotNode;
275
+ let i;
276
+ let ilen;
277
+ let j;
278
+ let slotNameAttr;
279
+ let nodeType;
280
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
281
+ // slot reference node?
282
+ if (childNodes[i]['s-sr']) {
283
+ // this component uses slots and we're on a slot node
284
+ // let's find all it's slotted children or lack thereof
285
+ // and show or hide fallback nodes (`<slot />` children)
286
+ // get the slot name for this slot reference node
287
+ slotNameAttr = childNodes[i]['s-sn'];
288
+ slotNode = childNodes[i];
289
+ // by default always show a fallback slot node
290
+ // then hide it if there are other slotted nodes in the light dom
291
+ renderSlotFallbackContent(slotNode, false);
292
+ // because we found a slot fallback node let's loop over all
293
+ // the children again to
294
+ for (j = 0; j < ilen; j++) {
295
+ nodeType = childNodes[j].nodeType;
296
+ // ignore slot fallback nodes
297
+ if (childNodes[j]['s-sf'])
298
+ continue;
299
+ // is sibling node is from a different component OR is a named fallback slot node?
300
+ if (childNodes[j]['s-hn'] !== slotNode['s-hn'] || slotNameAttr !== '') {
301
+ // you can't slot a textNode in a named slot
302
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j]['s-sn']) {
303
+ // we found a slotted element!
304
+ // let's hide all the fallback nodes
305
+ renderSlotFallbackContent(slotNode, true);
306
+ // patches this node's removal methods
307
+ // so if it gets removed in the future
308
+ // re-asses the fallback node status
309
+ patchRemove(childNodes[j]);
310
+ break;
301
311
  }
302
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
303
312
  }
304
- if (appliedStyles) {
305
- appliedStyles.add(scopeId);
313
+ else if (childNodes[j]['s-sn'] === slotNameAttr) {
314
+ // this is a default fallback slot node
315
+ // any element or text node (with content)
316
+ // should hide the default fallback slot node
317
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
318
+ (nodeType === 3 /* NODE_TYPE.TextNode */ &&
319
+ childNodes[j] &&
320
+ childNodes[j].textContent &&
321
+ childNodes[j].textContent.trim() !== '')) {
322
+ // we found a slotted something
323
+ // let's hide all the fallback nodes
324
+ renderSlotFallbackContent(slotNode, true);
325
+ // patches this node's removal methods
326
+ // so if it gets removed in the future
327
+ // re-asses the fallback node status
328
+ patchRemove(childNodes[j]);
329
+ break;
330
+ }
306
331
  }
307
332
  }
308
333
  }
309
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
310
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
311
- }
334
+ // keep drilling down
335
+ updateFallbackSlotVisibility(childNodes[i]);
312
336
  }
313
- return scopeId;
314
337
  };
315
- const attachStyles = (hostRef) => {
316
- const cmpMeta = hostRef.$cmpMeta$;
317
- const elm = hostRef.$hostElement$;
318
- const flags = cmpMeta.$flags$;
319
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
320
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
321
- if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
322
- // only required when we're NOT using native shadow dom (slot)
323
- // or this browser doesn't support native shadow dom
324
- // and this host element was NOT created with SSR
325
- // let's pick out the inner content for slot projection
326
- // create a node to represent where the original
327
- // content was first placed, which is useful later on
328
- // DOM WRITE!!
329
- elm['s-sc'] = scopeId;
330
- elm.classList.add(scopeId + '-h');
331
- if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
332
- elm.classList.add(scopeId + '-s');
333
- }
334
- }
335
- endAttachStyles();
338
+ const patchPseudoShadowDom = (HostElementPrototype) => {
339
+ patchChildNodes(HostElementPrototype);
340
+ patchInsertBefore(HostElementPrototype);
341
+ patchAppendChild(HostElementPrototype);
342
+ patchAppend(HostElementPrototype);
343
+ patchPrepend(HostElementPrototype);
344
+ patchInsertAdjacentHTML(HostElementPrototype);
345
+ patchInsertAdjacentText(HostElementPrototype);
346
+ patchInsertAdjacentElement(HostElementPrototype);
347
+ patchReplaceChildren(HostElementPrototype);
348
+ patchInnerHTML(HostElementPrototype);
349
+ patchInnerText(HostElementPrototype);
350
+ patchTextContent(HostElementPrototype);
336
351
  };
337
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
352
+ ////// non-shadow host component patches
338
353
  /**
339
- * Production setAccessor() function based on Preact by
340
- * Jason Miller (@developit)
341
- * Licensed under the MIT License
342
- * https://github.com/developit/preact/blob/master/LICENSE
343
- *
344
- * Modified for Stencil's compiler and vdom
354
+ * Patch `cloneNode()` for non-shadow components ()
355
+ * @param HostElementPrototype the host prototype to polyfill
345
356
  */
346
- const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
347
- if (oldValue !== newValue) {
348
- let isProp = isMemberInElement(elm, memberName);
349
- let ln = memberName.toLowerCase();
350
- if (memberName === 'class') {
351
- const classList = elm.classList;
352
- const oldClasses = parseClassList(oldValue);
353
- const newClasses = parseClassList(newValue);
354
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
355
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
356
- }
357
- else if (memberName === 'style') {
358
- // update style attribute, css properties and values
359
- {
360
- for (const prop in oldValue) {
361
- if (!newValue || newValue[prop] == null) {
362
- if (prop.includes('-')) {
363
- elm.style.removeProperty(prop);
364
- }
365
- else {
366
- elm.style[prop] = '';
367
- }
368
- }
357
+ const patchCloneNode = (HostElementPrototype) => {
358
+ HostElementPrototype.__cloneNode = HostElementPrototype.cloneNode;
359
+ HostElementPrototype.cloneNode = function (deep) {
360
+ const srcNode = this;
361
+ const clonedNode = HostElementPrototype.__cloneNode.call(srcNode, false);
362
+ if (deep) {
363
+ let i = 0;
364
+ let slotted, nonStencilNode;
365
+ const stencilPrivates = [
366
+ 's-id',
367
+ 's-cr',
368
+ 's-lr',
369
+ 's-rc',
370
+ 's-sc',
371
+ 's-p',
372
+ 's-cn',
373
+ 's-sr',
374
+ 's-sn',
375
+ 's-hn',
376
+ 's-ol',
377
+ 's-nr',
378
+ 's-si',
379
+ 's-sf',
380
+ 's-sfc',
381
+ 's-hsf',
382
+ ];
383
+ for (; i < srcNode.__childNodes.length; i++) {
384
+ slotted = srcNode.__childNodes[i]['s-nr'];
385
+ nonStencilNode = stencilPrivates.every((privateField) => !srcNode.__childNodes[i][privateField]);
386
+ if (slotted) {
387
+ clonedNode.__appendChild(slotted.cloneNode(true));
369
388
  }
370
- }
371
- for (const prop in newValue) {
372
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
373
- if (prop.includes('-')) {
374
- elm.style.setProperty(prop, newValue[prop]);
375
- }
376
- else {
377
- elm.style[prop] = newValue[prop];
378
- }
379
- }
380
- }
381
- }
382
- else if (memberName === 'key')
383
- ;
384
- else if (memberName === 'ref') {
385
- // minifier will clean this up
386
- if (newValue) {
387
- newValue(elm);
388
- }
389
- }
390
- else if ((!isProp ) &&
391
- memberName[0] === 'o' &&
392
- memberName[1] === 'n') {
393
- // Event Handlers
394
- // so if the member name starts with "on" and the 3rd characters is
395
- // a capital letter, and it's not already a member on the element,
396
- // then we're assuming it's an event listener
397
- if (memberName[2] === '-') {
398
- // on- prefixed events
399
- // allows to be explicit about the dom event to listen without any magic
400
- // under the hood:
401
- // <my-cmp on-click> // listens for "click"
402
- // <my-cmp on-Click> // listens for "Click"
403
- // <my-cmp on-ionChange> // listens for "ionChange"
404
- // <my-cmp on-EVENTS> // listens for "EVENTS"
405
- memberName = memberName.slice(3);
406
- }
407
- else if (isMemberInElement(win, ln)) {
408
- // standard event
409
- // the JSX attribute could have been "onMouseOver" and the
410
- // member name "onmouseover" is on the window's prototype
411
- // so let's add the listener "mouseover", which is all lowercased
412
- memberName = ln.slice(2);
413
- }
414
- else {
415
- // custom event
416
- // the JSX attribute could have been "onMyCustomEvent"
417
- // so let's trim off the "on" prefix and lowercase the first character
418
- // and add the listener "myCustomEvent"
419
- // except for the first character, we keep the event name case
420
- memberName = ln[2] + memberName.slice(3);
421
- }
422
- if (oldValue) {
423
- plt.rel(elm, memberName, oldValue, false);
424
- }
425
- if (newValue) {
426
- plt.ael(elm, memberName, newValue, false);
427
- }
428
- }
429
- else {
430
- // Set property if it exists and it's not a SVG
431
- const isComplex = isComplexType(newValue);
432
- if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
433
- try {
434
- if (!elm.tagName.includes('-')) {
435
- const n = newValue == null ? '' : newValue;
436
- // Workaround for Safari, moving the <input> caret when re-assigning the same valued
437
- if (memberName === 'list') {
438
- isProp = false;
439
- }
440
- else if (oldValue == null || elm[memberName] != n) {
441
- elm[memberName] = n;
442
- }
443
- }
444
- else {
445
- elm[memberName] = newValue;
446
- }
447
- }
448
- catch (e) { }
449
- }
450
- /**
451
- * Need to manually update attribute if:
452
- * - memberName is not an attribute
453
- * - if we are rendering the host element in order to reflect attribute
454
- * - if it's a SVG, since properties might not work in <svg>
455
- * - if the newValue is null/undefined or 'false'.
456
- */
457
- let xlink = false;
458
- {
459
- if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
460
- memberName = ln;
461
- xlink = true;
462
- }
463
- }
464
- if (newValue == null || newValue === false) {
465
- if (newValue !== false || elm.getAttribute(memberName) === '') {
466
- if (xlink) {
467
- elm.removeAttributeNS(XLINK_NS, memberName);
468
- }
469
- else {
470
- elm.removeAttribute(memberName);
471
- }
472
- }
473
- }
474
- else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
475
- newValue = newValue === true ? '' : newValue;
476
- if (xlink) {
477
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
478
- }
479
- else {
480
- elm.setAttribute(memberName, newValue);
481
- }
482
- }
483
- }
484
- }
485
- };
486
- const parseClassListRegex = /\s/;
487
- const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
488
- const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
489
- // if the element passed in is a shadow root, which is a document fragment
490
- // then we want to be adding attrs/props to the shadow root's "host" element
491
- // if it's not a shadow root, then we add attrs/props to the same element
492
- const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
493
- ? newVnode.$elm$.host
494
- : newVnode.$elm$;
495
- const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
496
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
497
- {
498
- // remove attributes no longer present on the vnode by setting them to undefined
499
- for (memberName in oldVnodeAttrs) {
500
- if (!(memberName in newVnodeAttrs)) {
501
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
502
- }
503
- }
504
- }
505
- // add new & update changed attributes
506
- for (memberName in newVnodeAttrs) {
507
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
508
- }
509
- };
510
- /**
511
- * Polyfills `cloneNode()` for slot polyfilled components ()
512
- * @param HostElementPrototype the host prototype to polyfill
513
- */
514
- const patchCloneNode = (HostElementPrototype) => {
515
- const orgCloneNode = HostElementPrototype.cloneNode;
516
- HostElementPrototype.cloneNode = function (deep) {
517
- const srcNode = this;
518
- const clonedNode = orgCloneNode.call(srcNode, false);
519
- if (deep) {
520
- let i = 0;
521
- let slotted, nonStencilNode;
522
- const stencilPrivates = [
523
- 's-id',
524
- 's-cr',
525
- 's-lr',
526
- 's-rc',
527
- 's-sc',
528
- 's-p',
529
- 's-cn',
530
- 's-sr',
531
- 's-sn',
532
- 's-hn',
533
- 's-ol',
534
- 's-nr',
535
- 's-si',
536
- 's-sf',
537
- 's-sfc',
538
- 's-hsf',
539
- ];
540
- for (; i < srcNode.__childNodes.length; i++) {
541
- slotted = srcNode.__childNodes[i]['s-nr'];
542
- nonStencilNode = stencilPrivates.every((privateField) => !srcNode.__childNodes[i][privateField]);
543
- if (slotted) {
544
- clonedNode.__appendChild(slotted.cloneNode(true));
545
- }
546
- if (nonStencilNode) {
547
- clonedNode.__appendChild(srcNode.__childNodes[i].cloneNode(true));
389
+ if (nonStencilNode) {
390
+ clonedNode.__appendChild(srcNode.__childNodes[i].cloneNode(true));
548
391
  }
549
392
  }
550
393
  }
551
394
  return clonedNode;
552
395
  };
553
396
  };
554
- const patchPseudoShadowDom = (HostElementPrototype) => {
555
- patchChildSlotNodes(HostElementPrototype);
556
- patchSlotAppendChild(HostElementPrototype);
557
- patchSlotAppend(HostElementPrototype);
558
- patchSlotPrepend(HostElementPrototype);
559
- patchSlotInsertAdjacentHTML(HostElementPrototype);
560
- patchSlotInsertAdjacentText(HostElementPrototype);
561
- patchSlotInsertAdjacentElement(HostElementPrototype);
562
- patchSlotReplaceChildren(HostElementPrototype);
563
- patchSlotInnerHTML(HostElementPrototype);
564
- patchSlotInnerText(HostElementPrototype);
565
- patchTextContent(HostElementPrototype);
566
- patchNodeRemoveChild(HostElementPrototype);
567
- };
568
- const patchChildSlotNodes = (HostElementPrototype) => {
397
+ /**
398
+ * Patches children accessors of a non-shadow component.
399
+ * (`childNodes`, `children`, `firstChild`, `lastChild` and `childElementCount`)
400
+ * @param HostElementPrototype
401
+ */
402
+ const patchChildNodes = (HostElementPrototype) => {
403
+ if (!globalThis.Node)
404
+ return;
569
405
  class FakeNodeList extends Array {
570
406
  item(n) {
571
407
  return this[n];
572
408
  }
573
409
  }
574
- const childNodesDesc = Object.getOwnPropertyDescriptor(Node.prototype, 'childNodes');
410
+ let childNodesDesc = Object.getOwnPropertyDescriptor(Node.prototype, 'childNodes');
411
+ if (!childNodesDesc) {
412
+ childNodesDesc = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Node.prototype), 'childNodes');
413
+ }
575
414
  if (childNodesDesc)
576
415
  Object.defineProperty(HostElementPrototype, '__childNodes', childNodesDesc);
577
416
  let childrenDesc = Object.getOwnPropertyDescriptor(Element.prototype, 'children');
578
- // on IE it's on HTMLElement.prototype
579
- if (!childrenDesc)
580
- childrenDesc = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'children');
581
417
  // MockNode won't have these
582
418
  if (childrenDesc)
583
419
  Object.defineProperty(HostElementPrototype, '__children', childrenDesc);
@@ -588,7 +424,7 @@ const patchChildSlotNodes = (HostElementPrototype) => {
588
424
  get() {
589
425
  return this.childNodes
590
426
  .map((n) => {
591
- if (n.nodeType === 1)
427
+ if (n.nodeType === 1 /* NODE_TYPE.ElementNode */)
592
428
  return n;
593
429
  else
594
430
  return null;
@@ -596,6 +432,16 @@ const patchChildSlotNodes = (HostElementPrototype) => {
596
432
  .filter((n) => !!n);
597
433
  },
598
434
  });
435
+ Object.defineProperty(HostElementPrototype, 'firstChild', {
436
+ get() {
437
+ return this.childNodes[0];
438
+ },
439
+ });
440
+ Object.defineProperty(HostElementPrototype, 'lastChild', {
441
+ get() {
442
+ return this.childNodes[this.childNodes.length - 1];
443
+ },
444
+ });
599
445
  Object.defineProperty(HostElementPrototype, 'childElementCount', {
600
446
  get() {
601
447
  return HostElementPrototype.children.length;
@@ -608,16 +454,23 @@ const patchChildSlotNodes = (HostElementPrototype) => {
608
454
  const childNodes = this.__childNodes;
609
455
  const result = new FakeNodeList();
610
456
  for (let i = 0; i < childNodes.length; i++) {
611
- const slot = childNodes[i]['s-nr'];
612
- if (slot) {
613
- result.push(slot);
457
+ const slottedNode = childNodes[i]['s-nr'];
458
+ if (slottedNode &&
459
+ (slottedNode.nodeType !== 8 /* NODE_TYPE.CommentNode */ || slottedNode.nodeValue.indexOf(ORG_LOCATION_ID + '.') !== 0)) {
460
+ result.push(slottedNode);
614
461
  }
615
462
  }
616
463
  return result;
617
464
  },
618
465
  });
619
466
  };
620
- const patchSlotInnerHTML = (HostElementPrototype) => {
467
+ /**
468
+ * Patches the inner html accessors of a non-shadow component
469
+ * @param HostElementPrototype the host `Element` to be patched
470
+ */
471
+ const patchInnerHTML = (HostElementPrototype) => {
472
+ if (!globalThis.Element)
473
+ return;
621
474
  let descriptor = Object.getOwnPropertyDescriptor(Element.prototype, 'innerHTML');
622
475
  // on IE it's on HTMLElement.prototype
623
476
  if (!descriptor)
@@ -641,7 +494,13 @@ const patchSlotInnerHTML = (HostElementPrototype) => {
641
494
  },
642
495
  });
643
496
  };
644
- const patchSlotInnerText = (HostElementPrototype) => {
497
+ /**
498
+ * Patches the inner text accessors of a non-shadow component
499
+ * @param HostElementPrototype the host `Element` to be patched
500
+ */
501
+ const patchInnerText = (HostElementPrototype) => {
502
+ if (!globalThis.Element)
503
+ return;
645
504
  let descriptor = Object.getOwnPropertyDescriptor(Element.prototype, 'innerText');
646
505
  // on IE it's on HTMLElement.prototype
647
506
  if (!descriptor)
@@ -671,10 +530,12 @@ const patchSlotInnerText = (HostElementPrototype) => {
671
530
  });
672
531
  };
673
532
  /**
674
- * Patches the text content accessors of a scoped component
533
+ * Patches the text content accessors of a non-shadow component
675
534
  * @param HostElementPrototype the host `Element` to be patched
676
535
  */
677
536
  const patchTextContent = (HostElementPrototype) => {
537
+ if (!globalThis.Node)
538
+ return;
678
539
  const descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent');
679
540
  // MockNode won't have these
680
541
  if (descriptor)
@@ -695,66 +556,88 @@ const patchTextContent = (HostElementPrototype) => {
695
556
  },
696
557
  });
697
558
  };
698
- const patchNodeRemove = (ElementPrototype) => {
699
- if (!ElementPrototype || ElementPrototype.__remove)
700
- return;
701
- ElementPrototype.__remove = ElementPrototype.remove || true;
702
- patchNodeRemoveChild(ElementPrototype.parentNode);
703
- ElementPrototype.remove = function () {
704
- if (this.parentNode) {
705
- return this.parentNode.removeChild(this);
706
- }
707
- return this.__remove();
708
- };
709
- };
710
- const patchNodeRemoveChild = (ElementPrototype) => {
711
- if (!ElementPrototype || ElementPrototype.__removeChild)
559
+ /**
560
+ * Patches the `insertBefore` of a non-shadow component.
561
+ * The problem solved being that the 'current' node to insert before may not be in the root of our component.
562
+ * This tries to find where the 'current' node lives within the component and insert the new node before it
563
+ * @param HostElementPrototype the host `Element` to be patched
564
+ */
565
+ const patchInsertBefore = (HostElementPrototype) => {
566
+ if (HostElementPrototype.__insertBefore)
712
567
  return;
713
- ElementPrototype.__removeChild = ElementPrototype.removeChild;
714
- ElementPrototype.removeChild = function (toRemove) {
715
- if (toRemove && typeof toRemove['s-sn'] !== 'undefined') {
716
- const slotNode = getHostSlotNode(this.__childNodes || this.childNodes, toRemove['s-sn']);
717
- toRemove.parentElement.__removeChild(toRemove);
718
- if (slotNode && slotNode['s-hsf']) {
719
- updateFallbackSlotVisibility(this);
568
+ HostElementPrototype.__insertBefore = HostElementPrototype.insertBefore;
569
+ HostElementPrototype.insertBefore = function (newChild, curChild) {
570
+ const slotName = (newChild['s-sn'] = getSlotName(newChild));
571
+ const slotNode = getHostSlotNode(this.__childNodes, slotName);
572
+ if (slotNode) {
573
+ let found = false;
574
+ this.childNodes.forEach((childNode) => {
575
+ // we found the node in our list of other 'lightDOM' / slotted nodes
576
+ if (childNode === curChild || curChild === null) {
577
+ found = true;
578
+ addSlotRelocateNode(newChild, slotNode);
579
+ if (curChild === null) {
580
+ this.__append(newChild);
581
+ return;
582
+ }
583
+ if (slotName === curChild['s-sn']) {
584
+ // current child ('slot before' node) is 'in' the same slot
585
+ const insertBefore = curChild.parentNode.__insertBefore || curChild.parentNode.insertBefore;
586
+ insertBefore.call(curChild.parentNode, newChild, curChild);
587
+ patchRemove(newChild);
588
+ }
589
+ else {
590
+ // current child is not in the same slot as 'slot before' node
591
+ // so just toss the node in wherever
592
+ this.__append(newChild);
593
+ }
594
+ return;
595
+ }
596
+ });
597
+ if (found) {
598
+ return newChild;
720
599
  }
721
- return;
722
600
  }
723
- return this.__removeChild(toRemove);
601
+ return this.__insertBefore(newChild, curChild);
724
602
  };
725
603
  };
726
- const patchSlotAppendChild = (HostElementPrototype) => {
604
+ /**
605
+ * Patches the `appendChild` method of a non-shadow component
606
+ * @param HostElementPrototype the host `Element` to be patched
607
+ */
608
+ const patchAppendChild = (HostElementPrototype) => {
727
609
  if (HostElementPrototype.__appendChild)
728
610
  return;
729
611
  HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
730
612
  HostElementPrototype.appendChild = function (newChild) {
731
613
  const slotName = (newChild['s-sn'] = getSlotName(newChild));
732
- const slotNode = getHostSlotNode(this.__childNodes, slotName);
614
+ const slotNode = getHostSlotNode(this.__childNodes || this.childNodes, slotName);
733
615
  if (slotNode) {
734
- const slotPlaceholder = document.createTextNode('');
735
- slotPlaceholder['s-nr'] = newChild;
736
- if (slotNode['s-cr'] && slotNode['s-cr'].parentNode) {
737
- slotNode['s-cr'].parentNode.__appendChild(slotPlaceholder);
738
- }
739
- newChild['s-ol'] = slotPlaceholder;
740
- patchNodeRemove(newChild);
741
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
616
+ addSlotRelocateNode(newChild, slotNode);
617
+ const slotChildNodes = getHostSlotChildNodes(slotNode);
742
618
  const appendAfter = slotChildNodes[slotChildNodes.length - 1];
743
619
  if (appendAfter.parentNode) {
744
- appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
620
+ const parent = appendAfter.parentNode;
621
+ parent.__insertBefore
622
+ ? parent.__insertBefore(newChild, appendAfter.nextSibling)
623
+ : parent.insertBefore(newChild, appendAfter.nextSibling);
624
+ patchRemove(newChild);
745
625
  }
746
- patchNodeRemoveChild(newChild.parentNode);
747
626
  if (slotNode['s-hsf']) {
748
627
  updateFallbackSlotVisibility(slotNode.parentNode);
749
628
  }
750
- return;
629
+ return newChild;
751
630
  }
752
- if (newChild.nodeType === 1 && !!newChild.getAttribute('slot') && this.__childNodes)
631
+ if (newChild.nodeType === 1 /* NODE_TYPE.ElementNode */ && !!newChild.getAttribute('slot') && this.__childNodes)
753
632
  newChild.hidden = true;
754
633
  return this.__appendChild(newChild);
755
634
  };
756
635
  };
757
- const patchSlotPrepend = (HostElementPrototype) => {
636
+ /**
637
+ * Patches the `prepend` method of a non-shadow component
638
+ * @param HostElementPrototype the host `Element` to be patched
639
+ */
640
+ const patchPrepend = (HostElementPrototype) => {
758
641
  if (HostElementPrototype.__prepend)
759
642
  return;
760
643
  HostElementPrototype.__prepend = HostElementPrototype.prepend;
@@ -766,31 +649,29 @@ const patchSlotPrepend = (HostElementPrototype) => {
766
649
  const slotName = (newChild['s-sn'] = getSlotName(newChild));
767
650
  const slotNode = getHostSlotNode(this.__childNodes, slotName);
768
651
  if (slotNode) {
769
- const slotPlaceholder = document.createTextNode('');
770
- slotPlaceholder['s-nr'] = newChild;
771
- if (slotNode['s-cr'] && slotNode['s-cr'].parentNode) {
772
- slotNode['s-cr'].parentNode.__appendChild(slotPlaceholder);
773
- }
774
- newChild['s-ol'] = slotPlaceholder;
775
- patchNodeRemove(newChild);
776
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
652
+ addSlotRelocateNode(newChild, slotNode);
653
+ const slotChildNodes = getHostSlotChildNodes(slotNode);
777
654
  const appendAfter = slotChildNodes[0];
778
655
  if (appendAfter.parentNode) {
779
656
  appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
657
+ patchRemove(newChild);
780
658
  }
781
- patchNodeRemoveChild(newChild.parentNode);
782
659
  if (slotNode['s-hsf']) {
783
660
  updateFallbackSlotVisibility(slotNode.parentNode);
784
661
  }
785
662
  return;
786
663
  }
787
- if (newChild.nodeType === 1 && !!newChild.getAttribute('slot') && this.__childNodes)
664
+ if (newChild.nodeType === 1 /* NODE_TYPE.ElementNode */ && !!newChild.getAttribute('slot') && this.__childNodes)
788
665
  newChild.hidden = true;
789
666
  return this.__prepend(newChild);
790
667
  });
791
668
  };
792
669
  };
793
- const patchSlotAppend = (HostElementPrototype) => {
670
+ /**
671
+ * Patches the `append` method of a non-shadow component
672
+ * @param HostElementPrototype the host `Element` to be patched
673
+ */
674
+ const patchAppend = (HostElementPrototype) => {
794
675
  if (HostElementPrototype.__append)
795
676
  return;
796
677
  HostElementPrototype.__append = HostElementPrototype.append;
@@ -803,14 +684,18 @@ const patchSlotAppend = (HostElementPrototype) => {
803
684
  });
804
685
  };
805
686
  };
806
- const patchSlotReplaceChildren = (HostElementPrototype) => {
687
+ /**
688
+ * Patches the `replaceChildren` method of a non-shadow component
689
+ * @param HostElementPrototype the host `Element` to be patched
690
+ */
691
+ const patchReplaceChildren = (HostElementPrototype) => {
807
692
  if (HostElementPrototype.__replaceChildren)
808
693
  return;
809
694
  HostElementPrototype.__replaceChildren = HostElementPrototype.replaceChildren;
810
695
  HostElementPrototype.replaceChildren = function (...newChildren) {
811
696
  const slotNode = getHostSlotNode(this.__childNodes, '');
812
697
  if (slotNode) {
813
- const slotChildNodes = getHostSlotChildNodes(slotNode, '');
698
+ const slotChildNodes = getHostSlotChildNodes(slotNode);
814
699
  slotChildNodes.forEach((node) => {
815
700
  if (!node['s-sr']) {
816
701
  node.remove();
@@ -820,7 +705,11 @@ const patchSlotReplaceChildren = (HostElementPrototype) => {
820
705
  }
821
706
  };
822
707
  };
823
- const patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
708
+ /**
709
+ * Patches the `insertAdjacentHTML` method of a non-shadow component
710
+ * @param HostElementPrototype the host `Element` to be patched
711
+ */
712
+ const patchInsertAdjacentHTML = (HostElementPrototype) => {
824
713
  if (HostElementPrototype.__insertAdjacentHTML)
825
714
  return;
826
715
  HostElementPrototype.__insertAdjacentHTML = HostElementPrototype.insertAdjacentHTML;
@@ -843,7 +732,11 @@ const patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
843
732
  }
844
733
  };
845
734
  };
846
- const patchSlotInsertAdjacentText = (HostElementPrototype) => {
735
+ /**
736
+ * Patches the `insertAdjacentText` method of a non-shadow component
737
+ * @param HostElementPrototype the host `Element` to be patched
738
+ */
739
+ const patchInsertAdjacentText = (HostElementPrototype) => {
847
740
  if (HostElementPrototype.__insertAdjacentText)
848
741
  return;
849
742
  HostElementPrototype.__insertAdjacentText = HostElementPrototype.insertAdjacentText;
@@ -851,7 +744,11 @@ const patchSlotInsertAdjacentText = (HostElementPrototype) => {
851
744
  this.insertAdjacentHTML(position, text);
852
745
  };
853
746
  };
854
- const patchSlotInsertAdjacentElement = (HostElementPrototype) => {
747
+ /**
748
+ * Patches the `insertAdjacentElement` method of a non-shadow component
749
+ * @param HostElementPrototype the host `Element` to be patched
750
+ */
751
+ const patchInsertAdjacentElement = (HostElementPrototype) => {
855
752
  if (HostElementPrototype.__insertAdjacentElement)
856
753
  return;
857
754
  HostElementPrototype.__insertAdjacentElement = HostElementPrototype.insertAdjacentElement;
@@ -867,110 +764,1072 @@ const patchSlotInsertAdjacentElement = (HostElementPrototype) => {
867
764
  }
868
765
  };
869
766
  };
870
- const getSlotName = (node) => node['s-sn'] || (node.nodeType === 1 && node.getAttribute('slot')) || node.slot || '';
767
+ ////// Slotted node patches
871
768
  /**
872
- * Recursively searches a series of child nodes for a slot with the provided name.
873
- * @param childNodes the nodes to search for a slot with a specific name.
874
- * @param slotName the name of the slot to match on.
875
- * @returns a reference to the slot node that matches the provided name, `null` otherwise
769
+ * Patches sibling accessors (`nextSibling`, `nextSiblingElement`, `previousSibling`, `previousSiblingElement`)
770
+ * of a 'slotted' node within a non-shadow component.
771
+ * @param NodePrototype the slotted node to be patched
876
772
  */
877
- const getHostSlotNode = (childNodes, slotName) => {
878
- let i = 0;
879
- let childNode;
880
- if (!childNodes)
881
- return null;
882
- for (; i < childNodes.length; i++) {
883
- childNode = childNodes[i];
884
- if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
885
- return childNode;
773
+ const patchNextPrev = (NodePrototype) => {
774
+ // Especially relevant when rendering components via SSR.
775
+ // Frameworks will often try to reconcile their VDOM with the real DOM
776
+ // by stepping through nodes with 'nextSibling' (and similar).
777
+ // This works with a shadowDOM; the lightDOM matches the framework's VDOM.
778
+ // This doesn't work without shadowDOM
779
+ if (!NodePrototype || NodePrototype.__nextSibling || !globalThis.Node)
780
+ return;
781
+ patchNextSibling(NodePrototype);
782
+ patchPreviousSibling(NodePrototype);
783
+ patchNextElementSibling(NodePrototype);
784
+ patchPreviousElementSibling(NodePrototype);
785
+ };
786
+ /**
787
+ * Patches the `nextSibling` accessor of a non-shadow slotted node
788
+ * @param NodePrototype the slotted node to be patched
789
+ */
790
+ const patchNextSibling = (NodePrototype) => {
791
+ if (!NodePrototype || NodePrototype.__nextSibling)
792
+ return;
793
+ const descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'nextSibling');
794
+ // MockNode might not have these
795
+ if (descriptor)
796
+ Object.defineProperty(NodePrototype, '__nextSibling', descriptor);
797
+ else {
798
+ NodePrototype.__nextSibling = NodePrototype.nextSibling || true;
799
+ }
800
+ Object.defineProperty(NodePrototype, 'nextSibling', {
801
+ get: function () {
802
+ var _a;
803
+ const parentNodes = (_a = this['s-ol']) === null || _a === void 0 ? void 0 : _a.parentNode.childNodes;
804
+ const index = parentNodes === null || parentNodes === void 0 ? void 0 : parentNodes.indexOf(this);
805
+ if (parentNodes && index > -1) {
806
+ return parentNodes[index + 1];
807
+ }
808
+ return this.__nextSibling;
809
+ },
810
+ });
811
+ };
812
+ /**
813
+ * Patches the `nextElementSibling` accessor of a non-shadow slotted node
814
+ * @param NodePrototype the slotted node to be patched
815
+ */
816
+ const patchNextElementSibling = (ElementPrototype) => {
817
+ if (!ElementPrototype || ElementPrototype.__nextElementSibling || !ElementPrototype.nextSiblingElement)
818
+ return;
819
+ const descriptor = Object.getOwnPropertyDescriptor(Element.prototype, 'nextElementSibling');
820
+ // MockNode won't have these
821
+ if (descriptor)
822
+ Object.defineProperty(ElementPrototype, '__nextElementSibling', descriptor);
823
+ else {
824
+ ElementPrototype.__nextElementSibling = ElementPrototype.nextSiblingElement || true;
825
+ }
826
+ Object.defineProperty(ElementPrototype, 'nextElementSibling', {
827
+ get: function () {
828
+ var _a;
829
+ const parentEles = (_a = this['s-ol']) === null || _a === void 0 ? void 0 : _a.parentNode.children;
830
+ const index = parentEles === null || parentEles === void 0 ? void 0 : parentEles.indexOf(this);
831
+ if (parentEles && index > -1) {
832
+ return parentEles[index + 1];
833
+ }
834
+ return this.__nextElementSibling;
835
+ },
836
+ });
837
+ };
838
+ /**
839
+ * Patches the `previousSibling` accessor of a non-shadow slotted node
840
+ * @param NodePrototype the slotted node to be patched
841
+ */
842
+ const patchPreviousSibling = (NodePrototype) => {
843
+ if (!NodePrototype || NodePrototype.__previousSibling)
844
+ return;
845
+ const descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'previousSibling');
846
+ // MockNode won't have these
847
+ if (descriptor)
848
+ Object.defineProperty(NodePrototype, '__previousSibling', descriptor);
849
+ else {
850
+ NodePrototype.__previousSibling = NodePrototype.previousSibling || true;
851
+ }
852
+ Object.defineProperty(NodePrototype, 'previousSibling', {
853
+ get: function () {
854
+ var _a;
855
+ const parentNodes = (_a = this['s-ol']) === null || _a === void 0 ? void 0 : _a.parentNode.childNodes;
856
+ const index = parentNodes === null || parentNodes === void 0 ? void 0 : parentNodes.indexOf(this);
857
+ if (parentNodes && index > -1) {
858
+ return parentNodes[index - 1];
859
+ }
860
+ return this.__previousSibling;
861
+ },
862
+ });
863
+ };
864
+ /**
865
+ * Patches the `previousElementSibling` accessor of a non-shadow slotted node
866
+ * @param ElementPrototype the slotted node to be patched
867
+ */
868
+ const patchPreviousElementSibling = (ElementPrototype) => {
869
+ if (!ElementPrototype || ElementPrototype.__previousElementSibling || !ElementPrototype.previousElementSibling)
870
+ return;
871
+ const descriptor = Object.getOwnPropertyDescriptor(Element.prototype, 'previousElementSibling');
872
+ // MockNode won't have these
873
+ if (descriptor)
874
+ Object.defineProperty(ElementPrototype, '__previousElementSibling', descriptor);
875
+ else {
876
+ ElementPrototype.__previousElementSibling = ElementPrototype.previousSiblingElement || true;
877
+ }
878
+ Object.defineProperty(ElementPrototype, 'previousElementSibling', {
879
+ get: function () {
880
+ var _a;
881
+ const parentNodes = (_a = this['s-ol']) === null || _a === void 0 ? void 0 : _a.parentNode.children;
882
+ const index = parentNodes === null || parentNodes === void 0 ? void 0 : parentNodes.indexOf(this);
883
+ if (parentNodes && index > -1) {
884
+ return parentNodes[index - 1];
885
+ }
886
+ return this.__previousElementSibling;
887
+ },
888
+ });
889
+ };
890
+ /**
891
+ * Patches the `remove` method of a non-shadow slotted node
892
+ * @param NodePrototype the slotted node to be patched
893
+ */
894
+ const patchRemove = (NodePrototype) => {
895
+ if (!NodePrototype || NodePrototype.__remove)
896
+ return;
897
+ NodePrototype.__remove = NodePrototype.remove || true;
898
+ patchRemoveChild(NodePrototype.parentNode);
899
+ NodePrototype.remove = function () {
900
+ if (this.parentNode) {
901
+ return this.parentNode.removeChild(this);
902
+ }
903
+ return this.__remove();
904
+ };
905
+ };
906
+ /**
907
+ * Patches the `removeChild` method of a non-shadow slotted node
908
+ * @param NodePrototype the slotted node to be patched
909
+ */
910
+ const patchRemoveChild = (ElementPrototype) => {
911
+ if (!ElementPrototype || ElementPrototype.__removeChild)
912
+ return;
913
+ ElementPrototype.__removeChild = ElementPrototype.removeChild;
914
+ ElementPrototype.removeChild = function (toRemove) {
915
+ if (toRemove && typeof toRemove['s-sn'] !== 'undefined') {
916
+ const slotNode = getHostSlotNode(this.__childNodes || this.childNodes, toRemove['s-sn']);
917
+ toRemove.parentElement.__removeChild(toRemove);
918
+ if (slotNode && slotNode['s-hsf']) {
919
+ updateFallbackSlotVisibility(slotNode.parentElement);
920
+ }
921
+ return;
922
+ }
923
+ return this.__removeChild(toRemove);
924
+ };
925
+ };
926
+ ////// Utils
927
+ /**
928
+ * When non-shadow component VDom re-renders,
929
+ * they sometimes need a place to temporarily put their 'lightDOM' elements.
930
+ * This function creates that node.
931
+ * @param newChild - A node that's going to be added to the component
932
+ * @param slotNode - The slot node that the node will be added to
933
+ */
934
+ const addSlotRelocateNode = (newChild, slotNode) => {
935
+ if (newChild['s-ol'] && newChild['s-ol'].isConnected)
936
+ return;
937
+ const slotPlaceholder = document.createTextNode('');
938
+ slotPlaceholder['s-nr'] = newChild;
939
+ if (slotNode['s-cr'] && slotNode['s-cr'].parentNode) {
940
+ const appendChild = slotNode['s-cr'].parentNode.__appendChild || slotNode['s-cr'].parentNode.appendChild;
941
+ appendChild.call(slotNode['s-cr'].parentNode, slotPlaceholder);
942
+ }
943
+ newChild['s-ol'] = slotPlaceholder;
944
+ };
945
+ /**
946
+ * Find the slot name of a given node
947
+ * @param node
948
+ * @returns the node's slot name
949
+ */
950
+ const getSlotName = (node) => node['s-sn'] ||
951
+ (node.nodeType === 1 /* NODE_TYPE.ElementNode */ && node.getAttribute('slot')) ||
952
+ node.slot ||
953
+ '';
954
+ /**
955
+ * Recursively searches a series of child nodes for a slot with the provided name.
956
+ * @param childNodes the nodes to search for a slot with a specific name.
957
+ * @param slotName the name of the slot to match on.
958
+ * @returns a reference to the slot node that matches the provided name, `null` otherwise
959
+ */
960
+ const getHostSlotNode = (childNodes, slotName) => {
961
+ let i = 0;
962
+ let childNode;
963
+ if (!childNodes)
964
+ return null;
965
+ for (; i < childNodes.length; i++) {
966
+ childNode = childNodes[i];
967
+ if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
968
+ return childNode;
969
+ }
970
+ childNode = getHostSlotNode(childNode.childNodes, slotName);
971
+ if (childNode) {
972
+ return childNode;
973
+ }
974
+ }
975
+ return null;
976
+ };
977
+ /**
978
+ * Get all nodes currently assigned to any given slot node
979
+ * @param slotNode - the slot node to check
980
+ * @returns - all child node 'within' the checked slot node
981
+ */
982
+ const getHostSlotChildNodes = (slotNode) => {
983
+ const childNodes = [slotNode];
984
+ const slotName = slotNode['s-sn'] || '';
985
+ while ((slotNode = slotNode.nextSibling) && slotNode['s-sn'] === slotName) {
986
+ childNodes.push(slotNode);
987
+ }
988
+ return childNodes;
989
+ };
990
+ /**
991
+ * Takes an SSR rendered document, as annotated by 'vdom-annotations.ts' and:
992
+ * 1) Recreate an accurate VDOM tree to reconcile with during 'vdom-render.ts'
993
+ * (a failure to do so will result in DOM nodes being duplicated when rendering)
994
+ * 2) Add `shadow: true` DOM trees to their document-fragment
995
+ * 3) Move slotted nodes out of shadowDOMs
996
+ * 4) Add meta nodes to non-shadow DOMs and their 'slotted' nodes
997
+ *
998
+ * @param hostElm - the current custom element being hydrated
999
+ * @param tagName - the custom element's tag
1000
+ * @param hostId - a unique custom element id
1001
+ * @param hostRef - the VNode representing this custom element
1002
+ */
1003
+ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1004
+ const endHydrate = createTime('hydrateClient', tagName);
1005
+ const shadowRoot = hostElm.shadowRoot;
1006
+ const childRenderNodes = [];
1007
+ const slotNodes = [];
1008
+ const slottedNodes = [];
1009
+ const shadowRootNodes = shadowRoot ? [] : null;
1010
+ let vnode = newVNode(tagName, null);
1011
+ vnode.$elm$ = hostElm;
1012
+ if (!plt.$orgLocNodes$) {
1013
+ // this is the first pass over of this whole document
1014
+ // does a quick scrape to construct a 'bare-bones' tree of
1015
+ // what elements we have and where content has been moved from
1016
+ initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
1017
+ }
1018
+ hostElm[HYDRATE_ID] = hostId;
1019
+ hostElm.removeAttribute(HYDRATE_ID);
1020
+ hostRef.$vnode$ = clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId, slottedNodes);
1021
+ let crIndex = 0;
1022
+ const crLength = childRenderNodes.length;
1023
+ let childRenderNode;
1024
+ // Steps through childNodes we found.
1025
+ // If moved from an original location (by nature of being rendered in SSR markup)
1026
+ // we might be able to move it back there now,
1027
+ // so slotted nodes don't get added to internal shadowDOMs
1028
+ for (crIndex; crIndex < crLength; crIndex++) {
1029
+ childRenderNode = childRenderNodes[crIndex];
1030
+ const orgLocationId = childRenderNode.$hostId$ + '.' + childRenderNode.$nodeId$;
1031
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1032
+ const node = childRenderNode.$elm$;
1033
+ if (!shadowRoot) {
1034
+ node['s-hn'] = tagName.toUpperCase();
1035
+ if (childRenderNode.$tag$ === 'slot') {
1036
+ // if this is a 'mock slot'
1037
+ // add it's content position reference now.
1038
+ // otherwise vdom-render will try to add nodes to it
1039
+ // (it's a comment node so will error)
1040
+ node['s-cr'] = hostElm['s-cr'];
1041
+ }
1042
+ }
1043
+ if (orgLocationNode && orgLocationNode.isConnected) {
1044
+ if (shadowRoot && orgLocationNode['s-en'] === '') {
1045
+ // if this node is within a shadowDOM, with an original location home
1046
+ // we're safe to move it now
1047
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1048
+ }
1049
+ // Remove original location comment now regardless:
1050
+ // 1) Stops SSR frameworks complaining about mismatches
1051
+ // 2) is un-required for non-shadow, slotted nodes as
1052
+ // we'll add all the meta nodes we need when we deal with *all* slotted nodes ↓↓↓
1053
+ orgLocationNode.parentNode.removeChild(orgLocationNode);
1054
+ }
1055
+ // remove the original location from the map
1056
+ plt.$orgLocNodes$.delete(orgLocationId);
1057
+ }
1058
+ const hosts = [];
1059
+ let snIndex = 0;
1060
+ const snLen = slottedNodes.length;
1061
+ let slotGroup;
1062
+ let snGroupIdx;
1063
+ let snGroupLen;
1064
+ let slottedItem;
1065
+ // Loops through all the slotted nodes we found while
1066
+ // stepping through this component
1067
+ for (snIndex; snIndex < snLen; snIndex++) {
1068
+ slotGroup = slottedNodes[snIndex];
1069
+ if (!slotGroup || !slotGroup.length)
1070
+ continue;
1071
+ snGroupLen = slotGroup.length;
1072
+ snGroupIdx = 0;
1073
+ for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
1074
+ slottedItem = slotGroup[snGroupIdx];
1075
+ if (!hosts[slottedItem.hostId]) {
1076
+ // cache this host for other grouped slotted nodes
1077
+ hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
1078
+ }
1079
+ // this shouldn't happen
1080
+ // as we collect all the custom elements first in `initializeDocumentHydrate`
1081
+ if (!hosts[slottedItem.hostId])
1082
+ continue;
1083
+ const hostEle = hosts[slottedItem.hostId];
1084
+ // this node is either slotted in a non-shadow host, OR
1085
+ // *that* host is nested in a non-shadow host
1086
+ if (!hostEle.shadowRoot || !shadowRoot) {
1087
+ // try to set an appropriate content position reference
1088
+ // (CR) node for this host element
1089
+ // a CR already set on the host?
1090
+ slottedItem.slot['s-cr'] = hostEle['s-cr'];
1091
+ if (!slottedItem.slot['s-cr'] && hostEle.shadowRoot) {
1092
+ // host is shadowDOM - just use the host itself as the CR for native slotting
1093
+ slottedItem.slot['s-cr'] = hostEle;
1094
+ }
1095
+ else {
1096
+ // if all else fails - just set the CR as the first child
1097
+ // (9/10 if node['s-cr'] hasn't been set, the node will be at the element root)
1098
+ const hostChildren = hostEle.__childNodes || hostEle.childNodes;
1099
+ slottedItem.slot['s-cr'] = hostChildren[0];
1100
+ }
1101
+ // create our original location node
1102
+ addSlotRelocateNode(slottedItem.node, slottedItem.slot);
1103
+ // patch this node for accessors like `nextSibling` (et al)
1104
+ patchNextPrev(slottedItem.node);
1105
+ }
1106
+ if (hostEle.shadowRoot) {
1107
+ // shadowDOM - move the item to the element root for
1108
+ // native slotting
1109
+ hostEle.appendChild(slottedItem.node);
1110
+ }
1111
+ }
1112
+ }
1113
+ if (shadowRoot) {
1114
+ // add all the root nodes in the shadowDOM
1115
+ // (a root node can have a whole nested DOM tree)
1116
+ let rnIdex = 0;
1117
+ const rnLen = shadowRootNodes.length;
1118
+ for (rnIdex; rnIdex < rnLen; rnIdex++) {
1119
+ shadowRoot.appendChild(shadowRootNodes[rnIdex]);
1120
+ }
1121
+ // tidy up left-over / unnecessary comments to stop
1122
+ // frameworks complaining about DOM mismatches
1123
+ Array.from(hostElm.childNodes).forEach((node) => {
1124
+ if (node.nodeType === 8 /* NODE_TYPE.CommentNode */ && typeof node['s-sn'] !== 'string') {
1125
+ node.parentNode.removeChild(node);
1126
+ }
1127
+ });
1128
+ }
1129
+ hostRef.$hostElement$ = hostElm;
1130
+ endHydrate();
1131
+ };
1132
+ /**
1133
+ * Recursively step through a nodes' SSR DOM.
1134
+ * Constructs a VDOM. Finds and adds nodes to master arrays
1135
+ * (`childRenderNodes`, `shadowRootNodes` and `slottedNodes`)
1136
+ * these are used later for special consideration:
1137
+ * - Add `shadow: true` DOM trees to their document-fragment
1138
+ * - Move slotted nodes out of shadowDOMs
1139
+ * - Add meta nodes to non-shadow DOMs and their 'slotted' nodes
1140
+ * @param parentVNode - this nodes current parent vnode
1141
+ * @param childRenderNodes - flat array of all child vnodes
1142
+ * @param slotNodes - nodes that represent an element's `<slot />`s
1143
+ * @param shadowRootNodes - nodes that are at the root of this hydrating element
1144
+ * @param hostElm - the root, hydrating element
1145
+ * @param node - the node currently being iterated over
1146
+ * @param hostId - the root, hydrating element id
1147
+ * @param slottedNodes - nodes that have been slotted
1148
+ * @returns - the constructed VNode
1149
+ */
1150
+ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
1151
+ let childNodeType;
1152
+ let childIdSplt;
1153
+ let childVNode;
1154
+ let i;
1155
+ const scopeId = hostElm['s-sc'];
1156
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1157
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
1158
+ if (childNodeType) {
1159
+ // got the node data from the element's attribute
1160
+ // `${hostId}.${nodeId}.${depth}.${index}`
1161
+ childIdSplt = childNodeType.split('.');
1162
+ if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
1163
+ childVNode = createSimpleVNode({
1164
+ $hostId$: childIdSplt[0],
1165
+ $nodeId$: childIdSplt[1],
1166
+ $depth$: childIdSplt[2],
1167
+ $index$: childIdSplt[3],
1168
+ $tag$: node.tagName.toLowerCase(),
1169
+ $elm$: node,
1170
+ // if we don't add the initial classes to the VNode,
1171
+ // the first vdom-render patch / reconciliation will fail;
1172
+ // any client side change before componentDidLoad will be ignored,
1173
+ // `setAccessor` will just take the element's initial classes
1174
+ $attrs$: { class: node.className },
1175
+ });
1176
+ childRenderNodes.push(childVNode);
1177
+ node.removeAttribute(HYDRATE_CHILD_ID);
1178
+ // this is a new child vnode
1179
+ // so ensure it's parent vnode has the vchildren array
1180
+ if (!parentVNode.$children$) {
1181
+ parentVNode.$children$ = [];
1182
+ }
1183
+ // test if this element was 'slotted'
1184
+ // recreate node attributes
1185
+ const slotName = childVNode.$elm$.getAttribute('s-sn');
1186
+ if (typeof slotName === 'string') {
1187
+ childVNode.$elm$['s-sn'] = slotName;
1188
+ childVNode.$elm$.removeAttribute('s-sn');
1189
+ }
1190
+ // test if this node is the child (a slot fallback node) of a slot
1191
+ const slotFbId = childVNode.$elm$.getAttribute(HYDRATED_SLOT_FALLBACK_ID);
1192
+ if (slotFbId) {
1193
+ childVNode.$elm$.removeAttribute(HYDRATED_SLOT_FALLBACK_ID);
1194
+ // find the relevant slot node
1195
+ const slotNode = slotNodes.find((slot) => slot.$elm$['s-sn'] === childVNode.$elm$['s-sn'] || slot.$name$ === childVNode.$elm$['s-sn']);
1196
+ // add the relationship to the VDOM to stop re-renders
1197
+ if (slotNode) {
1198
+ childVNode.$elm$['s-sf'] = true;
1199
+ childVNode.$elm$['s-hn'] = hostElm.tagName;
1200
+ slotNode.$children$ = slotNode.$children$ || [];
1201
+ slotNode.$children$[childVNode.$index$] = childVNode;
1202
+ // if the slot is an actual `<slot>`
1203
+ // that's a newly created node (↓↓↓)
1204
+ // move this element there now
1205
+ if (slotNode.$elm$.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1206
+ slotNode.$elm$.appendChild(childVNode.$elm$);
1207
+ }
1208
+ }
1209
+ }
1210
+ else if (childVNode.$index$ !== undefined) {
1211
+ // add our child vnode to a specific index of the vnode's children
1212
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1213
+ }
1214
+ // host is `scoped: true` - add that flag to child.
1215
+ // used in 'setAccessor' to make sure our scoped class is present
1216
+ if (scopeId)
1217
+ node['s-si'] = scopeId;
1218
+ // this is now the new parent vnode for all the next child checks
1219
+ parentVNode = childVNode;
1220
+ if (shadowRootNodes &&
1221
+ childVNode.$depth$ === '0' &&
1222
+ // don't move slot fallback node into the root nodes array
1223
+ // they'll be moved into a new slot element ↓↓↓
1224
+ !slotFbId) {
1225
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1226
+ }
1227
+ }
1228
+ }
1229
+ // recursively drill down, end to start so we can
1230
+ // construct a VDOM and add meta to nodes
1231
+ const nonShadowChildNodes = node.__childNodes || node.childNodes;
1232
+ for (i = nonShadowChildNodes.length - 1; i >= 0; i--) {
1233
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, nonShadowChildNodes[i], hostId, slottedNodes);
1234
+ }
1235
+ if (node.shadowRoot) {
1236
+ // keep drilling down through the shadow root nodes
1237
+ for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
1238
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId, slottedNodes);
1239
+ }
1240
+ }
1241
+ }
1242
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
1243
+ // `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}.${isSlotFallbackText}.${slotName}`
1244
+ childIdSplt = node.nodeValue.split('.');
1245
+ if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
1246
+ // comment node for either the host id or a 0 host id
1247
+ childNodeType = childIdSplt[0];
1248
+ childVNode = createSimpleVNode({
1249
+ $hostId$: childIdSplt[1],
1250
+ $nodeId$: childIdSplt[2],
1251
+ $depth$: childIdSplt[3],
1252
+ $index$: childIdSplt[4] || '0',
1253
+ $elm$: node,
1254
+ });
1255
+ if (childNodeType === TEXT_NODE_ID) {
1256
+ let textNode = (childVNode.$elm$ = node.nextSibling);
1257
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
1258
+ childVNode.$text$ = childVNode.$elm$.textContent;
1259
+ childRenderNodes.push(childVNode);
1260
+ // remove the text comment since it's no longer needed
1261
+ node.remove();
1262
+ // test to see if this is slot fallback text
1263
+ if (childIdSplt[5] === '1') {
1264
+ textNode['s-sf'] = true;
1265
+ textNode['s-sn'] = childIdSplt[6] || '';
1266
+ textNode['s-sfc'] = textNode.textContent;
1267
+ textNode['s-hn'] = hostElm.tagName;
1268
+ // find the relevant slot node
1269
+ const slotNode = slotNodes.find((slot) => slot.$elm$['s-sn'] === textNode['s-sn'] || slot.$name$ === textNode['s-sn']);
1270
+ // add the relationship to the VDOM to stop re-renders
1271
+ if (slotNode) {
1272
+ slotNode.$children$ = slotNode.$children$ || [];
1273
+ slotNode.$children$[childVNode.$index$] = childVNode;
1274
+ // if the slot is an actual `<slot>`
1275
+ // that's a newly created node (↓↓↓)
1276
+ // move this text node there now
1277
+ if (slotNode.$elm$.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1278
+ slotNode.$elm$.appendChild(textNode);
1279
+ }
1280
+ }
1281
+ }
1282
+ else {
1283
+ // check to make sure this node actually belongs to this host.
1284
+ // If it was slotted from another component, we don't want to add it
1285
+ // to this host's vdom; it can be removed on render reconciliation.
1286
+ // We want slotting logic to take care of it
1287
+ if (hostId === childVNode.$hostId$) {
1288
+ if (!parentVNode.$children$) {
1289
+ parentVNode.$children$ = [];
1290
+ }
1291
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1292
+ }
1293
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
1294
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1295
+ }
1296
+ }
1297
+ }
1298
+ }
1299
+ else if (childVNode.$hostId$ === hostId) {
1300
+ // this comment node is specifically for this host id
1301
+ if (childNodeType === SLOT_NODE_ID) {
1302
+ // `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}.${hasSlotFallback}.${slotFallbackText}`;
1303
+ childVNode.$tag$ = 'slot';
1304
+ // TODO: this is clunky.
1305
+ // Clear out parent VNode attrs so the initial element state is used as a reference.
1306
+ // The reason: this is a slot container element and requires special scope classes
1307
+ // This does mean any class changes client-side before 'componentDidLoad',
1308
+ // will not be respected.
1309
+ parentVNode.$attrs$ = undefined;
1310
+ // add slot name
1311
+ const slotName = (node['s-sn'] = childVNode.$name$ = childIdSplt[5] || '');
1312
+ node['s-sr'] = true;
1313
+ // this slot node has fallback nodes?
1314
+ if (childIdSplt[6] === '1') {
1315
+ node['s-hsf'] = true;
1316
+ }
1317
+ if (childIdSplt[7] === '1') {
1318
+ // this slot has fallback text
1319
+ // it should be held in the previous comment node
1320
+ // (white-space depending)
1321
+ let foundFallbackText = node.previousSibling;
1322
+ while (!!foundFallbackText && foundFallbackText.nodeType !== 8 /* NODE_TYPE.CommentNode */) {
1323
+ foundFallbackText = foundFallbackText.previousSibling;
1324
+ }
1325
+ // this slot node has fallback text?
1326
+ // (if so, the previous node comment will have that text)
1327
+ node['s-sfc'] = foundFallbackText.nodeValue;
1328
+ }
1329
+ // find this slots' current host parent as dictated by the vdom tree.
1330
+ // this is important because where it is now in the constructed SSR markup
1331
+ // might be different to where to should be
1332
+ const parentNodeId = (parentVNode === null || parentVNode === void 0 ? void 0 : parentVNode.$elm$)
1333
+ ? parentVNode.$elm$['s-id'] || parentVNode.$elm$.getAttribute('s-id')
1334
+ : '';
1335
+ if (shadowRootNodes) {
1336
+ /* SHADOW */
1337
+ // browser supports shadowRoot and this is a shadow dom component
1338
+ // create an actual slot element
1339
+ const slot = (childVNode.$elm$ = doc.createElement(childVNode.$tag$));
1340
+ if (childVNode.$name$) {
1341
+ // add the slot name attribute
1342
+ childVNode.$elm$.setAttribute('name', slotName);
1343
+ }
1344
+ if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1345
+ // shadow component's slot is placed inside a nested component's shadowDOM;
1346
+ // it doesn't belong to this host - it was forwarded by the SSR markup.
1347
+ // Insert it in the root of this host; it's lightDOM.
1348
+ // It doesn't really matter where in the host root; the component will take care of it.
1349
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1350
+ }
1351
+ else {
1352
+ // insert the new slot element before the slot comment
1353
+ node.parentNode.insertBefore(childVNode.$elm$, node);
1354
+ }
1355
+ addSlottedNodes(slottedNodes, childIdSplt[2], slotName, node, childVNode.$hostId$);
1356
+ // remove the slot comment since it's not needed for shadow
1357
+ node.remove();
1358
+ if (childVNode.$depth$ === '0') {
1359
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1360
+ }
1361
+ }
1362
+ else {
1363
+ /* NON-SHADOW */
1364
+ const slot = childVNode.$elm$;
1365
+ // test to see if this non-shadow component's mock 'slot' is placed
1366
+ // inside a nested component's shadowDOM. If so, it doesn't belong here;
1367
+ // it was forwarded by the SSR markup. So we'll insert it into the root of this host;
1368
+ // it's lightDOM with accompanying 'slotted' nodes
1369
+ const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
1370
+ // attempt to find any mock slotted nodes which we'll move later
1371
+ addSlottedNodes(slottedNodes, childIdSplt[2], slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
1372
+ if (shouldMove) {
1373
+ // move slot comment node (to after any other comment nodes)
1374
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1375
+ }
1376
+ childRenderNodes.push(childVNode);
1377
+ }
1378
+ slotNodes.push(childVNode);
1379
+ if (!parentVNode.$children$) {
1380
+ parentVNode.$children$ = [];
1381
+ }
1382
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1383
+ }
1384
+ else if (childNodeType === CONTENT_REF_ID) {
1385
+ // `${CONTENT_REF_ID}.${hostId}`;
1386
+ if (shadowRootNodes) {
1387
+ // remove the content ref comment since it's not needed for shadow
1388
+ node.remove();
1389
+ }
1390
+ else {
1391
+ hostElm['s-cr'] = node;
1392
+ node['s-cn'] = true;
1393
+ }
1394
+ }
1395
+ }
1396
+ }
1397
+ }
1398
+ else if (parentVNode && parentVNode.$tag$ === 'style') {
1399
+ const vnode = newVNode(null, node.textContent);
1400
+ vnode.$elm$ = node;
1401
+ vnode.$index$ = '0';
1402
+ parentVNode.$children$ = [vnode];
1403
+ }
1404
+ return parentVNode;
1405
+ };
1406
+ /**
1407
+ * Skims whole SSR document to create
1408
+ * a map of component IDs and 'original location ID's.
1409
+ * original location ID's are derived from comment nodes placed by 'vdom-annotations.ts'.
1410
+ * They relate to lightDOM nodes that were moved deeper into the SSR markup.
1411
+ * e.g. `<!--o.1-->` maps to `<div c-id="0.1">`
1412
+ *
1413
+ * @param node - a node in the document. If an element, will recursively drill down
1414
+ * @param orgLocNodes - a master map to add component ids and original location ids to
1415
+ */
1416
+ const initializeDocumentHydrate = (node, orgLocNodes) => {
1417
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1418
+ // add all the loaded component IDs in this document
1419
+ // they're required to find nodes later
1420
+ // when deciding where slotted nodes should live
1421
+ const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
1422
+ if (componentId) {
1423
+ orgLocNodes.set(componentId, node);
1424
+ }
1425
+ let i = 0;
1426
+ const nonShadowChildNodes = node.__childNodes || node.childNodes;
1427
+ for (; i < nonShadowChildNodes.length; i++) {
1428
+ initializeDocumentHydrate(nonShadowChildNodes[i], orgLocNodes);
1429
+ }
1430
+ if (node.shadowRoot) {
1431
+ for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
1432
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
1433
+ }
1434
+ }
1435
+ }
1436
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
1437
+ const childIdSplt = node.nodeValue.split('.');
1438
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
1439
+ orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
1440
+ // useful to know if the original location is
1441
+ // the root light-dom of a shadow dom component
1442
+ node['s-en'] = childIdSplt[3];
1443
+ }
1444
+ }
1445
+ };
1446
+ /**
1447
+ * Creates a vnode to add to a hydrated component vdom
1448
+ * @param vnode - a vnode partial which will be augmented
1449
+ * @returns an complete vnode
1450
+ */
1451
+ const createSimpleVNode = (vnode) => {
1452
+ const defaultVNode = {
1453
+ $flags$: 0,
1454
+ $hostId$: null,
1455
+ $nodeId$: null,
1456
+ $depth$: null,
1457
+ $index$: '0',
1458
+ $elm$: null,
1459
+ $attrs$: null,
1460
+ $children$: null,
1461
+ $key$: null,
1462
+ $name$: null,
1463
+ $tag$: null,
1464
+ $text$: null,
1465
+ };
1466
+ return Object.assign(Object.assign({}, defaultVNode), vnode);
1467
+ };
1468
+ /**
1469
+ * Adds groups of slotted nodes (grouped by slot ID)
1470
+ * to this host element's 'master' array. We'll use this after
1471
+ * the host element's VDOM is completely constructed to
1472
+ * finally position or / and add meta information required by non-shadow slotted nodes
1473
+ * @param slottedNodes - the main host element 'master' array to add to
1474
+ * @param slotNodeId - the slot node unique ID
1475
+ * @param slotName - the slot node name (can be '')
1476
+ * @param slotNode - the slot node
1477
+ * @param hostId - the host element id where this node should be slotted
1478
+ */
1479
+ const addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
1480
+ let slottedNode = slotNode.nextSibling;
1481
+ slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
1482
+ // looking for nodes that match this slot's name,
1483
+ // OR are text / comment nodes and the slot is a default slot (no name)
1484
+ // (text / comments cannot be direct descendants of named slots)
1485
+ // also ignore slot fallback nodes
1486
+ while (slottedNode &&
1487
+ (slottedNode['s-sn'] === slotName ||
1488
+ (slotName === '' &&
1489
+ !slottedNode['s-sn'] &&
1490
+ ((slottedNode.nodeType === 8 /* NODE_TYPE.CommentNode */ && slottedNode.nodeValue.indexOf('.') !== 1) ||
1491
+ slottedNode.nodeType === 3 /* NODE_TYPE.TextNode */))) &&
1492
+ !slottedNode['s-sf']) {
1493
+ slottedNode['s-sn'] = slotName;
1494
+ slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1495
+ slottedNode = slottedNode.nextSibling;
1496
+ }
1497
+ };
1498
+ // Private
1499
+ const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
1500
+ /**
1501
+ * Parse a new property value for a given property type.
1502
+ *
1503
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
1504
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
1505
+ * 1. `any`, the type given to `propValue` in the function signature
1506
+ * 2. the type stored from `propType`.
1507
+ *
1508
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
1509
+ *
1510
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
1511
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
1512
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
1513
+ * ```tsx
1514
+ * <my-cmp prop-val={0}></my-cmp>
1515
+ * ```
1516
+ *
1517
+ * HTML prop values on the other hand, will always a string
1518
+ *
1519
+ * @param propValue the new value to coerce to some type
1520
+ * @param propType the type of the prop, expressed as a binary number
1521
+ * @returns the parsed/coerced value
1522
+ */
1523
+ const parsePropertyValue = (propValue, propType) => {
1524
+ // ensure this value is of the correct prop type
1525
+ if (propValue != null && !isComplexType(propValue)) {
1526
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
1527
+ // per the HTML spec, any string value means it is a boolean true value
1528
+ // but we'll cheat here and say that the string "false" is the boolean false
1529
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
1530
+ }
1531
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
1532
+ // force it to be a number
1533
+ return parseFloat(propValue);
1534
+ }
1535
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
1536
+ // could have been passed as a number or boolean
1537
+ // but we still want it as a string
1538
+ return String(propValue);
1539
+ }
1540
+ // redundant return here for better minification
1541
+ return propValue;
1542
+ }
1543
+ // not sure exactly what type we want
1544
+ // so no need to change to a different type
1545
+ return propValue;
1546
+ };
1547
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
1548
+ const createEvent = (ref, name, flags) => {
1549
+ const elm = getElement(ref);
1550
+ return {
1551
+ emit: (detail) => {
1552
+ return emitEvent(elm, name, {
1553
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
1554
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
1555
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
1556
+ detail,
1557
+ });
1558
+ },
1559
+ };
1560
+ };
1561
+ /**
1562
+ * Helper function to create & dispatch a custom Event on a provided target
1563
+ * @param elm the target of the Event
1564
+ * @param name the name to give the custom Event
1565
+ * @param opts options for configuring a custom Event
1566
+ * @returns the custom Event
1567
+ */
1568
+ const emitEvent = (elm, name, opts) => {
1569
+ const ev = plt.ce(name, opts);
1570
+ elm.dispatchEvent(ev);
1571
+ return ev;
1572
+ };
1573
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
1574
+ const registerStyle = (scopeId, cssText, allowCS) => {
1575
+ let style = styles.get(scopeId);
1576
+ if (supportsConstructableStylesheets && allowCS) {
1577
+ style = (style || new CSSStyleSheet());
1578
+ if (typeof style === 'string') {
1579
+ style = cssText;
1580
+ }
1581
+ else {
1582
+ style.replaceSync(cssText);
1583
+ }
1584
+ }
1585
+ else {
1586
+ style = cssText;
1587
+ }
1588
+ styles.set(scopeId, style);
1589
+ };
1590
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
1591
+ var _a;
1592
+ let scopeId = getScopeId(cmpMeta);
1593
+ const style = styles.get(scopeId);
1594
+ // if an element is NOT connected then getRootNode() will return the wrong root node
1595
+ // so the fallback is to always use the document for the root node in those cases
1596
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
1597
+ if (style) {
1598
+ if (typeof style === 'string') {
1599
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
1600
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
1601
+ let styleElm;
1602
+ if (!appliedStyles) {
1603
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
1604
+ }
1605
+ if (!appliedStyles.has(scopeId)) {
1606
+ if (styleContainerNode.host &&
1607
+ (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
1608
+ // This is only happening on native shadow-dom, do not needs CSS var shim
1609
+ styleElm.innerHTML = style;
1610
+ }
1611
+ else {
1612
+ {
1613
+ styleElm = doc.createElement('style');
1614
+ styleElm.innerHTML = style;
1615
+ }
1616
+ // Apply CSP nonce to the style tag if it exists
1617
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1618
+ if (nonce != null) {
1619
+ styleElm.setAttribute('nonce', nonce);
1620
+ }
1621
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
1622
+ }
1623
+ if (appliedStyles) {
1624
+ appliedStyles.add(scopeId);
1625
+ }
1626
+ }
886
1627
  }
887
- childNode = getHostSlotNode(childNode.childNodes, slotName);
888
- if (childNode) {
889
- return childNode;
1628
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
1629
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
890
1630
  }
891
1631
  }
892
- return null;
1632
+ return scopeId;
893
1633
  };
894
- const getHostSlotChildNodes = (n, slotName) => {
895
- const childNodes = [n];
896
- while ((n = n.nextSibling) && n['s-sn'] === slotName) {
897
- childNodes.push(n);
1634
+ const attachStyles = (hostRef) => {
1635
+ const cmpMeta = hostRef.$cmpMeta$;
1636
+ const elm = hostRef.$hostElement$;
1637
+ const flags = cmpMeta.$flags$;
1638
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
1639
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
1640
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
1641
+ // only required when we're NOT using native shadow dom (slot)
1642
+ // or this browser doesn't support native shadow dom
1643
+ // and this host element was NOT created with SSR
1644
+ // let's pick out the inner content for slot projection
1645
+ // create a node to represent where the original
1646
+ // content was first placed, which is useful later on
1647
+ // DOM WRITE!!
1648
+ elm['s-sc'] = scopeId;
1649
+ elm.classList.add(scopeId + '-h');
1650
+ if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
1651
+ elm.classList.add(scopeId + '-s');
1652
+ }
898
1653
  }
899
- return childNodes;
1654
+ endAttachStyles();
900
1655
  };
901
- const renderSlotFallbackContent = (sr, hide) => {
902
- if (!sr['s-hsf'])
903
- return;
904
- let n = sr;
905
- while ((n = (n.previousSibling || n.parentNode)) && n.tagName !== sr['s-hn']) {
906
- if (n['s-sr'] && hide && n['s-psn'] && n['s-psn'] === sr['s-sn']) {
907
- renderSlotFallbackContent(n, true);
908
- continue;
1656
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
1657
+ const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
1658
+ /**
1659
+ * Production setAccessor() function based on Preact by
1660
+ * Jason Miller (@developit)
1661
+ * Licensed under the MIT License
1662
+ * https://github.com/developit/preact/blob/master/LICENSE
1663
+ *
1664
+ * Modified for Stencil's compiler and vdom
1665
+ */
1666
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
1667
+ if (oldValue !== newValue) {
1668
+ let isProp = isMemberInElement(elm, memberName);
1669
+ let ln = memberName.toLowerCase();
1670
+ if (memberName === 'class') {
1671
+ const classList = elm.classList;
1672
+ const oldClasses = parseClassList(oldValue);
1673
+ const newClasses = parseClassList(newValue);
1674
+ // for `scoped: true` components, new nodes after initial hydration
1675
+ // from SSR don't have the slotted class added. Let's add that now
1676
+ if (elm['s-si'] && newClasses.indexOf(elm['s-si']) < 0) {
1677
+ newClasses.push(elm['s-si']);
1678
+ }
1679
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
1680
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
909
1681
  }
910
- if (n['s-sn'] !== sr['s-sn'])
911
- continue;
912
- if (n.nodeType === 1 /* NODE_TYPE.ElementNode */) {
913
- n.hidden = hide;
914
- n.style.display = hide ? 'none' : '';
1682
+ else if (memberName === 'style') {
1683
+ // update style attribute, css properties and values
1684
+ {
1685
+ for (const prop in oldValue) {
1686
+ if (!newValue || newValue[prop] == null) {
1687
+ if (prop.includes('-')) {
1688
+ elm.style.removeProperty(prop);
1689
+ }
1690
+ else {
1691
+ elm.style[prop] = '';
1692
+ }
1693
+ }
1694
+ }
1695
+ }
1696
+ for (const prop in newValue) {
1697
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
1698
+ if (prop.includes('-')) {
1699
+ elm.style.setProperty(prop, newValue[prop]);
1700
+ }
1701
+ else {
1702
+ elm.style[prop] = newValue[prop];
1703
+ }
1704
+ }
1705
+ }
915
1706
  }
916
- else if (!!n['s-sfc']) {
917
- if (hide) {
918
- n['s-sfc'] = n.textContent || undefined;
919
- n.textContent = '';
1707
+ else if (memberName === 'key')
1708
+ ;
1709
+ else if (memberName === 'ref') {
1710
+ // minifier will clean this up
1711
+ if (newValue) {
1712
+ newValue(elm);
1713
+ }
1714
+ }
1715
+ else if ((!isProp ) &&
1716
+ memberName[0] === 'o' &&
1717
+ memberName[1] === 'n') {
1718
+ // Event Handlers
1719
+ // so if the member name starts with "on" and the 3rd characters is
1720
+ // a capital letter, and it's not already a member on the element,
1721
+ // then we're assuming it's an event listener
1722
+ if (memberName[2] === '-') {
1723
+ // on- prefixed events
1724
+ // allows to be explicit about the dom event to listen without any magic
1725
+ // under the hood:
1726
+ // <my-cmp on-click> // listens for "click"
1727
+ // <my-cmp on-Click> // listens for "Click"
1728
+ // <my-cmp on-ionChange> // listens for "ionChange"
1729
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
1730
+ memberName = memberName.slice(3);
1731
+ }
1732
+ else if (isMemberInElement(win, ln)) {
1733
+ // standard event
1734
+ // the JSX attribute could have been "onMouseOver" and the
1735
+ // member name "onmouseover" is on the window's prototype
1736
+ // so let's add the listener "mouseover", which is all lowercased
1737
+ memberName = ln.slice(2);
1738
+ }
1739
+ else {
1740
+ // custom event
1741
+ // the JSX attribute could have been "onMyCustomEvent"
1742
+ // so let's trim off the "on" prefix and lowercase the first character
1743
+ // and add the listener "myCustomEvent"
1744
+ // except for the first character, we keep the event name case
1745
+ memberName = ln[2] + memberName.slice(3);
1746
+ }
1747
+ if (oldValue) {
1748
+ plt.rel(elm, memberName, oldValue, false);
920
1749
  }
921
- else if (!n.textContent || n.textContent.trim() === '') {
922
- n.textContent = n['s-sfc'];
1750
+ if (newValue) {
1751
+ plt.ael(elm, memberName, newValue, false);
923
1752
  }
924
1753
  }
925
- }
926
- };
927
- const updateFallbackSlotVisibility = (elm) => {
928
- const childNodes = elm.__childNodes || elm.childNodes;
929
- let childNode;
930
- let i;
931
- let ilen;
932
- let j;
933
- let slotNameAttr;
934
- let nodeType;
935
- for (i = 0, ilen = childNodes.length; i < ilen; i++) {
936
- childNode = childNodes[i];
937
- if (childNode['s-sr']) {
938
- // this is a slot fallback node
939
- // get the slot name for this slot reference node
940
- slotNameAttr = childNode['s-sn'];
941
- // by default always show a fallback slot node
942
- // then hide it if there are other slots in the light dom
943
- renderSlotFallbackContent(childNode, false);
944
- for (j = 0; j < ilen; j++) {
945
- nodeType = childNodes[j].nodeType;
946
- if (childNodes[j]['s-sf'])
947
- continue;
948
- if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
949
- // this sibling node is from a different component OR is a named fallback slot node
950
- if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j]['s-sn']) {
951
- renderSlotFallbackContent(childNode, true);
952
- patchNodeRemove(childNodes[j]);
953
- break;
1754
+ else {
1755
+ // Set property if it exists and it's not a SVG
1756
+ const isComplex = isComplexType(newValue);
1757
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
1758
+ try {
1759
+ if (!elm.tagName.includes('-')) {
1760
+ const n = newValue == null ? '' : newValue;
1761
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
1762
+ if (memberName === 'list') {
1763
+ isProp = false;
1764
+ }
1765
+ else if (oldValue == null || elm[memberName] != n) {
1766
+ elm[memberName] = n;
1767
+ }
1768
+ }
1769
+ else {
1770
+ elm[memberName] = newValue;
954
1771
  }
955
1772
  }
956
- else if (childNodes[j]['s-sn'] === slotNameAttr) {
957
- // this is a default fallback slot node
958
- // any element or text node (with content)
959
- // should hide the default fallback slot node
960
- if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
961
- (nodeType === 3 /* NODE_TYPE.TextNode */ &&
962
- childNodes[j] &&
963
- childNodes[j].textContent &&
964
- childNodes[j].textContent.trim() !== '')) {
965
- renderSlotFallbackContent(childNode, true);
966
- patchNodeRemove(childNodes[j]);
967
- break;
1773
+ catch (e) { }
1774
+ }
1775
+ /**
1776
+ * Need to manually update attribute if:
1777
+ * - memberName is not an attribute
1778
+ * - if we are rendering the host element in order to reflect attribute
1779
+ * - if it's a SVG, since properties might not work in <svg>
1780
+ * - if the newValue is null/undefined or 'false'.
1781
+ */
1782
+ let xlink = false;
1783
+ {
1784
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
1785
+ memberName = ln;
1786
+ xlink = true;
1787
+ }
1788
+ }
1789
+ if (newValue == null || newValue === false) {
1790
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
1791
+ if (xlink) {
1792
+ elm.removeAttributeNS(XLINK_NS, memberName);
1793
+ }
1794
+ else {
1795
+ elm.removeAttribute(memberName);
968
1796
  }
969
1797
  }
970
1798
  }
1799
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
1800
+ newValue = newValue === true ? '' : newValue;
1801
+ if (xlink) {
1802
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
1803
+ }
1804
+ else {
1805
+ elm.setAttribute(memberName, newValue);
1806
+ }
1807
+ }
971
1808
  }
972
- // keep drilling down
973
- updateFallbackSlotVisibility(childNode);
1809
+ }
1810
+ };
1811
+ const parseClassListRegex = /\s/;
1812
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
1813
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
1814
+ // if the element passed in is a shadow root, which is a document fragment
1815
+ // then we want to be adding attrs/props to the shadow root's "host" element
1816
+ // if it's not a shadow root, then we add attrs/props to the same element
1817
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
1818
+ ? newVnode.$elm$.host
1819
+ : newVnode.$elm$;
1820
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
1821
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
1822
+ {
1823
+ // remove attributes no longer present on the vnode by setting them to undefined
1824
+ for (memberName in oldVnodeAttrs) {
1825
+ if (!(memberName in newVnodeAttrs)) {
1826
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
1827
+ }
1828
+ }
1829
+ }
1830
+ // add new & update changed attributes
1831
+ for (memberName in newVnodeAttrs) {
1832
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
974
1833
  }
975
1834
  };
976
1835
  /**
@@ -1047,30 +1906,41 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
1047
1906
  elm['s-cr'] = contentRef;
1048
1907
  // remember the slot name, or empty string for default slot
1049
1908
  elm['s-sn'] = newVNode.$name$ || '';
1050
- if (newParentVNode.$name$)
1909
+ // if this slot is nested within another parent slot, add that slot's name.
1910
+ // (used in 'renderSlotFallbackContent')
1911
+ if (newParentVNode.$name$) {
1051
1912
  elm['s-psn'] = newParentVNode.$name$;
1913
+ }
1052
1914
  if (newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */) {
1053
1915
  if (newVNode.$children$) {
1916
+ // this slot has fallback nodes
1054
1917
  for (i = 0; i < newVNode.$children$.length; ++i) {
1055
1918
  // create the node
1056
- let containerElm = elm.nodeType === 1 ? elm : parentElm;
1057
- while (containerElm.nodeType !== 1) {
1919
+ let containerElm = elm.nodeType === 1 /* NODE_TYPE.ElementNode */ ? elm : parentElm;
1920
+ while (containerElm.nodeType !== 1 /* NODE_TYPE.ElementNode */) {
1058
1921
  containerElm = containerElm.parentNode;
1059
1922
  }
1060
1923
  childNode = createElm(oldParentVNode, newVNode, i, containerElm);
1924
+ // add new node meta.
1925
+ // slot has fallback and childnode is slot fallback
1061
1926
  childNode['s-sf'] = elm['s-hsf'] = true;
1062
- if (typeof childNode['s-sn'] === 'undefined')
1927
+ if (typeof childNode['s-sn'] === 'undefined') {
1063
1928
  childNode['s-sn'] = newVNode.$name$ || '';
1929
+ }
1064
1930
  if (childNode.nodeType === 3 /* NODE_TYPE.TextNode */) {
1065
1931
  childNode['s-sfc'] = childNode.textContent;
1066
1932
  }
1067
- // return node could have been null
1068
- if (childNode) {
1933
+ // make sure a node was created
1934
+ // and we don't have a node already present
1935
+ // (if a node is already attached, we'll just patch it)
1936
+ if (childNode && (!oldParentVNode || !oldParentVNode.$children$)) {
1069
1937
  // append our new node
1070
- containerElm.__appendChild ? containerElm.__appendChild(childNode) : containerElm.appendChild(childNode);
1938
+ containerElm.appendChild(childNode);
1071
1939
  }
1072
1940
  }
1073
1941
  }
1942
+ if (oldParentVNode && oldParentVNode.$children$)
1943
+ patch(oldParentVNode, newVNode);
1074
1944
  }
1075
1945
  // check if we've got an old vnode for this slot
1076
1946
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
@@ -1437,7 +2307,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
1437
2307
  fbSlotsIdx = fbSlots.length - 1;
1438
2308
  for (i = 0; i <= fbSlotsIdx; ++i) {
1439
2309
  fbSlot = fbSlots[i];
1440
- if (!fbNodes[fbSlot['s-sn']])
2310
+ if (typeof fbNodes[fbSlot['s-sn']] === 'undefined')
1441
2311
  continue;
1442
2312
  fbNodesIdx = fbNodes[fbSlot['s-sn']].length - 1;
1443
2313
  for (j = 0; j <= fbNodesIdx; ++j) {
@@ -1698,13 +2568,14 @@ const renderVdom = (hostRef, renderFnResults) => {
1698
2568
  // by default we're just going to insert it directly
1699
2569
  // after the slot reference node
1700
2570
  parentNodeRef = relocateData.$slotRefNode$.parentNode;
1701
- insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
2571
+ insertBeforeNode =
2572
+ relocateData.$slotRefNode$.__nextSibling || relocateData.$slotRefNode$.nextSibling;
1702
2573
  orgLocationNode = nodeToRelocate['s-ol'];
1703
2574
  ogInsertBeforeNode = insertBeforeNode;
1704
- while ((orgLocationNode = orgLocationNode.previousSibling)) {
2575
+ while ((orgLocationNode = (orgLocationNode.__previousSibling || orgLocationNode.previousSibling))) {
1705
2576
  refNode = orgLocationNode['s-nr'];
1706
2577
  if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1707
- refNode = refNode.nextSibling;
2578
+ refNode = refNode.__nextSibling || refNode.nextSibling;
1708
2579
  if (!refNode || !refNode['s-nr']) {
1709
2580
  insertBeforeNode = refNode;
1710
2581
  break;
@@ -1712,7 +2583,7 @@ const renderVdom = (hostRef, renderFnResults) => {
1712
2583
  }
1713
2584
  }
1714
2585
  if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1715
- nodeToRelocate.nextSibling !== insertBeforeNode) {
2586
+ (nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling) !== insertBeforeNode) {
1716
2587
  // we've checked that it's worth while to relocate
1717
2588
  // since that the node to relocate
1718
2589
  // has a different next sibling or parent relocated
@@ -2250,7 +3121,22 @@ const connectedCallback = (elm) => {
2250
3121
  if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
2251
3122
  // first time this component has connected
2252
3123
  hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
3124
+ let hostId;
2253
3125
  {
3126
+ hostId = elm.getAttribute(HYDRATE_ID);
3127
+ if (hostId) {
3128
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
3129
+ const scopeId = addStyle(elm.shadowRoot, cmpMeta);
3130
+ elm.classList.remove(scopeId + '-h', scopeId + '-s');
3131
+ }
3132
+ else if (cmpMeta.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
3133
+ let scopeId = getScopeId(cmpMeta);
3134
+ elm['s-sc'] = scopeId;
3135
+ }
3136
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
3137
+ }
3138
+ }
3139
+ if (!hostId) {
2254
3140
  // initUpdate
2255
3141
  // if the slot polyfill is required we'll need to put some nodes
2256
3142
  // in here to act as original content anchors as we move nodes around
@@ -2266,7 +3152,10 @@ const connectedCallback = (elm) => {
2266
3152
  while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
2267
3153
  // climb up the ancestors looking for the first
2268
3154
  // component that hasn't finished its lifecycle update yet
2269
- if (ancestorComponent['s-p']) {
3155
+ if ((ancestorComponent.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
3156
+ ancestorComponent.hasAttribute('s-id') &&
3157
+ ancestorComponent['s-p']) ||
3158
+ ancestorComponent['s-p']) {
2270
3159
  // we found this components first ancestor component
2271
3160
  // keep a reference to this component's ancestor component
2272
3161
  attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
@@ -2330,6 +3219,7 @@ const disconnectedCallback = (elm) => {
2330
3219
  }
2331
3220
  };
2332
3221
  const bootstrapLazy = (lazyBundles, options = {}) => {
3222
+ var _a;
2333
3223
  const endBootstrap = createTime();
2334
3224
  const cmpTags = [];
2335
3225
  const exclude = options.exclude || [];
@@ -2338,10 +3228,16 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2338
3228
  const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
2339
3229
  const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
2340
3230
  const deferredConnectedCallbacks = [];
3231
+ const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2341
3232
  let appLoadFallback;
2342
3233
  let isBootstrapping = true;
2343
3234
  Object.assign(plt, options);
2344
3235
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
3236
+ {
3237
+ // If the app is already hydrated there is not point to disable the
3238
+ // async queue. This will improve the first input delay
3239
+ plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
3240
+ }
2345
3241
  lazyBundles.map((lazyBundle) => {
2346
3242
  lazyBundle[1].map((compactMeta) => {
2347
3243
  const cmpMeta = {
@@ -2371,6 +3267,18 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2371
3267
  // @ts-ignore
2372
3268
  super(self);
2373
3269
  self = this;
3270
+ {
3271
+ const scopeId = getScopeId(cmpMeta, computeMode(self));
3272
+ const style = Array.from(styles).find((style) => style.getAttribute(HYDRATED_STYLE_ID) === scopeId);
3273
+ if (style) {
3274
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
3275
+ registerStyle(scopeId, convertScopedToShadow(style.innerHTML), true);
3276
+ }
3277
+ else {
3278
+ registerStyle(scopeId, style.innerHTML, false);
3279
+ }
3280
+ }
3281
+ }
2374
3282
  registerHost(self, cmpMeta);
2375
3283
  if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2376
3284
  // this component is using shadow dom
@@ -2421,6 +3329,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2421
3329
  {
2422
3330
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
2423
3331
  visibilityStyle.setAttribute('data-styles', '');
3332
+ // Apply CSP nonce to the style tag if it exists
3333
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
3334
+ if (nonce != null) {
3335
+ visibilityStyle.setAttribute('nonce', nonce);
3336
+ }
2424
3337
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
2425
3338
  }
2426
3339
  // Process deferred connectedCallbacks now all components have been registered
@@ -2473,6 +3386,13 @@ const getHostListenerTarget = (elm, flags) => {
2473
3386
  };
2474
3387
  // prettier-ignore
2475
3388
  const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
3389
+ /**
3390
+ * Assigns the given value to the nonce property on the runtime platform object.
3391
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
3392
+ * @param nonce The value to be assigned to the platform nonce property.
3393
+ * @returns void
3394
+ */
3395
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
2476
3396
  const hostRefs = /*@__PURE__*/ new WeakMap();
2477
3397
  const getHostRef = (ref) => hostRefs.get(ref);
2478
3398
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -2698,6 +3618,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2698
3618
  });
2699
3619
  };
2700
3620
  const styles = /*@__PURE__*/ new Map();
3621
+ const modeResolutionChain = [];
2701
3622
  const win = typeof window !== 'undefined' ? window : {};
2702
3623
  const doc = win.document || { head: {} };
2703
3624
  const H = (win.HTMLElement || class {
@@ -2765,6 +3686,6 @@ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
2765
3686
  const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
2766
3687
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2767
3688
 
2768
- export { Build as B, Fragment as F, H, Host as a, bootstrapLazy as b, createEvent as c, readTask as d, getRenderingRef as e, forceUpdate as f, getElement as g, h, getAssetPath as i, consoleError as j, promiseResolve as p, registerInstance as r, writeTask as w };
3689
+ export { Build as B, Fragment as F, H, Host as a, bootstrapLazy as b, createEvent as c, readTask as d, getRenderingRef as e, forceUpdate as f, getElement as g, h, getAssetPath as i, consoleError as j, promiseResolve as p, registerInstance as r, setNonce as s, writeTask as w };
2769
3690
 
2770
- //# sourceMappingURL=index-3c280603.js.map
3691
+ //# sourceMappingURL=index-b4e277ad.js.map