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

pop.svg

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pop.svg - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

dist/paths/commands.d.ts

48

dist/index.d.ts

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

declare module "paths/pathGuide" {
export class PathGuide {
path: string;
constructor(count?: number);
createLinesPath(count: number): any;
}
export declare namespace POP {
}
declare module "paths/Point" {
export interface Point {
x: number;
y: number;
}
}
declare module "paths/commands" {
export class CommandPath {
static keys: any;
static ignoreWhenSizing: string[];
}
}
declare module "paths/referencePath" {
import { Point } from "paths/Point";
export class ReferencePath {
commands: any[];
constructor(element: any, breakup?: number, min?: Point, max?: Point);
normalize(min?: Point, max?: Point): void;
}
}
declare module "paths/translationPath" {
import { ReferencePath } from "paths/referencePath";
import { Point } from "paths/Point";
export class TranslationPath {
path: SVGPathElement;
width: number;
endWidth: number;
length: number;
constructor(element: any, width: number, endWidth?: number);
updatePath(): void;
getPath(path: ReferencePath, width?: number, endWidth?: number): string;
getWidth(yPercent: number, width: number, endWidth: number): number;
percentToPath(x: number, y: number, width: number, endWidth: number): Point;
getRotation(p1: Point, p2: Point): number;
getRotatedPoint(origin: Point, point: Point, angle: number): Point;
}
}
declare module "index" {
export namespace POP {
}
}

@@ -1,216 +0,11 @@

define("paths/pathGuide", ["require", "exports"], function (require, exports) {
"use strict";
exports.__esModule = true;
var PathGuide = /** @class */ (function () {
function PathGuide(count) {
if (count === void 0) { count = 3; }
this.path = '';
this.path = this.createLinesPath(count);
}
PathGuide.prototype.createLinesPath = function (count) {
var path = document.getElementById('lines');
var linesPath = '';
for (var i = 0; i < count; i++) {
linesPath += "M 0 " + i * 2 + " H 10";
}
if (path)
path.setAttribute('d', linesPath);
return path;
};
return PathGuide;
}());
exports.PathGuide = PathGuide;
});
define("paths/Point", ["require", "exports"], function (require, exports) {
"use strict";
exports.__esModule = true;
});
define("paths/commands", ["require", "exports"], function (require, exports) {
"use strict";
exports.__esModule = true;
var CommandPath = /** @class */ (function () {
function CommandPath() {
}
CommandPath.keys = {
M: ['x', 'y'],
L: ['x', 'y'],
V: ['y'],
H: ['x'],
C: ['x1', 'y1', 'x2', 'y2', 'x', 'y'],
S: ['x2', 'y2', 'x', 'y'],
Q: ['x1', 'y1', 'x', 'y'],
T: ['x', 'y'],
A: ['rx', 'ry', 'xAxisRotation', 'largeArc', 'sweep', 'x', 'y'],
Z: []
};
CommandPath.ignoreWhenSizing = ['rx', 'ry', 'xAxisRotation', 'largeArc', 'sweep'];
return CommandPath;
}());
exports.CommandPath = CommandPath;
});
define("paths/referencePath", ["require", "exports", "svg-path-parser", "paths/commands"], function (require, exports, svg_path_parser_1, commands_1) {
"use strict";
exports.__esModule = true;
var ReferencePath = /** @class */ (function () {
function ReferencePath(element, breakup, min, max) {
var isString = typeof element == 'string';
var pathString = '';
if (isString) {
pathString = element;
this.commands = svg_path_parser_1.makeAbsolute(svg_path_parser_1.parseSVG(pathString || ''));
}
else {
var path = element;
pathString = path.getAttribute('d') || '';
this.commands = svg_path_parser_1.makeAbsolute(svg_path_parser_1.parseSVG(pathString || ''));
if (breakup && breakup > 3) {
if (this.commands[0].code == 'M') {
pathString = "M " + this.commands[0].x + " " + this.commands[0].y;
}
else {
pathString = 'M 0 0';
}
var length_1 = path.getTotalLength();
for (var i = 1; i <= breakup; i++) {
var percent = i / breakup;
var pt = path.getPointAtLength(length_1 * percent);
pathString += "L " + pt.x + " " + pt.y;
}
this.commands = svg_path_parser_1.makeAbsolute(svg_path_parser_1.parseSVG(pathString || ''));
}
}
this.normalize(min, max);
}
ReferencePath.prototype.normalize = function (min, max) {
if (min === void 0) { min = { x: this.commands[0].x, y: this.commands[0].y }; }
if (max === void 0) { max = { x: this.commands[0].x, y: this.commands[0].y }; }
if (this.commands.length > 0) {
var ignore_1 = commands_1.CommandPath.ignoreWhenSizing;
this.commands.map(function (d) {
var keys = commands_1.CommandPath.keys[d.code];
keys.map(function (key) {
var ignoreIndex = ignore_1.indexOf(key);
if (ignoreIndex == -1) {
var direction = key.charAt(0);
if (direction == 'x' || direction == 'y') {
if (min[direction] == null || d[key] < min[direction])
min[direction] = d[key];
if (max[direction] == null || d[key] > max[direction])
max[direction] = d[key];
}
}
});
});
max.x -= min.x;
max.y -= min.y;
this.commands.map(function (d) {
var keys = commands_1.CommandPath.keys[d.code];
keys.map(function (key) {
var ignoreIndex = ignore_1.indexOf(key);
if (ignoreIndex == -1) {
var direction = key.charAt(0);
if (direction == 'x' || direction == 'y') {
d[key] -= min[direction];
d['p' + key] = (d[key] / max[direction]) * 1;
}
}
});
});
}
};
return ReferencePath;
}());
exports.ReferencePath = ReferencePath;
});
define("paths/translationPath", ["require", "exports", "paths/commands"], function (require, exports, commands_2) {
"use strict";
exports.__esModule = true;
var TranslationPath = /** @class */ (function () {
function TranslationPath(element, width, endWidth) {
this.length = 0;
this.path = element;
this.width = width;
this.endWidth = endWidth !== undefined ? endWidth : width;
this.updatePath();
}
TranslationPath.prototype.updatePath = function () {
this.length = this.path.getTotalLength();
};
TranslationPath.prototype.getPath = function (path, width, endWidth) {
var _this = this;
var newPath = '';
var lastPoint = { x: 0, y: 0 };
path.commands.map(function (command) {
var ignoreCodes = ['A'];
if (ignoreCodes.indexOf(command.code) == -1) {
var code = command.code;
if (code == 'V' || code == 'H')
code = 'L';
newPath += code;
var keys = commands_2.CommandPath.keys[command.code];
for (var i = 0; i < keys.length; i += 2) {
var direction = keys[i].charAt(0);
var x = direction == 'x' ? keys[i] : null;
var y = direction == 'y' ? keys[i] : keys[i + 1] != null ? keys[i + 1] : null;
var xValue = x ? command['p' + x] : lastPoint.x;
var yValue = y ? command['p' + y] : lastPoint.y;
lastPoint.x = xValue;
lastPoint.y = yValue;
var newPoint = _this.percentToPath(xValue, yValue, width || _this.width, endWidth || _this.endWidth);
newPath += ' ' + newPoint.x;
newPath += ' ' + newPoint.y;
}
}
});
return newPath;
};
TranslationPath.prototype.getWidth = function (yPercent, width, endWidth) {
var w = endWidth - width;
var newWidth = width + (w * yPercent);
return newWidth;
};
TranslationPath.prototype.percentToPath = function (x, y, width, endWidth) {
var angleDistance = 0.01;
var pt = this.path.getPointAtLength(this.length * y);
var anglePt = y < angleDistance ? this.path.getPointAtLength(this.length * (y + angleDistance)) : this.path.getPointAtLength(this.length * (y - angleDistance));
var rotation = this.getRotation(y < angleDistance ? anglePt : pt, y < angleDistance ? pt : anglePt);
var w = this.getWidth(y, width, endWidth);
var origin = { x: pt.x, y: pt.y };
var target = { x: pt.x - (w / 2) + (w * x), y: pt.y };
var toReturn = this.getRotatedPoint(origin, target, rotation);
return toReturn;
};
TranslationPath.prototype.getRotation = function (p1, p2) {
var angleRadians = Math.atan2(p2.y - p1.y, p2.x - p1.x);
return angleRadians;
};
TranslationPath.prototype.getRotatedPoint = function (origin, point, angle) {
var newPoint = {
x: point.x - origin.x,
y: point.y - origin.y
};
var x = newPoint.x;
var y = newPoint.y;
var cos = Math.cos(angle);
var sin = Math.sin(angle);
newPoint.y = (cos * x) + (sin * y);
newPoint.x = (cos * y) - (sin * x);
newPoint.x += origin.x;
newPoint.y += origin.y;
return newPoint;
};
return TranslationPath;
}());
exports.TranslationPath = TranslationPath;
});
define("index", ["require", "exports", "paths/pathGuide", "paths/referencePath", "paths/translationPath"], function (require, exports, pathGuide_1, referencePath_1, translationPath_1) {
"use strict";
exports.__esModule = true;
var POP;
(function (POP) {
pathGuide_1.PathGuide;
referencePath_1.ReferencePath;
translationPath_1.TranslationPath;
})(POP = exports.POP || (exports.POP = {}));
});
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var pathGuide_1 = require("./paths/pathGuide");
var referencePath_1 = require("./paths/referencePath");
var translationPath_1 = require("./paths/translationPath");
var POP;
(function (POP) {
pathGuide_1.PathGuide;
referencePath_1.ReferencePath;
translationPath_1.TranslationPath;
})(POP = exports.POP || (exports.POP = {}));
{
"name": "pop.svg",
"version": "0.1.4",
"version": "0.1.5",
"description": "",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

{
"compilerOptions": {
/* Basic Options */
//"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
"module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
"declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
"sourceMap": true, /* Generates corresponding '.map' file. */
"outFile": "./dist/index.js", /* Concatenate and emit output to single file. */
//"outDir": "./dist/", /* Redirect output structure to the directory. */
//"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
// "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
}
"target": "es5",
"module": "commonjs",
"declaration": true,
"outDir": "./dist",
"strict": true
},
"exclude": [
"node_modules"
],
"files": [
"src/index.ts"
]
}
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