@hina-ui/vue 1.7.4 → 1.7.6

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 (536) hide show
  1. package/README.md +37 -0
  2. package/dist/index.js +2251 -992
  3. package/dist/index.js.map +1 -1
  4. package/dist/shared/behavior/anchor-follow.ts +95 -0
  5. package/dist/shared/behavior/form.ts +187 -0
  6. package/dist/shared/behavior/ripple.ts +222 -0
  7. package/dist/shared/behavior/spoiler/painter.ts +197 -0
  8. package/dist/shared/behavior/spoiler/worklet.ts +199 -0
  9. package/dist/shared/behavior/toast.ts +243 -0
  10. package/dist/shared/lib/anchor.ts +83 -0
  11. package/dist/shared/lib/banner.ts +10 -0
  12. package/dist/shared/lib/calendar/format.ts +23 -0
  13. package/dist/shared/lib/caret.ts +48 -0
  14. package/dist/shared/lib/collapse.ts +29 -0
  15. package/dist/shared/lib/command-palette/hotkey.ts +27 -0
  16. package/dist/shared/lib/command-palette/match.ts +92 -0
  17. package/dist/shared/lib/data-list.ts +40 -0
  18. package/dist/shared/lib/data-table/column-sizing-styles.ts +41 -0
  19. package/dist/shared/lib/data-table/column-sizing.ts +101 -0
  20. package/dist/shared/lib/data-table/csv.ts +51 -0
  21. package/dist/shared/lib/data-table/layout.ts +199 -0
  22. package/dist/shared/lib/data-table/resize.ts +66 -0
  23. package/dist/shared/lib/data-table/state.ts +226 -0
  24. package/dist/shared/lib/data-table/utils.ts +80 -0
  25. package/dist/shared/lib/date-range-field/validity.ts +21 -0
  26. package/dist/shared/lib/date.ts +111 -0
  27. package/dist/shared/lib/field-focus.ts +36 -0
  28. package/dist/shared/lib/file-upload/select.ts +58 -0
  29. package/dist/shared/lib/file-upload/size.ts +16 -0
  30. package/dist/shared/lib/form/errors.ts +48 -0
  31. package/dist/shared/lib/form/focus.ts +10 -0
  32. package/dist/shared/lib/form/standard-schema.ts +26 -0
  33. package/dist/shared/lib/form/values.ts +23 -0
  34. package/dist/shared/lib/highlighter.ts +98 -0
  35. package/dist/shared/lib/iris-origin.ts +40 -0
  36. package/dist/shared/lib/lightbox/clip.ts +117 -0
  37. package/dist/shared/lib/lightbox/download.ts +29 -0
  38. package/dist/shared/lib/lightbox/gesture.ts +54 -0
  39. package/dist/shared/lib/lightbox/paging.ts +33 -0
  40. package/dist/shared/lib/lightbox/pose.ts +142 -0
  41. package/dist/shared/lib/lightbox/source.ts +17 -0
  42. package/dist/shared/lib/lightbox/types.ts +14 -0
  43. package/dist/shared/lib/lightbox/zoom.ts +127 -0
  44. package/dist/shared/lib/meter-group.ts +16 -0
  45. package/dist/shared/lib/overlay-anchor.ts +42 -0
  46. package/dist/shared/lib/pagination.ts +16 -0
  47. package/dist/shared/lib/pointer-corridor.ts +26 -0
  48. package/dist/shared/lib/qr-code-export.ts +68 -0
  49. package/dist/shared/lib/range-calendar/limit.ts +11 -0
  50. package/dist/shared/lib/rating.ts +4 -0
  51. package/dist/shared/lib/relative-time.ts +20 -0
  52. package/dist/shared/lib/scroll-area.ts +77 -0
  53. package/dist/shared/lib/scroll-restore.ts +148 -0
  54. package/dist/shared/lib/toast-layout.ts +42 -0
  55. package/dist/shared/lib/tree/selection.ts +131 -0
  56. package/dist/shared/lib/tree-select/filter.ts +19 -0
  57. package/dist/shared/lib/virtual/choices.ts +193 -0
  58. package/dist/shared/lib/virtual/collection.ts +71 -0
  59. package/dist/shared/lib/virtual/filter.ts +26 -0
  60. package/dist/shared/lib/virtual/flow.ts +32 -0
  61. package/dist/shared/lib/virtual/list.ts +63 -0
  62. package/dist/shared/lib/virtual/navigation.ts +26 -0
  63. package/dist/shared/lib/virtual/tree.ts +98 -0
  64. package/dist/shared/locale/en-US.ts +220 -0
  65. package/dist/shared/locale/index.ts +52 -0
  66. package/dist/shared/locale/types.ts +225 -0
  67. package/dist/shared/locale/zh-CN.ts +215 -0
  68. package/dist/shared/primitives/number-field/LICENSE +21 -0
  69. package/dist/shared/primitives/number-field/index.ts +407 -0
  70. package/dist/shared/styles/semantic.css +10 -2
  71. package/dist/shared/types/autocomplete.ts +16 -0
  72. package/dist/shared/types/data-table.ts +170 -0
  73. package/dist/shared/types/pagination.ts +19 -0
  74. package/dist/shared/types/select.ts +23 -0
  75. package/dist/shared/types/tree-select.ts +34 -0
  76. package/dist/shared/types/tree.ts +20 -0
  77. package/dist/types/shared/src/behavior/anchor-follow.d.ts +13 -0
  78. package/dist/types/shared/src/behavior/anchor-follow.d.ts.map +1 -0
  79. package/dist/types/shared/src/behavior/form.d.ts +24 -0
  80. package/dist/types/shared/src/behavior/form.d.ts.map +1 -0
  81. package/dist/types/shared/src/behavior/ripple.d.ts +11 -0
  82. package/dist/types/shared/src/behavior/ripple.d.ts.map +1 -0
  83. package/dist/types/shared/src/behavior/spoiler/painter.d.ts +35 -0
  84. package/dist/types/shared/src/behavior/spoiler/painter.d.ts.map +1 -0
  85. package/dist/types/shared/src/behavior/spoiler/worklet.d.ts +2 -0
  86. package/dist/types/shared/src/behavior/spoiler/worklet.d.ts.map +1 -0
  87. package/dist/types/shared/src/behavior/toast.d.ts +72 -0
  88. package/dist/types/shared/src/behavior/toast.d.ts.map +1 -0
  89. package/dist/types/shared/src/lib/anchor.d.ts +31 -0
  90. package/dist/types/shared/src/lib/anchor.d.ts.map +1 -0
  91. package/dist/types/shared/src/lib/banner.d.ts +3 -0
  92. package/dist/types/shared/src/lib/banner.d.ts.map +1 -0
  93. package/dist/types/shared/src/lib/calendar/format.d.ts +7 -0
  94. package/dist/types/shared/src/lib/calendar/format.d.ts.map +1 -0
  95. package/dist/types/shared/src/lib/caret.d.ts +2 -0
  96. package/dist/types/shared/src/lib/caret.d.ts.map +1 -0
  97. package/dist/types/shared/src/lib/collapse.d.ts +9 -0
  98. package/dist/types/shared/src/lib/collapse.d.ts.map +1 -0
  99. package/dist/types/shared/src/lib/command-palette/hotkey.d.ts +9 -0
  100. package/dist/types/shared/src/lib/command-palette/hotkey.d.ts.map +1 -0
  101. package/dist/types/shared/src/lib/command-palette/match.d.ts +21 -0
  102. package/dist/types/shared/src/lib/command-palette/match.d.ts.map +1 -0
  103. package/dist/types/shared/src/lib/data-list.d.ts +7 -0
  104. package/dist/types/shared/src/lib/data-list.d.ts.map +1 -0
  105. package/dist/types/shared/src/lib/data-table/column-sizing-styles.d.ts +8 -0
  106. package/dist/types/shared/src/lib/data-table/column-sizing-styles.d.ts.map +1 -0
  107. package/dist/types/shared/src/lib/data-table/column-sizing.d.ts +22 -0
  108. package/dist/types/shared/src/lib/data-table/column-sizing.d.ts.map +1 -0
  109. package/dist/types/shared/src/lib/data-table/csv.d.ts +5 -0
  110. package/dist/types/shared/src/lib/data-table/csv.d.ts.map +1 -0
  111. package/dist/types/shared/src/lib/data-table/layout.d.ts +28 -0
  112. package/dist/types/shared/src/lib/data-table/layout.d.ts.map +1 -0
  113. package/dist/types/shared/src/lib/data-table/resize.d.ts +15 -0
  114. package/dist/types/shared/src/lib/data-table/resize.d.ts.map +1 -0
  115. package/dist/types/shared/src/lib/data-table/state.d.ts +103 -0
  116. package/dist/types/shared/src/lib/data-table/state.d.ts.map +1 -0
  117. package/dist/types/shared/src/lib/data-table/utils.d.ts +11 -0
  118. package/dist/types/shared/src/lib/data-table/utils.d.ts.map +1 -0
  119. package/dist/types/shared/src/lib/date-range-field/validity.d.ts +12 -0
  120. package/dist/types/shared/src/lib/date-range-field/validity.d.ts.map +1 -0
  121. package/dist/types/shared/src/lib/date.d.ts +28 -0
  122. package/dist/types/shared/src/lib/date.d.ts.map +1 -0
  123. package/dist/types/shared/src/lib/field-focus.d.ts +2 -0
  124. package/dist/types/shared/src/lib/field-focus.d.ts.map +1 -0
  125. package/dist/types/shared/src/lib/file-upload/select.d.ts +17 -0
  126. package/dist/types/shared/src/lib/file-upload/select.d.ts.map +1 -0
  127. package/dist/types/shared/src/lib/file-upload/size.d.ts +2 -0
  128. package/dist/types/shared/src/lib/file-upload/size.d.ts.map +1 -0
  129. package/dist/types/shared/src/lib/form/errors.d.ts +7 -0
  130. package/dist/types/shared/src/lib/form/errors.d.ts.map +1 -0
  131. package/dist/types/shared/src/lib/form/focus.d.ts +2 -0
  132. package/dist/types/shared/src/lib/form/focus.d.ts.map +1 -0
  133. package/dist/types/shared/src/lib/form/standard-schema.d.ts +23 -0
  134. package/dist/types/shared/src/lib/form/standard-schema.d.ts.map +1 -0
  135. package/dist/types/shared/src/lib/form/values.d.ts +3 -0
  136. package/dist/types/shared/src/lib/form/values.d.ts.map +1 -0
  137. package/dist/types/shared/src/lib/highlighter.d.ts +4 -0
  138. package/dist/types/shared/src/lib/highlighter.d.ts.map +1 -0
  139. package/dist/types/shared/src/lib/iris-origin.d.ts +6 -0
  140. package/dist/types/shared/src/lib/iris-origin.d.ts.map +1 -0
  141. package/dist/types/shared/src/lib/lightbox/clip.d.ts +16 -0
  142. package/dist/types/shared/src/lib/lightbox/clip.d.ts.map +1 -0
  143. package/dist/types/shared/src/lib/lightbox/download.d.ts +3 -0
  144. package/dist/types/shared/src/lib/lightbox/download.d.ts.map +1 -0
  145. package/dist/types/shared/src/lib/lightbox/gesture.d.ts +26 -0
  146. package/dist/types/shared/src/lib/lightbox/gesture.d.ts.map +1 -0
  147. package/dist/types/shared/src/lib/lightbox/paging.d.ts +9 -0
  148. package/dist/types/shared/src/lib/lightbox/paging.d.ts.map +1 -0
  149. package/dist/types/shared/src/lib/lightbox/pose.d.ts +38 -0
  150. package/dist/types/shared/src/lib/lightbox/pose.d.ts.map +1 -0
  151. package/dist/types/shared/src/lib/lightbox/source.d.ts +4 -0
  152. package/dist/types/shared/src/lib/lightbox/source.d.ts.map +1 -0
  153. package/dist/types/shared/src/lib/lightbox/types.d.ts +16 -0
  154. package/dist/types/shared/src/lib/lightbox/types.d.ts.map +1 -0
  155. package/dist/types/shared/src/lib/lightbox/zoom.d.ts +40 -0
  156. package/dist/types/shared/src/lib/lightbox/zoom.d.ts.map +1 -0
  157. package/dist/types/shared/src/lib/meter-group.d.ts +5 -0
  158. package/dist/types/shared/src/lib/meter-group.d.ts.map +1 -0
  159. package/dist/types/shared/src/lib/overlay-anchor.d.ts +10 -0
  160. package/dist/types/shared/src/lib/overlay-anchor.d.ts.map +1 -0
  161. package/dist/types/shared/src/lib/pagination.d.ts +4 -0
  162. package/dist/types/shared/src/lib/pagination.d.ts.map +1 -0
  163. package/dist/types/shared/src/lib/pointer-corridor.d.ts +7 -0
  164. package/dist/types/shared/src/lib/pointer-corridor.d.ts.map +1 -0
  165. package/dist/types/shared/src/lib/qr-code-export.d.ts +6 -0
  166. package/dist/types/shared/src/lib/qr-code-export.d.ts.map +1 -0
  167. package/dist/types/shared/src/lib/range-calendar/limit.d.ts +3 -0
  168. package/dist/types/shared/src/lib/range-calendar/limit.d.ts.map +1 -0
  169. package/dist/types/shared/src/lib/rating.d.ts +2 -0
  170. package/dist/types/shared/src/lib/rating.d.ts.map +1 -0
  171. package/dist/types/shared/src/lib/relative-time.d.ts +2 -0
  172. package/dist/types/shared/src/lib/relative-time.d.ts.map +1 -0
  173. package/dist/types/shared/src/lib/scroll-area.d.ts +50 -0
  174. package/dist/types/shared/src/lib/scroll-area.d.ts.map +1 -0
  175. package/dist/types/shared/src/lib/scroll-restore.d.ts +34 -0
  176. package/dist/types/shared/src/lib/scroll-restore.d.ts.map +1 -0
  177. package/dist/types/shared/src/lib/toast-layout.d.ts +13 -0
  178. package/dist/types/shared/src/lib/toast-layout.d.ts.map +1 -0
  179. package/dist/types/shared/src/lib/tree/selection.d.ts +23 -0
  180. package/dist/types/shared/src/lib/tree/selection.d.ts.map +1 -0
  181. package/dist/types/shared/src/lib/tree-select/filter.d.ts +7 -0
  182. package/dist/types/shared/src/lib/tree-select/filter.d.ts.map +1 -0
  183. package/dist/types/shared/src/lib/virtual/choices.d.ts +59 -0
  184. package/dist/types/shared/src/lib/virtual/choices.d.ts.map +1 -0
  185. package/dist/types/shared/src/lib/virtual/collection.d.ts +25 -0
  186. package/dist/types/shared/src/lib/virtual/collection.d.ts.map +1 -0
  187. package/dist/types/shared/src/lib/virtual/flow.d.ts +18 -0
  188. package/dist/types/shared/src/lib/virtual/flow.d.ts.map +1 -0
  189. package/dist/types/shared/src/lib/virtual/list.d.ts +46 -0
  190. package/dist/types/shared/src/lib/virtual/list.d.ts.map +1 -0
  191. package/dist/types/shared/src/lib/virtual/navigation.d.ts +3 -0
  192. package/dist/types/shared/src/lib/virtual/navigation.d.ts.map +1 -0
  193. package/dist/types/shared/src/lib/virtual/tree.d.ts +31 -0
  194. package/dist/types/shared/src/lib/virtual/tree.d.ts.map +1 -0
  195. package/dist/types/shared/src/locale/en-US.d.ts +3 -0
  196. package/dist/types/shared/src/locale/en-US.d.ts.map +1 -0
  197. package/dist/types/shared/src/locale/index.d.ts +6 -0
  198. package/dist/types/shared/src/locale/index.d.ts.map +1 -0
  199. package/dist/types/shared/src/locale/types.d.ts +235 -0
  200. package/dist/types/shared/src/locale/types.d.ts.map +1 -0
  201. package/dist/types/shared/src/locale/zh-CN.d.ts +3 -0
  202. package/dist/types/shared/src/locale/zh-CN.d.ts.map +1 -0
  203. package/dist/types/shared/src/primitives/number-field/index.d.ts +155 -0
  204. package/dist/types/shared/src/primitives/number-field/index.d.ts.map +1 -0
  205. package/dist/types/shared/src/types/autocomplete.d.ts +14 -0
  206. package/dist/types/shared/src/types/autocomplete.d.ts.map +1 -0
  207. package/dist/types/shared/src/types/data-table.d.ts +169 -0
  208. package/dist/types/shared/src/types/data-table.d.ts.map +1 -0
  209. package/dist/types/shared/src/types/pagination.d.ts +23 -0
  210. package/dist/types/shared/src/types/pagination.d.ts.map +1 -0
  211. package/dist/types/shared/src/types/select.d.ts +14 -0
  212. package/dist/types/shared/src/types/select.d.ts.map +1 -0
  213. package/dist/types/shared/src/types/tree-select.d.ts +10 -0
  214. package/dist/types/shared/src/types/tree-select.d.ts.map +1 -0
  215. package/dist/types/shared/src/types/tree.d.ts +18 -0
  216. package/dist/types/shared/src/types/tree.d.ts.map +1 -0
  217. package/dist/types/shared/src/variants/autocomplete.d.ts +3 -0
  218. package/dist/types/shared/src/variants/autocomplete.d.ts.map +1 -0
  219. package/dist/types/shared/src/variants/editable.d.ts +52 -0
  220. package/dist/types/shared/src/variants/editable.d.ts.map +1 -0
  221. package/dist/types/shared/src/variants/float-button.d.ts +74 -0
  222. package/dist/types/shared/src/variants/float-button.d.ts.map +1 -0
  223. package/dist/types/shared/src/variants/split-button.d.ts +18 -0
  224. package/dist/types/shared/src/variants/split-button.d.ts.map +1 -0
  225. package/dist/types/vue/src/components/accordion/AccordionTrigger.vue.d.ts.map +1 -1
  226. package/dist/types/vue/src/components/anchor/Anchor.vue.d.ts.map +1 -1
  227. package/dist/types/vue/src/components/anchor/composables/useAnchor.d.ts +2 -7
  228. package/dist/types/vue/src/components/anchor/composables/useAnchor.d.ts.map +1 -1
  229. package/dist/types/vue/src/components/anchor/composables/useAnchorFollow.d.ts +1 -1
  230. package/dist/types/vue/src/components/anchor/composables/useAnchorFollow.d.ts.map +1 -1
  231. package/dist/types/vue/src/components/anchor/composables/useScrollSpy.d.ts +2 -5
  232. package/dist/types/vue/src/components/anchor/composables/useScrollSpy.d.ts.map +1 -1
  233. package/dist/types/vue/src/components/anchor/types.d.ts +1 -8
  234. package/dist/types/vue/src/components/anchor/types.d.ts.map +1 -1
  235. package/dist/types/vue/src/components/autocomplete/autocomplete.variants.d.ts +1 -1
  236. package/dist/types/vue/src/components/autocomplete/autocomplete.variants.d.ts.map +1 -1
  237. package/dist/types/vue/src/components/autocomplete/types.d.ts +1 -13
  238. package/dist/types/vue/src/components/autocomplete/types.d.ts.map +1 -1
  239. package/dist/types/vue/src/components/banner/utils/direction.d.ts +1 -2
  240. package/dist/types/vue/src/components/banner/utils/direction.d.ts.map +1 -1
  241. package/dist/types/vue/src/components/calendar/utils/format.d.ts +1 -6
  242. package/dist/types/vue/src/components/calendar/utils/format.d.ts.map +1 -1
  243. package/dist/types/vue/src/components/code-block/highlighter.d.ts +1 -3
  244. package/dist/types/vue/src/components/code-block/highlighter.d.ts.map +1 -1
  245. package/dist/types/vue/src/components/collapsible/CollapsibleTrigger.vue.d.ts.map +1 -1
  246. package/dist/types/vue/src/components/command-palette/composables/useCommandItems.d.ts +1 -1
  247. package/dist/types/vue/src/components/command-palette/utils/hotkey.d.ts +1 -8
  248. package/dist/types/vue/src/components/command-palette/utils/hotkey.d.ts.map +1 -1
  249. package/dist/types/vue/src/components/command-palette/utils/match.d.ts +5 -12
  250. package/dist/types/vue/src/components/command-palette/utils/match.d.ts.map +1 -1
  251. package/dist/types/vue/src/components/data-list/composables/useDataList.d.ts.map +1 -1
  252. package/dist/types/vue/src/components/data-list/utils/scroll.d.ts +1 -2
  253. package/dist/types/vue/src/components/data-list/utils/scroll.d.ts.map +1 -1
  254. package/dist/types/vue/src/components/data-table/column-sizing-styles.d.ts +1 -3
  255. package/dist/types/vue/src/components/data-table/column-sizing-styles.d.ts.map +1 -1
  256. package/dist/types/vue/src/components/data-table/column-sizing.d.ts +1 -21
  257. package/dist/types/vue/src/components/data-table/column-sizing.d.ts.map +1 -1
  258. package/dist/types/vue/src/components/data-table/composables/useDataTable.d.ts.map +1 -1
  259. package/dist/types/vue/src/components/data-table/composables/useTableColumns.d.ts.map +1 -1
  260. package/dist/types/vue/src/components/data-table/composables/useTableDrag.d.ts.map +1 -1
  261. package/dist/types/vue/src/components/data-table/composables/useTableExport.d.ts.map +1 -1
  262. package/dist/types/vue/src/components/data-table/composables/useTableResize.d.ts.map +1 -1
  263. package/dist/types/vue/src/components/data-table/composables/useTableResizeHandles.d.ts.map +1 -1
  264. package/dist/types/vue/src/components/data-table/composables/useTableVirtual.d.ts.map +1 -1
  265. package/dist/types/vue/src/components/data-table/types.d.ts +3 -153
  266. package/dist/types/vue/src/components/data-table/types.d.ts.map +1 -1
  267. package/dist/types/vue/src/components/data-table/utils.d.ts +1 -9
  268. package/dist/types/vue/src/components/data-table/utils.d.ts.map +1 -1
  269. package/dist/types/vue/src/components/date-range-field/utils/validity.d.ts +1 -11
  270. package/dist/types/vue/src/components/date-range-field/utils/validity.d.ts.map +1 -1
  271. package/dist/types/vue/src/components/editable/editable.variants.d.ts +1 -1
  272. package/dist/types/vue/src/components/editable/editable.variants.d.ts.map +1 -1
  273. package/dist/types/vue/src/components/file-upload/utils/select.d.ts +1 -16
  274. package/dist/types/vue/src/components/file-upload/utils/select.d.ts.map +1 -1
  275. package/dist/types/vue/src/components/file-upload/utils/size.d.ts +1 -1
  276. package/dist/types/vue/src/components/file-upload/utils/size.d.ts.map +1 -1
  277. package/dist/types/vue/src/components/float-button/float-button.variants.d.ts +1 -1
  278. package/dist/types/vue/src/components/float-button/float-button.variants.d.ts.map +1 -1
  279. package/dist/types/vue/src/components/form/Form.vue.d.ts +1 -1
  280. package/dist/types/vue/src/components/form/composables/useForm.d.ts +9 -15
  281. package/dist/types/vue/src/components/form/composables/useForm.d.ts.map +1 -1
  282. package/dist/types/vue/src/components/form/standard-schema.d.ts +1 -22
  283. package/dist/types/vue/src/components/form/standard-schema.d.ts.map +1 -1
  284. package/dist/types/vue/src/components/form/utils/errors.d.ts +1 -6
  285. package/dist/types/vue/src/components/form/utils/errors.d.ts.map +1 -1
  286. package/dist/types/vue/src/components/form/utils/focus.d.ts +1 -1
  287. package/dist/types/vue/src/components/form/utils/focus.d.ts.map +1 -1
  288. package/dist/types/vue/src/components/form/utils/values.d.ts +1 -2
  289. package/dist/types/vue/src/components/form/utils/values.d.ts.map +1 -1
  290. package/dist/types/vue/src/components/form-field/FormField.vue.d.ts.map +1 -1
  291. package/dist/types/vue/src/components/lightbox/composables/useLightboxHint.d.ts.map +1 -1
  292. package/dist/types/vue/src/components/lightbox/types.d.ts +1 -15
  293. package/dist/types/vue/src/components/lightbox/types.d.ts.map +1 -1
  294. package/dist/types/vue/src/components/lightbox/utils/clip.d.ts +1 -15
  295. package/dist/types/vue/src/components/lightbox/utils/clip.d.ts.map +1 -1
  296. package/dist/types/vue/src/components/lightbox/utils/download.d.ts +1 -2
  297. package/dist/types/vue/src/components/lightbox/utils/download.d.ts.map +1 -1
  298. package/dist/types/vue/src/components/lightbox/utils/gesture.d.ts +1 -25
  299. package/dist/types/vue/src/components/lightbox/utils/gesture.d.ts.map +1 -1
  300. package/dist/types/vue/src/components/lightbox/utils/paging.d.ts +1 -8
  301. package/dist/types/vue/src/components/lightbox/utils/paging.d.ts.map +1 -1
  302. package/dist/types/vue/src/components/lightbox/utils/pose.d.ts +1 -37
  303. package/dist/types/vue/src/components/lightbox/utils/pose.d.ts.map +1 -1
  304. package/dist/types/vue/src/components/lightbox/utils/source.d.ts +1 -3
  305. package/dist/types/vue/src/components/lightbox/utils/source.d.ts.map +1 -1
  306. package/dist/types/vue/src/components/lightbox/utils/zoom.d.ts +1 -39
  307. package/dist/types/vue/src/components/lightbox/utils/zoom.d.ts.map +1 -1
  308. package/dist/types/vue/src/components/meter-group/utils/tones.d.ts +1 -3
  309. package/dist/types/vue/src/components/meter-group/utils/tones.d.ts.map +1 -1
  310. package/dist/types/vue/src/components/month-grid/MonthGrid.vue.d.ts +1 -1
  311. package/dist/types/vue/src/components/multi-select/MultiSelect.vue.d.ts.map +1 -1
  312. package/dist/types/vue/src/components/pagination/composables/usePagination.d.ts +2 -2
  313. package/dist/types/vue/src/components/pagination/composables/usePagination.d.ts.map +1 -1
  314. package/dist/types/vue/src/components/pagination/types.d.ts +1 -22
  315. package/dist/types/vue/src/components/pagination/types.d.ts.map +1 -1
  316. package/dist/types/vue/src/components/pagination/utils/ranges.d.ts +1 -2
  317. package/dist/types/vue/src/components/pagination/utils/ranges.d.ts.map +1 -1
  318. package/dist/types/vue/src/components/password-input/PasswordInput.vue.d.ts +4 -1
  319. package/dist/types/vue/src/components/password-input/PasswordInput.vue.d.ts.map +1 -1
  320. package/dist/types/vue/src/components/prev-next/PrevNextLink.vue.d.ts.map +1 -1
  321. package/dist/types/vue/src/components/qr-code/export.d.ts +1 -2
  322. package/dist/types/vue/src/components/qr-code/export.d.ts.map +1 -1
  323. package/dist/types/vue/src/components/range-calendar/utils/limit.d.ts +1 -2
  324. package/dist/types/vue/src/components/range-calendar/utils/limit.d.ts.map +1 -1
  325. package/dist/types/vue/src/components/range-slider/RangeSlider.vue.d.ts +2 -2
  326. package/dist/types/vue/src/components/rating/utils/fill.d.ts +1 -1
  327. package/dist/types/vue/src/components/rating/utils/fill.d.ts.map +1 -1
  328. package/dist/types/vue/src/components/ripple/useRipple.d.ts.map +1 -1
  329. package/dist/types/vue/src/components/scroll-area/ScrollArea.vue.d.ts.map +1 -1
  330. package/dist/types/vue/src/components/scroll-area/composables/useEdgeShadow.d.ts +2 -1
  331. package/dist/types/vue/src/components/scroll-area/composables/useEdgeShadow.d.ts.map +1 -1
  332. package/dist/types/vue/src/components/scroll-area/composables/useLayerLock.d.ts.map +1 -1
  333. package/dist/types/vue/src/components/scroll-area/composables/useWheelRedirect.d.ts.map +1 -1
  334. package/dist/types/vue/src/components/scroll-area/scroll-restore.d.ts +1 -33
  335. package/dist/types/vue/src/components/scroll-area/scroll-restore.d.ts.map +1 -1
  336. package/dist/types/vue/src/components/search-input/SearchInput.vue.d.ts +4 -1
  337. package/dist/types/vue/src/components/search-input/SearchInput.vue.d.ts.map +1 -1
  338. package/dist/types/vue/src/components/select/types.d.ts +1 -13
  339. package/dist/types/vue/src/components/select/types.d.ts.map +1 -1
  340. package/dist/types/vue/src/components/slider/Slider.vue.d.ts +2 -2
  341. package/dist/types/vue/src/components/split-button/split-button.variants.d.ts +1 -1
  342. package/dist/types/vue/src/components/split-button/split-button.variants.d.ts.map +1 -1
  343. package/dist/types/vue/src/components/spoiler/SpoilerPainter.d.ts +1 -34
  344. package/dist/types/vue/src/components/spoiler/SpoilerPainter.d.ts.map +1 -1
  345. package/dist/types/vue/src/components/spoiler/utils/irisOrigin.d.ts +1 -5
  346. package/dist/types/vue/src/components/spoiler/utils/irisOrigin.d.ts.map +1 -1
  347. package/dist/types/vue/src/components/spoiler/worklet.d.ts +1 -1
  348. package/dist/types/vue/src/components/spoiler/worklet.d.ts.map +1 -1
  349. package/dist/types/vue/src/components/table/Table.vue.d.ts +6 -3
  350. package/dist/types/vue/src/components/table/Table.vue.d.ts.map +1 -1
  351. package/dist/types/vue/src/components/tabs/TabsList.vue.d.ts +6 -3
  352. package/dist/types/vue/src/components/tabs/TabsList.vue.d.ts.map +1 -1
  353. package/dist/types/vue/src/components/time/utils/relativeTime.d.ts +1 -1
  354. package/dist/types/vue/src/components/time/utils/relativeTime.d.ts.map +1 -1
  355. package/dist/types/vue/src/components/toast/composables/useToastLayout.d.ts +4 -11
  356. package/dist/types/vue/src/components/toast/composables/useToastLayout.d.ts.map +1 -1
  357. package/dist/types/vue/src/components/toast/store.d.ts +14 -62
  358. package/dist/types/vue/src/components/toast/store.d.ts.map +1 -1
  359. package/dist/types/vue/src/components/tree/composables/useTree.d.ts.map +1 -1
  360. package/dist/types/vue/src/components/tree/types.d.ts +1 -17
  361. package/dist/types/vue/src/components/tree/types.d.ts.map +1 -1
  362. package/dist/types/vue/src/components/tree/utils/selection.d.ts +1 -15
  363. package/dist/types/vue/src/components/tree/utils/selection.d.ts.map +1 -1
  364. package/dist/types/vue/src/components/tree-select/types.d.ts +1 -9
  365. package/dist/types/vue/src/components/tree-select/types.d.ts.map +1 -1
  366. package/dist/types/vue/src/components/tree-select/utils/filterTree.d.ts +1 -6
  367. package/dist/types/vue/src/components/tree-select/utils/filterTree.d.ts.map +1 -1
  368. package/dist/types/vue/src/components/virtual-list/composables/useVirtualList.d.ts +1 -1
  369. package/dist/types/vue/src/components/virtual-list/composables/useVirtualList.d.ts.map +1 -1
  370. package/dist/types/vue/src/components/visually-hidden/VisuallyHidden.vue.d.ts +4 -1
  371. package/dist/types/vue/src/components/visually-hidden/VisuallyHidden.vue.d.ts.map +1 -1
  372. package/dist/types/vue/src/lib/caret.d.ts +1 -1
  373. package/dist/types/vue/src/lib/caret.d.ts.map +1 -1
  374. package/dist/types/vue/src/lib/collapse.d.ts +2 -8
  375. package/dist/types/vue/src/lib/collapse.d.ts.map +1 -1
  376. package/dist/types/vue/src/lib/date.d.ts +1 -27
  377. package/dist/types/vue/src/lib/date.d.ts.map +1 -1
  378. package/dist/types/vue/src/lib/field-focus.d.ts +1 -1
  379. package/dist/types/vue/src/lib/field-focus.d.ts.map +1 -1
  380. package/dist/types/vue/src/lib/overlay-anchor.d.ts +2 -7
  381. package/dist/types/vue/src/lib/overlay-anchor.d.ts.map +1 -1
  382. package/dist/types/vue/src/lib/pointer-corridor.d.ts +1 -6
  383. package/dist/types/vue/src/lib/pointer-corridor.d.ts.map +1 -1
  384. package/dist/types/vue/src/lib/reka/useVirtualChoices.d.ts +3 -11
  385. package/dist/types/vue/src/lib/reka/useVirtualChoices.d.ts.map +1 -1
  386. package/dist/types/vue/src/lib/reka/useVirtualTree.d.ts +1 -1
  387. package/dist/types/vue/src/lib/reka/useVirtualTree.d.ts.map +1 -1
  388. package/dist/types/vue/src/lib/virtual/navigation.d.ts +1 -2
  389. package/dist/types/vue/src/lib/virtual/navigation.d.ts.map +1 -1
  390. package/dist/types/vue/src/lib/virtual/useVirtualCollection.d.ts +1 -1
  391. package/dist/types/vue/src/lib/virtual/useVirtualCollection.d.ts.map +1 -1
  392. package/dist/types/vue/src/lib/virtual/useVirtualWindow.d.ts +2 -15
  393. package/dist/types/vue/src/lib/virtual/useVirtualWindow.d.ts.map +1 -1
  394. package/dist/types/vue/src/locale/en-US.d.ts +1 -2
  395. package/dist/types/vue/src/locale/en-US.d.ts.map +1 -1
  396. package/dist/types/vue/src/locale/index.d.ts +3 -4
  397. package/dist/types/vue/src/locale/index.d.ts.map +1 -1
  398. package/dist/types/vue/src/locale/types.d.ts +1 -234
  399. package/dist/types/vue/src/locale/types.d.ts.map +1 -1
  400. package/dist/types/vue/src/locale/zh-CN.d.ts +1 -2
  401. package/dist/types/vue/src/locale/zh-CN.d.ts.map +1 -1
  402. package/dist/types/vue/src/primitives/number-field/NumberFieldDecrement.vue.d.ts +17 -0
  403. package/dist/types/vue/src/primitives/number-field/NumberFieldDecrement.vue.d.ts.map +1 -0
  404. package/dist/types/vue/src/primitives/number-field/NumberFieldIncrement.vue.d.ts +17 -0
  405. package/dist/types/vue/src/primitives/number-field/NumberFieldIncrement.vue.d.ts.map +1 -0
  406. package/dist/types/vue/src/primitives/number-field/NumberFieldInput.vue.d.ts +16 -0
  407. package/dist/types/vue/src/primitives/number-field/NumberFieldInput.vue.d.ts.map +1 -0
  408. package/dist/types/vue/src/primitives/number-field/NumberFieldRoot.vue.d.ts +47 -0
  409. package/dist/types/vue/src/primitives/number-field/NumberFieldRoot.vue.d.ts.map +1 -0
  410. package/dist/types/vue/src/primitives/number-field/context.d.ts +41 -0
  411. package/dist/types/vue/src/primitives/number-field/context.d.ts.map +1 -0
  412. package/dist/types/vue/src/primitives/number-field/index.d.ts +5 -0
  413. package/dist/types/vue/src/primitives/number-field/index.d.ts.map +1 -0
  414. package/dist/types/vue/src/primitives/utils/timers.d.ts +6 -0
  415. package/dist/types/vue/src/primitives/utils/timers.d.ts.map +1 -0
  416. package/dist/types/vue/src/primitives/utils/usePrimitiveElement.d.ts +6 -0
  417. package/dist/types/vue/src/primitives/utils/usePrimitiveElement.d.ts.map +1 -0
  418. package/dist/types/vue/src/primitives/utils/useVModel.d.ts +7 -0
  419. package/dist/types/vue/src/primitives/utils/useVModel.d.ts.map +1 -0
  420. package/dist/types/vue/src/primitives/visually-hidden/VisuallyHiddenInput.d.ts +66 -0
  421. package/dist/types/vue/src/primitives/visually-hidden/VisuallyHiddenInput.d.ts.map +1 -0
  422. package/dist/types/vue/src/primitives/visually-hidden/VisuallyHiddenInputBubble.vue.d.ts +28 -0
  423. package/dist/types/vue/src/primitives/visually-hidden/VisuallyHiddenInputBubble.vue.d.ts.map +1 -0
  424. package/package.json +3 -2
  425. package/src/components/accordion/AccordionTrigger.vue +9 -1
  426. package/src/components/anchor/Anchor.vue +13 -9
  427. package/src/components/anchor/composables/useAnchor.ts +3 -12
  428. package/src/components/anchor/composables/useAnchorFollow.ts +10 -63
  429. package/src/components/anchor/composables/useScrollSpy.ts +22 -38
  430. package/src/components/anchor/types.ts +1 -8
  431. package/src/components/autocomplete/autocomplete.variants.ts +1 -1
  432. package/src/components/autocomplete/composables/useAutocomplete.ts +1 -1
  433. package/src/components/autocomplete/types.ts +1 -16
  434. package/src/components/banner/utils/direction.ts +1 -10
  435. package/src/components/calendar/utils/format.ts +1 -23
  436. package/src/components/code-block/highlighter.ts +1 -98
  437. package/src/components/collapsible/CollapsibleTrigger.vue +8 -1
  438. package/src/components/command-palette/utils/hotkey.ts +1 -27
  439. package/src/components/command-palette/utils/match.ts +5 -75
  440. package/src/components/data-list/composables/useDataList.ts +2 -4
  441. package/src/components/data-list/utils/scroll.ts +1 -26
  442. package/src/components/data-table/column-sizing-styles.ts +1 -40
  443. package/src/components/data-table/column-sizing.ts +1 -101
  444. package/src/components/data-table/composables/useDataTable.ts +103 -123
  445. package/src/components/data-table/composables/useTableColumns.ts +38 -113
  446. package/src/components/data-table/composables/useTableDrag.ts +21 -11
  447. package/src/components/data-table/composables/useTableExport.ts +8 -32
  448. package/src/components/data-table/composables/useTableResize.ts +13 -17
  449. package/src/components/data-table/composables/useTableResizeHandles.ts +6 -21
  450. package/src/components/data-table/types.ts +15 -155
  451. package/src/components/data-table/utils.ts +1 -75
  452. package/src/components/date-range-field/utils/validity.ts +1 -21
  453. package/src/components/editable/editable.variants.ts +1 -1
  454. package/src/components/file-upload/utils/select.ts +1 -58
  455. package/src/components/file-upload/utils/size.ts +1 -16
  456. package/src/components/float-button/float-button.variants.ts +1 -1
  457. package/src/components/form/composables/useForm.ts +24 -135
  458. package/src/components/form/standard-schema.ts +1 -26
  459. package/src/components/form/utils/errors.ts +1 -48
  460. package/src/components/form/utils/focus.ts +1 -10
  461. package/src/components/form/utils/values.ts +1 -23
  462. package/src/components/form-field/FormField.vue +3 -2
  463. package/src/components/lightbox/composables/useLightboxHint.ts +6 -1
  464. package/src/components/lightbox/types.ts +1 -14
  465. package/src/components/lightbox/utils/clip.ts +1 -117
  466. package/src/components/lightbox/utils/download.ts +1 -29
  467. package/src/components/lightbox/utils/gesture.ts +1 -54
  468. package/src/components/lightbox/utils/paging.ts +1 -33
  469. package/src/components/lightbox/utils/pose.ts +1 -142
  470. package/src/components/lightbox/utils/source.ts +1 -17
  471. package/src/components/lightbox/utils/zoom.ts +1 -127
  472. package/src/components/meter-group/utils/tones.ts +1 -14
  473. package/src/components/multi-select/MultiSelect.vue +1 -2
  474. package/src/components/number-input/NumberInput.vue +2 -2
  475. package/src/components/pagination/composables/usePagination.ts +2 -3
  476. package/src/components/pagination/types.ts +1 -19
  477. package/src/components/pagination/utils/ranges.ts +1 -12
  478. package/src/components/password-input/PasswordInput.vue +6 -0
  479. package/src/components/prev-next/PrevNext.vue +1 -1
  480. package/src/components/prev-next/PrevNextLink.vue +1 -1
  481. package/src/components/qr-code/export.ts +1 -65
  482. package/src/components/range-calendar/utils/limit.ts +1 -11
  483. package/src/components/rating/utils/fill.ts +1 -4
  484. package/src/components/ripple/useRipple.ts +10 -198
  485. package/src/components/scroll-area/ScrollArea.vue +6 -18
  486. package/src/components/scroll-area/composables/useEdgeShadow.ts +7 -16
  487. package/src/components/scroll-area/composables/useLayerLock.ts +2 -9
  488. package/src/components/scroll-area/composables/useWheelRedirect.ts +2 -10
  489. package/src/components/scroll-area/scroll-restore.ts +1 -148
  490. package/src/components/search-input/SearchInput.vue +6 -0
  491. package/src/components/select/types.ts +1 -23
  492. package/src/components/split-button/split-button.variants.ts +1 -1
  493. package/src/components/spoiler/SpoilerPainter.ts +1 -197
  494. package/src/components/spoiler/utils/irisOrigin.ts +1 -40
  495. package/src/components/spoiler/worklet.ts +1 -199
  496. package/src/components/table/Table.vue +9 -0
  497. package/src/components/tabs/TabsList.vue +9 -0
  498. package/src/components/time/utils/relativeTime.ts +1 -20
  499. package/src/components/toast/composables/useToastLayout.ts +12 -24
  500. package/src/components/toast/store.ts +16 -228
  501. package/src/components/tree/composables/useTree.ts +17 -33
  502. package/src/components/tree/types.ts +1 -20
  503. package/src/components/tree/utils/selection.ts +1 -78
  504. package/src/components/tree-select/types.ts +1 -34
  505. package/src/components/tree-select/utils/filterTree.ts +1 -19
  506. package/src/components/virtual-list/composables/useVirtualList.ts +16 -42
  507. package/src/components/visually-hidden/VisuallyHidden.vue +21 -3
  508. package/src/lib/caret.ts +1 -48
  509. package/src/lib/collapse.ts +6 -29
  510. package/src/lib/date.ts +1 -111
  511. package/src/lib/field-focus.ts +1 -36
  512. package/src/lib/overlay-anchor.ts +11 -37
  513. package/src/lib/pointer-corridor.ts +1 -26
  514. package/src/lib/reka/useVirtualChoices.ts +55 -133
  515. package/src/lib/reka/useVirtualTree.ts +22 -65
  516. package/src/lib/virtual/navigation.ts +1 -26
  517. package/src/lib/virtual/useVirtualCollection.ts +28 -47
  518. package/src/lib/virtual/useVirtualWindow.ts +15 -25
  519. package/src/locale/en-US.ts +1 -220
  520. package/src/locale/index.ts +9 -53
  521. package/src/locale/types.ts +1 -225
  522. package/src/locale/zh-CN.ts +1 -215
  523. package/src/primitives/number-field/LICENSE +21 -0
  524. package/src/primitives/number-field/NumberFieldDecrement.vue +21 -0
  525. package/src/primitives/number-field/NumberFieldIncrement.vue +21 -0
  526. package/src/primitives/number-field/NumberFieldInput.vue +114 -0
  527. package/src/primitives/number-field/NumberFieldRoot.vue +169 -0
  528. package/src/primitives/number-field/context.ts +111 -0
  529. package/src/primitives/number-field/index.ts +14 -0
  530. package/src/primitives/utils/LICENSE +44 -0
  531. package/src/primitives/utils/timers.ts +6 -0
  532. package/src/primitives/utils/usePrimitiveElement.ts +12 -0
  533. package/src/primitives/utils/useVModel.ts +37 -0
  534. package/src/primitives/visually-hidden/LICENSE +21 -0
  535. package/src/primitives/visually-hidden/VisuallyHiddenInput.ts +97 -0
  536. package/src/primitives/visually-hidden/VisuallyHiddenInputBubble.vue +49 -0
package/dist/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import { clsx } from "clsx";
2
2
  import { extendTailwindMerge } from "tailwind-merge";
3
3
  import { createTV } from "tailwind-variants";
4
- import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, getCurrentInstance, guardReactiveProps, h, inject, isRef, isVNode, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUpdated, openBlock, provide, reactive, ref, render, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toHandlers, toRaw, toRef, toValue, unref, useAttrs, useId, useModel, useSlots, useTemplateRef, vModelDynamic, vModelSelect, vModelText, vShow, watch, watchEffect, watchPostEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
5
- import { AccordionContent, AccordionHeader, AccordionItem, AccordionRoot, AccordionTrigger, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogOverlay, AlertDialogPortal, AlertDialogRoot, AlertDialogTitle, AlertDialogTrigger, AspectRatio, CalendarCell, CalendarCellTrigger, CalendarGrid, CalendarGridBody, CalendarGridHead, CalendarGridRow, CalendarHeadCell, CalendarNext, CalendarPrev, CalendarRoot, CheckboxGroupRoot, CheckboxRoot, CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, ComboboxAnchor, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxItemIndicator, ComboboxLabel, ComboboxPortal, ComboboxRoot, ComboboxTrigger, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuItemIndicator, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuRoot, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DateFieldInput, DateFieldRoot, DateRangeFieldInput, DateRangeFieldRoot, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemIndicator, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, HoverCardContent, HoverCardPortal, HoverCardRoot, HoverCardTrigger, ListboxContent, ListboxFilter, ListboxGroup, ListboxGroupLabel, ListboxItem, ListboxItemIndicator, ListboxRoot, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarItemIndicator, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarRoot, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MonthPickerCell, MonthPickerCellTrigger, MonthPickerGrid, MonthPickerGridBody, MonthPickerGridRow, MonthPickerNext, MonthPickerPrev, MonthPickerRoot, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuRoot, NavigationMenuTrigger, NavigationMenuViewport, NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput, NumberFieldRoot, PaginationFirst, PaginationLast, PaginationList, PaginationListItem, PaginationNext, PaginationPrev, PaginationRoot, PinInputInput, PinInputRoot, PopoverAnchor, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger, Primitive, ProgressIndicator, ProgressRoot, RadioGroupItem, RadioGroupRoot, RangeCalendarCell, RangeCalendarCellTrigger, RangeCalendarGrid, RangeCalendarGridBody, RangeCalendarGridHead, RangeCalendarGridRow, RangeCalendarHeadCell, RangeCalendarNext, RangeCalendarPrev, RangeCalendarRoot, RatingItem, RatingItemIndicator, RatingRoot, SelectContent, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectLabel, SelectPortal, SelectRoot, SelectTrigger, Separator, SliderRoot, SliderThumb, SliderTrack, SplitterGroup, SplitterPanel, SplitterResizeHandle, StepperDescription, StepperIndicator, StepperItem, StepperRoot, StepperSeparator, StepperTitle, StepperTrigger, SwitchRoot, TabsContent, TabsList, TabsRoot, TabsTrigger, TagsInputInput, TagsInputItem, TagsInputItemText, TagsInputRoot, TimeFieldInput, TimeFieldRoot, ToastClose, ToastDescription, ToastPortal, ToastProvider, ToastRoot, ToastTitle, ToastViewport, Toggle, ToggleGroupItem, ToggleGroupRoot, ToolbarButton, ToolbarRoot, ToolbarToggleGroup, ToolbarToggleItem, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger, TreeItem, TreeRoot, VisuallyHidden, YearPickerCell, YearPickerCellTrigger, YearPickerGrid, YearPickerGridBody, YearPickerGridRow, YearPickerNext, YearPickerPrev, YearPickerRoot, injectComboboxRootContext, injectConfigProviderContext, injectDialogRootContext, injectHoverCardRootContext, injectListboxItemContext, injectListboxRootContext, injectPopoverRootContext, injectSelectRootContext, injectTabsRootContext, injectTooltipProviderContext, injectTooltipRootContext, injectTreeRootContext, useBodyScrollLock, useDirection, useFilter, useForwardExpose, useForwardPropsEmits } from "reka-ui";
4
+ import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, getCurrentInstance, guardReactiveProps, h, inject, isRef, isVNode, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUpdated, openBlock, provide, reactive, ref, render, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toHandlers, toRaw, toRef, toRefs, toValue, unref, useAttrs, useId, useModel, useSlots, useTemplateRef, vModelDynamic, vModelSelect, vModelText, vShow, watch, watchEffect, watchPostEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
5
+ import { AccordionContent, AccordionHeader, AccordionItem, AccordionRoot, AccordionTrigger, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogOverlay, AlertDialogPortal, AlertDialogRoot, AlertDialogTitle, AlertDialogTrigger, AspectRatio, CalendarCell, CalendarCellTrigger, CalendarGrid, CalendarGridBody, CalendarGridHead, CalendarGridRow, CalendarHeadCell, CalendarNext, CalendarPrev, CalendarRoot, CheckboxGroupRoot, CheckboxRoot, CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, ComboboxAnchor, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxItemIndicator, ComboboxLabel, ComboboxPortal, ComboboxRoot, ComboboxTrigger, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuItemIndicator, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuRoot, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DateFieldInput, DateFieldRoot, DateRangeFieldInput, DateRangeFieldRoot, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemIndicator, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, HoverCardContent, HoverCardPortal, HoverCardRoot, HoverCardTrigger, ListboxContent, ListboxFilter, ListboxGroup, ListboxGroupLabel, ListboxItem, ListboxItemIndicator, ListboxRoot, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarItemIndicator, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarRoot, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MonthPickerCell, MonthPickerCellTrigger, MonthPickerGrid, MonthPickerGridBody, MonthPickerGridRow, MonthPickerNext, MonthPickerPrev, MonthPickerRoot, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuRoot, NavigationMenuTrigger, NavigationMenuViewport, PaginationFirst, PaginationLast, PaginationList, PaginationListItem, PaginationNext, PaginationPrev, PaginationRoot, PinInputInput, PinInputRoot, PopoverAnchor, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger, Primitive, ProgressIndicator, ProgressRoot, RadioGroupItem, RadioGroupRoot, RangeCalendarCell, RangeCalendarCellTrigger, RangeCalendarGrid, RangeCalendarGridBody, RangeCalendarGridHead, RangeCalendarGridRow, RangeCalendarHeadCell, RangeCalendarNext, RangeCalendarPrev, RangeCalendarRoot, RatingItem, RatingItemIndicator, RatingRoot, SelectContent, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectLabel, SelectPortal, SelectRoot, SelectTrigger, Separator, SliderRoot, SliderThumb, SliderTrack, SplitterGroup, SplitterPanel, SplitterResizeHandle, StepperDescription, StepperIndicator, StepperItem, StepperRoot, StepperSeparator, StepperTitle, StepperTrigger, SwitchRoot, TabsContent, TabsList, TabsRoot, TabsTrigger, TagsInputInput, TagsInputItem, TagsInputItemText, TagsInputRoot, TimeFieldInput, TimeFieldRoot, ToastClose, ToastDescription, ToastPortal, ToastProvider, ToastRoot, ToastTitle, ToastViewport, Toggle, ToggleGroupItem, ToggleGroupRoot, ToolbarButton, ToolbarRoot, ToolbarToggleGroup, ToolbarToggleItem, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger, TreeItem, TreeRoot, VisuallyHidden, YearPickerCell, YearPickerCellTrigger, YearPickerGrid, YearPickerGridBody, YearPickerGridRow, YearPickerNext, YearPickerPrev, YearPickerRoot, injectCollapsibleRootContext, injectComboboxRootContext, injectConfigProviderContext, injectDialogRootContext, injectHoverCardRootContext, injectListboxItemContext, injectListboxRootContext, injectPopoverRootContext, injectSelectRootContext, injectTabsRootContext, injectTooltipProviderContext, injectTooltipRootContext, injectTreeRootContext, useBodyScrollLock, useDirection, useFilter, useForwardExpose, useForwardPropsEmits, useId as useId$1 } from "reka-ui";
6
6
  import { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, CalendarClock, CalendarDays, CalendarRange, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, ChevronsLeft, ChevronsRight, ChevronsUpDown, CircleAlert, CircleCheck, CircleX, Copy, Download, Eye, EyeOff, File, GripVertical, Inbox, Info, LayoutGrid, Lightbulb, List, Megaphone, Minus, MoreHorizontal, PanelLeft, Pause, Pencil, Play, QrCode, RefreshCw, RotateCw, Scan, Search, Shrink, Star, TrendingDown, TrendingUp, TriangleAlert, Upload, User, X, ZoomIn, ZoomOut } from "@lucide/vue";
7
7
  import { createSharedComposable, defaultDocument, useDocumentVisibility, useElementBounding, useEventListener, useIntersectionObserver, useIntervalFn, useMediaQuery, useMutationObserver, usePreferredReducedMotion, useRafFn, useResizeObserver, useVModel, useWindowSize } from "@vueuse/core";
8
8
  import { Motion, animate, useMotionValue, useTransform } from "motion-v";
9
9
  import { defaultRangeExtractor, measureElement, observeElementRect, useVirtualizer } from "@tanstack/vue-virtual";
10
+ import { NumberFormatter, NumberParser } from "@internationalized/number";
10
11
  import { CalendarDate, CalendarDateTime, Time, getLocalTimeZone, parseDate, parseDateTime, parseTime, today } from "@internationalized/date";
11
12
  import { columnFilteringFeature, columnGroupingFeature, columnVisibilityFeature, createExpandedRowModel, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, globalFilteringFeature, rowExpandingFeature, rowPaginationFeature, rowSelectionFeature, rowSortingFeature, tableFeatures, useTable } from "@tanstack/vue-table";
12
13
  import { encode } from "uqr";
@@ -128,7 +129,7 @@ function prefersReducedMotion() {
128
129
  return typeof window !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches;
129
130
  }
130
131
  //#endregion
131
- //#region src/locale/zh-CN.ts
132
+ //#region ../shared/src/locale/zh-CN.ts
132
133
  var zhCN = {
133
134
  qrCode: {
134
135
  label: "二维码",
@@ -329,7 +330,7 @@ var zhCN = {
329
330
  }
330
331
  };
331
332
  //#endregion
332
- //#region src/locale/en-US.ts
333
+ //#region ../shared/src/locale/en-US.ts
333
334
  var enUS = {
334
335
  qrCode: {
335
336
  label: "QR code",
@@ -530,10 +531,8 @@ var enUS = {
530
531
  }
531
532
  };
532
533
  //#endregion
533
- //#region src/locale/index.ts
534
- var UI_LOCALE_KEY = Symbol("hn-ui-locale");
535
- var fallbackLocale = computed(() => zhCN);
536
- function merge(base, patch) {
534
+ //#region ../shared/src/locale/index.ts
535
+ function mergeUiMessages(base, patch) {
537
536
  return {
538
537
  qrCode: {
539
538
  ...base.qrCode,
@@ -702,8 +701,12 @@ function merge(base, patch) {
702
701
  }
703
702
  };
704
703
  }
704
+ //#endregion
705
+ //#region src/locale/index.ts
706
+ var UI_LOCALE_KEY = Symbol("hn-ui-locale");
707
+ var fallbackLocale = computed(() => zhCN);
705
708
  function provideUiLocale(messages) {
706
- const resolved = computed(() => merge(zhCN, toValue(messages)));
709
+ const resolved = computed(() => mergeUiMessages(zhCN, toValue(messages)));
707
710
  provide(UI_LOCALE_KEY, resolved);
708
711
  return resolved;
709
712
  }
@@ -920,7 +923,7 @@ var IconSlot_default$1 = /* @__PURE__ */ defineComponent({
920
923
  }
921
924
  });
922
925
  //#endregion
923
- //#region src/components/ripple/useRipple.ts
926
+ //#region ../shared/src/behavior/ripple.ts
924
927
  var INITIAL_ORIGIN_SCALE = .2;
925
928
  var PADDING = 12;
926
929
  var SOFT_EDGE_MINIMUM_SIZE = 75;
@@ -934,8 +937,7 @@ var STATE = {
934
937
  holding: 2,
935
938
  waitingForClick: 3
936
939
  };
937
- function useRipple(container, surface, isDisabled) {
938
- const pressed = ref(false);
940
+ function createRipple(options) {
939
941
  let host = null;
940
942
  let state = STATE.inactive;
941
943
  let startEvent;
@@ -944,20 +946,28 @@ function useRipple(container, surface, isDisabled) {
944
946
  let initialSize = 0;
945
947
  let rippleScale = "";
946
948
  let rippleSize = "";
949
+ const timers = /* @__PURE__ */ new Set();
950
+ function later(callback, ms) {
951
+ const timer = window.setTimeout(() => {
952
+ timers.delete(timer);
953
+ callback();
954
+ }, ms);
955
+ timers.add(timer);
956
+ }
947
957
  const isTouch = ({ pointerType }) => pointerType === "touch";
948
958
  function shouldReact(event) {
949
- if (isDisabled() || !event.isPrimary) return false;
959
+ if (options.disabled() || !event.isPrimary) return false;
950
960
  if (startEvent && startEvent.pointerId !== event.pointerId) return false;
951
961
  if (event.type === "pointerenter" || event.type === "pointerleave") return !isTouch(event);
952
962
  return isTouch(event) || event.buttons === 1;
953
963
  }
954
964
  function inBounds({ x, y }) {
955
- const rect = container.value?.getBoundingClientRect();
965
+ const rect = options.container()?.getBoundingClientRect();
956
966
  if (!rect) return false;
957
967
  return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
958
968
  }
959
969
  function determineRippleSize() {
960
- const rect = container.value?.getBoundingClientRect();
970
+ const rect = options.container()?.getBoundingClientRect();
961
971
  if (!rect) return;
962
972
  const maxDim = Math.max(rect.height, rect.width);
963
973
  const softEdgeSize = Math.max(SOFT_EDGE_CONTAINER_RATIO * maxDim, SOFT_EDGE_MINIMUM_SIZE);
@@ -966,7 +976,7 @@ function useRipple(container, surface, isDisabled) {
966
976
  rippleSize = `${initialSize}px`;
967
977
  }
968
978
  function normalizedCoords(event) {
969
- const rect = container.value?.getBoundingClientRect();
979
+ const rect = options.container()?.getBoundingClientRect();
970
980
  if (!rect) return {
971
981
  x: 0,
972
982
  y: 0
@@ -977,7 +987,7 @@ function useRipple(container, surface, isDisabled) {
977
987
  };
978
988
  }
979
989
  function translationCoords(positionEvent) {
980
- const rect = container.value?.getBoundingClientRect();
990
+ const rect = options.container()?.getBoundingClientRect();
981
991
  if (!rect) return {
982
992
  startPoint: {
983
993
  x: 0,
@@ -998,9 +1008,9 @@ function useRipple(container, surface, isDisabled) {
998
1008
  };
999
1009
  }
1000
1010
  function startPress(positionEvent) {
1001
- const el = surface.value;
1011
+ const el = options.surface();
1002
1012
  if (!el) return;
1003
- pressed.value = true;
1013
+ options.onPressedChange(true);
1004
1014
  growAnimation?.cancel();
1005
1015
  growAnimation = void 0;
1006
1016
  determineRippleSize();
@@ -1027,12 +1037,12 @@ function useRipple(container, surface, isDisabled) {
1027
1037
  if (typeof animation?.currentTime === "number") playedMs = animation.currentTime;
1028
1038
  else if (animation?.currentTime) playedMs = animation.currentTime.to("ms").value;
1029
1039
  if (playedMs >= MINIMUM_PRESS_MS) {
1030
- pressed.value = false;
1040
+ options.onPressedChange(false);
1031
1041
  return;
1032
1042
  }
1033
- window.setTimeout(() => {
1043
+ later(() => {
1034
1044
  if (growAnimation !== animation) return;
1035
- pressed.value = false;
1045
+ options.onPressedChange(false);
1036
1046
  }, MINIMUM_PRESS_MS - playedMs);
1037
1047
  }
1038
1048
  function onPointerDown(event) {
@@ -1046,7 +1056,7 @@ function useRipple(container, surface, isDisabled) {
1046
1056
  if (checkBoundsAfterContextMenu && !inBounds(event)) return;
1047
1057
  checkBoundsAfterContextMenu = false;
1048
1058
  state = STATE.touchDelay;
1049
- window.setTimeout(() => {
1059
+ later(() => {
1050
1060
  if (state !== STATE.touchDelay) return;
1051
1061
  state = STATE.holding;
1052
1062
  startPress(event);
@@ -1072,7 +1082,7 @@ function useRipple(container, surface, isDisabled) {
1072
1082
  endPress();
1073
1083
  }
1074
1084
  function onClick() {
1075
- if (isDisabled()) return;
1085
+ if (options.disabled()) return;
1076
1086
  if (state === STATE.waitingForClick) {
1077
1087
  endPress();
1078
1088
  return;
@@ -1083,7 +1093,7 @@ function useRipple(container, surface, isDisabled) {
1083
1093
  }
1084
1094
  }
1085
1095
  function onContextMenu() {
1086
- if (isDisabled()) return;
1096
+ if (options.disabled()) return;
1087
1097
  checkBoundsAfterContextMenu = true;
1088
1098
  endPress();
1089
1099
  }
@@ -1095,16 +1105,37 @@ function useRipple(container, surface, isDisabled) {
1095
1105
  ["pointerleave", onPointerLeave],
1096
1106
  ["pointerup", onPointerUp]
1097
1107
  ];
1098
- onMounted(() => {
1099
- host = container.value?.parentElement ?? null;
1108
+ function connect() {
1109
+ host = options.container()?.parentElement ?? null;
1100
1110
  if (!host) return;
1101
1111
  for (const [name, fn] of listeners) host.addEventListener(name, fn, true);
1102
- });
1103
- onBeforeUnmount(() => {
1112
+ }
1113
+ function disconnect() {
1114
+ for (const timer of timers) window.clearTimeout(timer);
1115
+ timers.clear();
1104
1116
  if (!host) return;
1105
1117
  for (const [name, fn] of listeners) host.removeEventListener(name, fn, true);
1106
1118
  host = null;
1119
+ }
1120
+ return {
1121
+ connect,
1122
+ disconnect
1123
+ };
1124
+ }
1125
+ //#endregion
1126
+ //#region src/components/ripple/useRipple.ts
1127
+ function useRipple(container, surface, isDisabled) {
1128
+ const pressed = ref(false);
1129
+ const ripple = createRipple({
1130
+ container: () => container.value,
1131
+ surface: () => surface.value,
1132
+ disabled: isDisabled,
1133
+ onPressedChange: (value) => {
1134
+ pressed.value = value;
1135
+ }
1107
1136
  });
1137
+ onMounted(ripple.connect);
1138
+ onBeforeUnmount(ripple.disconnect);
1108
1139
  return { pressed };
1109
1140
  }
1110
1141
  //#endregion
@@ -2244,13 +2275,40 @@ function useOverlayPortal(open) {
2244
2275
  };
2245
2276
  }
2246
2277
  //#endregion
2247
- //#region src/lib/overlay-anchor.ts
2278
+ //#region ../shared/src/lib/overlay-anchor.ts
2248
2279
  function overlayAnchorElement(anchor) {
2249
2280
  return anchor && "nodeType" in anchor ? anchor : void 0;
2250
2281
  }
2251
2282
  function overlayAnchorContext(anchor) {
2252
2283
  return overlayAnchorElement(anchor) ?? (anchor && "contextElement" in anchor ? anchor.contextElement : void 0);
2253
2284
  }
2285
+ function createOverlayReference(anchor, current) {
2286
+ const contextElement = overlayAnchorContext(anchor);
2287
+ if (contextElement && !contextElement.isConnected) return void 0;
2288
+ const measure = () => {
2289
+ const { x, y, width, height, top, right, bottom, left } = anchor.getBoundingClientRect();
2290
+ return {
2291
+ x,
2292
+ y,
2293
+ width,
2294
+ height,
2295
+ top,
2296
+ right,
2297
+ bottom,
2298
+ left
2299
+ };
2300
+ };
2301
+ let rect = measure();
2302
+ return {
2303
+ contextElement,
2304
+ getBoundingClientRect: () => {
2305
+ if (current() && (!contextElement || contextElement.isConnected)) rect = measure();
2306
+ return rect;
2307
+ }
2308
+ };
2309
+ }
2310
+ //#endregion
2311
+ //#region src/lib/overlay-anchor.ts
2254
2312
  function useOverlayAnchor(source, open, present, strategy, direction = () => void 0) {
2255
2313
  const reference = shallowRef();
2256
2314
  let current;
@@ -2267,30 +2325,10 @@ function useOverlayAnchor(source, open, present, strategy, direction = () => voi
2267
2325
  return;
2268
2326
  }
2269
2327
  if (!anchor || !active && reference.value && anchor !== current) return;
2270
- const contextElement = overlayAnchorContext(anchor);
2271
- if (contextElement && !contextElement.isConnected) return;
2328
+ const next = createOverlayReference(anchor, () => source() === anchor);
2329
+ if (!next) return;
2272
2330
  current = anchor;
2273
- const measure = () => {
2274
- const { x, y, width, height, top, right, bottom, left } = anchor.getBoundingClientRect();
2275
- return {
2276
- x,
2277
- y,
2278
- width,
2279
- height,
2280
- top,
2281
- right,
2282
- bottom,
2283
- left
2284
- };
2285
- };
2286
- let rect = measure();
2287
- reference.value = {
2288
- contextElement,
2289
- getBoundingClientRect: () => {
2290
- if (source() === anchor && (!contextElement || contextElement.isConnected)) rect = measure();
2291
- return rect;
2292
- }
2293
- };
2331
+ reference.value = next;
2294
2332
  }, {
2295
2333
  immediate: true,
2296
2334
  flush: "post"
@@ -3159,12 +3197,36 @@ var Skeleton_default = /* @__PURE__ */ defineComponent({
3159
3197
  var VisuallyHidden_default = /* @__PURE__ */ defineComponent({
3160
3198
  name: "HnVisuallyHidden",
3161
3199
  __name: "VisuallyHidden",
3200
+ props: {
3201
+ asChild: { type: Boolean },
3202
+ as: { default: "span" }
3203
+ },
3162
3204
  setup(__props) {
3205
+ const props = __props;
3206
+ const hidden = {
3207
+ position: "absolute",
3208
+ border: 0,
3209
+ width: "1px",
3210
+ height: "1px",
3211
+ padding: 0,
3212
+ margin: "-1px",
3213
+ overflow: "hidden",
3214
+ clip: "rect(0, 0, 0, 0)",
3215
+ clipPath: "inset(50%)",
3216
+ whiteSpace: "nowrap",
3217
+ wordWrap: "normal",
3218
+ top: "-1px",
3219
+ left: "-1px"
3220
+ };
3163
3221
  return (_ctx, _cache) => {
3164
- return openBlock(), createBlock(unref(VisuallyHidden), null, {
3222
+ return openBlock(), createBlock(unref(Primitive), {
3223
+ as: props.as,
3224
+ "as-child": props.asChild,
3225
+ style: hidden
3226
+ }, {
3165
3227
  default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
3166
3228
  _: 3
3167
- });
3229
+ }, 8, ["as", "as-child"]);
3168
3230
  };
3169
3231
  }
3170
3232
  });
@@ -3349,7 +3411,7 @@ var d = getApi("ResizeObserver");
3349
3411
  var p = getApi("ScrollTimeline");
3350
3412
  var isUndefined = (t) => t === void 0;
3351
3413
  var isNull = (t) => t === null;
3352
- var isNumber = (t) => typeof t === "number";
3414
+ var isNumber$1 = (t) => typeof t === "number";
3353
3415
  var isString = (t) => typeof t === "string";
3354
3416
  var isBoolean = (t) => typeof t === "boolean";
3355
3417
  var isFunction = (t) => typeof t === "function";
@@ -3357,7 +3419,7 @@ var isArray = (t) => Array.isArray(t);
3357
3419
  var isObject = (t) => typeof t === "object" && !isArray(t) && !isNull(t);
3358
3420
  var isArrayLike = (t) => {
3359
3421
  const n = !!t && t.length;
3360
- const o = isNumber(n) && n > -1 && n % 1 == 0;
3422
+ const o = isNumber$1(n) && n > -1 && n % 1 == 0;
3361
3423
  return isArray(t) || !isFunction(t) && o ? n > 0 && isObject(t) ? n - 1 in t : true : false;
3362
3424
  };
3363
3425
  var isPlainObject = (t) => !!t && t.constructor === Object;
@@ -3371,7 +3433,7 @@ function each(t, n) {
3371
3433
  }
3372
3434
  var inArray = (t, n) => t.indexOf(n) >= 0;
3373
3435
  var concat = (t, n) => t.concat(n);
3374
- var push$1 = (t, n, o) => {
3436
+ var push = (t, n, o) => {
3375
3437
  if (!isString(n) && isArrayLike(n)) Array.prototype.push.apply(t, n);
3376
3438
  else t.push(n);
3377
3439
  return t;
@@ -3436,7 +3498,7 @@ var selfClearTimeout = (t) => {
3436
3498
  };
3437
3499
  var getDebouncer = (t) => {
3438
3500
  const n = isFunction(t) ? t() : t;
3439
- if (isNumber(n)) {
3501
+ if (isNumber$1(n)) {
3440
3502
  const t = n ? a : l;
3441
3503
  const o = n ? u : i;
3442
3504
  return (s) => {
@@ -3628,7 +3690,7 @@ function setStyles(t, n) {
3628
3690
  t && n && each(n, ((n, o) => {
3629
3691
  try {
3630
3692
  const s = t.style;
3631
- const e = isNull(n) || isBoolean(n) ? "" : isNumber(n) ? numberToCssPx(n) : n;
3693
+ const e = isNull(n) || isBoolean(n) ? "" : isNumber$1(n) ? numberToCssPx(n) : n;
3632
3694
  if (o.indexOf("--") === 0) s.setProperty(o, e);
3633
3695
  else s[o] = e;
3634
3696
  } catch (s) {}
@@ -3722,12 +3784,12 @@ var stopPropagation = (t) => t.stopPropagation();
3722
3784
  var preventDefault = (t) => t.preventDefault();
3723
3785
  var stopAndPrevent = (t) => stopPropagation(t) || preventDefault(t);
3724
3786
  var scrollElementTo = (t, n) => {
3725
- const { x: o, y: s } = isNumber(n) ? {
3787
+ const { x: o, y: s } = isNumber$1(n) ? {
3726
3788
  x: n,
3727
3789
  y: n
3728
3790
  } : n || {};
3729
- isNumber(o) && (t.scrollLeft = o);
3730
- isNumber(s) && (t.scrollTop = s);
3791
+ isNumber$1(o) && (t.scrollLeft = o);
3792
+ isNumber$1(s) && (t.scrollTop = s);
3731
3793
  };
3732
3794
  var getElementScroll = (t) => ({
3733
3795
  x: t.scrollLeft,
@@ -3823,7 +3885,7 @@ var createEventListenerHub = (t) => {
3823
3885
  const e = [];
3824
3886
  each(s, ((n) => {
3825
3887
  const o = t[n];
3826
- if (o) push$1(e, addEvent(n, o));
3888
+ if (o) push(e, addEvent(n, o));
3827
3889
  }));
3828
3890
  return bind(runEachAndClear, e);
3829
3891
  };
@@ -4107,7 +4169,7 @@ var createEventContentChange = (t, n, o) => {
4107
4169
  e.delete(c);
4108
4170
  } else n(o);
4109
4171
  }));
4110
- e.set(c, push$1(i, t));
4172
+ e.set(c, push(i, t));
4111
4173
  } else {
4112
4174
  runEachAndClear(i);
4113
4175
  e.delete(c);
@@ -4146,18 +4208,18 @@ var createDOMObserver = (t, n, o, s) => {
4146
4208
  const n = b && C;
4147
4209
  const a = n && l && is(c, l);
4148
4210
  const p = (a ? !r(c, e, u, O) : !b || n) && !i(o, !!a, t, s);
4149
- each(d, ((t) => push$1(f, t)));
4150
- each(h, ((t) => push$1(f, t)));
4211
+ each(d, ((t) => push(f, t)));
4212
+ each(h, ((t) => push(f, t)));
4151
4213
  g = g || p;
4152
4214
  }
4153
4215
  if (!n && w && C && !r(c, e, u, O)) {
4154
- push$1(_, e);
4216
+ push(_, e);
4155
4217
  p = p || $;
4156
4218
  }
4157
4219
  }));
4158
4220
  d(((t) => deduplicateArray(f).reduce(((n, o) => {
4159
- push$1(n, find(t, o));
4160
- return is(o, t) ? push$1(n, o) : n;
4221
+ push(n, find(t, o));
4222
+ return is(o, t) ? push(n, o) : n;
4161
4223
  }), [])));
4162
4224
  if (n) {
4163
4225
  if (!e && g) o(false);
@@ -4236,17 +4298,17 @@ var createSizeObserver = (t, n, o) => {
4236
4298
  const resizeObserverCallback = (t) => n(t);
4237
4299
  const s = new d(resizeObserverCallback);
4238
4300
  s.observe(Rt ? t : l);
4239
- push$1(o, [() => {
4301
+ push(o, [() => {
4240
4302
  s.disconnect();
4241
4303
  }, !Rt && appendChildren(t, i)]);
4242
4304
  if (Rt) {
4243
4305
  const n = new d(resizeObserverCallback);
4244
4306
  n.observe(t, { box: "border-box" });
4245
- push$1(o, (() => n.disconnect()));
4307
+ push(o, (() => n.disconnect()));
4246
4308
  }
4247
4309
  } else if (e) {
4248
4310
  const [n, c] = e(l, onSizeChangedCallbackProxy, s);
4249
- push$1(o, concat([
4311
+ push(o, concat([
4250
4312
  addClass(i, ot),
4251
4313
  addEventListener(i, "animationstart", n),
4252
4314
  appendChildren(t, i)
@@ -4273,7 +4335,7 @@ var createTrinsicObserver = (t, n) => {
4273
4335
  if (_) {
4274
4336
  o = new _(bind(intersectionObserverCallback, false), { root: t });
4275
4337
  o.observe(s);
4276
- push$1(n, (() => {
4338
+ push(n, (() => {
4277
4339
  o.disconnect();
4278
4340
  }));
4279
4341
  } else {
@@ -4281,10 +4343,10 @@ var createTrinsicObserver = (t, n) => {
4281
4343
  const t = I(s);
4282
4344
  triggerOnTrinsicChangedCallback(t);
4283
4345
  };
4284
- push$1(n, createSizeObserver(s, onSizeChanged)());
4346
+ push(n, createSizeObserver(s, onSizeChanged)());
4285
4347
  onSizeChanged();
4286
4348
  }
4287
- return bind(runEachAndClear, push$1(n, appendChildren(t, s)));
4349
+ return bind(runEachAndClear, push(n, appendChildren(t, s)));
4288
4350
  }, () => o && intersectionObserverCallback(true, o.takeRecords())];
4289
4351
  };
4290
4352
  var createObserversSetup = (t, n, o, s, sleeping) => {
@@ -4332,7 +4394,7 @@ var createObserversSetup = (t, n, o, s, sleeping) => {
4332
4394
  t = s;
4333
4395
  n = e;
4334
4396
  o = r;
4335
- } else if (isNumber(c)) {
4397
+ } else if (isNumber$1(c)) {
4336
4398
  t = c;
4337
4399
  n = false;
4338
4400
  o = false;
@@ -4479,7 +4541,7 @@ var createObserversSetup = (t, n, o, s, sleeping) => {
4479
4541
  }
4480
4542
  if (m) {
4481
4543
  z.O();
4482
- if (isArray(y) || isNumber(y)) {
4544
+ if (isArray(y) || isNumber$1(y)) {
4483
4545
  e = y;
4484
4546
  c = false;
4485
4547
  r = It;
@@ -4665,8 +4727,8 @@ var createScrollbarsSetupElements = (t, n, o, s) => {
4665
4727
  kt: r
4666
4728
  };
4667
4729
  const l = C[n];
4668
- push$1(t ? S : m, i);
4669
- push$1(w, [
4730
+ push(t ? S : m, i);
4731
+ push(w, [
4670
4732
  appendChildren(e, c),
4671
4733
  appendChildren(c, r),
4672
4734
  bind(removeElements, e),
@@ -4789,10 +4851,10 @@ var createScrollbarsSetupEvents = (t, n, o, s, r) => (i, l, u) => {
4789
4851
  const { Vt: n } = o;
4790
4852
  const s = t(scrollRelative, moveHandleRelative, bind(getHandleOffset), k, n[f], S, !!u, ((t) => {
4791
4853
  if (t) V();
4792
- else push$1(L, V);
4854
+ else push(L, V);
4793
4855
  }));
4794
- push$1(L, s);
4795
- push$1(_, bind(s, true));
4856
+ push(L, s);
4857
+ push(_, bind(s, true));
4796
4858
  }
4797
4859
  }
4798
4860
  }
@@ -4933,7 +4995,7 @@ var createScrollbarsSetup = (t, n, o, s, e, c, r) => {
4933
4995
  ];
4934
4996
  const R = getStaticPluginModuleInstance(xt);
4935
4997
  return [
4936
- () => bind(runEachAndClear, push$1(M, C())),
4998
+ () => bind(runEachAndClear, push(M, C())),
4937
4999
  ({ Dt: t, It: n, Zt: o, tn: c }) => {
4938
5000
  const { nn: r, sn: i, en: p, cn: v } = c || {};
4939
5001
  const { Ct: g, ft: h } = o || {};
@@ -5107,7 +5169,7 @@ var createStructureSetupElements = (t) => {
5107
5169
  appendChildren(W, J);
5108
5170
  appendChildren(J || W, !H && Q);
5109
5171
  appendChildren(Q, nt);
5110
- push$1(ot, [c, () => {
5172
+ push(ot, [c, () => {
5111
5173
  const t = getFocusedElement();
5112
5174
  const n = elementIsGenerated(Q);
5113
5175
  const e = n && t === Q ? Y : t;
@@ -5126,7 +5188,7 @@ var createStructureSetupElements = (t) => {
5126
5188
  }]);
5127
5189
  if (e && !H) {
5128
5190
  addAttrClass(Q, j, K);
5129
- push$1(ot, bind(removeAttrs, Q, j));
5191
+ push(ot, bind(removeAttrs, Q, j));
5130
5192
  }
5131
5193
  focusElement(!H && g && n === Y && t.top === t ? Q : n);
5132
5194
  c();
@@ -5699,7 +5761,7 @@ var OverlayScrollbars = (t, n, o) => {
5699
5761
  sleep: h,
5700
5762
  plugin: (t) => i[keys(t)[0]]
5701
5763
  };
5702
- push$1(r, [S]);
5764
+ push(r, [S]);
5703
5765
  addInstance(c, m);
5704
5766
  registerPluginModuleInstances(k, OverlayScrollbars, [
5705
5767
  m,
@@ -5710,7 +5772,7 @@ var OverlayScrollbars = (t, n, o) => {
5710
5772
  destroy(true);
5711
5773
  return m;
5712
5774
  }
5713
- push$1(r, v());
5775
+ push(r, v());
5714
5776
  triggerEvent("initialized", [m]);
5715
5777
  m.update();
5716
5778
  return m;
@@ -5805,6 +5867,81 @@ function useOverlayScrollbars(host, content, options) {
5805
5867
  };
5806
5868
  }
5807
5869
  //#endregion
5870
+ //#region ../shared/src/lib/scroll-area.ts
5871
+ var NONE = {
5872
+ xStart: false,
5873
+ xEnd: false,
5874
+ yStart: false,
5875
+ yEnd: false
5876
+ };
5877
+ function scrollEdges(element, direction, shadow) {
5878
+ if (!element || !shadow) return NONE;
5879
+ const room = 1;
5880
+ const x = direction !== "vertical";
5881
+ const y = direction !== "horizontal";
5882
+ return {
5883
+ xStart: x && Math.abs(element.scrollLeft) > room,
5884
+ xEnd: x && Math.abs(element.scrollLeft) + element.clientWidth < element.scrollWidth - room,
5885
+ yStart: y && element.scrollTop > room,
5886
+ yEnd: y && element.scrollTop + element.clientHeight < element.scrollHeight - room
5887
+ };
5888
+ }
5889
+ function redirectWheel(element, event) {
5890
+ if (Math.abs(event.deltaY) <= Math.abs(event.deltaX)) return;
5891
+ const max = element.scrollWidth - element.clientWidth;
5892
+ if (max <= 0) return;
5893
+ const sign = getComputedStyle(element).direction === "rtl" ? -1 : 1;
5894
+ const offset = Math.max(0, Math.min(max, element.scrollLeft * sign));
5895
+ const atStart = offset <= 1 && event.deltaY < 0;
5896
+ const atEnd = offset >= max - 1 && event.deltaY > 0;
5897
+ if (atStart || atEnd) return;
5898
+ event.preventDefault();
5899
+ element.scrollLeft = (offset + event.deltaY) * sign;
5900
+ }
5901
+ function blockWhenInert(element) {
5902
+ const block = (event) => {
5903
+ if (getComputedStyle(element).pointerEvents === "none") event.preventDefault();
5904
+ };
5905
+ element.addEventListener("wheel", block, {
5906
+ passive: false,
5907
+ capture: true
5908
+ });
5909
+ element.addEventListener("touchmove", block, {
5910
+ passive: false,
5911
+ capture: true
5912
+ });
5913
+ return () => {
5914
+ element.removeEventListener("wheel", block, true);
5915
+ element.removeEventListener("touchmove", block, true);
5916
+ };
5917
+ }
5918
+ var SCROLL_AREA_OVERFLOW = {
5919
+ vertical: {
5920
+ x: "hidden",
5921
+ y: "scroll"
5922
+ },
5923
+ horizontal: {
5924
+ x: "scroll",
5925
+ y: "hidden"
5926
+ },
5927
+ both: {
5928
+ x: "scroll",
5929
+ y: "scroll"
5930
+ }
5931
+ };
5932
+ function scrollAreaOptions(options) {
5933
+ return {
5934
+ scrollbars: {
5935
+ theme: "os-theme-dark",
5936
+ visibility: options.scrollbar ? "auto" : "hidden",
5937
+ autoHide: options.autoHide,
5938
+ autoHideDelay: 800
5939
+ },
5940
+ overflow: SCROLL_AREA_OVERFLOW[options.direction],
5941
+ update: { elementEvents: [["img", "load"]] }
5942
+ };
5943
+ }
5944
+ //#endregion
5808
5945
  //#region src/components/scroll-area/composables/useEdgeShadow.ts
5809
5946
  function useEdgeShadow(viewport, opts) {
5810
5947
  const showXStart = shallowRef(false);
@@ -5812,22 +5949,12 @@ function useEdgeShadow(viewport, opts) {
5812
5949
  const showYStart = shallowRef(false);
5813
5950
  const showYEnd = shallowRef(false);
5814
5951
  function updateEdges() {
5815
- const el = viewport.value;
5816
5952
  const { direction, shadow } = opts();
5817
- if (!el || !shadow) {
5818
- showXStart.value = false;
5819
- showXEnd.value = false;
5820
- showYStart.value = false;
5821
- showYEnd.value = false;
5822
- return;
5823
- }
5824
- const room = 1;
5825
- const x = direction !== "vertical";
5826
- const y = direction !== "horizontal";
5827
- showXStart.value = x && Math.abs(el.scrollLeft) > room;
5828
- showXEnd.value = x && Math.abs(el.scrollLeft) + el.clientWidth < el.scrollWidth - room;
5829
- showYStart.value = y && el.scrollTop > room;
5830
- showYEnd.value = y && el.scrollTop + el.clientHeight < el.scrollHeight - room;
5953
+ const edges = scrollEdges(viewport.value, direction, shadow);
5954
+ showXStart.value = edges.xStart;
5955
+ showXEnd.value = edges.xEnd;
5956
+ showYStart.value = edges.yStart;
5957
+ showYEnd.value = edges.yEnd;
5831
5958
  }
5832
5959
  return {
5833
5960
  showXStart,
@@ -5844,16 +5971,7 @@ function useWheelRedirect(viewport, enabled) {
5844
5971
  if (event.defaultPrevented || !enabled()) return;
5845
5972
  const el = viewport.value;
5846
5973
  if (!el) return;
5847
- if (Math.abs(event.deltaY) <= Math.abs(event.deltaX)) return;
5848
- const max = el.scrollWidth - el.clientWidth;
5849
- if (max <= 0) return;
5850
- const sign = getComputedStyle(el).direction === "rtl" ? -1 : 1;
5851
- const offset = Math.max(0, Math.min(max, el.scrollLeft * sign));
5852
- const atStart = offset <= 1 && event.deltaY < 0;
5853
- const atEnd = offset >= max - 1 && event.deltaY > 0;
5854
- if (atStart || atEnd) return;
5855
- event.preventDefault();
5856
- el.scrollLeft = (offset + event.deltaY) * sign;
5974
+ redirectWheel(el, event);
5857
5975
  }
5858
5976
  watch(viewport, (el, _, onCleanup) => {
5859
5977
  if (!el) return;
@@ -5885,21 +6003,7 @@ function useLayerLock(viewport) {
5885
6003
  release = void 0;
5886
6004
  const el = viewport.value;
5887
6005
  if (!el || !locked.value) return;
5888
- const block = (event) => {
5889
- if (getComputedStyle(el).pointerEvents === "none") event.preventDefault();
5890
- };
5891
- el.addEventListener("wheel", block, {
5892
- passive: false,
5893
- capture: true
5894
- });
5895
- el.addEventListener("touchmove", block, {
5896
- passive: false,
5897
- capture: true
5898
- });
5899
- release = () => {
5900
- el.removeEventListener("wheel", block, true);
5901
- el.removeEventListener("touchmove", block, true);
5902
- };
6006
+ release = blockWhenInert(el);
5903
6007
  }
5904
6008
  watch([locked, viewport], apply, { flush: "post" });
5905
6009
  onBeforeUnmount(() => release?.());
@@ -5971,31 +6075,12 @@ var ScrollArea_default = /* @__PURE__ */ defineComponent({
5971
6075
  const t = useUiLocale();
5972
6076
  const host = shallowRef();
5973
6077
  const content = shallowRef();
5974
- const overflow = {
5975
- vertical: {
5976
- x: "hidden",
5977
- y: "scroll"
5978
- },
5979
- horizontal: {
5980
- x: "scroll",
5981
- y: "hidden"
5982
- },
5983
- both: {
5984
- x: "scroll",
5985
- y: "scroll"
5986
- }
5987
- };
5988
6078
  function options() {
5989
- return {
5990
- scrollbars: {
5991
- theme: "os-theme-dark",
5992
- visibility: props.scrollbar ? "auto" : "hidden",
5993
- autoHide: props.autoHide,
5994
- autoHideDelay: 800
5995
- },
5996
- overflow: overflow[props.direction],
5997
- update: { elementEvents: [["img", "load"]] }
5998
- };
6079
+ return scrollAreaOptions({
6080
+ direction: props.direction,
6081
+ autoHide: props.autoHide,
6082
+ scrollbar: props.scrollbar
6083
+ });
5999
6084
  }
6000
6085
  const { viewport, instance, onEvent } = useOverlayScrollbars(host, content, options);
6001
6086
  const { hostFocus, viewportFocus } = useScrollFocus(host, viewport, () => ({
@@ -6530,7 +6615,7 @@ function stepZoom(zoom, direction, max = 2) {
6530
6615
  return clampZoom(zoom * ZOOM_STEP ** direction, 1, max);
6531
6616
  }
6532
6617
  //#endregion
6533
- //#region src/components/lightbox/utils/pose.ts
6618
+ //#region ../shared/src/lib/lightbox/pose.ts
6534
6619
  var REST_POSE = {
6535
6620
  x: 0,
6536
6621
  y: 0,
@@ -7462,7 +7547,7 @@ function useLightboxLarge(item, active) {
7462
7547
  };
7463
7548
  }
7464
7549
  //#endregion
7465
- //#region src/components/lightbox/utils/clip.ts
7550
+ //#region ../shared/src/lib/lightbox/clip.ts
7466
7551
  function emptyCorners() {
7467
7552
  return [
7468
7553
  {
@@ -7587,7 +7672,7 @@ function clipOf(el, box) {
7587
7672
  };
7588
7673
  }
7589
7674
  //#endregion
7590
- //#region src/components/lightbox/utils/source.ts
7675
+ //#region ../shared/src/lib/lightbox/source.ts
7591
7676
  function sourceRect(source) {
7592
7677
  if (!source) return null;
7593
7678
  const isElement = "getBoundingClientRect" in source;
@@ -7685,6 +7770,10 @@ function useLightboxPhase(options) {
7685
7770
  //#endregion
7686
7771
  //#region src/components/lightbox/composables/useLightboxHint.ts
7687
7772
  function useLightboxHint(options) {
7773
+ if (typeof window === "undefined") return {
7774
+ x: useMotionValue(0),
7775
+ y: useMotionValue(0)
7776
+ };
7688
7777
  const { motion, frames, paging } = options;
7689
7778
  function corner() {
7690
7779
  const frame = frames.frameOf(options.current());
@@ -7810,7 +7899,7 @@ function useLightboxRotation(frames, current) {
7810
7899
  };
7811
7900
  }
7812
7901
  //#endregion
7813
- //#region src/components/lightbox/utils/download.ts
7902
+ //#region ../shared/src/lib/lightbox/download.ts
7814
7903
  function fileNameOf(url, fallback = "image") {
7815
7904
  try {
7816
7905
  const parsed = new URL(url, "http://localhost");
@@ -8751,7 +8840,7 @@ var Callout_default = /* @__PURE__ */ defineComponent({
8751
8840
  }
8752
8841
  });
8753
8842
  //#endregion
8754
- //#region src/lib/collapse.ts
8843
+ //#region ../shared/src/lib/collapse.ts
8755
8844
  function collapseGapOf(parent, axis = "y") {
8756
8845
  if (!parent) return "0px";
8757
8846
  const style = getComputedStyle(parent);
@@ -8778,6 +8867,8 @@ function collapseHooks(axis = "y", parentOf) {
8778
8867
  beforeLeave
8779
8868
  };
8780
8869
  }
8870
+ //#endregion
8871
+ //#region src/lib/collapse.ts
8781
8872
  function useCollapseHooks(axis = "y") {
8782
8873
  const instance = getCurrentInstance();
8783
8874
  let parent = null;
@@ -9564,7 +9655,10 @@ var PaginationPopup_default = /* @__PURE__ */ defineComponent({
9564
9655
  }
9565
9656
  });
9566
9657
  //#endregion
9567
- //#region src/components/pagination/utils/ranges.ts
9658
+ //#region ../shared/src/lib/pagination.ts
9659
+ function paginationInteger(value, fallback, minimum) {
9660
+ return Number.isFinite(value) ? Math.max(minimum, Math.floor(value)) : fallback;
9661
+ }
9568
9662
  function paginationRanges(items) {
9569
9663
  return items.flatMap((item, index) => {
9570
9664
  if (item.type !== "ellipsis") return [];
@@ -9579,7 +9673,7 @@ function paginationRanges(items) {
9579
9673
  });
9580
9674
  }
9581
9675
  //#endregion
9582
- //#region src/lib/pointer-corridor.ts
9676
+ //#region ../shared/src/lib/pointer-corridor.ts
9583
9677
  var cross = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
9584
9678
  function inPointerCorridor(point, first, second) {
9585
9679
  const points = [first, second].flatMap((rect) => [
@@ -10045,12 +10139,22 @@ function injectInputGroup() {
10045
10139
  return inject(INPUT_GROUP_KEY, null);
10046
10140
  }
10047
10141
  //#endregion
10048
- //#region src/components/select/types.ts
10049
- function isOptionGroup(item) {
10050
- return !("value" in item) && "options" in item;
10142
+ //#region ../shared/src/lib/virtual/flow.ts
10143
+ function virtualFlow(items, total, margin = 0) {
10144
+ return {
10145
+ entries: items.map((item, index) => ({
10146
+ ...item,
10147
+ gapBefore: index ? Math.max(0, item.start - items[index - 1].end) : 0
10148
+ })),
10149
+ before: Math.max(0, (items[0]?.start ?? margin) - margin),
10150
+ after: Math.max(0, total - ((items.at(-1)?.end ?? margin) - margin))
10151
+ };
10051
10152
  }
10052
- function flattenOptions(items) {
10053
- return items.flatMap((item) => isOptionGroup(item) ? item.options : [item]);
10153
+ function measuredSize(size, cached, estimate) {
10154
+ return size > 0 ? size : cached ?? estimate();
10155
+ }
10156
+ function scrollPosition(offset, adjustments, horizontal, rtl) {
10157
+ return { [horizontal ? "left" : "top"]: (offset + adjustments) * (horizontal && rtl ? -1 : 1) };
10054
10158
  }
10055
10159
  //#endregion
10056
10160
  //#region src/lib/virtual/useVirtualWindow.ts
@@ -10058,65 +10162,85 @@ function useVirtualWindow(options) {
10058
10162
  return useVirtualizer(computed(() => ({
10059
10163
  useAnimationFrameWithResizeObserver: true,
10060
10164
  measureElement: (element, entry, instance) => {
10061
- const size = measureElement(element, entry, instance);
10062
10165
  const index = instance.indexFromElement(element);
10063
- return size > 0 ? size : instance.itemSizeCache.get(instance.options.getItemKey(index)) ?? instance.options.estimateSize(index);
10166
+ return measuredSize(measureElement(element, entry, instance), instance.itemSizeCache.get(instance.options.getItemKey(index)), () => instance.options.estimateSize(index));
10064
10167
  },
10065
10168
  scrollToFn: (offset, { adjustments = 0, behavior }, instance) => {
10066
10169
  instance.scrollElement?.scrollTo({
10067
- [instance.options.horizontal ? "left" : "top"]: (offset + adjustments) * (instance.options.horizontal && instance.options.isRtl ? -1 : 1),
10170
+ ...scrollPosition(offset, adjustments, instance.options.horizontal, instance.options.isRtl),
10068
10171
  behavior
10069
10172
  });
10070
10173
  },
10071
10174
  ...toValue(options)
10072
10175
  })));
10073
10176
  }
10074
- function virtualFlow(items, total, margin = 0) {
10177
+ //#endregion
10178
+ //#region ../shared/src/lib/virtual/collection.ts
10179
+ var VIRTUAL_RECT = {
10180
+ width: 320,
10181
+ height: 320
10182
+ };
10183
+ function finite(value, fallback) {
10184
+ return value !== void 0 && Number.isFinite(value) ? value : fallback;
10185
+ }
10186
+ function virtualConfig(config) {
10187
+ return typeof config === "object" ? config : {};
10188
+ }
10189
+ function collectionEstimator(items, config, estimate) {
10190
+ return (index) => Math.max(1, finite(config.estimateSize, estimate?.(items[index]) ?? 36));
10191
+ }
10192
+ function collectionOverscan(config) {
10193
+ return Math.max(0, Math.floor(finite(config.overscan, 6)));
10194
+ }
10195
+ function centeredOffset(index, count, estimateSize, viewport = VIRTUAL_RECT.height) {
10196
+ if (index < 0 || index >= count) return 0;
10197
+ let offset = (estimateSize(index) - viewport) / 2;
10198
+ for (let current = 0; current < index; current++) offset += estimateSize(current);
10199
+ return Math.max(0, offset);
10200
+ }
10201
+ function mergeRange(indexes, retained, count, include) {
10202
+ const merged = [...indexes, ...retained];
10203
+ return [.../* @__PURE__ */ new Set([...merged, ...include?.(merged) ?? []])].filter((index) => index >= 0 && index < count).sort((a, b) => a - b);
10204
+ }
10205
+ function fallbackRect(rect) {
10075
10206
  return {
10076
- entries: items.map((item, index) => ({
10077
- ...item,
10078
- gapBefore: index ? Math.max(0, item.start - items[index - 1].end) : 0
10079
- })),
10080
- before: Math.max(0, (items[0]?.start ?? margin) - margin),
10081
- after: Math.max(0, total - ((items.at(-1)?.end ?? margin) - margin))
10207
+ width: rect.width || VIRTUAL_RECT.width,
10208
+ height: rect.height || VIRTUAL_RECT.height
10082
10209
  };
10083
10210
  }
10211
+ function layoutTop(element) {
10212
+ let top = 0;
10213
+ for (let node = element; node; node = node.offsetParent) top += node.offsetTop;
10214
+ return top;
10215
+ }
10216
+ function scrollMargin(body, viewport) {
10217
+ return Math.max(0, layoutTop(body) - layoutTop(viewport));
10218
+ }
10219
+ function overscrolledOffset(scrollTop, total, clientHeight) {
10220
+ const max = Math.max(0, total - clientHeight);
10221
+ return scrollTop > max ? max : void 0;
10222
+ }
10084
10223
  //#endregion
10085
10224
  //#region src/lib/virtual/useVirtualCollection.ts
10086
10225
  function useVirtualCollection(options) {
10087
10226
  const margin = shallowRef(0);
10088
- const finite = (value, fallback) => value !== void 0 && Number.isFinite(value) ? value : fallback;
10089
- const config = computed(() => typeof options.config() === "object" ? options.config() : {});
10227
+ const config = computed(() => virtualConfig(options.config()));
10090
10228
  const virtualizer = useVirtualWindow(computed(() => {
10091
10229
  const items = options.items();
10092
10230
  const retained = options.retain?.() ?? [];
10093
10231
  const initialIndex = options.initialIndex?.() ?? -1;
10094
- const estimateSize = (index) => Math.max(1, finite(config.value.estimateSize, options.estimate?.(items[index]) ?? 36));
10232
+ const estimateSize = collectionEstimator(items, config.value, options.estimate);
10095
10233
  return {
10096
10234
  count: items.length,
10097
10235
  getScrollElement: () => options.viewport.value ?? null,
10098
10236
  getItemKey: (index) => options.key(items[index]),
10099
10237
  estimateSize,
10100
- overscan: Math.max(0, Math.floor(finite(config.value.overscan, 6))),
10101
- initialRect: {
10102
- width: 320,
10103
- height: 320
10104
- },
10105
- initialOffset: () => {
10106
- if (initialIndex < 0 || initialIndex >= items.length) return 0;
10107
- let offset = (estimateSize(initialIndex) - 320) / 2;
10108
- for (let index = 0; index < initialIndex; index++) offset += estimateSize(index);
10109
- return Math.max(0, offset);
10110
- },
10238
+ overscan: collectionOverscan(config.value),
10239
+ initialRect: VIRTUAL_RECT,
10240
+ initialOffset: () => centeredOffset(initialIndex, items.length, estimateSize),
10111
10241
  scrollMargin: margin.value,
10112
- observeElementRect: (instance, callback) => observeElementRect(instance, (rect) => callback({
10113
- width: rect.width || 320,
10114
- height: rect.height || 320
10115
- })),
10116
- rangeExtractor: (range) => {
10117
- const indexes = [...defaultRangeExtractor(range), ...retained];
10118
- return [.../* @__PURE__ */ new Set([...indexes, ...options.include?.(indexes) ?? []])].filter((index) => index >= 0 && index < items.length).sort((a, b) => a - b);
10119
- }
10242
+ observeElementRect: (instance, callback) => observeElementRect(instance, (rect) => callback(fallbackRect(rect))),
10243
+ rangeExtractor: (range) => mergeRange(defaultRangeExtractor(range), retained, items.length, options.include)
10120
10244
  };
10121
10245
  }));
10122
10246
  const flow = computed(() => virtualFlow(virtualizer.value.getVirtualItems(), virtualizer.value.getTotalSize(), margin.value));
@@ -10128,15 +10252,10 @@ function useVirtualCollection(options) {
10128
10252
  if (element === null) virtualizer.value.measureElement(null);
10129
10253
  else if (options.viewport.value && element instanceof HTMLElement && element.isConnected) virtualizer.value.measureElement(element);
10130
10254
  }
10131
- function layoutTop(element) {
10132
- let top = 0;
10133
- for (let node = element; node; node = node.offsetParent) top += node.offsetTop;
10134
- return top;
10135
- }
10136
10255
  async function refresh() {
10137
10256
  const viewport = options.viewport.value;
10138
10257
  const body = options.body.value;
10139
- if (viewport && body?.isConnected) margin.value = Math.max(0, layoutTop(body) - layoutTop(viewport));
10258
+ if (viewport && body?.isConnected) margin.value = scrollMargin(body, viewport);
10140
10259
  virtualizer.value.measure();
10141
10260
  await nextTick();
10142
10261
  for (const child of options.body.value?.children ?? []) measure(child);
@@ -10159,7 +10278,9 @@ function useVirtualCollection(options) {
10159
10278
  watch(() => [config.value.estimateSize, options.items().length], async () => {
10160
10279
  await nextTick();
10161
10280
  const viewport = options.viewport.value;
10162
- if (viewport && viewport.scrollTop > Math.max(0, virtualizer.value.getTotalSize() - viewport.clientHeight)) virtualizer.value.scrollToOffset(Math.max(0, virtualizer.value.getTotalSize() - viewport.clientHeight));
10281
+ if (!viewport) return;
10282
+ const offset = overscrolledOffset(viewport.scrollTop, virtualizer.value.getTotalSize(), viewport.clientHeight);
10283
+ if (offset !== void 0) virtualizer.value.scrollToOffset(offset);
10163
10284
  });
10164
10285
  onScopeDispose(() => {
10165
10286
  if (frame !== void 0) cancelAnimationFrame(frame);
@@ -10176,7 +10297,7 @@ function useVirtualCollection(options) {
10176
10297
  };
10177
10298
  }
10178
10299
  //#endregion
10179
- //#region src/lib/virtual/navigation.ts
10300
+ //#region ../shared/src/lib/virtual/navigation.ts
10180
10301
  function nextEnabled(length, from, step, disabled) {
10181
10302
  for (let index = from; index >= 0 && index < length; index += step) if (!disabled(index)) return index;
10182
10303
  return -1;
@@ -10192,6 +10313,123 @@ function typeaheadMatch(labels, query, current, disabled) {
10192
10313
  return -1;
10193
10314
  }
10194
10315
  //#endregion
10316
+ //#region ../shared/src/types/select.ts
10317
+ function isOptionGroup(item) {
10318
+ return !("value" in item) && "options" in item;
10319
+ }
10320
+ function flattenOptions(items) {
10321
+ return items.flatMap((item) => isOptionGroup(item) ? item.options : [item]);
10322
+ }
10323
+ function choiceKey(value) {
10324
+ return `option:${typeof value}:${value}`;
10325
+ }
10326
+ function choiceRows(items, query, contains) {
10327
+ const result = [];
10328
+ let position = 0;
10329
+ items.forEach((item, groupIndex) => {
10330
+ if (isOptionGroup(item)) {
10331
+ const options = item.options.filter((option) => !query || contains(option.label, query));
10332
+ if (!options.length) return;
10333
+ const group = result.length;
10334
+ result.push({
10335
+ key: `group:${groupIndex}`,
10336
+ label: item.label,
10337
+ position: 0
10338
+ });
10339
+ for (const option of options) result.push({
10340
+ key: choiceKey(option.value),
10341
+ label: option.label,
10342
+ option,
10343
+ group,
10344
+ position: ++position
10345
+ });
10346
+ } else if (!query || contains(item.label, query)) result.push({
10347
+ key: choiceKey(item.value),
10348
+ label: item.label,
10349
+ option: item,
10350
+ position: ++position
10351
+ });
10352
+ });
10353
+ return result;
10354
+ }
10355
+ function choiceSize(rows) {
10356
+ return rows.filter((row) => row.option).length;
10357
+ }
10358
+ function choiceDisabled(rows, index) {
10359
+ return !rows[index]?.option || !!rows[index]?.option?.disabled;
10360
+ }
10361
+ function choiceEstimate(row) {
10362
+ return row.option ? row.option.description ? 54 : 36 : 30;
10363
+ }
10364
+ function choiceGroups(rows, indexes) {
10365
+ return indexes.flatMap((index) => rows[index]?.group === void 0 ? [] : [rows[index].group]);
10366
+ }
10367
+ function selectedChoice(rows, model) {
10368
+ const value = Array.isArray(model) ? model[0] : model;
10369
+ return rows.findIndex((row) => row.option?.value === value && !!row.option);
10370
+ }
10371
+ function choiceAttrs(rows, index, size, id) {
10372
+ const row = rows[index];
10373
+ return {
10374
+ "aria-posinset": row.position,
10375
+ "aria-setsize": size,
10376
+ "aria-describedby": row.group === void 0 ? void 0 : `${id}-${row.group}`
10377
+ };
10378
+ }
10379
+ function enabledChoiceValues(rows) {
10380
+ return rows.flatMap((row) => row.option && !row.option.disabled ? [row.option.value] : []);
10381
+ }
10382
+ function choiceRangeValues(rows, anchor, target) {
10383
+ const start = rows.findIndex((row) => row.option?.value === anchor);
10384
+ if (start < 0) return void 0;
10385
+ return enabledChoiceValues(rows.slice(Math.min(start, target), Math.max(start, target) + 1));
10386
+ }
10387
+ function createChoiceTypeahead(now = () => Date.now()) {
10388
+ let search = "";
10389
+ let searchedAt = 0;
10390
+ return {
10391
+ get search() {
10392
+ return search;
10393
+ },
10394
+ expire() {
10395
+ if (now() - searchedAt > 1e3) search = "";
10396
+ },
10397
+ extend(key) {
10398
+ const time = now();
10399
+ search = (time - searchedAt > 1e3 ? "" : search) + key;
10400
+ searchedAt = time;
10401
+ return search;
10402
+ }
10403
+ };
10404
+ }
10405
+ function choiceKeyAction(event, state) {
10406
+ const { count, current, input, disabled, typeahead } = state;
10407
+ const meta = event.ctrlKey || event.metaKey || event.altKey;
10408
+ typeahead.expire();
10409
+ if ((event.ctrlKey || event.metaKey) && !event.altKey && event.key.toLowerCase() === "a" && !input && state.multiple) return { type: "select-all" };
10410
+ if (meta) return { type: "none" };
10411
+ let target = -1;
10412
+ if (event.key === "ArrowDown") target = nextEnabled(count, current + 1, 1, disabled);
10413
+ else if (event.key === "ArrowUp") target = nextEnabled(count, current < 0 ? count - 1 : current - 1, -1, disabled);
10414
+ else if (event.key === "Home") target = nextEnabled(count, 0, 1, disabled);
10415
+ else if (event.key === "End") target = nextEnabled(count, count - 1, -1, disabled);
10416
+ else if (event.key === "PageDown" || event.key === "PageUp") {
10417
+ const step = event.key === "PageDown" ? 1 : -1;
10418
+ target = nextEnabled(count, Math.max(0, Math.min(count - 1, Math.max(0, current) + step * Math.max(1, Math.floor(state.page / 36)))), step, disabled);
10419
+ } else if (event.key === "Enter" || event.key === " " && !input && !typeahead.search) {
10420
+ if (current < 0 || disabled(current)) return { type: "none" };
10421
+ return {
10422
+ type: "commit",
10423
+ index: current
10424
+ };
10425
+ } else if (!input && event.key.length === 1) target = typeaheadMatch(state.labels(), typeahead.extend(event.key), current, disabled);
10426
+ else return { type: "none" };
10427
+ return {
10428
+ type: "move",
10429
+ target
10430
+ };
10431
+ }
10432
+ //#endregion
10195
10433
  //#region src/lib/reka/useVirtualChoices.ts
10196
10434
  function useVirtualChoices(props) {
10197
10435
  const select = props.kind === "select" ? injectSelectRootContext() : void 0;
@@ -10203,44 +10441,11 @@ function useVirtualChoices(props) {
10203
10441
  const activeKey = shallowRef();
10204
10442
  const id = useId();
10205
10443
  const { contains } = useFilter({ sensitivity: "base" });
10206
- const rows = computed(() => {
10207
- const result = [];
10208
- const query = combobox && !combobox.ignoreFilter.value ? combobox.filterSearch.value : "";
10209
- let position = 0;
10210
- props.options.forEach((item, groupIndex) => {
10211
- if (isOptionGroup(item)) {
10212
- const options = item.options.filter((option) => !query || contains(option.label, query));
10213
- if (!options.length) return;
10214
- const group = result.length;
10215
- result.push({
10216
- key: `group:${groupIndex}`,
10217
- label: item.label,
10218
- position: 0
10219
- });
10220
- for (const option of options) result.push({
10221
- key: `option:${typeof option.value}:${option.value}`,
10222
- label: option.label,
10223
- option,
10224
- group,
10225
- position: ++position
10226
- });
10227
- } else if (!query || contains(item.label, query)) result.push({
10228
- key: `option:${typeof item.value}:${item.value}`,
10229
- label: item.label,
10230
- option: item,
10231
- position: ++position
10232
- });
10233
- });
10234
- return result;
10235
- });
10236
- const size = computed(() => rows.value.filter((row) => row.option).length);
10237
- const disabled = (index) => !rows.value[index]?.option || !!rows.value[index]?.option?.disabled;
10444
+ const rows = computed(() => choiceRows(props.options, combobox && !combobox.ignoreFilter.value ? combobox.filterSearch.value : "", contains));
10445
+ const size = computed(() => choiceSize(rows.value));
10446
+ const disabled = (index) => choiceDisabled(rows.value, index);
10238
10447
  const first = () => nextEnabled(rows.value.length, 0, 1, disabled);
10239
- const selectedIndex = computed(() => {
10240
- const model = select?.modelValue.value ?? listbox?.modelValue.value;
10241
- const value = Array.isArray(model) ? model[0] : model;
10242
- return rows.value.findIndex((row) => row.option?.value === value && !!row.option);
10243
- });
10448
+ const selectedIndex = computed(() => selectedChoice(rows.value, select?.modelValue.value ?? listbox?.modelValue.value));
10244
10449
  const activeIndex = computed(() => rows.value.findIndex((row) => row.key === activeKey.value));
10245
10450
  const collection = useVirtualCollection({
10246
10451
  items: () => rows.value,
@@ -10250,8 +10455,8 @@ function useVirtualChoices(props) {
10250
10455
  config: () => props.virtualize,
10251
10456
  initialIndex: props.kind === "listbox" ? void 0 : () => selectedIndex.value,
10252
10457
  retain: () => [activeIndex.value, selectedIndex.value],
10253
- include: (indexes) => indexes.flatMap((index) => rows.value[index]?.group === void 0 ? [] : [rows.value[index].group]),
10254
- estimate: (row) => row.option ? row.option.description ? 54 : 36 : 30
10458
+ include: (indexes) => choiceGroups(rows.value, indexes),
10459
+ estimate: choiceEstimate
10255
10460
  });
10256
10461
  let generation = 0;
10257
10462
  let disposed = false;
@@ -10273,52 +10478,39 @@ function useVirtualChoices(props) {
10273
10478
  const wrapper = event.target.closest("[data-index]");
10274
10479
  if (wrapper && body.value?.contains(wrapper)) activeKey.value = rows.value[Number(wrapper.dataset.index)]?.key;
10275
10480
  }
10276
- let search = "";
10277
- let searchedAt = 0;
10481
+ const typeahead = createChoiceTypeahead();
10278
10482
  function keydown(event) {
10279
10483
  if (event.isComposing || event.defaultPrevented || select?.disabled?.value || listbox?.disabled.value) return;
10280
- const input = event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement;
10281
- const meta = event.ctrlKey || event.metaKey || event.altKey;
10282
- const current = activeIndex.value;
10283
- if (Date.now() - searchedAt > 1e3) search = "";
10284
- let target = -1;
10285
- if ((event.ctrlKey || event.metaKey) && !event.altKey && event.key.toLowerCase() === "a" && !input && listbox?.multiple.value) {
10286
- event.preventDefault();
10287
- event.stopImmediatePropagation();
10288
- listbox.modelValue.value = rows.value.flatMap((row) => row.option && !row.option.disabled ? [row.option.value] : []);
10484
+ const action = choiceKeyAction(event, {
10485
+ labels: () => rows.value.map((row) => row.label),
10486
+ count: rows.value.length,
10487
+ current: activeIndex.value,
10488
+ input: event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement,
10489
+ multiple: !!listbox?.multiple.value,
10490
+ page: viewport.value?.clientHeight ?? 320,
10491
+ disabled,
10492
+ typeahead
10493
+ });
10494
+ if (action.type === "none") return;
10495
+ event.preventDefault();
10496
+ event.stopImmediatePropagation();
10497
+ if (action.type === "select-all") {
10498
+ listbox.modelValue.value = enabledChoiceValues(rows.value);
10289
10499
  return;
10290
10500
  }
10291
- if (meta) return;
10292
- if (event.key === "ArrowDown") target = nextEnabled(rows.value.length, current + 1, 1, disabled);
10293
- else if (event.key === "ArrowUp") target = nextEnabled(rows.value.length, current < 0 ? rows.value.length - 1 : current - 1, -1, disabled);
10294
- else if (event.key === "Home") target = first();
10295
- else if (event.key === "End") target = nextEnabled(rows.value.length, rows.value.length - 1, -1, disabled);
10296
- else if (event.key === "PageDown" || event.key === "PageUp") {
10297
- const step = event.key === "PageDown" ? 1 : -1;
10298
- target = nextEnabled(rows.value.length, Math.max(0, Math.min(rows.value.length - 1, Math.max(0, current) + step * Math.max(1, Math.floor((viewport.value?.clientHeight ?? 320) / 36)))), step, disabled);
10299
- } else if (event.key === "Enter" || event.key === " " && !input && !search) {
10300
- if (current < 0 || disabled(current)) return;
10301
- event.preventDefault();
10302
- event.stopImmediatePropagation();
10501
+ if (action.type === "commit") {
10303
10502
  if (select) {
10304
- select.onValueChange(rows.value[current].option.value);
10503
+ select.onValueChange(rows.value[action.index].option.value);
10305
10504
  if (!select.multiple.value) select.onOpenChange(false);
10306
- } else highlight(current, false, false).then((element) => element?.click());
10505
+ } else highlight(action.index, false, false).then((element) => element?.click());
10307
10506
  return;
10308
- } else if (!input && event.key.length === 1) {
10309
- const now = Date.now();
10310
- search = (now - searchedAt > 1e3 ? "" : search) + event.key;
10311
- searchedAt = now;
10312
- target = typeaheadMatch(rows.value.map((row) => row.label), search, current, disabled);
10313
- } else return;
10314
- event.preventDefault();
10315
- event.stopImmediatePropagation();
10316
- if (target < 0) return;
10507
+ }
10508
+ if (action.target < 0) return;
10317
10509
  if (event.shiftKey && listbox?.multiple.value && listbox.selectionBehavior?.value === "replace") {
10318
- const start = rows.value.findIndex((row) => row.option?.value === listbox.firstValue?.value);
10319
- if (start >= 0) listbox.modelValue.value = rows.value.slice(Math.min(start, target), Math.max(start, target) + 1).flatMap((row) => row.option && !row.option.disabled ? [row.option.value] : []);
10510
+ const values = choiceRangeValues(rows.value, listbox.firstValue?.value, action.target);
10511
+ if (values) listbox.modelValue.value = values;
10320
10512
  }
10321
- highlight(target);
10513
+ highlight(action.target);
10322
10514
  }
10323
10515
  useEventListener(body, "keydown", keydown, { capture: true });
10324
10516
  useEventListener(() => combobox?.inputElement.value ?? props.input, "keydown", keydown, { capture: true });
@@ -10368,21 +10560,13 @@ function useVirtualChoices(props) {
10368
10560
  generation++;
10369
10561
  stops.forEach((stop) => stop());
10370
10562
  });
10371
- function itemAttrs(index) {
10372
- const row = rows.value[index];
10373
- return {
10374
- "aria-posinset": row.position,
10375
- "aria-setsize": size.value,
10376
- "aria-describedby": row.group === void 0 ? void 0 : `${id}-${row.group}`
10377
- };
10378
- }
10379
10563
  return {
10380
10564
  area,
10381
10565
  body,
10382
10566
  viewport,
10383
10567
  rows,
10384
10568
  ...collection,
10385
- itemAttrs,
10569
+ itemAttrs: (index) => choiceAttrs(rows.value, index, size.value, id),
10386
10570
  labelId: (index) => `${id}-${index}`
10387
10571
  };
10388
10572
  }
@@ -10900,7 +11084,7 @@ var PaginationSize_default = /* @__PURE__ */ defineComponent({
10900
11084
  }
10901
11085
  });
10902
11086
  //#endregion
10903
- //#region src/lib/field-focus.ts
11087
+ //#region ../shared/src/lib/field-focus.ts
10904
11088
  var INTERACTIVE = "button, a, input, textarea, select, [contenteditable], [role=\"button\"]";
10905
11089
  var CONTROL = "input:not([type=\"hidden\"]), textarea";
10906
11090
  function controlOf(node) {
@@ -11191,9 +11375,6 @@ var PaginationJump_default = /* @__PURE__ */ defineComponent({
11191
11375
  });
11192
11376
  //#endregion
11193
11377
  //#region src/components/pagination/composables/usePagination.ts
11194
- function paginationInteger(value, fallback, minimum) {
11195
- return Number.isFinite(value) ? Math.max(minimum, Math.floor(value)) : fallback;
11196
- }
11197
11378
  function usePagination(props, model, sizeModel, change) {
11198
11379
  const total = computed(() => paginationInteger(props.total, 0, 0));
11199
11380
  const pageSize = computed(() => paginationInteger(sizeModel.value, 10, 1));
@@ -11401,7 +11582,7 @@ var PrevNext_default = /* @__PURE__ */ defineComponent({
11401
11582
  return (_ctx, _cache) => {
11402
11583
  return openBlock(), createElementBlock("nav", {
11403
11584
  "aria-label": props.label ?? unref(t).pagination.navLabel,
11404
- class: normalizeClass(unref(cn)("grid gap-4 sm:grid-cols-2", props.class))
11585
+ class: normalizeClass(unref(cn)("grid grid-cols-1 gap-4 sm:grid-cols-2", props.class))
11405
11586
  }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$104);
11406
11587
  };
11407
11588
  }
@@ -11426,7 +11607,7 @@ var prevNextEyebrow = tv({
11426
11607
  });
11427
11608
  //#endregion
11428
11609
  //#region src/components/prev-next/PrevNextLink.vue?vue&type=script&setup=true&lang.ts
11429
- var _hoisted_1$103 = { class: "text-fg font-medium" };
11610
+ var _hoisted_1$103 = { class: "text-fg max-w-full font-medium" };
11430
11611
  //#endregion
11431
11612
  //#region src/components/prev-next/PrevNextLink.vue
11432
11613
  var PrevNextLink_default = /* @__PURE__ */ defineComponent({
@@ -11558,10 +11739,17 @@ var Table_default = /* @__PURE__ */ defineComponent({
11558
11739
  caption: {},
11559
11740
  class: {}
11560
11741
  },
11561
- setup(__props) {
11742
+ setup(__props, { expose: __expose }) {
11562
11743
  const props = __props;
11744
+ const area = shallowRef(null);
11745
+ __expose({
11746
+ viewport: computed(() => area.value?.viewport),
11747
+ instance: computed(() => area.value?.instance)
11748
+ });
11563
11749
  return (_ctx, _cache) => {
11564
11750
  return openBlock(), createBlock(ScrollArea_default, {
11751
+ ref_key: "area",
11752
+ ref: area,
11565
11753
  direction: props.stickyHeader ? "both" : "horizontal",
11566
11754
  class: normalizeClass(unref(cn)(unref(tableWrapper)({
11567
11755
  variant: props.variant,
@@ -11895,11 +12083,18 @@ var TabsList_default = /* @__PURE__ */ defineComponent({
11895
12083
  label: {},
11896
12084
  class: {}
11897
12085
  },
11898
- setup(__props) {
12086
+ setup(__props, { expose: __expose }) {
11899
12087
  const props = __props;
11900
12088
  const { variant, orientation } = useTabsStyle();
12089
+ const area = shallowRef(null);
12090
+ __expose({
12091
+ viewport: computed(() => area.value?.viewport),
12092
+ instance: computed(() => area.value?.instance)
12093
+ });
11901
12094
  return (_ctx, _cache) => {
11902
12095
  return openBlock(), createBlock(ScrollArea_default, {
12096
+ ref_key: "area",
12097
+ ref: area,
11903
12098
  direction: unref(orientation),
11904
12099
  scrollbar: false,
11905
12100
  class: normalizeClass(unref(cn)(unref(tabsScroll)({
@@ -11996,7 +12191,7 @@ var TabsContent_default = /* @__PURE__ */ defineComponent({
11996
12191
  }
11997
12192
  });
11998
12193
  //#endregion
11999
- //#region src/lib/caret.ts
12194
+ //#region ../shared/src/lib/caret.ts
12000
12195
  var MIRRORED = [
12001
12196
  "font-family",
12002
12197
  "font-size",
@@ -12211,38 +12406,741 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
12211
12406
  };
12212
12407
  }
12213
12408
  });
12214
- //#endregion
12215
- //#region ../shared/src/variants/number-input.ts
12216
- var numberInputStepper = tv({
12217
- base: "flex shrink-0 flex-col",
12218
- variants: {
12219
- divided: { true: "border-line border-s" },
12220
- size: {
12221
- sm: "[&_svg]:size-3",
12222
- md: "[&_svg]:size-3",
12223
- lg: "[&_svg]:size-3.5"
12224
- }
12225
- },
12226
- defaultVariants: {
12227
- size: "md",
12228
- divided: true
12409
+ function clamp(value, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFINITY) {
12410
+ return Math.min(max, Math.max(min, value));
12411
+ }
12412
+ function roundToStepPrecision(value, step) {
12413
+ let rounded = value;
12414
+ const text = step.toString();
12415
+ const point = text.indexOf(".");
12416
+ const precision = point >= 0 ? text.length - point : 0;
12417
+ if (precision > 0) {
12418
+ const pow = 10 ** precision;
12419
+ rounded = Math.round(rounded * pow) / pow;
12229
12420
  }
12230
- });
12231
- var numberInputStep = tv({
12232
- base: [
12233
- "hn-interactive hn-state-layer hn-press-none text-muted",
12234
- "flex min-h-0 flex-1 basis-0 items-center justify-center px-1.5 outline-none",
12235
- "disabled:pointer-events-none disabled:opacity-40"
12236
- ],
12237
- variants: { divided: { true: "border-line border-t" } }
12238
- });
12239
- //#endregion
12240
- //#region src/components/number-input/NumberInput.vue
12241
- var NumberInput_default = /* @__PURE__ */ defineComponent({
12242
- name: "HnNumberInput",
12243
- inheritAttrs: false,
12244
- __name: "NumberInput",
12245
- props: {
12421
+ return rounded;
12422
+ }
12423
+ function snapValueToStep(value, minValue, maxValue, step) {
12424
+ const min = Number(minValue);
12425
+ const max = Number(maxValue);
12426
+ const remainder = (value - (Number.isNaN(min) ? 0 : min)) % step;
12427
+ let snapped = roundToStepPrecision(Math.abs(remainder) * 2 >= step ? value + Math.sign(remainder) * (step - Math.abs(remainder)) : value - remainder, step);
12428
+ if (!Number.isNaN(min)) {
12429
+ if (snapped < min) snapped = min;
12430
+ else if (!Number.isNaN(max) && snapped > max) snapped = min + Math.floor(roundToStepPrecision((max - min) / step, step)) * step;
12431
+ } else if (!Number.isNaN(max) && snapped > max) snapped = Math.floor(roundToStepPrecision(max / step, step)) * step;
12432
+ return roundToStepPrecision(snapped, step);
12433
+ }
12434
+ function handleDecimalOperation(operator, left, right) {
12435
+ let result = operator === "+" ? left + right : left - right;
12436
+ if (left % 1 !== 0 || right % 1 !== 0) {
12437
+ const leftDecimals = left.toString().split(".")[1]?.length ?? 0;
12438
+ const rightDecimals = right.toString().split(".")[1]?.length ?? 0;
12439
+ const multiplier = 10 ** Math.max(leftDecimals, rightDecimals);
12440
+ const a = Math.round(left * multiplier);
12441
+ const b = Math.round(right * multiplier);
12442
+ result = (operator === "+" ? a + b : a - b) / multiplier;
12443
+ }
12444
+ return result;
12445
+ }
12446
+ function isNullish(value) {
12447
+ return value === null || value === void 0;
12448
+ }
12449
+ function isNumber(value) {
12450
+ return !isNullish(value) && !Number.isNaN(value);
12451
+ }
12452
+ function resolveNumberFieldLocale(locale, inherited) {
12453
+ return locale || inherited || "en";
12454
+ }
12455
+ function createNumberFieldFormat(locale, options) {
12456
+ return {
12457
+ formatter: new NumberFormatter(locale, options),
12458
+ parser: new NumberParser(locale, options)
12459
+ };
12460
+ }
12461
+ function numberFieldInputMode(format) {
12462
+ return format.formatter.resolvedOptions().maximumFractionDigits > 0 ? "decimal" : "numeric";
12463
+ }
12464
+ function formatNumberFieldValue(value, format) {
12465
+ return isNumber(value) ? format.formatter.format(value) : "";
12466
+ }
12467
+ function clampNumberFieldValue(value, range, format) {
12468
+ const { min, max, step, stepSnapping } = range;
12469
+ const clamped = Number.isNaN(step) || !stepSnapping ? clamp(value, min, max) : snapValueToStep(value, min, max, step);
12470
+ return format.parser.parse(format.formatter.format(clamped));
12471
+ }
12472
+ function nextNumberFieldValue(direction, from, range, format, multiplier = 1) {
12473
+ const { step } = range;
12474
+ const operator = direction === "increase" ? "+" : "-";
12475
+ let next;
12476
+ if (range.stepSnapping && !Number.isNaN(step)) {
12477
+ const snapped = snapValueToStep(from, range.min, range.max, step);
12478
+ if (snapped === from) next = handleDecimalOperation(operator, from, step * multiplier);
12479
+ else {
12480
+ const aligned = direction === "increase" ? snapped > from ? snapped : handleDecimalOperation("+", snapped, step) : snapped < from ? snapped : handleDecimalOperation("-", snapped, step);
12481
+ next = multiplier > 1 ? handleDecimalOperation(operator, aligned, step * (multiplier - 1)) : aligned;
12482
+ }
12483
+ } else next = handleDecimalOperation(operator, from, step * multiplier);
12484
+ return clampNumberFieldValue(next, range, format);
12485
+ }
12486
+ function isNumberFieldAtLimit(direction, value, range, format) {
12487
+ if (!isNumber(value)) return false;
12488
+ const next = nextNumberFieldValue(direction, value, range, format);
12489
+ return direction === "increase" ? next <= value : next >= value;
12490
+ }
12491
+ function stepNumberFieldText(direction, text, range, format, multiplier = 1) {
12492
+ const current = format.parser.parse(text);
12493
+ if (Number.isNaN(current)) return clampNumberFieldValue(range.min ?? 0, range, format);
12494
+ return nextNumberFieldValue(direction, current, range, format, multiplier);
12495
+ }
12496
+ function boundNumberFieldValue(bound, range, format) {
12497
+ const target = bound === "min" ? range.min : range.max;
12498
+ return target === void 0 ? void 0 : clampNumberFieldValue(target, range, format);
12499
+ }
12500
+ function commitNumberFieldText(text, range, format) {
12501
+ const parsed = format.parser.parse(text);
12502
+ return {
12503
+ value: Number.isNaN(parsed) ? void 0 : clampNumberFieldValue(parsed, range, format),
12504
+ reformat: text.length > 0
12505
+ };
12506
+ }
12507
+ function rejectsNumberFieldInput(event, input, range, format) {
12508
+ if (event.isComposing) return false;
12509
+ if (event.inputType.startsWith("delete") || event.inputType.startsWith("history")) return false;
12510
+ const next = input.value.slice(0, input.selectionStart ?? void 0) + (event.data ?? "") + input.value.slice(input.selectionEnd ?? void 0);
12511
+ return !format.parser.isValidPartialNumber(next, range.min, range.max);
12512
+ }
12513
+ function numberFieldKeyAction(event, composing) {
12514
+ if (composing || event.isComposing) return void 0;
12515
+ switch (event.key) {
12516
+ case "ArrowUp": return {
12517
+ type: "step",
12518
+ direction: "increase",
12519
+ multiplier: 1,
12520
+ prevent: true
12521
+ };
12522
+ case "ArrowDown": return {
12523
+ type: "step",
12524
+ direction: "decrease",
12525
+ multiplier: 1,
12526
+ prevent: true
12527
+ };
12528
+ case "PageUp": return {
12529
+ type: "step",
12530
+ direction: "increase",
12531
+ multiplier: 10,
12532
+ prevent: true
12533
+ };
12534
+ case "PageDown": return {
12535
+ type: "step",
12536
+ direction: "decrease",
12537
+ multiplier: 10,
12538
+ prevent: true
12539
+ };
12540
+ case "Home": return {
12541
+ type: "bound",
12542
+ bound: "min",
12543
+ prevent: true
12544
+ };
12545
+ case "End": return {
12546
+ type: "bound",
12547
+ bound: "max",
12548
+ prevent: true
12549
+ };
12550
+ case "Enter": return {
12551
+ type: "commit",
12552
+ prevent: false
12553
+ };
12554
+ default: return;
12555
+ }
12556
+ }
12557
+ function numberFieldWheelStep(event, state) {
12558
+ if (state.disabled || !state.focused) return void 0;
12559
+ if (Math.abs(event.deltaY) <= Math.abs(event.deltaX)) return void 0;
12560
+ return event.deltaY > 0 !== state.inverted ? "increase" : "decrease";
12561
+ }
12562
+ function deepActiveElement(root) {
12563
+ let active = root.activeElement;
12564
+ while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
12565
+ return active;
12566
+ }
12567
+ function createNumberFieldPressHold(options) {
12568
+ let handle;
12569
+ let pressed = false;
12570
+ const reset = () => options.timers.clearTimeout(handle);
12571
+ const repeat = (delay) => {
12572
+ reset();
12573
+ if (options.disabled()) return;
12574
+ options.trigger();
12575
+ handle = options.timers.setTimeout(() => repeat(60), delay);
12576
+ };
12577
+ return {
12578
+ press(event) {
12579
+ if (event.button !== 0 || pressed) return;
12580
+ event.preventDefault();
12581
+ pressed = true;
12582
+ options.pressed(true);
12583
+ repeat(400);
12584
+ },
12585
+ release() {
12586
+ pressed = false;
12587
+ options.pressed(false);
12588
+ reset();
12589
+ },
12590
+ dispose: reset
12591
+ };
12592
+ }
12593
+ function numberFieldRootAttributes(state) {
12594
+ return {
12595
+ role: "group",
12596
+ "data-disabled": state.disabled ? "" : void 0,
12597
+ "data-readonly": state.readonly ? "" : void 0
12598
+ };
12599
+ }
12600
+ function numberFieldInputAttributes(state) {
12601
+ return {
12602
+ id: state.id,
12603
+ value: state.value,
12604
+ role: "spinbutton",
12605
+ type: "text",
12606
+ tabindex: "0",
12607
+ inputmode: state.inputMode,
12608
+ disabled: state.disabled ? "" : void 0,
12609
+ "data-disabled": state.disabled ? "" : void 0,
12610
+ readonly: state.readonly ? "" : void 0,
12611
+ "data-readonly": state.readonly ? "" : void 0,
12612
+ autocomplete: "off",
12613
+ autocorrect: "off",
12614
+ spellcheck: "false",
12615
+ "aria-roledescription": "Number field",
12616
+ "aria-valuenow": state.modelValue,
12617
+ "aria-valuemin": state.min,
12618
+ "aria-valuemax": state.max
12619
+ };
12620
+ }
12621
+ function isNumberFieldStepDisabled(state) {
12622
+ return state.disabled || state.readonly || state.own || state.atLimit;
12623
+ }
12624
+ function numberFieldStepAttributes(state) {
12625
+ return {
12626
+ tabindex: "-1",
12627
+ "aria-label": state.direction === "increase" ? "Increase" : "Decrease",
12628
+ type: state.button ? "button" : void 0,
12629
+ style: { userSelect: state.pressed ? "none" : void 0 },
12630
+ disabled: state.disabled ? "" : void 0,
12631
+ "data-disabled": state.disabled ? "" : void 0,
12632
+ "data-pressed": state.pressed ? "true" : void 0
12633
+ };
12634
+ }
12635
+ //#endregion
12636
+ //#region src/primitives/utils/usePrimitiveElement.ts
12637
+ function usePrimitiveElement() {
12638
+ const primitiveElement = ref();
12639
+ return {
12640
+ primitiveElement,
12641
+ currentElement: computed(() => {
12642
+ const element = primitiveElement.value?.$el;
12643
+ if (element && ["#text", "#comment"].includes(element.nodeName)) return element.nextElementSibling;
12644
+ return element ?? primitiveElement.value;
12645
+ })
12646
+ };
12647
+ }
12648
+ //#endregion
12649
+ //#region src/primitives/utils/useVModel.ts
12650
+ function useVModel$1(props, key, emit, options = {}) {
12651
+ const event = `update:${key}`;
12652
+ const current = () => props[key] !== void 0 ? props[key] : options.defaultValue;
12653
+ if (!options.passive) return computed({
12654
+ get: current,
12655
+ set: (value) => emit(event, value)
12656
+ });
12657
+ const proxy = ref(current());
12658
+ let updating = false;
12659
+ watch(() => props[key], (value) => {
12660
+ if (updating) return;
12661
+ updating = true;
12662
+ proxy.value = value;
12663
+ nextTick(() => updating = false);
12664
+ });
12665
+ watch(proxy, (value) => {
12666
+ if (!updating && value !== props[key]) emit(event, value);
12667
+ });
12668
+ return proxy;
12669
+ }
12670
+ //#endregion
12671
+ //#region src/primitives/visually-hidden/VisuallyHiddenInputBubble.vue
12672
+ var VisuallyHiddenInputBubble_default = /* @__PURE__ */ defineComponent({
12673
+ inheritAttrs: false,
12674
+ __name: "VisuallyHiddenInputBubble",
12675
+ props: {
12676
+ name: {},
12677
+ value: {},
12678
+ checked: {
12679
+ type: Boolean,
12680
+ default: void 0
12681
+ },
12682
+ required: { type: Boolean },
12683
+ disabled: { type: Boolean },
12684
+ feature: { default: "fully-hidden" }
12685
+ },
12686
+ setup(__props) {
12687
+ const props = __props;
12688
+ const { primitiveElement, currentElement } = usePrimitiveElement();
12689
+ const valueState = computed(() => props.checked ?? props.value);
12690
+ watch(valueState, (cur, prev) => {
12691
+ if (!currentElement.value) return;
12692
+ const input = currentElement.value;
12693
+ const setValue = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set;
12694
+ if (setValue && cur !== prev) {
12695
+ const inputEvent = new Event("input", { bubbles: true });
12696
+ const changeEvent = new Event("change", { bubbles: true });
12697
+ setValue.call(input, cur);
12698
+ input.dispatchEvent(inputEvent);
12699
+ input.dispatchEvent(changeEvent);
12700
+ }
12701
+ });
12702
+ return (_ctx, _cache) => {
12703
+ return openBlock(), createBlock(unref(VisuallyHidden), mergeProps({
12704
+ ref_key: "primitiveElement",
12705
+ ref: primitiveElement
12706
+ }, {
12707
+ ...props,
12708
+ ..._ctx.$attrs
12709
+ }, { as: "input" }), null, 16);
12710
+ };
12711
+ }
12712
+ });
12713
+ //#endregion
12714
+ //#region src/primitives/visually-hidden/VisuallyHiddenInput.ts
12715
+ var REQUIRED_NOTE = " We render single input if it's required ";
12716
+ var VisuallyHiddenInput_default = defineComponent({
12717
+ name: "VisuallyHiddenInput",
12718
+ inheritAttrs: false,
12719
+ props: {
12720
+ name: {
12721
+ type: String,
12722
+ required: true
12723
+ },
12724
+ value: {
12725
+ type: null,
12726
+ required: true
12727
+ },
12728
+ checked: {
12729
+ type: Boolean,
12730
+ required: false,
12731
+ default: void 0
12732
+ },
12733
+ required: {
12734
+ type: Boolean,
12735
+ required: false
12736
+ },
12737
+ disabled: {
12738
+ type: Boolean,
12739
+ required: false
12740
+ },
12741
+ feature: {
12742
+ type: String,
12743
+ required: false,
12744
+ default: "fully-hidden"
12745
+ }
12746
+ },
12747
+ setup(props, { attrs }) {
12748
+ const isFormArrayEmptyAndRequired = computed(() => Array.isArray(props.value) && props.value.length === 0 && props.required);
12749
+ const parsedValue = computed(() => {
12750
+ const value = props.value;
12751
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null || value === void 0) return [{
12752
+ name: props.name,
12753
+ value
12754
+ }];
12755
+ if (Array.isArray(value)) return value.flatMap((item, index) => typeof item === "object" ? Object.entries(item).map(([key, entry]) => ({
12756
+ name: `${props.name}[${index}][${key}]`,
12757
+ value: entry
12758
+ })) : {
12759
+ name: `${props.name}[${index}]`,
12760
+ value: item
12761
+ });
12762
+ if (typeof value === "object") return Object.entries(value).map(([key, entry]) => ({
12763
+ name: `${props.name}[${key}]`,
12764
+ value: entry
12765
+ }));
12766
+ return [];
12767
+ });
12768
+ return () => h(Fragment, null, [createCommentVNode(REQUIRED_NOTE), isFormArrayEmptyAndRequired.value ? h(VisuallyHiddenInputBubble_default, mergeProps({ key: props.name }, {
12769
+ ...props,
12770
+ ...attrs
12771
+ }, {
12772
+ name: props.name,
12773
+ value: props.value
12774
+ })) : h(Fragment, { key: 1 }, parsedValue.value.map((parsed) => h(VisuallyHiddenInputBubble_default, mergeProps({ key: parsed.name }, {
12775
+ ...props,
12776
+ ...attrs
12777
+ }, {
12778
+ name: parsed.name,
12779
+ value: parsed.value
12780
+ }))))]);
12781
+ }
12782
+ });
12783
+ //#endregion
12784
+ //#region src/primitives/utils/timers.ts
12785
+ var windowTimers = {
12786
+ setTimeout: (callback, delay) => window.setTimeout(callback, delay),
12787
+ clearTimeout: (handle) => window.clearTimeout(handle)
12788
+ };
12789
+ var isClient = typeof window !== "undefined" && typeof document !== "undefined";
12790
+ //#endregion
12791
+ //#region src/primitives/number-field/context.ts
12792
+ var NUMBER_FIELD_ROOT = Symbol("NumberFieldRootContext");
12793
+ function provideNumberFieldRootContext(context) {
12794
+ provide(NUMBER_FIELD_ROOT, context);
12795
+ return context;
12796
+ }
12797
+ function injectNumberFieldRootContext() {
12798
+ const context = inject(NUMBER_FIELD_ROOT, null);
12799
+ if (!context) throw new Error("Injection `Symbol(NumberFieldRootContext)` not found. Component must be used within `NumberFieldRoot`");
12800
+ return context;
12801
+ }
12802
+ function useNumberFieldStep(direction, props) {
12803
+ const root = injectNumberFieldRootContext();
12804
+ const isDisabled = computed(() => isNumberFieldStepDisabled({
12805
+ disabled: root.disabled.value,
12806
+ readonly: root.readonly.value,
12807
+ own: !!props.disabled,
12808
+ atLimit: direction === "increase" ? root.isIncreaseDisabled.value : root.isDecreaseDisabled.value
12809
+ }));
12810
+ const { primitiveElement, currentElement } = usePrimitiveElement();
12811
+ const isPressed = ref(false);
12812
+ const hold = createNumberFieldPressHold({
12813
+ timers: windowTimers,
12814
+ disabled: () => isDisabled.value,
12815
+ trigger: () => root.step(direction),
12816
+ pressed: (pressed) => isPressed.value = pressed
12817
+ });
12818
+ if (isClient) {
12819
+ watch(currentElement, (element, _, onCleanup) => {
12820
+ if (!element) return;
12821
+ element.addEventListener("pointerdown", hold.press);
12822
+ onCleanup(() => element.removeEventListener("pointerdown", hold.press));
12823
+ }, {
12824
+ immediate: true,
12825
+ flush: "post"
12826
+ });
12827
+ window.addEventListener("pointerup", hold.release);
12828
+ window.addEventListener("pointercancel", hold.release);
12829
+ onScopeDispose(() => {
12830
+ window.removeEventListener("pointerup", hold.release);
12831
+ window.removeEventListener("pointercancel", hold.release);
12832
+ });
12833
+ }
12834
+ return {
12835
+ primitiveElement,
12836
+ attributes: computed(() => numberFieldStepAttributes({
12837
+ direction,
12838
+ button: props.as === "button",
12839
+ disabled: isDisabled.value,
12840
+ pressed: isPressed.value
12841
+ }))
12842
+ };
12843
+ }
12844
+ //#endregion
12845
+ //#region src/primitives/number-field/NumberFieldRoot.vue
12846
+ var NumberFieldRoot_default = /* @__PURE__ */ defineComponent({
12847
+ inheritAttrs: false,
12848
+ __name: "NumberFieldRoot",
12849
+ props: {
12850
+ defaultValue: { default: void 0 },
12851
+ modelValue: {},
12852
+ min: {},
12853
+ max: {},
12854
+ step: { default: 1 },
12855
+ stepSnapping: {
12856
+ type: Boolean,
12857
+ default: true
12858
+ },
12859
+ focusOnChange: {
12860
+ type: Boolean,
12861
+ default: true
12862
+ },
12863
+ formatOptions: {},
12864
+ locale: {},
12865
+ disabled: { type: Boolean },
12866
+ readonly: { type: Boolean },
12867
+ disableWheelChange: { type: Boolean },
12868
+ invertWheelChange: { type: Boolean },
12869
+ id: {},
12870
+ name: {},
12871
+ required: { type: Boolean },
12872
+ asChild: { type: Boolean },
12873
+ as: { default: "div" }
12874
+ },
12875
+ emits: ["update:modelValue"],
12876
+ setup(__props, { emit: __emit }) {
12877
+ const props = __props;
12878
+ const emits = __emit;
12879
+ const { disabled, readonly, disableWheelChange, invertWheelChange, id } = toRefs(props);
12880
+ const modelValue = useVModel$1(props, "modelValue", emits, {
12881
+ defaultValue: props.defaultValue,
12882
+ passive: props.modelValue === void 0
12883
+ });
12884
+ const { primitiveElement, currentElement } = usePrimitiveElement();
12885
+ const config = injectConfigProviderContext(null);
12886
+ const locale = computed(() => resolveNumberFieldLocale(props.locale, config?.locale?.value));
12887
+ const isFormControl = computed(() => currentElement.value ? Boolean(currentElement.value.closest("form")) : true);
12888
+ const inputEl = ref();
12889
+ const format = computed(() => createNumberFieldFormat(locale.value, props.formatOptions));
12890
+ const range = computed(() => ({
12891
+ min: props.min,
12892
+ max: props.max,
12893
+ step: props.step,
12894
+ stepSnapping: props.stepSnapping
12895
+ }));
12896
+ const isDecreaseDisabled = computed(() => isNumberFieldAtLimit("decrease", modelValue.value, range.value, format.value));
12897
+ const isIncreaseDisabled = computed(() => isNumberFieldAtLimit("increase", modelValue.value, range.value, format.value));
12898
+ const inputMode = computed(() => numberFieldInputMode(format.value));
12899
+ const textValue = computed(() => formatNumberFieldValue(modelValue.value, format.value));
12900
+ const attributes = computed(() => numberFieldRootAttributes({
12901
+ disabled: props.disabled,
12902
+ readonly: props.readonly
12903
+ }));
12904
+ function step(direction, multiplier = 1) {
12905
+ if (props.focusOnChange) inputEl.value?.focus();
12906
+ if (props.disabled || props.readonly) return;
12907
+ modelValue.value = stepNumberFieldText(direction, inputEl.value?.value ?? "", range.value, format.value, multiplier);
12908
+ }
12909
+ function jump(bound) {
12910
+ const next = boundNumberFieldValue(bound, range.value, format.value);
12911
+ if (next !== void 0) modelValue.value = next;
12912
+ }
12913
+ function commit(text) {
12914
+ const { value, reformat } = commitNumberFieldText(text, range.value, format.value);
12915
+ modelValue.value = value;
12916
+ if (inputEl.value) inputEl.value.value = reformat ? textValue.value : text;
12917
+ }
12918
+ const FormInput = () => isFormControl.value && props.name ? h(VisuallyHiddenInput_default, {
12919
+ type: "text",
12920
+ value: modelValue.value,
12921
+ name: props.name,
12922
+ disabled: props.disabled,
12923
+ readonly: props.readonly,
12924
+ required: props.required
12925
+ }) : createCommentVNode("v-if", true);
12926
+ provideNumberFieldRootContext({
12927
+ modelValue,
12928
+ step,
12929
+ jump,
12930
+ commit,
12931
+ inputEl,
12932
+ onInputElement: (element) => inputEl.value = element,
12933
+ inputMode,
12934
+ textValue,
12935
+ range,
12936
+ format,
12937
+ disabled,
12938
+ readonly,
12939
+ disableWheelChange,
12940
+ invertWheelChange,
12941
+ isDecreaseDisabled,
12942
+ isIncreaseDisabled,
12943
+ id
12944
+ });
12945
+ return (_ctx, _cache) => {
12946
+ return openBlock(), createBlock(unref(Primitive), mergeProps({
12947
+ ..._ctx.$attrs,
12948
+ ...attributes.value
12949
+ }, {
12950
+ ref_key: "primitiveElement",
12951
+ ref: primitiveElement,
12952
+ as: __props.as,
12953
+ "as-child": __props.asChild
12954
+ }), {
12955
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default", {
12956
+ modelValue: unref(modelValue),
12957
+ textValue: textValue.value,
12958
+ readonly: unref(readonly)
12959
+ }), createVNode(FormInput)]),
12960
+ _: 3
12961
+ }, 16, ["as", "as-child"]);
12962
+ };
12963
+ }
12964
+ });
12965
+ //#endregion
12966
+ //#region src/primitives/number-field/NumberFieldInput.vue
12967
+ var NumberFieldInput_default = /* @__PURE__ */ defineComponent({
12968
+ __name: "NumberFieldInput",
12969
+ props: {
12970
+ asChild: { type: Boolean },
12971
+ as: { default: "input" }
12972
+ },
12973
+ setup(__props) {
12974
+ const props = __props;
12975
+ const { primitiveElement, currentElement } = usePrimitiveElement();
12976
+ const root = injectNumberFieldRootContext();
12977
+ const composing = ref(false);
12978
+ function handleKeydown(event) {
12979
+ const action = numberFieldKeyAction(event, composing.value);
12980
+ if (!action) return;
12981
+ if (action.prevent) event.preventDefault();
12982
+ if (action.type === "step") root.step(action.direction, action.multiplier);
12983
+ else if (action.type === "bound") root.jump(action.bound);
12984
+ else root.commit(event.target?.value);
12985
+ }
12986
+ function handleWheel(event) {
12987
+ const direction = numberFieldWheelStep(event, {
12988
+ focused: event.target === deepActiveElement(document),
12989
+ disabled: root.disableWheelChange.value,
12990
+ inverted: root.invertWheelChange.value
12991
+ });
12992
+ if (!direction) return;
12993
+ event.preventDefault();
12994
+ root.step(direction);
12995
+ }
12996
+ function handleBeforeInput(event) {
12997
+ const input = event.target;
12998
+ if (rejectsNumberFieldInput(event, input, root.range.value, root.format.value)) event.preventDefault();
12999
+ }
13000
+ function handleInput(event) {
13001
+ inputValue.value = event.target.value;
13002
+ }
13003
+ function handleChange() {
13004
+ requestAnimationFrame(() => {
13005
+ inputValue.value = root.textValue.value;
13006
+ });
13007
+ }
13008
+ function handleBlur(event) {
13009
+ root.commit(event.target?.value);
13010
+ }
13011
+ function handleCompositionEnd() {
13012
+ nextTick(() => {
13013
+ composing.value = false;
13014
+ });
13015
+ }
13016
+ onMounted(() => {
13017
+ root.onInputElement(currentElement.value);
13018
+ });
13019
+ const inputValue = ref(root.textValue.value);
13020
+ watch(() => root.textValue.value, () => {
13021
+ inputValue.value = root.textValue.value;
13022
+ }, {
13023
+ immediate: true,
13024
+ deep: true
13025
+ });
13026
+ const attributes = computed(() => numberFieldInputAttributes({
13027
+ id: root.id.value,
13028
+ value: inputValue.value,
13029
+ inputMode: root.inputMode.value,
13030
+ disabled: root.disabled.value,
13031
+ readonly: root.readonly.value,
13032
+ modelValue: root.modelValue.value,
13033
+ min: root.range.value.min,
13034
+ max: root.range.value.max
13035
+ }));
13036
+ return (_ctx, _cache) => {
13037
+ return openBlock(), createBlock(unref(Primitive), mergeProps({
13038
+ ...props,
13039
+ ...attributes.value
13040
+ }, {
13041
+ ref_key: "primitiveElement",
13042
+ ref: primitiveElement,
13043
+ onKeydown: handleKeydown,
13044
+ onWheel: handleWheel,
13045
+ onBeforeinput: handleBeforeInput,
13046
+ onInput: handleInput,
13047
+ onChange: handleChange,
13048
+ onBlur: handleBlur,
13049
+ onCompositionstart: _cache[0] || (_cache[0] = ($event) => composing.value = true),
13050
+ onCompositionend: handleCompositionEnd
13051
+ }), {
13052
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
13053
+ _: 3
13054
+ }, 16);
13055
+ };
13056
+ }
13057
+ });
13058
+ //#endregion
13059
+ //#region src/primitives/number-field/NumberFieldIncrement.vue
13060
+ var NumberFieldIncrement_default = /* @__PURE__ */ defineComponent({
13061
+ __name: "NumberFieldIncrement",
13062
+ props: {
13063
+ disabled: { type: Boolean },
13064
+ asChild: { type: Boolean },
13065
+ as: { default: "button" }
13066
+ },
13067
+ setup(__props) {
13068
+ const props = __props;
13069
+ const { primitiveElement, attributes } = useNumberFieldStep("increase", props);
13070
+ return (_ctx, _cache) => {
13071
+ return openBlock(), createBlock(unref(Primitive), mergeProps({
13072
+ ...props,
13073
+ ...unref(attributes)
13074
+ }, {
13075
+ ref_key: "primitiveElement",
13076
+ ref: primitiveElement,
13077
+ onContextmenu: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
13078
+ }), {
13079
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
13080
+ _: 3
13081
+ }, 16);
13082
+ };
13083
+ }
13084
+ });
13085
+ //#endregion
13086
+ //#region src/primitives/number-field/NumberFieldDecrement.vue
13087
+ var NumberFieldDecrement_default = /* @__PURE__ */ defineComponent({
13088
+ __name: "NumberFieldDecrement",
13089
+ props: {
13090
+ disabled: { type: Boolean },
13091
+ asChild: { type: Boolean },
13092
+ as: { default: "button" }
13093
+ },
13094
+ setup(__props) {
13095
+ const props = __props;
13096
+ const { primitiveElement, attributes } = useNumberFieldStep("decrease", props);
13097
+ return (_ctx, _cache) => {
13098
+ return openBlock(), createBlock(unref(Primitive), mergeProps({
13099
+ ...props,
13100
+ ...unref(attributes)
13101
+ }, {
13102
+ ref_key: "primitiveElement",
13103
+ ref: primitiveElement,
13104
+ onContextmenu: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
13105
+ }), {
13106
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
13107
+ _: 3
13108
+ }, 16);
13109
+ };
13110
+ }
13111
+ });
13112
+ //#endregion
13113
+ //#region ../shared/src/variants/number-input.ts
13114
+ var numberInputStepper = tv({
13115
+ base: "flex shrink-0 flex-col",
13116
+ variants: {
13117
+ divided: { true: "border-line border-s" },
13118
+ size: {
13119
+ sm: "[&_svg]:size-3",
13120
+ md: "[&_svg]:size-3",
13121
+ lg: "[&_svg]:size-3.5"
13122
+ }
13123
+ },
13124
+ defaultVariants: {
13125
+ size: "md",
13126
+ divided: true
13127
+ }
13128
+ });
13129
+ var numberInputStep = tv({
13130
+ base: [
13131
+ "hn-interactive hn-state-layer hn-press-none text-muted",
13132
+ "flex min-h-0 flex-1 basis-0 items-center justify-center px-1.5 outline-none",
13133
+ "disabled:pointer-events-none disabled:opacity-40"
13134
+ ],
13135
+ variants: { divided: { true: "border-line border-t" } }
13136
+ });
13137
+ //#endregion
13138
+ //#region src/components/number-input/NumberInput.vue
13139
+ var NumberInput_default = /* @__PURE__ */ defineComponent({
13140
+ name: "HnNumberInput",
13141
+ inheritAttrs: false,
13142
+ __name: "NumberInput",
13143
+ props: {
12246
13144
  modelValue: {},
12247
13145
  defaultValue: {},
12248
13146
  min: {},
@@ -12288,7 +13186,7 @@ var NumberInput_default = /* @__PURE__ */ defineComponent({
12288
13186
  readonly: props.readonly
12289
13187
  }), emits);
12290
13188
  return (_ctx, _cache) => {
12291
- return openBlock(), createBlock(unref(NumberFieldRoot), mergeProps(unref(forwarded), {
13189
+ return openBlock(), createBlock(unref(NumberFieldRoot_default), mergeProps(unref(forwarded), {
12292
13190
  locale: props.locale ?? unref(t).tag,
12293
13191
  disabled: unref(disabled),
12294
13192
  "data-hn-number-input": "",
@@ -12299,7 +13197,7 @@ var NumberInput_default = /* @__PURE__ */ defineComponent({
12299
13197
  size: props.size
12300
13198
  }), props.class)
12301
13199
  }), {
12302
- default: withCtx(() => [createVNode(unref(NumberFieldInput), mergeProps(_ctx.$attrs, {
13200
+ default: withCtx(() => [createVNode(unref(NumberFieldInput_default), mergeProps(_ctx.$attrs, {
12303
13201
  id: unref(fieldId),
12304
13202
  "aria-invalid": unref(invalid) || void 0,
12305
13203
  "aria-describedby": unref(describedBy),
@@ -12315,13 +13213,13 @@ var NumberInput_default = /* @__PURE__ */ defineComponent({
12315
13213
  size: size.value,
12316
13214
  divided: divided.value
12317
13215
  }))
12318
- }, [createVNode(unref(NumberFieldIncrement), {
13216
+ }, [createVNode(unref(NumberFieldIncrement_default), {
12319
13217
  "aria-label": unref(t).numberInput.increase,
12320
13218
  class: normalizeClass(unref(numberInputStep)())
12321
13219
  }, {
12322
13220
  default: withCtx(() => [createVNode(unref(ChevronUp))]),
12323
13221
  _: 1
12324
- }, 8, ["aria-label", "class"]), createVNode(unref(NumberFieldDecrement), {
13222
+ }, 8, ["aria-label", "class"]), createVNode(unref(NumberFieldDecrement_default), {
12325
13223
  "aria-label": unref(t).numberInput.decrease,
12326
13224
  class: normalizeClass(unref(numberInputStep)({ divided: divided.value }))
12327
13225
  }, {
@@ -12364,13 +13262,21 @@ var PasswordInput_default = /* @__PURE__ */ defineComponent({
12364
13262
  "visibleModifiers": {}
12365
13263
  }),
12366
13264
  emits: ["update:modelValue", "update:visible"],
12367
- setup(__props) {
13265
+ setup(__props, { expose: __expose }) {
12368
13266
  const props = __props;
12369
13267
  const model = useModel(__props, "modelValue");
12370
13268
  const visible = useModel(__props, "visible");
12371
13269
  const t = useUiLocale();
13270
+ const base = shallowRef(null);
13271
+ __expose({
13272
+ clear: () => base.value?.clear(),
13273
+ focus: () => base.value?.focus()
13274
+ });
12372
13275
  return (_ctx, _cache) => {
12373
- return openBlock(), createBlock(InputBase_default, mergeProps(_ctx.$attrs, {
13276
+ return openBlock(), createBlock(InputBase_default, mergeProps({
13277
+ ref_key: "base",
13278
+ ref: base
13279
+ }, _ctx.$attrs, {
12374
13280
  modelValue: model.value,
12375
13281
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => model.value = $event),
12376
13282
  type: visible.value ? "text" : "password",
@@ -12430,7 +13336,7 @@ var SearchInput_default = /* @__PURE__ */ defineComponent({
12430
13336
  "modelModifiers": {}
12431
13337
  }),
12432
13338
  emits: /*@__PURE__*/ mergeModels(["search", "clear"], ["update:modelValue"]),
12433
- setup(__props, { emit: __emit }) {
13339
+ setup(__props, { expose: __expose, emit: __emit }) {
12434
13340
  const props = __props;
12435
13341
  const emit = __emit;
12436
13342
  const model = useModel(__props, "modelValue");
@@ -12440,8 +13346,15 @@ var SearchInput_default = /* @__PURE__ */ defineComponent({
12440
13346
  model.value = "";
12441
13347
  emit("clear");
12442
13348
  }
13349
+ const base = shallowRef(null);
13350
+ __expose({
13351
+ clear: () => base.value?.clear(),
13352
+ focus: () => base.value?.focus()
13353
+ });
12443
13354
  return (_ctx, _cache) => {
12444
13355
  return openBlock(), createBlock(InputBase_default, mergeProps({
13356
+ ref_key: "base",
13357
+ ref: base,
12445
13358
  type: "search",
12446
13359
  enterkeyhint: "search"
12447
13360
  }, _ctx.$attrs, {
@@ -12707,7 +13620,7 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
12707
13620
  "aria-invalid",
12708
13621
  "class"
12709
13622
  ]),
12710
- props.name ? (openBlock(), createBlock(VisuallyHidden_default, {
13623
+ props.name ? (openBlock(), createBlock(unref(VisuallyHidden), {
12711
13624
  key: 0,
12712
13625
  "as-child": ""
12713
13626
  }, {
@@ -13785,12 +14698,10 @@ var CommandPaletteItem_default = /* @__PURE__ */ defineComponent({
13785
14698
  }
13786
14699
  });
13787
14700
  //#endregion
13788
- //#region src/components/command-palette/types.ts
13789
- function isCommandGroup(entry) {
14701
+ //#region ../shared/src/lib/command-palette/match.ts
14702
+ function isGroup(entry) {
13790
14703
  return "items" in entry;
13791
14704
  }
13792
- //#endregion
13793
- //#region src/components/command-palette/utils/match.ts
13794
14705
  function score(item, query) {
13795
14706
  if (!query) return {
13796
14707
  item,
@@ -13860,7 +14771,7 @@ function filterCommands(items, query) {
13860
14771
  loose = [];
13861
14772
  };
13862
14773
  for (const entry of items) {
13863
- if (!isCommandGroup(entry)) {
14774
+ if (!isGroup(entry)) {
13864
14775
  loose.push(entry);
13865
14776
  continue;
13866
14777
  }
@@ -14018,7 +14929,7 @@ var CommandPalettePanel_default = /* @__PURE__ */ defineComponent({
14018
14929
  }
14019
14930
  });
14020
14931
  //#endregion
14021
- //#region src/components/command-palette/utils/hotkey.ts
14932
+ //#region ../shared/src/lib/command-palette/hotkey.ts
14022
14933
  function parseHotkey(spec) {
14023
14934
  const parts = spec.toLowerCase().split("+").map((part) => part.trim()).filter(Boolean);
14024
14935
  const modifiers = parts.slice(0, -1);
@@ -14502,13 +15413,56 @@ var TreeCheck_default = /* @__PURE__ */ defineComponent({
14502
15413
  }
14503
15414
  });
14504
15415
  //#endregion
15416
+ //#region ../shared/src/lib/virtual/tree.ts
15417
+ function virtualTreeDisabled(rows, index, rootDisabled, disabled) {
15418
+ const row = rows[index];
15419
+ return !row || rootDisabled || (disabled?.(row.value) ?? !!row.value.disabled);
15420
+ }
15421
+ function virtualTreeKeyTarget(event, state) {
15422
+ const { rows, current, expanded, disabled } = state;
15423
+ if (event.ctrlKey || event.metaKey || event.altKey) return void 0;
15424
+ const count = rows.length;
15425
+ const item = rows[current];
15426
+ if (event.key === "ArrowDown") return nextEnabled(count, current + 1, 1, disabled);
15427
+ if (event.key === "ArrowUp") return nextEnabled(count, current - 1, -1, disabled);
15428
+ if (event.key === "Home") return nextEnabled(count, 0, 1, disabled);
15429
+ if (event.key === "End") return nextEnabled(count, count - 1, -1, disabled);
15430
+ if (event.key === "PageDown" || event.key === "PageUp") {
15431
+ const step = event.key === "PageDown" ? 1 : -1;
15432
+ return nextEnabled(count, Math.max(0, Math.min(count - 1, current + step * Math.max(1, Math.floor(state.page / 36)))), step, disabled);
15433
+ }
15434
+ if (event.key === (state.dir === "rtl" ? "ArrowLeft" : "ArrowRight")) {
15435
+ if (!item?.hasChildren) return void 0;
15436
+ if (!expanded.includes(item._id)) return void 0;
15437
+ const child = nextEnabled(count, current + 1, 1, disabled);
15438
+ return rows[child]?.level === item.level + 1 ? child : -1;
15439
+ }
15440
+ if (event.key === (state.dir === "rtl" ? "ArrowRight" : "ArrowLeft")) {
15441
+ if (!item || expanded.includes(item._id)) return void 0;
15442
+ if (!item.parentItem) return -1;
15443
+ const parent = state.getKey(item.parentItem);
15444
+ return rows.findIndex((row) => row._id === parent);
15445
+ }
15446
+ if (event.key.length === 1 && event.key !== " ") return typeaheadMatch(rows.map((row) => row.value.label), state.typeahead.extend(event.key), current, disabled);
15447
+ }
15448
+ function survivingTreeAncestor(rows, previous, active, getKey) {
15449
+ let removed = previous?.find((row) => row._id === active);
15450
+ let target = -1;
15451
+ while (removed?.parentItem && target < 0) {
15452
+ const parent = getKey(removed.parentItem);
15453
+ target = rows.findIndex((row) => row._id === parent);
15454
+ removed = previous?.find((row) => row._id === parent);
15455
+ }
15456
+ return target;
15457
+ }
15458
+ //#endregion
14505
15459
  //#region src/lib/reka/useVirtualTree.ts
14506
15460
  function useVirtualTree(props, viewport) {
14507
15461
  const root = injectTreeRootContext();
14508
15462
  const body = shallowRef();
14509
15463
  const active = shallowRef();
14510
15464
  const index = computed(() => props.items.findIndex((item) => item._id === active.value));
14511
- const disabled = (i) => !props.items[i] || root.disabled.value || (props.disabled?.(props.items[i].value) ?? !!props.items[i].value.disabled);
15465
+ const disabled = (i) => virtualTreeDisabled(props.items, i, root.disabled.value, props.disabled);
14512
15466
  const selected = computed(() => props.items.findIndex((item) => root.selectedKeys.value.includes(item._id)));
14513
15467
  const collection = useVirtualCollection({
14514
15468
  items: () => props.items,
@@ -14535,34 +15489,20 @@ function useVirtualTree(props, viewport) {
14535
15489
  }
14536
15490
  const first = () => nextEnabled(props.items.length, 0, 1, disabled);
14537
15491
  const last = () => nextEnabled(props.items.length, props.items.length - 1, -1, disabled);
14538
- let search = "";
14539
- let searchedAt = 0;
15492
+ const typeahead = createChoiceTypeahead();
14540
15493
  function keydown(event) {
14541
- if (event.defaultPrevented || event.isComposing || event.ctrlKey || event.metaKey || event.altKey || root.disabled.value) return;
14542
- const current = index.value;
14543
- const item = props.items[current];
14544
- let target = -1;
14545
- if (event.key === "ArrowDown") target = nextEnabled(props.items.length, current + 1, 1, disabled);
14546
- else if (event.key === "ArrowUp") target = nextEnabled(props.items.length, current - 1, -1, disabled);
14547
- else if (event.key === "Home") target = first();
14548
- else if (event.key === "End") target = last();
14549
- else if (event.key === "PageDown" || event.key === "PageUp") {
14550
- const step = event.key === "PageDown" ? 1 : -1;
14551
- target = nextEnabled(props.items.length, Math.max(0, Math.min(props.items.length - 1, current + step * Math.max(1, Math.floor((viewport.value?.clientHeight ?? 320) / 36)))), step, disabled);
14552
- } else if (event.key === (root.dir.value === "rtl" ? "ArrowLeft" : "ArrowRight")) {
14553
- if (!item?.hasChildren) return;
14554
- if (!root.expanded.value.includes(item._id)) return;
14555
- const child = nextEnabled(props.items.length, current + 1, 1, disabled);
14556
- if (props.items[child]?.level === item.level + 1) target = child;
14557
- } else if (event.key === (root.dir.value === "rtl" ? "ArrowRight" : "ArrowLeft")) {
14558
- if (!item || root.expanded.value.includes(item._id)) return;
14559
- if (item.parentItem) target = props.items.findIndex((row) => row._id === root.getKey(item.parentItem));
14560
- } else if (event.key.length === 1 && event.key !== " ") {
14561
- const now = Date.now();
14562
- search = (now - searchedAt > 1e3 ? "" : search) + event.key;
14563
- searchedAt = now;
14564
- target = typeaheadMatch(props.items.map((row) => row.value.label), search, current, disabled);
14565
- } else return;
15494
+ if (event.defaultPrevented || event.isComposing || root.disabled.value) return;
15495
+ const target = virtualTreeKeyTarget(event, {
15496
+ rows: props.items,
15497
+ current: index.value,
15498
+ expanded: root.expanded.value,
15499
+ dir: root.dir.value,
15500
+ page: viewport.value?.clientHeight ?? 320,
15501
+ getKey: root.getKey,
15502
+ disabled,
15503
+ typeahead
15504
+ });
15505
+ if (target === void 0) return;
14566
15506
  event.preventDefault();
14567
15507
  event.stopImmediatePropagation();
14568
15508
  focus(target);
@@ -14574,13 +15514,7 @@ function useVirtualTree(props, viewport) {
14574
15514
  });
14575
15515
  watch(() => props.items, (items, old) => {
14576
15516
  if (index.value >= 0 || !active.value) return;
14577
- let removed = old?.find((item) => item._id === active.value);
14578
- let target = -1;
14579
- while (removed?.parentItem && target < 0) {
14580
- const parent = root.getKey(removed.parentItem);
14581
- target = items.findIndex((item) => item._id === parent);
14582
- removed = old?.find((item) => item._id === parent);
14583
- }
15517
+ const target = survivingTreeAncestor(items, old, active.value, root.getKey);
14584
15518
  focus(target >= 0 ? target : first(), body.value?.contains(document.activeElement));
14585
15519
  }, { flush: "pre" });
14586
15520
  watch(viewport, (element) => {
@@ -14703,7 +15637,7 @@ var TreeRows_default = /* @__PURE__ */ defineComponent({
14703
15637
  }
14704
15638
  });
14705
15639
  //#endregion
14706
- //#region src/components/tree/utils/selection.ts
15640
+ //#region ../shared/src/lib/tree/selection.ts
14707
15641
  function indexTree(nodes) {
14708
15642
  const entries = /* @__PURE__ */ new Map();
14709
15643
  function visit(node, parent, disabled = false) {
@@ -14766,29 +15700,48 @@ function toggleChecked(tree, values, value) {
14766
15700
  const next = checkedState(tree, [...checked]);
14767
15701
  return [...[...checked].filter((value) => !tree.entries.has(value)), ...[...tree.entries.keys()].filter((value) => next.get(value).selected)];
14768
15702
  }
15703
+ function treeKey(node) {
15704
+ return `${typeof node.value}:${node.value}`;
15705
+ }
15706
+ function treeStates(tree, multiple, model) {
15707
+ if (multiple) return checkedState(tree, Array.isArray(model) ? model : []);
15708
+ return new Map([...tree.entries].map(([value, entry]) => [value, {
15709
+ selected: value === model,
15710
+ indeterminate: false,
15711
+ disabled: entry.disabled
15712
+ }]));
15713
+ }
15714
+ function selectedTreeNodes(tree, states) {
15715
+ return [...tree.entries.values()].filter((entry) => states.get(entry.node.value)?.selected).map((entry) => entry.node);
15716
+ }
15717
+ function treeKeyMap(tree) {
15718
+ return new Map([...tree.entries].map(([value, entry]) => [treeKey(entry.node), value]));
15719
+ }
15720
+ function expandedTreeKeys(values) {
15721
+ return values.map((value) => treeKey({ value }));
15722
+ }
15723
+ function expandedTreeValues(keys, expanded) {
15724
+ return expanded.flatMap((key) => keys.has(key) ? [keys.get(key)] : []);
15725
+ }
15726
+ function nextTreeModel(tree, multiple, model, value) {
15727
+ return multiple ? toggleChecked(tree, Array.isArray(model) ? model : [], value) : model === value ? null : value;
15728
+ }
14769
15729
  //#endregion
14770
15730
  //#region src/components/tree/composables/useTree.ts
14771
15731
  function useTree(props, model, expandedModel, disabled) {
14772
15732
  const initialExpanded = [...props.defaultExpanded];
14773
15733
  const index = computed(() => indexTree(props.items));
14774
- const states = computed(() => {
14775
- if (props.multiple) return checkedState(index.value, Array.isArray(model.value) ? model.value : []);
14776
- return new Map([...index.value.entries].map(([value, entry]) => [value, {
14777
- selected: value === model.value,
14778
- indeterminate: false,
14779
- disabled: entry.disabled
14780
- }]));
14781
- });
14782
- const selected = computed(() => [...index.value.entries.values()].filter((entry) => states.value.get(entry.node.value)?.selected).map((entry) => entry.node));
14783
- const keys = computed(() => new Map([...index.value.entries].map(([value, entry]) => [key(entry.node), value])));
15734
+ const states = computed(() => treeStates(index.value, props.multiple, model.value));
15735
+ const selected = computed(() => selectedTreeNodes(index.value, states.value));
15736
+ const keys = computed(() => treeKeyMap(index.value));
14784
15737
  const expanded = computed({
14785
- get: () => (expandedModel.value ?? initialExpanded).map((value) => key({ value })),
15738
+ get: () => expandedTreeKeys(expandedModel.value ?? initialExpanded),
14786
15739
  set: (value) => {
14787
- expandedModel.value = value.flatMap((key) => keys.value.has(key) ? [keys.value.get(key)] : []);
15740
+ expandedModel.value = expandedTreeValues(keys.value, value);
14788
15741
  }
14789
15742
  });
14790
15743
  function key(node) {
14791
- return `${typeof node.value}:${node.value}`;
15744
+ return treeKey(node);
14792
15745
  }
14793
15746
  function getChildren(node) {
14794
15747
  return node.children?.length ? node.children : void 0;
@@ -14804,7 +15757,7 @@ function useTree(props, model, expandedModel, disabled) {
14804
15757
  event.preventDefault();
14805
15758
  const node = event.detail.value;
14806
15759
  if (!node || state(node).disabled) return;
14807
- model.value = props.multiple ? toggleChecked(index.value, Array.isArray(model.value) ? model.value : [], node.value) : model.value === node.value ? null : node.value;
15760
+ model.value = nextTreeModel(index.value, props.multiple, model.value, node.value);
14808
15761
  }
14809
15762
  function toggle(node) {
14810
15763
  if (state(node).disabled || !getChildren(node)) return;
@@ -15084,7 +16037,7 @@ var TreeSelectSearch_default = /* @__PURE__ */ defineComponent({
15084
16037
  }
15085
16038
  });
15086
16039
  //#endregion
15087
- //#region src/components/tree-select/types.ts
16040
+ //#region ../shared/src/types/tree-select.ts
15088
16041
  function findNode(nodes, value) {
15089
16042
  for (const node of nodes) {
15090
16043
  if (node.value === value) return node;
@@ -15103,7 +16056,7 @@ function pathTo(nodes, value, trail = []) {
15103
16056
  return null;
15104
16057
  }
15105
16058
  //#endregion
15106
- //#region src/components/tree-select/utils/filterTree.ts
16059
+ //#region ../shared/src/lib/tree-select/filter.ts
15107
16060
  function filterTree(nodes, matches) {
15108
16061
  const children = /* @__PURE__ */ new Map();
15109
16062
  const expanded = [];
@@ -17826,7 +18779,7 @@ var MultiCombobox_default = /* @__PURE__ */ defineComponent({
17826
18779
  }
17827
18780
  });
17828
18781
  //#endregion
17829
- //#region src/lib/date.ts
18782
+ //#region ../shared/src/lib/date.ts
17830
18783
  var TIME_LENGTH = {
17831
18784
  hour: 5,
17832
18785
  minute: 5,
@@ -18042,7 +18995,7 @@ var CalendarHeader_default = /* @__PURE__ */ defineComponent({
18042
18995
  }
18043
18996
  });
18044
18997
  //#endregion
18045
- //#region src/components/calendar/utils/format.ts
18998
+ //#region ../shared/src/lib/calendar/format.ts
18046
18999
  var local = (date) => date.toDate(getLocalTimeZone());
18047
19000
  function formatMonthHeading(tag, date) {
18048
19001
  return new Intl.DateTimeFormat(tag, {
@@ -18891,7 +19844,7 @@ var DatePicker_default = /* @__PURE__ */ defineComponent({
18891
19844
  //#region ../shared/src/variants/date-range-field.ts
18892
19845
  var dateRangeFieldSeparator = tv({ base: "text-faint shrink-0 px-1 select-none" });
18893
19846
  //#endregion
18894
- //#region src/components/date-range-field/utils/validity.ts
19847
+ //#region ../shared/src/lib/date-range-field/validity.ts
18895
19848
  function outside(value, { min, max }) {
18896
19849
  if (!value) return false;
18897
19850
  return !!min && value.compare(min) < 0 || !!max && value.compare(max) > 0;
@@ -19113,7 +20066,7 @@ var rangeCalendarDay = tv({
19113
20066
  ]
19114
20067
  });
19115
20068
  //#endregion
19116
- //#region src/components/range-calendar/utils/limit.ts
20069
+ //#region ../shared/src/lib/range-calendar/limit.ts
19117
20070
  function maximumDaysMatcher(start, end, maximumDays) {
19118
20071
  if (!start || end || !maximumDays) return void 0;
19119
20072
  const reach = maximumDays - 1;
@@ -19898,7 +20851,7 @@ var ratingStar = tv({
19898
20851
  });
19899
20852
  var ratingFill = tv({ base: "absolute inset-y-0 start-0 overflow-hidden" });
19900
20853
  //#endregion
19901
- //#region src/components/rating/utils/fill.ts
20854
+ //#region ../shared/src/lib/rating.ts
19902
20855
  function starFill(value, index) {
19903
20856
  const portion = Math.min(Math.max(value - (index - 1), 0), 1);
19904
20857
  return `${Math.round(portion * 1e3) / 10}%`;
@@ -20126,7 +21079,7 @@ var fileUploadItem = tv({ base: "bg-subtle flex min-w-0 items-center gap-3 round
20126
21079
  var fileUploadThumb = tv({ base: "text-muted flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-sm bg-inset [&>img]:size-full [&>img]:object-cover [&>svg]:size-5" });
20127
21080
  var fileUploadMeta = tv({ base: "flex min-w-0 flex-1 flex-col" });
20128
21081
  //#endregion
20129
- //#region src/components/file-upload/utils/select.ts
21082
+ //#region ../shared/src/lib/file-upload/select.ts
20130
21083
  function matchesAccept(file, accept) {
20131
21084
  if (!accept) return true;
20132
21085
  const name = file.name.toLowerCase();
@@ -20178,7 +21131,7 @@ function selectFiles(current, incoming, rules) {
20178
21131
  };
20179
21132
  }
20180
21133
  //#endregion
20181
- //#region src/components/file-upload/utils/size.ts
21134
+ //#region ../shared/src/lib/file-upload/size.ts
20182
21135
  var UNITS = [
20183
21136
  "byte",
20184
21137
  "kilobyte",
@@ -22048,7 +23001,7 @@ var meterLegend = tv({ base: "flex flex-wrap gap-x-4 gap-y-1 text-sm" });
22048
23001
  var meterLegendItem = tv({ base: "inline-flex items-center gap-1.5" });
22049
23002
  var meterValue = tv({ base: "text-muted tabular-nums" });
22050
23003
  //#endregion
22051
- //#region src/components/meter-group/utils/tones.ts
23004
+ //#region ../shared/src/lib/meter-group.ts
22052
23005
  var METER_TONES = [
22053
23006
  "accent",
22054
23007
  "info",
@@ -22551,7 +23504,7 @@ var bannerIcons = {
22551
23504
  accent: Megaphone
22552
23505
  };
22553
23506
  //#endregion
22554
- //#region src/components/banner/utils/direction.ts
23507
+ //#region ../shared/src/lib/banner.ts
22555
23508
  function stepBetween(previous, next, count) {
22556
23509
  if (count < 2) return 1;
22557
23510
  const from = (previous % count + count) % count;
@@ -23073,12 +24026,12 @@ var MenubarRadioItem_default = /* @__PURE__ */ defineComponent({
23073
24026
  }
23074
24027
  });
23075
24028
  //#endregion
23076
- //#region src/components/form/standard-schema.ts
24029
+ //#region ../shared/src/lib/form/standard-schema.ts
23077
24030
  function isStandardSchema(rules) {
23078
24031
  return typeof rules === "object" && rules !== null && "~standard" in rules;
23079
24032
  }
23080
24033
  //#endregion
23081
- //#region src/components/form/utils/errors.ts
24034
+ //#region ../shared/src/lib/form/errors.ts
23082
24035
  function issueKey(issue) {
23083
24036
  return (issue.path ?? []).map((part) => String(typeof part === "object" && part !== null ? part.key : part)).join(".");
23084
24037
  }
@@ -23102,7 +24055,7 @@ async function runRules(rules, values) {
23102
24055
  return await rules(values);
23103
24056
  }
23104
24057
  //#endregion
23105
- //#region src/components/form/utils/values.ts
24058
+ //#region ../shared/src/lib/form/values.ts
23106
24059
  function isPlain(value) {
23107
24060
  return Object.prototype.toString.call(value) === "[object Object]";
23108
24061
  }
@@ -23121,31 +24074,41 @@ function same(a, b) {
23121
24074
  return false;
23122
24075
  }
23123
24076
  //#endregion
23124
- //#region src/components/form/composables/useForm.ts
23125
- function useForm(options) {
23126
- const found = shallowRef({});
23127
- const touched = ref(/* @__PURE__ */ new Set());
23128
- const submitted = ref(false);
23129
- const submitting = ref(false);
23130
- const server = shallowRef(/* @__PURE__ */ new Map());
24077
+ //#region ../shared/src/behavior/form.ts
24078
+ function createForm(options) {
24079
+ let found = {};
24080
+ let touched = /* @__PURE__ */ new Set();
24081
+ let submitted = false;
24082
+ let submitting = false;
24083
+ let server = /* @__PURE__ */ new Map();
23131
24084
  let pending;
23132
24085
  let validation = 0;
23133
24086
  let submission = 0;
23134
24087
  let initial = snapshot(options.values());
24088
+ let version = 0;
24089
+ const listeners = /* @__PURE__ */ new Set();
24090
+ function notify() {
24091
+ version++;
24092
+ for (const listener of [...listeners]) listener();
24093
+ }
23135
24094
  function shown(key) {
23136
- if (submitted.value || touched.value.has(key)) return true;
24095
+ if (submitted || touched.has(key)) return true;
23137
24096
  return options.validateOn() === "change" && !same(readPath(options.values(), key), readPath(initial, key));
23138
24097
  }
23139
- const errors = computed(() => {
24098
+ function errors() {
23140
24099
  const result = {};
23141
- for (const [key, message] of Object.entries(found.value)) if (key !== "" && shown(key)) result[key] = message;
23142
- for (const [key, entry] of server.value) result[key] = entry.message;
24100
+ for (const [key, message] of Object.entries(found)) if (key !== "" && shown(key)) result[key] = message;
24101
+ for (const [key, entry] of server) result[key] = entry.message;
23143
24102
  return result;
23144
- });
23145
- const formError = computed(() => found.value[""]);
23146
- const invalid = computed(() => Object.keys(errors.value).length > 0 || !!formError.value);
24103
+ }
24104
+ function formError() {
24105
+ return found[""];
24106
+ }
24107
+ function invalid() {
24108
+ return Object.keys(errors()).length > 0 || !!formError();
24109
+ }
23147
24110
  async function validate() {
23148
- const version = ++validation;
24111
+ const current = ++validation;
23149
24112
  const values = snapshot(options.values());
23150
24113
  const rules = options.rules();
23151
24114
  const request = {
@@ -23155,8 +24118,9 @@ function useForm(options) {
23155
24118
  pending = request;
23156
24119
  try {
23157
24120
  const result = await runRules(rules, values);
23158
- if (version !== validation || rules !== options.rules() || !same(values, options.values())) return false;
23159
- found.value = result;
24121
+ if (current !== validation || rules !== options.rules() || !same(values, options.values())) return false;
24122
+ found = result;
24123
+ notify();
23160
24124
  return Object.keys(result).length === 0;
23161
24125
  } finally {
23162
24126
  if (pending === request) pending = void 0;
@@ -23167,31 +24131,39 @@ function useForm(options) {
23167
24131
  validate();
23168
24132
  }
23169
24133
  function touch(name) {
23170
- if (touched.value.has(name)) return;
23171
- touched.value = new Set(touched.value).add(name);
24134
+ if (touched.has(name)) return;
24135
+ touched = new Set(touched).add(name);
24136
+ notify();
23172
24137
  if (options.validateOn() !== "submit") revalidate();
23173
24138
  }
23174
24139
  function onChange() {
23175
24140
  const values = options.values();
23176
- if (server.value.size) {
23177
- const next = new Map(server.value);
24141
+ if (server.size) {
24142
+ const next = new Map(server);
23178
24143
  for (const [key, entry] of next) if (readPath(values, key) !== entry.value) next.delete(key);
23179
- if (next.size !== server.value.size) server.value = next;
24144
+ if (next.size !== server.size) {
24145
+ server = next;
24146
+ notify();
24147
+ }
23180
24148
  }
23181
- if (submitted.value || options.validateOn() !== "submit") revalidate();
24149
+ if (submitted || options.validateOn() !== "submit") revalidate();
23182
24150
  }
23183
24151
  async function submit(handler) {
23184
- if (submitting.value) return false;
23185
- const version = ++submission;
24152
+ if (submitting) return false;
24153
+ const current = ++submission;
23186
24154
  const values = snapshot(options.values());
23187
- submitted.value = true;
23188
- submitting.value = true;
24155
+ submitted = true;
24156
+ submitting = true;
24157
+ notify();
23189
24158
  try {
23190
- if (!await validate() || version !== submission || server.value.size || !same(values, options.values())) return false;
24159
+ if (!await validate() || current !== submission || server.size || !same(values, options.values())) return false;
23191
24160
  await handler?.(options.values());
23192
24161
  return true;
23193
24162
  } finally {
23194
- if (version === submission) submitting.value = false;
24163
+ if (current === submission) {
24164
+ submitting = false;
24165
+ notify();
24166
+ }
23195
24167
  }
23196
24168
  }
23197
24169
  function setErrors(next) {
@@ -23201,25 +24173,35 @@ function useForm(options) {
23201
24173
  message,
23202
24174
  value: readPath(values, key)
23203
24175
  });
23204
- server.value = map;
24176
+ server = map;
24177
+ notify();
23205
24178
  }
23206
24179
  function reset() {
23207
24180
  validation++;
23208
24181
  submission++;
23209
24182
  pending = void 0;
23210
- submitting.value = false;
23211
- found.value = {};
23212
- touched.value = /* @__PURE__ */ new Set();
23213
- submitted.value = false;
23214
- server.value = /* @__PURE__ */ new Map();
24183
+ submitting = false;
24184
+ found = {};
24185
+ touched = /* @__PURE__ */ new Set();
24186
+ submitted = false;
24187
+ server = /* @__PURE__ */ new Map();
23215
24188
  initial = snapshot(options.values());
24189
+ notify();
24190
+ }
24191
+ function subscribe(listener) {
24192
+ listeners.add(listener);
24193
+ return () => {
24194
+ listeners.delete(listener);
24195
+ };
23216
24196
  }
23217
24197
  return {
23218
24198
  errors,
23219
24199
  formError,
23220
24200
  invalid,
23221
- submitted,
23222
- submitting,
24201
+ submitted: () => submitted,
24202
+ submitting: () => submitting,
24203
+ version: () => version,
24204
+ subscribe,
23223
24205
  validate,
23224
24206
  touch,
23225
24207
  onChange,
@@ -23229,6 +24211,34 @@ function useForm(options) {
23229
24211
  };
23230
24212
  }
23231
24213
  //#endregion
24214
+ //#region src/components/form/composables/useForm.ts
24215
+ function useForm(options) {
24216
+ const form = createForm(options);
24217
+ const version = shallowRef(form.version());
24218
+ form.subscribe(() => {
24219
+ version.value = form.version();
24220
+ });
24221
+ function track(read) {
24222
+ return computed(() => {
24223
+ version.value;
24224
+ return read();
24225
+ });
24226
+ }
24227
+ return {
24228
+ errors: track(form.errors),
24229
+ formError: track(form.formError),
24230
+ invalid: track(form.invalid),
24231
+ submitted: track(form.submitted),
24232
+ submitting: track(form.submitting),
24233
+ validate: form.validate,
24234
+ touch: form.touch,
24235
+ onChange: form.onChange,
24236
+ submit: form.submit,
24237
+ setErrors: form.setErrors,
24238
+ reset: form.reset
24239
+ };
24240
+ }
24241
+ //#endregion
23232
24242
  //#region src/components/form/context.ts
23233
24243
  var FORM_KEY = Symbol("hn-form");
23234
24244
  function provideForm(context) {
@@ -23241,7 +24251,7 @@ function injectForm() {
23241
24251
  //#region ../shared/src/variants/form.ts
23242
24252
  var formRoot = tv({ base: "flex flex-col gap-4" });
23243
24253
  //#endregion
23244
- //#region src/components/form/utils/focus.ts
24254
+ //#region ../shared/src/lib/form/focus.ts
23245
24255
  var FOCUSABLE = "input,select,textarea,button,[tabindex],[contenteditable=\"true\"]";
23246
24256
  function focusFirstInvalid(root) {
23247
24257
  const invalid = root.querySelector("[aria-invalid=\"true\"]");
@@ -23406,7 +24416,8 @@ var FormField_default = /* @__PURE__ */ defineComponent({
23406
24416
  const t = useUiLocale();
23407
24417
  const form = injectForm();
23408
24418
  const root = shallowRef(null);
23409
- const hooks = collapseHooks("y", () => root.value);
24419
+ const body = shallowRef(null);
24420
+ const hooks = collapseHooks("y", () => body.value);
23410
24421
  const id = useId();
23411
24422
  const labelId = useId();
23412
24423
  const descriptionId = useId();
@@ -23480,6 +24491,8 @@ var FormField_default = /* @__PURE__ */ defineComponent({
23480
24491
  id: unref(descriptionId),
23481
24492
  class: normalizeClass(unref(formFieldDescription)())
23482
24493
  }, [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(props.description), 1)])], 10, _hoisted_3$20)) : createCommentVNode("", true)], 2)) : createCommentVNode("", true), createElementVNode("div", {
24494
+ ref_key: "body",
24495
+ ref: body,
23483
24496
  "data-hn-form-field-body": "",
23484
24497
  class: normalizeClass(unref(formFieldContent)())
23485
24498
  }, [
@@ -23947,7 +24960,7 @@ var Mark_default = /* @__PURE__ */ defineComponent({
23947
24960
  }
23948
24961
  });
23949
24962
  //#endregion
23950
- //#region src/components/code-block/highlighter.ts
24963
+ //#region ../shared/src/lib/highlighter.ts
23951
24964
  var langLoaders = {
23952
24965
  typescript: () => import("shiki/langs/typescript.mjs"),
23953
24966
  tsx: () => import("shiki/langs/tsx.mjs"),
@@ -24184,7 +25197,7 @@ var DescriptionDetails_default = /* @__PURE__ */ defineComponent({
24184
25197
  }
24185
25198
  });
24186
25199
  //#endregion
24187
- //#region src/components/time/utils/relativeTime.ts
25200
+ //#region ../shared/src/lib/relative-time.ts
24188
25201
  var DIVISIONS = [
24189
25202
  [60, "second"],
24190
25203
  [60, "minute"],
@@ -24871,6 +25884,8 @@ var CollapsibleTrigger_default = /* @__PURE__ */ defineComponent({
24871
25884
  class: {}
24872
25885
  },
24873
25886
  setup(__props) {
25887
+ const root = injectCollapsibleRootContext();
25888
+ root.contentId ||= useId$1(void 0, "reka-collapsible-content");
24874
25889
  const props = __props;
24875
25890
  const slots = useSlots();
24876
25891
  return (_ctx, _cache) => {
@@ -25005,6 +26020,8 @@ var AccordionTrigger_default = /* @__PURE__ */ defineComponent({
25005
26020
  class: {}
25006
26021
  },
25007
26022
  setup(__props) {
26023
+ const root = injectCollapsibleRootContext();
26024
+ root.contentId ||= useId$1(void 0, "reka-collapsible-content");
25008
26025
  const props = __props;
25009
26026
  const slots = useSlots();
25010
26027
  return (_ctx, _cache) => {
@@ -25915,52 +26932,85 @@ var Section_default = /* @__PURE__ */ defineComponent({
25915
26932
  }
25916
26933
  });
25917
26934
  //#endregion
26935
+ //#region ../shared/src/lib/anchor.ts
26936
+ var SCROLL_SPY_OPTIONS = {
26937
+ rootMargin: "0px 0px -15% 0px",
26938
+ threshold: [0, Number.EPSILON]
26939
+ };
26940
+ function anchorEntries(items) {
26941
+ return items.flatMap((item) => [{
26942
+ id: item.id,
26943
+ label: item.label,
26944
+ depth: 0,
26945
+ item
26946
+ }, ...(item.children ?? []).map((child) => ({
26947
+ id: child.id,
26948
+ label: child.label,
26949
+ depth: 1,
26950
+ item: child
26951
+ }))]);
26952
+ }
26953
+ function coveredEntries(entries, visible) {
26954
+ return entries.filter((entry) => visible.has(entry.id));
26955
+ }
26956
+ function coveredSpan(entries, visible) {
26957
+ const rows = entries.flatMap((entry, index) => visible.has(entry.id) ? [index] : []);
26958
+ return rows.length ? `${rows[0] + 1} / ${rows.at(-1) + 2}` : void 0;
26959
+ }
26960
+ function sameTargets(next, previous) {
26961
+ return next.length === previous.length && next.every((entry, index) => entry.id === previous[index]?.id);
26962
+ }
26963
+ function hashTarget(entries) {
26964
+ const hash = decodeURIComponent(location.hash.slice(1));
26965
+ return hash && entries.some((entry) => entry.id === hash) ? hash : void 0;
26966
+ }
26967
+ function spyTargets(entries) {
26968
+ return entries.map(({ id }) => document.getElementById(id));
26969
+ }
26970
+ function applyIntersections(intersecting, observed, current) {
26971
+ for (const entry of observed) if (entry.isIntersecting && entry.intersectionRatio > 0) intersecting.add(entry.target.id);
26972
+ else intersecting.delete(entry.target.id);
26973
+ return intersecting.size ? new Set(intersecting) : new Set(current ? [current] : []);
26974
+ }
26975
+ function jumpToAnchor(event, id) {
26976
+ const el = document.getElementById(id);
26977
+ if (!el) return false;
26978
+ event.preventDefault();
26979
+ el.scrollIntoView({
26980
+ behavior: prefersReducedMotion() ? "auto" : "smooth",
26981
+ block: "start"
26982
+ });
26983
+ history.replaceState(history.state, "", `#${id}`);
26984
+ return true;
26985
+ }
26986
+ //#endregion
25918
26987
  //#region src/components/anchor/composables/useScrollSpy.ts
25919
26988
  function useScrollSpy(entries) {
25920
26989
  const visible = shallowRef(/* @__PURE__ */ new Set());
25921
26990
  const targets = shallowRef([]);
25922
26991
  const intersecting = /* @__PURE__ */ new Set();
25923
- const covered = computed(() => entries().filter((entry) => visible.value.has(entry.id)));
26992
+ const covered = computed(() => coveredEntries(entries(), visible.value));
25924
26993
  const current = computed(() => covered.value[0]?.id);
25925
- const span = computed(() => {
25926
- const rows = entries().flatMap((entry, index) => visible.value.has(entry.id) ? [index] : []);
25927
- return rows.length ? `${rows[0] + 1} / ${rows.at(-1) + 2}` : void 0;
25928
- });
26994
+ const span = computed(() => coveredSpan(entries(), visible.value));
25929
26995
  useIntersectionObserver(targets, (observed) => {
25930
- for (const entry of observed) if (entry.isIntersecting && entry.intersectionRatio > 0) intersecting.add(entry.target.id);
25931
- else intersecting.delete(entry.target.id);
25932
- visible.value = intersecting.size ? new Set(intersecting) : new Set(current.value ? [current.value] : []);
25933
- }, {
25934
- rootMargin: "0px 0px -15% 0px",
25935
- threshold: [0, Number.EPSILON]
25936
- });
25937
- function targetOf(id) {
25938
- return document.getElementById(id);
25939
- }
26996
+ visible.value = applyIntersections(intersecting, observed, current.value);
26997
+ }, SCROLL_SPY_OPTIONS);
25940
26998
  function locate() {
25941
26999
  intersecting.clear();
25942
- targets.value = entries().map(({ id }) => targetOf(id));
27000
+ targets.value = spyTargets(entries());
25943
27001
  }
25944
27002
  onMounted(() => {
25945
- const hash = decodeURIComponent(location.hash.slice(1));
25946
- if (hash && entries().some((entry) => entry.id === hash)) visible.value = /* @__PURE__ */ new Set([hash]);
27003
+ const hash = hashTarget(entries());
27004
+ if (hash) visible.value = /* @__PURE__ */ new Set([hash]);
25947
27005
  locate();
25948
27006
  watch(entries, (next, previous) => {
25949
- if (next.length === previous.length && next.every((entry, index) => entry.id === previous[index]?.id)) return;
27007
+ if (sameTargets(next, previous)) return;
25950
27008
  visible.value = /* @__PURE__ */ new Set();
25951
27009
  locate();
25952
27010
  });
25953
27011
  });
25954
27012
  function jump(event, id) {
25955
- const el = targetOf(id);
25956
- if (!el) return;
25957
- event.preventDefault();
25958
- el.scrollIntoView({
25959
- behavior: prefersReducedMotion() ? "auto" : "smooth",
25960
- block: "start"
25961
- });
25962
- history.replaceState(history.state, "", `#${id}`);
25963
- visible.value = /* @__PURE__ */ new Set([id]);
27013
+ if (jumpToAnchor(event, id)) visible.value = /* @__PURE__ */ new Set([id]);
25964
27014
  }
25965
27015
  return {
25966
27016
  visible,
@@ -25973,58 +27023,57 @@ function useScrollSpy(entries) {
25973
27023
  //#endregion
25974
27024
  //#region src/components/anchor/composables/useAnchor.ts
25975
27025
  function useAnchor(items) {
25976
- const entries = computed(() => items().flatMap((item) => [{
25977
- id: item.id,
25978
- label: item.label,
25979
- depth: 0,
25980
- item
25981
- }, ...(item.children ?? []).map((child) => ({
25982
- id: child.id,
25983
- label: child.label,
25984
- depth: 1,
25985
- item: child
25986
- }))]));
27026
+ const entries = computed(() => anchorEntries(items()));
25987
27027
  return {
25988
27028
  entries,
25989
27029
  ...useScrollSpy(() => entries.value)
25990
27030
  };
25991
27031
  }
25992
27032
  //#endregion
25993
- //#region src/components/anchor/composables/useAnchorFollow.ts
25994
- function useAnchorFollow(root, current, enabled) {
25995
- const viewport = shallowRef();
25996
- let mounted = false;
25997
- let frame = 0;
25998
- let lastCurrent;
25999
- function findViewport(nav, target) {
26000
- const doc = nav.ownerDocument;
26001
- const view = doc.defaultView;
26002
- for (let node = nav; node && node !== doc.body && node !== doc.documentElement; node = node.parentElement) {
26003
- if (node.contains(target)) break;
26004
- if (/^(auto|scroll|overlay)$/.test(view.getComputedStyle(node).overflowY)) return node;
26005
- }
27033
+ //#region ../shared/src/behavior/anchor-follow.ts
27034
+ function findViewport(nav, target) {
27035
+ const doc = nav.ownerDocument;
27036
+ const view = doc.defaultView;
27037
+ for (let node = nav; node && node !== doc.body && node !== doc.documentElement; node = node.parentElement) {
27038
+ if (node.contains(target)) break;
27039
+ if (/^(auto|scroll|overlay)$/.test(view.getComputedStyle(node).overflowY)) return node;
26006
27040
  }
26007
- function follow() {
26008
- frame = 0;
26009
- const nav = root.value;
26010
- const id = current.value;
26011
- if (!enabled() || !nav || !id) return;
27041
+ }
27042
+ function createAnchorFollow() {
27043
+ let lastCurrent;
27044
+ let lastEnd;
27045
+ function follow({ nav, current: id, lastCovered, enabled }) {
27046
+ if (!enabled || !nav || !id) return;
26012
27047
  const target = nav.ownerDocument.getElementById(id);
26013
27048
  const link = nav.querySelector("a[aria-current=\"location\"]");
26014
27049
  if (!target || !link || !link.getClientRects().length) return;
26015
27050
  const port = findViewport(nav, target);
26016
- viewport.value = port;
26017
- const changed = lastCurrent !== void 0 && lastCurrent !== id;
27051
+ const result = { viewport: port };
27052
+ const endId = lastCovered ?? id;
27053
+ const changed = lastCurrent !== void 0 && (lastCurrent !== id || lastEnd !== endId);
26018
27054
  lastCurrent = id;
26019
- if (!port || port.clientHeight <= 0 || port.scrollHeight <= port.clientHeight) return;
27055
+ lastEnd = endId;
27056
+ if (!port || port.clientHeight <= 0 || port.scrollHeight <= port.clientHeight) return result;
26020
27057
  const box = port.getBoundingClientRect();
26021
- const row = link.getBoundingClientRect();
27058
+ let row = link.getBoundingClientRect();
26022
27059
  const scale = port.offsetHeight ? box.height / port.offsetHeight : 1;
26023
- if (scale <= 0) return;
27060
+ if (scale <= 0) return result;
27061
+ if (endId !== id) {
27062
+ const end = nav.querySelector(`a[href="#${CSS.escape(endId)}"]`);
27063
+ if (end?.getClientRects().length) {
27064
+ const bottom = end.getBoundingClientRect().bottom;
27065
+ const height = bottom - row.top;
27066
+ if (height >= row.height && height <= port.clientHeight * scale) row = {
27067
+ top: row.top,
27068
+ bottom,
27069
+ height
27070
+ };
27071
+ }
27072
+ }
26024
27073
  const top = box.top + port.clientTop * scale;
26025
27074
  const bottom = top + port.clientHeight * scale;
26026
- if (row.top >= top && row.bottom <= bottom) return;
26027
- if (row.top <= top && row.bottom >= bottom) return;
27075
+ if (row.top >= top && row.bottom <= bottom) return result;
27076
+ if (row.top <= top && row.bottom >= bottom) return result;
26028
27077
  const style = port.ownerDocument.defaultView.getComputedStyle(port);
26029
27078
  const margin = Math.min(row.height / scale / 2, port.clientHeight / 4);
26030
27079
  const padding = (value) => Math.min(Math.max(0, (port.clientHeight - row.height / scale) / 2), value === "auto" ? margin : (parseFloat(value) || 0) * (value.endsWith("%") ? port.clientHeight / 100 : 1));
@@ -26032,11 +27081,31 @@ function useAnchorFollow(root, current, enabled) {
26032
27081
  const after = padding(style.scrollPaddingBottom);
26033
27082
  const delta = row.height > bottom - top || row.top < top ? (row.top - top) / scale - before : (row.bottom - bottom) / scale + after;
26034
27083
  const next = Math.max(0, Math.min(port.scrollHeight - port.clientHeight, port.scrollTop + delta));
26035
- if (Math.abs(next - port.scrollTop) < 1) return;
27084
+ if (Math.abs(next - port.scrollTop) < 1) return result;
26036
27085
  port.scrollTo({
26037
27086
  top: next,
26038
27087
  behavior: changed && !prefersReducedMotion() ? "smooth" : "instant"
26039
27088
  });
27089
+ return result;
27090
+ }
27091
+ return { follow };
27092
+ }
27093
+ //#endregion
27094
+ //#region src/components/anchor/composables/useAnchorFollow.ts
27095
+ function useAnchorFollow(root, current, lastCovered, enabled) {
27096
+ const viewport = shallowRef();
27097
+ const follower = createAnchorFollow();
27098
+ let mounted = false;
27099
+ let frame = 0;
27100
+ function follow() {
27101
+ frame = 0;
27102
+ const result = follower.follow({
27103
+ nav: root.value,
27104
+ current: current.value,
27105
+ lastCovered: lastCovered.value,
27106
+ enabled: enabled()
27107
+ });
27108
+ if (result) viewport.value = result.viewport;
26040
27109
  }
26041
27110
  function schedule() {
26042
27111
  if (mounted && !frame) frame = requestAnimationFrame(follow);
@@ -26044,6 +27113,7 @@ function useAnchorFollow(root, current, enabled) {
26044
27113
  watch([
26045
27114
  root,
26046
27115
  current,
27116
+ lastCovered,
26047
27117
  enabled
26048
27118
  ], schedule, { flush: "post" });
26049
27119
  useResizeObserver(() => [
@@ -26082,7 +27152,10 @@ var Anchor_default = /* @__PURE__ */ defineComponent({
26082
27152
  props: {
26083
27153
  items: {},
26084
27154
  label: {},
26085
- autoScroll: { type: Boolean },
27155
+ autoScroll: {
27156
+ type: Boolean,
27157
+ default: true
27158
+ },
26086
27159
  class: {}
26087
27160
  },
26088
27161
  emits: ["change"],
@@ -26090,9 +27163,10 @@ var Anchor_default = /* @__PURE__ */ defineComponent({
26090
27163
  const props = __props;
26091
27164
  const emit = __emit;
26092
27165
  const t = useUiLocale();
26093
- const { entries, visible, current, span, jump } = useAnchor(() => props.items);
27166
+ const { entries, visible, covered, current, span, jump } = useAnchor(() => props.items);
27167
+ const lastCovered = computed(() => covered.value.at(-1)?.id);
26094
27168
  const root = useTemplateRef("root");
26095
- useAnchorFollow(root, current, () => props.autoScroll !== false);
27169
+ useAnchorFollow(root, current, lastCovered, () => props.autoScroll);
26096
27170
  watch(current, (id) => emit("change", id), { flush: "post" });
26097
27171
  __expose({ current });
26098
27172
  return (_ctx, _cache) => {
@@ -26656,198 +27730,230 @@ var SidebarTrigger_default = /* @__PURE__ */ defineComponent({
26656
27730
  }
26657
27731
  });
26658
27732
  //#endregion
26659
- //#region src/components/toast/store.ts
27733
+ //#region ../shared/src/behavior/toast.ts
26660
27734
  var MAX_VISIBLE = 5;
26661
27735
  var SETTLE_DELAY = (DURATION.exit + .06) * 1e3;
26662
- var seed = 0;
26663
- var toastState = reactive({ items: [] });
26664
- var timers = /* @__PURE__ */ new Map();
26665
- var pauseReasons = /* @__PURE__ */ new Set();
26666
- function fire(id) {
26667
- timers.delete(id);
26668
- const item = toastState.items.find((t) => t.id === id);
26669
- if (item) close(item, "auto");
26670
- }
26671
- function startTimer(item) {
26672
- stopTimer(item.id);
26673
- if (item.duration <= 0) return;
26674
- const timer = {
26675
- handle: void 0,
26676
- remaining: item.duration,
26677
- startedAt: Date.now()
26678
- };
26679
- timers.set(item.id, timer);
26680
- if (pauseReasons.size === 0) timer.handle = setTimeout(() => fire(item.id), timer.remaining);
26681
- }
26682
- function stopTimer(id) {
26683
- const timer = timers.get(id);
26684
- if (timer?.handle) clearTimeout(timer.handle);
26685
- timers.delete(id);
26686
- }
26687
- function pauseTimers(reason) {
26688
- if (pauseReasons.has(reason)) return;
26689
- const wasRunning = pauseReasons.size === 0;
26690
- pauseReasons.add(reason);
26691
- if (!wasRunning) return;
26692
- for (const timer of timers.values()) {
26693
- if (!timer.handle) continue;
26694
- clearTimeout(timer.handle);
26695
- timer.handle = void 0;
26696
- timer.remaining = Math.max(0, timer.remaining - (Date.now() - timer.startedAt));
26697
- }
26698
- }
26699
- function resumeTimers(reason) {
26700
- pauseReasons.delete(reason);
26701
- if (pauseReasons.size > 0) return;
26702
- for (const [id, timer] of timers) {
26703
- if (timer.handle) continue;
26704
- timer.startedAt = Date.now();
26705
- timer.handle = setTimeout(() => fire(id), timer.remaining);
26706
- }
26707
- }
26708
- function settle(item) {
26709
- const index = toastState.items.indexOf(item);
26710
- if (index >= 0) toastState.items.splice(index, 1);
26711
- }
26712
- function close(item, source) {
26713
- if (!item.open) return;
26714
- item.open = false;
26715
- stopTimer(item.id);
26716
- if (source === "auto") item.onAutoClose?.(item.id);
26717
- item.onDismiss?.(item.id);
26718
- setTimeout(() => settle(item), SETTLE_DELAY);
26719
- }
26720
- function dismiss(id) {
26721
- for (const item of toastState.items) {
26722
- if (id !== void 0 && item.id !== id) continue;
26723
- close(item, "manual");
26724
- }
26725
- }
26726
27736
  function defaultDuration(tone) {
26727
27737
  return tone === "loading" ? 0 : 4e3;
26728
27738
  }
26729
- function push(message, options = {}) {
26730
- const tone = options.tone ?? "neutral";
26731
- const existing = options.id !== void 0 ? toastState.items.find((t) => t.id === options.id) : void 0;
26732
- if (existing && existing.open) {
26733
- existing.tone = tone;
26734
- existing.message = message;
26735
- existing.description = options.description;
26736
- existing.duration = options.duration ?? defaultDuration(tone);
26737
- existing.action = options.action;
26738
- existing.cancel = options.cancel;
26739
- existing.component = options.component ? markRaw(options.component) : void 0;
26740
- existing.componentProps = options.componentProps;
26741
- if (options.onDismiss) existing.onDismiss = options.onDismiss;
26742
- if (options.onAutoClose) existing.onAutoClose = options.onAutoClose;
26743
- startTimer(existing);
26744
- return existing.id;
26745
- }
26746
- if (existing) settle(existing);
26747
- const item = {
26748
- id: options.id ?? ++seed,
26749
- tone,
26750
- message,
26751
- description: options.description,
26752
- duration: options.duration ?? defaultDuration(tone),
26753
- open: true,
26754
- action: options.action,
26755
- cancel: options.cancel,
26756
- component: options.component ? markRaw(options.component) : void 0,
26757
- componentProps: options.componentProps,
26758
- onDismiss: options.onDismiss,
26759
- onAutoClose: options.onAutoClose
26760
- };
26761
- toastState.items.push(item);
26762
- startTimer(item);
26763
- const visible = toastState.items.filter((t) => t.open);
26764
- for (const stale of visible.slice(0, Math.max(0, visible.length - MAX_VISIBLE))) close(stale, "manual");
26765
- return item.id;
26766
- }
26767
27739
  function resolveMessage(input, value) {
26768
27740
  const raw = typeof input === "function" ? input(value) : input;
26769
27741
  if (typeof raw === "string") return { message: raw };
26770
27742
  return raw;
26771
27743
  }
26772
- function promiseToast(promise, messages, options = {}) {
26773
- const id = push(messages.loading, {
26774
- ...options,
26775
- tone: "loading",
26776
- duration: 0
26777
- });
26778
- promise.then((value) => {
26779
- const done = resolveMessage(messages.success, value);
26780
- push(done.message, {
27744
+ function createToastStore(options) {
27745
+ const state = options.state;
27746
+ const wrap = options.raw ?? ((component) => component);
27747
+ const notify = options.notify ?? (() => {});
27748
+ let seed = 0;
27749
+ const timers = /* @__PURE__ */ new Map();
27750
+ const pauseReasons = /* @__PURE__ */ new Set();
27751
+ function fire(id) {
27752
+ timers.delete(id);
27753
+ const item = state.items.find((t) => t.id === id);
27754
+ if (item) close(item, "auto");
27755
+ }
27756
+ function startTimer(item) {
27757
+ stopTimer(item.id);
27758
+ if (item.duration <= 0) return;
27759
+ const timer = {
27760
+ handle: void 0,
27761
+ remaining: item.duration,
27762
+ startedAt: Date.now()
27763
+ };
27764
+ timers.set(item.id, timer);
27765
+ if (pauseReasons.size === 0) timer.handle = setTimeout(() => fire(item.id), timer.remaining);
27766
+ }
27767
+ function stopTimer(id) {
27768
+ const timer = timers.get(id);
27769
+ if (timer?.handle) clearTimeout(timer.handle);
27770
+ timers.delete(id);
27771
+ }
27772
+ function pauseTimers(reason) {
27773
+ if (pauseReasons.has(reason)) return;
27774
+ const wasRunning = pauseReasons.size === 0;
27775
+ pauseReasons.add(reason);
27776
+ if (!wasRunning) return;
27777
+ for (const timer of timers.values()) {
27778
+ if (!timer.handle) continue;
27779
+ clearTimeout(timer.handle);
27780
+ timer.handle = void 0;
27781
+ timer.remaining = Math.max(0, timer.remaining - (Date.now() - timer.startedAt));
27782
+ }
27783
+ }
27784
+ function resumeTimers(reason) {
27785
+ pauseReasons.delete(reason);
27786
+ if (pauseReasons.size > 0) return;
27787
+ for (const [id, timer] of timers) {
27788
+ if (timer.handle) continue;
27789
+ timer.startedAt = Date.now();
27790
+ timer.handle = setTimeout(() => fire(id), timer.remaining);
27791
+ }
27792
+ }
27793
+ function settle(item) {
27794
+ const index = state.items.indexOf(item);
27795
+ if (index >= 0) state.items.splice(index, 1);
27796
+ notify();
27797
+ }
27798
+ function close(item, source) {
27799
+ if (!item.open) return;
27800
+ item.open = false;
27801
+ stopTimer(item.id);
27802
+ notify();
27803
+ if (source === "auto") item.onAutoClose?.(item.id);
27804
+ item.onDismiss?.(item.id);
27805
+ setTimeout(() => settle(item), SETTLE_DELAY);
27806
+ }
27807
+ function dismiss(id) {
27808
+ for (const item of state.items) {
27809
+ if (id !== void 0 && item.id !== id) continue;
27810
+ close(item, "manual");
27811
+ }
27812
+ }
27813
+ function push(message, options = {}) {
27814
+ const tone = options.tone ?? "neutral";
27815
+ const existing = options.id !== void 0 ? state.items.find((t) => t.id === options.id) : void 0;
27816
+ if (existing && existing.open) {
27817
+ existing.tone = tone;
27818
+ existing.message = message;
27819
+ existing.description = options.description;
27820
+ existing.duration = options.duration ?? defaultDuration(tone);
27821
+ existing.action = options.action;
27822
+ existing.cancel = options.cancel;
27823
+ existing.component = options.component ? wrap(options.component) : void 0;
27824
+ existing.componentProps = options.componentProps;
27825
+ if (options.onDismiss) existing.onDismiss = options.onDismiss;
27826
+ if (options.onAutoClose) existing.onAutoClose = options.onAutoClose;
27827
+ startTimer(existing);
27828
+ notify();
27829
+ return existing.id;
27830
+ }
27831
+ if (existing) settle(existing);
27832
+ const item = {
27833
+ id: options.id ?? ++seed,
27834
+ tone,
27835
+ message,
27836
+ description: options.description,
27837
+ duration: options.duration ?? defaultDuration(tone),
27838
+ open: true,
27839
+ action: options.action,
27840
+ cancel: options.cancel,
27841
+ component: options.component ? wrap(options.component) : void 0,
27842
+ componentProps: options.componentProps,
27843
+ onDismiss: options.onDismiss,
27844
+ onAutoClose: options.onAutoClose
27845
+ };
27846
+ state.items.push(item);
27847
+ startTimer(item);
27848
+ notify();
27849
+ const visible = state.items.filter((t) => t.open);
27850
+ for (const stale of visible.slice(0, Math.max(0, visible.length - MAX_VISIBLE))) close(stale, "manual");
27851
+ return item.id;
27852
+ }
27853
+ function promiseToast(promise, messages, options = {}) {
27854
+ const id = push(messages.loading, {
26781
27855
  ...options,
26782
- id,
26783
- tone: "success",
26784
- description: done.description
27856
+ tone: "loading",
27857
+ duration: 0
26785
27858
  });
26786
- }).catch((reason) => {
26787
- const done = resolveMessage(messages.error, reason);
26788
- push(done.message, {
26789
- ...options,
26790
- id,
26791
- tone: "danger",
26792
- description: done.description
27859
+ promise.then((value) => {
27860
+ const done = resolveMessage(messages.success, value);
27861
+ push(done.message, {
27862
+ ...options,
27863
+ id,
27864
+ tone: "success",
27865
+ description: done.description
27866
+ });
27867
+ }).catch((reason) => {
27868
+ const done = resolveMessage(messages.error, reason);
27869
+ push(done.message, {
27870
+ ...options,
27871
+ id,
27872
+ tone: "danger",
27873
+ description: done.description
27874
+ });
26793
27875
  });
26794
- });
26795
- return promise;
27876
+ return promise;
27877
+ }
27878
+ return {
27879
+ toast: Object.assign((message, options) => push(message, options), {
27880
+ success: (message, options) => push(message, {
27881
+ ...options,
27882
+ tone: "success"
27883
+ }),
27884
+ danger: (message, options) => push(message, {
27885
+ ...options,
27886
+ tone: "danger"
27887
+ }),
27888
+ warning: (message, options) => push(message, {
27889
+ ...options,
27890
+ tone: "warning"
27891
+ }),
27892
+ info: (message, options) => push(message, {
27893
+ ...options,
27894
+ tone: "info"
27895
+ }),
27896
+ loading: (message, options) => push(message, {
27897
+ ...options,
27898
+ tone: "loading"
27899
+ }),
27900
+ custom: (component, options) => {
27901
+ const { props: componentProps, ...rest } = options ?? {};
27902
+ return push("", {
27903
+ ...rest,
27904
+ component,
27905
+ componentProps
27906
+ });
27907
+ },
27908
+ promise: promiseToast,
27909
+ dismiss
27910
+ }),
27911
+ dismiss,
27912
+ pauseTimers,
27913
+ resumeTimers
27914
+ };
26796
27915
  }
26797
- var toast = Object.assign((message, options) => push(message, options), {
26798
- success: (message, options) => push(message, {
26799
- ...options,
26800
- tone: "success"
26801
- }),
26802
- danger: (message, options) => push(message, {
26803
- ...options,
26804
- tone: "danger"
26805
- }),
26806
- warning: (message, options) => push(message, {
26807
- ...options,
26808
- tone: "warning"
26809
- }),
26810
- info: (message, options) => push(message, {
26811
- ...options,
26812
- tone: "info"
26813
- }),
26814
- loading: (message, options) => push(message, {
26815
- ...options,
26816
- tone: "loading"
26817
- }),
26818
- custom: (component, options) => {
26819
- const { props: componentProps, ...rest } = options ?? {};
26820
- return push("", {
26821
- ...rest,
26822
- component,
26823
- componentProps
27916
+ //#endregion
27917
+ //#region src/components/toast/store.ts
27918
+ var toastState = reactive({ items: [] });
27919
+ var { toast, dismiss, pauseTimers, resumeTimers } = createToastStore({
27920
+ state: toastState,
27921
+ raw: (component) => markRaw(component)
27922
+ });
27923
+ function toastLayout(open, heightOf) {
27924
+ const map = /* @__PURE__ */ new Map();
27925
+ let offset = 0;
27926
+ for (let i = open.length - 1; i >= 0; i -= 1) {
27927
+ const item = open[i];
27928
+ const index = open.length - 1 - i;
27929
+ map.set(item.id, {
27930
+ index,
27931
+ offset
26824
27932
  });
26825
- },
26826
- promise: promiseToast,
26827
- dismiss
26828
- });
27933
+ offset += (heightOf(item.id) ?? 0) + 12;
27934
+ }
27935
+ return map;
27936
+ }
27937
+ function toastItemStyle(slot, selfHeight, frontHeight) {
27938
+ return {
27939
+ "--hn-t-index": String(slot.index),
27940
+ "--hn-t-offset": `${slot.offset}px`,
27941
+ ...selfHeight ? { "--hn-t-self-h": `${selfHeight}px` } : {},
27942
+ ...frontHeight > 0 ? { "--hn-t-front-h": `${frontHeight}px` } : {}
27943
+ };
27944
+ }
27945
+ function toastCardHeight(body) {
27946
+ return body.offsetHeight + 34;
27947
+ }
26829
27948
  //#endregion
26830
27949
  //#region src/components/toast/composables/useToastLayout.ts
26831
- var GAP = 12;
26832
- var CARD_CHROME_BLOCK = 34;
26833
27950
  function useToastLayout() {
26834
27951
  const heights = reactive(/* @__PURE__ */ new Map());
26835
27952
  const observers = /* @__PURE__ */ new Map();
26836
27953
  const lastLayout = /* @__PURE__ */ new Map();
26837
27954
  const openItems = computed(() => toastState.items.filter((item) => item.open));
26838
27955
  const layout = computed(() => {
26839
- const map = /* @__PURE__ */ new Map();
26840
- const open = openItems.value;
26841
- let offset = 0;
26842
- for (let i = open.length - 1; i >= 0; i -= 1) {
26843
- const item = open[i];
26844
- const index = open.length - 1 - i;
26845
- map.set(item.id, {
26846
- index,
26847
- offset
26848
- });
26849
- offset += (heights.get(item.id) ?? 0) + GAP;
26850
- }
27956
+ const map = toastLayout(openItems.value, (id) => heights.get(id));
26851
27957
  for (const [id, slot] of map) lastLayout.set(id, slot);
26852
27958
  return map;
26853
27959
  });
@@ -26862,14 +27968,7 @@ function useToastLayout() {
26862
27968
  };
26863
27969
  }
26864
27970
  function itemStyle(item) {
26865
- const slot = slotOf(item);
26866
- const selfHeight = heights.get(item.id);
26867
- return {
26868
- "--hn-t-index": String(slot.index),
26869
- "--hn-t-offset": `${slot.offset}px`,
26870
- ...selfHeight ? { "--hn-t-self-h": `${selfHeight}px` } : {},
26871
- ...frontHeight.value > 0 ? { "--hn-t-front-h": `${frontHeight.value}px` } : {}
26872
- };
27971
+ return toastItemStyle(slotOf(item), heights.get(item.id), frontHeight.value);
26873
27972
  }
26874
27973
  function setItemRef(id, refValue) {
26875
27974
  const el = refValue;
@@ -26878,10 +27977,10 @@ function useToastLayout() {
26878
27977
  if (existing?.el === el) return;
26879
27978
  existing?.observer.disconnect();
26880
27979
  const observer = new ResizeObserver(() => {
26881
- heights.set(id, el.offsetHeight + CARD_CHROME_BLOCK);
27980
+ heights.set(id, toastCardHeight(el));
26882
27981
  });
26883
27982
  observer.observe(el);
26884
- heights.set(id, el.offsetHeight + CARD_CHROME_BLOCK);
27983
+ heights.set(id, toastCardHeight(el));
26885
27984
  observers.set(id, {
26886
27985
  observer,
26887
27986
  el
@@ -27095,7 +28194,7 @@ var Toaster_default = /* @__PURE__ */ defineComponent({
27095
28194
  }
27096
28195
  });
27097
28196
  //#endregion
27098
- //#region src/components/spoiler/worklet.ts
28197
+ //#region ../shared/src/behavior/spoiler/worklet.ts
27099
28198
  var workletMain = () => {
27100
28199
  const M = Math;
27101
28200
  const lcgrand = (seed = 1) => (a = 0, b = 1) => a + M.abs(b - a) * (M.imul(48271, seed = M.imul(214013, seed) + 2531011) & 2147483647) / 2147483647;
@@ -27248,7 +28347,7 @@ var workletMain = () => {
27248
28347
  };
27249
28348
  var workletSource = `(${workletMain.toString()})()`;
27250
28349
  //#endregion
27251
- //#region src/components/spoiler/SpoilerPainter.ts
28350
+ //#region ../shared/src/behavior/spoiler/painter.ts
27252
28351
  var isPaintWorkletSupported = typeof CSS !== "undefined" && CSS.paintWorklet !== void 0;
27253
28352
  var workletRegistered = false;
27254
28353
  function registerSpoilerWorklet() {
@@ -27428,7 +28527,7 @@ function useSpoiler(host, hidden, forceFallback) {
27428
28527
  return { usesFallback };
27429
28528
  }
27430
28529
  //#endregion
27431
- //#region src/components/spoiler/utils/irisOrigin.ts
28530
+ //#region ../shared/src/lib/iris-origin.ts
27432
28531
  function irisOrigin(rects, clientX, clientY) {
27433
28532
  const valid = rects.filter((r) => r.width > 0 && r.height > 0);
27434
28533
  if (valid.length === 0) return null;
@@ -27600,7 +28699,7 @@ var ImageGroup_default = /* @__PURE__ */ defineComponent({
27600
28699
  }
27601
28700
  });
27602
28701
  //#endregion
27603
- //#region src/components/scroll-area/scroll-restore.ts
28702
+ //#region ../shared/src/lib/scroll-restore.ts
27604
28703
  var SCROLL_STATE_FIELD = "hnScroll";
27605
28704
  var RESTORE_DEADLINE_MS = 3e3;
27606
28705
  var SAVE_THROTTLE_MS = 500;
@@ -28101,7 +29200,7 @@ var DataTableText_default = /* @__PURE__ */ defineComponent({
28101
29200
  }
28102
29201
  });
28103
29202
  //#endregion
28104
- //#region src/components/data-table/utils.ts
29203
+ //#region ../shared/src/lib/data-table/utils.ts
28105
29204
  function rowId(key) {
28106
29205
  return `${typeof key}:${key}`;
28107
29206
  }
@@ -28527,6 +29626,140 @@ var features = tableFeatures({
28527
29626
  paginatedRowModel: createPaginatedRowModel()
28528
29627
  });
28529
29628
  //#endregion
29629
+ //#region ../shared/src/lib/data-table/state.ts
29630
+ function keyOf(row, field) {
29631
+ return typeof field === "function" ? field(row) : row[field];
29632
+ }
29633
+ function labelOf(row, label, key) {
29634
+ return String(typeof label === "function" ? label(row) : label === void 0 ? key(row) : row[label]);
29635
+ }
29636
+ function valueOf(row, column) {
29637
+ return column.accessor ? column.accessor(row) : row[column.field ?? column.key];
29638
+ }
29639
+ function displayValue(row, column) {
29640
+ const value = valueOf(row, column);
29641
+ return column.format ? column.format(value, row) : value == null ? "—" : String(value);
29642
+ }
29643
+ function compareValues(left, right, collator) {
29644
+ if (typeof left === "number" && typeof right === "number") return left - right;
29645
+ if (left instanceof Date && right instanceof Date) return left.getTime() - right.getTime();
29646
+ return collator.compare(String(left), String(right));
29647
+ }
29648
+ function engineSorting(sorting) {
29649
+ return sorting.map((sort) => ({
29650
+ id: sort.key,
29651
+ desc: sort.desc
29652
+ }));
29653
+ }
29654
+ function modelSorting(sorting) {
29655
+ return sorting.map((sort) => ({
29656
+ key: sort.id,
29657
+ desc: sort.desc
29658
+ }));
29659
+ }
29660
+ function engineSelection(selected) {
29661
+ return Object.fromEntries(selected.map((key) => [rowId(key), true]));
29662
+ }
29663
+ function modelSelection(selection) {
29664
+ return Object.keys(selection).filter((key) => selection[key]).map(rowKey);
29665
+ }
29666
+ function engineColumnFilters(leaves, filters) {
29667
+ return filters.filter((filter) => leaves.some((column) => column.key === filter.key)).map((filter) => ({
29668
+ id: filter.key,
29669
+ value: filter.value
29670
+ }));
29671
+ }
29672
+ function engineGrouping(leaves, grouping) {
29673
+ return grouping.filter((key) => leaves.some((column) => column.key === key));
29674
+ }
29675
+ function engineExpanded(expanded, groups) {
29676
+ return Object.fromEntries([...expanded.map(rowId), ...groups].map((key) => [key, true]));
29677
+ }
29678
+ function engineVisibility(hidden) {
29679
+ return Object.fromEntries(hidden.map((key) => [key, false]));
29680
+ }
29681
+ function engineState(leaves, models, page, pageSize) {
29682
+ return {
29683
+ sorting: engineSorting(models.sorting),
29684
+ globalFilter: models.filter.trim(),
29685
+ columnFilters: engineColumnFilters(leaves, models.columnFilters),
29686
+ grouping: engineGrouping(leaves, models.grouping),
29687
+ expanded: engineExpanded(models.expanded, models.expandedGroups),
29688
+ pagination: {
29689
+ pageIndex: page - 1,
29690
+ pageSize
29691
+ },
29692
+ rowSelection: engineSelection(models.selected),
29693
+ columnVisibility: engineVisibility(models.hiddenColumns)
29694
+ };
29695
+ }
29696
+ function orderColumns(leaves, hidden, order) {
29697
+ const visible = leaves.filter((column) => !hidden.includes(column.key));
29698
+ const ranking = [.../* @__PURE__ */ new Set([...order, ...visible.map((column) => column.key)])];
29699
+ return visible.sort((a, b) => {
29700
+ const rank = (column) => column.pin === "start" ? 0 : column.pin === "end" ? 2 : 1;
29701
+ return rank(a) - rank(b) || ranking.indexOf(a.key) - ranking.indexOf(b.key);
29702
+ });
29703
+ }
29704
+ function toggleKey(list, key, next) {
29705
+ return next ? [.../* @__PURE__ */ new Set([...list, key])] : list.filter((item) => item !== key);
29706
+ }
29707
+ function nextColumnFilters(filters, column, value) {
29708
+ const next = filters.filter((filter) => filter.key !== column);
29709
+ if (value != null && value !== "" && !(Array.isArray(value) && !value.length)) next.push({
29710
+ key: column,
29711
+ value
29712
+ });
29713
+ return next;
29714
+ }
29715
+ function totalRows(manual, total, supplied, processed) {
29716
+ return manual ? Math.max(0, Math.floor(Number.isFinite(total) ? total : supplied)) : processed();
29717
+ }
29718
+ function pageCount(total, pageSize) {
29719
+ return Math.max(1, Math.ceil(total / pageSize));
29720
+ }
29721
+ function canGoNext(knownTotal, page, count, hasNextPage, rows, pageSize) {
29722
+ return knownTotal ? page < count : hasNextPage ?? rows >= pageSize;
29723
+ }
29724
+ function clampedPage(pagination, loading, knownTotal, page, count) {
29725
+ return pagination && !loading && knownTotal && page > count ? count : void 0;
29726
+ }
29727
+ function uniqueSelectable(rows) {
29728
+ return [...new Map(rows.filter((row) => row.getCanSelect()).map((row) => [row.id, row])).values()];
29729
+ }
29730
+ function selectionState(eligible) {
29731
+ if (!eligible.length) return false;
29732
+ const count = eligible.filter((row) => row.getIsSelected()).length;
29733
+ return count === eligible.length ? true : count || eligible.some((row) => row.getIsSomeSelected()) ? "indeterminate" : false;
29734
+ }
29735
+ function toggleSelection(selected, rows, value, cascade, key) {
29736
+ const keys = new Set(selected);
29737
+ for (const row of rows) {
29738
+ const descendants = cascade ? [row, ...row.getLeafRows()] : [row];
29739
+ for (const item of descendants) if (item.getCanSelect()) {
29740
+ if (value === true) keys.add(key(item.original));
29741
+ else keys.delete(key(item.original));
29742
+ }
29743
+ }
29744
+ return [...keys];
29745
+ }
29746
+ function sortLabel(next, messages) {
29747
+ return next === "asc" ? messages.sortAsc : next === "desc" ? messages.sortDesc : messages.sortNone;
29748
+ }
29749
+ function ariaSort(sorting) {
29750
+ return sorting ? sorting === "asc" ? "ascending" : "descending" : void 0;
29751
+ }
29752
+ function tableQuery(page, pageSize, models) {
29753
+ return {
29754
+ page,
29755
+ pageSize,
29756
+ sorting: models.sorting.map((sort) => ({ ...sort })),
29757
+ filter: models.filter,
29758
+ columnFilters: models.columnFilters.map((filter) => ({ ...filter })),
29759
+ grouping: [...models.grouping]
29760
+ };
29761
+ }
29762
+ //#endregion
28530
29763
  //#region src/components/data-table/composables/useDataTable.ts
28531
29764
  function useDataTable(props, models, onChange, onRowClick) {
28532
29765
  const t = useUiLocale();
@@ -28539,27 +29772,24 @@ function useDataTable(props, models, onChange, onRowClick) {
28539
29772
  numeric: true,
28540
29773
  sensitivity: "base"
28541
29774
  }));
28542
- const keyOf = (row) => typeof props.rowKey === "function" ? props.rowKey(row) : row[props.rowKey];
28543
- const labelOf = (row) => String(typeof props.rowLabel === "function" ? props.rowLabel(row) : props.rowLabel === void 0 ? keyOf(row) : row[props.rowLabel]);
28544
- const valueOf = (row, column) => column.accessor ? column.accessor(row) : row[column.field ?? column.key];
29775
+ const keyOf$1 = (row) => keyOf(row, props.rowKey);
29776
+ const labelOf$1 = (row) => labelOf(row, props.rowLabel, keyOf$1);
29777
+ const valueOf$1 = (row, column) => valueOf(row, column);
28545
29778
  const selectable = (row) => typeof props.selectable === "function" ? props.selectable(row) : !!props.selectable;
28546
29779
  const expandable = (row) => typeof props.expandable === "function" ? props.expandable(row) : !!props.expandable;
28547
29780
  const columns = computed(() => {
28548
29781
  const compare = collator.value;
28549
29782
  return leaves.value.map((column) => ({
28550
29783
  id: column.key,
28551
- accessorFn: (row) => valueOf(row, column) ?? void 0,
29784
+ accessorFn: (row) => valueOf$1(row, column) ?? void 0,
28552
29785
  enableSorting: !!column.sortable,
28553
29786
  enableGlobalFilter: column.filterable !== false,
28554
- filterFn: (row, _id, value) => column.filterValue ? column.filterValue(row.original, value) : filterValue(valueOf(row.original, column), value, column.filterMode, t.value.tag),
29787
+ filterFn: (row, _id, value) => column.filterValue ? column.filterValue(row.original, value) : filterValue(valueOf$1(row.original, column), value, column.filterMode, t.value.tag),
28555
29788
  sortDescFirst: false,
28556
29789
  sortUndefined: "last",
28557
29790
  sortFn: (a, b, id) => {
28558
29791
  if (column.sort) return column.sort(a.original, b.original);
28559
- const left = a.getValue(id), right = b.getValue(id);
28560
- if (typeof left === "number" && typeof right === "number") return left - right;
28561
- if (left instanceof Date && right instanceof Date) return left.getTime() - right.getTime();
28562
- return compare.compare(String(left), String(right));
29792
+ return compareValues(a.getValue(id), b.getValue(id), compare);
28563
29793
  }
28564
29794
  }));
28565
29795
  });
@@ -28567,7 +29797,7 @@ function useDataTable(props, models, onChange, onRowClick) {
28567
29797
  features,
28568
29798
  data: computed(() => props.rows),
28569
29799
  columns,
28570
- getRowId: (row) => rowId(keyOf(row)),
29800
+ getRowId: (row) => rowId(keyOf$1(row)),
28571
29801
  getSubRows: (row) => props.getChildren?.(row),
28572
29802
  manualSorting: computed(() => !!props.manual),
28573
29803
  manualFiltering: computed(() => !!props.manual),
@@ -28588,61 +29818,39 @@ function useDataTable(props, models, onChange, onRowClick) {
28588
29818
  const column = leaves.value.find((column) => column.key === id);
28589
29819
  return column.filter ? column.filter(row.original, query) : filterValue(row.getValue(id), query, "contains", t.value.tag);
28590
29820
  },
28591
- state: computed(() => ({
28592
- sorting: models.sorting.value.map((sort) => ({
28593
- id: sort.key,
28594
- desc: sort.desc
28595
- })),
28596
- globalFilter: models.filter.value.trim(),
28597
- columnFilters: models.columnFilters.value.filter((filter) => leaves.value.some((column) => column.key === filter.key)).map((filter) => ({
28598
- id: filter.key,
28599
- value: filter.value
28600
- })),
28601
- grouping: models.grouping.value.filter((key) => leaves.value.some((column) => column.key === key)),
28602
- expanded: Object.fromEntries([...models.expanded.value.map(rowId), ...models.expandedGroups.value].map((key) => [key, true])),
28603
- pagination: {
28604
- pageIndex: page.value - 1,
28605
- pageSize: pageSize.value
28606
- },
28607
- rowSelection: Object.fromEntries(models.selected.value.map((key) => [rowId(key), true])),
28608
- columnVisibility: Object.fromEntries(models.hiddenColumns.value.map((key) => [key, false]))
28609
- })),
29821
+ state: computed(() => engineState(leaves.value, {
29822
+ sorting: models.sorting.value,
29823
+ filter: models.filter.value,
29824
+ columnFilters: models.columnFilters.value,
29825
+ grouping: models.grouping.value,
29826
+ selected: models.selected.value,
29827
+ expanded: models.expanded.value,
29828
+ expandedGroups: models.expandedGroups.value,
29829
+ hiddenColumns: models.hiddenColumns.value
29830
+ }, page.value, pageSize.value)),
28610
29831
  onSortingChange: (updater) => {
28611
29832
  if (blocked.value) return;
28612
- const current = models.sorting.value.map((sort) => ({
28613
- id: sort.key,
28614
- desc: sort.desc
28615
- }));
29833
+ const current = engineSorting(models.sorting.value);
28616
29834
  const next = typeof updater === "function" ? updater(current) : updater;
28617
- models.sorting.value = next.map((sort) => ({
28618
- key: sort.id,
28619
- desc: sort.desc
28620
- }));
29835
+ models.sorting.value = modelSorting(next);
28621
29836
  },
28622
29837
  onRowSelectionChange: (updater) => {
28623
29838
  if (blocked.value) return;
28624
- const current = Object.fromEntries(models.selected.value.map((key) => [rowId(key), true]));
29839
+ const current = engineSelection(models.selected.value);
28625
29840
  const next = typeof updater === "function" ? updater(current) : updater;
28626
- models.selected.value = Object.keys(next).filter((key) => next[key]).map(rowKey);
29841
+ models.selected.value = modelSelection(next);
28627
29842
  }
28628
29843
  });
28629
- const visibleColumns = computed(() => {
28630
- const visible = leaves.value.filter((column) => !models.hiddenColumns.value.includes(column.key));
28631
- const order = [.../* @__PURE__ */ new Set([...models.columnOrder.value, ...visible.map((column) => column.key)])];
28632
- return visible.sort((a, b) => {
28633
- const rank = (column) => column.pin === "start" ? 0 : column.pin === "end" ? 2 : 1;
28634
- return rank(a) - rank(b) || order.indexOf(a.key) - order.indexOf(b.key);
28635
- });
28636
- });
29844
+ const visibleColumns = computed(() => orderColumns(leaves.value, models.hiddenColumns.value, models.columnOrder.value));
28637
29845
  const knownTotal = computed(() => !props.manual || props.total !== void 0);
28638
- const total = computed(() => props.manual ? Math.max(0, Math.floor(Number.isFinite(props.total) ? props.total : props.rows.length)) : table.getPreExpandedRowModel().rows.length);
28639
- const pageCount = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)));
28640
- const canNext = computed(() => knownTotal.value ? page.value < pageCount.value : props.hasNextPage ?? props.rows.length >= pageSize.value);
29846
+ const total = computed(() => totalRows(props.manual, props.total, props.rows.length, () => table.getPreExpandedRowModel().rows.length));
29847
+ const pageCount$1 = computed(() => pageCount(total.value, pageSize.value));
29848
+ const canNext = computed(() => canGoNext(knownTotal.value, page.value, pageCount$1.value, props.hasNextPage, props.rows.length, pageSize.value));
28641
29849
  function toggleExpanded(key, value) {
28642
29850
  if (blocked.value) return;
28643
29851
  if (!table.getCoreRowModel().rowsById[rowId(key)]?.getCanExpand()) return;
28644
29852
  const next = value ?? !models.expanded.value.includes(key);
28645
- models.expanded.value = next ? [.../* @__PURE__ */ new Set([...models.expanded.value, key])] : models.expanded.value.filter((item) => item !== key);
29853
+ models.expanded.value = toggleKey(models.expanded.value, key, next);
28646
29854
  }
28647
29855
  function toggleSelected(key, value) {
28648
29856
  if (blocked.value) return;
@@ -28652,7 +29860,7 @@ function useDataTable(props, models, onChange, onRowClick) {
28652
29860
  const rows = computed(() => table.getRowModel().rows.map((row) => {
28653
29861
  const context = {
28654
29862
  row: row.original,
28655
- key: keyOf(row.original),
29863
+ key: keyOf$1(row.original),
28656
29864
  index: row.index,
28657
29865
  depth: row.depth,
28658
29866
  selected: row.getIsSelected(),
@@ -28660,9 +29868,9 @@ function useDataTable(props, models, onChange, onRowClick) {
28660
29868
  indeterminate: props.selectChildren !== false && row.getIsSomeSelected(),
28661
29869
  expanded: row.getIsExpanded(),
28662
29870
  expandable: row.getCanExpand(),
28663
- toggleSelected: (value) => toggleSelected(keyOf(row.original), value),
28664
- toggleExpanded: (value) => toggleExpanded(keyOf(row.original), value),
28665
- startEdit: (column) => api.startEdit(keyOf(row.original), column)
29871
+ toggleSelected: (value) => toggleSelected(keyOf$1(row.original), value),
29872
+ toggleExpanded: (value) => toggleExpanded(keyOf$1(row.original), value),
29873
+ startEdit: (column) => api.startEdit(keyOf$1(row.original), column)
28666
29874
  };
28667
29875
  const group = row.getIsGrouped() ? {
28668
29876
  key: row.id,
@@ -28674,51 +29882,30 @@ function useDataTable(props, models, onChange, onRowClick) {
28674
29882
  toggleExpanded: (value) => {
28675
29883
  if (blocked.value) return;
28676
29884
  const next = value ?? !models.expandedGroups.value.includes(row.id);
28677
- models.expandedGroups.value = next ? [.../* @__PURE__ */ new Set([...models.expandedGroups.value, row.id])] : models.expandedGroups.value.filter((key) => key !== row.id);
29885
+ models.expandedGroups.value = toggleKey(models.expandedGroups.value, row.id, next);
28678
29886
  },
28679
29887
  aggregate: (key) => {
28680
29888
  const column = leaves.value.find((column) => column.key === key);
28681
- return column ? aggregate(row.getLeafRows().map((leaf) => leaf.original), column, valueOf) : void 0;
29889
+ return column ? aggregate(row.getLeafRows().map((leaf) => leaf.original), column, valueOf$1) : void 0;
28682
29890
  }
28683
29891
  } : void 0;
28684
29892
  return {
28685
29893
  ...context,
28686
29894
  id: row.id,
28687
- label: labelOf(row.original),
29895
+ label: labelOf$1(row.original),
28688
29896
  group
28689
29897
  };
28690
29898
  }));
28691
- const selectionRows = computed(() => {
28692
- const source = props.selectAll === "filtered" ? table.getFilteredRowModel().flatRows : table.getRowModel().rows.flatMap((row) => row.getIsGrouped() ? row.getLeafRows() : [row]);
28693
- return [...new Map(source.filter((row) => row.getCanSelect()).map((row) => [row.id, row])).values()];
28694
- });
28695
- const pageSelection = computed(() => {
28696
- const eligible = selectionRows.value;
28697
- if (!eligible.length) return false;
28698
- const count = eligible.filter((row) => row.getIsSelected()).length;
28699
- return count === eligible.length ? true : count || eligible.some((row) => row.getIsSomeSelected()) ? "indeterminate" : false;
28700
- });
29899
+ const selectionRows = computed(() => uniqueSelectable(props.selectAll === "filtered" ? table.getFilteredRowModel().flatRows : table.getRowModel().rows.flatMap((row) => row.getIsGrouped() ? row.getLeafRows() : [row])));
29900
+ const pageSelection = computed(() => selectionState(selectionRows.value));
28701
29901
  const selectionDisabled = computed(() => blocked.value || !selectionRows.value.length);
28702
29902
  function togglePage(selected) {
28703
29903
  if (blocked.value || props.selectionMode === "single") return;
28704
- const keys = new Set(models.selected.value);
28705
- for (const row of selectionRows.value) {
28706
- const descendants = props.selectChildren === false ? [row] : [row, ...row.getLeafRows()];
28707
- for (const item of descendants) if (item.getCanSelect()) {
28708
- if (selected === true) keys.add(keyOf(item.original));
28709
- else keys.delete(keyOf(item.original));
28710
- }
28711
- }
28712
- models.selected.value = [...keys];
29904
+ models.selected.value = toggleSelection(models.selected.value, selectionRows.value, selected, props.selectChildren !== false, keyOf$1);
28713
29905
  }
28714
29906
  function setFilter(column, value) {
28715
29907
  if (blocked.value) return;
28716
- const next = models.columnFilters.value.filter((filter) => filter.key !== column);
28717
- if (value != null && value !== "" && !(Array.isArray(value) && !value.length)) next.push({
28718
- key: column,
28719
- value
28720
- });
28721
- models.columnFilters.value = next;
29908
+ models.columnFilters.value = nextColumnFilters(models.columnFilters.value, column, value);
28722
29909
  }
28723
29910
  function headerContext(column) {
28724
29911
  const engine = leaves.value.some((item) => item.key === column.key) ? table.getColumn(column.key) : void 0;
@@ -28730,8 +29917,8 @@ function useDataTable(props, models, onChange, onRowClick) {
28730
29917
  sortIndex: engine?.getSortIndex() ?? -1,
28731
29918
  filterValue: models.columnFilters.value.find((filter) => filter.key === column.key)?.value,
28732
29919
  setFilter: (value) => setFilter(column.key, value),
28733
- nextLabel: next === "asc" ? t.value.table.sortAsc : next === "desc" ? t.value.table.sortDesc : t.value.table.sortNone,
28734
- ariaSort: sorting ? sorting === "asc" ? "ascending" : "descending" : void 0,
29920
+ nextLabel: sortLabel(next, t.value.table),
29921
+ ariaSort: ariaSort(sorting),
28735
29922
  toggleSort: (multi = false) => {
28736
29923
  if (!blocked.value && column.sortable) engine?.toggleSorting(void 0, !!props.multiSort && multi);
28737
29924
  }
@@ -28746,7 +29933,7 @@ function useDataTable(props, models, onChange, onRowClick) {
28746
29933
  toggleExpanded,
28747
29934
  setFilter,
28748
29935
  setColumnHidden: (key, hidden) => {
28749
- models.hiddenColumns.value = hidden ? [.../* @__PURE__ */ new Set([...models.hiddenColumns.value, key])] : models.hiddenColumns.value.filter((value) => value !== key);
29936
+ models.hiddenColumns.value = toggleKey(models.hiddenColumns.value, key, hidden);
28750
29937
  }
28751
29938
  });
28752
29939
  const state = computed(() => ({
@@ -28773,13 +29960,14 @@ function useDataTable(props, models, onChange, onRowClick) {
28773
29960
  if (props.autoResetPage !== false) models.page.value = 1;
28774
29961
  }, { deep: true });
28775
29962
  watch([
28776
- pageCount,
29963
+ pageCount$1,
28777
29964
  page,
28778
29965
  () => props.loading,
28779
29966
  () => props.pagination,
28780
29967
  knownTotal
28781
29968
  ], () => {
28782
- if (props.pagination && !props.loading && knownTotal.value && page.value > pageCount.value) models.page.value = pageCount.value;
29969
+ const target = clampedPage(props.pagination, props.loading, knownTotal.value, page.value, pageCount$1.value);
29970
+ if (target !== void 0) models.page.value = target;
28783
29971
  }, { immediate: true });
28784
29972
  watch(() => [
28785
29973
  page.value,
@@ -28789,14 +29977,12 @@ function useDataTable(props, models, onChange, onRowClick) {
28789
29977
  models.columnFilters.value,
28790
29978
  models.grouping.value
28791
29979
  ], () => {
28792
- onChange({
28793
- page: page.value,
28794
- pageSize: pageSize.value,
28795
- sorting: models.sorting.value.map((sort) => ({ ...sort })),
29980
+ onChange(tableQuery(page.value, pageSize.value, {
29981
+ sorting: models.sorting.value,
28796
29982
  filter: models.filter.value,
28797
- columnFilters: models.columnFilters.value.map((filter) => ({ ...filter })),
28798
- grouping: [...models.grouping.value]
28799
- });
29983
+ columnFilters: models.columnFilters.value,
29984
+ grouping: models.grouping.value
29985
+ }));
28800
29986
  }, {
28801
29987
  deep: true,
28802
29988
  flush: "post"
@@ -28806,9 +29992,8 @@ function useDataTable(props, models, onChange, onRowClick) {
28806
29992
  if (event.type === "keydown") event.preventDefault();
28807
29993
  onRowClick(row, event);
28808
29994
  }
28809
- function displayValue(row, column) {
28810
- const value = valueOf(row, column);
28811
- return column.format ? column.format(value, row) : value == null ? "—" : String(value);
29995
+ function displayValue$1(row, column) {
29996
+ return displayValue(row, column);
28812
29997
  }
28813
29998
  return {
28814
29999
  api,
@@ -28825,17 +30010,17 @@ function useDataTable(props, models, onChange, onRowClick) {
28825
30010
  pageSelection,
28826
30011
  selectionDisabled,
28827
30012
  state,
28828
- valueOf,
28829
- displayValue,
30013
+ valueOf: valueOf$1,
30014
+ displayValue: displayValue$1,
28830
30015
  togglePage,
28831
30016
  activate,
28832
30017
  headerContext,
28833
- keyOf,
28834
- labelOf
30018
+ keyOf: keyOf$1,
30019
+ labelOf: labelOf$1
28835
30020
  };
28836
30021
  }
28837
30022
  //#endregion
28838
- //#region src/components/data-table/column-sizing.ts
30023
+ //#region ../shared/src/lib/data-table/column-sizing.ts
28839
30024
  function pixelWidth(value, fallback) {
28840
30025
  return typeof value === "number" && Number.isFinite(value) ? value : typeof value === "string" && /^\d+(\.\d+)?px$/.test(value) ? parseFloat(value) : fallback;
28841
30026
  }
@@ -28903,7 +30088,7 @@ function resizeWidths(column, neighbor, widths, value, minimumTotalWidth = 0, ma
28903
30088
  };
28904
30089
  }
28905
30090
  //#endregion
28906
- //#region src/components/data-table/column-sizing-styles.ts
30091
+ //#region ../shared/src/lib/data-table/column-sizing-styles.ts
28907
30092
  function columnSizingStyles(columns, overrides, controls) {
28908
30093
  const initial = allocateWidths(columns, overrides, 0);
28909
30094
  const total = Object.values(initial).reduce((sum, width) => sum + width, controls);
@@ -28923,26 +30108,165 @@ function columnSizingStyles(columns, overrides, controls) {
28923
30108
  };
28924
30109
  }
28925
30110
  //#endregion
30111
+ //#region ../shared/src/lib/data-table/layout.ts
30112
+ function pinStyle(layout, column, head = false) {
30113
+ if (!column.pin) return {};
30114
+ const siblings = layout.columns.filter((item) => item.pin === column.pin);
30115
+ const index = siblings.findIndex((item) => item.key === column.key);
30116
+ const preceding = column.pin === "start" ? siblings.slice(0, index) : siblings.slice(index + 1);
30117
+ const controls = column.pin === "start" ? layout.leading * 48 : layout.trailing * 72;
30118
+ const offset = `${preceding.reduce((sum, column) => sum + (layout.constrained ? layout.fixedWidths[column.key] : layout.width(column)), controls)}px`;
30119
+ return {
30120
+ position: "sticky",
30121
+ [column.pin === "start" ? "insetInlineStart" : "insetInlineEnd"]: offset,
30122
+ zIndex: head ? 5 : 1,
30123
+ backgroundColor: head ? "var(--hn-table-head-bg)" : "var(--hn-table-bg)",
30124
+ boxShadow: `${column.pin === "start" ? "1px" : "-1px"} 0 0 var(--hn-border)`
30125
+ };
30126
+ }
30127
+ function cellStyle(layout, column, head = false) {
30128
+ return {
30129
+ ...layout.constrained ? {} : {
30130
+ width: cssSize(column.width),
30131
+ minWidth: cssSize(column.minWidth ?? column.width),
30132
+ maxWidth: cssSize(column.maxWidth)
30133
+ },
30134
+ ...pinStyle(layout, column, head)
30135
+ };
30136
+ }
30137
+ function controlStyle(columns, side, index, head = false) {
30138
+ return {
30139
+ width: side === "end" ? "72px" : "48px",
30140
+ minWidth: side === "end" ? "72px" : "48px",
30141
+ paddingInline: "8px",
30142
+ textAlign: "center",
30143
+ ...columns.some((column) => column.pin === side) ? {
30144
+ position: "sticky",
30145
+ [side === "start" ? "insetInlineStart" : "insetInlineEnd"]: `${index * 48}px`,
30146
+ zIndex: head ? 5 : 1,
30147
+ backgroundColor: head ? "var(--hn-table-head-bg)" : "var(--hn-table-bg)"
30148
+ } : {}
30149
+ };
30150
+ }
30151
+ function headerRows(columns, visible, heights, sticky, context, styleOf) {
30152
+ const paths = /* @__PURE__ */ new Map();
30153
+ function visit(columns, parent = []) {
30154
+ for (const column of columns) {
30155
+ const path = [...parent, column];
30156
+ if (column.children?.length) visit(column.children, path);
30157
+ else paths.set(column.key, path);
30158
+ }
30159
+ }
30160
+ visit(columns);
30161
+ const depth = Math.max(1, ...visible.map((column) => paths.get(column.key).length));
30162
+ return Array.from({ length: depth }, (_, level) => {
30163
+ const result = [];
30164
+ for (let index = 0; index < visible.length;) {
30165
+ const first = visible[index];
30166
+ const path = paths.get(first.key);
30167
+ const column = path[level];
30168
+ if (!column) {
30169
+ index++;
30170
+ continue;
30171
+ }
30172
+ const leaf = level === path.length - 1;
30173
+ let end = index + 1;
30174
+ if (!leaf) while (end < visible.length && paths.get(visible[end].key)?.[level]?.key === column.key && visible[end].pin === first.pin) end++;
30175
+ const top = Array.from({ length: level }, (_, i) => heights[i] ?? 44).reduce((a, b) => a + b, 0);
30176
+ result.push({
30177
+ ...context(column),
30178
+ id: leaf ? `leaf:${column.key}` : `${level}:${column.key}:${first.key}`,
30179
+ leaf,
30180
+ colspan: end - index,
30181
+ rowspan: leaf ? depth - level : 1,
30182
+ top,
30183
+ style: {
30184
+ ...leaf ? styleOf(column, true) : styleOf(first.pin === "end" ? visible[end - 1] : first, false),
30185
+ ...sticky ? { top: `${top}px` } : {}
30186
+ }
30187
+ });
30188
+ index = end;
30189
+ }
30190
+ return result;
30191
+ });
30192
+ }
30193
+ function canMoveColumn(columns, key, target) {
30194
+ if (key === target) return false;
30195
+ const source = columns.find((column) => column.key === key), destination = columns.find((column) => column.key === target);
30196
+ return !(!source || !destination || source.pin !== destination.pin || source.reorderable === false || destination.reorderable === false);
30197
+ }
30198
+ function columnOrder(order, leaves) {
30199
+ return [.../* @__PURE__ */ new Set([...order, ...leaves.map((column) => column.key)])];
30200
+ }
30201
+ function moveColumnOrder(order, leaves, key, target) {
30202
+ const next = columnOrder(order, leaves);
30203
+ const from = next.indexOf(key), to = next.indexOf(target);
30204
+ next.splice(from, 1);
30205
+ next.splice(to, 0, key);
30206
+ return next;
30207
+ }
30208
+ function dropColumnOrder(order, leaves, key, target, before) {
30209
+ const next = columnOrder(order, leaves);
30210
+ next.splice(next.indexOf(key), 1);
30211
+ next.splice(next.indexOf(target) + (before ? 0 : 1), 0, key);
30212
+ return next;
30213
+ }
30214
+ function reorderPosition(from, to, before) {
30215
+ return before === void 0 ? to : to + (before ? 0 : 1) - (from < to ? 1 : 0);
30216
+ }
30217
+ function reorderedRows(source, from, position, row) {
30218
+ const rows = [...source];
30219
+ rows.splice(from, 1);
30220
+ rows.splice(position, 0, row);
30221
+ return rows;
30222
+ }
30223
+ //#endregion
30224
+ //#region ../shared/src/lib/data-table/resize.ts
30225
+ function resizeHandlePositions(columns, cells, box, scale, rtl) {
30226
+ let left = box.left;
30227
+ let right = box.right;
30228
+ for (const column of columns) {
30229
+ const rect = cells.get(column.key);
30230
+ if (!rect || !column.pin) continue;
30231
+ if (column.pin === "start" !== rtl) left = Math.max(left, rect.right);
30232
+ else right = Math.min(right, rect.left);
30233
+ }
30234
+ const next = {};
30235
+ for (const column of columns) {
30236
+ const rect = cells.get(column.key);
30237
+ if (!rect) continue;
30238
+ const start = Math.max(rect.left, column.pin ? box.left : left);
30239
+ const end = Math.min(rect.right, column.pin ? box.right : right);
30240
+ const fromLeft = column.pin === "end" !== rtl;
30241
+ next[column.key] = {
30242
+ inset: Math.max(0, (fromLeft ? start - rect.left : rect.right - end) / scale),
30243
+ visible: end - start >= 9 * scale - .01
30244
+ };
30245
+ }
30246
+ return next;
30247
+ }
30248
+ function resizeAffectedColumns(columns, column, mode) {
30249
+ const edge = resizeBoundary(columns, column, mode);
30250
+ return edge?.neighbor ? edge.side === "start" ? [edge.neighbor, column] : [column, edge.neighbor] : [column];
30251
+ }
30252
+ function pinnedMaximumWidth(columns, column, mode, source, available) {
30253
+ if (!column.pin || resizeBoundary(columns, column, mode)?.neighbor?.pin) return Infinity;
30254
+ const otherPinned = columns.reduce((sum, item) => sum + (item.pin && item.key !== column.key ? source[item.key] : 0), 0);
30255
+ const center = columns.some((item) => !item.pin) ? 48 : 0;
30256
+ return Math.max(source[column.key], available - otherPinned - center);
30257
+ }
30258
+ //#endregion
28926
30259
  //#region src/components/data-table/composables/useTableResize.ts
28927
30260
  function useTableResize(props, models, ctl, element, viewport, widths, active, available, updateHandles) {
28928
30261
  const resizing = shallowRef();
28929
30262
  const guide = shallowRef();
28930
30263
  let release;
28931
30264
  const boundary = (column) => resizeBoundary(ctl.visibleColumns.value, column, props.resizeMode ?? "fit");
28932
- const affectedColumns = (column) => {
28933
- const edge = boundary(column);
28934
- return edge?.neighbor ? edge.side === "start" ? [edge.neighbor, column] : [column, edge.neighbor] : [column];
28935
- };
30265
+ const affectedColumns = (column) => resizeAffectedColumns(ctl.visibleColumns.value, column, props.resizeMode ?? "fit");
28936
30266
  const resizeLabel = (column) => affectedColumns(column).map((item) => item.label).join(" / ");
28937
30267
  const resizeValueText = (column) => affectedColumns(column).map((item) => `${item.label}: ${Math.round(widths.value[item.key])}px`).join(" / ");
28938
30268
  const minimumTotalWidth = () => props.resizeMode === "expand" ? Math.max(0, available.value) : 0;
28939
- const maximumWidth = (column, source) => {
28940
- if (!column.pin || boundary(column)?.neighbor?.pin) return Infinity;
28941
- const columns = ctl.visibleColumns.value;
28942
- const otherPinned = columns.reduce((sum, item) => sum + (item.pin && item.key !== column.key ? source[item.key] : 0), 0);
28943
- const center = columns.some((item) => !item.pin) ? 48 : 0;
28944
- return Math.max(source[column.key], available.value - otherPinned - center);
28945
- };
30269
+ const maximumWidth = (column, source) => pinnedMaximumWidth(ctl.visibleColumns.value, column, props.resizeMode ?? "fit", source, available.value);
28946
30270
  const bounds = (column) => resizeBounds(column, boundary(column)?.neighbor, widths.value, minimumTotalWidth(), maximumWidth(column, widths.value));
28947
30271
  const canResize = (column) => {
28948
30272
  if (!props.resizable || !boundary(column)) return false;
@@ -29169,26 +30493,7 @@ function useTableResizeHandles(element, viewport, columns, enabled) {
29169
30493
  const scale = box.width / area.clientWidth || 1;
29170
30494
  const rtl = getComputedStyle(table).direction === "rtl";
29171
30495
  const cells = new Map([...table.querySelectorAll("thead [data-hn-column]")].map((cell) => [cell.dataset.hnColumn, cell.getBoundingClientRect()]));
29172
- let left = box.left;
29173
- let right = box.right;
29174
- for (const column of columns.value) {
29175
- const rect = cells.get(column.key);
29176
- if (!rect || !column.pin) continue;
29177
- if (column.pin === "start" !== rtl) left = Math.max(left, rect.right);
29178
- else right = Math.min(right, rect.left);
29179
- }
29180
- const next = {};
29181
- for (const column of columns.value) {
29182
- const rect = cells.get(column.key);
29183
- if (!rect) continue;
29184
- const start = Math.max(rect.left, column.pin ? box.left : left);
29185
- const end = Math.min(rect.right, column.pin ? box.right : right);
29186
- const fromLeft = column.pin === "end" !== rtl;
29187
- next[column.key] = {
29188
- inset: Math.max(0, (fromLeft ? start - rect.left : rect.right - end) / scale),
29189
- visible: end - start >= 9 * scale - .01
29190
- };
29191
- }
30496
+ const next = resizeHandlePositions(columns.value, cells, box, scale, rtl);
29192
30497
  if (JSON.stringify(next) !== JSON.stringify(positions.value)) positions.value = next;
29193
30498
  }
29194
30499
  function schedule() {
@@ -29295,88 +30600,26 @@ function useTableColumns(props, models, ctl, element, viewport, leading, trailin
29295
30600
  function columnStyle(column) {
29296
30601
  return { width: cssSize(constrained.value ? widthVariable(column) : column.width) };
29297
30602
  }
29298
- function pinStyle(column, head = false) {
29299
- if (!column.pin) return {};
29300
- const siblings = ctl.visibleColumns.value.filter((item) => item.pin === column.pin);
29301
- const index = siblings.findIndex((item) => item.key === column.key);
29302
- const preceding = column.pin === "start" ? siblings.slice(0, index) : siblings.slice(index + 1);
29303
- const controls = column.pin === "start" ? leading.value * 48 : trailing.value * 72;
29304
- const offset = `${preceding.reduce((sum, column) => sum + (constrained.value ? fixedWidths.value[column.key] : width(column)), controls)}px`;
29305
- return {
29306
- position: "sticky",
29307
- [column.pin === "start" ? "insetInlineStart" : "insetInlineEnd"]: offset,
29308
- zIndex: head ? 5 : 1,
29309
- backgroundColor: head ? "var(--hn-table-head-bg)" : "var(--hn-table-bg)",
29310
- boxShadow: `${column.pin === "start" ? "1px" : "-1px"} 0 0 var(--hn-border)`
29311
- };
30603
+ const pinLayout = () => ({
30604
+ columns: ctl.visibleColumns.value,
30605
+ constrained: constrained.value,
30606
+ leading: leading.value,
30607
+ trailing: trailing.value,
30608
+ get fixedWidths() {
30609
+ return fixedWidths.value;
30610
+ },
30611
+ width
30612
+ });
30613
+ function pinStyle$1(column, head = false) {
30614
+ return pinStyle(pinLayout(), column, head);
29312
30615
  }
29313
- function cellStyle(column, head = false) {
29314
- return {
29315
- ...constrained.value ? {} : {
29316
- width: cssSize(column.width),
29317
- minWidth: cssSize(column.minWidth ?? column.width),
29318
- maxWidth: cssSize(column.maxWidth)
29319
- },
29320
- ...pinStyle(column, head)
29321
- };
30616
+ function cellStyle$1(column, head = false) {
30617
+ return cellStyle(pinLayout(), column, head);
29322
30618
  }
29323
- function controlStyle(side, index, head = false) {
29324
- return {
29325
- width: side === "end" ? "72px" : "48px",
29326
- minWidth: side === "end" ? "72px" : "48px",
29327
- paddingInline: "8px",
29328
- textAlign: "center",
29329
- ...ctl.visibleColumns.value.some((column) => column.pin === side) ? {
29330
- position: "sticky",
29331
- [side === "start" ? "insetInlineStart" : "insetInlineEnd"]: `${index * 48}px`,
29332
- zIndex: head ? 5 : 1,
29333
- backgroundColor: head ? "var(--hn-table-head-bg)" : "var(--hn-table-bg)"
29334
- } : {}
29335
- };
29336
- }
29337
- const headerRows = computed(() => {
29338
- const paths = /* @__PURE__ */ new Map();
29339
- function visit(columns, parent = []) {
29340
- for (const column of columns) {
29341
- const path = [...parent, column];
29342
- if (column.children?.length) visit(column.children, path);
29343
- else paths.set(column.key, path);
29344
- }
29345
- }
29346
- visit(props.columns);
29347
- const visible = ctl.visibleColumns.value;
29348
- const depth = Math.max(1, ...visible.map((column) => paths.get(column.key).length));
29349
- return Array.from({ length: depth }, (_, level) => {
29350
- const result = [];
29351
- for (let index = 0; index < visible.length;) {
29352
- const first = visible[index];
29353
- const path = paths.get(first.key);
29354
- const column = path[level];
29355
- if (!column) {
29356
- index++;
29357
- continue;
29358
- }
29359
- const leaf = level === path.length - 1;
29360
- let end = index + 1;
29361
- if (!leaf) while (end < visible.length && paths.get(visible[end].key)?.[level]?.key === column.key && visible[end].pin === first.pin) end++;
29362
- const top = Array.from({ length: level }, (_, i) => heights.value[i] ?? 44).reduce((a, b) => a + b, 0);
29363
- result.push({
29364
- ...ctl.headerContext(column),
29365
- id: leaf ? `leaf:${column.key}` : `${level}:${column.key}:${first.key}`,
29366
- leaf,
29367
- colspan: end - index,
29368
- rowspan: leaf ? depth - level : 1,
29369
- top,
29370
- style: {
29371
- ...leaf ? cellStyle(column, true) : pinStyle(first.pin === "end" ? visible[end - 1] : first, true),
29372
- ...props.stickyHeader ? { top: `${top}px` } : {}
29373
- }
29374
- });
29375
- index = end;
29376
- }
29377
- return result;
29378
- });
29379
- });
30619
+ function controlStyle$1(side, index, head = false) {
30620
+ return controlStyle(ctl.visibleColumns.value, side, index, head);
30621
+ }
30622
+ const headerRows$1 = computed(() => headerRows(props.columns, ctl.visibleColumns.value, heights.value, props.stickyHeader, ctl.headerContext, (column, leaf) => leaf ? cellStyle$1(column, true) : pinStyle$1(column, true)));
29380
30623
  const sizing = computed(() => constrained.value ? columnSizingStyles(ctl.visibleColumns.value, active.value ?? models.columnWidths.value, leading.value * 48 + trailing.value * 72) : {});
29381
30624
  const tableStyle = computed(() => ({
29382
30625
  tableLayout: constrained.value ? "fixed" : "auto",
@@ -29388,15 +30631,8 @@ function useTableColumns(props, models, ctl, element, viewport, leading, trailin
29388
30631
  });
29389
30632
  const errorStyle = computed(() => ({ "--hn-table-viewport-width": available.value ? `${available.value}px` : void 0 }));
29390
30633
  function moveColumn(key, target) {
29391
- if (ctl.blocked.value || key === target) return;
29392
- const columns = ctl.visibleColumns.value;
29393
- const source = columns.find((column) => column.key === key), destination = columns.find((column) => column.key === target);
29394
- if (!source || !destination || source.pin !== destination.pin || source.reorderable === false || destination.reorderable === false) return;
29395
- const order = [.../* @__PURE__ */ new Set([...models.columnOrder.value, ...ctl.leaves.value.map((column) => column.key)])];
29396
- const from = order.indexOf(key), to = order.indexOf(target);
29397
- order.splice(from, 1);
29398
- order.splice(to, 0, key);
29399
- models.columnOrder.value = order;
30634
+ if (ctl.blocked.value || !canMoveColumn(ctl.visibleColumns.value, key, target)) return;
30635
+ models.columnOrder.value = moveColumnOrder(models.columnOrder.value, ctl.leaves.value, key, target);
29400
30636
  }
29401
30637
  Object.assign(ctl.api, {
29402
30638
  setColumnWidth: resizing.setWidth,
@@ -29409,13 +30645,13 @@ function useTableColumns(props, models, ctl, element, viewport, leading, trailin
29409
30645
  });
29410
30646
  return {
29411
30647
  constrained,
29412
- headerRows,
30648
+ headerRows: headerRows$1,
29413
30649
  tableStyle,
29414
30650
  columnStyles,
29415
30651
  columnStyle,
29416
30652
  errorStyle,
29417
- cellStyle,
29418
- controlStyle,
30653
+ cellStyle: cellStyle$1,
30654
+ controlStyle: controlStyle$1,
29419
30655
  ...resizing,
29420
30656
  ...handles,
29421
30657
  width
@@ -29438,19 +30674,16 @@ function useTableDrag(props, models, ctl, element, viewport, onReorder) {
29438
30674
  const parent = row.parentId ? all[row.parentId]?.original : void 0;
29439
30675
  const source = parent ? props.getChildren?.(parent) : props.rows;
29440
30676
  if (!source) return;
29441
- const from = source.findIndex((item) => ctl.keyOf(item) === key), to = source.findIndex((item) => ctl.keyOf(item) === targetKey);
29442
- const position = before === void 0 ? to : to + (before ? 0 : 1) - (from < to ? 1 : 0);
30677
+ const from = source.findIndex((item) => ctl.keyOf(item) === key);
30678
+ const position = reorderPosition(from, source.findIndex((item) => ctl.keyOf(item) === targetKey), before);
29443
30679
  if (position === from) return;
29444
- const rows = [...source];
29445
- rows.splice(from, 1);
29446
- rows.splice(position, 0, row.original);
29447
30680
  onReorder({
29448
30681
  row: row.original,
29449
30682
  target: target.original,
29450
30683
  parent,
29451
30684
  from,
29452
30685
  to: position,
29453
- rows
30686
+ rows: reorderedRows(source, from, position, row.original)
29454
30687
  });
29455
30688
  }
29456
30689
  function start(kind, key, label, event) {
@@ -29558,12 +30791,8 @@ function useTableDrag(props, models, ctl, element, viewport, onReorder) {
29558
30791
  const destination = moved && targetAtPoint();
29559
30792
  cleanup?.();
29560
30793
  if (!apply || !destination) return;
29561
- if (kind === "column") {
29562
- const order = [.../* @__PURE__ */ new Set([...models.columnOrder.value, ...ctl.leaves.value.map((column) => column.key)])];
29563
- order.splice(order.indexOf(key), 1);
29564
- order.splice(order.indexOf(destination.target) + (destination.before ? 0 : 1), 0, key);
29565
- models.columnOrder.value = order;
29566
- } else {
30794
+ if (kind === "column") models.columnOrder.value = dropColumnOrder(models.columnOrder.value, ctl.leaves.value, key, destination.target, destination.before);
30795
+ else {
29567
30796
  const all = ctl.table.getCoreRowModel().rowsById;
29568
30797
  const row = all[key], target = all[destination.target];
29569
30798
  if (row && target) moveRow(ctl.keyOf(row.original), ctl.keyOf(target.original), destination.before);
@@ -29823,28 +31052,40 @@ function useTableEditing(props, ctl, onEdit, onError, element) {
29823
31052
  };
29824
31053
  }
29825
31054
  //#endregion
31055
+ //#region ../shared/src/lib/data-table/csv.ts
31056
+ function exportColumns(columns, options) {
31057
+ return columns.filter((column) => column.exportable !== false && (!options.columns || options.columns.includes(column.key)));
31058
+ }
31059
+ function tableCsv(visible, rows, options, valueOf, displayValue) {
31060
+ const delimiter = options.delimiter ?? ",";
31061
+ const columns = exportColumns(visible, options);
31062
+ const escape = (value) => {
31063
+ let text = value == null ? "" : String(value);
31064
+ if (typeof value === "string" && /^[\s]*[=+@-]/.test(text)) text = "'" + text;
31065
+ return "\"" + text.replaceAll("\"", "\"\"") + "\"";
31066
+ };
31067
+ const lines = [columns.map((column) => escape(column.label)).join(delimiter)];
31068
+ for (const row of rows) lines.push(columns.map((column) => escape(column.exportValue ? column.exportValue(row) : options.formatted ? displayValue(row, column) : valueOf(row, column))).join(delimiter));
31069
+ return (options.bom === false ? "" : "") + lines.join("\r\n");
31070
+ }
31071
+ function downloadCsv(text, filename = "data.csv") {
31072
+ if (typeof document === "undefined") return;
31073
+ const url = URL.createObjectURL(new Blob([text], { type: "text/csv;charset=utf-8" }));
31074
+ const anchor = document.createElement("a");
31075
+ anchor.href = url;
31076
+ anchor.download = filename;
31077
+ anchor.click();
31078
+ setTimeout(() => URL.revokeObjectURL(url), 1e3);
31079
+ }
31080
+ //#endregion
29826
31081
  //#region src/components/data-table/composables/useTableExport.ts
29827
31082
  function useTableExport(ctl) {
29828
31083
  function toCsv(options = {}) {
29829
- const delimiter = options.delimiter ?? ",";
29830
- const columns = ctl.visibleColumns.value.filter((column) => column.exportable !== false && (!options.columns || options.columns.includes(column.key)));
29831
- const escape = (value) => {
29832
- let text = value == null ? "" : String(value);
29833
- if (typeof value === "string" && /^[\s]*[=+@-]/.test(text)) text = "'" + text;
29834
- return "\"" + text.replaceAll("\"", "\"\"") + "\"";
29835
- };
29836
- const lines = [columns.map((column) => escape(column.label)).join(delimiter)];
29837
- for (const row of ctl.api.getRows(options.scope ?? "filtered")) lines.push(columns.map((column) => escape(column.exportValue ? column.exportValue(row) : options.formatted ? ctl.displayValue(row, column) : ctl.valueOf(row, column))).join(delimiter));
29838
- return (options.bom === false ? "" : "") + lines.join("\r\n");
31084
+ return tableCsv(ctl.visibleColumns.value, ctl.api.getRows(options.scope ?? "filtered"), options, ctl.valueOf, ctl.displayValue);
29839
31085
  }
29840
31086
  function exportCsv(options = {}) {
29841
31087
  if (typeof document === "undefined") return;
29842
- const url = URL.createObjectURL(new Blob([toCsv(options)], { type: "text/csv;charset=utf-8" }));
29843
- const anchor = document.createElement("a");
29844
- anchor.href = url;
29845
- anchor.download = options.filename ?? "data.csv";
29846
- anchor.click();
29847
- setTimeout(() => URL.revokeObjectURL(url), 1e3);
31088
+ downloadCsv(toCsv(options), options.filename);
29848
31089
  }
29849
31090
  Object.assign(ctl.api, {
29850
31091
  toCsv,
@@ -30577,7 +31818,11 @@ var DataListLayoutToggle_default = /* @__PURE__ */ defineComponent({
30577
31818
  }
30578
31819
  });
30579
31820
  //#endregion
30580
- //#region src/components/data-list/utils/scroll.ts
31821
+ //#region ../shared/src/lib/data-list.ts
31822
+ function dataListText(item, index, field) {
31823
+ const value = typeof field === "function" ? field(item, index) : field ? item[field] : void 0;
31824
+ return value !== "" && (typeof value === "string" || typeof value === "number") ? value : void 0;
31825
+ }
30581
31826
  function scrollDataListItem(element, viewport, { align = "auto", behavior }) {
30582
31827
  if (!viewport) {
30583
31828
  element.scrollIntoView({
@@ -30945,8 +32190,7 @@ var DataListItem_default = /* @__PURE__ */ defineComponent({
30945
32190
  function useDataList(props, pageModel, sizeModel, change, layoutModel) {
30946
32191
  const layout = computed(() => layoutModel?.value ?? props.layout ?? "list");
30947
32192
  function text(item, index, field) {
30948
- const value = typeof field === "function" ? field(item, index) : field ? item[field] : void 0;
30949
- return value !== "" && (typeof value === "string" || typeof value === "number") ? value : void 0;
32193
+ return dataListText(item, index, field);
30950
32194
  }
30951
32195
  const pageSize = computed(() => paginationInteger(sizeModel.value, 10, 1));
30952
32196
  const total = computed(() => props.manual ? props.total === void 0 ? void 0 : paginationInteger(props.total, 0, 0) : props.items.length);
@@ -31384,10 +32628,51 @@ var Timeline_default = /* @__PURE__ */ defineComponent({
31384
32628
  }
31385
32629
  });
31386
32630
  //#endregion
31387
- //#region src/components/virtual-list/composables/useVirtualList.ts
32631
+ //#region ../shared/src/lib/virtual/list.ts
31388
32632
  function nonnegative(value) {
31389
32633
  return Number.isFinite(value) ? Math.max(0, value) : 0;
31390
32634
  }
32635
+ function listEstimator(items, estimate) {
32636
+ const value = estimate ?? 48;
32637
+ return (index) => Math.max(1, nonnegative(typeof value === "function" ? value(items[index], index) : value));
32638
+ }
32639
+ function listInitialRect(initialRect, height) {
32640
+ return initialRect ?? {
32641
+ width: VIRTUAL_RECT.width,
32642
+ height: typeof height === "number" ? height : VIRTUAL_RECT.height
32643
+ };
32644
+ }
32645
+ function retainIndex(indexes, retained) {
32646
+ if (retained >= 0 && !indexes.includes(retained)) indexes.push(retained);
32647
+ return indexes.sort((a, b) => a - b);
32648
+ }
32649
+ function listContentStyle(flow, horizontal) {
32650
+ const { before: start, after: end } = flow;
32651
+ return horizontal ? {
32652
+ width: "max-content",
32653
+ height: "100%",
32654
+ paddingInlineStart: `${start}px`,
32655
+ paddingInlineEnd: `${end}px`
32656
+ } : {
32657
+ width: "100%",
32658
+ paddingBlockStart: `${start}px`,
32659
+ paddingBlockEnd: `${end}px`
32660
+ };
32661
+ }
32662
+ function listRootStyle(height) {
32663
+ return { height: typeof height === "string" ? height : `${height ?? VIRTUAL_RECT.height}px` };
32664
+ }
32665
+ function listItemStyle(entry, horizontal, dynamic) {
32666
+ return horizontal ? {
32667
+ marginInlineStart: `${entry.gapBefore}px`,
32668
+ width: dynamic === false ? `${entry.size}px` : void 0
32669
+ } : {
32670
+ marginBlockStart: `${entry.gapBefore}px`,
32671
+ height: dynamic === false ? `${entry.size}px` : void 0
32672
+ };
32673
+ }
32674
+ //#endregion
32675
+ //#region src/components/virtual-list/composables/useVirtualList.ts
31391
32676
  function useVirtualList(props, onRangeChange) {
31392
32677
  const { root, direction, rootDirection } = useDirection$1(() => props.dir);
31393
32678
  const area = shallowRef();
@@ -31404,12 +32689,11 @@ function useVirtualList(props, onRangeChange) {
31404
32689
  const items = props.items;
31405
32690
  const itemKeys = keys.value;
31406
32691
  const retained = focusedIndex.value;
31407
- const estimate = props.estimateSize ?? 48;
31408
32692
  return {
31409
32693
  count: items.length,
31410
32694
  getScrollElement: () => viewport.value ?? null,
31411
32695
  getItemKey: (index) => itemKeys[index],
31412
- estimateSize: (index) => Math.max(1, nonnegative(typeof estimate === "function" ? estimate(items[index], index) : estimate)),
32696
+ estimateSize: listEstimator(items, props.estimateSize),
31413
32697
  horizontal: horizontal.value,
31414
32698
  isRtl: direction.value === "rtl",
31415
32699
  overscan: Math.floor(nonnegative(props.overscan ?? 5)),
@@ -31417,15 +32701,8 @@ function useVirtualList(props, onRangeChange) {
31417
32701
  paddingStart: nonnegative(props.paddingStart ?? 0),
31418
32702
  paddingEnd: nonnegative(props.paddingEnd ?? 0),
31419
32703
  initialOffset: nonnegative(props.initialOffset ?? 0),
31420
- initialRect: props.initialRect ?? {
31421
- width: 320,
31422
- height: typeof props.height === "number" ? props.height : 320
31423
- },
31424
- rangeExtractor: (range) => {
31425
- const indexes = defaultRangeExtractor(range);
31426
- if (retained >= 0 && !indexes.includes(retained)) indexes.push(retained);
31427
- return indexes.sort((a, b) => a - b);
31428
- }
32704
+ initialRect: listInitialRect(props.initialRect, props.height),
32705
+ rangeExtractor: (range) => retainIndex(defaultRangeExtractor(range), retained)
31429
32706
  };
31430
32707
  }));
31431
32708
  const flow = computed(() => virtualFlow(virtualizer.value.getVirtualItems(), virtualizer.value.getTotalSize()));
@@ -31433,28 +32710,10 @@ function useVirtualList(props, onRangeChange) {
31433
32710
  ...entry,
31434
32711
  key: keys.value[entry.index]
31435
32712
  })));
31436
- const contentStyle = computed(() => {
31437
- const { before: start, after: end } = flow.value;
31438
- return horizontal.value ? {
31439
- width: "max-content",
31440
- height: "100%",
31441
- paddingInlineStart: `${start}px`,
31442
- paddingInlineEnd: `${end}px`
31443
- } : {
31444
- width: "100%",
31445
- paddingBlockStart: `${start}px`,
31446
- paddingBlockEnd: `${end}px`
31447
- };
31448
- });
31449
- const rootStyle = computed(() => ({ height: typeof props.height === "string" ? props.height : `${props.height ?? 320}px` }));
32713
+ const contentStyle = computed(() => listContentStyle(flow.value, horizontal.value));
32714
+ const rootStyle = computed(() => listRootStyle(props.height));
31450
32715
  function itemStyle(entry) {
31451
- return horizontal.value ? {
31452
- marginInlineStart: `${entry.gapBefore}px`,
31453
- width: props.dynamic === false ? `${entry.size}px` : void 0
31454
- } : {
31455
- marginBlockStart: `${entry.gapBefore}px`,
31456
- height: props.dynamic === false ? `${entry.size}px` : void 0
31457
- };
32716
+ return listItemStyle(entry, horizontal.value, props.dynamic);
31458
32717
  }
31459
32718
  function measureElement(element) {
31460
32719
  if (element === null) {
@@ -32715,7 +33974,7 @@ var qrCode = tv({
32715
33974
  var qrCodeSvg = tv({ base: "block size-full" });
32716
33975
  var qrCodeStatus = tv({ base: "bg-subtle text-muted absolute inset-0 flex flex-col items-center justify-center gap-2 p-3 text-center text-sm" });
32717
33976
  //#endregion
32718
- //#region src/components/qr-code/export.ts
33977
+ //#region ../shared/src/lib/qr-code-export.ts
32719
33978
  function dataURL(blob) {
32720
33979
  return new Promise((resolve, reject) => {
32721
33980
  const reader = new FileReader();