diff options
Diffstat (limited to 'src/bem/_theme.scss')
-rw-r--r-- | src/bem/_theme.scss | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/bem/_theme.scss b/src/bem/_theme.scss index a49981c..ff1ba49 100644 --- a/src/bem/_theme.scss +++ b/src/bem/_theme.scss | |||
@@ -4,6 +4,11 @@ | |||
4 | /// @access public | 4 | /// @access public |
5 | //// | 5 | //// |
6 | 6 | ||
7 | @use './functions'; | ||
8 | @use './validators'; | ||
9 | @use './vars'; | ||
10 | @use '../contexts'; | ||
11 | |||
7 | /// | 12 | /// |
8 | /// Declare new rules for the current block for when this theme is active. | 13 | /// Declare new rules for the current block for when this theme is active. |
9 | /// | 14 | /// |
@@ -12,23 +17,23 @@ | |||
12 | /// | 17 | /// |
13 | /// @content | 18 | /// @content |
14 | /// | 19 | /// |
15 | @mixin iro-bem-at-theme($name, $names...) { | 20 | @mixin at-theme($name, $names...) { |
16 | $result: iro-bem-at-theme($name, $names...); | 21 | $result: at-theme($name, $names...); |
17 | $selector: nth($result, 1); | 22 | $selector: nth($result, 1); |
18 | $context: nth($result, 2); | 23 | $context: nth($result, 2); |
19 | 24 | ||
20 | @include iro-bem-validate( | 25 | @include validators.validate( |
21 | 'at-theme', | 26 | 'at-theme', |
22 | (name: $name, names: $names), | 27 | (name: $name, names: $names), |
23 | $selector, | 28 | $selector, |
24 | $context | 29 | $context |
25 | ); | 30 | ); |
26 | 31 | ||
27 | @include iro-context-push($iro-bem-context-id, $context...); | 32 | @include contexts.push(vars.$context-id, $context...); |
28 | @at-root #{$selector} { | 33 | @at-root #{$selector} { |
29 | @content; | 34 | @content; |
30 | } | 35 | } |
31 | @include iro-context-pop($iro-bem-context-id); | 36 | @include contexts.pop(vars.$context-id); |
32 | } | 37 | } |
33 | 38 | ||
34 | /// | 39 | /// |
@@ -37,19 +42,19 @@ | |||
37 | /// | 42 | /// |
38 | /// @return {list} A list with two items: 1. selector, 2. context or `null` | 43 | /// @return {list} A list with two items: 1. selector, 2. context or `null` |
39 | /// | 44 | /// |
40 | /// @see {mixin} iro-bem-at-theme | 45 | /// @see {mixin} at-theme |
41 | /// | 46 | /// |
42 | @function iro-bem-at-theme($name, $names...) { | 47 | @function at-theme($name, $names...) { |
43 | $noop: iro-context-assert-stack-must-contain($iro-bem-context-id, 'block'); | 48 | $noop: contexts.assert-stack-must-contain(vars.$context-id, 'block'); |
44 | 49 | ||
45 | $parent-context: iro-context-get($iro-bem-context-id, 'block'); | 50 | $parent-context: contexts.get(vars.$context-id, 'block'); |
46 | $parent-selector: map-get(nth($parent-context, 2), 'selector'); | 51 | $parent-selector: map-get(nth($parent-context, 2), 'selector'); |
47 | 52 | ||
48 | //@if not iro-selector-suffix-match(&, $parent-selector) { | 53 | //@if not functions.selector-suffix-match(&, $parent-selector) { |
49 | // @error 'An at-theme rule must be an immediate child of a block'; | 54 | // @error 'An at-theme rule must be an immediate child of a block'; |
50 | //} | 55 | //} |
51 | 56 | ||
52 | $selector: iro-bem-theme-selector($name, $names...); | 57 | $selector: functions.theme-selector($name, $names...); |
53 | $selector: selector-nest($selector, &); | 58 | $selector: selector-nest($selector, &); |
54 | 59 | ||
55 | $context: 'at-theme', ( | 60 | $context: 'at-theme', ( |