@averoui/tokens 1.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Faraz Pourebrahim
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # @averoui/tokens
2
+
3
+ The design tokens behind [Avero](https://github.com/FarazPourebrahim/avero): colour, typography,
4
+ spacing, radius, elevation, motion and z-index, as Tailwind CSS v4 `@theme` variables.
5
+
6
+ A theme is a set of CSS custom properties, not a fork — redefining a token restyles every component
7
+ that uses it.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pnpm add @averoui/tokens
13
+ ```
14
+
15
+ Tailwind CSS v4.3+ is a peer dependency.
16
+
17
+ ## Stylesheets
18
+
19
+ Import in this order; only `theme.css` is required.
20
+
21
+ | Import | Contributes | When |
22
+ | ---------------------------------- | ------------------------------------------------------- | ------------------------------ |
23
+ | `@averoui/tokens/theme.css` | Every token, plus keyframes | Always |
24
+ | `@averoui/tokens/base.css` | Document defaults, reduced motion, scroll-lock gutter | Apps built on Avero end to end |
25
+ | `@averoui/tokens/utilities.css` | Scrollbars, shimmer, glow ring, typing caret, gradients | When you use them |
26
+ | `@averoui/tokens/rich-content.css` | Prose styles for `RichContent` and the editor | With either of those |
27
+
28
+ ```css
29
+ @import "tailwindcss";
30
+ @import "@averoui/tokens/theme.css";
31
+ ```
32
+
33
+ ## Overriding
34
+
35
+ Add your own `@theme` block after the import; later declarations win.
36
+
37
+ ```css
38
+ @theme {
39
+ --color-primary: #7c3aed;
40
+ --color-primary-hover: #5b21b6;
41
+ }
42
+ ```
43
+
44
+ ## Token data
45
+
46
+ The same tokens are published as typed data and as DTCG JSON, generated from `theme.css` so they
47
+ cannot drift.
48
+
49
+ ```ts
50
+ import { tokens } from "@averoui/tokens";
51
+
52
+ tokens.colorPrimary.cssVar; // "--color-primary"
53
+ tokens.colorPrimary.value; // "#0a66c2"
54
+ ```
55
+
56
+ Use it where a value must reach JavaScript rather than CSS — charting libraries that take colours
57
+ as props, for instance. `@averoui/tokens/tokens.json` is the DTCG form, for design tools.
58
+
59
+ ## Licence
60
+
61
+ MIT.
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@averoui/tokens",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "Avero design tokens: Tailwind CSS v4 theme, base styles, utilities and token data.",
6
+ "sideEffects": [
7
+ "*.css"
8
+ ],
9
+ "exports": {
10
+ "./theme.css": "./src/theme.css",
11
+ "./base.css": "./src/base.css",
12
+ "./utilities.css": "./src/utilities.css",
13
+ "./rich-content.css": "./src/rich-content.css",
14
+ "./tokens.json": "./src/generated/tokens.json",
15
+ ".": {
16
+ "types": "./src/generated/tokens.d.ts",
17
+ "import": "./src/generated/tokens.js"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "files": [
22
+ "src",
23
+ "LICENSE"
24
+ ],
25
+ "peerDependencies": {
26
+ "tailwindcss": "^4.3.0"
27
+ },
28
+ "devDependencies": {
29
+ "lightningcss": "1.32.0",
30
+ "tailwindcss": "^4.3.3"
31
+ },
32
+ "license": "MIT",
33
+ "author": "Faraz Pourebrahim",
34
+ "homepage": "https://github.com/FarazPourebrahim/avero",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/FarazPourebrahim/avero.git",
38
+ "directory": "packages/tokens"
39
+ },
40
+ "bugs": {
41
+ "url": "https://github.com/FarazPourebrahim/avero/issues"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public",
45
+ "provenance": true
46
+ },
47
+ "scripts": {
48
+ "generate": "node scripts/generate-token-data.mjs",
49
+ "test": "node scripts/generate-token-data.mjs --check && node scripts/check-z-order.mjs",
50
+ "contrast": "node scripts/contrast-report.mjs"
51
+ }
52
+ }
package/src/base.css ADDED
@@ -0,0 +1,68 @@
1
+ /*
2
+ * Avero document defaults (opt-in).
3
+ *
4
+ * Import this file in applications built on Avero end to end. It sets the page background, text
5
+ * color and font on <body>. Hosts with their own chrome (such as a docs
6
+ * site) should import only theme.css and utilities.css.
7
+ */
8
+
9
+ @layer base {
10
+ html {
11
+ scroll-behavior: smooth;
12
+ }
13
+
14
+ body {
15
+ min-width: 320px;
16
+ min-height: 100vh;
17
+ background-color: var(--color-background);
18
+ color: var(--color-foreground);
19
+ font-family: var(--font-sans);
20
+ text-rendering: optimizeLegibility;
21
+ -webkit-font-smoothing: antialiased;
22
+ -moz-osx-font-smoothing: grayscale;
23
+ }
24
+
25
+ a,
26
+ button {
27
+ font-family: var(--font-sans);
28
+ }
29
+
30
+ /* Every link and enabled button shows a pointer. Outlines are left alone, so focus indication
31
+ stays intact. */
32
+ a,
33
+ button:not(:disabled),
34
+ [role="button"]:not([aria-disabled="true"]) {
35
+ cursor: pointer;
36
+ }
37
+
38
+ svg,
39
+ canvas {
40
+ max-width: 100%;
41
+ }
42
+
43
+ /* Overlays (Dialog, Drawer, Popover) lock scrolling through react-remove-scroll-bar, which makes
44
+ up for the hidden scrollbar with a margin on the physical right. Browsers put a right-to-left
45
+ page's scrollbar on different sides, so instead the viewport keeps the scrollbar's space on
46
+ whichever side it is, and the margin is dropped: the page doesn't move in either direction.
47
+ Important declarations in a layer outrank the library's unlayered ones. */
48
+ html:has(body[data-scroll-locked]) {
49
+ scrollbar-gutter: stable;
50
+ }
51
+
52
+ body[data-scroll-locked] {
53
+ margin-left: 0 !important;
54
+ margin-right: 0 !important;
55
+ }
56
+ }
57
+
58
+ /* Honour reduced-motion preferences for every animation and transition. */
59
+ @media (prefers-reduced-motion: reduce) {
60
+ *,
61
+ ::before,
62
+ ::after {
63
+ animation-duration: 0.01ms !important;
64
+ animation-iteration-count: 1 !important;
65
+ transition-duration: 0.01ms !important;
66
+ scroll-behavior: auto !important;
67
+ }
68
+ }
@@ -0,0 +1,122 @@
1
+ // Generated from @averoui/tokens/src/theme.css by scripts/generate-token-data.mjs. Do not edit.
2
+ export type TokenName =
3
+ | "fontFamilySans"
4
+ | "fontFamilyCode"
5
+ | "fontSize4xs"
6
+ | "fontSize3xs"
7
+ | "fontSize2xs"
8
+ | "fontSizeSmPlus"
9
+ | "fontSizeMd"
10
+ | "fontSizeXlPlus"
11
+ | "lineHeightProse"
12
+ | "lineHeightAiry"
13
+ | "colorPrimary"
14
+ | "colorPrimaryHover"
15
+ | "colorSecondary"
16
+ | "colorBackground"
17
+ | "colorForeground"
18
+ | "colorSurface"
19
+ | "colorSurfaceGlass"
20
+ | "colorSurfaceMuted"
21
+ | "colorSurfaceSunken"
22
+ | "colorBorderSubtle"
23
+ | "colorTextStrong"
24
+ | "colorTextChrome"
25
+ | "colorTextChromeHover"
26
+ | "colorTextSubtle"
27
+ | "colorTextMuted"
28
+ | "colorAccentSocial"
29
+ | "colorIconMuted"
30
+ | "colorWarning"
31
+ | "colorWarningHover"
32
+ | "colorShadowBrand"
33
+ | "colorShadowBox"
34
+ | "colorChartViews"
35
+ | "colorChartLikes"
36
+ | "colorChartClicks"
37
+ | "colorChartComments"
38
+ | "colorChartGrid"
39
+ | "colorChartAxis"
40
+ | "colorChartCursor"
41
+ | "colorChartTooltipSurface"
42
+ | "colorChartTooltipText"
43
+ | "colorChartTooltipLabel"
44
+ | "radiusHuge"
45
+ | "radiusLeaf"
46
+ | "shadowBrandSoft"
47
+ | "shadowBrandMd"
48
+ | "shadowBrandLg"
49
+ | "shadowBrandHover"
50
+ | "shadowBrandDrop"
51
+ | "shadowBox"
52
+ | "shadowCardSoft"
53
+ | "shadowCardAmbient"
54
+ | "shadowCardFaint"
55
+ | "shadowCardSubtle"
56
+ | "shadowCardHairline"
57
+ | "shadowCardRaised"
58
+ | "shadowElevated"
59
+ | "shadowElevatedSoft"
60
+ | "shadowElevatedTight"
61
+ | "shadowFloat"
62
+ | "shadowFloatHover"
63
+ | "shadowFloatWide"
64
+ | "shadowFloatStrong"
65
+ | "shadowPop"
66
+ | "shadowPopWide"
67
+ | "shadowModal"
68
+ | "shadowLightbox"
69
+ | "dropShadowSoft"
70
+ | "dropShadowAmberSm"
71
+ | "dropShadowAmberMd"
72
+ | "blurHair"
73
+ | "blurThin"
74
+ | "blurMist"
75
+ | "blurOrb"
76
+ | "blurHaze"
77
+ | "animationSlideUp"
78
+ | "animationFadeIn"
79
+ | "animationFade"
80
+ | "animationBlink"
81
+ | "animationBlinkCaret"
82
+ | "animationSway"
83
+ | "animationShimmer"
84
+ | "animationSpinGlow"
85
+ | "animationAccordionDown"
86
+ | "animationAccordionUp"
87
+ | "zIndexRaised"
88
+ | "zIndexSticky"
89
+ | "zIndexDrawer"
90
+ | "zIndexDropdown"
91
+ | "zIndexOverlay"
92
+ | "zIndexOverlayContent"
93
+ | "zIndexModal"
94
+ | "zIndexModalContent"
95
+ | "zIndexModalNested"
96
+ | "zIndexPopover"
97
+ | "zIndexTopLayer"
98
+ | "zIndexTopLayerContent"
99
+ | "zIndexToast"
100
+ | "zIndexMax";
101
+
102
+ export type Token = { readonly cssVar: `--${string}`; readonly value: string };
103
+
104
+ export declare const tokens: Readonly<Record<TokenName, Token>>;
105
+
106
+ /** Class-name suffixes per token group (e.g. `fontSize` → `text-<suffix>`), plus Avero `@utility` names. */
107
+ export declare const tokenGroups: Readonly<{
108
+ color: readonly string[];
109
+ fontFamily: readonly string[];
110
+ fontSize: readonly string[];
111
+ lineHeight: readonly string[];
112
+ radius: readonly string[];
113
+ shadow: readonly string[];
114
+ dropShadow: readonly string[];
115
+ blur: readonly string[];
116
+ animation: readonly string[];
117
+ zIndex: readonly string[];
118
+ utility: readonly string[];
119
+ }>;
120
+
121
+ /** Returns the CSS `var()` reference for a token, for use in style props. */
122
+ export declare function tokenVar(name: TokenName): string;