@nulllogic/scssleon 1.0.4 → 1.0.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.
@@ -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
@@ -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,18 +12,4 @@
12
12
  $config: nil !default;
13
13
  $theme: nil !default;
14
14
 
15
- @include mixins.generate-component('placeholder', 'placeholder', $config, $theme);
16
-
17
- @keyframes placeholder-glow {
18
- 50% {
19
- opacity: 0.5;
20
- }
21
- }
22
-
23
- @keyframes placeholder-wave {
24
- 100% {
25
- mask-position: -200% 0;
26
- -webkit-mask-position: -200% 0;
27
- }
28
- }
29
-
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')));
@@ -1,38 +1,68 @@
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
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
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, $options);
25
- }
25
+ @each $scheme in string.split(functions.get-config($config, 'color-scheme'), ' ') {
26
+
27
+ @if $scheme == 'light' {
28
+ .#{$class} {
29
+ @include properties.generate-properties($class, $theme-component, $config, map.deep-merge((
30
+ scheme: $scheme,
31
+ ), $options));
32
+ }
33
+ }
26
34
 
27
- @include wrapper.generate-wrapper($config) {
28
- .#{$class} {
29
- @extend %#{$class};
35
+ @if $scheme == 'dark' {
36
+ .#{$class}:where([data-theme="#{$scheme}"], [data-theme="#{$scheme}"] *) {
37
+ @include properties.generate-properties($class, $theme-component, $config, map.deep-merge((
38
+ scheme: $scheme,
39
+ ), $options));
40
+ }
30
41
  }
31
42
  }
43
+
32
44
  }
33
45
 
34
- //@mixin generate-components($component, $class, $config, $theme) {
46
+ @mixin generate-components($components, $config, $theme) {
35
47
 
36
- @mixin get-structure ($component) {
37
- @debug $component;
48
+ // Get components
49
+ @each $component in $components {
50
+ // Component options param check
51
+ @if (list.length($component) > 2) {
52
+ @include generate-component(
53
+ list.nth($component, 1),
54
+ list.nth($component, 2),
55
+ $config: $config,
56
+ $theme: $theme,
57
+ $options: list.nth($component, 3),
58
+ )
59
+ } @else {
60
+ @include generate-component(
61
+ list.nth($component, 1),
62
+ list.nth($component, 2),
63
+ $config: $config,
64
+ $theme: $theme,
65
+ )
66
+ }
67
+ }
38
68
  }
@@ -1,57 +1,96 @@
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
8
  @mixin generate-css-properties($tag, $property, $value, $config, $options : ()) {
9
- $prefix: functions.get-config($config, "prefix");
10
9
 
11
- @if(functions.get-config($options, 'add_pseudo_tag') != nil and functions.get-config($options, 'add_pseudo_tag') == false) {
12
- --#{$prefix}-#{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(
13
42
  $value
14
43
  )};
15
44
  } @else {
16
- --#{$prefix}-#{$tag}-#{functions.replace($property, '--', '')}: #{meta.inspect(
45
+ --#{$prefix}-#{functions.replace($property, '--', '')}: #{meta.inspect(
17
46
  $value
18
47
  )};
19
48
  }
49
+
20
50
  }
21
51
 
22
- @mixin generate-css-variables($tag, $property, $value, $config) {
23
- $prefix: functions.get-config($config, "prefix");
52
+ @mixin generate-css-variables($tag, $property, $value, $config, $options) {
53
+ $prefix: functions.get-config($config, 'prefix');
54
+
55
+ $variable_options_custom_name: functions.get-config($options, 'variable.name');
56
+ $variable_options_exclude: functions.get-config($options, 'variable.exclude');
57
+
58
+ $variable_name : $tag;
59
+
60
+ @if ($variable_options_custom_name != nil) {
61
+ $variable_name: $variable_options_custom_name;
62
+ }
63
+
64
+ @if (meta.type-of($value) == 'string' and string.index($value, 'var(--') == 1) {
24
65
 
25
- @if (meta.type-of($value) == "string" and string.index($value, "var(--") == 1) {
26
66
  #{$property}: #{meta.inspect(
27
- functions.replace($value, "--", "--" + $prefix + "-" + $tag + "-")
28
- )};
29
- } @else if (meta.type-of($value) == "string" and string.index($value, "var(global(") == 1) {
67
+ functions.replace($value, '--', '--' + $prefix + '-' + $variable_name + '-')
68
+ )};
69
+
70
+ } @else if (meta.type-of($value) == 'string' and string.index($value, 'var(global(') == 1) {
71
+
30
72
  #{$property}: #{meta.inspect(
31
73
  functions.replace(
32
74
  string.slice($value, 0, string.length($value) - 1),
33
- "global(--",
34
- "--" + $prefix + "-root-"
75
+ 'global(--',
76
+ '--' + $prefix + '-root-'
35
77
  )
36
78
  )};
79
+
37
80
  } @else {
81
+
38
82
  #{$property}: #{meta.inspect($value)};
83
+
39
84
  }
40
85
  }
41
86
 
42
- @mixin generate-colors($tag, $value, $config) {
43
- $prefix: functions.get-config($config, "prefix");
87
+ @mixin generate-colors($tag, $value, $config, $options, $requested_color : 'light') {
88
+ $prefix: functions.get-config($config, 'prefix');
44
89
 
45
90
  @each $color, $color-properties in $value {
46
- @each $scheme in string.split(functions.get-config($config, "color-scheme"), " ") {
47
- @if $scheme == $color {
48
- @include mixin.generate-color-scheme($color) {
49
- @each $color-property, $color-value in $color-properties {
50
- --#{$prefix}-#{$tag}-#{functions.replace($color-property, '--', '')}: #{meta.inspect(
51
- $color-value
52
- )};
53
- }
54
- }
91
+ @if ($color == $requested_color) {
92
+ @each $color-property, $color-value in $color-properties {
93
+ @include generate-css-properties($tag, $color-property, $color-value, $config, $options);
55
94
  }
56
95
  }
57
96
  }
@@ -64,16 +103,28 @@
64
103
  }
65
104
 
66
105
  @mixin generate-responsive($tag, $properties, $config) {
67
- $breakpoints: functions.get-config($config, "breakpoints");
106
+ $breakpoints: functions.get-config($config, 'breakpoints');
107
+
108
+ @each $property, $value in $properties {
109
+ $has-matched-breakpoint: false;
68
110
 
69
- @each $breakpoint, $value in $breakpoints {
70
- $property: map.get($properties, $breakpoint);
111
+ @each $breakpoint, $width in $breakpoints {
112
+ @if ($property == $breakpoint) {
113
+ $has-matched-breakpoint: true;
114
+ }
115
+ }
71
116
 
72
- @if $property != null {
73
- @media (min-width: $value) {
74
- @include generate-properties($tag, $property, $config);
117
+ @if ($has-matched-breakpoint) {
118
+ $width: map.get($breakpoints, $property);
119
+
120
+ @media (min-width: $width) {
121
+ @include generate-properties($tag, $value, $config);
75
122
  }
123
+
124
+ } @else {
125
+ @warn '❗️Invalid breakpoint '#{$property}'.';
76
126
  }
127
+
77
128
  }
78
129
  }
79
130
 
@@ -81,50 +132,83 @@
81
132
  @each $at-rule, $properties in $value {
82
133
  // Keep @ at the beginning
83
134
  @#{functions.replace($at-rule, '@', '')} {
84
- @include generate-properties($tag, $properties, $config, $options);
85
- }
135
+ @include generate-properties($tag, $properties, $config, $options);
136
+ }
86
137
  }
87
138
  }
88
139
 
89
- @mixin generate-animation($tag, $value, $config, $options) {
140
+ @mixin generate-print($tag, $value, $config, $options) {
141
+ //@TODO
142
+ }
90
143
 
144
+ @mixin generate-animation($tag, $value, $config, $options) {
145
+ @each $name, $properties in $value {
146
+ // Check, if _animation is not empty ;;
147
+ @if (meta.type-of($properties) != 'list') {
148
+ @keyframes #{$name} {
149
+ @each $offset, $offset-value in $properties {
150
+ #{$offset} {
151
+ @include generate-properties($tag, $offset-value, $config, $options);
152
+ }
153
+ }
154
+ }
155
+ }
156
+ }
91
157
  }
92
158
 
93
159
  @mixin generate-properties($tag, $properties, $config, $options : ()) {
94
- $prefix: functions.get-config($config, "prefix");
160
+ $prefix: functions.get-config($config, 'prefix');
161
+ $is_scheme_dark: functions.get-config($options, 'scheme') != nil and functions.get-config($options, 'scheme') == 'dark';
162
+
163
+ @if (not $is_scheme_dark) {
164
+ @each $property, $value in $properties {
165
+ // Variables
166
+ // Looking for "--" symbols in the beginning of the property
167
+ // Example: --flex-direction : row
168
+ @if (
169
+ meta.type-of($property) == 'string' and string.index($property, "--") == 1
170
+ ) {
171
+ @include generate-css-properties($tag, $property, $value, $config, $options);
172
+ }
95
173
 
96
- @each $property, $value in $properties {
97
- // Variables
98
- // Looking for "--" symbols in the beginning of the property
99
- // Example: --flex-direction : row
100
- @if (
101
- meta.type-of($property) == "string" and string.index($property, "--") == 1
102
- ) {
103
- @include generate-css-properties($tag, $property, $value, $config, $options);
104
- }
174
+ // Colors
175
+ @else if ($property == '_colors') {
176
+ @include generate-colors($tag, $value, $config, $options, 'light');
177
+ }
105
178
 
106
- // Colors
107
- @else if ($property == "_colors") {
108
- @include generate-colors($tag, $value, $config);
109
- }
179
+ // Responsive
180
+ @else if ($property == '_responsive') {
181
+ @include generate-responsive($tag, $value, $config);
182
+ }
110
183
 
111
- // Responsive
112
- @else if ($property == "_responsive") {
113
- @include generate-responsive($tag, $value, $config);
114
- }
184
+ // Sub classes
185
+ @else if ($property == "_subclasses") {
186
+ @each $class, $class_properties in $value {
187
+ @include generate-subclasses($tag, $class, $class_properties, $config, $options);
188
+ }
189
+ }
115
190
 
116
- // Sub classes
117
- @else if ($property == "_subclasses") {
118
- @each $class, $class_properties in $value {
119
- @include generate-subclasses($tag, $class, $class_properties, $config, $options);
191
+ // At-rules
192
+ @else if ($property == '_atrule') {
193
+ @include generate-atrule($tag, $value, $config, $options);
194
+ }
195
+
196
+ // Animations
197
+ @else if ($property == '_animations') {
198
+ @include generate-animation($tag, $value, $config, $options);
199
+ } @else {
200
+ @include generate-css-variables($tag, $property, $value, $config, $options);
120
201
  }
121
202
  }
122
- // At-rules
123
- @else if ($property == "_atrule") {
124
- @include generate-atrule($tag, $value, $config, $options);
125
- }
126
- @else {
127
- @include generate-css-variables($tag, $property, $value, $config);
203
+ } @else {
204
+ @each $property, $value in $properties {
205
+ @if ($property == '_colors') {
206
+ @include generate-colors($tag, $value, $config, $options, 'dark');
207
+ } @else if ($property == '_subclasses') {
208
+ @each $class, $class_properties in $value {
209
+ @include generate-subclasses($tag, $class, $class_properties, $config, $options);
210
+ }
211
+ }
128
212
  }
129
213
  }
130
- }
214
+ }