bem-constructor 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bem-constructor.rb +1 -1
- data/stylesheets/_error-checks.scss +7 -6
- data/stylesheets/_modifies-element.scss +6 -3
- data/stylesheets/_scope.scss +7 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d11930fa21da375d2a8a296532b5f291c0efe5d0
|
4
|
+
data.tar.gz: f7e1a7c6ff487e57ce0cc2e75ae2772e80cb32d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffe52aba896baedcc044316b7ecc253e6ec5ab453272441accda4848eddce79701d878dc959f59b08fb996f9095b3e5f8079d7da227a85b76f9da793ad4e35c3
|
7
|
+
data.tar.gz: 4e5e72fd167fa8f9eeaeed0c00db110b4b31985c86111e96b613e2a6b6a799f38eee2d82246faeec8bb74ad4d3880c79157183adcd0952f9b00206d79d8ca850
|
data/lib/bem-constructor.rb
CHANGED
@@ -13,15 +13,16 @@
|
|
13
13
|
@function _should-be-called-within($objs...) {
|
14
14
|
|
15
15
|
@each $obj in $objs {
|
16
|
-
@if map-get($_bem-current-context, $obj)
|
17
|
-
@
|
18
|
-
@error 'It should be called within #{inspect($objs)}';
|
19
|
-
}
|
20
|
-
@return false;
|
16
|
+
@if map-get($_bem-current-context, $obj) != null {
|
17
|
+
@return true;
|
21
18
|
}
|
22
19
|
}
|
23
20
|
|
24
|
-
@
|
21
|
+
@if $bem-throw-errors {
|
22
|
+
@error 'It should be called within #{inspect($objs)}';
|
23
|
+
}
|
24
|
+
|
25
|
+
@return false;
|
25
26
|
}
|
26
27
|
|
27
28
|
|
@@ -9,10 +9,11 @@
|
|
9
9
|
|
10
10
|
@function _modifies-element($modified-elements...) {
|
11
11
|
|
12
|
-
$inside-check: _should-be-called-within('modifier', 'state');
|
12
|
+
$inside-check: _should-be-called-within('modifier', 'state', 'theme');
|
13
13
|
$outside-check: _should-not-be-called-within('element');
|
14
14
|
|
15
|
-
|
15
|
+
// Return false in case error throwing is disabled
|
16
|
+
@if $inside-check == false or $outside-check == false {
|
16
17
|
@return false;
|
17
18
|
}
|
18
19
|
|
@@ -23,7 +24,9 @@
|
|
23
24
|
$selectors: append($selectors, $element, 'comma');
|
24
25
|
}
|
25
26
|
|
26
|
-
$
|
27
|
+
$block: selector-append(&...);
|
28
|
+
|
29
|
+
$selector: selector-nest($block, '>', $selectors);
|
27
30
|
|
28
31
|
$set-current: set-current-context('modifies-element', $modified-elements, $selector);
|
29
32
|
|
data/stylesheets/_scope.scss
CHANGED
@@ -17,10 +17,13 @@ $bem-scope-namespace: 's';
|
|
17
17
|
// Log new block
|
18
18
|
$new-scope: _bem-log-scope($scope);
|
19
19
|
|
20
|
-
//
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
// Error checks
|
21
|
+
$outside-check: _should-not-be-called-within('block', 'scope');
|
22
|
+
|
23
|
+
// Return false in case error throwing is disabled
|
24
|
+
@if $outside-check == false {
|
25
|
+
@return false;
|
26
|
+
}
|
24
27
|
|
25
28
|
$namespace: if($bem-use-namespaces, $bem-scope-namespace + '-', '');
|
26
29
|
$selector: '.' + $namespace + $scope;
|