@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
@@ -0,0 +1,125 @@
1
+ {
2
+ "about": "What a file is as a report (docs/reports-design.md §1, §2), one answer per case: `expected` is `grid`, `linear`, or `null` for no report. The server's one tag reader must give it for the compiled file, for the same text read uncompiled, and as the layout `lintNotebookText` lints the file as (report_layout_parity.spec.ts). The SDK's tag reader gives it too, and the builder opens any case it can open with that layout (readDocument.spec.ts).",
3
+ "cases": [
4
+ {
5
+ "name": "`layout=grid` with tiles is grid",
6
+ "source": "## artifact { layout=grid tiles=[\"s -> v\"] }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n",
7
+ "expected": "grid"
8
+ },
9
+ {
10
+ "name": "`layout=linear` with no tiles is linear",
11
+ "source": "## artifact { layout=linear }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\nrun: s -> v\n",
12
+ "expected": "linear"
13
+ },
14
+ {
15
+ "name": "a tag naming no layout and listing no tiles is linear by default",
16
+ "source": "## artifact { }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\nrun: s -> v\n",
17
+ "expected": "linear"
18
+ },
19
+ {
20
+ "name": "a tiles list with no layout is grid",
21
+ "source": "## artifact { tiles=[\"s -> v\"] }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n",
22
+ "expected": "grid"
23
+ },
24
+ {
25
+ "name": "an empty tiles list with no layout is grid",
26
+ "source": "## artifact { tiles=[] }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n",
27
+ "expected": "grid"
28
+ },
29
+ {
30
+ "name": "a `dashboard { … }` grid tag on the artifact line is grid",
31
+ "source": "## artifact { } dashboard { columns=6 }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n",
32
+ "expected": "grid"
33
+ },
34
+ {
35
+ "name": "a `## dashboard { … }` grid tag on its own line is grid",
36
+ "source": "## artifact { title=\"x\" }\n## dashboard { columns=6 }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n",
37
+ "expected": "grid"
38
+ },
39
+ {
40
+ "name": "`layout=linear` wins over a tiles list",
41
+ "source": "## artifact { layout=linear tiles=[\"s -> v\"] }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n",
42
+ "expected": "linear"
43
+ },
44
+ {
45
+ "name": "an unknown `layout=` falls through to the tiles list",
46
+ "source": "## artifact { layout=wide tiles=[\"s -> v\"] }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n",
47
+ "expected": "grid"
48
+ },
49
+ {
50
+ "name": "a tiles list of only a text tile is grid",
51
+ "source": "## artifact { tiles=[ intro { kind=text } ] }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n##|(markdown) intro\nHi.\n|##\n",
52
+ "expected": "grid"
53
+ },
54
+ {
55
+ "name": "`layout=grid` with no tiles is grid",
56
+ "source": "## artifact { layout=grid }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\nrun: s -> v\n",
57
+ "expected": "grid"
58
+ },
59
+ {
60
+ "name": "`layout=linear` wins over a grid width",
61
+ "source": "## artifact { layout=linear tiles=[\"s -> v\"] } dashboard { columns=12 }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n",
62
+ "expected": "linear"
63
+ },
64
+ {
65
+ "name": "an unknown `layout=` with no tiles falls through to linear",
66
+ "source": "## artifact { layout=wide }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\nrun: s -> v\n",
67
+ "expected": "linear"
68
+ },
69
+ {
70
+ "name": "a `##|` block tag is read like a one-line tag",
71
+ "source": "##| artifact { layout=grid tiles=[\"s -> v\"] }\n|##\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n",
72
+ "expected": "grid"
73
+ },
74
+ {
75
+ "name": "a tag after another property on its line",
76
+ "source": "## title=\"x\" artifact { layout=grid tiles=[\"s -> v\"] }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n",
77
+ "expected": "grid"
78
+ },
79
+ {
80
+ "name": "`kind=dashboard` is no longer read: no report",
81
+ "source": "## artifact { kind=dashboard tiles=[\"s -> v\"] }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n",
82
+ "expected": null
83
+ },
84
+ {
85
+ "name": "`kind=notebook` is no longer read: no report",
86
+ "source": "## artifact { kind=notebook }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\nrun: s -> v\n",
87
+ "expected": null
88
+ },
89
+ {
90
+ "name": "`kind=` beside `layout=` still makes no report",
91
+ "source": "## artifact { layout=grid kind=notebook }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n",
92
+ "expected": null
93
+ },
94
+ {
95
+ "name": "a model-level tag that does not parse is no report",
96
+ "source": "## artifact { layout=grid tiles=[ }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n",
97
+ "expected": null
98
+ },
99
+ {
100
+ "name": "a query-level `# artifact` on a named query is no report",
101
+ "source": "source: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n# artifact\nquery: q is s -> v\n",
102
+ "expected": null
103
+ },
104
+ {
105
+ "name": "a query-level `# artifact { … }` with properties is no report",
106
+ "source": "source: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n# artifact { title=\"x\" }\nquery: q is s -> v\n",
107
+ "expected": null
108
+ },
109
+ {
110
+ "name": "`# artifact` on a `run:` statement is no report",
111
+ "source": "source: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n# artifact\nrun: s -> v\n",
112
+ "expected": null
113
+ },
114
+ {
115
+ "name": "a model-level tag naming no layout beside a query-level `# artifact` is linear",
116
+ "source": "## artifact { }\nsource: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n# artifact\nquery: q is s -> v\n",
117
+ "expected": "linear"
118
+ },
119
+ {
120
+ "name": "a file with no artifact tag is no report",
121
+ "source": "source: s is duckdb.sql(\"select 1 as x\") extend { view: v is { group_by: x } }\n",
122
+ "expected": null
123
+ }
124
+ ]
125
+ }
@@ -21,7 +21,7 @@ import { whatMoved } from "./__test__/inventory";
21
21
 
22
22
  const NOTEBOOK = `##! experimental.givens
23
23
  ##" A review.
24
- ## artifact { kind=notebook title="Review" tiles=[intro { kind=text }, "a_tiles -> cell_1", outro { kind=text colspan=6 break }] }
24
+ ## artifact { layout=linear title="Review" tiles=[intro { kind=text }, "a_tiles -> cell_1", outro { kind=text colspan=6 break }] }
25
25
  import { a } from "../m.malloy"
26
26
 
27
27
  ##|(markdown) intro
@@ -59,15 +59,10 @@ const text = (document: DashboardDocument, name: string): TextTile => {
59
59
  async function writes(
60
60
  source: string,
61
61
  edit: (document: DashboardDocument) => void,
62
- options?: {
63
- changeKind?: boolean;
64
- modelPath?: string;
65
- explicitKind?: boolean;
66
- },
67
62
  ): Promise<{ out: string; document: DashboardDocument }> {
68
63
  const next = structuredClone(await openDocument(source));
69
64
  edit(next);
70
- const result = await spliceDashboardDocument(source, next, options);
65
+ const result = await spliceDashboardDocument(source, next);
71
66
  if (spliceFailed(result)) throw new Error(result.reason);
72
67
  expect(await syntaxErrors(result.source)).toEqual([]);
73
68
  return { out: result.source, document: await openDocument(result.source) };
@@ -104,10 +99,10 @@ describe("readTileList", () => {
104
99
  });
105
100
  });
106
101
 
107
- describe("readDashboardDocument: text tiles and kind", () => {
108
- it("reads a layout notebook: kind, text tiles in order, their blocks and list properties", async () => {
102
+ describe("readDashboardDocument: text tiles and layout", () => {
103
+ it("reads a linear report: its layout, text tiles in order, their blocks and list properties", async () => {
109
104
  const document = await openDocument(NOTEBOOK);
110
- expect(document.kind).toBe("notebook");
105
+ expect(document.layout).toBe("linear");
111
106
  expect(document.title).toBe("Review");
112
107
  expect(
113
108
  document.tiles.map((t) => `${t.kind ?? "query"}:${t.name}`),
@@ -129,8 +124,8 @@ describe("readDashboardDocument: text tiles and kind", () => {
129
124
  expect(query?.source).toBe("a_tiles");
130
125
  });
131
126
 
132
- it("leaves kind out for a dashboard", async () => {
133
- expect((await openDocument(DASHBOARD)).kind).toBeUndefined();
127
+ it("reads a tag that lists tiles as grid", async () => {
128
+ expect((await openDocument(DASHBOARD)).layout).toBe("grid");
134
129
  });
135
130
 
136
131
  it("reads a listed text tile whose block is missing as empty prose", async () => {
@@ -158,27 +153,35 @@ describe("readDashboardDocument: text tiles and kind", () => {
158
153
 
159
154
  it("marks a notebook with no tiles list as the cell format", async () => {
160
155
  const result = await readDashboardDocument(
161
- `## artifact { kind=notebook title="Old" }\nimport { a } from "../m.malloy"\n\nrun: a -> v\n`,
156
+ `## artifact { layout=linear title="Old" }\nimport { a } from "../m.malloy"\n\nrun: a -> v\n`,
162
157
  );
163
158
  if (!readFailed(result)) throw new Error("expected a refusal");
164
159
  expect(result.legacyNotebook).toBe(true);
165
160
  });
166
161
 
167
- it("still refuses a dashboard with no tiles list, without the legacy mark", async () => {
162
+ it("still refuses a grid report with no tiles list, without the legacy mark", async () => {
168
163
  const result = await readDashboardDocument(
169
- `## artifact { title="D" }\nimport { a } from "../m.malloy"\n`,
164
+ `## artifact { layout=grid title="D" }\nimport { a } from "../m.malloy"\n`,
170
165
  );
171
166
  if (!readFailed(result)) throw new Error("expected a refusal");
172
167
  expect(result.legacyNotebook).toBeUndefined();
173
168
  expect(result.reason).toContain("tiles");
174
169
  });
175
170
 
171
+ it("reads a tag with no layout and no tiles as a linear report in the cell format", async () => {
172
+ const result = await readDashboardDocument(
173
+ `## artifact { title="D" }\nimport { a } from "../m.malloy"\n`,
174
+ );
175
+ if (!readFailed(result)) throw new Error("expected a refusal");
176
+ expect(result.legacyNotebook).toBe(true);
177
+ });
178
+
176
179
  it("reads an empty tiles list on a notebook as a layout notebook with no tiles", async () => {
177
180
  const document = await openDocument(
178
- `## artifact { kind=notebook title="E" tiles=[] }\n`,
181
+ `## artifact { layout=linear title="E" tiles=[] }\n`,
179
182
  );
180
183
  expect(document.tiles).toEqual([]);
181
- expect(document.kind).toBe("notebook");
184
+ expect(document.layout).toBe("linear");
182
185
  });
183
186
 
184
187
  it("refuses an entry that is neither quoted nor kind=text", async () => {
@@ -288,7 +291,7 @@ describe("spliceDashboardDocument: text tiles", () => {
288
291
  expect(out).toContain(
289
292
  "\n\n##|(markdown) lead\nLead.\n|##\n\nsource: a_tiles is a extend",
290
293
  );
291
- expect(document.kind).toBeUndefined();
294
+ expect(document.layout).toBe("grid");
292
295
  expect(text(document, "lead").markdown).toBe("Lead.");
293
296
  });
294
297
 
@@ -351,7 +354,7 @@ describe("spliceDashboardDocument: text tiles", () => {
351
354
  expect(afterLast.out).toContain(
352
355
  "Bye.\n|##\n\n##|(markdown) coda\nEnd.\n|##\n",
353
356
  );
354
- const bare = `## artifact { kind=notebook tiles=[] }\nimport { a } from "../m.malloy"\n`;
357
+ const bare = `## artifact { layout=linear tiles=[] }\nimport { a } from "../m.malloy"\n`;
355
358
  const none = await writes(bare, (d) => {
356
359
  d.tiles.push({ kind: "text", name: "solo", markdown: "Only." });
357
360
  });
@@ -521,7 +524,7 @@ describe("spliceDashboardDocument: text tiles", () => {
521
524
  describe("spliceDashboardDocument: text edits move nothing else", () => {
522
525
  const RICH = `// the page
523
526
  ##! experimental.givens
524
- ## artifact { kind=notebook title="Rich" tiles=[intro { kind=text }, "a_tiles -> cell_1", "a_tiles -> cell_2"] }
527
+ ## artifact { layout=linear title="Rich" tiles=[intro { kind=text }, "a_tiles -> cell_1", "a_tiles -> cell_2"] }
525
528
  import { a } from "../m.malloy"
526
529
 
527
530
  // about the intro
@@ -594,151 +597,71 @@ source: a_tiles is a extend {
594
597
  });
595
598
  });
596
599
 
597
- describe("spliceDashboardDocument: switching kind", () => {
598
- it("refuses a kind change unless it is asked for", async () => {
599
- const reason = await refused(DASHBOARD, (d) => {
600
- d.kind = "notebook";
600
+ describe("spliceDashboardDocument: switching layout", () => {
601
+ it("turns a grid report linear in place: layout written, width cleared", async () => {
602
+ const { out, document } = await writes(DASHBOARD, (d) => {
603
+ d.layout = "linear";
604
+ delete d.columns;
601
605
  });
602
- expect(reason).toContain("kind");
603
- });
604
-
605
- it("turns a dashboard into a notebook in place: kind added, width cleared", async () => {
606
- const { out, document } = await writes(
607
- DASHBOARD,
608
- (d) => {
609
- d.kind = "notebook";
610
- delete d.columns;
611
- },
612
- { changeKind: true },
613
- );
614
606
  expect(out).toContain(
615
- '## artifact { title="D" tiles=["a_tiles -> x"] kind=notebook }',
607
+ '## artifact { title="D" tiles=["a_tiles -> x"] layout=linear }',
616
608
  );
617
609
  expect(out).not.toContain("dashboard {");
618
- expect(document.kind).toBe("notebook");
610
+ expect(document.layout).toBe("linear");
619
611
  expect(document.columns).toBeUndefined();
620
612
  expect(out.slice(out.indexOf("\n"))).toBe(
621
613
  DASHBOARD.slice(DASHBOARD.indexOf("\n")),
622
614
  );
623
615
  });
624
616
 
625
- it("turns a notebook back into a dashboard: kind removed, width written", async () => {
626
- const { out, document } = await writes(
627
- NOTEBOOK,
628
- (d) => {
629
- d.kind = "dashboard";
630
- d.columns = 12;
631
- },
632
- { changeKind: true },
633
- );
634
- expect(out).not.toContain("kind=notebook");
617
+ it("turns a linear report back into a grid: layout=grid, width written", async () => {
618
+ const { out, document } = await writes(NOTEBOOK, (d) => {
619
+ d.layout = "grid";
620
+ d.columns = 12;
621
+ });
622
+ expect(out).toContain("layout=grid");
623
+ expect(out).not.toContain("layout=linear");
635
624
  expect(out).toContain("kind=text");
636
625
  expect(out).toContain("dashboard { columns=12 }");
637
- expect(document.kind).toBeUndefined();
626
+ expect(document.layout).toBe("grid");
638
627
  expect(document.columns).toBe(12);
639
628
  });
640
629
 
641
- it("tags a dashboard kind=dashboard under notebooks/, where an untagged file reads as a notebook, and drops the tag again for a notebook", async () => {
642
- const flip = (source: string, kind: "dashboard" | "notebook") =>
643
- writes(
644
- source,
645
- (d) => {
646
- d.kind = kind;
647
- if (kind === "notebook") delete d.columns;
648
- },
649
- { changeKind: true, modelPath: "notebooks/n.malloy" },
650
- );
651
- const asDashboard = await flip(NOTEBOOK, "dashboard");
652
- expect(asDashboard.out).toContain("kind=dashboard");
653
- expect(asDashboard.out).not.toContain("kind=notebook");
654
- expect(asDashboard.document.kind).toBeUndefined();
655
- const back = await flip(asDashboard.out, "notebook");
656
- expect(back.out).toContain("kind=notebook");
657
- expect(back.out).not.toContain("kind=dashboard");
658
- expect(back.document.kind).toBe("notebook");
659
- });
660
-
661
- it("tags a dashboard kind=dashboard when the document has no path, as in text-source mode", async () => {
662
- const { out } = await writes(
663
- NOTEBOOK,
664
- (d) => {
665
- d.kind = "dashboard";
666
- },
667
- { changeKind: true },
668
- );
669
- expect(out).toContain("kind=dashboard");
670
- });
671
-
672
- it("writes the kind both ways in text mode, even under dashboards/, so the compile and the saved file agree", async () => {
673
- const options = {
674
- changeKind: true,
675
- modelPath: "dashboards/n.malloy",
676
- explicitKind: true,
677
- };
678
- const asDashboard = await writes(
679
- NOTEBOOK,
680
- (d) => {
681
- d.kind = "dashboard";
682
- },
683
- options,
684
- );
685
- expect(asDashboard.out).toContain("kind=dashboard");
686
- expect(asDashboard.out).not.toContain("kind=notebook");
687
- const back = await writes(
688
- asDashboard.out,
689
- (d) => {
690
- d.kind = "notebook";
691
- delete d.columns;
692
- },
693
- options,
694
- );
695
- expect(back.out).toContain("kind=notebook");
696
- expect(back.out).not.toContain("kind=dashboard");
697
- });
698
-
699
- it("leaves a dashboard under dashboards/ untagged", async () => {
700
- const { out } = await writes(
701
- NOTEBOOK,
702
- (d) => {
703
- d.kind = "dashboard";
704
- },
705
- { changeKind: true, modelPath: "dashboards/n.malloy" },
706
- );
707
- expect(out).not.toContain("kind=dashboard");
708
- expect(out).not.toContain("kind=notebook");
630
+ it("switches only the layout property: the rest of the tag and file stay byte for byte", async () => {
631
+ const { out } = await writes(NOTEBOOK, (d) => {
632
+ d.layout = "grid";
633
+ });
634
+ expect(out).toBe(NOTEBOOK.replace("layout=linear", "layout=grid"));
635
+ const back = await writes(out, (d) => {
636
+ d.layout = "linear";
637
+ });
638
+ expect(back.out).toBe(NOTEBOOK);
709
639
  });
710
640
 
711
- it("does not take a text tile's kind=text for the document's", async () => {
641
+ it("does not take a text tile's kind=text for the document's layout", async () => {
712
642
  const source = `## artifact { tiles=[a { kind=text }] title="T" }\n\n##|(markdown) a\nx\n|##\n`;
713
- const { out, document } = await writes(
714
- source,
715
- (d) => {
716
- d.kind = "notebook";
717
- },
718
- { changeKind: true },
719
- );
643
+ const { out, document } = await writes(source, (d) => {
644
+ d.layout = "linear";
645
+ });
720
646
  expect(out).toContain("a { kind=text }");
721
- expect(out).toContain("kind=notebook");
722
- expect(document.kind).toBe("notebook");
723
- const back = await writes(
724
- out,
725
- (d) => {
726
- d.kind = "dashboard";
727
- },
728
- { changeKind: true },
729
- );
647
+ expect(out).toContain("layout=linear");
648
+ expect(document.layout).toBe("linear");
649
+ const back = await writes(out, (d) => {
650
+ d.layout = "grid";
651
+ });
730
652
  expect(back.out).toContain("a { kind=text }");
731
- expect(back.out).not.toContain("kind=notebook");
653
+ expect(back.out).toContain("layout=grid");
654
+ expect(back.out).not.toContain("layout=linear");
732
655
  });
733
656
 
734
- it("refuses to switch to a notebook with the width still set, and never writes a notebook's width", async () => {
735
- const result = await spliceDashboardDocument(
736
- DASHBOARD,
737
- { ...(await openDocument(DASHBOARD)), kind: "notebook" },
738
- { changeKind: true },
739
- );
740
- if (!spliceFailed(result)) throw new Error("expected a refusal");
741
- expect(result.reason).toContain("one column");
657
+ it("keeps the width through a switch to linear, and never writes a linear report's width", async () => {
658
+ // The switch rewrites `layout=` and nothing else, so the file's own width stays as written.
659
+ const result = await spliceDashboardDocument(DASHBOARD, {
660
+ ...(await openDocument(DASHBOARD)),
661
+ layout: "linear",
662
+ });
663
+ if (spliceFailed(result)) throw new Error(result.reason);
664
+ expect(result.source).toContain("layout=linear");
742
665
  const reason = await refused(NOTEBOOK, (d) => {
743
666
  d.columns = 6;
744
667
  });
@@ -12,7 +12,7 @@ import {
12
12
  import { scrollBehavior } from "../../theme/motion";
13
13
  import { changedTileKey } from "./changedTile";
14
14
  import type { DashboardDocument } from "./document";
15
- import type { DashboardEditor } from "./useDashboardEditor";
15
+ import type { ReportEditorHandle } from "./useReportEditor";
16
16
 
17
17
  /**
18
18
  * What is selected on the page: one tile, by index, or the description.
@@ -36,7 +36,7 @@ export function useBuilderSelection({
36
36
  editor,
37
37
  gridBox,
38
38
  }: {
39
- editor: DashboardEditor;
39
+ editor: ReportEditorHandle;
40
40
  /** The grid's box, searched for the changed tile to scroll to. */
41
41
  gridBox: RefObject<HTMLDivElement | null>;
42
42
  }) {
@@ -19,7 +19,7 @@ import {
19
19
  type LocalGiven,
20
20
  type QueryTile,
21
21
  } from "./document";
22
- import type { DashboardEditor } from "./useDashboardEditor";
22
+ import type { ReportEditorHandle } from "./useReportEditor";
23
23
 
24
24
  /**
25
25
  * The document's controls, the fields each tile may bind one to, and the
@@ -31,7 +31,7 @@ export function useControlBindings({
31
31
  givens,
32
32
  catalog,
33
33
  }: {
34
- editor: DashboardEditor;
34
+ editor: ReportEditorHandle;
35
35
  /** The document as the host opened it, before any edit here. */
36
36
  opened: DashboardDocument;
37
37
  /** The givens the host resolved across the model and its imports. */
@@ -0,0 +1,156 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ /**
5
+ * The builder's catalog leaves out the package's reports and the file being
6
+ * edited, following the CURRENT listing and path: the models are cached once
7
+ * per package version, and the exclusions are never baked into that cache.
8
+ */
9
+ import { renderHook, waitFor } from "@testing-library/react";
10
+ import { beforeEach, describe, expect, it, mock } from "bun:test";
11
+ import {
12
+ cacheKeys,
13
+ clearCache,
14
+ mockServerProvider,
15
+ serverWrapper,
16
+ TEST_SERVER,
17
+ } from "../../../test/serverProvider";
18
+ import type { ListedReport } from "../Package/documentLocation";
19
+
20
+ const modelOf = (path: string, source: string) => ({
21
+ modelPath: path,
22
+ modelInfo: JSON.stringify({ entries: [{ kind: "source", name: source }] }),
23
+ sources: [{ name: source, views: [{ name: "v" }] }],
24
+ });
25
+ const MODELS: Record<string, unknown> = {
26
+ "data.malloy": modelOf("data.malloy", "orders"),
27
+ "a.malloy": modelOf("a.malloy", "a_tiles"),
28
+ "b.malloy": modelOf("b.malloy", "b_tiles"),
29
+ };
30
+ const listModels = mock(() =>
31
+ Promise.resolve({ data: Object.keys(MODELS).map((path) => ({ path })) }),
32
+ );
33
+ const getModel = mock((_env: string, _pkg: string, path: string) =>
34
+ Promise.resolve({ data: MODELS[path] }),
35
+ );
36
+ mockServerProvider({ models: { listModels, getModel } });
37
+
38
+ const { useEditorCatalog } = await import("./useEditorCatalog");
39
+
40
+ const REPORTS: ListedReport[] = [
41
+ { path: "a.malloy", layout: "grid" },
42
+ { path: "b.malloy", layout: "linear" },
43
+ ];
44
+
45
+ type Props = {
46
+ modelPath: string;
47
+ reports: readonly ListedReport[];
48
+ reportsSettled: boolean;
49
+ };
50
+ const mountCatalog = (initialProps: Props) =>
51
+ renderHook(
52
+ (props: Props) =>
53
+ useEditorCatalog({
54
+ environmentName: "env",
55
+ packageName: "pkg",
56
+ ...props,
57
+ }),
58
+ { wrapper: serverWrapper, initialProps },
59
+ );
60
+ const names = (catalog: { sources: { name: string }[] } | undefined) =>
61
+ catalog?.sources.map((s) => s.name).sort();
62
+
63
+ beforeEach(() => {
64
+ clearCache();
65
+ listModels.mockClear();
66
+ getModel.mockClear();
67
+ });
68
+
69
+ describe("useEditorCatalog", () => {
70
+ it("offers and fetches nothing until the listing has answered", async () => {
71
+ const { result } = mountCatalog({
72
+ modelPath: "a.malloy",
73
+ reports: [],
74
+ reportsSettled: false,
75
+ });
76
+ await waitFor(() => expect(listModels).toHaveBeenCalledTimes(1));
77
+ expect(getModel).not.toHaveBeenCalled();
78
+ expect(result.current).toBeUndefined();
79
+ });
80
+
81
+ it("never fetches the file being edited or a listed report", async () => {
82
+ const { result } = mountCatalog({
83
+ modelPath: "a.malloy",
84
+ reports: REPORTS,
85
+ reportsSettled: true,
86
+ });
87
+ await waitFor(() => expect(names(result.current)).toEqual(["orders"]));
88
+ expect(getModel.mock.calls.map((call) => call[2])).toEqual([
89
+ "data.malloy",
90
+ ]);
91
+ });
92
+
93
+ it("leaves the reports out once a failed listing recovers", async () => {
94
+ // A failed listing is settled with no reports: nothing to exclude yet.
95
+ const view = mountCatalog({
96
+ modelPath: "a.malloy",
97
+ reports: [],
98
+ reportsSettled: true,
99
+ });
100
+ await waitFor(() =>
101
+ expect(names(view.result.current)).toEqual(["b_tiles", "orders"]),
102
+ );
103
+ view.rerender({
104
+ modelPath: "a.malloy",
105
+ reports: REPORTS,
106
+ reportsSettled: true,
107
+ });
108
+ expect(names(view.result.current)).toEqual(["orders"]);
109
+ // The recovery reads the cached models; nothing is fetched again.
110
+ expect(listModels).toHaveBeenCalledTimes(1);
111
+ expect(getModel).toHaveBeenCalledTimes(2);
112
+ });
113
+
114
+ it("leaves each report out of its own catalog from one shared cache", async () => {
115
+ const first = mountCatalog({
116
+ modelPath: "a.malloy",
117
+ reports: REPORTS,
118
+ reportsSettled: true,
119
+ });
120
+ await waitFor(() =>
121
+ expect(names(first.result.current)).toEqual(["orders"]),
122
+ );
123
+ // The file being edited is left out even when the listing lacks it.
124
+ const second = mountCatalog({
125
+ modelPath: "b.malloy",
126
+ reports: [REPORTS[0]],
127
+ reportsSettled: true,
128
+ });
129
+ await waitFor(() =>
130
+ expect(names(second.result.current)).toEqual(["orders"]),
131
+ );
132
+ const other = mountCatalog({
133
+ modelPath: "b.malloy",
134
+ reports: [],
135
+ reportsSettled: true,
136
+ });
137
+ await waitFor(() =>
138
+ expect(names(other.result.current)).toEqual(["a_tiles", "orders"]),
139
+ );
140
+ // One listing entry for all three, and one entry per model: neither
141
+ // the path being edited nor the report listing is in any key.
142
+ expect(cacheKeys("report-editor-models")).toHaveLength(1);
143
+ expect(cacheKeys("report-editor-model").sort()).toEqual(
144
+ ["a.malloy", "data.malloy"].map((path) =>
145
+ JSON.stringify([
146
+ "report-editor-model",
147
+ "env",
148
+ "pkg",
149
+ path,
150
+ null,
151
+ TEST_SERVER,
152
+ ]),
153
+ ),
154
+ );
155
+ });
156
+ });