@malloy-publisher/sdk 0.9.13 → 0.9.15

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.
Files changed (148) hide show
  1. package/dist/RenderedResult-BClN_PG6.cjs.js +154 -0
  2. package/dist/{RenderedResult-DnBtf-cI.es.js → RenderedResult-YBzVMVH2.es.js} +295 -234
  3. package/dist/{ServerProvider-BV7IoDMR.es.js → ServerProvider-D7neZcTk.es.js} +283 -265
  4. package/dist/ServerProvider-e2369oom.cjs.js +1 -0
  5. package/dist/builder/index.cjs.js +80 -79
  6. package/dist/builder/index.es.js +7430 -6548
  7. package/dist/client/api.d.ts +30 -6
  8. package/dist/client/index.cjs.js +1 -1
  9. package/dist/client/index.es.js +1 -1
  10. package/dist/components/Dashboard/DashboardGrid.d.ts +49 -1
  11. package/dist/components/Dashboard/DashboardTile.d.ts +5 -2
  12. package/dist/components/Dashboard/DashboardView.d.ts +9 -2
  13. package/dist/components/Dashboard/index.d.ts +1 -1
  14. package/dist/components/Dashboard/promoteMeasureRow.d.ts +5 -7
  15. package/dist/components/Dashboard/useStuck.d.ts +18 -12
  16. package/dist/components/RenderedResult/RenderedResult.d.ts +3 -2
  17. package/dist/components/RenderedResult/ResultContainer.d.ts +11 -1
  18. package/dist/components/RenderedResult/ResultPanel.d.ts +5 -1
  19. package/dist/components/RenderedResult/chartPresentation.d.ts +15 -0
  20. package/dist/components/RenderedResult/chartShapeProblem.d.ts +55 -0
  21. package/dist/components/RenderedResult/resultSizing.d.ts +42 -6
  22. package/dist/components/Report/Report.d.ts +7 -1
  23. package/dist/components/Report/ReportPage.d.ts +7 -0
  24. package/dist/components/Report/layoutRules.d.ts +45 -0
  25. package/dist/components/ReportBuilder/AddTileDialog.d.ts +2 -1
  26. package/dist/components/ReportBuilder/BuilderGrid.d.ts +14 -1
  27. package/dist/components/ReportBuilder/ChartPicker.d.ts +4 -2
  28. package/dist/components/ReportBuilder/EditorSurface.d.ts +17 -1
  29. package/dist/components/ReportBuilder/ReportEditor.d.ts +18 -0
  30. package/dist/components/ReportBuilder/TileFrame.d.ts +33 -1
  31. package/dist/components/ReportBuilder/TileMenu.d.ts +5 -2
  32. package/dist/components/ReportBuilder/catalog.d.ts +23 -0
  33. package/dist/components/ReportBuilder/chartLine.d.ts +38 -5
  34. package/dist/components/ReportBuilder/controls.d.ts +2 -2
  35. package/dist/components/ReportBuilder/document.d.ts +53 -5
  36. package/dist/components/ReportBuilder/imports.d.ts +7 -0
  37. package/dist/components/ReportBuilder/placement.d.ts +75 -0
  38. package/dist/components/ReportBuilder/preview.d.ts +59 -10
  39. package/dist/components/ReportBuilder/sortable.d.ts +3 -1
  40. package/dist/components/ReportBuilder/useTileHeight.d.ts +39 -0
  41. package/dist/components/ReportBuilder/useTileReorder.d.ts +27 -3
  42. package/dist/components/ReportBuilder/useTileResize.d.ts +8 -0
  43. package/dist/index.cjs.js +7 -7
  44. package/dist/index.es.js +3328 -3287
  45. package/dist/text/index.es.js +1 -1
  46. package/dist/{text-entry-72YFLeNk.es.js → text-entry-YKJZbRPo.es.js} +2 -2
  47. package/dist/theme/resolveTheme.d.ts +15 -0
  48. package/dist/{useCompiledDocument-B4QF1mIl.es.js → useCompiledDocument-BGk38oaW.es.js} +5097 -4805
  49. package/dist/useCompiledDocument-D9t5ry_t.cjs.js +142 -0
  50. package/dist/utils/blankQuoted.d.ts +15 -0
  51. package/package.json +1 -1
  52. package/src/components/Dashboard/DashboardGrid.tsx +127 -10
  53. package/src/components/Dashboard/DashboardTile.tsx +11 -1
  54. package/src/components/Dashboard/DashboardView.tsx +63 -10
  55. package/src/components/Dashboard/TileCard.tsx +6 -0
  56. package/src/components/Dashboard/index.ts +1 -0
  57. package/src/components/Dashboard/promoteMeasureRow.spec.ts +19 -0
  58. package/src/components/Dashboard/promoteMeasureRow.ts +15 -36
  59. package/src/components/Dashboard/tileHeight.spec.ts +72 -0
  60. package/src/components/Dashboard/useStuck.ts +76 -28
  61. package/src/components/Package/NewDocumentDialog.spec.tsx +20 -16
  62. package/src/components/Package/NewDocumentDialog.tsx +10 -11
  63. package/src/components/RenderedResult/RenderedResult.lifecycle.spec.tsx +167 -2
  64. package/src/components/RenderedResult/RenderedResult.tsx +21 -6
  65. package/src/components/RenderedResult/ResultContainer.tsx +60 -7
  66. package/src/components/RenderedResult/ResultPanel.tsx +21 -1
  67. package/src/components/RenderedResult/chartPresentation.spec.ts +153 -0
  68. package/src/components/RenderedResult/chartPresentation.ts +166 -0
  69. package/src/components/RenderedResult/chartShapeProblem.spec.tsx +245 -0
  70. package/src/components/RenderedResult/chartShapeProblem.ts +219 -0
  71. package/src/components/RenderedResult/resultSizing.spec.ts +75 -3
  72. package/src/components/RenderedResult/resultSizing.ts +65 -11
  73. package/src/components/Report/Report.spec.tsx +19 -0
  74. package/src/components/Report/Report.tsx +8 -1
  75. package/src/components/Report/ReportPage.tsx +13 -1
  76. package/src/components/Report/layoutRules.spec.ts +43 -3
  77. package/src/components/Report/layoutRules.ts +70 -0
  78. package/src/components/Report/tileOverflow.spec.tsx +162 -0
  79. package/src/components/ReportBuilder/AddTileDialog.spec.tsx +2 -2
  80. package/src/components/ReportBuilder/AddTileDialog.tsx +11 -6
  81. package/src/components/ReportBuilder/BuilderBar.tsx +1 -1
  82. package/src/components/ReportBuilder/BuilderDialogs.tsx +20 -0
  83. package/src/components/ReportBuilder/BuilderGrid.tsx +126 -20
  84. package/src/components/ReportBuilder/ChartPicker.spec.ts +91 -4
  85. package/src/components/ReportBuilder/ChartPicker.tsx +45 -10
  86. package/src/components/ReportBuilder/DrillDialog.tsx +8 -2
  87. package/src/components/ReportBuilder/EditorSurface.tsx +110 -28
  88. package/src/components/ReportBuilder/FilterDialog.tsx +17 -8
  89. package/src/components/ReportBuilder/FilterStrip.tsx +2 -1
  90. package/src/components/ReportBuilder/ReportBuilder.charts.spec.tsx +193 -2
  91. package/src/components/ReportBuilder/ReportBuilder.controls.spec.tsx +4 -2
  92. package/src/components/ReportBuilder/ReportBuilder.notebook.spec.tsx +2 -2
  93. package/src/components/ReportBuilder/ReportBuilder.spec.tsx +143 -2
  94. package/src/components/ReportBuilder/ReportBuilder.tsx +73 -19
  95. package/src/components/ReportBuilder/ReportEditor.fileModel.spec.tsx +178 -0
  96. package/src/components/ReportBuilder/ReportEditor.modelFilters.spec.tsx +3 -5
  97. package/src/components/ReportBuilder/ReportEditor.queryVersion.spec.tsx +292 -0
  98. package/src/components/ReportBuilder/ReportEditor.readOnlyTitle.spec.tsx +92 -0
  99. package/src/components/ReportBuilder/ReportEditor.tsx +35 -0
  100. package/src/components/ReportBuilder/TileFrame.tsx +251 -6
  101. package/src/components/ReportBuilder/TileMenu.tsx +259 -20
  102. package/src/components/ReportBuilder/ViewPicker.tsx +4 -3
  103. package/src/components/ReportBuilder/addTileToDocument.spec.ts +34 -0
  104. package/src/components/ReportBuilder/addTileToDocument.ts +26 -1
  105. package/src/components/ReportBuilder/catalog.aggregate.spec.ts +137 -1
  106. package/src/components/ReportBuilder/catalog.ts +90 -37
  107. package/src/components/ReportBuilder/chartLine.spec.ts +42 -5
  108. package/src/components/ReportBuilder/chartLine.ts +80 -2
  109. package/src/components/ReportBuilder/controls.ts +4 -3
  110. package/src/components/ReportBuilder/document.ts +65 -7
  111. package/src/components/ReportBuilder/emptyStart.spec.ts +1 -1
  112. package/src/components/ReportBuilder/entryLayout.spec.ts +151 -0
  113. package/src/components/ReportBuilder/imports.ts +1 -1
  114. package/src/components/ReportBuilder/invariants.spec.ts +18 -10
  115. package/src/components/ReportBuilder/layout.ts +3 -0
  116. package/src/components/ReportBuilder/placement.spec.ts +193 -0
  117. package/src/components/ReportBuilder/placement.ts +250 -0
  118. package/src/components/ReportBuilder/preview.shapes.spec.ts +46 -6
  119. package/src/components/ReportBuilder/preview.spec.ts +151 -11
  120. package/src/components/ReportBuilder/preview.ts +203 -40
  121. package/src/components/ReportBuilder/preview.unsaved.compile.spec.ts +190 -0
  122. package/src/components/ReportBuilder/readDocument.spec.ts +46 -2
  123. package/src/components/ReportBuilder/readDocument.ts +194 -23
  124. package/src/components/ReportBuilder/scannerShapes.spec.ts +10 -10
  125. package/src/components/ReportBuilder/sortable.tsx +4 -0
  126. package/src/components/ReportBuilder/spliceDocument.chart.spec.ts +1 -1
  127. package/src/components/ReportBuilder/spliceDocument.color.spec.ts +80 -0
  128. package/src/components/ReportBuilder/spliceDocument.colspan.spec.ts +78 -0
  129. package/src/components/ReportBuilder/spliceDocument.spec.ts +110 -18
  130. package/src/components/ReportBuilder/spliceDocument.ts +139 -52
  131. package/src/components/ReportBuilder/statementExtent.spec.ts +3 -3
  132. package/src/components/ReportBuilder/testing/reportGivenOrder.json +42 -0
  133. package/src/components/ReportBuilder/textTiles.spec.ts +2 -2
  134. package/src/components/ReportBuilder/tileDisplayTitle.ts +2 -2
  135. package/src/components/ReportBuilder/useTileEditing.ts +16 -3
  136. package/src/components/ReportBuilder/useTileHeight.ts +149 -0
  137. package/src/components/ReportBuilder/useTileReorder.ts +143 -6
  138. package/src/components/ReportBuilder/useTileResize.ts +16 -1
  139. package/src/components/given/FilterButton.spec.tsx +27 -11
  140. package/src/components/given/FilterButton.tsx +19 -6
  141. package/src/theme/resolveTheme.spec.ts +72 -1
  142. package/src/theme/resolveTheme.ts +43 -0
  143. package/src/utils/blankQuoted.spec.ts +50 -0
  144. package/src/utils/blankQuoted.ts +32 -0
  145. package/src/utils/malloyText.ts +2 -1
  146. package/dist/RenderedResult-DtQtNV0d.cjs.js +0 -153
  147. package/dist/ServerProvider-BIFPCzTD.cjs.js +0 -1
  148. package/dist/useCompiledDocument-D0OAMejE.cjs.js +0 -142
@@ -26,7 +26,52 @@ export interface LayoutRules {
26
26
  * inserting; a grid is arranged by dragging, so it adds at the end.
27
27
  */
28
28
  insertBetween: boolean;
29
+ /**
30
+ * The cap on a query tile's result, or undefined for none. A grid keeps its
31
+ * rows even, so a tile is one panel among several: it stops at
32
+ * {@link TILE_MAX_HEIGHT} and scrolls past it. A linear report is read top
33
+ * to bottom and nothing beside a tile sets its height, so a tile grows to
34
+ * fit what it holds, the way the single-query form already does: a row of
35
+ * KPI cards that wraps one per line in a narrow column shows every card. A
36
+ * table is the exception, held by {@link tableMaxHeight}. A
37
+ * chart, which has no height of its own, still draws at the uncapped
38
+ * default (see `resolveResultHeight`).
39
+ */
40
+ tileMaxHeight: number | undefined;
41
+ /**
42
+ * A further cap on a tile whose result is a table, or undefined for none
43
+ * beyond {@link tileMaxHeight}. A linear report's tiles grow to fit, but a
44
+ * long table at full length pushes the rest of the report a screen or more
45
+ * down, so a table stops at {@link LINEAR_TABLE_MAX_HEIGHT} and scrolls
46
+ * inside its tile under its pinned header row. A grid needs none: its tile
47
+ * cap is lower. See `resultCap`.
48
+ */
49
+ tableMaxHeight: number | undefined;
29
50
  }
51
+ /**
52
+ * The `# colspan` to write for a tile `span` columns wide, or undefined to
53
+ * write none because the tile draws the same without one.
54
+ *
55
+ * A tile with no colspan is one column, except that the reader widens it until
56
+ * it is at least `MIN_TILE_PX` wide (`defaultTileSpan`). In a grid of one or two
57
+ * columns, one column is already that wide wherever the grid is laid out in
58
+ * columns (two columns of 240px need a box of 496px). So there a written
59
+ * `colspan=1` only repeats the default. In a wider grid an unset tile can be
60
+ * drawn wider than one column, and an explicit 1 is the author's choice to keep.
61
+ *
62
+ * `drawnWithout` is the span the caller draws an unset tile at now, when it
63
+ * measures one (the builder does): a width the author just set to 1 is still
64
+ * written while the tile would draw wider without it.
65
+ */
66
+ export declare function writtenSpan(span: number, columns: number, drawnWithout?: number): number | undefined;
67
+ /**
68
+ * The tile with its width as {@link writtenSpan} would write it: a `colspan`,
69
+ * or none. A copy, so a caller puts it back in its list rather than writing
70
+ * through an entry it looked up.
71
+ */
72
+ export declare function withSpan<T extends {
73
+ colspan?: number;
74
+ }>(tile: T, span: number, columns: number, drawnWithout?: number): T;
30
75
  export declare function layoutRules(layout: ReportLayout | undefined,
31
76
  /** `# dashboard { columns=N }` as the file has it. */
32
77
  declaredColumns?: number): LayoutRules;
@@ -30,7 +30,8 @@ export interface NewTile {
30
30
  chart?: ChartPick | "none";
31
31
  /** The chart tags the view carries, so the chart line negates only those. */
32
32
  chartCarried?: string[];
33
- colspan: number;
33
+ /** Columns the tile spans; absent writes none, where that draws the same (`writtenSpan`). */
34
+ colspan?: number;
34
35
  }
35
36
  /** A view the picker shows a preview of, as the tile it would add. */
36
37
  export interface ViewPreview {
@@ -4,16 +4,29 @@ import { LayoutRules } from '../Report/layoutRules';
4
4
  import { DashboardTile, QueryTile } from './document';
5
5
  import { ReportEditorHandle } from './useReportEditor';
6
6
  import { useTileReorder } from './useTileReorder';
7
+ import { useTileHeight } from './useTileHeight';
7
8
  import { useTileResize } from './useTileResize';
8
9
  /**
9
10
  * The builder's tiles, on the SAME grid the dashboard renders on, each drawn
10
11
  * by the caller's `renderTile` inside a `TileFrame` that carries the
11
12
  * affordances: selection, the grip and menu, the width handle.
12
13
  */
13
- export declare function BuilderGrid({ editor, reorder, resizing, gridBox, defaultSpan, rules, canAdd, selected, flash, menuIndex, onSelect, onOpenMenu, onRemove, removeBlocked, openAdd, editTile, renderTile, }: {
14
+ export declare function BuilderGrid({ editor, reorder, resizing, sizing, place, arrange, gridBox, defaultSpan, rules, canAdd, selected, flash, menuIndex, onSelect, onOpenMenu, onRemove, removeBlocked, openAdd, editTile, renderTile, }: {
14
15
  editor: ReportEditorHandle;
15
16
  reorder: ReturnType<typeof useTileReorder>;
16
17
  resizing: ReturnType<typeof useTileResize>;
18
+ /** The bottom edges: a tile's height, dragged in whole rows. */
19
+ sizing?: ReturnType<typeof useTileHeight>;
20
+ /**
21
+ * The tiles after the one at `index` changed size: on a placed report,
22
+ * whatever it now covers pushed down. Identity elsewhere.
23
+ */
24
+ place?: (tiles: DashboardTile[], index: number) => DashboardTile[];
25
+ /**
26
+ * Whether tiles can be moved and widened here. Off while a grid is drawn
27
+ * as one column (a window narrower than the grid), where neither shows.
28
+ */
29
+ arrange?: boolean;
17
30
  gridBox: RefObject<HTMLDivElement | null>;
18
31
  /** The span a tile with no `# colspan` is drawn at: as wide as the reader draws it. */
19
32
  defaultSpan?: number;
@@ -6,6 +6,8 @@ export interface ChartChoice {
6
6
  /** Listed but not pickable; `reason` says what the view would need. */
7
7
  disabled?: boolean;
8
8
  reason?: string;
9
+ /** A quiet second line on a choice that can be picked: what it means. */
10
+ hint?: string;
9
11
  }
10
12
  /** Why a view is absent, so the reason on a disabled choice says whether to wait or to pick another. */
11
13
  export type ViewStatus = "loading" | "unlisted";
@@ -13,11 +15,11 @@ export type ViewStatus = "loading" | "unlisted";
13
15
  * Every chart a cell can be set to; one the view cannot render is listed disabled with its reason, so it is discoverable rather than missing.
14
16
  * Whatever the cell has now stays selectable, so the select never shows a value it does not offer.
15
17
  */
16
- export declare function chartChoices(view: Pick<CatalogView, "chart" | "aggregateOnly"> | undefined, current: ChartState, viewStatus?: ViewStatus): ChartChoice[];
18
+ export declare function chartChoices(view: Pick<CatalogView, "chart" | "aggregateOnly" | "shape"> | undefined, current: ChartState, viewStatus?: ViewStatus): ChartChoice[];
17
19
  export declare function ChartPicker({ state, view, viewStatus, cellLabel, disabledReason, onOpen, onChange, variant, }: {
18
20
  state: ChartState;
19
21
  /** The catalog's view this cell runs, when it is one the catalog knows. */
20
- view: Pick<CatalogView, "chart" | "aggregateOnly"> | undefined;
22
+ view: Pick<CatalogView, "chart" | "aggregateOnly" | "shape"> | undefined;
21
23
  /** Why `view` is absent, worded into the reasons on the charts that need its shape. */
22
24
  viewStatus?: ViewStatus;
23
25
  /** Which cell this is, so the control is named apart from its neighbours. */
@@ -1,17 +1,33 @@
1
+ import { CompiledModel } from '../../client';
1
2
  import { ReportLayout } from '../Package/documentLocation';
2
3
  import { DashboardDocument } from './document';
3
4
  import { SavesTo } from './documentSession';
4
5
  import { TextSourceOptions } from './ReportEditor';
5
6
  import { ReportEventHandler } from '../Report/telemetry';
6
7
  import { BuilderControlsHandler } from './builderControls';
7
- export declare function EditorSurface({ textSource, environmentName, packageName, modelPath, versionId, opened, replaces, onSave, onDirtyChange, onExit, onOpenModel, onControlsChange, draftKey, onEvent, savesTo, saveLabel, note, }: {
8
+ export declare function EditorSurface({ textSource, environmentName, packageName, modelPath, versionId, queryVersionId, opened, replaces, onSave, onDirtyChange, onExit, onOpenModel, onControlsChange, draftKey, onEvent, savesTo, saveLabel, note, fileModel, }: {
9
+ /**
10
+ * The file's own compiled model as the package serves it, for the shapes
11
+ * of the views it declares (which charts each tile can take). Absent for a
12
+ * document held as text, whose compile answer carries no per-view shapes,
13
+ * and whenever the opened text is not the one this model compiled (a kept
14
+ * draft, the host's record, a held-back version): the catalog answers then.
15
+ */
16
+ fileModel?: CompiledModel;
8
17
  textSource?: TextSourceOptions;
9
18
  environmentName: string;
10
19
  packageName: string;
11
20
  modelPath: string;
12
21
  /** A display label; the editor keys on `modelPath`. */
13
22
  slug: string;
23
+ /** The document's version, from its `resourceUri`: what its control state is keyed by. */
14
24
  versionId?: string;
25
+ /**
26
+ * The package version every query runs at: tiles, the manifest, filter
27
+ * options, the listing and the catalog. `ReportEditor` passes its
28
+ * `queryVersionId`, or the document's own version when there is none.
29
+ */
30
+ queryVersionId?: string;
15
31
  opened: {
16
32
  source: string;
17
33
  document: DashboardDocument;
@@ -118,6 +118,24 @@ export type ReportEditorProps = ({
118
118
  keepDraft?: boolean;
119
119
  /** Edit a document held as text; see {@link TextSourceOptions}. */
120
120
  textSource?: TextSourceOptions;
121
+ /**
122
+ * The package version the builder's queries run at, apart from the
123
+ * document's own identity: every tile, the report's manifest, filter
124
+ * options and suggestions, the report listing and the field catalog.
125
+ *
126
+ * The document is still the one `resourceUri` and `path` name, so the kept
127
+ * draft, where a save goes, the save caption and whether a save is a pinned
128
+ * one all follow `resourceUri` alone. A host editing a package that is
129
+ * republished on every change passes an unversioned `resourceUri` and the
130
+ * version its reader ran at here: the builder then reuses the reader's
131
+ * results instead of running every tile again, and kept edits survive the
132
+ * next republish.
133
+ *
134
+ * Unset, queries run at the `resourceUri`'s version, as before. A text-held
135
+ * document's compile has no version, so it is compiled as today; its tiles
136
+ * do run at this version.
137
+ */
138
+ queryVersionId?: string;
121
139
  };
122
140
  /**
123
141
  * Open a document the host keeps as TEXT, rather than a file in a package.
@@ -10,7 +10,7 @@ import { DashboardTile, QueryTile } from './document';
10
10
  * itself is `children` — the host's real `DashboardTile`, or a placeholder
11
11
  * saying what the tile will run.
12
12
  */
13
- export declare function TileFrame({ tile, index, selected, flash, menuOpen, bare, onInsertAfter, onSelect, onOpenMenu, onRemove, removeBlocked, resizing, width, onResizeStart, onResizeMove, onResizeEnd, children, }: {
13
+ export declare function TileFrame({ tile, index, selected, flash, menuOpen, bare, onInsertAfter, onSelect, onOpenMenu, onRemove, removeBlocked, resizing, width, onResizeStart, onResizeMove, onResizeEnd, heightEdge, fixed, children, }: {
14
14
  tile: DashboardTile;
15
15
  index: number;
16
16
  selected: boolean;
@@ -42,8 +42,30 @@ export declare function TileFrame({ tile, index, selected, flash, menuOpen, bare
42
42
  width?: {
43
43
  span: number;
44
44
  columns: number;
45
+ /** The widest it may go, when that is less than the grid: a placed tile stops at the right edge. */
46
+ max?: number;
45
47
  onStep: (to: number) => void;
46
48
  };
49
+ /**
50
+ * The bottom edge, which sets the height in grid rows: dragged, or focused
51
+ * and stepped with the arrow keys. Delete or a double-click puts the tile
52
+ * back to fitting its content. Absent, the tile has no bottom handle.
53
+ */
54
+ /** The tile cannot be moved now (the grid is drawn as one column). */
55
+ fixed?: boolean;
56
+ heightEdge?: {
57
+ /** Its rows: the set height, or the drag's preview; absent on auto, as tall as its row. */
58
+ rows: number | undefined;
59
+ /** This edge is being dragged. */
60
+ dragging: boolean;
61
+ /** The fewest rows offered: a chart's floor, or prose's. */
62
+ min: number;
63
+ onStart: (event: PointerEvent<HTMLDivElement>) => void;
64
+ onMove: (event: PointerEvent<HTMLDivElement>) => void;
65
+ onEnd: (event: PointerEvent<HTMLDivElement>) => void;
66
+ /** A keyboard step, or `undefined` to fit the content again. */
67
+ onStep: (to: number | undefined) => void;
68
+ };
47
69
  children: ReactNode;
48
70
  }): import("react/jsx-runtime").JSX.Element;
49
71
  /** How far the selection stands outside what it selects: its halo. */
@@ -92,3 +114,13 @@ export declare function GapTarget({ after }: {
92
114
  export declare function GridGuides({ columns }: {
93
115
  columns: number;
94
116
  }): import("react/jsx-runtime").JSX.Element;
117
+ /**
118
+ * The rows a height snaps to, drawn while a tile's bottom edge is dragged: a
119
+ * faint band per row across the whole canvas, the way {@link GridGuides}
120
+ * draws the columns a width snaps to. Rows are counted from the dragged
121
+ * tile's top, since tiles flow and the grid has no row lines of its own.
122
+ * Behind the tiles and held inside the grid.
123
+ */
124
+ export declare function RowGuides({ top }: {
125
+ top: number;
126
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { CatalogView } from './catalog';
2
2
  import { DashboardTile } from './document';
3
+ import { ViewStatus } from './ChartPicker';
3
4
  /**
4
5
  * A tile's own settings, on the tile: a menu off its ⋯ button, so editing it
5
6
  * never means scrolling away from it. Its chart (a submenu, each pick drawn at
@@ -33,6 +34,8 @@ export interface TileMenuProps {
33
34
  /** Why the tile cannot be copied, when it cannot: Duplicate is then listed, greyed, with this under it. */
34
35
  duplicateBlocked?: string;
35
36
  /** The catalog's view the tile shows, when the catalog knows it: what decides which charts are offered. */
36
- view?: Pick<CatalogView, "chart" | "aggregateOnly">;
37
+ view?: Pick<CatalogView, "chart" | "aggregateOnly" | "shape">;
38
+ /** Why `view` is absent: still loading, or a view the catalog does not list. */
39
+ viewStatus?: ViewStatus;
37
40
  }
38
- export declare function TileMenu({ anchor, tile, onClose, onCommit, onDrills, onDuplicate, duplicateBlocked, view, }: TileMenuProps): import("react/jsx-runtime").JSX.Element;
41
+ export declare function TileMenu({ anchor, tile, onClose, onCommit, onDrills, onDuplicate, duplicateBlocked, view, viewStatus, }: TileMenuProps): import("react/jsx-runtime").JSX.Element;
@@ -30,6 +30,13 @@ export interface CatalogView {
30
30
  chart?: string;
31
31
  /** Every output column is an aggregate, which is the only shape `big_value` renders. Absent when the model did not say. */
32
32
  aggregateOnly?: boolean;
33
+ /** How many of its output columns are group-bys and how many are totals, when the model said: what decides which charts can draw it. */
34
+ shape?: ViewShape;
35
+ }
36
+ /** A view's output columns by role: a group-by is a field a chart can put on its x axis, a total one it can put on its y axis. */
37
+ export interface ViewShape {
38
+ groupBys: number;
39
+ totals: number;
33
40
  }
34
41
  export interface CatalogSource {
35
42
  name: string;
@@ -52,7 +59,23 @@ export interface CatalogSource {
52
59
  }
53
60
  export interface PackageCatalog {
54
61
  sources: CatalogSource[];
62
+ /**
63
+ * The views the report file itself declares, by source then view, from the
64
+ * file's own compiled model: an inline `view: kpis is { aggregate: … }` is
65
+ * in no other model, so without these the builder could not tell which
66
+ * charts such a tile can take. Absent until that model has answered.
67
+ */
68
+ documentViews?: Map<string, Map<string, CatalogView>>;
55
69
  }
70
+ /**
71
+ * The views a report file declares, from its own compiled model, keyed by
72
+ * source then view. The file's sources extend the package's, so its model
73
+ * lists their views too; only the ones under the file's own source names are
74
+ * the file's, and those are what a tile in it names. Each carries the chart
75
+ * its view declares, as a catalog view does: a pick negates that tag, and
76
+ * without it a `# line_chart` view picked as a bar would ask for both.
77
+ */
78
+ export declare function documentViewsOf(model: CompiledModel): Map<string, Map<string, CatalogView>>;
56
79
  /**
57
80
  * The fields a filter on `source` may name: its dimensions, joins included as
58
81
  * paths. Measures are not filterable with `where:` and are left out. Undefined
@@ -1,11 +1,7 @@
1
- /**
2
- * The one `# <chart>` tag line a builder writes above a tile or a query cell.
3
- * Pure text, with no Malloy import, so both writers and the main entry can reach it.
4
- */
5
1
  /** The renderer's chart tags, as they are spelled in a model. */
6
2
  export declare const CHART_TAGS: string[];
7
3
  /** The tags the renderer has a plugin for, in the order a line negates them. */
8
- declare const PLUGIN_TAGS: readonly ["line_chart", "bar_chart", "big_value", "scatter_chart", "shape_map", "segment_map"];
4
+ declare const PLUGIN_TAGS: readonly ["line_chart", "bar_chart", "big_value", "scatter_chart", "shape_map", "segment_map", "combo_chart"];
9
5
  export type ChartPick = (typeof PLUGIN_TAGS)[number];
10
6
  /** What a picker holds: a chart, no chart (a table), the view's own (no line), or a line the builder does not model. */
11
7
  export type ChartState = ChartPick | "none" | "default" | "custom";
@@ -18,16 +14,53 @@ export interface ChartLineParts {
18
14
  export declare function parseChartLine(line: string): ChartLineParts | undefined;
19
15
  /** Some other `#` tag line that names a chart tag (`# bar_chart { size=spark }`), which a chart edit must leave alone. */
20
16
  export declare function mentionsChartTag(line: string): boolean;
17
+ /**
18
+ * The line that previews "Default" on a tile whose saved body may carry
19
+ * a chart line of its own: the chart tags taken off, and nothing put on.
20
+ * Unlike Table's line it does not negate `viz`, so it is not a choice of
21
+ * rendering: what the view's own shape gives is what draws.
22
+ *
23
+ * `big_value` is left alone. A one-row view of totals draws as big numbers
24
+ * with no tag at all (see `promoteMeasureRowToKpis`), which is what "From the
25
+ * view" must show; measured, a `# big_value` after a `# -big_value` in the
26
+ * same result does not bring the cards back, and the tile drew a one-row
27
+ * table. Big value can only have been picked on such a view, so keeping it
28
+ * changes nothing that Default would otherwise show.
29
+ */
30
+ export declare function chartResetLine(): string;
21
31
  /**
22
32
  * The line for a pick. Given the chart tags the view carries it negates only those; without them
23
33
  * (the catalog does not know the view) it negates every other chart tag. `-viz` stays either way,
24
34
  * since the catalog does not report a `viz=` tag.
35
+ *
36
+ * Table also negates `big_value` always. A one-row view of totals draws as big numbers with no
37
+ * tag of its own (`promoteMeasureRowToKpis` puts `# big_value` ahead of the view's lines), so
38
+ * "the view carries none" is not "nothing to take off": only a `-big_value` after it draws a table.
25
39
  */
26
40
  export declare function chartLineText(chart: ChartPick | "none", carried?: readonly string[]): string;
27
41
  /** The picker state of a tile's or cell's recognized chart lines. */
28
42
  export declare function chartStateOf(lines: string[]): ChartState;
29
43
  /** What a tile's `#` lines say about its chart: nothing (undefined), a state, or "custom" when any line names a chart tag the builder does not model. */
30
44
  export declare function chartStateOfTagLines(lines: string[]): ChartState | undefined;
45
+ /** The colour a builder-written colour line sets, or undefined for any other line. */
46
+ export declare function seriesColorOf(line: string): string | undefined;
47
+ /** The colour line for a tile's chart colour. */
48
+ export declare const seriesColorLine: (color: string) => string;
49
+ /**
50
+ * The line that takes a saved colour line off, for a preview of a tile set
51
+ * back to the theme's colours. The tag parser deletes just that path, so any
52
+ * other `theme.*` setting on the view stays.
53
+ */
54
+ export declare const seriesColorResetLine = "# -theme.palette.series";
55
+ /** Whether a colour is one the builder writes: `#rrggbb`. */
56
+ export declare const isSeriesColor: (value: string) => boolean;
57
+ /**
58
+ * A theme colour as the builder writes it (`#rrggbb`, lower case), or
59
+ * undefined for one it cannot write. A host theme may spell its series `#abc`,
60
+ * which is widened; a named colour or `rgb()` is not offered, since a line
61
+ * holding one would not read back (`seriesColorOf`).
62
+ */
63
+ export declare function seriesColorFrom(value: string): string | undefined;
31
64
  /** The lines of `lines` that are about the chart, recognized or not: what a "custom" state is made of. */
32
65
  export declare const chartLinesOf: (lines: string[]) => string[];
33
66
  export {};
@@ -131,8 +131,8 @@ export interface MappingRow {
131
131
  * `inline` tile's own first stage — `TreeStage.wheres` in `malloyTree`, which
132
132
  * is the parse tree's answer rather than a depth count. Both forms are
133
133
  * declarations this file owns and the reader reads back. An `inherited` tile is declared on the
134
- * model's source, which the builder never writes, so it is the one kind this
135
- * excludes, and so is an `opaque` one: its body has no single block a binding
134
+ * model's source, which the builder never writes, so it is excluded, as is a
135
+ * named `query` tile, and so is an `opaque` one: its body has no single block a binding
136
136
  * belongs in, which the reader can see before a save is ever attempted.
137
137
  */
138
138
  export declare const canBind: (tile: DashboardTile) => tile is QueryTile;
@@ -80,7 +80,7 @@ export interface DashboardDrill {
80
80
  /**
81
81
  * Where a tile's view is declared, and therefore what the builder may edit.
82
82
  *
83
- * Four forms, all of them found in dashboards that ship in this repository, and
83
+ * Five forms, all of them found in dashboards that ship in this repository, and
84
84
  * the distinction decides which affordances a tile gets:
85
85
  *
86
86
  * - `reference` — `view: revenue_trend is sales_by_month` in this file. Fully
@@ -102,6 +102,12 @@ export interface DashboardDrill {
102
102
  * tile is `orders -> by_brand` against an imported source. Nothing about it is
103
103
  * editable here, because its tags live on the model's own view and the builder
104
104
  * does not write model files. Read and shown, not changed.
105
+ * - `query` — the entry names a query rather than a view: `tiles=["by_carrier"]`
106
+ * over a `query: by_carrier is flights -> { … }`, in this file or the model.
107
+ * The tile runs `run: by_carrier`, exactly as the reader does, and has no
108
+ * `source` of its own. Like `inherited` it is read and shown, and moved or
109
+ * removed in the list, but not changed: its tags sit on a `query:` statement
110
+ * the writer does not locate, and its body may be anything a query can be.
105
111
  */
106
112
  export type TileDeclaration = {
107
113
  kind: "reference";
@@ -113,6 +119,8 @@ export type TileDeclaration = {
113
119
  why: string;
114
120
  } | {
115
121
  kind: "inherited";
122
+ } | {
123
+ kind: "query";
116
124
  };
117
125
  /** A tile that runs a view: a view shown on the page, plus how it is presented. */
118
126
  export interface QueryTile {
@@ -128,9 +136,10 @@ export interface QueryTile {
128
136
  /**
129
137
  * The source it reads, by NAME — an index would break on reorder. May name a
130
138
  * source this file declares in {@link DashboardDocument.sources}, or one it
131
- * merely imports.
139
+ * merely imports. Absent on a tile that names a query (`declaration.kind`
140
+ * `"query"`), whose source is whatever the query's own definition reads.
132
141
  */
133
- source: string;
142
+ source?: string;
134
143
  declaration: TileDeclaration;
135
144
  /**
136
145
  * Given bindings: a `+ { where: … }` refinement on a `reference` tile, or a
@@ -160,14 +169,38 @@ export interface QueryTile {
160
169
  chartLines?: string[];
161
170
  /** The chart tags the tile's view carries, when the catalog knows them: the writer negates only these. Never read from a file. */
162
171
  chartCarried?: string[];
172
+ /**
173
+ * Where the tile sits: its entry's `colspan` and `break` in `tiles=[…]`,
174
+ * or else its view's `# colspan` and `# break`. The writer puts a changed
175
+ * layout on the entry, which every tile has, and takes the view's two tags
176
+ * off a view this file declares, so the layout has one home.
177
+ */
163
178
  colspan?: number;
164
179
  break?: boolean;
180
+ /** `rowspan=N` on its entry: the grid rows it is tall. Only the entry carries it. */
181
+ rowspan?: number;
182
+ /** `row=N` and `col=N` on its entry: where it sits on a placed report, counted from 1. */
183
+ row?: number;
184
+ col?: number;
165
185
  borderless?: boolean;
186
+ /**
187
+ * The chart's colour, `#rrggbb`: its first series colour, written as the
188
+ * per-chart theme line `# theme.palette.series=["#…"]` the renderer reads.
189
+ * Absent, the chart takes the theme's own series.
190
+ */
191
+ color?: string;
192
+ /**
193
+ * The tile's own tags set `theme.palette.series` in a line the builder did
194
+ * not write: a list of two or more colours, or any other spelling. Read from
195
+ * the file, never written. The preview keeps that line when the tile is on
196
+ * Theme, where it otherwise takes a saved builder colour off.
197
+ */
198
+ ownPalette?: true;
166
199
  }
167
200
  /**
168
201
  * A markdown tile: prose between the query tiles, written as a `##|(markdown) <name>` block
169
- * and listed in `tiles=[…]` as `<name> { kind=text }`. Its width and row break live on that
170
- * list entry, since a block has no tags.
202
+ * and listed in `tiles=[…]` as `<name> { kind=text }`. Its layout lives on that list entry,
203
+ * as every tile's does.
171
204
  */
172
205
  export interface TextTile {
173
206
  kind: "text";
@@ -176,6 +209,9 @@ export interface TextTile {
176
209
  markdown: string;
177
210
  colspan?: number;
178
211
  break?: boolean;
212
+ rowspan?: number;
213
+ row?: number;
214
+ col?: number;
179
215
  }
180
216
  export type DashboardTile = QueryTile | TextTile;
181
217
  export declare const isTextTile: (tile: DashboardTile) => tile is TextTile;
@@ -211,6 +247,18 @@ export interface DashboardSource {
211
247
  /** Givens the extension's own `where:`s read, which filter every tile on it. Read-only: never written. */
212
248
  scopedBy?: string[];
213
249
  }
250
+ /**
251
+ * What a query tile runs, as its `tiles=[…]` entry names it: `source -> view`,
252
+ * or a query's bare name. The one spelling every preview, served-tile lookup
253
+ * and new list entry derives from.
254
+ */
255
+ export declare const tileExpression: (tile: QueryTile) => string;
256
+ /**
257
+ * Whether the builder can write nothing about this tile but its place in the
258
+ * list: declared on the model's view (`inherited`), or a named query, whose
259
+ * tags are on a `query:` statement the writer does not edit.
260
+ */
261
+ export declare const isReadOnlyTile: (tile: QueryTile) => boolean;
214
262
  /** A tile's identity across a reorder: what the grid keys on, a drag names and the writer matches. */
215
263
  export declare const tileKey: (tile: DashboardTile) => string;
216
264
  /** `dimension: <name> is <expression>` in the dashboard's own extension. */
@@ -1,4 +1,11 @@
1
1
  import { DashboardDocument, DashboardImport } from './document';
2
+ /**
3
+ * The package path an import names, read from where the document sits, so
4
+ * `"../m.malloy"` and `"./../m.malloy"` are the same model: comparing the text
5
+ * alone would miss the second, and importing a source the file already
6
+ * reaches declares it twice.
7
+ */
8
+ export declare const resolvedOf: (from: string, documentPath: string) => string;
2
9
  /**
3
10
  * How the report at `documentPath` names the model at `modelPath`: relative to
4
11
  * the report's own folder, with no leading `./` (`"storefront.malloy"` beside
@@ -0,0 +1,75 @@
1
+ import { DashboardTile } from './document';
2
+ /**
3
+ * Free placement on a grid report: each tile at its own `row` and `col`, so
4
+ * empty space anywhere on the grid is somewhere a tile can go.
5
+ *
6
+ * Pure: what a move or a resize does to the tiles, never how the gesture
7
+ * feels. A move or resize keeps the tile it changed where it was put and
8
+ * pushes whatever it now covers straight down, the way the grid dashboards
9
+ * people already know behave. Nothing is pulled up to close a gap, since an
10
+ * empty cell is a choice the author made.
11
+ */
12
+ /** A tile's rectangle on the grid, in rows and columns counted from 1. */
13
+ export interface Cell {
14
+ row: number;
15
+ col: number;
16
+ colspan: number;
17
+ rowspan: number;
18
+ }
19
+ /** The fewest rows the builder offers a tile: a chart needs room to draw, prose does not. */
20
+ export declare const minRowsOf: (tile: DashboardTile) => 1 | 3;
21
+ /** Rows a tile takes on a placed report: its own, or its kind's default. */
22
+ export declare const rowsOf: (tile: DashboardTile) => number;
23
+ /** A placed tile's rectangle, held to the grid; undefined for one not placed yet. */
24
+ export declare function cellOf(tile: DashboardTile, columns: number): Cell | undefined;
25
+ /** Top to bottom, then left to right: the order a placed report is read in, and written. */
26
+ export declare function inReadingOrder(tiles: readonly DashboardTile[]): DashboardTile[];
27
+ /**
28
+ * The tiles with nothing covering anything: `fixed` (the tile just moved or
29
+ * resized) stays exactly where it is, and every placed tile it, or a tile it
30
+ * pushed, now covers moves straight down to just below what it hit. Tiles
31
+ * settle top to bottom, so a pushed tile pushes the ones under it in turn.
32
+ * Without `fixed`, the first tile in reading order holds its place.
33
+ */
34
+ export declare function settle(tiles: readonly DashboardTile[], columns: number, fixed?: number): DashboardTile[];
35
+ /**
36
+ * The tiles with the one at `index` dropped at `at`. A drop onto the lower
37
+ * part of a tile that starts higher up lands just under that tile, rather
38
+ * than shoving it beneath the dropped one; a drop at or above a tile's top
39
+ * pushes that tile down. Then everything settles around where it landed.
40
+ */
41
+ export declare function dropAt(tiles: readonly DashboardTile[], index: number, at: {
42
+ row: number;
43
+ col: number;
44
+ }, columns: number): DashboardTile[];
45
+ /** A tile's box against the grid's top left corner, in px. */
46
+ export interface Box {
47
+ top: number;
48
+ left: number;
49
+ width: number;
50
+ height: number;
51
+ }
52
+ /** One column track's width in a grid `gridWidth` px wide. */
53
+ export declare const trackWidth: (gridWidth: number, columns: number) => number;
54
+ /**
55
+ * The cell a tile of `colspan` columns lands in when its top left corner is
56
+ * at (`left`, `top`) px from the grid's: the nearest row and column, held on
57
+ * the grid.
58
+ */
59
+ export declare function cellAt(left: number, top: number, colspan: number, columns: number, track: number): {
60
+ row: number;
61
+ col: number;
62
+ };
63
+ /**
64
+ * The tiles placed where they are drawn now, the first time a report is
65
+ * placed: each tile's row, column, width and height read off its box, so
66
+ * turning a flowing report into a placed one moves nothing. A tile with no
67
+ * box (not drawn) is left for the grid to place.
68
+ */
69
+ export declare function placeWhereDrawn(tiles: readonly DashboardTile[], boxes: ReadonlyArray<Box | undefined>, columns: number, track: number): DashboardTile[];
70
+ /**
71
+ * The tiles with the one at `index` placed under everything else, at the
72
+ * left, when the report is placed: where a new tile goes, so it never drops
73
+ * into a gap an author left on purpose. A report that flows is left as it is.
74
+ */
75
+ export declare function placeAtEnd(tiles: readonly DashboardTile[], index: number, columns: number): DashboardTile[];