[TASK] Migrate Severity to 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 }
50 }
51 }
52
53 /**
54 * Current AMD/RequireJS modules are returning *instances* of ad-hoc *classes*, make that known to TypeScript
55 */
56
57 declare module 'TYPO3/CMS/Backend/FormEngineValidation' {
58 export = new TYPO3.CMS.Backend.FormEngineValidation();
59 }
60
61 declare module 'TYPO3/CMS/Backend/FormEngine' {
62 export = new TYPO3.CMS.Backend.FormEngine();
63 }
64
65 declare module 'TYPO3/CMS/Backend/Modal' {
66 export = new TYPO3.CMS.Backend.Modal();
67 }
68
69 declare module 'TYPO3/CMS/Backend/Notification' {
70 export = new TYPO3.CMS.Backend.Notification();
71 }
72
73 // type definition for global namespace object
74 interface Window {
75 TYPO3: any;
76 $: any;
77 inline: {
78 delayedImportElement: (objectId: number, table: string, uid: number, type: string) => void
79 };
80 }
81
82 /**
83 * Needed type declarations for provided libs
84 */
85 declare module 'TYPO3/CMS/Core/Contrib/imagesloaded.pkgd.min' {
86 import * as imagesloaded from 'imagesloaded';
87 export = imagesloaded;
88 }
89
90 declare module 'cm/lib/codemirror';
91 declare module 'moment';
92 declare module 'TYPO3/CMS/Backend/jsfunc.inline';
93
94 /**
95 * Options for the plugin.
96 * TODO fix this
97 */
98 interface DragUploaderOptions {
99 /**
100 * CSS selector for the element where generated messages are inserted. (required)
101 */
102 outputSelector: string;
103 /**
104 * Color of the message text. (optional)
105 */
106 outputColor?: string;
107 }
108
109 interface JQueryTypedEvent<T extends Event> extends JQueryEventObject {
110 originalEvent: T;
111 }
112
113 /**
114 * Required to make jQuery plugins "available" in TypeScript
115 */
116 interface JQuery {
117 clearable(): JQuery;
118 dragUploader(options?: DragUploaderOptions): JQuery;
119 }