derive-dashboards 0.8.0 → 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 (585) 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 +67 -26
  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 -30
  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 +49 -8
  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 +10 -5
  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/scale/calendar.mjs +41 -26
  109. package/dist/charts/scale/linear.mjs +58 -0
  110. package/dist/charts/scale/value.d.mts +21 -0
  111. package/dist/charts/scale/value.mjs +67 -9
  112. package/dist/charts/scene/lazy.mjs +27 -0
  113. package/dist/charts/scene/markup.mjs +2 -1
  114. package/dist/charts/scene/svg.mjs +20 -8
  115. package/dist/charts/scene/types.d.mts +34 -0
  116. package/dist/charts/text/measure.mjs +33 -3
  117. package/dist/charts/theme.mjs +13 -4
  118. package/dist/charts-react/Chart.d.mts +20 -0
  119. package/dist/charts-react/Chart.mjs +9 -67
  120. package/dist/charts-react/Reader.mjs +50 -96
  121. package/dist/charts-react/box.mjs +106 -0
  122. package/dist/charts-react/bucket-names.mjs +9 -24
  123. package/dist/charts-react/columns-picture.mjs +12 -0
  124. package/dist/charts-react/exact-sum.mjs +4 -7
  125. package/dist/charts-react/from-answer.mjs +9 -4
  126. package/dist/charts-react/index.d.mts +9 -2
  127. package/dist/charts-react/index.mjs +9 -2
  128. package/dist/charts-react/kinds/area.d.mts +4 -0
  129. package/dist/charts-react/kinds/area.mjs +38 -0
  130. package/dist/charts-react/kinds/bar.d.mts +4 -0
  131. package/dist/charts-react/kinds/bar.mjs +15 -0
  132. package/dist/charts-react/kinds/funnel.d.mts +4 -0
  133. package/dist/charts-react/kinds/funnel.mjs +13 -0
  134. package/dist/charts-react/kinds/heatmap.d.mts +4 -0
  135. package/dist/charts-react/kinds/heatmap.mjs +13 -0
  136. package/dist/charts-react/kinds/line.d.mts +4 -0
  137. package/dist/charts-react/kinds/line.mjs +20 -0
  138. package/dist/charts-react/kinds/multiples.d.mts +4 -0
  139. package/dist/charts-react/kinds/multiples.mjs +33 -0
  140. package/dist/charts-react/kinds/number.d.mts +5 -0
  141. package/dist/charts-react/kinds/number.mjs +86 -0
  142. package/dist/charts-react/plan-bars.mjs +15 -8
  143. package/dist/charts-react/plan-funnel.mjs +3 -1
  144. package/dist/charts-react/plan-grid.mjs +14 -5
  145. package/dist/charts-react/plan-of.mjs +17 -0
  146. package/dist/charts-react/plan-parts.mjs +16 -5
  147. package/dist/charts-react/plan-time.mjs +4 -53
  148. package/dist/charts-react/reader-page.d.mts +1 -1
  149. package/dist/charts-react/reader-page.mjs +19 -9
  150. package/dist/charts-react/renderers.d.mts +14 -0
  151. package/dist/charts-react/renderers.mjs +22 -0
  152. package/dist/charts-react/table.d.mts +1 -0
  153. package/dist/charts-react/table.mjs +108 -0
  154. package/dist/charts-react/tiles.mjs +21 -49
  155. package/dist/charts-react/useScene.mjs +45 -17
  156. package/dist/charts-react/words.mjs +19 -0
  157. package/dist/checks.mjs +97 -19
  158. package/dist/cli/add.mjs +4 -3
  159. package/dist/cli/doctor.mjs +2 -2
  160. package/dist/core/conformance/index.d.mts +5 -2
  161. package/dist/core/conformance/index.mjs +5 -2
  162. package/dist/core/conformance/memory/aggregate.mjs +11 -6
  163. package/dist/core/conformance/memory/rows.d.mts +7 -3
  164. package/dist/core/conformance/memory/rows.mjs +19 -13
  165. package/dist/core/conformance/memory/source.mjs +4 -4
  166. package/dist/core/document/control-fields.d.mts +20 -0
  167. package/dist/core/document/control-fields.mjs +117 -0
  168. package/dist/core/document/display-comparisons.d.mts +17 -0
  169. package/dist/core/document/display-comparisons.mjs +15 -4
  170. package/dist/core/document/display-entries.d.mts +14 -0
  171. package/dist/core/document/display-entries.mjs +25 -9
  172. package/dist/core/document/display-validation.d.mts +5 -1
  173. package/dist/core/document/display-validation.mjs +14 -7
  174. package/dist/core/document/display.d.mts +10 -8
  175. package/dist/core/document/display.mjs +25 -4
  176. package/dist/core/document/layout.d.mts +8 -9
  177. package/dist/core/document/layout.mjs +23 -6
  178. package/dist/core/document/stacked.d.mts +0 -7
  179. package/dist/core/document/types.mjs +8 -6
  180. package/dist/core/document/upgrade.d.mts +1 -0
  181. package/dist/core/document/upgrade.mjs +4 -2
  182. package/dist/core/engine/access.mjs +3 -3
  183. package/dist/core/engine/assert.mjs +4 -2
  184. package/dist/core/engine/bucket.mjs +2 -2
  185. package/dist/core/engine/checks.mjs +6 -7
  186. package/dist/core/engine/custom/ask.mjs +22 -2
  187. package/dist/core/engine/custom/cells.mjs +22 -22
  188. package/dist/core/engine/custom/level.mjs +12 -13
  189. package/dist/core/engine/custom/measures.mjs +12 -9
  190. package/dist/core/engine/custom/reader.mjs +3 -1
  191. package/dist/core/engine/custom/records.mjs +8 -7
  192. package/dist/core/engine/custom/unread.mjs +78 -0
  193. package/dist/core/engine/custom/where.mjs +15 -10
  194. package/dist/core/engine/index.d.mts +2 -13
  195. package/dist/core/engine/index.mjs +2 -12
  196. package/dist/core/engine/measure.mjs +1 -0
  197. package/dist/core/engine/members.mjs +7 -3
  198. package/dist/core/engine/nan.mjs +10 -1
  199. package/dist/core/engine/native.mjs +2 -20
  200. package/dist/core/engine/numbers.mjs +26 -14
  201. package/dist/core/engine/postgres.mjs +9 -5
  202. package/dist/core/engine/prepare.mjs +4 -4
  203. package/dist/core/engine/rank-sets.mjs +1 -1
  204. package/dist/core/engine/read.mjs +5 -4
  205. package/dist/core/engine/reader.d.mts +6 -0
  206. package/dist/core/engine/record-layout.mjs +3 -3
  207. package/dist/core/engine/run.mjs +77 -20
  208. package/dist/core/engine/segmented.d.mts +2 -1
  209. package/dist/core/engine/segmented.mjs +19 -12
  210. package/dist/core/engine/series.mjs +1 -1
  211. package/dist/core/engine/shape.mjs +8 -8
  212. package/dist/core/engine/sql-partition.mjs +2 -2
  213. package/dist/core/engine/sql-pass.mjs +3 -2
  214. package/dist/core/engine/sql-reader.mjs +13 -5
  215. package/dist/core/engine/sql-reads.mjs +2 -1
  216. package/dist/core/engine/sql-records.mjs +2 -2
  217. package/dist/core/engine/sql-split.mjs +1 -1
  218. package/dist/core/engine/sql-unread.mjs +70 -0
  219. package/dist/core/engine/time.mjs +2 -1
  220. package/dist/core/engine/types.d.mts +17 -0
  221. package/dist/core/engine/version.d.mts +1 -1
  222. package/dist/core/engine/version.mjs +1 -1
  223. package/dist/core/error/codes.d.mts +24 -1
  224. package/dist/core/error/codes.mjs +23 -3
  225. package/dist/core/error/refusal.d.mts +8 -3
  226. package/dist/core/error/refusal.mjs +6 -1
  227. package/dist/core/exact/decimal.d.mts +1 -14
  228. package/dist/core/exact/decimal.mjs +9 -19
  229. package/dist/core/exact/stored.d.mts +9 -0
  230. package/dist/core/exact/stored.mjs +38 -0
  231. package/dist/core/exact/text.d.mts +16 -1
  232. package/dist/core/exact/text.mjs +50 -1
  233. package/dist/core/format/digits.mjs +55 -0
  234. package/dist/core/format/index.d.mts +16 -0
  235. package/dist/core/format/index.mjs +27 -0
  236. package/dist/core/format/number.d.mts +27 -0
  237. package/dist/core/format/number.mjs +158 -0
  238. package/dist/core/format/write.d.mts +6 -0
  239. package/dist/core/format/write.mjs +57 -0
  240. package/dist/core/index.d.mts +43 -33
  241. package/dist/core/index.mjs +31 -28
  242. package/dist/core/model/defaults.d.mts +18 -1
  243. package/dist/core/model/defaults.mjs +19 -1
  244. package/dist/core/model/define.d.mts +17 -8
  245. package/dist/core/model/define.mjs +2 -0
  246. package/dist/core/model/member.d.mts +5 -3
  247. package/dist/core/model/member.mjs +33 -6
  248. package/dist/core/model/storage.mjs +40 -12
  249. package/dist/core/model/types.d.mts +17 -1
  250. package/dist/core/model/types.mjs +5 -0
  251. package/dist/core/model/validate/expr.d.mts +1 -7
  252. package/dist/core/model/validate/fields.d.mts +2 -0
  253. package/dist/core/model/validate/fields.mjs +14 -7
  254. package/dist/core/model/validate/issues.mjs +5 -1
  255. package/dist/core/model/validate/known-members.mjs +6 -5
  256. package/dist/core/model/validate/shape.mjs +36 -3
  257. package/dist/core/model/validate/source.mjs +2 -2
  258. package/dist/core/oracle/data.d.mts +4 -2
  259. package/dist/core/oracle/evaluate.d.mts +19 -1
  260. package/dist/core/oracle/evaluate.mjs +56 -10
  261. package/dist/core/oracle/expr.mjs +1 -1
  262. package/dist/core/oracle/facts.mjs +12 -5
  263. package/dist/core/oracle/measure.mjs +1 -1
  264. package/dist/core/oracle/request.mjs +39 -4
  265. package/dist/core/oracle/segmented.d.mts +3 -1
  266. package/dist/core/oracle/segmented.mjs +19 -13
  267. package/dist/core/oracle/unread.mjs +32 -0
  268. package/dist/core/oracle/visibility.mjs +4 -3
  269. package/dist/core/policy/bind.d.mts +2 -11
  270. package/dist/core/policy/bind.mjs +1 -1
  271. package/dist/core/policy/match.mjs +1 -1
  272. package/dist/core/query/closure.d.mts +7 -2
  273. package/dist/core/query/closure.mjs +29 -12
  274. package/dist/core/query/compose-tile.d.mts +3 -2
  275. package/dist/core/query/compose-tile.mjs +32 -13
  276. package/dist/core/query/compose.d.mts +0 -5
  277. package/dist/core/query/drill/internal.d.mts +5 -5
  278. package/dist/core/query/drill/internal.mjs +11 -0
  279. package/dist/core/query/drill/links.d.mts +2 -3
  280. package/dist/core/query/drill/links.mjs +18 -4
  281. package/dist/core/query/drill/selection.d.mts +8 -2
  282. package/dist/core/query/drill/selection.mjs +14 -3
  283. package/dist/core/query/drill/synthetic.mjs +1 -1
  284. package/dist/core/query/drill/time.mjs +11 -10
  285. package/dist/core/query/filter.d.mts +1 -6
  286. package/dist/core/query/filter.mjs +1 -4
  287. package/dist/core/query/fold.mjs +23 -0
  288. package/dist/core/query/segments.mjs +42 -3
  289. package/dist/core/query/to-wire.d.mts +7 -0
  290. package/dist/core/query/to-wire.mjs +14 -2
  291. package/dist/core/query/types.d.mts +30 -13
  292. package/dist/core/result/columns.mjs +23 -13
  293. package/dist/core/result/number.mjs +3 -3
  294. package/dist/core/result/status.d.mts +13 -0
  295. package/dist/core/result/status.mjs +18 -0
  296. package/dist/core/result/time-axis.d.mts +14 -13
  297. package/dist/core/result/time-axis.mjs +20 -2
  298. package/dist/core/result/types.d.mts +33 -3
  299. package/dist/core/result/whole.d.mts +23 -0
  300. package/dist/core/result/whole.mjs +27 -0
  301. package/dist/core/schema/agent-query.d.mts +89 -0
  302. package/dist/core/schema/agent-query.mjs +115 -0
  303. package/dist/core/schema/aliases.mjs +1 -52
  304. package/dist/core/schema/answer-parts.mjs +17 -13
  305. package/dist/core/schema/answers.d.mts +787 -319
  306. package/dist/core/schema/commands.d.mts +33 -23
  307. package/dist/core/schema/commands.mjs +26 -18
  308. package/dist/core/schema/custom.mjs +46 -45
  309. package/dist/core/schema/document.d.mts +32 -27
  310. package/dist/core/schema/document.mjs +61 -81
  311. package/dist/core/schema/drill-answers.mjs +4 -1
  312. package/dist/core/schema/drill.d.mts +14 -9
  313. package/dist/core/schema/drill.mjs +23 -22
  314. package/dist/core/schema/index.d.mts +5 -3
  315. package/dist/core/schema/index.mjs +5 -3
  316. package/dist/core/schema/options.d.mts +92 -0
  317. package/dist/core/schema/options.mjs +104 -0
  318. package/dist/core/schema/picks.d.mts +2 -2
  319. package/dist/core/schema/picks.mjs +7 -6
  320. package/dist/core/schema/query.d.mts +9 -83
  321. package/dist/core/schema/query.mjs +49 -73
  322. package/dist/core/schema/strict.d.mts +3 -0
  323. package/dist/core/schema/strict.mjs +91 -0
  324. package/dist/core/schema/union-error.mjs +30 -7
  325. package/dist/core/schema/view.d.mts +4 -3
  326. package/dist/core/schema/view.mjs +16 -11
  327. package/dist/core/store/ddl.d.mts +0 -2
  328. package/dist/core/store/ddl.mjs +1 -5
  329. package/dist/core/time/bucket.d.mts +1 -19
  330. package/dist/core/time/bucket.mjs +6 -6
  331. package/dist/core/time/compare.mjs +3 -2
  332. package/dist/core/time/index.d.mts +7 -8
  333. package/dist/core/time/instant.d.mts +15 -9
  334. package/dist/core/time/instant.mjs +23 -9
  335. package/dist/core/time/range.d.mts +3 -15
  336. package/dist/core/time/range.mjs +17 -7
  337. package/dist/core/time/stored.d.mts +8 -5
  338. package/dist/core/time/stored.mjs +51 -15
  339. package/dist/core/time/temporal.d.mts +1 -5
  340. package/dist/core/time/temporal.mjs +9 -4
  341. package/dist/core/time/text-time.d.mts +31 -2
  342. package/dist/core/time/text-time.mjs +139 -22
  343. package/dist/core/time/zone.mjs +2 -2
  344. package/dist/core/types/api.d.mts +1 -1
  345. package/dist/core/types/api.mjs +1 -1
  346. package/dist/core/types/dashboard.d.mts +185 -0
  347. package/dist/core/types/dashboard.mjs +26 -0
  348. package/dist/core/types/drill-api.d.mts +14 -2
  349. package/dist/core/types/infer.d.mts +0 -4
  350. package/dist/core/types/options-check.d.mts +42 -0
  351. package/dist/core/types/options-check.mjs +90 -0
  352. package/dist/core/types/options.d.mts +14 -8
  353. package/dist/core/value/casefold.d.mts +1 -3
  354. package/dist/core/value/stored.d.mts +26 -0
  355. package/dist/core/value/stored.mjs +28 -0
  356. package/dist/cursor-seal.mjs +37 -9
  357. package/dist/dashboard-documents.d.mts +14 -6
  358. package/dist/dashboard-documents.mjs +32 -12
  359. package/dist/dashboards.mjs +10 -9
  360. package/dist/drill-access.mjs +6 -6
  361. package/dist/drill-change.mjs +18 -20
  362. package/dist/drill-comparison.mjs +2 -1
  363. package/dist/drill-crumbs.mjs +63 -28
  364. package/dist/drill-distinct.mjs +2 -1
  365. package/dist/drill-explain.mjs +1 -1
  366. package/dist/drill-items.mjs +1 -1
  367. package/dist/drill-open.mjs +39 -23
  368. package/dist/drill-seal.mjs +41 -13
  369. package/dist/drill-share.mjs +1 -1
  370. package/dist/drill-summary.mjs +2 -1
  371. package/dist/drill-targets.mjs +4 -4
  372. package/dist/drill-views.mjs +4 -3
  373. package/dist/drill.mjs +1 -1
  374. package/dist/editing.mjs +5 -3
  375. package/dist/endpoints/index.d.mts +29 -8
  376. package/dist/endpoints/index.mjs +4 -1
  377. package/dist/endpoints/meta.mjs +4 -3
  378. package/dist/endpoints/query.mjs +5 -2
  379. package/dist/endpoints/read.mjs +7 -6
  380. package/dist/endpoints/versions.mjs +2 -1
  381. package/dist/execute.d.mts +3 -0
  382. package/dist/execute.mjs +23 -12
  383. package/dist/grant.d.mts +9 -0
  384. package/dist/grant.mjs +43 -0
  385. package/dist/handler.mjs +8 -13
  386. package/dist/http.d.mts +6 -2
  387. package/dist/http.mjs +6 -2
  388. package/dist/index.d.mts +25 -4
  389. package/dist/index.mjs +91 -40
  390. package/dist/llms.txt +3 -3
  391. package/dist/mcp/api.mjs +2 -1
  392. package/dist/mcp/query.mjs +3 -8
  393. package/dist/mcp/resolve.mjs +9 -2
  394. package/dist/node/index.d.mts +36 -0
  395. package/dist/node/index.mjs +89 -0
  396. package/dist/node/request.d.mts +12 -0
  397. package/dist/node/request.mjs +119 -0
  398. package/dist/node/response.mjs +58 -0
  399. package/dist/principal.mjs +15 -7
  400. package/dist/react/Canvas.mjs +88 -67
  401. package/dist/react/Cell.mjs +2 -1
  402. package/dist/react/Dashboard.d.mts +9 -1
  403. package/dist/react/Dashboard.mjs +42 -42
  404. package/dist/react/DashboardList.mjs +9 -4
  405. package/dist/react/Editing.d.mts +9 -0
  406. package/dist/react/Editing.mjs +8 -3
  407. package/dist/react/Grid.mjs +1 -1
  408. package/dist/react/Header.mjs +4 -35
  409. package/dist/react/History.mjs +3 -2
  410. package/dist/react/LoadFailed.mjs +59 -0
  411. package/dist/react/Panel.d.mts +1 -1
  412. package/dist/react/Panel.mjs +1 -1
  413. package/dist/react/Parts.d.mts +34 -0
  414. package/dist/react/Parts.mjs +9 -6
  415. package/dist/react/ReviewPanel.mjs +1 -1
  416. package/dist/react/RowBody.d.mts +2 -0
  417. package/dist/react/RowBody.mjs +5 -1
  418. package/dist/react/Share.mjs +153 -0
  419. package/dist/react/TabStrip.mjs +37 -0
  420. package/dist/react/Tile.d.mts +3 -1
  421. package/dist/react/Tile.mjs +89 -92
  422. package/dist/react/TileState.mjs +117 -0
  423. package/dist/react/ago.mjs +45 -0
  424. package/dist/react/arrange.mjs +1 -1
  425. package/dist/react/board.mjs +2 -2
  426. package/dist/react/bucket-name.d.mts +8 -0
  427. package/dist/react/bucket-name.mjs +13 -0
  428. package/dist/react/builder/DisplayOptions.mjs +219 -0
  429. package/dist/react/builder/Preview.mjs +13 -13
  430. package/dist/react/builder/RangeEditor.mjs +4 -3
  431. package/dist/react/builder/WidgetBuilder.d.mts +1 -7
  432. package/dist/react/builder/WidgetBuilder.mjs +12 -3
  433. package/dist/react/builder/base.d.mts +13 -2
  434. package/dist/react/builder/base.mjs +70 -12
  435. package/dist/react/builder/display.d.mts +3 -0
  436. package/dist/react/builder/display.mjs +256 -0
  437. package/dist/react/builder/labels.mjs +19 -5
  438. package/dist/react/builder/options.mjs +11 -6
  439. package/dist/react/builder/state.mjs +25 -3
  440. package/dist/react/builder/useBuilder.d.mts +7 -1
  441. package/dist/react/builder/useBuilder.mjs +6 -9
  442. package/dist/react/builder/usePreview.mjs +3 -2
  443. package/dist/react/builder/words.d.mts +16 -1
  444. package/dist/react/builder/words.mjs +41 -1
  445. package/dist/react/change-text.mjs +149 -0
  446. package/dist/react/client.d.mts +9 -0
  447. package/dist/react/client.mjs +105 -14
  448. package/dist/react/context.d.mts +24 -3
  449. package/dist/react/context.mjs +23 -7
  450. package/dist/react/dates-shown.mjs +76 -0
  451. package/dist/react/draft.mjs +3 -2
  452. package/dist/react/drill/Bars.mjs +12 -16
  453. package/dist/react/drill/Comparison.mjs +1 -1
  454. package/dist/react/drill/DrillPanel.d.mts +1 -1
  455. package/dist/react/drill/DrillPanel.mjs +2 -1
  456. package/dist/react/drill/Header.mjs +65 -12
  457. package/dist/react/drill/Items.d.mts +1 -1
  458. package/dist/react/drill/Notes.mjs +10 -7
  459. package/dist/react/drill/PanelStates.mjs +8 -1
  460. package/dist/react/drill/Trend.mjs +10 -5
  461. package/dist/react/drill/board.d.mts +1 -1
  462. package/dist/react/drill/host.mjs +4 -1
  463. package/dist/react/drill/lazy.mjs +2 -27
  464. package/dist/react/drill/props.d.mts +17 -7
  465. package/dist/react/drill/props.mjs +55 -14
  466. package/dist/react/drill/state.d.mts +15 -5
  467. package/dist/react/drill/state.mjs +12 -3
  468. package/dist/react/drill/words.d.mts +46 -3
  469. package/dist/react/drill/words.mjs +30 -5
  470. package/dist/react/english.mjs +33 -8
  471. package/dist/react/export/ExportButton.mjs +4 -1
  472. package/dist/react/export/csv.d.mts +7 -2
  473. package/dist/react/export/csv.mjs +24 -7
  474. package/dist/react/failure-words.mjs +60 -0
  475. package/dist/react/filters/bar.d.mts +1 -1
  476. package/dist/react/filters/bar.mjs +4 -1
  477. package/dist/react/filters/calendar.mjs +23 -8
  478. package/dist/react/filters/chip.mjs +7 -3
  479. package/dist/react/filters/context.d.mts +13 -1
  480. package/dist/react/filters/context.mjs +1 -1
  481. package/dist/react/filters/dates-said.mjs +57 -0
  482. package/dist/react/filters/days.d.mts +3 -4
  483. package/dist/react/filters/days.mjs +10 -17
  484. package/dist/react/filters/hooks.d.mts +11 -0
  485. package/dist/react/filters/hooks.mjs +10 -6
  486. package/dist/react/filters/menu-search.mjs +17 -9
  487. package/dist/react/filters/menu.mjs +10 -8
  488. package/dist/react/filters/phone.mjs +41 -16
  489. package/dist/react/filters/place.mjs +40 -0
  490. package/dist/react/filters/popover.mjs +18 -13
  491. package/dist/react/filters/rules.d.mts +4 -3
  492. package/dist/react/filters/rules.mjs +3 -3
  493. package/dist/react/filters/sheet.mjs +7 -3
  494. package/dist/react/filters/state.mjs +6 -1
  495. package/dist/react/filters/values.mjs +24 -7
  496. package/dist/react/filters/words.d.mts +13 -0
  497. package/dist/react/filters/words.mjs +5 -0
  498. package/dist/react/format-time.d.mts +17 -6
  499. package/dist/react/format-time.mjs +152 -33
  500. package/dist/react/format.d.mts +3 -3
  501. package/dist/react/format.mjs +27 -133
  502. package/dist/react/headline.d.mts +6 -3
  503. package/dist/react/headline.mjs +81 -25
  504. package/dist/react/index.d.mts +19 -17
  505. package/dist/react/index.mjs +12 -10
  506. package/dist/react/lazy.mjs +38 -0
  507. package/dist/react/messages.d.mts +78 -2
  508. package/dist/react/now.mjs +38 -0
  509. package/dist/react/read.d.mts +1 -0
  510. package/dist/react/read.mjs +140 -9
  511. package/dist/react/renderers/exact.mjs +31 -59
  512. package/dist/react/renderers/index.d.mts +27 -6
  513. package/dist/react/renderers/index.mjs +141 -102
  514. package/dist/react/renderers/list-parts.mjs +24 -0
  515. package/dist/react/renderers/list.d.mts +1 -0
  516. package/dist/react/renderers/list.mjs +99 -43
  517. package/dist/react/renderers/more-rows.mjs +75 -0
  518. package/dist/react/renderers/number-before.mjs +320 -0
  519. package/dist/react/renderers/number-period.mjs +54 -0
  520. package/dist/react/renderers/number-whole.mjs +29 -0
  521. package/dist/react/renderers/props.d.mts +24 -1
  522. package/dist/react/renderers/props.mjs +8 -0
  523. package/dist/react/renderers/table-cells.mjs +137 -31
  524. package/dist/react/renderers/table-fit.mjs +55 -10
  525. package/dist/react/renderers/table-measure.mjs +29 -9
  526. package/dist/react/renderers/table-row.mjs +14 -9
  527. package/dist/react/renderers/table-scale.mjs +2 -3
  528. package/dist/react/renderers/table-sort.mjs +3 -2
  529. package/dist/react/renderers/table-whole.mjs +37 -0
  530. package/dist/react/renderers/table.mjs +73 -53
  531. package/dist/react/review.d.mts +7 -0
  532. package/dist/react/review.mjs +35 -8
  533. package/dist/react/roving.d.mts +6 -0
  534. package/dist/react/roving.mjs +123 -0
  535. package/dist/react/says-dates.d.mts +7 -0
  536. package/dist/react/says-dates.mjs +51 -0
  537. package/dist/react/series.mjs +5 -6
  538. package/dist/react/stable.mjs +1 -1
  539. package/dist/react/tabs/EditTabs.mjs +125 -0
  540. package/dist/react/tabs/NameField.mjs +72 -0
  541. package/dist/react/tabs/TabMenu.mjs +175 -0
  542. package/dist/react/tabs/actions.mjs +37 -0
  543. package/dist/react/tabs/commands.mjs +76 -0
  544. package/dist/react/tabs/focus.mjs +22 -0
  545. package/dist/react/tabs/keys.mjs +28 -0
  546. package/dist/react/theme-unlayered.css +1 -1
  547. package/dist/react/theme.css +1 -1
  548. package/dist/react/tile-store.d.mts +4 -0
  549. package/dist/react/tile-store.mjs +93 -13
  550. package/dist/react/touch.d.mts +16 -0
  551. package/dist/react/touch.mjs +39 -0
  552. package/dist/react/useBoard.d.mts +6 -0
  553. package/dist/react/useBoard.mjs +1 -0
  554. package/dist/react/useDashboard.d.mts +2 -0
  555. package/dist/react/useDashboard.mjs +5 -2
  556. package/dist/react/useTiles.d.mts +3 -0
  557. package/dist/react/useTiles.mjs +73 -17
  558. package/dist/react/view-grid.mjs +2 -2
  559. package/dist/react/view.mjs +1 -1
  560. package/dist/recharts/axes.mjs +1 -1
  561. package/dist/recharts/axis.mjs +23 -73
  562. package/dist/recharts/bar.d.mts +2 -1
  563. package/dist/recharts/bar.mjs +140 -64
  564. package/dist/recharts/fit.mjs +33 -0
  565. package/dist/recharts/line.mjs +21 -15
  566. package/dist/recharts/marks.mjs +2 -1
  567. package/dist/recharts/parts.mjs +16 -13
  568. package/dist/recharts/table.mjs +8 -3
  569. package/dist/refusal.mjs +46 -0
  570. package/dist/registry/filter-bar.json +1 -1
  571. package/dist/skills/derive-dashboards/SKILL.md +23 -8
  572. package/dist/tile-doc.mjs +1 -1
  573. package/package.json +21 -6
  574. package/dist/charts-react/plan.d.mts +0 -3
  575. package/dist/charts-react/plan.mjs +0 -37
  576. package/dist/charts-react/tiles.d.mts +0 -24
  577. package/dist/core/policy/match.d.mts +0 -16
  578. package/dist/core/schema/aliases.d.mts +0 -7
  579. package/dist/core/time/compare.d.mts +0 -30
  580. package/dist/react/EditBar.d.mts +0 -16
  581. package/dist/react/History.d.mts +0 -30
  582. package/dist/react/ReviewPanel.d.mts +0 -15
  583. package/dist/react/digits.mjs +0 -46
  584. package/dist/react/drill/trend-touch.mjs +0 -33
  585. package/dist/react/renderers/exact.d.mts +0 -6
@@ -1,6 +1,5 @@
1
1
  import { isNumeric } from "../columns.mjs";
2
- import { digitsOf, moved } from "../renderers/exact.mjs";
3
- import { isMark } from "derive-dashboards/core";
2
+ import { cellDigits, isMark, movePoint, roleOf, wholeAnswer } from "derive-dashboards/core";
4
3
  // src/export/csv.ts
5
4
  /** A text a spreadsheet must not take for a formula: one that begins as a formula does is led by an apostrophe. */
6
5
  const guarded = (text) => /^[=+\-@\t\r]/u.test(text) ? `'${text}` : text;
@@ -8,7 +7,7 @@ const guarded = (text) => /^[=+\-@\t\r]/u.test(text) ? `'${text}` : text;
8
7
  const field = (text) => /[",\r\n]/u.test(text) ? `"${text.replaceAll("\"", "\"\"")}"` : text;
9
8
  /** A column's heading: its label, with the unit its numbers are in when the digits alone would lose it. */
10
9
  function headingOf(column) {
11
- if (column.format === "duration") return guarded(`${column.label} (seconds)`);
10
+ if (column.format === "duration") return guarded(`${column.label} (${column.unit ?? "second"}s)`);
12
11
  if (column.format === "percent" || column.unit === void 0) return guarded(column.label);
13
12
  return guarded(`${column.label} (${column.unit})`);
14
13
  }
@@ -17,7 +16,7 @@ function headingOf(column) {
17
16
  * with its sign (42.5%). A percent held as a fraction has its point moved two places as text;
18
17
  * no value is put through a float on the way.
19
18
  */
20
- const written = (digits, column) => column.format === "percent" ? `${column.fraction === true ? moved(digits, 2) : digits}%` : digits;
19
+ const written = (digits, column) => column.format === "percent" ? `${column.fraction === true ? movePoint(digits, 2) : digits}%` : digits;
21
20
  /**
22
21
  * One cell: nothing for no value, the fold's word for a mark, true or false, a number's own
23
22
  * digits as a plain decimal, and any other text guarded. A text is a number only in a column
@@ -29,13 +28,31 @@ function cellText(cell, column, words) {
29
28
  if (cell === null) return "";
30
29
  if (isMark(cell)) return guarded(cell.mark === "all" ? words.total : words.other);
31
30
  if (typeof cell === "boolean") return String(cell);
32
- const digits = typeof cell === "string" && !isNumeric(column) ? void 0 : digitsOf(cell);
31
+ const digits = typeof cell === "string" && !isNumeric(column) ? void 0 : cellDigits(cell);
33
32
  if (digits !== void 0) return written(digits, column);
34
33
  return guarded(typeof cell === "object" ? cell.v : String(cell));
35
34
  }
36
- /** The answer as rows of texts: its headings, then each row, every cell as it is exported. `words` name Other and a total. */
35
+ /**
36
+ * The whole's rows (`time.whole`) in the answer's columns: each cell read by its column's id,
37
+ * since the whole has no time column, and the time cell holding the word a total row's group
38
+ * holds, so the file adds up as the tile reads. None when the answer has no whole.
39
+ */
40
+ function wholeRows(answer, words) {
41
+ const whole = wholeAnswer(answer);
42
+ if (whole === void 0) return [];
43
+ const places = answer.columns.map((column) => whole.columns.findIndex((c) => c.id === column.id));
44
+ return whole.rows.map((cells) => answer.columns.map((column, at) => roleOf(column) === "time" ? guarded(words.total) : cellText(cells[places[at] ?? -1] ?? null, column, words)));
45
+ }
46
+ /**
47
+ * The answer as rows of texts: its headings, then each row, every cell as it is exported, then
48
+ * the whole's rows when it has one. `words` name Other and a total.
49
+ */
37
50
  function exportRows(answer, words) {
38
- return [answer.columns.map((column) => headingOf(column)), ...answer.rows.map((cells) => answer.columns.map((column, at) => cellText(cells[at] ?? null, column, words)))];
51
+ return [
52
+ answer.columns.map((column) => headingOf(column)),
53
+ ...answer.rows.map((cells) => answer.columns.map((column, at) => cellText(cells[at] ?? null, column, words))),
54
+ ...wholeRows(answer, words)
55
+ ];
39
56
  }
40
57
  /** The answer as CSV text: a line per row, each ended as RFC 4180 ends one. */
41
58
  const csvOf = (answer, words) => exportRows(answer, words).map((row) => `${row.map((text) => field(text)).join(",")}\r\n`).join("");
@@ -0,0 +1,60 @@
1
+ import { DashboardsError } from "./errors.mjs";
2
+ // src/failure-words.ts
3
+ /**
4
+ * Failures the client words for whoever set the page up, not for the person looking at it: no
5
+ * handler answered at the path. A viewer meets it when their session ends and the host's
6
+ * sign-in layer answers in the handler's place.
7
+ */
8
+ const FOR_SETUP = /* @__PURE__ */ new Set(["NO_HANDLER"]);
9
+ /** Whether a failure's own words are setup advice. */
10
+ const forSetup = (failure) => FOR_SETUP.has(failure.code);
11
+ /** The setup advice already told, so each is told once, not on every draw. */
12
+ const told = /* @__PURE__ */ new Set();
13
+ /** Tells setup advice where its reader looks: the browser's console. */
14
+ function tellSetup(advice) {
15
+ if (told.has(advice)) return;
16
+ told.add(advice);
17
+ console.error(`derive-dashboards: ${advice}`);
18
+ }
19
+ /** Refusals that pass on a later try: asked too often, or too slow to arrive. */
20
+ const PASSING = /* @__PURE__ */ new Set([
21
+ 408,
22
+ 425,
23
+ 429
24
+ ]);
25
+ /** Whether asking again may work: the network, a server's failure, or a refusal that passes. */
26
+ const mayPass = (failure) => failure === void 0 || failure.status < 400 || failure.status >= 500 || PASSING.has(failure.status);
27
+ /** Statuses that say to wait and ask again: asked too often, too early, too slowly, or a server not ready. */
28
+ const BUSY = /* @__PURE__ */ new Set([...PASSING, 503]);
29
+ /**
30
+ * What a failure that may pass says, where something answered: whether waiting helps. The
31
+ * server is busy, or it failed. It was reached either way, so neither says it was not.
32
+ */
33
+ const passingWords = (failure, messages) => BUSY.has(failure.status) ? messages.dashboardBusy : messages.dashboardServerFailed;
34
+ /** Whether something in front of the handler turned the viewer away: a 401 or a 403 no handler sent. */
35
+ const turnedAway = (failure) => failure instanceof DashboardsError && forSetup(failure) && (failure.status === 401 || failure.status === 403);
36
+ /**
37
+ * Whether the viewer is signed out: the handler's own 401, its host's `viewer` having found no
38
+ * one, or something in front of the handler turning them away (`turnedAway`). Its own 403 is
39
+ * not: that viewer is signed in, and may not see what they asked for.
40
+ */
41
+ const signedOut = (failure) => failure instanceof DashboardsError && (failure.status === 401 || turnedAway(failure));
42
+ /**
43
+ * What a viewer is told in place of setup advice: to sign in again where something in front of
44
+ * the handler turned them away (a 401, a 403), else that the page is not set up, which only
45
+ * whoever set it up can change.
46
+ */
47
+ const setupWords = (failure, messages) => failure.status === 401 || failure.status === 403 ? messages.dashboardSignedOut : messages.dashboardSetup;
48
+ /**
49
+ * What a failed action says on the page: that the server cannot be reached, where the request
50
+ * never arrived; the handler's own words for its refusal; or, where no handler answered, what
51
+ * a viewer can do (sign in again, wait, nothing), the setup advice going to the console.
52
+ */
53
+ function failureWords(failure, messages) {
54
+ if (failure instanceof TypeError) return messages.serverUnreachable;
55
+ if (!(failure instanceof DashboardsError)) return failure instanceof Error ? failure.message : String(failure);
56
+ if (!forSetup(failure)) return failure.message;
57
+ tellSetup(failure.message);
58
+ return mayPass(failure) ? passingWords(failure, messages) : setupWords(failure, messages);
59
+ }
60
+ export { failureWords, forSetup, mayPass, passingWords, setupWords, signedOut, tellSetup, turnedAway };
@@ -9,4 +9,4 @@ import { FilterBarProps } from "./hooks.mjs";
9
9
  * Every part carries a `dd-fb-*` class and the theme styles it in its own cascade layer, so your
10
10
  * CSS wins without `!important`; colors and sizes are the theme's `--dd-*` variables.
11
11
  */
12
- export declare function FilterBar({ controls, picks, onChange, timezone, ...options }: FilterBarProps & FilterBarOptions): import("react").JSX.Element | null;
12
+ export declare function FilterBar({ controls, picks, onChange, timezone, span, ...options }: FilterBarProps & FilterBarOptions): import("react").JSX.Element | null;
@@ -1,4 +1,5 @@
1
1
  import { useDashboards } from "../context.mjs";
2
+ import { useSaysDates } from "../says-dates.mjs";
2
3
  import { Chip } from "./chip.mjs";
3
4
  import { BarContext, useBar, useWords } from "./context.mjs";
4
5
  import { useFilterFields } from "./hooks.mjs";
@@ -101,7 +102,8 @@ function DesktopBar({ controls, pinned, linked, removeLast, onReset }) {
101
102
  * Every part carries a `dd-fb-*` class and the theme styles it in its own cascade layer, so your
102
103
  * CSS wins without `!important`; colors and sizes are the theme's `--dd-*` variables.
103
104
  */
104
- function FilterBar({ controls, picks, onChange, timezone, ...options }) {
105
+ function FilterBar({ controls, picks, onChange, timezone, span, ...options }) {
106
+ useSaysDates();
105
107
  const fields = useFilterFields(controls);
106
108
  const narrow = useNarrow();
107
109
  const { setPick, removeLast, reset, undo, takeBack } = useBarPicks(controls, picks, onChange);
@@ -111,6 +113,7 @@ function FilterBar({ controls, picks, onChange, timezone, ...options }) {
111
113
  fields,
112
114
  options,
113
115
  timezone,
116
+ span,
114
117
  picks,
115
118
  setPick
116
119
  };
@@ -1,5 +1,6 @@
1
+ import { dateFormat } from "../format-time.mjs";
1
2
  import { useBar, useLocale, useWords } from "./context.mjs";
2
- import { addDays, dateFormat, isoDay, monthEnd, monthStart, sameDay, todayIn, weekday } from "./days.mjs";
3
+ import { addDays, isoDay, monthEnd, monthStart, sameDay, todayIn, weekday } from "./days.mjs";
3
4
  import { useState } from "react";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  // src/filters/calendar.tsx
@@ -57,6 +58,7 @@ function Day({ d, days }) {
57
58
  className: "dd-fb-day",
58
59
  ...marks.day,
59
60
  "aria-pressed": marks.edge,
61
+ disabled: days.last !== void 0 && d > days.last,
60
62
  tabIndex: focused ? 0 : -1,
61
63
  "aria-label": dateFormat(days.locale, { dateStyle: "full" }).format(d),
62
64
  ref: (el) => {
@@ -102,13 +104,19 @@ function Month({ month, days }) {
102
104
  /** The calendar's state: the range so far (first click, then second), the month shown, focus. */
103
105
  /** The same day of the month in another month, the last day when it has fewer. */
104
106
  const sameDayIn = (d, month) => new Date(month.getFullYear(), month.getMonth(), Math.min(d.getDate(), monthEnd(month).getDate()), 12);
107
+ /** A day, or the last day that can be picked when it is after that one. */
108
+ const upTo = (d, last) => last !== void 0 && d > last ? last : d;
105
109
  function useRange(initial, narrow) {
106
- const today = todayIn(useBar().timezone);
110
+ const bar = useBar();
111
+ const today = todayIn(bar.timezone);
112
+ const last = bar.options.futureDays === true ? void 0 : today;
107
113
  const [range, setRange] = useState(initial ?? {});
108
- const [month, setMonth] = useState(() => monthStart(initial?.from ?? today, initial === void 0 && !narrow ? -1 : 0));
109
- const [focus, setFocus] = useState(initial?.from ?? today);
114
+ const start = upTo(initial?.from ?? today, last);
115
+ const [month, setMonth] = useState(() => monthStart(start, initial === void 0 && !narrow ? -1 : 0));
116
+ const [focus, setFocus] = useState(start);
110
117
  const shown = narrow ? [month] : [month, monthStart(month, 1)];
111
- const onFocus = (d) => {
118
+ const onFocus = (to) => {
119
+ const d = upTo(to, last);
112
120
  setFocus(d);
113
121
  if (d < month) setMonth(monthStart(month, -1));
114
122
  else if (d > monthEnd(shown.at(-1) ?? month)) setMonth(monthStart(month, 1));
@@ -128,20 +136,22 @@ function useRange(initial, narrow) {
128
136
  };
129
137
  const turn = (by) => {
130
138
  setMonth(monthStart(month, by));
131
- setFocus(sameDayIn(focus, monthStart(focus, by)));
139
+ setFocus(upTo(sameDayIn(focus, monthStart(focus, by)), last));
132
140
  };
133
141
  return {
134
142
  today,
143
+ last,
135
144
  range,
136
145
  month,
137
146
  turn,
147
+ ended: last !== void 0 && monthEnd(shown.at(-1) ?? month) >= last,
138
148
  focus,
139
149
  shown,
140
150
  onFocus,
141
151
  pickDay
142
152
  };
143
153
  }
144
- function MonthNav({ onTurn }) {
154
+ function MonthNav({ onTurn, ended }) {
145
155
  const words = useWords();
146
156
  return /* @__PURE__ */ jsxs("div", {
147
157
  className: "dd-fb-cal-nav",
@@ -157,6 +167,7 @@ function MonthNav({ onTurn }) {
157
167
  type: "button",
158
168
  className: "dd-fb-icon-button",
159
169
  "aria-label": words.nextMonth,
170
+ disabled: ended,
160
171
  onClick: () => {
161
172
  onTurn(1);
162
173
  },
@@ -173,6 +184,7 @@ function Calendar({ initial, narrow, onChange }) {
173
184
  to: cal.range.to,
174
185
  focus: cal.focus,
175
186
  today: cal.today,
187
+ last: cal.last,
176
188
  locale,
177
189
  onFocus: cal.onFocus,
178
190
  onPick: (d) => {
@@ -181,7 +193,10 @@ function Calendar({ initial, narrow, onChange }) {
181
193
  };
182
194
  return /* @__PURE__ */ jsxs("div", {
183
195
  className: "dd-fb-cal",
184
- children: [/* @__PURE__ */ jsx(MonthNav, { onTurn: cal.turn }), /* @__PURE__ */ jsx("div", {
196
+ children: [/* @__PURE__ */ jsx(MonthNav, {
197
+ onTurn: cal.turn,
198
+ ended: cal.ended
199
+ }), /* @__PURE__ */ jsx("div", {
185
200
  className: "dd-fb-months",
186
201
  children: cal.shown.map((m) => /* @__PURE__ */ jsx(Month, {
187
202
  month: m,
@@ -1,5 +1,6 @@
1
1
  import { rangeOf, useBar, useSummary, useWords, valuePickOf } from "./context.mjs";
2
2
  import { DatePicker } from "./dates.mjs";
3
+ import { useDates } from "./dates-said.mjs";
3
4
  import { chosenOf, flipped, isNumber, toggled } from "./logic.mjs";
4
5
  import { NumberPicker } from "./number.mjs";
5
6
  import { OperatorMenu } from "./operator.mjs";
@@ -51,13 +52,16 @@ function Picker({ control, narrow, close }) {
51
52
  /** What a chip's value segment shows: the chosen values with their marks, or the pick in words. */
52
53
  function ChipValue({ control, said }) {
53
54
  const { fields, picks } = useBar();
54
- const words = useWords();
55
55
  const pick = valuePickOf(picks, control.id);
56
+ const { text, beside } = useDates(control, said);
56
57
  if (control.kind === "filter" && pick !== void 0 && !isNumber(control, fields)) return /* @__PURE__ */ jsx(ValuesSummary, {
57
58
  control,
58
59
  values: chosenOf(pick)
59
60
  });
60
- return /* @__PURE__ */ jsx(Fragment$1, { children: said ?? words.widgetDates });
61
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [text, beside === void 0 ? null : /* @__PURE__ */ jsx("span", {
62
+ className: "dd-fb-span",
63
+ children: beside
64
+ })] });
61
65
  }
62
66
  function FieldSegment({ control, open, toggle }) {
63
67
  const words = useWords();
@@ -93,7 +97,7 @@ function SetChip({ control, said, open, toggle }) {
93
97
  const { fields, picks, setPick } = useBar();
94
98
  const pick = valuePickOf(picks, control.id);
95
99
  const operator = control.kind === "filter" && pick !== void 0 && !isNumber(control, fields);
96
- const now = said ?? words.widgetDates;
100
+ const now = useDates(control, said).spoken;
97
101
  return /* @__PURE__ */ jsxs("fieldset", {
98
102
  className: "dd-fb-chip",
99
103
  "aria-label": `${control.label} ${now}`,
@@ -1,6 +1,6 @@
1
1
  import "./logic.mjs";
2
- import { ComponentType, ReactNode } from "react";
3
2
  import { Control, DateRange, Picks, Primitive } from "derive-dashboards/core";
3
+ import { ComponentType, ReactNode } from "react";
4
4
  /** An icon: any component taking a className, such as one from lucide-react. */
5
5
  export type FilterIcon = ComponentType<{
6
6
  className?: string;
@@ -19,4 +19,16 @@ export type FilterBarOptions = {
19
19
  formatValue?: (control: Control, value: Primitive) => string | undefined;
20
20
  /** How many unset filters show as chips before the rest wait in the Filter menu. Default 4. */
21
21
  pinned?: number;
22
+ /**
23
+ * Whether the bar takes its two keys: F opens the Filter menu and Shift+F removes the last
24
+ * filter, anywhere on the page but in a field. On by default. A page with keys of its own
25
+ * turns them off, and the Filter button then shows no key.
26
+ */
27
+ shortcuts?: boolean;
28
+ /**
29
+ * Whether a day after today can be picked in the calendar. Off by default: a dashboard of what
30
+ * happened has nothing there, and a range that runs into next month reads as a chart that
31
+ * broke. A dashboard of what is planned (renewals, bookings) turns it on.
32
+ */
33
+ futureDays?: boolean;
22
34
  };
@@ -3,8 +3,8 @@ import { rangeLabel } from "./days.mjs";
3
3
  import { chosenOf, defaultFormat, isNumber, listText, pickOpWord } from "./logic.mjs";
4
4
  import { numberText } from "./numbers.mjs";
5
5
  import { ENGLISH_FILTERS } from "./words.mjs";
6
- import { createContext, useContext } from "react";
7
6
  import { isDateRange, isValuePick } from "derive-dashboards/core";
7
+ import { createContext, useContext } from "react";
8
8
  // src/filters/context.ts
9
9
  const BarContext = createContext({
10
10
  fields: {},
@@ -0,0 +1,57 @@
1
+ import { rangeOf, useBar, useWords } from "./context.mjs";
2
+ // src/filters/dates-said.ts
3
+ /** In place of dates not known yet, to the eye: the tiles' answers are on their way. */
4
+ const WAITING = "…";
5
+ /** What is seen and what is heard in place of the dashboard's dates: a mark and a word while they are not known. */
6
+ const datesOf = (span, loading) => span === null ? {
7
+ seen: WAITING,
8
+ heard: loading
9
+ } : {
10
+ seen: span,
11
+ heard: span
12
+ };
13
+ /**
14
+ * What a date control with no pick says: the dashboard's dates, or that each widget has its
15
+ * own. To the ear the dates shown are said as shown ("showing Aug 23 to Nov 20"), not as a
16
+ * pick, which would read the same.
17
+ */
18
+ function unpicked(span, words) {
19
+ const dates = datesOf(span, words.datesLoading);
20
+ const heard = typeof span === "string" ? words.datesShowing(span) : dates.heard;
21
+ const none = words.widgetDates;
22
+ return {
23
+ text: dates.seen ?? none,
24
+ beside: void 0,
25
+ spoken: heard ?? none
26
+ };
27
+ }
28
+ /**
29
+ * What a control says, given its pick in words (`said`). A date control says the dashboard's
30
+ * dates (`span`): in place of a pick when there is none, and beside one that names no dates
31
+ * itself ("Last 30 days"). A pick of dates says them already. While the dates are not known
32
+ * yet (the tiles' answers are on their way) it says so where the dates will be: a mark to the
33
+ * eye, a word to the ear. Any other control says its pick, and nothing with none.
34
+ */
35
+ function useDates(control, said) {
36
+ const { picks, span } = useBar();
37
+ const words = useWords();
38
+ if (control.kind !== "date_range") return {
39
+ text: said,
40
+ beside: void 0,
41
+ spoken: said ?? ""
42
+ };
43
+ if (said === void 0) return unpicked(span, words);
44
+ const dates = datesOf(span, words.datesLoading);
45
+ const range = rangeOf(picks, control.id);
46
+ if (range === void 0 || !("last" in range) || dates.seen === void 0) return {
47
+ text: said,
48
+ beside: void 0,
49
+ spoken: said
50
+ };
51
+ return {
52
+ text: said,
53
+ beside: dates.seen,
54
+ spoken: `${said}, ${dates.heard ?? ""}`
55
+ };
56
+ }
57
+ export { useDates };
@@ -1,8 +1,6 @@
1
1
  import { RelativeRange as RelativeRange$1 } from "./logic.mjs";
2
+ import { dateFormat } from "../format-time.mjs";
2
3
  import { DateRange } from "derive-dashboards/core";
3
- /** A date format for a locale (the viewer's when none), made once. */
4
- export declare function dateFormat(locale: string | undefined, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
5
- export declare const DAY_ONLY: RegExp;
6
4
  /** A local date as a plain day, "2026-10-01". */
7
5
  export declare const isoDay: (d: Date) => string;
8
6
  /** A plain day ("2026-10-01") as a local date at noon, so no zone can move it. */
@@ -33,4 +31,5 @@ export declare function rangeLabel(r: DateRange, locale?: string): string;
33
31
  /** Today as a plain day in a time zone (the viewer's when none), at noon so no zone moves it. */
34
32
  export declare function todayIn(zone: string | undefined, now?: Date): Date;
35
33
  /** The days a calendar pick sends: plain days, the end excluded, read by the server in the dashboard's zone. */
36
- export declare const daysPick: (first: Date, last: Date) => DateRange;
34
+ export declare const daysPick: (first: Date, last: Date) => DateRange;
35
+ export { dateFormat };
@@ -1,16 +1,6 @@
1
+ import { dateFormat, instantOf } from "../format-time.mjs";
2
+ import { isDateOnly } from "derive-dashboards/core";
1
3
  // src/filters/days.ts
2
- const formats = /* @__PURE__ */ new Map();
3
- /** A date format for a locale (the viewer's when none), made once. */
4
- function dateFormat(locale, options) {
5
- const key = `${locale ?? ""}|${JSON.stringify(options)}`;
6
- let f = formats.get(key);
7
- if (f === void 0) {
8
- f = new Intl.DateTimeFormat(locale, options);
9
- formats.set(key, f);
10
- }
11
- return f;
12
- }
13
- const DAY_ONLY = /^\d{4}-\d{2}-\d{2}$/u;
14
4
  /** A local date as a plain day, "2026-10-01". */
15
5
  const isoDay = (d) => `${String(d.getFullYear())}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
16
6
  /** A plain day ("2026-10-01") as a local date at noon, so no zone can move it. */
@@ -40,7 +30,7 @@ function explicitDays(r) {
40
30
  }
41
31
  /** The days of a pick that a calendar can show: plain days only, else none. */
42
32
  function pickedDays(r) {
43
- if (r === void 0 || !("from" in r) || !DAY_ONLY.test(r.from) || !DAY_ONLY.test(r.to)) return void 0;
33
+ if (r === void 0 || !("from" in r) || !isDateOnly(r.from) || !isDateOnly(r.to)) return void 0;
44
34
  const { first, last } = explicitDays(r);
45
35
  return {
46
36
  from: first,
@@ -64,17 +54,20 @@ function rangeLabel(r, locale) {
64
54
  dateStyle: "medium",
65
55
  timeStyle: "short"
66
56
  });
67
- return `${instant.format(new Date(r.from))} – ${instant.format(new Date(r.to))}`;
57
+ const write = (text) => {
58
+ const at = instantOf(text);
59
+ return at === void 0 ? text : instant.format(at);
60
+ };
61
+ return `${write(r.from)} – ${write(r.to)}`;
68
62
  }
69
63
  /** Today as a plain day in a time zone (the viewer's when none), at noon so no zone moves it. */
70
64
  function todayIn(zone, now = /* @__PURE__ */ new Date()) {
71
65
  try {
72
66
  return fromIsoDay(dateFormat("en-CA", {
73
- timeZone: zone,
74
67
  year: "numeric",
75
68
  month: "2-digit",
76
69
  day: "2-digit"
77
- }).format(now));
70
+ }, zone).format(now));
78
71
  } catch {
79
72
  return fromIsoDay(isoDay(now));
80
73
  }
@@ -84,4 +77,4 @@ const daysPick = (first, last) => ({
84
77
  from: isoDay(first),
85
78
  to: isoDay(addDays(last, 1))
86
79
  });
87
- export { DAY_ONLY, addDays, dateFormat, daysLabel, daysPick, explicitDays, fromIsoDay, isoDay, monthEnd, monthStart, pickedDays, rangeLabel, relativeLabel, sameDay, todayIn, weekday };
80
+ export { addDays, dateFormat, daysLabel, daysPick, explicitDays, fromIsoDay, isoDay, monthEnd, monthStart, pickedDays, rangeLabel, relativeLabel, sameDay, todayIn, weekday };
@@ -5,6 +5,15 @@ export type FilterBarProps = {
5
5
  onChange: (picks: Picks) => void;
6
6
  /** The dashboard's own time zone when it sets one; calendar days are read in it. */
7
7
  timezone?: string | undefined;
8
+ /**
9
+ * The dates most of the tiles cover, as text: a range ("Aug 23 to Nov 20"), or
10
+ * `messages.tileAllTime` ("All time") when most of them read every date, so it is words to
11
+ * show, never dates to parse. The date control says them: in place of "Each widget's own"
12
+ * when nothing is picked, and beside a pick that names no dates itself ("Last 30 days"). Left
13
+ * out when the tiles share none; null while their answers are on their way, when the control
14
+ * says neither.
15
+ */
16
+ span?: string | null | undefined;
8
17
  };
9
18
  /** A control's values as a bar lists them: what is known, whether a read is under way or failed. */
10
19
  export type ValuesState = {
@@ -12,6 +21,8 @@ export type ValuesState = {
12
21
  loading: boolean;
13
22
  /** The last read failed (earlier values may still be shown); `retry` asks again. */
14
23
  failed: boolean;
24
+ /** It failed because the viewer is signed out: asking again cannot pass until they sign in. */
25
+ signedOut: boolean;
15
26
  retry: () => void;
16
27
  };
17
28
  /**
@@ -1,5 +1,7 @@
1
1
  import { useDashboards } from "../context.mjs";
2
+ import { signedOut } from "../failure-words.mjs";
2
3
  import { ScopeContext } from "../scope.mjs";
4
+ import { parseMemberId } from "derive-dashboards/core";
3
5
  import { useContext, useEffect, useMemo, useState } from "react";
4
6
  import useSWR from "swr";
5
7
  // src/filters/hooks.ts
@@ -47,12 +49,14 @@ function useControlValues(control, options = {}) {
47
49
  values: ownValues,
48
50
  loading: false,
49
51
  failed: false,
52
+ signedOut: false,
50
53
  retry: noop
51
54
  };
52
55
  return {
53
56
  values: fetched.data?.values ?? NONE,
54
57
  loading: fetched.isLoading,
55
58
  failed: fetched.error !== void 0,
59
+ signedOut: signedOut(fetched.error),
56
60
  retry: () => {
57
61
  fetched.mutate();
58
62
  }
@@ -60,13 +64,13 @@ function useControlValues(control, options = {}) {
60
64
  }
61
65
  /** A member in the viewer's meta: its own source's dimension, or one a join reaches. */
62
66
  function fieldOf(meta, member) {
63
- const [sourceName, a, b] = member.split(".");
64
- const source = meta?.sources.find((s) => s.name === sourceName);
65
- if (source === void 0 || a === void 0) return void 0;
66
- if (b === void 0) return source.dimensions.find((d) => d.id === member);
67
- const join = source.joins.find((j) => j.name === a);
67
+ const ref = parseMemberId(member);
68
+ const source = meta?.sources.find((s) => s.name === ref?.source);
69
+ if (ref === void 0 || source === void 0) return void 0;
70
+ if (ref.join === void 0) return source.dimensions.find((d) => d.id === member);
71
+ const join = source.joins.find((j) => j.name === ref.join);
68
72
  const target = meta?.sources.find((s) => s.name === join?.source);
69
- return target?.dimensions.find((d) => d.id === `${target.name}.${b}`);
73
+ return target?.dimensions.find((d) => d.id === `${target.name}.${ref.name}`);
70
74
  }
71
75
  /**
72
76
  * What the model says about each filter control's field: its type (a text list, a number, a yes
@@ -11,13 +11,17 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
11
  /** Reads one control's values into the menu's suggestions. One per control, so hooks stay fixed. */
12
12
  function Collect({ control, query, onValues }) {
13
13
  const { grammar } = useWords();
14
- const { values, failed, retry } = useControlValues(control, { search: searchTerm(control, query, grammar) });
14
+ const { values, failed, signedOut, retry } = useControlValues(control, { search: searchTerm(control, query, grammar) });
15
15
  useEffect(() => {
16
- onValues(control.id, values, failed ? retry : null);
16
+ onValues(control.id, values, failed ? {
17
+ retry,
18
+ signedOut
19
+ } : null);
17
20
  }, [
18
21
  control.id,
19
22
  values,
20
23
  failed,
24
+ signedOut,
21
25
  retry,
22
26
  onValues
23
27
  ]);
@@ -50,7 +54,7 @@ function useKnown() {
50
54
  [id]: values
51
55
  });
52
56
  setFailed((f) => {
53
- if (f[id] === void 0 === (retry === null)) return f;
57
+ if (f[id]?.signedOut === retry?.signedOut) return f;
54
58
  const { [id]: _, ...rest } = f;
55
59
  return retry === null ? rest : {
56
60
  ...rest,
@@ -64,18 +68,22 @@ function useKnown() {
64
68
  onValues
65
69
  };
66
70
  }
67
- /** Some fields' values could not be read, so suggestions may be missing: say so, with Retry. */
68
- function MenuFailed({ retries }) {
71
+ /**
72
+ * Some fields' values could not be read, so suggestions may be missing: say so, with Retry.
73
+ * Where the viewer is signed out the line says to sign in, with no Retry that could never pass.
74
+ */
75
+ function MenuFailed({ failed }) {
69
76
  const words = useWords();
70
- if (retries.length === 0) return null;
77
+ if (failed.length === 0) return null;
78
+ const signedOut = failed.some((one) => one.signedOut);
71
79
  return /* @__PURE__ */ jsxs("div", {
72
80
  className: "dd-fb-foot dd-fb-error",
73
81
  role: "alert",
74
- children: [/* @__PURE__ */ jsx("span", { children: words.valuesFailed }), /* @__PURE__ */ jsx("button", {
82
+ children: [/* @__PURE__ */ jsx("span", { children: signedOut ? words.valuesSignedOut : words.valuesFailed }), signedOut ? null : /* @__PURE__ */ jsx("button", {
75
83
  type: "button",
76
84
  className: "dd-fb-link",
77
85
  onClick: () => {
78
- for (const retry of retries) retry();
86
+ for (const one of failed) one.retry();
79
87
  },
80
88
  children: words.retry
81
89
  })]
@@ -204,7 +212,7 @@ function MenuSearch({ controls, steps }) {
204
212
  options,
205
213
  empty: words.menuNoMatch
206
214
  }),
207
- /* @__PURE__ */ jsx(MenuFailed, { retries: failed }),
215
+ /* @__PURE__ */ jsx(MenuFailed, { failed }),
208
216
  /* @__PURE__ */ jsx(Keys, {})
209
217
  ] });
210
218
  }
@@ -1,4 +1,4 @@
1
- import { useWords } from "./context.mjs";
1
+ import { useBar, useWords } from "./context.mjs";
2
2
  import { FieldStep } from "./field-step.mjs";
3
3
  import { MenuSearch } from "./menu-search.mjs";
4
4
  import { Popover } from "./popover.mjs";
@@ -10,15 +10,16 @@ const focusStep = (node) => {
10
10
  };
11
11
  function MenuButton({ anchor, open, hidden, onClick }) {
12
12
  const words = useWords();
13
- const more = hidden > 0 ? words.more(hidden) : void 0;
13
+ const keys = useBar().options.shortcuts !== false;
14
+ const waiting = hidden > 0 ? words.moreFilters(hidden) : void 0;
14
15
  return /* @__PURE__ */ jsxs("button", {
15
16
  ref: anchor,
16
17
  type: "button",
17
18
  className: "dd-fb-add",
18
19
  "aria-haspopup": "dialog",
19
20
  "aria-expanded": open,
20
- "aria-keyshortcuts": "F",
21
- "aria-label": more === void 0 ? words.filter : `${words.filter} (${more})`,
21
+ "aria-keyshortcuts": keys ? "F" : void 0,
22
+ "aria-label": waiting === void 0 ? words.filter : `${words.filter}, ${waiting}`,
22
23
  onClick,
23
24
  children: [
24
25
  /* @__PURE__ */ jsx("span", {
@@ -27,14 +28,15 @@ function MenuButton({ anchor, open, hidden, onClick }) {
27
28
  children: "+"
28
29
  }),
29
30
  words.filter,
30
- more === void 0 ? null : /* @__PURE__ */ jsx("span", {
31
+ waiting === void 0 ? null : /* @__PURE__ */ jsx("span", {
31
32
  className: "dd-fb-count",
32
- children: more
33
+ title: waiting,
34
+ children: words.more(hidden)
33
35
  }),
34
- /* @__PURE__ */ jsx("kbd", {
36
+ keys ? /* @__PURE__ */ jsx("kbd", {
35
37
  "aria-hidden": true,
36
38
  children: "F"
37
- })
39
+ }) : null
38
40
  ]
39
41
  });
40
42
  }