Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vega-runtime

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-runtime - npm Package Compare versions

Comparing version 6.1.3 to 6.1.4

rollup.config.mjs

201

build/vega-runtime.js

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

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vega = {}, global.vega, global.vega));
}(this, (function (exports, vegaUtil, vegaDataflow) { 'use strict';
})(this, (function (exports, vegaUtil, vegaDataflow) { 'use strict';

@@ -13,25 +13,29 @@ /**

const ctx = this,
operators = spec.operators || []; // parse background
operators = spec.operators || [];
// parse background
if (spec.background) {
ctx.background = spec.background;
} // parse event configuration
}
// parse event configuration
if (spec.eventConfig) {
ctx.eventConfig = spec.eventConfig;
} // parse locale configuration
}
// parse locale configuration
if (spec.locale) {
ctx.locale = spec.locale;
} // parse operators
}
// parse operators
operators.forEach(entry => ctx.parseOperator(entry));
operators.forEach(entry => ctx.parseOperator(entry)); // parse operator parameters
// parse operator parameters
operators.forEach(entry => ctx.parseOperatorParameters(entry));
operators.forEach(entry => ctx.parseOperatorParameters(entry)); // parse streams
// parse streams
(spec.streams || []).forEach(entry => ctx.parseStream(entry));
(spec.streams || []).forEach(entry => ctx.parseStream(entry)); // parse updates
// parse updates
(spec.updates || []).forEach(entry => ctx.parseUpdate(entry));

@@ -42,7 +46,6 @@ return ctx.resolve();

const Skip = vegaUtil.toSet(['rule']),
Swap = vegaUtil.toSet(['group', 'image', 'rect']);
Swap = vegaUtil.toSet(['group', 'image', 'rect']);
function adjustSpatial(encode, marktype) {
let code = '';
if (Skip[marktype]) return code;
if (encode.x2) {

@@ -53,3 +56,2 @@ if (encode.x) {

}
code += 'o.width=o.x2-o.x;';

@@ -60,7 +62,5 @@ } else {

}
if (encode.xc) {
code += 'o.x=o.xc-(o.width||0)/2;';
}
if (encode.y2) {

@@ -71,3 +71,2 @@ if (encode.y) {

}
code += 'o.height=o.y2-o.y;';

@@ -78,7 +77,5 @@ } else {

}
if (encode.yc) {
code += 'o.y=o.yc-(o.height||0)/2;';
}
return code;

@@ -98,11 +95,10 @@ }

// wrap code in return statement if expression does not terminate
if (code[code.length - 1] !== ';') {
if (!code.endsWith(';')) {
code = 'return(' + code + ');';
}
const fn = Function(...args.concat(code));
return ctx && ctx.functions ? fn.bind(ctx.functions) : fn;
} // generate code for comparing a single field
}
// generate code for comparing a single field
function _compare(u, v, lt, gt) {

@@ -114,3 +110,2 @@ return `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt}

}
var expressionCodegen = {

@@ -121,3 +116,2 @@ /**

operator: (ctx, expr) => expression(ctx, ['_'], expr.code),
/**

@@ -127,3 +121,2 @@ * Parse an expression provided as an operator parameter value.

parameter: (ctx, expr) => expression(ctx, ['datum', '_'], expr.code),
/**

@@ -133,3 +126,2 @@ * Parse an expression applied to an event stream.

event: (ctx, expr) => expression(ctx, ['event'], expr.code),
/**

@@ -142,3 +134,2 @@ * Parse an expression used to handle an event-driven operator update.

},
/**

@@ -153,3 +144,2 @@ * Parse an expression that performs visual encoding.

let code = 'var o=item,datum=o.datum,m=0,$;';
for (const name in channels) {

@@ -159,3 +149,2 @@ const o = 'o[' + vegaUtil.stringValue(name) + ']';

}
code += adjustSpatial(channels, marktype);

@@ -165,3 +154,2 @@ code += 'return m;';

},
/**

@@ -177,10 +165,7 @@ * Optimized code generators for access and comparison.

},
comparator(fields, orders) {
let t;
const map = (f, i) => {
const o = orders[i];
let u, v;
if (f.path) {

@@ -194,10 +179,7 @@ u = `a${f.path}`;

}
return _compare(u, v, -o, o);
};
const fn = Function('a', 'b', 'var u, v; return ' + fields.map(map).join('') + '0;');
return t ? fn.bind(t) : fn;
}
}

@@ -209,6 +191,4 @@ };

*/
function parseOperator(spec) {
const ctx = this;
if (isOperator(spec.type) || !spec.type) {

@@ -220,9 +200,8 @@ ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null);

}
/**
* Parse and assign operator parameters.
*/
function parseOperatorParameters(spec) {
const ctx = this;
if (spec.params) {

@@ -238,7 +217,5 @@ const op = ctx.get(spec.id);

*/
function parseParameters(spec, params) {
params = params || {};
const ctx = this;
for (const key in spec) {

@@ -248,15 +225,12 @@ const value = spec[key];

}
return params;
}
/**
* Parse a single parameter.
*/
function parseParameter(spec, ctx, params) {
if (!spec || !vegaUtil.isObject(spec)) return spec;
for (let i = 0, n = PARSERS.length, p; i < n; ++i) {
p = PARSERS[i];
if (vegaUtil.hasOwnProperty(spec, p.key)) {

@@ -266,8 +240,6 @@ return p.parse(spec, ctx, params);

}
return spec;
}
/** Reference parsers. */
var PARSERS = [{

@@ -301,14 +273,13 @@ key: '$ref',

}];
/**
* Resolve an operator reference.
*/
function getOperator(_, ctx) {
return ctx.get(_.$ref) || vegaUtil.error('Operator not defined: ' + _.$ref);
}
/**
* Resolve an expression reference.
*/
function getExpression(_, ctx, params) {

@@ -319,11 +290,9 @@ if (_.$params) {

}
const k = 'e:' + _.$expr.code;
return ctx.fn[k] || (ctx.fn[k] = vegaUtil.accessor(ctx.parameterExpression(_.$expr), _.$fields));
}
const k = 'e:' + _.$expr.code + '_' + _.$name;
return ctx.fn[k] || (ctx.fn[k] = vegaUtil.accessor(ctx.parameterExpression(_.$expr), _.$fields, _.$name));
}
/**
* Resolve a key accessor reference.
*/
function getKey(_, ctx) {

@@ -333,7 +302,6 @@ const k = 'k:' + _.$key + '_' + !!_.$flat;

}
/**
* Resolve a field accessor reference.
*/
function getField(_, ctx) {

@@ -344,7 +312,6 @@ if (!_.$field) return null;

}
/**
* Resolve a comparator function reference.
*/
function getCompare(_, ctx) {

@@ -354,14 +321,12 @@ // As of Vega 5.5.3, $tupleid sort is no longer used.

const k = 'c:' + _.$compare + '_' + _.$order,
c = vegaUtil.array(_.$compare).map(_ => _ && _.$tupleid ? vegaDataflow.tupleid : _);
c = vegaUtil.array(_.$compare).map(_ => _ && _.$tupleid ? vegaDataflow.tupleid : _);
return ctx.fn[k] || (ctx.fn[k] = vegaUtil.compare(c, _.$order, ctx.expr.codegen));
}
/**
* Resolve an encode operator reference.
*/
function getEncode(_, ctx) {
const spec = _.$encode,
encode = {};
encode = {};
for (const name in spec) {

@@ -372,18 +337,15 @@ const enc = spec[name];

}
return encode;
}
/**
* Resolve a context reference.
*/
function getContext(_, ctx) {
return ctx;
}
/**
* Resolve a recursive subflow specification.
*/
function getSubflow(_, ctx) {

@@ -393,16 +355,13 @@ const spec = _.$subflow;

const subctx = ctx.fork().parse(spec),
op = subctx.get(spec.operators[0].id),
p = subctx.signals.parent;
op = subctx.get(spec.operators[0].id),
p = subctx.signals.parent;
if (p) p.set(parent);
op.detachSubflow = () => ctx.detach(subctx);
return op;
};
}
/**
* Resolve a tuple id reference.
*/
function getTupleId() {

@@ -415,9 +374,7 @@ return vegaDataflow.tupleid;

*/
function parseStream (spec) {
var ctx = this,
filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined,
stream = spec.stream != null ? ctx.get(spec.stream) : undefined,
args;
filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined,
stream = spec.stream != null ? ctx.get(spec.stream) : undefined,
args;
if (spec.source) {

@@ -429,3 +386,2 @@ stream = ctx.events(spec.source, spec.type, filter);

}
if (spec.between) {

@@ -435,19 +391,14 @@ args = spec.between.map(_ => ctx.get(_));

}
if (spec.filter) {
stream = stream.filter(filter);
}
if (spec.throttle != null) {
stream = stream.throttle(+spec.throttle);
}
if (spec.debounce != null) {
stream = stream.debounce(+spec.debounce);
}
if (stream == null) {
vegaUtil.error('Invalid stream definition: ' + JSON.stringify(spec));
}
if (spec.consume) stream.consume(true);

@@ -460,13 +411,11 @@ ctx.stream(spec, stream);

*/
function parseUpdate (spec) {
var ctx = this,
srcid = vegaUtil.isObject(srcid = spec.source) ? srcid.$ref : srcid,
source = ctx.get(srcid),
target = null,
update = spec.update,
params = undefined;
srcid = vegaUtil.isObject(srcid = spec.source) ? srcid.$ref : srcid,
source = ctx.get(srcid),
target = null,
update = spec.update,
params = undefined;
if (!source) vegaUtil.error('Source not defined: ' + spec.source);
target = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target);
if (update && update.$expr) {

@@ -476,6 +425,4 @@ if (update.$params) {

}
update = ctx.handlerExpression(update.$expr);
}
ctx.update(spec, source, target, update, params);

@@ -489,4 +436,3 @@ }

var ctx = this,
state = {};
state = {};
if (options.signals) {

@@ -496,3 +442,2 @@ var signals = state.signals = {};

const op = ctx.signals[key];
if (options.signals(key, op)) {

@@ -503,3 +448,2 @@ signals[key] = op.value;

}
if (options.data) {

@@ -509,3 +453,2 @@ var data = state.data = {};

const dataset = ctx.data[key];
if (options.data(key, dataset)) {

@@ -516,7 +459,5 @@ data[key] = dataset.input.value;

}
if (ctx.subcontext && options.recurse !== false) {
state.subcontext = ctx.subcontext.map(ctx => ctx.getState(options));
}
return state;

@@ -526,5 +467,5 @@ }

var ctx = this,
df = ctx.dataflow,
data = state.data,
signals = state.signals;
df = ctx.dataflow,
data = state.data,
signals = state.signals;
Object.keys(signals || {}).forEach(key => {

@@ -547,7 +488,5 @@ df.update(ctx.signals[key], signals[key], SKIP);

*/
function context (df, transforms, functions, expr) {
return new Context(df, transforms, functions, expr);
}
function Context(df, transforms, functions, expr) {

@@ -562,3 +501,2 @@ this.dataflow = df;

this.fn = {};
if (functions) {

@@ -569,3 +507,2 @@ this.functions = Object.create(functions);

}
function Subcontext(ctx) {

@@ -581,3 +518,2 @@ this.dataflow = ctx.dataflow;

this.fn = Object.create(ctx.fn);
if (ctx.functions) {

@@ -588,3 +524,2 @@ this.functions = Object.create(ctx.functions);

}
Context.prototype = Subcontext.prototype = {

@@ -596,30 +531,23 @@ fork() {

},
detach(ctx) {
this.subcontext = this.subcontext.filter(c => c !== ctx);
detach(ctx) {
this.subcontext = this.subcontext.filter(c => c !== ctx); // disconnect all nodes in the subcontext
// disconnect all nodes in the subcontext
// wipe out targets first for better efficiency
const keys = Object.keys(ctx.nodes);
for (const key of keys) ctx.nodes[key]._targets = null;
for (const key of keys) ctx.nodes[key].detach();
ctx.nodes = null;
},
get(id) {
return this.nodes[id];
},
set(id, node) {
return this.nodes[id] = node;
},
add(spec, op) {
const ctx = this,
df = ctx.dataflow,
data = spec.value;
df = ctx.dataflow,
data = spec.value;
ctx.set(spec.id, op);
if (isCollect(spec.type) && data) {

@@ -634,10 +562,7 @@ if (data.$ingest) {

}
if (spec.root) {
ctx.root = op;
}
if (spec.parent) {
let p = ctx.get(spec.parent.$ref);
if (p) {

@@ -654,11 +579,8 @@ df.connect(p, [op]);

}
if (spec.signal) {
ctx.signals[spec.signal] = op;
}
if (spec.scale) {
ctx.scales[spec.scale] = op;
}
if (spec.data) {

@@ -671,3 +593,2 @@ for (const name in spec.data) {

},
resolve() {

@@ -678,19 +599,14 @@ (this.unresolved || []).forEach(fn => fn());

},
operator(spec, update) {
this.add(spec, this.dataflow.add(spec.value, update));
},
transform(spec, type) {
this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)]));
},
stream(spec, stream) {
this.set(spec.id, stream);
},
update(spec, stream, target, update, params) {
this.dataflow.on(stream, target, update, params, spec.options);
},
// expression parsing

@@ -700,19 +616,14 @@ operatorExpression(expr) {

},
parameterExpression(expr) {
return this.expr.parameter(this, expr);
},
eventExpression(expr) {
return this.expr.event(this, expr);
},
handlerExpression(expr) {
return this.expr.handler(this, expr);
},
encodeExpression(encode) {
return this.expr.encode(this, encode);
},
// parse methods

@@ -732,4 +643,2 @@ parse,

Object.defineProperty(exports, '__esModule', { value: true });
})));
}));

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

var vega=function(e,t,n){"use strict";const r=t.toSet(["rule"]),o=t.toSet(["group","image","rect"]);function a(e){return(e+"").toLowerCase()}function s(e,t,n){";"!==n[n.length-1]&&(n="return("+n+");");const r=Function(...t.concat(n));return e&&e.functions?r.bind(e.functions):r}var c={operator:(e,t)=>s(e,["_"],t.code),parameter:(e,t)=>s(e,["datum","_"],t.code),event:(e,t)=>s(e,["event"],t.code),handler:(e,t)=>s(e,["_","event"],"var datum=event.item&&event.item.datum;return ".concat(t.code,";")),encode:(e,n)=>{const{marktype:a,channels:c}=n;let i="var o=item,datum=o.datum,m=0,$;";for(const e in c){const n="o["+t.stringValue(e)+"]";i+="$=".concat(c[e].code,";if(").concat(n,"!==$)").concat(n,"=$,m=1;")}return i+=function(e,t){let n="";return r[t]||(e.x2&&(e.x?(o[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(o[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(c,a),i+="return m;",s(e,["item","_"],i)},codegen:{get(e){const n="[".concat(e.map(t.stringValue).join("]["),"]"),r=Function("_","return _".concat(n,";"));return r.path=n,r},comparator(e,t){let n;const r=Function("a","b","var u, v; return "+e.map((e,r)=>{const o=t[r];let a,s;return e.path?(a="a".concat(e.path),s="b".concat(e.path)):((n=n||{})["f"+r]=e,a="this.f".concat(r,"(a)"),s="this.f".concat(r,"(b)")),function(e,t,n,r){return"((u = ".concat(e,") < (v = ").concat(t,") || u == null) && v != null ? ").concat(n,"\n : (u > v || v == null) && u != null ? ").concat(r,"\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ").concat(n,"\n : v !== v && u === u ? ").concat(r," : ")}(a,s,-o,o)}).join("")+"0;");return n?r.bind(n):r}}};function i(e,n,r){if(!e||!t.isObject(e))return e;for(let o,a=0,s=u.length;a<s;++a)if(o=u[a],t.hasOwnProperty(e,o.key))return o.parse(e,n,r);return e}var u=[{key:"$ref",parse:function(e,n){return n.get(e.$ref)||t.error("Operator not defined: "+e.$ref)}},{key:"$key",parse:function(e,n){const r="k:"+e.$key+"_"+!!e.$flat;return n.fn[r]||(n.fn[r]=t.key(e.$key,e.$flat,n.expr.codegen))}},{key:"$expr",parse:function(e,n,r){e.$params&&n.parseParameters(e.$params,r);const o="e:"+e.$expr.code+"_"+e.$name;return n.fn[o]||(n.fn[o]=t.accessor(n.parameterExpression(e.$expr),e.$fields,e.$name))}},{key:"$field",parse:function(e,n){if(!e.$field)return null;const r="f:"+e.$field+"_"+e.$name;return n.fn[r]||(n.fn[r]=t.field(e.$field,e.$name,n.expr.codegen))}},{key:"$encode",parse:function(e,n){const r=e.$encode,o={};for(const e in r){const a=r[e];o[e]=t.accessor(n.encodeExpression(a.$expr),a.$fields),o[e].output=a.$output}return o}},{key:"$compare",parse:function(e,r){const o="c:"+e.$compare+"_"+e.$order,a=t.array(e.$compare).map(e=>e&&e.$tupleid?n.tupleid:e);return r.fn[o]||(r.fn[o]=t.compare(a,e.$order,r.expr.codegen))}},{key:"$context",parse:function(e,t){return t}},{key:"$subflow",parse:function(e,t){const n=e.$subflow;return function(e,r,o){const a=t.fork().parse(n),s=a.get(n.operators[0].id),c=a.signals.parent;return c&&c.set(o),s.detachSubflow=()=>t.detach(a),s}}},{key:"$tupleid",parse:function(){return n.tupleid}}];const p={skip:!0};function d(e,t,n,r){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=r||c,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function f(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}return d.prototype=f.prototype={fork(){const e=new f(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter(t=>t!==e);const t=Object.keys(e.nodes);for(const n of t)e.nodes[n]._targets=null;for(const n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const n=this,r=n.dataflow,o=e.value;if(n.set(e.id,t),"collect"===a(e.type)&&o&&(o.$ingest?r.ingest(t,o.$ingest,o.$format):o.$request?r.preload(t,o.$request,o.$format):r.pulse(t,r.changeset().insert(o))),e.root&&(n.root=t),e.parent){let o=n.get(e.parent.$ref);o?(r.connect(o,[t]),t.targets().add(o)):(n.unresolved=n.unresolved||[]).push(()=>{o=n.get(e.parent.$ref),r.connect(o,[t]),t.targets().add(o)})}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(const r in e.data){const o=n.data[r]||(n.data[r]={});e.data[r].forEach(e=>o[e]=t)}},resolve(){return(this.unresolved||[]).forEach(e=>e()),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[a(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,r,o){this.dataflow.on(t,n,r,o,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:function(e){const t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach(e=>t.parseOperator(e)),n.forEach(e=>t.parseOperatorParameters(e)),(e.streams||[]).forEach(e=>t.parseStream(e)),(e.updates||[]).forEach(e=>t.parseUpdate(e)),t.resolve()},parseOperator:function(e){const t=this;"operator"!==a(e.type)&&e.type?t.transform(e,e.type):t.operator(e,e.update?t.operatorExpression(e.update):null)},parseOperatorParameters:function(e){const n=this;if(e.params){const r=n.get(e.id);r||t.error("Invalid operator id: "+e.id),n.dataflow.connect(r,r.parameters(n.parseParameters(e.params),e.react,e.initonly))}},parseParameters:function(e,n){n=n||{};const r=this;for(const o in e){const a=e[o];n[o]=t.isArray(a)?a.map(e=>i(e,r,n)):i(a,r,n)}return n},parseStream:function(e){var n,r=this,o=null!=e.filter?r.eventExpression(e.filter):void 0,a=null!=e.stream?r.get(e.stream):void 0;e.source?a=r.events(e.source,e.type,o):e.merge&&(a=(n=e.merge.map(e=>r.get(e)))[0].merge.apply(n[0],n.slice(1))),e.between&&(n=e.between.map(e=>r.get(e)),a=a.between(n[0],n[1])),e.filter&&(a=a.filter(o)),null!=e.throttle&&(a=a.throttle(+e.throttle)),null!=e.debounce&&(a=a.debounce(+e.debounce)),null==a&&t.error("Invalid stream definition: "+JSON.stringify(e)),e.consume&&a.consume(!0),r.stream(e,a)},parseUpdate:function(e){var n,r=this,o=t.isObject(o=e.source)?o.$ref:o,a=r.get(o),s=e.update,c=void 0;a||t.error("Source not defined: "+e.source),n=e.target&&e.target.$expr?r.eventExpression(e.target.$expr):r.get(e.target),s&&s.$expr&&(s.$params&&(c=r.parseParameters(s.$params)),s=r.handlerExpression(s.$expr)),r.update(e,a,n,s,c)},getState:function(e){var t=this,n={};if(e.signals){var r=n.signals={};Object.keys(t.signals).forEach(n=>{const o=t.signals[n];e.signals(n,o)&&(r[n]=o.value)})}if(e.data){var o=n.data={};Object.keys(t.data).forEach(n=>{const r=t.data[n];e.data(n,r)&&(o[n]=r.input.value)})}return t.subcontext&&!1!==e.recurse&&(n.subcontext=t.subcontext.map(t=>t.getState(e))),n},setState:function(e){var n=this,r=n.dataflow,o=e.data,a=e.signals;Object.keys(a||{}).forEach(e=>{r.update(n.signals[e],a[e],p)}),Object.keys(o||{}).forEach(e=>{r.pulse(n.data[e].input,r.changeset().remove(t.truthy).insert(o[e]))}),(e.subcontext||[]).forEach((e,t)=>{const r=n.subcontext[t];r&&r.setState(e)})}},e.context=function(e,t,n,r){return new d(e,t,n,r)},e}({},vega,vega);
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-dataflow")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-dataflow"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.vega,e.vega)}(this,(function(e,t,r){"use strict";const n=t.toSet(["rule"]),o=t.toSet(["group","image","rect"]);function s(e){return(e+"").toLowerCase()}function a(e,t,r){r.endsWith(";")||(r="return("+r+");");const n=Function(...t.concat(r));return e&&e.functions?n.bind(e.functions):n}var i={operator:(e,t)=>a(e,["_"],t.code),parameter:(e,t)=>a(e,["datum","_"],t.code),event:(e,t)=>a(e,["event"],t.code),handler:(e,t)=>a(e,["_","event"],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,r)=>{const{marktype:s,channels:i}=r;let c="var o=item,datum=o.datum,m=0,$;";for(const e in i){const r="o["+t.stringValue(e)+"]";c+=`$=${i[e].code};if(${r}!==$)${r}=$,m=1;`}return c+=function(e,t){let r="";return n[t]||(e.x2&&(e.x?(o[t]&&(r+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),r+="o.width=o.x2-o.x;"):r+="o.x=o.x2-(o.width||0);"),e.xc&&(r+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(o[t]&&(r+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),r+="o.height=o.y2-o.y;"):r+="o.y=o.y2-(o.height||0);"),e.yc&&(r+="o.y=o.yc-(o.height||0)/2;")),r}(i,s),c+="return m;",a(e,["item","_"],c)},codegen:{get(e){const r=`[${e.map(t.stringValue).join("][")}]`,n=Function("_",`return _${r};`);return n.path=r,n},comparator(e,t){let r;const n=Function("a","b","var u, v; return "+e.map(((e,n)=>{const o=t[n];let s,a;return e.path?(s=`a${e.path}`,a=`b${e.path}`):((r=r||{})["f"+n]=e,s=`this.f${n}(a)`,a=`this.f${n}(b)`),function(e,t,r,n){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${r}\n : (u > v || v == null) && u != null ? ${n}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${r}\n : v !== v && u === u ? ${n} : `}(s,a,-o,o)})).join("")+"0;");return r?n.bind(r):n}}};function c(e,r,n){if(!e||!t.isObject(e))return e;for(let o,s=0,a=u.length;s<a;++s)if(o=u[s],t.hasOwnProperty(e,o.key))return o.parse(e,r,n);return e}var u=[{key:"$ref",parse:function(e,r){return r.get(e.$ref)||t.error("Operator not defined: "+e.$ref)}},{key:"$key",parse:function(e,r){const n="k:"+e.$key+"_"+!!e.$flat;return r.fn[n]||(r.fn[n]=t.key(e.$key,e.$flat,r.expr.codegen))}},{key:"$expr",parse:function(e,r,n){e.$params&&r.parseParameters(e.$params,n);const o="e:"+e.$expr.code;return r.fn[o]||(r.fn[o]=t.accessor(r.parameterExpression(e.$expr),e.$fields))}},{key:"$field",parse:function(e,r){if(!e.$field)return null;const n="f:"+e.$field+"_"+e.$name;return r.fn[n]||(r.fn[n]=t.field(e.$field,e.$name,r.expr.codegen))}},{key:"$encode",parse:function(e,r){const n=e.$encode,o={};for(const e in n){const s=n[e];o[e]=t.accessor(r.encodeExpression(s.$expr),s.$fields),o[e].output=s.$output}return o}},{key:"$compare",parse:function(e,n){const o="c:"+e.$compare+"_"+e.$order,s=t.array(e.$compare).map((e=>e&&e.$tupleid?r.tupleid:e));return n.fn[o]||(n.fn[o]=t.compare(s,e.$order,n.expr.codegen))}},{key:"$context",parse:function(e,t){return t}},{key:"$subflow",parse:function(e,t){const r=e.$subflow;return function(e,n,o){const s=t.fork().parse(r),a=s.get(r.operators[0].id),i=s.signals.parent;return i&&i.set(o),a.detachSubflow=()=>t.detach(s),a}}},{key:"$tupleid",parse:function(){return r.tupleid}}];const f={skip:!0};function p(e,t,r,n){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=n||i,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},r&&(this.functions=Object.create(r),this.functions.context=this)}function d(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}p.prototype=d.prototype={fork(){const e=new d(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter((t=>t!==e));const t=Object.keys(e.nodes);for(const r of t)e.nodes[r]._targets=null;for(const r of t)e.nodes[r].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const r=this,n=r.dataflow,o=e.value;if(r.set(e.id,t),"collect"===s(e.type)&&o&&(o.$ingest?n.ingest(t,o.$ingest,o.$format):o.$request?n.preload(t,o.$request,o.$format):n.pulse(t,n.changeset().insert(o))),e.root&&(r.root=t),e.parent){let o=r.get(e.parent.$ref);o?(n.connect(o,[t]),t.targets().add(o)):(r.unresolved=r.unresolved||[]).push((()=>{o=r.get(e.parent.$ref),n.connect(o,[t]),t.targets().add(o)}))}if(e.signal&&(r.signals[e.signal]=t),e.scale&&(r.scales[e.scale]=t),e.data)for(const n in e.data){const o=r.data[n]||(r.data[n]={});e.data[n].forEach((e=>o[e]=t))}},resolve(){return(this.unresolved||[]).forEach((e=>e())),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[s(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,r,n,o){this.dataflow.on(t,r,n,o,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:function(e){const t=this,r=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),r.forEach((e=>t.parseOperator(e))),r.forEach((e=>t.parseOperatorParameters(e))),(e.streams||[]).forEach((e=>t.parseStream(e))),(e.updates||[]).forEach((e=>t.parseUpdate(e))),t.resolve()},parseOperator:function(e){const t=this;"operator"!==s(e.type)&&e.type?t.transform(e,e.type):t.operator(e,e.update?t.operatorExpression(e.update):null)},parseOperatorParameters:function(e){const r=this;if(e.params){const n=r.get(e.id);n||t.error("Invalid operator id: "+e.id),r.dataflow.connect(n,n.parameters(r.parseParameters(e.params),e.react,e.initonly))}},parseParameters:function(e,r){r=r||{};const n=this;for(const o in e){const s=e[o];r[o]=t.isArray(s)?s.map((e=>c(e,n,r))):c(s,n,r)}return r},parseStream:function(e){var r,n=this,o=null!=e.filter?n.eventExpression(e.filter):void 0,s=null!=e.stream?n.get(e.stream):void 0;e.source?s=n.events(e.source,e.type,o):e.merge&&(s=(r=e.merge.map((e=>n.get(e))))[0].merge.apply(r[0],r.slice(1))),e.between&&(r=e.between.map((e=>n.get(e))),s=s.between(r[0],r[1])),e.filter&&(s=s.filter(o)),null!=e.throttle&&(s=s.throttle(+e.throttle)),null!=e.debounce&&(s=s.debounce(+e.debounce)),null==s&&t.error("Invalid stream definition: "+JSON.stringify(e)),e.consume&&s.consume(!0),n.stream(e,s)},parseUpdate:function(e){var r,n=this,o=t.isObject(o=e.source)?o.$ref:o,s=n.get(o),a=e.update,i=void 0;s||t.error("Source not defined: "+e.source),r=e.target&&e.target.$expr?n.eventExpression(e.target.$expr):n.get(e.target),a&&a.$expr&&(a.$params&&(i=n.parseParameters(a.$params)),a=n.handlerExpression(a.$expr)),n.update(e,s,r,a,i)},getState:function(e){var t=this,r={};if(e.signals){var n=r.signals={};Object.keys(t.signals).forEach((r=>{const o=t.signals[r];e.signals(r,o)&&(n[r]=o.value)}))}if(e.data){var o=r.data={};Object.keys(t.data).forEach((r=>{const n=t.data[r];e.data(r,n)&&(o[r]=n.input.value)}))}return t.subcontext&&!1!==e.recurse&&(r.subcontext=t.subcontext.map((t=>t.getState(e)))),r},setState:function(e){var r=this,n=r.dataflow,o=e.data,s=e.signals;Object.keys(s||{}).forEach((e=>{n.update(r.signals[e],s[e],f)})),Object.keys(o||{}).forEach((e=>{n.pulse(r.data[e].input,n.changeset().remove(t.truthy).insert(o[e]))})),(e.subcontext||[]).forEach(((e,t)=>{const n=r.subcontext[t];n&&n.setState(e)}))}},e.context=function(e,t,r,n){return new p(e,t,r,n)}}));
//# sourceMappingURL=vega-runtime.min.js.map

@@ -9,25 +9,29 @@ import { toSet, stringValue, error, isArray, isObject, hasOwnProperty, accessor, key, field, array, compare, truthy } from 'vega-util';

const ctx = this,
operators = spec.operators || []; // parse background
operators = spec.operators || [];
// parse background
if (spec.background) {
ctx.background = spec.background;
} // parse event configuration
}
// parse event configuration
if (spec.eventConfig) {
ctx.eventConfig = spec.eventConfig;
} // parse locale configuration
}
// parse locale configuration
if (spec.locale) {
ctx.locale = spec.locale;
} // parse operators
}
// parse operators
operators.forEach(entry => ctx.parseOperator(entry));
operators.forEach(entry => ctx.parseOperator(entry)); // parse operator parameters
// parse operator parameters
operators.forEach(entry => ctx.parseOperatorParameters(entry));
operators.forEach(entry => ctx.parseOperatorParameters(entry)); // parse streams
// parse streams
(spec.streams || []).forEach(entry => ctx.parseStream(entry));
(spec.streams || []).forEach(entry => ctx.parseStream(entry)); // parse updates
// parse updates
(spec.updates || []).forEach(entry => ctx.parseUpdate(entry));

@@ -38,7 +42,6 @@ return ctx.resolve();

const Skip = toSet(['rule']),
Swap = toSet(['group', 'image', 'rect']);
Swap = toSet(['group', 'image', 'rect']);
function adjustSpatial(encode, marktype) {
let code = '';
if (Skip[marktype]) return code;
if (encode.x2) {

@@ -49,3 +52,2 @@ if (encode.x) {

}
code += 'o.width=o.x2-o.x;';

@@ -56,7 +58,5 @@ } else {

}
if (encode.xc) {
code += 'o.x=o.xc-(o.width||0)/2;';
}
if (encode.y2) {

@@ -67,3 +67,2 @@ if (encode.y) {

}
code += 'o.height=o.y2-o.y;';

@@ -74,7 +73,5 @@ } else {

}
if (encode.yc) {
code += 'o.y=o.yc-(o.height||0)/2;';
}
return code;

@@ -94,15 +91,16 @@ }

// wrap code in return statement if expression does not terminate
if (code[code.length - 1] !== ';') {
if (!code.endsWith(';')) {
code = 'return(' + code + ');';
}
const fn = Function(...args.concat(code));
return ctx && ctx.functions ? fn.bind(ctx.functions) : fn;
} // generate code for comparing a single field
}
// generate code for comparing a single field
function _compare(u, v, lt, gt) {
return "((u = ".concat(u, ") < (v = ").concat(v, ") || u == null) && v != null ? ").concat(lt, "\n : (u > v || v == null) && u != null ? ").concat(gt, "\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ").concat(lt, "\n : v !== v && u === u ? ").concat(gt, " : ");
return `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt}
: (u > v || v == null) && u != null ? ${gt}
: ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt}
: v !== v && u === u ? ${gt} : `;
}
var expressionCodegen = {

@@ -113,3 +111,2 @@ /**

operator: (ctx, expr) => expression(ctx, ['_'], expr.code),
/**

@@ -119,3 +116,2 @@ * Parse an expression provided as an operator parameter value.

parameter: (ctx, expr) => expression(ctx, ['datum', '_'], expr.code),
/**

@@ -125,3 +121,2 @@ * Parse an expression applied to an event stream.

event: (ctx, expr) => expression(ctx, ['event'], expr.code),
/**

@@ -131,6 +126,5 @@ * Parse an expression used to handle an event-driven operator update.

handler: (ctx, expr) => {
const code = "var datum=event.item&&event.item.datum;return ".concat(expr.code, ";");
const code = `var datum=event.item&&event.item.datum;return ${expr.code};`;
return expression(ctx, ['_', 'event'], code);
},
/**

@@ -145,8 +139,6 @@ * Parse an expression that performs visual encoding.

let code = 'var o=item,datum=o.datum,m=0,$;';
for (const name in channels) {
const o = 'o[' + stringValue(name) + ']';
code += "$=".concat(channels[name].code, ";if(").concat(o, "!==$)").concat(o, "=$,m=1;");
code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`;
}
code += adjustSpatial(channels, marktype);

@@ -156,3 +148,2 @@ code += 'return m;';

},
/**

@@ -163,31 +154,25 @@ * Optimized code generators for access and comparison.

get(path) {
const ref = "[".concat(path.map(stringValue).join(']['), "]");
const get = Function('_', "return _".concat(ref, ";"));
const ref = `[${path.map(stringValue).join('][')}]`;
const get = Function('_', `return _${ref};`);
get.path = ref;
return get;
},
comparator(fields, orders) {
let t;
const map = (f, i) => {
const o = orders[i];
let u, v;
if (f.path) {
u = "a".concat(f.path);
v = "b".concat(f.path);
u = `a${f.path}`;
v = `b${f.path}`;
} else {
(t = t || {})['f' + i] = f;
u = "this.f".concat(i, "(a)");
v = "this.f".concat(i, "(b)");
u = `this.f${i}(a)`;
v = `this.f${i}(b)`;
}
return _compare(u, v, -o, o);
};
const fn = Function('a', 'b', 'var u, v; return ' + fields.map(map).join('') + '0;');
return t ? fn.bind(t) : fn;
}
}

@@ -199,6 +184,4 @@ };

*/
function parseOperator(spec) {
const ctx = this;
if (isOperator(spec.type) || !spec.type) {

@@ -210,9 +193,8 @@ ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null);

}
/**
* Parse and assign operator parameters.
*/
function parseOperatorParameters(spec) {
const ctx = this;
if (spec.params) {

@@ -228,7 +210,5 @@ const op = ctx.get(spec.id);

*/
function parseParameters(spec, params) {
params = params || {};
const ctx = this;
for (const key in spec) {

@@ -238,15 +218,12 @@ const value = spec[key];

}
return params;
}
/**
* Parse a single parameter.
*/
function parseParameter(spec, ctx, params) {
if (!spec || !isObject(spec)) return spec;
for (let i = 0, n = PARSERS.length, p; i < n; ++i) {
p = PARSERS[i];
if (hasOwnProperty(spec, p.key)) {

@@ -256,8 +233,6 @@ return p.parse(spec, ctx, params);

}
return spec;
}
/** Reference parsers. */
var PARSERS = [{

@@ -291,14 +266,13 @@ key: '$ref',

}];
/**
* Resolve an operator reference.
*/
function getOperator(_, ctx) {
return ctx.get(_.$ref) || error('Operator not defined: ' + _.$ref);
}
/**
* Resolve an expression reference.
*/
function getExpression(_, ctx, params) {

@@ -309,11 +283,9 @@ if (_.$params) {

}
const k = 'e:' + _.$expr.code;
return ctx.fn[k] || (ctx.fn[k] = accessor(ctx.parameterExpression(_.$expr), _.$fields));
}
const k = 'e:' + _.$expr.code + '_' + _.$name;
return ctx.fn[k] || (ctx.fn[k] = accessor(ctx.parameterExpression(_.$expr), _.$fields, _.$name));
}
/**
* Resolve a key accessor reference.
*/
function getKey(_, ctx) {

@@ -323,7 +295,6 @@ const k = 'k:' + _.$key + '_' + !!_.$flat;

}
/**
* Resolve a field accessor reference.
*/
function getField(_, ctx) {

@@ -334,7 +305,6 @@ if (!_.$field) return null;

}
/**
* Resolve a comparator function reference.
*/
function getCompare(_, ctx) {

@@ -344,14 +314,12 @@ // As of Vega 5.5.3, $tupleid sort is no longer used.

const k = 'c:' + _.$compare + '_' + _.$order,
c = array(_.$compare).map(_ => _ && _.$tupleid ? tupleid : _);
c = array(_.$compare).map(_ => _ && _.$tupleid ? tupleid : _);
return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order, ctx.expr.codegen));
}
/**
* Resolve an encode operator reference.
*/
function getEncode(_, ctx) {
const spec = _.$encode,
encode = {};
encode = {};
for (const name in spec) {

@@ -362,18 +330,15 @@ const enc = spec[name];

}
return encode;
}
/**
* Resolve a context reference.
*/
function getContext(_, ctx) {
return ctx;
}
/**
* Resolve a recursive subflow specification.
*/
function getSubflow(_, ctx) {

@@ -383,16 +348,13 @@ const spec = _.$subflow;

const subctx = ctx.fork().parse(spec),
op = subctx.get(spec.operators[0].id),
p = subctx.signals.parent;
op = subctx.get(spec.operators[0].id),
p = subctx.signals.parent;
if (p) p.set(parent);
op.detachSubflow = () => ctx.detach(subctx);
return op;
};
}
/**
* Resolve a tuple id reference.
*/
function getTupleId() {

@@ -405,9 +367,7 @@ return tupleid;

*/
function parseStream (spec) {
var ctx = this,
filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined,
stream = spec.stream != null ? ctx.get(spec.stream) : undefined,
args;
filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined,
stream = spec.stream != null ? ctx.get(spec.stream) : undefined,
args;
if (spec.source) {

@@ -419,3 +379,2 @@ stream = ctx.events(spec.source, spec.type, filter);

}
if (spec.between) {

@@ -425,19 +384,14 @@ args = spec.between.map(_ => ctx.get(_));

}
if (spec.filter) {
stream = stream.filter(filter);
}
if (spec.throttle != null) {
stream = stream.throttle(+spec.throttle);
}
if (spec.debounce != null) {
stream = stream.debounce(+spec.debounce);
}
if (stream == null) {
error('Invalid stream definition: ' + JSON.stringify(spec));
}
if (spec.consume) stream.consume(true);

@@ -450,13 +404,11 @@ ctx.stream(spec, stream);

*/
function parseUpdate (spec) {
var ctx = this,
srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid,
source = ctx.get(srcid),
target = null,
update = spec.update,
params = undefined;
srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid,
source = ctx.get(srcid),
target = null,
update = spec.update,
params = undefined;
if (!source) error('Source not defined: ' + spec.source);
target = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target);
if (update && update.$expr) {

@@ -466,6 +418,4 @@ if (update.$params) {

}
update = ctx.handlerExpression(update.$expr);
}
ctx.update(spec, source, target, update, params);

@@ -479,4 +429,3 @@ }

var ctx = this,
state = {};
state = {};
if (options.signals) {

@@ -486,3 +435,2 @@ var signals = state.signals = {};

const op = ctx.signals[key];
if (options.signals(key, op)) {

@@ -493,3 +441,2 @@ signals[key] = op.value;

}
if (options.data) {

@@ -499,3 +446,2 @@ var data = state.data = {};

const dataset = ctx.data[key];
if (options.data(key, dataset)) {

@@ -506,7 +452,5 @@ data[key] = dataset.input.value;

}
if (ctx.subcontext && options.recurse !== false) {
state.subcontext = ctx.subcontext.map(ctx => ctx.getState(options));
}
return state;

@@ -516,5 +460,5 @@ }

var ctx = this,
df = ctx.dataflow,
data = state.data,
signals = state.signals;
df = ctx.dataflow,
data = state.data,
signals = state.signals;
Object.keys(signals || {}).forEach(key => {

@@ -537,7 +481,5 @@ df.update(ctx.signals[key], signals[key], SKIP);

*/
function context (df, transforms, functions, expr) {
return new Context(df, transforms, functions, expr);
}
function Context(df, transforms, functions, expr) {

@@ -552,3 +494,2 @@ this.dataflow = df;

this.fn = {};
if (functions) {

@@ -559,3 +500,2 @@ this.functions = Object.create(functions);

}
function Subcontext(ctx) {

@@ -571,3 +511,2 @@ this.dataflow = ctx.dataflow;

this.fn = Object.create(ctx.fn);
if (ctx.functions) {

@@ -578,3 +517,2 @@ this.functions = Object.create(ctx.functions);

}
Context.prototype = Subcontext.prototype = {

@@ -586,30 +524,23 @@ fork() {

},
detach(ctx) {
this.subcontext = this.subcontext.filter(c => c !== ctx);
detach(ctx) {
this.subcontext = this.subcontext.filter(c => c !== ctx); // disconnect all nodes in the subcontext
// disconnect all nodes in the subcontext
// wipe out targets first for better efficiency
const keys = Object.keys(ctx.nodes);
for (const key of keys) ctx.nodes[key]._targets = null;
for (const key of keys) ctx.nodes[key].detach();
ctx.nodes = null;
},
get(id) {
return this.nodes[id];
},
set(id, node) {
return this.nodes[id] = node;
},
add(spec, op) {
const ctx = this,
df = ctx.dataflow,
data = spec.value;
df = ctx.dataflow,
data = spec.value;
ctx.set(spec.id, op);
if (isCollect(spec.type) && data) {

@@ -624,10 +555,7 @@ if (data.$ingest) {

}
if (spec.root) {
ctx.root = op;
}
if (spec.parent) {
let p = ctx.get(spec.parent.$ref);
if (p) {

@@ -644,11 +572,8 @@ df.connect(p, [op]);

}
if (spec.signal) {
ctx.signals[spec.signal] = op;
}
if (spec.scale) {
ctx.scales[spec.scale] = op;
}
if (spec.data) {

@@ -661,3 +586,2 @@ for (const name in spec.data) {

},
resolve() {

@@ -668,19 +592,14 @@ (this.unresolved || []).forEach(fn => fn());

},
operator(spec, update) {
this.add(spec, this.dataflow.add(spec.value, update));
},
transform(spec, type) {
this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)]));
},
stream(spec, stream) {
this.set(spec.id, stream);
},
update(spec, stream, target, update, params) {
this.dataflow.on(stream, target, update, params, spec.options);
},
// expression parsing

@@ -690,19 +609,14 @@ operatorExpression(expr) {

},
parameterExpression(expr) {
return this.expr.parameter(this, expr);
},
eventExpression(expr) {
return this.expr.event(this, expr);
},
handlerExpression(expr) {
return this.expr.handler(this, expr);
},
encodeExpression(encode) {
return this.expr.encode(this, encode);
},
// parse methods

@@ -709,0 +623,0 @@ parse,

{
"name": "vega-runtime",
"version": "6.1.3",
"version": "6.1.4",
"description": "Runtime support for Vega dataflows.",

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

"prebuild": "rimraf build",
"build": "rollup -c",
"build": "rollup -c rollup.config.mjs",
"pretest": "yarn build --config-test",

@@ -26,4 +26,4 @@ "test": "tape 'test/**/*-test.js'",

"dependencies": {
"vega-dataflow": "^5.7.3",
"vega-util": "^1.15.2"
"vega-dataflow": "^5.7.5",
"vega-util": "^1.17.1"
},

@@ -34,3 +34,3 @@ "devDependencies": {

},
"gitHead": "4affcbedb9d14815dbb6d3b250ed231b54fc95c0"
"gitHead": "fb1092f6b931d450f9c210b67ae4752bd3dd461b"
}

@@ -6,3 +6,3 @@ import {adjustSpatial} from './util';

// wrap code in return statement if expression does not terminate
if (code[code.length-1] !== ';') {
if (!code.endsWith(';')) {
code = 'return(' + code + ');';

@@ -9,0 +9,0 @@ }

@@ -67,7 +67,6 @@ import {tupleid} from 'vega-dataflow';

}
const k = 'e:' + _.$expr.code + '_' + _.$name;
const k = 'e:' + _.$expr.code;
return ctx.fn[k] || (ctx.fn[k] = accessor(
ctx.parameterExpression(_.$expr),
_.$fields,
_.$name
_.$fields
));

@@ -74,0 +73,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc