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,45 +1,48 @@
1
1
  "use client";
2
+ import { formatBucket, formatInstant, formatInstantAt } from "./format-time.mjs";
3
+ import { bucketName } from "./bucket-name.mjs";
2
4
  import { WidgetPreview } from "./builder/Preview.mjs";
3
5
  import { useBuilder } from "./builder/useBuilder.mjs";
4
- import { WidgetBuilder } from "./builder/WidgetBuilder.mjs";
5
6
  import { createDashboardsClient } from "./client.mjs";
6
7
  import { DashboardsProvider, useDashboards } from "./context.mjs";
8
+ import { DashboardsError } from "./errors.mjs";
7
9
  import { Dashboard } from "./Dashboard.mjs";
8
10
  import { DashboardList } from "./DashboardList.mjs";
9
11
  import { useDraft } from "./draft.mjs";
10
12
  import { DashboardTile } from "./drill/DashboardTile.mjs";
11
13
  import { DrillPanel } from "./drill/lazy.mjs";
12
- import { formatBucket, formatInstant, formatInstantAt } from "./format-time.mjs";
13
- import { exactDigits } from "./renderers/exact.mjs";
14
14
  import { drillFrom } from "./drill/state.mjs";
15
15
  import { useDrill } from "./drill/useDrill.mjs";
16
16
  import { ENGLISH_DRILL } from "./drill/words.mjs";
17
- import { TableTile } from "./renderers/table.mjs";
18
- import { EditBar } from "./EditBar.mjs";
17
+ import { WidgetBuilder } from "./Editing.mjs";
19
18
  import { csvOf, exportRows } from "./export/csv.mjs";
20
- import { DashboardsError } from "./errors.mjs";
19
+ import { fitted } from "./renderers/props.mjs";
21
20
  import { downloadCsv } from "./export/download.mjs";
21
+ import { TableTile } from "./renderers/table.mjs";
22
22
  import { ENGLISH_FILTERS } from "./filters/words.mjs";
23
23
  import { FilterBar } from "./filters/bar.mjs";
24
24
  import { fieldOf, useControlValues, useFilterFields } from "./filters/hooks.mjs";
25
25
  import { rules_exports } from "./filters/rules.mjs";
26
26
  import { Popover } from "./filters/popover.mjs";
27
27
  import { formatCell, formatTick, plotValue } from "./format.mjs";
28
- import { HistoryPanel, VersionBar } from "./History.mjs";
28
+ import { formatHeadline } from "./headline.mjs";
29
29
  import { ENGLISH } from "./english.mjs";
30
30
  import { ChangeList, Panel } from "./Panel.mjs";
31
- import { ReviewPanel } from "./ReviewPanel.mjs";
31
+ import { EditBar, HistoryPanel, ReviewPanel, VersionBar } from "./Parts.mjs";
32
32
  import { answerIds } from "./renderers/entries.mjs";
33
- import { NumberTile } from "./renderers/index.mjs";
33
+ import { BUILTIN_RENDERERS, NumberTile, headlineColumn } from "./renderers/index.mjs";
34
34
  import { ListTile } from "./renderers/list.mjs";
35
35
  import { useReview } from "./review.mjs";
36
36
  import { ENGLISH_REVIEW } from "./review-words.mjs";
37
+ import { Roving } from "./roving.mjs";
38
+ import { useSaysDates } from "./says-dates.mjs";
37
39
  import { SeriesSlotsContext } from "./scope.mjs";
38
40
  import { OTHER_KEY, lastBucketOpen, toSeries } from "./series.mjs";
39
41
  import { pointCell, pointText, rowAt } from "./series-points.mjs";
40
42
  import { chartColors, seriesSlots } from "./series-slots.mjs";
41
43
  import { Tile } from "./Tile.mjs";
44
+ import { tapOpens, useTapPreview } from "./touch.mjs";
42
45
  import { useBoard } from "./useBoard.mjs";
43
46
  import { useDashboard } from "./useDashboard.mjs";
44
47
  import { useTiles } from "./useTiles.mjs";
45
- export { ChangeList, Dashboard, DashboardList, DashboardTile, DashboardsError, DashboardsProvider, DrillPanel, ENGLISH, ENGLISH_DRILL, ENGLISH_FILTERS, ENGLISH_REVIEW, EditBar, FilterBar, HistoryPanel, ListTile, NumberTile, OTHER_KEY, Panel, Popover, ReviewPanel, SeriesSlotsContext, TableTile, Tile, VersionBar, WidgetBuilder, WidgetPreview, answerIds, chartColors, createDashboardsClient, csvOf, downloadCsv, drillFrom, exactDigits, exportRows, fieldOf, rules_exports as filterRules, formatBucket, formatCell, formatInstant, formatInstantAt, formatTick, lastBucketOpen, plotValue, pointCell, pointText, rowAt, seriesSlots, toSeries, useBoard, useBuilder, useControlValues, useDashboard, useDashboards, useDraft, useDrill, useFilterFields, useReview, useTiles };
48
+ export { BUILTIN_RENDERERS, ChangeList, Dashboard, DashboardList, DashboardTile, DashboardsError, DashboardsProvider, DrillPanel, ENGLISH, ENGLISH_DRILL, ENGLISH_FILTERS, ENGLISH_REVIEW, EditBar, FilterBar, HistoryPanel, ListTile, NumberTile, OTHER_KEY, Panel, Popover, ReviewPanel, Roving, SeriesSlotsContext, TableTile, Tile, VersionBar, WidgetBuilder, WidgetPreview, answerIds, bucketName, chartColors, createDashboardsClient, csvOf, downloadCsv, drillFrom, exportRows, fieldOf, rules_exports as filterRules, fitted, formatBucket, formatCell, formatHeadline, formatInstant, formatInstantAt, formatTick, headlineColumn, lastBucketOpen, plotValue, pointCell, pointText, rowAt, seriesSlots, tapOpens, toSeries, useBoard, useBuilder, useControlValues, useDashboard, useDashboards, useDraft, useDrill, useFilterFields, useReview, useSaysDates, useTapPreview, useTiles };
@@ -0,0 +1,38 @@
1
+ import { useSyncExternalStore } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ // src/lazy.tsx
4
+ /**
5
+ * A part only some viewers open (the drill panel, the widget builder, the tabs while editing),
6
+ * its module loaded on the first mount, never on the server, so a dashboard that never opens it
7
+ * never downloads it. Each mounted part hears when the one shared import settles; until then it
8
+ * draws nothing, or `Before` where what stands in its place must not blink away, and a failed
9
+ * import is thrown to the nearest error boundary.
10
+ */
11
+ function lazyPart(load, Before) {
12
+ let loaded = null;
13
+ let pending;
14
+ const settle = async () => {
15
+ try {
16
+ loaded = { part: await load() };
17
+ } catch (error) {
18
+ loaded = { error };
19
+ }
20
+ };
21
+ const subscribe = (notify) => {
22
+ let listener = notify;
23
+ pending ??= settle();
24
+ pending.then(() => listener?.());
25
+ return () => {
26
+ listener = void 0;
27
+ };
28
+ };
29
+ const snapshot = () => loaded;
30
+ const serverSnapshot = () => null;
31
+ return function LazyPart(props) {
32
+ const module = useSyncExternalStore(subscribe, snapshot, serverSnapshot);
33
+ if (module === null) return Before === void 0 ? null : /* @__PURE__ */ jsx(Before, { ...props });
34
+ if ("error" in module) throw module.error;
35
+ return /* @__PURE__ */ jsx(module.part, { ...props });
36
+ };
37
+ }
38
+ export { lazyPart };
@@ -23,15 +23,62 @@ export type Messages = ReviewMessages & DrillMessages & BuilderMessages & {
23
23
  sortBy: (column: string) => string;
24
24
  /** Under a long table that draws its first rows only: "Show 500 more of 5,000 rows". Both counts are already written for the reader. */
25
25
  showMoreRows: (more: string, of: string) => string;
26
+ /** On the same button once every row is drawn: folds a long table or list back to its first rows. */
27
+ showFirstRows: (first: string) => string;
26
28
  loading: string;
29
+ /** A tile of a kind no renderer draws: the kind, and the kinds the provider has renderers for. */
30
+ noRenderer: (kind: string, kinds: readonly string[]) => string;
27
31
  noAccess: string;
28
32
  noData: string;
29
33
  noRows: string;
30
34
  /** Beside the last time bucket while it is still running: its value is not final yet. */
31
35
  soFar: string;
36
+ /**
37
+ * In place of a tile's dates, once the viewer has picked dates, on a tile that reads every
38
+ * date whatever is picked (a lifetime figure).
39
+ */
40
+ tileAllTime: string;
32
41
  dashboardFailed: string;
42
+ /**
43
+ * After `dashboardFailed`, when something in front of the handler answered that the
44
+ * viewer is not signed in or may not ask (a 401 or a 403 with no handler behind it):
45
+ * most often a session that ended while the page was open.
46
+ */
47
+ dashboardSignedOut: string;
48
+ /**
49
+ * After `dashboardFailed`, when nothing is mounted where the page asks (a 404 with no
50
+ * handler behind it): the page is set up wrong, which a retry does not change. What is
51
+ * missing is written to the browser's console.
52
+ */
53
+ dashboardSetup: string;
54
+ /** After `dashboardFailed`, with "Try again": the server said to wait (a 429, a 503). */
55
+ dashboardBusy: string;
56
+ /** After `dashboardFailed`, with "Try again": the server failed (a 500). */
57
+ dashboardServerFailed: string;
58
+ /** An action that never reached the server, or met a server that could not answer just now. */
59
+ serverUnreachable: string;
33
60
  /** A dashboard already shown, while the server cannot be reached. */
34
61
  dashboardUnreachable: string;
62
+ /**
63
+ * A dashboard already shown, when reading it again met a sign-in layer turning the viewer
64
+ * away (a 401, a 403 or a redirect with no handler behind it): the session may have ended.
65
+ * It does not update until the viewer signs in again.
66
+ */
67
+ dashboardSignedOutShown: string;
68
+ /**
69
+ * On a tile that still shows its answer to the filters picked before, because a sign-in
70
+ * layer turned away its request for the filters picked now.
71
+ */
72
+ tileNotUpdated: string;
73
+ /**
74
+ * On a tile that still shows its answer to the filters picked before, because the request
75
+ * for the filters picked now did not arrive or the server failed it: it is asked for again.
76
+ */
77
+ tileNotUpdatedYet: string;
78
+ /** Said once for the whole dashboard, to a screen reader: how many tiles are not updated yet. */
79
+ tilesNotUpdatedYet: (tiles: number) => string;
80
+ /** Share, where the clipboard is refused: the line over the link to copy by hand. */
81
+ shareCopyByHand: string;
35
82
  /** A dashboard this viewer cannot find: never published, removed, or not shared with them. */
36
83
  dashboardMissing: string;
37
84
  rowsFailed: string;
@@ -126,6 +173,12 @@ export type Messages = ReviewMessages & DrillMessages & BuilderMessages & {
126
173
  chartPartial?: string;
127
174
  chartAveraged?: (count: number) => string;
128
175
  chartMerged?: (count: number, grain: Grain, approximate: boolean) => string;
176
+ /**
177
+ * Under a bar chart whose bars each add up a split: the parts, the first few by name and
178
+ * the rest counted with `moreRows`. Default: "Each bar adds up low, high and Other. Show it
179
+ * as a table to see each."
180
+ */
181
+ chartSummed?: (parts: readonly string[]) => string;
129
182
  chartFunnel?: {
130
183
  continues: (percent: string) => string;
131
184
  largestDrop: string;
@@ -133,7 +186,7 @@ export type Messages = ReviewMessages & DrillMessages & BuilderMessages & {
133
186
  ofFirstStep: (percent: string) => string;
134
187
  ofStepBefore: (percent: string) => string;
135
188
  };
136
- /** What the builder keeps as it was, though it cannot edit it. */
189
+ /** What the builder keeps as it was, though it cannot edit it: `display` is a display option it does not offer for the kind. */
137
190
  keptAside: (kept: {
138
191
  display: boolean;
139
192
  queries: readonly string[];
@@ -176,6 +229,28 @@ export type Messages = ReviewMessages & DrillMessages & BuilderMessages & {
176
229
  discardAsk: (changes: number) => string;
177
230
  /** A tab with no widgets yet, while editing. */
178
231
  emptyTab: string;
232
+ /** After the last tab while editing: adds a tab. */
233
+ addTab: string;
234
+ /** A new tab's name: "New tab", then "New tab 2" when that is taken. */
235
+ newTab: (n: number) => string;
236
+ /** The field a tab's name is edited in, and what it says when left empty. */
237
+ tabName: string;
238
+ tabNameEmpty: string;
239
+ /** What the name field says of a name another tab already has, with that tab's name as it writes it. */
240
+ tabNameTaken: (title: string) => string;
241
+ /** Screen-reader name of the button that opens a tab's menu, which says which tab. */
242
+ tabOptions: (title: string) => string;
243
+ /** A tab's menu: Rename, Move left, Move right, Remove tab. */
244
+ renameTab: string;
245
+ moveTabLeft: string;
246
+ moveTabRight: string;
247
+ removeTab: string;
248
+ /** Remove tab while it asks, naming the tab and how many tiles go with it. */
249
+ removeTabAsk: (title: string, tiles: number) => string;
250
+ /** What Remove tab reads while its question is asked: the answer that removes the tab. */
251
+ removeTabYes: string;
252
+ /** Why the only tab cannot be removed. */
253
+ lastTab: string;
179
254
  /** The button that confirms a discard, so it never reads the same as the one that asked. */
180
255
  discardConfirm: string;
181
256
  /** Discard on a dashboard never published, which goes with its draft. */
@@ -186,8 +261,9 @@ export type Messages = ReviewMessages & DrillMessages & BuilderMessages & {
186
261
  unreachable: string;
187
262
  /** Said when a tile is removed while editing. */
188
263
  removedTile: (title: string) => string;
189
- /** A tile whose request failed before any answer came. */
264
+ /** A tile whose request never reached the server, and one the server failed (5xx). */
190
265
  tileUnreachable: string;
266
+ tileServerFailed: string;
191
267
  /** A list (a field's values, the history) that could not be read; with drillRetry beside it. */
192
268
  readFailed: string;
193
269
  /** A field with no values this viewer can see (or none matching the search). */
@@ -0,0 +1,38 @@
1
+ import { useSyncExternalStore } from "react";
2
+ // src/now.ts
3
+ const EVERY = 6e4;
4
+ const listeners = /* @__PURE__ */ new Set();
5
+ let timer;
6
+ /** The time as last read; none while nothing asks. */
7
+ let read;
8
+ function tick() {
9
+ read = Date.now();
10
+ for (const listener of listeners) listener();
11
+ }
12
+ function subscribe(listener) {
13
+ listeners.add(listener);
14
+ if (timer === void 0) {
15
+ read = Date.now();
16
+ timer = setInterval(tick, EVERY);
17
+ }
18
+ return () => {
19
+ listeners.delete(listener);
20
+ if (listeners.size > 0) return;
21
+ clearInterval(timer);
22
+ timer = void 0;
23
+ read = void 0;
24
+ };
25
+ }
26
+ const current = () => read;
27
+ /** Not read: a server, or a caller that asked for no clock. */
28
+ const NOT_READ = void 0;
29
+ const none = () => NOT_READ;
30
+ /** Nothing to listen to, for a caller that writes nothing against the time. */
31
+ const idle = () => () => {};
32
+ /**
33
+ * The time now in milliseconds, read again each minute; undefined on a server and in the first
34
+ * draw. A caller with nothing to write against it says so (`wanted: false`), and is never
35
+ * drawn again for the clock.
36
+ */
37
+ const useNow = (wanted) => useSyncExternalStore(wanted ? subscribe : idle, wanted ? current : none, none);
38
+ export { useNow };
@@ -4,11 +4,13 @@ const overlaps = (a, b) => a.x < b.x + b.w && b.x < a.x + a.w && a.y < b.y + b.h
4
4
  /**
5
5
  * Where a box is drawn on the 12-column CSS grid, as variables the theme places it by: a rule
6
6
  * (the one-column phone layout, or a host's own) can then place it otherwise, which an inline
7
- * grid position would always beat.
7
+ * grid position would always beat. The rows it spans are said alone too, for a rule that
8
+ * sizes it by them.
8
9
  */
9
10
  const placeOf = (box) => ({
10
11
  "--dd-at-column": `${String(box.x + 1)} / span ${String(box.w)}`,
11
- "--dd-at-row": `${String(box.y + 1)} / span ${String(box.h)}`
12
+ "--dd-at-row": `${String(box.y + 1)} / span ${String(box.h)}`,
13
+ "--dd-at-rows": String(box.h)
12
14
  });
13
15
  /** Brings an element into view when asked, without motion if the viewer asked for none. */
14
16
  function useBringIntoView(wanted) {
@@ -1,3 +1,4 @@
1
+ import "./errors.mjs";
1
2
  import { CoreContract, TileLine } from "derive-dashboards/core";
2
3
  /**
3
4
  * Schemas the client checks answers with: `{ answers: answerSchemas, tileLine: tileLineSchema }`
@@ -1,18 +1,140 @@
1
1
  import { DashboardsError } from "./errors.mjs";
2
2
  import { CONTRACT_VERSION } from "derive-dashboards/core";
3
3
  // src/read.ts
4
+ /** Statuses a server or a proxy answers with when it cannot answer just now, whatever is mounted. */
5
+ const AWAY = /* @__PURE__ */ new Set([
6
+ 408,
7
+ 425,
8
+ 429
9
+ ]);
10
+ /** The path of a URL, absolute or relative to the page. */
11
+ const pathOf = (url) => new URL(url || "/", "http://x/").pathname;
12
+ /**
13
+ * What the client says of a failure no handler sent, to whoever set the page up. A 401 or a 403
14
+ * is most often a sign-in layer in front of the handler, turning away a session that ended. A
15
+ * server's own failure (a 500, a 502) or a refusal for now (a 429) is most often a proxy or a
16
+ * server that could not answer, with the mount as it should be. Any other is most often nothing
17
+ * mounted at the path.
18
+ */
19
+ function noHandler(response) {
20
+ const path = pathOf(response.url);
21
+ const status = String(response.status);
22
+ if (response.status === 401 || response.status === 403) return `Something in front of the dashboards handler answered ${path} (${status}): most often a sign-in layer turning away a session that ended. If the viewer is signed in, check that the handler is mounted at that path and that requests to it pass that layer.`;
23
+ if (response.status === 413) return `Something in front of the dashboards handler refused the request to ${path} as too large (413): most often a body parser's limit (express.json() takes 100 kB unless told otherwise). Mount the handler before that parser, or raise its limit for that path.`;
24
+ if (response.status >= 500 || AWAY.has(response.status)) return `Something in front of the dashboards handler answered ${path} (${status}): most often a proxy or a server that could not answer just now. The page offers to try again. If it keeps happening, check the server behind that path before the mount.`;
25
+ return `No dashboards handler answered ${path} (${status}). Mount the handler at that path, or set the client's baseURL to where it is mounted. A server on another origin must also expose the dd-contract header.`;
26
+ }
27
+ /** Whether an answer is a redirect nobody followed: an opaque redirect in a browser, a 3xx elsewhere. */
28
+ const leftUnfollowed = (response) => response.type === "opaqueredirect" || response.status >= 300 && response.status < 400;
29
+ /**
30
+ * Whether an answer is a redirect that fetch left for the caller (`redirect: "manual"`), not
31
+ * the handler's: one nobody followed, with no fingerprint.
32
+ */
33
+ const unfollowed = (response) => response.headers.get("dd-contract") === null && leftUnfollowed(response);
34
+ /**
35
+ * A redirect the browser would not let this page follow and read: most often a sign-in page on
36
+ * another site (Okta, Auth0, a cloud's access proxy) turning away a session that ended. It is a
37
+ * viewer turned away, as a sign-in layer's 401 is, so the page says the same.
38
+ */
39
+ function redirectedAway(url) {
40
+ return new DashboardsError(401, {
41
+ code: "NO_HANDLER",
42
+ message: `The request to ${pathOf(url)} was redirected somewhere this page may not read: most often a sign-in page on another site turning away a session that ended. If the viewer is signed in, check that requests to that path reach the dashboards handler without a redirect.`
43
+ });
44
+ }
45
+ /** The types a web page is sent as: HTML, or XHTML. */
46
+ const PAGE_TYPES = ["text/html", "application/xhtml+xml"];
47
+ /** Redirects that keep a request's method and body, so the handler behind one reads it as sent. */
48
+ const KEEPS_METHOD = /* @__PURE__ */ new Set([307, 308]);
49
+ /** The handler's own words for a refusal, or the status's where its body has none. */
50
+ async function ownWords(response) {
51
+ const parsed = await response.json().catch(() => null);
52
+ const error = typeof parsed === "object" && parsed !== null && "error" in parsed ? parsed.error : null;
53
+ const message = typeof error === "object" && error !== null && "message" in error ? error.message : null;
54
+ return typeof message === "string" ? message : response.statusText;
55
+ }
56
+ /**
57
+ * A POST that a redirect turned into a GET: fetch follows a 301, 302 or 303 as a GET, and the
58
+ * handler behind it answers its own 404, since its endpoints answer POST. That is a setup to
59
+ * change, not the handler refusing what was asked, so it is said to whoever set the page up,
60
+ * with the handler's words. Read only by the handler's fingerprint and status, never by its
61
+ * words. A 307 or 308 keeps the POST, so a 404 behind one is the handler's own; in a browser
62
+ * the redirect's status is hidden (an opaque redirect), so there any redirect counts.
63
+ */
64
+ async function methodLost(first, followed, asked) {
65
+ if (asked.method !== "POST" || KEEPS_METHOD.has(first.status)) return void 0;
66
+ if (followed.status !== 404 || followed.headers.get("dd-contract") === null) return void 0;
67
+ const ended = followed.redirected ? ` and ended at ${pathOf(followed.url)}` : "";
68
+ return new DashboardsError(404, {
69
+ code: "NO_HANDLER",
70
+ message: `The request to ${pathOf(asked.url)} was redirected${ended}, where the dashboards handler answered: “${await ownWords(followed)}” A 301, 302 or 303 redirect turns a POST into a GET. In the client's options, set baseURL to where the handler answers, or redirect with 307 or 308.`
71
+ });
72
+ }
73
+ /** Whether an ok answer is a web page, which the handler never sends. */
74
+ function webPage(response) {
75
+ const type = (response.headers.get("content-type") ?? "").toLowerCase();
76
+ return response.ok && PAGE_TYPES.some((page) => type.startsWith(page));
77
+ }
78
+ /** Where a redirect sent the request, when the answer says: the page it ended at, or its Location. */
79
+ function sentTo(response) {
80
+ if (response.redirected) return pathOf(response.url);
81
+ const location = response.headers.get("location");
82
+ return location === null ? void 0 : pathOf(location);
83
+ }
84
+ /**
85
+ * What the client says, to whoever set the page up, of a redirect answered where the handler
86
+ * was asked: most often a sign-in layer sending a viewer whose session ended to its sign-in
87
+ * page, the way most of them turn a viewer away.
88
+ */
89
+ function signInPage(response, asked) {
90
+ const to = sentTo(response);
91
+ return `The request to ${asked} was ${to === void 0 ? "redirected, and the browser does not say where" : `redirected to ${to}`}: most often a sign-in page turning away a session that ended. If the viewer is signed in, check that requests to that path reach the dashboards handler without one.`;
92
+ }
93
+ /**
94
+ * Whether an answer with no fingerprint is a viewer turned away to a sign-in page: a redirect
95
+ * left unfollowed, or an answer of success a redirect led to (the sign-in page itself). A
96
+ * redirect that led to an error is that error: a host's own redirect to a proxy's 503 page is
97
+ * an outage, which waiting may mend, not a session that ended.
98
+ */
99
+ const turnedToSignIn = (response) => leftUnfollowed(response) || response.ok && response.redirected;
100
+ /**
101
+ * A web page answered with success that no redirect led to: most often the app's own page,
102
+ * which a single-page app sends for every path nothing else answers, the handler's included
103
+ * until it is mounted. That is a setup to change, so it is said to whoever set the page up and
104
+ * never read as a session that ended: signing in again would bring the same page back.
105
+ */
106
+ function ownPage(response, asked) {
107
+ if (!webPage(response)) return void 0;
108
+ return new DashboardsError(404, {
109
+ code: "NO_HANDLER",
110
+ message: `The request to ${asked} was answered with a web page, not by the dashboards handler: most often the app's own page, sent for any path nothing is mounted at. Mount the handler at that path, or set the client's baseURL to where it is mounted. A sign-in layer that shows its page in place, without a redirect, answers the same.`
111
+ });
112
+ }
113
+ /**
114
+ * Why an answer with no fingerprint is not the handler's, or nothing where it may be. A redirect
115
+ * is a viewer turned away, as a sign-in layer's 401 is, so the page says the same.
116
+ */
117
+ function notTheHandler(response, asked) {
118
+ if (turnedToSignIn(response)) return new DashboardsError(401, {
119
+ code: "NO_HANDLER",
120
+ message: signInPage(response, asked)
121
+ });
122
+ if (!response.ok) return new DashboardsError(response.status, {
123
+ code: "NO_HANDLER",
124
+ message: noHandler(response)
125
+ });
126
+ return ownPage(response, asked);
127
+ }
4
128
  /**
5
129
  * A server from another release: its answers are not read, whatever they hold. An answer with
6
130
  * no fingerprint is refused too when nothing else checks it (no schemas), so a proxy that strips
7
131
  * the header, or a cross-origin server that does not expose it, cannot turn the check off
8
- * silently.
132
+ * silently. `url` is what was asked for, which a redirected answer no longer says.
9
133
  */
10
- function checkContract(response, schemas) {
134
+ function checkContract(response, schemas, url) {
11
135
  const sent = response.headers.get("dd-contract");
12
- if (sent === null && !response.ok) throw new DashboardsError(response.status, {
13
- code: "NO_HANDLER",
14
- message: `No dashboards handler answered ${new URL(response.url || "http://x/").pathname} (${String(response.status)}). Mount the handler at that path, or set the client's baseURL to where it is mounted. A server on another origin must also expose the dd-contract header.`
15
- });
136
+ const other = sent === null ? notTheHandler(response, pathOf(url)) : void 0;
137
+ if (other !== void 0) throw other;
16
138
  if (sent === null && schemas === void 0) throw new DashboardsError(502, {
17
139
  code: "CONTRACT_MISMATCH",
18
140
  message: "The server's answer has no dd-contract header, so this page cannot tell it is the same release. A proxy may be removing it; a server on another origin must expose it (Access-Control-Expose-Headers: dd-contract)."
@@ -40,15 +162,24 @@ function checked(what, parse) {
40
162
  });
41
163
  }
42
164
  }
165
+ /** Whether a path is one of the library's own endpoints, which the schemas have an answer for. */
166
+ const isLibraryPath = (schemas, path) => Object.hasOwn(schemas.answers, path);
43
167
  /** How answers are read: checked by the schemas when the host gave them, else on trust. */
44
168
  function readerOf(schemas) {
169
+ const answer = (path, json) => schemas === void 0 ? trusted(path, json) : checked(path, () => schemas.answers[path].parse(json));
45
170
  return {
46
- answer(path, json) {
47
- return schemas === void 0 ? trusted(path, json) : checked(path, () => schemas.answers[path].parse(json));
171
+ answer,
172
+ /**
173
+ * Any endpoint's answer, by path, as `call` reads it: a library endpoint's as `answer`
174
+ * reads it, so `call("/dashboards/get")` is checked as `getDashboard` is; a plugin's,
175
+ * typed by `TypedCall` from the server's own endpoint, as it came.
176
+ */
177
+ any(path, json) {
178
+ return schemas !== void 0 && isLibraryPath(schemas, path) ? answer(path, json) : json;
48
179
  },
49
180
  line(json) {
50
181
  return schemas === void 0 ? trusted("/dashboards/tiles", json) : checked("/dashboards/tiles", () => schemas.tileLine.parse(json));
51
182
  }
52
183
  };
53
184
  }
54
- export { checkContract, readerOf };
185
+ export { checkContract, methodLost, readerOf, redirectedAway, unfollowed };
@@ -1,68 +1,40 @@
1
+ import { cellDigits, decimalPlaces, formatExact, parseExact } from "derive-dashboards/core";
1
2
  // src/renderers/exact.ts
2
- const PLAIN_DECIMAL = /^-?\d+(\.\d+)?$/u;
3
3
  /**
4
- * A cell's exact digits ("12.50"), when it has them: exact cells written as plain decimals, and
5
- * whole numbers a float holds exactly; undefined for any other float, whose digits are not exact.
4
+ * A cell's digits when they are exact ("12.50"): an exact cell's, and a whole number a float
5
+ * holds exactly. Undefined for any other float, whose digits are how it is written and not what
6
+ * it is, and for text: a change between two such is a float's, written to the figures one keeps.
6
7
  */
7
8
  const exactDigits = (cell) => {
8
9
  if (typeof cell === "number") return Number.isSafeInteger(cell) ? String(cell) : void 0;
9
- if (cell !== null && typeof cell === "object" && "v" in cell && typeof cell.v === "string") return PLAIN_DECIMAL.test(cell.v) ? cell.v : void 0;
10
+ return typeof cell === "string" ? void 0 : cellDigits(cell);
10
11
  };
11
- /** A decimal as an integer of `scale` fraction digits: "12.5" at scale 2 is 1250n. */
12
- const unitsOf = (digits, scale) => {
13
- const negative = digits.startsWith("-");
14
- const [whole = "0", fraction = ""] = digits.replace("-", "").split(".");
15
- return BigInt(`${negative ? "-" : ""}${whole}${fraction.padEnd(scale, "0")}`);
16
- };
17
- /** How many places after the point a decimal text has. */
18
- const placesOf = (digits) => digits.split(".")[1]?.length ?? 0;
19
- /** Which of two exact decimals is the larger: below zero when the first is smaller, zero when they are equal. */
20
- function compareExact(a, b) {
21
- const scale = Math.max(placesOf(a), placesOf(b));
22
- const d = unitsOf(a, scale) - unitsOf(b, scale);
23
- return d === 0n ? 0 : d > 0n ? 1 : -1;
24
- }
25
- /**
26
- * A plain decimal with its point moved `by` places to the right (to the left when negative):
27
- * "0.425" by 2 is "42.5". Only the point moves: every digit is kept, and no float is made.
28
- */
29
- function moved(digits, by) {
30
- const [whole = "0", part = ""] = digits.replace("-", "").split(".");
31
- const all = `${whole}${part}`;
32
- const at = whole.length + by;
33
- const padded = at <= 0 ? `${"0".repeat(1 - at)}${all}` : all.padEnd(at, "0");
34
- const cut = Math.max(at, 1);
35
- const left = padded.slice(0, cut).replace(/^0+(?=\d)/u, "");
36
- const right = padded.slice(cut);
37
- return `${digits.startsWith("-") && /[1-9]/u.test(all) ? "-" : ""}${left}${right === "" ? "" : `.${right}`}`;
12
+ /** Plain decimal text as minor units at a scale it fits; anything else is a caller's fault, not zero. */
13
+ function unitsOf(text, scale) {
14
+ const units = parseExact(text, scale);
15
+ if (units === void 0) throw new TypeError(`"${text}" is not plain decimal text (cellDigits).`);
16
+ return units;
38
17
  }
39
- const EXPONENT = /^(?<digits>-?\d+(?:\.\d+)?)e(?<power>[+-]?\d+)$/iu;
40
- /** The largest power of ten written out: past it a text is not taken for a number worth its zeros. */
41
- const MOST_POWER = 400;
42
- /**
43
- * Decimal text as a plain decimal: itself when it is one, and with its exponent written out
44
- * when it has one ("1e-7" is "0.0000001"). Undefined for a text that is no number.
45
- */
46
- function plainText(text) {
47
- if (PLAIN_DECIMAL.test(text)) return text;
48
- const found = EXPONENT.exec(text)?.groups;
49
- const power = Number(found?.["power"]);
50
- if (found === void 0 || Math.abs(power) > MOST_POWER) return void 0;
51
- return moved(found["digits"] ?? "0", power);
18
+ /** a − b of two plain decimals in minor units at the longer scale of the two, by core. */
19
+ function minus(a, b) {
20
+ const scale = Math.max(decimalPlaces(a), decimalPlaces(b));
21
+ return {
22
+ d: unitsOf(a, scale) - unitsOf(b, scale),
23
+ scale
24
+ };
52
25
  }
53
- /**
54
- * A finite number as plain decimal text: the digits JavaScript writes it in, with an exponent
55
- * written out, so it reads as a number wherever it is pasted.
56
- */
57
- const plainOf = (value) => plainText(String(value)) ?? String(value);
58
- /**
59
- * A number's cell as plain decimal text: an exact cell's digits (an exponent written out),
60
- * the digits a float is written in, or a text that is a number's. Undefined for a cell that is
61
- * not a finite number: a float that is not one, or a text that is no number.
62
- */
63
- function digitsOf(cell) {
64
- if (typeof cell === "number") return Number.isFinite(cell) ? plainOf(cell) : void 0;
65
- if (typeof cell === "string") return plainText(cell.trim());
66
- if (cell !== null && typeof cell === "object" && "v" in cell && typeof cell.v === "string") return plainText(cell.v);
26
+ const signOf$1 = (d) => d === 0n ? 0 : d > 0n ? 1 : -1;
27
+ /** Which of two exact decimals is the larger: below zero when the first is smaller, zero when they are equal. */
28
+ const compareExact = (a, b) => signOf$1(minus(a, b).d);
29
+ /** a − b of two plain decimals, exactly, as a cell of `type`. */
30
+ function exactDifference(a, b, type) {
31
+ const { d, scale } = minus(a, b);
32
+ return {
33
+ sign: signOf$1(d),
34
+ size: {
35
+ t: type,
36
+ v: formatExact(d < 0n ? -d : d, scale)
37
+ }
38
+ };
67
39
  }
68
- export { compareExact, digitsOf, exactDigits, moved, plainOf, plainText, unitsOf };
40
+ export { compareExact, exactDifference, exactDigits };
@@ -1,9 +1,30 @@
1
- import { TileRenderer, TileRendererProps } from "./props.mjs";
2
- import { exactDigits } from "./exact.mjs";
1
+ import { ListTile } from "./list.mjs";
2
+ import { TileRenderer, TileRendererProps, fitted } from "./props.mjs";
3
3
  import { TableTile } from "./table.mjs";
4
+ import { ResultColumn } from "derive-dashboards/core";
5
+ import { ReactNode } from "react";
4
6
  /**
5
- * One value, large, from the total row when there is one, else the first row; a change calc (a
6
- * signed column) sits under it, then a second figure when the widget names one.
7
+ * The value a number tile shows large, as a column of its answer by bucket: what a small trend
8
+ * beside the number draws. Undefined when the answer has no whole, no buckets, or the tile
9
+ * shows no value. `index` is the column's place in `answer.columns`, so a caller reads
10
+ * `answer.rows[i][index]`; the tile itself reads the whole, whose columns have no time column.
7
11
  */
8
- export declare function NumberTile(props: TileRendererProps): import("react").JSX.Element;
9
- export { TableTile, type TileRenderer, type TileRendererProps, exactDigits };
12
+ export declare function headlineColumn(props: TileRendererProps): {
13
+ column: ResultColumn;
14
+ index: number;
15
+ } | undefined;
16
+ /**
17
+ * One value, large, with how it moved and a second figure (`Figures`). With a whole
18
+ * (`time.whole`) every figure is the whole range's, never a bucket's. A chart kit may hand it a
19
+ * small trend (`course`), which it lays beside the large value, or under it in a narrow tile.
20
+ */
21
+ export declare function NumberTile({ course, ...props }: TileRendererProps & {
22
+ course?: ReactNode;
23
+ }): import("react").JSX.Element;
24
+ /** The renderers every dashboard has: a number, a table and a list. */
25
+ export declare const BUILTIN_RENDERERS: {
26
+ number: typeof NumberTile;
27
+ table: typeof TableTile;
28
+ list: typeof ListTile;
29
+ };
30
+ export { TableTile, type TileRenderer, type TileRendererProps, fitted };