derive-dashboards 0.5.1 → 0.7.0

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 (342) hide show
  1. package/README.md +4 -2
  2. package/dist/body.mjs +2 -2
  3. package/dist/charts/data/buckets.d.mts +11 -0
  4. package/dist/charts/data/buckets.mjs +66 -0
  5. package/dist/charts/data/clean.mjs +55 -0
  6. package/dist/charts/data/format.d.mts +19 -0
  7. package/dist/charts/data/format.mjs +174 -0
  8. package/dist/charts/data/input-error.d.mts +5 -0
  9. package/dist/charts/data/input-error.mjs +11 -0
  10. package/dist/charts/data/range.mjs +14 -0
  11. package/dist/charts/data/rows.d.mts +13 -0
  12. package/dist/charts/data/rows.mjs +31 -0
  13. package/dist/charts/data/shares.mjs +55 -0
  14. package/dist/charts/data/types.d.mts +106 -0
  15. package/dist/charts/data/words.d.mts +44 -0
  16. package/dist/charts/data/words.mjs +31 -0
  17. package/dist/charts/describe.mjs +110 -0
  18. package/dist/charts/index.d.mts +34 -0
  19. package/dist/charts/index.mjs +24 -0
  20. package/dist/charts/kinds/area-marks.mjs +120 -0
  21. package/dist/charts/kinds/area.d.mts +23 -0
  22. package/dist/charts/kinds/area.mjs +71 -0
  23. package/dist/charts/kinds/bars-data.d.mts +11 -0
  24. package/dist/charts/kinds/bars-data.mjs +30 -0
  25. package/dist/charts/kinds/bars-layout.mjs +30 -0
  26. package/dist/charts/kinds/bars-marks.mjs +93 -0
  27. package/dist/charts/kinds/bars-words.mjs +56 -0
  28. package/dist/charts/kinds/bars.d.mts +17 -0
  29. package/dist/charts/kinds/bars.mjs +68 -0
  30. package/dist/charts/kinds/columns-data.mjs +116 -0
  31. package/dist/charts/kinds/columns-layout.mjs +29 -0
  32. package/dist/charts/kinds/columns-marks.mjs +200 -0
  33. package/dist/charts/kinds/columns-words.mjs +26 -0
  34. package/dist/charts/kinds/columns.d.mts +13 -0
  35. package/dist/charts/kinds/columns.mjs +80 -0
  36. package/dist/charts/kinds/dumbbell-data.d.mts +22 -0
  37. package/dist/charts/kinds/dumbbell-data.mjs +59 -0
  38. package/dist/charts/kinds/dumbbell-layout.mjs +113 -0
  39. package/dist/charts/kinds/dumbbell-marks.mjs +119 -0
  40. package/dist/charts/kinds/dumbbell-words.d.mts +7 -0
  41. package/dist/charts/kinds/dumbbell-words.mjs +94 -0
  42. package/dist/charts/kinds/dumbbell.d.mts +14 -0
  43. package/dist/charts/kinds/dumbbell.mjs +67 -0
  44. package/dist/charts/kinds/funnel-data.d.mts +11 -0
  45. package/dist/charts/kinds/funnel-data.mjs +70 -0
  46. package/dist/charts/kinds/funnel-layout.mjs +32 -0
  47. package/dist/charts/kinds/funnel-marks.mjs +204 -0
  48. package/dist/charts/kinds/funnel-words.mjs +77 -0
  49. package/dist/charts/kinds/funnel.d.mts +11 -0
  50. package/dist/charts/kinds/funnel.mjs +75 -0
  51. package/dist/charts/kinds/grid-data.d.mts +18 -0
  52. package/dist/charts/kinds/grid-data.mjs +35 -0
  53. package/dist/charts/kinds/grid-layout.mjs +77 -0
  54. package/dist/charts/kinds/grid-marks.mjs +140 -0
  55. package/dist/charts/kinds/grid-time.mjs +41 -0
  56. package/dist/charts/kinds/grid-words.mjs +86 -0
  57. package/dist/charts/kinds/grid.d.mts +22 -0
  58. package/dist/charts/kinds/grid.mjs +55 -0
  59. package/dist/charts/kinds/histogram-data.mjs +142 -0
  60. package/dist/charts/kinds/histogram-layout.mjs +144 -0
  61. package/dist/charts/kinds/histogram-marks.mjs +110 -0
  62. package/dist/charts/kinds/histogram-words.mjs +104 -0
  63. package/dist/charts/kinds/histogram.d.mts +15 -0
  64. package/dist/charts/kinds/histogram.mjs +47 -0
  65. package/dist/charts/kinds/line-marks.mjs +36 -0
  66. package/dist/charts/kinds/line.d.mts +17 -0
  67. package/dist/charts/kinds/line.mjs +52 -0
  68. package/dist/charts/kinds/multiples-grid.mjs +107 -0
  69. package/dist/charts/kinds/multiples-head.mjs +44 -0
  70. package/dist/charts/kinds/multiples-layout.mjs +159 -0
  71. package/dist/charts/kinds/multiples-marks.mjs +95 -0
  72. package/dist/charts/kinds/multiples-words.mjs +110 -0
  73. package/dist/charts/kinds/multiples.d.mts +26 -0
  74. package/dist/charts/kinds/multiples.mjs +42 -0
  75. package/dist/charts/kinds/row-chart.mjs +112 -0
  76. package/dist/charts/kinds/row-marks.mjs +121 -0
  77. package/dist/charts/kinds/scatter-data.d.mts +18 -0
  78. package/dist/charts/kinds/scatter-data.mjs +123 -0
  79. package/dist/charts/kinds/scatter-layout.mjs +189 -0
  80. package/dist/charts/kinds/scatter-marks.mjs +149 -0
  81. package/dist/charts/kinds/scatter-words.mjs +80 -0
  82. package/dist/charts/kinds/scatter.d.mts +21 -0
  83. package/dist/charts/kinds/scatter.mjs +72 -0
  84. package/dist/charts/kinds/stat-data.mjs +91 -0
  85. package/dist/charts/kinds/stat-layout.mjs +108 -0
  86. package/dist/charts/kinds/stat-marks.mjs +85 -0
  87. package/dist/charts/kinds/stat-words.mjs +57 -0
  88. package/dist/charts/kinds/stat.d.mts +28 -0
  89. package/dist/charts/kinds/stat.mjs +35 -0
  90. package/dist/charts/kinds/time-chart.mjs +74 -0
  91. package/dist/charts/kinds/time-frame.mjs +113 -0
  92. package/dist/charts/kinds/time-notes.mjs +36 -0
  93. package/dist/charts/kinds/time-plan.d.mts +8 -0
  94. package/dist/charts/kinds/time-plan.mjs +57 -0
  95. package/dist/charts/kinds/time-plot.mjs +56 -0
  96. package/dist/charts/kinds/time-stops.mjs +56 -0
  97. package/dist/charts/kinds/value-plot.mjs +33 -0
  98. package/dist/charts/kinds/waterfall-data.d.mts +7 -0
  99. package/dist/charts/kinds/waterfall-data.mjs +71 -0
  100. package/dist/charts/kinds/waterfall-layout.mjs +38 -0
  101. package/dist/charts/kinds/waterfall-marks.mjs +82 -0
  102. package/dist/charts/kinds/waterfall-words.mjs +118 -0
  103. package/dist/charts/kinds/waterfall.d.mts +17 -0
  104. package/dist/charts/kinds/waterfall.mjs +66 -0
  105. package/dist/charts/layout/boxes.mjs +28 -0
  106. package/dist/charts/layout/dodge.mjs +75 -0
  107. package/dist/charts/layout/extent.mjs +25 -0
  108. package/dist/charts/layout/frame.mjs +97 -0
  109. package/dist/charts/layout/place-labels.mjs +101 -0
  110. package/dist/charts/layout/stack.mjs +31 -0
  111. package/dist/charts/marks/axes.mjs +137 -0
  112. package/dist/charts/marks/dot.mjs +31 -0
  113. package/dist/charts/marks/end-labels.mjs +124 -0
  114. package/dist/charts/marks/legend.mjs +141 -0
  115. package/dist/charts/marks/lines.d.mts +2 -0
  116. package/dist/charts/marks/lines.mjs +38 -0
  117. package/dist/charts/marks/lit.d.mts +3 -0
  118. package/dist/charts/marks/lit.mjs +63 -0
  119. package/dist/charts/marks/more.mjs +18 -0
  120. package/dist/charts/marks/notes.mjs +253 -0
  121. package/dist/charts/marks/series-line.mjs +110 -0
  122. package/dist/charts/marks/thin.mjs +138 -0
  123. package/dist/charts/marks/x-axis.mjs +32 -0
  124. package/dist/charts/scale/calendar.mjs +174 -0
  125. package/dist/charts/scale/time-ticks.mjs +154 -0
  126. package/dist/charts/scale/time.mjs +33 -0
  127. package/dist/charts/scale/value.mjs +161 -0
  128. package/dist/charts/scene/defs.mjs +33 -0
  129. package/dist/charts/scene/markup.mjs +35 -0
  130. package/dist/charts/scene/nearest.d.mts +11 -0
  131. package/dist/charts/scene/nearest.mjs +49 -0
  132. package/dist/charts/scene/paint.d.mts +12 -0
  133. package/dist/charts/scene/paint.mjs +13 -0
  134. package/dist/charts/scene/svg.d.mts +18 -0
  135. package/dist/charts/scene/svg.mjs +185 -0
  136. package/dist/charts/scene/types.d.mts +177 -0
  137. package/dist/charts/text/measure.d.mts +9 -0
  138. package/dist/charts/text/measure.mjs +123 -0
  139. package/dist/charts/theme.d.mts +47 -0
  140. package/dist/charts/theme.mjs +239 -0
  141. package/dist/charts-react/Chart.d.mts +91 -0
  142. package/dist/charts-react/Chart.mjs +166 -0
  143. package/dist/charts-react/Overlay.mjs +171 -0
  144. package/dist/charts-react/Picture.mjs +22 -0
  145. package/dist/charts-react/Reader.mjs +147 -0
  146. package/dist/charts-react/bucket-names.mjs +29 -0
  147. package/dist/charts-react/chart-unlayered.css +1 -0
  148. package/dist/charts-react/chart-unlayered.css.d.ts +1 -0
  149. package/dist/charts-react/chart.css +1 -0
  150. package/dist/charts-react/chart.css.d.ts +1 -0
  151. package/dist/charts-react/events.mjs +72 -0
  152. package/dist/charts-react/exact-sum.mjs +24 -0
  153. package/dist/charts-react/from-answer.mjs +185 -0
  154. package/dist/charts-react/index.d.mts +3 -0
  155. package/dist/charts-react/index.mjs +4 -0
  156. package/dist/charts-react/keys.mjs +117 -0
  157. package/dist/charts-react/opens.mjs +28 -0
  158. package/dist/charts-react/plan-bars.mjs +95 -0
  159. package/dist/charts-react/plan-funnel.mjs +120 -0
  160. package/dist/charts-react/plan-grid.mjs +121 -0
  161. package/dist/charts-react/plan-parts.d.mts +2 -0
  162. package/dist/charts-react/plan-parts.mjs +30 -0
  163. package/dist/charts-react/plan-time.mjs +84 -0
  164. package/dist/charts-react/plan.d.mts +3 -0
  165. package/dist/charts-react/plan.mjs +37 -0
  166. package/dist/charts-react/point-keys.mjs +22 -0
  167. package/dist/charts-react/pointer.mjs +99 -0
  168. package/dist/charts-react/reader-page.d.mts +8 -0
  169. package/dist/charts-react/reader-page.mjs +116 -0
  170. package/dist/charts-react/tiles.d.mts +24 -0
  171. package/dist/charts-react/tiles.mjs +142 -0
  172. package/dist/charts-react/tip-place.mjs +107 -0
  173. package/dist/charts-react/tip-room.mjs +31 -0
  174. package/dist/charts-react/useClientLayoutEffect.mjs +8 -0
  175. package/dist/charts-react/useScene.mjs +76 -0
  176. package/dist/charts-react/useSize.mjs +44 -0
  177. package/dist/charts-react/useStop.mjs +68 -0
  178. package/dist/core/conformance/memory/aggregate.mjs +2 -1
  179. package/dist/core/conformance/memory/rows.mjs +1 -1
  180. package/dist/core/conformance/memory/source.mjs +3 -2
  181. package/dist/core/document/display-comparisons.mjs +49 -0
  182. package/dist/core/document/display-entries.mjs +2 -1
  183. package/dist/core/document/display-validation.d.mts +12 -0
  184. package/dist/core/document/display-validation.mjs +56 -0
  185. package/dist/core/document/display.d.mts +27 -12
  186. package/dist/core/document/display.mjs +40 -49
  187. package/dist/core/document/view-layout.mjs +16 -0
  188. package/dist/core/engine/access.mjs +4 -2
  189. package/dist/core/engine/context.mjs +5 -7
  190. package/dist/core/engine/custom/cells.mjs +1 -1
  191. package/dist/core/engine/custom/records.mjs +2 -1
  192. package/dist/core/engine/dialect.d.mts +2 -0
  193. package/dist/core/engine/index.mjs +1 -1
  194. package/dist/core/engine/levels.mjs +33 -1
  195. package/dist/core/engine/plan.d.mts +2 -0
  196. package/dist/core/engine/postgres.mjs +1 -0
  197. package/dist/core/engine/rank.mjs +1 -1
  198. package/dist/core/engine/reader.d.mts +4 -0
  199. package/dist/core/engine/sql-partition.mjs +45 -0
  200. package/dist/core/engine/sql-reads.mjs +4 -1
  201. package/dist/core/engine/statement.mjs +4 -4
  202. package/dist/core/engine/version.d.mts +1 -1
  203. package/dist/core/engine/version.mjs +1 -1
  204. package/dist/core/error/codes.d.mts +1 -1
  205. package/dist/core/error/codes.mjs +1 -1
  206. package/dist/core/exact/decimal.d.mts +1 -4
  207. package/dist/core/exact/decimal.mjs +1 -14
  208. package/dist/core/exact/text.d.mts +5 -0
  209. package/dist/core/exact/text.mjs +19 -0
  210. package/dist/core/index.d.mts +9 -6
  211. package/dist/core/index.mjs +11 -8
  212. package/dist/core/model/types.d.mts +2 -0
  213. package/dist/core/model/validate/fields.mjs +1 -1
  214. package/dist/core/model/validate/known-members.mjs +2 -0
  215. package/dist/core/model/validate/shape.mjs +5 -1
  216. package/dist/core/oracle/visibility.mjs +2 -2
  217. package/dist/core/policy/bind.mjs +29 -1
  218. package/dist/core/query/drill/compose.d.mts +2 -0
  219. package/dist/core/query/drill/compose.mjs +1 -1
  220. package/dist/core/query/drill/synthetic.mjs +2 -1
  221. package/dist/core/query/drill/types.d.mts +7 -0
  222. package/dist/core/query/drill/types.mjs +3 -1
  223. package/dist/core/result/number.mjs +2 -1
  224. package/dist/core/result/time-axis.mjs +2 -1
  225. package/dist/core/schema/answers.d.mts +1176 -362
  226. package/dist/core/schema/commands.mjs +2 -1
  227. package/dist/core/schema/document.mjs +27 -2
  228. package/dist/core/schema/drill-answers.mjs +19 -1
  229. package/dist/core/schema/drill.d.mts +21 -6
  230. package/dist/core/schema/drill.mjs +7 -1
  231. package/dist/core/schema/index.d.mts +2 -1
  232. package/dist/core/schema/index.mjs +2 -1
  233. package/dist/core/schema/null-ops.d.mts +6 -0
  234. package/dist/core/schema/null-ops.mjs +18 -0
  235. package/dist/core/schema/query.mjs +30 -4
  236. package/dist/core/schema/tools.mjs +13 -0
  237. package/dist/core/schema/union-error.mjs +38 -0
  238. package/dist/core/time/bucket.mjs +2 -1
  239. package/dist/core/time/index.d.mts +3 -2
  240. package/dist/core/time/instant.d.mts +1 -2
  241. package/dist/core/time/instant.mjs +2 -30
  242. package/dist/core/time/range.mjs +2 -1
  243. package/dist/core/time/stored.mjs +2 -1
  244. package/dist/core/time/text-time.d.mts +10 -0
  245. package/dist/core/time/text-time.mjs +80 -0
  246. package/dist/core/types/api.d.mts +1 -1
  247. package/dist/core/types/api.mjs +1 -1
  248. package/dist/core/types/drill-api.d.mts +22 -2
  249. package/dist/dashboard-documents.d.mts +8 -0
  250. package/dist/dashboard-documents.mjs +52 -0
  251. package/dist/drill-access.mjs +40 -3
  252. package/dist/drill-comparison.mjs +71 -0
  253. package/dist/drill-crumbs.mjs +21 -2
  254. package/dist/drill-group-seal.mjs +13 -0
  255. package/dist/drill-open.mjs +7 -1
  256. package/dist/drill-seal.mjs +4 -6
  257. package/dist/drill-views.mjs +5 -13
  258. package/dist/drill.mjs +28 -58
  259. package/dist/editing.mjs +1 -1
  260. package/dist/endpoints/drill.mjs +2 -3
  261. package/dist/endpoints/index.d.mts +20 -0
  262. package/dist/index.d.mts +2 -1
  263. package/dist/index.mjs +6 -27
  264. package/dist/llms.txt +1 -1
  265. package/dist/react/Cell.mjs +2 -2
  266. package/dist/react/DashboardList.mjs +3 -3
  267. package/dist/react/Editing.mjs +3 -3
  268. package/dist/react/Header.mjs +2 -2
  269. package/dist/react/History.mjs +3 -3
  270. package/dist/react/Parts.mjs +2 -2
  271. package/dist/react/RowBody.d.mts +2 -4
  272. package/dist/react/RowBody.mjs +14 -39
  273. package/dist/react/Tile.mjs +4 -5
  274. package/dist/react/builder/FilterEditor.mjs +2 -2
  275. package/dist/react/builder/Picker.mjs +3 -3
  276. package/dist/react/builder/RangeEditor.mjs +3 -3
  277. package/dist/react/builder/Time.mjs +3 -3
  278. package/dist/react/builder/Values.mjs +2 -2
  279. package/dist/react/builder/WidgetBuilder.mjs +2 -2
  280. package/dist/react/digits.mjs +1 -1
  281. package/dist/react/drill/Bars.mjs +34 -38
  282. package/dist/react/drill/Comparison.mjs +204 -0
  283. package/dist/react/drill/Controls.mjs +8 -12
  284. package/dist/react/drill/DrillDrawer.mjs +42 -0
  285. package/dist/react/drill/DrillPanel.mjs +61 -41
  286. package/dist/react/drill/Header.mjs +65 -35
  287. package/dist/react/drill/ItemLink.mjs +40 -0
  288. package/dist/react/drill/Items.d.mts +2 -1
  289. package/dist/react/drill/Items.mjs +126 -99
  290. package/dist/react/drill/ItemsBody.mjs +38 -0
  291. package/dist/react/drill/ItemsFoot.mjs +24 -19
  292. package/dist/react/drill/Notes.mjs +23 -13
  293. package/dist/react/drill/PanelBody.mjs +7 -25
  294. package/dist/react/drill/RecordRow.mjs +47 -0
  295. package/dist/react/drill/Trend.mjs +186 -0
  296. package/dist/react/drill/board.mjs +21 -11
  297. package/dist/react/drill/drawer-context.mjs +5 -0
  298. package/dist/react/drill/item-parts.mjs +53 -35
  299. package/dist/react/drill/item-type.d.mts +2 -2
  300. package/dist/react/drill/lazy.d.mts +1 -4
  301. package/dist/react/drill/lazy.mjs +29 -11
  302. package/dist/react/drill/panel-focus.mjs +18 -7
  303. package/dist/react/drill/props.d.mts +7 -1
  304. package/dist/react/drill/props.mjs +39 -8
  305. package/dist/react/drill/record-page.mjs +61 -0
  306. package/dist/react/drill/state.mjs +17 -2
  307. package/dist/react/drill/trend-touch.mjs +33 -0
  308. package/dist/react/drill/useDrill.d.mts +3 -3
  309. package/dist/react/drill/useDrill.mjs +35 -15
  310. package/dist/react/drill/words.d.mts +14 -0
  311. package/dist/react/drill/words.mjs +20 -8
  312. package/dist/react/english.d.mts +4 -1
  313. package/dist/react/english.mjs +17 -2
  314. package/dist/react/filters/chip.mjs +2 -2
  315. package/dist/react/filters/menu-search.mjs +5 -5
  316. package/dist/react/filters/menu.mjs +2 -2
  317. package/dist/react/filters/number.mjs +2 -2
  318. package/dist/react/filters/operator.mjs +2 -2
  319. package/dist/react/filters/phone.mjs +2 -2
  320. package/dist/react/filters/values.mjs +4 -4
  321. package/dist/react/format-time.d.mts +2 -1
  322. package/dist/react/format-time.mjs +42 -34
  323. package/dist/react/format.mjs +15 -3
  324. package/dist/react/index.d.mts +4 -3
  325. package/dist/react/index.mjs +4 -3
  326. package/dist/react/messages.d.mts +23 -2
  327. package/dist/react/renderers/entries.d.mts +11 -0
  328. package/dist/react/renderers/list.mjs +8 -10
  329. package/dist/react/renderers/table-cells.mjs +38 -9
  330. package/dist/react/renderers/table-measure.mjs +2 -0
  331. package/dist/react/renderers/table-row.mjs +64 -7
  332. package/dist/react/renderers/table-sort.mjs +2 -8
  333. package/dist/react/renderers/table.mjs +16 -15
  334. package/dist/react/series.mjs +8 -3
  335. package/dist/react/theme-unlayered.css +1 -3144
  336. package/dist/react/theme.css +1 -3146
  337. package/dist/recharts/parts.mjs +1 -1
  338. package/dist/skills/derive-dashboards/SKILL.md +10 -5
  339. package/dist/store/apply.mjs +2 -2
  340. package/dist/store/editor.mjs +2 -2
  341. package/dist/store/writer.mjs +2 -2
  342. package/package.json +27 -2
@@ -0,0 +1,95 @@
1
+ import { barRowsOf, measureOf } from "./from-answer.mjs";
2
+ import { byKey, leftOut, noValue, oneOf } from "./plan-parts.mjs";
3
+ import { barChart } from "derive-dashboards/charts";
4
+ import { displayOf } from "derive-dashboards/core";
5
+ import { answerIds } from "derive-dashboards/react";
6
+ // src/plan-bars.ts
7
+ /**
8
+ * What the bars leave to the table: a summed split's parts, or the series not drawn (the rest of
9
+ * a split, or the measures after the first), the first few named and the rest counted.
10
+ */
11
+ function barsLeftOut(props, at) {
12
+ const labels = at.series.map((s) => s.label);
13
+ return leftOut(at.split === "summed" ? labels : labels.slice(1), {
14
+ drawn: at.drawn,
15
+ props
16
+ });
17
+ }
18
+ /**
19
+ * The order of bars by category: by value for a bar tile, unless its x column is a time
20
+ * (grouped with no grain, it has no time axis and still reads in time order); as given for
21
+ * every other kind, which was asked to follow the answer's order.
22
+ */
23
+ const sortOf = (props, kind) => kind === "bar" && props.answer.columns[0]?.type !== "time" ? "value" : "given";
24
+ /**
25
+ * The series a bar tile reads its bars against (`display.against`, named as the widget's query
26
+ * names it or as the answer does): its values are ticks on the bars, not bars of their own.
27
+ * None for a tile that names none, names what the answer lacks, or splits its bars. None either
28
+ * for one with no bar to stand on (it names the one value drawn), or read in another unit than
29
+ * the bars (a count against a rate): a tick is a place on the bars' own scale. Such a value is
30
+ * drawn or left to the table as any other is.
31
+ */
32
+ function againstOf(props, drawn) {
33
+ const named = displayOf("bar", props.widget.display).against;
34
+ if (named === void 0 || drawn.split) return void 0;
35
+ const id = answerIds(props.widget)(named);
36
+ const mark = drawn.series.find((s) => s.column.id === id);
37
+ const bar = drawn.series.find((s) => s !== mark);
38
+ return mark !== void 0 && bar?.axis === mark.axis ? mark : void 0;
39
+ }
40
+ /**
41
+ * Bars by category. A split of a measure that adds up is drawn whole: each bar the sum of its
42
+ * parts, which has no one cell behind it. One that does not (a rate) cannot be summed, so its
43
+ * first part is drawn, its measure named by its column and then that part ("Done · high"), as
44
+ * the dashboards join a split's names. Of several measures, the first is drawn, and the one a
45
+ * widget names to read the bars against is a tick on each. A bar tile ranks the bars, empty
46
+ * rows after those with a value; any other kind keeps the answer's order. Either way the chart
47
+ * puts Other last.
48
+ */
49
+ function byCategory(props, drawn, kind, from) {
50
+ const mark = againstOf(props, drawn);
51
+ const rest = drawn.series.filter((s) => s !== mark);
52
+ const [first] = rest;
53
+ if (first === void 0) return void 0;
54
+ const own = measureOf(first.column, props);
55
+ const split = drawn.split ? own.additive === false ? "first" : "summed" : void 0;
56
+ const series = split === "summed" ? rest : [first];
57
+ const measure = split === "first" ? {
58
+ ...own,
59
+ label: `${own.label} · ${first.label}`
60
+ } : own;
61
+ const bars = barRowsOf(drawn, {
62
+ ...from,
63
+ series
64
+ });
65
+ const rows = bars.data.map((row) => {
66
+ const point = bars.pointOf.get(row.key ?? row.label);
67
+ const at = mark === void 0 || point === void 0 ? void 0 : drawn.points[point]?.[mark.key];
68
+ return typeof at === "number" ? {
69
+ ...row,
70
+ against: at
71
+ } : row;
72
+ });
73
+ const slot = split === "summed" || first.slot === void 0 ? {} : { slot: first.slot };
74
+ const against = mark === void 0 ? {} : { againstLabel: mark.label };
75
+ return {
76
+ drawn,
77
+ drew: "bar",
78
+ draw: (env) => barChart(rows, {
79
+ measure,
80
+ sort: sortOf(props, kind),
81
+ ...slot,
82
+ ...against
83
+ }, env),
84
+ pointOf: byKey(bars.pointOf),
85
+ ...oneOf(series),
86
+ notDrawn: barsLeftOut(props, {
87
+ drawn,
88
+ series: rest,
89
+ split
90
+ }),
91
+ points: rows.length,
92
+ empty: rows.every((row) => noValue(row.value))
93
+ };
94
+ }
95
+ export { byCategory };
@@ -0,0 +1,120 @@
1
+ import { measureOf } from "./from-answer.mjs";
2
+ import { leftOut, noValue } from "./plan-parts.mjs";
3
+ import { overTime } from "./plan-time.mjs";
4
+ import { keyedPoints } from "./point-keys.mjs";
5
+ import { barChart, funnelChart } from "derive-dashboards/charts";
6
+ import { roleOf } from "derive-dashboards/core";
7
+ import { pointText } from "derive-dashboards/react";
8
+ // src/plan-funnel.ts
9
+ /** A step: its name, its value, and the answer's own text for it, so an exact amount keeps every digit. */
10
+ function stepOf(named, at, of) {
11
+ const value = of.drawn.points[at.point]?.[at.series.key];
12
+ const text = pointText(of.from.answer, of.drawn, at, of.from.format);
13
+ const step = {
14
+ ...named,
15
+ value: typeof value === "number" ? value : null
16
+ };
17
+ return text === void 0 ? step : {
18
+ ...step,
19
+ text
20
+ };
21
+ }
22
+ /**
23
+ * Each value of the answer's one row as a step, of those read in the first value's unit: a
24
+ * count is not a step of amounts, and an amount is no share of a count.
25
+ */
26
+ function byMeasure(first, of) {
27
+ const drew = of.drawn.series.filter((s) => s.axis === first.axis);
28
+ return {
29
+ steps: drew.map((s) => stepOf({
30
+ label: s.label,
31
+ key: s.key
32
+ }, {
33
+ point: 0,
34
+ series: s
35
+ }, of)),
36
+ at: new Map(drew.map((s) => [s.key, {
37
+ point: 0,
38
+ series: s
39
+ }])),
40
+ drew
41
+ };
42
+ }
43
+ /** Each group of the answer as a step, by its first value. */
44
+ function byGroup(first, of) {
45
+ const keyed = keyedPoints(of.drawn);
46
+ return {
47
+ steps: keyed.map(({ point, key, i }) => stepOf({
48
+ label: point.x,
49
+ key
50
+ }, {
51
+ point: i,
52
+ series: first
53
+ }, of)),
54
+ at: new Map(keyed.map(({ key, i }) => [key, {
55
+ point: i,
56
+ series: first
57
+ }])),
58
+ drew: [first]
59
+ };
60
+ }
61
+ /** Rising steps cannot describe the people continuing from an earlier step. */
62
+ function needsBars(steps) {
63
+ let previous = Number.POSITIVE_INFINITY;
64
+ for (const { value } of steps) {
65
+ if (value === null) continue;
66
+ if (value < 0 || value > previous) return true;
67
+ previous = value;
68
+ }
69
+ return false;
70
+ }
71
+ /** Whether the answer is one row with no field to group by: its values are then the steps. */
72
+ const ungrouped = (props, drawn) => drawn.points.length === 1 && props.answer.columns.every((column) => !["time", "dimension"].includes(roleOf(column)));
73
+ /**
74
+ * A funnel of the answer's steps. None for an answer with no value. An answer over time is
75
+ * columns over time: a funnel has no time axis. Steps one of which is below zero are bars in
76
+ * the steps' order: fewer than none cannot have gone on, and a funnel would have no bar and no
77
+ * number for it, where the bars keep the number in sight.
78
+ */
79
+ function funnelPlan(props, drawn, from) {
80
+ const [first] = drawn.series;
81
+ if (first === void 0) return void 0;
82
+ const timed = overTime(props, drawn, "bar", from);
83
+ if (timed !== void 0) return timed;
84
+ const steps = ungrouped(props, drawn) ? byMeasure(first, {
85
+ drawn,
86
+ from
87
+ }) : byGroup(first, {
88
+ drawn,
89
+ from
90
+ });
91
+ const own = measureOf(first.column, props);
92
+ const measure = steps.drew.length > 1 ? {
93
+ ...own,
94
+ label: props.widget.title
95
+ } : own;
96
+ const others = drawn.series.filter((s) => !steps.drew.includes(s)).map((s) => s.label);
97
+ const slot = first.slot === void 0 ? {} : { slot: first.slot };
98
+ const bars = needsBars(steps.steps);
99
+ return {
100
+ drawn,
101
+ drew: bars ? "bar" : "funnel",
102
+ draw: (env) => bars ? barChart(steps.steps, {
103
+ measure,
104
+ sort: "given",
105
+ ...slot
106
+ }, env) : funnelChart(steps.steps, {
107
+ measure,
108
+ ...slot
109
+ }, env),
110
+ pointOf: (stop) => steps.at.get(stop.key)?.point,
111
+ seriesOf: (_item, stop) => steps.at.get(stop.key)?.series,
112
+ notDrawn: leftOut(others, {
113
+ drawn,
114
+ props
115
+ }),
116
+ points: steps.steps.length,
117
+ empty: steps.steps.every((step) => noValue(step.value))
118
+ };
119
+ }
120
+ export { funnelPlan };
@@ -0,0 +1,121 @@
1
+ import { measureOf, timeTableOf } from "./from-answer.mjs";
2
+ import { leftOut, noValue } from "./plan-parts.mjs";
3
+ import { keyedPoints } from "./point-keys.mjs";
4
+ import { gridChart, pairKey } from "derive-dashboards/charts";
5
+ import { roleOf } from "derive-dashboards/core";
6
+ import { pointText } from "derive-dashboards/react";
7
+ // src/plan-grid.ts
8
+ /** The values of each series at each point, as numbers: a cell with none is empty. */
9
+ const valueAt = (drawn, point, series) => {
10
+ const value = drawn.points[point]?.[series.key];
11
+ return typeof value === "number" ? value : null;
12
+ };
13
+ /** The series a grid draws: the values of one measure. Several measures are not one scale, so the first is drawn. */
14
+ function drawnSeries(drawn) {
15
+ const [first] = drawn.series;
16
+ return drawn.series.filter((s) => s.column.id === first?.column.id);
17
+ }
18
+ /** Buckets across, the split's values down. Undefined when the answer is not over time. */
19
+ function overTime(props, drawn, from) {
20
+ const series = drawnSeries(drawn);
21
+ const zone = props.answer.receipt.calendar.timezone;
22
+ const timed = timeTableOf(drawn, {
23
+ ...from,
24
+ zone,
25
+ series
26
+ });
27
+ if (timed === void 0) return void 0;
28
+ const { buckets, titles } = timed.data.x;
29
+ const columns = buckets.map((bucket, i) => ({
30
+ label: titles?.[i] ?? bucket.label,
31
+ key: bucket.label
32
+ }));
33
+ const rows = series.map((s) => ({
34
+ label: s.label,
35
+ key: s.key
36
+ }));
37
+ const cells = new Map(series.flatMap((s) => buckets.flatMap((bucket) => {
38
+ const point = timed.pointOf.get(bucket.label);
39
+ return point === void 0 ? [] : [[pairKey(s.key, bucket.label), {
40
+ point,
41
+ series: s
42
+ }]];
43
+ })));
44
+ return {
45
+ data: {
46
+ rows,
47
+ columns,
48
+ values: timed.data.series.map((s) => [...s.values]),
49
+ texts: timed.data.series.map((s) => [...s.texts ?? []])
50
+ },
51
+ cells,
52
+ time: timed.data.x,
53
+ unplaced: timed.unplaced
54
+ };
55
+ }
56
+ /** The first field's values down, the second's (or the one measure) across. */
57
+ function byRows(drawn, from) {
58
+ const series = drawnSeries(drawn);
59
+ const keyed = keyedPoints(drawn);
60
+ const rows = keyed.map(({ point, key }) => ({
61
+ label: point.x,
62
+ key
63
+ }));
64
+ const columns = series.map((s) => ({
65
+ label: s.label,
66
+ key: s.key
67
+ }));
68
+ const cells = new Map(keyed.flatMap(({ key, i }) => series.map((s) => [pairKey(key, s.key), {
69
+ point: i,
70
+ series: s
71
+ }])));
72
+ return {
73
+ data: {
74
+ rows,
75
+ columns,
76
+ values: keyed.map(({ i }) => series.map((s) => valueAt(drawn, i, s))),
77
+ texts: keyed.map(({ i }) => series.map((s) => pointText(from.answer, drawn, {
78
+ point: i,
79
+ series: s
80
+ }, from.format)))
81
+ },
82
+ cells
83
+ };
84
+ }
85
+ /** The word over the row names: the label of the field whose values run down. */
86
+ function rowTitleOf(props, timed) {
87
+ return props.answer.columns.filter((c) => roleOf(c) === "time" || roleOf(c) === "dimension")[timed ? 1 : 0]?.label;
88
+ }
89
+ /** A heat grid of the answer's first value by its two fields. None for an answer with no value. */
90
+ function gridPlan(props, drawn, from) {
91
+ const [first] = drawn.series;
92
+ if (first === void 0) return void 0;
93
+ const timed = overTime(props, drawn, from);
94
+ const grid = timed ?? byRows(drawn, from);
95
+ const measure = measureOf(first.column, props);
96
+ const rowTitle = rowTitleOf(props, timed !== void 0);
97
+ const others = drawn.series.filter((s) => s.column.id !== first.column.id).map((s) => s.label);
98
+ const slot = drawn.split || first.slot === void 0 ? {} : { slot: first.slot };
99
+ const cellOf = (stop) => grid.cells.get(stop.key);
100
+ return {
101
+ drawn,
102
+ drew: "heatmap",
103
+ draw: (env) => gridChart(grid.data, {
104
+ measure,
105
+ diverging: true,
106
+ ...grid.time === void 0 ? {} : { time: grid.time },
107
+ ...rowTitle === void 0 ? {} : { rowTitle },
108
+ ...slot
109
+ }, env),
110
+ pointOf: (stop) => cellOf(stop)?.point,
111
+ seriesOf: (_item, stop) => cellOf(stop)?.series,
112
+ notDrawn: leftOut(others, {
113
+ drawn,
114
+ props,
115
+ more: grid.unplaced ?? []
116
+ }),
117
+ points: grid.data.rows.length * grid.data.columns.length,
118
+ empty: grid.data.values.every((row) => row.every((value) => noValue(value)))
119
+ };
120
+ }
121
+ export { gridPlan };
@@ -0,0 +1,2 @@
1
+ import { Env, HoverItem, HoverStop, Scene } from "derive-dashboards/charts";
2
+ import { TileRendererProps } from "derive-dashboards/react";
@@ -0,0 +1,30 @@
1
+ // src/plan-parts.ts
2
+ /** How many of the things left out the note names; the rest it counts. */
3
+ const NAMED = 3;
4
+ /**
5
+ * The note's labels: the series left out, then the values the answer itself does not draw, then
6
+ * whatever else has no place (`more`). The first few are named and the rest counted, the count
7
+ * always last, so it counts everything it stands for.
8
+ */
9
+ function leftOut(labels, at) {
10
+ const all = [
11
+ ...labels,
12
+ ...at.drawn.notDrawn.map((c) => c.label),
13
+ ...at.more ?? []
14
+ ];
15
+ if (all.length <= NAMED) return all;
16
+ return [...all.slice(0, NAMED), at.props.messages.moreRows(all.length - NAMED)];
17
+ }
18
+ /** The one series a plan draws, as every item's series, when it draws one. */
19
+ const oneOf = (series) => {
20
+ const [only] = series;
21
+ return only === void 0 || series.length !== 1 ? {} : { seriesOf: () => only };
22
+ };
23
+ /** The point behind a stop's key, in a map from keys to points. */
24
+ const byKey = (points) => (stop) => points.get(stop.key);
25
+ /**
26
+ * Whether there is no value to draw: none at all, or one that is not a number a chart draws
27
+ * (not a number, or not finite). A tile with none to draw says so, as one with none at all does.
28
+ */
29
+ const noValue = (value) => value === null || value === void 0 || !Number.isFinite(value);
30
+ export { byKey, leftOut, noValue, oneOf };
@@ -0,0 +1,84 @@
1
+ import { timeTableOf } from "./from-answer.mjs";
2
+ import { byKey, leftOut, noValue } from "./plan-parts.mjs";
3
+ import { areaChart, areaDraws, columnChart, lineChart, multiplesChart, pairKey } from "derive-dashboards/charts";
4
+ import { displayOf } from "derive-dashboards/core";
5
+ // src/plan-time.ts
6
+ /** Whether some value is below zero: such a table has no shares of a whole to read. */
7
+ const anyLoss = (data) => data.series.some((s) => s.values.some((value) => value !== null && value < 0));
8
+ /**
9
+ * What an area tile draws. Bands are the parts of one split, or one series alone: separate
10
+ * measures (Tasks and Hours) are lines, for a band of one on the other would reach a height,
11
+ * and a share of both, that means nothing. The chart itself draws lines of values that do not
12
+ * add up, and columns of one period or of a series that changes sign (`areaDraws`), so the
13
+ * tile names the picture that is drawn, not the one asked for. Shares are read only of parts
14
+ * none of which is a loss: a share of a whole with a loss in it is no share.
15
+ */
16
+ function areaPicture(props, drawn, data) {
17
+ if (!drawn.split && data.series.length > 1) return {
18
+ drew: "line",
19
+ draw: (table, env) => lineChart(table, {}, env)
20
+ };
21
+ const share = displayOf("area", props.widget.display).share === true && !anyLoss(data) && data.series.some((s) => s.values.some((v) => v !== null && v > 0));
22
+ const form = areaDraws(data);
23
+ return {
24
+ drew: form === "area" ? "area" : form === "lines" ? "line" : "bar",
25
+ draw: (table, env) => areaChart(table, share ? { arrange: "share" } : {}, env)
26
+ };
27
+ }
28
+ /**
29
+ * How each kind draws a table over time. Columns stack only the parts of a split, as the
30
+ * Recharts tile does: separate measures stand side by side, for a column of Tasks on Hours
31
+ * would reach a total that means nothing.
32
+ */
33
+ function pictureOf(props, drawn, at) {
34
+ const { kind, data } = at;
35
+ const own = displayOf("multiples", props.widget.display).ownScales === true;
36
+ return {
37
+ bar: {
38
+ drew: "bar",
39
+ draw: (table, env) => columnChart(table, drawn.split ? {} : { arrange: "grouped" }, env)
40
+ },
41
+ area: areaPicture(props, drawn, data),
42
+ multiples: {
43
+ drew: "multiples",
44
+ draw: (table, env) => multiplesChart(table, { shared: !own }, env)
45
+ }
46
+ }[kind] ?? {
47
+ drew: "line",
48
+ draw: (table, env) => lineChart(table, {}, env)
49
+ };
50
+ }
51
+ /**
52
+ * A chart over time, when the answer has a time axis with a bucket for some point. A point with
53
+ * no bucket is named under the chart, never silently dropped.
54
+ */
55
+ function overTime(props, drawn, kind, from) {
56
+ const series = drawn.series.filter((s) => s.axis === "left");
57
+ const timed = timeTableOf(drawn, {
58
+ ...from,
59
+ zone: props.answer.receipt.calendar.timezone,
60
+ series
61
+ });
62
+ if (timed === void 0) return void 0;
63
+ const picture = pictureOf(props, drawn, {
64
+ kind,
65
+ data: timed.data
66
+ });
67
+ const right = drawn.series.filter((s) => !series.includes(s)).map((s) => s.label);
68
+ const points = kind === "multiples" ? new Map(series.flatMap((s) => [...timed.pointOf].map(([label, point]) => [pairKey(s.key, label), point]))) : timed.pointOf;
69
+ return {
70
+ drawn,
71
+ drew: picture.drew,
72
+ draw: (env) => picture.draw(timed.data, env),
73
+ pointOf: byKey(points),
74
+ seriesOf: (item) => series.find((s) => s.key === item.key),
75
+ notDrawn: leftOut(right, {
76
+ drawn,
77
+ props,
78
+ more: timed.unplaced
79
+ }),
80
+ points: timed.data.x.buckets.length,
81
+ empty: timed.data.series.every((s) => s.values.every((value) => noValue(value)))
82
+ };
83
+ }
84
+ export { overTime };
@@ -0,0 +1,3 @@
1
+ import "./plan-parts.mjs";
2
+ import { HoverItem, HoverStop } from "derive-dashboards/charts";
3
+ import { TileRendererProps } from "derive-dashboards/react";
@@ -0,0 +1,37 @@
1
+ import { byCategory } from "./plan-bars.mjs";
2
+ import { funnelPlan } from "./plan-funnel.mjs";
3
+ import { gridPlan } from "./plan-grid.mjs";
4
+ import { overTime } from "./plan-time.mjs";
5
+ import { displayOf } from "derive-dashboards/core";
6
+ import { toSeries } from "derive-dashboards/react";
7
+ // src/plan.ts
8
+ /**
9
+ * How a tile is drawn, by its kind. A widget's own colours are read once, by series label, as
10
+ * the dashboards' other tiles read them.
11
+ */
12
+ function planOf(props, kind) {
13
+ const drawn = toSeries(props.answer, props, props.slots);
14
+ const colors = kind === "heatmap" || kind === "funnel" ? void 0 : displayOf(kind, props.widget.display).colors;
15
+ const from = {
16
+ answer: props.answer,
17
+ format: props,
18
+ colors
19
+ };
20
+ if (kind === "heatmap") return gridPlan(props, drawn, from);
21
+ if (kind === "funnel") return funnelPlan(props, drawn, from);
22
+ return overTime(props, drawn, kind, from) ?? byCategory(props, drawn, kind, from);
23
+ }
24
+ /**
25
+ * The row an item of a stop opens, with the series it is a value of: that series' row at the
26
+ * stop's point; none for an item no one row stands behind.
27
+ */
28
+ function rowOf(plan, stop, item) {
29
+ const point = plan.pointOf(stop);
30
+ const series = plan.seriesOf?.(item, stop);
31
+ const row = point === void 0 || series === void 0 ? void 0 : plan.drawn.rowAt(point, series.key);
32
+ return row === void 0 || series === void 0 ? void 0 : {
33
+ row,
34
+ series
35
+ };
36
+ }
37
+ export { planOf, rowOf };
@@ -0,0 +1,22 @@
1
+ // src/point-keys.ts
2
+ /**
3
+ * Each point, its place and its key: its raw x cell as JSON, the form `toSeries` keys points
4
+ * by, so two categories that read alike stay apart. A split's points are one per x cell
5
+ * already; a plain answer's are one per row, and nothing in an answer says no two rows share
6
+ * an x cell (with no key column, every row's reads as null), so a cell met again is told apart
7
+ * by how many times it has come ("#2"), which no JSON text ends with.
8
+ */
9
+ function keyedPoints(drawn) {
10
+ const seen = /* @__PURE__ */ new Map();
11
+ return drawn.points.map((point, i) => {
12
+ const raw = JSON.stringify(drawn.xAt(i));
13
+ const times = (seen.get(raw) ?? 0) + 1;
14
+ seen.set(raw, times);
15
+ return {
16
+ point,
17
+ i,
18
+ key: times === 1 ? raw : `${raw}#${String(times)}`
19
+ };
20
+ });
21
+ }
22
+ export { keyedPoints };
@@ -0,0 +1,99 @@
1
+ import { opens, valued } from "./opens.mjs";
2
+ import { useEffect, useRef } from "react";
3
+ import { nearestItem, nearestStop } from "derive-dashboards/charts";
4
+ // src/pointer.ts
5
+ /**
6
+ * Where a pointer is on the scene, in the scene's own pixels. It is read against the stage that
7
+ * holds the picture, not the chart's box: the box's padding and border are not the scene's.
8
+ */
9
+ function pointerAt(event, scene, stage) {
10
+ const svg = stage?.querySelector(".dd-chart-picture > svg")?.getBoundingClientRect();
11
+ const box = svg !== void 0 && svg.width > 0 ? svg : (stage ?? event.currentTarget).getBoundingClientRect();
12
+ const scale = box.width > 0 ? scene.width / box.width : 1;
13
+ return {
14
+ x: (event.clientX - box.left) * scale,
15
+ y: (event.clientY - box.top) * scale
16
+ };
17
+ }
18
+ /** The value under a pointer; none over a stop with no value, or on a scene with no stops. */
19
+ function under(event, scene, stage) {
20
+ const hover = scene?.hover;
21
+ if (scene === void 0 || hover === void 0) return;
22
+ const at = pointerAt(event, scene, stage);
23
+ const near = nearestStop(hover, at.x, at.y);
24
+ const found = near === void 0 ? void 0 : valued(hover.stops, hover.stops.indexOf(near));
25
+ const item = found === void 0 ? void 0 : nearestItem(found.stop.items, at);
26
+ return found === void 0 || item === void 0 ? void 0 : {
27
+ ...found,
28
+ at,
29
+ item,
30
+ place: found.stop.items.indexOf(item)
31
+ };
32
+ }
33
+ /** A touch that lands outside the chart's box clears what a finger lit in it. */
34
+ function useTouchAway(lit, stage, clear) {
35
+ const latest = useRef(clear);
36
+ useEffect(() => {
37
+ latest.current = clear;
38
+ });
39
+ useEffect(() => {
40
+ const page = stage.current?.ownerDocument;
41
+ if (!lit || page === void 0) return;
42
+ const away = (event) => {
43
+ const box = stage.current?.parentElement;
44
+ if (!(event.target instanceof Node) || box?.contains(event.target) !== true) latest.current();
45
+ };
46
+ page.addEventListener("pointerdown", away);
47
+ return () => {
48
+ page.removeEventListener("pointerdown", away);
49
+ };
50
+ }, [lit, stage]);
51
+ }
52
+ /** The handlers that light, clear and select by a mouse or a finger. */
53
+ function usePointer({ scene, callbacks, stage, stopped }) {
54
+ const touch = useRef(void 0);
55
+ useTouchAway(stopped.lit?.via === "touch", stage, stopped.clear);
56
+ const find = (event) => under(event, scene, stage.current);
57
+ const isLit = (found) => {
58
+ const was = stopped.current();
59
+ return found !== void 0 && was?.index === found.index && was.item === found.place;
60
+ };
61
+ const show = (found, via) => {
62
+ if (found === void 0) stopped.clear();
63
+ else stopped.light(found.index, via, {
64
+ at: scene?.hover?.snap === "y" ? { x: Math.round(found.at.x) } : void 0,
65
+ item: found.place
66
+ });
67
+ };
68
+ const onPointerDown = (event) => {
69
+ touch.current = event.pointerType === "touch" ? { moved: false } : void 0;
70
+ };
71
+ const onPointerMove = (event) => {
72
+ const found = find(event);
73
+ const finger = event.pointerType === "touch";
74
+ if (finger && touch.current !== void 0 && !isLit(found)) touch.current.moved = true;
75
+ show(found, finger ? "touch" : "pointer");
76
+ };
77
+ const onPointerLeave = (event) => {
78
+ if (event.pointerType !== "touch") stopped.clear();
79
+ };
80
+ const onPointerCancel = () => {
81
+ touch.current = void 0;
82
+ stopped.clear();
83
+ };
84
+ const onClick = (event) => {
85
+ const found = find(event);
86
+ const tapped = touch.current;
87
+ touch.current = void 0;
88
+ if (tapped !== void 0 && (tapped.moved || !isLit(found))) show(found, "touch");
89
+ else if (found !== void 0 && opens(callbacks, found.stop, found.item)) callbacks.onSelect?.(found.stop, found.item);
90
+ };
91
+ return {
92
+ onPointerDown,
93
+ onPointerMove,
94
+ onPointerLeave,
95
+ onPointerCancel,
96
+ onClick
97
+ };
98
+ }
99
+ export { usePointer };
@@ -0,0 +1,8 @@
1
+ import "react";
2
+ import "derive-dashboards/charts";
3
+ /** Words for navigating a chart table that needs more than one page. */
4
+ export type ReaderPages = {
5
+ previous: string;
6
+ next: string;
7
+ range: (first: number, last: number, total: number, axis: "rows" | "columns") => string;
8
+ };