@eluan/tokens 0.5.0 → 0.6.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 -7
- package/dist/curves.css +60 -12
- package/dist/fonts-eluan.css +5 -0
- package/dist/fonts.css +3 -3
- package/dist/index.d.ts +58 -1
- package/dist/index.js +24 -7
- package/dist/modes.css +214 -63
- package/dist/primitives.css +3 -0
- package/dist/spacing.css +42 -129
- package/dist/styles.css +117 -0
- package/dist/themes.css +74 -77
- package/dist/tokens.css +2 -1
- package/dist/typeset.css +108 -0
- package/package.json +3 -3
- package/dist/fonts-minimal.css +0 -2
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ import "@eluan/tokens/css"
|
|
|
24
24
|
Then activate a theme by setting attributes on `<html>` (or use `<EluanProvider>` from `@eluan/core`, which wires this up automatically):
|
|
25
25
|
|
|
26
26
|
```html
|
|
27
|
-
<html data-theme="
|
|
27
|
+
<html data-theme="eluan" data-mode="light" data-spacing="standard" data-curves="sweeping">
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
## Token families
|
|
@@ -32,21 +32,44 @@ Then activate a theme by setting attributes on `<html>` (or use `<EluanProvider>
|
|
|
32
32
|
| Family | Tokens | Driven by |
|
|
33
33
|
|---|---|---|
|
|
34
34
|
| Color | `--container-*`, `--interactive-*`, `--action-*-*`, `--positive-*`, `--cautionary-*`, `--destructive-*`, `--informative-*`, `--important-*`, `--dataviz-N-*` | `data-theme` + `data-mode` |
|
|
35
|
+
| Grey ramp | `--color-neutral-0` … `--color-neutral-950` | `data-theme` |
|
|
36
|
+
| Mode aliases | `--backgrounds-*`, `--foregrounds-*`, `--borders-primary` (hairline), `--borders-secondary` (field and control border) | `data-mode`, built from the grey ramp |
|
|
37
|
+
| The look | `--shell-ground`, `--surface-*`, `--control-*`, `--item-selected-*`, `--focus-ring` | fixed; follows `data-theme` + `data-mode` |
|
|
35
38
|
| Spacing | `--spacing-xxs` … `--spacing-4xl` | `data-spacing` |
|
|
36
39
|
| Sizing | `--size-xxs` … `--size-4xl` | `data-spacing` |
|
|
37
|
-
| Curves | `--curves-xxs` … `--curves-xl` | `data-curves` |
|
|
40
|
+
| Curves | `--surface-radius`, `--curves-xxs` … `--curves-xl` | `data-curves` (`--surface-radius` also steps with `data-spacing`) |
|
|
41
|
+
| Control shape | `--control-radius` | nothing: always a capsule |
|
|
38
42
|
| Typeset | `--font-size-step-6` … `--font-size-step-neg3`, plus `--line-height-step-*` and `--letter-spacing-step-*` | viewport, or `data-typeset` |
|
|
39
|
-
| Font-size aliases | `--font-size-xs` … `--font-size-5xl` |
|
|
43
|
+
| Font-size aliases | `--font-size-xs` … `--font-size-5xl` | each points at one typeset step, the same in every density |
|
|
40
44
|
| Fonts | `--font-heading`, `--font-body`, `--font-mono` | `data-theme` |
|
|
41
45
|
|
|
42
|
-
The typeset is a fluid 10-step scale: each step interpolates between anchors at 480px, 748px, and 1024px viewport widths, so type resizes without media queries. `data-typeset="small" \| "medium" \| "large"` pins the whole scale (or any subtree) to one column
|
|
46
|
+
The typeset is a fluid 10-step scale: each step interpolates between anchors at 480px, 748px, and 1024px viewport widths, so type resizes without media queries. `data-typeset="small" \| "medium" \| "large"` pins the whole scale (or any subtree) to one column, and `data-typeset="app"` pins a whole-pixel scale for app screens (11, 12, 13, 14, 16, 20, 24…); omit the attribute for fluid behaviour. Full details in the [theming guide](https://github.com/vasfio/eluan/blob/main/docs/theming.md#the-typeset-axis).
|
|
47
|
+
|
|
48
|
+
## Axes
|
|
49
|
+
|
|
50
|
+
- **Mode** (`data-mode="light" | "dim" | "dark"`). All three are built from the theme's one grey ramp, `--color-neutral-0` to `--color-neutral-950` (in the built-in theme these alias `--color-concrete-*`). Light: cards white, ground paper (step 50), text ink (step 800). Dark: ground step 950, cards 900, raised controls 800. Dim is a soft light mode read deeper on the same ramp; it has no ramp of its own.
|
|
51
|
+
- **Density** (`data-spacing="compact" | "standard" | "wide"`). Changes spacing (`--spacing-*`) and sizes (`--size-*`; a control is 28 / 36 / 44px tall) only. It does not change text size: font size, line height and tracking belong to the typeset.
|
|
52
|
+
- **Curves** (`data-curves="sharp" | "slight" | "sweeping"`, default `sweeping`). Governs surfaces only: `--surface-radius` (cards, tables, dialogs, panels) is 6px, 12px or 20px at standard density, stepping down in compact and up in wide, and the small `--curves-*` scale is for inner parts. Controls are always capsules via `--control-radius`.
|
|
53
|
+
|
|
54
|
+
## The look
|
|
55
|
+
|
|
56
|
+
There is one look and no style to choose. It comes from tokens that follow the theme and the mode:
|
|
57
|
+
|
|
58
|
+
- The page is a paper ground (`--shell-ground`).
|
|
59
|
+
- Cards and tables are flat: a surface fill plus a hairline, no shadow (`--surface-bg`, `--surface-border`).
|
|
60
|
+
- Controls (buttons, select triggers, the selected segment) are raised capsules (`--control-bg`, `--control-shadow`).
|
|
61
|
+
- The primary button is the one lit thing: the accent, with a glow.
|
|
62
|
+
- Inputs and the tracks of switches, sliders and segmented controls are recessed (`--control-field-*`, `--control-well-*`).
|
|
63
|
+
- Menus, popovers, toasts and dialogs float on elevation levels.
|
|
64
|
+
|
|
65
|
+
The primary action is the accent as picked, the same colour in light, dim and dark, with white text (about 3.3:1 on the built-in orange, an intentional exception to the 4.5:1 text floor). Switches, checks, radios, sliders, progress, the chosen calendar day and the focus ring (`--focus-ring`) take the accent. A selected row, tree node, page or pressed toggle is quiet: `--item-selected-bg` and `--item-selected-fg`.
|
|
43
66
|
|
|
44
67
|
## Fonts
|
|
45
68
|
|
|
46
69
|
Two faces ship with the package:
|
|
47
70
|
|
|
48
71
|
- **Paper Mono** — the monospace face for every theme. A variable font (weight axis 100–800) vendored as WOFF2 inside the package, so it works offline with no CDN or extra dependency. Licensed under the SIL Open Font License 1.1.
|
|
49
|
-
- **Inter Variable** — the `
|
|
72
|
+
- **Inter Variable** — the `eluan` theme's heading and body face, self-hosted via `@fontsource-variable/inter` (weight axis 100–900, so every weight is a real face).
|
|
50
73
|
|
|
51
74
|
## Subpath exports
|
|
52
75
|
|
|
@@ -54,7 +77,7 @@ Two faces ship with the package:
|
|
|
54
77
|
import "@eluan/tokens/css" // all tokens
|
|
55
78
|
import "@eluan/tokens/fonts/all" // every built-in theme's fonts
|
|
56
79
|
import "@eluan/tokens/fonts/base" // shared mono face only
|
|
57
|
-
import "@eluan/tokens/fonts/
|
|
80
|
+
import "@eluan/tokens/fonts/eluan" // a single theme's fonts
|
|
58
81
|
import { themes, modes, type Theme } from "@eluan/tokens"
|
|
59
82
|
```
|
|
60
83
|
|
|
@@ -78,7 +101,7 @@ resolveTypesetSize("0", 900) // the fluid step-0 size at a 900px viewport
|
|
|
78
101
|
|
|
79
102
|
## Built-in themes
|
|
80
103
|
|
|
81
|
-
`
|
|
104
|
+
`eluan` is the only built-in theme: concrete greys (a warm, faintly green grey ramp, `--color-concrete-*`) with blaze orange `#FF5100` as the accent. Every custom theme starts from it and changes colour only, never the look. Define your own via `createTheme()` from `@eluan/core`, or generate a theme from your brand colors with [`@eluan/theme-generator`](https://github.com/vasfio/eluan/tree/main/packages/theme-generator). See the [theming guide](https://github.com/vasfio/eluan/blob/main/docs/theming.md).
|
|
82
105
|
|
|
83
106
|
## License
|
|
84
107
|
|
package/dist/curves.css
CHANGED
|
@@ -1,25 +1,58 @@
|
|
|
1
1
|
/* ============================================
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Curves
|
|
3
|
+
* <html data-curves="sharp | slight | sweeping"> sets how round surfaces are.
|
|
4
|
+
*
|
|
5
|
+
* Two roles carry almost every corner in the system:
|
|
6
|
+
*
|
|
7
|
+
* --control-radius Buttons, inputs, selects, segmented controls, nav
|
|
8
|
+
* items, chips, switches. Always a capsule. data-curves
|
|
9
|
+
* does not touch it: a control is recognised by its
|
|
10
|
+
* shape, and the shape is part of the look.
|
|
11
|
+
* --surface-radius Cards, tables, dialogs, panels. This is what
|
|
12
|
+
* data-curves governs. It also steps down in compact and
|
|
13
|
+
* up in wide (--density-step, spacing.css), so a tight
|
|
14
|
+
* layout does not carry big soft corners.
|
|
15
|
+
*
|
|
16
|
+
* surface radius, px compact standard wide
|
|
17
|
+
* sharp 4 6 8
|
|
18
|
+
* slight 10 12 14
|
|
19
|
+
* sweeping 16 20 24
|
|
20
|
+
*
|
|
21
|
+
* --control-radius-multiline is for a control that grows past one line (a
|
|
22
|
+
* textarea, a tall dropzone): the capsule's corner at one line's height, so it
|
|
23
|
+
* sits beside single-line fields without turning into an ellipse.
|
|
24
|
+
*
|
|
25
|
+
* The --curves-* scale stays for the small parts inside those two roles: a
|
|
26
|
+
* checkbox corner, a menu item, a focus outline, a tag in a table cell.
|
|
5
27
|
* ============================================ */
|
|
6
28
|
|
|
29
|
+
:root {
|
|
30
|
+
--control-radius: var(--radius-radius-full);
|
|
31
|
+
}
|
|
32
|
+
|
|
7
33
|
[data-curves="sharp"] {
|
|
8
|
-
|
|
9
|
-
--curves-
|
|
10
|
-
--curves-
|
|
11
|
-
--curves-
|
|
12
|
-
--curves-
|
|
13
|
-
--curves-
|
|
34
|
+
/* The tightest scale still rounds: no card is ever square. */
|
|
35
|
+
--curves-xxs: var(--radius-radius-1);
|
|
36
|
+
--curves-xs: var(--radius-radius-2);
|
|
37
|
+
--curves-sm: var(--radius-radius-2);
|
|
38
|
+
--curves-md: var(--radius-radius-4);
|
|
39
|
+
--curves-lg: var(--radius-radius-6);
|
|
40
|
+
--curves-xl: var(--radius-radius-8);
|
|
41
|
+
|
|
42
|
+
--surface-radius-base: var(--radius-radius-6);
|
|
43
|
+
--surface-radius-step: var(--radius-radius-2);
|
|
14
44
|
}
|
|
15
45
|
|
|
16
46
|
[data-curves="slight"] {
|
|
17
47
|
--curves-xxs: var(--radius-radius-1);
|
|
18
48
|
--curves-xs: var(--radius-radius-2);
|
|
19
49
|
--curves-sm: var(--radius-radius-4);
|
|
20
|
-
--curves-md: var(--radius-radius-
|
|
21
|
-
--curves-lg: var(--radius-radius-
|
|
22
|
-
--curves-xl: var(--radius-radius-
|
|
50
|
+
--curves-md: var(--radius-radius-6);
|
|
51
|
+
--curves-lg: var(--radius-radius-10);
|
|
52
|
+
--curves-xl: var(--radius-radius-14);
|
|
53
|
+
|
|
54
|
+
--surface-radius-base: var(--radius-radius-12);
|
|
55
|
+
--surface-radius-step: var(--radius-radius-2);
|
|
23
56
|
}
|
|
24
57
|
|
|
25
58
|
[data-curves="sweeping"] {
|
|
@@ -29,4 +62,19 @@
|
|
|
29
62
|
--curves-md: var(--radius-radius-12);
|
|
30
63
|
--curves-lg: var(--radius-radius-16);
|
|
31
64
|
--curves-xl: var(--radius-radius-24);
|
|
65
|
+
|
|
66
|
+
--surface-radius-base: var(--radius-radius-20);
|
|
67
|
+
--surface-radius-step: var(--radius-radius-4);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* Resolved on every element that sets either axis, so a subtree that changes
|
|
71
|
+
* only its density or only its curves still gets the right corner. The
|
|
72
|
+
* fallbacks are sweeping at standard density. Must stay after the blocks above. */
|
|
73
|
+
:root,
|
|
74
|
+
[data-curves],
|
|
75
|
+
[data-spacing] {
|
|
76
|
+
--surface-radius: calc(
|
|
77
|
+
var(--surface-radius-base, 1.25rem) + var(--density-step, 0) * var(--surface-radius-step, 0.25rem)
|
|
78
|
+
);
|
|
79
|
+
--control-radius-multiline: calc(var(--size-lg, 2.25rem) / 2);
|
|
32
80
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* eluan theme — Inter Variable, wght 100–900 and opsz 14–32 (heading + body).
|
|
2
|
+
* The optical-size axis gives large text Inter's display cut (tighter, with
|
|
3
|
+
* finer joins) and small text its text cut, chosen by the browser from the
|
|
4
|
+
* font size. About 25 kB more than the weight-only file for the Latin subset. */
|
|
5
|
+
@import "@fontsource-variable/inter/opsz.css";
|
package/dist/fonts.css
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
Paper Mono ships inside this package as a variable WOFF2 (wght 100–800) and
|
|
6
6
|
is declared in fonts-base.css. Inter comes from Google Fonts via @fontsource
|
|
7
|
-
as a variable font (wght 100–900), so every weight a component asks for is a
|
|
7
|
+
as a variable font (wght 100–900, opsz 14–32), so every weight a component asks for is a
|
|
8
8
|
real face — nothing is faux-bolded.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/* Paper Mono — all themes mono */
|
|
12
12
|
@import "./fonts-base.css";
|
|
13
13
|
|
|
14
|
-
/* Inter Variable —
|
|
15
|
-
@import "@fontsource-variable/inter/
|
|
14
|
+
/* Inter Variable — eluan heading + body */
|
|
15
|
+
@import "@fontsource-variable/inter/opsz.css";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const modes: readonly ["light", "dim", "dark"];
|
|
2
2
|
export type Mode = (typeof modes)[number];
|
|
3
|
-
export declare const themes: readonly ["
|
|
3
|
+
export declare const themes: readonly ["eluan"];
|
|
4
4
|
export type Theme = (typeof themes)[number];
|
|
5
5
|
export declare const spacingScales: readonly ["compact", "standard", "wide"];
|
|
6
6
|
export type SpacingScale = (typeof spacingScales)[number];
|
|
@@ -429,6 +429,63 @@ export declare const typeset: {
|
|
|
429
429
|
};
|
|
430
430
|
};
|
|
431
431
|
export type TypesetStep = keyof typeof typeset;
|
|
432
|
+
/**
|
|
433
|
+
* The app typeset (`data-typeset="app"`): pinned, whole-pixel sizes for app
|
|
434
|
+
* screens, with line heights on a 4px grid and tracking per size. Sizes and
|
|
435
|
+
* line heights are CSS px at a 16px root; tracking is in em.
|
|
436
|
+
*/
|
|
437
|
+
export declare const appTypeset: {
|
|
438
|
+
readonly "6": {
|
|
439
|
+
readonly size: 40;
|
|
440
|
+
readonly lineHeight: 48;
|
|
441
|
+
readonly letterSpacing: -0.022;
|
|
442
|
+
};
|
|
443
|
+
readonly "5": {
|
|
444
|
+
readonly size: 32;
|
|
445
|
+
readonly lineHeight: 40;
|
|
446
|
+
readonly letterSpacing: -0.022;
|
|
447
|
+
};
|
|
448
|
+
readonly "4": {
|
|
449
|
+
readonly size: 28;
|
|
450
|
+
readonly lineHeight: 36;
|
|
451
|
+
readonly letterSpacing: -0.021;
|
|
452
|
+
};
|
|
453
|
+
readonly "3": {
|
|
454
|
+
readonly size: 24;
|
|
455
|
+
readonly lineHeight: 32;
|
|
456
|
+
readonly letterSpacing: -0.019;
|
|
457
|
+
};
|
|
458
|
+
readonly "2": {
|
|
459
|
+
readonly size: 20;
|
|
460
|
+
readonly lineHeight: 28;
|
|
461
|
+
readonly letterSpacing: -0.017;
|
|
462
|
+
};
|
|
463
|
+
readonly "1": {
|
|
464
|
+
readonly size: 16;
|
|
465
|
+
readonly lineHeight: 24;
|
|
466
|
+
readonly letterSpacing: -0.011;
|
|
467
|
+
};
|
|
468
|
+
readonly "0": {
|
|
469
|
+
readonly size: 14;
|
|
470
|
+
readonly lineHeight: 20;
|
|
471
|
+
readonly letterSpacing: 0;
|
|
472
|
+
};
|
|
473
|
+
readonly neg1: {
|
|
474
|
+
readonly size: 13;
|
|
475
|
+
readonly lineHeight: 20;
|
|
476
|
+
readonly letterSpacing: 0;
|
|
477
|
+
};
|
|
478
|
+
readonly neg2: {
|
|
479
|
+
readonly size: 12;
|
|
480
|
+
readonly lineHeight: 16;
|
|
481
|
+
readonly letterSpacing: 0;
|
|
482
|
+
};
|
|
483
|
+
readonly neg3: {
|
|
484
|
+
readonly size: 11;
|
|
485
|
+
readonly lineHeight: 16;
|
|
486
|
+
readonly letterSpacing: 0.005;
|
|
487
|
+
};
|
|
488
|
+
};
|
|
432
489
|
/** Every step, largest first — handy for iterating a scale showcase. */
|
|
433
490
|
export declare const typesetSteps: readonly ["6", "5", "4", "3", "2", "1", "0", "neg1", "neg2", "neg3"];
|
|
434
491
|
/**
|
package/dist/index.js
CHANGED
|
@@ -8,9 +8,9 @@ export const modes = ["light", "dim", "dark"];
|
|
|
8
8
|
// ============================================
|
|
9
9
|
// Available Themes
|
|
10
10
|
// ============================================
|
|
11
|
-
// `
|
|
11
|
+
// `eluan` is the only built-in theme. Everything else is a consumer theme
|
|
12
12
|
// built with createTheme() from @eluan/core or @eluan/theme-generator.
|
|
13
|
-
export const themes = ["
|
|
13
|
+
export const themes = ["eluan"];
|
|
14
14
|
// ============================================
|
|
15
15
|
// Available Spacing Scales
|
|
16
16
|
// ============================================
|
|
@@ -472,6 +472,23 @@ export const typeset = {
|
|
|
472
472
|
neg2: { small: 9.72, medium: 10.51, large: 11.52 },
|
|
473
473
|
neg3: { small: 8.1, medium: 8.59, large: 9.22 },
|
|
474
474
|
};
|
|
475
|
+
/**
|
|
476
|
+
* The app typeset (`data-typeset="app"`): pinned, whole-pixel sizes for app
|
|
477
|
+
* screens, with line heights on a 4px grid and tracking per size. Sizes and
|
|
478
|
+
* line heights are CSS px at a 16px root; tracking is in em.
|
|
479
|
+
*/
|
|
480
|
+
export const appTypeset = {
|
|
481
|
+
"6": { size: 40, lineHeight: 48, letterSpacing: -0.022 },
|
|
482
|
+
"5": { size: 32, lineHeight: 40, letterSpacing: -0.022 },
|
|
483
|
+
"4": { size: 28, lineHeight: 36, letterSpacing: -0.021 },
|
|
484
|
+
"3": { size: 24, lineHeight: 32, letterSpacing: -0.019 },
|
|
485
|
+
"2": { size: 20, lineHeight: 28, letterSpacing: -0.017 },
|
|
486
|
+
"1": { size: 16, lineHeight: 24, letterSpacing: -0.011 },
|
|
487
|
+
"0": { size: 14, lineHeight: 20, letterSpacing: 0 },
|
|
488
|
+
neg1: { size: 13, lineHeight: 20, letterSpacing: 0 },
|
|
489
|
+
neg2: { size: 12, lineHeight: 16, letterSpacing: 0 },
|
|
490
|
+
neg3: { size: 11, lineHeight: 16, letterSpacing: 0.005 },
|
|
491
|
+
};
|
|
475
492
|
/** Every step, largest first — handy for iterating a scale showcase. */
|
|
476
493
|
export const typesetSteps = [
|
|
477
494
|
"6",
|
|
@@ -606,7 +623,7 @@ export const fontFamilies = {
|
|
|
606
623
|
// Theme → Font Mapping (Google Fonts via @fontsource)
|
|
607
624
|
// ============================================
|
|
608
625
|
export const themeFonts = {
|
|
609
|
-
"
|
|
626
|
+
"eluan": {
|
|
610
627
|
heading: "Inter",
|
|
611
628
|
body: "Inter",
|
|
612
629
|
},
|
|
@@ -618,7 +635,7 @@ export const themeFonts = {
|
|
|
618
635
|
// Cross-platform consumers and sync tooling (e.g. Figma variables) can use
|
|
619
636
|
// this to resolve mode backgrounds/foregrounds per theme.
|
|
620
637
|
export const themeNeutrals = {
|
|
621
|
-
"
|
|
638
|
+
"eluan": "concrete",
|
|
622
639
|
};
|
|
623
640
|
// ============================================
|
|
624
641
|
// Dynamic Font Loader
|
|
@@ -630,7 +647,7 @@ export const themeNeutrals = {
|
|
|
630
647
|
// useEffect(() => { loadThemeFonts(theme) }, [theme])
|
|
631
648
|
//
|
|
632
649
|
// Usage (vanilla):
|
|
633
|
-
// loadThemeFonts('
|
|
650
|
+
// loadThemeFonts('eluan')
|
|
634
651
|
const _loadedFonts = new Set();
|
|
635
652
|
/**
|
|
636
653
|
* Dynamically load the font CSS for a given theme.
|
|
@@ -645,8 +662,8 @@ export async function loadThemeFonts(theme) {
|
|
|
645
662
|
if (_loadedFonts.has(theme))
|
|
646
663
|
return;
|
|
647
664
|
switch (theme) {
|
|
648
|
-
case "
|
|
649
|
-
await import("@fontsource-variable/inter/
|
|
665
|
+
case "eluan":
|
|
666
|
+
await import("@fontsource-variable/inter/opsz.css");
|
|
650
667
|
break;
|
|
651
668
|
}
|
|
652
669
|
_loadedFonts.add(theme);
|