export = svgjs;\r
export as namespace svgjs;\r
\r
-declare var svgjs: svgjs.Library;\r
+declare const svgjs: svgjs.Library;\r
\r
// todo add SVG.FX\r
declare namespace svgjs {\r
export interface Library {\r
- (id: string): Doc;\r
- (domElement: HTMLElement): Doc;\r
+ (id: string): Svg;\r
+ (domElement: HTMLElement): Svg;\r
+ (): Svg;\r
ns: string;\r
xmlns: string;\r
xlink: string;\r
siblings(): Element[];\r
position(): number;\r
next(): Element;\r
- previous(): Element;\r
+ prev(): Element;\r
before(element: Element): Element;\r
after(element: Element): Element;\r
+ defs(): Defs;\r
}\r
\r
// array.js\r
type ArrayAlias = _Array | number[] | string;\r
\r
interface _Array {\r
- new (array?: ArrayAlias, fallback?: number[]): _Array;\r
+ new(array?: ArrayAlias, fallback?: number[]): _Array;\r
value: number[];\r
morph(array: number[]): this;\r
settle(): number[];\r
toString(): string;\r
valueOf(): number[];\r
parse(array: ArrayAlias): number[];\r
- split(string: string): number[];\r
reverse(): this;\r
clone(): _Array;\r
}\r
attr(name: string): any;\r
attr(obj: Object): this;\r
attr(name: string, value: any, namespace?: string): this;\r
+ attr(obj: Object[]): Object;\r
}\r
\r
// bare.js\r
- export interface Bare extends Element {\r
- new (element: string, inherit?: any): Bare;\r
+ export interface Dom extends Element {\r
+ new(element: string, inherit?: any): Bare;\r
words(text: string): this;\r
}\r
interface Parent {\r
}\r
\r
export interface BBox extends Box {\r
- new (element?: Element): BBox;\r
+ new(element?: Element): BBox;\r
}\r
export interface RBox extends Box {\r
- new (element?: Element): RBox;\r
+ new(element?: Element): RBox;\r
}\r
export interface TBox extends Box {\r
- new (element?: Element): TBox;\r
+ new(element?: Element): TBox;\r
}\r
interface Element {\r
bbox(): BBox;\r
\r
// clip.js\r
export interface ClipPath extends Container {\r
- new (): ClipPath;\r
+ new(): ClipPath;\r
targets: Element[];\r
remove(): this;\r
}\r
\r
type ColorAlias = string | ColorLike;\r
\r
- export interface Color extends ColorLike{\r
- new (): Color;\r
- new (color: ColorAlias): Color;\r
+ export interface Color extends ColorLike {\r
+ new(): Color;\r
+ new(color: ColorAlias): Color;\r
\r
toString(): string;\r
toHex(): string;\r
x: number;\r
y: number;\r
width: number;\r
- height:number;\r
+ height: number;\r
}\r
\r
export interface Container extends Parent {\r
- new (): Container;\r
+ new(): Container;\r
}\r
interface Library { Container: Container }\r
\r
\r
// defs.js\r
export interface Defs extends Container {\r
- new (): Defs;\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
+ export interface Svg extends Container {\r
+ new(): Svg;\r
+ new(id: string): Svg;\r
+ new(domElement: HTMLElement): Doc;\r
namespace(): this;\r
defs(): Defs;\r
parent(): HTMLElement;\r
spof(): this;\r
remove(): this;\r
+ isRoot(): boolean;\r
}\r
- interface Library { Doc: Doc; }\r
+ interface Library { Svg: Svg; }\r
\r
- type ParentTypeAlias = string | Doc | Nested | G;\r
+ type ParentTypeAlias = string | Svg | G;\r
// element.js\r
export interface Element {\r
- new (): Element;\r
+ new(): Element;\r
node: LinkedHTMLElement;\r
type: string;\r
\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
toggleClass(name: string): this;\r
\r
reference(type: string): Element;\r
- // Add HTMLElement for Doc inheritance\r
+ // Add HTMLElement for Svg inheritance\r
parent(type?: ParentTypeAlias): Parent | HTMLElement;\r
doc(): Parent;\r
parents(): Parent[];\r
radius(x: number, y?: number): this;\r
}\r
export interface Circle extends CircleMethods {\r
- new (): Circle;\r
+ new(): Circle;\r
}\r
export interface Ellipse extends CircleMethods {\r
- new (): Ellipse;\r
+ new(): Ellipse;\r
}\r
interface Container {\r
circle(size?: number): Circle;\r
interface Element {\r
animate(duration?: number, ease?: string, delay?: number): Animation;\r
animate(info: { ease?: string; duration?: number; delay?: number }): Animation;\r
- stop(jumpToEnd:boolean,clearQueue:boolean): Animation;\r
+ stop(jumpToEnd: boolean, clearQueue: boolean): Animation;\r
}\r
// TODO finishs FX\r
interface StopProperties {\r
\r
// gradient.js\r
export interface Stop extends Element {\r
- new (): Stop;\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
+ 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
+ url(): string;\r
+ url(...params: any[]): never;\r
toString(): string;\r
from(x: number, y: number): this;\r
to(x: number, y: number): this;\r
\r
// group.js\r
export interface G extends Container {\r
- new (): G;\r
+ new(): G;\r
gbox(): BBox;\r
}\r
interface Container { group(): G; }\r
\r
// hyperlink.js\r
export interface A extends Container {\r
- new (): A;\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
\r
// image.js\r
export interface Image extends Shape {\r
- new (): Image;\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
type PointArrayAlias = ArrayPoint[] | number[] | PointArray | string;\r
\r
export interface Line extends Shape {\r
- new (): Line;\r
+ new(): Line;\r
array(): PointArray;\r
plot(points: PointArrayAlias): this;\r
plot(x1: number, y1: number, x2: number, y2: number): this;\r
\r
// marker.js\r
export interface Marker extends Container {\r
- new (): Marker;\r
+ new(): Marker;\r
ref(x: string | number, y: string | number): this;\r
update(block: (marker: Marker) => void): this;\r
toString(): string;\r
\r
// mask.js\r
export interface Mask extends Container {\r
- new (): Mask;\r
+ new(): Mask;\r
targets: Element[];\r
}\r
interface Container { mask(): Mask; }\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
+ 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
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
+ 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
\r
// parent.js\r
export interface Parent extends Element {\r
- new (): Parent;\r
+ new(): Parent;\r
children(): Element[];\r
add(element: Element, i?: number): this;\r
put(element: Element, i?: number): 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
+ 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
+ new(): Path;\r
morphArray: PathArray;\r
array(): PathArray;\r
plot(d: PathArrayAlias): this;\r
path(): Path;\r
path(d: PathArrayAlias): Path;\r
}\r
- interface Library{ Path: Path }\r
+ interface Library { Path: Path }\r
\r
// pathArray.js\r
export interface PathArray extends _Array {\r
- new (): PathArray;\r
- new (d: PathArrayAlias): PathArray;\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
\r
// pattern.js\r
export interface Pattern extends Container {\r
- new (): Pattern;\r
- fill(): string;\r
- fill(...rest: any[]): never;\r
+ new(): Pattern;\r
+ url(): string;\r
+ url(...rest: any[]): never;\r
update(block: (pattern: Pattern) => void): this;\r
toString(): string;\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
+ 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
\r
// pointArray.js\r
export interface PointArray extends _Array {\r
- new (): PointArray;\r
- new (points: PointArrayAlias): PointArray;\r
+ new(): PointArray;\r
+ new(points: PointArrayAlias): PointArray;\r
toString(): string;\r
toLine(): {\r
x1: number;\r
size(width: number, height: number): this;\r
}\r
export interface PolyLine extends poly {\r
- new (): PolyLine;\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
+ new(): Polygon;\r
}\r
interface Library { Polygon: Polygon; }\r
interface Container {\r
\r
// rect.js\r
export interface Rect extends Shape {\r
- new (): Rect;\r
+ new(): Rect;\r
radius(x: number, y?: number): this;\r
}\r
interface Library { Rect: Rect; }\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
+ export interface List extends _Array {\r
+ new(members?: Element[]): Set;\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
+ 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
+ css(styles: Object): this;\r
+ css(style: string): any;\r
+ css(style: string, value: any): this;\r
+ css(style: Object[]): Object;\r
+ css(): Object;\r
+ show (): this;\r
+ hide (): this;\r
+ visible (): boolean;\r
}\r
\r
// sugar.js\r
\r
// text.js\r
export interface Text extends Shape {\r
- new (): Text;\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
}\r
interface Library { Text: Text; }\r
export interface Tspan extends Shape {\r
- new (): Tspan;\r
+ new(): Tspan;\r
text(): string;\r
text(text: string): Tspan;\r
text(block: (tspan: Tspan) => void): this;\r
\r
// textpath.js\r
export interface TextPath extends Parent {\r
- new (): TextPath;\r
+ new(): TextPath;\r
}\r
interface Text {\r
path(d: PathArrayAlias): this;\r
untransform(): this;\r
matrixify(): Matrix;\r
toParent(parent: Parent): this;\r
- toDoc(): this;\r
+ toSvg(): this;\r
}\r
interface Transform {\r
x?: number;\r
scale?: number;\r
}\r
export interface Transformation {\r
- new (...transform: Transform[]): Transformation;\r
- new (source: Transform, inversed?: boolean): 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
+ 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
\r
// use.js\r
export interface Use extends Shape {\r
- new (): Use;\r
+ new(): Use;\r
element(element: Element, file?: string): this;\r
}\r
interface Container {\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
+ 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
toString(): string;\r
morph(source: ViewBoxAlias): ViewBox;\r
morph(x: number, y: number, width: number, height: number): ViewBox;\r
- at(pos:number): ViewBox;\r
+ at(pos: number): ViewBox;\r
}\r
interface Container {\r
viewbox(): ViewBox;\r
during(cb: (pos: number) => void): Animation;\r
to(value: number): Animation;\r
after(cb: () => void): Animation;\r
- \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
+ 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