@nulllogic/scssleon 1.0.3 → 1.0.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.
Files changed (46) hide show
  1. package/README.md +134 -34
  2. package/package.json +12 -10
  3. package/scss/_base.scss +37 -16
  4. package/scss/_config.scss +14 -40
  5. package/scss/_content.scss +32 -8
  6. package/scss/_functions.scss +12 -25
  7. package/scss/_mixins.scss +0 -1
  8. package/scss/_reset.scss +41 -11
  9. package/scss/_root.scss +8 -13
  10. package/scss/components/_accordion.scss +4 -4
  11. package/scss/components/_alert.scss +4 -4
  12. package/scss/components/_badge.scss +4 -4
  13. package/scss/components/_breadcrumb.scss +4 -4
  14. package/scss/components/_button.scss +4 -4
  15. package/scss/components/_button_group.scss +4 -4
  16. package/scss/components/_card.scss +4 -4
  17. package/scss/components/_container.scss +19 -17
  18. package/scss/components/_dropdown.scss +11 -1
  19. package/scss/components/_form.scss +3 -44
  20. package/scss/components/_loader.scss +4 -4
  21. package/scss/components/_megamenu.scss +15 -0
  22. package/scss/components/_modal.scss +4 -4
  23. package/scss/components/_nav.scss +4 -3
  24. package/scss/components/_navbar.scss +4 -4
  25. package/scss/components/_overlay.scss +4 -4
  26. package/scss/components/_pagination.scss +4 -4
  27. package/scss/components/_placeholder.scss +4 -23
  28. package/scss/components/_sidecap.scss +4 -4
  29. package/scss/components/_table.scss +3 -3
  30. package/scss/components/_tooltip.scss +15 -0
  31. package/scss/forms/_checkbox.scss +5 -5
  32. package/scss/forms/_input-group.scss +4 -4
  33. package/scss/forms/_input.scss +4 -4
  34. package/scss/forms/_label.scss +4 -4
  35. package/scss/forms/_radio.scss +4 -4
  36. package/scss/forms/_range.scss +4 -4
  37. package/scss/forms/_select.scss +4 -4
  38. package/scss/forms/_switch.scss +4 -4
  39. package/scss/forms/_validation.scss +4 -4
  40. package/scss/mixins/_utilities.scss +1 -1
  41. package/scss/mixins/generators/_color-sheme.scss +1 -13
  42. package/scss/mixins/generators/_components.scss +79 -16
  43. package/scss/mixins/generators/_properties.scss +163 -64
  44. package/scss/scssleon.scss +49 -37
  45. package/scss/themes/_default.scss +1417 -321
  46. package/scss/mixins/generators/_wrapper.scss +0 -16
@@ -1,17 +1,5 @@
1
1
  @use 'sass:map';
2
2
 
3
- @use '../../functions' as functions;
4
-
5
- // Media that add color variables
6
-
7
3
  @mixin generate-color-scheme($schema) {
8
- @if $schema == 'light' {
9
- @media (prefers-color-scheme: light) {
10
- @content
11
- }
12
- } @else if $schema == 'dark' {
13
- @media (prefers-color-scheme: dark) {
14
- @content
15
- }
16
- }
4
+ @content
17
5
  }
@@ -1,33 +1,96 @@
1
- @use "sass:map";
2
- @use "sass:meta";
1
+ @use 'sass:map';
2
+ @use 'sass:meta';
3
+ @use 'sass:list';
4
+ @use 'sass:string';
3
5
 
4
- @use "properties";
5
- @use "wrapper";
6
+ @use 'properties';
6
7
 
7
- @use "../../functions" as functions;
8
+ @use '../../functions' as functions;
8
9
 
9
- @mixin generate-component($component, $class, $config, $theme) {
10
- $theme-component: "";
10
+ @mixin generate-component($component, $class, $config, $theme, $options : ()) {
11
+ $theme-component: '';
11
12
 
12
- // Checking, if the component was previously defined inside theme components
13
- @if (meta.type-of($component) == "string") {
13
+ $color_scheme: functions.get-config($config, 'color-scheme');
14
+ $is_wrapper_enabled: functions.get-config($config, 'enable.wrapper');
15
+ $wrapper_class: functions.get-config($config, 'wrapper');
16
+
17
+ // Checking, if the component was previously defined inside theme's components
18
+ @if (meta.type-of($component) == 'string') {
14
19
  /* Loading component settings and styling */
15
20
  $theme-component: functions.get-theme(
16
- $theme,
17
- "components" + "." + $component
21
+ $theme,
22
+ 'components' + '.' + $component
18
23
  );
19
24
  } @else {
20
25
  $theme-component: $component;
21
26
  }
22
27
 
23
- %#{$class} {
24
- @include properties.generate-properties($class, $theme-component, $config);
28
+ @each $scheme in string.split(functions.get-config($config, 'color-scheme'), ' ') {
29
+
30
+ @if $scheme == 'light' {
31
+ @if ($is_wrapper_enabled) {
32
+ #{$wrapper_class} {
33
+ .#{$class} {
34
+ @include properties.generate-properties($class, $theme-component, $config, map.deep-merge((
35
+ scheme: $scheme,
36
+ ), $options));
37
+ }
38
+ }
39
+ } @else {
40
+ .#{$class} {
41
+ @include properties.generate-properties($class, $theme-component, $config, map.deep-merge((
42
+ scheme: $scheme,
43
+ ), $options));
44
+ }
45
+ }
46
+ }
47
+
48
+ @if $scheme == 'dark' {
49
+ @if ($is_wrapper_enabled) {
50
+ #{$wrapper_class}[data-theme="#{$scheme}"] {
51
+ .#{$class}:where([data-theme="#{$scheme}"], [data-theme="#{$scheme}"] *) {
52
+ @include properties.generate-properties($class, $theme-component, $config, map.deep-merge((
53
+ scheme: $scheme,
54
+ ), $options));
55
+ }
56
+ }
57
+
58
+ } @else {
59
+ .#{$class}:where([data-theme="#{$scheme}"], [data-theme="#{$scheme}"] *) {
60
+ @include properties.generate-properties($class, $theme-component, $config, map.deep-merge((
61
+ scheme: $scheme,
62
+ ), $options));
63
+ }
64
+
65
+ }
66
+ }
25
67
  }
68
+ }
69
+
70
+ @mixin generate-components($components, $config, $theme) {
26
71
 
27
- @include wrapper.generate-wrapper($config) {
28
- .#{$class} {
29
- @extend %#{$class};
72
+ // Get components
73
+ @each $component in $components {
74
+ // Component options param check
75
+ @if(list.length($component) > 2) {
76
+ @include generate-component(
77
+ list.nth($component, 1),
78
+ list.nth($component, 2),
79
+ $config: $config,
80
+ $theme: $theme,
81
+ $options: list.nth($component, 3),
82
+ )
83
+ } @else {
84
+ @include generate-component(
85
+ list.nth($component, 1),
86
+ list.nth($component, 2),
87
+ $config: $config,
88
+ $theme: $theme,
89
+ )
30
90
  }
31
91
  }
32
92
  }
33
93
 
94
+ @mixin get-structure($component) {
95
+ @debug $component;
96
+ }
@@ -1,116 +1,215 @@
1
1
  @use "sass:meta";
2
2
  @use "sass:string";
3
3
  @use "sass:map";
4
+ @use "sass:list";
4
5
 
5
6
  @use "../../functions" as functions;
6
7
  @use "../../mixins/generators/color-sheme" as mixin;
7
8
 
8
- @mixin generate-css-properties($tag, $property, $value, $config) {
9
- $prefix: functions.get-config($config, "prefix");
9
+ @mixin generate-css-properties($tag, $property, $value, $config, $options : ()) {
10
10
 
11
- & {
12
- --#{$prefix}-#{$tag}-#{functions.str-replace($property, '--', '')}: #{meta.inspect(
11
+ $prefix: functions.get-config($config, 'prefix');
12
+
13
+ $variable_options_custom_name: functions.get-config($options, 'variable.name');
14
+ $variable_options_exclude: functions.get-config($options, 'variable.exclude');
15
+
16
+ $variable_name: $tag;
17
+
18
+ $exclude: false;
19
+
20
+ @if ($variable_options_custom_name != nil) {
21
+ $variable_name: $variable_options_custom_name;
22
+ }
23
+
24
+ @if ($variable_options_exclude != nil) {
25
+
26
+ @if (meta.type-of($variable_options_exclude) == list) {
27
+ @each $variable_to_exclude in $variable_options_exclude {
28
+ @if string.index($property, --#{$variable_to_exclude}) {
29
+ $exclude: true
30
+ }
31
+ }
32
+ }
33
+
34
+ @if (meta.type-of($variable_options_exclude) == string) {
35
+ @if string.index($property, --#{$variable_options_exclude}) {
36
+ $exclude: true
37
+ }
38
+ }
39
+ }
40
+
41
+ @if ($exclude != true) {
42
+ --#{$prefix}-#{$variable_name}-#{functions.replace($property, '--', '')}: #{meta.inspect(
43
+ $value
44
+ )};
45
+ } @else {
46
+ --#{$prefix}-#{functions.replace($property, '--', '')}: #{meta.inspect(
13
47
  $value
14
48
  )};
15
49
  }
50
+
16
51
  }
17
52
 
18
- @mixin generate-css-variables($tag, $property, $value, $config) {
19
- $prefix: functions.get-config($config, "prefix");
53
+ @mixin generate-css-variables($tag, $property, $value, $config, $options) {
54
+ $prefix: functions.get-config($config, 'prefix');
55
+
56
+ $variable_options_custom_name: functions.get-config($options, 'variable.name');
57
+ $variable_options_exclude: functions.get-config($options, 'variable.exclude');
58
+
59
+ $variable_name : $tag;
60
+
61
+ @if ($variable_options_custom_name != nil) {
62
+ $variable_name: $variable_options_custom_name;
63
+ }
20
64
 
21
- @if (meta.type-of($value) == "string" and str-index($value, "var(--") == 1) {
22
- & {
23
- #{$property}: #{meta.inspect(
24
- functions.str-replace($value, "--", "--" + $prefix + "-" + $tag + "-")
65
+ @if (meta.type-of($value) == 'string' and string.index($value, 'var(--') == 1) {
66
+
67
+ #{$property}: #{meta.inspect(
68
+ functions.replace($value, '--', '--' + $prefix + '-' + $variable_name + '-')
25
69
  )};
26
- }
27
- } @else if (type-of($value) == "string" and str-index($value, "var(global(") == 1) {
28
- & {
29
- #{$property}: #{meta.inspect(
30
- functions.str-replace(
70
+
71
+ } @else if (meta.type-of($value) == 'string' and string.index($value, 'var(global(') == 1) {
72
+
73
+ #{$property}: #{meta.inspect(
74
+ functions.replace(
31
75
  string.slice($value, 0, string.length($value) - 1),
32
- "global(--",
33
- "--" + $prefix + "-root-"
76
+ 'global(--',
77
+ '--' + $prefix + '-root-'
34
78
  )
35
79
  )};
36
- }
80
+
37
81
  } @else {
38
- & {
39
- #{$property}: #{meta.inspect($value)};
40
- }
82
+
83
+ #{$property}: #{meta.inspect($value)};
84
+
41
85
  }
42
86
  }
43
87
 
44
- @mixin generate-colors($tag, $value, $config) {
45
- $prefix: functions.get-config($config, "prefix");
88
+ @mixin generate-colors($tag, $value, $config, $options, $requested_color : 'light') {
89
+ $prefix: functions.get-config($config, 'prefix');
46
90
 
47
91
  @each $color, $color-properties in $value {
48
- @each $scheme in functions.str-split(functions.get-config($config, "color-scheme"), " ") {
49
- @if $scheme == $color {
50
- @include mixin.generate-color-scheme($color) {
51
- @each $color-property, $color-value in $color-properties {
52
- & {
53
- --#{$prefix}-#{$tag}-#{functions.str-replace($color-property, '--', '')}: #{meta.inspect(
54
- $color-value
55
- )};
56
- }
57
- }
58
- }
92
+ @if ($color == $requested_color) {
93
+ @each $color-property, $color-value in $color-properties {
94
+ @include generate-css-properties($tag, $color-property, $color-value, $config, $options);
59
95
  }
60
96
  }
61
97
  }
62
98
  }
63
99
 
64
- @mixin generate-subclasses($tag, $class, $properties, $config) {
100
+ @mixin generate-subclasses($tag, $class, $properties, $config, $options : ()) {
65
101
  #{$class} {
66
- @include generate-properties($tag, $properties, $config);
102
+ @include generate-properties($tag, $properties, $config, $options);
67
103
  }
68
104
  }
69
105
 
70
106
  @mixin generate-responsive($tag, $properties, $config) {
71
- $breakpoints: functions.get-config($config, "breakpoints");
107
+ $breakpoints: functions.get-config($config, 'breakpoints');
72
108
 
73
- @each $breakpoint, $value in $breakpoints {
74
- $property: map.get($properties, $breakpoint);
109
+ @each $property, $value in $properties {
110
+ $has-matched-breakpoint: false;
75
111
 
76
- @if $property != null {
77
- @media (min-width: $value) {
78
- @include generate-properties($tag, $property, $config);
112
+ @each $breakpoint, $width in $breakpoints {
113
+ @if ($property == $breakpoint) {
114
+ $has-matched-breakpoint: true;
79
115
  }
80
116
  }
117
+
118
+ @if ($has-matched-breakpoint) {
119
+ $width: map.get($breakpoints, $property);
120
+
121
+ @media (min-width: $width) {
122
+ @include generate-properties($tag, $value, $config);
123
+ }
124
+
125
+ } @else {
126
+ @warn '❗️Invalid breakpoint '#{$property}'.';
127
+ }
128
+
81
129
  }
82
130
  }
83
131
 
84
- @mixin generate-properties($tag, $properties, $config) {
85
- $prefix: functions.get-config($config, "prefix");
132
+ @mixin generate-atrule($tag, $value, $config, $options) {
133
+ @each $at-rule, $properties in $value {
134
+ // Keep @ at the beginning
135
+ @#{functions.replace($at-rule, '@', '')} {
136
+ @include generate-properties($tag, $properties, $config, $options);
137
+ }
138
+ }
139
+ }
86
140
 
87
- @each $property, $value in $properties {
88
- // Variables
89
- // Looking for "--" symbols in the beginning of the property
90
- // Example: --flex-direction : row
91
- @if (
92
- meta.type-of($property) == "string" and str-index($property, "--") == 1
93
- ) {
94
- @include generate-css-properties($tag, $property, $value, $config);
141
+ @mixin generate-print($tag, $value, $config, $options) {
142
+ //@TODO
143
+ }
144
+
145
+ @mixin generate-animation($tag, $value, $config, $options) {
146
+ @each $name, $properties in $value {
147
+ // Check, if _animation is not empty ;;
148
+ @if (meta.type-of($properties) != 'list') {
149
+ @keyframes #{$name} {
150
+ @each $offset, $offset-value in $properties {
151
+ #{$offset} {
152
+ @include generate-properties($tag, $offset-value, $config, $options);
153
+ }
154
+ }
155
+ }
95
156
  }
157
+ }
158
+ }
159
+
160
+ @mixin generate-properties($tag, $properties, $config, $options : ()) {
161
+ $prefix: functions.get-config($config, 'prefix');
162
+ $is_scheme_dark: functions.get-config($options, 'scheme') != nil and functions.get-config($options, 'scheme') == 'dark';
163
+
164
+ @if (not $is_scheme_dark) {
165
+ @each $property, $value in $properties {
166
+ // Variables
167
+ // Looking for "--" symbols in the beginning of the property
168
+ // Example: --flex-direction : row
169
+ @if (
170
+ meta.type-of($property) == 'string' and string.index($property, "--") == 1
171
+ ) {
172
+ @include generate-css-properties($tag, $property, $value, $config, $options);
173
+ }
96
174
 
97
175
  // Colors
98
- @else if ($property == "colors") {
99
- @include generate-colors($tag, $value, $config);
100
- }
176
+ @else if ($property == '_colors') {
177
+ @include generate-colors($tag, $value, $config, $options, 'light');
178
+ }
101
179
 
102
180
  // Responsive
103
- @else if ($property == "responsive") {
104
- @include generate-responsive($tag, $value, $config);
105
- }
181
+ @else if ($property == '_responsive') {
182
+ @include generate-responsive($tag, $value, $config);
183
+ }
106
184
 
107
- // Subclasses
108
- @else if ($property == "subclasses") {
109
- @each $class, $class_properties in $value {
110
- @include generate-subclasses($tag, $class, $class_properties, $config);
185
+ // Sub classes
186
+ @else if ($property == "_subclasses") {
187
+ @each $class, $class_properties in $value {
188
+ @include generate-subclasses($tag, $class, $class_properties, $config, $options);
189
+ }
190
+ }
191
+
192
+ // At-rules
193
+ @else if ($property == '_atrule') {
194
+ @include generate-atrule($tag, $value, $config, $options);
195
+ }
196
+
197
+ // Animations
198
+ @else if ($property == '_animations') {
199
+ @include generate-animation($tag, $value, $config, $options);
200
+ } @else {
201
+ @include generate-css-variables($tag, $property, $value, $config, $options);
202
+ }
203
+ }
204
+ } @else {
205
+ @each $property, $value in $properties {
206
+ @if ($property == '_colors') {
207
+ @include generate-colors($tag, $value, $config, $options, 'dark');
208
+ } @else if ($property == '_subclasses') {
209
+ @each $class, $class_properties in $value {
210
+ @include generate-subclasses($tag, $class, $class_properties, $config, $options);
211
+ }
111
212
  }
112
- } @else {
113
- @include generate-css-variables($tag, $property, $value, $config);
114
213
  }
115
214
  }
116
215
  }
@@ -1,3 +1,8 @@
1
+ @charset "UTF-8";
2
+
3
+ @forward './mixins';
4
+ @forward './functions';
5
+
1
6
  /*
2
7
  * ------------------------------------------------------------------
3
8
  * ███████╗ ██████╗ ██████╗███████╗██╗ ███████╗ ██████╗ ███╗ ██╗
@@ -23,7 +28,7 @@ Main configuration - initial configuration requirement
23
28
  // Those two variables will be used to store configuration settings and theme settings
24
29
  // You can easily customize any available options to fit your needs
25
30
  $config: (
26
- prefix: "xii",
31
+ prefix: 'xii',
27
32
  enable: (
28
33
  wrapper: false,
29
34
  ),
@@ -37,104 +42,105 @@ $theme: (
37
42
 
38
43
  // ↓ Config
39
44
  // Override default config | @example
40
- @use "config" as config with (
45
+ @use 'config' as config with (
41
46
  $config: $config
42
47
  );
43
48
 
44
49
  // ↓ Theme
45
50
  /* Override default settings in the theme | @example */
46
- @use "themes/default" as theme with (
47
- $theme: $theme
51
+ @use 'themes/default' as theme with (
52
+ $theme: $theme,
53
+ $config: config.$config,
48
54
  );
49
55
 
50
56
  // Getting updated variables
51
57
  $config: config.$config;
52
58
  $theme: theme.$theme;
53
59
 
54
- /* Main configuration END
55
- -------------------------------------------------------*/
56
60
 
57
61
  /* ------------------------------------------------------------------
58
62
  * Loading modules - this is default configuration with all modules enabled
59
63
  */
60
64
 
61
65
  // ↓ Root
62
- @use "root" with (
66
+ @use 'root' with (
63
67
  $config: $config,
64
68
  $theme: $theme
65
69
  );
66
70
 
67
- // Great reset
68
- @use "reset" with (
71
+ // Great reset
72
+ @use 'reset' with (
69
73
  $config: $config,
70
74
  $theme: $theme
71
75
  );
72
76
 
73
- // Base
77
+ // Base
74
78
  // Special utility, that will dynamically generate CSS
75
79
  // properties for HTML tags, specified in theme
76
- @use "base" with (
80
+ @use 'base' with (
77
81
  $config: $config,
78
82
  $theme: $theme
79
83
  );
80
84
 
81
- // Amazing content
85
+ // Amazing content
82
86
  // Special class `.content` to allow formatting of the default html tags
83
- @use "content" with (
87
+ @use 'content' with (
84
88
  $config: $config,
85
89
  $theme: $theme
86
90
  );
87
91
 
88
92
  // ↓ Container
89
- @use "components/container" with (
93
+ @use 'components/container' with (
90
94
  $config: $config,
91
95
  $theme: $theme
92
96
  );
93
97
 
94
98
  // ↓ Card
95
- @use "components/card" with (
99
+ @use 'components/card' with (
96
100
  $config: $config,
97
101
  $theme: $theme
98
102
  );
99
103
 
100
104
  // ↓ Badge
101
- @use "components/badge" with (
105
+ @use 'components/badge' with (
102
106
  $config: $config,
103
107
  $theme: $theme
104
108
  );
105
109
 
106
110
  // ↓ Form
107
- @use "components/form" with (
111
+ @use 'components/form' with (
108
112
  $config: $config,
109
113
  $theme: $theme
110
114
  );
111
115
 
112
116
  // ↓ Buttons
113
- @use "components/button" with (
117
+ @use 'components/button' with (
114
118
  $config: $config,
115
119
  $theme: $theme
116
120
  );
117
- @use "components/button_group" with (
121
+ @use 'components/button_group' with (
118
122
  $config: $config,
119
123
  $theme: $theme
120
124
  );
121
125
 
122
- ////@use "components/icon";
123
- //@use "components/button";
124
- ////@use "components/button-group";
126
+ ////@use 'components/icon';
127
+ //@use 'components/button';
128
+ ////@use 'components/button-group';
125
129
 
126
130
  // ↓ Breadcrumbs
127
- @use "components/breadcrumb" with (
131
+ @use 'components/breadcrumb' with (
128
132
  $config: $config,
129
133
  $theme: $theme
130
134
  );
131
135
 
132
- @use "components/alert" with (
136
+ // Alert
137
+ @use 'components/alert' with (
133
138
  $config: $config,
134
139
  $theme: $theme
135
140
  );
136
141
 
137
- @use "components/accordion" with (
142
+ // Accordion
143
+ @use 'components/accordion' with (
138
144
  $config: $config,
139
145
  $theme: $theme
140
146
  );
@@ -146,60 +152,66 @@ $theme: theme.$theme;
146
152
  //);
147
153
 
148
154
  // ↓ Overlay
149
- @use "components/overlay" with (
155
+ @use 'components/overlay' with (
150
156
  $config: $config,
151
157
  $theme: $theme
152
158
  );
153
159
 
154
160
  // ↓ Pagination
155
- @use "components/pagination" with (
161
+ @use 'components/pagination' with (
156
162
  $config: $config,
157
163
  $theme: $theme
158
164
  );
159
165
 
160
166
  // ↓ Placeholder
161
- @use "components/placeholder" with (
167
+ @use 'components/placeholder' with (
162
168
  $config: $config,
163
169
  $theme: $theme
164
170
  );
165
171
 
166
172
  // ↓ Modal
167
- @use "components/modal" with (
173
+ @use 'components/modal' with (
168
174
  $config: $config,
169
175
  $theme: $theme
170
176
  );
171
177
 
172
178
  // ↓ Loader
173
- @use "components/loader" with (
179
+ @use 'components/loader' with (
174
180
  $config: $config,
175
181
  $theme: $theme
176
182
  );
177
183
 
178
184
  // ↓ Nav
179
- @use "components/nav" with (
185
+ @use 'components/nav' with (
180
186
  $config: $config,
181
187
  $theme: $theme
182
188
  );
183
189
 
184
190
  // ↓ Navigation bar
185
- @use "components/navbar" with (
191
+ @use 'components/navbar' with (
186
192
  $config: $config,
187
193
  $theme: $theme
188
194
  );
189
195
 
190
196
  // ↓ Sidecap
191
- @use "components/sidecap" with (
197
+ @use 'components/sidecap' with (
198
+ $config: $config,
199
+ $theme: $theme
200
+ );
201
+
202
+ // ↓ Tooltip
203
+ @use 'components/tooltip' with (
192
204
  $config: $config,
193
205
  $theme: $theme
194
206
  );
195
207
 
196
208
  // ↓ Helpers
197
- @use "helpers/clearfix";
198
- @use "helpers/screen_reader";
199
- @use "helpers/text_truncate";
209
+ @use 'helpers/clearfix';
210
+ @use 'helpers/screen_reader';
211
+ @use 'helpers/text_truncate';
200
212
 
201
213
  // ↓ Utilities
202
- @use "utilities/api" with (
214
+ @use 'utilities/api' with (
203
215
  $config: $config,
204
216
  $theme: $theme
205
217
  );