@malloy-publisher/sdk 0.2.7 → 0.3.1
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 +180 -204
- package/dist/DocumentStorageProvider-BeBD0uWc.cjs.js +134 -0
- package/dist/DocumentStorageProvider-tGvodI8f.es.js +24268 -0
- package/dist/RenderedResult-CPi6uQWq.cjs.js +115 -0
- package/dist/RenderedResult-mDE-4u8S.es.js +542 -0
- package/dist/{ServerProvider-xXW1HJOJ.cjs.js → ServerProvider-CH71GsoL.cjs.js} +1 -1
- package/dist/{ServerProvider-ksC5Su_x.es.js → ServerProvider-X2Ma0HRs.es.js} +324 -359
- package/dist/builder/index.cjs.js +105 -0
- package/dist/builder/index.d.ts +2 -0
- package/dist/builder/index.es.js +9561 -0
- package/dist/builder-entry.d.ts +8 -0
- package/dist/client/api.d.ts +13 -1
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/ApiErrorDisplay.d.ts +1 -2
- package/dist/components/Dashboard/Dashboard.d.ts +23 -16
- package/dist/components/Dashboard/DashboardGrid.d.ts +67 -0
- package/dist/components/Dashboard/DashboardTile.d.ts +6 -1
- package/dist/components/Dashboard/ExploreDialog.d.ts +18 -0
- package/dist/components/Dashboard/RowsDialog.d.ts +47 -0
- package/dist/components/Dashboard/TileCard.d.ts +44 -0
- package/dist/components/Dashboard/index.d.ts +2 -0
- package/dist/components/Dashboard/promoteMeasureRow.d.ts +40 -0
- package/dist/components/Dashboard/telemetry.d.ts +43 -0
- package/dist/components/DashboardBuilder/AddTileDialog.d.ts +35 -0
- package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +29 -0
- package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +112 -0
- package/dist/components/DashboardBuilder/DashboardEditor.d.ts +32 -0
- package/dist/components/DashboardBuilder/DiffDialog.d.ts +15 -0
- package/dist/components/DashboardBuilder/DrillDialog.d.ts +15 -0
- package/dist/components/DashboardBuilder/FilterDialog.d.ts +54 -0
- package/dist/components/DashboardBuilder/FilterStrip.d.ts +17 -0
- package/dist/components/DashboardBuilder/SettingsPopover.d.ts +20 -0
- package/dist/components/DashboardBuilder/TileFrame.d.ts +42 -0
- package/dist/components/DashboardBuilder/TileMenu.d.ts +24 -0
- package/dist/components/DashboardBuilder/catalog.d.ts +62 -0
- package/dist/components/DashboardBuilder/controls.d.ts +157 -0
- package/dist/components/DashboardBuilder/diff.d.ts +35 -0
- package/dist/components/DashboardBuilder/document.d.ts +218 -0
- package/dist/components/DashboardBuilder/layout.d.ts +71 -0
- package/dist/components/DashboardBuilder/malloyText.d.ts +45 -0
- package/dist/components/DashboardBuilder/preview.d.ts +60 -0
- package/dist/components/DashboardBuilder/readDocument.d.ts +106 -0
- package/dist/components/DashboardBuilder/sortable.d.ts +51 -0
- package/dist/components/DashboardBuilder/spliceDocument.d.ts +44 -0
- package/dist/components/DashboardBuilder/testing/fixtures.d.ts +10 -0
- package/dist/components/DashboardBuilder/useBuilderShortcuts.d.ts +22 -0
- package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +63 -0
- package/dist/components/DashboardBuilder/useDraft.d.ts +13 -0
- package/dist/components/DashboardBuilder/useFilterForm.d.ts +65 -0
- package/dist/components/DashboardBuilder/useTileReorder.d.ts +22 -0
- package/dist/components/DashboardBuilder/useTileResize.d.ts +29 -0
- package/dist/components/DocumentStorage/BrowserDocumentStorage.d.ts +14 -0
- package/dist/components/DocumentStorage/DocumentStorage.d.ts +58 -0
- package/dist/components/DocumentStorage/DocumentStorageProvider.d.ts +25 -0
- package/dist/components/DocumentStorage/index.d.ts +3 -0
- package/dist/components/FloatingIconButton.d.ts +16 -0
- package/dist/components/Model/index.d.ts +0 -1
- package/dist/components/Prose.d.ts +46 -0
- package/dist/components/RenderedResult/RenderedResult.d.ts +12 -0
- package/dist/components/RenderedResult/ResultContainer.d.ts +7 -1
- package/dist/components/RenderedResult/ResultPanel.d.ts +30 -0
- package/dist/components/RenderedResult/index.d.ts +2 -0
- package/dist/components/RenderedResult/resultSizing.d.ts +183 -0
- package/dist/components/drill/index.d.ts +2 -1
- package/dist/components/drill/resolveDrill.d.ts +22 -0
- package/dist/components/drill/useDrill.d.ts +11 -2
- package/dist/components/drill/useDrillSelf.d.ts +46 -0
- package/dist/components/given/filterValue.d.ts +63 -0
- package/dist/components/given/index.d.ts +1 -0
- package/dist/components/given/useGivenUrlParams.d.ts +39 -0
- package/dist/components/index.d.ts +3 -3
- package/dist/components/styles.d.ts +3 -7
- package/dist/core-8NVBCLZh.cjs.js +148 -0
- package/dist/{core-BY7vB5gN.es.js → core-B8oMW4sm.es.js} +3540 -2335
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/useDocumentControls.d.ts +70 -0
- package/dist/hooks/useQueryResult.d.ts +40 -0
- package/dist/hooks/useSuggestOptions.d.ts +28 -12
- package/dist/index.cjs.js +34 -1
- package/dist/index.es.js +21487 -79
- package/dist/sdk.css +1 -1
- package/dist/styles.css +0 -1
- package/dist/utils/malloyLiteral.d.ts +11 -0
- package/package.json +25 -14
- package/src/builder-entry.ts +55 -0
- package/src/components/ApiErrorDisplay.tsx +1 -1
- package/src/components/Connections/EditConnectionDialog.tsx +96 -86
- package/src/components/Dashboard/Dashboard.spec.tsx +7 -10
- package/src/components/Dashboard/Dashboard.tsx +184 -229
- package/src/components/Dashboard/DashboardGrid.tsx +124 -0
- package/src/components/Dashboard/DashboardTile.spec.tsx +30 -6
- package/src/components/Dashboard/DashboardTile.tsx +67 -101
- package/src/components/Dashboard/ExploreDialog.tsx +84 -0
- package/src/components/Dashboard/RowsDialog.spec.ts +42 -0
- package/src/components/Dashboard/RowsDialog.tsx +234 -0
- package/src/components/Dashboard/TileCard.tsx +120 -0
- package/src/components/Dashboard/index.ts +2 -0
- package/src/components/Dashboard/promoteMeasureRow.spec.ts +207 -0
- package/src/components/Dashboard/promoteMeasureRow.ts +160 -0
- package/src/components/Dashboard/telemetry.ts +44 -0
- package/src/components/Dashboard/tileGridColumn.spec.ts +1 -1
- package/src/components/DashboardBuilder/AddTileDialog.tsx +249 -0
- package/src/components/DashboardBuilder/BuilderToolbar.tsx +270 -0
- package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +858 -0
- package/src/components/DashboardBuilder/DashboardBuilder.tsx +653 -0
- package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +211 -0
- package/src/components/DashboardBuilder/DashboardEditor.tsx +493 -0
- package/src/components/DashboardBuilder/DiffDialog.tsx +129 -0
- package/src/components/DashboardBuilder/DrillDialog.tsx +281 -0
- package/src/components/DashboardBuilder/FilterDialog.tsx +581 -0
- package/src/components/DashboardBuilder/FilterStrip.tsx +125 -0
- package/src/components/DashboardBuilder/SettingsPopover.tsx +168 -0
- package/src/components/DashboardBuilder/TileFrame.tsx +380 -0
- package/src/components/DashboardBuilder/TileMenu.tsx +188 -0
- package/src/components/DashboardBuilder/catalog.spec.ts +215 -0
- package/src/components/DashboardBuilder/catalog.ts +225 -0
- package/src/components/DashboardBuilder/controls.spec.ts +243 -0
- package/src/components/DashboardBuilder/controls.ts +398 -0
- package/src/components/DashboardBuilder/diff.spec.ts +44 -0
- package/src/components/DashboardBuilder/diff.ts +93 -0
- package/src/components/DashboardBuilder/document.ts +209 -0
- package/src/components/DashboardBuilder/keepRowStructure.spec.ts +84 -0
- package/src/components/DashboardBuilder/layout.ts +143 -0
- package/src/components/DashboardBuilder/malloyText.spec.ts +84 -0
- package/src/components/DashboardBuilder/malloyText.ts +151 -0
- package/src/components/DashboardBuilder/moveIntoGap.spec.ts +90 -0
- package/src/components/DashboardBuilder/preview.spec.ts +149 -0
- package/src/components/DashboardBuilder/preview.ts +172 -0
- package/src/components/DashboardBuilder/readDocument.spec.ts +375 -0
- package/src/components/DashboardBuilder/readDocument.ts +467 -0
- package/src/components/DashboardBuilder/sortable.tsx +151 -0
- package/src/components/DashboardBuilder/spliceDocument.spec.ts +1108 -0
- package/src/components/DashboardBuilder/spliceDocument.ts +1098 -0
- package/src/components/DashboardBuilder/testing/fixtures.ts +48 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.ts +88 -0
- package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +255 -0
- package/src/components/DashboardBuilder/useDashboardEditor.ts +193 -0
- package/src/components/DashboardBuilder/useDraft.ts +43 -0
- package/src/components/DashboardBuilder/useFilterForm.spec.tsx +144 -0
- package/src/components/DashboardBuilder/useFilterForm.ts +352 -0
- package/src/components/DashboardBuilder/useTileReorder.spec.tsx +97 -0
- package/src/components/DashboardBuilder/useTileReorder.ts +115 -0
- package/src/components/DashboardBuilder/useTileResize.spec.tsx +121 -0
- package/src/components/DashboardBuilder/useTileResize.ts +110 -0
- package/src/components/DashboardBuilder/withGaps.spec.ts +96 -0
- package/src/components/DocumentStorage/BrowserDocumentStorage.spec.ts +81 -0
- package/src/components/DocumentStorage/BrowserDocumentStorage.ts +105 -0
- package/src/components/DocumentStorage/DocumentStorage.ts +73 -0
- package/src/components/DocumentStorage/DocumentStorageProvider.tsx +58 -0
- package/src/components/DocumentStorage/index.ts +16 -0
- package/src/components/Environment/About.tsx +4 -36
- package/src/components/FloatingIconButton.tsx +41 -0
- package/src/components/Model/Model.tsx +6 -23
- package/src/components/Model/ModelCell.tsx +34 -72
- package/src/components/Model/index.ts +0 -1
- package/src/components/Notebook/Notebook.tsx +27 -156
- package/src/components/Notebook/NotebookCell.tsx +37 -191
- package/src/components/Prose.spec.tsx +85 -0
- package/src/components/Prose.tsx +179 -0
- package/src/components/QueryResult/QueryResult.tsx +15 -43
- package/src/components/RenderedResult/RenderedResult.tsx +86 -76
- package/src/components/RenderedResult/ResultContainer.tsx +25 -36
- package/src/components/RenderedResult/ResultPanel.spec.tsx +49 -0
- package/src/components/RenderedResult/ResultPanel.tsx +73 -0
- package/src/components/RenderedResult/index.ts +16 -0
- package/src/components/RenderedResult/resultSizing.spec.ts +249 -0
- package/src/components/RenderedResult/resultSizing.ts +308 -0
- package/src/components/ResultsDialog.tsx +2 -1
- package/src/components/drill/index.ts +6 -0
- package/src/components/drill/resolveDrill.ts +22 -1
- package/src/components/drill/useDrill.spec.tsx +94 -0
- package/src/components/drill/useDrill.tsx +52 -12
- package/src/components/drill/useDrillSelf.spec.tsx +64 -0
- package/src/components/drill/useDrillSelf.ts +110 -0
- package/src/components/given/GivenInput.spec.tsx +196 -2
- package/src/components/given/GivenInput.tsx +300 -25
- package/src/components/given/GivensPanel.tsx +1 -1
- package/src/components/given/filterValue.spec.ts +112 -0
- package/src/components/given/filterValue.ts +188 -0
- package/src/components/given/index.ts +4 -0
- package/src/components/given/useGivenUrlParams.spec.tsx +74 -0
- package/src/components/given/useGivenUrlParams.ts +87 -0
- package/src/components/index.ts +11 -3
- package/src/components/styles.ts +0 -37
- package/src/hooks/index.ts +13 -1
- package/src/hooks/useDocumentControls.ts +170 -0
- package/src/hooks/useGivensState.spec.ts +158 -0
- package/src/hooks/useGivensState.ts +114 -23
- package/src/hooks/useQueryResult.ts +82 -0
- package/src/hooks/useSuggestOptions.dom.spec.ts +60 -1
- package/src/hooks/useSuggestOptions.ts +94 -51
- package/src/utils/malloyLiteral.spec.ts +43 -0
- package/src/utils/malloyLiteral.ts +76 -0
- package/vite.config.ts +5 -1
- package/dist/components/AnalyzePackageButton.d.ts +0 -6
- package/dist/components/Workbook/BrowserWorkbookStorage.d.ts +0 -9
- package/dist/components/Workbook/EditableMalloyCell.d.ts +0 -11
- package/dist/components/Workbook/ModelPicker.d.ts +0 -11
- package/dist/components/Workbook/MutableCell.d.ts +0 -17
- package/dist/components/Workbook/Workbook.d.ts +0 -7
- package/dist/components/Workbook/WorkbookList.d.ts +0 -7
- package/dist/components/Workbook/WorkbookManager.d.ts +0 -84
- package/dist/components/Workbook/WorkbookStorage.d.ts +0 -17
- package/dist/components/Workbook/WorkbookStorageProvider.d.ts +0 -12
- package/dist/components/Workbook/index.d.ts +0 -7
- package/dist/core-CWKmWEg2.cjs.js +0 -148
- package/dist/index-B0WyZAUA.es.js +0 -66412
- package/dist/index-kxVD1RjY.cjs.js +0 -356
- package/dist/markdown-editor.css +0 -341
- package/src/components/AnalyzePackageButton.tsx +0 -319
- package/src/components/Workbook/BrowserWorkbookStorage.ts +0 -64
- package/src/components/Workbook/EditableMalloyCell.tsx +0 -49
- package/src/components/Workbook/ModelPicker.tsx +0 -134
- package/src/components/Workbook/MutableCell.tsx +0 -458
- package/src/components/Workbook/Workbook.tsx +0 -501
- package/src/components/Workbook/WorkbookList.tsx +0 -110
- package/src/components/Workbook/WorkbookManager.ts +0 -214
- package/src/components/Workbook/WorkbookStorage.ts +0 -35
- package/src/components/Workbook/WorkbookStorageProvider.tsx +0 -40
- package/src/components/Workbook/index.ts +0 -10
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { DashboardDocument } from './document';
|
|
2
|
+
/**
|
|
3
|
+
* The editor's state: the document being edited, its history, and saving.
|
|
4
|
+
*
|
|
5
|
+
* Deliberately holds the DOCUMENT and nothing else. Given VALUES — what the
|
|
6
|
+
* preview is running with — are editor state rather than document state and
|
|
7
|
+
* live outside this hook, which is what keeps them out of the undo stack. Undo
|
|
8
|
+
* should take back a layout change; it should not rewind the filter someone was
|
|
9
|
+
* previewing under.
|
|
10
|
+
*/
|
|
11
|
+
export interface DashboardEditor {
|
|
12
|
+
document: DashboardDocument;
|
|
13
|
+
/** The file as it currently stands, which is what a save patches. */
|
|
14
|
+
source: string;
|
|
15
|
+
canUndo: boolean;
|
|
16
|
+
canRedo: boolean;
|
|
17
|
+
/** Whether the document has changes the file does not have yet. */
|
|
18
|
+
dirty: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Why the last save did not happen. The document is untouched when this is
|
|
21
|
+
* set: a refused write keeps the reader's work and reports a defect in the
|
|
22
|
+
* writer, rather than discarding an edit because a tool could not read back
|
|
23
|
+
* what it produced.
|
|
24
|
+
*/
|
|
25
|
+
error?: string;
|
|
26
|
+
/** Apply a change. Receives a copy; mutate it freely. */
|
|
27
|
+
update: (change: (draft: DashboardDocument) => void) => void;
|
|
28
|
+
undo: () => void;
|
|
29
|
+
redo: () => void;
|
|
30
|
+
/** Splice the change into the file, or say why it was refused. */
|
|
31
|
+
save: () => Promise<SaveOutcome>;
|
|
32
|
+
/**
|
|
33
|
+
* The file a save would write, without writing it: what a diff preview
|
|
34
|
+
* shows. The failure arm is the writer's refusal, worded for the author.
|
|
35
|
+
*/
|
|
36
|
+
preview: () => Promise<{
|
|
37
|
+
ok: true;
|
|
38
|
+
source: string;
|
|
39
|
+
} | {
|
|
40
|
+
ok: false;
|
|
41
|
+
reason: string;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the unsaved change adds or removes a tile. Those moves touch
|
|
45
|
+
* declarations and the comments beside them, which is when a save is worth
|
|
46
|
+
* showing as a diff first; a property edit never is.
|
|
47
|
+
*/
|
|
48
|
+
structural: boolean;
|
|
49
|
+
}
|
|
50
|
+
export type SaveOutcome = {
|
|
51
|
+
ok: true;
|
|
52
|
+
} | {
|
|
53
|
+
ok: false;
|
|
54
|
+
reason: string;
|
|
55
|
+
};
|
|
56
|
+
export declare function useDashboardEditor(options: {
|
|
57
|
+
/** The file as read from storage. */
|
|
58
|
+
source: string;
|
|
59
|
+
/** The document that file produced. */
|
|
60
|
+
document: DashboardDocument;
|
|
61
|
+
/** Persist the patched file. Rejecting leaves the editor dirty. */
|
|
62
|
+
onSave?: (source: string) => Promise<void> | void;
|
|
63
|
+
}): DashboardEditor;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A copy of `value` to edit while a window is open, committed ONCE when it
|
|
3
|
+
* closes, and only if something changed.
|
|
4
|
+
*
|
|
5
|
+
* Per-keystroke commits would put a document in the undo stack for every
|
|
6
|
+
* letter typed into a title, and undo would then walk back through the word.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useDraft<T>(value: T | undefined, open: boolean, onCommit: (next: T) => void, onClose: () => void): {
|
|
9
|
+
draft: T;
|
|
10
|
+
patch: (change: (draft: T) => void) => void;
|
|
11
|
+
close: () => void;
|
|
12
|
+
discard: () => void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { CatalogField } from './catalog';
|
|
2
|
+
import { BuilderControl, ControlKind, MappingRow } from './controls';
|
|
3
|
+
import { DashboardDocument, DashboardTile, LocalGiven } from './document';
|
|
4
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
5
|
+
type Source = {
|
|
6
|
+
kind: "existing";
|
|
7
|
+
name: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: "new";
|
|
10
|
+
};
|
|
11
|
+
/** `STATUS` → `Status`: the label a new control gets when none is typed. */
|
|
12
|
+
export declare const titleCase: (name: string) => string;
|
|
13
|
+
/**
|
|
14
|
+
* The filter window's state and every derivation it renders from: what the
|
|
15
|
+
* control is (new here, or one the model offers), which tiles it binds and on
|
|
16
|
+
* which field, what stands in the way of applying, and the payload an Apply
|
|
17
|
+
* hands back. No MUI in here, so it can be exercised without a dialog.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useFilterForm({ open, document, control, available, fieldsFor, onApply, }: {
|
|
20
|
+
open: boolean;
|
|
21
|
+
document: DashboardDocument;
|
|
22
|
+
control: BuilderControl | undefined;
|
|
23
|
+
available: readonly BuilderControl[];
|
|
24
|
+
fieldsFor?: (tile: DashboardTile) => readonly CatalogField[] | undefined;
|
|
25
|
+
onApply: (given: string, rows: MappingRow[], declare?: LocalGiven) => void;
|
|
26
|
+
}): {
|
|
27
|
+
editing: boolean;
|
|
28
|
+
shown: BuilderControl;
|
|
29
|
+
fromModel: boolean;
|
|
30
|
+
source: Source;
|
|
31
|
+
setSource: Dispatch<SetStateAction<Source>>;
|
|
32
|
+
label: string;
|
|
33
|
+
setLabel: Dispatch<SetStateAction<string>>;
|
|
34
|
+
kind: ControlKind;
|
|
35
|
+
dateDefault: string;
|
|
36
|
+
setDateDefault: Dispatch<SetStateAction<string>>;
|
|
37
|
+
field: string;
|
|
38
|
+
rows: MappingRow[];
|
|
39
|
+
setRows: Dispatch<SetStateAction<MappingRow[]>>;
|
|
40
|
+
perTile: boolean;
|
|
41
|
+
setPerTile: Dispatch<SetStateAction<boolean>>;
|
|
42
|
+
newName: string;
|
|
43
|
+
target: {
|
|
44
|
+
name: string;
|
|
45
|
+
type?: string;
|
|
46
|
+
};
|
|
47
|
+
valueTyped: boolean;
|
|
48
|
+
commonOp: string;
|
|
49
|
+
setRow: (index: number, patch: Partial<MappingRow>) => void;
|
|
50
|
+
setCommonOp: (next: string) => void;
|
|
51
|
+
pickExisting: (given: BuilderControl) => void;
|
|
52
|
+
pickKind: (next: ControlKind) => void;
|
|
53
|
+
bindable: boolean[];
|
|
54
|
+
bindableCount: number;
|
|
55
|
+
included: number;
|
|
56
|
+
commonFields: CatalogField[];
|
|
57
|
+
setAll: (include: boolean) => void;
|
|
58
|
+
accepts: (candidate: CatalogField) => boolean;
|
|
59
|
+
pickField: (next: string) => void;
|
|
60
|
+
rowProblems: string[];
|
|
61
|
+
commonProblem: string;
|
|
62
|
+
canApply: boolean;
|
|
63
|
+
apply: () => void;
|
|
64
|
+
};
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DragEndEvent, DragOverEvent } from '@dnd-kit/react';
|
|
2
|
+
import { DashboardTile } from './document';
|
|
3
|
+
/**
|
|
4
|
+
* Dragging a tile to reorder it. The gesture is `@dnd-kit/react`'s (see
|
|
5
|
+
* `sortable.tsx`); what is decided here is what a drop means for the file,
|
|
6
|
+
* through `keepRowStructure` for a drop onto a tile and `moveIntoGap` for a
|
|
7
|
+
* drop into the empty end of a row. The preview is rebuilt on each report and
|
|
8
|
+
* written ONCE, on release: one history entry for the whole drag.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useTileReorder({ tiles, commit, onLanded, }: {
|
|
11
|
+
tiles: DashboardTile[];
|
|
12
|
+
/** The order to write when the drag ends somewhere new. */
|
|
13
|
+
commit: (next: DashboardTile[]) => void;
|
|
14
|
+
/** Where the dragged tile came to rest, which the caller selects. */
|
|
15
|
+
onLanded: (index: number) => void;
|
|
16
|
+
}): {
|
|
17
|
+
dragging: boolean;
|
|
18
|
+
preview: DashboardTile[];
|
|
19
|
+
onDragStart: () => void;
|
|
20
|
+
onDragOver: (event: DragOverEvent) => void;
|
|
21
|
+
onDragEnd: (event: DragEndEvent) => void;
|
|
22
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DashboardTile } from './document';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
/** A resize in flight: the tile, the width it WOULD be, and the geometry. */
|
|
4
|
+
export interface ResizeState {
|
|
5
|
+
index: number;
|
|
6
|
+
span: number;
|
|
7
|
+
left: number;
|
|
8
|
+
track: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Dragging a tile's right edge to set its `colspan`. The width is previewed
|
|
12
|
+
* by the caller from `resize.span` and written ONCE, on release: writing on
|
|
13
|
+
* every pointer move would put a dozen documents in the history for one
|
|
14
|
+
* gesture, and undo would walk back through the drag a column at a time.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useTileResize({ tiles, columns, onStart, commit, }: {
|
|
17
|
+
tiles: readonly DashboardTile[];
|
|
18
|
+
columns: number;
|
|
19
|
+
/** The tile a resize begins on, which the caller selects. */
|
|
20
|
+
onStart: (index: number) => void;
|
|
21
|
+
/** The width to write when the drag ends. */
|
|
22
|
+
commit: (index: number, span: number) => void;
|
|
23
|
+
}): {
|
|
24
|
+
resize: ResizeState;
|
|
25
|
+
gridBox: RefObject<HTMLDivElement>;
|
|
26
|
+
startResize: (event: React.PointerEvent<HTMLDivElement>, index: number) => void;
|
|
27
|
+
onResize: (event: React.PointerEvent<HTMLDivElement>) => void;
|
|
28
|
+
endResize: (event: React.PointerEvent<HTMLDivElement>) => void;
|
|
29
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DocumentLocator, DocumentStorage, DocumentType, Workspace } from './DocumentStorage';
|
|
2
|
+
/**
|
|
3
|
+
* A {@link DocumentStorage} in the browser's localStorage: one workspace,
|
|
4
|
+
* `Local`, private to this browser and this origin. The Console's default, and
|
|
5
|
+
* what a host uses before it has a store of its own.
|
|
6
|
+
*/
|
|
7
|
+
export declare class BrowserDocumentStorage implements DocumentStorage {
|
|
8
|
+
listWorkspaces(writeableOnly: boolean): Promise<Workspace[]>;
|
|
9
|
+
listDocuments(workspace: Workspace, type?: DocumentType): Promise<DocumentLocator[]>;
|
|
10
|
+
getDocument(locator: DocumentLocator): Promise<string>;
|
|
11
|
+
saveDocument(locator: DocumentLocator, content: string): Promise<void>;
|
|
12
|
+
deleteDocument(locator: DocumentLocator): Promise<void>;
|
|
13
|
+
moveDocument(from: DocumentLocator, to: DocumentLocator): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where authored documents are kept, as an interface the host hands the SDK.
|
|
3
|
+
*
|
|
4
|
+
* The SDK renders dashboards and notebooks that a Publisher server serves out
|
|
5
|
+
* of a package, and it will author them too, but it does not decide where an
|
|
6
|
+
* authored document goes. That is the host's business: the Console keeps one
|
|
7
|
+
* in the browser, a platform keeps one in its own document store, a repo-backed
|
|
8
|
+
* host writes it to the package directory. So the SDK asks for a
|
|
9
|
+
* {@link DocumentStorage} through {@link DocumentStorageProvider} and calls it,
|
|
10
|
+
* and never touches a backend itself.
|
|
11
|
+
*
|
|
12
|
+
* A document is a string. The interface does not know whether it is a
|
|
13
|
+
* `dashboards/*.malloy` file, a `.malloynb`, or something else; the
|
|
14
|
+
* {@link DocumentLocator.type} says what kind it is so a backend can keep the
|
|
15
|
+
* kinds apart (a database column, a directory, a key prefix) and a listing can
|
|
16
|
+
* ask for one kind. Everything else a backend may know about a document, who
|
|
17
|
+
* changed it and when, who may see it, stays with the backend.
|
|
18
|
+
*
|
|
19
|
+
* Every method rejects rather than returning a sentinel when the document is
|
|
20
|
+
* not there, so a caller can tell "missing" from "empty".
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* The kinds of document the SDK authors. A `dashboard` is a
|
|
24
|
+
* `dashboards/<slug>.malloy` file; a `notebook` is a `.malloynb`.
|
|
25
|
+
*/
|
|
26
|
+
export type DocumentType = "dashboard" | "notebook";
|
|
27
|
+
/** A place documents live, as the backend presents it to a reader. */
|
|
28
|
+
export interface Workspace {
|
|
29
|
+
name: string;
|
|
30
|
+
/** False for a workspace this reader may list and open but not save into. */
|
|
31
|
+
writeable: boolean;
|
|
32
|
+
description: string;
|
|
33
|
+
}
|
|
34
|
+
/** One document's address: which workspace, which kind, and its path there. */
|
|
35
|
+
export interface DocumentLocator {
|
|
36
|
+
workspace: string;
|
|
37
|
+
type: DocumentType;
|
|
38
|
+
/**
|
|
39
|
+
* The document's path within the workspace, spelled the way the backend
|
|
40
|
+
* spells it. For a repo-backed store that is the file path relative to the
|
|
41
|
+
* package (`dashboards/overview.malloy`); a database store may use a slug.
|
|
42
|
+
*/
|
|
43
|
+
path: string;
|
|
44
|
+
}
|
|
45
|
+
export interface DocumentStorage {
|
|
46
|
+
/** The workspaces this reader can see; only the writeable ones when asked. */
|
|
47
|
+
listWorkspaces(writeableOnly: boolean): Promise<Workspace[]>;
|
|
48
|
+
/** Every document in a workspace, or only those of one kind. */
|
|
49
|
+
listDocuments(workspace: Workspace, type?: DocumentType): Promise<DocumentLocator[]>;
|
|
50
|
+
/** The document's content. Rejects when there is no document there. */
|
|
51
|
+
getDocument(locator: DocumentLocator): Promise<string>;
|
|
52
|
+
/** Write the content, creating the document or replacing it. */
|
|
53
|
+
saveDocument(locator: DocumentLocator, content: string): Promise<void>;
|
|
54
|
+
/** Remove the document. Rejects when there is no document there. */
|
|
55
|
+
deleteDocument(locator: DocumentLocator): Promise<void>;
|
|
56
|
+
/** Rename or relocate a document, keeping its content. Rejects when `from` is missing. */
|
|
57
|
+
moveDocument(from: DocumentLocator, to: DocumentLocator): Promise<void>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DocumentStorage } from './DocumentStorage';
|
|
3
|
+
export interface DocumentStorageProviderProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
documentStorage: DocumentStorage;
|
|
6
|
+
}
|
|
7
|
+
interface DocumentStorageContextValue {
|
|
8
|
+
documentStorage: DocumentStorage;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Hands a {@link DocumentStorage} to every SDK component beneath it. The host
|
|
12
|
+
* constructs the storage; the SDK only ever reads it through
|
|
13
|
+
* {@link useDocumentStorage}.
|
|
14
|
+
*/
|
|
15
|
+
export declare function DocumentStorageProvider({ children, documentStorage, }: DocumentStorageProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
/** The host's storage, or a thrown error outside a provider: there is no default. */
|
|
17
|
+
export declare function useDocumentStorage(): DocumentStorageContextValue;
|
|
18
|
+
/**
|
|
19
|
+
* The host's storage, or undefined outside a provider. For a component that
|
|
20
|
+
* can do without one — the dashboard editor still edits and exports with no
|
|
21
|
+
* place to save — rather than the throwing form, which is for components that
|
|
22
|
+
* cannot.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useOptionalDocumentStorage(): DocumentStorageContextValue | undefined;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { DocumentLocator, DocumentStorage, DocumentType, Workspace, } from './DocumentStorage';
|
|
2
|
+
export { DocumentStorageProvider, useDocumentStorage, useOptionalDocumentStorage, type DocumentStorageProviderProps, } from './DocumentStorageProvider';
|
|
3
|
+
export { BrowserDocumentStorage } from './BrowserDocumentStorage';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IconButtonProps } from '@mui/material';
|
|
2
|
+
/**
|
|
3
|
+
* A small round button that sits OVER content — a rendered result, an
|
|
4
|
+
* explorer, a chart — to open something about it: the code, the full result,
|
|
5
|
+
* a render warning.
|
|
6
|
+
*
|
|
7
|
+
* On the instance theme's tile colour, with its border, so it reads as a chip
|
|
8
|
+
* of the same card it floats on in both modes. Six of these were drawn by hand
|
|
9
|
+
* before, every one on a hardcoded white plate with a hardcoded dark icon,
|
|
10
|
+
* and the notebook's comment said why that was the only way: a white plate
|
|
11
|
+
* needs a dark icon whatever the mode. The plate follows the theme now, so
|
|
12
|
+
* the icon can too.
|
|
13
|
+
*
|
|
14
|
+
* Positioning is the caller's: it passes `sx` for where the button floats.
|
|
15
|
+
*/
|
|
16
|
+
export declare function FloatingIconButton({ sx, ...props }: IconButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,6 @@ export { default as Model } from './Model';
|
|
|
2
2
|
export { ModelExplorer } from './ModelExplorer';
|
|
3
3
|
export { ModelExplorerDialog } from './ModelExplorerDialog';
|
|
4
4
|
export { SourcesExplorer } from './SourcesExplorer';
|
|
5
|
-
export { SourceExplorerComponent } from './SourcesExplorer';
|
|
6
5
|
export type { SourceAndPath, QueryExplorerResult } from './SourcesExplorer';
|
|
7
6
|
export { useModelData } from './useModelData';
|
|
8
7
|
export type { ModelExplorerProps } from './ModelExplorer';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
import { NavigationClick } from './click_helper';
|
|
3
|
+
/**
|
|
4
|
+
* Markdown authored inside a package — a dashboard's `##"` description, a
|
|
5
|
+
* notebook's markdown cell, a README — rendered one way.
|
|
6
|
+
*
|
|
7
|
+
* Three surfaces each rendered it with their own style sheet, and only one of
|
|
8
|
+
* them guarded the links. Package content comes from untrusted git and S3
|
|
9
|
+
* sources, so a crafted `javascript:` or `data:` href in a README or a
|
|
10
|
+
* description must never run; the notebook cell knew this and the other two did
|
|
11
|
+
* not. Every link here goes through {@link ProseLink}.
|
|
12
|
+
*
|
|
13
|
+
* Two variants, because the prose plays two roles:
|
|
14
|
+
*
|
|
15
|
+
* - `document`: the prose IS the content — a notebook's markdown cells, read
|
|
16
|
+
* top to bottom. Full-size headings, reading-length lines.
|
|
17
|
+
* - `caption`: the prose sits under a title it must not compete with — a
|
|
18
|
+
* dashboard's description, a package's README card. Body size; headings are
|
|
19
|
+
* section labels within the block, at body size and bold.
|
|
20
|
+
*/
|
|
21
|
+
export type ProseVariant = "document" | "caption";
|
|
22
|
+
/**
|
|
23
|
+
* How a relative link is resolved. Links in package content are authored
|
|
24
|
+
* relative to the SOURCE FILE (`spielberg.malloynb`), and a plain anchor
|
|
25
|
+
* resolves them against the page URL instead, which drops the package segment
|
|
26
|
+
* for a README shown at the package route. With this, a relative link resolves
|
|
27
|
+
* against the file's own directory and routes through the host.
|
|
28
|
+
*/
|
|
29
|
+
export interface ProseLinkContext {
|
|
30
|
+
environmentName: string;
|
|
31
|
+
packageName: string;
|
|
32
|
+
/** The file the prose came from, within the package; its directory is the base. */
|
|
33
|
+
sourcePath?: string;
|
|
34
|
+
/**
|
|
35
|
+
* SPA navigation for a resolved link. Omitted, the absolute href navigates on
|
|
36
|
+
* its own, so rendering prose needs no router context.
|
|
37
|
+
*/
|
|
38
|
+
onNavigate?: (to: string, event?: NavigationClick) => void;
|
|
39
|
+
}
|
|
40
|
+
export interface ProseProps {
|
|
41
|
+
children: string;
|
|
42
|
+
variant?: ProseVariant;
|
|
43
|
+
links?: ProseLinkContext;
|
|
44
|
+
sx?: SxProps<Theme>;
|
|
45
|
+
}
|
|
46
|
+
export declare function Prose({ children, variant, links, sx, }: ProseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { ResultSizing } from './resultSizing';
|
|
2
3
|
import { DrillBinding } from '../drill/useDrill';
|
|
3
4
|
type MalloyRenderElement = HTMLElement & Record<string, unknown>;
|
|
4
5
|
declare global {
|
|
@@ -12,7 +13,18 @@ interface RenderedResultProps {
|
|
|
12
13
|
result: string;
|
|
13
14
|
height?: number;
|
|
14
15
|
isFillElement?: (boolean: any) => void;
|
|
16
|
+
/**
|
|
17
|
+
* The measured content height. Fires only for a content-sized root; a
|
|
18
|
+
* container-sized one has no height of its own to report. See
|
|
19
|
+
* {@link resultSizing}.
|
|
20
|
+
*/
|
|
15
21
|
onSizeChange?: (height: number) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Which sizing rule the rendered root follows, as soon as the renderer's
|
|
24
|
+
* metadata says. Lets a caller stop treating its cap as a height for a
|
|
25
|
+
* result that will never report one.
|
|
26
|
+
*/
|
|
27
|
+
onSizing?: (sizing: ResultSizing) => void;
|
|
16
28
|
/**
|
|
17
29
|
* Makes `# drill` cells clickable, and makes them look it. From `useDrill`
|
|
18
30
|
* on the host surface, which decides where a click may go; omitted where
|
|
@@ -2,7 +2,13 @@ import { LogMessage } from '../../client';
|
|
|
2
2
|
import { DrillBinding } from '../drill/useDrill';
|
|
3
3
|
interface ResultContainerProps {
|
|
4
4
|
result: string | undefined;
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Cap on the panel's height. A CAP, not a height request: a result shorter
|
|
7
|
+
* than this paints at its own height. Leave it out for no cap, which is what
|
|
8
|
+
* the single-query dashboard form wants — a result that IS the page should
|
|
9
|
+
* not be clipped to tidy it.
|
|
10
|
+
*/
|
|
11
|
+
maxHeight?: number;
|
|
6
12
|
maxResultSize?: number;
|
|
7
13
|
renderLogs?: LogMessage[];
|
|
8
14
|
drill?: DrillBinding;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { QueryResultState } from '../../hooks/useQueryResult';
|
|
2
|
+
import { DrillBinding } from '../drill/useDrill';
|
|
3
|
+
export interface ResultPanelProps {
|
|
4
|
+
/** From `useQueryResult`. */
|
|
5
|
+
state: QueryResultState;
|
|
6
|
+
/** Names the request in an error: the tile expression, the query name, the model path. */
|
|
7
|
+
context: string;
|
|
8
|
+
loadingText?: string;
|
|
9
|
+
maxHeight?: number;
|
|
10
|
+
maxResultSize?: number;
|
|
11
|
+
drill?: DrillBinding;
|
|
12
|
+
/**
|
|
13
|
+
* Rewrites the result before it is rendered — a dashboard tile promotes a
|
|
14
|
+
* one-row measure result to KPI cards this way. Memoized on the result
|
|
15
|
+
* string, so a large result is not re-parsed on every render around it.
|
|
16
|
+
*/
|
|
17
|
+
transform?: (result: string) => string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The three states of a running query, once: waiting, failed, and the result
|
|
21
|
+
* itself through `ResultContainer`.
|
|
22
|
+
*
|
|
23
|
+
* Every surface that runs a query goes through the same three, and each used
|
|
24
|
+
* to draw them itself with its own words ("Running…", "Loading results...",
|
|
25
|
+
* "Fetching Query Results...") and, in one case, without the failed state at
|
|
26
|
+
* all. A tile owning its own panel is still what lets a composite dashboard
|
|
27
|
+
* survive a bad tile: the broken one shows its error in place and the rest of
|
|
28
|
+
* the grid still renders.
|
|
29
|
+
*/
|
|
30
|
+
export declare function ResultPanel({ state, context, loadingText, maxHeight, maxResultSize, drill, transform, }: ResultPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { default as RenderedResult } from './RenderedResult';
|
|
2
2
|
export { default as ResultContainer } from './ResultContainer';
|
|
3
|
+
export { ResultPanel, type ResultPanelProps } from './ResultPanel';
|
|
4
|
+
export { contentNodeDepth, INITIAL_RENDER_HEIGHT, initialResultHeight, measureContentHeight, MODEL_CELL_MAX_HEIGHT, NOTEBOOK_CELL_MAX_HEIGHT, remeasuresAfterReady, resolveResultHeight, RESULTS_DIALOG_MAX_HEIGHT, resultSizing, TILE_MAX_HEIGHT, UNCAPPED_CONTAINER_HEIGHT, type ResultSizing, } from './resultSizing';
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every height decision a rendered result takes, in one module.
|
|
3
|
+
*
|
|
4
|
+
* Three things used to be tangled together and spread across four files: how
|
|
5
|
+
* tall a result should paint, whether it is the kind of result that has a
|
|
6
|
+
* height of its own at all, and which DOM node that height can be read off.
|
|
7
|
+
* They are separated here so the first two are pure and testable, and the third
|
|
8
|
+
* is the single place this package touches the renderer's DOM.
|
|
9
|
+
*
|
|
10
|
+
* The renderer exposes no size API — `MalloyViz` offers `onReady` and
|
|
11
|
+
* `getMetadata()` and nothing that reports a height — so a result that sizes
|
|
12
|
+
* itself has to be measured. What CAN come from the public metadata is whether
|
|
13
|
+
* it is worth measuring, from two sources, in this order:
|
|
14
|
+
*
|
|
15
|
+
* 1. The root's render plugin declares `sizingStrategy: "fill" | "fixed"`,
|
|
16
|
+
* which is the renderer's own answer to exactly this question. Read it
|
|
17
|
+
* through `getPluginsForField(getRootField().key)`.
|
|
18
|
+
* 2. Where no plugin claims the root — a table, a `# dashboard` grid — fall
|
|
19
|
+
* back to `renderAs()` and the lists below.
|
|
20
|
+
*
|
|
21
|
+
* Keying off either instead of the rendered class names is what keeps the DOM
|
|
22
|
+
* contact down to one bounded walk.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* How a rendered root arrives at its height.
|
|
26
|
+
*
|
|
27
|
+
* - `content`: it has a height of its own and the container should shrink to
|
|
28
|
+
* it — a table, a `# dashboard` grid, a `# big_value`, a list, and the maps,
|
|
29
|
+
* whose height comes from their aspect ratio.
|
|
30
|
+
* - `container`: it fills whatever box it is handed and has no height to
|
|
31
|
+
* report. The plotted charts, and only those. Measuring one tells you what
|
|
32
|
+
* you already gave it, minus the inset it drew itself at.
|
|
33
|
+
*/
|
|
34
|
+
export type ResultSizing = "content" | "container";
|
|
35
|
+
/**
|
|
36
|
+
* Which sizing rule a root follows.
|
|
37
|
+
*
|
|
38
|
+
* `strategy` is the root plugin's declared `sizingStrategy` and wins when it is
|
|
39
|
+
* there, because it is the renderer answering the question directly rather than
|
|
40
|
+
* this SDK inferring it from a name. Note it is the PLUGIN's strategy, not the
|
|
41
|
+
* field entry's: `renderProperties.sizingStrategy` on the root reads `"fit"` for
|
|
42
|
+
* every result and says nothing.
|
|
43
|
+
*
|
|
44
|
+
* Unknown, with no plugin — a renderer newer than this SDK — is treated as
|
|
45
|
+
* content-sized, which is the behavior every root had before this
|
|
46
|
+
* classification existed: measure once and use what comes back.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resultSizing(renderAs: string | undefined, strategy?: string | undefined): ResultSizing;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the result keeps being measured after the first height lands.
|
|
51
|
+
*
|
|
52
|
+
* It has to be, and the acute case is a table. The renderer signals `onReady`
|
|
53
|
+
* as soon as it knows it can paint, and for a table that is immediately — a
|
|
54
|
+
* chart waits for a non-zero parent size, a table does not — so a single
|
|
55
|
+
* measurement taken there lands before the table's virtualized grid has laid
|
|
56
|
+
* out, and reads a height the table never keeps. A `# big_value` row loses the
|
|
57
|
+
* same race more quietly: it reports the box it was handed, so the panel simply
|
|
58
|
+
* keeps the cap and the tile carries a band of empty space under its numbers.
|
|
59
|
+
*
|
|
60
|
+
* Re-measuring a content-sized root TERMINATES, because its height does not
|
|
61
|
+
* depend on the box it is in. `.malloy-table.root` is
|
|
62
|
+
* `height: fit-content; max-height: 100%` in the renderer's own CSS and the
|
|
63
|
+
* wrappers between it and the container add no padding, so shrinking the
|
|
64
|
+
* container to the table's content height is the exact point at which the cap
|
|
65
|
+
* stops binding and the next measurement reports the same number.
|
|
66
|
+
*
|
|
67
|
+
* This used to be tables only, and the reason was the one root this is NOT safe
|
|
68
|
+
* for: a chart draws itself inset from the box it is given, so feeding its
|
|
69
|
+
* height back as the new container height would ratchet the container down by
|
|
70
|
+
* that inset every pass and never converge. Charts are classified
|
|
71
|
+
* container-sized now and are never measured at all, so the hazard is out of
|
|
72
|
+
* the measured set and the narrow exemption it forced can go with it.
|
|
73
|
+
*
|
|
74
|
+
* A root this SDK cannot place stays on the one-shot path. A plugin that
|
|
75
|
+
* declares itself `"fixed"` IS placed — the renderer has said its size is its
|
|
76
|
+
* own — so it re-measures like any other content-sized root. Only a name we do
|
|
77
|
+
* not know, with no plugin behind it, falls back to one measurement, which is
|
|
78
|
+
* what it got before any of this existed.
|
|
79
|
+
*/
|
|
80
|
+
export declare function remeasuresAfterReady(renderAs: string | undefined, strategy?: string | undefined): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* How far below the stage the node carrying a root's content height sits.
|
|
83
|
+
*
|
|
84
|
+
* This is the one renderer-DOM assumption left in the SDK, so it is stated
|
|
85
|
+
* rather than inlined. The stage is our own node and is box-sized, so it is
|
|
86
|
+
* never the answer: measuring it would floor every result at the height the
|
|
87
|
+
* container already has and nothing could ever shrink. Its first child is the
|
|
88
|
+
* renderer's outer wrapper, also box-sized, for the same reason.
|
|
89
|
+
*
|
|
90
|
+
* Depth 2 — the wrapper's child — is the root render node, and for every root
|
|
91
|
+
* but one its `scrollHeight` is the content height.
|
|
92
|
+
*
|
|
93
|
+
* A `# dashboard` grid is the exception: its own wrapper is constrained, and
|
|
94
|
+
* the grid one level further down is what reports the height. That used to be
|
|
95
|
+
* spelled as a class-name check on the rendered DOM
|
|
96
|
+
* (`classList.contains("malloy-dashboard")`); it is keyed off `renderAs()` now,
|
|
97
|
+
* which is metadata the renderer publishes rather than markup it happens to
|
|
98
|
+
* emit.
|
|
99
|
+
*/
|
|
100
|
+
export declare function contentNodeDepth(renderAs: string | undefined): number;
|
|
101
|
+
/**
|
|
102
|
+
* The node under `stage` that carries the result's content height: `depth`
|
|
103
|
+
* first children down, or null if the renderer has not built that deep yet.
|
|
104
|
+
*
|
|
105
|
+
* This is the node measured AND the node watched for changes, so the two can
|
|
106
|
+
* never drift apart.
|
|
107
|
+
*
|
|
108
|
+
* Null rather than the deepest node available, which is the tempting fallback
|
|
109
|
+
* and is actively wrong. A DOM shallower than `depth` almost always means the
|
|
110
|
+
* renderer is still building, and the shallow nodes are its box-sized wrappers:
|
|
111
|
+
* answering with one reports the height the panel already has, which reads as a
|
|
112
|
+
* successful measurement, stops the retry, and leaves the observer watching a
|
|
113
|
+
* node whose size can never change. That is a `# big_value` tile stuck at its
|
|
114
|
+
* 400px cap with 264px of white under its numbers. Reporting nothing instead
|
|
115
|
+
* leaves the panel at its first-paint height and lets the caller measure again
|
|
116
|
+
* when the renderer mutates the DOM into its final shape.
|
|
117
|
+
*/
|
|
118
|
+
export declare function contentNode(stage: HTMLElement, depth: number): HTMLElement | null;
|
|
119
|
+
/**
|
|
120
|
+
* Content height of the rendered result under `stage`, or 0 if the renderer
|
|
121
|
+
* has not built its final shape yet. See {@link contentNode}.
|
|
122
|
+
*
|
|
123
|
+
* `scrollHeight` is the CONTENT height, so this assumes the box adds no chrome
|
|
124
|
+
* of its own. True today: `.malloy-table.root` has no border, and a horizontal
|
|
125
|
+
* scrollbar costs no layout where scrollbars overlay. A wide table clipped by a
|
|
126
|
+
* few pixels on a platform that draws classic scrollbars would be this
|
|
127
|
+
* assumption breaking, and the fix is `+ (offsetHeight - clientHeight)`.
|
|
128
|
+
*/
|
|
129
|
+
export declare function measureContentHeight(stage: HTMLElement, depth: number): number;
|
|
130
|
+
/**
|
|
131
|
+
* Per-tile cap for a dashboard's composite form. A tile is one panel among
|
|
132
|
+
* several, so capping them keeps the grid even instead of letting one long
|
|
133
|
+
* table set the height of its whole row.
|
|
134
|
+
*/
|
|
135
|
+
export declare const TILE_MAX_HEIGHT = 400;
|
|
136
|
+
/**
|
|
137
|
+
* Cap for a notebook cell result that lays itself out: a table, mostly. Tall
|
|
138
|
+
* enough for a screenful of rows, after which the cell scrolls rather than the
|
|
139
|
+
* page turning into one long table.
|
|
140
|
+
*/
|
|
141
|
+
export declare const NOTEBOOK_CELL_MAX_HEIGHT = 700;
|
|
142
|
+
/** Cap for a query result shown inside a model page's cell. */
|
|
143
|
+
export declare const MODEL_CELL_MAX_HEIGHT = 600;
|
|
144
|
+
/** Cap for the results dialog, which gets most of a tall viewport. */
|
|
145
|
+
export declare const RESULTS_DIALOG_MAX_HEIGHT = 800;
|
|
146
|
+
/**
|
|
147
|
+
* Height for a container-sized root whose caller set no cap.
|
|
148
|
+
*
|
|
149
|
+
* A chart has no height of its own, so with nothing to measure and no cap to
|
|
150
|
+
* obey, something has to choose. This is that choice, and it is the same number
|
|
151
|
+
* a dashboard tile gets, so an uncapped chart reads like a tall tile rather
|
|
152
|
+
* than a page-height band.
|
|
153
|
+
*
|
|
154
|
+
* This is what closed the stretch: the single-query dashboard form used to ask
|
|
155
|
+
* for a 20000px "no cap" height, which a bare `# bar_chart` painted at, measured
|
|
156
|
+
* back off itself, and kept — 1992px for a two-row chart against 227px for the
|
|
157
|
+
* same query under a `# dashboard` grid. The cap is `undefined` now and a chart
|
|
158
|
+
* is never measured, so neither half of that can happen.
|
|
159
|
+
*/
|
|
160
|
+
export declare const UNCAPPED_CONTAINER_HEIGHT = 400;
|
|
161
|
+
/**
|
|
162
|
+
* Height to paint at before a content-sized result has been measured.
|
|
163
|
+
*
|
|
164
|
+
* A cap is also the first paint's height, because the measured height starts
|
|
165
|
+
* out equal to it. Harmless while every caller passes something viewport-sized
|
|
166
|
+
* (400 to 800); a caller that passes no cap needs a number that is not "as tall
|
|
167
|
+
* as you like".
|
|
168
|
+
*/
|
|
169
|
+
export declare const INITIAL_RENDER_HEIGHT = 2000;
|
|
170
|
+
/** First-paint height, before anything is known about the result. */
|
|
171
|
+
export declare function initialResultHeight(maxHeight: number | undefined): number;
|
|
172
|
+
/**
|
|
173
|
+
* The height a result panel should paint at, given what is known so far.
|
|
174
|
+
*
|
|
175
|
+
* `maxHeight` is a CAP and `undefined` means uncapped — it is not a height
|
|
176
|
+
* request, which is why "no cap" is expressed by leaving it out rather than by
|
|
177
|
+
* passing a number big enough to mean the same thing.
|
|
178
|
+
*/
|
|
179
|
+
export declare function resolveResultHeight({ sizing, contentHeight, maxHeight, }: {
|
|
180
|
+
sizing: ResultSizing | undefined;
|
|
181
|
+
contentHeight: number | undefined;
|
|
182
|
+
maxHeight: number | undefined;
|
|
183
|
+
}): number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { DRILL_CELL_CLASS, drillableFieldNames, markDrillableCells, type DrillMetadataSource, } from './markDrillableCells';
|
|
2
|
-
export { DRILL_SELF, drillDestinations, drillValueToFilter, encodeDrillValue, humanizeSlug, resolveDrill, type DrillClickPayload, type DrillField, type DrillIntent, type DrillNavigation, type DrillTagReader, } from './resolveDrill';
|
|
2
|
+
export { DRILL_SELF, drillDestinations, drillValueToFilter, encodeDrillValue, humanizeSlug, resolveDrill, type DrillClickPayload, type DrillField, type DrillIntent, type DrillNavigation, type DrillRowsRequest, type DrillTagReader, } from './resolveDrill';
|
|
3
3
|
export { useDrill, type DrillBinding, type UseDrillOptions, type UseDrillResult, } from './useDrill';
|
|
4
|
+
export { useDrillSelf, type UseDrillSelfOptions, type UseDrillSelfResult, } from './useDrillSelf';
|