@malloy-publisher/sdk 0.9.1 → 0.9.2

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 (292) hide show
  1. package/dist/{Dashboard-H1kJlDFo.es.js → DashboardTile-BFcxdv7R.es.js} +15918 -17760
  2. package/dist/DashboardTile-sg8LjUk8.cjs.js +137 -0
  3. package/dist/RenderedResult-B48wAjM8.cjs.js +141 -0
  4. package/dist/{RenderedResult-BRgIgxWh.es.js → RenderedResult-CBLHr32C.es.js} +193 -183
  5. package/dist/{ServerProvider-Boxrv6Ym.es.js → ServerProvider-DCV8BUWD.es.js} +529 -521
  6. package/dist/ServerProvider-HRqT3w1C.cjs.js +1 -0
  7. package/dist/builder/index.cjs.js +146 -58
  8. package/dist/builder/index.es.js +9076 -6479
  9. package/dist/builder-entry.d.ts +4 -0
  10. package/dist/client/api.d.ts +77 -47
  11. package/dist/client/configuration.d.ts +1 -1
  12. package/dist/client/index.cjs.js +1 -1
  13. package/dist/client/index.d.ts +1 -1
  14. package/dist/client/index.es.js +84 -82
  15. package/dist/components/Dashboard/Dashboard.d.ts +8 -15
  16. package/dist/components/Dashboard/DashboardGrid.d.ts +23 -6
  17. package/dist/components/Dashboard/DashboardTile.d.ts +10 -1
  18. package/dist/components/Dashboard/DashboardView.d.ts +36 -0
  19. package/dist/components/Dashboard/TileCard.d.ts +15 -4
  20. package/dist/components/Dashboard/TileFilterTag.d.ts +12 -0
  21. package/dist/components/Dashboard/index.d.ts +3 -0
  22. package/dist/components/Dashboard/telemetry.d.ts +15 -3
  23. package/dist/components/DashboardBuilder/AddTileDialog.d.ts +8 -1
  24. package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +16 -5
  25. package/dist/components/DashboardBuilder/ChartPicker.d.ts +29 -0
  26. package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +48 -21
  27. package/dist/components/DashboardBuilder/DashboardEditor.d.ts +17 -4
  28. package/dist/components/DashboardBuilder/DiffDialog.d.ts +2 -10
  29. package/dist/components/DashboardBuilder/FilterDialog.d.ts +2 -2
  30. package/dist/components/DashboardBuilder/FilterStrip.d.ts +3 -1
  31. package/dist/components/DashboardBuilder/InlineMarkdown.d.ts +18 -0
  32. package/dist/components/DashboardBuilder/InlineText.d.ts +19 -0
  33. package/dist/components/DashboardBuilder/NotebookEditor.d.ts +15 -0
  34. package/dist/components/DashboardBuilder/SaveNotice.d.ts +27 -0
  35. package/dist/components/DashboardBuilder/SettingsPopover.d.ts +19 -7
  36. package/dist/components/DashboardBuilder/SourceViewPicker.d.ts +9 -0
  37. package/dist/components/DashboardBuilder/TextTileBody.d.ts +7 -0
  38. package/dist/components/DashboardBuilder/TileFrame.d.ts +14 -12
  39. package/dist/components/DashboardBuilder/TileMenu.d.ts +11 -3
  40. package/dist/components/DashboardBuilder/annotationText.d.ts +4 -0
  41. package/dist/components/DashboardBuilder/catalog.d.ts +4 -0
  42. package/dist/components/DashboardBuilder/changedTile.d.ts +7 -0
  43. package/dist/components/DashboardBuilder/chartLine.d.ts +33 -0
  44. package/dist/components/DashboardBuilder/controls.d.ts +2 -2
  45. package/dist/components/DashboardBuilder/document.d.ts +42 -26
  46. package/dist/components/DashboardBuilder/documentSession.d.ts +100 -0
  47. package/dist/components/DashboardBuilder/legacyNotebook.d.ts +73 -0
  48. package/dist/components/DashboardBuilder/loadMalloy.d.ts +15 -0
  49. package/dist/components/DashboardBuilder/malloyText.d.ts +45 -5
  50. package/dist/components/DashboardBuilder/malloyTree.d.ts +119 -0
  51. package/dist/components/DashboardBuilder/newDashboard.d.ts +3 -1
  52. package/dist/components/DashboardBuilder/openDraft.d.ts +10 -0
  53. package/dist/components/DashboardBuilder/preview.d.ts +24 -4
  54. package/dist/components/DashboardBuilder/readDocument.d.ts +4 -1
  55. package/dist/components/DashboardBuilder/readForEditor.d.ts +16 -0
  56. package/dist/components/DashboardBuilder/sortable.d.ts +14 -0
  57. package/dist/components/DashboardBuilder/spliceDocument.d.ts +13 -13
  58. package/dist/components/DashboardBuilder/spliceResult.d.ts +11 -0
  59. package/dist/components/DashboardBuilder/tagParse.d.ts +24 -0
  60. package/dist/components/DashboardBuilder/telemetry.d.ts +43 -0
  61. package/dist/components/DashboardBuilder/testing/fixtures.d.ts +3 -1
  62. package/dist/components/DashboardBuilder/testing/inline.d.ts +4 -0
  63. package/dist/components/DashboardBuilder/useBuilderSession.d.ts +89 -0
  64. package/dist/components/DashboardBuilder/useBuilderShortcuts.d.ts +9 -6
  65. package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +17 -55
  66. package/dist/components/DashboardBuilder/useDocumentEditor.d.ts +105 -0
  67. package/dist/components/DashboardBuilder/useExitGuard.d.ts +19 -0
  68. package/dist/components/DashboardBuilder/useFilterForm.d.ts +3 -3
  69. package/dist/components/DocumentCreate/canRetry.d.ts +6 -0
  70. package/dist/components/DocumentCreate/createDocument.d.ts +58 -0
  71. package/dist/components/DocumentCreate/documentPath.d.ts +10 -0
  72. package/dist/components/DocumentCreate/events.d.ts +10 -0
  73. package/dist/components/DocumentCreate/exportedSources.d.ts +7 -0
  74. package/dist/components/DocumentCreate/guards.d.ts +12 -0
  75. package/dist/components/DocumentCreate/index.d.ts +6 -0
  76. package/dist/components/DocumentCreate/newNotebook.d.ts +9 -0
  77. package/dist/components/DocumentCreate/useDocumentChoices.d.ts +32 -0
  78. package/dist/components/DocumentStorage/DocumentStorage.d.ts +2 -1
  79. package/dist/components/NarrowEditGate.d.ts +8 -0
  80. package/dist/components/Notebook/Notebook.d.ts +1 -1
  81. package/dist/components/Package/NewDocumentDialog.d.ts +33 -0
  82. package/dist/components/Package/Package.d.ts +1 -0
  83. package/dist/components/Package/documentLocation.d.ts +28 -0
  84. package/dist/components/Package/index.d.ts +4 -0
  85. package/dist/components/Package/useDocumentLocation.d.ts +12 -0
  86. package/dist/components/PackageSection.d.ts +2 -2
  87. package/dist/components/RenderedResult/RenderedResult.d.ts +2 -0
  88. package/dist/components/RenderedResult/ResultContainer.d.ts +8 -1
  89. package/dist/components/RenderedResult/ResultPanel.d.ts +3 -1
  90. package/dist/components/RenderedResult/resultSizing.d.ts +9 -1
  91. package/dist/components/ServerProvider.d.ts +2 -1
  92. package/dist/components/UnsavedChangesDialog.d.ts +9 -0
  93. package/dist/components/given/GivensPanel.d.ts +2 -2
  94. package/dist/components/index.d.ts +2 -0
  95. package/dist/hooks/index.d.ts +1 -0
  96. package/dist/hooks/useNarrowScreen.d.ts +4 -0
  97. package/dist/hooks/useQueryResult.d.ts +2 -0
  98. package/dist/hooks/useSettled.d.ts +14 -0
  99. package/dist/index.cjs.js +23 -24
  100. package/dist/index.es.js +9714 -7072
  101. package/dist/text/index.cjs.js +1 -0
  102. package/dist/text/index.d.ts +2 -0
  103. package/dist/text/index.es.js +6 -0
  104. package/dist/text-entry-BJwltZiy.cjs.js +7 -0
  105. package/dist/text-entry-CbbBcZl8.es.js +196 -0
  106. package/dist/text-entry.d.ts +2 -0
  107. package/dist/utils/clock.d.ts +2 -0
  108. package/package.json +10 -1
  109. package/src/builder-entry.ts +35 -0
  110. package/src/components/Dashboard/Dashboard.tsx +27 -278
  111. package/src/components/Dashboard/DashboardGrid.tsx +68 -7
  112. package/src/components/Dashboard/DashboardTile.spec.tsx +24 -0
  113. package/src/components/Dashboard/DashboardTile.tsx +31 -4
  114. package/src/components/Dashboard/DashboardView.spec.tsx +212 -0
  115. package/src/components/Dashboard/DashboardView.tsx +352 -0
  116. package/src/components/Dashboard/RowsDialog.tsx +1 -1
  117. package/src/components/Dashboard/TileCard.tsx +44 -10
  118. package/src/components/Dashboard/TileFilterTag.spec.tsx +73 -0
  119. package/src/components/Dashboard/TileFilterTag.tsx +78 -0
  120. package/src/components/Dashboard/defaultTileSpan.spec.ts +32 -0
  121. package/src/components/Dashboard/index.ts +3 -0
  122. package/src/components/Dashboard/telemetry.ts +16 -5
  123. package/src/components/DashboardBuilder/AddTileDialog.spec.tsx +88 -0
  124. package/src/components/DashboardBuilder/AddTileDialog.tsx +137 -111
  125. package/src/components/DashboardBuilder/BuilderToolbar.tsx +85 -27
  126. package/src/components/DashboardBuilder/ChartPicker.render.spec.tsx +25 -0
  127. package/src/components/DashboardBuilder/ChartPicker.spec.ts +77 -0
  128. package/src/components/DashboardBuilder/ChartPicker.tsx +153 -0
  129. package/src/components/DashboardBuilder/DashboardBuilder.charts.spec.tsx +205 -0
  130. package/src/components/DashboardBuilder/DashboardBuilder.exit.spec.tsx +192 -0
  131. package/src/components/DashboardBuilder/DashboardBuilder.inline.spec.tsx +329 -0
  132. package/src/components/DashboardBuilder/DashboardBuilder.notebook.spec.tsx +363 -0
  133. package/src/components/DashboardBuilder/DashboardBuilder.notice.spec.tsx +194 -0
  134. package/src/components/DashboardBuilder/DashboardBuilder.openDraft.spec.tsx +157 -0
  135. package/src/components/DashboardBuilder/DashboardBuilder.sources.spec.tsx +124 -0
  136. package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +103 -78
  137. package/src/components/DashboardBuilder/DashboardBuilder.textTiles.spec.tsx +177 -0
  138. package/src/components/DashboardBuilder/DashboardBuilder.tsx +610 -315
  139. package/src/components/DashboardBuilder/DashboardEditor.authoritative.spec.tsx +58 -8
  140. package/src/components/DashboardBuilder/DashboardEditor.emptyStart.spec.tsx +191 -0
  141. package/src/components/DashboardBuilder/DashboardEditor.filterTag.spec.tsx +162 -0
  142. package/src/components/DashboardBuilder/DashboardEditor.notebook.spec.tsx +316 -0
  143. package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +56 -10
  144. package/src/components/DashboardBuilder/DashboardEditor.resourceUri.spec.tsx +5 -22
  145. package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +96 -14
  146. package/src/components/DashboardBuilder/DashboardEditor.tsx +482 -332
  147. package/src/components/DashboardBuilder/DiffDialog.spec.tsx +25 -0
  148. package/src/components/DashboardBuilder/DiffDialog.tsx +5 -24
  149. package/src/components/DashboardBuilder/DrillDialog.tsx +1 -1
  150. package/src/components/DashboardBuilder/FilterDialog.tsx +10 -3
  151. package/src/components/DashboardBuilder/FilterStrip.tsx +26 -4
  152. package/src/components/DashboardBuilder/InlineMarkdown.tsx +184 -0
  153. package/src/components/DashboardBuilder/InlineText.tsx +106 -0
  154. package/src/components/DashboardBuilder/NotebookEditor.tsx +44 -0
  155. package/src/components/DashboardBuilder/SaveNotice.tsx +113 -0
  156. package/src/components/DashboardBuilder/SettingsPopover.spec.tsx +87 -0
  157. package/src/components/DashboardBuilder/SettingsPopover.tsx +225 -67
  158. package/src/components/DashboardBuilder/SourceViewPicker.tsx +122 -0
  159. package/src/components/DashboardBuilder/TextTileBody.tsx +28 -0
  160. package/src/components/DashboardBuilder/TileFrame.tsx +89 -115
  161. package/src/components/DashboardBuilder/TileMenu.tsx +168 -90
  162. package/src/components/DashboardBuilder/annotationText.spec.ts +33 -0
  163. package/src/components/DashboardBuilder/annotationText.ts +17 -0
  164. package/src/components/DashboardBuilder/artifactBlock.spec.ts +248 -0
  165. package/src/components/DashboardBuilder/artifactTagParity.spec.ts +41 -0
  166. package/src/components/DashboardBuilder/catalog.aggregate.spec.ts +49 -0
  167. package/src/components/DashboardBuilder/catalog.spec.ts +2 -0
  168. package/src/components/DashboardBuilder/catalog.ts +61 -21
  169. package/src/components/DashboardBuilder/changedTile.spec.ts +46 -0
  170. package/src/components/DashboardBuilder/changedTile.ts +28 -0
  171. package/src/components/DashboardBuilder/chartLine.spec.ts +180 -0
  172. package/src/components/DashboardBuilder/chartLine.ts +121 -0
  173. package/src/components/DashboardBuilder/controls.spec.ts +21 -10
  174. package/src/components/DashboardBuilder/controls.ts +22 -8
  175. package/src/components/DashboardBuilder/document.ts +53 -5
  176. package/src/components/DashboardBuilder/documentSession.spec.ts +209 -0
  177. package/src/components/DashboardBuilder/documentSession.ts +257 -0
  178. package/src/components/DashboardBuilder/emptyStart.spec.ts +131 -0
  179. package/src/components/DashboardBuilder/invariants.spec.ts +6 -2
  180. package/src/components/DashboardBuilder/legacyNotebook.chart.spec.ts +77 -0
  181. package/src/components/DashboardBuilder/legacyNotebook.convert.spec.ts +630 -0
  182. package/src/components/DashboardBuilder/legacyNotebook.read.spec.ts +338 -0
  183. package/src/components/DashboardBuilder/legacyNotebook.ts +1117 -0
  184. package/src/components/DashboardBuilder/loadMalloy.spec.ts +80 -0
  185. package/src/components/DashboardBuilder/loadMalloy.ts +39 -0
  186. package/src/components/DashboardBuilder/malloyText.spec.ts +48 -0
  187. package/src/components/DashboardBuilder/malloyText.ts +181 -27
  188. package/src/components/DashboardBuilder/malloyTree.ts +155 -7
  189. package/src/components/DashboardBuilder/newDashboard.spec.ts +46 -2
  190. package/src/components/DashboardBuilder/newDashboard.ts +30 -3
  191. package/src/components/DashboardBuilder/openDraft.ts +52 -0
  192. package/src/components/DashboardBuilder/preview.shapes.spec.ts +75 -0
  193. package/src/components/DashboardBuilder/preview.spec.ts +159 -12
  194. package/src/components/DashboardBuilder/preview.ts +83 -9
  195. package/src/components/DashboardBuilder/readDocument.spec.ts +139 -27
  196. package/src/components/DashboardBuilder/readDocument.ts +130 -44
  197. package/src/components/DashboardBuilder/readForEditor.spec.ts +80 -0
  198. package/src/components/DashboardBuilder/readForEditor.ts +47 -0
  199. package/src/components/DashboardBuilder/scannerShapes.spec.ts +14 -13
  200. package/src/components/DashboardBuilder/sortable.spec.ts +65 -0
  201. package/src/components/DashboardBuilder/sortable.tsx +2 -12
  202. package/src/components/DashboardBuilder/spliceDocument.chart.spec.ts +340 -0
  203. package/src/components/DashboardBuilder/spliceDocument.imports.spec.ts +167 -0
  204. package/src/components/DashboardBuilder/spliceDocument.spec.ts +229 -94
  205. package/src/components/DashboardBuilder/spliceDocument.ts +762 -130
  206. package/src/components/DashboardBuilder/spliceResult.ts +15 -0
  207. package/src/components/DashboardBuilder/statementExtent.spec.ts +33 -30
  208. package/src/components/DashboardBuilder/tagParse.spec.ts +149 -0
  209. package/src/components/DashboardBuilder/tagParse.ts +103 -0
  210. package/src/components/DashboardBuilder/telemetry.ts +47 -0
  211. package/src/components/DashboardBuilder/testing/artifactTagParity.json +197 -0
  212. package/src/components/DashboardBuilder/testing/fixtures.ts +16 -1
  213. package/src/components/DashboardBuilder/testing/inline.ts +25 -0
  214. package/src/components/DashboardBuilder/textTiles.spec.ts +718 -0
  215. package/src/components/DashboardBuilder/useBuilderSession.spec.ts +335 -0
  216. package/src/components/DashboardBuilder/useBuilderSession.ts +292 -0
  217. package/src/components/DashboardBuilder/useBuilderShortcuts.overlay.spec.tsx +65 -0
  218. package/src/components/DashboardBuilder/useBuilderShortcuts.spec.tsx +60 -0
  219. package/src/components/DashboardBuilder/useBuilderShortcuts.ts +36 -10
  220. package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +16 -13
  221. package/src/components/DashboardBuilder/useDashboardEditor.ts +54 -181
  222. package/src/components/DashboardBuilder/useDocumentEditor.spec.ts +565 -0
  223. package/src/components/DashboardBuilder/useDocumentEditor.ts +399 -0
  224. package/src/components/DashboardBuilder/useExitGuard.spec.ts +159 -0
  225. package/src/components/DashboardBuilder/useExitGuard.ts +89 -0
  226. package/src/components/DashboardBuilder/useFilterForm.existing.spec.tsx +41 -0
  227. package/src/components/DashboardBuilder/useFilterForm.spec.tsx +24 -2
  228. package/src/components/DashboardBuilder/useFilterForm.ts +41 -13
  229. package/src/components/DashboardBuilder/useTileReorder.spec.tsx +28 -5
  230. package/src/components/DashboardBuilder/useTileReorder.ts +5 -7
  231. package/src/components/DocumentCreate/canRetry.spec.ts +32 -0
  232. package/src/components/DocumentCreate/canRetry.ts +19 -0
  233. package/src/components/DocumentCreate/createDocument.spec.ts +310 -0
  234. package/src/components/DocumentCreate/createDocument.ts +159 -0
  235. package/src/components/DocumentCreate/documentPath.ts +40 -0
  236. package/src/components/DocumentCreate/events.ts +15 -0
  237. package/src/components/DocumentCreate/exportedSources.ts +25 -0
  238. package/src/components/DocumentCreate/guards.ts +45 -0
  239. package/src/components/DocumentCreate/index.ts +27 -0
  240. package/src/components/DocumentCreate/newNotebook.spec.ts +156 -0
  241. package/src/components/DocumentCreate/newNotebook.ts +44 -0
  242. package/src/components/DocumentCreate/useDocumentChoices.spec.tsx +138 -0
  243. package/src/components/DocumentCreate/useDocumentChoices.ts +113 -0
  244. package/src/components/DocumentStorage/DocumentStorage.ts +2 -1
  245. package/src/components/Model/ModelExplorer.spec.tsx +2 -2
  246. package/src/components/Model/SourcesExplorer.tsx +2 -4
  247. package/src/components/NarrowEditGate.spec.tsx +73 -0
  248. package/src/components/NarrowEditGate.tsx +29 -0
  249. package/src/components/Notebook/Notebook.layout.spec.tsx +94 -0
  250. package/src/components/Notebook/Notebook.tsx +66 -27
  251. package/src/components/Package/NewDocumentDialog.spec.tsx +749 -0
  252. package/src/components/Package/NewDocumentDialog.tsx +401 -0
  253. package/src/components/Package/Package.artifacts.spec.tsx +190 -0
  254. package/src/components/Package/Package.create.spec.tsx +380 -0
  255. package/src/components/Package/Package.notebooks.spec.tsx +18 -0
  256. package/src/components/Package/Package.tsx +366 -171
  257. package/src/components/Package/documentLocation.spec.ts +81 -0
  258. package/src/components/Package/documentLocation.ts +55 -0
  259. package/src/components/Package/index.ts +13 -0
  260. package/src/components/Package/useDocumentLocation.ts +59 -0
  261. package/src/components/PackageSection.tsx +2 -2
  262. package/src/components/RenderedResult/RenderedResult.tsx +18 -1
  263. package/src/components/RenderedResult/ResultContainer.tsx +44 -11
  264. package/src/components/RenderedResult/ResultPanel.tsx +4 -0
  265. package/src/components/RenderedResult/resultSizing.spec.ts +68 -0
  266. package/src/components/RenderedResult/resultSizing.ts +14 -3
  267. package/src/components/ServerProvider.tsx +2 -1
  268. package/src/components/UnsavedChangesDialog.spec.tsx +70 -0
  269. package/src/components/UnsavedChangesDialog.tsx +49 -0
  270. package/src/components/given/GivensPanel.spec.tsx +6 -6
  271. package/src/components/given/GivensPanel.tsx +3 -3
  272. package/src/components/index.ts +2 -0
  273. package/src/hooks/index.ts +3 -0
  274. package/src/hooks/useNarrowScreen.ts +21 -0
  275. package/src/hooks/useQueryResult.ts +16 -0
  276. package/src/hooks/useSettled.spec.ts +41 -0
  277. package/src/hooks/useSettled.ts +27 -0
  278. package/src/mainEntry.spec.ts +145 -0
  279. package/src/text-entry.ts +12 -0
  280. package/src/textEntry.spec.ts +118 -0
  281. package/src/utils/clock.spec.ts +12 -0
  282. package/src/utils/clock.ts +6 -0
  283. package/vite.config.ts +4 -0
  284. package/dist/Dashboard-ChyylkTD.cjs.js +0 -136
  285. package/dist/RenderedResult-AJPMUkAD.cjs.js +0 -135
  286. package/dist/ServerProvider-CXrOKD6g.cjs.js +0 -1
  287. package/dist/components/DashboardBuilder/useTileResize.d.ts +0 -29
  288. package/dist/components/Package/NewDashboardDialog.d.ts +0 -18
  289. package/src/components/DashboardBuilder/useTileResize.spec.tsx +0 -121
  290. package/src/components/DashboardBuilder/useTileResize.ts +0 -110
  291. package/src/components/Package/NewDashboardDialog.spec.tsx +0 -129
  292. package/src/components/Package/NewDashboardDialog.tsx +0 -265
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../text-entry-BJwltZiy.cjs.js");exports.artifactTag=e.artifactTag;exports.canRetryRequest=e.canRetryRequest;exports.splitSourceLines=e.splitSourceLines;
@@ -0,0 +1,2 @@
1
+ export * from '../text-entry'
2
+ export {}
@@ -0,0 +1,6 @@
1
+ import { a as e, n as t, s as r } from "../text-entry-CbbBcZl8.es.js";
2
+ export {
3
+ e as artifactTag,
4
+ t as canRetryRequest,
5
+ r as splitSourceLines
6
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";const y="[A-Za-z_][A-Za-z0-9_]*",S=t=>t.split(/\r\n|\r|\n/),p=t=>new RegExp(`^${y}$`).test(t),v=new Set("accept aggregate calculate calculation connection declare dimension drill except given group_by grouped_by having index join_cross join_many join_one limit measure nest order_by partition_by primary_key query rename run sample select timezone top type view where".split(" ")),T=new Set("all and as asc avg boolean by case cast compose count date day desc distinct else end exclude export extend false filter for from full has hour import in include inner internal is json left like max min minute month not now null number on or pick private public quarter right second source sql string sum table then this timestamp timestamptz to true virtual week when with year".split(" ")),g=t=>p(t)&&!T.has(t.toLowerCase()),E=t=>g(t)&&!v.has(t.toLowerCase()),L=t=>p(t)&&!g(t)?`\`${t}\``:t;function h(t){const o=/^##\|?(?:[ \t\r\n]|$)/.exec(t);if(!o)return!1;const n=/[0-9A-Za-z_\u00C0-\u024F\u1E00-\u1EFF]+/y;let r=0,s="";for(let e=o[0].length;e<t.length;e++){const i=t[e];if(/\s/.test(i))continue;if(t.startsWith("-...",e)){e+=3,s="";continue}n.lastIndex=e;const l=n.exec(t)?.[0];if(i==='"'||i==="'"){const c=t.startsWith(i.repeat(3),e)?i.repeat(3):i;for(e+=c.length;e<t.length&&!t.startsWith(c,e);)e+=t[e]==="\\"?2:1;e+=c.length-1}else if(i==="`"){let c=e+1;for(;c<t.length&&t[c]!=="`"&&t[c]!==`
2
+ `;)c+=t[c]==="\\"?2:1;const f=t.slice(e+1,c);if(r===0&&f==="artifact"&&!/[=.-]/.test(s))return!0;e=c}else if(i==="#"){const c=t.indexOf(`
3
+ `,e);if(c<0)return!1;e=c;continue}else if(i==="{"||i==="[")r++;else if(i==="}"||i==="]")r--;else if(l){if(r===0&&l==="artifact"&&!/[=.-]/.test(s))return!0;e+=l.length-1}s=i}return!1}function w(t){const o=t.trim().split(/[ \t\r]/,1)[0],n=/^(#{1,2})(\|?)(?:\(markdown\)|<markdown>|\[markdown\]|\{markdown\})$/.exec(o);return n?{level:n[1].length,block:n[2]==="|"}:void 0}function N(t,o,n){const r=/^[ \t]*/.exec(t)[0].length;if(o!==void 0&&r!==o)return!1;const s=t.slice(r);return s.startsWith(n)&&(n!=="|#"||s.charAt(2)!=="#")}function d(t,o){const n=new Map;t.forEach((e,i)=>{const l=/^[ \t]*/.exec(e)?.[0].length??0;for(const c of["|##","|#"])if(N(e,l,c)){const f=`${l}${c}`,m=n.get(f);m?m.push(i):n.set(f,[i]);break}});const r=new Map,s=[];for(let e=0;e<t.length;e++){if(o?.(e))continue;const i=/^([ \t]*)(#{1,2})\|/.exec(t[e]);if(!i)continue;const l=`${i[1].length}${i[2]==="#"?"|#":"|##"}`,c=n.get(l)??[];let f=r.get(l)??0;for(;f<c.length&&c[f]<=e;)f++;r.set(l,f),f<c.length&&(s.push([e,c[f]]),e=c[f])}return s}function b(t){const o=new Set;for(const[n,r]of d(t))for(let s=n;s<=r;s++)o.add(s);return o}function $(t,o){const n=new Set,r=new Set;for(const[s,e]of d(t,o)){const i=w(t[s])?.level===1;for(let l=s;l<=e;l++)r.add(l),i&&n.add(l)}return t.forEach((s,e)=>{if(r.has(e)||o?.(e))return;const i=w(s);i?.level===1&&!i.block&&n.add(e)}),n}function x(t){const o=b(t),n=t.findIndex((s,e)=>!o.has(e)&&!/^\s*##\|/.test(s)&&h(s.trim())),r=d(t).find(([s,e])=>h(t.slice(s,e).join(`
4
+ `).trim()));return r&&(n<0||r[0]<n)?{from:r[0],to:r[1],block:!0,text:t.slice(r[0],r[1]).join(`
5
+ `)}:n<0?void 0:{from:n,to:n,block:!1,text:t[n]}}const R=t=>/^\s*##(?:\|\s*|[ \t]*)artifact\b/.test(t),I="The `artifact` property is not the first on its tag, so the builder cannot rewrite the tag without risking the properties before it. Move `artifact { … }` first on the tag to edit this file here.",A=t=>x(t)?.from??-1,z=t=>t.replace(/^\s*##\|?\s*/,"# "),B=/^##"([ \t]|$)/;function O(t){const o=A(t),n=b(t),r=a=>o<0||a<o,s=a=>o>=0&&a>o,e=[];t.forEach((a,u)=>{!n.has(u)&&B.test(a.trim())&&e.push({at:u,text:a.trim().slice(3).trim(),block:!1})});for(const[a,u]of d(t)){if(!/^[ \t]*##\|"([ \t]|$)/.test(t[a]))continue;const k=[t[a].trim().slice(4),...t.slice(a+1,u)].map(_=>_.trim()).join(`
6
+ `).trim();k.length>0&&e.push({at:a,text:k,block:!0})}e.sort((a,u)=>a.at-u.at);const i=e.filter(a=>r(a.at)),l=e.filter(a=>s(a.at)),c=i.some(a=>a.text.trim())?i:l,f=c.map(a=>a.text).join(`
7
+ `),m=a=>a.filter(u=>!u.block).map(u=>u.at);return{read:m(c),blankAbove:c===l?m(i):[],below:m(l),belowBlock:l.some(a=>a.block),inBlock:c.some(a=>a.block),...f.trim()?{text:f}:{}}}const j=/^[A-Za-z_][A-Za-z0-9_]*$/;function F(t){const o=t.trim(),n=o.split(/[ \t\r]/,1)[0],r=/^##\|(?:\((markdown|text)\)|<(markdown|text)>|\[(markdown|text)\]|\{(markdown|text)\})$/.exec(n);if(!r)return;const s=o.slice(n.length).trim();return{route:r[1]??r[2]??r[3]??r[4],rest:s,...j.test(s)?{name:s}:{}}}function Z(t){const o=(t??"").split("->").map(e=>e.trim());if(o.length!==2)return;const n=o[1].indexOf("+"),r=n<0?o[1]:o[1].slice(0,n).trim(),s=n<0?void 0:o[1].slice(n).trim();return{source:o[0],view:r,...s===void 0?{}:{refinement:s}}}const C=t=>/^`([A-Za-z_][A-Za-z0-9_]*)`$/.test(t)?t.slice(1,-1):t,P=new Set([401,403,404]);function W(t){const o=t,n=o?.response?.status??o?.status;return typeof n!="number"||!P.has(n)}exports.ARTIFACT_NOT_FIRST=I;exports.artifactLeads=R;exports.artifactLine=A;exports.artifactTag=x;exports.blockSpans=d;exports.canRetryRequest=W;exports.descriptionNotes=O;exports.isBareName=g;exports.isIdentifier=p;exports.isStrictName=E;exports.malloyPath=L;exports.markdownLines=$;exports.readPath=C;exports.setsArtifactProperty=h;exports.splitSourceLines=S;exports.tagAnnotation=z;exports.textBlockOpener=F;exports.tileSteps=Z;
@@ -0,0 +1,196 @@
1
+ const A = "[A-Za-z_][A-Za-z0-9_]*", N = (t) => t.split(/\r\n|\r|\n/), k = (t) => new RegExp(`^${A}$`).test(t), _ = new Set(
2
+ "accept aggregate calculate calculation connection declare dimension drill except given group_by grouped_by having index join_cross join_many join_one limit measure nest order_by partition_by primary_key query rename run sample select timezone top type view where".split(
3
+ " "
4
+ )
5
+ ), v = new Set(
6
+ "all and as asc avg boolean by case cast compose count date day desc distinct else end exclude export extend false filter for from full has hour import in include inner internal is json left like max min minute month not now null number on or pick private public quarter right second source sql string sum table then this timestamp timestamptz to true virtual week when with year".split(
7
+ " "
8
+ )
9
+ ), w = (t) => k(t) && !v.has(t.toLowerCase()), j = (t) => w(t) && !_.has(t.toLowerCase()), z = (t) => k(t) && !w(t) ? `\`${t}\`` : t;
10
+ function p(t) {
11
+ const s = /^##\|?(?:[ \t\r\n]|$)/.exec(t);
12
+ if (!s) return !1;
13
+ const n = /[0-9A-Za-z_\u00C0-\u024F\u1E00-\u1EFF]+/y;
14
+ let r = 0, o = "";
15
+ for (let e = s[0].length; e < t.length; e++) {
16
+ const i = t[e];
17
+ if (/\s/.test(i)) continue;
18
+ if (t.startsWith("-...", e)) {
19
+ e += 3, o = "";
20
+ continue;
21
+ }
22
+ n.lastIndex = e;
23
+ const l = n.exec(t)?.[0];
24
+ if (i === '"' || i === "'") {
25
+ const c = t.startsWith(i.repeat(3), e) ? i.repeat(3) : i;
26
+ for (e += c.length; e < t.length && !t.startsWith(c, e); )
27
+ e += t[e] === "\\" ? 2 : 1;
28
+ e += c.length - 1;
29
+ } else if (i === "`") {
30
+ let c = e + 1;
31
+ for (; c < t.length && t[c] !== "`" && t[c] !== `
32
+ `; )
33
+ c += t[c] === "\\" ? 2 : 1;
34
+ const f = t.slice(e + 1, c);
35
+ if (r === 0 && f === "artifact" && !/[=.-]/.test(o))
36
+ return !0;
37
+ e = c;
38
+ } else if (i === "#") {
39
+ const c = t.indexOf(`
40
+ `, e);
41
+ if (c < 0) return !1;
42
+ e = c;
43
+ continue;
44
+ } else if (i === "{" || i === "[") r++;
45
+ else if (i === "}" || i === "]") r--;
46
+ else if (l) {
47
+ if (r === 0 && l === "artifact" && !/[=.-]/.test(o))
48
+ return !0;
49
+ e += l.length - 1;
50
+ }
51
+ o = i;
52
+ }
53
+ return !1;
54
+ }
55
+ function g(t) {
56
+ const s = t.trim().split(/[ \t\r]/, 1)[0], n = /^(#{1,2})(\|?)(?:\(markdown\)|<markdown>|\[markdown\]|\{markdown\})$/.exec(
57
+ s
58
+ );
59
+ return n ? { level: n[1].length, block: n[2] === "|" } : void 0;
60
+ }
61
+ function y(t, s, n) {
62
+ const r = /^[ \t]*/.exec(t)[0].length;
63
+ if (s !== void 0 && r !== s) return !1;
64
+ const o = t.slice(r);
65
+ return o.startsWith(n) && (n !== "|#" || o.charAt(2) !== "#");
66
+ }
67
+ function d(t, s) {
68
+ const n = /* @__PURE__ */ new Map();
69
+ t.forEach((e, i) => {
70
+ const l = /^[ \t]*/.exec(e)?.[0].length ?? 0;
71
+ for (const c of ["|##", "|#"])
72
+ if (y(e, l, c)) {
73
+ const f = `${l}${c}`, m = n.get(f);
74
+ m ? m.push(i) : n.set(f, [i]);
75
+ break;
76
+ }
77
+ });
78
+ const r = /* @__PURE__ */ new Map(), o = [];
79
+ for (let e = 0; e < t.length; e++) {
80
+ if (s?.(e)) continue;
81
+ const i = /^([ \t]*)(#{1,2})\|/.exec(t[e]);
82
+ if (!i) continue;
83
+ const l = `${i[1].length}${i[2] === "#" ? "|#" : "|##"}`, c = n.get(l) ?? [];
84
+ let f = r.get(l) ?? 0;
85
+ for (; f < c.length && c[f] <= e; ) f++;
86
+ r.set(l, f), f < c.length && (o.push([e, c[f]]), e = c[f]);
87
+ }
88
+ return o;
89
+ }
90
+ function b(t) {
91
+ const s = /* @__PURE__ */ new Set();
92
+ for (const [n, r] of d(t))
93
+ for (let o = n; o <= r; o++) s.add(o);
94
+ return s;
95
+ }
96
+ function I(t, s) {
97
+ const n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
98
+ for (const [o, e] of d(t, s)) {
99
+ const i = g(t[o])?.level === 1;
100
+ for (let l = o; l <= e; l++)
101
+ r.add(l), i && n.add(l);
102
+ }
103
+ return t.forEach((o, e) => {
104
+ if (r.has(e) || s?.(e)) return;
105
+ const i = g(o);
106
+ i?.level === 1 && !i.block && n.add(e);
107
+ }), n;
108
+ }
109
+ function E(t) {
110
+ const s = b(t), n = t.findIndex(
111
+ (o, e) => !s.has(e) && // An unclosed `##|` opener holds no block, so it is no tag either.
112
+ !/^\s*##\|/.test(o) && p(o.trim())
113
+ ), r = d(t).find(
114
+ ([o, e]) => p(t.slice(o, e).join(`
115
+ `).trim())
116
+ );
117
+ return r && (n < 0 || r[0] < n) ? {
118
+ from: r[0],
119
+ to: r[1],
120
+ block: !0,
121
+ text: t.slice(r[0], r[1]).join(`
122
+ `)
123
+ } : n < 0 ? void 0 : { from: n, to: n, block: !1, text: t[n] };
124
+ }
125
+ const R = (t) => /^\s*##(?:\|\s*|[ \t]*)artifact\b/.test(t), B = "The `artifact` property is not the first on its tag, so the builder cannot rewrite the tag without risking the properties before it. Move `artifact { … }` first on the tag to edit this file here.", S = (t) => E(t)?.from ?? -1, O = (t) => t.replace(/^\s*##\|?\s*/, "# "), T = /^##"([ \t]|$)/;
126
+ function Z(t) {
127
+ const s = S(t), n = b(t), r = (a) => s < 0 || a < s, o = (a) => s >= 0 && a > s, e = [];
128
+ t.forEach((a, u) => {
129
+ !n.has(u) && T.test(a.trim()) && e.push({ at: u, text: a.trim().slice(3).trim(), block: !1 });
130
+ });
131
+ for (const [a, u] of d(t)) {
132
+ if (!/^[ \t]*##\|"([ \t]|$)/.test(t[a])) continue;
133
+ const h = [t[a].trim().slice(4), ...t.slice(a + 1, u)].map((x) => x.trim()).join(`
134
+ `).trim();
135
+ h.length > 0 && e.push({ at: a, text: h, block: !0 });
136
+ }
137
+ e.sort((a, u) => a.at - u.at);
138
+ const i = e.filter((a) => r(a.at)), l = e.filter((a) => o(a.at)), c = i.some((a) => a.text.trim()) ? i : l, f = c.map((a) => a.text).join(`
139
+ `), m = (a) => a.filter((u) => !u.block).map((u) => u.at);
140
+ return {
141
+ read: m(c),
142
+ blankAbove: c === l ? m(i) : [],
143
+ below: m(l),
144
+ belowBlock: l.some((a) => a.block),
145
+ inBlock: c.some((a) => a.block),
146
+ ...f.trim() ? { text: f } : {}
147
+ };
148
+ }
149
+ const $ = /^[A-Za-z_][A-Za-z0-9_]*$/;
150
+ function F(t) {
151
+ const s = t.trim(), n = s.split(/[ \t\r]/, 1)[0], r = /^##\|(?:\((markdown|text)\)|<(markdown|text)>|\[(markdown|text)\]|\{(markdown|text)\})$/.exec(
152
+ n
153
+ );
154
+ if (!r) return;
155
+ const o = s.slice(n.length).trim();
156
+ return {
157
+ route: r[1] ?? r[2] ?? r[3] ?? r[4],
158
+ rest: o,
159
+ ...$.test(o) ? { name: o } : {}
160
+ };
161
+ }
162
+ function W(t) {
163
+ const s = (t ?? "").split("->").map((e) => e.trim());
164
+ if (s.length !== 2) return;
165
+ const n = s[1].indexOf("+"), r = n < 0 ? s[1] : s[1].slice(0, n).trim(), o = n < 0 ? void 0 : s[1].slice(n).trim();
166
+ return {
167
+ source: s[0],
168
+ view: r,
169
+ ...o === void 0 ? {} : { refinement: o }
170
+ };
171
+ }
172
+ const C = (t) => /^`([A-Za-z_][A-Za-z0-9_]*)`$/.test(t) ? t.slice(1, -1) : t, L = /* @__PURE__ */ new Set([401, 403, 404]);
173
+ function M(t) {
174
+ const s = t, n = s?.response?.status ?? s?.status;
175
+ return typeof n != "number" || !L.has(n);
176
+ }
177
+ export {
178
+ B as A,
179
+ E as a,
180
+ d as b,
181
+ R as c,
182
+ Z as d,
183
+ O as e,
184
+ W as f,
185
+ S as g,
186
+ k as h,
187
+ j as i,
188
+ w as j,
189
+ z as k,
190
+ p as l,
191
+ I as m,
192
+ M as n,
193
+ C as r,
194
+ N as s,
195
+ F as t
196
+ };
@@ -0,0 +1,2 @@
1
+ export { artifactTag, splitSourceLines, type ArtifactTag, } from './components/DashboardBuilder/malloyText';
2
+ export { canRetryRequest } from './components/DocumentCreate/canRetry';
@@ -0,0 +1,2 @@
1
+ /** A monotonic clock in milliseconds, for durations. */
2
+ export declare const now: () => number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@malloy-publisher/sdk",
3
3
  "description": "Malloy Publisher SDK",
4
- "version": "0.9.1",
4
+ "version": "0.9.2",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.es.js",
@@ -16,6 +16,9 @@
16
16
  ],
17
17
  "client/*": [
18
18
  "dist/client/*.d.ts"
19
+ ],
20
+ "text": [
21
+ "dist/text-entry.d.ts"
19
22
  ]
20
23
  }
21
24
  },
@@ -38,6 +41,12 @@
38
41
  "require": "./dist/builder/index.cjs.js",
39
42
  "default": "./dist/builder/index.es.js"
40
43
  },
44
+ "./text": {
45
+ "types": "./dist/text-entry.d.ts",
46
+ "import": "./dist/text/index.es.js",
47
+ "require": "./dist/text/index.cjs.js",
48
+ "default": "./dist/text/index.es.js"
49
+ },
41
50
  "./client/*": {
42
51
  "types": "./dist/client/*.d.ts",
43
52
  "import": "./dist/client/*.js",
@@ -30,6 +30,10 @@ export {
30
30
  DashboardEditor,
31
31
  type DashboardEditorProps,
32
32
  } from "./components/DashboardBuilder/DashboardEditor";
33
+ export type {
34
+ SaveContext,
35
+ SaveHandler,
36
+ } from "./components/DashboardBuilder/useDocumentEditor";
33
37
  export type {
34
38
  DashboardDocument,
35
39
  DashboardTile,
@@ -53,3 +57,34 @@ export type {
53
57
  DashboardEvent,
54
58
  DashboardEventHandler,
55
59
  } from "./components/Dashboard/telemetry";
60
+ export {
61
+ NotebookEditor,
62
+ type NotebookEditorProps,
63
+ } from "./components/DashboardBuilder/NotebookEditor";
64
+ export type {
65
+ BuilderEvent,
66
+ NotebookEvent,
67
+ NotebookEventHandler,
68
+ } from "./components/DashboardBuilder/telemetry";
69
+ export {
70
+ createDocument,
71
+ createRoute,
72
+ documentPathFor,
73
+ documentPathForTitle,
74
+ locatorFor,
75
+ MAX_SLUG_ATTEMPTS,
76
+ newDashboardSource,
77
+ newDocumentProblem,
78
+ newNotebookSource,
79
+ slugFor,
80
+ slugOrFallback,
81
+ useDocumentChoices,
82
+ type CreatedDocument,
83
+ type CreateDocumentOptions,
84
+ type CreateTarget,
85
+ type DashboardCreatedEvent,
86
+ type DocumentChoice,
87
+ type DocumentCreatedEvent,
88
+ type NewDocument,
89
+ type NotebookCreatedEvent,
90
+ } from "./components/DocumentCreate";
@@ -1,35 +1,21 @@
1
1
  // Copyright (c) Credible Data Inc.
2
2
  // SPDX-License-Identifier: MIT
3
3
 
4
- import { Alert, Box, Stack, Typography } from "@mui/material";
5
- import { useCallback, useMemo, useState } from "react";
6
- import type { DashboardManifest } from "../../client";
7
- import { useDocumentControls } from "../../hooks/useDocumentControls";
4
+ import { Alert } from "@mui/material";
8
5
  import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
9
6
  import { parseResourceUri } from "../../utils/formatting";
10
7
  import { ApiErrorDisplay } from "../ApiErrorDisplay";
11
- import {
12
- useDrill,
13
- type DrillBinding,
14
- type DrillClickPayload,
15
- type DrillNavigation,
16
- type DrillRowsRequest,
17
- } from "../drill";
18
- import { GivensPanel } from "../given";
19
- import { Prose } from "../Prose";
20
- import { givensToParams, givensToRequest } from "../given/paramCodec";
8
+ import type { DrillNavigation } from "../drill";
21
9
  import { Loading } from "../Loading";
22
- import { TILE_MAX_HEIGHT } from "../RenderedResult/resultSizing";
23
10
  import { useServer } from "../ServerProvider";
24
- import { DashboardGrid, DEFAULT_COLUMNS } from "./DashboardGrid";
25
- import { DashboardTile } from "./DashboardTile";
26
- import { ExploreDialog } from "./ExploreDialog";
27
- import { RowsDialog, stepsOf, type RowsRequest } from "./RowsDialog";
11
+ import { DashboardView } from "./DashboardView";
28
12
  import type { DashboardEventHandler } from "./telemetry";
13
+ import type { TileChrome } from "./TileCard";
29
14
 
30
15
  // The grid rule moved to `DashboardGrid`, which the builder shares.
31
16
  // Re-exported so existing importers of it are unaffected.
32
17
  export { DEFAULT_COLUMNS, tileGridColumn } from "./DashboardGrid";
18
+ export { DashboardProse } from "./DashboardView";
33
19
 
34
20
  export interface DashboardProps {
35
21
  /** `publisher://environments/{env}/packages/{pkg}`, optionally `?versionId=`. */
@@ -74,6 +60,11 @@ export interface DashboardProps {
74
60
  maxResultSize?: number;
75
61
  /** The rows shown and tiles explored, for the host to log or count. */
76
62
  onEvent?: DashboardEventHandler;
63
+ /**
64
+ * `card` (default) draws each tile as a panel; `none` draws them bare, a
65
+ * document that reads top to bottom.
66
+ */
67
+ chrome?: TileChrome;
77
68
  }
78
69
 
79
70
  /**
@@ -94,17 +85,14 @@ export function Dashboard({
94
85
  height,
95
86
  maxResultSize,
96
87
  onEvent,
88
+ chrome,
97
89
  }: DashboardProps) {
98
90
  const parsed = parseResourceUri(resourceUri);
99
91
  const { apiClients } = useServer();
100
92
 
101
- // Degraded, not thrown. `Notebook`, `Model` and `Package` all let a bad URI
102
- // fail into an error display; a throw in the render body takes the host's
103
- // whole tree down with it instead, which is a white screen rather than a
104
- // message. The Console cannot reach this, because `DashboardPage` builds the
105
- // URI from params `ModelPage` has already guarded, so the only caller a throw
106
- // could punish is the embedding host the docs invite. Reported below rather
107
- // than here, so every hook still runs in the same order.
93
+ // Degraded, not thrown: a throw in the render body takes the embedding
94
+ // host's whole tree down with it, which is a white screen rather than a
95
+ // message.
108
96
  const environmentName = parsed.environmentName ?? "";
109
97
  const packageName = parsed.packageName ?? "";
110
98
  const versionId = parsed.versionId;
@@ -139,81 +127,6 @@ export function Dashboard({
139
127
  });
140
128
  const manifest = manifestResponse?.data;
141
129
 
142
- const specs = useMemo(() => manifest?.givens ?? [], [manifest]);
143
-
144
- // The control row's state, options and `to=self` drill: the same hook the
145
- // notebook uses, so a control behaves identically on both surfaces.
146
- const controls = useDocumentControls({
147
- specs,
148
- loaded: isSuccess,
149
- startingValues: manifest?.startingGivens,
150
- params: givens,
151
- onGivensChange,
152
- // Which document these edits belong to, version included: two
153
- // dashboards whose starting values coincide (both empty, usually)
154
- // would otherwise look like one document, and the one you came from
155
- // would keep filtering the one you drilled into. Only the EDITS: a host
156
- // that round-trips givens through its own URL hands them straight back,
157
- // and they still apply across the swap.
158
- documentKey: `${environmentName}/${packageName}/${versionId ?? ""}/${dashboard}`,
159
- // Absent means autorun; only an explicit `autorun=false` batches.
160
- autorun: manifest?.autorun !== false,
161
- environmentName,
162
- packageName,
163
- modelPath: manifest?.path,
164
- versionId,
165
- documentName: dashboard,
166
- });
167
- const { applied, declaredTypes, canSelf, onSelf } = controls;
168
-
169
- // The rows behind a clicked value, and a tile's query in the explorer —
170
- // the two ways past a number. Composite tiles only: each names its
171
- // source, which is what the rows are of and what the explorer opens on.
172
- const [rows, setRows] = useState<RowsRequest | undefined>(undefined);
173
- const [exploring, setExploring] = useState<string | undefined>(undefined);
174
- const onRows = useCallback((request: DrillRowsRequest) => {
175
- const steps = stepsOf(request.context);
176
- if (steps === undefined) return;
177
- setRows({
178
- ...steps,
179
- field: request.field,
180
- rawValue: request.rawValue,
181
- label: request.label,
182
- });
183
- }, []);
184
-
185
- // The whole applied row: a source's own `where:` may read any of it, and a
186
- // given the rows query does not reference is ignored by the server.
187
- const rowsGivens = useMemo(
188
- () => givensToRequest(applied, declaredTypes),
189
- [applied, declaredTypes],
190
- );
191
-
192
- // The explorer's controls take the URL-string form, not the request form.
193
- const exploreGivens = useMemo(
194
- () => givensToParams(applied, declaredTypes),
195
- [applied, declaredTypes],
196
- );
197
-
198
- const { drill, drillMenu } = useDrill({
199
- onNavigate,
200
- onSelf,
201
- canSelf,
202
- selfLabel: "Filter this dashboard",
203
- onRows,
204
- });
205
- // Each tile's clicks carry the tile they came from, so the rows behind a
206
- // value know which source to run against.
207
- const drillFor = useCallback(
208
- (tile: string): DrillBinding => ({
209
- canDrill: drill.canDrill,
210
- onClick: (payload: DrillClickPayload) =>
211
- drill.onClick({ ...payload, context: tile }),
212
- }),
213
- [drill],
214
- );
215
-
216
- // After every hook, so the hook order does not depend on the URI.
217
130
  if (!uriNamesBoth) {
218
131
  return (
219
132
  <Alert severity="error">
@@ -235,186 +148,22 @@ export function Dashboard({
235
148
  return <Loading text="Loading dashboard…" />;
236
149
  }
237
150
 
238
- // Reachable on the in-process load path only. Production loads a package
239
- // through the worker pool, which aborts the package on the first compile
240
- // error, so an uncompilable file answers 424 everywhere rather than serving a
241
- // per-file error. Measured on this base with one bad file: the package
242
- // endpoint, the dashboards listing, and the manifest of a dashboard that was
243
- // FINE all answered 424. The earlier note here said such a dashboard "still
244
- // lists and still resolves", which contradicted this repo's own docs and was
245
- // the wrong half of the pair. Kept because the per-file error manifest still
246
- // exists and an empty frame would be worse than saying why.
247
- if (manifest.error) {
248
- return (
249
- <Stack spacing={2}>
250
- <DashboardHeader manifest={manifest} />
251
- <Alert severity="error">{manifest.error}</Alert>
252
- </Stack>
253
- );
254
- }
255
-
256
- const modelPath = manifest.path;
257
- const tiles = manifest.tiles ?? [];
258
- const columns = manifest.dashboardColumns ?? DEFAULT_COLUMNS;
259
-
260
151
  return (
261
- <Stack spacing={2}>
262
- <DashboardHeader manifest={manifest} />
263
-
264
- <GivensPanel {...controls.panel} layout="bar" />
265
-
266
- {modelPath === undefined ? (
267
- <Alert severity="error">
268
- This dashboard has no model path, so there is nothing to run.
269
- </Alert>
270
- ) : manifest.query !== undefined ? (
271
- // Single-query form: one query whose result IS the dashboard. Its
272
- // `# dashboard {columns=N}` tag is the renderer's business, so no
273
- // grid is imposed here: doing so would nest a grid in a grid.
274
- <DashboardTile
275
- environmentName={environmentName}
276
- packageName={packageName}
277
- versionId={versionId}
278
- modelPath={modelPath}
279
- queryName={manifest.query}
280
- givens={applied}
281
- declaredTypes={declaredTypes}
282
- height={height}
283
- maxResultSize={maxResultSize}
284
- drill={drill}
285
- />
286
- ) : tiles.length > 0 ? (
287
- // Composite form: each tile runs on its own and the results are
288
- // combined into one grid here, since no single Malloy result spans
289
- // them.
290
- <DashboardGrid
291
- tiles={tiles}
292
- columns={columns}
293
- // Position too, not the expression alone: `tiles=[…]` can repeat
294
- // one, which is a typo rather than a request for two identical
295
- // panels, and keying on the expression made the duplicate warn
296
- // and reconcile onto its twin.
297
- keyOf={(tile, index) => `${index}:${tile.query}`}
298
- renderTile={(tile) => (
299
- <DashboardTile
300
- environmentName={environmentName}
301
- packageName={packageName}
302
- versionId={versionId}
303
- modelPath={modelPath}
304
- tile={tile.query}
305
- label={tile.label}
306
- subtitle={tile.subtitle}
307
- borderless={tile.borderless}
308
- givens={applied}
309
- declaredTypes={declaredTypes}
310
- givenNames={tile.givenNames}
311
- height={height ?? TILE_MAX_HEIGHT}
312
- maxResultSize={maxResultSize}
313
- drill={drillFor(tile.query)}
314
- onExplore={() => {
315
- setExploring(tile.query);
316
- onEvent?.({
317
- type: "dashboard.explored",
318
- tile: tile.query,
319
- });
320
- }}
321
- />
322
- )}
323
- />
324
- ) : (
325
- <Alert severity="warning">
326
- This dashboard names neither a query nor any tiles.
327
- </Alert>
328
- )}
329
-
330
- {drillMenu}
331
- {modelPath !== undefined && (
332
- <>
333
- <RowsDialog
334
- request={rows}
335
- environmentName={environmentName}
336
- packageName={packageName}
337
- {...(versionId === undefined ? {} : { versionId })}
338
- modelPath={modelPath}
339
- givens={rowsGivens}
340
- onClose={() => setRows(undefined)}
341
- onDone={(ok, durationMs) => {
342
- if (rows)
343
- onEvent?.({
344
- type: "dashboard.rows_shown",
345
- source: rows.source,
346
- view: rows.view,
347
- field: rows.field,
348
- ok,
349
- durationMs,
350
- });
351
- }}
352
- />
353
- <ExploreDialog
354
- tile={exploring}
355
- environmentName={environmentName}
356
- packageName={packageName}
357
- {...(versionId === undefined ? {} : { versionId })}
358
- modelPath={modelPath}
359
- givens={exploreGivens}
360
- onClose={() => setExploring(undefined)}
361
- />
362
- </>
363
- )}
364
- </Stack>
365
- );
366
- }
367
-
368
- /**
369
- * The dashboard's prose header: its title, and the description as MARKDOWN.
370
- *
371
- * A description comes from the file's model-level doc comment (`##"` lines),
372
- * and Malloy carries a whole block of them through with its newlines and blank
373
- * lines intact — measured: `'## Why this page exists\nRevenue is up but margin
374
- * is flat.\n\nThe tile below says where it went.'` reaches the manifest exactly
375
- * like that. Rendering it as a plain `Typography` collapsed all of that onto
376
- * one unstyled line, so a dashboard could already carry a narrative header and
377
- * was throwing it away at the last step.
378
- *
379
- * Markdown here and not in a tile: prose BETWEEN tiles needs a tile kind the
380
- * format cannot express yet. This is the half that needs nothing new.
381
- */
382
- function DashboardHeader({ manifest }: { manifest: DashboardManifest }) {
383
- return (
384
- <DashboardProse
385
- title={manifest.title ?? manifest.name}
386
- {...(manifest.description
387
- ? { description: manifest.description }
388
- : {})}
152
+ <DashboardView
153
+ manifest={manifest}
154
+ environmentName={environmentName}
155
+ packageName={packageName}
156
+ versionId={versionId}
157
+ documentName={dashboard}
158
+ givens={givens}
159
+ onGivensChange={onGivensChange}
160
+ onNavigate={onNavigate}
161
+ height={height}
162
+ maxResultSize={maxResultSize}
163
+ onEvent={onEvent}
164
+ chrome={chrome}
389
165
  />
390
166
  );
391
167
  }
392
168
 
393
- /**
394
- * The prose header itself, over the two fields it actually needs.
395
- *
396
- * Separate from {@link DashboardHeader} so the BUILDER can render the same
397
- * header over a `DashboardDocument` — which carries `title` and `description`
398
- * but is not a manifest. Same argument as {@link tileGridColumn}: what the
399
- * builder shows a author is the thing a reader will see, and one component is
400
- * what stops the two drifting. A builder that restated this markdown block
401
- * would be one edit away from showing a different header than it writes.
402
- */
403
- export function DashboardProse({
404
- title,
405
- description,
406
- }: {
407
- title: string;
408
- description?: string;
409
- }) {
410
- return (
411
- <Box>
412
- <Typography variant="h5" sx={{ fontWeight: 600 }}>
413
- {title}
414
- </Typography>
415
- {description && <Prose variant="caption">{description}</Prose>}
416
- </Box>
417
- );
418
- }
419
-
420
169
  export default Dashboard;