@malloy-publisher/app 0.15.0 → 0.16.0

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 (24) hide show
  1. package/dist/api-doc.yaml +256 -15
  2. package/dist/assets/{EnvironmentPage-CKUvEX7r.js → EnvironmentPage-Y9IWPC9J.js} +1 -1
  3. package/dist/assets/{HomePage-COpZmm3Z.js → HomePage-BOUo0MEl.js} +1 -1
  4. package/dist/assets/{MainPage-nIyVOgy5.js → MainPage-BkM5UDRU.js} +1 -1
  5. package/dist/assets/{ModelPage-BelGfTpw.js → ModelPage-PgDTkS5C.js} +2 -2
  6. package/dist/assets/{PackagePage-CbnVG2uD.js → PackagePage-Dn7FrQ5r.js} +1 -1
  7. package/dist/assets/{PackageSplatRoute-37oqxKyq.js → PackageSplatRoute-BLC29ek-.js} +2 -2
  8. package/dist/assets/{RenderedResult-Ct3z543g.es-QeWq894a.js → RenderedResult-vyM2wQbC.es-ha8dF24T.js} +3 -3
  9. package/dist/assets/{RouteError-CjmVxFgv.js → RouteError-BolMqTuz.js} +1 -1
  10. package/dist/assets/{ThemeEditorPage-BjPyhpFF.js → ThemeEditorPage-CPv1eHkI.js} +1 -1
  11. package/dist/assets/{ToggleButtonGroup-bM-WVZrV.js → ToggleButtonGroup-DZtImN0S.js} +1 -1
  12. package/dist/assets/{documentRoutes-BAPDdua3.js → documentRoutes-DI5cX3ty.js} +1 -1
  13. package/dist/assets/{editPageMounted-B4HEQbbz.js → editPageMounted-C--4kcld.js} +2 -2
  14. package/dist/assets/{index-DbRUcXfe.js → index-CbsrzNSp.js} +1 -1
  15. package/dist/assets/{index-C-aFb4Gn.js → index-D9wSfMZN.js} +1 -1
  16. package/dist/assets/{index-DUgED99B.js → index-DLToSg1f.js} +62 -62
  17. package/dist/assets/{index-Bx-5B05C.js → index-DyYEltlF.js} +1 -1
  18. package/dist/assets/{index.es-DO67FMt6.js → index.es-D8SVyfmS.js} +1 -1
  19. package/dist/assets/usePackageLinkNavigate-DxHGKrmZ.js +1 -0
  20. package/dist/assets/{usePackageRoute-Cso_p7RX.js → usePackageRoute-A_YQMrax.js} +1 -1
  21. package/dist/index.html +1 -1
  22. package/dist/mcp-app/report.js +145 -145
  23. package/package.json +2 -2
  24. package/dist/assets/usePackageLinkNavigate-BgdbNERJ.js +0 -1
@@ -1,5 +1,5 @@
1
- import{az as ge,j as O,J as se,r as g,aA as ve,V as we,aB as ke,ah as xe,aC as Ce,aD as G,aE as V,aF as Ae,aG as Ee,aH as ze,aI as Se,aJ as De,aK as Fe,aL as $e,aM as me,aN as de}from"./index-DUgED99B.js";const v=ge.drillCell;function je(e,t){const r=new Set;let a;try{a=e.getMetadata()?.getAllFields()??[]}catch{return r}const o=new Set;for(const n of a)!n||t(n)||n.tag?.tag("hidden")===void 0&&o.add(n.tag?.text("label")??n.name);for(const n of a){if(!n||!t(n))continue;const l=n.tag?.text("label")??n.name;o.has(l)||r.add(l)}return r}function L(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function Re(e,t){if(t.size!==0)for(const r of e.querySelectorAll(".malloy-table")){const a=l=>l.closest(".malloy-table")===r,o=new Set;for(const l of r.querySelectorAll(".column-cell.th")){if(!a(l))continue;const i=(l.textContent??"").replace(/\u200b/g,"").trim(),b=L(l);b&&t.has(i)&&o.add(b)}if(o.size===0)continue;const n=new Set;for(const l of r.querySelectorAll(`.${v}[tabindex="0"]`)){if(!a(l))continue;const i=L(l);i&&(n.has(i)?l.tabIndex=-1:n.add(i))}for(const l of r.querySelectorAll(".column-cell.td")){if(!a(l))continue;const i=L(l),b=!l.querySelector(".value-null")&&(l.textContent??"").trim()!=="";if(i&&b&&o.has(i)&&!l.querySelector(".malloy-table")){if(l.classList.add(v),l.tabIndex===0)n.add(i);else{const f=n.has(i);f||n.add(i),l.tabIndex=f?-1:0}l.setAttribute("role","button")}}}}function Te(e){const t=e.closest(".malloy-table"),r=L(e);return!t||!r?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(a=>a.closest(".malloy-table")===t&&L(a)===r)}function ce(e,t){const r=Te(e),a=r.indexOf(e);if(a===-1)return;const o=t==="first"?r[0]:t==="last"?r[r.length-1]:r[Math.min(Math.max(a+t,0),r.length-1)];if(o){for(const n of r)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 _e(e){const{foreground:t,axisFaint:r,gridline:a,font:o}=e,n={background:e.background,font:o.family,title:{color:t,font:o.family},axis:{labelColor:t,titleColor:t,domainColor:r,tickColor:r,gridColor:a,labelFont:o.family,titleFont:o.family},legend:{labelColor:t,titleColor:t,labelFont:o.family,titleFont:o.family},header:{labelColor:t,titleColor:t},range:{category:e.series}},l={...n,legend:{...n.legend,orient:"bottom"}};return i=>i==="shape_map"?l:n}function Oe(e){if(!e)return;const t=e.tag("theme");if(!t)return;const r={},a=t.tag("palette");if(a){const n={},l=a.textArray("series");l&&l.length>0&&(n.series=l);for(const i of ve){const b=a.tag(i);if(!b)continue;const f={},x=b.text("light"),k=b.text("dark");x&&(f.light=x),k&&(f.dark=k),Object.keys(f).length>0&&(n[i]=f)}Object.keys(n).length>0&&(r.palette=n)}const o=t.tag("font");if(o){const n={},l=o.text("family");l&&(n.family=l);const i=o.numeric("size");typeof i=="number"&&Number.isFinite(i)&&(n.size=i),Object.keys(n).length>0&&(r.font=n)}return Object.keys(r).length>0?r:void 0}const Z=e=>(e??[]).map(t=>t?.value).filter(t=>typeof t=="string");function Be(e){const t=e.replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const Le=e=>Z(e.annotations).some(t=>{const r=t.trim();return/^#[^("]/.test(r)&&/(?:^#|[\s{])label\s*=/.test(r)}),Ie=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,qe=e=>e.type?.element_type?.fields??e.type?.fields;function be(e,t){let r=!1;return{fields:e.map(a=>{const o=qe(a);if(o){const l=be(o,me(Z(a.annotations)));if(!l.changed)return a;r=!0;const i=a.type?.element_type?{...a.type,element_type:{...a.type.element_type,fields:l.fields}}:{...a.type,fields:l.fields};return{...a,type:i}}if(!t||!a.name||Le(a))return a;const n=Be(a.name);return n===a.name?a:(r=!0,{...a,annotations:[{value:`# label=${Ie(n)}
2
- `},...a.annotations??[]]})}),changed:r}}function Ne(e){if(!e||typeof e!="object")return e;const t=e,r=t.schema?.fields;if(!Array.isArray(r))return e;const{fields:a,changed:o}=be(r,me(Z(t.annotations)));return o?{...t,schema:{...t.schema,fields:a}}:e}const he=320,Pe=10,He=96,Ve=4e3;function Ye(e,t){if(e!=="bar"&&e!=="combo"&&e!=="line"&&e!=="chart"&&e!=="scatter_chart")return;if(e!=="bar"&&e!=="combo")return he;const r=t?.data?.array_value?.length,a=r===void 0?0:r*Pe+He;return Math.min(Math.max(he,a),Ve)}function Je(e){let t;return{onClick:r=>{const a={...r,...Ke(r)};t=a,queueMicrotask(()=>{t===a&&(t=void 0),e(a)})},onDrill:r=>{const a=t;t=void 0,a&&r.stableDrillClauses!==void 0&&(a.drillClauses=r.stableDrillClauses)}}}function Ke(e){const t=e.field;try{const r=t?.getEffectiveQueryTimezone?.();return r?{timezone:r}:{}}catch{return{}}}function Ue(e){const t=r=>{let a=!1;try{a=r.isArray?.()===!0}catch{a=!1}a&&"stableDrillFilters"in r&&Object.defineProperty(r,"stableDrillFilters",{configurable:!0,get:()=>[]});for(const o of r.fields??[])t(o)};e&&t(e)}const B="data-publisher-fill";let Y;function ye(){if(Y===void 0)try{Y=new Function("return true")()===!0}catch{Y=!1}return Y}const We=async(e,t,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:a}=await Ee();return new a({onClick:t,...r?{onDrill:r,tableConfig:{enableDrill:!0}}:{},vegaConfigOverride:_e(e),...ye()?{}:{useVegaInterpreter:!0},theme:Me(e),onError:o=>{console.error("Error rendering visualization:",typeof o,o)}}).createViz()};async function Qe(e){if(!e||typeof e!="object")return;const t=e,r=[...Array.isArray(t.model_annotations)?t.model_annotations:[],...Array.isArray(t.source_annotations)?t.source_annotations:[],...Array.isArray(t.annotations)?t.annotations:[]].map(o=>typeof o?.value=="string"?o.value:void 0).filter(o=>!!o);if(r.length===0)return;let a;try{({parseAnnotation:a}=await Ae())}catch{return}try{const{tag:o}=a(r);return Oe(o)}catch(o){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:o,lines:r});return}}function Xe(e,t,r){const a=ze(t,r);for(const[o,n]of Object.entries(a))e.style.setProperty(o,n)}const Ge=`
1
+ import{az as ge,j as O,J as se,r as g,aA as ve,V as we,aB as ke,ah as xe,aC as Ce,aD as G,aE as V,aF as Ae,aG as Ee,aH as Se,aI as ze,aJ as De,aK as Fe,aL as $e,aM as me,aN as de}from"./index-DLToSg1f.js";const v=ge.drillCell;function je(e,t){const r=new Set;let a;try{a=e.getMetadata()?.getAllFields()??[]}catch{return r}const o=new Set;for(const n of a)!n||t(n)||n.tag?.tag("hidden")===void 0&&o.add(n.tag?.text("label")??n.name);for(const n of a){if(!n||!t(n))continue;const l=n.tag?.text("label")??n.name;o.has(l)||r.add(l)}return r}function L(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function Re(e,t){if(t.size!==0)for(const r of e.querySelectorAll(".malloy-table")){const a=l=>l.closest(".malloy-table")===r,o=new Set;for(const l of r.querySelectorAll(".column-cell.th")){if(!a(l))continue;const i=(l.textContent??"").replace(/\u200b/g,"").trim(),b=L(l);b&&t.has(i)&&o.add(b)}if(o.size===0)continue;const n=new Set;for(const l of r.querySelectorAll(`.${v}[tabindex="0"]`)){if(!a(l))continue;const i=L(l);i&&(n.has(i)?l.tabIndex=-1:n.add(i))}for(const l of r.querySelectorAll(".column-cell.td")){if(!a(l))continue;const i=L(l),b=!l.querySelector(".value-null")&&(l.textContent??"").trim()!=="";if(i&&b&&o.has(i)&&!l.querySelector(".malloy-table")){if(l.classList.add(v),l.tabIndex===0)n.add(i);else{const f=n.has(i);f||n.add(i),l.tabIndex=f?-1:0}l.setAttribute("role","button")}}}}function Te(e){const t=e.closest(".malloy-table"),r=L(e);return!t||!r?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(a=>a.closest(".malloy-table")===t&&L(a)===r)}function ce(e,t){const r=Te(e),a=r.indexOf(e);if(a===-1)return;const o=t==="first"?r[0]:t==="last"?r[r.length-1]:r[Math.min(Math.max(a+t,0),r.length-1)];if(o){for(const n of r)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 _e(e){const{foreground:t,axisFaint:r,gridline:a,font:o}=e,n={background:e.background,font:o.family,title:{color:t,font:o.family},axis:{labelColor:t,titleColor:t,domainColor:r,tickColor:r,gridColor:a,labelFont:o.family,titleFont:o.family},legend:{labelColor:t,titleColor:t,labelFont:o.family,titleFont:o.family},header:{labelColor:t,titleColor:t},range:{category:e.series}},l={...n,legend:{...n.legend,orient:"bottom"}};return i=>i==="shape_map"?l:n}function Oe(e){if(!e)return;const t=e.tag("theme");if(!t)return;const r={},a=t.tag("palette");if(a){const n={},l=a.textArray("series");l&&l.length>0&&(n.series=l);for(const i of ve){const b=a.tag(i);if(!b)continue;const f={},x=b.text("light"),k=b.text("dark");x&&(f.light=x),k&&(f.dark=k),Object.keys(f).length>0&&(n[i]=f)}Object.keys(n).length>0&&(r.palette=n)}const o=t.tag("font");if(o){const n={},l=o.text("family");l&&(n.family=l);const i=o.numeric("size");typeof i=="number"&&Number.isFinite(i)&&(n.size=i),Object.keys(n).length>0&&(r.font=n)}return Object.keys(r).length>0?r:void 0}const Z=e=>(e??[]).map(t=>t?.value).filter(t=>typeof t=="string");function Be(e){const t=e.replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const Le=e=>Z(e.annotations).some(t=>{const r=t.trim();return/^#[^("]/.test(r)&&/(?:^#|[\s{])label\s*=/.test(r)}),Ie=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,qe=e=>e.type?.element_type?.fields??e.type?.fields;function be(e,t){let r=!1;return{fields:e.map(a=>{const o=qe(a);if(o){const l=be(o,me(Z(a.annotations)));if(!l.changed)return a;r=!0;const i=a.type?.element_type?{...a.type,element_type:{...a.type.element_type,fields:l.fields}}:{...a.type,fields:l.fields};return{...a,type:i}}if(!t||!a.name||Le(a))return a;const n=Be(a.name);return n===a.name?a:(r=!0,{...a,annotations:[{value:`# label=${Ie(n)}
2
+ `},...a.annotations??[]]})}),changed:r}}function Ne(e){if(!e||typeof e!="object")return e;const t=e,r=t.schema?.fields;if(!Array.isArray(r))return e;const{fields:a,changed:o}=be(r,me(Z(t.annotations)));return o?{...t,schema:{...t.schema,fields:a}}:e}const he=320,Pe=10,He=96,Ve=4e3;function Ye(e,t){if(e!=="bar"&&e!=="combo"&&e!=="line"&&e!=="chart"&&e!=="scatter_chart")return;if(e!=="bar"&&e!=="combo")return he;const r=t?.data?.array_value?.length,a=r===void 0?0:r*Pe+He;return Math.min(Math.max(he,a),Ve)}function Je(e){let t;return{onClick:r=>{const a={...r,...Ke(r)};t=a,queueMicrotask(()=>{t===a&&(t=void 0),e(a)})},onDrill:r=>{const a=t;t=void 0,a&&r.stableDrillClauses!==void 0&&(a.drillClauses=r.stableDrillClauses)}}}function Ke(e){const t=e.field;try{const r=t?.getEffectiveQueryTimezone?.();return r?{timezone:r}:{}}catch{return{}}}function Ue(e){const t=r=>{let a=!1;try{a=r.isArray?.()===!0}catch{a=!1}a&&"stableDrillFilters"in r&&Object.defineProperty(r,"stableDrillFilters",{configurable:!0,get:()=>[]});for(const o of r.fields??[])t(o)};e&&t(e)}const B="data-publisher-fill";let Y;function ye(){if(Y===void 0)try{Y=new Function("return true")()===!0}catch{Y=!1}return Y}const We=async(e,t,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:a}=await Ee();return new a({onClick:t,...r?{onDrill:r,tableConfig:{enableDrill:!0}}:{},vegaConfigOverride:_e(e),...ye()?{}:{useVegaInterpreter:!0},theme:Me(e),onError:o=>{console.error("Error rendering visualization:",typeof o,o)}}).createViz()};async function Qe(e){if(!e||typeof e!="object")return;const t=e,r=[...Array.isArray(t.model_annotations)?t.model_annotations:[],...Array.isArray(t.source_annotations)?t.source_annotations:[],...Array.isArray(t.annotations)?t.annotations:[]].map(o=>typeof o?.value=="string"?o.value:void 0).filter(o=>!!o);if(r.length===0)return;let a;try{({parseAnnotation:a}=await Ae())}catch{return}try{const{tag:o}=a(r);return Oe(o)}catch(o){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:o,lines:r});return}}function Xe(e,t,r){const a=Se(t,r);for(const[o,n]of Object.entries(a))e.style.setProperty(o,n)}const Ge=`
3
3
  /* Card geometry, through the renderer's OWN theme vars rather than over the top
4
4
  of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
5
5
  passes each through to the --malloy-render--* the card CSS reads, so a value
@@ -176,4 +176,4 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
176
176
  .malloy-render .malloy-table .td.highlight:not(.${v}) {
177
177
  cursor: inherit;
178
178
  }
179
- `,ue="publisher-malloy-renderer-overrides";function Ze(){if(typeof document>"u"||document.getElementById(ue))return;const e=document.createElement("style");e.id=ue,e.textContent=Ge,document.head.appendChild(e)}function et({result:e,height:t,drill:r,onSizeChange:a,onSizing:o,fill:n}){const l=g.useRef(null),i=g.useRef(r);i.current=r;const b=g.useMemo(()=>Je(d=>i.current?.onClick(d)),[]),f=r!==void 0,x=g.useRef(!1),k=g.useRef(null),J=g.useRef(0),{theme:I,layers:K,mode:ee}=we(),te=g.useMemo(()=>({radius:I.ui.radius.tile,padding:`${ke}px`}),[I.ui.radius.tile]);return g.useEffect(()=>()=>{J.current+=1;const d=k.current;d?.viz.remove(),d?.node.remove(),k.current=null},[]),g.useLayoutEffect(()=>{if(!l.current||!e)return;Ze();const d=l.current,fe=J.current+=1;let U=!1;const W=()=>!U&&fe===J.current;let c,y,q=null,Q=0,N=null,P=null,H=null,j=null,R=null,T=null,re=null,ae=0,S=null;x.current=!1;let p,D;const X=w=>{if(U||!w.firstElementChild||G(p,D)==="container")return;const M=Se(p,D);if(x.current&&!M)return;const _=d.hasAttribute(B);_&&d.removeAttribute(B);const C=d.closest(`.${De}`),h=C?.style.overflowY;C&&(C.style.overflowY="hidden");const F=Fe(w,de(p));C&&(C.style.overflowY=h??""),_&&d.setAttribute(B,""),F>0&&(x.current=!0,a&&F!==ae&&(ae=F,a(F)));const A=$e(w,de(p));M&&A&&re!==A&&(re=A,T?.disconnect(),T=new ResizeObserver(()=>X(w)),T.observe(A))};return(async()=>{let w;try{w=JSON.parse(e)}catch(m){console.error("Error parsing visualization result:",m);return}const M=await Qe(w),_=M?xe([...K,Ce(K,M)],ee):I;if(!W())return;try{y=await We(_,b.onClick,f?b.onDrill:void 0)}catch(m){console.error("Failed to create renderer:",m);return}if(!W()){y.remove(),y=void 0;return}const C=k.current;c=document.createElement("div"),c.style.width="100%",c.style.height="100%",Xe(c,_,te),d.childElementCount>0&&(d.style.position="relative",c.style.position="absolute",c.style.inset="0",c.style.visibility="hidden"),d.appendChild(c);const h=c;j=new MutationObserver(()=>{R&&clearTimeout(R),R=setTimeout(()=>{X(h),x.current&&j?.disconnect()},100)}),j.observe(c,{childList:!0,subtree:!0,attributes:!0});const F=y;let A=!1;const oe=()=>{if(!(A||!W())){A=!0,S&&(clearTimeout(S),S=null),C?.viz.remove();for(const m of Array.from(d.children))m!==h&&d.removeChild(m);h.style.position="",h.style.inset="",h.style.visibility="",d.style.position="",k.current={viz:F,node:h},X(h)}};try{y.setResult(Ne(w));try{const E=y.getMetadata(),z=E?.getRootField();f&&Ue(z),p=z?.renderAs(),D=z?E?.getPluginsForField(z.key)?.[0]?.sizingStrategy:void 0}catch{p=void 0,D=void 0}o?.(G(p,D),p),c.dataset.malloyRenderAs=p??"unknown",c.dataset.malloySizing=G(p,D);const m=Ye(p,w);c.style.minWidth=m===void 0?"":`${m}px`,d.style.overflowX=m===void 0?"":"auto",d.style.overflowY=m===void 0?"":"hidden",y.render(c);const ne=i.current;try{if(ne){const E=je(y,ne.canDrill),z=()=>{try{Re(h,E)}catch(s){console.warn("Drill affordance skipped:",s)}};z();const le=s=>{const u=s.querySelector(".cell-content")??s,$=u.getBoundingClientRect();u.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:u.ownerDocument.defaultView,clientX:Math.round($.left+$.width/2),clientY:Math.round($.bottom)}))},ie=s=>s.target?.closest?.(`.${v}`)??null,pe=(s,u)=>{ce(s,u)?.focus()};N=s=>{const u=ie(s);if(!u)return;const $=s.key==="ArrowDown"?1:s.key==="ArrowUp"?-1:s.key==="Home"?"first":s.key==="End"?"last":void 0;if($!==void 0){s.preventDefault(),pe(u,$);return}s.key==="Enter"?(s.preventDefault(),le(u)):s.key===" "&&s.preventDefault()},P=s=>{if(s.key!==" ")return;const u=ie(s);u&&(s.preventDefault(),le(u))},H=s=>{const u=s.target?.closest?.(`.${v}`);u&&ce(u,0)},h.addEventListener("keydown",N),h.addEventListener("keyup",P),h.addEventListener("focusin",H),E.size>0&&typeof MutationObserver<"u"&&(q=new MutationObserver(()=>{cancelAnimationFrame(Q),Q=requestAnimationFrame(z)}),q.observe(h,{childList:!0,subtree:!0}))}}catch(E){console.warn("Drill affordance skipped:",E)}y.onReady(oe),S=setTimeout(oe,1e4)}catch(m){console.error("Error rendering visualization:",m),j?.disconnect(),T?.disconnect(),q?.disconnect(),y.remove(),y=void 0,h.parentNode===d&&d.removeChild(h)}})(),()=>{U=!0,j?.disconnect(),T?.disconnect(),R&&clearTimeout(R),S&&clearTimeout(S),c&&k.current?.node!==c&&(N&&c.removeEventListener("keydown",N),P&&c.removeEventListener("keyup",P),H&&c.removeEventListener("focusin",H),q?.disconnect(),cancelAnimationFrame(Q),y?.remove(),c.parentNode===d&&d.removeChild(c),d.style.position="")}},[e,b,f,a,o,I,K,ee,te]),O.jsx("div",{ref:l,...n?{[B]:""}:{},style:{width:"100%",height:t?`${t}px`:"400px"}})}function tt(e){return typeof window>"u"?O.jsx(se,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):O.jsx(g.Suspense,{fallback:O.jsx(se,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:O.jsx(et,{...e})})}const at=Object.freeze(Object.defineProperty({__proto__:null,default:tt,pageAllowsEval:ye},Symbol.toStringTag,{value:"Module"}));export{v as D,tt as R,_e as a,Me as b,at as c,je as d,Re as m,Oe as r};
179
+ `,ue="publisher-malloy-renderer-overrides";function Ze(){if(typeof document>"u"||document.getElementById(ue))return;const e=document.createElement("style");e.id=ue,e.textContent=Ge,document.head.appendChild(e)}function et({result:e,height:t,drill:r,onSizeChange:a,onSizing:o,fill:n}){const l=g.useRef(null),i=g.useRef(r);i.current=r;const b=g.useMemo(()=>Je(d=>i.current?.onClick(d)),[]),f=r!==void 0,x=g.useRef(!1),k=g.useRef(null),J=g.useRef(0),{theme:I,layers:K,mode:ee}=we(),te=g.useMemo(()=>({radius:I.ui.radius.tile,padding:`${ke}px`}),[I.ui.radius.tile]);return g.useEffect(()=>()=>{J.current+=1;const d=k.current;d?.viz.remove(),d?.node.remove(),k.current=null},[]),g.useLayoutEffect(()=>{if(!l.current||!e)return;Ze();const d=l.current,fe=J.current+=1;let U=!1;const W=()=>!U&&fe===J.current;let c,y,q=null,Q=0,N=null,P=null,H=null,j=null,R=null,T=null,re=null,ae=0,z=null;x.current=!1;let p,D;const X=w=>{if(U||!w.firstElementChild||G(p,D)==="container")return;const M=ze(p,D);if(x.current&&!M)return;const _=d.hasAttribute(B);_&&d.removeAttribute(B);const C=d.closest(`.${De}`),h=C?.style.overflowY;C&&(C.style.overflowY="hidden");const F=Fe(w,de(p));C&&(C.style.overflowY=h??""),_&&d.setAttribute(B,""),F>0&&(x.current=!0,a&&F!==ae&&(ae=F,a(F)));const A=$e(w,de(p));M&&A&&re!==A&&(re=A,T?.disconnect(),T=new ResizeObserver(()=>X(w)),T.observe(A))};return(async()=>{let w;try{w=JSON.parse(e)}catch(m){console.error("Error parsing visualization result:",m);return}const M=await Qe(w),_=M?xe([...K,Ce(K,M)],ee):I;if(!W())return;try{y=await We(_,b.onClick,f?b.onDrill:void 0)}catch(m){console.error("Failed to create renderer:",m);return}if(!W()){y.remove(),y=void 0;return}const C=k.current;c=document.createElement("div"),c.style.width="100%",c.style.height="100%",Xe(c,_,te),d.childElementCount>0&&(d.style.position="relative",c.style.position="absolute",c.style.inset="0",c.style.visibility="hidden"),d.appendChild(c);const h=c;j=new MutationObserver(()=>{R&&clearTimeout(R),R=setTimeout(()=>{X(h),x.current&&j?.disconnect()},100)}),j.observe(c,{childList:!0,subtree:!0,attributes:!0});const F=y;let A=!1;const oe=()=>{if(!(A||!W())){A=!0,z&&(clearTimeout(z),z=null),C?.viz.remove();for(const m of Array.from(d.children))m!==h&&d.removeChild(m);h.style.position="",h.style.inset="",h.style.visibility="",d.style.position="",k.current={viz:F,node:h},X(h)}};try{y.setResult(Ne(w));try{const E=y.getMetadata(),S=E?.getRootField();f&&Ue(S),p=S?.renderAs(),D=S?E?.getPluginsForField(S.key)?.[0]?.sizingStrategy:void 0}catch{p=void 0,D=void 0}o?.(G(p,D),p),c.dataset.malloyRenderAs=p??"unknown",c.dataset.malloySizing=G(p,D);const m=Ye(p,w);c.style.minWidth=m===void 0?"":`${m}px`,d.style.overflowX=m===void 0?"":"auto",d.style.overflowY=m===void 0?"":"hidden",y.render(c);const ne=i.current;try{if(ne){const E=je(y,ne.canDrill),S=()=>{try{Re(h,E)}catch(s){console.warn("Drill affordance skipped:",s)}};S();const le=s=>{const u=s.querySelector(".cell-content")??s,$=u.getBoundingClientRect();u.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:u.ownerDocument.defaultView,clientX:Math.round($.left+$.width/2),clientY:Math.round($.bottom)}))},ie=s=>s.target?.closest?.(`.${v}`)??null,pe=(s,u)=>{ce(s,u)?.focus()};N=s=>{const u=ie(s);if(!u)return;const $=s.key==="ArrowDown"?1:s.key==="ArrowUp"?-1:s.key==="Home"?"first":s.key==="End"?"last":void 0;if($!==void 0){s.preventDefault(),pe(u,$);return}s.key==="Enter"?(s.preventDefault(),le(u)):s.key===" "&&s.preventDefault()},P=s=>{if(s.key!==" ")return;const u=ie(s);u&&(s.preventDefault(),le(u))},H=s=>{const u=s.target?.closest?.(`.${v}`);u&&ce(u,0)},h.addEventListener("keydown",N),h.addEventListener("keyup",P),h.addEventListener("focusin",H),E.size>0&&typeof MutationObserver<"u"&&(q=new MutationObserver(()=>{cancelAnimationFrame(Q),Q=requestAnimationFrame(S)}),q.observe(h,{childList:!0,subtree:!0}))}}catch(E){console.warn("Drill affordance skipped:",E)}y.onReady(oe),z=setTimeout(oe,1e4)}catch(m){console.error("Error rendering visualization:",m),j?.disconnect(),T?.disconnect(),q?.disconnect(),y.remove(),y=void 0,h.parentNode===d&&d.removeChild(h)}})(),()=>{U=!0,j?.disconnect(),T?.disconnect(),R&&clearTimeout(R),z&&clearTimeout(z),c&&k.current?.node!==c&&(N&&c.removeEventListener("keydown",N),P&&c.removeEventListener("keyup",P),H&&c.removeEventListener("focusin",H),q?.disconnect(),cancelAnimationFrame(Q),y?.remove(),c.parentNode===d&&d.removeChild(c),d.style.position="")}},[e,b,f,a,o,I,K,ee,te]),O.jsx("div",{ref:l,...n?{[B]:""}:{},style:{width:"100%",height:t?`${t}px`:"400px"}})}function tt(e){return typeof window>"u"?O.jsx(se,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):O.jsx(g.Suspense,{fallback:O.jsx(se,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:O.jsx(et,{...e})})}const at=Object.freeze(Object.defineProperty({__proto__:null,default:tt,pageAllowsEval:ye},Symbol.toStringTag,{value:"Module"}));export{v as D,tt as R,_e as a,Me as b,at as c,je as d,Re as m,Oe as r};
@@ -1 +1 @@
1
- import{ab as o,j as r,ac as s,ad as n,J as t,T as a}from"./index-DUgED99B.js";function x(){const e=o();return console.error(e),r.jsx(s,{maxWidth:"lg",component:"main",sx:{display:"flex",flexDirection:"column",my:2,gap:0},children:r.jsxs(n,{sx:{m:"auto",flexDirection:"column"},children:[r.jsx(t,{sx:{height:"300px"}}),r.jsx("img",{src:"/error.png"}),r.jsx(a,{variant:"subtitle1",children:"An unexpected error occurred"})]})})}export{x as default};
1
+ import{ab as o,j as r,ac as s,ad as n,J as t,T as a}from"./index-DLToSg1f.js";function x(){const e=o();return console.error(e),r.jsx(s,{maxWidth:"lg",component:"main",sx:{display:"flex",flexDirection:"column",my:2,gap:0},children:r.jsxs(n,{sx:{m:"auto",flexDirection:"column"},children:[r.jsx(t,{sx:{height:"300px"}}),r.jsx("img",{src:"/error.png"}),r.jsx(a,{variant:"subtitle1",children:"An unexpected error occurred"})]})})}export{x as default};