@loworbitstudio/visor 1.13.0 → 1.15.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 +46 -0
- package/dist/CHANGELOG.json +1 -1
- package/dist/index.js +1137 -381
- package/dist/init-plays.json +22 -0
- package/dist/registry.json +2 -2
- package/dist/visor-manifest.json +1 -1
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -175,6 +175,52 @@ Rules in `disabledRules` are skipped entirely — useful when a project intentio
|
|
|
175
175
|
run: npx visor check design ./src --json
|
|
176
176
|
```
|
|
177
177
|
|
|
178
|
+
## visor check theme-mode
|
|
179
|
+
|
|
180
|
+
Deterministic theme-mode gate. Reads a theme's declared `color-scheme` (`dark-only | light-only | adaptive`) and asserts that the app-root background (`--surface-page`) luminance matches the declared mode — catching the failure class where a `dark-only` brand ships a light app root (or vice versa), which structural oracle/freeze gates cannot see.
|
|
181
|
+
|
|
182
|
+
- `dark-only` → the dark-scope app-root background must be **dark** (luminance `< 0.2`)
|
|
183
|
+
- `light-only` → the light-scope app-root background must be **light** (luminance `>= 0.2`)
|
|
184
|
+
- `adaptive` (or no `color-scheme`) → **skipped** — no single mode to assert
|
|
185
|
+
|
|
186
|
+
The gate is fully deterministic and dependency-light: it reuses the theme engine's own resolution to compute the host page background the emitted CSS would carry, then reuses `getLuminance()`. No browser required.
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# Human-readable terminal output
|
|
190
|
+
npx visor check theme-mode ./my-theme.visor.yaml
|
|
191
|
+
|
|
192
|
+
# JSON output for pipeline wiring
|
|
193
|
+
npx visor check theme-mode ./my-theme.visor.yaml --json
|
|
194
|
+
|
|
195
|
+
# Advisory mode — report without failing CI
|
|
196
|
+
npx visor check theme-mode ./my-theme.visor.yaml --no-fail
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Output schema (--json)
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"success": true,
|
|
204
|
+
"pass": false,
|
|
205
|
+
"skipped": false,
|
|
206
|
+
"mode": "dark-only",
|
|
207
|
+
"theme": "my-theme",
|
|
208
|
+
"computed_bg": "#ffffff",
|
|
209
|
+
"luminance": 1,
|
|
210
|
+
"threshold": 0.2,
|
|
211
|
+
"reason": "theme declares dark-only but app-root background \"#ffffff\" renders light (luminance 1.0000, threshold 0.2) — expected dark"
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
On failure, `computed_bg` is the offending computed background color.
|
|
216
|
+
|
|
217
|
+
### Exit codes
|
|
218
|
+
|
|
219
|
+
| Code | Meaning |
|
|
220
|
+
|------|---------|
|
|
221
|
+
| `0` | Mode matches, or `adaptive`/no-scheme (skipped), or `--no-fail` mode |
|
|
222
|
+
| `1` | Rendered mode does not match the declared `color-scheme` |
|
|
223
|
+
|
|
178
224
|
## Documentation
|
|
179
225
|
|
|
180
226
|
Full docs at [visor.loworbit.studio](https://visor.loworbit.studio).
|