igniteui-theming 1.0.0-beta.13 → 1.0.0-beta.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/_index.scss +3 -3
- package/package.json +1 -1
- package/sass/_index.scss +1 -1
- package/sass/bem/_index.scss +397 -0
- package/sass/color/presets/dark/_fluent.scss +3 -0
- package/sass/color/presets/light/_fluent.scss +2 -0
- package/test/_bem.spec.scss +168 -0
- package/test/_index.scss +1 -0
package/_index.scss
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "igniteui-theming",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.14",
|
|
4
4
|
"description": "A set of Sass variables, mixins, and functions for generating palettes, typography, and elevations used by Ignite UI components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
package/sass/_index.scss
CHANGED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
/* stylelint-disable max-line-length */
|
|
2
|
+
@use 'sass:string';
|
|
3
|
+
@use 'sass:meta';
|
|
4
|
+
@use 'sass:list';
|
|
5
|
+
@use 'sass:selector';
|
|
6
|
+
|
|
7
|
+
////
|
|
8
|
+
/// @group bem
|
|
9
|
+
/// @author <a href="https://github.com/runningskull" target="_blank">Juan Patten</a>
|
|
10
|
+
/// @author <a href="https://github.com/simeonoff" target="_blank">Simeon Simeonoff</a>
|
|
11
|
+
////
|
|
12
|
+
|
|
13
|
+
/// @type String - The Element separator used. Default '__'.
|
|
14
|
+
$bem--sep-elem: if(meta.variable-exists(bem--sep-elem), $bem--sep-elem, '__');
|
|
15
|
+
|
|
16
|
+
/// @type String - The Modifier separator used. Default '--'.
|
|
17
|
+
$bem--sep-mod: if(meta.variable-exists(bem--sep-mod), $bem--sep-mod, '--');
|
|
18
|
+
|
|
19
|
+
/// @type String - The Modifier Value separator used. Default '-'.
|
|
20
|
+
$bem--sep-mod-val: if(meta.variable-exists(bem--sep-mod-val), $bem--sep-mod-val, '-');
|
|
21
|
+
|
|
22
|
+
/// Converts a passed selector value into plain string.
|
|
23
|
+
/// @access private
|
|
24
|
+
/// @param {String} $s - The selector to be converted.
|
|
25
|
+
@function bem--selector-to-string($s) {
|
|
26
|
+
@if not($s) {
|
|
27
|
+
@return '';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@return string.slice(meta.inspect($s), 2, -3);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/// Prepends a dot to the passed BEM selector.
|
|
34
|
+
/// @access private
|
|
35
|
+
/// @param {String} $x - The BEM selector to prepend a dot to.
|
|
36
|
+
@function bem--with-dot($x) {
|
|
37
|
+
$first: string.slice($x, 0, 1);
|
|
38
|
+
|
|
39
|
+
@return if($first == '.', $x, string.insert($x, '.', -100));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/// Converts a key-value map into a modifier string.
|
|
43
|
+
/// @access private
|
|
44
|
+
@function bem--mod-str($m) {
|
|
45
|
+
@if meta.type-of($m) == 'map' {
|
|
46
|
+
$mm: list.nth($m, 1);
|
|
47
|
+
|
|
48
|
+
@return list.nth($mm, 1) + $bem--sep-mod-val + list.nth($mm, 2);
|
|
49
|
+
} @else {
|
|
50
|
+
@return $m;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// Prefixes the block name to an element selector string,
|
|
55
|
+
/// with the element separator string used as a divider.
|
|
56
|
+
/// @access private
|
|
57
|
+
/// @param {String} $b - The block name.
|
|
58
|
+
/// @param {String} $e - The element name.
|
|
59
|
+
@function bem--elem-str($b, $e) {
|
|
60
|
+
@return $b + $bem--sep-elem + $e;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/// Returns a block selector string affixed by the modifier selector,
|
|
64
|
+
/// followed by the element selector string.
|
|
65
|
+
/// @access private
|
|
66
|
+
/// @param {String} $block - The block name.
|
|
67
|
+
/// @param {String} $elem - The sub-element name.
|
|
68
|
+
/// @param {String} $mod - The modifier name.
|
|
69
|
+
@function bem--bem-str($block, $elem, $mod) {
|
|
70
|
+
$elem: if($elem, ' ' + $elem, '');
|
|
71
|
+
|
|
72
|
+
@return ($block + $bem--sep-mod + bem--mod-str($mod) + $elem);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/// Checks if the element separator string is part of the passed string.
|
|
76
|
+
/// @access private
|
|
77
|
+
/// @param {String} $x - The string to check.
|
|
78
|
+
/// @returns {number|null} Will return the index of the occurance,
|
|
79
|
+
/// or null if the element separator name is not part of the passed string.
|
|
80
|
+
@function bem--contains-elem($x) {
|
|
81
|
+
// if you set the separators to common strings, this could fail
|
|
82
|
+
@return string.index($x, $bem--sep-elem);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/// Checks if the modifier separator string is part of the passed string.
|
|
86
|
+
/// @access private
|
|
87
|
+
/// @param {String} $x - The string to check.
|
|
88
|
+
/// @returns {number|null} Will return the index of the occurance,
|
|
89
|
+
/// or null if the modifier separator string is not part of the passed string.
|
|
90
|
+
@function bem--contains-mod($x) {
|
|
91
|
+
// if you set the separators to common strings, this could fail
|
|
92
|
+
@return string.index($x, $bem--sep-mod);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/// Checks if the passed selector string contains a colon.
|
|
96
|
+
/// @access private
|
|
97
|
+
/// @param {String} $x - The string to check for colons.
|
|
98
|
+
/// @returns {number|null} Will return the index of the occurance,
|
|
99
|
+
/// or null if the string does not contain any colons.
|
|
100
|
+
@function bem--contains-pseudo($x) {
|
|
101
|
+
@return string.index($x, ':');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/// Returns the BEM block-name that generated `$x`. Does not include leading ".".
|
|
105
|
+
/// @access private
|
|
106
|
+
/// @param {String} $x - The block name.
|
|
107
|
+
@function bem--extract-block($x) {
|
|
108
|
+
@if bem--contains-mod($x) {
|
|
109
|
+
@return string.slice($x, 1, string.index($x, $bem--sep-mod) - 1);
|
|
110
|
+
} @else if bem--contains-elem($x) {
|
|
111
|
+
@return string.slice($x, 1, string.index($x, $bem--sep-elem) - 1);
|
|
112
|
+
} @else if bem--contains-pseudo($x) {
|
|
113
|
+
@return string.slice($x, 1, string.index($x, ':') - 1);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@return $x;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/// Returns the first selector of a nested selector string.
|
|
120
|
+
/// @access private
|
|
121
|
+
@function bem--extract-first-selector($x) {
|
|
122
|
+
$eow: string.index($x, ' ') or -1;
|
|
123
|
+
|
|
124
|
+
@return string.slice($x, 1, $eow);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/// Generates a full BEM selector.
|
|
128
|
+
/// @access public
|
|
129
|
+
/// @param {String} $block - Required. A string block name.
|
|
130
|
+
/// @param {String|List} $elem - Optional. A sub-element name. If `$mod` is not present, it is
|
|
131
|
+
/// joined with $block. If $mod is present, it is nested under `$block--$mod`.
|
|
132
|
+
/// @param {String|Map} $mod - Optional. A block modifier.
|
|
133
|
+
/// @example scss Include a block
|
|
134
|
+
/// @include bem-selector(block); // outputs .block
|
|
135
|
+
/// @example scss Include a block and an element
|
|
136
|
+
/// @include bem-selector(block, $e:elem); // outputs .block__elem
|
|
137
|
+
/// @example scss Include block, element, and element modifier
|
|
138
|
+
/// @include bem-selector(block, $e:(elem,emod); // outputs .block__elem-emod
|
|
139
|
+
/// @example scss Include block and block modifier
|
|
140
|
+
/// @include bem-selector(block, $m:mod) // outputs .block--mod
|
|
141
|
+
/// @example scss Include block and modifier value
|
|
142
|
+
/// @include bem-selector(block, $m:(mod:val)); // outputs .block--mod-val
|
|
143
|
+
/// @example scss Include block modifier followed by block sub-element
|
|
144
|
+
/// @include bem-selector(block, $m:mod, $e:elem); // outputs .block--mod .block__elem
|
|
145
|
+
@function bem-selector($block, $e: null, $elem: null, $m: null, $mod: null, $mods: null) {
|
|
146
|
+
$block: bem--with-dot($block);
|
|
147
|
+
$elem: $e or $elem;
|
|
148
|
+
|
|
149
|
+
// Return early if possible
|
|
150
|
+
$mods: $m or $mod or $mods;
|
|
151
|
+
|
|
152
|
+
@if not ($elem or $mods) {
|
|
153
|
+
@return $block;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@if $elem {
|
|
157
|
+
// User passed an element-specific modifier
|
|
158
|
+
@if meta.type-of($elem) == list and list.nth($elem, 2) {
|
|
159
|
+
// For now we don't support multiple elem-mods at once
|
|
160
|
+
@if meta.type-of(list.nth($elem, 2)) == 'list' {
|
|
161
|
+
@error 'Only one element-modifier allowed.';
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
$elem: string.slice(bem-selector(list.nth($elem, 1), $m: list.nth($elem, 2)), 2);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
$elem: bem--elem-str($block, $elem);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@if not $mods {
|
|
171
|
+
@return bem--with-dot($elem);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@if meta.type-of($mods) != 'list' {
|
|
175
|
+
$mods: ($mods, );
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
$bemcls: '';
|
|
179
|
+
|
|
180
|
+
@for $i from 1 to list.length($mods) {
|
|
181
|
+
$bemcls: $bemcls + bem--bem-str($block, $elem, list.nth($mods, $i)) + ', ';
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
$bemcls: $bemcls + bem--bem-str($block, $elem, list.nth($mods, -1));
|
|
185
|
+
|
|
186
|
+
@return $bemcls;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/// Simply unrolls into a class-selector. The main purpose of using this mixin
|
|
190
|
+
/// is to clearly denote the start of a BEM block.
|
|
191
|
+
/// @access public
|
|
192
|
+
/// @param {String} $block - The block name.
|
|
193
|
+
@mixin bem-block($block) {
|
|
194
|
+
@at-root {
|
|
195
|
+
#{bem-selector($block)} {
|
|
196
|
+
@content;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/// Unrolls into a proper BEM element selector, depending on the context.
|
|
202
|
+
/// Inside just a block, yields a root-level `.block__elem`.
|
|
203
|
+
/// Inside a mod or pseudo-selector, yields a nested `.block--mod .block__elem`.
|
|
204
|
+
/// If $mod is included, it is appended to the block selector. Multiple
|
|
205
|
+
/// $mods are not supported.
|
|
206
|
+
/// @access public
|
|
207
|
+
/// @param {String} $elem - The sub-element name.
|
|
208
|
+
/// @param {String} $m - The modifier name.
|
|
209
|
+
/// @param {String} $mod - An alias of `$m`.
|
|
210
|
+
@mixin bem-elem($elem, $m: null, $mod: null, $mods: null) {
|
|
211
|
+
$this: bem--selector-to-string(&);
|
|
212
|
+
$block: bem--extract-block($this);
|
|
213
|
+
$first: bem--extract-first-selector($this);
|
|
214
|
+
$nested: bem--contains-pseudo($this) or bem--contains-mod($this);
|
|
215
|
+
$mod: $m or $mod;
|
|
216
|
+
$mx: ();
|
|
217
|
+
|
|
218
|
+
@if $this == '' {
|
|
219
|
+
@error 'Detected an Element that is not inside a Block: #{$elem}';
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
@if bem--contains-elem($this) {
|
|
223
|
+
@error 'Detected a multi-level nested Element (#{$this} #{$elem})! Bem doesn\'t support nested ' + 'elements because they do not have BEM nature (www.getbem.com/faq/#css-nested-elements). ' + 'If you must do it, use a hardcoded selector like &__subsubelem ';
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@if $mods != null and meta.type-of($mods) == 'list' {
|
|
227
|
+
@each $i in $mods {
|
|
228
|
+
$mx: list.append($mx, #{bem-selector($block, $e: ($elem, $i))});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@if not($nested) {
|
|
233
|
+
// Normal case, no pseudo-selector present or mod, so no nesting.
|
|
234
|
+
// .block__elem { ... }
|
|
235
|
+
@at-root {
|
|
236
|
+
@if not($mods) {
|
|
237
|
+
#{bem-selector($block, $e: ($elem, $mod))} {
|
|
238
|
+
@content;
|
|
239
|
+
}
|
|
240
|
+
} @else {
|
|
241
|
+
#{selector.append($mx...)} {
|
|
242
|
+
@content;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
} @else {
|
|
247
|
+
// pseudo-element or mod present, so we have nesting.
|
|
248
|
+
// .block:active .block__elem { ... }
|
|
249
|
+
// .block--mod .block__elem { ... }
|
|
250
|
+
@at-root {
|
|
251
|
+
$selector: $first + ' ' + bem-selector($block, $e: ($elem, $mod));
|
|
252
|
+
|
|
253
|
+
@if not($mods) {
|
|
254
|
+
#{$selector} {
|
|
255
|
+
@content;
|
|
256
|
+
}
|
|
257
|
+
} @else {
|
|
258
|
+
#{$first} #{selector.append($mx...)} {
|
|
259
|
+
@content;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/// Unrolls into a BEM block-modifier selector.
|
|
267
|
+
/// This mixin does not generate element-modifiers, the bem-elem mixin instead.
|
|
268
|
+
/// Nesting bem-mod inside a pseudo-selector is not supported, because what
|
|
269
|
+
/// that should mean isn't clear.
|
|
270
|
+
/// @access public
|
|
271
|
+
/// @param {String} $mod - The modifier name.
|
|
272
|
+
@mixin bem-mod($mod) {
|
|
273
|
+
$skip: false;
|
|
274
|
+
$this: bem--selector-to-string(&);
|
|
275
|
+
|
|
276
|
+
@if $this == '' {
|
|
277
|
+
@error 'Detected a Modifier that is not inside a Block: ' + $mod;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
@if bem--contains-elem($this) {
|
|
281
|
+
@error 'Nesting a Modifier inside an Element (#{$this} #{$mod}) ' + 'is not supported. Instead, use bem-elem(myelem, elem-mod) syntax.';
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
@if bem--contains-pseudo($this) {
|
|
285
|
+
@error 'Nesting a Modifier inside a pseudo-selector is not supported: #{$this} #{$mod}';
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
@at-root {
|
|
289
|
+
#{bem-selector($this, $m: $mod)} {
|
|
290
|
+
@content;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/// Unrolls into a block--modifier.[block--modifier...] .block__el
|
|
296
|
+
/// This mixin is useful when we want to apply classes to a block,
|
|
297
|
+
/// or block element when two or more modifiers are applied in tandem
|
|
298
|
+
/// @access public
|
|
299
|
+
/// @param {List} $mods - A list of modifiers
|
|
300
|
+
@mixin bem-mods($mods...) {
|
|
301
|
+
$this: bem--selector-to-string(&);
|
|
302
|
+
$mod-classes: ();
|
|
303
|
+
|
|
304
|
+
@each $mod in $mods {
|
|
305
|
+
@if $this == '' {
|
|
306
|
+
@error 'Detected a Modifier that is not inside a Block: ' + $mod;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
@if bem--contains-elem($this) {
|
|
310
|
+
@error 'Nesting a Modifier inside an Element (#{$this} #{$mod}) ' + 'is not supported. Instead, use bem-elem(myelem, elem-mod) syntax.';
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
@if bem--contains-pseudo($this) {
|
|
314
|
+
@error 'Nesting a Modifier inside a pseudo-selector is not supported: #{$this} #{$mod}';
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
$mod-classes: list.append($mod-classes, #{bem-selector($block: $this, $m: $mod)});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
@at-root {
|
|
321
|
+
#{selector.append($mod-classes...)} {
|
|
322
|
+
@content;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/// @alias bem-selector
|
|
328
|
+
/// @see bem-selector
|
|
329
|
+
@mixin bem($block, $e: null, $elem: null, $m: null, $mod: null, $mods: null) {
|
|
330
|
+
#{bem-selector($block, $e: $e, $elem: $elem, $m: $m, $mod: $mod, $mods: $mods)} {
|
|
331
|
+
@content;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/// @alias bem-block
|
|
336
|
+
/// @see bem-block
|
|
337
|
+
@mixin block($block) {
|
|
338
|
+
@include bem-block($block) {
|
|
339
|
+
@content;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/// @alias bem-elem
|
|
344
|
+
/// @see bem-elem
|
|
345
|
+
@mixin elem($elem, $m: null, $mod: null, $mods: null) {
|
|
346
|
+
@include bem-elem($elem, $m: $m, $mod: $mod, $mods: $mods) {
|
|
347
|
+
@content;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/// @alias bem-mod
|
|
352
|
+
/// @see bem-mod
|
|
353
|
+
@mixin mod($mod) {
|
|
354
|
+
@include bem-mod($mod) {
|
|
355
|
+
@content;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/// @alias bem-mods
|
|
360
|
+
/// @see bem-mods
|
|
361
|
+
@mixin mods($mods...) {
|
|
362
|
+
@include bem-mods($mods...) {
|
|
363
|
+
@content;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/// @alias bem-block
|
|
368
|
+
/// @see bem-block
|
|
369
|
+
@mixin b($block) {
|
|
370
|
+
@include bem-block($block) {
|
|
371
|
+
@content;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/// @alias bem-elem
|
|
376
|
+
/// @see bem-elem
|
|
377
|
+
@mixin e($elem, $m: null, $mod: null, $mods: null) {
|
|
378
|
+
@include bem-elem($elem, $m: $m, $mod: $mod, $mods: $mods) {
|
|
379
|
+
@content;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/// @alias bem-mod
|
|
384
|
+
/// @see bem-mod
|
|
385
|
+
@mixin m($mod) {
|
|
386
|
+
@include bem-mod($mod) {
|
|
387
|
+
@content;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/// @alias bem-mods
|
|
392
|
+
/// @see bem-mods
|
|
393
|
+
@mixin mx($mods...) {
|
|
394
|
+
@include bem-mods($mods...) {
|
|
395
|
+
@content;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
@@ -4,6 +4,7 @@ $palette: palette(
|
|
|
4
4
|
$primary: #0078d4,
|
|
5
5
|
$secondary: #0078d4,
|
|
6
6
|
$surface: #222,
|
|
7
|
+
$info: #1377d5,
|
|
7
8
|
$success: #107c10,
|
|
8
9
|
$warn: #797673,
|
|
9
10
|
$error: #a80000,
|
|
@@ -13,6 +14,7 @@ $word-palette: palette(
|
|
|
13
14
|
$primary: #2b579a,
|
|
14
15
|
$secondary: #2b579a,
|
|
15
16
|
$surface: #222,
|
|
17
|
+
$info: #1377d5,
|
|
16
18
|
$success: #107c10,
|
|
17
19
|
$warn: #797673,
|
|
18
20
|
$error: #a80000,
|
|
@@ -22,6 +24,7 @@ $excel-palette: palette(
|
|
|
22
24
|
$primary: #217346,
|
|
23
25
|
$secondary: #217346,
|
|
24
26
|
$surface: #222,
|
|
27
|
+
$info: #1377d5,
|
|
25
28
|
$success: #107c10,
|
|
26
29
|
$warn: #797673,
|
|
27
30
|
$error: #a80000,
|
|
@@ -14,6 +14,7 @@ $word-palette: palette(
|
|
|
14
14
|
$primary: #2b579a,
|
|
15
15
|
$secondary: #2b579a,
|
|
16
16
|
$surface: #fff,
|
|
17
|
+
$info: #1377d5,
|
|
17
18
|
$success: #107c10,
|
|
18
19
|
$warn: #797673,
|
|
19
20
|
$error: #a80000,
|
|
@@ -23,6 +24,7 @@ $excel-palette: palette(
|
|
|
23
24
|
$primary: #217346,
|
|
24
25
|
$secondary: #217346,
|
|
25
26
|
$surface: #fff,
|
|
27
|
+
$info: #1377d5,
|
|
26
28
|
$success: #107c10,
|
|
27
29
|
$warn: #797673,
|
|
28
30
|
$error: #a80000,
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/* stylelint-disable selector-class-pattern */
|
|
2
|
+
/* stylelint-disable max-nesting-depth */
|
|
3
|
+
@use '../node_modules/sass-true/' as *;
|
|
4
|
+
@use '../sass/bem' as *;
|
|
5
|
+
|
|
6
|
+
@include describe('BEM') {
|
|
7
|
+
@include it('creates block__element classes using the respective mixins') {
|
|
8
|
+
@include assert() {
|
|
9
|
+
@include output($selector: false) {
|
|
10
|
+
@include b(block) {
|
|
11
|
+
background: black;
|
|
12
|
+
|
|
13
|
+
@include e(element) {
|
|
14
|
+
color: orange;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@include expect($selector: false) {
|
|
20
|
+
.block {
|
|
21
|
+
background: black;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.block__element {
|
|
25
|
+
color: orange;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@include it('creates block--modifier classes using the modifier mixins') {
|
|
32
|
+
@include assert() {
|
|
33
|
+
@include output($selector: false) {
|
|
34
|
+
@include b(block) {
|
|
35
|
+
background: black;
|
|
36
|
+
|
|
37
|
+
@include m(error) {
|
|
38
|
+
background: red;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@include mx(error, selected) {
|
|
42
|
+
background: darkred;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@include expect($selector: false) {
|
|
48
|
+
.block {
|
|
49
|
+
background: black;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.block--error {
|
|
53
|
+
background: red;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.block--error.block--selected {
|
|
57
|
+
background: darkred;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@include it('creates block__element--modifier classes using the element mixin') {
|
|
64
|
+
@include assert() {
|
|
65
|
+
@include output($selector: false) {
|
|
66
|
+
@include b(block) {
|
|
67
|
+
background: black;
|
|
68
|
+
|
|
69
|
+
@include e(element, $m: small) {
|
|
70
|
+
font-size: 12px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@include e(element, $m: medium) {
|
|
74
|
+
font-size: 14px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@include e(element, $m: large) {
|
|
78
|
+
font-size: 16px;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@include expect($selector: false) {
|
|
84
|
+
.block {
|
|
85
|
+
background: black;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.block__element--small {
|
|
89
|
+
font-size: 12px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.block__element--medium {
|
|
93
|
+
font-size: 14px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.block__element--large {
|
|
97
|
+
font-size: 16px;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@include it('creates multiple element modifier classes using the element mixin') {
|
|
104
|
+
@include assert() {
|
|
105
|
+
@include output($selector: false) {
|
|
106
|
+
@include b(block) {
|
|
107
|
+
background: black;
|
|
108
|
+
|
|
109
|
+
@include e(element, $mods: (small, pink)) {
|
|
110
|
+
color: pink;
|
|
111
|
+
font-size: 12px;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@include expect($selector: false) {
|
|
117
|
+
.block {
|
|
118
|
+
background: black;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.block__element--small.block__element--pink {
|
|
122
|
+
color: pink;
|
|
123
|
+
font-size: 12px;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@include it('overwrites element styles in a modified block') {
|
|
130
|
+
@include assert() {
|
|
131
|
+
@include output($selector: false) {
|
|
132
|
+
@include b(block) {
|
|
133
|
+
background: black;
|
|
134
|
+
|
|
135
|
+
@include e(element) {
|
|
136
|
+
color: wheat;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@include m(error) {
|
|
140
|
+
background: red;
|
|
141
|
+
|
|
142
|
+
@include e(element) {
|
|
143
|
+
color: white;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@include expect($selector: false) {
|
|
150
|
+
.block {
|
|
151
|
+
background: black;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.block__element {
|
|
155
|
+
color: wheat;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.block--error {
|
|
159
|
+
background: red;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.block--error .block__element {
|
|
163
|
+
color: white;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
package/test/_index.scss
CHANGED