@malloy-publisher/sdk 0.9.10 → 0.9.11
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-BlNoIiSi.cjs.js +153 -0
- package/dist/{RenderedResult-Dp1Qdajz.es.js → RenderedResult-Cmx8sX8d.es.js} +102 -102
- package/dist/ServerProvider-BOgiW8MX.cjs.js +1 -0
- package/dist/{ServerProvider-CQy4jVYK.es.js → ServerProvider-azXLkk1q.es.js} +619 -586
- package/dist/builder/index.cjs.js +78 -130
- package/dist/builder/index.es.js +7493 -6769
- package/dist/builder-entry.d.ts +3 -0
- package/dist/client/api.d.ts +26 -22
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/AppDialog.d.ts +9 -1
- package/dist/components/Dashboard/DashboardGrid.d.ts +14 -15
- package/dist/components/Dashboard/DashboardTile.d.ts +8 -1
- package/dist/components/Dashboard/DashboardView.d.ts +22 -34
- package/dist/components/Dashboard/TileCard.d.ts +10 -3
- package/dist/components/Dashboard/useStuck.d.ts +15 -7
- package/dist/components/DocumentCreate/useDocumentChoices.d.ts +6 -0
- package/dist/components/Package/PackageProblems.d.ts +14 -0
- package/dist/components/RemoveBadge.d.ts +40 -0
- package/dist/components/Report/Report.d.ts +13 -4
- package/dist/components/Report/ReportPage.d.ts +60 -0
- package/dist/components/Report/layoutRules.d.ts +32 -0
- package/dist/components/Report/reportQuery.d.ts +30 -0
- package/dist/components/Report/telemetry.d.ts +0 -2
- package/dist/components/ReportBuilder/AddTileDialog.d.ts +22 -3
- package/dist/components/ReportBuilder/BuilderBar.d.ts +17 -0
- package/dist/components/ReportBuilder/BuilderDialogs.d.ts +7 -6
- package/dist/components/ReportBuilder/BuilderGrid.d.ts +10 -4
- package/dist/components/ReportBuilder/BuilderHeader.d.ts +4 -7
- package/dist/components/ReportBuilder/BuilderToolbar.d.ts +88 -0
- package/dist/components/ReportBuilder/DrillDialog.d.ts +3 -1
- package/dist/components/ReportBuilder/EditorSurface.d.ts +7 -9
- package/dist/components/ReportBuilder/FilterDialog.d.ts +3 -1
- package/dist/components/ReportBuilder/FilterStrip.d.ts +30 -8
- package/dist/components/ReportBuilder/InlineMarkdown.d.ts +4 -4
- package/dist/components/ReportBuilder/ReportBuilder.d.ts +49 -12
- package/dist/components/ReportBuilder/ReportEditor.d.ts +53 -3
- package/dist/components/ReportBuilder/TextTileBody.d.ts +2 -5
- package/dist/components/ReportBuilder/TileFrame.d.ts +10 -4
- package/dist/components/ReportBuilder/TileMenu.d.ts +12 -9
- package/dist/components/ReportBuilder/ViewPicker.d.ts +53 -0
- package/dist/components/ReportBuilder/addTileToDocument.d.ts +24 -3
- package/dist/components/ReportBuilder/builderControls.d.ts +60 -0
- package/dist/components/ReportBuilder/catalog.d.ts +2 -4
- package/dist/components/ReportBuilder/inlineEdit.d.ts +9 -10
- package/dist/components/ReportBuilder/localGiven.d.ts +12 -0
- package/dist/components/ReportBuilder/preview.d.ts +17 -2
- package/dist/components/ReportBuilder/readDocument.d.ts +0 -2
- package/dist/components/ReportBuilder/readForEditor.d.ts +2 -7
- package/dist/components/ReportBuilder/reportTag.d.ts +11 -1
- package/dist/components/ReportBuilder/sortable.d.ts +4 -3
- package/dist/components/ReportBuilder/testing/inline.d.ts +5 -1
- package/dist/components/ReportBuilder/useBuilderSelection.d.ts +0 -1
- package/dist/components/ReportBuilder/useBuilderSession.d.ts +21 -12
- package/dist/components/ReportBuilder/useDocumentEditor.d.ts +2 -6
- package/dist/components/ReportBuilder/useExitGuard.d.ts +3 -0
- package/dist/components/ReportBuilder/useFilterForm.d.ts +3 -1
- package/dist/components/ReportBuilder/useOpenedDocument.d.ts +0 -4
- package/dist/components/ReportBuilder/useReportDraft.d.ts +66 -0
- package/dist/components/ReportBuilder/useReportEditor.d.ts +0 -9
- package/dist/components/ReportBuilder/useTileEditing.d.ts +6 -3
- package/dist/components/ReportBuilder/viewAnnotations.d.ts +9 -0
- package/dist/components/ReportBuilder/widthLabel.d.ts +6 -0
- package/dist/components/ServerProvider.d.ts +9 -0
- package/dist/components/controlTokens.d.ts +45 -0
- package/dist/components/drill/markDrillableCells.d.ts +1 -1
- package/dist/components/given/FilterButton.d.ts +35 -0
- package/dist/components/given/GivensPanel.d.ts +2 -1
- package/dist/components/given/filterEditing.d.ts +54 -0
- package/dist/components/given/filterSummary.d.ts +9 -0
- package/dist/components/given/paramCodec.d.ts +11 -0
- package/dist/components/given/required.d.ts +25 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/legacy/index.d.ts +1 -1
- package/dist/components/{Report/CellReport.d.ts → legacy/malloynb/CellRunnerView.d.ts} +9 -17
- package/dist/components/legacy/{MalloynbCells.d.ts → malloynb/MalloynbCells.d.ts} +3 -3
- package/dist/components/legacy/{Notebook.d.ts → malloynb/Notebook.d.ts} +1 -1
- package/dist/components/{Notebook → legacy/malloynb}/NotebookCell.d.ts +3 -3
- package/dist/components/legacy/malloynb/cellKind.d.ts +5 -0
- package/dist/components/{Notebook → legacy/malloynb}/types.d.ts +1 -1
- package/dist/components/styles.d.ts +0 -2
- package/dist/hooks/useQueryResult.d.ts +7 -0
- package/dist/index.cjs.js +16 -19
- package/dist/index.es.js +8324 -7769
- package/dist/theme/ThemeContext.d.ts +8 -1
- package/dist/theme/classes.d.ts +49 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/types.d.ts +7 -0
- package/dist/theme/ui.d.ts +75 -0
- package/dist/{useCompiledDocument-BMPDvdFx.es.js → useCompiledDocument-7j5cBjQd.es.js} +8669 -7851
- package/dist/useCompiledDocument-B21sVbb4.cjs.js +141 -0
- package/package.json +2 -2
- package/src/builder-entry.ts +9 -0
- package/src/components/AppDialog.tsx +23 -0
- package/src/components/Dashboard/DashboardGrid.tsx +39 -17
- package/src/components/Dashboard/DashboardTile.tsx +19 -2
- package/src/components/Dashboard/DashboardView.spec.tsx +216 -15
- package/src/components/Dashboard/DashboardView.tsx +137 -155
- package/src/components/Dashboard/RowsDialog.tsx +1 -2
- package/src/components/Dashboard/TileCard.tsx +28 -10
- package/src/components/Dashboard/defaultTileSpan.spec.ts +24 -0
- package/src/components/Dashboard/useStuck.ts +28 -17
- package/src/components/DocumentCreate/useDocumentChoices.ts +19 -2
- package/src/components/Package/NewDocumentDialog.spec.tsx +76 -59
- package/src/components/Package/NewDocumentDialog.tsx +383 -119
- package/src/components/Package/Package.artifacts.spec.tsx +1 -1
- package/src/components/Package/Package.create.spec.tsx +7 -6
- package/src/components/Package/Package.tsx +10 -7
- package/src/components/Package/PackageProblems.spec.tsx +41 -0
- package/src/components/Package/PackageProblems.tsx +95 -0
- package/src/components/Prose.tsx +12 -7
- package/src/components/RemoveBadge.tsx +94 -0
- package/src/components/RenderedResult/RenderedResult.tsx +5 -9
- package/src/components/RenderedResult/ResultPanel.tsx +59 -3
- package/src/components/Report/Report.spec.tsx +50 -32
- package/src/components/Report/Report.telemetry.spec.tsx +0 -45
- package/src/components/Report/Report.tsx +45 -77
- package/src/components/Report/ReportPage.tsx +168 -0
- package/src/components/Report/layoutRules.spec.ts +35 -0
- package/src/components/Report/layoutRules.ts +55 -0
- package/src/components/Report/reportQuery.ts +53 -0
- package/src/components/Report/telemetry.ts +0 -2
- package/src/components/ReportBuilder/AddTileDialog.spec.tsx +76 -41
- package/src/components/ReportBuilder/AddTileDialog.tsx +368 -133
- package/src/components/ReportBuilder/BuilderBar.tsx +599 -0
- package/src/components/ReportBuilder/BuilderDialogs.tsx +28 -39
- package/src/components/ReportBuilder/BuilderGrid.tsx +31 -29
- package/src/components/ReportBuilder/BuilderHeader.tsx +63 -75
- package/src/components/ReportBuilder/BuilderToolbar.tsx +95 -9
- package/src/components/ReportBuilder/DrillDialog.tsx +240 -128
- package/src/components/ReportBuilder/EditorSurface.tsx +345 -69
- package/src/components/ReportBuilder/FilterDialog.tsx +516 -166
- package/src/components/ReportBuilder/FilterStrip.tsx +130 -151
- package/src/components/ReportBuilder/InlineMarkdown.tsx +71 -45
- package/src/components/ReportBuilder/ReportBuilder.charts.spec.tsx +35 -40
- package/src/components/ReportBuilder/ReportBuilder.controls.spec.tsx +491 -0
- package/src/components/ReportBuilder/ReportBuilder.exit.spec.tsx +2 -4
- package/src/components/ReportBuilder/ReportBuilder.inline.spec.tsx +13 -15
- package/src/components/ReportBuilder/ReportBuilder.notebook.spec.tsx +27 -118
- package/src/components/ReportBuilder/ReportBuilder.openDraft.spec.tsx +12 -5
- package/src/components/ReportBuilder/ReportBuilder.sources.spec.tsx +2 -10
- package/src/components/ReportBuilder/ReportBuilder.spec.tsx +37 -31
- package/src/components/ReportBuilder/ReportBuilder.textTiles.spec.tsx +22 -15
- package/src/components/ReportBuilder/ReportBuilder.tsx +292 -117
- package/src/components/ReportBuilder/ReportEditor.emptyStart.spec.tsx +2 -1
- package/src/components/ReportBuilder/ReportEditor.modelFilters.spec.tsx +312 -0
- package/src/components/ReportBuilder/ReportEditor.notebook.spec.tsx +26 -75
- package/src/components/ReportBuilder/ReportEditor.package.spec.tsx +6 -2
- package/src/components/ReportBuilder/ReportEditor.resourceUri.spec.tsx +3 -2
- package/src/components/ReportBuilder/ReportEditor.spec.tsx +2 -4
- package/src/components/ReportBuilder/ReportEditor.textSource.spec.tsx +93 -13
- package/src/components/ReportBuilder/ReportEditor.tsx +104 -14
- package/src/components/ReportBuilder/TextTileBody.tsx +6 -7
- package/src/components/ReportBuilder/TileFrame.tsx +212 -75
- package/src/components/ReportBuilder/TileMenu.tsx +241 -140
- package/src/components/ReportBuilder/ViewPicker.tsx +349 -0
- package/src/components/ReportBuilder/addTile.compile.spec.ts +1 -1
- package/src/components/ReportBuilder/addTileToDocument.spec.ts +102 -3
- package/src/components/ReportBuilder/addTileToDocument.ts +122 -25
- package/src/components/ReportBuilder/builderControls.ts +164 -0
- package/src/components/ReportBuilder/builderReport.ts +1 -2
- package/src/components/ReportBuilder/catalog.ts +10 -26
- package/src/components/ReportBuilder/inlineEdit.tsx +22 -54
- package/src/components/ReportBuilder/localGiven.ts +56 -0
- package/src/components/ReportBuilder/preview.spec.ts +125 -5
- package/src/components/ReportBuilder/preview.ts +60 -44
- package/src/components/ReportBuilder/readDocument.spec.ts +16 -22
- package/src/components/ReportBuilder/readDocument.ts +14 -11
- package/src/components/ReportBuilder/readForEditor.spec.ts +12 -41
- package/src/components/ReportBuilder/readForEditor.ts +4 -26
- package/src/components/ReportBuilder/reportTag.ts +28 -7
- package/src/components/ReportBuilder/sortable.tsx +15 -7
- package/src/components/ReportBuilder/spliceDocument.imports.spec.ts +1 -1
- package/src/components/ReportBuilder/tagParse.spec.ts +0 -40
- package/src/components/ReportBuilder/testing/inline.ts +25 -5
- package/src/components/ReportBuilder/testing/reportLayoutParity.json +13 -8
- package/src/components/ReportBuilder/textTiles.spec.ts +7 -6
- package/src/components/ReportBuilder/useBuilderSelection.ts +35 -0
- package/src/components/ReportBuilder/useBuilderSession.spec.ts +2 -2
- package/src/components/ReportBuilder/useBuilderSession.ts +21 -13
- package/src/components/ReportBuilder/useDocumentEditor.spec.ts +0 -58
- package/src/components/ReportBuilder/useDocumentEditor.ts +3 -16
- package/src/components/ReportBuilder/useEditorCatalog.spec.tsx +26 -0
- package/src/components/ReportBuilder/useEditorCatalog.ts +7 -2
- package/src/components/ReportBuilder/useExitGuard.ts +16 -0
- package/src/components/ReportBuilder/useFilterForm.spec.tsx +17 -0
- package/src/components/ReportBuilder/useFilterForm.ts +5 -1
- package/src/components/ReportBuilder/useOpenedDocument.ts +0 -2
- package/src/components/ReportBuilder/useReportDraft.spec.ts +149 -0
- package/src/components/ReportBuilder/useReportDraft.ts +292 -0
- package/src/components/ReportBuilder/useReportEditor.ts +3 -12
- package/src/components/ReportBuilder/useSaveChannel.ts +0 -1
- package/src/components/ReportBuilder/useTileEditing.ts +43 -12
- package/src/components/ReportBuilder/viewAnnotations.ts +29 -0
- package/src/components/ReportBuilder/widthLabel.spec.ts +25 -0
- package/src/components/ReportBuilder/widthLabel.ts +26 -0
- package/src/components/ServerProvider.tsx +11 -0
- package/src/components/controlTokens.ts +47 -0
- package/src/components/drill/markDrillableCells.ts +2 -1
- package/src/components/given/FilterButton.spec.tsx +143 -0
- package/src/components/given/FilterButton.tsx +478 -0
- package/src/components/given/GivenInput.spec.tsx +47 -0
- package/src/components/given/GivenInput.tsx +20 -2
- package/src/components/given/GivensPanel.spec.tsx +11 -3
- package/src/components/given/GivensPanel.tsx +45 -44
- package/src/components/given/filterEditing.ts +60 -0
- package/src/components/given/filterSummary.spec.ts +108 -0
- package/src/components/given/filterSummary.ts +109 -0
- package/src/components/given/paramCodec.ts +1 -1
- package/src/components/given/required.spec.ts +60 -0
- package/src/components/given/required.ts +78 -0
- package/src/components/index.ts +9 -0
- package/src/components/legacy/Dashboard.spec.tsx +3 -1
- package/src/components/legacy/index.ts +1 -1
- package/src/components/{Report/CellReport.spec.tsx → legacy/malloynb/CellRunnerView.spec.tsx} +53 -57
- package/src/components/{Report/CellReport.tsx → legacy/malloynb/CellRunnerView.tsx} +122 -136
- package/src/components/legacy/{MalloynbCells.tsx → malloynb/MalloynbCells.tsx} +6 -6
- package/src/components/legacy/{Notebook.layout.spec.tsx → malloynb/Notebook.layout.spec.tsx} +16 -7
- package/src/components/legacy/malloynb/Notebook.served.spec.tsx +84 -0
- package/src/components/legacy/{Notebook.spec.tsx → malloynb/Notebook.spec.tsx} +5 -3
- package/src/components/legacy/{Notebook.tsx → malloynb/Notebook.tsx} +9 -7
- package/src/components/{Notebook → legacy/malloynb}/NotebookCell.tsx +70 -150
- package/src/components/legacy/malloynb/cellKind.spec.ts +33 -0
- package/src/components/legacy/malloynb/cellKind.ts +24 -0
- package/src/components/{Notebook → legacy/malloynb}/types.ts +1 -1
- package/src/components/styles.ts +0 -18
- package/src/hooks/useGivensState.ts +7 -3
- package/src/hooks/useQueryResult.placeholder.spec.ts +44 -0
- package/src/hooks/useQueryResult.ts +26 -1
- package/src/theme/ThemeContext.tsx +21 -1
- package/src/theme/classes.ts +52 -0
- package/src/theme/index.ts +8 -0
- package/src/theme/resolveTheme.ts +3 -0
- package/src/theme/types.ts +7 -0
- package/src/theme/ui.spec.tsx +91 -0
- package/src/theme/ui.ts +115 -0
- package/dist/RenderedResult-BcgYjkZ0.cjs.js +0 -153
- package/dist/ServerProvider-B0dUY8be.cjs.js +0 -1
- package/dist/components/Notebook/cellKind.d.ts +0 -20
- package/dist/components/Report/LinearReport.d.ts +0 -18
- package/dist/components/ReportBuilder/SourceViewPicker.d.ts +0 -9
- package/dist/components/ReportBuilder/legacyNotebook.d.ts +0 -73
- package/dist/components/ReportBuilder/useConversionConfirm.d.ts +0 -20
- package/dist/useCompiledDocument-UY28ITET.cjs.js +0 -141
- package/src/components/Notebook/cellKind.spec.ts +0 -199
- package/src/components/Notebook/cellKind.ts +0 -74
- package/src/components/Report/LinearReport.tsx +0 -71
- package/src/components/ReportBuilder/SourceViewPicker.tsx +0 -122
- package/src/components/ReportBuilder/legacyNotebook.chart.spec.ts +0 -77
- package/src/components/ReportBuilder/legacyNotebook.convert.spec.ts +0 -626
- package/src/components/ReportBuilder/legacyNotebook.read.spec.ts +0 -338
- package/src/components/ReportBuilder/legacyNotebook.ts +0 -1122
- package/src/components/ReportBuilder/useConversionConfirm.ts +0 -55
- package/src/components/legacy/Notebook.served.spec.tsx +0 -183
- /package/dist/components/{Notebook → legacy/malloynb}/runPlan.d.ts +0 -0
- /package/src/components/{Notebook → legacy/malloynb}/runPlan.spec.ts +0 -0
- /package/src/components/{Notebook → legacy/malloynb}/runPlan.ts +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
import { parseResourceUri } from "
|
|
5
|
-
import type { CellReportProps } from "
|
|
6
|
-
import {
|
|
4
|
+
import { parseResourceUri } from "../../../utils/formatting";
|
|
5
|
+
import type { CellReportProps } from "./CellRunnerView";
|
|
6
|
+
import { DashboardView } from "../../Dashboard/DashboardView";
|
|
7
7
|
import { MalloynbCells, useNotebookQuery } from "./MalloynbCells";
|
|
8
8
|
|
|
9
9
|
type NotebookProps = CellReportProps;
|
|
@@ -22,20 +22,22 @@ type NotebookProps = CellReportProps;
|
|
|
22
22
|
// Requires PackageProvider
|
|
23
23
|
export default function Notebook(props: NotebookProps) {
|
|
24
24
|
const { data: notebook } = useNotebookQuery(props.resourceUri);
|
|
25
|
-
// A notebook written as a tile layout
|
|
25
|
+
// A notebook written as a tile layout is a linear report: the report view,
|
|
26
|
+
// in one column.
|
|
26
27
|
if (notebook?.dashboard) {
|
|
27
28
|
const { environmentName, packageName, versionId, modelPath } =
|
|
28
29
|
parseResourceUri(props.resourceUri);
|
|
29
30
|
return (
|
|
30
|
-
<
|
|
31
|
-
manifest={notebook.dashboard}
|
|
31
|
+
<DashboardView
|
|
32
|
+
manifest={{ ...notebook.dashboard, layout: "linear" }}
|
|
32
33
|
environmentName={environmentName}
|
|
33
34
|
packageName={packageName}
|
|
34
35
|
versionId={versionId}
|
|
35
36
|
documentName={modelPath}
|
|
36
37
|
givens={props.givens}
|
|
37
38
|
onGivensChange={props.onGivensChange}
|
|
38
|
-
|
|
39
|
+
onNavigate={props.onDrillNavigate}
|
|
40
|
+
{...(props.onNavigate ? { onLinkNavigate: props.onNavigate } : {})}
|
|
39
41
|
maxResultSize={props.maxResultSize}
|
|
40
42
|
/>
|
|
41
43
|
);
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated `.malloynb` only; deleted with the format. One cell of a
|
|
6
|
+
* `.malloynb` notebook: prose, or code with its result in a report tile.
|
|
7
|
+
*/
|
|
8
|
+
|
|
6
9
|
import CodeIcon from "@mui/icons-material/Code";
|
|
7
10
|
import LinkOutlinedIcon from "@mui/icons-material/LinkOutlined";
|
|
8
11
|
import SearchIcon from "@mui/icons-material/Search";
|
|
@@ -14,25 +17,26 @@ import {
|
|
|
14
17
|
Snackbar,
|
|
15
18
|
Stack,
|
|
16
19
|
Tooltip,
|
|
17
|
-
Typography,
|
|
18
20
|
} from "@mui/material";
|
|
19
|
-
import React, { useEffect,
|
|
20
|
-
import type { Given } from "
|
|
21
|
-
import { usePublisherTheme } from "
|
|
22
|
-
import { parseResourceUri } from "
|
|
23
|
-
import { ErrorDetailAlert } from "
|
|
24
|
-
import { AppDialog } from "
|
|
25
|
-
import { highlight } from "
|
|
26
|
-
import { ModelExplorerDialog } from "
|
|
27
|
-
import { FloatingIconButton } from "
|
|
28
|
-
import { Prose } from "
|
|
29
|
-
import type { NavigationClick } from "
|
|
30
|
-
import { useDrill, type DrillNavigation } from "
|
|
31
|
-
import ResultContainer from "
|
|
32
|
-
import { NOTEBOOK_CELL_MAX_HEIGHT } from "
|
|
33
|
-
import ResultsDialog from "
|
|
34
|
-
import { CleanMetricCard, MONO_FONT_FAMILY } from "
|
|
35
|
-
import {
|
|
21
|
+
import React, { useEffect, useState } from "react";
|
|
22
|
+
import type { Given } from "../../../client";
|
|
23
|
+
import { usePublisherTheme } from "../../../theme/ThemeContext";
|
|
24
|
+
import { parseResourceUri } from "../../../utils/formatting";
|
|
25
|
+
import { ErrorDetailAlert } from "../../ApiErrorDisplay";
|
|
26
|
+
import { AppDialog } from "../../AppDialog";
|
|
27
|
+
import { highlight } from "../../highlighter";
|
|
28
|
+
import { ModelExplorerDialog } from "../../Model/ModelExplorerDialog";
|
|
29
|
+
import { FloatingIconButton } from "../../FloatingIconButton";
|
|
30
|
+
import { Prose } from "../../Prose";
|
|
31
|
+
import type { NavigationClick } from "../../click_helper";
|
|
32
|
+
import { useDrill, type DrillNavigation } from "../../drill";
|
|
33
|
+
import ResultContainer from "../../RenderedResult/ResultContainer";
|
|
34
|
+
import { NOTEBOOK_CELL_MAX_HEIGHT } from "../../RenderedResult/resultSizing";
|
|
35
|
+
import ResultsDialog from "../../ResultsDialog";
|
|
36
|
+
import { CleanMetricCard, MONO_FONT_FAMILY } from "../../styles";
|
|
37
|
+
import { stripProse } from "./cellKind";
|
|
38
|
+
import { TileCard, TileHeading } from "../../Dashboard/TileCard";
|
|
39
|
+
import { TextTileFrame } from "../../Report/ReportPage";
|
|
36
40
|
import { EnhancedNotebookCell } from "./types";
|
|
37
41
|
|
|
38
42
|
interface NotebookCellProps {
|
|
@@ -111,8 +115,6 @@ export function NotebookCell({
|
|
|
111
115
|
const [sourcesDialogOpen, setSourcesDialogOpen] =
|
|
112
116
|
React.useState<boolean>(false);
|
|
113
117
|
|
|
114
|
-
const [definitionOpen, setDefinitionOpen] = useState(false);
|
|
115
|
-
const definitionRegionId = useId();
|
|
116
118
|
const [copyMessage, setCopyMessage] = useState("");
|
|
117
119
|
|
|
118
120
|
const { environmentName, packageName, modelPath } =
|
|
@@ -228,13 +230,6 @@ export function NotebookCell({
|
|
|
228
230
|
});
|
|
229
231
|
}, [cell, mode]);
|
|
230
232
|
|
|
231
|
-
const caption = cell.kind === "query" ? cellCaption(cell) : undefined;
|
|
232
|
-
const header = cell.markdown ? (
|
|
233
|
-
<Prose variant="document" links={links}>
|
|
234
|
-
{cell.markdown}
|
|
235
|
-
</Prose>
|
|
236
|
-
) : null;
|
|
237
|
-
|
|
238
233
|
const copyToClipboard = () => {
|
|
239
234
|
const url = window.location.href;
|
|
240
235
|
navigator.clipboard
|
|
@@ -281,7 +276,7 @@ export function NotebookCell({
|
|
|
281
276
|
return (
|
|
282
277
|
(cell.type === "markdown" && (
|
|
283
278
|
<Box>
|
|
284
|
-
<
|
|
279
|
+
<TextTileFrame>
|
|
285
280
|
{showCopyLink ? (
|
|
286
281
|
<Stack
|
|
287
282
|
direction="row"
|
|
@@ -312,65 +307,11 @@ export function NotebookCell({
|
|
|
312
307
|
onClose={() => setCopyMessage("")}
|
|
313
308
|
message={copyMessage}
|
|
314
309
|
/>
|
|
315
|
-
</
|
|
316
|
-
</Box>
|
|
317
|
-
)) ||
|
|
318
|
-
(cell.kind === "definition" && (
|
|
319
|
-
<Box>
|
|
320
|
-
{header}
|
|
321
|
-
<Box
|
|
322
|
-
component="button"
|
|
323
|
-
type="button"
|
|
324
|
-
aria-expanded={definitionOpen}
|
|
325
|
-
aria-controls={definitionRegionId}
|
|
326
|
-
onClick={() => setDefinitionOpen((open) => !open)}
|
|
327
|
-
sx={{
|
|
328
|
-
display: "flex",
|
|
329
|
-
alignItems: "center",
|
|
330
|
-
gap: "4px",
|
|
331
|
-
p: 0,
|
|
332
|
-
border: 0,
|
|
333
|
-
background: "none",
|
|
334
|
-
cursor: "pointer",
|
|
335
|
-
fontFamily: MONO_FONT_FAMILY,
|
|
336
|
-
fontSize: "13px",
|
|
337
|
-
color: "text.secondary",
|
|
338
|
-
}}
|
|
339
|
-
>
|
|
340
|
-
{definitionOpen ? (
|
|
341
|
-
<ExpandMoreIcon fontSize="small" />
|
|
342
|
-
) : (
|
|
343
|
-
<ChevronRightIcon fontSize="small" />
|
|
344
|
-
)}
|
|
345
|
-
{definitionSummary(cell)}
|
|
346
|
-
</Box>
|
|
347
|
-
{definitionOpen && (
|
|
348
|
-
<CleanMetricCard
|
|
349
|
-
id={definitionRegionId}
|
|
350
|
-
sx={{ mt: 1, padding: "12px 24px" }}
|
|
351
|
-
>
|
|
352
|
-
<pre
|
|
353
|
-
className="code-display"
|
|
354
|
-
style={{ margin: 0, overflow: "auto" }}
|
|
355
|
-
dangerouslySetInnerHTML={{
|
|
356
|
-
__html: highlightedMalloyCode ?? "",
|
|
357
|
-
}}
|
|
358
|
-
/>
|
|
359
|
-
</CleanMetricCard>
|
|
360
|
-
)}
|
|
310
|
+
</TextTileFrame>
|
|
361
311
|
</Box>
|
|
362
312
|
)) ||
|
|
363
313
|
(cell.type === "code" && (
|
|
364
314
|
<Box>
|
|
365
|
-
{header}
|
|
366
|
-
{caption && (
|
|
367
|
-
<Typography
|
|
368
|
-
variant="body2"
|
|
369
|
-
sx={{ color: "text.secondary", mb: 1 }}
|
|
370
|
-
>
|
|
371
|
-
{caption}
|
|
372
|
-
</Typography>
|
|
373
|
-
)}
|
|
374
315
|
{cell.newSources && cell.newSources.length > 0 && (
|
|
375
316
|
<Stack
|
|
376
317
|
sx={{
|
|
@@ -453,16 +394,18 @@ export function NotebookCell({
|
|
|
453
394
|
!cell.error &&
|
|
454
395
|
!hasValidImport &&
|
|
455
396
|
!(cell.newSources && cell.newSources.length > 0) && (
|
|
456
|
-
<
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
397
|
+
<TileCard>
|
|
398
|
+
<Box
|
|
399
|
+
sx={{
|
|
400
|
+
display: "flex",
|
|
401
|
+
justifyContent: "center",
|
|
402
|
+
alignItems: "center",
|
|
403
|
+
minHeight: 200,
|
|
404
|
+
}}
|
|
405
|
+
>
|
|
406
|
+
<CircularProgress size={32} />
|
|
407
|
+
</Box>
|
|
408
|
+
</TileCard>
|
|
466
409
|
)}
|
|
467
410
|
|
|
468
411
|
{!cell.result && cell.error && (
|
|
@@ -480,62 +423,39 @@ export function NotebookCell({
|
|
|
480
423
|
)}
|
|
481
424
|
|
|
482
425
|
{cell.result && (
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
426
|
+
// The tile a grid draws: the cell's own actions on the heading's
|
|
427
|
+
// row, then the result.
|
|
428
|
+
<TileCard>
|
|
429
|
+
<TileHeading
|
|
430
|
+
title=""
|
|
431
|
+
action={
|
|
432
|
+
<Stack direction="row" sx={{ gap: 0.5, mt: "-4px" }}>
|
|
433
|
+
<FloatingIconButton
|
|
434
|
+
aria-label="Malloy code"
|
|
435
|
+
onClick={(e) => {
|
|
436
|
+
e.stopPropagation();
|
|
437
|
+
setCodeDialogOpen(true);
|
|
438
|
+
}}
|
|
439
|
+
>
|
|
440
|
+
<CodeIcon />
|
|
441
|
+
</FloatingIconButton>
|
|
442
|
+
<FloatingIconButton
|
|
443
|
+
aria-label="Expand results"
|
|
444
|
+
onClick={() => setResultsDialogOpen(true)}
|
|
445
|
+
>
|
|
446
|
+
<SearchIcon />
|
|
447
|
+
</FloatingIconButton>
|
|
448
|
+
</Stack>
|
|
449
|
+
}
|
|
450
|
+
/>
|
|
451
|
+
<ResultContainer
|
|
452
|
+
result={cell.result}
|
|
453
|
+
maxHeight={NOTEBOOK_CELL_MAX_HEIGHT}
|
|
454
|
+
maxResultSize={maxResultSize}
|
|
455
|
+
drill={drill}
|
|
456
|
+
/>
|
|
500
457
|
{drillMenu}
|
|
501
|
-
|
|
502
|
-
{/* Top right corner controls.
|
|
503
|
-
`top: -12px` lifts the buttons above the
|
|
504
|
-
CleanMetricCard's inner ResultContainer so the
|
|
505
|
-
dashboard panel (which now paints slate in dark
|
|
506
|
-
mode) doesn't bisect them. The icons were already
|
|
507
|
-
visually overlapping the panel's top edge in
|
|
508
|
-
light mode too, but the white-on-white made it
|
|
509
|
-
invisible; in dark mode the contrast made the
|
|
510
|
-
clipping obvious. */}
|
|
511
|
-
<Stack
|
|
512
|
-
sx={{
|
|
513
|
-
position: "absolute",
|
|
514
|
-
top: "-12px",
|
|
515
|
-
right: "8px",
|
|
516
|
-
flexDirection: "row",
|
|
517
|
-
gap: "8px",
|
|
518
|
-
alignItems: "center",
|
|
519
|
-
zIndex: 2,
|
|
520
|
-
}}
|
|
521
|
-
>
|
|
522
|
-
<FloatingIconButton
|
|
523
|
-
aria-label="Malloy code"
|
|
524
|
-
onClick={(e) => {
|
|
525
|
-
e.stopPropagation();
|
|
526
|
-
setCodeDialogOpen(true);
|
|
527
|
-
}}
|
|
528
|
-
>
|
|
529
|
-
<CodeIcon />
|
|
530
|
-
</FloatingIconButton>
|
|
531
|
-
<FloatingIconButton
|
|
532
|
-
aria-label="Expand results"
|
|
533
|
-
onClick={() => setResultsDialogOpen(true)}
|
|
534
|
-
>
|
|
535
|
-
<SearchIcon />
|
|
536
|
-
</FloatingIconButton>
|
|
537
|
-
</Stack>
|
|
538
|
-
</CleanMetricCard>
|
|
458
|
+
</TileCard>
|
|
539
459
|
)}
|
|
540
460
|
</Box>
|
|
541
461
|
))
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
// DEPRECATED FEATURE COVERAGE — delete together with
|
|
5
|
+
// `.malloynb` notebooks (see RELEASE_NOTES deprecations).
|
|
6
|
+
import { describe, expect, it } from "bun:test";
|
|
7
|
+
import { cellRuns, stripProse } from "./cellKind";
|
|
8
|
+
|
|
9
|
+
describe("cellRuns", () => {
|
|
10
|
+
it("runs a .malloynb code cell and skips its markdown", () => {
|
|
11
|
+
expect(cellRuns({ type: "code" })).toBe(true);
|
|
12
|
+
expect(cellRuns({ type: "markdown" })).toBe(false);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe("stripProse", () => {
|
|
17
|
+
it("drops the ## lines, as the released viewer did", () => {
|
|
18
|
+
expect(
|
|
19
|
+
stripProse({ text: "## title\n ## indented\nrun: q\n#(markdown) x" }),
|
|
20
|
+
).toBe("run: q\n#(markdown) x");
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("drops a .malloynb ##! line", () => {
|
|
24
|
+
expect(stripProse({ text: "##! experimental.parameters\nrun: q" })).toBe(
|
|
25
|
+
"run: q",
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("leaves (markdown) lines alone", () => {
|
|
30
|
+
const cell = '#(markdown) note\n#|(markdown)\nbody\n|#\n#" c\nrun: q';
|
|
31
|
+
expect(stripProse({ text: cell })).toBe(cell);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated `.malloynb` only; deleted with the format.
|
|
6
|
+
*
|
|
7
|
+
* How a `.malloynb` cell is read: every code cell runs, and a cell's code is
|
|
8
|
+
* shown without its `##` lines (the notebook's own annotations), which are not
|
|
9
|
+
* part of the query. A `.malloy` report never reaches here: it is tiles.
|
|
10
|
+
*/
|
|
11
|
+
import type { NotebookCell } from "../../../client";
|
|
12
|
+
|
|
13
|
+
/** Whether the viewer sends a cell to the server to run: every code cell. */
|
|
14
|
+
export function cellRuns(cell: Pick<NotebookCell, "type">): boolean {
|
|
15
|
+
return cell.type === "code";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** A cell's code without its `##` lines. */
|
|
19
|
+
export function stripProse(cell: Pick<NotebookCell, "text">): string {
|
|
20
|
+
return (cell.text ?? "")
|
|
21
|
+
.split("\n")
|
|
22
|
+
.filter((line) => !line.trimStart().startsWith("##"))
|
|
23
|
+
.join("\n");
|
|
24
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
import { NotebookCell as ClientNotebookCell } from "
|
|
4
|
+
import { NotebookCell as ClientNotebookCell } from "../../../client";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Enhanced notebook cell that extends the base API cell with execution results.
|
package/src/components/styles.ts
CHANGED
|
@@ -89,24 +89,6 @@ export const StyledCardMedia = styled(CardMedia)({
|
|
|
89
89
|
padding: "0",
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
// New clean notebook styles
|
|
93
|
-
// No width or side padding of its own: like the Dashboard, a notebook fills
|
|
94
|
-
// the column its host gives it, so a package's pages share one set of edges.
|
|
95
|
-
export const CleanNotebookContainer = styled("div")(({ theme }) => ({
|
|
96
|
-
backgroundColor: theme.palette.background.default,
|
|
97
|
-
borderRadius: "12px",
|
|
98
|
-
boxShadow: "none",
|
|
99
|
-
border: "none",
|
|
100
|
-
}));
|
|
101
|
-
|
|
102
|
-
export const CleanNotebookSection = styled("div")({
|
|
103
|
-
marginBottom: "48px",
|
|
104
|
-
padding: "0",
|
|
105
|
-
backgroundColor: "transparent",
|
|
106
|
-
border: "none",
|
|
107
|
-
boxShadow: "none",
|
|
108
|
-
});
|
|
109
|
-
|
|
110
92
|
export const CleanMetricCard = styled("div")({
|
|
111
93
|
backgroundColor: "transparent",
|
|
112
94
|
paddingTop: "12px",
|
|
@@ -328,9 +328,13 @@ export function useGivensState({
|
|
|
328
328
|
// they already match, so this cannot loop against a host that feeds its URL
|
|
329
329
|
// back in through `params`.
|
|
330
330
|
//
|
|
331
|
-
//
|
|
332
|
-
//
|
|
333
|
-
//
|
|
331
|
+
// Only the reader's own values are reported, not the file's starting values:
|
|
332
|
+
// a link copied before anything was touched follows the file's starting
|
|
333
|
+
// values as they are later edited, rather than pinning the ones it was opened
|
|
334
|
+
// at. That falls out of the seeding below for a host that mounts this with
|
|
335
|
+
// its manifest loaded, as the report reader does. (A host that mounts first
|
|
336
|
+
// and loads after, as the deprecated `.malloynb` runner does, reports them on
|
|
337
|
+
// an uncached load.)
|
|
334
338
|
//
|
|
335
339
|
// The reference starts at the first render's values rather than empty. The
|
|
336
340
|
// control row is empty until the manifest arrives and says which givens
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { describe, expect, it } from "bun:test";
|
|
5
|
+
import { onlyGivensDiffer, queryResultKey } from "./useQueryResult";
|
|
6
|
+
|
|
7
|
+
const spec = {
|
|
8
|
+
environmentName: "e",
|
|
9
|
+
packageName: "p",
|
|
10
|
+
modelPath: "m.malloy",
|
|
11
|
+
query: "run: a -> by_cat",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
describe("which earlier answer a re-run may show", () => {
|
|
15
|
+
it("keeps the last answer when only the control values changed", () => {
|
|
16
|
+
expect(
|
|
17
|
+
onlyGivensDiffer(
|
|
18
|
+
[...queryResultKey({ ...spec, givens: { R: "w" } }), "server"],
|
|
19
|
+
[...queryResultKey({ ...spec, givens: { R: "e" } }), "server"],
|
|
20
|
+
),
|
|
21
|
+
).toBe(true);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("drops it when the query changed: another view is not its answer", () => {
|
|
25
|
+
expect(
|
|
26
|
+
onlyGivensDiffer(
|
|
27
|
+
[...queryResultKey(spec), "server"],
|
|
28
|
+
[
|
|
29
|
+
...queryResultKey({ ...spec, query: "run: a -> by_brand" }),
|
|
30
|
+
"server",
|
|
31
|
+
],
|
|
32
|
+
),
|
|
33
|
+
).toBe(false);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("drops it for another server", () => {
|
|
37
|
+
expect(
|
|
38
|
+
onlyGivensDiffer(
|
|
39
|
+
[...queryResultKey(spec), "one"],
|
|
40
|
+
[...queryResultKey(spec), "two"],
|
|
41
|
+
),
|
|
42
|
+
).toBe(false);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import type { QueryKey } from "@tanstack/react-query";
|
|
5
5
|
import { useServer } from "../components/ServerProvider";
|
|
6
6
|
import { CHART_RESULT_QUERY_OPTIONS } from "../utils/queryClient";
|
|
7
|
+
import { keepPreviousData } from "@tanstack/react-query";
|
|
7
8
|
import { useQueryWithApiError } from "./useQueryWithApiError";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -74,8 +75,9 @@ export function useQueryResult(
|
|
|
74
75
|
{ enabled = true }: { enabled?: boolean } = {},
|
|
75
76
|
) {
|
|
76
77
|
const { apiClients } = useServer();
|
|
78
|
+
const key = queryResultKey(spec);
|
|
77
79
|
return useQueryWithApiError({
|
|
78
|
-
queryKey:
|
|
80
|
+
queryKey: key,
|
|
79
81
|
// The signal cancels a run the page no longer wants: a tile whose givens
|
|
80
82
|
// changed under it, or one that unmounted. react-query reverts a
|
|
81
83
|
// cancelled query to its previous state rather than to an error, so an
|
|
@@ -96,9 +98,32 @@ export function useQueryResult(
|
|
|
96
98
|
{ signal },
|
|
97
99
|
),
|
|
98
100
|
enabled,
|
|
101
|
+
// A change of givens is a new key, and without this the surface drops to
|
|
102
|
+
// "Running…" and back: every tile on a page blanked and redrew on each
|
|
103
|
+
// filter pick. The last result stays up until the new one lands, and
|
|
104
|
+
// `isPlaceholderData` says it is the previous answer.
|
|
105
|
+
placeholderData: (previous, previousQuery) =>
|
|
106
|
+
previousQuery && onlyGivensDiffer(previousQuery.queryKey, key)
|
|
107
|
+
? keepPreviousData(previous)
|
|
108
|
+
: undefined,
|
|
99
109
|
...CHART_RESULT_QUERY_OPTIONS,
|
|
100
110
|
});
|
|
101
111
|
}
|
|
102
112
|
|
|
113
|
+
/** Where the applied values sit in {@link queryResultKey}. */
|
|
114
|
+
const GIVENS_AT = 8;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The same request but for its control values. Only then is the last answer
|
|
118
|
+
* worth showing while the new one runs: a tile switched to another view, or a
|
|
119
|
+
* query changed for any other reason, showed the old view's rows under the
|
|
120
|
+
* new title. The wrapper appends the server; that has to match too.
|
|
121
|
+
*/
|
|
122
|
+
export function onlyGivensDiffer(previous: QueryKey, next: QueryKey): boolean {
|
|
123
|
+
return previous.every(
|
|
124
|
+
(part, i) => i === GIVENS_AT || i >= next.length || part === next[i],
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
103
128
|
/** What a result surface holds while a query runs: hand it to `ResultPanel`. */
|
|
104
129
|
export type QueryResultState = ReturnType<typeof useQueryResult>;
|
|
@@ -8,6 +8,7 @@ import React, {
|
|
|
8
8
|
type ReactNode,
|
|
9
9
|
} from "react";
|
|
10
10
|
import { resolveTheme } from "./resolveTheme";
|
|
11
|
+
import { mergeUi, type ReportUiOverrides } from "./ui";
|
|
11
12
|
import type { ResolvedTheme, Theme, ThemeMode } from "./types";
|
|
12
13
|
|
|
13
14
|
interface ThemeContextValue {
|
|
@@ -46,6 +47,12 @@ interface ThemeProviderProps {
|
|
|
46
47
|
userChoice: ThemeMode | "auto" | undefined;
|
|
47
48
|
setMode: (mode: ThemeMode | "auto") => void;
|
|
48
49
|
allowUserToggle?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The host's design tokens for the report and builder chrome: radii,
|
|
52
|
+
* control sizes, the type scale, the mono face, the menu shadow. Any subset;
|
|
53
|
+
* the rest stay the SDK's. See `ReportUi`.
|
|
54
|
+
*/
|
|
55
|
+
ui?: ReportUiOverrides;
|
|
49
56
|
children: ReactNode;
|
|
50
57
|
}
|
|
51
58
|
|
|
@@ -55,9 +62,22 @@ export function ThemeProvider({
|
|
|
55
62
|
userChoice,
|
|
56
63
|
setMode,
|
|
57
64
|
allowUserToggle = true,
|
|
65
|
+
ui,
|
|
58
66
|
children,
|
|
59
67
|
}: ThemeProviderProps) {
|
|
60
|
-
|
|
68
|
+
// Keyed on the tokens' content, not the object: a host writing `ui={{…}}`
|
|
69
|
+
// inline hands a new object every render, and a new theme every render
|
|
70
|
+
// repainted every chart on the page.
|
|
71
|
+
const uiKey = JSON.stringify(ui ?? null);
|
|
72
|
+
const merged = useMemo(
|
|
73
|
+
() => mergeUi(ui),
|
|
74
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
|
+
[uiKey],
|
|
76
|
+
);
|
|
77
|
+
const theme = useMemo(
|
|
78
|
+
() => ({ ...resolveTheme(layers, mode), ui: merged }),
|
|
79
|
+
[layers, mode, merged],
|
|
80
|
+
);
|
|
61
81
|
const value = useMemo<ThemeContextValue>(
|
|
62
82
|
() => ({ theme, layers, mode, userChoice, setMode, allowUserToggle }),
|
|
63
83
|
[theme, layers, mode, userChoice, setMode, allowUserToggle],
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Stable class names on the parts of the report reader and builder, for a
|
|
6
|
+
* host to style what the theme tokens (`ui`, the instance theme, the host's
|
|
7
|
+
* MUI palette) do not reach: a global stylesheet, or a styled wrapper,
|
|
8
|
+
* selecting `.publisher-tile` rather than an MUI class that changes between
|
|
9
|
+
* versions.
|
|
10
|
+
*
|
|
11
|
+
* These names are API: they are kept across releases, and a part that goes
|
|
12
|
+
* away is said so in the release notes.
|
|
13
|
+
*/
|
|
14
|
+
export const reportClasses = {
|
|
15
|
+
/** A report page, read or edited: header, filter row and tiles. */
|
|
16
|
+
report: "publisher-report",
|
|
17
|
+
/** The title and description over a report. */
|
|
18
|
+
header: "publisher-report-header",
|
|
19
|
+
/** The report's title. */
|
|
20
|
+
title: "publisher-report-title",
|
|
21
|
+
/** The row of filter buttons (pinned under the header while scrolling). */
|
|
22
|
+
filterRow: "publisher-filter-row",
|
|
23
|
+
/** One filter's button. */
|
|
24
|
+
filter: "publisher-filter",
|
|
25
|
+
/** The popover a filter button opens. */
|
|
26
|
+
filterPopover: "publisher-filter-popover",
|
|
27
|
+
/** A tile's card: a query result, or a block of prose (`data-tile-kind`). */
|
|
28
|
+
tile: "publisher-tile",
|
|
29
|
+
/** A tile's title and subtitle. */
|
|
30
|
+
tileHeading: "publisher-tile-heading",
|
|
31
|
+
/** A cell that can be clicked to filter (`# drill`). */
|
|
32
|
+
drillCell: "publisher-drill",
|
|
33
|
+
/** The builder, around the page it edits. */
|
|
34
|
+
builder: "publisher-builder",
|
|
35
|
+
/** The builder's controls as one bar (`BuilderBar`). */
|
|
36
|
+
builderBar: "publisher-builder-bar",
|
|
37
|
+
/** The bar's save status. */
|
|
38
|
+
saveStatus: "publisher-save-status",
|
|
39
|
+
/** A tile as the builder draws it: selection, handle and menu around the card. */
|
|
40
|
+
builderTile: "publisher-builder-tile",
|
|
41
|
+
/** The grip on a tile's right edge that sets its width. */
|
|
42
|
+
widthHandle: "publisher-width-handle",
|
|
43
|
+
/** The builder's menus (Add, a tile's ⋯, the save status). */
|
|
44
|
+
menu: "publisher-menu",
|
|
45
|
+
/** Every builder window; each also carries its own name below. */
|
|
46
|
+
dialog: "publisher-dialog",
|
|
47
|
+
addTileDialog: "publisher-add-tile-dialog",
|
|
48
|
+
filterDialog: "publisher-filter-dialog",
|
|
49
|
+
clickableCellsDialog: "publisher-clickable-cells-dialog",
|
|
50
|
+
/** The New report window. */
|
|
51
|
+
newReportDialog: "publisher-new-report-dialog",
|
|
52
|
+
} as const;
|
package/src/theme/index.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
export { accentFor, contrastRatio, type Accent } from "./accent";
|
|
5
5
|
export { buildMalloyExplicitTheme } from "./buildMalloyExplicitTheme";
|
|
6
6
|
export { buildTableCssVars } from "./buildTableCssVars";
|
|
7
|
+
export { reportClasses } from "./classes";
|
|
7
8
|
export { buildVegaThemeOverride } from "./buildVegaThemeOverride";
|
|
8
9
|
export { DEFAULT_THEME } from "./defaults";
|
|
9
10
|
export {
|
|
@@ -18,3 +19,10 @@ export { readChartAnnotations } from "./readChartAnnotations";
|
|
|
18
19
|
export { resolveMode, resolveTheme } from "./resolveTheme";
|
|
19
20
|
export { ThemeProvider, usePublisherTheme } from "./ThemeContext";
|
|
20
21
|
export type { ResolvedTheme, Theme, ThemeMode } from "./types";
|
|
22
|
+
export {
|
|
23
|
+
DEFAULT_UI,
|
|
24
|
+
mergeUi,
|
|
25
|
+
type ReportUi,
|
|
26
|
+
type ReportUiOverrides,
|
|
27
|
+
type UiTextStyle,
|
|
28
|
+
} from "./ui";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
+
import { DEFAULT_UI } from "./ui";
|
|
4
5
|
import { accentFor, legibleOn } from "./accent";
|
|
5
6
|
import { DEFAULT_THEME } from "./defaults";
|
|
6
7
|
import { PER_MODE_COLOR_KEYS, type PerModeColorKey } from "./keys";
|
|
@@ -94,6 +95,8 @@ export function resolveTheme(
|
|
|
94
95
|
: pick("mapColor");
|
|
95
96
|
return {
|
|
96
97
|
mode,
|
|
98
|
+
// The host's chrome tokens are laid over this by `ThemeProvider`.
|
|
99
|
+
ui: DEFAULT_UI,
|
|
97
100
|
// One series list for both modes, picked against a light page: in dark,
|
|
98
101
|
// an operator's colour too dark to see on the canvas is lifted until it
|
|
99
102
|
// reads. The defaults are drawn as they always were.
|