@malloy-publisher/sdk 0.12.1 → 0.12.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/README.md +79 -6
- package/dist/{RenderedResult-DrNhQ2_9.cjs.js → RenderedResult-Cgw4iqev.cjs.js} +1 -1
- package/dist/{RenderedResult-AyM-RQaA.es.js → RenderedResult-DEjFM1DL.es.js} +2 -2
- package/dist/ServerProvider-BRQl_cBo.cjs.js +1 -0
- package/dist/{ServerProvider-a9Ki0QXO.es.js → ServerProvider-RnliA2Ao.es.js} +577 -555
- package/dist/builder/index.cjs.js +1 -1
- package/dist/builder/index.es.js +3 -3
- package/dist/client/api.d.ts +10 -1
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +28 -27
- package/dist/components/Model/ExplorerPage.d.ts +9 -0
- package/dist/components/Model/Model.d.ts +27 -11
- package/dist/components/ModelViewer/AccessChips.d.ts +34 -0
- package/dist/components/ModelViewer/EmptyRow.d.ts +23 -0
- package/dist/components/ModelViewer/Facts.d.ts +15 -0
- package/dist/components/ModelViewer/FieldGroup.d.ts +31 -0
- package/dist/components/ModelViewer/FieldRow.d.ts +69 -0
- package/dist/components/ModelViewer/GivenFacts.d.ts +21 -0
- package/dist/components/ModelViewer/HeaderBar.d.ts +75 -0
- package/dist/components/ModelViewer/InlineDoc.d.ts +13 -0
- package/dist/components/ModelViewer/ModelGivensSection.d.ts +32 -0
- package/dist/components/ModelViewer/ModelSection.d.ts +21 -0
- package/dist/components/ModelViewer/ModelViewer.d.ts +91 -0
- package/dist/components/ModelViewer/QueriesGroup.d.ts +15 -0
- package/dist/components/ModelViewer/RowGlyph.d.ts +27 -0
- package/dist/components/ModelViewer/RunResult.d.ts +46 -0
- package/dist/components/ModelViewer/SampleValues.d.ts +20 -0
- package/dist/components/ModelViewer/SchemaJoin.d.ts +51 -0
- package/dist/components/ModelViewer/SchemaView.d.ts +52 -0
- package/dist/components/ModelViewer/SegmentIcons.d.ts +70 -0
- package/dist/components/ModelViewer/SourcesDropdown.d.ts +53 -0
- package/dist/components/ModelViewer/SourcesNav.d.ts +25 -0
- package/dist/components/ModelViewer/StatusPill.d.ts +56 -0
- package/dist/components/ModelViewer/ValueChip.d.ts +17 -0
- package/dist/components/ModelViewer/ViewRow.d.ts +36 -0
- package/dist/components/ModelViewer/clickableBox.d.ts +29 -0
- package/dist/components/ModelViewer/codeDisplay.d.ts +44 -0
- package/dist/components/ModelViewer/docAnnotations.d.ts +90 -0
- package/dist/components/ModelViewer/explorerModel.d.ts +12 -0
- package/dist/components/ModelViewer/extensions.d.ts +94 -0
- package/dist/components/ModelViewer/fieldCode.d.ts +74 -0
- package/dist/components/ModelViewer/fieldEntities.d.ts +45 -0
- package/dist/components/ModelViewer/fieldExpansion.d.ts +41 -0
- package/dist/components/ModelViewer/givenUsage.d.ts +71 -0
- package/dist/components/ModelViewer/headerCard.d.ts +31 -0
- package/dist/components/ModelViewer/httpStatus.d.ts +4 -0
- package/dist/components/ModelViewer/icons.d.ts +31 -0
- package/dist/components/ModelViewer/index.d.ts +9 -0
- package/dist/components/ModelViewer/joinAccess.d.ts +52 -0
- package/dist/components/ModelViewer/malloyRunText.d.ts +22 -0
- package/dist/components/ModelViewer/malloyText.d.ts +21 -0
- package/dist/components/ModelViewer/modelGivens.d.ts +61 -0
- package/dist/components/ModelViewer/modelGivensContext.d.ts +9 -0
- package/dist/components/ModelViewer/modelHeaderPresentation.d.ts +28 -0
- package/dist/components/ModelViewer/modelTextDeclarations.d.ts +32 -0
- package/dist/components/ModelViewer/modelTextParse.d.ts +27 -0
- package/dist/components/ModelViewer/namedQueryCode.d.ts +12 -0
- package/dist/components/ModelViewer/offSurface.d.ts +54 -0
- package/dist/components/ModelViewer/rowLayers.d.ts +30 -0
- package/dist/components/ModelViewer/runGate.d.ts +49 -0
- package/dist/components/ModelViewer/schemaModel.d.ts +109 -0
- package/dist/components/ModelViewer/sectionOpenCommand.d.ts +45 -0
- package/dist/components/ModelViewer/sourceAccess.d.ts +67 -0
- package/dist/components/ModelViewer/sourceLineage.d.ts +14 -0
- package/dist/components/ModelViewer/sourcePicker.d.ts +66 -0
- package/dist/components/ModelViewer/surface.d.ts +47 -0
- package/dist/components/ModelViewer/text.d.ts +6 -0
- package/dist/components/ModelViewer/theme.d.ts +63 -0
- package/dist/components/ModelViewer/tokens.d.ts +52 -0
- package/dist/components/ModelViewer/ui.d.ts +48 -0
- package/dist/components/ModelViewer/useDimensionSamples.d.ts +76 -0
- package/dist/components/ModelViewer/useModelSources.d.ts +92 -0
- package/dist/components/ModelViewer/useRunQuery.d.ts +115 -0
- package/dist/components/ReportBuilder/loadMalloy.d.ts +4 -0
- package/dist/components/ServerProvider.d.ts +15 -1
- package/dist/components/filter/utils.d.ts +1 -1
- package/dist/components/given/GivenInput.d.ts +7 -1
- package/dist/components/given/GivensPanel.d.ts +3 -1
- package/dist/components/given/filterSummary.d.ts +6 -0
- package/dist/components/given/useGivenUrlParams.d.ts +11 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/components/modelPage.d.ts +36 -0
- package/dist/hooks/useDimensionalFilterRangeData.d.ts +9 -0
- package/dist/hooks/useSuggestOptions.d.ts +26 -2
- package/dist/index.cjs.js +47 -19
- package/dist/index.es.js +14281 -9879
- package/dist/useCompiledDocument-D88_2cGS.cjs.js +143 -0
- package/dist/{useCompiledDocument-Utj2u8CG.es.js → useCompiledDocument-Dmm6xkom.es.js} +6975 -6893
- package/dist/utils/filterCondition.d.ts +14 -0
- package/dist/utils/malloyLiteral.d.ts +20 -1
- package/package.json +2 -2
- package/src/components/Model/ExplorerPage.tsx +269 -0
- package/src/components/Model/Model.tsx +66 -250
- package/src/components/Model/ModelExplorer.spec.tsx +64 -1
- package/src/components/ModelViewer/AccessChips.tsx +149 -0
- package/src/components/ModelViewer/EmptyRow.tsx +71 -0
- package/src/components/ModelViewer/Facts.tsx +46 -0
- package/src/components/ModelViewer/FieldGroup.tsx +137 -0
- package/src/components/ModelViewer/FieldRow.tsx +566 -0
- package/src/components/ModelViewer/GivenFacts.tsx +89 -0
- package/src/components/ModelViewer/HeaderBar.tsx +362 -0
- package/src/components/ModelViewer/InlineDoc.tsx +50 -0
- package/src/components/ModelViewer/ModelGivensSection.tsx +142 -0
- package/src/components/ModelViewer/ModelSection.tsx +98 -0
- package/src/components/ModelViewer/ModelViewer.spec.tsx +937 -0
- package/src/components/ModelViewer/ModelViewer.tsx +777 -0
- package/src/components/ModelViewer/QueriesGroup.tsx +107 -0
- package/src/components/ModelViewer/RowGlyph.tsx +138 -0
- package/src/components/ModelViewer/RunResult.tsx +298 -0
- package/src/components/ModelViewer/SampleValues.tsx +97 -0
- package/src/components/ModelViewer/SchemaJoin.tsx +258 -0
- package/src/components/ModelViewer/SchemaView.tsx +222 -0
- package/src/components/ModelViewer/SegmentIcons.tsx +129 -0
- package/src/components/ModelViewer/SourcesDropdown.tsx +265 -0
- package/src/components/ModelViewer/SourcesNav.tsx +75 -0
- package/src/components/ModelViewer/StatusPill.tsx +145 -0
- package/src/components/ModelViewer/ValueChip.tsx +39 -0
- package/src/components/ModelViewer/ViewRow.tsx +274 -0
- package/src/components/ModelViewer/clickableBox.ts +59 -0
- package/src/components/ModelViewer/codeDisplay.spec.ts +176 -0
- package/src/components/ModelViewer/codeDisplay.ts +118 -0
- package/src/components/ModelViewer/docAnnotations.spec.ts +181 -0
- package/src/components/ModelViewer/docAnnotations.ts +244 -0
- package/src/components/ModelViewer/docAnnotations.typeDetail.spec.ts +114 -0
- package/src/components/ModelViewer/explorerModel.spec.ts +43 -0
- package/src/components/ModelViewer/explorerModel.ts +31 -0
- package/src/components/ModelViewer/extensions.tsx +112 -0
- package/src/components/ModelViewer/fieldCode.spec.ts +168 -0
- package/src/components/ModelViewer/fieldCode.ts +118 -0
- package/src/components/ModelViewer/fieldEntities.ts +63 -0
- package/src/components/ModelViewer/fieldExpansion.spec.ts +116 -0
- package/src/components/ModelViewer/fieldExpansion.ts +95 -0
- package/src/components/ModelViewer/givenUsage.spec.ts +304 -0
- package/src/components/ModelViewer/givenUsage.ts +325 -0
- package/src/components/ModelViewer/headerCard.tsx +102 -0
- package/src/components/ModelViewer/httpStatus.ts +15 -0
- package/src/components/ModelViewer/icons.tsx +67 -0
- package/src/components/ModelViewer/index.ts +26 -0
- package/src/components/ModelViewer/joinAccess.spec.ts +95 -0
- package/src/components/ModelViewer/joinAccess.ts +54 -0
- package/src/components/ModelViewer/malloyRunText.spec.ts +48 -0
- package/src/components/ModelViewer/malloyRunText.ts +51 -0
- package/src/components/ModelViewer/malloyText.spec.ts +47 -0
- package/src/components/ModelViewer/malloyText.ts +77 -0
- package/src/components/ModelViewer/modelGivens.ts +228 -0
- package/src/components/ModelViewer/modelGivensContext.ts +13 -0
- package/src/components/ModelViewer/modelHeaderPresentation.spec.ts +31 -0
- package/src/components/ModelViewer/modelHeaderPresentation.ts +41 -0
- package/src/components/ModelViewer/modelTextDeclarations.spec.ts +336 -0
- package/src/components/ModelViewer/modelTextDeclarations.ts +228 -0
- package/src/components/ModelViewer/modelTextParse.ts +112 -0
- package/src/components/ModelViewer/namedQueryCode.spec.ts +58 -0
- package/src/components/ModelViewer/namedQueryCode.ts +26 -0
- package/src/components/ModelViewer/offSurface.tsx +124 -0
- package/src/components/ModelViewer/rowLayers.tsx +104 -0
- package/src/components/ModelViewer/runGate.spec.ts +219 -0
- package/src/components/ModelViewer/runGate.ts +145 -0
- package/src/components/ModelViewer/schemaModel.defaultSource.spec.ts +126 -0
- package/src/components/ModelViewer/schemaModel.queries.spec.ts +37 -0
- package/src/components/ModelViewer/schemaModel.ts +300 -0
- package/src/components/ModelViewer/sectionOpenCommand.tsx +125 -0
- package/src/components/ModelViewer/sourceAccess.spec.ts +130 -0
- package/src/components/ModelViewer/sourceAccess.ts +194 -0
- package/src/components/ModelViewer/sourceLineage.spec.ts +73 -0
- package/src/components/ModelViewer/sourceLineage.ts +38 -0
- package/src/components/ModelViewer/sourcePicker.spec.ts +294 -0
- package/src/components/ModelViewer/sourcePicker.ts +162 -0
- package/src/components/ModelViewer/surface.ts +51 -0
- package/src/components/ModelViewer/text.tsx +33 -0
- package/src/components/ModelViewer/theme.spec.ts +38 -0
- package/src/components/ModelViewer/theme.ts +58 -0
- package/src/components/ModelViewer/tokens.ts +87 -0
- package/src/components/ModelViewer/ui.tsx +201 -0
- package/src/components/ModelViewer/useDimensionSamples.spec.tsx +139 -0
- package/src/components/ModelViewer/useDimensionSamples.ts +220 -0
- package/src/components/ModelViewer/useModelSources.spec.ts +110 -0
- package/src/components/ModelViewer/useModelSources.ts +238 -0
- package/src/components/ModelViewer/useRunQuery.spec.ts +50 -0
- package/src/components/ModelViewer/useRunQuery.ts +223 -0
- package/src/components/ReportBuilder/emptyStart.spec.ts +8 -0
- package/src/components/ReportBuilder/loadMalloy.ts +8 -1
- package/src/components/ServerProvider.tsx +27 -3
- package/src/components/filter/utils.ts +4 -60
- package/src/components/given/FilterButton.tsx +4 -1
- package/src/components/given/GivenInput.tsx +8 -0
- package/src/components/given/GivensPanel.tsx +6 -1
- package/src/components/given/filterSummary.spec.ts +31 -1
- package/src/components/given/filterSummary.ts +41 -19
- package/src/components/given/useGivenUrlParams.spec.tsx +32 -0
- package/src/components/given/useGivenUrlParams.ts +49 -14
- package/src/components/index.ts +6 -1
- package/src/components/legacy/malloynb/Notebook.spec.tsx +38 -4
- package/src/components/legacy/malloynb/NotebookCell.tsx +8 -2
- package/src/components/modelPage.spec.ts +79 -0
- package/src/components/modelPage.ts +48 -0
- package/src/hooks/useDimensionFilters.ts +3 -58
- package/src/hooks/useDimensionFiltersQuery.ts +3 -58
- package/src/hooks/useDimensionalFilterRangeData.spec.ts +57 -0
- package/src/hooks/useDimensionalFilterRangeData.ts +8 -63
- package/src/hooks/useSuggestOptions.dom.spec.ts +54 -1
- package/src/hooks/useSuggestOptions.spec.ts +71 -0
- package/src/hooks/useSuggestOptions.ts +102 -12
- package/src/utils/filterCondition.spec.ts +87 -0
- package/src/utils/filterCondition.ts +66 -0
- package/src/utils/malloyLiteral.spec.ts +53 -1
- package/src/utils/malloyLiteral.ts +47 -12
- package/dist/ServerProvider-BvD7PYZ7.cjs.js +0 -1
- package/dist/useCompiledDocument-CRhFBKv_.cjs.js +0 -142
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DocumentRange, DocumentSymbol } from '@malloydata/malloy';
|
|
2
|
+
type MalloyModule = typeof import("@malloydata/malloy");
|
|
3
|
+
/**
|
|
4
|
+
* A model file's text with the symbols Malloy's parser finds in it: each
|
|
5
|
+
* source, its fields, views and joins, and the file's named queries, each with
|
|
6
|
+
* the range of text that declares it. Parsing does not compile, so a file
|
|
7
|
+
* mid-edit still yields what the parser could read.
|
|
8
|
+
*/
|
|
9
|
+
export interface ParsedModelText {
|
|
10
|
+
/** The file's lines, CRLF read as LF, which the symbols' ranges index. */
|
|
11
|
+
lines: string[];
|
|
12
|
+
symbols: DocumentSymbol[];
|
|
13
|
+
}
|
|
14
|
+
/** Undefined when the parser throws: the rows then say they have no code. */
|
|
15
|
+
export declare function parseModelText(malloy: MalloyModule, text: string): ParsedModelText | undefined;
|
|
16
|
+
/** The text a range covers. */
|
|
17
|
+
export declare function rangeText(lines: readonly string[], range: DocumentRange): string;
|
|
18
|
+
/**
|
|
19
|
+
* `text` parsed, once the parser has loaded. `pending` while it loads; when
|
|
20
|
+
* `wanted` is false nothing is loaded or parsed. A parser that fails to load
|
|
21
|
+
* leaves `parsed` undefined and `pending` false.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useParsedModelText(text: string | undefined, wanted?: boolean): {
|
|
24
|
+
parsed: ParsedModelText | undefined;
|
|
25
|
+
pending: boolean;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ParsedModelText } from './modelTextParse';
|
|
2
|
+
/**
|
|
3
|
+
* A model-level named query's declaration (`query: name is …`), read from the
|
|
4
|
+
* model file with Malloy's parser. The compiled model lists a query's name and
|
|
5
|
+
* annotations only, never its definition (see ExplorerQuery), so the file is
|
|
6
|
+
* the one place its code exists; this is what a query row's Code shows.
|
|
7
|
+
*
|
|
8
|
+
* Undefined where the file isn't available, doesn't declare the name, or
|
|
9
|
+
* declares it twice: the row's Code then says it has nothing to show, never a
|
|
10
|
+
* guess.
|
|
11
|
+
*/
|
|
12
|
+
export declare function namedQueryCode(parsed: ParsedModelText | undefined, name: string): string | undefined;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A package whose root `index.malloy` decides what it publishes hides every other
|
|
3
|
+
* model file: the models list leaves it out and the model GET answers 404. People
|
|
4
|
+
* who can edit the package still need to read those files, so for them the app asks
|
|
5
|
+
* with `includeHiddenFilesAndSources`, which a host allows only for someone who can edit
|
|
6
|
+
* the package. The same flag rides on their runs of such a file, and Publisher then drops
|
|
7
|
+
* the surface limit for that run, so an editor can query a hidden source too. Anyone else
|
|
8
|
+
* never sends the flag, so for them a hidden file stays a 404.
|
|
9
|
+
*/
|
|
10
|
+
/** The marker on a hidden file, in the package's models list and on its page. */
|
|
11
|
+
export declare const OFF_SURFACE_LABEL = "Private";
|
|
12
|
+
/** What the marker means: its tooltip, wherever it shows. */
|
|
13
|
+
export declare const OFF_SURFACE_DETAIL = "index.malloy doesn't export this file, so only people who can edit the package see it.";
|
|
14
|
+
/** Whether a models-list entry is a file the package hides. Absent (an older server) reads as not hidden. */
|
|
15
|
+
export declare function isHidden(model: {
|
|
16
|
+
isHidden?: boolean;
|
|
17
|
+
}): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The Private marker on a row of the package's models list: not a tab stop, since the row is
|
|
20
|
+
* one link and a control inside it would be a second. Its why is in the tooltip for a pointer,
|
|
21
|
+
* and in the row's accessible name for everyone else ({@link surfaceRowLabel}), as a row's
|
|
22
|
+
* access pills put theirs (AccessChips `accessRowLabel`).
|
|
23
|
+
*/
|
|
24
|
+
export declare function OffSurfacePill(): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* The Private marker on a hidden file's own page (its source's status row, or above the code):
|
|
27
|
+
* a status-row chip like its siblings (HeaderChip), so it is a tab stop whose accessible name
|
|
28
|
+
* is its why, reachable by keyboard and read by a screen reader, not only shown on hover.
|
|
29
|
+
*/
|
|
30
|
+
export declare function OffSurfaceChip(): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
/** The marker on the package's root `index.malloy`: the sources it exports are the package's public ones. */
|
|
32
|
+
export declare const PUBLIC_SURFACE_LABEL = "Public";
|
|
33
|
+
/** What the marker means on the root `index.malloy`'s row in the package's models list. */
|
|
34
|
+
export declare const PUBLIC_FILE_DETAIL = "What index.malloy exports is what the package publishes: everyone who can read the package can query its sources.";
|
|
35
|
+
/** What the marker means in a source's status row on the root `index.malloy`'s page. */
|
|
36
|
+
export declare const PUBLIC_SOURCE_DETAIL = "index.malloy exports this source, so everyone who can read the package can query it.";
|
|
37
|
+
/**
|
|
38
|
+
* The marker on the package's root `index.malloy`'s row in the models list: what it exports is
|
|
39
|
+
* what the package publishes, so it is the model a reader should open first. Green beside the
|
|
40
|
+
* amber Private on the files it leaves out ({@link OffSurfacePill}), so the two read as one
|
|
41
|
+
* public/private pair (the guide's §4 names this pair as the one Declaration that takes a
|
|
42
|
+
* tone), and drawn the same way: not a tab stop, its why in the tooltip and in the row's
|
|
43
|
+
* accessible name ({@link surfaceRowLabel}).
|
|
44
|
+
*/
|
|
45
|
+
export declare function PublicSurfacePill(): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
/**
|
|
47
|
+
* The Public marker in a source's status row on the root `index.malloy`'s page: a status-row
|
|
48
|
+
* chip like its siblings (HeaderChip), a tab stop whose accessible name is its why.
|
|
49
|
+
*/
|
|
50
|
+
export declare function PublicSurfaceChip(): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
/** Which side of the package's surface a models-list row's file is on, when it is marked. */
|
|
52
|
+
export type FileSurface = "public" | "private";
|
|
53
|
+
/** The words a models-list row's accessible name adds for its surface pill (", Private: …"). */
|
|
54
|
+
export declare function surfaceRowLabel(surface: FileSurface | undefined): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The kinds of content an open model row can show. An open row shows ONE card;
|
|
4
|
+
* where it has more than one of these, the switch on its line picks which, in
|
|
5
|
+
* this order.
|
|
6
|
+
*/
|
|
7
|
+
export type RowLayer = "result" | "fields" | "code" | "values" | "givens" | "access";
|
|
8
|
+
/**
|
|
9
|
+
* The layer an open row shows: the one the reader picked while it is available,
|
|
10
|
+
* else `initial` (when available), else the first available. `available` is in
|
|
11
|
+
* any order; it is read in {@link LAYER_ORDER}.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useRowLayer(available: ReadonlyArray<RowLayer>, initial?: RowLayer): {
|
|
14
|
+
layers: RowLayer[];
|
|
15
|
+
layer: RowLayer;
|
|
16
|
+
setLayer: Dispatch<SetStateAction<RowLayer>>;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The switch between an open row's layers, drawn as action icons on its line.
|
|
20
|
+
* Nothing when there is only one layer: a switch with one option has nothing to
|
|
21
|
+
* switch. A layer the row has but cannot show here keeps its place, disabled with
|
|
22
|
+
* its reason (SegmentIcons).
|
|
23
|
+
*/
|
|
24
|
+
export declare function RowLayerSwitch({ layers, value, onChange, "aria-label": ariaLabel, disabledReasons, }: {
|
|
25
|
+
layers: ReadonlyArray<RowLayer>;
|
|
26
|
+
value: RowLayer | undefined;
|
|
27
|
+
onChange: (layer: RowLayer) => void;
|
|
28
|
+
"aria-label": string;
|
|
29
|
+
disabledReasons?: Partial<Record<RowLayer, string>>;
|
|
30
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { GivenInfo, GivenRequest } from './modelGivens';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a run from the explorer can be honest about its inputs.
|
|
4
|
+
*
|
|
5
|
+
* A run sends the given values the reader set in the page's Givens section
|
|
6
|
+
* (the dashboard's own controls). A given the reader left unset falls back
|
|
7
|
+
* to its declared default, and the card names every default it ran at, the
|
|
8
|
+
* way a report's panel shows the values that produced its cells. An unset
|
|
9
|
+
* given with no default, or a `#(filter … required)` on the source (the
|
|
10
|
+
* explorer has no filter controls), cannot run at all, so the card says what
|
|
11
|
+
* is missing instead of showing a bare 400.
|
|
12
|
+
*
|
|
13
|
+
* Each given is named as its control on the page words it, `Ordered since:
|
|
14
|
+
* Jan 1, 2023`, never as a Malloy literal. A given the page can't tie to the
|
|
15
|
+
* source either way (`unknown`) is named apart: the card says it can't tell
|
|
16
|
+
* whether the source reads it, and what the run had for it where it does,
|
|
17
|
+
* rather than calling its default one the run ran at. Values are named whole
|
|
18
|
+
* (`describeGivenValue`), never cut to a button's width: the note is the record
|
|
19
|
+
* of what produced the result.
|
|
20
|
+
*
|
|
21
|
+
* A run held only for givens the page can't tie to the source can run anyway
|
|
22
|
+
* (`canRunAnyway`), at the reader's word: if the source does read one, the run
|
|
23
|
+
* fails, and the card has already said why.
|
|
24
|
+
*/
|
|
25
|
+
export type RunGate = {
|
|
26
|
+
kind: "ok";
|
|
27
|
+
} | {
|
|
28
|
+
kind: "noted";
|
|
29
|
+
note: string;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "blocked";
|
|
32
|
+
reason: string;
|
|
33
|
+
canRunAnyway: boolean;
|
|
34
|
+
};
|
|
35
|
+
/** `A`, `A or B`, `A, B or C`. */
|
|
36
|
+
export declare function wordList(words: readonly string[], conjunction: string): string;
|
|
37
|
+
export declare function runGate(givens: ReadonlyArray<GivenInfo> | undefined, requiredFilters: ReadonlyArray<string> | undefined,
|
|
38
|
+
/** Values the reader set, as a run sends them; an absent entry means "use the
|
|
39
|
+
* default". An empty string is a value, as on a dashboard (for a
|
|
40
|
+
* `filter<…>`, "All"). */
|
|
41
|
+
values?: GivenRequest | undefined,
|
|
42
|
+
/** Names of the givens the page can't tie to the source either way
|
|
43
|
+
* (scanGivensForSource). */
|
|
44
|
+
unknown?: ReadonlySet<string> | undefined,
|
|
45
|
+
/** The reader chose to run without the missing givens the page can't tie
|
|
46
|
+
* to the source; honored only when those are all that holds the run. */
|
|
47
|
+
runAnyway?: boolean,
|
|
48
|
+
/** What the run reads from: its source, or a named query with none. */
|
|
49
|
+
subject?: "source" | "query"): RunGate;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { AccentName } from './tokens';
|
|
2
|
+
import { ModelNamedQuery } from './useModelSources';
|
|
3
|
+
import type * as Malloy from "@malloydata/malloy-interfaces";
|
|
4
|
+
/**
|
|
5
|
+
* Render-ready view model for the model viewer, flattened from the compiled
|
|
6
|
+
* `Malloy.SourceInfo` metadata.
|
|
7
|
+
*
|
|
8
|
+
* SourceInfo doesn't expose everything the design mock shows — table name,
|
|
9
|
+
* grain, primary key, measure expressions, join `on` conditions, and view
|
|
10
|
+
* group-by/aggregate breakdowns aren't in the compiled metadata, so the
|
|
11
|
+
* explorer renders only name / type / docstring / join relationship. If the
|
|
12
|
+
* model API grows those fields, extend these types rather than re-deriving
|
|
13
|
+
* in components.
|
|
14
|
+
*/
|
|
15
|
+
export interface ExplorerField {
|
|
16
|
+
name: string;
|
|
17
|
+
kind: "dimension" | "measure" | "calculate" | "view";
|
|
18
|
+
/** Type with its detail, e.g. "string", "number · integer", "date · month",
|
|
19
|
+
* "array<string>": dimensions, measures and calculations only. */
|
|
20
|
+
dataType?: string;
|
|
21
|
+
/** A record type's fields, one per line, for the type chip's tooltip. */
|
|
22
|
+
typeTip?: string;
|
|
23
|
+
doc?: string;
|
|
24
|
+
/** True when the dimension carries `#(index)` / `#(index_values)` —
|
|
25
|
+
* its values can be fetched from the dimensional index. */
|
|
26
|
+
indexed?: boolean;
|
|
27
|
+
/** True when the measure carries `#@ preaggregate` — it is DECLARED to roll
|
|
28
|
+
* up into a table at some grain. Says nothing about whether one has been
|
|
29
|
+
* built; that is the measure's binding. */
|
|
30
|
+
preaggregate?: boolean;
|
|
31
|
+
/** Author-facing tags from the non-doc annotation lines: a view's renderer
|
|
32
|
+
* tags (`bar_chart`, `size=lg`), a field's display tags (`label="Revenue"`,
|
|
33
|
+
* `currency`, `percent`). */
|
|
34
|
+
tags?: string[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A model-level named query (`query: name is …`). Model-scoped, not a field of
|
|
38
|
+
* any source — so it is listed beside the sources in the rail, not inside one.
|
|
39
|
+
* The compiled metadata carries its name and annotations only (no definition:
|
|
40
|
+
* `modelInfo.entries` never includes queries, and a host's entities have no
|
|
41
|
+
* query kind), so a query is something to RUN rather than something to read.
|
|
42
|
+
*/
|
|
43
|
+
export interface ExplorerQuery {
|
|
44
|
+
name: string;
|
|
45
|
+
/** The source the query runs against, when the publisher reports it — the
|
|
46
|
+
* source whose required filters gate a run. */
|
|
47
|
+
sourceName?: string;
|
|
48
|
+
doc?: string;
|
|
49
|
+
/** Renderer/behavior tags (`bar_chart`, …), from the non-doc annotation lines. */
|
|
50
|
+
tags?: string[];
|
|
51
|
+
}
|
|
52
|
+
export interface ExplorerJoin {
|
|
53
|
+
name: string;
|
|
54
|
+
relationship: Malloy.Relationship;
|
|
55
|
+
doc?: string;
|
|
56
|
+
dimensions: ExplorerField[];
|
|
57
|
+
measures: ExplorerField[];
|
|
58
|
+
}
|
|
59
|
+
export interface ExplorerSource {
|
|
60
|
+
name: string;
|
|
61
|
+
doc?: string;
|
|
62
|
+
/** Each doc annotation, in order, inherited ones first (see `ownSourceDoc`). */
|
|
63
|
+
docParts?: string[];
|
|
64
|
+
accent: AccentName;
|
|
65
|
+
/** The source carries a `#@ persist` tag — served from a materialized
|
|
66
|
+
* table rather than computed live. */
|
|
67
|
+
persist?: boolean;
|
|
68
|
+
dimensions: ExplorerField[];
|
|
69
|
+
measures: ExplorerField[];
|
|
70
|
+
/** `calculate:` fields. */
|
|
71
|
+
calculations: ExplorerField[];
|
|
72
|
+
views: ExplorerField[];
|
|
73
|
+
joins: ExplorerJoin[];
|
|
74
|
+
}
|
|
75
|
+
/** Flatten one compiled source into the explorer view model. */
|
|
76
|
+
export declare function toExplorerSource(source: Malloy.SourceInfo, index: number): ExplorerSource;
|
|
77
|
+
/**
|
|
78
|
+
* Flatten the model's named queries. The publisher's `CompiledModel.queries`
|
|
79
|
+
* carries annotations as raw lines (not `Malloy.Annotation` objects), so they
|
|
80
|
+
* are wrapped to reuse the one doc/tag parser the fields use.
|
|
81
|
+
*/
|
|
82
|
+
export declare function toExplorerQueries(queries: ReadonlyArray<ModelNamedQuery> | undefined): ExplorerQuery[];
|
|
83
|
+
/**
|
|
84
|
+
* The fields a source declares: its dimensions, measures, calculations and views.
|
|
85
|
+
*
|
|
86
|
+
* A join's own fields are NOT counted: the pane header's count has to add
|
|
87
|
+
* up to the group counts printed directly beneath it — Dimensions · N, Measures
|
|
88
|
+
* · N, Views · N — and counting fields reachable THROUGH a join made the header
|
|
89
|
+
* read higher than anything visible, with the difference buried inside a
|
|
90
|
+
* collapsed Joins group. A join is counted as a join, not as its fields.
|
|
91
|
+
*/
|
|
92
|
+
export declare function fieldCount(source: ExplorerSource): number;
|
|
93
|
+
/**
|
|
94
|
+
* Which source a model opens on when the address names none.
|
|
95
|
+
*
|
|
96
|
+
* Declaration order is not a ranking. `flights.malloy` declares `carriers`
|
|
97
|
+
* first and `flights` last; `imdb.malloy` declares `people` first and `movies`
|
|
98
|
+
* last — so `sources[0]` opened both files on a lookup table while the source
|
|
99
|
+
* the file is about sat at the bottom of the rail.
|
|
100
|
+
*
|
|
101
|
+
* The signal is **views**: a source someone has written views over is one
|
|
102
|
+
* someone means to be read, and the analytically-central source is where the
|
|
103
|
+
* views accumulate. Ties break toward the file's namesake (`flights.malloy` →
|
|
104
|
+
* `flights`), then toward declaration order, so the pick is total and stable.
|
|
105
|
+
*
|
|
106
|
+
* Namesake alone would not do it: `imdb.malloy` has no `imdb` source, and its
|
|
107
|
+
* subject is `movies`. Views get both files right.
|
|
108
|
+
*/
|
|
109
|
+
export declare function pickDefaultSource(sources: ExplorerSource[], modelPath?: string): ExplorerSource | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Context } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A section's last "Expand" / "Collapse": every row in the section opens or
|
|
4
|
+
* shuts when `n` changes, then each is the reader's own again. Undefined until
|
|
5
|
+
* the reader asks, so a row starts shut.
|
|
6
|
+
*/
|
|
7
|
+
export interface SectionOpenCommand {
|
|
8
|
+
open: boolean;
|
|
9
|
+
n: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const SectionOpenCommandContext: Context<SectionOpenCommand>;
|
|
12
|
+
/**
|
|
13
|
+
* A row's open state, following its section's Expand / Collapse each time it is
|
|
14
|
+
* asked and the reader's own toggle in between.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useSectionOpen(): [
|
|
17
|
+
boolean,
|
|
18
|
+
(update: (open: boolean) => boolean) => void
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* The Expand / Collapse control for a section: the chevron saying which way it goes, and
|
|
22
|
+
* an accessible name saying what it opens, its visible words first and then the rows they
|
|
23
|
+
* act on ("Expand all measures"), or why it can't. It changes what the section shows rather
|
|
24
|
+
* than acting on the page, so it is a quiet text link alone on the line under the section's
|
|
25
|
+
* title, in the caption voice, so it reads as part of the section's header.
|
|
26
|
+
*/
|
|
27
|
+
export declare function SectionExpandButton({ allOpen, onToggle, noun, disabledReason, }: {
|
|
28
|
+
allOpen: boolean;
|
|
29
|
+
onToggle: () => void;
|
|
30
|
+
noun: readonly [string, string];
|
|
31
|
+
disabledReason?: string;
|
|
32
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* A section's Expand / Collapse and the command it sends its rows. Always in
|
|
35
|
+
* place on a page section, so the header never moves; disabled, with why, where
|
|
36
|
+
* no row has anything to open.
|
|
37
|
+
*/
|
|
38
|
+
export declare function useSectionExpand({ noun, disabledReason, }: {
|
|
39
|
+
noun: readonly [string, string];
|
|
40
|
+
/** Set when no row in the section can open. */
|
|
41
|
+
disabledReason?: string;
|
|
42
|
+
}): {
|
|
43
|
+
command: SectionOpenCommand;
|
|
44
|
+
action: import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a source's access declarations say, read from the compiled model's
|
|
3
|
+
* `sources[]` (the publisher's `Source.authorize` and `Source.accessFilter`).
|
|
4
|
+
*
|
|
5
|
+
* Both lists are the RULE, never a verdict about the reader: the publisher is
|
|
6
|
+
* the only authority on whether a caller passes, and its docs forbid
|
|
7
|
+
* re-deriving that from these strings. So everything here answers "is this
|
|
8
|
+
* source restricted / row filtered, and what does the rule say", and nothing
|
|
9
|
+
* answers "can you query it".
|
|
10
|
+
*/
|
|
11
|
+
export interface SourceAccess {
|
|
12
|
+
/** Effective `#(authorize)` expressions (own and inherited), AND-ed. */
|
|
13
|
+
authorize: string[];
|
|
14
|
+
/** Effective `#(access_filter)` expressions, AND-ed. */
|
|
15
|
+
accessFilter: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Source name → its access declarations, for every source the compiled model
|
|
19
|
+
* lists. Shape-checked: through the router an older publisher sends neither
|
|
20
|
+
* field (or `null`), which reads as no declaration.
|
|
21
|
+
*/
|
|
22
|
+
export declare function extractSourceAccess(body: unknown): Map<string, SourceAccess>;
|
|
23
|
+
/** The declarations of one source, or none. */
|
|
24
|
+
export declare function accessOf(bySource: ReadonlyMap<string, SourceAccess> | undefined, sourceName: string | undefined): SourceAccess;
|
|
25
|
+
/**
|
|
26
|
+
* Whether an `#(authorize)` rule locks the source. Read element-wise, as the
|
|
27
|
+
* publisher documents: the list is unlocked only when every element is the
|
|
28
|
+
* `"true"` sentinel (gates from different declaring sources AND together, so
|
|
29
|
+
* `["true", "'finance' in $GROUPS"]` is locked).
|
|
30
|
+
*/
|
|
31
|
+
export declare function isRestricted(access: SourceAccess | undefined): boolean;
|
|
32
|
+
/** Whether an `#(access_filter)` scopes the source's rows per reader. */
|
|
33
|
+
export declare function isRowFiltered(access: SourceAccess | undefined): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Who the `#(authorize)` rule admits, in plain words: "members of finance".
|
|
36
|
+
* Several rules all apply, so they are joined with "and"; a rule this cannot
|
|
37
|
+
* say becomes "readers its access rule admits" rather than a guess.
|
|
38
|
+
*/
|
|
39
|
+
export declare function restrictedToWords(access: SourceAccess): string;
|
|
40
|
+
/** What a Restricted chip's tooltip and accessible name say. */
|
|
41
|
+
export declare const RESTRICTED_MEANING = "Only some readers can query this source";
|
|
42
|
+
/** What a Row filtered chip's tooltip and accessible name say. */
|
|
43
|
+
export declare const ROW_FILTERED_MEANING = "Each reader sees only the rows they're allowed to see";
|
|
44
|
+
/**
|
|
45
|
+
* What a refused (403) run says: that the reader can't access the source, a
|
|
46
|
+
* restricted source's rule in words, and the way out — never a status code, and
|
|
47
|
+
* no Retry, since a second attempt meets the same rule. A 403 on a source with no
|
|
48
|
+
* rule this page knows (a package-level refusal, a rule the compiled model did
|
|
49
|
+
* not report) still says so in the same words.
|
|
50
|
+
*/
|
|
51
|
+
export declare function refusalMessage(sourceName: string | undefined, access: SourceAccess): string;
|
|
52
|
+
/**
|
|
53
|
+
* The caption under an empty result on a row-filtered source: an access filter
|
|
54
|
+
* that admits none of a reader's rows answers 200 with zero rows, which reads as
|
|
55
|
+
* "there is no data" unless the page says why. Only for zero rows: an ungrouped
|
|
56
|
+
* aggregate over nothing returns one row (`count()` = 0), which the caption
|
|
57
|
+
* cannot tell from a real zero, so it says nothing there.
|
|
58
|
+
*/
|
|
59
|
+
export declare function filteredEmptyCaption(access: SourceAccess, result: string | undefined): string | undefined;
|
|
60
|
+
/** Whether the source declares either rule, so there is something to show. */
|
|
61
|
+
export declare function hasAccessRules(access: SourceAccess | undefined): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* What an editor is told on an open join to a gated source: a gate applies only
|
|
64
|
+
* on the source a query enters through, so through this join the joined
|
|
65
|
+
* source's rows are read under this source's rules, not its own.
|
|
66
|
+
*/
|
|
67
|
+
export declare function joinGateWarning(sourceName: string, access: SourceAccess): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The immediate upstream SOURCE a derived source is built from, parsed from the
|
|
3
|
+
* model's own Malloy text — e.g. `raw_orders` for
|
|
4
|
+
* `source: order_rollup is raw_orders -> { … }`.
|
|
5
|
+
*
|
|
6
|
+
* Only a source-to-source derivation resolves. A table-backed source
|
|
7
|
+
* (`is conn.table('…')`, `is conn.sql('…')`) returns undefined — it has
|
|
8
|
+
* physical table provenance the header shows instead — and the parsed base
|
|
9
|
+
* must be one of the model's own sources, so a connection name or SQL slice is
|
|
10
|
+
* never mistaken for lineage. This is a best-effort read of source text: when
|
|
11
|
+
* the text is absent, or the declaration takes a form this doesn't recognise,
|
|
12
|
+
* it yields undefined and the header simply shows no `from`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function baseSourceName(sourceText: string | undefined, sourceName: string | undefined, knownSources: ReadonlySet<string>): string | undefined;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ExplorerSource } from './schemaModel';
|
|
2
|
+
/**
|
|
3
|
+
* The row's meta line: "16 views · 37 fields · 4 joins". The field count is the one the
|
|
4
|
+
* source's own header prints once it is picked (`fieldCount`), so the picker and the page it
|
|
5
|
+
* opens never disagree; joins are left out when there are none.
|
|
6
|
+
*/
|
|
7
|
+
export declare function sourceMetaLine(source: ExplorerSource): string;
|
|
8
|
+
/** The picker's sources in the order it lists them, and the one its token marks. */
|
|
9
|
+
export interface PickerOrder {
|
|
10
|
+
sources: ExplorerSource[];
|
|
11
|
+
/** True on the package's root `index.malloy`, on the surface: its sources are the curated
|
|
12
|
+
* set, and the pill counts them as public. */
|
|
13
|
+
curated: boolean;
|
|
14
|
+
/** The curated sources are listed as the file's `export { … }` orders them, so the picker's
|
|
15
|
+
* header may say so. False when the file's text, and so its order, is unknown. */
|
|
16
|
+
exportOrdered: boolean;
|
|
17
|
+
/** The source the model opens on, when it really has the most views — the "Most views"
|
|
18
|
+
* token. Never set when the claim would be false. */
|
|
19
|
+
mostViews?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The order the picker lists a model's sources in.
|
|
23
|
+
*
|
|
24
|
+
* - On the package's root `index.malloy`, when it is on the surface (`publicSurface`), the file
|
|
25
|
+
* IS the author's choice of what to publish, so its sources keep the order it exports them
|
|
26
|
+
* in, when its text says (`inExportOrder`); else the compiled model's, and `exportOrdered`
|
|
27
|
+
* is false so nothing claims an order.
|
|
28
|
+
* - On any other model, declaration order is not a ranking (`pickDefaultSource`), so the
|
|
29
|
+
* source the model opens on comes first and the rest follow by view count, most first;
|
|
30
|
+
* equal counts keep declaration order. A lookup table with no views sinks to the end.
|
|
31
|
+
*
|
|
32
|
+
* `mostViews` names the default only when no other source has more views than it and it has
|
|
33
|
+
* any: `pickDefaultSource` sets aside a source that extends another, so the default can be
|
|
34
|
+
* the base with fewer views than its extension, and the token must not claim otherwise.
|
|
35
|
+
*/
|
|
36
|
+
export declare function orderPickerSources(sources: readonly ExplorerSource[], defaultSource: ExplorerSource | null,
|
|
37
|
+
/** Set on the root `index.malloy` on the surface: the names its `export { … }` lists, in
|
|
38
|
+
* order (`exportOrder`), empty when its text is unknown. */
|
|
39
|
+
publicSurface?: {
|
|
40
|
+
exportOrder: readonly string[];
|
|
41
|
+
}): PickerOrder;
|
|
42
|
+
/**
|
|
43
|
+
* The names a model file's `export { … }` statements list, in the order written. The compiled
|
|
44
|
+
* model lists its exports in declaration order (an imported source where the import brings it
|
|
45
|
+
* in), which is not the order an `index.malloy`'s author chose, so the text is read for it.
|
|
46
|
+
* Each item is a bare identifier (Malloy's `exportItem`), backquoted or not; the keyword is
|
|
47
|
+
* matched without case, as Malloy's are, and comments are skipped. Empty when the text is
|
|
48
|
+
* unknown or has no export statement.
|
|
49
|
+
*/
|
|
50
|
+
export declare function exportOrder(sourceText: string | undefined): string[];
|
|
51
|
+
/**
|
|
52
|
+
* `items` in the order `order` names them; anything it does not name keeps its place after
|
|
53
|
+
* them, in the order given. Unchanged when `order` is empty.
|
|
54
|
+
*/
|
|
55
|
+
export declare function inExportOrder<T>(items: readonly T[], nameOf: (item: T) => string, order: readonly string[]): T[];
|
|
56
|
+
/** A row's description: the author's words, else a host's generated one, marked. */
|
|
57
|
+
export interface PickerDescription {
|
|
58
|
+
text: string;
|
|
59
|
+
/** From the host, not the model's author: the row marks it Generated. */
|
|
60
|
+
generated: boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The row's description: the source's own `#(doc)` when it has one — the author's words win —
|
|
64
|
+
* else a host's summary (`describePickerSource`), marked as generated. Nothing when neither.
|
|
65
|
+
*/
|
|
66
|
+
export declare function pickerDescription(doc: string | undefined, summary: string | undefined): PickerDescription | undefined;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** The model viewer's page column and pane geometry. */
|
|
2
|
+
/** The page's reading column. */
|
|
3
|
+
export declare const CONTENT_COLUMN_SX: {
|
|
4
|
+
readonly width: "100%";
|
|
5
|
+
readonly maxWidth: "1200px";
|
|
6
|
+
readonly mx: "auto";
|
|
7
|
+
};
|
|
8
|
+
/** The gap between a page's header and its first line (theme spacing units). */
|
|
9
|
+
export declare const FILE_VIEW_TOP_GAP = 3;
|
|
10
|
+
/** A card's inner inset (theme spacing units). */
|
|
11
|
+
export declare const PANE_INSET = 1.5;
|
|
12
|
+
/**
|
|
13
|
+
* A read-only card: bordered, rounded, on the paper colour. Text's I-beam
|
|
14
|
+
* cursor advertises an edit these cards don't offer, so the default cursor is
|
|
15
|
+
* set once; anything interactive declares `pointer`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const PANE_CARD_SX: {
|
|
18
|
+
readonly display: "flex";
|
|
19
|
+
readonly flexDirection: "column";
|
|
20
|
+
readonly minWidth: 0;
|
|
21
|
+
readonly minHeight: 0;
|
|
22
|
+
readonly border: "1px solid";
|
|
23
|
+
readonly borderColor: "divider";
|
|
24
|
+
readonly borderRadius: 2;
|
|
25
|
+
readonly bgcolor: "background.paper";
|
|
26
|
+
readonly overflow: "hidden";
|
|
27
|
+
readonly cursor: "default";
|
|
28
|
+
};
|
|
29
|
+
/** The same pane with no card around it: the page's own surface. */
|
|
30
|
+
export declare const FLAT_PANE_SX: {
|
|
31
|
+
readonly border: "none";
|
|
32
|
+
readonly borderRadius: 0;
|
|
33
|
+
readonly bgcolor: "transparent";
|
|
34
|
+
readonly overflow: "visible";
|
|
35
|
+
readonly display: "flex";
|
|
36
|
+
readonly flexDirection: "column";
|
|
37
|
+
readonly minWidth: 0;
|
|
38
|
+
readonly minHeight: 0;
|
|
39
|
+
readonly borderColor: "divider";
|
|
40
|
+
readonly cursor: "default";
|
|
41
|
+
};
|
|
42
|
+
/** A pane's body, under its header. */
|
|
43
|
+
export declare const PANE_BODY_SX: {
|
|
44
|
+
readonly flex: 1;
|
|
45
|
+
readonly minHeight: 0;
|
|
46
|
+
readonly py: 1;
|
|
47
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TypographyProps } from '@mui/material';
|
|
2
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
3
|
+
/** Secondary body text: a row's explanation, an empty state's line. */
|
|
4
|
+
export declare const BodyText: ForwardRefExoticComponent<Omit<TypographyProps, "ref"> & RefAttributes<HTMLSpanElement>>;
|
|
5
|
+
/** Caption text: a note under a result, a meta line. */
|
|
6
|
+
export declare const CaptionText: ForwardRefExoticComponent<Omit<TypographyProps, "ref"> & RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The model viewer's type steps and colour roles, in one place so the rows,
|
|
3
|
+
* pills and cards are set from the same few values. Built on the SDK palette.
|
|
4
|
+
*
|
|
5
|
+
* Every neutral is one of MUI's own palette keys (`text.*`, `action.*`), which
|
|
6
|
+
* every theme defines in both modes, never a hex or a key only some hosts add:
|
|
7
|
+
* a fixed light grey was a near-white pill under light text in a dark theme.
|
|
8
|
+
* So each role is for an `sx` colour prop, where MUI resolves it.
|
|
9
|
+
*/
|
|
10
|
+
/** The custom property the viewer's root sets from the host's `ui.font.mono`. */
|
|
11
|
+
export declare const MONO_FONT_VAR = "--model-viewer-mono";
|
|
12
|
+
/** The viewer's code face: the host theme's mono face, set on the viewer's root. */
|
|
13
|
+
export declare const MONO_FONT_FAMILY = "var(--model-viewer-mono, \"JetBrains Mono\", \"ui-monospace\", \"SFMono-Regular\", \"Menlo\", monospace)";
|
|
14
|
+
export declare const SANS_FONT_FAMILY = "inherit";
|
|
15
|
+
export declare const fontSizes: {
|
|
16
|
+
/** 11px: the floor, for a pill's text. */
|
|
17
|
+
readonly micro: "0.6875rem";
|
|
18
|
+
/** 12px: secondary row detail. */
|
|
19
|
+
readonly caption: "0.75rem";
|
|
20
|
+
/** 13px: dense rows. */
|
|
21
|
+
readonly small: "0.8125rem";
|
|
22
|
+
/** 14px: body. */
|
|
23
|
+
readonly body: "0.875rem";
|
|
24
|
+
/** 16px: prose meant to be read at length. */
|
|
25
|
+
readonly bodyLarge: "1rem";
|
|
26
|
+
};
|
|
27
|
+
export declare const fontWeights: {
|
|
28
|
+
readonly regular: 400;
|
|
29
|
+
readonly medium: 500;
|
|
30
|
+
readonly strong: 500;
|
|
31
|
+
};
|
|
32
|
+
export declare const roles: {
|
|
33
|
+
readonly text: {
|
|
34
|
+
readonly primary: "text.primary";
|
|
35
|
+
readonly secondary: "text.secondary";
|
|
36
|
+
readonly tertiary: "text.disabled";
|
|
37
|
+
};
|
|
38
|
+
/** A row's hover and a quiet pill's fill, then one step up: a selected row, a pill on a hovered row. */
|
|
39
|
+
readonly background: {
|
|
40
|
+
readonly muted: "action.hover";
|
|
41
|
+
readonly strong: "action.selected";
|
|
42
|
+
};
|
|
43
|
+
readonly accent: {
|
|
44
|
+
readonly sage: {
|
|
45
|
+
tint: string;
|
|
46
|
+
onTint: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
readonly warning: {
|
|
50
|
+
tint: string;
|
|
51
|
+
onTint: string;
|
|
52
|
+
};
|
|
53
|
+
readonly error: {
|
|
54
|
+
tint: string;
|
|
55
|
+
onTint: string;
|
|
56
|
+
};
|
|
57
|
+
readonly info: {
|
|
58
|
+
tint: string;
|
|
59
|
+
onTint: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
/** Tertiary text: lighter than MUI's `text.secondary`, for a row's least words. */
|
|
63
|
+
export declare const TEXT_TERTIARY: "text.disabled";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design tokens for the model viewer: its accents and its type scale, drawn
|
|
3
|
+
* from the SDK's palette so the viewer reads as part of the same Console.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ink = "text.primary";
|
|
6
|
+
export type AccentName = "steel" | "sage" | "brown" | "olive" | "amber";
|
|
7
|
+
/** An accent hue: `main` for a fill or glyph, `tint` behind it, `onTint` on top of `tint`. */
|
|
8
|
+
export interface Accent {
|
|
9
|
+
main: string;
|
|
10
|
+
tint: string;
|
|
11
|
+
onTint: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const ACCENT: Record<AccentName, Accent>;
|
|
14
|
+
/**
|
|
15
|
+
* Accent per field kind: steel = dimensions, sage = measures, amber =
|
|
16
|
+
* calculations, olive = views. Joins render brown (see SchemaJoin).
|
|
17
|
+
*/
|
|
18
|
+
export declare function kindAccent(kind: "dimension" | "measure" | "calculate" | "view"): Accent;
|
|
19
|
+
export declare function sourceAccentName(index: number): AccentName;
|
|
20
|
+
/** The type scale the rows are set in. */
|
|
21
|
+
export declare const FONT_SIZE: {
|
|
22
|
+
readonly body: 14;
|
|
23
|
+
readonly small: 13;
|
|
24
|
+
readonly caption: 12;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The identifier style for a CONTAINER row (a join): a thing you open to find
|
|
28
|
+
* more things. Mono, because it exists verbatim in a .malloy file. One step
|
|
29
|
+
* above the leaf rows it holds ({@link ENTITY_NAME_SX}).
|
|
30
|
+
*/
|
|
31
|
+
export declare const CONTAINER_NAME_SX: {
|
|
32
|
+
readonly fontFamily: "var(--model-viewer-mono, \"JetBrains Mono\", \"ui-monospace\", \"SFMono-Regular\", \"Menlo\", monospace)";
|
|
33
|
+
readonly fontSize: 14;
|
|
34
|
+
readonly fontWeight: 500;
|
|
35
|
+
readonly color: "text.primary";
|
|
36
|
+
};
|
|
37
|
+
/** The identifier style for a LEAF row (a field): the thing you came to read. */
|
|
38
|
+
export declare const ENTITY_NAME_SX: {
|
|
39
|
+
readonly fontFamily: "var(--model-viewer-mono, \"JetBrains Mono\", \"ui-monospace\", \"SFMono-Regular\", \"Menlo\", monospace)";
|
|
40
|
+
readonly fontSize: 13;
|
|
41
|
+
readonly fontWeight: 500;
|
|
42
|
+
readonly color: "text.primary";
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The secondary voice beside a row's name: a type annotation (`string`,
|
|
46
|
+
* `number`) or a dimmed count. Sans on purpose: it describes the row, it isn't
|
|
47
|
+
* a token you would type.
|
|
48
|
+
*/
|
|
49
|
+
export declare const ROW_META_SX: {
|
|
50
|
+
readonly fontSize: 12;
|
|
51
|
+
readonly color: "text.secondary";
|
|
52
|
+
};
|