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/_suffix.scss | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'src/bem/_suffix.scss') diff --git a/src/bem/_suffix.scss b/src/bem/_suffix.scss index b103c9f..2ddb54d 100644 --- a/src/bem/_suffix.scss +++ b/src/bem/_suffix.scss @@ -4,6 +4,11 @@ /// @access public //// +@use './validators'; +@use './vars'; +@use '../functions'; +@use '../contexts'; + /// /// Generate a new suffix. /// @@ -14,17 +19,17 @@ /// @throw If the element is not preceded by a block or modifier. /// /// @example scss - Using a suffix -/// @include iro-bem-utility('hidden') { +/// @include utility('hidden') { /// display: none; /// /// @media (max-width: 320px) { -/// @include iro-bem-suffix('phone') { +/// @include suffix('phone') { /// display: none; /// } /// } /// /// @media (max-width: 768px) { -/// @include iro-bem-suffix('tablet') { +/// @include suffix('tablet') { /// display: none; /// } /// } @@ -48,23 +53,23 @@ /// } /// } /// -@mixin iro-bem-suffix($name) { - $result: iro-bem-suffix($name); +@mixin suffix($name) { + $result: suffix($name); $selector: nth($result, 1); $context: nth($result, 2); - @include iro-bem-validate( + @include validators.validate( 'suffix', (name: $name), $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); } /// @@ -72,21 +77,21 @@ /// /// @return {list} A list with two items: 1. selector, 2. context or `null` /// -/// @see {mixin} iro-bem-suffix +/// @see {mixin} suffix /// -@function iro-bem-suffix($name) { +@function suffix($name) { // // Suffixes can be used on block, element and modifier. // - $noop: iro-context-assert-stack-count($iro-bem-context-id, $iro-bem-max-depth); - $noop: iro-context-assert-stack-must-contain($iro-bem-context-id, 'block'); - $noop: iro-context-assert-stack-must-not-contain($iro-bem-context-id, 'suffix'); + $noop: contexts.assert-stack-count(vars.$context-id, vars.$max-depth); + $noop: contexts.assert-stack-must-contain(vars.$context-id, 'block'); + $noop: contexts.assert-stack-must-not-contain(vars.$context-id, 'suffix'); - $parent-context: iro-context-get($iro-bem-context-id, 'block' 'element' 'modifier'); + $parent-context: contexts.get(vars.$context-id, 'block' 'element' 'modifier'); $parent-selector: map-get(nth($parent-context, 2), 'selector'); - @if not iro-selector-suffix-match(&, $parent-selector) { + @if not functions.selector-suffix-match(&, $parent-selector) { // // The current selector doesn't match the parent selector. // The user manually added a selector between parent context and this suffix call. @@ -107,7 +112,7 @@ // - {b,e,m}@suffix // - $selector: selector-append(&, $iro-bem-suffix-separator + $name); + $selector: selector-append(&, vars.$suffix-separator + $name); $context: 'suffix', ( 'name': $name, -- cgit v1.3.1