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,115 @@
1
+
2
+ /**
3
+ * Stroke (border) of any Shape (objects that extend {@link Shape} class).
4
+ * @class
5
+ * @global
6
+ * @see Shape
7
+ */
8
+ export class Stroke
9
+ {
10
+ /**
11
+ * Static enum for stroke cap styles.
12
+ * Defines how the ends of open subpaths are drawn.
13
+ *
14
+ * @readonly
15
+ * @enum {number}
16
+ * @property {number} Butt - Flat end, no extension beyond the end point.
17
+ * @property {number} Round - Rounded end with a half-circle extension.
18
+ * @property {number} Square - Flat end extended by half the line width.
19
+ * @example
20
+ * Stroke.Cap.Round
21
+ */
22
+ static Cap = Object.freeze({
23
+ Butt: 0,
24
+ Round: 1,
25
+ Square: 2
26
+ });
27
+
28
+ /**
29
+ * Static enum for stroke join styles.
30
+ * Defines how two connected line segments are joined.
31
+ *
32
+ * @readonly
33
+ * @enum {number}
34
+ * @property {number} Miter - Sharp corner with extended outer edges.
35
+ * @property {number} Round - Rounded corner with a circular arc.
36
+ * @property {number} Bevel - Flattened corner with a straight cut.
37
+ * @example
38
+ * Stroke.Join.Bevel
39
+ */
40
+ static Join = Object.freeze({
41
+ Miter: 0,
42
+ Round: 1,
43
+ Bevel: 2
44
+ });
45
+
46
+ /**
47
+ * Static enum for stroke alignment.
48
+ * Defines how the stroke is positioned relative to the shape’s outline.
49
+ *
50
+ * @readonly
51
+ * @enum {number}
52
+ * @property {number} Inside - Stroke fully inside the shape path.
53
+ * @property {number} Center - Stroke centered on the shape path.
54
+ * @property {number} Outside - Stroke fully outside the shape path.
55
+ * @example
56
+ * Stroke.Alignment.Outside
57
+ */
58
+ static Alignment = Object.freeze({
59
+ Inside: -1,
60
+ Center: 0,
61
+ Outside: 1
62
+ });
63
+
64
+ #prop = {};
65
+
66
+ /**
67
+ * Create an instance of a Stroke object.
68
+ *
69
+ * @param {number} [width=1] - Specifies the thickness of the line. Default is 1 pixel thick.
70
+ * @param {string} [background] - Stroke color. e.g. #008800. Setting gradients and a background image will be also possible in future.
71
+ * @param {Stroke.Alignment} [alignment] - Where stroke line is drawn: outside of shape, on the edge, or inside. Default is Center. Valid values: Stroke.Alignment.Outside, Stroke.Alignment.Center, Stroke.Alignment.Inside.
72
+ * @param {Stroke.Cap} [cap] - Defines the end cap style of the line. Default is Square. Valid values: Stroke.Cap.Square, Stroke.Cap.Butt, Stroke.Cap.Round.
73
+ * @param {Stroke.Join} [join] - Specifies the line join style. Default is Miter. Valid values: Stroke.Join.Miter, Stroke.Join.Bevel, Stroke.Join.Round.
74
+ * @param {number} [miterLimit] - Applicable when join is set to JOIN_MITER. It controls the maximum miter length. If the miter length exceeds this limit, the join is beveled instead.
75
+ * @param {number} [dashSize] - Size of a dash in a dash pattern,
76
+ * @param {number} [dashGapSize] - Size of gaps between dashes in dash pattern
77
+ * @param {number} [dashPhase] - Specifies the starting point of the dash pattern. It determines where in the dash pattern the line starts. A positive value shifts the pattern to the right, and a negative value shifts it to the left.
78
+ */
79
+ constructor(width = 1, background = "#000000", alignment = Stroke.Alignment.Center, cap = Stroke.Cap.Square, join = Stroke.Join.Miter, miterLimit = 10, dashSize = null, dashGapSize = null, dashPhase = 0)
80
+ {
81
+ this.#prop.width = parseFloat(width);
82
+
83
+ this.#prop.background = background;
84
+ this.#prop.alignment = alignment;
85
+ this.#prop.cap = parseInt(cap);
86
+ this.#prop.join = parseInt(join);
87
+ this.#prop.miterLimit = parseFloat(miterLimit);
88
+ if(dashSize !== null) this.#prop.dashSize = parseFloat(dashSize);
89
+ if(dashGapSize !== null) this.#prop.dashGapSize = parseFloat(dashGapSize);
90
+ if(dashPhase > 0 || dashPhase < 0) this.#prop.dashPhase = parseFloat(dashPhase);
91
+ }
92
+
93
+ /**
94
+ * Convert Stroke to JSON Object to be able to store it or modify it and convert back to the Stroke object using Stroke.fromObject(stroke).
95
+ *
96
+ * @return {object} Returns an object holding all properties of this Stroke object.
97
+ */
98
+ toObject()
99
+ {
100
+ return {...this.#prop};
101
+ }
102
+
103
+ /**
104
+ * Restore Stroke from JSON object that represents all properties of the Stroke object.
105
+ *
106
+ * @param {object} stroke - JSON object that holds properties of a Stroke object. It can be generated by stroke.toObject().
107
+ * @return {Stroke} Returns an instance of a new Stroke object.
108
+ */
109
+ static fromObject(stroke)
110
+ {
111
+ if(stroke === null || stroke === undefined) return undefined;
112
+
113
+ return new Stroke(stroke.width ?? 0, stroke.background ?? "#000000", stroke.alignment ?? Stroke.Alignment.Center, stroke.cap ?? Stroke.Cap.Square, stroke.join ?? Stroke.Join.Miter, stroke.miterLimit ?? 10, stroke.dashSize ?? null, stroke.dashGapSize ?? null, stroke.dashPhase ?? 0);
114
+ }
115
+ }