@zumer/orbit-kit 0.1.0 → 2.0.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 +108 -316
- package/package.json +20 -8
- package/src/base.js +564 -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,187 @@
|
|
|
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.
|
|
69
43
|
|
|
70
44
|
## Components
|
|
71
45
|
|
|
72
46
|
| 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.
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| [`<o-gauge>`](https://zumerlab.com/orbit/kit/gauge.html) | One value on an arc, with a readout. |
|
|
49
|
+
| [`<o-donut>`](https://zumerlab.com/orbit/kit/donut.html) | A donut chart from a JSON array. |
|
|
50
|
+
| [`<o-rings>`](https://zumerlab.com/orbit/kit/rings.html) | Concentric activity rings. |
|
|
51
|
+
| [`<o-knob>`](https://zumerlab.com/orbit/kit/knob.html) | A rotary control: pointer, wheel and keys. |
|
|
52
|
+
| [`<o-menu>`](https://zumerlab.com/orbit/kit/menu.html) | A radial menu, flat or nested. |
|
|
53
|
+
| [`<o-instrument>`](https://zumerlab.com/orbit/kit/instrument.html) | Needle gauges with ticks, zones and presets. |
|
|
54
|
+
| [`<o-clock>`](https://zumerlab.com/orbit/kit/clock.html) | Clocks and watch faces, live or fixed. |
|
|
55
|
+
| [`<o-compass>`](https://zumerlab.com/orbit/kit/compass.html) | A heading indicator. |
|
|
56
|
+
| [`<o-radar>`](https://zumerlab.com/orbit/kit/radar.html) | A scope with a sweep and blips. |
|
|
57
|
+
| [`<o-timer>`](https://zumerlab.com/orbit/kit/timer.html) | A countdown ring with start, pause and reset. |
|
|
58
|
+
| [`<o-status>`](https://zumerlab.com/orbit/kit/status.html) | Health of many things as colored segments, in layers. |
|
|
59
|
+
| [`<o-range>`](https://zumerlab.com/orbit/kit/range.html) | A circular range slider: two handles, numbers or times of day. |
|
|
60
|
+
| [`<o-time-picker>`](https://zumerlab.com/orbit/kit/time-picker.html) | A clock-face time picker: hours, then minutes. |
|
|
61
|
+
| [`<o-spinner>`](https://zumerlab.com/orbit/kit/spinner.html) | A loading indicator in five variants, with determinate progress. |
|
|
62
|
+
| [`<o-radar-chart>`](https://zumerlab.com/orbit/kit/radar-chart.html) | A radar (spider) chart: one polygon per series on a shared web. |
|
|
63
|
+
| [`<o-sunburst>`](https://zumerlab.com/orbit/kit/sunburst.html) | A tree as nested rings: hover a branch, click to zoom in. |
|
|
64
|
+
| [`<o-wheel>`](https://zumerlab.com/orbit/kit/wheel.html) | A prize wheel: spins, slows down and lands on a result picked by weight. |
|
|
65
|
+
| [`<o-color-wheel>`](https://zumerlab.com/orbit/kit/color-wheel.html) | A color picker: hue ring, saturation and brightness square, swatches. A form control. |
|
|
66
|
+
|
|
67
|
+
`<o-meter>`, a basic needle gauge from 0.x, still ships. `<o-instrument>` does all it does and more.
|
|
68
|
+
|
|
69
|
+
A few of them:
|
|
99
70
|
|
|
100
71
|
```html
|
|
101
|
-
<o-
|
|
102
|
-
<o-gauge value="125" max="240" label="125 km/h" range="360" glow></o-gauge>
|
|
103
|
-
```
|
|
72
|
+
<o-donut label="$2.4k" data='[{"value":52,"label":"Rent"},{"value":28,"label":"Food"},{"value":20,"label":"Other"}]'></o-donut>
|
|
104
73
|
|
|
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. |
|
|
74
|
+
<o-knob value="65" unit="%" aria-label="Volume"></o-knob>
|
|
119
75
|
|
|
120
|
-
|
|
76
|
+
<o-instrument preset="tachometer" value="6.2"></o-instrument>
|
|
121
77
|
|
|
122
|
-
|
|
78
|
+
<o-clock preset="chrono" live></o-clock>
|
|
123
79
|
|
|
124
|
-
|
|
125
|
-
or to an explicit `total` for a partial ring.
|
|
80
|
+
<o-timer duration="1:30" label="Tea"></o-timer>
|
|
126
81
|
|
|
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>
|
|
82
|
+
<o-status label="Services" data='[{"label":"API","status":"ok"},{"label":"DB","status":"warn"},{"label":"Queue","status":"down"}]'></o-status>
|
|
132
83
|
```
|
|
133
84
|
|
|
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. |
|
|
85
|
+
Every attribute, event and custom property is on the component's page in the documentation.
|
|
145
86
|
|
|
146
|
-
|
|
87
|
+
## What they share
|
|
147
88
|
|
|
148
|
-
|
|
89
|
+
- `size` sets the width with any CSS length. `100%` follows the container as it resizes.
|
|
90
|
+
- `thickness` sets band thickness in lanes, Orbit's unit: a twelfth of the radius.
|
|
91
|
+
- `fill` and `track` color the band components; `accent` is the highlight of the dial components.
|
|
92
|
+
- `label` and `unit` set the text in the middle; `range` and `from` the arc span and start angle.
|
|
93
|
+
- `min`, `max`, `step`, `format` and `theme`: see [Shared options](#shared-options).
|
|
94
|
+
- `glow` adds a glow in the indicator color (`glow="12"` for the blur in px).
|
|
95
|
+
- Lists (`data`, `items`, `targets`, `zones`) are JSON in the attribute.
|
|
96
|
+
- Change an attribute and the component updates. Values only move what moves.
|
|
149
97
|
|
|
150
|
-
|
|
151
|
-
solid track in its own color.
|
|
98
|
+
Colors are custom properties that inherit, so one rule themes a whole panel:
|
|
152
99
|
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
100
|
+
```css
|
|
101
|
+
.dashboard {
|
|
102
|
+
--ok-fill: #2dd4bf;
|
|
103
|
+
--ok-track: #12302c;
|
|
104
|
+
--ok-accent: #f97316;
|
|
105
|
+
--ok-text: #e2e8f0;
|
|
106
|
+
}
|
|
157
107
|
```
|
|
158
108
|
|
|
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. |
|
|
109
|
+
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
110
|
|
|
170
|
-
|
|
111
|
+
## Shared options
|
|
171
112
|
|
|
172
|
-
|
|
113
|
+
Four things work the same in every component that has them.
|
|
173
114
|
|
|
174
|
-
|
|
115
|
+
**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
116
|
|
|
176
117
|
```html
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
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
|
|
118
|
+
<section class="ok-theme-light">
|
|
119
|
+
<o-gauge value="64" unit="%"></o-gauge>
|
|
120
|
+
<o-knob value="40"></o-knob>
|
|
121
|
+
</section>
|
|
184
122
|
```
|
|
185
123
|
|
|
186
|
-
|
|
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.
|
|
124
|
+
**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
125
|
|
|
210
126
|
```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>
|
|
127
|
+
<o-gauge value="1234.5" max="5000" format="currency" currency="EUR" locale="de-DE"></o-gauge>
|
|
128
|
+
<o-instrument max="240" value="88" format="unit" unit="kilometer-per-hour"></o-instrument>
|
|
220
129
|
```
|
|
221
130
|
|
|
222
131
|
```js
|
|
223
|
-
|
|
224
|
-
menu.addEventListener('navigate', e => e.detail); // { path, depth }
|
|
225
|
-
menu.back(); menu.reset(); menu.path; // navigation API
|
|
132
|
+
gauge.formatter = (value, { kind }) => kind === 'tick' ? `${value}` : `${value} pts`
|
|
226
133
|
```
|
|
227
134
|
|
|
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. |
|
|
238
|
-
|
|
239
|
-
Keyboard: arrows move focus, Enter activates, Esc / Backspace goes back.
|
|
135
|
+
**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.
|
|
240
136
|
|
|
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.
|
|
137
|
+
**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.
|
|
248
138
|
|
|
249
139
|
```html
|
|
250
|
-
<
|
|
251
|
-
<o-
|
|
252
|
-
<o-
|
|
253
|
-
|
|
140
|
+
<form>
|
|
141
|
+
<o-knob name="volume" value="30"></o-knob>
|
|
142
|
+
<o-menu name="action" required items='[{"label":"Cut","value":"cut"},{"label":"Copy","value":"copy"}]'></o-menu>
|
|
143
|
+
</form>
|
|
254
144
|
```
|
|
255
145
|
|
|
256
|
-
|
|
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.
|
|
287
|
-
|
|
288
|
-
```html
|
|
289
|
-
<o-clock live seconds></o-clock> <!-- ticking wall clock -->
|
|
290
|
-
<o-clock time="10:08:42" numerals="roman" case="square"></o-clock>
|
|
291
|
-
<o-clock preset="smartwatch" live brand="ORBIT"></o-clock>
|
|
292
|
-
<o-clock preset="chrono" live></o-clock> <!-- tri-compax sub-dials -->
|
|
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 -->
|
|
295
|
-
```
|
|
146
|
+
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`.
|
|
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. |
|
|
313
|
-
|
|
314
|
-
---
|
|
315
|
-
|
|
316
|
-
### `<o-compass>`
|
|
148
|
+
## How it works
|
|
317
149
|
|
|
318
|
-
|
|
319
|
-
cardinals) rotates so the current `heading` sits under the index.
|
|
150
|
+
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.
|
|
320
151
|
|
|
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
|
-
```
|
|
152
|
+
## Coming from 0.x
|
|
325
153
|
|
|
326
|
-
|
|
327
|
-
|---|---|---|
|
|
328
|
-
| `heading` | `0` | Heading in degrees (clockwise from North). |
|
|
329
|
-
| `labels` | `N,E,S,W` | Cardinal labels (comma-separated). |
|
|
330
|
-
| `fill` | `#ef4444` | Accent (north tick + lubber). |
|
|
331
|
-
| `unit` | `°` | Readout suffix. |
|
|
332
|
-
| `size` | `220px` | Widget width. |
|
|
154
|
+
Tag names and attributes still work. What changed is underneath:
|
|
333
155
|
|
|
334
|
-
|
|
156
|
+
- The kit runs on Orbit 2.
|
|
157
|
+
- 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`.
|
|
158
|
+
- `thickness` sets band thickness. `orbit` and `stroke-width` still work as before.
|
|
159
|
+
- `gap` is a share of the widget width, the same in the donut, the menu and the status ring.
|
|
160
|
+
- Colors are custom properties you can set from CSS.
|
|
161
|
+
- New: `<o-timer>`, `<o-status>`, `min` on the gauge, `accent` on the compass and the radar.
|
|
335
162
|
|
|
336
|
-
|
|
163
|
+
The [CHANGELOG](CHANGELOG.md) has the full list.
|
|
337
164
|
|
|
338
|
-
|
|
339
|
-
conic-gradient sweep, and glowing blips.
|
|
165
|
+
## Development
|
|
340
166
|
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
{"angle":310,"dist":0.65,"color":"#ef4565"}]'></o-radar>
|
|
167
|
+
```sh
|
|
168
|
+
npm install
|
|
169
|
+
npx playwright install chromium
|
|
170
|
+
npm test
|
|
346
171
|
```
|
|
347
172
|
|
|
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.
|
|
173
|
+
`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
174
|
|
|
372
|
-
|
|
373
|
-
attributes above just map onto them.
|
|
175
|
+
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
176
|
|
|
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)).
|
|
177
|
+
## Browser support
|
|
379
178
|
|
|
380
|
-
|
|
179
|
+
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
180
|
|
|
382
|
-
|
|
383
|
-
npx serve .
|
|
384
|
-
# then open /docs/index.html
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
## Browser support
|
|
181
|
+
## Sponsor
|
|
388
182
|
|
|
389
|
-
|
|
390
|
-
functions (`cos`, `sin`); the radar/clock visuals use `conic-gradient` and
|
|
391
|
-
`color-mix`. Orbit shows an upgrade notice on unsupported browsers.
|
|
183
|
+
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
184
|
|
|
393
185
|
## License
|
|
394
186
|
|
|
395
|
-
[MIT](LICENSE)
|
|
187
|
+
[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": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.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
|
}
|