swing-ui 0.1.25 → 1.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 (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 +2154 -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 +966 -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,223 @@
1
+ /**
2
+ * Shape class is used to create shapes that can be drawn in the background of {@link Window} or {@link Panel} components. This class is usually extended by other shapes. It can be used by itself only if the ` path ` argument is provided.
3
+ *
4
+ * Path of the shape can be generated by adding, subtracting, or intersecting two shapes, then convert the Shape to JSON object using shape.toObject(). Then the resulting object will have a ` path ` property.
5
+ *
6
+ * Check out all the shapes that derive from this Shape class: {@link Arc}, {@link Ellipse}, {@link Line}, {@link Polygon}, {@link Polyline}, {@link Rectangle}, and a {@link Text} that can draw text as a shape.
7
+ *
8
+ * @class
9
+ * @global
10
+ */
11
+ export class Shape {
12
+ /**
13
+ * Converts JSON object back to Shape. To convert Shape to object use Shape.toObject() function.
14
+ *
15
+ * @param {object} object - An object that has properties to recreate a Shape object.
16
+ * @returns {Shape} Returns a new instance of `Shape`.
17
+ */
18
+ static fromObject(object: object): Shape;
19
+ /**
20
+ * Shape constructor.
21
+ *
22
+ * @param {string|undefined} [path] - Path consisting of points. It can be auto-generated by performing operations of one shape to another, such as add() or subtract().
23
+ * @param {Stroke|null} [stroke] - A border of the shape.
24
+ * @param {string|null} [background] - Color, gradient, image, and background options like in CSS.
25
+ * @param {number} [opacity] - Opacity of the shape as a decimal between 0 and 1.
26
+ * @param {number} [x] - Position of the shape from left edge.
27
+ * @param {number} [y] - Position of the shape from the top.
28
+ * @throws {TypeError} When stroke, opacity or other argument types are invalid.
29
+ */
30
+ constructor(path?: string | undefined, stroke?: Stroke | null, background?: string | null, opacity?: number, x?: number, y?: number);
31
+ _type: string;
32
+ /**
33
+ * Add this shape to a container.
34
+ *
35
+ * @param {ShapeContainer} container - Panel or Window component.
36
+ * @param {number} index - Optional index to insert the shape.
37
+ * @returns {Shape} Returns `this` Shape instance for chaining.
38
+ * @throws {TypeError} When a container is not Panel or Window component.
39
+ * @throws {Error} When specified index is out of bounds.
40
+ * @see ShapeComponent#addShape
41
+ * @see Shape#remove
42
+ */
43
+ addTo(container: ShapeContainer, index?: number): Shape;
44
+ /**
45
+ * Removes this Shape from its container component.
46
+ *
47
+ * @returns {Shape} `this` Shape container for chaining.
48
+ * @see ShapeComponent#removeComponent
49
+ * @see Shape#addTo
50
+ */
51
+ remove(): Shape;
52
+ /**
53
+ * Returns current parent component (Window or Panel), or `undefined` if the shape isn't added to any component.
54
+ *
55
+ * @readonly
56
+ * @type {Window|Panel|undefined}
57
+ */
58
+ readonly get parent(): Window | Panel | undefined;
59
+ /**
60
+ * Sets or gets a {@link Stroke} of the shape.
61
+ *
62
+ * @param {Stroke} [stroke] - Stroke object
63
+ * @return {Stroke|this} When called without parameters, current `Stroke` is returned; otherwise this `Shape` is returned for method chaining.
64
+ */
65
+ stroke(...args: any[]): Stroke | this;
66
+ /**
67
+ * Returns a JSON object that contains shape properties.
68
+ *
69
+ * @param {string} [include="all"] - Specified what to include. "all" is default. Valid values are: "all", "stroke", "background", "points", "basic". Each shape that derives from this `Shape` class may also have it's own values.
70
+ * @return {Shape} Returns this `Shape` for method chaining.
71
+ */
72
+ toObject(include?: string): Shape;
73
+ /**
74
+ * Updates properties of this Shape. It's called by other methods of Shape object when shape properties change.
75
+ *
76
+ * @param {string|boolean} [what="all"] - What to update: "all", "min", "stroke", "background", "points". Shapes that derive from this class may also have their own values. Pass a `boolean` to enable and disable this shape redraw. Before making multiple changes to the Shape it helps to disable redraw, make the changes, then enable redraw.
77
+ * @returns {void}
78
+ * @internal
79
+ * @ignore
80
+ */
81
+ update(what?: string | boolean): void;
82
+ /**
83
+ * Sets or gets location of the shape relative to top-left corner of its parent component.
84
+ *
85
+ * @param {number|Point} [x] - X position integer or a Point position object (e.g., {x:10,y:40}).
86
+ * @param {number} [y] - Y position integer.
87
+ * @return {Point|this} If called without arguments, current position object is returned; otherwise this shape is returned for method chaining.
88
+ * @see Point
89
+ */
90
+ position(...args: any[]): Point | this;
91
+ /**
92
+ * Moves the Shape by adding the specified x and y values to its current position.
93
+ * The function shifts the element's position relative to current position.
94
+ * If arguments are invalid integer values, the Shape will not be moved.
95
+ *
96
+ * @param {number} [dx=0] - Delta x (can be positive or negative number)
97
+ * @param {number} [dy=0] - Delta y (can be positive or negative number)
98
+ * @return {Shape} Returns `this` Shape instance.
99
+ */
100
+ move(dx?: number, dy?: number): Shape;
101
+ /**
102
+ * Sets or gets X position of the shape relative to left edge of its parent component.
103
+ *
104
+ * @param {number} [x] - X position integer.
105
+ * @return {number|this} If called without arguments, current X position is returned; otherwise this shape is returned for method chaining.
106
+ * @see Shape#position
107
+ */
108
+ x(...args: any[]): number | this;
109
+ /**
110
+ * Sets or gets Y position of the shape relative to top edge of its parent component (for Window parent component gets Y position from the top of content area).
111
+ *
112
+ * @param {number} [y] - Y position integer.
113
+ * @return {number|this} If called without arguments, current Y position is returned; otherwise this shape is returned for method chaining.
114
+ * @see Shape#position
115
+ */
116
+ y(...args: any[]): number | this;
117
+ /**
118
+ * Gets or sets the opacity (transparency) of the shape.
119
+ *
120
+ * @param {number} [opacity] - Decimal value between 0 and 1 (inclusive).
121
+ * @returns {number|this} If called without arguments, returns the current opacity; otherwise, returns this shape for method chaining.
122
+ */
123
+ opacity(...args: any[]): number | this;
124
+ /**
125
+ * Gets or sets the rotation angle of the shape around its anchor.
126
+ *
127
+ * Use the `anchor()` method to specify the anchor position relative to the shape.
128
+ *
129
+ * The default anchor is set to the top-left corner of the shape's bounding rectangle (even for non-rectangular shapes).
130
+ *
131
+ * @param {number} [angle] - Rotation angle in degrees. Values below 0 or above 360 are normalized to the range 0–360 using the modulus operator (%).
132
+ * @return {number|this} If called without arguments, returns the current value; otherwise this shape is returned for method chaining.
133
+ * @see Shape#anchor
134
+ */
135
+ angle(angle?: number): number | this;
136
+ /**
137
+ * Sets or gets the anchor position relative to the shape, around which the shape can be rotated using the `angle()` method.
138
+ *
139
+ * The default anchor is at the top-left corner of the shape's bounding rectangle (even for non-rectangular shapes).
140
+ *
141
+ * @param {Point} [anchor] - Anchor point around which the shape rotates when the rotation angle is not 0.
142
+ * @returns {Point|this} If called without arguments, returns the current anchor; otherwise, returns this shape for method chaining.
143
+ * @see Point
144
+ * @see Shape#angle
145
+ */
146
+ anchor(...args: any[]): Point | this;
147
+ /**
148
+ * Sets or gets the background of the shape.
149
+ *
150
+ * The `background` value can be a string that contains a mixture of background color, image path (relative or absolute), base64 encoded image string, linear-gradient, radial-gradient, like in CSS in web browsers. Some features may not be supported though.
151
+ * Background settings like position, image stretching or repeating, opacity and more are supported.
152
+ *
153
+ * See examples below.
154
+ *
155
+ * @param {string} [background] - Background string. If omitted, returns the current value.
156
+ * @returns {this|string} If called without parameters, returns this shape instance; otherwise returns current background.
157
+ *
158
+ * @example
159
+ * shape.background("#FF000055 url(images/bg.png) center no-repeat opacity=0.6 10px 15px linear-gradient(#DDDDDD55, #F8F8F855 10%) / auto);
160
+ * panel.background("url(data:image/png;base64,As8fE4fdt1r.....)")); // supports base64 encoded image string
161
+ */
162
+ background(...args: any[]): this | string;
163
+ /**
164
+ * Returns the size of a shape. Does not set a new size. Some shapes override this function and size can be set for those shapes. (e.g. Rectangle, Ellipse)
165
+ *
166
+ * @param {Size} [size] - Size formatted object, but only for shapes that allow setting new size, such as Rectangle or Ellipse.
167
+ * @returns {Size|this} If called without parameters, returns current size, or `null` if the shape is not added to a component. When setting size, this shape instance is returned for method chaining.
168
+ * @throws Error When the shape is not added to a container.
169
+ * @see Size
170
+ */
171
+ size(...args: any[]): Size | this;
172
+ /**
173
+ * Sets or gets whether the shape is visible.
174
+ *
175
+ * @param {boolean} [visible] - `true` to show, `false` to hide.
176
+ * @return {boolean|Shape} When setting a value, this shape is returned; otherwise current value is returned.
177
+ */
178
+ visible(...args: any[]): boolean | Shape;
179
+ /**
180
+ * Sets or gets whether this shape is active (`true` by default).
181
+ *
182
+ * An inactive shape (`active(false)`) does not produce events `mousedown`, `mouseup`, `click`, `mouseenter`, `mouseleave`, `mousemove` on {@link Panel#onShapeEvents}, and is skipped during mouse hit-testing. This means the mouse "passes through" the shape as if it weren't there — if another shape lies beneath it, that shape is considered to be under the mouse instead.
183
+ *
184
+ * Settings active to `false` may be useful for purely decorative shapes (e.g. background fills, watermarks, static overlays) that shouldn't intercept or respond to mouse interaction.
185
+ *
186
+ * @param {boolean} [active] - `false` to make the shape inactive (ignored by shape events and mouse hit-testing), `true` to restore normal behavior. Omit to get the current value.
187
+ * @return {boolean|Shape} When called without arguments, returns the current value; otherwise returns this `Shape` instance for method chaining.
188
+ * @default true
189
+ * @see Panel#onShapeEvents
190
+ * @see ShapeEvent
191
+ */
192
+ active(...args: any[]): boolean | Shape;
193
+ /**
194
+ * Adds another shape to this shape. Stroke of this shape is kept (stroke of another shape is disregarded).
195
+ *
196
+ * @param {Shape} shape - Another shape object that would be added to this shape.
197
+ * @returns {this} Returns this shape for method chaining.
198
+ */
199
+ add(shape: Shape): this;
200
+ /**
201
+ * Removes an area of a specified shape from this shape. Stroke of this shape is kept (stroke of another shape is disregarded).
202
+ *
203
+ * @param {Shape} shape - Another shape object that would be subtracted from this shape.
204
+ * @returns {this} Returns this shape for method chaining.
205
+ */
206
+ subtract(shape: Shape): this;
207
+ /**
208
+ * Remove an area from this shape where this shape and provided shape don't intersect, leaving only area where these shapes do intersect. Stroke of this shape is kept (stroke of another shape is disregarded).
209
+ *
210
+ * @param {Shape} shape - Another shape object.
211
+ * @returns {this} Returns this shape for method chaining.
212
+ */
213
+ intersect(shape: Shape): this;
214
+ /**
215
+ * Checks if this shape intersects (touches) with another shape. Both of these shapes must be added to the same component for this to work.
216
+ *
217
+ * @param {Shape} shape - Intercepting shape
218
+ * @return {boolean|null} Returns boolean on successful check or `null` if the check failed to be performed.
219
+ */
220
+ intersects(shape: Shape): boolean | null;
221
+ #private;
222
+ }
223
+ import { Stroke } from "./Stroke.js";
@@ -0,0 +1,92 @@
1
+ /**
2
+ * ShapeContainer is not a standalone component. ShapeContainer extends UIComponent and serves a purpose to implement Shape related methods and properties. ShapeContainer is extended by {@link Panel} and {@link Window} components.
3
+ * @class
4
+ * @global
5
+ * @see ComponentContainer
6
+ */
7
+ export class ShapeContainer extends ComponentContainer {
8
+ /**
9
+ * Returns amount of shapes added to this Window.
10
+ *
11
+ * @readonly
12
+ * @type {number}
13
+ */
14
+ readonly get shapeCount(): number;
15
+ /**
16
+ * Gets an array of shapes currently added to the component, or sets an array of new shapes while replacing existing ones.
17
+ *
18
+ * @param {Array<Shape>} [shapes] - An array of Shape objects, such as Rectangle, Line, Ellipse, etc.
19
+ * @returns Array<Shape> If called without arguments, an array of shapes is returned, otherwise `this` component instance is returned for chaining.
20
+ * @throws {TypeError} When one of passed array elements is not of Shape type.
21
+ * @see Shape
22
+ */
23
+ shapes(...args: any[]): this | any[];
24
+ /**
25
+ * Gets a Shape at a specified index.
26
+ *
27
+ * @param {number} i - Index of the shape you want to get
28
+ * @returns {Shape} Returns a `Shape` at a specified `index`, or `undefined`, if `index` is out of bounds or invalid.
29
+ */
30
+ shape(i: number): Shape;
31
+ /**
32
+ * Gets an index of a specified Shape object or sets a new index making the Shape change its layer index position.
33
+ *
34
+ * @param {Shape} shape - Shape object in question
35
+ * @param {number} [new_index] - The new index to assign to the `Shape`. Moves the `Shape` in z-order.
36
+ * @return {number} Returns an index of the Shape or -1 if only first argument is passed, or `this` component index if `new_index` is passed.
37
+ * @throws {TypeError} When invalid argument type is passed as a `shape` argument.
38
+ * @throws {Error} When the shape is not added to this component while attempting to change its index to `new_index`.
39
+ */
40
+ shapeIndex(shape: Shape, new_index?: number): number;
41
+ /**
42
+ * Adds a Shape to be drawn on the panel.
43
+ *
44
+ * @param {Shape} shape - Shape object to draw on this panel
45
+ * @param {number} [index] - Set only if you want to insert the Shape at a specific index
46
+ * @returns {ShapeContainer} Returns `this` instance of the Panel.
47
+ * @see Shape#addTo
48
+ */
49
+ addShape(shape: Shape, index?: number): ShapeContainer;
50
+ /**
51
+ * Removes a specified Shape, then the removed Shape is returned.
52
+ *
53
+ * @param {number|Shape} index_or_shape - Shape or index of the Shape to be removed.
54
+ * @return {Shape|boolean} Returns removed Shape, or `false` in case when index is invalid or out of bounds.
55
+ * @see Shape#remove
56
+ */
57
+ removeShape(index: any): Shape | boolean;
58
+ /**
59
+ * @internal
60
+ * @ignore
61
+ */
62
+ verifyToken(token: any): boolean;
63
+ /**
64
+ * Registers, unregisters and gets a list of handler functions for Shape events (such as when mouse enters, leaves, mouse button clicks, etc.).
65
+ *
66
+ * @param {function(ShapeEvent):any} [callback] - Event handler function that receives {@link ShapeEvent} object as an argument. Check example below for event Object format.
67
+ * @param {boolean} [remove] - Set to `true` to unregister the handler function.
68
+ * @return {function[]|ComboBox} Returns an array of registered handler functions if arguments are omitted, otherwise returns `this` component instance.
69
+ * @see ShapeEvent
70
+ * @example
71
+ * let handler = function(e){console.log(e);}
72
+ * mainForm.panel_1 = new Panel().addTo(mainForm).onPopupEvents(handler);
73
+ *
74
+ * // event Object format:
75
+ * const e = {
76
+ * target: object, // The Panel component that triggered the event.
77
+ * type: string, // Possible values: `add`, `remove`, `click`, `mousedown`, `mouseup`, `mouseenter`, `mouseleave`, `mousemove`.
78
+ * x: number, // X position relative to target.
79
+ * y: number, // Y position relative to target.
80
+ * shapeIndex: number, // Index of the shape that triggered the event.
81
+ * dragging: boolean, // `true` if mouse is down while moving, otherwise false.
82
+ * alt: boolean, // `true` if Alt key was pressed on keyboard when event was emitted.
83
+ * shift: boolean, // `true` if Shift key was pressed on keyboard when event was emitted.
84
+ * ctrl: boolean, // `true` if Control key was pressed on keyboard when event was emitted.
85
+ * modifiers: string, // Modifiers used when the event was emitted
86
+ * modifiersText: string // Description of used modifiers
87
+ * };
88
+ */
89
+ onShapeEvents(callback?: (arg0: ShapeEvent) => any, ...args: any[]): Function[] | ComboBox;
90
+ }
91
+ import { ComponentContainer } from "./ComponentContainer.js";
92
+ import { Shape } from "./Shape.js";
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Slider UI component is used to set value by sliding a thumb (handle) horizontally or vertically. Slider works only with integer numbers, so decimal places will not work.
3
+ *
4
+ * @class
5
+ * @global
6
+ */
7
+ export class Slider extends UIComponent {
8
+ /**
9
+ * Slider constructor. Creates an instance of Slider UI component.
10
+ * @param {string} [text] - Text of the component.
11
+ */
12
+ constructor(...args: any[]);
13
+ /**
14
+ * Sets or gets the spacing between minor tick marks (smaller markings) in the Slider.
15
+ *
16
+ * @param {number} [spacing] - The interval at which minor tick marks are drawn.
17
+ * @return {Slider|number} When setting a value, returns this component for chaining; otherwise returns the current value.
18
+ */
19
+ minorTickSpacing(...args: any[]): Slider | number;
20
+ /**
21
+ * Sets or gets the spacing between major tick marks (larger markings) in the Slider.
22
+ *
23
+ * @param {number} [spacing] - The interval at which major tick marks are drawn.
24
+ * @return {Slider|number} When setting a value, returns this component for chaining; otherwise returns the current value.
25
+ */
26
+ majorTickSpacing(...args: any[]): Slider | number;
27
+ /**
28
+ * Enables or disables snapping the slider's knob to the nearest tick mark.
29
+ *
30
+ * @param {boolean} [snap] - If true, the knob will snap to the nearest tick; if false, it moves freely.
31
+ * @return {Slider|boolean} When setting a value, returns this component for chaining; otherwise returns the current value.
32
+ */
33
+ snapToTicks(...args: any[]): Slider | boolean;
34
+ /**
35
+ * Shows or hides tick marks on the Slider.
36
+ *
37
+ * @param {boolean} [visible] - If true, tick marks will be displayed; if false, they will be hidden.
38
+ * @return {Slider|boolean} When setting a value, returns this component for chaining; otherwise returns the current value.
39
+ */
40
+ showTicks(...args: any[]): Slider | boolean;
41
+ /**
42
+ * Shows or hides numeric labels on the Slider.
43
+ *
44
+ * @param {boolean} [visible] - If true, labels will be displayed; if false, they will be hidden.
45
+ * @return {Slider|boolean} When setting a value, returns this component for chaining; otherwise returns the current value.
46
+ */
47
+ showLabels(...args: any[]): Slider | boolean;
48
+ /**
49
+ * Shows or hides the track (line) behind the slider knob.
50
+ *
51
+ * @param {boolean} [visible] - If true, the track will be displayed; if false, it will be hidden.
52
+ * @return {Slider|boolean} When setting a value, returns this component for chaining; otherwise returns the current value.
53
+ */
54
+ showTrack(...args: any[]): Slider | boolean;
55
+ /**
56
+ * Sets or gets whether the Slider is inverted (maximum value on the left/top).
57
+ *
58
+ * @param {boolean} [inverted] - If true, the maximum value is on the left/top; if false, it is on the right/bottom.
59
+ * @return {Slider|boolean} When setting a value, returns this component for chaining; otherwise returns the current value.
60
+ */
61
+ inverted(...args: any[]): Slider | boolean;
62
+ /**
63
+ * Sets or gets the minimum value of the Slider.
64
+ *
65
+ * @param {number} [minValue] - The minimum allowed value.
66
+ * @return {Slider|number} When setting a value, returns this component for chaining; otherwise returns the current value.
67
+ */
68
+ min(...args: any[]): Slider | number;
69
+ /**
70
+ * Sets or gets the maximum value of the Slider.
71
+ *
72
+ * @param {number} [maxValue] - The maximum allowed value.
73
+ * @return {Slider|number} When setting a value, returns this component for chaining; otherwise returns the current value.
74
+ */
75
+ max(...args: any[]): Slider | number;
76
+ /**
77
+ * Sets or get integer value of the slider.
78
+ *
79
+ * @param {number} [value] - Value to display by the slider's handle. Must be between min and max allowed values.
80
+ * @return {Slider|number} When setting a value, returns this component for chaining; otherwise returns the current value.
81
+ */
82
+ value(...args: any[]): Slider | number;
83
+ /**
84
+ * Sets or gets the orientation of the Slider.
85
+ *
86
+ * @param {Orientation} [orientation] - The slider's orientation: `Orientation.Horizontal` or `Orientation.Vertical`.
87
+ * @return {Slider|Orientation} When setting a value, returns this component for chaining; otherwise returns the current value.
88
+ */
89
+ orientation(...args: any[]): Slider | Orientation;
90
+ /**
91
+ *
92
+ * Enables or disables onChange event to be continuously emitted while user is moving the handle and value is changing.
93
+ * If disabled, the onChange event will only be invoked after user stopped sliding the knob and releases mouse button.
94
+ *
95
+ * @param {boolean} [enabled] - If true, change events are emitted during sliding; if false, only when handle is released.
96
+ * @return {Slider|boolean} When setting a value, returns this component for chaining; otherwise returns the current value.
97
+ */
98
+ emitWhileSliding(...args: any[]): Slider | boolean;
99
+ /**
100
+ * Indicates if the slider handle is being moved at that moment and not released yet.
101
+ *
102
+ * @readonly
103
+ * @type {boolean}
104
+ */
105
+ readonly get isAdjusting(): boolean;
106
+ }
107
+ import { UIComponent } from "./UIComponent.js";
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Component that can hold a number, list items, date/time, and IP addresses. Iterate through numbers or list items with up and down buttons or up and down keys (when Spinner has focus).
3
+ *
4
+ * @class
5
+ * @global
6
+ */
7
+ export class Spinner extends TextComponent {
8
+ /**
9
+ * Defines the available spinner data types.
10
+ * Determines what type of values the spinner can represent and iterate through.
11
+ *
12
+ * @readonly
13
+ * @enum {number}
14
+ * @property {number} Number Spinner holds and iterates through numeric values.
15
+ * @property {number} List Spinner iterates through values from a predefined list.
16
+ * @property {number} DateTime Spinner holds and iterates through date and/or time values.
17
+ * @property {number} IPv4 Spinner holds and iterates through IPv4 address values.
18
+ * @property {number} IPv6 Spinner holds and iterates through IPv6 address values.
19
+ * @see Spinner#constructor
20
+ */
21
+ static readonly Type: Readonly<{
22
+ Number: 0;
23
+ List: 1;
24
+ DateTime: 2;
25
+ IPv4: 3;
26
+ IPv6: 4;
27
+ }>;
28
+ /**
29
+ * Defines the available step units for {@link Spinner.Type.DateTime} spinners.
30
+ * Each unit represents the part of the date or time that changes when incremented or decremented.
31
+ *
32
+ * @readonly
33
+ * @enum {number}
34
+ * @property {number} Era Represents the era (e.g., BC/AD).
35
+ * @property {number} Year Represents the year.
36
+ * @property {number} Month Represents the month.
37
+ * @property {number} WeekOfYear Represents the week of the year.
38
+ * @property {number} WeekOfMonth Represents the week within the month.
39
+ * @property {number} DayOfMonth Represents the day of the month.
40
+ * @property {number} DayOfYear Represents the day of the year.
41
+ * @property {number} DayOfWeek Represents the day of the week.
42
+ * @property {number} DayOfWeekInMonth Represents the nth day of the week within a month.
43
+ * @property {number} AM_PM Represents AM or PM in a 12-hour clock.
44
+ * @property {number} Hour Represents the hour in a 12-hour clock.
45
+ * @property {number} HourOfDay Represents the hour in a 24-hour clock.
46
+ * @property {number} Minute Represents the minute.
47
+ * @property {number} Second Represents the second.
48
+ * @property {number} Millisecond Represents the millisecond.
49
+ * @see Spinner#step
50
+ */
51
+ static readonly Step: Readonly<{
52
+ Era: 0;
53
+ Year: 1;
54
+ Month: 2;
55
+ WeekOfYear: 3;
56
+ WeekOfMonth: 4;
57
+ DayOfMonth: 5;
58
+ DayOfYear: 6;
59
+ DayOfWeek: 7;
60
+ DayOfWeekInMonth: 8;
61
+ AM_PM: 9;
62
+ Hour: 10;
63
+ HourOfDay: 11;
64
+ Minute: 12;
65
+ Second: 13;
66
+ Millisecond: 14;
67
+ }>;
68
+ /**
69
+ * Creates a new Spinner component for selecting numbers, list items, dates/times, or IP addresses.
70
+ *
71
+ * @param {Spinner.Type} type - Spinner value type. Valid values are Spinner.Type.[Number (default)|List|DateTime|IPv4|IPv6]
72
+ * @param {string|Array<*>} [list_or_format] - Format of how the value should be displayed (for numbers), or Array of list items (when type is Spinner.DataType.List).
73
+ * @param {number} [min] - The minimum allowed value (numeric or date)
74
+ * @param {number} [max] - The maximum allowed value (numeric or date).
75
+ * @param {number|Spinner.Step} [step] - Step increment used when increasing/decreasing values. Pass `number` for Number type of spinner and `Spinner.Step` for DateTime type.
76
+ * @example
77
+ * // Number Type: new Spinner(type, format, min, max, step_size);
78
+ * new Spinner(Spinner.Type.Number, "0.00", 0, 100, 5);
79
+ * @example
80
+ * // List Type: new Spinner(new Array());
81
+ * new Spinner(Spinner.Type.List, ["Monday","Tuesday","Wednesday","Thursday","Friday"]);
82
+ * @example
83
+ * // DateTime type:
84
+ * new Spinner(Spinner.Type.DateTime, new Date(2000, 0, 1), new Date(2030, 11, 31), "yyyy-MM-dd", Spinner.Step.DayOfMonth);
85
+ */
86
+ constructor(type: Readonly<{
87
+ Number: 0;
88
+ List: 1;
89
+ DateTime: 2;
90
+ IPv4: 3;
91
+ IPv6: 4;
92
+ }>, ...args: any[]);
93
+ /**
94
+ * Gets or sets the minimum allowed numeric value for the spinner.
95
+ * Applicable only if the spinner was initialized with {Spinner.Type.Number}, {Spinner.Type.DateTime} or {Spinner.Type.IPv4}.
96
+ * Returns `null` if spinner type is {Spinner.Type.List}.
97
+ *
98
+ * @param {number} [value] - The minimum value to set.
99
+ * @returns {number | null | Spinner} The current minimum value, `null` if not applicable, or the Spinner instance when setting.
100
+ */
101
+ min(...args: any[]): number | null | Spinner;
102
+ /**
103
+ * Gets or sets the maximum allowed numeric value for the spinner.
104
+ * Applicable only if the spinner was initialized with {Spinner.Type.Number}, {Spinner.Type.DateTime} or {Spinner.Type.IPv4}.
105
+ * Returns `null` if spinner type is {Spinner.Type.List}.
106
+ *
107
+ * @param {number} [value] - The maximum value to set.
108
+ * @returns {number | null | Spinner} The current maximum value, `null` if not applicable, or the Spinner instance when setting.
109
+ */
110
+ max(...args: any[]): number | null | Spinner;
111
+ /**
112
+ * Gets or sets the step increment/decrement for the spinner when changing values via arrows or keyboard.
113
+ * Applicable only if the spinner was initialized with {Spinner.Type.Number}, {Spinner.Type.DateTime}, or {Spinner.Type.IPv4}.
114
+ * Returns `null` if spinner type is {Spinner.Type.List}.
115
+ *
116
+ * @param {number} [value] - The step size to set.
117
+ * @returns {number | null | Spinner} The current step size, `null` if not applicable, or the Spinner instance when setting.
118
+ */
119
+ step(...args: any[]): number | null | Spinner;
120
+ /**
121
+ * Sets or gets a value displayed in the Spinner component. This method returns number, Date and string types for value depending on the type of the Spinner. To set and get only string value you should use .text() method.
122
+ *
123
+ * @param {number|string|Date} value - New value to set. For date/time accepted value types are `Date` object or a string in the format `yyyy-MM-dd HH:mm:ss`, `yyyy-MM-dd`, `HH:mm:ss` or Date.toISOString() string.
124
+ * @returns {Spinner|number|Date|string} If called without arguments, a current value is returned, otherwise `this` component instance is returned for chaining.
125
+ * @see Spinner#text
126
+ */
127
+ value(...args: any[]): Spinner | number | Date | string;
128
+ }
129
+ import { TextComponent } from "./TextComponent.js";
@@ -0,0 +1,47 @@
1
+ /**
2
+ * A SplitView is a container component that holds two child components separated by a movable divider. The divider can be dragged to resize the space allocated to each component dynamically.
3
+ *
4
+ * Extends {@link ComponentContainer}, which extends {@link UIComponent}.
5
+ *
6
+ * NOTE: Set .dividerPosition(value) and add both child components before populating them with child components to make sure descendents' anchor settings yields expected result.
7
+ *
8
+ * @class
9
+ * @global
10
+ * @see ComponentContainer
11
+ */
12
+ export class SplitView extends ComponentContainer {
13
+ /**
14
+ * Sets of gets the position of the divider (from top or left depends on orientation).
15
+ *
16
+ * @param {number} [position] - Position of the divider.
17
+ * @return {number|SplitView} If called without parameters, returns current value; otherwise returns this SplitView component for chaining.
18
+ * @see SplitView#orientation
19
+ */
20
+ dividerPosition(...args: any[]): number | SplitView;
21
+ /**
22
+ * Sets of gets the thickness of the divider.
23
+ *
24
+ * @param {number} [size] - Thickness of the divider in pixels.
25
+ * @return {number|SplitView} If called without parameters, returns current value; otherwise returns this SplitView component for chaining.
26
+ */
27
+ dividerSize(...args: any[]): number | SplitView;
28
+ /**
29
+ * Returns an array of current sizes of both child components as an array of objects {width:number, height:number}.
30
+ *
31
+ * @type {Array<{width:number, height:number}>}
32
+ * @readonly
33
+ */
34
+ readonly get panelSizes(): Array<{
35
+ width: number;
36
+ height: number;
37
+ }>;
38
+ /**
39
+ * Sets or gets an orientation of two sides in relation to each other.
40
+ *
41
+ * @param {Orientation} [orientation] - One of the value: Orientation.Horizontal, Orientation.Vertical
42
+ * @return {number|SplitView} If called without parameters, returns current value; otherwise returns this SplitView component for chaining.
43
+ * @see Orientation
44
+ */
45
+ orientation(...args: any[]): number | SplitView;
46
+ }
47
+ import { ComponentContainer } from "./ComponentContainer.js";