@nuvoui/core 1.1.4 → 1.1.6

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,58 @@
1
+ @use 'sass:map';
2
+ @use 'sass:meta';
3
+ @use './variables' as *;
4
+ @use './functions' as FN;
5
+
6
+ /// Container Query: Up
7
+ @mixin container-up($breakpoint, $containerName: null) {
8
+ $bp-val: FN.get-breakpoint-value($breakpoint);
9
+ @container #{$containerName} (min-width: #{$bp-val}) {
10
+ @content;
11
+ }
12
+ }
13
+
14
+ /// Container Query: Down
15
+ @mixin container-down($breakpoint, $containerName: null) {
16
+ $bp-val: FN.get-breakpoint-value($breakpoint);
17
+ @container #{$containerName} (max-width: (#{ $bp-val } - 0.02px)) {
18
+ @content;
19
+ }
20
+ }
21
+
22
+ /// Container Query: Between
23
+ @mixin container-between($lower, $upper, $containerName: null) {
24
+ $min: FN.get-breakpoint-value($lower);
25
+ $max: FN.get-breakpoint-value($upper);
26
+ @container #{$containerName} (min-width: #{$min}) and (max-width: (#{ $max } - 0.02px)) {
27
+ @content;
28
+ }
29
+ }
30
+
31
+ /// Container Query: Only
32
+ @mixin container-only($breakpoint, $containerName: null) {
33
+ $min: FN.get-breakpoint-value($breakpoint);
34
+ $next-breakpoint: null;
35
+
36
+ @each $name, $width in $breakpoints {
37
+ @if $width > $min and (not $next-breakpoint or $width < $next-breakpoint) {
38
+ $next-breakpoint: $width;
39
+ }
40
+ }
41
+
42
+ @if $next-breakpoint {
43
+ @container #{$containerName} (min-width: #{$min}) and (max-width: (#{ $next-breakpoint } - 0.02px)) {
44
+ @content;
45
+ }
46
+ } @else {
47
+ @container #{$containerName} (min-width: #{$min}) {
48
+ @content;
49
+ }
50
+ }
51
+ }
52
+
53
+ /// Container Query: Query by Size
54
+ @mixin container-query($size, $containerName: null) {
55
+ @container #{$containerName} (min-width: $size) {
56
+ @content;
57
+ }
58
+ }
@@ -1,36 +1,79 @@
1
+ // Section: Utilities
2
+ // Module: Display
1
3
 
2
4
  @use './variables' as *;
3
- @use './functions' as *;
5
+ @use './functions' as FN;
4
6
 
5
7
  // Display Mixins
6
- @mixin d-none { display: none; }
7
- @mixin d-block { display: block; }
8
- @mixin d-inline { display: inline; }
9
- @mixin d-inline-block { display: inline-block; }
8
+
9
+ /**
10
+ * @description Set display to none.
11
+ */
12
+ @mixin hide { display: none; }
13
+
14
+ /**
15
+ * @description Set display to block.
16
+ */
17
+ @mixin block { display: block; }
18
+
19
+ /**
20
+ * @description Set display to inline.
21
+ */
22
+ @mixin inline { display: inline; }
23
+
24
+ /**
25
+ * @description Set display to inline-block.
26
+ */
27
+ @mixin inline-block { display: inline-block; }
28
+
29
+ /**
30
+ * @description Set display to initial original state.
31
+ */
32
+ @mixin show { display: revert; }
33
+
34
+ /**
35
+ * @description Set display to table.
36
+ */
10
37
  @mixin d-tbl { display: table; }
38
+
39
+ /**
40
+ * @description Set display to table-row.
41
+ */
11
42
  @mixin d-tbl-row { display: table-row; }
43
+
44
+ /**
45
+ * @description Set display to table-cell.
46
+ */
12
47
  @mixin d-tbl-cell { display: table-cell; }
13
48
 
49
+
50
+
51
+ @mixin overflow-hidden { overflow: hidden; }
52
+
14
53
  // Base Classes
15
- .hide { @include d-none; }
16
- .block { @include d-block; }
17
- .inline { @include d-inline; }
18
- .inline-block { @include d-inline-block; }
54
+ .hide { @include hide; }
55
+ .show { @include show; }
56
+ .block { @include block; }
57
+ .inline { @include inline; }
58
+ .inline-block { @include inline-block; }
59
+ .overflow-hidden { @include overflow-hidden; }
19
60
 
20
61
  .d {
21
62
  &-tbl { @include d-tbl; }
22
63
  &-tbl-row { @include d-tbl-row; }
23
64
  &-tbl-cell { @include d-tbl-cell; }
24
65
  }
25
-
66
+
26
67
  // Responsive Variants
27
68
  @each $breakpoint, $width in $breakpoints {
28
- @media (min-width: $width) {
29
- .hide\@#{$breakpoint} { @include d-none; }
30
- .block\@#{$breakpoint} { @include d-block; }
31
- .inline\@#{$breakpoint} { @include d-inline; }
32
- .inline-block\@#{$breakpoint} { @include d-inline-block; }
33
-
69
+ @media (min-width: #{$width}) {
70
+ .hide\@#{$breakpoint} { @include hide; }
71
+ .show\@#{$breakpoint} { @include show; }
72
+ .block\@#{$breakpoint} { @include block; }
73
+ .inline\@#{$breakpoint} { @include inline; }
74
+ .inline-block\@#{$breakpoint} { @include inline-block; }
75
+ .overflow-hidden\@#{$breakpoint} { @include overflow-hidden; }
76
+
34
77
  .d {
35
78
  &-tbl\@#{$breakpoint} { @include d-tbl; }
36
79
  &-tbl-row\@#{$breakpoint} { @include d-tbl-row; }
@@ -1,5 +1,30 @@
1
1
  @use 'sass:string';
2
2
  @use 'sass:math';
3
+ @use 'sass:map';
4
+ @use 'sass:list';
5
+ @use 'sass:meta';
6
+ @use 'variables' as *;
7
+
8
+ @function str-replace($string, $search, $replace: " ") {
9
+ $index: string.index($string, $search);
10
+ @if $index {
11
+ @return string.slice($string, 1, $index - 1)
12
+ + $replace
13
+ + str-replace(string.slice($string, $index + string.length($search)), $search, $replace);
14
+ }
15
+ @return $string;
16
+ }
17
+
18
+ @function get-breakpoint-value($bp) {
19
+ @if map.has-key($breakpoints, $bp) {
20
+ @return map.get($breakpoints, $bp);
21
+ } @else if meta.type-of($bp) == number {
22
+ @return $bp;
23
+ } @else {
24
+ @warn 'Invalid breakpoint: #{$bp}';
25
+ @return null;
26
+ }
27
+ }
3
28
 
4
29
  @function strip-unit($value) {
5
30
  @return math.div($value, ($value * 0 + 1));
@@ -51,9 +76,9 @@
51
76
  } @else if string.index($value-str, 'pt') {
52
77
  @return 'pt';
53
78
  } @else if string.index($value-str, 'pc') {
54
- @return 'pc';
79
+ @return 'pc';
55
80
  }
56
81
 
57
82
  // Return empty string if no unit found
58
83
  @return '';
59
- }
84
+ }
@@ -0,0 +1,128 @@
1
+ @use 'sass:string';
2
+ @use 'sass:math';
3
+ @use 'sass:map';
4
+ @use 'sass:list';
5
+ @use 'sass:meta';
6
+ @use 'variables' as *;
7
+
8
+ @if $enable-debuger {
9
+ .NuvoUI-Debugger-Wrapper {
10
+ color: #fff;
11
+ font-family: Arial, sans-serif;
12
+ position: fixed;
13
+ z-index: 999999;
14
+ inset: 10px auto auto 10px;
15
+ pointer-events: none;
16
+
17
+ &.top-left {
18
+ inset: 10px auto auto 10px;
19
+ text-align: left;
20
+ }
21
+
22
+ &.top-right {
23
+ inset: 10px 10px auto auto;
24
+ text-align: right;
25
+ }
26
+
27
+ &.bottom-left {
28
+ inset: auto auto 10px 10px;
29
+ text-align: left;
30
+ }
31
+
32
+ &.bottom-right {
33
+ inset: auto 10px 10px auto;
34
+ text-align: right;
35
+ }
36
+
37
+ .NuvoUI-Debugger-Main, .NuvoUI-Debugger{
38
+ padding: 10px;
39
+ background-color: rgb(0 0 0 / 80%);
40
+ border-radius: 5px;
41
+ border: 1px solid green;
42
+ box-shadow: 0 0 2px 0 #fff;
43
+ pointer-events: none;
44
+ }
45
+
46
+ .NuvoUI-Debugger-Main {
47
+ $breakpoint-keys: map.keys($breakpoints);
48
+ $total: list.length($breakpoint-keys);
49
+
50
+ &::before,
51
+ &::after {
52
+ font-family: 'Courier New', Courier, monospace;
53
+ font-size: 0.8em;
54
+ display: block;
55
+ }
56
+
57
+ &::before {
58
+ font-weight: bold;
59
+ }
60
+
61
+ @for $i from 1 through $total {
62
+ $current: list.nth($breakpoint-keys, $i);
63
+ $current-width: map.get($breakpoints, $current);
64
+
65
+ @if $i == 1 {
66
+ @media (max-width: #{$current-width}) {
67
+ &::before {
68
+ content: "Screen: #{$current}";
69
+ }
70
+ }
71
+ } @else {
72
+ $prev: list.nth($breakpoint-keys, $i - 1);
73
+ $prev-width: map.get($breakpoints, $prev);
74
+
75
+ @media (min-width: #{$prev-width}) and (max-width: (#{$current-width} - 1)) {
76
+ &::before {
77
+ content: "Screen: #{$current}";
78
+ }
79
+ }
80
+ }
81
+ }
82
+
83
+ &::after {
84
+ content: attr(data-size);
85
+ }
86
+ }
87
+
88
+ .NuvoUI-Debugger {
89
+ margin-top: 10px;
90
+
91
+ &::before,
92
+ &::after {
93
+ font-family: 'Courier New', Courier, monospace;
94
+ font-size: 0.8em;
95
+ display: block;
96
+ }
97
+
98
+ &::before {
99
+ font-weight: bold;
100
+ content: attr(data-element);
101
+ }
102
+
103
+ &::after {
104
+ content: attr(data-size);
105
+ }
106
+ }
107
+
108
+ .NuvoUI-Debugger-Close {
109
+ color: #fff;
110
+ cursor: pointer;
111
+ font-size: 14px;
112
+ pointer-events: auto;
113
+ position: absolute;
114
+ right: 0;
115
+ top: 0;
116
+ background: #00800199;
117
+ border-radius: 20px;
118
+ height: 14px;
119
+ width: 14px;
120
+ line-height: 14px;
121
+ text-align: center;
122
+
123
+ &:hover {
124
+ background: #008001;
125
+ }
126
+ }
127
+ }
128
+ }
@@ -1,68 +1,56 @@
1
+ // Section: Utilities
2
+ // Module: Media Queries
3
+
1
4
  @use 'sass:map';
2
5
  @use 'sass:meta';
3
6
  @use './variables' as *;
7
+ @use './functions' as FN;
8
+
4
9
 
5
- // Breakpoint mixins
10
+ /**
11
+ * @description Media query mixins.
12
+ * @param {string|number} $breakpoint - The breakpoint value.
13
+ * @param {string} $type - The media query type (e.g. 'lg', 'md').
14
+ */
6
15
  @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
- }
16
+ @media screen and (min-width: #{FN.get-breakpoint-value($breakpoint)}) {
17
+ @content;
15
18
  }
16
19
  }
17
20
 
18
21
  @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
- }
22
+ @media screen and (max-width: (#{FN.get-breakpoint-value($breakpoint)} - 0.02px)) {
23
+ @content;
27
24
  }
28
25
  }
29
26
 
30
27
  @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
- }
28
+ $lower-val: FN.get-breakpoint-value($lower);
29
+ $upper-val: FN.get-breakpoint-value($upper);
30
+ @media screen and (min-width: #{$lower-val}) and (max-width: (#{ $upper-val } - 0.02px)) {
31
+ @content;
35
32
  }
36
33
  }
37
34
 
38
35
  // Only at specific breakpoint
39
36
  @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
- }
37
+ $min: FN.get-breakpoint-value($breakpoint);
38
+ $next-breakpoint: null;
39
+
40
+ @each $name, $width in $breakpoints {
41
+ @if $width > $min and (not $next-breakpoint or $width < $next-breakpoint) {
42
+ $next-breakpoint: #{$width};
58
43
  }
59
44
  }
60
- }
61
-
62
- // Example: @include container(45em) { }
63
- @mixin container-query($size) {
64
- @container (min-width: $size) {
65
- @content;
45
+
46
+ @if $next-breakpoint {
47
+ @media (min-width: #{$min}) and (max-width: (#{ $next-breakpoint } - 1)) {
48
+ @content;
49
+ }
50
+ } @else {
51
+ @media (min-width: #{$min}) {
52
+ @content;
53
+ }
66
54
  }
67
55
  }
68
56
 
@@ -80,17 +68,13 @@
80
68
  }
81
69
  }
82
70
 
83
- // Modern feature detection
84
71
  // Example: @include supports(display: grid) { }
85
72
  @mixin supports($property) {
86
- @supports #{$property} {
73
+ @supports (#{$property}) {
87
74
  @content;
88
75
  }
89
76
  }
90
77
 
91
-
92
-
93
-
94
78
  // Mixin: Dark Mode
95
79
  // Applies styles when the user prefers a dark color scheme.
96
80
  @mixin dark-mode {
@@ -11,7 +11,7 @@
11
11
 
12
12
  // Responsive Variants for Opacity
13
13
  @each $breakpoint, $width in $breakpoints {
14
- @media (min-width: $width) {
14
+ @media (min-width: #{$width}) {
15
15
  @each $i in $percentages {
16
16
  .opacity-#{$i}\@#{$breakpoint} { opacity: math.div($i, 100); }
17
17
  .hover\:opacity-#{$i}\@#{$breakpoint}:hover { opacity: math.div($i, 100); }
@@ -46,7 +46,7 @@
46
46
 
47
47
  // Responsive Position Classes
48
48
  @each $breakpoint, $width in $breakpoints {
49
- @media (min-width: $width) {
49
+ @media (min-width: #{$width}) {
50
50
  .static\@#{$breakpoint} {
51
51
  @include static;
52
52
  }
@@ -94,7 +94,7 @@
94
94
 
95
95
  // Pixel widths based on spacing scale
96
96
  @each $breakpoint, $width in $breakpoints {
97
- @media (min-width: $width) {
97
+ @media (min-width: #{$width}) {
98
98
  // Generate utilities from spacing map
99
99
  @each $i in $spacings {
100
100
  .top-#{$i}\@#{$breakpoint} {height: if($i == 0, $i, $i + px);}
@@ -2,6 +2,7 @@
2
2
 
3
3
  @use 'sass:math';
4
4
  @use './variables' as *;
5
+ @use './container-queries' as Q;
5
6
 
6
7
  @mixin width($value) { width: if($value == 0, $value, $value + px); }
7
8
  @mixin height($value) { height: if($value == 0, $value, $value + px); }
@@ -41,10 +42,10 @@
41
42
  @each $i in $percentages {
42
43
  .w-#{$i}per { @include width-percent($i); }
43
44
  .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); }
45
+ .min-w-#{$i}per { @include min-width-percent($i); }
46
+ .min-h-#{$i}per { @include min-height-percent($i); }
47
+ .max-w-#{$i}per { @include max-width-percent($i); }
48
+ .max-h-#{$i}per { @include max-height-percent($i); }
48
49
  }
49
50
 
50
51
  // Generate utilities from spacing map
@@ -59,9 +60,26 @@
59
60
 
60
61
  // Pixel widths based on spacing scale
61
62
  @each $breakpoint, $width in $breakpoints {
62
- @media (min-width: $width) {
63
+
64
+ .w-#{$breakpoint} { @include width($width); }
65
+ .min-w-#{$breakpoint} { @include min-width($width) }
66
+ .max-w-#{$breakpoint} { @include max-width($width) }
67
+
68
+ @each $b, $w in $breakpoints {
69
+ .min-w-#{$breakpoint}\@#{$b} { @include min-width($width) }
70
+ .max-w-#{$breakpoint}\@#{$b} { @include max-width($width) }
71
+ }
72
+
73
+ @include Q.container-up ($breakpoint) {
63
74
  // Generate utilities from spacing map
75
+
64
76
  @each $i in $spacings {
77
+ .w-#{$i}per\@#{$breakpoint} { @include width-percent($i); }
78
+ .h-#{$i}per\@#{$breakpoint} { @include height-percent($i); }
79
+ .min-w-#{$i}per\@#{$breakpoint} { @include min-width-percent($i); }
80
+ .min-h-#{$i}per\@#{$breakpoint} { @include min-height-percent($i); }
81
+ .max-w-#{$i}per\@#{$breakpoint} { @include max-width-percent($i); }
82
+ .max-h-#{$i}per\@#{$breakpoint} { @include max-height-percent($i); }
65
83
  .w-#{$i}\@#{$breakpoint} { @include width($i); }
66
84
  .h-#{$i}\@#{$breakpoint} { @include height($i); }
67
85
  .min-w-#{$i}\@#{$breakpoint} { @include min-width($i) }
@@ -93,7 +93,7 @@
93
93
 
94
94
  // Responsive Position Classes
95
95
  @each $breakpoint, $width in $breakpoints {
96
- @media (min-width: $width) {
96
+ @media (min-width: #{$width}) {
97
97
  .mx-auto\@#{$breakpoint} { @include mx-auto; }
98
98
  .ml-auto\@#{$breakpoint} { @include ml-auto; }
99
99
  .mr-auto\@#{$breakpoint} { @include mr-auto; }
@@ -1,17 +1,20 @@
1
+ // Section: Text
2
+ // Module: Text
3
+
1
4
  @use 'sass:map';
2
5
 
3
6
  // Import variables
4
7
  @use '../utilities/variables' as *;
5
8
 
6
9
  // Utilities for text sizes
7
- @mixin text-xs { font-size: map.get($font-sizes, 'xs'); }
8
- @mixin text-sm { font-size: map.get($font-sizes, 'sm'); }
9
- @mixin text-md { font-size: map.get($font-sizes, 'md'); }
10
- @mixin text-lg { font-size: map.get($font-sizes, 'lg'); }
11
- @mixin text-xl { font-size: map.get($font-sizes, 'xl'); }
12
- @mixin text-2xl { font-size: map.get($font-sizes, '2xl'); }
13
- @mixin text-3xl { font-size: map.get($font-sizes, '3xl'); }
14
- @mixin text-4xl { font-size: map.get($font-sizes, '4xl'); }
10
+
11
+ /**
12
+ * Text size utility
13
+ * @param {string} $size - The size of the text.
14
+ */
15
+ @mixin text-size($size) {
16
+ font-size: map.get($font-sizes, $size);
17
+ }
15
18
 
16
19
  // Font weights
17
20
  @mixin font-thin { font-weight: 100; }
@@ -58,15 +61,9 @@
58
61
  @mixin truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
59
62
 
60
63
 
61
- // Generate text size utilities
62
- .text-xs { @include text-xs; }
63
- .text-sm { @include text-sm; }
64
- .text-md { @include text-md; }
65
- .text-lg { @include text-lg; }
66
- .text-xl { @include text-xl; }
67
- .text-2xl { @include text-2xl; }
68
- .text-3xl { @include text-3xl; }
69
- .text-4xl { @include text-4xl; }
64
+ @each $size, $val in $font-sizes {
65
+ .text-#{$size} { @include text-size($size); }
66
+ }
70
67
 
71
68
  // Generate font weight utilities
72
69
  .font-thin { @include font-thin; }
@@ -107,3 +104,54 @@
107
104
  .no-underline { @include no-underline; }
108
105
 
109
106
  .truncate { @include truncate; }
107
+
108
+
109
+ @each $breakpoint, $width in $breakpoints {
110
+ @media (min-width: #{$width}) {
111
+ @each $size, $val in $font-sizes {
112
+ // .text-#{$size}\@#{$breakpoint} { @include text-size($size); }
113
+ .text-#{$size}\@#{$breakpoint} { @include text-size($size); }
114
+ }
115
+
116
+ // Generate font weight utilities
117
+ .font-thin\@#{$breakpoint} { @include font-thin; }
118
+ .font-extralight\@#{$breakpoint} { @include font-extralight; }
119
+ .font-light\@#{$breakpoint} { @include font-light; }
120
+ .font-normal\@#{$breakpoint} { @include font-normal; }
121
+ .font-medium\@#{$breakpoint} { @include font-medium; }
122
+ .font-semibold\@#{$breakpoint} { @include font-semibold; }
123
+ .font-bold\@#{$breakpoint} { @include font-bold; }
124
+ .font-extrabold\@#{$breakpoint} { @include font-extrabold; }
125
+ .font-black\@#{$breakpoint} { @include font-black; }
126
+
127
+ // Generate line height utilities
128
+ .leading-none\@#{$breakpoint} { @include leading-none; }
129
+ .leading-tight\@#{$breakpoint} { @include leading-tight; }
130
+ .leading-snug\@#{$breakpoint} { @include leading-snug; }
131
+ .leading-normal\@#{$breakpoint} { @include leading-normal; }
132
+ .leading-relaxed\@#{$breakpoint} { @include leading-relaxed; }
133
+ .leading-loose\@#{$breakpoint} { @include leading-loose; }
134
+
135
+ // Generate text alignment utilities
136
+ .text-left\@#{$breakpoint} { @include text-left; }
137
+ .text-center\@#{$breakpoint} { @include text-center; }
138
+ .text-right\@#{$breakpoint} { @include text-right; }
139
+ .text-justify\@#{$breakpoint} { @include text-justify; }
140
+
141
+ // Classes using mixins
142
+ .uppercase\@#{$breakpoint} { @include uppercase; }
143
+ .lowercase\@#{$breakpoint} { @include lowercase; }
144
+ .capitalize\@#{$breakpoint} { @include capitalize; }
145
+ .normal-case\@#{$breakpoint} { @include normal-case; }
146
+
147
+ .italic\@#{$breakpoint} { @include italic; }
148
+ .not-italic\@#{$breakpoint} { @include not-italic; }
149
+
150
+ .underline\@#{$breakpoint} { @include underline; }
151
+ .line-through\@#{$breakpoint} { @include line-through; }
152
+ .no-underline\@#{$breakpoint} { @include no-underline; }
153
+
154
+ .truncate\@#{$breakpoint} { @include truncate; }
155
+ }
156
+ }
157
+