@malloy-publisher/sdk 0.9.15 → 0.10.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 (94) hide show
  1. package/dist/{RenderedResult-BClN_PG6.cjs.js → RenderedResult-B5f4qOjp.cjs.js} +21 -4
  2. package/dist/{RenderedResult-YBzVMVH2.es.js → RenderedResult-DiDsN6JE.es.js} +204 -187
  3. package/dist/builder/index.cjs.js +75 -75
  4. package/dist/builder/index.es.js +5304 -5156
  5. package/dist/builder-entry.d.ts +1 -1
  6. package/dist/client/api.d.ts +1 -1
  7. package/dist/components/Dashboard/DashboardGrid.d.ts +2 -0
  8. package/dist/components/Dashboard/DashboardTile.d.ts +3 -1
  9. package/dist/components/RenderedResult/ResultContainer.d.ts +8 -1
  10. package/dist/components/RenderedResult/ResultPanel.d.ts +3 -1
  11. package/dist/components/RenderedResult/resultSizing.d.ts +5 -0
  12. package/dist/components/ReportBuilder/ArrangeMenu.d.ts +9 -0
  13. package/dist/components/ReportBuilder/BuilderGrid.d.ts +5 -7
  14. package/dist/components/ReportBuilder/BuilderToolbar.d.ts +3 -1
  15. package/dist/components/ReportBuilder/ReportBuilder.d.ts +1 -1
  16. package/dist/components/ReportBuilder/TextTileBody.d.ts +9 -2
  17. package/dist/components/ReportBuilder/TileFrame.d.ts +34 -22
  18. package/dist/components/ReportBuilder/builderControls.d.ts +19 -0
  19. package/dist/components/ReportBuilder/placement.d.ts +48 -2
  20. package/dist/components/ReportBuilder/sortable.d.ts +9 -0
  21. package/dist/components/ReportBuilder/useBuilderSession.d.ts +1 -1
  22. package/dist/components/ReportBuilder/useBuilderShortcuts.d.ts +9 -1
  23. package/dist/components/ReportBuilder/useEdgeResize.d.ts +84 -0
  24. package/dist/components/ReportBuilder/useTileReorder.d.ts +3 -0
  25. package/dist/components/legacy/malloynb/CellRunnerView.d.ts +6 -6
  26. package/dist/hooks/useSettled.d.ts +5 -8
  27. package/dist/hooks/useSettledDraft.d.ts +33 -0
  28. package/dist/index.cjs.js +10 -10
  29. package/dist/index.es.js +3861 -3870
  30. package/dist/theme/classes.d.ts +1 -1
  31. package/dist/useCompiledDocument-C995sQ3j.cjs.js +142 -0
  32. package/dist/{useCompiledDocument-BGk38oaW.es.js → useCompiledDocument-CRmmbUza.es.js} +6426 -6257
  33. package/dist/utils/malloyLiteral.d.ts +2 -0
  34. package/package.json +11 -16
  35. package/src/builder-entry.ts +1 -0
  36. package/src/components/Dashboard/DashboardGrid.tsx +2 -0
  37. package/src/components/Dashboard/DashboardTile.tsx +4 -0
  38. package/src/components/Dashboard/DashboardView.tsx +1 -0
  39. package/src/components/RenderedResult/RenderedResult.tsx +18 -0
  40. package/src/components/RenderedResult/ResultContainer.tsx +39 -3
  41. package/src/components/RenderedResult/ResultPanel.tsx +4 -0
  42. package/src/components/RenderedResult/resultSizing.ts +6 -0
  43. package/src/components/ReportBuilder/ArrangeMenu.tsx +80 -0
  44. package/src/components/ReportBuilder/BuilderBar.tsx +4 -0
  45. package/src/components/ReportBuilder/BuilderDialogs.tsx +8 -1
  46. package/src/components/ReportBuilder/BuilderGrid.tsx +62 -60
  47. package/src/components/ReportBuilder/BuilderToolbar.tsx +4 -0
  48. package/src/components/ReportBuilder/EditorSurface.tsx +9 -2
  49. package/src/components/ReportBuilder/ReportBuilder.spec.tsx +99 -0
  50. package/src/components/ReportBuilder/ReportBuilder.tsx +110 -30
  51. package/src/components/ReportBuilder/TextTileBody.tsx +24 -4
  52. package/src/components/ReportBuilder/TileFrame.tsx +261 -310
  53. package/src/components/ReportBuilder/builderControls.ts +34 -0
  54. package/src/components/ReportBuilder/placement.spec.ts +235 -0
  55. package/src/components/ReportBuilder/placement.ts +179 -9
  56. package/src/components/ReportBuilder/readDocument.spec.ts +7 -17
  57. package/src/components/ReportBuilder/readDocument.ts +3 -6
  58. package/src/components/ReportBuilder/sortable.tsx +26 -2
  59. package/src/components/ReportBuilder/spliceDocument.spec.ts +0 -40
  60. package/src/components/ReportBuilder/spliceDocument.ts +0 -39
  61. package/src/components/ReportBuilder/useBuilderSession.ts +7 -2
  62. package/src/components/ReportBuilder/useBuilderShortcuts.ts +25 -1
  63. package/src/components/ReportBuilder/useEdgeResize.spec.tsx +324 -0
  64. package/src/components/ReportBuilder/useEdgeResize.ts +397 -0
  65. package/src/components/ReportBuilder/useTileReorder.ts +1 -1
  66. package/src/components/given/GivenInput.spec.tsx +447 -2
  67. package/src/components/given/GivenInput.tsx +192 -80
  68. package/src/components/given/GivensPanel.spec.tsx +59 -0
  69. package/src/components/given/GivensPanel.tsx +14 -2
  70. package/src/components/legacy/malloynb/CellRunnerView.tsx +6 -6
  71. package/src/hooks/useDimensionFilters.ts +1 -35
  72. package/src/hooks/useDimensionFiltersQuery.ts +2 -36
  73. package/src/hooks/useDimensionalFilterRangeData.ts +1 -35
  74. package/src/hooks/useGivensState.spec.ts +106 -1
  75. package/src/hooks/useGivensState.ts +48 -13
  76. package/src/hooks/useSettled.ts +5 -8
  77. package/src/hooks/useSettledDraft.ts +127 -0
  78. package/src/theme/classes.ts +1 -1
  79. package/src/utils/malloyLiteral.spec.ts +12 -1
  80. package/src/utils/malloyLiteral.ts +32 -0
  81. package/vite.config.ts +0 -2
  82. package/.eslintrc +0 -36
  83. package/dist/components/DOMElement/DOMElement.d.ts +0 -5
  84. package/dist/components/DOMElement/index.d.ts +0 -1
  85. package/dist/components/Package/FileTreeView.d.ts +0 -9
  86. package/dist/components/ReportBuilder/useTileHeight.d.ts +0 -39
  87. package/dist/components/ReportBuilder/useTileResize.d.ts +0 -40
  88. package/dist/useCompiledDocument-D9t5ry_t.cjs.js +0 -142
  89. package/src/components/DOMElement/DOMElement.tsx +0 -22
  90. package/src/components/DOMElement/index.ts +0 -4
  91. package/src/components/Package/FileTreeView.tsx +0 -244
  92. package/src/components/ReportBuilder/useTileHeight.ts +0 -149
  93. package/src/components/ReportBuilder/useTileResize.spec.tsx +0 -146
  94. package/src/components/ReportBuilder/useTileResize.ts +0 -148
@@ -1,38 +1,38 @@
1
- import { jsx as z } from "react/jsx-runtime";
2
- import { Box as le } from "@mui/material";
3
- import { Suspense as ye, useRef as M, useCallback as pe, useMemo as ge, useEffect as ve, useLayoutEffect as we } from "react";
4
- import { r as ke, a as ue, D as xe, b as G, l as Ce, c as Re, d as Ee, e as _e, m as Ae, f as Se, g as ie } from "./useCompiledDocument-BGk38oaW.es.js";
5
- import { ba as Te, b8 as De, bb as Oe, bc as Fe } from "./ServerProvider-D7neZcTk.es.js";
6
- const v = ke.drillCell;
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-CRmmbUza.es.js";
5
+ import { ba as De, b8 as Oe, bb as Fe, bc as ze } from "./ServerProvider-D7neZcTk.es.js";
6
+ const v = xe.drillCell;
7
7
  function Me(e, t) {
8
- const o = /* @__PURE__ */ new Set();
8
+ const a = /* @__PURE__ */ new Set();
9
9
  let l;
10
10
  try {
11
11
  l = e.getMetadata()?.getAllFields() ?? [];
12
12
  } catch {
13
- return o;
13
+ return a;
14
14
  }
15
15
  const r = /* @__PURE__ */ new Set();
16
- for (const a of l)
17
- !a || t(a) || a.tag?.tag("hidden") === void 0 && r.add(a.tag?.text("label") ?? a.name);
18
- for (const a of l) {
19
- if (!a || !t(a)) continue;
20
- const n = a.tag?.text("label") ?? a.name;
21
- r.has(n) || o.add(n);
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);
22
22
  }
23
- return o;
23
+ return a;
24
24
  }
25
25
  function L(e) {
26
26
  const t = /^\s*(\d+)/.exec(e.style?.gridColumn ?? "");
27
27
  return t ? t[1] : void 0;
28
28
  }
29
- function ze(e, t) {
29
+ function Ie(e, t) {
30
30
  if (t.size !== 0)
31
- for (const o of e.querySelectorAll(
31
+ for (const a of e.querySelectorAll(
32
32
  ".malloy-table"
33
33
  )) {
34
- const l = (n) => n.closest(".malloy-table") === o, r = /* @__PURE__ */ new Set();
35
- for (const n of o.querySelectorAll(
34
+ const l = (n) => n.closest(".malloy-table") === a, r = /* @__PURE__ */ new Set();
35
+ for (const n of a.querySelectorAll(
36
36
  ".column-cell.th"
37
37
  )) {
38
38
  if (!l(n)) continue;
@@ -40,49 +40,49 @@ function ze(e, t) {
40
40
  h && t.has(i) && r.add(h);
41
41
  }
42
42
  if (r.size === 0) continue;
43
- const a = /* @__PURE__ */ new Set();
44
- for (const n of o.querySelectorAll(
43
+ const o = /* @__PURE__ */ new Set();
44
+ for (const n of a.querySelectorAll(
45
45
  `.${v}[tabindex="0"]`
46
46
  )) {
47
47
  if (!l(n)) continue;
48
48
  const i = L(n);
49
- i && (a.has(i) ? n.tabIndex = -1 : a.add(i));
49
+ i && (o.has(i) ? n.tabIndex = -1 : o.add(i));
50
50
  }
51
- for (const n of o.querySelectorAll(
51
+ for (const n of a.querySelectorAll(
52
52
  ".column-cell.td"
53
53
  )) {
54
54
  if (!l(n)) continue;
55
55
  const i = L(n), h = !n.querySelector(".value-null") && (n.textContent ?? "").trim() !== "";
56
56
  if (i && h && r.has(i) && !n.querySelector(".malloy-table")) {
57
57
  if (n.classList.add(v), n.tabIndex === 0)
58
- a.add(i);
58
+ o.add(i);
59
59
  else {
60
- const p = a.has(i);
61
- p || a.add(i), n.tabIndex = p ? -1 : 0;
60
+ const p = o.has(i);
61
+ p || o.add(i), n.tabIndex = p ? -1 : 0;
62
62
  }
63
63
  n.setAttribute("role", "button");
64
64
  }
65
65
  }
66
66
  }
67
67
  }
68
- function Ie(e) {
69
- const t = e.closest(".malloy-table"), o = L(e);
70
- return !t || !o ? [] : Array.from(
68
+ function Le(e) {
69
+ const t = e.closest(".malloy-table"), a = L(e);
70
+ return !t || !a ? [] : Array.from(
71
71
  t.querySelectorAll(`.${v}`)
72
72
  ).filter(
73
- (l) => l.closest(".malloy-table") === t && L(l) === o
73
+ (l) => l.closest(".malloy-table") === t && L(l) === a
74
74
  );
75
75
  }
76
- function se(e, t) {
77
- const o = Ie(e), l = o.indexOf(e);
76
+ function de(e, t) {
77
+ const a = Le(e), l = a.indexOf(e);
78
78
  if (l === -1) return;
79
- const r = t === "first" ? o[0] : t === "last" ? o[o.length - 1] : o[Math.min(Math.max(l + t, 0), o.length - 1)];
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
80
  if (r) {
81
- for (const a of o) a.tabIndex = a === r ? 0 : -1;
81
+ for (const o of a) o.tabIndex = o === r ? 0 : -1;
82
82
  return r;
83
83
  }
84
84
  }
85
- function Le(e) {
85
+ function $e(e) {
86
86
  return {
87
87
  background: e.dashboardRoot,
88
88
  tableBackground: e.tableBackground,
@@ -105,15 +105,15 @@ function Le(e) {
105
105
  };
106
106
  }
107
107
  function Be(e) {
108
- const { foreground: t, axisFaint: o, gridline: l, font: r } = e, a = {
108
+ const { foreground: t, axisFaint: a, gridline: l, font: r } = e, o = {
109
109
  background: e.background,
110
110
  font: r.family,
111
111
  title: { color: t, font: r.family },
112
112
  axis: {
113
113
  labelColor: t,
114
114
  titleColor: t,
115
- domainColor: o,
116
- tickColor: o,
115
+ domainColor: a,
116
+ tickColor: a,
117
117
  gridColor: l,
118
118
  labelFont: r.family,
119
119
  titleFont: r.family
@@ -127,56 +127,56 @@ function Be(e) {
127
127
  header: { labelColor: t, titleColor: t },
128
128
  range: { category: e.series }
129
129
  }, n = {
130
- ...a,
131
- legend: { ...a.legend, orient: "bottom" }
130
+ ...o,
131
+ legend: { ...o.legend, orient: "bottom" }
132
132
  };
133
- return (i) => i === "shape_map" ? n : a;
133
+ return (i) => i === "shape_map" ? n : o;
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 o = {}, l = t.tag("palette");
139
+ const a = {}, l = t.tag("palette");
140
140
  if (l) {
141
- const a = {}, n = l.textArray("series");
142
- n && n.length > 0 && (a.series = n);
143
- for (const i of Te) {
141
+ const o = {}, n = l.textArray("series");
142
+ n && n.length > 0 && (o.series = n);
143
+ for (const i of De) {
144
144
  const h = l.tag(i);
145
145
  if (!h) continue;
146
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 && (a[i] = p);
147
+ k && (p.light = k), w && (p.dark = w), Object.keys(p).length > 0 && (o[i] = p);
148
148
  }
149
- Object.keys(a).length > 0 && (o.palette = a);
149
+ Object.keys(o).length > 0 && (a.palette = o);
150
150
  }
151
151
  const r = t.tag("font");
152
152
  if (r) {
153
- const a = {}, n = r.text("family");
154
- n && (a.family = n);
153
+ const o = {}, n = r.text("family");
154
+ n && (o.family = n);
155
155
  const i = r.numeric("size");
156
- typeof i == "number" && Number.isFinite(i) && (a.size = i), Object.keys(a).length > 0 && (o.font = a);
156
+ typeof i == "number" && Number.isFinite(i) && (o.size = i), Object.keys(o).length > 0 && (a.font = o);
157
157
  }
158
- return Object.keys(o).length > 0 ? o : void 0;
158
+ return Object.keys(a).length > 0 ? a : void 0;
159
159
  }
160
- const Y = (e) => (e ?? []).map((t) => t?.value).filter((t) => typeof t == "string");
161
- function $e(e) {
160
+ const J = (e) => (e ?? []).map((t) => t?.value).filter((t) => typeof t == "string");
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 Pe = (e) => Y(e.annotations).some((t) => {
166
- const o = t.trim();
167
- return /^#[^("]/.test(o) && /(?:^#|[\s{])label\s*=/.test(o);
168
- }), je = (e) => `"${e.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`, He = (e) => e.type?.element_type?.fields ?? e.type?.fields;
169
- function he(e, t) {
170
- let o = !1;
165
+ const je = (e) => J(e.annotations).some((t) => {
166
+ const a = t.trim();
167
+ return /^#[^("]/.test(a) && /(?:^#|[\s{])label\s*=/.test(a);
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
171
  return { fields: e.map((r) => {
172
- const a = He(r);
173
- if (a) {
174
- const i = he(
175
- a,
176
- ue(Y(r.annotations))
172
+ const o = qe(r);
173
+ if (o) {
174
+ const i = me(
175
+ o,
176
+ he(J(r.annotations))
177
177
  );
178
178
  if (!i.changed) return r;
179
- o = !0;
179
+ a = !0;
180
180
  const h = r.type?.element_type ? {
181
181
  ...r.type,
182
182
  element_type: {
@@ -186,41 +186,41 @@ function he(e, t) {
186
186
  } : { ...r.type, fields: i.fields };
187
187
  return { ...r, type: h };
188
188
  }
189
- if (!t || !r.name || Pe(r)) return r;
190
- const n = $e(r.name);
191
- return n === r.name ? r : (o = !0, {
189
+ if (!t || !r.name || je(r)) return r;
190
+ const n = Pe(r.name);
191
+ return n === r.name ? r : (a = !0, {
192
192
  ...r,
193
193
  annotations: [
194
- { value: `# label=${je(n)}
194
+ { value: `# label=${He(n)}
195
195
  ` },
196
196
  ...r.annotations ?? []
197
197
  ]
198
198
  });
199
- }), changed: o };
199
+ }), changed: a };
200
200
  }
201
- function qe(e) {
201
+ function Ve(e) {
202
202
  if (!e || typeof e != "object") return e;
203
- const t = e, o = t.schema?.fields;
204
- if (!Array.isArray(o)) return e;
205
- const { fields: l, changed: r } = he(
206
- o,
207
- ue(Y(t.annotations))
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))
208
208
  );
209
209
  return r ? { ...t, schema: { ...t.schema, fields: l } } : e;
210
210
  }
211
- const de = 320, Ve = 10, Xe = 96, Ke = 4e3;
212
- function We(e, t) {
211
+ const ce = 320, Xe = 10, Ke = 96, We = 4e3;
212
+ function Ge(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 de;
216
- const o = t?.data?.array_value?.length, l = o === void 0 ? 0 : o * Ve + Xe;
217
- return Math.min(Math.max(de, l), Ke);
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);
218
218
  }
219
219
  const I = "data-publisher-fill", Ue = async (e, t) => {
220
220
  if (typeof window > "u")
221
221
  throw new Error("MalloyRenderer can only be used in browser environment");
222
- const { MalloyRenderer: o } = await Re();
223
- return new o({
222
+ const { MalloyRenderer: a } = await Ee();
223
+ return new a({
224
224
  onClick: t,
225
225
  vegaConfigOverride: Be(e),
226
226
  // Pass the explicit theme so table chrome and dashboard tiles
@@ -228,43 +228,43 @@ const I = "data-publisher-fill", Ue = async (e, t) => {
228
228
  // renderer's own inline style writes `--malloy-render--*` values
229
229
  // sourced from its built-in defaults and shadows whatever we set
230
230
  // on the outer wrapper.
231
- theme: Le(e),
231
+ theme: $e(e),
232
232
  onError: (r) => {
233
233
  console.error("Error rendering visualization:", typeof r, r);
234
234
  }
235
235
  }).createViz();
236
236
  };
237
- async function Ge(e) {
237
+ async function Ye(e) {
238
238
  if (!e || typeof e != "object") return;
239
- const t = e, o = [
239
+ const t = e, a = [
240
240
  ...Array.isArray(t.model_annotations) ? t.model_annotations : [],
241
241
  ...Array.isArray(t.source_annotations) ? t.source_annotations : [],
242
242
  ...Array.isArray(t.annotations) ? t.annotations : []
243
243
  ].map((r) => typeof r?.value == "string" ? r.value : void 0).filter((r) => !!r);
244
- if (o.length === 0) return;
244
+ if (a.length === 0) return;
245
245
  let l;
246
246
  try {
247
- ({ parseAnnotation: l } = await Ce());
247
+ ({ parseAnnotation: l } = await Re());
248
248
  } catch {
249
249
  return;
250
250
  }
251
251
  try {
252
- const { tag: r } = l(o);
252
+ const { tag: r } = l(a);
253
253
  return Ne(r);
254
254
  } catch (r) {
255
255
  console.warn(
256
256
  "Failed to parse # theme.* annotations; chart will render with the shell theme.",
257
- { error: r, lines: o }
257
+ { error: r, lines: a }
258
258
  );
259
259
  return;
260
260
  }
261
261
  }
262
- function Ye(e, t, o) {
263
- const l = Ee(t, o);
264
- for (const [r, a] of Object.entries(l))
265
- e.style.setProperty(r, a);
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);
266
266
  }
267
- const Je = `
267
+ const Qe = `
268
268
  /* Card geometry, through the renderer's OWN theme vars rather than over the top
269
269
  of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
270
270
  passes each through to the --malloy-render--* the card CSS reads, so a value
@@ -358,6 +358,23 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
358
358
  width: auto;
359
359
  max-width: none;
360
360
  }
361
+ /* Compact, in a tile set shorter than its cards (ResultContainer marks it tight): smaller values,
362
+ tighter cards and a 190px floor, which a 22px value still fits in, so five cards share a row of
363
+ 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) {
365
+ grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
366
+ gap: 8px;
367
+ padding: 8px;
368
+ }
369
+ [${H}] .malloy-render .malloy-big-value-card:not(.malloy-big-value-card--embedded) {
370
+ padding: 9px 14px;
371
+ }
372
+ [${H}] .malloy-render .malloy-big-value-value {
373
+ font-size: 22px;
374
+ }
375
+ [${H}] .malloy-render .malloy-big-value-label {
376
+ font-size: 11px;
377
+ }
361
378
  .malloy-render .malloy-dashboard .dashboard-row-header-separator {
362
379
  background: var(--malloy-render--table-border) !important;
363
380
  }
@@ -416,59 +433,59 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
416
433
  color: var(--publisher-drill-link) !important;
417
434
  text-decoration: underline;
418
435
  }
419
- `, ce = "publisher-malloy-renderer-overrides";
420
- function Qe() {
421
- if (typeof document > "u" || document.getElementById(ce)) return;
436
+ `, ue = "publisher-malloy-renderer-overrides";
437
+ function Ze() {
438
+ if (typeof document > "u" || document.getElementById(ue)) return;
422
439
  const e = document.createElement("style");
423
- e.id = ce, e.textContent = Je, document.head.appendChild(e);
440
+ e.id = ue, e.textContent = Qe, document.head.appendChild(e);
424
441
  }
425
- function Ze({
442
+ function et({
426
443
  result: e,
427
444
  height: t,
428
- drill: o,
445
+ drill: a,
429
446
  onSizeChange: l,
430
447
  onSizing: r,
431
- fill: a
448
+ fill: o
432
449
  }) {
433
- const n = M(null), i = M(o);
434
- i.current = o;
435
- const h = pe((d) => {
450
+ const n = z(null), i = z(a);
451
+ i.current = a;
452
+ const h = ge((d) => {
436
453
  i.current?.onClick(d);
437
- }, []), p = o !== void 0, k = M(!1), w = M(
454
+ }, []), p = a !== void 0, k = z(!1), w = z(
438
455
  null
439
- ), H = M(0), { theme: B, layers: q, mode: J } = De(), Q = ge(
456
+ ), q = z(0), { theme: $, layers: V, mode: Q } = Oe(), Z = ve(
440
457
  () => ({
441
- radius: B.ui.radius.tile,
442
- padding: `${xe}px`
458
+ radius: $.ui.radius.tile,
459
+ padding: `${Ce}px`
443
460
  }),
444
- [B.ui.radius.tile]
461
+ [$.ui.radius.tile]
445
462
  );
446
- return ve(() => () => {
447
- H.current += 1;
463
+ return we(() => () => {
464
+ q.current += 1;
448
465
  const d = w.current;
449
466
  d?.viz.remove(), d?.node.remove(), w.current = null;
450
- }, []), we(() => {
467
+ }, []), ke(() => {
451
468
  if (!n.current || !e) return;
452
- Qe();
453
- const d = n.current, me = H.current += 1;
454
- let V = !1;
455
- const X = () => !V && me === H.current;
456
- let c, b, N = null, K = 0, $ = null, P = null, j = null, S = null, T = null, D = null, Z = null, ee = 0, C = null;
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;
457
474
  k.current = !1;
458
475
  let y, R;
459
- const W = (g) => {
460
- if (V || !g.firstElementChild || G(y, R) === "container") return;
476
+ const G = (g) => {
477
+ if (X || !g.firstElementChild || Y(y, R) === "container") return;
461
478
  const O = _e(y, R);
462
479
  if (k.current && !O) return;
463
480
  const F = d.hasAttribute(I);
464
481
  F && d.removeAttribute(I);
465
482
  const E = Ae(
466
483
  g,
467
- ie(y)
484
+ se(y)
468
485
  );
469
- F && d.setAttribute(I, ""), E > 0 && (k.current = !0, l && E !== ee && (ee = E, l(E)));
470
- const u = Se(g, ie(y));
471
- O && u && Z !== u && (Z = u, D?.disconnect(), D = new ResizeObserver(() => W(g)), D.observe(u));
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));
472
489
  };
473
490
  return (async () => {
474
491
  let g;
@@ -478,95 +495,95 @@ function Ze({
478
495
  console.error("Error parsing visualization result:", m);
479
496
  return;
480
497
  }
481
- const O = await Ge(g), F = O ? Oe([...q, Fe(q, O)], J) : B;
482
- if (!X()) return;
498
+ const O = await Ye(g), F = O ? Fe([...V, ze(V, O)], Q) : $;
499
+ if (!K()) return;
483
500
  try {
484
501
  b = await Ue(F, h);
485
502
  } catch (m) {
486
503
  console.error("Failed to create renderer:", m);
487
504
  return;
488
505
  }
489
- if (!X()) {
506
+ if (!K()) {
490
507
  b.remove(), b = void 0;
491
508
  return;
492
509
  }
493
510
  const E = w.current;
494
- c = document.createElement("div"), c.style.width = "100%", c.style.height = "100%", Ye(c, F, Q), d.childElementCount > 0 && (d.style.position = "relative", c.style.position = "absolute", c.style.inset = "0", c.style.visibility = "hidden"), d.appendChild(c);
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);
495
512
  const u = c;
496
- S = new MutationObserver(() => {
497
- T && clearTimeout(T), T = setTimeout(() => {
498
- W(u), k.current && S?.disconnect();
513
+ A = new MutationObserver(() => {
514
+ S && clearTimeout(S), S = setTimeout(() => {
515
+ G(u), k.current && A?.disconnect();
499
516
  }, 100);
500
- }), S.observe(c, {
517
+ }), A.observe(c, {
501
518
  childList: !0,
502
519
  subtree: !0,
503
520
  attributes: !0
504
521
  });
505
- const be = b;
506
- let te = !1;
507
- const re = () => {
508
- if (!(te || !X())) {
509
- te = !0, C && (clearTimeout(C), C = null), E?.viz.remove();
522
+ const fe = b;
523
+ let re = !1;
524
+ const ae = () => {
525
+ if (!(re || !K())) {
526
+ re = !0, C && (clearTimeout(C), C = null), E?.viz.remove();
510
527
  for (const m of Array.from(d.children))
511
528
  m !== u && d.removeChild(m);
512
- u.style.position = "", u.style.inset = "", u.style.visibility = "", d.style.position = "", w.current = { viz: be, node: u }, W(u);
529
+ u.style.position = "", u.style.inset = "", u.style.visibility = "", d.style.position = "", w.current = { viz: fe, node: u }, G(u);
513
530
  }
514
531
  };
515
532
  try {
516
- b.setResult(qe(g));
533
+ b.setResult(Ve(g));
517
534
  try {
518
- const x = b.getMetadata(), _ = x?.getRootField();
519
- y = _?.renderAs(), R = _ ? x?.getPluginsForField(_.key)?.[0]?.sizingStrategy : void 0;
535
+ const x = b.getMetadata(), T = x?.getRootField();
536
+ y = T?.renderAs(), R = T ? x?.getPluginsForField(T.key)?.[0]?.sizingStrategy : void 0;
520
537
  } catch {
521
538
  y = void 0, R = void 0;
522
539
  }
523
- r?.(G(y, R), y), c.dataset.malloyRenderAs = y ?? "unknown", c.dataset.malloySizing = G(y, R);
524
- const m = We(y, g);
540
+ r?.(Y(y, R), y), c.dataset.malloyRenderAs = y ?? "unknown", c.dataset.malloySizing = Y(y, R);
541
+ const m = Ge(y, g);
525
542
  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);
526
543
  const oe = i.current;
527
544
  try {
528
545
  if (oe) {
529
- const x = Me(b, oe.canDrill), _ = () => {
546
+ const x = Me(b, oe.canDrill), T = () => {
530
547
  try {
531
- ze(u, x);
548
+ Ie(u, x);
532
549
  } catch (s) {
533
550
  console.warn("Drill affordance skipped:", s);
534
551
  }
535
552
  };
536
- _();
537
- const ae = (s) => {
538
- const A = s.querySelector(".cell-content") ?? s, U = A.getBoundingClientRect();
539
- A.dispatchEvent(
553
+ T();
554
+ const ne = (s) => {
555
+ const _ = s.querySelector(".cell-content") ?? s, U = _.getBoundingClientRect();
556
+ _.dispatchEvent(
540
557
  new MouseEvent("click", {
541
558
  bubbles: !0,
542
559
  cancelable: !0,
543
- view: A.ownerDocument.defaultView,
560
+ view: _.ownerDocument.defaultView,
544
561
  clientX: Math.round(U.left + U.width / 2),
545
562
  clientY: Math.round(U.bottom)
546
563
  })
547
564
  );
548
- }, ne = (s) => s.target?.closest?.(`.${v}`) ?? null, fe = (s, f) => {
549
- se(s, f)?.focus();
565
+ }, le = (s) => s.target?.closest?.(`.${v}`) ?? null, ye = (s, f) => {
566
+ de(s, f)?.focus();
550
567
  };
551
- $ = (s) => {
552
- const f = ne(s);
568
+ N = (s) => {
569
+ const f = le(s);
553
570
  if (!f) return;
554
- const A = s.key === "ArrowDown" ? 1 : s.key === "ArrowUp" ? -1 : s.key === "Home" ? "first" : s.key === "End" ? "last" : void 0;
555
- if (A !== void 0) {
556
- s.preventDefault(), fe(f, A);
571
+ const _ = s.key === "ArrowDown" ? 1 : s.key === "ArrowUp" ? -1 : s.key === "Home" ? "first" : s.key === "End" ? "last" : void 0;
572
+ if (_ !== void 0) {
573
+ s.preventDefault(), ye(f, _);
557
574
  return;
558
575
  }
559
- s.key === "Enter" ? (s.preventDefault(), ae(f)) : s.key === " " && s.preventDefault();
576
+ s.key === "Enter" ? (s.preventDefault(), ne(f)) : s.key === " " && s.preventDefault();
560
577
  }, P = (s) => {
561
578
  if (s.key !== " ") return;
562
- const f = ne(s);
563
- f && (s.preventDefault(), ae(f));
579
+ const f = le(s);
580
+ f && (s.preventDefault(), ne(f));
564
581
  }, j = (s) => {
565
582
  const f = s.target?.closest?.(`.${v}`);
566
- f && se(f, 0);
567
- }, u.addEventListener("keydown", $), u.addEventListener("keyup", P), u.addEventListener("focusin", j), x.size > 0 && typeof MutationObserver < "u" && (N = new MutationObserver(() => {
568
- cancelAnimationFrame(K), K = requestAnimationFrame(_);
569
- }), N.observe(u, {
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, {
570
587
  childList: !0,
571
588
  subtree: !0
572
589
  }));
@@ -574,12 +591,12 @@ function Ze({
574
591
  } catch (x) {
575
592
  console.warn("Drill affordance skipped:", x);
576
593
  }
577
- b.onReady(re), C = setTimeout(re, 1e4);
594
+ b.onReady(ae), C = setTimeout(ae, 1e4);
578
595
  } catch (m) {
579
- console.error("Error rendering visualization:", m), S?.disconnect(), D?.disconnect(), N?.disconnect(), b.remove(), b = void 0, u.parentNode === d && d.removeChild(u);
596
+ console.error("Error rendering visualization:", m), A?.disconnect(), D?.disconnect(), B?.disconnect(), b.remove(), b = void 0, u.parentNode === d && d.removeChild(u);
580
597
  }
581
598
  })(), () => {
582
- V = !0, S?.disconnect(), D?.disconnect(), T && clearTimeout(T), C && clearTimeout(C), c && w.current?.node !== c && ($ && c.removeEventListener("keydown", $), P && c.removeEventListener("keyup", P), j && c.removeEventListener("focusin", j), N?.disconnect(), cancelAnimationFrame(K), b?.remove(), c.parentNode === d && d.removeChild(c), d.style.position = "");
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 = "");
583
600
  };
584
601
  }, [
585
602
  e,
@@ -587,15 +604,15 @@ function Ze({
587
604
  p,
588
605
  l,
589
606
  r,
590
- B,
591
- q,
592
- J,
593
- Q
594
- ]), /* @__PURE__ */ z(
607
+ $,
608
+ V,
609
+ Q,
610
+ Z
611
+ ]), /* @__PURE__ */ M(
595
612
  "div",
596
613
  {
597
614
  ref: n,
598
- ...a ? { [I]: "" } : {},
615
+ ...o ? { [I]: "" } : {},
599
616
  style: {
600
617
  width: "100%",
601
618
  height: t ? `${t}px` : "400px"
@@ -603,9 +620,9 @@ function Ze({
603
620
  }
604
621
  );
605
622
  }
606
- function et(e) {
607
- return typeof window > "u" ? /* @__PURE__ */ z(
608
- le,
623
+ function tt(e) {
624
+ return typeof window > "u" ? /* @__PURE__ */ M(
625
+ ie,
609
626
  {
610
627
  sx: {
611
628
  width: "100%",
@@ -617,11 +634,11 @@ function et(e) {
617
634
  },
618
635
  children: "Loading..."
619
636
  }
620
- ) : /* @__PURE__ */ z(
621
- ye,
637
+ ) : /* @__PURE__ */ M(
638
+ pe,
622
639
  {
623
- fallback: /* @__PURE__ */ z(
624
- le,
640
+ fallback: /* @__PURE__ */ M(
641
+ ie,
625
642
  {
626
643
  sx: {
627
644
  width: "100%",
@@ -634,21 +651,21 @@ function et(e) {
634
651
  children: "Loading visualization..."
635
652
  }
636
653
  ),
637
- children: /* @__PURE__ */ z(Ze, { ...e })
654
+ children: /* @__PURE__ */ M(et, { ...e })
638
655
  }
639
656
  );
640
657
  }
641
- const lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
658
+ const it = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
642
659
  __proto__: null,
643
- default: et
660
+ default: tt
644
661
  }, Symbol.toStringTag, { value: "Module" }));
645
662
  export {
646
663
  v as D,
647
- et as R,
664
+ tt as R,
648
665
  Be as a,
649
- Le as b,
650
- lt as c,
666
+ $e as b,
667
+ it as c,
651
668
  Me as d,
652
- ze as m,
669
+ Ie as m,
653
670
  Ne as r
654
671
  };