beathers 5.7.2 → 5.7.6

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.
@@ -1,129 +1,129 @@
1
- @use 'sass:string';
2
- @use 'sass:map';
3
- @use '../variables' as vars;
4
- @use '../settings/defaults' as defs;
5
- @use '../functions/validations' as val;
6
- @use '../settings/configs' as configs;
7
-
8
- // Definitions
9
- $fontMainPath: if(vars.$fontMainPath != null, vars.$fontMainPath, defs.$fontMainPath);
10
-
11
- // Font Face Mixin
12
- // --------------------------------------
13
- // Generates an @font-face rule.
14
- //
15
- // @param {String} $title - The base name of the font (e.g., "OpenSans").
16
- // @param {String} $weight - The font weight key (e.g., "regular", "bold").
17
- // @param {String} $format - The font file format (e.g., "woff2").
18
- // @param {String} $style - The font style (e.g., "normal", "italic").
19
- // @param {Number} $index [0] - An index appended to the font-family name if multiple fonts share the same weight name.
20
- // @param {String | Null} $unicode [null] - Optional unicode range for the font.
21
- // @param {Boolean} $isLocal [true] - Whether the font is hosted locally or externally.
22
- // @param {String} $externalUrl [""] - The URL for externally hosted fonts (if $isLocal is false).
23
- //
24
- // @example scss
25
- // @include font("OpenSans", "regular", "woff2", "normal", 0, null, true);
26
- // // Generates:
27
- // // @font-face {
28
- // // font-family: "regular"; // Or "regular-0" if $index is 0 but other fonts exist with same weight
29
- // // font-weight: 400;
30
- // // font-style: normal;
31
- // // font-display: swap;
32
- // // src: local("OpenSans-regular"),
33
- // // url("../fonts/OpenSans-regular.woff2") format("woff2");
34
- // // }
35
- //
36
- // @include font("Roboto", "bold", "ttf", "normal", 1, "U+000-5FF", false, "https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfBBc4.ttf");
37
- // // Generates:
38
- // // @font-face {
39
- // // font-family: "bold-1";
40
- // // font-weight: 700;
41
- // // font-style: normal;
42
- // // font-display: swap;
43
- // // src: url("https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfBBc4.ttf");
44
- // // unicode-range: U+000-5FF;
45
- // // }
46
- //
47
- @mixin font($key, $title, $weight, $format, $style, $index: 0, $unicode: null, $isLocal: true, $externalUrl: '') {
48
- // Validate parameters
49
- $checkedIsLocal: val.boolean($isLocal, '#{$title}.font().local');
50
- $checkedTitle: val.string($title, '#{$title}.font().title');
51
- $checkedWeight: val.mapItem(
52
- configs.$fontWeightsValues,
53
- $weight,
54
- configs.$fontWeightsValues,
55
- 'Typographic.fontFace.weights.#{$weight}'
56
- );
57
- $checkedStyle: val.listItem(('normal', 'italic', 'oblique'), $style, '#{$title}.font().weights.#{$style}');
58
- $checkIndex: val.number($index, '#{$title}.font().index');
59
- $checkedFormat: val.string($format, '#{$title}.font().format');
60
-
61
- @if (not($isLocal)) {
62
- $checkedExternalUrl: val.string($externalUrl, 'Typographic.fontFace.externalUrl');
63
- }
64
-
65
- $name: if($index == 0, $title, '#{$key}\:#{$title}');
66
- $weightValue: map.get(configs.$fontWeightsValues, $weight);
67
-
68
- @font-face {
69
- font-family: $name;
70
- font-weight: $weightValue;
71
- font-style: $style;
72
- font-display: swap;
73
-
74
- @if ($isLocal) {
75
- src:
76
- local('#{$title}-#{$weight}'),
77
- url(string.unquote('#{$fontMainPath}#{$title}-#{$weight}.#{$format}')) format('#{$format}');
78
- } @else {
79
- src: url(string.unquote('#{$externalUrl}'));
80
- }
81
-
82
- @if $unicode {
83
- // Validate parameters
84
- $checkedUnicode: val.string($unicode, '#{$title}.font().unicode');
85
-
86
- unicode-range: string.unquote($unicode);
87
- }
88
- }
89
- }
90
-
91
- // Font Shapes Mixin
92
- // --------------------------------------
93
- // Applies text transformation, decoration, or style properties to a class.
94
- //
95
- // @param {String} $class - The CSS class name to apply the style to.
96
- // @param {String} $type - The type of shape property ("transform", "decoration", "styles").
97
- // @param {String} $value - The value for the shape property (e.g., "uppercase", "underline", "italic").
98
- // @param {String | Null} $size [null] - Optional size prefix for responsive classes, determines if `!important` is added.
99
- //
100
- // @example scss
101
- // @include fontShapes("uppercase", "transform", "uppercase");
102
- // // Generates:
103
- // // .uppercase {
104
- // // text-transform: uppercase;
105
- // // }
106
- //
107
- // @include fontShapes("md:underline", "decoration", "underline", "md");
108
- // // Generates:
109
- // // .md\\:underline {
110
- // // text-decoration: underline !important;
111
- // // }
112
- //
113
- @mixin fontShapes($class, $type, $value) {
114
- $shapeList: map.get(configs.$fontShapes, $type);
115
-
116
- // Validate parameters
117
- $checkedType: val.mapItem(configs.$fontShapes, $type, configs.$fontShapes, 'fontShapes().#{$type}');
118
- $checkedValue: val.listItem($shapeList, $value, 'fontShapes().#{$value}');
119
-
120
- .#{$class} {
121
- @if $type == 'transform' {
122
- text-transform: $value;
123
- } @else if $type == 'decoration' {
124
- text-decoration: $value;
125
- } @else if $type == 'styles' {
126
- font-style: $value;
127
- }
128
- }
129
- }
1
+ @use 'sass:string';
2
+ @use 'sass:map';
3
+ @use '../variables' as vars;
4
+ @use '../settings/defaults' as defs;
5
+ @use '../functions/validations' as val;
6
+ @use '../settings/configs' as configs;
7
+
8
+ // Definitions
9
+ $fontMainPath: if(vars.$fontMainPath != null, vars.$fontMainPath, defs.$fontMainPath);
10
+
11
+ // Font Face Mixin
12
+ // --------------------------------------
13
+ // Generates an @font-face rule.
14
+ //
15
+ // @param {String} $title - The base name of the font (e.g., "OpenSans").
16
+ // @param {String} $weight - The font weight key (e.g., "regular", "bold").
17
+ // @param {String} $format - The font file format (e.g., "woff2").
18
+ // @param {String} $style - The font style (e.g., "normal", "italic").
19
+ // @param {Number} $index [0] - An index appended to the font-family name if multiple fonts share the same weight name.
20
+ // @param {String | Null} $unicode [null] - Optional unicode range for the font.
21
+ // @param {Boolean} $isLocal [true] - Whether the font is hosted locally or externally.
22
+ // @param {String} $externalUrl [""] - The URL for externally hosted fonts (if $isLocal is false).
23
+ //
24
+ // @example scss
25
+ // @include font("OpenSans", "regular", "woff2", "normal", 0, null, true);
26
+ // // Generates:
27
+ // // @font-face {
28
+ // // font-family: "regular"; // Or "regular-0" if $index is 0 but other fonts exist with same weight
29
+ // // font-weight: 400;
30
+ // // font-style: normal;
31
+ // // font-display: swap;
32
+ // // src: local("OpenSans-regular"),
33
+ // // url("../fonts/OpenSans-regular.woff2") format("woff2");
34
+ // // }
35
+ //
36
+ // @include font("Roboto", "bold", "ttf", "normal", 1, "U+000-5FF", false, "https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfBBc4.ttf");
37
+ // // Generates:
38
+ // // @font-face {
39
+ // // font-family: "bold-1";
40
+ // // font-weight: 700;
41
+ // // font-style: normal;
42
+ // // font-display: swap;
43
+ // // src: url("https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfBBc4.ttf");
44
+ // // unicode-range: U+000-5FF;
45
+ // // }
46
+ //
47
+ @mixin font($key, $title, $weight, $format, $style, $index: 0, $unicode: null, $isLocal: true, $externalUrl: '') {
48
+ // Validate parameters
49
+ $checkedIsLocal: val.boolean($isLocal, '#{$title}.font().local');
50
+ $checkedTitle: val.string($title, '#{$title}.font().title');
51
+ $checkedWeight: val.mapItem(
52
+ configs.$fontWeightsValues,
53
+ $weight,
54
+ configs.$fontWeightsValues,
55
+ 'Typographic.fontFace.weights.#{$weight}'
56
+ );
57
+ $checkedStyle: val.listItem(('normal', 'italic', 'oblique'), $style, '#{$title}.font().weights.#{$style}');
58
+ $checkIndex: val.number($index, '#{$title}.font().index');
59
+ $checkedFormat: val.string($format, '#{$title}.font().format');
60
+
61
+ @if (not($isLocal)) {
62
+ $checkedExternalUrl: val.string($externalUrl, 'Typographic.fontFace.externalUrl');
63
+ }
64
+
65
+ $name: if($index == 0, $title, '#{$key}\:#{$title}');
66
+ $weightValue: map.get(configs.$fontWeightsValues, $weight);
67
+
68
+ @font-face {
69
+ font-family: $name;
70
+ font-weight: $weightValue;
71
+ font-style: $style;
72
+ font-display: swap;
73
+
74
+ @if ($isLocal) {
75
+ src:
76
+ local('#{$title}-#{$weight}'),
77
+ url(string.unquote('#{$fontMainPath}#{$title}-#{$weight}.#{$format}')) format('#{$format}');
78
+ } @else {
79
+ src: url(string.unquote('#{$externalUrl}'));
80
+ }
81
+
82
+ @if $unicode {
83
+ // Validate parameters
84
+ $checkedUnicode: val.string($unicode, '#{$title}.font().unicode');
85
+
86
+ unicode-range: string.unquote($unicode);
87
+ }
88
+ }
89
+ }
90
+
91
+ // Font Shapes Mixin
92
+ // --------------------------------------
93
+ // Applies text transformation, decoration, or style properties to a class.
94
+ //
95
+ // @param {String} $class - The CSS class name to apply the style to.
96
+ // @param {String} $type - The type of shape property ("transform", "decoration", "styles").
97
+ // @param {String} $value - The value for the shape property (e.g., "uppercase", "underline", "italic").
98
+ // @param {String | Null} $size [null] - Optional size prefix for responsive classes, determines if `!important` is added.
99
+ //
100
+ // @example scss
101
+ // @include fontShapes("uppercase", "transform", "uppercase");
102
+ // // Generates:
103
+ // // .uppercase {
104
+ // // text-transform: uppercase;
105
+ // // }
106
+ //
107
+ // @include fontShapes("md:underline", "decoration", "underline", "md");
108
+ // // Generates:
109
+ // // .md\\:underline {
110
+ // // text-decoration: underline !important;
111
+ // // }
112
+ //
113
+ @mixin fontShapes($class, $type, $value) {
114
+ $shapeList: map.get(configs.$fontShapes, $type);
115
+
116
+ // Validate parameters
117
+ $checkedType: val.mapItem(configs.$fontShapes, $type, configs.$fontShapes, 'fontShapes().#{$type}');
118
+ $checkedValue: val.listItem($shapeList, $value, 'fontShapes().#{$value}');
119
+
120
+ .#{$class} {
121
+ @if $type == 'transform' {
122
+ text-transform: $value;
123
+ } @else if $type == 'decoration' {
124
+ text-decoration: $value;
125
+ } @else if $type == 'styles' {
126
+ font-style: $value;
127
+ }
128
+ }
129
+ }