diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2020-06-01 18:19:16 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 18:19:16 +1000 |
commit | bc938f05b708041921cf9d75b2cd84c92574c463 (patch) | |
tree | c686546c3cc19afd56970aeef7ca3d84d98f8e8c /svg.js.d.ts | |
parent | f9055655cec603e2cb7d01c2307a1eafab1b3f2e (diff) | |
parent | 5bd6906f48ad528cb3d3ee980c5bd537b703d953 (diff) | |
download | svg.js-bc938f05b708041921cf9d75b2cd84c92574c463.tar.gz svg.js-bc938f05b708041921cf9d75b2cd84c92574c463.zip |
Merge pull request #1123 from pragdave/some-more-typings
add foreignObject to types, and get List working
Diffstat (limited to 'svg.js.d.ts')
-rw-r--r-- | svg.js.d.ts | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/svg.js.d.ts b/svg.js.d.ts index 0aed23b..2264c66 100644 --- a/svg.js.d.ts +++ b/svg.js.d.ts @@ -83,14 +83,14 @@ declare module "@svgdotjs/svg.js" { }
- let easing: {
- '-'(pos: number): number;
- '<>'(pos: number): number;
- '>'(pos: number): number;
- '<'(pos: number): number;
- bezier(x1: number, y1: number, x2: number, y2: number): (t: number) => number;
- steps(steps: number, stepPosition?: "jump-start"|"jump-end"|"jump-none"|"jump-both"|"start"|"end"): (t: number, beforeFlag?: boolean) => number;
- }
+ // let easing: {
+ // '-'(pos: number): number;
+ // '<>'(pos: number): number;
+ // '>'(pos: number): number;
+ // '<'(pos: number): number;
+ // bezier(x1: number, y1: number, x2: number, y2: number): (t: number) => number;
+ // steps(steps: number, stepPosition?: "jump-start"|"jump-end"|"jump-none"|"jump-both"|"start"|"end"): (t: number, beforeFlag?: boolean) => number;
+ // }
let regex: {
delimiter: RegExp;
@@ -551,13 +551,12 @@ declare module "@svgdotjs/svg.js" { to(a: any): Morphable;
}
+ type ListEachCallback<T> = (el: T, index: number, list: List<T>) => any
+
// List.js
- interface List<T> extends BuiltInArray<T> {
- // I have no clue how to deal with this
- // [key: string]: (...arg0: any[]) => List<T>
- // [key: string]: () => List<any>
- each(fn: Function): void
- each(...args: any[]): void
+ class List<T> extends BuiltInArray<T> implements ElementAlias {
+ each(fn: ListEachCallback<T>): List<any>
+ each(name: string, ...args: any[]): List<any>
toArray(): T[]
}
@@ -817,6 +816,9 @@ declare module "@svgdotjs/svg.js" { type TimeLike = number | TimesParam | Stepper
+ type EasingCallback = (...any) => number
+ type EasingLiteral = "<>" | "-" | "<" | ">"
+
class Runner {
constructor();
constructor(options: Function);
@@ -837,6 +839,8 @@ declare module "@svgdotjs/svg.js" { loop(times: TimesParam): this
delay(delay: number): this
+
+
during(fn: Function): this
queue(initFn: Function, runFn: Function, retargetFn?: boolean | Function, isTransform?: boolean): this
after(fn: EventListener): this
@@ -854,7 +858,8 @@ declare module "@svgdotjs/svg.js" { reset(): this
finish(): this
reverse(r?: boolean): this
- ease(fn: Function | string): this
+ ease(fn: EasingCallback) : this
+ ease(kind: EasingLiteral) : this
active(): boolean
active(a: boolean): this
addTransform(m: Matrix): this
@@ -1065,6 +1070,7 @@ declare module "@svgdotjs/svg.js" { clip(): ClipPath;
ellipse(width?: number, height?: number): Ellipse;
flatten(parent: Dom, depth?: number): this;
+ foreignObject(width: number, height: number) : ForeignObject
gradient(type: string, block?: (stop: Gradient) => void): Gradient;
group(): G;
@@ -1392,6 +1398,14 @@ declare module "@svgdotjs/svg.js" { target(): string;
}
+
+ // ForeignObject.js
+ class ForeignObject extends Element {
+ constructor(node?: SVGForeignObjectElement, attrs?: object)
+ constructor(attrs?: object)
+ add(element: Dom, i?: number): ForeignObject
+ }
+
// image.js
class Image extends Shape {
constructor(node?: SVGImageElement);
|