@nuvoui/core 1.1.3 → 1.1.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.
@@ -6,86 +6,44 @@
6
6
 
7
7
  @use './variables' as *;
8
8
 
9
-
10
- // todo: only functions and may be not needed
11
-
12
- @each $color-name, $color-value in $colors {
13
- .text-#{$color-name} { color: $color-value; }
14
- .bg-#{$color-name} { background-color: $color-value; }
15
- }
16
-
17
- // Modern Color System
18
9
  // Color Validation
19
10
  @function is-valid-color($color) {
20
11
  @return meta.type-of($color) == 'color';
21
12
  }
22
13
 
23
- // Modern Color Spaces
24
- @function to-lch($color) {
25
- @if not is-valid-color($color) {
26
- @error "Invalid color provided to to-lch";
27
- }
28
- @return color.adjust($color, $space: lch);
29
- }
30
-
31
- @function adaptive-color($color, $lightness-shift) {
32
- @return color.adjust($color, $space: lch, $lightness: $lightness-shift);
33
- }
34
-
35
- // Semantic Color System
36
- @function get-surface-color($color, $elevation) {
37
- $lch-color: to-lch($color);
38
- @return color.adjust($lch-color,
39
- $lightness: if($elevation > 0, 5 * $elevation, 0)
40
- );
41
- }
42
-
43
- // Color Harmony Generation
44
- @function complementary($color) {
45
- @return color.adjust($color, 180);
46
- }
47
-
48
- @function triadic($color) {
49
- @return (
50
- $color,
51
- color.adjust($color, 120),
52
- color.adjust($color, 240)
14
+ @function create-color-scale($color) {
15
+ $scale: ();
16
+ $stops: (
17
+ 50: 95%,
18
+ 100: 85%,
19
+ 200: 75%,
20
+ 300: 65%,
21
+ 400: 55%,
22
+ 500: 50%, // Base color
23
+ 600: 45%,
24
+ 700: 35%,
25
+ 800: 25%,
26
+ 900: 15%
53
27
  );
54
- }
55
-
56
- @function split-complementary($color) {
57
- @return (
28
+
29
+ @each $stop, $mix in $stops {
30
+ $value: if($stop == 500,
58
31
  $color,
59
- color.adjust($color, 150),
60
- color.adjust($color, 210)
61
- );
62
- }
63
-
64
- @function get-accent-palette($primary, $accent-angle: 45deg) {
65
- $lch: to-lch($primary);
66
- @return (
67
- subtle: color.adjust($lch, $lightness: 15%, $hue: $accent-angle),
68
- vibrant: color.adjust($lch, $saturation: 20%, $hue: $accent-angle * 2)
69
- );
70
- }
71
-
72
- // Color Scale Generation
73
- @function create-scale($color, $steps: 9) {
74
- $scale: ();
75
- $lch-color: to-lch($color);
76
-
77
- @for $i from 0 through $steps {
78
- $lightness: 95 - ($i * (90 / $steps));
79
- $new-color: color.adjust($lch-color, $lightness: $lightness);
80
- $scale: list.append($scale, $new-color);
32
+ if($stop < 500,
33
+ color.mix(white, $color, $mix),
34
+ color.mix(black, $color, (100% - $mix))
35
+ )
36
+ );
37
+ $scale: map.set($scale, $stop, $value);
81
38
  }
82
39
 
83
40
  @return $scale;
84
- }
41
+ }
42
+
85
43
 
86
44
  // Color Relationship Functions
87
- @function find-text-color($background) {
88
- $luminance: luminance($background);
45
+ @function find-text-color($color) {
46
+ $luminance: luminance($color);
89
47
  @return if($luminance > 0.55, #000, #fff);
90
48
  }
91
49
 
@@ -102,26 +60,13 @@
102
60
  @return $r * 0.2126 + $g * 0.7152 + $b * 0.0722;
103
61
  }
104
62
 
105
- // Contrast Calculations
106
- @function get-contrast-ratio($foreground, $background) {
107
- $l1: luminance($foreground) + 0.05;
108
- $l2: luminance($background) + 0.05;
109
- @return if($l1 > $l2, $l1 / $l2, $l2 / $l1);
110
- }
111
-
112
- // Color Validation
113
- @function has-sufficient-contrast($text, $background) {
114
- $contrast: get-contrast-ratio($text, $background);
115
- @return $contrast >= 4.5;
116
- }
117
-
118
63
  // Context-Aware Colors
119
- @mixin adaptive-contrast($background) {
120
- background: $background;
121
- color: find-text-color($background);
64
+ @mixin adaptive-contrast($color) {
65
+ background: $color;
66
+ color: find-text-color($color);
122
67
 
123
68
  @media (prefers-contrast: more) {
124
- $high-contrast: adjust-contrast($background, 20%);
69
+ $high-contrast: adjust-contrast($color, 20%);
125
70
 
126
71
  background: $high-contrast;
127
72
  }
@@ -136,6 +81,15 @@
136
81
  filter: $value;
137
82
  }
138
83
 
84
+ $colors: (
85
+ 'primary': create-color-scale($primary),
86
+ 'secondary': create-color-scale($secondary),
87
+ 'success': create-color-scale($success),
88
+ 'danger': create-color-scale($danger),
89
+ 'warning': create-color-scale($warning),
90
+ 'info': create-color-scale($info)
91
+ );
92
+
139
93
  // Glass Effect Utilities
140
94
  .glass-effect {
141
95
  @include backdrop-filter(blur(10px));
@@ -1,5 +1,8 @@
1
1
  @use 'sass:string';
2
2
  @use 'sass:math';
3
+ @use 'sass:map';
4
+ @use 'sass:list';
5
+ @use 'variables' as *;
3
6
 
4
7
  @function strip-unit($value) {
5
8
  @return math.div($value, ($value * 0 + 1));
@@ -56,4 +59,126 @@
56
59
 
57
60
  // Return empty string if no unit found
58
61
  @return '';
62
+ }
63
+
64
+ @if $enable-debuger {
65
+ .NuvoUI-Debugger-Wrapper {
66
+ color: #fff;
67
+ font-family: Arial, sans-serif;
68
+ position: fixed;
69
+ z-index: 999999;
70
+ inset: 10px auto auto 10px;
71
+ pointer-events: none;
72
+
73
+ &.top-left {
74
+ inset: 10px auto auto 10px;
75
+ text-align: left;
76
+ }
77
+
78
+ &.top-right {
79
+ inset: 10px 10px auto auto;
80
+ text-align: right;
81
+ }
82
+
83
+ &.bottom-left {
84
+ inset: auto auto 10px 10px;
85
+ text-align: left;
86
+ }
87
+
88
+ &.bottom-right {
89
+ inset: auto 10px 10px auto;
90
+ text-align: right;
91
+ }
92
+
93
+ .NuvoUI-Debugger-Main, .NuvoUI-Debugger{
94
+ padding: 10px;
95
+ background-color: rgb(0 0 0 / 80%);
96
+ border-radius: 5px;
97
+ border: 1px solid green;
98
+ box-shadow: 0 0 2px 0 #fff;
99
+ pointer-events: none;
100
+ }
101
+
102
+ .NuvoUI-Debugger-Main {
103
+ $breakpoint-keys: map.keys($breakpoints);
104
+ $total: list.length($breakpoint-keys);
105
+
106
+ &::before,
107
+ &::after {
108
+ font-family: 'Courier New', Courier, monospace;
109
+ font-size: 0.8em;
110
+ display: block;
111
+ }
112
+
113
+ &::before {
114
+ font-weight: bold;
115
+ }
116
+
117
+ @for $i from 1 through $total {
118
+ $current: list.nth($breakpoint-keys, $i);
119
+ $current-width: map.get($breakpoints, $current);
120
+
121
+ @if $i == 1 {
122
+ @media (max-width: $current-width) {
123
+ &::before {
124
+ content: "Screen: #{$current}";
125
+ }
126
+ }
127
+ } @else {
128
+ $prev: list.nth($breakpoint-keys, $i - 1);
129
+ $prev-width: map.get($breakpoints, $prev);
130
+
131
+ @media (min-width: $prev-width) and (max-width: ($current-width - 1)) {
132
+ &::before {
133
+ content: "Screen: #{$current}";
134
+ }
135
+ }
136
+ }
137
+ }
138
+
139
+ &::after {
140
+ content: attr(data-size);
141
+ }
142
+ }
143
+
144
+ .NuvoUI-Debugger {
145
+ margin-top: 10px;
146
+
147
+ &::before,
148
+ &::after {
149
+ font-family: 'Courier New', Courier, monospace;
150
+ font-size: 0.8em;
151
+ display: block;
152
+ }
153
+
154
+ &::before {
155
+ font-weight: bold;
156
+ content: attr(data-element);
157
+ }
158
+
159
+ &::after {
160
+ content: attr(data-size);
161
+ }
162
+ }
163
+
164
+ .NuvoUI-Debugger-Close {
165
+ color: #fff;
166
+ cursor: pointer;
167
+ font-size: 14px;
168
+ pointer-events: auto;
169
+ position: absolute;
170
+ right: 0;
171
+ top: 0;
172
+ background: #00800199;
173
+ border-radius: 20px;
174
+ height: 14px;
175
+ width: 14px;
176
+ line-height: 14px;
177
+ text-align: center;
178
+
179
+ &:hover {
180
+ background: #008001;
181
+ }
182
+ }
183
+ }
59
184
  }
@@ -28,8 +28,28 @@
28
28
  }
29
29
 
30
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)) {
31
+
32
+ $-lower: null;
33
+ $-upper: null;
34
+
35
+ @if map.has-key($breakpoints, $lower) {
36
+ $-lower: map.get($breakpoints, $lower);
37
+ } @else if meta.type-of($lower) == number {
38
+ $-lower: $lower - 0.02px;
39
+ } @else {
40
+ @warn 'Unknown lower breakpoint: #{$lower}';
41
+ }
42
+
43
+ @if map.has-key($breakpoints, $upper) {
44
+ $-upper: map.get($breakpoints, $upper);
45
+ } @else if meta.type-of($upper) == number {
46
+ $-upper: $upper - 0.02px;
47
+ } @else {
48
+ @warn 'Unknown uppper breakpoint: #{$upper}';
49
+ }
50
+
51
+ @if $-lower and $-upper {
52
+ @media screen and (min-width: $-lower) and (max-width: $-upper) {
33
53
  @content;
34
54
  }
35
55
  }
@@ -80,21 +100,17 @@
80
100
  }
81
101
  }
82
102
 
83
- // Modern feature detection
84
103
  // Example: @include supports(display: grid) { }
85
104
  @mixin supports($property) {
86
- @supports #{$property} {
105
+ @supports (#{$property}) {
87
106
  @content;
88
107
  }
89
108
  }
90
109
 
91
-
92
-
93
-
94
110
  // Mixin: Dark Mode
95
111
  // Applies styles when the user prefers a dark color scheme.
96
112
  @mixin dark-mode {
97
- @media (prefers-color-scheme: dark) {
113
+ [data-theme='dark'] & {
98
114
  @content;
99
115
  }
100
116
  }
@@ -81,7 +81,7 @@ $shadow-sizes: (
81
81
 
82
82
  // Utility Classes
83
83
  .shadow-none {
84
- box-shadow: none;
84
+ box-shadow: none !important;
85
85
  }
86
86
 
87
87
  @each $size, $values in $shadow-sizes {
@@ -41,10 +41,10 @@
41
41
  @each $i in $percentages {
42
42
  .w-#{$i}per { @include width-percent($i); }
43
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); }
44
+ .min-w-#{$i}per { @include min-width-percent($i); }
45
+ .min-h-#{$i}per { @include min-height-percent($i); }
46
+ .max-w-#{$i}per { @include max-width-percent($i); }
47
+ .max-h-#{$i}per { @include max-height-percent($i); }
48
48
  }
49
49
 
50
50
  // Generate utilities from spacing map
@@ -62,6 +62,12 @@
62
62
  @media (min-width: $width) {
63
63
  // Generate utilities from spacing map
64
64
  @each $i in $spacings {
65
+ .w-#{$i}per\@#{$breakpoint} { @include width-percent($i); }
66
+ .h-#{$i}per\@#{$breakpoint} { @include height-percent($i); }
67
+ .min-w-#{$i}per\@#{$breakpoint} { @include min-width-percent($i); }
68
+ .min-h-#{$i}per\@#{$breakpoint} { @include min-height-percent($i); }
69
+ .max-w-#{$i}per\@#{$breakpoint} { @include max-width-percent($i); }
70
+ .max-h-#{$i}per\@#{$breakpoint} { @include max-height-percent($i); }
65
71
  .w-#{$i}\@#{$breakpoint} { @include width($i); }
66
72
  .h-#{$i}\@#{$breakpoint} { @include height($i); }
67
73
  .min-w-#{$i}\@#{$breakpoint} { @include min-width($i) }
@@ -16,28 +16,27 @@
16
16
 
17
17
  // Convert value to string for unit checking
18
18
  $value-str: if(meta.type-of($value) == 'string', string.unquote($value), #{$value});
19
- @debug string.unquote( $value-str); // .widget:hover
20
19
 
21
20
  @return $value-str;
22
21
  }
23
22
 
24
23
  // Padding mixins
25
- @mixin p($val) { padding: format-unit-value($val) !important; }
26
- @mixin px($val) { $val: format-unit-value($val); padding-left: $val !important; padding-right: $val !important; }
27
- @mixin py($val) { $val: format-unit-value($val); padding-top: $val !important; padding-bottom: $val !important; }
28
- @mixin pt($val) { $val: format-unit-value($val); padding-top: $val !important; }
29
- @mixin pr($val) { $val: format-unit-value($val); padding-right: $val !important; }
30
- @mixin pb($val) { $val: format-unit-value($val); padding-bottom: $val !important; }
31
- @mixin pl($val) { $val: format-unit-value($val); padding-left: $val !important; }
24
+ @mixin p($val) { padding: format-unit-value($val); }
25
+ @mixin px($val) { $val: format-unit-value($val); padding-left: $val; padding-right: $val; }
26
+ @mixin py($val) { $val: format-unit-value($val); padding-top: $val; padding-bottom: $val; }
27
+ @mixin pt($val) { $val: format-unit-value($val); padding-top: $val; }
28
+ @mixin pr($val) { $val: format-unit-value($val); padding-right: $val; }
29
+ @mixin pb($val) { $val: format-unit-value($val); padding-bottom: $val; }
30
+ @mixin pl($val) { $val: format-unit-value($val); padding-left: $val; }
32
31
 
33
32
  // Margin mixins
34
- @mixin m($val) { $val: format-unit-value($val); margin: $val !important; }
35
- @mixin mx($val) { $val: format-unit-value($val); margin-left: $val !important; margin-right: $val !important; }
36
- @mixin my($val) { $val: format-unit-value($val); margin-top: $val !important; margin-bottom: $val !important; }
37
- @mixin mt($val) { $val: format-unit-value($val); margin-top: $val !important; }
38
- @mixin mr($val) { $val: format-unit-value($val); margin-right: $val !important; }
39
- @mixin mb($val) { $val: format-unit-value($val); margin-bottom: $val !important; }
40
- @mixin ml($val) { $val: format-unit-value($val); margin-left: $val !important; }
33
+ @mixin m($val) { $val: format-unit-value($val); margin: $val; }
34
+ @mixin mx($val) { $val: format-unit-value($val); margin-left: $val; margin-right: $val; }
35
+ @mixin my($val) { $val: format-unit-value($val); margin-top: $val; margin-bottom: $val; }
36
+ @mixin mt($val) { $val: format-unit-value($val); margin-top: $val; }
37
+ @mixin mr($val) { $val: format-unit-value($val); margin-right: $val; }
38
+ @mixin mb($val) { $val: format-unit-value($val); margin-bottom: $val; }
39
+ @mixin ml($val) { $val: format-unit-value($val); margin-left: $val; }
41
40
 
42
41
  // Auto margin utilities
43
42
  @mixin ml-auto { margin-left: auto; }
@@ -1,29 +1,59 @@
1
+ @use 'sass:map';
2
+
1
3
  // Global variables that might be used across different modules
4
+ $enable-debuger: false !default;
2
5
  $enable-dark-mode: true !default;
3
6
  $enable-rtl: true !default;;
4
7
  $enable-reduced-motion: true !default;;
5
8
 
6
9
  $column-count: 12 !default;
7
10
 
8
- $color-primary: #007bff !default;
9
- $color-secondary: #6c757d !default;
10
- $color-success: #28a745 !default;
11
- $color-danger: #dc3545 !default;
12
- $color-warning: #ffc107 !default;
13
- $color-info: #17a2b8 !default;
14
- $color-light: #f8f9fa !default;
15
- $color-dark: #1c1f22 !default;
11
+ $primary: #007bff !default;
12
+ $secondary: #6c757d !default;
13
+ $success: #28a745 !default;
14
+ $danger: #dc3545 !default;
15
+ $warning: #ffc107 !default;
16
+ $info: #17a2b8 !default;
17
+
18
+ $color-primitives: (
19
+ 'gray': #6b7280,
20
+ 'red': #ef4444,
21
+ 'blue': #3b82f6,
22
+ 'green': #22c55e,
23
+ 'yellow': #eab308,
24
+ 'purple': #a855f7,
25
+ 'pink': #ec4899
26
+ ) !default;
27
+
28
+
29
+ $theme-tokens: (
30
+ 'background',
31
+ 'foreground',
32
+ 'surface',
33
+ 'border',
34
+ 'text-primary',
35
+ 'text-secondary'
36
+ ) !default;
37
+
38
+ // Default theme config (can be overridden)
39
+ $light-theme: (
40
+ 'background': #fff,
41
+ 'foreground': #000,
42
+ 'surface': #fff,
43
+ 'border': #e5e7eb,
44
+ 'text-primary': #000,
45
+ 'text-secondary': #4b5563
46
+ ) !default;
47
+
48
+ $dark-theme: (
49
+ 'background': #000,
50
+ 'foreground': #fff,
51
+ 'surface': #1a1a1a,
52
+ 'border': #2e2e2e,
53
+ 'text-primary': #fff,
54
+ 'text-secondary': #a3a3a3
55
+ ) !default;
16
56
 
17
- $colors: (
18
- 'primary': $color-primary,
19
- 'secondary': $color-secondary,
20
- 'success': $color-success,
21
- 'danger': $color-danger,
22
- 'warning': $color-warning,
23
- 'info': $color-info,
24
- 'light': $color-light,
25
- 'dark': $color-dark
26
- );
27
57
 
28
58
  // Breakpoints
29
59
  $breakpoints: (
@@ -32,7 +62,7 @@ $breakpoints: (
32
62
  'md': 768px,
33
63
  'lg': 1024px,
34
64
  'xl': 1280px,
35
- 'xxl': 1536px,
65
+ '2xl': 1536px,
36
66
  ) !default;
37
67
 
38
68
  // Container max-widths
@@ -42,7 +72,7 @@ $container-max-widths: (
42
72
  'md': 720px,
43
73
  'lg': 960px,
44
74
  'xl': 1140px,
45
- 'xxl': 1320px,
75
+ '2xl': 1320px,
46
76
  ) !default;
47
77
 
48
78
  // _variables.scss
@@ -69,9 +99,9 @@ $padding-map: (
69
99
  ) !default;
70
100
 
71
101
  $spacings: (
72
- 0,1,2,3,4,5,10,15,20,25,30,35,40,45,50,60,70,80,90,100,125,150,175,200,250,300,350,400,450,500
102
+ 0,1,2,3,4,5,10,15,20,25,30,35,40,45,50,60,70,80,90,100,150,200,250,300,350,400,450,500
73
103
  ) !default;
74
104
 
75
105
  $percentages: (
76
- 0, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 95, 100
106
+ 0, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 100
77
107
  ) !default;