From f0f84513f8efe533b6ee670a6f1a0c074387b2ec Mon Sep 17 00:00:00 2001 From: Volpeon Date: Wed, 13 Aug 2025 12:01:46 +0200 Subject: Make use of SASS modules --- src/bem/_multi.scss | 102 +++++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 49 deletions(-) (limited to 'src/bem/_multi.scss') diff --git a/src/bem/_multi.scss b/src/bem/_multi.scss index 1de5cdc..c0beeeb 100644 --- a/src/bem/_multi.scss +++ b/src/bem/_multi.scss @@ -4,6 +4,10 @@ /// @access public //// +@use 'sass:list'; +@use 'sass:meta'; +@use 'sass:selector'; +@use 'sass:string'; @use '../functions'; @use '../contexts'; @use './block'; @@ -81,67 +85,67 @@ /// } /// @mixin multi($first, $others...) { - @include contexts.assert-stack-count(vars.$context-id, vars.$max-depth); + @include contexts.assert-stack-count(vars.$context-id, vars.$max-depth); - @each $entity in functions.list-prepend($others, $first) { - $is-manual-selector: false; + @each $entity in functions.list-prepend($others, $first) { + $is-manual-selector: false; - @if type-of($entity) == string { - @if find-bem-function($entity) == null { - $is-manual-selector: true; - } - } + @if meta.type-of($entity) == string { + @if find-bem-function($entity) == null { + $is-manual-selector: true; + } + } - @if $is-manual-selector { - $sel: if(&, selector-nest(&, $entity), selector-parse($entity)); + @if $is-manual-selector { + $sel: if(&, selector.nest(&, $entity), selector.parse($entity)); - @at-root #{$sel} { - @content; - } - } @else { - $entity-func-id: null; + @at-root #{$sel} { + @content; + } + } @else { + $entity-func-id: null; - @if type-of($entity) == list { - $entity-func-id: nth($entity, 1); - $entity: functions.list-slice($entity, 2); - } @else { - $entity-func-id: $entity; - $entity: (); - } + @if meta.type-of($entity) == list { + $entity-func-id: list.nth($entity, 1); + $entity: functions.list-slice($entity, 2); + } @else { + $entity-func-id: $entity; + $entity: (); + } - @if str-slice($entity-func-id, str-length($entity-func-id)) == ':' { - $entity-func-id: unquote(str-slice($entity-func-id, 1, str-length($entity-func-id) - 1)); - } + @if string.slice($entity-func-id, string.length($entity-func-id)) == ':' { + $entity-func-id: string.unquote(string.slice($entity-func-id, 1, string.length($entity-func-id) - 1)); + } - $sel-func: find-bem-function($entity-func-id); + $sel-func: find-bem-function($entity-func-id); - @if $sel-func == null { - @error 'Function "#{inspect($entity-func-id)}" was not found.'; - } + @if $sel-func == null { + @error 'Function "#{inspect($entity-func-id)}" was not found.'; + } - $entity-result: call($sel-func, $entity...); - $entity-result-selector: nth($entity-result, 1); - $entity-result-context: nth($entity-result, 2); + $entity-result: meta.call($sel-func, $entity...); + $entity-result-selector: list.nth($entity-result, 1); + $entity-result-context: list.nth($entity-result, 2); - @if $entity-result-context != null { - @include contexts.push(vars.$context-id, $entity-result-context...); - } - @at-root #{$entity-result-selector} { - @content; - } - @if $entity-result-context != null { - @include contexts.pop(vars.$context-id); - } - } - } + @if $entity-result-context != null { + @include contexts.push(vars.$context-id, $entity-result-context...); + } + @at-root #{$entity-result-selector} { + @content; + } + @if $entity-result-context != null { + @include contexts.pop(vars.$context-id); + } + } + } } @function find-bem-function($name) { - @each $module in (block element modifier state suffix theme) { - @if function-exists($name, $module) { - @return get-function($name, $module: $module); - } - } + @each $module in (block element modifier state suffix theme) { + @if meta.function-exists($name, $module) { + @return meta.get-function($name, $module: $module); + } + } - @return null; + @return null; } -- cgit v1.2.3-70-g09d2