@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,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
+ }
@@ -1,39 +1,43 @@
1
- /**
2
- *
3
- * t - applies the spacing for margin-top
4
- * b - applies the spacing for margin-bottom
5
- * l - applies the spacing for margin-left
6
- * r - applies the spacing for margin-right
7
- * x - applies the spacing for both *-left and *-right
8
- * y - applies the spacing for both *-top and *-bottom
9
- * a - applies the spacing for the property in all directions
10
- *
11
- * @param {Array<name,value>[]} measure-list - postfix name and value
12
- */
13
- @mixin create-helper-margin($measure-list: (), $important: false, $prefix: "") {
14
- @each $name, $val in $measure-list {
15
- .#{$prefix}mt-#{$name} {
16
- margin-top: #{$val} #{if($important == true, "!important", "")};
17
- }
18
- .#{$prefix}mb-#{$name} {
19
- margin-bottom: #{$val} #{if($important == true, "!important", "")};
20
- }
21
- .#{$prefix}ml-#{$name} {
22
- margin-left: #{$val} #{if($important == true, "!important", "")};
23
- }
24
- .#{$prefix}mr-#{$name} {
25
- margin-right: #{$val} #{if($important == true, "!important", "")};
26
- }
27
- .#{$prefix}mx-#{$name} {
28
- margin-right: #{$val} #{if($important == true, "!important", "")};
29
- margin-left: #{$val} #{if($important == true, "!important", "")};
30
- }
31
- .#{$prefix}my-#{$name} {
32
- margin-top: #{$val} #{if($important == true, "!important", "")};
33
- margin-bottom: #{$val} #{if($important == true, "!important", "")};
34
- }
35
- .#{$prefix}ma-#{$name} {
36
- margin: #{$val} #{if($important == true, "!important", "")};
37
- }
38
- }
39
- }
1
+ /**
2
+ *
3
+ * t - applies the spacing for margin-top
4
+ * b - applies the spacing for margin-bottom
5
+ * l - applies the spacing for margin-left
6
+ * r - applies the spacing for margin-right
7
+ * x - applies the spacing for both *-left and *-right
8
+ * y - applies the spacing for both *-top and *-bottom
9
+ * a - applies the spacing for the property in all directions
10
+ *
11
+ * @param {Array<name,value>[]} measure-list - postfix name and value
12
+ */
13
+ @mixin create-helper-margin($measure-list: (), $important: false, $prefix: "") {
14
+ $important-suffix: "";
15
+ @if $important == true {
16
+ $important-suffix: " !important";
17
+ }
18
+ @each $name, $val in $measure-list {
19
+ .#{$prefix}mt-#{$name} {
20
+ margin-top: #{$val}#{$important-suffix};
21
+ }
22
+ .#{$prefix}mb-#{$name} {
23
+ margin-bottom: #{$val}#{$important-suffix};
24
+ }
25
+ .#{$prefix}ml-#{$name} {
26
+ margin-left: #{$val}#{$important-suffix};
27
+ }
28
+ .#{$prefix}mr-#{$name} {
29
+ margin-right: #{$val}#{$important-suffix};
30
+ }
31
+ .#{$prefix}mx-#{$name} {
32
+ margin-right: #{$val}#{$important-suffix};
33
+ margin-left: #{$val}#{$important-suffix};
34
+ }
35
+ .#{$prefix}my-#{$name} {
36
+ margin-top: #{$val}#{$important-suffix};
37
+ margin-bottom: #{$val}#{$important-suffix};
38
+ }
39
+ .#{$prefix}ma-#{$name} {
40
+ margin: #{$val}#{$important-suffix};
41
+ }
42
+ }
43
+ }