@enigmatry/scss-foundation 1.2.30 → 1.2.32

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/.stylelintrc.json CHANGED
@@ -18,7 +18,7 @@
18
18
  ]
19
19
  }
20
20
  ],
21
- "media-feature-name-allowed-list": ["width"],
21
+ "media-feature-name-allowed-list": ["min-width", "width"],
22
22
  "scss/no-duplicate-dollar-variables": [
23
23
  true,
24
24
  {
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1680858076561" clover="3.2.0">
3
- <project timestamp="1680858076561" name="All files">
2
+ <coverage generated="1681222034850" clover="3.2.0">
3
+ <project timestamp="1681222034850" 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 2023-04-07T09:01:16.557Z
89
+ at 2023-04-11T14:07:14.847Z
90
90
  </div>
91
91
  <script src="prettify.js"></script>
92
92
  <script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enigmatry/scss-foundation",
3
- "version": "1.2.30",
3
+ "version": "1.2.32",
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/projects/scss-foundation#readme",
@@ -11,6 +11,7 @@
11
11
  "license": "Apache-2.0",
12
12
  "scripts": {
13
13
  "build": "sass --style=compressed --load-path=src src/partials/main.scss dist/scss-foundation.css",
14
+ "build-modules": "sass --style=compressed --load-path=src src/modules/_index.scss dist/scss-foundation-modules.css",
14
15
  "lint": "stylelint --fix src/**/*.scss",
15
16
  "test": "jest --coverage --colors"
16
17
  },
@@ -21,6 +22,9 @@
21
22
  "sass": "1.60.0",
22
23
  "sass-true": "7.0.0"
23
24
  },
25
+ "peerDependencies": {
26
+ "sass-true": "7.0.0"
27
+ },
24
28
  "publishConfig": {
25
29
  "access": "public"
26
30
  }
@@ -4,4 +4,9 @@ $default-breakpoints: (
4
4
  tablet: ( size: 768px, description: 'md' ),
5
5
  desktop: ( size: 992px, description: 'lg'),
6
6
  largeDesktop: ( size: 1200px, description: 'xl'),
7
- extraLargeDesktop: ( size: 1400px, description: 'xxl'));
7
+ extraLargeDesktop: ( size: 1400px, description: 'xxl'));
8
+
9
+ $custom-breakpoints: (
10
+ mobile: ( size: 540px, description: 'sm' ),
11
+ tablet: ( size: 800px, description: 'md' ),
12
+ );
@@ -1,5 +1,6 @@
1
+ $breakpoints: () !default;
1
2
  @use 'sass:map';
2
- @use '../responsiveness/breakpoints';
3
+ @use '../../modules/responsiveness/breakpoints' as breakpoints;
3
4
 
4
5
  @mixin generate($column-prefix, $offset-prefix, $spacing: 0) {
5
6
  .row {
@@ -10,7 +11,6 @@
10
11
  margin: 0 -#{$spacing};
11
12
  }
12
13
 
13
- /* stylelint-disable-next-line selector-max-attribute */
14
14
  [class ^= #{$column-prefix}], [class ^= #{$offset-prefix}] {
15
15
  flex-shrink: 0;
16
16
  max-width: 100%;
@@ -3,34 +3,47 @@ $breakpoints: () !default;
3
3
  @use 'sass:string';
4
4
  @use 'sass:map';
5
5
  @use 'sass:math';
6
- @use '../../modules/variables' as variables;
6
+ @use 'sass:meta';
7
+ @use '../../../node_modules/sass-true';
8
+ @use '../../../node_modules/sass-true/sass/throw';
9
+ @use '../../modules/variables' as vars;
7
10
  @forward '../../modules/responsiveness/breakpoints' with (
8
11
  $breakpoints: $breakpoints
9
12
  );
10
13
  @use '../../modules/responsiveness/breakpoints';
11
- @use '../../modules/text/modification' as text-modification;
12
14
  @use 'grid-core';
13
15
 
14
16
  @if length($breakpoints) == 0 {
15
- $breakpoints: variables.$default-breakpoints;
17
+ $breakpoints: vars.$default-breakpoints;
16
18
  }
17
19
 
18
20
  $column-prefix: 'col-';
19
21
  $offset-prefix: 'offset-';
20
22
 
21
23
  @mixin generate($spacing:0, $divisions: 12) {
22
- @if type-of($divisions) != number {
23
- @error 'Please provide number parameter for divisions! Given value: ' + $divisions;
24
+ @if meta.type-of($spacing) != number {
25
+ @include throw.error(
26
+ $message: 'Please provide number parameter! Given value: ' + $spacing,
27
+ $source: 'generate($spacing, $divisions)',
28
+ $catch: vars.$testing
29
+ );
24
30
  }
25
-
26
- @if ($divisions < 2 or $divisions > 1000) {
27
- @error 'Please provide positive number for divisions! Given value: ' + $divisions;
31
+ @else {
32
+ @if ((meta.type-of($divisions) != number) or (($divisions < 2) or ($divisions > 1000))) {
33
+ @include throw.error(
34
+ $message: 'Please provide positive number for divisions, between 2 and 1000! Given value: ' + $divisions,
35
+ $source: 'generate($spacing, $divisions)',
36
+ $catch: vars.$testing
37
+ );
38
+ }
39
+
40
+ @else {
41
+ @include grid-core.generate($column-prefix, $offset-prefix, $spacing);
42
+ @include grid-core.generate-reverse-row($breakpoints);
43
+ @include -unresponsive-grid-from($spacing, $divisions);
44
+ @include -responsive-grid-from($spacing, $divisions);
45
+ }
28
46
  }
29
-
30
- @include grid-core.generate($column-prefix, $offset-prefix, $spacing);
31
- @include grid-core.generate-reverse-row($breakpoints);
32
- @include -unresponsive-grid-from($spacing, $divisions);
33
- @include -responsive-grid-from($spacing, $divisions);
34
47
  }
35
48
 
36
49
  @function -calculate-ratio($counter, $divisions) {
@@ -1,3 +1,4 @@
1
+ /* stylelint-disable at-rule-allowed-list */
1
2
  $breakpoints: () !default;
2
3
 
3
4
  @use 'sass:list';
@@ -33,7 +34,6 @@ $breakpoints: () !default;
33
34
  }
34
35
 
35
36
  @mixin apply-on($given-size) {
36
- /* stylelint-disable-next-line at-rule-allowed-list */
37
37
  @media only screen and (width >= -get-size($given-size)) {
38
38
  @content;
39
39
  }
@@ -1,15 +1,15 @@
1
1
  @use 'sass:string';
2
2
  @use '../../modules/variables' as vars;
3
+ @use '../../../node_modules/sass-true';
4
+ @use 'sass:meta';
3
5
 
4
6
  @function capitalize($string) {
5
- @if type-of($string) != string {
6
- $error-message: 'Please provide string parameter! Given value: ' + $string;
7
-
8
- @if vars.$testing == true {
9
- @return $error-message;
10
- }
11
-
12
- @error $error-message;
7
+ @if meta.type-of($string) != string {
8
+ @return sass-true.error(
9
+ $message: 'Please provide string parameter! Given value: ' + $string,
10
+ $source: 'capitalize()',
11
+ $catch: vars.$testing
12
+ );
13
13
  }
14
14
 
15
15
  @return to-upper-case(str-slice($string, 1, 1)) + str-slice($string, 2);
@@ -0,0 +1,114 @@
1
+ /* stylelint-disable selector-max-attribute */
2
+ /* stylelint-disable csstools/use-nesting */
3
+ /* stylelint-disable shorthand-property-no-redundant-values */
4
+ /* stylelint-disable max-nesting-depth */
5
+ /* stylelint-disable at-rule-allowed-list */
6
+ $custom-breakpoints: () !default;
7
+
8
+ @use '../../node_modules/sass-true/sass/true';
9
+ @use '../../src/modules/variables' as vars;
10
+
11
+ @forward '../../src/modules/layout/grid' with (
12
+ $breakpoints: vars.$custom-breakpoints
13
+ );
14
+ @use '../../src/modules/responsiveness/breakpoints' as custom-breakpoints;
15
+ @use '../../src/modules/layout/grid-core';
16
+
17
+ @include true.describe('generate($column-prefix, $offset-prefix, $spacing)') {
18
+ @include true.it('should generate column and offset classes. If spacing not provided, padding should be 0.') {
19
+ @include true.assert() {
20
+ @include true.output() {
21
+ @include grid-core.generate('col-', 'offset-');
22
+ }
23
+
24
+ @include true.expect() {
25
+ .row {
26
+ display: flex;
27
+ flex-wrap: wrap;
28
+ }
29
+
30
+ .row [class ^= 'col-'], .row [class ^= 'offset-'] {
31
+ flex-shrink: 0;
32
+ max-width: 100%;
33
+ padding: 0 0;
34
+ }
35
+
36
+ .col-auto {
37
+ flex: 0 0 auto;
38
+ width: auto;
39
+ padding: 0 0;
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+
46
+ @include true.describe('generate($column-prefix, $offset-prefix, $spacing)') {
47
+ @include true.it('should generate column and offset classes with prefixes column- and gap-. Spacing should be 8px.') {
48
+ @include true.assert() {
49
+ @include true.output() {
50
+ @include grid-core.generate('column-', 'gap-', 8px);
51
+ }
52
+
53
+ @include true.expect() {
54
+ .row {
55
+ display: flex;
56
+ flex-wrap: wrap;
57
+ margin: 0 -8px;
58
+ }
59
+
60
+ .row [class ^= 'column-'], .row [class ^= 'gap-'] {
61
+ flex-shrink: 0;
62
+ max-width: 100%;
63
+ padding: 0 8px;
64
+ }
65
+
66
+ .column-auto {
67
+ flex: 0 0 auto;
68
+ width: auto;
69
+ padding: 0 8px;
70
+ }
71
+ }
72
+ }
73
+ }
74
+ }
75
+
76
+ @include true.describe('generate-reverse-row($breakpoints)') {
77
+ @include true.it('should generate revert row classes for a given breakpoint') {
78
+ @include true.assert() {
79
+ @include true.output() {
80
+ @include grid-core.generate-reverse-row(custom-breakpoints.$breakpoints);
81
+ }
82
+
83
+ @include true.expect() {
84
+ @media only screen and (width >= 540px) {
85
+ .row.reverse-row-sm {
86
+ flex-direction: row-reverse;
87
+ }
88
+ }
89
+
90
+ @media only screen and (width >= 800px) {
91
+ .row.reverse-row-md {
92
+ flex-direction: row-reverse;
93
+ }
94
+ }
95
+
96
+ .row.reverse-row-under-sm {
97
+ flex-direction: row-reverse;
98
+
99
+ @media only screen and (width >= 540px) {
100
+ flex-direction: row;
101
+ }
102
+ }
103
+
104
+ .row.reverse-row-under-md {
105
+ flex-direction: row-reverse;
106
+
107
+ @media only screen and (width >= 800px) {
108
+ flex-direction: row;
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }