x4js 1.5.22 → 1.5.24

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 (70) hide show
  1. package/lib/cjs/index.js +9 -9
  2. package/lib/cjs/index.js.map +3 -3
  3. package/lib/esm/index.mjs +15731 -9
  4. package/lib/esm/index.mjs.map +3 -3
  5. package/lib/src/component.ts +18 -12
  6. package/lib/src/datastore.ts +45 -57
  7. package/lib/src/drag_manager.ts +23 -6
  8. package/lib/src/layout.ts +13 -1
  9. package/lib/src/router.ts +50 -9
  10. package/lib/src/version.ts +1 -1
  11. package/lib/types/action.d.ts +57 -0
  12. package/lib/types/app_sockets.d.ts +29 -0
  13. package/lib/types/application.d.ts +104 -0
  14. package/lib/types/autocomplete.d.ts +58 -0
  15. package/lib/types/base_component.d.ts +88 -0
  16. package/lib/types/button.d.ts +151 -0
  17. package/lib/types/calendar.d.ts +82 -0
  18. package/lib/types/canvas.d.ts +92 -0
  19. package/lib/types/cardview.d.ts +87 -0
  20. package/lib/types/checkbox.d.ts +77 -0
  21. package/lib/types/color.d.ts +148 -0
  22. package/lib/types/colorpicker.d.ts +107 -0
  23. package/lib/types/combobox.d.ts +107 -0
  24. package/lib/types/component.d.ts +601 -0
  25. package/lib/types/datastore.d.ts +396 -0
  26. package/lib/types/dialog.d.ts +175 -0
  27. package/lib/types/dom_events.d.ts +302 -0
  28. package/lib/types/drag_manager.d.ts +58 -0
  29. package/lib/types/drawtext.d.ts +48 -0
  30. package/lib/types/fileupload.d.ts +64 -0
  31. package/lib/types/form.d.ts +133 -0
  32. package/lib/types/formatters.d.ts +35 -0
  33. package/lib/types/gridview.d.ts +175 -0
  34. package/lib/types/i18n.d.ts +73 -0
  35. package/lib/types/icon.d.ts +64 -0
  36. package/lib/types/image.d.ts +55 -0
  37. package/lib/types/index.d.ts +84 -5896
  38. package/lib/types/input.d.ts +91 -0
  39. package/lib/types/label.d.ts +58 -0
  40. package/lib/types/layout.d.ts +89 -0
  41. package/lib/types/link.d.ts +50 -0
  42. package/lib/types/listview.d.ts +178 -0
  43. package/lib/types/md5.d.ts +61 -0
  44. package/lib/types/menu.d.ts +130 -0
  45. package/lib/types/messagebox.d.ts +69 -0
  46. package/lib/types/panel.d.ts +47 -0
  47. package/lib/types/popup.d.ts +75 -0
  48. package/lib/types/property_editor.d.ts +71 -0
  49. package/lib/types/radiobtn.d.ts +73 -0
  50. package/lib/types/rating.d.ts +53 -0
  51. package/lib/types/request.d.ts +52 -0
  52. package/lib/types/router.d.ts +67 -0
  53. package/lib/types/settings.d.ts +37 -0
  54. package/lib/types/sidebarview.d.ts +49 -0
  55. package/lib/types/spreadsheet.d.ts +222 -0
  56. package/lib/types/styles.d.ts +85 -0
  57. package/lib/types/svgcomponent.d.ts +215 -0
  58. package/lib/types/tabbar.d.ts +58 -0
  59. package/lib/types/tabview.d.ts +49 -0
  60. package/lib/types/textarea.d.ts +77 -0
  61. package/lib/types/textedit.d.ts +123 -0
  62. package/lib/types/toaster.d.ts +42 -0
  63. package/lib/types/tools.d.ts +394 -0
  64. package/lib/types/tooltips.d.ts +46 -0
  65. package/lib/types/treeview.d.ts +144 -0
  66. package/lib/types/version.d.ts +29 -0
  67. package/lib/types/x4dom.d.ts +49 -0
  68. package/lib/types/x4events.d.ts +269 -0
  69. package/lib/types/x4react.d.ts +41 -0
  70. package/package.json +1 -1
@@ -0,0 +1,123 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \_/ / / _
4
+ * \ / /_| |_
5
+ * / _ \____ _|
6
+ * /__/ \__\ |_|
7
+ *
8
+ * @file textedit.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
+ * of the Software, and to permit persons to whom the Software is furnished to do so,
18
+ * subject to the following conditions:
19
+ * The above copyright notice and this permission notice shall be included in all copies
20
+ * or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+ **/
29
+ import { Component, EvFocus, HtmlString } from './component';
30
+ import { Input, InputProps, InputEventMap, EditType } from './input';
31
+ import { IconID } from './icon';
32
+ import { EvClick, EvChange, EventCallback } from './x4events';
33
+ type ValidationFunction = (value: string) => string;
34
+ interface TextEditEventMap extends InputEventMap {
35
+ click: EvClick;
36
+ change: EvChange;
37
+ focus: EvFocus;
38
+ }
39
+ export interface TextEditProps extends InputProps<TextEditEventMap> {
40
+ label?: string | HtmlString;
41
+ labelWidth?: number;
42
+ labelAlign?: 'left' | 'right' | 'top';
43
+ required?: boolean;
44
+ spellcheck?: boolean;
45
+ icon?: IconID;
46
+ pattern?: string;
47
+ uppercase?: boolean;
48
+ format?: string | 'native';
49
+ autosel?: boolean;
50
+ gadgets?: Component[];
51
+ validator?: ValidationFunction;
52
+ change?: EventCallback<EvChange>;
53
+ click?: EventCallback<EvClick>;
54
+ focus?: EventCallback<EvFocus>;
55
+ }
56
+ /**
57
+ * TextEdit is a single line editor, it can have a label and an error descriptor.
58
+ */
59
+ export declare class TextEdit<T extends TextEditProps = TextEditProps, E extends TextEditEventMap = TextEditEventMap> extends Component<T, E> {
60
+ private m_cal_popup;
61
+ protected m_ui_input: Input;
62
+ private m_error_tip;
63
+ constructor(props: T);
64
+ componentCreated(): void;
65
+ componentDisposed(): void;
66
+ focus(): void;
67
+ /** @ignore */
68
+ render(props: TextEditProps): void;
69
+ enable(ena?: boolean): void;
70
+ disable(): void;
71
+ private _btnClick;
72
+ /**
73
+ * select the value format for input/output on textedit of type date
74
+ * cf. formatIntlDate / parseIntlDate
75
+ * @param fmt
76
+ */
77
+ setDateStoreFormat(fmt: string): void;
78
+ setStoreValue(value: any): void;
79
+ getStoreValue(): any;
80
+ private _date_get_hook;
81
+ private _date_set_hook;
82
+ showError(text: string): void;
83
+ clearError(): void;
84
+ get value(): string;
85
+ set value(value: string);
86
+ /**
87
+ * select all the text
88
+ */
89
+ selectAll(): void;
90
+ select(start: number, length?: number): void;
91
+ getSelection(): {
92
+ start: number;
93
+ length: number;
94
+ };
95
+ set readOnly(ro: boolean);
96
+ get label(): string | HtmlString;
97
+ set label(text: string | HtmlString);
98
+ /**
99
+ * content changed
100
+ * todo: should move into Input
101
+ */
102
+ private _change;
103
+ /**
104
+ * getting focus
105
+ */
106
+ private _focus;
107
+ /**
108
+ * loosing focus
109
+ * @param value
110
+ */
111
+ private _blur;
112
+ /**
113
+ * todo: should move into Input
114
+ * @returns
115
+ */
116
+ validate(): boolean;
117
+ protected _validate(value: string): boolean;
118
+ _date_validator(value: string): string;
119
+ private _showDatePicker;
120
+ get input(): Input;
121
+ get type(): EditType;
122
+ }
123
+ export {};
@@ -0,0 +1,42 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \_/ / / _
4
+ * \ / /_| |_
5
+ * / _ \____ _|
6
+ * /__/ \__\ |_|
7
+ *
8
+ * @file toaster.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
+ * of the Software, and to permit persons to whom the Software is furnished to do so,
18
+ * subject to the following conditions:
19
+ * The above copyright notice and this permission notice shall be included in all copies
20
+ * or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+ **/
29
+ import { IconID } from './icon';
30
+ import { Popup, PopupProps } from './popup';
31
+ export interface ToasterProps extends PopupProps {
32
+ message: string;
33
+ icon?: IconID;
34
+ }
35
+ export declare class Toaster extends Popup<ToasterProps> {
36
+ private m_message;
37
+ private m_icon;
38
+ constructor(props: ToasterProps);
39
+ /** @ignore */
40
+ render(): void;
41
+ show(): void;
42
+ }
@@ -0,0 +1,394 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \_/ / / _
4
+ * \ / /_| |_
5
+ * / _ \____ _|
6
+ * /__/ \__\ |_|
7
+ *
8
+ * @file tools.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
+ * of the Software, and to permit persons to whom the Software is furnished to do so,
18
+ * subject to the following conditions:
19
+ * The above copyright notice and this permission notice shall be included in all copies
20
+ * or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+ **/
29
+ /**
30
+ * @return true is the device has touch
31
+ */
32
+ export declare function isTouchDevice(): boolean;
33
+ /**
34
+ * round to a given number of decimals
35
+ * @param num numbre to round
36
+ * @param ndec number of decimals
37
+ * @returns number rounded
38
+ */
39
+ export declare function roundTo(num: number, ndec: number): number;
40
+ /**
41
+ * parse an intl formatted number
42
+ * understand grouping and ',' separator
43
+ * @review us format: grouping = ','
44
+ * @param num
45
+ */
46
+ export declare function parseIntlFloat(num: string): number;
47
+ /**
48
+ * inverse of camel case
49
+ * theThingToCase -> the-thing-to-case
50
+ * @param {String} str
51
+ */
52
+ export declare function pascalCase(string: string): string;
53
+ export declare function camelCase(text: string): string;
54
+ export type Constructor<T> = new (...args: any[]) => T;
55
+ export declare class Point {
56
+ x: number;
57
+ y: number;
58
+ constructor(x?: number, y?: number);
59
+ }
60
+ export declare class Size {
61
+ width: number;
62
+ height: number;
63
+ constructor(w?: number, h?: number);
64
+ }
65
+ export declare class Rect {
66
+ left: number;
67
+ top: number;
68
+ width: number;
69
+ height: number;
70
+ constructor();
71
+ constructor(rc: Rect);
72
+ constructor(rc: DOMRect);
73
+ constructor(left: number, top: number, width: number, height: number);
74
+ set(left: number, top: number, width: number, height: number): void;
75
+ get bottom(): number;
76
+ set bottom(bottom: number);
77
+ get right(): number;
78
+ set right(right: number);
79
+ get topLeft(): Point;
80
+ get bottomRight(): Point;
81
+ get size(): Size;
82
+ moveTo(left: number, top: number): this;
83
+ movedTo(left: number, top: number): Rect;
84
+ moveBy(dx: number, dy: number): this;
85
+ movedBy(dx: number, dy: number): Rect;
86
+ isEmpty(): boolean;
87
+ normalize(): this;
88
+ normalized(): Rect;
89
+ /**
90
+ * @deprecated
91
+ */
92
+ containsPt(x: number, y: number): boolean;
93
+ contains(pt: Point): boolean;
94
+ contains(rc: Rect): boolean;
95
+ touches(rc: Rect): boolean;
96
+ inflate(dx: number, dy?: number): void;
97
+ inflatedBy(dx: number, dy?: number): Rect;
98
+ combine(rc: Rect): void;
99
+ }
100
+ /**
101
+ * replace {0..9} by given arguments
102
+ * @param format string
103
+ * @param args
104
+ *
105
+ * @example ```ts
106
+ *
107
+ * console.log( sprintf( 'here is arg 1 {1} and arg 0 {0}', 'argument 0', 'argument 1' ) )
108
+ */
109
+ export declare function sprintf(format: string, ...args: any[]): string;
110
+ /**
111
+ * replace special characters for display
112
+ * @param unsafe
113
+ *
114
+ * console.log( escapeHtml('<div style="width:50px; height: 50px; background-color:red"></div>') );
115
+ */
116
+ export declare function escapeHtml(unsafe: string, nl_br?: boolean): string;
117
+ /**
118
+ * replace special characters for display
119
+ * @author Steven Levithan <http://slevithan.com/>
120
+ * @param unsafe
121
+ *
122
+ * console.log( removeHtmlTags('<h1>sss</h1>') );
123
+ */
124
+ export declare function removeHtmlTags(unsafe: string, nl_br?: boolean): string;
125
+ /**
126
+ * change the current locale for misc translations (date...)
127
+ * @param locale
128
+ */
129
+ export declare function _date_set_locale(locale: string): void;
130
+ /**
131
+ *
132
+ * @param date
133
+ * @param options
134
+ * @example
135
+ * let date = new Date( );
136
+ * let options = { day: 'numeric', month: 'numeric', year: 'numeric', hour: 'numeric', minute: 'numeric' };
137
+ * let text = date_format( date, options );
138
+ */
139
+ export declare function date_format(date: Date, options?: any): string;
140
+ /**
141
+ *
142
+ * @param date
143
+ * @param options
144
+ */
145
+ export declare function date_diff(date1: Date, date2: Date, options?: any): string;
146
+ export declare function date_to_sql(date: Date, withHours: boolean): string;
147
+ /**
148
+ * construct a date from an utc date time (sql format)
149
+ * YYYY-MM-DD HH:MM:SS
150
+ */
151
+ export declare function date_sql_utc(date: string): Date;
152
+ /**
153
+ * return a number that is a representation of the date
154
+ * this number can be compared with another hash
155
+ */
156
+ export declare function date_hash(date: Date): number;
157
+ /**
158
+ * return a copy of a date
159
+ */
160
+ export declare function date_clone(date: Date): Date;
161
+ /**
162
+ * return the week number of a date
163
+ */
164
+ export declare function date_calc_weeknum(date: Date): number;
165
+ /**
166
+ * parse a date according to the given format
167
+ * @param value - string date to parse
168
+ * @param fmts - format list - i18 tranlation by default
169
+ * allowed format specifiers:
170
+ * d or D: date (1 or 2 digits)
171
+ * m or M: month (1 or 2 digits)
172
+ * y or Y: year (2 or 4 digits)
173
+ * h or H: hours (1 or 2 digits)
174
+ * i or I: minutes (1 or 2 digits)
175
+ * s or S: seconds (1 or 2 digits)
176
+ * <space>: 1 or more spaces
177
+ * any other char: <0 or more spaces><the char><0 or more spaces>
178
+ * each specifiers is separated from other by a pipe (|)
179
+ * more specific at first
180
+ * @example
181
+ * 'd/m/y|d m Y|dmy|y-m-d h:i:s|y-m-d'
182
+ */
183
+ export declare function parseIntlDate(value: string, fmts?: string): Date;
184
+ /**
185
+ * format a date as string
186
+ * @param date - date to format
187
+ * @param fmt - format
188
+ * format specifiers:
189
+ * d: date
190
+ * D: 2 digits date padded with 0
191
+ * j: day of week short mode 'mon'
192
+ * J: day of week long mode 'monday'
193
+ * w: week number
194
+ * m: month
195
+ * M: 2 digits month padded with 0
196
+ * o: month short mode 'jan'
197
+ * O: month long mode 'january'
198
+ * y or Y: year
199
+ * h: hour (24 format)
200
+ * H: 2 digits hour (24 format) padded with 0
201
+ * i: minutes
202
+ * I: 2 digits minutes padded with 0
203
+ * s: seconds
204
+ * S: 2 digits seconds padded with 0
205
+ * a: am or pm
206
+ * anything else is inserted
207
+ * if you need to insert some text, put it between {}
208
+ *
209
+ * @example
210
+ *
211
+ * 01/01/1970 11:25:00 with '{this is my demo date formatter: }H-i*M'
212
+ * "this is my demo date formatter: 11-25*january"
213
+ */
214
+ export declare function formatIntlDate(date: Date, fmt?: string): string;
215
+ export declare function calcAge(birth: Date, ref?: Date): number;
216
+ /**
217
+ * date object patch
218
+ */
219
+ declare global {
220
+ interface Date {
221
+ hash(): number;
222
+ clone(): Date;
223
+ weekNum(): number;
224
+ format(format: string): string;
225
+ isSameDay(date: Date): boolean;
226
+ addDays(days: number): any;
227
+ }
228
+ }
229
+ /**
230
+ *
231
+ * @param data data to export
232
+ * @param mimetype - 'text/plain'
233
+ */
234
+ export declare function downloadData(data: any, mimetype: string, filename: string): void;
235
+ /**
236
+ * check if a value is a string
237
+ * @param val
238
+ */
239
+ export declare function isString(val: any): val is string;
240
+ /**
241
+ * check is a value is an array
242
+ * @param val
243
+ */
244
+ export declare function isArray(val: any): val is any[];
245
+ /**
246
+ *
247
+ */
248
+ export declare function isFunction(val: any): val is Function;
249
+ /**
250
+ *
251
+ */
252
+ export declare function isLiteralObject(val: any): boolean;
253
+ /**
254
+ * prepend 0 to a value to a given length
255
+ * @param value
256
+ * @param length
257
+ */
258
+ export declare function pad(what: unknown, size: number, ch?: string): string;
259
+ /**
260
+ * return true if val is a finite number
261
+ */
262
+ export declare function isNumber(val: any): val is number;
263
+ /**
264
+ *
265
+ * @param name
266
+ */
267
+ export declare function waitFontLoading(name: string): Promise<void>;
268
+ /**
269
+ *
270
+ * @param fn
271
+ * @param tm
272
+ *
273
+ * @example:
274
+ *
275
+ * defer( ( ) => {
276
+ * console.log( x );
277
+ * } )( );
278
+ */
279
+ export declare function deferCall(fn: Function, tm?: number, ...args: any[]): void;
280
+ /**
281
+ *
282
+ */
283
+ export declare function asap(cb: (time: number) => void): void;
284
+ /**
285
+ * micro md to html
286
+ *
287
+ * understand:
288
+ * **bold**
289
+ * *italic*
290
+ *
291
+ * > quote
292
+ * - list
293
+ * # title lvl 1
294
+ * ## title lvl 2
295
+ * ### title lvl 3 ...
296
+ *
297
+ */
298
+ export declare function markdownToHtml(text: string): string;
299
+ /**
300
+ *
301
+ */
302
+ export declare class NetworkError extends Error {
303
+ private m_code;
304
+ constructor(response: Response);
305
+ constructor(code: number, text: string);
306
+ get code(): number;
307
+ }
308
+ /**
309
+ * return the mouse pos in client coordinates
310
+ * handle correctly touch & mouse
311
+ */
312
+ export declare function getMousePos(ev: UIEvent, fromDoc: boolean): Point;
313
+ /**
314
+ * clamp a value
315
+ * @param v - value to clamp
316
+ * @param min - min value
317
+ * @param max - max value
318
+ * @returns clamped value
319
+ */
320
+ export declare function clamp(v: number, min: number, max: number): number;
321
+ /**
322
+ *
323
+ */
324
+ export interface IDisposable {
325
+ dispose(): any;
326
+ }
327
+ export declare class HtmlString extends String {
328
+ constructor(text: string);
329
+ static from(text: string): HtmlString;
330
+ }
331
+ export declare function html(a: any, ...b: any[]): HtmlString;
332
+ export declare function isHtmlString(val: any): val is HtmlString;
333
+ export declare class Clipboard {
334
+ static copy(data: any): void;
335
+ static paste(cb: (data: string) => void): void;
336
+ }
337
+ /**
338
+ * Calculates the CRC32 checksum of a string.
339
+ * taken from: https://gist.github.com/wqli78/1330293/6d85cc967f32cccfcbad94ae7d088a3dcfc14bd9
340
+ *
341
+ * @param {String} str
342
+ * @param {Boolean} hex
343
+ * @return {String} checksum
344
+ * @api public
345
+ */
346
+ export declare function crc32(str: any): number;
347
+ /**
348
+ * taken from this excellent article:
349
+ * https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/
350
+ *
351
+ * @example:
352
+ * class MyClass extends mix(MyBaseClass).with(Mixin1, Mixin2) {
353
+ * }
354
+ **/
355
+ export declare const mix: (superclass: any) => MixinBuilder;
356
+ declare class MixinBuilder {
357
+ private superclass;
358
+ constructor(superclass: any);
359
+ with(...mixins: any[]): any;
360
+ }
361
+ /**
362
+ * @example
363
+ *
364
+ * ```
365
+ * const cls = classNames( 'class1 class2', {
366
+ * 'class3': false,
367
+ * 'class4': true,
368
+ * });
369
+ *
370
+ * // even shorter
371
+ * const class1 = true, class2 = false;
372
+ * const cls = classNames( { class1, class2 } ); // cls = "class1"
373
+ *
374
+ * ```
375
+ *
376
+ * @returns
377
+ */
378
+ export declare function classNames(...args: (string | any)[]): string;
379
+ /**
380
+ *
381
+ */
382
+ interface PasswordRule {
383
+ chars: string;
384
+ min: number;
385
+ }
386
+ export declare function generatePassword(length: number, rules?: PasswordRule[]): string;
387
+ /**
388
+ * taken from live-server
389
+ * https://github.com/tapio/live-server
390
+ * @param host
391
+ * @param port
392
+ */
393
+ export declare function installHMR(host?: string, port?: string, reloadCallback?: Function): void;
394
+ export {};
@@ -0,0 +1,46 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \_/ / / _
4
+ * \ / /_| |_
5
+ * / _ \____ _|
6
+ * /__/ \__\ |_|
7
+ *
8
+ * @file tooltips.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
+ * of the Software, and to permit persons to whom the Software is furnished to do so,
18
+ * subject to the following conditions:
19
+ * The above copyright notice and this permission notice shall be included in all copies
20
+ * or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+ **/
29
+ import { Component } from './component';
30
+ /**
31
+ *
32
+ */
33
+ export declare class Tooltip extends Component {
34
+ private m_text;
35
+ set text(text: any);
36
+ /** @ignore */
37
+ render(): void;
38
+ /**
39
+ * display the menu at a specific position
40
+ * @param x
41
+ * @param y
42
+ */
43
+ displayAt(x: number, y: number, align?: string): void;
44
+ }
45
+ export type TooltipHandler = (text: string) => void;
46
+ export declare function initTooltips(cb?: TooltipHandler): void;