@horizonmedia/blu-design-system 1.0.1 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  # Blu Design System (`@blu/design-system`)
2
2
 
3
3
  The look of Blu: color, type, spacing, radii, elevation and motion as CSS custom properties, plus
4
- base styles, type classes, a Tailwind preset and lint rules. The Blu shell and the Admin use it,
4
+ base styles, type classes, Tailwind classes (a preset for Tailwind 3, a theme for Tailwind 4) and lint rules. The Blu shell and the Admin use it,
5
5
  and so should every module.
6
6
 
7
7
  On npm it's **`@horizonmedia/blu-design-system`**. Install it under the name the docs use:
@@ -17,19 +17,34 @@ npm install @blu/design-system@npm:@horizonmedia/blu-design-system@^1
17
17
  | **A module inside the Blu shell** (federated) | Nothing to import: the shell loads the tokens and type classes on every page. Write `var(--blu-500)`, `var(--space-4)`, `class="t-h2"`. With Tailwind, add the preset (below) |
18
18
  | **An isolated (iframe) module** | `import "@blu/design-system/tokens.css"` (and `type.css` if you use the type classes) |
19
19
  | **A page that owns the whole document** (the shell, the Admin, a module's standalone page) | `import "@blu/design-system/base.css"`: tokens, type classes and a light reset |
20
- | **Tailwind** | `presets: [require/import "@blu/design-system/tailwind-preset"]`. Every class maps to a token variable |
20
+ | **Tailwind 3** | `presets: [require/import "@blu/design-system/tailwind-preset"]`. Every class maps to a token variable |
21
+ | **Tailwind 4** | `@import "@blu/design-system/tailwind-theme.css";` after `@import "tailwindcss";`. The same classes |
21
22
 
22
23
  Don't import `base.css` into a federated module: its reset would restyle the shell. A module's own
23
24
  CSS is scoped to its wrapper (`@blu/next-adapter` does this).
24
25
 
25
26
  ## Tailwind
26
27
 
28
+ Tailwind 3:
29
+
27
30
  ```js
28
31
  // tailwind.config.js
29
32
  import bluPreset from "@blu/design-system/tailwind-preset";
30
33
  export default { presets: [bluPreset], content: ["./app/**/*.{ts,tsx}", "./components/**/*.{ts,tsx}"] };
31
34
  ```
32
35
 
36
+ Tailwind 4 (design system 1.1+):
37
+
38
+ ```css
39
+ /* app/globals.css */
40
+ @import "tailwindcss";
41
+ @import "@blu/design-system/tailwind-theme.css";
42
+ ```
43
+
44
+ The theme is `@theme reference inline`: each class uses the token variable directly (`bg-blu-500` is
45
+ `var(--blu-500)`), and Tailwind emits none of the theme's names, so it never redefines the tokens.
46
+ The page must load `tokens.css`; inside the shell it already does.
47
+
33
48
  | Class family | Examples |
34
49
  |---|---|
35
50
  | Brand and accent ramps | `bg-blu-500`, `text-blu-700`, `bg-teal-50`, `text-danger-500`, `bg-chart-1` |
@@ -109,7 +124,8 @@ If Horizon confirms a web-font license, the files can be hosted privately and lo
109
124
  | `src/tokens.css` | Every token (`:root` custom properties only) |
110
125
  | `src/type.css` | The semantic type classes |
111
126
  | `src/base.css` | tokens + type + reset, for apps that own the page |
112
- | `src/tailwind-preset.js` | Tailwind preset over the tokens |
127
+ | `src/tailwind-preset.js` | Tailwind 3 preset over the tokens |
128
+ | `src/tailwind-theme.css` | Tailwind 4 theme over the tokens (the same classes as the preset) |
113
129
  | `src/adherence.oxlintrc.json` | Lint rules |
114
130
  | `source/` | The original export, unchanged, for reference (see [`source/SOURCE.md`](source/SOURCE.md)): includes the 7 React components, **compiled only**. Their sources aren't in the export yet |
115
131
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@horizonmedia/blu-design-system",
3
- "version": "1.0.1",
4
- "description": "The Blu Design System: tokens (CSS custom properties), base styles, type classes, a Tailwind preset and lint rules for Blu modules.",
3
+ "version": "1.1.0",
4
+ "description": "The Blu Design System: tokens (CSS custom properties), base styles, type classes, a Tailwind preset (Tailwind 3) and theme (Tailwind 4) and lint rules for Blu modules.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
7
7
  "repository": {
@@ -25,6 +25,7 @@
25
25
  "./tokens.css": "./tokens.css",
26
26
  "./type.css": "./type.css",
27
27
  "./base.css": "./base.css",
28
+ "./tailwind-theme.css": "./tailwind-theme.css",
28
29
  "./adherence.oxlintrc.json": "./adherence.oxlintrc.json",
29
30
  "./assets/logo-blu-blue.svg": "./assets/logo-blu-blue.svg",
30
31
  "./assets/logo-blu-navy.svg": "./assets/logo-blu-navy.svg",
@@ -0,0 +1,154 @@
1
+ /*
2
+ * Blu Design System for Tailwind 4: the same classes as tailwind-preset.js (Tailwind 3), over the
3
+ * same CSS variables from tokens.css, so a module styled with them follows the shell's tokens.
4
+ *
5
+ * @import "tailwindcss";
6
+ * @import "@blu/design-system/tailwind-theme.css";
7
+ *
8
+ * `reference inline`: Tailwind writes `var(--blu-500)` straight into each class and emits none of
9
+ * these names itself. The values come from tokens.css, which the Blu shell loads on every page
10
+ * (a page that owns the whole document imports tokens.css or base.css).
11
+ *
12
+ * Classes: bg-blu-500, text-ink, text-ink-secondary, border-line, bg-surface, bg-surface-subtle,
13
+ * text-success-500, bg-chart-1, rounded-md, shadow-md (overlays only), font-sans, text-2xs … text-6xl,
14
+ * font-medium (headings), ease-standard, duration-base.
15
+ */
16
+ @theme reference inline {
17
+ --color-blu-50: var(--blu-50);
18
+ --color-blu-100: var(--blu-100);
19
+ --color-blu-200: var(--blu-200);
20
+ --color-blu-300: var(--blu-300);
21
+ --color-blu-400: var(--blu-400);
22
+ --color-blu-500: var(--blu-500);
23
+ --color-blu-600: var(--blu-600);
24
+ --color-blu-700: var(--blu-700);
25
+ --color-blu-800: var(--blu-800);
26
+ --color-blu-900: var(--blu-900);
27
+ --color-neutral-0: var(--neutral-0);
28
+ --color-neutral-25: var(--neutral-25);
29
+ --color-neutral-50: var(--neutral-50);
30
+ --color-neutral-100: var(--neutral-100);
31
+ --color-neutral-200: var(--neutral-200);
32
+ --color-neutral-300: var(--neutral-300);
33
+ --color-neutral-400: var(--neutral-400);
34
+ --color-neutral-500: var(--neutral-500);
35
+ --color-neutral-600: var(--neutral-600);
36
+ --color-neutral-700: var(--neutral-700);
37
+ --color-neutral-800: var(--neutral-800);
38
+ --color-neutral-900: var(--neutral-900);
39
+ --color-success-50: var(--success-50);
40
+ --color-success-200: var(--success-200);
41
+ --color-success-500: var(--success-500);
42
+ --color-success-700: var(--success-700);
43
+ --color-success-900: var(--success-900);
44
+ --color-danger-50: var(--danger-50);
45
+ --color-danger-200: var(--danger-200);
46
+ --color-danger-500: var(--danger-500);
47
+ --color-danger-700: var(--danger-700);
48
+ --color-danger-900: var(--danger-900);
49
+ --color-warning-50: var(--warning-50);
50
+ --color-warning-200: var(--warning-200);
51
+ --color-warning-500: var(--warning-500);
52
+ --color-warning-700: var(--warning-700);
53
+ --color-warning-900: var(--warning-900);
54
+ --color-purple-50: var(--purple-50);
55
+ --color-purple-200: var(--purple-200);
56
+ --color-purple-500: var(--purple-500);
57
+ --color-purple-700: var(--purple-700);
58
+ --color-purple-900: var(--purple-900);
59
+ --color-teal-50: var(--teal-50);
60
+ --color-teal-200: var(--teal-200);
61
+ --color-teal-500: var(--teal-500);
62
+ --color-teal-700: var(--teal-700);
63
+ --color-teal-900: var(--teal-900);
64
+ --color-amber-50: var(--amber-50);
65
+ --color-amber-200: var(--amber-200);
66
+ --color-amber-500: var(--amber-500);
67
+ --color-amber-700: var(--amber-700);
68
+ --color-amber-900: var(--amber-900);
69
+ --color-navy-500: var(--navy-500);
70
+ --color-navy-700: var(--navy-700);
71
+ --color-navy-900: var(--navy-900);
72
+ --color-chart-1: var(--chart-1);
73
+ --color-chart-2: var(--chart-2);
74
+ --color-chart-3: var(--chart-3);
75
+ --color-chart-4: var(--chart-4);
76
+ --color-chart-5: var(--chart-5);
77
+ --color-chart-blu-1: var(--chart-blu-1);
78
+ --color-chart-blu-2: var(--chart-blu-2);
79
+ --color-chart-blu-3: var(--chart-blu-3);
80
+ --color-chart-blu-4: var(--chart-blu-4);
81
+ --color-chart-blu-5: var(--chart-blu-5);
82
+
83
+ /* Semantic names: prefer these in UI code. */
84
+ --color-ink: var(--color-text-primary);
85
+ --color-ink-secondary: var(--color-text-secondary);
86
+ --color-ink-tertiary: var(--color-text-tertiary);
87
+ --color-ink-brand: var(--color-text-brand);
88
+ --color-ink-on-brand: var(--color-text-on-brand);
89
+ --color-surface: var(--color-background-primary);
90
+ --color-surface-subtle: var(--color-background-secondary);
91
+ --color-surface-wash: var(--color-background-tertiary);
92
+ --color-surface-brand: var(--color-background-brand);
93
+ --color-line: var(--color-border-tertiary);
94
+ --color-line-secondary: var(--color-border-secondary);
95
+ --color-line-strong: var(--color-border-primary);
96
+ --color-line-focus: var(--color-border-focus);
97
+
98
+ --font-sans: var(--font-sans);
99
+ --font-narrow: var(--font-narrow);
100
+ --font-mono: var(--font-mono);
101
+ --text-2xs: var(--fs-2xs);
102
+ --text-xs: var(--fs-xs);
103
+ --text-sm: var(--fs-sm);
104
+ --text-base: var(--fs-base);
105
+ --text-md: var(--fs-md);
106
+ --text-lg: var(--fs-lg);
107
+ --text-xl: var(--fs-xl);
108
+ --text-2xl: var(--fs-2xl);
109
+ --text-3xl: var(--fs-3xl);
110
+ --text-4xl: var(--fs-4xl);
111
+ --text-5xl: var(--fs-5xl);
112
+ --text-6xl: var(--fs-6xl);
113
+ --font-weight-light: var(--fw-light);
114
+ --font-weight-normal: var(--fw-regular);
115
+ --font-weight-medium: var(--fw-medium);
116
+ --font-weight-bold: var(--fw-bold);
117
+ --font-weight-black: var(--fw-black);
118
+ --leading-tight: var(--lh-tight);
119
+ --leading-snug: var(--lh-snug);
120
+ --leading-normal: var(--lh-normal);
121
+ --leading-relaxed: var(--lh-relaxed);
122
+ --tracking-tight: var(--tracking-tight);
123
+ --tracking-normal: var(--tracking-normal);
124
+ --tracking-wide: var(--tracking-wide);
125
+ --radius-xs: var(--radius-xs);
126
+ --radius-sm: var(--radius-sm);
127
+ --radius-md: var(--radius-md);
128
+ --radius-lg: var(--radius-lg);
129
+ --radius-xl: var(--radius-xl);
130
+ --radius-2xl: var(--radius-2xl);
131
+ --radius-pill: var(--radius-pill);
132
+ /* Depth is border weight; shadows are for overlays (menus, dialogs) only. */
133
+ --shadow-xs: var(--shadow-xs);
134
+ --shadow-sm: var(--shadow-sm);
135
+ --shadow-md: var(--shadow-md);
136
+ --shadow-lg: var(--shadow-lg);
137
+ --shadow-xl: var(--shadow-xl);
138
+ --shadow-focus: var(--shadow-focus);
139
+ --ease-standard: var(--easing-standard);
140
+ }
141
+
142
+ /* Tailwind 4 has no theme names for durations: these are utilities. */
143
+ @utility duration-fast {
144
+ --tw-duration: var(--duration-fast);
145
+ transition-duration: var(--duration-fast);
146
+ }
147
+ @utility duration-base {
148
+ --tw-duration: var(--duration-base);
149
+ transition-duration: var(--duration-base);
150
+ }
151
+ @utility duration-moderate {
152
+ --tw-duration: var(--duration-moderate);
153
+ transition-duration: var(--duration-moderate);
154
+ }