[TASK] Rewrite DragUploader in TypeScript
[Packages/TYPO3.CMS.git] / Build / types / TYPO3 / index.d.ts
1 /* tslint:disable:max-classes-per-file */
2
3 /**
4 * Currently a mixture between namespace and global object
5 * Add types as you use them
6 */
7 declare namespace TYPO3 {
8 export let DebugConsole: any;
9 export let InfoWindow: any;
10 export let Popover: any;
11 export let ShortcutMenu: any;
12 export let Storage: any;
13 export let Utility: any;
14 export const lang: any;
15 export const settings: any;
16 export namespace CMS {
17 export namespace Backend {
18 export class FormEngineValidation {
19 public readonly errorClass: string;
20 }
21 export class FormEngine {
22 public readonly Validation: FormEngineValidation;
23 }
24 export class Modal {
25 public readonly sizes: {[key: string]: string};
26 public readonly styles: {[key: string]: string};
27 public readonly types: {[key: string]: string};
28 public currentModal: JQuery;
29 public advanced(configuration: object): any;
30 public confirm(title: string, content: any, severity: number, buttons: any[], additionalCssClasses?: string[]): JQuery; // tslint:disable-line:max-line-length
31 public show(title: string, content: any, severity: number, buttons: any[], additionalCssClasses?: string[]): JQuery; // tslint:disable-line:max-line-length
32 public dismiss(): void;
33 }
34 export class Notification {
35 public readonly Notification: {
36 NOTICE: -2,
37 INFO: -1,
38 OK: 0,
39 WARNING: 1,
40 ERROR: 2
41 };
42 public notice(title: string, message: string, duration: Number): string;
43 public info(title: string, message: string, duration: Number): string;
44 public success(title: string, message: string, duration: Number): string;
45 public warning(title: string, message: string, duration: Number): string;
46 public error(title: string, message: string, duration: Number): string;
47 public showMessage(title: string, message: string, severity: Number, duration?: Number): string;
48 }
49 export class Severity {
50 public readonly notice: number;
51 public readonly info: number;
52 public readonly ok: number;
53 public readonly warning: number;
54 public readonly: number;
55 public getCssClass(severity: number): string;
56 }
57 }
58 }
59 }
60
61 /**
62 * Current AMD/RequireJS modules are returning *instances* of ad-hoc *classes*, make that known to TypeScript
63 */
64
65 declare module 'TYPO3/CMS/Backend/FormEngineValidation' {
66 export = new TYPO3.CMS.Backend.FormEngineValidation();
67 }
68
69 declare module 'TYPO3/CMS/Backend/FormEngine' {
70 export = new TYPO3.CMS.Backend.FormEngine();
71 }
72
73 declare module 'TYPO3/CMS/Backend/Modal' {
74 export = new TYPO3.CMS.Backend.Modal();
75 }
76
77 declare module 'TYPO3/CMS/Backend/Notification' {
78 export = new TYPO3.CMS.Backend.Notification();
79 }
80
81 declare module 'TYPO3/CMS/Backend/Severity' {
82 export = new TYPO3.CMS.Backend.Severity();
83 }
84
85 // type definition for global namespace object
86 interface Window {
87 TYPO3: any;
88 $: any;
89 inline: {
90 delayedImportElement: (objectId: number, table: string, uid: number, type: string) => void
91 };
92 }
93
94 /**
95 * Needed type declarations for provided libs
96 */
97 declare module 'TYPO3/CMS/Core/Contrib/imagesloaded.pkgd.min' {
98 import * as imagesloaded from 'imagesloaded';
99 export = imagesloaded;
100 }
101
102 declare module 'cm/lib/codemirror';
103 declare module 'moment';
104 declare module 'TYPO3/CMS/Backend/jsfunc.inline';
105
106 /**
107 * Options for the plugin.
108 * TODO fix this
109 */
110 interface DragUploaderOptions {
111 /**
112 * CSS selector for the element where generated messages are inserted. (required)
113 */
114 outputSelector: string;
115 /**
116 * Color of the message text. (optional)
117 */
118 outputColor?: string;
119 }
120
121 interface JQueryTypedEvent<T extends Event> extends JQueryEventObject {
122 originalEvent: T;
123 }
124
125 /**
126 * Required to make jQuery plugins "available" in TypeScript
127 */
128 interface JQuery {
129 clearable(): JQuery;
130 dragUploader(options?: DragUploaderOptions): JQuery;
131 }