@guebbit/css-toolkit 1.2.0 → 1.2.2

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 (54) hide show
  1. package/LICENSE +661 -661
  2. package/README.md +5 -5
  3. package/docs/.postcssrc.cjs +11 -11
  4. package/docs/.vitepress/config.ts +88 -88
  5. package/docs/.vitepress/dist/404.html +1 -1
  6. package/docs/.vitepress/dist/assets/{app.Cez_7bx7.js → app.BQiPqeST.js} +1 -1
  7. package/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.C9A3MdGo.js +1 -0
  8. package/docs/.vitepress/dist/assets/chunks/{VPLocalSearchBox.lfLgIsvm.js → VPLocalSearchBox.Bz_zRP0g.js} +1 -1
  9. package/docs/.vitepress/dist/assets/chunks/{theme.ZIndENJH.js → theme.DOuq-6g9.js} +2 -2
  10. package/docs/.vitepress/dist/colors/bootstrap.html +2 -2
  11. package/docs/.vitepress/dist/colors/brands.html +2 -2
  12. package/docs/.vitepress/dist/colors/customs.html +2 -2
  13. package/docs/.vitepress/dist/functions/colors.html +2 -2
  14. package/docs/.vitepress/dist/functions/helpers.html +2 -2
  15. package/docs/.vitepress/dist/functions/strings.html +2 -2
  16. package/docs/.vitepress/dist/index.html +2 -2
  17. package/docs/.vitepress/dist/mixins/build-aspect-ratio.html +2 -2
  18. package/docs/.vitepress/dist/mixins/build-compatibility.html +2 -2
  19. package/docs/.vitepress/dist/mixins/build-scrollbar.html +2 -2
  20. package/docs/.vitepress/dist/mixins/create-colors.html +2 -2
  21. package/docs/.vitepress/dist/mixins/create-helper-margin.html +2 -2
  22. package/docs/.vitepress/dist/mixins/create-helper-padding.html +2 -2
  23. package/docs/.vitepress/dist/mixins/create-instruction.html +2 -2
  24. package/docs/.vitepress/theme/index.js +11 -11
  25. package/docs/functions/colors.md +65 -65
  26. package/docs/logo.svg +55 -55
  27. package/docs/logotype.svg +149 -149
  28. package/docs/mixins/build-compatibility.md +22 -22
  29. package/docs/mixins/build-scrollbar.md +18 -18
  30. package/docs/mixins/create-helper-margin.md +25 -25
  31. package/docs/mixins/create-helper-padding.md +24 -24
  32. package/docs/mixins/create-instruction.md +32 -32
  33. package/package.json +61 -61
  34. package/src/colors/_bootstrap.scss +179 -179
  35. package/src/colors/_brands.scss +19 -19
  36. package/src/colors/_customs.scss +52 -52
  37. package/src/colors/_index.scss +199 -199
  38. package/src/functions/_colors.scss +133 -121
  39. package/src/functions/_helpers.scss +44 -42
  40. package/src/functions/_strings.scss +30 -30
  41. package/src/index.scss +12 -12
  42. package/src/mixins/_build-aspect-ratio.scss +36 -36
  43. package/src/mixins/_build-compatibility.scss +27 -27
  44. package/src/mixins/_build-scrollbar.scss +31 -31
  45. package/src/mixins/_create-colors.scss +118 -118
  46. package/src/mixins/_create-helper-margin.scss +38 -38
  47. package/src/mixins/_create-helper-padding.scss +40 -40
  48. package/src/mixins/_create-instructions.scss +11 -11
  49. package/test/compile.test.js +105 -105
  50. package/test/lint.test.js +48 -48
  51. package/test/test.css +104 -99
  52. package/test/test.scss +158 -158
  53. package/vite.config.ts +25 -25
  54. package/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.CkfJPSmi.js +0 -1
@@ -1,42 +1,44 @@
1
- /**
2
- * Giving a list of variables and values,
3
- * from start to end, try all the values until a non-null is found
4
- */
5
- @function no-null-var($list: ()){
6
- @each $value in $list {
7
- // stylelint-disable-next-line scss/at-if-no-null
8
- @if $value != null and $value != undefined {
9
- @return $value;
10
- }
11
- }
12
- @return null;
13
- }
14
-
15
- /**
16
- * If the color is the checked one, return inherit
17
- */
18
- @function no-target-var($check: transparent, $color: transparent){
19
- @if $color == $check {
20
- @return inherit;
21
- }
22
- @return $color;
23
- }
24
-
25
-
26
- /**
27
- * This function is to be used to return nested key values within a nested map
28
- * @parameter {Variable} $map [null] - pass in map to be evaluated
29
- * @parameter {Variable} $keys [null] - pass in keys to be evaluated
30
- */
31
- // $map: (
32
- // 'size': (
33
- // 'sml': 10px
34
- // )
35
- // );
36
- // $var: map-deep-get($map, 'size', 'sml'); // => 10px
37
- @function map-deep-get($map, $keys...) {
38
- @each $key in $keys {
39
- $map: map-get($map, $key);
40
- }
41
- @return $map;
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,13 @@
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-instructions";
12
- @forward "./mixins/create-helper-margin";
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-instructions";
12
+ @forward "./mixins/create-helper-margin";
13
13
  @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,28 @@
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 TODO
27
- // SAFARI TODO
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 TODO
27
+ // SAFARI TODO
28
28
  }
@@ -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
  }
@@ -1,119 +1,119 @@
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
- * $color-list - list of colors (like $colors-collection: ("branch": ( "leaf: $color" )))
8
- * $branch-list: - when filled: becomes a whitelist (aka: include only listed brands)
9
- * $feature-list: - when filled: becomes a whitelist. May become cumbersome and many are not needed. Use with care.
10
- * - root
11
- * - on-root (color's "best contrast" partner color)
12
- * - color
13
- * - background
14
- * - border
15
- * - pseudo (bg only, color very rarely used)
16
- * - hover
17
- * $prefix: prefix that applies to classes
18
- */
19
- @mixin create-colors($color-list: (), $branch-list: (), $feature-list: (), $prefix: "") {
20
- // for every branch
21
- @each $branch-name, $branch in $color-list {
22
- // check that there is no $branch-list or, if present, it's correctly whitelisted
23
- @if list.length($branch-list) < 1 or list.index($branch-list, $branch-name) {
24
-
25
- // for every leaf
26
- @each $sname, $scolor in $branch {
27
-
28
- @if not list.index($branch-name, "advanced"){
29
- @if list.length($feature-list) < 1 or list.index($feature-list, "color") {
30
- .#{$prefix}#{$branch-name}-#{$sname}-text {
31
- color: $scolor !important;
32
- }
33
- }
34
- @if list.length($feature-list) < 1 or list.index($feature-list, "border") {
35
- .#{$prefix}#{$branch-name}-#{$sname}-border {
36
- border-color: $scolor !important;
37
- }
38
- }
39
- }
40
-
41
- @if list.length($feature-list) < 1 or list.index($feature-list, "background") {
42
- .#{$prefix}#{$branch-name}-#{$sname}-bg {
43
- background: $scolor !important;
44
- }
45
- }
46
-
47
- @if list.length($feature-list) < 1 or list.index($feature-list, "pseudo") {
48
- .#{$prefix}#{$branch-name}-#{$sname}-pseudo-bg {
49
- &::after,
50
- &::before {
51
- background: $scolor !important;
52
- }
53
- }
54
- }
55
-
56
- @if list.length($feature-list) < 1 or list.index($feature-list, "hover"){
57
-
58
- @if not list.index($branch-name, "advanced"){
59
- @if list.length($feature-list) < 1 or list.index($feature-list, "color"){
60
- .#{$prefix}#{$branch-name}-#{$sname}-hover-text {
61
- &:hover {
62
- color: $scolor !important;
63
- }
64
- }
65
- }
66
- @if list.length($feature-list) < 1 or list.index($feature-list, "border"){
67
- .#{$prefix}#{$branch-name}-#{$sname}-hover-border {
68
- &:hover {
69
- border-color: $scolor !important;
70
- }
71
- }
72
- }
73
- }
74
-
75
- @if list.length($feature-list) < 1 or list.index($feature-list, "background") {
76
- .#{$prefix}#{$branch-name}-#{$sname}-hover-bg {
77
- &:hover {
78
- background: $scolor !important;
79
- }
80
- }
81
- }
82
-
83
- @if list.length($feature-list) < 1 or list.index($feature-list, "pseudo") {
84
- .#{$prefix}#{$branch-name}-#{$sname}-hover-pseudo-bg {
85
- &:hover{
86
- &::after,
87
- &::before {
88
- background: $scolor !important;
89
- }
90
- }
91
- }
92
- }
93
- }
94
- }
95
- }
96
- }
97
-
98
- /**
99
- * CSS VARS on root (they will be translated in "RGB" instead of "HEX"
100
- */
101
- :root{
102
- @if list.length($feature-list) < 1 or list.index($feature-list, "root"){
103
- @each $branch-name, $branch in $color-list {
104
- @each $sname, $scolor in $branch {
105
- --#{$prefix}#{$branch-name}-#{$sname}: #{color-functions.extract-colors($scolor)};
106
- }
107
- }
108
- }
109
- @if list.length($feature-list) < 1 or list.index($feature-list, "on-root"){
110
- @each $branch-name, $branch in $color-list {
111
- @each $sname, $scolor in $branch {
112
- // @if type-of($scolor) == color {
113
- --#{$prefix}on-#{$branch-name}-#{$sname}: #{color-functions.extract-colors(color-functions.color-contrast($scolor))};
114
- // _}
115
- }
116
- }
117
- }
118
- }
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
+ * $color-list - list of colors (like $colors-collection: ("branch": ( "leaf: $color" )))
8
+ * $branch-list: - when filled: becomes a whitelist (aka: include only listed brands)
9
+ * $feature-list: - when filled: becomes a whitelist. May become cumbersome and many are not needed. Use with care.
10
+ * - root
11
+ * - on-root (color's "best contrast" partner color)
12
+ * - color
13
+ * - background
14
+ * - border
15
+ * - pseudo (bg only, color very rarely used)
16
+ * - hover
17
+ * $prefix: prefix that applies to classes
18
+ */
19
+ @mixin create-colors($color-list: (), $branch-list: (), $feature-list: (), $prefix: "") {
20
+ // for every branch
21
+ @each $branch-name, $branch in $color-list {
22
+ // check that there is no $branch-list or, if present, it's correctly whitelisted
23
+ @if list.length($branch-list) < 1 or list.index($branch-list, $branch-name) {
24
+
25
+ // for every leaf
26
+ @each $sname, $scolor in $branch {
27
+
28
+ @if not list.index($branch-name, "advanced"){
29
+ @if list.length($feature-list) < 1 or list.index($feature-list, "color") {
30
+ .#{$prefix}#{$branch-name}-#{$sname}-text {
31
+ color: $scolor !important;
32
+ }
33
+ }
34
+ @if list.length($feature-list) < 1 or list.index($feature-list, "border") {
35
+ .#{$prefix}#{$branch-name}-#{$sname}-border {
36
+ border-color: $scolor !important;
37
+ }
38
+ }
39
+ }
40
+
41
+ @if list.length($feature-list) < 1 or list.index($feature-list, "background") {
42
+ .#{$prefix}#{$branch-name}-#{$sname}-bg {
43
+ background: $scolor !important;
44
+ }
45
+ }
46
+
47
+ @if list.length($feature-list) < 1 or list.index($feature-list, "pseudo") {
48
+ .#{$prefix}#{$branch-name}-#{$sname}-pseudo-bg {
49
+ &::after,
50
+ &::before {
51
+ background: $scolor !important;
52
+ }
53
+ }
54
+ }
55
+
56
+ @if list.length($feature-list) < 1 or list.index($feature-list, "hover"){
57
+
58
+ @if not list.index($branch-name, "advanced"){
59
+ @if list.length($feature-list) < 1 or list.index($feature-list, "color"){
60
+ .#{$prefix}#{$branch-name}-#{$sname}-hover-text {
61
+ &:hover {
62
+ color: $scolor !important;
63
+ }
64
+ }
65
+ }
66
+ @if list.length($feature-list) < 1 or list.index($feature-list, "border"){
67
+ .#{$prefix}#{$branch-name}-#{$sname}-hover-border {
68
+ &:hover {
69
+ border-color: $scolor !important;
70
+ }
71
+ }
72
+ }
73
+ }
74
+
75
+ @if list.length($feature-list) < 1 or list.index($feature-list, "background") {
76
+ .#{$prefix}#{$branch-name}-#{$sname}-hover-bg {
77
+ &:hover {
78
+ background: $scolor !important;
79
+ }
80
+ }
81
+ }
82
+
83
+ @if list.length($feature-list) < 1 or list.index($feature-list, "pseudo") {
84
+ .#{$prefix}#{$branch-name}-#{$sname}-hover-pseudo-bg {
85
+ &:hover{
86
+ &::after,
87
+ &::before {
88
+ background: $scolor !important;
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+
98
+ /**
99
+ * CSS VARS on root (they will be translated in "RGB" instead of "HEX"
100
+ */
101
+ :root{
102
+ @if list.length($feature-list) < 1 or list.index($feature-list, "root"){
103
+ @each $branch-name, $branch in $color-list {
104
+ @each $sname, $scolor in $branch {
105
+ --#{$prefix}#{$branch-name}-#{$sname}: #{color-functions.extract-colors($scolor)};
106
+ }
107
+ }
108
+ }
109
+ @if list.length($feature-list) < 1 or list.index($feature-list, "on-root"){
110
+ @each $branch-name, $branch in $color-list {
111
+ @each $sname, $scolor in $branch {
112
+ // @if meta.type-of($scolor) == color {
113
+ --#{$prefix}on-#{$branch-name}-#{$sname}: #{color-functions.extract-colors(color-functions.color-contrast($scolor))};
114
+ // _}
115
+ }
116
+ }
117
+ }
118
+ }
119
119
  }