oo-loop 1.0.2 → 1.0.3
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/scss/functions/_ooAlias.scss +59 -29
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -2,12 +2,12 @@ $ooAlias: (
|
|
|
2
2
|
(
|
|
3
3
|
name: 'ooDarken',
|
|
4
4
|
function: 'darken',
|
|
5
|
-
|
|
5
|
+
paramType: ('color', 'number'),
|
|
6
6
|
),
|
|
7
7
|
(
|
|
8
8
|
name: 'ooLighten',
|
|
9
9
|
function: 'lighten',
|
|
10
|
-
|
|
10
|
+
paramType: ('color', 'number'),
|
|
11
11
|
),
|
|
12
12
|
);
|
|
13
13
|
|
|
@@ -48,49 +48,79 @@ $ooAlias: (
|
|
|
48
48
|
@return $isAlias;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/// getAliasInfo
|
|
52
|
+
/// retrieve the alias information
|
|
53
|
+
/// @param string $aliasFunction The complete alias function
|
|
54
|
+
/// @return map|null
|
|
55
|
+
|
|
56
|
+
@function getAliasInfo($aliasFunction) {
|
|
57
|
+
@each $alias in $ooAlias {
|
|
58
|
+
$aliasName: getMapValue($alias, 'name');
|
|
59
|
+
$aliasLength: str-length($aliasName);
|
|
60
|
+
$aliasFunctionName: stripSpaces(str-slice($aliasFunction, 1, $aliasLength));
|
|
61
|
+
|
|
62
|
+
@if $aliasFunctionName == $aliasName {
|
|
63
|
+
$currentAlias: $alias;
|
|
64
|
+
$functionName: getMapValue($alias, 'function');
|
|
65
|
+
|
|
66
|
+
@return (
|
|
67
|
+
name: $aliasName,
|
|
68
|
+
nameLength: $aliasLength,
|
|
69
|
+
function: if(function-exists('get-function'), get-function($functionName), $functionName),
|
|
70
|
+
functionName: $functionName,
|
|
71
|
+
paramType: getMapValue($alias, 'paramType'),
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@return null;
|
|
77
|
+
}
|
|
51
78
|
|
|
52
79
|
/// getAliasValue
|
|
53
80
|
/// retrieve the value of an alias function
|
|
54
|
-
/// @param string $
|
|
81
|
+
/// @param string $aliasFunction The complete alias function
|
|
55
82
|
/// @param string $value Value of the 1st parameter
|
|
56
83
|
/// @return bool
|
|
57
84
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
$currentAlias: null;
|
|
85
|
+
@function getAliasValue($aliasFunction, $value:null) {
|
|
86
|
+
$name: null;
|
|
87
|
+
$paramType: null;
|
|
62
88
|
$function: null;
|
|
63
|
-
$params: split(',', inspect($
|
|
64
|
-
|
|
89
|
+
$params: split(',', inspect($aliasFunction));
|
|
65
90
|
$param1: nth($params, 1);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
$function: get-function($function);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
91
|
+
|
|
92
|
+
$aliasInfo: getAliasInfo($aliasFunction);
|
|
93
|
+
|
|
94
|
+
@if $aliasInfo != null {
|
|
95
|
+
$name: getMapValue($aliasInfo, 'name');
|
|
96
|
+
$function: getMapValue($aliasInfo, 'function');
|
|
97
|
+
$paramType: getMapValue($aliasInfo, 'paramType');
|
|
98
|
+
$param1: stripSpaces(str-slice($param1, getMapValue($aliasInfo, 'nameLength') + 2, str-length($param1)));
|
|
77
99
|
}
|
|
78
100
|
|
|
79
|
-
$param1: if($
|
|
101
|
+
$param1: if($value==null, $param1, $value);
|
|
80
102
|
|
|
81
103
|
@if length($params) > 1 {
|
|
82
|
-
$
|
|
83
|
-
|
|
104
|
+
$param2: stripSpaces(str-slice(#{nth($params, 2)}, 1, -2));
|
|
105
|
+
|
|
106
|
+
$param1Type: null;
|
|
107
|
+
$param2Type: null;
|
|
84
108
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
109
|
+
@if $paramType != null {
|
|
110
|
+
$param1Type: nth($paramType, 1);
|
|
111
|
+
$param2Type: nth($paramType, 2);
|
|
112
|
+
}
|
|
88
113
|
|
|
89
|
-
|
|
90
|
-
|
|
114
|
+
$param1: toType($param1Type, $param1);
|
|
115
|
+
$param2: toType($param2Type, $param2);
|
|
116
|
+
|
|
117
|
+
@if type-of($param1) != $param1Type or type-of($param2) != $param2Type {
|
|
118
|
+
@warn('The alias `#{$aliasFunction}` is targetting `#{$value}` and therefore cannot be used with the sass function `#{getMapValue($aliasInfo, 'functionName')}`');
|
|
119
|
+
@return $value;
|
|
91
120
|
}
|
|
92
121
|
|
|
93
122
|
@return call($function, $param1, $param2);
|
|
94
123
|
}
|
|
124
|
+
|
|
95
125
|
@return call($function, $param1);
|
|
96
|
-
}
|
|
126
|
+
}
|