@malloy-publisher/sdk 0.9.10 → 0.9.11
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-BlNoIiSi.cjs.js +153 -0
- package/dist/{RenderedResult-Dp1Qdajz.es.js → RenderedResult-Cmx8sX8d.es.js} +102 -102
- package/dist/ServerProvider-BOgiW8MX.cjs.js +1 -0
- package/dist/{ServerProvider-CQy4jVYK.es.js → ServerProvider-azXLkk1q.es.js} +619 -586
- package/dist/builder/index.cjs.js +78 -130
- package/dist/builder/index.es.js +7493 -6769
- package/dist/builder-entry.d.ts +3 -0
- package/dist/client/api.d.ts +26 -22
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/AppDialog.d.ts +9 -1
- package/dist/components/Dashboard/DashboardGrid.d.ts +14 -15
- package/dist/components/Dashboard/DashboardTile.d.ts +8 -1
- package/dist/components/Dashboard/DashboardView.d.ts +22 -34
- package/dist/components/Dashboard/TileCard.d.ts +10 -3
- package/dist/components/Dashboard/useStuck.d.ts +15 -7
- package/dist/components/DocumentCreate/useDocumentChoices.d.ts +6 -0
- package/dist/components/Package/PackageProblems.d.ts +14 -0
- package/dist/components/RemoveBadge.d.ts +40 -0
- package/dist/components/Report/Report.d.ts +13 -4
- package/dist/components/Report/ReportPage.d.ts +60 -0
- package/dist/components/Report/layoutRules.d.ts +32 -0
- package/dist/components/Report/reportQuery.d.ts +30 -0
- package/dist/components/Report/telemetry.d.ts +0 -2
- package/dist/components/ReportBuilder/AddTileDialog.d.ts +22 -3
- package/dist/components/ReportBuilder/BuilderBar.d.ts +17 -0
- package/dist/components/ReportBuilder/BuilderDialogs.d.ts +7 -6
- package/dist/components/ReportBuilder/BuilderGrid.d.ts +10 -4
- package/dist/components/ReportBuilder/BuilderHeader.d.ts +4 -7
- package/dist/components/ReportBuilder/BuilderToolbar.d.ts +88 -0
- package/dist/components/ReportBuilder/DrillDialog.d.ts +3 -1
- package/dist/components/ReportBuilder/EditorSurface.d.ts +7 -9
- package/dist/components/ReportBuilder/FilterDialog.d.ts +3 -1
- package/dist/components/ReportBuilder/FilterStrip.d.ts +30 -8
- package/dist/components/ReportBuilder/InlineMarkdown.d.ts +4 -4
- package/dist/components/ReportBuilder/ReportBuilder.d.ts +49 -12
- package/dist/components/ReportBuilder/ReportEditor.d.ts +53 -3
- package/dist/components/ReportBuilder/TextTileBody.d.ts +2 -5
- package/dist/components/ReportBuilder/TileFrame.d.ts +10 -4
- package/dist/components/ReportBuilder/TileMenu.d.ts +12 -9
- package/dist/components/ReportBuilder/ViewPicker.d.ts +53 -0
- package/dist/components/ReportBuilder/addTileToDocument.d.ts +24 -3
- package/dist/components/ReportBuilder/builderControls.d.ts +60 -0
- package/dist/components/ReportBuilder/catalog.d.ts +2 -4
- package/dist/components/ReportBuilder/inlineEdit.d.ts +9 -10
- package/dist/components/ReportBuilder/localGiven.d.ts +12 -0
- package/dist/components/ReportBuilder/preview.d.ts +17 -2
- package/dist/components/ReportBuilder/readDocument.d.ts +0 -2
- package/dist/components/ReportBuilder/readForEditor.d.ts +2 -7
- package/dist/components/ReportBuilder/reportTag.d.ts +11 -1
- package/dist/components/ReportBuilder/sortable.d.ts +4 -3
- package/dist/components/ReportBuilder/testing/inline.d.ts +5 -1
- package/dist/components/ReportBuilder/useBuilderSelection.d.ts +0 -1
- package/dist/components/ReportBuilder/useBuilderSession.d.ts +21 -12
- package/dist/components/ReportBuilder/useDocumentEditor.d.ts +2 -6
- package/dist/components/ReportBuilder/useExitGuard.d.ts +3 -0
- package/dist/components/ReportBuilder/useFilterForm.d.ts +3 -1
- package/dist/components/ReportBuilder/useOpenedDocument.d.ts +0 -4
- package/dist/components/ReportBuilder/useReportDraft.d.ts +66 -0
- package/dist/components/ReportBuilder/useReportEditor.d.ts +0 -9
- package/dist/components/ReportBuilder/useTileEditing.d.ts +6 -3
- package/dist/components/ReportBuilder/viewAnnotations.d.ts +9 -0
- package/dist/components/ReportBuilder/widthLabel.d.ts +6 -0
- package/dist/components/ServerProvider.d.ts +9 -0
- package/dist/components/controlTokens.d.ts +45 -0
- package/dist/components/drill/markDrillableCells.d.ts +1 -1
- package/dist/components/given/FilterButton.d.ts +35 -0
- package/dist/components/given/GivensPanel.d.ts +2 -1
- package/dist/components/given/filterEditing.d.ts +54 -0
- package/dist/components/given/filterSummary.d.ts +9 -0
- package/dist/components/given/paramCodec.d.ts +11 -0
- package/dist/components/given/required.d.ts +25 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/legacy/index.d.ts +1 -1
- package/dist/components/{Report/CellReport.d.ts → legacy/malloynb/CellRunnerView.d.ts} +9 -17
- package/dist/components/legacy/{MalloynbCells.d.ts → malloynb/MalloynbCells.d.ts} +3 -3
- package/dist/components/legacy/{Notebook.d.ts → malloynb/Notebook.d.ts} +1 -1
- package/dist/components/{Notebook → legacy/malloynb}/NotebookCell.d.ts +3 -3
- package/dist/components/legacy/malloynb/cellKind.d.ts +5 -0
- package/dist/components/{Notebook → legacy/malloynb}/types.d.ts +1 -1
- package/dist/components/styles.d.ts +0 -2
- package/dist/hooks/useQueryResult.d.ts +7 -0
- package/dist/index.cjs.js +16 -19
- package/dist/index.es.js +8324 -7769
- package/dist/theme/ThemeContext.d.ts +8 -1
- package/dist/theme/classes.d.ts +49 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/types.d.ts +7 -0
- package/dist/theme/ui.d.ts +75 -0
- package/dist/{useCompiledDocument-BMPDvdFx.es.js → useCompiledDocument-7j5cBjQd.es.js} +8669 -7851
- package/dist/useCompiledDocument-B21sVbb4.cjs.js +141 -0
- package/package.json +2 -2
- package/src/builder-entry.ts +9 -0
- package/src/components/AppDialog.tsx +23 -0
- package/src/components/Dashboard/DashboardGrid.tsx +39 -17
- package/src/components/Dashboard/DashboardTile.tsx +19 -2
- package/src/components/Dashboard/DashboardView.spec.tsx +216 -15
- package/src/components/Dashboard/DashboardView.tsx +137 -155
- package/src/components/Dashboard/RowsDialog.tsx +1 -2
- package/src/components/Dashboard/TileCard.tsx +28 -10
- package/src/components/Dashboard/defaultTileSpan.spec.ts +24 -0
- package/src/components/Dashboard/useStuck.ts +28 -17
- package/src/components/DocumentCreate/useDocumentChoices.ts +19 -2
- package/src/components/Package/NewDocumentDialog.spec.tsx +76 -59
- package/src/components/Package/NewDocumentDialog.tsx +383 -119
- package/src/components/Package/Package.artifacts.spec.tsx +1 -1
- package/src/components/Package/Package.create.spec.tsx +7 -6
- package/src/components/Package/Package.tsx +10 -7
- package/src/components/Package/PackageProblems.spec.tsx +41 -0
- package/src/components/Package/PackageProblems.tsx +95 -0
- package/src/components/Prose.tsx +12 -7
- package/src/components/RemoveBadge.tsx +94 -0
- package/src/components/RenderedResult/RenderedResult.tsx +5 -9
- package/src/components/RenderedResult/ResultPanel.tsx +59 -3
- package/src/components/Report/Report.spec.tsx +50 -32
- package/src/components/Report/Report.telemetry.spec.tsx +0 -45
- package/src/components/Report/Report.tsx +45 -77
- package/src/components/Report/ReportPage.tsx +168 -0
- package/src/components/Report/layoutRules.spec.ts +35 -0
- package/src/components/Report/layoutRules.ts +55 -0
- package/src/components/Report/reportQuery.ts +53 -0
- package/src/components/Report/telemetry.ts +0 -2
- package/src/components/ReportBuilder/AddTileDialog.spec.tsx +76 -41
- package/src/components/ReportBuilder/AddTileDialog.tsx +368 -133
- package/src/components/ReportBuilder/BuilderBar.tsx +599 -0
- package/src/components/ReportBuilder/BuilderDialogs.tsx +28 -39
- package/src/components/ReportBuilder/BuilderGrid.tsx +31 -29
- package/src/components/ReportBuilder/BuilderHeader.tsx +63 -75
- package/src/components/ReportBuilder/BuilderToolbar.tsx +95 -9
- package/src/components/ReportBuilder/DrillDialog.tsx +240 -128
- package/src/components/ReportBuilder/EditorSurface.tsx +345 -69
- package/src/components/ReportBuilder/FilterDialog.tsx +516 -166
- package/src/components/ReportBuilder/FilterStrip.tsx +130 -151
- package/src/components/ReportBuilder/InlineMarkdown.tsx +71 -45
- package/src/components/ReportBuilder/ReportBuilder.charts.spec.tsx +35 -40
- package/src/components/ReportBuilder/ReportBuilder.controls.spec.tsx +491 -0
- package/src/components/ReportBuilder/ReportBuilder.exit.spec.tsx +2 -4
- package/src/components/ReportBuilder/ReportBuilder.inline.spec.tsx +13 -15
- package/src/components/ReportBuilder/ReportBuilder.notebook.spec.tsx +27 -118
- package/src/components/ReportBuilder/ReportBuilder.openDraft.spec.tsx +12 -5
- package/src/components/ReportBuilder/ReportBuilder.sources.spec.tsx +2 -10
- package/src/components/ReportBuilder/ReportBuilder.spec.tsx +37 -31
- package/src/components/ReportBuilder/ReportBuilder.textTiles.spec.tsx +22 -15
- package/src/components/ReportBuilder/ReportBuilder.tsx +292 -117
- package/src/components/ReportBuilder/ReportEditor.emptyStart.spec.tsx +2 -1
- package/src/components/ReportBuilder/ReportEditor.modelFilters.spec.tsx +312 -0
- package/src/components/ReportBuilder/ReportEditor.notebook.spec.tsx +26 -75
- package/src/components/ReportBuilder/ReportEditor.package.spec.tsx +6 -2
- package/src/components/ReportBuilder/ReportEditor.resourceUri.spec.tsx +3 -2
- package/src/components/ReportBuilder/ReportEditor.spec.tsx +2 -4
- package/src/components/ReportBuilder/ReportEditor.textSource.spec.tsx +93 -13
- package/src/components/ReportBuilder/ReportEditor.tsx +104 -14
- package/src/components/ReportBuilder/TextTileBody.tsx +6 -7
- package/src/components/ReportBuilder/TileFrame.tsx +212 -75
- package/src/components/ReportBuilder/TileMenu.tsx +241 -140
- package/src/components/ReportBuilder/ViewPicker.tsx +349 -0
- package/src/components/ReportBuilder/addTile.compile.spec.ts +1 -1
- package/src/components/ReportBuilder/addTileToDocument.spec.ts +102 -3
- package/src/components/ReportBuilder/addTileToDocument.ts +122 -25
- package/src/components/ReportBuilder/builderControls.ts +164 -0
- package/src/components/ReportBuilder/builderReport.ts +1 -2
- package/src/components/ReportBuilder/catalog.ts +10 -26
- package/src/components/ReportBuilder/inlineEdit.tsx +22 -54
- package/src/components/ReportBuilder/localGiven.ts +56 -0
- package/src/components/ReportBuilder/preview.spec.ts +125 -5
- package/src/components/ReportBuilder/preview.ts +60 -44
- package/src/components/ReportBuilder/readDocument.spec.ts +16 -22
- package/src/components/ReportBuilder/readDocument.ts +14 -11
- package/src/components/ReportBuilder/readForEditor.spec.ts +12 -41
- package/src/components/ReportBuilder/readForEditor.ts +4 -26
- package/src/components/ReportBuilder/reportTag.ts +28 -7
- package/src/components/ReportBuilder/sortable.tsx +15 -7
- package/src/components/ReportBuilder/spliceDocument.imports.spec.ts +1 -1
- package/src/components/ReportBuilder/tagParse.spec.ts +0 -40
- package/src/components/ReportBuilder/testing/inline.ts +25 -5
- package/src/components/ReportBuilder/testing/reportLayoutParity.json +13 -8
- package/src/components/ReportBuilder/textTiles.spec.ts +7 -6
- package/src/components/ReportBuilder/useBuilderSelection.ts +35 -0
- package/src/components/ReportBuilder/useBuilderSession.spec.ts +2 -2
- package/src/components/ReportBuilder/useBuilderSession.ts +21 -13
- package/src/components/ReportBuilder/useDocumentEditor.spec.ts +0 -58
- package/src/components/ReportBuilder/useDocumentEditor.ts +3 -16
- package/src/components/ReportBuilder/useEditorCatalog.spec.tsx +26 -0
- package/src/components/ReportBuilder/useEditorCatalog.ts +7 -2
- package/src/components/ReportBuilder/useExitGuard.ts +16 -0
- package/src/components/ReportBuilder/useFilterForm.spec.tsx +17 -0
- package/src/components/ReportBuilder/useFilterForm.ts +5 -1
- package/src/components/ReportBuilder/useOpenedDocument.ts +0 -2
- package/src/components/ReportBuilder/useReportDraft.spec.ts +149 -0
- package/src/components/ReportBuilder/useReportDraft.ts +292 -0
- package/src/components/ReportBuilder/useReportEditor.ts +3 -12
- package/src/components/ReportBuilder/useSaveChannel.ts +0 -1
- package/src/components/ReportBuilder/useTileEditing.ts +43 -12
- package/src/components/ReportBuilder/viewAnnotations.ts +29 -0
- package/src/components/ReportBuilder/widthLabel.spec.ts +25 -0
- package/src/components/ReportBuilder/widthLabel.ts +26 -0
- package/src/components/ServerProvider.tsx +11 -0
- package/src/components/controlTokens.ts +47 -0
- package/src/components/drill/markDrillableCells.ts +2 -1
- package/src/components/given/FilterButton.spec.tsx +143 -0
- package/src/components/given/FilterButton.tsx +478 -0
- package/src/components/given/GivenInput.spec.tsx +47 -0
- package/src/components/given/GivenInput.tsx +20 -2
- package/src/components/given/GivensPanel.spec.tsx +11 -3
- package/src/components/given/GivensPanel.tsx +45 -44
- package/src/components/given/filterEditing.ts +60 -0
- package/src/components/given/filterSummary.spec.ts +108 -0
- package/src/components/given/filterSummary.ts +109 -0
- package/src/components/given/paramCodec.ts +1 -1
- package/src/components/given/required.spec.ts +60 -0
- package/src/components/given/required.ts +78 -0
- package/src/components/index.ts +9 -0
- package/src/components/legacy/Dashboard.spec.tsx +3 -1
- package/src/components/legacy/index.ts +1 -1
- package/src/components/{Report/CellReport.spec.tsx → legacy/malloynb/CellRunnerView.spec.tsx} +53 -57
- package/src/components/{Report/CellReport.tsx → legacy/malloynb/CellRunnerView.tsx} +122 -136
- package/src/components/legacy/{MalloynbCells.tsx → malloynb/MalloynbCells.tsx} +6 -6
- package/src/components/legacy/{Notebook.layout.spec.tsx → malloynb/Notebook.layout.spec.tsx} +16 -7
- package/src/components/legacy/malloynb/Notebook.served.spec.tsx +84 -0
- package/src/components/legacy/{Notebook.spec.tsx → malloynb/Notebook.spec.tsx} +5 -3
- package/src/components/legacy/{Notebook.tsx → malloynb/Notebook.tsx} +9 -7
- package/src/components/{Notebook → legacy/malloynb}/NotebookCell.tsx +70 -150
- package/src/components/legacy/malloynb/cellKind.spec.ts +33 -0
- package/src/components/legacy/malloynb/cellKind.ts +24 -0
- package/src/components/{Notebook → legacy/malloynb}/types.ts +1 -1
- package/src/components/styles.ts +0 -18
- package/src/hooks/useGivensState.ts +7 -3
- package/src/hooks/useQueryResult.placeholder.spec.ts +44 -0
- package/src/hooks/useQueryResult.ts +26 -1
- package/src/theme/ThemeContext.tsx +21 -1
- package/src/theme/classes.ts +52 -0
- package/src/theme/index.ts +8 -0
- package/src/theme/resolveTheme.ts +3 -0
- package/src/theme/types.ts +7 -0
- package/src/theme/ui.spec.tsx +91 -0
- package/src/theme/ui.ts +115 -0
- package/dist/RenderedResult-BcgYjkZ0.cjs.js +0 -153
- package/dist/ServerProvider-B0dUY8be.cjs.js +0 -1
- package/dist/components/Notebook/cellKind.d.ts +0 -20
- package/dist/components/Report/LinearReport.d.ts +0 -18
- package/dist/components/ReportBuilder/SourceViewPicker.d.ts +0 -9
- package/dist/components/ReportBuilder/legacyNotebook.d.ts +0 -73
- package/dist/components/ReportBuilder/useConversionConfirm.d.ts +0 -20
- package/dist/useCompiledDocument-UY28ITET.cjs.js +0 -141
- package/src/components/Notebook/cellKind.spec.ts +0 -199
- package/src/components/Notebook/cellKind.ts +0 -74
- package/src/components/Report/LinearReport.tsx +0 -71
- package/src/components/ReportBuilder/SourceViewPicker.tsx +0 -122
- package/src/components/ReportBuilder/legacyNotebook.chart.spec.ts +0 -77
- package/src/components/ReportBuilder/legacyNotebook.convert.spec.ts +0 -626
- package/src/components/ReportBuilder/legacyNotebook.read.spec.ts +0 -338
- package/src/components/ReportBuilder/legacyNotebook.ts +0 -1122
- package/src/components/ReportBuilder/useConversionConfirm.ts +0 -55
- package/src/components/legacy/Notebook.served.spec.tsx +0 -183
- /package/dist/components/{Notebook → legacy/malloynb}/runPlan.d.ts +0 -0
- /package/src/components/{Notebook → legacy/malloynb}/runPlan.spec.ts +0 -0
- /package/src/components/{Notebook → legacy/malloynb}/runPlan.ts +0 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";const M=require("react/jsx-runtime"),ne=require("@mui/material"),p=require("react"),h=require("./useCompiledDocument-B21sVbb4.cjs.js"),Y=require("./ServerProvider-BOgiW8MX.cjs.js"),g=h.reportClasses.drillCell;function se(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 de(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 pe(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 le(e,r){const t=pe(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 ce(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 ue(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}},n={...a,legend:{...a.legend,orient:"bottom"}};return s=>s==="shape_map"?n:a}function he(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={},C=f.text("light"),k=f.text("dark");C&&(v.light=C),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 I="data-publisher-fill",ge=async(e,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:t}=await h.loadMalloyRenderer();return new t({onClick:r,vegaConfigOverride:ue(e),theme:ce(e),onError:o=>{console.error("Error rendering visualization:",typeof o,o)}}).createViz()};async function ve(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 h.loadMalloyTag())}catch{return}try{const{tag:o}=l(t);return he(o)}catch(o){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:o,lines:t});return}}function we(e,r,t){const l=h.buildTableCssVars(r,t);for(const[o,a]of Object.entries(l))e.style.setProperty(o,a)}const ke=`
|
|
2
|
+
/* Card geometry, through the renderer's OWN theme vars rather than over the top
|
|
3
|
+
of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
|
|
4
|
+
passes each through to the --malloy-render--* the card CSS reads, so a value
|
|
5
|
+
inherited from our wrapper loses to that declaration however early it is set:
|
|
6
|
+
this has to be a rule on the same element, at higher specificity. Doubling the
|
|
7
|
+
class does that, and then no !important is needed — which matters, because
|
|
8
|
+
!important here also lands on .dashboard-item-borderless and repaints a card
|
|
9
|
+
the author asked to have no card. */
|
|
10
|
+
.malloy-render.malloy-render {
|
|
11
|
+
--malloy-theme--dashboard-card-radius: var(--publisher-dashboard-card-radius);
|
|
12
|
+
--malloy-theme--dashboard-card-padding: var(--publisher-dashboard-card-padding);
|
|
13
|
+
}
|
|
14
|
+
/* dashboard.css hardcodes background: #f7f9fc on .malloy-dashboard
|
|
15
|
+
and .dashboard-row-header, which would paint light grey in dark
|
|
16
|
+
mode and also bleed an operator-picked palette.background across
|
|
17
|
+
the panel chrome in light. Both surfaces use
|
|
18
|
+
--malloy-render--background here, which buildMalloyExplicitTheme
|
|
19
|
+
wires to dashboardRoot: a mode-keyed neutral that stays decoupled
|
|
20
|
+
from palette.background (the chart canvas) on purpose. Selectors
|
|
21
|
+
are duplicated at higher specificity to beat the renderer s own
|
|
22
|
+
scoped rules. */
|
|
23
|
+
.malloy-render .malloy-dashboard,
|
|
24
|
+
.malloy-render.malloy-render .malloy-dashboard,
|
|
25
|
+
div.malloy-render .malloy-dashboard {
|
|
26
|
+
/* --publisher-dashboard-root is set on the outer Publisher wrapper
|
|
27
|
+
(see buildTableCssVars) and stays decoupled from
|
|
28
|
+
--malloy-render--background, which gets shadowed inside the
|
|
29
|
+
renderer when a theme.background annotation is present. The
|
|
30
|
+
dedicated var means the panel between tiles always paints the
|
|
31
|
+
operator neutral dashboardRoot regardless of annotations. */
|
|
32
|
+
background: var(--publisher-dashboard-root) !important;
|
|
33
|
+
background-color: var(--publisher-dashboard-root) !important;
|
|
34
|
+
color: var(--malloy-render--table-body-color) !important;
|
|
35
|
+
}
|
|
36
|
+
.malloy-render .malloy-dashboard .dashboard-row,
|
|
37
|
+
.malloy-render .malloy-dashboard .dashboard-row-body,
|
|
38
|
+
.malloy-render .malloy-dashboard .dashboard-row-header,
|
|
39
|
+
.malloy-render.malloy-render .malloy-dashboard .dashboard-row-header,
|
|
40
|
+
div.malloy-render .malloy-dashboard .dashboard-row-header {
|
|
41
|
+
/* Belt + suspenders: dashboard.css hardcodes .dashboard-row-header
|
|
42
|
+
to #f7f9fc, and row / row-body have no explicit background but
|
|
43
|
+
get caught in any annotation-driven inline writes. Force all of
|
|
44
|
+
them to the neutral panel colour. */
|
|
45
|
+
background: var(--publisher-dashboard-root) !important;
|
|
46
|
+
background-color: var(--publisher-dashboard-root) !important;
|
|
47
|
+
}
|
|
48
|
+
.malloy-render .malloy-dashboard .dashboard-item:not(.dashboard-item-borderless) {
|
|
49
|
+
/* Tile padding around each chart / table. Uses our custom
|
|
50
|
+
--malloy-render--tile-background so the operator can theme the
|
|
51
|
+
tile separately from the table header row (which paints from
|
|
52
|
+
--malloy-render--table-pinned-background below).
|
|
53
|
+
|
|
54
|
+
A flat bordered card rather than the renderer's shadow ring, which is what
|
|
55
|
+
makes it match the composite tile's Paper. :not(borderless) because
|
|
56
|
+
# borderless asks for no card at all, and an !important background and
|
|
57
|
+
border drew one anyway. */
|
|
58
|
+
background: var(--malloy-render--tile-background) !important;
|
|
59
|
+
color: var(--malloy-render--table-body-color) !important;
|
|
60
|
+
box-shadow: none !important;
|
|
61
|
+
/* The card edge, not the table gridline: --publisher-dashboard-card-border,
|
|
62
|
+
the same value TileCard paints, so the renderer's card and the composite
|
|
63
|
+
one are outlined identically. */
|
|
64
|
+
border: var(--publisher-dashboard-card-border) !important;
|
|
65
|
+
}
|
|
66
|
+
/* The renderer's big-value card — the small card a "# big_value" measure sits
|
|
67
|
+
in, several to a row inside one tile. (No backticks in here: this is inside
|
|
68
|
+
a template literal.) Its own CSS gives it a 0.55px edge in
|
|
69
|
+
#e5e7eb: a sub-pixel width, and a grey off the slate ramp everything else on
|
|
70
|
+
the page is on. It is a dashboard card like any other, so it takes the card
|
|
71
|
+
edge and stops being the one card outlined in a hairline nobody can see. */
|
|
72
|
+
.malloy-render .malloy-big-value-card {
|
|
73
|
+
border: var(--publisher-dashboard-card-border) !important;
|
|
74
|
+
/* Its shadow is a four-layer Tailwind stack, and only two of those layers
|
|
75
|
+
are a shadow: the other is "0 0 0 1px #e5e7eb", a spread ring drawn as a
|
|
76
|
+
second border OVER the real one. So the border above was landing
|
|
77
|
+
underneath a ring in the renderer's own grey, and the card kept both a
|
|
78
|
+
lifted look the flat cards around it do not have and an edge we did not
|
|
79
|
+
pick. Dropped whole rather than rebuilt layer by layer: the ring's job is
|
|
80
|
+
the border's job, and the border is already doing it. */
|
|
81
|
+
box-shadow: none !important;
|
|
82
|
+
}
|
|
83
|
+
/* The strip of big-value cards as a grid, so cards share a width and the last one does not wrap
|
|
84
|
+
alone. The renderer's wrapping flex row sizes each card to its own text. The 250px floor is the
|
|
85
|
+
widest realistic value: it is nowrap at 32px in an overflow:visible card, so a narrower track
|
|
86
|
+
would spill it onto its neighbour. Embedded (a nested big_value) is left as the renderer draws it. */
|
|
87
|
+
.malloy-render .malloy-big-value:not(.malloy-big-value--embedded) {
|
|
88
|
+
display: grid;
|
|
89
|
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
90
|
+
}
|
|
91
|
+
.malloy-render .malloy-big-value-card:not(.malloy-big-value-card--embedded) {
|
|
92
|
+
width: auto;
|
|
93
|
+
max-width: none;
|
|
94
|
+
}
|
|
95
|
+
.malloy-render .malloy-dashboard .dashboard-row-header-separator {
|
|
96
|
+
background: var(--malloy-render--table-border) !important;
|
|
97
|
+
}
|
|
98
|
+
/* !important because the malloy-explorer stylesheet pins these same properties with it. */
|
|
99
|
+
[${I}] .malloy-table.root {
|
|
100
|
+
height: 100% !important;
|
|
101
|
+
align-content: start !important;
|
|
102
|
+
grid-template-columns: repeat(var(--total-header-size), minmax(max-content, 1fr)) !important;
|
|
103
|
+
}
|
|
104
|
+
.malloy-render .malloy-table .th.column-cell {
|
|
105
|
+
/* Non-pinned tables have no header background in the renderer's
|
|
106
|
+
own CSS (only pinned scrolled tables paint the pinned-header
|
|
107
|
+
with this var). Force the same value here so every table has a
|
|
108
|
+
visible header band reflecting the operator's choice. */
|
|
109
|
+
background: var(--malloy-render--table-pinned-background) !important;
|
|
110
|
+
}
|
|
111
|
+
.malloy-render .dashboard-item-title,
|
|
112
|
+
.malloy-render .dashboard-dimension-name {
|
|
113
|
+
color: var(--malloy-render--label-color) !important;
|
|
114
|
+
}
|
|
115
|
+
.malloy-render .dashboard-item-value,
|
|
116
|
+
.malloy-render .dashboard-item-value-measure,
|
|
117
|
+
.malloy-render .dashboard-dimension-value {
|
|
118
|
+
color: var(--malloy-render--value-color) !important;
|
|
119
|
+
}
|
|
120
|
+
.malloy-render .malloy-table,
|
|
121
|
+
.malloy-render .malloy-list {
|
|
122
|
+
color: var(--malloy-render--table-body-color) !important;
|
|
123
|
+
}
|
|
124
|
+
.malloy-render .column-cell.th,
|
|
125
|
+
.malloy-render .cell-content.header {
|
|
126
|
+
color: var(--malloy-render--table-header-color) !important;
|
|
127
|
+
}
|
|
128
|
+
/* A cell whose column declares a "# drill" this surface can honor, marked
|
|
129
|
+
by markDrillableCells. Ordinary text with a pointer cursor until hovered,
|
|
130
|
+
then it reads as a link: the same affordance Malloyyo gives the same tag,
|
|
131
|
+
and the only thing that tells a reader a cell navigates. Kept off the
|
|
132
|
+
resting state deliberately: a column painted blue competes with the data.
|
|
133
|
+
(No backticks in here: this is inside a template literal.) */
|
|
134
|
+
.malloy-render .${g} {
|
|
135
|
+
cursor: pointer;
|
|
136
|
+
}
|
|
137
|
+
.malloy-render .${g}:hover > .cell-content {
|
|
138
|
+
color: var(--publisher-drill-link) !important;
|
|
139
|
+
text-decoration: underline;
|
|
140
|
+
}
|
|
141
|
+
/* Keyboard focus reads the same as hover, plus a ring: a hover colour is not
|
|
142
|
+
something a keyboard user can produce, and a focus ring is not something a
|
|
143
|
+
mouse user sees. focus-visible rather than focus, so a click does not leave a
|
|
144
|
+
ring behind it. (No backticks in here: this is inside a template literal.) */
|
|
145
|
+
.malloy-render .${g}:focus-visible {
|
|
146
|
+
outline: 2px solid var(--publisher-drill-link);
|
|
147
|
+
outline-offset: -2px;
|
|
148
|
+
}
|
|
149
|
+
.malloy-render .${g}:focus-visible > .cell-content {
|
|
150
|
+
color: var(--publisher-drill-link) !important;
|
|
151
|
+
text-decoration: underline;
|
|
152
|
+
}
|
|
153
|
+
`,ie="publisher-malloy-renderer-overrides";function xe(){if(typeof document>"u"||document.getElementById(ie))return;const e=document.createElement("style");e.id=ie,e.textContent=ke,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,C=p.useRef(!1),k=p.useRef(null),V=p.useRef(0),{theme:j,layers:J,mode:W}=Y.usePublisherTheme(),Q=p.useMemo(()=>({radius:j.ui.radius.tile,padding:`${h.DASHBOARD_CARD_PADDING_PX}px`}),[j.ui.radius.tile]);return p.useEffect(()=>()=>{V.current+=1;const c=k.current;c?.viz.remove(),c?.node.remove(),k.current=null},[]),p.useLayoutEffect(()=>{if(!n.current||!e)return;xe();const c=n.current,be=V.current+=1;let H=!1;const K=()=>!H&&be===V.current;let d,m,N=null,G=0,$=null,q=null,P=null,O=null,_=null,L=null,Z=null,ee=0,E=null;C.current=!1;let w,S;const U=x=>{if(H||!x.firstElementChild||h.resultSizing(w,S)==="container")return;const z=h.remeasuresAfterReady(w,S);if(C.current&&!z)return;const F=c.hasAttribute(I);F&&c.removeAttribute(I);const A=h.measureContentHeight(x,h.contentNodeDepth(w));F&&c.setAttribute(I,""),A>0&&(C.current=!0,l&&A!==ee&&(ee=A,l(A)));const u=h.contentNode(x,h.contentNodeDepth(w));z&&u&&Z!==u&&(Z=u,L?.disconnect(),L=new ResizeObserver(()=>U(x)),L.observe(u))};return(async()=>{let x;try{x=JSON.parse(e)}catch(y){console.error("Error parsing visualization result:",y);return}const z=await ve(x),F=z?Y.resolveTheme([...J,z],W):j;if(!K())return;try{m=await ge(F,f)}catch(y){console.error("Failed to create renderer:",y);return}if(!K()){m.remove(),m=void 0;return}const A=k.current;d=document.createElement("div"),d.style.width="100%",d.style.height="100%",we(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);const u=d;O=new MutationObserver(()=>{_&&clearTimeout(_),_=setTimeout(()=>{U(u),C.current&&O?.disconnect()},100)}),O.observe(d,{childList:!0,subtree:!0,attributes:!0});const fe=m;let re=!1;const te=()=>{if(!(re||!K())){re=!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:fe,node:u},U(u)}};try{m.setResult(x);try{const R=m.getMetadata(),T=R?.getRootField();w=T?.renderAs(),S=T?R?.getPluginsForField(T.key)?.[0]?.sizingStrategy:void 0}catch{w=void 0,S=void 0}o?.(h.resultSizing(w,S)),d.dataset.malloyRenderAs=w??"unknown",d.dataset.malloySizing=h.resultSizing(w,S),m.render(d);const y=s.current;try{if(y){const R=se(m,y.canDrill),T=()=>{try{de(u,R)}catch(i){console.warn("Drill affordance skipped:",i)}};T();const oe=i=>{const D=i.querySelector(".cell-content")??i,X=D.getBoundingClientRect();D.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:D.ownerDocument.defaultView,clientX:Math.round(X.left+X.width/2),clientY:Math.round(X.bottom)}))},ae=i=>i.target?.closest?.(`.${g}`)??null,ye=(i,b)=>{le(i,b)?.focus()};$=i=>{const b=ae(i);if(!b)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(),ye(b,D);return}i.key==="Enter"?(i.preventDefault(),oe(b)):i.key===" "&&i.preventDefault()},q=i=>{if(i.key!==" ")return;const b=ae(i);b&&(i.preventDefault(),oe(b))},P=i=>{const b=i.target?.closest?.(`.${g}`);b&&le(b,0)},u.addEventListener("keydown",$),u.addEventListener("keyup",q),u.addEventListener("focusin",P),R.size>0&&typeof MutationObserver<"u"&&(N=new MutationObserver(()=>{cancelAnimationFrame(G),G=requestAnimationFrame(T)}),N.observe(u,{childList:!0,subtree:!0}))}}catch(R){console.warn("Drill affordance skipped:",R)}m.onReady(te),E=setTimeout(te,1e4)}catch(y){console.error("Error rendering visualization:",y),O?.disconnect(),L?.disconnect(),N?.disconnect(),m.remove(),m=void 0,u.parentNode===c&&c.removeChild(u)}})(),()=>{H=!0,O?.disconnect(),L?.disconnect(),_&&clearTimeout(_),E&&clearTimeout(E),d&&k.current?.node!==d&&($&&d.removeEventListener("keydown",$),q&&d.removeEventListener("keyup",q),P&&d.removeEventListener("focusin",P),N?.disconnect(),cancelAnimationFrame(G),m?.remove(),d.parentNode===c&&c.removeChild(d),c.style.position="")}},[e,f,v,l,o,j,J,W,Q]),M.jsx("div",{ref:n,...a?{[I]:""}:{},style:{width:"100%",height:r?`${r}px`:"400px"}})}function me(e){return typeof window>"u"?M.jsx(ne.Box,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):M.jsx(p.Suspense,{fallback:M.jsx(ne.Box,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:M.jsx(Ce,{...e})})}const Re=Object.freeze(Object.defineProperty({__proto__:null,default:me},Symbol.toStringTag,{value:"Module"}));exports.DRILL_CELL_CLASS=g;exports.RenderedResult=me;exports.RenderedResult$1=Re;exports.buildMalloyExplicitTheme=ce;exports.buildVegaThemeOverride=ue;exports.drillableFieldNames=se;exports.markDrillableCells=de;exports.readChartAnnotations=he;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as L } from "react/jsx-runtime";
|
|
2
|
-
import { Box as
|
|
3
|
-
import { Suspense as
|
|
4
|
-
import {
|
|
5
|
-
import { b6 as
|
|
6
|
-
const g =
|
|
7
|
-
function
|
|
2
|
+
import { Box as ae } from "@mui/material";
|
|
3
|
+
import { Suspense as ue, useRef as F, useCallback as he, useMemo as me, useEffect as be, useLayoutEffect as fe } from "react";
|
|
4
|
+
import { r as ye, D as pe, a as X, l as ge, b as ve, c as we, d as ke, m as xe, e as Ce, f as ne } from "./useCompiledDocument-7j5cBjQd.es.js";
|
|
5
|
+
import { b6 as Re, b4 as Ee, b7 as Se } from "./ServerProvider-azXLkk1q.es.js";
|
|
6
|
+
const g = ye.drillCell;
|
|
7
|
+
function Ae(e, r) {
|
|
8
8
|
const t = /* @__PURE__ */ new Set();
|
|
9
9
|
let l;
|
|
10
10
|
try {
|
|
@@ -26,7 +26,7 @@ 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 Te(e, r) {
|
|
30
30
|
if (r.size !== 0)
|
|
31
31
|
for (const t of e.querySelectorAll(
|
|
32
32
|
".malloy-table"
|
|
@@ -65,7 +65,7 @@ function De(e, r) {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function De(e) {
|
|
69
69
|
const r = e.closest(".malloy-table"), t = I(e);
|
|
70
70
|
return !r || !t ? [] : Array.from(
|
|
71
71
|
r.querySelectorAll(`.${g}`)
|
|
@@ -73,8 +73,8 @@ function Oe(e) {
|
|
|
73
73
|
(l) => l.closest(".malloy-table") === r && I(l) === t
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
const t =
|
|
76
|
+
function le(e, r) {
|
|
77
|
+
const t = De(e), l = t.indexOf(e);
|
|
78
78
|
if (l === -1) return;
|
|
79
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
80
|
if (o) {
|
|
@@ -82,7 +82,7 @@ function ie(e, r) {
|
|
|
82
82
|
return o;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function Oe(e) {
|
|
86
86
|
return {
|
|
87
87
|
background: e.dashboardRoot,
|
|
88
88
|
tableBackground: e.tableBackground,
|
|
@@ -104,7 +104,7 @@ function _e(e) {
|
|
|
104
104
|
mapColor: e.mapColor
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function _e(e) {
|
|
108
108
|
const { foreground: r, axisFaint: t, gridline: l, font: o } = e, a = {
|
|
109
109
|
background: e.background,
|
|
110
110
|
font: o.family,
|
|
@@ -132,7 +132,7 @@ function ze(e) {
|
|
|
132
132
|
};
|
|
133
133
|
return (s) => s === "shape_map" ? n : a;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function ze(e) {
|
|
136
136
|
if (!e) return;
|
|
137
137
|
const r = e.tag("theme");
|
|
138
138
|
if (!r) return;
|
|
@@ -140,7 +140,7 @@ function Fe(e) {
|
|
|
140
140
|
if (l) {
|
|
141
141
|
const a = {}, n = l.textArray("series");
|
|
142
142
|
n && n.length > 0 && (a.series = n);
|
|
143
|
-
for (const s of
|
|
143
|
+
for (const s of Re) {
|
|
144
144
|
const b = l.tag(s);
|
|
145
145
|
if (!b) continue;
|
|
146
146
|
const y = {}, k = b.text("light"), v = b.text("dark");
|
|
@@ -157,25 +157,25 @@ function Fe(e) {
|
|
|
157
157
|
}
|
|
158
158
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
159
159
|
}
|
|
160
|
-
const M = "data-publisher-fill",
|
|
160
|
+
const M = "data-publisher-fill", Fe = async (e, r) => {
|
|
161
161
|
if (typeof window > "u")
|
|
162
162
|
throw new Error("MalloyRenderer can only be used in browser environment");
|
|
163
|
-
const { MalloyRenderer: t } = await
|
|
163
|
+
const { MalloyRenderer: t } = await ve();
|
|
164
164
|
return new t({
|
|
165
165
|
onClick: r,
|
|
166
|
-
vegaConfigOverride:
|
|
166
|
+
vegaConfigOverride: _e(e),
|
|
167
167
|
// Pass the explicit theme so table chrome and dashboard tiles
|
|
168
168
|
// pick up the operator's colours directly. Without this the
|
|
169
169
|
// renderer's own inline style writes `--malloy-render--*` values
|
|
170
170
|
// sourced from its built-in defaults and shadows whatever we set
|
|
171
171
|
// on the outer wrapper.
|
|
172
|
-
theme:
|
|
172
|
+
theme: Oe(e),
|
|
173
173
|
onError: (o) => {
|
|
174
174
|
console.error("Error rendering visualization:", typeof o, o);
|
|
175
175
|
}
|
|
176
176
|
}).createViz();
|
|
177
177
|
};
|
|
178
|
-
async function
|
|
178
|
+
async function Le(e) {
|
|
179
179
|
if (!e || typeof e != "object") return;
|
|
180
180
|
const r = e, t = [
|
|
181
181
|
...Array.isArray(r.model_annotations) ? r.model_annotations : [],
|
|
@@ -185,13 +185,13 @@ async function Me(e) {
|
|
|
185
185
|
if (t.length === 0) return;
|
|
186
186
|
let l;
|
|
187
187
|
try {
|
|
188
|
-
({ parseAnnotation: l } = await
|
|
188
|
+
({ parseAnnotation: l } = await ge());
|
|
189
189
|
} catch {
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
192
|
try {
|
|
193
193
|
const { tag: o } = l(t);
|
|
194
|
-
return
|
|
194
|
+
return ze(o);
|
|
195
195
|
} catch (o) {
|
|
196
196
|
console.warn(
|
|
197
197
|
"Failed to parse # theme.* annotations; chart will render with the shell theme.",
|
|
@@ -200,12 +200,12 @@ async function Me(e) {
|
|
|
200
200
|
return;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
function
|
|
204
|
-
const l =
|
|
203
|
+
function Me(e, r, t) {
|
|
204
|
+
const l = we(r, t);
|
|
205
205
|
for (const [o, a] of Object.entries(l))
|
|
206
206
|
e.style.setProperty(o, a);
|
|
207
207
|
}
|
|
208
|
-
const
|
|
208
|
+
const Ie = `
|
|
209
209
|
/* Card geometry, through the renderer's OWN theme vars rather than over the top
|
|
210
210
|
of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
|
|
211
211
|
passes each through to the --malloy-render--* the card CSS reads, so a value
|
|
@@ -357,13 +357,13 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
|
|
|
357
357
|
color: var(--publisher-drill-link) !important;
|
|
358
358
|
text-decoration: underline;
|
|
359
359
|
}
|
|
360
|
-
`,
|
|
361
|
-
function
|
|
362
|
-
if (typeof document > "u" || document.getElementById(
|
|
360
|
+
`, ie = "publisher-malloy-renderer-overrides";
|
|
361
|
+
function Be() {
|
|
362
|
+
if (typeof document > "u" || document.getElementById(ie)) return;
|
|
363
363
|
const e = document.createElement("style");
|
|
364
|
-
e.id =
|
|
364
|
+
e.id = ie, e.textContent = Ie, document.head.appendChild(e);
|
|
365
365
|
}
|
|
366
|
-
function
|
|
366
|
+
function Ne({
|
|
367
367
|
result: e,
|
|
368
368
|
height: r,
|
|
369
369
|
drill: t,
|
|
@@ -373,43 +373,43 @@ function $e({
|
|
|
373
373
|
}) {
|
|
374
374
|
const n = F(null), s = F(t);
|
|
375
375
|
s.current = t;
|
|
376
|
-
const b =
|
|
376
|
+
const b = he((c) => {
|
|
377
377
|
s.current?.onClick(c);
|
|
378
378
|
}, []), y = t !== void 0, k = F(!1), v = F(
|
|
379
379
|
null
|
|
380
|
-
),
|
|
380
|
+
), V = F(0), { theme: B, layers: Y, mode: J } = Ee(), W = me(
|
|
381
381
|
() => ({
|
|
382
|
-
radius:
|
|
383
|
-
padding: `${
|
|
382
|
+
radius: B.ui.radius.tile,
|
|
383
|
+
padding: `${pe}px`
|
|
384
384
|
}),
|
|
385
|
-
[
|
|
385
|
+
[B.ui.radius.tile]
|
|
386
386
|
);
|
|
387
|
-
return
|
|
388
|
-
|
|
387
|
+
return be(() => () => {
|
|
388
|
+
V.current += 1;
|
|
389
389
|
const c = v.current;
|
|
390
390
|
c?.viz.remove(), c?.node.remove(), v.current = null;
|
|
391
|
-
}, []),
|
|
391
|
+
}, []), fe(() => {
|
|
392
392
|
if (!n.current || !e) return;
|
|
393
|
-
|
|
394
|
-
const c = n.current,
|
|
395
|
-
let
|
|
396
|
-
const
|
|
397
|
-
let d, h,
|
|
393
|
+
Be();
|
|
394
|
+
const c = n.current, se = V.current += 1;
|
|
395
|
+
let q = !1;
|
|
396
|
+
const H = () => !q && se === V.current;
|
|
397
|
+
let d, h, N = null, K = 0, $ = null, j = null, P = null, T = null, D = null, O = null, Q = null, Z = 0, C = null;
|
|
398
398
|
k.current = !1;
|
|
399
399
|
let p, R;
|
|
400
|
-
const
|
|
401
|
-
if (
|
|
402
|
-
const _ =
|
|
400
|
+
const G = (w) => {
|
|
401
|
+
if (q || !w.firstElementChild || X(p, R) === "container") return;
|
|
402
|
+
const _ = ke(p, R);
|
|
403
403
|
if (k.current && !_) return;
|
|
404
404
|
const z = c.hasAttribute(M);
|
|
405
405
|
z && c.removeAttribute(M);
|
|
406
|
-
const E =
|
|
406
|
+
const E = xe(
|
|
407
407
|
w,
|
|
408
|
-
|
|
408
|
+
ne(p)
|
|
409
409
|
);
|
|
410
|
-
z && c.setAttribute(M, ""), E > 0 && (k.current = !0, l && E !==
|
|
411
|
-
const u =
|
|
412
|
-
_ && u &&
|
|
410
|
+
z && c.setAttribute(M, ""), E > 0 && (k.current = !0, l && E !== Z && (Z = E, l(E)));
|
|
411
|
+
const u = Ce(w, ne(p));
|
|
412
|
+
_ && u && Q !== u && (Q = u, O?.disconnect(), O = new ResizeObserver(() => G(w)), O.observe(u));
|
|
413
413
|
};
|
|
414
414
|
return (async () => {
|
|
415
415
|
let w;
|
|
@@ -419,38 +419,38 @@ function $e({
|
|
|
419
419
|
console.error("Error parsing visualization result:", f);
|
|
420
420
|
return;
|
|
421
421
|
}
|
|
422
|
-
const _ = await
|
|
423
|
-
if (!
|
|
422
|
+
const _ = await Le(w), z = _ ? Se([...Y, _], J) : B;
|
|
423
|
+
if (!H()) return;
|
|
424
424
|
try {
|
|
425
|
-
h = await
|
|
425
|
+
h = await Fe(z, b);
|
|
426
426
|
} catch (f) {
|
|
427
427
|
console.error("Failed to create renderer:", f);
|
|
428
428
|
return;
|
|
429
429
|
}
|
|
430
|
-
if (!
|
|
430
|
+
if (!H()) {
|
|
431
431
|
h.remove(), h = void 0;
|
|
432
432
|
return;
|
|
433
433
|
}
|
|
434
434
|
const E = v.current;
|
|
435
|
-
d = document.createElement("div"), d.style.width = "100%", d.style.height = "100%",
|
|
435
|
+
d = document.createElement("div"), d.style.width = "100%", d.style.height = "100%", Me(d, z, W), c.childElementCount > 0 && (c.style.position = "relative", d.style.position = "absolute", d.style.inset = "0", d.style.visibility = "hidden"), c.appendChild(d);
|
|
436
436
|
const u = d;
|
|
437
437
|
T = new MutationObserver(() => {
|
|
438
438
|
D && clearTimeout(D), D = setTimeout(() => {
|
|
439
|
-
|
|
439
|
+
G(u), k.current && T?.disconnect();
|
|
440
440
|
}, 100);
|
|
441
441
|
}), T.observe(d, {
|
|
442
442
|
childList: !0,
|
|
443
443
|
subtree: !0,
|
|
444
444
|
attributes: !0
|
|
445
445
|
});
|
|
446
|
-
const
|
|
447
|
-
let
|
|
448
|
-
const
|
|
449
|
-
if (!(
|
|
450
|
-
|
|
446
|
+
const de = h;
|
|
447
|
+
let ee = !1;
|
|
448
|
+
const re = () => {
|
|
449
|
+
if (!(ee || !H())) {
|
|
450
|
+
ee = !0, C && (clearTimeout(C), C = null), E?.viz.remove();
|
|
451
451
|
for (const f of Array.from(c.children))
|
|
452
452
|
f !== u && c.removeChild(f);
|
|
453
|
-
u.style.position = "", u.style.inset = "", u.style.visibility = "", c.style.position = "", v.current = { viz:
|
|
453
|
+
u.style.position = "", u.style.inset = "", u.style.visibility = "", c.style.position = "", v.current = { viz: de, node: u }, G(u);
|
|
454
454
|
}
|
|
455
455
|
};
|
|
456
456
|
try {
|
|
@@ -461,51 +461,51 @@ function $e({
|
|
|
461
461
|
} catch {
|
|
462
462
|
p = void 0, R = void 0;
|
|
463
463
|
}
|
|
464
|
-
o?.(
|
|
464
|
+
o?.(X(p, R)), d.dataset.malloyRenderAs = p ?? "unknown", d.dataset.malloySizing = X(p, R), h.render(d);
|
|
465
465
|
const f = s.current;
|
|
466
466
|
try {
|
|
467
467
|
if (f) {
|
|
468
|
-
const x =
|
|
468
|
+
const x = Ae(h, f.canDrill), S = () => {
|
|
469
469
|
try {
|
|
470
|
-
|
|
470
|
+
Te(u, x);
|
|
471
471
|
} catch (i) {
|
|
472
472
|
console.warn("Drill affordance skipped:", i);
|
|
473
473
|
}
|
|
474
474
|
};
|
|
475
475
|
S();
|
|
476
|
-
const
|
|
477
|
-
const A = i.querySelector(".cell-content") ?? i,
|
|
476
|
+
const te = (i) => {
|
|
477
|
+
const A = i.querySelector(".cell-content") ?? i, U = A.getBoundingClientRect();
|
|
478
478
|
A.dispatchEvent(
|
|
479
479
|
new MouseEvent("click", {
|
|
480
480
|
bubbles: !0,
|
|
481
481
|
cancelable: !0,
|
|
482
482
|
view: A.ownerDocument.defaultView,
|
|
483
|
-
clientX: Math.round(
|
|
484
|
-
clientY: Math.round(
|
|
483
|
+
clientX: Math.round(U.left + U.width / 2),
|
|
484
|
+
clientY: Math.round(U.bottom)
|
|
485
485
|
})
|
|
486
486
|
);
|
|
487
|
-
},
|
|
488
|
-
|
|
487
|
+
}, oe = (i) => i.target?.closest?.(`.${g}`) ?? null, ce = (i, m) => {
|
|
488
|
+
le(i, m)?.focus();
|
|
489
489
|
};
|
|
490
|
-
|
|
491
|
-
const m =
|
|
490
|
+
$ = (i) => {
|
|
491
|
+
const m = oe(i);
|
|
492
492
|
if (!m) return;
|
|
493
493
|
const A = i.key === "ArrowDown" ? 1 : i.key === "ArrowUp" ? -1 : i.key === "Home" ? "first" : i.key === "End" ? "last" : void 0;
|
|
494
494
|
if (A !== void 0) {
|
|
495
|
-
i.preventDefault(),
|
|
495
|
+
i.preventDefault(), ce(m, A);
|
|
496
496
|
return;
|
|
497
497
|
}
|
|
498
|
-
i.key === "Enter" ? (i.preventDefault(),
|
|
499
|
-
}, $ = (i) => {
|
|
500
|
-
if (i.key !== " ") return;
|
|
501
|
-
const m = ae(i);
|
|
502
|
-
m && (i.preventDefault(), oe(m));
|
|
498
|
+
i.key === "Enter" ? (i.preventDefault(), te(m)) : i.key === " " && i.preventDefault();
|
|
503
499
|
}, j = (i) => {
|
|
500
|
+
if (i.key !== " ") return;
|
|
501
|
+
const m = oe(i);
|
|
502
|
+
m && (i.preventDefault(), te(m));
|
|
503
|
+
}, P = (i) => {
|
|
504
504
|
const m = i.target?.closest?.(`.${g}`);
|
|
505
|
-
m &&
|
|
506
|
-
}, u.addEventListener("keydown",
|
|
507
|
-
cancelAnimationFrame(
|
|
508
|
-
}),
|
|
505
|
+
m && le(m, 0);
|
|
506
|
+
}, u.addEventListener("keydown", $), u.addEventListener("keyup", j), u.addEventListener("focusin", P), x.size > 0 && typeof MutationObserver < "u" && (N = new MutationObserver(() => {
|
|
507
|
+
cancelAnimationFrame(K), K = requestAnimationFrame(S);
|
|
508
|
+
}), N.observe(u, {
|
|
509
509
|
childList: !0,
|
|
510
510
|
subtree: !0
|
|
511
511
|
}));
|
|
@@ -513,12 +513,12 @@ function $e({
|
|
|
513
513
|
} catch (x) {
|
|
514
514
|
console.warn("Drill affordance skipped:", x);
|
|
515
515
|
}
|
|
516
|
-
h.onReady(
|
|
516
|
+
h.onReady(re), C = setTimeout(re, 1e4);
|
|
517
517
|
} catch (f) {
|
|
518
|
-
console.error("Error rendering visualization:", f), T?.disconnect(), O?.disconnect(),
|
|
518
|
+
console.error("Error rendering visualization:", f), T?.disconnect(), O?.disconnect(), N?.disconnect(), h.remove(), h = void 0, u.parentNode === c && c.removeChild(u);
|
|
519
519
|
}
|
|
520
520
|
})(), () => {
|
|
521
|
-
|
|
521
|
+
q = !0, T?.disconnect(), O?.disconnect(), D && clearTimeout(D), C && clearTimeout(C), d && v.current?.node !== d && ($ && d.removeEventListener("keydown", $), j && d.removeEventListener("keyup", j), P && d.removeEventListener("focusin", P), N?.disconnect(), cancelAnimationFrame(K), h?.remove(), d.parentNode === c && c.removeChild(d), c.style.position = "");
|
|
522
522
|
};
|
|
523
523
|
}, [
|
|
524
524
|
e,
|
|
@@ -526,10 +526,10 @@ function $e({
|
|
|
526
526
|
y,
|
|
527
527
|
l,
|
|
528
528
|
o,
|
|
529
|
-
|
|
529
|
+
B,
|
|
530
530
|
Y,
|
|
531
531
|
J,
|
|
532
|
-
|
|
532
|
+
W
|
|
533
533
|
]), /* @__PURE__ */ L(
|
|
534
534
|
"div",
|
|
535
535
|
{
|
|
@@ -542,9 +542,9 @@ function $e({
|
|
|
542
542
|
}
|
|
543
543
|
);
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function $e(e) {
|
|
546
546
|
return typeof window > "u" ? /* @__PURE__ */ L(
|
|
547
|
-
|
|
547
|
+
ae,
|
|
548
548
|
{
|
|
549
549
|
sx: {
|
|
550
550
|
width: "100%",
|
|
@@ -557,10 +557,10 @@ function je(e) {
|
|
|
557
557
|
children: "Loading..."
|
|
558
558
|
}
|
|
559
559
|
) : /* @__PURE__ */ L(
|
|
560
|
-
|
|
560
|
+
ue,
|
|
561
561
|
{
|
|
562
562
|
fallback: /* @__PURE__ */ L(
|
|
563
|
-
|
|
563
|
+
ae,
|
|
564
564
|
{
|
|
565
565
|
sx: {
|
|
566
566
|
width: "100%",
|
|
@@ -573,21 +573,21 @@ function je(e) {
|
|
|
573
573
|
children: "Loading visualization..."
|
|
574
574
|
}
|
|
575
575
|
),
|
|
576
|
-
children: /* @__PURE__ */ L(
|
|
576
|
+
children: /* @__PURE__ */ L(Ne, { ...e })
|
|
577
577
|
}
|
|
578
578
|
);
|
|
579
579
|
}
|
|
580
|
-
const
|
|
580
|
+
const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
581
581
|
__proto__: null,
|
|
582
|
-
default:
|
|
582
|
+
default: $e
|
|
583
583
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
584
584
|
export {
|
|
585
585
|
g as D,
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
586
|
+
$e as R,
|
|
587
|
+
_e as a,
|
|
588
|
+
Oe as b,
|
|
589
|
+
Ke as c,
|
|
590
|
+
Ae as d,
|
|
591
|
+
Te as m,
|
|
592
|
+
ze as r
|
|
593
593
|
};
|