From f6869aada30aedad51e59382a05c86ded91a28be Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Sun, 1 Sep 2019 21:47:58 +0200 Subject: [PATCH] Updated declarations and fixed generate script --- build_declarations.sh | 2 +- .../imports/.copy_imports_shared.d.ts | 91 ++++++++++++++++++- 2 files changed, 88 insertions(+), 5 deletions(-) diff --git a/build_declarations.sh b/build_declarations.sh index 6d06ac2..1406afa 100755 --- a/build_declarations.sh +++ b/build_declarations.sh @@ -41,7 +41,7 @@ path_target="./modules/renderer/imports" for file in "${files[@]}" do - file_mapping=$(echo ${file_mapping} | tr ";" "\n") + file_mapping=($(echo ${file} | tr ";" "\n")) src_file=${file_mapping[0]} dst_file=${file_mapping[1]} diff --git a/modules/renderer/imports/.copy_imports_shared.d.ts b/modules/renderer/imports/.copy_imports_shared.d.ts index 246e5c7..e537540 100644 --- a/modules/renderer/imports/.copy_imports_shared.d.ts +++ b/modules/renderer/imports/.copy_imports_shared.d.ts @@ -762,10 +762,14 @@ declare namespace transfer { get_key(): DownloadKey; request_file(): Promise; } + export interface UploadTransfer { + get_key(): UploadKey; + put_data(data: BlobPart | File): Promise; + } export type DownloadKey = TransferKey; export type UploadKey = TransferKey; export function spawn_download_transfer(key: DownloadKey): DownloadTransfer; - export function spawn_upload_transfer(key: UploadKey): RequestFileUpload; + export function spawn_upload_transfer(key: UploadKey): UploadTransfer; } declare class RequestFileDownload implements transfer.DownloadTransfer { readonly transfer_key: transfer.DownloadKey; @@ -774,11 +778,12 @@ declare class RequestFileDownload implements transfer.DownloadTransfer { private try_fetch(url: string): Promise; get_key(): transfer.DownloadKey; } -declare class RequestFileUpload { +declare class RequestFileUpload implements transfer.UploadTransfer { readonly transfer_key: transfer.UploadKey; constructor(key: transfer.DownloadKey); - put_data(data: BlobPart | File); - try_put(data: FormData, url: string): Promise; + get_key(): transfer.UploadKey; + put_data(data: BlobPart | File): Promise; + private try_put(data: FormData, url: string): Promise; } declare class FileManager extends connection.AbstractCommandHandler { handle: ConnectionHandler; @@ -2720,6 +2725,83 @@ declare interface JQuery { modalize(entry_callback?: (header: JQuery, body: JQuery, footer: JQuery) => ModalElements | void, properties?: ModalProperties | any): Modal; } +/* File: /home/wolverindev/TeaSpeak/Web-Client/shared/js/ui/elements/net_graph.ts */ +declare namespace net.graph { + export type Entry = { + timestamp: number; + upload: number; + download: number; + }; + export type Style = { + background_color: string; + separator_color: string; + separator_count: number; + separator_width: number; + upload: { + fill: string; + stroke: string; + strike_width: number; + }; + download: { + fill: string; + stroke: string; + strike_width: number; + }; + }; + export type TimeSpan = { + origin: { + begin: number; + end: number; + time: number; + }; + target: { + begin: number; + end: number; + time: number; + }; + }; + /* Great explanation of Bezier curves: http://en.wikipedia.org/wiki/Bezier_curve#Quadratic_curves + * + * Assuming A was the last point in the line plotted and B is the new point, + * we draw a curve with control points P and Q as below. + * + * A---P + * | + * | + * | + * Q---B + * + * Importantly, A and P are at the same y coordinate, as are B and Q. This is + * so adjacent curves appear to flow as one. + */ + export class Graph { + private static _loops: (() => any)[]; + readonly canvas: HTMLCanvasElement; + public style: Style; + private _canvas_context: CanvasRenderingContext2D; + private _entries: Entry[]; + private _entry_max; + private _max_space; + private _max_gap; + private _animate_loop; + private _time_span: TimeSpan; + constructor(canvas: HTMLCanvasElement); + initialize(); + terminate(); + max_gap_size(value?: number): number; + private recalculate_cache(time_span?: boolean); + insert_entry(entry: Entry); + insert_entries(entries: Entry[]); + resize(); + cleanup(); + private calculate_time_span(): { + begin: number; + end: number; + }; + draw(); + } +} + /* File: /home/wolverindev/TeaSpeak/Web-Client/shared/js/ui/elements/slider.ts */ declare interface SliderOptions { min_value?: number; @@ -3106,6 +3188,7 @@ declare namespace chat { constructor(handle: ConnectionHandler); html_tag(): JQuery; info_frame(): InfoFrame; + content_type(): FrameContent; destroy(); private _build_html_tag(); private_conversations(): PrivateConverations;