@malloy-publisher/sdk 0.14.0 → 0.15.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 (28) hide show
  1. package/dist/{RenderedResult-C9PiHrGC.cjs.js → RenderedResult-B2VzqpJV.cjs.js} +1 -1
  2. package/dist/{RenderedResult-D0kAzSrP.es.js → RenderedResult-Ct3z543g.es.js} +9 -9
  3. package/dist/{ServerProvider-BHM9y5l0.es.js → ServerProvider-Be9eusDF.es.js} +1066 -989
  4. package/dist/ServerProvider-DDr5VOVF.cjs.js +1 -0
  5. package/dist/builder/index.cjs.js +1 -1
  6. package/dist/builder/index.es.js +335 -335
  7. package/dist/client/api.d.ts +245 -73
  8. package/dist/client/index.cjs.js +1 -1
  9. package/dist/client/index.es.js +110 -104
  10. package/dist/components/Materializations/DeleteMaterializationDialog.d.ts +1 -1
  11. package/dist/components/Materializations/MaterializationRunsList.d.ts +1 -1
  12. package/dist/components/Materializations/utils.d.ts +7 -4
  13. package/dist/components/Package/PackageProblems.d.ts +6 -0
  14. package/dist/index.cjs.js +38 -38
  15. package/dist/index.es.js +6176 -6665
  16. package/dist/{useCompiledDocument-Co-INO6B.cjs.js → useCompiledDocument-CQG6VO-x.cjs.js} +20 -20
  17. package/dist/{useCompiledDocument-CF5s0cXj.es.js → useCompiledDocument-CuSAYHX_.es.js} +56 -60
  18. package/package.json +1 -1
  19. package/src/components/Materializations/DeleteMaterializationDialog.tsx +5 -16
  20. package/src/components/Materializations/MaterializationRunsList.tsx +3 -5
  21. package/src/components/Materializations/Materializations.tsx +3 -13
  22. package/src/components/Materializations/Materializations.versions.spec.tsx +6 -3
  23. package/src/components/Materializations/TriggerLabel.tsx +2 -2
  24. package/src/components/Materializations/utils.spec.ts +6 -1
  25. package/src/components/Materializations/utils.ts +11 -5
  26. package/src/components/Package/PackageProblems.spec.tsx +25 -1
  27. package/src/components/Package/PackageProblems.tsx +30 -12
  28. package/dist/ServerProvider-D97_rUv5.cjs.js +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";const $=require("react/jsx-runtime"),de=require("@mui/material"),w=require("react"),u=require("./useCompiledDocument-Co-INO6B.cjs.js"),G=require("./ServerProvider-D97_rUv5.cjs.js"),v=u.reportClasses.drillCell;function me(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 j(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function be(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(),m=j(l);m&&t.has(i)&&o.add(m)}if(o.size===0)continue;const n=new Set;for(const l of r.querySelectorAll(`.${v}[tabindex="0"]`)){if(!a(l))continue;const i=j(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=j(l),m=!l.querySelector(".value-null")&&(l.textContent??"").trim()!=="";if(i&&m&&o.has(i)&&!l.querySelector(".malloy-table")){if(l.classList.add(v),l.tabIndex===0)n.add(i);else{const p=n.has(i);p||n.add(i),l.tabIndex=p?-1:0}l.setAttribute("role","button")}}}}function Ce(e){const t=e.closest(".malloy-table"),r=j(e);return!t||!r?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(a=>a.closest(".malloy-table")===t&&j(a)===r)}function ce(e,t){const r=Ce(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 fe(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 ye(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 pe(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 G.PER_MODE_COLOR_KEYS){const m=a.tag(i);if(!m)continue;const p={},C=m.text("light"),x=m.text("dark");C&&(p.light=C),x&&(p.dark=x),Object.keys(p).length>0&&(n[i]=p)}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 ee=e=>(e??[]).map(t=>t?.value).filter(t=>typeof t=="string");function Re(e){const t=e.replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const Te=e=>ee(e.annotations).some(t=>{const r=t.trim();return/^#[^("]/.test(r)&&/(?:^#|[\s{])label\s*=/.test(r)}),Ae=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Ee=e=>e.type?.element_type?.fields??e.type?.fields;function ge(e,t){let r=!1;return{fields:e.map(o=>{const n=Ee(o);if(n){const i=ge(n,u.requestsRowChart(ee(o.annotations)));if(!i.changed)return o;r=!0;const m=o.type?.element_type?{...o.type,element_type:{...o.type.element_type,fields:i.fields}}:{...o.type,fields:i.fields};return{...o,type:m}}if(!t||!o.name||Te(o))return o;const l=Re(o.name);return l===o.name?o:(r=!0,{...o,annotations:[{value:`# label=${Ae(l)}
1
+ "use strict";const $=require("react/jsx-runtime"),de=require("@mui/material"),w=require("react"),u=require("./useCompiledDocument-CQG6VO-x.cjs.js"),G=require("./ServerProvider-DDr5VOVF.cjs.js"),v=u.reportClasses.drillCell;function me(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 j(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function be(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(),m=j(l);m&&t.has(i)&&o.add(m)}if(o.size===0)continue;const n=new Set;for(const l of r.querySelectorAll(`.${v}[tabindex="0"]`)){if(!a(l))continue;const i=j(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=j(l),m=!l.querySelector(".value-null")&&(l.textContent??"").trim()!=="";if(i&&m&&o.has(i)&&!l.querySelector(".malloy-table")){if(l.classList.add(v),l.tabIndex===0)n.add(i);else{const p=n.has(i);p||n.add(i),l.tabIndex=p?-1:0}l.setAttribute("role","button")}}}}function Ce(e){const t=e.closest(".malloy-table"),r=j(e);return!t||!r?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(a=>a.closest(".malloy-table")===t&&j(a)===r)}function ce(e,t){const r=Ce(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 fe(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 ye(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 pe(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 G.PER_MODE_COLOR_KEYS){const m=a.tag(i);if(!m)continue;const p={},C=m.text("light"),x=m.text("dark");C&&(p.light=C),x&&(p.dark=x),Object.keys(p).length>0&&(n[i]=p)}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 ee=e=>(e??[]).map(t=>t?.value).filter(t=>typeof t=="string");function Re(e){const t=e.replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const Te=e=>ee(e.annotations).some(t=>{const r=t.trim();return/^#[^("]/.test(r)&&/(?:^#|[\s{])label\s*=/.test(r)}),Ae=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Ee=e=>e.type?.element_type?.fields??e.type?.fields;function ge(e,t){let r=!1;return{fields:e.map(o=>{const n=Ee(o);if(n){const i=ge(n,u.requestsRowChart(ee(o.annotations)));if(!i.changed)return o;r=!0;const m=o.type?.element_type?{...o.type,element_type:{...o.type.element_type,fields:i.fields}}:{...o.type,fields:i.fields};return{...o,type:m}}if(!t||!o.name||Te(o))return o;const l=Re(o.name);return l===o.name?o:(r=!0,{...o,annotations:[{value:`# label=${Ae(l)}
2
2
  `},...o.annotations??[]]})}),changed:r}}function Se(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}=ge(r,u.requestsRowChart(ee(t.annotations)));return o?{...t,schema:{...t.schema,fields:a}}:e}const ue=320,_e=10,De=96,Oe=4e3;function Fe(e,t){if(e!=="bar"&&e!=="combo"&&e!=="line"&&e!=="chart"&&e!=="scatter_chart")return;if(e!=="bar"&&e!=="combo")return ue;const r=t?.data?.array_value?.length,a=r===void 0?0:r*_e+De;return Math.min(Math.max(ue,a),Oe)}function Le(e){let t;return{onClick:r=>{const a={...r,...ze(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 ze(e){const t=e.field;try{const r=t?.getEffectiveQueryTimezone?.();return r?{timezone:r}:{}}catch{return{}}}function Ie(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 X;function ve(){if(X===void 0)try{X=new Function("return true")()===!0}catch{X=!1}return X}const Me=async(e,t,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:a}=await u.loadMalloyRenderer();return new a({onClick:t,...r?{onDrill:r,tableConfig:{enableDrill:!0}}:{},vegaConfigOverride:ye(e),...ve()?{}:{useVegaInterpreter:!0},theme:fe(e),onError:n=>{console.error("Error rendering visualization:",typeof n,n)}}).createViz()};async function $e(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 u.loadMalloyTag())}catch{return}try{const{tag:o}=a(r);return pe(o)}catch(o){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:o,lines:r});return}}function Be(e,t,r){const a=u.buildTableCssVars(t,r);for(const[o,n]of Object.entries(a))e.style.setProperty(o,n)}const je=`
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
@@ -1,8 +1,8 @@
1
1
  import { jsx as I } from "react/jsx-runtime";
2
2
  import { Box as de } from "@mui/material";
3
3
  import { Suspense as we, useRef as M, useMemo as ce, useEffect as ke, useLayoutEffect as xe } from "react";
4
- import { r as Ce, a as fe, D as Re, b as Z, T as V, l as Ee, c as Ae, d as Te, e as Se, R as _e, m as De, f as Oe, g as ue } from "./useCompiledDocument-CF5s0cXj.es.js";
5
- import { bx as Fe, bv as ze, by as Le, bz as Me } from "./ServerProvider-BHM9y5l0.es.js";
4
+ import { r as Ce, a as fe, D as Re, b as Z, T as V, l as Ee, c as Ae, d as Te, e as Se, R as _e, m as De, f as Fe, g as ue } from "./useCompiledDocument-CuSAYHX_.es.js";
5
+ import { bD as Oe, bB as ze, bE as Le, bF as Me } from "./ServerProvider-Be9eusDF.es.js";
6
6
  const g = Ce.drillCell;
7
7
  function Ie(e, t) {
8
8
  const r = /* @__PURE__ */ new Set();
@@ -140,7 +140,7 @@ function je(e) {
140
140
  if (a) {
141
141
  const n = {}, l = a.textArray("series");
142
142
  l && l.length > 0 && (n.series = l);
143
- for (const i of Fe) {
143
+ for (const i of Oe) {
144
144
  const h = a.tag(i);
145
145
  if (!h) continue;
146
146
  const y = {}, k = h.text("light"), w = h.text("dark");
@@ -538,7 +538,7 @@ function nt({
538
538
  const d = l.current, ge = W.current += 1;
539
539
  let U = !1;
540
540
  const Y = () => !U && ge === W.current;
541
- let c, b, P = null, G = 0, j = null, H = null, q = null, D = null, O = null, F = null, oe = null, ae = 0, A = null;
541
+ let c, b, P = null, G = 0, j = null, H = null, q = null, D = null, F = null, O = null, oe = null, ae = 0, A = null;
542
542
  k.current = !1;
543
543
  let p, T;
544
544
  const J = (v) => {
@@ -556,8 +556,8 @@ function nt({
556
556
  ue(p)
557
557
  );
558
558
  x && (x.style.overflowY = u ?? ""), L && d.setAttribute($, ""), S > 0 && (k.current = !0, a && S !== ae && (ae = S, a(S)));
559
- const C = Oe(v, ue(p));
560
- z && C && oe !== C && (oe = C, F?.disconnect(), F = new ResizeObserver(() => J(v)), F.observe(C));
559
+ const C = Fe(v, ue(p));
560
+ z && C && oe !== C && (oe = C, O?.disconnect(), O = new ResizeObserver(() => J(v)), O.observe(C));
561
561
  };
562
562
  return (async () => {
563
563
  let v;
@@ -587,7 +587,7 @@ function nt({
587
587
  c = document.createElement("div"), c.style.width = "100%", c.style.height = "100%", rt(c, L, re), d.childElementCount > 0 && (d.style.position = "relative", c.style.position = "absolute", c.style.inset = "0", c.style.visibility = "hidden"), d.appendChild(c);
588
588
  const u = c;
589
589
  D = new MutationObserver(() => {
590
- O && clearTimeout(O), O = setTimeout(() => {
590
+ F && clearTimeout(F), F = setTimeout(() => {
591
591
  J(u), k.current && D?.disconnect();
592
592
  }, 100);
593
593
  }), D.observe(c, {
@@ -669,10 +669,10 @@ function nt({
669
669
  }
670
670
  b.onReady(ne), A = setTimeout(ne, 1e4);
671
671
  } catch (m) {
672
- console.error("Error rendering visualization:", m), D?.disconnect(), F?.disconnect(), P?.disconnect(), b.remove(), b = void 0, u.parentNode === d && d.removeChild(u);
672
+ console.error("Error rendering visualization:", m), D?.disconnect(), O?.disconnect(), P?.disconnect(), b.remove(), b = void 0, u.parentNode === d && d.removeChild(u);
673
673
  }
674
674
  })(), () => {
675
- U = !0, D?.disconnect(), F?.disconnect(), O && clearTimeout(O), A && clearTimeout(A), c && w.current?.node !== c && (j && c.removeEventListener("keydown", j), H && c.removeEventListener("keyup", H), q && c.removeEventListener("focusin", q), P?.disconnect(), cancelAnimationFrame(G), b?.remove(), c.parentNode === d && d.removeChild(c), d.style.position = "");
675
+ U = !0, D?.disconnect(), O?.disconnect(), F && clearTimeout(F), A && clearTimeout(A), c && w.current?.node !== c && (j && c.removeEventListener("keydown", j), H && c.removeEventListener("keyup", H), q && c.removeEventListener("focusin", q), P?.disconnect(), cancelAnimationFrame(G), b?.remove(), c.parentNode === d && d.removeChild(c), d.style.position = "");
676
676
  };
677
677
  }, [
678
678
  e,