@cascivo/tokens 0.3.5 → 0.4.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 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.5",
3
+ "version": "0.4.0",
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
+ "./layers": "./src/layers.css",
34
+ "./layers.css": "./src/layers.css",
33
35
  "./properties": "./src/properties.css",
34
36
  "./properties.css": "./src/properties.css",
35
37
  "./functions": "./src/functions.css",
package/src/index.css CHANGED
@@ -2,6 +2,11 @@
2
2
  /* cascivo Design System — Primitive Tokens */
3
3
  /* These are raw values. Never use directly in components. Use semantic tokens. */
4
4
 
5
+ /* Establish the canonical cascade-layer order before any layered rule. Every
6
+ consumer path imports @cascivo/tokens (directly or via a theme), so this rides
7
+ along first and dedupes by URL. See ./layers.css for the authoritative order. */
8
+ @import './layers.css';
9
+
5
10
  @layer cascivo.tokens {
6
11
  :root {
7
12
  /* ── Color Primitives ─────────────────────────────── */
@@ -249,21 +254,25 @@
249
254
  --cascivo-editor-selection: var(--cascivo-color-accent-muted, oklch(0.882 0.095 250));
250
255
  --cascivo-editor-border: var(--cascivo-color-border, oklch(0.928 0.006 264));
251
256
 
252
- /* Syntax palette — one token per TokenKind */
257
+ /* Syntax palette — one token per TokenKind. String/number/type/property (and
258
+ their aliases regexp/attr/boolean) are pinned to text-safe darker values
259
+ instead of the raw chart hues, which are tuned for 3:1 fills and fall below
260
+ WCAG AA 4.5:1 as code text on the light editor surface. Dark-surface themes
261
+ restore the brighter chart hues below (they clear 4.5:1 on a dark bg). */
253
262
  --cascivo-editor-syntax-keyword: var(--cascivo-color-accent, oklch(0.52 0.2 250));
254
- --cascivo-editor-syntax-string: var(--cascivo-chart-3, oklch(0.52 0.13 150));
255
- --cascivo-editor-syntax-number: var(--cascivo-chart-6, oklch(0.55 0.16 40));
263
+ --cascivo-editor-syntax-string: oklch(0.53 0.13 135);
264
+ --cascivo-editor-syntax-number: oklch(0.54 0.15 40);
256
265
  --cascivo-editor-syntax-comment: var(--cascivo-color-foreground-muted, oklch(0.55 0.018 264));
257
266
  --cascivo-editor-syntax-function: var(--cascivo-chart-5, oklch(0.5 0.16 265));
258
- --cascivo-editor-syntax-type: var(--cascivo-chart-7, oklch(0.52 0.15 320));
267
+ --cascivo-editor-syntax-type: oklch(0.54 0.12 350);
259
268
  --cascivo-editor-syntax-operator: var(--cascivo-color-foreground-muted, oklch(0.5 0.04 264));
260
269
  --cascivo-editor-syntax-punctuation: var(--cascivo-color-text-subtle, oklch(0.446 0.018 264));
261
270
  --cascivo-editor-syntax-variable: var(--cascivo-editor-fg);
262
271
  --cascivo-editor-syntax-tag: var(--cascivo-color-accent, oklch(0.52 0.2 250));
263
- --cascivo-editor-syntax-attr: var(--cascivo-chart-6, oklch(0.55 0.16 40));
264
- --cascivo-editor-syntax-regexp: var(--cascivo-chart-3, oklch(0.52 0.13 150));
265
- --cascivo-editor-syntax-boolean: var(--cascivo-chart-6, oklch(0.55 0.16 40));
266
- --cascivo-editor-syntax-property: var(--cascivo-chart-2, oklch(0.5 0.13 240));
272
+ --cascivo-editor-syntax-attr: oklch(0.54 0.15 40);
273
+ --cascivo-editor-syntax-regexp: oklch(0.53 0.13 135);
274
+ --cascivo-editor-syntax-boolean: oklch(0.54 0.15 40);
275
+ --cascivo-editor-syntax-property: oklch(0.53 0.12 240);
267
276
 
268
277
  /* ── Brand (apps/logo/OG only — never used in component CSS) ── */
269
278
  --cascivo-brand-primary: oklch(
@@ -313,6 +322,22 @@
313
322
  --cascivo-target-min-coarse: 2.75rem; /* 44px — Apple HIG comfortable touch target */
314
323
  }
315
324
 
325
+ /* Dark-surface themes: restore the brighter chart hues for editor syntax, which
326
+ clear WCAG AA 4.5:1 on a dark editor background (the light-theme darkened
327
+ literals above would be too low-contrast there). */
328
+ [data-theme='dark'],
329
+ [data-theme='midnight'],
330
+ [data-theme='terminal'],
331
+ [data-theme='cyberpunk'] {
332
+ --cascivo-editor-syntax-string: var(--cascivo-chart-3);
333
+ --cascivo-editor-syntax-regexp: var(--cascivo-chart-3);
334
+ --cascivo-editor-syntax-number: var(--cascivo-chart-6);
335
+ --cascivo-editor-syntax-attr: var(--cascivo-chart-6);
336
+ --cascivo-editor-syntax-boolean: var(--cascivo-chart-6);
337
+ --cascivo-editor-syntax-type: var(--cascivo-chart-7);
338
+ --cascivo-editor-syntax-property: var(--cascivo-chart-2);
339
+ }
340
+
316
341
  /* All cascade motion derives from the duration tokens, so collapsing them
317
342
  disables every transition/animation library-wide. Continuous progress
318
343
  indicators (Spinner) use literal durations and opt out deliberately. */
package/src/layers.css ADDED
@@ -0,0 +1,29 @@
1
+ /* packages/tokens/src/layers.css */
2
+ /* cascivo — canonical @layer order (single source of truth). */
3
+ /*
4
+ * This statement is the ONE authoritative declaration of cascivo's cascade-layer
5
+ * order. Every entry path emits it first (via @import of this file, or — for the
6
+ * @cascivo/react aggregate — by prepending its contents), and identical @layer
7
+ * statements are idempotent, so the order is deterministic no matter which
8
+ * cascivo stylesheet a consumer loads first.
9
+ *
10
+ * Ordered lowest-priority → highest-priority:
11
+ *
12
+ * cascivo.reset consumer reset (box-sizing, margin/padding zeroing) — the floor
13
+ * cascivo.base minimal html font/color reset (@cascivo/themes/base.css)
14
+ * cascivo.tokens primitive design tokens (@cascivo/tokens)
15
+ * cascivo.component component + layout styles
16
+ * cascivo.theme semantic token values per [data-theme] (@cascivo/themes/*)
17
+ * cascivo.override consumer escape hatch — beats tokens, components, and themes
18
+ *
19
+ * theme > component matches the CLI scaffold and every example app: themes own
20
+ * the semantic tier, so a theme always wins over component defaults. cascivo.override
21
+ * sits on top: put brand/one-off overrides in `@layer cascivo.override { … }` and
22
+ * they beat everything cascivo ships — with no `:root:not([data-theme])` specificity
23
+ * fight. App-local sublayers (cascivo.example, cascivo.blocks.*) are not shipped by
24
+ * any package; insert them between cascivo.theme and cascivo.override.
25
+ *
26
+ * Guard: scripts/checks/layer-order.test.ts asserts every shipped/scaffolded
27
+ * @layer statement is an ordered subsequence of this one.
28
+ */
29
+ @layer cascivo.reset, cascivo.base, cascivo.tokens, cascivo.component, cascivo.theme, cascivo.override;
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'
@@ -322,6 +323,7 @@ export type CascivoColorToken =
322
323
  | '--cascivo-color-foreground-muted'
323
324
  | '--cascivo-color-info'
324
325
  | '--cascivo-color-info-content'
326
+ | '--cascivo-color-info-foreground'
325
327
  | '--cascivo-color-info-subtle'
326
328
  | '--cascivo-color-primary'
327
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
  {