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,345 @@
1
+ /* Bismillah */
2
+
3
+ /*
4
+
5
+ StepBar - v26.11
6
+
7
+ UI COMPONENT
8
+ - The steps of a job in a row: a cart, an address, a payment, done. A step that is behind has a check mark, the step of
9
+ now is filled, the next ones are empty; a line joins them.
10
+ - A step: a text, or { key, text, description }. Plain texts (never HTML). style.title and style.note are their look.
11
+ - canGoBack: 1: a click (or Enter) on a step that is behind calls onStepClick(self, index); the page decides to go
12
+ back with setStep(index). A step that is not reached yet can not be clicked.
13
+ - A narrow screen: the titles get thinner and wrap; showTitles: 0 leaves only the circles.
14
+ - For a history of what happened (it grows with new items): TimeLine.
15
+ - Style packages: "light" (default), "dark", "minimal", "minimalDark". Select with styleName (StepBar.styles), or later
16
+ with setTheme().
17
+
18
+ USAGE:
19
+ const steps = StepBar({
20
+ width: "100%",
21
+ steps: ["Cart", "Address", { text: "Payment", description: "Card or cash" }, "Done"],
22
+ currentStep: 1,
23
+ onStepClick: function (self, index) { self.setStep(index); },
24
+ });
25
+ steps.next();
26
+ steps.previous();
27
+ steps.setStep(3);
28
+ steps.setSteps(["One", "Two"]);
29
+
30
+ Started Date: November 2026
31
+ Webpage: https://bug7a.github.io/js-components/
32
+
33
+ Copyright 2020-2026 Bugra Ozden <bugra.ozden@gmail.com> (https://bug7a.github.io/)
34
+ Licensed under the Apache License, Version 2.0
35
+ SPDX-License-Identifier: Apache-2.0
36
+
37
+ */
38
+
39
+ "use strict";
40
+
41
+ // Default values:
42
+ const StepBarDefaults = {
43
+ key: "0", // Your name for this object: read it in a callback (self.key)
44
+ left: 0,
45
+ top: 0,
46
+ width: "100%",
47
+ height: "auto",
48
+ steps: [], // [STEP]: a text or { key, text, description }
49
+ currentStep: 0, // The step of now, from 0. steps.length: every step is done.
50
+ canGoBack: 1, // 1: a step that is behind can be clicked (onStepClick)
51
+ showTitles: 1,
52
+ ariaLabel: "Steps",
53
+ onStepClick: function (self, index) { }, // A step that is behind was chosen. setStep() goes there.
54
+ styleName: "light", // "light", "dark", "minimal", "minimalDark" or a name added to StepBar.styles
55
+ style: { // Light style package (default)
56
+ circle: { size: 30, fontSize: 13, lineWidth: 2, hoverRing: 6 }, // hoverRing: the soft ring of a step that can be clicked
57
+ title: { fontSize: 13, space: 8 },
58
+ note: { fontSize: 12 },
59
+ line: { size: 2, space: 6 }, // space: between a line and a circle
60
+ colors: {
61
+ done: "#3F8D94", // A step that is behind, the line before the step of now
62
+ doneText: "white",
63
+ current: "#3F8D94",
64
+ currentText: "white",
65
+ next: Black(0.25), // The ring of a step that is not reached yet, and its line
66
+ nextText: Black(0.55),
67
+ title: Black(0.82),
68
+ titleNext: Black(0.5),
69
+ note: Black(0.5),
70
+ hover: "rgba(63, 141, 148, 0.12)",
71
+ },
72
+ // ringPlace "step": the ring of basic.js around the whole step; "circle": a ring of ringWidth px around the circle,
73
+ // ringSpace px away from it (it does not cross the lines between the steps)
74
+ focus: { ringColor: "rgba(63, 141, 148, 0.8)", ringPlace: "step", ringWidth: 2, ringSpace: 2 },
75
+ },
76
+ };
77
+
78
+ const StepBar = function (params = {}) {
79
+
80
+ // Merge style package: params.style > StepBar.styles[styleName] > StepBarDefaults.style (light)
81
+ const pageStyle = params.style; // WHY: setTheme() puts it over another package.
82
+ basic.applyStylePackage(params, StepBar.styles, StepBarDefaults);
83
+
84
+ // Merge params:
85
+ mergeIntoIfMissing(params, StepBarDefaults);
86
+
87
+ // BOX: Component container
88
+ const box = startObject(params);
89
+
90
+ // *** PRIVATE VARIABLES:
91
+ let _s = box.style;
92
+ let parts = []; // { step, column, circle, lineBefore, lineAfter, lblTitle, lblNote, isHovered }
93
+
94
+ // *** PRIVATE FUNCTIONS:
95
+
96
+ // The style of a package, with the style of the page over it. (setTheme)
97
+ const styleOfPackage = function (styleName) {
98
+ const fresh = { styleName: styleName, style: pageStyle };
99
+ basic.applyStylePackage(fresh, StepBar.styles, StepBarDefaults);
100
+ mergeIntoIfMissing(fresh, StepBarDefaults);
101
+ return fresh.style;
102
+ };
103
+
104
+ const toStep = function (step, index) {
105
+ if (typeof step != "object" || step === null) return { key: String(index), text: String(step), description: "" };
106
+ return { key: (step.key === undefined) ? String(index) : String(step.key), text: String(step.text || ""), description: String(step.description || "") };
107
+ };
108
+
109
+ const stateOf = function (index) {
110
+ if (index < box.currentStep) return "done";
111
+ return (index === box.currentStep) ? "current" : "next";
112
+ };
113
+
114
+ const canClick = function (index) {
115
+ return (box.canGoBack == 1 && index < box.currentStep);
116
+ };
117
+
118
+ // PAINT: one step as its state says (behind, now, not reached), the mouse on it.
119
+ const paintPart = function (part, index) {
120
+ const colors = _s.colors;
121
+ const state = stateOf(index);
122
+ const isReached = (state !== "next");
123
+ const circle = part.circle;
124
+ circle.color = (isReached) ? colors[state] : "transparent";
125
+ circle.borderColor = (isReached) ? colors[state] : colors.next;
126
+ circle.textColor = (isReached) ? colors[state + "Text"] : colors.nextText;
127
+ circle.text = (state === "done") ? StepBar.CHECK_SVG : String(index + 1);
128
+ circle.boxShadow = (part.isHovered && canClick(index)) ? "0 0 0 " + _s.circle.hoverRing + "px " + colors.hover : "none";
129
+ part.lblTitle.textColor = (isReached) ? colors.title : colors.titleNext;
130
+ part.lblTitle.bold = (state === "current") ? 1 : 0;
131
+ part.lineBefore.color = (index <= box.currentStep) ? colors.done : colors.next;
132
+ part.lineAfter.color = (index < box.currentStep) ? colors.done : colors.next;
133
+ part.column.cursor = canClick(index) ? "pointer" : "default";
134
+ part.column.tabIndex = canClick(index) ? 0 : -1;
135
+ part.column.role = canClick(index) ? "button" : "listitem";
136
+ part.column.aria = { current: (state === "current") ? "step" : null, label: (index + 1) + ". " + part.step.text };
137
+ };
138
+
139
+ const paintParts = function () {
140
+ parts.forEach(paintPart);
141
+ };
142
+
143
+ const onPartClick = function (index) {
144
+ if (!canClick(index)) return;
145
+ box.onStepClick(box, index);
146
+ };
147
+
148
+ // The look that comes from the style: sizes and places.
149
+ const applyPartLook = function (part, index) {
150
+ const circle = _s.circle;
151
+ const line = _s.line;
152
+ part.circle.props({ width: circle.size, height: circle.size, round: circle.size / 2, fontSize: circle.fontSize, border: circle.lineWidth });
153
+ const lineTop = (circle.size - line.size) / 2;
154
+ const lineLength = "calc(50% - " + (circle.size / 2 + line.space) + "px)";
155
+ [part.lineBefore, part.lineAfter].forEach(function (oneLine) {
156
+ oneLine.props({ height: line.size, top: lineTop });
157
+ oneLine.css.width = lineLength;
158
+ });
159
+ part.lineBefore.visible = (index > 0) ? 1 : 0;
160
+ part.lineAfter.visible = (index < parts.length - 1) ? 1 : 0;
161
+ part.lblTitle.props({ fontSize: _s.title.fontSize, visible: box.showTitles });
162
+ part.lblTitle.css.marginTop = _s.title.space + "px";
163
+ part.lblNote.props({ fontSize: _s.note.fontSize, textColor: _s.colors.note, visible: (box.showTitles == 1 && part.step.description !== "") ? 1 : 0 });
164
+ applyFocusRing(part);
165
+ };
166
+
167
+ // The ring of the keyboard: around the step (basic.js), or around its circle (focus.ringPlace "circle")
168
+ const applyFocusRing = function (part) {
169
+ const isCircleRing = (_s.focus.ringPlace === "circle");
170
+ part.column.setFocusRing((isCircleRing) ? "" : _s.focus.ringColor);
171
+ part.column.elem.classList.toggle("step-bar-circle-ring", isCircleRing);
172
+ if (!isCircleRing) return;
173
+ StepBar.injectCss();
174
+ part.column.elem.style.setProperty("--step-bar-ring", _s.focus.ringColor);
175
+ part.column.elem.style.setProperty("--step-bar-ring-width", _s.focus.ringWidth + "px");
176
+ part.column.elem.style.setProperty("--step-bar-ring-space", _s.focus.ringSpace + "px");
177
+ };
178
+
179
+ const createPart = function (step, index) {
180
+ const part = { step: step, isHovered: 0 };
181
+ // GROUP: A step: its circle, its text and its description
182
+ part.column = VGroup({ width: "auto", height: "auto", align: "center top", position: "relative", clipContent: 0, css: { flex: "1 1 0", minWidth: "0" } });
183
+ // BOX: The lines to the steps before and after. WHY two halves: each step draws its own part of the line.
184
+ // WHY absolute: in a group a box takes its place in the flow and pushes the circle down.
185
+ part.lineBefore = Box({ left: 0, color: "transparent", css: { position: "absolute" } });
186
+ part.lineAfter = Box({ left: "auto", color: "transparent", css: { position: "absolute", right: "0" } });
187
+ part.circle = Label({ text: "", textAlign: "center", css: { display: "flex", alignItems: "center", justifyContent: "center", boxSizing: "border-box", flexShrink: "0" } });
188
+ part.circle.elem.classList.add("step-bar-circle");
189
+ part.lblTitle = Label({ width: "100%", textAlign: "center", css: { overflowWrap: "break-word", padding: "0 4px", boxSizing: "border-box" } });
190
+ part.lblTitle.plainText = step.text;
191
+ part.lblNote = Label({ width: "100%", textAlign: "center", css: { overflowWrap: "break-word", padding: "0 4px", boxSizing: "border-box", marginTop: "2px" } });
192
+ part.lblNote.plainText = step.description;
193
+ endGroup();
194
+ part.column.on("click", function () { onPartClick(index); });
195
+ part.column.on("keydown", function (self, event) {
196
+ if (event.key !== "Enter" && event.key !== " ") return;
197
+ event.preventDefault();
198
+ onPartClick(index);
199
+ });
200
+ part.column.onHoverChange(function (self, isOver) {
201
+ part.isHovered = isOver;
202
+ paintPart(part, index);
203
+ });
204
+ return part;
205
+ };
206
+
207
+ const createParts = function () {
208
+ parts.forEach(function (part) { part.column.remove(); });
209
+ createIn(box.row, function () {
210
+ parts = box.steps.map(createPart);
211
+ });
212
+ parts.forEach(applyPartLook);
213
+ paintParts();
214
+ };
215
+
216
+ const inRange = function (index) {
217
+ const number = Math.round(Number(index));
218
+ if (!isFinite(number)) return 0;
219
+ return Math.min(Math.max(number, 0), box.steps.length);
220
+ };
221
+
222
+ // *** PUBLIC FUNCTIONS:
223
+
224
+ // onStepClick is not called. steps.length: every step is done.
225
+ box.setStep = function (index) {
226
+ box.currentStep = inRange(index);
227
+ paintParts();
228
+ };
229
+ // USAGE: steps.setStep(2)
230
+
231
+ box.next = function () {
232
+ box.setStep(box.currentStep + 1);
233
+ };
234
+
235
+ box.previous = function () {
236
+ box.setStep(box.currentStep - 1);
237
+ };
238
+
239
+ box.getStep = function () {
240
+ return box.currentStep;
241
+ };
242
+
243
+ box.setSteps = function (steps) {
244
+ box.steps = (Array.isArray(steps) ? steps : []).map(toStep);
245
+ box.currentStep = inRange(box.currentStep);
246
+ createParts();
247
+ };
248
+ // USAGE: steps.setSteps(["One", "Two"])
249
+
250
+ // Another style package while it is on the page. A style given by the page stays over it.
251
+ box.setTheme = function (styleName) {
252
+ box.styleName = styleName;
253
+ _s = styleOfPackage(styleName);
254
+ box.style = _s;
255
+ parts.forEach(applyPartLook);
256
+ paintParts();
257
+ };
258
+ // USAGE: steps.setTheme("dark")
259
+
260
+ // *** OBJECT VIEW:
261
+
262
+ box.color = "transparent";
263
+ box.clipContent = 0;
264
+ box.role = "list";
265
+ box.aria = { label: box.ariaLabel };
266
+
267
+ // GROUP: The steps side by side. WHY relative: a box of height "auto" grows with it.
268
+ box.row = HGroup({ width: "100%", height: "auto", align: "left top", position: "relative", clipContent: 0 });
269
+ endGroup();
270
+
271
+ // *** OBJECT INIT CODE:
272
+
273
+ box.setSteps(box.steps);
274
+
275
+ return endObject(box);
276
+
277
+ };
278
+
279
+ // The ring of the keyboard around the circle of a step (focus.ringPlace "circle"). WHY CSS: :focus-visible is the
280
+ // keyboard only (a click shows no ring), and the outline follows the round of the circle.
281
+ StepBar.injectCss = function () {
282
+ basic.addCss("step-bar-css",
283
+ ".step-bar-circle-ring:focus { outline: none; }" +
284
+ ".step-bar-circle-ring:focus-visible .step-bar-circle { outline: var(--step-bar-ring-width) solid var(--step-bar-ring);" +
285
+ " outline-offset: var(--step-bar-ring-space); }");
286
+ };
287
+
288
+ StepBar.CHECK_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor"' +
289
+ ' stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round" style="display:block"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>';
290
+
291
+ // *** STYLE PACKAGES:
292
+ // USAGE: StepBar({ styleName: "dark" })
293
+ // USAGE: StepBar({ style: { colors: { current: "tomato" } } }) // Change only some keys.
294
+ // NOTE: A new package needs only the keys that differ from the default (light) style.
295
+ StepBar.styles = {
296
+
297
+ // The dark cyan of the kit on a light page.
298
+ light: StepBarDefaults.style,
299
+
300
+ // For a dark page: the main cyan of the kit.
301
+ dark: {
302
+ colors: {
303
+ done: "#5BBAC1",
304
+ doneText: "#1C1C1B",
305
+ current: "#5BBAC1",
306
+ currentText: "#1C1C1B",
307
+ next: White(0.28),
308
+ nextText: White(0.6),
309
+ title: White(0.88),
310
+ titleNext: White(0.5),
311
+ note: White(0.5),
312
+ hover: "rgba(91, 186, 193, 0.18)",
313
+ },
314
+ focus: { ringColor: "rgba(111, 198, 205, 0.8)" },
315
+ },
316
+
317
+ };
318
+
319
+ // The minimal theme (_designs/minimal-theme.htm): 20 px circles with a 1 px line, ink for the steps that are behind
320
+ // and the step of now, a soft line for the steps that are not reached yet; 12 px titles. minimalDark: on a dark window.
321
+ StepBar.createMinimalStyle = function (palette) {
322
+ return {
323
+ circle: { size: 20, fontSize: 11, lineWidth: 1, hoverRing: 4 },
324
+ title: { fontSize: 12, space: 6 },
325
+ note: { fontSize: 11 },
326
+ line: { size: 1, space: 5 }, // WHY 5: the ring of the keyboard (2 + 1.5 px around the circle) does not touch the line
327
+ colors: {
328
+ done: palette.ink,
329
+ doneText: palette.onInk,
330
+ current: palette.ink,
331
+ currentText: palette.onInk,
332
+ next: palette.line,
333
+ nextText: palette.softText,
334
+ title: palette.text,
335
+ titleNext: palette.softText,
336
+ note: palette.softText,
337
+ hover: palette.hover,
338
+ },
339
+ focus: { ringColor: palette.focus, ringPlace: "circle", ringWidth: 1.5, ringSpace: 2 },
340
+ };
341
+ };
342
+ StepBar.MINIMAL_COLORS = { ground: "#FFFFFF", text: Black(0.85), softText: Black(0.55), line: Black(0.2), ink: "#1F1F1F", onInk: "#FFFFFF", hover: Black(0.08), focus: "#3D8BD9" };
343
+ StepBar.styles.minimal = StepBar.createMinimalStyle(StepBar.MINIMAL_COLORS);
344
+ StepBar.MINIMAL_DARK_COLORS = { ground: "#1A1A19", text: White(0.88), softText: White(0.55), line: White(0.18), ink: "#EDEDEB", onInk: "#1A1A19", hover: White(0.1), focus: "#7FB6DE" };
345
+ StepBar.styles.minimalDark = StepBar.createMinimalStyle(StepBar.MINIMAL_DARK_COLORS);