From dd5f3c463fab336d694f426dcad11a1783590fc9 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 5 Feb 2022 07:52:13 +0100 Subject: Ported from import syntax to modules --- src/bem/_state.scss | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'src/bem/_state.scss') diff --git a/src/bem/_state.scss b/src/bem/_state.scss index 4a85bbb..2d430bf 100644 --- a/src/bem/_state.scss +++ b/src/bem/_state.scss @@ -4,6 +4,10 @@ /// @access public //// +@use './validators'; +@use './vars'; +@use '../contexts'; + /// /// Create a new state rule. /// @@ -13,10 +17,10 @@ /// @content /// /// @example scss - Using single is-state -/// @include iro-bem-object('menu') { +/// @include object('menu') { /// display: none; /// -/// @include iro-bem-state('is', open') { +/// @include state('is', open') { /// display: block; /// } /// } @@ -32,10 +36,10 @@ /// } /// /// @example scss - Using multiple is-states -/// @include iro-bem-object('menu') { +/// @include object('menu') { /// display: none; /// -/// @include iro-bem-state('is', open', 'visible') { +/// @include state('is', open', 'visible') { /// display: block; /// } /// } @@ -51,23 +55,23 @@ /// display: block; /// } /// -@mixin iro-bem-state($prefix, $state, $states...) { - $result: iro-bem-state($prefix, $state, $states...); +@mixin state($prefix, $state, $states...) { + $result: state($prefix, $state, $states...); $selector: nth($result, 1); $context: nth($result, 2); - @include iro-bem-validate( + @include validators.validate( 'state', (prefix: $prefix, state: $state, states: $states), $selector, $context ); - @include iro-context-push($iro-bem-context-id, $context...); + @include contexts.push(vars.$context-id, $context...); @at-root #{$selector} { @content; } - @include iro-context-pop($iro-bem-context-id); + @include contexts.pop(vars.$context-id); } /// @@ -75,9 +79,9 @@ /// /// @return {list} A list with two items: 1. selector, 2. context or `null` /// -/// @see {mixin} iro-bem-has +/// @see {mixin} has /// -@function iro-bem-state($prefix, $state, $states...) { +@function state($prefix, $state, $states...) { $selector: (); $parts-data: (); @@ -104,10 +108,10 @@ /// /// Create a new has-state modifier. /// -/// It's a shorthand for iro-bem-state('is', $state, $states...). +/// It's a shorthand for state('is', $state, $states...). /// -@mixin iro-bem-is($state, $states...) { - @include iro-bem-state('is', $state, $states...) { +@mixin is($state, $states...) { + @include state('is', $state, $states...) { @content; } } @@ -117,19 +121,19 @@ /// /// @return {list} A list with two items: 1. selector, 2. context or `null` /// -/// @see {mixin} iro-bem-is +/// @see {mixin} is /// -@function iro-bem-is($state, $states...) { - @return iro-bem-state('is', $state, $states...); +@function is($state, $states...) { + @return state('is', $state, $states...); } /// /// Create a new has-state modifier. /// -/// It's a shorthand for iro-bem-state('has', $state, $states...). +/// It's a shorthand for state('has', $state, $states...). /// -@mixin iro-bem-has($state, $states...) { - @include iro-bem-state('has', $state, $states...) { +@mixin has($state, $states...) { + @include state('has', $state, $states...) { @content; } } @@ -139,8 +143,8 @@ /// /// @return {list} A list with two items: 1. selector, 2. context or `null` /// -/// @see {mixin} iro-bem-has +/// @see {mixin} has /// -@function iro-bem-has($state, $states...) { - @return iro-bem-state('has', $state, $states...); +@function has($state, $states...) { + @return state('has', $state, $states...); } -- cgit v1.3.1