@zumer/orbit 1.4.12 → 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 CHANGED
@@ -1,6 +1,6 @@
1
- # Orbit CSS Composer
1
+ # Orbit
2
2
 
3
- **Orbit** is a CSS framework for building radial UIs — gauges, donuts, knobs, pie menus, dashboards — with **CSS only**. No layout JavaScript. Works with plain HTML and any framework (React, Vue, Svelte).
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 &amp; docs</strong></a>
@@ -16,7 +16,7 @@
16
16
 
17
17
  ## Why Orbit?
18
18
 
19
- Radial UIs usually need JavaScript to compute angles, radii, and positions. **Orbit** handles all of that with CSS classes and a couple of Web Components. Drop in two files and start building.
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
20
 
21
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.
22
22
 
@@ -40,6 +40,27 @@ import '@zumer/orbit/style'
40
40
  import '@zumer/orbit'
41
41
  ```
42
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
+
43
64
  ---
44
65
 
45
66
  ## Quick start
@@ -66,7 +87,7 @@ Minimal gauge in 10 lines:
66
87
  |---------|------|
67
88
  | `.bigbang` | Root container, sets viewport |
68
89
  | `.gravity-spot` | Center of the radial layout; holds rings |
69
- | `.orbit-1` … `.orbit-7` | Rings at different radii (1 = innermost) |
90
+ | `.orbit` / `.orbit-N` | Automatically numbered rings, or an explicit nonnegative integer ring level (1 = innermost) |
70
91
  | `.satellite` | Item placed on a ring (dot, label, icon) |
71
92
  | `<o-arc>` | Arc segment (donut slice, gauge needle, menu sector); `value` 0–100, `shape` e.g. `arrow`, `circle-a` |
72
93
  | `<o-progress>` | Simple progress ring |
@@ -74,7 +95,8 @@ Minimal gauge in 10 lines:
74
95
  | `.side` | Stretch content along arc |
75
96
  | `.capsule` | Wrapper for content inside satellite; required when satellite holds more than plain text |
76
97
 
77
- **Structure rules (avoid visual warnings):**
98
+ **Structure rules:**
99
+
78
100
  - `.bigbang` → direct children: `.gravity-spot` only
79
101
  - `.gravity-spot` → direct children: `.orbit`, `.orbit-N`, or `.gravity-spot` only
80
102
  - `.satellite` → direct children: `.capsule` or `.gravity-spot` (for nesting) only
@@ -83,6 +105,10 @@ Minimal gauge in 10 lines:
83
105
 
84
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).
85
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
+
86
112
  ---
87
113
 
88
114
  ## Themes
@@ -112,7 +138,7 @@ You can combine themes, e.g. `class="bigbang theme-cyan dev-orbit"`.
112
138
 
113
139
  ## Visual aids & development
114
140
 
115
- Orbit provides **CSS visual warnings** to catch invalid structure. When rules are broken (e.g. wrong children in `gravity-spot` or `satellite`), Orbit shows a red dotted border, grays out content, and displays a ⚠️ icon.
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.
116
142
 
117
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.
118
144
 
@@ -124,12 +150,33 @@ Add **`class="dev-orbit"`** to your root container to enable **developer mode**:
124
150
  </div>
125
151
  ```
126
152
 
127
- Orbit also checks browser support for `:has()` and trigonometric CSS functions (`cos`, `sin`); unsupported browsers show an upgrade message. See [CSS visual aids](https://zumerlab.github.io/orbit-docs/tools/support) in the full docs.
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.
128
167
 
129
168
  ---
130
169
 
131
170
  ## Examples
132
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
+
133
180
  Browse examples on the [Orbit docs site](https://zumerlab.github.io/orbit-docs):
134
181
 
135
182
  | Example | Link |