@nuvoui/core 1.2.3 → 1.2.5

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.
@@ -3,12 +3,36 @@
3
3
 
4
4
  @use 'sass:math';
5
5
  @use 'sass:map';
6
- @use '../abstracts' as *;
7
-
6
+ @use 'sass:meta';
7
+ @use 'sass:string' as str;
8
+ @use '../abstracts' as *;
9
+ @use '../abstracts/functions' as FN;
8
10
 
9
11
 
10
12
  // Common border styles
11
13
  $border-styles: (solid, dashed, dotted, double, none);
14
+
15
+
16
+ @function get-rounded-value($val) {
17
+ @if not $val {
18
+ @return map.get($border-radii, 'md');
19
+ } @else if meta.type-of($val) == string {
20
+ $clean-val: $val;
21
+
22
+ // Try to find the value in the border-radii map
23
+ @if map.has-key($border-radii, $clean-val) {
24
+ @return map.get($border-radii, $clean-val);
25
+ } @else if map.has-key($border-radii, str.unquote($clean-val)) {
26
+ @return map.get($border-radii, str.unquote($clean-val));
27
+ } @else {
28
+ // Not a predefined value, process it as a custom value
29
+ @return FN.fix-units($val);
30
+ }
31
+ } @else {
32
+ // Case 3: $val is a custom value, ensure it has units
33
+ @return FN.fix-units($val);
34
+ }
35
+ }
12
36
 
13
37
  // -----------------------------------------------
14
38
  // MIXINS
@@ -17,14 +41,18 @@ $border-styles: (solid, dashed, dotted, double, none);
17
41
  // Core Border Mixins - improved to include style and color by default
18
42
  // SKIP Documentation
19
43
  @mixin border($val, $style: solid, $color: var(--border)) {
44
+ $val: FN.fix-units($val);
45
+
20
46
  border-width: $val;
21
47
  @if $val != 0 {
22
48
  border-style: $style;
23
49
  border-color: $color;
24
50
  }
25
- }
51
+ }
26
52
 
27
53
  @mixin border-top($val) {
54
+ $val: FN.fix-units($val);
55
+
28
56
  border-top-width: $val;
29
57
  @if $val != 0 {
30
58
  border-top-style: solid;
@@ -33,6 +61,8 @@ $border-styles: (solid, dashed, dotted, double, none);
33
61
  }
34
62
 
35
63
  @mixin border-right($val) {
64
+ $val: FN.fix-units($val);
65
+
36
66
  border-right-width: $val;
37
67
  @if $val != 0 {
38
68
  border-right-style: solid;
@@ -41,6 +71,8 @@ $border-styles: (solid, dashed, dotted, double, none);
41
71
  }
42
72
 
43
73
  @mixin border-bottom($val) {
74
+ $val: FN.fix-units($val);
75
+
44
76
  border-bottom-width: $val;
45
77
  @if $val != 0 {
46
78
  border-bottom-style: solid;
@@ -49,6 +81,8 @@ $border-styles: (solid, dashed, dotted, double, none);
49
81
  }
50
82
 
51
83
  @mixin border-left($val) {
84
+ $val: FN.fix-units($val);
85
+
52
86
  border-left-width: $val;
53
87
  @if $val != 0 {
54
88
  border-left-style: solid;
@@ -61,54 +95,54 @@ $border-styles: (solid, dashed, dotted, double, none);
61
95
  * @param {String} $val - The border radius value
62
96
  */
63
97
  @mixin rounded($val: null) {
64
- border-radius: if($val == null, map.get($border-radii, 'md'), $val);
98
+ border-radius: get-rounded-value($val);
65
99
  }
66
100
 
67
101
  @mixin rounded-t($val: null) {
68
- $val: if($val == null, map.get($border-radii, 'md'), $val);
102
+ $val: get-rounded-value($val);
69
103
 
70
104
  border-top-left-radius: $val;
71
105
  border-top-right-radius: $val;
72
106
  }
73
107
 
74
108
  @mixin rounded-r($val: null) {
75
- $val: if($val == null, map.get($border-radii, 'md'), $val);
109
+ $val: get-rounded-value($val);
76
110
 
77
111
  border-top-right-radius: $val;
78
112
  border-bottom-right-radius: $val;
79
113
  }
80
114
 
81
115
  @mixin rounded-b($val: null) {
82
- $val: if($val == null, map.get($border-radii, 'md'), $val);
116
+ $val: get-rounded-value($val);
83
117
 
84
118
  border-bottom-left-radius: $val;
85
119
  border-bottom-right-radius: $val;
86
120
  }
87
121
 
88
122
  @mixin rounded-l($val: null) {
89
- $val: if($val == null, map.get($border-radii, 'md'), $val);
123
+ $val: get-rounded-value($val);
90
124
 
91
125
  border-top-left-radius: $val;
92
126
  border-bottom-left-radius: $val;
93
127
  }
94
128
 
95
129
  @mixin rounded-tl($val: null) {
96
- $val: if($val == null, map.get($border-radii, 'md'), $val);
130
+ $val: get-rounded-value($val);
97
131
 
98
132
  border-top-left-radius: $val;
99
133
  }
100
134
  @mixin rounded-tr($val: null) {
101
- $val: if($val == null, map.get($border-radii, 'md'), $val);
135
+ $val: get-rounded-value($val);
102
136
 
103
137
  border-top-right-radius: $val;
104
138
  }
105
139
  @mixin rounded-br($val: null) {
106
- $val: if($val == null, map.get($border-radii, 'md'), $val);
140
+ $val: get-rounded-value($val);
107
141
 
108
142
  border-bottom-right-radius: $val;
109
143
  }
110
144
  @mixin rounded-bl($val: null) {
111
- $val: if($val == null, map.get($border-radii, 'md'), $val);
145
+ $val: get-rounded-value($val);
112
146
 
113
147
  border-bottom-left-radius: $val;
114
148
  }
@@ -126,25 +160,6 @@ $border-styles: (solid, dashed, dotted, double, none);
126
160
 
127
161
  @mixin pill { @include rounded(9999px); } // todo: doc missing
128
162
 
129
- // -----------------------------------------------
130
- // VARIABLES
131
- // -----------------------------------------------
132
-
133
- // Common border width values that are most useful
134
- $border-widths: (0, 1, 2, 4, 8);
135
-
136
- // Common border radius values that are most useful
137
- $border-radii: (
138
- 'xs': 0.25rem,
139
- 'sm': 0.375rem,
140
- 'md': 0.5rem,
141
- 'lg': 0.75rem,
142
- 'xl': 1rem,
143
- '2xl': 1.25rem,
144
- 'full': 9999px,
145
- 'none': 0
146
- );
147
-
148
163
  // -----------------------------------------------
149
164
  // UTILITY CLASSES
150
165
  // -----------------------------------------------
@@ -108,12 +108,3 @@ $colors-primitives: ();
108
108
  @mixin gradient($direction, $colors...) {
109
109
  background-image: linear-gradient($direction, $colors);
110
110
  }
111
-
112
- // Filter Mixins
113
- @mixin backdrop-filter($value) {
114
- backdrop-filter: $value;
115
- }
116
-
117
- @mixin filter($value) {
118
- filter: $value;
119
- }
@@ -6,7 +6,7 @@
6
6
 
7
7
  @use "../abstracts/config" as *;
8
8
 
9
- @if $enable-debuger {
9
+ @if $enable-debugger {
10
10
  .NuvoUI-Debugger-Wrapper {
11
11
  color: #fff;
12
12
  font-family: Arial, sans-serif;
@@ -3,6 +3,7 @@
3
3
  // Forward all utility files
4
4
  @forward "alignment";
5
5
  @forward "animations";
6
+ @forward "backdrop-filters";
6
7
  @forward "borders";
7
8
  @forward "colors";
8
9
  @forward "container-queries";
@@ -16,5 +17,7 @@
16
17
  @forward "sizing";
17
18
  @forward "spacing";
18
19
  @forward "tooltips";
20
+ @forward "transforms";
19
21
  @forward "transitions";
20
22
  @forward "typography";
23
+ @forward "z-index";
@@ -73,6 +73,7 @@
73
73
  }
74
74
  }
75
75
 
76
+ // todo: doc
76
77
  // Touch devices
77
78
  @mixin touch {
78
79
  @media (hover: none) and (pointer: coarse) {
@@ -80,6 +81,7 @@
80
81
  }
81
82
  }
82
83
 
84
+ // todo: doc
83
85
  // Print media
84
86
  @mixin print {
85
87
  @media print {
@@ -87,6 +89,7 @@
87
89
  }
88
90
  }
89
91
 
92
+ // todo: doc
90
93
  // Example: @include supports(display: grid) { }
91
94
  @mixin supports($property) {
92
95
  @supports (#{$property}) {
@@ -94,6 +97,7 @@
94
97
  }
95
98
  }
96
99
 
100
+ // todo: doc
97
101
  // System preference only
98
102
  @mixin prefers-dark {
99
103
  @media (prefers-color-scheme: dark) {
@@ -101,21 +105,25 @@
101
105
  }
102
106
  }
103
107
 
108
+ // todo: doc
104
109
  // User preference takes precedence
105
110
  @mixin dark-mode {
106
- // Apply when user explicitly chooses dark
107
- [data-theme="dark"] & {
108
- @content;
109
- }
110
-
111
- // Apply when system is dark AND user hasn't made a choice
112
- @media (prefers-color-scheme: dark) {
113
- [data-theme="system"] & {
111
+ @if $enable-dark-mode { // todo: documentation as this will fully remove the dark mode by force
112
+ // Apply when user explicitly chooses dark
113
+ [data-theme="dark"] & {
114
114
  @content;
115
115
  }
116
+
117
+ // Apply when system is dark AND user hasn't made a choice
118
+ @media (prefers-color-scheme: dark) {
119
+ [data-theme="system"] & {
120
+ @content;
121
+ }
122
+ }
116
123
  }
117
124
  }
118
125
 
126
+ // todo: doc
119
127
  // Device orientation
120
128
  @mixin landscape {
121
129
  @media screen and (orientation: landscape) {
@@ -123,17 +131,20 @@
123
131
  }
124
132
  }
125
133
 
134
+ // todo: doc
126
135
  @mixin portrait {
127
136
  @media screen and (orientation: portrait) {
128
137
  @content;
129
138
  }
130
139
  }
131
140
 
141
+ // todo: doc
132
142
  // Modern aspect ratio
133
143
  @mixin aspect-ratio($ratio) {
134
144
  aspect-ratio: #{$ratio};
135
145
  }
136
146
 
147
+ // todo: doc
137
148
  // Dynamic viewport units (modern browsers)
138
149
  @mixin dvh {
139
150
  @supports (height: 100dvh) {
@@ -145,24 +156,20 @@
145
156
  }
146
157
  }
147
158
 
159
+ // todo: doc
148
160
  // Safe area insets (notches, home indicators)
149
161
  @mixin safe-area-inset($property, $position) {
150
162
  #{$property}: env(safe-area-inset-#{$position});
151
163
  }
152
164
 
165
+ // todo: doc
153
166
  @mixin reduced-motion {
154
167
  @media (prefers-reduced-motion: reduce) {
155
168
  @content;
156
169
  }
157
170
  }
158
171
 
159
- // Data-saving mode
160
- @mixin save-data {
161
- @media (prefers-reduced-data: reduce) {
162
- @content;
163
- }
164
- }
165
-
172
+ // todo: doc
166
173
  // Mouse precision detection
167
174
  @mixin fine-pointer {
168
175
  @media (pointer: fine) {
@@ -170,6 +177,7 @@
170
177
  }
171
178
  }
172
179
 
180
+ // todo: doc
173
181
  // Display mode for PWAs
174
182
  @mixin display-mode($mode: "standalone") {
175
183
  @media (display-mode: #{$mode}) {
@@ -177,6 +185,7 @@
177
185
  }
178
186
  }
179
187
 
188
+ // todo: doc
180
189
  // High contrast mode
181
190
  @mixin high-contrast {
182
191
  @media (forced-colors: active) {
@@ -3,16 +3,17 @@
3
3
  @use 'sass:math';
4
4
  @use 'sass:string' as str;
5
5
  @use '../abstracts' as VAR;
6
+ @use '../abstracts/functions' as FN;
6
7
  @use './container-queries' as Q;
7
8
  @use './media-queries' as MQ;
8
9
 
9
- @mixin width($value) { width: $value; }
10
- @mixin height($value) { height: $value; }
11
- @mixin min-width($value) { min-width: $value; }
12
- @mixin min-height($value) { min-height: $value; }
13
- @mixin max-width($value) { max-width: $value; }
14
- @mixin max-height($value) { max-height: $value; }
15
-
10
+ @mixin width($value) { width: FN.fix-units($value); }
11
+ @mixin height($value) { height: FN.fix-units($value); }
12
+ @mixin min-width($value) { min-width: FN.fix-units($value); }
13
+ @mixin min-height($value) { min-height: FN.fix-units($value); }
14
+ @mixin max-width($value) { max-width: FN.fix-units($value); }
15
+ @mixin max-height($value) { max-height: FN.fix-units($value); }
16
+ .widthx { @include width(100%); }
16
17
  @mixin width-percent($i) { width: str.unquote($i + '%'); }
17
18
  @mixin height-percent($i) { height: str.unquote($i + '%'); }
18
19
  @mixin min-width-percent($i) { min-width: str.unquote($i + '%'); }
@@ -20,14 +21,20 @@
20
21
  @mixin max-width-percent($i) { max-width: str.unquote($i + '%'); }
21
22
  @mixin max-height-percent($i) { max-height: str.unquote($i + '%'); }
22
23
 
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%; }
24
+ @mixin w-auto { @include width(auto);}
25
+ @mixin w-full { @include width(100%);}
26
+ @mixin h-auto { @include height(auto);}
27
+ @mixin h-full { @include height(100%);}
28
+ @mixin w-max { @include width(max-content);}
29
+ @mixin h-max { @include height(max-content);}
30
+ @mixin w-min { @include width(min-content);}
31
+ @mixin h-min { @include height(min-content);}
32
+ @mixin w-fit { @include width(fit-content);}
33
+ @mixin h-fit { @include height(fit-content);}
34
+ @mixin min-w-full { @include min-width(100%);}
35
+ @mixin max-w-full { @include max-width(100%);}
36
+ @mixin min-h-full { @include min-height(100%);}
37
+ @mixin max-h-full { @include max-height(100%);}
31
38
 
32
39
  @mixin w-screen { width: 100vw; }
33
40
  @mixin h-screen { height: 100dvh; }
@@ -38,9 +45,13 @@
38
45
 
39
46
  .w-auto { @include w-auto; }
40
47
  .w-full { @include w-full; }
41
-
42
48
  .h-auto { @include h-auto; }
43
49
  .h-full { @include h-full; }
50
+ .w-min { @include w-min;}
51
+ .h-min { @include h-min;}
52
+ .w-fit { @include w-fit;}
53
+ .h-fit { @include h-fit;}
54
+
44
55
  .min-w-full { @include min-w-full; }
45
56
  .max-w-full { @include max-w-full; }
46
57
  .min-h-full { @include min-h-full; }
@@ -58,8 +69,13 @@
58
69
 
59
70
  // Generate utilities from spacing map
60
71
  @each $key, $value in VAR.$spacings {
61
- .w-#{$key} { @include width($value); }
62
- .h-#{$key} { @include height($value); }
72
+ .w-#{$key},
73
+ .hover\:w-#{$key}:hover,
74
+ .group:hover .group-hover\:w-#{$key} { @include width($value); }
75
+ .h-#{$key},
76
+ .hover\:h-#{$key}:hover,
77
+ .group:hover .group-hover\:h-#{$key} { @include height($value); }
78
+
63
79
  .min-w-#{$key} { @include min-width($value); }
64
80
  .min-h-#{$key} { @include min-height($value); }
65
81
  .max-w-#{$key} { @include max-width($value); }
@@ -73,11 +89,26 @@
73
89
  .min-w-#{$breakpoint} { @include min-width($width); }
74
90
  .max-w-#{$breakpoint} { @include max-width($width); }
75
91
 
92
+
93
+ .w-auto\@#{$breakpoint} { @include w-auto; }
94
+ .w-full\@#{$breakpoint} { @include w-full; }
95
+ .h-auto\@#{$breakpoint} { @include h-auto; }
96
+ .h-full\@#{$breakpoint} { @include h-full; }
97
+ .w-min\@#{$breakpoint}{ @include w-min;}
98
+ .h-min\@#{$breakpoint}{ @include h-min;}
99
+ .w-fit\@#{$breakpoint}{ @include w-fit;}
100
+ .h-fit\@#{$breakpoint}{ @include h-fit;}
101
+
76
102
  @include MQ.media-up ($breakpoint) {
77
103
  // Generate utilities from spacing map
78
104
  @each $i in VAR.$percentages {
79
- .w-#{$i}p\@#{$breakpoint} { @include width-percent($i); }
80
- .h-#{$i}p\@#{$breakpoint} { @include height-percent($i); }
105
+ .w-#{$i}\@#{$breakpoint},
106
+ .hover\:w-#{$i}\@#{$breakpoint}:hover,
107
+ .group:hover .group-hover\:w-#{$i}\@#{$breakpoint} { @include width($i); }
108
+ .h-#{$i}\@#{$breakpoint},
109
+ .hover\:h-#{$i}\@#{$breakpoint}:hover,
110
+ .group:hover .group-hover\:h-#{$i}\@#{$breakpoint} { @include height($i); }
111
+
81
112
  .min-w-#{$i}p\@#{$breakpoint} { @include min-width-percent($i); }
82
113
  .min-h-#{$i}p\@#{$breakpoint} { @include min-height-percent($i); }
83
114
  .max-w-#{$i}p\@#{$breakpoint} { @include max-width-percent($i); }
@@ -85,8 +116,14 @@
85
116
  }
86
117
 
87
118
  @each $key, $value in VAR.$spacings {
88
- .w-#{$key}\@#{$breakpoint} { @include width($value); }
89
- .h-#{$key}\@#{$breakpoint} { @include height($value); }
119
+ .w-#{$key}\@#{$breakpoint},
120
+ .hover\:w-#{$key}\@#{$breakpoint}:hover,
121
+ .group:hover .group-hover\:w-#{$key}\@#{$breakpoint} { @include width($value); }
122
+ .h-#{$key}\@#{$breakpoint},
123
+ .hover\:h-#{$key}\@#{$breakpoint}:hover,
124
+ .group:hover .group-hover\:h-#{$key}\@#{$breakpoint} { @include height($value); }
125
+
126
+
90
127
  .min-w-#{$key}\@#{$breakpoint} { @include min-width($value); }
91
128
  .min-h-#{$key}\@#{$breakpoint} { @include min-height($value); }
92
129
  .max-w-#{$key}\@#{$breakpoint} { @include max-width($value); }