\r
// todo add SVG.FX\r
declare namespace svgjs {\r
- export interface Library {\r
- (id: string): Doc;\r
- (domElement: HTMLElement): Doc;\r
- ns: string;\r
- xmlns: string;\r
- xlink: string;\r
- svgjs: string;\r
- supported: boolean;\r
-\r
- did: number;\r
- eid(name: string): string;\r
-\r
- create(name: string): any;\r
- extend(parent: Object, obj: Object): void;\r
- invent(config: Object): any;\r
- adopt(node: HTMLElement): Element;\r
- prepare(element: HTMLElement): void;\r
- }\r
- interface LinkedHTMLElement extends HTMLElement {\r
- instance: Element;\r
- }\r
-\r
- // arrange.js\r
- interface Element {\r
- front(): this;\r
- back(): this;\r
- forward(): this;\r
- backward(): this;\r
-\r
- siblings(): Element[];\r
- position(): number;\r
- next(): Element;\r
- previous(): Element;\r
- before(element: Element): Element;\r
- after(element: Element): Element;\r
- }\r
-\r
- // array.js\r
- type ArrayAlias = _Array | number[] | string;\r
-\r
- interface _Array {\r
- new (array?: ArrayAlias, fallback?: number[]): _Array;\r
- value: number[];\r
- morph(array: number[]): this;\r
- settle(): number[];\r
- at(pos: NumberAlias): _Array;\r
- toString(): string;\r
- valueOf(): number[];\r
- parse(array: ArrayAlias): number[];\r
- split(string: string): number[];\r
- reverse(): this;\r
- clone(): _Array;\r
- }\r
- interface Library { Array: _Array }\r
-\r
- // attr.js\r
- interface Element {\r
- attr(): object;\r
- attr(name: string): any;\r
- attr(obj: Object): this;\r
- attr(name: string, value: any, namespace?: string): this;\r
- }\r
-\r
- // bare.js\r
- export interface Bare extends Element {\r
- new (element: string, inherit?: any): Bare;\r
- words(text: string): this;\r
- }\r
- interface Parent {\r
- element(element: string, inherit?: Object): Bare;\r
- }\r
- interface Library { Bare: Bare; }\r
-\r
- // boxes.js\r
- interface Box {\r
- height: number;\r
- width: number;\r
- y: number;\r
+ export interface Library {\r
+ (id: string): Doc;\r
+ (domElement: HTMLElement): Doc;\r
+ ns: string;\r
+ xmlns: string;\r
+ xlink: string;\r
+ svgjs: string;\r
+ supported: boolean;\r
+\r
+ did: number;\r
+ eid(name: string): string;\r
+\r
+ create(name: string): any;\r
+ extend(parent: Object, obj: Object): void;\r
+ invent(config: Object): any;\r
+ adopt(node: HTMLElement): Element;\r
+ prepare(element: HTMLElement): void;\r
+ }\r
+ interface LinkedHTMLElement extends HTMLElement {\r
+ instance: Element;\r
+ }\r
+\r
+ // arrange.js\r
+ interface Element {\r
+ front(): this;\r
+ back(): this;\r
+ forward(): this;\r
+ backward(): this;\r
+\r
+ siblings(): Element[];\r
+ position(): number;\r
+ next(): Element;\r
+ previous(): Element;\r
+ before(element: Element): Element;\r
+ after(element: Element): Element;\r
+ }\r
+\r
+ // array.js\r
+ type ArrayAlias = _Array | number[] | string;\r
+\r
+ interface _Array {\r
+ new (array?: ArrayAlias, fallback?: number[]): _Array;\r
+ value: number[];\r
+ morph(array: number[]): this;\r
+ settle(): number[];\r
+ at(pos: NumberAlias): _Array;\r
+ toString(): string;\r
+ valueOf(): number[];\r
+ parse(array: ArrayAlias): number[];\r
+ split(string: string): number[];\r
+ reverse(): this;\r
+ clone(): _Array;\r
+ }\r
+ interface Library {\r
+ Array: _Array;\r
+ }\r
+\r
+ // attr.js\r
+ interface Element {\r
+ attr(): object;\r
+ attr(name: string): any;\r
+ attr(obj: Object): this;\r
+ attr(name: string, value: any, namespace?: string): this;\r
+ }\r
+\r
+ // bare.js\r
+ export interface Bare extends Element {\r
+ new (element: string, inherit?: any): Bare;\r
+ words(text: string): this;\r
+ }\r
+ interface Parent {\r
+ element(element: string, inherit?: Object): Bare;\r
+ }\r
+ interface Library {\r
+ Bare: Bare;\r
+ }\r
+\r
+ // boxes.js\r
+ interface Box {\r
+ height: number;\r
+ width: number;\r
+ y: number;\r
+ x: number;\r
+ cx: number;\r
+ cy: number;\r
+ w: number;\r
+ h: number;\r
+ x2: number;\r
+ y2: number;\r
+ merge(box: Box): Box;\r
+ transform(m: Matrix): Box;\r
+ }\r
+\r
+ export interface BBox extends Box {\r
+ new (element?: Element): BBox;\r
+ }\r
+ export interface RBox extends Box {\r
+ new (element?: Element): RBox;\r
+ }\r
+ export interface TBox extends Box {\r
+ new (element?: Element): TBox;\r
+ }\r
+ interface Element {\r
+ bbox(): BBox;\r
+ rbox(element?: Element): RBox;\r
+ tbox(): TBox;\r
+ }\r
+ interface Library {\r
+ BBox: BBox;\r
+ RBox: RBox;\r
+ TBox: TBox;\r
+ }\r
+\r
+ // clip.js\r
+ export interface ClipPath extends Container {\r
+ new (): ClipPath;\r
+ targets: Element[];\r
+ remove(): this;\r
+ }\r
+ interface Container {\r
+ clip(): ClipPath;\r
+ }\r
+ interface Element {\r
+ clipWith(element: Element): this;\r
+ clipper: ClipPath;\r
+ unclip(): this;\r
+ }\r
+ interface Library {\r
+ ClipPath: ClipPath;\r
+ }\r
+\r
+ // color.js\r
+ interface ColorLike {\r
+ r: number;\r
+ g: number;\r
+ b: number;\r
+ }\r
+\r
+ type ColorAlias = string | ColorLike;\r
+\r
+ export interface Color extends ColorLike {\r
+ new (): Color;\r
+ new (color: ColorAlias): Color;\r
+\r
+ toString(): string;\r
+ toHex(): string;\r
+ toRgb(): string;\r
+ brightness(): number;\r
+ morph(color: ColorAlias): Color;\r
+ at(pos: number): Color;\r
+ }\r
+ interface Library {\r
+ Color: Color;\r
+ }\r
+\r
+ // container.js\r
+ interface ViewBoxLike {\r
+ x: number;\r
+ y: number;\r
+ width: number;\r
+ height: number;\r
+ }\r
+\r
+ export interface Container extends Parent {\r
+ new (): Container;\r
+ }\r
+ interface Library {\r
+ Container: Container;\r
+ }\r
+\r
+ // data.js\r
+ interface Element {\r
+ data(name: string): any;\r
+ data(name: string, value: any, sustain?: boolean): this;\r
+ }\r
+\r
+ // default.js\r
+ interface Library {\r
+ defaults: {\r
+ attrs: {\r
+ "fill-opacity": number;\r
+ "stroke-opacity": number;\r
+ "stroke-width": number;\r
+ "stroke-linejoin": string;\r
+ "stroke-linecap": string;\r
+ fill: string;\r
+ stroke: string;\r
+ opacity: number;\r
x: number;\r
+ y: number;\r
cx: number;\r
cy: number;\r
- w: number;\r
- h: number;\r
- x2: number;\r
- y2: number;\r
- merge(box: Box): Box;\r
- transform(m: Matrix): Box\r
- }\r
-\r
- export interface BBox extends Box {\r
- new (element?: Element): BBox;\r
- }\r
- export interface RBox extends Box {\r
- new (element?: Element): RBox;\r
- }\r
- export interface TBox extends Box {\r
- new (element?: Element): TBox;\r
- }\r
- interface Element {\r
- bbox(): BBox;\r
- rbox(element?: Element): RBox;\r
- tbox(): TBox;\r
- }\r
- interface Library {\r
- BBox: BBox;\r
- RBox: RBox;\r
- TBox: TBox;\r
- }\r
-\r
- // clip.js\r
- export interface ClipPath extends Container {\r
- new (): ClipPath;\r
- targets: Element[];\r
- remove(): this;\r
- }\r
- interface Container {\r
- clip(): ClipPath;\r
- }\r
- interface Element {\r
- clipWith(element: Element): this;\r
- clipper: ClipPath;\r
- unclip(): this;\r
- }\r
- interface Library { ClipPath: ClipPath; }\r
-\r
- // color.js\r
- interface ColorLike {\r
- r: number;\r
- g: number;\r
- b: number;\r
- }\r
-\r
- type ColorAlias = string | ColorLike;\r
-\r
- export interface Color extends ColorLike{\r
- new (): Color;\r
- new (color: ColorAlias): Color;\r
-\r
- toString(): string;\r
- toHex(): string;\r
- toRgb(): string;\r
- brightness(): number;\r
- morph(color: ColorAlias): Color;\r
- at(pos: number): Color;\r
- }\r
- interface Library { Color: Color; }\r
-\r
- // container.js\r
- interface ViewBoxLike {\r
- x: number;\r
- y: number;\r
width: number;\r
- height:number;\r
- }\r
-\r
- export interface Container extends Parent {\r
- new (): Container;\r
- }\r
- interface Library { Container: Container }\r
-\r
- // data.js\r
- interface Element {\r
- data(name: string): any;\r
- data(name: string, value: any, sustain?: boolean): this;\r
- }\r
-\r
- // default.js\r
- interface Library {\r
- defaults: {\r
- attrs: {\r
- 'fill-opacity': number;\r
- 'stroke-opacity': number;\r
- 'stroke-width': number;\r
- 'stroke-linejoin': string;\r
- 'stroke-linecap': string;\r
- 'fill': string;\r
- 'stroke': string;\r
- 'opacity': number;\r
- 'x': number;\r
- 'y': number;\r
- 'cx': number;\r
- 'cy': number;\r
- 'width': number;\r
- 'height': number;\r
- 'r': number;\r
- 'rx': number;\r
- 'ry': number;\r
- 'offset': number;\r
- 'stop-opacity': number;\r
- 'stop-color': string;\r
- 'font-size': number;\r
- 'font-family': string;\r
- 'text-anchor': string;\r
- }\r
- }\r
- }\r
-\r
- // defs.js\r
- export interface Defs extends Container {\r
- new (): Defs;\r
- }\r
- interface Library { Defs: Defs }\r
-\r
- // doc.js\r
- export interface Doc extends Container {\r
- new (): Doc;\r
- new (id: string): Doc;\r
- new (domElement: HTMLElement): Doc;\r
- namespace(): this;\r
- defs(): Defs;\r
- parent(): HTMLElement;\r
- spof(): this;\r
- remove(): this;\r
- }\r
- interface Library { Doc: Doc; }\r
-\r
- type ParentTypeAlias = string | Doc | Nested | G;\r
- // element.js\r
- export interface Element {\r
- new (): Element;\r
- node: LinkedHTMLElement;\r
- type: string;\r
-\r
- x(x: NumberAlias): this;\r
- x(): number;\r
- y(y: NumberAlias): this;\r
- y(): number;\r
- //cx(x: number, anchor?: boolean): this;\r
- cx(x: number): this;\r
- cx(): number;\r
- //cy(y: number, anchor?: boolean): this;\r
- cy(y: number): this;\r
- cy(): number;\r
- move(x: NumberAlias, y: NumberAlias): this;\r
- center(x: number, y: number): this;\r
-\r
- width(width: NumberAlias): this;\r
- width(): number;\r
- height(height: NumberAlias): this;\r
- height(): number;\r
- size(width?: NumberAlias, height?: NumberAlias): this;\r
-\r
- clone(): Element;\r
- clone(parent: Parent): Element;\r
- remove(): this;\r
- replace(element: Element): Element;\r
-\r
- addTo(parent: Parent): this;\r
- putIn(parent: Parent): Parent;\r
-\r
- id(): string;\r
- id(id: string): this;\r
-\r
- inside(x: number, y: number): boolean;\r
-\r
- show(): this;\r
- hide(): this;\r
- visible(): boolean;\r
-\r
- toString(): string;\r
-\r
- classes(): string[];\r
- hasClass(name: string): boolean;\r
- addClass(name: string): this;\r
- removeClass(name: string): this;\r
- toggleClass(name: string): this;\r
-\r
- reference(type: string): Element;\r
- // Add HTMLElement for Doc inheritance\r
- parent(type?: ParentTypeAlias): Parent | HTMLElement;\r
- doc(): Parent;\r
- parents(): Parent[];\r
-\r
- matches(selector: string): boolean;\r
- native(): LinkedHTMLElement;\r
-\r
- svg(svg: string): this;\r
- svg(): string;\r
-\r
- writeDataToDom(): this;\r
- setData(data: object): this;\r
-\r
- is(cls: any): boolean;\r
- }\r
- interface Library { Element: Element; }\r
-\r
- // ellipse.js\r
- interface CircleMethods extends Shape {\r
- rx(rx: number): this;\r
- rx(): this;\r
- ry(ry: number): this;\r
- ry(): this;\r
-\r
- radius(x: number, y?: number): this;\r
- }\r
- export interface Circle extends CircleMethods {\r
- new (): Circle;\r
- }\r
- export interface Ellipse extends CircleMethods {\r
- new (): Ellipse;\r
- }\r
- interface Container {\r
- circle(size?: number): Circle;\r
- ellipse(width?: number, height?: number): Ellipse;\r
- }\r
- interface Library {\r
- Circle: Circle;\r
- Ellipse: Ellipse;\r
- }\r
-\r
- // event.js\r
- interface Element {\r
- on(event: string, cb: Function, context?: Object): this;\r
- off(event: string, cb?: Function, context?: Object): this;\r
- fire(event: string, data?: any): this;\r
- fire(event: Event): this;\r
- event(): Event | CustomEvent;\r
-\r
- click(cb: Function): this;\r
- dblclick(cb: Function): this;\r
- mousedown(cb: Function): this;\r
- mouseup(cb: Function): this;\r
- mouseover(cb: Function): this;\r
- mouseout(cb: Function): this;\r
- mousemove(cb: Function): this;\r
- touchstart(cb: Function): this;\r
- touchmove(cb: Function): this;\r
- touchleave(cb: Function): this;\r
- touchend(cb: Function): this;\r
- touchcancel(cb: Function): this;\r
- }\r
-\r
- //fx.js\r
- interface Library {\r
- easing: {\r
- '-'(pos: number): number;\r
- '<>'(pos: number): number;\r
- '>'(pos: number): number;\r
- '<'(pos: number): number;\r
- }\r
- }\r
- interface Element {\r
- animate(duration?: number, ease?: string | ((pos: number) => number), delay?: number): Animation;\r
- animate(info: { ease?: string | ((pos: number) => number); duration?: number; delay?: number }): Animation;\r
- stop(jumpToEnd:boolean,clearQueue:boolean): Animation;\r
- }\r
- // TODO finishs FX\r
- interface StopProperties {\r
- color?: ColorAlias;\r
- offset?: number;\r
- opacity?: number;\r
- }\r
-\r
- // gradient.js\r
- export interface Stop extends Element {\r
- new (): Stop;\r
- update(offset?: number, color?: ColorAlias, opacity?: number): this;\r
- update(opts: StopProperties): this;\r
- }\r
- export interface Gradient extends Container {\r
- new (type: string): Gradient;\r
- at(offset?: number, color?: ColorAlias, opacity?: number): Stop;\r
- at(opts: StopProperties): Stop;\r
- update(block?: Function): this;\r
- fill(): string;\r
- fill(...params: any[]): never;\r
- toString(): string;\r
- from(x: number, y: number): this;\r
- to(x: number, y: number): this;\r
- radius(x: number, y?: number): this;\r
- }\r
- interface Container {\r
- gradient(type: string, block?: (stop: Gradient) => void): Gradient;\r
- }\r
- interface Library {\r
- Gradient: Gradient;\r
- Stop: Stop;\r
- }\r
-\r
- // group.js\r
- export interface G extends Container {\r
- new (): G;\r
- gbox(): BBox;\r
- }\r
- interface Container { group(): G; }\r
- interface Library { G: G; }\r
-\r
- // hyperlink.js\r
- export interface A extends Container {\r
- new (): A;\r
- to(url: string): this;\r
- to(): string;\r
- show(target: string): this;\r
- show(): string;\r
- show(...params: any[]): never;\r
- target(target: string): this;\r
- target(): string;\r
- }\r
- interface Container {\r
- link(url: string): A;\r
- }\r
- interface Element {\r
- linkTo(url: string): A;\r
- linkTo(url: (link: A) => void): A;\r
- }\r
- interface Library { A: A; }\r
-\r
- // image.js\r
- export interface Image extends Shape {\r
- new (): Image;\r
- load(url?: string): this;\r
- loaded(cb: (info: { width: number, height: number, ratio: number, url: string }) => void): this;\r
- error(cb: (event: Event) => void): this;\r
- }\r
- interface Container {\r
- image(): Image;\r
- image(href: string, size?: number): Image;\r
- image(href: string, width?: number, height?: number): Image;\r
- }\r
- interface Library { Image: Image; }\r
-\r
- // line.js\r
- interface ArrayPoint extends Array<number> { }\r
- type PointArrayAlias = ArrayPoint[] | number[] | PointArray | string;\r
-\r
- export interface Line extends Shape {\r
- new (): Line;\r
- array(): PointArray;\r
- plot(points: PointArrayAlias): this;\r
- plot(x1: number, y1: number, x2: number, y2: number): this;\r
- move(x: number, y: number): this;\r
- size(width?: number, height?: number): this;\r
- }\r
- interface Container {\r
- line(points: PointArrayAlias): Line;\r
- line(x1: number, y1: number, x2: number, y2: number): Line;\r
- }\r
- interface Library { Line: Line; }\r
-\r
- // marker.js\r
- export interface Marker extends Container {\r
- new (): Marker;\r
- ref(x: string | number, y: string | number): this;\r
- update(block: (marker: Marker) => void): this;\r
- toString(): string;\r
- }\r
- interface Container {\r
- marker(width?: number, height?: number, block?: (marker: Marker) => void): Marker\r
- }\r
- interface Defs {\r
- marker(width?: number, height?: number, block?: (marker: Marker) => void): Marker\r
- }\r
- interface Line {\r
- marker(position: string, width?: number, height?: number, block?: (marker: Marker) => void): Marker;\r
- marker(position: string, marker: Marker): Marker;\r
- }\r
- interface Polyline {\r
- marker(position: string, width?: number, height?: number, block?: (marker: Marker) => void): Marker;\r
- marker(position: string, marker: Marker): Marker;\r
- }\r
- interface Polygon {\r
- marker(position: string, width?: number, height?: number, block?: (marker: Marker) => void): Marker;\r
- marker(position: string, marker: Marker): Marker;\r
- }\r
- interface Path {\r
- marker(position: string, width?: number, height?: number, block?: (marker: Marker) => void): Marker;\r
- marker(position: string, marker: Marker): Marker;\r
- }\r
- interface Library {\r
- Marker: Marker;\r
- }\r
-\r
- // mask.js\r
- export interface Mask extends Container {\r
- new (): Mask;\r
- targets: Element[];\r
- }\r
- interface Container { mask(): Mask; }\r
- interface Element {\r
- maskWith(mask: Mask): this;\r
- maskWith(element: Element): this;\r
- masker: Mask;\r
- unmask(): this;\r
- }\r
- interface Library { Mask: Mask; }\r
-\r
- // matrix.js\r
- interface MatrixExtract {\r
- x: number;\r
- y: number;\r
- transformedX: number;\r
- transformedY: number;\r
- skewX: number;\r
- skewY: number;\r
- scaleX: number;\r
- scaleY: number;\r
- rotation: number;\r
- a: number;\r
- b: number;\r
- c: number;\r
- d: number;\r
- e: number;\r
- f: number;\r
- matrix: Matrix;\r
- }\r
-\r
- interface MatrixLike {\r
- a: number;\r
- b: number;\r
- c: number;\r
- d: number;\r
- e: number;\r
- f: number;\r
- }\r
-\r
- type MatrixAlias = MatrixLike | number[] | Element | string;\r
-\r
- export interface Matrix {\r
- new (): Matrix;\r
- new (source: MatrixAlias): Matrix;\r
- new (a: number, b: number, c: number, d: number, e: number, f: number): Matrix;\r
- a: number;\r
- b: number;\r
- c: number;\r
- d: number;\r
- e: number;\r
- f: number;\r
- extract(): MatrixExtract;\r
- clone(): Matrix;\r
- morph(matrix: Matrix): this;\r
- at(pos: number): Matrix;\r
- multiply(matrix: Matrix): Matrix;\r
- inverse(): Matrix;\r
- translate(x: number, y: number): Matrix;\r
- scale(x: number, y?: number, cx?: number, cy?: number): Matrix;\r
- rotate(r: number, cx?: number, cy?: number): Matrix;\r
- flip(a: string, offset?: number): Matrix;\r
- flip(offset?: number): Matrix;\r
- skew(x: number, y?: number, cx?: number, cy?: number): Matrix;\r
- skewX(x: number, cx?: number, cy?: number): Matrix;\r
- skewY(y: number, cx?: number, cy?: number): Matrix;\r
- around(cx: number, cy: number, matrix: Matrix): Matrix;\r
- native(): SVGMatrix;\r
- toString(): string;\r
- }\r
- interface Element {\r
- ctm(): Matrix;\r
- screenCTM(): Matrix;\r
- }\r
- interface Library { Matrix: Matrix }\r
-\r
- // memory.js\r
- interface Element {\r
- remember(name: string, value: any): this;\r
- remember(name: string): any;\r
- remember(obj: Object): this;\r
- forget(...keys: string[]): this;\r
- forget(): this;\r
- memory(): Object;\r
- }\r
-\r
- // nested.js\r
- export interface Nested extends Container {\r
- new (): Nested;\r
- }\r
- interface Container { nested(): Nested; }\r
- interface Library { Nested: Nested; }\r
-\r
- // number.js\r
- interface _Number {\r
- new (): _Number;\r
- new (value: _Number): _Number;\r
- new (value: string): _Number;\r
- new (value: number, unit?: any): _Number;\r
- toString(): string;\r
- toJSON(): Object;\r
- valueOf(): number;\r
- plus(number: number): _Number;\r
- minus(number: number): _Number;\r
- times(number: number): _Number;\r
- divide(number: number): _Number;\r
- to(unit: string): _Number;\r
- morph(number: any): this;\r
- at(pos: number): _Number;\r
- }\r
- interface Library { Number: _Number; }\r
-\r
- type NumberAlias = _Number | number | string;\r
-\r
- // parent.js\r
- export interface Parent extends Element {\r
- new (): Parent;\r
- children(): Element[];\r
- add(element: Element, i?: number): this;\r
- put(element: Element, i?: number): Element;\r
- has(element: Element): boolean;\r
- index(element: Element): number;\r
- get(i: number): Element;\r
- first(): Element;\r
- last(): Element;\r
- each(block: (index: number, children: Element[]) => void, deep?: boolean): this;\r
- removeElement(element: Element): this;\r
- clear(): this;\r
- defs(): Defs;\r
- }\r
- interface Library{ Parent: Parent }\r
-\r
- // path.js\r
- interface PathArrayPoint extends Array<number | string> { }\r
- type PathArrayAlias = PathArray | (string | number)[] | PathArrayPoint[] | string;\r
-\r
- export interface Path extends Shape {\r
- new (): Path;\r
- morphArray: PathArray;\r
- array(): PathArray;\r
- plot(d: PathArrayAlias): this;\r
- }\r
- interface Container {\r
- path(): Path;\r
- path(d: PathArrayAlias): Path;\r
- }\r
- interface Library{ Path: Path }\r
-\r
- // pathArray.js\r
- export interface PathArray extends _Array {\r
- new (): PathArray;\r
- new (d: PathArrayAlias): PathArray;\r
- move(x: number, y: number): this;\r
- size(width?: number, height?: number): this;\r
- parse(array: PathArrayAlias): PathArrayPoint[];\r
- parse(array: ArrayAlias): never;\r
- bbox(): BBox;\r
- }\r
- interface Library { PathArray: PathArray; }\r
-\r
- // pattern.js\r
- export interface Pattern extends Container {\r
- new (): Pattern;\r
- fill(): string;\r
- fill(...rest: any[]): never;\r
- update(block: (pattern: Pattern) => void): this;\r
- toString(): string;\r
- }\r
- interface Container {\r
- pattern(width?: number, height?: number, block?: (pattern: Pattern) => void): Pattern\r
- }\r
- interface Library { Pattern: Pattern }\r
-\r
- // point.js\r
- export interface Point {\r
- new (): Point;\r
- new (position: ArrayPoint): Point;\r
- new (point: Point): Point;\r
- new (position: { x: number, y: number }): Point;\r
- new (x: number, y: number): Point;\r
- \r
- x: number;\r
- y: number;\r
-\r
- clone(): Point;\r
- morph(point: Point): this;\r
- at(pos: number): Point;\r
- native(): SVGPoint;\r
- transform(matrix: Matrix): Point;\r
- }\r
- interface Library { Point: Point; }\r
- interface Element {\r
- point(): Point;\r
- point(position: ArrayPoint): Point;\r
- point(position: { x: number, y: number }): Point;\r
- point(x: number, y: number): Point;\r
- }\r
-\r
- // pointArray.js\r
- export interface PointArray extends _Array {\r
- new (): PointArray;\r
- new (points: PointArrayAlias): PointArray;\r
- toString(): string;\r
- toLine(): {\r
- x1: number;\r
- y1: number;\r
- x2: number;\r
- y2: number;\r
- };\r
- parse(points: PointArrayAlias): ArrayPoint[];\r
- parse(array: ArrayAlias): never;\r
- move(x: number, y: number): this;\r
- size(width?: number, height?: number): this;\r
- bbox(): BBox;\r
- }\r
- interface Library { PointArray: PointArray }\r
-\r
- // poly.js\r
- interface poly extends Shape {\r
- array(): PointArray;\r
- plot(p: PointArrayAlias): this;\r
- move(x: number, y: number): this;\r
- size(width: number, height: number): this;\r
- }\r
- export interface Polyline extends poly {\r
- new (): Polyline;\r
- }\r
- interface Library { Polyline: Polyline; }\r
- interface Container {\r
- polyline(points: PointArrayAlias): Polyline;\r
- }\r
- export interface Polygon extends poly {\r
- new (): Polygon;\r
- }\r
- interface Library { Polygon: Polygon; }\r
- interface Container {\r
- polygon(points: PointArrayAlias): Polygon;\r
- }\r
-\r
- // rect.js\r
- export interface Rect extends Shape {\r
- new (): Rect;\r
- radius(x: number, y?: number): this;\r
- }\r
- interface Library { Rect: Rect; }\r
- interface Container {\r
- rect(width?: number, height?: number): Rect;\r
- }\r
-\r
- // regex.js\r
- interface Library {\r
- regex: {\r
- numberAndUnit: RegExp;\r
- hex: RegExp;\r
- rgb: RegExp;\r
- reference: RegExp;\r
- transforms: RegExp;\r
- whitespace: RegExp;\r
- isHex: RegExp;\r
- isRgb: RegExp;\r
- isCss: RegExp;\r
- isBlank: RegExp;\r
- isNumber: RegExp;\r
- isPercent: RegExp;\r
- isImage: RegExp;\r
- delimiter: RegExp;\r
- hyphen: RegExp;\r
- pathLetters: RegExp;\r
- isPathLetter: RegExp;\r
- dots: RegExp;\r
- }\r
- }\r
-\r
- // selector.js\r
- interface Library {\r
- get(id: string): Element;\r
- select(query: string, parent?: HTMLElement): Set;\r
- }\r
- interface Parent {\r
- select(query: string): Set;\r
- }\r
-\r
- // set.js\r
- export interface Set {\r
- new (members?: Element[]): Set;\r
- add(...elments: Element[]): this;\r
- remove(element: Element): this;\r
- each(block: (index: number, members: Element[]) => void): this;\r
- clear(): this;\r
- length(): number;\r
- has(element: Element): this;\r
- index(element: Element): number;\r
- get(i: number): Element;\r
- first(): Element;\r
- last(): Element;\r
- valueOf(): Element[];\r
- bbox(): BBox;\r
- click(cb: Function): Set;\r
- }\r
- interface Container { set(members?: Element[]): Set; }\r
- interface Library { Set: Set; }\r
-\r
- // shape.js\r
- export interface Shape extends Element {\r
- new (): Shape;\r
- }\r
- interface Library { Shape: Shape; }\r
-\r
- // style.js\r
- interface Element {\r
- style(styles: Object): this;\r
- style(style: string): any;\r
- style(style: string, value: any): this;\r
- }\r
-\r
- // sugar.js\r
- interface StrokeData {\r
- color?: string;\r
- width?: number;\r
- opacity?: number;\r
- linecap?: string;\r
- linejoin?: string;\r
- miterlimit?: number;\r
- dasharray?: string;\r
- dashoffset?: number;\r
- }\r
- interface Element {\r
- fill(fill: { color?: string; opacity?: number, rule?: string }): this;\r
- fill(color: string): this;\r
- fill(pattern: Element): this;\r
- fill(image: Image): this;\r
- stroke(stroke: StrokeData): this;\r
- stroke(color: string): this;\r
- rotate(d: number, cx?: number, cy?: number): this;\r
- skew(x: number, y?: number, cx?: number, cy?: number): this;\r
- scale(x: number, y?: number, cx?: number, cy?: number): this;\r
- translate(x: number, y: number): this;\r
- flip(a: string, offset?: number): this;\r
- flip(offset?: number): this;\r
- matrix(m: MatrixAlias): this;\r
- matrix(a: number, b: number, c: number, d: number, e: number, f: number): this;\r
- opacity(o: number): this;\r
- opacity(): number;\r
- dx(x: NumberAlias): this;\r
- dy(y: NumberAlias): this;\r
- dmove(x: NumberAlias, y: NumberAlias): this;\r
- }\r
- interface Path {\r
- length(): number;\r
- pointAt(length: number): { x: number, y: number };\r
- }\r
- interface FontData {\r
- family?: string;\r
- size?: NumberAlias;\r
- anchor?: string;\r
- leading?: NumberAlias;\r
- weight?: string;\r
- style?: string\r
- }\r
- interface Parent {\r
- font(font: FontData): this;\r
- font(key: string, value: any): this;\r
- }\r
- interface Text {\r
- font(font: FontData): this;\r
- font(key: string, value: any): this;\r
- }\r
-\r
- // text.js\r
- export interface Text extends Shape {\r
- new (): Text;\r
- clone(): Text;\r
- text(): string;\r
- text(text: string): this;\r
- text(block: (text: Text) => void): this;\r
- size(fontSize: NumberAlias): this;\r
- leading(): number;\r
- leading(leading: NumberAlias): this;\r
- lines(): Set;\r
- rebuild(enabled: boolean): this;\r
- build(enabled: boolean): this;\r
- plain(text: string): this;\r
- tspan(text: string): Tspan;\r
- tspan(block: (tspan: Tspan) => void): this;\r
- clear(): this;\r
- length(): number;\r
- }\r
- interface Container {\r
- text(text: string): Text;\r
- text(block: (tspan: Tspan) => void): Text;\r
- plain(text: string): Text;\r
- }\r
- interface Library { Text: Text; }\r
- export interface Tspan extends Shape {\r
- new (): Tspan;\r
- text(): string;\r
- text(text: string): Tspan;\r
- text(block: (tspan: Tspan) => void): this;\r
- dx(x: NumberAlias): this;\r
- dy(y: NumberAlias): this;\r
- newLine(): this;\r
- plain(text: any): this;\r
- tspan(text: string): Tspan;\r
- tspan(block: (tspan: Tspan) => void): this;\r
- clear(): this;\r
- length(): number;\r
- }\r
- interface Library { Tspan: Tspan; }\r
-\r
- // textpath.js\r
- export interface TextPath extends Parent {\r
- new (): TextPath;\r
- }\r
- interface Text {\r
- path(d: PathArrayAlias): this;\r
- track(): Element;\r
- textPath(): Element;\r
- }\r
- interface Library { TextPath: TextPath; }\r
-\r
- // transform.js\r
- interface Element {\r
- transform(t: Transform, relative?: boolean): Element;\r
- transform(): Transform;\r
- untransform(): this;\r
- matrixify(): Matrix;\r
- toParent(parent: Parent): this;\r
- toDoc(): this;\r
- }\r
- interface Transform {\r
- x?: number;\r
- y?: number;\r
- rotation?: number;\r
- cx?: number;\r
- cy?: number;\r
- scaleX?: number;\r
- scaleY?: number;\r
- skewX?: number;\r
- skewY?: number;\r
- matrix?: Matrix; // 1,0,0,1,0,0\r
- a?: number; // direct digits of matrix\r
- b?: number;\r
- c?: number;\r
- d?: number;\r
- e?: number;\r
- f?: number;\r
- scale?: number;\r
- }\r
- export interface Transformation {\r
- new (...transform: Transform[]): Transformation;\r
- new (source: Transform, inversed?: boolean): Transformation;\r
- at(pos: number): Matrix;\r
- undo(transform: Transform): this\r
- }\r
- export interface Translate extends Transformation {new (): Translate}\r
- export interface Rotate extends Transformation {new (): Rotate}\r
- export interface Scale extends Transformation {new (): Scale}\r
- export interface Skew extends Transformation {new (): Skew}\r
- interface Library {\r
- Transformation: Transformation;\r
- Translate: Translate;\r
- Rotate: Rotate;\r
- Scale: Scale;\r
- Skew: Skew;\r
- }\r
-\r
- // ungroup.js\r
- interface Parent {\r
- ungroup(parent: Parent, depth?: number): this;\r
- flatten(parent: Parent, depth?: number): this;\r
- }\r
-\r
- // use.js\r
- export interface Use extends Shape {\r
- new (): Use;\r
- element(element: Element, file?: string): this;\r
- }\r
- interface Container {\r
- use(element: Element | string, file?: string): Use;\r
- }\r
- interface Library { Use: Use; }\r
-\r
- // utilities.js\r
- interface Library {\r
- utils: {\r
- map(array: any[], block: Function): any;\r
- filter(array: any[], block: Function): any;\r
- radians(d: number): number;\r
- degrees(r: number): number;\r
- filterSVGElements: HTMLElement[]\r
- }\r
- }\r
-\r
- // viewbox.js\r
- type ViewBoxAlias = ViewBoxLike | number[] | string | Element;\r
-\r
- interface ViewBox {\r
- new (source: ViewBoxAlias): ViewBox;\r
- new (x: number, y: number, width: number, height: number): ViewBox;\r
- x: number;\r
- y: number;\r
+ height: number;\r
+ r: number;\r
+ rx: number;\r
+ ry: number;\r
+ offset: number;\r
+ "stop-opacity": number;\r
+ "stop-color": string;\r
+ "font-size": number;\r
+ "font-family": string;\r
+ "text-anchor": string;\r
+ };\r
+ };\r
+ }\r
+\r
+ // defs.js\r
+ export interface Defs extends Container {\r
+ new (): Defs;\r
+ }\r
+ interface Library {\r
+ Defs: Defs;\r
+ }\r
+\r
+ // doc.js\r
+ export interface Doc extends Container {\r
+ new (): Doc;\r
+ new (id: string): Doc;\r
+ new (domElement: HTMLElement): Doc;\r
+ namespace(): this;\r
+ defs(): Defs;\r
+ parent(): HTMLElement;\r
+ spof(): this;\r
+ remove(): this;\r
+ }\r
+ interface Library {\r
+ Doc: Doc;\r
+ }\r
+\r
+ type ParentTypeAlias = string | Doc | Nested | G;\r
+ // element.js\r
+ export interface Element {\r
+ new (): Element;\r
+ node: LinkedHTMLElement;\r
+ type: string;\r
+\r
+ x(x: NumberAlias): this;\r
+ x(): number;\r
+ y(y: NumberAlias): this;\r
+ y(): number;\r
+ //cx(x: number, anchor?: boolean): this;\r
+ cx(x: number): this;\r
+ cx(): number;\r
+ //cy(y: number, anchor?: boolean): this;\r
+ cy(y: number): this;\r
+ cy(): number;\r
+ move(x: NumberAlias, y: NumberAlias): this;\r
+ center(x: number, y: number): this;\r
+\r
+ width(width: NumberAlias): this;\r
+ width(): number;\r
+ height(height: NumberAlias): this;\r
+ height(): number;\r
+ size(width?: NumberAlias, height?: NumberAlias): this;\r
+\r
+ clone(parent?: Parent): Element;\r
+ remove(): this;\r
+ replace(element: Element): Element;\r
+\r
+ addTo(parent: Parent): this;\r
+ putIn(parent: Parent): Parent;\r
+\r
+ id(): string;\r
+ id(id: string): this;\r
+\r
+ inside(x: number, y: number): boolean;\r
+\r
+ show(): this;\r
+ hide(): this;\r
+ visible(): boolean;\r
+\r
+ toString(): string;\r
+\r
+ classes(): string[];\r
+ hasClass(name: string): boolean;\r
+ addClass(name: string): this;\r
+ removeClass(name: string): this;\r
+ toggleClass(name: string): this;\r
+\r
+ reference(type: string): Element;\r
+ // Add HTMLElement for Doc inheritance\r
+ parent(type?: ParentTypeAlias): Parent | HTMLElement;\r
+ doc(): Parent;\r
+ parents(): Parent[];\r
+\r
+ matches(selector: string): boolean;\r
+ native(): LinkedHTMLElement;\r
+\r
+ svg(svg: string): this;\r
+ svg(): string;\r
+\r
+ writeDataToDom(): this;\r
+ setData(data: object): this;\r
+\r
+ is(cls: any): boolean;\r
+ }\r
+ interface Library {\r
+ Element: Element;\r
+ }\r
+\r
+ // ellipse.js\r
+ interface CircleMethods extends Shape {\r
+ rx(rx: number): this;\r
+ rx(): this;\r
+ ry(ry: number): this;\r
+ ry(): this;\r
+\r
+ radius(x: number, y?: number): this;\r
+ }\r
+ export interface Circle extends CircleMethods {\r
+ new (): Circle;\r
+ }\r
+ export interface Ellipse extends CircleMethods {\r
+ new (): Ellipse;\r
+ }\r
+ interface Container {\r
+ circle(size?: number): Circle;\r
+ ellipse(width?: number, height?: number): Ellipse;\r
+ }\r
+ interface Library {\r
+ Circle: Circle;\r
+ Ellipse: Ellipse;\r
+ }\r
+\r
+ // event.js\r
+ interface Element {\r
+ on(event: string, cb: Function, context?: Object): this;\r
+ off(event: string, cb?: Function, context?: Object): this;\r
+ fire(event: string, data?: any): this;\r
+ fire(event: Event): this;\r
+ event(): Event | CustomEvent;\r
+\r
+ click(cb: Function): this;\r
+ dblclick(cb: Function): this;\r
+ mousedown(cb: Function): this;\r
+ mouseup(cb: Function): this;\r
+ mouseover(cb: Function): this;\r
+ mouseout(cb: Function): this;\r
+ mousemove(cb: Function): this;\r
+ touchstart(cb: Function): this;\r
+ touchmove(cb: Function): this;\r
+ touchleave(cb: Function): this;\r
+ touchend(cb: Function): this;\r
+ touchcancel(cb: Function): this;\r
+ }\r
+\r
+ //fx.js\r
+ interface Library {\r
+ easing: {\r
+ "-"(pos: number): number;\r
+ "<>"(pos: number): number;\r
+ ">"(pos: number): number;\r
+ "<"(pos: number): number;\r
+ };\r
+ }\r
+ interface Element {\r
+ animate(\r
+ duration?: number,\r
+ ease?: string | ((pos: number) => number),\r
+ delay?: number\r
+ ): Animation;\r
+ animate(info: {\r
+ ease?: string | ((pos: number) => number);\r
+ duration?: number;\r
+ delay?: number;\r
+ }): Animation;\r
+ stop(jumpToEnd: boolean, clearQueue: boolean): Animation;\r
+ }\r
+ // TODO finishs FX\r
+ interface StopProperties {\r
+ color?: ColorAlias;\r
+ offset?: number;\r
+ opacity?: number;\r
+ }\r
+\r
+ // gradient.js\r
+ export interface Stop extends Element {\r
+ new (): Stop;\r
+ update(offset?: number, color?: ColorAlias, opacity?: number): this;\r
+ update(opts: StopProperties): this;\r
+ }\r
+ export interface Gradient extends Container {\r
+ new (type: string): Gradient;\r
+ at(offset?: number, color?: ColorAlias, opacity?: number): Stop;\r
+ at(opts: StopProperties): Stop;\r
+ update(block?: Function): this;\r
+ fill(): string;\r
+ fill(...params: any[]): never;\r
+ toString(): string;\r
+ from(x: number, y: number): this;\r
+ to(x: number, y: number): this;\r
+ radius(x: number, y?: number): this;\r
+ }\r
+ interface Container {\r
+ gradient(type: string, block?: (stop: Gradient) => void): Gradient;\r
+ }\r
+ interface Library {\r
+ Gradient: Gradient;\r
+ Stop: Stop;\r
+ }\r
+\r
+ // group.js\r
+ export interface G extends Container {\r
+ new (): G;\r
+ gbox(): BBox;\r
+ }\r
+ interface Container {\r
+ group(): G;\r
+ }\r
+ interface Library {\r
+ G: G;\r
+ }\r
+\r
+ // hyperlink.js\r
+ export interface A extends Container {\r
+ new (): A;\r
+ to(url: string): this;\r
+ to(): string;\r
+ show(target: string): this;\r
+ show(): string;\r
+ show(...params: any[]): never;\r
+ target(target: string): this;\r
+ target(): string;\r
+ }\r
+ interface Container {\r
+ link(url: string): A;\r
+ }\r
+ interface Element {\r
+ linkTo(url: string): A;\r
+ linkTo(url: (link: A) => void): A;\r
+ }\r
+ interface Library {\r
+ A: A;\r
+ }\r
+\r
+ // image.js\r
+ export interface Image extends Shape {\r
+ new (): Image;\r
+ load(url?: string): this;\r
+ loaded(\r
+ cb: (info: {\r
width: number;\r
height: number;\r
- zoom?: number;\r
- toString(): string;\r
- morph(source: ViewBoxAlias): ViewBox;\r
- morph(x: number, y: number, width: number, height: number): ViewBox;\r
- at(pos:number): ViewBox;\r
- }\r
- interface Container {\r
- viewbox(): ViewBox;\r
- viewbox(x: number, y: number, width: number, height: number): this;\r
- viewbox(viewbox: ViewBoxLike): this;\r
- }\r
- interface Library { ViewBox: ViewBox; }\r
-\r
- export interface Animation {\r
- stop(): Animation;\r
- finish(): Animation;\r
- pause(): Animation;\r
- play(): Animation;\r
- reverse(reversed?: boolean): Animation;\r
-\r
- attr(name: string, value: any, namespace?: string): Animation;\r
- attr(obj: Object): Animation;\r
- attr(name: string): any;\r
- attr(): object;\r
-\r
- viewbox(x: number, y: number, w: number, h: number): Animation;\r
-\r
- move(x: number, y: number, anchor?: boolean): Animation;\r
- dmove(x: number, y: number): Animation;\r
- x(x: number, anchor?: boolean): Animation;\r
- y(y: number, anchor?: boolean): Animation;\r
-\r
- center(x: number, y: number, anchor?: boolean): Animation;\r
- cx(x: number, anchor?: boolean): Animation;\r
- cy(y: number, anchor?: boolean): Animation;\r
-\r
- size(w: number, h: number, anchor?: boolean): Animation;\r
- during(cb: (pos: number) => void): Animation;\r
- to(value: number): Animation;\r
- after(cb: () => void): Animation;\r
- \r
- delay(delayMS: number): Animation;\r
-\r
- rotate(degrees: number, cx?: number, cy?: number): Animation;\r
- skew(skewX: number, skewY?: number, cx?: number, cy?: number): Animation;\r
- scale(scaleX: number, scaleY?: number, cx?: number, cy?: number): Animation;\r
- translate(x: number, y: number): Animation;\r
- transform(t: Transform, relative?: boolean): Animation;\r
-\r
- // TODO style, etc, bbox...\r
- }\r
+ ratio: number;\r
+ url: string;\r
+ }) => void\r
+ ): this;\r
+ error(cb: (event: Event) => void): this;\r
+ }\r
+ interface Container {\r
+ image(): Image;\r
+ image(href: string, size?: number): Image;\r
+ image(href: string, width?: number, height?: number): Image;\r
+ }\r
+ interface Library {\r
+ Image: Image;\r
+ }\r
+\r
+ // line.js\r
+ interface ArrayPoint extends Array<number> {}\r
+ type PointArrayAlias = ArrayPoint[] | number[] | PointArray | string;\r
+\r
+ export interface Line extends Shape {\r
+ new (): Line;\r
+ array(): PointArray;\r
+ plot(points: PointArrayAlias): this;\r
+ plot(x1: number, y1: number, x2: number, y2: number): this;\r
+ move(x: number, y: number): this;\r
+ size(width?: number, height?: number): this;\r
+ }\r
+ interface Container {\r
+ line(points: PointArrayAlias): Line;\r
+ line(x1: number, y1: number, x2: number, y2: number): Line;\r
+ }\r
+ interface Library {\r
+ Line: Line;\r
+ }\r
+\r
+ // marker.js\r
+ export interface Marker extends Container {\r
+ new (): Marker;\r
+ ref(x: string | number, y: string | number): this;\r
+ update(block: (marker: Marker) => void): this;\r
+ toString(): string;\r
+ }\r
+ interface Container {\r
+ marker(\r
+ width?: number,\r
+ height?: number,\r
+ block?: (marker: Marker) => void\r
+ ): Marker;\r
+ }\r
+ interface Defs {\r
+ marker(\r
+ width?: number,\r
+ height?: number,\r
+ block?: (marker: Marker) => void\r
+ ): Marker;\r
+ }\r
+ interface Line {\r
+ marker(\r
+ position: string,\r
+ width?: number,\r
+ height?: number,\r
+ block?: (marker: Marker) => void\r
+ ): Marker;\r
+ marker(position: string, marker: Marker): Marker;\r
+ }\r
+ interface Polyline {\r
+ marker(\r
+ position: string,\r
+ width?: number,\r
+ height?: number,\r
+ block?: (marker: Marker) => void\r
+ ): Marker;\r
+ marker(position: string, marker: Marker): Marker;\r
+ }\r
+ interface Polygon {\r
+ marker(\r
+ position: string,\r
+ width?: number,\r
+ height?: number,\r
+ block?: (marker: Marker) => void\r
+ ): Marker;\r
+ marker(position: string, marker: Marker): Marker;\r
+ }\r
+ interface Path {\r
+ marker(\r
+ position: string,\r
+ width?: number,\r
+ height?: number,\r
+ block?: (marker: Marker) => void\r
+ ): Marker;\r
+ marker(position: string, marker: Marker): Marker;\r
+ }\r
+ interface Library {\r
+ Marker: Marker;\r
+ }\r
+\r
+ // mask.js\r
+ export interface Mask extends Container {\r
+ new (): Mask;\r
+ targets: Element[];\r
+ }\r
+ interface Container {\r
+ mask(): Mask;\r
+ }\r
+ interface Element {\r
+ maskWith(mask: Mask): this;\r
+ maskWith(element: Element): this;\r
+ masker: Mask;\r
+ unmask(): this;\r
+ }\r
+ interface Library {\r
+ Mask: Mask;\r
+ }\r
+\r
+ // matrix.js\r
+ interface MatrixExtract {\r
+ x: number;\r
+ y: number;\r
+ transformedX: number;\r
+ transformedY: number;\r
+ skewX: number;\r
+ skewY: number;\r
+ scaleX: number;\r
+ scaleY: number;\r
+ rotation: number;\r
+ a: number;\r
+ b: number;\r
+ c: number;\r
+ d: number;\r
+ e: number;\r
+ f: number;\r
+ matrix: Matrix;\r
+ }\r
+\r
+ interface MatrixLike {\r
+ a: number;\r
+ b: number;\r
+ c: number;\r
+ d: number;\r
+ e: number;\r
+ f: number;\r
+ }\r
+\r
+ type MatrixAlias = MatrixLike | number[] | Element | string;\r
+\r
+ export interface Matrix {\r
+ new (): Matrix;\r
+ new (source: MatrixAlias): Matrix;\r
+ new (\r
+ a: number,\r
+ b: number,\r
+ c: number,\r
+ d: number,\r
+ e: number,\r
+ f: number\r
+ ): Matrix;\r
+ a: number;\r
+ b: number;\r
+ c: number;\r
+ d: number;\r
+ e: number;\r
+ f: number;\r
+ extract(): MatrixExtract;\r
+ clone(): Matrix;\r
+ morph(matrix: Matrix): this;\r
+ at(pos: number): Matrix;\r
+ multiply(matrix: Matrix): Matrix;\r
+ inverse(): Matrix;\r
+ translate(x: number, y: number): Matrix;\r
+ scale(x: number, y?: number, cx?: number, cy?: number): Matrix;\r
+ rotate(r: number, cx?: number, cy?: number): Matrix;\r
+ flip(a: string, offset?: number): Matrix;\r
+ flip(offset?: number): Matrix;\r
+ skew(x: number, y?: number, cx?: number, cy?: number): Matrix;\r
+ skewX(x: number, cx?: number, cy?: number): Matrix;\r
+ skewY(y: number, cx?: number, cy?: number): Matrix;\r
+ around(cx: number, cy: number, matrix: Matrix): Matrix;\r
+ native(): SVGMatrix;\r
+ toString(): string;\r
+ }\r
+ interface Element {\r
+ ctm(): Matrix;\r
+ screenCTM(): Matrix;\r
+ }\r
+ interface Library {\r
+ Matrix: Matrix;\r
+ }\r
+\r
+ // memory.js\r
+ interface Element {\r
+ remember(name: string, value: any): this;\r
+ remember(name: string): any;\r
+ remember(obj: Object): this;\r
+ forget(...keys: string[]): this;\r
+ forget(): this;\r
+ memory(): Object;\r
+ }\r
+\r
+ // nested.js\r
+ export interface Nested extends Container {\r
+ new (): Nested;\r
+ }\r
+ interface Container {\r
+ nested(): Nested;\r
+ }\r
+ interface Library {\r
+ Nested: Nested;\r
+ }\r
+\r
+ // number.js\r
+ interface _Number {\r
+ new (): _Number;\r
+ new (value: _Number): _Number;\r
+ new (value: string): _Number;\r
+ new (value: number, unit?: any): _Number;\r
+ toString(): string;\r
+ toJSON(): Object;\r
+ valueOf(): number;\r
+ plus(number: number): _Number;\r
+ minus(number: number): _Number;\r
+ times(number: number): _Number;\r
+ divide(number: number): _Number;\r
+ to(unit: string): _Number;\r
+ morph(number: any): this;\r
+ at(pos: number): _Number;\r
+ }\r
+ interface Library {\r
+ Number: _Number;\r
+ }\r
+\r
+ type NumberAlias = _Number | number | string;\r
+\r
+ // parent.js\r
+ export interface Parent extends Element {\r
+ new (): Parent;\r
+ children(): Element[];\r
+ add(element: Element, i?: number): this;\r
+ put(element: Element, i?: number): Element;\r
+ has(element: Element): boolean;\r
+ index(element: Element): number;\r
+ get(i: number): Element;\r
+ first(): Element;\r
+ last(): Element;\r
+ each(\r
+ block: (index: number, children: Element[]) => void,\r
+ deep?: boolean\r
+ ): this;\r
+ removeElement(element: Element): this;\r
+ clear(): this;\r
+ defs(): Defs;\r
+ }\r
+ interface Library {\r
+ Parent: Parent;\r
+ }\r
+\r
+ // path.js\r
+ interface PathArrayPoint extends Array<number | string> {}\r
+ type PathArrayAlias =\r
+ | PathArray\r
+ | (string | number)[]\r
+ | PathArrayPoint[]\r
+ | string;\r
+\r
+ export interface Path extends Shape {\r
+ new (): Path;\r
+ morphArray: PathArray;\r
+ array(): PathArray;\r
+ plot(d: PathArrayAlias): this;\r
+ }\r
+ interface Container {\r
+ path(): Path;\r
+ path(d: PathArrayAlias): Path;\r
+ }\r
+ interface Library {\r
+ Path: Path;\r
+ }\r
+\r
+ // pathArray.js\r
+ export interface PathArray extends _Array {\r
+ new (): PathArray;\r
+ new (d: PathArrayAlias): PathArray;\r
+ move(x: number, y: number): this;\r
+ size(width?: number, height?: number): this;\r
+ parse(array: PathArrayAlias): PathArrayPoint[];\r
+ parse(array: ArrayAlias): never;\r
+ bbox(): BBox;\r
+ }\r
+ interface Library {\r
+ PathArray: PathArray;\r
+ }\r
+\r
+ // pattern.js\r
+ export interface Pattern extends Container {\r
+ new (): Pattern;\r
+ fill(): string;\r
+ fill(...rest: any[]): never;\r
+ update(block: (pattern: Pattern) => void): this;\r
+ toString(): string;\r
+ }\r
+ interface Container {\r
+ pattern(\r
+ width?: number,\r
+ height?: number,\r
+ block?: (pattern: Pattern) => void\r
+ ): Pattern;\r
+ }\r
+ interface Library {\r
+ Pattern: Pattern;\r
+ }\r
+\r
+ // point.js\r
+ export interface Point {\r
+ new (): Point;\r
+ new (position: ArrayPoint): Point;\r
+ new (point: Point): Point;\r
+ new (position: { x: number; y: number }): Point;\r
+ new (x: number, y: number): Point;\r
+\r
+ x: number;\r
+ y: number;\r
+\r
+ clone(): Point;\r
+ morph(point: Point): this;\r
+ at(pos: number): Point;\r
+ native(): SVGPoint;\r
+ transform(matrix: Matrix): Point;\r
+ }\r
+ interface Library {\r
+ Point: Point;\r
+ }\r
+ interface Element {\r
+ point(): Point;\r
+ point(position: ArrayPoint): Point;\r
+ point(position: { x: number; y: number }): Point;\r
+ point(x: number, y: number): Point;\r
+ }\r
+\r
+ // pointArray.js\r
+ export interface PointArray extends _Array {\r
+ new (): PointArray;\r
+ new (points: PointArrayAlias): PointArray;\r
+ toString(): string;\r
+ toLine(): {\r
+ x1: number;\r
+ y1: number;\r
+ x2: number;\r
+ y2: number;\r
+ };\r
+ parse(points: PointArrayAlias): ArrayPoint[];\r
+ parse(array: ArrayAlias): never;\r
+ move(x: number, y: number): this;\r
+ size(width?: number, height?: number): this;\r
+ bbox(): BBox;\r
+ }\r
+ interface Library {\r
+ PointArray: PointArray;\r
+ }\r
+\r
+ // poly.js\r
+ interface poly extends Shape {\r
+ array(): PointArray;\r
+ plot(p: PointArrayAlias): this;\r
+ move(x: number, y: number): this;\r
+ size(width: number, height: number): this;\r
+ }\r
+ export interface Polyline extends poly {\r
+ new (): Polyline;\r
+ }\r
+ interface Library {\r
+ Polyline: Polyline;\r
+ }\r
+ interface Container {\r
+ polyline(points: PointArrayAlias): Polyline;\r
+ }\r
+ export interface Polygon extends poly {\r
+ new (): Polygon;\r
+ }\r
+ interface Library {\r
+ Polygon: Polygon;\r
+ }\r
+ interface Container {\r
+ polygon(points: PointArrayAlias): Polygon;\r
+ }\r
+\r
+ // rect.js\r
+ export interface Rect extends Shape {\r
+ new (): Rect;\r
+ radius(x: number, y?: number): this;\r
+ }\r
+ interface Library {\r
+ Rect: Rect;\r
+ }\r
+ interface Container {\r
+ rect(width?: number, height?: number): Rect;\r
+ }\r
+\r
+ // regex.js\r
+ interface Library {\r
+ regex: {\r
+ numberAndUnit: RegExp;\r
+ hex: RegExp;\r
+ rgb: RegExp;\r
+ reference: RegExp;\r
+ transforms: RegExp;\r
+ whitespace: RegExp;\r
+ isHex: RegExp;\r
+ isRgb: RegExp;\r
+ isCss: RegExp;\r
+ isBlank: RegExp;\r
+ isNumber: RegExp;\r
+ isPercent: RegExp;\r
+ isImage: RegExp;\r
+ delimiter: RegExp;\r
+ hyphen: RegExp;\r
+ pathLetters: RegExp;\r
+ isPathLetter: RegExp;\r
+ dots: RegExp;\r
+ };\r
+ }\r
+\r
+ // selector.js\r
+ interface Library {\r
+ get(id: string): Element;\r
+ select(query: string, parent?: HTMLElement): Set;\r
+ }\r
+ interface Parent {\r
+ select(query: string): Set;\r
+ }\r
+\r
+ // set.js\r
+ export interface Set {\r
+ new (members?: Element[]): Set;\r
+ add(...elments: Element[]): this;\r
+ remove(element: Element): this;\r
+ each(block: (index: number, members: Element[]) => void): this;\r
+ clear(): this;\r
+ length(): number;\r
+ has(element: Element): this;\r
+ index(element: Element): number;\r
+ get(i: number): Element;\r
+ first(): Element;\r
+ last(): Element;\r
+ valueOf(): Element[];\r
+ bbox(): BBox;\r
+ click(cb: Function): Set;\r
+ }\r
+ interface Container {\r
+ set(members?: Element[]): Set;\r
+ }\r
+ interface Library {\r
+ Set: Set;\r
+ }\r
+\r
+ // shape.js\r
+ export interface Shape extends Element {\r
+ new (): Shape;\r
+ }\r
+ interface Library {\r
+ Shape: Shape;\r
+ }\r
+\r
+ // style.js\r
+ interface Element {\r
+ style(styles: Object): this;\r
+ style(style: string): any;\r
+ style(style: string, value: any): this;\r
+ }\r
+\r
+ // sugar.js\r
+ interface StrokeData {\r
+ color?: string;\r
+ width?: number;\r
+ opacity?: number;\r
+ linecap?: string;\r
+ linejoin?: string;\r
+ miterlimit?: number;\r
+ dasharray?: string;\r
+ dashoffset?: number;\r
+ }\r
+ interface Element {\r
+ fill(fill: { color?: string; opacity?: number; rule?: string }): this;\r
+ fill(color: string): this;\r
+ fill(pattern: Element): this;\r
+ fill(image: Image): this;\r
+ stroke(stroke: StrokeData): this;\r
+ stroke(color: string): this;\r
+ rotate(d: number, cx?: number, cy?: number): this;\r
+ skew(x: number, y?: number, cx?: number, cy?: number): this;\r
+ scale(x: number, y?: number, cx?: number, cy?: number): this;\r
+ translate(x: number, y: number): this;\r
+ flip(a: string, offset?: number): this;\r
+ flip(offset?: number): this;\r
+ matrix(m: MatrixAlias): this;\r
+ matrix(\r
+ a: number,\r
+ b: number,\r
+ c: number,\r
+ d: number,\r
+ e: number,\r
+ f: number\r
+ ): this;\r
+ opacity(o: number): this;\r
+ opacity(): number;\r
+ dx(x: NumberAlias): this;\r
+ dy(y: NumberAlias): this;\r
+ dmove(x: NumberAlias, y: NumberAlias): this;\r
+ }\r
+ interface Path {\r
+ length(): number;\r
+ pointAt(length: number): { x: number; y: number };\r
+ }\r
+ interface FontData {\r
+ family?: string;\r
+ size?: NumberAlias;\r
+ anchor?: string;\r
+ leading?: NumberAlias;\r
+ weight?: string;\r
+ style?: string;\r
+ }\r
+ interface Parent {\r
+ font(font: FontData): this;\r
+ font(key: string, value: any): this;\r
+ }\r
+ interface Text {\r
+ font(font: FontData): this;\r
+ font(key: string, value: any): this;\r
+ }\r
+\r
+ // text.js\r
+ export interface Text extends Shape {\r
+ new (): Text;\r
+ clone(): Text;\r
+ text(): string;\r
+ text(text: string): this;\r
+ text(block: (text: Text) => void): this;\r
+ size(fontSize: NumberAlias): this;\r
+ leading(): number;\r
+ leading(leading: NumberAlias): this;\r
+ lines(): Set;\r
+ rebuild(enabled: boolean): this;\r
+ build(enabled: boolean): this;\r
+ plain(text: string): this;\r
+ tspan(text: string): Tspan;\r
+ tspan(block: (tspan: Tspan) => void): this;\r
+ clear(): this;\r
+ length(): number;\r
+ }\r
+ interface Container {\r
+ text(text: string): Text;\r
+ text(block: (tspan: Tspan) => void): Text;\r
+ plain(text: string): Text;\r
+ }\r
+ interface Library {\r
+ Text: Text;\r
+ }\r
+ export interface Tspan extends Shape {\r
+ new (): Tspan;\r
+ text(): string;\r
+ text(text: string): Tspan;\r
+ text(block: (tspan: Tspan) => void): this;\r
+ dx(x: NumberAlias): this;\r
+ dy(y: NumberAlias): this;\r
+ newLine(): this;\r
+ plain(text: any): this;\r
+ tspan(text: string): Tspan;\r
+ tspan(block: (tspan: Tspan) => void): this;\r
+ clear(): this;\r
+ length(): number;\r
+ }\r
+ interface Library {\r
+ Tspan: Tspan;\r
+ }\r
+\r
+ // textpath.js\r
+ export interface TextPath extends Parent {\r
+ new (): TextPath;\r
+ }\r
+ interface Text {\r
+ path(d: PathArrayAlias): this;\r
+ track(): Element;\r
+ textPath(): Element;\r
+ }\r
+ interface Library {\r
+ TextPath: TextPath;\r
+ }\r
+\r
+ // transform.js\r
+ interface Element {\r
+ transform(t: Transform, relative?: boolean): Element;\r
+ transform(): Transform;\r
+ untransform(): this;\r
+ matrixify(): Matrix;\r
+ toParent(parent: Parent): this;\r
+ toDoc(): this;\r
+ }\r
+ interface Transform {\r
+ x?: number;\r
+ y?: number;\r
+ rotation?: number;\r
+ cx?: number;\r
+ cy?: number;\r
+ scaleX?: number;\r
+ scaleY?: number;\r
+ skewX?: number;\r
+ skewY?: number;\r
+ matrix?: Matrix; // 1,0,0,1,0,0\r
+ a?: number; // direct digits of matrix\r
+ b?: number;\r
+ c?: number;\r
+ d?: number;\r
+ e?: number;\r
+ f?: number;\r
+ scale?: number;\r
+ }\r
+ export interface Transformation {\r
+ new (...transform: Transform[]): Transformation;\r
+ new (source: Transform, inversed?: boolean): Transformation;\r
+ at(pos: number): Matrix;\r
+ undo(transform: Transform): this;\r
+ }\r
+ export interface Translate extends Transformation {\r
+ new (): Translate;\r
+ }\r
+ export interface Rotate extends Transformation {\r
+ new (): Rotate;\r
+ }\r
+ export interface Scale extends Transformation {\r
+ new (): Scale;\r
+ }\r
+ export interface Skew extends Transformation {\r
+ new (): Skew;\r
+ }\r
+ interface Library {\r
+ Transformation: Transformation;\r
+ Translate: Translate;\r
+ Rotate: Rotate;\r
+ Scale: Scale;\r
+ Skew: Skew;\r
+ }\r
+\r
+ // ungroup.js\r
+ interface Parent {\r
+ ungroup(parent: Parent, depth?: number): this;\r
+ flatten(parent: Parent, depth?: number): this;\r
+ }\r
+\r
+ // use.js\r
+ export interface Use extends Shape {\r
+ new (): Use;\r
+ element(element: Element, file?: string): this;\r
+ }\r
+ interface Container {\r
+ use(element: Element | string, file?: string): Use;\r
+ }\r
+ interface Library {\r
+ Use: Use;\r
+ }\r
+\r
+ // utilities.js\r
+ interface Library {\r
+ utils: {\r
+ map(array: any[], block: Function): any;\r
+ filter(array: any[], block: Function): any;\r
+ radians(d: number): number;\r
+ degrees(r: number): number;\r
+ filterSVGElements: HTMLElement[];\r
+ };\r
+ }\r
+\r
+ // viewbox.js\r
+ type ViewBoxAlias = ViewBoxLike | number[] | string | Element;\r
+\r
+ interface ViewBox {\r
+ new (source: ViewBoxAlias): ViewBox;\r
+ new (x: number, y: number, width: number, height: number): ViewBox;\r
+ x: number;\r
+ y: number;\r
+ width: number;\r
+ height: number;\r
+ zoom?: number;\r
+ toString(): string;\r
+ morph(source: ViewBoxAlias): ViewBox;\r
+ morph(x: number, y: number, width: number, height: number): ViewBox;\r
+ at(pos: number): ViewBox;\r
+ }\r
+ interface Container {\r
+ viewbox(): ViewBox;\r
+ viewbox(x: number, y: number, width: number, height: number): this;\r
+ viewbox(viewbox: ViewBoxLike): this;\r
+ }\r
+ interface Library {\r
+ ViewBox: ViewBox;\r
+ }\r
+\r
+ export interface Animation {\r
+ stop(): Animation;\r
+ finish(): Animation;\r
+ pause(): Animation;\r
+ play(): Animation;\r
+ reverse(reversed?: boolean): Animation;\r
+\r
+ attr(name: string, value: any, namespace?: string): Animation;\r
+ attr(obj: Object): Animation;\r
+ attr(name: string): any;\r
+ attr(): object;\r
+\r
+ viewbox(x: number, y: number, w: number, h: number): Animation;\r
+\r
+ move(x: number, y: number, anchor?: boolean): Animation;\r
+ dmove(x: number, y: number): Animation;\r
+ x(x: number, anchor?: boolean): Animation;\r
+ y(y: number, anchor?: boolean): Animation;\r
+\r
+ center(x: number, y: number, anchor?: boolean): Animation;\r
+ cx(x: number, anchor?: boolean): Animation;\r
+ cy(y: number, anchor?: boolean): Animation;\r
+\r
+ size(w: number, h: number, anchor?: boolean): Animation;\r
+ during(cb: (pos: number) => void): Animation;\r
+ to(value: number): Animation;\r
+ after(cb: () => void): Animation;\r
+\r
+ delay(delayMS: number): Animation;\r
+\r
+ rotate(degrees: number, cx?: number, cy?: number): Animation;\r
+ skew(skewX: number, skewY?: number, cx?: number, cy?: number): Animation;\r
+ scale(scaleX: number, scaleY?: number, cx?: number, cy?: number): Animation;\r
+ translate(x: number, y: number): Animation;\r
+ transform(t: Transform, relative?: boolean): Animation;\r
+\r
+ // TODO style, etc, bbox...\r
+ }\r
}\r