@nappr/nappr-styles 0.2.27 → 0.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.
@@ -1,4 +1,8 @@
1
- @each $size in $border-size-map {
1
+ @use "sass:string";
2
+ @use '../funcs/rem' as rem;
3
+ @use '../variables/defaults' as defaults;
4
+
5
+ @each $size in defaults.$BORDER_SIZE_MAP {
2
6
  $sides: (all, topbottom, leftright, top, left, right, bottom);
3
7
 
4
8
  // convert value to SASS variables with unit
@@ -7,36 +11,36 @@
7
11
  @each $side in $sides {
8
12
  @if $side == 'all' {
9
13
  .b#{$size} {
10
- @include rem(border-width, $pixelValue);
11
-
12
- border-style: $border-style;
14
+ $value : rem.convert($pixelValue);
15
+ border-width: $value;
16
+ border-style: defaults.$BORDER_STYLE;
13
17
  }
14
18
  }
15
19
 
16
20
  @else if $side == 'topbottom' {
17
21
  .by#{$size} {
18
- @include rem(border-top-width, $pixelValue);
19
- @include rem(border-bottom-width, $pixelValue);
20
-
21
- border-style: $border-style;
22
+ $value : rem.convert($pixelValue);
23
+ border-top-width: $value;
24
+ border-bottom-width: $value;
25
+ border-style: defaults.$BORDER_STYLE;
22
26
  }
23
27
  }
24
28
 
25
29
  @else if $side == 'leftright' {
26
30
  .bx#{$size} {
27
- @include rem(border-left-width, $pixelValue);
28
- @include rem(border-right-width, $pixelValue);
29
-
30
- border-style: $border-style;
31
+ $value : rem.convert($pixelValue);
32
+ border-left-width: $value;
33
+ border-right-width: $value;
34
+ border-style: defaults.$BORDER_STYLE;
31
35
  }
32
36
  }
33
37
 
34
38
  @else {
35
39
  // .bl, .br, .bt, .bb
36
- .b#{str-slice($side, 0, 1)}#{$size} {
37
- @include rem(border-#{$side}-width, $pixelValue);
38
-
39
- border-style: $border-style;
40
+ .b#{string.slice($side, 0, 1)}#{$size} {
41
+ $value : rem.convert($pixelValue);
42
+ border-#{$side}-width: $value;
43
+ border-style: defaults.$BORDER_STYLE;
40
44
  }
41
45
  }
42
46
  }
@@ -1,3 +1,6 @@
1
+ @use '../funcs/rem' as rem;
2
+ @use '../variables/defaults' as defaults;
3
+
1
4
  /**
2
5
  * USAGE:
3
6
  * ---------------------
@@ -5,15 +8,15 @@
5
8
  * .w33 -> width 33%
6
9
  */
7
10
  @mixin withHeight($size) {
8
- height: rem($size);
9
- max-height: rem($size);
10
- min-height: rem($size);
11
+ height: rem.convert($size);
12
+ max-height: rem.convert($size);
13
+ min-height: rem.convert($size);
11
14
  }
12
15
 
13
16
  @mixin withWidth($size) {
14
- max-width: rem($size);
15
- min-width: rem($size);
16
- width: rem($size);
17
+ max-width: rem.convert($size);
18
+ min-width: rem.convert($size);
19
+ width: rem.convert($size);
17
20
  }
18
21
 
19
22
  @mixin withSize($width, $height: null) {
@@ -32,7 +35,7 @@
32
35
  @include withSize($size);
33
36
  }
34
37
 
35
- @each $size in $dimensions-map {
38
+ @each $size in defaults.$DIMENSIONS_MAP {
36
39
  $percentValue: ($size * 1%);
37
40
 
38
41
  .w#{$size} {
@@ -1,14 +1,18 @@
1
+ @use '../funcs/rem' as rem;
2
+ @use '../variables/defaults' as defaults;
3
+
1
4
  /**
2
5
  * USAGE:
3
6
  * ---------------------
4
7
  *
5
8
  * .fs12 -> font-size 12px converted to rem
6
9
  */
7
- @mixin fontSize($value) {
8
- @include rem(font-size, $value);
10
+ @mixin fontSize($pixelValue) {
11
+ $value: rem.convert($pixelValue);
12
+ font-size: $value;
9
13
  }
10
14
 
11
- @each $size in $font-sizes-map {
15
+ @each $size in defaults.$FONT_SIZES_MAP {
12
16
  $pixelValue: number-to-pixel($size);
13
17
 
14
18
  .fs#{$size} {
@@ -1,3 +1,5 @@
1
+ @use '../variables/defaults' as defaults;
2
+
1
3
  /**
2
4
  * USAGE:
3
5
  * ---------------------
@@ -5,10 +7,11 @@
5
7
  * .ln12 -> line-height 12px converted to rem
6
8
  */
7
9
  @mixin lineHeight($value) {
8
- @include rem(line-height, $value);
10
+ $pixelValue: number-to-pixel($value);
11
+ line-height: $pixelValue;
9
12
  }
10
13
 
11
- @each $size in $line-height-map {
14
+ @each $size in defaults.$LINE_HEIGHT_MAP {
12
15
  $pixelValue: number-to-pixel($size);
13
16
 
14
17
  .lh#{$size} {
@@ -1,3 +1,7 @@
1
+ @use "sass:string";
2
+ @use '../funcs/rem' as rem;
3
+ @use '../variables/defaults' as defaults;
4
+
1
5
  /**
2
6
  * USAGE:
3
7
  * ---------------------
@@ -6,54 +10,55 @@
6
10
  * .mx12 -> margin right-left 12px converted to rem
7
11
  * .pr12 -> padding right 12px converted to rem
8
12
  */
9
- @each $size in $spacings-map {
13
+ @each $size in defaults.$SPACINGS_MAP {
10
14
  $sides: (all, topbottom, leftright, top, left, right, bottom);
11
15
 
12
16
  // convert value to SASS variables with unit
13
- $pixelValue: number-to-pixel($size);
17
+ $nbx: number-to-pixel($size);
18
+ $pixelValue: rem.convert($nbx);
14
19
 
15
20
  @each $side in $sides {
16
21
  @if $side == 'all' {
17
22
  .m#{$size} {
18
- @include rem(margin, $pixelValue);
23
+ margin: $pixelValue;
19
24
  }
20
25
 
21
26
  .p#{$size} {
22
- @include rem(padding, $pixelValue);
27
+ padding: $pixelValue;
23
28
  }
24
29
  }
25
30
 
26
31
  @else if $side == 'topbottom' {
27
32
  .my#{$size} {
28
- @include rem(margin-top, $pixelValue);
29
- @include rem(margin-bottom, $pixelValue);
33
+ margin-top: $pixelValue;
34
+ margin-bottom: $pixelValue;
30
35
  }
31
36
 
32
37
  .py#{$size} {
33
- @include rem(padding-top, $pixelValue);
34
- @include rem(padding-bottom, $pixelValue);
38
+ padding-top: $pixelValue;
39
+ padding-bottom: $pixelValue;
35
40
  }
36
41
  }
37
42
 
38
43
  @else if $side == 'leftright' {
39
44
  .mx#{$size} {
40
- @include rem(margin-left, $pixelValue);
41
- @include rem(margin-right, $pixelValue);
45
+ margin-left: $pixelValue;
46
+ margin-right: $pixelValue;
42
47
  }
43
48
 
44
49
  .px#{$size} {
45
- @include rem(padding-left, $pixelValue);
46
- @include rem(padding-right, $pixelValue);
50
+ padding-left: $pixelValue;
51
+ padding-right: $pixelValue;
47
52
  }
48
53
  }
49
54
 
50
55
  @else {
51
- .m#{str-slice($side, 0, 1)}#{$size} {
52
- @include rem(margin-#{$side}, $pixelValue);
56
+ .m#{string.slice($side, 0, 1)}#{$size} {
57
+ margin-#{$side}: $pixelValue;
53
58
  }
54
59
 
55
- .p#{str-slice($side, 0, 1)}#{$size} {
56
- @include rem(padding-#{$side}, $pixelValue);
60
+ .p#{string.slice($side, 0, 1)}#{$size} {
61
+ padding-#{$side}: $pixelValue;
57
62
  }
58
63
  }
59
64
  }
@@ -1,9 +1,11 @@
1
+ @use '../globals' as globals;
2
+
1
3
  :root {
2
- @each $name, $value in $PALETTE {
4
+ @each $name, $value in globals.$PALETTE {
3
5
  --nappr-#{$name}: #{$value};
4
6
  }
5
7
 
6
- @each $name, $value in $BREAKPOINTS {
8
+ @each $name, $value in globals.$BREAKPOINTS {
7
9
  --nappr-#{$name}: #{$value};
8
10
  }
9
11
  }
@@ -1,16 +1,18 @@
1
+ @use '../globals' as globals;
2
+
1
3
  @mixin color($name) {
2
- color: get-color($PALETTE, $name);
4
+ color: get-color(globals.$PALETTE, $name);
3
5
  }
4
6
 
5
7
  @mixin backgroundColor($name) {
6
- background-color: get-color($PALETTE, $name);
8
+ background-color: get-color(globals.$PALETTE, $name);
7
9
  }
8
10
 
9
11
  // Generate helpers classes for colors
10
12
  // From auto generated file `_colors.scss`
11
13
  // .is-<color> { /* setup font-color */ }
12
14
  // .bg-<color> { /* setup background-color */ }
13
- @each $name, $value in $PALETTE {
15
+ @each $name, $value in globals.$PALETTE {
14
16
  // generate font colors
15
17
  .is-#{$name} {
16
18
  color: $value;
package/lib/styles.scss CHANGED
@@ -3,16 +3,16 @@
3
3
  * !!! DO NOT REORDER -> Declarative loading
4
4
  *
5
5
  */
6
- @import 'variables/';
7
- @import 'globals';
8
- @import 'funcs/';
6
+ @use 'variables/' as *;
7
+ @use 'globals';
8
+ @use 'funcs/' as *;
9
9
 
10
10
  // Core
11
- @import 'mixins/';
12
- @import 'reset';
13
- @import 'htmls/';
14
- @import 'helpers/';
15
- @import 'grid/';
11
+ @use 'mixins/' as *;
12
+ @use 'reset';
13
+ @use 'htmls/' as *;
14
+ @use 'grid/' as *;
15
+ @use 'helpers/' as *;
16
16
 
17
17
  .debug * {
18
18
  outline: 1px solid rgb(255 0 0 / 30%);
@@ -1,4 +1,4 @@
1
1
  // !!! DOT NOT REORDER !!!
2
- @import 'defaults';
3
- @import 'breakpoints';
4
- @import 'colors';
2
+ @use 'defaults';
3
+ @use 'breakpoints';
4
+ @use 'colors';
@@ -1,23 +1,11 @@
1
- $body-width: 100vw !default;
2
- $rem-fallback: true !default; // always force callback
3
- $rem-px-only: false !default;
4
-
5
- // Borders
6
- $border-style: solid !default;
7
- $border-size-map: (1, 2, 3, 4, 5, 6, 7, 8, 10) !default;
8
- $border-radius-map: (2, 3, 4, 5, 6, 7, 8, 10, 12, 24) !default;
9
-
10
- // Fonts
11
- $body-font-size: 16px !default;
12
- $default-font-size: 12px !default;
13
- $line-height-map: (12) !default;
14
- $font-sizes-map: (6, 7, 8, 9, 10, 11, 12, 14, 24, 26, 32, 40) !default;
15
- $rem-baseline: $body-font-size !default;
16
-
17
- // Dimensions
18
- $default-spacing: 12px !default;
19
- $spacings-map: (3, 6, 9, 12, 18, 24, 26, 48) !default;
20
- $dimensions-map: (
1
+ $BORDER_STYLE: solid !default;
2
+ $LINE_HEIGHT_MAP: (12) !default;
3
+ $BODY_FONT_SIZE: 16px !default;
4
+ $SPACINGS_MAP: (3, 6, 9, 12, 18, 24, 26, 48) !default;
5
+ $BORDER_SIZE_MAP: (1, 2, 3, 4, 5, 6, 7, 8, 10) !default;
6
+ $BORDER_RADIUS_MAP: (2, 3, 4, 5, 6, 7, 8, 10, 12, 24) !default;
7
+ $FONT_SIZES_MAP: (6, 7, 8, 9, 10, 11, 12, 14, 24, 26, 32, 40) !default;
8
+ $DIMENSIONS_MAP: (
21
9
  3,
22
10
  5,
23
11
  6,
@@ -42,3 +30,24 @@ $dimensions-map: (
42
30
  95,
43
31
  100
44
32
  ) !default;
33
+
34
+ $body-width: 100vw !default;
35
+ $rem-fallback: true !default; // always force callback
36
+ $rem-px-only: false !default;
37
+
38
+ // Borders
39
+ $border-style: $BORDER_STYLE;
40
+ $border-size-map: $BORDER_SIZE_MAP;
41
+ $border-radius-map: $BORDER_RADIUS_MAP;
42
+
43
+ // Fonts
44
+ $body-font-size: $BODY_FONT_SIZE;
45
+ $default-font-size: 12px !default;
46
+ $line-height-map: $LINE_HEIGHT_MAP;
47
+ $font-sizes-map: $FONT_SIZES_MAP;
48
+ $rem-baseline: $body-font-size !default;
49
+
50
+ // Dimensions
51
+ $default-spacing: 12px !default;
52
+ $spacings-map: $SPACINGS_MAP;
53
+ $dimensions-map: $DIMENSIONS_MAP;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nappr/nappr-styles",
3
- "version": "0.2.27",
3
+ "version": "0.3.0",
4
4
  "description": "A collection of SCSS helpers",
5
5
  "main": "./styles.scss",
6
6
  "browser": "./dist/styles.css",
@@ -22,17 +22,14 @@
22
22
  "prettier-stylelint": "0.4.2",
23
23
  "sass": "^1.77.6",
24
24
  "stylelint": "^16.6.1",
25
- "stylelint-config-standard": "^36.0.1",
26
- "stylelint-order": "^6.0.4",
25
+ "stylelint-config-standard": "^38.0.0",
26
+ "stylelint-order": "^7.0.0",
27
27
  "stylelint-scss": "^6.3.2"
28
28
  },
29
- "peerDepencies": {
30
- "sass": "^1.77.6"
31
- },
32
29
  "scripts": {
33
30
  "cleanup": "rm -rf node_modules",
34
31
  "docs": "docsify serve docs --port=2999",
35
- "dev": "sass styles.scss -o=dist -r --output-style=compressed",
32
+ "dev": "sass --load-path=node_modules --style=compressed styles.scss",
36
33
  "build": "./.scripts/build.sh"
37
34
  }
38
35
  }
package/styles.scss CHANGED
@@ -1 +1 @@
1
- @import './lib/styles';
1
+ @use './lib/styles';