@malloydata/render 0.0.355 → 0.0.356
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.
|
@@ -12,6 +12,7 @@ export declare class MalloyViz {
|
|
|
12
12
|
private logCollector;
|
|
13
13
|
private readyCallbacks;
|
|
14
14
|
private isReady;
|
|
15
|
+
private unreadTagsCollected;
|
|
15
16
|
constructor(options: MalloyRendererOptions, pluginRegistry?: RenderPluginFactory[]);
|
|
16
17
|
static addStylesheet(styles: string): void;
|
|
17
18
|
getHTML(): Promise<string>;
|
|
@@ -31,15 +32,13 @@ export declare class MalloyViz {
|
|
|
31
32
|
*/
|
|
32
33
|
onReady(callback: () => void): void;
|
|
33
34
|
/**
|
|
34
|
-
* Get log messages
|
|
35
|
-
* Includes warnings for unread (unknown) tags and semantic errors.
|
|
36
|
-
* For complete results including unread tag warnings,
|
|
37
|
-
* call this from an `onReady` callback.
|
|
35
|
+
* Get log messages including semantic errors and unread tag warnings.
|
|
38
36
|
*/
|
|
39
37
|
getLogs(): Malloy.LogMessage[];
|
|
40
38
|
private handleReady;
|
|
41
39
|
/**
|
|
42
40
|
* Walk all field tags and collect warnings for unread properties.
|
|
41
|
+
* Safe to call multiple times; only collects once.
|
|
43
42
|
*/
|
|
44
43
|
private collectUnreadTagWarnings;
|
|
45
44
|
}
|
package/dist/module/index.mjs
CHANGED
|
@@ -122027,7 +122027,7 @@ const LXe = {
|
|
|
122027
122027
|
};
|
|
122028
122028
|
class Pa {
|
|
122029
122029
|
constructor(t, n = []) {
|
|
122030
|
-
this.options = t, this.disposeFn = null, this.targetElement = null, this.result = null, this.metadata = null, this.logCollector = new Mq(), this.readyCallbacks = [], this.isReady = !1, this.options = t, this.pluginRegistry = [...n];
|
|
122030
|
+
this.options = t, this.disposeFn = null, this.targetElement = null, this.result = null, this.metadata = null, this.logCollector = new Mq(), this.readyCallbacks = [], this.isReady = !1, this.unreadTagsCollected = !1, this.options = t, this.pluginRegistry = [...n];
|
|
122031
122031
|
}
|
|
122032
122032
|
static addStylesheet(t) {
|
|
122033
122033
|
if (!Array.from(document.head.getElementsByTagName("style")).find((r) => r.textContent === t)) {
|
|
@@ -122139,13 +122139,10 @@ class Pa {
|
|
|
122139
122139
|
this.isReady ? t() : this.readyCallbacks.push(t);
|
|
122140
122140
|
}
|
|
122141
122141
|
/**
|
|
122142
|
-
* Get log messages
|
|
122143
|
-
* Includes warnings for unread (unknown) tags and semantic errors.
|
|
122144
|
-
* For complete results including unread tag warnings,
|
|
122145
|
-
* call this from an `onReady` callback.
|
|
122142
|
+
* Get log messages including semantic errors and unread tag warnings.
|
|
122146
122143
|
*/
|
|
122147
122144
|
getLogs() {
|
|
122148
|
-
return this.logCollector.getLogs();
|
|
122145
|
+
return this.collectUnreadTagWarnings(), this.logCollector.getLogs();
|
|
122149
122146
|
}
|
|
122150
122147
|
handleReady() {
|
|
122151
122148
|
this.isReady = !0, this.collectUnreadTagWarnings();
|
|
@@ -122155,11 +122152,14 @@ class Pa {
|
|
|
122155
122152
|
}
|
|
122156
122153
|
/**
|
|
122157
122154
|
* Walk all field tags and collect warnings for unread properties.
|
|
122155
|
+
* Safe to call multiple times; only collects once.
|
|
122158
122156
|
*/
|
|
122159
122157
|
collectUnreadTagWarnings() {
|
|
122160
|
-
if (this.metadata)
|
|
122158
|
+
if (!(this.unreadTagsCollected || !this.metadata)) {
|
|
122159
|
+
this.unreadTagsCollected = !0;
|
|
122161
122160
|
for (const t of this.metadata.getAllFields())
|
|
122162
122161
|
this.logCollector.collectUnreadTags(t.tag, t.name);
|
|
122162
|
+
}
|
|
122163
122163
|
}
|
|
122164
122164
|
}
|
|
122165
122165
|
function I1(e, t, n) {
|
package/dist/module/index.umd.js
CHANGED
|
@@ -695,7 +695,7 @@ ${n.map(i=>` ${i}`).join(`,
|
|
|
695
695
|
--malloy-render--table-pinned-border: ${d};
|
|
696
696
|
--malloy-render--background: ${m};
|
|
697
697
|
|
|
698
|
-
`}const uXe={name:"error",type:{kind:"string_type"},annotations:[]},cXe=new Bd(uXe,void 0),Mie={create:e=>({name:"error",field:cXe,renderMode:"solidjs",sizingStrategy:"fill",renderComponent:t=>te(Cie,{message:e}),getMetadata:()=>({message:e})})};class Pa{constructor(t,n=[]){this.options=t,this.disposeFn=null,this.targetElement=null,this.result=null,this.metadata=null,this.logCollector=new gR,this.readyCallbacks=[],this.isReady=!1,this.options=t,this.pluginRegistry=[...n]}static addStylesheet(t){if(!Array.from(document.head.getElementsByTagName("style")).find(r=>r.textContent===t)){const r=document.createElement("style");r.setAttribute("data-malloy-viz","true"),r.textContent=t,document.head.appendChild(r)}}async getHTML(){if(!this.result)throw new Error("No result to copy");if(!this.targetElement)throw new Error("No element to copy from");const t=this.targetElement.getBoundingClientRect();if(!t)throw new Error("No target element to measure");const n=document.createElement("div");n.style.position="absolute",n.style.left="-9999px",n.style.top="-9999px",n.style.width=`${Math.round(t.width)}px`,n.style.height=`${Math.round(t.height)}px`,document.body.appendChild(n);try{const r=new Pa({...this.options,tableConfig:{...this.options.tableConfig,disableVirtualization:!0},dashboardConfig:{...this.options.dashboardConfig,disableVirtualization:!0}});r.setResult(this.result),r.render(n),await new Promise(c=>setTimeout(c,1e3));const i=n.innerHTML,s=Array.from(document.head.getElementsByTagName("style")).filter(c=>c.getAttribute("data-malloy-viz")==="true").map(c=>c.textContent).join(`
|
|
698
|
+
`}const uXe={name:"error",type:{kind:"string_type"},annotations:[]},cXe=new Bd(uXe,void 0),Mie={create:e=>({name:"error",field:cXe,renderMode:"solidjs",sizingStrategy:"fill",renderComponent:t=>te(Cie,{message:e}),getMetadata:()=>({message:e})})};class Pa{constructor(t,n=[]){this.options=t,this.disposeFn=null,this.targetElement=null,this.result=null,this.metadata=null,this.logCollector=new gR,this.readyCallbacks=[],this.isReady=!1,this.unreadTagsCollected=!1,this.options=t,this.pluginRegistry=[...n]}static addStylesheet(t){if(!Array.from(document.head.getElementsByTagName("style")).find(r=>r.textContent===t)){const r=document.createElement("style");r.setAttribute("data-malloy-viz","true"),r.textContent=t,document.head.appendChild(r)}}async getHTML(){if(!this.result)throw new Error("No result to copy");if(!this.targetElement)throw new Error("No element to copy from");const t=this.targetElement.getBoundingClientRect();if(!t)throw new Error("No target element to measure");const n=document.createElement("div");n.style.position="absolute",n.style.left="-9999px",n.style.top="-9999px",n.style.width=`${Math.round(t.width)}px`,n.style.height=`${Math.round(t.height)}px`,document.body.appendChild(n);try{const r=new Pa({...this.options,tableConfig:{...this.options.tableConfig,disableVirtualization:!0},dashboardConfig:{...this.options.dashboardConfig,disableVirtualization:!0}});r.setResult(this.result),r.render(n),await new Promise(c=>setTimeout(c,1e3));const i=n.innerHTML,s=Array.from(document.head.getElementsByTagName("style")).filter(c=>c.getAttribute("data-malloy-viz")==="true").map(c=>c.textContent).join(`
|
|
699
699
|
`),a=this.targetElement.getBoundingClientRect(),o=Math.round(a.width),l=Math.round(a.height),u=`
|
|
700
700
|
<div style="width: ${o}px; height: ${l}px;">
|
|
701
701
|
<style>
|
|
@@ -705,7 +705,7 @@ ${n.map(i=>` ${i}`).join(`,
|
|
|
705
705
|
${i}
|
|
706
706
|
</div>
|
|
707
707
|
</div>
|
|
708
|
-
`;return r.remove(),u}catch{return"Malloy Renderer could not be exported to HTML"}finally{document.body.removeChild(n)}}async copyToHTML(){const t=await this.getHTML();await navigator.clipboard.writeText(t)}setResult(t){this.result=t,this.result&&(this.metadata=new bR(this.result,this.pluginRegistry,this.options.pluginOptions??{},(n,r,i,s)=>{const a=Mie.create(n.message);s.push(a)},this.logCollector))}render(t){if(!this.result||!this.metadata)throw new Error("Malloy Viz: No result to render");this.disposeFn&&this.disposeFn();const n=t||this.targetElement;if(!n)throw new Error("Malloy viz requires a target HTML element to render");this.targetElement=n,this.isReady=!1;const r={result:this.result,element:this.targetElement,onClick:this.options.onClick,onDrill:this.options.onDrill,onError:this.options.onError,vegaConfigOverride:this.options.vegaConfigOverride,tableConfig:this.options.tableConfig,dashboardConfig:this.options.dashboardConfig,modalElement:this.options.modalElement,scrollEl:this.options.scrollEl,renderFieldMetadata:this.metadata,useVegaInterpreter:this.options.useVegaInterpreter,onReady:()=>this.handleReady()};this.disposeFn=xGe(()=>te(aXe,r),this.targetElement)}remove(){this.disposeFn&&(this.disposeFn(),this.disposeFn=null),this.targetElement=null}updateOptions(t){this.options={...this.options,...t}}getMetadata(){return this.metadata}getActivePlugin(t){if(!this.metadata)return null;const n=this.metadata.getPluginsForField(t);return(n==null?void 0:n.at(0))??null}onReady(t){this.isReady?t():this.readyCallbacks.push(t)}getLogs(){return this.logCollector.getLogs()}handleReady(){this.isReady=!0,this.collectUnreadTagWarnings();for(const t of this.readyCallbacks)t();this.readyCallbacks=[]}collectUnreadTagWarnings(){if(this.metadata)for(const t of this.metadata.getAllFields())this.logCollector.collectUnreadTags(t.tag,t.name)}}function L1(e,t,n){return e.fields=t||[],e.fname=n,e}function fXe(e){return e.length===1?dXe(e[0]):hXe(e)}const dXe=e=>function(t){return t[e]},hXe=e=>{const t=e.length;return function(n){for(let r=0;r<t;++r)n=n[e[r]];return n}};function bT(e){throw Error(e)}function mXe(e){const t=[],n=e.length;let r=null,i=0,s="",a,o,l;e=e+"";function u(){t.push(s+e.substring(a,o)),s="",a=o+1}for(a=o=0;o<n;++o)if(l=e[o],l==="\\")s+=e.substring(a,o++),a=o;else if(l===r)u(),r=null,i=-1;else{if(r)continue;a===i&&l==='"'||a===i&&l==="'"?(a=o+1,r=l):l==="."&&!i?o>a?u():a=o+1:l==="["?(o>a&&u(),i=a=o+1):l==="]"&&(i||bT("Access path missing open bracket: "+e),i>0&&u(),i=0,a=o+1)}return i&&bT("Access path missing closing bracket: "+e),r&&bT("Access path missing closing quote: "+e),o>a&&(o++,u()),t}function pXe(e,t,n){const r=mXe(e);return e=r.length===1?r[0]:e,L1(fXe(r),[e],e)}pXe("id"),L1(e=>e,[],"identity"),L1(()=>0,[],"zero"),L1(()=>1,[],"one"),L1(()=>!0,[],"true"),L1(()=>!1,[],"false");const gXe=new Set([...Object.getOwnPropertyNames(Object.prototype).filter(e=>typeof Object.prototype[e]=="function"),"__proto__"]),yXe=(e,t)=>(e<t||e==null)&&t!=null?-1:(e>t||t==null)&&e!=null?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t===t?-1:t!==t&&e===e?1:0);function bXe(e){return typeof e=="string"}function vXe(e,t,n){let r;t.x2&&(t.x?(n&&e.x>e.x2&&(r=e.x,e.x=e.x2,e.x2=r),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(r=e.y,e.y=e.y2,e.y2=r),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}var xXe={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},wXe={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<<t,">>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},$Xe={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const SXe=Array.prototype.slice,yd=(e,t,n)=>{const r=n?n(t[0]):t[0];return r[e].apply(r,SXe.call(t,1))},_Xe=(e,t=0,n=1,r=0,i=0,s=0,a=0)=>bXe(e)?new Date(e):new Date(e,t,n,r,i,s,a);var kXe={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:_Xe,date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return yd("join",arguments)},indexof:function(){return yd("indexOf",arguments)},lastindexof:function(){return yd("lastIndexOf",arguments)},slice:function(){return yd("slice",arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(yXe),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return yd("substring",arguments,String)},split:function(){return yd("split",arguments,String)},replace:function(){return yd("replace",arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const EXe=["view","item","group","xy","x","y"],vT=new Set([Function,eval,setTimeout,setInterval]);typeof setImmediate=="function"&&vT.add(setImmediate);const CXe={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:n==="datum"?e.datum:n==="event"?e.event:n==="item"?e.item:xXe[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,r=e(t.object);n&&(e.memberDepth+=1);const i=e(t.property);if(n&&(e.memberDepth-=1),vT.has(r[i])){console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`);return}return r[i]},CallExpression:(e,t)=>{const n=t.arguments;let r=t.callee.name;return r.startsWith("_")&&(r=r.slice(1)),r==="if"?e(n[0])?e(n[1]):e(n[2]):(e.fn[r]||kXe[r]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>wXe[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>$Xe[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>t.operator==="&&"?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce((n,r)=>{e.memberDepth+=1;const i=e(r.key);e.memberDepth-=1;const s=e(r.value);return gXe.has(i)?console.error(`Prevented interpretation of property "${i}" which could lead to insecure code execution`):vT.has(s)?console.error(`Prevented interpretation of method "${i}" which could lead to insecure code execution`):n[i]=s,n},{})};function f2(e,t,n,r,i,s){const a=o=>CXe[o.type](a,o);return a.memberDepth=0,a.fn=Object.create(t),a.params=n,a.datum=r,a.event=i,a.item=s,EXe.forEach(o=>a.fn[o]=(...l)=>i.vega[o](...l)),a(e)}var AXe={operator(e,t){const n=t.ast,r=e.functions;return i=>f2(n,r,i)},parameter(e,t){const n=t.ast,r=e.functions;return(i,s)=>f2(n,r,s,i)},event(e,t){const n=t.ast,r=e.functions;return i=>f2(n,r,void 0,void 0,i)},handler(e,t){const n=t.ast,r=e.functions;return(i,s)=>{const a=s.item&&s.item.datum;return f2(n,r,i,a,s)}},encode(e,t){const{marktype:n,channels:r}=t,i=e.functions,s=n==="group"||n==="image"||n==="rect";return(a,o)=>{const l=a.datum;let u=0,c;for(const f in r)c=f2(r[f].ast,i,o,l,void 0,a),a[f]!==c&&(a[f]=c,u=1);return n!=="rule"&&vXe(a,r,s),u}}};Mt("renderMalloyNumber")||Mt("renderMalloyNumber",(e,t,n)=>{if(e){const r=e.fieldAt(t);return r.isBasic()?Cc(r,n):String(n)}return String(n)}),Mt("renderMalloyTime")||Mt("renderMalloyTime",(e,t,n,r)=>{if(e){const i=e.fieldAt(t);if(i.isTime()){const s={isDate:i.isDate(),timeframe:i.timeframe};return r&&(s.extractFormat=r),Wo(i,new Date(n),s)}}return String(n)}),Mt("getMalloyBrush")||Mt("getMalloyBrush",(e,t,n)=>{var i;const r=Array.isArray(t)?t:[t];return((i=e.find(s=>{const a=r.includes(s.fieldRefId),o=n?s.type===n:!0;return a&&o}))==null?void 0:i.value)??null}),Mt("getMalloyMeasureBrushes")||Mt("getMalloyMeasureBrushes",(e,t,n)=>e.filter(r=>t.includes(r.fieldRefId)).map(r=>({...r,fieldPath:n[r.fieldRefId]}))??[]),Mt("snapValue")||Mt("snapValue",(e,t,n)=>{const r=e[0],s=(e[1]-r)/t;return Math.round(n/s)*s});function Fie(e,t){const n=e.getState().signals;return n&&Object.prototype.hasOwnProperty.call(n,t)}function MXe(e,t,n){Fie(e,t)&&e.addSignalListener(t,n)}function Tie(e,t,n){Fie(e,t)&&e.signal(t,n)}function Rx(e){return e.mark.name??""}var FXe=ke("<div>");function TXe(e){let t;const[n,r]=kn(null);let i=null,s=Promise.resolve(null);const a=()=>{i&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{const o=n();o&&(s=s.then(l=>(l==null?void 0:l.runAsync())||o.runAsync()))})};return Ns(()=>{var o;n()&&((o=e.onViewInterface)==null||o.call(e,{view:n(),setSignalAndRun:(l,u)=>{Tie(n(),l,u),a()},onSignal:(l,u)=>MXe(n(),l,u)}))}),Ns(()=>{var c;const o=Ii(()=>n());o&&o.finalize();const l=e.useVegaInterpreter?{expr:AXe}:{},u=new w1(e.runtime,l).initialize(t).renderer("svg");Tie(u,"malloyExplore",e.explore),e.onMouseOver&&u.addEventListener("mousemove",e.onMouseOver),u.run(),r(u),(c=e.onView)==null||c.call(e,u)}),Ns(sGe([()=>e.width,()=>e.height,n],([o,l,u])=>{u&&(o&&u.width(o),l&&u.height(l),u.run())})),(()=>{var o=FXe(),l=t;return typeof l=="function"?zs(l,o):t=o,o})()}var DXe=ke("<div>");function OXe(e){const t=yc();return te(_Ge,{get mount(){return t.modalElement},get children(){var n=DXe(),r=e.ref;return typeof r=="function"?zs(r,n):e.ref=n,ae(n,()=>e.children),rt(i=>Is(n,e.style,i)),n}})}const RXe=`/*
|
|
708
|
+
`;return r.remove(),u}catch{return"Malloy Renderer could not be exported to HTML"}finally{document.body.removeChild(n)}}async copyToHTML(){const t=await this.getHTML();await navigator.clipboard.writeText(t)}setResult(t){this.result=t,this.result&&(this.metadata=new bR(this.result,this.pluginRegistry,this.options.pluginOptions??{},(n,r,i,s)=>{const a=Mie.create(n.message);s.push(a)},this.logCollector))}render(t){if(!this.result||!this.metadata)throw new Error("Malloy Viz: No result to render");this.disposeFn&&this.disposeFn();const n=t||this.targetElement;if(!n)throw new Error("Malloy viz requires a target HTML element to render");this.targetElement=n,this.isReady=!1;const r={result:this.result,element:this.targetElement,onClick:this.options.onClick,onDrill:this.options.onDrill,onError:this.options.onError,vegaConfigOverride:this.options.vegaConfigOverride,tableConfig:this.options.tableConfig,dashboardConfig:this.options.dashboardConfig,modalElement:this.options.modalElement,scrollEl:this.options.scrollEl,renderFieldMetadata:this.metadata,useVegaInterpreter:this.options.useVegaInterpreter,onReady:()=>this.handleReady()};this.disposeFn=xGe(()=>te(aXe,r),this.targetElement)}remove(){this.disposeFn&&(this.disposeFn(),this.disposeFn=null),this.targetElement=null}updateOptions(t){this.options={...this.options,...t}}getMetadata(){return this.metadata}getActivePlugin(t){if(!this.metadata)return null;const n=this.metadata.getPluginsForField(t);return(n==null?void 0:n.at(0))??null}onReady(t){this.isReady?t():this.readyCallbacks.push(t)}getLogs(){return this.collectUnreadTagWarnings(),this.logCollector.getLogs()}handleReady(){this.isReady=!0,this.collectUnreadTagWarnings();for(const t of this.readyCallbacks)t();this.readyCallbacks=[]}collectUnreadTagWarnings(){if(!(this.unreadTagsCollected||!this.metadata)){this.unreadTagsCollected=!0;for(const t of this.metadata.getAllFields())this.logCollector.collectUnreadTags(t.tag,t.name)}}}function L1(e,t,n){return e.fields=t||[],e.fname=n,e}function fXe(e){return e.length===1?dXe(e[0]):hXe(e)}const dXe=e=>function(t){return t[e]},hXe=e=>{const t=e.length;return function(n){for(let r=0;r<t;++r)n=n[e[r]];return n}};function bT(e){throw Error(e)}function mXe(e){const t=[],n=e.length;let r=null,i=0,s="",a,o,l;e=e+"";function u(){t.push(s+e.substring(a,o)),s="",a=o+1}for(a=o=0;o<n;++o)if(l=e[o],l==="\\")s+=e.substring(a,o++),a=o;else if(l===r)u(),r=null,i=-1;else{if(r)continue;a===i&&l==='"'||a===i&&l==="'"?(a=o+1,r=l):l==="."&&!i?o>a?u():a=o+1:l==="["?(o>a&&u(),i=a=o+1):l==="]"&&(i||bT("Access path missing open bracket: "+e),i>0&&u(),i=0,a=o+1)}return i&&bT("Access path missing closing bracket: "+e),r&&bT("Access path missing closing quote: "+e),o>a&&(o++,u()),t}function pXe(e,t,n){const r=mXe(e);return e=r.length===1?r[0]:e,L1(fXe(r),[e],e)}pXe("id"),L1(e=>e,[],"identity"),L1(()=>0,[],"zero"),L1(()=>1,[],"one"),L1(()=>!0,[],"true"),L1(()=>!1,[],"false");const gXe=new Set([...Object.getOwnPropertyNames(Object.prototype).filter(e=>typeof Object.prototype[e]=="function"),"__proto__"]),yXe=(e,t)=>(e<t||e==null)&&t!=null?-1:(e>t||t==null)&&e!=null?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t===t?-1:t!==t&&e===e?1:0);function bXe(e){return typeof e=="string"}function vXe(e,t,n){let r;t.x2&&(t.x?(n&&e.x>e.x2&&(r=e.x,e.x=e.x2,e.x2=r),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(r=e.y,e.y=e.y2,e.y2=r),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}var xXe={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},wXe={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<<t,">>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},$Xe={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const SXe=Array.prototype.slice,yd=(e,t,n)=>{const r=n?n(t[0]):t[0];return r[e].apply(r,SXe.call(t,1))},_Xe=(e,t=0,n=1,r=0,i=0,s=0,a=0)=>bXe(e)?new Date(e):new Date(e,t,n,r,i,s,a);var kXe={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:_Xe,date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return yd("join",arguments)},indexof:function(){return yd("indexOf",arguments)},lastindexof:function(){return yd("lastIndexOf",arguments)},slice:function(){return yd("slice",arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(yXe),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return yd("substring",arguments,String)},split:function(){return yd("split",arguments,String)},replace:function(){return yd("replace",arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const EXe=["view","item","group","xy","x","y"],vT=new Set([Function,eval,setTimeout,setInterval]);typeof setImmediate=="function"&&vT.add(setImmediate);const CXe={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:n==="datum"?e.datum:n==="event"?e.event:n==="item"?e.item:xXe[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,r=e(t.object);n&&(e.memberDepth+=1);const i=e(t.property);if(n&&(e.memberDepth-=1),vT.has(r[i])){console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`);return}return r[i]},CallExpression:(e,t)=>{const n=t.arguments;let r=t.callee.name;return r.startsWith("_")&&(r=r.slice(1)),r==="if"?e(n[0])?e(n[1]):e(n[2]):(e.fn[r]||kXe[r]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>wXe[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>$Xe[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>t.operator==="&&"?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce((n,r)=>{e.memberDepth+=1;const i=e(r.key);e.memberDepth-=1;const s=e(r.value);return gXe.has(i)?console.error(`Prevented interpretation of property "${i}" which could lead to insecure code execution`):vT.has(s)?console.error(`Prevented interpretation of method "${i}" which could lead to insecure code execution`):n[i]=s,n},{})};function f2(e,t,n,r,i,s){const a=o=>CXe[o.type](a,o);return a.memberDepth=0,a.fn=Object.create(t),a.params=n,a.datum=r,a.event=i,a.item=s,EXe.forEach(o=>a.fn[o]=(...l)=>i.vega[o](...l)),a(e)}var AXe={operator(e,t){const n=t.ast,r=e.functions;return i=>f2(n,r,i)},parameter(e,t){const n=t.ast,r=e.functions;return(i,s)=>f2(n,r,s,i)},event(e,t){const n=t.ast,r=e.functions;return i=>f2(n,r,void 0,void 0,i)},handler(e,t){const n=t.ast,r=e.functions;return(i,s)=>{const a=s.item&&s.item.datum;return f2(n,r,i,a,s)}},encode(e,t){const{marktype:n,channels:r}=t,i=e.functions,s=n==="group"||n==="image"||n==="rect";return(a,o)=>{const l=a.datum;let u=0,c;for(const f in r)c=f2(r[f].ast,i,o,l,void 0,a),a[f]!==c&&(a[f]=c,u=1);return n!=="rule"&&vXe(a,r,s),u}}};Mt("renderMalloyNumber")||Mt("renderMalloyNumber",(e,t,n)=>{if(e){const r=e.fieldAt(t);return r.isBasic()?Cc(r,n):String(n)}return String(n)}),Mt("renderMalloyTime")||Mt("renderMalloyTime",(e,t,n,r)=>{if(e){const i=e.fieldAt(t);if(i.isTime()){const s={isDate:i.isDate(),timeframe:i.timeframe};return r&&(s.extractFormat=r),Wo(i,new Date(n),s)}}return String(n)}),Mt("getMalloyBrush")||Mt("getMalloyBrush",(e,t,n)=>{var i;const r=Array.isArray(t)?t:[t];return((i=e.find(s=>{const a=r.includes(s.fieldRefId),o=n?s.type===n:!0;return a&&o}))==null?void 0:i.value)??null}),Mt("getMalloyMeasureBrushes")||Mt("getMalloyMeasureBrushes",(e,t,n)=>e.filter(r=>t.includes(r.fieldRefId)).map(r=>({...r,fieldPath:n[r.fieldRefId]}))??[]),Mt("snapValue")||Mt("snapValue",(e,t,n)=>{const r=e[0],s=(e[1]-r)/t;return Math.round(n/s)*s});function Fie(e,t){const n=e.getState().signals;return n&&Object.prototype.hasOwnProperty.call(n,t)}function MXe(e,t,n){Fie(e,t)&&e.addSignalListener(t,n)}function Tie(e,t,n){Fie(e,t)&&e.signal(t,n)}function Rx(e){return e.mark.name??""}var FXe=ke("<div>");function TXe(e){let t;const[n,r]=kn(null);let i=null,s=Promise.resolve(null);const a=()=>{i&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{const o=n();o&&(s=s.then(l=>(l==null?void 0:l.runAsync())||o.runAsync()))})};return Ns(()=>{var o;n()&&((o=e.onViewInterface)==null||o.call(e,{view:n(),setSignalAndRun:(l,u)=>{Tie(n(),l,u),a()},onSignal:(l,u)=>MXe(n(),l,u)}))}),Ns(()=>{var c;const o=Ii(()=>n());o&&o.finalize();const l=e.useVegaInterpreter?{expr:AXe}:{},u=new w1(e.runtime,l).initialize(t).renderer("svg");Tie(u,"malloyExplore",e.explore),e.onMouseOver&&u.addEventListener("mousemove",e.onMouseOver),u.run(),r(u),(c=e.onView)==null||c.call(e,u)}),Ns(sGe([()=>e.width,()=>e.height,n],([o,l,u])=>{u&&(o&&u.width(o),l&&u.height(l),u.run())})),(()=>{var o=FXe(),l=t;return typeof l=="function"?zs(l,o):t=o,o})()}var DXe=ke("<div>");function OXe(e){const t=yc();return te(_Ge,{get mount(){return t.modalElement},get children(){var n=DXe(),r=e.ref;return typeof r=="function"?zs(r,n):e.ref=n,ae(n,()=>e.children),rt(i=>Is(n,e.style,i)),n}})}const RXe=`/*
|
|
709
709
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
710
710
|
*
|
|
711
711
|
* This source code is licensed under the MIT license found in the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/render",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.356",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/module/index.umd.js",
|
|
6
6
|
"types": "dist/module/index.d.ts",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"generate-flow": "ts-node ../../scripts/gen-flow.ts"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@malloydata/malloy-interfaces": "0.0.
|
|
33
|
-
"@malloydata/malloy-tag": "0.0.
|
|
32
|
+
"@malloydata/malloy-interfaces": "0.0.356",
|
|
33
|
+
"@malloydata/malloy-tag": "0.0.356",
|
|
34
34
|
"@tanstack/solid-virtual": "^3.10.4",
|
|
35
35
|
"lodash": "^4.17.20",
|
|
36
36
|
"luxon": "^3.5.0",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"vega-lite": "^5.2.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@malloydata/db-duckdb": "0.0.
|
|
46
|
-
"@malloydata/malloy": "0.0.
|
|
45
|
+
"@malloydata/db-duckdb": "0.0.356",
|
|
46
|
+
"@malloydata/malloy": "0.0.356",
|
|
47
47
|
"@storybook/addon-essentials": "^8.6.15",
|
|
48
48
|
"@storybook/addon-interactions": "^8.6.15",
|
|
49
49
|
"@storybook/addon-links": "^8.6.15",
|