@malloy-publisher/sdk 0.2.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +172 -204
  2. package/dist/ServerProvider-CGnLjzag.cjs.js +1 -0
  3. package/dist/{ServerProvider-ksC5Su_x.es.js → ServerProvider-DSK9rfSY.es.js} +245 -245
  4. package/dist/client/api.d.ts +13 -1
  5. package/dist/client/index.cjs.js +1 -1
  6. package/dist/client/index.es.js +1 -1
  7. package/dist/components/ApiErrorDisplay.d.ts +1 -2
  8. package/dist/components/Dashboard/Dashboard.d.ts +4 -2
  9. package/dist/components/Dashboard/promoteMeasureRow.d.ts +36 -0
  10. package/dist/components/DocumentStorage/BrowserDocumentStorage.d.ts +14 -0
  11. package/dist/components/DocumentStorage/DocumentStorage.d.ts +58 -0
  12. package/dist/components/DocumentStorage/DocumentStorageProvider.d.ts +18 -0
  13. package/dist/components/DocumentStorage/index.d.ts +3 -0
  14. package/dist/components/Model/index.d.ts +0 -1
  15. package/dist/components/RenderedResult/RenderedResult.d.ts +12 -0
  16. package/dist/components/RenderedResult/ResultContainer.d.ts +7 -1
  17. package/dist/components/RenderedResult/index.d.ts +1 -0
  18. package/dist/components/RenderedResult/resultSizing.d.ts +183 -0
  19. package/dist/components/drill/index.d.ts +1 -0
  20. package/dist/components/drill/useDrillSelf.d.ts +46 -0
  21. package/dist/components/given/filterValue.d.ts +63 -0
  22. package/dist/components/given/index.d.ts +1 -0
  23. package/dist/components/given/useGivenUrlParams.d.ts +39 -0
  24. package/dist/components/index.d.ts +2 -3
  25. package/dist/components/styles.d.ts +3 -3
  26. package/dist/core-8NVBCLZh.cjs.js +148 -0
  27. package/dist/{core-xdZbLgaF.es.js → core-B8oMW4sm.es.js} +3540 -2335
  28. package/dist/hooks/index.d.ts +1 -1
  29. package/dist/hooks/useSuggestOptions.d.ts +28 -12
  30. package/dist/index.cjs.js +281 -1
  31. package/dist/index.es.js +45803 -79
  32. package/dist/sdk.css +1 -1
  33. package/dist/styles.css +0 -1
  34. package/package.json +2 -6
  35. package/src/components/ApiErrorDisplay.tsx +1 -1
  36. package/src/components/Connections/EditConnectionDialog.tsx +96 -86
  37. package/src/components/Dashboard/Dashboard.tsx +60 -95
  38. package/src/components/Dashboard/DashboardTile.tsx +25 -2
  39. package/src/components/Dashboard/promoteMeasureRow.spec.ts +137 -0
  40. package/src/components/Dashboard/promoteMeasureRow.ts +129 -0
  41. package/src/components/DocumentStorage/BrowserDocumentStorage.spec.ts +81 -0
  42. package/src/components/DocumentStorage/BrowserDocumentStorage.ts +105 -0
  43. package/src/components/DocumentStorage/DocumentStorage.ts +73 -0
  44. package/src/components/DocumentStorage/DocumentStorageProvider.tsx +46 -0
  45. package/src/components/DocumentStorage/index.ts +15 -0
  46. package/src/components/Environment/Connections.tsx +15 -15
  47. package/src/components/Model/ModelCell.tsx +2 -1
  48. package/src/components/Model/index.ts +0 -1
  49. package/src/components/Notebook/Notebook.tsx +10 -76
  50. package/src/components/Notebook/NotebookCell.tsx +2 -8
  51. package/src/components/RenderedResult/RenderedResult.tsx +86 -76
  52. package/src/components/RenderedResult/ResultContainer.tsx +21 -24
  53. package/src/components/RenderedResult/index.ts +15 -0
  54. package/src/components/RenderedResult/resultSizing.spec.ts +249 -0
  55. package/src/components/RenderedResult/resultSizing.ts +308 -0
  56. package/src/components/ResultsDialog.tsx +2 -1
  57. package/src/components/drill/index.ts +5 -0
  58. package/src/components/drill/useDrillSelf.spec.tsx +64 -0
  59. package/src/components/drill/useDrillSelf.ts +110 -0
  60. package/src/components/given/GivenInput.spec.tsx +196 -2
  61. package/src/components/given/GivenInput.tsx +300 -25
  62. package/src/components/given/filterValue.spec.ts +112 -0
  63. package/src/components/given/filterValue.ts +188 -0
  64. package/src/components/given/index.ts +4 -0
  65. package/src/components/given/useGivenUrlParams.spec.tsx +74 -0
  66. package/src/components/given/useGivenUrlParams.ts +87 -0
  67. package/src/components/index.ts +5 -3
  68. package/src/hooks/index.ts +0 -1
  69. package/src/hooks/useGivensState.spec.ts +158 -0
  70. package/src/hooks/useGivensState.ts +114 -23
  71. package/src/hooks/useSuggestOptions.dom.spec.ts +60 -1
  72. package/src/hooks/useSuggestOptions.ts +94 -51
  73. package/vite.config.ts +0 -1
  74. package/dist/ServerProvider-xXW1HJOJ.cjs.js +0 -1
  75. package/dist/components/AnalyzePackageButton.d.ts +0 -6
  76. package/dist/components/Workbook/BrowserWorkbookStorage.d.ts +0 -9
  77. package/dist/components/Workbook/EditableMalloyCell.d.ts +0 -11
  78. package/dist/components/Workbook/ModelPicker.d.ts +0 -11
  79. package/dist/components/Workbook/MutableCell.d.ts +0 -17
  80. package/dist/components/Workbook/Workbook.d.ts +0 -7
  81. package/dist/components/Workbook/WorkbookList.d.ts +0 -7
  82. package/dist/components/Workbook/WorkbookManager.d.ts +0 -84
  83. package/dist/components/Workbook/WorkbookStorage.d.ts +0 -17
  84. package/dist/components/Workbook/WorkbookStorageProvider.d.ts +0 -12
  85. package/dist/components/Workbook/index.d.ts +0 -7
  86. package/dist/core-RvrkY1Ss.cjs.js +0 -148
  87. package/dist/index-B3scIDRd.cjs.js +0 -356
  88. package/dist/index-Bda7HuZc.es.js +0 -66409
  89. package/dist/markdown-editor.css +0 -341
  90. package/src/components/AnalyzePackageButton.tsx +0 -319
  91. package/src/components/Workbook/BrowserWorkbookStorage.ts +0 -64
  92. package/src/components/Workbook/EditableMalloyCell.tsx +0 -49
  93. package/src/components/Workbook/ModelPicker.tsx +0 -134
  94. package/src/components/Workbook/MutableCell.tsx +0 -458
  95. package/src/components/Workbook/Workbook.tsx +0 -501
  96. package/src/components/Workbook/WorkbookList.tsx +0 -110
  97. package/src/components/Workbook/WorkbookManager.ts +0 -214
  98. package/src/components/Workbook/WorkbookStorage.ts +0 -35
  99. package/src/components/Workbook/WorkbookStorageProvider.tsx +0 -40
  100. package/src/components/Workbook/index.ts +0 -10
@@ -0,0 +1,105 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ import type {
5
+ DocumentLocator,
6
+ DocumentStorage,
7
+ DocumentType,
8
+ Workspace,
9
+ } from "./DocumentStorage";
10
+
11
+ const LOCAL_WORKSPACE: Workspace = {
12
+ name: "Local",
13
+ description: "Stored in this browser only",
14
+ writeable: true,
15
+ };
16
+
17
+ /**
18
+ * Every key this store writes starts with this, so it can list its own
19
+ * documents without reading everything else the page keeps in localStorage
20
+ * (the theme mode, other libraries' state). The predecessor enumerated every
21
+ * key as a document.
22
+ */
23
+ const KEY_PREFIX = "publisher:document:";
24
+
25
+ /**
26
+ * A {@link DocumentStorage} in the browser's localStorage: one workspace,
27
+ * `Local`, private to this browser and this origin. The Console's default, and
28
+ * what a host uses before it has a store of its own.
29
+ */
30
+ export class BrowserDocumentStorage implements DocumentStorage {
31
+ async listWorkspaces(writeableOnly: boolean): Promise<Workspace[]> {
32
+ void writeableOnly; // the one workspace is writeable
33
+ return [LOCAL_WORKSPACE];
34
+ }
35
+
36
+ async listDocuments(
37
+ workspace: Workspace,
38
+ type?: DocumentType,
39
+ ): Promise<DocumentLocator[]> {
40
+ if (workspace.name !== LOCAL_WORKSPACE.name) return [];
41
+ const found: DocumentLocator[] = [];
42
+ for (let i = 0; i < localStorage.length; i++) {
43
+ const key = localStorage.key(i);
44
+ const locator = key === null ? undefined : locatorOf(key);
45
+ if (locator && (type === undefined || locator.type === type)) {
46
+ found.push(locator);
47
+ }
48
+ }
49
+ return found;
50
+ }
51
+
52
+ async getDocument(locator: DocumentLocator): Promise<string> {
53
+ const content = localStorage.getItem(keyOf(locator));
54
+ if (content === null) throw missing(locator);
55
+ return content;
56
+ }
57
+
58
+ async saveDocument(
59
+ locator: DocumentLocator,
60
+ content: string,
61
+ ): Promise<void> {
62
+ localStorage.setItem(keyOf(locator), content);
63
+ }
64
+
65
+ async deleteDocument(locator: DocumentLocator): Promise<void> {
66
+ const key = keyOf(locator);
67
+ if (localStorage.getItem(key) === null) throw missing(locator);
68
+ localStorage.removeItem(key);
69
+ }
70
+
71
+ async moveDocument(
72
+ from: DocumentLocator,
73
+ to: DocumentLocator,
74
+ ): Promise<void> {
75
+ const content = await this.getDocument(from);
76
+ localStorage.setItem(keyOf(to), content);
77
+ localStorage.removeItem(keyOf(from));
78
+ }
79
+ }
80
+
81
+ function keyOf(locator: DocumentLocator): string {
82
+ // The type is one segment; the path may contain anything, so it goes last
83
+ // and is read back as "the rest".
84
+ return `${KEY_PREFIX}${locator.type}:${locator.path}`;
85
+ }
86
+
87
+ function locatorOf(key: string): DocumentLocator | undefined {
88
+ if (!key.startsWith(KEY_PREFIX)) return undefined;
89
+ const rest = key.slice(KEY_PREFIX.length);
90
+ const separator = rest.indexOf(":");
91
+ if (separator <= 0) return undefined;
92
+ const type = rest.slice(0, separator);
93
+ if (type !== "dashboard" && type !== "notebook") return undefined;
94
+ return {
95
+ workspace: LOCAL_WORKSPACE.name,
96
+ type,
97
+ path: rest.slice(separator + 1),
98
+ };
99
+ }
100
+
101
+ function missing(locator: DocumentLocator): Error {
102
+ return new Error(
103
+ `No ${locator.type} at ${locator.workspace}/${locator.path}`,
104
+ );
105
+ }
@@ -0,0 +1,73 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ /**
5
+ * Where authored documents are kept, as an interface the host hands the SDK.
6
+ *
7
+ * The SDK renders dashboards and notebooks that a Publisher server serves out
8
+ * of a package, and it will author them too, but it does not decide where an
9
+ * authored document goes. That is the host's business: the Console keeps one
10
+ * in the browser, a platform keeps one in its own document store, a repo-backed
11
+ * host writes it to the package directory. So the SDK asks for a
12
+ * {@link DocumentStorage} through {@link DocumentStorageProvider} and calls it,
13
+ * and never touches a backend itself.
14
+ *
15
+ * A document is a string. The interface does not know whether it is a
16
+ * `dashboards/*.malloy` file, a `.malloynb`, or something else; the
17
+ * {@link DocumentLocator.type} says what kind it is so a backend can keep the
18
+ * kinds apart (a database column, a directory, a key prefix) and a listing can
19
+ * ask for one kind. Everything else a backend may know about a document, who
20
+ * changed it and when, who may see it, stays with the backend.
21
+ *
22
+ * Every method rejects rather than returning a sentinel when the document is
23
+ * not there, so a caller can tell "missing" from "empty".
24
+ */
25
+
26
+ /**
27
+ * The kinds of document the SDK authors. A `dashboard` is a
28
+ * `dashboards/<slug>.malloy` file; a `notebook` is a `.malloynb`.
29
+ */
30
+ export type DocumentType = "dashboard" | "notebook";
31
+
32
+ /** A place documents live, as the backend presents it to a reader. */
33
+ export interface Workspace {
34
+ name: string;
35
+ /** False for a workspace this reader may list and open but not save into. */
36
+ writeable: boolean;
37
+ description: string;
38
+ }
39
+
40
+ /** One document's address: which workspace, which kind, and its path there. */
41
+ export interface DocumentLocator {
42
+ workspace: string;
43
+ type: DocumentType;
44
+ /**
45
+ * The document's path within the workspace, spelled the way the backend
46
+ * spells it. For a repo-backed store that is the file path relative to the
47
+ * package (`dashboards/overview.malloy`); a database store may use a slug.
48
+ */
49
+ path: string;
50
+ }
51
+
52
+ export interface DocumentStorage {
53
+ /** The workspaces this reader can see; only the writeable ones when asked. */
54
+ listWorkspaces(writeableOnly: boolean): Promise<Workspace[]>;
55
+
56
+ /** Every document in a workspace, or only those of one kind. */
57
+ listDocuments(
58
+ workspace: Workspace,
59
+ type?: DocumentType,
60
+ ): Promise<DocumentLocator[]>;
61
+
62
+ /** The document's content. Rejects when there is no document there. */
63
+ getDocument(locator: DocumentLocator): Promise<string>;
64
+
65
+ /** Write the content, creating the document or replacing it. */
66
+ saveDocument(locator: DocumentLocator, content: string): Promise<void>;
67
+
68
+ /** Remove the document. Rejects when there is no document there. */
69
+ deleteDocument(locator: DocumentLocator): Promise<void>;
70
+
71
+ /** Rename or relocate a document, keeping its content. Rejects when `from` is missing. */
72
+ moveDocument(from: DocumentLocator, to: DocumentLocator): Promise<void>;
73
+ }
@@ -0,0 +1,46 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ import React, { createContext, useContext, useMemo } from "react";
5
+ import type { DocumentStorage } from "./DocumentStorage";
6
+
7
+ export interface DocumentStorageProviderProps {
8
+ children: React.ReactNode;
9
+ documentStorage: DocumentStorage;
10
+ }
11
+
12
+ interface DocumentStorageContextValue {
13
+ documentStorage: DocumentStorage;
14
+ }
15
+
16
+ const DocumentStorageContext = createContext<
17
+ DocumentStorageContextValue | undefined
18
+ >(undefined);
19
+
20
+ /**
21
+ * Hands a {@link DocumentStorage} to every SDK component beneath it. The host
22
+ * constructs the storage; the SDK only ever reads it through
23
+ * {@link useDocumentStorage}.
24
+ */
25
+ export function DocumentStorageProvider({
26
+ children,
27
+ documentStorage,
28
+ }: DocumentStorageProviderProps) {
29
+ const value = useMemo(() => ({ documentStorage }), [documentStorage]);
30
+ return (
31
+ <DocumentStorageContext.Provider value={value}>
32
+ {children}
33
+ </DocumentStorageContext.Provider>
34
+ );
35
+ }
36
+
37
+ /** The host's storage, or a thrown error outside a provider: there is no default. */
38
+ export function useDocumentStorage(): DocumentStorageContextValue {
39
+ const context = useContext(DocumentStorageContext);
40
+ if (!context) {
41
+ throw new Error(
42
+ "useDocumentStorage must be used within a DocumentStorageProvider",
43
+ );
44
+ }
45
+ return context;
46
+ }
@@ -0,0 +1,15 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ export type {
5
+ DocumentLocator,
6
+ DocumentStorage,
7
+ DocumentType,
8
+ Workspace,
9
+ } from "./DocumentStorage";
10
+ export {
11
+ DocumentStorageProvider,
12
+ useDocumentStorage,
13
+ type DocumentStorageProviderProps,
14
+ } from "./DocumentStorageProvider";
15
+ export { BrowserDocumentStorage } from "./BrowserDocumentStorage";
@@ -117,13 +117,19 @@ export default function Connections({ resourceUri }: ConnectionsProps) {
117
117
  });
118
118
 
119
119
  const deleteConnection = useMutationWithApiError({
120
+ // The dedicated endpoint, not a PATCH of the filtered list. Updating the
121
+ // environment upserts the connections it still holds and never drops the
122
+ // row for one that went away, so a deleted connection came back on the
123
+ // next boot. This path removes the row and cleans up a duckdb/ducklake
124
+ // connection's database file.
120
125
  mutationFn: (payload: ApiConnection) => {
121
- return apiClients.environments.updateEnvironment(environmentName, {
122
- name: environmentName,
123
- connections: data!.data.filter(
124
- (conn) => conn.name !== payload.name,
125
- ),
126
- });
126
+ if (!payload.name) {
127
+ throw new Error("Cannot delete a connection with no name");
128
+ }
129
+ return apiClients.connections.deleteConnection(
130
+ environmentName,
131
+ payload.name,
132
+ );
127
133
  },
128
134
  onSuccess(_data, variables) {
129
135
  setNotificationMessage(
@@ -208,15 +214,9 @@ export default function Connections({ resourceUri }: ConnectionsProps) {
208
214
  onEdit={(payload) =>
209
215
  updateConnection.mutateAsync(payload)
210
216
  }
211
- onDelete={(payload) => {
212
- if (!conn.resource) {
213
- deleteConnection.mutateAsync(payload);
214
- } else {
215
- setNotificationMessage(
216
- "Cannot delete this connection",
217
- );
218
- }
219
- }}
217
+ onDelete={(payload) =>
218
+ deleteConnection.mutateAsync(payload)
219
+ }
220
220
  />
221
221
  </Grid>
222
222
  ))}
@@ -11,6 +11,7 @@ import { parseResourceUri } from "../../utils/formatting";
11
11
  import { CHART_RESULT_QUERY_OPTIONS } from "../../utils/queryClient";
12
12
  import { highlight } from "../highlighter";
13
13
  import ResultContainer from "../RenderedResult/ResultContainer";
14
+ import { MODEL_CELL_MAX_HEIGHT } from "../RenderedResult/resultSizing";
14
15
  import ResultsDialog from "../ResultsDialog";
15
16
  import { useServer } from "../ServerProvider";
16
17
  import { CleanMetricCard, CleanNotebookCell } from "../styles";
@@ -182,7 +183,7 @@ export function ModelCell({
182
183
  queryData?.data?.result && (
183
184
  <ResultContainer
184
185
  result={queryData.data.result}
185
- maxHeight={600}
186
+ maxHeight={MODEL_CELL_MAX_HEIGHT}
186
187
  maxResultSize={maxResultSize}
187
188
  renderLogs={queryData.data.renderLogs}
188
189
  />
@@ -5,7 +5,6 @@ export { default as Model } from "./Model";
5
5
  export { ModelExplorer } from "./ModelExplorer";
6
6
  export { ModelExplorerDialog } from "./ModelExplorerDialog";
7
7
  export { SourcesExplorer } from "./SourcesExplorer";
8
- export { SourceExplorerComponent } from "./SourcesExplorer";
9
8
  export type { SourceAndPath, QueryExplorerResult } from "./SourcesExplorer";
10
9
  export { useModelData } from "./useModelData";
11
10
  export type { ModelExplorerProps } from "./ModelExplorer";
@@ -14,7 +14,7 @@ import { useSuggestOptions } from "../../hooks/useSuggestOptions";
14
14
  import { parseResourceUri } from "../../utils/formatting";
15
15
  import { ApiErrorDisplay } from "../ApiErrorDisplay";
16
16
  import type { NavigationClick } from "../click_helper";
17
- import { encodeDrillValue, type DrillNavigation } from "../drill";
17
+ import { useDrillSelf, type DrillNavigation } from "../drill";
18
18
  import { GivensPanel } from "../given";
19
19
  import { givensToRequest } from "../given/paramCodec";
20
20
  import { Loading } from "../Loading";
@@ -231,83 +231,17 @@ export default function Notebook({
231
231
  notebookPath,
232
232
  declaredGivens,
233
233
  versionId,
234
+ // So a suggest over a gated or scoped source carries the givens it needs.
235
+ { values: applied, declaredTypes },
234
236
  );
235
237
 
236
- // The declared names, indexed case-insensitively, so a drill tag resolves
237
- // whichever way the two were spelled.
238
- //
239
- // Neither convention can be assumed. `# drill` defaults the given name to
240
- // the DIMENSION's name, which is conventionally lower_snake, while givens
241
- // are conventionally SHOUTED (both in-repo examples declare `REGION` and
242
- // `MIN_AMOUNT`). An exact match therefore failed for the common case, and
243
- // upper-casing the dimension name, which is what this did first, only moved
244
- // the failure onto models that spell their givens in lower case. Folding
245
- // case resolves both instead of picking a side.
246
- const givenNamesByFold = useMemo(() => {
247
- const byFold = new Map<string, string>();
248
- for (const name of declaredTypes.keys()) {
249
- // First declaration wins, so a model with `REGION` and `region` keeps
250
- // the one it declared first rather than silently flipping.
251
- if (!byFold.has(name.toLowerCase()))
252
- byFold.set(name.toLowerCase(), name);
253
- }
254
- return byFold;
255
- }, [declaredTypes]);
256
-
257
- /** The declared given a drill tag's name refers to, or undefined. */
258
- const resolveGiven = useCallback(
259
- (given: string) =>
260
- declaredTypes.has(given)
261
- ? given
262
- : givenNamesByFold.get(given.toLowerCase()),
263
- [declaredTypes, givenNamesByFold],
264
- );
265
-
266
- // `to=self` filters in place, which only works for a given this notebook
267
- // actually declares: sending one it cannot bind would fail every cell. The
268
- // mismatch is reported to the author rather than issued: same rule, same
269
- // wording, as the dashboard viewer.
270
- // Asked before a cell is painted as drillable, so the affordance matches what
271
- // a click can actually do. The refusal below still stands as a backstop for a
272
- // caller that does not ask.
273
- const canDrillSelf = useCallback(
274
- (given: string) => resolveGiven(given) !== undefined,
275
- [resolveGiven],
276
- );
277
-
278
- const onDrillSelf = useCallback(
279
- (given: string, rawValue: unknown) => {
280
- const declared = resolveGiven(given);
281
- if (declared === undefined) {
282
- console.warn(
283
- `# drill { to=self } tried to set '${given}', which ` +
284
- `'${notebookPath}' does not declare as a given. Name the ` +
285
- `given with 'given=' on the drill tag.`,
286
- );
287
- return;
288
- }
289
- // Encoded against the declared type of the given being set, which is
290
- // knowable here and is not knowable at the click. Set under the name
291
- // the MODEL declares, not the one the tag spelled, so the value goes
292
- // into the URL and the request under the one name the server knows.
293
- const declaredType = declaredTypes.get(declared);
294
- const value = encodeDrillValue(rawValue, declaredType);
295
- if (value === undefined) {
296
- // Say so. Returning in silence left a whole column painted as
297
- // clickable while every click did nothing, and a `given=` pointing
298
- // at a type the clicked value cannot become is an authoring
299
- // mistake the author has no other way to see. The sibling refusal
300
- // in `resolveDrill` warns for the same reason.
301
- console.warn(
302
- `Drill declined: ${JSON.stringify(rawValue)} cannot be a value for given "${declared}"` +
303
- (declaredType ? ` of type ${declaredType}` : ""),
304
- );
305
- return;
306
- }
307
- setGiven(declared, value);
308
- },
309
- [declaredTypes, notebookPath, resolveGiven, setGiven],
310
- );
238
+ // `to=self` filters in place. Which givens a tag may set, and setting one
239
+ // from a clicked cell, is the same on both surfaces, so it is shared.
240
+ const { canSelf: canDrillSelf, onSelf: onDrillSelf } = useDrillSelf({
241
+ declaredTypes,
242
+ setGiven,
243
+ documentName: notebookPath,
244
+ });
311
245
 
312
246
  /**
313
247
  * The `givens` query param for the notebook-cell GET: the same map the
@@ -29,17 +29,11 @@ import type { NavigationClick } from "../click_helper";
29
29
  import { useDrill, type DrillNavigation } from "../drill";
30
30
  import { createEmbeddedQueryResult } from "../QueryResult/QueryResult";
31
31
  import ResultContainer from "../RenderedResult/ResultContainer";
32
+ import { NOTEBOOK_CELL_MAX_HEIGHT } from "../RenderedResult/resultSizing";
32
33
  import ResultsDialog from "../ResultsDialog";
33
34
  import { CleanMetricCard, CleanNotebookCell } from "../styles";
34
35
  import { EnhancedNotebookCell } from "./types";
35
36
 
36
- /**
37
- * Cap for a cell result that lays itself out: a table, mostly. Tall enough for
38
- * a screenful of rows, after which the cell scrolls rather than the page
39
- * turning into one long table.
40
- */
41
- const CELL_MAX_HEIGHT = 700;
42
-
43
37
  interface NotebookCellProps {
44
38
  cell: EnhancedNotebookCell;
45
39
  expandCodeCell?: boolean;
@@ -670,7 +664,7 @@ export function NotebookCell({
670
664
  >
671
665
  <ResultContainer
672
666
  result={cell.result}
673
- maxHeight={CELL_MAX_HEIGHT}
667
+ maxHeight={NOTEBOOK_CELL_MAX_HEIGHT}
674
668
  maxResultSize={maxResultSize}
675
669
  drill={drill}
676
670
  />