@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.
- package/dist/{RenderedResult-BCJC0ZVj.es.js → RenderedResult-B_sW7neX.es.js} +328 -265
- package/dist/RenderedResult-BlYdT4lz.cjs.js +179 -0
- package/dist/builder/index.cjs.js +1 -1
- package/dist/builder/index.es.js +2 -2
- package/dist/client/api.d.ts +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-Citpvpnx.es.js → useCompiledDocument-xJRD5DRP.es.js} +1587 -1574
- 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,9 +1,20 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Menu, MenuItem } from "@mui/material";
|
|
5
5
|
import { useCallback, useMemo, useState, type ReactNode } from "react";
|
|
6
|
+
import { drillClauseLabels } from "./drillClauses";
|
|
6
7
|
import type { DrillField } from "./resolveDrill";
|
|
8
|
+
import {
|
|
9
|
+
asRowsField,
|
|
10
|
+
canShowRows,
|
|
11
|
+
dimensionCode,
|
|
12
|
+
rowDimensionsOf,
|
|
13
|
+
rowsDimensions,
|
|
14
|
+
rowsTargetOf,
|
|
15
|
+
rowTimezone,
|
|
16
|
+
type RowsDimension,
|
|
17
|
+
} from "./rowsTarget";
|
|
7
18
|
import {
|
|
8
19
|
DRILL_SELF,
|
|
9
20
|
drillDestinations,
|
|
@@ -41,18 +52,16 @@ export interface UseDrillOptions {
|
|
|
41
52
|
*/
|
|
42
53
|
canSelf?: (given: string) => boolean;
|
|
43
54
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* cannot know which document the reader is in, so the surface names itself.
|
|
55
|
+
* A `to=` destination's title, for its menu entry. Undefined, or no
|
|
56
|
+
* function, and the entry names the destination's file name instead.
|
|
47
57
|
*/
|
|
48
|
-
|
|
58
|
+
destinationTitle?: (destination: string) => string | undefined;
|
|
49
59
|
/**
|
|
50
|
-
* Show the rows behind a grouped value. With it,
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* says so.
|
|
60
|
+
* Show the rows behind a grouped value. With it, a dimension cell whose
|
|
61
|
+
* result names everything its rows query needs (`canShowRows`) offers
|
|
62
|
+
* "Show rows" in its menu, beside any `# drill` actions. Omitted on a
|
|
63
|
+
* surface with nowhere to show them, and cells then offer only what a tag
|
|
64
|
+
* says.
|
|
56
65
|
*/
|
|
57
66
|
onRows?: (request: DrillRowsRequest) => void;
|
|
58
67
|
}
|
|
@@ -77,22 +86,75 @@ export interface DrillBinding {
|
|
|
77
86
|
export interface UseDrillResult {
|
|
78
87
|
/** Hand to `ResultContainer`'s (or `RenderedResult`'s) `drill` prop. */
|
|
79
88
|
drill: DrillBinding;
|
|
80
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* The binding for one result on a surface with several, such as a
|
|
91
|
+
* dashboard's tiles: its clicks carry `context`. `rows: false` turns rows
|
|
92
|
+
* off for that result, leaving its tag drills.
|
|
93
|
+
*/
|
|
94
|
+
bindingFor: (context: string | undefined, rows: boolean) => DrillBinding;
|
|
95
|
+
/** Render anywhere in the subtree: the menu every drillable click opens. */
|
|
81
96
|
drillMenu: ReactNode;
|
|
82
97
|
}
|
|
83
98
|
|
|
99
|
+
interface DrillMenuItem {
|
|
100
|
+
key: string;
|
|
101
|
+
label: string;
|
|
102
|
+
run: () => void;
|
|
103
|
+
}
|
|
104
|
+
|
|
84
105
|
interface DrillMenuState {
|
|
85
|
-
|
|
86
|
-
destinations: string[];
|
|
87
|
-
event?: MouseEvent;
|
|
106
|
+
items: DrillMenuItem[];
|
|
88
107
|
top: number;
|
|
89
108
|
left: number;
|
|
90
|
-
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** A menu item is cut to this width; its full text is its tooltip and accessible name. */
|
|
112
|
+
const MENU_ITEM_MAX_WIDTH = 360;
|
|
113
|
+
|
|
114
|
+
/** A field as its column header reads: its `# label`, else its name. */
|
|
115
|
+
function fieldLabel(field: DrillField | undefined): string {
|
|
116
|
+
if (!field) return "";
|
|
117
|
+
return (
|
|
118
|
+
field.getLabel?.() ??
|
|
119
|
+
field.tag?.text("label") ??
|
|
120
|
+
asRowsField(field).metadataTag?.text("label") ??
|
|
121
|
+
field.name
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The values the rows behind a click are filtered on, each named by its
|
|
127
|
+
* column header: `Region: West, Month: 2025-12`, outermost first. Without the
|
|
128
|
+
* row's clauses, the clicked value alone.
|
|
129
|
+
*/
|
|
130
|
+
function rowsValuesLabel(rows: DrillRowsRequest, field: DrillField): string {
|
|
131
|
+
const parts = rows.drillClauses
|
|
132
|
+
? drillClauseLabels(rows.drillClauses, rows.timezone)
|
|
133
|
+
: [];
|
|
134
|
+
if (parts.length === 0) return `${fieldLabel(field)}: ${rows.label}`;
|
|
135
|
+
const row = rowDimensionsOf(asRowsField(field));
|
|
136
|
+
return parts
|
|
137
|
+
.map((part) => {
|
|
138
|
+
const key = JSON.stringify(part.expression);
|
|
139
|
+
const match = row.find(
|
|
140
|
+
(d) => JSON.stringify(d.drillStableExpression) === key,
|
|
141
|
+
);
|
|
142
|
+
return `${match ? fieldLabel(match) : part.field}: ${part.label}`;
|
|
143
|
+
})
|
|
144
|
+
.join(", ");
|
|
91
145
|
}
|
|
92
146
|
|
|
93
147
|
/**
|
|
94
148
|
* Click-to-drill for any surface that renders a Malloy result.
|
|
95
149
|
*
|
|
150
|
+
* Every drillable click opens one small menu that says what it can do, even
|
|
151
|
+
* when there is only one thing, each item naming the field and value it acts
|
|
152
|
+
* on: `Filter to Region: West` for a `to=self` drill, `Open Regional review
|
|
153
|
+
* (Region: West)` for each `to=` report, then `Show rows (Region: West, Month:
|
|
154
|
+
* 2025-12)`. A field is named as its column header reads. A `# drill` tag
|
|
155
|
+
* adds actions; it never replaces the rows, and a click never acts on a tag
|
|
156
|
+
* the reader cannot see.
|
|
157
|
+
*
|
|
96
158
|
* Shared between the dashboard viewer and notebook cells on purpose: `# drill`
|
|
97
159
|
* is declared on a model *dimension*, so it fires wherever that dimension is
|
|
98
160
|
* grouped, and a notebook can therefore drill into a dashboard with no notebook-
|
|
@@ -102,7 +164,7 @@ interface DrillMenuState {
|
|
|
102
164
|
export function useDrill({
|
|
103
165
|
onNavigate,
|
|
104
166
|
onSelf,
|
|
105
|
-
|
|
167
|
+
destinationTitle,
|
|
106
168
|
canSelf,
|
|
107
169
|
onRows,
|
|
108
170
|
}: UseDrillOptions): UseDrillResult {
|
|
@@ -143,21 +205,57 @@ export function useDrill({
|
|
|
143
205
|
[onNavigate, onSelf],
|
|
144
206
|
);
|
|
145
207
|
|
|
146
|
-
// The rows behind this click, when the surface shows rows and the
|
|
147
|
-
//
|
|
148
|
-
// has no
|
|
208
|
+
// The rows behind this click, when the surface shows rows and the result
|
|
209
|
+
// names everything the query needs (`canShowRows`). A header names the
|
|
210
|
+
// field and has no value; a measure has no rows of its own. Without the
|
|
211
|
+
// row's clauses the clicked value is the whole filter, so an empty cell is
|
|
212
|
+
// refused as a likely misclick.
|
|
149
213
|
const rowsBehind = useCallback(
|
|
150
214
|
(payload: DrillClickPayload): DrillRowsRequest | undefined => {
|
|
151
|
-
if (!onRows || payload.isHeader || !payload.field)
|
|
152
|
-
|
|
153
|
-
|
|
215
|
+
if (!onRows || payload.noRows || payload.isHeader || !payload.field)
|
|
216
|
+
return undefined;
|
|
217
|
+
const field = asRowsField(payload.field);
|
|
218
|
+
if (!canShowRows(field)) return undefined;
|
|
219
|
+
const target = rowsTargetOf(field);
|
|
220
|
+
if (target === undefined) return undefined;
|
|
221
|
+
const clauses = payload.drillClauses;
|
|
222
|
+
// With the row: every dimension of it. Without one (a click the
|
|
223
|
+
// renderer reports no row for), the clicked value alone, which names
|
|
224
|
+
// the rows only when it is the row's one dimension.
|
|
225
|
+
let rows: { dimensions: RowsDimension[] } | { code: string };
|
|
226
|
+
if (clauses !== undefined) {
|
|
227
|
+
const dimensions = rowsDimensions(field, clauses);
|
|
228
|
+
if (dimensions === undefined) return undefined;
|
|
229
|
+
rows = { dimensions };
|
|
230
|
+
} else {
|
|
231
|
+
const code = dimensionCode(field);
|
|
232
|
+
if (
|
|
233
|
+
code === undefined ||
|
|
234
|
+
rowDimensionsOf(field).length !== 1 ||
|
|
235
|
+
drillValueToFilter(payload.value) === undefined ||
|
|
236
|
+
// A bigint past 2^53 arrives rounded, and names another row.
|
|
237
|
+
(typeof payload.value === "number" &&
|
|
238
|
+
Number.isInteger(payload.value) &&
|
|
239
|
+
!Number.isSafeInteger(payload.value))
|
|
240
|
+
)
|
|
241
|
+
return undefined;
|
|
242
|
+
rows = { code };
|
|
243
|
+
}
|
|
244
|
+
const timezone = rowTimezone(field) ?? undefined;
|
|
154
245
|
return {
|
|
155
246
|
field: payload.field.name,
|
|
156
247
|
rawValue: payload.value,
|
|
157
248
|
label: drillValueLabel(payload.value),
|
|
249
|
+
target,
|
|
250
|
+
...rows,
|
|
158
251
|
...(payload.context === undefined
|
|
159
252
|
? {}
|
|
160
253
|
: { context: payload.context }),
|
|
254
|
+
...(clauses === undefined ? {} : { drillClauses: clauses }),
|
|
255
|
+
// The row's time dimensions' zone, not the clicked field's: a
|
|
256
|
+
// string clicked in a nest with its own `timezone:` would
|
|
257
|
+
// otherwise move the outer level's day boundaries.
|
|
258
|
+
...(timezone === undefined ? {} : { timezone }),
|
|
161
259
|
};
|
|
162
260
|
},
|
|
163
261
|
[onRows],
|
|
@@ -168,46 +266,86 @@ export function useDrill({
|
|
|
168
266
|
// Runs on every cell click, so "not a drill" is the ordinary answer.
|
|
169
267
|
const intent = resolveDrill(payload);
|
|
170
268
|
const rows = rowsBehind(payload);
|
|
171
|
-
// Offer only what this surface can actually do, so
|
|
172
|
-
//
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
269
|
+
// Offer only what this surface can actually do, so the menu never lists
|
|
270
|
+
// an action that would be a no-op when picked. Deduplicated: `# drill
|
|
271
|
+
// { to=[overview, overview] }` is a typo rather than a request for two
|
|
272
|
+
// identical rows. `to=self` first, then reports in the tag's order.
|
|
273
|
+
const destinations = intent
|
|
274
|
+
? Array.from(new Set(honorable(intent.to, intent.given))).sort(
|
|
275
|
+
(a, b) => Number(b === DRILL_SELF) - Number(a === DRILL_SELF),
|
|
276
|
+
)
|
|
277
|
+
: [];
|
|
278
|
+
const value = `${fieldLabel(payload.field)}: ${
|
|
279
|
+
intent?.label ?? drillValueLabel(payload.value)
|
|
280
|
+
}`;
|
|
281
|
+
const items: DrillMenuItem[] = destinations.map((destination) => ({
|
|
282
|
+
key: `to:${destination}`,
|
|
283
|
+
label:
|
|
284
|
+
destination === DRILL_SELF
|
|
285
|
+
? `Filter to ${value}`
|
|
286
|
+
: // The report's title, else its file name (a path from the package root).
|
|
287
|
+
`Open ${
|
|
288
|
+
destinationTitle?.(destination) ??
|
|
289
|
+
humanizeSlug(destination.split("/").pop() ?? destination)
|
|
290
|
+
} (${value})`,
|
|
291
|
+
run: () => {
|
|
292
|
+
if (intent) go(intent, destination, payload.event);
|
|
293
|
+
},
|
|
294
|
+
}));
|
|
295
|
+
if (rows && payload.field)
|
|
296
|
+
items.push({
|
|
297
|
+
key: "rows",
|
|
298
|
+
label: `Show rows (${rowsValuesLabel(rows, payload.field)})`,
|
|
299
|
+
run: () => onRows?.(rows),
|
|
300
|
+
});
|
|
301
|
+
if (items.length === 0) return;
|
|
182
302
|
setMenu({
|
|
183
|
-
|
|
184
|
-
destinations,
|
|
185
|
-
event: payload.event,
|
|
303
|
+
items,
|
|
186
304
|
top: payload.event?.clientY ?? 0,
|
|
187
305
|
left: payload.event?.clientX ?? 0,
|
|
188
|
-
label: intent?.label ?? rows?.label ?? "",
|
|
189
306
|
});
|
|
190
307
|
},
|
|
191
|
-
[go, honorable, onRows, rowsBehind],
|
|
308
|
+
[go, honorable, onRows, rowsBehind, destinationTitle],
|
|
192
309
|
);
|
|
193
310
|
|
|
194
|
-
const
|
|
311
|
+
const canDrillTag = useCallback(
|
|
195
312
|
(field: DrillField) =>
|
|
196
|
-
honorable(drillDestinations(field), drillGivenName(field)).length >
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
313
|
+
honorable(drillDestinations(field), drillGivenName(field)).length > 0,
|
|
314
|
+
[honorable],
|
|
315
|
+
);
|
|
316
|
+
const canDrillRows = useCallback(
|
|
317
|
+
(field: DrillField) =>
|
|
318
|
+
onRows !== undefined && canShowRows(asRowsField(field)),
|
|
319
|
+
[onRows],
|
|
200
320
|
);
|
|
201
321
|
|
|
202
322
|
const drill = useMemo<DrillBinding>(
|
|
203
|
-
() => ({
|
|
204
|
-
|
|
323
|
+
() => ({
|
|
324
|
+
onClick,
|
|
325
|
+
canDrill: (field) => canDrillTag(field) || canDrillRows(field),
|
|
326
|
+
}),
|
|
327
|
+
[onClick, canDrillTag, canDrillRows],
|
|
328
|
+
);
|
|
329
|
+
|
|
330
|
+
const bindingFor = useCallback(
|
|
331
|
+
(context: string | undefined, rows: boolean): DrillBinding => ({
|
|
332
|
+
canDrill: (field) =>
|
|
333
|
+
canDrillTag(field) || (rows && canDrillRows(field)),
|
|
334
|
+
onClick: (payload) =>
|
|
335
|
+
onClick({
|
|
336
|
+
...payload,
|
|
337
|
+
...(context === undefined ? {} : { context }),
|
|
338
|
+
...(rows ? {} : { noRows: true }),
|
|
339
|
+
}),
|
|
340
|
+
}),
|
|
341
|
+
[onClick, canDrillTag, canDrillRows],
|
|
205
342
|
);
|
|
206
343
|
|
|
207
344
|
const close = useCallback(() => setMenu(null), []);
|
|
208
345
|
|
|
209
346
|
return {
|
|
210
347
|
drill,
|
|
348
|
+
bindingFor,
|
|
211
349
|
drillMenu: (
|
|
212
350
|
<Menu
|
|
213
351
|
open={menu !== null}
|
|
@@ -215,29 +353,30 @@ export function useDrill({
|
|
|
215
353
|
anchorReference="anchorPosition"
|
|
216
354
|
anchorPosition={{ top: menu?.top ?? 0, left: menu?.left ?? 0 }}
|
|
217
355
|
>
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
356
|
+
{/* Only actions: each item names the value it acts on, so there is
|
|
357
|
+
no header row that reads like an item and does nothing. */}
|
|
358
|
+
{(menu?.items ?? []).map((item) => (
|
|
359
|
+
<MenuItem
|
|
360
|
+
key={item.key}
|
|
361
|
+
title={item.label}
|
|
362
|
+
aria-label={item.label}
|
|
363
|
+
onClick={() => {
|
|
364
|
+
close();
|
|
365
|
+
item.run();
|
|
366
|
+
}}
|
|
367
|
+
sx={{ maxWidth: MENU_ITEM_MAX_WIDTH }}
|
|
368
|
+
>
|
|
369
|
+
<span
|
|
370
|
+
style={{
|
|
371
|
+
overflow: "hidden",
|
|
372
|
+
textOverflow: "ellipsis",
|
|
373
|
+
whiteSpace: "nowrap",
|
|
233
374
|
}}
|
|
234
375
|
>
|
|
235
|
-
{
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
),
|
|
240
|
-
)}
|
|
376
|
+
{item.label}
|
|
377
|
+
</span>
|
|
378
|
+
</MenuItem>
|
|
379
|
+
))}
|
|
241
380
|
</Menu>
|
|
242
381
|
),
|
|
243
382
|
};
|
|
@@ -144,19 +144,12 @@ export function NotebookCell({
|
|
|
144
144
|
// `markDrillableCells`'s principle, that a destination the surface cannot
|
|
145
145
|
// reach never becomes a link, and it is why this is a prop rather than
|
|
146
146
|
// something the cell assumes.
|
|
147
|
-
//
|
|
148
|
-
// Wiring it also makes `drillMenu` reachable for the first time: a menu
|
|
149
|
-
// opens only for two or more honorable destinations, so until there was a
|
|
150
|
-
// second one every drillable cell applied its filter on the first click.
|
|
151
147
|
onNavigate: onDrillNavigate,
|
|
152
148
|
onSelf: onDrillSelf,
|
|
153
149
|
// Only the notebook knows which givens it declares, and a self-drill onto
|
|
154
150
|
// one it does not is refused. Asking here keeps the affordance honest
|
|
155
151
|
// instead of painting a link whose click only logs a warning.
|
|
156
152
|
canSelf: canDrillSelf,
|
|
157
|
-
// The reader is in a notebook, so `to=self` says so: the drill tag is on
|
|
158
|
-
// a shared model dimension and cannot know which document it fired in.
|
|
159
|
-
selfLabel: "Filter this report",
|
|
160
153
|
});
|
|
161
154
|
// Regex to extract imported names from import statements
|
|
162
155
|
const IMPORT_NAMES_REGEX = /import\s*\{([^}]+)\}\s*from\s*['"`][^'"`]+['"`]/;
|
|
@@ -5,8 +5,27 @@
|
|
|
5
5
|
* Escape a value for use inside a single-quoted Malloy string literal.
|
|
6
6
|
*
|
|
7
7
|
* Backslashes are escaped first, then quotes: doing it the other way round
|
|
8
|
-
* would re-escape the backslash that the quote escape introduced.
|
|
8
|
+
* would re-escape the backslash that the quote escape introduced. A raw line
|
|
9
|
+
* break ends the literal, so control characters are written as escapes too.
|
|
9
10
|
*/
|
|
10
11
|
export function escapeMalloyString(value: string): string {
|
|
11
|
-
return value
|
|
12
|
+
return value
|
|
13
|
+
.replace(/\\/g, "\\\\")
|
|
14
|
+
.replace(/'/g, "\\'")
|
|
15
|
+
.replace(
|
|
16
|
+
// eslint-disable-next-line no-control-regex -- matching them is the point
|
|
17
|
+
/[\u0000-\u001f]/g,
|
|
18
|
+
(c) => CONTROL_ESCAPES[c] ?? unicodeEscape(c),
|
|
19
|
+
);
|
|
12
20
|
}
|
|
21
|
+
|
|
22
|
+
const CONTROL_ESCAPES: Record<string, string> = {
|
|
23
|
+
"\n": "\\n",
|
|
24
|
+
"\r": "\\r",
|
|
25
|
+
"\t": "\\t",
|
|
26
|
+
"\b": "\\b",
|
|
27
|
+
"\f": "\\f",
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const unicodeEscape = (c: string) =>
|
|
31
|
+
`\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`;
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"use strict";const L=require("react/jsx-runtime"),ie=require("@mui/material"),g=require("react"),h=require("./useCompiledDocument-C995sQ3j.cjs.js"),H=require("./ServerProvider-e2369oom.cjs.js"),v=h.reportClasses.drillCell;function ue(e,t){const o=new Set;let l;try{l=e.getMetadata()?.getAllFields()??[]}catch{return o}const r=new Set;for(const a of l)!a||t(a)||a.tag?.tag("hidden")===void 0&&r.add(a.tag?.text("label")??a.name);for(const a of l){if(!a||!t(a))continue;const n=a.tag?.text("label")??a.name;r.has(n)||o.add(n)}return o}function $(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function he(e,t){if(t.size!==0)for(const o of e.querySelectorAll(".malloy-table")){const l=n=>n.closest(".malloy-table")===o,r=new Set;for(const n of o.querySelectorAll(".column-cell.th")){if(!l(n))continue;const i=(n.textContent??"").replace(/\u200b/g,"").trim(),m=$(n);m&&t.has(i)&&r.add(m)}if(r.size===0)continue;const a=new Set;for(const n of o.querySelectorAll(`.${v}[tabindex="0"]`)){if(!l(n))continue;const i=$(n);i&&(a.has(i)?n.tabIndex=-1:a.add(i))}for(const n of o.querySelectorAll(".column-cell.td")){if(!l(n))continue;const i=$(n),m=!n.querySelector(".value-null")&&(n.textContent??"").trim()!=="";if(i&&m&&r.has(i)&&!n.querySelector(".malloy-table")){if(n.classList.add(v),n.tabIndex===0)a.add(i);else{const w=a.has(i);w||a.add(i),n.tabIndex=w?-1:0}n.setAttribute("role","button")}}}}function ke(e){const t=e.closest(".malloy-table"),o=$(e);return!t||!o?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(l=>l.closest(".malloy-table")===t&&$(l)===o)}function se(e,t){const o=ke(e),l=o.indexOf(e);if(l===-1)return;const r=t==="first"?o[0]:t==="last"?o[o.length-1]:o[Math.min(Math.max(l+t,0),o.length-1)];if(r){for(const a of o)a.tabIndex=a===r?0:-1;return r}}function me(e){return{background:e.dashboardRoot,tableBackground:e.tableBackground,tableHeaderColor:e.tableHeader,tableBodyColor:e.tableBody,tableBorder:e.border,tablePinnedBackground:e.tableHeaderBackground,tablePinnedBorder:e.pinnedBorder,tableFontSize:`${e.font.size}px`,fontFamily:e.font.family,mapColor:e.mapColor}}function be(e){const{foreground:t,axisFaint:o,gridline:l,font:r}=e,a={background:e.background,font:r.family,title:{color:t,font:r.family},axis:{labelColor:t,titleColor:t,domainColor:o,tickColor:o,gridColor:l,labelFont:r.family,titleFont:r.family},legend:{labelColor:t,titleColor:t,labelFont:r.family,titleFont:r.family},header:{labelColor:t,titleColor:t},range:{category:e.series}},n={...a,legend:{...a.legend,orient:"bottom"}};return i=>i==="shape_map"?n:a}function ye(e){if(!e)return;const t=e.tag("theme");if(!t)return;const o={},l=t.tag("palette");if(l){const a={},n=l.textArray("series");n&&n.length>0&&(a.series=n);for(const i of H.PER_MODE_COLOR_KEYS){const m=l.tag(i);if(!m)continue;const w={},C=m.text("light"),x=m.text("dark");C&&(w.light=C),x&&(w.dark=x),Object.keys(w).length>0&&(a[i]=w)}Object.keys(a).length>0&&(o.palette=a)}const r=t.tag("font");if(r){const a={},n=r.text("family");n&&(a.family=n);const i=r.numeric("size");typeof i=="number"&&Number.isFinite(i)&&(a.size=i),Object.keys(a).length>0&&(o.font=a)}return Object.keys(o).length>0?o:void 0}const J=e=>(e??[]).map(t=>t?.value).filter(t=>typeof t=="string");function xe(e){const t=e.replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const Ce=e=>J(e.annotations).some(t=>{const o=t.trim();return/^#[^("]/.test(o)&&/(?:^#|[\s{])label\s*=/.test(o)}),Re=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Te=e=>e.type?.element_type?.fields??e.type?.fields;function fe(e,t){let o=!1;return{fields:e.map(r=>{const a=Te(r);if(a){const i=fe(a,h.requestsRowChart(J(r.annotations)));if(!i.changed)return r;o=!0;const m=r.type?.element_type?{...r.type,element_type:{...r.type.element_type,fields:i.fields}}:{...r.type,fields:i.fields};return{...r,type:m}}if(!t||!r.name||Ce(r))return r;const n=xe(r.name);return n===r.name?r:(o=!0,{...r,annotations:[{value:`# label=${Re(n)}
|
|
2
|
-
`},...r.annotations??[]]})}),changed:o}}function _e(e){if(!e||typeof e!="object")return e;const t=e,o=t.schema?.fields;if(!Array.isArray(o))return e;const{fields:l,changed:r}=fe(o,h.requestsRowChart(J(t.annotations)));return r?{...t,schema:{...t.schema,fields:l}}:e}const de=320,Ae=10,Ee=96,Se=4e3;function De(e,t){if(e!=="bar"&&e!=="combo"&&e!=="line"&&e!=="chart"&&e!=="scatter_chart")return;if(e!=="bar"&&e!=="combo")return de;const o=t?.data?.array_value?.length,l=o===void 0?0:o*Ae+Ee;return Math.min(Math.max(de,l),Se)}const M="data-publisher-fill",Ie=async(e,t)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:o}=await h.loadMalloyRenderer();return new o({onClick:t,vegaConfigOverride:be(e),theme:me(e),onError:r=>{console.error("Error rendering visualization:",typeof r,r)}}).createViz()};async function Oe(e){if(!e||typeof e!="object")return;const t=e,o=[...Array.isArray(t.model_annotations)?t.model_annotations:[],...Array.isArray(t.source_annotations)?t.source_annotations:[],...Array.isArray(t.annotations)?t.annotations:[]].map(r=>typeof r?.value=="string"?r.value:void 0).filter(r=>!!r);if(o.length===0)return;let l;try{({parseAnnotation:l}=await h.loadMalloyTag())}catch{return}try{const{tag:r}=l(o);return ye(r)}catch(r){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:r,lines:o});return}}function ze(e,t,o){const l=h.buildTableCssVars(t,o);for(const[r,a]of Object.entries(l))e.style.setProperty(r,a)}const Fe=`
|
|
3
|
-
/* Card geometry, through the renderer's OWN theme vars rather than over the top
|
|
4
|
-
of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
|
|
5
|
-
passes each through to the --malloy-render--* the card CSS reads, so a value
|
|
6
|
-
inherited from our wrapper loses to that declaration however early it is set:
|
|
7
|
-
this has to be a rule on the same element, at higher specificity. Doubling the
|
|
8
|
-
class does that, and then no !important is needed — which matters, because
|
|
9
|
-
!important here also lands on .dashboard-item-borderless and repaints a card
|
|
10
|
-
the author asked to have no card. */
|
|
11
|
-
.malloy-render.malloy-render {
|
|
12
|
-
--malloy-theme--dashboard-card-radius: var(--publisher-dashboard-card-radius);
|
|
13
|
-
--malloy-theme--dashboard-card-padding: var(--publisher-dashboard-card-padding);
|
|
14
|
-
}
|
|
15
|
-
/* dashboard.css hardcodes background: #f7f9fc on .malloy-dashboard
|
|
16
|
-
and .dashboard-row-header, which would paint light grey in dark
|
|
17
|
-
mode and also bleed an operator-picked palette.background across
|
|
18
|
-
the panel chrome in light. Both surfaces use
|
|
19
|
-
--malloy-render--background here, which buildMalloyExplicitTheme
|
|
20
|
-
wires to dashboardRoot: a mode-keyed neutral that stays decoupled
|
|
21
|
-
from palette.background (the chart canvas) on purpose. Selectors
|
|
22
|
-
are duplicated at higher specificity to beat the renderer s own
|
|
23
|
-
scoped rules. */
|
|
24
|
-
.malloy-render .malloy-dashboard,
|
|
25
|
-
.malloy-render.malloy-render .malloy-dashboard,
|
|
26
|
-
div.malloy-render .malloy-dashboard {
|
|
27
|
-
/* --publisher-dashboard-root is set on the outer Publisher wrapper
|
|
28
|
-
(see buildTableCssVars) and stays decoupled from
|
|
29
|
-
--malloy-render--background, which gets shadowed inside the
|
|
30
|
-
renderer when a theme.background annotation is present. The
|
|
31
|
-
dedicated var means the panel between tiles always paints the
|
|
32
|
-
operator neutral dashboardRoot regardless of annotations. */
|
|
33
|
-
background: var(--publisher-dashboard-root) !important;
|
|
34
|
-
background-color: var(--publisher-dashboard-root) !important;
|
|
35
|
-
color: var(--malloy-render--table-body-color) !important;
|
|
36
|
-
}
|
|
37
|
-
.malloy-render .malloy-dashboard .dashboard-row,
|
|
38
|
-
.malloy-render .malloy-dashboard .dashboard-row-body,
|
|
39
|
-
.malloy-render .malloy-dashboard .dashboard-row-header,
|
|
40
|
-
.malloy-render.malloy-render .malloy-dashboard .dashboard-row-header,
|
|
41
|
-
div.malloy-render .malloy-dashboard .dashboard-row-header {
|
|
42
|
-
/* Belt + suspenders: dashboard.css hardcodes .dashboard-row-header
|
|
43
|
-
to #f7f9fc, and row / row-body have no explicit background but
|
|
44
|
-
get caught in any annotation-driven inline writes. Force all of
|
|
45
|
-
them to the neutral panel colour. */
|
|
46
|
-
background: var(--publisher-dashboard-root) !important;
|
|
47
|
-
background-color: var(--publisher-dashboard-root) !important;
|
|
48
|
-
}
|
|
49
|
-
.malloy-render .malloy-dashboard .dashboard-item:not(.dashboard-item-borderless) {
|
|
50
|
-
/* Tile padding around each chart / table. Uses our custom
|
|
51
|
-
--malloy-render--tile-background so the operator can theme the
|
|
52
|
-
tile separately from the table header row (which paints from
|
|
53
|
-
--malloy-render--table-pinned-background below).
|
|
54
|
-
|
|
55
|
-
A flat bordered card rather than the renderer's shadow ring, which is what
|
|
56
|
-
makes it match the composite tile's Paper. :not(borderless) because
|
|
57
|
-
# borderless asks for no card at all, and an !important background and
|
|
58
|
-
border drew one anyway. */
|
|
59
|
-
background: var(--malloy-render--tile-background) !important;
|
|
60
|
-
color: var(--malloy-render--table-body-color) !important;
|
|
61
|
-
box-shadow: none !important;
|
|
62
|
-
/* The card edge, not the table gridline: --publisher-dashboard-card-border,
|
|
63
|
-
the same value TileCard paints, so the renderer's card and the composite
|
|
64
|
-
one are outlined identically. */
|
|
65
|
-
border: var(--publisher-dashboard-card-border) !important;
|
|
66
|
-
}
|
|
67
|
-
/* The renderer's big-value card — the small card a "# big_value" measure sits
|
|
68
|
-
in, several to a row inside one tile. (No backticks in here: this is inside
|
|
69
|
-
a template literal.) Its own CSS gives it a 0.55px edge in
|
|
70
|
-
#e5e7eb: a sub-pixel width, and a grey off the slate ramp everything else on
|
|
71
|
-
the page is on. It is a dashboard card like any other, so it takes the card
|
|
72
|
-
edge and stops being the one card outlined in a hairline nobody can see. */
|
|
73
|
-
.malloy-render .malloy-big-value-card {
|
|
74
|
-
border: var(--publisher-dashboard-card-border) !important;
|
|
75
|
-
/* Its shadow is a four-layer Tailwind stack, and only two of those layers
|
|
76
|
-
are a shadow: the other is "0 0 0 1px #e5e7eb", a spread ring drawn as a
|
|
77
|
-
second border OVER the real one. So the border above was landing
|
|
78
|
-
underneath a ring in the renderer's own grey, and the card kept both a
|
|
79
|
-
lifted look the flat cards around it do not have and an edge we did not
|
|
80
|
-
pick. Dropped whole rather than rebuilt layer by layer: the ring's job is
|
|
81
|
-
the border's job, and the border is already doing it. */
|
|
82
|
-
box-shadow: none !important;
|
|
83
|
-
}
|
|
84
|
-
/* The strip of big-value cards as a grid, so cards share a width and the last one does not wrap
|
|
85
|
-
alone. The renderer's wrapping flex row sizes each card to its own text. The 250px floor is the
|
|
86
|
-
widest realistic value: it is nowrap at 32px in an overflow:visible card, so a narrower track
|
|
87
|
-
would spill it onto its neighbour. Embedded (a nested big_value) is left as the renderer draws it. */
|
|
88
|
-
.malloy-render .malloy-big-value:not(.malloy-big-value--embedded) {
|
|
89
|
-
display: grid;
|
|
90
|
-
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
91
|
-
}
|
|
92
|
-
.malloy-render .malloy-big-value-card:not(.malloy-big-value-card--embedded) {
|
|
93
|
-
width: auto;
|
|
94
|
-
max-width: none;
|
|
95
|
-
}
|
|
96
|
-
/* Compact, in a tile set shorter than its cards (ResultContainer marks it tight): smaller values,
|
|
97
|
-
tighter cards and a 190px floor, which a 22px value still fits in, so five cards share a row of
|
|
98
|
-
about a thousand pixels instead of wrapping into rows the tile has no room for. */
|
|
99
|
-
[${h.TIGHT_ATTR}] .malloy-render .malloy-big-value:not(.malloy-big-value--embedded) {
|
|
100
|
-
grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
|
|
101
|
-
gap: 8px;
|
|
102
|
-
padding: 8px;
|
|
103
|
-
}
|
|
104
|
-
[${h.TIGHT_ATTR}] .malloy-render .malloy-big-value-card:not(.malloy-big-value-card--embedded) {
|
|
105
|
-
padding: 9px 14px;
|
|
106
|
-
}
|
|
107
|
-
[${h.TIGHT_ATTR}] .malloy-render .malloy-big-value-value {
|
|
108
|
-
font-size: 22px;
|
|
109
|
-
}
|
|
110
|
-
[${h.TIGHT_ATTR}] .malloy-render .malloy-big-value-label {
|
|
111
|
-
font-size: 11px;
|
|
112
|
-
}
|
|
113
|
-
.malloy-render .malloy-dashboard .dashboard-row-header-separator {
|
|
114
|
-
background: var(--malloy-render--table-border) !important;
|
|
115
|
-
}
|
|
116
|
-
/* !important because the malloy-explorer stylesheet pins these same properties with it. */
|
|
117
|
-
[${M}] .malloy-table.root {
|
|
118
|
-
height: 100% !important;
|
|
119
|
-
align-content: start !important;
|
|
120
|
-
grid-template-columns: repeat(var(--total-header-size), minmax(max-content, 1fr)) !important;
|
|
121
|
-
}
|
|
122
|
-
.malloy-render .malloy-table .th.column-cell {
|
|
123
|
-
/* Non-pinned tables have no header background in the renderer's
|
|
124
|
-
own CSS (only pinned scrolled tables paint the pinned-header
|
|
125
|
-
with this var). Force the same value here so every table has a
|
|
126
|
-
visible header band reflecting the operator's choice. */
|
|
127
|
-
background: var(--malloy-render--table-pinned-background) !important;
|
|
128
|
-
}
|
|
129
|
-
.malloy-render .dashboard-item-title,
|
|
130
|
-
.malloy-render .dashboard-dimension-name {
|
|
131
|
-
color: var(--malloy-render--label-color) !important;
|
|
132
|
-
}
|
|
133
|
-
.malloy-render .dashboard-item-value,
|
|
134
|
-
.malloy-render .dashboard-item-value-measure,
|
|
135
|
-
.malloy-render .dashboard-dimension-value {
|
|
136
|
-
color: var(--malloy-render--value-color) !important;
|
|
137
|
-
}
|
|
138
|
-
.malloy-render .malloy-table,
|
|
139
|
-
.malloy-render .malloy-list {
|
|
140
|
-
color: var(--malloy-render--table-body-color) !important;
|
|
141
|
-
}
|
|
142
|
-
.malloy-render .column-cell.th,
|
|
143
|
-
.malloy-render .cell-content.header {
|
|
144
|
-
color: var(--malloy-render--table-header-color) !important;
|
|
145
|
-
}
|
|
146
|
-
/* A cell whose column declares a "# drill" this surface can honor, marked
|
|
147
|
-
by markDrillableCells. Ordinary text with a pointer cursor until hovered,
|
|
148
|
-
then it reads as a link: the same affordance Malloyyo gives the same tag,
|
|
149
|
-
and the only thing that tells a reader a cell navigates. Kept off the
|
|
150
|
-
resting state deliberately: a column painted blue competes with the data.
|
|
151
|
-
(No backticks in here: this is inside a template literal.) */
|
|
152
|
-
.malloy-render .${v} {
|
|
153
|
-
cursor: pointer;
|
|
154
|
-
}
|
|
155
|
-
.malloy-render .${v}:hover > .cell-content {
|
|
156
|
-
color: var(--publisher-drill-link) !important;
|
|
157
|
-
text-decoration: underline;
|
|
158
|
-
}
|
|
159
|
-
/* Keyboard focus reads the same as hover, plus a ring: a hover colour is not
|
|
160
|
-
something a keyboard user can produce, and a focus ring is not something a
|
|
161
|
-
mouse user sees. focus-visible rather than focus, so a click does not leave a
|
|
162
|
-
ring behind it. (No backticks in here: this is inside a template literal.) */
|
|
163
|
-
.malloy-render .${v}:focus-visible {
|
|
164
|
-
outline: 2px solid var(--publisher-drill-link);
|
|
165
|
-
outline-offset: -2px;
|
|
166
|
-
}
|
|
167
|
-
.malloy-render .${v}:focus-visible > .cell-content {
|
|
168
|
-
color: var(--publisher-drill-link) !important;
|
|
169
|
-
text-decoration: underline;
|
|
170
|
-
}
|
|
171
|
-
`,ce="publisher-malloy-renderer-overrides";function Le(){if(typeof document>"u"||document.getElementById(ce))return;const e=document.createElement("style");e.id=ce,e.textContent=Fe,document.head.appendChild(e)}function Me({result:e,height:t,drill:o,onSizeChange:l,onSizing:r,fill:a}){const n=g.useRef(null),i=g.useRef(o);i.current=o;const m=g.useCallback(d=>{i.current?.onClick(d)},[]),w=o!==void 0,C=g.useRef(!1),x=g.useRef(null),V=g.useRef(0),{theme:B,layers:X,mode:Q}=H.usePublisherTheme(),Z=g.useMemo(()=>({radius:B.ui.radius.tile,padding:`${h.DASHBOARD_CARD_PADDING_PX}px`}),[B.ui.radius.tile]);return g.useEffect(()=>()=>{V.current+=1;const d=x.current;d?.viz.remove(),d?.node.remove(),x.current=null},[]),g.useLayoutEffect(()=>{if(!n.current||!e)return;Le();const d=n.current,ge=V.current+=1;let G=!1;const K=()=>!G&&ge===V.current;let c,y,N=null,W=0,j=null,P=null,q=null,D=null,I=null,O=null,ee=null,te=0,T=null;C.current=!1;let p,_;const U=k=>{if(G||!k.firstElementChild||h.resultSizing(p,_)==="container")return;const z=h.remeasuresAfterReady(p,_);if(C.current&&!z)return;const F=d.hasAttribute(M);F&&d.removeAttribute(M);const A=h.measureContentHeight(k,h.contentNodeDepth(p));F&&d.setAttribute(M,""),A>0&&(C.current=!0,l&&A!==te&&(te=A,l(A)));const u=h.contentNode(k,h.contentNodeDepth(p));z&&u&&ee!==u&&(ee=u,O?.disconnect(),O=new ResizeObserver(()=>U(k)),O.observe(u))};return(async()=>{let k;try{k=JSON.parse(e)}catch(b){console.error("Error parsing visualization result:",b);return}const z=await Oe(k),F=z?H.resolveTheme([...X,H.chartThemeLayer(X,z)],Q):B;if(!K())return;try{y=await Ie(F,m)}catch(b){console.error("Failed to create renderer:",b);return}if(!K()){y.remove(),y=void 0;return}const A=x.current;c=document.createElement("div"),c.style.width="100%",c.style.height="100%",ze(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);const u=c;D=new MutationObserver(()=>{I&&clearTimeout(I),I=setTimeout(()=>{U(u),C.current&&D?.disconnect()},100)}),D.observe(c,{childList:!0,subtree:!0,attributes:!0});const ve=y;let re=!1;const oe=()=>{if(!(re||!K())){re=!0,T&&(clearTimeout(T),T=null),A?.viz.remove();for(const b of Array.from(d.children))b!==u&&d.removeChild(b);u.style.position="",u.style.inset="",u.style.visibility="",d.style.position="",x.current={viz:ve,node:u},U(u)}};try{y.setResult(_e(k));try{const R=y.getMetadata(),E=R?.getRootField();p=E?.renderAs(),_=E?R?.getPluginsForField(E.key)?.[0]?.sizingStrategy:void 0}catch{p=void 0,_=void 0}r?.(h.resultSizing(p,_),p),c.dataset.malloyRenderAs=p??"unknown",c.dataset.malloySizing=h.resultSizing(p,_);const b=De(p,k);c.style.minWidth=b===void 0?"":`${b}px`,d.style.overflowX=b===void 0?"":"auto",d.style.overflowY=b===void 0?"":"hidden",y.render(c);const ae=i.current;try{if(ae){const R=ue(y,ae.canDrill),E=()=>{try{he(u,R)}catch(s){console.warn("Drill affordance skipped:",s)}};E();const ne=s=>{const S=s.querySelector(".cell-content")??s,Y=S.getBoundingClientRect();S.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:S.ownerDocument.defaultView,clientX:Math.round(Y.left+Y.width/2),clientY:Math.round(Y.bottom)}))},le=s=>s.target?.closest?.(`.${v}`)??null,we=(s,f)=>{se(s,f)?.focus()};j=s=>{const f=le(s);if(!f)return;const S=s.key==="ArrowDown"?1:s.key==="ArrowUp"?-1:s.key==="Home"?"first":s.key==="End"?"last":void 0;if(S!==void 0){s.preventDefault(),we(f,S);return}s.key==="Enter"?(s.preventDefault(),ne(f)):s.key===" "&&s.preventDefault()},P=s=>{if(s.key!==" ")return;const f=le(s);f&&(s.preventDefault(),ne(f))},q=s=>{const f=s.target?.closest?.(`.${v}`);f&&se(f,0)},u.addEventListener("keydown",j),u.addEventListener("keyup",P),u.addEventListener("focusin",q),R.size>0&&typeof MutationObserver<"u"&&(N=new MutationObserver(()=>{cancelAnimationFrame(W),W=requestAnimationFrame(E)}),N.observe(u,{childList:!0,subtree:!0}))}}catch(R){console.warn("Drill affordance skipped:",R)}y.onReady(oe),T=setTimeout(oe,1e4)}catch(b){console.error("Error rendering visualization:",b),D?.disconnect(),O?.disconnect(),N?.disconnect(),y.remove(),y=void 0,u.parentNode===d&&d.removeChild(u)}})(),()=>{G=!0,D?.disconnect(),O?.disconnect(),I&&clearTimeout(I),T&&clearTimeout(T),c&&x.current?.node!==c&&(j&&c.removeEventListener("keydown",j),P&&c.removeEventListener("keyup",P),q&&c.removeEventListener("focusin",q),N?.disconnect(),cancelAnimationFrame(W),y?.remove(),c.parentNode===d&&d.removeChild(c),d.style.position="")}},[e,m,w,l,r,B,X,Q,Z]),L.jsx("div",{ref:n,...a?{[M]:""}:{},style:{width:"100%",height:t?`${t}px`:"400px"}})}function pe(e){return typeof window>"u"?L.jsx(ie.Box,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):L.jsx(g.Suspense,{fallback:L.jsx(ie.Box,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:L.jsx(Me,{...e})})}const $e=Object.freeze(Object.defineProperty({__proto__:null,default:pe},Symbol.toStringTag,{value:"Module"}));exports.DRILL_CELL_CLASS=v;exports.RenderedResult=pe;exports.RenderedResult$1=$e;exports.buildMalloyExplicitTheme=me;exports.buildVegaThemeOverride=be;exports.drillableFieldNames=ue;exports.markDrillableCells=he;exports.readChartAnnotations=ye;
|