@enigmatry/scss-foundation 17.2.0 → 17.2.1-preview.4

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,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1726734930421" clover="3.2.0">
3
- <project timestamp="1726734930421" name="All files">
2
+ <coverage generated="1727770589363" clover="3.2.0">
3
+ <project timestamp="1727770589363" name="All files">
4
4
  <metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="0" coveredelements="0" complexity="0" loc="0" ncloc="0" packages="0" files="0" classes="0"/>
5
5
  </project>
6
6
  </coverage>
@@ -86,7 +86,7 @@
86
86
  <div class='footer quiet pad2 space-top1 center small'>
87
87
  Code coverage generated by
88
88
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
89
- at 2024-09-19T08:35:30.418Z
89
+ at 2024-10-01T08:16:29.357Z
90
90
  </div>
91
91
  <script src="prettify.js"></script>
92
92
  <script>
@@ -13,7 +13,9 @@ Utilities are nothing more than just sass mixins that won't be included in your
13
13
  - [Absolute Positioning utilities](./absolute-positioning.md)
14
14
  - [Fixed Positioning utilities](./fixed-positioning.md)
15
15
  - [Text Modification utilities](./text-modification.md)
16
+ - [Typography utilities](./typography.md)
16
17
  - [Text Hover utilities](./text-hover.md)
17
18
  - [Border Radius utilities](./border-radius.md)
18
19
  - [Row Coloring utilities](./row-coloring.md)
20
+ - [Sizing utilities](./sizes.md)
19
21
  - [Visibility utilities](./visibility.md)
@@ -4,14 +4,14 @@ Utilities for setting various sizing properties for elements.
4
4
 
5
5
  ## Set sizes
6
6
 
7
- @use scss-foundation/src/modules/sizes/set-sizes;
7
+ @use scss-foundation/src/modules/sizes/set-size;
8
8
 
9
9
  ### Box dimensions
10
10
 
11
11
  - Mixin for easily applying specified dimensions for width and height of an element and optional min/max constraints to shrink depending on the screen resizing.
12
12
 
13
13
  ```
14
- @include set-sizes.box-dimensions(width, 100px, 50px, 200px);
14
+ @include set-size.box-dimensions(width, 100px, 50px, 200px);
15
15
  ```
16
16
 
17
17
  Sets width property and their min and max values.
@@ -27,7 +27,7 @@ max-width: 200px;
27
27
  - A comprehensive mixin for defining both the width and height properties of an element. Sets width and height along with optional min and max values for both dimensions, providing a flexible way to manage element sizing.
28
28
 
29
29
  ```
30
- @include set-sizes.box-definition(300px, 200px, 250px, 350px, 150px, 250px);
30
+ @include set-size.box-definition(300px, 200px, 250px, 350px, 150px, 250px);
31
31
  ```
32
32
 
33
33
  Sets width and height along with their respective min and max values.
@@ -0,0 +1,29 @@
1
+ # Typography method
2
+
3
+ Utilities for setting font properties for elements.
4
+
5
+ ## Fonts
6
+
7
+ @use scss-foundation/src/modules/typography/fonts;
8
+
9
+ ### Set fonts
10
+
11
+ The `define-font` mixin provides a simple way to apply font properties such as family, size, and weight to an element. It allows for flexibility by enabling customization of each property. It requires **at least two** of the font properties to be provided. If this condition is not met, an error will be thrown.
12
+
13
+ ```
14
+ @include fonts.define-font('Roboto', 18px, 700);
15
+ ```
16
+
17
+ Sets the font family, size, and weight properties.
18
+
19
+ ```
20
+ font-family: 'Roboto';
21
+ font-size: 18px;
22
+ font-weight: 700;
23
+ ```
24
+
25
+ If you only want to set certain properties, you can skip others by using named arguments:
26
+
27
+ ```
28
+ @include fonts.define-font($size: 30px, $weight: bold);
29
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enigmatry/scss-foundation",
3
- "version": "17.2.0",
3
+ "version": "17.2.1-preview.4",
4
4
  "author": "Enigmatry",
5
5
  "description": "Collection of SCSS utilities useful for the most of projects.",
6
6
  "homepage": "https://github.com/enigmatry/entry-angular-building-blocks/tree/master/libs/scss-foundation#readme",
@@ -4,6 +4,7 @@
4
4
  @use 'sizes';
5
5
  @use 'responsiveness';
6
6
  @use 'text';
7
+ @use 'typography';
7
8
  @use 'lists';
8
9
  @use 'borders';
9
10
  @use 'states';
@@ -0,0 +1,26 @@
1
+ @use 'sass-true';
2
+ @use 'sass-true/sass/throw';
3
+ @use '../../modules/variables' as vars;
4
+
5
+ @mixin define-font($family: null, $size: null, $weight: null) {
6
+ @if ($family and $size) or ($family and $weight) or ($size and $weight) {
7
+ $properties: (
8
+ 'family': $family,
9
+ 'size': $size,
10
+ 'weight': $weight
11
+ );
12
+
13
+ @each $property, $value in $properties {
14
+ @if $value {
15
+ font-#{$property}: $value;
16
+ }
17
+ }
18
+ }
19
+ @else {
20
+ @include throw.error(
21
+ $message: 'At least two of the font properties must be provided.',
22
+ $source: 'define-font($family, $size, $weight)',
23
+ $catch: vars.$testing
24
+ );
25
+ }
26
+ }
@@ -0,0 +1 @@
1
+ @use 'fonts';
@@ -0,0 +1,69 @@
1
+ @use 'sass-true' as true;
2
+ @use '../../src/modules/typography/fonts';
3
+ @use '../../src/modules/variables' as vars;
4
+
5
+ vars.$testing: true;
6
+
7
+ @include true.describe('define-font($family, $size, $weight)') {
8
+ @include true.it('should set the font family and size') {
9
+ @include true.assert() {
10
+ @include true.output() {
11
+ @include fonts.define-font('Arial', 14px);
12
+ }
13
+ @include true.expect() {
14
+ font-family: 'Arial';
15
+ font-size: 14px;
16
+ }
17
+ }
18
+ }
19
+
20
+ @include true.it('should set the font family and weight') {
21
+ @include true.assert() {
22
+ @include true.output() {
23
+ @include fonts.define-font($family: 'Arial', $weight: 400);
24
+ }
25
+ @include true.expect() {
26
+ font-family: 'Arial';
27
+ font-weight: 400;
28
+ }
29
+ }
30
+ }
31
+
32
+ @include true.it('should set the font family, size, and weight') {
33
+ @include true.assert() {
34
+ @include true.output() {
35
+ @include fonts.define-font('Arial', 18px, 700);
36
+ }
37
+ @include true.expect() {
38
+ font-family: 'Arial';
39
+ font-size: 18px;
40
+ font-weight: 700;
41
+ }
42
+ }
43
+ }
44
+
45
+ @include true.it('should set the font size and weight') {
46
+ @include true.assert() {
47
+ @include true.output() {
48
+ @include fonts.define-font($size: 18px, $weight: 700);
49
+ }
50
+ @include true.expect() {
51
+ font-size: 18px;
52
+ font-weight: 700;
53
+ }
54
+ }
55
+ }
56
+
57
+ @include true.it('should throw an error if only one property is defined') {
58
+ @include true.assert() {
59
+ @include true.output() {
60
+ @include fonts.define-font('Arial');
61
+ }
62
+
63
+ @include true.contains() {
64
+ /* ERROR [define-font($family, $size, $weight)]: */
65
+ /* At least two of the font properties must be provided. */
66
+ }
67
+ }
68
+ }
69
+ }