@zumer/orbit-kit 0.1.0 → 2.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.
- package/README.md +110 -316
- package/package.json +20 -8
- package/src/base.js +606 -41
- package/src/color.js +139 -0
- package/src/o-clock.js +106 -129
- package/src/o-color-wheel.js +322 -0
- package/src/o-compass.js +45 -49
- package/src/o-donut.js +67 -79
- package/src/o-gauge.js +51 -117
- package/src/o-instrument.js +116 -105
- package/src/o-knob.js +137 -129
- package/src/o-menu.js +271 -183
- package/src/o-meter.js +35 -89
- package/src/o-radar-chart.js +391 -0
- package/src/o-radar.js +80 -123
- package/src/o-range.js +509 -0
- package/src/o-rings.js +66 -77
- package/src/o-spinner.js +214 -0
- package/src/o-status.js +209 -0
- package/src/o-sunburst.js +569 -0
- package/src/o-time-picker.js +447 -0
- package/src/o-timer.js +240 -0
- package/src/o-wheel.js +436 -0
- package/src/orbit-kit.js +23 -5
package/README.md
CHANGED
|
@@ -1,395 +1,189 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Orbit Kit
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[Orbit](https://github.com/zumerlab/orbit) CSS framework.
|
|
5
|
-
|
|
6
|
-
Orbit gives you **primitives** — a CSS engine for radial layout. It's powerful,
|
|
7
|
-
but composing a single widget means nesting five levels
|
|
8
|
-
(`.bigbang > .gravity-spot > .orbit-N > .satellite > .capsule`) and getting the
|
|
9
|
-
rules exactly right. That depth is the main barrier to entry, for humans *and*
|
|
10
|
-
for LLMs.
|
|
11
|
-
|
|
12
|
-
**orbit-kit** wraps the common radial patterns into one-line custom elements —
|
|
13
|
-
gauges, charts, activity rings, knobs, pie menus, cockpit instruments, analog
|
|
14
|
-
clocks, compasses and radars:
|
|
3
|
+
Ready-made radial components built on [Orbit](https://github.com/zumerlab/orbit): gauges, donut charts, activity rings, knobs, radial menus, instruments, clocks, compasses, radars, timers and status rings. One tag each.
|
|
15
4
|
|
|
16
5
|
```html
|
|
17
|
-
<!-- Before: raw primitives -->
|
|
18
|
-
<div class="bigbang" style="width:200px;aspect-ratio:1">
|
|
19
|
-
<div class="gravity-spot">
|
|
20
|
-
<div class="orbit-4" style="--o-range:270deg;--o-from:225deg">
|
|
21
|
-
<o-progress value="72" shape="rounded"
|
|
22
|
-
style="--o-fill:#6366f1;--o-stroke-width:8"></o-progress>
|
|
23
|
-
</div>
|
|
24
|
-
<div class="orbit-0">
|
|
25
|
-
<div class="satellite at-center"><div class="capsule">72%</div></div>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
<!-- After: orbit-kit -->
|
|
31
6
|
<o-gauge value="72" unit="%"></o-gauge>
|
|
32
7
|
```
|
|
33
8
|
|
|
34
|
-
|
|
9
|
+
That tag writes the Orbit structure you would write by hand into the page: a `.bigbang`, a `.gravity-spot`, a ring, two arcs and a readout. It scales with its box, takes your CSS and shows up as plain elements in the inspector. When you need something the kit does not do, start from what it built.
|
|
10
|
+
|
|
11
|
+
[Documentation and live examples](https://zumerlab.com/orbit/kit/)
|
|
35
12
|
|
|
36
13
|
## Install
|
|
37
14
|
|
|
38
|
-
|
|
15
|
+
The kit needs Orbit 2 on the page: its stylesheet, and its script, which draws the arcs.
|
|
16
|
+
|
|
17
|
+
```sh
|
|
39
18
|
npm install @zumer/orbit @zumer/orbit-kit
|
|
40
19
|
```
|
|
41
20
|
|
|
42
21
|
```js
|
|
43
|
-
import '@zumer/orbit/style'
|
|
44
|
-
import '@zumer/orbit'
|
|
45
|
-
import '@zumer/orbit-kit'
|
|
22
|
+
import '@zumer/orbit/style'
|
|
23
|
+
import '@zumer/orbit'
|
|
24
|
+
import '@zumer/orbit-kit'
|
|
46
25
|
```
|
|
47
26
|
|
|
48
|
-
Or
|
|
27
|
+
Or in a plain page:
|
|
49
28
|
|
|
50
29
|
```html
|
|
51
|
-
<link rel="stylesheet" href="https://unpkg.com/@zumer/orbit
|
|
52
|
-
<script src="https://unpkg.com/@zumer/orbit
|
|
53
|
-
<script type="module" src="https://unpkg.com/@zumer/orbit-kit
|
|
30
|
+
<link rel="stylesheet" href="https://unpkg.com/@zumer/orbit/dist/orbit.min.css">
|
|
31
|
+
<script defer src="https://unpkg.com/@zumer/orbit/dist/orbit.min.js"></script>
|
|
32
|
+
<script type="module" src="https://unpkg.com/@zumer/orbit-kit/src/orbit-kit.js"></script>
|
|
54
33
|
```
|
|
55
34
|
|
|
56
|
-
|
|
57
|
-
`<o-arc>` / `<o-progress>`) is present on the page.
|
|
58
|
-
|
|
59
|
-
Every component is a standard custom element, so it works in plain HTML and in
|
|
60
|
-
any framework (React, Vue, Svelte, Angular). Import the whole kit, or just the
|
|
61
|
-
components you use:
|
|
35
|
+
The entry registers every component. To load only the ones you use, import their files:
|
|
62
36
|
|
|
63
37
|
```js
|
|
64
|
-
import '@zumer/orbit-kit/
|
|
65
|
-
import '@zumer/orbit-kit/
|
|
38
|
+
import '@zumer/orbit-kit/o-gauge.js'
|
|
39
|
+
import '@zumer/orbit-kit/o-timer.js'
|
|
66
40
|
```
|
|
67
41
|
|
|
68
|
-
|
|
42
|
+
`@zumer/orbit` 2 is a peer dependency. The kit does not work with Orbit 1.x. Components are standard custom elements, so they work in plain HTML and in any framework that renders the DOM.
|
|
43
|
+
|
|
44
|
+
Inside a shadow root (a card, a component of yours) the page's stylesheets do not reach the components. The kit adopts its own stylesheets into that root on its own. Orbit's stylesheet is yours to put there, as for any Orbit layout in shadow DOM: `root.adoptedStyleSheets = [orbitSheet]`, or a `<link>` inside the root. `base.js` exports `adoptKitStyles(root)` for a root you fill before any component connects.
|
|
69
45
|
|
|
70
46
|
## Components
|
|
71
47
|
|
|
72
48
|
| Tag | What it is |
|
|
73
|
-
|
|
74
|
-
| [`<o-gauge>`](
|
|
75
|
-
| [`<o-donut>`](
|
|
76
|
-
| [`<o-rings>`](
|
|
77
|
-
| [`<o-knob>`](
|
|
78
|
-
| [`<o-menu>`](
|
|
79
|
-
| [`<o-instrument>`](
|
|
80
|
-
| [`<o-clock>`](
|
|
81
|
-
| [`<o-compass>`](
|
|
82
|
-
| [`<o-radar>`](
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
### `<o-gauge>`
|
|
97
|
-
|
|
98
|
-
A single value on an arc, with a center readout.
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| [`<o-gauge>`](https://zumerlab.com/orbit/kit/gauge.html) | One value on an arc, with a readout. |
|
|
51
|
+
| [`<o-donut>`](https://zumerlab.com/orbit/kit/donut.html) | A donut chart from a JSON array. |
|
|
52
|
+
| [`<o-rings>`](https://zumerlab.com/orbit/kit/rings.html) | Concentric activity rings. |
|
|
53
|
+
| [`<o-knob>`](https://zumerlab.com/orbit/kit/knob.html) | A rotary control: pointer, wheel and keys. |
|
|
54
|
+
| [`<o-menu>`](https://zumerlab.com/orbit/kit/menu.html) | A radial menu, flat or nested. |
|
|
55
|
+
| [`<o-instrument>`](https://zumerlab.com/orbit/kit/instrument.html) | Needle gauges with ticks, zones and presets. |
|
|
56
|
+
| [`<o-clock>`](https://zumerlab.com/orbit/kit/clock.html) | Clocks and watch faces, live or fixed. |
|
|
57
|
+
| [`<o-compass>`](https://zumerlab.com/orbit/kit/compass.html) | A heading indicator. |
|
|
58
|
+
| [`<o-radar>`](https://zumerlab.com/orbit/kit/radar.html) | A scope with a sweep and blips. |
|
|
59
|
+
| [`<o-timer>`](https://zumerlab.com/orbit/kit/timer.html) | A countdown ring with start, pause and reset. |
|
|
60
|
+
| [`<o-status>`](https://zumerlab.com/orbit/kit/status.html) | Health of many things as colored segments, in layers. |
|
|
61
|
+
| [`<o-range>`](https://zumerlab.com/orbit/kit/range.html) | A circular range slider: two handles, numbers or times of day. |
|
|
62
|
+
| [`<o-time-picker>`](https://zumerlab.com/orbit/kit/time-picker.html) | A clock-face time picker: hours, then minutes. |
|
|
63
|
+
| [`<o-spinner>`](https://zumerlab.com/orbit/kit/spinner.html) | A loading indicator in five variants, with determinate progress. |
|
|
64
|
+
| [`<o-radar-chart>`](https://zumerlab.com/orbit/kit/radar-chart.html) | A radar (spider) chart: one polygon per series on a shared web. |
|
|
65
|
+
| [`<o-sunburst>`](https://zumerlab.com/orbit/kit/sunburst.html) | A tree as nested rings: hover a branch, click to zoom in. |
|
|
66
|
+
| [`<o-wheel>`](https://zumerlab.com/orbit/kit/wheel.html) | A prize wheel: spins, slows down and lands on a result picked by weight. |
|
|
67
|
+
| [`<o-color-wheel>`](https://zumerlab.com/orbit/kit/color-wheel.html) | A color picker: hue ring, saturation and brightness square, swatches. A form control. |
|
|
68
|
+
|
|
69
|
+
`<o-meter>`, a basic needle gauge from 0.x, still ships. `<o-instrument>` does all it does and more.
|
|
70
|
+
|
|
71
|
+
A few of them:
|
|
99
72
|
|
|
100
73
|
```html
|
|
101
|
-
<o-
|
|
102
|
-
<o-gauge value="125" max="240" label="125 km/h" range="360" glow></o-gauge>
|
|
103
|
-
```
|
|
74
|
+
<o-donut label="$2.4k" data='[{"value":52,"label":"Rent"},{"value":28,"label":"Food"},{"value":20,"label":"Other"}]'></o-donut>
|
|
104
75
|
|
|
105
|
-
|
|
106
|
-
|---|---|---|
|
|
107
|
-
| `value` | `0` | Current value. |
|
|
108
|
-
| `max` | `100` | Value that fills the whole arc. |
|
|
109
|
-
| `range` | `270` | Arc span in degrees (`360` = full ring, `180` = semicircle). |
|
|
110
|
-
| `from` | auto | Start angle; defaults so the gap sits at the bottom. |
|
|
111
|
-
| `size` | `200px` | Widget width. |
|
|
112
|
-
| `label` | — | Center text; overrides the auto `value`+`unit`. |
|
|
113
|
-
| `unit` | `""` | Suffix on the value (`%`, `km/h`). |
|
|
114
|
-
| `fill` | `#6366f1` | Progress color. |
|
|
115
|
-
| `track` | `#262d38` | Background ring color. |
|
|
116
|
-
| `stroke-width` | `8` | Ring thickness. |
|
|
117
|
-
| `shape` | `rounded` | Arc cap shape (`rounded`, `none`). |
|
|
118
|
-
| `glow` | off | Neon glow on the progress arc. |
|
|
76
|
+
<o-knob value="65" unit="%" aria-label="Volume"></o-knob>
|
|
119
77
|
|
|
120
|
-
|
|
78
|
+
<o-instrument preset="tachometer" value="6.2"></o-instrument>
|
|
121
79
|
|
|
122
|
-
|
|
80
|
+
<o-clock preset="chrono" live></o-clock>
|
|
123
81
|
|
|
124
|
-
|
|
125
|
-
or to an explicit `total` for a partial ring.
|
|
82
|
+
<o-timer duration="1:30" label="Tea"></o-timer>
|
|
126
83
|
|
|
127
|
-
|
|
128
|
-
<o-donut label="$2.4k"
|
|
129
|
-
data='[{"value":52,"color":"#f97316","label":"Rent"},
|
|
130
|
-
{"value":28,"color":"#eab308"},
|
|
131
|
-
{"value":20,"color":"#22c55e"}]'></o-donut>
|
|
84
|
+
<o-status label="Services" data='[{"label":"API","status":"ok"},{"label":"DB","status":"warn"},{"label":"Queue","status":"down"}]'></o-status>
|
|
132
85
|
```
|
|
133
86
|
|
|
134
|
-
|
|
135
|
-
|---|---|---|
|
|
136
|
-
| `data` | `[]` | `[{ value, color?, label? }]`. Colors fall back to a palette. |
|
|
137
|
-
| `total` | sum | Denominator; set it for a partial ring (e.g. `total="100"`). |
|
|
138
|
-
| `range` / `from` | `360` / `0` | Arc span and start angle. |
|
|
139
|
-
| `stroke-width` | `14` | Ring thickness. |
|
|
140
|
-
| `gap` | `2` | Spacing between segments. |
|
|
141
|
-
| `shape` | `none` | Segment caps (`none`, or `rounded` to opt in). |
|
|
142
|
-
| `track` | faint | Background ring color. |
|
|
143
|
-
| `label` / `unit` | — | Center text. |
|
|
144
|
-
| `glow` | off | Neon glow per segment. |
|
|
87
|
+
Every attribute, event and custom property is on the component's page in the documentation.
|
|
145
88
|
|
|
146
|
-
|
|
89
|
+
## What they share
|
|
147
90
|
|
|
148
|
-
|
|
91
|
+
- `size` sets the width with any CSS length. `100%` follows the container as it resizes.
|
|
92
|
+
- `thickness` sets band thickness in lanes, Orbit's unit: a twelfth of the radius.
|
|
93
|
+
- `fill` and `track` color the band components; `accent` is the highlight of the dial components.
|
|
94
|
+
- `label` and `unit` set the text in the middle; `range` and `from` the arc span and start angle.
|
|
95
|
+
- `min`, `max`, `step`, `format` and `theme`: see [Shared options](#shared-options).
|
|
96
|
+
- `glow` adds a glow in the indicator color (`glow="12"` for the blur in px).
|
|
97
|
+
- Lists (`data`, `items`, `targets`, `zones`) are JSON in the attribute.
|
|
98
|
+
- Change an attribute and the component updates. Values only move what moves.
|
|
149
99
|
|
|
150
|
-
|
|
151
|
-
solid track in its own color.
|
|
100
|
+
Colors are custom properties that inherit, so one rule themes a whole panel:
|
|
152
101
|
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
102
|
+
```css
|
|
103
|
+
.dashboard {
|
|
104
|
+
--ok-fill: #2dd4bf;
|
|
105
|
+
--ok-track: #12302c;
|
|
106
|
+
--ok-accent: #f97316;
|
|
107
|
+
--ok-text: #e2e8f0;
|
|
108
|
+
}
|
|
157
109
|
```
|
|
158
110
|
|
|
159
|
-
|
|
160
|
-
|---|---|---|
|
|
161
|
-
| `data` | `[]` | `[{ value, max?, color?, label? }]`. |
|
|
162
|
-
| `range` / `from` | `360` | Arc span and start angle. |
|
|
163
|
-
| `stroke-width` | `12` | Ring thickness. |
|
|
164
|
-
| `step` | `1` | Orbit gap between rings. |
|
|
165
|
-
| `track` | auto | Track color (defaults to a dim wash of each ring's color). |
|
|
166
|
-
| `shape` | `rounded` | Cap shape. |
|
|
167
|
-
| `label` / `unit` | — | Center text. |
|
|
168
|
-
| `glow` | off | Neon glow per ring. |
|
|
111
|
+
Text scales with the widget: the base font size is a share of its box (`--ok-font-size`) and readouts are sized in `em`.
|
|
169
112
|
|
|
170
|
-
|
|
113
|
+
## Shared options
|
|
171
114
|
|
|
172
|
-
|
|
115
|
+
Four things work the same in every component that has them.
|
|
173
116
|
|
|
174
|
-
|
|
117
|
+
**Themes.** `theme="dark"`, `"light"` or `"glass"` on a component, or the class `ok-theme-dark`, `ok-theme-light` or `ok-theme-glass` on a container, and everything inside follows. A theme is only a set of the `--ok-*` properties above, at zero specificity, so any rule of yours still wins. Without a theme nothing changes.
|
|
175
118
|
|
|
176
119
|
```html
|
|
177
|
-
<
|
|
120
|
+
<section class="ok-theme-light">
|
|
121
|
+
<o-gauge value="64" unit="%"></o-gauge>
|
|
122
|
+
<o-knob value="40"></o-knob>
|
|
123
|
+
</section>
|
|
178
124
|
```
|
|
179
125
|
|
|
180
|
-
|
|
181
|
-
knob.addEventListener('input', e => console.log(e.detail.value)); // while dragging
|
|
182
|
-
knob.addEventListener('change', e => console.log(e.detail.value)); // on release
|
|
183
|
-
knob.value = 40; // read / write
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
Drag vertically, scroll the wheel, or use arrow keys / Page Up·Down / Home·End
|
|
187
|
-
when focused. `role="slider"` + ARIA values are set for you.
|
|
188
|
-
|
|
189
|
-
| Attribute | Default | Description |
|
|
190
|
-
|---|---|---|
|
|
191
|
-
| `value` | `min` | Current value. |
|
|
192
|
-
| `min` / `max` | `0` / `100` | Range. |
|
|
193
|
-
| `step` | `1` | Increment for keys / wheel and snapping. |
|
|
194
|
-
| `range` / `from` | `270` / auto | Arc span and start angle. |
|
|
195
|
-
| `size` | `160px` | Widget width. |
|
|
196
|
-
| `fill` | `#a1a1aa` | Value color. |
|
|
197
|
-
| `track` | `#27272a` | Track color. |
|
|
198
|
-
| `stroke-width` | `14` | Ring thickness. |
|
|
199
|
-
| `unit` / `label` | — | Center readout. |
|
|
200
|
-
| `disabled` | off | Non-interactive + dimmed. |
|
|
201
|
-
| `glow` | off | Neon glow on the value arc. |
|
|
202
|
-
|
|
203
|
-
---
|
|
204
|
-
|
|
205
|
-
### `<o-menu>`
|
|
206
|
-
|
|
207
|
-
A radial / pie menu. Items may nest via `children` for multi-level menus, with
|
|
208
|
-
two ways to reveal a branch.
|
|
126
|
+
**Number format.** `format` is `decimal`, `percent`, `currency`, `unit` or `compact`, with `decimals`, `currency` and `locale`. It goes through `Intl.NumberFormat` and reaches readouts, tick labels and `aria-valuetext`. `percent` shows where the value sits between `min` and `max`. `unit` stays plain text after the number, except with `format="unit"`, where it names an Intl unit. For full control, set a function:
|
|
209
127
|
|
|
210
128
|
```html
|
|
211
|
-
<o-
|
|
212
|
-
|
|
213
|
-
{"label":"Size","icon":"🔠","children":[
|
|
214
|
-
{"label":"Bigger","value":"size.up"},
|
|
215
|
-
{"label":"Smaller","value":"size.down"}]},
|
|
216
|
-
{"label":"Format","icon":"✏️","children":[
|
|
217
|
-
{"label":"Bold","value":"fmt.bold"},
|
|
218
|
-
{"label":"Italic","value":"fmt.italic"}]},
|
|
219
|
-
{"label":"Color","icon":"🎨","value":"color"}]'></o-menu>
|
|
129
|
+
<o-gauge value="1234.5" max="5000" format="currency" currency="EUR" locale="de-DE"></o-gauge>
|
|
130
|
+
<o-instrument max="240" value="88" format="unit" unit="kilometer-per-hour"></o-instrument>
|
|
220
131
|
```
|
|
221
132
|
|
|
222
133
|
```js
|
|
223
|
-
|
|
224
|
-
menu.addEventListener('navigate', e => e.detail); // { path, depth }
|
|
225
|
-
menu.back(); menu.reset(); menu.path; // navigation API
|
|
134
|
+
gauge.formatter = (value, { kind }) => kind === 'tick' ? `${value}` : `${value} pts`
|
|
226
135
|
```
|
|
227
136
|
|
|
228
|
-
|
|
229
|
-
|---|---|---|
|
|
230
|
-
| `items` | `[]` | `[{ label, value?, color?, icon?, children? }]` (recursive). |
|
|
231
|
-
| `expand` | `drill` | `drill` (ring replaces itself, center = back) or `concentric` (parent stays, children fan out — the editor look). |
|
|
232
|
-
| `theme` | `mono` | `mono` (slate sectors tinted by `accent` on hover/active) or `color` (refined per-item palette). |
|
|
233
|
-
| `accent` | `#3da9fc` | Accent for the `mono` theme. |
|
|
234
|
-
| `range` / `from` | `360` | Arc span and start angle (`270` for a quick action wheel). |
|
|
235
|
-
| `size` | `280px` | Widget width. |
|
|
236
|
-
| `gap` | `6` | Spacing between sectors. |
|
|
237
|
-
| `label` | `MENU` | Center / breadcrumb text. |
|
|
137
|
+
**min, max and step.** Every component with a value reads them the way `<input type="range">` does: values are clamped, `step` snaps them (`step="any"` turns it off), and a `max` below `min` becomes `min`. Arrow keys move one step, Page Up and Page Down ten.
|
|
238
138
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
### `<o-instrument>`
|
|
244
|
-
|
|
245
|
-
Cockpit / dashboard gauges with major + minor ticks, color zones, a redline, a
|
|
246
|
-
numeric scale, a needle and a digital readout. Driven by **presets**, or
|
|
247
|
-
configured by hand.
|
|
248
|
-
|
|
249
|
-
```html
|
|
250
|
-
<o-instrument preset="tachometer" value="6.2"></o-instrument>
|
|
251
|
-
<o-instrument preset="airspeed" value="120"></o-instrument>
|
|
252
|
-
<o-instrument min="0" max="100" value="40" unit="%" label="LOAD"
|
|
253
|
-
zones='[{"from":85,"to":100,"color":"#ef4444"}]'></o-instrument>
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
**Presets:** `tachometer`, `speedometer`, `fuel`, `temp`, `boost`, `voltmeter`,
|
|
257
|
-
`airspeed`, `altimeter`, `cpu`, `gpu`, `vu`. Any attribute below overrides the
|
|
258
|
-
preset.
|
|
259
|
-
|
|
260
|
-
| Attribute | Default | Description |
|
|
261
|
-
|---|---|---|
|
|
262
|
-
| `value` | `min` | Current reading. |
|
|
263
|
-
| `min` / `max` | `0` / `100` | Scale range. |
|
|
264
|
-
| `range` / `from` | `270` / auto | Arc span and start angle. |
|
|
265
|
-
| `ticks` | `7` | Major tick / label count. |
|
|
266
|
-
| `minor` | `5` | Minor ticks between each pair of majors. |
|
|
267
|
-
| `zones` | `[]` | `[{ from, to, color }]` color bands (in value units). |
|
|
268
|
-
| `redline` | — | Sugar: a red zone from this value to `max`. |
|
|
269
|
-
| `tick-labels` | numeric | Custom scale labels, e.g. `'["E","½","F"]'`. |
|
|
270
|
-
| `unit` / `label` | — | Readout unit and caption. |
|
|
271
|
-
| `digital` | on | Show the numeric readout. |
|
|
272
|
-
| `case` | auto | `round`, `square`, `rounded`, or `bare` (auto for ≤180° arcs). |
|
|
273
|
-
| `accent` / `needle-color` / `tick-color` / `face` / `bezel` | — | Theming. |
|
|
274
|
-
| `size` | `240px` | Widget width. |
|
|
275
|
-
| `glow` | off | Neon glow on the needle / zones. |
|
|
276
|
-
|
|
277
|
-
> `<o-meter>` (a basic speedometer) still ships for back-compat but is
|
|
278
|
-
> superseded by `<o-instrument preset="speedometer">`.
|
|
279
|
-
|
|
280
|
-
---
|
|
281
|
-
|
|
282
|
-
### `<o-clock>`
|
|
283
|
-
|
|
284
|
-
The flagship: an analog clock / watch face. Live or static, with case shapes,
|
|
285
|
-
an oval (tonneau) dial, numerals, smartwatch complications, chronograph
|
|
286
|
-
sub-dials, and an iOS activity-rings face.
|
|
139
|
+
**Forms.** `<o-knob>` and `<o-menu>` are form controls. Give them a `name` and they submit with the form, follow `disabled` (also from a `<fieldset>`), reset with it and come back on page restore. The menu takes `required` and a `value` to start from. Both fire `input` and `change` like native inputs; setting `value` from code fires neither.
|
|
287
140
|
|
|
288
141
|
```html
|
|
289
|
-
<
|
|
290
|
-
<o-
|
|
291
|
-
<o-
|
|
292
|
-
|
|
293
|
-
<o-clock case="rectangle" dial="oval" live smooth></o-clock> <!-- tonneau -->
|
|
294
|
-
<o-clock dial="rings" live seconds></o-clock> <!-- iOS activity-ring clock -->
|
|
142
|
+
<form>
|
|
143
|
+
<o-knob name="volume" value="30"></o-knob>
|
|
144
|
+
<o-menu name="action" required items='[{"label":"Cut","value":"cut"},{"label":"Copy","value":"copy"}]'></o-menu>
|
|
145
|
+
</form>
|
|
295
146
|
```
|
|
296
147
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
| Attribute | Default | Description |
|
|
300
|
-
|---|---|---|
|
|
301
|
-
| `time` | now | Static `HH:MM[:SS]`. Omit for the current time. |
|
|
302
|
-
| `live` | off | Tick with the real clock. |
|
|
303
|
-
| `smooth` | off | Sweeping (not ticking) second hand; implies `seconds`. |
|
|
304
|
-
| `seconds` | off | Show a second hand. |
|
|
305
|
-
| `numerals` | `arabic` | `arabic`, `roman`, or `none`. |
|
|
306
|
-
| `case` | `round` | `round`, `square`, `rounded`, `rectangle`. |
|
|
307
|
-
| `dial` | `round` | `round`, `oval` (tonneau, matches the case), or `rings` (iOS face). |
|
|
308
|
-
| `digital` / `date` / `brand` | off / off / — | Complications. |
|
|
309
|
-
| `subdials` | off | Chronograph sub-dials (small-seconds / 24h / date). |
|
|
310
|
-
| `accent` / `hand-color` / `tick-color` / `face` / `bezel` / `case-bg` | — | Theming (also via CSS vars, e.g. `--ok-clock-accent`). |
|
|
311
|
-
| `size` | `300px` | Widget width. |
|
|
312
|
-
| `glow` | off | Neon glow on the hands. |
|
|
148
|
+
Every component has a role and a name that follow its value: gauges and instruments are meters, the knob is a slider, the menu is a menu, the timer is a timer. `aria-valuetext` uses the number format. An `aria-label` of yours is kept. Decorative motion stops with `prefers-reduced-motion`.
|
|
313
149
|
|
|
314
|
-
|
|
150
|
+
## How it works
|
|
315
151
|
|
|
316
|
-
|
|
152
|
+
Components render into the light DOM on purpose. Orbit places things with global CSS and inherited `--o-*` properties, and its runtime watches the document to number rings and draw arcs, so the kit's markup has to live where both can reach it. Each component is sized by its universe, like any Orbit 2 layout: the `.bigbang` is as wide as `size`, `orbit-12` touches its edge, and everything else is laid out in lanes.
|
|
317
153
|
|
|
318
|
-
|
|
319
|
-
cardinals) rotates so the current `heading` sits under the index.
|
|
154
|
+
## Coming from 0.x
|
|
320
155
|
|
|
321
|
-
|
|
322
|
-
<o-compass heading="045"></o-compass>
|
|
323
|
-
<o-compass heading="120" labels="N,NE,E,SE,S,SW,W,NW"></o-compass>
|
|
324
|
-
```
|
|
156
|
+
Tag names and attributes still work. What changed is underneath:
|
|
325
157
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
| `size` | `220px` | Widget width. |
|
|
158
|
+
- The kit runs on Orbit 2.
|
|
159
|
+
- Components are sized by their universe instead of a scaled `--o-force`. The outer band touches the edge of the widget, so a gauge looks a little bigger in the same `size`.
|
|
160
|
+
- `thickness` sets band thickness. `orbit` and `stroke-width` still work as before.
|
|
161
|
+
- `gap` is a share of the widget width, the same in the donut, the menu and the status ring.
|
|
162
|
+
- Colors are custom properties you can set from CSS.
|
|
163
|
+
- New: `<o-timer>`, `<o-status>`, `min` on the gauge, `accent` on the compass and the radar.
|
|
333
164
|
|
|
334
|
-
|
|
165
|
+
The [CHANGELOG](CHANGELOG.md) has the full list.
|
|
335
166
|
|
|
336
|
-
|
|
167
|
+
## Development
|
|
337
168
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
<o-radar rings="4" spokes="12" label="SCAN"
|
|
343
|
-
targets='[{"angle":60,"dist":0.8},
|
|
344
|
-
{"angle":200,"dist":0.45},
|
|
345
|
-
{"angle":310,"dist":0.65,"color":"#ef4565"}]'></o-radar>
|
|
169
|
+
```sh
|
|
170
|
+
npm install
|
|
171
|
+
npx playwright install chromium
|
|
172
|
+
npm test
|
|
346
173
|
```
|
|
347
174
|
|
|
348
|
-
|
|
349
|
-
|---|---|---|
|
|
350
|
-
| `targets` | `[]` | `[{ angle, dist, color? }]` — `angle` °CW from top, `dist` 0–1. |
|
|
351
|
-
| `rings` | `4` | Concentric range rings. |
|
|
352
|
-
| `spokes` | `8` | Radial cross-hair lines. |
|
|
353
|
-
| `sweep` | on | The rotating beam (`sweep="false"` to hide). |
|
|
354
|
-
| `sweep-width` | `110` | Beam span in degrees. |
|
|
355
|
-
| `speed` | `4` | Seconds per revolution. |
|
|
356
|
-
| `color` | `#22d3ee` | Scope color. |
|
|
357
|
-
| `label` | — | Center label. |
|
|
358
|
-
| `size` | `240px` | Widget width. |
|
|
359
|
-
|
|
360
|
-
---
|
|
361
|
-
|
|
362
|
-
## How it works
|
|
363
|
-
|
|
364
|
-
orbit-kit components render their structure into the **light DOM** (not shadow
|
|
365
|
-
DOM) on purpose. Orbit positions elements through global CSS (`cos()` / `sin()`
|
|
366
|
-
/ `:has()`) and inherited `--o-*` custom properties, so a layout-composing
|
|
367
|
-
component must live in the light DOM for the engine and the cascade to reach it.
|
|
368
|
-
The generated markup is exactly the documented Orbit structure — "view source"
|
|
369
|
-
stays honest. Inspect any component in devtools to see the rings, satellites and
|
|
370
|
-
arcs it expands into.
|
|
175
|
+
`npm test` runs the Node checks and a browser suite against a real Orbit 2 build. It uses `ORBIT_DIR` when set, then a sibling `../orbit` checkout with a fresh `dist/`, then `node_modules/@zumer/orbit`. Chromium is required; Firefox and WebKit run when installed (`BROWSERS=chromium,firefox,webkit` makes them required). The browser suite fails on page errors, console errors and any `[orbit]` warning.
|
|
371
176
|
|
|
372
|
-
|
|
373
|
-
attributes above just map onto them.
|
|
177
|
+
To try changes in the documentation site, copy `src/` to `docs/kit/src/` in the Orbit repository and run its `npm run demo`; a sibling `orbit-kit` checkout is picked up on its own.
|
|
374
178
|
|
|
375
|
-
##
|
|
376
|
-
|
|
377
|
-
Live showcase of every component: **[zumerlab.com/orbit-kit](https://zumerlab.com/orbit-kit)**
|
|
378
|
-
(source in [`docs/index.html`](docs/index.html)).
|
|
179
|
+
## Browser support
|
|
379
180
|
|
|
380
|
-
|
|
181
|
+
Modern evergreen browsers. Orbit needs CSS `sin()`, `cos()`, container query units and `:has()`; the radar and clock faces also use `conic-gradient` and `color-mix()`.
|
|
381
182
|
|
|
382
|
-
|
|
383
|
-
npx serve .
|
|
384
|
-
# then open /docs/index.html
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
## Browser support
|
|
183
|
+
## Sponsor
|
|
388
184
|
|
|
389
|
-
|
|
390
|
-
functions (`cos`, `sin`); the radar/clock visuals use `conic-gradient` and
|
|
391
|
-
`color-mix`. Orbit shows an upgrade notice on unsupported browsers.
|
|
185
|
+
Orbit Kit is free and made in spare time. If it saves you time, you can [sponsor it on GitHub](https://github.com/sponsors/tinchox5).
|
|
392
186
|
|
|
393
187
|
## License
|
|
394
188
|
|
|
395
|
-
[MIT](LICENSE)
|
|
189
|
+
[MIT](LICENSE). Juan Martín Muda, [Zumerlab](https://github.com/zumerlab).
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zumer/orbit-kit",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Ready-made radial web components built on Orbit 2: gauges, donut charts, activity rings, knobs, radial menus, instruments, clocks, compasses, radars, timers and status rings, one tag each.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/orbit-kit.js",
|
|
7
7
|
"module": "src/orbit-kit.js",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./src/orbit-kit.js",
|
|
10
|
+
"./src/*": "./src/*",
|
|
10
11
|
"./*": "./src/*"
|
|
11
12
|
},
|
|
12
13
|
"files": [
|
|
@@ -16,12 +17,15 @@
|
|
|
16
17
|
"./src/*.js"
|
|
17
18
|
],
|
|
18
19
|
"scripts": {
|
|
19
|
-
"
|
|
20
|
+
"demo": "node scripts/demo.mjs",
|
|
21
|
+
"test": "npm run test:unit && npm run test:browser",
|
|
20
22
|
"shots": "node test/shoot.mjs",
|
|
21
|
-
"shots:menus": "node test/shoot-menus.mjs"
|
|
23
|
+
"shots:menus": "node test/shoot-menus.mjs",
|
|
24
|
+
"test:unit": "node test/package.mjs && node test/smoke.mjs && node test/control-regressions.mjs && node test/data-regressions.mjs && node test/shared-options.mjs && node test/spinner.mjs && node test/radar-chart.mjs && node test/range.mjs && node test/time-picker.mjs && node test/sunburst.mjs && node test/wheel.mjs && node test/color-wheel.mjs",
|
|
25
|
+
"test:browser": "node test/browser.mjs && node test/browser-spinner.mjs && node test/browser-radar-chart.mjs && node test/browser-range.mjs && node test/browser-time-picker.mjs && node test/browser-sunburst.mjs && node test/browser-wheel.mjs && node test/browser-color-wheel.mjs"
|
|
22
26
|
},
|
|
23
27
|
"peerDependencies": {
|
|
24
|
-
"@zumer/orbit": "^
|
|
28
|
+
"@zumer/orbit": "^2.0.0"
|
|
25
29
|
},
|
|
26
30
|
"devDependencies": {
|
|
27
31
|
"playwright": "^1.55.1"
|
|
@@ -42,9 +46,13 @@
|
|
|
42
46
|
"dashboard",
|
|
43
47
|
"circular",
|
|
44
48
|
"ui",
|
|
45
|
-
"zumerlab"
|
|
49
|
+
"zumerlab",
|
|
50
|
+
"timer",
|
|
51
|
+
"countdown",
|
|
52
|
+
"status",
|
|
53
|
+
"health"
|
|
46
54
|
],
|
|
47
|
-
"homepage": "https://zumerlab.com/orbit
|
|
55
|
+
"homepage": "https://zumerlab.com/orbit/kit/",
|
|
48
56
|
"repository": {
|
|
49
57
|
"type": "git",
|
|
50
58
|
"url": "git+https://github.com/zumerlab/orbit-kit.git"
|
|
@@ -53,5 +61,9 @@
|
|
|
53
61
|
"url": "https://github.com/zumerlab/orbit-kit/issues"
|
|
54
62
|
},
|
|
55
63
|
"author": "Juan Martin Muda - Zumerlab",
|
|
56
|
-
"license": "MIT"
|
|
64
|
+
"license": "MIT",
|
|
65
|
+
"funding": {
|
|
66
|
+
"type": "github",
|
|
67
|
+
"url": "https://github.com/sponsors/tinchox5"
|
|
68
|
+
}
|
|
57
69
|
}
|