gerillass 2.0.1 → 2.1.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.
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  }
17
17
  },
18
18
  "license": "Apache-2.0",
19
- "version": "2.0.1",
19
+ "version": "2.1.1",
20
20
  "repository": {
21
21
  "type": "git",
22
22
  "url": "git+https://github.com/selfishprimate/gerillass.git"
@@ -1,14 +1,29 @@
1
1
  @charset "UTF-8";
2
2
 
3
+ @use "sass:list";
3
4
  @use "sass:meta";
4
5
  @use "sass:string";
5
6
 
7
+ // True for an unquoted call to one of $names, such as var(--x). A quoted string
8
+ // stays text, so `"var(--x)"` is not a call.
9
+ @function -is-css-function($value, $names) {
10
+ @if meta.type-of($value) != "string" or string.slice(meta.inspect($value), 1, 1) == "\"" {
11
+ @return false;
12
+ }
13
+ $open: string.index($value, "(");
14
+ @return $open != null and list.index($names, string.to-lower-case(string.slice($value, 1, $open - 1))) != null;
15
+ }
16
+
6
17
  @mixin after($content: null) {
7
18
  &::after {
8
19
  @if $content == null {
9
20
  @content;
10
21
  } @else if meta.type-of($content) != "string" {
11
22
  @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.";
23
+ } @else if -is-css-function($content, "var" "attr" "counter" "counters") {
24
+ // Quoting would turn the call into text: content: "var(--label)".
25
+ content: $content;
26
+ @content;
12
27
  } @else {
13
28
  $data: string.slice($content, 1, 5);
14
29
  @if $data == "data-" {
@@ -1,17 +1,63 @@
1
1
  @charset "UTF-8";
2
2
 
3
3
  @use "sass:list";
4
- @use "sass:math";
5
4
  @use "sass:meta";
6
5
  @use "sass:string";
7
6
 
7
+ // An image path goes into url(). A var(), url(), image-set() or gradient is
8
+ // already an image, and wrapping it produced url(var(--x)), which loads nothing.
9
+ @function -image($value) {
10
+ @if -is-css-function($value, "var" "url" "image-set" "linear-gradient" "radial-gradient" "conic-gradient" "repeating-linear-gradient" "repeating-radial-gradient" "repeating-conic-gradient") {
11
+ @return $value;
12
+ }
13
+ @return url(string.unquote($value));
14
+ }
15
+
16
+ // True for an unquoted call to one of $names, such as var(--x). A quoted string
17
+ // stays text, so `"var(--x)"` is not a call.
18
+ @function -is-css-function($value, $names) {
19
+ @if meta.type-of($value) != "string" or string.slice(meta.inspect($value), 1, 1) == "\"" {
20
+ @return false;
21
+ }
22
+ $open: string.index($value, "(");
23
+ @return $open != null and list.index($names, string.to-lower-case(string.slice($value, 1, $open - 1))) != null;
24
+ }
25
+
26
+ // A size Sass can use inside calc(): a number, a calculation such as calc(),
27
+ // min() or clamp(), or var() and env(), which only the browser can resolve.
28
+ // Anything else would pass silently through calc(): `calc(nonsense * 5)`
29
+ // compiles.
30
+ @function -is-size($value) {
31
+ @if meta.type-of($value) == "number" or meta.type-of($value) == "calculation" {
32
+ @return true;
33
+ }
34
+ @if meta.type-of($value) == "string" and string.slice(meta.inspect($value), 1, 1) != "\"" {
35
+ $open: string.index($value, "(");
36
+ @return $open != null and list.index("var" "env", string.to-lower-case(string.slice($value, 1, $open - 1))) != null;
37
+ }
38
+ @return false;
39
+ }
40
+
8
41
  @mixin background-dots(
9
42
  $color: null,
10
43
  $size: 1em,
11
- $gutter: $size * 5,
44
+ $gutter: null,
12
45
  $diagonal: true,
13
46
  $image: null
14
47
  ) {
48
+ // The gutter defaults to five times the size. Deriving it here rather than in
49
+ // the signature lets $size be checked first, and doing the arithmetic in
50
+ // calc() lets var() and clamp() through: Sass simplifies calc() on plain
51
+ // numbers back to a number, so a call with lengths emits the same CSS.
52
+ @if not -is-size($size) {
53
+ @error "`#{meta.inspect($size)}` is not a valid $size for `background-dots`. Pass a length, or var(), env() or a calculation such as `clamp()`.";
54
+ }
55
+ @if $gutter == null {
56
+ $gutter: calc($size * 5);
57
+ }
58
+ @if not -is-size($gutter) {
59
+ @error "`#{meta.inspect($gutter)}` is not a valid $gutter for `background-dots`. Pass a length, or var(), env() or a calculation such as `calc()`.";
60
+ }
15
61
  @if $image != null and meta.type-of($image) != "string" {
16
62
  @error "`#{$image}` is not a valid $image for `background-dots`. Pass an image path as a string.";
17
63
  }
@@ -23,21 +69,21 @@
23
69
  @if $diagonal == true {
24
70
  background-image: radial-gradient($color $size, transparent 0),
25
71
  radial-gradient($color $size, transparent 0);
26
- background-position: math.div($gutter, 2) math.div($gutter, 2),
27
- ($gutter * 2) ($gutter * 2);
72
+ background-position: calc($gutter / 2) calc($gutter / 2),
73
+ calc($gutter * 2) calc($gutter * 2);
28
74
  } @else if $diagonal == false {
29
75
  background-image: radial-gradient($color $size, transparent 0);
30
- background-position: math.div($gutter, 2) math.div($gutter, 2);
76
+ background-position: calc($gutter / 2) calc($gutter / 2);
31
77
  }
32
78
  } @else if $color {
33
79
  @if $diagonal == true {
34
80
  background-image: radial-gradient(list.nth($color, 1) $size, transparent 0),
35
81
  radial-gradient(list.nth($color, list.length($color)) $size, transparent 0);
36
- background-position: math.div($gutter, 2) math.div($gutter, 2),
37
- ($gutter * 2) ($gutter * 2);
82
+ background-position: calc($gutter / 2) calc($gutter / 2),
83
+ calc($gutter * 2) calc($gutter * 2);
38
84
  } @else if $diagonal == false {
39
85
  background-image: radial-gradient(list.nth($color, 1) $size, transparent 0);
40
- background-position: math.div($gutter, 2) math.div($gutter, 2);
86
+ background-position: calc($gutter / 2) calc($gutter / 2);
41
87
  @if list.length($color) > 1 {
42
88
  @error "Please do not pass more than one argument when you disable 'diagonal' property! Simply remove the argument(s) after '#{list.nth($color, 1)}' to resolve the problem.";
43
89
  }
@@ -55,7 +101,7 @@
55
101
  height: 100%;
56
102
  top: 0;
57
103
  left: 0;
58
- background-image: url(string.unquote($image));
104
+ background-image: -image($image);
59
105
  background-repeat: no-repeat;
60
106
  background-position: center;
61
107
  background-size: cover;
@@ -4,19 +4,45 @@
4
4
  @use "sass:map";
5
5
  @use "sass:math";
6
6
  @use "sass:meta";
7
+ @use "sass:string";
7
8
  @use "../library/linear-gradient" as *;
8
9
  @use "../maps/map-for-directions" as *;
9
10
 
11
+ // An image path goes into url(). A var(), url(), image-set() or gradient is
12
+ // already an image, and wrapping it produced url(var(--x)), which loads nothing.
13
+ @function -image($value) {
14
+ @if -is-css-function($value, "var" "url" "image-set" "linear-gradient" "radial-gradient" "conic-gradient" "repeating-linear-gradient" "repeating-radial-gradient" "repeating-conic-gradient") {
15
+ @return $value;
16
+ }
17
+ @return url($value);
18
+ }
19
+
20
+ // True for an unquoted call to one of $names, such as var(--x). A quoted string
21
+ // stays text, so `"var(--x)"` is not a call.
22
+ @function -is-css-function($value, $names) {
23
+ @if meta.type-of($value) != "string" or string.slice(meta.inspect($value), 1, 1) == "\"" {
24
+ @return false;
25
+ }
26
+ $open: string.index($value, "(");
27
+ @return $open != null and list.index($names, string.to-lower-case(string.slice($value, 1, $open - 1))) != null;
28
+ }
29
+
10
30
  @mixin background-image(
11
31
  $image-url: null,
12
32
  $filter-color: null,
13
33
  $filter-direction: null
14
34
  ) {
35
+ // The direction used to be read only when there were two or more colours,
36
+ // so with one colour any value was dropped without a word, a typo included.
37
+ // Check it first, against what the gradient branches accept.
38
+ @if $filter-direction and not map.has-key($map-for-directions, $filter-direction) and not (meta.type-of($filter-direction) == "number" and math.unit($filter-direction) == "deg") {
39
+ @error "`#{$filter-direction}` is not a valid $filter-direction. Pass an angle such as `45deg`, or one of: #{map.keys($map-for-directions)}.";
40
+ }
15
41
  @if $image-url {
16
42
  @if $filter-color {
17
43
  @if list.length($filter-color) == 1 {
18
44
  background-image: linear-gradient(to top, $filter-color, $filter-color),
19
- url($image-url);
45
+ -image($image-url);
20
46
  } @else if list.length($filter-color) > 1 {
21
47
  $color-list: ();
22
48
  @for $i from 1 through list.length($filter-color) {
@@ -28,22 +54,22 @@
28
54
  map.get($map-for-directions, $filter-direction),
29
55
  $color-list
30
56
  ),
31
- url($image-url);
57
+ -image($image-url);
32
58
  } @else {
33
59
  @if meta.type-of($filter-direction) == "number" and list.index("deg", math.unit($filter-direction)) {
34
60
  background-image: linear-gradient($filter-direction, $color-list),
35
- url($image-url);
61
+ -image($image-url);
36
62
  } @else {
37
63
  @error "`#{$filter-direction}` is not a valid $filter-direction. Pass an angle such as `45deg`, or one of: #{map.keys($map-for-directions)}.";
38
64
  }
39
65
  }
40
66
  } @else {
41
67
  background-image: linear-gradient(to top, $color-list),
42
- url($image-url);
68
+ -image($image-url);
43
69
  }
44
70
  }
45
71
  } @else {
46
- background-image: url($image-url);
72
+ background-image: -image($image-url);
47
73
  }
48
74
  } @else {
49
75
  position: relative;
@@ -5,12 +5,51 @@
5
5
  @use "sass:meta";
6
6
  @use "sass:string";
7
7
 
8
+ // An image path goes into url(). A var(), url(), image-set() or gradient is
9
+ // already an image, and wrapping it produced url(var(--x)), which loads nothing.
10
+ @function -image($value) {
11
+ @if -is-css-function($value, "var" "url" "image-set" "linear-gradient" "radial-gradient" "conic-gradient" "repeating-linear-gradient" "repeating-radial-gradient" "repeating-conic-gradient") {
12
+ @return $value;
13
+ }
14
+ @return url(string.unquote($value));
15
+ }
16
+
17
+ // True for an unquoted call to one of $names, such as var(--x). A quoted string
18
+ // stays text, so `"var(--x)"` is not a call.
19
+ @function -is-css-function($value, $names) {
20
+ @if meta.type-of($value) != "string" or string.slice(meta.inspect($value), 1, 1) == "\"" {
21
+ @return false;
22
+ }
23
+ $open: string.index($value, "(");
24
+ @return $open != null and list.index($names, string.to-lower-case(string.slice($value, 1, $open - 1))) != null;
25
+ }
26
+
27
+ // A size Sass can use inside calc(): a number, a calculation such as calc(),
28
+ // min() or clamp(), or var() and env(), which only the browser can resolve.
29
+ // Anything else would pass silently through calc(): `calc(nonsense * 5)`
30
+ // compiles.
31
+ @function -is-size($value) {
32
+ @if meta.type-of($value) == "number" or meta.type-of($value) == "calculation" {
33
+ @return true;
34
+ }
35
+ @if meta.type-of($value) == "string" and string.slice(meta.inspect($value), 1, 1) != "\"" {
36
+ $open: string.index($value, "(");
37
+ @return $open != null and list.index("var" "env", string.to-lower-case(string.slice($value, 1, $open - 1))) != null;
38
+ }
39
+ @return false;
40
+ }
41
+
8
42
  @mixin background-stripes(
9
43
  $color: null,
10
44
  $thickness: 1em,
11
45
  $rotation: -45deg,
12
46
  $image: null
13
47
  ) {
48
+ // The arithmetic below runs in calc() so var() and clamp() work; on plain
49
+ // lengths Sass simplifies it back to the same number.
50
+ @if not -is-size($thickness) {
51
+ @error "`#{meta.inspect($thickness)}` is not a valid $thickness for `background-stripes`. Pass a length, or var(), env() or a calculation such as `clamp()`.";
52
+ }
14
53
  @if meta.type-of($rotation) != "number" {
15
54
  @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.";
16
55
  }
@@ -18,7 +57,7 @@
18
57
  @error "`#{$image}` is not a valid $image for `background-stripes`. Pass an image path as a string.";
19
58
  }
20
59
  $validate-unit: if(not list.index("deg", math.unit($rotation)), $rotation + deg, $rotation);
21
- $get-image: if($image, string.unquote(", ") + url(string.unquote($image)), string.unquote(""));
60
+ $get-image: if($image, string.unquote(", ") + -image($image), string.unquote(""));
22
61
  @if not $color {
23
62
  $color: rgba(0, 0, 0, 0.1);
24
63
  background-image: repeating-linear-gradient(
@@ -26,7 +65,7 @@
26
65
  $color 0,
27
66
  $color $thickness,
28
67
  transparent $thickness,
29
- transparent $thickness * 2
68
+ transparent calc($thickness * 2)
30
69
  ) + $get-image;
31
70
  @if $image {
32
71
  background-position: center;
@@ -39,7 +78,7 @@
39
78
  $color 0,
40
79
  $color $thickness,
41
80
  transparent $thickness,
42
- transparent $thickness * 2
81
+ transparent calc($thickness * 2)
43
82
  ) + $get-image;
44
83
  @if $image {
45
84
  background-position: center;
@@ -50,7 +89,7 @@
50
89
  $list: ();
51
90
  @for $i from 1 through list.length($color) {
52
91
  $index-color: list.nth($color, $i);
53
- $style-rule: $index-color ($thickness * $i) - $thickness, $index-color $thickness * $i;
92
+ $style-rule: $index-color calc($thickness * $i - $thickness), $index-color calc($thickness * $i);
54
93
  $list: list.append($list, $style-rule, comma);
55
94
  }
56
95
  background-image: repeating-linear-gradient($validate-unit, $list) + $get-image;
@@ -1,14 +1,29 @@
1
1
  @charset "UTF-8";
2
2
 
3
+ @use "sass:list";
3
4
  @use "sass:meta";
4
5
  @use "sass:string";
5
6
 
7
+ // True for an unquoted call to one of $names, such as var(--x). A quoted string
8
+ // stays text, so `"var(--x)"` is not a call.
9
+ @function -is-css-function($value, $names) {
10
+ @if meta.type-of($value) != "string" or string.slice(meta.inspect($value), 1, 1) == "\"" {
11
+ @return false;
12
+ }
13
+ $open: string.index($value, "(");
14
+ @return $open != null and list.index($names, string.to-lower-case(string.slice($value, 1, $open - 1))) != null;
15
+ }
16
+
6
17
  @mixin before($content: null) {
7
18
  &::before {
8
19
  @if $content == null {
9
20
  @content;
10
21
  } @else if meta.type-of($content) != "string" {
11
22
  @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.";
23
+ } @else if -is-css-function($content, "var" "attr" "counter" "counters") {
24
+ // Quoting would turn the call into text: content: "var(--label)".
25
+ content: $content;
26
+ @content;
12
27
  } @else {
13
28
  $data: string.slice($content, 1, 5);
14
29
  @if $data == "data-" {
@@ -1,14 +1,37 @@
1
1
  @charset "UTF-8";
2
2
 
3
+ @use "sass:list";
4
+ @use "sass:meta";
5
+ @use "sass:string";
6
+
3
7
  @use "../library/stretched-link" as *;
4
8
 
9
+ // An image path goes into url(). A var(), url(), image-set() or gradient is
10
+ // already an image, and wrapping it produced url(var(--x)), which loads nothing.
11
+ @function -image($value) {
12
+ @if -is-css-function($value, "var" "url" "image-set" "linear-gradient" "radial-gradient" "conic-gradient" "repeating-linear-gradient" "repeating-radial-gradient" "repeating-conic-gradient") {
13
+ @return $value;
14
+ }
15
+ @return url($value);
16
+ }
17
+
18
+ // True for an unquoted call to one of $names, such as var(--x). A quoted string
19
+ // stays text, so `"var(--x)"` is not a call.
20
+ @function -is-css-function($value, $names) {
21
+ @if meta.type-of($value) != "string" or string.slice(meta.inspect($value), 1, 1) == "\"" {
22
+ @return false;
23
+ }
24
+ $open: string.index($value, "(");
25
+ @return $open != null and list.index($names, string.to-lower-case(string.slice($value, 1, $open - 1))) != null;
26
+ }
27
+
5
28
  @mixin brand-logo($width, $height, $image-url: null) {
6
29
  display: inline-block;
7
30
  position: relative;
8
31
  width: $width;
9
32
  height: $height;
10
33
  @if $image-url {
11
- background-image: url($image-url);
34
+ background-image: -image($image-url);
12
35
  }
13
36
  background-position: center;
14
37
  background-repeat: no-repeat;
@@ -2,10 +2,35 @@
2
2
 
3
3
  @use "sass:list";
4
4
  @use "sass:map";
5
+ @use "sass:meta";
6
+ @use "sass:string";
5
7
  @use "../maps/map-for-breakpoints" as *;
6
8
  @use "../utilities/validate-breakpoint" as *;
7
9
 
10
+ // Returns the first value in $value that holds var(), looking inside lists and
11
+ // calculations, or null. Custom properties are not evaluated in a @media or
12
+ // @container condition, so a rule built from one never applies, and nothing
13
+ // warns. Measured in Chrome 152: `(min-width: var(--wide))` did not match with
14
+ // `--wide: 200px`, while `(min-width: 200px)` did.
15
+ @function -custom-property-in($value) {
16
+ @each $item in $value {
17
+ @if meta.type-of($item) == "list" or meta.type-of($item) == "arglist" {
18
+ $found: -custom-property-in($item);
19
+ @if $found {
20
+ @return $found;
21
+ }
22
+ } @else if string.index(meta.inspect($item), "var(") {
23
+ @return $item;
24
+ }
25
+ }
26
+ @return null;
27
+ }
28
+
8
29
  @mixin breakpoint($params...) {
30
+ $custom-property: -custom-property-in($params);
31
+ @if $custom-property {
32
+ @error "`#{$custom-property}` cannot be used in a breakpoint: custom properties are not evaluated in a @media condition, so the rule would never apply. Pass a length or a key from $map-for-breakpoints.";
33
+ }
9
34
  @if list.length($params) == 1 {
10
35
  $value: list.nth($params, 1);
11
36
  @if map.has-key($map-for-breakpoints, $value) {
@@ -65,5 +90,9 @@
65
90
  }
66
91
  }
67
92
  }
93
+ } @else {
94
+ // Anything else used to match no branch and emit nothing, so a three
95
+ // argument range such as `between, medium, large` failed without a sound.
96
+ @error "`breakpoint` takes one or two arguments; you passed #{list.length($params)}. For a range, pass `between` with a space-separated pair, `between, medium large`, or two sizes, `medium, large`.";
68
97
  }
69
98
  }
@@ -0,0 +1,86 @@
1
+ @charset "UTF-8";
2
+
3
+ @use "sass:list";
4
+ @use "sass:map";
5
+ @use "sass:meta";
6
+ @use "sass:string";
7
+ @use "../maps/map-for-breakpoints" as *;
8
+ @use "../utilities/validate-breakpoint" as *;
9
+
10
+ // Returns the first value in $value that holds var(), looking inside lists and
11
+ // calculations, or null. Custom properties are not evaluated in a @media or
12
+ // @container condition, so a rule built from one never applies, and nothing
13
+ // warns. Measured in Chrome 152: `(min-width: var(--wide))` did not match with
14
+ // `--wide: 200px`, while `(min-width: 200px)` did.
15
+ @function -custom-property-in($value) {
16
+ @each $item in $value {
17
+ @if meta.type-of($item) == "list" or meta.type-of($item) == "arglist" {
18
+ $found: -custom-property-in($item);
19
+ @if $found {
20
+ @return $found;
21
+ }
22
+ } @else if string.index(meta.inspect($item), "var(") {
23
+ @return $item;
24
+ }
25
+ }
26
+ @return null;
27
+ }
28
+
29
+ // A @container rule, taking the same argument shapes as `breakpoint` so the two
30
+ // read alike. Sizes may be a key from $map-for-breakpoints or a raw length; a
31
+ // container is usually narrower than the viewport, so a length is the common
32
+ // case.
33
+ //
34
+ // Pass $name to query one named container rather than the nearest ancestor.
35
+ // The container itself is declared with the `container` mixin, on an ancestor
36
+ // of whatever this styles.
37
+ @mixin container-query($params...) {
38
+ $keywords: meta.keywords($params);
39
+ $name: map.get($keywords, name);
40
+ $count: list.length($params);
41
+
42
+ @if $name != null and meta.type-of($name) != "string" {
43
+ @error "`#{$name}` is not a valid $name for `container-query`. Pass a container name as a string, such as `\"card\"`.";
44
+ }
45
+
46
+ $custom-property: -custom-property-in($params);
47
+ @if $custom-property {
48
+ @error "`#{$custom-property}` cannot be used in a container query: custom properties are not evaluated in a @container condition, so the rule would never apply. Pass a length or a key from $map-for-breakpoints.";
49
+ }
50
+ $condition: null;
51
+
52
+ @if $count == 1 {
53
+ $condition: "(width: #{validateBreakpoint(list.nth($params, 1))})";
54
+ } @else if $count == 2 {
55
+ $mode: list.nth($params, 1);
56
+ @if not list.index("only" "min" "max" "between", $mode) {
57
+ // Two bare sizes mean a range, as they do in `breakpoint`.
58
+ $condition: "(min-width: #{validateBreakpoint($mode)}) and (max-width: #{validateBreakpoint(list.nth($params, 2))})";
59
+ } @else {
60
+ $value: list.nth($params, 2);
61
+ @if $mode == "only" {
62
+ $condition: "(width: #{validateBreakpoint($value)})";
63
+ } @else if $mode == "min" {
64
+ $condition: "(min-width: #{validateBreakpoint($value)})";
65
+ } @else if $mode == "max" {
66
+ $condition: "(max-width: #{validateBreakpoint($value)})";
67
+ } @else {
68
+ $start: list.nth($value, 1);
69
+ $end: list.nth($value, 2);
70
+ $condition: "(min-width: #{validateBreakpoint($start)}) and (max-width: #{validateBreakpoint($end)})";
71
+ }
72
+ }
73
+ } @else {
74
+ @error "`container-query` takes one or two arguments, and was given #{$count}. Pass a size, two sizes for a range, or one of `min`, `max`, `only` or `between` followed by a size.";
75
+ }
76
+
77
+ @if $name {
78
+ @container #{string.unquote($name)} #{$condition} {
79
+ @content;
80
+ }
81
+ } @else {
82
+ @container #{$condition} {
83
+ @content;
84
+ }
85
+ }
86
+ }
@@ -0,0 +1,26 @@
1
+ @charset "UTF-8";
2
+
3
+ @use "sass:list";
4
+ @use "sass:meta";
5
+ @use "sass:string";
6
+
7
+ // Marks an element as a query container, so `container-query` can ask about its
8
+ // width instead of the viewport's.
9
+ //
10
+ // The rule that asks has to sit on a descendant. An element is not matched by a
11
+ // @container rule that reads its own container, and nothing warns you: the rule
12
+ // is simply never applied. Measured in a browser, a 600px element with
13
+ // `container-type: inline-size` on itself did not match `@container (min-width:
14
+ // 400px)`, while the same query did match a child of it.
15
+ @mixin container($name: null, $type: inline-size) {
16
+ @if not list.index("inline-size" "size" "normal", $type) {
17
+ @error "`#{$type}` is not a valid $type for `container`. Pass one of: inline-size, size, normal.";
18
+ }
19
+ @if $name != null and meta.type-of($name) != "string" {
20
+ @error "`#{$name}` is not a valid $name for `container`. Pass a name as a string, such as `\"card\"`, or no name at all.";
21
+ }
22
+ container-type: $type;
23
+ @if $name {
24
+ container-name: string.unquote($name);
25
+ }
26
+ }
@@ -1,8 +1,20 @@
1
1
  @charset "UTF-8";
2
2
 
3
3
  @use "sass:list";
4
+ @use "sass:meta";
5
+ @use "sass:string";
4
6
  @use "../lists/list-of-counter-styles" as *;
5
7
 
8
+ // True for an unquoted call to one of $names, such as var(--x). A quoted string
9
+ // stays text, so `"var(--x)"` is not a call.
10
+ @function -is-css-function($value, $names) {
11
+ @if meta.type-of($value) != "string" or string.slice(meta.inspect($value), 1, 1) == "\"" {
12
+ @return false;
13
+ }
14
+ $open: string.index($value, "(");
15
+ @return $open != null and list.index($names, string.to-lower-case(string.slice($value, 1, $open - 1))) != null;
16
+ }
17
+
6
18
  @mixin counter($params...) {
7
19
  $counter: null;
8
20
  $counter-before: null;
@@ -33,15 +45,25 @@
33
45
  }
34
46
  }
35
47
 
48
+ // A prefix or suffix is quoted into text, except a call CSS resolves, which
49
+ // quoting would turn into the literal characters.
50
+ $quote-before: '"';
51
+ $quote-after: '"';
52
+ @if -is-css-function($counter-before, "var" "attr" "counter" "counters") {
53
+ $quote-before: "";
54
+ }
55
+ @if -is-css-function($counter-after, "var" "attr" "counter" "counters") {
56
+ $quote-after: "";
57
+ }
36
58
  &.counter-start {
37
59
  counter-reset: glsCounter;
38
60
  }
39
61
  &.counter-start .counter-item::before,
40
62
  &.counter-continue .counter-item::before {
41
- content: #{if($counter-before, '"' + $counter-before + '"' + " ", null)}counter(
63
+ content: #{if($counter-before, $quote-before + $counter-before + $quote-before + " ", null)}counter(
42
64
  glsCounter#{if($counter, ", " + $counter, null)}
43
65
  )
44
- #{if($counter-after, " " + '"' + $counter-after + '"', null)};
66
+ #{if($counter-after, " " + $quote-after + $counter-after + $quote-after, null)};
45
67
  counter-increment: glsCounter;
46
68
  @content;
47
69
  }
@@ -1,8 +1,10 @@
1
1
  @charset "UTF-8";
2
2
 
3
3
  @use "sass:list";
4
+ @use "sass:map";
4
5
  @use "sass:meta";
5
6
  @use "sass:string";
7
+ @use "../maps/map-for-font-formats" as *;
6
8
  @use "../utilities/font-source" as *;
7
9
 
8
10
  @mixin font-face(
@@ -18,6 +20,10 @@
18
20
  @error "`#{$font-family}` is not a valid $font-family for `font-face`. Pass the family name as a string, such as `\"Inter\"`.";
19
21
  } @else if meta.type-of($file-path) != "string" {
20
22
  @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.";
23
+ } @else if string.slice(meta.inspect($file-path), 1, 1) != "\"" and string.index($file-path, "var(") {
24
+ // The path is written into url("..."), where var() is only text: the
25
+ // browser would request a file literally named var(--x).woff2.
26
+ @error "`#{$file-path}` is not a valid $file-path for `font-face`. A custom property cannot supply a font path, because the path is written into url() as text. Pass the path as a string.";
21
27
  } @else {
22
28
 
23
29
  $list: ();
@@ -42,6 +48,14 @@
42
48
  }
43
49
  }
44
50
 
51
+ // fontSource returns nothing for a format it does not know, so a typo
52
+ // dropped that source and a list of nothing but typos dropped `src`.
53
+ @each $format in $file-formats {
54
+ @if not map.has-key($map-for-font-formats, $format) {
55
+ @error "`#{meta.inspect($format)}` is not a valid file format for `font-face`. Pass one or more of: #{map.keys($map-for-font-formats)}.";
56
+ }
57
+ }
58
+
45
59
  @font-face {
46
60
  font-family: $font-family;
47
61
  @if list.index($file-formats, eot) {
@@ -19,12 +19,15 @@
19
19
  @forward "circle";
20
20
  @forward "clearfix";
21
21
  @forward "columnizer";
22
+ @forward "container";
23
+ @forward "container-query";
22
24
  @forward "counter";
23
25
  @forward "ellipsis";
24
26
  @forward "escape-to-parent";
25
27
  @forward "except";
26
28
  @forward "font-face";
27
29
  @forward "hide";
30
+ @forward "line-clamp";
28
31
  @forward "linear-gradient";
29
32
  @forward "loadify";
30
33
  @forward "only";