@guebbit/css-toolkit 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -661
- package/README.md +5 -5
- package/docs/.postcssrc.cjs +11 -11
- package/docs/.vitepress/config.ts +88 -88
- package/docs/.vitepress/dist/404.html +4 -4
- package/docs/.vitepress/dist/assets/app.CE7x4Dlp.js +1 -0
- package/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.CS_28jj8.js +1 -0
- package/docs/.vitepress/dist/assets/chunks/VPLocalSearchBox.TmXlq6CT.js +8 -0
- package/docs/.vitepress/dist/assets/chunks/framework.BZemHgQ6.js +18 -0
- package/docs/.vitepress/dist/assets/chunks/theme.BWSHCtHe.js +2 -0
- package/docs/.vitepress/dist/assets/{colors_bootstrap.md.B8QNot57.js → colors_bootstrap.md.CFg-dNGF.js} +1 -1
- package/docs/.vitepress/dist/assets/{colors_bootstrap.md.B8QNot57.lean.js → colors_bootstrap.md.CFg-dNGF.lean.js} +1 -1
- package/docs/.vitepress/dist/assets/colors_brands.md.CUxoS0ml.js +1 -0
- package/docs/.vitepress/dist/assets/colors_brands.md.CUxoS0ml.lean.js +1 -0
- package/docs/.vitepress/dist/assets/{colors_customs.md.B9XC2fYm.js → colors_customs.md.CnHhl84q.js} +1 -1
- package/docs/.vitepress/dist/assets/{colors_customs.md.B9XC2fYm.lean.js → colors_customs.md.CnHhl84q.lean.js} +1 -1
- package/docs/.vitepress/dist/assets/{functions_colors.md.8WIzA1Az.js → functions_colors.md.BsOBqU9L.js} +1 -1
- package/docs/.vitepress/dist/assets/functions_colors.md.BsOBqU9L.lean.js +1 -0
- package/docs/.vitepress/dist/assets/functions_helpers.md.B3A_IOEL.js +1 -0
- package/docs/.vitepress/dist/assets/functions_helpers.md.B3A_IOEL.lean.js +1 -0
- package/docs/.vitepress/dist/assets/{functions_strings.md.B-I-mSmy.js → functions_strings.md.BdV8Kx9J.js} +1 -1
- package/docs/.vitepress/dist/assets/{functions_strings.md.B-I-mSmy.lean.js → functions_strings.md.BdV8Kx9J.lean.js} +1 -1
- package/docs/.vitepress/dist/assets/{index.md.DO-yHYeM.js → index.md.Cn1TneoC.js} +1 -1
- package/docs/.vitepress/dist/assets/{index.md.DO-yHYeM.lean.js → index.md.Cn1TneoC.lean.js} +1 -1
- package/docs/.vitepress/dist/assets/{mixins_build-aspect-ratio.md.Cjv_a3MY.js → mixins_build-aspect-ratio.md.cD70Q1mW.js} +1 -1
- package/docs/.vitepress/dist/assets/{mixins_build-aspect-ratio.md.Cjv_a3MY.lean.js → mixins_build-aspect-ratio.md.cD70Q1mW.lean.js} +1 -1
- package/docs/.vitepress/dist/assets/{mixins_build-compatibility.md.BO6wODYa.js → mixins_build-compatibility.md.DvZg2OSO.js} +15 -4
- package/docs/.vitepress/dist/assets/mixins_build-compatibility.md.DvZg2OSO.lean.js +1 -0
- package/docs/.vitepress/dist/assets/{mixins_build-scrollbar.md.BX34elgD.js → mixins_build-scrollbar.md.Bze7PgzU.js} +1 -1
- package/docs/.vitepress/dist/assets/mixins_build-scrollbar.md.Bze7PgzU.lean.js +1 -0
- package/docs/.vitepress/dist/assets/{mixins_create-colors.md.82HeTZt6.js → mixins_create-colors.md.Bi4iqAHf.js} +1 -1
- package/docs/.vitepress/dist/assets/{mixins_create-colors.md.82HeTZt6.lean.js → mixins_create-colors.md.Bi4iqAHf.lean.js} +1 -1
- package/docs/.vitepress/dist/assets/{mixins_create-helper-margin.md.D2-T7z0a.js → mixins_create-helper-margin.md.DqwBKQ0G.js} +1 -1
- package/docs/.vitepress/dist/assets/mixins_create-helper-margin.md.DqwBKQ0G.lean.js +1 -0
- package/docs/.vitepress/dist/assets/{mixins_create-helper-padding.md.Cp-laxuA.js → mixins_create-helper-padding.md.Br9TOGl1.js} +1 -1
- package/docs/.vitepress/dist/assets/mixins_create-helper-padding.md.Br9TOGl1.lean.js +1 -0
- package/docs/.vitepress/dist/assets/{mixins_create-instruction.md.dJ83FO6R.js → mixins_create-instruction.md.BeAIoeQx.js} +15 -7
- package/docs/.vitepress/dist/assets/mixins_create-instruction.md.BeAIoeQx.lean.js +1 -0
- package/docs/.vitepress/dist/assets/style.BsKZwvOR.css +1 -0
- package/docs/.vitepress/dist/colors/bootstrap.html +8 -8
- package/docs/.vitepress/dist/colors/brands.html +8 -8
- package/docs/.vitepress/dist/colors/customs.html +8 -8
- package/docs/.vitepress/dist/functions/colors.html +8 -8
- package/docs/.vitepress/dist/functions/helpers.html +8 -8
- package/docs/.vitepress/dist/functions/strings.html +8 -8
- package/docs/.vitepress/dist/hashmap.json +1 -1
- package/docs/.vitepress/dist/index.html +8 -8
- package/docs/.vitepress/dist/mixins/build-aspect-ratio.html +8 -8
- package/docs/.vitepress/dist/mixins/build-compatibility.html +21 -10
- package/docs/.vitepress/dist/mixins/build-scrollbar.html +8 -8
- package/docs/.vitepress/dist/mixins/create-colors.html +8 -8
- package/docs/.vitepress/dist/mixins/create-helper-margin.html +9 -9
- package/docs/.vitepress/dist/mixins/create-helper-padding.html +8 -8
- package/docs/.vitepress/dist/mixins/create-instruction.html +21 -13
- package/docs/.vitepress/dist/vp-icons.css +0 -2
- package/docs/.vitepress/theme/index.js +11 -11
- package/docs/functions/colors.md +65 -65
- package/docs/logo.svg +55 -55
- package/docs/logotype.svg +149 -149
- package/docs/mixins/build-compatibility.md +22 -22
- package/docs/mixins/build-scrollbar.md +18 -18
- package/docs/mixins/create-helper-margin.md +25 -25
- package/docs/mixins/create-helper-padding.md +24 -24
- package/docs/mixins/create-instruction.md +32 -32
- package/package.json +61 -61
- package/src/colors/_bootstrap.scss +179 -179
- package/src/colors/_brands.scss +20 -20
- package/src/colors/_customs.scss +52 -52
- package/src/colors/_index.scss +199 -199
- package/src/functions/_colors.scss +134 -121
- package/src/functions/_helpers.scss +44 -42
- package/src/functions/_strings.scss +30 -30
- package/src/index.scss +13 -12
- package/src/mixins/_build-aspect-ratio.scss +36 -36
- package/src/mixins/_build-compatibility.scss +38 -27
- package/src/mixins/_build-scrollbar.scss +31 -31
- package/src/mixins/_create-class.scss +19 -0
- package/src/mixins/_create-colors-vars.scss +35 -0
- package/src/mixins/_create-colors.scss +160 -119
- package/src/mixins/_create-helper-margin.scss +38 -38
- package/src/mixins/_create-helper-padding.scss +40 -40
- package/test/compile.test.js +131 -105
- package/test/lint.test.js +48 -48
- package/test/test.css +5935 -986
- package/test/test.scss +196 -158
- package/vite.config.ts +25 -25
- package/docs/.vitepress/dist/assets/app.Cez_7bx7.js +0 -1
- package/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.CkfJPSmi.js +0 -1
- package/docs/.vitepress/dist/assets/chunks/VPLocalSearchBox.lfLgIsvm.js +0 -8
- package/docs/.vitepress/dist/assets/chunks/framework.BQmytedh.js +0 -18
- package/docs/.vitepress/dist/assets/chunks/theme.ZIndENJH.js +0 -2
- package/docs/.vitepress/dist/assets/colors_brands.md.DA7CAmLz.js +0 -1
- package/docs/.vitepress/dist/assets/colors_brands.md.DA7CAmLz.lean.js +0 -1
- package/docs/.vitepress/dist/assets/functions_colors.md.8WIzA1Az.lean.js +0 -10
- package/docs/.vitepress/dist/assets/functions_helpers.md.DlnJURDc.js +0 -1
- package/docs/.vitepress/dist/assets/functions_helpers.md.DlnJURDc.lean.js +0 -1
- package/docs/.vitepress/dist/assets/mixins_build-compatibility.md.BO6wODYa.lean.js +0 -30
- package/docs/.vitepress/dist/assets/mixins_build-scrollbar.md.BX34elgD.lean.js +0 -32
- package/docs/.vitepress/dist/assets/mixins_create-helper-margin.md.D2-T7z0a.lean.js +0 -46
- package/docs/.vitepress/dist/assets/mixins_create-helper-padding.md.Cp-laxuA.lean.js +0 -45
- package/docs/.vitepress/dist/assets/mixins_create-instruction.md.dJ83FO6R.lean.js +0 -20
- package/docs/.vitepress/dist/assets/style.BKBz-tcN.css +0 -1
- package/src/mixins/_create-instructions.scss +0 -11
|
@@ -1,122 +1,135 @@
|
|
|
1
|
-
@use "sass:color";
|
|
2
|
-
@use "sass:math";
|
|
3
|
-
@use "sass:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
@return
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Shade a color
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
@
|
|
30
|
-
@return
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Shade the color if the weight is positive, else tint it
|
|
36
|
-
* function credited to https://getbootstrap.com/
|
|
37
|
-
*/
|
|
38
|
-
@function color-shift($color, $weight) {
|
|
39
|
-
@return if($weight > 0,
|
|
40
|
-
color-shade($color, $weight),
|
|
41
|
-
color-tint($color, -$weight)
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
$
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
*
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
//
|
|
93
|
-
@if $
|
|
94
|
-
$
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
$
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
1
|
+
@use "sass:color";
|
|
2
|
+
@use "sass:math";
|
|
3
|
+
@use "sass:meta";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Return opaque color
|
|
7
|
+
* color-opaque(#fff, rgba(0, 0, 0, .5)) => #808080
|
|
8
|
+
* function credited to https://getbootstrap.com/
|
|
9
|
+
*/
|
|
10
|
+
@function color-opaque($background, $foreground) {
|
|
11
|
+
@return color.mix(rgba($foreground, 1), $background, color.opacity($foreground) * 100%);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Tint a color
|
|
16
|
+
*/
|
|
17
|
+
@function color-tint($color, $weight) {
|
|
18
|
+
// Creates a physical mixture with white color
|
|
19
|
+
@return color.mix(#fff, $color, $weight);
|
|
20
|
+
// Adjusts properties (like lightness) relative to the color's current values.
|
|
21
|
+
// @return color.scale($color, $lightness: $weight);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Shade a color
|
|
27
|
+
*/
|
|
28
|
+
@function color-shade($color, $weight) {
|
|
29
|
+
@return color.mix(#000, $color, $weight);
|
|
30
|
+
// @return color.scale($color, $lightness: -$weight);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Shade the color if the weight is positive, else tint it
|
|
36
|
+
* function credited to https://getbootstrap.com/
|
|
37
|
+
*/
|
|
38
|
+
@function color-shift($color, $weight) {
|
|
39
|
+
@return if($weight > 0,
|
|
40
|
+
color-shade($color, $weight),
|
|
41
|
+
color-tint($color, -$weight)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Return WCAG2.1 relative luminance
|
|
48
|
+
* See https://www.w3.org/TR/WCAG/#dfn-relative-luminance
|
|
49
|
+
* See https://en.wikipedia.org/wiki/Relative_luminance
|
|
50
|
+
* Gives %, less than 50 darker is better, less than 50, lighter.
|
|
51
|
+
* Function like color.channel($color, "lightness", $space: hsl) gives a different %
|
|
52
|
+
*/
|
|
53
|
+
@function color-luminance($color) {
|
|
54
|
+
// fallback
|
|
55
|
+
@if $color == transparent or meta.type-of($color) != color {
|
|
56
|
+
@return 100;
|
|
57
|
+
}
|
|
58
|
+
@return math.div((
|
|
59
|
+
(color.channel($color, "red", $space: rgb) * .299) +
|
|
60
|
+
(color.channel($color, "green", $space: rgb) * .587) +
|
|
61
|
+
(color.channel($color, "blue", $space: rgb) * .114)
|
|
62
|
+
), 255) * 100%;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Compares contrast of a given color to the light/dark arguments and returns whichever is most "contrasty"
|
|
68
|
+
*/
|
|
69
|
+
@function color-contrast($color: #fff, $dark: #000, $light: #fff) {
|
|
70
|
+
@if meta.type-of($color) != color or $color == transparent {
|
|
71
|
+
@return inherit;
|
|
72
|
+
}
|
|
73
|
+
$color-brightness: color-luminance($color);
|
|
74
|
+
$light-text-brightness: color-luminance($light);
|
|
75
|
+
$dark-text-brightness: color-luminance($dark);
|
|
76
|
+
|
|
77
|
+
@return if(math.abs($color-brightness - $light-text-brightness) > math.abs($color-brightness - $dark-text-brightness), $light, $dark);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* NEW numeric annotation
|
|
83
|
+
* Hex to RGB (only numbers, transparentize would add rgba(*))
|
|
84
|
+
* $color
|
|
85
|
+
* $alpha:
|
|
86
|
+
* - 0: never 4° digit
|
|
87
|
+
* - 1: always 4° digit
|
|
88
|
+
* - 2: 4° digit only when needed
|
|
89
|
+
* $classic: false = new number annotation
|
|
90
|
+
*/
|
|
91
|
+
@function extract-colors($color: #fff, $mode: 2, $classic: false){
|
|
92
|
+
// colors only
|
|
93
|
+
@if $color == transparent or meta.type-of($color) != color {
|
|
94
|
+
@return $color;
|
|
95
|
+
}
|
|
96
|
+
// new annotation
|
|
97
|
+
$delimiter: " ";
|
|
98
|
+
$delimiter-alpha: " / ";
|
|
99
|
+
// old annotation
|
|
100
|
+
@if $classic{
|
|
101
|
+
$delimiter: ", ";
|
|
102
|
+
$delimiter-alpha: ", ";
|
|
103
|
+
}
|
|
104
|
+
$alpha: color.alpha($color);
|
|
105
|
+
@if $mode == 1 or ($mode == 2 and $alpha == 1) {
|
|
106
|
+
@return color.channel($color, "red", $space: rgb) +
|
|
107
|
+
$delimiter + color.channel($color, "green", $space: rgb) +
|
|
108
|
+
$delimiter + color.channel($color, "blue", $space: rgb);
|
|
109
|
+
}
|
|
110
|
+
// Regular RGBA compliant result ("number" notation)
|
|
111
|
+
@return color.channel($color, "red", $space: rgb) +
|
|
112
|
+
$delimiter + color.channel($color, "green", $space: rgb) +
|
|
113
|
+
$delimiter + color.channel($color, "blue", $space: rgb) +
|
|
114
|
+
$delimiter-alpha + color.channel($color, "alpha"); // * 100%
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Create default collection
|
|
119
|
+
* @param $color
|
|
120
|
+
*/
|
|
121
|
+
@function create-collection($color: #fff) {
|
|
122
|
+
$list: (
|
|
123
|
+
"100": color-tint($color, 80%),
|
|
124
|
+
"200": color-tint($color, 60%),
|
|
125
|
+
"300": color-tint($color, 40%),
|
|
126
|
+
"400": color-tint($color, 20%),
|
|
127
|
+
"500": $color,
|
|
128
|
+
"600": color-shade($color, 20%),
|
|
129
|
+
"700": color-shade($color, 40%),
|
|
130
|
+
"800": color-shade($color, 60%),
|
|
131
|
+
"900": color-shade($color, 80%)
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
@return $list
|
|
122
135
|
}
|
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
1
|
+
@use "sass:map" as map;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Giving a list of variables and values,
|
|
5
|
+
* from start to end, try all the values until a non-null is found
|
|
6
|
+
*/
|
|
7
|
+
@function no-null-var($list: ()){
|
|
8
|
+
@each $value in $list {
|
|
9
|
+
// stylelint-disable-next-line scss/at-if-no-null
|
|
10
|
+
@if $value != null and $value != undefined {
|
|
11
|
+
@return $value;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
@return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* If the color is the checked one, return inherit
|
|
19
|
+
*/
|
|
20
|
+
@function no-target-var($check: transparent, $color: transparent){
|
|
21
|
+
@if $color == $check {
|
|
22
|
+
@return inherit;
|
|
23
|
+
}
|
|
24
|
+
@return $color;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* This function is to be used to return nested key values within a nested map
|
|
30
|
+
* @parameter {Variable} $map [null] - pass in map to be evaluated
|
|
31
|
+
* @parameter {Variable} $keys [null] - pass in keys to be evaluated
|
|
32
|
+
*/
|
|
33
|
+
// $map: (
|
|
34
|
+
// 'size': (
|
|
35
|
+
// 'sml': 10px
|
|
36
|
+
// )
|
|
37
|
+
// );
|
|
38
|
+
// $var: map-deep-get($map, 'size', 'sml'); // => 10px
|
|
39
|
+
@function map-deep-get($map, $keys...) {
|
|
40
|
+
@each $key in $keys {
|
|
41
|
+
$map: map.get($map, $key);
|
|
42
|
+
}
|
|
43
|
+
@return $map;
|
|
44
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Split string into lists
|
|
3
|
-
*/
|
|
4
|
-
@function string-split($string, $separator: "-") {
|
|
5
|
-
// empty array/list
|
|
6
|
-
$split-arr: ();
|
|
7
|
-
// first index of separator in string
|
|
8
|
-
$index : str-index($string, $separator);
|
|
9
|
-
// loop through string
|
|
10
|
-
@while $index != null {
|
|
11
|
-
// get the substring from the first character to the separator
|
|
12
|
-
$item: str-slice($string, 1, $index - 1);
|
|
13
|
-
// push item to array
|
|
14
|
-
$split-arr: append($split-arr, $item);
|
|
15
|
-
// remove item and separator from string
|
|
16
|
-
$string: str-slice($string, $index + 1);
|
|
17
|
-
// find new index of separator
|
|
18
|
-
$index : str-index($string, $separator);
|
|
19
|
-
}
|
|
20
|
-
// add the remaining string to list (the last item)
|
|
21
|
-
$split-arr: append($split-arr, $string);
|
|
22
|
-
|
|
23
|
-
@return $split-arr;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
Check if $string ends with $find
|
|
28
|
-
*/
|
|
29
|
-
@function string-ends-with($string, $find) {
|
|
30
|
-
@return (str-length($string) >= str-length($find)) and (str-slice($string, (str-length($string) - str-length($find) + 1)) == $find);
|
|
1
|
+
/**
|
|
2
|
+
Split string into lists
|
|
3
|
+
*/
|
|
4
|
+
@function string-split($string, $separator: "-") {
|
|
5
|
+
// empty array/list
|
|
6
|
+
$split-arr: ();
|
|
7
|
+
// first index of separator in string
|
|
8
|
+
$index : str-index($string, $separator);
|
|
9
|
+
// loop through string
|
|
10
|
+
@while $index != null {
|
|
11
|
+
// get the substring from the first character to the separator
|
|
12
|
+
$item: str-slice($string, 1, $index - 1);
|
|
13
|
+
// push item to array
|
|
14
|
+
$split-arr: append($split-arr, $item);
|
|
15
|
+
// remove item and separator from string
|
|
16
|
+
$string: str-slice($string, $index + 1);
|
|
17
|
+
// find new index of separator
|
|
18
|
+
$index : str-index($string, $separator);
|
|
19
|
+
}
|
|
20
|
+
// add the remaining string to list (the last item)
|
|
21
|
+
$split-arr: append($split-arr, $string);
|
|
22
|
+
|
|
23
|
+
@return $split-arr;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
Check if $string ends with $find
|
|
28
|
+
*/
|
|
29
|
+
@function string-ends-with($string, $find) {
|
|
30
|
+
@return (str-length($string) >= str-length($find)) and (str-slice($string, (str-length($string) - str-length($find) + 1)) == $find);
|
|
31
31
|
}
|
package/src/index.scss
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
@forward "./colors";
|
|
2
|
-
|
|
3
|
-
@forward "./functions/colors";
|
|
4
|
-
@forward "./functions/helpers";
|
|
5
|
-
@forward "./functions/strings";
|
|
6
|
-
|
|
7
|
-
@forward "./mixins/build-aspect-ratio";
|
|
8
|
-
@forward "./mixins/build-compatibility";
|
|
9
|
-
@forward "./mixins/build-scrollbar";
|
|
10
|
-
@forward "./mixins/create-colors";
|
|
11
|
-
@forward "./mixins/create-
|
|
12
|
-
@forward "./mixins/create-
|
|
1
|
+
@forward "./colors";
|
|
2
|
+
|
|
3
|
+
@forward "./functions/colors";
|
|
4
|
+
@forward "./functions/helpers";
|
|
5
|
+
@forward "./functions/strings";
|
|
6
|
+
|
|
7
|
+
@forward "./mixins/build-aspect-ratio";
|
|
8
|
+
@forward "./mixins/build-compatibility";
|
|
9
|
+
@forward "./mixins/build-scrollbar";
|
|
10
|
+
@forward "./mixins/create-colors";
|
|
11
|
+
@forward "./mixins/create-colors-vars";
|
|
12
|
+
@forward "./mixins/create-class";
|
|
13
|
+
@forward "./mixins/create-helper-margin";
|
|
13
14
|
@forward "./mixins/create-helper-padding";
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
@use "../functions/strings" as guebbit;
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Use in the parent\container, to be coupled with {build-aspect-ratio-anchor}
|
|
5
|
-
*/
|
|
6
|
-
@mixin build-aspect-ratio-container($ratio: 100%){
|
|
7
|
-
position: relative;
|
|
8
|
-
// aspect-ratio: #{$height} / #{$width};
|
|
9
|
-
|
|
10
|
-
&::before{
|
|
11
|
-
content: "";
|
|
12
|
-
display: block;
|
|
13
|
-
padding-top: #{$ratio};
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Use in the child that "gives" form to the parent that has the respective {build-aspect-ratio-container}
|
|
19
|
-
*/
|
|
20
|
-
@mixin build-aspect-ratio-anchor{
|
|
21
|
-
position: absolute;
|
|
22
|
-
top: 0;
|
|
23
|
-
left: 0;
|
|
24
|
-
width: 100%;
|
|
25
|
-
height: 100%;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* aspect ratio shortcut
|
|
30
|
-
*/
|
|
31
|
-
@mixin build-aspect-ratio($ratio: 100%){
|
|
32
|
-
@include build-aspect-ratio-container($ratio);
|
|
33
|
-
|
|
34
|
-
& > * {
|
|
35
|
-
@include build-aspect-ratio-anchor;
|
|
36
|
-
}
|
|
1
|
+
@use "../functions/strings" as guebbit;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Use in the parent\container, to be coupled with {build-aspect-ratio-anchor}
|
|
5
|
+
*/
|
|
6
|
+
@mixin build-aspect-ratio-container($ratio: 100%){
|
|
7
|
+
position: relative;
|
|
8
|
+
// aspect-ratio: #{$height} / #{$width};
|
|
9
|
+
|
|
10
|
+
&::before{
|
|
11
|
+
content: "";
|
|
12
|
+
display: block;
|
|
13
|
+
padding-top: #{$ratio};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Use in the child that "gives" form to the parent that has the respective {build-aspect-ratio-container}
|
|
19
|
+
*/
|
|
20
|
+
@mixin build-aspect-ratio-anchor{
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 0;
|
|
23
|
+
left: 0;
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* aspect ratio shortcut
|
|
30
|
+
*/
|
|
31
|
+
@mixin build-aspect-ratio($ratio: 100%){
|
|
32
|
+
@include build-aspect-ratio-container($ratio);
|
|
33
|
+
|
|
34
|
+
& > * {
|
|
35
|
+
@include build-aspect-ratio-anchor;
|
|
36
|
+
}
|
|
37
37
|
}
|
|
@@ -1,28 +1,39 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compatibility mode for browsers
|
|
3
|
-
* @param string $browser: target browser
|
|
4
|
-
* @content
|
|
5
|
-
**/
|
|
6
|
-
@mixin build-compatibility($browser) {
|
|
7
|
-
// INTERNET EXPLORER
|
|
8
|
-
@if $browser == "ie" {
|
|
9
|
-
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
|
|
10
|
-
@content;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
// MICROSOFT EDGE
|
|
14
|
-
@if $browser == "edge" {
|
|
15
|
-
@supports (-ms-ime-align:auto) {
|
|
16
|
-
@content;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
// FIREFOX
|
|
20
|
-
@if $browser == "firefox" {
|
|
21
|
-
@supports (-moz-appearance:none) {
|
|
22
|
-
@content;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// OPERA
|
|
27
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility mode for browsers
|
|
3
|
+
* @param string $browser: target browser
|
|
4
|
+
* @content
|
|
5
|
+
**/
|
|
6
|
+
@mixin build-compatibility($browser) {
|
|
7
|
+
// INTERNET EXPLORER
|
|
8
|
+
@if $browser == "ie" {
|
|
9
|
+
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
|
|
10
|
+
@content;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
// MICROSOFT EDGE
|
|
14
|
+
@if $browser == "edge" {
|
|
15
|
+
@supports (-ms-ime-align:auto) {
|
|
16
|
+
@content;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// FIREFOX
|
|
20
|
+
@if $browser == "firefox" {
|
|
21
|
+
@supports (-moz-appearance:none) {
|
|
22
|
+
@content;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// OPERA
|
|
27
|
+
@if $browser == "opera" {
|
|
28
|
+
@supports (-o-object-fit: fill) {
|
|
29
|
+
@content;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// SAFARI
|
|
34
|
+
@if $browser == "safari" {
|
|
35
|
+
@supports (background: -webkit-named-image(i)) and (not (-webkit-touch-callout: none)) {
|
|
36
|
+
@content;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
28
39
|
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Builder - scrollbars of element
|
|
3
|
-
* @param string $color
|
|
4
|
-
* @param pixels $size
|
|
5
|
-
* @param $background: if false, has default lighten 40%
|
|
6
|
-
*/
|
|
7
|
-
@mixin build-scrollbar($size: "4px", $color: "#fff", $bg: "auto", $radius: "10px") {
|
|
8
|
-
$fallback-color: #fff;
|
|
9
|
-
$fallback-bg: transparent;
|
|
10
|
-
|
|
11
|
-
@if $bg == "auto" {
|
|
12
|
-
$bg: $fallback-bg;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
&::-webkit-scrollbar {
|
|
16
|
-
width: $size;
|
|
17
|
-
height: $size;
|
|
18
|
-
background-color: $fallback-bg;
|
|
19
|
-
background-color: $bg;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&::-webkit-scrollbar-thumb {
|
|
23
|
-
border-radius: $radius;
|
|
24
|
-
background-color: $fallback-color;
|
|
25
|
-
background-color: $color;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&::-webkit-scrollbar-corner {
|
|
29
|
-
background-color: $fallback-bg;
|
|
30
|
-
background-color: $bg;
|
|
31
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Builder - scrollbars of element
|
|
3
|
+
* @param string $color
|
|
4
|
+
* @param pixels $size
|
|
5
|
+
* @param $background: if false, has default lighten 40%
|
|
6
|
+
*/
|
|
7
|
+
@mixin build-scrollbar($size: "4px", $color: "#fff", $bg: "auto", $radius: "10px") {
|
|
8
|
+
$fallback-color: #fff;
|
|
9
|
+
$fallback-bg: transparent;
|
|
10
|
+
|
|
11
|
+
@if $bg == "auto" {
|
|
12
|
+
$bg: $fallback-bg;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&::-webkit-scrollbar {
|
|
16
|
+
width: $size;
|
|
17
|
+
height: $size;
|
|
18
|
+
background-color: $fallback-bg;
|
|
19
|
+
background-color: $bg;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&::-webkit-scrollbar-thumb {
|
|
23
|
+
border-radius: $radius;
|
|
24
|
+
background-color: $fallback-color;
|
|
25
|
+
background-color: $color;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&::-webkit-scrollbar-corner {
|
|
29
|
+
background-color: $fallback-bg;
|
|
30
|
+
background-color: $bg;
|
|
31
|
+
}
|
|
32
32
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@use "sass:list";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CSS single instructions class generator
|
|
5
|
+
* @param measure-list - {Array<name,value>[]} postfix name and value OR just values[] (name and value will be the same)
|
|
6
|
+
*/
|
|
7
|
+
@mixin create-class($instruction, $measure-list: (), $important: false, $prefix: "", $delimiter: "-") {
|
|
8
|
+
@each $values in $measure-list {
|
|
9
|
+
$name: $values;
|
|
10
|
+
$val: $values;
|
|
11
|
+
@if list.length($values) > 1 {
|
|
12
|
+
$name: list.nth($values, 1);
|
|
13
|
+
$val: list.nth($values, 2);
|
|
14
|
+
}
|
|
15
|
+
.#{$prefix}#{$instruction}#{$delimiter}#{$name} {
|
|
16
|
+
#{$instruction}: #{$val} #{if($important == true, "!important", "")}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|