x4js 2.0.1 → 2.0.3

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.
Files changed (211) hide show
  1. package/package.json +12 -9
  2. package/lib/README.txt +0 -15
  3. package/lib/src/assets/house-light.svg +0 -1
  4. package/lib/src/assets/radio.svg +0 -4
  5. package/lib/src/components/base.scss +0 -26
  6. package/lib/src/components/boxes/boxes.module.scss +0 -37
  7. package/lib/src/components/boxes/boxes.ts +0 -125
  8. package/lib/src/components/btngroup/btngroup.module.scss +0 -29
  9. package/lib/src/components/btngroup/btngroup.ts +0 -106
  10. package/lib/src/components/button/button.module.scss +0 -154
  11. package/lib/src/components/button/button.ts +0 -117
  12. package/lib/src/components/calendar/calendar-check-sharp-light.svg +0 -1
  13. package/lib/src/components/calendar/calendar.module.scss +0 -163
  14. package/lib/src/components/calendar/calendar.ts +0 -326
  15. package/lib/src/components/calendar/chevron-left-sharp-light.svg +0 -1
  16. package/lib/src/components/calendar/chevron-right-sharp-light.svg +0 -1
  17. package/lib/src/components/checkbox/check.svg +0 -4
  18. package/lib/src/components/checkbox/checkbox.module.scss +0 -142
  19. package/lib/src/components/checkbox/checkbox.ts +0 -125
  20. package/lib/src/components/colorinput/colorinput.module.scss +0 -65
  21. package/lib/src/components/colorinput/colorinput.ts +0 -88
  22. package/lib/src/components/colorinput/crosshairs-simple-sharp-light.svg +0 -1
  23. package/lib/src/components/colorpicker/colorpicker.module.scss +0 -133
  24. package/lib/src/components/colorpicker/colorpicker.ts +0 -477
  25. package/lib/src/components/combobox/combobox.module.scss +0 -121
  26. package/lib/src/components/combobox/combobox.ts +0 -190
  27. package/lib/src/components/combobox/updown.svg +0 -4
  28. package/lib/src/components/dialog/dialog.module.scss +0 -71
  29. package/lib/src/components/dialog/dialog.ts +0 -91
  30. package/lib/src/components/dialog/xmark-sharp-light.svg +0 -1
  31. package/lib/src/components/form/form.module.scss +0 -34
  32. package/lib/src/components/form/form.ts +0 -36
  33. package/lib/src/components/header/header.module.scss +0 -40
  34. package/lib/src/components/header/header.ts +0 -124
  35. package/lib/src/components/icon/icon.module.scss +0 -30
  36. package/lib/src/components/icon/icon.ts +0 -134
  37. package/lib/src/components/image/image.module.scss +0 -21
  38. package/lib/src/components/image/image.ts +0 -67
  39. package/lib/src/components/input/input.module.scss +0 -69
  40. package/lib/src/components/input/input.ts +0 -274
  41. package/lib/src/components/label/label.module.scss +0 -52
  42. package/lib/src/components/label/label.ts +0 -55
  43. package/lib/src/components/listbox/listbox.module.scss +0 -103
  44. package/lib/src/components/listbox/listbox.ts +0 -427
  45. package/lib/src/components/menu/caret-right-solid.svg +0 -1
  46. package/lib/src/components/menu/menu.module.scss +0 -108
  47. package/lib/src/components/menu/menu.ts +0 -168
  48. package/lib/src/components/messages/circle-exclamation.svg +0 -1
  49. package/lib/src/components/messages/messages.module.scss +0 -47
  50. package/lib/src/components/messages/messages.ts +0 -64
  51. package/lib/src/components/normalize.scss +0 -386
  52. package/lib/src/components/notification/circle-check-solid.svg +0 -1
  53. package/lib/src/components/notification/circle-exclamation-solid.svg +0 -1
  54. package/lib/src/components/notification/circle-notch-light.svg +0 -1
  55. package/lib/src/components/notification/notification.module.scss +0 -82
  56. package/lib/src/components/notification/notification.ts +0 -108
  57. package/lib/src/components/notification/xmark-sharp-light.svg +0 -1
  58. package/lib/src/components/panel/panel.module.scss +0 -48
  59. package/lib/src/components/panel/panel.ts +0 -57
  60. package/lib/src/components/popup/popup.module.scss +0 -43
  61. package/lib/src/components/popup/popup.ts +0 -395
  62. package/lib/src/components/progress/progress.module.scss +0 -57
  63. package/lib/src/components/progress/progress.ts +0 -43
  64. package/lib/src/components/rating/rating.module.scss +0 -23
  65. package/lib/src/components/rating/rating.ts +0 -125
  66. package/lib/src/components/rating/star-sharp-light.svg +0 -1
  67. package/lib/src/components/rating/star-sharp-solid.svg +0 -1
  68. package/lib/src/components/shared.scss +0 -76
  69. package/lib/src/components/sizers/sizer.module.scss +0 -90
  70. package/lib/src/components/sizers/sizer.ts +0 -120
  71. package/lib/src/components/slider/slider.module.scss +0 -71
  72. package/lib/src/components/slider/slider.ts +0 -143
  73. package/lib/src/components/switch/switch.module.scss +0 -127
  74. package/lib/src/components/switch/switch.ts +0 -56
  75. package/lib/src/components/tabs/tabs.module.scss +0 -46
  76. package/lib/src/components/tabs/tabs.ts +0 -157
  77. package/lib/src/components/textarea/textarea.module.scss +0 -59
  78. package/lib/src/components/textarea/textarea.ts +0 -54
  79. package/lib/src/components/textedit/textedit.module.scss +0 -114
  80. package/lib/src/components/textedit/textedit.ts +0 -82
  81. package/lib/src/components/themes.scss +0 -77
  82. package/lib/src/components/tooltips/circle-info-sharp-light.svg +0 -1
  83. package/lib/src/components/tooltips/tooltips.scss +0 -51
  84. package/lib/src/components/tooltips/tooltips.ts +0 -103
  85. package/lib/src/components/treeview/chevron-down-light.svg +0 -1
  86. package/lib/src/components/treeview/treeview.module.scss +0 -116
  87. package/lib/src/components/treeview/treeview.ts +0 -403
  88. package/lib/src/components/viewport/viewport.module.scss +0 -25
  89. package/lib/src/components/viewport/viewport.ts +0 -38
  90. package/lib/src/core/component.ts +0 -979
  91. package/lib/src/core/core_colors.ts +0 -250
  92. package/lib/src/core/core_dom.ts +0 -471
  93. package/lib/src/core/core_dragdrop.ts +0 -201
  94. package/lib/src/core/core_element.ts +0 -98
  95. package/lib/src/core/core_events.ts +0 -149
  96. package/lib/src/core/core_i18n.ts +0 -377
  97. package/lib/src/core/core_router.ts +0 -221
  98. package/lib/src/core/core_styles.ts +0 -215
  99. package/lib/src/core/core_svg.ts +0 -550
  100. package/lib/src/core/core_tools.ts +0 -673
  101. package/lib/src/main.scss +0 -21
  102. package/lib/src/main.tsx +0 -323
  103. package/lib/src/x4.scss +0 -19
  104. package/lib/types/x4.d.ts +0 -2624
  105. package/scripts/build.mjs +0 -351
  106. package/scripts/prepack.mjs +0 -15
  107. package/src/assets/house-light.svg +0 -1
  108. package/src/assets/radio.svg +0 -4
  109. package/src/components/base.scss +0 -26
  110. package/src/components/boxes/boxes.module.scss +0 -37
  111. package/src/components/boxes/boxes.ts +0 -125
  112. package/src/components/btngroup/btngroup.module.scss +0 -29
  113. package/src/components/btngroup/btngroup.ts +0 -106
  114. package/src/components/button/button.module.scss +0 -154
  115. package/src/components/button/button.ts +0 -117
  116. package/src/components/calendar/calendar-check-sharp-light.svg +0 -1
  117. package/src/components/calendar/calendar.module.scss +0 -163
  118. package/src/components/calendar/calendar.ts +0 -326
  119. package/src/components/calendar/chevron-left-sharp-light.svg +0 -1
  120. package/src/components/calendar/chevron-right-sharp-light.svg +0 -1
  121. package/src/components/checkbox/check.svg +0 -4
  122. package/src/components/checkbox/checkbox.module.scss +0 -142
  123. package/src/components/checkbox/checkbox.ts +0 -125
  124. package/src/components/colorinput/colorinput.module.scss +0 -65
  125. package/src/components/colorinput/colorinput.ts +0 -88
  126. package/src/components/colorinput/crosshairs-simple-sharp-light.svg +0 -1
  127. package/src/components/colorpicker/colorpicker.module.scss +0 -133
  128. package/src/components/colorpicker/colorpicker.ts +0 -477
  129. package/src/components/combobox/combobox.module.scss +0 -121
  130. package/src/components/combobox/combobox.ts +0 -190
  131. package/src/components/combobox/updown.svg +0 -4
  132. package/src/components/dialog/dialog.module.scss +0 -71
  133. package/src/components/dialog/dialog.ts +0 -91
  134. package/src/components/dialog/xmark-sharp-light.svg +0 -1
  135. package/src/components/form/form.module.scss +0 -34
  136. package/src/components/form/form.ts +0 -36
  137. package/src/components/header/header.module.scss +0 -40
  138. package/src/components/header/header.ts +0 -124
  139. package/src/components/icon/icon.module.scss +0 -30
  140. package/src/components/icon/icon.ts +0 -134
  141. package/src/components/image/image.module.scss +0 -21
  142. package/src/components/image/image.ts +0 -67
  143. package/src/components/input/input.module.scss +0 -69
  144. package/src/components/input/input.ts +0 -274
  145. package/src/components/label/label.module.scss +0 -52
  146. package/src/components/label/label.ts +0 -55
  147. package/src/components/listbox/listbox.module.scss +0 -103
  148. package/src/components/listbox/listbox.ts +0 -427
  149. package/src/components/menu/caret-right-solid.svg +0 -1
  150. package/src/components/menu/menu.module.scss +0 -108
  151. package/src/components/menu/menu.ts +0 -168
  152. package/src/components/messages/circle-exclamation.svg +0 -1
  153. package/src/components/messages/messages.module.scss +0 -47
  154. package/src/components/messages/messages.ts +0 -64
  155. package/src/components/normalize.scss +0 -386
  156. package/src/components/notification/circle-check-solid.svg +0 -1
  157. package/src/components/notification/circle-exclamation-solid.svg +0 -1
  158. package/src/components/notification/circle-notch-light.svg +0 -1
  159. package/src/components/notification/notification.module.scss +0 -82
  160. package/src/components/notification/notification.ts +0 -108
  161. package/src/components/notification/xmark-sharp-light.svg +0 -1
  162. package/src/components/panel/panel.module.scss +0 -48
  163. package/src/components/panel/panel.ts +0 -57
  164. package/src/components/popup/popup.module.scss +0 -43
  165. package/src/components/popup/popup.ts +0 -395
  166. package/src/components/progress/progress.module.scss +0 -57
  167. package/src/components/progress/progress.ts +0 -43
  168. package/src/components/rating/rating.module.scss +0 -23
  169. package/src/components/rating/rating.ts +0 -125
  170. package/src/components/rating/star-sharp-light.svg +0 -1
  171. package/src/components/rating/star-sharp-solid.svg +0 -1
  172. package/src/components/shared.scss +0 -76
  173. package/src/components/sizers/sizer.module.scss +0 -90
  174. package/src/components/sizers/sizer.ts +0 -120
  175. package/src/components/slider/slider.module.scss +0 -71
  176. package/src/components/slider/slider.ts +0 -143
  177. package/src/components/switch/switch.module.scss +0 -127
  178. package/src/components/switch/switch.ts +0 -56
  179. package/src/components/tabs/tabs.module.scss +0 -46
  180. package/src/components/tabs/tabs.ts +0 -157
  181. package/src/components/textarea/textarea.module.scss +0 -59
  182. package/src/components/textarea/textarea.ts +0 -54
  183. package/src/components/textedit/textedit.module.scss +0 -114
  184. package/src/components/textedit/textedit.ts +0 -82
  185. package/src/components/themes.scss +0 -77
  186. package/src/components/tooltips/circle-info-sharp-light.svg +0 -1
  187. package/src/components/tooltips/tooltips.scss +0 -51
  188. package/src/components/tooltips/tooltips.ts +0 -103
  189. package/src/components/treeview/chevron-down-light.svg +0 -1
  190. package/src/components/treeview/treeview.module.scss +0 -116
  191. package/src/components/treeview/treeview.ts +0 -403
  192. package/src/components/viewport/viewport.module.scss +0 -25
  193. package/src/components/viewport/viewport.ts +0 -38
  194. package/src/core/component.ts +0 -979
  195. package/src/core/core_colors.ts +0 -250
  196. package/src/core/core_dom.ts +0 -471
  197. package/src/core/core_dragdrop.ts +0 -201
  198. package/src/core/core_element.ts +0 -98
  199. package/src/core/core_events.ts +0 -149
  200. package/src/core/core_i18n.ts +0 -377
  201. package/src/core/core_router.ts +0 -221
  202. package/src/core/core_styles.ts +0 -215
  203. package/src/core/core_svg.ts +0 -550
  204. package/src/core/core_tools.ts +0 -673
  205. package/src/main.scss +0 -21
  206. package/src/main.tsx +0 -323
  207. package/src/x4.scss +0 -19
  208. package/tsconfig.json +0 -14
  209. package/types/scss.d.ts +0 -4
  210. package/types/svg.d.ts +0 -4
  211. package/types/x4react.d.ts +0 -9
package/lib/types/x4.d.ts DELETED
@@ -1,2624 +0,0 @@
1
- declare module 'src/core/core_i18n' {
2
- /**
3
- * ___ ___ __
4
- * \ \/ / / _
5
- * \ / /_| |_
6
- * / \____ _|
7
- * /__/\__\ |_|
8
- *
9
- * @file core_i18n.ts
10
- * @author Etienne Cochard
11
- *
12
- * @copyright (c) 2024 R-libre ingenierie
13
- *
14
- * Use of this source code is governed by an MIT-style license
15
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
16
- **/
17
- /**
18
- * create a new language
19
- * @param name language name (code)
20
- * @param base base language (code)
21
- * @example:
22
- * ```js
23
- * createLanguage( 'en', 'fr' );
24
- * ```
25
- */
26
- export function createLanguage(name: string, base: string): void;
27
- /**
28
- * check if the given language is known
29
- * @param name language name (code)
30
- */
31
- export function isLanguage(name: string): boolean;
32
- /**
33
- * build the language with given fragments
34
- * @param name language name (code)
35
- * @param parts misc elements that make the language
36
- * @example:
37
- * ```js
38
- * createLanguage( 'en', 'fr' );
39
- * const app = {
40
- * clients: {
41
- * translation1: "hello",
42
- * }
43
- * }
44
- * addTranslation( 'en', app );
45
- * ```
46
- */
47
- export function addTranslation(name: string, ...parts: any[]): void;
48
- export let _tr: Partial<typeof fr>;
49
- /**
50
- * select the given language as current
51
- * @param name laguage name (code)
52
- */
53
- export function selectLanguage(name: string): Partial<{
54
- global: {
55
- ok: string;
56
- cancel: string;
57
- ignore: string;
58
- yes: string;
59
- no: string;
60
- abort: string;
61
- retry: string;
62
- error: string;
63
- today: string;
64
- open: string;
65
- new: string;
66
- delete: string;
67
- close: string;
68
- save: string;
69
- search: string;
70
- search_tip: string;
71
- required_field: string;
72
- invalid_format: string;
73
- invalid_email: string;
74
- invalid_number: string;
75
- diff_date_seconds: string;
76
- diff_date_minutes: string;
77
- diff_date_hours: string;
78
- invalid_date: string;
79
- empty_list: string;
80
- date_input_formats: string;
81
- date_format: string;
82
- day_short: string[];
83
- day_long: string[];
84
- month_short: string[];
85
- month_long: string[];
86
- property: string;
87
- value: string;
88
- err_403: string;
89
- copy: string;
90
- cut: string;
91
- paste: string;
92
- };
93
- }>;
94
- /**
95
- *
96
- */
97
- export function getCurrentLanguage(): string;
98
- /**
99
- *
100
- */
101
- export function getAvailableLanguages(): string[]; let fr: {
102
- global: {
103
- ok: string;
104
- cancel: string;
105
- ignore: string;
106
- yes: string;
107
- no: string;
108
- abort: string;
109
- retry: string;
110
- error: string;
111
- today: string;
112
- open: string;
113
- new: string;
114
- delete: string;
115
- close: string;
116
- save: string;
117
- search: string;
118
- search_tip: string;
119
- required_field: string;
120
- invalid_format: string;
121
- invalid_email: string;
122
- invalid_number: string;
123
- diff_date_seconds: string;
124
- diff_date_minutes: string;
125
- diff_date_hours: string;
126
- invalid_date: string;
127
- empty_list: string;
128
- date_input_formats: string;
129
- date_format: string;
130
- day_short: string[];
131
- day_long: string[];
132
- month_short: string[];
133
- month_long: string[];
134
- property: string;
135
- value: string;
136
- err_403: string;
137
- copy: string;
138
- cut: string;
139
- paste: string;
140
- };
141
- };
142
- export {};
143
-
144
- }
145
- declare module 'src/core/core_tools' {
146
- /**
147
- * ___ ___ __
148
- * \ \/ / / _
149
- * \ / /_| |_
150
- * / \____ _|
151
- * /__/\__\ |_|
152
- *
153
- * @file core_tools.ts
154
- * @author Etienne Cochard
155
- *
156
- * @copyright (c) 2024 R-libre ingenierie
157
- *
158
- * Use of this source code is governed by an MIT-style license
159
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
160
- **/
161
- /**
162
- * @returns true if object is a string
163
- */
164
- export function isString(val: any): val is string;
165
- /**
166
- * @returns true if object is a number
167
- */
168
- export function isNumber(v: any): v is number;
169
- /**
170
- * @returns true if object is an array
171
- */
172
- export function isArray(val: any): val is any[];
173
- /**
174
- * @returns true if object is a function
175
- */
176
- export function isFunction(val: any): val is Function;
177
- /**
178
- * generic constructor
179
- */
180
- export type Constructor<P> = {
181
- new (...params: any[]): P;
182
- };
183
- /**
184
- * a way to explain that the given string may be unsafe but must be treated a sstring
185
- * @example
186
- * label.setText( unsafehtml`<b>Bold</b> text` );
187
- * label.setText( new UnsafeHtml("<b>Bold</b> text`" ) );
188
- */
189
- export class UnsafeHtml extends String {
190
- constructor(value: string);
191
- }
192
- export function unsafeHtml(x: string): UnsafeHtml;
193
- /**
194
- *
195
- */
196
- export function clamp<T>(v: T, min: T, max: T): T;
197
- /**
198
- * generic Rectangle
199
- */
200
- export interface IRect {
201
- left: number;
202
- top: number;
203
- height: number;
204
- width: number;
205
- }
206
- /**
207
- *
208
- */
209
- export class Rect implements IRect {
210
- left: number;
211
- top: number;
212
- height: number;
213
- width: number;
214
- constructor();
215
- constructor(l: number, t: number, w: number, h: number);
216
- constructor(l: Rect);
217
- get right(): number;
218
- get bottom(): number;
219
- }
220
- /**
221
- * generic Point
222
- */
223
- export interface Point {
224
- x: number;
225
- y: number;
226
- }
227
- /**
228
- *
229
- */
230
- export interface IComponentInterface {
231
- }
232
- export interface IFormElement extends IComponentInterface {
233
- getRawValue(): any;
234
- setRawValue(v: any): void;
235
- }
236
- /**
237
- *
238
- */
239
- interface Features {
240
- eyedropper: 1;
241
- }
242
- export function isFeatureAvailable(name: keyof Features): boolean;
243
- export class Timer {
244
- protected _timers: Map<string, any>;
245
- /**
246
- *
247
- */
248
- setTimeout(name: string, time: number, callback: Function): number;
249
- clearTimeout(name: string): void;
250
- /**
251
- *
252
- */
253
- setInterval(name: string, time: number, callback: Function): number;
254
- clearInterval(name: string): void;
255
- clearAllTimeouts(): void;
256
- }
257
- /**
258
- *
259
- */
260
- export function asap(callback: () => void): number;
261
- /**
262
- * prepend 0 to a value to a given length
263
- * @param value
264
- * @param length
265
- */
266
- export function pad(what: any, size: number, ch?: string): string;
267
- /**
268
- * replace {0..9} by given arguments
269
- * @param format string
270
- * @param args
271
- *
272
- * @example ```ts
273
- *
274
- * console.log( sprintf( 'here is arg 1 {1} and arg 0 {0}', 'argument 0', 'argument 1' ) )
275
- */
276
- export function sprintf(format: string, ...args: any[]): string;
277
- /**
278
- * inverse of camel case
279
- * theThingToCase -> the-thing-to-case
280
- * @param {String} str
281
- */
282
- export function pascalCase(string: string): string;
283
- export function camelCase(text: string): string;
284
- /**
285
- * change the current locale for misc translations (date...)
286
- * @param locale
287
- */
288
- export function _date_set_locale(locale: string): void;
289
- /**
290
- *
291
- * @param date
292
- * @param options
293
- * @example
294
- * let date = new Date( );
295
- * let options = { day: 'numeric', month: 'numeric', year: 'numeric', hour: 'numeric', minute: 'numeric' };
296
- * let text = date_format( date, options );
297
- */
298
- export function date_format(date: Date, options?: any): string;
299
- /**
300
- *
301
- * @param date
302
- * @param options
303
- */
304
- export function date_diff(date1: Date, date2: Date, options?: any): string;
305
- export function date_to_sql(date: Date, withHours: boolean): string;
306
- /**
307
- * construct a date from an utc date time (sql format)
308
- * YYYY-MM-DD HH:MM:SS
309
- */
310
- export function date_sql_utc(date: string): Date;
311
- /**
312
- * return a number that is a representation of the date
313
- * this number can be compared with another hash
314
- */
315
- export function date_hash(date: Date): number;
316
- /**
317
- * return a copy of a date
318
- */
319
- export function date_clone(date: Date): Date;
320
- /**
321
- * return the week number of a date
322
- */
323
- export function date_calc_weeknum(date: Date): number;
324
- /**
325
- * parse a date according to the given format
326
- * @param value - string date to parse
327
- * @param fmts - format list - i18 tranlation by default
328
- * allowed format specifiers:
329
- * d or D: date (1 or 2 digits)
330
- * m or M: month (1 or 2 digits)
331
- * y or Y: year (2 or 4 digits)
332
- * h or H: hours (1 or 2 digits)
333
- * i or I: minutes (1 or 2 digits)
334
- * s or S: seconds (1 or 2 digits)
335
- * <space>: 1 or more spaces
336
- * any other char: <0 or more spaces><the char><0 or more spaces>
337
- * each specifiers is separated from other by a pipe (|)
338
- * more specific at first
339
- * @example
340
- * 'd/m/y|d m Y|dmy|y-m-d h:i:s|y-m-d'
341
- */
342
- export function parseIntlDate(value: string, fmts?: string): Date;
343
- /**
344
- * format a date as string
345
- * @param date - date to format
346
- * @param fmt - format
347
- * format specifiers:
348
- * d: date (no pad)
349
- * D: 2 digits date padded with 0
350
- * j: day of week short mode 'mon'
351
- * J: day of week long mode 'monday'
352
- * w: week number
353
- * m: month (no pad)
354
- * M: 2 digits month padded with 0
355
- * o: month short mode 'jan'
356
- * O: month long mode 'january'
357
- * y or Y: year
358
- * h: hour (24 format)
359
- * H: 2 digits hour (24 format) padded with 0
360
- * i: minutes
361
- * I: 2 digits minutes padded with 0
362
- * s: seconds
363
- * S: 2 digits seconds padded with 0
364
- * a: am or pm
365
- * anything else is inserted
366
- * if you need to insert some text, put it between {}
367
- *
368
- * @example
369
- *
370
- * 01/01/1970 11:25:00 with '{this is my demo date formatter: }H-i*M'
371
- * "this is my demo date formatter: 11-25*january"
372
- */
373
- export function formatIntlDate(date: Date, fmt?: string): string;
374
- export function calcAge(birth: Date, ref?: Date): number;
375
- export {};
376
-
377
- }
378
- declare module 'src/core/core_events' {
379
- /**
380
- * ___ ___ __
381
- * \ \/ / / _
382
- * \ / /_| |_
383
- * / \____ _|
384
- * /__/\__\ |_|
385
- *
386
- * @file core_events.ts
387
- * @author Etienne Cochard
388
- *
389
- * @copyright (c) 2024 R-libre ingenierie
390
- *
391
- * Use of this source code is governed by an MIT-style license
392
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
393
- **/
394
- import { CoreElement } from 'src/core/core_element';
395
- /**
396
- *
397
- */
398
- export interface CoreEvent {
399
- readonly type?: string;
400
- readonly source?: CoreElement;
401
- readonly context?: any;
402
- propagationStopped?: boolean;
403
- defaultPrevented?: boolean;
404
- stopPropagation?(): void;
405
- preventDefault?(): void;
406
- }
407
- /**
408
- *
409
- */
410
- export interface EventMap {
411
- }
412
- /**
413
- *
414
- */
415
- export type EventCallback<T extends CoreEvent = CoreEvent> = (event: T) => any;
416
- /**
417
- *
418
- */
419
- export class EventSource<E extends EventMap = EventMap> {
420
- private _source;
421
- private _registry;
422
- constructor(source?: unknown);
423
- addListener<K extends keyof E>(name: K, callback: (ev: E[K]) => void, capturing?: boolean): void;
424
- fire<K extends keyof E>(name: K, evx: E[K]): void;
425
- }
426
-
427
- }
428
- declare module 'src/core/core_element' {
429
- /**
430
- * ___ ___ __
431
- * \ \/ / / _
432
- * \ / /_| |_
433
- * / \____ _|
434
- * /__/\__\ |_|
435
- *
436
- * @file core_element.ts
437
- * @author Etienne Cochard
438
- *
439
- * @copyright (c) 2024 R-libre ingenierie
440
- *
441
- * Use of this source code is governed by an MIT-style license
442
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
443
- **/
444
- import { EventMap } from 'src/core/core_events.js';
445
- /**
446
- *
447
- */
448
- export class CoreElement<E extends EventMap = EventMap> {
449
- #private;
450
- private __startTimer;
451
- private __stopTimer;
452
- setTimeout(name: string, ms: number, callback: () => void): void;
453
- clearTimeout(name: string): void;
454
- setInterval(name: string, ms: number, callback: () => void): void;
455
- clearInterval(name: string): void;
456
- clearTimeouts(): void;
457
- /**
458
- * attach to an event
459
- */
460
- on<K extends keyof E>(name: K, listener: (ev: E[K]) => void): void;
461
- /**
462
- *
463
- */
464
- fire<K extends keyof E>(name: K, ev: E[K]): void;
465
- }
466
-
467
- }
468
- declare module 'src/core/core_styles' {
469
- /**
470
- * ___ ___ __
471
- * \ \/ / / _
472
- * \ / /_| |_
473
- * / \____ _|
474
- * /__/\__\ |_|
475
- *
476
- * @file core_styles.ts
477
- * @author Etienne Cochard
478
- *
479
- * @copyright (c) 2024 R-libre ingenierie
480
- *
481
- * Use of this source code is governed by an MIT-style license
482
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
483
- **/
484
- export const unitless: Record<string, 1>;
485
- export type ariaValues = {
486
- "aria-activedescendant": 1;
487
- "role": 1;
488
- };
489
- export function isUnitLess(name: string): boolean;
490
- /**
491
- *
492
- */
493
- export class Stylesheet {
494
- private m_sheet;
495
- private m_rules;
496
- constructor();
497
- /**
498
- * add a new rule to the style sheet
499
- * @param {string} name - internal rule name
500
- * @param {string} definition - css definition of the rule
501
- * @example
502
- * setRule('xbody', "body { background-color: #ff0000; }" );
503
- */
504
- setRule(name: string, definition: any): void;
505
- /**
506
- * return the style variable value
507
- * @param name - variable name
508
- * @example
509
- * ```
510
- * let color = Component.getCss( ).getVar( 'button-color' );
511
- * ```
512
- */
513
- static getVar(name: string): any;
514
- static guid: number;
515
- static doc_style: CSSStyleDeclaration;
516
- }
517
- /**
518
- *
519
- */
520
- export class ComputedStyle {
521
- m_style: CSSStyleDeclaration;
522
- constructor(style: CSSStyleDeclaration);
523
- /**
524
- * return the raw value
525
- */
526
- value(name: keyof CSSStyleDeclaration): any;
527
- /**
528
- * return the interpreted value
529
- */
530
- parse(name: keyof CSSStyleDeclaration): number;
531
- /**
532
- *
533
- */
534
- get style(): CSSStyleDeclaration;
535
- }
536
-
537
- }
538
- declare module 'src/core/core_dom' {
539
- /**
540
- * ___ ___ __
541
- * \ \/ / / _
542
- * \ / /_| |_
543
- * / \____ _|
544
- * /__/\__\ |_|
545
- *
546
- * @file core_dom.ts
547
- * @author Etienne Cochard
548
- *
549
- * @copyright (c) 2024 R-libre ingenierie
550
- *
551
- * Use of this source code is governed by an MIT-style license
552
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
553
- **/
554
- /** @ignore this events must be defined on domNode (do not bubble) */
555
- export const unbubbleEvents: {
556
- mouseleave: number;
557
- mouseenter: number;
558
- load: number;
559
- unload: number;
560
- scroll: number;
561
- focus: number;
562
- blur: number;
563
- rowexit: number;
564
- beforeunload: number;
565
- stop: number;
566
- dragdrop: number;
567
- dragenter: number;
568
- dragexit: number;
569
- draggesture: number;
570
- dragover: number;
571
- contextmenu: number;
572
- created: number;
573
- removed: number;
574
- sizechange: number;
575
- };
576
- export type DOMEventHandler = (ev: Event) => void;
577
- /**
578
- *
579
- */
580
- export function dispatchEvent(ev: Event): void;
581
- /**
582
- *
583
- */
584
- export function addEvent(node: Node, name: string, handler: DOMEventHandler, prepend?: boolean): void;
585
- /**
586
- *
587
- */
588
- export interface GlobalDOMEvents {
589
- /**
590
- * Fires when the user aborts the download.
591
- * @param ev The event.
592
- */
593
- abort?: (ev: UIEvent) => any;
594
- animationcancel?: (ev: AnimationEvent) => any;
595
- animationend?: (ev: AnimationEvent) => any;
596
- animationiteration?: (ev: AnimationEvent) => any;
597
- animationstart?: (ev: AnimationEvent) => any;
598
- auxclick?: (ev: MouseEvent) => any;
599
- /**
600
- * Fires when the object loses the input focus.
601
- * @param ev The focus event.
602
- */
603
- blur?: (ev: FocusEvent) => any;
604
- cancel?: (ev: Event) => any;
605
- /**
606
- * Occurs when playback is possible, but would require further buffering.
607
- * @param ev The event.
608
- */
609
- canplay?: (ev: Event) => any;
610
- canplaythrough?: (ev: Event) => any;
611
- /**
612
- * Fires when the contents of the object or selection have changed.
613
- * @param ev The event.
614
- */
615
- change?: (ev: Event) => any;
616
- /**
617
- * Fires when the user clicks the left mouse button on the object
618
- * @param ev The mouse event.
619
- */
620
- click?: (ev: MouseEvent) => any;
621
- close?: (ev: Event) => any;
622
- /**
623
- * Fires when the user clicks the right mouse button in the client area, opening the context menu.
624
- * @param ev The mouse event.
625
- */
626
- contextmenu?: (ev: MouseEvent) => any;
627
- cuechange?: (ev: Event) => any;
628
- /**
629
- * Fires when the user double-clicks the object.
630
- * @param ev The mouse event.
631
- */
632
- dblclick?: (ev: MouseEvent) => any;
633
- /**
634
- * Fires on the source object continuously during a drag operation.
635
- * @param ev The event.
636
- */
637
- drag?: (ev: DragEvent) => any;
638
- /**
639
- * Fires on the source object when the user releases the mouse at the close of a drag operation.
640
- * @param ev The event.
641
- */
642
- dragend?: (ev: DragEvent) => any;
643
- /**
644
- * Fires on the target element when the user drags the object to a valid drop target.
645
- * @param ev The drag event.
646
- */
647
- dragenter?: (ev: DragEvent) => any;
648
- dragexit?: (ev: Event) => any;
649
- /**
650
- * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation.
651
- * @param ev The drag event.
652
- */
653
- dragleave?: (ev: DragEvent) => any;
654
- /**
655
- * Fires on the target element continuously while the user drags the object over a valid drop target.
656
- * @param ev The event.
657
- */
658
- dragover?: (ev: DragEvent) => any;
659
- /**
660
- * Fires on the source object when the user starts to drag a text selection or selected object.
661
- * @param ev The event.
662
- */
663
- dragstart?: (ev: DragEvent) => any;
664
- drop?: (ev: DragEvent) => any;
665
- /**
666
- * Occurs when the duration attribute is updated.
667
- * @param ev The event.
668
- */
669
- durationchange?: (ev: Event) => any;
670
- /**
671
- * Occurs when the media element is reset to its initial state.
672
- * @param ev The event.
673
- */
674
- emptied?: (ev: Event) => any;
675
- /**
676
- * Occurs when the end of playback is reached.
677
- * @param ev The event
678
- */
679
- ended?: (ev: Event) => any;
680
- /**
681
- * Fires when an error occurs during object loading.
682
- * @param ev The event.
683
- */
684
- error?: OnErrorEventHandler;
685
- /**
686
- * Fires when the object receives focus.
687
- * @param ev The event.
688
- */
689
- focusin?: (ev: FocusEvent) => any;
690
- focusout?: (ev: FocusEvent) => any;
691
- focus?: (ev: FocusEvent) => any;
692
- gotpointercapture?: (ev: PointerEvent) => any;
693
- input?: (ev: Event) => any;
694
- invalid?: (ev: Event) => any;
695
- /**
696
- * Fires when the user presses a key.
697
- * @param ev The keyboard event
698
- */
699
- keydown?: (ev: KeyboardEvent) => any;
700
- /**
701
- * Fires when the user presses an alphanumeric key.
702
- * @param ev The event.
703
- */
704
- keypress?: (ev: KeyboardEvent) => any;
705
- /**
706
- * Fires when the user releases a key.
707
- * @param ev The keyboard event
708
- */
709
- keyup?: (ev: KeyboardEvent) => any;
710
- /**
711
- * Fires immediately after the browser loads the object.
712
- * @param ev The event.
713
- */
714
- load?: (ev: Event) => any;
715
- /**
716
- * Occurs when media data is loaded at the current playback position.
717
- * @param ev The event.
718
- */
719
- loadeddata?: (ev: Event) => any;
720
- /**
721
- * Occurs when the duration and dimensions of the media have been determined.
722
- * @param ev The event.
723
- */
724
- loadedmetadata?: (ev: Event) => any;
725
- /**
726
- * Occurs when Internet Explorer begins looking for media data.
727
- * @param ev The event.
728
- */
729
- loadstart?: (ev: Event) => any;
730
- lostpointercapture?: (ev: PointerEvent) => any;
731
- /**
732
- * Fires when the user clicks the object with either mouse button.
733
- * @param ev The mouse event.
734
- */
735
- mousedown?: (ev: MouseEvent) => any;
736
- mouseenter?: (ev: MouseEvent) => any;
737
- mouseleave?: (ev: MouseEvent) => any;
738
- /**
739
- * Fires when the user moves the mouse over the object.
740
- * @param ev The mouse event.
741
- */
742
- mousemove?: (ev: MouseEvent) => any;
743
- /**
744
- * Fires when the user moves the mouse pointer outside the boundaries of the object.
745
- * @param ev The mouse event.
746
- */
747
- mouseout?: (ev: MouseEvent) => any;
748
- /**
749
- * Fires when the user moves the mouse pointer into the object.
750
- * @param ev The mouse event.
751
- */
752
- mouseover?: (ev: MouseEvent) => any;
753
- /**
754
- * Fires when the user releases a mouse button while the mouse is over the object.
755
- * @param ev The mouse event.
756
- */
757
- mouseup?: (ev: MouseEvent) => any;
758
- /**
759
- * Occurs when playback is paused.
760
- * @param ev The event.
761
- */
762
- pause?: (ev: Event) => any;
763
- /**
764
- * Occurs when the play method is requested.
765
- * @param ev The event.
766
- */
767
- play?: (ev: Event) => any;
768
- /**
769
- * Occurs when the audio or video has started playing.
770
- * @param ev The event.
771
- */
772
- playing?: (ev: Event) => any;
773
- pointercancel?: (ev: PointerEvent) => any;
774
- pointerdown?: (ev: PointerEvent) => any;
775
- pointerenter?: (ev: PointerEvent) => any;
776
- pointerleave?: (ev: PointerEvent) => any;
777
- pointermove?: (ev: PointerEvent) => any;
778
- pointerout?: (ev: PointerEvent) => any;
779
- pointerover?: (ev: PointerEvent) => any;
780
- pointerup?: (ev: PointerEvent) => any;
781
- /**
782
- * Occurs to indicate progress while downloading media data.
783
- * @param ev The event.
784
- */
785
- progress?: (ev: ProgressEvent) => any;
786
- /**
787
- * Occurs when the playback rate is increased or decreased.
788
- * @param ev The event.
789
- */
790
- ratechange?: (ev: Event) => any;
791
- /**
792
- * Fires when the user resets a form.
793
- * @param ev The event.
794
- */
795
- reset?: (ev: Event) => any;
796
- /**
797
- * Fires when the user repositions the scroll box in the scroll bar on the object.
798
- * @param ev The event.
799
- */
800
- scroll?: (ev: Event) => any;
801
- securitypolicyviolation?: (ev: SecurityPolicyViolationEvent) => any;
802
- /**
803
- * Occurs when the seek operation ends.
804
- * @param ev The event.
805
- */
806
- seeked?: (ev: Event) => any;
807
- /**
808
- * Occurs when the current playback position is moved.
809
- * @param ev The event.
810
- */
811
- seeking?: (ev: Event) => any;
812
- /**
813
- * Fires when the current selection changes.
814
- * @param ev The event.
815
- */
816
- select?: (ev: Event) => any;
817
- selectionchange?: (ev: Event) => any;
818
- selectstart?: (ev: Event) => any;
819
- /**
820
- * Occurs when the download has stopped.
821
- * @param ev The event.
822
- */
823
- stalled?: (ev: Event) => any;
824
- submit?: (ev: Event) => any;
825
- /**
826
- * Occurs if the load operation has been intentionally halted.
827
- * @param ev The event.
828
- */
829
- suspend?: (ev: Event) => any;
830
- /**
831
- * Occurs to indicate the current playback position.
832
- * @param ev The event.
833
- */
834
- timeupdate?: (ev: Event) => any;
835
- toggle?: (ev: Event) => any;
836
- touchcancel?: (ev: TouchEvent) => any;
837
- touchend?: (ev: TouchEvent) => any;
838
- touchmove?: (ev: TouchEvent) => any;
839
- touchstart?: (ev: TouchEvent) => any;
840
- transitioncancel?: (ev: TransitionEvent) => any;
841
- transitionend?: (ev: TransitionEvent) => any;
842
- transitionrun?: (ev: TransitionEvent) => any;
843
- transitionstart?: (ev: TransitionEvent) => any;
844
- /**
845
- * Occurs when the volume is changed, or playback is muted or unmuted.
846
- * @param ev The event.
847
- */
848
- volumechange?: (ev: Event) => any;
849
- /**
850
- * Occurs when playback stops because the next frame of a video resource is not available.
851
- * @param ev The event.
852
- */
853
- waiting?: (ev: Event) => any;
854
- wheel?: (ev: WheelEvent) => any;
855
- /**
856
- * custom x4 events
857
- */
858
- resized?: (ev: Event) => void;
859
- created?: (ev: Event) => void;
860
- removed?: (ev: Event) => void;
861
- }
862
-
863
- }
864
- declare module 'src/components/icon/icon' {
865
- /**
866
- * ___ ___ __
867
- * \ \/ / / _
868
- * \ / /_| |_
869
- * / \____ _|
870
- * /__/\__\ |_|
871
- *
872
- * @file icon.ts
873
- * @author Etienne Cochard
874
- *
875
- * @copyright (c) 2024 R-libre ingenierie
876
- *
877
- * Use of this source code is governed by an MIT-style license
878
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
879
- **/
880
- import { Component, ComponentProps } from '@core/component';
881
- import 'src/components/icon/icon.module.scss'; class SvgLoader {
882
- private cache;
883
- private waiters;
884
- constructor();
885
- load(file: string): Promise<string>;
886
- private _load;
887
- }
888
- export const svgLoader: SvgLoader;
889
- /**
890
- *
891
- */
892
- export interface IconProps extends ComponentProps {
893
- iconId?: string;
894
- }
895
- /**
896
- *
897
- */
898
- export class Icon extends Component<IconProps> {
899
- constructor(props: IconProps);
900
- /**
901
- * change the icon content
902
- * @param iconId if name is starting with var: then we use css variable name a path
903
- * @example
904
- *
905
- * setIcon( "var:home" )
906
- *
907
- * import myicon from "./myicon.svg"
908
- * setIcon( myicon );
909
- *
910
- */
911
- setIcon(iconId: string): void;
912
- }
913
- export {};
914
-
915
- }
916
- declare module 'src/components/button/button' {
917
- /**
918
- * ___ ___ __
919
- * \ \/ / / _
920
- * \ / /_| |_
921
- * / \____ _|
922
- * /__/\__\ |_|
923
- *
924
- * @file button.ts
925
- * @author Etienne Cochard
926
- *
927
- * @copyright (c) 2024 R-libre ingenierie
928
- *
929
- * Use of this source code is governed by an MIT-style license
930
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
931
- **/
932
- import { Component, ComponentEvents, ComponentProps, EvClick } from '@core/component';
933
- import { EventCallback } from '@core/core_events.js';
934
- import { UnsafeHtml } from '@core/core_tools.js';
935
- import 'src/components/button/button.module.scss';
936
- /**
937
- * Button events
938
- */
939
- interface ButtonEvents extends ComponentEvents {
940
- click: EvClick;
941
- }
942
- /**
943
- * Button properties.
944
- */
945
- export interface ButtonProps extends ComponentProps {
946
- label?: string;
947
- icon?: string;
948
- click?: EventCallback<EvClick>;
949
- }
950
- /**
951
- * Button component.
952
- */
953
- export class Button extends Component<ButtonProps, ButtonEvents> {
954
- /**
955
- * Creates an instance of Button.
956
- *
957
- * @param props - The properties for the button component, including label and icon.
958
- * @example
959
- * const button = new Button({ label: 'Submit', icon: 'check-icon' });
960
- */
961
- constructor(props: ButtonProps);
962
- /**
963
- * called by the system on click event
964
- */
965
- protected _on_click(ev: MouseEvent): void;
966
- /**
967
- * Sets the text content of the button's label.
968
- *
969
- * @param text - The new text or HTML content for the label.
970
- * @example
971
- * button.setText('Click Me');
972
- * button.setText(new UnsafeHtml('<b>Bold Text</b>'));
973
- */
974
- setText(text: string | UnsafeHtml): void;
975
- /**
976
- * Sets the icon of the button.
977
- *
978
- * @param icon - The new icon ID to set on the button.
979
- * @example
980
- * button.setIcon('new-icon-id');
981
- */
982
- setIcon(icon: string): void;
983
- }
984
- export {};
985
-
986
- }
987
- declare module 'src/components/label/label' {
988
- /**
989
- * ___ ___ __
990
- * \ \/ / / _
991
- * \ / /_| |_
992
- * / \____ _|
993
- * /__/\__\ |_|
994
- *
995
- * @file label.ts
996
- * @author Etienne Cochard
997
- *
998
- * @copyright (c) 2024 R-libre ingenierie
999
- *
1000
- * Use of this source code is governed by an MIT-style license
1001
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1002
- **/
1003
- import { Component, ComponentProps } from '@core/component';
1004
- import 'src/components/label/label.module.scss';
1005
- import { UnsafeHtml } from '@core/core_tools.js';
1006
- interface LabelProps extends ComponentProps {
1007
- text?: string | UnsafeHtml;
1008
- icon?: string;
1009
- labelFor?: string;
1010
- }
1011
- export class Label extends Component<LabelProps> {
1012
- constructor(p: LabelProps);
1013
- setText(text: string | UnsafeHtml): void;
1014
- setIcon(icon: string): void;
1015
- }
1016
- export {};
1017
-
1018
- }
1019
- declare module 'src/components/input/input' {
1020
- /**
1021
- * ___ ___ __
1022
- * \ \/ / / _
1023
- * \ / /_| |_
1024
- * / \____ _|
1025
- * /__/\__\ |_|
1026
- *
1027
- * @file input.ts
1028
- * @author Etienne Cochard
1029
- *
1030
- * @copyright (c) 2024 R-libre ingenierie
1031
- *
1032
- * Use of this source code is governed by an MIT-style license
1033
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1034
- **/
1035
- import { Component, ComponentProps } from '@core/component';
1036
- import { IComponentInterface } from '@core/core_tools.js';
1037
- import 'src/components/input/input.module.scss';
1038
- export interface BaseProps extends ComponentProps {
1039
- name?: string;
1040
- }
1041
- interface CheckboxProps extends BaseProps {
1042
- type: "checkbox";
1043
- value?: boolean | number | string;
1044
- checked?: boolean;
1045
- }
1046
- interface RadioProps extends BaseProps {
1047
- type: "radio";
1048
- value: boolean | number | string;
1049
- checked?: boolean;
1050
- }
1051
- export interface RangeProps extends BaseProps {
1052
- type: "range";
1053
- value: number;
1054
- min: number;
1055
- max: number;
1056
- step?: number;
1057
- }
1058
- interface DateProps extends BaseProps {
1059
- type: "date";
1060
- readonly?: boolean;
1061
- required?: boolean;
1062
- value: Date | string;
1063
- }
1064
- interface NumberProps extends BaseProps {
1065
- type: "number";
1066
- readonly?: boolean;
1067
- required?: boolean;
1068
- value: number | string;
1069
- min?: number;
1070
- max?: number;
1071
- step?: number;
1072
- }
1073
- interface FileProps extends BaseProps {
1074
- type: "file";
1075
- accept: string | string[];
1076
- }
1077
- export interface TextInputProps extends BaseProps {
1078
- type: "text" | "email" | "password";
1079
- readonly?: boolean;
1080
- required?: boolean;
1081
- pattern?: string;
1082
- value: string | number;
1083
- placeholder?: string;
1084
- spellcheck?: boolean;
1085
- }
1086
- export type InputProps = CheckboxProps | RadioProps | TextInputProps | RangeProps | DateProps | NumberProps | FileProps;
1087
- /**
1088
- *
1089
- */
1090
- export class Input extends Component<InputProps> {
1091
- constructor(props: InputProps);
1092
- /**
1093
- * @returns
1094
- */
1095
- getValue(): string;
1096
- /**
1097
- *
1098
- * @param value
1099
- */
1100
- setValue(value: string): void;
1101
- /**
1102
- *
1103
- * @returns
1104
- */
1105
- getNumValue(): number;
1106
- /**
1107
- *
1108
- * @param value
1109
- */
1110
- setNumValue(value: number): void;
1111
- /**
1112
- *
1113
- */
1114
- setReadOnly(ro: boolean): void;
1115
- /**
1116
- * select all the text
1117
- */
1118
- selectAll(): void;
1119
- /**
1120
- * select a part of the text
1121
- * @param start
1122
- * @param length
1123
- */
1124
- select(start: number, length?: number): void;
1125
- /**
1126
- * get the selection as { start, length }
1127
- */
1128
- getSelection(): {
1129
- start: number;
1130
- length: number;
1131
- };
1132
- /**
1133
- *
1134
- */
1135
- queryInterface<T extends IComponentInterface>(name: string): T;
1136
- }
1137
- export {};
1138
-
1139
- }
1140
- declare module 'src/components/checkbox/checkbox' {
1141
- import { Component, ComponentEvents, ComponentProps, EvChange } from '@core/component.js';
1142
- import { EventCallback } from '@core/core_events.js';
1143
- import { Input } from 'src/components/input/input';
1144
- import 'src/components/checkbox/checkbox.module.scss';
1145
- /**
1146
- * Checkbox events
1147
- */
1148
- interface CheckBoxEvents extends ComponentEvents {
1149
- change?: EvChange;
1150
- }
1151
- /**
1152
- * Checkbox properties.
1153
- */
1154
- interface CheckboxProps extends ComponentProps {
1155
- label: string;
1156
- checked?: boolean;
1157
- value?: string;
1158
- change?: EventCallback<EvChange>;
1159
- }
1160
- /**
1161
- * Checkbox component that can be checked or unchecked.
1162
- */
1163
- export class Checkbox extends Component<CheckboxProps, CheckBoxEvents> {
1164
- readonly _input: Input;
1165
- /**
1166
- * Creates an instance of the Checkbox component.
1167
- *
1168
- * @param {CheckboxProps} props - The properties for the checkbox component, including label, checked state, and value.
1169
- * @example
1170
- * const checkbox = new Checkbox({ label: 'Accept Terms', checked: true });
1171
- */
1172
- constructor(props: CheckboxProps);
1173
- /**
1174
- * check state changed
1175
- */
1176
- private _on_change;
1177
- /**
1178
- * @return the checked value
1179
- */
1180
- getCheck(): boolean;
1181
- /**
1182
- * change the checked value
1183
- * @param {boolean} ck new checked value
1184
- */
1185
- setCheck(ck: boolean): void;
1186
- /**
1187
- * change the checkbox label
1188
- * @param text
1189
- */
1190
- setLabel(text: string): void;
1191
- /**
1192
- * toggle the checkbox
1193
- */
1194
- toggle(): void;
1195
- }
1196
- export {};
1197
-
1198
- }
1199
- declare module 'src/components/boxes/boxes' {
1200
- /**
1201
- * ___ ___ __
1202
- * \ \/ / / _
1203
- * \ / /_| |_
1204
- * / \____ _|
1205
- * /__/\__\ |_|
1206
- *
1207
- * @file boxes.ts
1208
- * @author Etienne Cochard
1209
- *
1210
- * @copyright (c) 2024 R-libre ingenierie
1211
- *
1212
- * Use of this source code is governed by an MIT-style license
1213
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1214
- **/
1215
- import { Component, ComponentEvents, ComponentProps } from '@core/component';
1216
- import 'src/components/boxes/boxes.module.scss';
1217
- export interface BoxProps extends ComponentProps {
1218
- }
1219
- /**
1220
- *
1221
- */
1222
- export class Box<P extends BoxProps = BoxProps, E extends ComponentEvents = ComponentEvents> extends Component<P, E> {
1223
- }
1224
- /**
1225
- *
1226
- */
1227
- export class HBox<P extends BoxProps = BoxProps, E extends ComponentEvents = ComponentEvents> extends Box<P, E> {
1228
- }
1229
- /**
1230
- *
1231
- */
1232
- export class VBox<P extends BoxProps = BoxProps, E extends ComponentEvents = ComponentEvents> extends Box<P, E> {
1233
- constructor(p: P);
1234
- }
1235
- /**
1236
- * stack of widgets where only one widget is visible at a time
1237
- */
1238
- interface StackItem {
1239
- name: string;
1240
- content: Component;
1241
- }
1242
- interface StackedLayoutProps extends Omit<ComponentProps, "content"> {
1243
- default: string;
1244
- items: StackItem[];
1245
- }
1246
- export class StackBox extends Box<StackedLayoutProps> {
1247
- private _items;
1248
- constructor(props: StackedLayoutProps);
1249
- select(name: string): void;
1250
- /**
1251
- *
1252
- */
1253
- private _createPage;
1254
- }
1255
- export {};
1256
-
1257
- }
1258
- declare module 'src/components/viewport/viewport' {
1259
- /**
1260
- * ___ ___ __
1261
- * \ \/ / / _
1262
- * \ / /_| |_
1263
- * / \____ _|
1264
- * /__/\__\ |_|
1265
- *
1266
- * @file viewport.ts
1267
- * @author Etienne Cochard
1268
- *
1269
- * @copyright (c) 2024 R-libre ingenierie
1270
- *
1271
- * Use of this source code is governed by an MIT-style license
1272
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1273
- **/
1274
- import { Component, ComponentProps } from '@core/component';
1275
- import 'src/components/viewport/viewport.module.scss';
1276
- export class Viewport extends Component {
1277
- constructor(props: ComponentProps);
1278
- }
1279
- export class ScrollView extends Component {
1280
- constructor(props: ComponentProps);
1281
- getViewport(): Viewport;
1282
- }
1283
-
1284
- }
1285
- declare module 'src/components/listbox/listbox' {
1286
- /**
1287
- * ___ ___ __
1288
- * \ \/ / / _
1289
- * \ / /_| |_
1290
- * / \____ _|
1291
- * /__/\__\ |_|
1292
- *
1293
- * @file listbox.ts
1294
- * @author Etienne Cochard
1295
- *
1296
- * @copyright (c) 2024 R-libre ingenierie
1297
- *
1298
- * Use of this source code is governed by an MIT-style license
1299
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1300
- **/
1301
- import { Component, ComponentEvents, ComponentProps, EvClick, EvContextMenu, EvDblClick, EvSelectionChange } from '@core/component';
1302
- import 'src/components/listbox/listbox.module.scss';
1303
- export enum kbNav {
1304
- first = 0,
1305
- prev = 1,
1306
- next = 2,
1307
- last = 3
1308
- }
1309
- export type ListboxID = number | string;
1310
- export interface ListItem {
1311
- id: ListboxID;
1312
- text: string;
1313
- iconId?: string;
1314
- data?: any;
1315
- cls?: string;
1316
- checked?: boolean;
1317
- }
1318
- /**
1319
- *
1320
- */
1321
- interface ListboxEvents extends ComponentEvents {
1322
- click?: EvClick;
1323
- dblClick?: EvDblClick;
1324
- contextMenu?: EvContextMenu;
1325
- selectionChange?: EvSelectionChange;
1326
- }
1327
- /**
1328
- *
1329
- */
1330
- interface ListboxProps extends Omit<ComponentProps, 'content'> {
1331
- items?: ListItem[];
1332
- renderer?: (item: ListItem) => Component;
1333
- checkable?: true;
1334
- }
1335
- export class Listbox extends Component<ListboxProps, ListboxEvents> {
1336
- private _view;
1337
- private _selection;
1338
- private _selitem;
1339
- private _items;
1340
- preventFocus: boolean;
1341
- constructor(props: ListboxProps);
1342
- /**
1343
- *
1344
- */
1345
- private _on_key;
1346
- /**
1347
- *
1348
- */
1349
- navigate(sens: kbNav): boolean;
1350
- /**
1351
- *
1352
- */
1353
- private _on_click;
1354
- /**
1355
- *
1356
- */
1357
- private _on_ctx_menu;
1358
- /**
1359
- *
1360
- */
1361
- private _selectItem;
1362
- /**
1363
- *
1364
- */
1365
- private _findItem;
1366
- /**
1367
- *
1368
- */
1369
- private _findItemIndex;
1370
- /**
1371
- *
1372
- */
1373
- clearSelection(): void;
1374
- /**
1375
- *
1376
- */
1377
- setItems(items: ListItem[]): void;
1378
- /**
1379
- *
1380
- */
1381
- renderItem(item: ListItem): Component<ComponentProps, ComponentEvents>;
1382
- /**
1383
- *
1384
- */
1385
- defaultRenderer(item: ListItem): Component;
1386
- /**
1387
- *
1388
- */
1389
- filter(filter: string): void;
1390
- /**
1391
- * append or prepend a new item
1392
- * @param item
1393
- * @param prepend
1394
- * @param select
1395
- */
1396
- appendItem(item: ListItem, prepend?: boolean, select?: boolean): void;
1397
- /**
1398
- * update an item
1399
- */
1400
- updateItem(id: any, item: ListItem): void;
1401
- }
1402
- export {};
1403
-
1404
- }
1405
- declare module 'src/components/panel/panel' {
1406
- /**
1407
- * ___ ___ __
1408
- * \ \/ / / _
1409
- * \ / /_| |_
1410
- * / \____ _|
1411
- * /__/\__\ |_|
1412
- *
1413
- * @file panel.ts
1414
- * @author Etienne Cochard
1415
- *
1416
- * @copyright (c) 2024 R-libre ingenierie
1417
- *
1418
- * Use of this source code is governed by an MIT-style license
1419
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1420
- **/
1421
- import { Component, ComponentContent, ComponentProps } from '@core/component';
1422
- import { UnsafeHtml, Constructor } from '@core/core_tools';
1423
- import { VBox } from 'src/components/boxes/boxes';
1424
- import 'src/components/panel/panel.module.scss';
1425
- interface PanelProps extends ComponentProps {
1426
- title: string;
1427
- icon?: string;
1428
- bodyModel?: Constructor<Component>;
1429
- }
1430
- /**
1431
- *
1432
- */
1433
- export class Panel extends VBox<PanelProps> {
1434
- private _title;
1435
- private _body;
1436
- constructor(props: PanelProps);
1437
- setContent(content: ComponentContent): void;
1438
- setTitle(title: string | UnsafeHtml): void;
1439
- }
1440
- export {};
1441
-
1442
- }
1443
- declare module 'src/components/textedit/textedit' {
1444
- /**
1445
- * ___ ___ __
1446
- * \ \/ / / _
1447
- * \ / /_| |_
1448
- * / \____ _|
1449
- * /__/\__\ |_|
1450
- *
1451
- * @file textedit.ts
1452
- * @author Etienne Cochard
1453
- *
1454
- * @copyright (c) 2024 R-libre ingenierie
1455
- *
1456
- * Use of this source code is governed by an MIT-style license
1457
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1458
- **/
1459
- import { Component, ComponentProps } from '@core/component';
1460
- import { UnsafeHtml } from '@core/core_tools';
1461
- import { HBox } from 'src/components/boxes/boxes';
1462
- import 'src/components/textedit/textedit.module.scss';
1463
- /**
1464
- *
1465
- */
1466
- interface TextEditProps extends ComponentProps {
1467
- label: string | UnsafeHtml;
1468
- labelWidth?: number;
1469
- inputId?: string;
1470
- type?: "text" | "email" | "password";
1471
- readonly?: boolean;
1472
- required?: boolean;
1473
- value: string | number;
1474
- placeholder?: string;
1475
- inputGadgets?: Component[];
1476
- }
1477
- /**
1478
- *
1479
- */
1480
- export class TextEdit extends HBox {
1481
- constructor(props: TextEditProps);
1482
- }
1483
- export {};
1484
-
1485
- }
1486
- declare module 'src/components/textarea/textarea' {
1487
- /**
1488
- * ___ ___ __
1489
- * \ \/ / / _
1490
- * \ / /_| |_
1491
- * / \____ _|
1492
- * /__/\__\ |_|
1493
- *
1494
- * @file textarea.ts
1495
- * @author Etienne Cochard
1496
- *
1497
- * @copyright (c) 2024 R-libre ingenierie
1498
- *
1499
- * Use of this source code is governed by an MIT-style license
1500
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1501
- **/
1502
- import { BaseProps } from 'src/components/input/input';
1503
- import { VBox } from 'src/components/boxes/boxes';
1504
- import 'src/components/textarea/textarea.module.scss';
1505
- /**
1506
- *
1507
- */
1508
- interface TextAreaProps extends BaseProps {
1509
- label?: string;
1510
- value?: string;
1511
- resize?: boolean;
1512
- }
1513
- export class TextArea extends VBox {
1514
- private _input;
1515
- constructor(props: TextAreaProps);
1516
- }
1517
- export {};
1518
-
1519
- }
1520
- declare module 'src/components/switch/switch' {
1521
- /**
1522
- * ___ ___ __
1523
- * \ \/ / / _
1524
- * \ / /_| |_
1525
- * / \____ _|
1526
- * /__/\__\ |_|
1527
- *
1528
- * @file switch.ts
1529
- * @author Etienne Cochard
1530
- *
1531
- * @copyright (c) 2024 R-libre ingenierie
1532
- *
1533
- * Use of this source code is governed by an MIT-style license
1534
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1535
- **/
1536
- import { ComponentProps } from '@core/component';
1537
- import { HBox } from 'src/components/boxes/boxes.js';
1538
- import 'src/components/switch/switch.module.scss';
1539
- interface SwitchProps extends ComponentProps {
1540
- label: string;
1541
- checked?: boolean;
1542
- value?: string;
1543
- }
1544
- export class Switch extends HBox<SwitchProps> {
1545
- constructor(props: SwitchProps);
1546
- }
1547
- export {};
1548
-
1549
- }
1550
- declare module 'src/components/sizers/sizer' {
1551
- /**
1552
- * ___ ___ __
1553
- * \ \/ / / _
1554
- * \ / /_| |_
1555
- * / \____ _|
1556
- * /__/\__\ |_|
1557
- *
1558
- * @file sizer.ts
1559
- * @author Etienne Cochard
1560
- *
1561
- * @copyright (c) 2024 R-libre ingenierie
1562
- *
1563
- * Use of this source code is governed by an MIT-style license
1564
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1565
- **/
1566
- import { Component, ComponentEvent, ComponentEvents, ComponentProps } from '@core/component';
1567
- import 'src/components/sizers/sizer.module.scss';
1568
- /**
1569
- *
1570
- */
1571
- interface EvSizeChange extends ComponentEvent {
1572
- size: number;
1573
- }
1574
- interface CSizerEvent extends ComponentEvents {
1575
- resize: EvSizeChange;
1576
- }
1577
- export class CSizer extends Component<ComponentProps, CSizerEvent> {
1578
- private _type;
1579
- private _ref;
1580
- private _delta;
1581
- constructor(type: string, target?: Component);
1582
- private _onMouseMove;
1583
- }
1584
- export {};
1585
-
1586
- }
1587
- declare module 'src/components/popup/popup' {
1588
- /**
1589
- * ___ ___ __
1590
- * \ \/ / / _
1591
- * \ / /_| |_
1592
- * / \____ _|
1593
- * /__/\__\ |_|
1594
- *
1595
- * @file popup.ts
1596
- * @author Etienne Cochard
1597
- *
1598
- * @copyright (c) 2024 R-libre ingenierie
1599
- *
1600
- * Use of this source code is governed by an MIT-style license
1601
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1602
- **/
1603
- import { Component, ComponentEvent, ComponentEvents, ComponentProps } from '@core/component';
1604
- import { Rect } from '@core/core_tools.js';
1605
- import 'src/components/popup/popup.module.scss';
1606
- export interface PopupEvents extends ComponentEvents {
1607
- closed: ComponentEvent;
1608
- opened: ComponentEvent;
1609
- }
1610
- export interface PopupProps extends ComponentProps {
1611
- modal?: boolean;
1612
- autoClose?: boolean | string;
1613
- sizable?: boolean;
1614
- movable?: boolean;
1615
- }
1616
- /**
1617
- *
1618
- */
1619
- export class Popup<P extends PopupProps = PopupProps, E extends PopupEvents = PopupEvents> extends Component<P, E> {
1620
- private _isopen;
1621
- private _isshown;
1622
- constructor(props: P);
1623
- displayNear(rc: Rect, dst?: string, src?: string, offset?: {
1624
- x: number;
1625
- y: number;
1626
- }): void;
1627
- /**
1628
- *
1629
- */
1630
- displayCenter(): void;
1631
- /**
1632
- *
1633
- */
1634
- displayAt(x: number, y: number): void;
1635
- private _show;
1636
- show(show?: boolean): void;
1637
- isOpen(): boolean;
1638
- /**
1639
- *
1640
- */
1641
- close(): void;
1642
- /**
1643
- * binded
1644
- */
1645
- private _dismiss;
1646
- /**
1647
- * dismiss all popup belonging to the same group as 'this'
1648
- */
1649
- dismiss(after?: boolean): void;
1650
- /**
1651
- *
1652
- */
1653
- private _showModalMask;
1654
- /**
1655
- *
1656
- */
1657
- private _updateModalMask;
1658
- /**
1659
- *
1660
- */
1661
- private _createSizers;
1662
- }
1663
-
1664
- }
1665
- declare module 'src/components/combobox/combobox' {
1666
- /**
1667
- * ___ ___ __
1668
- * \ \/ / / _
1669
- * \ / /_| |_
1670
- * / \____ _|
1671
- * /__/\__\ |_|
1672
- *
1673
- * @file combobox.ts
1674
- * @author Etienne Cochard
1675
- *
1676
- * @copyright (c) 2024 R-libre ingenierie
1677
- *
1678
- * Use of this source code is governed by an MIT-style license
1679
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1680
- **/
1681
- import { Component, ComponentProps } from '@core/component';
1682
- import { ListItem } from 'src/components/listbox/listbox';
1683
- import 'src/components/combobox/combobox.module.scss';
1684
- /**
1685
- *
1686
- */
1687
- interface ComboboxProps extends Omit<ComponentProps, "content"> {
1688
- label?: string;
1689
- labelWidth?: number | string;
1690
- readonly?: boolean;
1691
- items: ListItem[];
1692
- }
1693
- export class Combobox extends Component<ComboboxProps> {
1694
- private _dropdown;
1695
- private _label;
1696
- private _input;
1697
- private _button;
1698
- private _prevent_close;
1699
- private _edit;
1700
- constructor(props: ComboboxProps);
1701
- private _on_key;
1702
- private _on_input;
1703
- private _on_focusout;
1704
- private _on_click;
1705
- showDropDown(): void;
1706
- }
1707
- export {};
1708
-
1709
- }
1710
- declare module 'src/components/slider/slider' {
1711
- /**
1712
- * ___ ___ __
1713
- * \ \/ / / _
1714
- * \ / /_| |_
1715
- * / \____ _|
1716
- * /__/\__\ |_|
1717
- *
1718
- * @file slider.ts
1719
- * @author Etienne Cochard
1720
- *
1721
- * @copyright (c) 2024 R-libre ingenierie
1722
- *
1723
- * Use of this source code is governed by an MIT-style license
1724
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1725
- **/
1726
- import { Component, ComponentEvents, ComponentProps, ComponentEvent } from '@core/component';
1727
- import 'src/components/slider/slider.module.scss';
1728
- interface ChangeEvent extends ComponentEvent {
1729
- value: number;
1730
- }
1731
- interface SliderEvents extends ComponentEvents {
1732
- change: ChangeEvent;
1733
- }
1734
- interface SliderProps extends ComponentProps {
1735
- value: number;
1736
- min: number;
1737
- max: number;
1738
- step?: number;
1739
- }
1740
- export class Slider extends Component<SliderProps, SliderEvents> {
1741
- private _mdown;
1742
- private _irect;
1743
- private _thumb;
1744
- private _bar;
1745
- private _range;
1746
- constructor(props: SliderProps);
1747
- private _on_mousedown;
1748
- private _on_mousemove;
1749
- private _update;
1750
- private _on_mouseup;
1751
- private _on_key;
1752
- }
1753
- export {};
1754
-
1755
- }
1756
- declare module 'src/components/progress/progress' {
1757
- /**
1758
- * ___ ___ __
1759
- * \ \/ / / _
1760
- * \ / /_| |_
1761
- * / \____ _|
1762
- * /__/\__\ |_|
1763
- *
1764
- * @file progress.ts
1765
- * @author Etienne Cochard
1766
- *
1767
- * @copyright (c) 2024 R-libre ingenierie
1768
- *
1769
- * Use of this source code is governed by an MIT-style license
1770
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1771
- **/
1772
- import { Component, ComponentProps } from '@core/component';
1773
- import 'src/components/progress/progress.module.scss';
1774
- interface ProgressProps extends ComponentProps {
1775
- value: number;
1776
- min: number;
1777
- max: number;
1778
- }
1779
- export class Progress extends Component<ProgressProps> {
1780
- private _bar;
1781
- constructor(props: ProgressProps);
1782
- setValue(value: number): void;
1783
- }
1784
- export {};
1785
-
1786
- }
1787
- declare module 'src/components/form/form' {
1788
- /**
1789
- * ___ ___ __
1790
- * \ \/ / / _
1791
- * \ / /_| |_
1792
- * / \____ _|
1793
- * /__/\__\ |_|
1794
- *
1795
- * @file form.ts
1796
- * @author Etienne Cochard
1797
- *
1798
- * @copyright (c) 2024 R-libre ingenierie
1799
- *
1800
- * Use of this source code is governed by an MIT-style license
1801
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1802
- **/
1803
- import { Box } from 'src/components/boxes/boxes.js';
1804
- import 'src/components/form/form.module.scss';
1805
- type FormValue = string | number | boolean;
1806
- type FormValues = Record<string, FormValue>;
1807
- export class Form extends Box {
1808
- setValues(values: FormValues): void;
1809
- getValues(): FormValues;
1810
- }
1811
- export {};
1812
-
1813
- }
1814
- declare module 'src/components/dialog/dialog' {
1815
- /**
1816
- * ___ ___ __
1817
- * \ \/ / / _
1818
- * \ / /_| |_
1819
- * / \____ _|
1820
- * /__/\__\ |_|
1821
- *
1822
- * @file dialog.ts
1823
- * @author Etienne Cochard
1824
- *
1825
- * @copyright (c) 2024 R-libre ingenierie
1826
- *
1827
- * Use of this source code is governed by an MIT-style license
1828
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1829
- **/
1830
- import { Form } from 'src/components/form/form.js';
1831
- import { PopupEvents, PopupProps, Popup } from 'src/components/popup/popup.js';
1832
- import { BtnGroupItem } from 'src/components/btngroup/btngroup';
1833
- import { ComponentEvent } from '@core/component.js';
1834
- import 'src/components/dialog/dialog.module.scss';
1835
- export interface DialogProps extends PopupProps {
1836
- icon?: string;
1837
- title: string;
1838
- form: Form;
1839
- buttons: BtnGroupItem[];
1840
- closable?: boolean;
1841
- }
1842
- export interface EvBtnClick extends Event {
1843
- button: string;
1844
- }
1845
- interface DialogEvents extends PopupEvents {
1846
- btnclick: EvBtnClick;
1847
- close: ComponentEvent;
1848
- }
1849
- /**
1850
- *
1851
- */
1852
- export class Dialog<P extends DialogProps = DialogProps, E extends DialogEvents = DialogEvents> extends Popup<P, E> {
1853
- constructor(props: P);
1854
- display(): void;
1855
- close(): void;
1856
- }
1857
- export {};
1858
-
1859
- }
1860
- declare module 'src/components/btngroup/btngroup' {
1861
- /**
1862
- * ___ ___ __
1863
- * \ \/ / / _
1864
- * \ / /_| |_
1865
- * / \____ _|
1866
- * /__/\__\ |_|
1867
- *
1868
- * @file btngroup.ts
1869
- * @author Etienne Cochard
1870
- *
1871
- * @copyright (c) 2024 R-libre ingenierie
1872
- *
1873
- * Use of this source code is governed by an MIT-style license
1874
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1875
- **/
1876
- import { ComponentEvent, ComponentEvents, ComponentProps } from '@core/component';
1877
- import { EventCallback } from '@core/core_events.js';
1878
- import { Button } from 'src/components/button/button';
1879
- import { Box } from 'src/components/boxes/boxes.js';
1880
- import { Label } from 'src/components/label/label.js';
1881
- import { EvBtnClick } from 'src/components/dialog/dialog.js';
1882
- import 'src/components/btngroup/btngroup.module.scss';
1883
- type predefined = "ok" | "cancel" | "yes" | "no" | "retry" | "abort" | "-";
1884
- export type BtnGroupItem = predefined | Button | Label;
1885
- interface BtnClickEvent extends ComponentEvent {
1886
- emitter: predefined;
1887
- }
1888
- interface BtnGroupEvents extends ComponentEvents {
1889
- btnclick: BtnClickEvent;
1890
- }
1891
- interface BtnGroupProps extends Omit<ComponentProps, "content"> {
1892
- align?: "left" | "center" | "right";
1893
- vertical?: boolean;
1894
- items: BtnGroupItem[];
1895
- reverse?: boolean;
1896
- btnclick?: EventCallback<EvBtnClick>;
1897
- }
1898
- export class BtnGroup extends Box<BtnGroupProps, BtnGroupEvents> {
1899
- constructor(props: BtnGroupProps);
1900
- /**
1901
- *
1902
- * @param btns
1903
- */
1904
- setButtons(btns: BtnGroupItem[]): void;
1905
- }
1906
- export {};
1907
-
1908
- }
1909
- declare module 'src/components/image/image' {
1910
- /**
1911
- * ___ ___ __
1912
- * \ \/ / / _
1913
- * \ / /_| |_
1914
- * / \____ _|
1915
- * /__/\__\ |_|
1916
- *
1917
- * @file image.ts
1918
- * @author Etienne Cochard
1919
- *
1920
- * @copyright (c) 2024 R-libre ingenierie
1921
- *
1922
- * Use of this source code is governed by an MIT-style license
1923
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1924
- **/
1925
- import { Component, ComponentProps } from '@core/component.js';
1926
- import 'src/components/image/image.module.scss';
1927
- export interface ImageProps extends ComponentProps {
1928
- src: string;
1929
- fit?: "contain" | "cover" | "fill" | "scale-down";
1930
- position?: string;
1931
- lazy?: boolean;
1932
- alt?: string;
1933
- draggable?: boolean;
1934
- }
1935
- /**
1936
- *
1937
- */
1938
- export class Image extends Component<ImageProps> {
1939
- private _img;
1940
- constructor(props: ImageProps);
1941
- /**
1942
- *
1943
- */
1944
- setImage(src: string): void;
1945
- }
1946
-
1947
- }
1948
- declare module 'src/components/colorinput/colorinput' {
1949
- /**
1950
- * ___ ___ __
1951
- * \ \/ / / _
1952
- * \ / /_| |_
1953
- * / \____ _|
1954
- * /__/\__\ |_|
1955
- *
1956
- * @file colorinput.ts
1957
- * @author Etienne Cochard
1958
- *
1959
- * @copyright (c) 2024 R-libre ingenierie
1960
- *
1961
- * Use of this source code is governed by an MIT-style license
1962
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1963
- **/
1964
- import { Color } from '@core/core_colors';
1965
- import { BoxProps, HBox } from 'src/components/boxes/boxes';
1966
- import 'src/components/colorinput/colorinput.module.scss';
1967
- /**
1968
- *
1969
- */
1970
- interface ColorInputProps extends BoxProps {
1971
- color: Color | string;
1972
- }
1973
- /**
1974
- *
1975
- */
1976
- export class ColorInput extends HBox<ColorInputProps> {
1977
- constructor(props: ColorInputProps);
1978
- }
1979
- export {};
1980
-
1981
- }
1982
- declare module 'src/components/colorpicker/colorpicker' {
1983
- /**
1984
- * ___ ___ __
1985
- * \ \/ / / _
1986
- * \ / /_| |_
1987
- * / \____ _|
1988
- * /__/\__\ |_|
1989
- *
1990
- * @file colorpicker.ts
1991
- * @author Etienne Cochard
1992
- *
1993
- * @copyright (c) 2024 R-libre ingenierie
1994
- *
1995
- * Use of this source code is governed by an MIT-style license
1996
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
1997
- **/
1998
- import { Color, Hsv } from '@core/core_colors';
1999
- import { ComponentEvent, ComponentEvents, ComponentProps } from '@core/component';
2000
- import { Box, BoxProps, VBox } from 'src/components/boxes/boxes';
2001
- import 'src/components/colorpicker/colorpicker.module.scss';
2002
- interface ColorPickerProps extends ComponentProps {
2003
- color: string | Color;
2004
- }
2005
- interface HueChangeEvent extends ComponentEvent {
2006
- hue: number;
2007
- }
2008
- interface AlphaChangeEvent extends ComponentEvent {
2009
- alpha: number;
2010
- }
2011
- interface SatChangeEvent extends ComponentEvent {
2012
- saturation: number;
2013
- value: number;
2014
- }
2015
- interface CommonEvents extends ComponentEvents {
2016
- hue_change: HueChangeEvent;
2017
- alpha_change: AlphaChangeEvent;
2018
- sat_change: SatChangeEvent;
2019
- }
2020
- /**
2021
- *
2022
- */
2023
- export class Saturation extends Box<BoxProps, CommonEvents> {
2024
- private mdown;
2025
- private irect;
2026
- private hsv;
2027
- private color;
2028
- private thumb;
2029
- constructor(props: BoxProps, init: Hsv);
2030
- mousedown(ev: PointerEvent): void;
2031
- mousemove(ev: PointerEvent): void;
2032
- mouseup(ev: PointerEvent): void;
2033
- updateThumbMarker(): void;
2034
- updateBaseColor(hsv: Hsv): void;
2035
- move(sens: string, delta: number): void;
2036
- }
2037
- /**
2038
- *
2039
- */
2040
- interface ChangeEvent extends ComponentEvent {
2041
- color: Color;
2042
- }
2043
- interface ColorPickerChangeEvents extends ComponentEvents {
2044
- change: ChangeEvent;
2045
- }
2046
- /**
2047
- *
2048
- */
2049
- export class ColorPicker extends VBox<ColorPickerProps, ColorPickerChangeEvents> {
2050
- private _base;
2051
- private _sat;
2052
- private _swatch;
2053
- private _hue;
2054
- private _alpha;
2055
- constructor(props: ColorPickerProps);
2056
- private _onkey;
2057
- }
2058
- export {};
2059
-
2060
- }
2061
- declare module 'src/components/menu/menu' {
2062
- /**
2063
- * ___ ___ __
2064
- * \ \/ / / _
2065
- * \ / /_| |_
2066
- * / \____ _|
2067
- * /__/\__\ |_|
2068
- *
2069
- * @file menu.ts
2070
- * @author Etienne Cochard
2071
- *
2072
- * @copyright (c) 2024 R-libre ingenierie
2073
- *
2074
- * Use of this source code is governed by an MIT-style license
2075
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
2076
- **/
2077
- import { Component } from '@core/component';
2078
- import { DOMEventHandler } from '@core/core_dom';
2079
- import { UnsafeHtml } from '@core/core_tools';
2080
- import { Popup, PopupProps } from 'src/components/popup/popup';
2081
- import 'src/components/menu/menu.module.scss';
2082
- /**
2083
- *
2084
- */
2085
- export interface MenuItem {
2086
- cls?: string;
2087
- icon?: string;
2088
- text: string | UnsafeHtml;
2089
- menu?: Menu;
2090
- disabled?: true;
2091
- click?: DOMEventHandler;
2092
- }
2093
- type MenuElement = MenuItem | Component | string;
2094
- export interface MenuProps extends Omit<PopupProps, "content"> {
2095
- items: MenuElement[];
2096
- }
2097
- /**
2098
- *
2099
- */
2100
- export class Menu extends Popup {
2101
- constructor(props: MenuProps);
2102
- }
2103
- export {};
2104
-
2105
- }
2106
- declare module 'src/components/tooltips/tooltips' {
2107
- /**
2108
- * ___ ___ __
2109
- * \ \/ / / _
2110
- * \ / /_| |_
2111
- * / \____ _|
2112
- * /__/\__\ |_|
2113
- *
2114
- * @file tooltips.ts
2115
- * @author Etienne Cochard
2116
- *
2117
- * @copyright (c) 2024 R-libre ingenierie
2118
- *
2119
- * Use of this source code is governed by an MIT-style license
2120
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
2121
- **/
2122
- import 'src/components/tooltips/tooltips.scss';
2123
- export function initTooltips(): void;
2124
-
2125
- }
2126
- declare module 'src/components/treeview/treeview' {
2127
- /**
2128
- * ___ ___ __
2129
- * \ \/ / / _
2130
- * \ / /_| |_
2131
- * / \____ _|
2132
- * /__/\__\ |_|
2133
- *
2134
- * @file treeview.ts
2135
- * @author Etienne Cochard
2136
- *
2137
- * @copyright (c) 2024 R-libre ingenierie
2138
- *
2139
- * Use of this source code is governed by an MIT-style license
2140
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
2141
- **/
2142
- import { Component, ComponentEvent, ComponentEvents, ComponentProps } from '@core/component';
2143
- import { ListItem } from 'src/components/listbox/listbox';
2144
- import 'src/components/treeview/treeview.module.scss';
2145
- export enum kbTreeNav {
2146
- first = 0,
2147
- prev = 1,
2148
- next = 2,
2149
- last = 3,
2150
- parent = 4,
2151
- child = 5,
2152
- expand = 6,
2153
- collapse = 7,
2154
- toggle = 8
2155
- }
2156
- export interface TreeItem extends ListItem {
2157
- children?: TreeItem[];
2158
- open?: boolean;
2159
- }
2160
- interface TreeviewProps extends Omit<ComponentProps, "content"> {
2161
- items: TreeItem[];
2162
- }
2163
- interface ChangeEvent extends ComponentEvent {
2164
- selection: TreeItem;
2165
- }
2166
- interface TreeviewEvents extends ComponentEvents {
2167
- change: ChangeEvent;
2168
- }
2169
- /**
2170
- *
2171
- */
2172
- export class Treeview extends Component<TreeviewProps, TreeviewEvents> {
2173
- private _selection;
2174
- private _selitem;
2175
- private _items;
2176
- constructor(props: TreeviewProps);
2177
- /**
2178
- *
2179
- */
2180
- setItems(items: TreeItem[]): void;
2181
- private _onclick;
2182
- private _onkey;
2183
- /**
2184
- *
2185
- */
2186
- navigate(sens: kbTreeNav): boolean;
2187
- private _flattenOpenItems;
2188
- private _flattenItems;
2189
- private _selectItem;
2190
- private _findItem;
2191
- /**
2192
- *
2193
- */
2194
- clearSelection(): void;
2195
- }
2196
- export {};
2197
-
2198
- }
2199
- declare module 'src/components/messages/messages' {
2200
- import { Label } from 'src/components/label/label';
2201
- import { Dialog, DialogProps } from 'src/components/dialog/dialog';
2202
- import 'src/components/messages/messages.module.scss';
2203
- import { UnsafeHtml } from '@core/core_tools.js';
2204
- export interface MessageBoxProps extends DialogProps {
2205
- message: string;
2206
- click: (button: string) => void;
2207
- }
2208
- export class MessageBox extends Dialog<DialogProps> {
2209
- m_label: Label;
2210
- constructor(props: DialogProps);
2211
- setText(txt: string | UnsafeHtml): void;
2212
- /**
2213
- * display a messagebox
2214
- */
2215
- static show(msg: string | UnsafeHtml): MessageBox;
2216
- }
2217
-
2218
- }
2219
- declare module 'src/components/calendar/calendar' {
2220
- /**
2221
- * ___ ___ __
2222
- * \ \/ / / _
2223
- * \ / /_| |_
2224
- * / \____ _|
2225
- * /__/\__\ |_|
2226
- *
2227
- * @file calendar.ts
2228
- * @author Etienne Cochard
2229
- *
2230
- * @copyright (c) 2024 R-libre ingenierie
2231
- *
2232
- * Use of this source code is governed by an MIT-style license
2233
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
2234
- **/
2235
- import { ComponentEvents, ComponentProps, EvChange } from '@core/component';
2236
- import { EventCallback } from '@core/core_events.js';
2237
- import { VBox } from 'src/components/boxes/boxes';
2238
- import 'src/components/calendar/calendar.module.scss';
2239
- interface CalendarEventMap extends ComponentEvents {
2240
- change?: EvChange;
2241
- }
2242
- interface CalendarProps extends ComponentProps {
2243
- date?: Date;
2244
- minDate?: Date;
2245
- maxDate?: Date;
2246
- change?: EventCallback<EvChange>;
2247
- }
2248
- /**
2249
- * default calendar control
2250
- *
2251
- * fires:
2252
- * EventChange ( value = Date )
2253
- */
2254
- export class Calendar extends VBox<CalendarProps, CalendarEventMap> {
2255
- private m_date;
2256
- constructor(props: CalendarProps);
2257
- /** @ignore */
2258
- private _update;
2259
- /**
2260
- * select the given date
2261
- * @param date
2262
- */
2263
- private select;
2264
- /**
2265
- *
2266
- */
2267
- private _next;
2268
- /**
2269
- *
2270
- */
2271
- private _choose;
2272
- getDate(): Date;
2273
- setDate(date: Date): void;
2274
- }
2275
- export {};
2276
- /**
2277
- * default popup calendar
2278
- * /
2279
-
2280
- export class PopupCalendar extends Popup {
2281
-
2282
- m_cal: Calendar;
2283
-
2284
- constructor(props: CalendarProps) {
2285
- super({ tabIndex: 1 });
2286
-
2287
- this.enableMask(false);
2288
-
2289
- this.m_cal = new Calendar(props);
2290
- this.m_cal.addClass('@fit');
2291
-
2292
- this.setContent(this.m_cal);
2293
- }
2294
-
2295
- // binded
2296
- private _handleClick = (e: MouseEvent) => {
2297
- if (!this.dom) {
2298
- return;
2299
- }
2300
-
2301
- let newfocus = <HTMLElement>e.target;
2302
-
2303
- // child of this: ok
2304
- if (this.dom.contains(newfocus)) {
2305
- return;
2306
- }
2307
-
2308
- // menu: ok
2309
- let dest = Component.getElement(newfocus, MenuItem);
2310
- if (dest) {
2311
- return;
2312
- }
2313
-
2314
- this.close();
2315
- }
2316
-
2317
- / ** @ignore * /
2318
- show(modal?: boolean, at?: Point ) {
2319
- x4document.addEventListener('mousedown', this._handleClick);
2320
- if( at ) {
2321
- super.displayAt( at.x, at.y, 'top left', undefined, modal );
2322
- }
2323
- else {
2324
- super.show(modal);
2325
- }
2326
- }
2327
-
2328
- / ** @ignore * /
2329
- close() {
2330
- x4document.removeEventListener('mousedown', this._handleClick);
2331
- super.close();
2332
- }
2333
- }
2334
- */
2335
-
2336
- }
2337
- declare module 'src/components/notification/notification' {
2338
- /**
2339
- * ___ ___ __
2340
- * \ \/ / / _
2341
- * \ / /_| |_
2342
- * / \____ _|
2343
- * /__/\__\ |_|.2
2344
- *
2345
- * @file notification.ts
2346
- * @author Etienne Cochard
2347
- *
2348
- * @copyright (c) 2024 R-libre ingenierie
2349
- *
2350
- * Use of this source code is governed by an MIT-style license
2351
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
2352
- **/
2353
- import { ComponentProps } from '@core/component.js';
2354
- import { UnsafeHtml } from '@core/core_tools.js';
2355
- import { Popup } from 'src/components/popup/popup.js';
2356
- import 'src/components/notification/notification.module.scss';
2357
- /**
2358
- *
2359
- */
2360
- interface NotificationProps extends ComponentProps {
2361
- loading?: boolean;
2362
- iconId?: string;
2363
- closable?: boolean;
2364
- mode?: "success" | "danger";
2365
- title: string;
2366
- text: string | UnsafeHtml;
2367
- }
2368
- /**
2369
- *
2370
- */
2371
- export class Notification extends Popup {
2372
- constructor(props: NotificationProps);
2373
- close(): void;
2374
- display(time_in_s?: number): void;
2375
- }
2376
- export {};
2377
-
2378
- }
2379
- declare module 'src/components/header/header' {
2380
- import { ComponentProps } from '@core/component.js';
2381
- import { HBox } from 'src/components/boxes/boxes.js';
2382
- import 'src/components/header/header.module.scss';
2383
- interface HeaderItem {
2384
- name: string;
2385
- title: string;
2386
- iconId?: string;
2387
- width?: number;
2388
- }
2389
- interface HeaderProps extends Omit<ComponentProps, "content"> {
2390
- items: HeaderItem[];
2391
- }
2392
- export class Header extends HBox<HeaderProps> {
2393
- private _els;
2394
- private _vwp;
2395
- constructor(props: HeaderProps);
2396
- private _calc_sizes;
2397
- private _on_resize;
2398
- }
2399
- export {};
2400
-
2401
- }
2402
- declare module 'src/components/tabs/tabs' {
2403
- /**
2404
- * ___ ___ __
2405
- * \ \/ / / _
2406
- * \ / /_| |_
2407
- * / \____ _|
2408
- * /__/\__\ |_|.2
2409
- *
2410
- * @file tabs.ts
2411
- * @author Etienne Cochard
2412
- *
2413
- * @copyright (c) 2024 R-libre ingenierie
2414
- *
2415
- * Use of this source code is governed by an MIT-style license
2416
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
2417
- **/
2418
- import { Component, ComponentProps } from '@core/component';
2419
- import { VBox } from 'src/components/boxes/boxes';
2420
- import 'src/components/tabs/tabs.module.scss';
2421
- /**
2422
- *
2423
- */
2424
- export interface TabItem {
2425
- name: string;
2426
- title: string;
2427
- icon?: string;
2428
- tab: Component;
2429
- }
2430
- /**
2431
- *
2432
- */
2433
- interface TabsProps extends Omit<ComponentProps, "content"> {
2434
- default: string;
2435
- items: TabItem[];
2436
- }
2437
- export class Tabs extends VBox<TabsProps> {
2438
- private _list;
2439
- private _stack;
2440
- constructor(props: TabsProps);
2441
- selectTab(name: string): void;
2442
- private _onclick;
2443
- }
2444
- export {};
2445
-
2446
- }
2447
- declare module 'src/components/rating/rating' {
2448
- /**
2449
- * ___ ___ __
2450
- * \ \/ / / _
2451
- * \ / /_| |_
2452
- * / \____ _|
2453
- * /__/\__\ |_|.2
2454
- *
2455
- * @file rating.ts
2456
- * @author Etienne Cochard
2457
- *
2458
- * @copyright (c) 2024 R-libre ingenierie
2459
- *
2460
- * Use of this source code is governed by an MIT-style license
2461
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
2462
- **/
2463
- import { ComponentEvents, ComponentProps, EvChange } from '@core/component.js';
2464
- import { EventCallback } from '@core/core_events.js';
2465
- import { HBox } from 'src/components/boxes/boxes.js';
2466
- import 'src/components/rating/rating.module.scss';
2467
- interface RatingEventMap extends ComponentEvents {
2468
- change: EvChange;
2469
- }
2470
- export interface RatingProps extends ComponentProps {
2471
- steps?: number;
2472
- value?: number;
2473
- icon?: string;
2474
- name?: string;
2475
- change?: EventCallback<EvChange>;
2476
- }
2477
- export class Rating extends HBox<RatingProps, RatingEventMap> {
2478
- private m_els;
2479
- private m_input;
2480
- constructor(props: RatingProps);
2481
- private _update;
2482
- getValue(): number;
2483
- setValue(v: number): void;
2484
- setSteps(n: number): void;
2485
- setShape(icon: string): void;
2486
- private _on_click;
2487
- }
2488
- export {};
2489
-
2490
- }
2491
- declare module 'src/main' {
2492
- /**
2493
- * ___ ___ __
2494
- * \ \/ / / _
2495
- * \ / /_| |_
2496
- * / \____ _|
2497
- * /__/\__\ |_|
2498
- *
2499
- * DEMO FILE
2500
- *
2501
- **/
2502
- import '@fontsource/montserrat';
2503
- import 'src/main.scss';
2504
-
2505
- }
2506
- declare module 'src/core/core_dragdrop' {
2507
- /**
2508
- * ___ ___ __
2509
- * \ \/ / / _
2510
- * \ / /_| |_
2511
- * / \____ _|
2512
- * /__/\__\ |_|
2513
- *
2514
- * @file core_dragdrop.ts
2515
- * @author Etienne Cochard
2516
- *
2517
- * @copyright (c) 2024 R-libre ingenierie
2518
- *
2519
- * Use of this source code is governed by an MIT-style license
2520
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
2521
- **/
2522
- import { Component } from 'src/core/component';
2523
- import { Point } from 'src/core/core_tools';
2524
- interface DropInfo {
2525
- pt: Point;
2526
- data: DataTransfer;
2527
- }
2528
- type DropCallback = (command: 'enter' | 'leave' | 'drag' | 'drop', el: Component, infos: DropInfo) => void;
2529
- type FilterCallback = (el: Component) => boolean; class DragManager {
2530
- dragSource: Component;
2531
- dragGhost: HTMLElement;
2532
- dropTarget: Component;
2533
- notified: Component;
2534
- timer: any;
2535
- /**
2536
- *
2537
- */
2538
- registerDraggableElement(el: Component): void;
2539
- /**
2540
- *
2541
- */
2542
- registerDropTarget(el: Component, cb: DropCallback, filterCB?: FilterCallback): void;
2543
- _startCheck(): void;
2544
- _check(): void;
2545
- }
2546
- export const dragManager: DragManager;
2547
- export {};
2548
-
2549
- }
2550
- declare module 'src/core/core_router' {
2551
- /**
2552
- * ___ ___ __
2553
- * \ \/ / / _
2554
- * \ / /_| |_
2555
- * / \____ _|
2556
- * /__/\__\ |_|.2
2557
- *
2558
- * @file core_router.ts
2559
- * @author Etienne Cochard
2560
- *
2561
- * @copyright (c) 2024 R-libre ingenierie
2562
- *
2563
- * Use of this source code is governed by an MIT-style license
2564
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
2565
- **/
2566
- import { EvError } from 'src/core/component.js';
2567
- import { EventMap, EventSource } from 'src/core/core_events.js';
2568
- type RouteHandler = (params: any, path: string) => void;
2569
- interface RouterEvents extends EventMap {
2570
- error: EvError;
2571
- }
2572
- /**
2573
- * micro router
2574
- *
2575
- * ```
2576
- * const router = new Router( );
2577
- *
2578
- * router.get( "/detail/:id", ( params: any ) => {
2579
- * this._showDetail( detail );
2580
- * } );
2581
- *
2582
- * router.get( "/:id", ( params: any ) => {
2583
- * if( params.id==0 )
2584
- * router.navigate( '/home' );
2585
- * }
2586
- * });
2587
- *
2588
- * router.on( "error", ( ) => {
2589
- * router.navigate( '/home' );
2590
- * })
2591
- *
2592
- * router.init( );
2593
- * ```
2594
- */
2595
- export class Router extends EventSource<RouterEvents> {
2596
- private m_routes;
2597
- private m_useHash;
2598
- constructor(useHash?: boolean);
2599
- get(uri: string | RegExp, handler: RouteHandler): void;
2600
- init(): void;
2601
- private _getLocation;
2602
- navigate(uri: string, notify?: boolean, replace?: boolean): void;
2603
- private _find;
2604
- }
2605
- export {};
2606
-
2607
- }
2608
- declare module '*.scss' {
2609
- const content: { [className: string]: string };
2610
- export default content;
2611
- }
2612
- declare module '*.svg' {
2613
- const content: string;
2614
- export default content;
2615
- }
2616
- declare module 'types/x4react' {
2617
- export {}; global {
2618
- namespace JSX {
2619
- interface IntrinsicElements {
2620
- [elemName: string]: any;
2621
- }
2622
- }
2623
- }
2624
- }