swing-ui 0.1.25 → 1.0.1

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 (116) hide show
  1. package/LICENSE +5 -4
  2. package/README.md +144 -7
  3. package/SwingUI.js +2611 -0
  4. package/classes/Arc.js +185 -0
  5. package/classes/Button.js +55 -0
  6. package/classes/CheckBox.js +33 -0
  7. package/classes/CheckBoxMenuItem.js +24 -0
  8. package/classes/ComboBox.js +329 -0
  9. package/classes/ComponentContainer.js +828 -0
  10. package/classes/ContextMenu.js +141 -0
  11. package/classes/DocumentEditor.js +168 -0
  12. package/classes/Ellipse.js +76 -0
  13. package/classes/InternalWindow.js +397 -0
  14. package/classes/InternalWindowContainer.js +93 -0
  15. package/classes/Label.js +52 -0
  16. package/classes/Line.js +105 -0
  17. package/classes/List.js +452 -0
  18. package/classes/MediaPlayer.js +504 -0
  19. package/classes/Menu.js +74 -0
  20. package/classes/MenuBar.js +56 -0
  21. package/classes/MenuItem.js +92 -0
  22. package/classes/Panel.js +50 -0
  23. package/classes/PasswordField.js +47 -0
  24. package/classes/Polygon.js +236 -0
  25. package/classes/Polyline.js +240 -0
  26. package/classes/ProgressBar.js +62 -0
  27. package/classes/RadioButton.js +110 -0
  28. package/classes/RadioButtonMenuItem.js +106 -0
  29. package/classes/Rectangle.js +199 -0
  30. package/classes/ScrollPane.js +53 -0
  31. package/classes/ScrollableComponent.js +141 -0
  32. package/classes/Separator.js +24 -0
  33. package/classes/Shape.js +584 -0
  34. package/classes/ShapeContainer.js +231 -0
  35. package/classes/Slider.js +172 -0
  36. package/classes/Spinner.js +172 -0
  37. package/classes/SplitView.js +82 -0
  38. package/classes/Stroke.js +115 -0
  39. package/classes/Table.js +982 -0
  40. package/classes/Tabs.js +228 -0
  41. package/classes/TextArea.js +125 -0
  42. package/classes/TextComponent.js +207 -0
  43. package/classes/TextField.js +128 -0
  44. package/classes/TextShape.js +123 -0
  45. package/classes/ToggleButton.js +147 -0
  46. package/classes/ToolBar.js +120 -0
  47. package/classes/TrayIcon.js +54 -0
  48. package/classes/Tree.js +569 -0
  49. package/classes/UIComponent.js +2113 -0
  50. package/classes/Window.js +609 -0
  51. package/enums.js +298 -0
  52. package/fonts.conf +32 -0
  53. package/functions.js +254 -0
  54. package/icon.png +0 -0
  55. package/index.js +109 -4
  56. package/jar/gui-11.jar +0 -0
  57. package/jar/lib/flatlaf.jar +0 -0
  58. package/jar/lib/jna.jar +0 -0
  59. package/package.json +58 -33
  60. package/typedefs.js +973 -0
  61. package/types/SwingUI.d.ts +727 -0
  62. package/types/classes/Arc.d.ts +111 -0
  63. package/types/classes/Button.d.ts +38 -0
  64. package/types/classes/CheckBox.d.ts +22 -0
  65. package/types/classes/CheckBoxMenuItem.d.ts +18 -0
  66. package/types/classes/ComboBox.d.ts +172 -0
  67. package/types/classes/ComponentContainer.d.ts +131 -0
  68. package/types/classes/ContextMenu.d.ts +74 -0
  69. package/types/classes/DocumentEditor.d.ts +95 -0
  70. package/types/classes/Ellipse.d.ts +34 -0
  71. package/types/classes/InternalWindow.d.ts +163 -0
  72. package/types/classes/InternalWindowContainer.d.ts +36 -0
  73. package/types/classes/Label.d.ts +33 -0
  74. package/types/classes/Line.d.ts +48 -0
  75. package/types/classes/List.d.ts +223 -0
  76. package/types/classes/MediaPlayer.d.ts +381 -0
  77. package/types/classes/Menu.d.ts +43 -0
  78. package/types/classes/MenuBar.d.ts +26 -0
  79. package/types/classes/MenuItem.d.ts +57 -0
  80. package/types/classes/Panel.d.ts +28 -0
  81. package/types/classes/PasswordField.d.ts +22 -0
  82. package/types/classes/Polygon.d.ts +93 -0
  83. package/types/classes/Polyline.d.ts +96 -0
  84. package/types/classes/ProgressBar.d.ts +36 -0
  85. package/types/classes/RadioButton.d.ts +70 -0
  86. package/types/classes/RadioButtonMenuItem.d.ts +71 -0
  87. package/types/classes/Rectangle.d.ts +82 -0
  88. package/types/classes/ScrollPane.d.ts +23 -0
  89. package/types/classes/ScrollableComponent.d.ts +81 -0
  90. package/types/classes/Separator.d.ts +14 -0
  91. package/types/classes/Shape.d.ts +223 -0
  92. package/types/classes/ShapeContainer.d.ts +92 -0
  93. package/types/classes/Slider.d.ts +107 -0
  94. package/types/classes/Spinner.d.ts +129 -0
  95. package/types/classes/SplitView.d.ts +47 -0
  96. package/types/classes/Stroke.d.ts +99 -0
  97. package/types/classes/Table.d.ts +652 -0
  98. package/types/classes/Tabs.d.ts +118 -0
  99. package/types/classes/TextArea.d.ts +45 -0
  100. package/types/classes/TextComponent.d.ts +136 -0
  101. package/types/classes/TextField.d.ts +94 -0
  102. package/types/classes/TextShape.d.ts +73 -0
  103. package/types/classes/ToggleButton.d.ts +84 -0
  104. package/types/classes/ToolBar.d.ts +82 -0
  105. package/types/classes/TrayIcon.d.ts +43 -0
  106. package/types/classes/Tree.d.ts +354 -0
  107. package/types/classes/UIComponent.d.ts +945 -0
  108. package/types/classes/Window.d.ts +334 -0
  109. package/types/enums.d.ts +437 -0
  110. package/types/functions.d.ts +109 -0
  111. package/types/index.d.ts +188 -0
  112. package/types/typedefs.d.ts +1626 -0
  113. package/ui-process-manager.js +317 -0
  114. package/video-devices-linux.sh +72 -0
  115. package/video-devices-mac.sh +33 -0
  116. package/CHANGES.md +0 -3
@@ -0,0 +1,437 @@
1
+ /**
2
+ * *
3
+ */
4
+ export type ShortcutScope = number;
5
+ /**
6
+ * A keyboard shortcut binding scope. Used to set when a keyboard shortcut should emit a KeyEvent for onShortcutAction() event handler using a {@link UIComponent#shortcuts|shortcuts()} method.
7
+ *
8
+ * @readonly
9
+ * @global
10
+ * @enum {number}
11
+ * @property {number} Focused - When the component has focus (default for non-container components).
12
+ * @property {number} Ancestor - When any child or their children have a focus (default for container components, other than Window).
13
+ * @property {number} Window - When component is in focused window (default for Window component).
14
+ * @see UIComponent#shortcuts
15
+ * @see UIComponent#onShortcut
16
+ */
17
+ export const ShortcutScope: Readonly<{
18
+ Focused: 0;
19
+ Ancestor: 1;
20
+ Window: 2;
21
+ }>;
22
+ /**
23
+ * *
24
+ */
25
+ export type DragDropAction = string;
26
+ /**
27
+ * Enum for drag and drop actions.
28
+ * Used with `dragAction()` and `dropAction()`.
29
+ *
30
+ * @readonly
31
+ * @global
32
+ * @enum {string}
33
+ * @property {string} None - No action.
34
+ * @property {string} Copy - Copy action.
35
+ * @property {string} Move - Move action.
36
+ * @property {string} CopyOrMove - Copy or move action.
37
+ * @property {string} Link - Link action.
38
+ * @see UIComponent#dragAction
39
+ * @see UIComponent#dropAction
40
+ * @example
41
+ * list.dragAction(DragDropAction.CopyOrMove);
42
+ * list.dropAction(DragDropAction.CopyOrMove);
43
+ */
44
+ export const DragDropAction: Readonly<{
45
+ None: "None";
46
+ Copy: "Copy";
47
+ Move: "Move";
48
+ CopyOrMove: "CopyOrMove";
49
+ Link: "Link";
50
+ }>;
51
+ /**
52
+ * *
53
+ */
54
+ export type DropMode = string;
55
+ /**
56
+ * Used with dropMode() in Table, List, and Tree
57
+ *
58
+ * @readonly
59
+ * @global
60
+ * @enum {string}
61
+ * @property {string} On - Drop on items.
62
+ * @property {string} Insert - Insert between items
63
+ * @property {string} OnOrInsert - Drop on items and between items
64
+ * @see {@link List#dropMode|List.dropMode()}
65
+ * @see {@link Table#dropMode|Table.dropMode()}
66
+ * @see {@link Tree#dropMode|Tree.dropMode()}
67
+ * @example
68
+ * table.dropMode(DropMode.OnOrInsert);
69
+ */
70
+ export const DropMode: Readonly<{
71
+ On: "On";
72
+ Insert: "Insert";
73
+ OnOrInsert: "OnOrInsert";
74
+ }>;
75
+ /**
76
+ * *
77
+ */
78
+ export type MouseAction = number;
79
+ /**
80
+ * Enum for mouse actions.
81
+ * Used with `ui.mouseAction(action, button)`.
82
+ *
83
+ * @readonly
84
+ * @global
85
+ * @enum {number}
86
+ * @property {number} Press - Mouse button press.
87
+ * @property {number} Release - Mouse button release.
88
+ * @property {number} Click - Single click.
89
+ * @property {number} DoubleClick - Double click.
90
+ * @property {number} VerticalScroll - Vertical wheel scroll.
91
+ * @property {number} HorizontalScroll - Horizontal wheel scroll.
92
+ * @see SwingUI#mouseAction
93
+ * @example <h2>Performing a mouse click:</h2>
94
+ * ui.mouseAction(MouseAction.Click, MouseButton.Left);
95
+ */
96
+ export const MouseAction: Readonly<{
97
+ Press: 0;
98
+ Release: 1;
99
+ Click: 2;
100
+ DoubleClick: 3;
101
+ VerticalScroll: 4;
102
+ HorizontalScroll: 5;
103
+ }>;
104
+ /**
105
+ * *
106
+ */
107
+ export type MouseButton = number;
108
+ /**
109
+ * Enum for mouse buttons.
110
+ * Compare to `mouseEvent.button` on mouse events or use with `ui.mouseAction(action, button)`.
111
+ *
112
+ * @readonly
113
+ * @global
114
+ * @enum {number}
115
+ * @property {number} Left - Left mouse button.
116
+ * @property {number} Right - Right mouse button.
117
+ * @property {number} Middle - Middle mouse button.
118
+ * @see SwingUI#mouseAction
119
+ * @see UIComponent#onMouseEvents
120
+ * @example <h2>Checking if right mouse button was clicked:</h2>
121
+ * if(mouseEvent.button === MouseButton.Right)
122
+ * {
123
+ * console.log("Right click);
124
+ * }
125
+ * @example <h2>Performing a mouse click:</h2>
126
+ * ui.mouseAction(MouseAction.Click, MouseButton.Left);
127
+ */
128
+ export const MouseButton: Readonly<{
129
+ Left: 1;
130
+ Right: 3;
131
+ Middle: 2;
132
+ }>;
133
+ /**
134
+ * *
135
+ */
136
+ export type KeyAction = number;
137
+ /**
138
+ * Keyboard key actions to be performed on the computer. Use it only with `ui.keyboardAction(action, value)` to perform key actions.
139
+ *
140
+ * @readonly
141
+ * @global
142
+ * @enum {number}
143
+ * @property {number} Press - Key press.
144
+ * @property {number} Release - Key release.
145
+ * @property {number} Type - Key typed (typed character input).
146
+ * @see SwingUI#keyboardAction
147
+ * @example <h2>Performing a key type action:</h2>
148
+ * ui.keyboardAction(KeyAction.Type, "A");
149
+ */
150
+ export const KeyAction: Readonly<{
151
+ Press: 0;
152
+ Release: 1;
153
+ Type: 2;
154
+ }>;
155
+ /**
156
+ * *
157
+ */
158
+ export type MessageIcon = number;
159
+ /**
160
+ * Enum for standard message dialog icons. Used in `alert()`, `dialog()` and `TrayIcon.showNotification()`.
161
+ *
162
+ * @readonly
163
+ * @global
164
+ * @enum {number}
165
+ * @property {number} Error - Error icon.
166
+ * @property {number} Info - Information icon.
167
+ * @property {number} Warning - Warning icon.
168
+ * @property {number} Question - Question icon.
169
+ * @see alert
170
+ * @see dialog
171
+ * @see TrayIcon#showNotification
172
+ * @example
173
+ * alert("This file doesn't exist!", "File Absent", MessageIcon.Warning);
174
+ */
175
+ export const MessageIcon: Readonly<{
176
+ Error: 0;
177
+ Info: 1;
178
+ Warning: 2;
179
+ Question: 3;
180
+ }>;
181
+ /**
182
+ * *
183
+ */
184
+ export type SelectionMode = number;
185
+ /**
186
+ * Enum for selection modes in UI components like Table, List, Tree. Used with `selectionMode()` to set of get a selection mode of a list of items or rows.
187
+ *
188
+ * @readonly
189
+ * @global
190
+ * @enum {number}
191
+ * @property {number} Single - Single item selection.
192
+ * @property {number} Range - Range selection (shift-click).
193
+ * @property {number} Multiple - Multiple selection (ctrl/cmd-click).
194
+ * @see Table#selectionMode
195
+ * @see List#selectionMode
196
+ * @see Tree#selectionMode
197
+ * @example
198
+ * table.selectionMode(SelectionMode.Single);
199
+ */
200
+ export const SelectionMode: Readonly<{
201
+ Single: 0;
202
+ Range: 1;
203
+ Multiple: 2;
204
+ }>;
205
+ /**
206
+ * *
207
+ */
208
+ export type FontFamily = string;
209
+ /**
210
+ * An enum for generic font family names to use instead of a font name that may not be installed on target operating systems.
211
+ * Use with `component.font()`, `Text()` shape, `font` property of a List item, Tree item, ComboBox item, Table column, and everywhere else where font can be set.
212
+ *
213
+ * @readonly
214
+ * @global
215
+ * @enum {string}
216
+ * @property {string} Serif - Proportional font with small decorative strokes at the ends of letters (e.g., Times New Roman, Georgia, Garamond, Cambria.).
217
+ * @property {string} SansSerif - Proportional font without decorative strokes; clean and modern (e.g., Arial, Helvetica, Verdana, Calibri, Open Sans).
218
+ * @property {string} Monospaced - Fixed-width font where every character has the same width (e.g., Courier New, Consolas, Lucida Console, Menlo).
219
+ * @property {string} Cursive - Flowing, handwritten-style font (e.g., Brush Script, Comic Sans MS, Pacifico, Lobster).
220
+ * @property {string} System - The system UI font provided by the operating system. (e.g., Segoe UI (Windows), San Francisco (macOS/iOS), Roboto (Android/Linux)).
221
+ * @property {string} Fantasy - Decorative or themed font (e.g., Impact, Papyrus, Jokerman, Copperplate).
222
+ * @see UIComponent#font
223
+ * @see Text
224
+ * @example <h2>Setting component font:</h2>
225
+ * textarea.font({name: FontFamily.SansSerif});
226
+ *
227
+ * @example <h2>Setting Text shape font:</h2>
228
+ * let text = new Text("Hello World", {name: FontFamily.Fantasy, size: 30});
229
+ */
230
+ export const FontFamily: Readonly<{
231
+ Serif: "serif";
232
+ SansSerif: "sans-serif";
233
+ Monospaced: "monospace";
234
+ Cursive: "cursive";
235
+ System: "system-ui";
236
+ Fantasy: "fantasy";
237
+ }>;
238
+ /**
239
+ * *
240
+ */
241
+ export type DataType = string;
242
+ /**
243
+ * Enum for data types used with drag and drop.
244
+ * Used with `dragDataType()`, `dropDataType()`, and to check if certain data type was dragged onto component.
245
+ *
246
+ * @readonly
247
+ * @global
248
+ * @enum {string}
249
+ * @property {string} None - No data.
250
+ * @property {string} All - Accept any type. Used only for dropDataType().
251
+ * @property {string} Text - Plain text.
252
+ * @property {string} HTML - HTML content.
253
+ * @property {string} Image - Image data.
254
+ * @property {string} Files - Files copied to system clipboard or dragged/dropped.
255
+ * @property {string} URIList - List of URIs.
256
+ * @property {string} URL - A single URL string.
257
+ * @property {string} JSON - JSON-encoded data.
258
+ * @property {string} TextEncoding - Text encoding used to encode the Text and/or HTML values.
259
+ * @property {string} Components - UI components (`component/*`).
260
+ * @example <h2>Sets the type of data list items represent when dragged:</h2>
261
+ * list.dragDataType(DataType.Files);
262
+ * @example <h2>Sets the type of data Table component accepts:</h2>
263
+ * table.dropDataType([DataType.Files, DataType.URIList, DataType.URL]);
264
+ * @example <h2>Check if expected data type was dragged onto Label:</h2>
265
+ * label.dropAction(DragDropAction.CopyOrMove).dropDataType(DataType.Files).onDropEvents(e => {
266
+ * if(e.type === "drop" && Array.isArray(e.data[DataType.Filest]))
267
+ * {
268
+ * // set first file as label's icon image
269
+ * e.target.icon(e.data[DataType.Files][0]);
270
+ * }
271
+ * });
272
+ */
273
+ export const DataType: Readonly<{
274
+ None: "None";
275
+ All: "All";
276
+ Text: "Text";
277
+ HTML: "HTML";
278
+ Image: "Image";
279
+ Files: "Files";
280
+ URIList: "URIList";
281
+ URL: "URL";
282
+ JSON: "JSON";
283
+ Components: "component/*";
284
+ }>;
285
+ /**
286
+ * *
287
+ */
288
+ export type TextAction = number;
289
+ /**
290
+ * Enum for actions on text components (TextField, TextArea, etc.). To be used in text() method.
291
+ *
292
+ * @readonly
293
+ * @global
294
+ * @enum {number}
295
+ * @property {number} Set - Replace all text.
296
+ * @property {number} Prepend - Add text at the beginning.
297
+ * @property {number} Append - Add text at the end.
298
+ * @property {number} Insert - Insert at current caret position.
299
+ * @property {number} ReplaceSelection - Replace selected text.
300
+ * @see UIComponent#text
301
+ * @example <h2>Appending text to TextArea component:</h2>
302
+ * let textarea = new TextArea("Hello").text(" World!", TextAction.Append);
303
+ * // text area will contain text "Hello World!"
304
+ */
305
+ export const TextAction: Readonly<{
306
+ Set: 0;
307
+ Prepend: 1;
308
+ Append: 2;
309
+ Insert: 3;
310
+ ReplaceSelection: 4;
311
+ }>;
312
+ /**
313
+ * *
314
+ */
315
+ export type Cursor = number;
316
+ /**
317
+ * Enum for available mouse cursors.
318
+ *
319
+ * @readonly
320
+ * @global
321
+ * @enum {number}
322
+ * @property {number} Default - Default cursor.
323
+ * @property {number} Crosshair - Crosshair.
324
+ * @property {number} Text - Text input cursor.
325
+ * @property {number} Wait - Wait/busy cursor.
326
+ * @property {number} ResizeSW - Resize south-west.
327
+ * @property {number} ResizeSE - Resize south-east.
328
+ * @property {number} ResizeNW - Resize north-west.
329
+ * @property {number} ResizeNE - Resize north-east.
330
+ * @property {number} ResizeN - Resize north.
331
+ * @property {number} ResizeS - Resize south.
332
+ * @property {number} ResizeW - Resize west.
333
+ * @property {number} ResizeE - Resize east.
334
+ * @property {number} Hand - Pointing hand.
335
+ * @property {number} Move - Move cursor.
336
+ * @see UIComponent#cursor
337
+ * @example <h2>Sets "Wait" cursor to Panel component:</h2>
338
+ * panel.cursor(Cursor.Wait);
339
+ */
340
+ export const Cursor: Readonly<{
341
+ Default: 0;
342
+ Crosshair: 1;
343
+ Text: 2;
344
+ Wait: 3;
345
+ ResizeSW: 4;
346
+ ResizeSE: 5;
347
+ ResizeNW: 6;
348
+ ResizeNE: 7;
349
+ ResizeN: 8;
350
+ ResizeS: 9;
351
+ ResizeW: 10;
352
+ ResizeE: 11;
353
+ Hand: 12;
354
+ Move: 13;
355
+ }>;
356
+ /**
357
+ * *
358
+ */
359
+ export type Orientation = number;
360
+ /**
361
+ * Enum for component orientation, such as Slider or Toolbar.
362
+ *
363
+ * @readonly
364
+ * @global
365
+ * @enum {number}
366
+ * @property {number} Horizontal - Horizontal orientation.
367
+ * @property {number} Vertical - Vertical orientation.
368
+ * @see SplitView#orientation
369
+ * @see ToolBar#orientation
370
+ * @example <h2>Setting orientation to a component:</h2>
371
+ * toolbar.orientation(Orientation.Vertical);
372
+ */
373
+ export const Orientation: Readonly<{
374
+ Horizontal: 0;
375
+ Vertical: 1;
376
+ }>;
377
+ /**
378
+ * *
379
+ */
380
+ export type BorderStyle = string;
381
+ /**
382
+ * Border style enum. Use in a border object..
383
+ *
384
+ * @readonly
385
+ * @global
386
+ * @enum {string}
387
+ * @property {string} None - No border.
388
+ * @property {string} Line - Solid line.
389
+ * @property {string} Dashed - Dashed border.
390
+ * @property {string} Metal - Metallic style.
391
+ * @property {string} EtchedRaised - Etched raised border.
392
+ * @property {string} EtchedLowered - Etched lowered border.
393
+ * @property {string} BevelRaised - Bevel raised border.
394
+ * @property {string} BevelLowered - Bevel lowered border.
395
+ * @property {string} SoftRaised - Soft raised border.
396
+ * @property {string} SoftLowered - Soft lowered border.
397
+ * @see UIComponent#border
398
+ * @example <h2>Setting a new border:</h2>
399
+ * let border = {style: BorderStyle.Dashed, size: 2, color: "#002288"}
400
+ * panel.border(border);
401
+ */
402
+ export const BorderStyle: Readonly<{
403
+ None: "none";
404
+ Line: "line";
405
+ Dashed: "dashed";
406
+ Metal: "metal";
407
+ EtchedRaised: "etched_raised";
408
+ EtchedLowered: "etched_lowered";
409
+ BevelRaised: "bevel_raised";
410
+ BevelLowered: "bevel_lowered";
411
+ SoftRaised: "soft_raised";
412
+ SoftLowered: "soft_lowered";
413
+ }>;
414
+ /**
415
+ * *
416
+ */
417
+ export type LineWrap = number;
418
+ /**
419
+ * Enum for word wrapping styles.
420
+ * Used with `lineWrap()` method in TextArea and DocumentEditor to control how text is wrapped.
421
+ *
422
+ * @readonly
423
+ * @global
424
+ * @enum {number}
425
+ * @property {number} None - Disable line wrapping.
426
+ * @property {number} Word - Wrap line when a full word doesn't fit.
427
+ * @property {number} Character - Wrap line when a character doesn't fit.
428
+ * @see TextArea#lineWrapping
429
+ * @see DocumentEditor#lineWrapping
430
+ * @example <h2>Setting line wrapping style:</h2>
431
+ * textarea.lineWrap(LineWrap.Word);
432
+ */
433
+ export const LineWrap: Readonly<{
434
+ None: 0;
435
+ Word: 1;
436
+ Character: 2;
437
+ }>;
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Displays a dialog windows with error message and error icon.
3
+ *
4
+ * @param {string|Error} message - Error message to display or Error object to display stack trace.
5
+ * @param {boolean|Error} [show_stack_trace=true] - Whether to show stack trace to be able to trace the error (applies only when first parameter is not an Error object).
6
+ * @return {void} Does not return a value
7
+ * @global
8
+ * @example <h2>Showing an error message only:</h2>
9
+ * error("Invalid parameters passed.", false);
10
+ *
11
+ * @example <h2>Showing an error message with a stack trace:</h2>
12
+ * error("Invalid parameters passed.");
13
+ *
14
+ * @example <h2>Showing an error message by passing an Error object:</h2>
15
+ * try
16
+ * {
17
+ * // some code that may throw an error
18
+ * }
19
+ * catch(ex)
20
+ * {
21
+ * error(ex);
22
+ * }
23
+ *
24
+ */
25
+ export function error(message: string | Error, show_stack_trace?: boolean | Error): void;
26
+ /**
27
+ * Returns a text representation of passed variable. Similar to JSON.stringify().
28
+ *
29
+ * @internal
30
+ * @ignore
31
+ * @global
32
+ * @param {any} variable - Any variable to be converted to a string representation
33
+ * @return {string} Serialized object as a String
34
+ */
35
+ export function stringify(variable: any): string;
36
+ /**
37
+ * Displays a dialog window with a specified error message and an error icon.
38
+ *
39
+ * @param {string} message - A message to be displayed in the dialog window
40
+ * @param {string} [title="Message"] - Dialog window title bar text
41
+ * @param {MessageIcon} [icon=MessageIcon.Info] - Icon to show in the dialog window.
42
+ *
43
+ * Valid value are:
44
+ * - MessageIcon.Error
45
+ * - MessageIcon.Info
46
+ * - MessageIcon.Warning
47
+ * - MessageIcon.Question
48
+ *
49
+ * @param {Window} [ownerWindow=null] - If set, the message dialog window will attempts to be centered at specified window
50
+ * @return {void} Does not return a value
51
+ * @global
52
+ *
53
+ * @example <h2>Simple usage with only one parameter:</h2>
54
+ * alert("File name is invalid. Please try again");
55
+ *
56
+ * @example <h2>Usage example when passing all parameters:</h2>
57
+ * alert("File name is invalid. Please try again","Invalid File", MessageIcon.Warning, this);
58
+ */
59
+ export function alert(message: string, title?: string, icon?: MessageIcon, ownerWindow?: Window): void;
60
+ /**
61
+ * Requests user for text input in a dialog window. Returns a string as user's input or undefined when user declined to input.
62
+ *
63
+ * @param {string} message - Message to user about this text input.
64
+ * @param {string} [default_value=""] - Default string that will be already present in the dialog window.
65
+ * @param {Window} [ownerWindow=null] - Window that will be overlaid by the dialog window.
66
+ * @returns {string|undefined} Returns user provided string, or `undefined` if user canceled input.
67
+ * @global
68
+ * @example
69
+ * let response = prompt("Please enter your name:", "John Doe", this);
70
+ * console.log("You entered: " + response);
71
+ */
72
+ export function prompt(message: string, default_value?: string, ownerWindow?: Window): string | undefined;
73
+ /**
74
+ * Displays a confirmation dialog to user and returns user's response as boolean.
75
+ *
76
+ * @param {string} message - Message to display to user
77
+ * @param {Window} [window=null] - Window which dialog window will overlay. If omitted, last created visible Window that's not PopUp will be used.
78
+ * @return {boolean} Returns `true` if user confirms the message, or `false` otherwise.
79
+ * @global
80
+ * @example
81
+ * if(confirm("Delete this file?", this))
82
+ * {
83
+ * // delete code
84
+ * }
85
+ */
86
+ export function confirm(message: string, window?: Window): boolean;
87
+ /**
88
+ * Shows a custom dialog window that allows the user to respond by clicking one of provided buttons.
89
+ *
90
+ * @param {string} message - String message to user. It can be plain text or HTML.
91
+ * @param {string} [title=""] - Dialog window title shown in the title bar of the window
92
+ * @param {string[]} [buttons=["OK","Cancel"]] - An Array of button names. Indicate a default button by surrounding the text with square brackets like so: "[Cancel]"
93
+ * @param {MessageIcon|string} [icon=null] - One of MessageIcon icons, or an absolute path to an image from a file system.
94
+ * @param {Window} [window=null] - Owner window that will be overlaid by this dialog window. If omitted, last created visible Window that's not PopUp will be used.
95
+ * @return {number|undefined} Returns a zero-based number of a clicked button, or `null` if the dialog window was closed without clicking provided buttons.
96
+ * @global
97
+ * @example <h2>Usage example</h2>
98
+ * let response = dialog("Are you ready?", "Confirm readiness", ["Yes", "No", "[Maybe]"], MessageIcon.Question, window);
99
+ * switch(response)
100
+ * {
101
+ * case 0: return "Yes";
102
+ * case 1: return "No";
103
+ * case 2: return "Maybe";
104
+ * }
105
+ *
106
+ * @example <h2>Using custom image</h2>
107
+ * let response = dialog("Is this you?", "Question #5", ["Yes","[No]"], "C://User/John/profile_icon.jpg", window);
108
+ */
109
+ export function dialog(message: string, title?: string, buttons?: string[], icon?: MessageIcon | string, window?: Window): number | undefined;