@nuvoui/core 1.2.1 → 1.2.3

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.
@@ -9,42 +9,42 @@
9
9
 
10
10
  // Color Validation
11
11
  @function is-valid-color($color) {
12
- @return meta.type-of($color) == 'color';
12
+ @return meta.type-of($color) == 'color';
13
13
  }
14
14
 
15
15
  // Scale Generation Function
16
16
  @function create-color-scale($color) {
17
- $scale: ();
18
- $stops: (
19
- 50: 95%,
20
- 100: 85%,
21
- 200: 75%,
22
- 300: 65%,
23
- 400: 55%,
24
- 500: 50%, // Base color
25
- 600: 45%,
26
- 700: 35%,
27
- 800: 25%,
28
- 900: 15%
29
- );
30
-
31
- @each $shade, $lightness in $stops {
32
- $adjusted-color: $color;
33
-
34
- @if $shade < 500 {
35
- // Lighter shades: mix with white
36
- $mix-percentage: math.div($lightness - 50%, 50%) * 100%;
37
- $adjusted-color: color.mix(white, $color, $mix-percentage);
38
- } @else if $shade > 500 {
39
- // Darker shades: mix with black
40
- $mix-percentage: math.div(50% - $lightness, 50%) * 100%;
41
- $adjusted-color: color.mix(black, $color, $mix-percentage);
42
- }
43
-
44
- $scale: map.set($scale, $shade, $adjusted-color);
17
+ $scale: ();
18
+ $stops: (
19
+ 50: 95%,
20
+ 100: 85%,
21
+ 200: 75%,
22
+ 300: 65%,
23
+ 400: 55%,
24
+ 500: 50%, // Base color
25
+ 600: 45%,
26
+ 700: 35%,
27
+ 800: 25%,
28
+ 900: 15%
29
+ );
30
+
31
+ @each $shade, $lightness in $stops {
32
+ $adjusted-color: $color;
33
+
34
+ @if $shade < 500 {
35
+ // Lighter shades: mix with white
36
+ $mix-percentage: math.div($lightness - 50%, 50%) * 100%;
37
+ $adjusted-color: color.mix(white, $color, $mix-percentage);
38
+ } @else if $shade > 500 {
39
+ // Darker shades: mix with black
40
+ $mix-percentage: math.div(50% - $lightness, 50%) * 100%;
41
+ $adjusted-color: color.mix(black, $color, $mix-percentage);
45
42
  }
46
-
47
- @return $scale;
43
+
44
+ $scale: map.set($scale, $shade, $adjusted-color);
45
+ }
46
+
47
+ @return $scale;
48
48
  }
49
49
 
50
50
  // Luminance calculation for contrast
@@ -52,72 +52,68 @@
52
52
  $red: math.div(color.channel($color, "red"), 255);
53
53
  $green: math.div(color.channel($color, "green"), 255);
54
54
  $blue: math.div(color.channel($color, "blue"), 255);
55
-
56
- $red: if($red <= 0.0393, math.div($red, 12.92), math.pow((math.div($red + 0.055, 1.055)), 2.4));
57
- $green: if($green <= 0.0393, math.div($green, 12.92), math.pow((math.div($green + 0.055, 1.055)), 2.4));
58
- $blue: if($blue <= 0.0393, math.div($blue, 12.92), math.pow((math.div($blue + 0.055, 1.055)), 2.4));
59
-
60
- @return 0.2126 * $red + 0.7152 * $green + 0.0722 * $blue;
55
+
56
+ $red: if($red <= 0.0393, math.div($red, 12.92), math.pow((math.div($red + 0.055, 1.055)), 2.4));
57
+ $green: if($green <= 0.0393, math.div($green, 12.92), math.pow((math.div($green + 0.055, 1.055)), 2.4));
58
+ $blue: if($blue <= 0.0393, math.div($blue, 12.92), math.pow((math.div($blue + 0.055, 1.055)), 2.4));
59
+
60
+ @return 0.2126 * $red + 0.7152 * $green + 0.0722 * $blue;
61
61
  }
62
62
 
63
63
  // Find appropriate text color for a background
64
64
  @function find-text-color($background) {
65
- $luminance: luminance($background);
66
- @return if($luminance > 0.55, #000, #fff);
65
+ $luminance: luminance($background);
66
+ @return if($luminance > 0.55, #000, #fff);
67
67
  }
68
68
 
69
69
  // Adaptive contrast mixin
70
70
  @mixin adaptive-contrast($color) {
71
- background-color: $color;
72
- color: find-text-color($color);
73
-
74
- @media (prefers-contrast: more) {
75
- $adjusted: if(color.lightness($color) > 50%,
76
- color.adjust($color, $lightness: -10%),
71
+ background-color: $color;
72
+ color: find-text-color($color);
73
+
74
+ @media (prefers-contrast: more) {
75
+ $adjusted: if(color.lightness($color) > 50%,
76
+ color.adjust($color, $lightness: -10%),
77
77
  color.adjust($color, $lightness: 10%));
78
78
 
79
- background-color: $adjusted;
80
- color: find-text-color($adjusted);
81
- }
79
+ background-color: $adjusted;
80
+ color: find-text-color($adjusted);
81
+ }
82
82
  }
83
83
 
84
84
  // Generate color scales
85
85
  $colors: (
86
- 'primary': create-color-scale($primary),
87
- 'secondary': create-color-scale($secondary),
88
- 'success': create-color-scale($success),
89
- 'danger': create-color-scale($danger),
90
- 'warning': create-color-scale($warning),
91
- 'info': create-color-scale($info)
86
+ 'primary': create-color-scale($primary),
87
+ 'secondary': create-color-scale($secondary),
88
+ 'success': create-color-scale($success),
89
+ 'danger': create-color-scale($danger),
90
+ 'warning': create-color-scale($warning),
91
+ 'info': create-color-scale($info)
92
92
  );
93
93
 
94
94
  // Generate scales for primitives
95
95
  $colors-primitives: ();
96
96
 
97
97
  @each $name, $color in $color-primitives {
98
- $colors-primitives: map.set($colors-primitives, $name, create-color-scale($color));
98
+ $colors-primitives: map.set($colors-primitives, $name, create-color-scale($color));
99
99
  }
100
100
 
101
101
  // todo: documentation
102
102
  @mixin bg($color) {
103
- & {
104
- background-color: $color;
105
- }
103
+ background-color: $color;
106
104
  }
107
105
  @mixin color($color) {
108
- & {
109
- color: $color;
110
- }
106
+ color: $color;
111
107
  }
112
108
  @mixin gradient($direction, $colors...) {
113
- background-image: linear-gradient($direction, $colors);
109
+ background-image: linear-gradient($direction, $colors);
114
110
  }
115
111
 
116
112
  // Filter Mixins
117
113
  @mixin backdrop-filter($value) {
118
- backdrop-filter: $value;
114
+ backdrop-filter: $value;
119
115
  }
120
116
 
121
117
  @mixin filter($value) {
122
- filter: $value;
123
- }
118
+ filter: $value;
119
+ }
@@ -0,0 +1,23 @@
1
+ @use '../abstracts' as VAR;
2
+
3
+ @mixin cursor($cursor-value) {
4
+ cursor: $cursor-value;
5
+ }
6
+
7
+ @if VAR.$generate-utility-classes {
8
+ .cursor-auto {@include cursor(auto);}
9
+ .cursor-pointer { @include cursor(pointer); }
10
+ .cursor-default { @include cursor(default); }
11
+ .cursor-move { @include cursor(move); }
12
+ .cursor-not-allowed { @include cursor(not-allowed); }
13
+ .cursor-wait { @include cursor(wait); }
14
+ .cursor-help { @include cursor(help); }
15
+ .cursor-text { @include cursor(text); }
16
+ .cursor-cell { @include cursor(cell); }
17
+ .cursor-crosshair { @include cursor(crosshair); }
18
+ .cursor-grabbing { @include cursor(grabbing); }
19
+ .cursor-grab { @include cursor(grab); }
20
+ .cursor-zoom-in { @include cursor(zoom-in); }
21
+ .cursor-zoom-out { @include cursor(zoom-out); }
22
+ .cursor-none { @include cursor(none); }
23
+ }
@@ -6,6 +6,7 @@
6
6
  @forward "borders";
7
7
  @forward "colors";
8
8
  @forward "container-queries";
9
+ @forward "cursor";
9
10
  @forward "display";
10
11
  @forward "helpers";
11
12
  @forward "media-queries";
@@ -2,6 +2,7 @@
2
2
  // Module: Opacity
3
3
 
4
4
  @use "sass:math";
5
+ @use "sass:meta";
5
6
  @use "../abstracts" as *;
6
7
 
7
8
  /**
@@ -68,30 +69,30 @@
68
69
  * Opacity values are defined in the $percentages variable
69
70
  * Transition timing can be customized via CSS variables
70
71
  *
71
- * @see transitions
72
+ * @see transitions
72
73
  */
73
74
 
74
75
  @mixin opacity($value) {
75
- opacity: math.div($value, 100);
76
+ opacity: calc(#{$value} / 100);
76
77
  }
77
78
 
78
79
  @if $generate-utility-classes {
79
80
  // Opacity Utilities
80
81
  @each $i in $percentages {
81
82
  .opacity-#{$i} {
82
- @include opacity ($i);
83
+ @include opacity($i);
83
84
  }
84
85
  .hover\:opacity-#{$i}:hover {
85
- @include opacity ($i);
86
+ @include opacity($i);
86
87
  }
87
88
  .focus\:opacity-#{$i}:focus {
88
- @include opacity ($i);
89
+ @include opacity($i);
89
90
  }
90
91
  .active\:opacity-#{$i}:active {
91
- @include opacity ($i);
92
+ @include opacity($i);
92
93
  }
93
94
  .group:hover .group-hover\:opacity-#{$i} {
94
- @include opacity ($i);
95
+ @include opacity($i);
95
96
  }
96
97
  }
97
98
 
@@ -100,29 +101,21 @@
100
101
  @media (min-width: #{$width}) {
101
102
  @each $i in $percentages {
102
103
  .opacity-#{$i}\@#{$breakpoint} {
103
- @include opacity ($i);
104
+ @include opacity($i);
104
105
  }
105
106
  .hover\:opacity-#{$i}\@#{$breakpoint}:hover {
106
- @include opacity ($i);
107
+ @include opacity($i);
107
108
  }
108
109
  .focus\:opacity-#{$i}\@#{$breakpoint}:focus {
109
- @include opacity ($i);
110
+ @include opacity($i);
110
111
  }
111
112
  .active\:opacity-#{$i}\@#{$breakpoint}:active {
112
- @include opacity ($i);
113
+ @include opacity($i);
113
114
  }
114
115
  .group:hover .group-hover\:opacity-#{$i}\@#{$breakpoint} {
115
- @include opacity ($i);
116
+ @include opacity($i);
116
117
  }
117
118
  }
118
119
  }
119
120
  }
120
-
121
- // Transition Opacity
122
- // TODO move to transitons may be?
123
- .transition-opacity {
124
- transition-property: opacity;
125
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
126
- transition-duration: 150ms;
127
- }
128
- }
121
+ }
@@ -171,6 +171,31 @@
171
171
 
172
172
 
173
173
 
174
+ // todo: Documentation
175
+ @mixin absolute-center {
176
+ position: absolute;
177
+ left: 50%;
178
+ top: 50%;
179
+
180
+ --translate-x: -50%;
181
+ --translate-y: -50%;
182
+
183
+ transform: translateX(var(--translate-x)) translateY(var(--translate-y)) translateZ(var(--translate-z, 0)) rotate(var(--rotate, 0)) skewX(var(--skew-x, 0)) skewY(var(--skew-y, 0)) scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1));
184
+ }
185
+
186
+ // todo: Documentation
187
+ // Fractional and percentage placements
188
+ $position-fractions: (
189
+ '25p': 25%,
190
+ '33p': 33.333%,
191
+ '50p': 50%,
192
+ '66p': 66.667%,
193
+ '75p': 75%,
194
+ "100p": 100%
195
+ );
196
+
197
+
198
+
174
199
  // -----------------------------------------------
175
200
  // UTILITY CLASSES
176
201
  // -----------------------------------------------
@@ -181,6 +206,14 @@
181
206
  .absolute { @include absolute; }
182
207
  .fixed { @include fixed; }
183
208
  .sticky { @include sticky; }
209
+ .absolute-center { @include absolute-center; }
210
+
211
+ @each $key, $value in $position-fractions {
212
+ .top-#{$key} { @include top($value); }
213
+ .right-#{$key} { @include right($value); }
214
+ .bottom-#{$key} { @include bottom($value); }
215
+ .left-#{$key} { @include left($value); }
216
+ }
184
217
 
185
218
  // Placement Classes
186
219
  @each $key, $value in $spacings {
@@ -202,6 +235,16 @@
202
235
  .absolute\@#{$breakpoint} {@include absolute;}
203
236
  .fixed\@#{$breakpoint} {@include fixed;}
204
237
  .sticky\@#{$breakpoint} {@include sticky;}
238
+ .absolute-center\@#{$breakpoint} { @include absolute-center; }
239
+
240
+ // Fractional responsive placements
241
+ @each $key, $value in $position-fractions {
242
+ .top-#{$key}\@#{$breakpoint} { @include top($value); }
243
+ .right-#{$key}\@#{$breakpoint} { @include right($value); }
244
+ .bottom-#{$key}\@#{$breakpoint} { @include bottom($value); }
245
+ .left-#{$key}\@#{$breakpoint} { @include left($value); }
246
+ }
247
+
205
248
  @each $key, $value in $spacings {
206
249
  .top-#{$key}\@#{$breakpoint} {@include top($value);}
207
250
  .right-#{$key}\@#{$breakpoint} {@include right($value);}
@@ -210,4 +253,4 @@
210
253
  }
211
254
  }
212
255
  }
213
- }
256
+ }
@@ -1,98 +1,97 @@
1
1
  // _spacing.scss
2
-
2
+
3
3
  @use 'sass:math';
4
4
  @use 'sass:string' as str;
5
5
  @use '../abstracts' as VAR;
6
6
  @use './container-queries' as Q;
7
7
  @use './media-queries' as MQ;
8
8
 
9
- @mixin width($value) { & { width: $value; } }
10
- @mixin height($value) { & { height: $value; } }
9
+ @mixin width($value) { width: $value; }
10
+ @mixin height($value) { height: $value; }
11
11
  @mixin min-width($value) { min-width: $value; }
12
12
  @mixin min-height($value) { min-height: $value; }
13
13
  @mixin max-width($value) { max-width: $value; }
14
14
  @mixin max-height($value) { max-height: $value; }
15
15
 
16
- @mixin width-percent($i) { & { width: str.unquote($i + '%'); } }
17
- @mixin height-percent($i) { & { height: str.unquote($i + '%'); } }
18
- @mixin min-width-percent($i) { & { min-width: str.unquote($i + '%'); } }
19
- @mixin min-height-percent($i) { & { min-height: str.unquote($i + '%'); } }
20
- @mixin max-width-percent($i) { & { max-width: str.unquote($i + '%'); } }
21
- @mixin max-height-percent($i) { & { max-height: str.unquote($i + '%'); } }
16
+ @mixin width-percent($i) { width: str.unquote($i + '%'); }
17
+ @mixin height-percent($i) { height: str.unquote($i + '%'); }
18
+ @mixin min-width-percent($i) { min-width: str.unquote($i + '%'); }
19
+ @mixin min-height-percent($i) { min-height: str.unquote($i + '%'); }
20
+ @mixin max-width-percent($i) { max-width: str.unquote($i + '%'); }
21
+ @mixin max-height-percent($i) { max-height: str.unquote($i + '%'); }
22
22
 
23
- @mixin w-auto { & { width: auto; } }
24
- @mixin w-full { & { width: 100%; } }
25
- @mixin h-auto { & { height: auto; } }
26
- @mixin h-full { & { height: 100%; } }
27
- @mixin min-w-full { & { min-width: 100%; } }
28
- @mixin max-w-full { & { max-width: 100%; } }
29
- @mixin min-h-full { & { min-height: 100%; } }
30
- @mixin max-h-full { & { max-height: 100%; } }
23
+ @mixin w-auto { width: auto; }
24
+ @mixin w-full { width: 100%; }
25
+ @mixin h-auto { height: auto; }
26
+ @mixin h-full { height: 100%; }
27
+ @mixin min-w-full { min-width: 100%; }
28
+ @mixin max-w-full { max-width: 100%; }
29
+ @mixin min-h-full { min-height: 100%; }
30
+ @mixin max-h-full { max-height: 100%; }
31
31
 
32
- @mixin w-screen { & { width: 100vw; } }
33
- @mixin h-screen { & { height: 100dvh; } }
32
+ @mixin w-screen { width: 100vw; }
33
+ @mixin h-screen { height: 100dvh; }
34
34
 
35
35
  @if VAR.$generate-utility-classes {
36
- .w-screen { @include w-screen; }
37
- .h-screen { @include h-screen; }
36
+ .w-screen { @include w-screen; }
37
+ .h-screen { @include h-screen; }
38
38
 
39
- // Width utilities need :not(.flex) to avoid conflicts with flex child sizing
40
- :not(.flex)>.w-auto { @include w-auto; }
41
- :not(.flex)>.w-full { @include w-full; }
39
+ .w-auto { @include w-auto; }
40
+ .w-full { @include w-full; }
42
41
 
43
- .h-auto { @include h-auto; }
44
- .h-full { @include h-full; }
45
- .min-w-full { @include min-w-full; }
46
- .max-w-full { @include max-w-full; }
47
- .min-h-full { @include min-h-full; }
48
- .max-h-full { @include max-h-full; }
42
+ .h-auto { @include h-auto; }
43
+ .h-full { @include h-full; }
44
+ .min-w-full { @include min-w-full; }
45
+ .max-w-full { @include max-w-full; }
46
+ .min-h-full { @include min-h-full; }
47
+ .max-h-full { @include max-h-full; }
49
48
 
50
- // Percentage widths
51
- @each $i in VAR.$percentages {
52
- .w-#{$i}p { @include width-percent($i); }
53
- .h-#{$i}p { @include height-percent($i); }
54
- .min-w-#{$i}p { @include min-width-percent($i); }
55
- .min-h-#{$i}p { @include min-height-percent($i); }
56
- .max-w-#{$i}p { @include max-width-percent($i); }
57
- .max-h-#{$i}p { @include max-height-percent($i); }
58
- }
49
+ // Percentage widths
50
+ @each $i in VAR.$percentages {
51
+ .w-#{$i}p { @include width-percent($i); }
52
+ .h-#{$i}p { @include height-percent($i); }
53
+ .min-w-#{$i}p { @include min-width-percent($i); }
54
+ .min-h-#{$i}p { @include min-height-percent($i); }
55
+ .max-w-#{$i}p { @include max-width-percent($i); }
56
+ .max-h-#{$i}p { @include max-height-percent($i); }
57
+ }
59
58
 
60
- // Generate utilities from spacing map
61
- @each $key, $value in VAR.$spacings {
62
- .w-#{$key} { @include width($value); }
63
- .h-#{$key} { @include height($value); }
64
- .min-w-#{$key} { @include min-width($value); }
65
- .min-h-#{$key} { @include min-height($value); }
66
- .max-w-#{$key} { @include max-width($value); }
67
- .max-h-#{$key} { @include max-height($value); }
68
- }
59
+ // Generate utilities from spacing map
60
+ @each $key, $value in VAR.$spacings {
61
+ .w-#{$key} { @include width($value); }
62
+ .h-#{$key} { @include height($value); }
63
+ .min-w-#{$key} { @include min-width($value); }
64
+ .min-h-#{$key} { @include min-height($value); }
65
+ .max-w-#{$key} { @include max-width($value); }
66
+ .max-h-#{$key} { @include max-height($value); }
67
+ }
69
68
 
70
- // Pixel widths based on spacing scale
71
- @each $breakpoint, $width in VAR.$breakpoints {
69
+ // Pixel widths based on spacing scale
70
+ @each $breakpoint, $width in VAR.$breakpoints {
72
71
 
73
- .w-#{$breakpoint} { @include width($width); }
74
- .min-w-#{$breakpoint} { @include min-width($width); }
75
- .max-w-#{$breakpoint} { @include max-width($width); }
72
+ .w-#{$breakpoint} { @include width($width); }
73
+ .min-w-#{$breakpoint} { @include min-width($width); }
74
+ .max-w-#{$breakpoint} { @include max-width($width); }
76
75
 
77
- @include MQ.media-up ($breakpoint) {
78
- // Generate utilities from spacing map
79
- @each $i in VAR.$percentages {
80
- .w-#{$i}p\@#{$breakpoint} { @include width-percent($i); }
81
- .h-#{$i}p\@#{$breakpoint} { @include height-percent($i); }
82
- .min-w-#{$i}p\@#{$breakpoint} { @include min-width-percent($i); }
83
- .min-h-#{$i}p\@#{$breakpoint} { @include min-height-percent($i); }
84
- .max-w-#{$i}p\@#{$breakpoint} { @include max-width-percent($i); }
85
- .max-h-#{$i}p\@#{$breakpoint} { @include max-height-percent($i); }
86
- }
76
+ @include MQ.media-up ($breakpoint) {
77
+ // Generate utilities from spacing map
78
+ @each $i in VAR.$percentages {
79
+ .w-#{$i}p\@#{$breakpoint} { @include width-percent($i); }
80
+ .h-#{$i}p\@#{$breakpoint} { @include height-percent($i); }
81
+ .min-w-#{$i}p\@#{$breakpoint} { @include min-width-percent($i); }
82
+ .min-h-#{$i}p\@#{$breakpoint} { @include min-height-percent($i); }
83
+ .max-w-#{$i}p\@#{$breakpoint} { @include max-width-percent($i); }
84
+ .max-h-#{$i}p\@#{$breakpoint} { @include max-height-percent($i); }
85
+ }
87
86
 
88
- @each $key, $value in VAR.$spacings {
89
- .w-#{$key}\@#{$breakpoint} { @include width($value); }
90
- .h-#{$key}\@#{$breakpoint} { @include height($value); }
91
- .min-w-#{$key}\@#{$breakpoint} { @include min-width($value); }
92
- .min-h-#{$key}\@#{$breakpoint} { @include min-height($value); }
93
- .max-w-#{$key}\@#{$breakpoint} { @include max-width($value); }
94
- .max-h-#{$key}\@#{$breakpoint} { @include max-height($value); }
95
- }
96
- }
87
+ @each $key, $value in VAR.$spacings {
88
+ .w-#{$key}\@#{$breakpoint} { @include width($value); }
89
+ .h-#{$key}\@#{$breakpoint} { @include height($value); }
90
+ .min-w-#{$key}\@#{$breakpoint} { @include min-width($value); }
91
+ .min-h-#{$key}\@#{$breakpoint} { @include min-height($value); }
92
+ .max-w-#{$key}\@#{$breakpoint} { @include max-width($value); }
93
+ .max-h-#{$key}\@#{$breakpoint} { @include max-height($value); }
94
+ }
97
95
  }
98
- }
96
+ }
97
+ }