@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
|
@@ -136,6 +136,16 @@ export interface TreeImport extends Positioned {
|
|
|
136
136
|
names?: string[];
|
|
137
137
|
statement: Span;
|
|
138
138
|
}
|
|
139
|
+
/** A floating `##|(markdown) [name]` … `|##` block, which a dashboard reads as a text tile's body. */
|
|
140
|
+
export interface TreeTextBlock extends Positioned {
|
|
141
|
+
/** Absent when the opener has no name, or more than one word after the route. */
|
|
142
|
+
name?: string;
|
|
143
|
+
route: "markdown" | "text";
|
|
144
|
+
/** Text on the opener line (unless it is only the name), then the body lines; no trailing newline. */
|
|
145
|
+
body: string;
|
|
146
|
+
/** From the opener's line start through the closer's newline: the whole-line extent a writer replaces or removes. */
|
|
147
|
+
span: Span;
|
|
148
|
+
}
|
|
139
149
|
export interface ParsedMalloy {
|
|
140
150
|
text: string;
|
|
141
151
|
/** 0-based line -> offset of its first character. */
|
|
@@ -143,6 +153,8 @@ export interface ParsedMalloy {
|
|
|
143
153
|
imports: TreeImport[];
|
|
144
154
|
sources: TreeSource[];
|
|
145
155
|
givens: TreeGiven[];
|
|
156
|
+
/** The closed floating `(markdown)` / `(text)` blocks, in file order. */
|
|
157
|
+
textBlocks: TreeTextBlock[];
|
|
146
158
|
/** The comment token on `line`, if the line ends with one. */
|
|
147
159
|
trailingComment(line: number): Span | undefined;
|
|
148
160
|
/**
|
|
@@ -177,6 +189,68 @@ export type ParseResult = {
|
|
|
177
189
|
parsed: ParsedMalloy;
|
|
178
190
|
} | ParseRefusal;
|
|
179
191
|
export declare const parseRefused: (r: ParseResult) => r is ParseRefusal;
|
|
192
|
+
export interface TokenStream {
|
|
193
|
+
tokenSource?: {
|
|
194
|
+
vocabulary?: {
|
|
195
|
+
getSymbolicName(type: number): string | undefined;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
getTokens?(): Array<{
|
|
199
|
+
type: number;
|
|
200
|
+
startIndex: number;
|
|
201
|
+
stopIndex: number;
|
|
202
|
+
}>;
|
|
203
|
+
}
|
|
204
|
+
export type Ctx = Record<string, unknown> & {
|
|
205
|
+
ruleIndex?: number;
|
|
206
|
+
childCount?: number;
|
|
207
|
+
getChild(i: number): Ctx;
|
|
208
|
+
start?: {
|
|
209
|
+
startIndex: number;
|
|
210
|
+
line: number;
|
|
211
|
+
};
|
|
212
|
+
stop?: {
|
|
213
|
+
stopIndex: number;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
/** A rule context we can take a range from; terminals and empties are not. */
|
|
217
|
+
export declare const isRule: (c: Ctx | undefined) => boolean;
|
|
218
|
+
export declare class Reader {
|
|
219
|
+
readonly text: string;
|
|
220
|
+
private readonly map;
|
|
221
|
+
readonly lineStarts: number[];
|
|
222
|
+
/**
|
|
223
|
+
* Lines that are comment rather than code, filled in from the lexer before
|
|
224
|
+
* anything is read. A block comment's own text is prose: a line inside one
|
|
225
|
+
* that happens to start with `#` is not an annotation, and reading it as one
|
|
226
|
+
* makes the writer rewrite a line inside a comment.
|
|
227
|
+
*/
|
|
228
|
+
commentLines: ReadonlySet<number>;
|
|
229
|
+
/** `(markdown)` annotation lines, whose body can start with `#` without being a tag. */
|
|
230
|
+
proseLines: ReadonlySet<number>;
|
|
231
|
+
/** The `#|` blocks with a closer, as [opener line, closer line]; a comment's lines open none. */
|
|
232
|
+
blocks: [number, number][];
|
|
233
|
+
constructor(text: string);
|
|
234
|
+
/**
|
|
235
|
+
* The span a context covers, or `undefined` when it covers nothing we can
|
|
236
|
+
* trust. Empty rule contexts report inverted or whole-file ranges without
|
|
237
|
+
* throwing, so every span is checked rather than assumed.
|
|
238
|
+
*/
|
|
239
|
+
span(c: Ctx | undefined): Span | undefined;
|
|
240
|
+
/**
|
|
241
|
+
* The span of a TERMINAL node — a keyword or punctuation. A terminal has no
|
|
242
|
+
* rule range, only the token it stands for, and asking `span` for one
|
|
243
|
+
* silently yields nothing.
|
|
244
|
+
*/
|
|
245
|
+
terminal(node: unknown): Span | undefined;
|
|
246
|
+
/** A parser code-point index as a JS string offset. */
|
|
247
|
+
utf16(codePoint: number): number | undefined;
|
|
248
|
+
text_(c: Ctx | undefined): string | undefined;
|
|
249
|
+
line(offset: number): number;
|
|
250
|
+
positioned(c: Ctx | undefined): Positioned | undefined;
|
|
251
|
+
/** The whitespace a line begins with, which anything inserted matches. */
|
|
252
|
+
indentAt(offset: number): string;
|
|
253
|
+
}
|
|
180
254
|
/**
|
|
181
255
|
* Parse `text`, or refuse.
|
|
182
256
|
*
|
|
@@ -193,6 +267,14 @@ export declare function parseMalloy(text: string): Promise<ParseResult>;
|
|
|
193
267
|
export interface MalloyProblem {
|
|
194
268
|
code?: string;
|
|
195
269
|
message?: string;
|
|
270
|
+
/** 0-based. */
|
|
271
|
+
at?: {
|
|
272
|
+
range?: {
|
|
273
|
+
start?: {
|
|
274
|
+
line?: number;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
};
|
|
196
278
|
}
|
|
197
279
|
/** One parse of one file, stopped at the parse step. */
|
|
198
280
|
export interface Translation {
|
|
@@ -214,3 +296,40 @@ export interface Translation {
|
|
|
214
296
|
* resolved -- so callers see every syntax error and none of the semantic ones.
|
|
215
297
|
*/
|
|
216
298
|
export declare function translate(text: string, url: string): Promise<Translation>;
|
|
299
|
+
/**
|
|
300
|
+
* The comments, taken from the LEXER's own tokens rather than from a scan for
|
|
301
|
+
* `//`: a `//` inside a string literal is not a comment, and every scan here
|
|
302
|
+
* that had to know that got it wrong at least once.
|
|
303
|
+
*
|
|
304
|
+
* BOTH token kinds, because Malloy has two and spells a comment three ways:
|
|
305
|
+
* `//` and `--` lex as `COMMENT_TO_EOL`, `/* … *\/` as `BLOCK_COMMENT`. A
|
|
306
|
+
* filter on the first name alone left every block comment out of this index,
|
|
307
|
+
* so it was invisible to `commentIn` -- and a writer asking that before it
|
|
308
|
+
* deleted a range was told there was nothing there to lose.
|
|
309
|
+
*
|
|
310
|
+
* A comment alone on its line belongs to the block above a declaration; one
|
|
311
|
+
* that follows code is a trailing comment, and anything appended to that line
|
|
312
|
+
* has to go before it.
|
|
313
|
+
*/
|
|
314
|
+
export declare function commentIndex(r: Reader, tokenStream: TokenStream): {
|
|
315
|
+
trailing: Map<number, Span>;
|
|
316
|
+
lines: Set<number>;
|
|
317
|
+
all: Span[];
|
|
318
|
+
};
|
|
319
|
+
/** One `tiles=[…]` entry, exactly as written, with where it sits in the line. */
|
|
320
|
+
export interface TileEntry {
|
|
321
|
+
text: string;
|
|
322
|
+
span: Span;
|
|
323
|
+
}
|
|
324
|
+
export interface TileList {
|
|
325
|
+
/** Offsets of `[` and the matching `]` in the line. */
|
|
326
|
+
open: number;
|
|
327
|
+
close: number;
|
|
328
|
+
entries: TileEntry[];
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* The `tiles=[…]` list of a one-line `## artifact { … }` tag, as written: quoted run expressions
|
|
332
|
+
* and `name { kind=text … }` entries alike. Undefined when the tag has no list or it never closes.
|
|
333
|
+
* Strings and nested braces are skipped, so a title containing `tiles=[` or a `]` is not the list.
|
|
334
|
+
*/
|
|
335
|
+
export declare function readTileList(line: string): TileList | undefined;
|
|
@@ -14,4 +14,6 @@ export interface NewDashboard {
|
|
|
14
14
|
}
|
|
15
15
|
/** `Sales by region` → `sales-by-region`: the file name, and so the slug. */
|
|
16
16
|
export declare function slugFor(title: string): string;
|
|
17
|
-
|
|
17
|
+
/** Why this dashboard cannot be written as a file, or undefined when it can. */
|
|
18
|
+
export declare function newDashboardProblem({ title, modelPath, source, view, }: NewDashboard): string | undefined;
|
|
19
|
+
export declare function newDashboardSource(dashboard: NewDashboard): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MutableRefObject, Context } from 'react';
|
|
2
|
+
/** Where an inline field tells the builder it holds text that is not in the document yet. */
|
|
3
|
+
export interface OpenDraftSink {
|
|
4
|
+
setDirty: (dirty: boolean) => void;
|
|
5
|
+
/** Holds a function that commits the open draft; true when it did, false when the draft was refused. */
|
|
6
|
+
commitRef: MutableRefObject<(() => boolean) | undefined>;
|
|
7
|
+
}
|
|
8
|
+
export declare const OpenDraftContext: Context<OpenDraftSink>;
|
|
9
|
+
/** Reports an open field's draft as unsaved while `dirty`, and lets a save commit it first. */
|
|
10
|
+
export declare function useReportOpenDraft(dirty: boolean, commit: () => boolean): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Given } from '../../client';
|
|
2
2
|
import { GivenValue } from '../../hooks/givenValue';
|
|
3
|
-
import { DashboardDocument,
|
|
3
|
+
import { DashboardDocument, QueryTile } from './document';
|
|
4
4
|
/**
|
|
5
5
|
* What a reader would see if the DOCUMENT were the file: the controls, and
|
|
6
6
|
* each tile's query — so the builder's live view follows an edit the moment it
|
|
@@ -26,16 +26,34 @@ import { DashboardDocument, DashboardTile } from './document';
|
|
|
26
26
|
* suggest is gated by, for one).
|
|
27
27
|
*/
|
|
28
28
|
export declare function previewGivens(document: DashboardDocument, modelSpecs: readonly Given[]): Given[];
|
|
29
|
+
/** A tile expression as the server keys it, so `a->b` and `a -> b` match. */
|
|
30
|
+
export declare function tileExpressionKey(expression: string): string;
|
|
29
31
|
/** A tile's query as the document has it, and the givens it sends. */
|
|
30
32
|
export interface PreviewTileQuery {
|
|
31
33
|
/** A run expression, without `run:` — what `DashboardTile.tile` takes. */
|
|
32
34
|
expression: string;
|
|
33
35
|
/**
|
|
34
|
-
* The
|
|
35
|
-
*
|
|
36
|
+
* The chart line the tile's wrapper carries, to sit above the `run:`. A
|
|
37
|
+
* reference tile runs its base view, which has never seen the wrapper, so
|
|
38
|
+
* without it the tile would draw the view's own chart whatever the picker
|
|
39
|
+
* says. An inline or opaque tile runs the SAVED view, wrapper line and all,
|
|
40
|
+
* so Default there carries the all-negating line: the saved line is what
|
|
41
|
+
* Default removes. Absent when a reference tile's wrapper adds none.
|
|
42
|
+
*/
|
|
43
|
+
annotation?: string;
|
|
44
|
+
/**
|
|
45
|
+
* The givens this tile binds, its extension reads, or its served tile
|
|
46
|
+
* reads that the server can take, for narrowing the request. Undefined for a tile whose bindings live in the model, where the
|
|
36
47
|
* document cannot know them: send the whole row, as the reader does.
|
|
37
48
|
*/
|
|
38
49
|
givenNames: string[] | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Every given this tile's preview answers to, runnable or not, for saying
|
|
52
|
+
* which controls it ignores. Undefined when nothing can say: a tile the
|
|
53
|
+
* served file did not resolve (inherited, or not saved yet) whose document
|
|
54
|
+
* side reads no given either.
|
|
55
|
+
*/
|
|
56
|
+
reads: string[] | undefined;
|
|
39
57
|
}
|
|
40
58
|
/**
|
|
41
59
|
* A tile's query with the DOCUMENT's bindings, run on the dashboard's own
|
|
@@ -74,4 +92,6 @@ export interface PreviewTileQuery {
|
|
|
74
92
|
* without its bindings, which this builder deliberately does not do: it
|
|
75
93
|
* splices, and never writes a view's body out from the document.
|
|
76
94
|
*/
|
|
77
|
-
export declare function previewTileQuery(document: DashboardDocument, tile:
|
|
95
|
+
export declare function previewTileQuery(document: DashboardDocument, tile: QueryTile, runnable: ReadonlySet<string>, values?: ReadonlyMap<string, GivenValue>,
|
|
96
|
+
/** What the served file's compiled tile reads (`DashboardTile.givenNames`), when it has this tile. */
|
|
97
|
+
served?: readonly string[]): PreviewTileQuery;
|
|
@@ -29,6 +29,8 @@ export interface ReadFailure {
|
|
|
29
29
|
reason: string;
|
|
30
30
|
/** 1-based, for a message that can point at the line. */
|
|
31
31
|
line?: number;
|
|
32
|
+
/** The file is a `kind=notebook` in the run-cell format, which `convertLegacyNotebook` turns into a layout notebook. */
|
|
33
|
+
legacyNotebook?: true;
|
|
32
34
|
}
|
|
33
35
|
export type ReadResult = {
|
|
34
36
|
ok: true;
|
|
@@ -99,5 +101,8 @@ type ParseTags = (lines: string[]) => {
|
|
|
99
101
|
* Either way the `#` tags above a declaration are its control contract.
|
|
100
102
|
*/
|
|
101
103
|
export declare function localGivens(parsed: ParsedMalloy, lines: string[], parse: ParseTags): LocalGiven[] | undefined;
|
|
102
|
-
|
|
104
|
+
/** Refuses rather than throws: `Tag.text()` throws on a malformed date literal such as `@2024-13-01`, and dropping the value would lose it on the next save. */
|
|
105
|
+
export declare function readDashboardDocument(sourceText: string, modelPath?: string,
|
|
106
|
+
/** A document the host keeps as text has no folder to take a kind from, so the layout decides. */
|
|
107
|
+
textHeld?: boolean): Promise<ReadResult>;
|
|
103
108
|
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DashboardDocument } from './document';
|
|
2
|
+
/** A file opened for editing: its document, and the conversion it is the result of when the file is a cell-format notebook. */
|
|
3
|
+
export type EditorOpen = {
|
|
4
|
+
ok: true;
|
|
5
|
+
document: DashboardDocument;
|
|
6
|
+
/** `from` is the text on disk, `to` the layout text it converts to. */
|
|
7
|
+
conversion?: {
|
|
8
|
+
from: string;
|
|
9
|
+
to: string;
|
|
10
|
+
};
|
|
11
|
+
} | {
|
|
12
|
+
ok: false;
|
|
13
|
+
reason: string;
|
|
14
|
+
};
|
|
15
|
+
/** Read `text` for the builder, converting a cell-format notebook rather than refusing it. */
|
|
16
|
+
export declare function readForEditor(text: string, modelPath?: string, textHeld?: boolean): Promise<EditorOpen>;
|
|
@@ -3,7 +3,23 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
import { PluginDescriptor, Plugin } from '@dnd-kit/abstract';
|
|
4
4
|
/** The type of a gap: the empty end of a row, offered as a drop target. */
|
|
5
5
|
export declare const GAP_TYPE = "gap";
|
|
6
|
+
/**
|
|
7
|
+
* The sensors: the library's own, with one addition.
|
|
8
|
+
*
|
|
9
|
+
* `activatorElements`: the whole tile starts a pointer drag,
|
|
10
|
+
* not only the grip. A 22px corner that appears on hover is not a target a
|
|
11
|
+
* reader finds; the whole card is. The grip stays the `handle`, which is what
|
|
12
|
+
* gives it keyboard focus and the screen-reader instructions — and, by the
|
|
13
|
+
* library's own rule, a press on the handle drags at once while a press
|
|
14
|
+
* anywhere else on the card waits for a short hold or a few pixels of travel,
|
|
15
|
+
* so a click inside a tile stays a click. Those thresholds, and the check that
|
|
16
|
+
* a press on a button or a link is never a drag, are the defaults: they are
|
|
17
|
+
* what every surface built on this library feels like, and the hand-tuned
|
|
18
|
+
* versions this replaced were most of why the gesture felt unfamiliar.
|
|
19
|
+
*/
|
|
6
20
|
export declare const builderSensors: ( PluginDescriptor<any, Plugin<any, PointerSensorOptions>, typeof PointerSensor> | typeof KeyboardSensor)[];
|
|
21
|
+
/** Marks an element inside a tile whose presses must never start a move. */
|
|
22
|
+
export declare const NO_DRAG = "data-no-drag";
|
|
7
23
|
interface TileSortableHandles {
|
|
8
24
|
/** The tile's element: what is dragged, and what a drop lands on. */
|
|
9
25
|
ref: (element: Element | null) => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DashboardDocument, DashboardTile } from './document';
|
|
2
|
+
import { spliceFailed, SpliceFailure, SpliceResult } from './spliceResult';
|
|
2
3
|
/**
|
|
3
4
|
* The syntax errors Malloy's own parser reports for `text`, as a multiset of
|
|
4
5
|
* messages.
|
|
@@ -35,24 +36,15 @@ export declare function syntaxErrors(text: string): Promise<string[]>;
|
|
|
35
36
|
* ADDED or REMOVED: a new `view:` inside the extension of the source it reads
|
|
36
37
|
* (or a new extension, when the file imports that source by name), a removed
|
|
37
38
|
* one deleted with its `#` tags. Those moves are the one place the file cannot
|
|
38
|
-
* say who owns the comment beside a declaration, so the
|
|
39
|
-
*
|
|
39
|
+
* say who owns the comment beside a declaration, so the `//` comments are left
|
|
40
|
+
* where they were and the author can read the change back with View change.
|
|
40
41
|
*
|
|
41
42
|
* A given is different from a tile in exactly the way that matters there: the
|
|
42
43
|
* `#` tags above its declaration are its control contract and have no other
|
|
43
44
|
* owner, so removing the declaration can take them with it, and a `//` comment
|
|
44
45
|
* in the same block is left where it is.
|
|
45
46
|
*/
|
|
46
|
-
export
|
|
47
|
-
ok: false;
|
|
48
|
-
reason: string;
|
|
49
|
-
}
|
|
50
|
-
export type SpliceResult = {
|
|
51
|
-
ok: true;
|
|
52
|
-
source: string;
|
|
53
|
-
} | SpliceFailure;
|
|
54
|
-
/** Narrow to the failure arm; see {@link readFailed} for why a guard. */
|
|
55
|
-
export declare const spliceFailed: (result: SpliceResult) => result is SpliceFailure;
|
|
47
|
+
export { spliceFailed, type SpliceFailure, type SpliceResult };
|
|
56
48
|
/**
|
|
57
49
|
* One tile's identity TO THE FILE, ignoring presentation and position — but
|
|
58
50
|
* not its declaration: a tile redeclared from another view is a different tile
|
|
@@ -62,4 +54,14 @@ export declare const spliceFailed: (result: SpliceResult) => result is SpliceFai
|
|
|
62
54
|
* rewrite declarations?" wants THIS key.
|
|
63
55
|
*/
|
|
64
56
|
export declare const tileFileKey: (t: DashboardTile) => string;
|
|
65
|
-
|
|
57
|
+
/** Why a text tile's markdown cannot be written into a block, or undefined when it can: the writer's refusals, for an editor to show live. */
|
|
58
|
+
export declare function markdownProblem(markdown: string): string | undefined;
|
|
59
|
+
export interface SpliceOptions {
|
|
60
|
+
/** Lets `requested.kind` differ from the file's: the one edit that switches a dashboard to a notebook or back. */
|
|
61
|
+
changeKind?: boolean;
|
|
62
|
+
/** The file's path within the package; a dashboard under `notebooks/` is tagged `kind=dashboard` rather than left untagged. */
|
|
63
|
+
modelPath?: string;
|
|
64
|
+
/** Write `kind=dashboard` too, whatever the folder: for a document held as text, which the server reads by its tags and not by a folder. */
|
|
65
|
+
explicitKind?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export declare function spliceDashboardDocument(sourceText: string, requested: DashboardDocument, options?: SpliceOptions): Promise<SpliceResult>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** What a writer hands back: the patched file, or why it refused to write one. */
|
|
2
|
+
export interface SpliceFailure {
|
|
3
|
+
ok: false;
|
|
4
|
+
reason: string;
|
|
5
|
+
}
|
|
6
|
+
export type SpliceResult = {
|
|
7
|
+
ok: true;
|
|
8
|
+
source: string;
|
|
9
|
+
} | SpliceFailure;
|
|
10
|
+
/** Narrow to the failure arm; see `readFailed` in `readDocument.ts` for why a guard. */
|
|
11
|
+
export declare const spliceFailed: (result: SpliceResult) => result is SpliceFailure;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** A MOTLY parse as `parseAnnotation` returns it; only the reads this file makes. */
|
|
2
|
+
type Parsed<T> = {
|
|
3
|
+
tag: T;
|
|
4
|
+
log: Array<{
|
|
5
|
+
message: string;
|
|
6
|
+
}>;
|
|
7
|
+
};
|
|
8
|
+
type ParseAnnotation<T> = (lines: string[]) => Parsed<T>;
|
|
9
|
+
/**
|
|
10
|
+
* Quote each bare filter literal (`f'US'`) so MOTLY reads it as a string, as
|
|
11
|
+
* the server does. The rewritten line is never spliced into the file; a changed
|
|
12
|
+
* `givens { … }` block is re-emitted, quoted, from the values parsed out of it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function quoteFilterLiterals(annotation: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* `parseAnnotation` that rescues bare filter literals. Parse-first: only a line
|
|
17
|
+
* MOTLY rejects is rewritten, and only kept if the rewrite parses, so a valid
|
|
18
|
+
* tag is never altered. `errors` are the parse messages that remain.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseTagLines<T>(parseAnnotation: ParseAnnotation<T>, lines: string[]): {
|
|
21
|
+
tag: T;
|
|
22
|
+
errors: string[];
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { DashboardEvent } from '../Dashboard/telemetry';
|
|
2
|
+
import { SavesTo } from './documentSession';
|
|
3
|
+
import { NotebookCreatedEvent } from '../DocumentCreate/events';
|
|
4
|
+
/** What the notebook editor reports about itself, for the host to log; context-free like `DashboardEvent`. A one-column dashboard document reports these too. */
|
|
5
|
+
export type NotebookEvent = {
|
|
6
|
+
type: "notebook.opened";
|
|
7
|
+
/** The package file, or the host's own copy when that copy is the record. */
|
|
8
|
+
from: "package" | "record";
|
|
9
|
+
cells: number;
|
|
10
|
+
durationMs: number;
|
|
11
|
+
} | {
|
|
12
|
+
type: "notebook.open_refused";
|
|
13
|
+
reason: string;
|
|
14
|
+
} | {
|
|
15
|
+
type: "notebook.saved";
|
|
16
|
+
cells: number;
|
|
17
|
+
where: SavesTo;
|
|
18
|
+
/** The save added or removed a cell. */
|
|
19
|
+
structural: boolean;
|
|
20
|
+
/** The save rewrote a notebook in the cell format as a layout notebook. */
|
|
21
|
+
converted?: boolean;
|
|
22
|
+
/** The host workspace that took the write; never set for a package save. */
|
|
23
|
+
workspace?: string;
|
|
24
|
+
durationMs: number;
|
|
25
|
+
} | {
|
|
26
|
+
type: "notebook.save_refused";
|
|
27
|
+
reason: string;
|
|
28
|
+
} | {
|
|
29
|
+
/** Undo save wrote the file back as it was before the last save. */
|
|
30
|
+
type: "notebook.save_undone";
|
|
31
|
+
cells: number;
|
|
32
|
+
where: SavesTo;
|
|
33
|
+
/** Whether the save it took back added or removed a cell. */
|
|
34
|
+
structural: boolean;
|
|
35
|
+
workspace?: string;
|
|
36
|
+
durationMs: number;
|
|
37
|
+
} | {
|
|
38
|
+
type: "notebook.save_undo_refused";
|
|
39
|
+
reason: string;
|
|
40
|
+
} | NotebookCreatedEvent;
|
|
41
|
+
export type NotebookEventHandler = (event: NotebookEvent) => void;
|
|
42
|
+
/** Whatever the one builder reports: a notebook-kind document speaks `notebook.*`, a dashboard `dashboard.*`. */
|
|
43
|
+
export type BuilderEvent = DashboardEvent | NotebookEvent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DashboardDocument } from '../document';
|
|
1
|
+
import { DashboardDocument, QueryTile } from '../document';
|
|
2
2
|
import { SpliceResult } from '../spliceDocument';
|
|
3
3
|
/** The document a file produces, or a thrown reason: what a spec starts from. */
|
|
4
4
|
export declare function openDocument(source: string): Promise<DashboardDocument>;
|
|
@@ -8,3 +8,5 @@ export declare function splice(source: string, edit: (document: DashboardDocumen
|
|
|
8
8
|
export declare function spliced(source: string, edit: (document: DashboardDocument) => void): Promise<string>;
|
|
9
9
|
/** `splice`, for an edit the writer is expected to refuse; its reason. */
|
|
10
10
|
export declare function refused(source: string, edit: (document: DashboardDocument) => void): Promise<string>;
|
|
11
|
+
/** The query tile at `index`, for a spec that edits or reads query-only fields. */
|
|
12
|
+
export declare function queryTile(document: DashboardDocument, index: number): QueryTile;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Edit a line of text where it is shown: click it, type, and commit (Enter) or leave another way. */
|
|
2
|
+
export declare function editInline(shown: string, label: string, next: string, key?: "Enter" | "Escape", scope?: HTMLElement): void;
|
|
3
|
+
/** Close an open tile menu: Escape inside it, now that no field in it holds focus. */
|
|
4
|
+
export declare const closeMenu: () => boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drag a tile's right edge until it spans `columns` of a 12-column grid whose
|
|
3
|
+
* tracks are 100px wide and which starts, like every tile, at x = 0. The test
|
|
4
|
+
* DOM lays nothing out, so the measurements the resize reads are stubbed for
|
|
5
|
+
* the length of the gesture.
|
|
6
|
+
*/
|
|
7
|
+
export declare function dragEdge(label: string, columns: number): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { QueryTile } from './document';
|
|
2
|
+
/**
|
|
3
|
+
* The title a query tile is drawn under when it has no label of its own: the
|
|
4
|
+
* one the reader's view derives from the view's name. One definition, so a
|
|
5
|
+
* live tile, a placeholder and the menu agree.
|
|
6
|
+
*/
|
|
7
|
+
export declare const tileDisplayTitle: (tile: QueryTile) => string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { DashboardDocument } from './document';
|
|
3
|
+
import { DashboardEditor } from './useDashboardEditor';
|
|
4
|
+
import { SaveOutcome, LastSave } from './useDocumentEditor';
|
|
5
|
+
/**
|
|
6
|
+
* The builder's selection, and the flash that points at what undo and redo
|
|
7
|
+
* changed.
|
|
8
|
+
*
|
|
9
|
+
* `stepEditor` is the editor with its undo and redo marked as STEPS, so the
|
|
10
|
+
* document they produce is diffed against the one before it and the tile that
|
|
11
|
+
* changed is lit briefly and scrolled to. An ordinary edit is not a step: the
|
|
12
|
+
* author is already looking at what they changed.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useBuilderSelection({ editor, gridBox, }: {
|
|
15
|
+
editor: DashboardEditor;
|
|
16
|
+
/** The grid's box, searched for the changed tile to scroll to. */
|
|
17
|
+
gridBox: RefObject<HTMLDivElement | null>;
|
|
18
|
+
}): {
|
|
19
|
+
selected: number;
|
|
20
|
+
descriptionSelected: boolean;
|
|
21
|
+
selectTile: (index: number) => void;
|
|
22
|
+
deselectTile: () => void;
|
|
23
|
+
selectDescription: () => void;
|
|
24
|
+
clearSelection: () => void;
|
|
25
|
+
flash: string;
|
|
26
|
+
stepEditor: {
|
|
27
|
+
undo: () => void;
|
|
28
|
+
redo: () => void;
|
|
29
|
+
document: DashboardDocument;
|
|
30
|
+
saved: DashboardDocument;
|
|
31
|
+
source: string;
|
|
32
|
+
canUndo: boolean;
|
|
33
|
+
canRedo: boolean;
|
|
34
|
+
dirty: boolean;
|
|
35
|
+
edited: boolean;
|
|
36
|
+
pendingOpen: boolean;
|
|
37
|
+
error?: string;
|
|
38
|
+
update: (change: (draft: DashboardDocument) => void) => void;
|
|
39
|
+
save: () => Promise< SaveOutcome>;
|
|
40
|
+
preview: () => Promise<{
|
|
41
|
+
ok: true;
|
|
42
|
+
source: string;
|
|
43
|
+
} | {
|
|
44
|
+
ok: false;
|
|
45
|
+
reason: string;
|
|
46
|
+
}>;
|
|
47
|
+
structural: boolean;
|
|
48
|
+
clearsHistory: boolean;
|
|
49
|
+
canUndoSave: boolean;
|
|
50
|
+
lastSave?: LastSave;
|
|
51
|
+
undoSave: () => Promise< SaveOutcome>;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { BuilderToolbarProps } from './BuilderToolbar';
|
|
2
|
+
import { BuilderShortcutHandlers } from './useBuilderShortcuts';
|
|
3
|
+
import { LastSave, SaveHandler, SaveOutcome } from './useDocumentEditor';
|
|
4
|
+
/** What a builder's session reads of its document editor. */
|
|
5
|
+
export interface SessionEditor<D, L extends LastSave = LastSave> {
|
|
6
|
+
document: D;
|
|
7
|
+
/** The document as of the last save (or open). */
|
|
8
|
+
saved: D;
|
|
9
|
+
dirty: boolean;
|
|
10
|
+
/** Unsaved edits made by a person, when that differs from `dirty` (an open that is unsaved before any edit); absent means `dirty`. */
|
|
11
|
+
edited?: boolean;
|
|
12
|
+
structural: boolean;
|
|
13
|
+
/** Whether the document opened unsaved (a conversion); the save that clears it reports so. */
|
|
14
|
+
pendingOpen?: boolean;
|
|
15
|
+
canUndo: boolean;
|
|
16
|
+
canRedo: boolean;
|
|
17
|
+
undo: () => void;
|
|
18
|
+
redo: () => void;
|
|
19
|
+
save: () => Promise<SaveOutcome>;
|
|
20
|
+
canUndoSave: boolean;
|
|
21
|
+
lastSave?: L;
|
|
22
|
+
undoSave: () => Promise<SaveOutcome>;
|
|
23
|
+
}
|
|
24
|
+
/** What a builder says about a save, in its own event's words. */
|
|
25
|
+
export interface SessionReport {
|
|
26
|
+
/** How many tiles or cells the document has, as the event counts them. */
|
|
27
|
+
size: number;
|
|
28
|
+
saved: (info: SessionSaveInfo) => void;
|
|
29
|
+
refused: (reason: string) => void;
|
|
30
|
+
/** An Undo save that wrote the file back. */
|
|
31
|
+
undone: (info: SessionSaveInfo) => void;
|
|
32
|
+
undoRefused: (reason: string) => void;
|
|
33
|
+
}
|
|
34
|
+
export interface SessionSaveInfo {
|
|
35
|
+
size: number;
|
|
36
|
+
structural: boolean;
|
|
37
|
+
/** The save wrote a document that opened unsaved. */
|
|
38
|
+
fromOpen: boolean;
|
|
39
|
+
durationMs: number;
|
|
40
|
+
}
|
|
41
|
+
export interface BuilderSessionOptions<D, L extends LastSave = LastSave> {
|
|
42
|
+
editor: SessionEditor<D, L>;
|
|
43
|
+
onSave?: SaveHandler<D>;
|
|
44
|
+
onDirtyChange?: (dirty: boolean) => void;
|
|
45
|
+
/** The host's way out, opted into: draws Close, which asks first when edits are unsaved. */
|
|
46
|
+
onExit?: () => void;
|
|
47
|
+
onChange?: (document: D) => void;
|
|
48
|
+
/** Unsaved state the editor does not hold, such as an open text draft. */
|
|
49
|
+
extraDirty?: boolean;
|
|
50
|
+
report: SessionReport;
|
|
51
|
+
/** What the notice counts and calls them: "tile" or "cell". */
|
|
52
|
+
unit: {
|
|
53
|
+
name: string;
|
|
54
|
+
count: (document: D) => number;
|
|
55
|
+
};
|
|
56
|
+
/** Runs before every save entry point, handing it the save to run once the document is ready. */
|
|
57
|
+
prepare?: (run: () => Promise<void> | void) => Promise<void> | void;
|
|
58
|
+
/** The builder's own keys, less undo, redo and save, which the session owns. Memoized by the caller. */
|
|
59
|
+
shortcuts: Pick<BuilderShortcutHandlers, "escape" | "nudge">;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* What the dashboard and notebook builders share around their document editor:
|
|
63
|
+
* saving (with its event and timing), the dirty and change reports, the exit
|
|
64
|
+
* guard, the keyboard, and the props their toolbar takes.
|
|
65
|
+
*/
|
|
66
|
+
export declare function useBuilderSession<D, L extends LastSave & {
|
|
67
|
+
removedComments?: string[];
|
|
68
|
+
} = LastSave>({ editor, onSave, onDirtyChange, onExit, onChange, extraDirty, report, unit, prepare, shortcuts, }: BuilderSessionOptions<D, L>): {
|
|
69
|
+
saving: boolean;
|
|
70
|
+
save: () => Promise<void> | void;
|
|
71
|
+
exitGuard: {
|
|
72
|
+
requestExit: () => void;
|
|
73
|
+
dialog: {
|
|
74
|
+
open: boolean;
|
|
75
|
+
canSave: boolean;
|
|
76
|
+
onKeepEditing: () => void;
|
|
77
|
+
onDiscard: () => void;
|
|
78
|
+
onSaveAndExit: () => void;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
/** Write the file back as it was before the last save, and put the edits back unsaved. */
|
|
82
|
+
undoSave: () => Promise<void> | void;
|
|
83
|
+
canUndoSave: boolean;
|
|
84
|
+
lastSave: L;
|
|
85
|
+
toolbarProps: Pick<BuilderToolbarProps, "onSave" | "canUndo" | "canRedo" | "onUndo" | "onRedo" | "dirty" | "saving" | "saveButton" | "onExit">;
|
|
86
|
+
};
|
|
@@ -3,20 +3,23 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Undo and redo on the platform's usual keys, save on ⌘S / Ctrl+S (which the
|
|
5
5
|
* browser would otherwise take), Escape to drop the selection, and the arrow
|
|
6
|
-
* keys to nudge the selected tile's width a column at a time
|
|
7
|
-
* edit that is otherwise drag-only.
|
|
6
|
+
* keys to nudge the selected tile's width a column at a time.
|
|
8
7
|
*
|
|
9
|
-
* Nothing but Escape fires while a text field has focus, so typing
|
|
10
|
-
* title never undoes a layout.
|
|
8
|
+
* Nothing but Escape and save fires while a text field has focus, so typing
|
|
9
|
+
* into a title never undoes a layout. Save leaves the field first, so its
|
|
10
|
+
* blur commits the draft, and runs once that edit has rendered.
|
|
11
11
|
*/
|
|
12
12
|
export interface BuilderShortcutHandlers {
|
|
13
13
|
undo: () => void;
|
|
14
14
|
redo: () => void;
|
|
15
15
|
save?: () => void;
|
|
16
16
|
escape: () => void;
|
|
17
|
-
/** Nudge the selected tile's width by ±1 column. */
|
|
18
|
-
nudge
|
|
17
|
+
/** Nudge the selected tile's width by ±1 column. Absent, the arrow keys are left alone. */
|
|
18
|
+
nudge?: (delta: 1 | -1) => void;
|
|
19
|
+
/** A modal owns the keyboard: no shortcut fires, so none can open a second dialog over it. */
|
|
20
|
+
paused?: boolean;
|
|
19
21
|
}
|
|
22
|
+
export declare const isMac: boolean;
|
|
20
23
|
/** The modifier's glyph for a tooltip. */
|
|
21
24
|
export declare const MOD: string;
|
|
22
25
|
export declare function useBuilderShortcuts(handlers: BuilderShortcutHandlers): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PackageCatalog, CatalogField } from './catalog';
|
|
2
|
+
import { BuilderControl, BuilderGiven, MappingRow } from './controls';
|
|
3
|
+
import { DashboardDocument, LocalGiven, QueryTile } from './document';
|
|
4
|
+
import { DashboardEditor } from './useDashboardEditor';
|
|
5
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
6
|
+
/**
|
|
7
|
+
* The document's controls, the fields each tile may bind one to, and the
|
|
8
|
+
* filter window that edits them — the one place a filter is configured.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useControlBindings({ editor, opened, givens, catalog, }: {
|
|
11
|
+
editor: DashboardEditor;
|
|
12
|
+
/** The document as the host opened it, before any edit here. */
|
|
13
|
+
opened: DashboardDocument;
|
|
14
|
+
/** The givens the host resolved across the model and its imports. */
|
|
15
|
+
givens: BuilderGiven[] | undefined;
|
|
16
|
+
catalog: PackageCatalog | undefined;
|
|
17
|
+
}): {
|
|
18
|
+
filterDialog: {
|
|
19
|
+
control?: BuilderControl;
|
|
20
|
+
};
|
|
21
|
+
setFilterDialog: Dispatch<SetStateAction<{
|
|
22
|
+
control?: BuilderControl;
|
|
23
|
+
}>>;
|
|
24
|
+
controlList: BuilderControl[];
|
|
25
|
+
fieldsFor: (tile: QueryTile) => CatalogField[];
|
|
26
|
+
unknownFieldsOf: (name: string, type: string | undefined) => string[];
|
|
27
|
+
available: BuilderControl[];
|
|
28
|
+
applyFilter: (given: string, rows: MappingRow[], declare?: LocalGiven) => void;
|
|
29
|
+
dropControl: (given: string) => void;
|
|
30
|
+
};
|