New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@visactor/vgrammar-venn

Package Overview
Dependencies
Maintainers
15
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@visactor/vgrammar-venn - npm Package Compare versions

Comparing version 0.13.0-alpha.6 to 0.13.0-alpha.7

8

cjs/animation.d.ts
import { ACustomAnimate } from '@visactor/vrender-core';
import type { IVennCircle } from './utils/interface';
import type { IVennCircle, IVennOverlapArc, VennCircleName } from './utils/interface';
export declare class VennOverlapAnimation extends ACustomAnimate<{
path: string;
arcs: IVennOverlapArc[];
}> {
protected fromCircles: IVennCircle[];
protected toCircles: IVennCircle[];
protected fromCircles: Record<VennCircleName, IVennCircle>;
protected toCircles: Record<VennCircleName, IVennCircle>;
onBind(): void;
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
}

@@ -11,8 +11,11 @@ "use strict";

onBind() {
this.fromCircles = (0, path_1.getCirclesFromArcs)((0, path_1.getArcsFromPath)(this.from.path)),
this.toCircles = (0, path_1.getCirclesFromArcs)((0, path_1.getArcsFromPath)(this.to.path));
this.fromCircles = {}, (0, path_1.getCirclesFromArcs)(this.from.arcs).forEach((c => {
this.fromCircles[c.setId] = c;
})), this.toCircles = {}, (0, path_1.getCirclesFromArcs)(this.to.arcs).forEach((c => {
this.toCircles[c.setId] = c;
}));
}
onUpdate(end, ratio, out) {
const circles = this.fromCircles.map(((fromC, i) => {
const toC = this.toCircles[i];
const circles = Object.keys(this.fromCircles).map(((key, i) => {
const fromC = this.fromCircles[key], toC = this.toCircles[key];
return {

@@ -19,0 +22,0 @@ radius: fromC.radius + (toC.radius - fromC.radius) * ratio,

import type { Datum } from '@visactor/vgrammar-core';
import type { IVennArea, IVennParams } from './utils/interface';
import type { IVennArea, IVennOverlapArc, IVennParams } from './utils/interface';
export interface IVennTransformOptions extends IVennParams {

@@ -28,2 +28,3 @@ x0: number;

path: string;
arcs: IVennOverlapArc[];
}

@@ -30,0 +31,0 @@ export interface IVennLabelDatum {

@@ -15,5 +15,3 @@ "use strict";

setId: setId
})));
arcs.sort(((a, b) => b.setId < a.setId ? 1 : b.setId > a.setId ? -1 : 0));
const result = [];
}))), result = [];
let i = 0, arc = arcs[0];

@@ -71,3 +69,3 @@ for (;i < arcs.length && arc; ) {

const getCirclesFromArcs = arcs => arcs.map((arc => {
const {p1: p1, p2: p2, radius: radius} = arc, {x: x1, y: y1} = p1, {x: x2, y: y2} = p2, d = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** .5, mX = (x1 + x2) / 2, mY = (y1 + y2) / 2, h = (radius ** 2 - (d / 2) ** 2) ** .5;
const {p1: p1, p2: p2, radius: radius, setId: setId} = arc, {x: x1, y: y1} = p1, {x: x2, y: y2} = p2, d = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** .5, mX = (x1 + x2) / 2, mY = (y1 + y2) / 2, h = (radius ** 2 - (d / 2) ** 2) ** .5;
let x = mX + h * (y2 - y1) / d, y = mY - h * (x2 - x1) / d;

@@ -78,3 +76,4 @@ return (0, vutils_1.crossProduct)([ x2 - x1, y2 - y1 ], [ x - x1, y - y1 ]) > 0 && (x = mX - h * (y2 - y1) / d,

y: y,
radius: radius
radius: radius,
setId: setId
};

@@ -81,0 +80,0 @@ }));

@@ -29,3 +29,3 @@ "use strict";

}), circle = circles[key];
return circle ? Object.assign(Object.assign({}, basicDatum), {
if (circle) return Object.assign(Object.assign({}, basicDatum), {
type: "circle",

@@ -35,7 +35,10 @@ x: circle.x,

radius: circle.radius
}) : Object.assign(Object.assign({}, basicDatum), {
});
const arcs = (0, path_1.getArcsFromCircles)(sets.map((name => circles[name])));
return Object.assign(Object.assign({}, basicDatum), {
type: "overlap",
x: 0,
y: 0,
path: (0, path_1.getPathFromArcs)((0, path_1.getArcsFromCircles)(sets.map((name => circles[name]))))
path: (0, path_1.getPathFromArcs)(arcs),
arcs: arcs
});

@@ -42,0 +45,0 @@ }));

import { ACustomAnimate } from '@visactor/vrender-core';
import type { IVennCircle } from './utils/interface';
import type { IVennCircle, IVennOverlapArc, VennCircleName } from './utils/interface';
export declare class VennOverlapAnimation extends ACustomAnimate<{
path: string;
arcs: IVennOverlapArc[];
}> {
protected fromCircles: IVennCircle[];
protected toCircles: IVennCircle[];
protected fromCircles: Record<VennCircleName, IVennCircle>;
protected toCircles: Record<VennCircleName, IVennCircle>;
onBind(): void;
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
}
import { ACustomAnimate } from "@visactor/vrender-core";
import { getArcsFromCircles, getArcsFromPath, getCirclesFromArcs, getPathFromArcs } from "./utils/path";
import { getArcsFromCircles, getCirclesFromArcs, getPathFromArcs } from "./utils/path";
export class VennOverlapAnimation extends ACustomAnimate {
onBind() {
this.fromCircles = getCirclesFromArcs(getArcsFromPath(this.from.path)), this.toCircles = getCirclesFromArcs(getArcsFromPath(this.to.path));
this.fromCircles = {}, getCirclesFromArcs(this.from.arcs).forEach((c => {
this.fromCircles[c.setId] = c;
})), this.toCircles = {}, getCirclesFromArcs(this.to.arcs).forEach((c => {
this.toCircles[c.setId] = c;
}));
}
onUpdate(end, ratio, out) {
const circles = this.fromCircles.map(((fromC, i) => {
const toC = this.toCircles[i];
const circles = Object.keys(this.fromCircles).map(((key, i) => {
const fromC = this.fromCircles[key], toC = this.toCircles[key];
return {

@@ -13,0 +17,0 @@ radius: fromC.radius + (toC.radius - fromC.radius) * ratio,

import type { Datum } from '@visactor/vgrammar-core';
import type { IVennArea, IVennParams } from './utils/interface';
import type { IVennArea, IVennOverlapArc, IVennParams } from './utils/interface';
export interface IVennTransformOptions extends IVennParams {

@@ -28,2 +28,3 @@ x0: number;

path: string;
arcs: IVennOverlapArc[];
}

@@ -30,0 +31,0 @@ export interface IVennLabelDatum {

@@ -15,5 +15,3 @@ import { crossProduct } from "@visactor/vutils";

setId: setId
})));
arcs.sort(((a, b) => b.setId < a.setId ? 1 : b.setId > a.setId ? -1 : 0));
const result = [];
}))), result = [];
let i = 0, arc = arcs[0];

@@ -64,3 +62,3 @@ for (;i < arcs.length && arc; ) {

export const getCirclesFromArcs = arcs => arcs.map((arc => {
const {p1: p1, p2: p2, radius: radius} = arc, {x: x1, y: y1} = p1, {x: x2, y: y2} = p2, d = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** .5, mX = (x1 + x2) / 2, mY = (y1 + y2) / 2, h = (radius ** 2 - (d / 2) ** 2) ** .5;
const {p1: p1, p2: p2, radius: radius, setId: setId} = arc, {x: x1, y: y1} = p1, {x: x2, y: y2} = p2, d = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** .5, mX = (x1 + x2) / 2, mY = (y1 + y2) / 2, h = (radius ** 2 - (d / 2) ** 2) ** .5;
let x = mX + h * (y2 - y1) / d, y = mY - h * (x2 - x1) / d;

@@ -71,5 +69,6 @@ return crossProduct([ x2 - x1, y2 - y1 ], [ x - x1, y - y1 ]) > 0 && (x = mX - h * (y2 - y1) / d,

y: y,
radius: radius
radius: radius,
setId: setId
};
}));
//# sourceMappingURL=path.js.map

@@ -28,3 +28,3 @@ import { computeTextCenters, normalizeSolution, scaleSolution, venn } from "./utils";

}), circle = circles[key];
return circle ? Object.assign(Object.assign({}, basicDatum), {
if (circle) return Object.assign(Object.assign({}, basicDatum), {
type: "circle",

@@ -34,7 +34,10 @@ x: circle.x,

radius: circle.radius
}) : Object.assign(Object.assign({}, basicDatum), {
});
const arcs = getArcsFromCircles(sets.map((name => circles[name])));
return Object.assign(Object.assign({}, basicDatum), {
type: "overlap",
x: 0,
y: 0,
path: getPathFromArcs(getArcsFromCircles(sets.map((name => circles[name]))))
path: getPathFromArcs(arcs),
arcs: arcs
});

@@ -41,0 +44,0 @@ }));

{
"name": "@visactor/vgrammar-venn",
"version": "0.13.0-alpha.6",
"version": "0.13.0-alpha.7",
"description": "Venn layout transform for VGrammar",

@@ -27,4 +27,4 @@ "keywords": [

"dependencies": {
"@visactor/vgrammar-core": "0.13.0-alpha.6",
"@visactor/vgrammar-util": "0.13.0-alpha.6",
"@visactor/vgrammar-core": "0.13.0-alpha.7",
"@visactor/vgrammar-util": "0.13.0-alpha.7",
"@visactor/vrender-core": "0.18.8",

@@ -46,5 +46,5 @@ "@visactor/vrender-kits": "0.18.8",

"@internal/bundler": "0.0.1",
"@internal/jest-config": "0.0.1",
"@internal/eslint-config": "0.0.1",
"@internal/ts-config": "0.0.1",
"@internal/eslint-config": "0.0.1"
"@internal/jest-config": "0.0.1"
},

@@ -51,0 +51,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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