oo-loop 1.0.3 → 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.
- package/dist/loop.css +1 -1
- package/package.json +5 -6
- package/scss/_fn.scss +13 -0
- package/scss/_init.scss +6 -4
- package/scss/_loop.scss +1 -1
- package/scss/_pre.scss +3 -1
- package/scss/base/_type.scss +6 -4
- package/scss/components/_button.scss +16 -13
- package/scss/components/_column.scss +39 -34
- package/scss/components/_template.scss +48 -42
- package/scss/components/form/_checkbox.scss +8 -5
- package/scss/components/form/_input.scss +4 -2
- package/scss/components/form/_radio.scss +9 -6
- package/scss/components/form/_select.scss +43 -40
- package/scss/components/form/_toggle.scss +7 -4
- package/scss/functions/_color.scss +30 -16
- package/scss/functions/_convert.scss +24 -9
- package/scss/functions/_empty.scss +8 -3
- package/scss/functions/_extract.scss +9 -5
- package/scss/functions/_list.scss +9 -6
- package/scss/functions/_map.scss +15 -44
- package/scss/functions/_number.scss +16 -11
- package/scss/functions/_replace.scss +7 -4
- package/scss/functions/_split.scss +12 -8
- package/scss/functions/_strip.scss +3 -1
- package/scss/functions/_type.scss +7 -5
- package/scss/helpers/_container.scss +4 -2
- package/scss/helpers/_miscellaneous.scss +4 -2
- package/scss/helpers/_visibility.scss +7 -5
- package/scss/mixins/_breakpoint.scss +15 -10
- package/scss/mixins/_component.scss +19 -18
- package/scss/mixins/_loop.scss +13 -13
- package/scss/mixins/_props.scss +17 -14
- package/scss/mixins/_utilities.scss +21 -18
- package/scss/oo/_all.scss +11 -0
- package/scss/oo/_oo.scss +42 -0
- package/scss/{functions → oo}/_ooAdd.scss +9 -6
- package/scss/oo/_ooAlias.scss +146 -0
- package/scss/oo/_ooMerge.scss +41 -0
- package/scss/{functions → oo}/_ooParse.scss +20 -16
- package/scss/{functions → oo}/_ooPipe.scss +5 -3
- package/scss/{functions → oo}/_ooRef.scss +31 -25
- package/scss/{functions → oo}/_ooSet.scss +18 -13
- package/scss/utilities/_color.scss +3 -1
- package/scss/utilities/_float.scss +5 -2
- package/scss/utilities/_spacing.scss +3 -1
- package/scss/utilities/_typography.scss +3 -1
- package/scss/utilities/_wrapper.scss +3 -1
- package/CHANGELOG.md +0 -236
- package/scss/functions/_all.scss +0 -21
- package/scss/functions/_oo.scss +0 -38
- package/scss/functions/_ooAlias.scss +0 -126
- /package/scss/{functions → oo}/_ooUse.scss +0 -0
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:meta';
|
|
3
|
+
@use 'sass:string';
|
|
4
|
+
@use 'type';
|
|
5
|
+
|
|
1
6
|
/// Empty
|
|
2
7
|
/// @param string|list $data
|
|
3
8
|
/// @return bool
|
|
4
9
|
|
|
5
10
|
@function isEmpty($data) {
|
|
6
|
-
@if type-of($data) == 'null' {
|
|
11
|
+
@if meta.type-of($data) == 'null' {
|
|
7
12
|
@return true;
|
|
8
13
|
}
|
|
9
|
-
@if isString($data) and
|
|
14
|
+
@if type.isString($data) and string.length($data) == 0 {
|
|
10
15
|
@return true;
|
|
11
16
|
}
|
|
12
|
-
@if isList($data) and length($data) == 0 {
|
|
17
|
+
@if type.isList($data) and list.length($data) == 0 {
|
|
13
18
|
@return true;
|
|
14
19
|
}
|
|
15
20
|
@return false;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
@use 'sass:meta';
|
|
2
|
+
@use 'sass:string';
|
|
3
|
+
@use 'type';
|
|
4
|
+
|
|
1
5
|
/// Extract
|
|
2
6
|
/// @param string $start The string to start width
|
|
3
7
|
/// @param string $end The string to end width
|
|
@@ -5,11 +9,11 @@
|
|
|
5
9
|
/// @return string
|
|
6
10
|
|
|
7
11
|
@function extract($start, $end, $subject) {
|
|
8
|
-
@if isNotString($subject) {
|
|
9
|
-
$subject: inspect($subject)
|
|
12
|
+
@if type.isNotString($subject) {
|
|
13
|
+
$subject: meta.inspect($subject)
|
|
10
14
|
}
|
|
11
|
-
$startIndex:
|
|
12
|
-
$endIndex:
|
|
15
|
+
$startIndex: string.index($subject, $start);
|
|
16
|
+
$endIndex: string.index($subject, $end) + string.length($end) - 1;
|
|
13
17
|
|
|
14
|
-
@return
|
|
18
|
+
@return string.slice($subject, $startIndex, $endIndex);
|
|
15
19
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'type';
|
|
3
|
+
|
|
1
4
|
/// In List
|
|
2
5
|
/// @param string $needle the searched value
|
|
3
6
|
/// @param string|list $haystack the list to search in
|
|
4
7
|
/// @return bool
|
|
5
8
|
|
|
6
9
|
@function inList($needle, $haystack) {
|
|
7
|
-
@if index($haystack, $needle) == null {
|
|
10
|
+
@if list.index($haystack, $needle) == null {
|
|
8
11
|
@return false;
|
|
9
12
|
} @else {
|
|
10
13
|
@return true;
|
|
@@ -21,21 +24,21 @@
|
|
|
21
24
|
/// @return List
|
|
22
25
|
|
|
23
26
|
@function removeInList($list, $index) {
|
|
24
|
-
@if isNotList($list)
|
|
25
|
-
or isNotNumber($index) {
|
|
27
|
+
@if type.isNotList($list)
|
|
28
|
+
or type.isNotNumber($index) {
|
|
26
29
|
@return $list;
|
|
27
30
|
}
|
|
28
31
|
$newList: ();
|
|
29
|
-
@for $i from 1 through length($list) {
|
|
32
|
+
@for $i from 1 through list.length($list) {
|
|
30
33
|
@if ($i != $index) {
|
|
31
|
-
$newList: append($newList, nth($list, $i), $separator: comma)
|
|
34
|
+
$newList: list.append($newList, list.nth($list, $i), $separator: comma)
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
@return $newList;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
@function toList($value) {
|
|
38
|
-
@if isList($value) {
|
|
41
|
+
@if type.isList($value) {
|
|
39
42
|
@return $value;
|
|
40
43
|
}
|
|
41
44
|
@return ($value,);
|
package/scss/functions/_map.scss
CHANGED
|
@@ -1,54 +1,25 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:string';
|
|
4
|
+
@use 'type';
|
|
5
|
+
@use 'split';
|
|
6
|
+
|
|
1
7
|
/// getMapValue
|
|
2
8
|
/// @param map $map map of data
|
|
3
9
|
/// @param string $key key to retrieve the value from
|
|
4
10
|
/// @return string
|
|
5
11
|
|
|
6
12
|
@function getMapValue($map, $key) {
|
|
7
|
-
@if isNotMap($map) {
|
|
13
|
+
@if type.isNotMap($map) {
|
|
8
14
|
@return null;
|
|
9
15
|
}
|
|
10
|
-
@if map
|
|
16
|
+
@if map.has-key($map, $key) == false {
|
|
11
17
|
// @warn 'key does not exist when using getMapValue() for' #{$key} 'on' $map;
|
|
12
18
|
@return null;
|
|
13
19
|
}
|
|
14
|
-
@return map
|
|
20
|
+
@return map.get($map, $key);
|
|
15
21
|
}
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/// mapMergeDeep
|
|
20
|
-
/// Non destructive map merge.
|
|
21
|
-
/// @credit-to https://gist.github.com/pentzzsolt
|
|
22
|
-
/// @param map $parentMap Map of data to be merged into
|
|
23
|
-
/// @param map $childMap The set of data
|
|
24
|
-
/// @param map $refMap The base map to refer too, usually equivalent to the $ooLoop before going into nested merge
|
|
25
|
-
/// @param bool $forceKebab force the use of kebab-case property
|
|
26
|
-
/// @return map
|
|
27
|
-
|
|
28
|
-
@function mapMergeDeep($parentMap, $childMap, $refMap:null, $forceKebab: false) {
|
|
29
|
-
$map: $parentMap;
|
|
30
|
-
@if not isMap($map) {
|
|
31
|
-
@return $map;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
$refMap: if($refMap == null, $ooLoop, $refMap);
|
|
35
|
-
|
|
36
|
-
@each $key, $value in $childMap {
|
|
37
|
-
$key: if($forceKebab, toKebabCase($key), $key);
|
|
38
|
-
@if isRef(map-get($map, $key)) {
|
|
39
|
-
$mapValue: getRefValue(map-get($map, $key), $refMap);
|
|
40
|
-
$map: map-merge($map, ($key: $mapValue));
|
|
41
|
-
}
|
|
42
|
-
@if (not map-has-key($map, $key)) or (type-of(map-get($map, $key) ) != type-of($value)) or (not (isMap(map-get($map, $key)) and isMap($value))) {
|
|
43
|
-
$map: map-merge($map, ($key: $value));
|
|
44
|
-
} @else {
|
|
45
|
-
$map: map-merge($map, ($key: mapMergeDeep(map-get($map, $key), $value, $refMap, inList($key, ('props', 'states')))));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
@return $map;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
23
|
/// setMapValue
|
|
53
24
|
/// @param map $map map of data
|
|
54
25
|
/// @param string $key key to retrieve the value from
|
|
@@ -56,7 +27,7 @@
|
|
|
56
27
|
|
|
57
28
|
@function setMapValue($map, $key, $value) {
|
|
58
29
|
$newSet: ($key: $value);
|
|
59
|
-
@return map
|
|
30
|
+
@return map.merge($map, $newSet);
|
|
60
31
|
}
|
|
61
32
|
|
|
62
33
|
/// toMap [w.i.p]
|
|
@@ -68,15 +39,15 @@
|
|
|
68
39
|
/// @todo consider nested map
|
|
69
40
|
|
|
70
41
|
@function toMap($string) {
|
|
71
|
-
@if isMap($string) {
|
|
42
|
+
@if type.isMap($string) {
|
|
72
43
|
@return $string;
|
|
73
44
|
}
|
|
74
45
|
$map: ();
|
|
75
|
-
$stripParenthesis:
|
|
76
|
-
$list:
|
|
46
|
+
$stripParenthesis: string.slice($string, 2, string.length($string) - 1);
|
|
47
|
+
$list: fn.splitDeep(',', $stripParenthesis);
|
|
77
48
|
@each $item in $list {
|
|
78
|
-
$itemList:
|
|
79
|
-
$map: setMapValue($map, nth($itemList, 1), nth($itemList, 2));
|
|
49
|
+
$itemList: fn.splitDeep(':', $item);
|
|
50
|
+
$map: setMapValue($map, list.nth($itemList, 1), list.nth($itemList, 2));
|
|
80
51
|
}
|
|
81
52
|
@return $map;
|
|
82
53
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:meta';
|
|
4
|
+
@use 'sass:string';
|
|
5
|
+
|
|
1
6
|
/// toNumber
|
|
2
7
|
/// convert a string to number
|
|
3
8
|
/// @credit-to Hugo Giraudel https://www.sassmeister.com/gist/9fa19d254864f33d4a80
|
|
@@ -5,31 +10,31 @@
|
|
|
5
10
|
/// @return number
|
|
6
11
|
|
|
7
12
|
@function toNumber($value) {
|
|
8
|
-
@if type-of($value) == 'number' {
|
|
13
|
+
@if meta.type-of($value) == 'number' {
|
|
9
14
|
@return $value;
|
|
10
|
-
} @else if type-of($value) != 'string' {
|
|
15
|
+
} @else if meta.type-of($value) != 'string' {
|
|
11
16
|
@warn('Value for `to-number` should be a number or a string.');
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
$result: 0;
|
|
15
20
|
$digits: 0;
|
|
16
|
-
$minus:
|
|
21
|
+
$minus: string.slice($value, 1, 1) == '-';
|
|
17
22
|
$numbers: ('0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9);
|
|
18
23
|
|
|
19
|
-
@for $i from if($minus, 2, 1) through
|
|
20
|
-
$character:
|
|
24
|
+
@for $i from if($minus, 2, 1) through string.length($value) {
|
|
25
|
+
$character: string.slice($value, $i, $i);
|
|
21
26
|
|
|
22
|
-
@if not (index(map
|
|
23
|
-
@return toLength(if($minus, -$result, $result),
|
|
27
|
+
@if not (list.index(map.keys($numbers), $character) or $character == '.') {
|
|
28
|
+
@return toLength(if($minus, -$result, $result), string.slice($value, $i));
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
@if $character == '.' {
|
|
27
32
|
$digits: 1;
|
|
28
33
|
} @else if $digits == 0 {
|
|
29
|
-
$result: $result * 10 + map
|
|
34
|
+
$result: $result * 10 + map.get($numbers, $character);
|
|
30
35
|
} @else {
|
|
31
36
|
$digits: $digits * 10;
|
|
32
|
-
$result: $result + map
|
|
37
|
+
$result: $result + map.get($numbers, $character) / $digits;
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
40
|
|
|
@@ -47,8 +52,8 @@
|
|
|
47
52
|
|
|
48
53
|
@function toLength($value, $unit) {
|
|
49
54
|
$units: ('px': 1px, 'cm': 1cm, 'mm': 1mm, '%': 1%, 'ch': 1ch, 'pc': 1pc, 'in': 1in, 'em': 1em, 'rem': 1rem, 'pt': 1pt, 'ex': 1ex, 'vw': 1vw, 'vh': 1vh, 'vmin': 1vmin, 'vmax': 1vmax);
|
|
50
|
-
@if not index(map
|
|
55
|
+
@if not list.index(map.keys($units), $unit) {
|
|
51
56
|
@warn 'Invalid unit `#{$unit}`.';
|
|
52
57
|
}
|
|
53
|
-
@return $value * map
|
|
58
|
+
@return $value * map.get($units, $unit);
|
|
54
59
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
@use 'sass:string';
|
|
2
|
+
@use 'type';
|
|
3
|
+
|
|
1
4
|
/// Replace
|
|
2
5
|
/// @param string $search The value being searched
|
|
3
6
|
/// @param string $replace The replacement value
|
|
@@ -5,10 +8,10 @@
|
|
|
5
8
|
/// @return String
|
|
6
9
|
|
|
7
10
|
@function replace($search, $replace, $subject) {
|
|
8
|
-
$searchIndex:
|
|
9
|
-
@if isString($search) and isString($replace) and isString($subject) and $searchIndex {
|
|
10
|
-
$subjectStart:
|
|
11
|
-
$subjectEnd:
|
|
11
|
+
$searchIndex: string.index($subject, $search);
|
|
12
|
+
@if type.isString($search) and type.isString($replace) and type.isString($subject) and $searchIndex {
|
|
13
|
+
$subjectStart: string.slice($subject, 1, $searchIndex - 1);
|
|
14
|
+
$subjectEnd: string.slice($subject, $searchIndex + string.length($search));
|
|
12
15
|
$newSubject: $subjectStart + $replace + $subjectEnd;
|
|
13
16
|
@return replace($search, $replace, $newSubject);
|
|
14
17
|
} @else {
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:string';
|
|
3
|
+
@use 'type';
|
|
4
|
+
|
|
1
5
|
/// Split
|
|
2
6
|
/// @param string $pattern The string character to split your string by
|
|
3
7
|
/// @param string $subject The input string
|
|
4
8
|
/// @param list $list The list being populated
|
|
5
9
|
/// @return list
|
|
6
10
|
|
|
7
|
-
@function
|
|
8
|
-
$searchIndex:
|
|
9
|
-
@if isString($pattern) and isString($subject) and $searchIndex {
|
|
10
|
-
$subjectStart:
|
|
11
|
-
$subjectEnd:
|
|
12
|
-
$newList: join($list, $subjectStart);
|
|
13
|
-
@return
|
|
11
|
+
@function splitDeep($pattern, $subject, $list:()) {
|
|
12
|
+
$searchIndex: string.index($subject, $pattern);
|
|
13
|
+
@if type.isString($pattern) and type.isString($subject) and $searchIndex {
|
|
14
|
+
$subjectStart: string.slice($subject, 1, $searchIndex - 1);
|
|
15
|
+
$subjectEnd: string.slice($subject, $searchIndex + string.length($pattern));
|
|
16
|
+
$newList: list.join($list, $subjectStart);
|
|
17
|
+
@return splitDeep($pattern, $subjectEnd, $newList);
|
|
14
18
|
} @else {
|
|
15
|
-
$newList: join($list, $subject);
|
|
19
|
+
$newList: list.join($list, $subject);
|
|
16
20
|
@return $newList;
|
|
17
21
|
}
|
|
18
22
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
@use 'sass:meta';
|
|
2
|
+
|
|
1
3
|
/// isString
|
|
2
4
|
/// @param mixed $data
|
|
3
5
|
/// @return bool
|
|
4
6
|
|
|
5
7
|
@function isString($data) {
|
|
6
|
-
@if type-of($data) == 'string'{
|
|
8
|
+
@if meta.type-of($data) == 'string'{
|
|
7
9
|
@return true;
|
|
8
10
|
}
|
|
9
11
|
@return false;
|
|
@@ -18,7 +20,7 @@
|
|
|
18
20
|
/// @return bool
|
|
19
21
|
|
|
20
22
|
@function isNumber($data) {
|
|
21
|
-
@if type-of($data) == 'number'{
|
|
23
|
+
@if meta.type-of($data) == 'number'{
|
|
22
24
|
@return true;
|
|
23
25
|
}
|
|
24
26
|
@return false;
|
|
@@ -33,7 +35,7 @@
|
|
|
33
35
|
/// @return bool
|
|
34
36
|
|
|
35
37
|
@function isColor($data) {
|
|
36
|
-
@if type-of($data) == 'color'{
|
|
38
|
+
@if meta.type-of($data) == 'color'{
|
|
37
39
|
@return true;
|
|
38
40
|
}
|
|
39
41
|
@return false;
|
|
@@ -48,7 +50,7 @@
|
|
|
48
50
|
/// @return bool
|
|
49
51
|
|
|
50
52
|
@function isList($data) {
|
|
51
|
-
@if type-of($data) == 'list'{
|
|
53
|
+
@if meta.type-of($data) == 'list'{
|
|
52
54
|
@return true;
|
|
53
55
|
}
|
|
54
56
|
@return false;
|
|
@@ -63,7 +65,7 @@
|
|
|
63
65
|
/// @return bool
|
|
64
66
|
|
|
65
67
|
@function isMap($data) {
|
|
66
|
-
@if type-of($data) == 'map' {
|
|
68
|
+
@if meta.type-of($data) == 'map' {
|
|
67
69
|
@return true;
|
|
68
70
|
}
|
|
69
71
|
@return false;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use '../fn';
|
|
2
|
+
|
|
1
3
|
// Container
|
|
2
4
|
@mixin Container($param: null) {
|
|
3
5
|
@include initElement('container', $param);
|
|
@@ -10,14 +12,14 @@
|
|
|
10
12
|
|
|
11
13
|
$gutter: oo('container.gutter');
|
|
12
14
|
|
|
13
|
-
@if isMap($gutter) {
|
|
15
|
+
@if fn.isMap($gutter) {
|
|
14
16
|
@each $key, $value in $gutter {
|
|
15
17
|
@include breakpoint($key) {
|
|
16
18
|
padding-right: $value;
|
|
17
19
|
padding-left: $value;
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
|
-
} @else if isString($gutter) or isNumber($gutter) {
|
|
22
|
+
} @else if fn.isString($gutter) or fn.isNumber($gutter) {
|
|
21
23
|
padding-right: $gutter;
|
|
22
24
|
padding-left: $gutter;
|
|
23
25
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
@use '../fn';
|
|
2
|
+
|
|
1
3
|
// Miscellaneous
|
|
2
4
|
|
|
3
5
|
@mixin Misc($param: null) {
|
|
4
6
|
@include initElement('misc', $param);
|
|
5
7
|
|
|
6
|
-
@if isNotEmpty(oo('misc')) {
|
|
8
|
+
@if fn.isNotEmpty(oo('misc')) {
|
|
7
9
|
@each $name, $misc in oo('misc') {
|
|
8
|
-
.#{toKebabCase($name)} {
|
|
10
|
+
.#{fn.toKebabCase($name)} {
|
|
9
11
|
@include generateStyles($misc);
|
|
10
12
|
}
|
|
11
13
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use '../fn';
|
|
2
|
+
|
|
1
3
|
// Visibility Utilities
|
|
2
4
|
|
|
3
5
|
@mixin Visibility($param: null) {
|
|
@@ -12,14 +14,14 @@
|
|
|
12
14
|
@media screen { display: none !important; }
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
@if isNotEmpty(oo('visibility.breakpoints')) {
|
|
17
|
+
@if fn.isNotEmpty(oo('visibility.breakpoints')) {
|
|
16
18
|
@each $screen in oo('visibility.breakpoints') {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
@include breakpoint($screen) {
|
|
20
|
+
.hidden\@#{$screen} { display: none !important; }
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
|
-
@if isNotEmpty(oo('visibility.pointbreaks')) {
|
|
24
|
+
@if fn.isNotEmpty(oo('visibility.pointbreaks')) {
|
|
23
25
|
@each $screen in oo('visibility.pointbreaks') {
|
|
24
26
|
@include pointbreak($screen) {
|
|
25
27
|
.hidden\!\@#{$screen} { display: none !important; }
|
|
@@ -1,36 +1,41 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:math';
|
|
4
|
+
@use '../fn';
|
|
5
|
+
|
|
1
6
|
@mixin breakpoint($key) {
|
|
2
7
|
// make sure the key exist
|
|
3
|
-
@if map
|
|
4
|
-
$width: map
|
|
8
|
+
@if map.has-key(oo('breakpoints'), $key) {
|
|
9
|
+
$width: map.get(oo('breakpoints'), $key);
|
|
5
10
|
@media (min-width: $width) {
|
|
6
11
|
@content;
|
|
7
12
|
}
|
|
8
|
-
} @else if isEmpty($key) or $key == 'rt' {
|
|
13
|
+
} @else if fn.isEmpty($key) or $key == 'rt' {
|
|
9
14
|
@content;
|
|
10
15
|
}
|
|
11
16
|
}
|
|
12
17
|
|
|
13
18
|
@mixin pointbreak($key) {
|
|
14
19
|
// make sure the key exist
|
|
15
|
-
@if map
|
|
16
|
-
$minWidth: map
|
|
20
|
+
@if map.has-key(oo('breakpoints'), $key) {
|
|
21
|
+
$minWidth: map.get(oo('breakpoints'), $key);
|
|
17
22
|
$maxWidth: $minWidth - 1;
|
|
18
|
-
@if inList(unit($minWidth), ('em', 'rem')) {
|
|
23
|
+
@if fn.inList(math.unit($minWidth), ('em', 'rem')) {
|
|
19
24
|
$maxWidth: $minWidth - 0.001;
|
|
20
25
|
}
|
|
21
26
|
@media (max-width: $maxWidth) {
|
|
22
27
|
@content;
|
|
23
28
|
}
|
|
24
|
-
} @else if isEmpty($key) or $key == 'rt' {
|
|
29
|
+
} @else if fn.isEmpty($key) or $key == 'rt' {
|
|
25
30
|
@content;
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
@function areKeysBreakpoints($map){
|
|
30
|
-
$breakpointsKeys: join('rt', map
|
|
31
|
-
$mapKeys: map
|
|
35
|
+
$breakpointsKeys: list.join('rt', map.keys(oo('breakpoints')));
|
|
36
|
+
$mapKeys: map.keys($map);
|
|
32
37
|
@each $key in $mapKeys {
|
|
33
|
-
@if inList($key, $breakpointsKeys) {
|
|
38
|
+
@if fn.inList($key, $breakpointsKeys) {
|
|
34
39
|
@return true;
|
|
35
40
|
}
|
|
36
41
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
@
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../fn';
|
|
2
3
|
|
|
3
4
|
/// Create component
|
|
4
5
|
/// @param string $name
|
|
5
6
|
|
|
6
7
|
@mixin ooComponent($name) {
|
|
7
|
-
@if isNotString($name) {
|
|
8
|
+
@if fn.isNotString($name) {
|
|
8
9
|
@error 'Parameter $name on ooComponent must be a string';
|
|
9
10
|
}
|
|
10
11
|
[#{ooPrefix()}-#{$name}] {
|
|
@@ -17,10 +18,10 @@
|
|
|
17
18
|
/// @param string $variantName
|
|
18
19
|
|
|
19
20
|
@mixin ooComponentVariant($name, $variantName) {
|
|
20
|
-
@if isNotString($name) {
|
|
21
|
+
@if fn.isNotString($name) {
|
|
21
22
|
@error 'Parameter $name on ooComponentVariant must be a string';
|
|
22
23
|
}
|
|
23
|
-
@if isNotString($variantName) {
|
|
24
|
+
@if fn.isNotString($variantName) {
|
|
24
25
|
@error 'Parameter $variantName on ooComponentVariant must be a string';
|
|
25
26
|
}
|
|
26
27
|
[#{ooPrefix()}-#{$name}~="#{$variantName}"] {
|
|
@@ -33,14 +34,14 @@
|
|
|
33
34
|
/// @param $variantsMap
|
|
34
35
|
|
|
35
36
|
@mixin generateComponentVariants($componentName, $variantsMap) {
|
|
36
|
-
@if isNotEmpty($variantsMap) {
|
|
37
|
+
@if fn.isNotEmpty($variantsMap) {
|
|
37
38
|
@each $name, $props in $variantsMap {
|
|
38
|
-
@if isMap($props) {
|
|
39
|
-
$hasStates: if(map
|
|
40
|
-
[#{ooPrefix()}-#{$componentName}~="#{toKebabCase($name)}"] {
|
|
41
|
-
@if map
|
|
42
|
-
$states: map
|
|
43
|
-
$props: map
|
|
39
|
+
@if fn.isMap($props) {
|
|
40
|
+
$hasStates: if(map.has-key($props, 'states'), map.get($props, 'states'), null);
|
|
41
|
+
[#{ooPrefix()}-#{$componentName}~="#{fn.toKebabCase($name)}"] {
|
|
42
|
+
@if map.has-key($props, 'states') {
|
|
43
|
+
$states: map.get($props, 'states');
|
|
44
|
+
$props: map.remove($props, 'states');
|
|
44
45
|
@include generateStatesProperties($states);
|
|
45
46
|
}
|
|
46
47
|
@include generateProperties($props);
|
|
@@ -55,24 +56,24 @@
|
|
|
55
56
|
/// @param $componentMap
|
|
56
57
|
|
|
57
58
|
@mixin generateComponent($componentMap) {
|
|
58
|
-
$name: if(map
|
|
59
|
-
$hasProps: if(map
|
|
60
|
-
$variants: if(map
|
|
59
|
+
$name: if(map.has-key($componentMap, 'name'), fn.toKebabCase(map.get($componentMap, 'name')), null);
|
|
60
|
+
$hasProps: if(map.has-key($componentMap, 'props') or map.has-key($componentMap, 'states'), true, false);
|
|
61
|
+
$variants: if(map.has-key($componentMap, 'variants'), map.get($componentMap, 'variants'), null);
|
|
61
62
|
|
|
62
|
-
@if isNotEmpty($name) and $hasProps {
|
|
63
|
+
@if fn.isNotEmpty($name) and $hasProps {
|
|
63
64
|
[#{ooPrefix()}-#{$name}] {
|
|
64
65
|
@include generateStyles($componentMap);
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
|
-
@if isNotEmpty($name) and isNotEmpty($variants) {
|
|
68
|
+
@if fn.isNotEmpty($name) and fn.isNotEmpty($variants) {
|
|
68
69
|
@include generateComponentVariants($name, $variants);
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
@mixin generateComponents($components) {
|
|
73
74
|
@each $name, $componentMap in $components {
|
|
74
|
-
@if not map
|
|
75
|
-
$componentMap: map
|
|
75
|
+
@if not map.has-key($componentMap, 'name') {
|
|
76
|
+
$componentMap: map.merge(('name': $name) , $componentMap);
|
|
76
77
|
}
|
|
77
78
|
@include generateComponent($componentMap);
|
|
78
79
|
}
|
package/scss/mixins/_loop.scss
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
@
|
|
2
|
-
|
|
1
|
+
@use 'sass:string';
|
|
2
|
+
@use '../fn';
|
|
3
3
|
|
|
4
4
|
// Loop Properties
|
|
5
5
|
@mixin loopProperties($properties, $value, $isImportant) {
|
|
6
6
|
// multiple properties
|
|
7
|
-
@if isList($properties) {
|
|
7
|
+
@if fn.isList($properties) {
|
|
8
8
|
@each $property in $properties {
|
|
9
9
|
#{$property}: if($isImportant, #{$value} !important, #{$value});
|
|
10
10
|
}
|
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
|
|
24
24
|
@mixin loop($data, $properties, $prefix, $isImportant:false, $suffix:'') {
|
|
25
25
|
// Make sure to have the correct format or do not generate rules
|
|
26
|
-
@if isNotEmpty($data) {
|
|
27
|
-
@if isString($data) {
|
|
26
|
+
@if fn.isNotEmpty($data) {
|
|
27
|
+
@if fn.isString($data) {
|
|
28
28
|
#{$prefix}-#{$data}#{$suffix} {
|
|
29
29
|
@include loopProperties($properties, $data, $isImportant);
|
|
30
30
|
}
|
|
31
|
-
} @else if isList($data) {
|
|
31
|
+
} @else if fn.isList($data) {
|
|
32
32
|
@each $value in $data {
|
|
33
33
|
#{$prefix}-#{$value}#{$suffix} {
|
|
34
34
|
@include loopProperties($properties, $value, $isImportant);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
} @else if isMap($data) {
|
|
37
|
+
} @else if fn.isMap($data) {
|
|
38
38
|
@each $key, $value in $data {
|
|
39
|
-
$affix: if(isEmpty($key), '', '-');
|
|
39
|
+
$affix: if(fn.isEmpty($key), '', '-');
|
|
40
40
|
|
|
41
41
|
#{$prefix}#{$affix}#{$key}#{$suffix} {
|
|
42
42
|
// responsive properties ?
|
|
43
|
-
@if isMap($value) and
|
|
43
|
+
@if fn.isMap($value) and string.index($suffix, $substring: "\@") == null {
|
|
44
44
|
@each $child-breakpoint, $child-value in $value {
|
|
45
45
|
@include breakpoint($child-breakpoint) {
|
|
46
46
|
@include loopProperties($properties, $child-value, $isImportant);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
} @else if isNotMap($value) {
|
|
49
|
+
} @else if fn.isNotMap($value) {
|
|
50
50
|
@include loopProperties($properties, $value, $isImportant);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
/// @param string $suffix String to append to the selector
|
|
65
65
|
|
|
66
66
|
@mixin loopBreakpoints($breakpoints, $data, $properties, $prefix, $isImportant:false, $suffix:'') {
|
|
67
|
-
@if isNotEmpty($breakpoints) and isNotEmpty($data) {
|
|
68
|
-
@if isString($breakpoints) {
|
|
69
|
-
$breakpoints: toList($breakpoints);
|
|
67
|
+
@if fn.isNotEmpty($breakpoints) and fn.isNotEmpty($data) {
|
|
68
|
+
@if fn.isString($breakpoints) {
|
|
69
|
+
$breakpoints: fn.toList($breakpoints);
|
|
70
70
|
}
|
|
71
71
|
@each $breakpoint in $breakpoints {
|
|
72
72
|
@include breakpoint($breakpoint) {
|