derive-dashboards 0.7.1 → 0.9.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 (591) hide show
  1. package/CHANGELOG.md +513 -0
  2. package/README.md +8 -2
  3. package/dist/adapter/statement.mjs +9 -7
  4. package/dist/authorize.mjs +27 -6
  5. package/dist/body.mjs +28 -25
  6. package/dist/cache.d.mts +2 -2
  7. package/dist/charts/data/buckets.d.mts +25 -7
  8. package/dist/charts/data/buckets.mjs +92 -15
  9. package/dist/charts/data/clean.mjs +254 -12
  10. package/dist/charts/data/format.d.mts +7 -2
  11. package/dist/charts/data/format.mjs +68 -70
  12. package/dist/charts/data/input-error.d.mts +2 -0
  13. package/dist/charts/data/input-error.mjs +2 -0
  14. package/dist/charts/data/rows.d.mts +3 -1
  15. package/dist/charts/data/rows.mjs +4 -2
  16. package/dist/charts/data/types.d.mts +50 -7
  17. package/dist/charts/data/words.d.mts +13 -0
  18. package/dist/charts/data/words.mjs +8 -1
  19. package/dist/charts/describe.mjs +6 -6
  20. package/dist/charts/index.d.mts +14 -14
  21. package/dist/charts/index.mjs +4 -1
  22. package/dist/charts/kinds/area-marks.mjs +86 -44
  23. package/dist/charts/kinds/area.d.mts +3 -3
  24. package/dist/charts/kinds/area.mjs +32 -11
  25. package/dist/charts/kinds/bars-data.d.mts +3 -3
  26. package/dist/charts/kinds/bars-data.mjs +12 -6
  27. package/dist/charts/kinds/bars-layout.mjs +60 -6
  28. package/dist/charts/kinds/bars-marks.mjs +6 -6
  29. package/dist/charts/kinds/bars.d.mts +5 -3
  30. package/dist/charts/kinds/bars.mjs +39 -6
  31. package/dist/charts/kinds/columns-data.mjs +14 -5
  32. package/dist/charts/kinds/columns-marks.mjs +52 -23
  33. package/dist/charts/kinds/columns.d.mts +2 -2
  34. package/dist/charts/kinds/columns.mjs +36 -10
  35. package/dist/charts/kinds/course-data.mjs +44 -0
  36. package/dist/charts/kinds/course-layout.mjs +77 -0
  37. package/dist/charts/kinds/course-marks.mjs +52 -0
  38. package/dist/charts/kinds/course-words.mjs +64 -0
  39. package/dist/charts/kinds/course.d.mts +10 -0
  40. package/dist/charts/kinds/course.mjs +55 -0
  41. package/dist/charts/kinds/dumbbell-data.d.mts +4 -4
  42. package/dist/charts/kinds/dumbbell-data.mjs +3 -3
  43. package/dist/charts/kinds/dumbbell-layout.mjs +17 -8
  44. package/dist/charts/kinds/dumbbell.d.mts +5 -3
  45. package/dist/charts/kinds/dumbbell.mjs +35 -4
  46. package/dist/charts/kinds/funnel-data.d.mts +3 -3
  47. package/dist/charts/kinds/funnel-data.mjs +11 -16
  48. package/dist/charts/kinds/funnel-layout.mjs +7 -6
  49. package/dist/charts/kinds/funnel.d.mts +5 -4
  50. package/dist/charts/kinds/funnel.mjs +33 -6
  51. package/dist/charts/kinds/grid-data.d.mts +3 -3
  52. package/dist/charts/kinds/grid-data.mjs +55 -13
  53. package/dist/charts/kinds/grid-layout.mjs +88 -13
  54. package/dist/charts/kinds/grid-legend.mjs +60 -0
  55. package/dist/charts/kinds/grid-marks.mjs +81 -32
  56. package/dist/charts/kinds/grid-time.mjs +19 -5
  57. package/dist/charts/kinds/grid-words.mjs +57 -35
  58. package/dist/charts/kinds/grid.d.mts +7 -4
  59. package/dist/charts/kinds/grid.mjs +51 -9
  60. package/dist/charts/kinds/histogram-data.mjs +68 -26
  61. package/dist/charts/kinds/histogram-layout.mjs +4 -3
  62. package/dist/charts/kinds/histogram-words.mjs +2 -3
  63. package/dist/charts/kinds/histogram.d.mts +2 -2
  64. package/dist/charts/kinds/histogram.mjs +17 -1
  65. package/dist/charts/kinds/line-marks.mjs +19 -11
  66. package/dist/charts/kinds/line.d.mts +2 -2
  67. package/dist/charts/kinds/line.mjs +21 -3
  68. package/dist/charts/kinds/multiples-grid.mjs +57 -27
  69. package/dist/charts/kinds/multiples-head.mjs +52 -22
  70. package/dist/charts/kinds/multiples-layout.mjs +106 -52
  71. package/dist/charts/kinds/multiples-marks.mjs +6 -5
  72. package/dist/charts/kinds/multiples-words.mjs +53 -38
  73. package/dist/charts/kinds/multiples.d.mts +2 -2
  74. package/dist/charts/kinds/multiples.mjs +35 -7
  75. package/dist/charts/kinds/row-chart.d.mts +7 -0
  76. package/dist/charts/kinds/row-chart.mjs +47 -10
  77. package/dist/charts/kinds/row-marks.mjs +5 -5
  78. package/dist/charts/kinds/scatter-data.d.mts +5 -5
  79. package/dist/charts/kinds/scatter-data.mjs +6 -6
  80. package/dist/charts/kinds/scatter-marks.mjs +46 -19
  81. package/dist/charts/kinds/scatter-words.mjs +8 -8
  82. package/dist/charts/kinds/scatter.d.mts +5 -3
  83. package/dist/charts/kinds/scatter.mjs +18 -0
  84. package/dist/charts/kinds/stat-data.mjs +7 -7
  85. package/dist/charts/kinds/stat-marks.mjs +2 -2
  86. package/dist/charts/kinds/stat.d.mts +4 -4
  87. package/dist/charts/kinds/stat.mjs +19 -0
  88. package/dist/charts/kinds/time-chart.mjs +13 -4
  89. package/dist/charts/kinds/time-frame.mjs +50 -19
  90. package/dist/charts/kinds/time-plan.mjs +29 -2
  91. package/dist/charts/kinds/time-plot.mjs +1 -1
  92. package/dist/charts/kinds/time-stops.mjs +58 -29
  93. package/dist/charts/kinds/waterfall-data.d.mts +3 -3
  94. package/dist/charts/kinds/waterfall-data.mjs +2 -2
  95. package/dist/charts/kinds/waterfall.d.mts +5 -4
  96. package/dist/charts/kinds/waterfall.mjs +29 -2
  97. package/dist/charts/layout/frame.mjs +5 -3
  98. package/dist/charts/layout/stack.mjs +43 -22
  99. package/dist/charts/marks/axes.mjs +12 -6
  100. package/dist/charts/marks/budget.mjs +14 -0
  101. package/dist/charts/marks/end-labels.mjs +24 -10
  102. package/dist/charts/marks/legend.mjs +19 -8
  103. package/dist/charts/marks/lines.mjs +3 -3
  104. package/dist/charts/marks/more.mjs +79 -13
  105. package/dist/charts/marks/notes.mjs +12 -6
  106. package/dist/charts/marks/series-line.mjs +14 -10
  107. package/dist/charts/marks/thin.mjs +16 -33
  108. package/dist/charts/marks/x-axis.mjs +3 -2
  109. package/dist/charts/scale/calendar.mjs +41 -26
  110. package/dist/charts/scale/linear.mjs +58 -0
  111. package/dist/charts/scale/value.d.mts +21 -0
  112. package/dist/charts/scale/value.mjs +67 -9
  113. package/dist/charts/scene/lazy.mjs +27 -0
  114. package/dist/charts/scene/markup.mjs +2 -1
  115. package/dist/charts/scene/svg.mjs +20 -8
  116. package/dist/charts/scene/types.d.mts +34 -0
  117. package/dist/charts/text/measure.mjs +33 -3
  118. package/dist/charts/theme.d.mts +25 -25
  119. package/dist/charts/theme.mjs +47 -30
  120. package/dist/charts-react/Chart.d.mts +20 -0
  121. package/dist/charts-react/Chart.mjs +9 -67
  122. package/dist/charts-react/Reader.mjs +50 -96
  123. package/dist/charts-react/box.mjs +106 -0
  124. package/dist/charts-react/bucket-names.mjs +9 -24
  125. package/dist/charts-react/columns-picture.mjs +12 -0
  126. package/dist/charts-react/exact-sum.mjs +4 -7
  127. package/dist/charts-react/from-answer.mjs +9 -4
  128. package/dist/charts-react/index.d.mts +9 -2
  129. package/dist/charts-react/index.mjs +9 -2
  130. package/dist/charts-react/kinds/area.d.mts +4 -0
  131. package/dist/charts-react/kinds/area.mjs +38 -0
  132. package/dist/charts-react/kinds/bar.d.mts +4 -0
  133. package/dist/charts-react/kinds/bar.mjs +15 -0
  134. package/dist/charts-react/kinds/funnel.d.mts +4 -0
  135. package/dist/charts-react/kinds/funnel.mjs +13 -0
  136. package/dist/charts-react/kinds/heatmap.d.mts +4 -0
  137. package/dist/charts-react/kinds/heatmap.mjs +13 -0
  138. package/dist/charts-react/kinds/line.d.mts +4 -0
  139. package/dist/charts-react/kinds/line.mjs +20 -0
  140. package/dist/charts-react/kinds/multiples.d.mts +4 -0
  141. package/dist/charts-react/kinds/multiples.mjs +33 -0
  142. package/dist/charts-react/kinds/number.d.mts +5 -0
  143. package/dist/charts-react/kinds/number.mjs +86 -0
  144. package/dist/charts-react/plan-bars.mjs +15 -8
  145. package/dist/charts-react/plan-funnel.mjs +3 -1
  146. package/dist/charts-react/plan-grid.mjs +14 -5
  147. package/dist/charts-react/plan-of.mjs +17 -0
  148. package/dist/charts-react/plan-parts.mjs +16 -5
  149. package/dist/charts-react/plan-time.mjs +4 -53
  150. package/dist/charts-react/reader-page.d.mts +1 -1
  151. package/dist/charts-react/reader-page.mjs +19 -9
  152. package/dist/charts-react/renderers.d.mts +14 -0
  153. package/dist/charts-react/renderers.mjs +22 -0
  154. package/dist/charts-react/table.d.mts +1 -0
  155. package/dist/charts-react/table.mjs +108 -0
  156. package/dist/charts-react/tiles.mjs +21 -49
  157. package/dist/charts-react/useScene.mjs +45 -17
  158. package/dist/charts-react/words.mjs +19 -0
  159. package/dist/checks.mjs +97 -19
  160. package/dist/cli/add.mjs +4 -3
  161. package/dist/cli/doctor.mjs +2 -2
  162. package/dist/core/conformance/index.d.mts +5 -2
  163. package/dist/core/conformance/index.mjs +5 -2
  164. package/dist/core/conformance/memory/aggregate.mjs +11 -6
  165. package/dist/core/conformance/memory/rows.d.mts +7 -3
  166. package/dist/core/conformance/memory/rows.mjs +19 -13
  167. package/dist/core/conformance/memory/source.mjs +4 -4
  168. package/dist/core/document/control-fields.d.mts +20 -0
  169. package/dist/core/document/control-fields.mjs +117 -0
  170. package/dist/core/document/display-comparisons.d.mts +17 -0
  171. package/dist/core/document/display-comparisons.mjs +15 -4
  172. package/dist/core/document/display-entries.d.mts +14 -0
  173. package/dist/core/document/display-entries.mjs +25 -9
  174. package/dist/core/document/display-validation.d.mts +5 -1
  175. package/dist/core/document/display-validation.mjs +14 -7
  176. package/dist/core/document/display.d.mts +11 -8
  177. package/dist/core/document/display.mjs +26 -3
  178. package/dist/core/document/layout.d.mts +8 -9
  179. package/dist/core/document/layout.mjs +23 -6
  180. package/dist/core/document/stacked.d.mts +0 -7
  181. package/dist/core/document/types.mjs +8 -6
  182. package/dist/core/document/upgrade.d.mts +1 -0
  183. package/dist/core/document/upgrade.mjs +4 -2
  184. package/dist/core/engine/access.mjs +3 -3
  185. package/dist/core/engine/assert.mjs +4 -2
  186. package/dist/core/engine/bucket.mjs +2 -2
  187. package/dist/core/engine/checks.mjs +6 -7
  188. package/dist/core/engine/custom/ask.mjs +22 -2
  189. package/dist/core/engine/custom/cells.mjs +22 -22
  190. package/dist/core/engine/custom/level.mjs +12 -13
  191. package/dist/core/engine/custom/measures.mjs +12 -9
  192. package/dist/core/engine/custom/reader.mjs +3 -1
  193. package/dist/core/engine/custom/records.mjs +8 -7
  194. package/dist/core/engine/custom/unread.mjs +78 -0
  195. package/dist/core/engine/custom/where.mjs +15 -10
  196. package/dist/core/engine/index.d.mts +2 -13
  197. package/dist/core/engine/index.mjs +2 -12
  198. package/dist/core/engine/measure.mjs +1 -0
  199. package/dist/core/engine/members.mjs +7 -3
  200. package/dist/core/engine/nan.mjs +10 -1
  201. package/dist/core/engine/native.mjs +2 -20
  202. package/dist/core/engine/numbers.mjs +26 -14
  203. package/dist/core/engine/postgres.mjs +9 -5
  204. package/dist/core/engine/prepare.mjs +4 -4
  205. package/dist/core/engine/rank-sets.mjs +1 -1
  206. package/dist/core/engine/read.mjs +5 -4
  207. package/dist/core/engine/reader.d.mts +6 -0
  208. package/dist/core/engine/record-layout.mjs +3 -3
  209. package/dist/core/engine/run.mjs +77 -20
  210. package/dist/core/engine/segmented.d.mts +2 -1
  211. package/dist/core/engine/segmented.mjs +19 -12
  212. package/dist/core/engine/series.mjs +1 -1
  213. package/dist/core/engine/shape.mjs +8 -8
  214. package/dist/core/engine/sql-partition.mjs +2 -2
  215. package/dist/core/engine/sql-pass.mjs +3 -2
  216. package/dist/core/engine/sql-reader.mjs +13 -5
  217. package/dist/core/engine/sql-reads.mjs +2 -1
  218. package/dist/core/engine/sql-records.mjs +2 -2
  219. package/dist/core/engine/sql-split.mjs +1 -1
  220. package/dist/core/engine/sql-unread.mjs +70 -0
  221. package/dist/core/engine/time.mjs +2 -1
  222. package/dist/core/engine/types.d.mts +17 -0
  223. package/dist/core/engine/version.d.mts +1 -1
  224. package/dist/core/engine/version.mjs +1 -1
  225. package/dist/core/error/codes.d.mts +24 -1
  226. package/dist/core/error/codes.mjs +23 -3
  227. package/dist/core/error/refusal.d.mts +8 -3
  228. package/dist/core/error/refusal.mjs +6 -1
  229. package/dist/core/exact/decimal.d.mts +1 -14
  230. package/dist/core/exact/decimal.mjs +9 -19
  231. package/dist/core/exact/stored.d.mts +9 -0
  232. package/dist/core/exact/stored.mjs +38 -0
  233. package/dist/core/exact/text.d.mts +16 -1
  234. package/dist/core/exact/text.mjs +50 -1
  235. package/dist/core/format/digits.mjs +55 -0
  236. package/dist/core/format/index.d.mts +16 -0
  237. package/dist/core/format/index.mjs +27 -0
  238. package/dist/core/format/number.d.mts +27 -0
  239. package/dist/core/format/number.mjs +158 -0
  240. package/dist/core/format/write.d.mts +6 -0
  241. package/dist/core/format/write.mjs +57 -0
  242. package/dist/core/index.d.mts +43 -33
  243. package/dist/core/index.mjs +31 -28
  244. package/dist/core/model/defaults.d.mts +18 -1
  245. package/dist/core/model/defaults.mjs +19 -1
  246. package/dist/core/model/define.d.mts +17 -8
  247. package/dist/core/model/define.mjs +2 -0
  248. package/dist/core/model/member.d.mts +5 -3
  249. package/dist/core/model/member.mjs +33 -6
  250. package/dist/core/model/storage.mjs +40 -12
  251. package/dist/core/model/types.d.mts +17 -1
  252. package/dist/core/model/types.mjs +5 -0
  253. package/dist/core/model/validate/expr.d.mts +1 -7
  254. package/dist/core/model/validate/fields.d.mts +2 -0
  255. package/dist/core/model/validate/fields.mjs +14 -7
  256. package/dist/core/model/validate/issues.mjs +5 -1
  257. package/dist/core/model/validate/known-members.mjs +6 -5
  258. package/dist/core/model/validate/shape.mjs +36 -3
  259. package/dist/core/model/validate/source.mjs +2 -2
  260. package/dist/core/oracle/data.d.mts +4 -2
  261. package/dist/core/oracle/evaluate.d.mts +19 -1
  262. package/dist/core/oracle/evaluate.mjs +56 -10
  263. package/dist/core/oracle/expr.mjs +1 -1
  264. package/dist/core/oracle/facts.mjs +12 -5
  265. package/dist/core/oracle/measure.mjs +1 -1
  266. package/dist/core/oracle/request.mjs +39 -4
  267. package/dist/core/oracle/segmented.d.mts +3 -1
  268. package/dist/core/oracle/segmented.mjs +19 -13
  269. package/dist/core/oracle/unread.mjs +32 -0
  270. package/dist/core/oracle/visibility.mjs +4 -3
  271. package/dist/core/policy/bind.d.mts +2 -11
  272. package/dist/core/policy/bind.mjs +1 -1
  273. package/dist/core/policy/match.mjs +1 -1
  274. package/dist/core/query/closure.d.mts +7 -2
  275. package/dist/core/query/closure.mjs +29 -12
  276. package/dist/core/query/compose-tile.d.mts +3 -2
  277. package/dist/core/query/compose-tile.mjs +32 -13
  278. package/dist/core/query/compose.d.mts +0 -5
  279. package/dist/core/query/drill/internal.d.mts +5 -5
  280. package/dist/core/query/drill/internal.mjs +11 -0
  281. package/dist/core/query/drill/links.d.mts +2 -3
  282. package/dist/core/query/drill/links.mjs +18 -4
  283. package/dist/core/query/drill/selection.d.mts +8 -2
  284. package/dist/core/query/drill/selection.mjs +14 -3
  285. package/dist/core/query/drill/synthetic.mjs +1 -1
  286. package/dist/core/query/drill/time.mjs +11 -10
  287. package/dist/core/query/filter.d.mts +1 -6
  288. package/dist/core/query/filter.mjs +1 -4
  289. package/dist/core/query/fold.mjs +23 -0
  290. package/dist/core/query/segments.mjs +42 -3
  291. package/dist/core/query/to-wire.d.mts +7 -0
  292. package/dist/core/query/to-wire.mjs +14 -2
  293. package/dist/core/query/types.d.mts +30 -13
  294. package/dist/core/result/columns.mjs +23 -13
  295. package/dist/core/result/number.mjs +3 -3
  296. package/dist/core/result/status.d.mts +13 -0
  297. package/dist/core/result/status.mjs +18 -0
  298. package/dist/core/result/time-axis.d.mts +14 -13
  299. package/dist/core/result/time-axis.mjs +20 -2
  300. package/dist/core/result/types.d.mts +33 -3
  301. package/dist/core/result/whole.d.mts +23 -0
  302. package/dist/core/result/whole.mjs +27 -0
  303. package/dist/core/schema/agent-query.d.mts +89 -0
  304. package/dist/core/schema/agent-query.mjs +115 -0
  305. package/dist/core/schema/aliases.mjs +1 -52
  306. package/dist/core/schema/answer-parts.mjs +17 -13
  307. package/dist/core/schema/answers.d.mts +787 -319
  308. package/dist/core/schema/commands.d.mts +33 -23
  309. package/dist/core/schema/commands.mjs +26 -18
  310. package/dist/core/schema/custom.mjs +46 -45
  311. package/dist/core/schema/document.d.mts +32 -27
  312. package/dist/core/schema/document.mjs +61 -81
  313. package/dist/core/schema/drill-answers.mjs +4 -1
  314. package/dist/core/schema/drill.d.mts +14 -9
  315. package/dist/core/schema/drill.mjs +23 -22
  316. package/dist/core/schema/index.d.mts +5 -3
  317. package/dist/core/schema/index.mjs +5 -3
  318. package/dist/core/schema/options.d.mts +92 -0
  319. package/dist/core/schema/options.mjs +104 -0
  320. package/dist/core/schema/picks.d.mts +2 -2
  321. package/dist/core/schema/picks.mjs +7 -6
  322. package/dist/core/schema/query.d.mts +9 -83
  323. package/dist/core/schema/query.mjs +49 -73
  324. package/dist/core/schema/strict.d.mts +3 -0
  325. package/dist/core/schema/strict.mjs +91 -0
  326. package/dist/core/schema/union-error.mjs +30 -7
  327. package/dist/core/schema/view.d.mts +4 -3
  328. package/dist/core/schema/view.mjs +16 -11
  329. package/dist/core/store/ddl.d.mts +0 -2
  330. package/dist/core/store/ddl.mjs +1 -5
  331. package/dist/core/time/bucket.d.mts +1 -18
  332. package/dist/core/time/bucket.mjs +12 -8
  333. package/dist/core/time/compare.mjs +3 -2
  334. package/dist/core/time/index.d.mts +7 -8
  335. package/dist/core/time/instant.d.mts +15 -9
  336. package/dist/core/time/instant.mjs +23 -9
  337. package/dist/core/time/range.d.mts +3 -15
  338. package/dist/core/time/range.mjs +17 -7
  339. package/dist/core/time/stored.d.mts +8 -5
  340. package/dist/core/time/stored.mjs +51 -15
  341. package/dist/core/time/temporal.d.mts +1 -5
  342. package/dist/core/time/temporal.mjs +9 -4
  343. package/dist/core/time/text-time.d.mts +31 -2
  344. package/dist/core/time/text-time.mjs +139 -22
  345. package/dist/core/time/zone.d.mts +6 -1
  346. package/dist/core/time/zone.mjs +13 -4
  347. package/dist/core/types/api.d.mts +1 -1
  348. package/dist/core/types/api.mjs +1 -1
  349. package/dist/core/types/dashboard.d.mts +185 -0
  350. package/dist/core/types/dashboard.mjs +26 -0
  351. package/dist/core/types/drill-api.d.mts +14 -2
  352. package/dist/core/types/infer.d.mts +0 -4
  353. package/dist/core/types/options-check.d.mts +42 -0
  354. package/dist/core/types/options-check.mjs +90 -0
  355. package/dist/core/types/options.d.mts +14 -8
  356. package/dist/core/value/casefold.d.mts +1 -3
  357. package/dist/core/value/stored.d.mts +26 -0
  358. package/dist/core/value/stored.mjs +28 -0
  359. package/dist/cursor-seal.mjs +37 -9
  360. package/dist/dashboard-documents.d.mts +14 -6
  361. package/dist/dashboard-documents.mjs +32 -12
  362. package/dist/dashboards.mjs +10 -9
  363. package/dist/drill-access.mjs +6 -6
  364. package/dist/drill-change.mjs +18 -20
  365. package/dist/drill-comparison.mjs +2 -1
  366. package/dist/drill-crumbs.mjs +63 -28
  367. package/dist/drill-distinct.mjs +2 -1
  368. package/dist/drill-explain.mjs +1 -1
  369. package/dist/drill-items.mjs +1 -1
  370. package/dist/drill-open.mjs +39 -23
  371. package/dist/drill-seal.mjs +41 -13
  372. package/dist/drill-share.mjs +1 -1
  373. package/dist/drill-summary.mjs +2 -1
  374. package/dist/drill-targets.mjs +4 -4
  375. package/dist/drill-views.mjs +4 -3
  376. package/dist/drill.mjs +1 -1
  377. package/dist/editing.mjs +5 -3
  378. package/dist/endpoints/index.d.mts +29 -8
  379. package/dist/endpoints/index.mjs +4 -1
  380. package/dist/endpoints/meta.mjs +4 -3
  381. package/dist/endpoints/query.mjs +5 -2
  382. package/dist/endpoints/read.mjs +7 -6
  383. package/dist/endpoints/versions.mjs +2 -1
  384. package/dist/execute.d.mts +3 -0
  385. package/dist/execute.mjs +23 -12
  386. package/dist/grant.d.mts +9 -0
  387. package/dist/grant.mjs +43 -0
  388. package/dist/handler.mjs +8 -13
  389. package/dist/http.d.mts +6 -2
  390. package/dist/http.mjs +6 -2
  391. package/dist/index.d.mts +25 -4
  392. package/dist/index.mjs +91 -40
  393. package/dist/llms.txt +3 -3
  394. package/dist/mcp/api.mjs +2 -1
  395. package/dist/mcp/query.mjs +3 -8
  396. package/dist/mcp/resolve.mjs +9 -2
  397. package/dist/node/index.d.mts +36 -0
  398. package/dist/node/index.mjs +89 -0
  399. package/dist/node/request.d.mts +12 -0
  400. package/dist/node/request.mjs +119 -0
  401. package/dist/node/response.mjs +58 -0
  402. package/dist/principal.mjs +15 -7
  403. package/dist/react/Canvas.mjs +90 -69
  404. package/dist/react/Cell.mjs +2 -1
  405. package/dist/react/Dashboard.d.mts +15 -1
  406. package/dist/react/Dashboard.mjs +43 -42
  407. package/dist/react/DashboardList.mjs +9 -4
  408. package/dist/react/Editing.d.mts +9 -0
  409. package/dist/react/Editing.mjs +8 -3
  410. package/dist/react/Grid.mjs +1 -1
  411. package/dist/react/Header.mjs +25 -52
  412. package/dist/react/History.mjs +3 -2
  413. package/dist/react/LoadFailed.mjs +59 -0
  414. package/dist/react/Panel.d.mts +1 -1
  415. package/dist/react/Panel.mjs +1 -1
  416. package/dist/react/Parts.d.mts +34 -0
  417. package/dist/react/Parts.mjs +9 -6
  418. package/dist/react/ReviewPanel.mjs +1 -1
  419. package/dist/react/RowBody.d.mts +2 -0
  420. package/dist/react/RowBody.mjs +5 -1
  421. package/dist/react/Share.mjs +153 -0
  422. package/dist/react/TabStrip.mjs +37 -0
  423. package/dist/react/Tile.d.mts +3 -1
  424. package/dist/react/Tile.mjs +89 -92
  425. package/dist/react/TileState.mjs +117 -0
  426. package/dist/react/ago.mjs +45 -0
  427. package/dist/react/arrange.mjs +1 -1
  428. package/dist/react/board.mjs +2 -2
  429. package/dist/react/bucket-name.d.mts +8 -0
  430. package/dist/react/bucket-name.mjs +13 -0
  431. package/dist/react/builder/DisplayOptions.mjs +219 -0
  432. package/dist/react/builder/Preview.mjs +13 -13
  433. package/dist/react/builder/RangeEditor.mjs +4 -3
  434. package/dist/react/builder/WidgetBuilder.d.mts +1 -7
  435. package/dist/react/builder/WidgetBuilder.mjs +12 -3
  436. package/dist/react/builder/base.d.mts +13 -2
  437. package/dist/react/builder/base.mjs +70 -12
  438. package/dist/react/builder/display.d.mts +3 -0
  439. package/dist/react/builder/display.mjs +256 -0
  440. package/dist/react/builder/labels.mjs +19 -5
  441. package/dist/react/builder/options.mjs +11 -6
  442. package/dist/react/builder/state.mjs +25 -3
  443. package/dist/react/builder/useBuilder.d.mts +7 -1
  444. package/dist/react/builder/useBuilder.mjs +6 -9
  445. package/dist/react/builder/usePreview.mjs +3 -2
  446. package/dist/react/builder/words.d.mts +16 -1
  447. package/dist/react/builder/words.mjs +41 -1
  448. package/dist/react/change-text.mjs +149 -0
  449. package/dist/react/client.d.mts +9 -0
  450. package/dist/react/client.mjs +105 -14
  451. package/dist/react/columns.mjs +9 -1
  452. package/dist/react/context.d.mts +24 -3
  453. package/dist/react/context.mjs +23 -7
  454. package/dist/react/dates-shown.mjs +76 -0
  455. package/dist/react/draft.mjs +3 -2
  456. package/dist/react/drill/Bars.mjs +12 -16
  457. package/dist/react/drill/Comparison.mjs +1 -1
  458. package/dist/react/drill/DrillPanel.d.mts +1 -1
  459. package/dist/react/drill/DrillPanel.mjs +2 -1
  460. package/dist/react/drill/Header.mjs +65 -12
  461. package/dist/react/drill/Items.d.mts +1 -1
  462. package/dist/react/drill/Notes.mjs +10 -7
  463. package/dist/react/drill/PanelStates.mjs +8 -1
  464. package/dist/react/drill/Trend.mjs +10 -5
  465. package/dist/react/drill/board.d.mts +1 -1
  466. package/dist/react/drill/board.mjs +1 -0
  467. package/dist/react/drill/host.mjs +4 -1
  468. package/dist/react/drill/lazy.mjs +2 -27
  469. package/dist/react/drill/props.d.mts +19 -8
  470. package/dist/react/drill/props.mjs +62 -18
  471. package/dist/react/drill/state.d.mts +15 -5
  472. package/dist/react/drill/state.mjs +12 -3
  473. package/dist/react/drill/words.d.mts +46 -3
  474. package/dist/react/drill/words.mjs +30 -5
  475. package/dist/react/english.mjs +33 -8
  476. package/dist/react/export/ExportButton.mjs +4 -1
  477. package/dist/react/export/csv.d.mts +7 -2
  478. package/dist/react/export/csv.mjs +24 -7
  479. package/dist/react/failure-words.mjs +60 -0
  480. package/dist/react/filters/bar.d.mts +1 -1
  481. package/dist/react/filters/bar.mjs +4 -1
  482. package/dist/react/filters/calendar.mjs +23 -8
  483. package/dist/react/filters/chip.mjs +7 -3
  484. package/dist/react/filters/context.d.mts +13 -1
  485. package/dist/react/filters/context.mjs +1 -1
  486. package/dist/react/filters/dates-said.mjs +57 -0
  487. package/dist/react/filters/days.d.mts +3 -4
  488. package/dist/react/filters/days.mjs +10 -17
  489. package/dist/react/filters/hooks.d.mts +11 -0
  490. package/dist/react/filters/hooks.mjs +10 -6
  491. package/dist/react/filters/menu-search.mjs +17 -9
  492. package/dist/react/filters/menu.mjs +10 -8
  493. package/dist/react/filters/phone.mjs +41 -16
  494. package/dist/react/filters/place.mjs +40 -0
  495. package/dist/react/filters/popover.mjs +18 -13
  496. package/dist/react/filters/rules.d.mts +4 -3
  497. package/dist/react/filters/rules.mjs +3 -3
  498. package/dist/react/filters/sheet.mjs +7 -3
  499. package/dist/react/filters/state.mjs +6 -1
  500. package/dist/react/filters/values.mjs +24 -7
  501. package/dist/react/filters/words.d.mts +13 -0
  502. package/dist/react/filters/words.mjs +5 -0
  503. package/dist/react/format-time.d.mts +17 -6
  504. package/dist/react/format-time.mjs +152 -33
  505. package/dist/react/format.d.mts +3 -3
  506. package/dist/react/format.mjs +35 -122
  507. package/dist/react/headline.d.mts +12 -0
  508. package/dist/react/headline.mjs +107 -0
  509. package/dist/react/index.d.mts +20 -17
  510. package/dist/react/index.mjs +13 -10
  511. package/dist/react/lazy.mjs +38 -0
  512. package/dist/react/messages.d.mts +78 -2
  513. package/dist/react/now.mjs +38 -0
  514. package/dist/react/place.mjs +4 -2
  515. package/dist/react/read.d.mts +1 -0
  516. package/dist/react/read.mjs +140 -9
  517. package/dist/react/renderers/exact.mjs +31 -59
  518. package/dist/react/renderers/index.d.mts +27 -6
  519. package/dist/react/renderers/index.mjs +154 -92
  520. package/dist/react/renderers/list-parts.mjs +24 -0
  521. package/dist/react/renderers/list.d.mts +1 -0
  522. package/dist/react/renderers/list.mjs +99 -43
  523. package/dist/react/renderers/more-rows.mjs +75 -0
  524. package/dist/react/renderers/number-before.mjs +320 -0
  525. package/dist/react/renderers/number-period.mjs +54 -0
  526. package/dist/react/renderers/number-whole.mjs +29 -0
  527. package/dist/react/renderers/props.d.mts +24 -1
  528. package/dist/react/renderers/props.mjs +8 -0
  529. package/dist/react/renderers/table-cells.mjs +137 -31
  530. package/dist/react/renderers/table-fit.mjs +55 -10
  531. package/dist/react/renderers/table-measure.mjs +29 -9
  532. package/dist/react/renderers/table-row.mjs +14 -9
  533. package/dist/react/renderers/table-scale.mjs +2 -3
  534. package/dist/react/renderers/table-sort.mjs +3 -2
  535. package/dist/react/renderers/table-whole.mjs +37 -0
  536. package/dist/react/renderers/table.mjs +73 -53
  537. package/dist/react/review.d.mts +7 -0
  538. package/dist/react/review.mjs +35 -8
  539. package/dist/react/roving.d.mts +6 -0
  540. package/dist/react/roving.mjs +123 -0
  541. package/dist/react/says-dates.d.mts +7 -0
  542. package/dist/react/says-dates.mjs +51 -0
  543. package/dist/react/series.mjs +5 -6
  544. package/dist/react/stable.mjs +1 -1
  545. package/dist/react/tabs/EditTabs.mjs +125 -0
  546. package/dist/react/tabs/NameField.mjs +72 -0
  547. package/dist/react/tabs/TabMenu.mjs +175 -0
  548. package/dist/react/tabs/actions.mjs +37 -0
  549. package/dist/react/tabs/commands.mjs +76 -0
  550. package/dist/react/tabs/focus.mjs +22 -0
  551. package/dist/react/tabs/keys.mjs +28 -0
  552. package/dist/react/theme-unlayered.css +1 -1
  553. package/dist/react/theme.css +1 -1
  554. package/dist/react/tile-store.d.mts +4 -0
  555. package/dist/react/tile-store.mjs +93 -13
  556. package/dist/react/touch.d.mts +16 -0
  557. package/dist/react/touch.mjs +39 -0
  558. package/dist/react/useBoard.d.mts +6 -0
  559. package/dist/react/useBoard.mjs +1 -0
  560. package/dist/react/useDashboard.d.mts +2 -0
  561. package/dist/react/useDashboard.mjs +5 -2
  562. package/dist/react/useTiles.d.mts +3 -0
  563. package/dist/react/useTiles.mjs +73 -17
  564. package/dist/react/view-grid.mjs +2 -2
  565. package/dist/react/view.mjs +1 -1
  566. package/dist/recharts/axes.mjs +1 -1
  567. package/dist/recharts/axis.mjs +23 -73
  568. package/dist/recharts/bar.d.mts +2 -1
  569. package/dist/recharts/bar.mjs +140 -64
  570. package/dist/recharts/fit.mjs +33 -0
  571. package/dist/recharts/line.mjs +23 -17
  572. package/dist/recharts/marks.mjs +2 -1
  573. package/dist/recharts/parts.mjs +19 -14
  574. package/dist/recharts/table.mjs +8 -3
  575. package/dist/refusal.mjs +46 -0
  576. package/dist/registry/filter-bar.json +1 -1
  577. package/dist/skills/derive-dashboards/SKILL.md +25 -9
  578. package/dist/tile-doc.mjs +1 -1
  579. package/package.json +21 -6
  580. package/dist/charts-react/plan.d.mts +0 -3
  581. package/dist/charts-react/plan.mjs +0 -37
  582. package/dist/charts-react/tiles.d.mts +0 -24
  583. package/dist/core/policy/match.d.mts +0 -16
  584. package/dist/core/schema/aliases.d.mts +0 -7
  585. package/dist/core/time/compare.d.mts +0 -30
  586. package/dist/react/EditBar.d.mts +0 -16
  587. package/dist/react/History.d.mts +0 -30
  588. package/dist/react/ReviewPanel.d.mts +0 -15
  589. package/dist/react/digits.mjs +0 -46
  590. package/dist/react/drill/trend-touch.mjs +0 -33
  591. package/dist/react/renderers/exact.d.mts +0 -6
@@ -1,8 +1,8 @@
1
1
  import { ItemParts } from "./item-parts.mjs";
2
2
  import "./item-type.mjs";
3
3
  import { Item } from "../index.mjs";
4
- import { ComponentType, MouseEvent, ReactNode } from "react";
5
4
  import { DrillItem, DrillItemsView, ItemLinks } from "derive-dashboards/core";
5
+ import { ComponentType, MouseEvent, ReactNode } from "react";
6
6
  /** What a host's own item row is given: the item's link and parts, and how to open it. */
7
7
  export type ItemHelpers = ItemParts & {
8
8
  href?: string;
@@ -1,6 +1,6 @@
1
1
  import { useDashboards } from "../context.mjs";
2
- import { formatCell } from "../format.mjs";
3
2
  import { formatPeriod } from "../format-time.mjs";
3
+ import { formatFull } from "../headline.mjs";
4
4
  import { trendWindowLabel } from "./words.mjs";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  // src/drill/Notes.tsx
@@ -23,24 +23,27 @@ function TrendPeriod({ range, summary }) {
23
23
  children: summary && !selected ? window(period) : period
24
24
  });
25
25
  }
26
- function Period({ summary }) {
26
+ function Period({ summary, range }) {
27
27
  const format = useDashboards();
28
28
  const { messages } = format;
29
- if (summary.range === void 0) return null;
30
- const period = formatPeriod(summary.range, format, summary.receipt.calendar.timezone);
29
+ if (range === void 0) return null;
30
+ const period = formatPeriod(range, format, summary.receipt.calendar.timezone);
31
31
  return /* @__PURE__ */ jsx("p", {
32
32
  className: "dd-drill-period",
33
33
  children: summary.previous === true ? messages.drillEarlier(period) : period
34
34
  });
35
35
  }
36
36
  /** The notes under the value: the period before, a moved value (the viewer's own link only), a shared link's limits. */
37
- function Notes({ summary, value, onRefresh }) {
37
+ function Notes({ summary, period, value, onRefresh }) {
38
38
  const format = useDashboards();
39
39
  const { messages } = format;
40
40
  const clicked = summary.clicked;
41
- const previous = clicked === void 0 || summary.foreign === true ? void 0 : formatCell(clicked, valueColumn(summary), format);
41
+ const previous = clicked === void 0 || summary.foreign === true ? void 0 : formatFull(clicked, valueColumn(summary), format);
42
42
  return /* @__PURE__ */ jsxs(Fragment, { children: [
43
- /* @__PURE__ */ jsx(Period, { summary }),
43
+ /* @__PURE__ */ jsx(Period, {
44
+ summary,
45
+ range: period ?? summary.range
46
+ }),
44
47
  previous !== void 0 && previous !== value ? /* @__PURE__ */ jsxs("p", {
45
48
  className: "dd-tile-note",
46
49
  role: "status",
@@ -1,6 +1,8 @@
1
1
  import { useDashboards } from "../context.mjs";
2
2
  import { DashboardsError } from "../errors.mjs";
3
+ import { forSetup, tellSetup, turnedAway } from "../failure-words.mjs";
3
4
  import { countText } from "./counts.mjs";
5
+ import { useEffect } from "react";
4
6
  import { jsx, jsxs } from "react/jsx-runtime";
5
7
  // src/drill/PanelStates.tsx
6
8
  /** A failed read in words a person can act on: out of date (close it), or could not load (try again). */
@@ -8,11 +10,16 @@ function Failed({ d, close }) {
8
10
  const { messages } = useDashboards();
9
11
  const code = d.error instanceof DashboardsError ? d.error.code : void 0;
10
12
  const stale = code === "SELECTION_INVALID" || code === "DRILL_STALE";
13
+ const advice = d.error instanceof DashboardsError && forSetup(d.error) ? d.error.message : void 0;
14
+ useEffect(() => {
15
+ if (advice !== void 0) tellSetup(advice);
16
+ }, [advice]);
17
+ const failed = turnedAway(d.error) ? messages.dashboardSignedOut : messages.drillFailed;
11
18
  return /* @__PURE__ */ jsxs("p", {
12
19
  className: "dd-tile-error",
13
20
  role: "alert",
14
21
  children: [
15
- stale ? messages.drillStale : messages.drillFailed,
22
+ stale ? messages.drillStale : failed,
16
23
  " ",
17
24
  /* @__PURE__ */ jsx("button", {
18
25
  type: "button",
@@ -1,4 +1,4 @@
1
- import { useTouchPreview } from "./trend-touch.mjs";
1
+ import { useTapPreview } from "../touch.mjs";
2
2
  import { ENGLISH_DRILL, RECORD_PAGES } from "./words.mjs";
3
3
  import { memo, useCallback, useMemo, useState } from "react";
4
4
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -37,8 +37,11 @@ const Mark = memo(function Mark(props) {
37
37
  type: "button",
38
38
  "aria-label": label,
39
39
  tabIndex: props.tabIndex,
40
- onClick: () => {
41
- props.onOpen(selection);
40
+ onClick: (event) => {
41
+ event.currentTarget.focus({ preventScroll: true });
42
+ props.tap(index, () => {
43
+ props.onOpen(selection);
44
+ });
42
45
  },
43
46
  children: column
44
47
  })
@@ -51,6 +54,7 @@ const Marks = memo(function Marks(props) {
51
54
  active: i === props.active,
52
55
  tabIndex: i === props.entry ? 0 : -1,
53
56
  onOpen: props.onOpen,
57
+ tap: props.tap,
54
58
  onHover: props.onHover,
55
59
  onFocus: props.onFocus
56
60
  }, i));
@@ -99,7 +103,7 @@ function Axis({ bars }) {
99
103
  }
100
104
  function TrendPage(props) {
101
105
  const p = usePeriods(props.bars);
102
- const { selected, handlers } = useTouchPreview();
106
+ const { shown: selected, handlers, tap } = useTapPreview();
103
107
  const touched = selected === null ? void 0 : props.bars[selected];
104
108
  const selection = touched?.bar === p.active ? touched?.selection : void 0;
105
109
  return /* @__PURE__ */ jsxs("figure", {
@@ -134,7 +138,8 @@ function TrendPage(props) {
134
138
  active: p.at,
135
139
  entry: p.entry,
136
140
  onHover: p.setHover,
137
- onFocus: p.focusMark
141
+ onFocus: p.focusMark,
142
+ tap
138
143
  })
139
144
  }),
140
145
  /* @__PURE__ */ jsx(Axis, { bars: props.bars })
@@ -1,8 +1,8 @@
1
1
  import "../useBoard.mjs";
2
2
  import { ItemOptions } from "./Items.mjs";
3
3
  import { ViewChange } from "../view.mjs";
4
- import { ReactNode } from "react";
5
4
  import { DrillState } from "derive-dashboards/core";
5
+ import { ReactNode } from "react";
6
6
  /** A drill about to open: the host may take it (`preventDefault`) and open it its own way. */
7
7
  export type DrillEvent = {
8
8
  state: DrillState;
@@ -92,6 +92,7 @@ function DrillScope(props) {
92
92
  children: /* @__PURE__ */ jsx("div", {
93
93
  className: "dd-dashboard",
94
94
  "data-editing": board.edit.draft !== void 0,
95
+ "data-tiles": props.tiles,
95
96
  "data-panel": panel !== void 0,
96
97
  "data-drill": panel === void 0 && drilling,
97
98
  children: props.children
@@ -13,7 +13,10 @@ function useTileDrill(widgetId, result) {
13
13
  return tileDrill({
14
14
  answer: result,
15
15
  origin: host.origin(widgetId),
16
- format,
16
+ format: {
17
+ ...format,
18
+ timeZone: result.receipt.calendar.timezone
19
+ },
17
20
  onDrill: host.onDrill
18
21
  });
19
22
  }, [
@@ -1,32 +1,7 @@
1
- import { useSyncExternalStore } from "react";
1
+ import { lazyPart } from "../lazy.mjs";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  // src/drill/lazy.tsx
4
- let loaded = null;
5
- let pending;
6
- const snapshot = () => loaded;
7
- const serverSnapshot = () => null;
8
- async function load() {
9
- try {
10
- loaded = await import("./DrillPanel.mjs");
11
- } catch (error) {
12
- loaded = { error };
13
- }
14
- }
15
- /** Start the chunk on first open. Each mounted panel hears when the shared import settles. */
16
- function subscribe(notify) {
17
- let listener = notify;
18
- pending ??= load();
19
- pending.then(() => listener?.());
20
- return () => {
21
- listener = void 0;
22
- };
23
- }
24
- function OpenPanel(props) {
25
- const module = useSyncExternalStore(subscribe, snapshot, serverSnapshot);
26
- if (!module) return null;
27
- if ("error" in module) throw module.error;
28
- return /* @__PURE__ */ jsx(module.DrillPanel, { ...props });
29
- }
4
+ const OpenPanel = lazyPart(async () => (await import("./DrillPanel.mjs")).DrillPanel);
30
5
  /** An unopened dashboard leaves the drill chunk unloaded, including during server rendering. */
31
6
  function DrillPanel(props) {
32
7
  if ((props.controller?.state ?? props.state) === void 0) return null;
@@ -1,26 +1,37 @@
1
1
  import "../messages.mjs";
2
+ import { AnswerDrill, DrillOrigin, DrillState, DrillView, ResultCell, ResultColumn, TileAnswer } from "derive-dashboards/core";
2
3
  import { KeyboardEvent, MouseEvent } from "react";
3
- import { AnswerDrill, DrillOrigin, DrillState, DrillView, ResultCell, ResultColumn } from "derive-dashboards/core";
4
- /** What a drillable mark spreads on its element: a button a click or Enter opens. */
4
+ /**
5
+ * What a drillable mark spreads on its element: a button a click or Enter opens. It is one of
6
+ * its tile's marks, which are one tab stop together (`roving.tsx`): the tile makes one of them
7
+ * reachable by Tab and moves between them with the arrow keys.
8
+ */
5
9
  export type DrillMarkProps = {
6
10
  role: "button";
7
- tabIndex: 0;
11
+ tabIndex: -1;
8
12
  "aria-label": string;
13
+ /** A note the mark is read with: on a tile not updated for these filters, the note that says so. */
14
+ "aria-describedby"?: string;
9
15
  "data-drill": "";
16
+ "data-roving": "";
10
17
  onClick: (event: MouseEvent) => void;
11
18
  onKeyDown: (event: KeyboardEvent) => void;
12
19
  };
13
20
  /**
14
21
  * What a renderer drills its answer with; absent where drilling is off. `props(row, entry)`
15
- * gives the props a mark spreads, or undefined for a row that does not drill (a comparison, a
16
- * row the server sealed no selection for). `open(row, entry)` opens it from a chart kit's own
22
+ * gives the props a mark spreads, or undefined for a row that does not drill (a row the server
23
+ * sealed no selection for). `open(row, entry)` opens it from a chart kit's own
17
24
  * event. A row is its index in `answer.rows` or the row itself; `entry` is the line clicked
18
25
  * (`m1`), needed when the answer has more than one.
19
26
  */
20
27
  export type TileDrill = {
21
- props: (row: number | readonly ResultCell[], entry?: string) => DrillMarkProps | undefined;
22
- /** Open every measure of a group together, if the server sealed the row. */
23
- compare?: (row: Row, view: Extract<DrillView, {
28
+ /** `written` is how the tile writes the entry's value, when not as `formatCell` does: the mark is named by what is seen. */
29
+ props: (row: number | readonly ResultCell[], entry?: string, written?: string) => DrillMarkProps | undefined;
30
+ /**
31
+ * A group comparison: every measure of a row's group, regrouped by the view's fields, if the
32
+ * server sealed the row. Not the period before, which a row of `answer.compare` opens.
33
+ */
34
+ compareGroups?: (row: Row, view: Extract<DrillView, {
24
35
  by: "comparison";
25
36
  }>) => (() => void) | undefined;
26
37
  open: (row: number | readonly ResultCell[] | undefined, entry?: string) => void;
@@ -1,17 +1,22 @@
1
- import { formatCell, groupText } from "../format.mjs";
1
+ import { groupName } from "../bucket-name.mjs";
2
+ import { formatCell, isTotal } from "../format.mjs";
2
3
  import { drillFrom } from "./state.mjs";
3
- import { roleOf } from "derive-dashboards/core";
4
+ import { roleOf, wholeAnswer } from "derive-dashboards/core";
4
5
  // src/drill/props.ts
5
6
  const isLine = (c) => roleOf(c) === "measure" || roleOf(c) === "calc";
6
- /** A mark's name for a screen reader: its groups, then its value. */
7
- function markLabel(answer, row, format, entry) {
7
+ /** A mark's name for a screen reader: its groups, then its value, as the tile writes it. */
8
+ function markLabel(answer, row, format, { entry, written } = {}) {
8
9
  const named = answer.columns.length > 1 ? entry : void 0;
9
10
  const text = answer.columns.map((c, i) => ({
10
11
  c,
11
- cell: row[i] ?? null
12
- })).filter(({ c }) => named === void 0 || !isLine(c) || c.id === named).map(({ c, cell }) => {
13
- if (!isLine(c)) return groupText(cell, c, format);
14
- const value = formatCell(cell, c, format);
12
+ cell: row[i] ?? null,
13
+ folded: isTotal(row[i]) && isTotal(row[i - 1])
14
+ })).filter(({ c, folded }) => isLine(c) ? named === void 0 || c.id === named : !folded).map(({ c, cell }) => {
15
+ if (!isLine(c)) return groupName(answer, {
16
+ cell,
17
+ column: c
18
+ }, format);
19
+ const value = c.id === entry && written !== void 0 ? written : formatCell(cell, c, format);
15
20
  return named !== void 0 && isLine(c) ? `${c.label} ${value}` : value;
16
21
  }).join(", ");
17
22
  return format.messages.drillMark(text);
@@ -27,12 +32,30 @@ function position(rows, row) {
27
32
  }
28
33
  return index.get(row);
29
34
  }
35
+ /** A row found by identity among the rows sealed beside the answer's: the period before's, the whole's, or the period before's whole. */
36
+ function besidePlace(answer, row) {
37
+ const previous = answer.compare && position(answer.compare.rows, row);
38
+ if (previous !== void 0) return { previous };
39
+ const whole = answer.whole && position(answer.whole.rows, row);
40
+ if (whole !== void 0) return { whole };
41
+ const before = answer.compare?.whole && position(answer.compare.whole.rows, row);
42
+ return before === void 0 ? void 0 : { previousWhole: before };
43
+ }
30
44
  function at(answer, row) {
31
45
  if (typeof row === "number") return Number.isInteger(row) && row < answer.rows.length ? row : -1;
32
- const own = position(answer.rows, row);
33
- if (own !== void 0) return own;
34
- const previous = answer.compare && position(answer.compare.rows, row);
35
- return previous === void 0 ? -1 : { previous };
46
+ return position(answer.rows, row) ?? besidePlace(answer, row) ?? -1;
47
+ }
48
+ /**
49
+ * The answer a row is named by: a whole row's cells are in the whole's columns, which have no
50
+ * time column, so it is named by those; any other row by the answer's own.
51
+ */
52
+ function namedBy(answer, row) {
53
+ const place = at(answer, row);
54
+ const columns = typeof place === "object" && !("previous" in place) ? wholeAnswer(answer)?.columns : void 0;
55
+ return columns === void 0 ? answer : {
56
+ ...answer,
57
+ columns
58
+ };
36
59
  }
37
60
  const warnedAboutCopy = /* @__PURE__ */ new WeakSet();
38
61
  /** Copies can match more than one period or selection. Tell custom renderers how to identify the row. */
@@ -40,7 +63,7 @@ function comparisonRow(answer, row) {
40
63
  const place = at(answer, row);
41
64
  if (place === -1 && typeof row !== "number" && !warnedAboutCopy.has(answer)) {
42
65
  warnedAboutCopy.add(answer);
43
- console.warn("drill.compare needs an original answer row or its index in answer.rows. Keep the index when copying or sorting rows.");
66
+ console.warn("drill.compareGroups needs an original answer row or its index in answer.rows. Keep the index when copying or sorting rows.");
44
67
  }
45
68
  return place;
46
69
  }
@@ -66,7 +89,7 @@ function tileDrill(a) {
66
89
  open: (row, entry) => {
67
90
  open(row, entry);
68
91
  },
69
- compare: (row, view) => {
92
+ compareGroups: (row, view) => {
70
93
  const state = drillFrom(a.origin, answer.drill, {
71
94
  row: comparisonRow(answer, row),
72
95
  view
@@ -78,22 +101,43 @@ function tileDrill(a) {
78
101
  openAll: (entry, view) => {
79
102
  open(void 0, entry ?? (single ? void 0 : firstLine), view ?? ITEMS);
80
103
  },
81
- props: (row, entry) => {
104
+ props: (row, entry, written) => {
82
105
  const cells = typeof row === "number" ? answer.rows[row] : row;
83
106
  if (cells === void 0 || stateOf(row, entry) === void 0) return;
84
- return markProps(markLabel(answer, cells, a.format, entry), () => {
107
+ return markProps(markLabel(namedBy(answer, row), cells, a.format, {
108
+ entry,
109
+ written
110
+ }), () => {
85
111
  open(row, entry);
86
112
  });
87
113
  }
88
114
  };
89
115
  }
116
+ /**
117
+ * The same drill, each mark it makes read with the element `id` names: the note of a tile not
118
+ * updated for these filters, so a screen reader moving from mark to mark hears that the value
119
+ * is from before, as a sighted reader sees the note above it.
120
+ */
121
+ function describedBy(drill, id) {
122
+ return {
123
+ ...drill,
124
+ props: (row, entry, written) => {
125
+ const marks = drill.props(row, entry, written);
126
+ return marks === void 0 ? void 0 : {
127
+ ...marks,
128
+ "aria-describedby": id
129
+ };
130
+ }
131
+ };
132
+ }
90
133
  const ITEMS = { by: "items" };
91
134
  /** A mark's props: a button by role, named, that opens on a click, Enter or Space. */
92
135
  const markProps = (label, open) => ({
93
136
  role: "button",
94
- tabIndex: 0,
137
+ tabIndex: -1,
95
138
  "aria-label": label,
96
139
  "data-drill": "",
140
+ "data-roving": "",
97
141
  onClick: open,
98
142
  onKeyDown: (event) => {
99
143
  if (event.key !== "Enter" && event.key !== " ") return;
@@ -101,4 +145,4 @@ const markProps = (label, open) => ({
101
145
  open();
102
146
  }
103
147
  });
104
- export { tileDrill };
148
+ export { describedBy, tileDrill };
@@ -3,16 +3,26 @@ import { AnswerDrill, DrillOrigin, DrillState, DrillView } from "derive-dashboar
3
3
  export type DrillHistory = "push" | "replace";
4
4
  /** How a drill tells its host its next state: undefined when it closed. */
5
5
  export type DrillChange = (next: DrillState | undefined, history: DrillHistory) => void;
6
+ /**
7
+ * Where a clicked row is: its index in the answer's rows, or in one of the rows sealed beside
8
+ * them: the period before's (`compare.rows`), the whole's (`whole.rows`) or the period
9
+ * before's whole (`compare.whole.rows`).
10
+ */
11
+ export type RowPlace = number | {
12
+ previous: number;
13
+ } | {
14
+ whole: number;
15
+ } | {
16
+ previousWhole: number;
17
+ };
6
18
  /**
7
19
  * A drill's state from a click on an answer: its origin, the line clicked, the execution the
8
- * answer ran under, and the clicked row of the sealed answer (none for the whole tile; a row of
9
- * the comparison period by `{ previous: i }`), which the server answers with a sealed path.
20
+ * answer ran under, and the clicked row of the sealed answer (none for the whole tile; a row
21
+ * sealed beside the answer's by its `RowPlace`), which the server answers with a sealed path.
10
22
  * Undefined when the answer does not drill, or the row does not.
11
23
  */
12
24
  export declare function drillFrom(origin: DrillOrigin, drill: AnswerDrill | undefined, at?: {
13
- row?: number | {
14
- previous: number;
15
- };
25
+ row?: RowPlace;
16
26
  entry?: string;
17
27
  view?: DrillView;
18
28
  }): DrillState | undefined;
@@ -4,8 +4,8 @@ import { MAX_DRILL_ROWS } from "derive-dashboards/core";
4
4
  const FIRST = { by: "breakdown" };
5
5
  /**
6
6
  * A drill's state from a click on an answer: its origin, the line clicked, the execution the
7
- * answer ran under, and the clicked row of the sealed answer (none for the whole tile; a row of
8
- * the comparison period by `{ previous: i }`), which the server answers with a sealed path.
7
+ * answer ran under, and the clicked row of the sealed answer (none for the whole tile; a row
8
+ * sealed beside the answer's by its `RowPlace`), which the server answers with a sealed path.
9
9
  * Undefined when the answer does not drill, or the row does not.
10
10
  */
11
11
  function drillFrom(origin, drill, at = {}) {
@@ -23,9 +23,18 @@ function drillFrom(origin, drill, at = {}) {
23
23
  function rowEntry(sealed, row, previous = false) {
24
24
  return sealed === void 0 || !Number.isInteger(row) || row < 0 || row >= MAX_DRILL_ROWS || sealed.closed?.some((c) => c.row === row) === true ? void 0 : `${sealed.answer}#${previous ? "p" : ""}${String(row)}`;
25
25
  }
26
+ /**
27
+ * A row sealed beside the answer's as a path entry: the period before's and its whole's are
28
+ * placed `#p`, the whole's as the answer's own rows are.
29
+ */
30
+ function besideEntry(drill, row) {
31
+ if ("previous" in row) return rowEntry(drill.previous, row.previous, true);
32
+ if ("whole" in row) return rowEntry(drill.whole, row.whole);
33
+ return rowEntry(drill.previousWhole, row.previousWhole, true);
34
+ }
26
35
  /** A row's place in the sealed answer as a path of one, or undefined when the row does not open. */
27
36
  function pick(drill, row) {
28
- const entry = typeof row === "number" ? rowEntry(drill, row) : rowEntry(drill.previous, row.previous, true);
37
+ const entry = typeof row === "number" ? rowEntry(drill, row) : besideEntry(drill, row);
29
38
  return entry === void 0 ? void 0 : [entry];
30
39
  }
31
40
  /** One step deeper: a row of a Breakdown or Over time clicked; the view it left is kept for Back. */
@@ -82,9 +82,52 @@ export type DrillMessages = {
82
82
  drillCut: string;
83
83
  /** A number's value in the period before: "Before: 30". */
84
84
  drillBefore: (value: string) => string;
85
- /** A number tile's change against the period before: "+17 from 0", or no change. */
86
- beforeChange: (change: string, before: string) => string;
87
- beforeSame: (before: string) => string;
85
+ /**
86
+ * A number tile's change against the period before, in parts: which way it moved, said to a
87
+ * screen reader beside the arrow ("up", "down"); a rate's change in points ("2.2 pts"); what
88
+ * it moved from ("from 3,189"); that with the period's length when it is the period just
89
+ * before ("3,189 in the 13 weeks before"); and no change.
90
+ */
91
+ changeUp: string;
92
+ changeDown: string;
93
+ /**
94
+ * A change for the better or the worse, where the model or the query says which way is
95
+ * better: said beside the change, so its colour is never the only thing that says it.
96
+ */
97
+ changeBetter: string;
98
+ changeWorse: string;
99
+ changePoints: (size: string) => string;
100
+ /** A move too small to write, by the least that is written: "less than 0.01 pts". */
101
+ changeUnder: (least: string) => string;
102
+ /**
103
+ * The line under a headline number when it moved, as it is seen after its arrow: how far
104
+ * (`size`), from what (`was`), and over which period when that is the one just before
105
+ * (`days`, its length). A whole sentence, so a language can put its parts in its own order;
106
+ * the size is set apart wherever the sentence puts it.
107
+ */
108
+ changeSeen: (moved: {
109
+ size: string;
110
+ was: string;
111
+ days: number | undefined;
112
+ }) => string;
113
+ /**
114
+ * The same line in words alone, for a screen reader: which way it went too, the exact
115
+ * change (`exact`, "+462") when the size is not it already, and whether that was for the
116
+ * better or the worse (`better`) when the column says which way is better.
117
+ */
118
+ changeSaid: (moved: {
119
+ way: "up" | "down";
120
+ size: string;
121
+ exact: string | undefined;
122
+ was: string;
123
+ days: number | undefined;
124
+ better?: "better" | "worse";
125
+ }) => string;
126
+ /** The line when the number did not move. */
127
+ changeNone: (same: {
128
+ was: string;
129
+ days: number | undefined;
130
+ }) => string;
88
131
  /** A step that is the whole of the period before, in the breadcrumb. */
89
132
  drillPeriodBefore: string;
90
133
  /** The Items table's first column when the source names no noun. */
@@ -1,3 +1,4 @@
1
+ import { ENGLISH_CELL } from "../format.mjs";
1
2
  import { DRILL_REASONS } from "derive-dashboards/core";
2
3
  // src/drill/words.ts
3
4
  const RECORD_PAGES = {
@@ -8,6 +9,23 @@ const RECORD_PAGES = {
8
9
  const capital = (text) => text.charAt(0).toUpperCase() + text.slice(1);
9
10
  const compareGroupLabel = (group) => `${group} · Compare groups`;
10
11
  const trendWindowLabel = (period) => `Chart covers ${period}. The total above covers all dates.`;
12
+ /**
13
+ * What is said in brackets after a change's size: its exact amount where the size is not it,
14
+ * and whether it was for the better or the worse ("(+462, better)"); nothing where neither is.
15
+ */
16
+ function aside(exact, better) {
17
+ const said = [exact, better].filter((part) => part !== void 0);
18
+ return said.length === 0 ? "" : ` (${said.join(", ")})`;
19
+ }
20
+ /** What a number moved from, and over which period when that is the one just before: "from 3,189 in the 13 weeks before". */
21
+ const fromBefore = (was, days) => days === void 0 ? `from ${was}` : `from ${was} ${spanBefore(days)}`;
22
+ /** The period just before, by its length: whole weeks where it is, else days. */
23
+ function spanBefore(days) {
24
+ if (days === 1) return "the day before";
25
+ if (days === 365 || days === 366) return "in the year before";
26
+ if (days % 7 === 0 && days >= 14) return `in the ${String(days / 7)} weeks before`;
27
+ return `in the ${String(days)} days before`;
28
+ }
11
29
  const ENGLISH_DRILL = {
12
30
  drillTitle: "Analysis",
13
31
  drillViews: {
@@ -63,16 +81,23 @@ const ENGLISH_DRILL = {
63
81
  drillSearch: "Search",
64
82
  drillOnly: (numerator, count) => `Only ${numerator} (${count})`,
65
83
  drillBefore: (value) => `Before: ${value}`,
66
- beforeChange: (change, before) => `${change} from ${before}`,
67
- beforeSame: (before) => `No change from ${before}`,
84
+ changeUp: "up",
85
+ changeDown: "down",
86
+ changeBetter: "better",
87
+ changeWorse: "worse",
88
+ changePoints: (size) => `${size} pts`,
89
+ changeUnder: (least) => `less than ${least}`,
90
+ changeSeen: ({ size, was, days }) => `${size} ${fromBefore(was, days)}`,
91
+ changeSaid: ({ way, size, exact, was, days, better }) => `${way} ${size}${aside(exact, better)} ${fromBefore(was, days)}`,
92
+ changeNone: ({ was, days }) => `No change ${fromBefore(was, days)}`,
68
93
  drillPeriodBefore: "The period before",
69
94
  drillItem: "Item",
70
95
  drillCut: "Only the first rows of this answer open; narrow the filters to open the rest.",
71
- drillNone: (field) => `No ${field.toLowerCase()}`,
96
+ drillNone: ENGLISH_CELL.drillNone,
72
97
  drillOtherOf: (field) => `Other ${field.toLowerCase()}`,
73
98
  drillWeekOf: (date) => `Week of ${date}`,
74
- drillYes: "Yes",
75
- drillNo: "No",
99
+ drillYes: ENGLISH_CELL.drillYes,
100
+ drillNo: ENGLISH_CELL.drillNo,
76
101
  drillPercentile: (p, value) => `${String(p)}% are at or below ${value}`,
77
102
  drillTrendWindow: trendWindowLabel,
78
103
  drillRange: (from, to) => `${from} to ${to}`,
@@ -1,6 +1,7 @@
1
1
  import { ENGLISH_BUILDER } from "./builder/words.mjs";
2
2
  import { ENGLISH_DRILL } from "./drill/words.mjs";
3
3
  import { relativeLabel } from "./filters/days.mjs";
4
+ import { ENGLISH_CELL } from "./format.mjs";
4
5
  import { ENGLISH_REVIEW } from "./review-words.mjs";
5
6
  // src/english.ts
6
7
  /** What each kind of chart is called, with its article, in a chart's table caption. */
@@ -17,20 +18,30 @@ const ENGLISH = {
17
18
  ...ENGLISH_REVIEW,
18
19
  ...ENGLISH_DRILL,
19
20
  ...ENGLISH_BUILDER,
20
- other: "Other",
21
- total: "Total",
22
- empty: "None",
23
- noValue: "–",
21
+ ...ENGLISH_CELL,
24
22
  sortBy: (column) => `Sort by ${column}`,
25
23
  showMoreRows: (more, of) => `Show ${more} more of ${of} rows`,
24
+ showFirstRows: (first) => `Show the first ${first} rows only`,
26
25
  loading: "Loading",
26
+ noRenderer: (kind, kinds) => `No renderer draws "${kind}". This dashboard draws: ${kinds.join(", ")}.`,
27
27
  noAccess: "You don't have access to this data",
28
28
  noData: "No data for this range",
29
29
  noRows: "No rows",
30
30
  soFar: "so far",
31
31
  chartPartial: "part of the period",
32
+ tileAllTime: "All time",
32
33
  dashboardFailed: "This dashboard could not be loaded.",
34
+ dashboardSignedOut: "Your session may have ended. Sign in again, then reload.",
35
+ dashboardSetup: "This page is not set up to load it. The browser's console says why.",
36
+ dashboardBusy: "The server is busy. Try again in a moment.",
37
+ dashboardServerFailed: "Something went wrong on the server.",
38
+ serverUnreachable: "Can't reach the server. Try again.",
33
39
  dashboardUnreachable: "Can't reach the server. Showing what was last loaded; it updates when the connection is back.",
40
+ dashboardSignedOutShown: "Your session may have ended. Showing what was last loaded; sign in again, then reload to update it.",
41
+ tileNotUpdated: "Not updated for these filters. Sign in again to see it.",
42
+ tileNotUpdatedYet: "Not updated for these filters yet. Trying again.",
43
+ tilesNotUpdatedYet: (tiles) => tiles === 1 ? "1 tile is not updated for these filters yet. Trying again." : `${String(tiles)} tiles are not updated for these filters yet. Trying again.`,
44
+ shareCopyByHand: "Copy this link to share this view.",
34
45
  dashboardMissing: "This dashboard isn't here. It may not be published yet, or it was removed.",
35
46
  rowsFailed: "These rows could not be loaded.",
36
47
  rows: "Rows",
@@ -120,7 +131,7 @@ const ENGLISH = {
120
131
  bucket: "its period",
121
132
  previous: "previous period"
122
133
  },
123
- removedCalcs: (names) => `Removed ${names.join(", ")}. To use these calculations, choose Whole period and a period to compare with.`,
134
+ removedCalcs: (names) => `Removed ${names.join(", ")}. To use these calculations, choose Whole period and a period before to read.`,
124
135
  noMainQuery: (title) => `${title} has no main query, so the builder cannot edit it. Change it where it was made (in code, or by its plugin).`,
125
136
  notDrawn: (labels) => `Not drawn here: ${labels.join(", ")}. Show it as a table to see ${labels.length === 1 ? "it" : "them"}.`,
126
137
  chartTooSmall: "Enlarge the tile to see the chart.",
@@ -128,10 +139,10 @@ const ENGLISH = {
128
139
  chartPoints: "Points to open (arrow keys move between them)",
129
140
  keptAside: ({ display, queries, fields }) => {
130
141
  return `Kept as they are: ${[
131
- ...display ? ["its display settings"] : [],
142
+ ...display ? ["its other display settings"] : [],
132
143
  ...fields.length === 0 ? [] : [`its own ${fields.join(", ")}`],
133
144
  ...queries.length === 0 ? [] : [`its ${queries.map((q) => `"${q}"`).join(", ")} ${queries.length === 1 ? "query" : "queries"}`]
134
- ].join(" and ")}. This builder edits the title, the chart and the main query.`;
145
+ ].join(" and ")}. This builder edits the title, the chart, its options and the main query.`;
135
146
  },
136
147
  followsFilters: (labels) => labels.length === 0 ? "On the dashboard: no dashboard filter applies to it." : `On the dashboard: follows its ${labels.join(", ")} ${labels.length === 1 ? "filter" : "filters"}.`,
137
148
  reorder: "Drag, or use the arrow keys, to reorder",
@@ -154,13 +165,27 @@ const ENGLISH = {
154
165
  undo: "Undo",
155
166
  discardAsk: (n) => n === 1 ? "Discard 1 change?" : `Discard all ${String(n)} changes?`,
156
167
  emptyTab: "Nothing here yet. Add a widget to start.",
168
+ addTab: "Add tab",
169
+ newTab: (n) => n < 2 ? "New tab" : `New tab ${String(n)}`,
170
+ tabName: "Tab name",
171
+ tabNameEmpty: "A tab needs a name",
172
+ tabNameTaken: (title) => `Another tab is named ${title}.`,
173
+ tabOptions: (title) => `Tab options for ${title}`,
174
+ renameTab: "Rename",
175
+ moveTabLeft: "Move left",
176
+ moveTabRight: "Move right",
177
+ removeTab: "Remove tab",
178
+ removeTabYes: "Yes, remove",
179
+ removeTabAsk: (title, tiles) => tiles === 0 ? `Remove "${title}"?` : `Remove "${title}" and its ${String(tiles)} ${tiles === 1 ? "tile" : "tiles"}?`,
180
+ lastTab: "A dashboard needs at least one tab.",
157
181
  discardConfirm: "Discard changes",
158
182
  deleteNewAsk: "Delete this new dashboard? It was never published.",
159
183
  deleteNewConfirm: "Delete dashboard",
160
184
  keepEditing: "Keep editing",
161
185
  unreachable: "Can't reach the server. Your draft is safe as last saved; try again.",
162
186
  removedTile: (title) => `Removed “${title}”. Undo brings it back.`,
163
- tileUnreachable: "Couldn't load this tile. Check the connection and reload.",
187
+ tileUnreachable: "Couldn't load this tile: the server can't be reached.",
188
+ tileServerFailed: "The server couldn't load this tile.",
164
189
  readFailed: "Could not load this list.",
165
190
  noValues: "No values to pick.",
166
191
  copyByHand: "The browser would not copy it. Select the text below and copy it.",