@leta-io/design-tokens 0.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 +30 -0
- package/dist/dark-elevation.css +90 -0
- package/dist/fonts.d.ts +2 -0
- package/dist/fonts.js +2 -0
- package/dist/index.d.ts +2176 -0
- package/dist/index.js +2162 -0
- package/dist/map-elevation.css +148 -0
- package/dist/scroll-utilities.css +258 -0
- package/dist/tailwind.preset.cjs +795 -0
- package/dist/text-styles.css +349 -0
- package/dist/tokens.css +1946 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @leta-io/design-tokens
|
|
2
|
+
|
|
3
|
+
Generated design tokens for the LETA design system.
|
|
4
|
+
|
|
5
|
+
## ⚠️ Do not hand-edit `dist/`
|
|
6
|
+
|
|
7
|
+
Files in `dist/` are generated by `@leta/cli` from the LETA Figma Library. To change a token, update it in Figma and run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm tokens:sync
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Hand-edits will be flagged by the token-drift CI check and overwritten on the next sync.
|
|
14
|
+
|
|
15
|
+
## Source collections (Figma)
|
|
16
|
+
|
|
17
|
+
- **Brand** → primitives (raw colors, fonts, sizes)
|
|
18
|
+
- **Alias** → semantic tokens (themed: Neutral / Caution / Warning × moded: Product / Marketing)
|
|
19
|
+
- **Mapped Colors** → component-level color tokens
|
|
20
|
+
- **Mapped Type** → text styles
|
|
21
|
+
- **Mapped Sizes** → icon sizes
|
|
22
|
+
|
|
23
|
+
## Outputs
|
|
24
|
+
|
|
25
|
+
| File | Purpose |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `dist/tokens.css` | CSS custom properties (with `[data-mode]` switching) |
|
|
28
|
+
| `dist/tokens.ts` | TypeScript constants |
|
|
29
|
+
| `dist/tailwind.preset.cjs` | Tailwind preset extending theme from CSS vars |
|
|
30
|
+
| `dist/text-styles.css` | Text style utility classes |
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dark Elevation — LETA Design System
|
|
3
|
+
* @leta-io/design-tokens/dark-elevation.css
|
|
4
|
+
*
|
|
5
|
+
* ─── Why this exists ───────────────────────────────────────────────────────
|
|
6
|
+
*
|
|
7
|
+
* A shadow communicates elevation by CONTRASTING with what sits behind it. Every
|
|
8
|
+
* Figma shadow — Neutral Drop Shadow 1/2/3 — is a soft, low-opacity BLACK tuned
|
|
9
|
+
* against the app's near-white light surfaces. On a dark surface a low-opacity
|
|
10
|
+
* black shadow is invisible, so in dark mode every overlay (dropdowns, toasts,
|
|
11
|
+
* tooltips, modals, cards, the zoom control) reads flat — pasted onto the page
|
|
12
|
+
* rather than floating above it.
|
|
13
|
+
*
|
|
14
|
+
* The generated `tokens.css` has no `--shadow-*` overrides in its
|
|
15
|
+
* `[data-theme="dark"]` block (its dark palette is colour only), so dark mode
|
|
16
|
+
* inherits the light shadows verbatim. This file supplies the missing dark
|
|
17
|
+
* elevation ramp. It overrides ONLY the shared `--shadow-neutral-*` (and the two
|
|
18
|
+
* colour glows) under `[data-theme="dark"]`, so **every** consumer of
|
|
19
|
+
* `box-shadow: var(--shadow-neutral-N)` gets correct depth with no component
|
|
20
|
+
* changes.
|
|
21
|
+
*
|
|
22
|
+
* ─── The model (chosen 2026-08-23): hairline + deeper shadow ────────────────
|
|
23
|
+
*
|
|
24
|
+
* The same recipe map overlays already use (`map-elevation.css`), because the
|
|
25
|
+
* problem is the same — a shadow alone can't promise contrast against the
|
|
26
|
+
* substrate:
|
|
27
|
+
*
|
|
28
|
+
* 1. a **light hairline ring** — `0 0 0 1px rgb(255 255 255 / …)` — a bright
|
|
29
|
+
* edge that crisply lifts the surface off the dark background no matter how
|
|
30
|
+
* dark the shadow reads; the primary depth cue in dark UIs (Linear/Vercel/
|
|
31
|
+
* Figma). Scales with level (0.05 → 0.10).
|
|
32
|
+
* 2. a **deeper drop shadow** — pure black at much higher opacity than light
|
|
33
|
+
* mode (0.40 → 0.70) with a tight contact layer + a wider ambient layer,
|
|
34
|
+
* giving the actual sense of lift.
|
|
35
|
+
*
|
|
36
|
+
* The ring sits OUTSIDE the element's box, so it is never clipped by an overlay's
|
|
37
|
+
* own `overflow: hidden`, and it layers cleanly with a component's own
|
|
38
|
+
* (dark-token) border — a faint light halo just outside a dark edge.
|
|
39
|
+
*
|
|
40
|
+
* ─── Deliberately NOT overridden ───────────────────────────────────────────
|
|
41
|
+
*
|
|
42
|
+
* `--shadow-map-overlay` is unchanged: map tiles stay light in both themes, so an
|
|
43
|
+
* overlay floating on the map still needs a shadow tuned for a LIGHT substrate.
|
|
44
|
+
*
|
|
45
|
+
* ─── This is an addition to the system ─────────────────────────────────────
|
|
46
|
+
*
|
|
47
|
+
* It should be added to the Figma library as dark-mode effect styles so design
|
|
48
|
+
* and code stay in sync. Until then, Figma dark frames will show overlays a step
|
|
49
|
+
* flatter than the build.
|
|
50
|
+
*
|
|
51
|
+
* ─── Usage ─────────────────────────────────────────────────────────────────
|
|
52
|
+
*
|
|
53
|
+
* import '@leta-io/design-tokens/dark-elevation.css'; // AFTER '@leta-io/design-tokens/css'
|
|
54
|
+
*
|
|
55
|
+
* Load order matters: `[data-theme="dark"]` here and `:root` in tokens.css have
|
|
56
|
+
* equal specificity, so this file must come last for its dark shadows to win.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Overlay backdrop scrim — the dim behind a modal/drawer that makes the page
|
|
61
|
+
* recede. In LIGHT mode a 40% black works. In DARK mode dimming an already-dark
|
|
62
|
+
* page by 40% barely changes it, so the page never recedes and the overlay reads
|
|
63
|
+
* unseparated (the reported bug). Dark uses a much heavier black so the page
|
|
64
|
+
* clearly drops behind the overlay. Consumers reference
|
|
65
|
+
* `var(--leta-overlay-scrim, rgb(16 16 16 / 0.40))` (the fallback keeps it working
|
|
66
|
+
* anywhere this file isn't loaded, e.g. Storybook).
|
|
67
|
+
*/
|
|
68
|
+
:root {
|
|
69
|
+
--leta-overlay-scrim: rgb(16 16 16 / 0.40);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
[data-theme="dark"] {
|
|
73
|
+
--shadow-neutral-1:
|
|
74
|
+
0 0 0 1px rgb(255 255 255 / 0.05),
|
|
75
|
+
0 4px 12px -4px rgb(0 0 0 / 0.40),
|
|
76
|
+
0 1px 4px -2px rgb(0 0 0 / 0.30);
|
|
77
|
+
--shadow-neutral-2:
|
|
78
|
+
0 0 0 1px rgb(255 255 255 / 0.08),
|
|
79
|
+
0 8px 20px -6px rgb(0 0 0 / 0.55),
|
|
80
|
+
0 2px 8px -4px rgb(0 0 0 / 0.40);
|
|
81
|
+
--shadow-neutral-3:
|
|
82
|
+
0 0 0 1px rgb(255 255 255 / 0.10),
|
|
83
|
+
0 14px 32px -8px rgb(0 0 0 / 0.70),
|
|
84
|
+
0 4px 12px -6px rgb(0 0 0 / 0.50);
|
|
85
|
+
/* Colour glows (focus rings / FAB accents) — bumped so they still read on dark. */
|
|
86
|
+
--shadow-red: 0 4px 16px 0 rgb(255 57 65 / 0.35);
|
|
87
|
+
--shadow-blue: 0 4px 16px 0 rgb(72 160 255 / 0.35);
|
|
88
|
+
/* Heavier so the page recedes behind modals/drawers (see note above). */
|
|
89
|
+
--leta-overlay-scrim: rgb(0 0 0 / 0.65);
|
|
90
|
+
}
|
package/dist/fonts.d.ts
ADDED
package/dist/fonts.js
ADDED