@tooark/tokens 1.0.1 → 1.1.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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![npm](https://img.shields.io/npm/v/@tooark/tokens?logo=npm&color=CB3837)](https://www.npmjs.com/package/@tooark/tokens)
4
4
  [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/Tooark/web-components/blob/main/LICENSE)
5
5
 
6
- Design primitives of the Tooark design system: colors by intent, size scale, radii and motion tokens as CSS custom properties, a Tailwind v4 `@theme` and TypeScript types.
6
+ Design primitives of the Tooark design system: colors by intent and the size scale as a Tailwind v4 `@theme`, motion tokens as CSS custom properties, and TypeScript types.
7
7
 
8
8
  🌍 **Languages:** ![USA Flag](https://flagcdn.com/w20/us.png) **English (this file)** · [![Brazil Flag](https://flagcdn.com/w20/br.png) Português](./README.pt-BR.md)
9
9
 
@@ -26,7 +26,7 @@ Design primitives of the Tooark design system: colors by intent, size scale, rad
26
26
 
27
27
  The `@tooark/tokens` package provides:
28
28
 
29
- - `tokens.css`: a `@theme static` block with semantic colors (`primary`, `secondary`, `success`, `warning`, `danger`, `info`, `neutral`, plus `surface*`, `fg*`, `border*`) as `light-dark()` values, the size scale (`--size-xs…xl`), the `--text-2xs` step and Tailwind's radii;
29
+ - `tokens.css`: a `@theme static` block with semantic colors (`primary`, `secondary`, `success`, `warning`, `danger`, `info`, `neutral`, plus `surface*`, `fg*`, `border*`, `muted`, `ring`) as `light-dark()` values, the size scale (`--size-xs…xl`) and the `--text-2xs` step (no radii: the `rounded` scale is Tailwind's own, `ArkRounded` only types it);
30
30
  - motion tokens outside `@theme`: `--ark-duration-*` (eight steps), `--ark-ease-*` (`linear`, `standard`, `in`, `out`, `in-out`, `overshoot`, `sheet`) and `--ark-motion-distance`, zeroed under `prefers-reduced-motion`;
31
31
  - JS mirrors of the motion tokens (`ARK_DURATION_MS`, `ARK_EASING_CSS`, `ARK_MOTION_DISTANCE`) for WAAPI fallbacks;
32
32
  - `resolveColorScheme(element)` and `observeColorScheme(element, onChange)` to resolve and follow the page theme;
@@ -46,9 +46,15 @@ Not needed directly when you use `@tooark/web-components`: its `styles.css` alre
46
46
 
47
47
  ## ⚙️ Configuration
48
48
 
49
- Import the stylesheet in your own CSS or Tailwind entry and declare the page's `color-scheme` (the tokens are `light-dark()` values, so the theme is pure CSS):
49
+ `tokens.css` is written for the Tailwind v4 compiler: the colors, sizes and `--text-2xs` live in a `@theme` block, which a browser reading the file as plain CSS drops (only the motion tokens survive). Two ways to get them:
50
+
51
+ - through the Tooark stylesheets: `@tooark/web-components/styles.css` (or `@tooark/core/styles.css` without the components) already carries them, compiled with the `ark` prefix (`--ark-color-*`, `--ark-size-*`, `--ark-text-2xs`);
52
+ - in your own Tailwind v4 entry: import `tokens.css` after Tailwind and they become `--color-*`, `--size-*` and `--text-2xs` variables plus utilities (`bg-primary`, `text-primary-fg`, `border-border`, `text-2xs`).
53
+
54
+ Either way, declare the page's `color-scheme` (the colors are `light-dark()` values, so the theme is pure CSS). In a Tailwind entry:
50
55
 
51
56
  ```css
57
+ @import "tailwindcss";
52
58
  @import "@tooark/tokens/tokens.css";
53
59
 
54
60
  :root {
@@ -62,9 +68,11 @@ Import the stylesheet in your own CSS or Tailwind entry and declare the page's `
62
68
 
63
69
  ### CSS custom properties
64
70
 
65
- - Colors: `--ark-color-<intent>`, `-fg`, `-hover`, `-soft`, `-soft-fg`, `-border`, `-ring`; neutrals `--ark-color-surface`, `-surface-muted`, `-fg`, `-fg-soft`, `-fg-muted`, `-border`, `-ring`.
71
+ Names as the Tooark stylesheets expose them; in your own Tailwind entry the `@theme` ones have no `ark-` prefix (`--color-surface`, `--size-md`, `--text-2xs`).
72
+
73
+ - Colors: `--ark-color-<intent>`, `-fg`, `-hover`, `-soft`, `-soft-fg`, `-border`, `-ring`; neutrals `--ark-color-surface`, `-surface-muted`, `-surface-strong`, `-surface-raised`, `-fg`, `-fg-soft`, `-fg-muted`, `-fg-faint`, `-fg-placeholder`, `-border`, `-border-strong`, `-muted`, `-ring`.
66
74
  - Sizes: `--ark-size-xs…xl` (1.5 / 1.75 / 2.25 / 2.75 / 3.25 rem, the min-height of form controls); `--ark-text-2xs` (0.6875 rem) for micro-labels.
67
- - Motion: `--ark-duration-none|instant|quick|default|moderate|gentle|slow|long`, `--ark-ease-*`, `--ark-motion-distance`.
75
+ - Motion (plain custom properties outside `@theme`: the same name everywhere, even with `tokens.css` as plain CSS): `--ark-duration-none|instant|quick|default|moderate|gentle|slow|long`, `--ark-ease-*`, `--ark-motion-distance`.
68
76
 
69
77
  ### JavaScript
70
78
 
@@ -80,11 +88,12 @@ Import the stylesheet in your own CSS or Tailwind entry and declare the page's `
80
88
  ### Styling your own component with the tokens
81
89
 
82
90
  ```css
91
+ /* with @tooark/web-components/styles.css (or @tooark/core/styles.css) on the page */
83
92
  .card {
84
93
  background: var(--ark-color-surface);
85
94
  color: var(--ark-color-fg);
86
95
  border: 1px solid var(--ark-color-border);
87
- border-radius: var(--ark-radius-lg);
96
+ border-radius: 0.5rem;
88
97
  transition: opacity var(--ark-duration-quick) var(--ark-ease-out);
89
98
  }
90
99
 
package/README.pt-BR.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![npm](https://img.shields.io/npm/v/@tooark/tokens?logo=npm&color=CB3837)](https://www.npmjs.com/package/@tooark/tokens)
4
4
  [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/Tooark/web-components/blob/main/LICENSE)
5
5
 
6
- Primitivas de design do design system Tooark: cores por intent, escala de tamanhos, raios e tokens de motion como custom properties CSS, um `@theme` do Tailwind v4 e tipos TypeScript.
6
+ Primitivas de design do design system Tooark: cores por intent e escala de tamanhos como um `@theme` do Tailwind v4, tokens de motion como custom properties CSS e tipos TypeScript.
7
7
 
8
8
  🌍 **Idiomas:** [![USA Flag](https://flagcdn.com/w20/us.png) English](./README.md) · ![Brazil Flag](https://flagcdn.com/w20/br.png) **Português (este arquivo)**
9
9
 
@@ -26,7 +26,7 @@ Primitivas de design do design system Tooark: cores por intent, escala de tamanh
26
26
 
27
27
  O pacote `@tooark/tokens` fornece:
28
28
 
29
- - `tokens.css`: um bloco `@theme static` com as cores semânticas (`primary`, `secondary`, `success`, `warning`, `danger`, `info`, `neutral`, mais `surface*`, `fg*`, `border*`) em `light-dark()`, a escala de tamanhos (`--size-xs…xl`), o degrau `--text-2xs` e os raios do Tailwind;
29
+ - `tokens.css`: um bloco `@theme static` com as cores semânticas (`primary`, `secondary`, `success`, `warning`, `danger`, `info`, `neutral`, mais `surface*`, `fg*`, `border*`, `muted`, `ring`) em `light-dark()`, a escala de tamanhos (`--size-xs…xl`) e o degrau `--text-2xs` (sem raios: a escala de `rounded` é a do próprio Tailwind, o `ArkRounded` só a tipa);
30
30
  - tokens de motion fora do `@theme`: `--ark-duration-*` (oito passos), `--ark-ease-*` (`linear`, `standard`, `in`, `out`, `in-out`, `overshoot`, `sheet`) e `--ark-motion-distance`, zerados sob `prefers-reduced-motion`;
31
31
  - espelhos JS dos tokens de motion (`ARK_DURATION_MS`, `ARK_EASING_CSS`, `ARK_MOTION_DISTANCE`) para fallback em WAAPI;
32
32
  - `resolveColorScheme(element)` e `observeColorScheme(element, onChange)` para resolver e acompanhar o tema da página;
@@ -46,9 +46,15 @@ Não é necessário diretamente quando você usa o `@tooark/web-components`: o `
46
46
 
47
47
  ## ⚙️ Configuração
48
48
 
49
- Importe a folha de estilo no seu CSS ou na entrada do Tailwind e declare o `color-scheme` da página (os tokens são `light-dark()`, então o tema é puro CSS):
49
+ O `tokens.css` é escrito para o compilador do Tailwind v4: as cores, os tamanhos e o `--text-2xs` ficam num bloco `@theme`, que o navegador descarta ao ler o arquivo como CSS puro (só os tokens de motion sobrevivem). Duas formas de obtê-los:
50
+
51
+ - pelas folhas de estilo do Tooark: o `@tooark/web-components/styles.css` (ou o `@tooark/core/styles.css`, sem os componentes) já os traz, compilados com o prefixo `ark` (`--ark-color-*`, `--ark-size-*`, `--ark-text-2xs`);
52
+ - na sua própria entrada do Tailwind v4: importe o `tokens.css` depois do Tailwind e eles viram as variáveis `--color-*`, `--size-*` e `--text-2xs` mais utilitários (`bg-primary`, `text-primary-fg`, `border-border`, `text-2xs`).
53
+
54
+ Nos dois casos, declare o `color-scheme` da página (as cores são `light-dark()`, então o tema é puro CSS). Numa entrada do Tailwind:
50
55
 
51
56
  ```css
57
+ @import "tailwindcss";
52
58
  @import "@tooark/tokens/tokens.css";
53
59
 
54
60
  :root {
@@ -62,9 +68,11 @@ Importe a folha de estilo no seu CSS ou na entrada do Tailwind e declare o `colo
62
68
 
63
69
  ### Custom properties CSS
64
70
 
65
- - Cores: `--ark-color-<intent>`, `-fg`, `-hover`, `-soft`, `-soft-fg`, `-border`, `-ring`; neutros `--ark-color-surface`, `-surface-muted`, `-fg`, `-fg-soft`, `-fg-muted`, `-border`, `-ring`.
71
+ Nomes como as folhas de estilo do Tooark os expõem; na sua própria entrada do Tailwind, os do `@theme` ficam sem o prefixo `ark-` (`--color-surface`, `--size-md`, `--text-2xs`).
72
+
73
+ - Cores: `--ark-color-<intent>`, `-fg`, `-hover`, `-soft`, `-soft-fg`, `-border`, `-ring`; neutros `--ark-color-surface`, `-surface-muted`, `-surface-strong`, `-surface-raised`, `-fg`, `-fg-soft`, `-fg-muted`, `-fg-faint`, `-fg-placeholder`, `-border`, `-border-strong`, `-muted`, `-ring`.
66
74
  - Tamanhos: `--ark-size-xs…xl` (1,5 / 1,75 / 2,25 / 2,75 / 3,25 rem, a altura mínima dos controles); `--ark-text-2xs` (0,6875 rem) para micro-rótulos.
67
- - Motion: `--ark-duration-none|instant|quick|default|moderate|gentle|slow|long`, `--ark-ease-*`, `--ark-motion-distance`.
75
+ - Motion (custom properties puras, fora do `@theme`: o mesmo nome em qualquer lugar, inclusive com o `tokens.css` como CSS puro): `--ark-duration-none|instant|quick|default|moderate|gentle|slow|long`, `--ark-ease-*`, `--ark-motion-distance`.
68
76
 
69
77
  ### JavaScript
70
78
 
@@ -80,11 +88,12 @@ Importe a folha de estilo no seu CSS ou na entrada do Tailwind e declare o `colo
80
88
  ### Estilizando um componente seu com os tokens
81
89
 
82
90
  ```css
91
+ /* com o @tooark/web-components/styles.css (ou o @tooark/core/styles.css) na página */
83
92
  .card {
84
93
  background: var(--ark-color-surface);
85
94
  color: var(--ark-color-fg);
86
95
  border: 1px solid var(--ark-color-border);
87
- border-radius: var(--ark-radius-lg);
96
+ border-radius: 0.5rem;
88
97
  transition: opacity var(--ark-duration-quick) var(--ark-ease-out);
89
98
  }
90
99
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tooark/tokens",
3
- "version": "1.0.1",
4
- "description": "Tooark Tokens — design primitives (colors by intent, sizes, radii, motion) as CSS tokens and TypeScript types",
3
+ "version": "1.1.0",
4
+ "description": "Tooark Tokens — design primitives (colors by intent, sizes, motion) as CSS tokens and TypeScript types",
5
5
  "keywords": [
6
6
  "tooark",
7
7
  "web-components",