@krometra/ui-kit 0.7.0 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krometra/ui-kit",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "UI-kit на Vue 3 со сменными темами, светлой и тёмной схемой; интерактивные компоненты на zag.js",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/theme.js CHANGED
@@ -27,7 +27,9 @@ export const schemes = ['light', 'dark', 'system']
27
27
  * чем держать десяток почти одинаковых палитр. Пресет может уточнить нейтрали
28
28
  * точечно через `neutralOverrides` — так живут проектные темы. Ещё пресет
29
29
  * может задать свои `radius`, `density`, `elevation` и `font`: они действуют,
30
- * пока ось не задана в теме явно.
30
+ * пока ось не задана в теме явно. `accentOverrides` и `semanticOverrides`
31
+ * по схемам (`light`, `dark`) задают акцент и цвета статусов точно, когда
32
+ * подобранная вручную палитра должна совпасть с макетом.
31
33
  */
32
34
  export const presets = {
33
35
  default: {
@@ -97,6 +99,51 @@ export const presets = {
97
99
  accentSoft: '#f4f4f5',
98
100
  neutral: 'plain',
99
101
  },
102
+ bordeaux: {
103
+ label: 'Bordeaux',
104
+ accent: '#8a3a48',
105
+ accentHover: '#73303c',
106
+ accentSoft: '#f3e6e8',
107
+ neutral: 'warm',
108
+ font: "'Golos Text', -apple-system, 'Segoe UI', Roboto, sans-serif",
109
+ accentOverrides: {
110
+ dark: { accent: '#e3929e', accentHover: '#eaa9b3', accentSoft: '#33242a' },
111
+ },
112
+ semanticOverrides: {
113
+ light: {
114
+ success: { base: '#2c7656', hover: '#235f45', soft: '#e3f1ea', strong: '#2c7656' },
115
+ info: { base: '#3b6286', hover: '#2f4f6c', soft: '#e5edf5', strong: '#3b6286' },
116
+ danger: { base: '#b03a37', hover: '#922f2d', soft: '#fbe8e6', strong: '#b03a37' },
117
+ },
118
+ dark: {
119
+ success: { base: '#72c9a2', hover: '#8fd6b6', soft: '#1b3228', strong: '#72c9a2' },
120
+ info: { base: '#94b8db', hover: '#adc9e4', soft: '#1c2936', strong: '#94b8db' },
121
+ danger: { base: '#f08d83', hover: '#f4a69e', soft: '#3a2220', strong: '#f08d83' },
122
+ },
123
+ },
124
+ neutralOverrides: {
125
+ light: {
126
+ bg: '#f6f4f4',
127
+ surface: '#ffffff',
128
+ surfaceMuted: '#faf8f8',
129
+ border: '#e3dcdd',
130
+ borderStrong: '#cdc3c4',
131
+ text: '#1e2327',
132
+ textMuted: '#5f666c',
133
+ textFaint: '#959ca1',
134
+ },
135
+ dark: {
136
+ bg: '#15181b',
137
+ surface: '#1d2125',
138
+ surfaceMuted: '#24292e',
139
+ border: '#30353a',
140
+ borderStrong: '#454b52',
141
+ text: '#ebe7e7',
142
+ textMuted: '#a3a9ae',
143
+ textFaint: '#737a80',
144
+ },
145
+ },
146
+ },
100
147
  blocky: {
101
148
  label: 'Blocky',
102
149
  accent: '#4f8a25',
@@ -300,11 +347,12 @@ export function buildTheme(theme = {}) {
300
347
  const fontKey = spec.font ?? preset.font
301
348
  const font = fontStacks[fontKey] ?? fontKey ?? fontStacks.system
302
349
 
350
+ const own = spec.accent ? null : preset.accentOverrides?.[scheme]
303
351
  const baseAccent = spec.accent ?? preset.accent
304
- const accent = dark ? tint(baseAccent, 0.12) : baseAccent
305
- const accentHover = spec.accentHover
352
+ const accent = own?.accent ?? (dark ? tint(baseAccent, 0.12) : baseAccent)
353
+ const accentHover = spec.accentHover ?? own?.accentHover
306
354
  ?? (dark ? tint(accent, 0.14) : spec.accent ? shade(accent, -0.12) : preset.accentHover)
307
- const accentSoft = spec.accentSoft
355
+ const accentSoft = spec.accentSoft ?? own?.accentSoft
308
356
  ?? (dark ? mix(accent, neutral.surface, 0.22) : spec.accent ? tint(accent, 0.92) : preset.accentSoft)
309
357
 
310
358
  const vars = {
@@ -342,7 +390,8 @@ export function buildTheme(theme = {}) {
342
390
  '--k-font': font,
343
391
  }
344
392
 
345
- for (const [name, tone] of Object.entries(semantics[scheme])) {
393
+ const tones = { ...semantics[scheme], ...preset.semanticOverrides?.[scheme] }
394
+ for (const [name, tone] of Object.entries(tones)) {
346
395
  vars[`--k-${name}`] = tone.base
347
396
  vars[`--k-${name}-hover`] = tone.hover
348
397
  vars[`--k-${name}-soft`] = tone.soft ?? mix(tone.base, neutral.surface, 0.18)