@marianmeres/stuic 3.5.2 → 3.6.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 (64) hide show
  1. package/dist/components/Button/index.css +32 -92
  2. package/dist/components/Input/FieldAssets.svelte +1 -1
  3. package/dist/components/Input/FieldKeyValues.svelte +9 -9
  4. package/dist/components/Input/Fieldset.svelte +1 -1
  5. package/dist/components/Notifications/index.css +2 -2
  6. package/dist/components/ThemePreview/ThemePreview.svelte +10 -19
  7. package/dist/components/ThemePreview/index.css +14 -23
  8. package/dist/icons/index.d.ts +1 -0
  9. package/dist/icons/index.js +1 -0
  10. package/dist/themes/blue-orange.js +11 -47
  11. package/dist/themes/css/blue-orange.css +26 -26
  12. package/dist/themes/css/cyan-red.css +26 -26
  13. package/dist/themes/css/cyan-slate.css +26 -26
  14. package/dist/themes/css/emerald-amber-forest.css +30 -30
  15. package/dist/themes/css/emerald-pink.css +26 -26
  16. package/dist/themes/css/fuchsia-emerald.css +26 -26
  17. package/dist/themes/css/gray.css +27 -27
  18. package/dist/themes/css/indigo-amber.css +26 -26
  19. package/dist/themes/css/lime-fuchsia-neon.css +32 -32
  20. package/dist/themes/css/orange-pink-sunset.css +26 -26
  21. package/dist/themes/css/pink-emerald.css +26 -26
  22. package/dist/themes/css/pink-teal.css +26 -26
  23. package/dist/themes/css/purple-yellow.css +26 -26
  24. package/dist/themes/css/rainbow.css +26 -26
  25. package/dist/themes/css/red-blue.css +26 -26
  26. package/dist/themes/css/red-cyan.css +26 -26
  27. package/dist/themes/css/red-sky.css +26 -26
  28. package/dist/themes/css/rose-teal.css +26 -26
  29. package/dist/themes/css/sky-amber.css +26 -26
  30. package/dist/themes/css/slate-cyan.css +26 -26
  31. package/dist/themes/css/slate-teal-ocean.css +26 -26
  32. package/dist/themes/css/stone-orange-earth.css +33 -33
  33. package/dist/themes/css/stone.css +27 -27
  34. package/dist/themes/css/teal-rose.css +26 -26
  35. package/dist/themes/css/violet-lime.css +26 -26
  36. package/dist/themes/css/violet-rose-dusk.css +26 -26
  37. package/dist/themes/cyan-red.js +11 -47
  38. package/dist/themes/cyan-slate.js +11 -47
  39. package/dist/themes/emerald-amber-forest.js +13 -49
  40. package/dist/themes/emerald-pink.js +11 -47
  41. package/dist/themes/fuchsia-emerald.js +11 -47
  42. package/dist/themes/gray.js +11 -47
  43. package/dist/themes/indigo-amber.js +11 -47
  44. package/dist/themes/lime-fuchsia-neon.js +13 -49
  45. package/dist/themes/orange-pink-sunset.js +11 -47
  46. package/dist/themes/pink-emerald.js +11 -47
  47. package/dist/themes/pink-teal.js +11 -47
  48. package/dist/themes/purple-yellow.js +11 -47
  49. package/dist/themes/rainbow.js +11 -47
  50. package/dist/themes/red-blue.js +11 -47
  51. package/dist/themes/red-cyan.js +11 -47
  52. package/dist/themes/red-sky.js +11 -47
  53. package/dist/themes/rose-teal.js +11 -47
  54. package/dist/themes/sky-amber.js +11 -47
  55. package/dist/themes/slate-cyan.js +11 -47
  56. package/dist/themes/slate-teal-ocean.js +11 -47
  57. package/dist/themes/stone-orange-earth.js +13 -49
  58. package/dist/themes/stone.js +11 -47
  59. package/dist/themes/teal-rose.js +11 -47
  60. package/dist/themes/violet-lime.js +11 -47
  61. package/dist/themes/violet-rose-dusk.js +11 -47
  62. package/dist/utils/design-tokens.d.ts +1 -3
  63. package/dist/utils/design-tokens.js +57 -12
  64. package/package.json +1 -1
@@ -4,32 +4,22 @@ const light = {
4
4
  primary: {
5
5
  DEFAULT: "var(--color-violet-600)",
6
6
  foreground: "var(--color-white)",
7
- hover: "var(--color-violet-700)",
8
- active: "var(--color-violet-800)",
9
7
  },
10
8
  accent: {
11
9
  DEFAULT: "var(--color-rose-500)",
12
10
  foreground: "var(--color-white)",
13
- hover: "var(--color-rose-600)",
14
- active: "var(--color-rose-700)",
15
11
  },
16
12
  destructive: {
17
13
  DEFAULT: "var(--color-red-600)",
18
14
  foreground: "var(--color-white)",
19
- hover: "var(--color-red-700)",
20
- active: "var(--color-red-800)",
21
15
  },
22
16
  warning: {
23
17
  DEFAULT: "var(--color-amber-500)",
24
18
  foreground: "var(--color-white)",
25
- hover: "var(--color-amber-600)",
26
- active: "var(--color-amber-700)",
27
19
  },
28
20
  success: {
29
21
  DEFAULT: "var(--color-emerald-600)",
30
22
  foreground: "var(--color-white)",
31
- hover: "var(--color-emerald-700)",
32
- active: "var(--color-emerald-800)",
33
23
  },
34
24
  },
35
25
  role: {
@@ -38,31 +28,23 @@ const light = {
38
28
  DEFAULT: "var(--color-zinc-50)",
39
29
  foreground: "var(--color-zinc-900)",
40
30
  },
31
+ muted: {
32
+ DEFAULT: "var(--color-zinc-100)",
33
+ foreground: "var(--color-zinc-500)",
34
+ },
41
35
  surface: {
42
36
  DEFAULT: "var(--color-zinc-200)",
43
37
  foreground: "var(--color-zinc-900)",
44
- hover: "var(--color-zinc-300)",
45
- active: "var(--color-zinc-400)",
46
38
  },
47
39
  "surface-1": {
48
40
  DEFAULT: "var(--color-zinc-300)",
49
41
  foreground: "var(--color-zinc-900)",
50
- hover: "var(--color-zinc-400)",
51
- active: "var(--color-zinc-500)",
52
- },
53
- muted: {
54
- DEFAULT: "var(--color-zinc-200)",
55
- foreground: "var(--color-zinc-500)",
56
- hover: "var(--color-zinc-300)",
57
- active: "var(--color-zinc-400)",
58
42
  },
59
43
  },
60
44
  single: {
61
45
  foreground: "var(--color-zinc-900)",
62
46
  border: {
63
47
  DEFAULT: "var(--color-zinc-300)",
64
- hover: "var(--color-zinc-400)",
65
- active: "var(--color-zinc-500)",
66
48
  },
67
49
  input: {
68
50
  DEFAULT: "var(--color-white)",
@@ -79,32 +61,22 @@ const dark = {
79
61
  primary: {
80
62
  DEFAULT: "var(--color-violet-400)",
81
63
  foreground: "var(--color-white)",
82
- hover: "var(--color-violet-300)",
83
- active: "var(--color-violet-200)",
84
64
  },
85
65
  accent: {
86
66
  DEFAULT: "var(--color-rose-400)",
87
67
  foreground: "var(--color-white)",
88
- hover: "var(--color-rose-300)",
89
- active: "var(--color-rose-200)",
90
68
  },
91
69
  destructive: {
92
70
  DEFAULT: "var(--color-red-500)",
93
71
  foreground: "var(--color-white)",
94
- hover: "var(--color-red-400)",
95
- active: "var(--color-red-300)",
96
72
  },
97
73
  warning: {
98
74
  DEFAULT: "var(--color-amber-400)",
99
75
  foreground: "var(--color-black)",
100
- hover: "var(--color-amber-300)",
101
- active: "var(--color-amber-200)",
102
76
  },
103
77
  success: {
104
78
  DEFAULT: "var(--color-emerald-500)",
105
79
  foreground: "var(--color-white)",
106
- hover: "var(--color-emerald-400)",
107
- active: "var(--color-emerald-300)",
108
80
  },
109
81
  },
110
82
  role: {
@@ -113,31 +85,23 @@ const dark = {
113
85
  DEFAULT: "var(--color-zinc-950)",
114
86
  foreground: "var(--color-zinc-50)",
115
87
  },
116
- surface: {
88
+ muted: {
117
89
  DEFAULT: "var(--color-zinc-900)",
118
- foreground: "var(--color-zinc-100)",
119
- hover: "var(--color-zinc-800)",
120
- active: "var(--color-zinc-700)",
90
+ foreground: "var(--color-zinc-500)",
121
91
  },
122
- "surface-1": {
92
+ surface: {
123
93
  DEFAULT: "var(--color-zinc-800)",
124
- foreground: "var(--color-zinc-100)",
125
- hover: "var(--color-zinc-700)",
126
- active: "var(--color-zinc-600)",
94
+ foreground: "var(--color-zinc-400)",
127
95
  },
128
- muted: {
129
- DEFAULT: "var(--color-zinc-800)",
130
- foreground: "var(--color-zinc-500)",
131
- hover: "var(--color-zinc-700)",
132
- active: "var(--color-zinc-600)",
96
+ "surface-1": {
97
+ DEFAULT: "var(--color-zinc-700)",
98
+ foreground: "var(--color-zinc-300)",
133
99
  },
134
100
  },
135
101
  single: {
136
102
  foreground: "var(--color-zinc-50)",
137
103
  border: {
138
104
  DEFAULT: "var(--color-zinc-700)",
139
- hover: "var(--color-zinc-600)",
140
- active: "var(--color-zinc-500)",
141
105
  },
142
106
  input: {
143
107
  DEFAULT: "var(--color-zinc-900)",
@@ -10,15 +10,13 @@ export type ColorPair = {
10
10
  foreground: string;
11
11
  hover?: string;
12
12
  active?: string;
13
- foregroundHover?: string;
14
- foregroundActive?: string;
15
13
  };
16
14
  /** Single color: either a plain string or an object with pseudo states */
17
15
  export type SingleColor = string | ColorValue;
18
16
  /** Known intent color keys */
19
17
  export type IntentColorKey = "primary" | "accent" | "destructive" | "warning" | "success";
20
18
  /** Known role color keys (paired) */
21
- export type RolePairedKey = "background" | "surface" | "muted";
19
+ export type RolePairedKey = "background" | "muted" | "surface";
22
20
  /** Known role color keys (single value) */
23
21
  export type RoleSingleKey = "foreground" | "border" | "input" | "ring";
24
22
  /** Helper: require known keys, allow additional */
@@ -8,6 +8,48 @@
8
8
  function isSingleColorObject(value) {
9
9
  return typeof value === "object" && "DEFAULT" in value;
10
10
  }
11
+ /** Tailwind shade scale (ordered light → dark) */
12
+ const SHADE_SCALE = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
13
+ /**
14
+ * Derive hover/active shades from a Tailwind CSS variable.
15
+ * Light mode steps darker (+1, +2 in scale), dark mode steps lighter (-1, -2).
16
+ * Returns defaultValue for both if the value is not a parseable shade variable.
17
+ */
18
+ function deriveShadeSteps(defaultValue, mode) {
19
+ const match = defaultValue.match(/^var\(--color-([a-z]+)-(\d+)\)$/);
20
+ if (!match)
21
+ return { hover: defaultValue, active: defaultValue };
22
+ const [, name, shadeStr] = match;
23
+ const shade = parseInt(shadeStr, 10);
24
+ const idx = SHADE_SCALE.indexOf(shade);
25
+ if (idx === -1)
26
+ return { hover: defaultValue, active: defaultValue };
27
+ const step = mode === "light" ? 1 : -1;
28
+ const hoverIdx = idx + step;
29
+ const activeIdx = idx + step * 2;
30
+ if (hoverIdx < 0 || hoverIdx >= SHADE_SCALE.length)
31
+ return { hover: defaultValue, active: defaultValue };
32
+ if (activeIdx < 0 || activeIdx >= SHADE_SCALE.length)
33
+ return { hover: defaultValue, active: defaultValue };
34
+ return {
35
+ hover: `var(--color-${name}-${SHADE_SCALE[hoverIdx]})`,
36
+ active: `var(--color-${name}-${SHADE_SCALE[activeIdx]})`,
37
+ };
38
+ }
39
+ /** Fill missing hover/active on a ColorPair using shade derivation */
40
+ function fillPairStates(pair, mode) {
41
+ if (pair.hover !== undefined && pair.active !== undefined)
42
+ return pair;
43
+ const derived = deriveShadeSteps(pair.DEFAULT, mode);
44
+ return { ...pair, hover: pair.hover ?? derived.hover, active: pair.active ?? derived.active };
45
+ }
46
+ /** Fill missing hover/active on a ColorValue using shade derivation */
47
+ function fillColorValueStates(color, mode) {
48
+ if (color.hover !== undefined && color.active !== undefined)
49
+ return color;
50
+ const derived = deriveShadeSteps(color.DEFAULT, mode);
51
+ return { ...color, hover: color.hover ?? derived.hover, active: color.active ?? derived.active };
52
+ }
11
53
  /** Generate color tokens for a paired color (with foreground) */
12
54
  function generatePairedColorTokens(tokens, key, pair, prefix = "stuic-") {
13
55
  // Main color
@@ -16,10 +58,8 @@ function generatePairedColorTokens(tokens, key, pair, prefix = "stuic-") {
16
58
  tokens[`${prefix}color-${key}-active`] = pair.active ?? pair.DEFAULT;
17
59
  // Foreground
18
60
  tokens[`${prefix}color-${key}-foreground`] = pair.foreground;
19
- tokens[`${prefix}color-${key}-foreground-hover`] =
20
- pair.foregroundHover ?? pair.foreground;
21
- tokens[`${prefix}color-${key}-foreground-active`] =
22
- pair.foregroundActive ?? pair.foreground;
61
+ tokens[`${prefix}color-${key}-foreground-hover`] = pair.foreground;
62
+ tokens[`${prefix}color-${key}-foreground-active`] = pair.foreground;
23
63
  }
24
64
  /** Generate color tokens for a single color */
25
65
  function generateSingleColorTokens(tokens, key, color, prefix = "stuic-") {
@@ -40,9 +80,9 @@ function generateSingleColorTokens(tokens, key, color, prefix = "stuic-") {
40
80
  // ============================================================================
41
81
  export function generateCssTokens(schema, prefix = "stuic-", mode = "light") {
42
82
  const tokens = {};
43
- // Intent colors
83
+ // Intent colors (auto-derive hover/active from shade steps)
44
84
  for (const [key, pair] of Object.entries(schema.colors.intent)) {
45
- generatePairedColorTokens(tokens, key, pair, prefix);
85
+ generatePairedColorTokens(tokens, key, fillPairStates(pair, mode), prefix);
46
86
  }
47
87
  // Surface-intent tokens (auto-derived from intent colors)
48
88
  // These provide subtle tinted backgrounds for callouts, alerts, highlighted content, etc.
@@ -58,13 +98,19 @@ export function generateCssTokens(schema, prefix = "stuic-", mode = "light") {
58
98
  tokens[`${prefix}color-surface-${key}-border`] =
59
99
  `color-mix(in srgb, var(--${prefix}color-${key}) 30%, var(--stuic-color-background))`;
60
100
  }
61
- // Role colors (paired)
101
+ // Role colors (paired) — auto-derive except "background" (no hover/active by design)
62
102
  for (const [key, pair] of Object.entries(schema.colors.role.paired)) {
63
- generatePairedColorTokens(tokens, key, pair, prefix);
103
+ const filled = key === "background" ? pair : fillPairStates(pair, mode);
104
+ generatePairedColorTokens(tokens, key, filled, prefix);
64
105
  }
65
- // Role colors (single)
106
+ // Role colors (single) — auto-derive for object types (e.g. border)
66
107
  for (const [key, color] of Object.entries(schema.colors.role.single)) {
67
- generateSingleColorTokens(tokens, key, color, prefix);
108
+ if (isSingleColorObject(color)) {
109
+ generateSingleColorTokens(tokens, key, fillColorValueStates(color, mode), prefix);
110
+ }
111
+ else {
112
+ generateSingleColorTokens(tokens, key, color, prefix);
113
+ }
68
114
  }
69
115
  return tokens;
70
116
  }
@@ -144,8 +190,7 @@ export function generateThemeCss(schema, prefix = "stuic-") {
144
190
  let css = toCssString(generateCssTokens(schema.light, prefix, "light"));
145
191
  if (schema.dark) {
146
192
  css +=
147
- "\n" +
148
- toCssString(generateCssTokens(schema.dark, prefix, "dark"), ":root.dark");
193
+ "\n" + toCssString(generateCssTokens(schema.dark, prefix, "dark"), ":root.dark");
149
194
  }
150
195
  return css;
151
196
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.5.2",
3
+ "version": "3.6.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",