@1771technologies/lytenyte-pro 2.0.0-dev.0 → 2.0.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (423) hide show
  1. package/dist/__play__/alpha.play.d.ts +3 -0
  2. package/dist/__play__/alpha.play.js +56 -0
  3. package/dist/__play__/basic-server-data/data.d.ts +10 -0
  4. package/dist/__play__/basic-server-data/data.js +17746 -0
  5. package/dist/__play__/basic-server-data/server.d.ts +36 -0
  6. package/dist/__play__/basic-server-data/server.js +105 -0
  7. package/dist/__play__/buttons.play.d.ts +4 -0
  8. package/dist/__play__/buttons.play.js +7 -0
  9. package/dist/__play__/inputs.play.d.ts +3 -0
  10. package/dist/__play__/inputs.play.js +13 -0
  11. package/dist/__play__/server.play.d.ts +3 -0
  12. package/dist/__play__/server.play.js +66 -0
  13. package/dist/__play__/tree.play.d.ts +3 -0
  14. package/dist/__play__/tree.play.js +47 -0
  15. package/dist/cell-selection/adjust-rect-for-row-and-cell-span.d.ts +2 -0
  16. package/dist/cell-selection/adjust-rect-for-row-and-cell-span.js +43 -0
  17. package/dist/cell-selection/are-rects-equal.d.ts +2 -0
  18. package/dist/cell-selection/are-rects-equal.js +6 -0
  19. package/dist/cell-selection/bound-selection-rect.d.ts +3 -0
  20. package/dist/cell-selection/bound-selection-rect.js +16 -0
  21. package/dist/cell-selection/cell-selection-containers.d.ts +3 -0
  22. package/dist/cell-selection/cell-selection-containers.js +86 -0
  23. package/dist/cell-selection/cell-selection-driver/cell-selection-driver.d.ts +1 -0
  24. package/dist/cell-selection/cell-selection-driver/cell-selection-driver.js +279 -0
  25. package/dist/cell-selection/cell-selection-driver/use-cell-focus-change.d.ts +6 -0
  26. package/dist/cell-selection/cell-selection-driver/use-cell-focus-change.js +34 -0
  27. package/dist/cell-selection/cell-style-row.d.ts +8 -0
  28. package/dist/cell-selection/cell-style-row.js +79 -0
  29. package/dist/cell-selection/data-rect-from-cell-position.d.ts +3 -0
  30. package/dist/cell-selection/data-rect-from-cell-position.js +17 -0
  31. package/dist/cell-selection/deselect-rect-range.d.ts +2 -0
  32. package/dist/cell-selection/deselect-rect-range.js +43 -0
  33. package/dist/cell-selection/expand-selection-down.d.ts +3 -0
  34. package/dist/cell-selection/expand-selection-down.js +78 -0
  35. package/dist/cell-selection/expand-selection-end.d.ts +3 -0
  36. package/dist/cell-selection/expand-selection-end.js +76 -0
  37. package/dist/cell-selection/expand-selection-start.d.ts +3 -0
  38. package/dist/cell-selection/expand-selection-start.js +73 -0
  39. package/dist/cell-selection/expand-selection-up.d.ts +3 -0
  40. package/dist/cell-selection/expand-selection-up.js +74 -0
  41. package/dist/cell-selection/full-width-start-end-index.d.ts +2 -0
  42. package/dist/cell-selection/full-width-start-end-index.js +4 -0
  43. package/dist/cell-selection/get-root-cell.d.ts +3 -0
  44. package/dist/cell-selection/get-root-cell.js +6 -0
  45. package/dist/cell-selection/index.d.ts +13 -0
  46. package/dist/cell-selection/index.js +13 -0
  47. package/dist/cell-selection/is-bottom-rect.d.ts +2 -0
  48. package/dist/cell-selection/is-bottom-rect.js +4 -0
  49. package/dist/cell-selection/is-center-col-rect.d.ts +5 -0
  50. package/dist/cell-selection/is-center-col-rect.js +3 -0
  51. package/dist/cell-selection/is-center-rect.d.ts +2 -0
  52. package/dist/cell-selection/is-center-rect.js +4 -0
  53. package/dist/cell-selection/is-end-rect.d.ts +5 -0
  54. package/dist/cell-selection/is-end-rect.js +3 -0
  55. package/dist/cell-selection/is-fully-within-rect.d.ts +2 -0
  56. package/dist/cell-selection/is-fully-within-rect.js +6 -0
  57. package/dist/cell-selection/is-overlapping-rect.d.ts +2 -0
  58. package/dist/cell-selection/is-overlapping-rect.js +5 -0
  59. package/dist/cell-selection/is-start-rect.d.ts +5 -0
  60. package/dist/cell-selection/is-start-rect.js +3 -0
  61. package/dist/cell-selection/is-top-rect.d.ts +2 -0
  62. package/dist/cell-selection/is-top-rect.js +3 -0
  63. package/dist/cell-selection/is-within-selection-rect.d.ts +2 -0
  64. package/dist/cell-selection/is-within-selection-rect.js +3 -0
  65. package/dist/cell-selection/split-cell-selection-rect.d.ts +47 -0
  66. package/dist/cell-selection/split-cell-selection-rect.js +88 -0
  67. package/dist/cell-selection/split-on-pivot.d.ts +3 -0
  68. package/dist/cell-selection/split-on-pivot.js +50 -0
  69. package/dist/cell-selection/update-additive-cell-selection.d.ts +4 -0
  70. package/dist/cell-selection/update-additive-cell-selection.js +21 -0
  71. package/dist/cell-selection/use-edge-scroll.d.ts +6 -0
  72. package/dist/cell-selection/use-edge-scroll.js +71 -0
  73. package/dist/components/checkbox/checkbox.d.ts +15 -0
  74. package/dist/components/checkbox/checkbox.js +42 -0
  75. package/dist/components/checkbox/checkbox.play.d.ts +2 -0
  76. package/dist/components/checkbox/checkbox.play.js +6 -0
  77. package/dist/components/column-manager/column-manager.d.ts +13 -0
  78. package/dist/components/column-manager/column-manager.js +47 -0
  79. package/dist/components/external/clsx.d.ts +2 -0
  80. package/dist/components/external/clsx.js +44 -0
  81. package/dist/components/external/floating-ui.d.ts +268 -0
  82. package/dist/components/external/floating-ui.js +1802 -0
  83. package/dist/components/headless/dialog/arrow.d.ts +6 -0
  84. package/dist/components/headless/dialog/arrow.js +16 -0
  85. package/dist/components/headless/dialog/close.d.ts +10 -0
  86. package/dist/components/headless/dialog/close.js +22 -0
  87. package/dist/components/headless/dialog/container.d.ts +5 -0
  88. package/dist/components/headless/dialog/container.js +221 -0
  89. package/dist/components/headless/dialog/context.d.ts +32 -0
  90. package/dist/components/headless/dialog/context.js +3 -0
  91. package/dist/components/headless/dialog/description.d.ts +9 -0
  92. package/dist/components/headless/dialog/description.js +20 -0
  93. package/dist/components/headless/dialog/index.parts.d.ts +30 -0
  94. package/dist/components/headless/dialog/index.parts.js +17 -0
  95. package/dist/components/headless/dialog/root.d.ts +32 -0
  96. package/dist/components/headless/dialog/root.js +75 -0
  97. package/dist/components/headless/dialog/title.d.ts +9 -0
  98. package/dist/components/headless/dialog/title.js +20 -0
  99. package/dist/components/headless/dialog/transform-origin.d.ts +5 -0
  100. package/dist/components/headless/dialog/transform-origin.js +38 -0
  101. package/dist/components/headless/dialog/trigger.d.ts +10 -0
  102. package/dist/components/headless/dialog/trigger.js +24 -0
  103. package/dist/components/headless/dialog/use-dialog.d.ts +4 -0
  104. package/dist/components/headless/dialog/use-dialog.js +12 -0
  105. package/dist/components/headless/menu/checkbox-item.d.ts +11 -0
  106. package/dist/components/headless/menu/checkbox-item.js +42 -0
  107. package/dist/components/headless/menu/combo/combo-checkbox.d.ts +11 -0
  108. package/dist/components/headless/menu/combo/combo-checkbox.js +38 -0
  109. package/dist/components/headless/menu/combo/combo-context.d.ts +9 -0
  110. package/dist/components/headless/menu/combo/combo-context.js +3 -0
  111. package/dist/components/headless/menu/combo/combo-input.d.ts +7 -0
  112. package/dist/components/headless/menu/combo/combo-input.js +58 -0
  113. package/dist/components/headless/menu/combo/combo-menu.d.ts +5 -0
  114. package/dist/components/headless/menu/combo/combo-menu.js +24 -0
  115. package/dist/components/headless/menu/combo/combo-option.d.ts +9 -0
  116. package/dist/components/headless/menu/combo/combo-option.js +37 -0
  117. package/dist/components/headless/menu/container.d.ts +5 -0
  118. package/dist/components/headless/menu/container.js +19 -0
  119. package/dist/components/headless/menu/dom.d.ts +4 -0
  120. package/dist/components/headless/menu/dom.js +20 -0
  121. package/dist/components/headless/menu/index.d.ts +54 -0
  122. package/dist/components/headless/menu/index.js +39 -0
  123. package/dist/components/headless/menu/item/handle-vertical-navigation.d.ts +2 -0
  124. package/dist/components/headless/menu/item/handle-vertical-navigation.js +28 -0
  125. package/dist/components/headless/menu/item/item.d.ts +9 -0
  126. package/dist/components/headless/menu/item/item.js +45 -0
  127. package/dist/components/headless/menu/item/use-menu-item-events.d.ts +1 -0
  128. package/dist/components/headless/menu/item/use-menu-item-events.js +25 -0
  129. package/dist/components/headless/menu/menu-divider.d.ts +5 -0
  130. package/dist/components/headless/menu/menu-divider.js +6 -0
  131. package/dist/components/headless/menu/menu-group.d.ts +5 -0
  132. package/dist/components/headless/menu/menu-group.js +6 -0
  133. package/dist/components/headless/menu/menu-header.d.ts +5 -0
  134. package/dist/components/headless/menu/menu-header.js +6 -0
  135. package/dist/components/headless/menu/popover.d.ts +5 -0
  136. package/dist/components/headless/menu/popover.js +7 -0
  137. package/dist/components/headless/menu/radio-group/context.d.ts +11 -0
  138. package/dist/components/headless/menu/radio-group/context.js +7 -0
  139. package/dist/components/headless/menu/radio-group/radio-item.d.ts +10 -0
  140. package/dist/components/headless/menu/radio-group/radio-item.js +44 -0
  141. package/dist/components/headless/menu/submenu/submenu-context.d.ts +9 -0
  142. package/dist/components/headless/menu/submenu/submenu-context.js +3 -0
  143. package/dist/components/headless/menu/submenu/submenu-trigger.d.ts +7 -0
  144. package/dist/components/headless/menu/submenu/submenu-trigger.js +70 -0
  145. package/dist/components/headless/menu/submenu/submenu.d.ts +21 -0
  146. package/dist/components/headless/menu/submenu/submenu.js +55 -0
  147. package/dist/components/headless/menu/submenu/use-submenu-position.d.ts +5 -0
  148. package/dist/components/headless/menu/submenu/use-submenu-position.js +31 -0
  149. package/dist/components/headless/menu/use-menu.d.ts +1 -0
  150. package/dist/components/headless/menu/use-menu.js +52 -0
  151. package/dist/components/headless/popover/container.d.ts +5 -0
  152. package/dist/components/headless/popover/container.js +7 -0
  153. package/dist/components/headless/popover/context.d.ts +6 -0
  154. package/dist/components/headless/popover/context.js +3 -0
  155. package/dist/components/headless/popover/index.d.ts +30 -0
  156. package/dist/components/headless/popover/index.js +17 -0
  157. package/dist/components/headless/popover/root.d.ts +6 -0
  158. package/dist/components/headless/popover/root.js +8 -0
  159. package/dist/components/headless/popover/trigger.d.ts +7 -0
  160. package/dist/components/headless/popover/trigger.js +11 -0
  161. package/dist/components/pill-manager/container.d.ts +5 -0
  162. package/dist/components/pill-manager/container.js +127 -0
  163. package/dist/components/pill-manager/expander.d.ts +9 -0
  164. package/dist/components/pill-manager/expander.js +21 -0
  165. package/dist/components/pill-manager/icons.d.ts +12 -0
  166. package/dist/components/pill-manager/icons.js +35 -0
  167. package/dist/components/pill-manager/index.d.ts +33 -0
  168. package/dist/components/pill-manager/index.js +13 -0
  169. package/dist/components/pill-manager/item.d.ts +10 -0
  170. package/dist/components/pill-manager/item.js +178 -0
  171. package/dist/components/pill-manager/label.d.ts +10 -0
  172. package/dist/components/pill-manager/label.js +31 -0
  173. package/dist/components/pill-manager/pill-manager.play.d.ts +3 -0
  174. package/dist/components/pill-manager/pill-manager.play.js +73 -0
  175. package/dist/components/pill-manager/pill-row.context.d.ts +8 -0
  176. package/dist/components/pill-manager/pill-row.context.js +4 -0
  177. package/dist/components/pill-manager/pill-row.d.ts +12 -0
  178. package/dist/components/pill-manager/pill-row.js +22 -0
  179. package/dist/components/pill-manager/root.context.d.ts +40 -0
  180. package/dist/components/pill-manager/root.context.js +4 -0
  181. package/dist/components/pill-manager/root.d.ts +25 -0
  182. package/dist/components/pill-manager/root.js +33 -0
  183. package/dist/components/pill-manager/row-default.d.ts +3 -0
  184. package/dist/components/pill-manager/row-default.js +14 -0
  185. package/dist/components/pill-manager/types.d.ts +21 -0
  186. package/dist/components/pill-manager/types.js +1 -0
  187. package/dist/components/row-group-cell.d.ts +13 -0
  188. package/dist/components/row-group-cell.js +40 -0
  189. package/dist/components/select-all.d.ts +12 -0
  190. package/dist/components/select-all.js +34 -0
  191. package/dist/components/smart-select/chip-context.d.ts +8 -0
  192. package/dist/components/smart-select/chip-context.js +4 -0
  193. package/dist/components/smart-select/chip-remove.d.ts +1 -0
  194. package/dist/components/smart-select/chip-remove.js +13 -0
  195. package/dist/components/smart-select/chip.d.ts +13 -0
  196. package/dist/components/smart-select/chip.js +79 -0
  197. package/dist/components/smart-select/container.d.ts +1 -0
  198. package/dist/components/smart-select/container.js +13 -0
  199. package/dist/components/smart-select/context.d.ts +31 -0
  200. package/dist/components/smart-select/context.js +4 -0
  201. package/dist/components/smart-select/index.d.ts +30 -0
  202. package/dist/components/smart-select/index.js +19 -0
  203. package/dist/components/smart-select/option.d.ts +8 -0
  204. package/dist/components/smart-select/option.js +36 -0
  205. package/dist/components/smart-select/root.d.ts +17 -0
  206. package/dist/components/smart-select/root.js +165 -0
  207. package/dist/components/smart-select/smart-select.play.d.ts +2 -0
  208. package/dist/components/smart-select/smart-select.play.js +36 -0
  209. package/dist/components/smart-select/triggers/basic-trigger.d.ts +1 -0
  210. package/dist/components/smart-select/triggers/basic-trigger.js +18 -0
  211. package/dist/components/smart-select/triggers/combo-trigger.d.ts +1 -0
  212. package/dist/components/smart-select/triggers/combo-trigger.js +17 -0
  213. package/dist/components/smart-select/triggers/is-selectable-option.d.ts +1 -0
  214. package/dist/components/smart-select/triggers/is-selectable-option.js +3 -0
  215. package/dist/components/smart-select/triggers/multi-combo-trigger.d.ts +11 -0
  216. package/dist/components/smart-select/triggers/multi-combo-trigger.js +38 -0
  217. package/dist/components/smart-select/triggers/multi-trigger.d.ts +6 -0
  218. package/dist/components/smart-select/triggers/multi-trigger.js +8 -0
  219. package/dist/components/smart-select/triggers/use-combo-controls.d.ts +9 -0
  220. package/dist/components/smart-select/triggers/use-combo-controls.js +145 -0
  221. package/dist/components/smart-select/triggers/use-trigger-controls.d.ts +5 -0
  222. package/dist/components/smart-select/triggers/use-trigger-controls.js +126 -0
  223. package/dist/components/smart-select/type.d.ts +44 -0
  224. package/dist/components/smart-select/type.js +1 -0
  225. package/dist/components/smart-select/use-async-options.d.ts +8 -0
  226. package/dist/components/smart-select/use-async-options.js +42 -0
  227. package/dist/components/tree-view/index.d.ts +4 -0
  228. package/dist/components/tree-view/index.js +2 -0
  229. package/dist/components/tree-view/root.d.ts +37 -0
  230. package/dist/components/tree-view/root.js +139 -0
  231. package/dist/components/tree-view/select-all.d.ts +7 -0
  232. package/dist/components/tree-view/select-all.js +22 -0
  233. package/dist/components/tree-view/tree-children.d.ts +2 -0
  234. package/dist/components/tree-view/tree-children.js +15 -0
  235. package/dist/components/tree-view/types.d.ts +31 -0
  236. package/dist/components/tree-view/types.js +1 -0
  237. package/dist/components/types.d.ts +4 -0
  238. package/dist/components/types.js +1 -0
  239. package/dist/components/virtual-from-coordinates.d.ts +2 -0
  240. package/dist/components/virtual-from-coordinates.js +15 -0
  241. package/dist/components.d.ts +16 -0
  242. package/dist/components.js +11 -0
  243. package/dist/data-source-client/hooks/get-valid-leafs.d.ts +3 -0
  244. package/dist/data-source-client/hooks/get-valid-leafs.js +11 -0
  245. package/dist/data-source-client/hooks/use-controlled-ds-state.d.ts +13 -0
  246. package/dist/data-source-client/hooks/use-controlled-ds-state.js +39 -0
  247. package/dist/data-source-client/hooks/use-flattened-data.d.ts +18 -0
  248. package/dist/data-source-client/hooks/use-flattened-data.js +40 -0
  249. package/dist/data-source-client/hooks/use-flattened-groups.d.ts +5 -0
  250. package/dist/data-source-client/hooks/use-flattened-groups.js +63 -0
  251. package/dist/data-source-client/hooks/use-flattened-piece.d.ts +14 -0
  252. package/dist/data-source-client/hooks/use-flattened-piece.js +55 -0
  253. package/dist/data-source-client/hooks/use-group-tree/collapse-child.d.ts +2 -0
  254. package/dist/data-source-client/hooks/use-group-tree/collapse-child.js +11 -0
  255. package/dist/data-source-client/hooks/use-group-tree/collapse-last.d.ts +2 -0
  256. package/dist/data-source-client/hooks/use-group-tree/collapse-last.js +14 -0
  257. package/dist/data-source-client/hooks/use-group-tree/collapse.d.ts +2 -0
  258. package/dist/data-source-client/hooks/use-group-tree/collapse.js +17 -0
  259. package/dist/data-source-client/hooks/use-group-tree/use-group-tree.d.ts +31 -0
  260. package/dist/data-source-client/hooks/use-group-tree/use-group-tree.js +152 -0
  261. package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/apply-reference-column.d.ts +2 -0
  262. package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/apply-reference-column.js +22 -0
  263. package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/evaluate-label-filter.d.ts +2 -0
  264. package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/evaluate-label-filter.js +9 -0
  265. package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/pivot-paths-with-totals.d.ts +18 -0
  266. package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/pivot-paths-with-totals.js +140 -0
  267. package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/pivot-paths.d.ts +4 -0
  268. package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/pivot-paths.js +31 -0
  269. package/dist/data-source-client/hooks/use-pivot/use-agg-model.d.ts +4 -0
  270. package/dist/data-source-client/hooks/use-pivot/use-agg-model.js +45 -0
  271. package/dist/data-source-client/hooks/use-pivot/use-filtered-data.d.ts +2 -0
  272. package/dist/data-source-client/hooks/use-pivot/use-filtered-data.js +18 -0
  273. package/dist/data-source-client/hooks/use-pivot/use-pivot-columns.d.ts +14 -0
  274. package/dist/data-source-client/hooks/use-pivot/use-pivot-columns.js +151 -0
  275. package/dist/data-source-client/hooks/use-pivot/use-pivot-data.d.ts +32 -0
  276. package/dist/data-source-client/hooks/use-pivot/use-pivot-data.js +83 -0
  277. package/dist/data-source-client/hooks/use-pivot/use-pivot-group-fn.d.ts +4 -0
  278. package/dist/data-source-client/hooks/use-pivot/use-pivot-group-fn.js +23 -0
  279. package/dist/data-source-client/hooks/use-pivot/use-pivot-state.d.ts +16 -0
  280. package/dist/data-source-client/hooks/use-pivot/use-pivot-state.js +40 -0
  281. package/dist/data-source-client/use-client-data-source.d.ts +91 -0
  282. package/dist/data-source-client/use-client-data-source.js +169 -0
  283. package/dist/data-source-server/async-tree/+constants.async-tree.d.ts +1 -0
  284. package/dist/data-source-server/async-tree/+constants.async-tree.js +1 -0
  285. package/dist/data-source-server/async-tree/apply-delete-action-to-tree.d.ts +2 -0
  286. package/dist/data-source-server/async-tree/apply-delete-action-to-tree.js +27 -0
  287. package/dist/data-source-server/async-tree/apply-set-action-to-tree.d.ts +2 -0
  288. package/dist/data-source-server/async-tree/apply-set-action-to-tree.js +26 -0
  289. package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-keys-are-unique.d.ts +2 -0
  290. package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-keys-are-unique.js +20 -0
  291. package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-keys-are-valid.d.ts +2 -0
  292. package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-keys-are-valid.js +12 -0
  293. package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-keys-fit.d.ts +2 -0
  294. package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-keys-fit.js +18 -0
  295. package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-kinds.d.ts +2 -0
  296. package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-kinds.js +12 -0
  297. package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action.d.ts +2 -0
  298. package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action.js +24 -0
  299. package/dist/data-source-server/async-tree/get-parent-node-by-path.d.ts +2 -0
  300. package/dist/data-source-server/async-tree/get-parent-node-by-path.js +18 -0
  301. package/dist/data-source-server/async-tree/is-set-action-a-no-op-on-node.d.ts +2 -0
  302. package/dist/data-source-server/async-tree/is-set-action-a-no-op-on-node.js +3 -0
  303. package/dist/data-source-server/async-tree/make-async-tree.d.ts +2 -0
  304. package/dist/data-source-server/async-tree/make-async-tree.js +64 -0
  305. package/dist/data-source-server/async-tree/maybe-apply-parent-remove-self.d.ts +2 -0
  306. package/dist/data-source-server/async-tree/maybe-apply-parent-remove-self.js +8 -0
  307. package/dist/data-source-server/async-tree/maybe-apply-resize.d.ts +2 -0
  308. package/dist/data-source-server/async-tree/maybe-apply-resize.js +17 -0
  309. package/dist/data-source-server/async-tree/maybe-apply-set-action-items.d.ts +2 -0
  310. package/dist/data-source-server/async-tree/maybe-apply-set-action-items.js +54 -0
  311. package/dist/data-source-server/async-tree/types.d.ts +70 -0
  312. package/dist/data-source-server/async-tree/types.js +1 -0
  313. package/dist/data-source-server/range-tree/range-tree.d.ts +66 -0
  314. package/dist/data-source-server/range-tree/range-tree.js +102 -0
  315. package/dist/data-source-server/server-data.d.ts +73 -0
  316. package/dist/data-source-server/server-data.js +553 -0
  317. package/dist/data-source-server/source/use-on-rows-updated.d.ts +4 -0
  318. package/dist/data-source-server/source/use-on-rows-updated.js +29 -0
  319. package/dist/data-source-server/source/use-on-view-change.d.ts +3 -0
  320. package/dist/data-source-server/source/use-on-view-change.js +13 -0
  321. package/dist/data-source-server/source/use-row-add.d.ts +3 -0
  322. package/dist/data-source-server/source/use-row-add.js +36 -0
  323. package/dist/data-source-server/source/use-row-by-id.d.ts +2 -0
  324. package/dist/data-source-server/source/use-row-by-id.js +8 -0
  325. package/dist/data-source-server/source/use-row-by-index.d.ts +9 -0
  326. package/dist/data-source-server/source/use-row-by-index.js +89 -0
  327. package/dist/data-source-server/source/use-row-children.d.ts +2 -0
  328. package/dist/data-source-server/source/use-row-children.js +16 -0
  329. package/dist/data-source-server/source/use-row-delete.d.ts +3 -0
  330. package/dist/data-source-server/source/use-row-delete.js +39 -0
  331. package/dist/data-source-server/source/use-row-id-to-row-index.d.ts +2 -0
  332. package/dist/data-source-server/source/use-row-id-to-row-index.js +7 -0
  333. package/dist/data-source-server/source/use-row-index-to-row-id.d.ts +2 -0
  334. package/dist/data-source-server/source/use-row-index-to-row-id.js +7 -0
  335. package/dist/data-source-server/source/use-row-leafs.d.ts +2 -0
  336. package/dist/data-source-server/source/use-row-leafs.js +20 -0
  337. package/dist/data-source-server/source/use-row-parents.d.ts +2 -0
  338. package/dist/data-source-server/source/use-row-parents.js +16 -0
  339. package/dist/data-source-server/source/use-row-siblings.d.ts +2 -0
  340. package/dist/data-source-server/source/use-row-siblings.js +15 -0
  341. package/dist/data-source-server/source/use-rows-between.d.ts +2 -0
  342. package/dist/data-source-server/source/use-rows-between.js +20 -0
  343. package/dist/data-source-server/source/use-source-state.d.ts +28 -0
  344. package/dist/data-source-server/source/use-source-state.js +47 -0
  345. package/dist/data-source-server/source/use-source.d.ts +5 -0
  346. package/dist/data-source-server/source/use-source.js +66 -0
  347. package/dist/data-source-server/types.d.ts +42 -0
  348. package/dist/data-source-server/types.js +1 -0
  349. package/dist/data-source-server/use-server-data-source.d.ts +51 -0
  350. package/dist/data-source-server/use-server-data-source.js +192 -0
  351. package/dist/data-source-server/utils/get-node-depth.d.ts +2 -0
  352. package/dist/data-source-server/utils/get-node-depth.js +9 -0
  353. package/dist/data-source-server/utils/get-node-path.d.ts +2 -0
  354. package/dist/data-source-server/utils/get-node-path.js +9 -0
  355. package/dist/data-source-server/utils/get-request-id.d.ts +1 -0
  356. package/dist/data-source-server/utils/get-request-id.js +6 -0
  357. package/dist/data-source-tree/source/use-controlled-state.d.ts +8 -0
  358. package/dist/data-source-tree/source/use-controlled-state.js +21 -0
  359. package/dist/data-source-tree/source/use-flattened.d.ts +17 -0
  360. package/dist/data-source-tree/source/use-flattened.js +65 -0
  361. package/dist/data-source-tree/source/use-on-rows-updated.d.ts +3 -0
  362. package/dist/data-source-tree/source/use-on-rows-updated.js +49 -0
  363. package/dist/data-source-tree/source/use-row-by-id.d.ts +2 -0
  364. package/dist/data-source-tree/source/use-row-by-id.js +7 -0
  365. package/dist/data-source-tree/source/use-row-children.d.ts +2 -0
  366. package/dist/data-source-tree/source/use-row-children.js +11 -0
  367. package/dist/data-source-tree/source/use-row-leafs.d.ts +2 -0
  368. package/dist/data-source-tree/source/use-row-leafs.js +20 -0
  369. package/dist/data-source-tree/source/use-row-parents.d.ts +2 -0
  370. package/dist/data-source-tree/source/use-row-parents.js +16 -0
  371. package/dist/data-source-tree/source/use-row-siblings.d.ts +2 -0
  372. package/dist/data-source-tree/source/use-row-siblings.js +12 -0
  373. package/dist/data-source-tree/source/use-tree.d.ts +3 -0
  374. package/dist/data-source-tree/source/use-tree.js +59 -0
  375. package/dist/data-source-tree/types.d.ts +16 -0
  376. package/dist/data-source-tree/types.js +1 -0
  377. package/dist/data-source-tree/use-tree-data-source.d.ts +41 -0
  378. package/dist/data-source-tree/use-tree-data-source.js +101 -0
  379. package/dist/data-source-tree/utils/is-object.d.ts +1 -0
  380. package/dist/data-source-tree/utils/is-object.js +3 -0
  381. package/dist/hooks/use-slot/get-element-ref.d.ts +2 -0
  382. package/dist/hooks/use-slot/get-element-ref.js +20 -0
  383. package/dist/hooks/use-slot/index.d.ts +3 -0
  384. package/dist/hooks/use-slot/index.js +1 -0
  385. package/dist/hooks/use-slot/merge-props.d.ts +4 -0
  386. package/dist/hooks/use-slot/merge-props.js +27 -0
  387. package/dist/hooks/use-slot/react-version.d.ts +3 -0
  388. package/dist/hooks/use-slot/react-version.js +5 -0
  389. package/dist/hooks/use-slot/types.d.ts +4 -0
  390. package/dist/hooks/use-slot/types.js +1 -0
  391. package/dist/hooks/use-slot/use-slot.d.ts +12 -0
  392. package/dist/hooks/use-slot/use-slot.js +28 -0
  393. package/dist/hooks/use-transitioned-open.d.ts +2 -0
  394. package/dist/hooks/use-transitioned-open.js +50 -0
  395. package/dist/index.d.ts +121 -0
  396. package/dist/index.js +23 -0
  397. package/dist/license/index.d.ts +1 -0
  398. package/dist/license/index.js +1 -0
  399. package/dist/license/license.d.ts +3 -0
  400. package/dist/license/license.js +215 -0
  401. package/dist/license/md5-hash.d.ts +9 -0
  402. package/dist/license/md5-hash.js +167 -0
  403. package/dist/license.d.ts +3 -0
  404. package/dist/license.js +214 -0
  405. package/dist/root/context.d.ts +16 -0
  406. package/dist/root/context.js +4 -0
  407. package/dist/root/hooks/use-pro-api.d.ts +2 -0
  408. package/dist/root/hooks/use-pro-api.js +8 -0
  409. package/dist/root/root.d.ts +15 -0
  410. package/dist/root/root.js +112 -0
  411. package/dist/types/api.d.ts +100 -0
  412. package/dist/types/api.js +1 -0
  413. package/dist/types/column.d.ts +73 -0
  414. package/dist/types/column.js +1 -0
  415. package/dist/types/events.d.ts +56 -0
  416. package/dist/types/events.js +1 -0
  417. package/dist/types/grid.d.ts +47 -0
  418. package/dist/types/grid.js +1 -0
  419. package/dist/types/index.d.ts +7 -0
  420. package/dist/types/index.js +1 -0
  421. package/dist/types/props.d.ts +187 -0
  422. package/dist/types/props.js +1 -0
  423. package/package.json +5 -5
@@ -0,0 +1,192 @@
1
+ import { useMemo } from "react";
2
+ import { usePiece, useOnRowsSelected, useRowIsSelected, useRowSelection, useRowsSelected, useEvent, useGlobalRefresh, useRowSelectionState, } from "@1771technologies/lytenyte-core/internal";
3
+ import {} from "@1771technologies/lytenyte-shared";
4
+ import { useRowByIndex } from "./source/use-row-by-index.js";
5
+ import { useRowIndexToRowId } from "./source/use-row-index-to-row-id.js";
6
+ import { useRowIdToRowIndex } from "./source/use-row-id-to-row-index.js";
7
+ import { useRowById } from "./source/use-row-by-id.js";
8
+ import { useOnViewChange } from "./source/use-on-view-change.js";
9
+ import { useSourceState } from "./source/use-source-state.js";
10
+ import { useSource } from "./source/use-source.js";
11
+ import { useRowParents } from "./source/use-row-parents.js";
12
+ import { useRowsBetween } from "./source/use-rows-between.js";
13
+ import { useRowChildren } from "./source/use-row-children.js";
14
+ import { useRowLeafs } from "./source/use-row-leafs.js";
15
+ import { useOnRowsUpdated } from "./source/use-on-rows-updated.js";
16
+ import { useRowDelete } from "./source/use-row-delete.js";
17
+ import { useRowAdd } from "./source/use-row-add.js";
18
+ import { useRowSiblings } from "./source/use-row-siblings.js";
19
+ export function useServerDataSource(props) {
20
+ const isolatedSelected = props.rowsIsolatedSelection ?? false;
21
+ const state = useSourceState(props);
22
+ const isLoading$ = usePiece(state.isLoading);
23
+ const loadError$ = usePiece(state.loadingError);
24
+ const requestsForView$ = usePiece(state.requestsForView, state.setRequestsForView);
25
+ const top$ = usePiece(state.topCount);
26
+ const bot$ = usePiece(state.botCount);
27
+ const maxDepth$ = usePiece(state.maxDepth);
28
+ const rowCount$ = usePiece(state.rowCount);
29
+ const globalSignal = useGlobalRefresh();
30
+ const source = useSource(props, state, globalSignal);
31
+ const rowById = useRowById(source);
32
+ const rowIdToRowIndex = useRowIdToRowIndex(source);
33
+ const rowIndexToRowId = useRowIndexToRowId(source);
34
+ const rowParents = useRowParents(source);
35
+ const rowsBetween = useRowsBetween(source);
36
+ const rowChildren = useRowChildren(source);
37
+ const onViewChange = useOnViewChange(source, state.requestsForView, state.setRequestsForView);
38
+ const idSpec = useEvent((id) => {
39
+ const node = source.tree.rowIdToNode.get(id);
40
+ if (!node || node.kind === "leaf")
41
+ return null;
42
+ return { size: node.size, children: node.byIndex };
43
+ });
44
+ const { rootIds, rootCount } = useMemo(() => {
45
+ const subset = props.rowSelectionIdUniverseSubtractions ?? new Set();
46
+ const rootIds = new Set([...source.tree.byIndex.values()].map((x) => x.row.id)).difference(subset);
47
+ const additions = new Set(props.rowSelectionIdUniverseAdditions?.filter((x) => x.root).map((x) => x.id) ?? []).difference(subset);
48
+ return { rootIds: rootIds.union(additions), rootCount: source.tree.size };
49
+ }, [
50
+ props.rowSelectionIdUniverseAdditions,
51
+ props.rowSelectionIdUniverseSubtractions,
52
+ source.tree.byIndex,
53
+ source.tree.size,
54
+ ]);
55
+ // Handling row selection
56
+ const selectionState = useRowSelection(props.rowSelection, props.onRowSelectionChange, isolatedSelected, props.rowSelectKey ?? props.queryKey, useMemo(() => {
57
+ const subset = props.rowSelectionIdUniverseSubtractions ?? new Set();
58
+ if (!props.rowSelectionIdUniverseAdditions)
59
+ return state.idUniverse.difference(subset);
60
+ return state.idUniverse
61
+ .union(new Set(props.rowSelectionIdUniverseAdditions.map((x) => x.id)))
62
+ .difference(subset);
63
+ }, [props.rowSelectionIdUniverseAdditions, props.rowSelectionIdUniverseSubtractions, state.idUniverse]), rootIds, rootCount, globalSignal);
64
+ const onRowsSelected = useOnRowsSelected(selectionState, idSpec, rowParents, isolatedSelected, globalSignal);
65
+ const rowIsSelected = useRowIsSelected(selectionState, rowParents, rowById);
66
+ const rowsSelected = useRowsSelected(selectionState, source.tree.rowIdToNode, rowParents);
67
+ const rowSelectionState = useRowSelectionState(selectionState);
68
+ const rowLeafs = useRowLeafs(source);
69
+ const { rowByIndex, rowInvalidate } = useRowByIndex(source, selectionState, globalSignal, rowParents);
70
+ const setExpansions = state.onExpansionsChange;
71
+ const onRowsUpdated = useOnRowsUpdated(source, props.onRowDataChange, props.rowUpdateOptimistically, globalSignal);
72
+ const rowSiblings = useRowSiblings(source);
73
+ const rowDelete = useRowDelete(source, props.onRowsDeleted, props.rowUpdateOptimistically);
74
+ const rowAdd = useRowAdd(source, props.onRowsAdded, props.rowUpdateOptimistically);
75
+ const selection$ = usePiece(selectionState.rowSelectionsRaw);
76
+ const rowGroupsPresent$ = usePiece(props.hasRowBranches ?? "infer");
77
+ const rowSource = useMemo(() => {
78
+ const rowSource = {
79
+ rowById,
80
+ rowByIndex,
81
+ rowInvalidate,
82
+ rowIdToRowIndex,
83
+ rowIndexToRowId,
84
+ rowChildren,
85
+ rowsSelected,
86
+ rowIsSelected,
87
+ rowSelectionState,
88
+ rowDelete,
89
+ rowAdd,
90
+ rowUpdate: onRowsUpdated,
91
+ rowSiblings,
92
+ rowLeafs,
93
+ rowParents,
94
+ rowsBetween,
95
+ useTopCount: () => top$.useValue(),
96
+ useRowCount: () => rowCount$.useValue(),
97
+ useBottomCount: () => bot$.useValue(),
98
+ useRows: () => {
99
+ const rowCount = rowCount$.useValue();
100
+ const mappedMemo = useMemo(() => {
101
+ return {
102
+ get: (i) => {
103
+ const row = source.flat.rowIndexToRow.get(i);
104
+ if (!row && i >= 0 && i < rowCount) {
105
+ return {
106
+ kind: "leaf",
107
+ id: `__loading__placeholder__${i}`,
108
+ data: {},
109
+ depth: 0,
110
+ };
111
+ }
112
+ return row;
113
+ },
114
+ size: rowCount,
115
+ };
116
+ }, [rowCount]);
117
+ return mappedMemo;
118
+ },
119
+ useMaxRowGroupDepth: () => {
120
+ const maxDepth = maxDepth$.useValue();
121
+ const presence = rowGroupsPresent$.useValue();
122
+ if (presence === "infer")
123
+ return maxDepth;
124
+ return presence ? 1 : 0;
125
+ },
126
+ useSelectionState: selection$.useValue,
127
+ rowGroupExpansionChange: (deltaChanges) => {
128
+ setExpansions(deltaChanges);
129
+ },
130
+ onRowsSelected,
131
+ onViewChange,
132
+ onRowsUpdated,
133
+ // Specific to the server data source
134
+ isLoading: isLoading$,
135
+ loadingError: loadError$,
136
+ requestsForView: requestsForView$,
137
+ pushRequests: (requests) => source.handleRequests(requests),
138
+ pushResponses: source.handleResponses,
139
+ retry: () => {
140
+ source.retry();
141
+ rowSource.rowInvalidate();
142
+ },
143
+ refresh: (onSuccess, onError) => {
144
+ const requests = requestsForView$.get();
145
+ rowSource.pushRequests(requests, onSuccess, onError);
146
+ },
147
+ reset: () => source.reset(),
148
+ requestForGroup: (row) => {
149
+ const index = typeof row === "number" ? row : source.flat.rowIdToRowIndex.get(row.id);
150
+ if (index == null)
151
+ return null;
152
+ return source.requestForGroup(index);
153
+ },
154
+ requestForNextSlice: (req) => source.requestForNextSlice(req),
155
+ get seenRequests() {
156
+ return source.flat?.seenRequests ?? new Set();
157
+ },
158
+ };
159
+ return rowSource;
160
+ }, [
161
+ bot$,
162
+ isLoading$,
163
+ loadError$,
164
+ maxDepth$,
165
+ onRowsSelected,
166
+ onRowsUpdated,
167
+ onViewChange,
168
+ requestsForView$,
169
+ rowAdd,
170
+ rowById,
171
+ rowByIndex,
172
+ rowChildren,
173
+ rowCount$,
174
+ rowDelete,
175
+ rowGroupsPresent$,
176
+ rowIdToRowIndex,
177
+ rowIndexToRowId,
178
+ rowInvalidate,
179
+ rowIsSelected,
180
+ rowLeafs,
181
+ rowParents,
182
+ rowSelectionState,
183
+ rowSiblings,
184
+ rowsBetween,
185
+ rowsSelected,
186
+ selection$.useValue,
187
+ setExpansions,
188
+ source,
189
+ top$,
190
+ ]);
191
+ return rowSource;
192
+ }
@@ -0,0 +1,2 @@
1
+ import type { TreeLeaf, TreeParent } from "../async-tree/types.js";
2
+ export declare function getNodeDepth(node: TreeParent | TreeLeaf): number;
@@ -0,0 +1,9 @@
1
+ export function getNodeDepth(node) {
2
+ let depth = 0;
3
+ let current = node.parent;
4
+ while (current && current.kind !== "root") {
5
+ depth++;
6
+ current = current.parent;
7
+ }
8
+ return depth;
9
+ }
@@ -0,0 +1,2 @@
1
+ import type { TreeParent, TreeRoot } from "../async-tree/types.js";
2
+ export declare function getNodePath(c: TreeRoot | TreeParent): (string | null)[];
@@ -0,0 +1,9 @@
1
+ export function getNodePath(c) {
2
+ const path = [];
3
+ let current = c;
4
+ while (current.kind !== "root") {
5
+ path.unshift(current.path);
6
+ current = current.parent;
7
+ }
8
+ return path;
9
+ }
@@ -0,0 +1 @@
1
+ export declare function getRequestId(path: (string | null)[], start: number, end: number): string;
@@ -0,0 +1,6 @@
1
+ export function getRequestId(path, start, end) {
2
+ if (path.length === 0)
3
+ return `__ROOT__/${start}-${end}`;
4
+ const key = path.map((s) => (s == null ? `__null__` : s)).join("/") + `${start}-${end}`;
5
+ return key;
6
+ }
@@ -0,0 +1,8 @@
1
+ import type { UseTreeDataSourceParams } from "../use-tree-data-source";
2
+ export declare function useControlledState<T>({ onRowGroupExpansionChange, rowGroupDefaultExpansion, rowGroupExpansions, }: UseTreeDataSourceParams<T>): {
3
+ expansions: {
4
+ [rowId: string]: boolean | undefined;
5
+ };
6
+ onExpansionsChange: (delta: Record<string, boolean | undefined>) => void;
7
+ expandedFn: (id: string, depth: number) => boolean;
8
+ };
@@ -0,0 +1,21 @@
1
+ import { useControlled, useEvent } from "@1771technologies/lytenyte-core/internal";
2
+ import { useCallback } from "react";
3
+ export function useControlledState({ onRowGroupExpansionChange, rowGroupDefaultExpansion = false, rowGroupExpansions, }) {
4
+ const [expansions, setExpansions] = useControlled({
5
+ controlled: rowGroupExpansions,
6
+ default: {},
7
+ });
8
+ const onExpansionsChange = useEvent((delta) => {
9
+ setExpansions({ ...expansions, ...delta });
10
+ onRowGroupExpansionChange?.({ ...expansions, ...delta });
11
+ });
12
+ const expandedFn = useCallback((id, depth) => {
13
+ const s = expansions[id];
14
+ if (s != null)
15
+ return s;
16
+ if (typeof rowGroupDefaultExpansion === "boolean")
17
+ return rowGroupDefaultExpansion;
18
+ return depth <= rowGroupDefaultExpansion;
19
+ }, [expansions, rowGroupDefaultExpansion]);
20
+ return { expansions, onExpansionsChange, expandedFn };
21
+ }
@@ -0,0 +1,17 @@
1
+ import type { TreeRoot } from "../types";
2
+ import type { RowAggregated, RowLeaf, RowNode, SortFn } from "@1771technologies/lytenyte-shared";
3
+ export declare function useFlattened<T>(tree: TreeRoot, expandFn: (id: string, depth: number) => boolean, top: (RowLeaf<T> | RowAggregated)[] | undefined, bot: (RowLeaf<T> | RowAggregated)[] | undefined, idUniverseAdditions: {
4
+ readonly id: string;
5
+ readonly root: boolean;
6
+ }[] | null | undefined, idUniverseSubtractions: Set<string> | null | undefined, sort: SortFn<T> | null | undefined): {
7
+ idUniverse: Set<string>;
8
+ rootIds: Set<string>;
9
+ rootCount: number;
10
+ rows: RowNode<T>[];
11
+ indexToRow: Map<number, RowNode<T>>;
12
+ idToIndex: Map<string, number>;
13
+ rowCount: number;
14
+ topCount: number;
15
+ botCount: number;
16
+ maxDepth: number;
17
+ };
@@ -0,0 +1,65 @@
1
+ import { useMemo } from "react";
2
+ const empty = [];
3
+ export function useFlattened(tree, expandFn, top = empty, bot = empty, idUniverseAdditions, idUniverseSubtractions, sort) {
4
+ const flat = useMemo(() => {
5
+ const stack = [...tree.children.values()];
6
+ if (sort)
7
+ stack.sort((l, r) => sort(l.row, r.row));
8
+ const indexToRow = new Map();
9
+ const idToIndex = new Map();
10
+ const rows = [...top];
11
+ top.map((x, i) => {
12
+ indexToRow.set(i, x);
13
+ idToIndex.set(x.id, i);
14
+ });
15
+ let maxDepth = 0;
16
+ while (stack.length) {
17
+ const node = stack.shift();
18
+ indexToRow.set(rows.length, node.row);
19
+ idToIndex.set(node.row.id, rows.length);
20
+ rows.push(node.row);
21
+ if (node.kind === "parent")
22
+ maxDepth = Math.max(maxDepth, node.row.depth + 1);
23
+ if (node.kind === "parent" && expandFn(node.row.id, node.row.depth) && node.row.expandable) {
24
+ node.row.expanded = true;
25
+ const children = [...node.children.values()];
26
+ if (sort)
27
+ children.sort((l, r) => sort(l.row, r.row));
28
+ stack.unshift(...children);
29
+ }
30
+ else if (node.kind === "parent") {
31
+ node.row.expanded = false;
32
+ }
33
+ }
34
+ rows.push(...bot);
35
+ bot.map((x, i) => {
36
+ indexToRow.set(i, x);
37
+ idToIndex.set(x.id, i);
38
+ });
39
+ return {
40
+ rows,
41
+ indexToRow,
42
+ idToIndex,
43
+ rowCount: rows.length,
44
+ topCount: top.length,
45
+ botCount: bot.length,
46
+ maxDepth,
47
+ };
48
+ }, [bot, expandFn, sort, top, tree.children]);
49
+ return useMemo(() => {
50
+ const initialSet = new Set(tree.rowIdToNode.keys());
51
+ top.map((x) => initialSet.add(x.id));
52
+ bot.map((x) => initialSet.add(x.id));
53
+ const subSet = idUniverseSubtractions ?? new Set();
54
+ const rootAdds = idUniverseAdditions?.filter((x) => x.root)?.map((x) => x.id) ?? [];
55
+ const rootIds = new Set([...tree.children.values().map((x) => x.row.id)].concat(rootAdds)).difference(subSet);
56
+ return {
57
+ ...flat,
58
+ idUniverse: idUniverseAdditions
59
+ ? initialSet.union(new Set(idUniverseAdditions.map((x) => x.id) ?? [])).difference(subSet)
60
+ : initialSet.difference(subSet),
61
+ rootIds,
62
+ rootCount: rootIds.size,
63
+ };
64
+ }, [bot, flat, idUniverseAdditions, idUniverseSubtractions, top, tree.children, tree.rowIdToNode]);
65
+ }
@@ -0,0 +1,3 @@
1
+ import type { UseTreeDataSourceParams } from "../use-tree-data-source";
2
+ import type { TreeRoot } from "../types";
3
+ export declare function useOnRowsUpdated<T>(tree: TreeRoot, p: UseTreeDataSourceParams<T>): (rows: Map<import("@1771technologies/lytenyte-shared").RowNode<any>, any>) => void;
@@ -0,0 +1,49 @@
1
+ import { useEvent } from "@1771technologies/lytenyte-core/internal";
2
+ export function useOnRowsUpdated(tree, p) {
3
+ const onRowsUpdate = useEvent((updates) => {
4
+ if (!p.onRowDataChange)
5
+ return;
6
+ const changes = [];
7
+ const top = new Map();
8
+ const bottom = new Map();
9
+ for (const [row, u] of updates) {
10
+ // Updating data
11
+ if (row.kind === "branch") {
12
+ const node = tree.rowIdToNode.get(row.id);
13
+ if (!node) {
14
+ console.error(`Attempting to update a node that does not exist: ${row.id}`);
15
+ return;
16
+ }
17
+ let current = node.parent;
18
+ const path = [];
19
+ while (current.kind !== "root") {
20
+ path.push(current.key);
21
+ current = current.parent;
22
+ }
23
+ path.reverse();
24
+ changes.push({
25
+ key: node.key,
26
+ next: u,
27
+ parent: node?.parent.data,
28
+ prev: node.data,
29
+ path,
30
+ });
31
+ continue;
32
+ }
33
+ const topIndex = p.topData?.findIndex((r) => r.id === row.id);
34
+ if (topIndex != null && topIndex !== -1) {
35
+ top.set(topIndex, u);
36
+ continue;
37
+ }
38
+ const botIndex = p.botData?.findIndex((r) => r.id === row.id);
39
+ if (botIndex != null && botIndex !== -1) {
40
+ bottom.set(botIndex, u);
41
+ continue;
42
+ }
43
+ console.error(`Attempting to update a node that does not exist: ${row.id}`);
44
+ return;
45
+ }
46
+ p.onRowDataChange({ changes, top, bottom });
47
+ });
48
+ return onRowsUpdate;
49
+ }
@@ -0,0 +1,2 @@
1
+ import type { TreeRoot } from "../types.js";
2
+ export declare function useRowById(tree: TreeRoot): (id: string) => import("@1771technologies/lytenyte-shared").RowNode<any> | null;
@@ -0,0 +1,7 @@
1
+ import { useEvent } from "@1771technologies/lytenyte-core/internal";
2
+ export function useRowById(tree) {
3
+ const rowById = useEvent((id) => {
4
+ return tree.rowIdToNode.get(id)?.row ?? null;
5
+ });
6
+ return rowById;
7
+ }
@@ -0,0 +1,2 @@
1
+ import type { TreeRoot } from "../types";
2
+ export declare function useRowChildren(tree: TreeRoot): (id: string) => string[];
@@ -0,0 +1,11 @@
1
+ import { useEvent } from "@1771technologies/lytenyte-core/internal";
2
+ export function useRowChildren(tree) {
3
+ const rowChildren = useEvent((id) => {
4
+ const node = tree.rowIdToNode.get(id);
5
+ if (!node)
6
+ return [];
7
+ const ids = [...node.children.values()].map((x) => x.row.id);
8
+ return ids;
9
+ });
10
+ return rowChildren;
11
+ }
@@ -0,0 +1,2 @@
1
+ import type { TreeRoot } from "../types";
2
+ export declare function useRowLeafs(tree: TreeRoot): (id: string) => string[];
@@ -0,0 +1,20 @@
1
+ import { useEvent } from "@1771technologies/lytenyte-core/internal";
2
+ export function useRowLeafs(tree) {
3
+ const rowLeafs = useEvent((id) => {
4
+ const node = tree.rowIdToNode.get(id);
5
+ if (!node || !node.row.expandable)
6
+ return [];
7
+ const rows = [];
8
+ const stack = [...node.children.values()];
9
+ while (stack.length) {
10
+ const next = stack.pop();
11
+ if (!next.row.expandable)
12
+ rows.push(next.row.id);
13
+ else {
14
+ stack.push(...next.children.values());
15
+ }
16
+ }
17
+ return rows;
18
+ });
19
+ return rowLeafs;
20
+ }
@@ -0,0 +1,2 @@
1
+ import type { TreeRoot } from "../types.js";
2
+ export declare function useRowParents(tree: TreeRoot): (id: string) => string[];
@@ -0,0 +1,16 @@
1
+ import { useEvent } from "@1771technologies/lytenyte-core/internal";
2
+ export function useRowParents(tree) {
3
+ const rowParents = useEvent((id) => {
4
+ const node = tree.rowIdToNode.get(id);
5
+ if (!node)
6
+ return [];
7
+ const parents = [];
8
+ let current = node.parent;
9
+ while (current && current.kind !== "root") {
10
+ parents.push(current.row.id);
11
+ current = current.parent;
12
+ }
13
+ return parents.reverse();
14
+ });
15
+ return rowParents;
16
+ }
@@ -0,0 +1,2 @@
1
+ import type { TreeRoot } from "../types";
2
+ export declare function useRowSiblings(tree: TreeRoot): (id: string) => string[];
@@ -0,0 +1,12 @@
1
+ import { useEvent } from "@1771technologies/lytenyte-core/internal";
2
+ export function useRowSiblings(tree) {
3
+ const rowChildren = useEvent((id) => {
4
+ const node = tree.rowIdToNode.get(id);
5
+ const parent = node?.parent;
6
+ if (!parent)
7
+ return [];
8
+ const ids = [...parent.children.values()].map((x) => x.row.id);
9
+ return ids;
10
+ });
11
+ return rowChildren;
12
+ }
@@ -0,0 +1,3 @@
1
+ import type { TreeRoot } from "../types";
2
+ import type { UseTreeDataSourceParams } from "../use-tree-data-source";
3
+ export declare function useTree<T>({ data, filter, idFn, rowValueFn, rowChildrenFn, rowRootFn, }: UseTreeDataSourceParams<T>): TreeRoot;
@@ -0,0 +1,59 @@
1
+ import { useMemo } from "react";
2
+ import { isObject } from "../utils/is-object.js";
3
+ const defaultIdFn = (path) => path.join("-->");
4
+ const rowValueFnDefault = (x) => {
5
+ if (!isObject(x))
6
+ return null;
7
+ const entries = Object.entries(x).filter((v) => !isObject(v[1]));
8
+ return Object.fromEntries(entries);
9
+ };
10
+ const rowChildrenFnDefault = (x) => {
11
+ if (!isObject(x))
12
+ return [];
13
+ return Object.entries(x).filter((x) => isObject(x[1]));
14
+ };
15
+ export function useTree({ data, filter, idFn = defaultIdFn, rowValueFn = rowValueFnDefault, rowChildrenFn = rowChildrenFnDefault, rowRootFn = Object.entries, }) {
16
+ const rowTree = useMemo(() => {
17
+ const root = {
18
+ kind: "root",
19
+ children: new Map(),
20
+ rowIdToNode: new Map(),
21
+ data,
22
+ };
23
+ const groupKeys = (parent, path, row, parentObj) => {
24
+ const value = rowValueFn(row, parentObj, path.at(-1));
25
+ const entries = rowChildrenFn(row, parentObj, path.at(-1));
26
+ if (filter && !filter(value))
27
+ return;
28
+ const expandable = entries.some((x) => isObject(x[1]));
29
+ const node = {
30
+ kind: "parent",
31
+ children: new Map(),
32
+ parent,
33
+ path,
34
+ data: row,
35
+ key: path.at(-1),
36
+ row: {
37
+ kind: "branch",
38
+ depth: path.length - 1,
39
+ expandable,
40
+ expanded: false,
41
+ key: path.at(-1),
42
+ last: !expandable,
43
+ id: idFn(path, value),
44
+ data: value,
45
+ parentId: parent.kind === "root" ? null : parent.row.id,
46
+ },
47
+ };
48
+ parent.children.set(path.at(-1), node);
49
+ root.rowIdToNode.set(node.row.id, node);
50
+ entries.forEach((x) => groupKeys(node, [...path, x[0]], x[1], row));
51
+ };
52
+ const rootRows = rowRootFn(data);
53
+ for (const [path, row] of rootRows) {
54
+ groupKeys(root, [path], row, data);
55
+ }
56
+ return root;
57
+ }, [data, filter, idFn, rowChildrenFn, rowRootFn, rowValueFn]);
58
+ return rowTree;
59
+ }
@@ -0,0 +1,16 @@
1
+ import type { RowGroup } from "@1771technologies/lytenyte-shared";
2
+ export type TreeRoot = {
3
+ readonly kind: "root";
4
+ readonly children: Map<string, TreeParent>;
5
+ readonly rowIdToNode: Map<string, TreeParent>;
6
+ readonly data: object;
7
+ };
8
+ export type TreeParent = {
9
+ readonly kind: "parent";
10
+ readonly row: RowGroup;
11
+ readonly children: Map<string, TreeParent>;
12
+ readonly path: string[];
13
+ readonly parent: TreeParent | TreeRoot;
14
+ readonly data: object;
15
+ readonly key: string;
16
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ import type { DimensionSort, RowAggregated, RowLeaf, RowNode, RowSelectionState, RowSource, SortFn } from "@1771technologies/lytenyte-shared";
2
+ export interface UseTreeDataSourceParams<T = unknown> {
3
+ readonly topData?: (RowLeaf<T> | RowAggregated)[];
4
+ readonly botData?: (RowLeaf<T> | RowAggregated)[];
5
+ readonly data: Record<string, unknown>;
6
+ readonly idFn?: (path: string[], data: any) => string;
7
+ readonly rowRootFn?: (x: object) => [key: string, child: object][];
8
+ readonly rowValueFn?: (x: any, parent: any, key: string) => any;
9
+ readonly rowChildrenFn?: (x: any, parent: any, key: string) => [key: string, child: object][];
10
+ readonly rowGroupExpansions?: {
11
+ [rowId: string]: boolean | undefined;
12
+ };
13
+ readonly rowGroupDefaultExpansion?: boolean | number;
14
+ readonly onRowGroupExpansionChange?: (state: Record<string, boolean | undefined>) => void;
15
+ readonly sort?: SortFn<any> | DimensionSort<any>[] | null;
16
+ readonly filter?: ((data: any) => boolean) | null;
17
+ readonly rowsIsolatedSelection?: boolean;
18
+ readonly rowSelectKey?: unknown[];
19
+ readonly rowSelection?: RowSelectionState;
20
+ readonly rowSelectionIdUniverseAdditions?: {
21
+ readonly id: string;
22
+ root: boolean;
23
+ }[];
24
+ readonly rowSelectionIdUniverseSubtractions?: Set<string>;
25
+ readonly onRowSelectionChange?: (state: RowSelectionState) => void;
26
+ readonly onRowDataChange?: (params: {
27
+ readonly changes: {
28
+ next: any;
29
+ prev: any;
30
+ parent: any;
31
+ key: string;
32
+ path: string[];
33
+ }[];
34
+ readonly top: Map<number, T>;
35
+ readonly bottom: Map<number, T>;
36
+ }) => void;
37
+ }
38
+ export interface RowSourceTree<T> extends RowSource<T> {
39
+ readonly rowUpdate: (rows: Map<RowNode<T>, T>) => void;
40
+ }
41
+ export declare function useTreeDataSource<T>(p: UseTreeDataSourceParams<T>): RowSource;