@marianmeres/design-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.
Files changed (84) hide show
  1. package/AGENTS.md +85 -0
  2. package/API.md +271 -0
  3. package/CLAUDE.md +3 -0
  4. package/LICENSE +21 -0
  5. package/README.md +139 -0
  6. package/dist/colors.d.ts +301 -0
  7. package/dist/colors.js +301 -0
  8. package/dist/generate.d.ts +14 -0
  9. package/dist/generate.js +137 -0
  10. package/dist/mod.d.ts +13 -0
  11. package/dist/mod.js +12 -0
  12. package/dist/reboot-bridge.d.ts +27 -0
  13. package/dist/reboot-bridge.js +89 -0
  14. package/dist/themes/blue-orange.d.ts +3 -0
  15. package/dist/themes/blue-orange.js +117 -0
  16. package/dist/themes/cyan-red.d.ts +3 -0
  17. package/dist/themes/cyan-red.js +117 -0
  18. package/dist/themes/cyan-slate.d.ts +3 -0
  19. package/dist/themes/cyan-slate.js +117 -0
  20. package/dist/themes/dds.d.ts +3 -0
  21. package/dist/themes/dds.js +133 -0
  22. package/dist/themes/emerald-amber-forest.d.ts +3 -0
  23. package/dist/themes/emerald-amber-forest.js +117 -0
  24. package/dist/themes/emerald-pink.d.ts +3 -0
  25. package/dist/themes/emerald-pink.js +117 -0
  26. package/dist/themes/fuchsia-emerald.d.ts +3 -0
  27. package/dist/themes/fuchsia-emerald.js +117 -0
  28. package/dist/themes/gray.d.ts +3 -0
  29. package/dist/themes/gray.js +66 -0
  30. package/dist/themes/indigo-amber.d.ts +3 -0
  31. package/dist/themes/indigo-amber.js +117 -0
  32. package/dist/themes/lime-fuchsia-neon.d.ts +3 -0
  33. package/dist/themes/lime-fuchsia-neon.js +117 -0
  34. package/dist/themes/mod.d.ts +72 -0
  35. package/dist/themes/mod.js +71 -0
  36. package/dist/themes/monokai-cyan.d.ts +3 -0
  37. package/dist/themes/monokai-cyan.js +119 -0
  38. package/dist/themes/monokai-green.d.ts +3 -0
  39. package/dist/themes/monokai-green.js +119 -0
  40. package/dist/themes/monokai-pink.d.ts +3 -0
  41. package/dist/themes/monokai-pink.js +119 -0
  42. package/dist/themes/orange-pink-sunset.d.ts +3 -0
  43. package/dist/themes/orange-pink-sunset.js +117 -0
  44. package/dist/themes/pink-emerald.d.ts +3 -0
  45. package/dist/themes/pink-emerald.js +117 -0
  46. package/dist/themes/pink-teal.d.ts +3 -0
  47. package/dist/themes/pink-teal.js +117 -0
  48. package/dist/themes/purple-yellow.d.ts +3 -0
  49. package/dist/themes/purple-yellow.js +117 -0
  50. package/dist/themes/rainbow.d.ts +3 -0
  51. package/dist/themes/rainbow.js +122 -0
  52. package/dist/themes/red-blue.d.ts +3 -0
  53. package/dist/themes/red-blue.js +117 -0
  54. package/dist/themes/red-cyan.d.ts +3 -0
  55. package/dist/themes/red-cyan.js +117 -0
  56. package/dist/themes/red-sky-slate.d.ts +3 -0
  57. package/dist/themes/red-sky-slate.js +117 -0
  58. package/dist/themes/red-sky.d.ts +3 -0
  59. package/dist/themes/red-sky.js +117 -0
  60. package/dist/themes/rose-teal.d.ts +3 -0
  61. package/dist/themes/rose-teal.js +117 -0
  62. package/dist/themes/sky-amber.d.ts +3 -0
  63. package/dist/themes/sky-amber.js +117 -0
  64. package/dist/themes/slate-cyan.d.ts +3 -0
  65. package/dist/themes/slate-cyan.js +117 -0
  66. package/dist/themes/slate-teal-ocean.d.ts +3 -0
  67. package/dist/themes/slate-teal-ocean.js +117 -0
  68. package/dist/themes/stone-orange-earth.d.ts +3 -0
  69. package/dist/themes/stone-orange-earth.js +117 -0
  70. package/dist/themes/stone.d.ts +3 -0
  71. package/dist/themes/stone.js +72 -0
  72. package/dist/themes/teal-rose.d.ts +3 -0
  73. package/dist/themes/teal-rose.js +117 -0
  74. package/dist/themes/violet-lime.d.ts +3 -0
  75. package/dist/themes/violet-lime.js +117 -0
  76. package/dist/themes/violet-rose-dusk.d.ts +3 -0
  77. package/dist/themes/violet-rose-dusk.js +117 -0
  78. package/dist/themes/zinc.d.ts +3 -0
  79. package/dist/themes/zinc.js +66 -0
  80. package/dist/types.d.ts +48 -0
  81. package/dist/types.js +1 -0
  82. package/dist/utils.d.ts +11 -0
  83. package/dist/utils.js +28 -0
  84. package/package.json +23 -0
@@ -0,0 +1,117 @@
1
+ import { colors } from "../colors.js";
2
+ const light = {
3
+ colors: {
4
+ intent: {
5
+ primary: {
6
+ DEFAULT: colors.violet[600],
7
+ foreground: colors.white,
8
+ },
9
+ accent: {
10
+ DEFAULT: colors.lime[500],
11
+ foreground: colors.white,
12
+ },
13
+ destructive: {
14
+ DEFAULT: colors.rose[600],
15
+ foreground: colors.white,
16
+ },
17
+ warning: {
18
+ DEFAULT: colors.lime[500],
19
+ foreground: colors.white,
20
+ },
21
+ success: {
22
+ DEFAULT: colors.lime[600],
23
+ foreground: colors.white,
24
+ },
25
+ },
26
+ role: {
27
+ paired: {
28
+ background: {
29
+ DEFAULT: colors.white,
30
+ foreground: colors.neutral[900],
31
+ },
32
+ muted: {
33
+ DEFAULT: colors.neutral[100],
34
+ foreground: colors.neutral[500],
35
+ },
36
+ surface: {
37
+ DEFAULT: colors.neutral[200],
38
+ foreground: colors.neutral[900],
39
+ },
40
+ "surface-1": {
41
+ DEFAULT: colors.neutral[300],
42
+ foreground: colors.neutral[900],
43
+ },
44
+ },
45
+ single: {
46
+ foreground: colors.neutral[900],
47
+ border: {
48
+ DEFAULT: colors.neutral[300],
49
+ },
50
+ input: {
51
+ DEFAULT: colors.white,
52
+ hover: colors.neutral[50],
53
+ },
54
+ ring: `color-mix(in srgb, ${colors.violet[600]} 20%, transparent)`,
55
+ },
56
+ },
57
+ },
58
+ };
59
+ const dark = {
60
+ colors: {
61
+ intent: {
62
+ primary: {
63
+ DEFAULT: colors.violet[500],
64
+ foreground: colors.white,
65
+ },
66
+ accent: {
67
+ DEFAULT: colors.lime[400],
68
+ foreground: colors.black,
69
+ },
70
+ destructive: {
71
+ DEFAULT: colors.rose[500],
72
+ foreground: colors.white,
73
+ },
74
+ warning: {
75
+ DEFAULT: colors.lime[400],
76
+ foreground: colors.black,
77
+ },
78
+ success: {
79
+ DEFAULT: colors.lime[500],
80
+ foreground: colors.black,
81
+ },
82
+ },
83
+ role: {
84
+ paired: {
85
+ background: {
86
+ DEFAULT: colors.neutral[900],
87
+ foreground: colors.neutral[50],
88
+ },
89
+ muted: {
90
+ DEFAULT: colors.neutral[800],
91
+ foreground: colors.neutral[400],
92
+ },
93
+ surface: {
94
+ DEFAULT: colors.neutral[700],
95
+ foreground: colors.neutral[300],
96
+ },
97
+ "surface-1": {
98
+ DEFAULT: colors.neutral[600],
99
+ foreground: colors.neutral[200],
100
+ },
101
+ },
102
+ single: {
103
+ foreground: colors.neutral[50],
104
+ border: {
105
+ DEFAULT: colors.neutral[700],
106
+ },
107
+ input: {
108
+ DEFAULT: colors.neutral[900],
109
+ hover: colors.neutral[800],
110
+ },
111
+ ring: `color-mix(in srgb, ${colors.violet[400]} 25%, transparent)`,
112
+ },
113
+ },
114
+ },
115
+ };
116
+ const theme = { light, dark };
117
+ export default theme;
@@ -0,0 +1,3 @@
1
+ import type { ThemeSchema } from "../types.js";
2
+ declare const theme: ThemeSchema;
3
+ export default theme;
@@ -0,0 +1,117 @@
1
+ import { colors } from "../colors.js";
2
+ const light = {
3
+ colors: {
4
+ intent: {
5
+ primary: {
6
+ DEFAULT: colors.violet[600],
7
+ foreground: colors.white,
8
+ },
9
+ accent: {
10
+ DEFAULT: colors.rose[500],
11
+ foreground: colors.white,
12
+ },
13
+ destructive: {
14
+ DEFAULT: colors.red[600],
15
+ foreground: colors.white,
16
+ },
17
+ warning: {
18
+ DEFAULT: colors.amber[500],
19
+ foreground: colors.white,
20
+ },
21
+ success: {
22
+ DEFAULT: colors.emerald[600],
23
+ foreground: colors.white,
24
+ },
25
+ },
26
+ role: {
27
+ paired: {
28
+ background: {
29
+ DEFAULT: colors.neutral[50],
30
+ foreground: colors.zinc[900],
31
+ },
32
+ muted: {
33
+ DEFAULT: colors.zinc[100],
34
+ foreground: colors.zinc[500],
35
+ },
36
+ surface: {
37
+ DEFAULT: colors.zinc[200],
38
+ foreground: colors.zinc[900],
39
+ },
40
+ "surface-1": {
41
+ DEFAULT: colors.zinc[300],
42
+ foreground: colors.zinc[900],
43
+ },
44
+ },
45
+ single: {
46
+ foreground: colors.zinc[900],
47
+ border: {
48
+ DEFAULT: colors.zinc[300],
49
+ },
50
+ input: {
51
+ DEFAULT: colors.white,
52
+ hover: colors.neutral[50],
53
+ },
54
+ ring: `color-mix(in srgb, ${colors.violet[500]} 20%, transparent)`,
55
+ },
56
+ },
57
+ },
58
+ };
59
+ const dark = {
60
+ colors: {
61
+ intent: {
62
+ primary: {
63
+ DEFAULT: colors.violet[400],
64
+ foreground: colors.white,
65
+ },
66
+ accent: {
67
+ DEFAULT: colors.rose[400],
68
+ foreground: colors.white,
69
+ },
70
+ destructive: {
71
+ DEFAULT: colors.red[500],
72
+ foreground: colors.white,
73
+ },
74
+ warning: {
75
+ DEFAULT: colors.amber[400],
76
+ foreground: colors.black,
77
+ },
78
+ success: {
79
+ DEFAULT: colors.emerald[500],
80
+ foreground: colors.white,
81
+ },
82
+ },
83
+ role: {
84
+ paired: {
85
+ background: {
86
+ DEFAULT: colors.zinc[950],
87
+ foreground: colors.neutral[50],
88
+ },
89
+ muted: {
90
+ DEFAULT: colors.zinc[900],
91
+ foreground: colors.zinc[500],
92
+ },
93
+ surface: {
94
+ DEFAULT: colors.zinc[800],
95
+ foreground: colors.zinc[400],
96
+ },
97
+ "surface-1": {
98
+ DEFAULT: colors.zinc[700],
99
+ foreground: colors.zinc[300],
100
+ },
101
+ },
102
+ single: {
103
+ foreground: colors.neutral[50],
104
+ border: {
105
+ DEFAULT: colors.zinc[700],
106
+ },
107
+ input: {
108
+ DEFAULT: colors.zinc[950],
109
+ hover: colors.zinc[900],
110
+ },
111
+ ring: `color-mix(in srgb, ${colors.violet[400]} 25%, transparent)`,
112
+ },
113
+ },
114
+ },
115
+ };
116
+ const theme = { light, dark };
117
+ export default theme;
@@ -0,0 +1,3 @@
1
+ import type { ThemeSchema } from "../types.js";
2
+ declare const theme: ThemeSchema;
3
+ export default theme;
@@ -0,0 +1,66 @@
1
+ import { colors } from "../colors.js";
2
+ const theme = {
3
+ light: {
4
+ colors: {
5
+ intent: {
6
+ primary: { DEFAULT: colors.zinc[800], foreground: colors.white }, // zinc-800, white
7
+ accent: { DEFAULT: colors.zinc[500], foreground: colors.white }, // zinc-500, white
8
+ destructive: { DEFAULT: colors.rose[600], foreground: colors.white }, // rose-600, white
9
+ warning: { DEFAULT: colors.amber[500], foreground: colors.black }, // amber-500, black
10
+ success: { DEFAULT: colors.emerald[600], foreground: colors.white }, // emerald-600, white
11
+ },
12
+ role: {
13
+ paired: {
14
+ background: {
15
+ DEFAULT: colors.zinc[50],
16
+ foreground: colors.zinc[900],
17
+ }, // zinc-50, zinc-900
18
+ muted: { DEFAULT: colors.zinc[100], foreground: colors.zinc[500] }, // zinc-100, zinc-500
19
+ surface: { DEFAULT: colors.zinc[200], foreground: colors.zinc[900] }, // zinc-200, zinc-900
20
+ "surface-1": {
21
+ DEFAULT: colors.zinc[300],
22
+ foreground: colors.zinc[900],
23
+ }, // zinc-300, zinc-900
24
+ },
25
+ single: {
26
+ foreground: colors.zinc[900], // zinc-900
27
+ border: { DEFAULT: colors.zinc[300] }, // zinc-300
28
+ input: { DEFAULT: colors.zinc[50], hover: colors.zinc[100] }, // zinc-50, zinc-100
29
+ ring: `color-mix(in srgb, ${colors.zinc[800]} 20%, transparent)`, // zinc-800
30
+ },
31
+ },
32
+ },
33
+ },
34
+ dark: {
35
+ colors: {
36
+ intent: {
37
+ primary: { DEFAULT: colors.zinc[200], foreground: colors.black }, // zinc-200, black
38
+ accent: { DEFAULT: colors.zinc[500], foreground: colors.white }, // zinc-500, white
39
+ destructive: { DEFAULT: colors.rose[500], foreground: colors.white }, // rose-500, white
40
+ warning: { DEFAULT: colors.amber[400], foreground: colors.black }, // amber-400, black
41
+ success: { DEFAULT: colors.emerald[500], foreground: colors.white }, // emerald-500, white
42
+ },
43
+ role: {
44
+ paired: {
45
+ background: {
46
+ DEFAULT: colors.zinc[900],
47
+ foreground: colors.zinc[50],
48
+ }, // zinc-900, zinc-50
49
+ muted: { DEFAULT: colors.zinc[800], foreground: colors.zinc[400] }, // zinc-800, zinc-400
50
+ surface: { DEFAULT: colors.zinc[700], foreground: colors.zinc[300] }, // zinc-700, zinc-300
51
+ "surface-1": {
52
+ DEFAULT: colors.zinc[600],
53
+ foreground: colors.zinc[200],
54
+ }, // zinc-600, zinc-200
55
+ },
56
+ single: {
57
+ foreground: colors.zinc[50], // zinc-50
58
+ border: { DEFAULT: colors.zinc[700] }, // zinc-700
59
+ input: { DEFAULT: colors.zinc[900], hover: colors.zinc[800] }, // zinc-900, zinc-800
60
+ ring: `color-mix(in srgb, ${colors.zinc[200]} 25%, transparent)`, // zinc-200
61
+ },
62
+ },
63
+ },
64
+ },
65
+ };
66
+ export default theme;
@@ -0,0 +1,48 @@
1
+ /** Base color value with optional pseudo states */
2
+ export type ColorValue = {
3
+ DEFAULT: string;
4
+ hover?: string;
5
+ active?: string;
6
+ };
7
+ /** Color pair enforcing the -foreground convention, with optional pseudo states */
8
+ export type ColorPair = {
9
+ DEFAULT: string;
10
+ foreground: string;
11
+ hover?: string;
12
+ active?: string;
13
+ };
14
+ /** Single color: either a plain string or an object with pseudo states */
15
+ export type SingleColor = string | ColorValue;
16
+ /** Known intent color keys */
17
+ export type IntentColorKey = "primary" | "accent" | "destructive" | "warning" | "success";
18
+ /** Known role color keys (paired) */
19
+ export type RolePairedKey = "background" | "muted" | "surface";
20
+ /** Known role color keys (single value) */
21
+ export type RoleSingleKey = "foreground" | "border" | "input" | "ring";
22
+ /** Helper: require known keys, allow additional */
23
+ export type WithRequired<TRequired extends string, TValue> = Record<TRequired, TValue> & Record<string, TValue>;
24
+ /** Helper: partial known keys, allow additional */
25
+ export type WithOptional<TKnown extends string, TValue> = Partial<Record<TKnown, TValue>> & Record<string, TValue>;
26
+ /**
27
+ * Complete token schema for a single mode (light or dark).
28
+ *
29
+ * Defines intent colors (primary, accent, destructive, warning, success),
30
+ * role paired colors (background, muted, surface — each with a foreground),
31
+ * and role single colors (foreground, border, input, ring).
32
+ */
33
+ export type TokenSchema = {
34
+ colors: {
35
+ intent: WithRequired<IntentColorKey, ColorPair>;
36
+ role: {
37
+ paired: WithRequired<RolePairedKey, ColorPair>;
38
+ single: WithRequired<RoleSingleKey, SingleColor>;
39
+ };
40
+ };
41
+ };
42
+ /** Generated CSS token key-value pairs (without the `--` prefix on keys). */
43
+ export type GeneratedTokens = Record<string, string>;
44
+ /** A complete theme definition with required light mode and optional dark mode */
45
+ export type ThemeSchema = {
46
+ light: TokenSchema;
47
+ dark?: TokenSchema;
48
+ };
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Parse a hex color string to RGB components.
3
+ * Supports "#abc" (3-digit) and "#aabbcc" (6-digit) formats.
4
+ * Returns null if the input is not a valid hex color.
5
+ */
6
+ export declare function hexToRgb(hex: string): [number, number, number] | null;
7
+ /**
8
+ * Convert a hex color to an "r, g, b" triplet string.
9
+ * Returns null if the input is not a valid hex color.
10
+ */
11
+ export declare function hexToRgbTriplet(hex: string): string | null;
package/dist/utils.js ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Parse a hex color string to RGB components.
3
+ * Supports "#abc" (3-digit) and "#aabbcc" (6-digit) formats.
4
+ * Returns null if the input is not a valid hex color.
5
+ */
6
+ export function hexToRgb(hex) {
7
+ hex = hex.replace(/^#/, "");
8
+ if (hex.length === 3) {
9
+ hex = hex
10
+ .split("")
11
+ .map((c) => c + c)
12
+ .join("");
13
+ }
14
+ if (hex.length !== 6)
15
+ return null;
16
+ const n = parseInt(hex, 16);
17
+ if (isNaN(n))
18
+ return null;
19
+ return [(n >> 16) & 255, (n >> 8) & 255, n & 255];
20
+ }
21
+ /**
22
+ * Convert a hex color to an "r, g, b" triplet string.
23
+ * Returns null if the input is not a valid hex color.
24
+ */
25
+ export function hexToRgbTriplet(hex) {
26
+ const rgb = hexToRgb(hex);
27
+ return rgb ? rgb.join(", ") : null;
28
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@marianmeres/design-tokens",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "dist/mod.js",
6
+ "types": "dist/mod.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/mod.d.ts",
10
+ "import": "./dist/mod.js"
11
+ }
12
+ },
13
+ "author": "Marian Meres",
14
+ "license": "MIT",
15
+ "dependencies": {},
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/marianmeres/design-tokens.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/marianmeres/design-tokens/issues"
22
+ }
23
+ }