@zumer/orbit 1.4.11 → 1.5.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 +57 -7
- package/dist/orbit.css +448 -600
- package/dist/orbit.js +535 -157
- package/dist/orbit.min.css +1 -1
- package/dist/orbit.min.js +39 -4
- package/dist/orbit.mjs +941 -0
- package/package.json +13 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Orbit
|
|
1
|
+
# Orbit
|
|
2
2
|
|
|
3
|
-
**Orbit**
|
|
3
|
+
**Orbit** builds radial UIs — gauges, donuts, knobs, pie menus, dashboards — with **CSS geometry and a small JavaScript runtime**. CSS controls presentation; JavaScript keeps ring indices, spacing and SVG paths in sync as the interface changes. Use it with plain HTML or frameworks such as React, Vue and Svelte.
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://zumerlab.github.io/orbit-docs" target="_blank"><strong>🚀 Live showcase & docs</strong></a>
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
## Why Orbit?
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Orbit provides reusable radial layout primitives, CSS custom properties and Web Components for arcs and progress rings. Load the stylesheet and script, then compose an interface with HTML classes. The runtime updates added, removed and reordered elements, ancestor style changes and container resizes.
|
|
20
|
+
|
|
21
|
+
> **Want ready-made components?** [**orbit-kit**](https://zumerlab.com/orbit-kit) wraps the common Orbit patterns into one-line custom elements — gauges, charts, activity rings, knobs, pie menus, cockpit instruments, analog clocks, compasses and radars.
|
|
20
22
|
|
|
21
23
|
## Installation
|
|
22
24
|
|
|
@@ -38,6 +40,27 @@ import '@zumer/orbit/style'
|
|
|
38
40
|
import '@zumer/orbit'
|
|
39
41
|
```
|
|
40
42
|
|
|
43
|
+
The npm import resolves to an ES module. Importing it during server rendering is safe; registration and layout observation start when the module runs in a browser. Render the markup on the server and include the JavaScript in your client entrypoint to activate it.
|
|
44
|
+
|
|
45
|
+
The module also exports `Orbit`, `OrbitArc`, `OrbitProgress` and `registerOrbit`:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
import { Orbit } from '@zumer/orbit'
|
|
49
|
+
|
|
50
|
+
// Run after the container mounts. Dispose the observer when it unmounts.
|
|
51
|
+
const stopResizing = Orbit.resize('#instrument-panel')
|
|
52
|
+
// Later: stopResizing()
|
|
53
|
+
|
|
54
|
+
// After changing stylesheet rules through CSSOM, refresh the affected subtree.
|
|
55
|
+
Orbit.refresh(document.querySelector('#instrument-panel'))
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`Orbit.resize` accepts a selector or an element. `Orbit.refresh(root)` accepts a document, element or shadow root, defaults to the document and updates layout synchronously. DOM, attribute and resize changes within a layout or its ancestors are observed automatically and batched for the next animation frame; use `refresh` when immediate results are needed. Repeated calls to `registerOrbit()` are safe. The classic CDN script exposes the same `Orbit` API as `window.Orbit`.
|
|
59
|
+
|
|
60
|
+
Arcs and progress elements also register layouts inside open or closed shadow roots. Include the Orbit stylesheet inside each shadow root; host and ancestor style changes then refresh its SVGs. For a shadow tree containing only CSS elements, call `Orbit.refresh(shadowRoot)` to register it explicitly. Removing a shadow host releases its observers; reconnecting its components restores them.
|
|
61
|
+
|
|
62
|
+
Changes made through CSSOM, or selectors driven by external siblings and control states (such as `:checked`), may affect a chart without mutating the layout or an ancestor. Call `Orbit.refresh(chart)` after those changes. Orbit does not infer arbitrary CSS dependencies across unrelated elements.
|
|
63
|
+
|
|
41
64
|
---
|
|
42
65
|
|
|
43
66
|
## Quick start
|
|
@@ -64,7 +87,7 @@ Minimal gauge in 10 lines:
|
|
|
64
87
|
|---------|------|
|
|
65
88
|
| `.bigbang` | Root container, sets viewport |
|
|
66
89
|
| `.gravity-spot` | Center of the radial layout; holds rings |
|
|
67
|
-
| `.orbit
|
|
90
|
+
| `.orbit` / `.orbit-N` | Automatically numbered rings, or an explicit nonnegative integer ring level (1 = innermost) |
|
|
68
91
|
| `.satellite` | Item placed on a ring (dot, label, icon) |
|
|
69
92
|
| `<o-arc>` | Arc segment (donut slice, gauge needle, menu sector); `value` 0–100, `shape` e.g. `arrow`, `circle-a` |
|
|
70
93
|
| `<o-progress>` | Simple progress ring |
|
|
@@ -72,7 +95,8 @@ Minimal gauge in 10 lines:
|
|
|
72
95
|
| `.side` | Stretch content along arc |
|
|
73
96
|
| `.capsule` | Wrapper for content inside satellite; required when satellite holds more than plain text |
|
|
74
97
|
|
|
75
|
-
**Structure rules
|
|
98
|
+
**Structure rules:**
|
|
99
|
+
|
|
76
100
|
- `.bigbang` → direct children: `.gravity-spot` only
|
|
77
101
|
- `.gravity-spot` → direct children: `.orbit`, `.orbit-N`, or `.gravity-spot` only
|
|
78
102
|
- `.satellite` → direct children: `.capsule` or `.gravity-spot` (for nesting) only
|
|
@@ -81,6 +105,10 @@ Minimal gauge in 10 lines:
|
|
|
81
105
|
|
|
82
106
|
**Useful classes:** `range-180`, `range-270`, `range-360` (arc span); `from-180` (start angle); `fit-range` (distribute items); `shrink-50`, `gap-4` (spacing); `at-center` (place satellite in middle).
|
|
83
107
|
|
|
108
|
+
The runtime supports ring levels and child counts beyond the static CSS fallback's 24 levels and 60 children per type. Without JavaScript, that fallback can position simple CSS elements in browsers supporting `:has()` and `:nth-child(... of ...)`; `<o-arc>` and `<o-progress>` require JavaScript. Ring classes are matched as complete tokens, so application classes such as `orbit-card` do not become rings.
|
|
109
|
+
|
|
110
|
+
Use public custom properties such as `--o-range`, `--o-from`, `--o-orbit-number` and `--o-orbit-child-number` for overrides. The runtime owns `data-orbit-ring`, `--o-layout-*` and `--o-arc-start`; leave these internal values to Orbit.
|
|
111
|
+
|
|
84
112
|
---
|
|
85
113
|
|
|
86
114
|
## Themes
|
|
@@ -110,7 +138,7 @@ You can combine themes, e.g. `class="bigbang theme-cyan dev-orbit"`.
|
|
|
110
138
|
|
|
111
139
|
## Visual aids & development
|
|
112
140
|
|
|
113
|
-
Orbit provides **CSS visual warnings** to catch invalid structure.
|
|
141
|
+
Orbit provides **opt-in CSS visual warnings** to catch invalid structure. Inside a `dev-orbit` container, invalid children show a dotted border, dimmed content and a ⚠️ icon. These diagnostics require `:has()` and respect reduced-motion preferences.
|
|
114
142
|
|
|
115
143
|
Add **`class="dev-orbit"`** to your root container to enable **developer mode**: dashed red borders on `gravity-spot`, `orbit`, and `satellite` to visualize the layout structure. Useful for debugging.
|
|
116
144
|
|
|
@@ -122,12 +150,33 @@ Add **`class="dev-orbit"`** to your root container to enable **developer mode**:
|
|
|
122
150
|
</div>
|
|
123
151
|
```
|
|
124
152
|
|
|
125
|
-
|
|
153
|
+
CSS trigonometric functions (`cos`, `sin`) are required for geometry; unsupported browsers show an upgrade message. Missing `:has()` support does not block the JavaScript layout runtime. See [CSS visual aids](https://zumerlab.github.io/orbit-docs/tools/support) in the full docs.
|
|
154
|
+
|
|
155
|
+
## Building and testing
|
|
156
|
+
|
|
157
|
+
```sh
|
|
158
|
+
npm ci
|
|
159
|
+
npx playwright install chromium
|
|
160
|
+
npm test
|
|
161
|
+
npm run build
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`npm test` compiles the package, tests its published file list and server imports, then runs browser and shadow-root regressions in Chromium. Set `BROWSERS=chromium,firefox,webkit` to run all three engines after installing them with Playwright; CI runs this matrix. Use `npm run test:package`, `npm run test:browser` or `npm run test:shadow` for an individual suite. The shadow suite builds in memory so it can also check source changes independently of `dist`.
|
|
165
|
+
|
|
166
|
+
`npm run build` compiles CSS, classic browser scripts and the ES module, then creates an npm tarball. It does not commit, tag, push or publish; release operations are separate.
|
|
126
167
|
|
|
127
168
|
---
|
|
128
169
|
|
|
129
170
|
## Examples
|
|
130
171
|
|
|
172
|
+
Run the core playground against your local checkout:
|
|
173
|
+
|
|
174
|
+
```sh
|
|
175
|
+
npm run demo
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Open **http://127.0.0.1:5174**. The command compiles the current source and serves the interactive playground and existing examples using that local build. Use `PORT=5175 npm run demo` to choose another port; stop the server with Ctrl+C.
|
|
179
|
+
|
|
131
180
|
Browse examples on the [Orbit docs site](https://zumerlab.github.io/orbit-docs):
|
|
132
181
|
|
|
133
182
|
| Example | Link |
|
|
@@ -172,6 +221,7 @@ asking the model to build a radial UI.
|
|
|
172
221
|
|
|
173
222
|
## Resources
|
|
174
223
|
|
|
224
|
+
- [orbit-kit](https://zumerlab.com/orbit-kit) — ready-made radial components built on Orbit
|
|
175
225
|
- [Full documentation](https://zumerlab.github.io/orbit-docs) — elements, tools, advanced examples
|
|
176
226
|
- [Contributing](CONTRIBUTING.md)
|
|
177
227
|
- [GitHub Discussions](https://github.com/zumerlab/orbit/discussions)
|