@malloy-publisher/sdk 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -9
- package/dist/DocumentStorageProvider-CyOJ0hqf.es.js +24443 -0
- package/dist/DocumentStorageProvider-DGPQEd_l.cjs.js +134 -0
- package/dist/RenderedResult-BnPzJ9Jf.es.js +549 -0
- package/dist/RenderedResult-Dp22kZsQ.cjs.js +115 -0
- package/dist/{ServerProvider-DSK9rfSY.es.js → ServerProvider-BWOEKg0O.es.js} +1256 -1318
- package/dist/ServerProvider-Cc489A3f.cjs.js +1 -0
- package/dist/builder/index.cjs.js +105 -0
- package/dist/builder/index.d.ts +2 -0
- package/dist/builder/index.es.js +9482 -0
- package/dist/builder-entry.d.ts +8 -0
- package/dist/client/api.d.ts +100 -42
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/AppDialog.d.ts +30 -0
- package/dist/components/BackLink.d.ts +32 -0
- package/dist/components/Dashboard/Dashboard.d.ts +19 -14
- package/dist/components/Dashboard/DashboardBar.d.ts +21 -0
- package/dist/components/Dashboard/DashboardGrid.d.ts +67 -0
- package/dist/components/Dashboard/DashboardTile.d.ts +6 -1
- package/dist/components/Dashboard/ExploreDialog.d.ts +18 -0
- package/dist/components/Dashboard/RowsDialog.d.ts +47 -0
- package/dist/components/Dashboard/TileCard.d.ts +44 -0
- package/dist/components/Dashboard/index.d.ts +2 -0
- package/dist/components/Dashboard/promoteMeasureRow.d.ts +7 -3
- package/dist/components/Dashboard/telemetry.d.ts +48 -0
- package/dist/components/DashboardBuilder/AddTileDialog.d.ts +35 -0
- package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +31 -0
- package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +118 -0
- package/dist/components/DashboardBuilder/DashboardEditor.d.ts +30 -0
- package/dist/components/DashboardBuilder/DiffDialog.d.ts +15 -0
- package/dist/components/DashboardBuilder/DrillDialog.d.ts +15 -0
- package/dist/components/DashboardBuilder/FilterDialog.d.ts +54 -0
- package/dist/components/DashboardBuilder/FilterStrip.d.ts +17 -0
- package/dist/components/DashboardBuilder/SettingsPopover.d.ts +20 -0
- package/dist/components/DashboardBuilder/TileFrame.d.ts +42 -0
- package/dist/components/DashboardBuilder/TileMenu.d.ts +24 -0
- package/dist/components/DashboardBuilder/catalog.d.ts +62 -0
- package/dist/components/DashboardBuilder/controls.d.ts +157 -0
- package/dist/components/DashboardBuilder/diff.d.ts +35 -0
- package/dist/components/DashboardBuilder/document.d.ts +218 -0
- package/dist/components/DashboardBuilder/layout.d.ts +71 -0
- package/dist/components/DashboardBuilder/malloyText.d.ts +45 -0
- package/dist/components/DashboardBuilder/newDashboard.d.ts +17 -0
- package/dist/components/DashboardBuilder/preview.d.ts +60 -0
- package/dist/components/DashboardBuilder/readDocument.d.ts +106 -0
- package/dist/components/DashboardBuilder/sortable.d.ts +51 -0
- package/dist/components/DashboardBuilder/spliceDocument.d.ts +53 -0
- package/dist/components/DashboardBuilder/testing/fixtures.d.ts +10 -0
- package/dist/components/DashboardBuilder/useBuilderShortcuts.d.ts +22 -0
- package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +63 -0
- package/dist/components/DashboardBuilder/useDraft.d.ts +13 -0
- package/dist/components/DashboardBuilder/useFilterForm.d.ts +65 -0
- package/dist/components/DashboardBuilder/useTileReorder.d.ts +22 -0
- package/dist/components/DashboardBuilder/useTileResize.d.ts +29 -0
- package/dist/components/DocumentStorage/DocumentStorageProvider.d.ts +7 -0
- package/dist/components/DocumentStorage/index.d.ts +1 -1
- package/dist/components/FloatingIconButton.d.ts +16 -0
- package/dist/components/ItemRow.d.ts +38 -0
- package/dist/components/Materializations/MaterializationDetailDialog.d.ts +1 -2
- package/dist/components/Materializations/MaterializationRunsList.d.ts +1 -5
- package/dist/components/Materializations/Materializations.d.ts +7 -3
- package/dist/components/Materializations/ScopeButton.d.ts +18 -0
- package/dist/components/Materializations/SectionLabel.d.ts +7 -4
- package/dist/components/Materializations/TriggerLabel.d.ts +14 -0
- package/dist/components/Materializations/index.d.ts +0 -1
- package/dist/components/Package/ContentTypeIcon.d.ts +3 -5
- package/dist/components/Package/NewDashboardDialog.d.ts +18 -0
- package/dist/components/Package/index.d.ts +0 -1
- package/dist/components/PackageSection.d.ts +23 -0
- package/dist/components/Prose.d.ts +46 -0
- package/dist/components/RenderedResult/ResultPanel.d.ts +30 -0
- package/dist/components/RenderedResult/index.d.ts +1 -0
- package/dist/components/buttons.d.ts +53 -0
- package/dist/components/drill/index.d.ts +1 -1
- package/dist/components/drill/resolveDrill.d.ts +22 -0
- package/dist/components/drill/useDrill.d.ts +11 -2
- package/dist/components/index.d.ts +6 -0
- package/dist/components/styles.d.ts +49 -44
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useCrudMutation.d.ts +42 -0
- package/dist/hooks/useDocumentControls.d.ts +70 -0
- package/dist/hooks/useQueryResult.d.ts +40 -0
- package/dist/index.cjs.js +22 -273
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +16888 -44451
- package/dist/telemetry/consoleEvents.d.ts +60 -0
- package/dist/utils/malloyLiteral.d.ts +11 -0
- package/dist/utils/sha256.d.ts +2 -0
- package/package.json +24 -9
- package/src/builder-entry.ts +55 -0
- package/src/components/AppDialog.tsx +115 -0
- package/src/components/BackLink.tsx +83 -0
- package/src/components/Connections/AddConnectionDialog.tsx +50 -70
- package/src/components/Connections/DeleteConnectionDialog.tsx +23 -50
- package/src/components/Connections/EditConnectionDialog.tsx +54 -73
- package/src/components/Dashboard/Dashboard.spec.tsx +7 -10
- package/src/components/Dashboard/Dashboard.tsx +165 -175
- package/src/components/Dashboard/DashboardBar.tsx +88 -0
- package/src/components/Dashboard/DashboardGrid.tsx +124 -0
- package/src/components/Dashboard/DashboardTile.spec.tsx +30 -6
- package/src/components/Dashboard/DashboardTile.tsx +66 -123
- package/src/components/Dashboard/ExploreDialog.tsx +84 -0
- package/src/components/Dashboard/RowsDialog.spec.ts +42 -0
- package/src/components/Dashboard/RowsDialog.tsx +234 -0
- package/src/components/Dashboard/TileCard.tsx +120 -0
- package/src/components/Dashboard/index.ts +2 -0
- package/src/components/Dashboard/promoteMeasureRow.spec.ts +70 -0
- package/src/components/Dashboard/promoteMeasureRow.ts +33 -2
- package/src/components/Dashboard/telemetry.ts +51 -0
- package/src/components/Dashboard/tileGridColumn.spec.ts +1 -1
- package/src/components/DashboardBuilder/AddTileDialog.tsx +247 -0
- package/src/components/DashboardBuilder/BuilderToolbar.tsx +162 -0
- package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +852 -0
- package/src/components/DashboardBuilder/DashboardBuilder.tsx +666 -0
- package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +163 -0
- package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +188 -0
- package/src/components/DashboardBuilder/DashboardEditor.tsx +567 -0
- package/src/components/DashboardBuilder/DiffDialog.tsx +122 -0
- package/src/components/DashboardBuilder/DrillDialog.tsx +269 -0
- package/src/components/DashboardBuilder/FilterDialog.tsx +562 -0
- package/src/components/DashboardBuilder/FilterStrip.tsx +126 -0
- package/src/components/DashboardBuilder/SettingsPopover.tsx +168 -0
- package/src/components/DashboardBuilder/TileFrame.tsx +380 -0
- package/src/components/DashboardBuilder/TileMenu.tsx +188 -0
- package/src/components/DashboardBuilder/catalog.spec.ts +215 -0
- package/src/components/DashboardBuilder/catalog.ts +225 -0
- package/src/components/DashboardBuilder/controls.spec.ts +243 -0
- package/src/components/DashboardBuilder/controls.ts +398 -0
- package/src/components/DashboardBuilder/diff.spec.ts +44 -0
- package/src/components/DashboardBuilder/diff.ts +93 -0
- package/src/components/DashboardBuilder/document.ts +209 -0
- package/src/components/DashboardBuilder/keepRowStructure.spec.ts +84 -0
- package/src/components/DashboardBuilder/layout.ts +143 -0
- package/src/components/DashboardBuilder/malloyText.spec.ts +84 -0
- package/src/components/DashboardBuilder/malloyText.ts +151 -0
- package/src/components/DashboardBuilder/moveIntoGap.spec.ts +90 -0
- package/src/components/DashboardBuilder/newDashboard.spec.ts +40 -0
- package/src/components/DashboardBuilder/newDashboard.ts +48 -0
- package/src/components/DashboardBuilder/preview.spec.ts +149 -0
- package/src/components/DashboardBuilder/preview.ts +172 -0
- package/src/components/DashboardBuilder/readDocument.spec.ts +375 -0
- package/src/components/DashboardBuilder/readDocument.ts +467 -0
- package/src/components/DashboardBuilder/sortable.tsx +151 -0
- package/src/components/DashboardBuilder/spliceDocument.spec.ts +1161 -0
- package/src/components/DashboardBuilder/spliceDocument.ts +1135 -0
- package/src/components/DashboardBuilder/testing/fixtures.ts +48 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.ts +88 -0
- package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +311 -0
- package/src/components/DashboardBuilder/useDashboardEditor.ts +201 -0
- package/src/components/DashboardBuilder/useDraft.ts +43 -0
- package/src/components/DashboardBuilder/useFilterForm.spec.tsx +144 -0
- package/src/components/DashboardBuilder/useFilterForm.ts +352 -0
- package/src/components/DashboardBuilder/useTileReorder.spec.tsx +97 -0
- package/src/components/DashboardBuilder/useTileReorder.ts +115 -0
- package/src/components/DashboardBuilder/useTileResize.spec.tsx +121 -0
- package/src/components/DashboardBuilder/useTileResize.ts +110 -0
- package/src/components/DashboardBuilder/withGaps.spec.ts +96 -0
- package/src/components/DocumentStorage/DocumentStorageProvider.tsx +12 -0
- package/src/components/DocumentStorage/index.ts +1 -0
- package/src/components/Environment/About.tsx +16 -62
- package/src/components/Environment/AddPackageDialog.tsx +85 -154
- package/src/components/Environment/Connections.tsx +125 -205
- package/src/components/Environment/DeletePackageDialog.tsx +32 -77
- package/src/components/Environment/EditPackageDialog.tsx +46 -58
- package/src/components/Environment/Environment.tsx +34 -36
- package/src/components/Environment/Packages.tsx +63 -128
- package/src/components/FloatingIconButton.tsx +41 -0
- package/src/components/Home/AddEnvironmentDialog.tsx +47 -70
- package/src/components/Home/DeleteEnvironmentDialog.tsx +32 -77
- package/src/components/Home/EditEnvironmentDialog.tsx +47 -61
- package/src/components/Home/Home.tsx +101 -214
- package/src/components/ItemRow.tsx +165 -0
- package/src/components/Materializations/CreateMaterializationDialog.tsx +34 -51
- package/src/components/Materializations/DeleteMaterializationDialog.tsx +31 -53
- package/src/components/Materializations/MaterializationDetailDialog.tsx +60 -69
- package/src/components/Materializations/MaterializationRunsList.tsx +29 -42
- package/src/components/Materializations/Materializations.tsx +137 -140
- package/src/components/Materializations/ScopeButton.tsx +85 -0
- package/src/components/Materializations/SectionLabel.tsx +7 -4
- package/src/components/Materializations/SetScheduleDialog.tsx +48 -89
- package/src/components/Materializations/TriggerLabel.tsx +36 -0
- package/src/components/Materializations/cron.spec.ts +113 -0
- package/src/components/Materializations/index.ts +0 -1
- package/src/components/Materializations/utils.spec.ts +182 -0
- package/src/components/Model/Model.tsx +6 -23
- package/src/components/Model/ModelCell.tsx +33 -72
- package/src/components/Notebook/Notebook.tsx +25 -88
- package/src/components/Notebook/NotebookCell.tsx +35 -183
- package/src/components/Package/ContentTypeIcon.spec.ts +22 -37
- package/src/components/Package/ContentTypeIcon.tsx +10 -12
- package/src/components/Package/NewDashboardDialog.spec.tsx +129 -0
- package/src/components/Package/NewDashboardDialog.tsx +265 -0
- package/src/components/Package/Package.tsx +179 -238
- package/src/components/Package/index.ts +0 -1
- package/src/components/PackageSection.tsx +85 -0
- package/src/components/Prose.spec.tsx +85 -0
- package/src/components/Prose.tsx +179 -0
- package/src/components/QueryResult/QueryResult.tsx +15 -43
- package/src/components/RenderedResult/RenderedResult.lifecycle.spec.tsx +198 -0
- package/src/components/RenderedResult/RenderedResult.tsx +22 -8
- package/src/components/RenderedResult/ResultContainer.tsx +4 -12
- package/src/components/RenderedResult/ResultPanel.spec.tsx +49 -0
- package/src/components/RenderedResult/ResultPanel.tsx +73 -0
- package/src/components/RenderedResult/index.ts +1 -0
- package/src/components/ResultsDialog.tsx +8 -32
- package/src/components/buttons.tsx +114 -0
- package/src/components/designSystem.spec.tsx +316 -0
- package/src/components/drill/index.ts +1 -0
- package/src/components/drill/resolveDrill.ts +22 -1
- package/src/components/drill/useDrill.spec.tsx +94 -0
- package/src/components/drill/useDrill.tsx +52 -12
- package/src/components/given/GivensPanel.tsx +1 -1
- package/src/components/given/paramCodec.spec.ts +1 -1
- package/src/components/index.ts +16 -0
- package/src/components/styles.ts +49 -122
- package/src/hooks/index.ts +13 -0
- package/src/hooks/useCrudMutation.spec.tsx +119 -0
- package/src/hooks/useCrudMutation.tsx +85 -0
- package/src/hooks/useDocumentControls.ts +170 -0
- package/src/hooks/useQueryResult.ts +82 -0
- package/src/index.ts +9 -0
- package/src/telemetry/consoleEvents.spec.ts +130 -0
- package/src/telemetry/consoleEvents.ts +124 -0
- package/src/theme/defaults.ts +34 -23
- package/src/theme/resolveTheme.spec.ts +9 -4
- package/src/theme/resolveTheme.ts +12 -8
- package/src/utils/malloyLiteral.spec.ts +43 -0
- package/src/utils/malloyLiteral.ts +76 -0
- package/src/utils/sha256.ts +13 -0
- package/test/README.md +1 -1
- package/test/serverProvider.tsx +5 -2
- package/vite.config.ts +5 -0
- package/dist/ServerProvider-CGnLjzag.cjs.js +0 -1
- package/dist/components/Materializations/CreateEnvMaterializationDialog.d.ts +0 -14
- package/dist/components/Materializations/EnvironmentMaterializations.d.ts +0 -7
- package/dist/components/Materializations/ScheduleCard.d.ts +0 -20
- package/dist/components/Materializations/TriggerChip.d.ts +0 -10
- package/dist/components/Package/Models.d.ts +0 -6
- package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +0 -179
- package/src/components/Materializations/EnvironmentMaterializations.tsx +0 -267
- package/src/components/Materializations/ScheduleCard.tsx +0 -231
- package/src/components/Materializations/TriggerChip.tsx +0 -44
- package/src/components/Package/Models.tsx +0 -71
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the Console reports about the things it CHANGES.
|
|
3
|
+
*
|
|
4
|
+
* The dashboard surfaces already report themselves through `DashboardEvent`,
|
|
5
|
+
* which the host wires per surface because each one is mounted with a
|
|
6
|
+
* dashboard's name. The Console's writes are not like that: create, edit and
|
|
7
|
+
* delete for environments, packages, connections and materializations happen
|
|
8
|
+
* inside dialogs the host never mounts directly, and there is no seam to pass
|
|
9
|
+
* a handler down through. So the sink is set once, by the host, at boot.
|
|
10
|
+
*
|
|
11
|
+
* Until now those writes reported to a six-second snackbar and nothing else.
|
|
12
|
+
* There was no record that a package had been deleted, or that a delete had
|
|
13
|
+
* failed — the operations whose outcome someone is most likely to be asked
|
|
14
|
+
* about afterwards.
|
|
15
|
+
*/
|
|
16
|
+
/** The thing being written. */
|
|
17
|
+
export type ConsoleResource = "environment" | "package" | "connection" | "materialization" | "schedule" | "scope";
|
|
18
|
+
export type ConsoleEvent = {
|
|
19
|
+
type: "console.mutation";
|
|
20
|
+
resource: ConsoleResource;
|
|
21
|
+
/** What was done to it. */
|
|
22
|
+
action: "create" | "update" | "delete";
|
|
23
|
+
ok: boolean;
|
|
24
|
+
durationMs: number;
|
|
25
|
+
/** Present when `ok` is false: the message the operator was shown. */
|
|
26
|
+
reason?: string;
|
|
27
|
+
};
|
|
28
|
+
export type ConsoleEventHandler = (event: ConsoleEvent) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Install the host's sink. Called once at boot; called again, it replaces.
|
|
31
|
+
* Passing `undefined` removes it, which is what a test wants between cases.
|
|
32
|
+
*/
|
|
33
|
+
export declare function setConsoleEventHandler(next: ConsoleEventHandler | undefined): void;
|
|
34
|
+
/**
|
|
35
|
+
* Report one event, if anyone is listening.
|
|
36
|
+
*
|
|
37
|
+
* Never throws, and never lets a sink's own failure reach the caller: this is
|
|
38
|
+
* called from the success and error paths of a write, and a telemetry bug that
|
|
39
|
+
* turned a successful delete into a visible error would be worse than the
|
|
40
|
+
* missing line it is reporting.
|
|
41
|
+
*/
|
|
42
|
+
export declare function reportConsoleEvent(event: ConsoleEvent): void;
|
|
43
|
+
/**
|
|
44
|
+
* Wrap a mutation's function so it reports itself.
|
|
45
|
+
*
|
|
46
|
+
* The write that reports is the `mutationFn`, not the hook around it, because
|
|
47
|
+
* the Console has two shapes of write and only one of them fits a shared hook.
|
|
48
|
+
* The CRUD dialogs each own a mutation, a snackbar and a dialog to close, and
|
|
49
|
+
* {@link useCrudMutation} holds all three. Connections and Materializations do
|
|
50
|
+
* not: they `mutateAsync` from a caller that awaits the promise, and share one
|
|
51
|
+
* snackbar across several mutations at the component level. Forcing those onto
|
|
52
|
+
* the dialog hook would mean giving them a snackbar each and a dialog to close
|
|
53
|
+
* that they do not have.
|
|
54
|
+
*
|
|
55
|
+
* Wrapping the function instead fits both, and reports the same event either
|
|
56
|
+
* way: it times what the caller actually waits on, it sees the rejection
|
|
57
|
+
* before any handler has turned it into a message, and it re-throws unchanged
|
|
58
|
+
* so nothing downstream can tell it is there.
|
|
59
|
+
*/
|
|
60
|
+
export declare function reporting<F extends (variables: never) => Promise<unknown>>(resource: ConsoleResource, action: ConsoleEvent["action"], mutationFn: F): F;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A value as a Malloy literal: `'text'`, `42`, `true`, `@2024-01-31`,
|
|
3
|
+
* `@2024-01-31 09:30:00`, or `f'…'` for a `filter<…>` type.
|
|
4
|
+
*
|
|
5
|
+
* With `type` — a given's declared type — the value is spelled the way that
|
|
6
|
+
* type reads it, so `"42"` for a `number` given is `42` and `true` for a
|
|
7
|
+
* `boolean` is `true`. Without it the JavaScript type decides, which is what a
|
|
8
|
+
* clicked cell's value needs. Undefined when there is nothing to write: no
|
|
9
|
+
* value, or one the type cannot spell.
|
|
10
|
+
*/
|
|
11
|
+
export declare function malloyLiteral(value: unknown, type?: string): string | undefined;
|
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloy-publisher/sdk",
|
|
3
3
|
"description": "Malloy Publisher SDK",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
7
7
|
"module": "dist/index.es.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"typesVersions": {
|
|
10
10
|
"*": {
|
|
11
|
+
"builder": [
|
|
12
|
+
"dist/builder-entry.d.ts"
|
|
13
|
+
],
|
|
11
14
|
"client": [
|
|
12
15
|
"dist/client-entry.d.ts"
|
|
13
16
|
],
|
|
@@ -29,6 +32,12 @@
|
|
|
29
32
|
"require": "./dist/client/index.cjs.js",
|
|
30
33
|
"default": "./dist/client/index.es.js"
|
|
31
34
|
},
|
|
35
|
+
"./builder": {
|
|
36
|
+
"types": "./dist/builder-entry.d.ts",
|
|
37
|
+
"import": "./dist/builder/index.es.js",
|
|
38
|
+
"require": "./dist/builder/index.cjs.js",
|
|
39
|
+
"default": "./dist/builder/index.es.js"
|
|
40
|
+
},
|
|
32
41
|
"./client/*": {
|
|
33
42
|
"types": "./dist/client/*.d.ts",
|
|
34
43
|
"import": "./dist/client/*.js",
|
|
@@ -63,10 +72,7 @@
|
|
|
63
72
|
"generate-api-types": "bunx openapi-generator-cli generate -i ../../api-doc.yaml -g typescript-axios -o src/client/"
|
|
64
73
|
},
|
|
65
74
|
"peerDependencies": {
|
|
66
|
-
"
|
|
67
|
-
"react-dom": ">=19.1.0",
|
|
68
|
-
"react-router-dom": ">=7.6.2",
|
|
69
|
-
"@tanstack/react-query": ">=5.59.16",
|
|
75
|
+
"@malloydata/malloy": "^0.0.432",
|
|
70
76
|
"@malloydata/malloy-explorer": "0.0.338-dev260215172810",
|
|
71
77
|
"@malloydata/malloy-filter": "^0.0.432",
|
|
72
78
|
"@malloydata/malloy-interfaces": "^0.0.432",
|
|
@@ -74,23 +80,32 @@
|
|
|
74
80
|
"@malloydata/malloy-tag": "^0.0.432",
|
|
75
81
|
"@malloydata/render": "^0.0.432",
|
|
76
82
|
"@mui/icons-material": ">=7.1.1",
|
|
77
|
-
"@mui/x-date-pickers": ">=7.1.1",
|
|
78
83
|
"@mui/material": ">=7.1.1",
|
|
79
84
|
"@mui/system": ">=7.1.1",
|
|
85
|
+
"@mui/x-date-pickers": ">=7.1.1",
|
|
80
86
|
"@mui/x-tree-view": ">=7.16.0",
|
|
81
|
-
"
|
|
87
|
+
"@tanstack/react-query": ">=5.59.16",
|
|
88
|
+
"axios": ">=1.7.7",
|
|
89
|
+
"react": ">=19.1.0",
|
|
90
|
+
"react-dom": ">=19.1.0",
|
|
91
|
+
"react-router-dom": ">=7.6.2"
|
|
82
92
|
},
|
|
83
93
|
"dependencies": {
|
|
94
|
+
"@dnd-kit/collision": "^0.5.0",
|
|
95
|
+
"@dnd-kit/dom": "^0.5.0",
|
|
96
|
+
"@dnd-kit/helpers": "^0.5.0",
|
|
97
|
+
"@dnd-kit/react": "^0.5.0",
|
|
84
98
|
"@emotion/react": "^11.14.0",
|
|
85
99
|
"@emotion/styled": "^11.14.0",
|
|
86
100
|
"@react-spring/web": "^10.0.1",
|
|
87
101
|
"cron-parser": "^5.6.2",
|
|
88
102
|
"cronstrue": "^2.50.0",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
103
|
+
"dayjs": "^1.11.13",
|
|
104
|
+
"markdown-to-jsx": "^7.7.6"
|
|
91
105
|
},
|
|
92
106
|
"devDependencies": {
|
|
93
107
|
"@happy-dom/global-registrator": "^20.11.1",
|
|
108
|
+
"@malloydata/malloy": "^0.0.432",
|
|
94
109
|
"@malloydata/malloy-explorer": "0.0.338-dev260215172810",
|
|
95
110
|
"@malloydata/malloy-filter": "^0.0.432",
|
|
96
111
|
"@malloydata/malloy-query-builder": "^0.0.432",
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
// The dashboard builder's entry point, separate from the SDK's main entry on
|
|
5
|
+
// purpose: the builder reads Malloy files with the Malloy parser, and that
|
|
6
|
+
// parser is 440 KB gzipped. Most Console users never open the builder, so this
|
|
7
|
+
// module is what a host loads LAZILY (`React.lazy(() => import(
|
|
8
|
+
// "@malloy-publisher/sdk/builder"))`), and nothing reachable from the main
|
|
9
|
+
// entry imports it. One static import of the parser anywhere on the main path
|
|
10
|
+
// would hoist all of it into every page load.
|
|
11
|
+
//
|
|
12
|
+
// The parser's dependencies (antlr4ts -> assert -> util) read `process.env` at
|
|
13
|
+
// module scope, which a browser does not define. A bundler's `define` does not
|
|
14
|
+
// reach pre-bundled dependencies, so the shim has to exist at runtime, before
|
|
15
|
+
// the parser's chunk is evaluated — and the reader's `await import` runs after
|
|
16
|
+
// this module has, which is what makes this the right place for it.
|
|
17
|
+
declare const globalThis: { process?: { env?: Record<string, string> } };
|
|
18
|
+
if (typeof globalThis.process === "undefined") {
|
|
19
|
+
globalThis.process = { env: {} };
|
|
20
|
+
} else if (globalThis.process.env === undefined) {
|
|
21
|
+
globalThis.process.env = {};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { DashboardBuilder } from "./components/DashboardBuilder/DashboardBuilder";
|
|
25
|
+
export type {
|
|
26
|
+
BuilderGiven,
|
|
27
|
+
DashboardBuilderProps,
|
|
28
|
+
} from "./components/DashboardBuilder/DashboardBuilder";
|
|
29
|
+
export {
|
|
30
|
+
DashboardEditor,
|
|
31
|
+
type DashboardEditorProps,
|
|
32
|
+
} from "./components/DashboardBuilder/DashboardEditor";
|
|
33
|
+
export type {
|
|
34
|
+
DashboardDocument,
|
|
35
|
+
DashboardTile,
|
|
36
|
+
LocalGiven,
|
|
37
|
+
} from "./components/DashboardBuilder/document";
|
|
38
|
+
export {
|
|
39
|
+
readDashboardDocument,
|
|
40
|
+
readFailed,
|
|
41
|
+
type ReadResult,
|
|
42
|
+
} from "./components/DashboardBuilder/readDocument";
|
|
43
|
+
export {
|
|
44
|
+
spliceDashboardDocument,
|
|
45
|
+
spliceFailed,
|
|
46
|
+
type SpliceResult,
|
|
47
|
+
} from "./components/DashboardBuilder/spliceDocument";
|
|
48
|
+
export {
|
|
49
|
+
buildCatalog,
|
|
50
|
+
type PackageCatalog,
|
|
51
|
+
} from "./components/DashboardBuilder/catalog";
|
|
52
|
+
export type {
|
|
53
|
+
DashboardEvent,
|
|
54
|
+
DashboardEventHandler,
|
|
55
|
+
} from "./components/Dashboard/telemetry";
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
5
|
+
import {
|
|
6
|
+
Dialog,
|
|
7
|
+
DialogActions,
|
|
8
|
+
DialogContent,
|
|
9
|
+
DialogTitle,
|
|
10
|
+
IconButton,
|
|
11
|
+
Stack,
|
|
12
|
+
Typography,
|
|
13
|
+
} from "@mui/material";
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import { useId } from "react";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Every dialog in the Console, in one shape.
|
|
19
|
+
*
|
|
20
|
+
* A dialog is a page that arrived in a box: it should be set like one. The
|
|
21
|
+
* title is the page's heading at the same size, weight and tracking; a line
|
|
22
|
+
* under it says what the dialog is for, where a page's description would be;
|
|
23
|
+
* the body is one column with one gap; and the actions sit at the bottom right
|
|
24
|
+
* with the same padding every time — a text Cancel and a filled confirm, the
|
|
25
|
+
* two roles `buttons.tsx` names.
|
|
26
|
+
*
|
|
27
|
+
* Three dialogs stay off it deliberately, and each needs something this does
|
|
28
|
+
* not have: `ModelExplorerDialog` is `fullScreen`, and `RowsDialog` and
|
|
29
|
+
* `MaterializationDetailDialog` title themselves with a node rather than a
|
|
30
|
+
* string. Widening this for three callers would cost more than it saves —
|
|
31
|
+
* but a fourth exception is a reason to widen it, not to hand-roll a fourth.
|
|
32
|
+
*/
|
|
33
|
+
export function AppDialog({
|
|
34
|
+
open,
|
|
35
|
+
onClose,
|
|
36
|
+
title,
|
|
37
|
+
description,
|
|
38
|
+
maxWidth = "sm",
|
|
39
|
+
showClose = false,
|
|
40
|
+
actions,
|
|
41
|
+
children,
|
|
42
|
+
}: {
|
|
43
|
+
open: boolean;
|
|
44
|
+
onClose: () => void;
|
|
45
|
+
title: string;
|
|
46
|
+
/** What the dialog is for, in a line. The page's description, in a box. */
|
|
47
|
+
description?: React.ReactNode;
|
|
48
|
+
maxWidth?: "xs" | "sm" | "md" | "lg" | false;
|
|
49
|
+
/** An X in the title, for a dialog whose actions do not include a way out. */
|
|
50
|
+
showClose?: boolean;
|
|
51
|
+
/** The buttons, in order. Cancel first, the thing it does last. */
|
|
52
|
+
actions?: React.ReactNode;
|
|
53
|
+
children: React.ReactNode;
|
|
54
|
+
}) {
|
|
55
|
+
const titleId = useId();
|
|
56
|
+
return (
|
|
57
|
+
<Dialog
|
|
58
|
+
open={open}
|
|
59
|
+
onClose={onClose}
|
|
60
|
+
maxWidth={maxWidth}
|
|
61
|
+
fullWidth
|
|
62
|
+
aria-labelledby={titleId}
|
|
63
|
+
>
|
|
64
|
+
<DialogTitle
|
|
65
|
+
id={titleId}
|
|
66
|
+
sx={{
|
|
67
|
+
px: 3,
|
|
68
|
+
pt: 3,
|
|
69
|
+
pb: description ? 0.5 : 1,
|
|
70
|
+
display: "flex",
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
justifyContent: "space-between",
|
|
73
|
+
gap: 1,
|
|
74
|
+
// The page heading's type, so a dialog reads as part of the same
|
|
75
|
+
// application rather than as a system alert.
|
|
76
|
+
fontSize: "1.25rem",
|
|
77
|
+
fontWeight: 600,
|
|
78
|
+
letterSpacing: "-0.025em",
|
|
79
|
+
lineHeight: 1.2,
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
{title}
|
|
83
|
+
{showClose && (
|
|
84
|
+
<IconButton
|
|
85
|
+
aria-label="Close"
|
|
86
|
+
onClick={onClose}
|
|
87
|
+
size="small"
|
|
88
|
+
sx={{ color: "text.secondary", mr: -1 }}
|
|
89
|
+
>
|
|
90
|
+
<CloseIcon fontSize="small" />
|
|
91
|
+
</IconButton>
|
|
92
|
+
)}
|
|
93
|
+
</DialogTitle>
|
|
94
|
+
<DialogContent sx={{ px: 3, pb: 1, pt: 1 }}>
|
|
95
|
+
{description && (
|
|
96
|
+
<Typography
|
|
97
|
+
variant="body2"
|
|
98
|
+
color="text.secondary"
|
|
99
|
+
sx={{ mb: 2 }}
|
|
100
|
+
>
|
|
101
|
+
{description}
|
|
102
|
+
</Typography>
|
|
103
|
+
)}
|
|
104
|
+
{/* One column, one gap: a dialog's fields are a list, and the list
|
|
105
|
+
should not be spaced by whatever margin each field brought. */}
|
|
106
|
+
<Stack sx={{ gap: 2, pt: description ? 0 : 1 }}>{children}</Stack>
|
|
107
|
+
</DialogContent>
|
|
108
|
+
{actions && (
|
|
109
|
+
<DialogActions sx={{ px: 3, pb: 3, pt: 2, gap: 1 }}>
|
|
110
|
+
{actions}
|
|
111
|
+
</DialogActions>
|
|
112
|
+
)}
|
|
113
|
+
</Dialog>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
|
5
|
+
import { Link } from "@mui/material";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The way up, at the top of a page: an arrow and the name of the thing you came
|
|
10
|
+
* from.
|
|
11
|
+
*
|
|
12
|
+
* Every page that has a parent shows one, in this one shape. The breadcrumb in
|
|
13
|
+
* the app's header bar is a different affordance and does not replace it: it is
|
|
14
|
+
* chrome the eye skips, it cannot say what the parent IS (it renders a model
|
|
15
|
+
* path as one opaque chip), and it is absent on the pages the app shell does
|
|
16
|
+
* not parameterise.
|
|
17
|
+
*
|
|
18
|
+
* The click is the host's, so a Console navigates its router and an embedder
|
|
19
|
+
* does whatever it does. Give it an `href` as well wherever the parent has a
|
|
20
|
+
* URL: that is what makes it a link rather than a widget that looks like one —
|
|
21
|
+
* focusable from the keyboard, announced as a link, and shown in the status bar
|
|
22
|
+
* on hover. Without an `href` it still has to be reachable, so it renders as a
|
|
23
|
+
* button rather than as an anchor with nothing to point at, which is focusable
|
|
24
|
+
* by neither keyboard nor assistive technology.
|
|
25
|
+
*
|
|
26
|
+
* A PLAIN left click is the host's and the default is suppressed, or the page
|
|
27
|
+
* would navigate twice — once through the host's router and once as a document
|
|
28
|
+
* load, which is the slower of the two and undoes the first. A middle-click or
|
|
29
|
+
* a modified click is deliberately left to the browser: that is what opens the
|
|
30
|
+
* parent in a new tab, and it is the reason for the `href` in the first place.
|
|
31
|
+
*/
|
|
32
|
+
export function BackLink({
|
|
33
|
+
label,
|
|
34
|
+
href,
|
|
35
|
+
onClick,
|
|
36
|
+
}: {
|
|
37
|
+
/** The parent, named: "Back to {label}". */
|
|
38
|
+
label: string;
|
|
39
|
+
/** The parent's URL, when it has one. */
|
|
40
|
+
href?: string;
|
|
41
|
+
onClick: (event: React.MouseEvent) => void;
|
|
42
|
+
}) {
|
|
43
|
+
const handleClick = (event: React.MouseEvent) => {
|
|
44
|
+
const modified =
|
|
45
|
+
event.metaKey ||
|
|
46
|
+
event.ctrlKey ||
|
|
47
|
+
event.shiftKey ||
|
|
48
|
+
event.altKey ||
|
|
49
|
+
event.button !== 0;
|
|
50
|
+
if (href !== undefined && modified) return;
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
onClick(event);
|
|
53
|
+
};
|
|
54
|
+
return (
|
|
55
|
+
<Link
|
|
56
|
+
{...(href === undefined
|
|
57
|
+
? { component: "button" as const, type: "button" as const }
|
|
58
|
+
: { href })}
|
|
59
|
+
onClick={handleClick}
|
|
60
|
+
underline="none"
|
|
61
|
+
aria-label={`Back to ${label}`}
|
|
62
|
+
sx={{
|
|
63
|
+
display: "inline-flex",
|
|
64
|
+
alignItems: "center",
|
|
65
|
+
gap: 0.5,
|
|
66
|
+
cursor: "pointer",
|
|
67
|
+
color: "text.secondary",
|
|
68
|
+
fontSize: "0.875rem",
|
|
69
|
+
mb: 2,
|
|
70
|
+
// A `component="button"` link brings the platform's button chrome
|
|
71
|
+
// with it; this is a link either way.
|
|
72
|
+
border: 0,
|
|
73
|
+
p: 0,
|
|
74
|
+
background: "none",
|
|
75
|
+
font: "inherit",
|
|
76
|
+
"&:hover": { color: "primary.main" },
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
<ArrowBackIcon sx={{ fontSize: 18 }} />
|
|
80
|
+
Back to {label}
|
|
81
|
+
</Link>
|
|
82
|
+
);
|
|
83
|
+
}
|