@malloy-publisher/sdk 0.10.2 → 0.10.3

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 (47) hide show
  1. package/dist/{RenderedResult-BCJC0ZVj.es.js → RenderedResult-B_sW7neX.es.js} +328 -265
  2. package/dist/RenderedResult-BlYdT4lz.cjs.js +179 -0
  3. package/dist/builder/index.cjs.js +1 -1
  4. package/dist/builder/index.es.js +2 -2
  5. package/dist/client/api.d.ts +1 -1
  6. package/dist/components/Dashboard/DashboardView.d.ts +10 -3
  7. package/dist/components/Dashboard/DownloadRowsCsv.d.ts +10 -0
  8. package/dist/components/Dashboard/RowsDialog.d.ts +63 -21
  9. package/dist/components/Dashboard/index.d.ts +2 -0
  10. package/dist/components/Dashboard/rowsCsv.d.ts +26 -0
  11. package/dist/components/RenderedResult/ResultContainer.d.ts +2 -3
  12. package/dist/components/RenderedResult/resultSizing.d.ts +2 -0
  13. package/dist/components/Report/Report.d.ts +8 -1
  14. package/dist/components/drill/drillClauses.d.ts +34 -0
  15. package/dist/components/drill/drillClickRelay.d.ts +36 -0
  16. package/dist/components/drill/resolveDrill.d.ts +29 -0
  17. package/dist/components/drill/rowsTarget.d.ts +114 -0
  18. package/dist/components/drill/useDrill.d.ts +24 -12
  19. package/dist/index.cjs.js +13 -11
  20. package/dist/index.es.js +7331 -6886
  21. package/dist/{useCompiledDocument-C995sQ3j.cjs.js → useCompiledDocument-CyPOSStA.cjs.js} +31 -31
  22. package/dist/{useCompiledDocument-Citpvpnx.es.js → useCompiledDocument-xJRD5DRP.es.js} +1587 -1574
  23. package/dist/utils/malloyString.d.ts +2 -1
  24. package/package.json +1 -1
  25. package/src/components/Dashboard/DashboardView.tsx +54 -28
  26. package/src/components/Dashboard/DownloadRowsCsv.tsx +152 -0
  27. package/src/components/Dashboard/RowsDialog.actions.spec.tsx +250 -0
  28. package/src/components/Dashboard/RowsDialog.drill.compile.spec.ts +672 -0
  29. package/src/components/Dashboard/RowsDialog.spec.ts +38 -11
  30. package/src/components/Dashboard/RowsDialog.tsx +194 -40
  31. package/src/components/Dashboard/index.ts +2 -0
  32. package/src/components/Dashboard/rowsCsv.spec.ts +105 -0
  33. package/src/components/Dashboard/rowsCsv.ts +107 -0
  34. package/src/components/RenderedResult/RenderedResult.tsx +44 -7
  35. package/src/components/RenderedResult/ResultContainer.tsx +2 -2
  36. package/src/components/RenderedResult/resultSizing.ts +3 -0
  37. package/src/components/Report/Report.tsx +9 -0
  38. package/src/components/drill/drillClauses.ts +201 -0
  39. package/src/components/drill/drillClickRelay.spec.ts +122 -0
  40. package/src/components/drill/drillClickRelay.ts +106 -0
  41. package/src/components/drill/resolveDrill.ts +29 -0
  42. package/src/components/drill/rowsTarget.ts +245 -0
  43. package/src/components/drill/useDrill.spec.tsx +311 -15
  44. package/src/components/drill/useDrill.tsx +206 -67
  45. package/src/components/legacy/malloynb/NotebookCell.tsx +0 -7
  46. package/src/utils/malloyString.ts +21 -2
  47. package/dist/RenderedResult-B5f4qOjp.cjs.js +0 -171
@@ -1,85 +1,85 @@
1
- import { jsx as M } from "react/jsx-runtime";
2
- import { Box as ie } from "@mui/material";
3
- import { Suspense as pe, useRef as z, useCallback as ge, useMemo as ve, useEffect as we, useLayoutEffect as ke } from "react";
4
- import { r as xe, a as he, D as Ce, b as Y, T as H, l as Re, c as Ee, d as Te, e as _e, m as Ae, f as Se, g as se } from "./useCompiledDocument-Citpvpnx.es.js";
1
+ import { jsx as I } from "react/jsx-runtime";
2
+ import { Box as se } from "@mui/material";
3
+ import { Suspense as ge, useRef as M, useMemo as de, useEffect as ve, useLayoutEffect as we } from "react";
4
+ import { r as ke, a as be, D as xe, b as Q, T as V, l as Ce, c as Re, d as Ee, e as Te, R as Ae, m as Se, f as _e, g as ce } from "./useCompiledDocument-xJRD5DRP.es.js";
5
5
  import { ba as De, b8 as Oe, bb as Fe, bc as ze } from "./ServerProvider-BN399NH6.es.js";
6
- const v = xe.drillCell;
7
- function Me(e, t) {
8
- const a = /* @__PURE__ */ new Set();
9
- let l;
6
+ const g = ke.drillCell;
7
+ function Le(e, t) {
8
+ const r = /* @__PURE__ */ new Set();
9
+ let a;
10
10
  try {
11
- l = e.getMetadata()?.getAllFields() ?? [];
11
+ a = e.getMetadata()?.getAllFields() ?? [];
12
12
  } catch {
13
- return a;
13
+ return r;
14
14
  }
15
- const r = /* @__PURE__ */ new Set();
16
- for (const o of l)
17
- !o || t(o) || o.tag?.tag("hidden") === void 0 && r.add(o.tag?.text("label") ?? o.name);
18
- for (const o of l) {
19
- if (!o || !t(o)) continue;
20
- const n = o.tag?.text("label") ?? o.name;
21
- r.has(n) || a.add(n);
15
+ const o = /* @__PURE__ */ new Set();
16
+ for (const n of a)
17
+ !n || t(n) || n.tag?.tag("hidden") === void 0 && o.add(n.tag?.text("label") ?? n.name);
18
+ for (const n of a) {
19
+ if (!n || !t(n)) continue;
20
+ const l = n.tag?.text("label") ?? n.name;
21
+ o.has(l) || r.add(l);
22
22
  }
23
- return a;
23
+ return r;
24
24
  }
25
- function L(e) {
25
+ function B(e) {
26
26
  const t = /^\s*(\d+)/.exec(e.style?.gridColumn ?? "");
27
27
  return t ? t[1] : void 0;
28
28
  }
29
- function Ie(e, t) {
29
+ function Me(e, t) {
30
30
  if (t.size !== 0)
31
- for (const a of e.querySelectorAll(
31
+ for (const r of e.querySelectorAll(
32
32
  ".malloy-table"
33
33
  )) {
34
- const l = (n) => n.closest(".malloy-table") === a, r = /* @__PURE__ */ new Set();
35
- for (const n of a.querySelectorAll(
34
+ const a = (l) => l.closest(".malloy-table") === r, o = /* @__PURE__ */ new Set();
35
+ for (const l of r.querySelectorAll(
36
36
  ".column-cell.th"
37
37
  )) {
38
- if (!l(n)) continue;
39
- const i = (n.textContent ?? "").replace(/\u200b/g, "").trim(), h = L(n);
40
- h && t.has(i) && r.add(h);
38
+ if (!a(l)) continue;
39
+ const i = (l.textContent ?? "").replace(/\u200b/g, "").trim(), h = B(l);
40
+ h && t.has(i) && o.add(h);
41
41
  }
42
- if (r.size === 0) continue;
43
- const o = /* @__PURE__ */ new Set();
44
- for (const n of a.querySelectorAll(
45
- `.${v}[tabindex="0"]`
42
+ if (o.size === 0) continue;
43
+ const n = /* @__PURE__ */ new Set();
44
+ for (const l of r.querySelectorAll(
45
+ `.${g}[tabindex="0"]`
46
46
  )) {
47
- if (!l(n)) continue;
48
- const i = L(n);
49
- i && (o.has(i) ? n.tabIndex = -1 : o.add(i));
47
+ if (!a(l)) continue;
48
+ const i = B(l);
49
+ i && (n.has(i) ? l.tabIndex = -1 : n.add(i));
50
50
  }
51
- for (const n of a.querySelectorAll(
51
+ for (const l of r.querySelectorAll(
52
52
  ".column-cell.td"
53
53
  )) {
54
- if (!l(n)) continue;
55
- const i = L(n), h = !n.querySelector(".value-null") && (n.textContent ?? "").trim() !== "";
56
- if (i && h && r.has(i) && !n.querySelector(".malloy-table")) {
57
- if (n.classList.add(v), n.tabIndex === 0)
58
- o.add(i);
54
+ if (!a(l)) continue;
55
+ const i = B(l), h = !l.querySelector(".value-null") && (l.textContent ?? "").trim() !== "";
56
+ if (i && h && o.has(i) && !l.querySelector(".malloy-table")) {
57
+ if (l.classList.add(g), l.tabIndex === 0)
58
+ n.add(i);
59
59
  else {
60
- const p = o.has(i);
61
- p || o.add(i), n.tabIndex = p ? -1 : 0;
60
+ const y = n.has(i);
61
+ y || n.add(i), l.tabIndex = y ? -1 : 0;
62
62
  }
63
- n.setAttribute("role", "button");
63
+ l.setAttribute("role", "button");
64
64
  }
65
65
  }
66
66
  }
67
67
  }
68
- function Le(e) {
69
- const t = e.closest(".malloy-table"), a = L(e);
70
- return !t || !a ? [] : Array.from(
71
- t.querySelectorAll(`.${v}`)
68
+ function Ie(e) {
69
+ const t = e.closest(".malloy-table"), r = B(e);
70
+ return !t || !r ? [] : Array.from(
71
+ t.querySelectorAll(`.${g}`)
72
72
  ).filter(
73
- (l) => l.closest(".malloy-table") === t && L(l) === a
73
+ (a) => a.closest(".malloy-table") === t && B(a) === r
74
74
  );
75
75
  }
76
- function de(e, t) {
77
- const a = Le(e), l = a.indexOf(e);
78
- if (l === -1) return;
79
- const r = t === "first" ? a[0] : t === "last" ? a[a.length - 1] : a[Math.min(Math.max(l + t, 0), a.length - 1)];
80
- if (r) {
81
- for (const o of a) o.tabIndex = o === r ? 0 : -1;
82
- return r;
76
+ function ue(e, t) {
77
+ const r = Ie(e), a = r.indexOf(e);
78
+ if (a === -1) return;
79
+ const o = t === "first" ? r[0] : t === "last" ? r[r.length - 1] : r[Math.min(Math.max(a + t, 0), r.length - 1)];
80
+ if (o) {
81
+ for (const n of r) n.tabIndex = n === o ? 0 : -1;
82
+ return o;
83
83
  }
84
84
  }
85
85
  function $e(e) {
@@ -105,123 +105,169 @@ function $e(e) {
105
105
  };
106
106
  }
107
107
  function Be(e) {
108
- const { foreground: t, axisFaint: a, gridline: l, font: r } = e, o = {
108
+ const { foreground: t, axisFaint: r, gridline: a, font: o } = e, n = {
109
109
  background: e.background,
110
- font: r.family,
111
- title: { color: t, font: r.family },
110
+ font: o.family,
111
+ title: { color: t, font: o.family },
112
112
  axis: {
113
113
  labelColor: t,
114
114
  titleColor: t,
115
- domainColor: a,
116
- tickColor: a,
117
- gridColor: l,
118
- labelFont: r.family,
119
- titleFont: r.family
115
+ domainColor: r,
116
+ tickColor: r,
117
+ gridColor: a,
118
+ labelFont: o.family,
119
+ titleFont: o.family
120
120
  },
121
121
  legend: {
122
122
  labelColor: t,
123
123
  titleColor: t,
124
- labelFont: r.family,
125
- titleFont: r.family
124
+ labelFont: o.family,
125
+ titleFont: o.family
126
126
  },
127
127
  header: { labelColor: t, titleColor: t },
128
128
  range: { category: e.series }
129
- }, n = {
130
- ...o,
131
- legend: { ...o.legend, orient: "bottom" }
129
+ }, l = {
130
+ ...n,
131
+ legend: { ...n.legend, orient: "bottom" }
132
132
  };
133
- return (i) => i === "shape_map" ? n : o;
133
+ return (i) => i === "shape_map" ? l : n;
134
134
  }
135
135
  function Ne(e) {
136
136
  if (!e) return;
137
137
  const t = e.tag("theme");
138
138
  if (!t) return;
139
- const a = {}, l = t.tag("palette");
140
- if (l) {
141
- const o = {}, n = l.textArray("series");
142
- n && n.length > 0 && (o.series = n);
139
+ const r = {}, a = t.tag("palette");
140
+ if (a) {
141
+ const n = {}, l = a.textArray("series");
142
+ l && l.length > 0 && (n.series = l);
143
143
  for (const i of De) {
144
- const h = l.tag(i);
144
+ const h = a.tag(i);
145
145
  if (!h) continue;
146
- const p = {}, k = h.text("light"), w = h.text("dark");
147
- k && (p.light = k), w && (p.dark = w), Object.keys(p).length > 0 && (o[i] = p);
146
+ const y = {}, k = h.text("light"), w = h.text("dark");
147
+ k && (y.light = k), w && (y.dark = w), Object.keys(y).length > 0 && (n[i] = y);
148
148
  }
149
- Object.keys(o).length > 0 && (a.palette = o);
149
+ Object.keys(n).length > 0 && (r.palette = n);
150
150
  }
151
- const r = t.tag("font");
152
- if (r) {
153
- const o = {}, n = r.text("family");
154
- n && (o.family = n);
155
- const i = r.numeric("size");
156
- typeof i == "number" && Number.isFinite(i) && (o.size = i), Object.keys(o).length > 0 && (a.font = o);
151
+ const o = t.tag("font");
152
+ if (o) {
153
+ const n = {}, l = o.text("family");
154
+ l && (n.family = l);
155
+ const i = o.numeric("size");
156
+ typeof i == "number" && Number.isFinite(i) && (n.size = i), Object.keys(n).length > 0 && (r.font = n);
157
157
  }
158
- return Object.keys(a).length > 0 ? a : void 0;
158
+ return Object.keys(r).length > 0 ? r : void 0;
159
159
  }
160
- const J = (e) => (e ?? []).map((t) => t?.value).filter((t) => typeof t == "string");
160
+ const Z = (e) => (e ?? []).map((t) => t?.value).filter((t) => typeof t == "string");
161
161
  function Pe(e) {
162
162
  const t = e.replace(/[-_]+/g, " ").replace(/\s+/g, " ").trim();
163
163
  return t.charAt(0).toUpperCase() + t.slice(1);
164
164
  }
165
- const je = (e) => J(e.annotations).some((t) => {
166
- const a = t.trim();
167
- return /^#[^("]/.test(a) && /(?:^#|[\s{])label\s*=/.test(a);
165
+ const je = (e) => Z(e.annotations).some((t) => {
166
+ const r = t.trim();
167
+ return /^#[^("]/.test(r) && /(?:^#|[\s{])label\s*=/.test(r);
168
168
  }), He = (e) => `"${e.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`, qe = (e) => e.type?.element_type?.fields ?? e.type?.fields;
169
- function me(e, t) {
170
- let a = !1;
171
- return { fields: e.map((r) => {
172
- const o = qe(r);
173
- if (o) {
174
- const i = me(
175
- o,
176
- he(J(r.annotations))
169
+ function fe(e, t) {
170
+ let r = !1;
171
+ return { fields: e.map((o) => {
172
+ const n = qe(o);
173
+ if (n) {
174
+ const i = fe(
175
+ n,
176
+ be(Z(o.annotations))
177
177
  );
178
- if (!i.changed) return r;
179
- a = !0;
180
- const h = r.type?.element_type ? {
181
- ...r.type,
178
+ if (!i.changed) return o;
179
+ r = !0;
180
+ const h = o.type?.element_type ? {
181
+ ...o.type,
182
182
  element_type: {
183
- ...r.type.element_type,
183
+ ...o.type.element_type,
184
184
  fields: i.fields
185
185
  }
186
- } : { ...r.type, fields: i.fields };
187
- return { ...r, type: h };
186
+ } : { ...o.type, fields: i.fields };
187
+ return { ...o, type: h };
188
188
  }
189
- if (!t || !r.name || je(r)) return r;
190
- const n = Pe(r.name);
191
- return n === r.name ? r : (a = !0, {
192
- ...r,
189
+ if (!t || !o.name || je(o)) return o;
190
+ const l = Pe(o.name);
191
+ return l === o.name ? o : (r = !0, {
192
+ ...o,
193
193
  annotations: [
194
- { value: `# label=${He(n)}
194
+ { value: `# label=${He(l)}
195
195
  ` },
196
- ...r.annotations ?? []
196
+ ...o.annotations ?? []
197
197
  ]
198
198
  });
199
- }), changed: a };
199
+ }), changed: r };
200
200
  }
201
201
  function Ve(e) {
202
202
  if (!e || typeof e != "object") return e;
203
- const t = e, a = t.schema?.fields;
204
- if (!Array.isArray(a)) return e;
205
- const { fields: l, changed: r } = me(
206
- a,
207
- he(J(t.annotations))
203
+ const t = e, r = t.schema?.fields;
204
+ if (!Array.isArray(r)) return e;
205
+ const { fields: a, changed: o } = fe(
206
+ r,
207
+ be(Z(t.annotations))
208
208
  );
209
- return r ? { ...t, schema: { ...t.schema, fields: l } } : e;
209
+ return o ? { ...t, schema: { ...t.schema, fields: a } } : e;
210
210
  }
211
- const ce = 320, Xe = 10, Ke = 96, We = 4e3;
212
- function Ge(e, t) {
211
+ const he = 320, Xe = 10, We = 96, Ke = 4e3;
212
+ function Ue(e, t) {
213
213
  if (e !== "bar" && e !== "combo" && e !== "line" && e !== "chart" && e !== "scatter_chart")
214
214
  return;
215
- if (e !== "bar" && e !== "combo") return ce;
216
- const a = t?.data?.array_value?.length, l = a === void 0 ? 0 : a * Xe + Ke;
217
- return Math.min(Math.max(ce, l), We);
215
+ if (e !== "bar" && e !== "combo") return he;
216
+ const r = t?.data?.array_value?.length, a = r === void 0 ? 0 : r * Xe + We;
217
+ return Math.min(Math.max(he, a), Ke);
218
218
  }
219
- const I = "data-publisher-fill", Ue = async (e, t) => {
219
+ function Ye(e) {
220
+ let t;
221
+ return {
222
+ onClick: (r) => {
223
+ const a = {
224
+ ...r,
225
+ ...Ge(r)
226
+ };
227
+ t = a, queueMicrotask(() => {
228
+ t === a && (t = void 0), e(a);
229
+ });
230
+ },
231
+ onDrill: (r) => {
232
+ const a = t;
233
+ t = void 0, a && r.stableDrillClauses !== void 0 && (a.drillClauses = r.stableDrillClauses);
234
+ }
235
+ };
236
+ }
237
+ function Ge(e) {
238
+ const t = e.field;
239
+ try {
240
+ const r = t?.getEffectiveQueryTimezone?.();
241
+ return r ? { timezone: r } : {};
242
+ } catch {
243
+ return {};
244
+ }
245
+ }
246
+ function Je(e) {
247
+ const t = (r) => {
248
+ let a = !1;
249
+ try {
250
+ a = r.isArray?.() === !0;
251
+ } catch {
252
+ a = !1;
253
+ }
254
+ a && "stableDrillFilters" in r && Object.defineProperty(r, "stableDrillFilters", {
255
+ configurable: !0,
256
+ get: () => []
257
+ });
258
+ for (const o of r.fields ?? []) t(o);
259
+ };
260
+ e && t(e);
261
+ }
262
+ const $ = "data-publisher-fill", Qe = async (e, t, r) => {
220
263
  if (typeof window > "u")
221
264
  throw new Error("MalloyRenderer can only be used in browser environment");
222
- const { MalloyRenderer: a } = await Ee();
265
+ const { MalloyRenderer: a } = await Re();
223
266
  return new a({
224
267
  onClick: t,
268
+ // A table cell's row reaches the host only through the renderer's drill,
269
+ // which it reports only with `enableDrill` set; see `drillClickRelay`.
270
+ ...r ? { onDrill: r, tableConfig: { enableDrill: !0 } } : {},
225
271
  vegaConfigOverride: Be(e),
226
272
  // Pass the explicit theme so table chrome and dashboard tiles
227
273
  // pick up the operator's colours directly. Without this the
@@ -229,42 +275,42 @@ const I = "data-publisher-fill", Ue = async (e, t) => {
229
275
  // sourced from its built-in defaults and shadows whatever we set
230
276
  // on the outer wrapper.
231
277
  theme: $e(e),
232
- onError: (r) => {
233
- console.error("Error rendering visualization:", typeof r, r);
278
+ onError: (n) => {
279
+ console.error("Error rendering visualization:", typeof n, n);
234
280
  }
235
281
  }).createViz();
236
282
  };
237
- async function Ye(e) {
283
+ async function Ze(e) {
238
284
  if (!e || typeof e != "object") return;
239
- const t = e, a = [
285
+ const t = e, r = [
240
286
  ...Array.isArray(t.model_annotations) ? t.model_annotations : [],
241
287
  ...Array.isArray(t.source_annotations) ? t.source_annotations : [],
242
288
  ...Array.isArray(t.annotations) ? t.annotations : []
243
- ].map((r) => typeof r?.value == "string" ? r.value : void 0).filter((r) => !!r);
244
- if (a.length === 0) return;
245
- let l;
289
+ ].map((o) => typeof o?.value == "string" ? o.value : void 0).filter((o) => !!o);
290
+ if (r.length === 0) return;
291
+ let a;
246
292
  try {
247
- ({ parseAnnotation: l } = await Re());
293
+ ({ parseAnnotation: a } = await Ce());
248
294
  } catch {
249
295
  return;
250
296
  }
251
297
  try {
252
- const { tag: r } = l(a);
253
- return Ne(r);
254
- } catch (r) {
298
+ const { tag: o } = a(r);
299
+ return Ne(o);
300
+ } catch (o) {
255
301
  console.warn(
256
302
  "Failed to parse # theme.* annotations; chart will render with the shell theme.",
257
- { error: r, lines: a }
303
+ { error: o, lines: r }
258
304
  );
259
305
  return;
260
306
  }
261
307
  }
262
- function Je(e, t, a) {
263
- const l = Te(t, a);
264
- for (const [r, o] of Object.entries(l))
265
- e.style.setProperty(r, o);
308
+ function et(e, t, r) {
309
+ const a = Ee(t, r);
310
+ for (const [o, n] of Object.entries(a))
311
+ e.style.setProperty(o, n);
266
312
  }
267
- const Qe = `
313
+ const tt = `
268
314
  /* Card geometry, through the renderer's OWN theme vars rather than over the top
269
315
  of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
270
316
  passes each through to the --malloy-render--* the card CSS reads, so a value
@@ -361,25 +407,25 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
361
407
  /* Compact, in a tile set shorter than its cards (ResultContainer marks it tight): smaller values,
362
408
  tighter cards and a 190px floor, which a 22px value still fits in, so five cards share a row of
363
409
  about a thousand pixels instead of wrapping into rows the tile has no room for. */
364
- [${H}] .malloy-render .malloy-big-value:not(.malloy-big-value--embedded) {
410
+ [${V}] .malloy-render .malloy-big-value:not(.malloy-big-value--embedded) {
365
411
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
366
412
  gap: 8px;
367
413
  padding: 8px;
368
414
  }
369
- [${H}] .malloy-render .malloy-big-value-card:not(.malloy-big-value-card--embedded) {
415
+ [${V}] .malloy-render .malloy-big-value-card:not(.malloy-big-value-card--embedded) {
370
416
  padding: 9px 14px;
371
417
  }
372
- [${H}] .malloy-render .malloy-big-value-value {
418
+ [${V}] .malloy-render .malloy-big-value-value {
373
419
  font-size: 22px;
374
420
  }
375
- [${H}] .malloy-render .malloy-big-value-label {
421
+ [${V}] .malloy-render .malloy-big-value-label {
376
422
  font-size: 11px;
377
423
  }
378
424
  .malloy-render .malloy-dashboard .dashboard-row-header-separator {
379
425
  background: var(--malloy-render--table-border) !important;
380
426
  }
381
427
  /* !important because the malloy-explorer stylesheet pins these same properties with it. */
382
- [${I}] .malloy-table.root {
428
+ [${$}] .malloy-table.root {
383
429
  height: 100% !important;
384
430
  align-content: start !important;
385
431
  grid-template-columns: repeat(var(--total-header-size), minmax(max-content, 1fr)) !important;
@@ -414,10 +460,10 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
414
460
  and the only thing that tells a reader a cell navigates. Kept off the
415
461
  resting state deliberately: a column painted blue competes with the data.
416
462
  (No backticks in here: this is inside a template literal.) */
417
- .malloy-render .${v} {
463
+ .malloy-render .${g} {
418
464
  cursor: pointer;
419
465
  }
420
- .malloy-render .${v}:hover > .cell-content {
466
+ .malloy-render .${g}:hover > .cell-content {
421
467
  color: var(--publisher-drill-link) !important;
422
468
  text-decoration: underline;
423
469
  }
@@ -425,194 +471,211 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
425
471
  something a keyboard user can produce, and a focus ring is not something a
426
472
  mouse user sees. focus-visible rather than focus, so a click does not leave a
427
473
  ring behind it. (No backticks in here: this is inside a template literal.) */
428
- .malloy-render .${v}:focus-visible {
474
+ .malloy-render .${g}:focus-visible {
429
475
  outline: 2px solid var(--publisher-drill-link);
430
476
  outline-offset: -2px;
431
477
  }
432
- .malloy-render .${v}:focus-visible > .cell-content {
478
+ .malloy-render .${g}:focus-visible > .cell-content {
433
479
  color: var(--publisher-drill-link) !important;
434
480
  text-decoration: underline;
435
481
  }
436
- `, ue = "publisher-malloy-renderer-overrides";
437
- function Ze() {
438
- if (typeof document > "u" || document.getElementById(ue)) return;
482
+ /* The renderer's own drill, on so a click can report its row, paints the
483
+ whole hovered row as a link. Which cells click is the marking above. */
484
+ .malloy-render .malloy-table .td.highlight {
485
+ color: inherit;
486
+ }
487
+ .malloy-render .malloy-table .td.highlight:not(.${g}) {
488
+ cursor: inherit;
489
+ }
490
+ `, me = "publisher-malloy-renderer-overrides";
491
+ function rt() {
492
+ if (typeof document > "u" || document.getElementById(me)) return;
439
493
  const e = document.createElement("style");
440
- e.id = ue, e.textContent = Qe, document.head.appendChild(e);
494
+ e.id = me, e.textContent = tt, document.head.appendChild(e);
441
495
  }
442
- function et({
496
+ function ot({
443
497
  result: e,
444
498
  height: t,
445
- drill: a,
446
- onSizeChange: l,
447
- onSizing: r,
448
- fill: o
499
+ drill: r,
500
+ onSizeChange: a,
501
+ onSizing: o,
502
+ fill: n
449
503
  }) {
450
- const n = z(null), i = z(a);
451
- i.current = a;
452
- const h = ge((d) => {
453
- i.current?.onClick(d);
454
- }, []), p = a !== void 0, k = z(!1), w = z(
504
+ const l = M(null), i = M(r);
505
+ i.current = r;
506
+ const h = de(
507
+ () => Ye((d) => i.current?.onClick(d)),
508
+ []
509
+ ), y = r !== void 0, k = M(!1), w = M(
455
510
  null
456
- ), q = z(0), { theme: $, layers: V, mode: Q } = Oe(), Z = ve(
511
+ ), X = M(0), { theme: N, layers: W, mode: ee } = Oe(), te = de(
457
512
  () => ({
458
- radius: $.ui.radius.tile,
459
- padding: `${Ce}px`
513
+ radius: N.ui.radius.tile,
514
+ padding: `${xe}px`
460
515
  }),
461
- [$.ui.radius.tile]
516
+ [N.ui.radius.tile]
462
517
  );
463
- return we(() => () => {
464
- q.current += 1;
518
+ return ve(() => () => {
519
+ X.current += 1;
465
520
  const d = w.current;
466
521
  d?.viz.remove(), d?.node.remove(), w.current = null;
467
- }, []), ke(() => {
468
- if (!n.current || !e) return;
469
- Ze();
470
- const d = n.current, be = q.current += 1;
471
- let X = !1;
472
- const K = () => !X && be === q.current;
473
- let c, b, B = null, W = 0, N = null, P = null, j = null, A = null, S = null, D = null, ee = null, te = 0, C = null;
522
+ }, []), we(() => {
523
+ if (!l.current || !e) return;
524
+ rt();
525
+ const d = l.current, ye = X.current += 1;
526
+ let K = !1;
527
+ const U = () => !K && ye === X.current;
528
+ let c, b, P = null, Y = 0, j = null, H = null, q = null, D = null, O = null, F = null, re = null, oe = 0, T = null;
474
529
  k.current = !1;
475
- let y, R;
476
- const G = (g) => {
477
- if (X || !g.firstElementChild || Y(y, R) === "container") return;
478
- const O = _e(y, R);
479
- if (k.current && !O) return;
480
- const F = d.hasAttribute(I);
481
- F && d.removeAttribute(I);
482
- const E = Ae(
483
- g,
484
- se(y)
530
+ let p, A;
531
+ const G = (v) => {
532
+ if (K || !v.firstElementChild || Q(p, A) === "container") return;
533
+ const z = Te(p, A);
534
+ if (k.current && !z) return;
535
+ const L = d.hasAttribute($);
536
+ L && d.removeAttribute($);
537
+ const x = d.closest(
538
+ `.${Ae}`
539
+ ), u = x?.style.overflowY;
540
+ x && (x.style.overflowY = "hidden");
541
+ const S = Se(
542
+ v,
543
+ ce(p)
485
544
  );
486
- F && d.setAttribute(I, ""), E > 0 && (k.current = !0, l && E !== te && (te = E, l(E)));
487
- const u = Se(g, se(y));
488
- O && u && ee !== u && (ee = u, D?.disconnect(), D = new ResizeObserver(() => G(g)), D.observe(u));
545
+ x && (x.style.overflowY = u ?? ""), L && d.setAttribute($, ""), S > 0 && (k.current = !0, a && S !== oe && (oe = S, a(S)));
546
+ const C = _e(v, ce(p));
547
+ z && C && re !== C && (re = C, F?.disconnect(), F = new ResizeObserver(() => G(v)), F.observe(C));
489
548
  };
490
549
  return (async () => {
491
- let g;
550
+ let v;
492
551
  try {
493
- g = JSON.parse(e);
552
+ v = JSON.parse(e);
494
553
  } catch (m) {
495
554
  console.error("Error parsing visualization result:", m);
496
555
  return;
497
556
  }
498
- const O = await Ye(g), F = O ? Fe([...V, ze(V, O)], Q) : $;
499
- if (!K()) return;
557
+ const z = await Ze(v), L = z ? Fe([...W, ze(W, z)], ee) : N;
558
+ if (!U()) return;
500
559
  try {
501
- b = await Ue(F, h);
560
+ b = await Qe(
561
+ L,
562
+ h.onClick,
563
+ y ? h.onDrill : void 0
564
+ );
502
565
  } catch (m) {
503
566
  console.error("Failed to create renderer:", m);
504
567
  return;
505
568
  }
506
- if (!K()) {
569
+ if (!U()) {
507
570
  b.remove(), b = void 0;
508
571
  return;
509
572
  }
510
- const E = w.current;
511
- c = document.createElement("div"), c.style.width = "100%", c.style.height = "100%", Je(c, F, Z), d.childElementCount > 0 && (d.style.position = "relative", c.style.position = "absolute", c.style.inset = "0", c.style.visibility = "hidden"), d.appendChild(c);
573
+ const x = w.current;
574
+ c = document.createElement("div"), c.style.width = "100%", c.style.height = "100%", et(c, L, te), d.childElementCount > 0 && (d.style.position = "relative", c.style.position = "absolute", c.style.inset = "0", c.style.visibility = "hidden"), d.appendChild(c);
512
575
  const u = c;
513
- A = new MutationObserver(() => {
514
- S && clearTimeout(S), S = setTimeout(() => {
515
- G(u), k.current && A?.disconnect();
576
+ D = new MutationObserver(() => {
577
+ O && clearTimeout(O), O = setTimeout(() => {
578
+ G(u), k.current && D?.disconnect();
516
579
  }, 100);
517
- }), A.observe(c, {
580
+ }), D.observe(c, {
518
581
  childList: !0,
519
582
  subtree: !0,
520
583
  attributes: !0
521
584
  });
522
- const fe = b;
523
- let re = !1;
585
+ const S = b;
586
+ let C = !1;
524
587
  const ae = () => {
525
- if (!(re || !K())) {
526
- re = !0, C && (clearTimeout(C), C = null), E?.viz.remove();
588
+ if (!(C || !U())) {
589
+ C = !0, T && (clearTimeout(T), T = null), x?.viz.remove();
527
590
  for (const m of Array.from(d.children))
528
591
  m !== u && d.removeChild(m);
529
- u.style.position = "", u.style.inset = "", u.style.visibility = "", d.style.position = "", w.current = { viz: fe, node: u }, G(u);
592
+ u.style.position = "", u.style.inset = "", u.style.visibility = "", d.style.position = "", w.current = { viz: S, node: u }, G(u);
530
593
  }
531
594
  };
532
595
  try {
533
- b.setResult(Ve(g));
596
+ b.setResult(Ve(v));
534
597
  try {
535
- const x = b.getMetadata(), T = x?.getRootField();
536
- y = T?.renderAs(), R = T ? x?.getPluginsForField(T.key)?.[0]?.sizingStrategy : void 0;
598
+ const R = b.getMetadata(), E = R?.getRootField();
599
+ y && Je(E), p = E?.renderAs(), A = E ? R?.getPluginsForField(E.key)?.[0]?.sizingStrategy : void 0;
537
600
  } catch {
538
- y = void 0, R = void 0;
601
+ p = void 0, A = void 0;
539
602
  }
540
- r?.(Y(y, R), y), c.dataset.malloyRenderAs = y ?? "unknown", c.dataset.malloySizing = Y(y, R);
541
- const m = Ge(y, g);
603
+ o?.(Q(p, A), p), c.dataset.malloyRenderAs = p ?? "unknown", c.dataset.malloySizing = Q(p, A);
604
+ const m = Ue(p, v);
542
605
  c.style.minWidth = m === void 0 ? "" : `${m}px`, d.style.overflowX = m === void 0 ? "" : "auto", d.style.overflowY = m === void 0 ? "" : "hidden", b.render(c);
543
- const oe = i.current;
606
+ const ne = i.current;
544
607
  try {
545
- if (oe) {
546
- const x = Me(b, oe.canDrill), T = () => {
608
+ if (ne) {
609
+ const R = Le(b, ne.canDrill), E = () => {
547
610
  try {
548
- Ie(u, x);
611
+ Me(u, R);
549
612
  } catch (s) {
550
613
  console.warn("Drill affordance skipped:", s);
551
614
  }
552
615
  };
553
- T();
554
- const ne = (s) => {
555
- const _ = s.querySelector(".cell-content") ?? s, U = _.getBoundingClientRect();
616
+ E();
617
+ const le = (s) => {
618
+ const _ = s.querySelector(".cell-content") ?? s, J = _.getBoundingClientRect();
556
619
  _.dispatchEvent(
557
620
  new MouseEvent("click", {
558
621
  bubbles: !0,
559
622
  cancelable: !0,
560
623
  view: _.ownerDocument.defaultView,
561
- clientX: Math.round(U.left + U.width / 2),
562
- clientY: Math.round(U.bottom)
624
+ clientX: Math.round(J.left + J.width / 2),
625
+ clientY: Math.round(J.bottom)
563
626
  })
564
627
  );
565
- }, le = (s) => s.target?.closest?.(`.${v}`) ?? null, ye = (s, f) => {
566
- de(s, f)?.focus();
628
+ }, ie = (s) => s.target?.closest?.(`.${g}`) ?? null, pe = (s, f) => {
629
+ ue(s, f)?.focus();
567
630
  };
568
- N = (s) => {
569
- const f = le(s);
631
+ j = (s) => {
632
+ const f = ie(s);
570
633
  if (!f) return;
571
634
  const _ = s.key === "ArrowDown" ? 1 : s.key === "ArrowUp" ? -1 : s.key === "Home" ? "first" : s.key === "End" ? "last" : void 0;
572
635
  if (_ !== void 0) {
573
- s.preventDefault(), ye(f, _);
636
+ s.preventDefault(), pe(f, _);
574
637
  return;
575
638
  }
576
- s.key === "Enter" ? (s.preventDefault(), ne(f)) : s.key === " " && s.preventDefault();
577
- }, P = (s) => {
639
+ s.key === "Enter" ? (s.preventDefault(), le(f)) : s.key === " " && s.preventDefault();
640
+ }, H = (s) => {
578
641
  if (s.key !== " ") return;
579
- const f = le(s);
580
- f && (s.preventDefault(), ne(f));
581
- }, j = (s) => {
582
- const f = s.target?.closest?.(`.${v}`);
583
- f && de(f, 0);
584
- }, u.addEventListener("keydown", N), u.addEventListener("keyup", P), u.addEventListener("focusin", j), x.size > 0 && typeof MutationObserver < "u" && (B = new MutationObserver(() => {
585
- cancelAnimationFrame(W), W = requestAnimationFrame(T);
586
- }), B.observe(u, {
642
+ const f = ie(s);
643
+ f && (s.preventDefault(), le(f));
644
+ }, q = (s) => {
645
+ const f = s.target?.closest?.(`.${g}`);
646
+ f && ue(f, 0);
647
+ }, u.addEventListener("keydown", j), u.addEventListener("keyup", H), u.addEventListener("focusin", q), R.size > 0 && typeof MutationObserver < "u" && (P = new MutationObserver(() => {
648
+ cancelAnimationFrame(Y), Y = requestAnimationFrame(E);
649
+ }), P.observe(u, {
587
650
  childList: !0,
588
651
  subtree: !0
589
652
  }));
590
653
  }
591
- } catch (x) {
592
- console.warn("Drill affordance skipped:", x);
654
+ } catch (R) {
655
+ console.warn("Drill affordance skipped:", R);
593
656
  }
594
- b.onReady(ae), C = setTimeout(ae, 1e4);
657
+ b.onReady(ae), T = setTimeout(ae, 1e4);
595
658
  } catch (m) {
596
- console.error("Error rendering visualization:", m), A?.disconnect(), D?.disconnect(), B?.disconnect(), b.remove(), b = void 0, u.parentNode === d && d.removeChild(u);
659
+ console.error("Error rendering visualization:", m), D?.disconnect(), F?.disconnect(), P?.disconnect(), b.remove(), b = void 0, u.parentNode === d && d.removeChild(u);
597
660
  }
598
661
  })(), () => {
599
- X = !0, A?.disconnect(), D?.disconnect(), S && clearTimeout(S), C && clearTimeout(C), c && w.current?.node !== c && (N && c.removeEventListener("keydown", N), P && c.removeEventListener("keyup", P), j && c.removeEventListener("focusin", j), B?.disconnect(), cancelAnimationFrame(W), b?.remove(), c.parentNode === d && d.removeChild(c), d.style.position = "");
662
+ K = !0, D?.disconnect(), F?.disconnect(), O && clearTimeout(O), T && clearTimeout(T), c && w.current?.node !== c && (j && c.removeEventListener("keydown", j), H && c.removeEventListener("keyup", H), q && c.removeEventListener("focusin", q), P?.disconnect(), cancelAnimationFrame(Y), b?.remove(), c.parentNode === d && d.removeChild(c), d.style.position = "");
600
663
  };
601
664
  }, [
602
665
  e,
603
666
  h,
604
- p,
605
- l,
606
- r,
607
- $,
608
- V,
609
- Q,
610
- Z
611
- ]), /* @__PURE__ */ M(
667
+ y,
668
+ a,
669
+ o,
670
+ N,
671
+ W,
672
+ ee,
673
+ te
674
+ ]), /* @__PURE__ */ I(
612
675
  "div",
613
676
  {
614
- ref: n,
615
- ...o ? { [I]: "" } : {},
677
+ ref: l,
678
+ ...n ? { [$]: "" } : {},
616
679
  style: {
617
680
  width: "100%",
618
681
  height: t ? `${t}px` : "400px"
@@ -620,9 +683,9 @@ function et({
620
683
  }
621
684
  );
622
685
  }
623
- function tt(e) {
624
- return typeof window > "u" ? /* @__PURE__ */ M(
625
- ie,
686
+ function at(e) {
687
+ return typeof window > "u" ? /* @__PURE__ */ I(
688
+ se,
626
689
  {
627
690
  sx: {
628
691
  width: "100%",
@@ -634,11 +697,11 @@ function tt(e) {
634
697
  },
635
698
  children: "Loading..."
636
699
  }
637
- ) : /* @__PURE__ */ M(
638
- pe,
700
+ ) : /* @__PURE__ */ I(
701
+ ge,
639
702
  {
640
- fallback: /* @__PURE__ */ M(
641
- ie,
703
+ fallback: /* @__PURE__ */ I(
704
+ se,
642
705
  {
643
706
  sx: {
644
707
  width: "100%",
@@ -651,21 +714,21 @@ function tt(e) {
651
714
  children: "Loading visualization..."
652
715
  }
653
716
  ),
654
- children: /* @__PURE__ */ M(et, { ...e })
717
+ children: /* @__PURE__ */ I(ot, { ...e })
655
718
  }
656
719
  );
657
720
  }
658
- const it = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
721
+ const ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
659
722
  __proto__: null,
660
- default: tt
723
+ default: at
661
724
  }, Symbol.toStringTag, { value: "Module" }));
662
725
  export {
663
- v as D,
664
- tt as R,
726
+ g as D,
727
+ at as R,
665
728
  Be as a,
666
729
  $e as b,
667
- it as c,
668
- Me as d,
669
- Ie as m,
730
+ ct as c,
731
+ Le as d,
732
+ Me as m,
670
733
  Ne as r
671
734
  };