@cascivo/tokens 0.3.4 → 0.3.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 urbanisierung
3
+ Copyright (c) cascivo contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cascivo/tokens",
3
- "version": "0.3.4",
3
+ "version": "0.3.8",
4
4
  "private": false,
5
5
  "description": "Three-level CSS design tokens (primitive → semantic → component)",
6
6
  "keywords": [
@@ -30,6 +30,8 @@
30
30
  ],
31
31
  "exports": {
32
32
  ".": "./src/index.css",
33
+ "./properties": "./src/properties.css",
34
+ "./properties.css": "./src/properties.css",
33
35
  "./functions": "./src/functions.css",
34
36
  "./functions.css": "./src/functions.css",
35
37
  "./screens": "./src/screens.ts",
package/src/index.css CHANGED
@@ -127,6 +127,26 @@
127
127
  --cascivo-tracking-normal: 0em;
128
128
  --cascivo-tracking-wide: 0.025em;
129
129
 
130
+ /* ── Typography roles (semantic) ───────────────────
131
+ Purpose-named type tokens. Each resolves to exactly ONE primitive size
132
+ above, so "what size is a button label?" has exactly one answer:
133
+ --cascivo-text-ui. These tokens carry size only; pair them with the
134
+ recommended weight/leading in docs/cookbooks/derivable-theming.md. */
135
+ --cascivo-text-display: var(--cascivo-text-4xl); /* hero / marketing display */
136
+ --cascivo-text-heading-lg: var(--cascivo-text-3xl); /* page title (h1) */
137
+ --cascivo-text-heading-md: var(--cascivo-text-2xl); /* section heading (h2) */
138
+ --cascivo-text-heading-sm: var(--cascivo-text-xl); /* subsection heading (h3) */
139
+ --cascivo-text-body: var(--cascivo-text-base); /* default body copy */
140
+ --cascivo-text-body-sm: var(--cascivo-text-sm); /* secondary / dense body copy */
141
+ --cascivo-text-ui: var(
142
+ --cascivo-text-sm
143
+ ); /* control & button labels (the canonical "ui.default") */
144
+ --cascivo-text-label: var(--cascivo-text-sm); /* form field labels */
145
+ --cascivo-text-caption: var(--cascivo-text-xs); /* captions, helper text, metadata */
146
+ --cascivo-text-code: var(
147
+ --cascivo-text-sm
148
+ ); /* inline code / mono (pair with --cascivo-font-mono) */
149
+
130
150
  /* ── Border Radius — Primitive ───────────────────── */
131
151
  --cascivo-radius-none: 0px;
132
152
  --cascivo-radius-sm: 0.25rem; /* 4px */
@@ -229,21 +249,25 @@
229
249
  --cascivo-editor-selection: var(--cascivo-color-accent-muted, oklch(0.882 0.095 250));
230
250
  --cascivo-editor-border: var(--cascivo-color-border, oklch(0.928 0.006 264));
231
251
 
232
- /* Syntax palette — one token per TokenKind */
252
+ /* Syntax palette — one token per TokenKind. String/number/type/property (and
253
+ their aliases regexp/attr/boolean) are pinned to text-safe darker values
254
+ instead of the raw chart hues, which are tuned for 3:1 fills and fall below
255
+ WCAG AA 4.5:1 as code text on the light editor surface. Dark-surface themes
256
+ restore the brighter chart hues below (they clear 4.5:1 on a dark bg). */
233
257
  --cascivo-editor-syntax-keyword: var(--cascivo-color-accent, oklch(0.52 0.2 250));
234
- --cascivo-editor-syntax-string: var(--cascivo-chart-3, oklch(0.52 0.13 150));
235
- --cascivo-editor-syntax-number: var(--cascivo-chart-6, oklch(0.55 0.16 40));
258
+ --cascivo-editor-syntax-string: oklch(0.53 0.13 135);
259
+ --cascivo-editor-syntax-number: oklch(0.54 0.15 40);
236
260
  --cascivo-editor-syntax-comment: var(--cascivo-color-foreground-muted, oklch(0.55 0.018 264));
237
261
  --cascivo-editor-syntax-function: var(--cascivo-chart-5, oklch(0.5 0.16 265));
238
- --cascivo-editor-syntax-type: var(--cascivo-chart-7, oklch(0.52 0.15 320));
262
+ --cascivo-editor-syntax-type: oklch(0.54 0.12 350);
239
263
  --cascivo-editor-syntax-operator: var(--cascivo-color-foreground-muted, oklch(0.5 0.04 264));
240
264
  --cascivo-editor-syntax-punctuation: var(--cascivo-color-text-subtle, oklch(0.446 0.018 264));
241
265
  --cascivo-editor-syntax-variable: var(--cascivo-editor-fg);
242
266
  --cascivo-editor-syntax-tag: var(--cascivo-color-accent, oklch(0.52 0.2 250));
243
- --cascivo-editor-syntax-attr: var(--cascivo-chart-6, oklch(0.55 0.16 40));
244
- --cascivo-editor-syntax-regexp: var(--cascivo-chart-3, oklch(0.52 0.13 150));
245
- --cascivo-editor-syntax-boolean: var(--cascivo-chart-6, oklch(0.55 0.16 40));
246
- --cascivo-editor-syntax-property: var(--cascivo-chart-2, oklch(0.5 0.13 240));
267
+ --cascivo-editor-syntax-attr: oklch(0.54 0.15 40);
268
+ --cascivo-editor-syntax-regexp: oklch(0.53 0.13 135);
269
+ --cascivo-editor-syntax-boolean: oklch(0.54 0.15 40);
270
+ --cascivo-editor-syntax-property: oklch(0.53 0.12 240);
247
271
 
248
272
  /* ── Brand (apps/logo/OG only — never used in component CSS) ── */
249
273
  --cascivo-brand-primary: oklch(
@@ -293,6 +317,22 @@
293
317
  --cascivo-target-min-coarse: 2.75rem; /* 44px — Apple HIG comfortable touch target */
294
318
  }
295
319
 
320
+ /* Dark-surface themes: restore the brighter chart hues for editor syntax, which
321
+ clear WCAG AA 4.5:1 on a dark editor background (the light-theme darkened
322
+ literals above would be too low-contrast there). */
323
+ [data-theme='dark'],
324
+ [data-theme='midnight'],
325
+ [data-theme='terminal'],
326
+ [data-theme='cyberpunk'] {
327
+ --cascivo-editor-syntax-string: var(--cascivo-chart-3);
328
+ --cascivo-editor-syntax-regexp: var(--cascivo-chart-3);
329
+ --cascivo-editor-syntax-number: var(--cascivo-chart-6);
330
+ --cascivo-editor-syntax-attr: var(--cascivo-chart-6);
331
+ --cascivo-editor-syntax-boolean: var(--cascivo-chart-6);
332
+ --cascivo-editor-syntax-type: var(--cascivo-chart-7);
333
+ --cascivo-editor-syntax-property: var(--cascivo-chart-2);
334
+ }
335
+
296
336
  /* All cascade motion derives from the duration tokens, so collapsing them
297
337
  disables every transition/animation library-wide. Continuous progress
298
338
  indicators (Spinner) use literal durations and opt out deliberately. */
@@ -0,0 +1,76 @@
1
+ /* packages/tokens/src/properties.css */
2
+ /* cascivo — @property registrations for themeable color custom properties.
3
+ *
4
+ * Registering the themeable color tokens as typed custom properties (<color>,
5
+ * inherits) buys two things:
6
+ * 1. Smooth interpolation when [data-theme] changes under a transition.
7
+ * 2. A typed substrate for future @container style() palette branching.
8
+ *
9
+ * Only *themeable* color props are registered (the values a theme overrides or
10
+ * that animate), not the whole primitive scale. Registration sets the property
11
+ * type + initial value; theme blocks still override the value as usual.
12
+ *
13
+ * Imported by @cascivo/themes/all.css (and safe to import standalone). @property
14
+ * is a top-level at-rule and intentionally lives outside @layer.
15
+ */
16
+
17
+ @property --cascivo-color-accent {
18
+ syntax: '<color>';
19
+ inherits: true;
20
+ initial-value: oklch(0.52 0.2 250);
21
+ }
22
+ @property --cascivo-color-accent-hover {
23
+ syntax: '<color>';
24
+ inherits: true;
25
+ initial-value: oklch(0.45 0.2 250);
26
+ }
27
+ @property --cascivo-color-accent-active {
28
+ syntax: '<color>';
29
+ inherits: true;
30
+ initial-value: oklch(0.373 0.155 250);
31
+ }
32
+ @property --cascivo-color-primary {
33
+ syntax: '<color>';
34
+ inherits: true;
35
+ initial-value: oklch(0.205 0 0);
36
+ }
37
+ @property --cascivo-color-primary-hover {
38
+ syntax: '<color>';
39
+ inherits: true;
40
+ initial-value: oklch(0.27 0 0);
41
+ }
42
+ @property --cascivo-color-primary-active {
43
+ syntax: '<color>';
44
+ inherits: true;
45
+ initial-value: oklch(0.32 0 0);
46
+ }
47
+ @property --cascivo-color-secondary {
48
+ syntax: '<color>';
49
+ inherits: true;
50
+ initial-value: oklch(0.92 0.004 264);
51
+ }
52
+ @property --cascivo-color-secondary-hover {
53
+ syntax: '<color>';
54
+ inherits: true;
55
+ initial-value: oklch(0.86 0.006 264);
56
+ }
57
+ @property --cascivo-color-destructive {
58
+ syntax: '<color>';
59
+ inherits: true;
60
+ initial-value: oklch(0.54 0.188 22);
61
+ }
62
+ @property --cascivo-color-destructive-hover {
63
+ syntax: '<color>';
64
+ inherits: true;
65
+ initial-value: oklch(0.448 0.17 22);
66
+ }
67
+ @property --cascivo-color-text-on-accent {
68
+ syntax: '<color>';
69
+ inherits: true;
70
+ initial-value: oklch(1 0 0);
71
+ }
72
+ @property --cascivo-color-text-on-destructive {
73
+ syntax: '<color>';
74
+ inherits: true;
75
+ initial-value: oklch(1 0 0);
76
+ }
package/src/tokens.d.ts CHANGED
@@ -58,6 +58,7 @@ export type CascivoToken =
58
58
  | '--cascivo-color-foreground-muted'
59
59
  | '--cascivo-color-info'
60
60
  | '--cascivo-color-info-content'
61
+ | '--cascivo-color-info-foreground'
61
62
  | '--cascivo-color-info-subtle'
62
63
  | '--cascivo-color-primary'
63
64
  | '--cascivo-color-primary-active'
@@ -226,8 +227,18 @@ export type CascivoToken =
226
227
  | '--cascivo-text-4xl'
227
228
  | '--cascivo-text-4xl-fluid'
228
229
  | '--cascivo-text-base'
230
+ | '--cascivo-text-body'
231
+ | '--cascivo-text-body-sm'
232
+ | '--cascivo-text-caption'
233
+ | '--cascivo-text-code'
234
+ | '--cascivo-text-display'
235
+ | '--cascivo-text-heading-lg'
236
+ | '--cascivo-text-heading-md'
237
+ | '--cascivo-text-heading-sm'
238
+ | '--cascivo-text-label'
229
239
  | '--cascivo-text-lg'
230
240
  | '--cascivo-text-sm'
241
+ | '--cascivo-text-ui'
231
242
  | '--cascivo-text-xl'
232
243
  | '--cascivo-text-xs'
233
244
  | '--cascivo-tracking-normal'
@@ -312,6 +323,7 @@ export type CascivoColorToken =
312
323
  | '--cascivo-color-foreground-muted'
313
324
  | '--cascivo-color-info'
314
325
  | '--cascivo-color-info-content'
326
+ | '--cascivo-color-info-foreground'
315
327
  | '--cascivo-color-info-subtle'
316
328
  | '--cascivo-color-primary'
317
329
  | '--cascivo-color-primary-active'
package/tokens.json CHANGED
@@ -227,7 +227,7 @@
227
227
  "name": "--cascivo-chart-axis",
228
228
  "category": "color",
229
229
  "role": "chart-axis",
230
- "value": "var(--cascivo-gray-400)",
230
+ "value": "oklch(0.5 0.016 264)",
231
231
  "canonical": true
232
232
  },
233
233
  {
@@ -399,7 +399,7 @@
399
399
  "name": "--cascivo-color-foreground-muted",
400
400
  "category": "color",
401
401
  "role": "color-foreground-muted",
402
- "value": "oklch(0.554 0.018 264)",
402
+ "value": "oklch(0.5 0.018 264)",
403
403
  "canonical": false,
404
404
  "aliasOf": "--cascivo-color-text-muted"
405
405
  },
@@ -417,6 +417,13 @@
417
417
  "value": "oklch(1 0 0)",
418
418
  "canonical": true
419
419
  },
420
+ {
421
+ "name": "--cascivo-color-info-foreground",
422
+ "category": "color",
423
+ "role": "color-info-foreground",
424
+ "value": "oklch(0.45 0.19 250)",
425
+ "canonical": true
426
+ },
420
427
  {
421
428
  "name": "--cascivo-color-info-subtle",
422
429
  "category": "color",
@@ -557,7 +564,7 @@
557
564
  "name": "--cascivo-color-text-muted",
558
565
  "category": "color",
559
566
  "role": "color-text-muted",
560
- "value": "var(--cascivo-gray-400)",
567
+ "value": "oklch(0.5 0.016 264)",
561
568
  "canonical": true
562
569
  },
563
570
  {
@@ -1132,14 +1139,14 @@
1132
1139
  "name": "--cascivo-editor-syntax-attr",
1133
1140
  "category": "other",
1134
1141
  "role": "editor-syntax-attr",
1135
- "value": "var(--cascivo-chart-6, oklch(0.55 0.16 40))",
1142
+ "value": "oklch(0.54 0.15 40)",
1136
1143
  "canonical": true
1137
1144
  },
1138
1145
  {
1139
1146
  "name": "--cascivo-editor-syntax-boolean",
1140
1147
  "category": "other",
1141
1148
  "role": "editor-syntax-boolean",
1142
- "value": "var(--cascivo-chart-6, oklch(0.55 0.16 40))",
1149
+ "value": "oklch(0.54 0.15 40)",
1143
1150
  "canonical": true
1144
1151
  },
1145
1152
  {
@@ -1167,7 +1174,7 @@
1167
1174
  "name": "--cascivo-editor-syntax-number",
1168
1175
  "category": "other",
1169
1176
  "role": "editor-syntax-number",
1170
- "value": "var(--cascivo-chart-6, oklch(0.55 0.16 40))",
1177
+ "value": "oklch(0.54 0.15 40)",
1171
1178
  "canonical": true
1172
1179
  },
1173
1180
  {
@@ -1181,7 +1188,7 @@
1181
1188
  "name": "--cascivo-editor-syntax-property",
1182
1189
  "category": "other",
1183
1190
  "role": "editor-syntax-property",
1184
- "value": "var(--cascivo-chart-2, oklch(0.5 0.13 240))",
1191
+ "value": "oklch(0.53 0.12 240)",
1185
1192
  "canonical": true
1186
1193
  },
1187
1194
  {
@@ -1195,14 +1202,14 @@
1195
1202
  "name": "--cascivo-editor-syntax-regexp",
1196
1203
  "category": "other",
1197
1204
  "role": "editor-syntax-regexp",
1198
- "value": "var(--cascivo-chart-3, oklch(0.52 0.13 150))",
1205
+ "value": "oklch(0.53 0.13 135)",
1199
1206
  "canonical": true
1200
1207
  },
1201
1208
  {
1202
1209
  "name": "--cascivo-editor-syntax-string",
1203
1210
  "category": "other",
1204
1211
  "role": "editor-syntax-string",
1205
- "value": "var(--cascivo-chart-3, oklch(0.52 0.13 150))",
1212
+ "value": "oklch(0.53 0.13 135)",
1206
1213
  "canonical": true
1207
1214
  },
1208
1215
  {
@@ -1216,7 +1223,7 @@
1216
1223
  "name": "--cascivo-editor-syntax-type",
1217
1224
  "category": "other",
1218
1225
  "role": "editor-syntax-type",
1219
- "value": "var(--cascivo-chart-7, oklch(0.52 0.15 320))",
1226
+ "value": "oklch(0.54 0.12 350)",
1220
1227
  "canonical": true
1221
1228
  },
1222
1229
  {
@@ -1667,6 +1674,69 @@
1667
1674
  "value": "1rem",
1668
1675
  "canonical": true
1669
1676
  },
1677
+ {
1678
+ "name": "--cascivo-text-body",
1679
+ "category": "typography",
1680
+ "role": "text-body",
1681
+ "value": "var(--cascivo-text-base)",
1682
+ "canonical": true
1683
+ },
1684
+ {
1685
+ "name": "--cascivo-text-body-sm",
1686
+ "category": "typography",
1687
+ "role": "text-body-sm",
1688
+ "value": "var(--cascivo-text-sm)",
1689
+ "canonical": true
1690
+ },
1691
+ {
1692
+ "name": "--cascivo-text-caption",
1693
+ "category": "typography",
1694
+ "role": "text-caption",
1695
+ "value": "var(--cascivo-text-xs)",
1696
+ "canonical": true
1697
+ },
1698
+ {
1699
+ "name": "--cascivo-text-code",
1700
+ "category": "typography",
1701
+ "role": "text-code",
1702
+ "value": "var( --cascivo-text-sm )",
1703
+ "canonical": true
1704
+ },
1705
+ {
1706
+ "name": "--cascivo-text-display",
1707
+ "category": "typography",
1708
+ "role": "text-display",
1709
+ "value": "var(--cascivo-text-4xl)",
1710
+ "canonical": true
1711
+ },
1712
+ {
1713
+ "name": "--cascivo-text-heading-lg",
1714
+ "category": "typography",
1715
+ "role": "text-heading-lg",
1716
+ "value": "var(--cascivo-text-3xl)",
1717
+ "canonical": true
1718
+ },
1719
+ {
1720
+ "name": "--cascivo-text-heading-md",
1721
+ "category": "typography",
1722
+ "role": "text-heading-md",
1723
+ "value": "var(--cascivo-text-2xl)",
1724
+ "canonical": true
1725
+ },
1726
+ {
1727
+ "name": "--cascivo-text-heading-sm",
1728
+ "category": "typography",
1729
+ "role": "text-heading-sm",
1730
+ "value": "var(--cascivo-text-xl)",
1731
+ "canonical": true
1732
+ },
1733
+ {
1734
+ "name": "--cascivo-text-label",
1735
+ "category": "typography",
1736
+ "role": "text-label",
1737
+ "value": "var(--cascivo-text-sm)",
1738
+ "canonical": true
1739
+ },
1670
1740
  {
1671
1741
  "name": "--cascivo-text-lg",
1672
1742
  "category": "typography",
@@ -1681,6 +1751,13 @@
1681
1751
  "value": "0.875rem",
1682
1752
  "canonical": true
1683
1753
  },
1754
+ {
1755
+ "name": "--cascivo-text-ui",
1756
+ "category": "typography",
1757
+ "role": "text-ui",
1758
+ "value": "var( --cascivo-text-sm )",
1759
+ "canonical": true
1760
+ },
1684
1761
  {
1685
1762
  "name": "--cascivo-text-xl",
1686
1763
  "category": "typography",