@guebbit/css-toolkit 1.3.2 → 1.4.0

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.
Files changed (131) hide show
  1. package/LICENSE +661 -661
  2. package/README.md +3 -6
  3. package/docs/.postcssrc.cjs +12 -12
  4. package/docs/.vitepress/cache/deps/_metadata.json +52 -0
  5. package/docs/.vitepress/cache/deps/chunk-GD2PZ323.js +9709 -0
  6. package/docs/.vitepress/cache/deps/chunk-GD2PZ323.js.map +7 -0
  7. package/docs/.vitepress/cache/deps/chunk-LW4I4DCF.js +12542 -0
  8. package/docs/.vitepress/cache/deps/chunk-LW4I4DCF.js.map +7 -0
  9. package/docs/.vitepress/cache/deps/package.json +3 -0
  10. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4504 -0
  11. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
  12. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +581 -0
  13. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
  14. package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +1145 -0
  15. package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js.map +7 -0
  16. package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +1665 -0
  17. package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js.map +7 -0
  18. package/docs/.vitepress/cache/deps/vitepress___minisearch.js +1839 -0
  19. package/docs/.vitepress/cache/deps/vitepress___minisearch.js.map +7 -0
  20. package/docs/.vitepress/cache/deps/vue.js +343 -0
  21. package/docs/.vitepress/cache/deps/vue.js.map +7 -0
  22. package/docs/.vitepress/config.ts +89 -89
  23. package/docs/.vitepress/dist/404.html +3 -3
  24. package/docs/.vitepress/dist/assets/{app.CBPosL5d.js → app.L5XIc3SO.js} +1 -1
  25. package/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.BjS_jZ-W.js +1 -0
  26. package/docs/.vitepress/dist/assets/chunks/{VPLocalSearchBox.gSyUO2Y7.js → VPLocalSearchBox.D9sh6SyY.js} +1 -1
  27. package/docs/.vitepress/dist/assets/chunks/{theme.BeEqdqye.js → theme.CNmpkBNC.js} +2 -2
  28. package/docs/.vitepress/dist/assets/colors_bootstrap.md.CoHKBFV-.js +183 -0
  29. package/docs/.vitepress/dist/assets/colors_bootstrap.md.CoHKBFV-.lean.js +1 -0
  30. package/docs/.vitepress/dist/assets/colors_brands.md.D66byFIK.js +34 -0
  31. package/docs/.vitepress/dist/assets/colors_brands.md.D66byFIK.lean.js +1 -0
  32. package/docs/.vitepress/dist/assets/colors_customs.md.BOrXeoM5.js +53 -0
  33. package/docs/.vitepress/dist/assets/colors_customs.md.BOrXeoM5.lean.js +1 -0
  34. package/docs/.vitepress/dist/assets/{functions_colors.md.BsOBqU9L.js → functions_colors.md.-D_m804_.js} +12 -4
  35. package/docs/.vitepress/dist/assets/functions_colors.md.-D_m804_.lean.js +1 -0
  36. package/docs/.vitepress/dist/assets/functions_helpers.md.ByBd49Zv.js +51 -0
  37. package/docs/.vitepress/dist/assets/functions_helpers.md.ByBd49Zv.lean.js +1 -0
  38. package/docs/.vitepress/dist/assets/functions_strings.md.BQe_bdya.js +38 -0
  39. package/docs/.vitepress/dist/assets/functions_strings.md.BQe_bdya.lean.js +1 -0
  40. package/docs/.vitepress/dist/assets/index.md.B1EiZFo_.js +1 -0
  41. package/docs/.vitepress/dist/assets/index.md.B1EiZFo_.lean.js +1 -0
  42. package/docs/.vitepress/dist/assets/mixins_build-aspect-ratio.md.ICFUpBeX.js +39 -0
  43. package/docs/.vitepress/dist/assets/mixins_build-aspect-ratio.md.ICFUpBeX.lean.js +1 -0
  44. package/docs/.vitepress/dist/assets/{mixins_build-compatibility.md.DvZg2OSO.js → mixins_build-compatibility.md.CmlXWpxv.js} +4 -3
  45. package/docs/.vitepress/dist/assets/{mixins_build-scrollbar.md.Bze7PgzU.js → mixins_build-scrollbar.md.hZriM4ET.js} +7 -2
  46. package/docs/.vitepress/dist/assets/mixins_create-colors.md.D6f2BMAy.js +204 -0
  47. package/docs/.vitepress/dist/assets/mixins_create-colors.md.D6f2BMAy.lean.js +1 -0
  48. package/docs/.vitepress/dist/assets/{mixins_create-helper-margin.md.DqwBKQ0G.js → mixins_create-helper-margin.md.CFz5if3z.js} +18 -18
  49. package/docs/.vitepress/dist/assets/mixins_create-helper-margin.md.CFz5if3z.lean.js +1 -0
  50. package/docs/.vitepress/dist/assets/mixins_create-helper-padding.md.Ct06sNMx.js +50 -0
  51. package/docs/.vitepress/dist/assets/mixins_create-helper-padding.md.Ct06sNMx.lean.js +1 -0
  52. package/docs/.vitepress/dist/assets/{mixins_create-instruction.md.BeAIoeQx.js → mixins_create-instruction.md.B0iVQyHl.js} +18 -4
  53. package/docs/.vitepress/dist/colors/bootstrap.html +189 -7
  54. package/docs/.vitepress/dist/colors/brands.html +40 -7
  55. package/docs/.vitepress/dist/colors/customs.html +59 -7
  56. package/docs/.vitepress/dist/functions/colors.html +16 -8
  57. package/docs/.vitepress/dist/functions/helpers.html +57 -7
  58. package/docs/.vitepress/dist/functions/strings.html +44 -7
  59. package/docs/.vitepress/dist/hashmap.json +1 -1
  60. package/docs/.vitepress/dist/index.html +6 -6
  61. package/docs/.vitepress/dist/mixins/build-aspect-ratio.html +45 -7
  62. package/docs/.vitepress/dist/mixins/build-compatibility.html +10 -9
  63. package/docs/.vitepress/dist/mixins/build-scrollbar.html +12 -7
  64. package/docs/.vitepress/dist/mixins/create-colors.html +210 -7
  65. package/docs/.vitepress/dist/mixins/create-helper-margin.html +23 -23
  66. package/docs/.vitepress/dist/mixins/create-helper-padding.html +39 -34
  67. package/docs/.vitepress/dist/mixins/create-instruction.html +24 -10
  68. package/docs/.vitepress/theme/index.js +12 -12
  69. package/docs/colors/bootstrap.md +18 -1
  70. package/docs/colors/brands.md +8 -1
  71. package/docs/colors/customs.md +8 -1
  72. package/docs/functions/colors.md +71 -66
  73. package/docs/functions/helpers.md +15 -1
  74. package/docs/functions/strings.md +13 -1
  75. package/docs/index.md +1 -1
  76. package/docs/logo.svg +55 -55
  77. package/docs/logotype.svg +149 -149
  78. package/docs/mixins/build-aspect-ratio.md +16 -1
  79. package/docs/mixins/build-compatibility.md +24 -23
  80. package/docs/mixins/build-scrollbar.md +21 -19
  81. package/docs/mixins/create-colors.md +16 -1
  82. package/docs/mixins/create-helper-margin.md +21 -25
  83. package/docs/mixins/create-helper-padding.md +21 -24
  84. package/docs/mixins/create-instruction.md +38 -33
  85. package/index.scss +1 -1
  86. package/package.json +67 -61
  87. package/src/colors/_bootstrap.scss +179 -180
  88. package/src/colors/_brands.scss +34 -20
  89. package/src/colors/_customs.scss +53 -53
  90. package/src/colors/_index.scss +200 -200
  91. package/src/functions/_colors.scss +143 -135
  92. package/src/functions/_helpers.scss +51 -44
  93. package/src/functions/_strings.scss +38 -31
  94. package/src/index.scss +14 -14
  95. package/src/mixins/_build-aspect-ratio.scss +37 -37
  96. package/src/mixins/_build-compatibility.scss +40 -39
  97. package/src/mixins/_build-scrollbar.scss +37 -32
  98. package/src/mixins/_create-class.scss +29 -19
  99. package/src/mixins/_create-colors-vars.scss +31 -27
  100. package/src/mixins/_create-colors.scss +202 -155
  101. package/src/mixins/_create-helper-margin.scss +43 -39
  102. package/src/mixins/_create-helper-padding.scss +47 -40
  103. package/test/compile.test.js +197 -132
  104. package/test/lint.test.js +43 -48
  105. package/test/test.css +32 -0
  106. package/test/test.scss +216 -197
  107. package/vite.config.ts +26 -26
  108. package/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.C6BRpH9I.js +0 -1
  109. package/docs/.vitepress/dist/assets/colors_bootstrap.md.CFg-dNGF.js +0 -1
  110. package/docs/.vitepress/dist/assets/colors_bootstrap.md.CFg-dNGF.lean.js +0 -1
  111. package/docs/.vitepress/dist/assets/colors_brands.md.CUxoS0ml.js +0 -1
  112. package/docs/.vitepress/dist/assets/colors_brands.md.CUxoS0ml.lean.js +0 -1
  113. package/docs/.vitepress/dist/assets/colors_customs.md.CnHhl84q.js +0 -1
  114. package/docs/.vitepress/dist/assets/colors_customs.md.CnHhl84q.lean.js +0 -1
  115. package/docs/.vitepress/dist/assets/functions_colors.md.BsOBqU9L.lean.js +0 -1
  116. package/docs/.vitepress/dist/assets/functions_helpers.md.B3A_IOEL.js +0 -1
  117. package/docs/.vitepress/dist/assets/functions_helpers.md.B3A_IOEL.lean.js +0 -1
  118. package/docs/.vitepress/dist/assets/functions_strings.md.BdV8Kx9J.js +0 -1
  119. package/docs/.vitepress/dist/assets/functions_strings.md.BdV8Kx9J.lean.js +0 -1
  120. package/docs/.vitepress/dist/assets/index.md.Cn1TneoC.js +0 -1
  121. package/docs/.vitepress/dist/assets/index.md.Cn1TneoC.lean.js +0 -1
  122. package/docs/.vitepress/dist/assets/mixins_build-aspect-ratio.md.cD70Q1mW.js +0 -1
  123. package/docs/.vitepress/dist/assets/mixins_build-aspect-ratio.md.cD70Q1mW.lean.js +0 -1
  124. package/docs/.vitepress/dist/assets/mixins_create-colors.md.Bi4iqAHf.js +0 -1
  125. package/docs/.vitepress/dist/assets/mixins_create-colors.md.Bi4iqAHf.lean.js +0 -1
  126. package/docs/.vitepress/dist/assets/mixins_create-helper-margin.md.DqwBKQ0G.lean.js +0 -1
  127. package/docs/.vitepress/dist/assets/mixins_create-helper-padding.md.Br9TOGl1.js +0 -45
  128. package/docs/.vitepress/dist/assets/mixins_create-helper-padding.md.Br9TOGl1.lean.js +0 -1
  129. /package/docs/.vitepress/dist/assets/{mixins_build-compatibility.md.DvZg2OSO.lean.js → mixins_build-compatibility.md.CmlXWpxv.lean.js} +0 -0
  130. /package/docs/.vitepress/dist/assets/{mixins_build-scrollbar.md.Bze7PgzU.lean.js → mixins_build-scrollbar.md.hZriM4ET.lean.js} +0 -0
  131. /package/docs/.vitepress/dist/assets/{mixins_create-instruction.md.BeAIoeQx.lean.js → mixins_create-instruction.md.B0iVQyHl.lean.js} +0 -0
@@ -1,135 +1,143 @@
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
135
- }
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(
12
+ rgba($foreground, 1),
13
+ $background,
14
+ color.opacity($foreground) * 100%
15
+ );
16
+ }
17
+
18
+ /**
19
+ * Tint a color
20
+ */
21
+ @function color-tint($color, $weight) {
22
+ // Creates a physical mixture with white color
23
+ @return color.mix(#fff, $color, $weight);
24
+ // Adjusts properties (like lightness) relative to the color's current values.
25
+ // @return color.scale($color, $lightness: $weight);
26
+ }
27
+
28
+ /**
29
+ * Shade a color
30
+ */
31
+ @function color-shade($color, $weight) {
32
+ @return color.mix(#000, $color, $weight);
33
+ // @return color.scale($color, $lightness: -$weight);
34
+ }
35
+
36
+ /**
37
+ * Shade the color if the weight is positive, else tint it
38
+ * function credited to https://getbootstrap.com/
39
+ */
40
+ @function color-shift($color, $weight) {
41
+ @if $weight > 0 {
42
+ @return color-shade($color, $weight);
43
+ }
44
+ @return color-tint($color, -$weight);
45
+ }
46
+
47
+ /**
48
+ * Return WCAG2.1 relative luminance
49
+ * See https://www.w3.org/TR/WCAG/#dfn-relative-luminance
50
+ * See https://en.wikipedia.org/wiki/Relative_luminance
51
+ * Gives %, less than 50 darker is better, less than 50, lighter.
52
+ * Function like color.channel($color, "lightness", $space: hsl) gives a different %
53
+ */
54
+ @function color-luminance($color) {
55
+ // fallback
56
+ @if $color == transparent or meta.type-of($color) != color {
57
+ @return 100;
58
+ }
59
+ @return math.div(
60
+ (
61
+ (color.channel($color, "red", $space: rgb) * 0.299) +
62
+ (color.channel($color, "green", $space: rgb) * 0.587) +
63
+ (color.channel($color, "blue", $space: rgb) * 0.114)
64
+ ),
65
+ 255
66
+ ) *
67
+ 100%;
68
+ }
69
+
70
+ /**
71
+ * Compares contrast of a given color to the light/dark arguments and returns whichever is most "contrasty"
72
+ */
73
+ @function color-contrast($color: #fff, $dark: #000, $light: #fff) {
74
+ @if meta.type-of($color) != color or $color == transparent {
75
+ @return inherit;
76
+ }
77
+ $color-brightness: color-luminance($color);
78
+ $light-text-brightness: color-luminance($light);
79
+ $dark-text-brightness: color-luminance($dark);
80
+
81
+ @if math.abs($color-brightness - $light-text-brightness) >
82
+ math.abs($color-brightness - $dark-text-brightness)
83
+ {
84
+ @return $light;
85
+ }
86
+ @return $dark;
87
+ }
88
+
89
+ /**
90
+ * NEW numeric annotation
91
+ * Hex to RGB (only numbers, transparentize would add rgba(*))
92
+ * $color
93
+ * $alpha:
94
+ * - 0: never 4° digit
95
+ * - 1: always 4° digit
96
+ * - 2: 4° digit only when needed
97
+ * $classic: false = new number annotation
98
+ */
99
+ @function extract-colors($color: #fff, $mode: 2, $classic: false) {
100
+ // colors only
101
+ @if $color == transparent or meta.type-of($color) != color {
102
+ @return $color;
103
+ }
104
+ // new annotation
105
+ $delimiter: " ";
106
+ $delimiter-alpha: " / ";
107
+ // old annotation
108
+ @if $classic {
109
+ $delimiter: ", ";
110
+ $delimiter-alpha: ", ";
111
+ }
112
+ $alpha: color.alpha($color);
113
+ @if $mode == 1 or ($mode == 2 and $alpha == 1) {
114
+ @return color.channel($color, "red", $space: rgb) + $delimiter +
115
+ color.channel($color, "green", $space: rgb) + $delimiter +
116
+ color.channel($color, "blue", $space: rgb);
117
+ }
118
+ // Regular RGBA compliant result ("number" notation)
119
+ @return color.channel($color, "red", $space: rgb) + $delimiter +
120
+ color.channel($color, "green", $space: rgb) + $delimiter +
121
+ color.channel($color, "blue", $space: rgb) + $delimiter-alpha +
122
+ color.channel($color, "alpha"); // * 100%
123
+ }
124
+
125
+ /**
126
+ * Create default collection
127
+ * @param $color
128
+ */
129
+ @function create-collection($color: #fff) {
130
+ $list: (
131
+ "100": color-tint($color, 80%),
132
+ "200": color-tint($color, 60%),
133
+ "300": color-tint($color, 40%),
134
+ "400": color-tint($color, 20%),
135
+ "500": $color,
136
+ "600": color-shade($color, 20%),
137
+ "700": color-shade($color, 40%),
138
+ "800": color-shade($color, 60%),
139
+ "900": color-shade($color, 80%),
140
+ );
141
+
142
+ @return $list;
143
+ }
@@ -1,44 +1,51 @@
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
+ @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
+ * This function is to be used to return nested key values within a nested map
29
+ * @parameter {Variable} $map [null] - pass in map to be evaluated
30
+ * @parameter {Variable} $keys [null] - pass in keys to be evaluated
31
+ */
32
+ // $map: (
33
+ // 'size': (
34
+ // 'sml': 10px
35
+ // )
36
+ // );
37
+ // $var: map-deep-get($map, 'size', 'sml'); // => 10px
38
+ @function map-deep-get($map, $keys...) {
39
+ @each $key in $keys {
40
+ $map: map.get($map, $key);
41
+ }
42
+ @return $map;
43
+ }
44
+
45
+ /**
46
+ * Read a color value from a 2-level color map collection
47
+ * Example: color-get($colors-collection, "blue", "500")
48
+ */
49
+ @function color-get($collection, $group, $shade) {
50
+ @return map.get(map.get($collection, $group), $shade);
51
+ }
@@ -1,31 +1,38 @@
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
- }
1
+ @use "sass:list";
2
+ @use "sass:string";
3
+
4
+ /**
5
+ Split string into lists
6
+ */
7
+ @function string-split($string, $separator: "-") {
8
+ // empty array/list
9
+ $split-arr: ();
10
+ // first index of separator in string
11
+ $index: string.index($string, $separator);
12
+ // loop through string
13
+ @while $index != null {
14
+ // get the substring from the first character to the separator
15
+ $item: string.slice($string, 1, $index - 1);
16
+ // push item to array
17
+ $split-arr: list.append($split-arr, $item);
18
+ // remove item and separator from string
19
+ $string: string.slice($string, $index + 1);
20
+ // find new index of separator
21
+ $index: string.index($string, $separator);
22
+ }
23
+ // add the remaining string to list (the last item)
24
+ $split-arr: list.append($split-arr, $string);
25
+
26
+ @return $split-arr;
27
+ }
28
+
29
+ /**
30
+ Check if $string ends with $find
31
+ */
32
+ @function string-ends-with($string, $find) {
33
+ @return (string.length($string) >= string.length($find)) and
34
+ (
35
+ string.slice($string, (string.length($string) - string.length($find) + 1))
36
+ == $find
37
+ );
38
+ }
package/src/index.scss CHANGED
@@ -1,14 +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-colors-vars";
12
- @forward "./mixins/create-class";
13
- @forward "./mixins/create-helper-margin";
14
- @forward "./mixins/create-helper-padding";
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";
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
- }
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
+ }
37
+ }
@@ -1,39 +1,40 @@
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
- }
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
+ @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
36
+ (not (-webkit-touch-callout: none)) {
37
+ @content;
38
+ }
39
+ }
40
+ }