canvg
Advanced tools
Comparing version 3.0.6 to 3.0.7
@@ -27,2 +27,11 @@ # Changelog | ||
## [3.0.7] - 2020-10-17 | ||
### Fixed | ||
- [#1133](https://github.com/canvg/canvg/issues/1133) | ||
- [#1001](https://github.com/canvg/canvg/issues/1001) | ||
- [#977](https://github.com/canvg/canvg/issues/977) | ||
- [#1196](https://github.com/canvg/canvg/issues/1196) | ||
- [#1111](https://github.com/canvg/canvg/issues/1111) | ||
- [#1161](https://github.com/canvg/canvg/issues/1161) | ||
## [3.0.6] - 2020-03-25 | ||
@@ -29,0 +38,0 @@ ### Fixed |
@@ -13,3 +13,3 @@ import { RenderingContext2D } from './types'; | ||
/** | ||
* Create Canvg isntance from SVG source string or URL. | ||
* Create Canvg instance from SVG source string or URL. | ||
* @param ctx - Rendering context. | ||
@@ -21,3 +21,3 @@ * @param svg - SVG source string or URL. | ||
/** | ||
* Create Canvg isntance from SVG source string. | ||
* Create Canvg instance from SVG source string. | ||
* @param ctx - Rendering context. | ||
@@ -29,3 +29,3 @@ * @param svg - SVG source string. | ||
/** | ||
* XML/HTML parser isntance. | ||
* XML/HTML parser instance. | ||
*/ | ||
@@ -32,0 +32,0 @@ readonly parser: Parser; |
@@ -16,13 +16,61 @@ import { RenderingContext2D } from '../types'; | ||
renderChildren(ctx: RenderingContext2D): void; | ||
static pathM(pathParser: PathParser): { | ||
point: Point; | ||
}; | ||
protected pathM(ctx: RenderingContext2D, boundingBox: BoundingBox): void; | ||
static pathL(pathParser: PathParser): { | ||
current: Point; | ||
point: Point; | ||
}; | ||
protected pathL(ctx: RenderingContext2D, boundingBox: BoundingBox): void; | ||
static pathH(pathParser: PathParser): { | ||
current: Point; | ||
point: Point; | ||
}; | ||
protected pathH(ctx: RenderingContext2D, boundingBox: BoundingBox): void; | ||
static pathV(pathParser: PathParser): { | ||
current: Point; | ||
point: Point; | ||
}; | ||
protected pathV(ctx: RenderingContext2D, boundingBox: BoundingBox): void; | ||
static pathC(pathParser: PathParser): { | ||
current: Point; | ||
point: Point; | ||
controlPoint: Point; | ||
currentPoint: Point; | ||
}; | ||
protected pathC(ctx: RenderingContext2D, boundingBox: BoundingBox): void; | ||
static pathS(pathParser: PathParser): { | ||
current: Point; | ||
point: Point; | ||
controlPoint: Point; | ||
currentPoint: Point; | ||
}; | ||
protected pathS(ctx: RenderingContext2D, boundingBox: BoundingBox): void; | ||
static pathQ(pathParser: PathParser): { | ||
current: Point; | ||
controlPoint: Point; | ||
currentPoint: Point; | ||
}; | ||
protected pathQ(ctx: RenderingContext2D, boundingBox: BoundingBox): void; | ||
static pathT(pathParser: PathParser): { | ||
current: Point; | ||
controlPoint: Point; | ||
currentPoint: Point; | ||
}; | ||
protected pathT(ctx: RenderingContext2D, boundingBox: BoundingBox): void; | ||
static pathA(pathParser: PathParser): { | ||
currentPoint: Point; | ||
rX: number; | ||
rY: number; | ||
sweepFlag: 0 | 1; | ||
xAxisRotation: number; | ||
centp: Point; | ||
a1: number; | ||
ad: number; | ||
}; | ||
protected pathA(ctx: RenderingContext2D, boundingBox: BoundingBox): void; | ||
static pathZ(pathParser: PathParser): void; | ||
protected pathZ(ctx: RenderingContext2D, boundingBox: BoundingBox): void; | ||
} | ||
//# sourceMappingURL=PathElement.d.ts.map |
@@ -6,4 +6,4 @@ import { RenderingContext2D } from '../types'; | ||
root: boolean; | ||
setContext(ctx: RenderingContext2D): void; | ||
clearContext(ctx: RenderingContext2D): void; | ||
setContext(ctx: RenderingContext2D): void; | ||
/** | ||
@@ -10,0 +10,0 @@ * Resize SVG to fit in given size. |
import { RenderingContext2D } from '../types'; | ||
import PathParser from '../PathParser'; | ||
import PathParser, { CommandType } from '../PathParser'; | ||
import Document from './Document'; | ||
@@ -11,3 +11,3 @@ import TextElement from './TextElement'; | ||
export interface IPathCommand { | ||
command: string; | ||
type: CommandType; | ||
points: number[]; | ||
@@ -21,4 +21,2 @@ start?: IPoint; | ||
interface IGlyphInfo { | ||
transposeX: number; | ||
transposeY: number; | ||
text: string; | ||
@@ -45,3 +43,3 @@ rotation: number; | ||
protected getLetterSpacingAt(idx?: number): number; | ||
protected findSegmentToFitChar(ctx: RenderingContext2D, anchor: string, textFullWidth: number, fullPathWidth: number, spacesNumber: number, inputOffset: number, c: string, charI: number): { | ||
protected findSegmentToFitChar(ctx: RenderingContext2D, anchor: string, textFullWidth: number, fullPathWidth: number, spacesNumber: number, inputOffset: number, dy: number, c: string, charI: number): { | ||
offset: number; | ||
@@ -52,2 +50,3 @@ segment: { | ||
}; | ||
rotation: number; | ||
}; | ||
@@ -57,12 +56,12 @@ protected measureText(ctx: RenderingContext2D, text?: string): number; | ||
protected parsePathData(path: PathElement): IPathCommand[]; | ||
protected pathM(pathParser: PathParser, points: number[]): string; | ||
protected pathL(pathParser: PathParser, points: number[]): string; | ||
protected pathH(pathParser: PathParser, points: number[]): string; | ||
protected pathV(pathParser: PathParser, points: number[]): string; | ||
protected pathM(pathParser: PathParser, points: number[]): void; | ||
protected pathL(pathParser: PathParser, points: number[]): 16; | ||
protected pathH(pathParser: PathParser, points: number[]): 16; | ||
protected pathV(pathParser: PathParser, points: number[]): 16; | ||
protected pathC(pathParser: PathParser, points: number[]): void; | ||
protected pathS(pathParser: PathParser, points: number[]): string; | ||
protected pathS(pathParser: PathParser, points: number[]): 32; | ||
protected pathQ(pathParser: PathParser, points: number[]): void; | ||
protected pathT(pathParser: PathParser, points: number[]): string; | ||
protected pathT(pathParser: PathParser, points: number[]): 128; | ||
protected pathA(pathParser: PathParser): number[]; | ||
protected calcLength(x: number, y: number, cmd: string, points: number[]): number; | ||
protected calcLength(x: number, y: number, commandType: CommandType, points: number[]): number; | ||
protected getPointOnLine(dist: number, P1x: number, P1y: number, P2x: number, P2y: number, fromX?: number, fromY?: number): IPoint; | ||
@@ -69,0 +68,0 @@ protected getPointOnPath(distance: number): IPoint; |
@@ -0,8 +1,14 @@ | ||
import { SVGCommand, CommandM, CommandL, CommandH, CommandV, CommandZ, CommandQ, CommandT, CommandC, CommandS, CommandA } from 'svg-pathdata/lib/types'; | ||
import { SVGPathData } from 'svg-pathdata'; | ||
import Point from './Point'; | ||
export default class PathParser { | ||
export declare type CommandType = SVGCommand['type']; | ||
export declare type Command = { | ||
type: CommandType; | ||
} & Omit<CommandM, 'type'> & Omit<CommandL, 'type'> & Omit<CommandH, 'type'> & Omit<CommandV, 'type'> & Omit<CommandZ, 'type'> & Omit<CommandQ, 'type'> & Omit<CommandT, 'type'> & Omit<CommandC, 'type'> & Omit<CommandS, 'type'> & Omit<CommandA, 'type'>; | ||
export default class PathParser extends SVGPathData { | ||
control: Point; | ||
start: Point; | ||
current: Point; | ||
command: string; | ||
private readonly tokens; | ||
command: Command; | ||
readonly commands: Command[]; | ||
private i; | ||
@@ -15,10 +21,6 @@ private previousCommand; | ||
isEnd(): boolean; | ||
isCommandOrEnd(): boolean; | ||
isRelativeCommand(): boolean; | ||
getToken(): string; | ||
getScalar(): number; | ||
nextCommand(): void; | ||
getPoint(): Point; | ||
getAsControlPoint(): Point; | ||
getAsCurrentPoint(): Point; | ||
next(): Command; | ||
getPoint(xProp?: string, yProp?: string): Point; | ||
getAsControlPoint(xProp?: string, yProp?: string): Point; | ||
getAsCurrentPoint(xProp?: string, yProp?: string): Point; | ||
getReflectedControlPoint(): Point; | ||
@@ -25,0 +27,0 @@ makeAbsolute(point: Point): Point; |
@@ -23,3 +23,4 @@ import { Axis } from './ViewPort'; | ||
constructor(document: Document, name: string, value: T); | ||
hasValue(): boolean; | ||
split(separator?: string): Property<string>[]; | ||
hasValue(zeroIsValue?: boolean): boolean; | ||
isString(regexp?: RegExp): boolean; | ||
@@ -26,0 +27,0 @@ isUrlDefinition(): boolean; |
import { RenderingContext2D } from '../types'; | ||
import Document from '../Document'; | ||
import Property from '../Property'; | ||
import Point from '../Point'; | ||
@@ -7,5 +8,7 @@ export default class Rotate { | ||
private readonly angle; | ||
private readonly originX; | ||
private readonly originY; | ||
private readonly cx; | ||
private readonly cy; | ||
constructor(document: Document, rotate: string, transformOrigin?: number[]); | ||
constructor(document: Document, rotate: string, transformOrigin: [Property<string>, Property<string>]); | ||
apply(ctx: RenderingContext2D): void; | ||
@@ -12,0 +15,0 @@ unapply(ctx: RenderingContext2D): void; |
import { RenderingContext2D } from '../types'; | ||
import Property from '../Property'; | ||
import Point from '../Point'; | ||
@@ -15,3 +16,3 @@ import { ITransform } from './types'; | ||
prototype: ITransform; | ||
new (document: Document, value: string, transformOrigin?: number[]): ITransform; | ||
new (document: Document, value: string, transformOrigin?: readonly [Property<string>, Property<string>]): ITransform; | ||
} | ||
@@ -23,3 +24,3 @@ export default class Transform { | ||
private readonly transforms; | ||
constructor(document: Document, transform: string, transformOrigin?: string); | ||
constructor(document: Document, transform: string, transformOrigin?: readonly [Property<string>, Property<string>]); | ||
apply(ctx: RenderingContext2D): void; | ||
@@ -26,0 +27,0 @@ unapply(ctx: RenderingContext2D): void; |
{ | ||
"name": "canvg", | ||
"version": "3.0.6", | ||
"version": "3.0.7", | ||
"description": "JavaScript SVG parser and renderer on Canvas.", | ||
@@ -42,8 +42,8 @@ "authors": [ | ||
"dependencies": { | ||
"@babel/runtime": "^7.6.3", | ||
"@babel/runtime-corejs3": "^7.9.6", | ||
"@types/raf": "^3.4.0", | ||
"core-js": "3", | ||
"raf": "^3.4.1", | ||
"rgbcolor": "^1.0.1", | ||
"stackblur-canvas": "^2.0.0" | ||
"stackblur-canvas": "^2.0.0", | ||
"svg-pathdata": "^5.0.5" | ||
}, | ||
@@ -50,0 +50,0 @@ "files": [ |
@@ -111,2 +111,4 @@ # canvg | ||
[`OffscreenCanvas` browsers compatibility.](https://caniuse.com/offscreencanvas) | ||
</details> | ||
@@ -113,0 +115,0 @@ |
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 too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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 too big to display
Sorry, the diff of this file is not supported yet
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
181
320
1485996
20668
24
+ Addedsvg-pathdata@^5.0.5
+ Added@babel/runtime-corejs3@7.24.7(transitive)
+ Addedcore-js-pure@3.37.1(transitive)
+ Addedsvg-pathdata@5.0.5(transitive)
- Removed@babel/runtime@^7.6.3
- Removedcore-js@3
- Removed@babel/runtime@7.24.7(transitive)
- Removedcore-js@3.37.1(transitive)