gerillass 1.5.0 → 1.6.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 (39) hide show
  1. package/README.md +2 -2
  2. package/SKILL.md +198 -0
  3. package/gerillass.json +1904 -0
  4. package/package.json +2 -1
  5. package/scss/_gerillass-prefix.scss +90 -15
  6. package/scss/library/_after.scss +3 -1
  7. package/scss/library/_all-buttons.scss +1 -1
  8. package/scss/library/_all-text-inputs.scss +1 -1
  9. package/scss/library/_antialias.scss +4 -0
  10. package/scss/library/_background-dots.scss +6 -0
  11. package/scss/library/_background-image.scss +2 -2
  12. package/scss/library/_background-stripes.scss +6 -0
  13. package/scss/library/_before.scss +3 -1
  14. package/scss/library/_border-box.scss +4 -0
  15. package/scss/library/_border-radius.scss +3 -1
  16. package/scss/library/_breakpointer.scss +3 -0
  17. package/scss/library/_center.scss +3 -0
  18. package/scss/library/_columnizer.scss +5 -0
  19. package/scss/library/_escape-to-parent.scss +3 -0
  20. package/scss/library/_except.scss +2 -0
  21. package/scss/library/_font-face.scss +4 -0
  22. package/scss/library/_linear-gradient.scss +2 -2
  23. package/scss/library/_only.scss +2 -0
  24. package/scss/library/_radial-gradient.scss +6 -0
  25. package/scss/library/_remove.scss +1 -1
  26. package/scss/library/_scissors.scss +2 -0
  27. package/scss/library/_smartphone.scss +3 -1
  28. package/scss/library/_sprite.scss +4 -0
  29. package/scss/library/_tablet.scss +3 -1
  30. package/scss/library/_text-gradient.scss +2 -2
  31. package/scss/library/_text-selection.scss +4 -0
  32. package/scss/library/_text-shadow.scss +7 -0
  33. package/scss/library/_triangle.scss +1 -1
  34. package/scss/utilities/_clear-whitespace.scss +3 -0
  35. package/scss/utilities/_convert-to-number.scss +4 -0
  36. package/scss/utilities/_null.scss +3 -0
  37. package/scss/utilities/_pixelify.scss +3 -0
  38. package/scss/utilities/_validate-length.scss +17 -5
  39. package/scss/utilities/_validate-scissors.scss +6 -0
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  }
17
17
  },
18
18
  "license": "Apache-2.0",
19
- "version": "1.5.0",
19
+ "version": "1.6.1",
20
20
  "repository": {
21
21
  "type": "git",
22
22
  "url": "git+https://github.com/selfishprimate/gerillass.git"
@@ -47,6 +47,7 @@
47
47
  "needs": "^3.0.0"
48
48
  },
49
49
  "scripts": {
50
+ "manifest": "node tools/build-manifest.js && node tools/build-skill.js",
50
51
  "test": "jest"
51
52
  },
52
53
  "devDependencies": {
@@ -17,7 +17,9 @@
17
17
  &::after {
18
18
  @if $content == null {
19
19
  @content;
20
- } @else if $content != null {
20
+ } @else if type-of($content) != "string" {
21
+ @error "`#{$content}` is not a valid $content for `after`. Pass a string to use as the content value, a data- attribute name such as `\"data-label\"` to render it with attr(), or no argument at all and write the content yourself.";
22
+ } @else {
21
23
  $data: str-slice($content, 1, 5);
22
24
  @if $data == "data-" {
23
25
  content: attr(#{$content});
@@ -43,7 +45,7 @@
43
45
  @content;
44
46
  }
45
47
  } @else {
46
- @error "The argument must be `null` or one of the followings: #{quote($list)}.";
48
+ @error "The argument must be `null` or one of the followings: #{$list}.";
47
49
  }
48
50
  }
49
51
 
@@ -60,7 +62,7 @@
60
62
  @content;
61
63
  }
62
64
  } @else {
63
- @error "The argument must be `null` or one of the followings: #{quote($list)}";
65
+ @error "The argument must be `null` or one of the followings: #{$list}";
64
66
  }
65
67
  }
66
68
 
@@ -91,6 +93,10 @@
91
93
  -webkit-font-smoothing: antialiased;
92
94
  -moz-osx-font-smoothing: grayscale;
93
95
  }
96
+ } @else if not & and $value == "only" {
97
+ @error "`only` has no meaning at the root of a stylesheet, because there is no selector to limit the effect to. Call `antialias(\"only\")` inside a selector, or pass no argument at all.";
98
+ } @else {
99
+ @error "`#{$value}` is not a valid argument for `antialias`. Pass `\"only\"` inside a selector to affect just that element, or pass no argument at all.";
94
100
  }
95
101
  }
96
102
 
@@ -103,6 +109,12 @@
103
109
  $diagonal: true,
104
110
  $image: null
105
111
  ) {
112
+ @if $image != null and type-of($image) != "string" {
113
+ @error "`#{$image}` is not a valid $image for `background-dots`. Pass an image path as a string.";
114
+ }
115
+ @if $diagonal != true and $diagonal != false {
116
+ @error "`#{$diagonal}` is not a valid $diagonal for `background-dots`. Pass `true` or `false`.";
117
+ }
106
118
  @if not $color {
107
119
  $color: rgba(0, 0, 0, 0.1);
108
120
  @if $diagonal == true {
@@ -174,11 +186,11 @@
174
186
  ),
175
187
  url($image-url);
176
188
  } @else {
177
- @if index("deg", unit($filter-direction)) {
189
+ @if type-of($filter-direction) == "number" and index("deg", unit($filter-direction)) {
178
190
  background-image: linear-gradient($filter-direction, $color-list),
179
191
  url($image-url);
180
192
  } @else {
181
- @error "#{$filter-direction} is a wrong value for the $filter-direction parameter. The value must be either a number followed by the 'deg' unit or one of the following pre-defined values: #{quote(map-keys($map-for-directions))}.";
193
+ @error "`#{$filter-direction}` is not a valid $filter-direction. Pass an angle such as `45deg`, or one of: #{map-keys($map-for-directions)}.";
182
194
  }
183
195
  }
184
196
  } @else {
@@ -226,6 +238,12 @@
226
238
  $rotation: -45deg,
227
239
  $image: null
228
240
  ) {
241
+ @if type-of($rotation) != "number" {
242
+ @error "`#{$rotation}` is not a valid $rotation for `background-stripes`. Pass an angle such as `-45deg`, or a unitless number which is treated as degrees.";
243
+ }
244
+ @if $image != null and type-of($image) != "string" {
245
+ @error "`#{$image}` is not a valid $image for `background-stripes`. Pass an image path as a string.";
246
+ }
229
247
  $validate-unit: if(not index("deg", unit($rotation)), $rotation + deg, $rotation);
230
248
  $get-image: if($image, unquote(", ") + url(unquote($image)), unquote(""));
231
249
  @if not $color {
@@ -277,7 +295,9 @@
277
295
  &::before {
278
296
  @if $content == null {
279
297
  @content;
280
- } @else if $content != null {
298
+ } @else if type-of($content) != "string" {
299
+ @error "`#{$content}` is not a valid $content for `before`. Pass a string to use as the content value, a data- attribute name such as `\"data-label\"` to render it with attr(), or no argument at all and write the content yourself.";
300
+ } @else {
281
301
  $data: str-slice($content, 1, 5);
282
302
  @if $data == "data-" {
283
303
  content: attr(#{$content});
@@ -314,6 +334,10 @@
314
334
  *::after {
315
335
  box-sizing: border-box;
316
336
  }
337
+ } @else if not & and $value == "only" {
338
+ @error "`only` has no meaning at the root of a stylesheet, because there is no selector to limit the effect to. Call `border-box(\"only\")` inside a selector, or pass no argument at all.";
339
+ } @else {
340
+ @error "`#{$value}` is not a valid argument for `border-box`. Pass `\"only\"` inside a selector to affect just that element, or pass no argument at all.";
317
341
  }
318
342
  }
319
343
 
@@ -358,7 +382,7 @@
358
382
  border-bottom-left-radius: $value;
359
383
  }
360
384
  } @else {
361
- @error "Corner value must be one of the followings: #{quote($list)}.";
385
+ @error "Corner value must be one of the followings: #{$list}.";
362
386
  }
363
387
  } @else if length($args) == 4 {
364
388
  $args: __null($args, space, true);
@@ -366,6 +390,8 @@
366
390
  border-top-right-radius: nth($args, 2);
367
391
  border-bottom-right-radius: nth($args, 3);
368
392
  border-bottom-left-radius: nth($args, 4);
393
+ } @else {
394
+ @error "`border-radius` takes 1, 2 or 4 arguments; you passed #{length($args)}. Use one radius for every corner, a corner name plus a radius, or four radii in top-left, top-right, bottom-right, bottom-left order.";
369
395
  }
370
396
  }
371
397
 
@@ -460,6 +486,9 @@
460
486
 
461
487
 
462
488
  @mixin gls-breakpointer($selector: null) {
489
+ @if $selector != null and type-of($selector) != "string" {
490
+ @error "`#{$selector}` is not a valid $selector for `breakpointer`. Pass a selector as a string, such as `\".debug\"`, or no argument at all to attach it to body.";
491
+ }
463
492
  @if & {
464
493
  &::before {
465
494
  @content;
@@ -495,6 +524,9 @@
495
524
 
496
525
 
497
526
  @mixin gls-center($axis: "both") {
527
+ @if not index("both" "horizontal" "vertical", $axis) {
528
+ @error "`#{$axis}` is not a valid $axis for `center`. Pass one of: both, horizontal, vertical.";
529
+ }
498
530
  @if $axis == "both" or $axis == "vertical" {
499
531
  top: 50%;
500
532
  }
@@ -529,6 +561,9 @@
529
561
 
530
562
 
531
563
  @mixin gls-columnizer($params...) {
564
+ @if length($params) < 1 or length($params) > 3 {
565
+ @error "`columnizer` takes 1 to 3 arguments; you passed #{length($params)}. Pass the column count, optionally a gutter length, and optionally a boolean telling the last row whether to fill.";
566
+ }
532
567
  $columns: nth($params, 1);
533
568
  $gutter: null;
534
569
  $fill: false;
@@ -564,6 +599,8 @@
564
599
  &:nth-child(#{$columns}n) {
565
600
  margin-right: 0;
566
601
  }
602
+ } @else {
603
+ @error "`#{nth($params, 2)}` is not a valid second argument for `columnizer`. Pass a gutter length such as `20px`, or a boolean telling the last row whether to fill.";
567
604
  }
568
605
  } @else if length($params) == 3 {
569
606
  $gutter: nth($params, 2);
@@ -642,6 +679,9 @@
642
679
 
643
680
 
644
681
  @mixin gls-escape-to-parent($selector: null) {
682
+ @if $selector != null and type-of($selector) != "string" {
683
+ @error "`#{$selector}` is not a valid $selector for `escape-to-parent`. Pass a selector as a string, such as `\".theme-dark\"`.";
684
+ }
645
685
  @at-root #{$selector}#{&} {
646
686
  @content;
647
687
  }
@@ -686,6 +726,8 @@
686
726
  @content;
687
727
  }
688
728
  }
729
+ } @else {
730
+ @error "`#{$value}` is not a valid argument for `except`. Pass a positive or negative number, one of `first`, `last`, `odd`, `even`, or a selector such as `.foo`.";
689
731
  }
690
732
  } @else if length($params) > 1 {
691
733
  $items: "";
@@ -709,6 +751,10 @@
709
751
  ) {
710
752
  @if & {
711
753
  @error "You must call the mixin at the root level of your style sheet, not in the `#{&+'{'+'}'}` selector.";
754
+ } @else if type-of($font-family) != "string" {
755
+ @error "`#{$font-family}` is not a valid $font-family for `font-face`. Pass the family name as a string, such as `\"Inter\"`.";
756
+ } @else if type-of($file-path) != "string" {
757
+ @error "`#{$file-path}` is not a valid $file-path for `font-face`. Pass the path to the font files without an extension, as a string.";
712
758
  } @else {
713
759
 
714
760
  $list: ();
@@ -788,8 +834,8 @@
788
834
  $list
789
835
  );
790
836
  } @else if not map-has-key($map-for-directions, $direction) {
791
- @if not index("deg", unit($direction)) {
792
- @error "#{$direction} is a wrong value for the $direction parameter. The value must be eighter a number followed by the 'deg' unit or one of the followings: #{map-keys($map-for-directions)}.";
837
+ @if type-of($direction) != "number" or not index("deg", unit($direction)) {
838
+ @error "`#{$direction}` is not a valid $direction for `linear-gradient`. Pass an angle such as `45deg`, or one of: #{map-keys($map-for-directions)}.";
793
839
  } @else {
794
840
  background: linear-gradient($direction, $list);
795
841
  }
@@ -877,6 +923,8 @@
877
923
  @content;
878
924
  }
879
925
  }
926
+ } @else {
927
+ @error "`#{$value}` is not a valid argument for `only`. Pass a positive or negative number, one of `first`, `last`, `odd`, `even`, or a selector such as `.foo`.";
880
928
  }
881
929
  } @else if length($params) > 1 {
882
930
  $list: ();
@@ -938,6 +986,12 @@
938
986
 
939
987
 
940
988
  @mixin gls-radial-gradient($shape, $position, $colors) {
989
+ @if type-of($shape) != "string" {
990
+ @error "`#{$shape}` is not a valid $shape for `radial-gradient`. Pass `circle` or `ellipse`.";
991
+ }
992
+ @if type-of($position) != "string" {
993
+ @error "`#{$position}` is not a valid $position for `radial-gradient`. Pass a position name such as `center` or `top-left`, or a raw CSS position as a string.";
994
+ }
941
995
  $list: ();
942
996
  $shape: unquote($shape);
943
997
  $position: unquote($position);
@@ -1005,7 +1059,7 @@
1005
1059
  }
1006
1060
  }
1007
1061
  } @else {
1008
- @error "Error!";
1062
+ @error "`remove` takes at most 2 arguments; you passed #{length($params)}. Pass nothing to hide the element outright, one breakpoint, `min`/`max` plus a breakpoint, or a start and an end breakpoint.";
1009
1063
  }
1010
1064
  }
1011
1065
 
@@ -1135,6 +1189,8 @@
1135
1189
  #{nth($corners, 4)} 100%,
1136
1190
  0 calc(100% - #{nth($corners, 4)})
1137
1191
  );
1192
+ } @else {
1193
+ @error "`scissors` takes either 1 corner size or 4; you passed #{length($corners)}. Pass one length to cut every corner equally, or four lengths in top-left, top-right, bottom-right, bottom-left order.";
1138
1194
  }
1139
1195
  }
1140
1196
 
@@ -1185,9 +1241,11 @@
1185
1241
  and (orientation: landscape) {
1186
1242
  @content;
1187
1243
  }
1244
+ } @else {
1245
+ @error "`#{$orientation}` is not a valid $orientation for `smartphone`. Pass `portrait`, `landscape`, or no orientation at all.";
1188
1246
  }
1189
1247
  } @else {
1190
- @warn "#{$device} is a wrong device name! The argument must be one of the followings: #{map-keys($map-for-smartphones)}";
1248
+ @error "`#{$device}` is not a device known to `smartphone`. Pass one of: #{map-keys($map-for-smartphones)}.";
1191
1249
  }
1192
1250
  }
1193
1251
 
@@ -1203,6 +1261,8 @@
1203
1261
  display: inline-block;
1204
1262
  background-image: url($image-url);
1205
1263
  background-repeat: no-repeat;
1264
+ } @else {
1265
+ @error "`#{nth($params, 1)}` is not a valid image path for `sprite`. The path must end in .png, .jpg or .svg.";
1206
1266
  }
1207
1267
  } @else {
1208
1268
  $position: nth($params, 1);
@@ -1215,6 +1275,8 @@
1215
1275
  background-image: url($image-url);
1216
1276
  background-position: $position;
1217
1277
  background-repeat: no-repeat;
1278
+ } @else {
1279
+ @error "`sprite` takes 1 or 2 arguments; you passed #{length($params)}. Pass an image path, a background position, or both in that order.";
1218
1280
  }
1219
1281
  @content;
1220
1282
  }
@@ -1257,9 +1319,11 @@
1257
1319
  and (orientation: landscape) {
1258
1320
  @content;
1259
1321
  }
1322
+ } @else {
1323
+ @error "`#{$orientation}` is not a valid $orientation for `tablet`. Pass `portrait`, `landscape`, or no orientation at all.";
1260
1324
  }
1261
1325
  } @else {
1262
- @warn "#{$device} is a wrong device name! The argument must be one of the followings: #{map-keys($map-for-tablets)}";
1326
+ @error "`#{$device}` is not a device known to `tablet`. Pass one of: #{map-keys($map-for-tablets)}.";
1263
1327
  }
1264
1328
  }
1265
1329
 
@@ -1276,8 +1340,8 @@
1276
1340
  $list
1277
1341
  );
1278
1342
  } @else if not map-has-key($map-for-directions, $direction) {
1279
- @if not index("deg", unit($direction)) {
1280
- @error "#{$direction} is a wrong value for the $direction parameter. The value must be eighter a number followed by the 'deg' unit or one of the followings: #{map-keys($map-for-directions)}.";
1343
+ @if type-of($direction) != "number" or not index("deg", unit($direction)) {
1344
+ @error "`#{$direction}` is not a valid $direction for `text-gradient`. Pass an angle such as `45deg`, or one of: #{map-keys($map-for-directions)}.";
1281
1345
  } @else {
1282
1346
  background: linear-gradient($direction, $list);
1283
1347
  }
@@ -1318,6 +1382,10 @@
1318
1382
  *::selection {
1319
1383
  @content;
1320
1384
  }
1385
+ } @else if not & and $value == "only" {
1386
+ @error "`only` has no meaning at the root of a stylesheet, because there is no selector to limit the effect to. Call `text-selection(\"only\")` inside a selector, or pass no argument at all.";
1387
+ } @else {
1388
+ @error "`#{$value}` is not a valid argument for `text-selection`. Pass `\"only\"` inside a selector to affect just that element, or pass no argument at all.";
1321
1389
  }
1322
1390
  }
1323
1391
 
@@ -1330,6 +1398,13 @@
1330
1398
  // Takes each items come from $params.
1331
1399
  $item: nth($params, $i);
1332
1400
 
1401
+ // Each group must carry at least a direction, a colour and a size. Without
1402
+ // this the nth() calls below fail with "Invalid index", which says nothing
1403
+ // about what the mixin wanted.
1404
+ @if length($item) < 3 {
1405
+ @error "`#{$item}` is not a valid shadow for `text-shadow`. Each group needs a direction, a colour and a size, such as `bottom-right red 5px`. An optional blur and a fill flag may follow.";
1406
+ }
1407
+
1333
1408
  // The first value comes from the $item is direction.
1334
1409
  // This will be used in the @if, @else statements with $size to control the offset of the shadows.
1335
1410
  $direction: nth($item, 1);
@@ -1506,6 +1581,6 @@
1506
1581
  @content;
1507
1582
  }
1508
1583
  } @else {
1509
- @error "The argument for direction must be one of the followings: #{quote($list-of-directions)}";
1584
+ @error "The argument for direction must be one of the followings: #{$list-of-directions}";
1510
1585
  }
1511
1586
  }
@@ -4,7 +4,9 @@
4
4
  &::after {
5
5
  @if $content == null {
6
6
  @content;
7
- } @else if $content != null {
7
+ } @else if type-of($content) != "string" {
8
+ @error "`#{$content}` is not a valid $content for `after`. Pass a string to use as the content value, a data- attribute name such as `\"data-label\"` to render it with attr(), or no argument at all and write the content yourself.";
9
+ } @else {
8
10
  $data: str-slice($content, 1, 5);
9
11
  @if $data == "data-" {
10
12
  content: attr(#{$content});
@@ -12,6 +12,6 @@
12
12
  @content;
13
13
  }
14
14
  } @else {
15
- @error "The argument must be `null` or one of the followings: #{quote($list)}.";
15
+ @error "The argument must be `null` or one of the followings: #{$list}.";
16
16
  }
17
17
  }
@@ -12,6 +12,6 @@
12
12
  @content;
13
13
  }
14
14
  } @else {
15
- @error "The argument must be `null` or one of the followings: #{quote($list)}";
15
+ @error "The argument must be `null` or one of the followings: #{$list}";
16
16
  }
17
17
  }
@@ -25,5 +25,9 @@
25
25
  -webkit-font-smoothing: antialiased;
26
26
  -moz-osx-font-smoothing: grayscale;
27
27
  }
28
+ } @else if not & and $value == "only" {
29
+ @error "`only` has no meaning at the root of a stylesheet, because there is no selector to limit the effect to. Call `antialias(\"only\")` inside a selector, or pass no argument at all.";
30
+ } @else {
31
+ @error "`#{$value}` is not a valid argument for `antialias`. Pass `\"only\"` inside a selector to affect just that element, or pass no argument at all.";
28
32
  }
29
33
  }
@@ -7,6 +7,12 @@
7
7
  $diagonal: true,
8
8
  $image: null
9
9
  ) {
10
+ @if $image != null and type-of($image) != "string" {
11
+ @error "`#{$image}` is not a valid $image for `background-dots`. Pass an image path as a string.";
12
+ }
13
+ @if $diagonal != true and $diagonal != false {
14
+ @error "`#{$diagonal}` is not a valid $diagonal for `background-dots`. Pass `true` or `false`.";
15
+ }
10
16
  @if not $color {
11
17
  $color: rgba(0, 0, 0, 0.1);
12
18
  @if $diagonal == true {
@@ -23,11 +23,11 @@
23
23
  ),
24
24
  url($image-url);
25
25
  } @else {
26
- @if index("deg", unit($filter-direction)) {
26
+ @if type-of($filter-direction) == "number" and index("deg", unit($filter-direction)) {
27
27
  background-image: linear-gradient($filter-direction, $color-list),
28
28
  url($image-url);
29
29
  } @else {
30
- @error "#{$filter-direction} is a wrong value for the $filter-direction parameter. The value must be either a number followed by the 'deg' unit or one of the following pre-defined values: #{quote(map-keys($map-for-directions))}.";
30
+ @error "`#{$filter-direction}` is not a valid $filter-direction. Pass an angle such as `45deg`, or one of: #{map-keys($map-for-directions)}.";
31
31
  }
32
32
  }
33
33
  } @else {
@@ -6,6 +6,12 @@
6
6
  $rotation: -45deg,
7
7
  $image: null
8
8
  ) {
9
+ @if type-of($rotation) != "number" {
10
+ @error "`#{$rotation}` is not a valid $rotation for `background-stripes`. Pass an angle such as `-45deg`, or a unitless number which is treated as degrees.";
11
+ }
12
+ @if $image != null and type-of($image) != "string" {
13
+ @error "`#{$image}` is not a valid $image for `background-stripes`. Pass an image path as a string.";
14
+ }
9
15
  $validate-unit: if(not index("deg", unit($rotation)), $rotation + deg, $rotation);
10
16
  $get-image: if($image, unquote(", ") + url(unquote($image)), unquote(""));
11
17
  @if not $color {
@@ -4,7 +4,9 @@
4
4
  &::before {
5
5
  @if $content == null {
6
6
  @content;
7
- } @else if $content != null {
7
+ } @else if type-of($content) != "string" {
8
+ @error "`#{$content}` is not a valid $content for `before`. Pass a string to use as the content value, a data- attribute name such as `\"data-label\"` to render it with attr(), or no argument at all and write the content yourself.";
9
+ } @else {
8
10
  $data: str-slice($content, 1, 5);
9
11
  @if $data == "data-" {
10
12
  content: attr(#{$content});
@@ -22,5 +22,9 @@
22
22
  *::after {
23
23
  box-sizing: border-box;
24
24
  }
25
+ } @else if not & and $value == "only" {
26
+ @error "`only` has no meaning at the root of a stylesheet, because there is no selector to limit the effect to. Call `border-box(\"only\")` inside a selector, or pass no argument at all.";
27
+ } @else {
28
+ @error "`#{$value}` is not a valid argument for `border-box`. Pass `\"only\"` inside a selector to affect just that element, or pass no argument at all.";
25
29
  }
26
30
  }
@@ -39,7 +39,7 @@
39
39
  border-bottom-left-radius: $value;
40
40
  }
41
41
  } @else {
42
- @error "Corner value must be one of the followings: #{quote($list)}.";
42
+ @error "Corner value must be one of the followings: #{$list}.";
43
43
  }
44
44
  } @else if length($args) == 4 {
45
45
  $args: __null($args, space, true);
@@ -47,5 +47,7 @@
47
47
  border-top-right-radius: nth($args, 2);
48
48
  border-bottom-right-radius: nth($args, 3);
49
49
  border-bottom-left-radius: nth($args, 4);
50
+ } @else {
51
+ @error "`border-radius` takes 1, 2 or 4 arguments; you passed #{length($args)}. Use one radius for every corner, a corner name plus a radius, or four radii in top-left, top-right, bottom-right, bottom-left order.";
50
52
  }
51
53
  }
@@ -1,6 +1,9 @@
1
1
  @charset "UTF-8";
2
2
 
3
3
  @mixin breakpointer($selector: null) {
4
+ @if $selector != null and type-of($selector) != "string" {
5
+ @error "`#{$selector}` is not a valid $selector for `breakpointer`. Pass a selector as a string, such as `\".debug\"`, or no argument at all to attach it to body.";
6
+ }
4
7
  @if & {
5
8
  &::before {
6
9
  @content;
@@ -1,6 +1,9 @@
1
1
  @charset "UTF-8";
2
2
 
3
3
  @mixin center($axis: "both") {
4
+ @if not index("both" "horizontal" "vertical", $axis) {
5
+ @error "`#{$axis}` is not a valid $axis for `center`. Pass one of: both, horizontal, vertical.";
6
+ }
4
7
  @if $axis == "both" or $axis == "vertical" {
5
8
  top: 50%;
6
9
  }
@@ -1,6 +1,9 @@
1
1
  @charset "UTF-8";
2
2
 
3
3
  @mixin columnizer($params...) {
4
+ @if length($params) < 1 or length($params) > 3 {
5
+ @error "`columnizer` takes 1 to 3 arguments; you passed #{length($params)}. Pass the column count, optionally a gutter length, and optionally a boolean telling the last row whether to fill.";
6
+ }
4
7
  $columns: nth($params, 1);
5
8
  $gutter: null;
6
9
  $fill: false;
@@ -36,6 +39,8 @@
36
39
  &:nth-child(#{$columns}n) {
37
40
  margin-right: 0;
38
41
  }
42
+ } @else {
43
+ @error "`#{nth($params, 2)}` is not a valid second argument for `columnizer`. Pass a gutter length such as `20px`, or a boolean telling the last row whether to fill.";
39
44
  }
40
45
  } @else if length($params) == 3 {
41
46
  $gutter: nth($params, 2);
@@ -1,6 +1,9 @@
1
1
  @charset "UTF-8";
2
2
 
3
3
  @mixin escape-to-parent($selector: null) {
4
+ @if $selector != null and type-of($selector) != "string" {
5
+ @error "`#{$selector}` is not a valid $selector for `escape-to-parent`. Pass a selector as a string, such as `\".theme-dark\"`.";
6
+ }
4
7
  @at-root #{$selector}#{&} {
5
8
  @content;
6
9
  }
@@ -37,6 +37,8 @@
37
37
  @content;
38
38
  }
39
39
  }
40
+ } @else {
41
+ @error "`#{$value}` is not a valid argument for `except`. Pass a positive or negative number, one of `first`, `last`, `odd`, `even`, or a selector such as `.foo`.";
40
42
  }
41
43
  } @else if length($params) > 1 {
42
44
  $items: "";
@@ -9,6 +9,10 @@
9
9
  ) {
10
10
  @if & {
11
11
  @error "You must call the mixin at the root level of your style sheet, not in the `#{&+'{'+'}'}` selector.";
12
+ } @else if type-of($font-family) != "string" {
13
+ @error "`#{$font-family}` is not a valid $font-family for `font-face`. Pass the family name as a string, such as `\"Inter\"`.";
14
+ } @else if type-of($file-path) != "string" {
15
+ @error "`#{$file-path}` is not a valid $file-path for `font-face`. Pass the path to the font files without an extension, as a string.";
12
16
  } @else {
13
17
 
14
18
  $list: ();
@@ -11,8 +11,8 @@
11
11
  $list
12
12
  );
13
13
  } @else if not map-has-key($map-for-directions, $direction) {
14
- @if not index("deg", unit($direction)) {
15
- @error "#{$direction} is a wrong value for the $direction parameter. The value must be eighter a number followed by the 'deg' unit or one of the followings: #{map-keys($map-for-directions)}.";
14
+ @if type-of($direction) != "number" or not index("deg", unit($direction)) {
15
+ @error "`#{$direction}` is not a valid $direction for `linear-gradient`. Pass an angle such as `45deg`, or one of: #{map-keys($map-for-directions)}.";
16
16
  } @else {
17
17
  background: linear-gradient($direction, $list);
18
18
  }
@@ -38,6 +38,8 @@
38
38
  @content;
39
39
  }
40
40
  }
41
+ } @else {
42
+ @error "`#{$value}` is not a valid argument for `only`. Pass a positive or negative number, one of `first`, `last`, `odd`, `even`, or a selector such as `.foo`.";
41
43
  }
42
44
  } @else if length($params) > 1 {
43
45
  $list: ();
@@ -1,6 +1,12 @@
1
1
  @charset "UTF-8";
2
2
 
3
3
  @mixin radial-gradient($shape, $position, $colors) {
4
+ @if type-of($shape) != "string" {
5
+ @error "`#{$shape}` is not a valid $shape for `radial-gradient`. Pass `circle` or `ellipse`.";
6
+ }
7
+ @if type-of($position) != "string" {
8
+ @error "`#{$position}` is not a valid $position for `radial-gradient`. Pass a position name such as `center` or `top-left`, or a raw CSS position as a string.";
9
+ }
4
10
  $list: ();
5
11
  $shape: unquote($shape);
6
12
  $position: unquote($position);
@@ -29,6 +29,6 @@
29
29
  }
30
30
  }
31
31
  } @else {
32
- @error "Error!";
32
+ @error "`remove` takes at most 2 arguments; you passed #{length($params)}. Pass nothing to hide the element outright, one breakpoint, `min`/`max` plus a breakpoint, or a start and an end breakpoint.";
33
33
  }
34
34
  }
@@ -25,5 +25,7 @@
25
25
  #{nth($corners, 4)} 100%,
26
26
  0 calc(100% - #{nth($corners, 4)})
27
27
  );
28
+ } @else {
29
+ @error "`scissors` takes either 1 corner size or 4; you passed #{length($corners)}. Pass one length to cut every corner equally, or four lengths in top-left, top-right, bottom-right, bottom-left order.";
28
30
  }
29
31
  }
@@ -16,8 +16,10 @@
16
16
  and (orientation: landscape) {
17
17
  @content;
18
18
  }
19
+ } @else {
20
+ @error "`#{$orientation}` is not a valid $orientation for `smartphone`. Pass `portrait`, `landscape`, or no orientation at all.";
19
21
  }
20
22
  } @else {
21
- @warn "#{$device} is a wrong device name! The argument must be one of the followings: #{map-keys($map-for-smartphones)}";
23
+ @error "`#{$device}` is not a device known to `smartphone`. Pass one of: #{map-keys($map-for-smartphones)}.";
22
24
  }
23
25
  }
@@ -10,6 +10,8 @@
10
10
  display: inline-block;
11
11
  background-image: url($image-url);
12
12
  background-repeat: no-repeat;
13
+ } @else {
14
+ @error "`#{nth($params, 1)}` is not a valid image path for `sprite`. The path must end in .png, .jpg or .svg.";
13
15
  }
14
16
  } @else {
15
17
  $position: nth($params, 1);
@@ -22,6 +24,8 @@
22
24
  background-image: url($image-url);
23
25
  background-position: $position;
24
26
  background-repeat: no-repeat;
27
+ } @else {
28
+ @error "`sprite` takes 1 or 2 arguments; you passed #{length($params)}. Pass an image path, a background position, or both in that order.";
25
29
  }
26
30
  @content;
27
31
  }
@@ -16,8 +16,10 @@
16
16
  and (orientation: landscape) {
17
17
  @content;
18
18
  }
19
+ } @else {
20
+ @error "`#{$orientation}` is not a valid $orientation for `tablet`. Pass `portrait`, `landscape`, or no orientation at all.";
19
21
  }
20
22
  } @else {
21
- @warn "#{$device} is a wrong device name! The argument must be one of the followings: #{map-keys($map-for-tablets)}";
23
+ @error "`#{$device}` is not a device known to `tablet`. Pass one of: #{map-keys($map-for-tablets)}.";
22
24
  }
23
25
  }
@@ -11,8 +11,8 @@
11
11
  $list
12
12
  );
13
13
  } @else if not map-has-key($map-for-directions, $direction) {
14
- @if not index("deg", unit($direction)) {
15
- @error "#{$direction} is a wrong value for the $direction parameter. The value must be eighter a number followed by the 'deg' unit or one of the followings: #{map-keys($map-for-directions)}.";
14
+ @if type-of($direction) != "number" or not index("deg", unit($direction)) {
15
+ @error "`#{$direction}` is not a valid $direction for `text-gradient`. Pass an angle such as `45deg`, or one of: #{map-keys($map-for-directions)}.";
16
16
  } @else {
17
17
  background: linear-gradient($direction, $list);
18
18
  }