derive-dashboards 0.8.0 → 0.10.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 (587) hide show
  1. package/CHANGELOG.md +534 -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 +12 -10
  175. package/dist/core/document/display.mjs +32 -6
  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 +31 -5
  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/tools.mjs +4 -0
  325. package/dist/core/schema/union-error.mjs +30 -7
  326. package/dist/core/schema/view.d.mts +4 -3
  327. package/dist/core/schema/view.mjs +16 -11
  328. package/dist/core/store/ddl.d.mts +0 -2
  329. package/dist/core/store/ddl.mjs +1 -5
  330. package/dist/core/time/bucket.d.mts +1 -19
  331. package/dist/core/time/bucket.mjs +6 -6
  332. package/dist/core/time/compare.mjs +3 -2
  333. package/dist/core/time/index.d.mts +7 -8
  334. package/dist/core/time/instant.d.mts +15 -9
  335. package/dist/core/time/instant.mjs +23 -9
  336. package/dist/core/time/range.d.mts +3 -15
  337. package/dist/core/time/range.mjs +17 -7
  338. package/dist/core/time/stored.d.mts +8 -5
  339. package/dist/core/time/stored.mjs +51 -15
  340. package/dist/core/time/temporal.d.mts +1 -5
  341. package/dist/core/time/temporal.mjs +9 -4
  342. package/dist/core/time/text-time.d.mts +31 -2
  343. package/dist/core/time/text-time.mjs +139 -22
  344. package/dist/core/time/zone.mjs +2 -2
  345. package/dist/core/types/api.d.mts +1 -1
  346. package/dist/core/types/api.mjs +1 -1
  347. package/dist/core/types/dashboard.d.mts +185 -0
  348. package/dist/core/types/dashboard.mjs +26 -0
  349. package/dist/core/types/drill-api.d.mts +14 -2
  350. package/dist/core/types/infer.d.mts +0 -4
  351. package/dist/core/types/options-check.d.mts +42 -0
  352. package/dist/core/types/options-check.mjs +90 -0
  353. package/dist/core/types/options.d.mts +14 -8
  354. package/dist/core/value/casefold.d.mts +1 -3
  355. package/dist/core/value/stored.d.mts +26 -0
  356. package/dist/core/value/stored.mjs +28 -0
  357. package/dist/cursor-seal.mjs +37 -9
  358. package/dist/dashboard-documents.d.mts +14 -6
  359. package/dist/dashboard-documents.mjs +32 -12
  360. package/dist/dashboards.mjs +10 -9
  361. package/dist/drill-access.mjs +6 -6
  362. package/dist/drill-change.mjs +18 -20
  363. package/dist/drill-comparison.mjs +2 -1
  364. package/dist/drill-crumbs.mjs +63 -28
  365. package/dist/drill-distinct.mjs +2 -1
  366. package/dist/drill-explain.mjs +1 -1
  367. package/dist/drill-items.mjs +1 -1
  368. package/dist/drill-open.mjs +39 -23
  369. package/dist/drill-seal.mjs +41 -13
  370. package/dist/drill-share.mjs +1 -1
  371. package/dist/drill-summary.mjs +2 -1
  372. package/dist/drill-targets.mjs +4 -4
  373. package/dist/drill-views.mjs +4 -3
  374. package/dist/drill.mjs +1 -1
  375. package/dist/editing.mjs +5 -3
  376. package/dist/endpoints/index.d.mts +29 -8
  377. package/dist/endpoints/index.mjs +4 -1
  378. package/dist/endpoints/meta.mjs +4 -3
  379. package/dist/endpoints/query.mjs +5 -2
  380. package/dist/endpoints/read.mjs +7 -6
  381. package/dist/endpoints/versions.mjs +2 -1
  382. package/dist/execute.d.mts +3 -0
  383. package/dist/execute.mjs +23 -12
  384. package/dist/grant.d.mts +9 -0
  385. package/dist/grant.mjs +43 -0
  386. package/dist/handler.mjs +8 -13
  387. package/dist/http.d.mts +6 -2
  388. package/dist/http.mjs +6 -2
  389. package/dist/index.d.mts +25 -4
  390. package/dist/index.mjs +91 -40
  391. package/dist/llms.txt +3 -3
  392. package/dist/mcp/api.mjs +2 -1
  393. package/dist/mcp/query.mjs +3 -8
  394. package/dist/mcp/resolve.mjs +9 -2
  395. package/dist/node/index.d.mts +36 -0
  396. package/dist/node/index.mjs +89 -0
  397. package/dist/node/request.d.mts +12 -0
  398. package/dist/node/request.mjs +119 -0
  399. package/dist/node/response.mjs +58 -0
  400. package/dist/principal.mjs +15 -7
  401. package/dist/react/Canvas.mjs +88 -67
  402. package/dist/react/Cell.mjs +2 -1
  403. package/dist/react/Dashboard.d.mts +11 -4
  404. package/dist/react/Dashboard.mjs +42 -42
  405. package/dist/react/DashboardList.mjs +9 -4
  406. package/dist/react/Editing.d.mts +9 -0
  407. package/dist/react/Editing.mjs +8 -3
  408. package/dist/react/Grid.mjs +1 -1
  409. package/dist/react/Header.mjs +4 -35
  410. package/dist/react/History.mjs +3 -2
  411. package/dist/react/LoadFailed.mjs +59 -0
  412. package/dist/react/Panel.d.mts +1 -1
  413. package/dist/react/Panel.mjs +1 -1
  414. package/dist/react/Parts.d.mts +34 -0
  415. package/dist/react/Parts.mjs +9 -6
  416. package/dist/react/ReviewPanel.mjs +1 -1
  417. package/dist/react/RowBody.d.mts +2 -0
  418. package/dist/react/RowBody.mjs +5 -1
  419. package/dist/react/Share.mjs +153 -0
  420. package/dist/react/TabStrip.mjs +37 -0
  421. package/dist/react/Tile.d.mts +3 -1
  422. package/dist/react/Tile.mjs +89 -92
  423. package/dist/react/TileState.mjs +117 -0
  424. package/dist/react/ago.mjs +45 -0
  425. package/dist/react/arrange-steps.mjs +99 -11
  426. package/dist/react/arrange.mjs +11 -4
  427. package/dist/react/board.mjs +2 -2
  428. package/dist/react/bucket-name.d.mts +8 -0
  429. package/dist/react/bucket-name.mjs +13 -0
  430. package/dist/react/builder/DisplayOptions.mjs +219 -0
  431. package/dist/react/builder/Preview.mjs +13 -13
  432. package/dist/react/builder/RangeEditor.mjs +4 -3
  433. package/dist/react/builder/WidgetBuilder.d.mts +1 -7
  434. package/dist/react/builder/WidgetBuilder.mjs +12 -3
  435. package/dist/react/builder/base.d.mts +13 -2
  436. package/dist/react/builder/base.mjs +70 -12
  437. package/dist/react/builder/display.d.mts +3 -0
  438. package/dist/react/builder/display.mjs +257 -0
  439. package/dist/react/builder/labels.mjs +19 -5
  440. package/dist/react/builder/options.mjs +11 -6
  441. package/dist/react/builder/state.mjs +25 -3
  442. package/dist/react/builder/useBuilder.d.mts +7 -1
  443. package/dist/react/builder/useBuilder.mjs +6 -9
  444. package/dist/react/builder/usePreview.mjs +3 -2
  445. package/dist/react/builder/words.d.mts +16 -1
  446. package/dist/react/builder/words.mjs +41 -1
  447. package/dist/react/change-text.mjs +149 -0
  448. package/dist/react/client.d.mts +9 -0
  449. package/dist/react/client.mjs +105 -14
  450. package/dist/react/context.d.mts +24 -3
  451. package/dist/react/context.mjs +23 -7
  452. package/dist/react/dates-shown.mjs +76 -0
  453. package/dist/react/draft.mjs +3 -2
  454. package/dist/react/drill/Bars.mjs +12 -16
  455. package/dist/react/drill/Comparison.mjs +1 -1
  456. package/dist/react/drill/DrillPanel.d.mts +1 -1
  457. package/dist/react/drill/DrillPanel.mjs +2 -1
  458. package/dist/react/drill/Header.mjs +65 -12
  459. package/dist/react/drill/Items.d.mts +1 -1
  460. package/dist/react/drill/Notes.mjs +10 -7
  461. package/dist/react/drill/PanelStates.mjs +8 -1
  462. package/dist/react/drill/Trend.mjs +10 -5
  463. package/dist/react/drill/board.d.mts +1 -1
  464. package/dist/react/drill/host.mjs +4 -1
  465. package/dist/react/drill/lazy.mjs +2 -27
  466. package/dist/react/drill/props.d.mts +17 -7
  467. package/dist/react/drill/props.mjs +55 -14
  468. package/dist/react/drill/state.d.mts +15 -5
  469. package/dist/react/drill/state.mjs +12 -3
  470. package/dist/react/drill/words.d.mts +46 -3
  471. package/dist/react/drill/words.mjs +30 -5
  472. package/dist/react/english.mjs +33 -8
  473. package/dist/react/export/ExportButton.mjs +4 -1
  474. package/dist/react/export/csv.d.mts +7 -2
  475. package/dist/react/export/csv.mjs +24 -7
  476. package/dist/react/failure-words.mjs +60 -0
  477. package/dist/react/filters/bar.d.mts +1 -1
  478. package/dist/react/filters/bar.mjs +4 -1
  479. package/dist/react/filters/calendar.mjs +23 -8
  480. package/dist/react/filters/chip.mjs +7 -3
  481. package/dist/react/filters/context.d.mts +13 -1
  482. package/dist/react/filters/context.mjs +1 -1
  483. package/dist/react/filters/dates-said.mjs +57 -0
  484. package/dist/react/filters/days.d.mts +3 -4
  485. package/dist/react/filters/days.mjs +10 -17
  486. package/dist/react/filters/hooks.d.mts +11 -0
  487. package/dist/react/filters/hooks.mjs +10 -6
  488. package/dist/react/filters/menu-search.mjs +17 -9
  489. package/dist/react/filters/menu.mjs +10 -8
  490. package/dist/react/filters/phone.mjs +41 -16
  491. package/dist/react/filters/place.mjs +40 -0
  492. package/dist/react/filters/popover.mjs +18 -13
  493. package/dist/react/filters/rules.d.mts +4 -3
  494. package/dist/react/filters/rules.mjs +3 -3
  495. package/dist/react/filters/sheet.mjs +7 -3
  496. package/dist/react/filters/state.mjs +6 -1
  497. package/dist/react/filters/values.mjs +24 -7
  498. package/dist/react/filters/words.d.mts +13 -0
  499. package/dist/react/filters/words.mjs +5 -0
  500. package/dist/react/format-time.d.mts +17 -6
  501. package/dist/react/format-time.mjs +152 -33
  502. package/dist/react/format.d.mts +3 -3
  503. package/dist/react/format.mjs +27 -133
  504. package/dist/react/headline.d.mts +6 -3
  505. package/dist/react/headline.mjs +81 -25
  506. package/dist/react/index.d.mts +19 -17
  507. package/dist/react/index.mjs +12 -10
  508. package/dist/react/lazy.mjs +38 -0
  509. package/dist/react/messages.d.mts +78 -2
  510. package/dist/react/now.mjs +38 -0
  511. package/dist/react/read.d.mts +1 -0
  512. package/dist/react/read.mjs +140 -9
  513. package/dist/react/renderers/exact.mjs +31 -59
  514. package/dist/react/renderers/index.d.mts +27 -6
  515. package/dist/react/renderers/index.mjs +141 -102
  516. package/dist/react/renderers/list-parts.mjs +24 -0
  517. package/dist/react/renderers/list.d.mts +1 -0
  518. package/dist/react/renderers/list.mjs +99 -43
  519. package/dist/react/renderers/more-rows.mjs +75 -0
  520. package/dist/react/renderers/number-before.mjs +320 -0
  521. package/dist/react/renderers/number-period.mjs +54 -0
  522. package/dist/react/renderers/number-whole.mjs +29 -0
  523. package/dist/react/renderers/props.d.mts +24 -1
  524. package/dist/react/renderers/props.mjs +8 -0
  525. package/dist/react/renderers/table-cells.mjs +137 -31
  526. package/dist/react/renderers/table-fit.mjs +55 -10
  527. package/dist/react/renderers/table-measure.mjs +29 -9
  528. package/dist/react/renderers/table-row.mjs +14 -9
  529. package/dist/react/renderers/table-scale.mjs +2 -3
  530. package/dist/react/renderers/table-sort.mjs +3 -2
  531. package/dist/react/renderers/table-whole.mjs +37 -0
  532. package/dist/react/renderers/table.mjs +73 -53
  533. package/dist/react/review.d.mts +7 -0
  534. package/dist/react/review.mjs +35 -8
  535. package/dist/react/roving.d.mts +6 -0
  536. package/dist/react/roving.mjs +123 -0
  537. package/dist/react/says-dates.d.mts +7 -0
  538. package/dist/react/says-dates.mjs +51 -0
  539. package/dist/react/series.mjs +5 -6
  540. package/dist/react/stable.mjs +1 -1
  541. package/dist/react/tabs/EditTabs.mjs +125 -0
  542. package/dist/react/tabs/NameField.mjs +72 -0
  543. package/dist/react/tabs/TabMenu.mjs +175 -0
  544. package/dist/react/tabs/actions.mjs +37 -0
  545. package/dist/react/tabs/commands.mjs +76 -0
  546. package/dist/react/tabs/focus.mjs +22 -0
  547. package/dist/react/tabs/keys.mjs +28 -0
  548. package/dist/react/theme-unlayered.css +1 -1
  549. package/dist/react/theme.css +1 -1
  550. package/dist/react/tile-store.d.mts +4 -0
  551. package/dist/react/tile-store.mjs +93 -13
  552. package/dist/react/touch.d.mts +16 -0
  553. package/dist/react/touch.mjs +39 -0
  554. package/dist/react/useBoard.d.mts +6 -0
  555. package/dist/react/useBoard.mjs +1 -0
  556. package/dist/react/useDashboard.d.mts +2 -0
  557. package/dist/react/useDashboard.mjs +5 -2
  558. package/dist/react/useTiles.d.mts +3 -0
  559. package/dist/react/useTiles.mjs +73 -17
  560. package/dist/react/view-grid.mjs +2 -2
  561. package/dist/react/view.mjs +1 -1
  562. package/dist/recharts/axes.mjs +1 -1
  563. package/dist/recharts/axis.mjs +23 -73
  564. package/dist/recharts/bar.d.mts +2 -1
  565. package/dist/recharts/bar.mjs +140 -64
  566. package/dist/recharts/fit.mjs +33 -0
  567. package/dist/recharts/line.mjs +21 -15
  568. package/dist/recharts/marks.mjs +2 -1
  569. package/dist/recharts/parts.mjs +16 -13
  570. package/dist/recharts/table.mjs +8 -3
  571. package/dist/refusal.mjs +46 -0
  572. package/dist/registry/filter-bar.json +1 -1
  573. package/dist/skills/derive-dashboards/SKILL.md +23 -8
  574. package/dist/tile-doc.mjs +1 -1
  575. package/package.json +21 -6
  576. package/dist/charts-react/plan.d.mts +0 -3
  577. package/dist/charts-react/plan.mjs +0 -37
  578. package/dist/charts-react/tiles.d.mts +0 -24
  579. package/dist/core/policy/match.d.mts +0 -16
  580. package/dist/core/schema/aliases.d.mts +0 -7
  581. package/dist/core/time/compare.d.mts +0 -30
  582. package/dist/react/EditBar.d.mts +0 -16
  583. package/dist/react/History.d.mts +0 -30
  584. package/dist/react/ReviewPanel.d.mts +0 -15
  585. package/dist/react/digits.mjs +0 -46
  586. package/dist/react/drill/trend-touch.mjs +0 -33
  587. package/dist/react/renderers/exact.d.mts +0 -6
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
1
  import { TileResult, Widget } from "derive-dashboards/core";
2
+ import { ReactNode } from "react";
3
3
  type Props = {
4
4
  widgetId: string;
5
5
  widget: Widget;
@@ -13,6 +13,8 @@ type Props = {
13
13
  badge?: ReactNode;
14
14
  /** The span most tiles cover (`spanKey`), said once for the dashboard, not on each tile. */
15
15
  sharedSpan?: string | undefined;
16
+ /** Whether the tile is as tall as what it holds: on a dashboard, read or edited. */
17
+ fit?: boolean | undefined;
16
18
  };
17
19
  /**
18
20
  * One widget: its title, then its answer, a refusal, or an empty state; and the rows behind it
@@ -1,48 +1,46 @@
1
1
  import { useDashboards } from "./context.mjs";
2
+ import { spanKey, wasRead } from "./dates-shown.mjs";
2
3
  import { useTileDrill } from "./drill/host.mjs";
4
+ import { describedBy } from "./drill/props.mjs";
3
5
  import { ExportButton } from "./export/ExportButton.mjs";
4
6
  import { formatPeriod } from "./format-time.mjs";
5
- import { SeriesSlotsContext } from "./scope.mjs";
7
+ import { useRoving } from "./roving.mjs";
8
+ import { ScopeContext, SeriesSlotsContext } from "./scope.mjs";
6
9
  import { seriesSlots } from "./series-slots.mjs";
7
- import { memo, useContext, useState } from "react";
8
- import { sharedDisplay } from "derive-dashboards/core";
10
+ import { TileState, Unrendered, rendererOf } from "./TileState.mjs";
11
+ import { NotUpdatedContext } from "./useTiles.mjs";
12
+ import { isDateRange, sharedDisplay } from "derive-dashboards/core";
13
+ import { memo, useContext, useId, useMemo, useState } from "react";
9
14
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
15
  // src/Tile.tsx
11
- /** Refusals that last only until the dashboard is read again, never shown as errors. */
12
- const PASSING = /* @__PURE__ */ new Set(["VERSION_CONFLICT", "TILE_UNKNOWN"]);
13
- /** The answer's state when there is nothing to draw yet or instead: waiting, refused, unreadable, empty. */
14
- function TileState({ result, loading, empty }) {
16
+ /**
17
+ * Notes under a tile: a viewer's filter that could not apply, or an answer cut at the row cap.
18
+ * A tile not updated (`stale`) does not say which filters did not reach it: that is of the
19
+ * picks its answer was made for, and the note above it says the answer is not for these.
20
+ */
21
+ function Notes({ result, controlLabels, stale }) {
15
22
  const { messages } = useDashboards();
16
- if (result === void 0 || "error" in result && PASSING.has(result.error.code)) {
17
- const busy = result !== void 0 || loading;
18
- return /* @__PURE__ */ jsx("div", {
19
- className: "dd-tile-state",
20
- "aria-busy": busy,
21
- children: busy ? messages.loading : ""
22
- });
23
- }
24
- if ("error" in result && result.error.code === "TILES_FAILED") return /* @__PURE__ */ jsx("div", {
25
- className: "dd-tile-state dd-tile-error",
26
- children: messages.tileUnreachable
27
- });
28
- if ("error" in result) return /* @__PURE__ */ jsx("div", {
29
- className: "dd-tile-state dd-tile-error",
30
- role: "alert",
31
- children: result.error.message
32
- });
33
- if (result.unreadable === true) return /* @__PURE__ */ jsx("div", {
34
- className: "dd-tile-state",
35
- children: messages.noAccess
36
- });
37
- return /* @__PURE__ */ jsx("div", {
38
- className: "dd-tile-state",
39
- children: empty
40
- });
23
+ if (result === void 0 || "error" in result) return null;
24
+ const dropped = stale ? [] : result.receipt.coverage.dropped.map((id) => controlLabels?.get(id) ?? id);
25
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
26
+ dropped.length === 0 ? null : /* @__PURE__ */ jsx("p", {
27
+ className: "dd-tile-note",
28
+ children: messages.notFilteredBy(dropped)
29
+ }),
30
+ result.status === "truncated" ? /* @__PURE__ */ jsx("p", {
31
+ className: "dd-tile-note",
32
+ children: messages.firstRows(result.rows.length)
33
+ }) : null,
34
+ result.drill?.reason === void 0 ? null : /* @__PURE__ */ jsx("p", {
35
+ className: "dd-tile-note",
36
+ children: messages.drillCut
37
+ })
38
+ ] });
41
39
  }
42
40
  /** Whether an answer has rows to draw. */
43
41
  const drawable = (result) => result !== void 0 && !("error" in result) && result.unreadable !== true && result.rows.length > 0;
44
42
  /** The answer drawn: a memo of its own, so a change to the tile's buttons or badge never draws the chart again. */
45
- const Body = memo(function Body({ widget, result, loading, drill }) {
43
+ const Body = memo(function Body({ widget, result, loading, drill, fit }) {
46
44
  const { renderers, locale, messages, link } = useDashboards();
47
45
  const shared = useContext(SeriesSlotsContext);
48
46
  const [own] = useState(seriesSlots);
@@ -55,54 +53,49 @@ const Body = memo(function Body({ widget, result, loading, drill }) {
55
53
  empty: empty ?? messages.noData
56
54
  });
57
55
  }
58
- const Renderer = renderers[widget.kind] ?? renderers.table;
59
- return Renderer === void 0 ? null : /* @__PURE__ */ jsx(Renderer, {
56
+ const Renderer = rendererOf(renderers, widget.kind);
57
+ return Renderer === void 0 ? /* @__PURE__ */ jsx(Unrendered, { kind: widget.kind }) : /* @__PURE__ */ jsx(Renderer, {
60
58
  answer: result,
61
59
  widget,
62
60
  messages,
63
61
  ...locale === void 0 ? {} : { locale },
64
62
  ...drill === void 0 ? {} : { drill },
65
63
  ...link === void 0 ? {} : { link },
64
+ ...fit === true ? { fit } : {},
65
+ timeZone: result.receipt.calendar.timezone,
66
66
  slots
67
67
  });
68
68
  });
69
- /** Notes under a tile: a viewer's filter that could not apply, or an answer cut at the row cap. */
70
- function Notes({ result, controlLabels }) {
71
- const { messages } = useDashboards();
72
- if (result === void 0 || "error" in result) return null;
73
- const dropped = result.receipt.coverage.dropped.map((id) => controlLabels?.get(id) ?? id);
74
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
75
- dropped.length === 0 ? null : /* @__PURE__ */ jsx("p", {
76
- className: "dd-tile-note",
77
- children: messages.notFilteredBy(dropped)
78
- }),
79
- result.status === "truncated" ? /* @__PURE__ */ jsx("p", {
80
- className: "dd-tile-note",
81
- children: messages.firstRows(result.rows.length)
82
- }) : null,
83
- result.drill?.reason === void 0 ? null : /* @__PURE__ */ jsx("p", {
84
- className: "dd-tile-note",
85
- children: messages.drillCut
86
- })
87
- ] });
69
+ /** A tile's body: its answer or its state. */
70
+ function TileBody(props) {
71
+ return /* @__PURE__ */ jsx("div", {
72
+ className: "dd-tile-body",
73
+ children: /* @__PURE__ */ jsx(Body, { ...props })
74
+ });
75
+ }
76
+ /** Whether the viewer has picked dates on this dashboard: some pick of theirs is a range of them. */
77
+ function useDatesPicked() {
78
+ const picks = useContext(ScopeContext)?.picks ?? {};
79
+ return Object.values(picks).some((pick) => isDateRange(pick));
88
80
  }
89
- /** Whether a tile has rows behind it to show: an answer the viewer can read. */
90
- const hasRows = (result) => result !== void 0 && !("error" in result) && result.unreadable !== true && result.rows.length > 0;
91
- /** The time a tile's answer covers, as a key two tiles share when they cover the same days. */
92
- const spanKey = (result) => {
93
- if (result === void 0 || "error" in result) return void 0;
94
- const range = result.receipt.range;
95
- return range === void 0 ? void 0 : `${range.from}|${range.to}`;
96
- };
97
81
  /**
98
82
  * The time a tile's answer covers, as it read it ("Oct 15 to Nov 14"), so a reader knows its
99
83
  * window. A tile covering the span most tiles do leaves it to the dashboard, which says it once.
84
+ * A tile that reads every date says "All time" wherever a reader would take it to cover other
85
+ * dates: once the viewer picks some, so a tile their pick does not move is not taken for one
86
+ * that is broken, and wherever the dashboard says dates of its own (`shared`). A tile that read
87
+ * nothing (one the viewer may not see) says nothing of dates.
100
88
  */
101
89
  function Span({ result, shared }) {
102
90
  const format = useDashboards();
103
- if (result === void 0 || "error" in result) return null;
91
+ const picked = useDatesPicked();
92
+ if (result === void 0 || !wasRead(result)) return null;
104
93
  const range = result.receipt.range;
105
- if (range === void 0 || shared !== void 0 && spanKey(result) === shared) return null;
94
+ if (range === void 0) return picked || shared !== void 0 && shared !== "every date" ? /* @__PURE__ */ jsx("p", {
95
+ className: "dd-tile-span",
96
+ children: format.messages.tileAllTime
97
+ }) : null;
98
+ if (shared !== void 0 && spanKey(result) === shared) return null;
106
99
  const zone = result.receipt.calendar.timezone;
107
100
  return /* @__PURE__ */ jsx("p", {
108
101
  className: "dd-tile-span",
@@ -110,33 +103,28 @@ function Span({ result, shared }) {
110
103
  });
111
104
  }
112
105
  /**
113
- * The span most of the tiles cover, when at least two do and they are most of them: the
114
- * dashboard says it once and those tiles leave it out. None when the tiles disagree.
115
- */
116
- function sharedSpan(results) {
117
- const counts = /* @__PURE__ */ new Map();
118
- let spans = 0;
119
- for (const result of results.values()) {
120
- const key = spanKey(result);
121
- if (key === void 0) continue;
122
- spans += 1;
123
- counts.set(key, (counts.get(key) ?? 0) + 1);
124
- }
125
- const [top] = [...counts].toSorted((a, b) => b[1] - a[1]);
126
- return top !== void 0 && top[1] >= 2 && top[1] * 2 > spans ? top[0] : void 0;
127
- }
128
- /**
129
106
  * One widget: its title, then its answer, a refusal, or an empty state; and the rows behind it
130
107
  * on request (Rows opens its drill on Items). It draws again only when one of its props changes.
131
108
  */
132
109
  const Tile = memo(function Tile(props) {
133
110
  const { messages } = useDashboards();
134
- const drill = useTileDrill(props.widgetId, props.result);
111
+ const own = useTileDrill(props.widgetId, props.result);
112
+ const stale = useContext(NotUpdatedContext).get(props.widgetId);
113
+ const notUpdated = stale !== void 0;
114
+ const noteId = useId();
115
+ const drill = useMemo(() => own === void 0 || !notUpdated ? own : describedBy(own, noteId), [
116
+ own,
117
+ notUpdated,
118
+ noteId
119
+ ]);
120
+ const roving = useRoving();
135
121
  return /* @__PURE__ */ jsxs("section", {
122
+ ...roving,
136
123
  className: "dd-tile",
137
124
  "aria-busy": props.loading,
138
125
  "data-kind": props.widget.kind,
139
126
  "data-widget": props.widgetId,
127
+ ...notUpdated ? { "data-not-updated": "" } : {},
140
128
  children: [
141
129
  /* @__PURE__ */ jsxs("header", {
142
130
  className: "dd-tile-header",
@@ -150,10 +138,13 @@ const Tile = memo(function Tile(props) {
150
138
  props.badge,
151
139
  /* @__PURE__ */ jsxs("span", {
152
140
  className: "dd-tile-actions",
141
+ "data-roving-actions": "",
153
142
  children: [
154
- hasRows(props.result) && drill !== void 0 ? /* @__PURE__ */ jsx("button", {
143
+ drawable(props.result) && drill !== void 0 ? /* @__PURE__ */ jsx("button", {
155
144
  type: "button",
156
145
  className: "dd-tile-rows",
146
+ "data-roving": "",
147
+ tabIndex: -1,
157
148
  "aria-label": messages.rowsBehind(props.widget.title),
158
149
  onClick: () => {
159
150
  drill.openAll();
@@ -173,17 +164,23 @@ const Tile = memo(function Tile(props) {
173
164
  result: props.result,
174
165
  shared: props.sharedSpan
175
166
  }),
176
- /* @__PURE__ */ jsx("div", {
177
- className: "dd-tile-body",
178
- children: /* @__PURE__ */ jsx(Body, {
179
- widget: props.widget,
180
- result: props.result,
181
- loading: props.result === void 0 && props.loading,
182
- drill
183
- })
167
+ notUpdated ? /* @__PURE__ */ jsx("p", {
168
+ id: noteId,
169
+ className: "dd-tile-note dd-not-updated",
170
+ children: stale === "signedOut" ? messages.tileNotUpdated : messages.tileNotUpdatedYet
171
+ }) : null,
172
+ /* @__PURE__ */ jsx(TileBody, {
173
+ widget: props.widget,
174
+ result: props.result,
175
+ loading: props.result === void 0 && props.loading,
176
+ drill,
177
+ fit: props.fit
184
178
  }),
185
- /* @__PURE__ */ jsx(Notes, { ...props })
179
+ /* @__PURE__ */ jsx(Notes, {
180
+ ...props,
181
+ stale: notUpdated
182
+ })
186
183
  ]
187
184
  });
188
185
  });
189
- export { Span, Tile, sharedSpan, spanKey };
186
+ export { Span, Tile };
@@ -0,0 +1,117 @@
1
+ import { useDashboards } from "./context.mjs";
2
+ import { FAILED, RETRY } from "./tile-store.mjs";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ // src/TileState.tsx
5
+ /** Refusals that last only until the dashboard is read again, never shown as errors. */
6
+ const PASSING = /* @__PURE__ */ new Set(["VERSION_CONFLICT", "TILE_UNKNOWN"]);
7
+ /** Loading, in words a person sees and a screen reader is told of. */
8
+ function Loading({ busy = true }) {
9
+ const { messages } = useDashboards();
10
+ return /* @__PURE__ */ jsx("div", {
11
+ className: "dd-tile-state",
12
+ "aria-busy": busy,
13
+ children: busy ? messages.loading : ""
14
+ });
15
+ }
16
+ /** What a tile says of a request for every tile that failed: the session ended, the server failed, or it was not reached. */
17
+ function failedWords(code, messages) {
18
+ if (code === "TILES_SIGNED_OUT") return messages.dashboardSignedOut;
19
+ return code === "TILES_SERVER" ? messages.tileServerFailed : messages.tileUnreachable;
20
+ }
21
+ /** The answer's state when there is nothing to draw yet or instead: waiting, refused, unreadable, empty. */
22
+ function TileState({ result, loading, empty }) {
23
+ const { messages } = useDashboards();
24
+ if (result === void 0 || "error" in result && PASSING.has(result.error.code)) return /* @__PURE__ */ jsx(Loading, { busy: result !== void 0 || loading });
25
+ if ("error" in result && FAILED.has(result.error.code)) return /* @__PURE__ */ jsxs("div", {
26
+ className: "dd-tile-state dd-tile-error",
27
+ children: [
28
+ failedWords(result.error.code, messages),
29
+ " ",
30
+ /* @__PURE__ */ jsx("button", {
31
+ type: "button",
32
+ className: "dd-button dd-quiet",
33
+ onClick: () => {
34
+ globalThis.dispatchEvent(new Event(RETRY));
35
+ },
36
+ children: messages.drillRetry
37
+ })
38
+ ]
39
+ });
40
+ if ("error" in result) return /* @__PURE__ */ jsx(Refused, { message: result.error.message });
41
+ if (result.unreadable === true) return /* @__PURE__ */ jsx("div", {
42
+ className: "dd-tile-state",
43
+ children: messages.noAccess
44
+ });
45
+ return /* @__PURE__ */ jsx("div", {
46
+ className: "dd-tile-state",
47
+ children: empty
48
+ });
49
+ }
50
+ /** A refusal in the server's own words. */
51
+ const Refused = ({ message }) => /* @__PURE__ */ jsx("div", {
52
+ className: "dd-tile-state dd-tile-error",
53
+ role: "alert",
54
+ children: message
55
+ });
56
+ /** The kinds a development build has warned of, so a kind is warned of once, not on every draw. */
57
+ const warned = /* @__PURE__ */ new Set();
58
+ /**
59
+ * Whether this is a development build. A bundler writes `process.env.NODE_ENV` in as text (so it
60
+ * is read as written here, not through `process`); a page with no `process` and no bundler is
61
+ * taken for one in development.
62
+ */
63
+ function developing() {
64
+ try {
65
+ return process.env.NODE_ENV !== "production";
66
+ } catch {
67
+ return true;
68
+ }
69
+ }
70
+ /**
71
+ * The renderer of a widget's kind; undefined when none draws it (a typo, or a kind of a chart
72
+ * kit that is not given to the provider). Never another kind's: a table in a line chart's
73
+ * place would be read as the answer drawn. A development build warns of it once.
74
+ */
75
+ function rendererOf(renderers, kind) {
76
+ const renderer = Object.hasOwn(renderers, kind) ? renderers[kind] : void 0;
77
+ if (renderer === void 0 && developing() && !warned.has(kind)) {
78
+ warned.add(kind);
79
+ console.warn(`derive-dashboards: no renderer draws widget kind "${kind}". Pass one in DashboardsProvider's renderers (these are given: ${Object.keys(renderers).join(", ")}).`);
80
+ }
81
+ return renderer;
82
+ }
83
+ /** A tile of a kind no renderer draws: which kind, and which kinds there are. */
84
+ function Unrendered({ kind }) {
85
+ const { messages, renderers } = useDashboards();
86
+ return /* @__PURE__ */ jsx("div", {
87
+ className: "dd-tile-state dd-tile-error",
88
+ role: "note",
89
+ children: messages.noRenderer(kind, Object.keys(renderers))
90
+ });
91
+ }
92
+ /**
93
+ * A dashboard whose document is not read yet: the word Loading, seen and announced, over a
94
+ * skeleton of tiles the theme draws. A host that has the document passes it to the provider
95
+ * (`dashboards`), and the dashboard is drawn as its layout instead, on the server too.
96
+ */
97
+ function DashboardLoading() {
98
+ const { messages } = useDashboards();
99
+ return /* @__PURE__ */ jsxs("div", {
100
+ className: "dd-dashboard dd-dashboard-loading",
101
+ "aria-busy": "true",
102
+ children: [/* @__PURE__ */ jsx("p", {
103
+ className: "dd-tile-state",
104
+ role: "status",
105
+ children: messages.loading
106
+ }), /* @__PURE__ */ jsxs("div", {
107
+ className: "dd-skeleton",
108
+ "aria-hidden": "true",
109
+ children: [
110
+ /* @__PURE__ */ jsx("span", {}),
111
+ /* @__PURE__ */ jsx("span", {}),
112
+ /* @__PURE__ */ jsx("span", {})
113
+ ]
114
+ })]
115
+ });
116
+ }
117
+ export { DashboardLoading, Loading, Refused, TileState, Unrendered, rendererOf };
@@ -0,0 +1,45 @@
1
+ // src/ago.ts
2
+ const MINUTE = 6e4;
3
+ /** The units a time away is counted in, each up to where the next takes over; from a week, none. */
4
+ const UNITS = [
5
+ {
6
+ unit: "minute",
7
+ size: MINUTE,
8
+ under: 60
9
+ },
10
+ {
11
+ unit: "hour",
12
+ size: 60 * MINUTE,
13
+ under: 24
14
+ },
15
+ {
16
+ unit: "day",
17
+ size: 1440 * MINUTE,
18
+ under: 7
19
+ }
20
+ ];
21
+ /** A relative time format for each locale and way of counting, made once. */
22
+ const FORMATS = /* @__PURE__ */ new Map();
23
+ function formatIn(locale, numeric) {
24
+ const key = `${locale ?? ""}|${numeric}`;
25
+ const made = FORMATS.get(key) ?? new Intl.RelativeTimeFormat(locale, {
26
+ numeric,
27
+ style: "short"
28
+ });
29
+ FORMATS.set(key, made);
30
+ return made;
31
+ }
32
+ /**
33
+ * How long before now an instant was, or how long after, in words: "now" inside a minute, then
34
+ * whole minutes, hours and days, each rounded down so nothing is said to be older than it is.
35
+ * Undefined from a week away: by then a date says more. Both are milliseconds.
36
+ */
37
+ function agoText(at, now, locale) {
38
+ const away = Math.abs(at - now);
39
+ if (away < MINUTE) return formatIn(locale, "auto").format(0, "second");
40
+ const step = UNITS.find(({ size, under }) => away < size * under);
41
+ if (step === void 0) return void 0;
42
+ const count = Math.sign(at - now) * Math.floor(away / step.size);
43
+ return formatIn(locale, "always").format(count, step.unit);
44
+ }
45
+ export { agoText };
@@ -23,23 +23,107 @@ function pixels(length, fallback) {
23
23
  const n = Number(length.replace(/px$/u, ""));
24
24
  return length !== "" && Number.isFinite(n) ? n : fallback;
25
25
  }
26
- /** One grid cell's size plus the gap after it, read from the grid as drawn. */
27
- function stepOf(grid) {
26
+ /** A row's height where the page is not laid out, as a test's is not. */
27
+ const ROW = 72;
28
+ /** The rows between two that were seen, spaced evenly: no tile starts or ends on them. */
29
+ function between(from, to) {
30
+ const rows = to.row - from.row;
31
+ return Array.from({ length: rows }, (_, i) => from.at + (to.at - from.at) * i / rows);
32
+ }
33
+ /**
34
+ * Where each row starts, from where tiles were seen to start and end: `[0]` alone when nothing
35
+ * was seen below the top, as on a page that is not laid out.
36
+ */
37
+ function rowStarts(seen) {
38
+ const known = /* @__PURE__ */ new Map([[0, 0]]);
39
+ for (const { row, at } of seen) if (!known.has(row)) known.set(row, at);
40
+ const sorted = [...known].map(([row, at]) => ({
41
+ row,
42
+ at
43
+ })).toSorted((a, b) => a.row - b.row);
44
+ const last = sorted.at(-1);
45
+ if (last === void 0 || last.at <= 0) return [0];
46
+ return [...sorted.slice(1).flatMap((to, i) => between(sorted[i] ?? to, to)), last.at];
47
+ }
48
+ /** Where every tile drawn starts and ends on the grid: its rows by its place, its edges as drawn. */
49
+ function seenIn(grid, layout, gap) {
50
+ const top = grid.getBoundingClientRect().top;
51
+ const places = new Map(layout.map((item) => [item.widget, item]));
52
+ return [...grid.querySelectorAll(".dd-cell[data-widget]")].flatMap((cell) => {
53
+ const item = places.get(cell.dataset["widget"] ?? "");
54
+ if (item === void 0) return [];
55
+ const box = cell.getBoundingClientRect();
56
+ return [{
57
+ row: item.y,
58
+ at: box.top - top
59
+ }, {
60
+ row: item.y + item.h,
61
+ at: box.bottom - top + gap
62
+ }];
63
+ });
64
+ }
65
+ /** A row of the dragged tile's own, with the gap after it: what one more row past the last is. */
66
+ function ownRow(cell, rows, gap) {
67
+ const height = cell?.getBoundingClientRect().height ?? 0;
68
+ return height > 0 ? (height + gap) / rows : ROW + gap;
69
+ }
70
+ /** The grid's steps as it is drawn, for a drag of `cell` that starts now. */
71
+ function stepsOf(grid, layout, tile) {
28
72
  if (grid === null) return {
29
73
  x: 1,
30
- y: 1
74
+ starts: [0],
75
+ y: 1,
76
+ gap: 0
31
77
  };
32
78
  const style = getComputedStyle(grid);
33
79
  const columnGap = pixels(style.columnGap, 0);
34
80
  const rowGap = pixels(style.rowGap, 0);
35
- const column = (grid.clientWidth - columnGap * 11) / 12;
36
- const row = pixels(style.gridAutoRows, 72);
37
81
  return {
38
- x: column + columnGap,
39
- y: row + rowGap
82
+ x: (grid.clientWidth - columnGap * (GRID_COLUMNS - 1)) / GRID_COLUMNS + columnGap,
83
+ starts: rowStarts(seenIn(grid, layout, rowGap)),
84
+ y: ownRow(tile.cell, tile.rows, rowGap),
85
+ gap: rowGap
86
+ };
87
+ }
88
+ /** A length as a track is written, to a hundredth of a pixel. */
89
+ const track = (length) => `${String(Math.round(length * 100) / 100)}px`;
90
+ /**
91
+ * The grid's rows as a drag holds them: each row drawn at the height it has, and any row past
92
+ * the last a row of the dragged tile's own.
93
+ */
94
+ function heldRows(step) {
95
+ return {
96
+ rows: step.starts.slice(1).map((start, i) => start - (step.starts[i] ?? 0) - step.gap).map((height) => track(height)).join(" "),
97
+ more: track(step.y - step.gap)
40
98
  };
41
99
  }
42
100
  /**
101
+ * Holds the grid's rows at the heights they are drawn at while a drag lasts, or lets them go
102
+ * (`undefined`). Rows are as tall as their tiles, so tiles making room for the dragged one
103
+ * would otherwise move every row under the pointer, and the place it lands with them.
104
+ */
105
+ function hold(grid, step) {
106
+ if (grid === null) return;
107
+ const held = step === void 0 ? void 0 : heldRows(step);
108
+ grid.style.gridTemplateRows = held?.rows ?? "";
109
+ grid.style.gridAutoRows = held?.more ?? "";
110
+ grid.toggleAttribute("data-arranging", held !== void 0);
111
+ }
112
+ /** Where a row starts: as drawn, and past the last drawn by even steps. */
113
+ function startOf(step, row) {
114
+ const last = step.starts.length - 1;
115
+ return row <= last ? step.starts[row] ?? 0 : (step.starts[last] ?? 0) + (row - last) * step.y;
116
+ }
117
+ /** The row whose start is nearest a place down the grid. */
118
+ function rowAt(step, at) {
119
+ const last = step.starts.length - 1;
120
+ const end = step.starts[last] ?? 0;
121
+ if (at >= end) return last + Math.round((at - end) / step.y);
122
+ let nearest = 0;
123
+ for (const [row, start] of step.starts.entries()) if (Math.abs(start - at) < Math.abs((step.starts[nearest] ?? 0) - at)) nearest = row;
124
+ return nearest;
125
+ }
126
+ /**
43
127
  * The item moved or resized by whole cells: a move keeps the size; a resize keeps the top left,
44
128
  * stops at the grid's edge, and never makes a tile smaller than its kind reads at (core's
45
129
  * `smallestFor`; one already smaller stays as it is).
@@ -57,13 +141,17 @@ function shifted(item, how, by) {
57
141
  h: Math.max(Math.min(least.h, item.h), item.h + dy)
58
142
  };
59
143
  }
60
- /** Where a drag puts the item: whole cells from where the pointer went down. */
144
+ /**
145
+ * Where a drag puts the item: whole columns from where the pointer went down, and the row whose
146
+ * start the dragged edge is nearest (a move's top, a resize's bottom).
147
+ */
61
148
  function dragged(d, event) {
62
149
  const dx = Math.round((event.clientX - d.x0) / d.step.x);
63
- const dy = Math.round((event.clientY - d.y0) / d.step.y);
150
+ const edge = d.mode === "move" ? d.start.y : d.start.y + d.start.h;
151
+ const row = rowAt(d.step, startOf(d.step, edge) + event.clientY - d.y0);
64
152
  return shifted(d.start, d, {
65
153
  dx,
66
- dy
154
+ dy: row - edge
67
155
  });
68
156
  }
69
157
  /**
@@ -108,4 +196,4 @@ async function commit(edit, tab, wanted, show) {
108
196
  }]);
109
197
  show();
110
198
  }
111
- export { KEYS, commit, dragged, follow, nextStep, same, stepOf };
199
+ export { KEYS, commit, dragged, follow, heldRows, hold, nextStep, rowStarts, same, stepsOf };
@@ -1,8 +1,8 @@
1
- import { KEYS, commit, dragged, follow, nextStep, same, stepOf } from "./arrange-steps.mjs";
1
+ import { KEYS, commit, dragged, follow, hold, nextStep, same, stepsOf } from "./arrange-steps.mjs";
2
2
  import { useDashboards } from "./context.mjs";
3
3
  import { useStable } from "./stable.mjs";
4
- import { useMemo, useRef, useState } from "react";
5
4
  import { placeItem, smallestFor } from "derive-dashboards/core";
5
+ import { useMemo, useRef, useState } from "react";
6
6
  // src/arrange.ts
7
7
  /**
8
8
  * A preview that only changes when its place does: a pointer moving inside one grid cell
@@ -54,14 +54,19 @@ function handlers(a, drag, show) {
54
54
  drag.current = void 0;
55
55
  if (d === void 0) return;
56
56
  follow(d);
57
+ hold(a.grid());
57
58
  send(dragged(d, at ?? d.last));
58
59
  };
59
60
  return (item, mode) => ({
60
61
  onPointerDown: (event) => {
61
62
  if (a.edit().busy || event.button !== 0) return;
62
63
  event.currentTarget.setPointerCapture(event.pointerId);
63
- const step = stepOf(a.grid());
64
64
  const cell = event.currentTarget.closest(".dd-cell");
65
+ const step = stepsOf(a.grid(), a.tab().layout, {
66
+ cell,
67
+ rows: item.h
68
+ });
69
+ hold(a.grid(), step);
65
70
  const { clientX: x0, clientY: y0 } = event;
66
71
  drag.current = {
67
72
  mode,
@@ -97,6 +102,7 @@ function handlers(a, drag, show) {
97
102
  onPointerCancel: () => {
98
103
  if (drag.current !== void 0) follow(drag.current);
99
104
  drag.current = void 0;
105
+ hold(a.grid());
100
106
  show();
101
107
  },
102
108
  onKeyDown: onKey(a, send, item, mode)
@@ -105,7 +111,8 @@ function handlers(a, drag, show) {
105
111
  /**
106
112
  * Moving and resizing tiles on one tab of a draft. While a tile is dragged it follows the
107
113
  * pointer, an outline shows where it will land, snapped to the grid, and the tiles `placeItem`
108
- * must move for it make room; nothing else moves. Letting go sends one `widget.move`. The arrow
114
+ * must move for it make room; nothing else moves, and the rows keep the heights they had when
115
+ * the drag began. Letting go sends one `widget.move`. The arrow
109
116
  * keys on a tile's handle move it a cell at a time, and with Shift resize it. The preview holds
110
117
  * until the draft has the move, so nothing jumps back. `handle` keeps one identity, so tiles
111
118
  * that did not move are not drawn again.
@@ -1,8 +1,8 @@
1
1
  import { useDashboards } from "./context.mjs";
2
2
  import { marksOf, versionMarks } from "./marks.mjs";
3
+ import { diffDocs } from "derive-dashboards/core";
3
4
  import { useEffect, useRef, useState } from "react";
4
5
  import useSWR from "swr";
5
- import { diffDocs } from "derive-dashboards/core";
6
6
  // src/board.ts
7
7
  /** The side panel, the version previewed from history, and the tile a review row points at. */
8
8
  function usePanels(dashboardId, edit, review) {
@@ -62,7 +62,7 @@ function useReviewFollowsDraft(open, edit, review, close) {
62
62
  useEffect(() => {
63
63
  if (!open) return;
64
64
  if (revision === void 0) latest.current.close();
65
- else latest.current.review.open();
65
+ else latest.current.review.follow();
66
66
  }, [open, revision]);
67
67
  }
68
68
  const tabIn = (doc, tabId) => doc.tabs.find((t) => t.id === tabId) ?? doc.tabs[0];
@@ -0,0 +1,8 @@
1
+ import { Messages } from "./messages.mjs";
2
+ import { ResultCell, ResultColumn, TileAnswer } from "derive-dashboards/core";
3
+ type Bucket = {
4
+ partial?: "start" | "end" | "both" | undefined;
5
+ } | undefined;
6
+ /** A bucket's name with "so far" after it while it is still running. */
7
+ export declare const bucketName: (name: string, bucket: Bucket, messages: Pick<Messages, "soFar">) => string;
8
+ export {};