gerillass 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.
package/README.md CHANGED
@@ -139,7 +139,7 @@ So, feel free to use any tool to support that. My suggestion is Autoprefixer. If
139
139
 
140
140
  ## Experimenting
141
141
 
142
- Experimentation with Gerillass is easy: If you're processing Sass files on your computer already, [download the Gerillass Sass library](https://github.com/selfishprimate/gerillass/archive/master.zip), include it in your project, and start using it. If not, use [Gerillass Play](https://github.com/selfishprimate/gerillass-play)! Gerillass Play is a Gulp based playground, built for you to get started with [Sass](https://sass-lang.com/) and [Gerillass](https://gerillass.com/) quickly.
142
+ Experimentation with Gerillass is easy: If you're processing Sass files on your computer already, [download the Gerillass Sass library](https://github.com/selfishprimate/gerillass/archive/main.zip), include it in your project, and start using it. If not, use [Gerillass Play](https://github.com/selfishprimate/gerillass-play)! Gerillass Play is a Gulp based playground, built for you to get started with [Sass](https://sass-lang.com/) and [Gerillass](https://gerillass.com/) quickly.
143
143
 
144
144
  **Important Note**: Don't forget that you must have [Node.js](https://nodejs.org/en/) and [Gulp CLI](https://gulpjs.com/docs/en/getting-started/quick-start) installed on your machine to work with Gerillass Play.
145
145
 
@@ -157,7 +157,7 @@ Please read the [contribution details](CONTRIBUTING.md) and feel free to contrib
157
157
 
158
158
  ## License
159
159
 
160
- Gerillass is licensed under the Apache License, Version 2.0. For more [see the license content](https://github.com/selfishprimate/gerillass/blob/master/LICENSE.md).
160
+ Gerillass is licensed under the Apache License, Version 2.0. For more [see the license content](https://github.com/selfishprimate/gerillass/blob/main/LICENSE.md).
161
161
 
162
162
  ## Additional Info
163
163
 
package/package.json CHANGED
@@ -6,10 +6,10 @@
6
6
  "author": "Halil İbrahim Çakıroğlu",
7
7
  "main": "scss/_gerillass.scss",
8
8
  "license": "Apache-2.0",
9
- "version": "1.3.2",
9
+ "version": "1.4.0",
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/selfishprimate/gerillass"
12
+ "url": "git+https://github.com/selfishprimate/gerillass.git"
13
13
  },
14
14
  "bugs": {
15
15
  "url": "https://github.com/selfihsprimate/gerillass/issues"
@@ -39,18 +39,15 @@
39
39
  "scripts": {
40
40
  "test": "jest"
41
41
  },
42
- "dependencies": {
42
+ "devDependencies": {
43
43
  "glob": "^11.0.0",
44
+ "gulp": "^5.0.1",
45
+ "gulp-concat": "^2.6.1",
46
+ "gulp-replace": "^1.1.4",
44
47
  "jest": "^30.0.5",
45
48
  "sass": "^1.90.0",
46
- "sass-loader": "^16.0.3",
47
49
  "sass-true": "^9.0.0"
48
50
  },
49
- "devDependencies": {
50
- "gulp": "^5.0.1",
51
- "gulp-concat": "^2.6.1",
52
- "gulp-replace": "^1.1.4"
53
- },
54
51
  "resolutions": {
55
52
  "braces": ">=3.0.3",
56
53
  "micromatch": ">=4.0.8"
@@ -961,27 +961,7 @@
961
961
  &::before {
962
962
  content: "";
963
963
  display: block;
964
- @if not $ratio {
965
- padding-top: 56.25%;
966
- } @else if $ratio {
967
- @if type-of($ratio) == string {
968
- $width: null;
969
- $height: null;
970
- @if str-index($ratio, "/") {
971
- $fslash-index: str-index($ratio, "/");
972
- $width: __convertToNumber(str-slice($ratio, 1, $fslash-index - 1));
973
- $height: __convertToNumber(str-slice($ratio, $fslash-index + 1));
974
- } @else if str-index($ratio, ":") {
975
- $colon-index: str-index($ratio, ":");
976
- $width: __convertToNumber(str-slice($ratio, 1, $colon-index - 1));
977
- $height: __convertToNumber(str-slice($ratio, $colon-index + 1));
978
- }
979
- $calc: math.div($height, $width) * 100;
980
- padding-top: #{$calc * 1%};
981
- } @else if type-of($ratio) == number {
982
- padding-top: math.div(1, $ratio) * 100%;
983
- }
984
- }
964
+ padding-top: __validateRatio($ratio);
985
965
  }
986
966
  & > * {
987
967
  width: 100%;
@@ -1115,27 +1095,7 @@
1115
1095
  &::before {
1116
1096
  content: "";
1117
1097
  display: block;
1118
- @if not $ratio {
1119
- padding-top: 56.25%;
1120
- } @else if $ratio {
1121
- @if type-of($ratio) == string {
1122
- $width: null;
1123
- $height: null;
1124
- @if str-index($ratio, "/") {
1125
- $fslash-index: str-index($ratio, "/");
1126
- $width: __convertToNumber(str-slice($ratio, 1, $fslash-index - 1));
1127
- $height: __convertToNumber(str-slice($ratio, $fslash-index + 1));
1128
- } @else if str-index($ratio, ":") {
1129
- $colon-index: str-index($ratio, ":");
1130
- $width: __convertToNumber(str-slice($ratio, 1, $colon-index - 1));
1131
- $height: __convertToNumber(str-slice($ratio, $colon-index + 1));
1132
- }
1133
- $calc: math.div($height, $width) * 100;
1134
- padding-top: #{$calc * 1%};
1135
- } @else if type-of($ratio) == number {
1136
- padding-top: math.div(1, $ratio) * 100%;
1137
- }
1138
- }
1098
+ padding-top: __validateRatio($ratio);
1139
1099
  }
1140
1100
  & > * {
1141
1101
  width: 100%;
@@ -38,6 +38,7 @@
38
38
  @import "utilities/shorthand-property";
39
39
  @import "utilities/validate-breakpoint";
40
40
  @import "utilities/validate-length";
41
+ @import "utilities/validate-ratio";
41
42
  @import "utilities/validate-scissors";
42
43
 
43
44
  @import "library/adaptive";
@@ -5,27 +5,7 @@
5
5
  &::before {
6
6
  content: "";
7
7
  display: block;
8
- @if not $ratio {
9
- padding-top: 56.25%;
10
- } @else if $ratio {
11
- @if type-of($ratio) == string {
12
- $width: null;
13
- $height: null;
14
- @if str-index($ratio, "/") {
15
- $fslash-index: str-index($ratio, "/");
16
- $width: __convertToNumber(str-slice($ratio, 1, $fslash-index - 1));
17
- $height: __convertToNumber(str-slice($ratio, $fslash-index + 1));
18
- } @else if str-index($ratio, ":") {
19
- $colon-index: str-index($ratio, ":");
20
- $width: __convertToNumber(str-slice($ratio, 1, $colon-index - 1));
21
- $height: __convertToNumber(str-slice($ratio, $colon-index + 1));
22
- }
23
- $calc: math.div($height, $width) * 100;
24
- padding-top: #{$calc * 1%};
25
- } @else if type-of($ratio) == number {
26
- padding-top: math.div(1, $ratio) * 100%;
27
- }
28
- }
8
+ padding-top: __validateRatio($ratio);
29
9
  }
30
10
  & > * {
31
11
  width: 100%;
@@ -5,27 +5,7 @@
5
5
  &::before {
6
6
  content: "";
7
7
  display: block;
8
- @if not $ratio {
9
- padding-top: 56.25%;
10
- } @else if $ratio {
11
- @if type-of($ratio) == string {
12
- $width: null;
13
- $height: null;
14
- @if str-index($ratio, "/") {
15
- $fslash-index: str-index($ratio, "/");
16
- $width: __convertToNumber(str-slice($ratio, 1, $fslash-index - 1));
17
- $height: __convertToNumber(str-slice($ratio, $fslash-index + 1));
18
- } @else if str-index($ratio, ":") {
19
- $colon-index: str-index($ratio, ":");
20
- $width: __convertToNumber(str-slice($ratio, 1, $colon-index - 1));
21
- $height: __convertToNumber(str-slice($ratio, $colon-index + 1));
22
- }
23
- $calc: math.div($height, $width) * 100;
24
- padding-top: #{$calc * 1%};
25
- } @else if type-of($ratio) == number {
26
- padding-top: math.div(1, $ratio) * 100%;
27
- }
28
- }
8
+ padding-top: __validateRatio($ratio);
29
9
  }
30
10
  & > * {
31
11
  width: 100%;
@@ -0,0 +1,42 @@
1
+ @charset "UTF-8";
2
+
3
+ @function __validateRatio($ratio) {
4
+ // No argument at all keeps the 16/9 default.
5
+ @if $ratio == null {
6
+ @return 56.25%;
7
+ }
8
+
9
+ @if type-of($ratio) == "number" {
10
+ @if not unitless($ratio) {
11
+ @error "`#{$ratio}` is not a valid ratio. A numeric ratio must be unitless, like `1.77`.";
12
+ }
13
+ @if $ratio <= 0 {
14
+ @error "`#{$ratio}` is not a valid ratio. A numeric ratio must be greater than zero.";
15
+ }
16
+ @return math.div(1, $ratio) * 100%;
17
+ }
18
+
19
+ @if type-of($ratio) == "string" {
20
+ $separator: null;
21
+ @if str-index($ratio, "/") {
22
+ $separator: str-index($ratio, "/");
23
+ } @else if str-index($ratio, ":") {
24
+ $separator: str-index($ratio, ":");
25
+ } @else {
26
+ @error "`#{$ratio}` is not a valid ratio. A string ratio must separate width and height with `/` or `:`, like `\"16/9\"` or `\"16:9\"`.";
27
+ }
28
+
29
+ $width: __convertToNumber(str-slice($ratio, 1, $separator - 1));
30
+ $height: __convertToNumber(str-slice($ratio, $separator + 1));
31
+
32
+ @if $width == 0 {
33
+ @error "`#{$ratio}` is not a valid ratio. The width must be greater than zero.";
34
+ }
35
+ @return math.div($height, $width) * 100%;
36
+ }
37
+
38
+ // Anything else -- most commonly a list, which is what `16/9` becomes once
39
+ // Dart Sass 2.0.0 removes slash division. Without this the mixin would emit
40
+ // no padding-top at all and silently produce a ratio box with no ratio.
41
+ @error "`#{$ratio}` is not a valid ratio. Pass a string like `\"16/9\"` or `\"16:9\"`, a unitless number like `1.77`, or no argument at all for the 16/9 default. You passed a #{type-of($ratio)}.";
42
+ }