@rokkit/cli 1.9.1 → 1.10.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/cli",
3
- "version": "1.9.1",
3
+ "version": "1.10.1",
4
4
  "description": "Command line utilities for icon bundling and conversion.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,8 +27,9 @@
27
27
  "vitest": "^4.1.11"
28
28
  },
29
29
  "dependencies": {
30
+ "@rokkit/core": "1.10.1",
30
31
  "@mdi/svg": "^7.4.47",
31
- "@rokkit/unocss": "1.9.1",
32
+ "@rokkit/unocss": "1.10.1",
32
33
  "sade": "^1.8.1",
33
34
  "@iconify/tools": "^5.0.14",
34
35
  "@iconify/types": "^2.0.0",
@@ -198,7 +198,7 @@ The 24-token core vocabulary, all flipping automatically under `[data-mode="dark
198
198
  | Group | Tokens | Use |
199
199
  |---------|---------------------------------------------------------|--------------------------------------------------|
200
200
  | Surface | `paper` · `paper-soft` · `paper-mute` · `paper-edge` | canvas · card · subdued panel · hairline border |
201
- | Text | `ink` · `ink-mute` · `ink-soft` · `ink-faint` | body · secondary · placeholder · disabled |
201
+ | Text | `ink` · `ink-mute` · `ink-soft` · `ink-faint` | body · secondary · tertiary · quietest (all AA) |
202
202
  | Primary | `primary` · `on-primary` | CTA fill · text/icon on a primary fill |
203
203
  | Accent | `accent` · `accent-soft` | accent fill · tinted accent background |
204
204
  | Status | `success`/`-soft`, `warning`/`-soft`, `danger`/`-soft`, `error`/`-soft`, `info`/`-soft` | solid status · tinted callout bg |
package/src/contrast.js CHANGED
@@ -3,7 +3,8 @@
3
3
  *
4
4
  * Computes real WCAG contrast (not just OKLCH lightness diff) from the project's
5
5
  * configured palettes, in BOTH light and dark modes, and verifies:
6
- * - `ink` and `ink-mute` (primary + secondary text) clear AA 4.5 on `paper`,
6
+ * - every ink tone (`ink`, `ink-mute`, `ink-soft`, `ink-faint`) clears AA 4.5 on `paper`
7
+ * — all four are text tones,
7
8
  * - the text ramp is monotonic: ink > ink-mute > ink-soft > ink-faint,
8
9
  * - `paper-edge` (the hairline border tone) is actually visible against `paper`
9
10
  * (catches the "near-black etched edge invisible in dark" class of bug).
@@ -12,6 +13,8 @@
12
13
  * the doctor surfaces problems, it doesn't block.
13
14
  */
14
15
 
16
+ import { NAMED_TOKEN_SHADE_MAP } from '@rokkit/core'
17
+
15
18
  const PALETTE_REF = /^([a-z][\w-]*)\.(\d{2,3})$/i
16
19
 
17
20
  /**
@@ -137,15 +140,8 @@ const AA = 4.5
137
140
  const EDGE_MIN = 1.18
138
141
  /** Float slack, so noise in the ramp doesn't read as a real inversion. */
139
142
  const RAMP_SLACK = 0.01
140
- /** The ink ramp, darkest first — the order the monotonic check asserts. */
141
- const INK_RAMP = [
142
- ['ink', 900],
143
- ['ink-mute', 700],
144
- ['ink-soft', 500],
145
- ['ink-faint', 300]
146
- ]
147
- /** The two ink tones that carry readable text, and so must clear AA. */
148
- const READABLE = new Set(['ink', 'ink-mute'])
143
+ /** The ink ramp, strongest first — the order the monotonic check asserts — at the preset's shades. */
144
+ const INK_RAMP = ['ink', 'ink-mute', 'ink-soft', 'ink-faint'].map((name) => [name, NAMED_TOKEN_SHADE_MAP[name]])
149
145
 
150
146
  /** The skin block, under whichever of the three accepted config keys holds it. */
151
147
  function skinOf(config) {
@@ -160,16 +156,24 @@ function inkRamp(config, skin, paper, mode) {
160
156
  })
161
157
  }
162
158
 
163
- /** AA gate on the tones that actually carry text. */
159
+ /** The kind of text each ink tone carries, for the finding. */
160
+ const ROLE_OF = {
161
+ ink: 'primary',
162
+ 'ink-mute': 'secondary',
163
+ 'ink-soft': 'tertiary',
164
+ 'ink-faint': 'quietest'
165
+ }
166
+
167
+ /** AA gate on the ink tones. */
164
168
  function checkReadableText(ramp, mode) {
165
169
  return ramp
166
- .filter(({ name, c }) => READABLE.has(name) && c !== null && c < AA)
170
+ .filter(({ c }) => c !== null && c < AA)
167
171
  .map(({ name, c }) => ({
168
172
  id: `contrast-${name}-${mode}`,
169
173
  label: `${name} on paper clears AA in ${mode}`,
170
174
  status: 'warn',
171
175
  fixable: false,
172
- fix: `${name} vs paper is ${c.toFixed(2)}:1 in ${mode} (need ≥ ${AA}). It backs ${name === 'ink' ? 'primary' : 'secondary'} text — darken ${name} (or lighten paper) in this mode.`
176
+ fix: `${name} vs paper is ${c.toFixed(2)}:1 in ${mode} (need ≥ ${AA}). It backs ${ROLE_OF[name]} text — darken ${name} (or lighten paper) in this mode.`
173
177
  }))
174
178
  }
175
179
 
@@ -195,7 +199,7 @@ function checkRampMonotonic(ramp, mode) {
195
199
 
196
200
  /** paper-edge must be distinguishable from paper, or the hairline border vanishes. */
197
201
  function checkEdgeVisible(config, skin, paper, mode) {
198
- const edge = resolveToken({ config, skin, role: 'surface', shade: 400, name: 'paper-edge', mode })
202
+ const edge = resolveToken({ config, skin, role: 'surface', shade: NAMED_TOKEN_SHADE_MAP['paper-edge'], name: 'paper-edge', mode })
199
203
  if (!edge) return []
200
204
  const ratio = contrastRatio(edge, paper)
201
205
  if (ratio >= EDGE_MIN) return []
@@ -212,7 +216,7 @@ function checkEdgeVisible(config, skin, paper, mode) {
212
216
 
213
217
  /** All three checks for one mode. */
214
218
  function checksForMode(config, skin, mode) {
215
- const paper = resolveToken({ config, skin, role: 'surface', shade: 50, name: 'paper', mode })
219
+ const paper = resolveToken({ config, skin, role: 'surface', shade: NAMED_TOKEN_SHADE_MAP.paper, name: 'paper', mode })
216
220
  if (!paper) return []
217
221
  const ramp = inkRamp(config, skin, paper, mode)
218
222
  return [
package/src/init.js CHANGED
@@ -174,13 +174,13 @@ const ZEN_SUMI_PALETTES = {
174
174
  kami: {
175
175
  50: '0.985 0.005 85', 100: '0.975 0.008 85', 200: '0.955 0.010 85',
176
176
  300: '0.920 0.012 85', 400: '0.850 0.010 70', 500: '0.750 0.008 50',
177
- 600: '0.580 0.010 50', 700: '0.380 0.012 50', 800: '0.280 0.012 50',
177
+ 600: '0.510 0.010 50', 700: '0.470 0.012 50', 800: '0.380 0.012 50',
178
178
  900: '0.220 0.012 50', 950: '0.170 0.010 50'
179
179
  },
180
180
  sumi: {
181
181
  50: '0.170 0.010 50', 100: '0.210 0.012 50', 200: '0.250 0.012 50',
182
182
  300: '0.320 0.012 50', 400: '0.420 0.010 50', 500: '0.570 0.010 50',
183
- 600: '0.420 0.012 85', 700: '0.600 0.010 85', 800: '0.780 0.008 85',
183
+ 600: '0.660 0.009 85', 700: '0.720 0.009 85', 800: '0.780 0.008 85',
184
184
  900: '0.940 0.008 85', 950: '0.975 0.008 85'
185
185
  },
186
186
  shu: {