@malloy-publisher/sdk 0.9.2 → 0.9.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-CBLHr32C.es.js → RenderedResult-DwB0-9Yx.es.js} +118 -119
- package/dist/{RenderedResult-B48wAjM8.cjs.js → RenderedResult-hKjFEqaN.cjs.js} +2 -2
- package/dist/{ServerProvider-DCV8BUWD.es.js → ServerProvider-CcSrGaRN.es.js} +1281 -1142
- package/dist/ServerProvider-Gbf1YPOP.cjs.js +1 -0
- package/dist/builder/index.cjs.js +112 -115
- package/dist/builder/index.es.js +11766 -11502
- package/dist/builder-entry.d.ts +1 -1
- package/dist/client/api.d.ts +170 -9
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +93 -89
- package/dist/client-entry.d.ts +2 -0
- package/dist/components/ApiErrorDisplay.d.ts +11 -0
- package/dist/components/AppDialog.d.ts +6 -6
- package/dist/components/Dashboard/DashboardGrid.d.ts +18 -3
- package/dist/components/Dashboard/DashboardTile.d.ts +12 -2
- package/dist/components/Dashboard/DashboardView.d.ts +38 -3
- package/dist/components/Dashboard/TileCard.d.ts +16 -2
- package/dist/components/Dashboard/dropValueUrlTags.d.ts +6 -0
- package/dist/components/Dashboard/index.d.ts +3 -2
- package/dist/components/Dashboard/telemetry.d.ts +2 -1
- package/dist/components/Dashboard/textSource.d.ts +19 -0
- package/dist/components/DashboardBuilder/AddTileDialog.d.ts +7 -8
- package/dist/components/DashboardBuilder/BuilderDialogs.d.ts +25 -0
- package/dist/components/DashboardBuilder/BuilderGrid.d.ts +31 -0
- package/dist/components/DashboardBuilder/BuilderHeader.d.ts +17 -0
- package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +14 -17
- package/dist/components/DashboardBuilder/ChartPicker.d.ts +3 -1
- package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +15 -7
- package/dist/components/DashboardBuilder/DashboardEditor.d.ts +28 -2
- package/dist/components/DashboardBuilder/EditorSurface.d.ts +33 -0
- package/dist/components/DashboardBuilder/FilterStrip.d.ts +6 -4
- package/dist/components/DashboardBuilder/InlineText.d.ts +1 -1
- package/dist/components/DashboardBuilder/NotebookEditor.d.ts +1 -1
- package/dist/components/DashboardBuilder/TextTileBody.d.ts +4 -1
- package/dist/components/DashboardBuilder/TileFrame.d.ts +43 -6
- package/dist/components/DashboardBuilder/TileMenu.d.ts +6 -8
- package/dist/components/DashboardBuilder/builderReport.d.ts +13 -0
- package/dist/components/DashboardBuilder/catalog.d.ts +0 -18
- package/dist/components/DashboardBuilder/documentSession.d.ts +2 -2
- package/dist/components/DashboardBuilder/imports.d.ts +19 -0
- package/dist/components/DashboardBuilder/inlineEdit.d.ts +18 -0
- package/dist/components/DashboardBuilder/readDocument.d.ts +3 -1
- package/dist/components/DashboardBuilder/readForEditor.d.ts +1 -1
- package/dist/components/DashboardBuilder/sortable.d.ts +2 -0
- package/dist/components/DashboardBuilder/spliceDocument.d.ts +2 -0
- package/dist/components/DashboardBuilder/testing/resize.d.ts +7 -0
- package/dist/components/DashboardBuilder/tileDisplayTitle.d.ts +7 -0
- package/dist/components/DashboardBuilder/useBuilderSelection.d.ts +53 -0
- package/dist/components/DashboardBuilder/useBuilderSession.d.ts +4 -7
- package/dist/components/DashboardBuilder/useControlBindings.d.ts +30 -0
- package/dist/components/DashboardBuilder/useConversionConfirm.d.ts +20 -0
- package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +2 -0
- package/dist/components/DashboardBuilder/useDraft.d.ts +3 -1
- package/dist/components/DashboardBuilder/useHostCopy.d.ts +26 -0
- package/dist/components/DashboardBuilder/useOpenDraftCommit.d.ts +17 -0
- package/dist/components/DashboardBuilder/useOpenedDocument.d.ts +71 -0
- package/dist/components/DashboardBuilder/useSaveChannel.d.ts +50 -0
- package/dist/components/DashboardBuilder/useTileEditing.d.ts +33 -0
- package/dist/components/DashboardBuilder/useTileResize.d.ts +32 -0
- package/dist/components/Loading.d.ts +13 -0
- package/dist/components/Notebook/NotebookCell.d.ts +1 -5
- package/dist/components/Package/Package.d.ts +16 -1
- package/dist/components/Package/index.d.ts +1 -1
- package/dist/components/Prose.d.ts +1 -1
- package/dist/components/RenderedResult/loadRenderer.d.ts +7 -0
- package/dist/components/given/paramCodec.d.ts +8 -1
- package/dist/components/index.d.ts +1 -2
- package/dist/components/styles.d.ts +4 -4
- package/dist/hooks/givenValue.d.ts +6 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useCompiledDocument.d.ts +23 -0
- package/dist/hooks/useDocumentControls.d.ts +6 -1
- package/dist/hooks/useNearViewport.d.ts +16 -0
- package/dist/hooks/useQueryWithApiError.d.ts +7 -2
- package/dist/hooks/useSuggestOptions.d.ts +9 -2
- package/dist/index.cjs.js +14 -14
- package/dist/index.es.js +9760 -10363
- package/dist/text/index.es.js +1 -1
- package/dist/{text-entry-CbbBcZl8.es.js → text-entry-CA0LZ1xL.es.js} +8 -8
- package/dist/text-entry.d.ts +1 -1
- package/dist/theme/accent.d.ts +29 -0
- package/dist/theme/buildVegaThemeOverride.d.ts +3 -3
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/keys.d.ts +1 -1
- package/dist/theme/motion.d.ts +31 -0
- package/dist/theme/readChartAnnotations.d.ts +1 -1
- package/dist/theme/resolveTheme.d.ts +4 -4
- package/dist/theme/types.d.ts +33 -5
- package/dist/{DashboardTile-BFcxdv7R.es.js → useCompiledDocument-BU6d8FPp.es.js} +6978 -6289
- package/dist/useCompiledDocument-pOg2W-Yt.cjs.js +142 -0
- package/package.json +11 -11
- package/src/builder-entry.ts +1 -0
- package/src/client-entry.ts +8 -0
- package/src/clientEntry.spec.ts +17 -0
- package/src/components/ApiErrorDisplay.tsx +37 -18
- package/src/components/AppDialog.tsx +8 -7
- package/src/components/Dashboard/Dashboard.spec.tsx +3 -32
- package/src/components/Dashboard/Dashboard.tsx +2 -2
- package/src/components/Dashboard/DashboardGrid.tsx +23 -5
- package/src/components/Dashboard/DashboardTile.spec.tsx +97 -2
- package/src/components/Dashboard/DashboardTile.tsx +95 -31
- package/src/components/Dashboard/DashboardView.spec.tsx +156 -0
- package/src/components/Dashboard/DashboardView.tsx +165 -89
- package/src/components/Dashboard/RowsDialog.tsx +3 -2
- package/src/components/Dashboard/TileCard.tsx +17 -2
- package/src/components/Dashboard/dropValueUrlTags.spec.ts +177 -0
- package/src/components/Dashboard/dropValueUrlTags.ts +108 -0
- package/src/components/Dashboard/index.ts +11 -2
- package/src/components/Dashboard/telemetry.ts +2 -1
- package/src/components/Dashboard/textSource.spec.ts +36 -0
- package/src/components/Dashboard/textSource.ts +39 -0
- package/src/components/DashboardBuilder/AddTileDialog.tsx +16 -56
- package/src/components/DashboardBuilder/BuilderDialogs.tsx +162 -0
- package/src/components/DashboardBuilder/BuilderGrid.tsx +245 -0
- package/src/components/DashboardBuilder/BuilderHeader.tsx +107 -0
- package/src/components/DashboardBuilder/BuilderToolbar.tsx +86 -113
- package/src/components/DashboardBuilder/ChartPicker.tsx +4 -1
- package/src/components/DashboardBuilder/DashboardBuilder.charts.spec.tsx +5 -5
- package/src/components/DashboardBuilder/DashboardBuilder.exit.spec.tsx +74 -83
- package/src/components/DashboardBuilder/DashboardBuilder.inline.spec.tsx +62 -18
- package/src/components/DashboardBuilder/DashboardBuilder.notebook.spec.tsx +55 -108
- package/src/components/DashboardBuilder/DashboardBuilder.openDraft.spec.tsx +10 -62
- package/src/components/DashboardBuilder/DashboardBuilder.sources.spec.tsx +50 -57
- package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +53 -40
- package/src/components/DashboardBuilder/DashboardBuilder.textTiles.spec.tsx +10 -8
- package/src/components/DashboardBuilder/DashboardBuilder.tsx +227 -704
- package/src/components/DashboardBuilder/DashboardEditor.authoritative.spec.tsx +32 -52
- package/src/components/DashboardBuilder/DashboardEditor.emptyStart.spec.tsx +1 -50
- package/src/components/DashboardBuilder/DashboardEditor.notebook.spec.tsx +12 -18
- package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +4 -24
- package/src/components/DashboardBuilder/DashboardEditor.resourceUri.spec.tsx +4 -4
- package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +8 -13
- package/src/components/DashboardBuilder/DashboardEditor.textSource.spec.tsx +317 -0
- package/src/components/DashboardBuilder/DashboardEditor.tsx +142 -820
- package/src/components/DashboardBuilder/DrillDialog.tsx +2 -2
- package/src/components/DashboardBuilder/EditorSurface.tsx +471 -0
- package/src/components/DashboardBuilder/FilterDialog.tsx +13 -8
- package/src/components/DashboardBuilder/FilterStrip.tsx +117 -79
- package/src/components/DashboardBuilder/InlineMarkdown.tsx +7 -9
- package/src/components/DashboardBuilder/InlineText.tsx +23 -17
- package/src/components/DashboardBuilder/NotebookEditor.tsx +3 -3
- package/src/components/DashboardBuilder/TextTileBody.tsx +5 -2
- package/src/components/DashboardBuilder/TileFrame.tsx +255 -90
- package/src/components/DashboardBuilder/TileMenu.tsx +41 -91
- package/src/components/DashboardBuilder/artifactBlock.spec.ts +1 -1
- package/src/components/DashboardBuilder/artifactTagParity.spec.ts +9 -4
- package/src/components/DashboardBuilder/builderReport.ts +74 -0
- package/src/components/DashboardBuilder/catalog.spec.ts +0 -44
- package/src/components/DashboardBuilder/catalog.ts +0 -36
- package/src/components/DashboardBuilder/controls.spec.ts +1 -1
- package/src/components/DashboardBuilder/controls.ts +1 -1
- package/src/components/DashboardBuilder/documentSession.ts +3 -2
- package/src/components/DashboardBuilder/imports.spec.ts +61 -0
- package/src/components/DashboardBuilder/imports.ts +93 -0
- package/src/components/DashboardBuilder/inlineEdit.tsx +78 -0
- package/src/components/DashboardBuilder/legacyNotebook.ts +1 -1
- package/src/components/DashboardBuilder/malloyTree.ts +5 -1
- package/src/components/DashboardBuilder/newDashboard.ts +1 -1
- package/src/components/DashboardBuilder/preview.ts +1 -1
- package/src/components/DashboardBuilder/readDocument.spec.ts +36 -0
- package/src/components/DashboardBuilder/readDocument.ts +10 -4
- package/src/components/DashboardBuilder/readForEditor.ts +7 -2
- package/src/components/DashboardBuilder/sortable.spec.ts +25 -1
- package/src/components/DashboardBuilder/sortable.tsx +11 -0
- package/src/components/DashboardBuilder/spliceDocument.ts +8 -3
- package/src/components/DashboardBuilder/testing/artifactTagParity.json +62 -6
- package/src/components/DashboardBuilder/testing/documentKindRule.json +40 -0
- package/src/components/DashboardBuilder/testing/inline.ts +1 -1
- package/src/components/DashboardBuilder/testing/resize.ts +48 -0
- package/src/components/DashboardBuilder/testing/urlRenderTags.json +62 -0
- package/src/components/DashboardBuilder/textTiles.spec.ts +43 -1
- package/src/components/DashboardBuilder/tileDisplayTitle.ts +13 -0
- package/src/components/DashboardBuilder/useBuilderSelection.ts +121 -0
- package/src/components/DashboardBuilder/useBuilderSession.spec.ts +0 -85
- package/src/components/DashboardBuilder/useBuilderSession.ts +6 -43
- package/src/components/DashboardBuilder/useBuilderShortcuts.overlay.spec.tsx +32 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.ts +11 -1
- package/src/components/DashboardBuilder/useControlBindings.ts +152 -0
- package/src/components/DashboardBuilder/useConversionConfirm.ts +55 -0
- package/src/components/DashboardBuilder/useDashboardEditor.ts +5 -2
- package/src/components/DashboardBuilder/useDraft.ts +15 -2
- package/src/components/DashboardBuilder/useHostCopy.ts +104 -0
- package/src/components/DashboardBuilder/useOpenDraftCommit.ts +47 -0
- package/src/components/DashboardBuilder/useOpenedDocument.ts +314 -0
- package/src/components/DashboardBuilder/useSaveChannel.ts +275 -0
- package/src/components/DashboardBuilder/useTileEditing.ts +141 -0
- package/src/components/DashboardBuilder/useTileResize.spec.tsx +146 -0
- package/src/components/DashboardBuilder/useTileResize.ts +133 -0
- package/src/components/DataAppViewer/DataAppViewer.tsx +7 -4
- package/src/components/DocumentCreate/guards.ts +1 -1
- package/src/components/Environment/Environment.tsx +0 -10
- package/src/components/Loading.tsx +14 -0
- package/src/components/Model/Model.tsx +16 -9
- package/src/components/Model/ModelExplorer.tsx +2 -2
- package/src/components/Notebook/Notebook.tsx +6 -2
- package/src/components/Notebook/NotebookCell.tsx +90 -215
- package/src/components/Package/Package.artifacts.spec.tsx +8 -12
- package/src/components/Package/Package.create.spec.tsx +22 -1
- package/src/components/Package/Package.tsx +51 -27
- package/src/components/Package/index.ts +1 -1
- package/src/components/Prose.spec.tsx +37 -0
- package/src/components/Prose.tsx +35 -5
- package/src/components/RenderedResult/RenderedResult.tsx +5 -7
- package/src/components/RenderedResult/ResultContainer.tsx +7 -2
- package/src/components/RenderedResult/ResultPanel.tsx +20 -5
- package/src/components/RenderedResult/loadRenderer.ts +42 -0
- package/src/components/given/GivenInput.spec.tsx +5 -5
- package/src/components/given/GivenInput.tsx +46 -38
- package/src/components/given/GivensPanel.tsx +2 -8
- package/src/components/given/paramCodec.ts +27 -1
- package/src/components/index.ts +1 -2
- package/src/components/styles.ts +4 -5
- package/src/hooks/givenValue.ts +9 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useCompiledDocument.spec.tsx +86 -0
- package/src/hooks/useCompiledDocument.ts +59 -0
- package/src/hooks/useDimensionalFilterRangeData.ts +3 -1
- package/src/hooks/useDocumentControls.ts +13 -1
- package/src/hooks/useNearViewport.spec.tsx +150 -0
- package/src/hooks/useNearViewport.ts +102 -0
- package/src/hooks/useQueryResult.ts +7 -1
- package/src/hooks/useQueryWithApiError.ts +10 -3
- package/src/hooks/useRawQueryData.ts +3 -1
- package/src/hooks/useSuggestOptions.dom.spec.ts +40 -1
- package/src/hooks/useSuggestOptions.ts +42 -10
- package/src/text-entry.ts +1 -1
- package/src/textEntry.spec.ts +2 -8
- package/src/theme/accent.spec.ts +116 -0
- package/src/theme/accent.ts +148 -0
- package/src/theme/buildTableCssVars.spec.ts +24 -0
- package/src/theme/buildTableCssVars.ts +1 -2
- package/src/theme/buildVegaThemeOverride.spec.ts +38 -2
- package/src/theme/buildVegaThemeOverride.ts +5 -5
- package/src/theme/defaults.ts +34 -0
- package/src/theme/index.ts +9 -0
- package/src/theme/keys.ts +6 -0
- package/src/theme/motion.ts +44 -0
- package/src/theme/readChartAnnotations.spec.ts +18 -0
- package/src/theme/readChartAnnotations.ts +1 -1
- package/src/theme/resolveTheme.spec.ts +73 -0
- package/src/theme/resolveTheme.ts +61 -20
- package/src/theme/types.ts +30 -5
- package/src/utils/queryClient.ts +8 -0
- package/dist/DashboardTile-sg8LjUk8.cjs.js +0 -137
- package/dist/ServerProvider-HRqT3w1C.cjs.js +0 -1
- package/dist/components/Dashboard/DashboardBar.d.ts +0 -21
- package/dist/components/Dashboard/ExploreDialog.d.ts +0 -20
- package/dist/components/DashboardBuilder/DiffDialog.d.ts +0 -7
- package/dist/components/DashboardBuilder/SaveNotice.d.ts +0 -27
- package/dist/components/DashboardBuilder/SettingsPopover.d.ts +0 -32
- package/dist/components/DashboardBuilder/diff.d.ts +0 -35
- package/src/components/Dashboard/DashboardBar.tsx +0 -88
- package/src/components/Dashboard/ExploreDialog.tsx +0 -89
- package/src/components/DashboardBuilder/DashboardBuilder.notice.spec.tsx +0 -194
- package/src/components/DashboardBuilder/DiffDialog.spec.tsx +0 -25
- package/src/components/DashboardBuilder/DiffDialog.tsx +0 -103
- package/src/components/DashboardBuilder/SaveNotice.tsx +0 -113
- package/src/components/DashboardBuilder/SettingsPopover.spec.tsx +0 -87
- package/src/components/DashboardBuilder/SettingsPopover.tsx +0 -326
- package/src/components/DashboardBuilder/diff.spec.ts +0 -44
- package/src/components/DashboardBuilder/diff.ts +0 -93
- /package/dist/{components/DashboardBuilder → utils}/malloyText.d.ts +0 -0
- /package/src/{components/DashboardBuilder → utils}/malloyText.spec.ts +0 -0
- /package/src/{components/DashboardBuilder → utils}/malloyText.ts +0 -0
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as L } from "react/jsx-runtime";
|
|
2
2
|
import { Box as ne, useTheme as he } from "@mui/material";
|
|
3
3
|
import { Suspense as me, useRef as z, useCallback as be, useMemo as fe, useEffect as ye, useLayoutEffect as pe } from "react";
|
|
4
|
-
import { D as ge, r as U, l as ve,
|
|
5
|
-
import {
|
|
4
|
+
import { D as ge, r as U, l as ve, a as we, b as ke, c as xe, m as Ce, d as Re, e as le } from "./useCompiledDocument-BU6d8FPp.es.js";
|
|
5
|
+
import { aM as Ee, aK as Se, aN as Ae } from "./ServerProvider-CcSrGaRN.es.js";
|
|
6
6
|
const g = "publisher-drill";
|
|
7
|
-
function
|
|
7
|
+
function Te(e, r) {
|
|
8
8
|
const t = /* @__PURE__ */ new Set();
|
|
9
|
-
let
|
|
9
|
+
let l;
|
|
10
10
|
try {
|
|
11
|
-
|
|
11
|
+
l = e.getMetadata()?.getAllFields() ?? [];
|
|
12
12
|
} catch {
|
|
13
13
|
return t;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
16
|
-
for (const a of
|
|
17
|
-
!a || r(a) || a.tag?.tag("hidden") === void 0 &&
|
|
18
|
-
for (const a of
|
|
15
|
+
const o = /* @__PURE__ */ new Set();
|
|
16
|
+
for (const a of l)
|
|
17
|
+
!a || r(a) || a.tag?.tag("hidden") === void 0 && o.add(a.tag?.text("label") ?? a.name);
|
|
18
|
+
for (const a of l) {
|
|
19
19
|
if (!a || !r(a)) continue;
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
const n = a.tag?.text("label") ?? a.name;
|
|
21
|
+
o.has(n) || t.add(n);
|
|
22
22
|
}
|
|
23
23
|
return t;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function I(e) {
|
|
26
26
|
const r = /^\s*(\d+)/.exec(e.style?.gridColumn ?? "");
|
|
27
27
|
return r ? r[1] : void 0;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function De(e, r) {
|
|
30
30
|
if (r.size !== 0)
|
|
31
31
|
for (const t of e.querySelectorAll(
|
|
32
32
|
".malloy-table"
|
|
33
33
|
)) {
|
|
34
|
-
const
|
|
35
|
-
for (const
|
|
34
|
+
const l = (n) => n.closest(".malloy-table") === t, o = /* @__PURE__ */ new Set();
|
|
35
|
+
for (const n of t.querySelectorAll(
|
|
36
36
|
".column-cell.th"
|
|
37
37
|
)) {
|
|
38
|
-
if (!
|
|
39
|
-
const s = (
|
|
40
|
-
b && r.has(s) &&
|
|
38
|
+
if (!l(n)) continue;
|
|
39
|
+
const s = (n.textContent ?? "").replace(/\u200b/g, "").trim(), b = I(n);
|
|
40
|
+
b && r.has(s) && o.add(b);
|
|
41
41
|
}
|
|
42
|
-
if (
|
|
42
|
+
if (o.size === 0) continue;
|
|
43
43
|
const a = /* @__PURE__ */ new Set();
|
|
44
|
-
for (const
|
|
44
|
+
for (const n of t.querySelectorAll(
|
|
45
45
|
`.${g}[tabindex="0"]`
|
|
46
46
|
)) {
|
|
47
|
-
if (!
|
|
48
|
-
const s =
|
|
49
|
-
s && (a.has(s) ?
|
|
47
|
+
if (!l(n)) continue;
|
|
48
|
+
const s = I(n);
|
|
49
|
+
s && (a.has(s) ? n.tabIndex = -1 : a.add(s));
|
|
50
50
|
}
|
|
51
|
-
for (const
|
|
51
|
+
for (const n of t.querySelectorAll(
|
|
52
52
|
".column-cell.td"
|
|
53
53
|
)) {
|
|
54
|
-
if (!
|
|
55
|
-
const s =
|
|
56
|
-
if (s && b &&
|
|
57
|
-
if (
|
|
54
|
+
if (!l(n)) continue;
|
|
55
|
+
const s = I(n), b = !n.querySelector(".value-null") && (n.textContent ?? "").trim() !== "";
|
|
56
|
+
if (s && b && o.has(s) && !n.querySelector(".malloy-table")) {
|
|
57
|
+
if (n.classList.add(g), n.tabIndex === 0)
|
|
58
58
|
a.add(s);
|
|
59
59
|
else {
|
|
60
60
|
const y = a.has(s);
|
|
61
|
-
y || a.add(s),
|
|
61
|
+
y || a.add(s), n.tabIndex = y ? -1 : 0;
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
n.setAttribute("role", "button");
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
const r = e.closest(".malloy-table"), t =
|
|
68
|
+
function Oe(e) {
|
|
69
|
+
const r = e.closest(".malloy-table"), t = I(e);
|
|
70
70
|
return !r || !t ? [] : Array.from(
|
|
71
71
|
r.querySelectorAll(`.${g}`)
|
|
72
72
|
).filter(
|
|
73
|
-
(
|
|
73
|
+
(l) => l.closest(".malloy-table") === r && I(l) === t
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
function ie(e, r) {
|
|
77
|
-
const t =
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
for (const a of t) a.tabIndex = a ===
|
|
82
|
-
return
|
|
77
|
+
const t = Oe(e), l = t.indexOf(e);
|
|
78
|
+
if (l === -1) return;
|
|
79
|
+
const o = r === "first" ? t[0] : r === "last" ? t[t.length - 1] : t[Math.min(Math.max(l + r, 0), t.length - 1)];
|
|
80
|
+
if (o) {
|
|
81
|
+
for (const a of t) a.tabIndex = a === o ? 0 : -1;
|
|
82
|
+
return o;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function _e(e) {
|
|
86
86
|
return {
|
|
87
87
|
background: e.dashboardRoot,
|
|
88
88
|
tableBackground: e.tableBackground,
|
|
@@ -104,8 +104,8 @@ function Oe(e) {
|
|
|
104
104
|
mapColor: e.mapColor
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
const { foreground: r, axisFaint: t, font: o } = e,
|
|
107
|
+
function Fe(e) {
|
|
108
|
+
const { foreground: r, axisFaint: t, gridline: l, font: o } = e, a = {
|
|
109
109
|
background: e.background,
|
|
110
110
|
font: o.family,
|
|
111
111
|
title: { color: r, font: o.family },
|
|
@@ -114,7 +114,7 @@ function _e(e) {
|
|
|
114
114
|
titleColor: r,
|
|
115
115
|
domainColor: t,
|
|
116
116
|
tickColor: t,
|
|
117
|
-
gridColor:
|
|
117
|
+
gridColor: l,
|
|
118
118
|
labelFont: o.family,
|
|
119
119
|
titleFont: o.family
|
|
120
120
|
},
|
|
@@ -127,83 +127,82 @@ function _e(e) {
|
|
|
127
127
|
header: { labelColor: r, titleColor: r },
|
|
128
128
|
range: { category: e.series }
|
|
129
129
|
};
|
|
130
|
-
return (
|
|
130
|
+
return (n) => a;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function ze(e) {
|
|
133
133
|
if (!e) return;
|
|
134
134
|
const r = e.tag("theme");
|
|
135
135
|
if (!r) return;
|
|
136
|
-
const t = {},
|
|
137
|
-
if (
|
|
138
|
-
const a = {},
|
|
139
|
-
|
|
140
|
-
for (const s of
|
|
141
|
-
const b =
|
|
136
|
+
const t = {}, l = r.tag("palette");
|
|
137
|
+
if (l) {
|
|
138
|
+
const a = {}, n = l.textArray("series");
|
|
139
|
+
n && n.length > 0 && (a.series = n);
|
|
140
|
+
for (const s of Ee) {
|
|
141
|
+
const b = l.tag(s);
|
|
142
142
|
if (!b) continue;
|
|
143
143
|
const y = {}, k = b.text("light"), v = b.text("dark");
|
|
144
144
|
k && (y.light = k), v && (y.dark = v), Object.keys(y).length > 0 && (a[s] = y);
|
|
145
145
|
}
|
|
146
146
|
Object.keys(a).length > 0 && (t.palette = a);
|
|
147
147
|
}
|
|
148
|
-
const
|
|
149
|
-
if (
|
|
150
|
-
const a = {},
|
|
151
|
-
|
|
152
|
-
const s =
|
|
148
|
+
const o = r.tag("font");
|
|
149
|
+
if (o) {
|
|
150
|
+
const a = {}, n = o.text("family");
|
|
151
|
+
n && (a.family = n);
|
|
152
|
+
const s = o.numeric("size");
|
|
153
153
|
typeof s == "number" && Number.isFinite(s) && (a.size = s), Object.keys(a).length > 0 && (t.font = a);
|
|
154
154
|
}
|
|
155
155
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
156
156
|
}
|
|
157
|
-
const
|
|
157
|
+
const M = "data-publisher-fill", Le = async (e, r) => {
|
|
158
158
|
if (typeof window > "u")
|
|
159
159
|
throw new Error("MalloyRenderer can only be used in browser environment");
|
|
160
|
-
const { MalloyRenderer: t } = await
|
|
160
|
+
const { MalloyRenderer: t } = await we();
|
|
161
161
|
return new t({
|
|
162
162
|
onClick: r,
|
|
163
|
-
vegaConfigOverride:
|
|
163
|
+
vegaConfigOverride: Fe(e),
|
|
164
164
|
// Pass the explicit theme so table chrome and dashboard tiles
|
|
165
165
|
// pick up the operator's colours directly. Without this the
|
|
166
166
|
// renderer's own inline style writes `--malloy-render--*` values
|
|
167
167
|
// sourced from its built-in defaults and shadows whatever we set
|
|
168
168
|
// on the outer wrapper.
|
|
169
|
-
theme:
|
|
170
|
-
onError: (
|
|
171
|
-
console.error("Error rendering visualization:", typeof
|
|
169
|
+
theme: _e(e),
|
|
170
|
+
onError: (o) => {
|
|
171
|
+
console.error("Error rendering visualization:", typeof o, o);
|
|
172
172
|
}
|
|
173
173
|
}).createViz();
|
|
174
174
|
};
|
|
175
|
-
|
|
176
|
-
async function Ie(e) {
|
|
175
|
+
async function Me(e) {
|
|
177
176
|
if (!e || typeof e != "object") return;
|
|
178
177
|
const r = e, t = [
|
|
179
178
|
...Array.isArray(r.model_annotations) ? r.model_annotations : [],
|
|
180
179
|
...Array.isArray(r.source_annotations) ? r.source_annotations : [],
|
|
181
180
|
...Array.isArray(r.annotations) ? r.annotations : []
|
|
182
|
-
].map((
|
|
181
|
+
].map((o) => typeof o?.value == "string" ? o.value : void 0).filter((o) => !!o);
|
|
183
182
|
if (t.length === 0) return;
|
|
184
|
-
let
|
|
183
|
+
let l;
|
|
185
184
|
try {
|
|
186
|
-
({ parseAnnotation:
|
|
185
|
+
({ parseAnnotation: l } = await ve());
|
|
187
186
|
} catch {
|
|
188
187
|
return;
|
|
189
188
|
}
|
|
190
189
|
try {
|
|
191
|
-
const { tag:
|
|
192
|
-
return
|
|
193
|
-
} catch (
|
|
190
|
+
const { tag: o } = l(t);
|
|
191
|
+
return ze(o);
|
|
192
|
+
} catch (o) {
|
|
194
193
|
console.warn(
|
|
195
194
|
"Failed to parse # theme.* annotations; chart will render with the shell theme.",
|
|
196
|
-
{ error:
|
|
195
|
+
{ error: o, lines: t }
|
|
197
196
|
);
|
|
198
197
|
return;
|
|
199
198
|
}
|
|
200
199
|
}
|
|
201
|
-
function
|
|
202
|
-
const
|
|
203
|
-
for (const [
|
|
204
|
-
e.style.setProperty(
|
|
200
|
+
function Ie(e, r, t) {
|
|
201
|
+
const l = ke(r, t);
|
|
202
|
+
for (const [o, a] of Object.entries(l))
|
|
203
|
+
e.style.setProperty(o, a);
|
|
205
204
|
}
|
|
206
|
-
const
|
|
205
|
+
const Be = `
|
|
207
206
|
/* Card geometry, through the renderer's OWN theme vars rather than over the top
|
|
208
207
|
of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
|
|
209
208
|
passes each through to the --malloy-render--* the card CSS reads, so a value
|
|
@@ -289,7 +288,7 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
|
|
|
289
288
|
background: var(--malloy-render--table-border) !important;
|
|
290
289
|
}
|
|
291
290
|
/* !important because the malloy-explorer stylesheet pins these same properties with it. */
|
|
292
|
-
[${
|
|
291
|
+
[${M}] .malloy-table.root {
|
|
293
292
|
height: 100% !important;
|
|
294
293
|
align-content: start !important;
|
|
295
294
|
grid-template-columns: repeat(var(--total-header-size), minmax(max-content, 1fr)) !important;
|
|
@@ -344,26 +343,26 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
|
|
|
344
343
|
text-decoration: underline;
|
|
345
344
|
}
|
|
346
345
|
`, se = "publisher-malloy-renderer-overrides";
|
|
347
|
-
function
|
|
346
|
+
function Ne() {
|
|
348
347
|
if (typeof document > "u" || document.getElementById(se)) return;
|
|
349
348
|
const e = document.createElement("style");
|
|
350
|
-
e.id = se, e.textContent =
|
|
349
|
+
e.id = se, e.textContent = Be, document.head.appendChild(e);
|
|
351
350
|
}
|
|
352
|
-
function
|
|
351
|
+
function $e({
|
|
353
352
|
result: e,
|
|
354
353
|
height: r,
|
|
355
354
|
drill: t,
|
|
356
|
-
onSizeChange:
|
|
357
|
-
onSizing:
|
|
355
|
+
onSizeChange: l,
|
|
356
|
+
onSizing: o,
|
|
358
357
|
fill: a
|
|
359
358
|
}) {
|
|
360
|
-
const
|
|
359
|
+
const n = z(null), s = z(t);
|
|
361
360
|
s.current = t;
|
|
362
361
|
const b = be((c) => {
|
|
363
362
|
s.current?.onClick(c);
|
|
364
363
|
}, []), y = t !== void 0, k = z(!1), v = z(
|
|
365
364
|
null
|
|
366
|
-
), P = z(0), { theme:
|
|
365
|
+
), P = z(0), { theme: X, layers: Y, mode: J } = Se(), W = he().shape.borderRadius, Q = fe(
|
|
367
366
|
() => ({
|
|
368
367
|
radius: `${W}px`,
|
|
369
368
|
padding: `${ge}px`
|
|
@@ -375,9 +374,9 @@ function Ne({
|
|
|
375
374
|
const c = v.current;
|
|
376
375
|
c?.viz.remove(), c?.node.remove(), v.current = null;
|
|
377
376
|
}, []), pe(() => {
|
|
378
|
-
if (!
|
|
379
|
-
|
|
380
|
-
const c =
|
|
377
|
+
if (!n.current || !e) return;
|
|
378
|
+
Ne();
|
|
379
|
+
const c = n.current, de = P.current += 1;
|
|
381
380
|
let V = !1;
|
|
382
381
|
const q = () => !V && de === P.current;
|
|
383
382
|
let d, h, B = null, H = 0, N = null, $ = null, j = null, T = null, D = null, O = null, Z = null, ee = 0, C = null;
|
|
@@ -385,16 +384,16 @@ function Ne({
|
|
|
385
384
|
let p, R;
|
|
386
385
|
const K = (w) => {
|
|
387
386
|
if (V || !w.firstElementChild || U(p, R) === "container") return;
|
|
388
|
-
const _ =
|
|
387
|
+
const _ = xe(p, R);
|
|
389
388
|
if (k.current && !_) return;
|
|
390
|
-
const F = c.hasAttribute(
|
|
391
|
-
F && c.removeAttribute(
|
|
392
|
-
const E =
|
|
389
|
+
const F = c.hasAttribute(M);
|
|
390
|
+
F && c.removeAttribute(M);
|
|
391
|
+
const E = Ce(
|
|
393
392
|
w,
|
|
394
393
|
le(p)
|
|
395
394
|
);
|
|
396
|
-
F && c.setAttribute(
|
|
397
|
-
const u =
|
|
395
|
+
F && c.setAttribute(M, ""), E > 0 && (k.current = !0, l && E !== ee && (ee = E, l(E)));
|
|
396
|
+
const u = Re(w, le(p));
|
|
398
397
|
_ && u && Z !== u && (Z = u, O?.disconnect(), O = new ResizeObserver(() => K(w)), O.observe(u));
|
|
399
398
|
};
|
|
400
399
|
return (async () => {
|
|
@@ -405,10 +404,10 @@ function Ne({
|
|
|
405
404
|
console.error("Error parsing visualization result:", f);
|
|
406
405
|
return;
|
|
407
406
|
}
|
|
408
|
-
const _ = await
|
|
407
|
+
const _ = await Me(w), F = _ ? Ae([...Y, _], J) : X;
|
|
409
408
|
if (!q()) return;
|
|
410
409
|
try {
|
|
411
|
-
h = await
|
|
410
|
+
h = await Le(F, b);
|
|
412
411
|
} catch (f) {
|
|
413
412
|
console.error("Failed to create renderer:", f);
|
|
414
413
|
return;
|
|
@@ -418,7 +417,7 @@ function Ne({
|
|
|
418
417
|
return;
|
|
419
418
|
}
|
|
420
419
|
const E = v.current;
|
|
421
|
-
d = document.createElement("div"), d.style.width = "100%", d.style.height = "100%",
|
|
420
|
+
d = document.createElement("div"), d.style.width = "100%", d.style.height = "100%", Ie(d, F, Q), c.childElementCount > 0 && (c.style.position = "relative", d.style.position = "absolute", d.style.inset = "0", d.style.visibility = "hidden"), c.appendChild(d);
|
|
422
421
|
const u = d;
|
|
423
422
|
T = new MutationObserver(() => {
|
|
424
423
|
D && clearTimeout(D), D = setTimeout(() => {
|
|
@@ -447,13 +446,13 @@ function Ne({
|
|
|
447
446
|
} catch {
|
|
448
447
|
p = void 0, R = void 0;
|
|
449
448
|
}
|
|
450
|
-
|
|
449
|
+
o?.(U(p, R)), d.dataset.malloyRenderAs = p ?? "unknown", d.dataset.malloySizing = U(p, R), h.render(d);
|
|
451
450
|
const f = s.current;
|
|
452
451
|
try {
|
|
453
452
|
if (f) {
|
|
454
|
-
const x =
|
|
453
|
+
const x = Te(h, f.canDrill), S = () => {
|
|
455
454
|
try {
|
|
456
|
-
|
|
455
|
+
De(u, x);
|
|
457
456
|
} catch (i) {
|
|
458
457
|
console.warn("Drill affordance skipped:", i);
|
|
459
458
|
}
|
|
@@ -510,17 +509,17 @@ function Ne({
|
|
|
510
509
|
e,
|
|
511
510
|
b,
|
|
512
511
|
y,
|
|
512
|
+
l,
|
|
513
513
|
o,
|
|
514
|
-
n,
|
|
515
|
-
J,
|
|
516
514
|
X,
|
|
517
515
|
Y,
|
|
516
|
+
J,
|
|
518
517
|
Q
|
|
519
|
-
]), /* @__PURE__ */
|
|
518
|
+
]), /* @__PURE__ */ L(
|
|
520
519
|
"div",
|
|
521
520
|
{
|
|
522
|
-
ref:
|
|
523
|
-
...a ? { [
|
|
521
|
+
ref: n,
|
|
522
|
+
...a ? { [M]: "" } : {},
|
|
524
523
|
style: {
|
|
525
524
|
width: "100%",
|
|
526
525
|
height: r ? `${r}px` : "400px"
|
|
@@ -528,8 +527,8 @@ function Ne({
|
|
|
528
527
|
}
|
|
529
528
|
);
|
|
530
529
|
}
|
|
531
|
-
function
|
|
532
|
-
return typeof window > "u" ? /* @__PURE__ */
|
|
530
|
+
function je(e) {
|
|
531
|
+
return typeof window > "u" ? /* @__PURE__ */ L(
|
|
533
532
|
ne,
|
|
534
533
|
{
|
|
535
534
|
sx: {
|
|
@@ -542,10 +541,10 @@ function $e(e) {
|
|
|
542
541
|
},
|
|
543
542
|
children: "Loading..."
|
|
544
543
|
}
|
|
545
|
-
) : /* @__PURE__ */
|
|
544
|
+
) : /* @__PURE__ */ L(
|
|
546
545
|
me,
|
|
547
546
|
{
|
|
548
|
-
fallback: /* @__PURE__ */
|
|
547
|
+
fallback: /* @__PURE__ */ L(
|
|
549
548
|
ne,
|
|
550
549
|
{
|
|
551
550
|
sx: {
|
|
@@ -559,21 +558,21 @@ function $e(e) {
|
|
|
559
558
|
children: "Loading visualization..."
|
|
560
559
|
}
|
|
561
560
|
),
|
|
562
|
-
children: /* @__PURE__ */
|
|
561
|
+
children: /* @__PURE__ */ L($e, { ...e })
|
|
563
562
|
}
|
|
564
563
|
);
|
|
565
564
|
}
|
|
566
|
-
const
|
|
565
|
+
const Ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
567
566
|
__proto__: null,
|
|
568
|
-
default:
|
|
567
|
+
default: je
|
|
569
568
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
570
569
|
export {
|
|
571
570
|
g as D,
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
571
|
+
je as R,
|
|
572
|
+
Fe as a,
|
|
573
|
+
_e as b,
|
|
574
|
+
Ge as c,
|
|
575
|
+
Te as d,
|
|
576
|
+
De as m,
|
|
577
|
+
ze as r
|
|
579
578
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const I=require("react/jsx-runtime"),X=require("@mui/material"),p=require("react"),b=require("./useCompiledDocument-pOg2W-Yt.cjs.js"),Y=require("./ServerProvider-Gbf1YPOP.cjs.js"),g="publisher-drill";function de(e,r){const t=new Set;let l;try{l=e.getMetadata()?.getAllFields()??[]}catch{return t}const o=new Set;for(const a of l)!a||r(a)||a.tag?.tag("hidden")===void 0&&o.add(a.tag?.text("label")??a.name);for(const a of l){if(!a||!r(a))continue;const n=a.tag?.text("label")??a.name;o.has(n)||t.add(n)}return t}function B(e){const r=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return r?r[1]:void 0}function ce(e,r){if(r.size!==0)for(const t of e.querySelectorAll(".malloy-table")){const l=n=>n.closest(".malloy-table")===t,o=new Set;for(const n of t.querySelectorAll(".column-cell.th")){if(!l(n))continue;const s=(n.textContent??"").replace(/\u200b/g,"").trim(),f=B(n);f&&r.has(s)&&o.add(f)}if(o.size===0)continue;const a=new Set;for(const n of t.querySelectorAll(`.${g}[tabindex="0"]`)){if(!l(n))continue;const s=B(n);s&&(a.has(s)?n.tabIndex=-1:a.add(s))}for(const n of t.querySelectorAll(".column-cell.td")){if(!l(n))continue;const s=B(n),f=!n.querySelector(".value-null")&&(n.textContent??"").trim()!=="";if(s&&f&&o.has(s)&&!n.querySelector(".malloy-table")){if(n.classList.add(g),n.tabIndex===0)a.add(s);else{const v=a.has(s);v||a.add(s),n.tabIndex=v?-1:0}n.setAttribute("role","button")}}}}function ge(e){const r=e.closest(".malloy-table"),t=B(e);return!r||!t?[]:Array.from(r.querySelectorAll(`.${g}`)).filter(l=>l.closest(".malloy-table")===r&&B(l)===t)}function ie(e,r){const t=ge(e),l=t.indexOf(e);if(l===-1)return;const o=r==="first"?t[0]:r==="last"?t[t.length-1]:t[Math.min(Math.max(l+r,0),t.length-1)];if(o){for(const a of t)a.tabIndex=a===o?0:-1;return o}}function ue(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 he(e){const{foreground:r,axisFaint:t,gridline:l,font:o}=e,a={background:e.background,font:o.family,title:{color:r,font:o.family},axis:{labelColor:r,titleColor:r,domainColor:t,tickColor:t,gridColor:l,labelFont:o.family,titleFont:o.family},legend:{labelColor:r,titleColor:r,labelFont:o.family,titleFont:o.family},header:{labelColor:r,titleColor:r},range:{category:e.series}};return n=>a}function me(e){if(!e)return;const r=e.tag("theme");if(!r)return;const t={},l=r.tag("palette");if(l){const a={},n=l.textArray("series");n&&n.length>0&&(a.series=n);for(const s of Y.PER_MODE_COLOR_KEYS){const f=l.tag(s);if(!f)continue;const v={},R=f.text("light"),k=f.text("dark");R&&(v.light=R),k&&(v.dark=k),Object.keys(v).length>0&&(a[s]=v)}Object.keys(a).length>0&&(t.palette=a)}const o=r.tag("font");if(o){const a={},n=o.text("family");n&&(a.family=n);const s=o.numeric("size");typeof s=="number"&&Number.isFinite(s)&&(a.size=s),Object.keys(a).length>0&&(t.font=a)}return Object.keys(t).length>0?t:void 0}const M="data-publisher-fill",ve=async(e,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:t}=await b.loadMalloyRenderer();return new t({onClick:r,vegaConfigOverride:he(e),theme:ue(e),onError:o=>{console.error("Error rendering visualization:",typeof o,o)}}).createViz()};async function we(e){if(!e||typeof e!="object")return;const r=e,t=[...Array.isArray(r.model_annotations)?r.model_annotations:[],...Array.isArray(r.source_annotations)?r.source_annotations:[],...Array.isArray(r.annotations)?r.annotations:[]].map(o=>typeof o?.value=="string"?o.value:void 0).filter(o=>!!o);if(t.length===0)return;let l;try{({parseAnnotation:l}=await b.loadMalloyTag())}catch{return}try{const{tag:o}=l(t);return me(o)}catch(o){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:o,lines:t});return}}function ke(e,r,t){const l=b.buildTableCssVars(r,t);for(const[o,a]of Object.entries(l))e.style.setProperty(o,a)}const xe=`
|
|
2
2
|
/* Card geometry, through the renderer's OWN theme vars rather than over the top
|
|
3
3
|
of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
|
|
4
4
|
passes each through to the --malloy-render--* the card CSS reads, so a value
|
|
@@ -138,4 +138,4 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
|
|
|
138
138
|
color: var(--publisher-drill-link) !important;
|
|
139
139
|
text-decoration: underline;
|
|
140
140
|
}
|
|
141
|
-
`,
|
|
141
|
+
`,se="publisher-malloy-renderer-overrides";function Re(){if(typeof document>"u"||document.getElementById(se))return;const e=document.createElement("style");e.id=se,e.textContent=xe,document.head.appendChild(e)}function Ce({result:e,height:r,drill:t,onSizeChange:l,onSizing:o,fill:a}){const n=p.useRef(null),s=p.useRef(t);s.current=t;const f=p.useCallback(c=>{s.current?.onClick(c)},[]),v=t!==void 0,R=p.useRef(!1),k=p.useRef(null),P=p.useRef(0),{theme:J,layers:W,mode:Q}=Y.usePublisherTheme(),Z=X.useTheme().shape.borderRadius,ee=p.useMemo(()=>({radius:`${Z}px`,padding:`${b.DASHBOARD_CARD_PADDING_PX}px`}),[Z]);return p.useEffect(()=>()=>{P.current+=1;const c=k.current;c?.viz.remove(),c?.node.remove(),k.current=null},[]),p.useLayoutEffect(()=>{if(!n.current||!e)return;Re();const c=n.current,fe=P.current+=1;let V=!1;const H=()=>!V&&fe===P.current;let d,h,j=null,K=0,N=null,$=null,q=null,O=null,L=null,_=null,re=null,te=0,E=null;R.current=!1;let w,S;const G=x=>{if(V||!x.firstElementChild||b.resultSizing(w,S)==="container")return;const z=b.remeasuresAfterReady(w,S);if(R.current&&!z)return;const F=c.hasAttribute(M);F&&c.removeAttribute(M);const A=b.measureContentHeight(x,b.contentNodeDepth(w));F&&c.setAttribute(M,""),A>0&&(R.current=!0,l&&A!==te&&(te=A,l(A)));const u=b.contentNode(x,b.contentNodeDepth(w));z&&u&&re!==u&&(re=u,_?.disconnect(),_=new ResizeObserver(()=>G(x)),_.observe(u))};return(async()=>{let x;try{x=JSON.parse(e)}catch(y){console.error("Error parsing visualization result:",y);return}const z=await we(x),F=z?Y.resolveTheme([...W,z],Q):J;if(!H())return;try{h=await ve(F,f)}catch(y){console.error("Failed to create renderer:",y);return}if(!H()){h.remove(),h=void 0;return}const A=k.current;d=document.createElement("div"),d.style.width="100%",d.style.height="100%",ke(d,F,ee),c.childElementCount>0&&(c.style.position="relative",d.style.position="absolute",d.style.inset="0",d.style.visibility="hidden"),c.appendChild(d);const u=d;O=new MutationObserver(()=>{L&&clearTimeout(L),L=setTimeout(()=>{G(u),R.current&&O?.disconnect()},100)}),O.observe(d,{childList:!0,subtree:!0,attributes:!0});const ye=h;let oe=!1;const ae=()=>{if(!(oe||!H())){oe=!0,E&&(clearTimeout(E),E=null),A?.viz.remove();for(const y of Array.from(c.children))y!==u&&c.removeChild(y);u.style.position="",u.style.inset="",u.style.visibility="",c.style.position="",k.current={viz:ye,node:u},G(u)}};try{h.setResult(x);try{const C=h.getMetadata(),T=C?.getRootField();w=T?.renderAs(),S=T?C?.getPluginsForField(T.key)?.[0]?.sizingStrategy:void 0}catch{w=void 0,S=void 0}o?.(b.resultSizing(w,S)),d.dataset.malloyRenderAs=w??"unknown",d.dataset.malloySizing=b.resultSizing(w,S),h.render(d);const y=s.current;try{if(y){const C=de(h,y.canDrill),T=()=>{try{ce(u,C)}catch(i){console.warn("Drill affordance skipped:",i)}};T();const ne=i=>{const D=i.querySelector(".cell-content")??i,U=D.getBoundingClientRect();D.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:D.ownerDocument.defaultView,clientX:Math.round(U.left+U.width/2),clientY:Math.round(U.bottom)}))},le=i=>i.target?.closest?.(`.${g}`)??null,pe=(i,m)=>{ie(i,m)?.focus()};N=i=>{const m=le(i);if(!m)return;const D=i.key==="ArrowDown"?1:i.key==="ArrowUp"?-1:i.key==="Home"?"first":i.key==="End"?"last":void 0;if(D!==void 0){i.preventDefault(),pe(m,D);return}i.key==="Enter"?(i.preventDefault(),ne(m)):i.key===" "&&i.preventDefault()},$=i=>{if(i.key!==" ")return;const m=le(i);m&&(i.preventDefault(),ne(m))},q=i=>{const m=i.target?.closest?.(`.${g}`);m&&ie(m,0)},u.addEventListener("keydown",N),u.addEventListener("keyup",$),u.addEventListener("focusin",q),C.size>0&&typeof MutationObserver<"u"&&(j=new MutationObserver(()=>{cancelAnimationFrame(K),K=requestAnimationFrame(T)}),j.observe(u,{childList:!0,subtree:!0}))}}catch(C){console.warn("Drill affordance skipped:",C)}h.onReady(ae),E=setTimeout(ae,1e4)}catch(y){console.error("Error rendering visualization:",y),O?.disconnect(),_?.disconnect(),j?.disconnect(),h.remove(),h=void 0,u.parentNode===c&&c.removeChild(u)}})(),()=>{V=!0,O?.disconnect(),_?.disconnect(),L&&clearTimeout(L),E&&clearTimeout(E),d&&k.current?.node!==d&&(N&&d.removeEventListener("keydown",N),$&&d.removeEventListener("keyup",$),q&&d.removeEventListener("focusin",q),j?.disconnect(),cancelAnimationFrame(K),h?.remove(),d.parentNode===c&&c.removeChild(d),c.style.position="")}},[e,f,v,l,o,J,W,Q,ee]),I.jsx("div",{ref:n,...a?{[M]:""}:{},style:{width:"100%",height:r?`${r}px`:"400px"}})}function be(e){return typeof window>"u"?I.jsx(X.Box,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):I.jsx(p.Suspense,{fallback:I.jsx(X.Box,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:I.jsx(Ce,{...e})})}const Ee=Object.freeze(Object.defineProperty({__proto__:null,default:be},Symbol.toStringTag,{value:"Module"}));exports.DRILL_CELL_CLASS=g;exports.RenderedResult=be;exports.RenderedResult$1=Ee;exports.buildMalloyExplicitTheme=ue;exports.buildVegaThemeOverride=he;exports.drillableFieldNames=de;exports.markDrillableCells=ce;exports.readChartAnnotations=me;
|