@nuvoui/core 0.3.0 → 1.0.1

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,20 +1,23 @@
1
1
  @use "sass:math";
2
2
  @use 'sass:color';
3
3
  @use 'sass:map';
4
+ @use 'sass:meta';
5
+ @use 'sass:list';
4
6
 
5
7
  @use './variables' as *;
6
8
 
9
+
10
+ // todo: only functions and may be not needed
11
+
7
12
  @each $color-name, $color-value in $colors {
8
13
  .text-#{$color-name} { color: $color-value; }
9
14
  .bg-#{$color-name} { background-color: $color-value; }
10
15
  }
11
16
 
12
17
  // Modern Color System
13
- // _colors.scss
14
-
15
18
  // Color Validation
16
19
  @function is-valid-color($color) {
17
- @return type-of($color) == 'color';
20
+ @return meta.type-of($color) == 'color';
18
21
  }
19
22
 
20
23
  // Modern Color Spaces
@@ -39,22 +42,22 @@
39
42
 
40
43
  // Color Harmony Generation
41
44
  @function complementary($color) {
42
- @return adjust-hue($color, 180);
45
+ @return color.adjust($color, 180);
43
46
  }
44
47
 
45
48
  @function triadic($color) {
46
49
  @return (
47
50
  $color,
48
- adjust-hue($color, 120),
49
- adjust-hue($color, 240)
51
+ color.adjust($color, 120),
52
+ color.adjust($color, 240)
50
53
  );
51
54
  }
52
55
 
53
56
  @function split-complementary($color) {
54
57
  @return (
55
58
  $color,
56
- adjust-hue($color, 150),
57
- adjust-hue($color, 210)
59
+ color.adjust($color, 150),
60
+ color.adjust($color, 210)
58
61
  );
59
62
  }
60
63
 
@@ -74,7 +77,7 @@
74
77
  @for $i from 0 through $steps {
75
78
  $lightness: 95 - ($i * (90 / $steps));
76
79
  $new-color: color.adjust($lch-color, $lightness: $lightness);
77
- $scale: append($scale, $new-color);
80
+ $scale: list.append($scale, $new-color);
78
81
  }
79
82
 
80
83
  @return $scale;
@@ -88,13 +91,13 @@
88
91
 
89
92
  // Luminance Calculation
90
93
  @function luminance($color) {
91
- $r: red($color) / 255;
92
- $g: green($color) / 255;
93
- $b: blue($color) / 255;
94
+ $r: color.red($color) / 255;
95
+ $g: color.green($color) / 255;
96
+ $b: color.blue($color) / 255;
94
97
 
95
- $r: if($r <= 0.03928, $r / 12.92, pow(($r + 0.055) / 1.055, 2.4));
96
- $g: if($g <= 0.03928, $g / 12.92, pow(($g + 0.055) / 1.055, 2.4));
97
- $b: if($b <= 0.03928, $b / 12.92, pow(($b + 0.055) / 1.055, 2.4));
98
+ $r: if($r <= 0.0393, $r / 12.92, pow(($r + 0.055) / 1.055, 2.4));
99
+ $g: if($g <= 0.0393, $g / 12.92, pow(($g + 0.055) / 1.055, 2.4));
100
+ $b: if($b <= 0.0393, $b / 12.92, pow(($b + 0.055) / 1.055, 2.4));
98
101
 
99
102
  @return $r * 0.2126 + $g * 0.7152 + $b * 0.0722;
100
103
  }
@@ -119,40 +122,29 @@
119
122
 
120
123
  @media (prefers-contrast: more) {
121
124
  $high-contrast: adjust-contrast($background, 20%);
125
+
122
126
  background: $high-contrast;
123
127
  }
124
128
  }
125
129
 
126
130
  // Filter Mixins
127
131
  @mixin backdrop-filter($value) {
128
- -webkit-backdrop-filter: $value;
129
132
  backdrop-filter: $value;
130
133
  }
131
134
 
132
135
  @mixin filter($value) {
133
- -webkit-filter: $value;
134
136
  filter: $value;
135
137
  }
136
138
 
137
139
  // Glass Effect Utilities
138
140
  .glass-effect {
139
141
  @include backdrop-filter(blur(10px));
140
- background-color: rgba(255, 255, 255, 0.1);
142
+
143
+ background-color: rgb(255 255 255 / 10%);
141
144
  }
142
145
 
143
146
  .frosted-glass {
144
147
  @include backdrop-filter(blur(5px) saturate(180%));
145
- background-color: rgba(255, 255, 255, 0.8);
148
+
149
+ background-color: rgb(255 255 255 / 80%);
146
150
  }
147
-
148
- // <div class="bg-primary-0">Lightest shade</div>
149
- // <div class="bg-primary-4">Middle shade</div>
150
- // <div class="bg-primary-8">Darkest shade</div>
151
-
152
- // <div class="brand-complementary">Complementary colors</div>
153
-
154
- // <div class="text-on-background">Accessible text</div>
155
-
156
- // <div class="glass-effect">
157
- // Blurred backdrop
158
- // </div>
@@ -0,0 +1,39 @@
1
+
2
+ @use './variables' as *;
3
+
4
+ // Display Mixins
5
+ @mixin d-none { display: none; }
6
+ @mixin d-block { display: block; }
7
+ @mixin d-inline { display: inline; }
8
+ @mixin d-inline-block { display: inline-block; }
9
+ @mixin d-tbl { display: table; }
10
+ @mixin d-tbl-row { display: table-row; }
11
+ @mixin d-tbl-cell { display: table-cell; }
12
+
13
+ // Base Classes
14
+ .hide { @include d-none; }
15
+ .block { @include d-block; }
16
+ .inline { @include d-inline; }
17
+ .inline-block { @include d-inline-block; }
18
+
19
+ .d {
20
+ &-tbl { @include d-tbl; }
21
+ &-tbl-row { @include d-tbl-row; }
22
+ &-tbl-cell { @include d-tbl-cell; }
23
+ }
24
+
25
+ // Responsive Variants
26
+ @each $breakpoint, $width in $breakpoints {
27
+ @media (min-width: $width) {
28
+ .hide\@#{$breakpoint} { @include d-none; }
29
+ .block\@#{$breakpoint} { @include d-block; }
30
+ .inline\@#{$breakpoint} { @include d-inline; }
31
+ .inline-block\@#{$breakpoint} { @include d-inline-block; }
32
+
33
+ .d {
34
+ &-tbl\@#{$breakpoint} { @include d-tbl; }
35
+ &-tbl-row\@#{$breakpoint} { @include d-tbl-row; }
36
+ &-tbl-cell\@#{$breakpoint} { @include d-tbl-cell; }
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,147 @@
1
+ @use 'sass:map';
2
+ @use 'sass:meta';
3
+ @use './variables' as *;
4
+
5
+ // Breakpoint mixins
6
+ @mixin media-up($breakpoint) {
7
+ @if map.has-key($breakpoints, $breakpoint) {
8
+ @media screen and (min-width: map.get($breakpoints, $breakpoint)) {
9
+ @content;
10
+ }
11
+ } @else if meta.type-of($breakpoint) == number {
12
+ @media screen and (min-width: $breakpoint) {
13
+ @content;
14
+ }
15
+ }
16
+ }
17
+
18
+ @mixin media-down($breakpoint) {
19
+ @if map.has-key($breakpoints, $breakpoint) {
20
+ @media screen and (max-width: (map.get($breakpoints, $breakpoint) - 0.02px)) {
21
+ @content;
22
+ }
23
+ } @else if meta.type-of($breakpoint) == number {
24
+ @media screen and (max-width: ($breakpoint - 0.02px)) {
25
+ @content;
26
+ }
27
+ }
28
+ }
29
+
30
+ @mixin media-between($lower, $upper) {
31
+ @if map.has-key($breakpoints, $lower) and map.has-key($breakpoints, $upper) {
32
+ @media screen and (min-width: map.get($breakpoints, $lower)) and (max-width: (map.get($breakpoints, $upper) - 0.02px)) {
33
+ @content;
34
+ }
35
+ }
36
+ }
37
+
38
+ // Only at specific breakpoint
39
+ @mixin media-only($breakpoint) {
40
+ @if map.has-key($breakpoints, $breakpoint) {
41
+ $min: map.get($breakpoints, $breakpoint);
42
+ $next-breakpoint: null;
43
+
44
+ @each $name, $width in $breakpoints {
45
+ @if $width > $min and (meta.type-of($next-breakpoint) == 'null' or $width < $next-breakpoint) {
46
+ $next-breakpoint: $width;
47
+ }
48
+ }
49
+
50
+ @if $next-breakpoint {
51
+ @media (min-width: $min) and (max-width: ($next-breakpoint - 1)) {
52
+ @content;
53
+ }
54
+ } @else {
55
+ @media (min-width: $min) {
56
+ @content;
57
+ }
58
+ }
59
+ }
60
+ }
61
+
62
+ // Example: @include container(45em) { }
63
+ @mixin container-query($size) {
64
+ @container (min-width: $size) {
65
+ @content;
66
+ }
67
+ }
68
+
69
+ // Touch devices
70
+ @mixin touch {
71
+ @media (hover: none) and (pointer: coarse) {
72
+ @content;
73
+ }
74
+ }
75
+
76
+ // Print media
77
+ @mixin print {
78
+ @media print {
79
+ @content;
80
+ }
81
+ }
82
+
83
+ // Modern feature detection
84
+ // Example: @include supports(display: grid) { }
85
+ @mixin supports($property) {
86
+ @supports #{$property} {
87
+ @content;
88
+ }
89
+ }
90
+
91
+
92
+
93
+
94
+ // Mixin: Dark Mode
95
+ // Applies styles when the user prefers a dark color scheme.
96
+ @mixin dark-mode {
97
+ @media (prefers-color-scheme: dark) {
98
+ @content;
99
+ }
100
+ }
101
+
102
+ // Device orientation
103
+ @mixin landscape {
104
+ @media screen and (orientation: landscape) {
105
+ @content;
106
+ }
107
+ }
108
+
109
+ @mixin portrait {
110
+ @media screen and (orientation: portrait) {
111
+ @content;
112
+ }
113
+ }
114
+
115
+ // Modern aspect ratio
116
+ @mixin aspect-ratio($ratio) {
117
+ aspect-ratio: #{$ratio};
118
+ }
119
+
120
+ // Dynamic viewport units (modern browsers)
121
+ @mixin dvh {
122
+ @supports (height: 100dvh) {
123
+ height: 100dvh;
124
+ }
125
+
126
+ @supports not (height: 100dvh) {
127
+ height: 100vh;
128
+ }
129
+ }
130
+
131
+ // Safe area insets (notches, home indicators)
132
+ @mixin safe-area-inset($property, $position) {
133
+ #{$property}: env(safe-area-inset-#{$position});
134
+ }
135
+
136
+ @mixin reduced-motion {
137
+ @media (prefers-reduced-motion: reduce) {
138
+ @content;
139
+ }
140
+ }
141
+
142
+ // High contrast mode
143
+ @mixin high-contrast {
144
+ @media (forced-colors: active) {
145
+ @content;
146
+ }
147
+ }
@@ -0,0 +1,20 @@
1
+ // _spacing.scss
2
+
3
+ @use 'sass:math';
4
+ @use './variables' as *;
5
+
6
+ // Opacity Utilities
7
+ @each $i in $percentages {
8
+ .opacity-#{$i} { opacity: math.div($i, 100); }
9
+ .hover\:opacity-#{$i}:hover { opacity: math.div($i, 100); }
10
+ }
11
+
12
+ // Responsive Variants for Opacity
13
+ @each $breakpoint, $width in $breakpoints {
14
+ @media (min-width: $width) {
15
+ @each $i in $percentages {
16
+ .opacity-#{$i}\@#{$breakpoint} { opacity: math.div($i, 100); }
17
+ .hover\:opacity-#{$i}\@#{$breakpoint}:hover { opacity: math.div($i, 100); }
18
+ }
19
+ }
20
+ }
@@ -1,63 +1,66 @@
1
1
  @use './variables' as *;
2
+
2
3
  // Position Mixins
3
- @mixin p-static {
4
+ @mixin static {
4
5
  position: static;
5
6
  }
6
7
 
7
- @mixin p-relative {
8
+ @mixin relative {
8
9
  position: relative;
9
10
  }
10
11
 
11
- @mixin p-absolute {
12
+ @mixin absolute {
12
13
  position: absolute;
13
14
  }
14
15
 
15
- @mixin p-fixed {
16
+ @mixin fixed {
16
17
  position: fixed;
17
- }
18
-
19
- @mixin p-sticky {
18
+ }
19
+
20
+ @mixin sticky {
20
21
  position: sticky;
21
- }
22
+ z-index: 999;
23
+ top: 0;
24
+ }
22
25
 
23
26
  // Position Classes
24
- .p-static {
25
- @include p-static;
27
+ .static {
28
+ @include static;
26
29
  }
27
30
 
28
- .p-relative {
29
- @include p-relative;
31
+ .relative {
32
+ @include relative;
30
33
  }
31
34
 
32
- .p-absolute {
33
- @include p-absolute;
35
+ .absolute {
36
+ @include absolute;
34
37
  }
35
38
 
36
- .p-fixed {
37
- @include p-fixed;
39
+ .fixed {
40
+ @include fixed;
38
41
  }
39
42
 
40
- .p-sticky {
41
- @include p-sticky;
43
+ .sticky {
44
+ @include sticky;
42
45
  }
43
46
 
44
47
  // Responsive Position Classes
45
48
  @each $breakpoint, $width in $breakpoints {
46
49
  @media (min-width: $width) {
47
- .p-static\@#{$breakpoint} {
48
- @include p-static;
50
+ .static\@#{$breakpoint} {
51
+ @include static;
49
52
  }
50
- .p-relative\@#{$breakpoint} {
51
- @include p-relative;
53
+ .relative\@#{$breakpoint} {
54
+ @include relative;
52
55
  }
53
- .p-absolute\@#{$breakpoint} {
54
- @include p-absolute;
56
+ .absolute\@#{$breakpoint} {
57
+ @include absolute;
55
58
  }
56
- .p-fixed\@#{$breakpoint} {
57
- @include p-fixed;
59
+ .fixed\@#{$breakpoint} {
60
+ @include fixed;
58
61
  }
59
- .p-sticky\@#{$breakpoint} {
60
- @include p-sticky;
62
+ .sticky\@#{$breakpoint} {
63
+ @include sticky;
61
64
  }
62
65
  }
63
66
  }
@@ -81,17 +84,23 @@
81
84
  }
82
85
 
83
86
  // Top, Right, Bottom, Left Classes
84
- @for $i from 0 through 100{
85
- .top-#{$i} {
86
- @include top($i);
87
- }
88
- .right-#{$i} {
89
- @include right($i);
90
- }
91
- .bottom-#{$i} {
92
- @include bottom($i);
93
- }
94
- .left-#{$i} {
95
- @include left($i);
87
+ @each $i in $spacings {
88
+ .top-#{$i} {@include top($i);}
89
+ .right-#{$i} {@include right($i);}
90
+ .bottom-#{$i} {@include bottom($i);}
91
+ .left-#{$i} {@include left($i);}
92
+ }
93
+
94
+
95
+ // Pixel widths based on spacing scale
96
+ @each $breakpoint, $width in $breakpoints {
97
+ @media (min-width: $width) {
98
+ // Generate utilities from spacing map
99
+ @each $i in $spacings {
100
+ .top-#{$i}\@#{$breakpoint} {height: if($i == 0, $i, $i + px);}
101
+ .right-#{$i}\@#{$breakpoint} {width: if($i == 0, $i, $i + px);}
102
+ .bottom-#{$i}\@#{$breakpoint} {min-width: if($i == 0, $i, $i + px);}
103
+ .left-#{$i}\@#{$breakpoint} {min-height: if($i == 0, $i, $i + px);}
104
+ }
96
105
  }
97
106
  }
@@ -7,10 +7,10 @@
7
7
 
8
8
  // Shadow Variables
9
9
  $shadow-colors: (
10
- 'default': rgba(0, 0, 0, 0.1),
11
- 'dark': rgba(0, 0, 0, 0.2),
12
- 'darker': rgba(0, 0, 0, 0.35),
13
- 'darkest': rgba(0, 0, 0, 0.5),
10
+ 'default': rgb(0 0 0 / 10%),
11
+ 'dark': rgb(0 0 0 / 20%),
12
+ 'darker': rgb(0 0 0 / 35%),
13
+ 'darkest': rgb(0 0 0 / 50%),
14
14
  );
15
15
 
16
16
  $shadow-sizes: (
@@ -60,7 +60,6 @@ $shadow-sizes: (
60
60
 
61
61
  @mixin shadow($size: 'md', $color: 'default') {
62
62
  $shadow: map.get($shadow-sizes, $size);
63
-
64
63
  $shadow-color: map.get($shadow-colors, $color);
65
64
  @include shadow-base(
66
65
  map.get($shadow, 'x'),
@@ -0,0 +1,73 @@
1
+ // _spacing.scss
2
+
3
+ @use 'sass:math';
4
+ @use './variables' as *;
5
+
6
+ @mixin width($value) { width: if($value == 0, $value, $value + px); }
7
+ @mixin height($value) { height: if($value == 0, $value, $value + px); }
8
+ @mixin min-width($value) { min-width: if($value == 0, $value, $value + px); }
9
+ @mixin min-height($value) { min-height: if($value == 0, $value, $value + px); }
10
+ @mixin max-width($value) { max-width: if($value == 0, $value, $value + px); }
11
+ @mixin max-height($value) { max-height: if($value == 0, $value, $value + px); }
12
+
13
+ @mixin width-percent($i) { width: #{$i + '%'}; }
14
+ @mixin height-percent($i) { height: #{$i + '%'}; }
15
+ @mixin min-width-percent($i) { min-width: #{$i + '%'}; }
16
+ @mixin min-height-percent($i) { min-height: #{$i + '%'}; }
17
+ @mixin max-width-percent($i) { max-width: #{$i + '%'}; }
18
+ @mixin max-height-percent($i) { max-height: #{$i + '%'}; }
19
+
20
+
21
+ @mixin w-auto { width: auto; }
22
+ @mixin w-full { width: 100%; }
23
+ @mixin h-auto { height: auto; }
24
+ @mixin h-full { height: 100%; }
25
+ @mixin min-w-full { min-width: 100%; }
26
+ @mixin max-w-full { max-width: 100%; }
27
+ @mixin min-h-full { min-height: 100%; }
28
+ @mixin max-h-full { max-height: 100%; }
29
+
30
+ :not(.flex)>.w-auto { @include w-auto; }
31
+ :not(.flex)>.w-full { @include w-full; }
32
+
33
+ .h-auto { @include h-auto; }
34
+ .h-full { @include h-full; }
35
+ .min-w-full { @include min-w-full }
36
+ .max-w-full { @include max-w-full }
37
+ .min-h-full { @include min-h-full }
38
+ .max-h-full { @include max-h-full }
39
+
40
+ // Percentage widths
41
+ @each $i in $percentages {
42
+ .w-#{$i}per { @include width-percent($i); }
43
+ .h-#{$i}per { @include height-percent($i); }
44
+ .min-w-#{$i} { @include min-width-percent($i); }
45
+ .min-h-#{$i} { @include min-height-percent($i); }
46
+ .max-w-#{$i} { @include max-width-percent($i); }
47
+ .max-h-#{$i} { @include max-height-percent($i); }
48
+ }
49
+
50
+ // Generate utilities from spacing map
51
+ @each $i in $spacings {
52
+ .w-#{$i} { @include width($i); }
53
+ .h-#{$i} { @include height($i); }
54
+ .min-w-#{$i} { @include min-width($i) }
55
+ .min-h-#{$i} { @include min-height($i) }
56
+ .max-w-#{$i} { @include max-width($i) }
57
+ .max-h-#{$i} { @include max-height($i) }
58
+ }
59
+
60
+ // Pixel widths based on spacing scale
61
+ @each $breakpoint, $width in $breakpoints {
62
+ @media (min-width: $width) {
63
+ // Generate utilities from spacing map
64
+ @each $i in $spacings {
65
+ .w-#{$i}\@#{$breakpoint} { @include width($i); }
66
+ .h-#{$i}\@#{$breakpoint} { @include height($i); }
67
+ .min-w-#{$i}\@#{$breakpoint} { @include min-width($i) }
68
+ .min-h-#{$i}\@#{$breakpoint} { @include min-height($i) }
69
+ .max-w-#{$i}\@#{$breakpoint} { @include max-width($i) }
70
+ .max-h-#{$i}\@#{$breakpoint} { @include max-height($i) }
71
+ }
72
+ }
73
+ }