@nanoporetech-digital/components 3.7.0 → 3.8.0

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