@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.
Files changed (264) hide show
  1. package/dist/{RenderedResult-CBLHr32C.es.js → RenderedResult-DwB0-9Yx.es.js} +118 -119
  2. package/dist/{RenderedResult-B48wAjM8.cjs.js → RenderedResult-hKjFEqaN.cjs.js} +2 -2
  3. package/dist/{ServerProvider-DCV8BUWD.es.js → ServerProvider-CcSrGaRN.es.js} +1281 -1142
  4. package/dist/ServerProvider-Gbf1YPOP.cjs.js +1 -0
  5. package/dist/builder/index.cjs.js +112 -115
  6. package/dist/builder/index.es.js +11766 -11502
  7. package/dist/builder-entry.d.ts +1 -1
  8. package/dist/client/api.d.ts +170 -9
  9. package/dist/client/index.cjs.js +1 -1
  10. package/dist/client/index.es.js +93 -89
  11. package/dist/client-entry.d.ts +2 -0
  12. package/dist/components/ApiErrorDisplay.d.ts +11 -0
  13. package/dist/components/AppDialog.d.ts +6 -6
  14. package/dist/components/Dashboard/DashboardGrid.d.ts +18 -3
  15. package/dist/components/Dashboard/DashboardTile.d.ts +12 -2
  16. package/dist/components/Dashboard/DashboardView.d.ts +38 -3
  17. package/dist/components/Dashboard/TileCard.d.ts +16 -2
  18. package/dist/components/Dashboard/dropValueUrlTags.d.ts +6 -0
  19. package/dist/components/Dashboard/index.d.ts +3 -2
  20. package/dist/components/Dashboard/telemetry.d.ts +2 -1
  21. package/dist/components/Dashboard/textSource.d.ts +19 -0
  22. package/dist/components/DashboardBuilder/AddTileDialog.d.ts +7 -8
  23. package/dist/components/DashboardBuilder/BuilderDialogs.d.ts +25 -0
  24. package/dist/components/DashboardBuilder/BuilderGrid.d.ts +31 -0
  25. package/dist/components/DashboardBuilder/BuilderHeader.d.ts +17 -0
  26. package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +14 -17
  27. package/dist/components/DashboardBuilder/ChartPicker.d.ts +3 -1
  28. package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +15 -7
  29. package/dist/components/DashboardBuilder/DashboardEditor.d.ts +28 -2
  30. package/dist/components/DashboardBuilder/EditorSurface.d.ts +33 -0
  31. package/dist/components/DashboardBuilder/FilterStrip.d.ts +6 -4
  32. package/dist/components/DashboardBuilder/InlineText.d.ts +1 -1
  33. package/dist/components/DashboardBuilder/NotebookEditor.d.ts +1 -1
  34. package/dist/components/DashboardBuilder/TextTileBody.d.ts +4 -1
  35. package/dist/components/DashboardBuilder/TileFrame.d.ts +43 -6
  36. package/dist/components/DashboardBuilder/TileMenu.d.ts +6 -8
  37. package/dist/components/DashboardBuilder/builderReport.d.ts +13 -0
  38. package/dist/components/DashboardBuilder/catalog.d.ts +0 -18
  39. package/dist/components/DashboardBuilder/documentSession.d.ts +2 -2
  40. package/dist/components/DashboardBuilder/imports.d.ts +19 -0
  41. package/dist/components/DashboardBuilder/inlineEdit.d.ts +18 -0
  42. package/dist/components/DashboardBuilder/readDocument.d.ts +3 -1
  43. package/dist/components/DashboardBuilder/readForEditor.d.ts +1 -1
  44. package/dist/components/DashboardBuilder/sortable.d.ts +2 -0
  45. package/dist/components/DashboardBuilder/spliceDocument.d.ts +2 -0
  46. package/dist/components/DashboardBuilder/testing/resize.d.ts +7 -0
  47. package/dist/components/DashboardBuilder/tileDisplayTitle.d.ts +7 -0
  48. package/dist/components/DashboardBuilder/useBuilderSelection.d.ts +53 -0
  49. package/dist/components/DashboardBuilder/useBuilderSession.d.ts +4 -7
  50. package/dist/components/DashboardBuilder/useControlBindings.d.ts +30 -0
  51. package/dist/components/DashboardBuilder/useConversionConfirm.d.ts +20 -0
  52. package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +2 -0
  53. package/dist/components/DashboardBuilder/useDraft.d.ts +3 -1
  54. package/dist/components/DashboardBuilder/useHostCopy.d.ts +26 -0
  55. package/dist/components/DashboardBuilder/useOpenDraftCommit.d.ts +17 -0
  56. package/dist/components/DashboardBuilder/useOpenedDocument.d.ts +71 -0
  57. package/dist/components/DashboardBuilder/useSaveChannel.d.ts +50 -0
  58. package/dist/components/DashboardBuilder/useTileEditing.d.ts +33 -0
  59. package/dist/components/DashboardBuilder/useTileResize.d.ts +32 -0
  60. package/dist/components/Loading.d.ts +13 -0
  61. package/dist/components/Notebook/NotebookCell.d.ts +1 -5
  62. package/dist/components/Package/Package.d.ts +16 -1
  63. package/dist/components/Package/index.d.ts +1 -1
  64. package/dist/components/Prose.d.ts +1 -1
  65. package/dist/components/RenderedResult/loadRenderer.d.ts +7 -0
  66. package/dist/components/given/paramCodec.d.ts +8 -1
  67. package/dist/components/index.d.ts +1 -2
  68. package/dist/components/styles.d.ts +4 -4
  69. package/dist/hooks/givenValue.d.ts +6 -0
  70. package/dist/hooks/index.d.ts +1 -0
  71. package/dist/hooks/useCompiledDocument.d.ts +23 -0
  72. package/dist/hooks/useDocumentControls.d.ts +6 -1
  73. package/dist/hooks/useNearViewport.d.ts +16 -0
  74. package/dist/hooks/useQueryWithApiError.d.ts +7 -2
  75. package/dist/hooks/useSuggestOptions.d.ts +9 -2
  76. package/dist/index.cjs.js +14 -14
  77. package/dist/index.es.js +9760 -10363
  78. package/dist/text/index.es.js +1 -1
  79. package/dist/{text-entry-CbbBcZl8.es.js → text-entry-CA0LZ1xL.es.js} +8 -8
  80. package/dist/text-entry.d.ts +1 -1
  81. package/dist/theme/accent.d.ts +29 -0
  82. package/dist/theme/buildVegaThemeOverride.d.ts +3 -3
  83. package/dist/theme/index.d.ts +3 -0
  84. package/dist/theme/keys.d.ts +1 -1
  85. package/dist/theme/motion.d.ts +31 -0
  86. package/dist/theme/readChartAnnotations.d.ts +1 -1
  87. package/dist/theme/resolveTheme.d.ts +4 -4
  88. package/dist/theme/types.d.ts +33 -5
  89. package/dist/{DashboardTile-BFcxdv7R.es.js → useCompiledDocument-BU6d8FPp.es.js} +6978 -6289
  90. package/dist/useCompiledDocument-pOg2W-Yt.cjs.js +142 -0
  91. package/package.json +11 -11
  92. package/src/builder-entry.ts +1 -0
  93. package/src/client-entry.ts +8 -0
  94. package/src/clientEntry.spec.ts +17 -0
  95. package/src/components/ApiErrorDisplay.tsx +37 -18
  96. package/src/components/AppDialog.tsx +8 -7
  97. package/src/components/Dashboard/Dashboard.spec.tsx +3 -32
  98. package/src/components/Dashboard/Dashboard.tsx +2 -2
  99. package/src/components/Dashboard/DashboardGrid.tsx +23 -5
  100. package/src/components/Dashboard/DashboardTile.spec.tsx +97 -2
  101. package/src/components/Dashboard/DashboardTile.tsx +95 -31
  102. package/src/components/Dashboard/DashboardView.spec.tsx +156 -0
  103. package/src/components/Dashboard/DashboardView.tsx +165 -89
  104. package/src/components/Dashboard/RowsDialog.tsx +3 -2
  105. package/src/components/Dashboard/TileCard.tsx +17 -2
  106. package/src/components/Dashboard/dropValueUrlTags.spec.ts +177 -0
  107. package/src/components/Dashboard/dropValueUrlTags.ts +108 -0
  108. package/src/components/Dashboard/index.ts +11 -2
  109. package/src/components/Dashboard/telemetry.ts +2 -1
  110. package/src/components/Dashboard/textSource.spec.ts +36 -0
  111. package/src/components/Dashboard/textSource.ts +39 -0
  112. package/src/components/DashboardBuilder/AddTileDialog.tsx +16 -56
  113. package/src/components/DashboardBuilder/BuilderDialogs.tsx +162 -0
  114. package/src/components/DashboardBuilder/BuilderGrid.tsx +245 -0
  115. package/src/components/DashboardBuilder/BuilderHeader.tsx +107 -0
  116. package/src/components/DashboardBuilder/BuilderToolbar.tsx +86 -113
  117. package/src/components/DashboardBuilder/ChartPicker.tsx +4 -1
  118. package/src/components/DashboardBuilder/DashboardBuilder.charts.spec.tsx +5 -5
  119. package/src/components/DashboardBuilder/DashboardBuilder.exit.spec.tsx +74 -83
  120. package/src/components/DashboardBuilder/DashboardBuilder.inline.spec.tsx +62 -18
  121. package/src/components/DashboardBuilder/DashboardBuilder.notebook.spec.tsx +55 -108
  122. package/src/components/DashboardBuilder/DashboardBuilder.openDraft.spec.tsx +10 -62
  123. package/src/components/DashboardBuilder/DashboardBuilder.sources.spec.tsx +50 -57
  124. package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +53 -40
  125. package/src/components/DashboardBuilder/DashboardBuilder.textTiles.spec.tsx +10 -8
  126. package/src/components/DashboardBuilder/DashboardBuilder.tsx +227 -704
  127. package/src/components/DashboardBuilder/DashboardEditor.authoritative.spec.tsx +32 -52
  128. package/src/components/DashboardBuilder/DashboardEditor.emptyStart.spec.tsx +1 -50
  129. package/src/components/DashboardBuilder/DashboardEditor.notebook.spec.tsx +12 -18
  130. package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +4 -24
  131. package/src/components/DashboardBuilder/DashboardEditor.resourceUri.spec.tsx +4 -4
  132. package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +8 -13
  133. package/src/components/DashboardBuilder/DashboardEditor.textSource.spec.tsx +317 -0
  134. package/src/components/DashboardBuilder/DashboardEditor.tsx +142 -820
  135. package/src/components/DashboardBuilder/DrillDialog.tsx +2 -2
  136. package/src/components/DashboardBuilder/EditorSurface.tsx +471 -0
  137. package/src/components/DashboardBuilder/FilterDialog.tsx +13 -8
  138. package/src/components/DashboardBuilder/FilterStrip.tsx +117 -79
  139. package/src/components/DashboardBuilder/InlineMarkdown.tsx +7 -9
  140. package/src/components/DashboardBuilder/InlineText.tsx +23 -17
  141. package/src/components/DashboardBuilder/NotebookEditor.tsx +3 -3
  142. package/src/components/DashboardBuilder/TextTileBody.tsx +5 -2
  143. package/src/components/DashboardBuilder/TileFrame.tsx +255 -90
  144. package/src/components/DashboardBuilder/TileMenu.tsx +41 -91
  145. package/src/components/DashboardBuilder/artifactBlock.spec.ts +1 -1
  146. package/src/components/DashboardBuilder/artifactTagParity.spec.ts +9 -4
  147. package/src/components/DashboardBuilder/builderReport.ts +74 -0
  148. package/src/components/DashboardBuilder/catalog.spec.ts +0 -44
  149. package/src/components/DashboardBuilder/catalog.ts +0 -36
  150. package/src/components/DashboardBuilder/controls.spec.ts +1 -1
  151. package/src/components/DashboardBuilder/controls.ts +1 -1
  152. package/src/components/DashboardBuilder/documentSession.ts +3 -2
  153. package/src/components/DashboardBuilder/imports.spec.ts +61 -0
  154. package/src/components/DashboardBuilder/imports.ts +93 -0
  155. package/src/components/DashboardBuilder/inlineEdit.tsx +78 -0
  156. package/src/components/DashboardBuilder/legacyNotebook.ts +1 -1
  157. package/src/components/DashboardBuilder/malloyTree.ts +5 -1
  158. package/src/components/DashboardBuilder/newDashboard.ts +1 -1
  159. package/src/components/DashboardBuilder/preview.ts +1 -1
  160. package/src/components/DashboardBuilder/readDocument.spec.ts +36 -0
  161. package/src/components/DashboardBuilder/readDocument.ts +10 -4
  162. package/src/components/DashboardBuilder/readForEditor.ts +7 -2
  163. package/src/components/DashboardBuilder/sortable.spec.ts +25 -1
  164. package/src/components/DashboardBuilder/sortable.tsx +11 -0
  165. package/src/components/DashboardBuilder/spliceDocument.ts +8 -3
  166. package/src/components/DashboardBuilder/testing/artifactTagParity.json +62 -6
  167. package/src/components/DashboardBuilder/testing/documentKindRule.json +40 -0
  168. package/src/components/DashboardBuilder/testing/inline.ts +1 -1
  169. package/src/components/DashboardBuilder/testing/resize.ts +48 -0
  170. package/src/components/DashboardBuilder/testing/urlRenderTags.json +62 -0
  171. package/src/components/DashboardBuilder/textTiles.spec.ts +43 -1
  172. package/src/components/DashboardBuilder/tileDisplayTitle.ts +13 -0
  173. package/src/components/DashboardBuilder/useBuilderSelection.ts +121 -0
  174. package/src/components/DashboardBuilder/useBuilderSession.spec.ts +0 -85
  175. package/src/components/DashboardBuilder/useBuilderSession.ts +6 -43
  176. package/src/components/DashboardBuilder/useBuilderShortcuts.overlay.spec.tsx +32 -0
  177. package/src/components/DashboardBuilder/useBuilderShortcuts.ts +11 -1
  178. package/src/components/DashboardBuilder/useControlBindings.ts +152 -0
  179. package/src/components/DashboardBuilder/useConversionConfirm.ts +55 -0
  180. package/src/components/DashboardBuilder/useDashboardEditor.ts +5 -2
  181. package/src/components/DashboardBuilder/useDraft.ts +15 -2
  182. package/src/components/DashboardBuilder/useHostCopy.ts +104 -0
  183. package/src/components/DashboardBuilder/useOpenDraftCommit.ts +47 -0
  184. package/src/components/DashboardBuilder/useOpenedDocument.ts +314 -0
  185. package/src/components/DashboardBuilder/useSaveChannel.ts +275 -0
  186. package/src/components/DashboardBuilder/useTileEditing.ts +141 -0
  187. package/src/components/DashboardBuilder/useTileResize.spec.tsx +146 -0
  188. package/src/components/DashboardBuilder/useTileResize.ts +133 -0
  189. package/src/components/DataAppViewer/DataAppViewer.tsx +7 -4
  190. package/src/components/DocumentCreate/guards.ts +1 -1
  191. package/src/components/Environment/Environment.tsx +0 -10
  192. package/src/components/Loading.tsx +14 -0
  193. package/src/components/Model/Model.tsx +16 -9
  194. package/src/components/Model/ModelExplorer.tsx +2 -2
  195. package/src/components/Notebook/Notebook.tsx +6 -2
  196. package/src/components/Notebook/NotebookCell.tsx +90 -215
  197. package/src/components/Package/Package.artifacts.spec.tsx +8 -12
  198. package/src/components/Package/Package.create.spec.tsx +22 -1
  199. package/src/components/Package/Package.tsx +51 -27
  200. package/src/components/Package/index.ts +1 -1
  201. package/src/components/Prose.spec.tsx +37 -0
  202. package/src/components/Prose.tsx +35 -5
  203. package/src/components/RenderedResult/RenderedResult.tsx +5 -7
  204. package/src/components/RenderedResult/ResultContainer.tsx +7 -2
  205. package/src/components/RenderedResult/ResultPanel.tsx +20 -5
  206. package/src/components/RenderedResult/loadRenderer.ts +42 -0
  207. package/src/components/given/GivenInput.spec.tsx +5 -5
  208. package/src/components/given/GivenInput.tsx +46 -38
  209. package/src/components/given/GivensPanel.tsx +2 -8
  210. package/src/components/given/paramCodec.ts +27 -1
  211. package/src/components/index.ts +1 -2
  212. package/src/components/styles.ts +4 -5
  213. package/src/hooks/givenValue.ts +9 -0
  214. package/src/hooks/index.ts +4 -0
  215. package/src/hooks/useCompiledDocument.spec.tsx +86 -0
  216. package/src/hooks/useCompiledDocument.ts +59 -0
  217. package/src/hooks/useDimensionalFilterRangeData.ts +3 -1
  218. package/src/hooks/useDocumentControls.ts +13 -1
  219. package/src/hooks/useNearViewport.spec.tsx +150 -0
  220. package/src/hooks/useNearViewport.ts +102 -0
  221. package/src/hooks/useQueryResult.ts +7 -1
  222. package/src/hooks/useQueryWithApiError.ts +10 -3
  223. package/src/hooks/useRawQueryData.ts +3 -1
  224. package/src/hooks/useSuggestOptions.dom.spec.ts +40 -1
  225. package/src/hooks/useSuggestOptions.ts +42 -10
  226. package/src/text-entry.ts +1 -1
  227. package/src/textEntry.spec.ts +2 -8
  228. package/src/theme/accent.spec.ts +116 -0
  229. package/src/theme/accent.ts +148 -0
  230. package/src/theme/buildTableCssVars.spec.ts +24 -0
  231. package/src/theme/buildTableCssVars.ts +1 -2
  232. package/src/theme/buildVegaThemeOverride.spec.ts +38 -2
  233. package/src/theme/buildVegaThemeOverride.ts +5 -5
  234. package/src/theme/defaults.ts +34 -0
  235. package/src/theme/index.ts +9 -0
  236. package/src/theme/keys.ts +6 -0
  237. package/src/theme/motion.ts +44 -0
  238. package/src/theme/readChartAnnotations.spec.ts +18 -0
  239. package/src/theme/readChartAnnotations.ts +1 -1
  240. package/src/theme/resolveTheme.spec.ts +73 -0
  241. package/src/theme/resolveTheme.ts +61 -20
  242. package/src/theme/types.ts +30 -5
  243. package/src/utils/queryClient.ts +8 -0
  244. package/dist/DashboardTile-sg8LjUk8.cjs.js +0 -137
  245. package/dist/ServerProvider-HRqT3w1C.cjs.js +0 -1
  246. package/dist/components/Dashboard/DashboardBar.d.ts +0 -21
  247. package/dist/components/Dashboard/ExploreDialog.d.ts +0 -20
  248. package/dist/components/DashboardBuilder/DiffDialog.d.ts +0 -7
  249. package/dist/components/DashboardBuilder/SaveNotice.d.ts +0 -27
  250. package/dist/components/DashboardBuilder/SettingsPopover.d.ts +0 -32
  251. package/dist/components/DashboardBuilder/diff.d.ts +0 -35
  252. package/src/components/Dashboard/DashboardBar.tsx +0 -88
  253. package/src/components/Dashboard/ExploreDialog.tsx +0 -89
  254. package/src/components/DashboardBuilder/DashboardBuilder.notice.spec.tsx +0 -194
  255. package/src/components/DashboardBuilder/DiffDialog.spec.tsx +0 -25
  256. package/src/components/DashboardBuilder/DiffDialog.tsx +0 -103
  257. package/src/components/DashboardBuilder/SaveNotice.tsx +0 -113
  258. package/src/components/DashboardBuilder/SettingsPopover.spec.tsx +0 -87
  259. package/src/components/DashboardBuilder/SettingsPopover.tsx +0 -326
  260. package/src/components/DashboardBuilder/diff.spec.ts +0 -44
  261. package/src/components/DashboardBuilder/diff.ts +0 -93
  262. /package/dist/{components/DashboardBuilder → utils}/malloyText.d.ts +0 -0
  263. /package/src/{components/DashboardBuilder → utils}/malloyText.spec.ts +0 -0
  264. /package/src/{components/DashboardBuilder → utils}/malloyText.ts +0 -0
@@ -1,88 +1,88 @@
1
- import { jsx as I } from "react/jsx-runtime";
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, b as we, a as ke, m as xe, c as Ce, d as le } from "./DashboardTile-BFcxdv7R.es.js";
5
- import { aI as Re, aJ as Ee, aK as Se } from "./ServerProvider-DCV8BUWD.es.js";
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 Ae(e, r) {
7
+ function Te(e, r) {
8
8
  const t = /* @__PURE__ */ new Set();
9
- let o;
9
+ let l;
10
10
  try {
11
- o = e.getMetadata()?.getAllFields() ?? [];
11
+ l = e.getMetadata()?.getAllFields() ?? [];
12
12
  } catch {
13
13
  return t;
14
14
  }
15
- const n = /* @__PURE__ */ new Set();
16
- for (const a of o)
17
- !a || r(a) || a.tag?.tag("hidden") === void 0 && n.add(a.tag?.text("label") ?? a.name);
18
- for (const a of o) {
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 l = a.tag?.text("label") ?? a.name;
21
- n.has(l) || t.add(l);
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 M(e) {
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 Te(e, r) {
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 o = (l) => l.closest(".malloy-table") === t, n = /* @__PURE__ */ new Set();
35
- for (const l of t.querySelectorAll(
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 (!o(l)) continue;
39
- const s = (l.textContent ?? "").replace(/\u200b/g, "").trim(), b = M(l);
40
- b && r.has(s) && n.add(b);
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 (n.size === 0) continue;
42
+ if (o.size === 0) continue;
43
43
  const a = /* @__PURE__ */ new Set();
44
- for (const l of t.querySelectorAll(
44
+ for (const n of t.querySelectorAll(
45
45
  `.${g}[tabindex="0"]`
46
46
  )) {
47
- if (!o(l)) continue;
48
- const s = M(l);
49
- s && (a.has(s) ? l.tabIndex = -1 : a.add(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 l of t.querySelectorAll(
51
+ for (const n of t.querySelectorAll(
52
52
  ".column-cell.td"
53
53
  )) {
54
- if (!o(l)) continue;
55
- const s = M(l), b = !l.querySelector(".value-null") && (l.textContent ?? "").trim() !== "";
56
- if (s && b && n.has(s) && !l.querySelector(".malloy-table")) {
57
- if (l.classList.add(g), l.tabIndex === 0)
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), l.tabIndex = y ? -1 : 0;
61
+ y || a.add(s), n.tabIndex = y ? -1 : 0;
62
62
  }
63
- l.setAttribute("role", "button");
63
+ n.setAttribute("role", "button");
64
64
  }
65
65
  }
66
66
  }
67
67
  }
68
- function De(e) {
69
- const r = e.closest(".malloy-table"), t = M(e);
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
- (o) => o.closest(".malloy-table") === r && M(o) === t
73
+ (l) => l.closest(".malloy-table") === r && I(l) === t
74
74
  );
75
75
  }
76
76
  function ie(e, r) {
77
- const t = De(e), o = t.indexOf(e);
78
- if (o === -1) return;
79
- const n = r === "first" ? t[0] : r === "last" ? t[t.length - 1] : t[Math.min(Math.max(o + r, 0), t.length - 1)];
80
- if (n) {
81
- for (const a of t) a.tabIndex = a === n ? 0 : -1;
82
- return n;
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 Oe(e) {
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 _e(e) {
108
- const { foreground: r, axisFaint: t, font: o } = e, n = {
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: t,
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 (a) => n;
130
+ return (n) => a;
131
131
  }
132
- function Fe(e) {
132
+ function ze(e) {
133
133
  if (!e) return;
134
134
  const r = e.tag("theme");
135
135
  if (!r) return;
136
- const t = {}, o = r.tag("palette");
137
- if (o) {
138
- const a = {}, l = o.textArray("series");
139
- l && l.length > 0 && (a.series = l);
140
- for (const s of Re) {
141
- const b = o.tag(s);
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 n = r.tag("font");
149
- if (n) {
150
- const a = {}, l = n.text("family");
151
- l && (a.family = l);
152
- const s = n.numeric("size");
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 L = "data-publisher-fill", ze = async (e, r) => {
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 import("@malloydata/render");
160
+ const { MalloyRenderer: t } = await we();
161
161
  return new t({
162
162
  onClick: r,
163
- vegaConfigOverride: _e(e),
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: Oe(e),
170
- onError: (n) => {
171
- console.error("Error rendering visualization:", typeof n, n);
169
+ theme: _e(e),
170
+ onError: (o) => {
171
+ console.error("Error rendering visualization:", typeof o, o);
172
172
  }
173
173
  }).createViz();
174
174
  };
175
- typeof window < "u" && import("@malloydata/render");
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((n) => typeof n?.value == "string" ? n.value : void 0).filter((n) => !!n);
181
+ ].map((o) => typeof o?.value == "string" ? o.value : void 0).filter((o) => !!o);
183
182
  if (t.length === 0) return;
184
- let o;
183
+ let l;
185
184
  try {
186
- ({ parseAnnotation: o } = await ve());
185
+ ({ parseAnnotation: l } = await ve());
187
186
  } catch {
188
187
  return;
189
188
  }
190
189
  try {
191
- const { tag: n } = o(t);
192
- return Fe(n);
193
- } catch (n) {
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: n, lines: t }
195
+ { error: o, lines: t }
197
196
  );
198
197
  return;
199
198
  }
200
199
  }
201
- function Le(e, r, t) {
202
- const o = we(r, t);
203
- for (const [n, a] of Object.entries(o))
204
- e.style.setProperty(n, a);
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 Me = `
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
- [${L}] .malloy-table.root {
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 Be() {
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 = Me, document.head.appendChild(e);
349
+ e.id = se, e.textContent = Be, document.head.appendChild(e);
351
350
  }
352
- function Ne({
351
+ function $e({
353
352
  result: e,
354
353
  height: r,
355
354
  drill: t,
356
- onSizeChange: o,
357
- onSizing: n,
355
+ onSizeChange: l,
356
+ onSizing: o,
358
357
  fill: a
359
358
  }) {
360
- const l = z(null), s = z(t);
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: J, layers: X, mode: Y } = Ee(), W = he().shape.borderRadius, Q = fe(
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 (!l.current || !e) return;
379
- Be();
380
- const c = l.current, de = P.current += 1;
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 _ = ke(p, R);
387
+ const _ = xe(p, R);
389
388
  if (k.current && !_) return;
390
- const F = c.hasAttribute(L);
391
- F && c.removeAttribute(L);
392
- const E = xe(
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(L, ""), E > 0 && (k.current = !0, o && E !== ee && (ee = E, o(E)));
397
- const u = Ce(w, le(p));
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 Ie(w), F = _ ? Se([...X, _], Y) : J;
407
+ const _ = await Me(w), F = _ ? Ae([...Y, _], J) : X;
409
408
  if (!q()) return;
410
409
  try {
411
- h = await ze(F, b);
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%", Le(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);
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
- n?.(U(p, R)), d.dataset.malloyRenderAs = p ?? "unknown", d.dataset.malloySizing = U(p, R), h.render(d);
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 = Ae(h, f.canDrill), S = () => {
453
+ const x = Te(h, f.canDrill), S = () => {
455
454
  try {
456
- Te(u, x);
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__ */ I(
518
+ ]), /* @__PURE__ */ L(
520
519
  "div",
521
520
  {
522
- ref: l,
523
- ...a ? { [L]: "" } : {},
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 $e(e) {
532
- return typeof window > "u" ? /* @__PURE__ */ I(
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__ */ I(
544
+ ) : /* @__PURE__ */ L(
546
545
  me,
547
546
  {
548
- fallback: /* @__PURE__ */ I(
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__ */ I(Ne, { ...e })
561
+ children: /* @__PURE__ */ L($e, { ...e })
563
562
  }
564
563
  );
565
564
  }
566
- const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
565
+ const Ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
567
566
  __proto__: null,
568
- default: $e
567
+ default: je
569
568
  }, Symbol.toStringTag, { value: "Module" }));
570
569
  export {
571
570
  g as D,
572
- $e as R,
573
- _e as a,
574
- Oe as b,
575
- Ke as c,
576
- Ae as d,
577
- Te as m,
578
- Fe as r
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";var we=Object.create;var ie=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var Re=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var Ee=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of xe(r))!Ce.call(e,o)&&o!==t&&ie(e,o,{get:()=>r[o],enumerable:!(a=ke(r,o))||a.enumerable});return e};var se=(e,r,t)=>(t=e!=null?we(Re(e)):{},Ee(r||!e||!e.__esModule?ie(t,"default",{value:e,enumerable:!0}):t,e));const I=require("react/jsx-runtime"),X=require("@mui/material"),p=require("react"),y=require("./DashboardTile-sg8LjUk8.cjs.js"),Y=require("./ServerProvider-HRqT3w1C.cjs.js"),g="publisher-drill";function ue(e,r){const t=new Set;let a;try{a=e.getMetadata()?.getAllFields()??[]}catch{return t}const o=new Set;for(const n of a)!n||r(n)||n.tag?.tag("hidden")===void 0&&o.add(n.tag?.text("label")??n.name);for(const n of a){if(!n||!r(n))continue;const l=n.tag?.text("label")??n.name;o.has(l)||t.add(l)}return t}function B(e){const r=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return r?r[1]:void 0}function he(e,r){if(r.size!==0)for(const t of e.querySelectorAll(".malloy-table")){const a=l=>l.closest(".malloy-table")===t,o=new Set;for(const l of t.querySelectorAll(".column-cell.th")){if(!a(l))continue;const s=(l.textContent??"").replace(/\u200b/g,"").trim(),b=B(l);b&&r.has(s)&&o.add(b)}if(o.size===0)continue;const n=new Set;for(const l of t.querySelectorAll(`.${g}[tabindex="0"]`)){if(!a(l))continue;const s=B(l);s&&(n.has(s)?l.tabIndex=-1:n.add(s))}for(const l of t.querySelectorAll(".column-cell.td")){if(!a(l))continue;const s=B(l),b=!l.querySelector(".value-null")&&(l.textContent??"").trim()!=="";if(s&&b&&o.has(s)&&!l.querySelector(".malloy-table")){if(l.classList.add(g),l.tabIndex===0)n.add(s);else{const v=n.has(s);v||n.add(s),l.tabIndex=v?-1:0}l.setAttribute("role","button")}}}}function Se(e){const r=e.closest(".malloy-table"),t=B(e);return!r||!t?[]:Array.from(r.querySelectorAll(`.${g}`)).filter(a=>a.closest(".malloy-table")===r&&B(a)===t)}function de(e,r){const t=Se(e),a=t.indexOf(e);if(a===-1)return;const o=r==="first"?t[0]:r==="last"?t[t.length-1]:t[Math.min(Math.max(a+r,0),t.length-1)];if(o){for(const n of t)n.tabIndex=n===o?0:-1;return o}}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:r,axisFaint:t,font:a}=e,o={background:e.background,font:a.family,title:{color:r,font:a.family},axis:{labelColor:r,titleColor:r,domainColor:t,tickColor:t,gridColor:t,labelFont:a.family,titleFont:a.family},legend:{labelColor:r,titleColor:r,labelFont:a.family,titleFont:a.family},header:{labelColor:r,titleColor:r},range:{category:e.series}};return n=>o}function fe(e){if(!e)return;const r=e.tag("theme");if(!r)return;const t={},a=r.tag("palette");if(a){const n={},l=a.textArray("series");l&&l.length>0&&(n.series=l);for(const s of Y.PER_MODE_COLOR_KEYS){const b=a.tag(s);if(!b)continue;const v={},R=b.text("light"),k=b.text("dark");R&&(v.light=R),k&&(v.dark=k),Object.keys(v).length>0&&(n[s]=v)}Object.keys(n).length>0&&(t.palette=n)}const o=r.tag("font");if(o){const n={},l=o.text("family");l&&(n.family=l);const s=o.numeric("size");typeof s=="number"&&Number.isFinite(s)&&(n.size=s),Object.keys(n).length>0&&(t.font=n)}return Object.keys(t).length>0?t:void 0}const M="data-publisher-fill",Ae=async(e,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:t}=await import("@malloydata/render");return new t({onClick:r,vegaConfigOverride:be(e),theme:me(e),onError:o=>{console.error("Error rendering visualization:",typeof o,o)}}).createViz()};typeof window<"u"&&import("@malloydata/render");async function Te(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 a;try{({parseAnnotation:a}=await y.loadMalloyTag())}catch{return}try{const{tag:o}=a(t);return fe(o)}catch(o){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:o,lines:t});return}}function De(e,r,t){const a=y.buildTableCssVars(r,t);for(const[o,n]of Object.entries(a))e.style.setProperty(o,n)}const Oe=`
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
- `,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=Oe,document.head.appendChild(e)}function _e({result:e,height:r,drill:t,onSizeChange:a,onSizing:o,fill:n}){const l=p.useRef(null),s=p.useRef(t);s.current=t;const b=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:`${y.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(!l.current||!e)return;Le();const c=l.current,pe=P.current+=1;let V=!1;const H=()=>!V&&pe===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||y.resultSizing(w,S)==="container")return;const z=y.remeasuresAfterReady(w,S);if(R.current&&!z)return;const F=c.hasAttribute(M);F&&c.removeAttribute(M);const A=y.measureContentHeight(x,y.contentNodeDepth(w));F&&c.setAttribute(M,""),A>0&&(R.current=!0,a&&A!==te&&(te=A,a(A)));const u=y.contentNode(x,y.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(f){console.error("Error parsing visualization result:",f);return}const z=await Te(x),F=z?Y.resolveTheme([...W,z],Q):J;if(!H())return;try{h=await Ae(F,b)}catch(f){console.error("Failed to create renderer:",f);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%",De(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 ge=h;let oe=!1;const ae=()=>{if(!(oe||!H())){oe=!0,E&&(clearTimeout(E),E=null),A?.viz.remove();for(const f of Array.from(c.children))f!==u&&c.removeChild(f);u.style.position="",u.style.inset="",u.style.visibility="",c.style.position="",k.current={viz:ge,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?.(y.resultSizing(w,S)),d.dataset.malloyRenderAs=w??"unknown",d.dataset.malloySizing=y.resultSizing(w,S),h.render(d);const f=s.current;try{if(f){const C=ue(h,f.canDrill),T=()=>{try{he(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,ve=(i,m)=>{de(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(),ve(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&&de(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(f){console.error("Error rendering visualization:",f),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,b,v,a,o,J,W,Q,ee]),I.jsx("div",{ref:l,...n?{[M]:""}:{},style:{width:"100%",height:r?`${r}px`:"400px"}})}function ye(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(_e,{...e})})}const ze=Object.freeze(Object.defineProperty({__proto__:null,default:ye},Symbol.toStringTag,{value:"Module"}));exports.DRILL_CELL_CLASS=g;exports.RenderedResult=ye;exports.RenderedResult$1=ze;exports.buildMalloyExplicitTheme=me;exports.buildVegaThemeOverride=be;exports.drillableFieldNames=ue;exports.markDrillableCells=he;exports.readChartAnnotations=fe;
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;