@a-type/ui 3.0.12 → 3.0.14
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/dist/cjs/__tests__/setup.d.ts +1 -0
- package/dist/cjs/__tests__/setup.js +5 -0
- package/dist/cjs/__tests__/setup.js.map +1 -0
- package/dist/cjs/colors.stories.d.ts +1 -8
- package/dist/cjs/colors.stories.js +36 -26
- package/dist/cjs/colors.stories.js.map +1 -1
- package/dist/cjs/components/box/Box.d.ts +1 -1
- package/dist/cjs/components/box/Box.stories.js +2 -2
- package/dist/cjs/components/box/Box.stories.js.map +1 -1
- package/dist/cjs/components/button/Button.d.ts +1 -1
- package/dist/cjs/components/button/Button.stories.js +9 -9
- package/dist/cjs/components/button/Button.stories.js.map +1 -1
- package/dist/cjs/components/button/classes.d.ts +1 -1
- package/dist/cjs/components/card/Card.d.ts +1 -1
- package/dist/cjs/components/chip/Chip.d.ts +1 -1
- package/dist/cjs/components/colorPicker/ColorPicker.d.ts +1 -1
- package/dist/cjs/components/colorPicker/ColorPicker.js +2 -2
- package/dist/cjs/components/colorPicker/ColorPicker.js.map +1 -1
- package/dist/cjs/components/datePicker/DatePicker.d.ts +1 -1
- package/dist/cjs/components/dropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/cjs/components/layouts/PageRoot.d.ts +5 -1
- package/dist/cjs/components/layouts/PageRoot.js +22 -2
- package/dist/cjs/components/layouts/PageRoot.js.map +1 -1
- package/dist/cjs/components/note/Note.d.ts +1 -1
- package/dist/cjs/components/progress/Progress.d.ts +1 -1
- package/dist/cjs/components/slider/Slider.d.ts +1 -1
- package/dist/cjs/hooks/useOverrideTheme.d.ts +1 -1
- package/dist/cjs/hooks/useTitleBarColor.d.ts +4 -0
- package/dist/cjs/hooks/useTitleBarColor.js +33 -3
- package/dist/cjs/hooks/useTitleBarColor.js.map +1 -1
- package/dist/cjs/hooks/useTitleBarColor.stories.js +1 -1
- package/dist/cjs/hooks/useTitleBarColor.stories.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +2 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/uno/index.d.ts +1 -0
- package/dist/cjs/uno/index.js +8 -0
- package/dist/cjs/uno/index.js.map +1 -0
- package/dist/cjs/uno/logic/color.d.ts +100 -27
- package/dist/cjs/uno/logic/color.js +259 -42
- package/dist/cjs/uno/logic/color.js.map +1 -1
- package/dist/cjs/uno/logic/color.test.d.ts +1 -0
- package/dist/cjs/uno/logic/color.test.js +74 -0
- package/dist/cjs/uno/logic/color.test.js.map +1 -0
- package/dist/cjs/uno/logic/oklch.d.ts +3 -0
- package/dist/cjs/uno/logic/oklch.js +96 -0
- package/dist/cjs/uno/logic/oklch.js.map +1 -0
- package/dist/cjs/uno/logic/palettes.d.ts +63 -0
- package/dist/cjs/uno/logic/palettes.js +99 -0
- package/dist/cjs/uno/logic/palettes.js.map +1 -0
- package/dist/cjs/uno/preflights/colors.js +18 -42
- package/dist/cjs/uno/preflights/colors.js.map +1 -1
- package/dist/cjs/uno/preflights/fonts.d.ts +4 -0
- package/dist/cjs/uno/preflights/fonts.js +20 -0
- package/dist/cjs/uno/preflights/fonts.js.map +1 -0
- package/dist/cjs/uno/preflights/index.d.ts +2 -1
- package/dist/cjs/uno/preflights/index.js +2 -0
- package/dist/cjs/uno/preflights/index.js.map +1 -1
- package/dist/cjs/uno/theme/colors.d.ts +17 -53
- package/dist/cjs/uno/theme/colors.js +11 -13
- package/dist/cjs/uno/theme/colors.js.map +1 -1
- package/dist/cjs/uno/uno.preset.d.ts +2 -1
- package/dist/cjs/uno/uno.preset.js +3 -1
- package/dist/cjs/uno/uno.preset.js.map +1 -1
- package/dist/css/main.css +9 -8
- package/dist/esm/__tests__/setup.d.ts +1 -0
- package/dist/esm/__tests__/setup.js +3 -0
- package/dist/esm/__tests__/setup.js.map +1 -0
- package/dist/esm/colors.stories.d.ts +1 -8
- package/dist/esm/colors.stories.js +33 -26
- package/dist/esm/colors.stories.js.map +1 -1
- package/dist/esm/components/box/Box.d.ts +1 -1
- package/dist/esm/components/box/Box.stories.js +1 -1
- package/dist/esm/components/box/Box.stories.js.map +1 -1
- package/dist/esm/components/button/Button.d.ts +1 -1
- package/dist/esm/components/button/Button.stories.js +1 -1
- package/dist/esm/components/button/Button.stories.js.map +1 -1
- package/dist/esm/components/button/classes.d.ts +1 -1
- package/dist/esm/components/card/Card.d.ts +1 -1
- package/dist/esm/components/chip/Chip.d.ts +1 -1
- package/dist/esm/components/colorPicker/ColorPicker.d.ts +1 -1
- package/dist/esm/components/colorPicker/ColorPicker.js +1 -1
- package/dist/esm/components/colorPicker/ColorPicker.js.map +1 -1
- package/dist/esm/components/datePicker/DatePicker.d.ts +1 -1
- package/dist/esm/components/dropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/esm/components/layouts/PageRoot.d.ts +5 -1
- package/dist/esm/components/layouts/PageRoot.js +19 -2
- package/dist/esm/components/layouts/PageRoot.js.map +1 -1
- package/dist/esm/components/note/Note.d.ts +1 -1
- package/dist/esm/components/progress/Progress.d.ts +1 -1
- package/dist/esm/components/slider/Slider.d.ts +1 -1
- package/dist/esm/hooks/useOverrideTheme.d.ts +1 -1
- package/dist/esm/hooks/useTitleBarColor.d.ts +4 -0
- package/dist/esm/hooks/useTitleBarColor.js +32 -3
- package/dist/esm/hooks/useTitleBarColor.js.map +1 -1
- package/dist/esm/hooks/useTitleBarColor.stories.js +2 -2
- package/dist/esm/hooks/useTitleBarColor.stories.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/uno/index.d.ts +1 -0
- package/dist/esm/uno/index.js +3 -0
- package/dist/esm/uno/index.js.map +1 -0
- package/dist/esm/uno/logic/color.d.ts +100 -27
- package/dist/esm/uno/logic/color.js +256 -38
- package/dist/esm/uno/logic/color.js.map +1 -1
- package/dist/esm/uno/logic/color.test.d.ts +1 -0
- package/dist/esm/uno/logic/color.test.js +72 -0
- package/dist/esm/uno/logic/color.test.js.map +1 -0
- package/dist/esm/uno/logic/oklch.d.ts +3 -0
- package/dist/esm/uno/logic/oklch.js +90 -0
- package/dist/esm/uno/logic/oklch.js.map +1 -0
- package/dist/esm/uno/logic/palettes.d.ts +63 -0
- package/dist/esm/uno/logic/palettes.js +95 -0
- package/dist/esm/uno/logic/palettes.js.map +1 -0
- package/dist/esm/uno/preflights/colors.js +17 -41
- package/dist/esm/uno/preflights/colors.js.map +1 -1
- package/dist/esm/uno/preflights/fonts.d.ts +4 -0
- package/dist/esm/uno/preflights/fonts.js +16 -0
- package/dist/esm/uno/preflights/fonts.js.map +1 -0
- package/dist/esm/uno/preflights/index.d.ts +2 -1
- package/dist/esm/uno/preflights/index.js +2 -0
- package/dist/esm/uno/preflights/index.js.map +1 -1
- package/dist/esm/uno/theme/colors.d.ts +17 -53
- package/dist/esm/uno/theme/colors.js +11 -13
- package/dist/esm/uno/theme/colors.js.map +1 -1
- package/dist/esm/uno/uno.preset.d.ts +2 -1
- package/dist/esm/uno/uno.preset.js +3 -1
- package/dist/esm/uno/uno.preset.js.map +1 -1
- package/package.json +132 -125
- package/src/__tests__/setup.ts +1 -0
- package/src/colors.stories.tsx +94 -71
- package/src/components/box/Box.stories.tsx +1 -1
- package/src/components/box/Box.tsx +1 -1
- package/src/components/button/Button.stories.tsx +1 -1
- package/src/components/button/Button.tsx +1 -1
- package/src/components/button/classes.tsx +1 -1
- package/src/components/chip/Chip.tsx +1 -1
- package/src/components/colorPicker/ColorPicker.tsx +1 -1
- package/src/components/datePicker/DatePicker.tsx +1 -1
- package/src/components/dropdownMenu/DropdownMenu.tsx +1 -1
- package/src/components/layouts/PageRoot.tsx +29 -8
- package/src/components/note/Note.tsx +1 -1
- package/src/components/progress/Progress.tsx +1 -1
- package/src/components/slider/Slider.tsx +1 -1
- package/src/hooks/useOverrideTheme.ts +1 -1
- package/src/hooks/useTitleBarColor.stories.tsx +2 -2
- package/src/hooks/useTitleBarColor.ts +41 -3
- package/src/index.ts +1 -5
- package/src/themes.stories.tsx +1 -1
- package/src/uno/index.ts +5 -0
- package/src/uno/logic/color.test.ts +109 -0
- package/src/uno/logic/color.ts +428 -80
- package/src/uno/logic/oklch.ts +120 -0
- package/src/uno/logic/palettes.ts +266 -0
- package/src/uno/preflights/colors.ts +22 -41
- package/src/uno/preflights/fonts.ts +23 -0
- package/src/uno/preflights/index.ts +3 -1
- package/src/uno/theme/colors.ts +13 -18
- package/src/uno/uno.preset.ts +8 -3
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import {
|
|
2
|
+
livePropertyColorContext,
|
|
3
|
+
oklchBuilder,
|
|
4
|
+
OklchColorEquation,
|
|
5
|
+
} from './color.js';
|
|
6
|
+
|
|
7
|
+
export const paletteHues = {
|
|
8
|
+
primary: 'var(--p-primary-hue,91.8)',
|
|
9
|
+
accent: 'var(--p-accent-hue,160.88)',
|
|
10
|
+
main: 'var(--l-main-hue,var(--p-primary-hue,91.8))',
|
|
11
|
+
|
|
12
|
+
attention: 'var(--p-attention-hue,30)',
|
|
13
|
+
success: 'var(--p-success-hue,140)',
|
|
14
|
+
|
|
15
|
+
lemon: 'var(--p-lemon-hue,90.8)',
|
|
16
|
+
leek: 'var(--p-leek-hue,165.88)',
|
|
17
|
+
tomato: 'var(--p-tomato-hue,10.51)',
|
|
18
|
+
blueberry: 'var(--p-blueberry-hue,248.14)',
|
|
19
|
+
eggplant: 'var(--p-eggplant-hue,280.21)',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const paletteNames = [
|
|
23
|
+
'primary',
|
|
24
|
+
'accent',
|
|
25
|
+
'attention',
|
|
26
|
+
'success',
|
|
27
|
+
'lemon',
|
|
28
|
+
'leek',
|
|
29
|
+
'tomato',
|
|
30
|
+
'blueberry',
|
|
31
|
+
'eggplant',
|
|
32
|
+
'gray',
|
|
33
|
+
'high-contrast',
|
|
34
|
+
] as const;
|
|
35
|
+
export type PaletteName = (typeof paletteNames)[number];
|
|
36
|
+
|
|
37
|
+
export interface ColorLogicalPaletteDefinitions {
|
|
38
|
+
wash: OklchColorEquation;
|
|
39
|
+
light: OklchColorEquation;
|
|
40
|
+
default: OklchColorEquation;
|
|
41
|
+
dark: OklchColorEquation;
|
|
42
|
+
ink: OklchColorEquation;
|
|
43
|
+
}
|
|
44
|
+
export interface ColorPaletteStyles {
|
|
45
|
+
wash: string;
|
|
46
|
+
light: string;
|
|
47
|
+
DEFAULT: string;
|
|
48
|
+
dark: string;
|
|
49
|
+
ink: string;
|
|
50
|
+
[key: string]: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ColorLogicalPalette {
|
|
54
|
+
sourceHue: string;
|
|
55
|
+
saturation?: string;
|
|
56
|
+
definitions: ColorLogicalPaletteDefinitions;
|
|
57
|
+
styles: ColorPaletteStyles;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function createColorLogicalPalette({
|
|
61
|
+
sourceHue,
|
|
62
|
+
saturation,
|
|
63
|
+
}: {
|
|
64
|
+
sourceHue: string;
|
|
65
|
+
saturation?: string;
|
|
66
|
+
}): ColorLogicalPalette {
|
|
67
|
+
const definitions = {
|
|
68
|
+
wash: oklchBuilder(($) => ({
|
|
69
|
+
l: $.clamp(
|
|
70
|
+
$.add(
|
|
71
|
+
$.literal((ctx) => ctx.mode.lNeutral),
|
|
72
|
+
$.multiply(
|
|
73
|
+
$.literal((ctx) => ctx.mode.lRangeUp),
|
|
74
|
+
$.literal((ctx) => ctx.mode.mult),
|
|
75
|
+
$.literal((ctx) => ctx.localLightnessSpread),
|
|
76
|
+
),
|
|
77
|
+
),
|
|
78
|
+
$.literal(() => '0%'),
|
|
79
|
+
$.literal(() => '100%'),
|
|
80
|
+
),
|
|
81
|
+
c: $.clamp(
|
|
82
|
+
$.multiply(
|
|
83
|
+
$.literal(() => saturation ?? '1'),
|
|
84
|
+
$.literal((ctx) => ctx.localSaturation),
|
|
85
|
+
$.literal((ctx) => ctx.globalSaturation),
|
|
86
|
+
$.add(
|
|
87
|
+
$.literal((ctx) => ctx.mode.sNeutral),
|
|
88
|
+
$.multiply(
|
|
89
|
+
$.literal((ctx) => ctx.mode.sRangeUp),
|
|
90
|
+
$.literal((ctx) => ctx.mode.mult),
|
|
91
|
+
),
|
|
92
|
+
),
|
|
93
|
+
),
|
|
94
|
+
$.literal(() => '0%'),
|
|
95
|
+
$.literal(() => '100%'),
|
|
96
|
+
),
|
|
97
|
+
h: $.literal((ctx) => ctx.sourceHue),
|
|
98
|
+
})),
|
|
99
|
+
light: oklchBuilder(($) => ({
|
|
100
|
+
l: $.clamp(
|
|
101
|
+
$.add(
|
|
102
|
+
$.literal((ctx) => ctx.mode.lNeutral),
|
|
103
|
+
$.multiply(
|
|
104
|
+
$.literal((ctx) => ctx.mode.lRangeUp),
|
|
105
|
+
$.literal(() => '0.5'),
|
|
106
|
+
$.literal((ctx) => ctx.mode.mult),
|
|
107
|
+
$.literal((ctx) => ctx.localLightnessSpread),
|
|
108
|
+
),
|
|
109
|
+
),
|
|
110
|
+
$.literal(() => '0%'),
|
|
111
|
+
$.literal(() => '100%'),
|
|
112
|
+
),
|
|
113
|
+
c: $.clamp(
|
|
114
|
+
$.multiply(
|
|
115
|
+
$.literal(() => saturation ?? '1'),
|
|
116
|
+
$.literal((ctx) => ctx.localSaturation),
|
|
117
|
+
$.literal((ctx) => ctx.globalSaturation),
|
|
118
|
+
$.add(
|
|
119
|
+
$.literal((ctx) => ctx.mode.sNeutral),
|
|
120
|
+
$.multiply(
|
|
121
|
+
$.literal((ctx) => ctx.mode.sRangeUp),
|
|
122
|
+
$.literal(() => '0.75'),
|
|
123
|
+
$.literal((ctx) => ctx.mode.mult),
|
|
124
|
+
),
|
|
125
|
+
),
|
|
126
|
+
),
|
|
127
|
+
$.literal(() => '0%'),
|
|
128
|
+
$.literal(() => '100%'),
|
|
129
|
+
),
|
|
130
|
+
h: $.literal((ctx) => ctx.sourceHue),
|
|
131
|
+
})),
|
|
132
|
+
default: oklchBuilder(($) => ({
|
|
133
|
+
l: $.literal((ctx) => ctx.mode.lNeutral),
|
|
134
|
+
c: $.clamp(
|
|
135
|
+
$.multiply(
|
|
136
|
+
$.literal(() => saturation ?? '1'),
|
|
137
|
+
$.literal((ctx) => ctx.localSaturation),
|
|
138
|
+
$.literal((ctx) => ctx.globalSaturation),
|
|
139
|
+
$.literal((ctx) => ctx.mode.sNeutral),
|
|
140
|
+
),
|
|
141
|
+
$.literal(() => '0%'),
|
|
142
|
+
$.literal(() => '100%'),
|
|
143
|
+
),
|
|
144
|
+
h: $.literal((ctx) => ctx.sourceHue),
|
|
145
|
+
})),
|
|
146
|
+
dark: oklchBuilder(($) => ({
|
|
147
|
+
l: $.clamp(
|
|
148
|
+
$.subtract(
|
|
149
|
+
$.literal((ctx) => ctx.mode.lNeutral),
|
|
150
|
+
$.multiply(
|
|
151
|
+
$.literal((ctx) => ctx.mode.lRangeDown),
|
|
152
|
+
$.literal(() => '0.35'),
|
|
153
|
+
$.literal((ctx) => ctx.mode.mult),
|
|
154
|
+
$.literal((ctx) => ctx.localLightnessSpread),
|
|
155
|
+
),
|
|
156
|
+
),
|
|
157
|
+
$.literal(() => '0%'),
|
|
158
|
+
$.literal(() => '100%'),
|
|
159
|
+
),
|
|
160
|
+
c: $.clamp(
|
|
161
|
+
$.multiply(
|
|
162
|
+
$.literal(() => saturation ?? '1'),
|
|
163
|
+
$.literal((ctx) => ctx.localSaturation),
|
|
164
|
+
$.literal((ctx) => ctx.globalSaturation),
|
|
165
|
+
$.subtract(
|
|
166
|
+
$.literal((ctx) => ctx.mode.sNeutral),
|
|
167
|
+
$.multiply(
|
|
168
|
+
$.literal((ctx) => ctx.mode.sRangeDown),
|
|
169
|
+
$.literal(() => '0.5'),
|
|
170
|
+
$.literal((ctx) => ctx.mode.mult),
|
|
171
|
+
),
|
|
172
|
+
),
|
|
173
|
+
),
|
|
174
|
+
$.literal(() => '0%'),
|
|
175
|
+
$.literal(() => '100%'),
|
|
176
|
+
),
|
|
177
|
+
h: $.literal((ctx) => ctx.sourceHue),
|
|
178
|
+
})),
|
|
179
|
+
ink: oklchBuilder(($) => ({
|
|
180
|
+
l: $.clamp(
|
|
181
|
+
$.subtract(
|
|
182
|
+
$.literal((ctx) => ctx.mode.lNeutral),
|
|
183
|
+
$.multiply(
|
|
184
|
+
$.literal((ctx) => ctx.mode.lRangeDown),
|
|
185
|
+
$.literal(() => '1'),
|
|
186
|
+
$.literal((ctx) => ctx.mode.mult),
|
|
187
|
+
$.literal((ctx) => ctx.localLightnessSpread),
|
|
188
|
+
),
|
|
189
|
+
),
|
|
190
|
+
$.literal(() => '0%'),
|
|
191
|
+
$.literal(() => '100%'),
|
|
192
|
+
),
|
|
193
|
+
c: $.clamp(
|
|
194
|
+
$.multiply(
|
|
195
|
+
$.literal(() => saturation ?? '1'),
|
|
196
|
+
$.literal((ctx) => ctx.localSaturation),
|
|
197
|
+
$.literal((ctx) => ctx.globalSaturation),
|
|
198
|
+
$.subtract(
|
|
199
|
+
$.literal((ctx) => ctx.mode.sNeutral),
|
|
200
|
+
$.multiply(
|
|
201
|
+
$.literal((ctx) => ctx.mode.sRangeDown),
|
|
202
|
+
$.literal(() => '1'),
|
|
203
|
+
$.literal((ctx) => ctx.mode.mult),
|
|
204
|
+
),
|
|
205
|
+
),
|
|
206
|
+
),
|
|
207
|
+
$.literal(() => '0%'),
|
|
208
|
+
$.literal(() => '100%'),
|
|
209
|
+
),
|
|
210
|
+
h: $.literal((ctx) => ctx.sourceHue),
|
|
211
|
+
})),
|
|
212
|
+
};
|
|
213
|
+
return {
|
|
214
|
+
sourceHue,
|
|
215
|
+
saturation,
|
|
216
|
+
definitions,
|
|
217
|
+
styles: createPaletteStyles(sourceHue, definitions),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface ColorPaletteStyles {
|
|
222
|
+
wash: string;
|
|
223
|
+
light: string;
|
|
224
|
+
DEFAULT: string;
|
|
225
|
+
dark: string;
|
|
226
|
+
ink: string;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function createPaletteStyles(
|
|
230
|
+
sourceHue: string,
|
|
231
|
+
definitions: ColorLogicalPaletteDefinitions,
|
|
232
|
+
): ColorPaletteStyles {
|
|
233
|
+
const ctx = livePropertyColorContext(sourceHue);
|
|
234
|
+
return {
|
|
235
|
+
wash: definitions.wash.print(ctx),
|
|
236
|
+
light: definitions.light.print(ctx),
|
|
237
|
+
DEFAULT: definitions.default.print(ctx),
|
|
238
|
+
dark: definitions.dark.print(ctx),
|
|
239
|
+
ink: definitions.ink.print(ctx),
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export const graySaturation = '0.15';
|
|
244
|
+
export const highContrastSaturation = '0.04';
|
|
245
|
+
|
|
246
|
+
export const palettes = {
|
|
247
|
+
main: createColorLogicalPalette({ sourceHue: paletteHues.main }),
|
|
248
|
+
primary: createColorLogicalPalette({ sourceHue: paletteHues.primary }),
|
|
249
|
+
accent: createColorLogicalPalette({ sourceHue: paletteHues.accent }),
|
|
250
|
+
attention: createColorLogicalPalette({ sourceHue: paletteHues.attention }),
|
|
251
|
+
success: createColorLogicalPalette({ sourceHue: paletteHues.success }),
|
|
252
|
+
gray: createColorLogicalPalette({
|
|
253
|
+
sourceHue: paletteHues.main,
|
|
254
|
+
saturation: graySaturation,
|
|
255
|
+
}),
|
|
256
|
+
['high-contrast']: createColorLogicalPalette({
|
|
257
|
+
sourceHue: paletteHues.main,
|
|
258
|
+
saturation: highContrastSaturation,
|
|
259
|
+
}),
|
|
260
|
+
|
|
261
|
+
lemon: createColorLogicalPalette({ sourceHue: paletteHues.lemon }),
|
|
262
|
+
leek: createColorLogicalPalette({ sourceHue: paletteHues.leek }),
|
|
263
|
+
tomato: createColorLogicalPalette({ sourceHue: paletteHues.tomato }),
|
|
264
|
+
blueberry: createColorLogicalPalette({ sourceHue: paletteHues.blueberry }),
|
|
265
|
+
eggplant: createColorLogicalPalette({ sourceHue: paletteHues.eggplant }),
|
|
266
|
+
};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
graySaturation,
|
|
3
|
+
highContrastSaturation,
|
|
4
|
+
paletteNames,
|
|
5
|
+
palettes,
|
|
6
|
+
} from '../logic/palettes.js';
|
|
2
7
|
import { preflight } from './_util.js';
|
|
3
8
|
|
|
4
9
|
const baseThemeCSS = `
|
|
5
|
-
--v-color: ${
|
|
10
|
+
--v-color: ${palettes['high-contrast'].styles.ink};
|
|
6
11
|
color: var(--v-color);
|
|
7
|
-
--v-bg: ${
|
|
12
|
+
--v-bg: ${palettes['high-contrast'].styles.wash};
|
|
8
13
|
background-color: var(--v-bg);
|
|
9
14
|
`;
|
|
10
15
|
|
|
@@ -21,14 +26,7 @@ export const colorPreflight = preflight({
|
|
|
21
26
|
--p-success-hue: 140;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
|
-
.theme-lemon {
|
|
25
|
-
--p-primary-hue: var(--p-lemon-hue);
|
|
26
|
-
--p-accent-hue: var(--p-leek-hue);
|
|
27
|
-
--l-main-hue: var(--p-primary-hue);
|
|
28
|
-
|
|
29
|
-
${baseThemeCSS}
|
|
30
|
-
}
|
|
31
|
-
.theme-override-lemon.theme-override-lemon {
|
|
29
|
+
.theme-lemon, .theme-override-lemon.theme-override-lemon {
|
|
32
30
|
--p-primary-hue: var(--p-lemon-hue);
|
|
33
31
|
--p-accent-hue: var(--p-leek-hue);
|
|
34
32
|
--l-main-hue: var(--p-primary-hue);
|
|
@@ -36,14 +34,7 @@ export const colorPreflight = preflight({
|
|
|
36
34
|
${baseThemeCSS}
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
.theme-leek {
|
|
40
|
-
--p-primary-hue: var(--p-leek-hue);
|
|
41
|
-
--p-accent-hue: var(--p-lemon-hue);
|
|
42
|
-
--l-main-hue: var(--p-primary-hue);
|
|
43
|
-
|
|
44
|
-
${baseThemeCSS}
|
|
45
|
-
}
|
|
46
|
-
.theme-override-leek.theme-override-leek {
|
|
37
|
+
.theme-leek, .theme-override-leek.theme-override-leek {
|
|
47
38
|
--p-primary-hue: var(--p-leek-hue);
|
|
48
39
|
--p-accent-hue: var(--p-lemon-hue);
|
|
49
40
|
--l-main-hue: var(--p-primary-hue);
|
|
@@ -51,48 +42,38 @@ export const colorPreflight = preflight({
|
|
|
51
42
|
${baseThemeCSS}
|
|
52
43
|
}
|
|
53
44
|
|
|
54
|
-
.theme-tomato {
|
|
45
|
+
.theme-tomato, .theme-override-tomato.theme-override-tomato {
|
|
55
46
|
--p-primary-hue: var(--p-tomato-hue);
|
|
56
47
|
--p-accent-hue: var(--p-leek-hue);
|
|
57
48
|
--l-main-hue: var(--p-primary-hue);
|
|
58
49
|
|
|
59
50
|
${baseThemeCSS}
|
|
60
51
|
}
|
|
61
|
-
.theme-override-tomato.theme-override-tomato {
|
|
62
|
-
--p-primary-hue: var(--p-tomato-hue);
|
|
63
|
-
--p-accent-hue: var(--p-leek-hue);
|
|
64
|
-
--l-main-hue: var(--p-primary-hue);
|
|
65
52
|
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.theme-blueberry {
|
|
53
|
+
.theme-blueberry, .theme-override-blueberry.theme-override-blueberry {
|
|
70
54
|
--p-primary-hue: var(--p-blueberry-hue);
|
|
71
55
|
--p-accent-hue: var(--p-leek-hue);
|
|
72
56
|
--l-main-hue: var(--p-primary-hue);
|
|
73
57
|
|
|
74
58
|
${baseThemeCSS}
|
|
75
59
|
}
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
|
|
61
|
+
.theme-eggplant, .theme-override-eggplant.theme-override-eggplant {
|
|
62
|
+
--p-primary-hue: var(--p-eggplant-hue);
|
|
78
63
|
--p-accent-hue: var(--p-leek-hue);
|
|
79
64
|
--l-main-hue: var(--p-primary-hue);
|
|
80
65
|
|
|
81
66
|
${baseThemeCSS}
|
|
82
67
|
}
|
|
83
68
|
|
|
84
|
-
.theme-
|
|
85
|
-
--
|
|
86
|
-
--p-accent-hue: var(--p-leek-hue);
|
|
87
|
-
--l-main-hue: var(--p-primary-hue);
|
|
88
|
-
|
|
69
|
+
.theme-gray, .theme-salt, .theme-override-gray.theme-override-gray {
|
|
70
|
+
--l-saturation: ${graySaturation};
|
|
89
71
|
${baseThemeCSS}
|
|
90
72
|
}
|
|
91
|
-
.theme-override-eggplant.theme-override-eggplant {
|
|
92
|
-
--p-primary-hue: var(--p-eggplant-hue);
|
|
93
|
-
--p-accent-hue: var(--p-leek-hue);
|
|
94
|
-
--l-main-hue: var(--p-primary-hue);
|
|
95
73
|
|
|
74
|
+
.theme-high-contrast, .theme-override-high-contrast.theme-override-high-contrast {
|
|
75
|
+
--l-saturation: ${highContrastSaturation};
|
|
76
|
+
--l-lightness-spread: 10;
|
|
96
77
|
${baseThemeCSS}
|
|
97
78
|
}
|
|
98
79
|
|
|
@@ -101,10 +82,10 @@ ${paletteNames
|
|
|
101
82
|
.map(createPaletteClass)
|
|
102
83
|
.join('\n')}
|
|
103
84
|
.palette-gray {
|
|
104
|
-
--l-saturation:
|
|
85
|
+
--l-saturation: ${graySaturation};
|
|
105
86
|
}
|
|
106
87
|
.palette-high-contrast {
|
|
107
|
-
--l-saturation:
|
|
88
|
+
--l-saturation: ${highContrastSaturation};
|
|
108
89
|
--l-lightness-spread: 10;
|
|
109
90
|
}
|
|
110
91
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { preflight } from './_util.js';
|
|
2
|
+
|
|
3
|
+
export interface FontsPreflightOptions {
|
|
4
|
+
interFontLocation: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const fontsPreflight = (
|
|
8
|
+
{ interFontLocation }: FontsPreflightOptions = {
|
|
9
|
+
interFontLocation:
|
|
10
|
+
'https://resources.biscuits.club/fonts/Inter-VariableFont_slnt,wght.ttf',
|
|
11
|
+
},
|
|
12
|
+
) =>
|
|
13
|
+
preflight({
|
|
14
|
+
getCSS: () => `
|
|
15
|
+
@font-face {
|
|
16
|
+
font-family: "Inter";
|
|
17
|
+
src: url("${interFontLocation}") format("truetype-variations");
|
|
18
|
+
font-weight: 1 999;
|
|
19
|
+
font-style: oblique 0deg 5deg;
|
|
20
|
+
font-display: block;
|
|
21
|
+
}
|
|
22
|
+
`,
|
|
23
|
+
});
|
|
@@ -6,11 +6,12 @@ import {
|
|
|
6
6
|
ThemeCustomizationConfig,
|
|
7
7
|
} from './customization.js';
|
|
8
8
|
import { darkModePreflight } from './dark.js';
|
|
9
|
+
import { fontsPreflight, FontsPreflightOptions } from './fonts.js';
|
|
9
10
|
import { globalPreflight } from './globals.js';
|
|
10
11
|
import { layerPreflight } from './layers.js';
|
|
11
12
|
|
|
12
13
|
export const preflights = (
|
|
13
|
-
config: ThemeCustomizationConfig,
|
|
14
|
+
config: ThemeCustomizationConfig & FontsPreflightOptions,
|
|
14
15
|
): Preflight<any>[] => [
|
|
15
16
|
layerPreflight,
|
|
16
17
|
basePreflight,
|
|
@@ -18,4 +19,5 @@ export const preflights = (
|
|
|
18
19
|
colorPreflight,
|
|
19
20
|
darkModePreflight,
|
|
20
21
|
customizationPreflight(config),
|
|
22
|
+
fontsPreflight(config),
|
|
21
23
|
];
|
package/src/uno/theme/colors.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
paletteHues,
|
|
4
|
-
whiteBlackRange,
|
|
5
|
-
} from '../logic/color.js';
|
|
1
|
+
import { Theme } from '@unocss/preset-mini';
|
|
2
|
+
import { palettes } from '../logic/palettes.js';
|
|
6
3
|
|
|
7
4
|
const contrastClamp = 'clamp(0, (0.36 / y - 1) * infinity, 1)';
|
|
8
5
|
|
|
@@ -11,25 +8,23 @@ export const colors = {
|
|
|
11
8
|
transparent: 'transparent',
|
|
12
9
|
current: 'currentColor',
|
|
13
10
|
|
|
14
|
-
black:
|
|
15
|
-
white:
|
|
16
|
-
wash:
|
|
17
|
-
saturation: '3%',
|
|
18
|
-
}).wash,
|
|
19
|
-
contrast: `color(from var(--l-contrast-bg,var(--v-bg-altered,var(--v-bg,var(--mode-white)))) xyz-d65 ${contrastClamp} ${contrastClamp} ${contrastClamp})`,
|
|
11
|
+
black: palettes['high-contrast'].styles.ink,
|
|
12
|
+
white: palettes['high-contrast'].styles.wash,
|
|
13
|
+
wash: palettes.gray.styles.wash,
|
|
20
14
|
|
|
21
15
|
// magic tokens
|
|
16
|
+
contrast: `color(from var(--l-contrast-bg,var(--v-bg-altered,var(--v-bg,var(--mode-white)))) xyz-d65 ${contrastClamp} ${contrastClamp} ${contrastClamp})`,
|
|
22
17
|
bg: 'var(--v-bg-altered, var(--v-bg, transparent))',
|
|
23
18
|
fg: 'var(--v-color-altered, var(--v-color, var(--mode-black)))',
|
|
24
19
|
color: 'var(--v-color-altered, var(--v-color, var(--mode-black)))',
|
|
25
20
|
border: 'var(--v-border-altered, var(--v-border, transparent))',
|
|
26
21
|
|
|
27
|
-
primary:
|
|
28
|
-
accent:
|
|
29
|
-
attention:
|
|
30
|
-
success:
|
|
22
|
+
primary: palettes.primary.styles,
|
|
23
|
+
accent: palettes.accent.styles,
|
|
24
|
+
attention: palettes.attention.styles,
|
|
25
|
+
success: palettes.success.styles,
|
|
31
26
|
|
|
32
|
-
main:
|
|
27
|
+
main: palettes.main.styles,
|
|
33
28
|
|
|
34
|
-
gray:
|
|
35
|
-
}
|
|
29
|
+
gray: palettes.gray.styles,
|
|
30
|
+
} satisfies Record<string, string | Theme['colors']>;
|
package/src/uno/uno.preset.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import presetWind3 from '@unocss/preset-wind3';
|
|
2
2
|
import { Preset } from 'unocss';
|
|
3
3
|
import { ThemeCustomizationConfig } from './preflights/customization.js';
|
|
4
|
+
import { FontsPreflightOptions } from './preflights/fonts.js';
|
|
4
5
|
import { preflights } from './preflights/index.js';
|
|
5
6
|
import { rules } from './rules/index.js';
|
|
6
7
|
import { shortcuts } from './shortcuts/index.js';
|
|
@@ -8,9 +9,13 @@ import { theme } from './theme/index.js';
|
|
|
8
9
|
import { variants } from './variants/index.js';
|
|
9
10
|
|
|
10
11
|
export default function presetAtype(
|
|
11
|
-
config: ThemeCustomizationConfig &
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
config: ThemeCustomizationConfig &
|
|
13
|
+
FontsPreflightOptions & {
|
|
14
|
+
noPreflight?: boolean;
|
|
15
|
+
} = {
|
|
16
|
+
interFontLocation:
|
|
17
|
+
'https://resources.biscuits.club/fonts/Inter-VariableFont_slnt,wght.ttf',
|
|
18
|
+
},
|
|
14
19
|
): Preset {
|
|
15
20
|
return {
|
|
16
21
|
name: 'atype',
|