@nuvoui/core 0.2.1 → 0.3.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.
@@ -0,0 +1,184 @@
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
33
+ (max-width: (map.get($breakpoints, $upper) - 0.02px)) {
34
+ @content;
35
+ }
36
+ }
37
+ }
38
+
39
+ // Only at specific breakpoint
40
+ @mixin media-only($breakpoint) {
41
+ @if map.has-key($breakpoints, $breakpoint) {
42
+ $min: map.get($breakpoints, $breakpoint);
43
+ $next-breakpoint: null;
44
+
45
+ @each $name, $width in $breakpoints {
46
+ @if $width > $min and ($next-breakpoint == null or $width < $next-breakpoint) {
47
+ $next-breakpoint: $width;
48
+ }
49
+ }
50
+
51
+ @if $next-breakpoint {
52
+ @media (min-width: $min) and (max-width: $next-breakpoint - 1) {
53
+ @content;
54
+ }
55
+ } @else {
56
+ @media (min-width: $min) {
57
+ @content;
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ // Example: @include container(45em) { }
64
+ @mixin container-query($size) {
65
+ @container (min-width: $size) {
66
+ @content;
67
+ }
68
+ }
69
+
70
+ // Touch devices
71
+ @mixin touch {
72
+ @media (hover: none) and (pointer: coarse) {
73
+ @content;
74
+ }
75
+ }
76
+
77
+ // Print media
78
+ @mixin print {
79
+ @media print {
80
+ @content;
81
+ }
82
+ }
83
+
84
+ // Retina displays
85
+ @mixin retina {
86
+ @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
87
+ @content;
88
+ }
89
+ }
90
+
91
+ // Modern feature detection
92
+ // Example: @include supports(display: grid) { }
93
+ @mixin supports($property) {
94
+ @supports #{$property} {
95
+ @content;
96
+ }
97
+ }
98
+
99
+ // Reduced motion preference
100
+ @mixin reduced-motion {
101
+ @media (prefers-reduced-motion: reduce) {
102
+ @content;
103
+ }
104
+ }
105
+
106
+ // High contrast mode
107
+ @mixin high-contrast {
108
+ @media (forced-colors: active) {
109
+ @content;
110
+ }
111
+ }
112
+
113
+ // Dark mode
114
+ @mixin dark-mode {
115
+ @media (prefers-color-scheme: dark) {
116
+ @content;
117
+ }
118
+ }
119
+
120
+ // Device orientation
121
+ @mixin landscape {
122
+ @media screen and (orientation: landscape) {
123
+ @content;
124
+ }
125
+ }
126
+
127
+ @mixin portrait {
128
+ @media screen and (orientation: portrait) {
129
+ @content;
130
+ }
131
+ }
132
+
133
+ // Modern hover capabilities
134
+ @mixin hover-device {
135
+ @media (hover: hover) and (pointer: fine) {
136
+ @content;
137
+ }
138
+ }
139
+
140
+ // Modern aspect ratio
141
+ @mixin aspect-ratio($ratio) {
142
+ @supports (aspect-ratio: #{$ratio}) {
143
+ aspect-ratio: #{$ratio};
144
+ }
145
+
146
+ @supports not (aspect-ratio: #{$ratio}) {
147
+ &::before {
148
+ float: left;
149
+ padding-top: percentage(1 / $ratio);
150
+ content: '';
151
+ }
152
+
153
+ &::after {
154
+ display: block;
155
+ content: '';
156
+ clear: both;
157
+ }
158
+ }
159
+ }
160
+
161
+ // Dynamic viewport units (modern browsers)
162
+ @mixin dvh {
163
+ @supports (height: 100dvh) {
164
+ height: 100dvh;
165
+ }
166
+
167
+ @supports not (height: 100dvh) {
168
+ height: 100vh;
169
+ }
170
+ }
171
+
172
+ // Safe area insets (notches, home indicators)
173
+ @mixin safe-area-inset($property, $position) {
174
+ #{$property}: env(safe-area-inset-#{$position});
175
+ }
176
+
177
+ // Color scheme transition
178
+ @mixin color-scheme-transition {
179
+ @media (prefers-reduced-motion: no-preference) {
180
+ transition: background-color 0.3s ease, color 0.3s ease;
181
+ }
182
+ }
183
+
184
+
@@ -52,23 +52,22 @@
52
52
  // Generate utilities from spacing map
53
53
  @each $i in $spacings {
54
54
  // Padding classes
55
- .#{$breakpoint}\:p-#{$i} { @include p($i); }
56
- .#{$breakpoint}\:px-#{$i} { @include px($i); }
57
- .#{$breakpoint}\:py-#{$i} { @include py($i); }
58
- .#{$breakpoint}\:pt-#{$i} { @include pt($i); }
59
- .#{$breakpoint}\:pr-#{$i} { @include pr($i); }
60
- .#{$breakpoint}\:pb-#{$i} { @include pb($i); }
61
- .#{$breakpoint}\:pl-#{$i} { @include pl($i); }
55
+ .p-#{$i}\@#{$breakpoint} { @include p($i); }
56
+ .px-#{$i}\@#{$breakpoint} { @include px($i); }
57
+ .py-#{$i}\@#{$breakpoint} { @include py($i); }
58
+ .pt-#{$i}\@#{$breakpoint} { @include pt($i); }
59
+ .pr-#{$i}\@#{$breakpoint} { @include pr($i); }
60
+ .pb-#{$i}\@#{$breakpoint} { @include pb($i); }
61
+ .pl-#{$i}\@#{$breakpoint} { @include pl($i); }
62
62
 
63
63
  // Margin classes
64
- .#{$breakpoint}\:m-#{$i} { @include m($i); }
65
- .#{$breakpoint}\:mx-#{$i} { @include mx($i); }
66
- .#{$breakpoint}\:my-#{$i} { @include my($i); }
67
- .#{$breakpoint}\:mt-#{$i} { @include mt($i); }
68
- .#{$breakpoint}\:mr-#{$i} { @include mr($i); }
69
- .#{$breakpoint}\:mb-#{$i} { @include mb($i); }
70
- .#{$breakpoint}\:ml-#{$i} { @include ml($i); }
71
- // .gap-#{$key} { gap: $value; }
64
+ .m-#{$i}\@#{$breakpoint} { @include m($i); }
65
+ .mx-#{$i}\@#{$breakpoint} { @include mx($i); }
66
+ .my-#{$i}\@#{$breakpoint} { @include my($i); }
67
+ .mt-#{$i}\@#{$breakpoint} { @include mt($i); }
68
+ .mr-#{$i}\@#{$breakpoint} { @include mr($i); }
69
+ .mb-#{$i}\@#{$breakpoint} { @include mb($i); }
70
+ .ml-#{$i}\@#{$breakpoint} { @include ml($i); }
72
71
  }
73
72
  }
74
73
  }
@@ -106,4 +105,15 @@
106
105
  .gap-#{$i} { @include gap($i); }
107
106
  .gap-x-#{$i} { @include gap-x($i); }
108
107
  .gap-y-#{$i} { @include gap-y($i); }
108
+ }
109
+
110
+ // Responsive Gap Classes
111
+ @each $breakpoint, $width in $breakpoints {
112
+ @media (min-width: $width) {
113
+ @each $i in $spacings {
114
+ .gap-#{$i}\@#{$breakpoint} { gap: $i; }
115
+ .gap-x-#{$i}\@#{$breakpoint} { column-gap: $i; }
116
+ .gap-y-#{$i}\@#{$breakpoint} { row-gap: $i; }
117
+ }
118
+ }
109
119
  }