@alien6-studio/elea-tokens 0.1.2 → 0.1.3

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,14 +1,13 @@
1
1
  # @alien6-studio/elea-tokens
2
2
 
3
- Design tokens of the Elea design system. The source is a [DTCG](https://tr.designtokens.org/format/)
4
- JSON file; the package resolves its aliases and emits every form a project needs.
3
+ Design tokens for ELEA, available as CSS, JavaScript and DTCG 2025.10 interchange files.
5
4
 
6
5
  The JavaScript entry points are ES modules. For Jest with `next/jest`, add `@alien6-studio/elea-tokens` to `transpilePackages` when testing a JavaScript import such as `@alien6-studio/elea-tokens/brand`.
7
6
 
8
7
  ## What you get
9
8
 
10
- - `tokens/elea.tokens.json` and `tokens/elea.dark.tokens.json`: the light and dark source files
11
- for tooling that transforms Elea tokens.
9
+ - `dtcg/2025.10/elea.tokens.json` and `dtcg/2025.10/elea.dark.tokens.json` each contain a complete theme for external design-token tools.
10
+ - `tokens/elea.tokens.json` and `tokens/elea.dark.tokens.json` expose ELEA's original CSS-oriented JSON. The second file contains only overrides and refers back to the first. Existing integrations can keep using these paths.
12
11
  - `elea.css`: the runtime stylesheet. Every token is a custom property on `:root`
13
12
  (`--elea-color-text-default`, `--elea-space-4`, `--elea-radius-lg`,
14
13
  `--elea-motion-duration-base`, `--elea-motion-easing-standard`...); the dark overrides apply
@@ -27,6 +26,35 @@ The JavaScript entry points are ES modules. For Jest with `next/jest`, add `@ali
27
26
  produce all of the above (`toStylesheet`, `toTailwindTheme`, `toTailwindPreset`,
28
27
  `toShadcnAliases`, `toShadcnPreset`) for custom themes.
29
28
 
29
+ ## DTCG 2025.10 interchange
30
+
31
+ Choose one document as the input to your tool. Dimensions carry a number and a unit, colors carry sRGB components and alpha, and each shadow layer has its own offsets, blur, spread and color. Aliases retain their named targets so editing a primitive updates the roles that reference it. Both exports target the [DTCG Format](https://www.designtokens.org/tr/2025.10/format/) and [Color](https://www.designtokens.org/tr/2025.10/color/) modules for October 2025.
32
+
33
+ These export paths were added in 0.1.3. To reproduce the check, use Node.js 22 or later at the root of a checkout.
34
+
35
+ ```sh
36
+ npm ci
37
+ npm run export:dtcg -w packages/tokens
38
+ npm run test:dtcg
39
+ ```
40
+
41
+ `export:dtcg` writes both JSON files to `packages/tokens/dist/dtcg/2025.10/`. The test installs Style Dictionary 5.8.0 from the example's lockfile, reads the package exports and writes `light.css` and `dark.css` under `artifacts/examples/dtcg/`. It compares every token path, type, computed CSS value and alias target with the source. For example, the `100ms` duration becomes the equivalent `0.1s`, and both layers of `shadow.md` retain their negative spreads.
42
+
43
+ In the generated light CSS, two declarations show how a primary swatch reaches a button. The example changes that swatch and verifies that both roles take its new color. [Runnable example](../../docs/examples/dtcg/qualify.test.mjs)
44
+
45
+ ```css
46
+ --color-info: var(--color-primary-600);
47
+ --color-action-info: var(--color-info);
48
+ ```
49
+
50
+ The following command uses `uvx` to validate both files against the pinned JSON Schema.
51
+
52
+ ```sh
53
+ uvx --from check-jsonschema==0.39.0 check-jsonschema \
54
+ --schemafile https://www.designtokens.org/schemas/2025.10/format.json \
55
+ packages/tokens/dist/dtcg/2025.10/*.tokens.json
56
+ ```
57
+
30
58
  ## Use
31
59
 
32
60
  ```css
@@ -93,6 +121,16 @@ The chart and sidebar variables have no Elea counterpart and stay yours. An alia
93
121
  where it is declared: `shadcn.css` covers the root, `data-theme` containers and the three
94
122
  editions; for your own brand class, emit `toShadcnAliases(".journal")` next to its theme.
95
123
 
124
+ ## Interface density
125
+
126
+ The runtime stylesheet includes three regional spacing profiles. Set
127
+ `data-elea-density="compact"` on a workspace, `"comfortable"` on a roomy
128
+ form or `"standard"` to reset an inner region. Each profile defines
129
+ `--elea-density-control-offset`, `--elea-density-field-gap`,
130
+ `--elea-density-action-gap` and `--elea-density-table-padding`.
131
+ The brand generator's `rhythm` still controls reading text. See the
132
+ [UI density example](../ui#regional-density).
133
+
96
134
  ## Local appearance
97
135
 
98
136
  Set `data-elea-appearance="light"`, `"dark"` or `"auto"` on an HTML container
@@ -274,3 +312,45 @@ the new values.
274
312
 
275
313
  `color` (neutral, primary, secondary scales; success, warning, danger, info; semantic text, surface,
276
314
  border, focus), `font` (family, size, weight, leading), `space`, `radius`, `shadow`, `size`.
315
+
316
+ ## Interface typography
317
+
318
+ Import `@alien6-studio/elea-tokens/elea.css` and `@alien6-studio/elea-tokens/typography.css`.
319
+ Set `data-elea-type` on the element that renders the text. Choose its HTML heading level separately.
320
+ The following are the defaults at a 16px root. A scoped reading theme supplies its own body family, size, leading and measure.
321
+
322
+ | Role | Use | Size / weight | Line height | Tracking | Maximum measure |
323
+ | --- | --- | --- | --- | --- | --- |
324
+ | `display` | Opening headline | 48px / 600 | 1.05 | −.045em | 18ch |
325
+ | `page` | Page title | 36px / 700 | 1.1 | −.035em | 28ch |
326
+ | `section` | Section heading | 24px / 600 | 1.25 | −.02em | 38ch |
327
+ | `reading` | Body copy | 18px / 400 | 1.625 | Normal | Reading measure token |
328
+ | `label` | Field or action label | 14px / 500 | 1.5 | Normal | Container |
329
+ | `data` | Dates and numeric values | 14px / 500 | 1.5 | Normal | Column |
330
+ | `annotation` | Source or figure note | 12px / 400 | 1.5 | .01em | 56ch |
331
+
332
+ The data role requests lining, tabular figures. Align comparable amounts to the end of their column and format units, dates and currencies for the reader’s locale. Keep identifiers as strings to preserve leading zeroes.
333
+
334
+ ## Qualify a theme
335
+
336
+ Import `qualifyTheme` and `compareThemeReports` from `@alien6-studio/elea-tokens/qualification`.
337
+ The Studio’s **Download contrast report** exports the same JSON. Each record includes the resolved foreground, background, full-precision contrast ratio, threshold and outcome. A complete named profile has 56 checks across seven roles, two appearances and four states. Unassigned roles are listed separately because they inherit their colours from the host.
338
+
339
+ From a source checkout, generate two reports and inspect the changes:
340
+
341
+ ```sh
342
+ npm ci
343
+ npm run build:packages
344
+ node docs/examples/qualify-theme.mjs --profile reserve > reserve.json
345
+ node docs/examples/qualify-theme.mjs --profile braise --previous reserve.json > braise.json
346
+ ```
347
+
348
+ Pass `--theme path/to/brand.json` to use your own `BrandTheme`. A colour pair below 4.5:1 sets the command’s exit status to 1 and is included in the output. Diff entries are keyed by role, appearance and state, with the previous and current pair. The comparison lists changed theme settings, including typography and shape.
349
+
350
+ The colour report uses the [WCAG relative luminance calculation](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html) on the generated sRGB values. Browser styles, host overrides, focus indicators, images and document accessibility require separate checks. The site’s Playwright `theme-proof.spec.ts` records actual button foregrounds and backgrounds at rest, on hover and on press, and field, button and row measurements at all three densities. Its declared matrix covers Réserve and Rasance in light and dark across Chromium, Firefox and WebKit. Each result identifies the engine, version, viewport and component states exercised. To deliver a combined report, supply matching Playwright files from that build. Repeat `--evidence` for additional configurations:
351
+
352
+ ```sh
353
+ node docs/examples/qualify-theme.mjs --profile reserve --evidence path/to/theme-proof.json > qualified.json
354
+ ```
355
+
356
+ The command checks the recorded profile configuration and tokens version, retains the original run metadata and returns a failing status for unsuccessful measurements. Use results from the same library and site revisions as your delivery.