@1771technologies/lytenyte-pro 1.0.0-beta.11 → 1.0.0-beta.12

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 (381) hide show
  1. package/dist/+types.d.ts +4155 -3957
  2. package/dist/cell-selection/adjust-rect-for-row-and-cell-span.js +38 -38
  3. package/dist/cell-selection/are-rects-equal.js +6 -4
  4. package/dist/cell-selection/bound-selection-rect.js +14 -14
  5. package/dist/cell-selection/cell-selection-containers.js +108 -78
  6. package/dist/cell-selection/cell-selection-driver.js +250 -262
  7. package/dist/cell-selection/cell-style-row.d.ts +12 -6
  8. package/dist/cell-selection/cell-style-row.js +82 -79
  9. package/dist/cell-selection/deselect-rect-range.js +41 -40
  10. package/dist/cell-selection/expand-cell-selection-down.d.ts +5 -2
  11. package/dist/cell-selection/expand-cell-selection-down.js +29 -33
  12. package/dist/cell-selection/expand-cell-selection-end.d.ts +5 -2
  13. package/dist/cell-selection/expand-cell-selection-end.js +30 -34
  14. package/dist/cell-selection/expand-cell-selection-start.d.ts +5 -2
  15. package/dist/cell-selection/expand-cell-selection-start.js +29 -33
  16. package/dist/cell-selection/expand-cell-selection-up.d.ts +5 -2
  17. package/dist/cell-selection/expand-cell-selection-up.js +29 -33
  18. package/dist/cell-selection/full-width-start-end-index.js +3 -3
  19. package/dist/cell-selection/get-root-cell.d.ts +5 -1
  20. package/dist/cell-selection/get-root-cell.js +77 -79
  21. package/dist/cell-selection/is-bottom-rect.js +5 -5
  22. package/dist/cell-selection/is-center-col-rect.d.ts +5 -2
  23. package/dist/cell-selection/is-center-col-rect.js +5 -3
  24. package/dist/cell-selection/is-center-rect.js +3 -3
  25. package/dist/cell-selection/is-end-rect.d.ts +5 -2
  26. package/dist/cell-selection/is-end-rect.js +2 -2
  27. package/dist/cell-selection/is-overlapping-rect.js +6 -4
  28. package/dist/cell-selection/is-start-rect.d.ts +5 -2
  29. package/dist/cell-selection/is-start-rect.js +2 -2
  30. package/dist/cell-selection/is-top-rect.js +2 -2
  31. package/dist/cell-selection/is-within-selection-rect.js +1 -1
  32. package/dist/cell-selection/split-cell-selection-rect.d.ts +12 -6
  33. package/dist/cell-selection/split-cell-selection-rect.js +53 -47
  34. package/dist/cell-selection/update-additive-cell-selection.d.ts +5 -2
  35. package/dist/cell-selection/update-additive-cell-selection.js +18 -19
  36. package/dist/cell-selection/use-edge-scroll.d.ts +8 -6
  37. package/dist/cell-selection/use-edge-scroll.js +65 -63
  38. package/dist/cells/cell-default.d.ts +5 -1
  39. package/dist/cells/cell-default.js +5 -5
  40. package/dist/cells/cell-editor.d.ts +4 -2
  41. package/dist/cells/cell-editor.js +121 -86
  42. package/dist/cells/cell.d.ts +16 -3
  43. package/dist/cells/cell.js +56 -27
  44. package/dist/column-manager/branch-lookup-context.d.ts +3 -1
  45. package/dist/column-manager/branch.d.ts +12 -4
  46. package/dist/column-manager/branch.js +39 -29
  47. package/dist/column-manager/column-manager.d.ts +58 -9
  48. package/dist/column-manager/column-manager.js +9 -9
  49. package/dist/column-manager/context.d.ts +1 -1
  50. package/dist/column-manager/label.d.ts +10 -2
  51. package/dist/column-manager/label.js +11 -12
  52. package/dist/column-manager/leaf.d.ts +10 -2
  53. package/dist/column-manager/leaf.js +42 -32
  54. package/dist/column-manager/move-handle.d.ts +14 -6
  55. package/dist/column-manager/move-handle.js +54 -50
  56. package/dist/column-manager/root.d.ts +9 -3
  57. package/dist/column-manager/root.js +26 -13
  58. package/dist/column-manager/use-column-manager.d.ts +12 -12
  59. package/dist/column-manager/use-column-manager.js +20 -20
  60. package/dist/column-manager/use-columns-from-context.js +18 -18
  61. package/dist/column-manager/visibility-checkbox.d.ts +14 -6
  62. package/dist/column-manager/visibility-checkbox.js +36 -23
  63. package/dist/context.d.ts +4 -4
  64. package/dist/filter-tree/branch.d.ts +13 -5
  65. package/dist/filter-tree/branch.js +23 -13
  66. package/dist/filter-tree/context.d.ts +16 -16
  67. package/dist/filter-tree/filter-tree.d.ts +49 -8
  68. package/dist/filter-tree/filter-tree.js +8 -8
  69. package/dist/filter-tree/hooks/use-filter-tree.d.ts +35 -29
  70. package/dist/filter-tree/hooks/use-filter-tree.js +94 -92
  71. package/dist/filter-tree/hooks/use-tree-item.d.ts +4 -4
  72. package/dist/filter-tree/hooks/use-tree-item.js +99 -106
  73. package/dist/filter-tree/inclusion-checkbox.d.ts +14 -6
  74. package/dist/filter-tree/inclusion-checkbox.js +19 -9
  75. package/dist/filter-tree/label.d.ts +10 -2
  76. package/dist/filter-tree/label.js +11 -12
  77. package/dist/filter-tree/leaf.d.ts +10 -2
  78. package/dist/filter-tree/leaf.js +15 -5
  79. package/dist/filter-tree/root.d.ts +23 -7
  80. package/dist/filter-tree/root.js +51 -23
  81. package/dist/grid-box/+types.d.ts +9 -9
  82. package/dist/grid-box/context.d.ts +3 -3
  83. package/dist/grid-box/grid-box.d.ts +26 -6
  84. package/dist/grid-box/grid-box.js +6 -6
  85. package/dist/grid-box/item.d.ts +11 -3
  86. package/dist/grid-box/item.js +29 -26
  87. package/dist/grid-box/panel.d.ts +13 -1
  88. package/dist/grid-box/panel.js +9 -2
  89. package/dist/grid-box/root.d.ts +11 -5
  90. package/dist/grid-box/root.js +11 -2
  91. package/dist/grid-box/use-aggregation-box-items.d.ts +16 -13
  92. package/dist/grid-box/use-aggregation-box-items.js +54 -55
  93. package/dist/grid-box/use-column-box-items.d.ts +31 -21
  94. package/dist/grid-box/use-column-box-items.js +90 -78
  95. package/dist/grid-box/use-row-group-box-items.d.ts +17 -12
  96. package/dist/grid-box/use-row-group-box-items.js +116 -124
  97. package/dist/grid-provider/context.d.ts +4 -2
  98. package/dist/grid-provider/provider.d.ts +4 -2
  99. package/dist/grid-provider/use-grid.d.ts +1 -1
  100. package/dist/grid.d.ts +150 -26
  101. package/dist/grid.js +38 -26
  102. package/dist/header/header-cell.d.ts +13 -5
  103. package/dist/header/header-cell.js +41 -15
  104. package/dist/header/header-group-cell.d.ts +10 -2
  105. package/dist/header/header-group-cell.js +21 -6
  106. package/dist/header/header-row.d.ts +10 -2
  107. package/dist/header/header-row.js +2 -2
  108. package/dist/header/header.d.ts +10 -1
  109. package/dist/header/header.js +11 -2
  110. package/dist/header/resize-handler.d.ts +15 -6
  111. package/dist/header/resize-handler.js +128 -118
  112. package/dist/header/use-drag-move.d.ts +22 -11
  113. package/dist/header/use-drag-move.js +83 -87
  114. package/dist/header/use-header-cell-renderer.d.ts +9 -2
  115. package/dist/header/use-header-cell-renderer.js +24 -29
  116. package/dist/icons/index.d.ts +92 -1
  117. package/dist/icons/index.js +92 -1
  118. package/dist/license.js +174 -174
  119. package/dist/listbox/context.d.ts +2 -2
  120. package/dist/listbox/item.d.ts +10 -1
  121. package/dist/listbox/item.js +23 -19
  122. package/dist/listbox/panel.d.ts +10 -1
  123. package/dist/listbox/panel.js +69 -43
  124. package/dist/listbox/root.d.ts +5 -3
  125. package/dist/listbox/root.js +7 -7
  126. package/dist/root/dialog-driver.js +22 -16
  127. package/dist/root/popover-driver.js +27 -16
  128. package/dist/root/root.d.ts +7 -3
  129. package/dist/root/root.js +111 -107
  130. package/dist/row-data-source-client/+types.d.ts +17 -17
  131. package/dist/row-data-source-client/built-ins/avg.js +3 -4
  132. package/dist/row-data-source-client/built-ins/built-ins.d.ts +16 -16
  133. package/dist/row-data-source-client/built-ins/built-ins.js +16 -16
  134. package/dist/row-data-source-client/built-ins/count.js +3 -5
  135. package/dist/row-data-source-client/built-ins/first.js +1 -1
  136. package/dist/row-data-source-client/built-ins/group.js +1 -1
  137. package/dist/row-data-source-client/built-ins/last.js +1 -1
  138. package/dist/row-data-source-client/built-ins/max.js +9 -13
  139. package/dist/row-data-source-client/built-ins/min.js +9 -13
  140. package/dist/row-data-source-client/built-ins/sum.js +8 -10
  141. package/dist/row-data-source-client/filter/+types.d.ts +35 -13
  142. package/dist/row-data-source-client/filter/compute-filtered-rows.d.ts +16 -2
  143. package/dist/row-data-source-client/filter/compute-filtered-rows.js +102 -102
  144. package/dist/row-data-source-client/pivots/create-agg-model.d.ts +8 -4
  145. package/dist/row-data-source-client/pivots/create-agg-model.js +8 -9
  146. package/dist/row-data-source-client/pivots/create-pivot-columns-from-paths.d.ts +6 -1
  147. package/dist/row-data-source-client/pivots/create-pivot-columns-from-paths.js +42 -46
  148. package/dist/row-data-source-client/pivots/create-pivot-columns.d.ts +6 -1
  149. package/dist/row-data-source-client/pivots/create-pivot-columns.js +16 -17
  150. package/dist/row-data-source-client/pivots/create-pivot-tree.d.ts +7 -1
  151. package/dist/row-data-source-client/pivots/create-pivot-tree.js +19 -19
  152. package/dist/row-data-source-client/tree/client-tree.d.ts +19 -13
  153. package/dist/row-data-source-client/tree/client-tree.js +64 -67
  154. package/dist/row-data-source-client/tree/evaluator-aggregation.d.ts +4 -1
  155. package/dist/row-data-source-client/tree/evaluator-aggregation.js +6 -6
  156. package/dist/row-data-source-client/tree/evaluator-group.d.ts +4 -1
  157. package/dist/row-data-source-client/tree/evaluator-group.js +6 -7
  158. package/dist/row-data-source-client/tree/traverse.d.ts +5 -1
  159. package/dist/row-data-source-client/tree/traverse.js +15 -18
  160. package/dist/row-data-source-client/use-client-data-source-paginated.d.ts +9 -5
  161. package/dist/row-data-source-client/use-client-data-source-paginated.js +539 -522
  162. package/dist/row-data-source-client/use-client-data-source.d.ts +9 -5
  163. package/dist/row-data-source-client/use-client-data-source.js +682 -647
  164. package/dist/row-data-source-client/use-client-tree-data-source.d.ts +9 -5
  165. package/dist/row-data-source-client/use-client-tree-data-source.js +510 -499
  166. package/dist/row-data-source-server/async-tree/+types.async-tree.d.ts +36 -33
  167. package/dist/row-data-source-server/async-tree/apply-delete-action-to-tree.d.ts +4 -1
  168. package/dist/row-data-source-server/async-tree/apply-delete-action-to-tree.js +18 -22
  169. package/dist/row-data-source-server/async-tree/apply-set-action-to-tree.d.ts +4 -1
  170. package/dist/row-data-source-server/async-tree/apply-set-action-to-tree.js +17 -25
  171. package/dist/row-data-source-server/async-tree/check-set-action-item-keys-are-unique.js +18 -18
  172. package/dist/row-data-source-server/async-tree/check-set-action-item-keys-are-valid.js +9 -10
  173. package/dist/row-data-source-server/async-tree/check-set-action-item-keys-fit.d.ts +4 -1
  174. package/dist/row-data-source-server/async-tree/check-set-action-item-keys-fit.js +13 -14
  175. package/dist/row-data-source-server/async-tree/check-set-action-item-kinds.js +9 -10
  176. package/dist/row-data-source-server/async-tree/get-parent-node-by-path.d.ts +4 -1
  177. package/dist/row-data-source-server/async-tree/get-parent-node-by-path.js +13 -13
  178. package/dist/row-data-source-server/async-tree/is-set-action-a-no-op-on-node.d.ts +4 -1
  179. package/dist/row-data-source-server/async-tree/is-set-action-a-no-op-on-node.js +1 -1
  180. package/dist/row-data-source-server/async-tree/make-async-tree.js +14 -14
  181. package/dist/row-data-source-server/async-tree/maybe-apply-parent-remove-self.d.ts +3 -1
  182. package/dist/row-data-source-server/async-tree/maybe-apply-parent-remove-self.js +6 -6
  183. package/dist/row-data-source-server/async-tree/maybe-apply-resize.d.ts +5 -1
  184. package/dist/row-data-source-server/async-tree/maybe-apply-resize.js +11 -14
  185. package/dist/row-data-source-server/async-tree/maybe-apply-set-action-items.d.ts +4 -1
  186. package/dist/row-data-source-server/async-tree/maybe-apply-set-action-items.js +42 -46
  187. package/dist/row-data-source-server/range-tree/range-tree.d.ts +28 -28
  188. package/dist/row-data-source-server/range-tree/range-tree.js +49 -48
  189. package/dist/row-data-source-server/use-server-data-source.d.ts +11 -2
  190. package/dist/row-data-source-server/use-server-data-source.js +665 -652
  191. package/dist/row-data-source-server/utils/get-node-depth.js +7 -7
  192. package/dist/row-data-source-server/utils/get-node-path.js +7 -7
  193. package/dist/row-data-source-server/utils/get-request-id.js +3 -4
  194. package/dist/rows/row/context.d.ts +2 -2
  195. package/dist/rows/row/row.d.ts +16 -3
  196. package/dist/rows/row/row.js +19 -4
  197. package/dist/rows/row/use-row-context-value.d.ts +5 -2
  198. package/dist/rows/row/use-row-context-value.js +23 -26
  199. package/dist/rows/row-detail-row.d.ts +4 -2
  200. package/dist/rows/row-detail-row.js +147 -124
  201. package/dist/rows/row-full-width.d.ts +12 -4
  202. package/dist/rows/row-full-width.js +35 -7
  203. package/dist/rows/rows-container.d.ts +10 -1
  204. package/dist/rows/rows-container.js +12 -3
  205. package/dist/rows/rows-sections.d.ts +30 -3
  206. package/dist/rows/rows-sections.js +42 -10
  207. package/dist/rows/scrollers/native-scroller.d.ts +3 -1
  208. package/dist/rows/scrollers/native-scroller.js +17 -13
  209. package/dist/sort-manager/+types.d.ts +14 -7
  210. package/dist/sort-manager/context.d.ts +4 -4
  211. package/dist/sort-manager/hooks/use-sort-manager.d.ts +9 -9
  212. package/dist/sort-manager/hooks/use-sort-manager.js +45 -49
  213. package/dist/sort-manager/hooks/use-sort-row-item.d.ts +57 -46
  214. package/dist/sort-manager/hooks/use-sort-row-item.js +126 -131
  215. package/dist/sort-manager/hooks/use-sortable-column-items.d.ts +6 -3
  216. package/dist/sort-manager/hooks/use-sortable-column-items.js +10 -10
  217. package/dist/sort-manager/root.d.ts +7 -1
  218. package/dist/sort-manager/root.js +10 -10
  219. package/dist/sort-manager/sort-add.d.ts +13 -5
  220. package/dist/sort-manager/sort-add.js +8 -8
  221. package/dist/sort-manager/sort-apply.d.ts +12 -4
  222. package/dist/sort-manager/sort-apply.js +16 -16
  223. package/dist/sort-manager/sort-cancel.d.ts +12 -4
  224. package/dist/sort-manager/sort-cancel.js +19 -19
  225. package/dist/sort-manager/sort-clear.d.ts +12 -4
  226. package/dist/sort-manager/sort-clear.js +15 -16
  227. package/dist/sort-manager/sort-column-select.d.ts +14 -6
  228. package/dist/sort-manager/sort-column-select.js +26 -15
  229. package/dist/sort-manager/sort-direction-select.d.ts +14 -6
  230. package/dist/sort-manager/sort-direction-select.js +27 -19
  231. package/dist/sort-manager/sort-manager.d.ts +93 -12
  232. package/dist/sort-manager/sort-manager.js +12 -12
  233. package/dist/sort-manager/sort-remove.d.ts +12 -4
  234. package/dist/sort-manager/sort-remove.js +8 -8
  235. package/dist/sort-manager/sort-row.d.ts +10 -2
  236. package/dist/sort-manager/sort-row.js +4 -1
  237. package/dist/sort-manager/sort-rows.d.ts +10 -1
  238. package/dist/sort-manager/sort-rows.js +1 -1
  239. package/dist/sort-manager/sort-value-select.d.ts +15 -7
  240. package/dist/sort-manager/sort-value-select.js +28 -19
  241. package/dist/sort-manager/utils/sort-item-to-sort-model.d.ts +4 -1
  242. package/dist/sort-manager/utils/sort-item-to-sort-model.js +46 -49
  243. package/dist/sort-manager/utils/sort-model-to-sort-items.d.ts +4 -1
  244. package/dist/sort-manager/utils/sort-model-to-sort-items.js +36 -44
  245. package/dist/state/+types.d.ts +41 -28
  246. package/dist/state/api/column-autosize.d.ts +4 -2
  247. package/dist/state/api/column-autosize.js +62 -63
  248. package/dist/state/api/column-by-id.js +4 -4
  249. package/dist/state/api/column-field.js +17 -20
  250. package/dist/state/api/column-from-index.js +4 -4
  251. package/dist/state/api/column-group-toggle.js +8 -8
  252. package/dist/state/api/column-index.js +5 -5
  253. package/dist/state/api/column-move.js +48 -46
  254. package/dist/state/api/column-resize.js +9 -7
  255. package/dist/state/api/column-update.js +11 -11
  256. package/dist/state/api/dialog-frame.d.ts +8 -4
  257. package/dist/state/api/dialog-frame.js +11 -12
  258. package/dist/state/api/edit-begin.d.ts +4 -2
  259. package/dist/state/api/edit-begin.js +71 -84
  260. package/dist/state/api/edit-end.d.ts +4 -2
  261. package/dist/state/api/edit-end.js +38 -41
  262. package/dist/state/api/edit-is-cell-active.d.ts +4 -2
  263. package/dist/state/api/edit-is-cell-active.js +17 -24
  264. package/dist/state/api/edit-update.d.ts +4 -2
  265. package/dist/state/api/edit-update.js +74 -85
  266. package/dist/state/api/event-listeners.d.ts +12 -3
  267. package/dist/state/api/event-listeners.js +16 -17
  268. package/dist/state/api/export-csv.js +33 -35
  269. package/dist/state/api/export-data-rect.js +21 -21
  270. package/dist/state/api/focus-cell.d.ts +4 -2
  271. package/dist/state/api/focus-cell.js +110 -109
  272. package/dist/state/api/popover-frame.d.ts +8 -4
  273. package/dist/state/api/popover-frame.js +11 -12
  274. package/dist/state/api/position-from-element.js +5 -6
  275. package/dist/state/api/row-by-id.js +3 -3
  276. package/dist/state/api/row-by-index.js +11 -6
  277. package/dist/state/api/row-detail-is-expanded.d.ts +3 -1
  278. package/dist/state/api/row-detail-is-expanded.js +4 -4
  279. package/dist/state/api/row-detail-rendered-height.d.ts +4 -2
  280. package/dist/state/api/row-detail-rendered-height.js +10 -12
  281. package/dist/state/api/row-detail-toggle.js +26 -30
  282. package/dist/state/api/row-group-apply-expansions.d.ts +3 -1
  283. package/dist/state/api/row-group-apply-expansions.js +15 -17
  284. package/dist/state/api/row-group-column-index.d.ts +3 -1
  285. package/dist/state/api/row-group-column-index.js +14 -12
  286. package/dist/state/api/row-group-is-expanded.d.ts +3 -1
  287. package/dist/state/api/row-group-is-expanded.js +11 -13
  288. package/dist/state/api/row-group-toggle.js +5 -5
  289. package/dist/state/api/row-handle-select.d.ts +4 -2
  290. package/dist/state/api/row-handle-select.js +36 -40
  291. package/dist/state/api/row-select-all.js +14 -15
  292. package/dist/state/api/row-select.d.ts +4 -2
  293. package/dist/state/api/row-select.js +30 -33
  294. package/dist/state/api/row-selected.js +10 -11
  295. package/dist/state/api/scroll-into-view.d.ts +4 -2
  296. package/dist/state/api/scroll-into-view.js +47 -47
  297. package/dist/state/api/sort-for-column.js +6 -7
  298. package/dist/state/api/use-row-drag.js +22 -24
  299. package/dist/state/helpers/cell-row-group.d.ts +5 -1
  300. package/dist/state/helpers/cell-row-group.js +18 -16
  301. package/dist/state/helpers/column-add-row-group.d.ts +16 -6
  302. package/dist/state/helpers/column-add-row-group.js +63 -58
  303. package/dist/state/helpers/column-layout.d.ts +7 -1
  304. package/dist/state/helpers/column-layout.js +60 -60
  305. package/dist/state/helpers/column-marker.d.ts +8 -4
  306. package/dist/state/helpers/column-marker.js +38 -34
  307. package/dist/state/helpers/column-view.d.ts +21 -15
  308. package/dist/state/helpers/column-view.js +56 -32
  309. package/dist/state/helpers/edit-on-change.d.ts +18 -10
  310. package/dist/state/helpers/edit-on-change.js +24 -24
  311. package/dist/state/helpers/empty-row-data-source.js +16 -16
  312. package/dist/state/helpers/get-data-rect.d.ts +20 -10
  313. package/dist/state/helpers/get-data-rect.js +67 -62
  314. package/dist/state/helpers/get-full-width-callback.d.ts +5 -1
  315. package/dist/state/helpers/get-full-width-callback.js +5 -6
  316. package/dist/state/helpers/get-span-callback.d.ts +6 -1
  317. package/dist/state/helpers/get-span-callback.js +15 -18
  318. package/dist/state/helpers/resolve-column.d.ts +6 -2
  319. package/dist/state/helpers/resolve-column.js +18 -18
  320. package/dist/state/helpers/row-layout/get-focus-criteria.d.ts +15 -12
  321. package/dist/state/helpers/row-layout/get-focus-criteria.js +57 -56
  322. package/dist/state/helpers/row-layout/row-layout.d.ts +15 -9
  323. package/dist/state/helpers/row-layout/row-layout.js +387 -401
  324. package/dist/state/use-lytenyte.js +556 -516
  325. package/dist/tree-view/branch/branch.d.ts +16 -8
  326. package/dist/tree-view/branch/branch.js +104 -52
  327. package/dist/tree-view/branch/use-branch-keys.d.ts +5 -1
  328. package/dist/tree-view/branch/use-branch-keys.js +71 -74
  329. package/dist/tree-view/context.d.ts +21 -17
  330. package/dist/tree-view/hooks/use-tree-view-paths.d.ts +6 -1
  331. package/dist/tree-view/hooks/use-tree-view-paths.js +5 -5
  332. package/dist/tree-view/index.d.ts +35 -7
  333. package/dist/tree-view/index.js +7 -7
  334. package/dist/tree-view/leaf.d.ts +10 -2
  335. package/dist/tree-view/leaf.js +29 -20
  336. package/dist/tree-view/navigation/get-all-ids.js +3 -3
  337. package/dist/tree-view/navigation/get-first-node.js +3 -3
  338. package/dist/tree-view/navigation/get-last-node.js +3 -3
  339. package/dist/tree-view/navigation/get-next-node.js +6 -8
  340. package/dist/tree-view/navigation/get-prev-node.js +6 -8
  341. package/dist/tree-view/panel/make-handle-navigation.js +23 -31
  342. package/dist/tree-view/panel/make-handle-selection.js +68 -77
  343. package/dist/tree-view/panel/make-handle-typeahead.js +34 -40
  344. package/dist/tree-view/panel/panel.d.ts +10 -1
  345. package/dist/tree-view/panel/panel.js +40 -20
  346. package/dist/tree-view/panel/use-tree-navigation.js +64 -52
  347. package/dist/tree-view/root.d.ts +20 -14
  348. package/dist/tree-view/root.js +53 -55
  349. package/dist/tree-view/utils/get-focusable-nodes.js +4 -2
  350. package/dist/tree-view/utils/get-focused-node.js +11 -11
  351. package/dist/tree-view/utils/get-ids-between-nodes.d.ts +5 -1
  352. package/dist/tree-view/utils/get-ids-between-nodes.js +10 -11
  353. package/dist/tree-view/utils/get-panel.js +5 -5
  354. package/dist/tree-view/utils/get-parent-node.js +6 -7
  355. package/dist/tree-view/utils/get-sibling-branches.js +8 -10
  356. package/dist/tree-view/utils/get-tree-node-id.js +1 -1
  357. package/dist/tree-view/utils/is-branch-node.js +1 -1
  358. package/dist/tree-view/utils/is-leaf-node.js +1 -1
  359. package/dist/tree-view/utils/is-tree-node-disabled.js +1 -1
  360. package/dist/tree-view/utils/select-node.d.ts +5 -1
  361. package/dist/tree-view/utils/select-node.js +8 -11
  362. package/dist/tree-view/utils/toggle-all-selections.js +4 -6
  363. package/dist/tree-view/utils/toggle-selection.js +15 -18
  364. package/dist/tree-view/virtualized/force-sync-scrolling.d.ts +3 -1
  365. package/dist/tree-view/virtualized/force-sync-scrolling.js +24 -18
  366. package/dist/tree-view/virtualized/get-virtual-tree-paths.d.ts +3 -1
  367. package/dist/tree-view/virtualized/get-virtual-tree-paths.js +11 -12
  368. package/dist/tree-view/virtualized/make-virtual-tree.d.ts +26 -21
  369. package/dist/tree-view/virtualized/make-virtual-tree.js +79 -85
  370. package/dist/tree-view/virtualized/use-flattened-tree.d.ts +17 -8
  371. package/dist/tree-view/virtualized/use-flattened-tree.js +30 -31
  372. package/dist/tree-view/virtualized/use-row-start-and-end.d.ts +6 -1
  373. package/dist/tree-view/virtualized/use-row-start-and-end.js +21 -23
  374. package/dist/tree-view/virtualized/use-virtualized-tree.d.ts +21 -15
  375. package/dist/tree-view/virtualized/use-virtualized-tree.js +103 -90
  376. package/dist/utils/cycle-sorts.js +12 -14
  377. package/dist/viewport/begin-editing.d.ts +6 -2
  378. package/dist/viewport/begin-editing.js +9 -13
  379. package/dist/viewport/viewport.d.ts +10 -1
  380. package/dist/viewport/viewport.js +93 -70
  381. package/package.json +7 -7
@@ -1,11 +1,19 @@
1
1
  import { type SlotComponent } from "@1771technologies/lytenyte-react-hooks";
2
2
  export interface TreeBranchProps {
3
- readonly itemId: string;
4
- readonly labelWrap?: SlotComponent;
5
- readonly label?: SlotComponent;
6
- readonly expander?: SlotComponent;
7
- readonly transitionEnterMs?: number;
8
- readonly transitionExitMs?: number;
9
- readonly gridWrapped?: boolean;
3
+ readonly itemId: string;
4
+ readonly labelWrap?: SlotComponent;
5
+ readonly label?: SlotComponent;
6
+ readonly expander?: SlotComponent;
7
+ readonly transitionEnterMs?: number;
8
+ readonly transitionExitMs?: number;
9
+ readonly gridWrapped?: boolean;
10
10
  }
11
- export declare const TreeBranch: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLLIElement> & import("react").LiHTMLAttributes<HTMLLIElement> & TreeBranchProps, "ref"> & import("react").RefAttributes<HTMLLIElement>>;
11
+ export declare const TreeBranch: import("react").ForwardRefExoticComponent<
12
+ Omit<
13
+ import("react").ClassAttributes<HTMLLIElement> &
14
+ import("react").LiHTMLAttributes<HTMLLIElement> &
15
+ TreeBranchProps,
16
+ "ref"
17
+ > &
18
+ import("react").RefAttributes<HTMLLIElement>
19
+ >;
@@ -1,61 +1,113 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useEffect } from "react";
3
3
  import { depthContext, useDepth } from "../depth-provider.js";
4
- import { useEvent, useSlot, useTransitionedOpen, } from "@1771technologies/lytenyte-react-hooks";
4
+ import { useEvent, useSlot, useTransitionedOpen } from "@1771technologies/lytenyte-react-hooks";
5
5
  import { useTreeRoot } from "../context.js";
6
6
  import { useBranchKeys } from "./use-branch-keys.js";
7
- export const TreeBranch = forwardRef(function TreeBranch({ itemId, label, expander, transitionEnterMs, transitionExitMs, gridWrapped, labelWrap, ...props }, forwarded) {
8
- const depth = useDepth();
9
- const root = useTreeRoot();
10
- // Manage the open and close state of the branch
11
- const expanded = root.expansions[itemId] ?? root.expansionDefault ?? false;
12
- const { open, shouldMount, state, toggle } = useTransitionedOpen({
13
- initial: expanded,
14
- timeEnter: transitionEnterMs ?? root.transitionEnterMs,
15
- timeExit: transitionExitMs ?? root.transitionExitMs,
7
+ export const TreeBranch = forwardRef(function TreeBranch(
8
+ {
9
+ itemId,
10
+ label,
11
+ expander,
12
+ transitionEnterMs,
13
+ transitionExitMs,
14
+ gridWrapped,
15
+ labelWrap,
16
+ ...props
17
+ },
18
+ forwarded,
19
+ ) {
20
+ const depth = useDepth();
21
+ const root = useTreeRoot();
22
+ // Manage the open and close state of the branch
23
+ const expanded = root.expansions[itemId] ?? root.expansionDefault ?? false;
24
+ const { open, shouldMount, state, toggle } = useTransitionedOpen({
25
+ initial: expanded,
26
+ timeEnter: transitionEnterMs ?? root.transitionEnterMs,
27
+ timeExit: transitionExitMs ?? root.transitionExitMs,
28
+ });
29
+ const onExpansionChange = useEvent((b) => {
30
+ root.onExpansionChange({
31
+ ...root.expansions,
32
+ [itemId]: b,
16
33
  });
17
- const onExpansionChange = useEvent((b) => {
18
- root.onExpansionChange({
19
- ...root.expansions,
20
- [itemId]: b,
21
- });
22
- });
23
- useEffect(() => {
24
- if (expanded === open)
25
- return;
26
- toggle(expanded);
27
- }, [expanded, open, toggle]);
28
- // Component part rendering
29
- const labelRendered = useSlot({
30
- props: [],
31
- slot: label ?? _jsx("div", {}),
32
- });
33
- const expandedProps = {
34
- onClick: () => {
35
- onExpansionChange(!expanded);
36
- },
37
- };
38
- const expanderRendered = useSlot({
39
- props: [expandedProps],
40
- slot: expander ?? _jsx("button", { children: ">" }),
41
- });
42
- const wrapped = gridWrapped ?? root.gridWrappedBranches;
43
- const labelWrapSlot = useSlot({
44
- props: [
45
- {
46
- "data-tree-branch-label": true,
47
- children: (_jsxs(_Fragment, { children: [expanderRendered, labelRendered] })),
48
- },
49
- ],
50
- slot: labelWrap ?? _jsx("div", {}),
51
- });
52
- return (_jsx(depthContext.Provider, { value: depth + 1, children: _jsxs("li", { ...props, onKeyDown: useBranchKeys(itemId, root.expansionDefault ?? false, props.onKeyDown), tabIndex: -1, ref: forwarded, role: "treeitem", "aria-expanded": open, "aria-selected": root.selection.has(itemId), "aria-level": depth + 1, "data-ln-selected": root.selection.has(itemId), "data-ln-tree-node": true, "data-ln-tree-branch": true, "data-ln-tree-id": itemId, style: {
53
- ...props.style,
54
- "--tree-depth": depth,
55
- }, children: [labelWrapSlot, _jsx("div", { children: _jsx(Wrapped, { wrapped: wrapped, expanded: open, children: shouldMount && (_jsx("ul", { "data-tree-branch-children": true, "data-expanded": open, "data-open-state": state, role: "group", children: props.children })) }) })] }) }));
34
+ });
35
+ useEffect(() => {
36
+ if (expanded === open) return;
37
+ toggle(expanded);
38
+ }, [expanded, open, toggle]);
39
+ // Component part rendering
40
+ const labelRendered = useSlot({
41
+ props: [],
42
+ slot: label ?? _jsx("div", {}),
43
+ });
44
+ const expandedProps = {
45
+ onClick: () => {
46
+ onExpansionChange(!expanded);
47
+ },
48
+ };
49
+ const expanderRendered = useSlot({
50
+ props: [expandedProps],
51
+ slot: expander ?? _jsx("button", { children: ">" }),
52
+ });
53
+ const wrapped = gridWrapped ?? root.gridWrappedBranches;
54
+ const labelWrapSlot = useSlot({
55
+ props: [
56
+ {
57
+ "data-tree-branch-label": true,
58
+ children: _jsxs(_Fragment, { children: [expanderRendered, labelRendered] }),
59
+ },
60
+ ],
61
+ slot: labelWrap ?? _jsx("div", {}),
62
+ });
63
+ return _jsx(depthContext.Provider, {
64
+ value: depth + 1,
65
+ children: _jsxs("li", {
66
+ ...props,
67
+ onKeyDown: useBranchKeys(itemId, root.expansionDefault ?? false, props.onKeyDown),
68
+ tabIndex: -1,
69
+ ref: forwarded,
70
+ role: "treeitem",
71
+ "aria-expanded": open,
72
+ "aria-selected": root.selection.has(itemId),
73
+ "aria-level": depth + 1,
74
+ "data-ln-selected": root.selection.has(itemId),
75
+ "data-ln-tree-node": true,
76
+ "data-ln-tree-branch": true,
77
+ "data-ln-tree-id": itemId,
78
+ style: {
79
+ ...props.style,
80
+ "--tree-depth": depth,
81
+ },
82
+ children: [
83
+ labelWrapSlot,
84
+ _jsx("div", {
85
+ children: _jsx(Wrapped, {
86
+ wrapped: wrapped,
87
+ expanded: open,
88
+ children:
89
+ shouldMount &&
90
+ _jsx("ul", {
91
+ "data-tree-branch-children": true,
92
+ "data-expanded": open,
93
+ "data-open-state": state,
94
+ role: "group",
95
+ children: props.children,
96
+ }),
97
+ }),
98
+ }),
99
+ ],
100
+ }),
101
+ });
56
102
  });
57
103
  function Wrapped(props) {
58
- if (!props.wrapped)
59
- return _jsx(_Fragment, { children: props.children });
60
- return (_jsx("div", { "data-tree-branch-grid-wrapped": true, "data-expanded": props.expanded, children: _jsx("div", { "data-tree-branch-grid-wrapped-content": true, children: props.children }) }));
104
+ if (!props.wrapped) return _jsx(_Fragment, { children: props.children });
105
+ return _jsx("div", {
106
+ "data-tree-branch-grid-wrapped": true,
107
+ "data-expanded": props.expanded,
108
+ children: _jsx("div", {
109
+ "data-tree-branch-grid-wrapped-content": true,
110
+ children: props.children,
111
+ }),
112
+ });
61
113
  }
@@ -1,2 +1,6 @@
1
1
  import type { KeyboardEvent, KeyboardEventHandler } from "react";
2
- export declare function useBranchKeys(id: string, defaultExpansion: boolean, current?: KeyboardEventHandler): (ev: KeyboardEvent) => void;
2
+ export declare function useBranchKeys(
3
+ id: string,
4
+ defaultExpansion: boolean,
5
+ current?: KeyboardEventHandler,
6
+ ): (ev: KeyboardEvent) => void;
@@ -9,79 +9,76 @@ import { getSiblingBranches } from "../utils/get-sibling-branches.js";
9
9
  import { getFocusables } from "@1771technologies/lytenyte-dom-utils";
10
10
  const accepted = ["ArrowRight", "ArrowLeft", "Enter", "*"];
11
11
  export function useBranchKeys(id, defaultExpansion, current) {
12
- const ctx = useTreeRoot();
13
- const onKeyDown = useEvent((ev) => {
14
- current?.(ev);
15
- if (!accepted.includes(ev.key))
16
- return;
17
- const isExpanded = ctx.expansions[id] ?? defaultExpansion;
18
- if (ev.key === "*") {
19
- const node = getFocusedNode();
20
- const siblings = getSiblingBranches(node);
21
- const next = { ...ctx.expansions };
22
- siblings?.forEach((c) => {
23
- next[getTreeNodeId(c)] = true;
24
- });
25
- ctx.onExpansionChange(next);
26
- ev.stopPropagation();
27
- return;
12
+ const ctx = useTreeRoot();
13
+ const onKeyDown = useEvent((ev) => {
14
+ current?.(ev);
15
+ if (!accepted.includes(ev.key)) return;
16
+ const isExpanded = ctx.expansions[id] ?? defaultExpansion;
17
+ if (ev.key === "*") {
18
+ const node = getFocusedNode();
19
+ const siblings = getSiblingBranches(node);
20
+ const next = { ...ctx.expansions };
21
+ siblings?.forEach((c) => {
22
+ next[getTreeNodeId(c)] = true;
23
+ });
24
+ ctx.onExpansionChange(next);
25
+ ev.stopPropagation();
26
+ return;
27
+ }
28
+ if (ev.key === "Enter") {
29
+ if (ev.currentTarget !== ev.target) return;
30
+ const next = { ...ctx.expansions };
31
+ next[id] = !isExpanded;
32
+ ctx.onExpansionChange(next);
33
+ return;
34
+ }
35
+ if (ev.key === "ArrowRight") {
36
+ const branch = getFocusedNode();
37
+ if (ev.currentTarget !== branch) return;
38
+ if (!isExpanded) {
39
+ const next = { ...ctx.expansions };
40
+ next[id] = !(next[id] ?? defaultExpansion);
41
+ ctx.onExpansionChange(next);
42
+ return;
43
+ }
44
+ const childNodes = getFocusables(branch.firstElementChild);
45
+ if (childNodes.length > 1 && childNodes.at(-1) !== document.activeElement) {
46
+ const current = childNodes.indexOf(document.activeElement);
47
+ const index = current === -1 || current === 0 ? 1 : current + 1;
48
+ childNodes[index]?.focus();
49
+ return;
50
+ }
51
+ // Get the first focusable node.
52
+ const nodes = getFocusableNodes(branch);
53
+ nodes.at(0)?.focus();
54
+ }
55
+ if (ev.key === "ArrowLeft") {
56
+ const node = getFocusedNode();
57
+ // We need to collapse this node
58
+ if (isBranchNode(node) && isExpanded) {
59
+ // Ensure we don't collapse the node when the event bubbles and the left arrow
60
+ // was pressed on a child element. Pressing left arrow on the child will focus the
61
+ // parent, and then run the parent's on keydown handler.
62
+ if (
63
+ ev.target !== ev.currentTarget &&
64
+ !ev.currentTarget.firstElementChild?.contains(document.activeElement)
65
+ )
66
+ return;
67
+ const next = { ...ctx.expansions };
68
+ const id = getTreeNodeId(node);
69
+ next[id] = false;
70
+ ctx.onExpansionChange(next);
71
+ return;
72
+ } else {
73
+ const parent = getParentNode(node);
74
+ if (!parent) {
75
+ const focusNodes = getFocusableNodes(ctx.panel);
76
+ focusNodes.at(0)?.focus();
77
+ } else {
78
+ parent.focus();
28
79
  }
29
- if (ev.key === "Enter") {
30
- if (ev.currentTarget !== ev.target)
31
- return;
32
- const next = { ...ctx.expansions };
33
- next[id] = !isExpanded;
34
- ctx.onExpansionChange(next);
35
- return;
36
- }
37
- if (ev.key === "ArrowRight") {
38
- const branch = getFocusedNode();
39
- if (ev.currentTarget !== branch)
40
- return;
41
- if (!isExpanded) {
42
- const next = { ...ctx.expansions };
43
- next[id] = !(next[id] ?? defaultExpansion);
44
- ctx.onExpansionChange(next);
45
- return;
46
- }
47
- const childNodes = getFocusables(branch.firstElementChild);
48
- if (childNodes.length > 1 && childNodes.at(-1) !== document.activeElement) {
49
- const current = childNodes.indexOf(document.activeElement);
50
- const index = current === -1 || current === 0 ? 1 : current + 1;
51
- childNodes[index]?.focus();
52
- return;
53
- }
54
- // Get the first focusable node.
55
- const nodes = getFocusableNodes(branch);
56
- nodes.at(0)?.focus();
57
- }
58
- if (ev.key === "ArrowLeft") {
59
- const node = getFocusedNode();
60
- // We need to collapse this node
61
- if (isBranchNode(node) && isExpanded) {
62
- // Ensure we don't collapse the node when the event bubbles and the left arrow
63
- // was pressed on a child element. Pressing left arrow on the child will focus the
64
- // parent, and then run the parent's on keydown handler.
65
- if (ev.target !== ev.currentTarget &&
66
- !ev.currentTarget.firstElementChild?.contains(document.activeElement))
67
- return;
68
- const next = { ...ctx.expansions };
69
- const id = getTreeNodeId(node);
70
- next[id] = false;
71
- ctx.onExpansionChange(next);
72
- return;
73
- }
74
- else {
75
- const parent = getParentNode(node);
76
- if (!parent) {
77
- const focusNodes = getFocusableNodes(ctx.panel);
78
- focusNodes.at(0)?.focus();
79
- }
80
- else {
81
- parent.focus();
82
- }
83
- }
84
- }
85
- });
86
- return onKeyDown;
80
+ }
81
+ }
82
+ });
83
+ return onKeyDown;
87
84
  }
@@ -1,22 +1,26 @@
1
1
  import { type Dispatch, type SetStateAction } from "react";
2
2
  export interface TreeViewRootContext {
3
- readonly panel: HTMLUListElement | null;
4
- readonly panelRef: Dispatch<SetStateAction<HTMLUListElement | null>>;
5
- readonly expansions: Record<string, boolean>;
6
- readonly onExpansionChange: (n: Record<string, boolean>) => void;
7
- readonly expansionDefault: boolean;
8
- readonly selectionMode: "single" | "multiple" | "none";
9
- readonly selection: Set<string>;
10
- readonly onSelectionChange: (c: Set<string>) => void;
11
- readonly selectionPivotRef: {
12
- current: string | null;
13
- };
14
- readonly transitionEnterMs: number;
15
- readonly transitionExitMs: number;
16
- readonly gridWrappedBranches: boolean;
17
- readonly onFocusChange: (el: HTMLElement | null) => void;
18
- readonly getAllIds: (panel: HTMLElement) => Set<string>;
19
- readonly getIdsBetweenNodes: (start: HTMLElement, end: HTMLElement, panel: HTMLElement) => string[];
3
+ readonly panel: HTMLUListElement | null;
4
+ readonly panelRef: Dispatch<SetStateAction<HTMLUListElement | null>>;
5
+ readonly expansions: Record<string, boolean>;
6
+ readonly onExpansionChange: (n: Record<string, boolean>) => void;
7
+ readonly expansionDefault: boolean;
8
+ readonly selectionMode: "single" | "multiple" | "none";
9
+ readonly selection: Set<string>;
10
+ readonly onSelectionChange: (c: Set<string>) => void;
11
+ readonly selectionPivotRef: {
12
+ current: string | null;
13
+ };
14
+ readonly transitionEnterMs: number;
15
+ readonly transitionExitMs: number;
16
+ readonly gridWrappedBranches: boolean;
17
+ readonly onFocusChange: (el: HTMLElement | null) => void;
18
+ readonly getAllIds: (panel: HTMLElement) => Set<string>;
19
+ readonly getIdsBetweenNodes: (
20
+ start: HTMLElement,
21
+ end: HTMLElement,
22
+ panel: HTMLElement,
23
+ ) => string[];
20
24
  }
21
25
  export declare const context: import("react").Context<TreeViewRootContext>;
22
26
  export declare const useTreeRoot: () => TreeViewRootContext;
@@ -1,2 +1,7 @@
1
1
  import { type PathProvidedItem } from "@1771technologies/lytenyte-shared";
2
- export declare function useTreeViewPaths<T extends PathProvidedItem>(paths: T[]): (import("@1771technologies/lytenyte-shared").PathBranch<T> | import("@1771technologies/lytenyte-shared").PathLeaf<T>)[];
2
+ export declare function useTreeViewPaths<T extends PathProvidedItem>(
3
+ paths: T[],
4
+ ): (
5
+ | import("@1771technologies/lytenyte-shared").PathBranch<T>
6
+ | import("@1771technologies/lytenyte-shared").PathLeaf<T>
7
+ )[];
@@ -1,9 +1,9 @@
1
1
  import { computePathTree } from "@1771technologies/lytenyte-shared";
2
2
  import { useMemo } from "react";
3
3
  export function useTreeViewPaths(paths) {
4
- const tree = useMemo(() => {
5
- const result = computePathTree(paths);
6
- return [...result.children.values()];
7
- }, [paths]);
8
- return tree;
4
+ const tree = useMemo(() => {
5
+ const result = computePathTree(paths);
6
+ return [...result.children.values()];
7
+ }, [paths]);
8
+ return tree;
9
9
  }
@@ -2,13 +2,41 @@ import { useTreeViewPaths } from "./hooks/use-tree-view-paths.js";
2
2
  import { ForceSyncScrolling } from "./virtualized/force-sync-scrolling.js";
3
3
  import { useVirtualizedTree } from "./virtualized/use-virtualized-tree.js";
4
4
  export declare const Tree: {
5
- Leaf: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLLIElement> & import("react").LiHTMLAttributes<HTMLLIElement> & import("./leaf.js").TreeLeafProps, "ref"> & import("react").RefAttributes<HTMLLIElement>>;
6
- Branch: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLLIElement> & import("react").LiHTMLAttributes<HTMLLIElement> & import("./index.js").TreeBranchProps, "ref"> & import("react").RefAttributes<HTMLLIElement>>;
7
- Root: import("react").ForwardRefExoticComponent<Omit<import("react").PropsWithChildren<import("./root.js").TreeRootProps>, "ref"> & import("react").RefAttributes<HTMLElement>>;
8
- Panel: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & import("react").RefAttributes<HTMLUListElement>>;
9
- usePaths: typeof useTreeViewPaths;
10
- useVirtualTree: typeof useVirtualizedTree;
11
- ForceSyncScrolling: typeof ForceSyncScrolling;
5
+ Leaf: import("react").ForwardRefExoticComponent<
6
+ Omit<
7
+ import("react").ClassAttributes<HTMLLIElement> &
8
+ import("react").LiHTMLAttributes<HTMLLIElement> &
9
+ import("./leaf.js").TreeLeafProps,
10
+ "ref"
11
+ > &
12
+ import("react").RefAttributes<HTMLLIElement>
13
+ >;
14
+ Branch: import("react").ForwardRefExoticComponent<
15
+ Omit<
16
+ import("react").ClassAttributes<HTMLLIElement> &
17
+ import("react").LiHTMLAttributes<HTMLLIElement> &
18
+ import("./index.js").TreeBranchProps,
19
+ "ref"
20
+ > &
21
+ import("react").RefAttributes<HTMLLIElement>
22
+ >;
23
+ Root: import("react").ForwardRefExoticComponent<
24
+ Omit<import("react").PropsWithChildren<import("./root.js").TreeRootProps>, "ref"> &
25
+ import("react").RefAttributes<HTMLElement>
26
+ >;
27
+ Panel: import("react").ForwardRefExoticComponent<
28
+ Omit<
29
+ import("react").DetailedHTMLProps<
30
+ import("react").HTMLAttributes<HTMLUListElement>,
31
+ HTMLUListElement
32
+ >,
33
+ "ref"
34
+ > &
35
+ import("react").RefAttributes<HTMLUListElement>
36
+ >;
37
+ usePaths: typeof useTreeViewPaths;
38
+ useVirtualTree: typeof useVirtualizedTree;
39
+ ForceSyncScrolling: typeof ForceSyncScrolling;
12
40
  };
13
41
  export type { TreeRootProps } from "./root.js";
14
42
  export type { TreeBranchProps } from "./branch/branch.js";
@@ -6,11 +6,11 @@ import { TreeRoot } from "./root.js";
6
6
  import { ForceSyncScrolling } from "./virtualized/force-sync-scrolling.js";
7
7
  import { useVirtualizedTree } from "./virtualized/use-virtualized-tree.js";
8
8
  export const Tree = {
9
- Leaf: TreeLeaf,
10
- Branch: TreeBranch,
11
- Root: TreeRoot,
12
- Panel: TreePanel,
13
- usePaths: useTreeViewPaths,
14
- useVirtualTree: useVirtualizedTree,
15
- ForceSyncScrolling,
9
+ Leaf: TreeLeaf,
10
+ Branch: TreeBranch,
11
+ Root: TreeRoot,
12
+ Panel: TreePanel,
13
+ usePaths: useTreeViewPaths,
14
+ useVirtualTree: useVirtualizedTree,
15
+ ForceSyncScrolling,
16
16
  };
@@ -1,4 +1,12 @@
1
1
  export interface TreeLeafProps {
2
- readonly itemId: string;
2
+ readonly itemId: string;
3
3
  }
4
- export declare const TreeLeaf: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLLIElement> & import("react").LiHTMLAttributes<HTMLLIElement> & TreeLeafProps, "ref"> & import("react").RefAttributes<HTMLLIElement>>;
4
+ export declare const TreeLeaf: import("react").ForwardRefExoticComponent<
5
+ Omit<
6
+ import("react").ClassAttributes<HTMLLIElement> &
7
+ import("react").LiHTMLAttributes<HTMLLIElement> &
8
+ TreeLeafProps,
9
+ "ref"
10
+ > &
11
+ import("react").RefAttributes<HTMLLIElement>
12
+ >;
@@ -4,24 +4,33 @@ import { useDepth } from "./depth-provider.js";
4
4
  import { useTreeRoot } from "./context.js";
5
5
  import { getFocusables } from "@1771technologies/lytenyte-dom-utils";
6
6
  export const TreeLeaf = forwardRef(function TreeLeaf({ itemId, ...props }, forwarded) {
7
- const depth = useDepth();
8
- const root = useTreeRoot();
9
- return (_jsx("li", { ...props, tabIndex: -1, "data-ln-tree-node": true, "data-ln-tree-leaf": true, "data-ln-selected": root.selection.has(itemId), "data-ln-tree-id": itemId, onKeyDown: (e) => {
10
- props.onKeyDown?.(e);
11
- if ((e.key !== "ArrowLeft" && e.key !== "ArrowRight") ||
12
- e.metaKey ||
13
- e.ctrlKey ||
14
- e.shiftKey)
15
- return;
16
- const nodes = getFocusables(e.currentTarget);
17
- const index = nodes.indexOf(document.activeElement);
18
- if (index === -1) {
19
- nodes.at(0)?.focus();
20
- return;
21
- }
22
- if (e.key === "ArrowLeft")
23
- nodes[index === 0 ? nodes.length - 1 : index - 1].focus();
24
- else
25
- nodes[index === nodes.length - 1 ? 0 : index + 1].focus();
26
- }, ref: forwarded, role: "treeitem", "aria-level": depth + 1, "aria-selected": root.selection.has(itemId), style: { ...props.style, "--tree-depth": depth }, children: props.children }));
7
+ const depth = useDepth();
8
+ const root = useTreeRoot();
9
+ return _jsx("li", {
10
+ ...props,
11
+ tabIndex: -1,
12
+ "data-ln-tree-node": true,
13
+ "data-ln-tree-leaf": true,
14
+ "data-ln-selected": root.selection.has(itemId),
15
+ "data-ln-tree-id": itemId,
16
+ onKeyDown: (e) => {
17
+ props.onKeyDown?.(e);
18
+ if ((e.key !== "ArrowLeft" && e.key !== "ArrowRight") || e.metaKey || e.ctrlKey || e.shiftKey)
19
+ return;
20
+ const nodes = getFocusables(e.currentTarget);
21
+ const index = nodes.indexOf(document.activeElement);
22
+ if (index === -1) {
23
+ nodes.at(0)?.focus();
24
+ return;
25
+ }
26
+ if (e.key === "ArrowLeft") nodes[index === 0 ? nodes.length - 1 : index - 1].focus();
27
+ else nodes[index === nodes.length - 1 ? 0 : index + 1].focus();
28
+ },
29
+ ref: forwarded,
30
+ role: "treeitem",
31
+ "aria-level": depth + 1,
32
+ "aria-selected": root.selection.has(itemId),
33
+ style: { ...props.style, "--tree-depth": depth },
34
+ children: props.children,
35
+ });
27
36
  });
@@ -1,7 +1,7 @@
1
1
  import { getFocusableNodes } from "../utils/get-focusable-nodes.js";
2
2
  import { getTreeNodeId } from "../utils/get-tree-node-id.js";
3
3
  export function getAllIds(panel) {
4
- const focusables = getFocusableNodes(panel);
5
- const allIds = new Set(focusables.map((c) => getTreeNodeId(c)));
6
- return allIds;
4
+ const focusables = getFocusableNodes(panel);
5
+ const allIds = new Set(focusables.map((c) => getTreeNodeId(c)));
6
+ return allIds;
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import { getFocusableNodes } from "../utils/get-focusable-nodes.js";
2
2
  import { isTreeNodeDisabled } from "../utils/is-tree-node-disabled.js";
3
3
  export function getFirstNode(panel) {
4
- const focusables = getFocusableNodes(panel);
5
- const first = focusables.find((c) => !isTreeNodeDisabled(c));
6
- return first;
4
+ const focusables = getFocusableNodes(panel);
5
+ const first = focusables.find((c) => !isTreeNodeDisabled(c));
6
+ return first;
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import { getFocusableNodes } from "../utils/get-focusable-nodes.js";
2
2
  import { isTreeNodeDisabled } from "../utils/is-tree-node-disabled.js";
3
3
  export function getLastNode(panel) {
4
- const focusables = getFocusableNodes(panel);
5
- const first = focusables.findLast((c) => !isTreeNodeDisabled(c));
6
- return first;
4
+ const focusables = getFocusableNodes(panel);
5
+ const first = focusables.findLast((c) => !isTreeNodeDisabled(c));
6
+ return first;
7
7
  }
@@ -2,12 +2,10 @@ import { getFocusableNodes } from "../utils/get-focusable-nodes.js";
2
2
  import { getPanel } from "../utils/get-panel.js";
3
3
  // Assumes that el is a branch or leaf node
4
4
  export function getNextNode(el) {
5
- const panel = getPanel(el);
6
- if (!panel)
7
- return;
8
- const focusables = getFocusableNodes(panel);
9
- const index = focusables.indexOf(el);
10
- if (index === -1)
11
- return;
12
- return focusables.at(index + 1);
5
+ const panel = getPanel(el);
6
+ if (!panel) return;
7
+ const focusables = getFocusableNodes(panel);
8
+ const index = focusables.indexOf(el);
9
+ if (index === -1) return;
10
+ return focusables.at(index + 1);
13
11
  }
@@ -2,12 +2,10 @@ import { getFocusableNodes } from "../utils/get-focusable-nodes.js";
2
2
  import { getPanel } from "../utils/get-panel.js";
3
3
  // Assumes that el is a branch or leaf node
4
4
  export function getPrevNode(el) {
5
- const panel = getPanel(el);
6
- if (!panel)
7
- return;
8
- const focusables = getFocusableNodes(panel);
9
- const index = focusables.indexOf(el);
10
- if (index === -1)
11
- return;
12
- return focusables[index - 1];
5
+ const panel = getPanel(el);
6
+ if (!panel) return;
7
+ const focusables = getFocusableNodes(panel);
8
+ const index = focusables.indexOf(el);
9
+ if (index === -1) return;
10
+ return focusables[index - 1];
13
11
  }