From bd50abd4f87ae51d56e751c7dc7e95bbfc3ab088 Mon Sep 17 00:00:00 2001 From: Chris Moran Date: Tue, 7 Mar 2017 11:09:16 -0500 Subject: [PATCH 1/3] Add constructors to types I added previously. This removes a warning when trying to use these classes while compiling typescript --- jointjs/index.d.ts | 51 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/jointjs/index.d.ts b/jointjs/index.d.ts index c8ef9ae302..8ecb05f3ba 100644 --- a/jointjs/index.d.ts +++ b/jointjs/index.d.ts @@ -511,6 +511,7 @@ declare namespace joint { polyline?: ShapeAttrs; } class Polyline extends Generic { + constructor(attributes?: GenericAttributes, options?: Object); } class Image extends Generic { constructor(attributes?: GenericAttributes, options?: Object); @@ -539,28 +540,40 @@ declare namespace joint { namespace chess { class KingWhite extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } class KingBlack extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } class QueenWhite extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } class QueenBlack extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } class RookWhite extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } class RookBlack extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } class BishopWhite extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } class BishopBlack extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } class KnightWhite extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } class KnightBlack extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } class PawnWhite extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } class PawnBlack extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } } @@ -582,23 +595,28 @@ declare namespace joint { removeInPort(port: string, opt?: any): this; } class Coupled extends Model { + constructor(attributes?: ModelAttributes, options?: Object); } class Atomic extends Model { + constructor(attributes?: ModelAttributes, options?: Object); } class Link extends dia.Link { + constructor(attributes?: LinkAttributes, options?: Object); } } namespace erd { class Entity extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); + constructor(attributes?: GenericAttributes, options?: Object); } class WeakEntity extends Entity { + constructor(attributes?: GenericAttributes, options?: Object); } class Relationship extends dia.Element { constructor(attributes?: GenericAttributes, options?: Object); } class IdentifyingRelationship extends Relationship { + constructor(attributes?: GenericAttributes, options?: Object); } interface AttributeAttrs extends dia.TextAttrs { ellipse?: ShapeAttrs; @@ -607,12 +625,16 @@ declare namespace joint { constructor(attributes?: GenericAttributes, options?: Object); } class Multivalued extends Attribute { + constructor(attributes?: GenericAttributes, options?: Object); } class Derived extends Attribute { + constructor(attributes?: GenericAttributes, options?: Object); } class Key extends Attribute { + constructor(attributes?: GenericAttributes, options?: Object); } class Normal extends Attribute { + constructor(attributes?: GenericAttributes, options?: Object); } interface ISAAttrs extends dia.Element { polygon?: ShapeAttrs; @@ -621,19 +643,23 @@ declare namespace joint { constructor(attributes?: GenericAttributes, options?: Object); } class Line extends dia.Link { + constructor(attributes?: LinkAttributes, options?: Object); cardinality(value: string | number): void; } } namespace fsa { class State extends basic.Circle { + constructor(attributes?: GenericAttributes, options?: Object); } class StartState extends dia.Element { constructor(attributes?: GenericAttributes, options?: Object); } class EndState extends dia.Element { + constructor(attributes?: GenericAttributes, options?: Object); } class Arrow extends dia.Link { + constructor(attributes?: LinkAttributes, options?: Object); } } @@ -655,14 +681,19 @@ declare namespace joint { constructor(attributes?: GenericAttributes, options?: Object); } class IO extends Gate { + constructor(attributes?: GenericAttributes, options?: Object); } class Input extends IO { + constructor(attributes?: GenericAttributes, options?: Object); } class Output extends IO { + constructor(attributes?: GenericAttributes, options?: Object); } class Gate11 extends Gate { + constructor(attributes?: GenericAttributes, options?: Object); } class Gate21 extends Gate { + constructor(attributes?: GenericAttributes, options?: Object); } interface Image { 'xlink:href'?: string; @@ -720,11 +751,13 @@ declare namespace joint { constructor(attributes?: GenericAttributes, options?: Object); } class Arrow extends dia.Link { + constructor(attributes?: LinkAttributes, options?: Object); } } namespace pn { class Place extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } class PlaceView extends dia.ElementView { renderTokens(): void; @@ -733,6 +766,7 @@ declare namespace joint { constructor(attributes?: GenericAttributes, options?: Object); } class Link extends dia.Link { + constructor(attributes?: LinkAttributes, options?: Object); } } @@ -750,36 +784,49 @@ declare namespace joint { class ClassView extends dia.ElementView { } class Abstract extends Class { + constructor(attributes?: ClassAttributes, options?: Object); } class AbstractView extends ClassView { + constructor(attributes?: ClassAttributes, options?: Object); } class Interface extends Class { + constructor(attributes?: ClassAttributes, options?: Object); } class InterfaceView extends ClassView { + constructor(attributes?: ClassAttributes, options?: Object); } class Generalization extends dia.Link { + constructor(attributes?: LinkAttributes, options?: Object); } class Implementation extends dia.Link { + constructor(attributes?: LinkAttributes, options?: Object); } class Aggregation extends dia.Link { + constructor(attributes?: LinkAttributes, options?: Object); } class Composition extends dia.Link { + constructor(attributes?: LinkAttributes, options?: Object); } class Association extends dia.Link { + constructor(attributes?: LinkAttributes, options?: Object); } interface StateAttributes extends GenericAttributes { events?: string[]; } class State extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); updateName(): void; updateEvents(): void; updatePath(): void; } class StartState extends basic.Circle { + constructor(attributes?: GenericAttributes, options?: Object); } class EndState extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } class Transition extends dia.Link { + constructor(attributes?: LinkAttributes, options?: Object); } } } @@ -833,7 +880,7 @@ declare namespace joint { setLinkVertices?: (link: dia.Link, vertices: Position[]) => void; } - class DirectedGraph { + export class DirectedGraph { static layout(graph: dia.Graph | dia.Cell[], options?: LayoutOptions): dia.BBox; } } From 93cdf199a536ef8032eaee9d6161c4ff653576ac Mon Sep 17 00:00:00 2001 From: Chris Moran Date: Tue, 7 Mar 2017 11:15:52 -0500 Subject: [PATCH 2/3] Add namespace prefix to LinkAttributes --- jointjs/index.d.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/jointjs/index.d.ts b/jointjs/index.d.ts index 8ecb05f3ba..e8c9e8b53e 100644 --- a/jointjs/index.d.ts +++ b/jointjs/index.d.ts @@ -601,7 +601,7 @@ declare namespace joint { constructor(attributes?: ModelAttributes, options?: Object); } class Link extends dia.Link { - constructor(attributes?: LinkAttributes, options?: Object); + constructor(attributes?: dia.LinkAttributes, options?: Object); } } @@ -643,7 +643,7 @@ declare namespace joint { constructor(attributes?: GenericAttributes, options?: Object); } class Line extends dia.Link { - constructor(attributes?: LinkAttributes, options?: Object); + constructor(attributes?: dia.LinkAttributes, options?: Object); cardinality(value: string | number): void; } } @@ -659,7 +659,7 @@ declare namespace joint { constructor(attributes?: GenericAttributes, options?: Object); } class Arrow extends dia.Link { - constructor(attributes?: LinkAttributes, options?: Object); + constructor(attributes?: dia.LinkAttributes, options?: Object); } } @@ -751,7 +751,7 @@ declare namespace joint { constructor(attributes?: GenericAttributes, options?: Object); } class Arrow extends dia.Link { - constructor(attributes?: LinkAttributes, options?: Object); + constructor(attributes?: dia.LinkAttributes, options?: Object); } } @@ -766,7 +766,7 @@ declare namespace joint { constructor(attributes?: GenericAttributes, options?: Object); } class Link extends dia.Link { - constructor(attributes?: LinkAttributes, options?: Object); + constructor(attributes?: dia.LinkAttributes, options?: Object); } } @@ -796,19 +796,19 @@ declare namespace joint { constructor(attributes?: ClassAttributes, options?: Object); } class Generalization extends dia.Link { - constructor(attributes?: LinkAttributes, options?: Object); + constructor(attributes?: dia.LinkAttributes, options?: Object); } class Implementation extends dia.Link { - constructor(attributes?: LinkAttributes, options?: Object); + constructor(attributes?: dia.LinkAttributes, options?: Object); } class Aggregation extends dia.Link { - constructor(attributes?: LinkAttributes, options?: Object); + constructor(attributes?: dia.LinkAttributes, options?: Object); } class Composition extends dia.Link { - constructor(attributes?: LinkAttributes, options?: Object); + constructor(attributes?: dia.LinkAttributes, options?: Object); } class Association extends dia.Link { - constructor(attributes?: LinkAttributes, options?: Object); + constructor(attributes?: dia.LinkAttributes, options?: Object); } interface StateAttributes extends GenericAttributes { events?: string[]; @@ -826,7 +826,7 @@ declare namespace joint { constructor(attributes?: GenericAttributes, options?: Object); } class Transition extends dia.Link { - constructor(attributes?: LinkAttributes, options?: Object); + constructor(attributes?: dia.LinkAttributes, options?: Object); } } } From b77325fd0c234f1a571e95c2dd6cc3cfb4942a3a Mon Sep 17 00:00:00 2001 From: Chris Moran Date: Tue, 7 Mar 2017 16:57:46 -0500 Subject: [PATCH 3/3] Add some missing methods to Element class --- jointjs/index.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jointjs/index.d.ts b/jointjs/index.d.ts index e8c9e8b53e..95e2b2b7e3 100644 --- a/jointjs/index.d.ts +++ b/jointjs/index.d.ts @@ -156,6 +156,15 @@ declare namespace joint { findView(paper: Paper): ElementView; isElement(): boolean; scale(scaleX: number, scaleY: number, origin?: Point, options?: any): this; + addPort(port: any, opt?: any): this; + addPorts(ports: any[], opt?: any): this; + removePort(port: any, opt?: any): this; + hasPorts(): boolean; + hasPort(id: string): boolean; + getPorts(): any[]; + getPort(id: string): any; + getPortIndex(port: any): number; + portProp(portId: string, path: any, value?: any, opt?: any): joint.dia.Element; } interface CSSSelector {