gerillass 2.2.0 → 2.3.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/SKILL.md +2 -1
- package/gerillass.json +24 -6
- package/package.json +1 -1
- package/scss/library/_container.scss +63 -0
- package/scss/library/_font-face.scss +7 -0
- package/scss/library/_position.scss +29 -9
package/SKILL.md
CHANGED
|
@@ -92,6 +92,7 @@ a dropped declaration rather than an error.
|
|
|
92
92
|
| `loadify` | `@include loadify(nonsense);` |
|
|
93
93
|
| `motion-safe` | `.card { @include motion-safe; }` |
|
|
94
94
|
| `only` | `.a { @include only(#ff0000) { margin: 0; } }` |
|
|
95
|
+
| `position` | `.badge { @include position(absolute, 0, $logical: yes); }` |
|
|
95
96
|
| `radial-gradient` | `.a { @include radial-gradient(42, "center", (red, blue)); }` |
|
|
96
97
|
| `remove` | `.a { @include remove(a, b, c); }` |
|
|
97
98
|
| `reset-css` | `.a { @include reset-css; }` |
|
|
@@ -190,7 +191,7 @@ a dropped declaration rather than an error.
|
|
|
190
191
|
| `only($params...)` | Selects only the siblings named. |
|
|
191
192
|
| `placeholder-shown` | Styles an input while its placeholder is visible. |
|
|
192
193
|
| `placeholder` | Styles the placeholder text of an input across vendor prefixes. |
|
|
193
|
-
| `position($position: absolute, $offsets: 0)` | Sets position and offsets in one call, using shorthand order. |
|
|
194
|
+
| `position($position: absolute, $offsets: 0, $logical: false)` | Sets position and offsets in one call, using shorthand order. |
|
|
194
195
|
| `radial-gradient($shape, $position, $colors)` | Radial gradient background from a shape and a position. |
|
|
195
196
|
| `remove($params...)` | Hides an element outright, or within a media query: from a breakpoint up with min, up to it with max, or between two breakpoints. One breakpoint on its own hides the element at exactly that width, a single pixel, and prints a warning: pass only for that. |
|
|
196
197
|
| `reset-css` | Meyer reset. Must be called at the root of the stylesheet. |
|
package/gerillass.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gerillass",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Gerillass is an open-source toolkit that contains a set of Sass mixins to help designers and developers to create better, faster and consistent user interfaces.",
|
|
5
5
|
"homepage": "https://gerillass.com",
|
|
6
6
|
"documentation": "https://docs.gerillass.com",
|
|
@@ -705,7 +705,9 @@
|
|
|
705
705
|
],
|
|
706
706
|
"rejects": [
|
|
707
707
|
".card { @include container(\"card\", sideways); }",
|
|
708
|
-
".card { @include container(42); }"
|
|
708
|
+
".card { @include container(42); }",
|
|
709
|
+
".card { @include container(\"and\"); }",
|
|
710
|
+
".card { @include container(\"1card\"); }"
|
|
709
711
|
]
|
|
710
712
|
},
|
|
711
713
|
{
|
|
@@ -921,7 +923,10 @@
|
|
|
921
923
|
"@include font-face(var(--font-family), \"/fonts/inter\", $file-formats: woff2);",
|
|
922
924
|
"@include font-face(\"Inter\", \"/fonts/inter\", var(--font-style), $file-formats: woff2);",
|
|
923
925
|
"@include font-face(\"Inter\", \"/fonts/inter\", $font-weight: var(--font-weight), $file-formats: woff2);",
|
|
924
|
-
"@include font-face(\"Inter\", \"/fonts/inter\", $font-weight: 100 var(--max-weight), $file-formats: woff2);"
|
|
926
|
+
"@include font-face(\"Inter\", \"/fonts/inter\", $font-weight: 100 var(--max-weight), $file-formats: woff2);",
|
|
927
|
+
"@include font-face(sans-serif, \"/fonts/inter\", $file-formats: woff2);",
|
|
928
|
+
"@include font-face(inherit, \"/fonts/inter\", $file-formats: woff2);",
|
|
929
|
+
"@include font-face(env(--font-family), \"/fonts/inter\", $file-formats: woff2);"
|
|
925
930
|
]
|
|
926
931
|
},
|
|
927
932
|
{
|
|
@@ -1126,18 +1131,31 @@
|
|
|
1126
1131
|
"one to four lengths in shorthand order, or auto/inherit/initial/0",
|
|
1127
1132
|
"null in any position to leave that edge out"
|
|
1128
1133
|
]
|
|
1134
|
+
},
|
|
1135
|
+
{
|
|
1136
|
+
"name": "$logical",
|
|
1137
|
+
"default": "false",
|
|
1138
|
+
"accepts": [
|
|
1139
|
+
"false, the default, for top, right, bottom and left",
|
|
1140
|
+
"null, read as false",
|
|
1141
|
+
"true for inset-block-start, inset-inline-end, inset-block-end and inset-inline-start, which follow the writing direction"
|
|
1142
|
+
]
|
|
1129
1143
|
}
|
|
1130
1144
|
],
|
|
1131
1145
|
"file": "scss/library/_position.scss",
|
|
1132
|
-
"signature": "position($position: absolute, $offsets: 0)",
|
|
1146
|
+
"signature": "position($position: absolute, $offsets: 0, $logical: false)",
|
|
1133
1147
|
"summary": "Sets position and offsets in one call, using shorthand order.",
|
|
1134
1148
|
"examples": [
|
|
1135
1149
|
".a { @include position(absolute, 0); }",
|
|
1136
1150
|
".a { @include position(fixed, 0 10px); }",
|
|
1137
1151
|
".a { @include position(absolute, null 16px 16px 16px); }",
|
|
1138
|
-
".a { @include position(absolute, 0 null null 0); }"
|
|
1152
|
+
".a { @include position(absolute, 0 null null 0); }",
|
|
1153
|
+
".badge { @include position(absolute, 0 auto auto 1rem, $logical: true); }",
|
|
1154
|
+
".a { @include position(absolute, 0, $logical: null); }"
|
|
1139
1155
|
],
|
|
1140
|
-
"rejects": [
|
|
1156
|
+
"rejects": [
|
|
1157
|
+
".badge { @include position(absolute, 0, $logical: yes); }"
|
|
1158
|
+
]
|
|
1141
1159
|
},
|
|
1142
1160
|
{
|
|
1143
1161
|
"name": "radial-gradient",
|
package/package.json
CHANGED
|
@@ -4,6 +4,63 @@
|
|
|
4
4
|
@use "sass:meta";
|
|
5
5
|
@use "sass:string";
|
|
6
6
|
|
|
7
|
+
// What a browser will not keep in `container-name`. Measured in Chrome 152, the
|
|
8
|
+
// declaration was dropped for `and`, `or`, `not` and `default` in any case, a
|
|
9
|
+
// name starting with a digit or a hyphen and a digit, and a name holding `.`,
|
|
10
|
+
// `#` or `!`; and for a list with any one of those in it, such as `card and`,
|
|
11
|
+
// and for `none` or a CSS-wide keyword beside another name, such as `NONE card`
|
|
12
|
+
// or `card inherit`. `none`, `inherit`, `revert` and the other CSS-wide
|
|
13
|
+
// keywords were kept on their own, as were several valid names,
|
|
14
|
+
// `-card`, and `var()`, which a container can take its name from.
|
|
15
|
+
$-reserved-names: "and" "or" "not" "default";
|
|
16
|
+
$-alone-names: "none" "inherit" "initial" "unset" "revert" "revert-layer";
|
|
17
|
+
$-forbidden-in-name: "." "," "/" "#" ":" ";" "(" ")" "[" "]" "{" "}" "!" "@" "$" "%" "^" "&" "*" "+" "=" "<" ">" "?" "\\" "|" "~" "`" "'" "\"";
|
|
18
|
+
|
|
19
|
+
@function -words($text) {
|
|
20
|
+
$words: ();
|
|
21
|
+
$rest: $text;
|
|
22
|
+
$at: string.index($rest, " ");
|
|
23
|
+
@while $at {
|
|
24
|
+
$word: string.slice($rest, 1, $at - 1);
|
|
25
|
+
@if string.length($word) > 0 {
|
|
26
|
+
$words: list.append($words, $word);
|
|
27
|
+
}
|
|
28
|
+
$rest: string.slice($rest, $at + 1);
|
|
29
|
+
$at: string.index($rest, " ");
|
|
30
|
+
}
|
|
31
|
+
@if string.length($rest) > 0 {
|
|
32
|
+
$words: list.append($words, $rest);
|
|
33
|
+
}
|
|
34
|
+
@return $words;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@function -name-problem($name) {
|
|
38
|
+
$text: "#{$name}";
|
|
39
|
+
@if string.index($text, "var(") {
|
|
40
|
+
@return null;
|
|
41
|
+
}
|
|
42
|
+
$words: -words($text);
|
|
43
|
+
@each $word in $words {
|
|
44
|
+
$lower: string.to-lower-case($word);
|
|
45
|
+
@if list.index($-alone-names, $lower) and list.length($words) > 1 {
|
|
46
|
+
@return "`#{$word}` only works as the whole value, not beside another name";
|
|
47
|
+
}
|
|
48
|
+
@if list.index($-reserved-names, $lower) {
|
|
49
|
+
@return "`and`, `or`, `not` and `default` cannot name a container";
|
|
50
|
+
}
|
|
51
|
+
$first: string.slice($word, 1, 1);
|
|
52
|
+
@if string.index("0123456789", $first) or ($first == "-" and string.length($word) > 1 and string.index("0123456789", string.slice($word, 2, 2))) {
|
|
53
|
+
@return "a container name cannot start with a digit, or with a hyphen and a digit";
|
|
54
|
+
}
|
|
55
|
+
@each $character in $-forbidden-in-name {
|
|
56
|
+
@if string.index($word, $character) {
|
|
57
|
+
@return "a container name cannot contain `#{$character}`";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
@return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
7
64
|
// Marks an element as a query container, so `container-query` can ask about its
|
|
8
65
|
// width instead of the viewport's.
|
|
9
66
|
//
|
|
@@ -19,6 +76,12 @@
|
|
|
19
76
|
@if $name != null and meta.type-of($name) != "string" {
|
|
20
77
|
@error "`#{$name}` is not a valid $name for `container`. Pass a name as a string, such as `\"card\"`, or no name at all.";
|
|
21
78
|
}
|
|
79
|
+
@if $name != null {
|
|
80
|
+
$problem: -name-problem($name);
|
|
81
|
+
@if $problem {
|
|
82
|
+
@error "`#{$name}` is not a valid $name for `container`: #{$problem}, and a browser drops the whole declaration. Pass a name such as `\"card\"`.";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
22
85
|
container-type: $type;
|
|
23
86
|
@if $name {
|
|
24
87
|
container-name: string.unquote($name);
|
|
@@ -30,6 +30,13 @@
|
|
|
30
30
|
// and a rule with no family is never used. A quoted "var(--f)" is only a
|
|
31
31
|
// name, which the browser kept, so it is left alone like a quoted path.
|
|
32
32
|
@error "`#{$font-family}` is not a valid $font-family for `font-face`. A custom property cannot supply it, because a @font-face rule drops var() in a descriptor, and without a family the font is never used. Pass the family name as a string, such as `\"Inter\"`.";
|
|
33
|
+
} @else if string.slice(meta.inspect($font-family), 1, 1) != "\"" and (list.index("serif" "sans-serif" "monospace" "cursive" "fantasy" "system-ui" "math" "inherit" "initial" "unset" "revert" "revert-layer" "default", string.to-lower-case($font-family)) or string.index($font-family, "env(") or string.index($font-family, "attr(")) {
|
|
34
|
+
// Measured in Chrome 152, a @font-face rule dropped an unquoted `serif`,
|
|
35
|
+
// `sans-serif`, `monospace`, `cursive`, `fantasy`, `system-ui`, `math`,
|
|
36
|
+
// `default` or CSS-wide keyword, in any case, and `env()` and `attr()`. The
|
|
37
|
+
// same words quoted are names and were kept, as were `emoji`, `fangsong` and
|
|
38
|
+
// the `ui-` families unquoted.
|
|
39
|
+
@error "`#{$font-family}` is not a valid $font-family for `font-face`. A @font-face rule drops a generic family, a CSS-wide keyword or a function as its family, and without a family the font is never used. Pass the family name as a quoted string, such as `\"Inter\"`.";
|
|
33
40
|
} @else {
|
|
34
41
|
|
|
35
42
|
$list: ();
|
|
@@ -1,21 +1,41 @@
|
|
|
1
1
|
@charset "UTF-8";
|
|
2
2
|
|
|
3
3
|
@use "sass:list";
|
|
4
|
+
@use "sass:meta";
|
|
4
5
|
@use "../utilities/shorthand-property" as *;
|
|
5
6
|
@use "../utilities/validate-length" as *;
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
// Sets position and its four offsets in shorthand order: top, right, bottom,
|
|
9
|
+
// left, as `margin` and `padding` take them.
|
|
10
|
+
//
|
|
11
|
+
// Pass $logical: true for the offsets that follow the writing direction, the
|
|
12
|
+
// same choice `triangle` and `border-radius` offer with their logical names.
|
|
13
|
+
// The shorthand order stays the same and each position maps to its logical
|
|
14
|
+
// twin: top to inset-block-start, right to inset-inline-end, bottom to
|
|
15
|
+
// inset-block-end, left to inset-inline-start. Measured in Chrome 152: under
|
|
16
|
+
// dir="ltr" each logical offset put the box where its physical twin did, and
|
|
17
|
+
// under dir="rtl" where the mirrored twin did, while a physical `left: 16px`
|
|
18
|
+
// stayed 16px from the left in both. For one offset, writing inset-* by hand is
|
|
19
|
+
// as short; the argument is here so the library behaves the same way
|
|
20
|
+
// everywhere.
|
|
21
|
+
@mixin position($position: absolute, $offsets: 0, $logical: false) {
|
|
22
|
+
// null is read as false, as a null argument means "not set" across the
|
|
23
|
+
// library, so a caller can pass a variable that may be unset.
|
|
24
|
+
@if $logical != true and $logical != false and $logical != null {
|
|
25
|
+
@error "`#{meta.inspect($logical)}` is not a valid $logical for `position`. Pass true for offsets that follow the writing direction, or false for top, right, bottom and left.";
|
|
26
|
+
}
|
|
27
|
+
|
|
8
28
|
$offsets: shorthandProperty($offsets);
|
|
9
|
-
$
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
29
|
+
$edges: top right bottom left;
|
|
30
|
+
@if $logical {
|
|
31
|
+
$edges: inset-block-start inset-inline-end inset-block-end inset-inline-start;
|
|
32
|
+
}
|
|
33
|
+
|
|
15
34
|
position: $position;
|
|
16
|
-
@
|
|
35
|
+
@for $i from 1 through 4 {
|
|
36
|
+
$value: list.nth($offsets, $i);
|
|
17
37
|
@if validateLength($value) {
|
|
18
|
-
#{$
|
|
38
|
+
#{list.nth($edges, $i)}: $value;
|
|
19
39
|
}
|
|
20
40
|
}
|
|
21
41
|
}
|