@oneli8/tokens 1.0.0-beta.2 → 1.0.0-beta.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,94 +1,100 @@
1
1
  # @oneli8/tokens
2
2
 
3
- The canonical machine-readable source for Oneli8. Authored DTCG-compatible
4
- files live in `src/`; everything under `build/` is generated.
5
-
6
- ## Build
3
+ OneLi8 Design System design tokens compiled from Figma.
7
4
 
8
5
  ```sh
9
- npm run build
10
- npm test
6
+ npm install @oneli8/tokens
11
7
  ```
12
8
 
13
- When building a distributed token package without the development repository,
14
- use `node scripts/build.mjs --standalone` (or `node scripts/test.mjs --standalone`).
15
- This skips only external contract-file existence checks. Token references,
16
- schema-related checks and generated values are unchanged. The historical status
17
- registry is not proof that those components are included in a scoped distribution.
9
+ ```js
10
+ import '@oneli8/tokens/css'; // :root custom properties + .ol8-type-* classes
11
+ import { tokens } from '@oneli8/tokens'; // flat { 'color-text-primary': '#151817', ... }
12
+ ```
18
13
 
19
- ## Delivery adapters
14
+ Every value is generated from `src/tokens.json`, which is verified against the
15
+ Figma file rather than hand-maintained. Do not edit `dist/` — edit the source and
16
+ rebuild.
20
17
 
21
- - CSS: `@oneli8/tokens/css`
22
- - TypeScript/JavaScript: `@oneli8/tokens`
23
- - Tailwind CSS v3 preset: `@oneli8/tokens/tailwind`
24
- - Tailwind CSS v4 theme bridge: `@oneli8/tokens/tailwind.css`
25
- - Figma importer data: `@oneli8/tokens/figma`
26
- - Component maturity registry: `@oneli8/tokens/status`
18
+ ## What the vocabulary contains
27
19
 
28
- Tailwind is an adapter. It never becomes the source of Oneli8 values.
29
- Its spacing keys preserve the familiar 3px-indexed utilities: `1 = 3px`,
30
- `2 = 6px`, `4 = 12px`, `8 = 24px`, through `36 = 108px`.
31
- Semantic colors are exposed as utilities such as
32
- `bg-ol8-background-canvas`, `text-ol8-text-primary`, and
33
- `bg-ol8-action-primary-default`. Product interfaces should not assign
34
- meaning with raw Candidate 03 palette steps.
20
+ 99 colour primitives across 9 ramps, 68 semantic colour roles, 45 Gem material
21
+ roles, 27 control-material roles, a 3px-atomic dimension scale, 9 radii, 9
22
+ composite typography roles and 5 elevations.
35
23
 
36
- ## Color modes
24
+ Two rules matter when consuming it:
37
25
 
38
- Color Scheme and Primary Family are independent attributes. They can be
39
- combined without selecting a prebuilt Cartesian-product theme:
26
+ - **Use semantic roles, not primitives.** `color-blue-600` is a swatch;
27
+ `color-actionprimary-default` is a decision. Primitives are hidden from Figma
28
+ pickers for the same reason.
29
+ - **Use the `.ol8-type-<role>` class, not individual font variables.** Typography
30
+ is composite in Figma — a role bundles family, size, line height, weight and
31
+ tracking — and the class applies all of them together.
40
32
 
41
- ```html
42
- <main data-ol8-color-scheme="dark" data-ol8-primary="orange">
43
- ...
44
- </main>
33
+ ## Entry points
34
+
35
+ | Import | What it gives you |
36
+ |---|---|
37
+ | `@oneli8/tokens` | flat `{ name: value }` map, with a literal-union key type |
38
+ | `@oneli8/tokens/css` | the custom properties and `.ol8-type-*` classes |
39
+ | `@oneli8/tokens/tailwind` | Tailwind v3 preset |
40
+ | `@oneli8/tokens/tailwind.css` | Tailwind v4 `@theme` bridge |
41
+ | `@oneli8/tokens/figma` | round-trip payload: collections, theme modes, type and elevation styles |
42
+ | `@oneli8/tokens/status` | component maturity records |
43
+ | `@oneli8/tokens/source` | the editable `tokens.json` |
44
+
45
+ ```js
46
+ // tailwind.config.js (v3)
47
+ import ol8 from '@oneli8/tokens/tailwind';
48
+ export default { presets: [ol8], content: ['./src/**/*'] };
45
49
  ```
46
50
 
47
- - `data-ol8-color-scheme="light|dark"`
48
- - `data-ol8-primary="blue|orange|green"`
49
- - `data-ol8-type-mode="compact|medium|expanded"`
51
+ ```css
52
+ /* Tailwind v4 */
53
+ @import "@oneli8/tokens/css";
54
+ @import "@oneli8/tokens/tailwind.css";
55
+ ```
50
56
 
51
- The CSS keeps Semantic color references live through custom-property aliases,
52
- so changing the Primary family updates its Default, Hover, Pressed, content,
53
- link, and qualified focus roles together.
57
+ Both adapters emit `var(--ol8-*)` references rather than resolved values, so
58
+ Tailwind classes follow the theme attributes exactly like the raw custom
59
+ properties do. `bg-ol8-actionprimary-default` repaints when you switch the
60
+ primary family; it does not bake a blue at build time.
54
61
 
55
- ## Elevation and Gem material
62
+ The JS map is the exception: it holds resolved literals, because code that reads
63
+ it wants an actual colour, not a `var()` string.
56
64
 
57
- Five visual elevation roles and five independent stacking tiers are generated
58
- for CSS, Tailwind, TypeScript, and Figma. Tailwind examples include
59
- `shadow-ol8-raised`, `shadow-ol8-overlay`, and `z-ol8-modal`.
65
+ ## Naming
60
66
 
61
- Gem material colors preserve their Candidate 03 references and governed alpha.
62
- They are optional environmental-material roles, not replacements for
63
- `Color / Surface`, feedback, selection, focus, or action semantics. Reduced
64
- Transparency resolves through each recipe's opaque equivalent.
67
+ Hyphens separate hierarchy levels; compound words inside a level run together.
68
+ So `--ol8-focus-ring-innerwidth`, not `inner-width` and likewise
69
+ `surfacedefault`, `disabledcontent`, `paddinginline`, `cutedge`,
70
+ `opaqueequivalent`. This mirrors the Figma variable names exactly.
65
71
 
66
- ### Tailwind CSS v3
72
+ ## Theming
67
73
 
68
- ```js
69
- import oneli8 from "@oneli8/tokens/tailwind";
74
+ Three independent axes, each an attribute. They compose — set two at once and you
75
+ get both; there is no Cartesian product of pre-baked modes.
70
76
 
71
- export default {
72
- presets: [oneli8],
73
- };
77
+ ```html
78
+ <html data-ol8-color-scheme="dark" data-ol8-primary="orange">
74
79
  ```
75
80
 
76
- ### Tailwind CSS v4
81
+ | Attribute | Values | Effect |
82
+ |---|---|---|
83
+ | `data-ol8-color-scheme` | `dark` | Remaps 86 semantic roles onto dark primitives. Omit for light. |
84
+ | `data-ol8-primary` | `blue` (default), `orange`, `green` | Repoints the `color-primary-*` ramp at another family. |
77
85
 
78
- ```css
79
- @import "tailwindcss";
80
- @import "@oneli8/tokens/tailwind.css";
81
- @import "@oneli8/tokens/css";
82
- ```
86
+ Family swapping works because semantic roles are emitted as *references*
87
+ (`--ol8-color-actionprimary-default: var(--ol8-color-primary-600)`), never as
88
+ baked hex. Repoint the ramp and every role that reads it repaints. Anything you
89
+ author yourself should follow the same rule: reference the semantic role, not a
90
+ primitive, or your UI will not follow the theme.
91
+
92
+ Not yet ported from the Figma theme source: the `typographyViewport` axis
93
+ (`medium` / `expanded`), which needs `font.size.090`, `font.line.096` and a
94
+ `font.tracking.*` scale this tree has never synced; dark overrides for the five
95
+ `elevation-*` composites; and dark link-state and icon-button-surface roles,
96
+ which have no token in this vocabulary yet.
97
+
98
+ ## Licence
83
99
 
84
- The current encoding contains approved Dimension, Spacing, Sizing, Shape,
85
- Border, Focus, Typography, Motion, Candidate 03 Color, Semantic Light/Dark
86
- color modes, Blue/Orange/Green Primary families, Elevation, stacking order,
87
- approved Gem material geometry and colors, plus 125 approved Component geometry
88
- recipes and ten evidence-backed maturity records. The Navigation slice adds
89
- shared recipes for Tabs, Segmented Control, and Tab Bar without creating
90
- component-private foundation scales.
91
-
92
- Thin agent adapters live in `../agent/`. A browser example that consumes the
93
- generated CSS, ESM tokens, and maturity registry without copying values lives
94
- in `../../examples/web-token-consumer/`.
100
+ Apache-2.0. Created by Akshay Dhore. See `LICENSE` and `NOTICE`.