@malloy-publisher/sdk 0.4.0 → 0.5.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 (72) hide show
  1. package/README.md +19 -0
  2. package/dist/{DocumentStorageProvider-CyOJ0hqf.es.js → DocumentStorage-B04sZ5Ie.es.js} +2307 -2334
  3. package/dist/{DocumentStorageProvider-DGPQEd_l.cjs.js → DocumentStorage-B_MMJ0Ot.cjs.js} +20 -20
  4. package/dist/{RenderedResult-BnPzJ9Jf.es.js → RenderedResult-BB7eokcf.es.js} +100 -80
  5. package/dist/RenderedResult-DVuGhatg.cjs.js +135 -0
  6. package/dist/ServerProvider-D-jjzfE5.cjs.js +1 -0
  7. package/dist/{ServerProvider-BWOEKg0O.es.js → ServerProvider-Do-GBvpn.es.js} +492 -481
  8. package/dist/builder/index.cjs.js +57 -52
  9. package/dist/builder/index.es.js +4421 -3738
  10. package/dist/client/api.d.ts +14 -1
  11. package/dist/client/index.cjs.js +1 -1
  12. package/dist/client/index.es.js +1 -1
  13. package/dist/components/Dashboard/TileCard.d.ts +7 -3
  14. package/dist/components/Dashboard/telemetry.d.ts +20 -8
  15. package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +16 -4
  16. package/dist/components/DashboardBuilder/DashboardEditor.d.ts +31 -8
  17. package/dist/components/DashboardBuilder/controls.d.ts +8 -6
  18. package/dist/components/DashboardBuilder/document.d.ts +19 -5
  19. package/dist/components/DashboardBuilder/malloyText.d.ts +0 -30
  20. package/dist/components/DashboardBuilder/malloyTree.d.ts +232 -0
  21. package/dist/components/DashboardBuilder/preview.d.ts +17 -0
  22. package/dist/components/DashboardBuilder/readDocument.d.ts +23 -28
  23. package/dist/components/DashboardBuilder/spliceDocument.d.ts +12 -0
  24. package/dist/components/DocumentStorage/DocumentStorage.d.ts +69 -5
  25. package/dist/components/DocumentStorage/index.d.ts +1 -0
  26. package/dist/index.cjs.js +9 -9
  27. package/dist/index.es.js +508 -506
  28. package/dist/theme/resolveTheme.d.ts +1 -1
  29. package/dist/theme/types.d.ts +12 -2
  30. package/package.json +1 -1
  31. package/src/components/Dashboard/TileCard.tsx +8 -4
  32. package/src/components/Dashboard/telemetry.ts +20 -8
  33. package/src/components/DashboardBuilder/BuilderToolbar.tsx +4 -5
  34. package/src/components/DashboardBuilder/DashboardBuilder.tsx +21 -3
  35. package/src/components/DashboardBuilder/DashboardEditor.authoritative.spec.tsx +706 -0
  36. package/src/components/DashboardBuilder/DashboardEditor.resourceUri.spec.tsx +356 -0
  37. package/src/components/DashboardBuilder/DashboardEditor.tsx +468 -103
  38. package/src/components/DashboardBuilder/FilterDialog.tsx +19 -6
  39. package/src/components/DashboardBuilder/TileFrame.tsx +11 -2
  40. package/src/components/DashboardBuilder/TileMenu.tsx +6 -0
  41. package/src/components/DashboardBuilder/__test__/inventory.ts +367 -0
  42. package/src/components/DashboardBuilder/controls.spec.ts +53 -3
  43. package/src/components/DashboardBuilder/controls.ts +9 -7
  44. package/src/components/DashboardBuilder/document.ts +17 -5
  45. package/src/components/DashboardBuilder/invariants.spec.ts +297 -0
  46. package/src/components/DashboardBuilder/malloyText.spec.ts +27 -66
  47. package/src/components/DashboardBuilder/malloyText.ts +4 -109
  48. package/src/components/DashboardBuilder/malloyTree.spec.ts +362 -0
  49. package/src/components/DashboardBuilder/malloyTree.ts +954 -0
  50. package/src/components/DashboardBuilder/preview.spec.ts +18 -0
  51. package/src/components/DashboardBuilder/preview.ts +24 -6
  52. package/src/components/DashboardBuilder/readDocument.spec.ts +312 -21
  53. package/src/components/DashboardBuilder/readDocument.ts +144 -165
  54. package/src/components/DashboardBuilder/scannerShapes.spec.ts +550 -0
  55. package/src/components/DashboardBuilder/spliceDocument.spec.ts +955 -21
  56. package/src/components/DashboardBuilder/spliceDocument.ts +509 -119
  57. package/src/components/DashboardBuilder/statementExtent.spec.ts +606 -0
  58. package/src/components/DocumentStorage/BrowserDocumentStorage.ts +7 -6
  59. package/src/components/DocumentStorage/DocumentStorage.ts +78 -5
  60. package/src/components/DocumentStorage/index.ts +1 -0
  61. package/src/components/Package/Package.tsx +12 -7
  62. package/src/components/RenderedResult/RenderedResult.tsx +21 -1
  63. package/src/components/given/GivensPanel.tsx +15 -3
  64. package/src/theme/buildTableCssVars.spec.ts +3 -0
  65. package/src/theme/buildTableCssVars.ts +6 -0
  66. package/src/theme/defaults.ts +16 -12
  67. package/src/theme/resolveTheme.spec.ts +14 -7
  68. package/src/theme/resolveTheme.ts +14 -8
  69. package/src/theme/types.ts +12 -2
  70. package/tsconfig.spec.json +5 -1
  71. package/dist/RenderedResult-Dp22kZsQ.cjs.js +0 -115
  72. package/dist/ServerProvider-Cc489A3f.cjs.js +0 -1
@@ -10,11 +10,13 @@ import type {
10
10
  LocalGiven,
11
11
  } from "./document";
12
12
  import {
13
- type DeclarationAt,
14
- declarationsUnder,
15
- givenDeclarations,
16
- tileSteps,
17
- } from "./malloyText";
13
+ parseMalloy,
14
+ parseRefused,
15
+ type ParsedMalloy,
16
+ type TreeStage,
17
+ type TreeView,
18
+ } from "./malloyTree";
19
+ import { tileSteps } from "./malloyText";
18
20
 
19
21
  /**
20
22
  * Read a `dashboards/*.malloy` file into a {@link DashboardDocument}.
@@ -24,10 +26,10 @@ import {
24
26
  * in the browser and in a unit test alike, which is what lets the suite open
25
27
  * every dashboard in the repository as a regression gate.
26
28
  *
27
- * Structure comes from the parser's symbol tree, which covers imports (including
28
- * the items of a named list), sources, views and dimensions, each with a source
29
- * RANGE. Content comes from the text inside those ranges, and tags from
30
- * `parseAnnotation` over the block above each declaration.
29
+ * Structure comes from Malloy's own parse tree, through `malloyTree`: imports,
30
+ * sources, views, dimensions, givens and every `where:` clause, each with an
31
+ * exact span. Tags come from `parseAnnotation` over the `#` block above a
32
+ * declaration, which is `malloy-tag`'s grammar rather than Malloy's.
31
33
  *
32
34
  * Reading tags from the text rather than from the server, which serves them
33
35
  * already attached, is deliberate. The splice writer has to LOCATE a tag in
@@ -64,7 +66,7 @@ export type ReadResult =
64
66
  export const readFailed = (result: ReadResult): result is ReadFailure =>
65
67
  result.ok === false;
66
68
 
67
- /** A `#`/`//` block above a declaration, and where it sits. */
69
+ /** A `#`/comment block above a declaration, and where it sits. */
68
70
  export interface Block {
69
71
  /** 0-based line of the first line in the block. */
70
72
  start: number;
@@ -76,27 +78,32 @@ export interface Block {
76
78
  }
77
79
 
78
80
  /**
79
- * The comment-and-tag block immediately above `declLine`.
81
+ * The comment-and-tag block immediately above `declLine`, up to the blank line
82
+ * that is the author's own separator. Validated against the bundled dashboard,
83
+ * where it collects `revenue_trend`'s three tags and the fourteen-line comment
84
+ * explaining its colspan, then stops at the blank line above — which is the
85
+ * right unit to carry when that tile moves.
80
86
  *
81
- * Scans upward while lines are `#` tags or `//` comments and STOPS AT A BLANK
82
- * LINE. Validated against the bundled dashboard, where it collects
83
- * `revenue_trend`'s three tags and the fourteen-line comment explaining its
84
- * colspan, then stops at the blank line above — which is the right unit to carry
85
- * when that tile moves.
86
- *
87
- * A blank line is the author's own separator, which is why it is the boundary
88
- * rather than a count or a heuristic about comment content.
87
+ * WHERE the block starts comes from `parsed`, which takes its comments from the
88
+ * lexer, and not from a scan for `//` here. Malloy spells a comment three ways
89
+ * — `//`, `--` and `/* … *\/` — and this walked upward looking only for the
90
+ * first. The other two stopped it early while the parser read straight past
91
+ * them, so a `#` tag above one was visible to the reader and invisible to the
92
+ * writer, which then wrote a SECOND copy of the tag below the comment. The
93
+ * reader picks the lower one up and the read-back gate is satisfied, so the
94
+ * file quietly ends up carrying two.
89
95
  */
90
- export function blockAbove(lines: string[], declLine: number): Block {
91
- let start = declLine;
92
- for (let i = declLine - 1; i >= 0; i--) {
93
- const text = lines[i].trim();
94
- if (text === "") break;
95
- if (text.startsWith("#") || text.startsWith("//")) start = i;
96
- else break;
97
- }
96
+ export function blockAbove(
97
+ parsed: ParsedMalloy,
98
+ lines: string[],
99
+ declLine: number,
100
+ ): Block {
101
+ const start = parsed.blockStart(declLine);
98
102
  const tags: Array<{ line: number; text: string }> = [];
99
103
  for (let i = start; i < declLine; i++) {
104
+ // Inside a `/* … */`, where a line beginning `#` is prose. Rewriting one
105
+ // would put an edit inside a comment.
106
+ if (parsed.commentLine(i)) continue;
100
107
  const text = lines[i].trim();
101
108
  // `##` at this indent level is a MODEL annotation and never belongs to a
102
109
  // declaration; only single-`#` object tags do.
@@ -128,53 +135,26 @@ function modelLines(lines: string[]): {
128
135
  };
129
136
  }
130
137
 
131
- /** `source: overview is scoped_orders extend {` -> `scoped_orders`. */
132
- function sourceBase(text: string, name: string): string | undefined {
133
- const m = new RegExp(
134
- `source:\\s*${name}\\s+is\\s+([A-Za-z_][A-Za-z0-9_.]*)`,
135
- ).exec(text);
136
- return m?.[1];
137
- }
138
-
139
138
  /**
140
- * `view: revenue_trend is sales_by_month + { where: … }` -> base and filters,
141
- * or `inline` for `view: order_tile is { aggregate: … }`, which is a query body
142
- * rather than a reference and is read but never rewritten.
143
- */
144
- function viewBody(
145
- text: string,
146
- name: string,
147
- ):
148
- | { kind: "reference"; from: string; refinement?: string }
149
- | { kind: "inline" }
150
- | undefined {
151
- const ref = new RegExp(
152
- `view:\\s*${name}\\s+is\\s+([A-Za-z_][A-Za-z0-9_.]*)\\s*(\\+\\s*\\{[\\s\\S]*\\})?`,
153
- ).exec(text);
154
- if (ref)
155
- return { kind: "reference", from: ref[1], refinement: ref[2]?.trim() };
156
- if (new RegExp(`view:\\s*${name}\\s+is\\s*\\{`).test(text))
157
- return { kind: "inline" };
158
- return undefined;
159
- }
160
-
161
- /**
162
- * One `where: <field> <op> $<GIVEN>` clause. Exported for the writer, which
163
- * has to find the same clauses in order to replace them and nothing else.
139
+ * The builder-managed filters of a `{ … }` block: every clause the tree says
140
+ * is exactly `field <op> $GIVEN`.
141
+ *
142
+ * A clause that is anything else — a compound predicate, a literal comparison
143
+ * — is not a binding and is left exactly as written. That is a STRUCTURAL
144
+ * test now, so the isolation heuristics this used to need are gone along with
145
+ * the shapes that defeated them.
164
146
  */
165
- export const BINDING_CLAUSE =
166
- /where:\s*([A-Za-z_][A-Za-z0-9_.]*)\s*(~|>=|<=|!=|=|>|<)\s*\$([A-Za-z_][A-Za-z0-9_]*)/g;
167
-
168
- /** `where: products.brand ~ $BRAND`, `where: created_at >= $SINCE` … */
169
- function filtersOf(refinement: string | undefined) {
170
- if (!refinement) return undefined;
147
+ function filtersOf(
148
+ stage: TreeStage | undefined,
149
+ ): Array<{ field: string; given: string; op?: string }> | undefined {
150
+ if (!stage) return undefined;
171
151
  const out: Array<{ field: string; given: string; op?: string }> = [];
172
- for (const m of refinement.matchAll(BINDING_CLAUSE))
173
- out.push({
174
- field: m[1],
175
- given: m[3],
176
- ...(m[2] === "~" ? {} : { op: m[2] }),
177
- });
152
+ for (const where of stage.wheres)
153
+ for (const clause of where.clauses) {
154
+ if (!clause.binding) continue;
155
+ const { field, op, given } = clause.binding;
156
+ out.push({ field, given, ...(op === "~" ? {} : { op }) });
157
+ }
178
158
  return out.length > 0 ? out : undefined;
179
159
  }
180
160
 
@@ -189,10 +169,7 @@ type TagLike = {
189
169
  type ParseTags = (lines: string[]) => { tag?: TagLike | null };
190
170
 
191
171
  /**
192
- * `given:` declarations, which the parser's symbol tree does not cover at all —
193
- * its types are query, unnamed_query, explore, field, join, import and
194
- * import_item. So these are read as text, in BOTH spellings Malloy accepts and
195
- * this repository uses:
172
+ * `given:` declarations, in BOTH spellings Malloy accepts:
196
173
  *
197
174
  * given: CATEGORY :: filter<string> is f'' // one per line
198
175
  *
@@ -200,18 +177,17 @@ type ParseTags = (lines: string[]) => { tag?: TagLike | null };
200
177
  * CATEGORY :: filter<string> is f''
201
178
  * SINCE :: date is @2023-01-01
202
179
  *
203
- * The one-line form is what `givens.malloy` and the docs write and what the
204
- * builder emits; the block form is read so a file written the other way still
205
- * opens. Either way the tags above a declaration are its control contract.
180
+ * Either way the `#` tags above a declaration are its control contract.
206
181
  */
207
182
  export function localGivens(
183
+ parsed: ParsedMalloy,
208
184
  lines: string[],
209
185
  parse: ParseTags,
210
186
  ): LocalGiven[] | undefined {
211
187
  const out: LocalGiven[] = [];
212
- for (const at of givenDeclarations(lines).values()) {
213
- const m = /^([A-Z_][A-Z0-9_]*)\s*::\s*(\S+)\s+is\s+(.+)$/.exec(
214
- at.declaration,
188
+ for (const given of parsed.givens) {
189
+ const m = /^([A-Za-z_][A-Za-z0-9_]*)\s*::\s*(\S+)\s+is\s+([\s\S]+)$/.exec(
190
+ given.declaration,
215
191
  );
216
192
  if (!m) continue;
217
193
  out.push({
@@ -219,7 +195,7 @@ export function localGivens(
219
195
  type: m[2],
220
196
  default: m[3].trim(),
221
197
  ...readControlTags(
222
- parse(tagText(blockAbove(lines, at.line).tags)).tag,
198
+ parse(tagText(blockAbove(parsed, lines, given.line).tags)).tag,
223
199
  ),
224
200
  });
225
201
  }
@@ -273,16 +249,17 @@ function tileEntries(artifactLine: string): string[] {
273
249
  export async function readDashboardDocument(
274
250
  sourceText: string,
275
251
  ): Promise<ReadResult> {
276
- const { Malloy } = await import("@malloydata/malloy");
277
252
  const { parseAnnotation } = await import("@malloydata/malloy-tag");
278
253
  const lines = sourceText.split("\n");
279
254
 
280
- let symbols;
281
- try {
282
- symbols = Malloy.parse({ source: sourceText }).symbols;
283
- } catch (error) {
284
- return { ok: false, reason: `This file is not valid Malloy: ${error}` };
285
- }
255
+ const parse = await parseMalloy(sourceText);
256
+ if (parseRefused(parse))
257
+ return {
258
+ ok: false,
259
+ reason: parse.reason,
260
+ ...(parse.line ? { line: parse.line } : {}),
261
+ };
262
+ const parsed = parse.parsed;
286
263
 
287
264
  const { description, artifact } = modelLines(lines);
288
265
  const artifactLine = artifact.find((l) => l.includes("artifact"));
@@ -305,75 +282,47 @@ export async function readDashboardDocument(
305
282
  };
306
283
  }
307
284
 
308
- const imports: DashboardImport[] = [];
285
+ const imports: DashboardImport[] = parsed.imports.map((i) =>
286
+ i.names
287
+ ? { kind: "names", names: i.names, from: i.from }
288
+ : { kind: "all", from: i.from },
289
+ );
309
290
  const sources: DashboardSource[] = [];
310
291
  const drills: DashboardDrill[] = [];
311
- const viewsBySource = new Map<string, Map<string, DeclarationAt>>();
312
-
313
- for (const symbol of symbols) {
314
- if (symbol.type === "import") {
315
- const names = (symbol.children ?? [])
316
- .filter((c) => c.type === "import_item")
317
- .map((c) => String(c.name));
318
- imports.push(
319
- names.length > 0
320
- ? { kind: "names", names, from: String(symbol.name) }
321
- : { kind: "all", from: String(symbol.name) },
322
- );
323
- continue;
324
- }
325
- if (symbol.type !== "explore") continue;
326
-
327
- const name = String(symbol.name);
328
- const head = lines[symbol.range.start.line] ?? "";
329
- const base = sourceBase(head, name);
330
- if (base === undefined) {
331
- return {
332
- ok: false,
333
- reason: `Could not read what source \`${name}\` extends.`,
334
- line: symbol.range.start.line + 1,
335
- };
336
- }
337
- sources.push({ name, base });
338
-
339
- // The VIEWS are found in the TEXT, attributed to the nearest `source:`
340
- // above them, and not taken from the symbol tree. The tree is reliable
341
- // about which sources and imports exist and unreliable about what is
342
- // inside a source: measured, a refinement spelled `+ { limit: 5, where: … }`
343
- // — which compiles — makes it report the refined view's BASE as a child
344
- // view, end the source early, and drop the next declaration altogether,
345
- // so the tile that named it read back as "inherited" and lost its tags.
346
- // A `view: <name> is` line under a `source: <name> is` line is
347
- // unambiguous, and Malloy has no nested sources to confuse it.
348
- const views = declarationsUnder(lines, name, "view");
349
- // Dimensions the same way, and drills off THEIR tag blocks: a `# drill`
350
- // is a tag on a dimension's declaration, so the dimensions this file
351
- // declares are exactly where one can be authored.
352
- const dimensions = declarationsUnder(lines, name, "dimension");
353
- if (dimensions.size > 0) {
354
- sources[sources.length - 1].dimensions = [...dimensions].map(
355
- ([dimensionName, at]) => ({
356
- name: dimensionName,
357
- expression: at.rest,
358
- }),
359
- );
360
- }
361
- for (const [dimensionName, at] of dimensions) {
362
- const { tags } = blockAbove(lines, at.line);
363
- const drillTag = parseAnnotation(tagText(tags)).tag?.tag("drill");
292
+ const viewsBySource = new Map<string, Map<string, TreeView>>();
293
+
294
+ for (const source of parsed.sources) {
295
+ const entry: DashboardSource = { name: source.name, base: source.base };
296
+ if (source.dimensions.length > 0)
297
+ entry.dimensions = source.dimensions.map((d) => ({
298
+ name: d.name,
299
+ expression: d.expression,
300
+ }));
301
+ sources.push(entry);
302
+
303
+ // A `# drill` is a tag on a dimension's declaration, so the dimensions
304
+ // this file declares are exactly where one can be authored.
305
+ for (const dimension of source.dimensions) {
306
+ const drillTag = parseAnnotation(
307
+ tagText(blockAbove(parsed, lines, dimension.line).tags),
308
+ ).tag?.tag("drill");
364
309
  if (!drillTag) continue;
365
310
  const to = drillTag.textArray("to") ?? [drillTag.text("to") ?? ""];
366
311
  drills.push({
367
- source: name,
368
- name: dimensionName,
369
- expression: at.rest,
312
+ source: source.name,
313
+ name: dimension.name,
314
+ expression: dimension.expression,
370
315
  to: to.filter(Boolean),
371
316
  ...(drillTag.text("given")
372
317
  ? { given: drillTag.text("given") as string }
373
318
  : {}),
374
319
  });
375
320
  }
376
- viewsBySource.set(name, views);
321
+
322
+ viewsBySource.set(
323
+ source.name,
324
+ new Map(source.views.map((v) => [v.name, v])),
325
+ );
377
326
  }
378
327
 
379
328
  const tiles: DashboardTile[] = [];
@@ -388,14 +337,14 @@ export async function readDashboardDocument(
388
337
  };
389
338
  }
390
339
  const { source: sourceName, view: viewName } = steps;
391
- const declLine = viewsBySource.get(sourceName)?.get(viewName)?.line;
340
+ const view = viewsBySource.get(sourceName)?.get(viewName);
392
341
 
393
342
  // Not declared here: the view belongs to an imported source, which is a
394
343
  // complete dashboard in itself — `tiles=["orders -> by_brand"]` over an
395
344
  // imported `orders` needs nothing else in the file. Shown, not editable:
396
345
  // its tags live on the model's view, and the builder does not write model
397
346
  // files.
398
- if (declLine === undefined) {
347
+ if (view === undefined) {
399
348
  tiles.push({
400
349
  name: viewName,
401
350
  source: sourceName,
@@ -404,25 +353,55 @@ export async function readDashboardDocument(
404
353
  continue;
405
354
  }
406
355
 
407
- const body = viewBody(lines[declLine], viewName);
408
- if (body === undefined) {
409
- return {
410
- ok: false,
411
- reason: `Could not read what view \`${viewName}\` is declared from.`,
412
- line: declLine + 1,
413
- };
356
+ const t = parseAnnotation(tagText(view.tags)).tag;
357
+ const declaration:
358
+ | { kind: "reference"; from: string }
359
+ | { kind: "inline" }
360
+ | undefined =
361
+ view.body.kind === "reference"
362
+ ? { kind: "reference" as const, from: view.body.from }
363
+ : view.body.kind === "inline"
364
+ ? { kind: "inline" as const }
365
+ : undefined;
366
+ if (declaration === undefined) {
367
+ // Declared here, in a body the builder does not rewrite. Its tags are
368
+ // still `#` lines in this file, so they come with it: only a filter
369
+ // has nowhere to go.
370
+ tiles.push({
371
+ name: viewName,
372
+ source: sourceName,
373
+ declaration: {
374
+ kind: "opaque",
375
+ why:
376
+ view.body.kind === "unsupported"
377
+ ? view.body.why
378
+ : "unreadable",
379
+ },
380
+ ...(t?.text("label") ? { label: t.text("label") as string } : {}),
381
+ ...(t?.text("subtitle")
382
+ ? { subtitle: t.text("subtitle") as string }
383
+ : {}),
384
+ ...(t?.numeric("colspan") !== undefined
385
+ ? { colspan: t.numeric("colspan") as number }
386
+ : {}),
387
+ ...(t?.has("break") ? { break: true } : {}),
388
+ ...(t?.has("borderless") ? { borderless: true } : {}),
389
+ });
390
+ continue;
414
391
  }
415
- const { tags } = blockAbove(lines, declLine);
416
- const t = parseAnnotation(tagText(tags)).tag;
417
- const filters =
418
- body.kind === "reference" ? filtersOf(body.refinement) : undefined;
392
+ // A refinement's filters, or an inline body's own — the same clauses
393
+ // either way, located by the tree rather than by depth in the text.
394
+ const filters = filtersOf(
395
+ view.body.kind === "reference"
396
+ ? view.body.refinement
397
+ : view.body.kind === "inline"
398
+ ? view.body.stage
399
+ : undefined,
400
+ );
419
401
  tiles.push({
420
402
  name: viewName,
421
403
  source: sourceName,
422
- declaration:
423
- body.kind === "reference"
424
- ? { kind: "reference", from: body.from }
425
- : { kind: "inline" },
404
+ declaration,
426
405
  ...(filters ? { filters } : {}),
427
406
  ...(t?.text("label") ? { label: t.text("label") as string } : {}),
428
407
  ...(t?.text("subtitle")
@@ -436,7 +415,7 @@ export async function readDashboardDocument(
436
415
  });
437
416
  }
438
417
 
439
- const givens = localGivens(lines, parseAnnotation as ParseTags);
418
+ const givens = localGivens(parsed, lines, parseAnnotation as ParseTags);
440
419
 
441
420
  const startingGivens: Record<string, string> = {};
442
421
  const givensTag = artifactTag?.tag("givens");