Skip to content

Commit

Permalink
fix: create typescript declaration files
Browse files Browse the repository at this point in the history
  • Loading branch information
grzhan committed Aug 16, 2016
1 parent 2c98bee commit 4633efd
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 0 deletions.
69 changes: 69 additions & 0 deletions src/Annotator.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/// <reference path="typings/svgjs.d.ts" />
import { EventBase } from './lib/util/EventBase';
export declare enum Categories {
'sign&symptom' = 1,
'diagnosis' = 2,
'assessment' = 3,
'treatment' = 4,
"index" = 5,
"drug" = 6,
"body location" = 7,
"frequency" = 8,
"value" = 9,
"change" = 10,
"modifier" = 11,
"time" = 12,
}
export declare class Annotator extends EventBase {
svg: any;
group: {};
lines: {};
category: {
id: number;
fill: string;
boader: string;
highlight: string;
text: string;
}[];
lcategory: {
id: number;
text: string;
}[];
labelsSVG: any[];
linkable: boolean;
underscorable: boolean;
progress: number;
visible: {
'relation': boolean;
'highlight': boolean;
'label': boolean;
};
private state;
private style;
private puncLen;
private renderPerLines;
private draw;
private raw;
private label_line_map;
private labels;
private background;
private baseTop;
private baseLeft;
private maxWidth;
private selectionCallback;
constructor(container: any, width?: number, height?: number);
private init();
private clear();
import(raw: String, labels: any, relations: any): void;
stringify(): void;
enableSelection(): void;
disableSelection(): void;
setVisiblity(component: string, visible: boolean): void;
exportPNG(scale?: number): void;
resize(width: any, height: any): void;
private render(startAt);
private selectionEventHandler();
private selectionParagraphEventHandler();
private posInLine(x, y);
private requestAnimeFrame(callback);
}
24 changes: 24 additions & 0 deletions src/lib/Draw.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/// <reference path="../typings/svgjs.d.ts" />
export declare class Draw {
private board;
private margin;
private lineHeight;
private shoulder;
private needExtend;
private style_user_select_none;
constructor(board: any);
highlight(selector: any, color?: string): any;
textline(lineNo: any, content: any, left: any, top: any): any;
annotation(id: any, cid: any, selector: any): void;
label(id: any, cid: any, selector: any): void;
relation(srcId: any, dstId: any, text?: string): void;
underscore(paragraph: any): void;
bracket(cid: any, x1: any, y1: any, x2: any, y2: any, width: any, q?: number): any;
private moveLineRight(lineNo, padding);
private extendAnnotationLine(lineNo, type);
private underscoreLine(lineNo, start, end);
private calcAnnotationTop(text, selector);
private calcRelationTop(lineNo, width, height, top, left);
private isCollisionInLine(lineNo, width, height, left, top);
private isCollision(x1, y1, w1, h1, x2, y2, w2, h2);
}
18 changes: 18 additions & 0 deletions src/lib/components/Label.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export declare class Label {
id: any;
category: any;
pos: number[];
lineNo: any;
constructor(id: any, category: any, pos: any);
isTruncate(pos: any): boolean;
}
export declare class LabelContainer {
private labels;
private lineMap;
create(id: any, category: any, pos: any): void;
push(label: Label): void;
get(id: any): any;
readonly length: number;
gen(label: any): any[];
private insert(target);
}
7 changes: 7 additions & 0 deletions src/lib/components/Line.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/// <reference path="../../typings/svgjs.d.ts" />
export declare class Line {
svg: any;
constructor(id: any, width: any, height: any);
group(): void;
extend(lineNo: any): void;
}
11 changes: 11 additions & 0 deletions src/lib/components/Paragraph.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export declare class Paragraph {
startLine: any;
endLine: any;
startOffset: any;
endOffset: any;
startPos: any;
endPos: any;
private context;
constructor(context: any, startLine: any, startOffset: any, endLine: any, endOffset: any);
calcPos(lineNo: any, offset: any): number;
}
8 changes: 8 additions & 0 deletions src/lib/util/EventBase.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export declare class EventBase {
private listeners;
emit(event: string, args?: any): boolean;
on(event: string, listener: (target: EventBase, args?: any) => any): number;
private off(event);
offById(event: string, id: number): void;
offAll(): void;
}
26 changes: 26 additions & 0 deletions src/lib/util/TextSelector.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// <reference path="../../typings/svgjs.d.ts" />
export declare class TextSelector {
static rect(): {
width: number;
height: number;
left: number;
top: number;
};
static lineNo(): number;
static init(): {
startOffset: number;
endOffset: number;
startNode: Node;
endNode: Node;
tspan: SVGTextContentElement;
};
static paragraph(): {
startOffset: number;
endOffset: number;
startLineNo: number;
endLineNo: number;
};
}
export declare class SelectorDummyException extends Error {
constructor(message: any);
}
6 changes: 6 additions & 0 deletions src/lib/util/Util.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export declare class Util {
static height(node: any): any;
static width(node: any): any;
static top(node: any): any;
static left(node: any): any;
}

0 comments on commit 4633efd

Please sign in to comment.