@malloy-publisher/sdk 0.9.7 → 0.9.9

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 (353) hide show
  1. package/README.md +117 -17
  2. package/dist/{RenderedResult-CkUS04tl.es.js → RenderedResult-BHuJpdSn.es.js} +2 -2
  3. package/dist/{RenderedResult-qnpbr4tc.cjs.js → RenderedResult-Bw7EQc42.cjs.js} +1 -1
  4. package/dist/ServerProvider-B0dUY8be.cjs.js +1 -0
  5. package/dist/{ServerProvider-DnLLeXEX.es.js → ServerProvider-CQy4jVYK.es.js} +1602 -1074
  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 +893 -104
  10. package/dist/client/index.cjs.js +1 -1
  11. package/dist/client/index.es.js +125 -104
  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/ContentTypeIcon.d.ts +3 -3
  24. package/dist/components/Package/DataSchemaDialog.d.ts +26 -0
  25. package/dist/components/Package/NewDocumentDialog.d.ts +19 -10
  26. package/dist/components/Package/Package.d.ts +14 -9
  27. package/dist/components/Package/documentLocation.d.ts +66 -23
  28. package/dist/components/Package/index.d.ts +3 -2
  29. package/dist/components/Package/reportQueries.d.ts +8 -0
  30. package/dist/components/Package/useDocumentLocation.d.ts +36 -6
  31. package/dist/components/Package/useDraftLayout.d.ts +20 -0
  32. package/dist/components/Report/CellReport.d.ts +89 -0
  33. package/dist/components/Report/LinearReport.d.ts +18 -0
  34. package/dist/components/Report/Report.d.ts +62 -0
  35. package/dist/components/Report/index.d.ts +2 -0
  36. package/dist/components/Report/telemetry.d.ts +163 -0
  37. package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderDialogs.d.ts +2 -2
  38. package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderGrid.d.ts +2 -2
  39. package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderHeader.d.ts +5 -4
  40. package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderToolbar.d.ts +5 -1
  41. package/dist/components/{DashboardBuilder → ReportBuilder}/EditorSurface.d.ts +10 -7
  42. package/dist/components/{DashboardBuilder/DashboardBuilder.d.ts → ReportBuilder/ReportBuilder.d.ts} +17 -8
  43. package/dist/components/{DashboardBuilder/DashboardEditor.d.ts → ReportBuilder/ReportEditor.d.ts} +41 -14
  44. package/dist/components/ReportBuilder/builderReport.d.ts +14 -0
  45. package/dist/components/{DashboardBuilder → ReportBuilder}/catalog.d.ts +8 -5
  46. package/dist/components/{DashboardBuilder → ReportBuilder}/document.d.ts +3 -4
  47. package/dist/components/{DashboardBuilder → ReportBuilder}/documentSession.d.ts +1 -1
  48. package/dist/components/{DashboardBuilder → ReportBuilder}/imports.d.ts +5 -1
  49. package/dist/components/{DashboardBuilder → ReportBuilder}/malloyTree.d.ts +9 -0
  50. package/dist/components/{DashboardBuilder → ReportBuilder}/newDashboard.d.ts +7 -1
  51. package/dist/components/{DashboardBuilder → ReportBuilder}/readDocument.d.ts +7 -5
  52. package/dist/components/{DashboardBuilder → ReportBuilder}/readForEditor.d.ts +1 -1
  53. package/dist/components/ReportBuilder/reportTag.d.ts +52 -0
  54. package/dist/components/{DashboardBuilder → ReportBuilder}/spliceDocument.d.ts +1 -7
  55. package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderSelection.d.ts +2 -2
  56. package/dist/components/{DashboardBuilder → ReportBuilder}/useControlBindings.d.ts +2 -2
  57. package/dist/components/ReportBuilder/useEditorCatalog.d.ts +25 -0
  58. package/dist/components/{DashboardBuilder → ReportBuilder}/useHostCopy.d.ts +5 -3
  59. package/dist/components/{DashboardBuilder → ReportBuilder}/useOpenedDocument.d.ts +7 -5
  60. package/dist/components/{DashboardBuilder/useDashboardEditor.d.ts → ReportBuilder/useReportEditor.d.ts} +3 -7
  61. package/dist/components/{DashboardBuilder → ReportBuilder}/useSaveChannel.d.ts +6 -4
  62. package/dist/components/{DashboardBuilder → ReportBuilder}/useTileEditing.d.ts +2 -2
  63. package/dist/components/ServerProvider.d.ts +2 -1
  64. package/dist/components/drill/resolveDrill.d.ts +8 -1
  65. package/dist/components/drill/useDrillSelf.d.ts +4 -2
  66. package/dist/components/index.d.ts +2 -1
  67. package/dist/components/{Dashboard → legacy}/Dashboard.d.ts +15 -9
  68. package/dist/components/legacy/MalloynbCells.d.ts +13 -0
  69. package/dist/components/legacy/Notebook.d.ts +15 -0
  70. package/dist/components/{DashboardBuilder → legacy}/NotebookEditor.d.ts +3 -3
  71. package/dist/components/legacy/builderNames.d.ts +10 -0
  72. package/dist/components/legacy/index.d.ts +11 -0
  73. package/dist/components/legacy/kindAdapter.d.ts +11 -0
  74. package/dist/components/legacy/kindTypedDrafts.d.ts +10 -0
  75. package/dist/components/legacy/nameAlias.d.ts +44 -0
  76. package/dist/components/legacy/queryKeys.d.ts +8 -0
  77. package/dist/index.cjs.js +19 -19
  78. package/dist/index.es.js +8216 -7635
  79. package/dist/text/index.es.js +2 -2
  80. package/dist/{text-entry-CA0LZ1xL.es.js → text-entry-72YFLeNk.es.js} +10 -10
  81. package/dist/{useCompiledDocument-Bf72Ob5v.es.js → useCompiledDocument-1dgF5CC9.es.js} +4593 -4395
  82. package/dist/useCompiledDocument-BKyRnXmA.cjs.js +141 -0
  83. package/package.json +2 -2
  84. package/src/builder-entry.ts +32 -24
  85. package/src/components/Dashboard/DashboardTile.tsx +17 -0
  86. package/src/components/Dashboard/DashboardView.spec.tsx +0 -21
  87. package/src/components/Dashboard/DashboardView.tsx +8 -24
  88. package/src/components/Dashboard/dropValueUrlTags.spec.ts +1 -4
  89. package/src/components/Dashboard/index.ts +0 -2
  90. package/src/components/DocumentCreate/createDocument.spec.ts +346 -53
  91. package/src/components/DocumentCreate/createDocument.ts +143 -63
  92. package/src/components/DocumentCreate/documentPath.ts +41 -12
  93. package/src/components/DocumentCreate/guards.ts +7 -15
  94. package/src/components/DocumentCreate/index.ts +3 -7
  95. package/src/components/DocumentCreate/newNotebook.spec.ts +113 -43
  96. package/src/components/DocumentCreate/newNotebook.ts +32 -10
  97. package/src/components/DocumentStorage/BrowserDocumentStorage.spec.ts +130 -28
  98. package/src/components/DocumentStorage/BrowserDocumentStorage.ts +78 -40
  99. package/src/components/DocumentStorage/DocumentStorage.contract.spec.tsx +426 -0
  100. package/src/components/DocumentStorage/DocumentStorage.ts +57 -24
  101. package/src/components/Home/AddEnvironmentDialog.tsx +1 -1
  102. package/src/components/Home/Home.tsx +1 -1
  103. package/src/components/Loading.tsx +1 -1
  104. package/src/components/Model/SourcesExplorer.tsx +1 -1
  105. package/src/components/Notebook/NotebookCell.tsx +6 -5
  106. package/src/components/Notebook/cellKind.spec.ts +15 -7
  107. package/src/components/Package/ContentTypeIcon.tsx +16 -3
  108. package/src/components/Package/DataSchemaDialog.spec.tsx +85 -0
  109. package/src/components/Package/DataSchemaDialog.tsx +367 -0
  110. package/src/components/Package/NewDocumentDialog.spec.tsx +145 -88
  111. package/src/components/Package/NewDocumentDialog.tsx +93 -48
  112. package/src/components/Package/Package.agents.spec.tsx +76 -0
  113. package/src/components/Package/Package.artifacts.spec.tsx +79 -60
  114. package/src/components/Package/Package.create.spec.tsx +126 -112
  115. package/src/components/Package/Package.notebooks.spec.tsx +46 -27
  116. package/src/components/Package/Package.spec.tsx +43 -30
  117. package/src/components/Package/Package.tsx +217 -293
  118. package/src/components/Package/documentLocation.spec.ts +145 -50
  119. package/src/components/Package/documentLocation.ts +118 -39
  120. package/src/components/Package/index.ts +12 -3
  121. package/src/components/Package/reportQueries.ts +25 -0
  122. package/src/components/Package/useDocumentLocation.spec.ts +58 -0
  123. package/src/components/Package/useDocumentLocation.ts +90 -32
  124. package/src/components/Package/useDraftLayout.spec.tsx +143 -0
  125. package/src/components/Package/useDraftLayout.ts +81 -0
  126. package/src/components/Prose.spec.tsx +3 -3
  127. package/src/components/RenderedResult/RenderedResult.tsx +1 -1
  128. package/src/components/Report/CellReport.spec.tsx +155 -0
  129. package/src/components/{Notebook/Notebook.tsx → Report/CellReport.tsx} +178 -220
  130. package/src/components/Report/LinearReport.tsx +71 -0
  131. package/src/components/Report/Report.spec.tsx +238 -0
  132. package/src/components/Report/Report.telemetry.spec.tsx +292 -0
  133. package/src/components/Report/Report.tsx +277 -0
  134. package/src/components/Report/index.ts +12 -0
  135. package/src/components/Report/telemetry.spec.ts +90 -0
  136. package/src/components/Report/telemetry.ts +250 -0
  137. package/src/components/{DashboardBuilder → ReportBuilder}/BuilderDialogs.tsx +5 -5
  138. package/src/components/{DashboardBuilder → ReportBuilder}/BuilderGrid.tsx +2 -2
  139. package/src/components/{DashboardBuilder → ReportBuilder}/BuilderHeader.tsx +6 -7
  140. package/src/components/{DashboardBuilder → ReportBuilder}/BuilderToolbar.tsx +33 -0
  141. package/src/components/{DashboardBuilder → ReportBuilder}/DrillDialog.tsx +2 -2
  142. package/src/components/{DashboardBuilder → ReportBuilder}/EditorSurface.tsx +67 -107
  143. package/src/components/{DashboardBuilder → ReportBuilder}/FilterDialog.tsx +3 -4
  144. package/src/components/{DashboardBuilder/DashboardBuilder.charts.spec.tsx → ReportBuilder/ReportBuilder.charts.spec.tsx} +4 -4
  145. package/src/components/{DashboardBuilder/DashboardBuilder.exit.spec.tsx → ReportBuilder/ReportBuilder.exit.spec.tsx} +5 -5
  146. package/src/components/{DashboardBuilder/DashboardBuilder.inline.spec.tsx → ReportBuilder/ReportBuilder.inline.spec.tsx} +4 -4
  147. package/src/components/ReportBuilder/ReportBuilder.layoutSwitch.spec.tsx +145 -0
  148. package/src/components/{DashboardBuilder/DashboardBuilder.notebook.spec.tsx → ReportBuilder/ReportBuilder.notebook.spec.tsx} +22 -21
  149. package/src/components/{DashboardBuilder/DashboardBuilder.openDraft.spec.tsx → ReportBuilder/ReportBuilder.openDraft.spec.tsx} +3 -3
  150. package/src/components/{DashboardBuilder/DashboardBuilder.sources.spec.tsx → ReportBuilder/ReportBuilder.sources.spec.tsx} +19 -8
  151. package/src/components/{DashboardBuilder/DashboardBuilder.spec.tsx → ReportBuilder/ReportBuilder.spec.tsx} +34 -34
  152. package/src/components/{DashboardBuilder/DashboardBuilder.textTiles.spec.tsx → ReportBuilder/ReportBuilder.textTiles.spec.tsx} +5 -5
  153. package/src/components/{DashboardBuilder/DashboardBuilder.tsx → ReportBuilder/ReportBuilder.tsx} +46 -21
  154. package/src/components/{DashboardBuilder/DashboardEditor.authoritative.spec.tsx → ReportBuilder/ReportEditor.authoritative.spec.tsx} +28 -20
  155. package/src/components/{DashboardBuilder/DashboardEditor.emptyStart.spec.tsx → ReportBuilder/ReportEditor.emptyStart.spec.tsx} +19 -11
  156. package/src/components/{DashboardBuilder/DashboardEditor.filterTag.spec.tsx → ReportBuilder/ReportEditor.filterTag.spec.tsx} +7 -7
  157. package/src/components/{DashboardBuilder/DashboardEditor.notebook.spec.tsx → ReportBuilder/ReportEditor.notebook.spec.tsx} +70 -49
  158. package/src/components/{DashboardBuilder/DashboardEditor.package.spec.tsx → ReportBuilder/ReportEditor.package.spec.tsx} +52 -8
  159. package/src/components/{DashboardBuilder/DashboardEditor.resourceUri.spec.tsx → ReportBuilder/ReportEditor.resourceUri.spec.tsx} +50 -18
  160. package/src/components/{DashboardBuilder/DashboardEditor.spec.tsx → ReportBuilder/ReportEditor.spec.tsx} +65 -20
  161. package/src/components/{DashboardBuilder/DashboardEditor.textSource.spec.tsx → ReportBuilder/ReportEditor.textSource.spec.tsx} +6 -6
  162. package/src/components/{DashboardBuilder/DashboardEditor.tsx → ReportBuilder/ReportEditor.tsx} +92 -35
  163. package/src/components/{DashboardBuilder → ReportBuilder}/addTile.compile.spec.ts +1 -3
  164. package/src/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.spec.ts +1 -0
  165. package/src/components/{DashboardBuilder → ReportBuilder}/artifactBlock.spec.ts +21 -29
  166. package/src/components/ReportBuilder/builderReport.ts +53 -0
  167. package/src/components/{DashboardBuilder → ReportBuilder}/catalog.spec.ts +28 -10
  168. package/src/components/{DashboardBuilder → ReportBuilder}/catalog.ts +17 -10
  169. package/src/components/{DashboardBuilder → ReportBuilder}/controls.spec.ts +1 -0
  170. package/src/components/{DashboardBuilder → ReportBuilder}/document.ts +4 -7
  171. package/src/components/{DashboardBuilder → ReportBuilder}/documentSession.spec.ts +5 -5
  172. package/src/components/{DashboardBuilder → ReportBuilder}/documentSession.ts +1 -1
  173. package/src/components/{DashboardBuilder → ReportBuilder}/imports.spec.ts +6 -2
  174. package/src/components/{DashboardBuilder → ReportBuilder}/imports.ts +8 -4
  175. package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.chart.spec.ts +1 -1
  176. package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.convert.spec.ts +9 -13
  177. package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.read.spec.ts +15 -15
  178. package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.ts +7 -2
  179. package/src/components/{DashboardBuilder → ReportBuilder}/malloyTree.ts +25 -0
  180. package/src/components/{DashboardBuilder → ReportBuilder}/newDashboard.spec.ts +12 -4
  181. package/src/components/{DashboardBuilder → ReportBuilder}/newDashboard.ts +11 -24
  182. package/src/components/{DashboardBuilder → ReportBuilder}/preview.spec.ts +1 -0
  183. package/src/components/{DashboardBuilder → ReportBuilder}/readDocument.spec.ts +64 -36
  184. package/src/components/{DashboardBuilder → ReportBuilder}/readDocument.ts +33 -32
  185. package/src/components/ReportBuilder/readForEditor.spec.ts +96 -0
  186. package/src/components/{DashboardBuilder → ReportBuilder}/readForEditor.ts +3 -11
  187. package/src/components/ReportBuilder/reportTag.ts +108 -0
  188. package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.imports.spec.ts +28 -1
  189. package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.spec.ts +32 -3
  190. package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.ts +37 -60
  191. package/src/components/{DashboardBuilder → ReportBuilder}/tagParse.spec.ts +3 -3
  192. package/src/components/{DashboardBuilder → ReportBuilder}/testing/artifactTagParity.json +2 -2
  193. package/src/components/ReportBuilder/testing/drillResolution.json +279 -0
  194. package/src/components/ReportBuilder/testing/reportLayoutParity.json +125 -0
  195. package/src/components/{DashboardBuilder → ReportBuilder}/textTiles.spec.ts +66 -143
  196. package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSelection.ts +2 -2
  197. package/src/components/{DashboardBuilder → ReportBuilder}/useControlBindings.ts +2 -2
  198. package/src/components/ReportBuilder/useEditorCatalog.spec.tsx +156 -0
  199. package/src/components/ReportBuilder/useEditorCatalog.ts +119 -0
  200. package/src/components/{DashboardBuilder → ReportBuilder}/useHostCopy.ts +7 -5
  201. package/src/components/{DashboardBuilder → ReportBuilder}/useOpenedDocument.ts +56 -35
  202. package/src/components/{DashboardBuilder/useDashboardEditor.spec.ts → ReportBuilder/useReportEditor.spec.ts} +6 -6
  203. package/src/components/{DashboardBuilder/useDashboardEditor.ts → ReportBuilder/useReportEditor.ts} +6 -17
  204. package/src/components/{DashboardBuilder → ReportBuilder}/useSaveChannel.ts +36 -35
  205. package/src/components/{DashboardBuilder → ReportBuilder}/useTileEditing.ts +2 -2
  206. package/src/components/ServerProvider.tsx +2 -0
  207. package/src/components/drill/resolveDrill.ts +9 -2
  208. package/src/components/drill/useDrill.tsx +1 -0
  209. package/src/components/drill/useDrillSelf.spec.tsx +60 -7
  210. package/src/components/drill/useDrillSelf.ts +29 -12
  211. package/src/components/index.ts +2 -1
  212. package/src/components/{Dashboard → legacy}/Dashboard.spec.tsx +1 -1
  213. package/src/components/{Dashboard → legacy}/Dashboard.tsx +40 -28
  214. package/src/components/legacy/MalloynbCells.tsx +88 -0
  215. package/src/components/{Notebook → legacy}/Notebook.served.spec.tsx +17 -13
  216. package/src/components/{Notebook → legacy}/Notebook.spec.tsx +24 -20
  217. package/src/components/legacy/Notebook.tsx +44 -0
  218. package/src/components/{DashboardBuilder → legacy}/NotebookEditor.tsx +7 -4
  219. package/src/components/legacy/builderNames.ts +25 -0
  220. package/src/components/legacy/index.ts +20 -0
  221. package/src/components/legacy/kindAdapter.ts +19 -0
  222. package/src/components/legacy/kindTypedDrafts.ts +34 -0
  223. package/src/components/legacy/nameAlias.spec.ts +124 -0
  224. package/src/components/legacy/nameAlias.ts +95 -0
  225. package/src/components/legacy/queryKeys.ts +26 -0
  226. package/src/hooks/useGivensState.spec.ts +9 -9
  227. package/src/mainEntry.spec.ts +1 -1
  228. package/src/textEntry.spec.ts +9 -9
  229. package/src/utils/formatting.spec.ts +5 -5
  230. package/src/utils/parsing.spec.ts +1 -1
  231. package/src/utils/parsing.ts +1 -1
  232. package/dist/ServerProvider-Gj-im5VD.cjs.js +0 -1
  233. package/dist/components/Dashboard/telemetry.d.ts +0 -73
  234. package/dist/components/DashboardBuilder/builderReport.d.ts +0 -13
  235. package/dist/components/DashboardBuilder/telemetry.d.ts +0 -43
  236. package/dist/components/DocumentCreate/events.d.ts +0 -10
  237. package/dist/components/Notebook/Notebook.d.ts +0 -52
  238. package/dist/components/Notebook/index.d.ts +0 -1
  239. package/dist/useCompiledDocument-tBejqZ7s.cjs.js +0 -142
  240. package/src/components/Dashboard/telemetry.ts +0 -75
  241. package/src/components/DashboardBuilder/builderReport.ts +0 -74
  242. package/src/components/DashboardBuilder/readForEditor.spec.ts +0 -80
  243. package/src/components/DashboardBuilder/telemetry.ts +0 -47
  244. package/src/components/DashboardBuilder/testing/documentKindRule.json +0 -40
  245. package/src/components/DocumentCreate/events.ts +0 -15
  246. package/src/components/Notebook/index.ts +0 -4
  247. /package/dist/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.d.ts +0 -0
  248. /package/dist/components/{DashboardBuilder → ReportBuilder}/ChartPicker.d.ts +0 -0
  249. /package/dist/components/{DashboardBuilder → ReportBuilder}/DrillDialog.d.ts +0 -0
  250. /package/dist/components/{DashboardBuilder → ReportBuilder}/FilterDialog.d.ts +0 -0
  251. /package/dist/components/{DashboardBuilder → ReportBuilder}/FilterStrip.d.ts +0 -0
  252. /package/dist/components/{DashboardBuilder → ReportBuilder}/InlineMarkdown.d.ts +0 -0
  253. /package/dist/components/{DashboardBuilder → ReportBuilder}/InlineText.d.ts +0 -0
  254. /package/dist/components/{DashboardBuilder → ReportBuilder}/SourceViewPicker.d.ts +0 -0
  255. /package/dist/components/{DashboardBuilder → ReportBuilder}/TextTileBody.d.ts +0 -0
  256. /package/dist/components/{DashboardBuilder → ReportBuilder}/TileFrame.d.ts +0 -0
  257. /package/dist/components/{DashboardBuilder → ReportBuilder}/TileMenu.d.ts +0 -0
  258. /package/dist/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.d.ts +0 -0
  259. /package/dist/components/{DashboardBuilder → ReportBuilder}/annotationText.d.ts +0 -0
  260. /package/dist/components/{DashboardBuilder → ReportBuilder}/changedTile.d.ts +0 -0
  261. /package/dist/components/{DashboardBuilder → ReportBuilder}/chartLine.d.ts +0 -0
  262. /package/dist/components/{DashboardBuilder → ReportBuilder}/controls.d.ts +0 -0
  263. /package/dist/components/{DashboardBuilder → ReportBuilder}/inlineEdit.d.ts +0 -0
  264. /package/dist/components/{DashboardBuilder → ReportBuilder}/layout.d.ts +0 -0
  265. /package/dist/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.d.ts +0 -0
  266. /package/dist/components/{DashboardBuilder → ReportBuilder}/loadMalloy.d.ts +0 -0
  267. /package/dist/components/{DashboardBuilder → ReportBuilder}/openDraft.d.ts +0 -0
  268. /package/dist/components/{DashboardBuilder → ReportBuilder}/preview.d.ts +0 -0
  269. /package/dist/components/{DashboardBuilder → ReportBuilder}/sortable.d.ts +0 -0
  270. /package/dist/components/{DashboardBuilder → ReportBuilder}/spliceResult.d.ts +0 -0
  271. /package/dist/components/{DashboardBuilder → ReportBuilder}/tagParse.d.ts +0 -0
  272. /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/fixtures.d.ts +0 -0
  273. /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/inline.d.ts +0 -0
  274. /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/resize.d.ts +0 -0
  275. /package/dist/components/{DashboardBuilder → ReportBuilder}/tileDisplayTitle.d.ts +0 -0
  276. /package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.d.ts +0 -0
  277. /package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.d.ts +0 -0
  278. /package/dist/components/{DashboardBuilder → ReportBuilder}/useConversionConfirm.d.ts +0 -0
  279. /package/dist/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.d.ts +0 -0
  280. /package/dist/components/{DashboardBuilder → ReportBuilder}/useDraft.d.ts +0 -0
  281. /package/dist/components/{DashboardBuilder → ReportBuilder}/useExitGuard.d.ts +0 -0
  282. /package/dist/components/{DashboardBuilder → ReportBuilder}/useFilterForm.d.ts +0 -0
  283. /package/dist/components/{DashboardBuilder → ReportBuilder}/useOpenDraftCommit.d.ts +0 -0
  284. /package/dist/components/{DashboardBuilder → ReportBuilder}/useTileReorder.d.ts +0 -0
  285. /package/dist/components/{DashboardBuilder → ReportBuilder}/useTileResize.d.ts +0 -0
  286. /package/src/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.spec.tsx +0 -0
  287. /package/src/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.tsx +0 -0
  288. /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.render.spec.tsx +0 -0
  289. /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.spec.ts +0 -0
  290. /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.tsx +0 -0
  291. /package/src/components/{DashboardBuilder → ReportBuilder}/FilterStrip.tsx +0 -0
  292. /package/src/components/{DashboardBuilder → ReportBuilder}/InlineMarkdown.tsx +0 -0
  293. /package/src/components/{DashboardBuilder → ReportBuilder}/InlineText.tsx +0 -0
  294. /package/src/components/{DashboardBuilder → ReportBuilder}/SourceViewPicker.tsx +0 -0
  295. /package/src/components/{DashboardBuilder → ReportBuilder}/TextTileBody.tsx +0 -0
  296. /package/src/components/{DashboardBuilder → ReportBuilder}/TileFrame.tsx +0 -0
  297. /package/src/components/{DashboardBuilder → ReportBuilder}/TileMenu.tsx +0 -0
  298. /package/src/components/{DashboardBuilder → ReportBuilder}/__test__/inventory.ts +0 -0
  299. /package/src/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.ts +0 -0
  300. /package/src/components/{DashboardBuilder → ReportBuilder}/annotationText.spec.ts +0 -0
  301. /package/src/components/{DashboardBuilder → ReportBuilder}/annotationText.ts +0 -0
  302. /package/src/components/{DashboardBuilder → ReportBuilder}/artifactTagParity.spec.ts +0 -0
  303. /package/src/components/{DashboardBuilder → ReportBuilder}/catalog.aggregate.spec.ts +0 -0
  304. /package/src/components/{DashboardBuilder → ReportBuilder}/changedTile.spec.ts +0 -0
  305. /package/src/components/{DashboardBuilder → ReportBuilder}/changedTile.ts +0 -0
  306. /package/src/components/{DashboardBuilder → ReportBuilder}/chartLine.spec.ts +0 -0
  307. /package/src/components/{DashboardBuilder → ReportBuilder}/chartLine.ts +0 -0
  308. /package/src/components/{DashboardBuilder → ReportBuilder}/controls.ts +0 -0
  309. /package/src/components/{DashboardBuilder → ReportBuilder}/emptyStart.spec.ts +0 -0
  310. /package/src/components/{DashboardBuilder → ReportBuilder}/inlineEdit.tsx +0 -0
  311. /package/src/components/{DashboardBuilder → ReportBuilder}/invariants.spec.ts +0 -0
  312. /package/src/components/{DashboardBuilder → ReportBuilder}/keepRowStructure.spec.ts +0 -0
  313. /package/src/components/{DashboardBuilder → ReportBuilder}/layout.ts +0 -0
  314. /package/src/components/{DashboardBuilder → ReportBuilder}/loadMalloy.spec.ts +0 -0
  315. /package/src/components/{DashboardBuilder → ReportBuilder}/loadMalloy.ts +0 -0
  316. /package/src/components/{DashboardBuilder → ReportBuilder}/malloyTree.spec.ts +0 -0
  317. /package/src/components/{DashboardBuilder → ReportBuilder}/moveIntoGap.spec.ts +0 -0
  318. /package/src/components/{DashboardBuilder → ReportBuilder}/openDraft.ts +0 -0
  319. /package/src/components/{DashboardBuilder → ReportBuilder}/preview.shapes.spec.ts +0 -0
  320. /package/src/components/{DashboardBuilder → ReportBuilder}/preview.ts +0 -0
  321. /package/src/components/{DashboardBuilder → ReportBuilder}/scannerShapes.spec.ts +0 -0
  322. /package/src/components/{DashboardBuilder → ReportBuilder}/sortable.spec.ts +0 -0
  323. /package/src/components/{DashboardBuilder → ReportBuilder}/sortable.tsx +0 -0
  324. /package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.chart.spec.ts +0 -0
  325. /package/src/components/{DashboardBuilder → ReportBuilder}/spliceResult.ts +0 -0
  326. /package/src/components/{DashboardBuilder → ReportBuilder}/statementExtent.spec.ts +0 -0
  327. /package/src/components/{DashboardBuilder → ReportBuilder}/tagParse.ts +0 -0
  328. /package/src/components/{DashboardBuilder → ReportBuilder}/testing/fixtures.ts +0 -0
  329. /package/src/components/{DashboardBuilder → ReportBuilder}/testing/inline.ts +0 -0
  330. /package/src/components/{DashboardBuilder → ReportBuilder}/testing/resize.ts +0 -0
  331. /package/src/components/{DashboardBuilder → ReportBuilder}/testing/urlRenderTags.json +0 -0
  332. /package/src/components/{DashboardBuilder → ReportBuilder}/tileDisplayTitle.ts +0 -0
  333. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.spec.ts +0 -0
  334. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.ts +0 -0
  335. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.overlay.spec.tsx +0 -0
  336. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.spec.tsx +0 -0
  337. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.ts +0 -0
  338. /package/src/components/{DashboardBuilder → ReportBuilder}/useConversionConfirm.ts +0 -0
  339. /package/src/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.spec.ts +0 -0
  340. /package/src/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.ts +0 -0
  341. /package/src/components/{DashboardBuilder → ReportBuilder}/useDraft.ts +0 -0
  342. /package/src/components/{DashboardBuilder → ReportBuilder}/useExitGuard.spec.ts +0 -0
  343. /package/src/components/{DashboardBuilder → ReportBuilder}/useExitGuard.ts +0 -0
  344. /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.existing.spec.tsx +0 -0
  345. /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.spec.tsx +0 -0
  346. /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.ts +0 -0
  347. /package/src/components/{DashboardBuilder → ReportBuilder}/useOpenDraftCommit.ts +0 -0
  348. /package/src/components/{DashboardBuilder → ReportBuilder}/useTileReorder.spec.tsx +0 -0
  349. /package/src/components/{DashboardBuilder → ReportBuilder}/useTileReorder.ts +0 -0
  350. /package/src/components/{DashboardBuilder → ReportBuilder}/useTileResize.spec.tsx +0 -0
  351. /package/src/components/{DashboardBuilder → ReportBuilder}/useTileResize.ts +0 -0
  352. /package/src/components/{DashboardBuilder → ReportBuilder}/withGaps.spec.ts +0 -0
  353. /package/src/components/{Notebook → legacy}/Notebook.layout.spec.tsx +0 -0
@@ -8,7 +8,7 @@ import {
8
8
  chartOf,
9
9
  docOf,
10
10
  filterableFields,
11
- isDashboardModel,
11
+ isReportModel,
12
12
  } from "./catalog";
13
13
 
14
14
  /** A `modelInfo` exporting these sources, and a named query beside them. */
@@ -126,15 +126,33 @@ describe("buildCatalog", () => {
126
126
  expect(catalog.sources[0].views).toHaveLength(2);
127
127
  });
128
128
 
129
- // Offering a dashboard's own tiles as things to put on a dashboard would be
130
- // circular, and the endpoint lists dashboards because they are models too.
131
- it("leaves dashboards out", () => {
132
- expect(isDashboardModel("dashboards/overview.malloy")).toBe(true);
133
- expect(isDashboardModel("data_app.malloy")).toBe(false);
134
- const catalog = buildCatalog([
135
- { ...MODEL, modelPath: "dashboards/overview.malloy" } as CompiledModel,
136
- ]);
137
- expect(catalog.sources).toEqual([]);
129
+ // Offering a report's own tiles as things to put on a report would be
130
+ // circular, and the endpoint lists reports because they are models too. The
131
+ // listed report paths decide it, never a directory name.
132
+ it("leaves the listed reports out, wherever they live", () => {
133
+ const reports = new Set(["overview.malloy", "sales/q3.malloy"]);
134
+ expect(isReportModel("overview.malloy", reports)).toBe(true);
135
+ expect(isReportModel("sales/q3.malloy", reports)).toBe(true);
136
+ expect(isReportModel("dashboards/overview.malloy", reports)).toBe(false);
137
+ expect(isReportModel("data_app.malloy", reports)).toBe(false);
138
+ expect(isReportModel(undefined, reports)).toBe(false);
139
+ for (const modelPath of ["overview.malloy", "sales/q3.malloy"])
140
+ expect(
141
+ buildCatalog([{ ...MODEL, modelPath } as CompiledModel], reports)
142
+ .sources,
143
+ ).toEqual([]);
144
+ // A model in a directory once named for dashboards is a model like any other.
145
+ expect(
146
+ buildCatalog(
147
+ [
148
+ {
149
+ ...MODEL,
150
+ modelPath: "dashboards/shared.malloy",
151
+ } as CompiledModel,
152
+ ],
153
+ reports,
154
+ ).sources,
155
+ ).toHaveLength(1);
138
156
  });
139
157
 
140
158
  // `sources` also lists names a model only imports; an import of one of
@@ -196,12 +196,15 @@ export function filterableFields(
196
196
  }
197
197
 
198
198
  /**
199
- * A dashboard file is itself a model, so the endpoint lists it alongside the
200
- * real ones. Offering a dashboard's own tile views as things to put on a
201
- * dashboard would be circular, so they are left out.
199
+ * A report file is itself a model, so the models endpoint may list it beside
200
+ * the real ones. Offering a report's own tile views as things to put on a
201
+ * report would be circular, so they are left out, by the paths the package's
202
+ * report listing names: where a file lives never says whether it is a report.
202
203
  */
203
- export const isDashboardModel = (path: string | undefined) =>
204
- (path ?? "").startsWith("dashboards/");
204
+ export const isReportModel = (
205
+ path: string | undefined,
206
+ reportPaths: ReadonlySet<string>,
207
+ ) => path !== undefined && reportPaths.has(path);
205
208
 
206
209
  /**
207
210
  * The model's own path.
@@ -209,13 +212,17 @@ export const isDashboardModel = (path: string | undefined) =>
209
212
  * Two spellings, and the generated client only knows one: the models LIST
210
213
  * returns `path`, while a single model returns `modelPath`. Reading `path`
211
214
  * alone yields an empty string against the real server, which silently disables
212
- * the dashboard exclusion below and leaves a preview with nothing to run
213
- * against. Measured, not deduced from the type.
215
+ * the report exclusion below and leaves a preview with nothing to run
216
+ * against.
214
217
  */
215
218
  const pathOf = (model: CompiledModel): string =>
216
219
  (model as { modelPath?: string }).modelPath ?? model.path ?? "";
217
220
 
218
- export function buildCatalog(models: CompiledModel[]): PackageCatalog {
221
+ export function buildCatalog(
222
+ models: CompiledModel[],
223
+ /** The package's report paths (`GET …/reports`), left out of the catalog. */
224
+ reportPaths: ReadonlySet<string> = new Set(),
225
+ ): PackageCatalog {
219
226
  const sources: CatalogSource[] = [];
220
227
  const seen = new Set<string>();
221
228
  const exporters = new Map<string, string[]>();
@@ -223,7 +230,7 @@ export function buildCatalog(models: CompiledModel[]): PackageCatalog {
223
230
  const listed = new Map<string, string[]>();
224
231
  for (const model of models) {
225
232
  const modelPath = pathOf(model);
226
- if (isDashboardModel(modelPath)) continue;
233
+ if (isReportModel(modelPath, reportPaths)) continue;
227
234
  const names = exportedSources(model.modelInfo);
228
235
  exported.set(model, names);
229
236
  for (const { name } of model.sources ?? [])
@@ -234,7 +241,7 @@ export function buildCatalog(models: CompiledModel[]): PackageCatalog {
234
241
 
235
242
  for (const model of models) {
236
243
  const modelPath = pathOf(model);
237
- if (isDashboardModel(modelPath)) continue;
244
+ if (isReportModel(modelPath, reportPaths)) continue;
238
245
  const fields = fieldsOf(model);
239
246
  const aggregates = aggregateViewsOf(model);
240
247
 
@@ -21,6 +21,7 @@ import type { DashboardDocument } from "./document";
21
21
  import { queryTile } from "./testing/fixtures";
22
22
 
23
23
  const doc = (): DashboardDocument => ({
24
+ layout: "grid",
24
25
  title: "T",
25
26
  imports: [{ kind: "names", names: ["order_items"], from: "../m.malloy" }],
26
27
  sources: [{ name: "a", base: "order_items" }],
@@ -2,8 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
 
4
4
  /**
5
- * The dashboard builder's working representation of a `dashboards/*.malloy`
6
- * file.
5
+ * The builder's working representation of a report file.
7
6
  *
8
7
  * This is an editing PROJECTION, not a complete representation of the file, and
9
8
  * the distinction is load-bearing. The builder writes changes by SPLICING the
@@ -21,6 +20,7 @@
21
20
  * opening it half-understood. See {@link readDashboardDocument}.
22
21
  */
23
22
 
23
+ import type { ReportLayout } from "../Package/documentLocation";
24
24
  import type { ChartState } from "./chartLine";
25
25
 
26
26
  /** One `import` line. The file needs both forms, and for different reasons. */
@@ -237,12 +237,9 @@ export interface DashboardDimension {
237
237
  expression: string;
238
238
  }
239
239
 
240
- /** Which surface the file is: a notebook is the same file with one column. */
241
- export type DocumentKind = "dashboard" | "notebook";
242
-
243
240
  export interface DashboardDocument {
244
- /** `## artifact { kind=… }`; the reader leaves it out for a dashboard. */
245
- kind?: DocumentKind;
241
+ /** The report's layout, as its tag decides it: a linear report is the same file drawn as one column. */
242
+ layout: ReportLayout;
246
243
  title: string;
247
244
  /** The narrative header, as markdown. Emitted as `##"` lines. */
248
245
  description?: string;
@@ -172,7 +172,7 @@ describe("resolveEditorTarget", () => {
172
172
 
173
173
  describe("withWorkspace", () => {
174
174
  const saved: { type: string; where: string; workspace?: string } = {
175
- type: "dashboard.saved",
175
+ type: "report.saved",
176
176
  where: "host",
177
177
  };
178
178
 
@@ -185,24 +185,24 @@ describe("withWorkspace", () => {
185
185
 
186
186
  it("names the workspace on an undone save a workspace took, and not on a refused one", () => {
187
187
  const undone: { type: string; where: string; workspace?: string } = {
188
- type: "notebook.save_undone",
188
+ type: "report.save_undone",
189
189
  where: "host",
190
190
  };
191
191
  expect(withWorkspace(undone, "records")).toEqual({
192
192
  ...undone,
193
193
  workspace: "records",
194
194
  });
195
- const refused = { type: "notebook.save_undo_refused", reason: "x" };
195
+ const refused = { type: "report.save_undo_refused", reason: "x" };
196
196
  expect(withWorkspace(refused, "records")).toBe(refused);
197
197
  });
198
198
 
199
199
  it("leaves a package save alone", () => {
200
- const pkg = { type: "notebook.saved", where: "package" };
200
+ const pkg = { type: "report.saved", where: "package" };
201
201
  expect(withWorkspace(pkg, "records")).toBe(pkg);
202
202
  });
203
203
 
204
204
  it("leaves other events and an unnamed workspace alone", () => {
205
- const refused = { type: "dashboard.save_refused", reason: "x" };
205
+ const refused = { type: "report.save_refused", reason: "x" };
206
206
  expect(withWorkspace(refused, "records")).toBe(refused);
207
207
  expect(withWorkspace(saved, undefined)).toBe(saved);
208
208
  });
@@ -11,7 +11,7 @@ import type { ApiClients } from "../ServerProvider";
11
11
  // workspace it opens against, where Save goes, and the hash a package write
12
12
  // carries. The dashboard and notebook hosts both decide these the same way.
13
13
 
14
- import type { SavesTo } from "../Dashboard/telemetry";
14
+ import type { SavesTo } from "../Report/telemetry";
15
15
 
16
16
  export type { SavesTo };
17
17
 
@@ -17,10 +17,14 @@ describe("importPathOf", () => {
17
17
  expect(importPathOf("storefront.malloy", "notebooks/sub/x.malloy")).toBe(
18
18
  "../../storefront.malloy",
19
19
  );
20
+ // Beside it: the bare name, with no leading `./`.
20
21
  expect(importPathOf("models/m.malloy", "models/x.malloy")).toBe(
21
- "./m.malloy",
22
+ "m.malloy",
23
+ );
24
+ expect(importPathOf("m.malloy", "x.malloy")).toBe("m.malloy");
25
+ expect(importPathOf("models/m.malloy", "x.malloy")).toBe(
26
+ "models/m.malloy",
22
27
  );
23
- expect(importPathOf("m.malloy", "x.malloy")).toBe("./m.malloy");
24
28
  });
25
29
  });
26
30
 
@@ -3,8 +3,8 @@
3
3
 
4
4
  import type { DashboardDocument, DashboardImport } from "./document";
5
5
 
6
- /** Where a document sits when the caller does not say: one folder below the package root. */
7
- const DEFAULT_DOCUMENT_PATH = "dashboards/document.malloy";
6
+ /** Where a report sits when the caller does not say: the package root. */
7
+ const DEFAULT_DOCUMENT_PATH = "document.malloy";
8
8
 
9
9
  /** The folder a package path sits in, with its trailing slash, or "" at the root. */
10
10
  const folderOf = (path: string) => path.slice(0, path.lastIndexOf("/") + 1);
@@ -21,7 +21,11 @@ const resolvedOf = (from: string, documentPath: string) =>
21
21
  `https://malloy.invalid/${folderOf(documentPath)}`,
22
22
  ).pathname.slice(1);
23
23
 
24
- /** How the document at `documentPath` names the model at `modelPath`. */
24
+ /**
25
+ * How the report at `documentPath` names the model at `modelPath`: relative to
26
+ * the report's own folder, with no leading `./` (`"storefront.malloy"` beside
27
+ * it, `"../storefront.malloy"` from one folder down).
28
+ */
25
29
  export function importPathOf(modelPath: string, documentPath: string): string {
26
30
  const from = folderOf(documentPath).split("/").filter(Boolean);
27
31
  const to = modelPath.split("/");
@@ -33,7 +37,7 @@ export function importPathOf(modelPath: string, documentPath: string): string {
33
37
  )
34
38
  shared++;
35
39
  const up = from.length - shared;
36
- return `${up === 0 ? "./" : "../".repeat(up)}${to.slice(shared).join("/")}`;
40
+ return `${"../".repeat(up)}${to.slice(shared).join("/")}`;
37
41
  }
38
42
 
39
43
  /**
@@ -9,7 +9,7 @@ import {
9
9
  } from "./legacyNotebook";
10
10
 
11
11
  const HEAD =
12
- '## artifact { kind=notebook }\nsource: a is duckdb.sql("select 1 as x")\n\n';
12
+ '## artifact { layout=linear }\nsource: a is duckdb.sql("select 1 as x")\n\n';
13
13
 
14
14
  async function read(text: string): Promise<NotebookSource> {
15
15
  const result = await readNotebookSource(text);
@@ -22,7 +22,7 @@ import {
22
22
  const REPO = path.resolve(import.meta.dir, "../../../../..");
23
23
  const CATEGORY_REVIEW = path.join(
24
24
  REPO,
25
- "examples/storefront/notebooks/category-review.malloy",
25
+ "examples/storefront/category-review.malloy",
26
26
  );
27
27
  const FIXTURES = path.join(
28
28
  REPO,
@@ -79,7 +79,7 @@ async function compiled(pkg: string, file: string, text: string) {
79
79
  }
80
80
 
81
81
  const HEAD = `##! experimental.givens
82
- ## artifact { kind=notebook title="T" }
82
+ ## artifact { layout=linear title="T" }
83
83
  import "../models/orders.malloy"
84
84
  `;
85
85
 
@@ -90,7 +90,7 @@ describe("convertLegacyNotebook: the storefront category review", () => {
90
90
  expect(await syntaxErrors(converted)).toEqual([]);
91
91
 
92
92
  const doc = await document(converted);
93
- expect(doc.kind).toBe("notebook");
93
+ expect(doc.layout).toBe("linear");
94
94
  expect(doc.title).toBe("Category review");
95
95
  expect(doc.description).toContain("One category at a time");
96
96
  expect(
@@ -164,11 +164,7 @@ describe("convertLegacyNotebook: the storefront category review", () => {
164
164
  it("compiles under Malloy and its views run", async () => {
165
165
  const pkg = path.join(REPO, "examples/storefront");
166
166
  const converted = await convert(read(CATEGORY_REVIEW));
167
- const model = await compiled(
168
- pkg,
169
- "notebooks/converted.malloy",
170
- converted,
171
- );
167
+ const model = await compiled(pkg, "converted.malloy", converted);
172
168
  try {
173
169
  for (const view of [
174
170
  "revenue_by_month",
@@ -278,7 +274,7 @@ describe("convertLegacyNotebook: every cell-format notebook in the corpus", () =
278
274
 
279
275
  it("refuses a tag whose artifact property is not the first, rather than rewriting it", async () => {
280
276
  const result = await refusal(
281
- `##! experimental.givens\n## dashboard { columns=2 } artifact { kind=notebook title="T" }\nimport "../m.malloy"\n\nrun: orders -> kpis\n`,
277
+ `##! experimental.givens\n## dashboard { columns=2 } artifact { layout=linear title="T" }\nimport "../m.malloy"\n\nrun: orders -> kpis\n`,
282
278
  );
283
279
  expect(result.refused).toContain("`artifact { … }` first");
284
280
  expect(result.line).toBe(2);
@@ -501,12 +497,12 @@ describe("convertLegacyNotebook: shapes", () => {
501
497
  const cells = "\n##(markdown) Hello\n\nrun: orders -> kpis\n";
502
498
  const fromLine = await convert(`${HEAD}${cells}`);
503
499
  expect(fromLine).toContain(
504
- '##| artifact { kind=notebook title="T"\n tiles=[\n text_1 { kind=text },\n "orders_tiles -> tile_1"\n ]\n}\n|##\n',
500
+ '##| artifact { layout=linear title="T"\n tiles=[\n text_1 { kind=text },\n "orders_tiles -> tile_1"\n ]\n}\n|##\n',
505
501
  );
506
- const block = `##! experimental.givens\n##| artifact { kind=notebook\n title="T"\n}\n|##\nimport "../models/orders.malloy"\n${cells}`;
502
+ const block = `##! experimental.givens\n##| artifact { layout=linear\n title="T"\n}\n|##\nimport "../models/orders.malloy"\n${cells}`;
507
503
  const fromBlock = await convert(block);
508
504
  expect(fromBlock).toContain(
509
- '##| artifact { kind=notebook\n title="T"\n tiles=[\n text_1 { kind=text },\n "orders_tiles -> tile_1"\n ]\n}\n|##\n',
505
+ '##| artifact { layout=linear\n title="T"\n tiles=[\n text_1 { kind=text },\n "orders_tiles -> tile_1"\n ]\n}\n|##\n',
510
506
  );
511
507
  expect(await syntaxErrors(fromBlock)).toEqual([]);
512
508
  expect((await document(fromBlock)).tiles.map((t) => t.name)).toEqual([
@@ -519,7 +515,7 @@ describe("convertLegacyNotebook: shapes", () => {
519
515
  const converted = await convert(HEAD);
520
516
  const doc = await document(converted);
521
517
  expect(doc.tiles).toEqual([]);
522
- expect(doc.kind).toBe("notebook");
518
+ expect(doc.layout).toBe("linear");
523
519
  });
524
520
 
525
521
  it("carries the tags above a consumed query onto the view it becomes, and names the view from its label", async () => {
@@ -159,7 +159,7 @@ describe("readNotebookSource: the server reader is the oracle", () => {
159
159
  ];
160
160
  for (const [name, prose] of LEGACY) {
161
161
  it(`reads the legacy ${name} spelling as a markdown cell`, async () => {
162
- const text = `## artifact { kind=notebook }\nsource: a is duckdb.sql("select 1 as x")\n\n${prose}\nrun: a -> { select: x }\n`;
162
+ const text = `## artifact { layout=linear }\nsource: a is duckdb.sql("select 1 as x")\n\n${prose}\nrun: a -> { select: x }\n`;
163
163
  const mine = await expectMatchesOracle(text);
164
164
  expect(mine.cells.map((c) => c.kind)).toEqual([
165
165
  "definition",
@@ -171,7 +171,7 @@ describe("readNotebookSource: the server reader is the oracle", () => {
171
171
 
172
172
  it("keeps a non-prose note in the header before the first cell, and in the gap after it", async () => {
173
173
  const text = [
174
- "## artifact { kind=notebook }",
174
+ "## artifact { layout=linear }",
175
175
  '## title="In the header"',
176
176
  "##(markdown) First cell.",
177
177
  '## title="A gap note"',
@@ -180,7 +180,7 @@ describe("readNotebookSource: the server reader is the oracle", () => {
180
180
  ].join("\n");
181
181
  const mine = await expectMatchesOracle(text);
182
182
  expect(text.slice(mine.header.start, mine.header.end)).toBe(
183
- '## artifact { kind=notebook }\n## title="In the header"\n',
183
+ '## artifact { layout=linear }\n## title="In the header"\n',
184
184
  );
185
185
  expect(mine.cells.map((c) => c.markdown)).toEqual([
186
186
  "First cell.",
@@ -191,7 +191,7 @@ describe("readNotebookSource: the server reader is the oracle", () => {
191
191
 
192
192
  it("carries a comment block directly above a cell, and leaves one after a blank line in the gap", async () => {
193
193
  const text = [
194
- "## artifact { kind=notebook }",
194
+ "## artifact { layout=linear }",
195
195
  'source: a is duckdb.sql("select 1 as x")',
196
196
  "",
197
197
  "// Stays in the gap.",
@@ -225,7 +225,7 @@ describe("readNotebookSource: the server reader is the oracle", () => {
225
225
 
226
226
  it("reads a block whose closer is followed only by whitespace", async () => {
227
227
  const text =
228
- '## artifact { kind=notebook }\nsource: a is duckdb.sql("select 1 as x")\n##|(markdown)\nBody.\n|## \n#|(markdown)\nhi\n|# \t\nrun: a -> { select: x }\n';
228
+ '## artifact { layout=linear }\nsource: a is duckdb.sql("select 1 as x")\n##|(markdown)\nBody.\n|## \n#|(markdown)\nhi\n|# \t\nrun: a -> { select: x }\n';
229
229
  const mine = await expectMatchesOracle(text);
230
230
  expect(mine.cells.map((c) => c.markdown)).toEqual([
231
231
  undefined,
@@ -236,7 +236,7 @@ describe("readNotebookSource: the server reader is the oracle", () => {
236
236
 
237
237
  it("measures spans in UTF-16 units past astral characters", async () => {
238
238
  const text =
239
- '## artifact { kind=notebook }\n##(markdown) Rockets 🚀🚀 first.\n\nsource: a is duckdb.sql("select 1 as x")\n\nrun: a -> { select: x }\n';
239
+ '## artifact { layout=linear }\n##(markdown) Rockets 🚀🚀 first.\n\nsource: a is duckdb.sql("select 1 as x")\n\nrun: a -> { select: x }\n';
240
240
  const mine = await expectMatchesOracle(text);
241
241
  expect(text.slice(mine.cells[2].span.start, mine.cells[2].span.end)).toBe(
242
242
  "run: a -> { select: x }\n",
@@ -280,7 +280,7 @@ describe("readNotebookSource: refusals", () => {
280
280
  const REFUSE: [string, string, RegExp][] = [
281
281
  [
282
282
  "a syntax error",
283
- "## artifact { kind=notebook }\nrun: a -> {\n",
283
+ "## artifact { layout=linear }\nrun: a -> {\n",
284
284
  /^Line \d+: Malloy could not parse this notebook .*Fix: correct the syntax/,
285
285
  ],
286
286
  [
@@ -290,42 +290,42 @@ describe("readNotebookSource: refusals", () => {
290
290
  ],
291
291
  [
292
292
  "a # tag that annotates nothing",
293
- '## artifact { kind=notebook }\nsource: a is duckdb.sql("select 1")\n# bar_chart\n',
293
+ '## artifact { layout=linear }\nsource: a is duckdb.sql("select 1")\n# bar_chart\n',
294
294
  /^Line 3: a # tag that annotates no statement/,
295
295
  ],
296
296
  [
297
297
  "two statements on one line",
298
- '## artifact { kind=notebook }\nsource: a is duckdb.sql("select 1 as x"); run: a -> { select: x }\n',
298
+ '## artifact { layout=linear }\nsource: a is duckdb.sql("select 1 as x"); run: a -> { select: x }\n',
299
299
  /^Line 2: a line holding two statements.*Fix: put each statement and note on its own line\.$/,
300
300
  ],
301
301
  [
302
302
  "a block comment that straddles a cell's last line",
303
- '## artifact { kind=notebook }\nsource: a is duckdb.sql("select 1 as x") /* runs\non */\nrun: a -> { select: x }\n',
303
+ '## artifact { layout=linear }\nsource: a is duckdb.sql("select 1 as x") /* runs\non */\nrun: a -> { select: x }\n',
304
304
  /^Line 2: a comment that straddles a cell/,
305
305
  ],
306
306
  [
307
307
  "a lone carriage return",
308
- "## artifact { kind=notebook }\r##(markdown) Prose.\n",
308
+ "## artifact { layout=linear }\r##(markdown) Prose.\n",
309
309
  /^Line 1: a carriage return/,
310
310
  ],
311
311
  [
312
312
  "words after a floating block's closer",
313
- "## artifact { kind=notebook }\n##|(markdown)\nBody.\n|## more words\n",
313
+ "## artifact { layout=linear }\n##|(markdown)\nBody.\n|## more words\n",
314
314
  /^Line 4: the text after a block's closer \(`more words`\)/,
315
315
  ],
316
316
  [
317
317
  "a run: after a floating block's closer",
318
- '## artifact { kind=notebook }\nsource: a is duckdb.sql("select 1 as x")\n##|(markdown)\nBody.\n|## run: a -> { select: x }\n',
318
+ '## artifact { layout=linear }\nsource: a is duckdb.sql("select 1 as x")\n##|(markdown)\nBody.\n|## run: a -> { select: x }\n',
319
319
  /^Line 5: the text after a block's closer \(`run: a -> \{ select: x \}`\)/,
320
320
  ],
321
321
  [
322
322
  "words after an attached block's closer",
323
- '## artifact { kind=notebook }\nsource: a is duckdb.sql("select 1 as x")\n#|(markdown)\nhi\n|# extra\nrun: a -> { select: x }\n',
323
+ '## artifact { layout=linear }\nsource: a is duckdb.sql("select 1 as x")\n#|(markdown)\nhi\n|# extra\nrun: a -> { select: x }\n',
324
324
  /^Line 5: the text after a block's closer \(`extra`\)/,
325
325
  ],
326
326
  [
327
327
  "words after a header block's closer",
328
- '##|"\nDesc\n|## oops\n## artifact { kind=notebook }\n##(markdown) Prose.\n',
328
+ '##|"\nDesc\n|## oops\n## artifact { layout=linear }\n##(markdown) Prose.\n',
329
329
  /^Line 3: the text after a block's closer \(`oops`\)/,
330
330
  ],
331
331
  ];
@@ -469,7 +469,7 @@ export async function readNotebookSource(
469
469
  if (artifactAt < 0)
470
470
  return refuse(
471
471
  0,
472
- "this file has no ## artifact note, so it is not a notebook the builder can edit. Fix: add `## artifact { kind=notebook }` after the ##! line.",
472
+ "this file has no ## artifact note, so it is not a notebook the builder can edit. Fix: add `## artifact { layout=linear }` after the ##! line.",
473
473
  );
474
474
  const above = items.findIndex(
475
475
  (item, index) => index < artifactAt && item.kind === "statement",
@@ -1057,8 +1057,13 @@ export async function convertLegacyNotebook(
1057
1057
  entries.length === 0
1058
1058
  ? "\n tiles=[]\n"
1059
1059
  : `\n tiles=[\n${entries.map((e) => ` ${e}`).join(",\n")}\n ]\n`;
1060
- const rewritten = `${artifact.text
1060
+ // A tile list with no stated layout reads as grid, so the converted tag says
1061
+ // `layout=linear` outright, in place of any `layout=` it had.
1062
+ const head = artifact.text
1061
1063
  .slice(0, close)
1064
+ .replace(/[ \t]*\blayout\s*=\s*(?:"(?:[^"\\]|\\.)*"|[^\s}]+)/g, "")
1065
+ .replace(/\bartifact\s*\{/, (open) => `${open} layout=linear`);
1066
+ const rewritten = `${head
1062
1067
  .trimEnd()
1063
1068
  .replace(/^##(?!\|)/, "##|")}${entryList}${artifact.text.slice(close)}`;
1064
1069
  headerLines.splice(
@@ -176,6 +176,8 @@ export interface ParsedMalloy {
176
176
  givens: TreeGiven[];
177
177
  /** The closed floating `(markdown)` / `(text)` blocks, in file order. */
178
178
  textBlocks: TreeTextBlock[];
179
+ /** The file's own model-level notes (`##` lines and `##|` blocks), as written; a report's tag is read from these. */
180
+ modelNotes: string[];
179
181
  /** The comment token on `line`, if the line ends with one. */
180
182
  trailingComment(line: number): Span | undefined;
181
183
  /**
@@ -299,6 +301,28 @@ function lineStartsOf(text: string): number[] {
299
301
  return out;
300
302
  }
301
303
 
304
+ /**
305
+ * The model-level notes of a parse: each top-level statement's own
306
+ * `docAnnotations`, as written, a `##|` block without its closer. The
307
+ * server's `modelNotesOfParse` reads the same notes, so a report's tag is
308
+ * read from the same text on both sides.
309
+ */
310
+ export function readModelNotes(r: Reader, root: Ctx): string[] {
311
+ const notes: string[] = [];
312
+ for (let i = 0; i < (root.childCount ?? 0); i++) {
313
+ const child = root.getChild(i);
314
+ if (!isRule(child)) continue;
315
+ const group = call(child, "docAnnotations");
316
+ if (!group) continue;
317
+ for (const note of callAll(group, "docAnnotation")) {
318
+ const text = r.text_(note);
319
+ if (text !== undefined)
320
+ notes.push(text.replace(/\r?\n\|##[^\n]*\n?$/, ""));
321
+ }
322
+ }
323
+ return notes;
324
+ }
325
+
302
326
  /* ------------------------------------------------------------------ */
303
327
 
304
328
  export class Reader {
@@ -833,6 +857,7 @@ export async function parseMalloy(text: string): Promise<ParseResult> {
833
857
  sources,
834
858
  givens: readGivens(r, root),
835
859
  textBlocks: readTextBlocks(r, tokenStream),
860
+ modelNotes: readModelNotes(r, root),
836
861
  trailingComment: (line) => comments.trailing.get(line),
837
862
  comments: comments.all,
838
863
  commentLine: (line) => comments.lines.has(line),
@@ -17,7 +17,7 @@ describe("a new dashboard", () => {
17
17
  expect(slugFor("***")).toBe("");
18
18
  });
19
19
 
20
- it("is a file the builder opens, with the picked view as its first tile", async () => {
20
+ it("is a grid report the builder opens: an intro text tile, then the picked view", async () => {
21
21
  const text = newDashboardSource({
22
22
  title: 'Sales "West"',
23
23
  modelPath: "models/storefront.malloy",
@@ -25,22 +25,27 @@ describe("a new dashboard", () => {
25
25
  view: "by_category",
26
26
  });
27
27
  expect(text).toContain('title="Sales \\"West\\""');
28
+ // Written at the package root by default, so the import needs no `../`.
28
29
  expect(text).toContain(
29
- 'import { order_items } from "../models/storefront.malloy"',
30
+ 'import { order_items } from "models/storefront.malloy"',
30
31
  );
32
+ expect(text).toContain("layout=grid");
33
+ expect(text).toContain("} dashboard { columns=12 }");
31
34
  const document = await openDocument(text);
32
35
  expect(document.title).toBe('Sales "West"');
33
36
  expect(document.sources).toEqual([
34
37
  { name: "order_items_tiles", base: "order_items" },
35
38
  ]);
39
+ expect(document.layout).toBe("grid");
40
+ expect(document.columns).toBe(12);
36
41
  expect(document.tiles.map((tile) => tile.name)).toEqual([
42
+ "intro",
37
43
  "by_category_tile",
38
44
  ]);
39
- expect(queryTile(document, 0).declaration).toEqual({
45
+ expect(queryTile(document, 1).declaration).toEqual({
40
46
  kind: "reference",
41
47
  from: "by_category",
42
48
  });
43
- expect(document.tiles[0].colspan).toBe(6);
44
49
  });
45
50
 
46
51
  it("trims the title once, and refuses a source named like a keyword", () => {
@@ -51,6 +56,9 @@ describe("a new dashboard", () => {
51
56
  view: "v",
52
57
  };
53
58
  expect(newDashboardSource(base)).toContain('title="Sales"');
59
+ expect(newDashboardSource(base, "team/sales.malloy")).toContain(
60
+ 'from "../m.malloy"',
61
+ );
54
62
  expect(newDashboardProblem({ ...base, source: "date" })).toContain(
55
63
  "cannot be written",
56
64
  );
@@ -3,6 +3,7 @@
3
3
 
4
4
  import { annotationTextProblem } from "./annotationText";
5
5
  import { isBareName } from "../../utils/malloyText";
6
+ import { newReportSource } from "../DocumentCreate/newNotebook";
6
7
 
7
8
  /**
8
9
  * A new dashboard file, the way the builder would have written it: the
@@ -46,30 +47,16 @@ export function newDashboardProblem({
46
47
  return annotationTextProblem("title", title);
47
48
  }
48
49
 
49
- export function newDashboardSource(dashboard: NewDashboard): string {
50
+ /**
51
+ * A new grid report; see `newReportSource`, which writes both layouts from
52
+ * one template.
53
+ */
54
+ export function newDashboardSource(
55
+ dashboard: NewDashboard,
56
+ /** The package path the report is written at; the import is relative to it. Default: the root. */
57
+ reportPath?: string,
58
+ ): string {
50
59
  const problem = newDashboardProblem(dashboard);
51
60
  if (problem) throw new Error(problem);
52
- return writeNewDashboard(dashboard);
53
- }
54
-
55
- function writeNewDashboard({
56
- title,
57
- modelPath,
58
- source,
59
- view,
60
- }: NewDashboard): string {
61
- const extension = `${source}_tiles`;
62
- const tile = `${view}_tile`;
63
- const quoted = `"${title.trim().replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
64
- return [
65
- "##! experimental.givens",
66
- `## artifact { title=${quoted} tiles=["${extension} -> ${tile}"] } dashboard { columns=12 }`,
67
- `import { ${source} } from "../${modelPath}"`,
68
- "",
69
- `source: ${extension} is ${source} extend {`,
70
- " # colspan=6",
71
- ` view: ${tile} is ${view}`,
72
- "}",
73
- "",
74
- ].join("\n");
61
+ return newReportSource(dashboard, "grid", reportPath);
75
62
  }
@@ -19,6 +19,7 @@ const tile = (
19
19
  });
20
20
 
21
21
  const document: DashboardDocument = {
22
+ layout: "grid",
22
23
  title: "Overview",
23
24
  imports: [],
24
25
  sources: [{ name: "overview", base: "order_items" }],