@stackoverflow/stacks 1.10.2 → 2.0.0-rc.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 +15 -0
- package/dist/css/stacks.css +7428 -4429
- package/dist/css/stacks.min.css +1 -1
- package/lib/atomic/__snapshots__/color-new.less.test.ts.snap +3015 -0
- package/lib/atomic/__snapshots__/color.less.test.ts.snap +2886 -0
- package/lib/atomic/border.less +0 -258
- package/lib/atomic/color.less +26 -200
- package/lib/atomic/color.less.test.ts +12 -0
- package/lib/atomic/misc.less +7 -6
- package/lib/atomic/typography.less +0 -7
- package/lib/atomic/v1/__snapshots__/border.less.test.ts.snap +552 -0
- package/lib/atomic/v1/__snapshots__/color.less.test.ts.snap +6756 -0
- package/lib/atomic/v1/__snapshots__/typography.less.test.ts.snap +22 -0
- package/lib/atomic/v1/border.less +210 -0
- package/lib/atomic/v1/border.less.test.ts +14 -0
- package/lib/atomic/v1/color.less +183 -0
- package/lib/atomic/v1/color.less.test.ts +14 -0
- package/lib/atomic/v1/typography.less +8 -0
- package/lib/atomic/v1/typography.less.test.ts +14 -0
- package/lib/components/activity-indicator/activity-indicator.a11y.test.ts +1 -8
- package/lib/components/activity-indicator/activity-indicator.less +4 -4
- package/lib/components/anchor/anchor.a11y.test.ts +0 -5
- package/lib/components/anchor/anchor.less +4 -4
- package/lib/components/anchor/anchor.visual.test.ts +1 -1
- package/lib/components/avatar/avatar.less +2 -2
- package/lib/components/award-bling/award-bling.less +3 -3
- package/lib/components/badge/badge.a11y.test.ts +2 -12
- package/lib/components/badge/badge.less +40 -40
- package/lib/components/badge/badge.visual.test.ts +27 -5
- package/lib/components/block-link/block-link.a11y.test.ts +0 -7
- package/lib/components/block-link/block-link.less +8 -8
- package/lib/components/breadcrumbs/breadcrumbs.less +1 -1
- package/lib/components/button/button.a11y.test.ts +0 -3
- package/lib/components/button/button.less +40 -40
- package/lib/components/button/button.visual.test.ts +1 -1
- package/lib/components/check-control/check-control.a11y.test.ts +0 -5
- package/lib/components/check-control/check-control.visual.test.ts +1 -1
- package/lib/components/checkbox_radio/checkbox_radio.less +5 -5
- package/lib/components/checkbox_radio/checkbox_radio.visual.test.ts +1 -1
- package/lib/components/code-block/code-block.less +3 -3
- package/lib/components/description/description.a11y.test.ts +0 -1
- package/lib/components/description/description.visual.test.ts +1 -1
- package/lib/components/input-fill/input-fill.less +2 -2
- package/lib/components/input-icon/input-icon.less +2 -2
- package/lib/components/input-message/input-message.less +8 -8
- package/lib/components/input_textarea/input_textarea.less +6 -6
- package/lib/components/label/label.less +11 -11
- package/lib/components/link/link.a11y.test.ts +0 -8
- package/lib/components/link/link.less +8 -8
- package/lib/components/link-preview/link-preview.less +9 -9
- package/lib/components/menu/menu.less +3 -3
- package/lib/components/modal/modal.less +5 -4
- package/lib/components/navigation/navigation.less +11 -11
- package/lib/components/notice/notice.less +48 -48
- package/lib/components/pagination/pagination.less +3 -3
- package/lib/components/popover/popover.less +2 -2
- package/lib/components/popover/tooltip.test.ts +1 -1
- package/lib/components/post-summary/post-summary.less +40 -40
- package/lib/components/progress-bar/progress-bar.less +15 -15
- package/lib/components/prose/prose.less +15 -15
- package/lib/components/select/select.less +5 -5
- package/lib/components/sidebar-widget/sidebar-widget.less +12 -12
- package/lib/components/table/table.less +7 -7
- package/lib/components/tag/tag.less +25 -25
- package/lib/components/toggle-switch/toggle-switch.a11y.test.ts +0 -4
- package/lib/components/toggle-switch/toggle-switch.less +4 -4
- package/lib/components/toggle-switch/toggle-switch.visual.test.ts +12 -11
- package/lib/components/topbar/topbar.less +34 -34
- package/lib/components/uploader/uploader.less +15 -15
- package/lib/components/user-card/user-card.less +7 -7
- package/lib/exports/__snapshots__/color-mixins.less.test.ts.snap +539 -0
- package/lib/exports/__snapshots__/color.less.test.ts.snap +762 -0
- package/lib/exports/color-mixins.less +280 -0
- package/lib/exports/color-mixins.less.test.ts +150 -0
- package/lib/exports/color-sets.less +620 -0
- package/lib/exports/color.less +57 -0
- package/lib/exports/color.less.test.ts +12 -0
- package/lib/exports/exports.less +2 -1
- package/lib/exports/mixins.less +17 -5
- package/lib/exports/theme.less +85 -0
- package/lib/exports/v1/__snapshots__/constants-colors.less.test.ts.snap +902 -0
- package/lib/exports/v1/constants-colors.less +893 -0
- package/lib/exports/v1/constants-colors.less.test.ts +12 -0
- package/lib/stacks-static.less +5 -0
- package/lib/test/axe-apca/README.md +34 -0
- package/lib/test/axe-apca/index.ts +3 -0
- package/lib/test/axe-apca/package.wip.json +30 -0
- package/lib/test/axe-apca/src/apca-w3.d.ts +3 -0
- package/lib/test/axe-apca/src/axe-apca.test.ts +155 -0
- package/lib/test/axe-apca/src/axe-apca.ts +212 -0
- package/lib/test/less-test-utils.ts +28 -0
- package/lib/test/test-utils.ts +18 -1
- package/lib/tsconfig.json +1 -0
- package/package.json +14 -7
- package/lib/exports/constants-colors.less +0 -1100
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
@import (reference) "./mixins.less";
|
|
2
|
+
@import (reference) "./color-sets.less";
|
|
3
|
+
@import (reference) "./theme.less";
|
|
4
|
+
|
|
5
|
+
// Type definitions
|
|
6
|
+
//
|
|
7
|
+
// @mode: light | dark | light-highcontrast | dark-highcontrast;
|
|
8
|
+
// @modeCustom: base | dark; // legacy we're supporting for theming in Core
|
|
9
|
+
// @modeSimple: light | dark; // TODO consider different name?
|
|
10
|
+
// @property: all | background-color | border-color | color;
|
|
11
|
+
// @set: { [key: stop]: color }[];
|
|
12
|
+
// @sets: set[] | { [key: string]: set }[];
|
|
13
|
+
// @stop: default | 050 | 100 | 150 | 200 | 225 | 300 | 350 | 400 | 500 | 600;
|
|
14
|
+
// @tier: primary | secondary;
|
|
15
|
+
// @type: classes | variables;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Primary function to generate colors variables for a given mode.
|
|
19
|
+
*
|
|
20
|
+
* Usage example:
|
|
21
|
+
* .generate-colors(dark);
|
|
22
|
+
*
|
|
23
|
+
* @mode - Determines what to generate and which mode set to use.
|
|
24
|
+
*/
|
|
25
|
+
//
|
|
26
|
+
.generate-colors(@mode: light) {
|
|
27
|
+
@set: .sets-mode()[$@mode];
|
|
28
|
+
@setUtility: .sets-utility-mode()[$@mode];
|
|
29
|
+
@modeCustom: if(@mode = dark, dark, base);
|
|
30
|
+
|
|
31
|
+
& when (@mode = light), (@mode = dark) {
|
|
32
|
+
&,
|
|
33
|
+
&.themed,
|
|
34
|
+
& .themed {
|
|
35
|
+
.create-colors(@set);
|
|
36
|
+
.create-colors(@setUtility);
|
|
37
|
+
.create-theme-variables(@mode);
|
|
38
|
+
.create-custom-theme-variables(primary, @modeCustom);
|
|
39
|
+
.create-custom-theme-variables(secondary, @modeCustom);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
& when (@mode = light-highcontrast), (@mode = dark-highcontrast) {
|
|
44
|
+
.create-colors(@set);
|
|
45
|
+
.create-colors(@setUtility);
|
|
46
|
+
.create-theme-variables(@mode);
|
|
47
|
+
--_o-disabled: 0.8;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Creates color variables or atomic classes based on the given sets of colors.
|
|
53
|
+
*
|
|
54
|
+
* Usage example:
|
|
55
|
+
* .create-colors(.sets-mode()[dark], classes);
|
|
56
|
+
*
|
|
57
|
+
* @sets - (required) A collection of name/set pairs.
|
|
58
|
+
* @type - The type of output.
|
|
59
|
+
* @modeSimple - The mode to use for generating classes.
|
|
60
|
+
* @property - The property to use for generating classes.
|
|
61
|
+
*/
|
|
62
|
+
.create-colors(@sets, @type: variables, @modeSimple: light, @property: all) {
|
|
63
|
+
each(@sets, .(@set, @setName, @iSet) {
|
|
64
|
+
each(@set, .(@value, @stop, @iColorValue) {
|
|
65
|
+
@suffix: if((@stop = default), "", ~"-@{stop}");
|
|
66
|
+
@name: ~"@{setName}@{suffix}";
|
|
67
|
+
@variable: ~"--@{name}";
|
|
68
|
+
|
|
69
|
+
// Create custom property assignment
|
|
70
|
+
& when (@type = variables) {
|
|
71
|
+
@{variable}: @value;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Create bg atomic class assignments
|
|
75
|
+
& when (@type = classes) {
|
|
76
|
+
@customValue: ~"var(@{variable}) !important";
|
|
77
|
+
.create-color-classes(@name, @customValue, @modeSimple, @property);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Creates atomic color classes for background and text color with the given color name and property value.
|
|
85
|
+
*
|
|
86
|
+
* Usage example:
|
|
87
|
+
* .create-color-classes(red-500, var(--red-500));
|
|
88
|
+
*
|
|
89
|
+
* @name - (required) Used as a suffix to each class.
|
|
90
|
+
* @value - (required) The value assigned to the generated class' property.
|
|
91
|
+
* @modeSimple - Generate either all standard or dark conditional classes.
|
|
92
|
+
* @property - Determines which type(s) of atomic class to generate.
|
|
93
|
+
*/
|
|
94
|
+
.create-color-classes(@name, @value, @modeSimple: light, @property: all) {
|
|
95
|
+
& when (@modeSimple = light) {
|
|
96
|
+
// Create bg atomic class assignments
|
|
97
|
+
& when (@property = all), (@property = background-color) {
|
|
98
|
+
.bg-@{name},
|
|
99
|
+
.h\:bg-@{name}:hover,
|
|
100
|
+
.f\:bg-@{name}:focus,
|
|
101
|
+
.f\:bg-@{name}:focus-within {
|
|
102
|
+
background-color: @value;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Create bc atomic class assignments
|
|
107
|
+
& when (@property = all), (@property = border-color) {
|
|
108
|
+
.bc-@{name},
|
|
109
|
+
.h\:bc-@{name}:hover,
|
|
110
|
+
.f\:bc-@{name}:focus,
|
|
111
|
+
.f\:bc-@{name}:focus-within {
|
|
112
|
+
border-color: @value;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Create fc atomic class assignments
|
|
117
|
+
& when (@property = all), (@property = color) {
|
|
118
|
+
.fc-@{name},
|
|
119
|
+
.h\:fc-@{name}:hover,
|
|
120
|
+
.f\:fc-@{name}:focus,
|
|
121
|
+
.f\:fc-@{name}:focus-within {
|
|
122
|
+
color: @value;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Create dark mode atomic class assignments
|
|
128
|
+
& when (@modeSimple = dark) {
|
|
129
|
+
// Note: we currently do not generate conditional border-color classes
|
|
130
|
+
// & when (@property = all), (@property = border-color) {
|
|
131
|
+
// .d\:bc-@{name} {
|
|
132
|
+
// border-color: @value;
|
|
133
|
+
// }
|
|
134
|
+
// }
|
|
135
|
+
|
|
136
|
+
// Create bg atomic class assignments
|
|
137
|
+
& when (@property = all), (@property = background-color) {
|
|
138
|
+
.d\:bg-@{name} {
|
|
139
|
+
background-color: @value;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Create fc atomic class assignments
|
|
144
|
+
& when (@property = all), (@property = color) {
|
|
145
|
+
.d\:fc-@{name} {
|
|
146
|
+
color: @value;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Creates aliased color classes or variables.
|
|
154
|
+
*
|
|
155
|
+
* Usage example:
|
|
156
|
+
* .create-aliased-utility-colors(classes)
|
|
157
|
+
*
|
|
158
|
+
* @modeSimple - Generate either all standard or dark conditional classes.
|
|
159
|
+
*/
|
|
160
|
+
.create-aliased-utility-classes(@modeSimple: light) {
|
|
161
|
+
// TODO add font color aliases
|
|
162
|
+
each(.set-fc(), .(@value, @stop, @iColorValue) {
|
|
163
|
+
@customValue: ~"var(--fc-@{stop}) !important";
|
|
164
|
+
.create-color-classes(@stop, @customValue, @modeSimple, color);
|
|
165
|
+
});
|
|
166
|
+
each(.set-utility-alias(), .(@value, @stop, @iColorValue) {
|
|
167
|
+
@customValue: ~"var(--bg-@{stop}) !important";
|
|
168
|
+
.create-color-classes(@stop, @customValue, @modeSimple, background-color);
|
|
169
|
+
});
|
|
170
|
+
each(.set-utility-alias(), .(@value, @stop, @iColorValue) {
|
|
171
|
+
@suffix: if((@stop = default), "", ~"@{stop}");
|
|
172
|
+
@customValue: ~"var(--bc-@{stop}) !important";
|
|
173
|
+
.create-color-classes(@stop, @customValue, @modeSimple, border-color);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// THEMING -- PUBLIC API
|
|
178
|
+
/**
|
|
179
|
+
* Creates theme h/s/l and r/g/b variables based on the given color for a specified theme.
|
|
180
|
+
* Replaces .generate-calculated-themed-variables() (referenced in Core)
|
|
181
|
+
* Maintains API parity with legacy .generate-calculated-themed-variables()
|
|
182
|
+
*
|
|
183
|
+
* Usage example:
|
|
184
|
+
* .create-custom-theme-hsl-variables("#ff1100", secondary, dark);
|
|
185
|
+
*
|
|
186
|
+
* @color - (required) The color to be used to generate h/s/g and /r/g/b values.
|
|
187
|
+
* @tier - The tier name to be used to generate the variable name.
|
|
188
|
+
* @modeCustom - A custom label to be used to generate the variable name.
|
|
189
|
+
*/
|
|
190
|
+
.create-custom-theme-hsl-variables(@color, @tier: primary, @modeCustom: base) {
|
|
191
|
+
@varBase: ~"--theme-@{modeCustom}-@{tier}-color";
|
|
192
|
+
|
|
193
|
+
@{varBase}-h: hue(@color);
|
|
194
|
+
@{varBase}-s: saturation(@color);
|
|
195
|
+
@{varBase}-l: lightness(@color);
|
|
196
|
+
|
|
197
|
+
.create-custom-theme-variables(@tier, @modeCustom);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// THEMING -- PSEUDO-PRIVATE API
|
|
201
|
+
/**
|
|
202
|
+
* Defines custom theme varaibles from assembled h/s/l variables
|
|
203
|
+
*
|
|
204
|
+
* Usage example:
|
|
205
|
+
* .create-custom-theme-variables(base);
|
|
206
|
+
*
|
|
207
|
+
* @tier - The tier name to be used to generate the variable name.
|
|
208
|
+
* @modeCustom - A custom label to be used to generate the variable name.
|
|
209
|
+
*/
|
|
210
|
+
.create-custom-theme-variables(@tier: primary, @modeCustom: base) {
|
|
211
|
+
@valueVar: ~"theme-@{modeCustom}-@{tier}-color";
|
|
212
|
+
@focusRingHSLVars: ~"var(--@{valueVar}-h), var(--@{valueVar}-s), var(--@{valueVar}-l)";
|
|
213
|
+
|
|
214
|
+
// TODO verify color stops with design
|
|
215
|
+
& when (@modeCustom = base) {
|
|
216
|
+
@varBase: ~"--theme-@{tier}-custom";
|
|
217
|
+
|
|
218
|
+
@{varBase}-100: .native-lightness(@valueVar, 50, 70, 95)[];
|
|
219
|
+
@{varBase}-200: .native-lightness(@valueVar, 35, 55, 90)[];
|
|
220
|
+
@{varBase}-300: .native-lightness(@valueVar, 15, 35, 75)[];
|
|
221
|
+
@{varBase}-400: .native-lightness(@valueVar, 0, 20, 60)[];
|
|
222
|
+
@{varBase}-500: .native-lightness(@valueVar, -14, 13, 50)[];
|
|
223
|
+
@{varBase}-600: .native-lightness(@valueVar, -26, 5, 40)[];
|
|
224
|
+
@{varBase}: ~"var(@{varBase}-400)";
|
|
225
|
+
|
|
226
|
+
& when (@tier = secondary) {
|
|
227
|
+
@{varBase}-focus-ring: ~"hsla(@{focusRingHSLVars}, 0.15)";
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
& when (@modeCustom = dark) {
|
|
232
|
+
@varBaseDark: ~"--theme-@{modeCustom}-@{tier}-custom";
|
|
233
|
+
|
|
234
|
+
@{varBaseDark}-100: .native-saturation-lightness(@valueVar, -12, -60, 15, 30)[];
|
|
235
|
+
@{varBaseDark}-200: .native-saturation-lightness(@valueVar, -10, -45, 25, 45)[];
|
|
236
|
+
@{varBaseDark}-300: .native-saturation-lightness(@valueVar, -7, -33, 35, 70)[];
|
|
237
|
+
@{varBaseDark}-400: .native-lightness(@valueVar, 0, 55, 85)[];
|
|
238
|
+
@{varBaseDark}-500: .native-lightness(@valueVar, 10, 70, 90)[];
|
|
239
|
+
@{varBaseDark}-600: .native-lightness(@valueVar, 20, 85, 95)[];
|
|
240
|
+
@{varBaseDark}: ~"var(@{varBaseDark}-400)";
|
|
241
|
+
|
|
242
|
+
& when (@tier = secondary) {
|
|
243
|
+
@{varBaseDark}-focus-ring: ~"hsla(@{focusRingHSLVars}, 0.25)";
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Generates theme variables with values mapped to custom hsl values
|
|
250
|
+
*
|
|
251
|
+
* Usage example:
|
|
252
|
+
* .create-theme-variables();
|
|
253
|
+
*
|
|
254
|
+
* @mode - determines which variable naming convention to use.
|
|
255
|
+
*/
|
|
256
|
+
.create-theme-variables(@mode: light) {
|
|
257
|
+
@tiers: primary, secondary;
|
|
258
|
+
|
|
259
|
+
each(@tiers, .(@tier, @k, @i) {
|
|
260
|
+
@stops: 100, 200, 300, 400, 500, 600;
|
|
261
|
+
@fallbackColor: if(@tier = primary, orange, blue);
|
|
262
|
+
@baseThemeVar: ~"--theme-@{tier}";
|
|
263
|
+
@customThemeVar: if(@mode = light, ~"@{baseThemeVar}-custom", ~"--theme-dark-@{tier}-custom");
|
|
264
|
+
|
|
265
|
+
& when (@mode = light), (@mode = dark) {
|
|
266
|
+
@{baseThemeVar}: ~"var(@{customThemeVar}, var(--@{fallbackColor}-400))";
|
|
267
|
+
each(@stops, .(@stop, @kStop, @iStop) {
|
|
268
|
+
@{baseThemeVar}-@{stop}: ~"var(@{customThemeVar}-@{stop}, var(--@{fallbackColor}-@{stop}))";
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
& when (@mode = light-highcontrast), (@mode = dark-highcontrast) {
|
|
273
|
+
@{baseThemeVar}: ~"var(--@{fallbackColor}-400)";
|
|
274
|
+
|
|
275
|
+
each(@stops, .(@stop, @kStop, @iStop) {
|
|
276
|
+
@{baseThemeVar}-@{stop}: ~"var(--@{fallbackColor}-@{stop})";
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { renderLess } from "../test/less-test-utils";
|
|
3
|
+
|
|
4
|
+
describe("color-mixins", () => {
|
|
5
|
+
describe("colors", () => {
|
|
6
|
+
describe("generate-colors", () => {
|
|
7
|
+
it("light", async () => {
|
|
8
|
+
const css = await renderLess(`
|
|
9
|
+
@import (reference) "color-mixins.less";
|
|
10
|
+
|
|
11
|
+
// TODO: figure out how to simplify sets to reduce output
|
|
12
|
+
|
|
13
|
+
/* .generate-colors(light) */
|
|
14
|
+
body {
|
|
15
|
+
.generate-colors(light);
|
|
16
|
+
}
|
|
17
|
+
`);
|
|
18
|
+
|
|
19
|
+
expect(css).toMatchSnapshot();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
it("create-colors", async () => {
|
|
23
|
+
const css = await renderLess(`
|
|
24
|
+
@import (reference) "color-mixins.less";
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
.set-test-emerald() {
|
|
28
|
+
default: hsl(150, 60%, 55%);
|
|
29
|
+
}
|
|
30
|
+
.set-test-ruby() {
|
|
31
|
+
100: hsl(350, 70%, 97%);
|
|
32
|
+
600: hsl(350, 70%, 29%);
|
|
33
|
+
}
|
|
34
|
+
.sets-test() {
|
|
35
|
+
emerald: .set-test-emerald();
|
|
36
|
+
ruby: .set-test-ruby();
|
|
37
|
+
}
|
|
38
|
+
*/
|
|
39
|
+
.set-test-emerald() {
|
|
40
|
+
default: hsl(150, 60%, 55%);
|
|
41
|
+
}
|
|
42
|
+
.set-test-ruby() {
|
|
43
|
+
100: hsl(350, 70%, 97%);
|
|
44
|
+
600: hsl(350, 70%, 29%);
|
|
45
|
+
}
|
|
46
|
+
.sets-test() {
|
|
47
|
+
emerald: .set-test-emerald();
|
|
48
|
+
ruby: .set-test-ruby();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* .create-colors(.sets-test(), variables) */
|
|
52
|
+
body {
|
|
53
|
+
.create-colors(.sets-test(), variables);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* .create-colors(.sets-test(), classes) */
|
|
57
|
+
body {
|
|
58
|
+
.create-colors(.sets-test(), classes);
|
|
59
|
+
}
|
|
60
|
+
`);
|
|
61
|
+
|
|
62
|
+
expect(css).toMatchSnapshot();
|
|
63
|
+
});
|
|
64
|
+
it("create-color-classes", async () => {
|
|
65
|
+
const css = await renderLess(`
|
|
66
|
+
@import (reference) "color-mixins.less";
|
|
67
|
+
/* .create-color-classes(red-500, var(--red-500)) */
|
|
68
|
+
/* .create-color-classes(blue-400, var(--blue-400), dark, color) */
|
|
69
|
+
/* .create-color-classes(green-300, var(--green-300), light, background-color) */
|
|
70
|
+
body {
|
|
71
|
+
.create-color-classes(red-500, var(--red-500));
|
|
72
|
+
.create-color-classes(blue-500, var(--blue-500), dark, color);
|
|
73
|
+
.create-color-classes(green-300, var(--green-300), light, background-color);
|
|
74
|
+
}
|
|
75
|
+
`);
|
|
76
|
+
|
|
77
|
+
expect(css).toMatchSnapshot();
|
|
78
|
+
});
|
|
79
|
+
it(".create-aliased-utility-classes", async () => {
|
|
80
|
+
const css = await renderLess(`
|
|
81
|
+
@import (reference) "color-mixins.less";
|
|
82
|
+
/* .create-aliased-utility-classes() */
|
|
83
|
+
/* .create-aliased-utility-classes(dark) */
|
|
84
|
+
body {
|
|
85
|
+
.create-aliased-utility-classes();
|
|
86
|
+
}
|
|
87
|
+
body.theme-dark {
|
|
88
|
+
.create-aliased-utility-classes(dark);
|
|
89
|
+
}
|
|
90
|
+
`);
|
|
91
|
+
|
|
92
|
+
expect(css).toMatchSnapshot();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
describe("theming", () => {
|
|
96
|
+
it("create-custom-theme-hsl-rgb-variables", async () => {
|
|
97
|
+
const css = await renderLess(`
|
|
98
|
+
@import (reference) "color-mixins.less";
|
|
99
|
+
create-custom-theme-hsl-rgb-variables(#ff1100, primary, base) {
|
|
100
|
+
.create-custom-theme-hsl-variables(#ff1100, primary, base);
|
|
101
|
+
}
|
|
102
|
+
create-custom-theme-hsl-rgb-variables(#29ff53, secondary, base) {
|
|
103
|
+
.create-custom-theme-hsl-variables(#29ff53, secondary, base);
|
|
104
|
+
}
|
|
105
|
+
create-custom-theme-hsl-rgb-variables(#1c091d, primary, dark) {
|
|
106
|
+
.create-custom-theme-hsl-variables(#1c091d, primary, dark);
|
|
107
|
+
}
|
|
108
|
+
create-custom-theme-hsl-rgb-variables(#49281f, secondary, dark) {
|
|
109
|
+
.create-custom-theme-hsl-variables(#49281f, secondary, dark);
|
|
110
|
+
}
|
|
111
|
+
`);
|
|
112
|
+
|
|
113
|
+
expect(css).toMatchSnapshot();
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("create-theme-variables", async () => {
|
|
117
|
+
const css = await renderLess(`
|
|
118
|
+
@import (reference) "color-mixins.less";
|
|
119
|
+
body {
|
|
120
|
+
.create-theme-variables();
|
|
121
|
+
}
|
|
122
|
+
body.theme-highcontrast {
|
|
123
|
+
.create-theme-variables(light-highcontrast);
|
|
124
|
+
}
|
|
125
|
+
`);
|
|
126
|
+
|
|
127
|
+
expect(css).toMatchSnapshot();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("create-custom-theme-variables", async () => {
|
|
131
|
+
const css = await renderLess(`
|
|
132
|
+
@import (reference) "color-mixins.less";
|
|
133
|
+
create-custom-theme-variables(primary, base) {
|
|
134
|
+
.create-custom-theme-variables(primary, base);
|
|
135
|
+
}
|
|
136
|
+
create-custom-theme-variables(primary, dark) {
|
|
137
|
+
.create-custom-theme-variables(primary, dark);
|
|
138
|
+
}
|
|
139
|
+
create-custom-theme-variables(secondary, base) {
|
|
140
|
+
.create-custom-theme-variables(secondary, base);
|
|
141
|
+
}
|
|
142
|
+
create-custom-theme-variables(secondary, base) {
|
|
143
|
+
.create-custom-theme-variables(secondary, base);
|
|
144
|
+
}
|
|
145
|
+
`);
|
|
146
|
+
|
|
147
|
+
expect(css).toMatchSnapshot();
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
});
|