x4js 1.4.3 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +55 -0
- package/lib/index.js +55 -56
- package/lib/router.d.ts +1 -8
- package/lib/router.js +1 -1
- package/package.json +2 -1
- package/src/index.ts +55 -0
- package/src/router.ts +1 -1
- package/tsconfig.json +2 -1
- package/lib/application.d.ts +0 -95
- package/lib/application.js +0 -137
- package/lib/base64.d.ts +0 -31
- package/lib/base64.js +0 -135
- package/lib/base_component.d.ts +0 -64
- package/lib/base_component.js +0 -77
- package/lib/button.d.ts +0 -145
- package/lib/button.js +0 -235
- package/lib/calendar.d.ts +0 -77
- package/lib/calendar.js +0 -236
- package/lib/canvas.d.ts +0 -88
- package/lib/canvas.js +0 -354
- package/lib/cardview.d.ts +0 -83
- package/lib/cardview.js +0 -152
- package/lib/checkbox.d.ts +0 -72
- package/lib/checkbox.js +0 -126
- package/lib/color.d.ts +0 -144
- package/lib/color.js +0 -584
- package/lib/component.d.ts +0 -572
- package/lib/component.js +0 -1712
- package/lib/dom_events.d.ts +0 -284
- package/lib/dom_events.js +0 -13
- package/lib/hosts/host.d.ts +0 -44
- package/lib/hosts/host.js +0 -69
- package/lib/i18n.d.ts +0 -67
- package/lib/i18n.js +0 -169
- package/lib/icon.d.ts +0 -56
- package/lib/icon.js +0 -173
- package/lib/input.d.ts +0 -86
- package/lib/input.js +0 -172
- package/lib/label.d.ts +0 -54
- package/lib/label.js +0 -86
- package/lib/layout.d.ts +0 -77
- package/lib/layout.js +0 -261
- package/lib/list.txt +0 -56
- package/lib/menu.d.ts +0 -122
- package/lib/menu.js +0 -276
- package/lib/popup.d.ts +0 -71
- package/lib/popup.js +0 -373
- package/lib/settings.d.ts +0 -33
- package/lib/settings.js +0 -63
- package/lib/styles.d.ts +0 -81
- package/lib/styles.js +0 -262
- package/lib/tools.d.ts +0 -382
- package/lib/tools.js +0 -1096
- package/lib/x4_events.d.ts +0 -253
- package/lib/x4_events.js +0 -363
- package/list.txt +0 -0
package/lib/dom_events.d.ts
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ___ ___ __
|
|
3
|
-
* \ \/ / / _
|
|
4
|
-
* \ / /_| |_
|
|
5
|
-
* / \____ _|
|
|
6
|
-
* /__/\__\ |_|
|
|
7
|
-
*
|
|
8
|
-
* @file dom_events.ts
|
|
9
|
-
* @author Etienne Cochard
|
|
10
|
-
* @copyright (c) 2022 R-libre ingenierie, all rights reserved.
|
|
11
|
-
*
|
|
12
|
-
**/
|
|
13
|
-
export interface X4ElementEventMap extends HTMLElementEventMap {
|
|
14
|
-
"sizechange": Event;
|
|
15
|
-
"create": Event;
|
|
16
|
-
}
|
|
17
|
-
export interface IDOMEvents {
|
|
18
|
-
/**
|
|
19
|
-
* Fires when the user aborts the download.
|
|
20
|
-
* @param ev The event.
|
|
21
|
-
*/
|
|
22
|
-
abort?: (ev: UIEvent) => any;
|
|
23
|
-
animationcancel?: (ev: AnimationEvent) => any;
|
|
24
|
-
animationend?: (ev: AnimationEvent) => any;
|
|
25
|
-
animationiteration?: (ev: AnimationEvent) => any;
|
|
26
|
-
animationstart?: (ev: AnimationEvent) => any;
|
|
27
|
-
auxclick?: (ev: MouseEvent) => any;
|
|
28
|
-
/**
|
|
29
|
-
* Fires when the object loses the input focus.
|
|
30
|
-
* @param ev The focus event.
|
|
31
|
-
*/
|
|
32
|
-
blur?: (ev: FocusEvent) => any;
|
|
33
|
-
cancel?: (ev: Event) => any;
|
|
34
|
-
/**
|
|
35
|
-
* Occurs when playback is possible, but would require further buffering.
|
|
36
|
-
* @param ev The event.
|
|
37
|
-
*/
|
|
38
|
-
canplay?: (ev: Event) => any;
|
|
39
|
-
canplaythrough?: (ev: Event) => any;
|
|
40
|
-
/**
|
|
41
|
-
* Fires when the contents of the object or selection have changed.
|
|
42
|
-
* @param ev The event.
|
|
43
|
-
*/
|
|
44
|
-
change?: (ev: Event) => any;
|
|
45
|
-
/**
|
|
46
|
-
* Fires when the user clicks the left mouse button on the object
|
|
47
|
-
* @param ev The mouse event.
|
|
48
|
-
*/
|
|
49
|
-
click?: (ev: MouseEvent) => any;
|
|
50
|
-
close?: (ev: Event) => any;
|
|
51
|
-
/**
|
|
52
|
-
* Fires when the user clicks the right mouse button in the client area, opening the context menu.
|
|
53
|
-
* @param ev The mouse event.
|
|
54
|
-
*/
|
|
55
|
-
contextmenu?: (ev: MouseEvent) => any;
|
|
56
|
-
cuechange?: (ev: Event) => any;
|
|
57
|
-
/**
|
|
58
|
-
* Fires when the user double-clicks the object.
|
|
59
|
-
* @param ev The mouse event.
|
|
60
|
-
*/
|
|
61
|
-
dblclick?: (ev: MouseEvent) => any;
|
|
62
|
-
/**
|
|
63
|
-
* Fires on the source object continuously during a drag operation.
|
|
64
|
-
* @param ev The event.
|
|
65
|
-
*/
|
|
66
|
-
drag?: (ev: DragEvent) => any;
|
|
67
|
-
/**
|
|
68
|
-
* Fires on the source object when the user releases the mouse at the close of a drag operation.
|
|
69
|
-
* @param ev The event.
|
|
70
|
-
*/
|
|
71
|
-
dragend?: (ev: DragEvent) => any;
|
|
72
|
-
/**
|
|
73
|
-
* Fires on the target element when the user drags the object to a valid drop target.
|
|
74
|
-
* @param ev The drag event.
|
|
75
|
-
*/
|
|
76
|
-
dragenter?: (ev: DragEvent) => any;
|
|
77
|
-
dragexit?: (ev: Event) => any;
|
|
78
|
-
/**
|
|
79
|
-
* Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation.
|
|
80
|
-
* @param ev The drag event.
|
|
81
|
-
*/
|
|
82
|
-
dragleave?: (ev: DragEvent) => any;
|
|
83
|
-
/**
|
|
84
|
-
* Fires on the target element continuously while the user drags the object over a valid drop target.
|
|
85
|
-
* @param ev The event.
|
|
86
|
-
*/
|
|
87
|
-
dragover?: (ev: DragEvent) => any;
|
|
88
|
-
/**
|
|
89
|
-
* Fires on the source object when the user starts to drag a text selection or selected object.
|
|
90
|
-
* @param ev The event.
|
|
91
|
-
*/
|
|
92
|
-
dragstart?: (ev: DragEvent) => any;
|
|
93
|
-
drop?: (ev: DragEvent) => any;
|
|
94
|
-
/**
|
|
95
|
-
* Occurs when the duration attribute is updated.
|
|
96
|
-
* @param ev The event.
|
|
97
|
-
*/
|
|
98
|
-
durationchange?: (ev: Event) => any;
|
|
99
|
-
/**
|
|
100
|
-
* Occurs when the media element is reset to its initial state.
|
|
101
|
-
* @param ev The event.
|
|
102
|
-
*/
|
|
103
|
-
emptied?: (ev: Event) => any;
|
|
104
|
-
/**
|
|
105
|
-
* Occurs when the end of playback is reached.
|
|
106
|
-
* @param ev The event
|
|
107
|
-
*/
|
|
108
|
-
ended?: (ev: Event) => any;
|
|
109
|
-
/**
|
|
110
|
-
* Fires when an error occurs during object loading.
|
|
111
|
-
* @param ev The event.
|
|
112
|
-
*/
|
|
113
|
-
error?: OnErrorEventHandler;
|
|
114
|
-
/**
|
|
115
|
-
* Fires when the object receives focus.
|
|
116
|
-
* @param ev The event.
|
|
117
|
-
*/
|
|
118
|
-
focus?: (ev: FocusEvent) => any;
|
|
119
|
-
gotpointercapture?: (ev: PointerEvent) => any;
|
|
120
|
-
input?: (ev: Event) => any;
|
|
121
|
-
invalid?: (ev: Event) => any;
|
|
122
|
-
/**
|
|
123
|
-
* Fires when the user presses a key.
|
|
124
|
-
* @param ev The keyboard event
|
|
125
|
-
*/
|
|
126
|
-
keydown?: (ev: KeyboardEvent) => any;
|
|
127
|
-
/**
|
|
128
|
-
* Fires when the user presses an alphanumeric key.
|
|
129
|
-
* @param ev The event.
|
|
130
|
-
*/
|
|
131
|
-
keypress?: (ev: KeyboardEvent) => any;
|
|
132
|
-
/**
|
|
133
|
-
* Fires when the user releases a key.
|
|
134
|
-
* @param ev The keyboard event
|
|
135
|
-
*/
|
|
136
|
-
keyup?: (ev: KeyboardEvent) => any;
|
|
137
|
-
/**
|
|
138
|
-
* Fires immediately after the browser loads the object.
|
|
139
|
-
* @param ev The event.
|
|
140
|
-
*/
|
|
141
|
-
load?: (ev: Event) => any;
|
|
142
|
-
/**
|
|
143
|
-
* Occurs when media data is loaded at the current playback position.
|
|
144
|
-
* @param ev The event.
|
|
145
|
-
*/
|
|
146
|
-
loadeddata?: (ev: Event) => any;
|
|
147
|
-
/**
|
|
148
|
-
* Occurs when the duration and dimensions of the media have been determined.
|
|
149
|
-
* @param ev The event.
|
|
150
|
-
*/
|
|
151
|
-
loadedmetadata?: (ev: Event) => any;
|
|
152
|
-
/**
|
|
153
|
-
* Occurs when Internet Explorer begins looking for media data.
|
|
154
|
-
* @param ev The event.
|
|
155
|
-
*/
|
|
156
|
-
loadstart?: (ev: Event) => any;
|
|
157
|
-
lostpointercapture?: (ev: PointerEvent) => any;
|
|
158
|
-
/**
|
|
159
|
-
* Fires when the user clicks the object with either mouse button.
|
|
160
|
-
* @param ev The mouse event.
|
|
161
|
-
*/
|
|
162
|
-
mousedown?: (ev: MouseEvent) => any;
|
|
163
|
-
mouseenter?: (ev: MouseEvent) => any;
|
|
164
|
-
mouseleave?: (ev: MouseEvent) => any;
|
|
165
|
-
/**
|
|
166
|
-
* Fires when the user moves the mouse over the object.
|
|
167
|
-
* @param ev The mouse event.
|
|
168
|
-
*/
|
|
169
|
-
mousemove?: (ev: MouseEvent) => any;
|
|
170
|
-
/**
|
|
171
|
-
* Fires when the user moves the mouse pointer outside the boundaries of the object.
|
|
172
|
-
* @param ev The mouse event.
|
|
173
|
-
*/
|
|
174
|
-
mouseout?: (ev: MouseEvent) => any;
|
|
175
|
-
/**
|
|
176
|
-
* Fires when the user moves the mouse pointer into the object.
|
|
177
|
-
* @param ev The mouse event.
|
|
178
|
-
*/
|
|
179
|
-
mouseover?: (ev: MouseEvent) => any;
|
|
180
|
-
/**
|
|
181
|
-
* Fires when the user releases a mouse button while the mouse is over the object.
|
|
182
|
-
* @param ev The mouse event.
|
|
183
|
-
*/
|
|
184
|
-
mouseup?: (ev: MouseEvent) => any;
|
|
185
|
-
/**
|
|
186
|
-
* Occurs when playback is paused.
|
|
187
|
-
* @param ev The event.
|
|
188
|
-
*/
|
|
189
|
-
pause?: (ev: Event) => any;
|
|
190
|
-
/**
|
|
191
|
-
* Occurs when the play method is requested.
|
|
192
|
-
* @param ev The event.
|
|
193
|
-
*/
|
|
194
|
-
play?: (ev: Event) => any;
|
|
195
|
-
/**
|
|
196
|
-
* Occurs when the audio or video has started playing.
|
|
197
|
-
* @param ev The event.
|
|
198
|
-
*/
|
|
199
|
-
playing?: (ev: Event) => any;
|
|
200
|
-
pointercancel?: (ev: PointerEvent) => any;
|
|
201
|
-
pointerdown?: (ev: PointerEvent) => any;
|
|
202
|
-
pointerenter?: (ev: PointerEvent) => any;
|
|
203
|
-
pointerleave?: (ev: PointerEvent) => any;
|
|
204
|
-
pointermove?: (ev: PointerEvent) => any;
|
|
205
|
-
pointerout?: (ev: PointerEvent) => any;
|
|
206
|
-
pointerover?: (ev: PointerEvent) => any;
|
|
207
|
-
pointerup?: (ev: PointerEvent) => any;
|
|
208
|
-
/**
|
|
209
|
-
* Occurs to indicate progress while downloading media data.
|
|
210
|
-
* @param ev The event.
|
|
211
|
-
*/
|
|
212
|
-
progress?: (ev: ProgressEvent) => any;
|
|
213
|
-
/**
|
|
214
|
-
* Occurs when the playback rate is increased or decreased.
|
|
215
|
-
* @param ev The event.
|
|
216
|
-
*/
|
|
217
|
-
ratechange?: (ev: Event) => any;
|
|
218
|
-
/**
|
|
219
|
-
* Fires when the user resets a form.
|
|
220
|
-
* @param ev The event.
|
|
221
|
-
*/
|
|
222
|
-
reset?: (ev: Event) => any;
|
|
223
|
-
/**
|
|
224
|
-
* Fires when the user repositions the scroll box in the scroll bar on the object.
|
|
225
|
-
* @param ev The event.
|
|
226
|
-
*/
|
|
227
|
-
scroll?: (ev: Event) => any;
|
|
228
|
-
securitypolicyviolation?: (ev: SecurityPolicyViolationEvent) => any;
|
|
229
|
-
/**
|
|
230
|
-
* Occurs when the seek operation ends.
|
|
231
|
-
* @param ev The event.
|
|
232
|
-
*/
|
|
233
|
-
seeked?: (ev: Event) => any;
|
|
234
|
-
/**
|
|
235
|
-
* Occurs when the current playback position is moved.
|
|
236
|
-
* @param ev The event.
|
|
237
|
-
*/
|
|
238
|
-
seeking?: (ev: Event) => any;
|
|
239
|
-
/**
|
|
240
|
-
* Fires when the current selection changes.
|
|
241
|
-
* @param ev The event.
|
|
242
|
-
*/
|
|
243
|
-
select?: (ev: Event) => any;
|
|
244
|
-
selectionchange?: (ev: Event) => any;
|
|
245
|
-
selectstart?: (ev: Event) => any;
|
|
246
|
-
/**
|
|
247
|
-
* Occurs when the download has stopped.
|
|
248
|
-
* @param ev The event.
|
|
249
|
-
*/
|
|
250
|
-
stalled?: (ev: Event) => any;
|
|
251
|
-
submit?: (ev: Event) => any;
|
|
252
|
-
/**
|
|
253
|
-
* Occurs if the load operation has been intentionally halted.
|
|
254
|
-
* @param ev The event.
|
|
255
|
-
*/
|
|
256
|
-
suspend?: (ev: Event) => any;
|
|
257
|
-
/**
|
|
258
|
-
* Occurs to indicate the current playback position.
|
|
259
|
-
* @param ev The event.
|
|
260
|
-
*/
|
|
261
|
-
timeupdate?: (ev: Event) => any;
|
|
262
|
-
toggle?: (ev: Event) => any;
|
|
263
|
-
ontouchcancel?: (ev: TouchEvent) => any;
|
|
264
|
-
ontouchend?: (ev: TouchEvent) => any;
|
|
265
|
-
ontouchmove?: (ev: TouchEvent) => any;
|
|
266
|
-
ontouchstart?: (ev: TouchEvent) => any;
|
|
267
|
-
transitioncancel?: (ev: TransitionEvent) => any;
|
|
268
|
-
transitionend?: (ev: TransitionEvent) => any;
|
|
269
|
-
transitionrun?: (ev: TransitionEvent) => any;
|
|
270
|
-
transitionstart?: (ev: TransitionEvent) => any;
|
|
271
|
-
/**
|
|
272
|
-
* Occurs when the volume is changed, or playback is muted or unmuted.
|
|
273
|
-
* @param ev The event.
|
|
274
|
-
*/
|
|
275
|
-
volumechange?: (ev: Event) => any;
|
|
276
|
-
/**
|
|
277
|
-
* Occurs when playback stops because the next frame of a video resource is not available.
|
|
278
|
-
* @param ev The event.
|
|
279
|
-
*/
|
|
280
|
-
waiting?: (ev: Event) => any;
|
|
281
|
-
wheel?: (ev: WheelEvent) => any;
|
|
282
|
-
sizechange?: (ev: Event) => void;
|
|
283
|
-
create?: (ev: Event) => void;
|
|
284
|
-
}
|
package/lib/dom_events.js
DELETED
package/lib/hosts/host.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file host.ts
|
|
3
|
-
* @author Etienne Cochard
|
|
4
|
-
* @license
|
|
5
|
-
* Copyright (c) 2019-2021 R-libre ingenierie
|
|
6
|
-
*
|
|
7
|
-
* This program is free software; you can redistribute it and/or modify
|
|
8
|
-
* it under the terms of the GNU General Public License as published by
|
|
9
|
-
* the Free Software Foundation; either version 3 of the License, or
|
|
10
|
-
* (at your option) any later version.
|
|
11
|
-
*
|
|
12
|
-
* This program is distributed in the hope that it will be useful,
|
|
13
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
* GNU General Public License for more details.
|
|
16
|
-
*
|
|
17
|
-
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
-
**/
|
|
19
|
-
export interface FileStat {
|
|
20
|
-
atime: number;
|
|
21
|
-
isDir: boolean;
|
|
22
|
-
}
|
|
23
|
-
export declare type PathType = 'home' | 'appData' | 'userData' | 'cache' | 'temp' | 'exe' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'crashDumps';
|
|
24
|
-
export declare type PartType = 'filename' | 'extname' | 'basename' | 'dirname';
|
|
25
|
-
export declare abstract class Host {
|
|
26
|
-
constructor();
|
|
27
|
-
makePath(...els: string[]): string;
|
|
28
|
-
readBinary(path: string): Promise<Uint8Array>;
|
|
29
|
-
writeBinary(path: string, data: Uint8Array): Promise<boolean>;
|
|
30
|
-
readUtf8(path: string): Promise<string>;
|
|
31
|
-
writeUtf8(path: string, data: string): Promise<boolean>;
|
|
32
|
-
compress(data: Uint8Array): Promise<Uint8Array>;
|
|
33
|
-
decompress(data: Uint8Array): Promise<Uint8Array>;
|
|
34
|
-
readLocalStorage(name: string): string;
|
|
35
|
-
writeLocalStorage(name: string, data: string): void;
|
|
36
|
-
stat(name: string): FileStat;
|
|
37
|
-
readDir(path: string): Promise<string[]>;
|
|
38
|
-
require(name: string): any;
|
|
39
|
-
cwd(): string;
|
|
40
|
-
getPath(type: PathType): string;
|
|
41
|
-
getPathPart(path: string, type: PartType): string;
|
|
42
|
-
abstract createCanvas(): any;
|
|
43
|
-
}
|
|
44
|
-
export declare let host: Host;
|
package/lib/hosts/host.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file host.ts
|
|
3
|
-
* @author Etienne Cochard
|
|
4
|
-
* @license
|
|
5
|
-
* Copyright (c) 2019-2021 R-libre ingenierie
|
|
6
|
-
*
|
|
7
|
-
* This program is free software; you can redistribute it and/or modify
|
|
8
|
-
* it under the terms of the GNU General Public License as published by
|
|
9
|
-
* the Free Software Foundation; either version 3 of the License, or
|
|
10
|
-
* (at your option) any later version.
|
|
11
|
-
*
|
|
12
|
-
* This program is distributed in the hope that it will be useful,
|
|
13
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
* GNU General Public License for more details.
|
|
16
|
-
*
|
|
17
|
-
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
-
**/
|
|
19
|
-
export class Host {
|
|
20
|
-
constructor() {
|
|
21
|
-
host = this;
|
|
22
|
-
}
|
|
23
|
-
makePath(...els) {
|
|
24
|
-
return els.join('/');
|
|
25
|
-
}
|
|
26
|
-
readBinary(path) {
|
|
27
|
-
return Promise.reject('not imp');
|
|
28
|
-
}
|
|
29
|
-
writeBinary(path, data) {
|
|
30
|
-
return Promise.reject('not imp');
|
|
31
|
-
}
|
|
32
|
-
readUtf8(path) {
|
|
33
|
-
return Promise.reject('not imp');
|
|
34
|
-
}
|
|
35
|
-
writeUtf8(path, data) {
|
|
36
|
-
return Promise.reject('not imp');
|
|
37
|
-
}
|
|
38
|
-
compress(data) {
|
|
39
|
-
return Promise.reject('not imp');
|
|
40
|
-
}
|
|
41
|
-
decompress(data) {
|
|
42
|
-
return Promise.reject('not imp');
|
|
43
|
-
}
|
|
44
|
-
readLocalStorage(name) {
|
|
45
|
-
return localStorage.getItem(name);
|
|
46
|
-
}
|
|
47
|
-
writeLocalStorage(name, data) {
|
|
48
|
-
localStorage.setItem(name, data);
|
|
49
|
-
}
|
|
50
|
-
stat(name) {
|
|
51
|
-
throw 'not imp';
|
|
52
|
-
}
|
|
53
|
-
readDir(path) {
|
|
54
|
-
throw 'not imp';
|
|
55
|
-
}
|
|
56
|
-
require(name) {
|
|
57
|
-
throw 'not imp';
|
|
58
|
-
}
|
|
59
|
-
cwd() {
|
|
60
|
-
throw 'not imp';
|
|
61
|
-
}
|
|
62
|
-
getPath(type) {
|
|
63
|
-
throw 'not imp';
|
|
64
|
-
}
|
|
65
|
-
getPathPart(path, type) {
|
|
66
|
-
throw 'not imp';
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export let host = null;
|
package/lib/i18n.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ___ ___ __
|
|
3
|
-
* \ \/ / / _
|
|
4
|
-
* \ / /_| |_
|
|
5
|
-
* / \____ _|
|
|
6
|
-
* /__/\__\ |_|
|
|
7
|
-
*
|
|
8
|
-
* @file i18n.ts
|
|
9
|
-
* @author Etienne Cochard
|
|
10
|
-
* @license
|
|
11
|
-
* Copyright (c) 2019-2021 R-libre ingenierie
|
|
12
|
-
*
|
|
13
|
-
* This program is free software; you can redistribute it and/or modify
|
|
14
|
-
* it under the terms of the GNU General Public License as published by
|
|
15
|
-
* the Free Software Foundation; either version 3 of the License, or
|
|
16
|
-
* (at your option) any later version.
|
|
17
|
-
*
|
|
18
|
-
* This program is distributed in the hope that it will be useful,
|
|
19
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21
|
-
* GNU General Public License for more details.
|
|
22
|
-
*
|
|
23
|
-
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
24
|
-
**/
|
|
25
|
-
/**
|
|
26
|
-
* current language
|
|
27
|
-
* FR by default
|
|
28
|
-
* @example ```typescript
|
|
29
|
-
* console.log( _tr.global.ok );
|
|
30
|
-
*/
|
|
31
|
-
export declare let _tr: any;
|
|
32
|
-
/**
|
|
33
|
-
* check if the language is known
|
|
34
|
-
* @param name - language name to test
|
|
35
|
-
* @example ```typescript
|
|
36
|
-
* if( isLanguage('fr') ) {
|
|
37
|
-
* }
|
|
38
|
-
*/
|
|
39
|
-
export declare function isLanguage(name: any): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* select the current language
|
|
42
|
-
* @param name - language name
|
|
43
|
-
* @example ```typescript
|
|
44
|
-
* selectLanguage( 'en' );
|
|
45
|
-
*/
|
|
46
|
-
export declare function selectLanguage(name: any): void;
|
|
47
|
-
/**
|
|
48
|
-
* define a translation
|
|
49
|
-
* you can also patch 'global' elements witch are defined by x4
|
|
50
|
-
* @param name - language name
|
|
51
|
-
* @param definition - definition of the language
|
|
52
|
-
* @example ```typescript
|
|
53
|
-
* setTranslation( 'fr', {
|
|
54
|
-
* this_is_an_example: 'ceci est un exemple',
|
|
55
|
-
* this_is: {
|
|
56
|
-
* another_example: 'ceci est un autre exemple'
|
|
57
|
-
* },
|
|
58
|
-
* global: {
|
|
59
|
-
* ok: 'O.K.'
|
|
60
|
-
* }
|
|
61
|
-
* });
|
|
62
|
-
* console.log( _tr.this_is_an_example ); // defined by the previous line
|
|
63
|
-
* selectLanguage( 'en' );
|
|
64
|
-
* console.log( _tr.this_is_an_example ); // 'en' do not define this, so we get 'fr' one
|
|
65
|
-
*
|
|
66
|
-
*/
|
|
67
|
-
export declare function extendTranslation(name: any, definition: any): void;
|
package/lib/i18n.js
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ___ ___ __
|
|
3
|
-
* \ \/ / / _
|
|
4
|
-
* \ / /_| |_
|
|
5
|
-
* / \____ _|
|
|
6
|
-
* /__/\__\ |_|
|
|
7
|
-
*
|
|
8
|
-
* @file i18n.ts
|
|
9
|
-
* @author Etienne Cochard
|
|
10
|
-
* @license
|
|
11
|
-
* Copyright (c) 2019-2021 R-libre ingenierie
|
|
12
|
-
*
|
|
13
|
-
* This program is free software; you can redistribute it and/or modify
|
|
14
|
-
* it under the terms of the GNU General Public License as published by
|
|
15
|
-
* the Free Software Foundation; either version 3 of the License, or
|
|
16
|
-
* (at your option) any later version.
|
|
17
|
-
*
|
|
18
|
-
* This program is distributed in the hope that it will be useful,
|
|
19
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21
|
-
* GNU General Public License for more details.
|
|
22
|
-
*
|
|
23
|
-
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
24
|
-
**/
|
|
25
|
-
/**
|
|
26
|
-
* language definition
|
|
27
|
-
* x4 specific strings
|
|
28
|
-
*/
|
|
29
|
-
let fr = {
|
|
30
|
-
global: {
|
|
31
|
-
ok: 'OK',
|
|
32
|
-
cancel: 'Annuler',
|
|
33
|
-
ignore: 'Ignorer',
|
|
34
|
-
yes: 'Oui',
|
|
35
|
-
no: 'Non',
|
|
36
|
-
open: 'Ouvrir',
|
|
37
|
-
new: 'Nouveau',
|
|
38
|
-
delete: 'Supprimer',
|
|
39
|
-
close: 'Fermer',
|
|
40
|
-
save: 'Enregistrer',
|
|
41
|
-
search: 'Rechercher',
|
|
42
|
-
search_tip: 'Saisissez le texte à rechercher. <b>Enter</b> pour lancer la recherche. <b>Esc</b> pour annuler.',
|
|
43
|
-
required_field: "information requise",
|
|
44
|
-
invalid_format: "format invalide",
|
|
45
|
-
invalid_email: 'adresse mail invalide',
|
|
46
|
-
invalid_number: 'valeur numérique invalide',
|
|
47
|
-
diff_date_seconds: '{0} seconds',
|
|
48
|
-
diff_date_minutes: '{0} minutes',
|
|
49
|
-
diff_date_hours: '{0} hours',
|
|
50
|
-
invalid_date: 'Date non reconnue ({0})',
|
|
51
|
-
empty_list: 'Liste vide',
|
|
52
|
-
date_input_formats: 'd/m/y|d.m.y|d m y|d-m-y|dmy',
|
|
53
|
-
date_format: 'D/M/Y',
|
|
54
|
-
day_short: ['dim', 'lun', 'mar', 'mer', 'jeu', 'ven', 'sam'],
|
|
55
|
-
day_long: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
|
|
56
|
-
month_short: ['jan', 'fév', 'mar', 'avr', 'mai', 'jun', 'jui', 'aoû', 'sep', 'oct', 'nov', 'déc'],
|
|
57
|
-
month_long: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
|
|
58
|
-
property: 'Propriété',
|
|
59
|
-
value: 'Valeur',
|
|
60
|
-
err_403: `Vous n'avez pas les droits suffisants pour effectuer cette action`,
|
|
61
|
-
copy: 'Copier',
|
|
62
|
-
cut: 'Couper',
|
|
63
|
-
paste: 'Coller'
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
/** @ignore */
|
|
67
|
-
let en = {
|
|
68
|
-
global: {
|
|
69
|
-
ok: 'OK',
|
|
70
|
-
cancel: 'Cancel',
|
|
71
|
-
ignore: 'Ignore',
|
|
72
|
-
yes: 'Yes',
|
|
73
|
-
no: 'No',
|
|
74
|
-
required_field: "required field",
|
|
75
|
-
invalid_format: "invalid format",
|
|
76
|
-
diff_date_seconds: '{0} seconds',
|
|
77
|
-
diff_date_minutes: '{0} minutes',
|
|
78
|
-
diff_date_hours: '{0} hours',
|
|
79
|
-
invalid_date: 'Bad date format {0}',
|
|
80
|
-
copy: 'Copy',
|
|
81
|
-
cut: 'Cut',
|
|
82
|
-
paste: 'Paste'
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
/** @ignore */
|
|
86
|
-
let all_langs = {
|
|
87
|
-
'fr': fr,
|
|
88
|
-
'en': _mk_proxy(_patch({}, en))
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* current language
|
|
92
|
-
* FR by default
|
|
93
|
-
* @example ```typescript
|
|
94
|
-
* console.log( _tr.global.ok );
|
|
95
|
-
*/
|
|
96
|
-
export let _tr = all_langs['fr'];
|
|
97
|
-
/**
|
|
98
|
-
* check if the language is known
|
|
99
|
-
* @param name - language name to test
|
|
100
|
-
* @example ```typescript
|
|
101
|
-
* if( isLanguage('fr') ) {
|
|
102
|
-
* }
|
|
103
|
-
*/
|
|
104
|
-
export function isLanguage(name) {
|
|
105
|
-
return all_langs[name] !== undefined;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* select the current language
|
|
109
|
-
* @param name - language name
|
|
110
|
-
* @example ```typescript
|
|
111
|
-
* selectLanguage( 'en' );
|
|
112
|
-
*/
|
|
113
|
-
export function selectLanguage(name) {
|
|
114
|
-
if (!isLanguage(name)) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
_tr = all_langs[name];
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* define a translation
|
|
121
|
-
* you can also patch 'global' elements witch are defined by x4
|
|
122
|
-
* @param name - language name
|
|
123
|
-
* @param definition - definition of the language
|
|
124
|
-
* @example ```typescript
|
|
125
|
-
* setTranslation( 'fr', {
|
|
126
|
-
* this_is_an_example: 'ceci est un exemple',
|
|
127
|
-
* this_is: {
|
|
128
|
-
* another_example: 'ceci est un autre exemple'
|
|
129
|
-
* },
|
|
130
|
-
* global: {
|
|
131
|
-
* ok: 'O.K.'
|
|
132
|
-
* }
|
|
133
|
-
* });
|
|
134
|
-
* console.log( _tr.this_is_an_example ); // defined by the previous line
|
|
135
|
-
* selectLanguage( 'en' );
|
|
136
|
-
* console.log( _tr.this_is_an_example ); // 'en' do not define this, so we get 'fr' one
|
|
137
|
-
*
|
|
138
|
-
*/
|
|
139
|
-
export function extendTranslation(name, definition) {
|
|
140
|
-
if (!isLanguage(name)) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
_patch(all_langs[name], definition);
|
|
144
|
-
}
|
|
145
|
-
function _patch(obj, by) {
|
|
146
|
-
for (let n in by) {
|
|
147
|
-
if (obj[n] instanceof Object) {
|
|
148
|
-
_patch(obj[n], by[n]);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
obj[n] = by[n];
|
|
152
|
-
if (obj[n] instanceof Object) {
|
|
153
|
-
obj[n] = _mk_proxy(obj[n]);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return obj;
|
|
158
|
-
}
|
|
159
|
-
function _mk_proxy(obj) {
|
|
160
|
-
return new Proxy(obj, {
|
|
161
|
-
get: function (target, prop, receiver) {
|
|
162
|
-
let value = target[prop];
|
|
163
|
-
if (value === undefined) {
|
|
164
|
-
return fr[prop];
|
|
165
|
-
}
|
|
166
|
-
return value;
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
}
|
package/lib/icon.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ___ ___ __
|
|
3
|
-
* \ \/ / / _
|
|
4
|
-
* \ / /_| |_
|
|
5
|
-
* / \____ _|
|
|
6
|
-
* /__/\__\ |_|
|
|
7
|
-
*
|
|
8
|
-
* @file icon.ts
|
|
9
|
-
* @author Etienne Cochard
|
|
10
|
-
* @license
|
|
11
|
-
* Copyright (c) 2019-2021 R-libre ingenierie
|
|
12
|
-
*
|
|
13
|
-
* This program is free software; you can redistribute it and/or modify
|
|
14
|
-
* it under the terms of the GNU General Public License as published by
|
|
15
|
-
* the Free Software Foundation; either version 3 of the License, or
|
|
16
|
-
* (at your option) any later version.
|
|
17
|
-
*
|
|
18
|
-
* This program is distributed in the hope that it will be useful,
|
|
19
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21
|
-
* GNU General Public License for more details.
|
|
22
|
-
*
|
|
23
|
-
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
24
|
-
**/
|
|
25
|
-
import { Component, CProps } from './component';
|
|
26
|
-
import { BasicEvent } from './x4_events';
|
|
27
|
-
export declare type IconID = string | number;
|
|
28
|
-
export interface IconProps extends CProps {
|
|
29
|
-
icon: IconID;
|
|
30
|
-
size?: number;
|
|
31
|
-
}
|
|
32
|
-
export interface EvLoaded extends BasicEvent {
|
|
33
|
-
url: string;
|
|
34
|
-
svg: string;
|
|
35
|
-
}
|
|
36
|
-
export declare function EvLoaded(url: string, svg: string, context?: any): EvLoaded;
|
|
37
|
-
/**
|
|
38
|
-
* standard icon
|
|
39
|
-
*/
|
|
40
|
-
export declare class Icon extends Component<IconProps> {
|
|
41
|
-
private m_icon;
|
|
42
|
-
private m_iconName;
|
|
43
|
-
constructor(props: IconProps);
|
|
44
|
-
private _setIcon;
|
|
45
|
-
/**
|
|
46
|
-
* change the icon
|
|
47
|
-
* @param icon - new icon
|
|
48
|
-
*/
|
|
49
|
-
set icon(icon: IconID);
|
|
50
|
-
get icon(): IconID;
|
|
51
|
-
private _setSVG;
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
*/
|
|
55
|
-
private static icon_cache;
|
|
56
|
-
}
|