@akohn/dashql-react 0.0.0-stage → 0.0.20-dev.1001.g5e5121808

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 (356) hide show
  1. package/LICENSE +373 -0
  2. package/NOTICE +118 -0
  3. package/README.md +133 -2
  4. package/dist/_virtual/_vite/preload-helper.js +100 -0
  5. package/dist/brand/brand.d.ts +13 -0
  6. package/dist/brand/brand.js +14 -0
  7. package/dist/brand/landing_backdrop.d.ts +56 -0
  8. package/dist/brand/landing_backdrop.js +1019 -0
  9. package/dist/brand/wobble_morph.d.ts +54 -0
  10. package/dist/brand/wobble_morph.js +439 -0
  11. package/dist/components/action_list.d.ts +31 -0
  12. package/dist/components/action_list.js +63 -0
  13. package/dist/components/action_list.module.js +11 -0
  14. package/dist/components/anchored_overlay.d.ts +28 -0
  15. package/dist/components/anchored_overlay.js +93 -0
  16. package/dist/components/button.d.ts +42 -0
  17. package/dist/components/button.js +97 -0
  18. package/dist/components/button.module.js +20 -0
  19. package/dist/components/button_group.d.ts +7 -0
  20. package/dist/components/button_group.js +18 -0
  21. package/dist/components/button_group.module.js +3 -0
  22. package/dist/components/card_placeholder.d.ts +9 -0
  23. package/dist/components/card_placeholder.js +39 -0
  24. package/dist/components/card_placeholder.module.js +6 -0
  25. package/dist/components/clipboard.d.ts +19 -0
  26. package/dist/components/clipboard.js +54 -0
  27. package/dist/components/data_table/computation_tables.d.ts +12 -0
  28. package/dist/components/data_table/computation_tables.js +42 -0
  29. package/dist/components/data_table/data_table.d.ts +39 -0
  30. package/dist/components/data_table/data_table.js +415 -0
  31. package/dist/components/data_table/data_table.module.js +41 -0
  32. package/dist/components/data_table/data_table_cell.d.ts +7 -0
  33. package/dist/components/data_table/data_table_cell.js +9 -0
  34. package/dist/components/data_table/data_table_cell_data.d.ts +22 -0
  35. package/dist/components/data_table/data_table_cell_data.js +103 -0
  36. package/dist/components/data_table/data_table_cell_header_name.d.ts +17 -0
  37. package/dist/components/data_table/data_table_cell_header_name.js +73 -0
  38. package/dist/components/data_table/data_table_cell_header_plots.d.ts +29 -0
  39. package/dist/components/data_table/data_table_cell_header_plots.js +120 -0
  40. package/dist/components/data_table/data_table_colors.d.ts +19 -0
  41. package/dist/components/data_table/data_table_colors.js +27 -0
  42. package/dist/components/data_table/data_table_column_resize.d.ts +21 -0
  43. package/dist/components/data_table/data_table_column_resize.js +121 -0
  44. package/dist/components/data_table/data_table_focus.d.ts +15 -0
  45. package/dist/components/data_table/data_table_focus.js +53 -0
  46. package/dist/components/data_table/data_table_layout.d.ts +18 -0
  47. package/dist/components/data_table/data_table_layout.js +103 -0
  48. package/dist/components/data_table/data_table_ordering.d.ts +9 -0
  49. package/dist/components/data_table/data_table_ordering.js +39 -0
  50. package/dist/components/data_table/data_table_portals.d.ts +9 -0
  51. package/dist/components/data_table/data_table_portals.js +29 -0
  52. package/dist/components/data_table/data_table_row_detail.d.ts +22 -0
  53. package/dist/components/data_table/data_table_row_detail.js +68 -0
  54. package/dist/components/data_table/data_table_row_detail.module.js +7 -0
  55. package/dist/components/data_table/data_table_sticky_views.d.ts +35 -0
  56. package/dist/components/data_table/data_table_sticky_views.js +161 -0
  57. package/dist/components/data_table/data_table_window.d.ts +18 -0
  58. package/dist/components/data_table/data_table_window.js +118 -0
  59. package/dist/components/data_table/format_peek.d.ts +2 -0
  60. package/dist/components/data_table/format_peek.js +17 -0
  61. package/dist/components/data_table/histogram_bars.d.ts +36 -0
  62. package/dist/components/data_table/histogram_bars.js +100 -0
  63. package/dist/components/data_table/histogram_brush.d.ts +22 -0
  64. package/dist/components/data_table/histogram_brush.js +105 -0
  65. package/dist/components/data_table/histogram_cell.d.ts +17 -0
  66. package/dist/components/data_table/histogram_cell.js +324 -0
  67. package/dist/components/data_table/histogram_cell.module.js +9 -0
  68. package/dist/components/data_table/histogram_label.d.ts +1 -0
  69. package/dist/components/data_table/histogram_label.js +7 -0
  70. package/dist/components/data_table/memo_props.d.ts +1 -0
  71. package/dist/components/data_table/memo_props.js +17 -0
  72. package/dist/components/data_table/mostfrequent_cell.d.ts +17 -0
  73. package/dist/components/data_table/mostfrequent_cell.js +316 -0
  74. package/dist/components/data_table/mostfrequent_cell.module.js +10 -0
  75. package/dist/components/data_table/use_cross_filters.d.ts +14 -0
  76. package/dist/components/data_table/use_cross_filters.js +47 -0
  77. package/dist/components/deferred.d.ts +11 -0
  78. package/dist/components/deferred.js +41 -0
  79. package/dist/components/deferred.module.js +5 -0
  80. package/dist/components/error_boundary.d.ts +18 -0
  81. package/dist/components/error_boundary.js +15 -0
  82. package/dist/components/graph.module.js +15 -0
  83. package/dist/components/graph_port.d.ts +10 -0
  84. package/dist/components/graph_port.js +34 -0
  85. package/dist/components/inspector_overlay.d.ts +32 -0
  86. package/dist/components/inspector_overlay.js +72 -0
  87. package/dist/components/inspector_overlay.module.js +18 -0
  88. package/dist/components/json/json_arrow_symbol.d.ts +4 -0
  89. package/dist/components/json/json_arrow_symbol.js +25 -0
  90. package/dist/components/json/json_copy_button.d.ts +11 -0
  91. package/dist/components/json/json_copy_button.js +61 -0
  92. package/dist/components/json/json_ellipsis_symbol.d.ts +7 -0
  93. package/dist/components/json/json_ellipsis_symbol.js +11 -0
  94. package/dist/components/json/json_item_count.d.ts +5 -0
  95. package/dist/components/json/json_item_count.js +12 -0
  96. package/dist/components/json/json_key_name.d.ts +6 -0
  97. package/dist/components/json/json_key_name.js +40 -0
  98. package/dist/components/json/json_key_values.d.ts +12 -0
  99. package/dist/components/json/json_key_values.js +99 -0
  100. package/dist/components/json/json_literal.d.ts +8 -0
  101. package/dist/components/json/json_literal.js +140 -0
  102. package/dist/components/json/json_nested_close.d.ts +11 -0
  103. package/dist/components/json/json_nested_close.js +31 -0
  104. package/dist/components/json/json_nested_open.d.ts +18 -0
  105. package/dist/components/json/json_nested_open.js +150 -0
  106. package/dist/components/json/json_nested_state.d.ts +14 -0
  107. package/dist/components/json/json_nested_state.js +28 -0
  108. package/dist/components/json/json_tool_state.d.ts +18 -0
  109. package/dist/components/json/json_tool_state.js +46 -0
  110. package/dist/components/json/json_value.d.ts +10 -0
  111. package/dist/components/json/json_value.js +46 -0
  112. package/dist/components/json/json_view.d.ts +14 -0
  113. package/dist/components/json/json_view.js +37 -0
  114. package/dist/components/json/json_view.module.js +41 -0
  115. package/dist/components/json/json_view_state.d.ts +14 -0
  116. package/dist/components/json/json_view_state.js +32 -0
  117. package/dist/components/json/unique_key.d.ts +1 -0
  118. package/dist/components/json/unique_key.js +8 -0
  119. package/dist/components/keyvalue_list.d.ts +25 -0
  120. package/dist/components/keyvalue_list.js +106 -0
  121. package/dist/components/keyvalue_list.module.js +15 -0
  122. package/dist/components/name_input.d.ts +12 -0
  123. package/dist/components/name_input.js +63 -0
  124. package/dist/components/overlay.d.ts +53 -0
  125. package/dist/components/overlay.js +183 -0
  126. package/dist/components/overlay.module.js +32 -0
  127. package/dist/components/panel_resize_handle.d.ts +12 -0
  128. package/dist/components/panel_resize_handle.js +39 -0
  129. package/dist/components/portal.d.ts +8 -0
  130. package/dist/components/portal.js +53 -0
  131. package/dist/components/progress_bar.d.ts +7 -0
  132. package/dist/components/progress_bar.js +21 -0
  133. package/dist/components/progress_bar.module.js +3 -0
  134. package/dist/components/query_history_viewer.d.ts +31 -0
  135. package/dist/components/query_history_viewer.js +271 -0
  136. package/dist/components/query_history_viewer.module.js +7 -0
  137. package/dist/components/query_profile/engine_profile_view.d.ts +19 -0
  138. package/dist/components/query_profile/engine_profile_view.js +94 -0
  139. package/dist/components/query_profile/numeric_limits.d.ts +1 -0
  140. package/dist/components/query_profile/numeric_limits.js +2 -0
  141. package/dist/components/query_profile/profile_execution_controller.d.ts +12 -0
  142. package/dist/components/query_profile/profile_execution_controller.js +44 -0
  143. package/dist/components/query_profile/profile_fit.d.ts +24 -0
  144. package/dist/components/query_profile/profile_fit.js +22 -0
  145. package/dist/components/query_profile/profile_navigation.d.ts +3 -0
  146. package/dist/components/query_profile/profile_navigation.js +34 -0
  147. package/dist/components/query_profile/profile_scene.d.ts +64 -0
  148. package/dist/components/query_profile/profile_scene.js +422 -0
  149. package/dist/components/query_profile/query_profile_view.d.ts +36 -0
  150. package/dist/components/query_profile/query_profile_view.js +953 -0
  151. package/dist/components/query_profile/query_profile_view.module.js +23 -0
  152. package/dist/components/query_progress/query_profile_overlay.d.ts +7 -0
  153. package/dist/components/query_progress/query_profile_overlay.js +67 -0
  154. package/dist/components/query_progress/query_profile_overlay.module.js +6 -0
  155. package/dist/components/query_progress/query_progress_panel.d.ts +14 -0
  156. package/dist/components/query_progress/query_progress_panel.js +255 -0
  157. package/dist/components/query_progress/query_progress_panel.module.js +10 -0
  158. package/dist/components/query_result/cell_detail_overlay.d.ts +34 -0
  159. package/dist/components/query_result/cell_detail_overlay.js +277 -0
  160. package/dist/components/query_result/cell_detail_overlay.module.js +21 -0
  161. package/dist/components/query_result/query_result_action_menu.d.ts +12 -0
  162. package/dist/components/query_result/query_result_action_menu.js +62 -0
  163. package/dist/components/query_result/query_result_action_menu.module.js +2 -0
  164. package/dist/components/query_result/query_result_details.d.ts +17 -0
  165. package/dist/components/query_result/query_result_details.js +46 -0
  166. package/dist/components/query_result/query_result_details.module.js +5 -0
  167. package/dist/components/query_result/query_result_download_button.d.ts +8 -0
  168. package/dist/components/query_result/query_result_download_button.js +38 -0
  169. package/dist/components/query_result/query_result_header.d.ts +21 -0
  170. package/dist/components/query_result/query_result_header.js +72 -0
  171. package/dist/components/query_result/query_result_header.module.js +3 -0
  172. package/dist/components/query_result/query_result_search_controls.d.ts +12 -0
  173. package/dist/components/query_result/query_result_search_controls.js +141 -0
  174. package/dist/components/query_result/query_result_search_controls.module.js +7 -0
  175. package/dist/components/query_result/query_result_toolbar.d.ts +21 -0
  176. package/dist/components/query_result/query_result_toolbar.js +74 -0
  177. package/dist/components/query_result/result_table_overlay.d.ts +9 -0
  178. package/dist/components/query_result/result_table_overlay.js +73 -0
  179. package/dist/components/query_result/result_table_overlay.module.js +6 -0
  180. package/dist/components/query_result/use_query_result_search.d.ts +8 -0
  181. package/dist/components/query_result/use_query_result_search.js +28 -0
  182. package/dist/components/segmented_control.d.ts +58 -0
  183. package/dist/components/segmented_control.js +116 -0
  184. package/dist/components/segmented_control.module.js +17 -0
  185. package/dist/components/separator.d.ts +21 -0
  186. package/dist/components/separator.js +79 -0
  187. package/dist/components/separator.module.js +7 -0
  188. package/dist/components/sheet.d.ts +11 -0
  189. package/dist/components/sheet.js +65 -0
  190. package/dist/components/sheet.module.js +7 -0
  191. package/dist/components/size_observer.d.ts +7 -0
  192. package/dist/components/size_observer.js +57 -0
  193. package/dist/components/skeleton.d.ts +2 -0
  194. package/dist/components/skeleton.js +14 -0
  195. package/dist/components/skeleton.module.js +2 -0
  196. package/dist/components/spinners.d.ts +8 -0
  197. package/dist/components/spinners.js +33 -0
  198. package/dist/components/spinners.module.js +8 -0
  199. package/dist/components/status_indicator.d.ts +36 -0
  200. package/dist/components/status_indicator.js +182 -0
  201. package/dist/components/status_indicator.module.js +3 -0
  202. package/dist/components/symbol_icon.d.ts +65 -0
  203. package/dist/components/symbol_icon.js +213 -0
  204. package/dist/components/tab_header.d.ts +11 -0
  205. package/dist/components/tab_header.js +55 -0
  206. package/dist/components/tab_header.module.js +7 -0
  207. package/dist/components/tag.d.ts +10 -0
  208. package/dist/components/tag.js +17 -0
  209. package/dist/components/tag.module.js +4 -0
  210. package/dist/components/text_field.d.ts +44 -0
  211. package/dist/components/text_field.js +159 -0
  212. package/dist/components/text_field.module.js +15 -0
  213. package/dist/components/text_input.d.ts +25 -0
  214. package/dist/components/text_input.js +90 -0
  215. package/dist/components/text_input.module.js +13 -0
  216. package/dist/components/text_input_action.d.ts +19 -0
  217. package/dist/components/text_input_action.js +33 -0
  218. package/dist/components/text_input_action.module.js +2 -0
  219. package/dist/components/toggle_switch.d.ts +7 -0
  220. package/dist/components/toggle_switch.js +22 -0
  221. package/dist/components/toggle_switch.module.js +6 -0
  222. package/dist/components/tooltip.d.ts +22 -0
  223. package/dist/components/tooltip.js +139 -0
  224. package/dist/components/tooltip.module.js +2 -0
  225. package/dist/components/tree_entry.d.ts +17 -0
  226. package/dist/components/tree_entry.js +48 -0
  227. package/dist/components/tree_entry.module.js +9 -0
  228. package/dist/components/value_list.d.ts +17 -0
  229. package/dist/components/value_list.js +70 -0
  230. package/dist/components/value_list.module.js +8 -0
  231. package/dist/components/vegalite_chart.d.ts +16 -0
  232. package/dist/components/vegalite_chart.js +149 -0
  233. package/dist/components/vegalite_chart.module.js +3 -0
  234. package/dist/components/vegalite_view.d.ts +26 -0
  235. package/dist/components/vegalite_view.js +239 -0
  236. package/dist/components/vegalite_view.module.js +5 -0
  237. package/dist/components/vertical_scroll_shadows.d.ts +14 -0
  238. package/dist/components/vertical_scroll_shadows.js +55 -0
  239. package/dist/components/vertical_scroll_shadows.module.js +5 -0
  240. package/dist/components/vertical_split.d.ts +15 -0
  241. package/dist/components/vertical_split.js +112 -0
  242. package/dist/components/vertical_split.module.js +5 -0
  243. package/dist/components/vertical_tabs.d.ts +36 -0
  244. package/dist/components/vertical_tabs.js +169 -0
  245. package/dist/components/vertical_tabs.module.js +23 -0
  246. package/dist/components/visualization/capped_rows.d.ts +9 -0
  247. package/dist/components/visualization/capped_rows.js +23 -0
  248. package/dist/components/visualization/capped_rows.module.js +3 -0
  249. package/dist/components/visualization/chart_download_button.d.ts +12 -0
  250. package/dist/components/visualization/chart_download_button.js +41 -0
  251. package/dist/components/visualization/kpi_view.d.ts +10 -0
  252. package/dist/components/visualization/kpi_view.js +215 -0
  253. package/dist/components/visualization/kpi_view.module.js +17 -0
  254. package/dist/components/visualization/markdown_view.d.ts +17 -0
  255. package/dist/components/visualization/markdown_view.js +154 -0
  256. package/dist/components/visualization/markdown_view.module.js +4 -0
  257. package/dist/components/visualization/result_rows.d.ts +17 -0
  258. package/dist/components/visualization/result_rows.js +82 -0
  259. package/dist/components/visualization/vegalite_preview.d.ts +8 -0
  260. package/dist/components/visualization/vegalite_preview.js +17 -0
  261. package/dist/components/visualization/vegalite_preview.module.js +2 -0
  262. package/dist/components/visualization/visualization_dispatch.d.ts +13 -0
  263. package/dist/components/visualization/visualization_dispatch.js +40 -0
  264. package/dist/components/visualization/visualization_panel.d.ts +10 -0
  265. package/dist/components/visualization/visualization_panel.js +36 -0
  266. package/dist/components/visualization/visualization_panel.module.js +3 -0
  267. package/dist/dom/anchored_position.d.ts +42 -0
  268. package/dist/dom/anchored_position.js +255 -0
  269. package/dist/dom/app_host.d.ts +2 -0
  270. package/dist/dom/app_host.js +7 -0
  271. package/dist/dom/calm_frames.d.ts +29 -0
  272. package/dist/dom/calm_frames.js +120 -0
  273. package/dist/dom/classnames.d.ts +8 -0
  274. package/dist/dom/classnames.js +20 -0
  275. package/dist/dom/download_file.d.ts +1 -0
  276. package/dist/dom/download_file.js +12 -0
  277. package/dist/dom/focus.d.ts +29 -0
  278. package/dist/dom/focus.js +84 -0
  279. package/dist/dom/graph_edges.d.ts +53 -0
  280. package/dist/dom/graph_edges.js +450 -0
  281. package/dist/dom/key_events.d.ts +9 -0
  282. package/dist/dom/key_events.js +33 -0
  283. package/dist/dom/media_query.d.ts +5 -0
  284. package/dist/dom/media_query.js +18 -0
  285. package/dist/dom/outside_click.d.ts +8 -0
  286. package/dist/dom/outside_click.js +32 -0
  287. package/dist/dom/rerender_ref.d.ts +2 -0
  288. package/dist/dom/rerender_ref.js +11 -0
  289. package/dist/dom/row_context_menu.d.ts +7 -0
  290. package/dist/dom/row_context_menu.js +32 -0
  291. package/dist/dom/scrollbar.d.ts +3 -0
  292. package/dist/dom/scrollbar.js +23 -0
  293. package/dist/format/format.d.ts +11 -0
  294. package/dist/format/format.js +72 -0
  295. package/dist/format/query_progress_format.d.ts +17 -0
  296. package/dist/format/query_progress_format.js +69 -0
  297. package/dist/format/time_format.d.ts +5 -0
  298. package/dist/format/time_format.js +45 -0
  299. package/dist/hooks.d.ts +72 -0
  300. package/dist/hooks.js +305 -0
  301. package/dist/host.d.ts +10 -0
  302. package/dist/host.js +12 -0
  303. package/dist/logger.d.ts +4 -0
  304. package/dist/logger.js +13 -0
  305. package/dist/models/computation_model.d.ts +14 -0
  306. package/dist/models/computation_model.js +27 -0
  307. package/dist/models/query_model.d.ts +12 -0
  308. package/dist/models/query_model.js +27 -0
  309. package/dist/models/script_model.d.ts +17 -0
  310. package/dist/models/script_model.js +59 -0
  311. package/dist/platform/content_length.d.ts +1 -0
  312. package/dist/platform/content_length.js +7 -0
  313. package/dist/platform/core_provider.d.ts +18 -0
  314. package/dist/platform/core_provider.js +106 -0
  315. package/dist/platform/embedded_database_provider.d.ts +19 -0
  316. package/dist/platform/embedded_database_provider.js +53 -0
  317. package/dist/platform/page_runtime.d.ts +3 -0
  318. package/dist/platform/page_runtime.js +29 -0
  319. package/dist/style.css +4386 -0
  320. package/dist/svg_symbols.d.ts +2 -0
  321. package/dist/svg_symbols.js +2 -0
  322. package/dist/symbols.svg +1197 -0
  323. package/dist/theme/color_scheme.d.ts +4 -0
  324. package/dist/theme/color_scheme.js +28 -0
  325. package/dist/theme/xcode_palette.d.ts +22 -0
  326. package/dist/theme/xcode_palette.js +4 -0
  327. package/dist/theme/xcode_palettes.js +41 -0
  328. package/dist/utils/plan_engine.d.ts +2 -0
  329. package/dist/utils/plan_engine.js +13 -0
  330. package/dist/vegalite/vegalite_check.d.ts +1 -0
  331. package/dist/vegalite/vegalite_check.js +7 -0
  332. package/dist/vegalite/vegalite_crossfilter.d.ts +54 -0
  333. package/dist/vegalite/vegalite_crossfilter.js +187 -0
  334. package/dist/vegalite/vegalite_image.d.ts +14 -0
  335. package/dist/vegalite/vegalite_image.js +28 -0
  336. package/dist/vegalite/vegalite_loader.d.ts +7 -0
  337. package/dist/vegalite/vegalite_loader.js +15 -0
  338. package/dist/vegalite/vegalite_rows.d.ts +3 -0
  339. package/dist/vegalite/vegalite_rows.js +23 -0
  340. package/dist/vegalite/vegalite_theme.d.ts +13 -0
  341. package/dist/vegalite/vegalite_theme.js +141 -0
  342. package/fonts/InstrumentSans-Bold.ttf +0 -0
  343. package/fonts/InstrumentSans-Medium.ttf +0 -0
  344. package/fonts/InstrumentSans-OFL.txt +93 -0
  345. package/fonts/InstrumentSans-Regular.ttf +0 -0
  346. package/fonts/InstrumentSans-SemiBold.ttf +0 -0
  347. package/fonts/JetBrainsMono-Bold.ttf +0 -0
  348. package/fonts/JetBrainsMono-Medium.ttf +0 -0
  349. package/fonts/JetBrainsMono-OFL.txt +93 -0
  350. package/fonts/JetBrainsMono-Regular.ttf +0 -0
  351. package/fonts/JetBrainsMono-SemiBold.ttf +0 -0
  352. package/fonts/fonts.css +61 -0
  353. package/package.json +403 -4
  354. package/styles/colors.css +110 -0
  355. package/styles/flavors/dbcom.css +48 -0
  356. package/styles/tokens.css +192 -0
@@ -0,0 +1,105 @@
1
+ import * as React from "react";
2
+ import * as d3 from "d3";
3
+ var BRUSH_SETTLE_DELAY_MS = 120;
4
+ function hideBrushSelection(container) {
5
+ d3.select(container).selectAll(".selection, .handle").style("display", "none").attr("x", 0).attr("y", 0).attr("width", 0).attr("height", 0);
6
+ }
7
+ var SettledBrushUpdates = class {
8
+ timeout = null;
9
+ pending = null;
10
+ schedule(event, callback) {
11
+ this.pending = event;
12
+ if (this.timeout != null) window.clearTimeout(this.timeout);
13
+ this.timeout = window.setTimeout(() => {
14
+ this.timeout = null;
15
+ const pending = this.pending;
16
+ this.pending = null;
17
+ if (pending != null) callback(pending);
18
+ }, 120);
19
+ }
20
+ flush(event, callback) {
21
+ this.cancel();
22
+ callback(event);
23
+ }
24
+ cancel() {
25
+ if (this.timeout != null) {
26
+ window.clearTimeout(this.timeout);
27
+ this.timeout = null;
28
+ }
29
+ this.pending = null;
30
+ }
31
+ };
32
+ function useHistogramBrush(options) {
33
+ const brushContainer = React.useRef(null);
34
+ const brushBehavior = React.useRef(null);
35
+ const syncingSelection = React.useRef(false);
36
+ const settledBrushUpdates = React.useRef(new SettledBrushUpdates());
37
+ const { xScale, height, selection, onBrushUpdate, onClear } = options;
38
+ const onBrushUpdateRef = React.useRef(onBrushUpdate);
39
+ onBrushUpdateRef.current = onBrushUpdate;
40
+ const selectionRef = React.useRef(selection);
41
+ selectionRef.current = selection;
42
+ const onBrushStart = React.useCallback(() => {
43
+ if (syncingSelection.current) return;
44
+ settledBrushUpdates.current.cancel();
45
+ }, []);
46
+ const onBrushMove = React.useCallback((event) => {
47
+ if (syncingSelection.current) return;
48
+ settledBrushUpdates.current.schedule(event, (pending) => onBrushUpdateRef.current(pending));
49
+ }, []);
50
+ const onBrushEnd = React.useCallback((event) => {
51
+ if (syncingSelection.current) return;
52
+ settledBrushUpdates.current.flush(event, onBrushUpdate);
53
+ }, [onBrushUpdate]);
54
+ const onBrushStartRef = React.useRef(onBrushStart);
55
+ const onBrushMoveRef = React.useRef(onBrushMove);
56
+ const onBrushEndRef = React.useRef(onBrushEnd);
57
+ onBrushStartRef.current = onBrushStart;
58
+ onBrushMoveRef.current = onBrushMove;
59
+ onBrushEndRef.current = onBrushEnd;
60
+ React.useEffect(() => () => settledBrushUpdates.current.cancel(), []);
61
+ React.useLayoutEffect(() => {
62
+ const brush = d3.brushX().extent([[xScale.range()[0], 0], [xScale.range()[1], height]]).on("start", () => onBrushStartRef.current()).on("brush", (event) => onBrushMoveRef.current(event)).on("end", (event) => onBrushEndRef.current(event));
63
+ brushBehavior.current = brush;
64
+ d3.select(brushContainer.current).selectChildren().remove();
65
+ d3.select(brushContainer.current).call(brush).selectAll("rect").attr("y", 0).attr("height", height);
66
+ if (selectionRef.current == null) hideBrushSelection(brushContainer.current);
67
+ return () => {
68
+ brushBehavior.current = null;
69
+ };
70
+ }, [xScale, height]);
71
+ React.useLayoutEffect(() => {
72
+ const container = brushContainer.current;
73
+ const brush = brushBehavior.current;
74
+ if (container == null || brush == null) return;
75
+ const current = d3.brushSelection(container);
76
+ const next = selection;
77
+ if (current == null ? next == null : next != null && current[0] === next[0] && current[1] === next[1]) return;
78
+ settledBrushUpdates.current.cancel();
79
+ syncingSelection.current = true;
80
+ try {
81
+ d3.select(container).call(brush.move, next);
82
+ if (next == null) hideBrushSelection(container);
83
+ } finally {
84
+ syncingSelection.current = false;
85
+ }
86
+ }, [
87
+ selection,
88
+ xScale,
89
+ height
90
+ ]);
91
+ return {
92
+ brushContainer,
93
+ clearBrush: React.useCallback(() => {
94
+ const container = brushContainer.current;
95
+ const brush = brushBehavior.current;
96
+ if (container != null && brush != null) {
97
+ d3.select(container).call(brush.move, null);
98
+ hideBrushSelection(container);
99
+ return;
100
+ }
101
+ onClear();
102
+ }, [onClear])
103
+ };
104
+ }
105
+ export { BRUSH_SETTLE_DELAY_MS, SettledBrushUpdates, useHistogramBrush };
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { ColumnAggregationVariant, OrdinalColumnAggregation, TableAggregation, WithFilterEpoch } from '@akohn/dashql/platform/compute/computation_types';
3
+ export { NULL_SYMBOL } from './histogram_bars.js';
4
+ export { SettledBrushUpdates } from './histogram_brush.js';
5
+ export type HistogramFilterCallback = (table: TableAggregation, columnId: number, column: OrdinalColumnAggregation, filter: [number, number] | null) => void;
6
+ interface HistogramCellProps {
7
+ className?: string;
8
+ style?: React.CSSProperties;
9
+ tableAggregation: TableAggregation;
10
+ columnIndex: number;
11
+ columnAggregate: OrdinalColumnAggregation;
12
+ filteredColumnAggregation: WithFilterEpoch<ColumnAggregationVariant> | null;
13
+ selection: [number, number] | null;
14
+ onFilter: HistogramFilterCallback;
15
+ }
16
+ declare function HistogramCellImpl(props: HistogramCellProps): React.ReactElement;
17
+ export declare const HistogramCell: React.MemoExoticComponent<typeof HistogramCellImpl>;
@@ -0,0 +1,324 @@
1
+ import { axis_label_left, axis_label_right, axis_labels_container, header_container, plot_container, plot_svg, root } from "./histogram_cell.module.js";
2
+ import { useObservedSize } from "../size_observer.js";
3
+ import { COLUMN_SUMMARY_BASELINE_COLOR, getFilteredBarColor, getTotalBarColor } from "./data_table_colors.js";
4
+ import { HistogramBars, HistogramNullBar, NULL_SYMBOL } from "./histogram_bars.js";
5
+ import { SettledBrushUpdates, useHistogramBrush } from "./histogram_brush.js";
6
+ import { formatHistogramFocusDescription } from "./histogram_label.js";
7
+ import { arePropsEqualWithStyle } from "./memo_props.js";
8
+ import * as React from "react";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { ORDINAL_COLUMN } from "@akohn/dashql/platform/compute/computation_types";
11
+ import { dataTypeToString } from "@akohn/dashql/platform/compute/arrow_formatter";
12
+ import * as d3 from "d3";
13
+ function HistogramCellImpl(props) {
14
+ const inputNullable = props.columnAggregate.columnEntry.inputFieldNullable;
15
+ const countNull = props.columnAggregate.columnAnalysis.countNull;
16
+ const binCounts = props.columnAggregate.columnAnalysis.binValueCounts;
17
+ const binCount = props.columnAggregate.columnAnalysis.binCount;
18
+ const svgContainer = React.useRef(null);
19
+ const svgContainerSize = useObservedSize(svgContainer);
20
+ const margin = {
21
+ top: 8,
22
+ right: 8,
23
+ bottom: 20,
24
+ left: 8
25
+ }, width = (svgContainerSize?.width ?? 130) - margin.left - margin.right, height = (svgContainerSize?.height ?? 50) - margin.top - margin.bottom;
26
+ let histWidth = width;
27
+ const nullsWidth = 12;
28
+ const nullsMargin = 2;
29
+ if (inputNullable) histWidth -= 14;
30
+ const [histXScale, histYScale, nullsXScale, nullsYScale, nullsXWidth] = React.useMemo(() => {
31
+ const xValues = [];
32
+ for (let i = 0; i < binCount; ++i) xValues.push(i.toString());
33
+ const yMin = BigInt(0);
34
+ let yMax = BigInt(countNull ?? 0);
35
+ for (let i = 0; i < binCounts.length; ++i) yMax = binCounts[i] > yMax ? binCounts[i] : yMax;
36
+ const yDomain = [Number(yMin), Number(yMax)];
37
+ const histXScale = d3.scaleBand().range([0, histWidth]).domain(xValues).padding(.1);
38
+ const histYScale = d3.scaleLinear().range([height, 0]).domain(yDomain);
39
+ const nullsXWidth = histXScale.bandwidth() + 2 * histXScale.paddingOuter();
40
+ return [
41
+ histXScale,
42
+ histYScale,
43
+ d3.scaleBand().range([0, nullsXWidth]).domain(["∅"]).padding(.1),
44
+ d3.scaleLinear().range([height, 0]).domain(yDomain),
45
+ nullsXWidth
46
+ ];
47
+ }, [
48
+ histWidth,
49
+ height,
50
+ binCount,
51
+ binCounts,
52
+ countNull
53
+ ]);
54
+ const { onFilter, tableAggregation, columnIndex, columnAggregate } = props;
55
+ const onBrushUpdate = React.useCallback((e) => {
56
+ if (!onFilter) return;
57
+ if (e.selection == null) {
58
+ onFilter(tableAggregation, columnIndex, columnAggregate, null);
59
+ return;
60
+ }
61
+ const pixelSelection = e.selection;
62
+ if (pixelSelection[0] == pixelSelection[1]) {
63
+ onFilter(tableAggregation, columnIndex, columnAggregate, null);
64
+ return;
65
+ }
66
+ const step = histXScale.step();
67
+ const binOffset = histXScale.paddingOuter() * step;
68
+ const binSelection = [(pixelSelection[0] - binOffset) / step, (pixelSelection[1] - binOffset) / step];
69
+ onFilter(tableAggregation, columnIndex, columnAggregate, binSelection);
70
+ }, [
71
+ tableAggregation,
72
+ columnAggregate,
73
+ onFilter,
74
+ columnIndex,
75
+ histXScale
76
+ ]);
77
+ const clearFilter = React.useCallback(() => {
78
+ onFilter(tableAggregation, columnIndex, columnAggregate, null);
79
+ }, [
80
+ tableAggregation,
81
+ columnIndex,
82
+ columnAggregate,
83
+ onFilter
84
+ ]);
85
+ const brushSelection = React.useMemo(() => {
86
+ if (props.selection == null) return null;
87
+ const step = histXScale.step();
88
+ const binOffset = histXScale.paddingOuter() * step;
89
+ return [binOffset + props.selection[0] * step, binOffset + props.selection[1] * step];
90
+ }, [histXScale, props.selection]);
91
+ const { brushContainer, clearBrush } = useHistogramBrush({
92
+ xScale: histXScale,
93
+ height,
94
+ selection: brushSelection,
95
+ onBrushUpdate,
96
+ onClear: clearFilter
97
+ });
98
+ const nullsPadding = (nullsWidth - nullsXScale.bandwidth()) / 2;
99
+ const hasFilteredAggregate = props.filteredColumnAggregation != null && props.filteredColumnAggregation.type === ORDINAL_COLUMN;
100
+ const [filteredBinCounts, filteredNullCount, filteredRowCount] = React.useMemo(() => {
101
+ if (props.filteredColumnAggregation?.type !== ORDINAL_COLUMN) return [
102
+ null,
103
+ null,
104
+ null
105
+ ];
106
+ const filteredAgg = props.filteredColumnAggregation.value;
107
+ return [
108
+ filteredAgg.columnAnalysis.binValueCounts,
109
+ filteredAgg.columnAnalysis.countNull,
110
+ filteredAgg.columnAnalysis.totalCount
111
+ ];
112
+ }, [props.filteredColumnAggregation]);
113
+ const totalBarColor = getTotalBarColor(hasFilteredAggregate, false);
114
+ const totalBarFocusedColor = getTotalBarColor(hasFilteredAggregate, true);
115
+ const filteredBarColor = getFilteredBarColor(false);
116
+ const filteredBarFocusedColor = getFilteredBarColor(true);
117
+ const totalNullBarColor = getTotalBarColor(hasFilteredAggregate, false, true);
118
+ const totalNullBarFocusedColor = getTotalBarColor(hasFilteredAggregate, true, true);
119
+ const [focusedBin, setFocusedBin] = React.useState(null);
120
+ const [focusedNull, setFocusedNull] = React.useState(null);
121
+ let focusDescription = null;
122
+ if (focusedBin != null) focusDescription = formatHistogramFocusDescription(binCounts[focusedBin], props.columnAggregate.columnAnalysis.totalCount, filteredBinCounts?.[focusedBin] ?? null, filteredRowCount);
123
+ else if (focusedNull) focusDescription = formatHistogramFocusDescription(BigInt(countNull), props.columnAggregate.columnAnalysis.totalCount, filteredNullCount == null ? null : BigInt(filteredNullCount), filteredRowCount);
124
+ const onPointerOverBin = React.useCallback((elem) => {
125
+ const step = histXScale.step();
126
+ const binOffset = histXScale.paddingOuter() * step;
127
+ const [relativeX] = d3.pointer(elem.nativeEvent, elem.currentTarget);
128
+ const innerX = Math.max(relativeX, binOffset) - binOffset;
129
+ const bin = Math.min(Math.floor(innerX / step), binCount - 1);
130
+ setFocusedBin(bin);
131
+ }, [histXScale, binCount]);
132
+ const onPointerOutBin = React.useCallback((_elem) => {
133
+ setFocusedBin(null);
134
+ }, []);
135
+ const onPointerOverNull = React.useCallback((_elem) => {
136
+ setFocusedNull(true);
137
+ }, []);
138
+ const onPointerOutNull = React.useCallback((_elem) => {
139
+ setFocusedNull(false);
140
+ }, []);
141
+ const binLabels = props.columnAggregate.columnAnalysis.binLowerBounds;
142
+ const binLabelLeft = binLabels[0];
143
+ const binLabelRight = binLabels[binLabels.length - 1];
144
+ const binLabelFocused = focusedBin != null ? binLabels[focusedBin] : null;
145
+ const containerStyle = React.useMemo(() => ({
146
+ ...props.style,
147
+ zIndex: focusedBin != null ? 100 : props.style?.zIndex
148
+ }), [props.style, focusedBin]);
149
+ const axisLabelsStyle = React.useMemo(() => ({
150
+ position: "absolute",
151
+ top: `${margin.top + height + 2}px`,
152
+ left: `${margin.left}px`,
153
+ width: `${histWidth}px`
154
+ }), [
155
+ margin.top,
156
+ margin.left,
157
+ height,
158
+ histWidth
159
+ ]);
160
+ const focusedLabelStyle = React.useMemo(() => {
161
+ if (focusedBin == null) return null;
162
+ return {
163
+ position: "absolute",
164
+ top: `${margin.top + height + 13 - 12}px`,
165
+ left: `${margin.left + (histXScale(focusedBin.toString()) ?? 0) + histXScale.bandwidth() / 2}px`,
166
+ transform: "translateX(-50%)",
167
+ textWrap: "nowrap",
168
+ fontSize: "12px",
169
+ fontWeight: 400,
170
+ pointerEvents: "none",
171
+ color: "var(--color_fg_inverse)",
172
+ backgroundColor: "var(--color_bg_inverse)",
173
+ zIndex: 3,
174
+ padding: "0px 4px 0px 4px",
175
+ borderRadius: "3px"
176
+ };
177
+ }, [
178
+ focusedBin,
179
+ margin.top,
180
+ margin.left,
181
+ height,
182
+ histXScale
183
+ ]);
184
+ const nullLabelStyle = React.useMemo(() => ({
185
+ position: "absolute",
186
+ top: `${margin.top + height + 2}px`,
187
+ left: `${margin.left + histWidth + nullsMargin + nullsPadding + nullsXScale.bandwidth() / 2}px`,
188
+ transform: "translateX(-50%)",
189
+ fontSize: "12px",
190
+ fontWeight: 400,
191
+ pointerEvents: "none"
192
+ }), [
193
+ margin.top,
194
+ margin.left,
195
+ height,
196
+ histWidth,
197
+ nullsMargin,
198
+ nullsPadding,
199
+ nullsXScale
200
+ ]);
201
+ const focusedNullLabelStyle = React.useMemo(() => ({
202
+ top: `${margin.top + height + 13 - 12}px`,
203
+ left: `${margin.left + histWidth + nullsMargin + nullsPadding + nullsXScale.bandwidth() / 2}px`
204
+ }), [
205
+ margin.top,
206
+ margin.left,
207
+ height,
208
+ histWidth,
209
+ nullsMargin,
210
+ nullsPadding,
211
+ nullsXScale
212
+ ]);
213
+ return /* @__PURE__ */ jsx("div", {
214
+ className: props.className,
215
+ style: containerStyle,
216
+ onClick: clearBrush,
217
+ children: /* @__PURE__ */ jsxs("div", {
218
+ className: root,
219
+ children: [/* @__PURE__ */ jsx("div", {
220
+ className: header_container,
221
+ children: focusDescription ?? dataTypeToString(props.columnAggregate.columnEntry.inputFieldType)
222
+ }), /* @__PURE__ */ jsxs("div", {
223
+ className: plot_container,
224
+ ref: svgContainer,
225
+ children: [
226
+ /* @__PURE__ */ jsx("svg", {
227
+ className: plot_svg,
228
+ width: width + margin.left + margin.right,
229
+ height: height + margin.top + margin.bottom,
230
+ children: /* @__PURE__ */ jsxs("g", {
231
+ transform: `translate(${margin.left},${margin.top})`,
232
+ children: [
233
+ /* @__PURE__ */ jsx("g", {
234
+ "data-part": "bars",
235
+ children: /* @__PURE__ */ jsx(HistogramBars, {
236
+ binCounts,
237
+ filteredBinCounts,
238
+ focusedBin,
239
+ xScale: histXScale,
240
+ yScale: histYScale,
241
+ height,
242
+ totalBarColor,
243
+ totalBarFocusedColor,
244
+ filteredBarColor,
245
+ filteredBarFocusedColor
246
+ })
247
+ }),
248
+ /* @__PURE__ */ jsx("g", {
249
+ ref: brushContainer,
250
+ "data-part": "brush",
251
+ onPointerOver: onPointerOverBin,
252
+ onPointerMove: onPointerOverBin,
253
+ onPointerOut: onPointerOutBin,
254
+ onClick: (event) => event.stopPropagation()
255
+ }),
256
+ /* @__PURE__ */ jsxs("g", {
257
+ "data-part": "axis",
258
+ transform: `translate(0, ${height})`,
259
+ onPointerOver: onPointerOverBin,
260
+ onPointerMove: onPointerOverBin,
261
+ onPointerOut: onPointerOutBin,
262
+ children: [/* @__PURE__ */ jsx("line", {
263
+ x1: 0,
264
+ y1: 1,
265
+ x2: histWidth,
266
+ y2: 1,
267
+ style: { stroke: COLUMN_SUMMARY_BASELINE_COLOR }
268
+ }), /* @__PURE__ */ jsx("rect", {
269
+ x: 0,
270
+ y: 0,
271
+ width: histWidth,
272
+ height: margin.bottom - 1,
273
+ fillOpacity: 0
274
+ })]
275
+ }),
276
+ inputNullable && /* @__PURE__ */ jsx(HistogramNullBar, {
277
+ countNull: countNull ?? 0,
278
+ filteredNullCount,
279
+ focused: focusedNull,
280
+ xScale: nullsXScale,
281
+ yScale: nullsYScale,
282
+ xWidth: nullsXWidth,
283
+ height,
284
+ bottomMargin: margin.bottom,
285
+ transformX: histWidth + nullsMargin + nullsPadding,
286
+ totalBarColor: totalNullBarColor,
287
+ totalBarFocusedColor: totalNullBarFocusedColor,
288
+ filteredBarColor,
289
+ filteredBarFocusedColor,
290
+ onPointerOver: onPointerOverNull,
291
+ onPointerOut: onPointerOutNull
292
+ })
293
+ ]
294
+ })
295
+ }),
296
+ binLabelFocused == null ? /* @__PURE__ */ jsxs("div", {
297
+ className: axis_labels_container,
298
+ style: axisLabelsStyle,
299
+ children: [/* @__PURE__ */ jsx("span", {
300
+ className: axis_label_left,
301
+ children: binLabelLeft
302
+ }), /* @__PURE__ */ jsx("span", {
303
+ className: axis_label_right,
304
+ children: binLabelRight
305
+ })]
306
+ }) : /* @__PURE__ */ jsx("span", {
307
+ style: focusedLabelStyle,
308
+ children: binLabelFocused
309
+ }),
310
+ inputNullable && (!focusedNull ? /* @__PURE__ */ jsx("span", {
311
+ style: nullLabelStyle,
312
+ children: "∅"
313
+ }) : /* @__PURE__ */ jsx("span", {
314
+ className: "dashql_axis_label_overlay_Ju3jJE",
315
+ style: focusedNullLabelStyle,
316
+ children: "∅"
317
+ }))
318
+ ]
319
+ })]
320
+ })
321
+ });
322
+ }
323
+ var HistogramCell = React.memo(HistogramCellImpl, arePropsEqualWithStyle);
324
+ export { HistogramCell, NULL_SYMBOL, SettledBrushUpdates };
@@ -0,0 +1,9 @@
1
+ var root = "dashql_root_0s5qGx";
2
+ var header_container = "dashql_header_container_v4mK_H";
3
+ var plot_container = "dashql_plot_container_ycPoHV";
4
+ var plot_svg = "dashql_plot_svg_1_DWlc";
5
+ var axis_labels_container = "dashql_axis_labels_container_HyYE3V";
6
+ var axis_label_left = "dashql_axis_label_left_TQRG9z";
7
+ var axis_label_right = "dashql_axis_label_right_jQT7Rq";
8
+ var axis_label_overlay = "dashql_axis_label_overlay_Ju3jJE";
9
+ export { axis_label_left, axis_label_overlay, axis_label_right, axis_labels_container, header_container, plot_container, plot_svg, root };
@@ -0,0 +1 @@
1
+ export declare function formatHistogramFocusDescription(count: bigint, rowCount: number, filteredCount?: bigint | null, filteredRowCount?: number | null): string;
@@ -0,0 +1,7 @@
1
+ function formatHistogramFocusDescription(count, rowCount, filteredCount = null, filteredRowCount = null) {
2
+ const displayedCount = filteredCount ?? count;
3
+ const displayedRowCount = filteredRowCount ?? rowCount;
4
+ const percentage = displayedRowCount === 0 ? 0 : Math.round(Number(displayedCount) / displayedRowCount * 100 * 100) / 100;
5
+ return `${displayedCount} ${displayedCount === 1n ? "row" : "rows"} (${percentage}%)`;
6
+ }
7
+ export { formatHistogramFocusDescription };
@@ -0,0 +1 @@
1
+ export declare function arePropsEqualWithStyle<P extends object>(prev: Readonly<P>, next: Readonly<P>): boolean;
@@ -0,0 +1,17 @@
1
+ function shallowEqualStyle(a, b) {
2
+ if (a === b) return true;
3
+ if (a == null || b == null) return false;
4
+ const aKeys = Object.keys(a);
5
+ if (aKeys.length !== Object.keys(b).length) return false;
6
+ for (const key of aKeys) if (a[key] !== b[key]) return false;
7
+ return true;
8
+ }
9
+ function arePropsEqualWithStyle(prev, next) {
10
+ const prevKeys = Object.keys(prev);
11
+ if (prevKeys.length !== Object.keys(next).length) return false;
12
+ for (const key of prevKeys) if (key === "style") {
13
+ if (!shallowEqualStyle(prev[key], next[key])) return false;
14
+ } else if (!Object.is(prev[key], next[key])) return false;
15
+ return true;
16
+ }
17
+ export { arePropsEqualWithStyle };
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { ColumnAggregationVariant, StringColumnAggregation, TableAggregation, WithFilterEpoch } from '@akohn/dashql/platform/compute/computation_types';
3
+ export type MostFrequentValueFilterCallback = (table: TableAggregation, columnIndex: number, column: StringColumnAggregation, frequentValueId: number | null) => void;
4
+ export declare const MAX_FOCUSED_VALUE_LENGTH = 100;
5
+ export declare function truncateFocusedValue(value: string): string;
6
+ interface MostFrequentCellProps {
7
+ className?: string;
8
+ style?: React.CSSProperties;
9
+ tableAggregation: TableAggregation;
10
+ columnIndex: number;
11
+ columnAggregate: StringColumnAggregation;
12
+ filteredColumnAggregation: WithFilterEpoch<ColumnAggregationVariant> | null;
13
+ onFilter: MostFrequentValueFilterCallback;
14
+ }
15
+ declare function MostFrequentCellImpl(props: MostFrequentCellProps): React.ReactElement;
16
+ export declare const MostFrequentCell: React.MemoExoticComponent<typeof MostFrequentCellImpl>;
17
+ export {};