From: pragdave Date: Sat, 30 May 2020 18:57:36 +0000 (-0500) Subject: aff foreignObject to types, get get List working X-Git-Tag: 3.1.0~19^2~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d9d620fc3e92da83a75449eff78a01b66152b0d2;p=svg.js.git aff foreignObject to types, get get List working --- diff --git a/svg.js.d.ts b/svg.js.d.ts index e397e05..213828f 100644 --- a/svg.js.d.ts +++ b/svg.js.d.ts @@ -548,13 +548,15 @@ declare module "@svgdotjs/svg.js" { to(a: any): Morphable; } + type ListEachCallback = (el: T, index: number, list: T[]) => T + // List.js - interface List extends BuiltInArray { + class List extends BuiltInArray { // I have no clue how to deal with this // [key: string]: (...arg0: any[]) => List // [key: string]: () => List - each(fn: Function): void - each(...args: any[]): void + each(fn: ListEachCallback): T[] + each(...args: any[]): T[] toArray(): T[] } @@ -1055,6 +1057,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; @@ -1382,6 +1385,13 @@ declare module "@svgdotjs/svg.js" { target(): string; } + + // ForeignObject.js + class ForeignObject extends Element { + constructor(node: HTMLElement, attrs?: any) + add(element: Dom) : ForeignObject + } + // image.js class Image extends Shape { constructor(node?: SVGImageElement);