@crewlethq/tokens 0.81.2 → 0.82.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewlethq/tokens",
3
- "version": "0.81.2",
3
+ "version": "0.82.0",
4
4
  "description": "Crewlet design tokens. Single JSON source compiled to CSS variables and typed JS modules.",
5
5
  "license": "MIT AND OFL-1.1",
6
6
  "repository": {
package/test/color.mjs CHANGED
@@ -22,12 +22,14 @@
22
22
  */
23
23
 
24
24
  import {
25
+ atLightness,
25
26
  contrast,
26
27
  formatHex,
27
28
  fromLinear,
28
29
  fromOklab,
29
30
  linearChannel,
30
31
  luminance,
32
+ oklabHex,
31
33
  oklabToLinear,
32
34
  parseHex,
33
35
  parseRgba,
@@ -35,7 +37,7 @@ import {
35
37
  withAlpha,
36
38
  } from '../dist/color.js';
37
39
 
38
- export { contrast, fromOklab, luminance, oklabToLinear, parseHex, parseRgba, toOklab, withAlpha };
40
+ export { atLightness, contrast, fromOklab, luminance, oklabHex, oklabToLinear, parseHex, parseRgba, toOklab, withAlpha };
39
41
  export { formatHex as hex };
40
42
 
41
43
  /** @typedef {{ r: number, g: number, b: number }} RGB */
@@ -220,3 +220,5 @@ export const ARTIFACT_KIND_HUES: readonly string[];
220
220
  export const ARTIFACT_KIND_FILL_ALPHA: number;
221
221
  /** How far apart, in OKLab dE under normal vision, any two kind hues sit. */
222
222
  export const ARTIFACT_KIND_DE: number;
223
+ /** The kind ground steps the primary text is held to 4.5:1 on, over the card rung (`ground`, `ground-strong`). */
224
+ export const ARTIFACT_KIND_GROUNDS: readonly string[];
package/test/palette.mjs CHANGED
@@ -371,6 +371,13 @@ export const ARTIFACT_KIND_HUES = ARTIFACT_KINDS.map((kind) => `--color-artifact
371
371
  export const ARTIFACT_KIND_FILL_ALPHA = 0.12;
372
372
  /** How far apart, in OKLab dE under normal vision, any two kind hues sit. */
373
373
  export const ARTIFACT_KIND_DE = 8;
374
+ /**
375
+ * The steps a card drawn ON a kind's hue reads its words on: its ground at
376
+ * rest and under the pointer (`-ground`, `-ground-strong`), each laid on the
377
+ * card rung it stands on. The primary text clears 4.5:1 on both, in every
378
+ * palette, because the card's title is set in it.
379
+ */
380
+ export const ARTIFACT_KIND_GROUNDS = ['ground', 'ground-strong'];
374
381
 
375
382
  // ---------------------------------------------------------------------------
376
383
  // The rail
@@ -1001,6 +1008,13 @@ function checkState(state, values, profile, push, theme = { tint: null, contrast
1001
1008
  ink.ratio,
1002
1009
  `${ink.ratio.toFixed(2)}:1 (worst on ${ink.name})`,
1003
1010
  );
1011
+ // See ARTIFACT_KIND_GROUNDS. Laid on the card rung, where a card on a
1012
+ // kind's hue stands.
1013
+ const card = flatten(values.get('--color-surface-subtle'), ground);
1014
+ for (const step of ARTIFACT_KIND_GROUNDS) {
1015
+ const ratio = contrast(colour('--color-text-primary'), flatten(values.get(`${name}-${step}`), card));
1016
+ say('the primary text clears 4.5:1 on a kind ground', ratio >= 4.5, `--color-text-primary on ${name}-${step}`, ratio, `${ratio.toFixed(2)}:1`);
1017
+ }
1004
1018
  }
1005
1019
  if (profile === 'full') {
1006
1020
  for (let i = 0; i < kinds.length; i += 1) {