Update deps, typescript declarations

This commit is contained in:
Evert Prants 2025-03-09 10:37:06 +02:00
parent 5732329f38
commit e0c8dda4a9
11 changed files with 4103 additions and 1527 deletions

View File

@ -1,30 +0,0 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test

View File

@ -1,5 +1,11 @@
## CHANGELOG
### v2.5.1
- Fork of a fork
- Update all dependencies
- Add placeholder type declaration files
### v2.5.0
- fix: ellipse translate and rotate problem ([Chris Waters](https://github.com/k1w1)) https://github.com/zenozeng/svgcanvas/pull/19

5443
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
"version": "2.5.1",
"description": "svgcanvas",
"main": "dist/svgcanvas.js",
"types": "types/index.d.ts",
"scripts": {
"watch": "rollup -c -w",
"build": "rollup -c",
@ -21,17 +22,17 @@
"author": "Zeno Zeng",
"license": "MIT",
"devDependencies": {
"@rollup/plugin-commonjs": "^21.0.2",
"@rollup/plugin-node-resolve": "^13.1.3",
"chai": "^4.3.6",
"karma": "^6.3.17",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^2.2.0",
"@rollup/plugin-commonjs": "^28.0.3",
"@rollup/plugin-node-resolve": "^16.0.0",
"chai": "^5.2.0",
"karma": "^6.4.4",
"karma-chrome-launcher": "^3.2.0",
"karma-coverage": "^2.2.1",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-sourcemap-loader": "^0.3.8",
"mocha": "^9.2.1",
"puppeteer": "^13.5.0",
"rollup": "^2.67.0"
"karma-sourcemap-loader": "^0.4.0",
"mocha": "^11.1.0",
"puppeteer": "^24.4.0",
"rollup": "^4.35.0"
}
}

78
types/context.d.ts vendored Normal file
View File

@ -0,0 +1,78 @@
export default class Context {
constructor(o: any, ...args: any[]);
width: number;
height: number;
enableMirroring: any;
canvas: this;
getSerializedSvg(fixNamedEntities): any;
createPath(arg): any;
getSvg(): any;
save(): any;
restore(): any;
beginPath(): any;
closePath(): any;
moveTo(x: number, y: number): any;
lineTo(x: number, y: number): any;
rect(x: number, y: number, width: number, height: number): any;
roundRect(
x: number,
y: number,
width: number,
height: number,
radii: number
): any;
bezierCurveTo(
cp1x: number,
cp1y: number,
cp2x: number,
cp2y: number,
x: number,
y: number
): any;
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): any;
arc(
x: number,
y: number,
radius: number,
startAngle: number,
endAngle: number,
counterClockwise: boolean
): any;
arcTo(x1, y1, x2, y2, radius): any;
ellipse(
x: number,
y: number,
radiusX: number,
radiusY: number,
rotation: number,
startAngle: number,
endAngle: number,
counterClockwise?: boolean
): any;
stroke(path2d): any;
fill(path2d): any;
fillRect(x: number, y: number, width: number, height: number): any;
strokeRect(x: number, y: number, width: number, height: number): any;
clearRect(x: number, y: number, width: number, height: number): any;
createLinearGradient(x1, y1, x2, y2): any;
createRadialGradient(x0, y0, r0, x1, y1, r1): any;
fillText(text, x: number, y: number): any;
strokeText(text, x: number, y: number): any;
measureText(text): any;
clip(fillRule): any;
drawImage(): any;
createPattern(image, repetition): any;
setLineDash(dashArray): any;
setTransform(a, b, c, d, e, f): any;
getTransform(): any;
resetTransform(): any;
scale(x: number, y: number): any;
rotate(angle): any;
translate(x: number, y: number): any;
transform(a, b, c, d, e, f): any;
getImageData(sx, sy, sw, sh, options): any;
drawFocusRing(): any;
createImageData(): any;
putImageData(): any;
globalCompositeOperation(): any;
}

22
types/element.d.ts vendored Normal file
View File

@ -0,0 +1,22 @@
export default SVGCanvasElement;
declare function SVGCanvasElement(options: any): void;
declare class SVGCanvasElement {
constructor(options: any);
ctx: any;
svg: any;
wrapper: HTMLDivElement;
getContext(type: any): any;
toObjectURL(): string;
/**
* toDataURL returns a data URI containing a representation of the image in the format specified by the type parameter.
*
* @param {String} type A DOMString indicating the image format. The default type is image/svg+xml; this image format will be also used if the specified type is not supported.
* @param {Number} encoderOptions A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
* @param {Boolean} options.async Will return a Promise<String> if true, must be set to true if type is not image/svg+xml
*/
toDataURL(type: string, encoderOptions: number, options: any): string | Promise<string>;
addEventListener(...args: any[]): any;
getElement(): HTMLDivElement;
getAttribute(prop: any): string;
setAttribute(prop: any, val: any): void;
}

12
types/image.d.ts vendored Normal file
View File

@ -0,0 +1,12 @@
export default utils;
declare const utils: ImageUtils;
declare class ImageUtils {
/**
* Convert svg dataurl to canvas element
*
* @private
*/
private svg2canvas;
toDataURL(svgNode: any, width: any, height: any, type: any, encoderOptions: any, options: any): string | Promise<string>;
getImageData(svgNode: any, width: any, height: any, sx: any, sy: any, sw: any, sh: any, options: any): Promise<ImageData>;
}

4
types/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import Context from './context';
import Element from './element';
import Path2D from './path2d';
export { Context, Element, Path2D };

10
types/path2d.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
export default class Path2D {
constructor(ctx: any, arg: any);
__pathString: any;
ctx: any;
__subPaths: any[];
__currentPosition: {
x: any;
y: any;
};
}

1
types/roundRect.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export default function roundRect(x: any, y: any, w: any, h: any, radii: any): void;

3
types/utils.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
export function toString(obj: any): any;
export function debug(...data: any[]): void;
export function format(str: any, args: any): any;