@malloy-publisher/sdk 0.9.7 → 0.9.8

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 (350) hide show
  1. package/README.md +117 -17
  2. package/dist/{RenderedResult-qnpbr4tc.cjs.js → RenderedResult-BrvrMDAP.cjs.js} +1 -1
  3. package/dist/{RenderedResult-CkUS04tl.es.js → RenderedResult-DZj-FnOJ.es.js} +2 -2
  4. package/dist/{ServerProvider-DnLLeXEX.es.js → ServerProvider-B_bPAsu2.es.js} +583 -398
  5. package/dist/ServerProvider-DuEOzwPc.cjs.js +1 -0
  6. package/dist/builder/index.cjs.js +93 -93
  7. package/dist/builder/index.es.js +4630 -4562
  8. package/dist/builder-entry.d.ts +13 -12
  9. package/dist/client/api.d.ts +472 -94
  10. package/dist/client/index.cjs.js +1 -1
  11. package/dist/client/index.es.js +105 -95
  12. package/dist/components/Dashboard/DashboardTile.d.ts +3 -1
  13. package/dist/components/Dashboard/DashboardView.d.ts +1 -3
  14. package/dist/components/Dashboard/index.d.ts +0 -2
  15. package/dist/components/DocumentCreate/createDocument.d.ts +29 -9
  16. package/dist/components/DocumentCreate/documentPath.d.ts +21 -6
  17. package/dist/components/DocumentCreate/guards.d.ts +2 -3
  18. package/dist/components/DocumentCreate/index.d.ts +2 -3
  19. package/dist/components/DocumentCreate/newNotebook.d.ts +14 -5
  20. package/dist/components/DocumentStorage/BrowserDocumentStorage.d.ts +6 -0
  21. package/dist/components/DocumentStorage/DocumentStorage.d.ts +52 -24
  22. package/dist/components/Loading.d.ts +1 -1
  23. package/dist/components/Package/DataSchemaDialog.d.ts +26 -0
  24. package/dist/components/Package/NewDocumentDialog.d.ts +19 -10
  25. package/dist/components/Package/Package.d.ts +14 -9
  26. package/dist/components/Package/documentLocation.d.ts +66 -23
  27. package/dist/components/Package/index.d.ts +3 -2
  28. package/dist/components/Package/reportQueries.d.ts +8 -0
  29. package/dist/components/Package/useDocumentLocation.d.ts +36 -6
  30. package/dist/components/Package/useDraftLayout.d.ts +20 -0
  31. package/dist/components/Report/CellReport.d.ts +89 -0
  32. package/dist/components/Report/LinearReport.d.ts +18 -0
  33. package/dist/components/Report/Report.d.ts +62 -0
  34. package/dist/components/Report/index.d.ts +2 -0
  35. package/dist/components/Report/telemetry.d.ts +163 -0
  36. package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderDialogs.d.ts +2 -2
  37. package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderGrid.d.ts +2 -2
  38. package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderHeader.d.ts +5 -4
  39. package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderToolbar.d.ts +5 -1
  40. package/dist/components/{DashboardBuilder → ReportBuilder}/EditorSurface.d.ts +10 -7
  41. package/dist/components/{DashboardBuilder/DashboardBuilder.d.ts → ReportBuilder/ReportBuilder.d.ts} +17 -8
  42. package/dist/components/{DashboardBuilder/DashboardEditor.d.ts → ReportBuilder/ReportEditor.d.ts} +41 -14
  43. package/dist/components/ReportBuilder/builderReport.d.ts +14 -0
  44. package/dist/components/{DashboardBuilder → ReportBuilder}/catalog.d.ts +8 -5
  45. package/dist/components/{DashboardBuilder → ReportBuilder}/document.d.ts +3 -4
  46. package/dist/components/{DashboardBuilder → ReportBuilder}/documentSession.d.ts +1 -1
  47. package/dist/components/{DashboardBuilder → ReportBuilder}/imports.d.ts +5 -1
  48. package/dist/components/{DashboardBuilder → ReportBuilder}/malloyTree.d.ts +9 -0
  49. package/dist/components/{DashboardBuilder → ReportBuilder}/newDashboard.d.ts +7 -1
  50. package/dist/components/{DashboardBuilder → ReportBuilder}/readDocument.d.ts +7 -5
  51. package/dist/components/{DashboardBuilder → ReportBuilder}/readForEditor.d.ts +1 -1
  52. package/dist/components/ReportBuilder/reportTag.d.ts +52 -0
  53. package/dist/components/{DashboardBuilder → ReportBuilder}/spliceDocument.d.ts +1 -7
  54. package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderSelection.d.ts +2 -2
  55. package/dist/components/{DashboardBuilder → ReportBuilder}/useControlBindings.d.ts +2 -2
  56. package/dist/components/ReportBuilder/useEditorCatalog.d.ts +25 -0
  57. package/dist/components/{DashboardBuilder → ReportBuilder}/useHostCopy.d.ts +5 -3
  58. package/dist/components/{DashboardBuilder → ReportBuilder}/useOpenedDocument.d.ts +7 -5
  59. package/dist/components/{DashboardBuilder/useDashboardEditor.d.ts → ReportBuilder/useReportEditor.d.ts} +3 -7
  60. package/dist/components/{DashboardBuilder → ReportBuilder}/useSaveChannel.d.ts +6 -4
  61. package/dist/components/{DashboardBuilder → ReportBuilder}/useTileEditing.d.ts +2 -2
  62. package/dist/components/ServerProvider.d.ts +2 -1
  63. package/dist/components/drill/resolveDrill.d.ts +8 -1
  64. package/dist/components/drill/useDrillSelf.d.ts +4 -2
  65. package/dist/components/index.d.ts +2 -1
  66. package/dist/components/{Dashboard → legacy}/Dashboard.d.ts +15 -9
  67. package/dist/components/legacy/MalloynbCells.d.ts +13 -0
  68. package/dist/components/legacy/Notebook.d.ts +15 -0
  69. package/dist/components/{DashboardBuilder → legacy}/NotebookEditor.d.ts +3 -3
  70. package/dist/components/legacy/builderNames.d.ts +10 -0
  71. package/dist/components/legacy/index.d.ts +11 -0
  72. package/dist/components/legacy/kindAdapter.d.ts +11 -0
  73. package/dist/components/legacy/kindTypedDrafts.d.ts +10 -0
  74. package/dist/components/legacy/nameAlias.d.ts +44 -0
  75. package/dist/components/legacy/queryKeys.d.ts +8 -0
  76. package/dist/index.cjs.js +19 -19
  77. package/dist/index.es.js +7984 -7452
  78. package/dist/text/index.es.js +2 -2
  79. package/dist/{text-entry-CA0LZ1xL.es.js → text-entry-72YFLeNk.es.js} +10 -10
  80. package/dist/useCompiledDocument-oocN5cGE.cjs.js +141 -0
  81. package/dist/{useCompiledDocument-Bf72Ob5v.es.js → useCompiledDocument-x0B2RAH3.es.js} +4593 -4395
  82. package/package.json +2 -2
  83. package/src/builder-entry.ts +32 -24
  84. package/src/components/Dashboard/DashboardTile.tsx +17 -0
  85. package/src/components/Dashboard/DashboardView.spec.tsx +0 -21
  86. package/src/components/Dashboard/DashboardView.tsx +8 -24
  87. package/src/components/Dashboard/dropValueUrlTags.spec.ts +1 -4
  88. package/src/components/Dashboard/index.ts +0 -2
  89. package/src/components/DocumentCreate/createDocument.spec.ts +346 -53
  90. package/src/components/DocumentCreate/createDocument.ts +143 -63
  91. package/src/components/DocumentCreate/documentPath.ts +41 -12
  92. package/src/components/DocumentCreate/guards.ts +7 -15
  93. package/src/components/DocumentCreate/index.ts +3 -7
  94. package/src/components/DocumentCreate/newNotebook.spec.ts +113 -43
  95. package/src/components/DocumentCreate/newNotebook.ts +32 -10
  96. package/src/components/DocumentStorage/BrowserDocumentStorage.spec.ts +130 -28
  97. package/src/components/DocumentStorage/BrowserDocumentStorage.ts +78 -40
  98. package/src/components/DocumentStorage/DocumentStorage.contract.spec.tsx +426 -0
  99. package/src/components/DocumentStorage/DocumentStorage.ts +57 -24
  100. package/src/components/Home/AddEnvironmentDialog.tsx +1 -1
  101. package/src/components/Home/Home.tsx +1 -1
  102. package/src/components/Loading.tsx +1 -1
  103. package/src/components/Model/SourcesExplorer.tsx +1 -1
  104. package/src/components/Notebook/NotebookCell.tsx +6 -5
  105. package/src/components/Notebook/cellKind.spec.ts +15 -7
  106. package/src/components/Package/DataSchemaDialog.spec.tsx +85 -0
  107. package/src/components/Package/DataSchemaDialog.tsx +367 -0
  108. package/src/components/Package/NewDocumentDialog.spec.tsx +145 -88
  109. package/src/components/Package/NewDocumentDialog.tsx +93 -48
  110. package/src/components/Package/Package.artifacts.spec.tsx +79 -60
  111. package/src/components/Package/Package.create.spec.tsx +126 -112
  112. package/src/components/Package/Package.notebooks.spec.tsx +46 -27
  113. package/src/components/Package/Package.spec.tsx +43 -30
  114. package/src/components/Package/Package.tsx +173 -292
  115. package/src/components/Package/documentLocation.spec.ts +145 -50
  116. package/src/components/Package/documentLocation.ts +118 -39
  117. package/src/components/Package/index.ts +12 -3
  118. package/src/components/Package/reportQueries.ts +25 -0
  119. package/src/components/Package/useDocumentLocation.spec.ts +58 -0
  120. package/src/components/Package/useDocumentLocation.ts +90 -32
  121. package/src/components/Package/useDraftLayout.spec.tsx +143 -0
  122. package/src/components/Package/useDraftLayout.ts +81 -0
  123. package/src/components/Prose.spec.tsx +3 -3
  124. package/src/components/RenderedResult/RenderedResult.tsx +1 -1
  125. package/src/components/Report/CellReport.spec.tsx +155 -0
  126. package/src/components/{Notebook/Notebook.tsx → Report/CellReport.tsx} +178 -220
  127. package/src/components/Report/LinearReport.tsx +71 -0
  128. package/src/components/Report/Report.spec.tsx +238 -0
  129. package/src/components/Report/Report.telemetry.spec.tsx +292 -0
  130. package/src/components/Report/Report.tsx +277 -0
  131. package/src/components/Report/index.ts +12 -0
  132. package/src/components/Report/telemetry.spec.ts +90 -0
  133. package/src/components/Report/telemetry.ts +250 -0
  134. package/src/components/{DashboardBuilder → ReportBuilder}/BuilderDialogs.tsx +5 -5
  135. package/src/components/{DashboardBuilder → ReportBuilder}/BuilderGrid.tsx +2 -2
  136. package/src/components/{DashboardBuilder → ReportBuilder}/BuilderHeader.tsx +6 -7
  137. package/src/components/{DashboardBuilder → ReportBuilder}/BuilderToolbar.tsx +33 -0
  138. package/src/components/{DashboardBuilder → ReportBuilder}/DrillDialog.tsx +2 -2
  139. package/src/components/{DashboardBuilder → ReportBuilder}/EditorSurface.tsx +67 -107
  140. package/src/components/{DashboardBuilder → ReportBuilder}/FilterDialog.tsx +3 -4
  141. package/src/components/{DashboardBuilder/DashboardBuilder.charts.spec.tsx → ReportBuilder/ReportBuilder.charts.spec.tsx} +4 -4
  142. package/src/components/{DashboardBuilder/DashboardBuilder.exit.spec.tsx → ReportBuilder/ReportBuilder.exit.spec.tsx} +5 -5
  143. package/src/components/{DashboardBuilder/DashboardBuilder.inline.spec.tsx → ReportBuilder/ReportBuilder.inline.spec.tsx} +4 -4
  144. package/src/components/ReportBuilder/ReportBuilder.layoutSwitch.spec.tsx +145 -0
  145. package/src/components/{DashboardBuilder/DashboardBuilder.notebook.spec.tsx → ReportBuilder/ReportBuilder.notebook.spec.tsx} +22 -21
  146. package/src/components/{DashboardBuilder/DashboardBuilder.openDraft.spec.tsx → ReportBuilder/ReportBuilder.openDraft.spec.tsx} +3 -3
  147. package/src/components/{DashboardBuilder/DashboardBuilder.sources.spec.tsx → ReportBuilder/ReportBuilder.sources.spec.tsx} +19 -8
  148. package/src/components/{DashboardBuilder/DashboardBuilder.spec.tsx → ReportBuilder/ReportBuilder.spec.tsx} +34 -34
  149. package/src/components/{DashboardBuilder/DashboardBuilder.textTiles.spec.tsx → ReportBuilder/ReportBuilder.textTiles.spec.tsx} +5 -5
  150. package/src/components/{DashboardBuilder/DashboardBuilder.tsx → ReportBuilder/ReportBuilder.tsx} +46 -21
  151. package/src/components/{DashboardBuilder/DashboardEditor.authoritative.spec.tsx → ReportBuilder/ReportEditor.authoritative.spec.tsx} +28 -20
  152. package/src/components/{DashboardBuilder/DashboardEditor.emptyStart.spec.tsx → ReportBuilder/ReportEditor.emptyStart.spec.tsx} +19 -11
  153. package/src/components/{DashboardBuilder/DashboardEditor.filterTag.spec.tsx → ReportBuilder/ReportEditor.filterTag.spec.tsx} +7 -7
  154. package/src/components/{DashboardBuilder/DashboardEditor.notebook.spec.tsx → ReportBuilder/ReportEditor.notebook.spec.tsx} +70 -49
  155. package/src/components/{DashboardBuilder/DashboardEditor.package.spec.tsx → ReportBuilder/ReportEditor.package.spec.tsx} +52 -8
  156. package/src/components/{DashboardBuilder/DashboardEditor.resourceUri.spec.tsx → ReportBuilder/ReportEditor.resourceUri.spec.tsx} +50 -18
  157. package/src/components/{DashboardBuilder/DashboardEditor.spec.tsx → ReportBuilder/ReportEditor.spec.tsx} +65 -20
  158. package/src/components/{DashboardBuilder/DashboardEditor.textSource.spec.tsx → ReportBuilder/ReportEditor.textSource.spec.tsx} +6 -6
  159. package/src/components/{DashboardBuilder/DashboardEditor.tsx → ReportBuilder/ReportEditor.tsx} +92 -35
  160. package/src/components/{DashboardBuilder → ReportBuilder}/addTile.compile.spec.ts +1 -3
  161. package/src/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.spec.ts +1 -0
  162. package/src/components/{DashboardBuilder → ReportBuilder}/artifactBlock.spec.ts +21 -29
  163. package/src/components/ReportBuilder/builderReport.ts +53 -0
  164. package/src/components/{DashboardBuilder → ReportBuilder}/catalog.spec.ts +28 -10
  165. package/src/components/{DashboardBuilder → ReportBuilder}/catalog.ts +17 -10
  166. package/src/components/{DashboardBuilder → ReportBuilder}/controls.spec.ts +1 -0
  167. package/src/components/{DashboardBuilder → ReportBuilder}/document.ts +4 -7
  168. package/src/components/{DashboardBuilder → ReportBuilder}/documentSession.spec.ts +5 -5
  169. package/src/components/{DashboardBuilder → ReportBuilder}/documentSession.ts +1 -1
  170. package/src/components/{DashboardBuilder → ReportBuilder}/imports.spec.ts +6 -2
  171. package/src/components/{DashboardBuilder → ReportBuilder}/imports.ts +8 -4
  172. package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.chart.spec.ts +1 -1
  173. package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.convert.spec.ts +9 -13
  174. package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.read.spec.ts +15 -15
  175. package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.ts +7 -2
  176. package/src/components/{DashboardBuilder → ReportBuilder}/malloyTree.ts +25 -0
  177. package/src/components/{DashboardBuilder → ReportBuilder}/newDashboard.spec.ts +12 -4
  178. package/src/components/{DashboardBuilder → ReportBuilder}/newDashboard.ts +11 -24
  179. package/src/components/{DashboardBuilder → ReportBuilder}/preview.spec.ts +1 -0
  180. package/src/components/{DashboardBuilder → ReportBuilder}/readDocument.spec.ts +64 -36
  181. package/src/components/{DashboardBuilder → ReportBuilder}/readDocument.ts +33 -32
  182. package/src/components/ReportBuilder/readForEditor.spec.ts +96 -0
  183. package/src/components/{DashboardBuilder → ReportBuilder}/readForEditor.ts +3 -11
  184. package/src/components/ReportBuilder/reportTag.ts +108 -0
  185. package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.imports.spec.ts +28 -1
  186. package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.spec.ts +32 -3
  187. package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.ts +37 -60
  188. package/src/components/{DashboardBuilder → ReportBuilder}/tagParse.spec.ts +3 -3
  189. package/src/components/{DashboardBuilder → ReportBuilder}/testing/artifactTagParity.json +2 -2
  190. package/src/components/ReportBuilder/testing/drillResolution.json +279 -0
  191. package/src/components/ReportBuilder/testing/reportLayoutParity.json +125 -0
  192. package/src/components/{DashboardBuilder → ReportBuilder}/textTiles.spec.ts +66 -143
  193. package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSelection.ts +2 -2
  194. package/src/components/{DashboardBuilder → ReportBuilder}/useControlBindings.ts +2 -2
  195. package/src/components/ReportBuilder/useEditorCatalog.spec.tsx +156 -0
  196. package/src/components/ReportBuilder/useEditorCatalog.ts +119 -0
  197. package/src/components/{DashboardBuilder → ReportBuilder}/useHostCopy.ts +7 -5
  198. package/src/components/{DashboardBuilder → ReportBuilder}/useOpenedDocument.ts +56 -35
  199. package/src/components/{DashboardBuilder/useDashboardEditor.spec.ts → ReportBuilder/useReportEditor.spec.ts} +6 -6
  200. package/src/components/{DashboardBuilder/useDashboardEditor.ts → ReportBuilder/useReportEditor.ts} +6 -17
  201. package/src/components/{DashboardBuilder → ReportBuilder}/useSaveChannel.ts +36 -35
  202. package/src/components/{DashboardBuilder → ReportBuilder}/useTileEditing.ts +2 -2
  203. package/src/components/ServerProvider.tsx +2 -0
  204. package/src/components/drill/resolveDrill.ts +9 -2
  205. package/src/components/drill/useDrill.tsx +1 -0
  206. package/src/components/drill/useDrillSelf.spec.tsx +60 -7
  207. package/src/components/drill/useDrillSelf.ts +29 -12
  208. package/src/components/index.ts +2 -1
  209. package/src/components/{Dashboard → legacy}/Dashboard.spec.tsx +1 -1
  210. package/src/components/{Dashboard → legacy}/Dashboard.tsx +40 -28
  211. package/src/components/legacy/MalloynbCells.tsx +88 -0
  212. package/src/components/{Notebook → legacy}/Notebook.served.spec.tsx +17 -13
  213. package/src/components/{Notebook → legacy}/Notebook.spec.tsx +24 -20
  214. package/src/components/legacy/Notebook.tsx +44 -0
  215. package/src/components/{DashboardBuilder → legacy}/NotebookEditor.tsx +7 -4
  216. package/src/components/legacy/builderNames.ts +25 -0
  217. package/src/components/legacy/index.ts +20 -0
  218. package/src/components/legacy/kindAdapter.ts +19 -0
  219. package/src/components/legacy/kindTypedDrafts.ts +34 -0
  220. package/src/components/legacy/nameAlias.spec.ts +124 -0
  221. package/src/components/legacy/nameAlias.ts +95 -0
  222. package/src/components/legacy/queryKeys.ts +26 -0
  223. package/src/hooks/useGivensState.spec.ts +9 -9
  224. package/src/mainEntry.spec.ts +1 -1
  225. package/src/textEntry.spec.ts +9 -9
  226. package/src/utils/formatting.spec.ts +5 -5
  227. package/src/utils/parsing.spec.ts +1 -1
  228. package/src/utils/parsing.ts +1 -1
  229. package/dist/ServerProvider-Gj-im5VD.cjs.js +0 -1
  230. package/dist/components/Dashboard/telemetry.d.ts +0 -73
  231. package/dist/components/DashboardBuilder/builderReport.d.ts +0 -13
  232. package/dist/components/DashboardBuilder/telemetry.d.ts +0 -43
  233. package/dist/components/DocumentCreate/events.d.ts +0 -10
  234. package/dist/components/Notebook/Notebook.d.ts +0 -52
  235. package/dist/components/Notebook/index.d.ts +0 -1
  236. package/dist/useCompiledDocument-tBejqZ7s.cjs.js +0 -142
  237. package/src/components/Dashboard/telemetry.ts +0 -75
  238. package/src/components/DashboardBuilder/builderReport.ts +0 -74
  239. package/src/components/DashboardBuilder/readForEditor.spec.ts +0 -80
  240. package/src/components/DashboardBuilder/telemetry.ts +0 -47
  241. package/src/components/DashboardBuilder/testing/documentKindRule.json +0 -40
  242. package/src/components/DocumentCreate/events.ts +0 -15
  243. package/src/components/Notebook/index.ts +0 -4
  244. /package/dist/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.d.ts +0 -0
  245. /package/dist/components/{DashboardBuilder → ReportBuilder}/ChartPicker.d.ts +0 -0
  246. /package/dist/components/{DashboardBuilder → ReportBuilder}/DrillDialog.d.ts +0 -0
  247. /package/dist/components/{DashboardBuilder → ReportBuilder}/FilterDialog.d.ts +0 -0
  248. /package/dist/components/{DashboardBuilder → ReportBuilder}/FilterStrip.d.ts +0 -0
  249. /package/dist/components/{DashboardBuilder → ReportBuilder}/InlineMarkdown.d.ts +0 -0
  250. /package/dist/components/{DashboardBuilder → ReportBuilder}/InlineText.d.ts +0 -0
  251. /package/dist/components/{DashboardBuilder → ReportBuilder}/SourceViewPicker.d.ts +0 -0
  252. /package/dist/components/{DashboardBuilder → ReportBuilder}/TextTileBody.d.ts +0 -0
  253. /package/dist/components/{DashboardBuilder → ReportBuilder}/TileFrame.d.ts +0 -0
  254. /package/dist/components/{DashboardBuilder → ReportBuilder}/TileMenu.d.ts +0 -0
  255. /package/dist/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.d.ts +0 -0
  256. /package/dist/components/{DashboardBuilder → ReportBuilder}/annotationText.d.ts +0 -0
  257. /package/dist/components/{DashboardBuilder → ReportBuilder}/changedTile.d.ts +0 -0
  258. /package/dist/components/{DashboardBuilder → ReportBuilder}/chartLine.d.ts +0 -0
  259. /package/dist/components/{DashboardBuilder → ReportBuilder}/controls.d.ts +0 -0
  260. /package/dist/components/{DashboardBuilder → ReportBuilder}/inlineEdit.d.ts +0 -0
  261. /package/dist/components/{DashboardBuilder → ReportBuilder}/layout.d.ts +0 -0
  262. /package/dist/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.d.ts +0 -0
  263. /package/dist/components/{DashboardBuilder → ReportBuilder}/loadMalloy.d.ts +0 -0
  264. /package/dist/components/{DashboardBuilder → ReportBuilder}/openDraft.d.ts +0 -0
  265. /package/dist/components/{DashboardBuilder → ReportBuilder}/preview.d.ts +0 -0
  266. /package/dist/components/{DashboardBuilder → ReportBuilder}/sortable.d.ts +0 -0
  267. /package/dist/components/{DashboardBuilder → ReportBuilder}/spliceResult.d.ts +0 -0
  268. /package/dist/components/{DashboardBuilder → ReportBuilder}/tagParse.d.ts +0 -0
  269. /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/fixtures.d.ts +0 -0
  270. /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/inline.d.ts +0 -0
  271. /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/resize.d.ts +0 -0
  272. /package/dist/components/{DashboardBuilder → ReportBuilder}/tileDisplayTitle.d.ts +0 -0
  273. /package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.d.ts +0 -0
  274. /package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.d.ts +0 -0
  275. /package/dist/components/{DashboardBuilder → ReportBuilder}/useConversionConfirm.d.ts +0 -0
  276. /package/dist/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.d.ts +0 -0
  277. /package/dist/components/{DashboardBuilder → ReportBuilder}/useDraft.d.ts +0 -0
  278. /package/dist/components/{DashboardBuilder → ReportBuilder}/useExitGuard.d.ts +0 -0
  279. /package/dist/components/{DashboardBuilder → ReportBuilder}/useFilterForm.d.ts +0 -0
  280. /package/dist/components/{DashboardBuilder → ReportBuilder}/useOpenDraftCommit.d.ts +0 -0
  281. /package/dist/components/{DashboardBuilder → ReportBuilder}/useTileReorder.d.ts +0 -0
  282. /package/dist/components/{DashboardBuilder → ReportBuilder}/useTileResize.d.ts +0 -0
  283. /package/src/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.spec.tsx +0 -0
  284. /package/src/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.tsx +0 -0
  285. /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.render.spec.tsx +0 -0
  286. /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.spec.ts +0 -0
  287. /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.tsx +0 -0
  288. /package/src/components/{DashboardBuilder → ReportBuilder}/FilterStrip.tsx +0 -0
  289. /package/src/components/{DashboardBuilder → ReportBuilder}/InlineMarkdown.tsx +0 -0
  290. /package/src/components/{DashboardBuilder → ReportBuilder}/InlineText.tsx +0 -0
  291. /package/src/components/{DashboardBuilder → ReportBuilder}/SourceViewPicker.tsx +0 -0
  292. /package/src/components/{DashboardBuilder → ReportBuilder}/TextTileBody.tsx +0 -0
  293. /package/src/components/{DashboardBuilder → ReportBuilder}/TileFrame.tsx +0 -0
  294. /package/src/components/{DashboardBuilder → ReportBuilder}/TileMenu.tsx +0 -0
  295. /package/src/components/{DashboardBuilder → ReportBuilder}/__test__/inventory.ts +0 -0
  296. /package/src/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.ts +0 -0
  297. /package/src/components/{DashboardBuilder → ReportBuilder}/annotationText.spec.ts +0 -0
  298. /package/src/components/{DashboardBuilder → ReportBuilder}/annotationText.ts +0 -0
  299. /package/src/components/{DashboardBuilder → ReportBuilder}/artifactTagParity.spec.ts +0 -0
  300. /package/src/components/{DashboardBuilder → ReportBuilder}/catalog.aggregate.spec.ts +0 -0
  301. /package/src/components/{DashboardBuilder → ReportBuilder}/changedTile.spec.ts +0 -0
  302. /package/src/components/{DashboardBuilder → ReportBuilder}/changedTile.ts +0 -0
  303. /package/src/components/{DashboardBuilder → ReportBuilder}/chartLine.spec.ts +0 -0
  304. /package/src/components/{DashboardBuilder → ReportBuilder}/chartLine.ts +0 -0
  305. /package/src/components/{DashboardBuilder → ReportBuilder}/controls.ts +0 -0
  306. /package/src/components/{DashboardBuilder → ReportBuilder}/emptyStart.spec.ts +0 -0
  307. /package/src/components/{DashboardBuilder → ReportBuilder}/inlineEdit.tsx +0 -0
  308. /package/src/components/{DashboardBuilder → ReportBuilder}/invariants.spec.ts +0 -0
  309. /package/src/components/{DashboardBuilder → ReportBuilder}/keepRowStructure.spec.ts +0 -0
  310. /package/src/components/{DashboardBuilder → ReportBuilder}/layout.ts +0 -0
  311. /package/src/components/{DashboardBuilder → ReportBuilder}/loadMalloy.spec.ts +0 -0
  312. /package/src/components/{DashboardBuilder → ReportBuilder}/loadMalloy.ts +0 -0
  313. /package/src/components/{DashboardBuilder → ReportBuilder}/malloyTree.spec.ts +0 -0
  314. /package/src/components/{DashboardBuilder → ReportBuilder}/moveIntoGap.spec.ts +0 -0
  315. /package/src/components/{DashboardBuilder → ReportBuilder}/openDraft.ts +0 -0
  316. /package/src/components/{DashboardBuilder → ReportBuilder}/preview.shapes.spec.ts +0 -0
  317. /package/src/components/{DashboardBuilder → ReportBuilder}/preview.ts +0 -0
  318. /package/src/components/{DashboardBuilder → ReportBuilder}/scannerShapes.spec.ts +0 -0
  319. /package/src/components/{DashboardBuilder → ReportBuilder}/sortable.spec.ts +0 -0
  320. /package/src/components/{DashboardBuilder → ReportBuilder}/sortable.tsx +0 -0
  321. /package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.chart.spec.ts +0 -0
  322. /package/src/components/{DashboardBuilder → ReportBuilder}/spliceResult.ts +0 -0
  323. /package/src/components/{DashboardBuilder → ReportBuilder}/statementExtent.spec.ts +0 -0
  324. /package/src/components/{DashboardBuilder → ReportBuilder}/tagParse.ts +0 -0
  325. /package/src/components/{DashboardBuilder → ReportBuilder}/testing/fixtures.ts +0 -0
  326. /package/src/components/{DashboardBuilder → ReportBuilder}/testing/inline.ts +0 -0
  327. /package/src/components/{DashboardBuilder → ReportBuilder}/testing/resize.ts +0 -0
  328. /package/src/components/{DashboardBuilder → ReportBuilder}/testing/urlRenderTags.json +0 -0
  329. /package/src/components/{DashboardBuilder → ReportBuilder}/tileDisplayTitle.ts +0 -0
  330. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.spec.ts +0 -0
  331. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.ts +0 -0
  332. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.overlay.spec.tsx +0 -0
  333. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.spec.tsx +0 -0
  334. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.ts +0 -0
  335. /package/src/components/{DashboardBuilder → ReportBuilder}/useConversionConfirm.ts +0 -0
  336. /package/src/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.spec.ts +0 -0
  337. /package/src/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.ts +0 -0
  338. /package/src/components/{DashboardBuilder → ReportBuilder}/useDraft.ts +0 -0
  339. /package/src/components/{DashboardBuilder → ReportBuilder}/useExitGuard.spec.ts +0 -0
  340. /package/src/components/{DashboardBuilder → ReportBuilder}/useExitGuard.ts +0 -0
  341. /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.existing.spec.tsx +0 -0
  342. /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.spec.tsx +0 -0
  343. /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.ts +0 -0
  344. /package/src/components/{DashboardBuilder → ReportBuilder}/useOpenDraftCommit.ts +0 -0
  345. /package/src/components/{DashboardBuilder → ReportBuilder}/useTileReorder.spec.tsx +0 -0
  346. /package/src/components/{DashboardBuilder → ReportBuilder}/useTileReorder.ts +0 -0
  347. /package/src/components/{DashboardBuilder → ReportBuilder}/useTileResize.spec.tsx +0 -0
  348. /package/src/components/{DashboardBuilder → ReportBuilder}/useTileResize.ts +0 -0
  349. /package/src/components/{DashboardBuilder → ReportBuilder}/withGaps.spec.ts +0 -0
  350. /package/src/components/{Notebook → legacy}/Notebook.layout.spec.tsx +0 -0
@@ -17,7 +17,7 @@ import {
17
17
  } from "../../../test/serverProvider";
18
18
  import { BrowserDocumentStorage } from "../DocumentStorage/BrowserDocumentStorage";
19
19
  import { DocumentStorageProvider } from "../DocumentStorage/DocumentStorageProvider";
20
- import type { DashboardEvent } from "../Dashboard/telemetry";
20
+ import type { ReportEvent } from "../Report/telemetry";
21
21
  import { globalQueryClient } from "../../utils/queryClient";
22
22
 
23
23
  /**
@@ -78,13 +78,22 @@ const getModel = mock((_env: string, _pkg: string, path: string) =>
78
78
  },
79
79
  }),
80
80
  );
81
- const getDashboard = mock(() =>
81
+ const getReport = mock(() =>
82
82
  Promise.resolve({
83
83
  data: { path: "dashboards/overview.malloy", givens: [], tiles: [] },
84
84
  }),
85
85
  );
86
- const listDashboards = mock(() =>
87
- Promise.resolve({ data: [{ name: "overview" }, { name: "regions" }] }),
86
+ const listReports = mock(() =>
87
+ Promise.resolve({
88
+ data: [
89
+ {
90
+ path: "dashboards/overview.malloy",
91
+ name: "overview",
92
+ layout: "grid",
93
+ },
94
+ { path: "regions.malloy", name: "regions", layout: "grid" },
95
+ ],
96
+ }),
88
97
  );
89
98
  const executeQueryModel = mock(() => pending());
90
99
  // What the package publishes: the catalog is built from these, not from
@@ -99,25 +108,25 @@ const serverContext: {
99
108
  mockServerProvider(
100
109
  {
101
110
  models: { getModel, executeQueryModel, listModels },
102
- dashboards: { getDashboard, listDashboards },
111
+ reports: { getReport, listReports },
103
112
  },
104
113
  serverContext,
105
114
  );
106
115
 
107
116
  // Imported after the stub is registered: a static import would hoist above it.
108
- const { DashboardEditor } = await import("./DashboardEditor");
117
+ const { ReportEditor } = await import("./ReportEditor");
109
118
 
110
119
  const DRAFT = {
111
120
  workspace: "Local",
112
- type: "dashboard" as const,
121
+ type: "grid" as const,
113
122
  path: "env/pkg/dashboards/overview.malloy",
114
123
  };
115
124
 
116
- const mount = (onEvent?: (event: DashboardEvent) => void) => {
125
+ const mount = (onEvent?: (event: ReportEvent) => void) => {
117
126
  const storage = new BrowserDocumentStorage();
118
127
  render(
119
128
  <DocumentStorageProvider documentStorage={storage}>
120
- <DashboardEditor
129
+ <ReportEditor
121
130
  environmentName="env"
122
131
  packageName="pkg"
123
132
  dashboardName="overview"
@@ -139,10 +148,10 @@ beforeEach(() => {
139
148
  fetchFailure = undefined;
140
149
  serverContext.mutable = undefined;
141
150
  serverContext.isLoadingStatus = false;
142
- getDashboard.mockClear();
151
+ getReport.mockClear();
143
152
  });
144
153
 
145
- describe("DashboardEditor", () => {
154
+ describe("ReportEditor", () => {
146
155
  it("opens the package file in the builder, with the package's sources to pick from", async () => {
147
156
  mount();
148
157
  expect(await screen.findByText("Storefront")).toBeDefined();
@@ -174,7 +183,7 @@ describe("DashboardEditor", () => {
174
183
  })
175
184
  ).length,
176
185
  ).toBe(2);
177
- expect(getDashboard).not.toHaveBeenCalled();
186
+ expect(getReport).not.toHaveBeenCalled();
178
187
  });
179
188
 
180
189
  it("keeps the builder and its unsaved edit through a failed refetch", async () => {
@@ -242,6 +251,24 @@ describe("DashboardEditor", () => {
242
251
  ).toBeDefined();
243
252
  });
244
253
 
254
+ it("leaves the package's listed reports out of the catalog, wherever they live", async () => {
255
+ listModels.mockImplementationOnce(() =>
256
+ Promise.resolve({
257
+ data: [{ path: "data_app.malloy" }, { path: "regions.malloy" }],
258
+ }),
259
+ );
260
+ mount();
261
+ await waitFor(() =>
262
+ expect(
263
+ getModel.mock.calls.some((call) => call[2] === "data_app.malloy"),
264
+ ).toBe(true),
265
+ );
266
+ expect(listReports).toHaveBeenCalled();
267
+ expect(
268
+ getModel.mock.calls.some((call) => call[2] === "regions.malloy"),
269
+ ).toBe(false);
270
+ });
271
+
245
272
  it("saves an edit into the browser and marks it saved", async () => {
246
273
  const storage = mount();
247
274
  await screen.findByText("Storefront");
@@ -265,39 +292,57 @@ describe("DashboardEditor", () => {
265
292
  'title="Drafted"',
266
293
  );
267
294
  await new BrowserDocumentStorage().saveDocument(DRAFT, draft);
268
- const onEvent = mock((_event: DashboardEvent) => {});
295
+ const onEvent = mock((_event: ReportEvent) => {});
269
296
  mount(onEvent);
270
297
  expect(
271
- await screen.findByText(
272
- /edits to this dashboard saved in this browser/,
273
- ),
298
+ await screen.findByText(/edits to this report saved in this browser/),
274
299
  ).toBeDefined();
275
300
  // Until the reader chooses, the package file is what is open.
276
301
  expect(await screen.findByText("Storefront")).toBeDefined();
277
302
  fireEvent.click(button("Resume"));
278
303
  expect(await screen.findByText("Drafted")).toBeDefined();
279
304
  expect(onEvent.mock.calls.at(-1)?.[0]).toMatchObject({
280
- type: "dashboard.opened",
305
+ type: "report.opened",
281
306
  from: "draft",
282
307
  });
283
308
  expect(screen.queryByText(/saved in this browser/)).toBeNull();
284
309
  });
285
310
 
286
311
  it("reports the open, and offers Save rather than Close when it can save", async () => {
287
- const onEvent = mock((_event: DashboardEvent) => {});
312
+ const onEvent = mock((_event: ReportEvent) => {});
288
313
  mount(onEvent);
289
314
  await screen.findByText("Storefront");
290
315
  await waitFor(() =>
291
316
  expect(onEvent.mock.calls.map((call) => call[0].type)).toContain(
292
- "dashboard.opened",
317
+ "report.opened",
293
318
  ),
294
319
  );
295
320
  expect(onEvent.mock.calls[0][0]).toMatchObject({
296
- type: "dashboard.opened",
321
+ type: "report.opened",
322
+ path: "dashboards/overview.malloy",
323
+ layout: "grid",
324
+ surface: "edit",
297
325
  from: "package",
298
326
  tiles: 1,
299
327
  });
300
328
  expect(screen.queryByRole("button", { name: "Close" })).toBeNull();
301
329
  expect(button("Saved")).toBeDefined();
302
330
  });
331
+
332
+ it("reports a file it could not fetch as one load failure, by category", async () => {
333
+ fetchFailure = Object.assign(new Error("gone"), { status: 404 });
334
+ const onEvent = mock((_event: ReportEvent) => {});
335
+ mount(onEvent);
336
+ await waitFor(() => expect(onEvent).toHaveBeenCalled());
337
+ await new Promise((resolve) => setTimeout(resolve, 20));
338
+ expect(onEvent.mock.calls.map(([event]) => event)).toEqual([
339
+ {
340
+ type: "report.load_failed",
341
+ path: "dashboards/overview.malloy",
342
+ layout: "grid",
343
+ surface: "edit",
344
+ category: "not_found",
345
+ },
346
+ ]);
347
+ });
303
348
  });
@@ -85,15 +85,15 @@ const listModels = mock(
85
85
  mockServerProvider(
86
86
  {
87
87
  models: { compileModelSource, executeQueryModel, getModel, listModels },
88
- dashboards: {
89
- getDashboard: mock(() => pending()),
90
- listDashboards: mock(() => Promise.resolve({ data: [] })),
88
+ reports: {
89
+ getReport: mock(() => pending()),
90
+ listReports: mock(() => Promise.resolve({ data: [] })),
91
91
  },
92
92
  },
93
93
  { mutable: true },
94
94
  );
95
95
 
96
- const { DashboardEditor } = await import("./DashboardEditor");
96
+ const { ReportEditor } = await import("./ReportEditor");
97
97
 
98
98
  const RECORD: Workspace = {
99
99
  name: "Host",
@@ -134,7 +134,7 @@ const mount = (
134
134
  ) =>
135
135
  render(
136
136
  <DocumentStorageProvider documentStorage={storage}>
137
- <DashboardEditor
137
+ <ReportEditor
138
138
  environmentName="env"
139
139
  packageName="pkg"
140
140
  dashboardName="ops"
@@ -159,7 +159,7 @@ beforeEach(() => {
159
159
  listModels.mockClear();
160
160
  });
161
161
 
162
- describe("DashboardEditor in text-source mode", () => {
162
+ describe("ReportEditor in text-source mode", () => {
163
163
  it("compiles the stored text for the viewer and reads the package model nowhere", async () => {
164
164
  mount(documentStore());
165
165
 
@@ -3,17 +3,28 @@
3
3
 
4
4
  import { Alert, Button, Stack } from "@mui/material";
5
5
  import { useQueryClient } from "@tanstack/react-query";
6
- import { useCallback, useRef } from "react";
6
+ import { useCallback, useEffect, useRef } from "react";
7
7
  import type { Given } from "../../client";
8
8
  import type { HostGivenValue } from "../../hooks/givenValue";
9
9
  import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
10
10
  import { ApiErrorDisplay } from "../ApiErrorDisplay";
11
- import type { BuilderEvent } from "./telemetry";
11
+ import {
12
+ failureCategory,
13
+ reportEmitter,
14
+ type ReportEvent,
15
+ type ReportEventHandler,
16
+ } from "../Report/telemetry";
12
17
  import { now } from "../../utils/clock";
13
18
  import { useOptionalDocumentStorage } from "../DocumentStorage";
14
19
  import { Loading } from "../Loading";
20
+ import { documentSlug } from "../Package/documentLocation";
15
21
  import { useServer } from "../ServerProvider";
16
- import type { DocumentKind } from "./document";
22
+ import {
23
+ layoutOfKind,
24
+ legacyNamedPath,
25
+ type DocumentKind,
26
+ } from "../legacy/kindAdapter";
27
+ import type { ReportLayout } from "../Package/documentLocation";
17
28
  import {
18
29
  resolveEditorTarget,
19
30
  saveCaption,
@@ -42,11 +53,26 @@ import { useSaveChannel } from "./useSaveChannel";
42
53
  * editor (its value is written into each tile's query) but reaches the package
43
54
  * only when the file is saved into it.
44
55
  */
45
- export type DashboardEditorProps = (
56
+ export type ReportEditorProps = (
57
+ | {
58
+ /** `publisher://environments/{env}/packages/{pkg}`, optionally `?versionId=`. */
59
+ resourceUri: string;
60
+ /**
61
+ * The report's package path, `sales/q3.malloy`: its identity, and what
62
+ * the editor is keyed by. Give this.
63
+ */
64
+ path: string;
65
+ /** A display label; default the path's basename. */
66
+ dashboard?: string;
67
+ }
46
68
  | {
47
69
  /** `publisher://environments/{env}/packages/{pkg}`, optionally `?versionId=`. */
48
70
  resourceUri: string;
49
- /** The dashboard's slug, as listed by the dashboards endpoint. */
71
+ /**
72
+ * @deprecated Pass `path`. The report's basename, which opens
73
+ * `<kind>s/<name>.malloy` (`dashboards/` unless `kind` says
74
+ * `notebook`) when no `path` is given.
75
+ */
50
76
  dashboard: string;
51
77
  }
52
78
  | {
@@ -62,20 +88,25 @@ export type DashboardEditorProps = (
62
88
  }
63
89
  ) & {
64
90
  /**
65
- * What the editor does — opened, saved, refused — for the host to log or
66
- * count; see `DashboardEvent`. A notebook reports `NotebookEvent`s instead.
91
+ * What the editor does — opened, failed to load, saved, refused, switched
92
+ * layout — for the host to log or count; see `ReportEvent`.
67
93
  */
68
- onEvent?: (event: BuilderEvent) => void;
94
+ onEvent?: ReportEventHandler;
69
95
  /**
70
- * What the document is to the host: its storage locator and event names.
71
- * Default `dashboard`. A notebook is a dashboard with one column, and is
72
- * read with the authoring flag and served through the notebook endpoint.
96
+ * The report's layout as the host knows it before the text is read: from
97
+ * the package's listing, or for a draft the layout its store recorded.
98
+ * Default `grid`. It decides what is read when the editor opens (a linear
99
+ * report's copy is read back only from an authoritative store) and is what
100
+ * a save records until the text says otherwise; once open, the document's
101
+ * own tag decides how it is drawn, what a save records and which events it
102
+ * reports, and the layout switch changes that.
73
103
  */
104
+ layout?: ReportLayout;
105
+ /** @deprecated Pass `layout`: `dashboard` is grid, `notebook` linear. */
74
106
  kind?: DocumentKind;
75
107
  /**
76
- * The document's file within the package, when it is not where its kind
77
- * puts a new one (`dashboards/<slug>.malloy`, `notebooks/<slug>.malloy`):
78
- * the kind comes from the file's own tag, so a document may sit in either.
108
+ * The report's file within the package, wherever it lives: its identity.
109
+ * Without it, the deprecated name forms open `<kind>s/<name>.malloy`.
79
110
  */
80
111
  path?: string;
81
112
  /**
@@ -95,6 +126,13 @@ export type DashboardEditorProps = (
95
126
  onExit?: () => void;
96
127
  /** Edit a document held as text; see {@link TextSourceOptions}. */
97
128
  textSource?: TextSourceOptions;
129
+ /**
130
+ * Whether the toolbar offers the Linear / Grid layout switch. Default
131
+ * true. A host that files a report by its layout passes false, so an
132
+ * author cannot change a layout the host files by. A document held as text
133
+ * never gets the switch.
134
+ */
135
+ allowLayoutChange?: boolean;
98
136
  };
99
137
 
100
138
  /**
@@ -117,16 +155,19 @@ export interface TextSourceOptions {
117
155
  givens?: Record<string, HostGivenValue>;
118
156
  }
119
157
 
120
- export function DashboardEditor(props: DashboardEditorProps) {
158
+ export function ReportEditor(props: ReportEditorProps) {
121
159
  const {
122
160
  onEvent,
123
161
  onDirtyChange,
124
162
  onExit,
125
- kind = "dashboard",
163
+ kind,
126
164
  path,
127
165
  textSource,
166
+ allowLayoutChange,
128
167
  } = props;
129
- const notebook = kind === "notebook";
168
+ const layout: ReportLayout =
169
+ props.layout ?? (kind ? layoutOfKind(kind) : "grid");
170
+ const notebook = layout === "linear";
130
171
  const textHeld = textSource !== undefined;
131
172
  // Degraded, not thrown, on a bad URI: a throw in a render body takes the host's whole tree down.
132
173
  const {
@@ -135,12 +176,10 @@ export function DashboardEditor(props: DashboardEditorProps) {
135
176
  versionId,
136
177
  namesBoth: uriNamesBoth,
137
178
  } = resolveEditorTarget(props);
138
- const dashboardName =
139
- "resourceUri" in props ? props.dashboard : props.dashboardName;
140
- const noun = notebook ? "notebook" : "dashboard";
141
- const refusedEvent = notebook
142
- ? ("notebook.open_refused" as const)
143
- : ("dashboard.open_refused" as const);
179
+ const named = "resourceUri" in props ? props.dashboard : props.dashboardName;
180
+ // The label the builder shows; the path is what it opens.
181
+ const dashboardName = named ?? documentSlug(path) ?? "";
182
+ const noun = "report";
144
183
 
145
184
  const { apiClients, mutable, isLoadingStatus } = useServer();
146
185
  const queryClient = useQueryClient();
@@ -153,8 +192,11 @@ export function DashboardEditor(props: DashboardEditorProps) {
153
192
  const onDirtyChangeRef = useRef(onDirtyChange);
154
193
  onDirtyChangeRef.current = onDirtyChange;
155
194
  const storage = useOptionalDocumentStorage()?.documentStorage;
156
- const legacyFormat = notebook && /\.malloynb$/i.test(dashboardName);
157
- const modelPath = path ?? `${kind}s/${dashboardName}.malloy`;
195
+ const modelPath =
196
+ path ?? legacyNamedPath(kind ?? "dashboard", dashboardName);
197
+ const legacyFormat =
198
+ /\.malloynb$/i.test(modelPath) ||
199
+ (notebook && /\.malloynb$/i.test(dashboardName));
158
200
 
159
201
  // The file as the package has it. `sourceText` rides on the compiled model.
160
202
  const modelQuery = useQueryWithApiError({
@@ -191,7 +233,7 @@ export function DashboardEditor(props: DashboardEditorProps) {
191
233
  readFailure,
192
234
  } = useHostCopy({
193
235
  storage,
194
- kind,
236
+ layout,
195
237
  notebook,
196
238
  environmentName,
197
239
  packageName,
@@ -224,9 +266,9 @@ export function DashboardEditor(props: DashboardEditorProps) {
224
266
  fetchedAt: modelQuery.dataUpdatedAt,
225
267
  packageSettled: modelQuery.isSuccess && !modelQuery.isFetching,
226
268
  modelPath,
269
+ layout,
227
270
  notebook,
228
271
  noun,
229
- refusedEvent,
230
272
  legacyFormat,
231
273
  textHeld,
232
274
  startedAt,
@@ -242,7 +284,7 @@ export function DashboardEditor(props: DashboardEditorProps) {
242
284
  } = useSaveChannel({
243
285
  storage,
244
286
  workspace,
245
- kind,
287
+ layout,
246
288
  notebook,
247
289
  environmentName,
248
290
  packageName,
@@ -267,11 +309,24 @@ export function DashboardEditor(props: DashboardEditorProps) {
267
309
  });
268
310
  const workspaceName = workspace?.name;
269
311
  const reportEvent = useCallback(
270
- (event: BuilderEvent) => {
312
+ (event: ReportEvent) => {
271
313
  onEventRef.current?.(withWorkspace(event, workspaceName));
272
314
  },
273
315
  [workspaceName],
274
316
  );
317
+ // The file could not be fetched before anything opened: once per mount,
318
+ // since a refetch that fails again is the same failure.
319
+ const fetchFailed = modelQuery.isError && !opened;
320
+ const fetchFailureReported = useRef(false);
321
+ useEffect(() => {
322
+ if (!fetchFailed || fetchFailureReported.current) return;
323
+ fetchFailureReported.current = true;
324
+ reportEmitter({ path: modelPath, layout }, onEventRef.current).emit({
325
+ type: "report.load_failed",
326
+ surface: "edit",
327
+ category: failureCategory(modelQuery.error),
328
+ });
329
+ }, [fetchFailed, modelQuery.error, modelPath, layout]);
275
330
  // Stable: the builder fires this from an effect that depends on it.
276
331
  const reportDirty = useCallback(
277
332
  (value: boolean) => {
@@ -362,8 +417,8 @@ export function DashboardEditor(props: DashboardEditorProps) {
362
417
  </Stack>
363
418
  }
364
419
  >
365
- You have edits to this dashboard saved in this browser that
366
- the package does not have.
420
+ You have edits to this report saved in this browser that the
421
+ package does not have.
367
422
  </Alert>
368
423
  )}
369
424
  {held !== undefined && (
@@ -376,10 +431,10 @@ export function DashboardEditor(props: DashboardEditorProps) {
376
431
  }
377
432
  >
378
433
  {savesTo === "package"
379
- ? "This dashboard changed since you opened it. Your edits are still here; loading the new version replaces them, and until you do, saving is refused."
434
+ ? "This report changed since you opened it. Your edits are still here; loading the new version replaces them, and until you do, saving is refused."
380
435
  : savesTo === "host"
381
- ? "This dashboard changed since you opened it. Your edits are still here; loading the new version replaces them, and saving keeps yours and writes over it."
382
- : "The package's copy of this dashboard changed since you opened it. Your edits are still here; loading the new version replaces them."}
436
+ ? "This report changed since you opened it. Your edits are still here; loading the new version replaces them, and saving keeps yours and writes over it."
437
+ : "The package's copy of this report changed since you opened it. Your edits are still here; loading the new version replaces them."}
383
438
  </Alert>
384
439
  )}
385
440
  {supersedeFailure !== undefined && (
@@ -392,7 +447,6 @@ export function DashboardEditor(props: DashboardEditorProps) {
392
447
  {opened && (
393
448
  <EditorSurface
394
449
  key={opened.generation}
395
- kind={kind}
396
450
  environmentName={environmentName}
397
451
  packageName={packageName}
398
452
  modelPath={modelPath}
@@ -412,6 +466,9 @@ export function DashboardEditor(props: DashboardEditorProps) {
412
466
  onSave={save}
413
467
  onDirtyChange={reportDirty}
414
468
  {...(onExit ? { onExit } : {})}
469
+ {...(allowLayoutChange !== undefined
470
+ ? { allowLayoutChange }
471
+ : {})}
415
472
  savesTo={savesTo}
416
473
  {...(saveLabel ? { saveLabel } : {})}
417
474
  {...(onEvent ? { onEvent: reportEvent } : {})}
@@ -97,9 +97,7 @@ async function addTile(
97
97
  },
98
98
  { modelPath: DOCUMENT, textHeld, notebook: false },
99
99
  );
100
- const result = await spliceDashboardDocument(text, document, {
101
- modelPath: DOCUMENT,
102
- });
100
+ const result = await spliceDashboardDocument(text, document);
103
101
  if (spliceFailed(result)) throw new Error(result.reason);
104
102
  return result.source;
105
103
  }
@@ -7,6 +7,7 @@ import { addTileToDocument, type AddTileContext } from "./addTileToDocument";
7
7
  import type { DashboardDocument } from "./document";
8
8
 
9
9
  const document = (): DashboardDocument => ({
10
+ layout: "grid",
10
11
  title: "X",
11
12
  imports: [{ kind: "all", from: "../b.malloy" }],
12
13
  sources: [],
@@ -12,7 +12,7 @@ import {
12
12
  import { openDocument } from "./testing/fixtures";
13
13
 
14
14
  const BLOCK = `##! experimental.givens
15
- ##| artifact { kind=notebook title="Review"
15
+ ##| artifact { layout=linear title="Review"
16
16
  tiles=[
17
17
  intro { kind=text },
18
18
  "a_tiles -> overview",
@@ -34,17 +34,16 @@ source: a_tiles is a extend {
34
34
 
35
35
  const SINGLE = BLOCK.replace(
36
36
  /##\| artifact[\s\S]*?\|##\n/,
37
- `## artifact { kind=notebook title="Review" tiles=[intro { kind=text }, "a_tiles -> overview", "a_tiles -> detail"] }\n`,
37
+ `## artifact { layout=linear title="Review" tiles=[intro { kind=text }, "a_tiles -> overview", "a_tiles -> detail"] }\n`,
38
38
  );
39
39
 
40
40
  async function writes(
41
41
  source: string,
42
42
  edit: (document: DashboardDocument) => void,
43
- options?: { changeKind?: boolean },
44
43
  ): Promise<{ out: string; document: DashboardDocument }> {
45
44
  const next = structuredClone(await openDocument(source));
46
45
  edit(next);
47
- const result = await spliceDashboardDocument(source, next, options);
46
+ const result = await spliceDashboardDocument(source, next);
48
47
  if (spliceFailed(result)) throw new Error(result.reason);
49
48
  expect(await syntaxErrors(result.source)).toEqual([]);
50
49
  return { out: result.source, document: await openDocument(result.source) };
@@ -67,7 +66,7 @@ describe("the artifact tag written as a ##| block", () => {
67
66
  const block = await openDocument(BLOCK);
68
67
  const single = await openDocument(SINGLE);
69
68
  expect(block).toEqual(single);
70
- expect(block.kind).toBe("notebook");
69
+ expect(block.layout).toBe("linear");
71
70
  expect(block.title).toBe("Review");
72
71
  expect(block.tiles.map((t) => t.name)).toEqual([
73
72
  "intro",
@@ -133,7 +132,7 @@ describe("the artifact tag written as a ##| block", () => {
133
132
  if (intro) intro.colspan = 6;
134
133
  });
135
134
  expect(out).toContain(` intro { kind=text colspan=6 },\n`);
136
- expect(out).toContain(`##| artifact { kind=notebook title="Review"\n`);
135
+ expect(out).toContain(`##| artifact { layout=linear title="Review"\n`);
137
136
  });
138
137
 
139
138
  it("patches the title where it is, without collapsing the lines", async () => {
@@ -141,7 +140,7 @@ describe("the artifact tag written as a ##| block", () => {
141
140
  d.title = "Renamed";
142
141
  });
143
142
  expect(out).toContain(
144
- `##| artifact { kind=notebook title="Renamed"\n tiles=[\n`,
143
+ `##| artifact { layout=linear title="Renamed"\n tiles=[\n`,
145
144
  );
146
145
  expect(document.title).toBe("Renamed");
147
146
  });
@@ -156,33 +155,26 @@ describe("the artifact tag written as a ##| block", () => {
156
155
  expect(document.autorun).toBe(false);
157
156
  });
158
157
 
159
- it("toggles the kind both ways, leaving the layout alone", async () => {
160
- const asDashboard = await writes(
161
- BLOCK,
162
- (d) => {
163
- d.kind = undefined;
164
- d.columns = 12;
165
- },
166
- { changeKind: true },
167
- );
158
+ it("toggles the layout both ways in place, leaving the tiles alone", async () => {
159
+ const asDashboard = await writes(BLOCK, (d) => {
160
+ d.layout = "grid";
161
+ d.columns = 12;
162
+ });
168
163
  expect(asDashboard.out).toContain(
169
- `##| artifact { title="Review"\n tiles=[\n`,
164
+ `##| artifact { layout=grid title="Review"\n tiles=[\n`,
170
165
  );
171
- expect(asDashboard.document.kind).toBeUndefined();
166
+ expect(asDashboard.document.layout).toBe("grid");
172
167
  expect(asDashboard.document.columns).toBe(12);
173
168
  expect(asDashboard.out).toContain("dashboard { columns=12 }");
174
- const back = await writes(
175
- asDashboard.out,
176
- (d) => {
177
- d.kind = "notebook";
178
- d.columns = undefined;
179
- },
180
- { changeKind: true },
181
- );
182
- expect(back.document.kind).toBe("notebook");
169
+ const back = await writes(asDashboard.out, (d) => {
170
+ d.layout = "linear";
171
+ d.columns = undefined;
172
+ });
173
+ expect(back.document.layout).toBe("linear");
183
174
  expect(back.document.columns).toBeUndefined();
184
175
  expect(back.out).not.toContain("dashboard {");
185
176
  expect(back.out).toContain(`\n tiles=[\n intro { kind=text },\n`);
177
+ expect(back.out).toBe(BLOCK);
186
178
  });
187
179
 
188
180
  it("adds, changes and removes starting givens inside the block", async () => {
@@ -228,7 +220,7 @@ describe("the artifact tag written as a ##| block", () => {
228
220
  expect(document.description).toBe("What this review covers.");
229
221
  expect(out).toContain(`##" What this review covers.\n`);
230
222
  expect(out).toContain(
231
- `##| artifact { kind=notebook title="Review"\n tiles=[\n`,
223
+ `##| artifact { layout=linear title="Review"\n tiles=[\n`,
232
224
  );
233
225
  const cleared = await writes(out, (d) => {
234
226
  d.description = undefined;
@@ -242,7 +234,7 @@ describe("the artifact tag written as a ##| block", () => {
242
234
  d.title = "Renamed";
243
235
  });
244
236
  expect(out.split("\n")[1]).toBe(
245
- `## artifact { kind=notebook title="Renamed" tiles=["a_tiles -> detail", "a_tiles -> overview", intro { kind=text }] }`,
237
+ `## artifact { layout=linear title="Renamed" tiles=["a_tiles -> detail", "a_tiles -> overview", intro { kind=text }] }`,
246
238
  );
247
239
  });
248
240
  });
@@ -0,0 +1,53 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ import type { ReportLayout } from "../Package/documentLocation";
5
+ import {
6
+ reportEmitter,
7
+ type ReportEventHandler,
8
+ type SavesTo,
9
+ } from "../Report/telemetry";
10
+ import type { SessionReport } from "./useBuilderSession";
11
+
12
+ /**
13
+ * What the builder's session says about a save, as `report.*` events stamped
14
+ * with the report's path and the document's layout as it stands.
15
+ */
16
+ export const builderReport = ({
17
+ size,
18
+ path,
19
+ layout,
20
+ savesTo,
21
+ onEvent,
22
+ }: {
23
+ size: number;
24
+ path: string;
25
+ layout: ReportLayout;
26
+ savesTo: SavesTo;
27
+ onEvent: ReportEventHandler | undefined;
28
+ }): SessionReport => {
29
+ const { emit } = reportEmitter({ path, layout }, onEvent);
30
+ return {
31
+ size,
32
+ saved: ({ size, structural, durationMs, fromOpen }) =>
33
+ emit({
34
+ type: "report.saved",
35
+ tiles: size,
36
+ structural,
37
+ ...(fromOpen ? { converted: true } : {}),
38
+ where: savesTo,
39
+ durationMs,
40
+ }),
41
+ refused: (reason) => emit({ type: "report.save_refused", reason }),
42
+ undone: ({ size, structural, durationMs }) =>
43
+ emit({
44
+ type: "report.save_undone",
45
+ tiles: size,
46
+ structural,
47
+ where: savesTo,
48
+ durationMs,
49
+ }),
50
+ undoRefused: (reason) =>
51
+ emit({ type: "report.save_undo_refused", reason }),
52
+ };
53
+ };