Socket
Socket
Sign inDemoInstall

vega-view-transforms

Package Overview
Dependencies
30
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.2.0 to 4.2.1

80

build/vega-view-transforms.js

@@ -554,3 +554,3 @@ (function (global, factory) {

function bboxFlush(item) {
return {x1: 0, y1: 0, x2: item.width || 0, y2: item.height || 0};
return new vegaScenegraph.Bounds().set(0, 0, item.width || 0, item.height || 0);
}

@@ -562,3 +562,3 @@

? b.set(0, 0, 0, 0)
: b.translate(-(item.x||0), -(item.y||0));
: b.translate(-(item.x || 0), -(item.y || 0));
}

@@ -585,6 +585,6 @@

nrows = ncols < 0 ? 1 : Math.ceil(groups.length / ncols),
boxes = [],
xOffset = [], xExtent = [], xMax = 0,
yOffset = [], yExtent = [], yMax = 0,
n = groups.length,
xOffset = Array(n), xExtent = Array(ncols), xMax = 0,
yOffset = Array(n), yExtent = Array(nrows), yMax = 0,
dx = Array(n), dy = Array(n), boxes = Array(n),
m, i, c, r, b, g, px, py, x, y, offset;

@@ -597,13 +597,14 @@

for (i=0; i<n; ++i) {
b = boxes[i] = bbox(groups[i]);
g = groups[i];
b = boxes[i] = bbox(g);
g.x = g.x || 0; dx[i] = 0;
g.y = g.y || 0; dy[i] = 0;
c = i % ncols;
r = ~~(i / ncols);
px = Math.ceil(bbox(groups[i]).x2);
py = Math.ceil(bbox(groups[i]).y2);
xMax = Math.max(xMax, px);
yMax = Math.max(yMax, py);
xMax = Math.max(xMax, px = Math.ceil(b.x2));
yMax = Math.max(yMax, py = Math.ceil(b.y2));
xExtent[c] = Math.max(xExtent[c], px);
yExtent[r] = Math.max(yExtent[r], py);
xOffset.push(padCol + offsetValue(b.x1));
yOffset.push(padRow + offsetValue(b.y1));
xOffset[i] = padCol + offsetValue(b.x1);
yOffset[i] = padRow + offsetValue(b.y1);
if (dirty) view.dirty(groups[i]);

@@ -670,6 +671,4 @@ }

for (x=0, i=0; i<n; ++i) {
g = groups[i];
px = g.x || 0;
g.x = (x = xOffset[i] + (i % ncols ? x : 0));
g.bounds.translate(x - px, 0);
x = xOffset[i] + (i % ncols ? x : 0);
dx[i] += x - groups[i].x;
}

@@ -680,6 +679,4 @@

for (y=0, i=c; i<n; i += ncols) {
g = groups[i];
py = g.y || 0;
g.y = (y += yOffset[i]);
g.bounds.translate(0, y - py);
y += yOffset[i];
dy[i] += y - groups[i].y;
}

@@ -689,12 +686,7 @@ }

// perform horizontal centering
// TODO: remove nrows > 1 constraint?
if (alignCol && get(opt.center, Column) && nrows > 1) {
for (i=0; i<n; ++i) {
g = groups[i];
b = alignCol === All ? xMax : xExtent[i % ncols];
x = b - boxes[i].x2;
if (x > 0) {
g.x += (px = x / 2);
g.bounds.translate(px, 0);
}
x = b - boxes[i].x2 - groups[i].x - dx[i];
if (x > 0) dx[i] += x / 2;
}

@@ -704,12 +696,7 @@ }

// perform vertical centering
// TODO: remove ncols !== 1 constraint?
if (alignRow && get(opt.center, Row) && ncols !== 1) {
for (i=0; i<n; ++i) {
g = groups[i];
b = alignRow === All ? yMax : yExtent[~~(i / ncols)];
y = b - boxes[i].y2;
if (y > 0) {
g.y += (py = y / 2);
g.bounds.translate(0, py);
}
y = b - boxes[i].y2 - groups[i].y - dy[i];
if (y > 0) dy[i] += y / 2;
}

@@ -719,3 +706,5 @@ }

// position grid relative to anchor
for (i=0; i<n; ++i) bounds.union(boxes[i]);
for (i=0; i<n; ++i) {
bounds.union(boxes[i].translate(dx[i], dy[i]));
}
x = get(opt.anchor, X);

@@ -741,6 +730,5 @@ y = get(opt.anchor, Y);

g = groups[i];
g.x += x;
g.y += y;
g.bounds.translate(x, y);
bounds.union(g.mark.bounds.union(g.bounds));
g.x += (dx[i] += x);
g.y += (dy[i] += y);
bounds.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i])));
if (dirty) view.dirty(g);

@@ -760,3 +748,3 @@ }

cells = nrows * ncols,
x, y, band, offset;
x, y, x2, y2, anchor, band, offset;

@@ -783,3 +771,3 @@ // -- initial grid layout

band = get(opt.footerBand, Row, null);
layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get(off, 'rowFooter'), max, 0, bbox, 'x2', ncols-1, ncols, 1, band);
x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get(off, 'rowFooter'), max, 0, bbox, 'x2', ncols-1, ncols, 1, band);
}

@@ -790,3 +778,3 @@

band = get(opt.footerBand, Column, null);
layoutHeaders(view, views.colfooters, groups, ncols, ncols, get(off, 'columnFooter'), max, 1, bbox, 'y2', cells-ncols, 1, ncols, band);
y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get(off, 'columnFooter'), max, 1, bbox, 'y2', cells-ncols, 1, ncols, band);
}

@@ -796,3 +784,5 @@

if (views.rowtitle) {
offset = x - get(off, 'rowTitle');
anchor = get(opt.titleAnchor, Row);
offset = get(off, 'rowTitle');
offset = anchor === End ? x2 + offset : x - offset;
band = get(opt.titleBand, Row, 0.5);

@@ -804,3 +794,5 @@ layoutTitle(view, views.rowtitle, offset, 0, bounds, band);

if (views.coltitle) {
offset = y - get(off, 'columnTitle');
anchor = get(opt.titleAnchor, Column);
offset = get(off, 'columnTitle');
offset = anchor === End ? y2 + offset : y - offset;
band = get(opt.titleBand, Column, 0.5);

@@ -807,0 +799,0 @@ layoutTitle(view, views.coltitle, offset, 1, bounds, band);

@@ -1,1 +0,1 @@

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vega-dataflow"),require("vega-scenegraph"),require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-scenegraph","vega-util"],n):n(((t=t||self).vega=t.vega||{},t.vega.transforms={}),t.vega,t.vega,t.vega)}(this,function(t,n,e,r){"use strict";const o="top",a="left",i="right",s="bottom",u="top-left",c="top-right",d="bottom-left",l="bottom-right",f="start",h="middle",m="end",y="x",b="y",x="group",g="axis",p="title",v="frame",w="scope",k="legend",M="row-header",T="row-footer",E="row-title",_="column-header",z="column-footer",B="column-title",D="padding",O="symbol",S="fit",j="fit-x",q="fit-y",A="pad",I="none",P="all",C="each",F="flush",G="column",H="row";function L(t){n.Transform.call(this,null,t)}function R(t,n,e){return n(t.bounds.clear(),t,e)}r.inherits(L,n.Transform).transform=function(t,n){var r,o=n.dataflow,a=t.mark,i=a.marktype,s=e.Marks[i],u=s.bound,c=a.bounds;return s.nested?(a.items.length&&o.dirty(a.items[0]),c=R(a,u),a.items.forEach(function(t){t.bounds.clear().union(c)})):i===x||t.modified()?(n.visit(n.MOD,function(t){o.dirty(t)}),c.clear(),a.items.forEach(function(t){c.union(R(t,u))}),a.role===k&&n.reflow()):(r=n.changed(n.REM),n.visit(n.ADD,function(t){c.union(R(t,u))}),n.visit(n.MOD,function(t){r=r||c.alignsWith(t.bounds),o.dirty(t),c.union(R(t,u))}),r&&(c.clear(),a.items.forEach(function(t){c.union(t.bounds)}))),e.boundClip(a),n.modifies("bounds")};var U=":vega_identifier:";function V(t){n.Transform.call(this,0,t)}function W(t){n.Transform.call(this,null,t)}function J(t){n.Transform.call(this,null,t)}V.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},r.inherits(V,n.Transform).transform=function(t,n){var e=function(t){var n=t._signals[U];n||(t._signals[U]=n=t.add(0));return n}(n.dataflow),r=e.value,o=t.as;return n.visit(n.ADD,function(t){t[o]||(t[o]=++r)}),e.set(this.value=r),n},r.inherits(W,n.Transform).transform=function(t,n){var r=this.value;r||((r=n.dataflow.scenegraph().mark(t.markdef,function(t){var n=t.groups,e=t.parent;return n&&1===n.size?n.get(Object.keys(n.object)[0]):n&&e?n.lookup(e):null}(t),t.index)).group.context=t.context,t.context.group||(t.context.group=r.group),r.source=this,r.clip=t.clip,r.interactive=t.interactive,this.value=r);var o=r.marktype===x?e.GroupItem:e.Item;return n.visit(n.ADD,function(t){o.call(t,r)}),(t.modified("clip")||t.modified("interactive"))&&(r.clip=t.clip,r.interactive=!!t.interactive,r.zdirty=!0,n.reflow()),r.items=n.source,n};var K=r.inherits(J,n.Transform),N={parity:function(t){return t.filter(function(t,n){return n%2?t.opacity=0:1})},greedy:function(t,n){var e;return t.filter(function(t,r){return r&&Q(e.bounds,t.bounds,n)?t.opacity=0:(e=t,1)})}};function Q(t,n,e){return e>Math.max(n.x1-t.x2,t.x1-n.x2,n.y1-t.y2,t.y1-n.y2)}function X(t,n){for(var e,r=1,o=t.length,a=t[0].bounds;r<o;a=e,++r)if(Q(a,e=t[r].bounds,n))return!0}function Y(t){var n=t.bounds;return n.width()>1&&n.height()>1}function Z(t){return t.forEach(function(t){t.opacity=1}),t}function $(t,n){return t.reflow(n.modified()).modifies("opacity")}function tt(t){n.Transform.call(this,null,t)}K.transform=function(t,n){var a,i,u=N[t.method]||N.parity,c=n.materialize(n.SOURCE).source,d=t.separation||0;if(c){if(!t.method)return t.modified("method")&&(Z(c),n=$(n,t)),n;if(t.sort&&(c=c.slice().sort(t.sort)),a=Z(c=c.filter(Y)),n=$(n,t),a.length>=3&&X(a,d)){do{a=u(a,d)}while(a.length>=3&&X(a,d));a.length<3&&!r.peek(c).opacity&&(a.length>1&&(r.peek(a).opacity=0),r.peek(c).opacity=1)}var l,f,h,m,y;return t.boundScale&&t.boundTolerance>=0&&(l=t.boundScale,f=t.boundOrient,h=+t.boundTolerance,m=l.range(),y=new e.Bounds,f===o||f===s?y.set(m[0],-1/0,m[1],1/0):y.set(-1/0,m[0],1/0,m[1]),y.expand(h||1),i=function(t){return y.encloses(t.bounds)},c.forEach(function(t){i(t)||(t.opacity=0)})),n}},r.inherits(tt,n.Transform).transform=function(t,n){var e=n.dataflow;if(n.visit(n.ALL,function(t){e.dirty(t)}),n.fields&&n.fields.zindex){var r=n.source&&n.source[0];r&&(r.mark.zdirty=!0)}};const nt=new e.Bounds;function et(t,n,e){return t[n]===e?0:(t[n]=e,1)}const rt=.5;function ot(t){var n=t.items[0].datum.orient;return n===a||n===i}function at(t,n,r,u){var c,d,l=n.items[0],f=l.datum,h=f.orient,m=function(t){var n=+t.grid;return[t.ticks?n++:-1,t.labels?n++:-1,n+ +t.domain]}(f),y=l.range,b=l.offset,x=l.position,g=l.minExtent,p=l.maxExtent,v=f.title&&l.items[m[2]].items[0],w=l.titlePadding,k=l.bounds,M=0,T=0;switch(nt.clear().union(k),k.clear(),(c=m[0])>-1&&k.union(l.items[c].bounds),(c=m[1])>-1&&k.union(l.items[c].bounds),h){case o:M=x||0,T=-b,d=Math.max(g,Math.min(p,-k.y1)),v&&(d=it(v,d,w,0,-1,k)),k.add(0,-d).add(y,0);break;case a:M=-b,T=x||0,d=Math.max(g,Math.min(p,-k.x1)),v&&(d=it(v,d,w,1,-1,k)),k.add(-d,0).add(0,y);break;case i:M=r+b,T=x||0,d=Math.max(g,Math.min(p,k.x2)),v&&(d=it(v,d,w,1,1,k)),k.add(0,0).add(d,y);break;case s:M=x||0,T=u+b,d=Math.max(g,Math.min(p,k.y2)),v&&(d=it(v,d,w,0,1,k)),k.add(0,0).add(y,d);break;default:M=l.x,T=l.y}return e.boundStroke(k.translate(M,T),l),et(l,"x",M+rt)|et(l,"y",T+rt)&&(l.bounds=nt,t.dirty(l),l.bounds=k,t.dirty(l)),l.mark.bounds.clear().union(k)}function it(t,n,e,r,o,a){var i=t.bounds,s=0,u=0;return t.auto?(n+=e,r?s=(t.x||0)-(t.x=o*n):u=(t.y||0)-(t.y=o*n),i.translate(-s,-u),t.mark.bounds.set(i.x1,i.y1,i.x2,i.y2),r?(a.add(0,i.y1).add(0,i.y2),n+=i.width()):(a.add(i.x1,0).add(i.x2,0),n+=i.height())):a.union(i),n}function st(t){return{x1:0,y1:0,x2:t.width||0,y2:t.height||0}}function ut(t){var n=t.bounds.clone();return n.empty()?n.set(0,0,0,0):n.translate(-(t.x||0),-(t.y||0))}function ct(t,n,e){var o=r.isObject(t)?t[n]:t;return null!=o?o:void 0!==e?e:0}function dt(t){return t<0?Math.ceil(-t):0}function lt(t,n,e){var r,o,a,i,s,u,c,d,l,f,x,g=!e.nodirty,p=e.bounds===F?st:ut,v=nt.set(0,0,0,0),w=ct(e.align,G),k=ct(e.align,H),M=ct(e.padding,G),T=ct(e.padding,H),E=e.columns||n.length,_=E<0?1:Math.ceil(n.length/E),z=[],B=[],D=[],O=0,S=[],j=[],q=0,A=n.length;for(o=0;o<E;++o)D[o]=0;for(o=0;o<_;++o)j[o]=0;for(o=0;o<A;++o)s=z[o]=p(n[o]),a=o%E,i=~~(o/E),c=Math.ceil(p(n[o]).x2),d=Math.ceil(p(n[o]).y2),O=Math.max(O,c),q=Math.max(q,d),D[a]=Math.max(D[a],c),j[i]=Math.max(j[i],d),B.push(M+dt(s.x1)),S.push(T+dt(s.y1)),g&&t.dirty(n[o]);for(o=0;o<A;++o)o%E==0&&(B[o]=0),o<E&&(S[o]=0);if(w===C)for(a=1;a<E;++a){for(x=0,o=a;o<A;o+=E)x<B[o]&&(x=B[o]);for(o=a;o<A;o+=E)B[o]=x+D[a-1]}else if(w===P){for(x=0,o=0;o<A;++o)o%E&&x<B[o]&&(x=B[o]);for(o=0;o<A;++o)o%E&&(B[o]=x+O)}else for(w=!1,a=1;a<E;++a)for(o=a;o<A;o+=E)B[o]+=D[a-1];if(k===C)for(i=1;i<_;++i){for(x=0,r=(o=i*E)+E;o<r;++o)x<S[o]&&(x=S[o]);for(o=i*E;o<r;++o)S[o]=x+j[i-1]}else if(k===P){for(x=0,o=E;o<A;++o)x<S[o]&&(x=S[o]);for(o=E;o<A;++o)S[o]=x+q}else for(k=!1,i=1;i<_;++i)for(r=(o=i*E)+E;o<r;++o)S[o]+=j[i-1];for(l=0,o=0;o<A;++o)c=(u=n[o]).x||0,u.x=l=B[o]+(o%E?l:0),u.bounds.translate(l-c,0);for(a=0;a<E;++a)for(f=0,o=a;o<A;o+=E)d=(u=n[o]).y||0,u.y=f+=S[o],u.bounds.translate(0,f-d);if(w&&ct(e.center,G)&&_>1)for(o=0;o<A;++o)u=n[o],(l=(s=w===P?O:D[o%E])-z[o].x2)>0&&(u.x+=c=l/2,u.bounds.translate(c,0));if(k&&ct(e.center,H)&&1!==E)for(o=0;o<A;++o)u=n[o],(f=(s=k===P?q:j[~~(o/E)])-z[o].y2)>0&&(u.y+=d=f/2,u.bounds.translate(0,d));for(o=0;o<A;++o)v.union(z[o]);switch(l=ct(e.anchor,y),f=ct(e.anchor,b),ct(e.anchor,G)){case m:l-=v.width();break;case h:l-=v.width()/2}switch(ct(e.anchor,H)){case m:f-=v.height();break;case h:f-=v.height()/2}for(l=Math.round(l),f=Math.round(f),v.clear(),o=0;o<A;++o)n[o].mark.bounds.clear();for(o=0;o<A;++o)(u=n[o]).x+=l,u.y+=f,u.bounds.translate(l,f),v.union(u.mark.bounds.union(u.bounds)),g&&t.dirty(u);return v}function ft(t,n,e){var r,o,a,i,s=function(t){for(var n,e,r=t.items,o=r.length,a=0,i={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};a<o;++a)if(e=(n=r[a]).items,n.marktype===x)switch(n.role){case g:case k:break;case M:i.rowheaders.push(...e);break;case T:i.rowfooters.push(...e);break;case _:i.colheaders.push(...e);break;case z:i.colfooters.push(...e);break;case E:i.rowtitle=e[0];break;case B:i.coltitle=e[0];break;default:i.marks.push(...e)}return i}(n),u=s.marks,c=e.bounds===F?ht:mt,d=e.offset,l=e.columns||u.length,f=l<0?1:Math.ceil(u.length/l),h=f*l;const m=lt(t,u,e);s.rowheaders&&(a=ct(e.headerBand,H,null),r=xt(t,s.rowheaders,u,l,f,-ct(d,"rowHeader"),yt,0,c,"x1",0,l,1,a)),s.colheaders&&(a=ct(e.headerBand,G,null),o=xt(t,s.colheaders,u,l,l,-ct(d,"columnHeader"),yt,1,c,"y1",0,1,l,a)),s.rowfooters&&(a=ct(e.footerBand,H,null),xt(t,s.rowfooters,u,l,f,ct(d,"rowFooter"),bt,0,c,"x2",l-1,l,1,a)),s.colfooters&&(a=ct(e.footerBand,G,null),xt(t,s.colfooters,u,l,l,ct(d,"columnFooter"),bt,1,c,"y2",h-l,1,l,a)),s.rowtitle&&(i=r-ct(d,"rowTitle"),a=ct(e.titleBand,H,.5),gt(t,s.rowtitle,i,0,m,a)),s.coltitle&&(i=o-ct(d,"columnTitle"),a=ct(e.titleBand,G,.5),gt(t,s.coltitle,i,1,m,a))}function ht(t,n){return"x1"===n?t.x||0:"y1"===n?t.y||0:"x2"===n?(t.x||0)+(t.width||0):"y2"===n?(t.y||0)+(t.height||0):void 0}function mt(t,n){return t.bounds[n]}function yt(t,n){return Math.floor(Math.min(t,n))}function bt(t,n){return Math.ceil(Math.max(t,n))}function xt(t,n,e,r,o,a,i,s,u,c,d,l,f,h){var m,y,b,x,g,p,v,w,k,M=e.length,T=0,E=0;if(!M)return T;for(m=d;m<M;m+=l)e[m]&&(T=i(T,u(e[m],c)));if(!n.length)return T;for(n.length>o&&(t.warn("Grid headers exceed limit: "+o),n=n.slice(0,o)),T+=a,y=0,x=n.length;y<x;++y)t.dirty(n[y]),n[y].mark.bounds.clear();for(m=d,y=0,x=n.length;y<x;++y,m+=l){for(g=(p=n[y]).mark.bounds,b=m;b>=0&&null==(v=e[b]);b-=f);s?(w=null==h?v.x:Math.round(v.bounds.x1+h*v.bounds.width()),k=T):(w=T,k=null==h?v.y:Math.round(v.bounds.y1+h*v.bounds.height())),g.union(p.bounds.translate(w-(p.x||0),k-(p.y||0))),p.x=w,p.y=k,t.dirty(p),E=i(E,g[c])}return E}function gt(t,n,e,r,o,a){if(n){t.dirty(n);var i=e,s=e;r?i=Math.round(o.x1+a*o.width()):s=Math.round(o.y1+a*o.height()),n.bounds.translate(i-(n.x||0),s-(n.y||0)),n.mark.bounds.clear().union(n.bounds),n.x=i,n.y=s,t.dirty(n)}}function pt(t,n,e,r,y,b,x){const g=function(t,n){const e=t[n]||{};return(n,r)=>null!=e[n]?e[n]:null!=t[n]?t[n]:r}(e,n),p=(k=t,M=g("offset",0),T=-1/0,k.forEach(t=>{null!=t.offset&&(T=Math.max(T,t.offset))}),T>-1/0?T:M),v=g("anchor",f),w=v===m?1:v===h?.5:0;var k,M,T;const E={align:C,bounds:g("bounds",F),columns:"vertical"===g("direction")?1:t.length,padding:g("margin",8),center:g("center"),nodirty:!0};switch(n){case a:E.anchor={x:Math.floor(r.x1)-p,column:m,y:w*(x||r.height()+2*r.y1),row:v};break;case i:E.anchor={x:Math.ceil(r.x2)+p,y:w*(x||r.height()+2*r.y1),row:v};break;case o:E.anchor={y:Math.floor(y.y1)-p,row:m,x:w*(b||y.width()+2*y.x1),column:v};break;case s:E.anchor={y:Math.ceil(y.y2)+p,x:w*(b||y.width()+2*y.x1),column:v};break;case u:E.anchor={x:p,y:p};break;case c:E.anchor={x:b-p,y:p,column:m};break;case d:E.anchor={x:p,y:x-p,row:m};break;case l:E.anchor={x:b-p,y:x-p,column:m,row:m}}return E}function vt(t,n){var r,o,u,c,d=n.items[0],l=d.datum,f=l.orient,h=d.bounds,y=d.x,b=d.y;return d._bounds?d._bounds.clear().union(h):d._bounds=h.clone(),h.clear(),function(t,n,e){var r=n.padding,o=r-e.x,u=r-e.y;if(n.datum.title){var c=n.items[1].items[0],d=c.anchor,l=n.titlePadding||0,f=r-c.x,h=r-c.y;switch(c.orient){case a:o+=Math.ceil(c.bounds.width())+l;break;case i:case s:break;default:u+=c.fontSize+l}switch((o||u)&&kt(t,e,o,u),c.orient){case a:h+=wt(n,e,c,d,0,1);break;case i:f+=wt(n,e,c,m,1,0)+l,h+=wt(n,e,c,d,0,1);break;case s:f+=wt(n,e,c,d,1,0),h+=wt(n,e,c,m,0,0,1)+l;break;default:f+=wt(n,e,c,d,1,0)}(f||h)&&kt(t,c,f,h),(f=Math.round(c.bounds.x1-r))<0&&(kt(t,e,-f,0),kt(t,c,-f,0))}else(o||u)&&kt(t,e,o,u)}(t,d,d.items[0].items[0]),h=function(t,n){return t.items.forEach(t=>n.union(t.bounds)),n.x1=t.padding,n.y1=t.padding,n}(d,h),r=2*d.padding,o=2*d.padding,h.empty()||(r=Math.ceil(h.width()+r),o=Math.ceil(h.height()+o)),l.type===O&&(u=d.items[0].items[0].items[0].items,c=u.reduce(function(t,n){return t[n.column]=Math.max(n.bounds.x2-n.x,t[n.column]||0),t},{}),u.forEach(function(t){t.width=c[t.column],t.height=t.bounds.y2-t.y})),f!==I&&(d.x=y=0,d.y=b=0),d.width=r,d.height=o,e.boundStroke(h.set(y,b,y+r,b+o),d),d.mark.bounds.clear().union(h),d}function wt(t,n,e,r,o,a,i){const s="symbol"!==t.datum.type,u=e.datum.vgrad,c=(!s||!a&&u||i?n:n.items[0]).bounds[o?"x2":"y2"]-t.padding,d=u&&a?c:0,l=u&&a?0:c;return Math.round(r===f?d:r===m?l:.5*c)}function kt(t,n,e,r){n.x+=e,n.y+=r,n.bounds.translate(e,r),n.mark.bounds.translate(e,r),t.dirty(n)}function Mt(t){n.Transform.call(this,null,t)}r.inherits(Mt,n.Transform).transform=function(t,n){var r=n.dataflow;return t.mark.items.forEach(function(n){t.layout&&ft(r,n,t.layout),function(t,n,r){var u,c,d,l,h,y=n.items,b=Math.max(0,n.width||0),O=Math.max(0,n.height||0),P=(new e.Bounds).set(0,0,b,O),C=P.clone(),F=P.clone(),G=[];for(l=0,h=y.length;l<h;++l)switch((c=y[l]).role){case g:(ot(c)?C:F).union(at(t,c,b,O));break;case p:u=c;break;case k:G.push(vt(t,c));break;case v:case w:case M:case T:case E:case _:case z:case B:C.union(c.bounds),F.union(c.bounds);break;default:P.union(c.bounds)}if(G.length){const n={};G.forEach(t=>{(d=t.datum.orient||i)!==I&&(n[d]||(n[d]=[])).push(t)});for(let e in n){const o=n[e];lt(t,o,pt(o,e,r.legends,C,F,b,O))}G.forEach(n=>{const e=n.bounds;e.equals(n._bounds)||(n.bounds=n._bounds,t.dirty(n),n.bounds=e,t.dirty(n)),r.autosize&&r.autosize.type===S?(d=n.datum.orient)===a||d===i?P.add(e.x1,0).add(e.x2,0):d!==o&&d!==s||P.add(0,e.y1).add(0,e.y2):P.union(e)})}P.union(C).union(F),u&&P.union(function(t,n,e,r,u){var c,d=n.items[0],l=d.orient,h=d.frame,y=d.anchor,b=d.offset,g=d.bounds,p=0,v=l===a||l===i?r:e,w=0,k=0;switch(h!==x?l===a?(p=u.y2,v=u.y1):l===i?(p=u.y1,v=u.y2):(p=u.x1,v=u.x2):l===a&&(p=r,v=0),c=y===f?p:y===m?v:(p+v)/2,nt.clear().union(g),l){case o:w=c,k=u.y1-b;break;case a:w=u.x1-b,k=c;break;case i:w=u.x2+b,k=c;break;case s:w=c,k=u.y2+b;break;default:w=d.x,k=d.y}return g.translate(w-(d.x||0),k-(d.y||0)),et(d,"x",w)|et(d,"y",k)&&(d.bounds=nt,t.dirty(d),d.bounds=g,t.dirty(d)),n.bounds.clear().union(g)}(t,u,b,O,P));!function(t,n,e,r){var o=r.autosize||{},a=o.type,i=t._width,s=t._height,u=t.padding();if(t._autosize<1||!a)return;var c=Math.max(0,n.width||0),d=Math.max(0,Math.ceil(-e.x1)),l=Math.max(0,Math.ceil(e.x2-c)),f=Math.max(0,n.height||0),h=Math.max(0,Math.ceil(-e.y1)),m=Math.max(0,Math.ceil(e.y2-f));o.contains===D&&(i-=u.left+u.right,s-=u.top+u.bottom);a===I?(d=0,h=0,c=i,f=s):a===S?(c=Math.max(0,i-d-l),f=Math.max(0,s-h-m)):a===j?(c=Math.max(0,i-d-l),s=f+h+m):a===q?(i=c+d+l,f=Math.max(0,s-h-m)):a===A&&(i=c+d+l,s=f+h+m);t._resizeView(i,s,c,f,[d,h],o.resize)}(t,n,P,r)}(r,n,t)}),t.modified()&&n.reflow(),n},t.bound=L,t.identifier=V,t.mark=W,t.overlap=J,t.render=tt,t.viewlayout=Mt,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-dataflow"),require("vega-scenegraph"),require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-scenegraph","vega-util"],e):e(((t=t||self).vega=t.vega||{},t.vega.transforms={}),t.vega,t.vega,t.vega)}(this,function(t,e,n,r){"use strict";const o="top",a="left",i="right",u="bottom",s="top-left",c="top-right",d="bottom-left",l="bottom-right",f="start",h="middle",m="end",y="x",b="y",x="group",g="axis",p="title",v="frame",w="scope",k="legend",M="row-header",T="row-footer",E="row-title",_="column-header",A="column-footer",z="column-title",B="padding",D="symbol",O="fit",S="fit-x",j="fit-y",q="pad",I="none",P="all",C="each",F="flush",G="column",H="row";function L(t){e.Transform.call(this,null,t)}function R(t,e,n){return e(t.bounds.clear(),t,n)}r.inherits(L,e.Transform).transform=function(t,e){var r,o=e.dataflow,a=t.mark,i=a.marktype,u=n.Marks[i],s=u.bound,c=a.bounds;return u.nested?(a.items.length&&o.dirty(a.items[0]),c=R(a,s),a.items.forEach(function(t){t.bounds.clear().union(c)})):i===x||t.modified()?(e.visit(e.MOD,function(t){o.dirty(t)}),c.clear(),a.items.forEach(function(t){c.union(R(t,s))}),a.role===k&&e.reflow()):(r=e.changed(e.REM),e.visit(e.ADD,function(t){c.union(R(t,s))}),e.visit(e.MOD,function(t){r=r||c.alignsWith(t.bounds),o.dirty(t),c.union(R(t,s))}),r&&(c.clear(),a.items.forEach(function(t){c.union(t.bounds)}))),n.boundClip(a),e.modifies("bounds")};var U=":vega_identifier:";function V(t){e.Transform.call(this,0,t)}function W(t){e.Transform.call(this,null,t)}function J(t){e.Transform.call(this,null,t)}V.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},r.inherits(V,e.Transform).transform=function(t,e){var n=function(t){var e=t._signals[U];e||(t._signals[U]=e=t.add(0));return e}(e.dataflow),r=n.value,o=t.as;return e.visit(e.ADD,function(t){t[o]||(t[o]=++r)}),n.set(this.value=r),e},r.inherits(W,e.Transform).transform=function(t,e){var r=this.value;r||((r=e.dataflow.scenegraph().mark(t.markdef,function(t){var e=t.groups,n=t.parent;return e&&1===e.size?e.get(Object.keys(e.object)[0]):e&&n?e.lookup(n):null}(t),t.index)).group.context=t.context,t.context.group||(t.context.group=r.group),r.source=this,r.clip=t.clip,r.interactive=t.interactive,this.value=r);var o=r.marktype===x?n.GroupItem:n.Item;return e.visit(e.ADD,function(t){o.call(t,r)}),(t.modified("clip")||t.modified("interactive"))&&(r.clip=t.clip,r.interactive=!!t.interactive,r.zdirty=!0,e.reflow()),r.items=e.source,e};var K=r.inherits(J,e.Transform),N={parity:function(t){return t.filter(function(t,e){return e%2?t.opacity=0:1})},greedy:function(t,e){var n;return t.filter(function(t,r){return r&&Q(n.bounds,t.bounds,e)?t.opacity=0:(n=t,1)})}};function Q(t,e,n){return n>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function X(t,e){for(var n,r=1,o=t.length,a=t[0].bounds;r<o;a=n,++r)if(Q(a,n=t[r].bounds,e))return!0}function Y(t){var e=t.bounds;return e.width()>1&&e.height()>1}function Z(t){return t.forEach(function(t){t.opacity=1}),t}function $(t,e){return t.reflow(e.modified()).modifies("opacity")}function tt(t){e.Transform.call(this,null,t)}K.transform=function(t,e){var a,i,s=N[t.method]||N.parity,c=e.materialize(e.SOURCE).source,d=t.separation||0;if(c){if(!t.method)return t.modified("method")&&(Z(c),e=$(e,t)),e;if(t.sort&&(c=c.slice().sort(t.sort)),a=Z(c=c.filter(Y)),e=$(e,t),a.length>=3&&X(a,d)){do{a=s(a,d)}while(a.length>=3&&X(a,d));a.length<3&&!r.peek(c).opacity&&(a.length>1&&(r.peek(a).opacity=0),r.peek(c).opacity=1)}var l,f,h,m,y;return t.boundScale&&t.boundTolerance>=0&&(l=t.boundScale,f=t.boundOrient,h=+t.boundTolerance,m=l.range(),y=new n.Bounds,f===o||f===u?y.set(m[0],-1/0,m[1],1/0):y.set(-1/0,m[0],1/0,m[1]),y.expand(h||1),i=function(t){return y.encloses(t.bounds)},c.forEach(function(t){i(t)||(t.opacity=0)})),e}},r.inherits(tt,e.Transform).transform=function(t,e){var n=e.dataflow;if(e.visit(e.ALL,function(t){n.dirty(t)}),e.fields&&e.fields.zindex){var r=e.source&&e.source[0];r&&(r.mark.zdirty=!0)}};const et=new n.Bounds;function nt(t,e,n){return t[e]===n?0:(t[e]=n,1)}const rt=.5;function ot(t){var e=t.items[0].datum.orient;return e===a||e===i}function at(t,e,r,s){var c,d,l=e.items[0],f=l.datum,h=f.orient,m=function(t){var e=+t.grid;return[t.ticks?e++:-1,t.labels?e++:-1,e+ +t.domain]}(f),y=l.range,b=l.offset,x=l.position,g=l.minExtent,p=l.maxExtent,v=f.title&&l.items[m[2]].items[0],w=l.titlePadding,k=l.bounds,M=0,T=0;switch(et.clear().union(k),k.clear(),(c=m[0])>-1&&k.union(l.items[c].bounds),(c=m[1])>-1&&k.union(l.items[c].bounds),h){case o:M=x||0,T=-b,d=Math.max(g,Math.min(p,-k.y1)),v&&(d=it(v,d,w,0,-1,k)),k.add(0,-d).add(y,0);break;case a:M=-b,T=x||0,d=Math.max(g,Math.min(p,-k.x1)),v&&(d=it(v,d,w,1,-1,k)),k.add(-d,0).add(0,y);break;case i:M=r+b,T=x||0,d=Math.max(g,Math.min(p,k.x2)),v&&(d=it(v,d,w,1,1,k)),k.add(0,0).add(d,y);break;case u:M=x||0,T=s+b,d=Math.max(g,Math.min(p,k.y2)),v&&(d=it(v,d,w,0,1,k)),k.add(0,0).add(y,d);break;default:M=l.x,T=l.y}return n.boundStroke(k.translate(M,T),l),nt(l,"x",M+rt)|nt(l,"y",T+rt)&&(l.bounds=et,t.dirty(l),l.bounds=k,t.dirty(l)),l.mark.bounds.clear().union(k)}function it(t,e,n,r,o,a){var i=t.bounds,u=0,s=0;return t.auto?(e+=n,r?u=(t.x||0)-(t.x=o*e):s=(t.y||0)-(t.y=o*e),i.translate(-u,-s),t.mark.bounds.set(i.x1,i.y1,i.x2,i.y2),r?(a.add(0,i.y1).add(0,i.y2),e+=i.width()):(a.add(i.x1,0).add(i.x2,0),e+=i.height())):a.union(i),e}function ut(t){return(new n.Bounds).set(0,0,t.width||0,t.height||0)}function st(t){var e=t.bounds.clone();return e.empty()?e.set(0,0,0,0):e.translate(-(t.x||0),-(t.y||0))}function ct(t,e,n){var o=r.isObject(t)?t[e]:t;return null!=o?o:void 0!==n?n:0}function dt(t){return t<0?Math.ceil(-t):0}function lt(t,e,n){var r,o,a,i,u,s,c,d,l,f,x,g=!n.nodirty,p=n.bounds===F?ut:st,v=et.set(0,0,0,0),w=ct(n.align,G),k=ct(n.align,H),M=ct(n.padding,G),T=ct(n.padding,H),E=n.columns||e.length,_=E<0?1:Math.ceil(e.length/E),A=e.length,z=Array(A),B=Array(E),D=0,O=Array(A),S=Array(_),j=0,q=Array(A),I=Array(A),L=Array(A);for(o=0;o<E;++o)B[o]=0;for(o=0;o<_;++o)S[o]=0;for(o=0;o<A;++o)s=e[o],u=L[o]=p(s),s.x=s.x||0,q[o]=0,s.y=s.y||0,I[o]=0,a=o%E,i=~~(o/E),D=Math.max(D,c=Math.ceil(u.x2)),j=Math.max(j,d=Math.ceil(u.y2)),B[a]=Math.max(B[a],c),S[i]=Math.max(S[i],d),z[o]=M+dt(u.x1),O[o]=T+dt(u.y1),g&&t.dirty(e[o]);for(o=0;o<A;++o)o%E==0&&(z[o]=0),o<E&&(O[o]=0);if(w===C)for(a=1;a<E;++a){for(x=0,o=a;o<A;o+=E)x<z[o]&&(x=z[o]);for(o=a;o<A;o+=E)z[o]=x+B[a-1]}else if(w===P){for(x=0,o=0;o<A;++o)o%E&&x<z[o]&&(x=z[o]);for(o=0;o<A;++o)o%E&&(z[o]=x+D)}else for(w=!1,a=1;a<E;++a)for(o=a;o<A;o+=E)z[o]+=B[a-1];if(k===C)for(i=1;i<_;++i){for(x=0,r=(o=i*E)+E;o<r;++o)x<O[o]&&(x=O[o]);for(o=i*E;o<r;++o)O[o]=x+S[i-1]}else if(k===P){for(x=0,o=E;o<A;++o)x<O[o]&&(x=O[o]);for(o=E;o<A;++o)O[o]=x+j}else for(k=!1,i=1;i<_;++i)for(r=(o=i*E)+E;o<r;++o)O[o]+=S[i-1];for(l=0,o=0;o<A;++o)l=z[o]+(o%E?l:0),q[o]+=l-e[o].x;for(a=0;a<E;++a)for(f=0,o=a;o<A;o+=E)f+=O[o],I[o]+=f-e[o].y;if(w&&ct(n.center,G)&&_>1)for(o=0;o<A;++o)(l=(u=w===P?D:B[o%E])-L[o].x2-e[o].x-q[o])>0&&(q[o]+=l/2);if(k&&ct(n.center,H)&&1!==E)for(o=0;o<A;++o)(f=(u=k===P?j:S[~~(o/E)])-L[o].y2-e[o].y-I[o])>0&&(I[o]+=f/2);for(o=0;o<A;++o)v.union(L[o].translate(q[o],I[o]));switch(l=ct(n.anchor,y),f=ct(n.anchor,b),ct(n.anchor,G)){case m:l-=v.width();break;case h:l-=v.width()/2}switch(ct(n.anchor,H)){case m:f-=v.height();break;case h:f-=v.height()/2}for(l=Math.round(l),f=Math.round(f),v.clear(),o=0;o<A;++o)e[o].mark.bounds.clear();for(o=0;o<A;++o)(s=e[o]).x+=q[o]+=l,s.y+=I[o]+=f,v.union(s.mark.bounds.union(s.bounds.translate(q[o],I[o]))),g&&t.dirty(s);return v}function ft(t,e,n){var r,o,a,i,u,s,c,d=function(t){for(var e,n,r=t.items,o=r.length,a=0,i={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};a<o;++a)if(n=(e=r[a]).items,e.marktype===x)switch(e.role){case g:case k:break;case M:i.rowheaders.push(...n);break;case T:i.rowfooters.push(...n);break;case _:i.colheaders.push(...n);break;case A:i.colfooters.push(...n);break;case E:i.rowtitle=n[0];break;case z:i.coltitle=n[0];break;default:i.marks.push(...n)}return i}(e),l=d.marks,f=n.bounds===F?ht:mt,h=n.offset,y=n.columns||l.length,b=y<0?1:Math.ceil(l.length/y),p=b*y;const v=lt(t,l,n);d.rowheaders&&(s=ct(n.headerBand,H,null),r=xt(t,d.rowheaders,l,y,b,-ct(h,"rowHeader"),yt,0,f,"x1",0,y,1,s)),d.colheaders&&(s=ct(n.headerBand,G,null),o=xt(t,d.colheaders,l,y,y,-ct(h,"columnHeader"),yt,1,f,"y1",0,1,y,s)),d.rowfooters&&(s=ct(n.footerBand,H,null),a=xt(t,d.rowfooters,l,y,b,ct(h,"rowFooter"),bt,0,f,"x2",y-1,y,1,s)),d.colfooters&&(s=ct(n.footerBand,G,null),i=xt(t,d.colfooters,l,y,y,ct(h,"columnFooter"),bt,1,f,"y2",p-y,1,y,s)),d.rowtitle&&(u=ct(n.titleAnchor,H),c=ct(h,"rowTitle"),c=u===m?a+c:r-c,s=ct(n.titleBand,H,.5),gt(t,d.rowtitle,c,0,v,s)),d.coltitle&&(u=ct(n.titleAnchor,G),c=ct(h,"columnTitle"),c=u===m?i+c:o-c,s=ct(n.titleBand,G,.5),gt(t,d.coltitle,c,1,v,s))}function ht(t,e){return"x1"===e?t.x||0:"y1"===e?t.y||0:"x2"===e?(t.x||0)+(t.width||0):"y2"===e?(t.y||0)+(t.height||0):void 0}function mt(t,e){return t.bounds[e]}function yt(t,e){return Math.floor(Math.min(t,e))}function bt(t,e){return Math.ceil(Math.max(t,e))}function xt(t,e,n,r,o,a,i,u,s,c,d,l,f,h){var m,y,b,x,g,p,v,w,k,M=n.length,T=0,E=0;if(!M)return T;for(m=d;m<M;m+=l)n[m]&&(T=i(T,s(n[m],c)));if(!e.length)return T;for(e.length>o&&(t.warn("Grid headers exceed limit: "+o),e=e.slice(0,o)),T+=a,y=0,x=e.length;y<x;++y)t.dirty(e[y]),e[y].mark.bounds.clear();for(m=d,y=0,x=e.length;y<x;++y,m+=l){for(g=(p=e[y]).mark.bounds,b=m;b>=0&&null==(v=n[b]);b-=f);u?(w=null==h?v.x:Math.round(v.bounds.x1+h*v.bounds.width()),k=T):(w=T,k=null==h?v.y:Math.round(v.bounds.y1+h*v.bounds.height())),g.union(p.bounds.translate(w-(p.x||0),k-(p.y||0))),p.x=w,p.y=k,t.dirty(p),E=i(E,g[c])}return E}function gt(t,e,n,r,o,a){if(e){t.dirty(e);var i=n,u=n;r?i=Math.round(o.x1+a*o.width()):u=Math.round(o.y1+a*o.height()),e.bounds.translate(i-(e.x||0),u-(e.y||0)),e.mark.bounds.clear().union(e.bounds),e.x=i,e.y=u,t.dirty(e)}}function pt(t,e,n,r,y,b,x){const g=function(t,e){const n=t[e]||{};return(e,r)=>null!=n[e]?n[e]:null!=t[e]?t[e]:r}(n,e),p=(k=t,M=g("offset",0),T=-1/0,k.forEach(t=>{null!=t.offset&&(T=Math.max(T,t.offset))}),T>-1/0?T:M),v=g("anchor",f),w=v===m?1:v===h?.5:0;var k,M,T;const E={align:C,bounds:g("bounds",F),columns:"vertical"===g("direction")?1:t.length,padding:g("margin",8),center:g("center"),nodirty:!0};switch(e){case a:E.anchor={x:Math.floor(r.x1)-p,column:m,y:w*(x||r.height()+2*r.y1),row:v};break;case i:E.anchor={x:Math.ceil(r.x2)+p,y:w*(x||r.height()+2*r.y1),row:v};break;case o:E.anchor={y:Math.floor(y.y1)-p,row:m,x:w*(b||y.width()+2*y.x1),column:v};break;case u:E.anchor={y:Math.ceil(y.y2)+p,x:w*(b||y.width()+2*y.x1),column:v};break;case s:E.anchor={x:p,y:p};break;case c:E.anchor={x:b-p,y:p,column:m};break;case d:E.anchor={x:p,y:x-p,row:m};break;case l:E.anchor={x:b-p,y:x-p,column:m,row:m}}return E}function vt(t,e){var r,o,s,c,d=e.items[0],l=d.datum,f=l.orient,h=d.bounds,y=d.x,b=d.y;return d._bounds?d._bounds.clear().union(h):d._bounds=h.clone(),h.clear(),function(t,e,n){var r=e.padding,o=r-n.x,s=r-n.y;if(e.datum.title){var c=e.items[1].items[0],d=c.anchor,l=e.titlePadding||0,f=r-c.x,h=r-c.y;switch(c.orient){case a:o+=Math.ceil(c.bounds.width())+l;break;case i:case u:break;default:s+=c.fontSize+l}switch((o||s)&&kt(t,n,o,s),c.orient){case a:h+=wt(e,n,c,d,0,1);break;case i:f+=wt(e,n,c,m,1,0)+l,h+=wt(e,n,c,d,0,1);break;case u:f+=wt(e,n,c,d,1,0),h+=wt(e,n,c,m,0,0,1)+l;break;default:f+=wt(e,n,c,d,1,0)}(f||h)&&kt(t,c,f,h),(f=Math.round(c.bounds.x1-r))<0&&(kt(t,n,-f,0),kt(t,c,-f,0))}else(o||s)&&kt(t,n,o,s)}(t,d,d.items[0].items[0]),h=function(t,e){return t.items.forEach(t=>e.union(t.bounds)),e.x1=t.padding,e.y1=t.padding,e}(d,h),r=2*d.padding,o=2*d.padding,h.empty()||(r=Math.ceil(h.width()+r),o=Math.ceil(h.height()+o)),l.type===D&&(s=d.items[0].items[0].items[0].items,c=s.reduce(function(t,e){return t[e.column]=Math.max(e.bounds.x2-e.x,t[e.column]||0),t},{}),s.forEach(function(t){t.width=c[t.column],t.height=t.bounds.y2-t.y})),f!==I&&(d.x=y=0,d.y=b=0),d.width=r,d.height=o,n.boundStroke(h.set(y,b,y+r,b+o),d),d.mark.bounds.clear().union(h),d}function wt(t,e,n,r,o,a,i){const u="symbol"!==t.datum.type,s=n.datum.vgrad,c=(!u||!a&&s||i?e:e.items[0]).bounds[o?"x2":"y2"]-t.padding,d=s&&a?c:0,l=s&&a?0:c;return Math.round(r===f?d:r===m?l:.5*c)}function kt(t,e,n,r){e.x+=n,e.y+=r,e.bounds.translate(n,r),e.mark.bounds.translate(n,r),t.dirty(e)}function Mt(t){e.Transform.call(this,null,t)}r.inherits(Mt,e.Transform).transform=function(t,e){var r=e.dataflow;return t.mark.items.forEach(function(e){t.layout&&ft(r,e,t.layout),function(t,e,r){var s,c,d,l,h,y=e.items,b=Math.max(0,e.width||0),D=Math.max(0,e.height||0),P=(new n.Bounds).set(0,0,b,D),C=P.clone(),F=P.clone(),G=[];for(l=0,h=y.length;l<h;++l)switch((c=y[l]).role){case g:(ot(c)?C:F).union(at(t,c,b,D));break;case p:s=c;break;case k:G.push(vt(t,c));break;case v:case w:case M:case T:case E:case _:case A:case z:C.union(c.bounds),F.union(c.bounds);break;default:P.union(c.bounds)}if(G.length){const e={};G.forEach(t=>{(d=t.datum.orient||i)!==I&&(e[d]||(e[d]=[])).push(t)});for(let n in e){const o=e[n];lt(t,o,pt(o,n,r.legends,C,F,b,D))}G.forEach(e=>{const n=e.bounds;n.equals(e._bounds)||(e.bounds=e._bounds,t.dirty(e),e.bounds=n,t.dirty(e)),r.autosize&&r.autosize.type===O?(d=e.datum.orient)===a||d===i?P.add(n.x1,0).add(n.x2,0):d!==o&&d!==u||P.add(0,n.y1).add(0,n.y2):P.union(n)})}P.union(C).union(F),s&&P.union(function(t,e,n,r,s){var c,d=e.items[0],l=d.orient,h=d.frame,y=d.anchor,b=d.offset,g=d.bounds,p=0,v=l===a||l===i?r:n,w=0,k=0;switch(h!==x?l===a?(p=s.y2,v=s.y1):l===i?(p=s.y1,v=s.y2):(p=s.x1,v=s.x2):l===a&&(p=r,v=0),c=y===f?p:y===m?v:(p+v)/2,et.clear().union(g),l){case o:w=c,k=s.y1-b;break;case a:w=s.x1-b,k=c;break;case i:w=s.x2+b,k=c;break;case u:w=c,k=s.y2+b;break;default:w=d.x,k=d.y}return g.translate(w-(d.x||0),k-(d.y||0)),nt(d,"x",w)|nt(d,"y",k)&&(d.bounds=et,t.dirty(d),d.bounds=g,t.dirty(d)),e.bounds.clear().union(g)}(t,s,b,D,P));!function(t,e,n,r){var o=r.autosize||{},a=o.type,i=t._width,u=t._height,s=t.padding();if(t._autosize<1||!a)return;var c=Math.max(0,e.width||0),d=Math.max(0,Math.ceil(-n.x1)),l=Math.max(0,Math.ceil(n.x2-c)),f=Math.max(0,e.height||0),h=Math.max(0,Math.ceil(-n.y1)),m=Math.max(0,Math.ceil(n.y2-f));o.contains===B&&(i-=s.left+s.right,u-=s.top+s.bottom);a===I?(d=0,h=0,c=i,f=u):a===O?(c=Math.max(0,i-d-l),f=Math.max(0,u-h-m)):a===S?(c=Math.max(0,i-d-l),u=f+h+m):a===j?(i=c+d+l,f=Math.max(0,u-h-m)):a===q&&(i=c+d+l,u=f+h+m);t._resizeView(i,u,c,f,[d,h],o.resize)}(t,e,P,r)}(r,e,t)}),t.modified()&&e.reflow(),e},t.bound=L,t.identifier=V,t.mark=W,t.overlap=J,t.render=tt,t.viewlayout=Mt,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "vega-view-transforms",
"version": "4.2.0",
"version": "4.2.1",
"description": "View-specific transforms for Vega dataflows.",

@@ -30,3 +30,3 @@ "keywords": [

},
"gitHead": "a34555f5474d42a4599dd958895b8e44d3fda0fe"
"gitHead": "bb0759a26a547ac05dfc4525a610bd6a465051ed"
}

@@ -8,2 +8,3 @@ import {

import {tempBounds} from './util';
import {Bounds} from 'vega-scenegraph';
import {isObject} from 'vega-util';

@@ -50,3 +51,3 @@

function bboxFlush(item) {
return {x1: 0, y1: 0, x2: item.width || 0, y2: item.height || 0};
return new Bounds().set(0, 0, item.width || 0, item.height || 0);
}

@@ -58,3 +59,3 @@

? b.set(0, 0, 0, 0)
: b.translate(-(item.x||0), -(item.y||0));
: b.translate(-(item.x || 0), -(item.y || 0));
}

@@ -81,6 +82,6 @@

nrows = ncols < 0 ? 1 : Math.ceil(groups.length / ncols),
boxes = [],
xOffset = [], xExtent = [], xMax = 0,
yOffset = [], yExtent = [], yMax = 0,
n = groups.length,
xOffset = Array(n), xExtent = Array(ncols), xMax = 0,
yOffset = Array(n), yExtent = Array(nrows), yMax = 0,
dx = Array(n), dy = Array(n), boxes = Array(n),
m, i, c, r, b, g, px, py, x, y, offset;

@@ -93,13 +94,14 @@

for (i=0; i<n; ++i) {
b = boxes[i] = bbox(groups[i]);
g = groups[i];
b = boxes[i] = bbox(g);
g.x = g.x || 0; dx[i] = 0;
g.y = g.y || 0; dy[i] = 0;
c = i % ncols;
r = ~~(i / ncols);
px = Math.ceil(bbox(groups[i]).x2);
py = Math.ceil(bbox(groups[i]).y2);
xMax = Math.max(xMax, px);
yMax = Math.max(yMax, py);
xMax = Math.max(xMax, px = Math.ceil(b.x2));
yMax = Math.max(yMax, py = Math.ceil(b.y2));
xExtent[c] = Math.max(xExtent[c], px);
yExtent[r] = Math.max(yExtent[r], py);
xOffset.push(padCol + offsetValue(b.x1));
yOffset.push(padRow + offsetValue(b.y1));
xOffset[i] = padCol + offsetValue(b.x1);
yOffset[i] = padRow + offsetValue(b.y1);
if (dirty) view.dirty(groups[i]);

@@ -166,6 +168,4 @@ }

for (x=0, i=0; i<n; ++i) {
g = groups[i];
px = g.x || 0;
g.x = (x = xOffset[i] + (i % ncols ? x : 0));
g.bounds.translate(x - px, 0);
x = xOffset[i] + (i % ncols ? x : 0);
dx[i] += x - groups[i].x;
}

@@ -176,6 +176,4 @@

for (y=0, i=c; i<n; i += ncols) {
g = groups[i];
py = g.y || 0;
g.y = (y += yOffset[i]);
g.bounds.translate(0, y - py);
y += yOffset[i];
dy[i] += y - groups[i].y;
}

@@ -185,12 +183,7 @@ }

// perform horizontal centering
// TODO: remove nrows > 1 constraint?
if (alignCol && get(opt.center, Column) && nrows > 1) {
for (i=0; i<n; ++i) {
g = groups[i];
b = alignCol === All ? xMax : xExtent[i % ncols];
x = b - boxes[i].x2;
if (x > 0) {
g.x += (px = x / 2);
g.bounds.translate(px, 0);
}
x = b - boxes[i].x2 - groups[i].x - dx[i];
if (x > 0) dx[i] += x / 2;
}

@@ -200,12 +193,7 @@ }

// perform vertical centering
// TODO: remove ncols !== 1 constraint?
if (alignRow && get(opt.center, Row) && ncols !== 1) {
for (i=0; i<n; ++i) {
g = groups[i];
b = alignRow === All ? yMax : yExtent[~~(i / ncols)];
y = b - boxes[i].y2;
if (y > 0) {
g.y += (py = y / 2);
g.bounds.translate(0, py);
}
y = b - boxes[i].y2 - groups[i].y - dy[i];
if (y > 0) dy[i] += y / 2;
}

@@ -215,3 +203,5 @@ }

// position grid relative to anchor
for (i=0; i<n; ++i) bounds.union(boxes[i]);
for (i=0; i<n; ++i) {
bounds.union(boxes[i].translate(dx[i], dy[i]));
}
x = get(opt.anchor, X);

@@ -237,6 +227,5 @@ y = get(opt.anchor, Y);

g = groups[i];
g.x += x;
g.y += y;
g.bounds.translate(x, y);
bounds.union(g.mark.bounds.union(g.bounds));
g.x += (dx[i] += x);
g.y += (dy[i] += y);
bounds.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i])));
if (dirty) view.dirty(g);

@@ -256,3 +245,3 @@ }

cells = nrows * ncols,
x, y, band, offset;
x, y, x2, y2, anchor, band, offset;

@@ -279,3 +268,3 @@ // -- initial grid layout

band = get(opt.footerBand, Row, null);
layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get(off, 'rowFooter'), max, 0, bbox, 'x2', ncols-1, ncols, 1, band);
x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get(off, 'rowFooter'), max, 0, bbox, 'x2', ncols-1, ncols, 1, band);
}

@@ -286,3 +275,3 @@

band = get(opt.footerBand, Column, null);
layoutHeaders(view, views.colfooters, groups, ncols, ncols, get(off, 'columnFooter'), max, 1, bbox, 'y2', cells-ncols, 1, ncols, band);
y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get(off, 'columnFooter'), max, 1, bbox, 'y2', cells-ncols, 1, ncols, band);
}

@@ -292,3 +281,5 @@

if (views.rowtitle) {
offset = x - get(off, 'rowTitle');
anchor = get(opt.titleAnchor, Row);
offset = get(off, 'rowTitle');
offset = anchor === End ? x2 + offset : x - offset;
band = get(opt.titleBand, Row, 0.5);

@@ -300,3 +291,5 @@ layoutTitle(view, views.rowtitle, offset, 0, bounds, band);

if (views.coltitle) {
offset = y - get(off, 'columnTitle');
anchor = get(opt.titleAnchor, Column);
offset = get(off, 'columnTitle');
offset = anchor === End ? y2 + offset : y - offset;
band = get(opt.titleBand, Column, 0.5);

@@ -303,0 +296,0 @@ layoutTitle(view, views.coltitle, offset, 1, bounds, band);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc