@nulllogic/scssleon 1.0.38 → 1.1.0

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 (36) hide show
  1. package/README.md +247 -40
  2. package/package.json +6 -13
  3. package/scss/_base.scss +22 -3
  4. package/scss/_config.scss +11 -37
  5. package/scss/_content.scss +14 -6
  6. package/scss/_functions.scss +4 -4
  7. package/scss/_mixins.scss +0 -15
  8. package/scss/_reset.scss +26 -6
  9. package/scss/_root.scss +8 -12
  10. package/scss/components/_container.scss +19 -17
  11. package/scss/components/_dropdown.scss +7 -1
  12. package/scss/components/_form.scss +3 -44
  13. package/scss/components/_megamenu.scss +15 -0
  14. package/scss/components/_placeholder.scss +1 -20
  15. package/scss/components/_tooltip.scss +15 -0
  16. package/scss/forms/_checkbox.scss +1 -1
  17. package/scss/mixins/generators/_components.scss +31 -16
  18. package/scss/mixins/generators/_properties.scss +164 -44
  19. package/scss/scssleon.scss +36 -37
  20. package/scss/themes/_default.scss +1368 -303
  21. package/scss/_utilities.scss +0 -356
  22. package/scss/animations/_placeholder.scss +0 -12
  23. package/scss/helpers/_clearfix.scss +0 -5
  24. package/scss/helpers/_screen_reader.scss +0 -11
  25. package/scss/helpers/_text_truncate.scss +0 -5
  26. package/scss/mixins/_border-radius.scss +0 -3
  27. package/scss/mixins/_box-shadow.scss +0 -16
  28. package/scss/mixins/_clearfix.scss +0 -9
  29. package/scss/mixins/_forms.scss +0 -152
  30. package/scss/mixins/_gradients.scss +0 -6
  31. package/scss/mixins/_grid.scss +0 -93
  32. package/scss/mixins/_transition.scss +0 -30
  33. package/scss/mixins/_utilities.scss +0 -15
  34. package/scss/mixins/generators/_color-sheme.scss +0 -17
  35. package/scss/mixins/generators/_wrapper.scss +0 -16
  36. package/scss/utilities/_api.scss +0 -24
package/scss/_root.scss CHANGED
@@ -1,6 +1,7 @@
1
1
  /* - ૮₍ ˃ ⤙ ˂ ₎ა – root */
2
- @use "sass:string";
3
- @use "./mixins" as mixins;
2
+ @use 'sass:string';
3
+
4
+ @use './mixins' as mixins;
4
5
  @use "./functions" as functions;
5
6
 
6
7
  $config: () !default;
@@ -10,20 +11,15 @@ $prefix: functions.get-config($config, "prefix");
10
11
 
11
12
  $is-smooth-scroll-enabled: functions.get-config(
12
13
  $config,
13
- "enable.smooth-scroll"
14
+ 'enable.smooth-scroll'
14
15
  );
15
16
 
16
- $color_scheme: functions.get-config($config, "color-scheme");
17
-
18
- $root-variables: functions.get-theme($theme, "root.variables");
19
-
20
17
  :root {
21
- color-scheme: string.unquote($color_scheme);
22
-
18
+ /* 🌱𖣂🫚🌿 */
23
19
  @include mixins.generate-properties(
24
- "root",
25
- functions.get-theme($theme, "root"),
26
- $config
20
+ 'root',
21
+ functions.get-theme($theme, 'root'),
22
+ $config,
27
23
  );
28
24
 
29
25
  @if $is-smooth-scroll-enabled {
@@ -3,36 +3,38 @@
3
3
  │ │ ││││ │ ├─┤││││├┤ ├┬┘
4
4
  └─┘└─┘┘└┘ ┴ ┴ ┴┴┘└┘└─┘┴└─
5
5
  **/
6
+ @use 'sass:map';
6
7
 
7
- @use "sass:map";
8
- @use "../themes/default" as theme;
9
- @use "../functions" as functions;
8
+ @use '../functions' as functions;
10
9
  @use "../mixins" as mixins;
11
10
 
12
11
  $config: nil !default;
13
12
  $theme: nil !default;
14
13
 
15
- $prefix: functions.get-config($config, "prefix");
16
- $color_scheme: functions.get-config($config, "color-scheme");
14
+ $prefix: functions.get-config($config, 'prefix');
15
+ $color_scheme: functions.get-config($config, 'color-scheme');
17
16
 
18
- $breakpoints: functions.get-config($config, "breakpoints");
17
+ $breakpoints: functions.get-config($config, 'breakpoints');
19
18
 
20
- $container-component: functions.get-theme($theme, "components.container");
19
+ $container-component: functions.get-theme($theme, 'components.container');
21
20
 
22
21
  // Container
23
- @each $name, $size in $breakpoints {
24
- @include mixins.breakpoint($size, "min") {
25
- .container.#{$name} {
26
- max-width: $size;
27
- @include mixins.generate-properties(
28
- "container",
29
- $container-component,
30
- $config
31
- );
22
+ .container {
23
+ @include mixins.generate-properties(
24
+ 'container',
25
+ $container-component,
26
+ $config
27
+ );
28
+
29
+ @each $name, $size in $breakpoints {
30
+ @include mixins.breakpoint($size, 'min') {
31
+ &.#{$name} {
32
+ max-width: $size;
33
+ }
32
34
  }
33
35
  }
34
- }
35
36
 
37
+ }
36
38
  /**
37
39
  ==[ Note ]==
38
40
  We are using mixin here, because @include is not working with @media query in SCSS | 07.12.2023
@@ -6,4 +6,10 @@
6
6
 
7
7
  /* Load mixins/functions */
8
8
  @use '../mixins' as mixins;
9
- @use '../functions' as functions;
9
+ @use '../functions' as functions;
10
+
11
+ /* SCSS variables definition requirement */
12
+ $config: nil !default;
13
+ $theme: nil !default;
14
+
15
+ @include mixins.generate-component('dropdown', 'dropdown', $config, $theme);
@@ -1,50 +1,9 @@
1
- @use '../config';
1
+ /* Load mixins/functions */
2
2
  @use '../mixins' as mixins;
3
+ @use '../functions' as functions;
3
4
 
4
5
  /* SCSS variables definition requirement */
5
6
  $config: nil !default;
6
7
  $theme: nil !default;
7
8
 
8
- @use '../forms/label' with (
9
- $config : $config,
10
- $theme : $theme
11
- );
12
-
13
- @use '../forms/input' with (
14
- $config : $config,
15
- $theme : $theme
16
- );
17
-
18
- @use '../forms/select' with (
19
- $config : $config,
20
- $theme : $theme
21
- );
22
-
23
- @use '../forms/radio' with (
24
- $config : $config,
25
- $theme : $theme
26
- );
27
-
28
- @use '../forms/checkbox' with (
29
- $config : $config,
30
- $theme : $theme
31
- );
32
-
33
- @use '../forms/range' with (
34
- $config : $config,
35
- $theme : $theme
36
- );
37
-
38
- @use '../forms/switch' with (
39
- $config : $config,
40
- $theme : $theme
41
- );
42
-
43
-
44
- //@forward '../forms/form-text';
45
- //@forward '../forms/form-control';
46
- //@forward '../forms/form-select';
47
- //@forward '../forms/form-check';
48
- //@forward '../forms/form-range';
49
- //@forward '../forms/input-group';
50
- //@forward '../forms/validation';
9
+ @include mixins.generate-component('form', 'form', $config, $theme);
@@ -0,0 +1,15 @@
1
+ /*
2
+ ┬ ┌─┐┌─┐┌┬┐┌─┐┬─┐
3
+ │ │ │├─┤ ││├┤ ├┬┘
4
+ ┴─┘└─┘┴ ┴─┴┘└─┘┴└─
5
+ */
6
+
7
+ /* Load mixins/functions */
8
+ @use '../mixins' as mixins;
9
+ @use '../functions' as functions;
10
+
11
+ /* SCSS variables definition requirement */
12
+ $config: nil !default;
13
+ $theme: nil !default;
14
+
15
+ @include mixins.generate-component('megamenu', 'megamenu', $config, $theme);
@@ -12,23 +12,4 @@
12
12
  $config: nil !default;
13
13
  $theme: nil !default;
14
14
 
15
- @include mixins.generate-component(
16
- 'placeholder',
17
- 'placeholder',
18
- $config,
19
- $theme
20
- );
21
-
22
- @keyframes placeholder-glow {
23
- 50% {
24
- opacity: 0.5;
25
- }
26
- }
27
-
28
- @keyframes placeholder-wave {
29
- 100% {
30
- mask-position: -200% 0;
31
- -webkit-mask-position: -200% 0;
32
- }
33
- }
34
-
15
+ @include mixins.generate-component('placeholder', 'placeholder', $config, $theme);
@@ -0,0 +1,15 @@
1
+ /*
2
+ ┌┬┐┌─┐┌─┐┬ ┌┬┐┬┌─┐
3
+ │ │ ││ ││ │ │├─┘
4
+ ┴ └─┘└─┘┴─┘┴ ┴┴
5
+ */
6
+
7
+ /* Load mixins/functions */
8
+ @use '../mixins' as mixins;
9
+ @use '../functions' as functions;
10
+
11
+ /* SCSS variables definition requirement */
12
+ $config: nil !default;
13
+ $theme: nil !default;
14
+
15
+ @include mixins.generate-component('tooltip', 'has-tooltip', $config, $theme, (variable: (name : 'tooltip')));
@@ -10,5 +10,5 @@ $theme: nil !default;
10
10
  'form.checkbox',
11
11
  'checkbox',
12
12
  $config,
13
- $theme
13
+ $theme,
14
14
  );
@@ -1,38 +1,53 @@
1
1
  @use 'sass:map';
2
2
  @use 'sass:meta';
3
+ @use 'sass:list';
4
+ @use 'sass:string';
3
5
 
4
6
  @use 'properties';
5
- @use 'wrapper';
6
7
 
7
8
  @use '../../functions' as functions;
8
9
 
9
- @mixin generate-component($component, $class, $config, $theme) {
10
+ @mixin generate-component($component, $class, $config, $theme, $options : ()) {
10
11
  $theme-component: '';
12
+ $color_scheme: functions.get-config($config, 'color-scheme');
11
13
 
12
- // Checking, if the component was previously defined inside theme components
14
+ // Checking, if the component was previously defined inside theme's components
13
15
  @if (meta.type-of($component) == 'string') {
14
16
  /* Loading component settings and styling */
15
17
  $theme-component: functions.get-theme(
16
- $theme,
17
- 'components' + '.' + $component
18
+ $theme,
19
+ 'components' + '.' + $component
18
20
  );
19
21
  } @else {
20
22
  $theme-component: $component;
21
23
  }
22
24
 
23
- %#{$class} {
24
- @include properties.generate-properties($class, $theme-component, $config);
25
+ .#{$class} {
26
+ @include properties.generate-properties($class, $theme-component, $config, $options);
25
27
  }
26
28
 
27
- @include wrapper.generate-wrapper($config) {
28
- .#{$class} {
29
- @extend %#{$class};
30
- }
31
- }
32
29
  }
33
30
 
34
- //@mixin generate-components($component, $class, $config, $theme) {
35
-
36
- @mixin get-structure ($component) {
37
- @debug $component;
31
+ @mixin generate-components($components, $config, $theme) {
32
+
33
+ // Get components
34
+ @each $component in $components {
35
+ // Component options param check
36
+ @if (list.length($component) > 2) {
37
+ @include generate-component(
38
+ list.nth($component, 1),
39
+ list.nth($component, 2),
40
+ $config: $config,
41
+ $theme: $theme,
42
+ $options: list.nth($component, 3),
43
+ )
44
+ } @else {
45
+ @include generate-component(
46
+ list.nth($component, 1),
47
+ list.nth($component, 2),
48
+ $config: $config,
49
+ $theme: $theme,
50
+ )
51
+ }
52
+ }
38
53
  }
@@ -1,106 +1,226 @@
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
- @use "../../mixins/generators/color-sheme" as mixin;
7
7
 
8
- @mixin generate-css-properties($tag, $property, $value, $config) {
9
- $prefix: functions.get-config($config, "prefix");
8
+ @mixin generate-css-properties($tag, $property, $value, $config, $options : ()) {
10
9
 
11
- --#{$prefix}-#{$tag}-#{functions.replace($property, '--', '')}: #{meta.inspect(
10
+ $prefix: functions.get-config($config, 'prefix');
11
+
12
+ $variable_options_custom_name: functions.get-config($options, 'variable.name');
13
+ $variable_options_exclude: functions.get-config($options, 'variable.exclude');
14
+
15
+ $variable_name: $tag;
16
+
17
+ $exclude: false;
18
+
19
+ @if ($variable_options_custom_name != nil) {
20
+ $variable_name: $variable_options_custom_name;
21
+ }
22
+
23
+ @if ($variable_options_exclude != nil) {
24
+
25
+ @if (meta.type-of($variable_options_exclude) == list) {
26
+ @each $variable_to_exclude in $variable_options_exclude {
27
+ @if string.index($property, --#{$variable_to_exclude}) {
28
+ $exclude: true
29
+ }
30
+ }
31
+ }
32
+
33
+ @if (meta.type-of($variable_options_exclude) == string) {
34
+ @if string.index($property, --#{$variable_options_exclude}) {
35
+ $exclude: true
36
+ }
37
+ }
38
+ }
39
+
40
+ @if ($exclude != true) {
41
+ --#{$prefix}-#{$variable_name}-#{functions.replace($property, '--', '')}: #{meta.inspect(
42
+ $value
43
+ )};
44
+ } @else {
45
+ --#{$prefix}-#{functions.replace($property, '--', '')}: #{meta.inspect(
12
46
  $value
13
47
  )};
48
+ }
49
+
50
+ }
51
+
52
+ @mixin generate-print-variables($tag, $value, $config, $options) {
53
+ @media print {
54
+ @include generate-properties($tag, $value, $config, $options);
55
+ }
14
56
  }
15
57
 
16
- @mixin generate-css-variables($tag, $property, $value, $config) {
17
- $prefix: functions.get-config($config, "prefix");
58
+ @mixin generate-rtl-variables($tag, $value, $config, $options) {
59
+ &:where(:dir(rtl),[dir=rtl],[dir=rtl] *) {
60
+ @include generate-properties($tag, $value, $config, $options);
61
+ }
62
+ }
63
+
64
+ @mixin generate-css-variables($tag, $property, $value, $config, $options) {
65
+ $prefix: functions.get-config($config, 'prefix');
66
+
67
+ $variable_options_custom_name: functions.get-config($options, 'variable.name');
68
+ $variable_options_exclude: functions.get-config($options, 'variable.exclude');
69
+
70
+ $variable_name: $tag;
71
+
72
+ @if ($variable_options_custom_name != nil) {
73
+ $variable_name: $variable_options_custom_name;
74
+ }
75
+
76
+ @if (meta.type-of($value) == 'string' and string.index($value, 'var(--') == 1) {
18
77
 
19
- @if (meta.type-of($value) == "string" and str-index($value, "var(--") == 1) {
20
78
  #{$property}: #{meta.inspect(
21
- functions.replace($value, "--", "--" + $prefix + "-" + $tag + "-")
22
- )};
23
- } @else if (type-of($value) == "string" and str-index($value, "var(global(") == 1) {
79
+ functions.replace($value, '--', '--' + $prefix + '-' + $variable_name + '-')
80
+ )};
81
+
82
+ } @else if (meta.type-of($value) == 'string' and string.index($value, 'var(global(') == 1) {
83
+
24
84
  #{$property}: #{meta.inspect(
25
85
  functions.replace(
26
86
  string.slice($value, 0, string.length($value) - 1),
27
- "global(--",
28
- "--" + $prefix + "-root-"
87
+ 'global(--',
88
+ '--' + $prefix + '-root-'
29
89
  )
30
90
  )};
91
+
31
92
  } @else {
93
+
32
94
  #{$property}: #{meta.inspect($value)};
95
+
33
96
  }
34
97
  }
35
98
 
36
- @mixin generate-colors($tag, $value, $config) {
37
- $prefix: functions.get-config($config, "prefix");
99
+ @mixin generate-colors($tag, $value, $config, $options) {
100
+ $prefix: functions.get-config($config, 'prefix');
38
101
 
39
102
  @each $color, $color-properties in $value {
40
- @each $scheme in string.split(functions.get-config($config, "color-scheme"), " ") {
41
- @if $scheme == $color {
42
- @include mixin.generate-color-scheme($color) {
43
- @each $color-property, $color-value in $color-properties {
44
- --#{$prefix}-#{$tag}-#{functions.replace($color-property, '--', '')}: #{meta.inspect(
45
- $color-value
46
- )};
47
- }
103
+ @if ($color == 'light') {
104
+ @each $color-property, $color-value in $color-properties {
105
+ @include generate-css-properties($tag, $color-property, $color-value, $config, $options);
106
+ }
107
+ }
108
+ @if ($color == 'dark') {
109
+ &:where([data-theme="#{$color}"], [data-theme="#{$color}"] *) {
110
+ @each $color-property, $color-value in $color-properties {
111
+ @include generate-css-properties($tag, $color-property, $color-value, $config, $options);
48
112
  }
49
113
  }
50
114
  }
51
115
  }
52
116
  }
53
117
 
54
- @mixin generate-subclasses($tag, $class, $properties, $config) {
118
+ @mixin generate-subclasses($tag, $class, $properties, $config, $options : ()) {
55
119
  #{$class} {
56
- @include generate-properties($tag, $properties, $config);
120
+ @include generate-properties($tag, $properties, $config, $options);
57
121
  }
58
122
  }
59
123
 
60
124
  @mixin generate-responsive($tag, $properties, $config) {
61
- $breakpoints: functions.get-config($config, "breakpoints");
125
+ $breakpoints: functions.get-config($config, 'breakpoints');
126
+
127
+ @each $property, $value in $properties {
128
+ $has-matched-breakpoint: false;
129
+
130
+ @each $breakpoint, $width in $breakpoints {
131
+ @if ($property == $breakpoint) {
132
+ $has-matched-breakpoint: true;
133
+ }
134
+ }
135
+
136
+ @if ($has-matched-breakpoint) {
137
+ $width: map.get($breakpoints, $property);
138
+
139
+ @media (min-width: $width) {
140
+ @include generate-properties($tag, $value, $config);
141
+ }
142
+
143
+ } @else {
144
+ @warn '❗️Invalid breakpoint '#{$property}'.';
145
+ }
62
146
 
63
- @each $breakpoint, $value in $breakpoints {
64
- $property: map.get($properties, $breakpoint);
147
+ }
148
+ }
65
149
 
66
- @if $property != null {
67
- @media (min-width: $value) {
68
- @include generate-properties($tag, $property, $config);
150
+ @mixin generate-atrule($tag, $value, $config, $options) {
151
+ @each $at-rule, $properties in $value {
152
+ // Keep @ at the beginning
153
+ @#{functions.replace($at-rule, '@', '')} {
154
+ @include generate-properties($tag, $properties, $config, $options);
155
+ }
156
+ }
157
+ }
158
+
159
+ @mixin generate-animation($tag, $value, $config, $options) {
160
+ @each $name, $properties in $value {
161
+ // Check, if _animation is not empty ;;
162
+ @if (meta.type-of($properties) != 'list') {
163
+ @keyframes #{$name} {
164
+ @each $offset, $offset-value in $properties {
165
+ #{$offset} {
166
+ @include generate-properties($tag, $offset-value, $config, $options);
167
+ }
168
+ }
69
169
  }
70
170
  }
71
171
  }
72
172
  }
73
173
 
74
- @mixin generate-properties($tag, $properties, $config) {
75
- $prefix: functions.get-config($config, "prefix");
174
+ @mixin generate-properties($tag, $properties, $config, $options : ()) {
175
+ $prefix: functions.get-config($config, 'prefix');
76
176
 
77
177
  @each $property, $value in $properties {
78
178
  // Variables
79
179
  // Looking for "--" symbols in the beginning of the property
80
180
  // Example: --flex-direction : row
81
181
  @if (
82
- meta.type-of($property) == "string" and str-index($property, "--") == 1
182
+ meta.type-of($property) == 'string' and string.index($property, "--") == 1
83
183
  ) {
84
- @include generate-css-properties($tag, $property, $value, $config);
184
+ @include generate-css-properties($tag, $property, $value, $config, $options);
85
185
  }
86
186
 
87
- // Colors
88
- @else if ($property == "colors") {
89
- @include generate-colors($tag, $value, $config);
187
+ // Colors
188
+ @else if ($property == '_colors') {
189
+ @include generate-colors($tag, $value, $config, $options);
90
190
  }
91
191
 
92
- // Responsive
93
- @else if ($property == "responsive") {
192
+ // Responsive
193
+ @else if ($property == '_responsive') {
94
194
  @include generate-responsive($tag, $value, $config);
95
195
  }
96
196
 
97
- // Subclasses
98
- @else if ($property == "subclasses") {
197
+ // Subclasses
198
+ @else if ($property == '_subclasses') {
99
199
  @each $class, $class_properties in $value {
100
- @include generate-subclasses($tag, $class, $class_properties, $config);
200
+ @include generate-subclasses($tag, $class, $class_properties, $config, $options);
101
201
  }
202
+ }
203
+
204
+ // At-rules
205
+ @else if ($property == '_atrule') {
206
+ @include generate-atrule($tag, $value, $config, $options);
207
+ }
208
+
209
+ // Print media query
210
+ @else if ($property == '_print') {
211
+ @include generate-print-variables($tag, $value, $config, $options);
212
+ }
213
+
214
+ // RTL support
215
+ @else if ($property == '_rtl') {
216
+ @include generate-rtl-variables($tag, $value, $config, $options);
217
+ }
218
+
219
+ // Animations
220
+ @else if ($property == '_animations') {
221
+ @include generate-animation($tag, $value, $config, $options);
102
222
  } @else {
103
- @include generate-css-variables($tag, $property, $value, $config);
223
+ @include generate-css-variables($tag, $property, $value, $config, $options);
104
224
  }
105
225
  }
106
- }
226
+ }