@guebbit/css-toolkit 1.0.1 → 1.1.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 (43) hide show
  1. package/CHANGELOG +0 -0
  2. package/README.md +2 -1
  3. package/package.json +8 -5
  4. package/.stylelintignore +0 -2
  5. package/.stylelintrc.json +0 -23
  6. package/docs/.postcssrc.cjs +0 -12
  7. package/docs/.vitepress/config.ts +0 -89
  8. package/docs/.vitepress/theme/index.js +0 -12
  9. package/docs/colors/bootstrap.md +0 -1
  10. package/docs/colors/brands.md +0 -1
  11. package/docs/colors/customs.md +0 -1
  12. package/docs/functions/colors.md +0 -66
  13. package/docs/functions/helpers.md +0 -1
  14. package/docs/functions/strings.md +0 -1
  15. package/docs/index.md +0 -1
  16. package/docs/logo.svg +0 -55
  17. package/docs/logotype.svg +0 -149
  18. package/docs/mixins/build-aspect-ratio.md +0 -1
  19. package/docs/mixins/build-compatibility.md +0 -23
  20. package/docs/mixins/build-scrollbar.md +0 -19
  21. package/docs/mixins/create-colors.md +0 -1
  22. package/docs/mixins/create-helper-margin.md +0 -25
  23. package/docs/mixins/create-helper-padding.md +0 -24
  24. package/docs/mixins/create-instruction.md +0 -33
  25. package/src/colors/_bootstrap.scss +0 -180
  26. package/src/colors/_brands.scss +0 -20
  27. package/src/colors/_customs.scss +0 -53
  28. package/src/colors/_index.scss +0 -205
  29. package/src/functions/_colors.scss +0 -111
  30. package/src/functions/_helpers.scss +0 -23
  31. package/src/functions/_strings.scss +0 -31
  32. package/src/index.scss +0 -14
  33. package/src/mixins/_build-aspect-ratio.scss +0 -34
  34. package/src/mixins/_build-compatibility.scss +0 -28
  35. package/src/mixins/_build-scrollbar.scss +0 -32
  36. package/src/mixins/_create-colors.scss +0 -119
  37. package/src/mixins/_create-helper-margin.scss +0 -39
  38. package/src/mixins/_create-helper-padding.scss +0 -40
  39. package/src/mixins/_create-instruction.scss +0 -11
  40. package/test/compile.test.js +0 -19
  41. package/test/lint.test.js +0 -33
  42. package/test.scss +0 -65
  43. package/vite.config.ts +0 -26
@@ -1,28 +0,0 @@
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
- }
@@ -1,32 +0,0 @@
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,119 +0,0 @@
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.hex2rgb($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.hex2rgb(color-functions.color-contrast($scolor))};
114
- // _}
115
- }
116
- }
117
- }
118
- }
119
- }
@@ -1,39 +0,0 @@
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,40 +0,0 @@
1
- /**
2
- *
3
- * t - applies the spacing for padding-top
4
- * b - applies the spacing for padding-bottom
5
- * l - applies the spacing for padding-left
6
- * r - applies the spacing for padding-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-padding($measure-list: (), $important: false, $prefix: "") {
14
-
15
- @each $name, $val in $measure-list {
16
- .#{$prefix}pt-#{$name} {
17
- padding-top: #{$val} #{if($important == true, "!important", "")};
18
- }
19
- .#{$prefix}pb-#{$name} {
20
- padding-bottom: #{$val} #{if($important == true, "!important", "")};
21
- }
22
- .#{$prefix}pl-#{$name} {
23
- padding-left: #{$val} #{if($important == true, "!important", "")};
24
- }
25
- .#{$prefix}pr-#{$name} {
26
- padding-right: #{$val} #{if($important == true, "!important", "")};
27
- }
28
- .#{$prefix}px-#{$name} {
29
- padding-right: #{$val} #{if($important == true, "!important", "")};
30
- padding-left: #{$val} #{if($important == true, "!important", "")};
31
- }
32
- .#{$prefix}py-#{$name} {
33
- padding-top: #{$val} #{if($important == true, "!important", "")};
34
- padding-bottom: #{$val} #{if($important == true, "!important", "")};
35
- }
36
- .#{$prefix}pa-#{$name} {
37
- padding: #{$val} #{if($important == true, "!important", "")};
38
- }
39
- }
40
- }
@@ -1,11 +0,0 @@
1
- /**
2
- CSS single instructions generator
3
- @param {Array<name,value>[]} measure-list - postfix name and value
4
- */
5
- @mixin create-instruction($instruction, $measure-list: (), $important: false, $prefix: "", $delimiter: "-") {
6
- @each $name, $val in $measure-list {
7
- .#{$prefix}#{$instruction}#{$delimiter}#{$name} {
8
- #{$instruction}: #{$val} #{if($important == true, "!important", "")}
9
- }
10
- }
11
- }
@@ -1,19 +0,0 @@
1
- import { describe, it } from 'mocha';
2
- import util from "util";
3
- import * as sass from "sass";
4
- import path from "path";
5
- import { fileURLToPath } from "url";
6
-
7
- const __filename = fileURLToPath(import.meta.url);
8
- const __dirname = path.dirname(__filename);
9
-
10
- describe("COMPILE", function() {
11
- this.timeout(10000);
12
- it("Compiles in CSS", () => {
13
- const sassRender = util.promisify(sass.render);
14
- return sassRender({
15
- includePaths: ['./scss'],
16
- file: path.join(__dirname, '../test.scss')
17
- });
18
- });
19
- });
package/test/lint.test.js DELETED
@@ -1,33 +0,0 @@
1
- import { describe, it } from 'mocha';
2
- import stylelint from "stylelint";
3
- import path from "path";
4
- import styleLintFormatter from "stylelint-config-standard-scss";
5
- import assert from "assert";
6
- import { fileURLToPath } from "url";
7
-
8
-
9
- const __filename = fileURLToPath(import.meta.url);
10
- const __dirname = path.dirname(__filename);
11
-
12
-
13
- describe("LINT", () => {
14
- it('Generic linting', async () => {
15
- return stylelint.lint({
16
- configFile: path.join(__dirname, '../.stylelintrc.json'),
17
- ignorePath: path.join(__dirname, '../.stylelintignore'),
18
- formatter: styleLintFormatter,
19
- files: [
20
- path.join(__dirname, '../test.scss'),
21
- ],
22
- }).then(function (lintResults) {
23
- // console.log("results", lintResults.results)
24
- // console.log("output", lintResults.output)
25
- // console.log("errored", lintResults.errored)
26
- return assert.ok(!lintResults.errored);
27
- }).catch(function (error) {
28
- // do things with err e.g.
29
- console.error("ERROR", error);
30
- return false;
31
- });
32
- });
33
- });
package/test.scss DELETED
@@ -1,65 +0,0 @@
1
- @use "./src" as guebbit;
2
-
3
- @include guebbit.create-colors(guebbit.$colors-collection);
4
-
5
-
6
- @include guebbit.create-helper-margin((
7
- (auto, auto),
8
- (6, 6px),
9
- (12, 12px),
10
- (24, 24px),
11
- (36, 36px),
12
- (48, 48px),
13
- ));
14
-
15
- @include guebbit.create-helper-padding((
16
- (6, 6px),
17
- (12, 12px),
18
- (24, 24px),
19
- (36, 36px),
20
- (48, 48px),
21
- ));
22
-
23
- @include guebbit.create-instruction("font-size", (
24
- (n2, 0.6em),
25
- (n1, 0.8em),
26
- (1, 1.2em),
27
- (2, 1.5em),
28
- (3, 2em),
29
- ));
30
-
31
- @include guebbit.create-instruction("opacity", (
32
- (0, 0),
33
- (25, 0.25),
34
- (50, 0.50),
35
- (75, 0.75),
36
- (100, 1),
37
- ));
38
-
39
- @include guebbit.create-instruction("width", (
40
- (25, 25%),
41
- (50, 50%),
42
- (75, 75%),
43
- (100, 100%),
44
- (p25, 25px),
45
- (p50, 50px),
46
- (p75, 75px),
47
- (p100, 100px)
48
- ), true);
49
-
50
- @include guebbit.create-instruction("min-width", (
51
- (25, 25%),
52
- (50, 50%),
53
- (75, 75%),
54
- (100, 100%),
55
- (p25, 25px),
56
- (p50, 50px),
57
- (p75, 75px),
58
- (p100, 100px)
59
- ), true);
60
-
61
- @include guebbit.create-instruction("gap", (
62
- (6, 6px),
63
- (12, 12px),
64
- (24, 24px),
65
- ), true, "flex-");
package/vite.config.ts DELETED
@@ -1,26 +0,0 @@
1
- import { defineConfig } from 'vite';
2
- import * as path from 'path';
3
-
4
- export default defineConfig({
5
- // root: "/",
6
- build: {
7
- outDir: path.join(__dirname, "dist"),
8
- lib: {
9
- entry: path.resolve(__dirname, "index.scss"), // TODO library.scss (import the various components)
10
- name: "@guebbit/css-toolkit",
11
- fileName: "css-toolkit",
12
- },
13
- },
14
- server: {
15
- port: 8080,
16
- },
17
- resolve: {
18
- alias: [
19
- {
20
- find: '@',
21
- replacement: path.resolve(__dirname, 'src')
22
- }
23
- ]
24
- },
25
- plugins: [],
26
- });