@malloy-publisher/sdk 0.9.6 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -17
- package/dist/{RenderedResult-qnpbr4tc.cjs.js → RenderedResult-BrvrMDAP.cjs.js} +1 -1
- package/dist/{RenderedResult-BUb2Xvr2.es.js → RenderedResult-DZj-FnOJ.es.js} +2 -2
- package/dist/{ServerProvider-C6QQVKPm.es.js → ServerProvider-B_bPAsu2.es.js} +595 -410
- package/dist/ServerProvider-DuEOzwPc.cjs.js +1 -0
- package/dist/builder/index.cjs.js +93 -93
- package/dist/builder/index.es.js +4630 -4562
- package/dist/builder-entry.d.ts +13 -12
- package/dist/client/api.d.ts +489 -111
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +105 -95
- package/dist/components/Dashboard/DashboardTile.d.ts +3 -1
- package/dist/components/Dashboard/DashboardView.d.ts +1 -3
- package/dist/components/Dashboard/index.d.ts +0 -2
- package/dist/components/DocumentCreate/createDocument.d.ts +29 -9
- package/dist/components/DocumentCreate/documentPath.d.ts +21 -6
- package/dist/components/DocumentCreate/guards.d.ts +2 -3
- package/dist/components/DocumentCreate/index.d.ts +2 -3
- package/dist/components/DocumentCreate/newNotebook.d.ts +14 -5
- package/dist/components/DocumentStorage/BrowserDocumentStorage.d.ts +6 -0
- package/dist/components/DocumentStorage/DocumentStorage.d.ts +52 -24
- package/dist/components/Loading.d.ts +1 -1
- package/dist/components/Package/DataSchemaDialog.d.ts +26 -0
- package/dist/components/Package/NewDocumentDialog.d.ts +19 -10
- package/dist/components/Package/Package.d.ts +14 -9
- package/dist/components/Package/documentLocation.d.ts +66 -23
- package/dist/components/Package/index.d.ts +3 -2
- package/dist/components/Package/reportQueries.d.ts +8 -0
- package/dist/components/Package/useDocumentLocation.d.ts +36 -6
- package/dist/components/Package/useDraftLayout.d.ts +20 -0
- package/dist/components/Report/CellReport.d.ts +89 -0
- package/dist/components/Report/LinearReport.d.ts +18 -0
- package/dist/components/Report/Report.d.ts +62 -0
- package/dist/components/Report/index.d.ts +2 -0
- package/dist/components/Report/telemetry.d.ts +163 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderDialogs.d.ts +2 -2
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderGrid.d.ts +2 -2
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderHeader.d.ts +5 -4
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderToolbar.d.ts +5 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/EditorSurface.d.ts +10 -7
- package/dist/components/{DashboardBuilder/DashboardBuilder.d.ts → ReportBuilder/ReportBuilder.d.ts} +17 -8
- package/dist/components/{DashboardBuilder/DashboardEditor.d.ts → ReportBuilder/ReportEditor.d.ts} +41 -14
- package/dist/components/ReportBuilder/builderReport.d.ts +14 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/catalog.d.ts +8 -5
- package/dist/components/{DashboardBuilder → ReportBuilder}/document.d.ts +3 -4
- package/dist/components/{DashboardBuilder → ReportBuilder}/documentSession.d.ts +1 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/imports.d.ts +5 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/malloyTree.d.ts +9 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/newDashboard.d.ts +7 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/readDocument.d.ts +7 -5
- package/dist/components/{DashboardBuilder → ReportBuilder}/readForEditor.d.ts +1 -1
- package/dist/components/ReportBuilder/reportTag.d.ts +52 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/spliceDocument.d.ts +1 -7
- package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderSelection.d.ts +2 -2
- package/dist/components/{DashboardBuilder → ReportBuilder}/useControlBindings.d.ts +2 -2
- package/dist/components/ReportBuilder/useEditorCatalog.d.ts +25 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/useHostCopy.d.ts +5 -3
- package/dist/components/{DashboardBuilder → ReportBuilder}/useOpenedDocument.d.ts +7 -5
- package/dist/components/{DashboardBuilder/useDashboardEditor.d.ts → ReportBuilder/useReportEditor.d.ts} +3 -7
- package/dist/components/{DashboardBuilder → ReportBuilder}/useSaveChannel.d.ts +6 -4
- package/dist/components/{DashboardBuilder → ReportBuilder}/useTileEditing.d.ts +2 -2
- package/dist/components/ServerProvider.d.ts +2 -1
- package/dist/components/drill/resolveDrill.d.ts +8 -1
- package/dist/components/drill/useDrillSelf.d.ts +4 -2
- package/dist/components/index.d.ts +2 -1
- package/dist/components/{Dashboard → legacy}/Dashboard.d.ts +15 -9
- package/dist/components/legacy/MalloynbCells.d.ts +13 -0
- package/dist/components/legacy/Notebook.d.ts +15 -0
- package/dist/components/{DashboardBuilder → legacy}/NotebookEditor.d.ts +3 -3
- package/dist/components/legacy/builderNames.d.ts +10 -0
- package/dist/components/legacy/index.d.ts +11 -0
- package/dist/components/legacy/kindAdapter.d.ts +11 -0
- package/dist/components/legacy/kindTypedDrafts.d.ts +10 -0
- package/dist/components/legacy/nameAlias.d.ts +44 -0
- package/dist/components/legacy/queryKeys.d.ts +8 -0
- package/dist/index.cjs.js +19 -19
- package/dist/index.es.js +7984 -7452
- package/dist/text/index.es.js +2 -2
- package/dist/{text-entry-CA0LZ1xL.es.js → text-entry-72YFLeNk.es.js} +10 -10
- package/dist/useCompiledDocument-oocN5cGE.cjs.js +141 -0
- package/dist/{useCompiledDocument-0sxonf6N.es.js → useCompiledDocument-x0B2RAH3.es.js} +4593 -4395
- package/package.json +2 -2
- package/src/builder-entry.ts +32 -24
- package/src/components/Dashboard/DashboardTile.tsx +17 -0
- package/src/components/Dashboard/DashboardView.spec.tsx +0 -21
- package/src/components/Dashboard/DashboardView.tsx +8 -24
- package/src/components/Dashboard/dropValueUrlTags.spec.ts +1 -4
- package/src/components/Dashboard/index.ts +0 -2
- package/src/components/DocumentCreate/createDocument.spec.ts +346 -53
- package/src/components/DocumentCreate/createDocument.ts +143 -63
- package/src/components/DocumentCreate/documentPath.ts +41 -12
- package/src/components/DocumentCreate/guards.ts +7 -15
- package/src/components/DocumentCreate/index.ts +3 -7
- package/src/components/DocumentCreate/newNotebook.spec.ts +113 -43
- package/src/components/DocumentCreate/newNotebook.ts +32 -10
- package/src/components/DocumentStorage/BrowserDocumentStorage.spec.ts +130 -28
- package/src/components/DocumentStorage/BrowserDocumentStorage.ts +78 -40
- package/src/components/DocumentStorage/DocumentStorage.contract.spec.tsx +426 -0
- package/src/components/DocumentStorage/DocumentStorage.ts +57 -24
- package/src/components/Home/AddEnvironmentDialog.tsx +1 -1
- package/src/components/Home/Home.tsx +1 -1
- package/src/components/Loading.tsx +1 -1
- package/src/components/Model/SourcesExplorer.tsx +1 -1
- package/src/components/Notebook/NotebookCell.tsx +6 -5
- package/src/components/Notebook/cellKind.spec.ts +15 -7
- package/src/components/Package/DataSchemaDialog.spec.tsx +85 -0
- package/src/components/Package/DataSchemaDialog.tsx +367 -0
- package/src/components/Package/NewDocumentDialog.spec.tsx +145 -88
- package/src/components/Package/NewDocumentDialog.tsx +93 -48
- package/src/components/Package/Package.artifacts.spec.tsx +79 -60
- package/src/components/Package/Package.create.spec.tsx +126 -112
- package/src/components/Package/Package.notebooks.spec.tsx +46 -27
- package/src/components/Package/Package.spec.tsx +43 -30
- package/src/components/Package/Package.tsx +173 -292
- package/src/components/Package/documentLocation.spec.ts +145 -50
- package/src/components/Package/documentLocation.ts +118 -39
- package/src/components/Package/index.ts +12 -3
- package/src/components/Package/reportQueries.ts +25 -0
- package/src/components/Package/useDocumentLocation.spec.ts +58 -0
- package/src/components/Package/useDocumentLocation.ts +90 -32
- package/src/components/Package/useDraftLayout.spec.tsx +143 -0
- package/src/components/Package/useDraftLayout.ts +81 -0
- package/src/components/Prose.spec.tsx +3 -3
- package/src/components/RenderedResult/RenderedResult.tsx +1 -1
- package/src/components/Report/CellReport.spec.tsx +155 -0
- package/src/components/{Notebook/Notebook.tsx → Report/CellReport.tsx} +178 -220
- package/src/components/Report/LinearReport.tsx +71 -0
- package/src/components/Report/Report.spec.tsx +238 -0
- package/src/components/Report/Report.telemetry.spec.tsx +292 -0
- package/src/components/Report/Report.tsx +277 -0
- package/src/components/Report/index.ts +12 -0
- package/src/components/Report/telemetry.spec.ts +90 -0
- package/src/components/Report/telemetry.ts +250 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderDialogs.tsx +5 -5
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderGrid.tsx +2 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderHeader.tsx +6 -7
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderToolbar.tsx +33 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/DrillDialog.tsx +2 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/EditorSurface.tsx +67 -107
- package/src/components/{DashboardBuilder → ReportBuilder}/FilterDialog.tsx +3 -4
- package/src/components/{DashboardBuilder/DashboardBuilder.charts.spec.tsx → ReportBuilder/ReportBuilder.charts.spec.tsx} +4 -4
- package/src/components/{DashboardBuilder/DashboardBuilder.exit.spec.tsx → ReportBuilder/ReportBuilder.exit.spec.tsx} +5 -5
- package/src/components/{DashboardBuilder/DashboardBuilder.inline.spec.tsx → ReportBuilder/ReportBuilder.inline.spec.tsx} +4 -4
- package/src/components/ReportBuilder/ReportBuilder.layoutSwitch.spec.tsx +145 -0
- package/src/components/{DashboardBuilder/DashboardBuilder.notebook.spec.tsx → ReportBuilder/ReportBuilder.notebook.spec.tsx} +22 -21
- package/src/components/{DashboardBuilder/DashboardBuilder.openDraft.spec.tsx → ReportBuilder/ReportBuilder.openDraft.spec.tsx} +3 -3
- package/src/components/{DashboardBuilder/DashboardBuilder.sources.spec.tsx → ReportBuilder/ReportBuilder.sources.spec.tsx} +19 -8
- package/src/components/{DashboardBuilder/DashboardBuilder.spec.tsx → ReportBuilder/ReportBuilder.spec.tsx} +34 -34
- package/src/components/{DashboardBuilder/DashboardBuilder.textTiles.spec.tsx → ReportBuilder/ReportBuilder.textTiles.spec.tsx} +5 -5
- package/src/components/{DashboardBuilder/DashboardBuilder.tsx → ReportBuilder/ReportBuilder.tsx} +46 -21
- package/src/components/{DashboardBuilder/DashboardEditor.authoritative.spec.tsx → ReportBuilder/ReportEditor.authoritative.spec.tsx} +28 -20
- package/src/components/{DashboardBuilder/DashboardEditor.emptyStart.spec.tsx → ReportBuilder/ReportEditor.emptyStart.spec.tsx} +19 -11
- package/src/components/{DashboardBuilder/DashboardEditor.filterTag.spec.tsx → ReportBuilder/ReportEditor.filterTag.spec.tsx} +7 -7
- package/src/components/{DashboardBuilder/DashboardEditor.notebook.spec.tsx → ReportBuilder/ReportEditor.notebook.spec.tsx} +70 -49
- package/src/components/{DashboardBuilder/DashboardEditor.package.spec.tsx → ReportBuilder/ReportEditor.package.spec.tsx} +52 -8
- package/src/components/{DashboardBuilder/DashboardEditor.resourceUri.spec.tsx → ReportBuilder/ReportEditor.resourceUri.spec.tsx} +50 -18
- package/src/components/{DashboardBuilder/DashboardEditor.spec.tsx → ReportBuilder/ReportEditor.spec.tsx} +65 -20
- package/src/components/{DashboardBuilder/DashboardEditor.textSource.spec.tsx → ReportBuilder/ReportEditor.textSource.spec.tsx} +6 -6
- package/src/components/{DashboardBuilder/DashboardEditor.tsx → ReportBuilder/ReportEditor.tsx} +92 -35
- package/src/components/{DashboardBuilder → ReportBuilder}/addTile.compile.spec.ts +6 -4
- package/src/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.spec.ts +1 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/artifactBlock.spec.ts +21 -29
- package/src/components/ReportBuilder/builderReport.ts +53 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/catalog.spec.ts +28 -10
- package/src/components/{DashboardBuilder → ReportBuilder}/catalog.ts +17 -10
- package/src/components/{DashboardBuilder → ReportBuilder}/controls.spec.ts +1 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/document.ts +4 -7
- package/src/components/{DashboardBuilder → ReportBuilder}/documentSession.spec.ts +5 -5
- package/src/components/{DashboardBuilder → ReportBuilder}/documentSession.ts +1 -1
- package/src/components/{DashboardBuilder → ReportBuilder}/imports.spec.ts +6 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/imports.ts +8 -4
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.chart.spec.ts +1 -1
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.convert.spec.ts +9 -13
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.read.spec.ts +15 -15
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.ts +7 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/malloyTree.ts +25 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/newDashboard.spec.ts +12 -4
- package/src/components/{DashboardBuilder → ReportBuilder}/newDashboard.ts +11 -24
- package/src/components/{DashboardBuilder → ReportBuilder}/preview.spec.ts +1 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/readDocument.spec.ts +64 -36
- package/src/components/{DashboardBuilder → ReportBuilder}/readDocument.ts +33 -32
- package/src/components/ReportBuilder/readForEditor.spec.ts +96 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/readForEditor.ts +3 -11
- package/src/components/ReportBuilder/reportTag.ts +108 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.imports.spec.ts +28 -1
- package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.spec.ts +32 -3
- package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.ts +37 -60
- package/src/components/{DashboardBuilder → ReportBuilder}/tagParse.spec.ts +3 -3
- package/src/components/{DashboardBuilder → ReportBuilder}/testing/artifactTagParity.json +2 -2
- package/src/components/ReportBuilder/testing/drillResolution.json +279 -0
- package/src/components/ReportBuilder/testing/reportLayoutParity.json +125 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/textTiles.spec.ts +66 -143
- package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSelection.ts +2 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/useControlBindings.ts +2 -2
- package/src/components/ReportBuilder/useEditorCatalog.spec.tsx +156 -0
- package/src/components/ReportBuilder/useEditorCatalog.ts +119 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/useHostCopy.ts +7 -5
- package/src/components/{DashboardBuilder → ReportBuilder}/useOpenedDocument.ts +56 -35
- package/src/components/{DashboardBuilder/useDashboardEditor.spec.ts → ReportBuilder/useReportEditor.spec.ts} +6 -6
- package/src/components/{DashboardBuilder/useDashboardEditor.ts → ReportBuilder/useReportEditor.ts} +6 -17
- package/src/components/{DashboardBuilder → ReportBuilder}/useSaveChannel.ts +36 -35
- package/src/components/{DashboardBuilder → ReportBuilder}/useTileEditing.ts +2 -2
- package/src/components/ServerProvider.tsx +2 -0
- package/src/components/drill/resolveDrill.ts +9 -2
- package/src/components/drill/useDrill.tsx +1 -0
- package/src/components/drill/useDrillSelf.spec.tsx +60 -7
- package/src/components/drill/useDrillSelf.ts +29 -12
- package/src/components/index.ts +2 -1
- package/src/components/{Dashboard → legacy}/Dashboard.spec.tsx +1 -1
- package/src/components/{Dashboard → legacy}/Dashboard.tsx +40 -28
- package/src/components/legacy/MalloynbCells.tsx +88 -0
- package/src/components/{Notebook → legacy}/Notebook.served.spec.tsx +17 -13
- package/src/components/{Notebook → legacy}/Notebook.spec.tsx +24 -20
- package/src/components/legacy/Notebook.tsx +44 -0
- package/src/components/{DashboardBuilder → legacy}/NotebookEditor.tsx +7 -4
- package/src/components/legacy/builderNames.ts +25 -0
- package/src/components/legacy/index.ts +20 -0
- package/src/components/legacy/kindAdapter.ts +19 -0
- package/src/components/legacy/kindTypedDrafts.ts +34 -0
- package/src/components/legacy/nameAlias.spec.ts +124 -0
- package/src/components/legacy/nameAlias.ts +95 -0
- package/src/components/legacy/queryKeys.ts +26 -0
- package/src/hooks/useGivensState.spec.ts +9 -9
- package/src/mainEntry.spec.ts +1 -1
- package/src/textEntry.spec.ts +9 -9
- package/src/utils/formatting.spec.ts +5 -5
- package/src/utils/parsing.spec.ts +1 -1
- package/src/utils/parsing.ts +1 -1
- package/dist/ServerProvider-Gj-im5VD.cjs.js +0 -1
- package/dist/components/Dashboard/telemetry.d.ts +0 -73
- package/dist/components/DashboardBuilder/builderReport.d.ts +0 -13
- package/dist/components/DashboardBuilder/telemetry.d.ts +0 -43
- package/dist/components/DocumentCreate/events.d.ts +0 -10
- package/dist/components/Notebook/Notebook.d.ts +0 -52
- package/dist/components/Notebook/index.d.ts +0 -1
- package/dist/useCompiledDocument-tBejqZ7s.cjs.js +0 -142
- package/src/components/Dashboard/telemetry.ts +0 -75
- package/src/components/DashboardBuilder/builderReport.ts +0 -74
- package/src/components/DashboardBuilder/readForEditor.spec.ts +0 -80
- package/src/components/DashboardBuilder/telemetry.ts +0 -47
- package/src/components/DashboardBuilder/testing/documentKindRule.json +0 -40
- package/src/components/DocumentCreate/events.ts +0 -15
- package/src/components/Notebook/index.ts +0 -4
- /package/dist/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/ChartPicker.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/DrillDialog.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/FilterDialog.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/FilterStrip.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/InlineMarkdown.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/InlineText.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/SourceViewPicker.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/TextTileBody.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/TileFrame.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/TileMenu.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/annotationText.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/changedTile.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/chartLine.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/controls.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/inlineEdit.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/layout.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/loadMalloy.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/openDraft.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/preview.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/sortable.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/spliceResult.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/tagParse.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/fixtures.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/inline.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/resize.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/tileDisplayTitle.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useConversionConfirm.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useDraft.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useExitGuard.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useFilterForm.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useOpenDraftCommit.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useTileReorder.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useTileResize.d.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.render.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/FilterStrip.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/InlineMarkdown.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/InlineText.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/SourceViewPicker.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/TextTileBody.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/TileFrame.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/TileMenu.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/__test__/inventory.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/annotationText.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/annotationText.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/artifactTagParity.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/catalog.aggregate.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/changedTile.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/changedTile.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/chartLine.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/chartLine.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/controls.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/emptyStart.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/inlineEdit.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/invariants.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/keepRowStructure.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/layout.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/loadMalloy.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/loadMalloy.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/malloyTree.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/moveIntoGap.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/openDraft.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/preview.shapes.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/preview.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/scannerShapes.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/sortable.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/sortable.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.chart.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/spliceResult.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/statementExtent.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/tagParse.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/fixtures.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/inline.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/resize.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/urlRenderTags.json +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/tileDisplayTitle.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.overlay.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useConversionConfirm.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useDraft.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useExitGuard.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useExitGuard.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.existing.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useOpenDraftCommit.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileReorder.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileReorder.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileResize.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileResize.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/withGaps.spec.ts +0 -0
- /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 {
|
|
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
|
|
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
|
|
108
|
-
it("reads a
|
|
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.
|
|
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("
|
|
133
|
-
expect((await openDocument(DASHBOARD)).
|
|
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 {
|
|
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
|
|
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 {
|
|
181
|
+
`## artifact { layout=linear title="E" tiles=[] }\n`,
|
|
179
182
|
);
|
|
180
183
|
expect(document.tiles).toEqual([]);
|
|
181
|
-
expect(document.
|
|
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.
|
|
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 {
|
|
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 {
|
|
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
|
|
598
|
-
it("
|
|
599
|
-
const
|
|
600
|
-
d.
|
|
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"]
|
|
607
|
+
'## artifact { title="D" tiles=["a_tiles -> x"] layout=linear }',
|
|
616
608
|
);
|
|
617
609
|
expect(out).not.toContain("dashboard {");
|
|
618
|
-
expect(document.
|
|
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
|
|
626
|
-
const { out, document } = await writes(
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
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.
|
|
626
|
+
expect(document.layout).toBe("grid");
|
|
638
627
|
expect(document.columns).toBe(12);
|
|
639
628
|
});
|
|
640
629
|
|
|
641
|
-
it("
|
|
642
|
-
const
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
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
|
-
|
|
715
|
-
|
|
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("
|
|
722
|
-
expect(document.
|
|
723
|
-
const back = await writes(
|
|
724
|
-
|
|
725
|
-
|
|
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).
|
|
653
|
+
expect(back.out).toContain("layout=grid");
|
|
654
|
+
expect(back.out).not.toContain("layout=linear");
|
|
732
655
|
});
|
|
733
656
|
|
|
734
|
-
it("
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
);
|
|
740
|
-
if (
|
|
741
|
-
expect(result.
|
|
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 {
|
|
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:
|
|
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 {
|
|
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:
|
|
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
|
+
});
|