derive-dashboards 0.1.0 → 0.2.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 (410) hide show
  1. package/README.md +8 -5
  2. package/dist/adapter/sql-adapter.mjs +4 -4
  3. package/dist/body.mjs +11 -1
  4. package/dist/cache.d.mts +1 -1
  5. package/dist/cli/add.mjs +130 -0
  6. package/dist/cli/check.mjs +14 -1
  7. package/dist/cli/cli.mjs +14 -12
  8. package/dist/cli/config.mjs +12 -1
  9. package/dist/cli/doctor.mjs +147 -0
  10. package/dist/cli/import/dbt-schema.mjs +2 -2
  11. package/dist/cli/import/index.mjs +2 -2
  12. package/dist/cli/init.mjs +3 -2
  13. package/dist/cli/json.mjs +21 -0
  14. package/dist/cli/layers.mjs +33 -0
  15. package/dist/core/conformance/cases.d.mts +3 -0
  16. package/dist/core/conformance/cases.mjs +20 -4
  17. package/dist/core/conformance/check.mjs +6 -3
  18. package/dist/core/conformance/drill-cases.mjs +120 -0
  19. package/dist/core/document/layout.mjs +1 -1
  20. package/dist/core/document/view-layout.d.mts +14 -0
  21. package/dist/core/document/view-layout.mjs +157 -0
  22. package/dist/core/document/view.d.mts +26 -7
  23. package/dist/core/document/view.mjs +42 -11
  24. package/dist/core/engine/filter.mjs +2 -2
  25. package/dist/core/engine/index.d.mts +14 -2
  26. package/dist/core/engine/index.mjs +12 -1
  27. package/dist/core/engine/leaf.mjs +9 -4
  28. package/dist/core/engine/members.mjs +2 -2
  29. package/dist/core/engine/postgres.mjs +1 -1
  30. package/dist/core/engine/record-layout.d.mts +11 -0
  31. package/dist/core/engine/record-layout.mjs +7 -7
  32. package/dist/core/engine/records.d.mts +3 -2
  33. package/dist/core/engine/records.mjs +2 -1
  34. package/dist/core/engine/segmented.mjs +5 -2
  35. package/dist/core/engine/sql-records.mjs +2 -1
  36. package/dist/core/engine/statement.mjs +37 -3
  37. package/dist/core/engine/types.d.mts +3 -0
  38. package/dist/core/engine/version.d.mts +1 -1
  39. package/dist/core/engine/version.mjs +1 -1
  40. package/dist/core/error/codes.d.mts +33 -1
  41. package/dist/core/error/codes.mjs +30 -2
  42. package/dist/core/index.d.mts +13 -7
  43. package/dist/core/index.mjs +9 -5
  44. package/dist/core/model/catalog/check.mjs +1 -1
  45. package/dist/core/model/hints.d.mts +36 -0
  46. package/dist/core/model/member.d.mts +4 -2
  47. package/dist/core/model/member.mjs +19 -3
  48. package/dist/core/model/types.d.mts +21 -19
  49. package/dist/core/model/validate/drill.mjs +70 -0
  50. package/dist/core/model/validate/index.mjs +3 -0
  51. package/dist/core/model/validate/members.mjs +7 -4
  52. package/dist/core/model/validate/shape.mjs +150 -0
  53. package/dist/core/model/validate/source.mjs +5 -3
  54. package/dist/core/policy/bind-query.d.mts +12 -0
  55. package/dist/core/policy/bind-query.mjs +53 -0
  56. package/dist/core/query/alias.mjs +7 -1
  57. package/dist/core/query/drill/compose.d.mts +22 -0
  58. package/dist/core/query/drill/compose.mjs +85 -0
  59. package/dist/core/query/drill/fields.d.mts +21 -0
  60. package/dist/core/query/drill/fields.mjs +91 -0
  61. package/dist/core/query/drill/internal.d.mts +11 -0
  62. package/dist/core/query/drill/items.d.mts +29 -0
  63. package/dist/core/query/drill/items.mjs +98 -0
  64. package/dist/core/query/drill/line.d.mts +31 -0
  65. package/dist/core/query/drill/line.mjs +183 -0
  66. package/dist/core/query/drill/links.d.mts +33 -0
  67. package/dist/core/query/drill/links.mjs +31 -0
  68. package/dist/core/query/drill/operand.mjs +7 -0
  69. package/dist/core/query/drill/scopes.d.mts +22 -0
  70. package/dist/core/query/drill/scopes.mjs +58 -0
  71. package/dist/core/query/drill/selection.d.mts +37 -0
  72. package/dist/core/query/drill/selection.mjs +144 -0
  73. package/dist/core/query/drill/steps.d.mts +14 -0
  74. package/dist/core/query/drill/steps.mjs +35 -0
  75. package/dist/core/query/drill/synthetic-expr.mjs +85 -0
  76. package/dist/core/query/drill/synthetic.d.mts +22 -0
  77. package/dist/core/query/drill/synthetic.mjs +165 -0
  78. package/dist/core/query/drill/time.d.mts +11 -0
  79. package/dist/core/query/drill/time.mjs +71 -0
  80. package/dist/core/query/drill/types.d.mts +155 -0
  81. package/dist/core/query/drill/types.mjs +4 -0
  82. package/dist/core/query/drill/views.d.mts +62 -0
  83. package/dist/core/query/drill/views.mjs +257 -0
  84. package/dist/core/query/filter.d.mts +6 -0
  85. package/dist/core/query/picks.d.mts +8 -2
  86. package/dist/core/query/picks.mjs +11 -4
  87. package/dist/core/query/segments.d.mts +12 -2
  88. package/dist/core/query/segments.mjs +5 -2
  89. package/dist/core/result/columns.mjs +20 -4
  90. package/dist/core/result/types.d.mts +5 -1
  91. package/dist/core/schema/aliases.d.mts +7 -0
  92. package/dist/core/schema/aliases.mjs +77 -0
  93. package/dist/core/schema/answer-parts.mjs +117 -0
  94. package/dist/core/schema/answers.d.mts +2109 -128
  95. package/dist/core/schema/answers.mjs +11 -113
  96. package/dist/core/schema/commands.d.mts +2 -2
  97. package/dist/core/schema/document.d.mts +1 -1
  98. package/dist/core/schema/drill-answers.mjs +179 -0
  99. package/dist/core/schema/drill.d.mts +260 -0
  100. package/dist/core/schema/drill.mjs +107 -0
  101. package/dist/core/schema/index.d.mts +6 -3
  102. package/dist/core/schema/index.mjs +6 -3
  103. package/dist/core/schema/picks.d.mts +35 -0
  104. package/dist/core/schema/picks.mjs +23 -0
  105. package/dist/core/schema/query.d.mts +82 -1
  106. package/dist/core/schema/query.mjs +9 -5
  107. package/dist/core/schema/tools.mjs +1 -1
  108. package/dist/core/schema/view.d.mts +0 -35
  109. package/dist/core/schema/view.mjs +19 -24
  110. package/dist/core/store/schema.d.mts +5 -0
  111. package/dist/core/store/schema.mjs +10 -0
  112. package/dist/core/types/api.d.mts +21 -1
  113. package/dist/core/types/api.mjs +1 -1
  114. package/dist/core/types/drill-api.d.mts +210 -0
  115. package/dist/core/types/options.d.mts +21 -0
  116. package/dist/core/types/viewer.d.mts +5 -0
  117. package/dist/cursor-seal.d.mts +8 -0
  118. package/dist/cursor-seal.mjs +98 -0
  119. package/dist/dashboard-id.mjs +1 -1
  120. package/dist/dashboards.mjs +4 -0
  121. package/dist/drill-access.mjs +93 -0
  122. package/dist/drill-change.mjs +76 -0
  123. package/dist/drill-crumbs.mjs +113 -0
  124. package/dist/drill-distinct.mjs +130 -0
  125. package/dist/drill-explain.mjs +64 -0
  126. package/dist/drill-identity.mjs +35 -0
  127. package/dist/drill-item-id.mjs +35 -0
  128. package/dist/drill-items.mjs +132 -0
  129. package/dist/drill-open.mjs +169 -0
  130. package/dist/drill-seal.mjs +170 -0
  131. package/dist/drill-secret.mjs +14 -0
  132. package/dist/drill-share.mjs +53 -0
  133. package/dist/drill-summary.mjs +158 -0
  134. package/dist/drill-targets.mjs +53 -0
  135. package/dist/drill-totals.mjs +8 -0
  136. package/dist/drill-views.mjs +175 -0
  137. package/dist/drill.mjs +157 -0
  138. package/dist/editing.mjs +3 -3
  139. package/dist/endpoints/dashboards.mjs +28 -5
  140. package/dist/endpoints/drill.mjs +55 -0
  141. package/dist/endpoints/index.d.mts +245 -4
  142. package/dist/endpoints/index.mjs +5 -1
  143. package/dist/endpoints/meta.mjs +10 -1
  144. package/dist/endpoints/query.mjs +26 -4
  145. package/dist/execute.d.mts +19 -1
  146. package/dist/execute.mjs +34 -27
  147. package/dist/handler.mjs +5 -1
  148. package/dist/index.d.mts +3 -1
  149. package/dist/index.mjs +29 -2
  150. package/dist/llms.txt +22 -0
  151. package/dist/mcp/drill.mjs +61 -0
  152. package/dist/mcp/format.mjs +69 -11
  153. package/dist/mcp/index.d.mts +15 -4
  154. package/dist/mcp/index.mjs +13 -7
  155. package/dist/mcp/query.d.mts +7 -2
  156. package/dist/mcp/query.mjs +40 -6
  157. package/dist/node-postgres.d.mts +8 -4
  158. package/dist/node-postgres.mjs +29 -6
  159. package/dist/owner.mjs +3 -3
  160. package/dist/postgres-connection.d.mts +8 -2
  161. package/dist/postgres-connection.mjs +2 -1
  162. package/dist/postgres-store.mjs +1 -0
  163. package/dist/react/Canvas.mjs +28 -5
  164. package/dist/react/Cell.mjs +2 -1
  165. package/dist/react/Dashboard.d.mts +10 -5
  166. package/dist/react/Dashboard.mjs +62 -22
  167. package/dist/react/DashboardList.mjs +52 -24
  168. package/dist/react/DashboardListRow.mjs +49 -0
  169. package/dist/react/Discard.mjs +12 -4
  170. package/dist/react/Editing.mjs +19 -5
  171. package/dist/react/FilterBar.d.mts +7 -9
  172. package/dist/react/Grid.mjs +19 -24
  173. package/dist/react/Header.mjs +10 -1
  174. package/dist/react/History.mjs +5 -0
  175. package/dist/react/Parts.mjs +6 -2
  176. package/dist/react/ReadFailed.mjs +23 -0
  177. package/dist/react/ReviewPanel.mjs +13 -2
  178. package/dist/react/RowBody.d.mts +19 -0
  179. package/dist/react/RowBody.mjs +55 -0
  180. package/dist/react/Spaces.mjs +15 -1
  181. package/dist/react/Tile.d.mts +3 -1
  182. package/dist/react/Tile.mjs +84 -32
  183. package/dist/react/_virtual/_rolldown/runtime.mjs +12 -0
  184. package/dist/react/arrange-steps.mjs +16 -13
  185. package/dist/react/arrange.mjs +10 -3
  186. package/dist/react/builder/Calcs.mjs +35 -11
  187. package/dist/react/builder/FilterEditor.mjs +196 -0
  188. package/dist/react/builder/Filters.mjs +172 -116
  189. package/dist/react/builder/Formula.mjs +82 -0
  190. package/dist/react/builder/Groups.mjs +1 -0
  191. package/dist/react/builder/Preview.mjs +1 -1
  192. package/dist/react/builder/RangeEditor.mjs +184 -0
  193. package/dist/react/builder/Sections.mjs +41 -6
  194. package/dist/react/builder/Time.mjs +138 -60
  195. package/dist/react/builder/Values.mjs +85 -0
  196. package/dist/react/builder/WidgetBuilder.mjs +50 -49
  197. package/dist/react/builder/base.d.mts +5 -0
  198. package/dist/react/builder/base.mjs +33 -8
  199. package/dist/react/builder/calc.mjs +15 -1
  200. package/dist/react/builder/escape.d.mts +1 -0
  201. package/dist/react/builder/escape.mjs +62 -0
  202. package/dist/react/builder/filter-tree.d.mts +9 -0
  203. package/dist/react/builder/filter-tree.mjs +186 -0
  204. package/dist/react/builder/formula-parse.d.mts +18 -0
  205. package/dist/react/builder/formula-parse.mjs +136 -0
  206. package/dist/react/builder/labels.d.mts +1 -1
  207. package/dist/react/builder/state.d.mts +2 -1
  208. package/dist/react/builder/state.mjs +23 -37
  209. package/dist/react/builder/useBuilder.d.mts +12 -1
  210. package/dist/react/builder/useBuilder.mjs +6 -3
  211. package/dist/react/builder/words.d.mts +59 -0
  212. package/dist/react/builder/words.mjs +73 -0
  213. package/dist/react/client.d.mts +2 -0
  214. package/dist/react/client.mjs +1 -0
  215. package/dist/react/context.d.mts +28 -1
  216. package/dist/react/context.mjs +25 -4
  217. package/dist/react/drill/Bars.mjs +179 -0
  218. package/dist/react/drill/Controls.mjs +173 -0
  219. package/dist/react/drill/DashboardTile.d.mts +18 -0
  220. package/dist/react/drill/DashboardTile.mjs +107 -0
  221. package/dist/react/drill/DrillPanel.d.mts +31 -0
  222. package/dist/react/drill/DrillPanel.mjs +104 -0
  223. package/dist/react/drill/DrillTabs.mjs +52 -0
  224. package/dist/react/drill/Header.mjs +131 -0
  225. package/dist/react/drill/Items.d.mts +22 -0
  226. package/dist/react/drill/Items.mjs +164 -0
  227. package/dist/react/drill/ItemsFoot.mjs +60 -0
  228. package/dist/react/drill/Notes.mjs +58 -0
  229. package/dist/react/drill/PanelBody.mjs +74 -0
  230. package/dist/react/drill/PanelStates.mjs +37 -0
  231. package/dist/react/drill/board.d.mts +18 -0
  232. package/dist/react/drill/board.mjs +91 -0
  233. package/dist/react/drill/counts.mjs +14 -0
  234. package/dist/react/drill/host.mjs +26 -0
  235. package/dist/react/drill/item-parts.d.mts +5 -0
  236. package/dist/react/drill/item-parts.mjs +76 -0
  237. package/dist/react/drill/item-type.d.mts +26 -0
  238. package/dist/react/drill/item-type.mjs +7 -0
  239. package/dist/react/drill/lazy.d.mts +6 -0
  240. package/dist/react/drill/lazy.mjs +17 -0
  241. package/dist/react/drill/pages.mjs +48 -0
  242. package/dist/react/drill/panel-focus.mjs +51 -0
  243. package/dist/react/drill/props.d.mts +25 -0
  244. package/dist/react/drill/props.mjs +72 -0
  245. package/dist/react/drill/state.d.mts +18 -0
  246. package/dist/react/drill/state.mjs +68 -0
  247. package/dist/react/drill/useDrill.d.mts +46 -0
  248. package/dist/react/drill/useDrill.mjs +194 -0
  249. package/dist/react/drill/words.d.mts +101 -0
  250. package/dist/react/drill/words.mjs +79 -0
  251. package/dist/react/english.mjs +29 -6
  252. package/dist/react/filters/bar.d.mts +12 -0
  253. package/dist/react/filters/bar.mjs +135 -0
  254. package/dist/react/filters/calendar.mjs +193 -0
  255. package/dist/react/filters/chip.mjs +174 -0
  256. package/dist/react/filters/context.d.mts +22 -0
  257. package/dist/react/filters/context.mjs +78 -0
  258. package/dist/react/filters/dates.mjs +89 -0
  259. package/dist/react/filters/days.d.mts +36 -0
  260. package/dist/react/filters/days.mjs +87 -0
  261. package/dist/react/filters/field-step.mjs +81 -0
  262. package/dist/react/filters/hooks.d.mts +34 -0
  263. package/dist/react/filters/hooks.mjs +94 -0
  264. package/dist/react/filters/listbox.mjs +131 -0
  265. package/dist/react/filters/logic.d.mts +59 -0
  266. package/dist/react/filters/logic.mjs +109 -0
  267. package/dist/react/filters/menu-search.mjs +211 -0
  268. package/dist/react/filters/menu.mjs +85 -0
  269. package/dist/react/filters/number.mjs +127 -0
  270. package/dist/react/filters/numbers.d.mts +47 -0
  271. package/dist/react/filters/numbers.mjs +151 -0
  272. package/dist/react/filters/operator.mjs +104 -0
  273. package/dist/react/filters/phone.mjs +104 -0
  274. package/dist/react/filters/popover.d.mts +19 -0
  275. package/dist/react/filters/popover.mjs +153 -0
  276. package/dist/react/filters/rules.d.mts +8 -0
  277. package/dist/react/filters/rules.mjs +55 -0
  278. package/dist/react/filters/sheet.mjs +196 -0
  279. package/dist/react/filters/state.mjs +132 -0
  280. package/dist/react/filters/suggest.d.mts +47 -0
  281. package/dist/react/filters/suggest.mjs +97 -0
  282. package/dist/react/filters/values.mjs +166 -0
  283. package/dist/react/filters/words.d.mts +81 -0
  284. package/dist/react/filters/words.mjs +73 -0
  285. package/dist/react/format.d.mts +3 -3
  286. package/dist/react/format.mjs +45 -16
  287. package/dist/react/index.d.mts +34 -5
  288. package/dist/react/index.mjs +15 -4
  289. package/dist/react/messages.d.mts +47 -2
  290. package/dist/react/place.mjs +7 -3
  291. package/dist/react/renderers/index.d.mts +10 -2
  292. package/dist/react/renderers/index.mjs +116 -14
  293. package/dist/react/renderers/list.d.mts +22 -0
  294. package/dist/react/renderers/list.mjs +118 -0
  295. package/dist/react/review-words.mjs +1 -1
  296. package/dist/react/review.mjs +2 -2
  297. package/dist/react/scope.mjs +2 -7
  298. package/dist/react/series.d.mts +54 -0
  299. package/dist/react/series.mjs +191 -0
  300. package/dist/react/theme.css +2734 -1296
  301. package/dist/react/theme.css.d.ts +1 -0
  302. package/dist/react/tile-store.mjs +15 -3
  303. package/dist/react/useBoard.d.mts +7 -0
  304. package/dist/react/useBoard.mjs +4 -1
  305. package/dist/react/useDashboard.d.mts +4 -0
  306. package/dist/react/useDashboard.mjs +8 -1
  307. package/dist/react/useTiles.mjs +50 -15
  308. package/dist/react/view-grid.mjs +16 -0
  309. package/dist/react/view.d.mts +9 -0
  310. package/dist/react/view.mjs +22 -10
  311. package/dist/reading.d.mts +2 -0
  312. package/dist/reading.mjs +9 -1
  313. package/dist/recharts/axes.mjs +28 -0
  314. package/dist/recharts/axis.mjs +84 -0
  315. package/dist/recharts/bar.d.mts +7 -0
  316. package/dist/recharts/bar.mjs +140 -0
  317. package/dist/recharts/charts.d.mts +4 -6
  318. package/dist/recharts/charts.mjs +2 -114
  319. package/dist/recharts/index.d.mts +5 -3
  320. package/dist/recharts/index.mjs +6 -3
  321. package/dist/recharts/line.d.mts +2 -0
  322. package/dist/recharts/line.mjs +111 -0
  323. package/dist/recharts/marks.mjs +112 -0
  324. package/dist/recharts/parts.mjs +88 -0
  325. package/dist/recharts/series.d.mts +2 -22
  326. package/dist/recharts/series.mjs +1 -64
  327. package/dist/recharts/table.mjs +71 -0
  328. package/dist/records-read.mjs +44 -0
  329. package/dist/registry/filter-bar.json +26 -0
  330. package/dist/skills/derive-dashboards/SKILL.md +69 -0
  331. package/dist/store/apply.mjs +5 -5
  332. package/dist/store/commands.mjs +4 -4
  333. package/dist/store/discard.mjs +7 -7
  334. package/dist/store/drafts.mjs +5 -5
  335. package/dist/store/editor.mjs +1 -1
  336. package/dist/store/publish.mjs +12 -12
  337. package/dist/store/reader.mjs +41 -22
  338. package/dist/store/review.mjs +16 -16
  339. package/dist/store/rows.mjs +20 -20
  340. package/dist/store/undo.mjs +3 -3
  341. package/dist/store/unpublished.mjs +4 -4
  342. package/dist/store/versions.mjs +14 -14
  343. package/dist/testing/adapter-suite.mjs +4 -4
  344. package/dist/tiles.mjs +37 -3
  345. package/package.json +12 -10
  346. package/dist/react/FilterBar.mjs +0 -119
  347. package/dist/react/Records.d.mts +0 -12
  348. package/dist/react/Records.mjs +0 -97
  349. package/src/adapter/sql-adapter.ts +0 -95
  350. package/src/adapter/statement.ts +0 -185
  351. package/src/authorize.ts +0 -73
  352. package/src/body.ts +0 -169
  353. package/src/bounded.ts +0 -43
  354. package/src/cache.ts +0 -192
  355. package/src/checks.ts +0 -170
  356. package/src/custom-source.ts +0 -59
  357. package/src/dashboard-id.ts +0 -36
  358. package/src/dashboards.ts +0 -132
  359. package/src/editing.ts +0 -148
  360. package/src/endpoints/access.ts +0 -41
  361. package/src/endpoints/dashboards.ts +0 -92
  362. package/src/endpoints/drafts.ts +0 -138
  363. package/src/endpoints/index.ts +0 -21
  364. package/src/endpoints/meta.ts +0 -137
  365. package/src/endpoints/query.ts +0 -86
  366. package/src/endpoints/read.ts +0 -92
  367. package/src/endpoints/review.ts +0 -89
  368. package/src/endpoints/values.ts +0 -62
  369. package/src/endpoints/versions.ts +0 -104
  370. package/src/execute.ts +0 -207
  371. package/src/handler.ts +0 -232
  372. package/src/http.ts +0 -66
  373. package/src/index.ts +0 -163
  374. package/src/introspect.ts +0 -205
  375. package/src/mcp/api.ts +0 -59
  376. package/src/mcp/format.ts +0 -67
  377. package/src/mcp/index.ts +0 -151
  378. package/src/mcp/query.ts +0 -153
  379. package/src/mcp/resolve.ts +0 -114
  380. package/src/node-postgres.ts +0 -81
  381. package/src/owner.ts +0 -36
  382. package/src/postgres-connection.ts +0 -143
  383. package/src/postgres-store.ts +0 -82
  384. package/src/principal.ts +0 -39
  385. package/src/reading.ts +0 -56
  386. package/src/request-rows.ts +0 -23
  387. package/src/request.ts +0 -22
  388. package/src/storage.ts +0 -63
  389. package/src/store/apply.ts +0 -129
  390. package/src/store/commands.ts +0 -75
  391. package/src/store/conflicts.ts +0 -98
  392. package/src/store/create-tables.ts +0 -104
  393. package/src/store/discard.ts +0 -42
  394. package/src/store/drafts.ts +0 -133
  395. package/src/store/editor.ts +0 -28
  396. package/src/store/log.ts +0 -28
  397. package/src/store/publish.ts +0 -199
  398. package/src/store/publisher.ts +0 -21
  399. package/src/store/reader.ts +0 -139
  400. package/src/store/review.ts +0 -239
  401. package/src/store/rows.ts +0 -250
  402. package/src/store/tenant.ts +0 -28
  403. package/src/store/undo.ts +0 -56
  404. package/src/store/unpublished.ts +0 -33
  405. package/src/store/versions.ts +0 -106
  406. package/src/store/writer.ts +0 -19
  407. package/src/testing/adapter-suite.ts +0 -239
  408. package/src/testing/index.ts +0 -2
  409. package/src/tile-doc.ts +0 -46
  410. package/src/tiles.ts +0 -120
@@ -0,0 +1 @@
1
+ export {};
@@ -19,11 +19,17 @@ function nextFrame(run) {
19
19
  function createTileStore(onDraw) {
20
20
  const answers = /* @__PURE__ */ new Map();
21
21
  const last = /* @__PURE__ */ new Map();
22
+ const failed = /* @__PURE__ */ new Map();
22
23
  const queued = /* @__PURE__ */ new Map();
23
24
  let cancel;
24
25
  const draw = () => {
25
26
  cancel = void 0;
26
27
  for (const [key, { widgetId, result }] of queued) {
28
+ if ("error" in result && result.error.code === "TILES_FAILED") {
29
+ failed.set(key, result);
30
+ continue;
31
+ }
32
+ failed.delete(key);
27
33
  answers.set(key, result);
28
34
  last.set(widgetId, result);
29
35
  }
@@ -32,8 +38,8 @@ function createTileStore(onDraw) {
32
38
  };
33
39
  return {
34
40
  /** The answer for a key, or else the last one the widget had, while its new one loads. */
35
- shown: (widgetId, key) => answers.get(key) ?? last.get(widgetId),
36
- answered: (key) => answers.has(key),
41
+ shown: (widgetId, key) => answers.get(key) ?? last.get(widgetId) ?? failed.get(key),
42
+ answered: (key) => answers.has(key) || failed.has(key),
37
43
  put: (widgetId, key, result) => {
38
44
  queued.set(key, {
39
45
  widgetId,
@@ -41,7 +47,13 @@ function createTileStore(onDraw) {
41
47
  });
42
48
  cancel ??= nextFrame(draw);
43
49
  },
44
- has: (key) => answers.has(key) || queued.has(key),
50
+ has: (key) => answers.has(key) || queued.has(key) || failed.has(key),
51
+ /** Whether any tile's request never reached the server. */
52
+ hasFailed: () => failed.size > 0,
53
+ /** Forgets the requests that never arrived, so the next refresh asks for them again. */
54
+ retry: () => {
55
+ failed.clear();
56
+ },
45
57
  /** Forgets answers no tile wants any more; each widget's last answer stays to show. */
46
58
  keepOnly: (wanted) => {
47
59
  for (const key of answers.keys()) if (!wanted.has(key)) answers.delete(key);
@@ -1,6 +1,9 @@
1
1
  import { Moved } from "./review.mjs";
2
2
  import { PanelName, Showing } from "./board.mjs";
3
+ import "./index.mjs";
3
4
  import { Attempt, DraftStatus } from "./draft.mjs";
5
+ import { DashboardsError } from "./errors.mjs";
6
+ import { DrillHistory } from "./drill/state.mjs";
4
7
  import { DashboardProps } from "./Dashboard.mjs";
5
8
  import { JustPublished } from "./Notice.mjs";
6
9
  /** Everything the dashboard shows at once, gathered from its hooks. */
@@ -31,9 +34,11 @@ export declare function useBoard(props: DashboardProps): {
31
34
  view: {
32
35
  tab: string | undefined;
33
36
  picks: import("derive-dashboards/core").Picks;
37
+ drill: import("derive-dashboards/core").DrillState | undefined;
34
38
  dropped: string[];
35
39
  setTab: (tab: string) => void;
36
40
  setPicks: (picks: import("derive-dashboards/core").Picks) => void;
41
+ setDrill: (drill: import("derive-dashboards/core").DrillState | undefined, history: DrillHistory) => void;
37
42
  current: import("derive-dashboards/core").ViewState;
38
43
  };
39
44
  shown: (Showing & {
@@ -75,6 +80,8 @@ export declare function useBoard(props: DashboardProps): {
75
80
  waiting: boolean;
76
81
  unpublished: boolean;
77
82
  error: boolean;
83
+ failure: DashboardsError | undefined;
84
+ unreachable: boolean;
78
85
  missing: boolean;
79
86
  doc: import("derive-dashboards/core").Doc | undefined;
80
87
  };
@@ -37,7 +37,10 @@ function useBoard(props) {
37
37
  useShortcuts({
38
38
  edit,
39
39
  onReview: panels.openReview,
40
- onEscape: panels.close
40
+ onEscape: () => {
41
+ panels.close();
42
+ if (view.drill !== void 0) view.setDrill(void 0, "push");
43
+ }
41
44
  });
42
45
  return {
43
46
  ...loaded,
@@ -1,4 +1,5 @@
1
1
  import { Attempt, DraftClosed, DraftStatus } from "./draft.mjs";
2
+ import { DashboardsError } from "./errors.mjs";
2
3
  import { PublishResponse } from "derive-dashboards/core";
3
4
  /**
4
5
  * The dashboard as stored, and the viewer's draft of it once they start editing. The viewer's
@@ -45,6 +46,9 @@ export declare function useDashboard(id: string, events: DashboardEvents, editab
45
46
  /** Made by this viewer and never published: discarding its draft deletes it. */
46
47
  unpublished: boolean;
47
48
  error: boolean;
49
+ /** Why it failed, when the handler said: its code and message, for whoever can act on it. */
50
+ failure: DashboardsError | undefined;
51
+ unreachable: boolean;
48
52
  /** The dashboard is not there for this viewer: not published yet, removed, or not theirs. */
49
53
  missing: boolean;
50
54
  doc: import("derive-dashboards/core").Doc | undefined;
@@ -29,6 +29,10 @@ function rights(data, editable) {
29
29
  unpublished: data?.unpublished === true
30
30
  };
31
31
  }
32
+ /** Why a read failed with nothing to show, when the handler said: its code and message. */
33
+ function failureOf(loaded) {
34
+ return loaded.data === void 0 && loaded.error instanceof DashboardsError ? loaded.error : void 0;
35
+ }
32
36
  function useDashboard(id, events, editable, onClosed) {
33
37
  const { client } = useDashboards();
34
38
  const { mutate } = useSWRConfig();
@@ -44,7 +48,10 @@ function useDashboard(id, events, editable, onClosed) {
44
48
  });
45
49
  useOpenOnce(editable && loaded.data?.unpublished === true, edit.start);
46
50
  return {
47
- error: loaded.error !== void 0,
51
+ error: loaded.error !== void 0 && loaded.data === void 0,
52
+ /** Why it failed, when the handler said: its code and message, for whoever can act on it. */
53
+ failure: failureOf(loaded),
54
+ unreachable: loaded.error !== void 0 && loaded.data !== void 0,
48
55
  /** The dashboard is not there for this viewer: not published yet, removed, or not theirs. */
49
56
  missing: loaded.error instanceof DashboardsError && loaded.error.code === "NOT_FOUND",
50
57
  doc: edit.draft?.doc ?? loaded.data?.document,
@@ -21,6 +21,24 @@ function refresh(a) {
21
21
  const missing = [...a.keys].filter(([, key]) => !a.store.has(key) && !flying.has(key));
22
22
  if (missing.length > 0) a.flights.add(a.start(missing));
23
23
  }
24
+ /** Asks for the wanted tiles that have no answer, as the latest keys and body say. */
25
+ function refreshNow(a) {
26
+ const onEnd = (flight) => {
27
+ a.flights.delete(flight);
28
+ };
29
+ refresh({
30
+ keys: a.keys,
31
+ flights: a.flights,
32
+ store: a.store,
33
+ start: (wanted) => launch({
34
+ client: a.client,
35
+ body: a.body,
36
+ wanted,
37
+ store: a.store,
38
+ onEnd
39
+ })
40
+ });
41
+ }
24
42
  /** Each widget's answer to show, and which are still on their way. */
25
43
  function collect(keys, store) {
26
44
  const results = /* @__PURE__ */ new Map();
@@ -35,6 +53,30 @@ function collect(keys, store) {
35
53
  pending
36
54
  };
37
55
  }
56
+ /**
57
+ * Tiles whose request never reached the server ask again when the browser is back online, when
58
+ * the window is focused, and every 15 seconds while any is still failing: a dropped connection
59
+ * heals without a reload.
60
+ */
61
+ function useRetry(store, again) {
62
+ const latest = useRef(again);
63
+ latest.current = again;
64
+ useEffect(() => {
65
+ const retry = () => {
66
+ if (!store.hasFailed()) return;
67
+ store.retry();
68
+ latest.current();
69
+ };
70
+ globalThis.addEventListener("online", retry);
71
+ globalThis.addEventListener("focus", retry);
72
+ const timer = setInterval(retry, 15e3);
73
+ return () => {
74
+ globalThis.removeEventListener("online", retry);
75
+ globalThis.removeEventListener("focus", retry);
76
+ clearInterval(timer);
77
+ };
78
+ }, [store]);
79
+ }
38
80
  /** Once per set of wanted answers: a version conflict means the document shown is behind. */
39
81
  function useStaleCheck(results, signature, onStale) {
40
82
  const stale = [...results.values()].some((r) => "error" in r && r.error.code === "VERSION_CONFLICT");
@@ -92,24 +134,16 @@ function useTiles(a) {
92
134
  }
93
135
  };
94
136
  const signature = [...keys.values()].toSorted().join("\0");
95
- useEffect(() => {
96
- const { keys: now, body } = latest.current;
97
- const onEnd = (flight) => {
98
- flights.current.delete(flight);
99
- };
100
- const start = (wanted) => launch({
137
+ const again = () => {
138
+ refreshNow({
139
+ ...latest.current,
101
140
  client,
102
- body,
103
- wanted,
104
141
  store,
105
- onEnd
106
- });
107
- refresh({
108
- keys: now,
109
- flights: flights.current,
110
- store,
111
- start
142
+ flights: flights.current
112
143
  });
144
+ };
145
+ useEffect(() => {
146
+ again();
113
147
  }, [
114
148
  signature,
115
149
  client,
@@ -123,6 +157,7 @@ function useTiles(a) {
123
157
  store.stop();
124
158
  };
125
159
  }, [store]);
160
+ useRetry(store, again);
126
161
  const { results, pending } = collect(keys, store);
127
162
  useStaleCheck(results, signature, a.onStale);
128
163
  return {
@@ -0,0 +1,16 @@
1
+ import { sharedSpan } from "./Tile.mjs";
2
+ import { useMemo } from "react";
3
+ import { viewLayout } from "derive-dashboards/core";
4
+ // src/view-grid.ts
5
+ /**
6
+ * The grid as a viewer sees it. The layout holds only the tiles there are widgets for, each at
7
+ * least the size its kind reads at, with no holes and every row full (core's `viewLayout`); an
8
+ * editor arranges the layout as saved. The span most tiles cover is said once, not per tile.
9
+ */
10
+ function useViewGrid(layout, widgets, results) {
11
+ return {
12
+ layout: useMemo(() => viewLayout(layout.filter((item) => widgets[item.widget] !== void 0), (widget) => widgets[widget]?.kind), [layout, widgets]),
13
+ sharedSpan: useMemo(() => sharedSpan(results), [results])
14
+ };
15
+ }
16
+ export { useViewGrid };
@@ -0,0 +1,9 @@
1
+ import { DrillHistory } from "./drill/state.mjs";
2
+ import { Doc, DrillState, Picks, ViewState } from "derive-dashboards/core";
3
+ /**
4
+ * How a view changed: `push` for a step Back should undo (a drill opened or a step deeper),
5
+ * `replace` for the rest. The library never writes history itself; the host decides.
6
+ */
7
+ export type ViewChange = {
8
+ history: DrillHistory;
9
+ };
@@ -2,44 +2,56 @@ import { useState } from "react";
2
2
  import { VIEW_PREFIX, encodeView, viewFor } from "derive-dashboards/core";
3
3
  // src/view.ts
4
4
  /**
5
- * The tab open and the filters set: the host's, when it passes `view` and `onViewChange` (to
6
- * keep them in its URL), else the dashboard's own. A view naming a tab or filter the dashboard
7
- * does not have keeps the rest, and `dropped` names what was left out.
5
+ * The tab open, the filters set and the drill open: the host's, when it passes `view` and
6
+ * `onViewChange` (to keep them in its URL), else the dashboard's own. A host view without a
7
+ * `drill` key keeps the dashboard's own drill. A view naming a tab,
8
+ * filter or widget the dashboard does not have keeps the rest, and `dropped` names what was left out.
8
9
  */
9
10
  function useView(doc, view, onViewChange, linkDropped = []) {
10
11
  const [own, setOwn] = useState({ picks: {} });
11
- const wanted = view ?? own;
12
+ const wanted = view === void 0 ? own : "drill" in view || own.drill === void 0 ? view : {
13
+ ...view,
14
+ drill: own.drill
15
+ };
12
16
  const kept = doc === void 0 ? {
13
17
  view: wanted,
14
18
  dropped: []
15
19
  } : viewFor(doc, wanted);
16
- const set = (next) => {
20
+ const set = (next, history = "replace") => {
17
21
  setOwn(next);
18
- onViewChange?.(next);
22
+ onViewChange?.(next, { history });
19
23
  };
24
+ const { drill: _drill, ...base } = kept.view;
20
25
  return {
21
26
  tab: kept.view.tab,
22
27
  picks: kept.view.picks,
28
+ drill: kept.view.drill,
23
29
  dropped: [...linkDropped, ...kept.dropped],
24
30
  setTab: (tab) => {
25
31
  set({
26
- ...kept.view,
32
+ ...base,
27
33
  tab
28
34
  });
29
35
  },
30
36
  setPicks: (picks) => {
31
37
  set({
32
- ...kept.view,
38
+ ...base,
33
39
  picks
34
40
  });
35
41
  },
42
+ setDrill: (drill, history) => {
43
+ set(drill === void 0 ? base : {
44
+ ...base,
45
+ drill
46
+ }, history);
47
+ },
36
48
  current: kept.view
37
49
  };
38
50
  }
39
51
  /**
40
52
  * A link to this view: the host's `linkFor`, or the page's own address with the view's
41
- * parameters in place of any it had. A link carries only the tab and filters; the person who
42
- * opens it sees what their own access allows.
53
+ * parameters in place of any it had. A link carries the tab, the filters and the drill; the
54
+ * person who opens it sees what their own access allows.
43
55
  */
44
56
  function linkTo(view, linkFor) {
45
57
  if (linkFor !== void 0) return linkFor(view);
@@ -0,0 +1,2 @@
1
+ import { CustomSource, DashOptions } from "derive-dashboards/core";
2
+ import "derive-dashboards/core/engine";
package/dist/reading.mjs CHANGED
@@ -15,6 +15,14 @@ function connectionOf(at) {
15
15
  if (!isSource(handle)) throw new Error(`\`connections.${connection}\` gave no connection for this request. It must return postgresConnection({ run, transaction }) or customSource({ answer }).`);
16
16
  return handle;
17
17
  }
18
+ /** Whether a source's connection serves the rows behind an answer: a database does, a host's data layer when it gives `records`. */
19
+ function servesRecords(at) {
20
+ const handle = connectionOf({
21
+ ...at,
22
+ maxRows: 0
23
+ });
24
+ return !isCustomSource(handle) || handle.records !== void 0;
25
+ }
18
26
  /**
19
27
  * Runs `fn` with a reader for the source's connection, under the request's deadline and abort:
20
28
  * in one read-only session of a database, or through the host's custom source, each of its
@@ -40,4 +48,4 @@ async function withReader(at, fn) {
40
48
  custom: false
41
49
  };
42
50
  }
43
- export { isSource, withReader };
51
+ export { isSource, servesRecords, withReader };
@@ -0,0 +1,28 @@
1
+ import { yAxis } from "./axis.mjs";
2
+ import { YAxis } from "recharts";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/axes.tsx
5
+ /**
6
+ * The value axes: the first unit on the left; a second unit, when the chart has one, on the
7
+ * right, so dollars and counts are never read on one scale.
8
+ */
9
+ function yAxes(drawn, locale) {
10
+ return ["left", "right"].filter((side) => drawn.series.some((s) => s.axis === side)).map((side) => /* @__PURE__ */ jsx(YAxis, {
11
+ yAxisId: side,
12
+ orientation: side,
13
+ tickLine: false,
14
+ axisLine: false,
15
+ stroke: "var(--dd-muted)",
16
+ width: 56,
17
+ ...yAxis(drawn.series.filter((s) => s.axis === side), drawn.points, locale)
18
+ }, side));
19
+ }
20
+ /** The values a chart leaves to the table (a third unit, or more than a split draws), named. */
21
+ function NotDrawn({ drawn, props }) {
22
+ if (drawn.notDrawn.length === 0) return null;
23
+ return /* @__PURE__ */ jsx("p", {
24
+ className: "dd-chart-note",
25
+ children: props.messages.notDrawn(drawn.notDrawn.map((c) => c.label))
26
+ });
27
+ }
28
+ export { NotDrawn, yAxes };
@@ -0,0 +1,84 @@
1
+ import { formatTick } from "derive-dashboards/react";
2
+ // src/axis.ts
3
+ /**
4
+ * A percent axis's ticks: from 0 up past the data in a step a person reads (5%, 10%, 25%...),
5
+ * so it reads 0, 10, 20, 30% and never 6.5%. All zero reaches 100%, not 400% of nothing.
6
+ */
7
+ function percentTicks(max, full) {
8
+ const top = max > 0 ? max : full;
9
+ const step = [
10
+ .05,
11
+ .1,
12
+ .2,
13
+ .25,
14
+ .5,
15
+ 1
16
+ ].map((s) => s * full).find((s) => top / s <= 5) ?? full;
17
+ const count = Math.ceil(top / step - 1e-9);
18
+ return Array.from({ length: count + 1 }, (_v, i) => Number((i * step).toFixed(6)));
19
+ }
20
+ /**
21
+ * A value axis's ticks: from 0 up past the data in a step a person reads (1, 2, 2.5 or 5 times
22
+ * a power of ten), four or five steps, so it reads 0, 50, 100, 150 and never 35, 70, 105. A
23
+ * count steps in whole numbers only.
24
+ */
25
+ function niceTicks(max, whole) {
26
+ if (!(max > 0)) return [0, 1];
27
+ const rough = max / 4;
28
+ const power = 10 ** Math.floor(Math.log10(rough));
29
+ const step = [
30
+ 1,
31
+ 2,
32
+ 2.5,
33
+ 5,
34
+ 10
35
+ ].map((m) => m * power).filter((s) => !whole || Number.isInteger(s)).find((s) => max / s <= 5) ?? Math.max(1, Math.ceil(rough));
36
+ const count = Math.ceil(max / step - 1e-9);
37
+ return Array.from({ length: count + 1 }, (_v, i) => Number((i * step).toPrecision(12)));
38
+ }
39
+ /**
40
+ * A value axis that reads at a glance: counts tick in whole numbers (no 2.5 tasks), percents on
41
+ * round steps of the whole, anything else on round steps from 0; a stacked chart reaches its
42
+ * tallest stack. Data below zero keeps the kit's own ticks, which reach both ways.
43
+ */
44
+ function yAxis(series, points, locale, stacked = false) {
45
+ const { whole, percentOf } = shapeOf(series[0]?.column);
46
+ const values = points.flatMap((p) => series.map((s) => p[s.key]).filter((v) => typeof v === "number"));
47
+ const top = Math.max(0, ...stacked ? stackedTops(series, points) : [], ...values);
48
+ const ticks = values.some((v) => v < 0) ? void 0 : ticksFor(top, percentOf, whole);
49
+ return {
50
+ allowDecimals: !whole,
51
+ interval: 0,
52
+ tickFormatter: axisFormat(series, locale),
53
+ ...ticks === void 0 ? {} : {
54
+ ticks,
55
+ domain: [0, ticks.at(-1) ?? 1]
56
+ }
57
+ };
58
+ }
59
+ /** What an axis reads of its column: whole counts, and a percent's whole (1 or 100). */
60
+ function shapeOf(column) {
61
+ if (column === void 0) return {
62
+ whole: false,
63
+ percentOf: void 0
64
+ };
65
+ const percentOf = column.format === "percent" ? column.fraction === true ? 1 : 100 : void 0;
66
+ return {
67
+ whole: column.type === "int",
68
+ percentOf
69
+ };
70
+ }
71
+ /** A percent axis ticks on steps of its whole; any other on round steps from 0. */
72
+ const ticksFor = (top, percentOf, whole) => percentOf === void 0 ? niceTicks(top, whole) : percentTicks(top, percentOf);
73
+ /** Each point's total over its series: a stacked bar reaches its sum, not its tallest part. */
74
+ function stackedTops(series, points) {
75
+ return points.map((p) => series.reduce((sum, s) => {
76
+ const v = p[s.key];
77
+ return typeof v === "number" && v > 0 ? sum + v : sum;
78
+ }, 0));
79
+ }
80
+ function axisFormat(series, locale) {
81
+ const column = series[0]?.column;
82
+ return (value) => formatTick(value, column, locale);
83
+ }
84
+ export { niceTicks, percentTicks, yAxis };
@@ -0,0 +1,7 @@
1
+ import { TileRendererProps } from "derive-dashboards/react";
2
+ /**
3
+ * Bars per x value; when a second field splits them, its values stack, Other on top. Bars over
4
+ * time stand up, the bucket still running drawn faint; bars by category lie down, so every
5
+ * name has room to be read and none is skipped.
6
+ */
7
+ export declare function BarTile(props: TileRendererProps): import("react").JSX.Element;
@@ -0,0 +1,140 @@
1
+ import { yAxis } from "./axis.mjs";
2
+ import { openPoint } from "./marks.mjs";
3
+ import { CHART, TOOLTIP, color, legendText, runningLabel, tooltipFormat, tooltipLabel } from "./parts.mjs";
4
+ import { toSeries } from "./series.mjs";
5
+ import { Beside } from "./table.mjs";
6
+ import { useState } from "react";
7
+ import { Bar, BarChart, CartesianGrid, Legend, Rectangle, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ // src/bar.tsx
10
+ /** Category labels are cut to this many characters, with the whole name in the tooltip. */
11
+ const LABEL = 24;
12
+ const cut = (label) => {
13
+ const text = String(label);
14
+ return text.length > LABEL ? `${text.slice(0, 23)}…` : text;
15
+ };
16
+ /** Room for the longest category label, in pixels, between a floor and a ceiling. */
17
+ const labelWidth = (points) => Math.min(180, Math.max(48, 12 + 7 * Math.max(0, ...points.map((p) => cut(p.x).length))));
18
+ /** A click on a bar opens the row behind it, with its series' line. */
19
+ const barClick = (drill, drawn, s) => drill === void 0 ? {} : { onClick: (_bar, point) => {
20
+ openPoint(drill, drawn, {
21
+ point,
22
+ series: s
23
+ });
24
+ } };
25
+ /** A bar's shape: outlined when the keyboard is on it, faint when its bucket is still running. */
26
+ const barShape = (focused, key, running) => (props) => /* @__PURE__ */ jsx(Rectangle, {
27
+ ...props,
28
+ ...props.index === running ? { fillOpacity: .45 } : {},
29
+ ...focused?.key === key && focused.point === props.index ? {
30
+ className: "dd-chart-focus",
31
+ stroke: "var(--dd-ink)",
32
+ strokeWidth: 2
33
+ } : {}
34
+ });
35
+ /** Round ends on the bar's outer end only: its top standing up, its right end lying down. */
36
+ const barRadius = (inner, upright) => inner ? 0 : upright ? [
37
+ 4,
38
+ 4,
39
+ 0,
40
+ 0
41
+ ] : [
42
+ 0,
43
+ 4,
44
+ 4,
45
+ 0
46
+ ];
47
+ const AXIS = {
48
+ tickLine: false,
49
+ axisLine: false,
50
+ stroke: "var(--dd-muted)"
51
+ };
52
+ /** Bars over time: time along the bottom, values up the side. By category: names down the side. */
53
+ function barAxes(overTime, values, points) {
54
+ return overTime ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(XAxis, {
55
+ dataKey: "x",
56
+ ...AXIS,
57
+ interval: "preserveStartEnd",
58
+ minTickGap: 12
59
+ }), /* @__PURE__ */ jsx(YAxis, {
60
+ ...AXIS,
61
+ width: 56,
62
+ ...values
63
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(XAxis, {
64
+ type: "number",
65
+ ...AXIS,
66
+ ...values
67
+ }), /* @__PURE__ */ jsx(YAxis, {
68
+ type: "category",
69
+ dataKey: "x",
70
+ ...AXIS,
71
+ interval: 0,
72
+ width: labelWidth(points),
73
+ tickFormatter: cut
74
+ })] });
75
+ }
76
+ /**
77
+ * Bars per x value; when a second field splits them, its values stack, Other on top. Bars over
78
+ * time stand up, the bucket still running drawn faint; bars by category lie down, so every
79
+ * name has room to be read and none is skipped.
80
+ */
81
+ function BarTile(props) {
82
+ const { answer, locale, drill } = props;
83
+ const [focused, setFocused] = useState(null);
84
+ const drawn = toSeries(answer, props);
85
+ const { points, series, split } = drawn;
86
+ const overTime = answer.columns[0]?.type === "time" || answer.columns[0]?.grain !== void 0;
87
+ const running = overTime ? runningLabel(props, points) : void 0;
88
+ const values = yAxis(series, points, locale, split);
89
+ return /* @__PURE__ */ jsxs("div", {
90
+ className: "dd-chart",
91
+ "data-drillable": drill !== void 0,
92
+ children: [/* @__PURE__ */ jsx("div", {
93
+ className: "dd-chart-picture",
94
+ "aria-hidden": "true",
95
+ children: /* @__PURE__ */ jsx(ResponsiveContainer, { children: /* @__PURE__ */ jsxs(BarChart, {
96
+ ...CHART,
97
+ data: points,
98
+ maxBarSize: overTime ? 56 : 28,
99
+ layout: overTime ? "horizontal" : "vertical",
100
+ children: [
101
+ /* @__PURE__ */ jsx(CartesianGrid, {
102
+ stroke: "var(--dd-line)",
103
+ vertical: !overTime,
104
+ horizontal: overTime
105
+ }),
106
+ barAxes(overTime, values, points),
107
+ /* @__PURE__ */ jsx(Tooltip, {
108
+ ...TOOLTIP,
109
+ formatter: tooltipFormat(props, drawn),
110
+ labelFormatter: tooltipLabel(props, running)
111
+ }),
112
+ series.length > 1 ? /* @__PURE__ */ jsx(Legend, {
113
+ itemSorter: null,
114
+ formatter: legendText
115
+ }) : null,
116
+ series.map((s, i) => /* @__PURE__ */ jsx(Bar, {
117
+ dataKey: s.key,
118
+ name: s.label,
119
+ fill: color(props, s, i),
120
+ ...split ? {
121
+ stackId: "split",
122
+ stroke: "var(--dd-surface)",
123
+ strokeWidth: 2
124
+ } : {},
125
+ radius: barRadius(split && i < series.length - 1, overTime),
126
+ isAnimationActive: false,
127
+ ...barClick(drill, drawn, s),
128
+ shape: barShape(focused, s.key, running === void 0 ? -1 : points.length - 1)
129
+ }, s.key))
130
+ ]
131
+ }) })
132
+ }), /* @__PURE__ */ jsx(Beside, {
133
+ drawn,
134
+ props,
135
+ kind: "bar",
136
+ onFocusMark: setFocused
137
+ })]
138
+ });
139
+ }
140
+ export { BarTile };
@@ -1,10 +1,8 @@
1
- import { TileRendererProps } from "derive-dashboards/react";
2
- /** A line per series over the x axis, usually time buckets. */
3
- export declare function LineTile(props: TileRendererProps): import("react").JSX.Element;
4
- /** Bars per x value; when a second field splits them, its values stack, Other on top. */
5
- export declare function BarTile(props: TileRendererProps): import("react").JSX.Element;
1
+ import { BarTile } from "./bar.mjs";
2
+ import { LineTile } from "./line.mjs";
6
3
  /** Register with `<DashboardsProvider renderers={RECHARTS_RENDERERS}>`. */
7
4
  export declare const RECHARTS_RENDERERS: {
8
5
  line: typeof LineTile;
9
6
  bar: typeof BarTile;
10
- };
7
+ };
8
+ export { BarTile, LineTile };