@wrikka/theme 0.1.0 → 0.1.3
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 +9 -6
- package/dist/{brand-CzIW-imW.d.mts → brand-DIJLf6Xs.d.mts} +0 -4
- package/dist/{css-vars-vNnaKbWz.mjs → css-vars-WEUFBMjy.mjs} +9 -18
- package/dist/index.d.mts +1 -13
- package/dist/index.mjs +2 -3
- package/dist/preset.d.mts +1 -3
- package/dist/preset.mjs +2 -3
- package/dist/vite.d.mts +58 -0
- package/dist/vite.mjs +100 -0
- package/package.json +60 -51
- package/src/styles/theme.css +22 -22
- package/src/styles/tokens.dtcg.json +396 -396
package/README.md
CHANGED
|
@@ -7,21 +7,23 @@ Design tokens, theme presets, theme CSS, and the shared UnoCSS config behind
|
|
|
7
7
|
|
|
8
8
|
 
|
|
9
9
|
|
|
10
|
-
| api
|
|
11
|
-
|
|
12
|
-
| `@wrikka/theme`
|
|
13
|
-
| `@wrikka/theme/preset`
|
|
14
|
-
| `@wrikka/theme/uno`
|
|
15
|
-
| `@wrikka/theme/styles/*` | Theme CSS: `tokens.css`, `theme.css`, `markdown.css`
|
|
10
|
+
| api | description | options | default |
|
|
11
|
+
| ------------------------ | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ------- |
|
|
12
|
+
| `@wrikka/theme` | Token scales, color schemes, presets, and CSS-variable builders | — | — |
|
|
13
|
+
| `@wrikka/theme/preset` | UnoCSS preset mapping tokens to `var(--color-*)` / `var(--su-*)` | `color`, `font`, `space`, `radius`, `mode`, `brand`, `preflight` | — |
|
|
14
|
+
| `@wrikka/theme/uno` | Shared UnoCSS config (presetWind4 + token rules) | — | — |
|
|
15
|
+
| `@wrikka/theme/styles/*` | Theme CSS: `tokens.css`, `theme.css`, `markdown.css` | — | — |
|
|
16
16
|
|
|
17
17
|
## Get Started
|
|
18
18
|
|
|
19
19
|
1. Import the tokens and theme CSS once at your app entry
|
|
20
|
+
|
|
20
21
|
```ts
|
|
21
22
|
import "@wrikka/theme/styles/tokens.css";
|
|
22
23
|
import "@wrikka/theme/styles/theme.css";
|
|
23
24
|
```
|
|
24
25
|
2. Extend the shared UnoCSS config
|
|
26
|
+
|
|
25
27
|
```ts
|
|
26
28
|
import { defineConfig } from "unocss";
|
|
27
29
|
import baseConfig from "@wrikka/theme/uno";
|
|
@@ -32,6 +34,7 @@ Design tokens, theme presets, theme CSS, and the shared UnoCSS config behind
|
|
|
32
34
|
});
|
|
33
35
|
```
|
|
34
36
|
3. Optional: swap tokens at runtime with the preset
|
|
37
|
+
|
|
35
38
|
```ts
|
|
36
39
|
import { presetSolidUI } from "@wrikka/theme/preset";
|
|
37
40
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/theme/types.d.ts
|
|
2
1
|
type ThemeMode = "light" | "dark";
|
|
3
2
|
type ThemeColor = "auto" | "slate" | "blue" | "indigo" | "violet" | "rose" | "pink" | "red" | "orange" | "amber" | "yellow" | "green" | "teal" | "cyan";
|
|
4
3
|
type ThemeFont = "sans" | "serif" | "mono" | "thai";
|
|
@@ -36,8 +35,6 @@ interface ColorScheme {
|
|
|
36
35
|
light: ColorSet;
|
|
37
36
|
dark: ColorSet;
|
|
38
37
|
}
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region src/theme/brand.d.ts
|
|
41
38
|
/** A brand color per mode, for palettes that need a brighter dark-mode fill. */
|
|
42
39
|
interface BrandPair {
|
|
43
40
|
light: string;
|
|
@@ -68,5 +65,4 @@ declare function brandForMode(brand: BrandInput, mode?: ThemeMode): string;
|
|
|
68
65
|
declare function brandRamp(brand: BrandInput, mode?: ThemeMode): BrandRamp;
|
|
69
66
|
/** CSS custom properties consumed by theme.css / the UnoCSS preset. */
|
|
70
67
|
declare function brandVars(brand: BrandInput, mode?: ThemeMode): Record<string, string>;
|
|
71
|
-
//#endregion
|
|
72
68
|
export { ThemeState as _, brandRamp as a, readableForeground as c, ThemeColor as d, ThemeFont as f, ThemeSpace as g, ThemeRadius as h, brandForMode as i, ColorScheme as l, ThemePreset as m, BrandPair as n, brandVars as o, ThemeMode as p, BrandRamp as r, normalizeBrand as s, BrandInput as t, ColorSet as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/theme/color-math.ts
|
|
2
2
|
const TRIPLET$1 = /^([\d.]+)\s+([\d.]+)%\s+([\d.]+)%$/;
|
|
3
3
|
const HEX = /^#([0-9a-f]{6})$/i;
|
|
4
4
|
const isHslTriplet = (value) => TRIPLET$1.test(value.trim());
|
|
@@ -65,8 +65,7 @@ function round(value) {
|
|
|
65
65
|
return Number(value.toFixed(1));
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
//#region src/theme/hsl.ts
|
|
68
|
+
// src/theme/hsl.ts
|
|
70
69
|
const TRIPLET = /^([\d.]+)\s+([\d.]+)%\s+([\d.]+)%$/;
|
|
71
70
|
/**
|
|
72
71
|
* Soft surfaces keep the family hue and scale saturation/lightness instead of
|
|
@@ -130,8 +129,7 @@ function alphaVars(mode) {
|
|
|
130
129
|
};
|
|
131
130
|
}
|
|
132
131
|
|
|
133
|
-
|
|
134
|
-
//#region src/theme/brand.ts
|
|
132
|
+
// src/theme/brand.ts
|
|
135
133
|
/**
|
|
136
134
|
* Brand ramp — one brand color in, the full primary token set out.
|
|
137
135
|
*
|
|
@@ -200,8 +198,7 @@ function brandVars(brand, mode = "light") {
|
|
|
200
198
|
};
|
|
201
199
|
}
|
|
202
200
|
|
|
203
|
-
|
|
204
|
-
//#region src/theme/colors/blue-family.ts
|
|
201
|
+
// src/theme/colors/blue-family.ts
|
|
205
202
|
const blueFamilySchemes = {
|
|
206
203
|
slate: {
|
|
207
204
|
light: {
|
|
@@ -317,8 +314,7 @@ const blueFamilySchemes = {
|
|
|
317
314
|
}
|
|
318
315
|
};
|
|
319
316
|
|
|
320
|
-
|
|
321
|
-
//#region src/theme/colors/cool.ts
|
|
317
|
+
// src/theme/colors/cool.ts
|
|
322
318
|
const coolSchemes = {
|
|
323
319
|
green: {
|
|
324
320
|
light: {
|
|
@@ -406,8 +402,7 @@ const coolSchemes = {
|
|
|
406
402
|
}
|
|
407
403
|
};
|
|
408
404
|
|
|
409
|
-
|
|
410
|
-
//#region src/theme/colors/warm.ts
|
|
405
|
+
// src/theme/colors/warm.ts
|
|
411
406
|
const warmSchemes = {
|
|
412
407
|
rose: {
|
|
413
408
|
light: {
|
|
@@ -579,16 +574,14 @@ const warmSchemes = {
|
|
|
579
574
|
}
|
|
580
575
|
};
|
|
581
576
|
|
|
582
|
-
|
|
583
|
-
//#region src/theme/colors.ts
|
|
577
|
+
// src/theme/colors.ts
|
|
584
578
|
const colorSchemes = {
|
|
585
579
|
...blueFamilySchemes,
|
|
586
580
|
...warmSchemes,
|
|
587
581
|
...coolSchemes
|
|
588
582
|
};
|
|
589
583
|
|
|
590
|
-
|
|
591
|
-
//#region src/theme/scales.ts
|
|
584
|
+
// src/theme/scales.ts
|
|
592
585
|
const fontStacks = {
|
|
593
586
|
sans: "system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Noto Sans Thai\", \"IBM Plex Sans Thai\", \"Helvetica Neue\", Arial, sans-serif",
|
|
594
587
|
serif: "Georgia, Cambria, \"Times New Roman\", Times, serif",
|
|
@@ -752,8 +745,7 @@ const radiusScales = {
|
|
|
752
745
|
}
|
|
753
746
|
};
|
|
754
747
|
|
|
755
|
-
|
|
756
|
-
//#region src/theme/css-vars.ts
|
|
748
|
+
// src/theme/css-vars.ts
|
|
757
749
|
const SOFT_FAMILIES = [
|
|
758
750
|
"primary",
|
|
759
751
|
"destructive",
|
|
@@ -855,5 +847,4 @@ function brandCssVars(brand) {
|
|
|
855
847
|
].join("\n");
|
|
856
848
|
}
|
|
857
849
|
|
|
858
|
-
//#endregion
|
|
859
850
|
export { tripletContrast as A, contrastRatio as C, isHslTriplet as D, hslTripletToRgb as E, relativeLuminance as O, softTriplet as S, hexToRgb as T, adjustLightness as _, varsForState as a, hsl as b, leadingScales as c, colorSchemes as d, brandForMode as f, readableForeground as g, normalizeBrand as h, varsForMode as i, rgbToHslTriplet as k, radiusScales as l, brandVars as m, cssVarsForTheme as n, densityScales as o, brandRamp as p, softVars as r, fontStacks as s, brandCssVars as t, spaceScales as u, alphaVars as v, hexToHslTriplet as w, inkTriplet as x, deepTriplet as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { _ as ThemeState, a as brandRamp, c as readableForeground, d as ThemeColor, f as ThemeFont, g as ThemeSpace, h as ThemeRadius, i as brandForMode, l as ColorScheme, m as ThemePreset, n as BrandPair, o as brandVars, p as ThemeMode, r as BrandRamp, s as normalizeBrand, t as BrandInput, u as ColorSet } from "./brand-
|
|
2
|
-
//#region src/theme/color-math.d.ts
|
|
1
|
+
import { _ as ThemeState, a as brandRamp, c as readableForeground, d as ThemeColor, f as ThemeFont, g as ThemeSpace, h as ThemeRadius, i as brandForMode, l as ColorScheme, m as ThemePreset, n as BrandPair, o as brandVars, p as ThemeMode, r as BrandRamp, s as normalizeBrand, t as BrandInput, u as ColorSet } from "./brand-DIJLf6Xs.mjs";
|
|
3
2
|
/**
|
|
4
3
|
* Color math shared by the brand ramp and the token health audit.
|
|
5
4
|
*
|
|
@@ -21,11 +20,7 @@ export declare function relativeLuminance([r, g, b]: Rgb): number;
|
|
|
21
20
|
export declare function contrastRatio(a: Rgb, b: Rgb): number;
|
|
22
21
|
/** Contrast between two "h s% l%" triplets; undefined when either fails to parse. */
|
|
23
22
|
export declare function tripletContrast(a: string, b: string): number | undefined;
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region src/theme/colors.d.ts
|
|
26
23
|
export declare const colorSchemes: Record<Exclude<ThemeColor, "auto">, ColorScheme>;
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region src/theme/css-vars.d.ts
|
|
29
24
|
/** Soft/ink/deep surfaces for the families that carry them; neutral accent has no family. */
|
|
30
25
|
export declare function softVars(colorSet: ColorSet, mode: ThemeMode): Record<string, string>;
|
|
31
26
|
/** Same lightness adjustments applyThemeState uses at runtime. */
|
|
@@ -41,8 +36,6 @@ export declare function cssVarsForTheme(state: ThemeState, color?: Exclude<Theme
|
|
|
41
36
|
* emitted after cssVarsForTheme so it wins on cascade order.
|
|
42
37
|
*/
|
|
43
38
|
export declare function brandCssVars(brand: BrandInput): string;
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region src/theme/hsl.d.ts
|
|
46
39
|
export declare function hsl(h: number, s: number, l: number): string;
|
|
47
40
|
/** Shift the lightness channel of an "h s% l%" string, clamped to 0–100. */
|
|
48
41
|
export declare function adjustLightness(hslValue: string, delta: number): string;
|
|
@@ -54,16 +47,12 @@ export declare function inkTriplet(value: string, mode: ThemeMode): string;
|
|
|
54
47
|
export declare function deepTriplet(value: string): string;
|
|
55
48
|
/** Translucent brand levels applied over any surface: `hsl(var(--color-primary) / var(--su-alpha-<level>))`. */
|
|
56
49
|
export declare function alphaVars(mode: ThemeMode): Record<string, string>;
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region src/theme/presets.d.ts
|
|
59
50
|
/**
|
|
60
51
|
* Weekday themes ΓÇö Thai weekday colors: Sunday red, Monday yellow,
|
|
61
52
|
* Tuesday pink, Wednesday green, Thursday orange, Friday blue,
|
|
62
53
|
* Saturday violet. Matches `weekdayColors` in store.ts.
|
|
63
54
|
*/
|
|
64
55
|
export declare const presets: ThemePreset[];
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region src/theme/scales.d.ts
|
|
67
56
|
export declare const fontStacks: Record<ThemeFont, string>;
|
|
68
57
|
/**
|
|
69
58
|
* Line heights per font. Thai stacks carry stacked vowels and tone marks above
|
|
@@ -88,5 +77,4 @@ export declare const radiusScales: Record<ThemeRadius, {
|
|
|
88
77
|
lg: string;
|
|
89
78
|
xl: string;
|
|
90
79
|
}>;
|
|
91
|
-
//#endregion
|
|
92
80
|
export { BrandInput, BrandPair, BrandRamp, ColorScheme, ColorSet, ThemeColor, ThemeFont, ThemeMode, ThemePreset, ThemeRadius, ThemeSpace, ThemeState, brandForMode, brandRamp, brandVars, normalizeBrand, readableForeground };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as tripletContrast, C as contrastRatio, D as isHslTriplet, E as hslTripletToRgb, O as relativeLuminance, S as softTriplet, T as hexToRgb, _ as adjustLightness, a as varsForState, b as hsl, c as leadingScales, d as colorSchemes, f as brandForMode, g as readableForeground, h as normalizeBrand, i as varsForMode, k as rgbToHslTriplet, l as radiusScales, m as brandVars, n as cssVarsForTheme, o as densityScales, p as brandRamp, r as softVars, s as fontStacks, t as brandCssVars, u as spaceScales, v as alphaVars, w as hexToHslTriplet, x as inkTriplet, y as deepTriplet } from "./css-vars-
|
|
1
|
+
import { A as tripletContrast, C as contrastRatio, D as isHslTriplet, E as hslTripletToRgb, O as relativeLuminance, S as softTriplet, T as hexToRgb, _ as adjustLightness, a as varsForState, b as hsl, c as leadingScales, d as colorSchemes, f as brandForMode, g as readableForeground, h as normalizeBrand, i as varsForMode, k as rgbToHslTriplet, l as radiusScales, m as brandVars, n as cssVarsForTheme, o as densityScales, p as brandRamp, r as softVars, s as fontStacks, t as brandCssVars, u as spaceScales, v as alphaVars, w as hexToHslTriplet, x as inkTriplet, y as deepTriplet } from "./css-vars-WEUFBMjy.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/theme/presets.ts
|
|
4
4
|
/**
|
|
5
5
|
* Weekday themes ΓÇö Thai weekday colors: Sunday red, Monday yellow,
|
|
6
6
|
* Tuesday pink, Wednesday green, Thursday orange, Friday blue,
|
|
@@ -93,5 +93,4 @@ const presets = [
|
|
|
93
93
|
}
|
|
94
94
|
];
|
|
95
95
|
|
|
96
|
-
//#endregion
|
|
97
96
|
export { adjustLightness, alphaVars, brandCssVars, brandForMode, brandRamp, brandVars, colorSchemes, contrastRatio, cssVarsForTheme, deepTriplet, densityScales, fontStacks, hexToHslTriplet, hexToRgb, hsl, hslTripletToRgb, inkTriplet, isHslTriplet, leadingScales, normalizeBrand, presets, radiusScales, readableForeground, relativeLuminance, rgbToHslTriplet, softTriplet, softVars, spaceScales, tripletContrast, varsForMode, varsForState };
|
package/dist/preset.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { _ as ThemeState, t as BrandInput } from "./brand-
|
|
1
|
+
import { _ as ThemeState, t as BrandInput } from "./brand-DIJLf6Xs.mjs";
|
|
2
2
|
import { Preset } from "unocss";
|
|
3
|
-
//#region src/preset.d.ts
|
|
4
3
|
export interface PresetSolidUIOptions {
|
|
5
4
|
color?: ThemeState["color"];
|
|
6
5
|
font?: ThemeState["font"];
|
|
@@ -21,5 +20,4 @@ export interface PresetSolidUIOptions {
|
|
|
21
20
|
* `var(--color-*)` / `var(--su-*)` so themes can be swapped at runtime.
|
|
22
21
|
*/
|
|
23
22
|
export declare function presetSolidUI(options?: PresetSolidUIOptions): Preset;
|
|
24
|
-
//#endregion
|
|
25
23
|
export { presetSolidUI as default };
|
package/dist/preset.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as cssVarsForTheme, t as brandCssVars } from "./css-vars-
|
|
1
|
+
import { n as cssVarsForTheme, t as brandCssVars } from "./css-vars-WEUFBMjy.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/preset.ts
|
|
4
4
|
/**
|
|
5
5
|
* UnoCSS preset that maps the solid-ui design tokens to CSS variables.
|
|
6
6
|
* Utilities like `bg-primary`, `text-muted-foreground`, `rounded-lg` resolve to
|
|
@@ -186,5 +186,4 @@ function presetSolidUI(options = {}) {
|
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
//#endregion
|
|
190
189
|
export { presetSolidUI as default, presetSolidUI };
|
package/dist/vite.d.mts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drop-in Vite plugin for Solid UI apps.
|
|
3
|
+
*
|
|
4
|
+
* Wires UnoCSS with the Wrikka stack — presetWind4 (dark-mode selectors),
|
|
5
|
+
* presetSolidUI (design tokens → utilities) and presetIcons (mdi, lucide and
|
|
6
|
+
* simple-icons bundled) — so a consumer only needs:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* // vite.config.ts
|
|
10
|
+
* import { wrikka } from "@wrikka/theme/vite";
|
|
11
|
+
* export default defineConfig({ plugins: [solid(), wrikka()] });
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* ```tsx
|
|
15
|
+
* // app entry (once)
|
|
16
|
+
* import "@wrikka/theme/uno.css";
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* `uno.css`, `virtual:uno.css` and `@wrikka/theme/uno.css` all resolve to the
|
|
20
|
+
* same generated stylesheet.
|
|
21
|
+
*/
|
|
22
|
+
import { PresetSolidUIOptions } from "./preset.mjs";
|
|
23
|
+
import { UserConfig, presetIcons } from "unocss";
|
|
24
|
+
import { Plugin } from "vite";
|
|
25
|
+
/** Specifier consumers import once to pull in the generated stylesheet. */
|
|
26
|
+
export declare const UNO_CSS_ENTRY = "@wrikka/theme/uno.css";
|
|
27
|
+
type PresetIconsOptions = NonNullable<Parameters<typeof presetIcons>[0]>;
|
|
28
|
+
type IconCollection = NonNullable<NonNullable<PresetIconsOptions["collections"]>>[string];
|
|
29
|
+
export interface WrikkaViteOptions {
|
|
30
|
+
/** Forwarded to `presetSolidUI` — brand, mode, color, font, space, radius, preflight. */
|
|
31
|
+
preset?: PresetSolidUIOptions;
|
|
32
|
+
/**
|
|
33
|
+
* Extra UnoCSS icon collections merged over the bundled defaults
|
|
34
|
+
* (`mdi`, `lucide`, `simple-icons`). Same signature presetIcons expects.
|
|
35
|
+
*/
|
|
36
|
+
icons?: Record<string, IconCollection>;
|
|
37
|
+
/**
|
|
38
|
+
* Raw UnoCSS config merged into the generated one — `safelist`,
|
|
39
|
+
* `content`, extra `presets`/`rules`/`theme` keys, etc. Presets, rules and
|
|
40
|
+
* transformers are appended after the Wrikka defaults.
|
|
41
|
+
*/
|
|
42
|
+
uno?: UserConfig;
|
|
43
|
+
/**
|
|
44
|
+
* UnoCSS vite-plugin options that are not part of the UnoCSS config —
|
|
45
|
+
* `mode`, `inspector`, `checkImport`, `postcss`, `transformCSS`, …
|
|
46
|
+
*/
|
|
47
|
+
vite?: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Returns the Vite plugins a Solid UI consumer needs. Place it alongside the
|
|
51
|
+
* Solid plugin — order does not matter:
|
|
52
|
+
*
|
|
53
|
+
* ```ts
|
|
54
|
+
* plugins: [tanstackStart(), solid({ ssr: true }), wrikka()]
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function wrikka(options?: WrikkaViteOptions): Plugin[];
|
|
58
|
+
export { wrikka as default };
|
package/dist/vite.mjs
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import presetSolidUI from "./preset.mjs";
|
|
2
|
+
import { presetIcons, presetWind4, transformerDirectives, transformerVariantGroup } from "unocss";
|
|
3
|
+
import UnoCSS from "unocss/vite";
|
|
4
|
+
|
|
5
|
+
// src/vite.ts
|
|
6
|
+
/**
|
|
7
|
+
* Drop-in Vite plugin for Solid UI apps.
|
|
8
|
+
*
|
|
9
|
+
* Wires UnoCSS with the Wrikka stack — presetWind4 (dark-mode selectors),
|
|
10
|
+
* presetSolidUI (design tokens → utilities) and presetIcons (mdi, lucide and
|
|
11
|
+
* simple-icons bundled) — so a consumer only needs:
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* // vite.config.ts
|
|
15
|
+
* import { wrikka } from "@wrikka/theme/vite";
|
|
16
|
+
* export default defineConfig({ plugins: [solid(), wrikka()] });
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // app entry (once)
|
|
21
|
+
* import "@wrikka/theme/uno.css";
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* `uno.css`, `virtual:uno.css` and `@wrikka/theme/uno.css` all resolve to the
|
|
25
|
+
* same generated stylesheet.
|
|
26
|
+
*/
|
|
27
|
+
/** Specifier consumers import once to pull in the generated stylesheet. */
|
|
28
|
+
const UNO_CSS_ENTRY = "@wrikka/theme/uno.css";
|
|
29
|
+
const VIRTUALUnoEntry = "\0wrikka:uno-entry";
|
|
30
|
+
const DEFAULT_ICON_COLLECTIONS = {
|
|
31
|
+
mdi: () => import("@iconify-json/mdi/icons.json").then((i) => i.default),
|
|
32
|
+
lucide: () => import("@iconify-json/lucide/icons.json").then((i) => i.default),
|
|
33
|
+
"simple-icons": () => import("@iconify-json/simple-icons/icons.json").then((i) => i.default)
|
|
34
|
+
};
|
|
35
|
+
/** Named z-index/duration/density utilities the Wrikka token scale needs. */
|
|
36
|
+
const BASE_RULES = [
|
|
37
|
+
[/^z-(base|dropdown|sticky|fixed|modal-backdrop|modal|popover|tooltip|toast)$/, (m) => ({ "z-index": `var(--su-z-${m[1]})` })],
|
|
38
|
+
[/^duration-(fast|normal|slow|slower)$/, (m) => ({
|
|
39
|
+
"--un-duration": `var(--su-duration-${m[1]})`,
|
|
40
|
+
"transition-duration": `var(--su-duration-${m[1]})`
|
|
41
|
+
})],
|
|
42
|
+
[/^h-control-(sm|md|lg)$/, (m) => ({ height: `var(--su-control-h-${m[1]})` })],
|
|
43
|
+
[/^h-row$/, () => ({ height: "var(--su-row-h)" })]
|
|
44
|
+
];
|
|
45
|
+
/**
|
|
46
|
+
* Returns the Vite plugins a Solid UI consumer needs. Place it alongside the
|
|
47
|
+
* Solid plugin — order does not matter:
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* plugins: [tanstackStart(), solid({ ssr: true }), wrikka()]
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
function wrikka(options = {}) {
|
|
54
|
+
const { preset = {}, icons = {}, uno = {}, vite = {} } = options;
|
|
55
|
+
const { presets: extraPresets = [], rules: extraRules = [], transformers: extraTransformers = [], ...unoRest } = uno;
|
|
56
|
+
const unocssConfig = {
|
|
57
|
+
...unoRest,
|
|
58
|
+
presets: [
|
|
59
|
+
presetWind4({
|
|
60
|
+
dark: {
|
|
61
|
+
dark: "html[data-theme=\"dark\"]",
|
|
62
|
+
light: "html[data-theme=\"light\"]"
|
|
63
|
+
},
|
|
64
|
+
preflights: { reset: true }
|
|
65
|
+
}),
|
|
66
|
+
presetSolidUI(preset),
|
|
67
|
+
presetIcons({
|
|
68
|
+
collections: {
|
|
69
|
+
...DEFAULT_ICON_COLLECTIONS,
|
|
70
|
+
...icons
|
|
71
|
+
},
|
|
72
|
+
extraProperties: {
|
|
73
|
+
display: "inline-block",
|
|
74
|
+
"vertical-align": "middle",
|
|
75
|
+
"flex-shrink": "0"
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
...extraPresets
|
|
79
|
+
],
|
|
80
|
+
rules: [...BASE_RULES ?? [], ...extraRules],
|
|
81
|
+
transformers: [
|
|
82
|
+
transformerVariantGroup(),
|
|
83
|
+
transformerDirectives(),
|
|
84
|
+
...extraTransformers
|
|
85
|
+
],
|
|
86
|
+
...vite
|
|
87
|
+
};
|
|
88
|
+
return [{
|
|
89
|
+
name: "wrikka:uno-entry",
|
|
90
|
+
enforce: "pre",
|
|
91
|
+
resolveId(id) {
|
|
92
|
+
if (id === "@wrikka/theme/uno.css") return VIRTUALUnoEntry;
|
|
93
|
+
},
|
|
94
|
+
load(id) {
|
|
95
|
+
if (id === VIRTUALUnoEntry) return `import "virtual:uno.css";`;
|
|
96
|
+
}
|
|
97
|
+
}, ...UnoCSS(unocssConfig)];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export { UNO_CSS_ENTRY, wrikka as default, wrikka };
|
package/package.json
CHANGED
|
@@ -1,52 +1,61 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
2
|
+
"name": "@wrikka/theme",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"description": "Design tokens, theme presets, and the UnoCSS configuration behind @wrikka/ui",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"src/styles/tokens.css",
|
|
14
|
+
"src/styles/theme.css",
|
|
15
|
+
"src/styles/markdown.css",
|
|
16
|
+
"src/styles/tokens.dtcg.json",
|
|
17
|
+
"uno.config.ts",
|
|
18
|
+
"tokens.json",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./dist/index.mjs",
|
|
24
|
+
"types": "./dist/index.d.mts"
|
|
25
|
+
},
|
|
26
|
+
"./preset": {
|
|
27
|
+
"import": "./dist/preset.mjs",
|
|
28
|
+
"types": "./dist/preset.d.mts"
|
|
29
|
+
},
|
|
30
|
+
"./vite": {
|
|
31
|
+
"types": "./dist/vite.d.mts",
|
|
32
|
+
"import": "./dist/vite.mjs"
|
|
33
|
+
},
|
|
34
|
+
"./uno": "./uno.config.ts",
|
|
35
|
+
"./styles/*": "./src/styles/*"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsdown",
|
|
39
|
+
"dev": "tsdown --watch",
|
|
40
|
+
"typecheck": "bun check -p . --no-script",
|
|
41
|
+
"lint": "biome check src",
|
|
42
|
+
"format": "biome format --write src",
|
|
43
|
+
"test": "vitest run --passWithNoTests",
|
|
44
|
+
"gen:tokens": "bun scripts/export-tokens-dtcg.ts",
|
|
45
|
+
"check:tokens": "bun scripts/check-tokens.ts"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"vite": ">=5.0.0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependenciesMeta": {
|
|
51
|
+
"vite": {
|
|
52
|
+
"optional": true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@iconify-json/lucide": "^1.2.157",
|
|
57
|
+
"@iconify-json/mdi": "^1.2.3",
|
|
58
|
+
"@iconify-json/simple-icons": "^1.2.103",
|
|
59
|
+
"unocss": "^66.10.4"
|
|
60
|
+
}
|
|
61
|
+
}
|
package/src/styles/theme.css
CHANGED
|
@@ -78,19 +78,19 @@ html[data-theme="dark"],
|
|
|
78
78
|
.dark {
|
|
79
79
|
color-scheme: dark;
|
|
80
80
|
|
|
81
|
-
/* Background/surface/muted */
|
|
82
|
-
--color-background:
|
|
83
|
-
--color-foreground:
|
|
84
|
-
--color-surface:
|
|
85
|
-
--color-surface-elevated:
|
|
86
|
-
--color-surface-foreground:
|
|
87
|
-
--color-muted:
|
|
88
|
-
--color-muted-foreground:
|
|
81
|
+
/* Background/surface/muted — neutral near-black ramp, no blue cast */
|
|
82
|
+
--color-background: 260 14% 4%;
|
|
83
|
+
--color-foreground: 260 20% 96%;
|
|
84
|
+
--color-surface: 260 10% 8%;
|
|
85
|
+
--color-surface-elevated: 260 8% 12%;
|
|
86
|
+
--color-surface-foreground: 260 20% 96%;
|
|
87
|
+
--color-muted: 260 8% 11%;
|
|
88
|
+
--color-muted-foreground: 260 6% 58%;
|
|
89
89
|
|
|
90
90
|
/* Borders and focus */
|
|
91
|
-
--color-border:
|
|
92
|
-
--color-border-hover:
|
|
93
|
-
--color-input:
|
|
91
|
+
--color-border: 260 8% 14%;
|
|
92
|
+
--color-border-hover: 260 6% 26%;
|
|
93
|
+
--color-input: 260 8% 14%;
|
|
94
94
|
--color-ring: 200 98% 55%;
|
|
95
95
|
--color-focus: 200 98% 55%;
|
|
96
96
|
|
|
@@ -98,19 +98,19 @@ html[data-theme="dark"],
|
|
|
98
98
|
--color-primary: 200 98% 55%;
|
|
99
99
|
--color-primary-hover: 199 95% 48%;
|
|
100
100
|
--color-primary-active: 199 95% 42%;
|
|
101
|
-
--color-primary-foreground:
|
|
101
|
+
--color-primary-foreground: 260 12% 7%;
|
|
102
102
|
|
|
103
103
|
/* Secondary */
|
|
104
|
-
--color-secondary:
|
|
105
|
-
--color-secondary-hover:
|
|
106
|
-
--color-secondary-active:
|
|
107
|
-
--color-secondary-foreground:
|
|
104
|
+
--color-secondary: 260 8% 11%;
|
|
105
|
+
--color-secondary-hover: 260 8% 14%;
|
|
106
|
+
--color-secondary-active: 260 6% 19%;
|
|
107
|
+
--color-secondary-foreground: 260 20% 96%;
|
|
108
108
|
|
|
109
109
|
/* Accent */
|
|
110
|
-
--color-accent:
|
|
111
|
-
--color-accent-hover:
|
|
112
|
-
--color-accent-active:
|
|
113
|
-
--color-accent-foreground:
|
|
110
|
+
--color-accent: 260 8% 11%;
|
|
111
|
+
--color-accent-hover: 260 8% 14%;
|
|
112
|
+
--color-accent-active: 260 6% 19%;
|
|
113
|
+
--color-accent-foreground: 260 20% 96%;
|
|
114
114
|
|
|
115
115
|
/* Semantic colors — dark ink on the light fills; hover and active brighten so
|
|
116
116
|
the ink keeps its contrast instead of fading toward it */
|
|
@@ -142,8 +142,8 @@ html[data-theme="dark"],
|
|
|
142
142
|
/* Misc */
|
|
143
143
|
--color-overlay: 0 0% 0%;
|
|
144
144
|
--color-scrim: 0 0% 100%;
|
|
145
|
-
--color-skeleton:
|
|
146
|
-
--color-skeleton-shine:
|
|
145
|
+
--color-skeleton: 260 8% 15%;
|
|
146
|
+
--color-skeleton-shine: 260 8% 11%;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
/*
|