ozdenui 0.1.0

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 (149) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +14 -0
  3. data/NOTICE +5 -0
  4. data/README.md +242 -0
  5. data/exe/ozdenui +17 -0
  6. data/lib/ozdenui/AGENTS.md +210 -0
  7. data/lib/ozdenui/COMPONENTS.md +3017 -0
  8. data/lib/ozdenui/app.rb +749 -0
  9. data/lib/ozdenui/command.rb +107 -0
  10. data/lib/ozdenui/components.rb +368 -0
  11. data/lib/ozdenui/dialogs.rb +212 -0
  12. data/lib/ozdenui/files.rb +124 -0
  13. data/lib/ozdenui/icon.png +0 -0
  14. data/lib/ozdenui/kit.json +1 -0
  15. data/lib/ozdenui/kit.rb +115 -0
  16. data/lib/ozdenui/look.rb +229 -0
  17. data/lib/ozdenui/objects.rb +652 -0
  18. data/lib/ozdenui/server.rb +270 -0
  19. data/lib/ozdenui/values.rb +273 -0
  20. data/lib/ozdenui/version.rb +15 -0
  21. data/lib/ozdenui/web/basic/LICENSE +14 -0
  22. data/lib/ozdenui/web/basic/basic.min.css +1 -0
  23. data/lib/ozdenui/web/basic/basic.min.js +78 -0
  24. data/lib/ozdenui/web/basic/font/open-sans/LICENSE.txt +206 -0
  25. data/lib/ozdenui/web/basic/font/open-sans/OpenSans-Bold.ttf +0 -0
  26. data/lib/ozdenui/web/basic/font/open-sans/OpenSans-Regular.ttf +0 -0
  27. data/lib/ozdenui/web/basic/scroll-bar.min.js +3 -0
  28. data/lib/ozdenui/web/bridge.js +584 -0
  29. data/lib/ozdenui/web/comp/accordion.js +659 -0
  30. data/lib/ozdenui/web/comp/action-button/add.png +0 -0
  31. data/lib/ozdenui/web/comp/action-button.js +521 -0
  32. data/lib/ozdenui/web/comp/action-tab-bar.js +383 -0
  33. data/lib/ozdenui/web/comp/app-bar.js +237 -0
  34. data/lib/ozdenui/web/comp/badge.js +292 -0
  35. data/lib/ozdenui/web/comp/bottom-bar.js +555 -0
  36. data/lib/ozdenui/web/comp/breadcrumbs.js +524 -0
  37. data/lib/ozdenui/web/comp/canvas.js +652 -0
  38. data/lib/ozdenui/web/comp/chat-view.js +827 -0
  39. data/lib/ozdenui/web/comp/check-box.js +490 -0
  40. data/lib/ozdenui/web/comp/code-editor.js +965 -0
  41. data/lib/ozdenui/web/comp/color-picker.js +636 -0
  42. data/lib/ozdenui/web/comp/context-menu.js +951 -0
  43. data/lib/ozdenui/web/comp/currency-field.js +209 -0
  44. data/lib/ozdenui/web/comp/data-table/arrow.svg +2 -0
  45. data/lib/ozdenui/web/comp/data-table.js +937 -0
  46. data/lib/ozdenui/web/comp/date-picker.js +1055 -0
  47. data/lib/ozdenui/web/comp/dialog.js +992 -0
  48. data/lib/ozdenui/web/comp/email-field.js +65 -0
  49. data/lib/ozdenui/web/comp/file-picker.js +920 -0
  50. data/lib/ozdenui/web/comp/filters.js +807 -0
  51. data/lib/ozdenui/web/comp/form.js +602 -0
  52. data/lib/ozdenui/web/comp/full-screen-select/arrow.svg +2 -0
  53. data/lib/ozdenui/web/comp/full-screen-select/cancel.svg +2 -0
  54. data/lib/ozdenui/web/comp/full-screen-select.js +614 -0
  55. data/lib/ozdenui/web/comp/gauge.js +439 -0
  56. data/lib/ozdenui/web/comp/graph-box.js +3911 -0
  57. data/lib/ozdenui/web/comp/grid-group.js +185 -0
  58. data/lib/ozdenui/web/comp/hold-to-confirm-button/trash-red.png +0 -0
  59. data/lib/ozdenui/web/comp/hold-to-confirm-button/trash.png +0 -0
  60. data/lib/ozdenui/web/comp/hold-to-confirm-button.js +289 -0
  61. data/lib/ozdenui/web/comp/image-view.js +598 -0
  62. data/lib/ozdenui/web/comp/item-list.js +1740 -0
  63. data/lib/ozdenui/web/comp/json-editor.js +3221 -0
  64. data/lib/ozdenui/web/comp/json-view.js +597 -0
  65. data/lib/ozdenui/web/comp/label-editor.js +1140 -0
  66. data/lib/ozdenui/web/comp/left-menu/data-table.png +0 -0
  67. data/lib/ozdenui/web/comp/left-menu/home.png +0 -0
  68. data/lib/ozdenui/web/comp/left-menu/reports.png +0 -0
  69. data/lib/ozdenui/web/comp/left-menu/setting.png +0 -0
  70. data/lib/ozdenui/web/comp/left-menu.js +548 -0
  71. data/lib/ozdenui/web/comp/line-progress-bar.js +343 -0
  72. data/lib/ozdenui/web/comp/loading-screen.js +413 -0
  73. data/lib/ozdenui/web/comp/log-view.js +530 -0
  74. data/lib/ozdenui/web/comp/login-page.js +685 -0
  75. data/lib/ozdenui/web/comp/markdown-view.js +1045 -0
  76. data/lib/ozdenui/web/comp/menu-bar.js +624 -0
  77. data/lib/ozdenui/web/comp/mini-graph-box.js +492 -0
  78. data/lib/ozdenui/web/comp/minimal-accent.js +208 -0
  79. data/lib/ozdenui/web/comp/notice.js +229 -0
  80. data/lib/ozdenui/web/comp/number-field.js +128 -0
  81. data/lib/ozdenui/web/comp/numeric-keyboard.js +298 -0
  82. data/lib/ozdenui/web/comp/page-control.js +762 -0
  83. data/lib/ozdenui/web/comp/page-header.js +191 -0
  84. data/lib/ozdenui/web/comp/password-field/hide-btn.png +0 -0
  85. data/lib/ozdenui/web/comp/password-field/hide-btn2.png +0 -0
  86. data/lib/ozdenui/web/comp/password-field/show-btn.png +0 -0
  87. data/lib/ozdenui/web/comp/password-field/show-btn2.png +0 -0
  88. data/lib/ozdenui/web/comp/password-field.js +192 -0
  89. data/lib/ozdenui/web/comp/period-bar.js +436 -0
  90. data/lib/ozdenui/web/comp/phone-field.js +322 -0
  91. data/lib/ozdenui/web/comp/progress-bar.js +992 -0
  92. data/lib/ozdenui/web/comp/property-panel.js +3639 -0
  93. data/lib/ozdenui/web/comp/radio-button.js +527 -0
  94. data/lib/ozdenui/web/comp/range-slider.js +569 -0
  95. data/lib/ozdenui/web/comp/rich-text-editor.js +1064 -0
  96. data/lib/ozdenui/web/comp/scroll-area.js +308 -0
  97. data/lib/ozdenui/web/comp/scrolling-text.js +297 -0
  98. data/lib/ozdenui/web/comp/search-input/clear-round.svg +1 -0
  99. data/lib/ozdenui/web/comp/search-input/clear.svg +1 -0
  100. data/lib/ozdenui/web/comp/search-input/filter.png +0 -0
  101. data/lib/ozdenui/web/comp/search-input/filter.svg +1 -0
  102. data/lib/ozdenui/web/comp/search-input/search.svg +1 -0
  103. data/lib/ozdenui/web/comp/search-input.js +725 -0
  104. data/lib/ozdenui/web/comp/search-results.js +596 -0
  105. data/lib/ozdenui/web/comp/select-box.js +1862 -0
  106. data/lib/ozdenui/web/comp/settings-row.js +299 -0
  107. data/lib/ozdenui/web/comp/side-panel.js +616 -0
  108. data/lib/ozdenui/web/comp/slider-field.js +952 -0
  109. data/lib/ozdenui/web/comp/slider.js +838 -0
  110. data/lib/ozdenui/web/comp/smart-button/alert-black.png +0 -0
  111. data/lib/ozdenui/web/comp/smart-button/clock.png +0 -0
  112. data/lib/ozdenui/web/comp/smart-button.js +981 -0
  113. data/lib/ozdenui/web/comp/smart-table/clock.png +0 -0
  114. data/lib/ozdenui/web/comp/smart-table/down.png +0 -0
  115. data/lib/ozdenui/web/comp/smart-table/scroll.png +0 -0
  116. data/lib/ozdenui/web/comp/smart-table/sort.png +0 -0
  117. data/lib/ozdenui/web/comp/smart-table/up.png +0 -0
  118. data/lib/ozdenui/web/comp/smart-table.js +1883 -0
  119. data/lib/ozdenui/web/comp/sortable-list.js +1181 -0
  120. data/lib/ozdenui/web/comp/spark-line-box.js +738 -0
  121. data/lib/ozdenui/web/comp/splitter.js +411 -0
  122. data/lib/ozdenui/web/comp/status-bar.js +408 -0
  123. data/lib/ozdenui/web/comp/step-bar.js +345 -0
  124. data/lib/ozdenui/web/comp/stepper.js +753 -0
  125. data/lib/ozdenui/web/comp/tabs.js +1366 -0
  126. data/lib/ozdenui/web/comp/tag-input.js +1107 -0
  127. data/lib/ozdenui/web/comp/tap-effect.js +170 -0
  128. data/lib/ozdenui/web/comp/text-area-field.js +233 -0
  129. data/lib/ozdenui/web/comp/text-field.js +1006 -0
  130. data/lib/ozdenui/web/comp/time-line.js +398 -0
  131. data/lib/ozdenui/web/comp/time-picker.js +1032 -0
  132. data/lib/ozdenui/web/comp/tiny-select/arrow.svg +1 -0
  133. data/lib/ozdenui/web/comp/tiny-select.js +322 -0
  134. data/lib/ozdenui/web/comp/tiny-table.js +283 -0
  135. data/lib/ozdenui/web/comp/toast.js +891 -0
  136. data/lib/ozdenui/web/comp/toggle.js +757 -0
  137. data/lib/ozdenui/web/comp/tool-bar.js +760 -0
  138. data/lib/ozdenui/web/comp/tooltip.js +534 -0
  139. data/lib/ozdenui/web/comp/tree-view.js +1179 -0
  140. data/lib/ozdenui/web/comp/ui-effects.js +1097 -0
  141. data/lib/ozdenui/web/comp/ui-standards.js +403 -0
  142. data/lib/ozdenui/web/comp/url-field.js +190 -0
  143. data/lib/ozdenui/web/comp/web-view.js +588 -0
  144. data/lib/ozdenui/web/components.js +123 -0
  145. data/lib/ozdenui/web/index.html +39 -0
  146. data/lib/ozdenui/window.rb +188 -0
  147. data/lib/ozdenui/window_cocoa.rb +221 -0
  148. data/lib/ozdenui.rb +32 -0
  149. metadata +200 -0
@@ -0,0 +1,413 @@
1
+ /* Bismillah */
2
+
3
+ /*
4
+
5
+ LoadingScreen - v26.09
6
+
7
+ UI COMPONENT
8
+ - A full cover that is shown while an app or a page is getting ready (a splash / loading screen).
9
+ It covers its container (the page by default) and fades out when close() is called.
10
+ - Parts (all optional): an icon (an image file or an SVG text), a title, a message, a spinner
11
+ ("ring", "dots" or "clock") and a progress bar (setProgress(0 - 1)).
12
+ - spinnerType "clock": the clock of the waiting views
13
+ (a white face, a dark edge and dark hands) with moving hands: the minute hand turns fast, the hour hand 12 times
14
+ slower. Always 30 px: the hour hand 2 px, the minute hand (the long one) 2 px in indianred, and an
15
+ indianred dot (4 px) in the middle over the place where the hands meet. Drawn as SVG in px (no file);
16
+ style.clock. The hands stand still with prefers-reduced-motion.
17
+ THE DEFAULT WAIT: spinnerType is "clock" by default. Its two looks are LoadingScreen.clocks
18
+ "ozden" (a white face, dark lines: the default) and "ozdenDark" (a dark face, light lines, a yellow minute hand); the style packages
19
+ "ozden" and "ozdenDark" are the screens made for them.
20
+ - NEEDS comp/smart-button.js, loaded first: the clock and the dots are the drawings of SmartButton
21
+ (SmartButton.clocks, createClockSvg, createDots): one drawing for the whole suite.
22
+ - minDuration: the screen stays at least this long, so a fast load does not show a short flash.
23
+ - The cover takes the clicks, so nothing under it can be clicked while it is open.
24
+ - Style packages: "light" (default), "dark", "ozden", "ozdenDark", "minimal", "minimalDark". Select with styleName.
25
+ (LoadingScreen.styles) The minimal packages wait with the ring of the minimal SmartButton.
26
+ - NOTE: The methods are open() / close(), not show() / hide(): those are basic.js methods of every
27
+ object (they only change "visible").
28
+
29
+ USAGE:
30
+ const loading = LoadingScreen({ styleName: "dark", iconFile: "icon/icon-192.png", titleText: "My App" });
31
+ loading.close(); // Fades out (after minDuration).
32
+ loading.open(); // Shows it again.
33
+ loading.setMessageText("Loading the data...");
34
+ loading.setProgress(0.4); // A progress bar under the spinner. -1 hides it.
35
+ LoadingScreen({ spinnerType: "dots", removeOnClose: 1, onClose: (self) => println("ready") });
36
+ LoadingScreen({ spinnerType: "clock", messageText: "Saving..." }); // The moving clock
37
+
38
+ Started Date: September 2026
39
+ Webpage: https://bug7a.github.io/js-components/
40
+
41
+ Copyright 2020-2026 Bugra Ozden <bugra.ozden@gmail.com> (https://bug7a.github.io/)
42
+ Licensed under the Apache License, Version 2.0
43
+ SPDX-License-Identifier: Apache-2.0
44
+
45
+ */
46
+
47
+ "use strict";
48
+
49
+ // Default values:
50
+ const LoadingScreenDefaults = {
51
+ left: 0,
52
+ top: 0,
53
+ width: "100%",
54
+ height: "100%",
55
+ styleName: "light", // "light", "dark", "ozden", "ozdenDark", "minimal", "minimalDark" or a name added to LoadingScreen.styles
56
+ iconFile: "", // An image file (Ex: the app icon)
57
+ iconSvg: "", // Or an SVG text (works with no file, also offline)
58
+ titleText: "",
59
+ allowHtml: 0, // 1: titleText and messageText are HTML, only for your own texts (Ex: "Please wait.<br>It takes a few seconds.")
60
+ messageText: "",
61
+ spinnerType: "clock", // "clock" (the default wait, the user), "ring", "dots", "none"
62
+ progress: -1, // 0 - 1: a progress bar is shown. -1: no progress bar
63
+ opened: 1, // 0: created closed, open() shows it
64
+ minDuration: 600, // ms. A close() before this time waits. (No short flash on a fast load)
65
+ fadeDuration: 0.35, // seconds
66
+ removeOnClose: 0, // 1: The object is removed after it is closed (a splash screen that is used once)
67
+ onClose: function (self) { }, // After the fade out
68
+ style: {
69
+ box: {
70
+ color: "#FFFFFF",
71
+ },
72
+ layout: {
73
+ gap: 14,
74
+ padding: 30,
75
+ },
76
+ icon: {
77
+ size: 72,
78
+ round: 16,
79
+ marginBottom: 6,
80
+ },
81
+ title: {
82
+ fontSize: 20,
83
+ textColor: Black(0.85),
84
+ bold: 1,
85
+ },
86
+ message: {
87
+ width: 300,
88
+ fontSize: 15,
89
+ textColor: Black(0.5),
90
+ },
91
+ spinner: {
92
+ size: 30,
93
+ thickness: 3,
94
+ color: "#3D7A6B",
95
+ trackColor: Black(0.1),
96
+ speed: 0.8, // seconds for one turn
97
+ marginTop: 8,
98
+ },
99
+ dots: {
100
+ size: 9,
101
+ gap: 7,
102
+ color: "#3D7A6B",
103
+ },
104
+ clock: SmartButton.clocks.ozden, // the ozden clock of SmartButton (LoadingScreen.clocks)
105
+ progress: {
106
+ width: 180,
107
+ height: 4,
108
+ color: "#3D7A6B",
109
+ trackColor: Black(0.08),
110
+ round: 100,
111
+ },
112
+ },
113
+ };
114
+
115
+ const LoadingScreen = function (params = {}) {
116
+
117
+ // Merge style package: params.style > LoadingScreen.styles[styleName] > LoadingScreenDefaults.style (light)
118
+ basic.applyStylePackage(params, LoadingScreen.styles, LoadingScreenDefaults);
119
+
120
+ // Merge params:
121
+ mergeIntoIfMissing(params, LoadingScreenDefaults);
122
+
123
+ // Edit params, if needed:
124
+ params.color = params.style.box.color;
125
+
126
+ LoadingScreen.injectCss();
127
+
128
+ // BOX: Component container
129
+ let box = startObject(params);
130
+
131
+ // *** PRIVATE VARIABLES:
132
+ const _s = box.style;
133
+ let openedTime = 0;
134
+ let cancelClose = null; // (box.after: the timers are stopped by remove())
135
+ let cancelFade = null;
136
+ const PROGRESS_MOTION = "width 0.25s";
137
+
138
+ // *** PUBLIC VARIABLES:
139
+ // NOTE: Default values are also public variables. (box.opened, box.progress, box.titleText)
140
+
141
+ // *** PRIVATE FUNCTIONS:
142
+
143
+ const setText = function (label, text) {
144
+ const value = (text === undefined || text === null) ? "" : String(text);
145
+ if (box.allowHtml == 1) label.text = value;
146
+ else label.plainText = value;
147
+ };
148
+
149
+ const clearTimers = function () {
150
+ if (cancelClose) cancelClose();
151
+ if (cancelFade) cancelFade();
152
+ cancelClose = null;
153
+ cancelFade = null;
154
+ };
155
+
156
+ const updateProgressView = function () {
157
+ const hasProgress = (box.progress >= 0);
158
+ box.progressTrack.visible = hasProgress ? 1 : 0;
159
+ if (hasProgress) box.progressBar.css.width = (box.progress * 100) + "%";
160
+ };
161
+
162
+ const fadeOut = function () {
163
+ cancelClose = null;
164
+ box.opacity = 0;
165
+ cancelFade = box.after(box.fadeDuration * 1000, function () {
166
+ cancelFade = null;
167
+ box.visible = 0;
168
+ box.css.pointerEvents = "none";
169
+ box.onClose(box);
170
+ if (box.removeOnClose) box.remove();
171
+ });
172
+ };
173
+
174
+ // *** PUBLIC FUNCTIONS:
175
+
176
+ // Shows the screen again. (It is shown at create time, unless opened: 0)
177
+ box.open = function () {
178
+ clearTimers();
179
+ box.opened = 1;
180
+ openedTime = Date.now();
181
+ box.setMotionNow("none");
182
+ box.opacity = 1;
183
+ box.visible = 1;
184
+ box.css.pointerEvents = "auto"; // WHY: The cover takes the clicks. (basic.css: none)
185
+ box.bringToFront();
186
+ };
187
+
188
+ // Fades out. Before minDuration it waits, so a fast load does not show a short flash.
189
+ box.close = function () {
190
+ if (!box.opened) return;
191
+ box.opened = 0;
192
+ clearTimers();
193
+ box.setMotionNow("opacity " + box.fadeDuration + "s");
194
+ const wait = Math.max(0, box.minDuration - (Date.now() - openedTime));
195
+ cancelClose = box.after(wait, fadeOut);
196
+ };
197
+
198
+ box.setTitleText = function (text) {
199
+ box.titleText = text || "";
200
+ setText(box.titleLabel, box.titleText);
201
+ box.titleLabel.visible = box.titleText ? 1 : 0;
202
+ };
203
+
204
+ box.setMessageText = function (text) {
205
+ box.messageText = text || "";
206
+ setText(box.messageLabel, box.messageText);
207
+ box.messageLabel.visible = box.messageText ? 1 : 0;
208
+ };
209
+
210
+ // 0 - 1. -1 hides the progress bar.
211
+ box.setProgress = function (value) {
212
+ value = Number(value);
213
+ box.progress = (isNaN(value) || value < 0) ? -1 : Math.min(value, 1);
214
+ updateProgressView();
215
+ };
216
+
217
+
218
+ // *** OBJECT VIEW:
219
+
220
+ // GROUP: Centered content
221
+ box.content = VGroup({
222
+ align: "center center",
223
+ gap: _s.layout.gap,
224
+ padding: _s.layout.padding,
225
+ });
226
+
227
+ // ICON: An image file or an SVG text
228
+ if (box.iconFile) {
229
+ box.icon = Icon({ width: _s.icon.size, height: _s.icon.size, round: _s.icon.round });
230
+ box.icon.load(box.iconFile);
231
+ } else if (box.iconSvg) {
232
+ box.icon = Box({ width: _s.icon.size, height: _s.icon.size, color: "transparent" });
233
+ box.icon.elem.innerHTML = box.iconSvg;
234
+ }
235
+ if (box.icon) {
236
+ box.icon.css.marginBottom = _s.icon.marginBottom + "px";
237
+ box.icon.shrink = 0;
238
+ }
239
+
240
+ // LABEL: Title
241
+ box.titleLabel = Label({
242
+ fontSize: _s.title.fontSize,
243
+ textColor: _s.title.textColor,
244
+ });
245
+ setText(box.titleLabel, box.titleText);
246
+ if (_s.title.bold) box.titleLabel.css.fontFamily = "opensans-bold";
247
+ box.titleLabel.css.textAlign = "center";
248
+
249
+ // LABEL: Message
250
+ box.messageLabel = Label({
251
+ width: _s.message.width,
252
+ fontSize: _s.message.fontSize,
253
+ textColor: _s.message.textColor,
254
+ });
255
+ setText(box.messageLabel, box.messageText);
256
+ box.messageLabel.css = {
257
+ textAlign: "center",
258
+ lineHeight: "1.45",
259
+ };
260
+
261
+ // BOX: Spinner (ring)
262
+ box.spinner = Box({
263
+ width: _s.spinner.size,
264
+ height: _s.spinner.size,
265
+ color: "transparent",
266
+ round: 100,
267
+ });
268
+ box.spinner.css = {
269
+ border: _s.spinner.thickness + "px solid " + _s.spinner.trackColor,
270
+ borderTopColor: _s.spinner.color,
271
+ boxSizing: "border-box",
272
+ animation: "loadingScreenSpin " + _s.spinner.speed + "s linear infinite",
273
+ marginTop: _s.spinner.marginTop + "px",
274
+ };
275
+ box.spinner.shrink = 0;
276
+
277
+ // GROUP: Spinner (dots: the drawing of SmartButton)
278
+ box.dots = SmartButton.createDots(_s.dots);
279
+ box.dots.css.marginTop = _s.spinner.marginTop + "px";
280
+
281
+ // BOX: Spinner (clock: the drawing of SmartButton)
282
+ box.clock = Box({ width: SmartButton.CLOCK_SIZE, height: SmartButton.CLOCK_SIZE, color: "transparent" });
283
+ box.clock.elem.innerHTML = SmartButton.createClockSvg(_s.clock);
284
+ box.clock.css.marginTop = _s.spinner.marginTop + "px";
285
+ box.clock.shrink = 0;
286
+
287
+ // BOX: Progress bar
288
+ box.progressTrack = startBox({
289
+ width: _s.progress.width,
290
+ height: _s.progress.height,
291
+ color: _s.progress.trackColor,
292
+ round: _s.progress.round,
293
+ });
294
+ box.progressTrack.css.overflow = "hidden";
295
+ box.progressTrack.shrink = 0;
296
+
297
+ box.progressBar = Box(0, 0, 0, "100%", {
298
+ color: _s.progress.color,
299
+ round: _s.progress.round,
300
+ });
301
+ box.progressBar.setMotion(PROGRESS_MOTION);
302
+
303
+ endBox();
304
+
305
+ endGroup();
306
+
307
+ // *** OBJECT INIT CODE:
308
+
309
+ // WHY: A hidden object inside a group is not a flex item, so the parts are hidden after they are created.
310
+ box.titleLabel.visible = box.titleText ? 1 : 0;
311
+ box.messageLabel.visible = box.messageText ? 1 : 0;
312
+ box.spinner.visible = (box.spinnerType === "ring") ? 1 : 0;
313
+ box.dots.visible = (box.spinnerType === "dots") ? 1 : 0;
314
+ box.clock.visible = (box.spinnerType === "clock") ? 1 : 0;
315
+ box.setProgress(box.progress);
316
+
317
+ if (box.opened) {
318
+ box.opened = 0; // WHY: open() sets it.
319
+ box.open();
320
+ } else {
321
+ box.visible = 0;
322
+ box.css.pointerEvents = "none";
323
+ }
324
+
325
+ return endObject(box);
326
+
327
+ };
328
+
329
+ // *** THE CLOCKS: the two looks of the waiting clock: the clocks of SmartButton
330
+ LoadingScreen.clocks = SmartButton.clocks;
331
+
332
+ // *** STYLE PACKAGES:
333
+ // USAGE: LoadingScreen({ styleName: "dark" })
334
+ // USAGE: LoadingScreen({ styleName: "dark", style: { spinner: { color: "tomato" } } }) // Change only some keys.
335
+ // USAGE: LoadingScreen({ style: LoadingScreen.styles.dark }) // The same as styleName: "dark". (The package is copied, never changed.)
336
+ // NOTE: A new package needs only the keys that differ from the default (light) style.
337
+ // USAGE: LoadingScreen.styles.myStyle = { box: { color: "#0B2239" } };
338
+ LoadingScreen.styles = {
339
+
340
+ light: LoadingScreenDefaults.style,
341
+
342
+ // The screens of the ozden clock: the colors of the ozden pages (#F0F1EE, #232323) and indianred
343
+ ozden: {
344
+ box: { color: "#F0F1EE" },
345
+ title: { textColor: "#232323" },
346
+ message: { textColor: "rgba(35, 35, 35, 0.6)" },
347
+ spinner: { color: "indianred" },
348
+ dots: { color: "indianred" },
349
+ progress: { color: "indianred", trackColor: Black(0.08) },
350
+ clock: LoadingScreen.clocks.ozden,
351
+ },
352
+
353
+ ozdenDark: { // (its accent is the yellow of the dark clock)
354
+ box: { color: "#1B1B1B" },
355
+ title: { textColor: White(0.9) },
356
+ message: { textColor: White(0.55) },
357
+ spinner: { color: "#F1C74A", trackColor: White(0.12) },
358
+ dots: { color: "#F1C74A" },
359
+ progress: { color: "#F1C74A", trackColor: White(0.12) },
360
+ clock: LoadingScreen.clocks.ozdenDark,
361
+ },
362
+
363
+ dark: {
364
+ box: {
365
+ color: "#141414",
366
+ },
367
+ title: {
368
+ textColor: White(0.9),
369
+ },
370
+ message: {
371
+ textColor: White(0.55),
372
+ },
373
+ spinner: {
374
+ color: "#5FB39F",
375
+ trackColor: White(0.12),
376
+ },
377
+ dots: {
378
+ color: "#5FB39F",
379
+ },
380
+ progress: {
381
+ color: "#5FB39F",
382
+ trackColor: White(0.12),
383
+ },
384
+ },
385
+
386
+ };
387
+
388
+ // The minimal theme (_designs/minimal-theme.htm): the ground of the window, small texts (15 px title, 13 px message),
389
+ // the waiting ring of the minimal SmartButton, 2 px ink lines for the ring, the other spinners and the progress bar.
390
+ // minimalDark: the same on a dark window.
391
+ LoadingScreen.createMinimalStyle = function (colors) {
392
+ return {
393
+ box: { color: colors.ground },
394
+ layout: { gap: 10, padding: 24 },
395
+ icon: { size: 48, round: 8, marginBottom: 4 },
396
+ title: { fontSize: 15, textColor: colors.text, bold: 1 },
397
+ message: { width: 260, fontSize: 13, textColor: colors.softText },
398
+ spinner: { size: 24, thickness: 2, color: colors.ink, trackColor: colors.track, speed: 0.8, marginTop: 6 },
399
+ dots: { size: 6, gap: 5, color: colors.ink },
400
+ clock: Object.assign({}, colors.ring, { edgeWidth: 2 }), // WHY 2: the line of the progress bar under it (the button ring is drawn smaller)
401
+ progress: { width: 160, height: 2, color: colors.ink, trackColor: colors.track, round: 1 },
402
+ };
403
+ };
404
+ LoadingScreen.MINIMAL_COLORS = { ground: "#FFFFFF", text: Black(0.85), softText: Black(0.55), ink: "#1F1F1F", track: Black(0.12), ring: LoadingScreen.clocks.minimal };
405
+ LoadingScreen.styles.minimal = LoadingScreen.createMinimalStyle(LoadingScreen.MINIMAL_COLORS);
406
+ LoadingScreen.MINIMAL_DARK_COLORS = { ground: "#1A1A19", text: White(0.88), softText: White(0.55), ink: "#EDEDEB", track: White(0.14), ring: LoadingScreen.clocks.minimalDark };
407
+ LoadingScreen.styles.minimalDark = LoadingScreen.createMinimalStyle(LoadingScreen.MINIMAL_DARK_COLORS);
408
+
409
+ // The animations can not be set with inline styles. (the clock and the dots: SmartButton.injectCss)
410
+ LoadingScreen.injectCss = function () {
411
+ basic.addCss("loading-screen-css",
412
+ "@keyframes loadingScreenSpin { to { transform: rotate(360deg); } }");
413
+ };