@krizaka/tokens 0.0.0-stage → 1.3.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/LICENSE +202 -0
- package/README.md +133 -2
- package/dist/index.d.ts +48 -0
- package/dist/index.js +121 -0
- package/dist/native.d.ts +49 -0
- package/dist/native.js +75 -0
- package/dist/tokens.css +89 -0
- package/package.json +91 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,134 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @krizaka/tokens
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**The Krizaka semantic design tokens.** One vocabulary, `--kz-*`, written once in [DTCG](https://www.designtokens.org/)
|
|
4
|
+
JSON and compiled to CSS (dark, light, media invariants), typed constants and React Native themes. It is the vocabulary
|
|
5
|
+
krizaka.com already runs on (1 974 usages, zero raw palette colour), now shared by every product.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@krizaka/tokens)
|
|
8
|
+
[](../../LICENSE)
|
|
9
|
+
|
|
10
|
+
## The rule
|
|
11
|
+
|
|
12
|
+
> **A component never reads a palette colour, only a role.**
|
|
13
|
+
> `bg-zinc-950/70 light:bg-white` → `var(--kz-surface-1)`; `text-zinc-400 light:text-slate-500` →
|
|
14
|
+
> `var(--kz-text-secondary)`; `bg-black/60 text-white` on an image → `var(--kz-scrim)` + `var(--kz-text-on-media)`.
|
|
15
|
+
|
|
16
|
+
A theme is a set of **values**, never a set of classes. A component is written once against the roles below; dark,
|
|
17
|
+
light and a product theme (an override of `--kz-accent`, `--kz-font-display`…) only change the values. No `light:`
|
|
18
|
+
variant, no `dark:` variant, no `zinc-*` / `slate-*` / `#hex` in a component.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @krizaka/tokens
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
| Entry | For | Gives |
|
|
27
|
+
| :-- | :-- | :-- |
|
|
28
|
+
| `@krizaka/tokens/tokens.css` | Web (imported once, usually through `@krizaka/tailwind`) | The `--kz-*` custom properties. |
|
|
29
|
+
| `@krizaka/tokens` | TS / JS on the web (canvas, charts, e-mails, inline styles) | `tokens` (`var(--kz-…)` references, camelCase keys), `values.dark` / `values.light` (raw CSS, aliases resolved), `TokenName`. |
|
|
30
|
+
| `@krizaka/tokens/native` | React Native / Expo | `themes.dark` / `themes.light` (hex, `rgba()` when translucent), `radius` (dp), `typography`, `motion.ease`, type `Theme`. |
|
|
31
|
+
|
|
32
|
+
```css
|
|
33
|
+
@import "@krizaka/tokens/tokens.css";
|
|
34
|
+
|
|
35
|
+
.card { background: var(--kz-surface-1); border: 1px solid var(--kz-border-default); border-radius: var(--kz-radius-lg); }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { tokens, values } from "@krizaka/tokens";
|
|
40
|
+
element.style.color = tokens.textSecondary; // "var(--kz-text-secondary)" — follows the theme
|
|
41
|
+
chart.gridColor = values.dark.borderSubtle; // "hsl(0 0% 100% / 0.06)"
|
|
42
|
+
|
|
43
|
+
import { themes, radius, type Theme } from "@krizaka/tokens/native";
|
|
44
|
+
const t: Theme = scheme === "light" ? themes.light : themes.dark;
|
|
45
|
+
<View style={{ backgroundColor: t.surface1, borderRadius: radius.lg }} />;
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Themes
|
|
49
|
+
|
|
50
|
+
| Selector | Gets |
|
|
51
|
+
| :-- | :-- |
|
|
52
|
+
| `:root`, `.theme-dark` | Dark — the default. `.theme-dark` re-declares the dark values, so a player, an editor or a media stays dark inside a light page without one `light:` class in its subtree. |
|
|
53
|
+
| `html.light` | Light. Toggle the `light` class on `<html>`. |
|
|
54
|
+
| `:root` (invariants) | Identical in both themes: what sits **on** a media (scrims, text on media, dialog overlay), statuses, `on-accent`, radii, easing, font stacks. |
|
|
55
|
+
|
|
56
|
+
`color-scheme` follows the theme, so scrollbars and native controls match.
|
|
57
|
+
|
|
58
|
+
## Roles
|
|
59
|
+
|
|
60
|
+
Values are the CSS written in `dist/tokens.css`; `→` marks an alias, which follows its target in every theme and
|
|
61
|
+
under every product override.
|
|
62
|
+
|
|
63
|
+
### Colour
|
|
64
|
+
|
|
65
|
+
| Token | Key | Usage | Dark | Light |
|
|
66
|
+
| :-- | :-- | :-- | :-- | :-- |
|
|
67
|
+
| `--kz-surface-0` | `surface0` | Page background | `hsl(240 6% 5%)` | `hsl(0 0% 98%)` |
|
|
68
|
+
| `--kz-surface-1` | `surface1` | Card, panel | `hsl(240 5% 9%)` | `hsl(0 0% 100%)` |
|
|
69
|
+
| `--kz-surface-2` | `surface2` | Raised element, field, hover | `hsl(240 5% 13%)` | `hsl(240 6% 95%)` |
|
|
70
|
+
| `--kz-surface-3` | `surface3` | Active element, chip, track | `hsl(240 4% 17%)` | `hsl(240 5% 90%)` |
|
|
71
|
+
| `--kz-media` | `media` | A media's background before it loads | `hsl(240 5% 11%)` | `hsl(240 6% 92%)` |
|
|
72
|
+
| `--kz-border-subtle` | `borderSubtle` | Quiet separator | `hsl(0 0% 100% / 0.06)` | `hsl(240 6% 0% / 0.06)` |
|
|
73
|
+
| `--kz-border-default` | `borderDefault` | Card and field outline | `hsl(0 0% 100% / 0.10)` | `hsl(240 6% 0% / 0.10)` |
|
|
74
|
+
| `--kz-border-strong` | `borderStrong` | Hover outline, non-keyboard focus | `hsl(0 0% 100% / 0.16)` | `hsl(240 6% 0% / 0.16)` |
|
|
75
|
+
| `--kz-text-primary` | `textPrimary` | Headings, body text (≥ 4.5:1 on every surface) | `hsl(0 0% 96%)` | `hsl(240 6% 10%)` |
|
|
76
|
+
| `--kz-text-secondary` | `textSecondary` | Supporting text, labels (≥ 4.5:1 on every surface) | `hsl(240 4% 64%)` | `hsl(240 4% 41%)` |
|
|
77
|
+
| `--kz-text-muted` | `textMuted` | Metadata, placeholders, disabled (≥ 3:1 on every surface) | `hsl(240 4% 47%)` | `hsl(240 4% 52%)` |
|
|
78
|
+
| `--kz-text-on-media` | `textOnMedia` | Text on an image or a video | `hsl(0 0% 100%)` | = dark |
|
|
79
|
+
| `--kz-accent` | `accent` | Primary action, link, selection — the product's identity | `hsl(217 92% 53%)` | `hsl(217 92% 50%)` |
|
|
80
|
+
| `--kz-accent-hover` | `accentHover` | Accent on hover | `hsl(217 88% 45%)` | `hsl(217 88% 42%)` |
|
|
81
|
+
| `--kz-accent-soft` | `accentSoft` | Tinted background (selection, badge) | `hsl(217 92% 53% / 0.10)` | `hsl(217 92% 50% / 0.08)` |
|
|
82
|
+
| `--kz-accent-2` | `accent2` | Second accent (gradients) | → `accent` | → `accent` |
|
|
83
|
+
| `--kz-on-accent` | `onAccent` | Text and icon on the accent (≥ 4.5:1) | `hsl(0 0% 100%)` | = dark |
|
|
84
|
+
| `--kz-ring` | `ring` | Keyboard focus ring | → `accent` | → `accent` |
|
|
85
|
+
| `--kz-success` | `success` | Status: success | `hsl(160 84% 39%)` | = dark |
|
|
86
|
+
| `--kz-warning` | `warning` | Status: warning | `hsl(38 92% 50%)` | = dark |
|
|
87
|
+
| `--kz-danger` | `danger` | Status: error, destructive action | `hsl(0 84% 60%)` | = dark |
|
|
88
|
+
| `--kz-info` | `info` | Status: information | → `accent` | → `accent` |
|
|
89
|
+
| `--kz-scrim` | `scrim` | Veil behind a badge or a caption on an image | `hsl(0 0% 0% / 0.60)` | = dark |
|
|
90
|
+
| `--kz-scrim-strong` | `scrimStrong` | Stronger veil (long text on an image) | `hsl(0 0% 0% / 0.80)` | = dark |
|
|
91
|
+
| `--kz-overlay` | `overlay` | Dialog backdrop | `hsl(0 0% 0% / 0.70)` | = dark |
|
|
92
|
+
|
|
93
|
+
### Shape, depth, motion, type
|
|
94
|
+
|
|
95
|
+
| Token | Key | Usage | Dark | Light |
|
|
96
|
+
| :-- | :-- | :-- | :-- | :-- |
|
|
97
|
+
| `--kz-radius-sm` | `radiusSm` | Field, chip | `8px` | = dark |
|
|
98
|
+
| `--kz-radius-md` | `radiusMd` | Button, menu | `12px` | = dark |
|
|
99
|
+
| `--kz-radius-lg` | `radiusLg` | Card | `16px` | = dark |
|
|
100
|
+
| `--kz-radius-xl` | `radiusXl` | Dialog, sheet | `20px` | = dark |
|
|
101
|
+
| `--kz-radius-full` | `radiusFull` | Pill, avatar | `9999px` | = dark |
|
|
102
|
+
| `--kz-shadow-sm` | `shadowSm` | Field, button at rest (web only) | `0 1px 3px hsl(0 0% 0% / 0.12), 0 1px 2px hsl(0 0% 0% / 0.06)` | `0 1px 3px hsl(240 6% 0% / 0.06), 0 1px 2px hsl(240 6% 0% / 0.04)` |
|
|
103
|
+
| `--kz-shadow-md` | `shadowMd` | Menu, popover, card on hover (web only) | `0 4px 12px hsl(0 0% 0% / 0.15), 0 2px 4px hsl(0 0% 0% / 0.08)` | `0 4px 12px hsl(240 6% 0% / 0.08), 0 2px 4px hsl(240 6% 0% / 0.04)` |
|
|
104
|
+
| `--kz-shadow-lg` | `shadowLg` | Dialog, sheet (web only) | `0 8px 24px hsl(0 0% 0% / 0.18), 0 4px 8px hsl(0 0% 0% / 0.08)` | `0 8px 24px hsl(240 6% 0% / 0.10), 0 4px 8px hsl(240 6% 0% / 0.05)` |
|
|
105
|
+
| `--kz-ease` | `ease` | Default curve of the motion signature | `cubic-bezier(0.16, 1, 0.3, 1)` | = dark |
|
|
106
|
+
| `--kz-font-sans` | `fontSans` | Interface and running text | `Inter, system-ui, sans-serif` | = dark |
|
|
107
|
+
| `--kz-font-display` | `fontDisplay` | Headings; a product theme may override it | → `font-sans` | → `font-sans` |
|
|
108
|
+
| `--kz-font-mono` | `fontMono` | Code, aligned amounts | `"JetBrains Mono", ui-monospace, monospace` | = dark |
|
|
109
|
+
|
|
110
|
+
Contrast is **tested**, not assumed: `pnpm turbo run check` fails if `text-primary` / `text-secondary` drop under 4.5:1 or
|
|
111
|
+
`text-muted` under 3:1 on any surface, or `on-accent` under 4.5:1 on the accent, in either theme (WCAG 2.x).
|
|
112
|
+
One trade-off is known: no blue can carry white text at 4.5:1 *and* be read at 4.5:1 as text on `surface-0`. The
|
|
113
|
+
accent favours white text on it; for body-size links on dark, pair the accent with an underline or use it at
|
|
114
|
+
≥ 18.66px bold (3:1).
|
|
115
|
+
|
|
116
|
+
## Add or change a token
|
|
117
|
+
|
|
118
|
+
1. **Source** — edit `src/tokens/<category>.tokens.json` (DTCG: `$type`, `$value`, `$description`).
|
|
119
|
+
- `$value` is the **dark** value (the default); the **light** value goes in
|
|
120
|
+
`"$extensions": { "com.krizaka": { "light": … } }`. No extension = the same value in both themes.
|
|
121
|
+
- An alias is `"{group.token}"` (`"{accent.$root}"` for a group's own token); it compiles to `var(--kz-…)` and
|
|
122
|
+
may not carry a light value — it follows its target.
|
|
123
|
+
- The CSS name is the path joined with `-` (`text.on-media` → `--kz-text-on-media`), the JS key its camelCase
|
|
124
|
+
(`textOnMedia`). Colours are `hsl()`; radii are `px` (the native output converts them to dp).
|
|
125
|
+
2. **Build** — `pnpm --filter @krizaka/tokens build` writes `dist/` (never edit `dist/`), then
|
|
126
|
+
`pnpm --filter @krizaka/tokens test`: update the `tokens.css` snapshot only when the change is intended
|
|
127
|
+
(`vitest run -u`), and keep the contrast tests green.
|
|
128
|
+
3. **Changeset** — `pnpm changeset`: a new token is a **minor**, a changed value at least a **minor** (it changes
|
|
129
|
+
every product), a removed or renamed token a **major**. `@krizaka/tokens` and `@krizaka/ui` are released together
|
|
130
|
+
(`fixed` group).
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
[Apache-2.0](LICENSE)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// @krizaka/tokens — GÉNÉRÉ depuis src/tokens/*.tokens.json par scripts/build.mjs : ne pas éditer.
|
|
2
|
+
|
|
3
|
+
/** Every token as a CSS reference, `var(--kz-…)`: follows the active theme. */
|
|
4
|
+
export declare const tokens: {
|
|
5
|
+
readonly surface0: "var(--kz-surface-0)";
|
|
6
|
+
readonly surface1: "var(--kz-surface-1)";
|
|
7
|
+
readonly surface2: "var(--kz-surface-2)";
|
|
8
|
+
readonly surface3: "var(--kz-surface-3)";
|
|
9
|
+
readonly media: "var(--kz-media)";
|
|
10
|
+
readonly borderSubtle: "var(--kz-border-subtle)";
|
|
11
|
+
readonly borderDefault: "var(--kz-border-default)";
|
|
12
|
+
readonly borderStrong: "var(--kz-border-strong)";
|
|
13
|
+
readonly textPrimary: "var(--kz-text-primary)";
|
|
14
|
+
readonly textSecondary: "var(--kz-text-secondary)";
|
|
15
|
+
readonly textMuted: "var(--kz-text-muted)";
|
|
16
|
+
readonly textOnMedia: "var(--kz-text-on-media)";
|
|
17
|
+
readonly accent: "var(--kz-accent)";
|
|
18
|
+
readonly accentHover: "var(--kz-accent-hover)";
|
|
19
|
+
readonly accentSoft: "var(--kz-accent-soft)";
|
|
20
|
+
readonly accent2: "var(--kz-accent-2)";
|
|
21
|
+
readonly onAccent: "var(--kz-on-accent)";
|
|
22
|
+
readonly ring: "var(--kz-ring)";
|
|
23
|
+
readonly success: "var(--kz-success)";
|
|
24
|
+
readonly warning: "var(--kz-warning)";
|
|
25
|
+
readonly danger: "var(--kz-danger)";
|
|
26
|
+
readonly info: "var(--kz-info)";
|
|
27
|
+
readonly scrim: "var(--kz-scrim)";
|
|
28
|
+
readonly scrimStrong: "var(--kz-scrim-strong)";
|
|
29
|
+
readonly overlay: "var(--kz-overlay)";
|
|
30
|
+
readonly radiusSm: "var(--kz-radius-sm)";
|
|
31
|
+
readonly radiusMd: "var(--kz-radius-md)";
|
|
32
|
+
readonly radiusLg: "var(--kz-radius-lg)";
|
|
33
|
+
readonly radiusXl: "var(--kz-radius-xl)";
|
|
34
|
+
readonly radiusFull: "var(--kz-radius-full)";
|
|
35
|
+
readonly shadowSm: "var(--kz-shadow-sm)";
|
|
36
|
+
readonly shadowMd: "var(--kz-shadow-md)";
|
|
37
|
+
readonly shadowLg: "var(--kz-shadow-lg)";
|
|
38
|
+
readonly ease: "var(--kz-ease)";
|
|
39
|
+
readonly fontSans: "var(--kz-font-sans)";
|
|
40
|
+
readonly fontDisplay: "var(--kz-font-display)";
|
|
41
|
+
readonly fontMono: "var(--kz-font-mono)";
|
|
42
|
+
};
|
|
43
|
+
/** A token's camelCase name. */
|
|
44
|
+
export type TokenName = keyof typeof tokens;
|
|
45
|
+
/** Raw CSS values of one theme. */
|
|
46
|
+
export type TokenValues = { readonly [K in TokenName]: string };
|
|
47
|
+
/** The raw CSS values per theme (aliases resolved), for canvas, charts and e-mails. */
|
|
48
|
+
export declare const values: { readonly dark: TokenValues; readonly light: TokenValues };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// @krizaka/tokens — GÉNÉRÉ depuis src/tokens/*.tokens.json par scripts/build.mjs : ne pas éditer.
|
|
2
|
+
|
|
3
|
+
/** Every token as a CSS reference, `var(--kz-…)`: follows the active theme. */
|
|
4
|
+
export const tokens = Object.freeze({
|
|
5
|
+
"surface0": "var(--kz-surface-0)",
|
|
6
|
+
"surface1": "var(--kz-surface-1)",
|
|
7
|
+
"surface2": "var(--kz-surface-2)",
|
|
8
|
+
"surface3": "var(--kz-surface-3)",
|
|
9
|
+
"media": "var(--kz-media)",
|
|
10
|
+
"borderSubtle": "var(--kz-border-subtle)",
|
|
11
|
+
"borderDefault": "var(--kz-border-default)",
|
|
12
|
+
"borderStrong": "var(--kz-border-strong)",
|
|
13
|
+
"textPrimary": "var(--kz-text-primary)",
|
|
14
|
+
"textSecondary": "var(--kz-text-secondary)",
|
|
15
|
+
"textMuted": "var(--kz-text-muted)",
|
|
16
|
+
"textOnMedia": "var(--kz-text-on-media)",
|
|
17
|
+
"accent": "var(--kz-accent)",
|
|
18
|
+
"accentHover": "var(--kz-accent-hover)",
|
|
19
|
+
"accentSoft": "var(--kz-accent-soft)",
|
|
20
|
+
"accent2": "var(--kz-accent-2)",
|
|
21
|
+
"onAccent": "var(--kz-on-accent)",
|
|
22
|
+
"ring": "var(--kz-ring)",
|
|
23
|
+
"success": "var(--kz-success)",
|
|
24
|
+
"warning": "var(--kz-warning)",
|
|
25
|
+
"danger": "var(--kz-danger)",
|
|
26
|
+
"info": "var(--kz-info)",
|
|
27
|
+
"scrim": "var(--kz-scrim)",
|
|
28
|
+
"scrimStrong": "var(--kz-scrim-strong)",
|
|
29
|
+
"overlay": "var(--kz-overlay)",
|
|
30
|
+
"radiusSm": "var(--kz-radius-sm)",
|
|
31
|
+
"radiusMd": "var(--kz-radius-md)",
|
|
32
|
+
"radiusLg": "var(--kz-radius-lg)",
|
|
33
|
+
"radiusXl": "var(--kz-radius-xl)",
|
|
34
|
+
"radiusFull": "var(--kz-radius-full)",
|
|
35
|
+
"shadowSm": "var(--kz-shadow-sm)",
|
|
36
|
+
"shadowMd": "var(--kz-shadow-md)",
|
|
37
|
+
"shadowLg": "var(--kz-shadow-lg)",
|
|
38
|
+
"ease": "var(--kz-ease)",
|
|
39
|
+
"fontSans": "var(--kz-font-sans)",
|
|
40
|
+
"fontDisplay": "var(--kz-font-display)",
|
|
41
|
+
"fontMono": "var(--kz-font-mono)"
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/** The raw CSS values per theme (aliases resolved), for canvas, charts and e-mails. */
|
|
45
|
+
export const values = Object.freeze({ dark: Object.freeze({
|
|
46
|
+
"surface0": "hsl(240 6% 5%)",
|
|
47
|
+
"surface1": "hsl(240 5% 9%)",
|
|
48
|
+
"surface2": "hsl(240 5% 13%)",
|
|
49
|
+
"surface3": "hsl(240 4% 17%)",
|
|
50
|
+
"media": "hsl(240 5% 11%)",
|
|
51
|
+
"borderSubtle": "hsl(0 0% 100% / 0.06)",
|
|
52
|
+
"borderDefault": "hsl(0 0% 100% / 0.10)",
|
|
53
|
+
"borderStrong": "hsl(0 0% 100% / 0.16)",
|
|
54
|
+
"textPrimary": "hsl(0 0% 96%)",
|
|
55
|
+
"textSecondary": "hsl(240 4% 64%)",
|
|
56
|
+
"textMuted": "hsl(240 4% 47%)",
|
|
57
|
+
"textOnMedia": "hsl(0 0% 100%)",
|
|
58
|
+
"accent": "hsl(217 92% 53%)",
|
|
59
|
+
"accentHover": "hsl(217 88% 45%)",
|
|
60
|
+
"accentSoft": "hsl(217 92% 53% / 0.10)",
|
|
61
|
+
"accent2": "hsl(217 92% 53%)",
|
|
62
|
+
"onAccent": "hsl(0 0% 100%)",
|
|
63
|
+
"ring": "hsl(217 92% 53%)",
|
|
64
|
+
"success": "hsl(160 84% 39%)",
|
|
65
|
+
"warning": "hsl(38 92% 50%)",
|
|
66
|
+
"danger": "hsl(0 84% 60%)",
|
|
67
|
+
"info": "hsl(217 92% 53%)",
|
|
68
|
+
"scrim": "hsl(0 0% 0% / 0.60)",
|
|
69
|
+
"scrimStrong": "hsl(0 0% 0% / 0.80)",
|
|
70
|
+
"overlay": "hsl(0 0% 0% / 0.70)",
|
|
71
|
+
"radiusSm": "8px",
|
|
72
|
+
"radiusMd": "12px",
|
|
73
|
+
"radiusLg": "16px",
|
|
74
|
+
"radiusXl": "20px",
|
|
75
|
+
"radiusFull": "9999px",
|
|
76
|
+
"shadowSm": "0 1px 3px hsl(0 0% 0% / 0.12), 0 1px 2px hsl(0 0% 0% / 0.06)",
|
|
77
|
+
"shadowMd": "0 4px 12px hsl(0 0% 0% / 0.15), 0 2px 4px hsl(0 0% 0% / 0.08)",
|
|
78
|
+
"shadowLg": "0 8px 24px hsl(0 0% 0% / 0.18), 0 4px 8px hsl(0 0% 0% / 0.08)",
|
|
79
|
+
"ease": "cubic-bezier(0.16, 1, 0.3, 1)",
|
|
80
|
+
"fontSans": "Inter, system-ui, sans-serif",
|
|
81
|
+
"fontDisplay": "Inter, system-ui, sans-serif",
|
|
82
|
+
"fontMono": "\"JetBrains Mono\", ui-monospace, monospace"
|
|
83
|
+
}), light: Object.freeze({
|
|
84
|
+
"surface0": "hsl(0 0% 98%)",
|
|
85
|
+
"surface1": "hsl(0 0% 100%)",
|
|
86
|
+
"surface2": "hsl(240 6% 95%)",
|
|
87
|
+
"surface3": "hsl(240 5% 90%)",
|
|
88
|
+
"media": "hsl(240 6% 92%)",
|
|
89
|
+
"borderSubtle": "hsl(240 6% 0% / 0.06)",
|
|
90
|
+
"borderDefault": "hsl(240 6% 0% / 0.10)",
|
|
91
|
+
"borderStrong": "hsl(240 6% 0% / 0.16)",
|
|
92
|
+
"textPrimary": "hsl(240 6% 10%)",
|
|
93
|
+
"textSecondary": "hsl(240 4% 41%)",
|
|
94
|
+
"textMuted": "hsl(240 4% 52%)",
|
|
95
|
+
"textOnMedia": "hsl(0 0% 100%)",
|
|
96
|
+
"accent": "hsl(217 92% 50%)",
|
|
97
|
+
"accentHover": "hsl(217 88% 42%)",
|
|
98
|
+
"accentSoft": "hsl(217 92% 50% / 0.08)",
|
|
99
|
+
"accent2": "hsl(217 92% 50%)",
|
|
100
|
+
"onAccent": "hsl(0 0% 100%)",
|
|
101
|
+
"ring": "hsl(217 92% 50%)",
|
|
102
|
+
"success": "hsl(160 84% 39%)",
|
|
103
|
+
"warning": "hsl(38 92% 50%)",
|
|
104
|
+
"danger": "hsl(0 84% 60%)",
|
|
105
|
+
"info": "hsl(217 92% 50%)",
|
|
106
|
+
"scrim": "hsl(0 0% 0% / 0.60)",
|
|
107
|
+
"scrimStrong": "hsl(0 0% 0% / 0.80)",
|
|
108
|
+
"overlay": "hsl(0 0% 0% / 0.70)",
|
|
109
|
+
"radiusSm": "8px",
|
|
110
|
+
"radiusMd": "12px",
|
|
111
|
+
"radiusLg": "16px",
|
|
112
|
+
"radiusXl": "20px",
|
|
113
|
+
"radiusFull": "9999px",
|
|
114
|
+
"shadowSm": "0 1px 3px hsl(240 6% 0% / 0.06), 0 1px 2px hsl(240 6% 0% / 0.04)",
|
|
115
|
+
"shadowMd": "0 4px 12px hsl(240 6% 0% / 0.08), 0 2px 4px hsl(240 6% 0% / 0.04)",
|
|
116
|
+
"shadowLg": "0 8px 24px hsl(240 6% 0% / 0.10), 0 4px 8px hsl(240 6% 0% / 0.05)",
|
|
117
|
+
"ease": "cubic-bezier(0.16, 1, 0.3, 1)",
|
|
118
|
+
"fontSans": "Inter, system-ui, sans-serif",
|
|
119
|
+
"fontDisplay": "Inter, system-ui, sans-serif",
|
|
120
|
+
"fontMono": "\"JetBrains Mono\", ui-monospace, monospace"
|
|
121
|
+
}) });
|
package/dist/native.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// @krizaka/tokens — GÉNÉRÉ depuis src/tokens/*.tokens.json par scripts/build.mjs : ne pas éditer.
|
|
2
|
+
|
|
3
|
+
/** The colour roles of one theme. */
|
|
4
|
+
export type Theme = {
|
|
5
|
+
readonly surface0: string;
|
|
6
|
+
readonly surface1: string;
|
|
7
|
+
readonly surface2: string;
|
|
8
|
+
readonly surface3: string;
|
|
9
|
+
readonly media: string;
|
|
10
|
+
readonly borderSubtle: string;
|
|
11
|
+
readonly borderDefault: string;
|
|
12
|
+
readonly borderStrong: string;
|
|
13
|
+
readonly textPrimary: string;
|
|
14
|
+
readonly textSecondary: string;
|
|
15
|
+
readonly textMuted: string;
|
|
16
|
+
readonly textOnMedia: string;
|
|
17
|
+
readonly accent: string;
|
|
18
|
+
readonly accentHover: string;
|
|
19
|
+
readonly accentSoft: string;
|
|
20
|
+
readonly accent2: string;
|
|
21
|
+
readonly onAccent: string;
|
|
22
|
+
readonly ring: string;
|
|
23
|
+
readonly success: string;
|
|
24
|
+
readonly warning: string;
|
|
25
|
+
readonly danger: string;
|
|
26
|
+
readonly info: string;
|
|
27
|
+
readonly scrim: string;
|
|
28
|
+
readonly scrimStrong: string;
|
|
29
|
+
readonly overlay: string;
|
|
30
|
+
};
|
|
31
|
+
export type ThemeName = "dark" | "light";
|
|
32
|
+
/** Colour roles per theme, resolved for React Native (`#rrggbb`, `rgba()` when translucent). */
|
|
33
|
+
export declare const themes: { readonly dark: Theme; readonly light: Theme };
|
|
34
|
+
/** Corner radii, in dp. */
|
|
35
|
+
export declare const radius: {
|
|
36
|
+
readonly sm: 8;
|
|
37
|
+
readonly md: 12;
|
|
38
|
+
readonly lg: 16;
|
|
39
|
+
readonly xl: 20;
|
|
40
|
+
readonly full: 9999;
|
|
41
|
+
};
|
|
42
|
+
/** Font families: the first family of each web stack (React Native takes a single name). */
|
|
43
|
+
export declare const typography: {
|
|
44
|
+
readonly sans: "Inter";
|
|
45
|
+
readonly display: "Inter";
|
|
46
|
+
readonly mono: "JetBrains Mono";
|
|
47
|
+
};
|
|
48
|
+
/** Motion: the cubic-bezier control points (`Easing.bezier(...motion.ease)`). */
|
|
49
|
+
export declare const motion: { readonly ease: readonly [number, number, number, number] };
|
package/dist/native.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// @krizaka/tokens — GÉNÉRÉ depuis src/tokens/*.tokens.json par scripts/build.mjs : ne pas éditer.
|
|
2
|
+
|
|
3
|
+
/** Colour roles per theme, resolved for React Native (`#rrggbb`, `rgba()` when translucent). */
|
|
4
|
+
export const themes = Object.freeze({ dark: Object.freeze({
|
|
5
|
+
"surface0": "#0c0c0e",
|
|
6
|
+
"surface1": "#161618",
|
|
7
|
+
"surface2": "#1f1f23",
|
|
8
|
+
"surface3": "#2a2a2d",
|
|
9
|
+
"media": "#1b1b1d",
|
|
10
|
+
"borderSubtle": "rgba(255,255,255,0.06)",
|
|
11
|
+
"borderDefault": "rgba(255,255,255,0.1)",
|
|
12
|
+
"borderStrong": "rgba(255,255,255,0.16)",
|
|
13
|
+
"textPrimary": "#f5f5f5",
|
|
14
|
+
"textSecondary": "#a0a0a7",
|
|
15
|
+
"textMuted": "#73737d",
|
|
16
|
+
"textOnMedia": "#ffffff",
|
|
17
|
+
"accent": "#196df5",
|
|
18
|
+
"accentHover": "#0e5bd8",
|
|
19
|
+
"accentSoft": "rgba(25,109,245,0.1)",
|
|
20
|
+
"accent2": "#196df5",
|
|
21
|
+
"onAccent": "#ffffff",
|
|
22
|
+
"ring": "#196df5",
|
|
23
|
+
"success": "#10b77f",
|
|
24
|
+
"warning": "#f59f0a",
|
|
25
|
+
"danger": "#ef4343",
|
|
26
|
+
"info": "#196df5",
|
|
27
|
+
"scrim": "rgba(0,0,0,0.6)",
|
|
28
|
+
"scrimStrong": "rgba(0,0,0,0.8)",
|
|
29
|
+
"overlay": "rgba(0,0,0,0.7)"
|
|
30
|
+
}), light: Object.freeze({
|
|
31
|
+
"surface0": "#fafafa",
|
|
32
|
+
"surface1": "#ffffff",
|
|
33
|
+
"surface2": "#f1f1f3",
|
|
34
|
+
"surface3": "#e4e4e7",
|
|
35
|
+
"media": "#e9e9ec",
|
|
36
|
+
"borderSubtle": "rgba(0,0,0,0.06)",
|
|
37
|
+
"borderDefault": "rgba(0,0,0,0.1)",
|
|
38
|
+
"borderStrong": "rgba(0,0,0,0.16)",
|
|
39
|
+
"textPrimary": "#18181b",
|
|
40
|
+
"textSecondary": "#64646d",
|
|
41
|
+
"textMuted": "#808089",
|
|
42
|
+
"textOnMedia": "#ffffff",
|
|
43
|
+
"accent": "#0a64f5",
|
|
44
|
+
"accentHover": "#0d55c9",
|
|
45
|
+
"accentSoft": "rgba(10,100,245,0.08)",
|
|
46
|
+
"accent2": "#0a64f5",
|
|
47
|
+
"onAccent": "#ffffff",
|
|
48
|
+
"ring": "#0a64f5",
|
|
49
|
+
"success": "#10b77f",
|
|
50
|
+
"warning": "#f59f0a",
|
|
51
|
+
"danger": "#ef4343",
|
|
52
|
+
"info": "#0a64f5",
|
|
53
|
+
"scrim": "rgba(0,0,0,0.6)",
|
|
54
|
+
"scrimStrong": "rgba(0,0,0,0.8)",
|
|
55
|
+
"overlay": "rgba(0,0,0,0.7)"
|
|
56
|
+
}) });
|
|
57
|
+
|
|
58
|
+
/** Corner radii, in dp. */
|
|
59
|
+
export const radius = Object.freeze({
|
|
60
|
+
"sm": 8,
|
|
61
|
+
"md": 12,
|
|
62
|
+
"lg": 16,
|
|
63
|
+
"xl": 20,
|
|
64
|
+
"full": 9999
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
/** Font families: the first family of each web stack (React Native takes a single name). */
|
|
68
|
+
export const typography = Object.freeze({
|
|
69
|
+
"sans": "Inter",
|
|
70
|
+
"display": "Inter",
|
|
71
|
+
"mono": "JetBrains Mono"
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
/** Motion: the cubic-bezier control points (`Easing.bezier(...motion.ease)`). */
|
|
75
|
+
export const motion = Object.freeze({ ease: Object.freeze([0.16,1,0.3,1]) });
|
package/dist/tokens.css
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* @krizaka/tokens — GÉNÉRÉ depuis src/tokens/*.tokens.json par scripts/build.mjs : ne pas éditer. */
|
|
2
|
+
|
|
3
|
+
/* Dark : la valeur par défaut. `.theme-dark` reprend exactement les mêmes valeurs : un lecteur, un éditeur ou un
|
|
4
|
+
média reste sombre dans les deux thèmes sans une seule classe `light:` dans son sous-arbre. */
|
|
5
|
+
:root, .theme-dark {
|
|
6
|
+
color-scheme: dark;
|
|
7
|
+
|
|
8
|
+
/* Surfaces (hiérarchie de profondeur) */
|
|
9
|
+
--kz-surface-0: hsl(240 6% 5%); /* Fond de page */
|
|
10
|
+
--kz-surface-1: hsl(240 5% 9%); /* Carte, panneau */
|
|
11
|
+
--kz-surface-2: hsl(240 5% 13%); /* Élément surélevé, champ, survol */
|
|
12
|
+
--kz-surface-3: hsl(240 4% 17%); /* Élément actif, puce, piste */
|
|
13
|
+
--kz-media: hsl(240 5% 11%); /* fond d'un média avant chargement */
|
|
14
|
+
|
|
15
|
+
/* Bordures */
|
|
16
|
+
--kz-border-subtle: hsl(0 0% 100% / 0.06); /* Séparateur discret */
|
|
17
|
+
--kz-border-default: hsl(0 0% 100% / 0.10); /* Contour de carte, de champ */
|
|
18
|
+
--kz-border-strong: hsl(0 0% 100% / 0.16); /* Contour au survol, focus non clavier */
|
|
19
|
+
|
|
20
|
+
/* Texte */
|
|
21
|
+
--kz-text-primary: hsl(0 0% 96%); /* Titres, corps de texte */
|
|
22
|
+
--kz-text-secondary: hsl(240 4% 64%); /* Texte d'appui, libellés */
|
|
23
|
+
--kz-text-muted: hsl(240 4% 47%); /* Métadonnées, placeholders, désactivé (≥ 3:1) */
|
|
24
|
+
|
|
25
|
+
/* Accent : l'identité du produit. Surchargé par le thème produit, jamais par un composant. */
|
|
26
|
+
--kz-accent: hsl(217 92% 53%); /* Action principale, lien, sélection */
|
|
27
|
+
--kz-accent-hover: hsl(217 88% 45%); /* Accent au survol */
|
|
28
|
+
--kz-accent-soft: hsl(217 92% 53% / 0.10); /* Fond teinté (sélection, badge) */
|
|
29
|
+
--kz-accent-2: var(--kz-accent); /* 2e accent (dégradés) ; égal à l'accent par défaut */
|
|
30
|
+
--kz-ring: var(--kz-accent); /* Anneau de focus clavier */
|
|
31
|
+
--kz-info: var(--kz-accent); /* Statut : information */
|
|
32
|
+
|
|
33
|
+
/* Ombres (web uniquement) */
|
|
34
|
+
--kz-shadow-sm: 0 1px 3px hsl(0 0% 0% / 0.12), 0 1px 2px hsl(0 0% 0% / 0.06); /* Champ, bouton au repos */
|
|
35
|
+
--kz-shadow-md: 0 4px 12px hsl(0 0% 0% / 0.15), 0 2px 4px hsl(0 0% 0% / 0.08); /* Menu, popover, carte au survol */
|
|
36
|
+
--kz-shadow-lg: 0 8px 24px hsl(0 0% 0% / 0.18), 0 4px 8px hsl(0 0% 0% / 0.08); /* Dialogue, feuille */
|
|
37
|
+
|
|
38
|
+
/* Typographie */
|
|
39
|
+
--kz-font-display: var(--kz-font-sans); /* Titres ; égal à sans par défaut, surchargé par le thème produit */
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Light. */
|
|
43
|
+
html.light {
|
|
44
|
+
color-scheme: light;
|
|
45
|
+
--kz-surface-0: hsl(0 0% 98%); /* Fond de page */
|
|
46
|
+
--kz-surface-1: hsl(0 0% 100%); /* Carte, panneau */
|
|
47
|
+
--kz-surface-2: hsl(240 6% 95%); /* Élément surélevé, champ, survol */
|
|
48
|
+
--kz-surface-3: hsl(240 5% 90%); /* Élément actif, puce, piste */
|
|
49
|
+
--kz-media: hsl(240 6% 92%); /* fond d'un média avant chargement */
|
|
50
|
+
--kz-border-subtle: hsl(240 6% 0% / 0.06); /* Séparateur discret */
|
|
51
|
+
--kz-border-default: hsl(240 6% 0% / 0.10); /* Contour de carte, de champ */
|
|
52
|
+
--kz-border-strong: hsl(240 6% 0% / 0.16); /* Contour au survol, focus non clavier */
|
|
53
|
+
--kz-text-primary: hsl(240 6% 10%); /* Titres, corps de texte */
|
|
54
|
+
--kz-text-secondary: hsl(240 4% 41%); /* Texte d'appui, libellés */
|
|
55
|
+
--kz-text-muted: hsl(240 4% 52%); /* Métadonnées, placeholders, désactivé (≥ 3:1) */
|
|
56
|
+
--kz-accent: hsl(217 92% 50%); /* Action principale, lien, sélection */
|
|
57
|
+
--kz-accent-hover: hsl(217 88% 42%); /* Accent au survol */
|
|
58
|
+
--kz-accent-soft: hsl(217 92% 50% / 0.08); /* Fond teinté (sélection, badge) */
|
|
59
|
+
--kz-shadow-sm: 0 1px 3px hsl(240 6% 0% / 0.06), 0 1px 2px hsl(240 6% 0% / 0.04); /* Champ, bouton au repos */
|
|
60
|
+
--kz-shadow-md: 0 4px 12px hsl(240 6% 0% / 0.08), 0 2px 4px hsl(240 6% 0% / 0.04); /* Menu, popover, carte au survol */
|
|
61
|
+
--kz-shadow-lg: 0 8px 24px hsl(240 6% 0% / 0.10), 0 4px 8px hsl(240 6% 0% / 0.05); /* Dialogue, feuille */
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Invariants : identiques dans les deux thèmes. Tout ce qui se pose SUR un média les utilise. */
|
|
65
|
+
:root {
|
|
66
|
+
/* Texte */
|
|
67
|
+
--kz-text-on-media: hsl(0 0% 100%); /* Texte posé sur une image ou une vidéo */
|
|
68
|
+
--kz-on-accent: hsl(0 0% 100%); /* Texte et icône posés sur l'accent */
|
|
69
|
+
--kz-success: hsl(160 84% 39%); /* Statut : succès (lisible dans les deux thèmes) */
|
|
70
|
+
--kz-warning: hsl(38 92% 50%); /* Statut : avertissement */
|
|
71
|
+
--kz-danger: hsl(0 84% 60%); /* Statut : erreur, action destructive */
|
|
72
|
+
|
|
73
|
+
/* Voiles sur média : identiques dans les deux thèmes. */
|
|
74
|
+
--kz-scrim: hsl(0 0% 0% / 0.60); /* voile derrière un badge ou une légende sur image */
|
|
75
|
+
--kz-scrim-strong: hsl(0 0% 0% / 0.80); /* voile renforcé (texte long sur image) */
|
|
76
|
+
--kz-overlay: hsl(0 0% 0% / 0.70); /* fond d'un dialogue */
|
|
77
|
+
|
|
78
|
+
/* Rayons */
|
|
79
|
+
--kz-radius-sm: 8px; /* Champ, puce */
|
|
80
|
+
--kz-radius-md: 12px; /* Bouton, menu */
|
|
81
|
+
--kz-radius-lg: 16px; /* Carte */
|
|
82
|
+
--kz-radius-xl: 20px; /* Dialogue, feuille */
|
|
83
|
+
--kz-radius-full: 9999px; /* Pastille, avatar */
|
|
84
|
+
--kz-ease: cubic-bezier(0.16, 1, 0.3, 1); /* Courbe par défaut de la signature de mouvement */
|
|
85
|
+
|
|
86
|
+
/* Typographie */
|
|
87
|
+
--kz-font-sans: Inter, system-ui, sans-serif; /* Interface et texte courant */
|
|
88
|
+
--kz-font-mono: "JetBrains Mono", ui-monospace, monospace; /* Code, montants alignés */
|
|
89
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,94 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krizaka/tokens",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "The Krizaka semantic design tokens (--kz-*): one DTCG source compiled to CSS (dark, light, media invariants), typed constants and React Native themes.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"krizaka",
|
|
7
|
+
"design-tokens",
|
|
8
|
+
"dtcg",
|
|
9
|
+
"css-variables",
|
|
10
|
+
"theme",
|
|
11
|
+
"dark-mode",
|
|
12
|
+
"react-native",
|
|
13
|
+
"design-system"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/krizaka/krizaka-ui/tree/main/packages/tokens#readme",
|
|
16
|
+
"bugs": "https://github.com/krizaka/krizaka-ui/issues",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/krizaka/krizaka-ui.git",
|
|
20
|
+
"directory": "packages/tokens"
|
|
21
|
+
},
|
|
22
|
+
"license": "Apache-2.0",
|
|
23
|
+
"author": "Krizaka (https://www.krizaka.com)",
|
|
24
|
+
"type": "module",
|
|
25
|
+
"main": "./dist/index.js",
|
|
26
|
+
"module": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./tokens.css": "./dist/tokens.css",
|
|
34
|
+
"./native": {
|
|
35
|
+
"types": "./dist/native.d.ts",
|
|
36
|
+
"import": "./dist/native.js"
|
|
37
|
+
},
|
|
38
|
+
"./package.json": "./package.json"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE"
|
|
44
|
+
],
|
|
45
|
+
"sideEffects": [
|
|
46
|
+
"*.css"
|
|
47
|
+
],
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
50
|
+
"@size-limit/preset-small-lib": "^14.2.0",
|
|
51
|
+
"@types/node": "^22.15.0",
|
|
52
|
+
"eslint": "^9.39.0",
|
|
53
|
+
"publint": "^0.3.25",
|
|
54
|
+
"size-limit": "^14.2.0",
|
|
55
|
+
"typescript": "^5.9.0",
|
|
56
|
+
"vitest": "^4.1.11",
|
|
57
|
+
"@krizaka/config": "0.1.0"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=20"
|
|
61
|
+
},
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"access": "public"
|
|
64
|
+
},
|
|
65
|
+
"size-limit": [
|
|
66
|
+
{
|
|
67
|
+
"name": "./tokens.css",
|
|
68
|
+
"path": "dist/tokens.css",
|
|
69
|
+
"limit": "2.5 kB",
|
|
70
|
+
"gzip": true,
|
|
71
|
+
"rolldown": false
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": ".",
|
|
75
|
+
"path": "dist/index.js",
|
|
76
|
+
"limit": "1.5 kB",
|
|
77
|
+
"gzip": true
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "./native",
|
|
81
|
+
"path": "dist/native.js",
|
|
82
|
+
"limit": "1 kB",
|
|
83
|
+
"gzip": true
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"scripts": {
|
|
87
|
+
"build": "node scripts/build.mjs",
|
|
88
|
+
"lint": "eslint . --max-warnings 0 && tsc --noEmit --noUnusedLocals --noUnusedParameters --noFallthroughCasesInSwitch --noImplicitReturns",
|
|
89
|
+
"typecheck": "tsc --noEmit",
|
|
90
|
+
"test": "vitest run",
|
|
91
|
+
"size": "size-limit",
|
|
92
|
+
"publint": "publint && attw --pack . --profile esm-only --exclude-entrypoints ./tokens.css"
|
|
93
|
+
}
|
|
6
94
|
}
|