@nyxwire/tailwind 0.0.0-stage → 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.
@@ -0,0 +1,225 @@
1
+ # Utilities & variants
2
+
3
+ > Cut corners, wire edges, glow, text glow, the wire gradient, glass, scanlines, the circuit grid, glitch, animations, and the flavor variants of @nyxwire/tailwind, with live examples.
4
+
5
+ The theme adds the Nyxwire motifs as Tailwind utilities. Every example on this page is rendered with the real utilities; switch the flavor in the header to see them follow it. The class-only equivalents for plain HTML (`.nw-cut`, `.nw-wire`, `.nw-glow-md`, …) are on [Effects & motion](foundations/effects-motion.md).
6
+
7
+ ## Cut corners
8
+
9
+ `cut` chamfers the top-right and bottom-left corners by `--nw-cut` (10px by default). The fill is a background gradient with transparent corners, and the 1px edge is a `::before` layer clipped to the chamfered ring, so the element itself stays unclipped. A cut element is therefore painted through these inputs instead of the usual utilities:
10
+
11
+ | Input | Default | Paints |
12
+ | ----------- | ------------ | -------------------------- |
13
+ | `--nw-fill` | `--nw-panel` | The surface inside the cut |
14
+ | `--nw-edge` | `--nw-line` | The 1px edge |
15
+ | `--nw-cut` | `10px` | The size of each chamfer |
16
+
17
+ ```html
18
+ <div class="cut p-5 font-semibold">cut</div>
19
+ <div class="cut p-5 font-semibold [--nw-edge:var(--nw-primary)]">cut with a primary edge</div>
20
+ <div class="cut p-5 font-semibold text-on-primary [--nw-cut:18px] [--nw-edge:transparent] [--nw-fill:var(--nw-primary)]">
21
+ 18px cut, primary fill
22
+ </div>
23
+ ```
24
+
25
+ ```html
26
+ <div class="cut p-5">…</div>
27
+ <button class="cut px-5 py-3 text-on-primary [--nw-cut:12px] [--nw-fill:var(--nw-primary)]">
28
+ Deploy
29
+ </button>
30
+ ```
31
+
32
+ `cut` resets the border and the radius and sets its own background, so `bg-*`, `border` and `rounded-*` on the same element are dropped when classes are merged with [`cn()`](merging.md). On images, video, canvas, SVG and iframes it clips the media itself.
33
+
34
+ ## Wire edge
35
+
36
+ `wire` draws a 1px primary-to-secondary gradient border with the padding-box/border-box background trick, so the fill must be opaque: it comes from `--nw-fill` as well. On a `cut` element the gradient becomes the edge of the chamfered shape. `wire-glow` adds the wire-colored bloom.
37
+
38
+ ```html
39
+ <div class="wire rounded-lg p-5 font-semibold">wire</div>
40
+ <div class="wire wire-glow rounded-lg p-5 font-semibold">wire wire-glow</div>
41
+ <div class="cut wire wire-glow p-5 font-semibold">cut wire wire-glow</div>
42
+ ```
43
+
44
+ ```html
45
+ <div class="wire wire-glow rounded-lg p-5">…</div>
46
+ <div class="cut wire wire-glow p-5 [--nw-fill:var(--nw-canvas-subtle)]">…</div>
47
+ ```
48
+
49
+ ## Glow
50
+
51
+ `glow-sm`, `glow-md` and `glow-lg` set a box shadow from `--nw-glow-sm`, `--nw-glow-md` and `--nw-glow-lg`. Their color comes from `--nw-glow-color`, which defaults to the primary intent. Pick another color with `glow-<color>`: any semantic key (`glow-danger`), any raw key (`glow-nw-flux`), or the short raw form (`glow-flux`). A color utility only selects the color; it draws nothing on its own.
52
+
53
+ ```html
54
+ <div class="rounded-lg border border-primary/60 bg-panel p-4 font-mono text-sm glow-sm">
55
+ glow-sm
56
+ </div>
57
+ <div class="rounded-lg border border-primary/60 bg-panel p-4 font-mono text-sm glow-md">
58
+ glow-md
59
+ </div>
60
+ <div class="rounded-lg border border-primary/60 bg-panel p-4 font-mono text-sm glow-lg">
61
+ glow-lg
62
+ </div>
63
+ <div class="rounded-lg border border-nw-flux/60 bg-panel p-4 font-mono text-sm glow-md glow-flux">
64
+ glow-md glow-flux
65
+ </div>
66
+ <div class="rounded-lg border border-success/60 bg-panel p-4 font-mono text-sm glow-md glow-success">
67
+ glow-md glow-success
68
+ </div>
69
+ <div class="cut p-4 font-mono text-sm glow-md glow-danger [--nw-edge:var(--nw-danger)]">
70
+ cut glow-md glow-danger
71
+ </div>
72
+ ```
73
+
74
+ ```html
75
+ <button class="rounded-md bg-primary px-4 py-2 text-on-primary glow-sm">Connect</button>
76
+ <div class="rounded-lg border border-nw-flux/60 glow-md glow-flux">…</div>
77
+ ```
78
+
79
+ On a `cut` element the glow becomes a `filter: drop-shadow(…)`, which follows the chamfered shape where a box shadow would draw the full rectangle. Glow strength scales with `--nw-flavor-dark`, so it is quieter on Lumen, where a full glow would smudge. Glow is an effect, not elevation: it sets `box-shadow`, so it replaces a `shadow-*` on the same element.
80
+
81
+ ## Text glow
82
+
83
+ `text-glow` adds `--nw-glow-text`. It shares `--nw-glow-color` with the box glow, so `text-glow-<color>` picks its color the same way.
84
+
85
+ ```html
86
+ <p class="m-0 font-display text-3xl font-semibold text-primary text-glow">
87
+ text-primary text-glow
88
+ </p>
89
+ <p class="m-0 font-display text-3xl font-semibold text-nw-ice text-glow text-glow-ice">
90
+ text-nw-ice text-glow text-glow-ice
91
+ </p>
92
+ <p class="m-0 font-mono text-sm text-success text-glow text-glow-success">
93
+ LINK UP · text-success text-glow text-glow-success
94
+ </p>
95
+ ```
96
+
97
+ Keep text glow for short labels and headings; body text stays crisp without it. A box glow and a text glow on the same element share one color, so use nested elements when they need two.
98
+
99
+ ## Wire gradient
100
+
101
+ `bg-wire` paints `--nw-gradient-wire` (135°, primary to secondary) as a fill. `text-wire` clips the same gradient to the glyphs and makes the text color transparent, so do not combine it with a `text-*` color. In forced-colors mode it falls back to solid system text.
102
+
103
+ ```html
104
+ <p class="m-0 font-display text-5xl font-bold tracking-tight text-wire">text-wire</p>
105
+ <div class="rounded-lg bg-wire px-5 py-4 font-semibold text-on-primary">
106
+ bg-wire with text-on-primary
107
+ </div>
108
+ ```
109
+
110
+ Check contrast against the rendered surface when you use `text-wire` with a custom accent.
111
+
112
+ ## Glass
113
+
114
+ `glass` fills an element with `--nw-glass` and blurs what is behind it by `--nw-blur-md`. Its look depends on the backdrop, here the circuit grid:
115
+
116
+ ```html
117
+ <div class="glass rounded-lg border border-line px-5 py-4 font-semibold">glass</div>
118
+ <div class="glass scanlines rounded-lg border border-line px-5 py-4 font-semibold">
119
+ glass scanlines
120
+ </div>
121
+ ```
122
+
123
+ `glass` replaces an earlier `bg-*` color or `backdrop-blur-*` when classes are merged with [`cn()`](merging.md); a color written after it still applies.
124
+
125
+ ## Scanlines and circuit grid
126
+
127
+ | Utility | Paints |
128
+ | ----------- | ----------------------------------------------------------------------------------------------------------------- |
129
+ | `scanlines` | `--nw-scanlines` on a pointer-transparent `::after` overlay; clipped to the shape on a `cut` element |
130
+ | `grid-bg` | The circuit grid: `--nw-grid-line` lines every `--nw-grid-size` (32px), with a primary node every fourth crossing |
131
+
132
+ ```html
133
+ <div class="scanlines rounded-lg border border-line bg-panel p-5 font-semibold">scanlines</div>
134
+ <div class="cut scanlines p-5 font-semibold">cut scanlines</div>
135
+ <div class="grid-bg rounded-lg border border-line p-5 font-semibold">grid-bg</div>
136
+ ```
137
+
138
+ > **Caution**
139
+ >
140
+ > `cut` reserves `::before` and `scanlines` reserves `::after`. `grid-bg`, `cut`, `wire`, `bg-wire`
141
+ > and `text-wire` all paint the background, so put `grid-bg` on its own element when you combine it
142
+ > with the others.
143
+
144
+ ## Glitch
145
+
146
+ `glitch` runs one 480ms glitch burst when the element is hovered or focused, or when a link or button around it is. Inline elements become `inline-block` so the jitter can move them. It does nothing under `prefers-reduced-motion: reduce`.
147
+
148
+ ```html
149
+ <a href="#glitch" class="glitch font-display text-2xl font-bold text-primary">
150
+ Hover or focus me
151
+ </a>
152
+ <button type="button" class="nw-btn nw-btn-outline">
153
+ <span class="glitch">Glitch inside a button</span>
154
+ </button>
155
+ ```
156
+
157
+ ```html
158
+ <a href="/status" class="glitch font-display text-2xl">Status</a>
159
+ <button class="nw-btn"><span class="glitch">Reboot</span></button>
160
+ ```
161
+
162
+ ## Animations
163
+
164
+ The decorative loops, rendered with the animation utilities from the [theme](theme-reference.md#animations):
165
+
166
+ ```html
167
+ <div class="rounded-lg border border-primary/60 bg-panel p-4 font-mono text-sm animate-glow-pulse">
168
+ animate-glow-pulse
169
+ </div>
170
+ <div class="rounded-lg border border-line bg-panel p-4 font-mono text-sm animate-pulse">
171
+ animate-pulse
172
+ </div>
173
+ <div class="rounded-lg bg-wire bg-size-[200%_100%] p-4 font-mono text-sm text-on-primary animate-shimmer">
174
+ animate-shimmer
175
+ </div>
176
+ <div class="flex items-center gap-3 rounded-lg border border-line bg-panel p-4 font-mono text-sm">
177
+ <span
178
+ class="size-4 rounded-full border-2 border-line border-t-primary animate-spin"
179
+ aria-hidden="true"
180
+ ></span>
181
+ animate-spin
182
+ </div>
183
+ ```
184
+
185
+ ```html
186
+ <div class="rounded-lg border border-danger/60 glow-danger animate-glow-pulse">Alarm</div>
187
+ <div class="bg-wire bg-size-[200%_100%] animate-shimmer">Syncing</div>
188
+ ```
189
+
190
+ `animate-shimmer` slides the background, so give it an image wider than the element (`bg-size-[200%_100%]`). With `prefers-reduced-motion: reduce`, the base stylesheet collapses every decorative animation to one near-instant iteration; turn on reduced motion in your system settings and the tiles stand still.
191
+
192
+ ## Variants
193
+
194
+ | Variant | Applies when |
195
+ | -------------------------------------------- | ------------------------------------------------------------------------------ |
196
+ | `abyss:`, `nocturne:`, `twilight:`, `lumen:` | the element or an ancestor has that `data-flavor` |
197
+ | `dark:` | the element or an ancestor has a dark flavor (`abyss`, `nocturne`, `twilight`) |
198
+ | `light:` | the element or an ancestor has `data-flavor="lumen"` |
199
+
200
+ The line below holds one sentence per flavor, and only the current one is visible. Switch the flavor in the header:
201
+
202
+ ```html
203
+ <p class="m-0 font-display text-xl font-semibold">
204
+ <span class="hidden abyss:inline">
205
+ abyss: Near-black indigo, for dense dashboards and HUDs.
206
+ </span>
207
+ <span class="hidden nocturne:inline">nocturne: Deep electric indigo, the default.</span>
208
+ <span class="hidden twilight:inline">twilight: Dusky violet-indigo, the softest dark.</span>
209
+ <span class="hidden lumen:inline">lumen: Lavender daylight, the light flavor.</span>
210
+ </p>
211
+ ```
212
+
213
+ ```html
214
+ <span class="hidden twilight:inline">…</span>
215
+ <div class="bg-panel abyss:bg-canvas-sunken">…</div>
216
+ ```
217
+
218
+ The variants match ancestors, and a nested scope does not cancel an outer one. This Lumen scope sits inside the page: on a dark page both badges show, on Lumen only `light:` does.
219
+
220
+ ```html
221
+ <span class="nw-badge nw-badge-info hidden dark:inline-flex">dark: matches</span>
222
+ <span class="nw-badge nw-badge-success hidden light:inline-flex">light: matches</span>
223
+ ```
224
+
225
+ Prefer semantic utilities (`bg-canvas`, `text-fg`, `border-line`): they resolve in the nearest scope, nested or not. Keep variants for changes the tokens cannot express, such as a different layout or motif per flavor. The variants read `data-flavor` only, so set it explicitly: the Astro and Starlight flavor runtimes set it on `<html>`, and `NwProvider`'s `flavor` prop sets it on a Vue scope.
@@ -0,0 +1,9 @@
1
+ import type { ConfigExtension, DefaultClassGroupIds, DefaultThemeGroupIds } from 'tailwind-merge';
2
+ export type NyxwireClassGroupIds = 'nw-cut' | 'nw-wire' | 'nw-grid' | 'nw-glow-color' | 'nw-scanlines' | 'nw-glitch' | 'nw-glass' | 'nw-text-wire';
3
+ export type ClassDictionary = {
4
+ readonly [className: string]: unknown;
5
+ };
6
+ export type ClassValue = string | number | bigint | boolean | null | undefined | ClassDictionary | readonly ClassValue[];
7
+ export type TwMergeConfig = ConfigExtension<DefaultClassGroupIds | NyxwireClassGroupIds, DefaultThemeGroupIds>;
8
+ export declare const twMergeConfig: TwMergeConfig;
9
+ export declare function cn(...inputs: readonly ClassValue[]): string;
package/dist/merge.js ADDED
@@ -0,0 +1,113 @@
1
+ import { extendTailwindMerge, fromTheme } from 'tailwind-merge';
2
+ const roundedGroups = [
3
+ 'rounded',
4
+ 'rounded-s',
5
+ 'rounded-e',
6
+ 'rounded-t',
7
+ 'rounded-r',
8
+ 'rounded-b',
9
+ 'rounded-l',
10
+ 'rounded-ss',
11
+ 'rounded-se',
12
+ 'rounded-ee',
13
+ 'rounded-es',
14
+ 'rounded-tl',
15
+ 'rounded-tr',
16
+ 'rounded-br',
17
+ 'rounded-bl',
18
+ ];
19
+ const borderWidthGroups = [
20
+ 'border-w',
21
+ 'border-w-x',
22
+ 'border-w-y',
23
+ 'border-w-s',
24
+ 'border-w-e',
25
+ 'border-w-bs',
26
+ 'border-w-be',
27
+ 'border-w-t',
28
+ 'border-w-r',
29
+ 'border-w-b',
30
+ 'border-w-l',
31
+ ];
32
+ const borderColorGroups = [
33
+ 'border-color',
34
+ 'border-color-x',
35
+ 'border-color-y',
36
+ 'border-color-s',
37
+ 'border-color-e',
38
+ 'border-color-bs',
39
+ 'border-color-be',
40
+ 'border-color-t',
41
+ 'border-color-r',
42
+ 'border-color-b',
43
+ 'border-color-l',
44
+ ];
45
+ export const twMergeConfig = {
46
+ extend: {
47
+ theme: {
48
+ text: ['2xs'],
49
+ radius: ['xs', 'sm', 'md', 'lg', 'xl', '2xl'],
50
+ ease: ['standard', 'out', 'in', 'in-out', 'back'],
51
+ animate: [
52
+ 'spin',
53
+ 'pulse',
54
+ 'glow-pulse',
55
+ 'shimmer',
56
+ 'glitch',
57
+ 'fade-in',
58
+ 'fade-out',
59
+ 'zoom-in',
60
+ 'zoom-out',
61
+ 'slide-in-from-top',
62
+ 'slide-in-from-bottom',
63
+ 'slide-in-from-left',
64
+ 'slide-in-from-right',
65
+ 'slide-out-to-top',
66
+ 'slide-out-to-bottom',
67
+ 'slide-out-to-left',
68
+ 'slide-out-to-right',
69
+ ],
70
+ },
71
+ classGroups: {
72
+ shadow: ['glow-sm', 'glow-md', 'glow-lg', 'wire-glow'],
73
+ 'text-shadow': ['text-glow'],
74
+ 'nw-glow-color': [{ glow: [fromTheme('color')], 'text-glow': [fromTheme('color')] }],
75
+ 'bg-image': ['bg-wire'],
76
+ 'nw-cut': ['cut'],
77
+ 'nw-wire': ['wire'],
78
+ 'nw-grid': ['grid-bg'],
79
+ 'nw-scanlines': ['scanlines'],
80
+ 'nw-glitch': ['glitch'],
81
+ 'nw-glass': ['glass'],
82
+ 'nw-text-wire': ['text-wire'],
83
+ },
84
+ conflictingClassGroups: {
85
+ 'nw-cut': [...roundedGroups, ...borderWidthGroups, 'bg-color', 'nw-grid'],
86
+ 'nw-wire': [...borderColorGroups, 'nw-grid'],
87
+ 'nw-grid': ['nw-cut', 'nw-wire'],
88
+ 'nw-glass': ['bg-color', 'backdrop-blur'],
89
+ 'nw-text-wire': ['bg-image', 'text-color', 'bg-clip', 'nw-grid'],
90
+ 'bg-image': ['nw-grid'],
91
+ 'bg-size': ['nw-grid'],
92
+ },
93
+ },
94
+ };
95
+ const merge = extendTailwindMerge(twMergeConfig);
96
+ function join(input) {
97
+ if (!input)
98
+ return '';
99
+ if (typeof input === 'string' || typeof input === 'number' || typeof input === 'bigint') {
100
+ return String(input);
101
+ }
102
+ if (typeof input === 'boolean')
103
+ return '';
104
+ if (Array.isArray(input))
105
+ return input.map(join).filter(Boolean).join(' ');
106
+ return Object.entries(input)
107
+ .filter(([, enabled]) => Boolean(enabled))
108
+ .map(([name]) => name)
109
+ .join(' ');
110
+ }
111
+ export function cn(...inputs) {
112
+ return merge(inputs.map(join));
113
+ }
package/index.css ADDED
@@ -0,0 +1,4 @@
1
+ @import '@nyxwire/css/tokens.css';
2
+ @import '@nyxwire/css/fonts.css';
3
+ @import '@nyxwire/css/base.css';
4
+ @import './theme.css';
package/package.json CHANGED
@@ -1,6 +1,66 @@
1
1
  {
2
2
  "name": "@nyxwire/tailwind",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Nyxwire's Tailwind CSS v4 theme: palette and role colors, fonts, motif utilities and class merging.",
5
+ "keywords": [
6
+ "nyxwire",
7
+ "design-system",
8
+ "tailwindcss",
9
+ "tailwindcss-v4",
10
+ "tailwind-theme"
11
+ ],
12
+ "homepage": "https://nyxwire.dissidence.ovh/tailwind/setup/",
13
+ "bugs": {
14
+ "url": "https://github.com/fmauNeko/nyxwire/issues"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/fmauNeko/nyxwire.git",
19
+ "directory": "packages/tailwind"
20
+ },
21
+ "license": "MIT",
22
+ "author": "Florian Maunier",
23
+ "type": "module",
24
+ "files": [
25
+ "dist",
26
+ "index.css",
27
+ "theme.css"
28
+ ],
29
+ "skills": [
30
+ "npm:@nyxwire/css"
31
+ ],
32
+ "sideEffects": [
33
+ "**/*.css"
34
+ ],
35
+ "exports": {
36
+ ".": "./index.css",
37
+ "./theme.css": "./theme.css",
38
+ "./merge": {
39
+ "types": "./dist/merge.d.ts",
40
+ "import": "./dist/merge.js"
41
+ }
42
+ },
43
+ "dependencies": {
44
+ "tailwind-merge": "3.7.0",
45
+ "@nyxwire/css": "0.1.0"
46
+ },
47
+ "peerDependencies": {
48
+ "tailwindcss": "^4"
49
+ },
50
+ "devDependencies": {
51
+ "@tailwindcss/cli": "4.3.5",
52
+ "@types/node": "^26",
53
+ "tailwindcss": "4.3.5",
54
+ "typescript": "6.0.3",
55
+ "vitest": "5.1.0"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public"
59
+ },
60
+ "scripts": {
61
+ "build": "tsc -p tsconfig.build.json && node ../agent-docs/src/run.ts",
62
+ "test": "vitest run",
63
+ "typecheck": "tsc --noEmit -p tsconfig.json",
64
+ "demo": "tailwindcss -i demo/input.css -o demo/output.css && node demo/copy-fonts.ts"
65
+ }
6
66
  }