@malloy-publisher/sdk 0.9.1 → 0.9.2
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/{Dashboard-H1kJlDFo.es.js → DashboardTile-BFcxdv7R.es.js} +15918 -17760
- package/dist/DashboardTile-sg8LjUk8.cjs.js +137 -0
- package/dist/RenderedResult-B48wAjM8.cjs.js +141 -0
- package/dist/{RenderedResult-BRgIgxWh.es.js → RenderedResult-CBLHr32C.es.js} +193 -183
- package/dist/{ServerProvider-Boxrv6Ym.es.js → ServerProvider-DCV8BUWD.es.js} +529 -521
- package/dist/ServerProvider-HRqT3w1C.cjs.js +1 -0
- package/dist/builder/index.cjs.js +146 -58
- package/dist/builder/index.es.js +9076 -6479
- package/dist/builder-entry.d.ts +4 -0
- package/dist/client/api.d.ts +77 -47
- 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 +84 -82
- package/dist/components/Dashboard/Dashboard.d.ts +8 -15
- package/dist/components/Dashboard/DashboardGrid.d.ts +23 -6
- package/dist/components/Dashboard/DashboardTile.d.ts +10 -1
- package/dist/components/Dashboard/DashboardView.d.ts +36 -0
- package/dist/components/Dashboard/TileCard.d.ts +15 -4
- package/dist/components/Dashboard/TileFilterTag.d.ts +12 -0
- package/dist/components/Dashboard/index.d.ts +3 -0
- package/dist/components/Dashboard/telemetry.d.ts +15 -3
- package/dist/components/DashboardBuilder/AddTileDialog.d.ts +8 -1
- package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +16 -5
- package/dist/components/DashboardBuilder/ChartPicker.d.ts +29 -0
- package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +48 -21
- package/dist/components/DashboardBuilder/DashboardEditor.d.ts +17 -4
- package/dist/components/DashboardBuilder/DiffDialog.d.ts +2 -10
- package/dist/components/DashboardBuilder/FilterDialog.d.ts +2 -2
- package/dist/components/DashboardBuilder/FilterStrip.d.ts +3 -1
- 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/SaveNotice.d.ts +27 -0
- package/dist/components/DashboardBuilder/SettingsPopover.d.ts +19 -7
- package/dist/components/DashboardBuilder/SourceViewPicker.d.ts +9 -0
- package/dist/components/DashboardBuilder/TextTileBody.d.ts +7 -0
- package/dist/components/DashboardBuilder/TileFrame.d.ts +14 -12
- package/dist/components/DashboardBuilder/TileMenu.d.ts +11 -3
- package/dist/components/DashboardBuilder/annotationText.d.ts +4 -0
- package/dist/components/DashboardBuilder/catalog.d.ts +4 -0
- 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/legacyNotebook.d.ts +73 -0
- package/dist/components/DashboardBuilder/loadMalloy.d.ts +15 -0
- package/dist/components/DashboardBuilder/malloyText.d.ts +45 -5
- 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 +4 -1
- package/dist/components/DashboardBuilder/readForEditor.d.ts +16 -0
- package/dist/components/DashboardBuilder/sortable.d.ts +14 -0
- package/dist/components/DashboardBuilder/spliceDocument.d.ts +13 -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/useBuilderSession.d.ts +89 -0
- package/dist/components/DashboardBuilder/useBuilderShortcuts.d.ts +9 -6
- package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +17 -55
- package/dist/components/DashboardBuilder/useDocumentEditor.d.ts +105 -0
- package/dist/components/DashboardBuilder/useExitGuard.d.ts +19 -0
- package/dist/components/DashboardBuilder/useFilterForm.d.ts +3 -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/NarrowEditGate.d.ts +8 -0
- package/dist/components/Notebook/Notebook.d.ts +1 -1
- package/dist/components/Package/NewDocumentDialog.d.ts +33 -0
- package/dist/components/Package/Package.d.ts +1 -0
- package/dist/components/Package/documentLocation.d.ts +28 -0
- package/dist/components/Package/index.d.ts +4 -0
- package/dist/components/Package/useDocumentLocation.d.ts +12 -0
- package/dist/components/PackageSection.d.ts +2 -2
- 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/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/index.d.ts +2 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useNarrowScreen.d.ts +4 -0
- package/dist/hooks/useQueryResult.d.ts +2 -0
- package/dist/hooks/useSettled.d.ts +14 -0
- package/dist/index.cjs.js +23 -24
- package/dist/index.es.js +9714 -7072
- 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-CbbBcZl8.es.js +196 -0
- package/dist/text-entry.d.ts +2 -0
- package/dist/utils/clock.d.ts +2 -0
- package/package.json +10 -1
- package/src/builder-entry.ts +35 -0
- package/src/components/Dashboard/Dashboard.tsx +27 -278
- package/src/components/Dashboard/DashboardGrid.tsx +68 -7
- package/src/components/Dashboard/DashboardTile.spec.tsx +24 -0
- package/src/components/Dashboard/DashboardTile.tsx +31 -4
- package/src/components/Dashboard/DashboardView.spec.tsx +212 -0
- package/src/components/Dashboard/DashboardView.tsx +352 -0
- package/src/components/Dashboard/RowsDialog.tsx +1 -1
- package/src/components/Dashboard/TileCard.tsx +44 -10
- 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/index.ts +3 -0
- package/src/components/Dashboard/telemetry.ts +16 -5
- package/src/components/DashboardBuilder/AddTileDialog.spec.tsx +88 -0
- package/src/components/DashboardBuilder/AddTileDialog.tsx +137 -111
- package/src/components/DashboardBuilder/BuilderToolbar.tsx +85 -27
- 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 +153 -0
- package/src/components/DashboardBuilder/DashboardBuilder.charts.spec.tsx +205 -0
- package/src/components/DashboardBuilder/DashboardBuilder.exit.spec.tsx +192 -0
- package/src/components/DashboardBuilder/DashboardBuilder.inline.spec.tsx +329 -0
- package/src/components/DashboardBuilder/DashboardBuilder.notebook.spec.tsx +363 -0
- package/src/components/DashboardBuilder/DashboardBuilder.notice.spec.tsx +194 -0
- package/src/components/DashboardBuilder/DashboardBuilder.openDraft.spec.tsx +157 -0
- package/src/components/DashboardBuilder/DashboardBuilder.sources.spec.tsx +124 -0
- package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +103 -78
- package/src/components/DashboardBuilder/DashboardBuilder.textTiles.spec.tsx +177 -0
- package/src/components/DashboardBuilder/DashboardBuilder.tsx +610 -315
- package/src/components/DashboardBuilder/DashboardEditor.authoritative.spec.tsx +58 -8
- package/src/components/DashboardBuilder/DashboardEditor.emptyStart.spec.tsx +191 -0
- package/src/components/DashboardBuilder/DashboardEditor.filterTag.spec.tsx +162 -0
- package/src/components/DashboardBuilder/DashboardEditor.notebook.spec.tsx +316 -0
- package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +56 -10
- package/src/components/DashboardBuilder/DashboardEditor.resourceUri.spec.tsx +5 -22
- package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +96 -14
- package/src/components/DashboardBuilder/DashboardEditor.tsx +482 -332
- package/src/components/DashboardBuilder/DiffDialog.spec.tsx +25 -0
- package/src/components/DashboardBuilder/DiffDialog.tsx +5 -24
- package/src/components/DashboardBuilder/DrillDialog.tsx +1 -1
- package/src/components/DashboardBuilder/FilterDialog.tsx +10 -3
- package/src/components/DashboardBuilder/FilterStrip.tsx +26 -4
- package/src/components/DashboardBuilder/InlineMarkdown.tsx +184 -0
- package/src/components/DashboardBuilder/InlineText.tsx +106 -0
- package/src/components/DashboardBuilder/NotebookEditor.tsx +44 -0
- package/src/components/DashboardBuilder/SaveNotice.tsx +113 -0
- package/src/components/DashboardBuilder/SettingsPopover.spec.tsx +87 -0
- package/src/components/DashboardBuilder/SettingsPopover.tsx +225 -67
- package/src/components/DashboardBuilder/SourceViewPicker.tsx +122 -0
- package/src/components/DashboardBuilder/TextTileBody.tsx +28 -0
- package/src/components/DashboardBuilder/TileFrame.tsx +89 -115
- package/src/components/DashboardBuilder/TileMenu.tsx +168 -90
- 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 +41 -0
- package/src/components/DashboardBuilder/catalog.aggregate.spec.ts +49 -0
- package/src/components/DashboardBuilder/catalog.spec.ts +2 -0
- package/src/components/DashboardBuilder/catalog.ts +61 -21
- 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 +257 -0
- package/src/components/DashboardBuilder/emptyStart.spec.ts +131 -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/malloyText.spec.ts +48 -0
- package/src/components/DashboardBuilder/malloyText.ts +181 -27
- package/src/components/DashboardBuilder/malloyTree.ts +155 -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 +139 -27
- package/src/components/DashboardBuilder/readDocument.ts +130 -44
- package/src/components/DashboardBuilder/readForEditor.spec.ts +80 -0
- package/src/components/DashboardBuilder/readForEditor.ts +47 -0
- package/src/components/DashboardBuilder/scannerShapes.spec.ts +14 -13
- package/src/components/DashboardBuilder/sortable.spec.ts +65 -0
- package/src/components/DashboardBuilder/sortable.tsx +2 -12
- 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 +762 -130
- 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 +197 -0
- package/src/components/DashboardBuilder/testing/fixtures.ts +16 -1
- package/src/components/DashboardBuilder/testing/inline.ts +25 -0
- package/src/components/DashboardBuilder/textTiles.spec.ts +718 -0
- package/src/components/DashboardBuilder/useBuilderSession.spec.ts +335 -0
- package/src/components/DashboardBuilder/useBuilderSession.ts +292 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.overlay.spec.tsx +65 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.spec.tsx +60 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.ts +36 -10
- package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +16 -13
- package/src/components/DashboardBuilder/useDashboardEditor.ts +54 -181
- package/src/components/DashboardBuilder/useDocumentEditor.spec.ts +565 -0
- package/src/components/DashboardBuilder/useDocumentEditor.ts +399 -0
- 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/useTileReorder.spec.tsx +28 -5
- package/src/components/DashboardBuilder/useTileReorder.ts +5 -7
- 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/Model/ModelExplorer.spec.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 +66 -27
- 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 +190 -0
- package/src/components/Package/Package.create.spec.tsx +380 -0
- package/src/components/Package/Package.notebooks.spec.tsx +18 -0
- package/src/components/Package/Package.tsx +366 -171
- package/src/components/Package/documentLocation.spec.ts +81 -0
- package/src/components/Package/documentLocation.ts +55 -0
- package/src/components/Package/index.ts +13 -0
- package/src/components/Package/useDocumentLocation.ts +59 -0
- package/src/components/PackageSection.tsx +2 -2
- package/src/components/RenderedResult/RenderedResult.tsx +18 -1
- package/src/components/RenderedResult/ResultContainer.tsx +44 -11
- package/src/components/RenderedResult/ResultPanel.tsx +4 -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/GivensPanel.spec.tsx +6 -6
- package/src/components/given/GivensPanel.tsx +3 -3
- package/src/components/index.ts +2 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useNarrowScreen.ts +21 -0
- package/src/hooks/useQueryResult.ts +16 -0
- package/src/hooks/useSettled.spec.ts +41 -0
- package/src/hooks/useSettled.ts +27 -0
- package/src/mainEntry.spec.ts +145 -0
- package/src/text-entry.ts +12 -0
- package/src/textEntry.spec.ts +118 -0
- package/src/utils/clock.spec.ts +12 -0
- package/src/utils/clock.ts +6 -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/DashboardBuilder/useTileResize.d.ts +0 -29
- package/dist/components/Package/NewDashboardDialog.d.ts +0 -18
- package/src/components/DashboardBuilder/useTileResize.spec.tsx +0 -121
- package/src/components/DashboardBuilder/useTileResize.ts +0 -110
- package/src/components/Package/NewDashboardDialog.spec.tsx +0 -129
- package/src/components/Package/NewDashboardDialog.tsx +0 -265
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { TileHeadingSlots } from '../Dashboard/TileCard';
|
|
3
|
+
import { SavesTo } from './documentSession';
|
|
4
|
+
import { BuilderEvent } from './telemetry';
|
|
3
5
|
import { BuilderGiven } from './controls';
|
|
4
6
|
import { PackageCatalog } from './catalog';
|
|
5
|
-
import { DashboardDocument,
|
|
7
|
+
import { DashboardDocument, QueryTile } from './document';
|
|
8
|
+
import { SaveHandler } from './useDocumentEditor';
|
|
6
9
|
export type { BuilderGiven } from './controls';
|
|
7
10
|
/**
|
|
8
11
|
* The dashboard builder's editing surface.
|
|
@@ -20,30 +23,33 @@ export type { BuilderGiven } from './controls';
|
|
|
20
23
|
* draws its own card AND its own heading. Nesting one inside a card of ours
|
|
21
24
|
* would show a card in a card under two titles — which is precisely not what a
|
|
22
25
|
* reader sees. So every affordance is drawn AROUND whatever the caller renders:
|
|
23
|
-
* an outline for selection, a grip and a menu in the corners
|
|
24
|
-
* edge.
|
|
26
|
+
* an outline for selection, a grip and a menu in the corners.
|
|
25
27
|
*
|
|
26
|
-
* **Everything here is on the thing it changes.**
|
|
27
|
-
*
|
|
28
|
-
* to change which row it is in.
|
|
29
|
-
*
|
|
28
|
+
* **Everything here is on the thing it changes.** Set a tile's width from its menu, and drag
|
|
29
|
+
* the tile itself to reorder — into the empty end of a row
|
|
30
|
+
* to change which row it is in. Click a title, subtitle, description or text
|
|
31
|
+
* tile to edit it where it stands. FILTERS are configured in exactly one place, the strip under the
|
|
30
32
|
* header: each chip opens the tiles-to-update window for that control,
|
|
31
33
|
* which is where a tile is bound or unbound, and "Add filter" declares a new
|
|
32
34
|
* one in this file — the convention {@link LocalGiven} describes — or binds one
|
|
33
35
|
* the model offers. Nothing about filters is on the tiles themselves: a second
|
|
34
36
|
* place to edit the same binding is a second place for it to be wrong.
|
|
35
37
|
*
|
|
36
|
-
* Tiles are added from the package's catalog and removed from their menu
|
|
37
|
-
* save that adds or removes one shows the file's diff first, because those
|
|
38
|
-
* moves relocate declarations and the comments beside them.
|
|
38
|
+
* Tiles are added from the package's catalog and removed from their menu.
|
|
39
39
|
*/
|
|
40
40
|
export interface DashboardBuilderProps {
|
|
41
41
|
/** The file being edited. */
|
|
42
42
|
source: string;
|
|
43
43
|
/** The document that file produced. */
|
|
44
44
|
document: DashboardDocument;
|
|
45
|
-
/**
|
|
46
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Persist the patched file. Left out, the builder edits without saving.
|
|
47
|
+
* Undo save calls it too, with `purpose: "undo"` and the text from before
|
|
48
|
+
* the save, so it must write through the same channel and checks.
|
|
49
|
+
*/
|
|
50
|
+
onSave?: SaveHandler<DashboardDocument>;
|
|
51
|
+
/** Whether the save notice (View change, Undo save) is showing, for a host that must not replace the document under it. */
|
|
52
|
+
onSaveNoticeChange?: (showing: boolean) => void;
|
|
47
53
|
/**
|
|
48
54
|
* The document as it stands, on every edit — including the first render.
|
|
49
55
|
*
|
|
@@ -58,8 +64,13 @@ export interface DashboardBuilderProps {
|
|
|
58
64
|
/**
|
|
59
65
|
* Renders a tile, card and heading included — this is where a real
|
|
60
66
|
* `DashboardTile` goes. Without it, tiles show what they will run.
|
|
67
|
+
*
|
|
68
|
+
* `heading` is the tile's title and subtitle as fields edited in place;
|
|
69
|
+
* absent for a tile whose title the model owns. A host that draws the
|
|
70
|
+
* heading itself passes it on (`DashboardTile`'s `heading`), or the tile
|
|
71
|
+
* cannot be retitled on the page.
|
|
61
72
|
*/
|
|
62
|
-
renderTile?: (tile:
|
|
73
|
+
renderTile?: (tile: QueryTile, heading?: TileHeadingSlots) => ReactNode;
|
|
63
74
|
/**
|
|
64
75
|
* The control row, in the slot the reader puts it — this is where a real
|
|
65
76
|
* `GivensPanel` goes.
|
|
@@ -100,8 +111,17 @@ export interface DashboardBuilderProps {
|
|
|
100
111
|
* go. Absent, a drill can only filter this dashboard.
|
|
101
112
|
*/
|
|
102
113
|
dashboards?: string[];
|
|
103
|
-
/** Saves and refusals, for the host to log; see `DashboardEvent`. */
|
|
104
|
-
onEvent?:
|
|
114
|
+
/** Saves and refusals, for the host to log; see `DashboardEvent`. A notebook-kind document reports `NotebookEvent`s instead. */
|
|
115
|
+
onEvent?: (event: BuilderEvent) => void;
|
|
116
|
+
/**
|
|
117
|
+
* The document is a conversion of a cell-format notebook: `from` is the text
|
|
118
|
+
* on disk, `to` the layout text it converts to. Save writes `to` with the
|
|
119
|
+
* edits spliced in, and Undo save puts `from` back.
|
|
120
|
+
*/
|
|
121
|
+
conversion?: {
|
|
122
|
+
from: string;
|
|
123
|
+
to: string;
|
|
124
|
+
};
|
|
105
125
|
/**
|
|
106
126
|
* Whether the document differs from what was last saved, on every change
|
|
107
127
|
* and on mount.
|
|
@@ -119,12 +139,19 @@ export interface DashboardBuilderProps {
|
|
|
119
139
|
* this browser, and into a host store that holds the record are not the
|
|
120
140
|
* same event.
|
|
121
141
|
*/
|
|
122
|
-
savesTo?:
|
|
142
|
+
savesTo?: SavesTo;
|
|
143
|
+
/** The backend's own words for where Save writes, in place of the generic line for `savesTo`. */
|
|
144
|
+
saveLabel?: string;
|
|
145
|
+
/** The file a save overwrites when `source` is a draft of it, so Undo save restores that file rather than the draft. */
|
|
146
|
+
replaces?: string;
|
|
147
|
+
/** The document's file within the package, so a kind switch tags what its folder would otherwise misread. */
|
|
148
|
+
modelPath?: string;
|
|
123
149
|
/**
|
|
124
|
-
* The host's own actions for the edit bar
|
|
125
|
-
*
|
|
126
|
-
* afterwards is the host's, so its buttons sit in the host's slot.
|
|
150
|
+
* The host's own extra actions for the edit bar, rendered beside undo, redo
|
|
151
|
+
* and save. Leaving is `onExit`, not this: the builder draws Done itself.
|
|
127
152
|
*/
|
|
128
153
|
toolbar?: ReactNode;
|
|
154
|
+
/** Leave the builder: renders "Close", which asks first when there are unsaved edits. */
|
|
155
|
+
onExit?: () => void;
|
|
129
156
|
}
|
|
130
|
-
export declare function DashboardBuilder({ source, document, onSave, onChange, onDirtyChange, renderTile, controls, givens, catalog, toolbar, dashboards, onEvent, savesTo, }: DashboardBuilderProps): import("react/jsx-runtime").JSX.Element;
|
|
157
|
+
export declare function DashboardBuilder({ source, document, onSave, onChange, onDirtyChange, onSaveNoticeChange, renderTile, controls, givens, catalog, toolbar, onExit, dashboards, onEvent, conversion, savesTo, saveLabel, replaces, modelPath, }: DashboardBuilderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuilderEvent } from './telemetry';
|
|
2
|
+
import { DocumentKind } from './document';
|
|
2
3
|
/**
|
|
3
4
|
* The builder, opened on a package dashboard, with everything a host has to
|
|
4
5
|
* supply already wired: the file's text and manifest from the server, a live
|
|
@@ -33,13 +34,25 @@ export type DashboardEditorProps = ({
|
|
|
33
34
|
*/
|
|
34
35
|
dashboardName: string;
|
|
35
36
|
}) & {
|
|
36
|
-
/** Leave the editor:
|
|
37
|
+
/** Leave the editor: its "Close", which asks first when edits are unsaved. Absent, no such button. */
|
|
37
38
|
onExit?: () => void;
|
|
38
39
|
/**
|
|
39
40
|
* What the editor does — opened, saved, refused — for the host to log or
|
|
40
|
-
* count; see `DashboardEvent`.
|
|
41
|
+
* count; see `DashboardEvent`. A notebook reports `NotebookEvent`s instead.
|
|
41
42
|
*/
|
|
42
|
-
onEvent?:
|
|
43
|
+
onEvent?: (event: BuilderEvent) => void;
|
|
44
|
+
/**
|
|
45
|
+
* What the document is to the host: its storage locator and event names.
|
|
46
|
+
* Default `dashboard`. A notebook is a dashboard with one column, and is
|
|
47
|
+
* read with the authoring flag and served through the notebook endpoint.
|
|
48
|
+
*/
|
|
49
|
+
kind?: DocumentKind;
|
|
50
|
+
/**
|
|
51
|
+
* The document's file within the package, when it is not where its kind
|
|
52
|
+
* puts a new one (`dashboards/<slug>.malloy`, `notebooks/<slug>.malloy`):
|
|
53
|
+
* the kind comes from the file's own tag, so a document may sit in either.
|
|
54
|
+
*/
|
|
55
|
+
path?: string;
|
|
43
56
|
/**
|
|
44
57
|
* Whether there are edits the record does not have, on every change and
|
|
45
58
|
* whenever the editor opens a document.
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Shown for a STRUCTURAL save — a tile added or removed — because those move
|
|
5
|
-
* declarations and the comments beside them, and the file is git-native: a
|
|
6
|
-
* diff is the idiom its authors already read. A property edit never needs
|
|
7
|
-
* this; it changes one tag on one line.
|
|
8
|
-
*/
|
|
9
|
-
export declare function DiffDialog({ open, before, after, onConfirm, onClose, }: {
|
|
1
|
+
/** What the last save changed in the file, read-only: the file is git-native, and a diff is the idiom its authors already read. */
|
|
2
|
+
export declare function DiffDialog({ open, before, after, onClose, }: {
|
|
10
3
|
open: boolean;
|
|
11
4
|
before: string;
|
|
12
5
|
after: string;
|
|
13
|
-
onConfirm: () => void;
|
|
14
6
|
onClose: () => void;
|
|
15
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CatalogField } from './catalog';
|
|
2
2
|
import { BuilderControl, MappingRow } from './controls';
|
|
3
|
-
import { DashboardDocument,
|
|
3
|
+
import { DashboardDocument, LocalGiven, QueryTile } from './document';
|
|
4
4
|
/**
|
|
5
5
|
* A filter control: what it is, and which tiles it drives.
|
|
6
6
|
*
|
|
@@ -41,7 +41,7 @@ export interface FilterDialogProps {
|
|
|
41
41
|
* source the host has no catalog for, in which case any name is accepted
|
|
42
42
|
* for it and nothing is searched.
|
|
43
43
|
*/
|
|
44
|
-
fieldsFor?: (tile:
|
|
44
|
+
fieldsFor?: (tile: QueryTile) => readonly CatalogField[] | undefined;
|
|
45
45
|
onClose: () => void;
|
|
46
46
|
/**
|
|
47
47
|
* Bind a control. `declare` is set when the control is new to this file, or
|
|
@@ -5,13 +5,15 @@ import { BuilderControl } from './controls';
|
|
|
5
5
|
* the ONE place: a chip per control opens its window, and "Add filter"
|
|
6
6
|
* declares a new one. The live control row the host renders sits under it.
|
|
7
7
|
*/
|
|
8
|
-
export declare function FilterStrip({ controls: controlList, tileCount, unknownFieldsOf, onEdit, onAdd, children, }: {
|
|
8
|
+
export declare function FilterStrip({ controls: controlList, tileCount, unknownFieldsOf, onEdit, onAdd, onRemove, children, }: {
|
|
9
9
|
controls: BuilderControl[];
|
|
10
10
|
tileCount: number;
|
|
11
11
|
/** Bindings a control has that its tiles' sources cannot take. */
|
|
12
12
|
unknownFieldsOf: (name: string, type: string | undefined) => string[];
|
|
13
13
|
onEdit: (control: BuilderControl) => void;
|
|
14
14
|
onAdd: () => void;
|
|
15
|
+
/** Take a control off the dashboard, as its window's Remove does. */
|
|
16
|
+
onRemove: (name: string) => void;
|
|
15
17
|
/** The host's live control row. */
|
|
16
18
|
children?: ReactNode;
|
|
17
19
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ProseVariant } from '../Prose';
|
|
2
|
+
/**
|
|
3
|
+
* Markdown that is edited where it is read: it draws as prose, a click on it
|
|
4
|
+
* opens a textarea, and what was typed commits once, when the field closes.
|
|
5
|
+
*
|
|
6
|
+
* Escape and Cmd or Ctrl+Enter are Done, which holds on a draft the writer
|
|
7
|
+
* would refuse and says why; leaving the field commits, so the closed prose
|
|
8
|
+
* keeps saying what Save will refuse. Links stay inert: a click on one is not
|
|
9
|
+
* a way out of the builder, and not an edit either.
|
|
10
|
+
*/
|
|
11
|
+
export declare function InlineMarkdown({ markdown, placeholder, onCommit, variant, }: {
|
|
12
|
+
markdown: string;
|
|
13
|
+
/** Shown in place of empty prose. */
|
|
14
|
+
placeholder: string;
|
|
15
|
+
/** Called once per edit, with the new text, only when it differs from `markdown`. */
|
|
16
|
+
onCommit: (next: string) => void;
|
|
17
|
+
variant?: ProseVariant;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single line of text that is edited where it is read: a click opens a field,
|
|
3
|
+
* Enter or leaving it commits, Escape puts the old text back.
|
|
4
|
+
*
|
|
5
|
+
* The display is a real button, so it is a tab stop that Enter and Space open,
|
|
6
|
+
* and the drag sensor refuses a press that starts on one: opening an editor can
|
|
7
|
+
* never be the start of a move.
|
|
8
|
+
*/
|
|
9
|
+
export declare function InlineText({ value, placeholder, ariaLabel, onCommit, faintWhenEmpty, }: {
|
|
10
|
+
value: string;
|
|
11
|
+
/** Shown in place of an empty value. */
|
|
12
|
+
placeholder: string;
|
|
13
|
+
/** Names the field while it is open. */
|
|
14
|
+
ariaLabel: string;
|
|
15
|
+
/** Called once per edit, with the new text, only when it differs from `value`. */
|
|
16
|
+
onCommit: (next: string) => void;
|
|
17
|
+
/** Draws an empty value faintly, and only while its tile is hovered or focused. */
|
|
18
|
+
faintWhenEmpty?: boolean;
|
|
19
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DashboardEditorProps } from './DashboardEditor';
|
|
2
|
+
/** The props a host passed the notebook editor before notebooks opened in the one builder. */
|
|
3
|
+
export type NotebookEditorProps = ({
|
|
4
|
+
/** `publisher://environments/{env}/packages/{pkg}`, optionally `?versionId=`. */
|
|
5
|
+
resourceUri: string;
|
|
6
|
+
/** The notebook's slug: `overview` for `notebooks/overview.malloy`. */
|
|
7
|
+
notebook: string;
|
|
8
|
+
} | {
|
|
9
|
+
environmentName: string;
|
|
10
|
+
packageName: string;
|
|
11
|
+
/** The notebook's slug: `overview` for `notebooks/overview.malloy`. */
|
|
12
|
+
notebookName: string;
|
|
13
|
+
}) & Pick<DashboardEditorProps, "onExit" | "onEvent" | "onDirtyChange" | "path">;
|
|
14
|
+
/** `DashboardEditor` opened on a notebook, under the name hosts already import. */
|
|
15
|
+
export declare function NotebookEditor(props: NotebookEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LastSave } from './useDocumentEditor';
|
|
2
|
+
export interface SaveNoticeProps {
|
|
3
|
+
/** The save the notice offers to take back; absent once that offer is withdrawn. */
|
|
4
|
+
lastSave?: LastSave & {
|
|
5
|
+
removedComments?: string[];
|
|
6
|
+
};
|
|
7
|
+
/** What the document's parts are called, singular: "tile" or "cell". */
|
|
8
|
+
unit: string;
|
|
9
|
+
/** How many parts the document had before the save and after it. */
|
|
10
|
+
moved: {
|
|
11
|
+
before: number;
|
|
12
|
+
after: number;
|
|
13
|
+
} | undefined;
|
|
14
|
+
canUndoSave: boolean;
|
|
15
|
+
/** An Undo save just landed and the offer is gone. */
|
|
16
|
+
undone: boolean;
|
|
17
|
+
/** The read-only viewer of the saved change is open. */
|
|
18
|
+
viewing: boolean;
|
|
19
|
+
onView: (open: boolean) => void;
|
|
20
|
+
onUndoSave: () => Promise<void> | void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* What a save just did, with the way back: View change shows the file's diff
|
|
24
|
+
* read-only, Undo save writes the file back as it was. Stays until an edit
|
|
25
|
+
* withdraws the offer or the next save replaces it; nothing else hides it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function SaveNotice(props: SaveNoticeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,19 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PackageCatalog } from './catalog';
|
|
2
|
+
import { DashboardDocument, DashboardImport, DocumentKind } from './document';
|
|
2
3
|
/**
|
|
3
|
-
* The page's own settings, off the edit bar:
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The page's own settings, off the edit bar: what it shows as, the grid's
|
|
5
|
+
* width, whether controls run as they change or behind an Apply button, and
|
|
6
|
+
* the sources it imports. Its title and description are edited on the page. Edits commit on close
|
|
7
|
+
* (`useDraft`).
|
|
6
8
|
*/
|
|
7
9
|
export interface PageSettings {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
/** Absent reads as a dashboard. */
|
|
11
|
+
kind?: DocumentKind;
|
|
10
12
|
columns?: number;
|
|
11
13
|
autorun?: boolean;
|
|
14
|
+
/** A `{ names }` import is edited as sources; a whole-file import is shown and left alone. */
|
|
15
|
+
imports: DashboardImport[];
|
|
12
16
|
}
|
|
13
17
|
export declare const settingsOf: (document: DashboardDocument) => PageSettings;
|
|
14
|
-
|
|
18
|
+
/** `settings` with `name` from `modelPath` imported. */
|
|
19
|
+
export declare function withSource(imports: DashboardImport[], name: string, modelPath: string): DashboardImport[];
|
|
20
|
+
/** `imports` without the source `name`; its statement goes with its last name. */
|
|
21
|
+
export declare const withoutSource: (imports: DashboardImport[], name: string) => DashboardImport[];
|
|
22
|
+
export declare function SettingsPopover({ anchor, settings, catalog, inUse, onClose, onCommit, }: {
|
|
15
23
|
anchor: HTMLElement | null;
|
|
16
24
|
settings: PageSettings;
|
|
25
|
+
/** What the package offers to import; without it the sources are shown, not edited. */
|
|
26
|
+
catalog?: PackageCatalog | undefined;
|
|
27
|
+
/** Sources a tile or extension reads, which cannot be taken off. */
|
|
28
|
+
inUse: ReadonlySet<string>;
|
|
17
29
|
onClose: () => void;
|
|
18
30
|
/** Called once, on close, only when something changed. */
|
|
19
31
|
onCommit: (next: PageSettings) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CatalogSource } from './catalog';
|
|
2
|
+
/** A source select and the list of its views, which is what both "add a tile" and "add a query" pick from. */
|
|
3
|
+
export declare function SourceViewPicker({ sources, source, view, onSource, onView, }: {
|
|
4
|
+
sources: CatalogSource[];
|
|
5
|
+
source: string;
|
|
6
|
+
view: string;
|
|
7
|
+
onSource: (name: string) => void;
|
|
8
|
+
onView: (name: string) => void;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TextTile } from './document';
|
|
2
|
+
export declare const TEXT_TILE_PLACEHOLDER = "Write markdown: # heading, **bold**, - list";
|
|
3
|
+
/** A text tile as the builder draws it: its markdown, edited in place. */
|
|
4
|
+
export declare function TextTileBody({ tile, onChange, }: {
|
|
5
|
+
tile: TextTile;
|
|
6
|
+
onChange: (markdown: string) => void;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TileHeadingSlots } from '../Dashboard/TileCard';
|
|
3
|
+
import { DashboardTile, QueryTile } from './document';
|
|
3
4
|
/**
|
|
4
5
|
* Everything the builder draws AROUND a tile: the selection outline, the grip,
|
|
5
|
-
* the menu button
|
|
6
|
+
* the menu button and, in a notebook, the insert button. The tile
|
|
6
7
|
* itself is `children` — the host's real `DashboardTile`, or a placeholder
|
|
7
8
|
* saying what the tile will run.
|
|
8
9
|
*/
|
|
9
|
-
export declare function TileFrame({ tile, index, selected,
|
|
10
|
+
export declare function TileFrame({ tile, index, selected, flash, menuOpen, onInsertAfter, onSelect, onOpenMenu, children, }: {
|
|
10
11
|
tile: DashboardTile;
|
|
11
12
|
index: number;
|
|
12
13
|
selected: boolean;
|
|
14
|
+
/** Briefly lit: the tile an undo or redo just changed. */
|
|
15
|
+
flash?: boolean;
|
|
13
16
|
/** Whether this tile's menu is open, which keeps its button showing. */
|
|
14
17
|
menuOpen: boolean;
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
columns: number;
|
|
18
|
+
/** Offers a "+" on the bottom edge that adds a tile after this one; set where tiles stack in one column. */
|
|
19
|
+
onInsertAfter?: () => void;
|
|
18
20
|
onSelect: () => void;
|
|
19
21
|
onOpenMenu: (anchor: HTMLElement) => void;
|
|
20
|
-
onResizeStart: (event: PointerEvent<HTMLDivElement>) => void;
|
|
21
|
-
onResizeMove: (event: PointerEvent<HTMLDivElement>) => void;
|
|
22
|
-
onResizeEnd: (event: PointerEvent<HTMLDivElement>) => void;
|
|
23
22
|
children: ReactNode;
|
|
24
23
|
}): import("react/jsx-runtime").JSX.Element;
|
|
25
24
|
/**
|
|
26
25
|
* No host-supplied tile: say what this one will run, so the surface is still
|
|
27
26
|
* legible without a server.
|
|
28
27
|
*/
|
|
29
|
-
export declare function TilePlaceholder({ tile }: {
|
|
30
|
-
tile:
|
|
28
|
+
export declare function TilePlaceholder({ tile, heading, note, }: {
|
|
29
|
+
tile: QueryTile;
|
|
30
|
+
heading?: TileHeadingSlots;
|
|
31
|
+
/** Why there is no preview, in place of an empty body. */
|
|
32
|
+
note?: string;
|
|
31
33
|
}): import("react/jsx-runtime").JSX.Element;
|
|
32
34
|
/** The empty end of a row, made a drop target while a drag is live. */
|
|
33
35
|
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, width presets,
|
|
6
|
+
* clickable cells and removal; 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
10
|
* strip under the header. Edits commit on close (`useDraft`).
|
|
11
|
+
*
|
|
12
|
+
* A text tile has only a width (when the grid has more than one column) and
|
|
13
|
+
* Remove: its words are written on the tile itself.
|
|
10
14
|
*/
|
|
11
15
|
export interface TileMenuProps {
|
|
12
16
|
anchor: HTMLElement | null;
|
|
@@ -16,9 +20,13 @@ 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;
|
|
23
|
+
/** Why removing is refused, shown beside a Remove that stays focusable; absent when it is allowed. */
|
|
24
|
+
removeBlocked?: string;
|
|
19
25
|
/** The grid's width, which the width presets are fractions of. */
|
|
20
26
|
columns: number;
|
|
21
27
|
/** Open the clickable-cells window for this tile's source. */
|
|
22
28
|
onDrills: () => void;
|
|
29
|
+
/** The catalog's view the tile shows, when the catalog knows it: what decides which charts are offered. */
|
|
30
|
+
view?: Pick<CatalogView, "chart" | "aggregateOnly">;
|
|
23
31
|
}
|
|
24
|
-
export declare function TileMenu({ anchor, tile, onClose, onCommit, onRemove, columns, onDrills, }: TileMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare function TileMenu({ anchor, tile, onClose, onCommit, onRemove, removeBlocked, columns, 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;
|
|
@@ -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;
|
|
@@ -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;
|