@krometra/ui-kit 0.6.1 → 0.7.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/README.md +21 -6
- package/dist/ui-kit.js +60 -10
- package/dist/ui-kit.umd.cjs +1 -1
- package/package.json +1 -1
- package/src/theme.js +46 -5
package/package.json
CHANGED
package/src/theme.js
CHANGED
|
@@ -25,7 +25,9 @@ export const schemes = ['light', 'dark', 'system']
|
|
|
25
25
|
* Нейтрали задаются отдельно от акцента: одинаковый синий на холодном и на
|
|
26
26
|
* тёплом сером выглядит как два разных бренда, и подбирать их порознь удобнее,
|
|
27
27
|
* чем держать десяток почти одинаковых палитр. Пресет может уточнить нейтрали
|
|
28
|
-
* точечно через `neutralOverrides` — так живут проектные темы.
|
|
28
|
+
* точечно через `neutralOverrides` — так живут проектные темы. Ещё пресет
|
|
29
|
+
* может задать свои `radius`, `density`, `elevation` и `font`: они действуют,
|
|
30
|
+
* пока ось не задана в теме явно.
|
|
29
31
|
*/
|
|
30
32
|
export const presets = {
|
|
31
33
|
default: {
|
|
@@ -95,6 +97,38 @@ export const presets = {
|
|
|
95
97
|
accentSoft: '#f4f4f5',
|
|
96
98
|
neutral: 'plain',
|
|
97
99
|
},
|
|
100
|
+
blocky: {
|
|
101
|
+
label: 'Blocky',
|
|
102
|
+
accent: '#4f8a25',
|
|
103
|
+
accentHover: '#3f711c',
|
|
104
|
+
accentSoft: '#e8f3dc',
|
|
105
|
+
neutral: 'warm',
|
|
106
|
+
radius: 'square',
|
|
107
|
+
elevation: 'hard',
|
|
108
|
+
font: 'rounded',
|
|
109
|
+
neutralOverrides: {
|
|
110
|
+
light: {
|
|
111
|
+
bg: '#e7e1d3',
|
|
112
|
+
surface: '#fbf8f1',
|
|
113
|
+
surfaceMuted: '#f1ebdf',
|
|
114
|
+
border: '#cdc3ae',
|
|
115
|
+
borderStrong: '#8a7a5c',
|
|
116
|
+
text: '#2b2418',
|
|
117
|
+
textMuted: '#675a43',
|
|
118
|
+
textFaint: '#9a8c72',
|
|
119
|
+
},
|
|
120
|
+
dark: {
|
|
121
|
+
bg: '#1b1814',
|
|
122
|
+
surface: '#27231d',
|
|
123
|
+
surfaceMuted: '#302b24',
|
|
124
|
+
border: '#443d32',
|
|
125
|
+
borderStrong: '#6b5f4c',
|
|
126
|
+
text: '#efe8da',
|
|
127
|
+
textMuted: '#b2a58c',
|
|
128
|
+
textFaint: '#7c715f',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
98
132
|
}
|
|
99
133
|
|
|
100
134
|
/** Нейтральные шкалы: фон, поверхности, границы, текст — для обеих схем. */
|
|
@@ -193,6 +227,7 @@ export const radiusScales = {
|
|
|
193
227
|
default: { sm: '6px', md: '8px', lg: '14px' },
|
|
194
228
|
soft: { sm: '9px', md: '12px', lg: '20px' },
|
|
195
229
|
pill: { sm: '12px', md: '16px', lg: '28px' },
|
|
230
|
+
square: { sm: '0px', md: '0px', lg: '0px' },
|
|
196
231
|
}
|
|
197
232
|
|
|
198
233
|
/** Плотность: высота контролов и базовый шаг. */
|
|
@@ -216,6 +251,10 @@ export const elevations = {
|
|
|
216
251
|
light: { sm: '0 1px 3px rgba(15, 23, 42, 0.08)', md: '0 8px 24px rgba(15, 23, 42, 0.12)', lg: '0 24px 60px rgba(15, 23, 42, 0.20)' },
|
|
217
252
|
dark: { sm: '0 1px 3px rgba(0, 0, 0, 0.45)', md: '0 8px 24px rgba(0, 0, 0, 0.55)', lg: '0 24px 60px rgba(0, 0, 0, 0.7)' },
|
|
218
253
|
},
|
|
254
|
+
hard: {
|
|
255
|
+
light: { sm: '0 3px 0 rgba(43, 36, 24, 0.28)', md: '0 4px 0 rgba(43, 36, 24, 0.16)', lg: '0 8px 0 rgba(43, 36, 24, 0.22)' },
|
|
256
|
+
dark: { sm: '0 3px 0 rgba(0, 0, 0, 0.55)', md: '0 4px 0 rgba(0, 0, 0, 0.45)', lg: '0 8px 0 rgba(0, 0, 0, 0.6)' },
|
|
257
|
+
},
|
|
219
258
|
}
|
|
220
259
|
|
|
221
260
|
/** Шрифтовые пары. */
|
|
@@ -224,6 +263,7 @@ export const fontStacks = {
|
|
|
224
263
|
grotesk: "'Inter', 'Segoe UI', system-ui, sans-serif",
|
|
225
264
|
serif: "'Georgia', 'Times New Roman', serif",
|
|
226
265
|
mono: "ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace",
|
|
266
|
+
rounded: "ui-rounded, 'SF Pro Rounded', 'Nunito', 'Varela Round', 'Segoe UI', system-ui, sans-serif",
|
|
227
267
|
}
|
|
228
268
|
|
|
229
269
|
/** Сводит `system` к конкретной схеме по настройке ОС; вне браузера — light. */
|
|
@@ -254,10 +294,11 @@ export function buildTheme(theme = {}) {
|
|
|
254
294
|
...(spec.textMuted ? { textMuted: spec.textMuted } : {}),
|
|
255
295
|
...(spec.textFaint ? { textFaint: spec.textFaint } : {}),
|
|
256
296
|
}
|
|
257
|
-
const radius = radiusScales[spec.radius] ?? radiusScales.default
|
|
258
|
-
const density = densities[spec.density] ?? densities.default
|
|
259
|
-
const elevation = (elevations[spec.elevation] ?? elevations.default)[scheme]
|
|
260
|
-
const
|
|
297
|
+
const radius = radiusScales[spec.radius ?? preset.radius] ?? radiusScales.default
|
|
298
|
+
const density = densities[spec.density ?? preset.density] ?? densities.default
|
|
299
|
+
const elevation = (elevations[spec.elevation ?? preset.elevation] ?? elevations.default)[scheme]
|
|
300
|
+
const fontKey = spec.font ?? preset.font
|
|
301
|
+
const font = fontStacks[fontKey] ?? fontKey ?? fontStacks.system
|
|
261
302
|
|
|
262
303
|
const baseAccent = spec.accent ?? preset.accent
|
|
263
304
|
const accent = dark ? tint(baseAccent, 0.12) : baseAccent
|