@1771technologies/lytenyte-pro 1.0.12-dev.1 → 1.0.12-dev.2

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 (499) hide show
  1. package/dist/+types.d.ts +5836 -0
  2. package/dist/+types.js +1 -0
  3. package/dist/cell-selection/adjust-rect-for-row-and-cell-span.d.ts +2 -0
  4. package/dist/cell-selection/adjust-rect-for-row-and-cell-span.js +43 -0
  5. package/dist/cell-selection/are-rects-equal.d.ts +2 -0
  6. package/dist/cell-selection/are-rects-equal.js +6 -0
  7. package/dist/cell-selection/bound-selection-rect.d.ts +2 -0
  8. package/dist/cell-selection/bound-selection-rect.js +17 -0
  9. package/dist/cell-selection/cell-selection-containers.d.ts +3 -0
  10. package/dist/cell-selection/cell-selection-containers.js +91 -0
  11. package/dist/cell-selection/cell-selection-driver.d.ts +1 -0
  12. package/dist/cell-selection/cell-selection-driver.js +285 -0
  13. package/dist/cell-selection/cell-style-row.d.ts +8 -0
  14. package/dist/cell-selection/cell-style-row.js +84 -0
  15. package/dist/cell-selection/deselect-rect-range.d.ts +2 -0
  16. package/dist/cell-selection/deselect-rect-range.js +43 -0
  17. package/dist/cell-selection/expand-cell-selection-down.d.ts +5 -0
  18. package/dist/cell-selection/expand-cell-selection-down.js +39 -0
  19. package/dist/cell-selection/expand-cell-selection-end.d.ts +5 -0
  20. package/dist/cell-selection/expand-cell-selection-end.js +40 -0
  21. package/dist/cell-selection/expand-cell-selection-start.d.ts +5 -0
  22. package/dist/cell-selection/expand-cell-selection-start.js +39 -0
  23. package/dist/cell-selection/expand-cell-selection-up.d.ts +5 -0
  24. package/dist/cell-selection/expand-cell-selection-up.js +39 -0
  25. package/dist/cell-selection/full-width-start-end-index.d.ts +2 -0
  26. package/dist/cell-selection/full-width-start-end-index.js +5 -0
  27. package/dist/cell-selection/get-root-cell.d.ts +2 -0
  28. package/dist/cell-selection/get-root-cell.js +6 -0
  29. package/dist/cell-selection/index.d.ts +18 -0
  30. package/dist/cell-selection/index.js +18 -0
  31. package/dist/cell-selection/is-bottom-rect.d.ts +2 -0
  32. package/dist/cell-selection/is-bottom-rect.js +7 -0
  33. package/dist/cell-selection/is-center-col-rect.d.ts +5 -0
  34. package/dist/cell-selection/is-center-col-rect.js +5 -0
  35. package/dist/cell-selection/is-center-rect.d.ts +2 -0
  36. package/dist/cell-selection/is-center-rect.js +5 -0
  37. package/dist/cell-selection/is-end-rect.d.ts +5 -0
  38. package/dist/cell-selection/is-end-rect.js +4 -0
  39. package/dist/cell-selection/is-overlapping-rect.d.ts +2 -0
  40. package/dist/cell-selection/is-overlapping-rect.js +6 -0
  41. package/dist/cell-selection/is-start-rect.d.ts +5 -0
  42. package/dist/cell-selection/is-start-rect.js +4 -0
  43. package/dist/cell-selection/is-top-rect.d.ts +2 -0
  44. package/dist/cell-selection/is-top-rect.js +4 -0
  45. package/dist/cell-selection/is-within-selection-rect.d.ts +2 -0
  46. package/dist/cell-selection/is-within-selection-rect.js +3 -0
  47. package/dist/cell-selection/split-cell-selection-rect.d.ts +46 -0
  48. package/dist/cell-selection/split-cell-selection-rect.js +88 -0
  49. package/dist/cell-selection/split-on-pivot.d.ts +3 -0
  50. package/dist/cell-selection/split-on-pivot.js +50 -0
  51. package/dist/cell-selection/update-additive-cell-selection.d.ts +5 -0
  52. package/dist/cell-selection/update-additive-cell-selection.js +23 -0
  53. package/dist/cell-selection/use-edge-scroll.d.ts +10 -0
  54. package/dist/cell-selection/use-edge-scroll.js +66 -0
  55. package/dist/cells/+types.cell.d.ts +13 -0
  56. package/dist/cells/+types.cell.js +1 -0
  57. package/dist/cells/cell-default.d.ts +2 -0
  58. package/dist/cells/cell-default.js +8 -0
  59. package/dist/cells/cell-editor.d.ts +6 -0
  60. package/dist/cells/cell-editor.js +103 -0
  61. package/dist/cells/cell-spacer.d.ts +9 -0
  62. package/dist/cells/cell-spacer.js +34 -0
  63. package/dist/cells/cell.d.ts +5 -0
  64. package/dist/cells/cell.js +43 -0
  65. package/dist/cells/use-cell-style.d.ts +3 -0
  66. package/dist/cells/use-cell-style.js +51 -0
  67. package/dist/column-manager/branch-lookup-context.d.ts +4 -0
  68. package/dist/column-manager/branch-lookup-context.js +3 -0
  69. package/dist/column-manager/branch.d.ts +15 -0
  70. package/dist/column-manager/branch.js +54 -0
  71. package/dist/column-manager/column-manager.d.ts +13 -0
  72. package/dist/column-manager/column-manager.js +18 -0
  73. package/dist/column-manager/context.d.ts +7 -0
  74. package/dist/column-manager/context.js +3 -0
  75. package/dist/column-manager/label.d.ts +5 -0
  76. package/dist/column-manager/label.js +18 -0
  77. package/dist/column-manager/leaf.d.ts +6 -0
  78. package/dist/column-manager/leaf.js +58 -0
  79. package/dist/column-manager/move-handle.d.ts +5 -0
  80. package/dist/column-manager/move-handle.js +73 -0
  81. package/dist/column-manager/panel.d.ts +1 -0
  82. package/dist/column-manager/panel.js +2 -0
  83. package/dist/column-manager/root.d.ts +8 -0
  84. package/dist/column-manager/root.js +7 -0
  85. package/dist/column-manager/use-column-manager.d.ts +10 -0
  86. package/dist/column-manager/use-column-manager.js +24 -0
  87. package/dist/column-manager/use-columns-from-context.d.ts +3 -0
  88. package/dist/column-manager/use-columns-from-context.js +23 -0
  89. package/dist/column-manager/visibility-checkbox.d.ts +9 -0
  90. package/dist/column-manager/visibility-checkbox.js +30 -0
  91. package/dist/context.d.ts +10 -0
  92. package/dist/context.js +4 -0
  93. package/dist/filter-tree/branch.d.ts +13 -0
  94. package/dist/filter-tree/branch.js +21 -0
  95. package/dist/filter-tree/context.d.ts +27 -0
  96. package/dist/filter-tree/context.js +5 -0
  97. package/dist/filter-tree/filter-tree.d.ts +14 -0
  98. package/dist/filter-tree/filter-tree.js +18 -0
  99. package/dist/filter-tree/hooks/use-filter-tree.d.ts +38 -0
  100. package/dist/filter-tree/hooks/use-filter-tree.js +101 -0
  101. package/dist/filter-tree/hooks/use-tree-item.d.ts +8 -0
  102. package/dist/filter-tree/hooks/use-tree-item.js +116 -0
  103. package/dist/filter-tree/inclusion-checkbox.d.ts +9 -0
  104. package/dist/filter-tree/inclusion-checkbox.js +14 -0
  105. package/dist/filter-tree/label.d.ts +5 -0
  106. package/dist/filter-tree/label.js +18 -0
  107. package/dist/filter-tree/leaf.d.ts +6 -0
  108. package/dist/filter-tree/leaf.js +14 -0
  109. package/dist/filter-tree/root.d.ts +13 -0
  110. package/dist/filter-tree/root.js +30 -0
  111. package/dist/grid-box/+types.d.ts +15 -0
  112. package/dist/grid-box/+types.js +1 -0
  113. package/dist/grid-box/context.d.ts +9 -0
  114. package/dist/grid-box/context.js +3 -0
  115. package/dist/grid-box/grid-box.d.ts +12 -0
  116. package/dist/grid-box/grid-box.js +14 -0
  117. package/dist/grid-box/item.d.ts +10 -0
  118. package/dist/grid-box/item.js +63 -0
  119. package/dist/grid-box/panel.d.ts +1 -0
  120. package/dist/grid-box/panel.js +9 -0
  121. package/dist/grid-box/root.d.ts +9 -0
  122. package/dist/grid-box/root.js +8 -0
  123. package/dist/grid-box/use-aggregation-box-items.d.ts +18 -0
  124. package/dist/grid-box/use-aggregation-box-items.js +61 -0
  125. package/dist/grid-box/use-column-box-items.d.ts +34 -0
  126. package/dist/grid-box/use-column-box-items.js +78 -0
  127. package/dist/grid-box/use-row-group-box-items.d.ts +18 -0
  128. package/dist/grid-box/use-row-group-box-items.js +169 -0
  129. package/dist/grid-provider/context.d.ts +5 -0
  130. package/dist/grid-provider/context.js +2 -0
  131. package/dist/grid-provider/provider.d.ts +3 -0
  132. package/dist/grid-provider/provider.js +2 -0
  133. package/dist/grid-provider/use-grid.d.ts +3 -0
  134. package/dist/grid-provider/use-grid.js +3 -0
  135. package/dist/grid.d.ts +18 -0
  136. package/dist/grid.js +28 -0
  137. package/dist/header/header-cell.d.ts +10 -0
  138. package/dist/header/header-cell.js +22 -0
  139. package/dist/header/header-group-cell.d.ts +5 -0
  140. package/dist/header/header-group-cell.js +16 -0
  141. package/dist/header/header-row.d.ts +4 -0
  142. package/dist/header/header-row.js +10 -0
  143. package/dist/header/header.d.ts +1 -0
  144. package/dist/header/header.js +12 -0
  145. package/dist/header/resize-handler.d.ts +12 -0
  146. package/dist/header/resize-handler.js +136 -0
  147. package/dist/header/use-drag-move.d.ts +14 -0
  148. package/dist/header/use-drag-move.js +97 -0
  149. package/dist/header/use-header-cell-renderer.d.ts +4 -0
  150. package/dist/header/use-header-cell-renderer.js +36 -0
  151. package/dist/icons/index.d.ts +1 -0
  152. package/dist/icons/index.js +3 -0
  153. package/dist/index.d.ts +13 -0
  154. package/dist/index.js +13 -0
  155. package/dist/license.d.ts +3 -0
  156. package/dist/license.js +214 -0
  157. package/dist/listbox/context.d.ts +6 -0
  158. package/dist/listbox/context.js +3 -0
  159. package/dist/listbox/item.d.ts +1 -0
  160. package/dist/listbox/item.js +25 -0
  161. package/dist/listbox/panel.d.ts +1 -0
  162. package/dist/listbox/panel.js +50 -0
  163. package/dist/listbox/root.d.ts +6 -0
  164. package/dist/listbox/root.js +12 -0
  165. package/dist/root/dialog-driver.d.ts +1 -0
  166. package/dist/root/dialog-driver.js +21 -0
  167. package/dist/root/popover-driver.d.ts +1 -0
  168. package/dist/root/popover-driver.js +21 -0
  169. package/dist/root/root.d.ts +8 -0
  170. package/dist/root/root.js +125 -0
  171. package/dist/row-data-source-client/+constants.d.ts +2 -0
  172. package/dist/row-data-source-client/+constants.js +2 -0
  173. package/dist/row-data-source-client/+types.d.ts +27 -0
  174. package/dist/row-data-source-client/+types.js +1 -0
  175. package/dist/row-data-source-client/built-ins/avg.d.ts +10 -0
  176. package/dist/row-data-source-client/built-ins/avg.js +16 -0
  177. package/dist/row-data-source-client/built-ins/built-ins.d.ts +44 -0
  178. package/dist/row-data-source-client/built-ins/built-ins.js +44 -0
  179. package/dist/row-data-source-client/built-ins/count.d.ts +10 -0
  180. package/dist/row-data-source-client/built-ins/count.js +16 -0
  181. package/dist/row-data-source-client/built-ins/first.d.ts +10 -0
  182. package/dist/row-data-source-client/built-ins/first.js +12 -0
  183. package/dist/row-data-source-client/built-ins/group.d.ts +1 -0
  184. package/dist/row-data-source-client/built-ins/group.js +3 -0
  185. package/dist/row-data-source-client/built-ins/last.d.ts +10 -0
  186. package/dist/row-data-source-client/built-ins/last.js +12 -0
  187. package/dist/row-data-source-client/built-ins/max.d.ts +11 -0
  188. package/dist/row-data-source-client/built-ins/max.js +25 -0
  189. package/dist/row-data-source-client/built-ins/min.d.ts +11 -0
  190. package/dist/row-data-source-client/built-ins/min.js +25 -0
  191. package/dist/row-data-source-client/built-ins/sum.d.ts +10 -0
  192. package/dist/row-data-source-client/built-ins/sum.js +21 -0
  193. package/dist/row-data-source-client/filter/+types.d.ts +23 -0
  194. package/dist/row-data-source-client/filter/+types.js +1 -0
  195. package/dist/row-data-source-client/filter/compute-filtered-rows.d.ts +2 -0
  196. package/dist/row-data-source-client/filter/compute-filtered-rows.js +109 -0
  197. package/dist/row-data-source-client/pivots/create-agg-model.d.ts +6 -0
  198. package/dist/row-data-source-client/pivots/create-agg-model.js +13 -0
  199. package/dist/row-data-source-client/pivots/create-pivot-columns-from-paths.d.ts +2 -0
  200. package/dist/row-data-source-client/pivots/create-pivot-columns-from-paths.js +50 -0
  201. package/dist/row-data-source-client/pivots/create-pivot-columns.d.ts +2 -0
  202. package/dist/row-data-source-client/pivots/create-pivot-columns.js +22 -0
  203. package/dist/row-data-source-client/pivots/create-pivot-tree.d.ts +2 -0
  204. package/dist/row-data-source-client/pivots/create-pivot-tree.js +23 -0
  205. package/dist/row-data-source-client/tree/client-tree.d.ts +18 -0
  206. package/dist/row-data-source-client/tree/client-tree.js +76 -0
  207. package/dist/row-data-source-client/tree/evaluator-aggregation.d.ts +2 -0
  208. package/dist/row-data-source-client/tree/evaluator-aggregation.js +8 -0
  209. package/dist/row-data-source-client/tree/evaluator-group.d.ts +2 -0
  210. package/dist/row-data-source-client/tree/evaluator-group.js +9 -0
  211. package/dist/row-data-source-client/tree/traverse.d.ts +2 -0
  212. package/dist/row-data-source-client/tree/traverse.js +22 -0
  213. package/dist/row-data-source-client/use-client-data-source-paginated.d.ts +10 -0
  214. package/dist/row-data-source-client/use-client-data-source-paginated.js +572 -0
  215. package/dist/row-data-source-client/use-client-data-source.d.ts +10 -0
  216. package/dist/row-data-source-client/use-client-data-source.js +666 -0
  217. package/dist/row-data-source-client/use-client-tree-data-source.d.ts +9 -0
  218. package/dist/row-data-source-client/use-client-tree-data-source.js +511 -0
  219. package/dist/row-data-source-server/async-tree/+constants.async-tree.d.ts +1 -0
  220. package/dist/row-data-source-server/async-tree/+constants.async-tree.js +1 -0
  221. package/dist/row-data-source-server/async-tree/+types.async-tree.d.ts +59 -0
  222. package/dist/row-data-source-server/async-tree/+types.async-tree.js +1 -0
  223. package/dist/row-data-source-server/async-tree/apply-delete-action-to-tree.d.ts +2 -0
  224. package/dist/row-data-source-server/async-tree/apply-delete-action-to-tree.js +27 -0
  225. package/dist/row-data-source-server/async-tree/apply-set-action-to-tree.d.ts +2 -0
  226. package/dist/row-data-source-server/async-tree/apply-set-action-to-tree.js +36 -0
  227. package/dist/row-data-source-server/async-tree/check-set-action-item-keys-are-unique.d.ts +2 -0
  228. package/dist/row-data-source-server/async-tree/check-set-action-item-keys-are-unique.js +24 -0
  229. package/dist/row-data-source-server/async-tree/check-set-action-item-keys-are-valid.d.ts +2 -0
  230. package/dist/row-data-source-server/async-tree/check-set-action-item-keys-are-valid.js +14 -0
  231. package/dist/row-data-source-server/async-tree/check-set-action-item-keys-fit.d.ts +2 -0
  232. package/dist/row-data-source-server/async-tree/check-set-action-item-keys-fit.js +18 -0
  233. package/dist/row-data-source-server/async-tree/check-set-action-item-kinds.d.ts +2 -0
  234. package/dist/row-data-source-server/async-tree/check-set-action-item-kinds.js +14 -0
  235. package/dist/row-data-source-server/async-tree/get-parent-node-by-path.d.ts +2 -0
  236. package/dist/row-data-source-server/async-tree/get-parent-node-by-path.js +18 -0
  237. package/dist/row-data-source-server/async-tree/is-set-action-a-no-op-on-node.d.ts +2 -0
  238. package/dist/row-data-source-server/async-tree/is-set-action-a-no-op-on-node.js +3 -0
  239. package/dist/row-data-source-server/async-tree/make-async-tree.d.ts +2 -0
  240. package/dist/row-data-source-server/async-tree/make-async-tree.js +19 -0
  241. package/dist/row-data-source-server/async-tree/maybe-apply-parent-remove-self.d.ts +2 -0
  242. package/dist/row-data-source-server/async-tree/maybe-apply-parent-remove-self.js +8 -0
  243. package/dist/row-data-source-server/async-tree/maybe-apply-resize.d.ts +2 -0
  244. package/dist/row-data-source-server/async-tree/maybe-apply-resize.js +17 -0
  245. package/dist/row-data-source-server/async-tree/maybe-apply-set-action-items.d.ts +2 -0
  246. package/dist/row-data-source-server/async-tree/maybe-apply-set-action-items.js +52 -0
  247. package/dist/row-data-source-server/range-tree/range-tree.d.ts +66 -0
  248. package/dist/row-data-source-server/range-tree/range-tree.js +102 -0
  249. package/dist/row-data-source-server/server-data.d.ts +48 -0
  250. package/dist/row-data-source-server/server-data.js +378 -0
  251. package/dist/row-data-source-server/use-server-data-source.d.ts +3 -0
  252. package/dist/row-data-source-server/use-server-data-source.js +344 -0
  253. package/dist/row-data-source-server/utils/get-node-depth.d.ts +2 -0
  254. package/dist/row-data-source-server/utils/get-node-depth.js +9 -0
  255. package/dist/row-data-source-server/utils/get-node-path.d.ts +2 -0
  256. package/dist/row-data-source-server/utils/get-node-path.js +9 -0
  257. package/dist/row-data-source-server/utils/get-request-id.d.ts +1 -0
  258. package/dist/row-data-source-server/utils/get-request-id.js +6 -0
  259. package/dist/rows/row/context.d.ts +14 -0
  260. package/dist/rows/row/context.js +13 -0
  261. package/dist/rows/row/row.d.ts +7 -0
  262. package/dist/rows/row/row.js +25 -0
  263. package/dist/rows/row/use-row-context-value.d.ts +6 -0
  264. package/dist/rows/row/use-row-context-value.js +44 -0
  265. package/dist/rows/row-detail-row.d.ts +4 -0
  266. package/dist/rows/row-detail-row.js +130 -0
  267. package/dist/rows/row-full-width.d.ts +8 -0
  268. package/dist/rows/row-full-width.js +19 -0
  269. package/dist/rows/rows-container.d.ts +1 -0
  270. package/dist/rows/rows-container.js +9 -0
  271. package/dist/rows/rows-sections.d.ts +3 -0
  272. package/dist/rows/rows-sections.js +27 -0
  273. package/dist/rows/scrollers/native-scroller.d.ts +2 -0
  274. package/dist/rows/scrollers/native-scroller.js +4 -0
  275. package/dist/sort-manager/+types.d.ts +13 -0
  276. package/dist/sort-manager/+types.js +1 -0
  277. package/dist/sort-manager/context.d.ts +14 -0
  278. package/dist/sort-manager/context.js +5 -0
  279. package/dist/sort-manager/hooks/use-sort-manager.d.ts +15 -0
  280. package/dist/sort-manager/hooks/use-sort-manager.js +56 -0
  281. package/dist/sort-manager/hooks/use-sort-row-item.d.ts +51 -0
  282. package/dist/sort-manager/hooks/use-sort-row-item.js +145 -0
  283. package/dist/sort-manager/hooks/use-sortable-column-items.d.ts +5 -0
  284. package/dist/sort-manager/hooks/use-sortable-column-items.js +13 -0
  285. package/dist/sort-manager/root.d.ts +3 -0
  286. package/dist/sort-manager/root.js +14 -0
  287. package/dist/sort-manager/sort-add.d.ts +8 -0
  288. package/dist/sort-manager/sort-add.js +14 -0
  289. package/dist/sort-manager/sort-apply.d.ts +7 -0
  290. package/dist/sort-manager/sort-apply.js +24 -0
  291. package/dist/sort-manager/sort-cancel.d.ts +7 -0
  292. package/dist/sort-manager/sort-cancel.js +27 -0
  293. package/dist/sort-manager/sort-clear.d.ts +7 -0
  294. package/dist/sort-manager/sort-clear.js +22 -0
  295. package/dist/sort-manager/sort-column-select.d.ts +10 -0
  296. package/dist/sort-manager/sort-column-select.js +20 -0
  297. package/dist/sort-manager/sort-direction-select.d.ts +10 -0
  298. package/dist/sort-manager/sort-direction-select.js +24 -0
  299. package/dist/sort-manager/sort-manager.d.ts +16 -0
  300. package/dist/sort-manager/sort-manager.js +26 -0
  301. package/dist/sort-manager/sort-remove.d.ts +7 -0
  302. package/dist/sort-manager/sort-remove.js +14 -0
  303. package/dist/sort-manager/sort-row.d.ts +5 -0
  304. package/dist/sort-manager/sort-row.js +7 -0
  305. package/dist/sort-manager/sort-rows.d.ts +1 -0
  306. package/dist/sort-manager/sort-rows.js +6 -0
  307. package/dist/sort-manager/sort-value-select.d.ts +11 -0
  308. package/dist/sort-manager/sort-value-select.js +25 -0
  309. package/dist/sort-manager/utils/sort-item-to-sort-model.d.ts +3 -0
  310. package/dist/sort-manager/utils/sort-item-to-sort-model.js +62 -0
  311. package/dist/sort-manager/utils/sort-model-to-sort-items.d.ts +3 -0
  312. package/dist/sort-manager/utils/sort-model-to-sort-items.js +50 -0
  313. package/dist/state/+types.d.ts +35 -0
  314. package/dist/state/+types.js +1 -0
  315. package/dist/state/api/cell-root.d.ts +5 -0
  316. package/dist/state/api/cell-root.js +64 -0
  317. package/dist/state/api/column-autosize.d.ts +5 -0
  318. package/dist/state/api/column-autosize.js +72 -0
  319. package/dist/state/api/column-by-id.d.ts +2 -0
  320. package/dist/state/api/column-by-id.js +6 -0
  321. package/dist/state/api/column-field.d.ts +2 -0
  322. package/dist/state/api/column-field.js +23 -0
  323. package/dist/state/api/column-from-index.d.ts +2 -0
  324. package/dist/state/api/column-from-index.js +6 -0
  325. package/dist/state/api/column-group-toggle.d.ts +2 -0
  326. package/dist/state/api/column-group-toggle.js +10 -0
  327. package/dist/state/api/column-index.d.ts +2 -0
  328. package/dist/state/api/column-index.js +7 -0
  329. package/dist/state/api/column-move.d.ts +2 -0
  330. package/dist/state/api/column-move.js +49 -0
  331. package/dist/state/api/column-resize.d.ts +2 -0
  332. package/dist/state/api/column-resize.js +9 -0
  333. package/dist/state/api/column-update.d.ts +5 -0
  334. package/dist/state/api/column-update.js +26 -0
  335. package/dist/state/api/dialog-frame.d.ts +8 -0
  336. package/dist/state/api/dialog-frame.js +16 -0
  337. package/dist/state/api/edit-begin.d.ts +5 -0
  338. package/dist/state/api/edit-begin.js +87 -0
  339. package/dist/state/api/edit-end.d.ts +5 -0
  340. package/dist/state/api/edit-end.js +43 -0
  341. package/dist/state/api/edit-is-cell-active.d.ts +5 -0
  342. package/dist/state/api/edit-is-cell-active.js +22 -0
  343. package/dist/state/api/edit-update.d.ts +5 -0
  344. package/dist/state/api/edit-update.js +88 -0
  345. package/dist/state/api/event-listeners.d.ts +5 -0
  346. package/dist/state/api/event-listeners.js +19 -0
  347. package/dist/state/api/export-csv.d.ts +3 -0
  348. package/dist/state/api/export-csv.js +40 -0
  349. package/dist/state/api/export-data-rect.d.ts +2 -0
  350. package/dist/state/api/export-data-rect.js +24 -0
  351. package/dist/state/api/focus-cell.d.ts +5 -0
  352. package/dist/state/api/focus-cell.js +117 -0
  353. package/dist/state/api/popover-frame.d.ts +8 -0
  354. package/dist/state/api/popover-frame.js +16 -0
  355. package/dist/state/api/position-from-element.d.ts +2 -0
  356. package/dist/state/api/position-from-element.js +9 -0
  357. package/dist/state/api/row-by-id.d.ts +2 -0
  358. package/dist/state/api/row-by-id.js +5 -0
  359. package/dist/state/api/row-by-index.d.ts +2 -0
  360. package/dist/state/api/row-by-index.js +9 -0
  361. package/dist/state/api/row-detail-is-expanded.d.ts +2 -0
  362. package/dist/state/api/row-detail-is-expanded.js +6 -0
  363. package/dist/state/api/row-detail-rendered-height.d.ts +5 -0
  364. package/dist/state/api/row-detail-rendered-height.js +14 -0
  365. package/dist/state/api/row-detail-toggle.d.ts +2 -0
  366. package/dist/state/api/row-detail-toggle.js +32 -0
  367. package/dist/state/api/row-group-apply-expansions.d.ts +2 -0
  368. package/dist/state/api/row-group-apply-expansions.js +20 -0
  369. package/dist/state/api/row-group-column-index.d.ts +2 -0
  370. package/dist/state/api/row-group-column-index.js +14 -0
  371. package/dist/state/api/row-group-is-expanded.d.ts +2 -0
  372. package/dist/state/api/row-group-is-expanded.js +15 -0
  373. package/dist/state/api/row-group-toggle.d.ts +2 -0
  374. package/dist/state/api/row-group-toggle.js +7 -0
  375. package/dist/state/api/row-handle-select.d.ts +5 -0
  376. package/dist/state/api/row-handle-select.js +43 -0
  377. package/dist/state/api/row-select-all.d.ts +2 -0
  378. package/dist/state/api/row-select-all.js +17 -0
  379. package/dist/state/api/row-select.d.ts +5 -0
  380. package/dist/state/api/row-select.js +35 -0
  381. package/dist/state/api/row-selected.d.ts +2 -0
  382. package/dist/state/api/row-selected.js +13 -0
  383. package/dist/state/api/scroll-into-view.d.ts +5 -0
  384. package/dist/state/api/scroll-into-view.js +50 -0
  385. package/dist/state/api/sort-for-column.d.ts +2 -0
  386. package/dist/state/api/sort-for-column.js +9 -0
  387. package/dist/state/api/use-row-drag.d.ts +2 -0
  388. package/dist/state/api/use-row-drag.js +27 -0
  389. package/dist/state/helpers/cell-row-group.d.ts +2 -0
  390. package/dist/state/helpers/cell-row-group.js +19 -0
  391. package/dist/state/helpers/column-add-row-group.d.ts +10 -0
  392. package/dist/state/helpers/column-add-row-group.js +74 -0
  393. package/dist/state/helpers/column-layout.d.ts +3 -0
  394. package/dist/state/helpers/column-layout.js +59 -0
  395. package/dist/state/helpers/column-marker.d.ts +8 -0
  396. package/dist/state/helpers/column-marker.js +43 -0
  397. package/dist/state/helpers/column-view.d.ts +21 -0
  398. package/dist/state/helpers/column-view.js +33 -0
  399. package/dist/state/helpers/edit-on-change.d.ts +15 -0
  400. package/dist/state/helpers/edit-on-change.js +27 -0
  401. package/dist/state/helpers/empty-row-data-source.d.ts +2 -0
  402. package/dist/state/helpers/empty-row-data-source.js +18 -0
  403. package/dist/state/helpers/get-data-rect.d.ts +13 -0
  404. package/dist/state/helpers/get-data-rect.js +65 -0
  405. package/dist/state/helpers/get-full-width-callback.d.ts +2 -0
  406. package/dist/state/helpers/get-full-width-callback.js +10 -0
  407. package/dist/state/helpers/get-span-callback.d.ts +2 -0
  408. package/dist/state/helpers/get-span-callback.js +22 -0
  409. package/dist/state/helpers/resolve-column.d.ts +4 -0
  410. package/dist/state/helpers/resolve-column.js +29 -0
  411. package/dist/state/helpers/row-layout/get-focus-criteria.d.ts +17 -0
  412. package/dist/state/helpers/row-layout/get-focus-criteria.js +62 -0
  413. package/dist/state/helpers/row-layout/row-layout.d.ts +19 -0
  414. package/dist/state/helpers/row-layout/row-layout.js +181 -0
  415. package/dist/state/use-lytenyte.d.ts +3 -0
  416. package/dist/state/use-lytenyte.js +671 -0
  417. package/dist/tree-view/branch/branch.d.ts +14 -0
  418. package/dist/tree-view/branch/branch.js +63 -0
  419. package/dist/tree-view/branch/use-branch-keys.d.ts +2 -0
  420. package/dist/tree-view/branch/use-branch-keys.js +87 -0
  421. package/dist/tree-view/context.d.ts +22 -0
  422. package/dist/tree-view/context.js +3 -0
  423. package/dist/tree-view/depth-provider.d.ts +2 -0
  424. package/dist/tree-view/depth-provider.js +3 -0
  425. package/dist/tree-view/hooks/use-tree-view-paths.d.ts +2 -0
  426. package/dist/tree-view/hooks/use-tree-view-paths.js +9 -0
  427. package/dist/tree-view/index.d.ts +16 -0
  428. package/dist/tree-view/index.js +16 -0
  429. package/dist/tree-view/leaf.d.ts +4 -0
  430. package/dist/tree-view/leaf.js +28 -0
  431. package/dist/tree-view/navigation/get-all-ids.d.ts +1 -0
  432. package/dist/tree-view/navigation/get-all-ids.js +7 -0
  433. package/dist/tree-view/navigation/get-first-node.d.ts +1 -0
  434. package/dist/tree-view/navigation/get-first-node.js +7 -0
  435. package/dist/tree-view/navigation/get-last-node.d.ts +1 -0
  436. package/dist/tree-view/navigation/get-last-node.js +7 -0
  437. package/dist/tree-view/navigation/get-next-node.d.ts +1 -0
  438. package/dist/tree-view/navigation/get-next-node.js +13 -0
  439. package/dist/tree-view/navigation/get-prev-node.d.ts +1 -0
  440. package/dist/tree-view/navigation/get-prev-node.js +13 -0
  441. package/dist/tree-view/panel/make-handle-navigation.d.ts +2 -0
  442. package/dist/tree-view/panel/make-handle-navigation.js +39 -0
  443. package/dist/tree-view/panel/make-handle-selection.d.ts +2 -0
  444. package/dist/tree-view/panel/make-handle-selection.js +92 -0
  445. package/dist/tree-view/panel/make-handle-typeahead.d.ts +1 -0
  446. package/dist/tree-view/panel/make-handle-typeahead.js +45 -0
  447. package/dist/tree-view/panel/panel.d.ts +1 -0
  448. package/dist/tree-view/panel/panel.js +30 -0
  449. package/dist/tree-view/panel/use-tree-navigation.d.ts +1 -0
  450. package/dist/tree-view/panel/use-tree-navigation.js +63 -0
  451. package/dist/tree-view/root.d.ts +17 -0
  452. package/dist/tree-view/root.js +63 -0
  453. package/dist/tree-view/utils/get-focusable-nodes.d.ts +1 -0
  454. package/dist/tree-view/utils/get-focusable-nodes.js +5 -0
  455. package/dist/tree-view/utils/get-focused-node.d.ts +1 -0
  456. package/dist/tree-view/utils/get-focused-node.js +14 -0
  457. package/dist/tree-view/utils/get-ids-between-nodes.d.ts +1 -0
  458. package/dist/tree-view/utils/get-ids-between-nodes.js +15 -0
  459. package/dist/tree-view/utils/get-panel.d.ts +1 -0
  460. package/dist/tree-view/utils/get-panel.js +7 -0
  461. package/dist/tree-view/utils/get-parent-node.d.ts +1 -0
  462. package/dist/tree-view/utils/get-parent-node.js +10 -0
  463. package/dist/tree-view/utils/get-sibling-branches.d.ts +1 -0
  464. package/dist/tree-view/utils/get-sibling-branches.js +14 -0
  465. package/dist/tree-view/utils/get-tree-node-id.d.ts +1 -0
  466. package/dist/tree-view/utils/get-tree-node-id.js +3 -0
  467. package/dist/tree-view/utils/is-branch-node.d.ts +1 -0
  468. package/dist/tree-view/utils/is-branch-node.js +3 -0
  469. package/dist/tree-view/utils/is-leaf-node.d.ts +1 -0
  470. package/dist/tree-view/utils/is-leaf-node.js +3 -0
  471. package/dist/tree-view/utils/is-tree-node-disabled.d.ts +1 -0
  472. package/dist/tree-view/utils/is-tree-node-disabled.js +3 -0
  473. package/dist/tree-view/utils/select-node.d.ts +2 -0
  474. package/dist/tree-view/utils/select-node.js +15 -0
  475. package/dist/tree-view/utils/toggle-all-selections.d.ts +2 -0
  476. package/dist/tree-view/utils/toggle-all-selections.js +9 -0
  477. package/dist/tree-view/utils/toggle-selection.d.ts +2 -0
  478. package/dist/tree-view/utils/toggle-selection.js +21 -0
  479. package/dist/tree-view/virtualized/force-sync-scrolling.d.ts +2 -0
  480. package/dist/tree-view/virtualized/force-sync-scrolling.js +23 -0
  481. package/dist/tree-view/virtualized/get-virtual-tree-paths.d.ts +2 -0
  482. package/dist/tree-view/virtualized/get-virtual-tree-paths.js +14 -0
  483. package/dist/tree-view/virtualized/make-virtual-tree.d.ts +31 -0
  484. package/dist/tree-view/virtualized/make-virtual-tree.js +90 -0
  485. package/dist/tree-view/virtualized/use-flattened-tree.d.ts +9 -0
  486. package/dist/tree-view/virtualized/use-flattened-tree.js +36 -0
  487. package/dist/tree-view/virtualized/use-row-start-and-end.d.ts +2 -0
  488. package/dist/tree-view/virtualized/use-row-start-and-end.js +27 -0
  489. package/dist/tree-view/virtualized/use-virtualized-tree.d.ts +22 -0
  490. package/dist/tree-view/virtualized/use-virtualized-tree.js +100 -0
  491. package/dist/types/types.d.ts +8 -0
  492. package/dist/types/types.js +1 -0
  493. package/dist/utils/cycle-sorts.d.ts +2 -0
  494. package/dist/utils/cycle-sorts.js +16 -0
  495. package/dist/viewport/begin-editing.d.ts +5 -0
  496. package/dist/viewport/begin-editing.js +15 -0
  497. package/dist/viewport/viewport.d.ts +1 -0
  498. package/dist/viewport/viewport.js +78 -0
  499. package/package.json +7 -7
@@ -0,0 +1,63 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect } from "react";
3
+ import { depthContext, useDepth } from "../depth-provider.js";
4
+ import { useEvent, useSlot, useTransitionedOpen, } from "@1771technologies/lytenyte-react-hooks";
5
+ import { useTreeRoot } from "../context.js";
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,
16
+ });
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: (e) => {
35
+ e.stopPropagation();
36
+ onExpansionChange(!expanded);
37
+ },
38
+ };
39
+ const expanderRendered = useSlot({
40
+ props: [expandedProps],
41
+ slot: expander ?? _jsx("button", { children: ">" }),
42
+ state: { toggle, expanded },
43
+ });
44
+ const wrapped = gridWrapped ?? root.gridWrappedBranches;
45
+ const labelWrapSlot = useSlot({
46
+ props: [
47
+ {
48
+ "data-tree-branch-label": true,
49
+ children: (_jsxs(_Fragment, { children: [expanderRendered, labelRendered] })),
50
+ },
51
+ ],
52
+ slot: labelWrap ?? _jsx("div", {}),
53
+ });
54
+ 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: {
55
+ ...props.style,
56
+ "--ln-tree-depth": depth,
57
+ }, 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 })) }) })] }) }));
58
+ });
59
+ function Wrapped(props) {
60
+ if (!props.wrapped)
61
+ return _jsx(_Fragment, { children: props.children });
62
+ 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 }) }));
63
+ }
@@ -0,0 +1,2 @@
1
+ import type { KeyboardEvent, KeyboardEventHandler } from "react";
2
+ export declare function useBranchKeys(id: string, defaultExpansion: boolean, current?: KeyboardEventHandler): (ev: KeyboardEvent) => void;
@@ -0,0 +1,87 @@
1
+ import { useEvent } from "@1771technologies/lytenyte-react-hooks";
2
+ import { useTreeRoot } from "../context.js";
3
+ import { getFocusableNodes } from "../utils/get-focusable-nodes.js";
4
+ import { getFocusedNode } from "../utils/get-focused-node.js";
5
+ import { isBranchNode } from "../utils/is-branch-node.js";
6
+ import { getTreeNodeId } from "../utils/get-tree-node-id.js";
7
+ import { getParentNode } from "../utils/get-parent-node.js";
8
+ import { getSiblingBranches } from "../utils/get-sibling-branches.js";
9
+ import { getFocusables } from "@1771technologies/lytenyte-dom-utils";
10
+ const accepted = ["ArrowRight", "ArrowLeft", "Enter", "*"];
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;
28
+ }
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;
87
+ }
@@ -0,0 +1,22 @@
1
+ import { type Dispatch, type SetStateAction } from "react";
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[];
20
+ }
21
+ export declare const context: import("react").Context<TreeViewRootContext>;
22
+ export declare const useTreeRoot: () => TreeViewRootContext;
@@ -0,0 +1,3 @@
1
+ import { createContext, useContext } from "react";
2
+ export const context = createContext({});
3
+ export const useTreeRoot = () => useContext(context);
@@ -0,0 +1,2 @@
1
+ export declare const depthContext: import("react").Context<number>;
2
+ export declare const useDepth: () => number;
@@ -0,0 +1,3 @@
1
+ import { createContext, useContext } from "react";
2
+ export const depthContext = createContext(0);
3
+ export const useDepth = () => useContext(depthContext);
@@ -0,0 +1,2 @@
1
+ import { type PathProvidedItem } from "@1771technologies/lytenyte-shared";
2
+ export declare function useTreeViewPaths<T extends PathProvidedItem>(paths: T[], nonAdjacentAreDistinct?: boolean): (import("@1771technologies/lytenyte-shared").PathBranch<T> | import("@1771technologies/lytenyte-shared").PathLeaf<T>)[];
@@ -0,0 +1,9 @@
1
+ import { computePathTree } from "@1771technologies/lytenyte-shared";
2
+ import { useMemo } from "react";
3
+ export function useTreeViewPaths(paths, nonAdjacentAreDistinct) {
4
+ const tree = useMemo(() => {
5
+ const result = computePathTree(paths, {}, nonAdjacentAreDistinct);
6
+ return [...result.children.values()];
7
+ }, [nonAdjacentAreDistinct, paths]);
8
+ return tree;
9
+ }
@@ -0,0 +1,16 @@
1
+ import { useTreeViewPaths } from "./hooks/use-tree-view-paths.js";
2
+ import { ForceSyncScrolling } from "./virtualized/force-sync-scrolling.js";
3
+ import { useVirtualizedTree } from "./virtualized/use-virtualized-tree.js";
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;
12
+ };
13
+ export type { TreeRootProps } from "./root.js";
14
+ export type { TreeBranchProps } from "./branch/branch.js";
15
+ export type { TreeLeafProps } from "./leaf.js";
16
+ export type { VirtualizedTreeViewPathsArgs } from "./virtualized/use-virtualized-tree.js";
@@ -0,0 +1,16 @@
1
+ import { TreeBranch } from "./branch/branch.js";
2
+ import { useTreeViewPaths } from "./hooks/use-tree-view-paths.js";
3
+ import { TreeLeaf } from "./leaf.js";
4
+ import { TreePanel } from "./panel/panel.js";
5
+ import { TreeRoot } from "./root.js";
6
+ import { ForceSyncScrolling } from "./virtualized/force-sync-scrolling.js";
7
+ import { useVirtualizedTree } from "./virtualized/use-virtualized-tree.js";
8
+ export const Tree = {
9
+ Leaf: TreeLeaf,
10
+ Branch: TreeBranch,
11
+ Root: TreeRoot,
12
+ Panel: TreePanel,
13
+ usePaths: useTreeViewPaths,
14
+ useVirtualTree: useVirtualizedTree,
15
+ ForceSyncScrolling,
16
+ };
@@ -0,0 +1,4 @@
1
+ export interface TreeLeafProps {
2
+ readonly itemId: string;
3
+ }
4
+ export declare const TreeLeaf: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLLIElement> & import("react").LiHTMLAttributes<HTMLLIElement> & TreeLeafProps, "ref"> & import("react").RefAttributes<HTMLLIElement>>;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useDepth } from "./depth-provider.js";
4
+ import { useTreeRoot } from "./context.js";
5
+ import { getFocusables } from "@1771technologies/lytenyte-dom-utils";
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
+ e.preventDefault();
17
+ const nodes = getFocusables(e.currentTarget);
18
+ const index = nodes.indexOf(document.activeElement);
19
+ if (index === -1) {
20
+ nodes.at(0)?.focus();
21
+ return;
22
+ }
23
+ if (e.key === "ArrowLeft")
24
+ nodes[index === 0 ? nodes.length - 1 : index - 1].focus();
25
+ else
26
+ nodes[index === nodes.length - 1 ? 0 : index + 1].focus();
27
+ }, ref: forwarded, role: "treeitem", "aria-level": depth + 1, "aria-selected": root.selection.has(itemId), style: { ...props.style, "--tree-depth": depth }, children: props.children }));
28
+ });
@@ -0,0 +1 @@
1
+ export declare function getAllIds(panel: HTMLElement): Set<string>;
@@ -0,0 +1,7 @@
1
+ import { getFocusableNodes } from "../utils/get-focusable-nodes.js";
2
+ import { getTreeNodeId } from "../utils/get-tree-node-id.js";
3
+ export function getAllIds(panel) {
4
+ const focusables = getFocusableNodes(panel);
5
+ const allIds = new Set(focusables.map((c) => getTreeNodeId(c)));
6
+ return allIds;
7
+ }
@@ -0,0 +1 @@
1
+ export declare function getFirstNode(panel: HTMLElement): HTMLElement | undefined;
@@ -0,0 +1,7 @@
1
+ import { getFocusableNodes } from "../utils/get-focusable-nodes.js";
2
+ import { isTreeNodeDisabled } from "../utils/is-tree-node-disabled.js";
3
+ export function getFirstNode(panel) {
4
+ const focusables = getFocusableNodes(panel);
5
+ const first = focusables.find((c) => !isTreeNodeDisabled(c));
6
+ return first;
7
+ }
@@ -0,0 +1 @@
1
+ export declare function getLastNode(panel: HTMLElement): HTMLElement | undefined;
@@ -0,0 +1,7 @@
1
+ import { getFocusableNodes } from "../utils/get-focusable-nodes.js";
2
+ import { isTreeNodeDisabled } from "../utils/is-tree-node-disabled.js";
3
+ export function getLastNode(panel) {
4
+ const focusables = getFocusableNodes(panel);
5
+ const first = focusables.findLast((c) => !isTreeNodeDisabled(c));
6
+ return first;
7
+ }
@@ -0,0 +1 @@
1
+ export declare function getNextNode(el: HTMLElement): HTMLElement | undefined;
@@ -0,0 +1,13 @@
1
+ import { getFocusableNodes } from "../utils/get-focusable-nodes.js";
2
+ import { getPanel } from "../utils/get-panel.js";
3
+ // Assumes that el is a branch or leaf node
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);
13
+ }
@@ -0,0 +1 @@
1
+ export declare function getPrevNode(el: HTMLElement): HTMLElement | undefined;
@@ -0,0 +1,13 @@
1
+ import { getFocusableNodes } from "../utils/get-focusable-nodes.js";
2
+ import { getPanel } from "../utils/get-panel.js";
3
+ // Assumes that el is a branch or leaf node
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];
13
+ }
@@ -0,0 +1,2 @@
1
+ import type { TreeViewRootContext } from "../context.js";
2
+ export declare function makeHandleNavigation(ctx: TreeViewRootContext): (ev: KeyboardEvent) => void;
@@ -0,0 +1,39 @@
1
+ import { isInView } from "@1771technologies/lytenyte-dom-utils";
2
+ import { getFirstNode } from "../navigation/get-first-node.js";
3
+ import { getLastNode } from "../navigation/get-last-node.js";
4
+ import { getNextNode } from "../navigation/get-next-node.js";
5
+ import { getPrevNode } from "../navigation/get-prev-node.js";
6
+ import { getFocusedNode } from "../utils/get-focused-node.js";
7
+ export function makeHandleNavigation(ctx) {
8
+ const acceptedKeys = ["ArrowUp", "ArrowDown", "Home", "End"];
9
+ return (ev) => {
10
+ if (!acceptedKeys.includes(ev.key) || ev.shiftKey || ev.ctrlKey || ev.metaKey)
11
+ return;
12
+ const current = getFocusedNode();
13
+ if (!current)
14
+ return;
15
+ if (ev.key === "ArrowUp") {
16
+ const prev = getPrevNode(current);
17
+ if (!prev)
18
+ return;
19
+ const inView = isInView(prev, ctx.panel);
20
+ if (!inView)
21
+ prev?.scrollIntoView({ behavior: "instant", block: "start" });
22
+ prev?.focus();
23
+ }
24
+ if (ev.key === "ArrowDown") {
25
+ const node = getNextNode(current);
26
+ if (!node)
27
+ return;
28
+ const inView = isInView(node, ctx.panel);
29
+ if (!inView)
30
+ node?.scrollIntoView({ behavior: "instant", block: "end" });
31
+ node?.focus();
32
+ }
33
+ if (ev.key === "Home")
34
+ getFirstNode(ctx.panel)?.focus();
35
+ if (ev.key === "End")
36
+ getLastNode(ctx.panel)?.focus();
37
+ ev.preventDefault();
38
+ };
39
+ }
@@ -0,0 +1,2 @@
1
+ import type { TreeViewRootContext } from "../context.js";
2
+ export declare function makeHandleSelection(ctx: TreeViewRootContext): (ev: KeyboardEvent) => void;
@@ -0,0 +1,92 @@
1
+ import { isInView } from "@1771technologies/lytenyte-dom-utils";
2
+ import { getFirstNode } from "../navigation/get-first-node.js";
3
+ import { getLastNode } from "../navigation/get-last-node.js";
4
+ import { getNextNode } from "../navigation/get-next-node.js";
5
+ import { getPrevNode } from "../navigation/get-prev-node.js";
6
+ import { getFocusableNodes } from "../utils/get-focusable-nodes.js";
7
+ import { getFocusedNode } from "../utils/get-focused-node.js";
8
+ import { getIdsBetweenNodes } from "../utils/get-ids-between-nodes.js";
9
+ import { getTreeNodeId } from "../utils/get-tree-node-id.js";
10
+ import { selectNode } from "../utils/select-node.js";
11
+ import { toggleAllSelections } from "../utils/toggle-all-selections.js";
12
+ import { toggleSelection } from "../utils/toggle-selection.js";
13
+ export function makeHandleSelection(ctx) {
14
+ const acceptedKeys = ["Enter", "Home", "End", "ArrowDown", "ArrowUp", "Space", " ", "a"];
15
+ const make = (ev) => {
16
+ if (ctx.selectionMode === "none")
17
+ return;
18
+ if (!acceptedKeys.includes(ev.key))
19
+ return;
20
+ ev.preventDefault();
21
+ const pivot = ctx.selectionPivotRef.current;
22
+ if (ev.key === " " && (ctx.selectionMode === "single" || !ev.shiftKey || !pivot)) {
23
+ const node = getFocusedNode();
24
+ toggleSelection(node, ctx);
25
+ return;
26
+ }
27
+ if (ctx.selectionMode !== "multiple")
28
+ return;
29
+ const focusables = getFocusableNodes(ctx.panel);
30
+ const focused = getFocusedNode();
31
+ const focusedIndex = focusables.indexOf(focused);
32
+ if (focusedIndex === -1)
33
+ return;
34
+ if (ev.ctrlKey || ev.metaKey) {
35
+ if (ev.key === "a") {
36
+ ev.preventDefault();
37
+ toggleAllSelections(ctx);
38
+ return;
39
+ }
40
+ }
41
+ if (!ev.shiftKey)
42
+ return;
43
+ if (ev.key === "ArrowUp" && focusedIndex !== 0) {
44
+ const node = getPrevNode(focused);
45
+ if (!isInView(node, ctx.panel))
46
+ node?.scrollIntoView({ behavior: "instant", block: "start" });
47
+ selectNode(node, ctx, true);
48
+ return;
49
+ }
50
+ if (ev.key === "ArrowDown" && focusedIndex !== focusables.length) {
51
+ const node = getNextNode(focused);
52
+ if (!isInView(node, ctx.panel))
53
+ node?.scrollIntoView({ behavior: "instant", block: "end" });
54
+ selectNode(node, ctx, true);
55
+ return;
56
+ }
57
+ if (ev.key === " ") {
58
+ const pivotNode = focusables.find((c) => getTreeNodeId(c) === pivot);
59
+ if (!pivotNode)
60
+ return;
61
+ const ids = ctx.getIdsBetweenNodes(pivotNode, focused, ctx.panel);
62
+ const next = new Set(ctx.selection);
63
+ ids.forEach((c) => next.add(c));
64
+ ctx.onSelectionChange(next);
65
+ ctx.selectionPivotRef.current = getTreeNodeId(focused);
66
+ return;
67
+ }
68
+ if (!ev.ctrlKey && !ev.metaKey)
69
+ return;
70
+ if (ev.key === "Home") {
71
+ const firstNode = getFirstNode(ctx.panel);
72
+ const ids = getIdsBetweenNodes(firstNode, focused, ctx.panel);
73
+ const next = new Set(ctx.selection);
74
+ ids.forEach((c) => next.add(c));
75
+ ctx.onSelectionChange(next);
76
+ firstNode?.focus();
77
+ ctx.selectionPivotRef.current = getTreeNodeId(firstNode);
78
+ return;
79
+ }
80
+ if (ev.key === "End") {
81
+ const lastNode = getLastNode(ctx.panel);
82
+ const ids = ctx.getIdsBetweenNodes(focused, lastNode, ctx.panel);
83
+ const next = new Set(ctx.selection);
84
+ ids.forEach((c) => next.add(c));
85
+ ctx.onSelectionChange(next);
86
+ lastNode?.focus();
87
+ ctx.selectionPivotRef.current = getTreeNodeId(lastNode);
88
+ return;
89
+ }
90
+ };
91
+ return make;
92
+ }
@@ -0,0 +1 @@
1
+ export declare function makeHandleTypeahead(): (panel: HTMLElement, ev: KeyboardEvent) => void;
@@ -0,0 +1,45 @@
1
+ import { getFocusableNodes } from "../utils/get-focusable-nodes.js";
2
+ import { getFocusedNode } from "../utils/get-focused-node.js";
3
+ import { isBranchNode } from "../utils/is-branch-node.js";
4
+ export function makeHandleTypeahead() {
5
+ let typeaheadCapture = [];
6
+ let typeaheadTimeout = null;
7
+ const handleTypeahead = (panel, ev) => {
8
+ if (ev.ctrlKey || ev.shiftKey || ev.metaKey)
9
+ return;
10
+ if (ev.key.length === 1 && ev.key.match(/[\S\s]/) && ev.key != " ") {
11
+ // Begin the typeahead.
12
+ typeaheadCapture.push(ev.key);
13
+ if (typeaheadTimeout)
14
+ clearTimeout(typeaheadTimeout);
15
+ typeaheadTimeout = setTimeout(() => {
16
+ const text = typeaheadCapture.join("");
17
+ const nodes = getFocusableNodes(panel);
18
+ const focused = getFocusedNode();
19
+ if (!focused)
20
+ return;
21
+ const index = nodes.indexOf(focused);
22
+ if (index === -1)
23
+ return;
24
+ const nodesAfterCurrent = nodes.slice(index);
25
+ const nodeToFocus = nodesAfterCurrent.find((c) => {
26
+ let textContent = "";
27
+ if (isBranchNode(c)) {
28
+ // On a branch node the text content of the expanded should not be included. We should simply
29
+ // look at the text content of the node.
30
+ textContent = c.firstElementChild?.lastElementChild?.textContent ?? "";
31
+ }
32
+ else {
33
+ textContent = c.textContent ?? "";
34
+ }
35
+ return textContent?.toLowerCase()?.startsWith(text);
36
+ });
37
+ if (nodeToFocus)
38
+ nodeToFocus.focus();
39
+ typeaheadCapture = [];
40
+ typeaheadTimeout = null;
41
+ }, 300);
42
+ }
43
+ };
44
+ return handleTypeahead;
45
+ }
@@ -0,0 +1 @@
1
+ export declare const TreePanel: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & import("react").RefAttributes<HTMLUListElement>>;
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useRef } from "react";
3
+ import { depthContext } from "../depth-provider.js";
4
+ import { useTreeRoot } from "../context.js";
5
+ import { useForkRef } from "@1771technologies/lytenyte-react-hooks";
6
+ import { useTreeNavigation } from "./use-tree-navigation.js";
7
+ import { getFocusedNode } from "../utils/get-focused-node.js";
8
+ import { getFirstNode } from "../navigation/get-first-node.js";
9
+ export const TreePanel = forwardRef(function TreePanel(props, forwarded) {
10
+ const ctx = useTreeRoot();
11
+ const ref = useForkRef(ctx.panelRef, forwarded);
12
+ const focused = useTreeNavigation();
13
+ const focusTime = useRef(null);
14
+ return (_jsxs(depthContext.Provider, { value: 0, children: [_jsx("ul", { ...props, role: "tree", ref: ref, tabIndex: focused ? -1 : 0, "aria-multiselectable": ctx.selectionMode === "multiple", "aria-orientation": "vertical", "data-ln-tree-panel": true, onFocus: () => {
15
+ if (focusTime.current) {
16
+ clearTimeout(focusTime.current);
17
+ focusTime.current = null;
18
+ }
19
+ ctx.onFocusChange(getFocusedNode());
20
+ }, onBlur: () => {
21
+ if (focusTime.current)
22
+ return;
23
+ focusTime.current = setTimeout(() => {
24
+ ctx.onFocusChange(null);
25
+ focusTime.current = null;
26
+ }, 20);
27
+ }, children: props.children }), _jsx("div", { role: "presentation", tabIndex: focused ? -1 : 0, onFocus: () => {
28
+ getFirstNode(ctx.panel)?.focus();
29
+ } })] }));
30
+ });
@@ -0,0 +1 @@
1
+ export declare function useTreeNavigation(): boolean;
@@ -0,0 +1,63 @@
1
+ import { useEffect, useState } from "react";
2
+ import { useTreeRoot } from "../context.js";
3
+ import { getFocusableNodes } from "../utils/get-focusable-nodes.js";
4
+ import { makeHandleTypeahead } from "./make-handle-typeahead.js";
5
+ import { makeHandleNavigation } from "./make-handle-navigation.js";
6
+ import { makeHandleSelection } from "./make-handle-selection.js";
7
+ import { getTreeNodeId } from "../utils/get-tree-node-id.js";
8
+ import { getTabbables } from "@1771technologies/lytenyte-dom-utils";
9
+ export function useTreeNavigation() {
10
+ const ctx = useTreeRoot();
11
+ const [focused, setFocused] = useState(false);
12
+ const panel = ctx.panel;
13
+ useEffect(() => {
14
+ if (!panel)
15
+ return;
16
+ const controller = new AbortController();
17
+ panel.addEventListener("focus", () => {
18
+ const focusNodes = getFocusableNodes(panel);
19
+ if (ctx.selectionMode !== "none" && ctx.selection.size > 0) {
20
+ const node = focusNodes.find((c) => ctx.selection.has(getTreeNodeId(c)));
21
+ if (node) {
22
+ node.focus();
23
+ return;
24
+ }
25
+ }
26
+ focusNodes.at(0)?.focus();
27
+ }, { signal: controller.signal });
28
+ panel.addEventListener("focusin", () => {
29
+ setFocused(true);
30
+ }, { signal: controller.signal });
31
+ panel.addEventListener("focusout", () => {
32
+ setFocused(false);
33
+ }, { signal: controller.signal });
34
+ const handleTypeahead = makeHandleTypeahead();
35
+ const handleNavigation = makeHandleNavigation(ctx);
36
+ const handleSelection = makeHandleSelection(ctx);
37
+ panel.addEventListener("keydown", (ev) => {
38
+ handleTypeahead(panel, ev);
39
+ handleNavigation(ev);
40
+ handleSelection(ev);
41
+ if (ev.key === "Tab") {
42
+ const els = getTabbables(panel);
43
+ if (!els.length)
44
+ return;
45
+ const original = els.map((el) => {
46
+ const o = el.getAttribute("tabindex");
47
+ el.tabIndex = -1;
48
+ return o;
49
+ });
50
+ requestAnimationFrame(() => {
51
+ els.forEach((el, i) => {
52
+ if (original[i] == null)
53
+ el.removeAttribute("tabindex");
54
+ else
55
+ el.setAttribute("tabindex", original[i]);
56
+ });
57
+ });
58
+ }
59
+ }, { signal: controller.signal });
60
+ return () => controller.abort();
61
+ }, [ctx, focused, panel]);
62
+ return focused;
63
+ }