53 lines
2.2 KiB
Markdown
53 lines
2.2 KiB
Markdown
# Token Tools
|
|
|
|
Token Tools imports and exports bounded Design Tokens Community Group
|
|
`$type`/`$value` JSON, including aliases, inherited groups, ordered themes and
|
|
explicit modes. Alias references resolve recursively inside composite values
|
|
with missing-target and full cycle diagnostics. Color, dimension, duration,
|
|
font, Bézier, stroke, border, transition, gradient, typography and shadow
|
|
tokens can be inspected before loss-aware CSS, Sass, Android or Swift export.
|
|
|
|
Edit, validate and export design tokens locally in the browser. Token Tools supports plain W3C-style nested JSON and a local multi-set wrapper using `$sets` plus ordered `$themes`.
|
|
|
|
## Features
|
|
|
|
- Bounded nested JSON editor and a focused path/type/value editor.
|
|
- Set composition with later-set overrides and theme previews.
|
|
- `{path.to.token}` alias resolution, missing-target errors, cycle detection and type warnings.
|
|
- Color, dimension, typography, shadow, number, string and boolean validation.
|
|
- W3C-style JSON, CSS custom properties, Sass, Android XML and Swift/UIKit exports.
|
|
- Target-safe string escaping, identifier-collision detection and a loss report that never silently drops unsupported composite semantics.
|
|
- Offline PWA and shared system/light/dark Toolbox shell.
|
|
|
|
## Document shape
|
|
|
|
A plain nested object is treated as the `default` set. For themes:
|
|
|
|
```json
|
|
{
|
|
"$sets": { "core": {}, "dark": {} },
|
|
"$themes": { "light": ["core"], "dark": ["core", "dark"] }
|
|
}
|
|
```
|
|
|
|
Each token uses `$type` and `$value`; group `$type` values are inherited. This is a practical W3C-style interchange, while `$sets` and `$themes` are an application wrapper rather than a claim of W3C standardization.
|
|
|
|
## Limits
|
|
|
|
Documents are capped at 1 MiB, depth 64 and 10,000 tokens (with a 50,000 JSON-node parsing bound). Malformed wrappers, unknown declared types and token/group shape conflicts fail explicitly. No imported value is executed. Android and Swift composite output needs project conventions, so unsupported values are omitted with explicit losses.
|
|
|
|
## Development
|
|
|
|
```sh
|
|
npm ci
|
|
npm run check
|
|
npm run test:browser
|
|
npm run package:release -- --force
|
|
```
|
|
|
|
The deterministic release is `release/token-tools-0.2.0.zip` with a SHA-256 sidecar. Node.js 22+ and npm 11 are required.
|
|
|
|
## Licence
|
|
|
|
GPL-3.0-or-later.
|