@guebbit/css-toolkit 1.3.2 → 1.4.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.
Files changed (144) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/LICENSE +661 -661
  3. package/README.md +40 -6
  4. package/docs/.postcssrc.cjs +12 -12
  5. package/docs/.vitepress/cache/deps/_metadata.json +52 -0
  6. package/docs/.vitepress/cache/deps/chunk-GD2PZ323.js +9709 -0
  7. package/docs/.vitepress/cache/deps/chunk-GD2PZ323.js.map +7 -0
  8. package/docs/.vitepress/cache/deps/chunk-LW4I4DCF.js +12542 -0
  9. package/docs/.vitepress/cache/deps/chunk-LW4I4DCF.js.map +7 -0
  10. package/docs/.vitepress/cache/deps/package.json +3 -0
  11. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4504 -0
  12. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
  13. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +581 -0
  14. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
  15. package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +1145 -0
  16. package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js.map +7 -0
  17. package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +1665 -0
  18. package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js.map +7 -0
  19. package/docs/.vitepress/cache/deps/vitepress___minisearch.js +1839 -0
  20. package/docs/.vitepress/cache/deps/vitepress___minisearch.js.map +7 -0
  21. package/docs/.vitepress/cache/deps/vue.js +343 -0
  22. package/docs/.vitepress/cache/deps/vue.js.map +7 -0
  23. package/docs/.vitepress/config.ts +97 -89
  24. package/docs/.vitepress/dist/404.html +3 -3
  25. package/docs/.vitepress/dist/assets/{app.CBPosL5d.js → app.jf3Qn9qL.js} +1 -1
  26. package/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.CbTBD5fF.js +1 -0
  27. package/docs/.vitepress/dist/assets/chunks/{VPLocalSearchBox.gSyUO2Y7.js → VPLocalSearchBox.B3CAY0xn.js} +1 -1
  28. package/docs/.vitepress/dist/assets/chunks/{theme.BeEqdqye.js → theme.rWQpqSL8.js} +2 -2
  29. package/docs/.vitepress/dist/assets/colors_bootstrap.md.AyoUVG26.js +188 -0
  30. package/docs/.vitepress/dist/assets/colors_bootstrap.md.AyoUVG26.lean.js +1 -0
  31. package/docs/.vitepress/dist/assets/colors_brands.md.D66byFIK.js +34 -0
  32. package/docs/.vitepress/dist/assets/colors_brands.md.D66byFIK.lean.js +1 -0
  33. package/docs/.vitepress/dist/assets/colors_customs.md.BOrXeoM5.js +53 -0
  34. package/docs/.vitepress/dist/assets/colors_customs.md.BOrXeoM5.lean.js +1 -0
  35. package/docs/.vitepress/dist/assets/functions_breakpoints.md.CELQkNwH.js +63 -0
  36. package/docs/.vitepress/dist/assets/functions_breakpoints.md.CELQkNwH.lean.js +1 -0
  37. package/docs/.vitepress/dist/assets/{functions_colors.md.BsOBqU9L.js → functions_colors.md.-D_m804_.js} +12 -4
  38. package/docs/.vitepress/dist/assets/functions_colors.md.-D_m804_.lean.js +1 -0
  39. package/docs/.vitepress/dist/assets/functions_helpers.md.ByBd49Zv.js +51 -0
  40. package/docs/.vitepress/dist/assets/functions_helpers.md.ByBd49Zv.lean.js +1 -0
  41. package/docs/.vitepress/dist/assets/functions_strings.md.BQe_bdya.js +38 -0
  42. package/docs/.vitepress/dist/assets/functions_strings.md.BQe_bdya.lean.js +1 -0
  43. package/docs/.vitepress/dist/assets/index.md.B50gUndk.js +10 -0
  44. package/docs/.vitepress/dist/assets/index.md.B50gUndk.lean.js +1 -0
  45. package/docs/.vitepress/dist/assets/mixins_build-aspect-ratio.md.ICFUpBeX.js +39 -0
  46. package/docs/.vitepress/dist/assets/mixins_build-aspect-ratio.md.ICFUpBeX.lean.js +1 -0
  47. package/docs/.vitepress/dist/assets/mixins_build-breakpoint.md.DKQMAk7p.js +100 -0
  48. package/docs/.vitepress/dist/assets/mixins_build-breakpoint.md.DKQMAk7p.lean.js +1 -0
  49. package/docs/.vitepress/dist/assets/mixins_build-compatibility.md.s8jk3C-J.js +85 -0
  50. package/docs/.vitepress/dist/assets/{mixins_build-compatibility.md.DvZg2OSO.lean.js → mixins_build-compatibility.md.s8jk3C-J.lean.js} +1 -1
  51. package/docs/.vitepress/dist/assets/{mixins_build-scrollbar.md.Bze7PgzU.js → mixins_build-scrollbar.md.hZriM4ET.js} +7 -2
  52. package/docs/.vitepress/dist/assets/mixins_create-colors.md.D6f2BMAy.js +204 -0
  53. package/docs/.vitepress/dist/assets/mixins_create-colors.md.D6f2BMAy.lean.js +1 -0
  54. package/docs/.vitepress/dist/assets/{mixins_create-helper-margin.md.DqwBKQ0G.js → mixins_create-helper-margin.md.CFz5if3z.js} +18 -18
  55. package/docs/.vitepress/dist/assets/mixins_create-helper-margin.md.CFz5if3z.lean.js +1 -0
  56. package/docs/.vitepress/dist/assets/mixins_create-helper-padding.md.Ct06sNMx.js +50 -0
  57. package/docs/.vitepress/dist/assets/mixins_create-helper-padding.md.Ct06sNMx.lean.js +1 -0
  58. package/docs/.vitepress/dist/assets/{mixins_create-instruction.md.BeAIoeQx.js → mixins_create-instruction.md.B0iVQyHl.js} +18 -4
  59. package/docs/.vitepress/dist/colors/bootstrap.html +194 -7
  60. package/docs/.vitepress/dist/colors/brands.html +40 -7
  61. package/docs/.vitepress/dist/colors/customs.html +59 -7
  62. package/docs/.vitepress/dist/functions/breakpoints.html +87 -0
  63. package/docs/.vitepress/dist/functions/colors.html +16 -8
  64. package/docs/.vitepress/dist/functions/helpers.html +57 -7
  65. package/docs/.vitepress/dist/functions/strings.html +44 -7
  66. package/docs/.vitepress/dist/hashmap.json +1 -1
  67. package/docs/.vitepress/dist/index.html +15 -6
  68. package/docs/.vitepress/dist/mixins/build-aspect-ratio.html +45 -7
  69. package/docs/.vitepress/dist/mixins/build-breakpoint.html +124 -0
  70. package/docs/.vitepress/dist/mixins/build-compatibility.html +59 -15
  71. package/docs/.vitepress/dist/mixins/build-scrollbar.html +13 -8
  72. package/docs/.vitepress/dist/mixins/create-colors.html +210 -7
  73. package/docs/.vitepress/dist/mixins/create-helper-margin.html +23 -23
  74. package/docs/.vitepress/dist/mixins/create-helper-padding.html +39 -34
  75. package/docs/.vitepress/dist/mixins/create-instruction.html +24 -10
  76. package/docs/.vitepress/theme/index.js +12 -12
  77. package/docs/colors/bootstrap.md +29 -1
  78. package/docs/colors/brands.md +8 -1
  79. package/docs/colors/customs.md +8 -1
  80. package/docs/functions/breakpoints.md +25 -0
  81. package/docs/functions/colors.md +71 -66
  82. package/docs/functions/helpers.md +15 -1
  83. package/docs/functions/strings.md +13 -1
  84. package/docs/index.md +1 -1
  85. package/docs/logo.svg +55 -55
  86. package/docs/logotype.svg +149 -149
  87. package/docs/mixins/build-aspect-ratio.md +16 -1
  88. package/docs/mixins/build-breakpoint.md +24 -0
  89. package/docs/mixins/build-compatibility.md +24 -23
  90. package/docs/mixins/build-scrollbar.md +21 -19
  91. package/docs/mixins/create-colors.md +16 -1
  92. package/docs/mixins/create-helper-margin.md +21 -25
  93. package/docs/mixins/create-helper-padding.md +21 -24
  94. package/docs/mixins/create-instruction.md +38 -33
  95. package/index.scss +1 -1
  96. package/package.json +72 -61
  97. package/src/colors/_bootstrap.scss +179 -180
  98. package/src/colors/_brands.scss +34 -20
  99. package/src/colors/_customs.scss +53 -53
  100. package/src/colors/_index.scss +212 -200
  101. package/src/functions/_breakpoints.scss +52 -0
  102. package/src/functions/_colors.scss +143 -135
  103. package/src/functions/_helpers.scss +51 -44
  104. package/src/functions/_strings.scss +38 -31
  105. package/src/index.scss +16 -14
  106. package/src/mixins/_build-aspect-ratio.scss +37 -37
  107. package/src/mixins/_build-breakpoint.scss +90 -0
  108. package/src/mixins/_build-compatibility.scss +83 -39
  109. package/src/mixins/_build-scrollbar.scss +37 -32
  110. package/src/mixins/_create-class.scss +29 -19
  111. package/src/mixins/_create-colors-vars.scss +31 -27
  112. package/src/mixins/_create-colors.scss +202 -155
  113. package/src/mixins/_create-helper-margin.scss +43 -39
  114. package/src/mixins/_create-helper-padding.scss +47 -40
  115. package/test/compile.test.js +211 -132
  116. package/test/lint.test.js +43 -48
  117. package/test/test.css +32 -0
  118. package/test/test.scss +239 -197
  119. package/vite.config.ts +26 -26
  120. package/CHANGELOG +0 -0
  121. package/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.C6BRpH9I.js +0 -1
  122. package/docs/.vitepress/dist/assets/colors_bootstrap.md.CFg-dNGF.js +0 -1
  123. package/docs/.vitepress/dist/assets/colors_bootstrap.md.CFg-dNGF.lean.js +0 -1
  124. package/docs/.vitepress/dist/assets/colors_brands.md.CUxoS0ml.js +0 -1
  125. package/docs/.vitepress/dist/assets/colors_brands.md.CUxoS0ml.lean.js +0 -1
  126. package/docs/.vitepress/dist/assets/colors_customs.md.CnHhl84q.js +0 -1
  127. package/docs/.vitepress/dist/assets/colors_customs.md.CnHhl84q.lean.js +0 -1
  128. package/docs/.vitepress/dist/assets/functions_colors.md.BsOBqU9L.lean.js +0 -1
  129. package/docs/.vitepress/dist/assets/functions_helpers.md.B3A_IOEL.js +0 -1
  130. package/docs/.vitepress/dist/assets/functions_helpers.md.B3A_IOEL.lean.js +0 -1
  131. package/docs/.vitepress/dist/assets/functions_strings.md.BdV8Kx9J.js +0 -1
  132. package/docs/.vitepress/dist/assets/functions_strings.md.BdV8Kx9J.lean.js +0 -1
  133. package/docs/.vitepress/dist/assets/index.md.Cn1TneoC.js +0 -1
  134. package/docs/.vitepress/dist/assets/index.md.Cn1TneoC.lean.js +0 -1
  135. package/docs/.vitepress/dist/assets/mixins_build-aspect-ratio.md.cD70Q1mW.js +0 -1
  136. package/docs/.vitepress/dist/assets/mixins_build-aspect-ratio.md.cD70Q1mW.lean.js +0 -1
  137. package/docs/.vitepress/dist/assets/mixins_build-compatibility.md.DvZg2OSO.js +0 -41
  138. package/docs/.vitepress/dist/assets/mixins_create-colors.md.Bi4iqAHf.js +0 -1
  139. package/docs/.vitepress/dist/assets/mixins_create-colors.md.Bi4iqAHf.lean.js +0 -1
  140. package/docs/.vitepress/dist/assets/mixins_create-helper-margin.md.DqwBKQ0G.lean.js +0 -1
  141. package/docs/.vitepress/dist/assets/mixins_create-helper-padding.md.Br9TOGl1.js +0 -45
  142. package/docs/.vitepress/dist/assets/mixins_create-helper-padding.md.Br9TOGl1.lean.js +0 -1
  143. /package/docs/.vitepress/dist/assets/{mixins_build-scrollbar.md.Bze7PgzU.lean.js → mixins_build-scrollbar.md.hZriM4ET.lean.js} +0 -0
  144. /package/docs/.vitepress/dist/assets/{mixins_create-instruction.md.BeAIoeQx.lean.js → mixins_create-instruction.md.B0iVQyHl.lean.js} +0 -0
@@ -1,39 +1,83 @@
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
+ // normalize aliases
8
+ $target: $browser;
9
+ @if $browser == "internet-explorer" or $browser == "msie" {
10
+ $target: "ie";
11
+ }
12
+ @if $browser == "ms-edge" {
13
+ $target: "edge";
14
+ }
15
+ @if $browser == "ff" {
16
+ $target: "firefox";
17
+ }
18
+
19
+ // MODERN BROWSER GROUP (supports feature queries)
20
+ @if $target == "modern" {
21
+ @supports (display: grid) and (selector(:is(*))) {
22
+ @content;
23
+ }
24
+ }
25
+
26
+ // WEBKIT GROUP
27
+ @if $target == "webkit" {
28
+ @supports (-webkit-touch-callout: none) {
29
+ @content;
30
+ }
31
+ }
32
+
33
+ // LEGACY GROUP
34
+ @if $target == "legacy" {
35
+ @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
36
+ @content;
37
+ }
38
+ @supports (-ms-ime-align: auto) {
39
+ @content;
40
+ }
41
+ }
42
+
43
+ // INTERNET EXPLORER
44
+ @if $target == "ie" {
45
+ @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
46
+ @content;
47
+ }
48
+ }
49
+ // MICROSOFT EDGE
50
+ @if $target == "edge" {
51
+ @supports (-ms-ime-align: auto) {
52
+ @content;
53
+ }
54
+ }
55
+ // FIREFOX
56
+ @if $target == "firefox" {
57
+ @supports (-moz-appearance: none) {
58
+ @content;
59
+ }
60
+ }
61
+
62
+ // OPERA
63
+ @if $target == "opera" {
64
+ @supports (-o-object-fit: fill) {
65
+ @content;
66
+ }
67
+ }
68
+
69
+ // SAFARI
70
+ @if $target == "safari" {
71
+ @supports (background: -webkit-named-image(i)) and
72
+ (not (-webkit-touch-callout: none)) {
73
+ @content;
74
+ }
75
+ }
76
+
77
+ // CHROME (best-effort via webkit + not safari condition)
78
+ @if $target == "chrome" {
79
+ @supports (-webkit-appearance: none) and (font: -apple-system-body) {
80
+ @content;
81
+ }
82
+ }
83
+ }
@@ -1,32 +1,37 @@
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
- }
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(
8
+ $size: "4px",
9
+ $color: "#fff",
10
+ $bg: "auto",
11
+ $radius: "10px"
12
+ ) {
13
+ $fallback-color: #fff;
14
+ $fallback-bg: transparent;
15
+
16
+ @if $bg == "auto" {
17
+ $bg: $fallback-bg;
18
+ }
19
+
20
+ &::-webkit-scrollbar {
21
+ width: $size;
22
+ height: $size;
23
+ background-color: $fallback-bg;
24
+ background-color: $bg;
25
+ }
26
+
27
+ &::-webkit-scrollbar-thumb {
28
+ border-radius: $radius;
29
+ background-color: $fallback-color;
30
+ background-color: $color;
31
+ }
32
+
33
+ &::-webkit-scrollbar-corner {
34
+ background-color: $fallback-bg;
35
+ background-color: $bg;
36
+ }
37
+ }
@@ -1,19 +1,29 @@
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
- }
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(
8
+ $instruction,
9
+ $measure-list: (),
10
+ $important: false,
11
+ $prefix: "",
12
+ $delimiter: "-"
13
+ ) {
14
+ $important-suffix: "";
15
+ @if $important == true {
16
+ $important-suffix: " !important";
17
+ }
18
+ @each $values in $measure-list {
19
+ $name: $values;
20
+ $val: $values;
21
+ @if list.length($values) > 1 {
22
+ $name: list.nth($values, 1);
23
+ $val: list.nth($values, 2);
24
+ }
25
+ .#{$prefix}#{$instruction}#{$delimiter}#{$name} {
26
+ #{$instruction}: #{$val}#{$important-suffix};
27
+ }
28
+ }
29
+ }
@@ -1,27 +1,31 @@
1
- @use "sass:list";
2
- @use "../functions/colors" as color-functions;
3
-
4
- /**
5
- * Create the CSS VARS (like on root)
6
- * WARNING: They will be translated in "RGB" instead of "HEX"
7
- *
8
- * @param $color-list - list of colors (like $colors-collection: ("branch": ( "leaf: $color" )))
9
- * @param $prefix
10
- */
11
- @mixin create-colors-vars($color-list: (), $prefix: "") {
12
- // for every branch
13
- @each $branch-name, $branch in $color-list {
14
- // for every color
15
- @each $color-name, $color-value in $branch {
16
- // @if meta.type-of($scolor) == color {
17
- --#{$prefix}#{$branch-name}-#{$color-name}: #{color-functions.extract-colors($color-value)};
18
- // _}
19
- }
20
-
21
- @each $color-name, $color-value in $branch {
22
- // @if meta.type-of($scolor) == color {
23
- --#{$prefix}on-#{$branch-name}-#{$color-name}: #{color-functions.extract-colors(color-functions.color-contrast($color-value))};
24
- // _}
25
- }
26
- }
27
- }
1
+ @use "sass:list";
2
+ @use "../functions/colors" as color-functions;
3
+
4
+ /**
5
+ * Create the CSS VARS (like on root)
6
+ * WARNING: They will be translated in "RGB" instead of "HEX"
7
+ *
8
+ * @param $color-list - list of colors (like $colors-collection: ("branch": ( "leaf: $color" )))
9
+ * @param $prefix
10
+ */
11
+ @mixin create-colors-vars($color-list: (), $prefix: "") {
12
+ // for every branch
13
+ @each $branch-name, $branch in $color-list {
14
+ // for every color
15
+ @each $color-name, $color-value in $branch {
16
+ // @if meta.type-of($scolor) == color {
17
+ --#{$prefix}#{$branch-name}-#{$color-name}: #{color-functions.extract-colors(
18
+ $color-value
19
+ )};
20
+ // _}
21
+ }
22
+
23
+ @each $color-name, $color-value in $branch {
24
+ // @if meta.type-of($scolor) == color {
25
+ --#{$prefix}on-#{$branch-name}-#{$color-name}: #{color-functions.extract-colors(
26
+ color-functions.color-contrast($color-value)
27
+ )};
28
+ // _}
29
+ }
30
+ }
31
+ }
@@ -1,155 +1,202 @@
1
- @use "sass:list";
2
- @use "sass:string";
3
- @use "../functions/colors" as color-functions;
4
-
5
- /**
6
- * Create all the needed classes for the requested colors
7
- * WARNING: $gradient-* are not meant to be used in color and border classes (because they have gradients)
8
- *
9
- * @param $color-list - list of colors (like $colors-collection: ("branch": ( "leaf: $color" )))
10
- * @param $vars: if true, use css vars instead of rgb
11
- * @param $prefix: prefix that applies to classes
12
- * @param $prefixV: prefix that applies to vars (if true)
13
- * @param $feature-list: - when filled: becomes a whitelist. May become cumbersome and many are not needed. Use with care.
14
- * - text
15
- * - background
16
- * - border
17
- * - pseudo (bg only, text very rarely used)
18
- * - hover
19
- */
20
- @mixin create-colors($color-list: (), $vars: false, $prefix: "", $prefixV: "", $feature-list: ()) {
21
- // for every branch
22
- @each $branch-name, $branch in $color-list {
23
- // for every leaf
24
- @each $color-name, $color-value in $branch {
25
-
26
- @if not list.index($branch-name, "gradient") and (list.length($feature-list) < 1 or list.index($feature-list, "text")) {
27
- .#{$prefix}#{$branch-name}-#{$color-name}-text {
28
- @if $vars {
29
- color: var(--#{$prefixV}#{$branch-name}-#{$color-name}) !important;
30
- } @else {
31
- color: $color-value !important;
32
- }
33
- }
34
- }
35
-
36
- @if not list.index($branch-name, "gradient") and (list.length($feature-list) < 1 or list.index($feature-list, "border")) {
37
- @if $vars {
38
- .#{$prefix}#{$branch-name}-#{$color-name}-border {
39
- border-color: var(--#{$prefixV}#{$branch-name}-#{$color-name}) !important;
40
- }
41
- } @else {
42
- .#{$prefix}#{$branch-name}-#{$color-name}-border {
43
- border-color: $color-value !important;
44
- }
45
- }
46
- }
47
-
48
- @if list.length($feature-list) < 1 or list.index($feature-list, "background") {
49
- @if $vars {
50
- .#{$prefix}#{$branch-name}-#{$color-name}-bg {
51
- background-color: var(--#{$prefixV}#{$branch-name}-#{$color-name}) !important;
52
- color: var(--#{$prefixV}on-#{$branch-name}-#{$color-name}) !important;
53
- }
54
- } @else {
55
- .#{$prefix}#{$branch-name}-#{$color-name}-bg {
56
- background-color: $color-value !important;
57
- }
58
- }
59
- }
60
-
61
- @if list.length($feature-list) < 1 or list.index($feature-list, "pseudo") {
62
- @if $vars {
63
- .#{$prefix}#{$branch-name}-#{$color-name}-pseudo-bg {
64
- &::after,
65
- &::before {
66
- background-color: var(--#{$prefixV}#{$branch-name}-#{$color-name}) !important;
67
- }
68
- }
69
- } @else {
70
- .#{$prefix}#{$branch-name}-#{$color-name}-pseudo-bg {
71
- &::after,
72
- &::before {
73
- background-color: $color-value !important;
74
- }
75
- }
76
- }
77
- }
78
-
79
- @if list.length($feature-list) < 1 or list.index($feature-list, "hover") {
80
-
81
- @if not list.index($branch-name, "gradient") and (list.length($feature-list) < 1 or list.index($feature-list, "text")) {
82
- @if $vars {
83
- .#{$prefix}#{$branch-name}-#{$color-name}-hover-text {
84
- &:hover {
85
- color: var(--#{$prefixV}#{$branch-name}-#{$color-name}) !important;
86
- }
87
- }
88
- } @else {
89
- .#{$prefix}#{$branch-name}-#{$color-name}-hover-text {
90
- &:hover {
91
- color: $color-value !important;
92
- }
93
- }
94
- }
95
- }
96
-
97
- @if not list.index($branch-name, "gradient") and (list.length($feature-list) < 1 or list.index($feature-list, "border")) {
98
- @if $vars {
99
- .#{$prefix}#{$branch-name}-#{$color-name}-hover-border {
100
- &:hover {
101
- border-color: var(--#{$prefixV}#{$branch-name}-#{$color-name}) !important;
102
- }
103
- }
104
- } @else {
105
- .#{$prefix}#{$branch-name}-#{$color-name}-hover-border {
106
- &:hover {
107
- border-color: $color-value !important;
108
- }
109
- }
110
- }
111
- }
112
-
113
- @if list.length($feature-list) < 1 or list.index($feature-list, "background") {
114
- @if $vars {
115
- .#{$prefix}#{$branch-name}-#{$color-name}-hover-bg {
116
- &:hover {
117
- background-color: var(--#{$prefixV}#{$branch-name}-#{$color-name}) !important;
118
- color: var(--#{$prefixV}on-#{$branch-name}-#{$color-name}) !important;
119
- }
120
- }
121
- } @else {
122
- .#{$prefix}#{$branch-name}-#{$color-name}-hover-bg {
123
- &:hover {
124
- background-color: $color-value !important;
125
- }
126
- }
127
- }
128
- }
129
-
130
- @if list.length($feature-list) < 1 or list.index($feature-list, "pseudo") {
131
- @if $vars {
132
- .#{$prefix}#{$branch-name}-#{$color-name}-hover-pseudo-bg {
133
- &:hover {
134
- &::after,
135
- &::before {
136
- background-color: var(--#{$prefixV}#{$branch-name}-#{$color-name}) !important;
137
- }
138
- }
139
- }
140
- } @else {
141
- .#{$prefix}#{$branch-name}-#{$color-name}-hover-pseudo-bg {
142
- &:hover {
143
- &::after,
144
- &::before {
145
- background-color: $color-value !important;
146
- }
147
- }
148
- }
149
- }
150
- }
151
- }
152
- }
153
- }
154
- }
155
-
1
+ @use "sass:list";
2
+ @use "sass:string";
3
+ @use "../functions/colors" as color-functions;
4
+
5
+ /**
6
+ * Create all the needed classes for the requested colors
7
+ * WARNING: $gradient-* are not meant to be used in color and border classes (because they have gradients)
8
+ *
9
+ * @param $color-list - list of colors (like $colors-collection: ("branch": ( "leaf: $color" )))
10
+ * @param $vars: if true, use css vars instead of rgb
11
+ * @param $prefix: prefix that applies to classes
12
+ * @param $prefixV: prefix that applies to vars (if true)
13
+ * @param $feature-list: - when filled: becomes a whitelist. May become cumbersome and many are not needed. Use with care.
14
+ * - text
15
+ * - background
16
+ * - border
17
+ * - pseudo (bg only, text very rarely used)
18
+ * - hover
19
+ */
20
+ @mixin create-colors(
21
+ $color-list: (),
22
+ $vars: false,
23
+ $prefix: "",
24
+ $prefixV: "",
25
+ $feature-list: ()
26
+ ) {
27
+ // for every branch
28
+ @each $branch-name, $branch in $color-list {
29
+ // for every leaf
30
+ @each $color-name, $color-value in $branch {
31
+ @if not
32
+ list.index($branch-name, "gradient") and
33
+ (list.length($feature-list) < 1 or list.index($feature-list, "text"))
34
+ {
35
+ .#{$prefix}#{$branch-name}-#{$color-name}-text {
36
+ @if $vars {
37
+ color: var(--#{$prefixV}#{$branch-name}-#{$color-name}) !important;
38
+ } @else {
39
+ color: $color-value !important;
40
+ }
41
+ }
42
+ }
43
+
44
+ @if not
45
+ list.index($branch-name, "gradient") and
46
+ (list.length($feature-list) < 1 or list.index($feature-list, "border"))
47
+ {
48
+ @if $vars {
49
+ .#{$prefix}#{$branch-name}-#{$color-name}-border {
50
+ border-color: var(
51
+ --#{$prefixV}#{$branch-name}-#{$color-name}
52
+ ) !important;
53
+ }
54
+ } @else {
55
+ .#{$prefix}#{$branch-name}-#{$color-name}-border {
56
+ border-color: $color-value !important;
57
+ }
58
+ }
59
+ }
60
+
61
+ @if list.length($feature-list) <
62
+ 1 or
63
+ list.index($feature-list, "background")
64
+ {
65
+ @if $vars {
66
+ .#{$prefix}#{$branch-name}-#{$color-name}-bg {
67
+ background-color: var(
68
+ --#{$prefixV}#{$branch-name}-#{$color-name}
69
+ ) !important;
70
+ color: var(
71
+ --#{$prefixV}on-#{$branch-name}-#{$color-name}
72
+ ) !important;
73
+ }
74
+ } @else {
75
+ .#{$prefix}#{$branch-name}-#{$color-name}-bg {
76
+ background-color: $color-value !important;
77
+ }
78
+ }
79
+ }
80
+
81
+ @if list.length($feature-list) < 1 or list.index($feature-list, "pseudo")
82
+ {
83
+ @if $vars {
84
+ .#{$prefix}#{$branch-name}-#{$color-name}-pseudo-bg {
85
+ &::after,
86
+ &::before {
87
+ background-color: var(
88
+ --#{$prefixV}#{$branch-name}-#{$color-name}
89
+ ) !important;
90
+ }
91
+ }
92
+ } @else {
93
+ .#{$prefix}#{$branch-name}-#{$color-name}-pseudo-bg {
94
+ &::after,
95
+ &::before {
96
+ background-color: $color-value !important;
97
+ }
98
+ }
99
+ }
100
+ }
101
+
102
+ @if list.length($feature-list) < 1 or list.index($feature-list, "hover") {
103
+ @if not
104
+ list.index($branch-name, "gradient") and
105
+ (list.length($feature-list) < 1 or list.index($feature-list, "text"))
106
+ {
107
+ @if $vars {
108
+ .#{$prefix}#{$branch-name}-#{$color-name}-hover-text {
109
+ &:hover {
110
+ color: var(
111
+ --#{$prefixV}#{$branch-name}-#{$color-name}
112
+ ) !important;
113
+ }
114
+ }
115
+ } @else {
116
+ .#{$prefix}#{$branch-name}-#{$color-name}-hover-text {
117
+ &:hover {
118
+ color: $color-value !important;
119
+ }
120
+ }
121
+ }
122
+ }
123
+
124
+ @if not
125
+ list.index($branch-name, "gradient") and
126
+ (
127
+ list.length($feature-list) <
128
+ 1 or
129
+ list.index($feature-list, "border")
130
+ )
131
+ {
132
+ @if $vars {
133
+ .#{$prefix}#{$branch-name}-#{$color-name}-hover-border {
134
+ &:hover {
135
+ border-color: var(
136
+ --#{$prefixV}#{$branch-name}-#{$color-name}
137
+ ) !important;
138
+ }
139
+ }
140
+ } @else {
141
+ .#{$prefix}#{$branch-name}-#{$color-name}-hover-border {
142
+ &:hover {
143
+ border-color: $color-value !important;
144
+ }
145
+ }
146
+ }
147
+ }
148
+
149
+ @if list.length($feature-list) <
150
+ 1 or
151
+ list.index($feature-list, "background")
152
+ {
153
+ @if $vars {
154
+ .#{$prefix}#{$branch-name}-#{$color-name}-hover-bg {
155
+ &:hover {
156
+ background-color: var(
157
+ --#{$prefixV}#{$branch-name}-#{$color-name}
158
+ ) !important;
159
+ color: var(
160
+ --#{$prefixV}on-#{$branch-name}-#{$color-name}
161
+ ) !important;
162
+ }
163
+ }
164
+ } @else {
165
+ .#{$prefix}#{$branch-name}-#{$color-name}-hover-bg {
166
+ &:hover {
167
+ background-color: $color-value !important;
168
+ }
169
+ }
170
+ }
171
+ }
172
+
173
+ @if list.length($feature-list) <
174
+ 1 or
175
+ list.index($feature-list, "pseudo")
176
+ {
177
+ @if $vars {
178
+ .#{$prefix}#{$branch-name}-#{$color-name}-hover-pseudo-bg {
179
+ &:hover {
180
+ &::after,
181
+ &::before {
182
+ background-color: var(
183
+ --#{$prefixV}#{$branch-name}-#{$color-name}
184
+ ) !important;
185
+ }
186
+ }
187
+ }
188
+ } @else {
189
+ .#{$prefix}#{$branch-name}-#{$color-name}-hover-pseudo-bg {
190
+ &:hover {
191
+ &::after,
192
+ &::before {
193
+ background-color: $color-value !important;
194
+ }
195
+ }
196
+ }
197
+ }
198
+ }
199
+ }
200
+ }
201
+ }
202
+ }