auva 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +124 -17
- data/index.html +133 -0
- data/lib/auva/version.rb +1 -1
- data/lib/auva.rb +14 -3
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: caeb5bc6900e617822665366a145c8e931b752612eb2617a5b4521ca7fc91768
|
|
4
|
+
data.tar.gz: 8cb0e0402e3582f7c9eed983b58eaa04b77c3b79c3744909af97dc82d52cc416
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dbdd43f740b4ff501864eb89014fc0acfc5a1347918aaf26839d781da470ff0d96b6ea8c67d5b1e2df6f49b53f9effc55a35dec4b521dc0d187cbb1650755b83
|
|
7
|
+
data.tar.gz: c71cddfd5bf23af0f365195cc0ac7b73ea6d6bfed75fcfe65a37a0c01a8db19ab1655100b2a5bda30418e15d1dd4bd62f322c439cf6d95a0de429d603bf3dae4
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -1,38 +1,145 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">Auva</h1>
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>JSONC design-token loader and deterministic theme sheets for Zaniah.</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://rubygems.org/gems/auva"><img src="https://img.shields.io/gem/v/auva?style=flat-square" alt="Gem version"></a>
|
|
9
|
+
<a href="https://rubygems.org/gems/auva"><img src="https://img.shields.io/gem/dt/auva?style=flat-square" alt="Gem downloads"></a>
|
|
10
|
+
<a href="https://github.com/noxdea/auva/actions/workflows/main.yml"><img src="https://github.com/noxdea/auva/actions/workflows/main.yml/badge.svg" alt="CI"></a>
|
|
11
|
+
<img src="https://img.shields.io/badge/Ruby-%3E%3D%203.2-CC342D?style=flat-square" alt="Ruby 3.2 or newer">
|
|
12
|
+
<a href="LICENSE.txt"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="MIT license"></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="#features">Features</a> ·
|
|
17
|
+
<a href="#installation">Installation</a> ·
|
|
18
|
+
<a href="#quick-start">Quick start</a> ·
|
|
19
|
+
<a href="#token-format">Token format</a> ·
|
|
20
|
+
<a href="#cli">CLI</a> ·
|
|
21
|
+
<a href="#ruby-api">Ruby API</a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
Auva is a JSONC design-token loader and deterministic theme-sheet generator
|
|
27
|
+
for [Zaniah](https://github.com/noxdea/zaniah). It validates tokens against
|
|
28
|
+
Zaniah's own theme members, reports source locations, and checks WCAG contrast.
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- **JSONC tokens** — comments and trailing commas are accepted.
|
|
33
|
+
- **Built-in inheritance** — extend `dark`, `light`, or `high_contrast`.
|
|
34
|
+
- **Strict validation** — unknown categories, tokens, and values fail with a source line and path.
|
|
35
|
+
- **WCAG checks** — report AA and AAA contrast for essential color pairs.
|
|
36
|
+
- **Native preview** — inspect colors, typography, spacing, radii, shadows, motion, buttons, and components.
|
|
37
|
+
- **Live reload** — update the preview as a token file changes.
|
|
38
|
+
- **Deterministic sheets** — export all eight preview categories as PNG files.
|
|
6
39
|
|
|
7
40
|
## Installation
|
|
8
41
|
|
|
9
|
-
```
|
|
42
|
+
```bash
|
|
10
43
|
gem install auva
|
|
11
44
|
```
|
|
12
45
|
|
|
13
|
-
|
|
46
|
+
Auva requires Ruby 3.2 or newer.
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
Create `tokens.jsonc`:
|
|
51
|
+
|
|
52
|
+
```jsonc
|
|
53
|
+
{
|
|
54
|
+
// Start from a complete Zaniah theme.
|
|
55
|
+
"extends": "light",
|
|
56
|
+
"colors": {
|
|
57
|
+
"accent": "#245b9b"
|
|
58
|
+
},
|
|
59
|
+
"syntax": {
|
|
60
|
+
"keyword": "#7c3aed",
|
|
61
|
+
"string": "#15803d"
|
|
62
|
+
},
|
|
63
|
+
"motion": {
|
|
64
|
+
"reduced": true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Open the native preview:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
auva tokens.jsonc
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Check contrast and fail when any required pair misses WCAG AA:
|
|
14
76
|
|
|
15
|
-
```
|
|
77
|
+
```bash
|
|
16
78
|
auva tokens.jsonc --check --strict
|
|
17
|
-
auva --builtin dark --export public/theme
|
|
18
79
|
```
|
|
19
80
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
81
|
+
## Token format
|
|
82
|
+
|
|
83
|
+
| Category | Description |
|
|
84
|
+
|---|---|
|
|
85
|
+
| `extends` | Base theme: `dark`, `light`, `high_contrast`, or `none` |
|
|
86
|
+
| `colors` | Zaniah color members such as `accent` and `background` |
|
|
87
|
+
| `syntax` | Code-editor colors: `keyword`, `string`, `comment`, `number`, `function`, `type`, `constant`, `punctuation`, `operator`, `variable`, `text` |
|
|
88
|
+
| `typography` | Font families, sizes, and related type tokens |
|
|
89
|
+
| `spacing` | Numeric spacing scale entries |
|
|
90
|
+
| `radii` | Named border radii |
|
|
91
|
+
| `shadows` | Named shadows with validated members |
|
|
92
|
+
| `motion` | Durations, easing values, and reduced-motion preference |
|
|
93
|
+
|
|
94
|
+
Unspecified values remain inherited from the selected base theme.
|
|
95
|
+
`syntax` requires a Zaniah theme with `Theme::Syntax` support; token files
|
|
96
|
+
without it remain compatible with older Zaniah versions.
|
|
97
|
+
|
|
98
|
+
## CLI
|
|
99
|
+
|
|
100
|
+
Export every preview sheet:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
auva tokens.jsonc --export public/theme
|
|
104
|
+
```
|
|
24
105
|
|
|
25
|
-
|
|
26
|
-
`radii`, `shadows`,
|
|
106
|
+
The directory contains `colors.png`, `typography.png`, `spacing.png`,
|
|
107
|
+
`radii.png`, `shadows.png`, `motion.png`, `buttons.png`, and `components.png`.
|
|
108
|
+
|
|
109
|
+
| Option | Description |
|
|
110
|
+
|---|---|
|
|
111
|
+
| `--builtin NAME` | Use `dark`, `light`, or `high_contrast` without a token file |
|
|
112
|
+
| `--themes NAMES` | Preview or export comma-separated built-in themes |
|
|
113
|
+
| `--check` | Print contrast ratios |
|
|
114
|
+
| `--strict` | Exit with failure when WCAG AA is not met |
|
|
115
|
+
| `--export DIR` | Write deterministic PNG sheets |
|
|
116
|
+
| `--watch` | Watch a token file outside the native preview |
|
|
117
|
+
| `--no-watch` | Disable watching |
|
|
118
|
+
|
|
119
|
+
## Ruby API
|
|
120
|
+
|
|
121
|
+
```ruby
|
|
122
|
+
require "auva"
|
|
123
|
+
|
|
124
|
+
theme = Auva.load("tokens.jsonc")
|
|
125
|
+
results = Auva.contrast(theme)
|
|
126
|
+
Auva::Preview.render_all(theme, "public/theme")
|
|
127
|
+
```
|
|
27
128
|
|
|
28
129
|
## Development
|
|
29
130
|
|
|
30
|
-
|
|
131
|
+
```bash
|
|
132
|
+
bundle install
|
|
133
|
+
bundle exec rake
|
|
134
|
+
bundle exec rbs -I sig validate
|
|
135
|
+
gem build --strict auva.gemspec
|
|
136
|
+
```
|
|
31
137
|
|
|
32
138
|
## Contributing
|
|
33
139
|
|
|
34
|
-
Bug reports and pull requests are welcome
|
|
140
|
+
Bug reports and pull requests are welcome on
|
|
141
|
+
[GitHub](https://github.com/noxdea/auva).
|
|
35
142
|
|
|
36
143
|
## License
|
|
37
144
|
|
|
38
|
-
MIT.
|
|
145
|
+
Auva is available under the [MIT License](LICENSE.txt).
|
data/index.html
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<meta name="theme-color" content="#080c0b">
|
|
7
|
+
<meta name="description" content="Auva is a JSONC design-token loader and deterministic theme-sheet generator for Zaniah.">
|
|
8
|
+
<link rel="canonical" href="https://noxdea.github.io/auva/">
|
|
9
|
+
<title>Auva — Design tokens for Zaniah</title>
|
|
10
|
+
<style>
|
|
11
|
+
:root { color-scheme: dark; --bg:#080c0b; --panel:#101715; --line:#293a34; --text:#edf2ef; --muted:#9faea8; --accent:#83b79f; --ink:#08120d; }
|
|
12
|
+
* { box-sizing: border-box; }
|
|
13
|
+
html { background: var(--bg); }
|
|
14
|
+
body { margin: 0; min-width: 320px; color: var(--text); background: var(--bg); font: 16px/1.62 "Helvetica Neue", Helvetica, Arial, sans-serif; }
|
|
15
|
+
a { color: inherit; }
|
|
16
|
+
.skip { position: absolute; top: -5rem; left: 1rem; z-index: 20; padding: .65rem .9rem; color: var(--ink); background: var(--accent); }
|
|
17
|
+
.skip:focus { top: 1rem; }
|
|
18
|
+
.wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
|
|
19
|
+
header { display: flex; align-items: center; justify-content: space-between; min-height: 76px; border-bottom: 1px solid var(--line); }
|
|
20
|
+
.brand { font: 700 1.15rem/1 "Helvetica Neue", Helvetica, sans-serif; text-decoration: none; }
|
|
21
|
+
nav { display: flex; gap: 1.4rem; color: var(--muted); font-size: .9rem; }
|
|
22
|
+
nav a { text-decoration: none; }
|
|
23
|
+
nav a:hover { color: var(--text); }
|
|
24
|
+
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
|
|
25
|
+
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(520px, 1fr); gap: clamp(3rem, 7vw, 7rem); align-items: center; min-height: 700px; padding: 90px 0; }
|
|
26
|
+
.context { margin: 0 0 1.2rem; color: var(--accent); font-size: .95rem; }
|
|
27
|
+
h1, h2 { margin: 0; font-family: "Helvetica Neue", Helvetica, sans-serif; font-weight: 700; text-wrap: balance; }
|
|
28
|
+
h1 { max-width: 11ch; font-size: clamp(3.4rem, 5.7vw, 5.7rem); line-height: .94; }
|
|
29
|
+
h2 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.05; }
|
|
30
|
+
p { text-wrap: pretty; }
|
|
31
|
+
.lede { max-width: 54ch; margin: 1.6rem 0 0; color: var(--muted); font-size: 1.08rem; }
|
|
32
|
+
.actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
|
|
33
|
+
.button { display: inline-flex; align-items: center; min-height: 44px; padding: .65rem 1rem; border: 1px solid var(--line); text-decoration: none; }
|
|
34
|
+
.button.primary { border-color: var(--accent); color: var(--ink); background: var(--accent); font-weight: 700; }
|
|
35
|
+
.token-lab { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); background: var(--panel); }
|
|
36
|
+
.source { padding: 1.2rem; border-right: 1px solid var(--line); color: var(--muted); font: .72rem/1.75 ui-monospace, "SFMono-Regular", Consolas, monospace; }
|
|
37
|
+
.source .key { color: var(--text); }
|
|
38
|
+
.source .value { color: var(--accent); }
|
|
39
|
+
.source .comment { color: #718079; }
|
|
40
|
+
.inspect { padding: 1.2rem; }
|
|
41
|
+
.inspect h3 { margin: 0 0 1rem; font-size: .85rem; font-weight: 600; }
|
|
42
|
+
.swatch { display: grid; grid-template-columns: 42px 1fr auto; gap: .75rem; align-items: center; padding: .7rem 0; border-top: 1px solid var(--line); font-size: .75rem; font-variant-numeric: tabular-nums; }
|
|
43
|
+
.chip { width: 42px; height: 28px; border: 1px solid #53645d; background: var(--accent); }
|
|
44
|
+
.chip.surface { background: #19211e; } .chip.text { background: #edf2ef; } .chip.muted { background: #9faea8; }
|
|
45
|
+
.swatch span:last-child { color: var(--muted); }
|
|
46
|
+
.contrast { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); }
|
|
47
|
+
.contrast-row { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; color: var(--muted); font-size: .72rem; font-variant-numeric: tabular-nums; }
|
|
48
|
+
.contrast-row b { color: var(--accent); }
|
|
49
|
+
.section { display: grid; grid-template-columns: .72fr 1.28fr; gap: clamp(2rem, 7vw, 7rem); padding: 88px 0; border-top: 1px solid var(--line); }
|
|
50
|
+
.section-copy { max-width: 38ch; color: var(--muted); }
|
|
51
|
+
.rows { border-top: 1px solid var(--line); }
|
|
52
|
+
.row { display: grid; grid-template-columns: 150px 1fr; gap: 1.5rem; padding: 1.35rem 0; border-bottom: 1px solid var(--line); }
|
|
53
|
+
.row strong { color: var(--accent); font-weight: 600; }
|
|
54
|
+
.row p { margin: 0; color: var(--muted); }
|
|
55
|
+
.categories { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); }
|
|
56
|
+
.category { display: grid; grid-template-columns: 24px 1fr; gap: .8rem; padding: 1rem 0; border-bottom: 1px solid var(--line); color: var(--muted); }
|
|
57
|
+
.category:nth-child(odd) { padding-right: 1rem; }
|
|
58
|
+
.category:nth-child(even) { padding-left: 1rem; border-left: 1px solid var(--line); }
|
|
59
|
+
.category i { width: 24px; height: 24px; border: 1px solid var(--accent); }
|
|
60
|
+
.category b { display: block; color: var(--text); font-weight: 600; }
|
|
61
|
+
pre.command { margin: 0; overflow-x: auto; padding: 1.2rem; border: 1px solid var(--line); color: var(--accent); background: var(--panel); font: .9rem/1.7 ui-monospace, "SFMono-Regular", Consolas, monospace; }
|
|
62
|
+
footer { display: flex; justify-content: space-between; gap: 1rem; padding: 30px 0 46px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
|
|
63
|
+
@media (max-width: 900px) {
|
|
64
|
+
.hero, .section { grid-template-columns: 1fr; }
|
|
65
|
+
.hero { min-height: auto; padding: 72px 0; }
|
|
66
|
+
.token-lab { max-width: 680px; }
|
|
67
|
+
}
|
|
68
|
+
@media (max-width: 580px) {
|
|
69
|
+
.wrap { width: min(100% - 24px, 1180px); }
|
|
70
|
+
nav a:not(:last-child) { display: none; }
|
|
71
|
+
.token-lab { grid-template-columns: 1fr; }
|
|
72
|
+
.source { border-right: 0; border-bottom: 1px solid var(--line); }
|
|
73
|
+
.row, .categories { grid-template-columns: 1fr; }
|
|
74
|
+
.row { gap: .35rem; }
|
|
75
|
+
.category:nth-child(even) { padding-left: 0; border-left: 0; }
|
|
76
|
+
footer { flex-direction: column; }
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
79
|
+
</head>
|
|
80
|
+
<body>
|
|
81
|
+
<a class="skip" href="#content">Skip to content</a>
|
|
82
|
+
<header class="wrap">
|
|
83
|
+
<a class="brand" href="./">Auva</a>
|
|
84
|
+
<nav aria-label="Primary navigation">
|
|
85
|
+
<a href="#contract">Contract</a>
|
|
86
|
+
<a href="#system">System</a>
|
|
87
|
+
<a href="https://github.com/noxdea/auva">Source</a>
|
|
88
|
+
</nav>
|
|
89
|
+
</header>
|
|
90
|
+
<main id="content">
|
|
91
|
+
<section class="hero wrap">
|
|
92
|
+
<div>
|
|
93
|
+
<p class="context">Design tokens for Zaniah</p>
|
|
94
|
+
<h1>Make the theme inspectable before it reaches the interface.</h1>
|
|
95
|
+
<p class="lede">Auva loads JSONC into a validated Zaniah theme, checks essential contrast pairs, and exports deterministic sheets for every token category.</p>
|
|
96
|
+
<div class="actions"><a class="button primary" href="https://rubygems.org/gems/auva">Install the gem</a><a class="button" href="https://github.com/noxdea/auva#quick-start">Read the guide</a></div>
|
|
97
|
+
</div>
|
|
98
|
+
<div class="token-lab" aria-label="Auva token validation example">
|
|
99
|
+
<pre class="source"><code><span class="comment">// tokens.jsonc</span>
|
|
100
|
+
{
|
|
101
|
+
<span class="key">"extends"</span>: <span class="value">"dark"</span>,
|
|
102
|
+
<span class="key">"colors"</span>: {
|
|
103
|
+
<span class="key">"accent"</span>: <span class="value">"#83b79f"</span>,
|
|
104
|
+
<span class="key">"background"</span>: <span class="value">"#080c0b"</span>
|
|
105
|
+
},
|
|
106
|
+
<span class="key">"motion"</span>: {
|
|
107
|
+
<span class="key">"reduced"</span>: <span class="value">true</span>
|
|
108
|
+
}
|
|
109
|
+
}</code></pre>
|
|
110
|
+
<div class="inspect"><h3>Resolved theme</h3><div class="swatch"><i class="chip" aria-hidden="true"> </i><span>accent</span><span>#83b79f</span></div><div class="swatch"><i class="chip surface" aria-hidden="true"> </i><span>surface</span><span>#19211e</span></div><div class="swatch"><i class="chip text" aria-hidden="true"> </i><span>text</span><span>#edf2ef</span></div><div class="swatch"><i class="chip muted" aria-hidden="true"> </i><span>text_muted</span><span>#9faea8</span></div><div class="contrast"><div class="contrast-row"><span>text / background</span><b>AAA</b></div><div class="contrast-row"><span>accent_text / accent</span><b>AA</b></div></div></div>
|
|
111
|
+
</div>
|
|
112
|
+
</section>
|
|
113
|
+
<section class="section wrap" id="contract">
|
|
114
|
+
<div><h2>Bad tokens fail where they are written.</h2><p class="section-copy">The schema comes from Zaniah's theme members, so validation tracks the real interface contract instead of a parallel copy.</p></div>
|
|
115
|
+
<div class="rows">
|
|
116
|
+
<div class="row"><strong>Parse</strong><p>Accept comments and trailing commas while retaining source ranges.</p></div>
|
|
117
|
+
<div class="row"><strong>Validate</strong><p>Reject unknown categories, members, types, colors, and shadow fields with a line and token path.</p></div>
|
|
118
|
+
<div class="row"><strong>Check</strong><p>Measure WCAG AA and AAA contrast for the color pairs users depend on.</p></div>
|
|
119
|
+
</div>
|
|
120
|
+
</section>
|
|
121
|
+
<section class="section wrap" id="system">
|
|
122
|
+
<div><h2>Inspect the whole system, not a single swatch.</h2></div>
|
|
123
|
+
<div class="categories"><div class="category"><i aria-hidden="true"> </i><span><b>Colors</b>Semantic palette and contrast</span></div><div class="category"><i aria-hidden="true"> </i><span><b>Typography</b>Families and type scale</span></div><div class="category"><i aria-hidden="true"> </i><span><b>Spacing</b>Numeric rhythm</span></div><div class="category"><i aria-hidden="true"> </i><span><b>Radii</b>Named corner system</span></div><div class="category"><i aria-hidden="true"> </i><span><b>Shadows</b>Validated shadow members</span></div><div class="category"><i aria-hidden="true"> </i><span><b>Motion</b>Durations, easing, reduction</span></div><div class="category"><i aria-hidden="true"> </i><span><b>Buttons</b>Interactive states</span></div><div class="category"><i aria-hidden="true"> </i><span><b>Components</b>Full UI gallery</span></div></div>
|
|
124
|
+
</section>
|
|
125
|
+
<section class="section wrap">
|
|
126
|
+
<div><h2>Load and check a theme.</h2></div>
|
|
127
|
+
<pre class="command"><code>gem install auva
|
|
128
|
+
auva tokens.jsonc --check --strict</code></pre>
|
|
129
|
+
</section>
|
|
130
|
+
</main>
|
|
131
|
+
<footer class="wrap"><span>Auva 0.1.0</span><span>Ruby 3.2+ · MIT</span></footer>
|
|
132
|
+
</body>
|
|
133
|
+
</html>
|
data/lib/auva/version.rb
CHANGED
data/lib/auva.rb
CHANGED
|
@@ -72,20 +72,22 @@ module Auva
|
|
|
72
72
|
|
|
73
73
|
def call
|
|
74
74
|
validate_top_level
|
|
75
|
-
|
|
75
|
+
overrides = {
|
|
76
76
|
colors: build_colors,
|
|
77
77
|
typography: build_data(:typography),
|
|
78
78
|
motion: build_data(:motion),
|
|
79
79
|
spacing: build_hash(:spacing, integer_keys: true),
|
|
80
80
|
radii: build_hash(:radii, symbol_keys: true),
|
|
81
81
|
shadows: build_shadows
|
|
82
|
-
|
|
82
|
+
}
|
|
83
|
+
overrides[:syntax] = build_syntax if @tokens.key?("syntax")
|
|
84
|
+
@base.with(**overrides)
|
|
83
85
|
end
|
|
84
86
|
|
|
85
87
|
private
|
|
86
88
|
|
|
87
89
|
def validate_top_level
|
|
88
|
-
unknown = @tokens.keys.map(&:to_s) - %w[extends colors typography spacing radii shadows motion]
|
|
90
|
+
unknown = @tokens.keys.map(&:to_s) - %w[extends colors typography spacing radii shadows motion syntax]
|
|
89
91
|
raise_token("unknown token category: #{unknown.join(", ")}", [unknown.first]) unless unknown.empty?
|
|
90
92
|
base = @tokens["extends"]
|
|
91
93
|
unless base.nil? || %w[dark light high_contrast high-contrast none].include?(base)
|
|
@@ -101,6 +103,15 @@ module Auva
|
|
|
101
103
|
@base.colors.with(**overrides)
|
|
102
104
|
end
|
|
103
105
|
|
|
106
|
+
def build_syntax
|
|
107
|
+
raise_token("syntax tokens require a Zaniah theme with syntax support", ["syntax"]) unless @base.respond_to?(:syntax)
|
|
108
|
+
values = @tokens.fetch("syntax", {})
|
|
109
|
+
ensure_hash(values, ["syntax"])
|
|
110
|
+
validate_keys(values, @base.syntax.members.map(&:to_s), ["syntax"])
|
|
111
|
+
overrides = values.to_h { |key, value| [key.to_sym, parse_color(value, ["syntax", key])] }
|
|
112
|
+
@base.syntax.with(**overrides)
|
|
113
|
+
end
|
|
114
|
+
|
|
104
115
|
def build_data(category)
|
|
105
116
|
values = @tokens.fetch(category.to_s, {})
|
|
106
117
|
ensure_hash(values, [category.to_s])
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: auva
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yudai Takada
|
|
@@ -43,20 +43,20 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 0.
|
|
46
|
+
version: 0.10.0
|
|
47
47
|
- - "<"
|
|
48
48
|
- !ruby/object:Gem::Version
|
|
49
|
-
version: '0
|
|
49
|
+
version: '1.0'
|
|
50
50
|
type: :runtime
|
|
51
51
|
prerelease: false
|
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
|
53
53
|
requirements:
|
|
54
54
|
- - ">="
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
|
-
version: 0.
|
|
56
|
+
version: 0.10.0
|
|
57
57
|
- - "<"
|
|
58
58
|
- !ruby/object:Gem::Version
|
|
59
|
-
version: '0
|
|
59
|
+
version: '1.0'
|
|
60
60
|
description: Load JSONC design tokens into Zaniah themes and check WCAG contrast ratios.
|
|
61
61
|
email:
|
|
62
62
|
- t.yudai92@gmail.com
|
|
@@ -70,6 +70,7 @@ files:
|
|
|
70
70
|
- README.md
|
|
71
71
|
- Rakefile
|
|
72
72
|
- exe/auva
|
|
73
|
+
- index.html
|
|
73
74
|
- lib/auva.rb
|
|
74
75
|
- lib/auva/version.rb
|
|
75
76
|
- sig/auva.rbs
|
|
@@ -94,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
94
95
|
- !ruby/object:Gem::Version
|
|
95
96
|
version: '0'
|
|
96
97
|
requirements: []
|
|
97
|
-
rubygems_version:
|
|
98
|
+
rubygems_version: 3.6.9
|
|
98
99
|
specification_version: 4
|
|
99
100
|
summary: Design token loader and preview utilities for Zaniah
|
|
100
101
|
test_files: []
|