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

vega-selections

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-selections - npm Package Compare versions

Comparing version 5.1.5 to 5.2.0

12

build/vega-selection.js

@@ -10,2 +10,3 @@ (function (global, factory) {

const VlMulti = 'vlMulti';
const VlPoint = 'vlPoint';
const Or = 'or';

@@ -123,6 +124,12 @@ const And = 'and';

* One of 'intersect' or 'union' (default).
* @param {boolean} isMulti - Identifies a "multi" selection to perform more
* expensive resolution computation.
* @param {boolean} vl5 - With Vega-Lite v5, "multi" selections are now called "point"
* selections, and thus the resolved tuple should reflect this name.
* This parameter allows us to reflect this change without triggering
* a major version bump for Vega.
* @returns {object} An object of selected fields and values.
*/
function selectionResolve(name, op, isMulti) {
function selectionResolve(name, op, isMulti, vl5) {
var data = this.context.data[name],

@@ -182,3 +189,4 @@ entries = data ? data.values.value : [],

if (isMulti && entries.length) {
resolved[VlMulti] = op === Union ? {
const key = vl5 ? VlPoint : VlMulti;
resolved[key] = op === Union ? {
[Or]: entries.reduce((acc, k) => (acc.push(...multiRes[k]), acc), [])

@@ -185,0 +193,0 @@ } : {

2

build/vega-selection.min.js

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-expression")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.vega,e.vega)}(this,(function(e,t,n){"use strict";const r="intersect",i="union";var u="index:unit";function o(e,n){for(var r,i,u=n.fields,o=n.values,a=u.length,f=0;f<a;++f)if((i=u[f]).getter=t.field.getter||t.field(i.field),r=i.getter(e),t.isDate(r)&&(r=t.toNumber(r)),t.isDate(o[f])&&(o[f]=t.toNumber(o[f])),t.isDate(o[f][0])&&(o[f]=o[f].map(t.toNumber)),"E"===i.type){if(t.isArray(o[f])?o[f].indexOf(r)<0:r!==o[f])return!1}else if("R"===i.type){if(!t.inrange(r,o[f]))return!1}else if("R-RE"===i.type){if(!t.inrange(r,o[f],!0,!1))return!1}else if("R-E"===i.type){if(!t.inrange(r,o[f],!1,!1))return!1}else if("R-LE"===i.type&&!t.inrange(r,o[f],!1,!0))return!1;return!0}var a={E_union:function(e,t){if(!e.length)return t;for(var n=0,r=t.length;n<r;++n)e.indexOf(t[n])<0&&e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter((e=>t.indexOf(e)>=0)):t},R_union:function(e,n){var r=t.toNumber(n[0]),i=t.toNumber(n[1]);return r>i&&(r=n[1],i=n[0]),e.length?(e[0]>r&&(e[0]=r),e[1]<i&&(e[1]=i),e):[r,i]},R_intersect:function(e,n){var r=t.toNumber(n[0]),i=t.toNumber(n[1]);return r>i&&(r=n[1],i=n[0]),e.length?i<e[0]||e[1]<r?[]:(e[0]<r&&(e[0]=r),e[1]>i&&(e[1]=i),e):[r,i]}};e.selectionResolve=function(e,n,r){for(var u,o,f,s,l,c,d,g,v,p,h,y=this.context.data[e],b=y?y.values.value:[],m={},x={},R={},O=b.length,_=0;_<O;++_){for(s=(u=b[_]).unit,o=u.fields,f=u.values,p=0,h=o.length;p<h;++p)l=o[p],d=(c=m[l.field]||(m[l.field]={}))[s]||(c[s]=[]),R[l.field]=g=l.type.charAt(0),v=a[g+"_union"],c[s]=v(d,t.array(f[p]));r&&(d=x[s]||(x[s]=[])).push(t.array(f).reduce(((e,t,n)=>(e[o[n].field]=t,e)),{}))}return n=n||i,Object.keys(m).forEach((e=>{m[e]=Object.keys(m[e]).map((t=>m[e][t])).reduce(((t,r)=>void 0===t?r:a[R[e]+"_"+n](t,r)))})),b=Object.keys(x),r&&b.length&&(m.vlMulti=n===i?{or:b.reduce(((e,t)=>(e.push(...x[t]),e)),[])}:{and:b.map((e=>({or:x[e]})))}),m},e.selectionTest=function(e,t,n){for(var i,a,f,s,l,c=this.context.data[e],d=c?c.values.value:[],g=c?c[u]&&c[u].value:void 0,v=n===r,p=d.length,h=0;h<p;++h)if(i=d[h],g&&v){if(-1===(f=(a=a||{})[s=i.unit]||0))continue;if(l=o(t,i),a[s]=l?-1:++f,l&&1===g.size)return!0;if(!l&&f===g.get(s).count)return!1}else if(v^(l=o(t,i)))return l;return p&&v},e.selectionVisitor=function(e,i,u,o){i[0].type!==n.Literal&&t.error("First argument to selection functions must be a string literal.");const a=i[0].value,f="unit",s="@unit",l=":"+a;(i.length>=2&&t.peek(i).value)!==r||t.hasOwnProperty(o,s)||(o["@unit"]=u.getData(a).indataRef(u,f)),t.hasOwnProperty(o,l)||(o[l]=u.getData(a).tuplesRef())},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-expression")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.vega,e.vega)}(this,(function(e,t,n){"use strict";const r="intersect",i="union";var u="index:unit";function o(e,n){for(var r,i,u=n.fields,o=n.values,a=u.length,f=0;f<a;++f)if((i=u[f]).getter=t.field.getter||t.field(i.field),r=i.getter(e),t.isDate(r)&&(r=t.toNumber(r)),t.isDate(o[f])&&(o[f]=t.toNumber(o[f])),t.isDate(o[f][0])&&(o[f]=o[f].map(t.toNumber)),"E"===i.type){if(t.isArray(o[f])?o[f].indexOf(r)<0:r!==o[f])return!1}else if("R"===i.type){if(!t.inrange(r,o[f]))return!1}else if("R-RE"===i.type){if(!t.inrange(r,o[f],!0,!1))return!1}else if("R-E"===i.type){if(!t.inrange(r,o[f],!1,!1))return!1}else if("R-LE"===i.type&&!t.inrange(r,o[f],!1,!0))return!1;return!0}var a={E_union:function(e,t){if(!e.length)return t;for(var n=0,r=t.length;n<r;++n)e.indexOf(t[n])<0&&e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter((e=>t.indexOf(e)>=0)):t},R_union:function(e,n){var r=t.toNumber(n[0]),i=t.toNumber(n[1]);return r>i&&(r=n[1],i=n[0]),e.length?(e[0]>r&&(e[0]=r),e[1]<i&&(e[1]=i),e):[r,i]},R_intersect:function(e,n){var r=t.toNumber(n[0]),i=t.toNumber(n[1]);return r>i&&(r=n[1],i=n[0]),e.length?i<e[0]||e[1]<r?[]:(e[0]<r&&(e[0]=r),e[1]>i&&(e[1]=i),e):[r,i]}};e.selectionResolve=function(e,n,r,u){for(var o,f,l,s,c,d,g,v,p,h,y,b=this.context.data[e],m=b?b.values.value:[],x={},R={},O={},_=m.length,E=0;E<_;++E){for(s=(o=m[E]).unit,f=o.fields,l=o.values,h=0,y=f.length;h<y;++h)c=f[h],g=(d=x[c.field]||(x[c.field]={}))[s]||(d[s]=[]),O[c.field]=v=c.type.charAt(0),p=a[v+"_union"],d[s]=p(g,t.array(l[h]));r&&(g=R[s]||(R[s]=[])).push(t.array(l).reduce(((e,t,n)=>(e[f[n].field]=t,e)),{}))}if(n=n||i,Object.keys(x).forEach((e=>{x[e]=Object.keys(x[e]).map((t=>x[e][t])).reduce(((t,r)=>void 0===t?r:a[O[e]+"_"+n](t,r)))})),m=Object.keys(R),r&&m.length){x[u?"vlPoint":"vlMulti"]=n===i?{or:m.reduce(((e,t)=>(e.push(...R[t]),e)),[])}:{and:m.map((e=>({or:R[e]})))}}return x},e.selectionTest=function(e,t,n){for(var i,a,f,l,s,c=this.context.data[e],d=c?c.values.value:[],g=c?c[u]&&c[u].value:void 0,v=n===r,p=d.length,h=0;h<p;++h)if(i=d[h],g&&v){if(-1===(f=(a=a||{})[l=i.unit]||0))continue;if(s=o(t,i),a[l]=s?-1:++f,s&&1===g.size)return!0;if(!s&&f===g.get(l).count)return!1}else if(v^(s=o(t,i)))return s;return p&&v},e.selectionVisitor=function(e,i,u,o){i[0].type!==n.Literal&&t.error("First argument to selection functions must be a string literal.");const a=i[0].value,f="unit",l="@unit",s=":"+a;(i.length>=2&&t.peek(i).value)!==r||t.hasOwnProperty(o,l)||(o["@unit"]=u.getData(a).indataRef(u,f)),t.hasOwnProperty(o,s)||(o[s]=u.getData(a).tuplesRef())},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=vega-selection.min.js.map

@@ -7,2 +7,3 @@ import { field, isDate, toNumber, isArray, inrange, array, error, peek, hasOwnProperty } from 'vega-util';

const VlMulti = 'vlMulti';
const VlPoint = 'vlPoint';
const Or = 'or';

@@ -120,6 +121,12 @@ const And = 'and';

* One of 'intersect' or 'union' (default).
* @param {boolean} isMulti - Identifies a "multi" selection to perform more
* expensive resolution computation.
* @param {boolean} vl5 - With Vega-Lite v5, "multi" selections are now called "point"
* selections, and thus the resolved tuple should reflect this name.
* This parameter allows us to reflect this change without triggering
* a major version bump for Vega.
* @returns {object} An object of selected fields and values.
*/
function selectionResolve(name, op, isMulti) {
function selectionResolve(name, op, isMulti, vl5) {
var data = this.context.data[name],

@@ -179,3 +186,4 @@ entries = data ? data.values.value : [],

if (isMulti && entries.length) {
resolved[VlMulti] = op === Union ? {
const key = vl5 ? VlPoint : VlMulti;
resolved[key] = op === Union ? {
[Or]: entries.reduce((acc, k) => (acc.push(...multiRes[k]), acc), [])

@@ -182,0 +190,0 @@ } : {

{
"name": "vega-selections",
"version": "5.1.5",
"version": "5.2.0",
"description": "Vega expression functions for Vega-Lite selections.",

@@ -24,6 +24,6 @@ "keywords": [

"dependencies": {
"vega-expression": "^4.0.0",
"vega-util": "^1.15.2"
"vega-expression": "^4.0.1",
"vega-util": "^1.16.0"
},
"gitHead": "28260d120036984d6cfc6b02c97be940f3b32e5e"
"gitHead": "0f8859294bb83eb637da209d952faf65eebcf908"
}
export const Intersect = 'intersect';
export const Union = 'union';
export const VlMulti = 'vlMulti';
export const VlPoint = 'vlPoint';
export const Or = 'or';
export const And = 'and';

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

import {And, Or, Union, VlMulti} from './constants';
import {And, Or, Union, VlMulti, VlPoint} from './constants';
import {array, toNumber} from 'vega-util';

@@ -9,5 +9,11 @@

* One of 'intersect' or 'union' (default).
* @param {boolean} isMulti - Identifies a "multi" selection to perform more
* expensive resolution computation.
* @param {boolean} vl5 - With Vega-Lite v5, "multi" selections are now called "point"
* selections, and thus the resolved tuple should reflect this name.
* This parameter allows us to reflect this change without triggering
* a major version bump for Vega.
* @returns {object} An object of selected fields and values.
*/
export function selectionResolve(name, op, isMulti) {
export function selectionResolve(name, op, isMulti, vl5) {
var data = this.context.data[name],

@@ -57,3 +63,4 @@ entries = data ? data.values.value : [],

if (isMulti && entries.length) {
resolved[VlMulti] = op === Union
const key = vl5 ? VlPoint : VlMulti;
resolved[key] = op === Union
? {[Or]: entries.reduce((acc, k) => (acc.push(...multiRes[k]), acc), [])}

@@ -60,0 +67,0 @@ : {[And]: entries.map(k => ({[Or]: multiRes[k]}))};

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