Files
Automata/packages/design-system/src/css/mixins/function.scss
कारतोफ्फेलस्क्रिप्ट™ 13659d036f ci: Ensure that eslint runs on all frontend code (no-changelog) (#4602)
* ensure that eslint runs on all frontend code

* remove tslint from `design-system`

* enable prettier and eslint-prettier for `design-system`

* Delete tslint.json

* use a single editorconfig for the repo

* enable prettier for all code in `design-system`

* more linting fixes on design-system

* ignore coverage for git and prettier

* lintfix on editor-ui
2022-11-15 18:20:54 +01:00

54 lines
1.2 KiB
SCSS

@use 'sass:meta';
@use 'sass:string';
@use 'config';
/* BEM support Func
-------------------------- */
@function selectorToString($selector) {
$selector: meta.inspect($selector);
$selector: string.slice($selector, 2, -2);
@return $selector;
}
@function containsModifier($selector) {
$selector: selectorToString($selector);
@if string.index($selector, config.$modifier-separator) {
@return true;
} @else {
@return false;
}
}
@function containWhenFlag($selector) {
$selector: selectorToString($selector);
@if string.index($selector, '.' + config.$state-prefix) {
@return true;
} @else {
@return false;
}
}
@function containPseudoClass($selector) {
$selector: selectorToString($selector);
@if string.index($selector, ':') {
@return true;
} @else {
@return false;
}
}
@function hitAllSpecialNestRule($selector) {
@return containsModifier($selector) or containWhenFlag($selector) or containPseudoClass($selector);
}
@function lightness($h, $s, $l, $lightness) {
@return hsl(var(#{$h}), var(#{$s}), calc(var(#{$l}) + #{$lightness}));
}
@function saturation($h, $s, $l, $saturation) {
@return hsl(var(#{$h}), calc(var(#{$s}) + #{$saturation}), var(#{$l}));
}