@malloy-publisher/sdk 0.10.1 → 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.
- package/dist/{RenderedResult-vf6tu8tf.es.js → RenderedResult-B_sW7neX.es.js} +329 -266
- package/dist/RenderedResult-BlYdT4lz.cjs.js +179 -0
- package/dist/{ServerProvider-B6RLAbgV.es.js → ServerProvider-BN399NH6.es.js} +4 -4
- package/dist/builder/index.cjs.js +1 -1
- package/dist/builder/index.es.js +3 -3
- package/dist/client/api.d.ts +6 -6
- package/dist/client/index.es.js +1 -1
- package/dist/components/Dashboard/DashboardView.d.ts +10 -3
- package/dist/components/Dashboard/DownloadRowsCsv.d.ts +10 -0
- package/dist/components/Dashboard/RowsDialog.d.ts +63 -21
- package/dist/components/Dashboard/index.d.ts +2 -0
- package/dist/components/Dashboard/rowsCsv.d.ts +26 -0
- package/dist/components/RenderedResult/ResultContainer.d.ts +2 -3
- package/dist/components/RenderedResult/resultSizing.d.ts +2 -0
- package/dist/components/Report/Report.d.ts +8 -1
- package/dist/components/drill/drillClauses.d.ts +34 -0
- package/dist/components/drill/drillClickRelay.d.ts +36 -0
- package/dist/components/drill/resolveDrill.d.ts +29 -0
- package/dist/components/drill/rowsTarget.d.ts +114 -0
- package/dist/components/drill/useDrill.d.ts +24 -12
- package/dist/index.cjs.js +13 -11
- package/dist/index.es.js +7331 -6886
- package/dist/{useCompiledDocument-C995sQ3j.cjs.js → useCompiledDocument-CyPOSStA.cjs.js} +31 -31
- package/dist/{useCompiledDocument-CLbTFtsJ.es.js → useCompiledDocument-xJRD5DRP.es.js} +1588 -1575
- package/dist/utils/malloyString.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/Dashboard/DashboardView.tsx +54 -28
- package/src/components/Dashboard/DownloadRowsCsv.tsx +152 -0
- package/src/components/Dashboard/RowsDialog.actions.spec.tsx +250 -0
- package/src/components/Dashboard/RowsDialog.drill.compile.spec.ts +672 -0
- package/src/components/Dashboard/RowsDialog.spec.ts +38 -11
- package/src/components/Dashboard/RowsDialog.tsx +194 -40
- package/src/components/Dashboard/index.ts +2 -0
- package/src/components/Dashboard/rowsCsv.spec.ts +105 -0
- package/src/components/Dashboard/rowsCsv.ts +107 -0
- package/src/components/RenderedResult/RenderedResult.tsx +44 -7
- package/src/components/RenderedResult/ResultContainer.tsx +2 -2
- package/src/components/RenderedResult/resultSizing.ts +3 -0
- package/src/components/Report/Report.tsx +9 -0
- package/src/components/drill/drillClauses.ts +201 -0
- package/src/components/drill/drillClickRelay.spec.ts +122 -0
- package/src/components/drill/drillClickRelay.ts +106 -0
- package/src/components/drill/resolveDrill.ts +29 -0
- package/src/components/drill/rowsTarget.ts +245 -0
- package/src/components/drill/useDrill.spec.tsx +311 -15
- package/src/components/drill/useDrill.tsx +206 -67
- package/src/components/legacy/malloynb/NotebookCell.tsx +0 -7
- package/src/utils/malloyString.ts +21 -2
- package/dist/RenderedResult-B5f4qOjp.cjs.js +0 -171
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Box as
|
|
3
|
-
import { Suspense as
|
|
4
|
-
import { r as
|
|
5
|
-
import { ba as De, b8 as Oe, bb as Fe, bc as ze } from "./ServerProvider-
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
const
|
|
9
|
-
let
|
|
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
|
+
import { ba as De, b8 as Oe, bb as Fe, bc as ze } from "./ServerProvider-BN399NH6.es.js";
|
|
6
|
+
const g = ke.drillCell;
|
|
7
|
+
function Le(e, t) {
|
|
8
|
+
const r = /* @__PURE__ */ new Set();
|
|
9
|
+
let a;
|
|
10
10
|
try {
|
|
11
|
-
|
|
11
|
+
a = e.getMetadata()?.getAllFields() ?? [];
|
|
12
12
|
} catch {
|
|
13
|
-
return
|
|
13
|
+
return r;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
16
|
-
for (const
|
|
17
|
-
!
|
|
18
|
-
for (const
|
|
19
|
-
if (!
|
|
20
|
-
const
|
|
21
|
-
|
|
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
|
|
23
|
+
return r;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
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
|
|
29
|
+
function Me(e, t) {
|
|
30
30
|
if (t.size !== 0)
|
|
31
|
-
for (const
|
|
31
|
+
for (const r of e.querySelectorAll(
|
|
32
32
|
".malloy-table"
|
|
33
33
|
)) {
|
|
34
|
-
const
|
|
35
|
-
for (const
|
|
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
|
|
39
|
-
const i = (
|
|
40
|
-
h && t.has(i) &&
|
|
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 (
|
|
43
|
-
const
|
|
44
|
-
for (const
|
|
45
|
-
`.${
|
|
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
|
|
48
|
-
const i =
|
|
49
|
-
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
|
|
51
|
+
for (const l of r.querySelectorAll(
|
|
52
52
|
".column-cell.td"
|
|
53
53
|
)) {
|
|
54
|
-
if (!l
|
|
55
|
-
const i =
|
|
56
|
-
if (i && h &&
|
|
57
|
-
if (
|
|
58
|
-
|
|
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
|
|
61
|
-
|
|
60
|
+
const y = n.has(i);
|
|
61
|
+
y || n.add(i), l.tabIndex = y ? -1 : 0;
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
l.setAttribute("role", "button");
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
const t = e.closest(".malloy-table"),
|
|
70
|
-
return !t || !
|
|
71
|
-
t.querySelectorAll(`.${
|
|
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
|
-
(
|
|
73
|
+
(a) => a.closest(".malloy-table") === t && B(a) === r
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
for (const
|
|
82
|
-
return
|
|
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:
|
|
108
|
+
const { foreground: t, axisFaint: r, gridline: a, font: o } = e, n = {
|
|
109
109
|
background: e.background,
|
|
110
|
-
font:
|
|
111
|
-
title: { color: t, font:
|
|
110
|
+
font: o.family,
|
|
111
|
+
title: { color: t, font: o.family },
|
|
112
112
|
axis: {
|
|
113
113
|
labelColor: t,
|
|
114
114
|
titleColor: t,
|
|
115
|
-
domainColor:
|
|
116
|
-
tickColor:
|
|
117
|
-
gridColor:
|
|
118
|
-
labelFont:
|
|
119
|
-
titleFont:
|
|
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:
|
|
125
|
-
titleFont:
|
|
124
|
+
labelFont: o.family,
|
|
125
|
+
titleFont: o.family
|
|
126
126
|
},
|
|
127
127
|
header: { labelColor: t, titleColor: t },
|
|
128
128
|
range: { category: e.series }
|
|
129
|
-
},
|
|
130
|
-
...
|
|
131
|
-
legend: { ...
|
|
129
|
+
}, l = {
|
|
130
|
+
...n,
|
|
131
|
+
legend: { ...n.legend, orient: "bottom" }
|
|
132
132
|
};
|
|
133
|
-
return (i) => i === "shape_map" ?
|
|
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
|
|
140
|
-
if (
|
|
141
|
-
const
|
|
142
|
-
|
|
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 =
|
|
144
|
+
const h = a.tag(i);
|
|
145
145
|
if (!h) continue;
|
|
146
|
-
const
|
|
147
|
-
k && (
|
|
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(
|
|
149
|
+
Object.keys(n).length > 0 && (r.palette = n);
|
|
150
150
|
}
|
|
151
|
-
const
|
|
152
|
-
if (
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
const i =
|
|
156
|
-
typeof i == "number" && Number.isFinite(i) && (
|
|
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(
|
|
158
|
+
return Object.keys(r).length > 0 ? r : void 0;
|
|
159
159
|
}
|
|
160
|
-
const
|
|
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) =>
|
|
166
|
-
const
|
|
167
|
-
return /^#[^("]/.test(
|
|
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
|
|
170
|
-
let
|
|
171
|
-
return { fields: e.map((
|
|
172
|
-
const
|
|
173
|
-
if (
|
|
174
|
-
const i =
|
|
175
|
-
|
|
176
|
-
|
|
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
|
|
179
|
-
|
|
180
|
-
const h =
|
|
181
|
-
...
|
|
178
|
+
if (!i.changed) return o;
|
|
179
|
+
r = !0;
|
|
180
|
+
const h = o.type?.element_type ? {
|
|
181
|
+
...o.type,
|
|
182
182
|
element_type: {
|
|
183
|
-
...
|
|
183
|
+
...o.type.element_type,
|
|
184
184
|
fields: i.fields
|
|
185
185
|
}
|
|
186
|
-
} : { ...
|
|
187
|
-
return { ...
|
|
186
|
+
} : { ...o.type, fields: i.fields };
|
|
187
|
+
return { ...o, type: h };
|
|
188
188
|
}
|
|
189
|
-
if (!t || !
|
|
190
|
-
const
|
|
191
|
-
return
|
|
192
|
-
...
|
|
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(
|
|
194
|
+
{ value: `# label=${He(l)}
|
|
195
195
|
` },
|
|
196
|
-
...
|
|
196
|
+
...o.annotations ?? []
|
|
197
197
|
]
|
|
198
198
|
});
|
|
199
|
-
}), changed:
|
|
199
|
+
}), changed: r };
|
|
200
200
|
}
|
|
201
201
|
function Ve(e) {
|
|
202
202
|
if (!e || typeof e != "object") return e;
|
|
203
|
-
const t = e,
|
|
204
|
-
if (!Array.isArray(
|
|
205
|
-
const { fields:
|
|
206
|
-
|
|
207
|
-
|
|
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
|
|
209
|
+
return o ? { ...t, schema: { ...t.schema, fields: a } } : e;
|
|
210
210
|
}
|
|
211
|
-
const
|
|
212
|
-
function
|
|
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
|
|
216
|
-
const
|
|
217
|
-
return Math.min(Math.max(
|
|
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
|
-
|
|
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
|
|
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: (
|
|
233
|
-
console.error("Error rendering visualization:", typeof
|
|
278
|
+
onError: (n) => {
|
|
279
|
+
console.error("Error rendering visualization:", typeof n, n);
|
|
234
280
|
}
|
|
235
281
|
}).createViz();
|
|
236
282
|
};
|
|
237
|
-
async function
|
|
283
|
+
async function Ze(e) {
|
|
238
284
|
if (!e || typeof e != "object") return;
|
|
239
|
-
const t = e,
|
|
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((
|
|
244
|
-
if (
|
|
245
|
-
let
|
|
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:
|
|
293
|
+
({ parseAnnotation: a } = await Ce());
|
|
248
294
|
} catch {
|
|
249
295
|
return;
|
|
250
296
|
}
|
|
251
297
|
try {
|
|
252
|
-
const { tag:
|
|
253
|
-
return Ne(
|
|
254
|
-
} catch (
|
|
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:
|
|
303
|
+
{ error: o, lines: r }
|
|
258
304
|
);
|
|
259
305
|
return;
|
|
260
306
|
}
|
|
261
307
|
}
|
|
262
|
-
function
|
|
263
|
-
const
|
|
264
|
-
for (const [
|
|
265
|
-
e.style.setProperty(
|
|
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
|
|
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
|
-
[${
|
|
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
|
-
[${
|
|
415
|
+
[${V}] .malloy-render .malloy-big-value-card:not(.malloy-big-value-card--embedded) {
|
|
370
416
|
padding: 9px 14px;
|
|
371
417
|
}
|
|
372
|
-
[${
|
|
418
|
+
[${V}] .malloy-render .malloy-big-value-value {
|
|
373
419
|
font-size: 22px;
|
|
374
420
|
}
|
|
375
|
-
[${
|
|
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
|
-
[${
|
|
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 .${
|
|
463
|
+
.malloy-render .${g} {
|
|
418
464
|
cursor: pointer;
|
|
419
465
|
}
|
|
420
|
-
.malloy-render .${
|
|
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 .${
|
|
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 .${
|
|
478
|
+
.malloy-render .${g}:focus-visible > .cell-content {
|
|
433
479
|
color: var(--publisher-drill-link) !important;
|
|
434
480
|
text-decoration: underline;
|
|
435
481
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
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 =
|
|
494
|
+
e.id = me, e.textContent = tt, document.head.appendChild(e);
|
|
441
495
|
}
|
|
442
|
-
function
|
|
496
|
+
function ot({
|
|
443
497
|
result: e,
|
|
444
498
|
height: t,
|
|
445
|
-
drill:
|
|
446
|
-
onSizeChange:
|
|
447
|
-
onSizing:
|
|
448
|
-
fill:
|
|
499
|
+
drill: r,
|
|
500
|
+
onSizeChange: a,
|
|
501
|
+
onSizing: o,
|
|
502
|
+
fill: n
|
|
449
503
|
}) {
|
|
450
|
-
const
|
|
451
|
-
i.current =
|
|
452
|
-
const h =
|
|
453
|
-
i.current?.onClick(d)
|
|
454
|
-
|
|
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
|
-
),
|
|
511
|
+
), X = M(0), { theme: N, layers: W, mode: ee } = Oe(), te = de(
|
|
457
512
|
() => ({
|
|
458
|
-
radius:
|
|
459
|
-
padding: `${
|
|
513
|
+
radius: N.ui.radius.tile,
|
|
514
|
+
padding: `${xe}px`
|
|
460
515
|
}),
|
|
461
|
-
[
|
|
516
|
+
[N.ui.radius.tile]
|
|
462
517
|
);
|
|
463
|
-
return
|
|
464
|
-
|
|
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
|
-
}, []),
|
|
468
|
-
if (!
|
|
469
|
-
|
|
470
|
-
const d =
|
|
471
|
-
let
|
|
472
|
-
const
|
|
473
|
-
let c, b,
|
|
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
|
|
476
|
-
const G = (
|
|
477
|
-
if (
|
|
478
|
-
const
|
|
479
|
-
if (k.current && !
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
|
|
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
|
-
|
|
487
|
-
const
|
|
488
|
-
|
|
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
|
|
550
|
+
let v;
|
|
492
551
|
try {
|
|
493
|
-
|
|
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
|
|
499
|
-
if (!
|
|
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
|
|
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 (!
|
|
569
|
+
if (!U()) {
|
|
507
570
|
b.remove(), b = void 0;
|
|
508
571
|
return;
|
|
509
572
|
}
|
|
510
|
-
const
|
|
511
|
-
c = document.createElement("div"), c.style.width = "100%", c.style.height = "100%",
|
|
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
|
-
|
|
514
|
-
|
|
515
|
-
G(u), k.current &&
|
|
576
|
+
D = new MutationObserver(() => {
|
|
577
|
+
O && clearTimeout(O), O = setTimeout(() => {
|
|
578
|
+
G(u), k.current && D?.disconnect();
|
|
516
579
|
}, 100);
|
|
517
|
-
}),
|
|
580
|
+
}), D.observe(c, {
|
|
518
581
|
childList: !0,
|
|
519
582
|
subtree: !0,
|
|
520
583
|
attributes: !0
|
|
521
584
|
});
|
|
522
|
-
const
|
|
523
|
-
let
|
|
585
|
+
const S = b;
|
|
586
|
+
let C = !1;
|
|
524
587
|
const ae = () => {
|
|
525
|
-
if (!(
|
|
526
|
-
|
|
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:
|
|
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(
|
|
596
|
+
b.setResult(Ve(v));
|
|
534
597
|
try {
|
|
535
|
-
const
|
|
536
|
-
y =
|
|
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
|
-
|
|
601
|
+
p = void 0, A = void 0;
|
|
539
602
|
}
|
|
540
|
-
|
|
541
|
-
const m =
|
|
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
|
|
606
|
+
const ne = i.current;
|
|
544
607
|
try {
|
|
545
|
-
if (
|
|
546
|
-
const
|
|
608
|
+
if (ne) {
|
|
609
|
+
const R = Le(b, ne.canDrill), E = () => {
|
|
547
610
|
try {
|
|
548
|
-
|
|
611
|
+
Me(u, R);
|
|
549
612
|
} catch (s) {
|
|
550
613
|
console.warn("Drill affordance skipped:", s);
|
|
551
614
|
}
|
|
552
615
|
};
|
|
553
|
-
|
|
554
|
-
const
|
|
555
|
-
const _ = s.querySelector(".cell-content") ?? s,
|
|
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(
|
|
562
|
-
clientY: Math.round(
|
|
624
|
+
clientX: Math.round(J.left + J.width / 2),
|
|
625
|
+
clientY: Math.round(J.bottom)
|
|
563
626
|
})
|
|
564
627
|
);
|
|
565
|
-
},
|
|
566
|
-
|
|
628
|
+
}, ie = (s) => s.target?.closest?.(`.${g}`) ?? null, pe = (s, f) => {
|
|
629
|
+
ue(s, f)?.focus();
|
|
567
630
|
};
|
|
568
|
-
|
|
569
|
-
const f =
|
|
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(),
|
|
636
|
+
s.preventDefault(), pe(f, _);
|
|
574
637
|
return;
|
|
575
638
|
}
|
|
576
|
-
s.key === "Enter" ? (s.preventDefault(),
|
|
577
|
-
},
|
|
639
|
+
s.key === "Enter" ? (s.preventDefault(), le(f)) : s.key === " " && s.preventDefault();
|
|
640
|
+
}, H = (s) => {
|
|
578
641
|
if (s.key !== " ") return;
|
|
579
|
-
const f =
|
|
580
|
-
f && (s.preventDefault(),
|
|
581
|
-
},
|
|
582
|
-
const f = s.target?.closest?.(`.${
|
|
583
|
-
f &&
|
|
584
|
-
}, u.addEventListener("keydown",
|
|
585
|
-
cancelAnimationFrame(
|
|
586
|
-
}),
|
|
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 (
|
|
592
|
-
console.warn("Drill affordance skipped:",
|
|
654
|
+
} catch (R) {
|
|
655
|
+
console.warn("Drill affordance skipped:", R);
|
|
593
656
|
}
|
|
594
|
-
b.onReady(ae),
|
|
657
|
+
b.onReady(ae), T = setTimeout(ae, 1e4);
|
|
595
658
|
} catch (m) {
|
|
596
|
-
console.error("Error rendering visualization:", m),
|
|
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
|
-
|
|
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
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
]), /* @__PURE__ */
|
|
667
|
+
y,
|
|
668
|
+
a,
|
|
669
|
+
o,
|
|
670
|
+
N,
|
|
671
|
+
W,
|
|
672
|
+
ee,
|
|
673
|
+
te
|
|
674
|
+
]), /* @__PURE__ */ I(
|
|
612
675
|
"div",
|
|
613
676
|
{
|
|
614
|
-
ref:
|
|
615
|
-
...
|
|
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
|
|
624
|
-
return typeof window > "u" ? /* @__PURE__ */
|
|
625
|
-
|
|
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__ */
|
|
638
|
-
|
|
700
|
+
) : /* @__PURE__ */ I(
|
|
701
|
+
ge,
|
|
639
702
|
{
|
|
640
|
-
fallback: /* @__PURE__ */
|
|
641
|
-
|
|
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__ */
|
|
717
|
+
children: /* @__PURE__ */ I(ot, { ...e })
|
|
655
718
|
}
|
|
656
719
|
);
|
|
657
720
|
}
|
|
658
|
-
const
|
|
721
|
+
const ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
659
722
|
__proto__: null,
|
|
660
|
-
default:
|
|
723
|
+
default: at
|
|
661
724
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
662
725
|
export {
|
|
663
|
-
|
|
664
|
-
|
|
726
|
+
g as D,
|
|
727
|
+
at as R,
|
|
665
728
|
Be as a,
|
|
666
729
|
$e as b,
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
730
|
+
ct as c,
|
|
731
|
+
Le as d,
|
|
732
|
+
Me as m,
|
|
670
733
|
Ne as r
|
|
671
734
|
};
|