diff --git a/lib/assets/vega_lite/build/main.js b/lib/assets/vega_lite/build/main.js index 3d3eadf..ca6defa 100644 --- a/lib/assets/vega_lite/build/main.js +++ b/lib/assets/vega_lite/build/main.js @@ -190,12 +190,12 @@ var YB=Object.create;var z2=Object.defineProperty;var XB=Object.getOwnPropertyDe -`,xhe="chart-wrapper";function bhe(e){return typeof e=="function"}function $B(e,t,n,r){let i=`${t}
`,o=`
${n}`,a=window.open("");a.document.write(i+e+o),a.document.title=`${s0[r]} JSON Source`}function vhe(e,t){if(e.$schema){let n=HT(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${s0[n.library]}, but mode argument sets ${s0[t]??t}.`);let r=n.library;return jB(L2[r],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${s0[r]} ${n.version}, but the current version of ${s0[r]} is v${L2[r]}.`),r}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":t??"vega"}function HB(e){return!!(e&&"load"in e)}function PB(e){return HB(e)?e:Na.loader(e)}function whe(e){let t=e.usermeta?.embedOptions??{};return q(t.defaultStyle)&&(t.defaultStyle=!1),t}async function WB(e,t,n={}){let r,i;q(t)?(i=PB(n.loader),r=JSON.parse(await i.load(t))):r=t;let o=whe(r),a=o.loader;(!i||a)&&(i=PB(n.loader??a));let s=await LB(o,i),l=await LB(n,i),u={...qB(l,s),config:Ho(l.config??{},s.config??{})};return await She(e,r,u,i)}async function LB(e,t){let n=q(e.config)?JSON.parse(await t.load(e.config)):e.config??{},r=q(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return{...e,...r?{patch:r}:{},...n?{config:n}:{}}}function Ehe(e){let t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}async function She(e,t,n={},r){let i=n.theme?Ho(KT[n.theme],n.config??{}):n.config,o=Tr(n.actions)?n.actions:qB({},mhe,n.actions??{}),a={...hhe,...n.i18n},s=n.renderer??"canvas",l=n.logLevel??Na.Warn,u=n.downloadFileName??"visualization",f=typeof e=="string"?document.querySelector(e):e;if(!f)throw new Error(`${e} does not exist`);if(n.defaultStyle!==!1){let w="vega-embed-style",{root:S,rootContainer:E}=Ehe(f);if(!S.getElementById(w)){let _=document.createElement("style");_.id=w,_.innerHTML=n.defaultStyle===void 0||n.defaultStyle===!0?Hme.toString():n.defaultStyle,E.appendChild(_)}}let c=vhe(t,n.mode),d=ghe[c](t,i);if(c==="vega-lite"&&d.$schema){let w=HT(d.$schema);jB(L2.vega,`^${w.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${w.version}, but current version is v${L2.vega}.`)}f.classList.add("vega-embed"),o&&f.classList.add("has-actions"),f.innerHTML="";let p=f;if(o){let w=document.createElement("div");w.classList.add(xhe),f.appendChild(w),p=w}let m=n.patch;if(m&&(d=m instanceof Function?m(d):Bf(d,m,!0,!1).newDocument),n.formatLocale&&Na.formatLocale(n.formatLocale),n.timeFormatLocale&&Na.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(let w in n.expressionFunctions){let S=n.expressionFunctions[w];"fn"in S?Na.expressionFunction(w,S.fn,S.visitor):S instanceof Function&&Na.expressionFunction(w,S)}let{ast:h}=n,g=Na.parse(d,c==="vega-lite"?{}:i,{ast:h}),y=new(n.viewClass||Na.View)(g,{loader:r,logLevel:l,renderer:s,...h?{expr:Na.expressionInterpreter??n.expr??Z4}:{}});if(y.addSignalListener("autosize",(w,S)=>{let{type:E}=S;E=="fit-x"?(p.classList.add("fit-x"),p.classList.remove("fit-y")):E=="fit-y"?(p.classList.remove("fit-x"),p.classList.add("fit-y")):E=="fit"?p.classList.add("fit-x","fit-y"):p.classList.remove("fit-x","fit-y")}),n.tooltip!==!1){let{loader:w,tooltip:S}=n,E=w&&!HB(w)?w?.baseURL:void 0,_=bhe(S)?S:new N2({baseURL:E,...S===!0?{}:S}).call;y.tooltip(_)}let{hover:x}=n;if(x===void 0&&(x=c==="vega"),x){let{hoverSet:w,updateSet:S}=typeof x=="boolean"?{}:x;y.hover(w,S)}n&&(n.width!=null&&y.width(n.width),n.height!=null&&y.height(n.height),n.padding!=null&&y.padding(n.padding)),await y.initialize(p,n.bind).runAsync();let b;if(o!==!1){let w=f;if(n.defaultStyle!==!1||n.forceActionsMenu){let E=document.createElement("details");E.title=a.CLICK_TO_VIEW_ACTIONS,f.append(E),w=E;let _=document.createElement("summary");_.innerHTML=yhe,E.append(_),b=A=>{E.contains(A.target)||E.removeAttribute("open")},document.addEventListener("click",b)}let S=document.createElement("div");if(w.append(S),S.classList.add("vega-actions"),o===!0||o.export!==!1){for(let E of["svg","png"])if(o===!0||o.export===!0||o.export[E]){let _=a[`${E.toUpperCase()}_ACTION`],A=document.createElement("a"),D=X(n.scaleFactor)?n.scaleFactor[E]:n.scaleFactor;A.text=_,A.href="#",A.target="_blank",A.download=`${u}.${E}`,A.addEventListener("mousedown",async function(F){F.preventDefault();let I=await y.toImageURL(E,D);this.href=I}),S.append(A)}}if(o===!0||o.source!==!1){let E=document.createElement("a");E.text=a.SOURCE_ACTION,E.href="#",E.addEventListener("click",function(_){$B((0,$2.default)(t),n.sourceHeader??"",n.sourceFooter??"",c),_.preventDefault()}),S.append(E)}if(c==="vega-lite"&&(o===!0||o.compiled!==!1)){let E=document.createElement("a");E.text=a.COMPILED_ACTION,E.href="#",E.addEventListener("click",function(_){$B((0,$2.default)(d),n.sourceHeader??"",n.sourceFooter??"","vega"),_.preventDefault()}),S.append(E)}if(o===!0||o.editor!==!1){let E=n.editorUrl??"https://vega.github.io/editor/",_=document.createElement("a");_.text=a.EDITOR_ACTION,_.href="#",_.addEventListener("click",function(A){qme(window,E,{config:i,mode:c,renderer:s,spec:(0,$2.default)(t)}),A.preventDefault()}),S.append(_)}}function v(){b&&document.removeEventListener("click",b),y.finalize()}return{view:y,spec:t,vgSpec:d,finalize:v,embedOptions:n}}var GB="source_0",_he=Fhe(e=>e.resize(),1e3),xt={blue300:"#b2c1ff",blue400:"#8ba2ff",blue500:"#6583ff",blue600:"#3e64ff",blue700:"#2d4cdb",blue800:"#1f37b7",blue900:"#132593",yellow600:"#ffa83f",yellow800:"#b7641f",red500:"#e2474d",red700:"#bc1227",green500:"#4aa148",green700:"#137518",gray200:"#e1e8f0",gray600:"#445668",gray800:"#1c2a3a",gray900:"#0d1829"},Ahe=[xt.blue500,xt.yellow600,xt.red500,xt.green500,xt.blue700,xt.yellow800,xt.red700,xt.green700],VB=[xt.blue300,xt.blue400,xt.blue500,xt.blue600,xt.blue700,xt.blue800,xt.blue900],Ma=xt.blue500,Che={background:"#fff",title:{anchor:"center",fontSize:18,fontWeight:400,color:xt.gray600,fontFamily:"Inter",font:"Inter"},arc:{fill:Ma},area:{fill:Ma},line:{stroke:Ma,strokeWidth:2},path:{stroke:Ma},rect:{fill:Ma},shape:{stroke:Ma},symbol:{fill:Ma,strokeWidth:1.5,size:50},bar:{fill:Ma,stroke:null},circle:{fill:Ma},tick:{fill:Ma},rule:{color:xt.gray900,size:2},text:{color:xt.gray900},axisBand:{grid:!1,tickExtra:!0},legend:{titleFontWeight:400,titleFontColor:xt.gray600,titleFontSize:13,titlePadding:10,labelBaseline:"middle",labelFontSize:12,symbolSize:100,symbolType:"circle"},axisY:{gridColor:xt.gray200,titleFontSize:12,titlePadding:10,labelFontSize:12,labelPadding:8,titleColor:xt.gray800,titleFontWeight:400},axisX:{domain:!0,domainColor:xt.gray200,titlePadding:10,titleColor:xt.gray800,titleFontWeight:400},range:{category:Ahe,ramp:VB,ordinal:VB}};function yXe(e,t){e.importCSS("https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap");let{spec:n,datasets:r}=t;n.data||(n.data={values:[]});let i={actions:{export:!0,source:!1,compiled:!1,editor:!1},config:Che};WB(e.root,n,i).then(o=>{let a=o.view;r.forEach(([s,l])=>{a.resize(),a.data(s||GB,l).run()}),e.handleEvent("push",({data:s,dataset:l,window:u})=>{l=l||GB;let f=a.data(l),c=khe(f,s,u);_he(a),a.change(l,c).run()}),e.handleEvent("set_param",({name:s,value:l})=>{a.signal(s,l),a.run()})}).catch(o=>{let a=`Failed to render the given Vega-Lite specification, got the following error: +`,xhe="chart-wrapper";function bhe(e){return typeof e=="function"}function $B(e,t,n,r){let i=`${t}
`,o=`
${n}`,a=window.open("");a.document.write(i+e+o),a.document.title=`${s0[r]} JSON Source`}function vhe(e,t){if(e.$schema){let n=HT(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${s0[n.library]}, but mode argument sets ${s0[t]??t}.`);let r=n.library;return jB(L2[r],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${s0[r]} ${n.version}, but the current version of ${s0[r]} is v${L2[r]}.`),r}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":t??"vega"}function HB(e){return!!(e&&"load"in e)}function PB(e){return HB(e)?e:Na.loader(e)}function whe(e){let t=e.usermeta?.embedOptions??{};return q(t.defaultStyle)&&(t.defaultStyle=!1),t}async function WB(e,t,n={}){let r,i;q(t)?(i=PB(n.loader),r=JSON.parse(await i.load(t))):r=t;let o=whe(r),a=o.loader;(!i||a)&&(i=PB(n.loader??a));let s=await LB(o,i),l=await LB(n,i),u={...qB(l,s),config:Ho(l.config??{},s.config??{})};return await She(e,r,u,i)}async function LB(e,t){let n=q(e.config)?JSON.parse(await t.load(e.config)):e.config??{},r=q(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return{...e,...r?{patch:r}:{},...n?{config:n}:{}}}function Ehe(e){let t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}async function She(e,t,n={},r){let i=n.theme?Ho(KT[n.theme],n.config??{}):n.config,o=Tr(n.actions)?n.actions:qB({},mhe,n.actions??{}),a={...hhe,...n.i18n},s=n.renderer??"canvas",l=n.logLevel??Na.Warn,u=n.downloadFileName??"visualization",f=typeof e=="string"?document.querySelector(e):e;if(!f)throw new Error(`${e} does not exist`);if(n.defaultStyle!==!1){let w="vega-embed-style",{root:S,rootContainer:E}=Ehe(f);if(!S.getElementById(w)){let _=document.createElement("style");_.id=w,_.innerHTML=n.defaultStyle===void 0||n.defaultStyle===!0?Hme.toString():n.defaultStyle,E.appendChild(_)}}let c=vhe(t,n.mode),d=ghe[c](t,i);if(c==="vega-lite"&&d.$schema){let w=HT(d.$schema);jB(L2.vega,`^${w.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${w.version}, but current version is v${L2.vega}.`)}f.classList.add("vega-embed"),o&&f.classList.add("has-actions"),f.innerHTML="";let p=f;if(o){let w=document.createElement("div");w.classList.add(xhe),f.appendChild(w),p=w}let m=n.patch;if(m&&(d=m instanceof Function?m(d):Bf(d,m,!0,!1).newDocument),n.formatLocale&&Na.formatLocale(n.formatLocale),n.timeFormatLocale&&Na.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(let w in n.expressionFunctions){let S=n.expressionFunctions[w];"fn"in S?Na.expressionFunction(w,S.fn,S.visitor):S instanceof Function&&Na.expressionFunction(w,S)}let{ast:h}=n,g=Na.parse(d,c==="vega-lite"?{}:i,{ast:h}),y=new(n.viewClass||Na.View)(g,{loader:r,logLevel:l,renderer:s,...h?{expr:Na.expressionInterpreter??n.expr??Z4}:{}});if(y.addSignalListener("autosize",(w,S)=>{let{type:E}=S;E=="fit-x"?(p.classList.add("fit-x"),p.classList.remove("fit-y")):E=="fit-y"?(p.classList.remove("fit-x"),p.classList.add("fit-y")):E=="fit"?p.classList.add("fit-x","fit-y"):p.classList.remove("fit-x","fit-y")}),n.tooltip!==!1){let{loader:w,tooltip:S}=n,E=w&&!HB(w)?w?.baseURL:void 0,_=bhe(S)?S:new N2({baseURL:E,...S===!0?{}:S}).call;y.tooltip(_)}let{hover:x}=n;if(x===void 0&&(x=c==="vega"),x){let{hoverSet:w,updateSet:S}=typeof x=="boolean"?{}:x;y.hover(w,S)}n&&(n.width!=null&&y.width(n.width),n.height!=null&&y.height(n.height),n.padding!=null&&y.padding(n.padding)),await y.initialize(p,n.bind).runAsync();let b;if(o!==!1){let w=f;if(n.defaultStyle!==!1||n.forceActionsMenu){let E=document.createElement("details");E.title=a.CLICK_TO_VIEW_ACTIONS,f.append(E),w=E;let _=document.createElement("summary");_.innerHTML=yhe,E.append(_),b=A=>{E.contains(A.target)||E.removeAttribute("open")},document.addEventListener("click",b)}let S=document.createElement("div");if(w.append(S),S.classList.add("vega-actions"),o===!0||o.export!==!1){for(let E of["svg","png"])if(o===!0||o.export===!0||o.export[E]){let _=a[`${E.toUpperCase()}_ACTION`],A=document.createElement("a"),D=X(n.scaleFactor)?n.scaleFactor[E]:n.scaleFactor;A.text=_,A.href="#",A.target="_blank",A.download=`${u}.${E}`,A.addEventListener("mousedown",async function(F){F.preventDefault();let I=await y.toImageURL(E,D);this.href=I}),S.append(A)}}if(o===!0||o.source!==!1){let E=document.createElement("a");E.text=a.SOURCE_ACTION,E.href="#",E.addEventListener("click",function(_){$B((0,$2.default)(t),n.sourceHeader??"",n.sourceFooter??"",c),_.preventDefault()}),S.append(E)}if(c==="vega-lite"&&(o===!0||o.compiled!==!1)){let E=document.createElement("a");E.text=a.COMPILED_ACTION,E.href="#",E.addEventListener("click",function(_){$B((0,$2.default)(d),n.sourceHeader??"",n.sourceFooter??"","vega"),_.preventDefault()}),S.append(E)}if(o===!0||o.editor!==!1){let E=n.editorUrl??"https://vega.github.io/editor/",_=document.createElement("a");_.text=a.EDITOR_ACTION,_.href="#",_.addEventListener("click",function(A){qme(window,E,{config:i,mode:c,renderer:s,spec:(0,$2.default)(t)}),A.preventDefault()}),S.append(_)}}function v(){b&&document.removeEventListener("click",b),y.finalize()}return{view:y,spec:t,vgSpec:d,finalize:v,embedOptions:n}}var GB="source_0",_he=Fhe(e=>e.resize(),1e3),xt={blue300:"#b2c1ff",blue400:"#8ba2ff",blue500:"#6583ff",blue600:"#3e64ff",blue700:"#2d4cdb",blue800:"#1f37b7",blue900:"#132593",yellow600:"#ffa83f",yellow800:"#b7641f",red500:"#e2474d",red700:"#bc1227",green500:"#4aa148",green700:"#137518",gray200:"#e1e8f0",gray600:"#445668",gray800:"#1c2a3a",gray900:"#0d1829"},Ahe=[xt.blue500,xt.yellow600,xt.red500,xt.green500,xt.blue700,xt.yellow800,xt.red700,xt.green700],VB=[xt.blue300,xt.blue400,xt.blue500,xt.blue600,xt.blue700,xt.blue800,xt.blue900],Ma=xt.blue500,Che={background:"#fff",title:{anchor:"center",fontSize:18,fontWeight:400,color:xt.gray600,fontFamily:"Inter",font:"Inter"},arc:{fill:Ma},area:{fill:Ma},line:{stroke:Ma,strokeWidth:2},path:{stroke:Ma},rect:{fill:Ma},shape:{stroke:Ma},symbol:{fill:Ma,strokeWidth:1.5,size:50},bar:{fill:Ma,stroke:null},circle:{fill:Ma},tick:{fill:Ma},rule:{color:xt.gray900,size:2},text:{color:xt.gray900},axisBand:{grid:!1,tickExtra:!0},legend:{titleFontWeight:400,titleFontColor:xt.gray600,titleFontSize:13,titlePadding:10,labelBaseline:"middle",labelFontSize:12,symbolSize:100,symbolType:"circle"},axisY:{gridColor:xt.gray200,titleFontSize:12,titlePadding:10,labelFontSize:12,labelPadding:8,titleColor:xt.gray800,titleFontWeight:400},axisX:{domain:!0,domainColor:xt.gray200,titlePadding:10,titleColor:xt.gray800,titleFontWeight:400},range:{category:Ahe,ramp:VB,ordinal:VB}};function yXe(e,t){e.importCSS("https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap");let{spec:n,datasets:r,config:i}=t;n.data||(n.data={values:[]});let o=i.theme==="livebook"?Che:{},a={actions:{export:!0,source:!0,compiled:!1,editor:!0},config:o};WB(e.root,n,a).then(s=>{let l=s.view;r.forEach(([u,f])=>{l.resize(),l.data(u||GB,f).run()}),e.handleEvent("push",({data:u,dataset:f,window:c})=>{f=f||GB;let d=l.data(f),p=khe(d,u,c);_he(l),l.change(f,p).run()}),e.handleEvent("set_param",({name:u,value:f})=>{l.signal(u,f),l.run()})}).catch(s=>{let l=`Failed to render the given Vega-Lite specification, got the following error: - ${o.message} + ${s.message} Make sure to check for typos.`;e.root.innerHTML=` -
${a}
+
${l}
`})}function khe(e,t,n){if(n===0)return ri().remove(e);if(n){let r=t.slice(-n),i=Math.max(n-r.length,0),o=i===0?e:e.slice(0,-i);return ri().remove(o).insert(r)}else return ri().insert(t)}function Fhe(e,t){let n=!1;return(...r)=>{n||(e(...r),n=!0,setTimeout(()=>{n=!1},t))}}export{yXe as init,Fhe as throttle}; /*! * https://github.com/Starcounter-Jack/JSON-Patch