@malloy-publisher/sdk 0.9.1 → 0.9.3
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/dist/{RenderedResult-BRgIgxWh.es.js → RenderedResult-DwB0-9Yx.es.js} +219 -210
- package/dist/RenderedResult-hKjFEqaN.cjs.js +141 -0
- package/dist/{ServerProvider-Boxrv6Ym.es.js → ServerProvider-CcSrGaRN.es.js} +1473 -1326
- package/dist/ServerProvider-Gbf1YPOP.cjs.js +1 -0
- package/dist/builder/index.cjs.js +143 -58
- package/dist/builder/index.es.js +12179 -9318
- package/dist/builder-entry.d.ts +5 -1
- package/dist/client/api.d.ts +247 -56
- package/dist/client/configuration.d.ts +1 -1
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.es.js +94 -88
- package/dist/client-entry.d.ts +2 -0
- package/dist/components/ApiErrorDisplay.d.ts +11 -0
- package/dist/components/AppDialog.d.ts +6 -6
- package/dist/components/Dashboard/Dashboard.d.ts +8 -15
- package/dist/components/Dashboard/DashboardGrid.d.ts +38 -6
- package/dist/components/Dashboard/DashboardTile.d.ts +21 -2
- package/dist/components/Dashboard/DashboardView.d.ts +71 -0
- package/dist/components/Dashboard/TileCard.d.ts +30 -5
- package/dist/components/Dashboard/TileFilterTag.d.ts +12 -0
- package/dist/components/Dashboard/dropValueUrlTags.d.ts +6 -0
- package/dist/components/Dashboard/index.d.ts +5 -1
- package/dist/components/Dashboard/telemetry.d.ts +16 -3
- package/dist/components/Dashboard/textSource.d.ts +19 -0
- package/dist/components/DashboardBuilder/AddTileDialog.d.ts +15 -9
- package/dist/components/DashboardBuilder/BuilderDialogs.d.ts +25 -0
- package/dist/components/DashboardBuilder/BuilderGrid.d.ts +31 -0
- package/dist/components/DashboardBuilder/BuilderHeader.d.ts +17 -0
- package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +23 -15
- package/dist/components/DashboardBuilder/ChartPicker.d.ts +31 -0
- package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +56 -21
- package/dist/components/DashboardBuilder/DashboardEditor.d.ts +44 -5
- package/dist/components/DashboardBuilder/EditorSurface.d.ts +33 -0
- package/dist/components/DashboardBuilder/FilterDialog.d.ts +2 -2
- package/dist/components/DashboardBuilder/FilterStrip.d.ts +8 -4
- package/dist/components/DashboardBuilder/InlineMarkdown.d.ts +18 -0
- package/dist/components/DashboardBuilder/InlineText.d.ts +19 -0
- package/dist/components/DashboardBuilder/NotebookEditor.d.ts +15 -0
- package/dist/components/DashboardBuilder/SourceViewPicker.d.ts +9 -0
- package/dist/components/DashboardBuilder/TextTileBody.d.ts +10 -0
- package/dist/components/DashboardBuilder/TileFrame.d.ts +51 -12
- package/dist/components/DashboardBuilder/TileMenu.d.ts +12 -6
- package/dist/components/DashboardBuilder/annotationText.d.ts +4 -0
- package/dist/components/DashboardBuilder/builderReport.d.ts +13 -0
- package/dist/components/DashboardBuilder/catalog.d.ts +4 -18
- package/dist/components/DashboardBuilder/changedTile.d.ts +7 -0
- package/dist/components/DashboardBuilder/chartLine.d.ts +33 -0
- package/dist/components/DashboardBuilder/controls.d.ts +2 -2
- package/dist/components/DashboardBuilder/document.d.ts +42 -26
- package/dist/components/DashboardBuilder/documentSession.d.ts +100 -0
- package/dist/components/DashboardBuilder/imports.d.ts +19 -0
- package/dist/components/DashboardBuilder/inlineEdit.d.ts +18 -0
- package/dist/components/DashboardBuilder/legacyNotebook.d.ts +73 -0
- package/dist/components/DashboardBuilder/loadMalloy.d.ts +15 -0
- package/dist/components/DashboardBuilder/malloyTree.d.ts +119 -0
- package/dist/components/DashboardBuilder/newDashboard.d.ts +3 -1
- package/dist/components/DashboardBuilder/openDraft.d.ts +10 -0
- package/dist/components/DashboardBuilder/preview.d.ts +24 -4
- package/dist/components/DashboardBuilder/readDocument.d.ts +6 -1
- package/dist/components/DashboardBuilder/readForEditor.d.ts +16 -0
- package/dist/components/DashboardBuilder/sortable.d.ts +16 -0
- package/dist/components/DashboardBuilder/spliceDocument.d.ts +15 -13
- package/dist/components/DashboardBuilder/spliceResult.d.ts +11 -0
- package/dist/components/DashboardBuilder/tagParse.d.ts +24 -0
- package/dist/components/DashboardBuilder/telemetry.d.ts +43 -0
- package/dist/components/DashboardBuilder/testing/fixtures.d.ts +3 -1
- package/dist/components/DashboardBuilder/testing/inline.d.ts +4 -0
- package/dist/components/DashboardBuilder/testing/resize.d.ts +7 -0
- package/dist/components/DashboardBuilder/tileDisplayTitle.d.ts +7 -0
- package/dist/components/DashboardBuilder/useBuilderSelection.d.ts +53 -0
- package/dist/components/DashboardBuilder/useBuilderSession.d.ts +86 -0
- package/dist/components/DashboardBuilder/useBuilderShortcuts.d.ts +9 -6
- package/dist/components/DashboardBuilder/useControlBindings.d.ts +30 -0
- package/dist/components/DashboardBuilder/useConversionConfirm.d.ts +20 -0
- package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +19 -55
- package/dist/components/DashboardBuilder/useDocumentEditor.d.ts +105 -0
- package/dist/components/DashboardBuilder/useDraft.d.ts +3 -1
- package/dist/components/DashboardBuilder/useExitGuard.d.ts +19 -0
- package/dist/components/DashboardBuilder/useFilterForm.d.ts +3 -3
- package/dist/components/DashboardBuilder/useHostCopy.d.ts +26 -0
- package/dist/components/DashboardBuilder/useOpenDraftCommit.d.ts +17 -0
- package/dist/components/DashboardBuilder/useOpenedDocument.d.ts +71 -0
- package/dist/components/DashboardBuilder/useSaveChannel.d.ts +50 -0
- package/dist/components/DashboardBuilder/useTileEditing.d.ts +33 -0
- package/dist/components/DashboardBuilder/useTileResize.d.ts +6 -3
- package/dist/components/DocumentCreate/canRetry.d.ts +6 -0
- package/dist/components/DocumentCreate/createDocument.d.ts +58 -0
- package/dist/components/DocumentCreate/documentPath.d.ts +10 -0
- package/dist/components/DocumentCreate/events.d.ts +10 -0
- package/dist/components/DocumentCreate/exportedSources.d.ts +7 -0
- package/dist/components/DocumentCreate/guards.d.ts +12 -0
- package/dist/components/DocumentCreate/index.d.ts +6 -0
- package/dist/components/DocumentCreate/newNotebook.d.ts +9 -0
- package/dist/components/DocumentCreate/useDocumentChoices.d.ts +32 -0
- package/dist/components/DocumentStorage/DocumentStorage.d.ts +2 -1
- package/dist/components/Loading.d.ts +13 -0
- package/dist/components/NarrowEditGate.d.ts +8 -0
- package/dist/components/Notebook/Notebook.d.ts +1 -1
- package/dist/components/Notebook/NotebookCell.d.ts +1 -5
- package/dist/components/Package/NewDocumentDialog.d.ts +33 -0
- package/dist/components/Package/Package.d.ts +17 -1
- package/dist/components/Package/documentLocation.d.ts +28 -0
- package/dist/components/Package/index.d.ts +5 -1
- package/dist/components/Package/useDocumentLocation.d.ts +12 -0
- package/dist/components/PackageSection.d.ts +2 -2
- package/dist/components/Prose.d.ts +1 -1
- package/dist/components/RenderedResult/RenderedResult.d.ts +2 -0
- package/dist/components/RenderedResult/ResultContainer.d.ts +8 -1
- package/dist/components/RenderedResult/ResultPanel.d.ts +3 -1
- package/dist/components/RenderedResult/loadRenderer.d.ts +7 -0
- package/dist/components/RenderedResult/resultSizing.d.ts +9 -1
- package/dist/components/ServerProvider.d.ts +2 -1
- package/dist/components/UnsavedChangesDialog.d.ts +9 -0
- package/dist/components/given/GivensPanel.d.ts +2 -2
- package/dist/components/given/paramCodec.d.ts +8 -1
- package/dist/components/index.d.ts +3 -2
- package/dist/components/styles.d.ts +4 -4
- package/dist/hooks/givenValue.d.ts +6 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useCompiledDocument.d.ts +23 -0
- package/dist/hooks/useDocumentControls.d.ts +6 -1
- package/dist/hooks/useNarrowScreen.d.ts +4 -0
- package/dist/hooks/useNearViewport.d.ts +16 -0
- package/dist/hooks/useQueryResult.d.ts +2 -0
- package/dist/hooks/useQueryWithApiError.d.ts +7 -2
- package/dist/hooks/useSettled.d.ts +14 -0
- package/dist/hooks/useSuggestOptions.d.ts +9 -2
- package/dist/index.cjs.js +23 -24
- package/dist/index.es.js +9041 -7002
- package/dist/text/index.cjs.js +1 -0
- package/dist/text/index.d.ts +2 -0
- package/dist/text/index.es.js +6 -0
- package/dist/text-entry-BJwltZiy.cjs.js +7 -0
- package/dist/text-entry-CA0LZ1xL.es.js +196 -0
- package/dist/text-entry.d.ts +2 -0
- package/dist/theme/accent.d.ts +29 -0
- package/dist/theme/buildVegaThemeOverride.d.ts +3 -3
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/keys.d.ts +1 -1
- package/dist/theme/motion.d.ts +31 -0
- package/dist/theme/readChartAnnotations.d.ts +1 -1
- package/dist/theme/resolveTheme.d.ts +4 -4
- package/dist/theme/types.d.ts +33 -5
- package/dist/{Dashboard-H1kJlDFo.es.js → useCompiledDocument-BU6d8FPp.es.js} +17904 -19057
- package/dist/useCompiledDocument-pOg2W-Yt.cjs.js +142 -0
- package/dist/utils/clock.d.ts +2 -0
- package/dist/utils/malloyText.d.ts +104 -0
- package/package.json +20 -11
- package/src/builder-entry.ts +36 -0
- package/src/client-entry.ts +8 -0
- package/src/clientEntry.spec.ts +17 -0
- package/src/components/ApiErrorDisplay.tsx +37 -18
- package/src/components/AppDialog.tsx +8 -7
- package/src/components/Dashboard/Dashboard.spec.tsx +3 -32
- package/src/components/Dashboard/Dashboard.tsx +29 -280
- package/src/components/Dashboard/DashboardGrid.tsx +87 -8
- package/src/components/Dashboard/DashboardTile.spec.tsx +121 -2
- package/src/components/Dashboard/DashboardTile.tsx +121 -30
- package/src/components/Dashboard/DashboardView.spec.tsx +368 -0
- package/src/components/Dashboard/DashboardView.tsx +428 -0
- package/src/components/Dashboard/RowsDialog.tsx +4 -3
- package/src/components/Dashboard/TileCard.tsx +60 -11
- package/src/components/Dashboard/TileFilterTag.spec.tsx +73 -0
- package/src/components/Dashboard/TileFilterTag.tsx +78 -0
- package/src/components/Dashboard/defaultTileSpan.spec.ts +32 -0
- package/src/components/Dashboard/dropValueUrlTags.spec.ts +177 -0
- package/src/components/Dashboard/dropValueUrlTags.ts +108 -0
- package/src/components/Dashboard/index.ts +13 -1
- package/src/components/Dashboard/telemetry.ts +17 -5
- package/src/components/Dashboard/textSource.spec.ts +36 -0
- package/src/components/Dashboard/textSource.ts +39 -0
- package/src/components/DashboardBuilder/AddTileDialog.spec.tsx +88 -0
- package/src/components/DashboardBuilder/AddTileDialog.tsx +124 -138
- package/src/components/DashboardBuilder/BuilderDialogs.tsx +162 -0
- package/src/components/DashboardBuilder/BuilderGrid.tsx +245 -0
- package/src/components/DashboardBuilder/BuilderHeader.tsx +107 -0
- package/src/components/DashboardBuilder/BuilderToolbar.tsx +111 -80
- package/src/components/DashboardBuilder/ChartPicker.render.spec.tsx +25 -0
- package/src/components/DashboardBuilder/ChartPicker.spec.ts +77 -0
- package/src/components/DashboardBuilder/ChartPicker.tsx +156 -0
- package/src/components/DashboardBuilder/DashboardBuilder.charts.spec.tsx +205 -0
- package/src/components/DashboardBuilder/DashboardBuilder.exit.spec.tsx +183 -0
- package/src/components/DashboardBuilder/DashboardBuilder.inline.spec.tsx +373 -0
- package/src/components/DashboardBuilder/DashboardBuilder.notebook.spec.tsx +310 -0
- package/src/components/DashboardBuilder/DashboardBuilder.openDraft.spec.tsx +105 -0
- package/src/components/DashboardBuilder/DashboardBuilder.sources.spec.tsx +117 -0
- package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +146 -108
- package/src/components/DashboardBuilder/DashboardBuilder.textTiles.spec.tsx +179 -0
- package/src/components/DashboardBuilder/DashboardBuilder.tsx +330 -512
- package/src/components/DashboardBuilder/DashboardEditor.authoritative.spec.tsx +55 -25
- package/src/components/DashboardBuilder/DashboardEditor.emptyStart.spec.tsx +142 -0
- package/src/components/DashboardBuilder/DashboardEditor.filterTag.spec.tsx +162 -0
- package/src/components/DashboardBuilder/DashboardEditor.notebook.spec.tsx +310 -0
- package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +39 -13
- package/src/components/DashboardBuilder/DashboardEditor.resourceUri.spec.tsx +9 -26
- package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +102 -25
- package/src/components/DashboardBuilder/DashboardEditor.textSource.spec.tsx +317 -0
- package/src/components/DashboardBuilder/DashboardEditor.tsx +252 -780
- package/src/components/DashboardBuilder/DrillDialog.tsx +2 -2
- package/src/components/DashboardBuilder/EditorSurface.tsx +471 -0
- package/src/components/DashboardBuilder/FilterDialog.tsx +23 -11
- package/src/components/DashboardBuilder/FilterStrip.tsx +130 -70
- package/src/components/DashboardBuilder/InlineMarkdown.tsx +182 -0
- package/src/components/DashboardBuilder/InlineText.tsx +112 -0
- package/src/components/DashboardBuilder/NotebookEditor.tsx +44 -0
- package/src/components/DashboardBuilder/SourceViewPicker.tsx +122 -0
- package/src/components/DashboardBuilder/TextTileBody.tsx +31 -0
- package/src/components/DashboardBuilder/TileFrame.tsx +302 -163
- package/src/components/DashboardBuilder/TileMenu.tsx +125 -97
- package/src/components/DashboardBuilder/annotationText.spec.ts +33 -0
- package/src/components/DashboardBuilder/annotationText.ts +17 -0
- package/src/components/DashboardBuilder/artifactBlock.spec.ts +248 -0
- package/src/components/DashboardBuilder/artifactTagParity.spec.ts +46 -0
- package/src/components/DashboardBuilder/builderReport.ts +74 -0
- package/src/components/DashboardBuilder/catalog.aggregate.spec.ts +49 -0
- package/src/components/DashboardBuilder/catalog.spec.ts +2 -44
- package/src/components/DashboardBuilder/catalog.ts +61 -57
- package/src/components/DashboardBuilder/changedTile.spec.ts +46 -0
- package/src/components/DashboardBuilder/changedTile.ts +28 -0
- package/src/components/DashboardBuilder/chartLine.spec.ts +180 -0
- package/src/components/DashboardBuilder/chartLine.ts +121 -0
- package/src/components/DashboardBuilder/controls.spec.ts +21 -10
- package/src/components/DashboardBuilder/controls.ts +22 -8
- package/src/components/DashboardBuilder/document.ts +53 -5
- package/src/components/DashboardBuilder/documentSession.spec.ts +209 -0
- package/src/components/DashboardBuilder/documentSession.ts +258 -0
- package/src/components/DashboardBuilder/emptyStart.spec.ts +131 -0
- package/src/components/DashboardBuilder/imports.spec.ts +61 -0
- package/src/components/DashboardBuilder/imports.ts +93 -0
- package/src/components/DashboardBuilder/inlineEdit.tsx +78 -0
- package/src/components/DashboardBuilder/invariants.spec.ts +6 -2
- package/src/components/DashboardBuilder/legacyNotebook.chart.spec.ts +77 -0
- package/src/components/DashboardBuilder/legacyNotebook.convert.spec.ts +630 -0
- package/src/components/DashboardBuilder/legacyNotebook.read.spec.ts +338 -0
- package/src/components/DashboardBuilder/legacyNotebook.ts +1117 -0
- package/src/components/DashboardBuilder/loadMalloy.spec.ts +80 -0
- package/src/components/DashboardBuilder/loadMalloy.ts +39 -0
- package/src/components/DashboardBuilder/malloyTree.ts +159 -7
- package/src/components/DashboardBuilder/newDashboard.spec.ts +46 -2
- package/src/components/DashboardBuilder/newDashboard.ts +30 -3
- package/src/components/DashboardBuilder/openDraft.ts +52 -0
- package/src/components/DashboardBuilder/preview.shapes.spec.ts +75 -0
- package/src/components/DashboardBuilder/preview.spec.ts +159 -12
- package/src/components/DashboardBuilder/preview.ts +83 -9
- package/src/components/DashboardBuilder/readDocument.spec.ts +174 -26
- package/src/components/DashboardBuilder/readDocument.ts +137 -45
- package/src/components/DashboardBuilder/readForEditor.spec.ts +80 -0
- package/src/components/DashboardBuilder/readForEditor.ts +52 -0
- package/src/components/DashboardBuilder/scannerShapes.spec.ts +14 -13
- package/src/components/DashboardBuilder/sortable.spec.ts +89 -0
- package/src/components/DashboardBuilder/sortable.tsx +11 -10
- package/src/components/DashboardBuilder/spliceDocument.chart.spec.ts +340 -0
- package/src/components/DashboardBuilder/spliceDocument.imports.spec.ts +167 -0
- package/src/components/DashboardBuilder/spliceDocument.spec.ts +229 -94
- package/src/components/DashboardBuilder/spliceDocument.ts +768 -131
- package/src/components/DashboardBuilder/spliceResult.ts +15 -0
- package/src/components/DashboardBuilder/statementExtent.spec.ts +33 -30
- package/src/components/DashboardBuilder/tagParse.spec.ts +149 -0
- package/src/components/DashboardBuilder/tagParse.ts +103 -0
- package/src/components/DashboardBuilder/telemetry.ts +47 -0
- package/src/components/DashboardBuilder/testing/artifactTagParity.json +253 -0
- package/src/components/DashboardBuilder/testing/documentKindRule.json +40 -0
- package/src/components/DashboardBuilder/testing/fixtures.ts +16 -1
- package/src/components/DashboardBuilder/testing/inline.ts +25 -0
- package/src/components/DashboardBuilder/testing/resize.ts +48 -0
- package/src/components/DashboardBuilder/testing/urlRenderTags.json +62 -0
- package/src/components/DashboardBuilder/textTiles.spec.ts +760 -0
- package/src/components/DashboardBuilder/tileDisplayTitle.ts +13 -0
- package/src/components/DashboardBuilder/useBuilderSelection.ts +121 -0
- package/src/components/DashboardBuilder/useBuilderSession.spec.ts +250 -0
- package/src/components/DashboardBuilder/useBuilderSession.ts +255 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.overlay.spec.tsx +97 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.spec.tsx +60 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.ts +45 -9
- package/src/components/DashboardBuilder/useControlBindings.ts +152 -0
- package/src/components/DashboardBuilder/useConversionConfirm.ts +55 -0
- package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +16 -13
- package/src/components/DashboardBuilder/useDashboardEditor.ts +57 -181
- package/src/components/DashboardBuilder/useDocumentEditor.spec.ts +565 -0
- package/src/components/DashboardBuilder/useDocumentEditor.ts +399 -0
- package/src/components/DashboardBuilder/useDraft.ts +15 -2
- package/src/components/DashboardBuilder/useExitGuard.spec.ts +159 -0
- package/src/components/DashboardBuilder/useExitGuard.ts +89 -0
- package/src/components/DashboardBuilder/useFilterForm.existing.spec.tsx +41 -0
- package/src/components/DashboardBuilder/useFilterForm.spec.tsx +24 -2
- package/src/components/DashboardBuilder/useFilterForm.ts +41 -13
- package/src/components/DashboardBuilder/useHostCopy.ts +104 -0
- package/src/components/DashboardBuilder/useOpenDraftCommit.ts +47 -0
- package/src/components/DashboardBuilder/useOpenedDocument.ts +314 -0
- package/src/components/DashboardBuilder/useSaveChannel.ts +275 -0
- package/src/components/DashboardBuilder/useTileEditing.ts +141 -0
- package/src/components/DashboardBuilder/useTileReorder.spec.tsx +28 -5
- package/src/components/DashboardBuilder/useTileReorder.ts +5 -7
- package/src/components/DashboardBuilder/useTileResize.spec.tsx +30 -5
- package/src/components/DashboardBuilder/useTileResize.ts +31 -8
- package/src/components/DataAppViewer/DataAppViewer.tsx +7 -4
- package/src/components/DocumentCreate/canRetry.spec.ts +32 -0
- package/src/components/DocumentCreate/canRetry.ts +19 -0
- package/src/components/DocumentCreate/createDocument.spec.ts +310 -0
- package/src/components/DocumentCreate/createDocument.ts +159 -0
- package/src/components/DocumentCreate/documentPath.ts +40 -0
- package/src/components/DocumentCreate/events.ts +15 -0
- package/src/components/DocumentCreate/exportedSources.ts +25 -0
- package/src/components/DocumentCreate/guards.ts +45 -0
- package/src/components/DocumentCreate/index.ts +27 -0
- package/src/components/DocumentCreate/newNotebook.spec.ts +156 -0
- package/src/components/DocumentCreate/newNotebook.ts +44 -0
- package/src/components/DocumentCreate/useDocumentChoices.spec.tsx +138 -0
- package/src/components/DocumentCreate/useDocumentChoices.ts +113 -0
- package/src/components/DocumentStorage/DocumentStorage.ts +2 -1
- package/src/components/Environment/Environment.tsx +0 -10
- package/src/components/Loading.tsx +14 -0
- package/src/components/Model/Model.tsx +16 -9
- package/src/components/Model/ModelExplorer.spec.tsx +2 -2
- package/src/components/Model/ModelExplorer.tsx +2 -2
- package/src/components/Model/SourcesExplorer.tsx +2 -4
- package/src/components/NarrowEditGate.spec.tsx +73 -0
- package/src/components/NarrowEditGate.tsx +29 -0
- package/src/components/Notebook/Notebook.layout.spec.tsx +94 -0
- package/src/components/Notebook/Notebook.tsx +72 -29
- package/src/components/Notebook/NotebookCell.tsx +90 -215
- package/src/components/Package/NewDocumentDialog.spec.tsx +749 -0
- package/src/components/Package/NewDocumentDialog.tsx +401 -0
- package/src/components/Package/Package.artifacts.spec.tsx +186 -0
- package/src/components/Package/Package.create.spec.tsx +401 -0
- package/src/components/Package/Package.notebooks.spec.tsx +18 -0
- package/src/components/Package/Package.tsx +396 -177
- package/src/components/Package/documentLocation.spec.ts +81 -0
- package/src/components/Package/documentLocation.ts +55 -0
- package/src/components/Package/index.ts +14 -1
- package/src/components/Package/useDocumentLocation.ts +59 -0
- package/src/components/PackageSection.tsx +2 -2
- package/src/components/Prose.spec.tsx +37 -0
- package/src/components/Prose.tsx +35 -5
- package/src/components/RenderedResult/RenderedResult.tsx +23 -8
- package/src/components/RenderedResult/ResultContainer.tsx +51 -13
- package/src/components/RenderedResult/ResultPanel.tsx +24 -5
- package/src/components/RenderedResult/loadRenderer.ts +42 -0
- package/src/components/RenderedResult/resultSizing.spec.ts +68 -0
- package/src/components/RenderedResult/resultSizing.ts +14 -3
- package/src/components/ServerProvider.tsx +2 -1
- package/src/components/UnsavedChangesDialog.spec.tsx +70 -0
- package/src/components/UnsavedChangesDialog.tsx +49 -0
- package/src/components/given/GivenInput.spec.tsx +5 -5
- package/src/components/given/GivenInput.tsx +46 -38
- package/src/components/given/GivensPanel.spec.tsx +6 -6
- package/src/components/given/GivensPanel.tsx +5 -11
- package/src/components/given/paramCodec.ts +27 -1
- package/src/components/index.ts +3 -2
- package/src/components/styles.ts +4 -5
- package/src/hooks/givenValue.ts +9 -0
- package/src/hooks/index.ts +7 -0
- package/src/hooks/useCompiledDocument.spec.tsx +86 -0
- package/src/hooks/useCompiledDocument.ts +59 -0
- package/src/hooks/useDimensionalFilterRangeData.ts +3 -1
- package/src/hooks/useDocumentControls.ts +13 -1
- package/src/hooks/useNarrowScreen.ts +21 -0
- package/src/hooks/useNearViewport.spec.tsx +150 -0
- package/src/hooks/useNearViewport.ts +102 -0
- package/src/hooks/useQueryResult.ts +23 -1
- package/src/hooks/useQueryWithApiError.ts +10 -3
- package/src/hooks/useRawQueryData.ts +3 -1
- package/src/hooks/useSettled.spec.ts +41 -0
- package/src/hooks/useSettled.ts +27 -0
- package/src/hooks/useSuggestOptions.dom.spec.ts +40 -1
- package/src/hooks/useSuggestOptions.ts +42 -10
- package/src/mainEntry.spec.ts +145 -0
- package/src/text-entry.ts +12 -0
- package/src/textEntry.spec.ts +112 -0
- package/src/theme/accent.spec.ts +116 -0
- package/src/theme/accent.ts +148 -0
- package/src/theme/buildTableCssVars.spec.ts +24 -0
- package/src/theme/buildTableCssVars.ts +1 -2
- package/src/theme/buildVegaThemeOverride.spec.ts +38 -2
- package/src/theme/buildVegaThemeOverride.ts +5 -5
- package/src/theme/defaults.ts +34 -0
- package/src/theme/index.ts +9 -0
- package/src/theme/keys.ts +6 -0
- package/src/theme/motion.ts +44 -0
- package/src/theme/readChartAnnotations.spec.ts +18 -0
- package/src/theme/readChartAnnotations.ts +1 -1
- package/src/theme/resolveTheme.spec.ts +73 -0
- package/src/theme/resolveTheme.ts +61 -20
- package/src/theme/types.ts +30 -5
- package/src/utils/clock.spec.ts +12 -0
- package/src/utils/clock.ts +6 -0
- package/src/{components/DashboardBuilder → utils}/malloyText.spec.ts +48 -0
- package/src/utils/malloyText.ts +368 -0
- package/src/utils/queryClient.ts +8 -0
- package/vite.config.ts +4 -0
- package/dist/Dashboard-ChyylkTD.cjs.js +0 -136
- package/dist/RenderedResult-AJPMUkAD.cjs.js +0 -135
- package/dist/ServerProvider-CXrOKD6g.cjs.js +0 -1
- package/dist/components/Dashboard/DashboardBar.d.ts +0 -21
- package/dist/components/Dashboard/ExploreDialog.d.ts +0 -20
- package/dist/components/DashboardBuilder/DiffDialog.d.ts +0 -15
- package/dist/components/DashboardBuilder/SettingsPopover.d.ts +0 -20
- package/dist/components/DashboardBuilder/diff.d.ts +0 -35
- package/dist/components/DashboardBuilder/malloyText.d.ts +0 -64
- package/dist/components/Package/NewDashboardDialog.d.ts +0 -18
- package/src/components/Dashboard/DashboardBar.tsx +0 -88
- package/src/components/Dashboard/ExploreDialog.tsx +0 -89
- package/src/components/DashboardBuilder/DiffDialog.tsx +0 -122
- package/src/components/DashboardBuilder/SettingsPopover.tsx +0 -168
- package/src/components/DashboardBuilder/diff.spec.ts +0 -44
- package/src/components/DashboardBuilder/diff.ts +0 -93
- package/src/components/DashboardBuilder/malloyText.ts +0 -214
- package/src/components/Package/NewDashboardDialog.spec.tsx +0 -129
- package/src/components/Package/NewDashboardDialog.tsx +0 -265
|
@@ -1,33 +1,72 @@
|
|
|
1
1
|
import { PointerEvent, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Theme } from '@mui/material';
|
|
3
|
+
import { SystemStyleObject } from '@mui/system';
|
|
4
|
+
import { ResolvedTheme } from '../../theme/types';
|
|
5
|
+
import { TileChrome, TileHeadingSlots } from '../Dashboard/TileCard';
|
|
6
|
+
import { DashboardTile, QueryTile } from './document';
|
|
3
7
|
/**
|
|
4
|
-
* Everything the builder draws AROUND a tile: the selection outline, the
|
|
5
|
-
* the
|
|
8
|
+
* Everything the builder draws AROUND a tile: the selection outline, the menu
|
|
9
|
+
* button, the handle at the right edge and, in a notebook, the insert button. The tile
|
|
6
10
|
* itself is `children` — the host's real `DashboardTile`, or a placeholder
|
|
7
11
|
* saying what the tile will run.
|
|
8
12
|
*/
|
|
9
|
-
export declare function TileFrame({ tile, index, selected, menuOpen,
|
|
13
|
+
export declare function TileFrame({ tile, index, selected, flash, menuOpen, bare, onInsertAfter, onSelect, onOpenMenu, resizing, width, onResizeStart, onResizeMove, onResizeEnd, children, }: {
|
|
10
14
|
tile: DashboardTile;
|
|
11
15
|
index: number;
|
|
12
16
|
selected: boolean;
|
|
17
|
+
/** Briefly lit: the tile an undo or redo just changed. */
|
|
18
|
+
flash?: boolean;
|
|
13
19
|
/** Whether this tile's menu is open, which keeps its button showing. */
|
|
14
20
|
menuOpen: boolean;
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The tile has no card (a notebook's): its ring is drawn clear of the
|
|
23
|
+
* content and its menu sits on the ring's top edge, so neither touches the
|
|
24
|
+
* text, and the tile reads where the reader draws it.
|
|
25
|
+
*/
|
|
26
|
+
bare?: boolean;
|
|
27
|
+
/** Offers a "+" on the bottom edge that adds a tile after this one; set where tiles stack in one column. */
|
|
28
|
+
onInsertAfter?: () => void;
|
|
18
29
|
onSelect: () => void;
|
|
19
30
|
onOpenMenu: (anchor: HTMLElement) => void;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
/** This tile's edge is being dragged. */
|
|
32
|
+
resizing?: boolean;
|
|
33
|
+
/** Dragging the right edge sets the width; absent, the tile has no edge handle (one column, or tags the file does not own). */
|
|
34
|
+
onResizeStart?: (event: PointerEvent<HTMLDivElement>) => void;
|
|
35
|
+
onResizeMove?: (event: PointerEvent<HTMLDivElement>) => void;
|
|
36
|
+
onResizeEnd?: (event: PointerEvent<HTMLDivElement>) => void;
|
|
37
|
+
/** The tile's width and the grid's, and a step of one column: the edge's keyboard route. */
|
|
38
|
+
width?: {
|
|
39
|
+
span: number;
|
|
40
|
+
columns: number;
|
|
41
|
+
onStep: (to: number) => void;
|
|
42
|
+
};
|
|
23
43
|
children: ReactNode;
|
|
24
44
|
}): import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
/** How far the selection ring stands outside what it selects: its 2px offset plus its 2px width. */
|
|
46
|
+
export declare const SELECTION_RING_PX = 4;
|
|
47
|
+
/**
|
|
48
|
+
* The builder's selection look, for anything a person can select — a tile,
|
|
49
|
+
* the description: an outline outside the element (so selecting moves no
|
|
50
|
+
* layout), solid in the accent when selected, lifting on hover the way a card
|
|
51
|
+
* does in any builder's edit mode, and a brief halo when an undo or redo just
|
|
52
|
+
* changed it. One definition, so the description selects exactly as a tile.
|
|
53
|
+
*/
|
|
54
|
+
export declare const selectionSx: (theme: ResolvedTheme, { selected, flash, bare, }: {
|
|
55
|
+
selected: boolean;
|
|
56
|
+
flash?: boolean;
|
|
57
|
+
bare?: boolean;
|
|
58
|
+
}) => SystemStyleObject<Theme>;
|
|
25
59
|
/**
|
|
26
60
|
* No host-supplied tile: say what this one will run, so the surface is still
|
|
27
61
|
* legible without a server.
|
|
28
62
|
*/
|
|
29
|
-
export declare function TilePlaceholder({ tile }: {
|
|
30
|
-
tile:
|
|
63
|
+
export declare function TilePlaceholder({ tile, heading, note, chrome, }: {
|
|
64
|
+
tile: QueryTile;
|
|
65
|
+
heading?: TileHeadingSlots;
|
|
66
|
+
/** Why there is no preview, in place of an empty body. */
|
|
67
|
+
note?: string;
|
|
68
|
+
/** The document's tile chrome, as the reader draws it. */
|
|
69
|
+
chrome?: TileChrome;
|
|
31
70
|
}): import("react/jsx-runtime").JSX.Element;
|
|
32
71
|
/** The empty end of a row, made a drop target while a drag is live. */
|
|
33
72
|
export declare function GapTarget({ after }: {
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { CatalogView } from './catalog';
|
|
1
2
|
import { DashboardTile } from './document';
|
|
2
3
|
/**
|
|
3
4
|
* A tile's own settings, on the tile: a popover off its menu button, so
|
|
4
|
-
* editing it never means scrolling away from it. Its
|
|
5
|
-
*
|
|
5
|
+
* editing it never means scrolling away from it. Its chart, clickable cells
|
|
6
|
+
* and removal; its width is set by dragging its right edge; its title and subtitle are edited on the tile. Its row is set by dragging it — a drop
|
|
6
7
|
* into the empty end of a row is what "start a new row" means — and its card
|
|
7
8
|
* is the reader's to decide, so neither is a toggle here. Which controls it
|
|
8
9
|
* answers to is not here either: filters are configured in one place, the
|
|
9
|
-
* strip under the header.
|
|
10
|
+
* strip under the header. A chart pick commits at once, so the tile redraws
|
|
11
|
+
* under the open menu (`useDraft`'s `apply`).
|
|
12
|
+
*
|
|
13
|
+
* A text tile has only Remove: its words are written on the tile itself.
|
|
10
14
|
*/
|
|
11
15
|
export interface TileMenuProps {
|
|
12
16
|
anchor: HTMLElement | null;
|
|
@@ -16,9 +20,11 @@ export interface TileMenuProps {
|
|
|
16
20
|
onCommit: (next: DashboardTile) => void;
|
|
17
21
|
/** Take the tile off the dashboard. Offered on every tile: order is this file's. */
|
|
18
22
|
onRemove: () => void;
|
|
19
|
-
/**
|
|
20
|
-
|
|
23
|
+
/** Why removing is refused, shown beside a Remove that stays focusable; absent when it is allowed. */
|
|
24
|
+
removeBlocked?: string;
|
|
21
25
|
/** Open the clickable-cells window for this tile's source. */
|
|
22
26
|
onDrills: () => void;
|
|
27
|
+
/** The catalog's view the tile shows, when the catalog knows it: what decides which charts are offered. */
|
|
28
|
+
view?: Pick<CatalogView, "chart" | "aggregateOnly">;
|
|
23
29
|
}
|
|
24
|
-
export declare function TileMenu({ anchor, tile, onClose, onCommit, onRemove,
|
|
30
|
+
export declare function TileMenu({ anchor, tile, onClose, onCommit, onRemove, removeBlocked, onDrills, view, }: TileMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** A copy of the server's `AUTHORIZE_TAG_LIKE`, kept in step by a parity spec; the server's caller guard reads it anywhere outside markdown and text prose, and a tag value or `#"` caption is not prose. */
|
|
2
|
+
export declare const AUTHORIZE_TAG_LIKE: string;
|
|
3
|
+
/** Why `text` cannot be written into a tag value or a `#"` note (`what` names it), or undefined when it can. */
|
|
4
|
+
export declare function annotationTextProblem(what: string, text: string): string | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SavesTo } from './documentSession';
|
|
2
|
+
import { BuilderEvent } from './telemetry';
|
|
3
|
+
import { SessionReport } from './useBuilderSession';
|
|
4
|
+
/**
|
|
5
|
+
* What the builder's session says about a save, in the event names the
|
|
6
|
+
* document's kind reports under.
|
|
7
|
+
*/
|
|
8
|
+
export declare const builderReport: ({ size, notebook, savesTo, onEvent, }: {
|
|
9
|
+
size: number;
|
|
10
|
+
notebook: boolean;
|
|
11
|
+
savesTo: SavesTo;
|
|
12
|
+
onEvent: ((event: BuilderEvent) => void) | undefined;
|
|
13
|
+
}) => SessionReport;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { CompiledModel } from '../../client';
|
|
2
|
+
import { CHART_TAGS } from './chartLine';
|
|
3
|
+
export { CHART_TAGS };
|
|
2
4
|
/**
|
|
3
5
|
* What a package offers a dashboard: the sources, the views on them, and the
|
|
4
6
|
* fields a drill can be declared on.
|
|
@@ -24,6 +26,8 @@ export interface CatalogView {
|
|
|
24
26
|
description?: string;
|
|
25
27
|
/** `bar_chart`, `line_chart`, `shape_map`, … if the view declares one. */
|
|
26
28
|
chart?: string;
|
|
29
|
+
/** Every output column is an aggregate, which is the only shape `big_value` renders. Absent when the model did not say. */
|
|
30
|
+
aggregateOnly?: boolean;
|
|
27
31
|
}
|
|
28
32
|
export interface CatalogSource {
|
|
29
33
|
name: string;
|
|
@@ -60,21 +64,3 @@ export declare function filterableFields(catalog: PackageCatalog | undefined, so
|
|
|
60
64
|
*/
|
|
61
65
|
export declare const isDashboardModel: (path: string | undefined) => boolean;
|
|
62
66
|
export declare function buildCatalog(models: CompiledModel[]): PackageCatalog;
|
|
63
|
-
/**
|
|
64
|
-
* The part of the package catalog a dashboard file can actually use.
|
|
65
|
-
*
|
|
66
|
-
* The builder never writes an import, so a source the file cannot see would
|
|
67
|
-
* produce a tile that does not compile. A named import says exactly which
|
|
68
|
-
* names it brings. A whole-file import of a published model brings that
|
|
69
|
-
* model's sources. A whole-file import of a file off the surface cannot be
|
|
70
|
-
* read, so then every published source is offered and a wrong pick is caught
|
|
71
|
-
* by the compile check the editor already runs.
|
|
72
|
-
*/
|
|
73
|
-
export declare function visibleToDashboard(catalog: PackageCatalog, imports: ReadonlyArray<{
|
|
74
|
-
kind: "all";
|
|
75
|
-
path: string;
|
|
76
|
-
} | {
|
|
77
|
-
kind: "names";
|
|
78
|
-
names: string[];
|
|
79
|
-
path: string;
|
|
80
|
-
}>, published: CompiledModel[]): PackageCatalog;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DashboardDocument } from './document';
|
|
2
|
+
/**
|
|
3
|
+
* The key of the first tile that differs between two states of a document: new
|
|
4
|
+
* in `after`, edited, or moved. Undefined when no tile that still exists
|
|
5
|
+
* changed (a title edit, or a tile that is gone), so there is nowhere to point.
|
|
6
|
+
*/
|
|
7
|
+
export declare function changedTileKey(before: DashboardDocument, after: DashboardDocument): string | undefined;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one `# <chart>` tag line a builder writes above a tile or a query cell.
|
|
3
|
+
* Pure text, with no Malloy import, so both writers and the main entry can reach it.
|
|
4
|
+
*/
|
|
5
|
+
/** The renderer's chart tags, as they are spelled in a model. */
|
|
6
|
+
export declare const CHART_TAGS: string[];
|
|
7
|
+
/** The tags the renderer has a plugin for, in the order a line negates them. */
|
|
8
|
+
declare const PLUGIN_TAGS: readonly ["line_chart", "bar_chart", "big_value", "scatter_chart", "shape_map", "segment_map"];
|
|
9
|
+
export type ChartPick = (typeof PLUGIN_TAGS)[number];
|
|
10
|
+
/** What a picker holds: a chart, no chart (a table), the view's own (no line), or a line the builder does not model. */
|
|
11
|
+
export type ChartState = ChartPick | "none" | "default" | "custom";
|
|
12
|
+
export declare const isChartPick: (value: unknown) => value is ChartPick;
|
|
13
|
+
export interface ChartLineParts {
|
|
14
|
+
negated: string[];
|
|
15
|
+
pick?: string;
|
|
16
|
+
}
|
|
17
|
+
/** `#`, any `-name`s, at most one `name`, every name a chart tag or `viz`, no `{` and no `=`; anything else is not ours to rewrite. */
|
|
18
|
+
export declare function parseChartLine(line: string): ChartLineParts | undefined;
|
|
19
|
+
/** Some other `#` tag line that names a chart tag (`# bar_chart { size=spark }`), which a chart edit must leave alone. */
|
|
20
|
+
export declare function mentionsChartTag(line: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The line for a pick. Given the chart tags the view carries it negates only those; without them
|
|
23
|
+
* (the catalog does not know the view) it negates every other chart tag. `-viz` stays either way,
|
|
24
|
+
* since the catalog does not report a `viz=` tag.
|
|
25
|
+
*/
|
|
26
|
+
export declare function chartLineText(chart: ChartPick | "none", carried?: readonly string[]): string;
|
|
27
|
+
/** The picker state of a tile's or cell's recognized chart lines. */
|
|
28
|
+
export declare function chartStateOf(lines: string[]): ChartState;
|
|
29
|
+
/** What a tile's `#` lines say about its chart: nothing (undefined), a state, or "custom" when any line names a chart tag the builder does not model. */
|
|
30
|
+
export declare function chartStateOfTagLines(lines: string[]): ChartState | undefined;
|
|
31
|
+
/** The lines of `lines` that are about the chart, recognized or not: what a "custom" state is made of. */
|
|
32
|
+
export declare const chartLinesOf: (lines: string[]) => string[];
|
|
33
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DashboardDocument, DashboardTile, LocalGiven } from './document';
|
|
1
|
+
import { DashboardDocument, DashboardTile, LocalGiven, QueryTile } from './document';
|
|
2
2
|
/**
|
|
3
3
|
* The builder's view of the dashboard's filter controls, and the pure edits it
|
|
4
4
|
* makes to them. Kept out of the component so every rule here has a test that
|
|
@@ -135,7 +135,7 @@ export interface MappingRow {
|
|
|
135
135
|
* excludes, and so is an `opaque` one: its body has no single block a binding
|
|
136
136
|
* belongs in, which the reader can see before a save is ever attempted.
|
|
137
137
|
*/
|
|
138
|
-
export declare const canBind: (tile: DashboardTile) =>
|
|
138
|
+
export declare const canBind: (tile: DashboardTile) => tile is QueryTile;
|
|
139
139
|
/** The mapping a control has NOW, one row per tile, for the dialog to open on. */
|
|
140
140
|
export declare function mappingOf(document: DashboardDocument, control: {
|
|
141
141
|
name: string;
|
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* The dashboard builder's working representation of a `dashboards/*.malloy`
|
|
3
|
-
* file.
|
|
4
|
-
*
|
|
5
|
-
* This is an editing PROJECTION, not a complete representation of the file, and
|
|
6
|
-
* the distinction is load-bearing. The builder writes changes by SPLICING the
|
|
7
|
-
* source text — patching the ranges it owns and leaving every other byte alone —
|
|
8
|
-
* so anything this type does not model survives an edit untouched. A `where:` in
|
|
9
|
-
* a source extension, an inline computed dimension, a `#(doc)` tag, a reader's
|
|
10
|
-
* comments: none of them appear below, and none of them are lost.
|
|
11
|
-
*
|
|
12
|
-
* What that buys is the reason the projection exists. A writer that regenerated
|
|
13
|
-
* the whole file would have to model everything or destroy it, which is why the
|
|
14
|
-
* earlier design could only ever have edited files it wrote itself.
|
|
15
|
-
*
|
|
16
|
-
* The document is still what decides whether a file can be opened at all: the
|
|
17
|
-
* reader refuses a file it cannot fully turn into one of these, rather than
|
|
18
|
-
* opening it half-understood. See {@link readDashboardDocument}.
|
|
19
|
-
*/
|
|
1
|
+
import { ChartState } from './chartLine';
|
|
20
2
|
/** One `import` line. The file needs both forms, and for different reasons. */
|
|
21
3
|
export type DashboardImport =
|
|
22
4
|
/** `import "../givens.malloy"` — the whole file's declarations. */
|
|
@@ -131,8 +113,10 @@ export type TileDeclaration = {
|
|
|
131
113
|
} | {
|
|
132
114
|
kind: "inherited";
|
|
133
115
|
};
|
|
134
|
-
/**
|
|
135
|
-
export interface
|
|
116
|
+
/** A tile that runs a view: a view shown on the page, plus how it is presented. */
|
|
117
|
+
export interface QueryTile {
|
|
118
|
+
/** Absent means a query tile, the API's default. */
|
|
119
|
+
kind?: "query";
|
|
136
120
|
/**
|
|
137
121
|
* The view name. For a tile declared in this file, assigned ONCE when the
|
|
138
122
|
* tile is added and never recomputed — deriving it from position would
|
|
@@ -164,10 +148,39 @@ export interface DashboardTile {
|
|
|
164
148
|
}>;
|
|
165
149
|
label?: string;
|
|
166
150
|
subtitle?: string;
|
|
151
|
+
/**
|
|
152
|
+
* The chart line on the tile's wrapper. `"default"` removes the writer's line
|
|
153
|
+
* and, on a tile read from a file with none, is what absent means; an absent
|
|
154
|
+
* `chart` handed to the writer means unchanged. `"custom"` is a line the
|
|
155
|
+
* builder does not model, which it keeps and never writes.
|
|
156
|
+
*/
|
|
157
|
+
chart?: ChartState;
|
|
158
|
+
/** The chart lines behind a `"custom"` chart, as written; read-only, so a picker can say what it will not change. */
|
|
159
|
+
chartLines?: string[];
|
|
160
|
+
/** The chart tags the tile's view carries, when the catalog knows them: the writer negates only these. Never read from a file. */
|
|
161
|
+
chartCarried?: string[];
|
|
167
162
|
colspan?: number;
|
|
168
163
|
break?: boolean;
|
|
169
164
|
borderless?: boolean;
|
|
170
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* A markdown tile: prose between the query tiles, written as a `##|(markdown) <name>` block
|
|
168
|
+
* and listed in `tiles=[…]` as `<name> { kind=text }`. Its width and row break live on that
|
|
169
|
+
* list entry, since a block has no tags.
|
|
170
|
+
*/
|
|
171
|
+
export interface TextTile {
|
|
172
|
+
kind: "text";
|
|
173
|
+
/** The block's name and the list entry's: a bare identifier, unique among the text tiles. */
|
|
174
|
+
name: string;
|
|
175
|
+
markdown: string;
|
|
176
|
+
colspan?: number;
|
|
177
|
+
break?: boolean;
|
|
178
|
+
}
|
|
179
|
+
export type DashboardTile = QueryTile | TextTile;
|
|
180
|
+
export declare const isTextTile: (tile: DashboardTile) => tile is TextTile;
|
|
181
|
+
export declare const isQueryTile: (tile: DashboardTile) => tile is QueryTile;
|
|
182
|
+
/** What a tile is called in the builder's own labels: a query tile's title, else its name. */
|
|
183
|
+
export declare const tileLabel: (tile: DashboardTile) => string;
|
|
171
184
|
/**
|
|
172
185
|
* A source extension the dashboard DECLARES, holding tiles that read it.
|
|
173
186
|
*
|
|
@@ -194,22 +207,25 @@ export interface DashboardSource {
|
|
|
194
207
|
* the model.
|
|
195
208
|
*/
|
|
196
209
|
dimensions?: DashboardDimension[];
|
|
210
|
+
/** Givens the extension's own `where:`s read, which filter every tile on it. Read-only: never written. */
|
|
211
|
+
scopedBy?: string[];
|
|
197
212
|
}
|
|
198
213
|
/** A tile's identity across a reorder: what the grid keys on, a drag names and the writer matches. */
|
|
199
|
-
export declare const tileKey: (tile:
|
|
200
|
-
source: string;
|
|
201
|
-
name: string;
|
|
202
|
-
}) => string;
|
|
214
|
+
export declare const tileKey: (tile: DashboardTile) => string;
|
|
203
215
|
/** `dimension: <name> is <expression>` in the dashboard's own extension. */
|
|
204
216
|
export interface DashboardDimension {
|
|
205
217
|
name: string;
|
|
206
218
|
expression: string;
|
|
207
219
|
}
|
|
220
|
+
/** Which surface the file is: a notebook is the same file with one column. */
|
|
221
|
+
export type DocumentKind = "dashboard" | "notebook";
|
|
208
222
|
export interface DashboardDocument {
|
|
223
|
+
/** `## artifact { kind=… }`; the reader leaves it out for a dashboard. */
|
|
224
|
+
kind?: DocumentKind;
|
|
209
225
|
title: string;
|
|
210
226
|
/** The narrative header, as markdown. Emitted as `##"` lines. */
|
|
211
227
|
description?: string;
|
|
212
|
-
/** `# dashboard { columns=N }
|
|
228
|
+
/** `# dashboard { columns=N }` as the file has it; a notebook's grid is one column whatever it says. */
|
|
213
229
|
columns?: number;
|
|
214
230
|
/** `## artifact { autorun=false }`. Absent means autorun. */
|
|
215
231
|
autorun?: boolean;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { QueryClient, QueryKey } from '@tanstack/react-query';
|
|
2
|
+
import { Workspace } from '../DocumentStorage';
|
|
3
|
+
import { ApiClients } from '../ServerProvider';
|
|
4
|
+
import { SavesTo } from '../Dashboard/telemetry';
|
|
5
|
+
export type { SavesTo };
|
|
6
|
+
/**
|
|
7
|
+
* The record when one declares itself, and otherwise the first writeable
|
|
8
|
+
* workspace. Pass every workspace, not only the writeable ones: a reader who
|
|
9
|
+
* cannot write to the record still has to be shown the record.
|
|
10
|
+
*/
|
|
11
|
+
export declare function chooseWorkspace(all: readonly Workspace[]): Workspace | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Where Save goes, and which writer takes it, or `undefined` for no Save.
|
|
14
|
+
*
|
|
15
|
+
* `authoritative` wins outright rather than breaking a tie: a host whose store
|
|
16
|
+
* is the record may well sit on a server that reports itself writable, and
|
|
17
|
+
* writing the package there would edit a deploy of the record instead of the
|
|
18
|
+
* record.
|
|
19
|
+
*/
|
|
20
|
+
export declare function saveTarget({ authoritative, mutable, versionId, canStore, readFailed, }: {
|
|
21
|
+
authoritative: boolean;
|
|
22
|
+
mutable: boolean;
|
|
23
|
+
versionId?: string;
|
|
24
|
+
/** The host keeps documents and the chosen workspace takes writes. */
|
|
25
|
+
canStore: boolean;
|
|
26
|
+
/** The host's copy could not be read. */
|
|
27
|
+
readFailed: boolean;
|
|
28
|
+
}): {
|
|
29
|
+
savesTo: SavesTo;
|
|
30
|
+
pinnedPackageSave: boolean;
|
|
31
|
+
writer: "storage" | "package" | undefined;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The `expectedHash` a package write carries: the server's own hash after this
|
|
35
|
+
* editor's last write, else the hash of the package file the editor opened on.
|
|
36
|
+
* Never the latest fetch's, which may already hold someone else's change.
|
|
37
|
+
*/
|
|
38
|
+
export declare function expectedHashFor(savedHash: string | undefined, base: string | undefined): Promise<string | undefined>;
|
|
39
|
+
/**
|
|
40
|
+
* What the toolbar says about where Save goes, in the backend's own words
|
|
41
|
+
* wherever it has any: a workspace carries a `description` precisely so the
|
|
42
|
+
* editor does not have to guess, and "this browser" is one host's answer
|
|
43
|
+
* rather than the interface's.
|
|
44
|
+
*/
|
|
45
|
+
export declare function saveCaption({ authoritative, mutable, pinnedPackageSave, workspace, readFailure, versionId, }: {
|
|
46
|
+
authoritative: boolean;
|
|
47
|
+
mutable: boolean;
|
|
48
|
+
pinnedPackageSave: boolean;
|
|
49
|
+
workspace?: Workspace;
|
|
50
|
+
readFailure?: string;
|
|
51
|
+
versionId?: string;
|
|
52
|
+
}): string;
|
|
53
|
+
/** What a storage backend said went wrong, for a reader who has to act on it. */
|
|
54
|
+
export declare function storageErrorMessage(error: unknown): string;
|
|
55
|
+
/** The server's own reason for a refused write, when it gave one. */
|
|
56
|
+
export declare function apiErrorMessage(error: unknown): string;
|
|
57
|
+
/** A query family a package write marks stale. */
|
|
58
|
+
export interface Invalidation {
|
|
59
|
+
queryKey: QueryKey;
|
|
60
|
+
/** `"none"` marks the family stale without refetching it. */
|
|
61
|
+
refetchType?: "none";
|
|
62
|
+
/** Hold the write's result until the refetch lands. */
|
|
63
|
+
wait?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Writes a package file against `expectedHash` and returns the server's hash
|
|
67
|
+
* of what it wrote. A refused write invalidates `invalidateOnError`, since it
|
|
68
|
+
* usually means the file moved, and throws the server's own reason.
|
|
69
|
+
* `afterWrite` runs once the write has landed and before the invalidations, so
|
|
70
|
+
* the caller's bookkeeping is in place when a refetch arrives.
|
|
71
|
+
*/
|
|
72
|
+
export declare function writePackageFile({ apiClients, queryClient, environmentName, packageName, modelPath, source, expectedHash, invalidateOnError, invalidate, afterWrite, }: {
|
|
73
|
+
apiClients: ApiClients;
|
|
74
|
+
queryClient: QueryClient;
|
|
75
|
+
environmentName: string;
|
|
76
|
+
packageName: string;
|
|
77
|
+
modelPath: string;
|
|
78
|
+
source: string;
|
|
79
|
+
expectedHash: string;
|
|
80
|
+
invalidateOnError: readonly QueryKey[];
|
|
81
|
+
invalidate: readonly Invalidation[];
|
|
82
|
+
afterWrite?: (contentHash: string) => Promise<void> | void;
|
|
83
|
+
}): Promise<string>;
|
|
84
|
+
/** The host workspace that took a save or its undo, named on the event; a package save was taken by none. */
|
|
85
|
+
export declare function withWorkspace<E extends {
|
|
86
|
+
type: string;
|
|
87
|
+
}>(event: E, workspace: string | undefined): E;
|
|
88
|
+
/** The environment, package and version an editor was asked for, from either prop form; a render body must not throw, so a URI `parseResourceUri` rejects reads as naming neither. */
|
|
89
|
+
export declare function resolveEditorTarget(props: {
|
|
90
|
+
resourceUri: string;
|
|
91
|
+
} | {
|
|
92
|
+
environmentName: string;
|
|
93
|
+
packageName: string;
|
|
94
|
+
}): {
|
|
95
|
+
environmentName: string;
|
|
96
|
+
packageName: string;
|
|
97
|
+
versionId: string | undefined;
|
|
98
|
+
/** False when a resource URI did not name both an environment and a package. */
|
|
99
|
+
namesBoth: boolean;
|
|
100
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DashboardDocument, DashboardImport } from './document';
|
|
2
|
+
/** How the document at `documentPath` names the model at `modelPath`. */
|
|
3
|
+
export declare function importPathOf(modelPath: string, documentPath: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* Whether the file can already see `name` from `modelPath`: it extends it,
|
|
6
|
+
* imports it by name, or imports that model whole. A whole-file import brings
|
|
7
|
+
* every source the model exports, and naming one of them again would declare
|
|
8
|
+
* it twice. A source the file sees only through another model that re-exports
|
|
9
|
+
* it is not followed: that needs the catalog to say which model declares each
|
|
10
|
+
* source, and the compile check on save catches the duplicate.
|
|
11
|
+
*/
|
|
12
|
+
export declare function reaches(document: Pick<DashboardDocument, "imports" | "sources">, name: string, modelPath: string, documentPath?: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* `imports` with `name` from `modelPath` brought in, by name — into that
|
|
15
|
+
* model's existing `{ … }` import when there is one, else as a new statement
|
|
16
|
+
* written relative to where the document sits. Unchanged when the file can
|
|
17
|
+
* already see it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function withSource(document: Pick<DashboardDocument, "imports" | "sources">, name: string, modelPath: string, documentPath?: string): DashboardImport[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
import { SystemStyleObject } from '@mui/system';
|
|
3
|
+
import { ResolvedTheme } from '../../theme/types';
|
|
4
|
+
/** Where the pencil goes: after a line of text, or after the first block of prose. */
|
|
5
|
+
export type PencilAt = "line" | "prose";
|
|
6
|
+
/**
|
|
7
|
+
* How text that is edited where it is read says so: a thin pencil straight
|
|
8
|
+
* after the text, in the text's own colour and in proportion to its size,
|
|
9
|
+
* faint at rest and clearer under the pointer. The same mark in the same place
|
|
10
|
+
* for every field — a title, a subtitle, a description — and nothing else: no
|
|
11
|
+
* wash, no outline, no gutter. The keyboard gets a focus ring, since a pencil
|
|
12
|
+
* does not say where focus is.
|
|
13
|
+
*
|
|
14
|
+
* Drawn as a pseudo-element, so it adds no node and moves no layout; for prose
|
|
15
|
+
* it follows the first paragraph or heading, which is the line the reader is
|
|
16
|
+
* looking at when they reach for it.
|
|
17
|
+
*/
|
|
18
|
+
export declare const editableSx: (theme: ResolvedTheme, at?: PencilAt) => SystemStyleObject<Theme>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Span } from './malloyTree';
|
|
2
|
+
export type { Span };
|
|
3
|
+
/** A `# <chart>` line the chart rule recognizes, whole line including its newline. */
|
|
4
|
+
export interface ChartLineSpan {
|
|
5
|
+
span: Span;
|
|
6
|
+
/** The line less its newline. */
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
/** The chart tag lines of a query cell. */
|
|
10
|
+
export interface QueryChart {
|
|
11
|
+
lines: ChartLineSpan[];
|
|
12
|
+
/** A `#` line that names a chart tag but is not one the rule recognizes, kept byte for byte. */
|
|
13
|
+
unmodelled?: string;
|
|
14
|
+
/** Where a new chart line goes: the start of the line holding the statement's code. */
|
|
15
|
+
insertAt: number;
|
|
16
|
+
}
|
|
17
|
+
export interface NotebookSourceCell {
|
|
18
|
+
kind: "markdown" | "query" | "definition";
|
|
19
|
+
/** The movable chunk: from the first line of its tag/prose/caption/comment block to the end of the statement's last line (incl. newline). */
|
|
20
|
+
span: Span;
|
|
21
|
+
/** markdown cells: the prose; query cells: the attached header prose, if any. */
|
|
22
|
+
markdown?: string;
|
|
23
|
+
/** Statement cells: the attached `(markdown)`/`(text)` notes and `"` captions, each a whole note token run. */
|
|
24
|
+
prose?: Span[];
|
|
25
|
+
/** Query cells only. */
|
|
26
|
+
chart?: QueryChart;
|
|
27
|
+
/** Stable id for React keys and history; its index in the read. */
|
|
28
|
+
id: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A notebook's layout. `header` starts at 0; the cells follow in file order
|
|
32
|
+
* without overlapping it or each other, and every byte between two spans (or
|
|
33
|
+
* after the last) is a gap the writer keeps as it found it.
|
|
34
|
+
*/
|
|
35
|
+
export interface NotebookSource {
|
|
36
|
+
text: string;
|
|
37
|
+
header: Span;
|
|
38
|
+
cells: NotebookSourceCell[];
|
|
39
|
+
}
|
|
40
|
+
export type NotebookSourceResult = {
|
|
41
|
+
ok: true;
|
|
42
|
+
source: NotebookSource;
|
|
43
|
+
} | {
|
|
44
|
+
ok: false;
|
|
45
|
+
refused: string;
|
|
46
|
+
line?: number;
|
|
47
|
+
};
|
|
48
|
+
export declare const notebookSourceRefused: (r: NotebookSourceResult) => r is Extract<NotebookSourceResult, {
|
|
49
|
+
ok: false;
|
|
50
|
+
}>;
|
|
51
|
+
/** A notebook's layout, or why it cannot be edited; a refusal's `line` is 1-based, while lines inside are 0-based. */
|
|
52
|
+
export declare function readNotebookSource(text: string): Promise<NotebookSourceResult>;
|
|
53
|
+
export type LegacyConversion = {
|
|
54
|
+
ok: true;
|
|
55
|
+
text: string;
|
|
56
|
+
tiles: number;
|
|
57
|
+
} | {
|
|
58
|
+
ok: false;
|
|
59
|
+
refused: string;
|
|
60
|
+
line?: number;
|
|
61
|
+
};
|
|
62
|
+
export declare const conversionRefused: (r: LegacyConversion) => r is Extract<LegacyConversion, {
|
|
63
|
+
ok: false;
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* Rewrite a cell-format notebook (`run:` cells and prose cells) as a layout
|
|
67
|
+
* notebook: the same file with a `tiles=[…]` list, each prose cell a
|
|
68
|
+
* `##|(markdown)` block, and each `run:` a view in a `<source>_tiles`
|
|
69
|
+
* extension. Text outside the cells is carried over as written.
|
|
70
|
+
*
|
|
71
|
+
* PURE: text in, text out. The caller keeps the original to hand back on Undo.
|
|
72
|
+
*/
|
|
73
|
+
export declare function convertLegacyNotebook(text: string): Promise<LegacyConversion>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Malloy = typeof import("@malloydata/malloy");
|
|
2
|
+
type MalloyTag = typeof import("@malloydata/malloy-tag");
|
|
3
|
+
type QueryBuilder = typeof import("@malloydata/malloy-query-builder");
|
|
4
|
+
export declare const unwrapMalloy: (ns: Malloy) => Malloy;
|
|
5
|
+
export declare const unwrapMalloyTag: (ns: MalloyTag) => MalloyTag;
|
|
6
|
+
export declare const unwrapQueryBuilder: (ns: QueryBuilder) => QueryBuilder;
|
|
7
|
+
/**
|
|
8
|
+
* Imported dynamically, never statically: `builder-entry.ts` installs the
|
|
9
|
+
* `process.env` shim the parser's dependencies read at module scope, and a
|
|
10
|
+
* static import would be evaluated before that shim runs.
|
|
11
|
+
*/
|
|
12
|
+
export declare function loadMalloy(): Promise<Malloy>;
|
|
13
|
+
export declare function loadMalloyTag(): Promise<MalloyTag>;
|
|
14
|
+
export declare function loadQueryBuilder(): Promise<QueryBuilder>;
|
|
15
|
+
export {};
|