1
1
type Strings = string [ ] ;
2
2
declare var acode : Acode ;
3
3
4
-
5
4
interface WCPage extends HTMLElement {
6
- on ( event : 'hide' | 'show' , cb : ( this : WCPage ) => void ) : void ;
7
- off ( event : 'hide' | 'show' , cb : ( this : WCPage ) => void ) : void ;
8
-
9
- settitle ( title : string ) : void ;
10
-
11
- id : string ;
12
-
13
- hide ( ) : void ;
14
- show ( ) : void ;
15
-
16
- get body ( ) : HTMLElement | null ;
17
- set body ( $el : HTMLElement | null ) ;
18
-
19
- get innerHTML ( ) : string ;
20
- set innerHTML ( html : string ) ;
21
-
22
- get textContent ( ) : string | null ;
23
- set textContent ( text : string ) ;
24
-
25
- get lead ( ) : HTMLElement ;
26
- set lead ( $el : HTMLElement ) ;
27
-
28
- get header ( ) : HTMLElement ;
29
- set header ( $el : HTMLElement ) ;
30
- }
31
-
32
- interface Input {
33
- id : string ;
34
- required ?: boolean ;
35
- type : string ;
36
- match ?: RegExp ;
37
- value ?: string ;
38
- placeholder ?: string ;
39
- hints ?: string ;
40
- name ?: string ;
41
- disabled ?: boolean ;
42
- readOnly ?: boolean ;
43
- autofocus ?: boolean ;
44
- hidden ?: boolean ;
45
- onclick ?: ( event : Event ) => void ;
46
- onchange ?: ( event : Event ) => void ;
47
- }
48
-
49
-
50
- interface Acode {
51
- /**
52
- * Define a module
53
- * @param {string } name
54
- * @param {Object|function } module
55
- */
56
- define ( name : string , module : any ) : void ;
57
-
58
- require ( module : string ) : any ;
59
-
60
- exec ( key : string , val : any ) : boolean | undefined ;
5
+ on ( event : "hide" | "show" , cb : ( this : WCPage ) => void ) : void ;
6
+ off ( event : "hide" | "show" , cb : ( this : WCPage ) => void ) : void ;
61
7
62
- get exitAppMessage ( ) : string | undefined ;
8
+ settitle ( title : string ) : void ;
63
9
64
- setLoadingMessage ( message : string ) : void ;
10
+ id : string ;
65
11
66
- setPluginInit (
67
- id : string ,
68
- initFunction : ( baseUrl : string , $page : WCPage , options ?: any ) => Promise < void > ,
69
- settings ?: any
70
- ) : void ;
12
+ hide ( ) : void ;
13
+ show ( ) : void ;
71
14
72
- getPluginSettings ( id : string ) : any ;
15
+ get body ( ) : HTMLElement | null ;
16
+ set body ( $el : HTMLElement | null ) ;
73
17
74
- setPluginUnmount ( id : string , unmountFunction : ( ) => void ) : void ;
18
+ get innerHTML ( ) : string ;
19
+ set innerHTML ( html : string ) ;
75
20
76
- /**
77
- * @param {string } id plugin id
78
- * @param {string } baseUrl local plugin url
79
- * @param {WCPage } $page
80
- */
81
- initPlugin ( id : string , baseUrl : string , $page : WCPage , options ?: any ) : Promise < void > ;
21
+ get textContent ( ) : string | null ;
22
+ set textContent ( text : string ) ;
82
23
83
- unmountPlugin ( id : string ) : void ;
24
+ get lead ( ) : HTMLElement ;
25
+ set lead ( $el : HTMLElement ) ;
84
26
85
- registerFormatter ( id : string , extensions : string [ ] , format : ( ) => Promise < void > ) : void ;
86
-
87
- unregisterFormatter ( id : string ) : void ;
88
-
89
- format ( selectIfNull ?: boolean ) : Promise < void > ;
90
-
91
- fsOperation ( file : string ) : any ;
92
-
93
- newEditorFile ( filename : string , options ?: any ) : void ;
94
-
95
- // readonly formatters(): { id: string; name: string; exts: string[] }[];
27
+ get header ( ) : HTMLElement ;
28
+ set header ( $el : HTMLElement ) ;
29
+ }
96
30
97
- /**
98
- * @param {string[] } extensions
99
- * @returns {Array<[id: string, name: string]> } options
100
- */
101
- getFormatterFor ( extensions : string [ ] ) : [ id : string , name : string ] [ ] ;
31
+ interface Input {
32
+ id : string ;
33
+ required ?: boolean ;
34
+ type : string ;
35
+ match ?: RegExp ;
36
+ value ?: string ;
37
+ placeholder ?: string ;
38
+ hints ?: string ;
39
+ name ?: string ;
40
+ disabled ?: boolean ;
41
+ readOnly ?: boolean ;
42
+ autofocus ?: boolean ;
43
+ hidden ?: boolean ;
44
+ onclick ?: ( event : Event ) => void ;
45
+ onchange ?: ( event : Event ) => void ;
46
+ }
102
47
103
- alert ( title : string , message : string , onhide : ( ) => void ) : void ;
104
-
105
- loader ( title : string , message : string , cancel : { timeout : number , callback : ( ) => void } ) : void ;
106
-
107
- joinUrl ( ...args : string [ ] ) : string ;
108
-
109
- addIcon ( className : string , src : string ) : void ;
110
-
111
- prompt (
112
- message : string ,
113
- defaultValue : string ,
114
- type : 'textarea' | 'text' | 'number' | 'tel' | 'search' | 'email' | 'url' ,
115
- options ?: {
116
- match : RegExp ,
117
- required : boolean ,
118
- placeholder : string ,
119
- test : ( value : string ) => boolean
48
+ interface Acode {
49
+ /**
50
+ * Define a module
51
+ * @param {string } name
52
+ * @param {Object|function } module
53
+ */
54
+ define ( name : string , module : Object | Function ) : void ;
55
+
56
+ require ( module : "fsOperation" ) : FsOperation ;
57
+ require ( module : "loader" ) : LoaderDialog ;
58
+ require ( module : "prompt" ) : PromptDialog ;
59
+ require ( module : "alert" ) : AlertDialog ;
60
+ require ( module : "fileBrowser" ) : FileBrowser ;
61
+ require ( module : string ) : any ; // Allow other modules
62
+
63
+ exec ( key : string , val : any ) : boolean | undefined ;
64
+
65
+ get exitAppMessage ( ) : string | undefined ;
66
+
67
+ setLoadingMessage ( message : string ) : void ;
68
+
69
+ setPluginInit (
70
+ id : string ,
71
+ initFunction : (
72
+ baseUrl : string ,
73
+ $page : WCPage ,
74
+ options ?: any
75
+ ) => Promise < void > ,
76
+ settings ?: any
77
+ ) : void ;
78
+
79
+ getPluginSettings ( id : string ) : any ;
80
+
81
+ setPluginUnmount ( id : string , unmountFunction : ( ) => void ) : void ;
82
+
83
+ /**
84
+ * @param {string } id plugin id
85
+ * @param {string } baseUrl local plugin url
86
+ * @param {WCPage } $page
87
+ */
88
+ initPlugin (
89
+ id : string ,
90
+ baseUrl : string ,
91
+ $page : WCPage ,
92
+ options ?: any
93
+ ) : Promise < void > ;
94
+
95
+ unmountPlugin ( id : string ) : void ;
96
+
97
+ registerFormatter (
98
+ id : string ,
99
+ extensions : string [ ] ,
100
+ format : ( ) => Promise < void >
101
+ ) : void ;
102
+
103
+ unregisterFormatter ( id : string ) : void ;
104
+
105
+ format ( selectIfNull ?: boolean ) : Promise < void > ;
106
+
107
+ fsOperation ( file : string ) : any ;
108
+
109
+ newEditorFile ( filename : string , options ?: any ) : void ;
110
+
111
+ // readonly formatters(): { id: string; name: string; exts: string[] }[];
112
+
113
+ /**
114
+ * @param {string[] } extensions
115
+ * @returns {Array<[id: string, name: string]> } options
116
+ */
117
+ getFormatterFor ( extensions : string [ ] ) : [ id : string , name : string ] [ ] ;
118
+
119
+ alert ( title : string , message : string , onhide : ( ) => void ) : void ;
120
+
121
+ loader (
122
+ title : string ,
123
+ message : string ,
124
+ cancel : { timeout : number ; callback : ( ) => void }
125
+ ) : void ;
126
+
127
+ joinUrl ( ...args : string [ ] ) : string ;
128
+
129
+ addIcon ( className : string , src : string ) : void ;
130
+
131
+ prompt (
132
+ message : string ,
133
+ defaultValue : string ,
134
+ type : "textarea" | "text" | "number" | "tel" | "search" | "email" | "url" ,
135
+ options ?: {
136
+ match : RegExp ;
137
+ required : boolean ;
138
+ placeholder : string ;
139
+ test : ( value : string ) => boolean ;
140
+ }
141
+ ) : Promise < any > ;
142
+
143
+ confirm ( title : string , message : string ) : Promise < boolean > ;
144
+
145
+ select (
146
+ title : string ,
147
+ options : [ string , string , string , boolean ] [ ] | string ,
148
+ opts ?:
149
+ | {
150
+ onCancel ?: ( ) => void ;
151
+ onHide ?: ( ) => void ;
152
+ hideOnSelect ?: boolean ;
153
+ textTransform ?: boolean ;
154
+ default ?: string ;
120
155
}
121
- ) : Promise < any > ;
122
-
123
- confirm ( title : string , message : string ) : Promise < boolean > ;
124
-
125
- select (
126
- title : string ,
127
- options : [ string , string , string , boolean ] [ ] | string ,
128
- opts ?: {
129
- onCancel ?: ( ) => void ;
130
- onHide ?: ( ) => void ;
131
- hideOnSelect ?: boolean ;
132
- textTransform ?: boolean ;
133
- default ?: string ;
134
- } | boolean
135
- ) : Promise < any > ;
136
-
137
- multiPrompt ( title : string , inputs : Array < Input | Input [ ] > , help : string ) : Promise < Strings > ;
138
-
139
- fileBrowser ( mode : 'file' | 'folder' | 'both' , info : string , doesOpenLast : boolean ) : Promise <
156
+ | boolean
157
+ ) : Promise < any > ;
158
+
159
+ multiPrompt (
160
+ title : string ,
161
+ inputs : Array < Input | Input [ ] > ,
162
+ help : string
163
+ ) : Promise < Strings > ;
164
+
165
+ fileBrowser (
166
+ mode : "file" | "folder" | "both" ,
167
+ info : string ,
168
+ doesOpenLast : boolean
169
+ ) : Promise <
140
170
| {
141
171
name : string ;
142
- type : ' file' ;
172
+ type : " file" ;
143
173
url : string ;
144
174
}
145
175
| {
@@ -149,16 +179,16 @@ interface Acode {
149
179
isFile : boolean ;
150
180
mime : string ;
151
181
name : string ;
152
- type : ' file' | ' folder' ;
182
+ type : " file" | " folder" ;
153
183
uri : string ;
154
184
url : string ;
155
185
} [ ] ;
156
186
scroll : number ;
157
187
name : string ;
158
- type : ' folder' ;
188
+ type : " folder" ;
159
189
url : string ;
160
190
}
161
- > ;
162
-
163
- toInternalUrl ( url : string ) : Promise < string > ;
191
+ > ;
192
+
193
+ toInternalUrl ( url : string ) : Promise < string > ;
164
194
}
0 commit comments