@progress/kendo-theme-core 6.1.1-dev.0 → 6.1.1-dev.11
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/all.scss +823 -23
- package/package.json +2 -2
- package/scss/color-system/_palettes.scss +69 -0
- package/scss/color-system/_variables.scss +37 -0
- package/scss/functions/_color-contrast.import.scss +50 -11
- package/scss/functions/_color-manipulation.import.scss +53 -1
- package/scss/functions/_color.import.scss +105 -0
- package/scss/functions/_escape-string.import.scss +8 -1
- package/scss/functions/_lang.import.scss +11 -0
- package/scss/functions/_list.import.scss +80 -0
- package/scss/functions/_map.import.scss +48 -0
- package/scss/functions/_math.import.scss +131 -9
- package/scss/functions/_meta.import.scss +162 -0
- package/scss/functions/_string.import.scss +69 -1
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/// Returns the value at `$key` in `$map`.
|
|
2
|
+
/// @param {Map} $map - The map to get the value from.
|
|
3
|
+
/// @param {Any} $key - The key to get the value for.
|
|
4
|
+
///
|
|
5
|
+
/// @example scss - Usage
|
|
6
|
+
/// @debug k-map-get( ( "foo": "bar" ), "foo" ); // => "bar"
|
|
1
7
|
@function k-map-get( $map, $keys... ) {
|
|
2
8
|
@each $key in $keys {
|
|
3
9
|
$map: map-get( $map, $key );
|
|
@@ -5,14 +11,35 @@
|
|
|
5
11
|
@return $map;
|
|
6
12
|
}
|
|
7
13
|
|
|
14
|
+
/// Returns whether `$map` has a value at `$key`.
|
|
15
|
+
/// @param {Map} $map - The map to check.
|
|
16
|
+
/// @param {Any} $key - The key to check.
|
|
17
|
+
/// @return {Boolean} - Whether `$map` has a value at `$key`.
|
|
18
|
+
///
|
|
19
|
+
/// @example scss - Usage
|
|
20
|
+
/// @debug k-map-has( ( "foo": "bar" ), "foo" ); // => true
|
|
21
|
+
/// @debug k-map-has( ( "foo": "bar" ), "bar" ); // => false
|
|
8
22
|
@function k-map-has-key( $map, $key ) {
|
|
9
23
|
@return map-has-key( $map, $key );
|
|
10
24
|
}
|
|
11
25
|
|
|
26
|
+
/// Returns a comma separated list of the keys in `$map`.
|
|
27
|
+
/// @param {Map} $map - The map to get the keys from.
|
|
28
|
+
/// @return {List} - A comma separated list of the keys in `$map`.
|
|
29
|
+
///
|
|
30
|
+
/// @example scss - Usage
|
|
31
|
+
/// @debug k-map-keys( ( "foo": "bar", "baz": "qux" ) ); // => "foo, baz"
|
|
12
32
|
@function k-map-keys( $map ) {
|
|
13
33
|
@return map-keys( $map );
|
|
14
34
|
}
|
|
15
35
|
|
|
36
|
+
/// Returns a map with the keys and values from `$map` and `$args`.
|
|
37
|
+
/// @param {Map} $map - The map to merge.
|
|
38
|
+
/// @param {Map} $args - The map to merge into `$map`.
|
|
39
|
+
/// @return {Map} - A map with the keys and values from `$map` and `$args`.
|
|
40
|
+
///
|
|
41
|
+
/// @example scss - Usage
|
|
42
|
+
/// @debug k-map-merge( ( "foo": "bar" ), ( "baz": "qux" ) ); // => ( "foo": "bar", "baz": "qux" )
|
|
16
43
|
@function k-map-merge( $map, $args... ) {
|
|
17
44
|
@each $arg in $args {
|
|
18
45
|
$map: map-merge( $map, $arg );
|
|
@@ -20,14 +47,35 @@
|
|
|
20
47
|
@return $map;
|
|
21
48
|
}
|
|
22
49
|
|
|
50
|
+
/// Returns a map with the keys and values from `$map` except for `$keys`.
|
|
51
|
+
/// @param {Map} $map - The map to remove keys from.
|
|
52
|
+
/// @param {Any} $keys - The keys to remove from `$map`.
|
|
53
|
+
/// @return {Map} - A map with the keys and values from `$map` except for `$keys`.
|
|
54
|
+
///
|
|
55
|
+
/// @example scss - Usage
|
|
56
|
+
/// @debug k-map-remove( ( "foo": "bar", "baz": "qux" ), "foo" ); // => ( "baz": "qux" )
|
|
23
57
|
@function k-map-remove( $map, $keys... ) {
|
|
24
58
|
@return map-remove( $map, $keys... );
|
|
25
59
|
}
|
|
26
60
|
|
|
61
|
+
/// Sets a single key and value in `$map`.
|
|
62
|
+
/// @param {Map} $map - The map to set the value in.
|
|
63
|
+
/// @param {Any} $key - The key to set the value for.
|
|
64
|
+
/// @param {Any} $value - The value to set.
|
|
65
|
+
/// @return {Map} - A map with the key and value set.
|
|
66
|
+
///
|
|
67
|
+
/// @example scss - Usage
|
|
68
|
+
/// @debug k-map-set( ( "foo": "bar" ), "baz", "qux" ); // => ( "foo": "bar", "baz": "qux" )
|
|
27
69
|
@function k-map-set( $map, $key, $value ) {
|
|
28
70
|
@return k-map-merge( $map, ( $key: $value ) );
|
|
29
71
|
}
|
|
30
72
|
|
|
73
|
+
/// Returns a comma separated list of the values in `$map`.
|
|
74
|
+
/// @param {Map} $map - The map to get the values from.
|
|
75
|
+
/// @return {List} - A comma separated list of the values in `$map`.
|
|
76
|
+
///
|
|
77
|
+
/// @example scss - Usage
|
|
78
|
+
/// @debug k-map-values( ( "foo": "bar", "baz": "qux" ) ); // => "bar, qux"
|
|
31
79
|
@function k-map-values( $map ) {
|
|
32
80
|
@return map-values( $map );
|
|
33
81
|
}
|
|
@@ -1,47 +1,147 @@
|
|
|
1
|
+
/// Returns the absolute value of a number.
|
|
2
|
+
/// @param {Number} $number - The number to get the absolute value of.
|
|
3
|
+
/// @return {Number} - The absolute value of `$number`.
|
|
4
|
+
///
|
|
5
|
+
/// @example scss - Usage
|
|
6
|
+
/// @debug k-math-abs( -10 ); // => 10
|
|
1
7
|
@function k-math-abs( $number ) {
|
|
2
8
|
@return abs( $number );
|
|
3
9
|
}
|
|
4
10
|
|
|
11
|
+
/// Returns the smallest integer greater than or equal to a number.
|
|
12
|
+
/// @param {Number} $number - The number to get the ceiling of.
|
|
13
|
+
/// @return {Number} - The ceiling of `$number`.
|
|
14
|
+
///
|
|
15
|
+
/// @example scss - Usage
|
|
16
|
+
/// @debug k-math-ceil( 10.1 ); // => 11
|
|
5
17
|
@function k-math-ceil( $number ) {
|
|
6
18
|
@return ceil( $number );
|
|
7
19
|
}
|
|
8
20
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
21
|
+
/// Returns the largest integer less than or equal to a number.
|
|
22
|
+
/// @param {Number} $number - The number to get the floor of.
|
|
23
|
+
/// @return {Number} - The floor of `$number`.
|
|
24
|
+
///
|
|
25
|
+
/// @example scss - Usage
|
|
26
|
+
/// @debug k-math-floor( 10.9 ); // => 10
|
|
27
|
+
@function k-math-floor( $number ) {
|
|
28
|
+
@return floor( $number );
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// Restricts `$number` to the range between `$min` and `$max`. If `$number` is
|
|
32
|
+
/// less than `$min`, `$min` is returned. If `$number` is greater than `$max`,
|
|
33
|
+
/// `$max` is returned. Otherwise, `$number` is returned.
|
|
34
|
+
/// @param {Number} $number - The number to clamp.
|
|
35
|
+
/// @param {Number} $min - The minimum value.
|
|
36
|
+
/// @param {Number} $max - The maximum value.
|
|
37
|
+
/// @return {Number} - The clamped number.
|
|
38
|
+
///
|
|
39
|
+
/// @example scss - Usage
|
|
40
|
+
/// @debug k-math-clamp( 10, 0, 5 ); // => 5
|
|
41
|
+
@function k-math-clamp( $number, $min, $max ) {
|
|
42
|
+
@return k-math-max( $min, k-math-min( $max, $number ) );
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/// Returns whether two numbers have compatible units.
|
|
46
|
+
/// @param {Number} $a - The first number.
|
|
47
|
+
/// @param {Number} $b - The second number.
|
|
48
|
+
/// @return {Boolean} - Whether the numbers have compatible units.
|
|
49
|
+
///
|
|
50
|
+
/// @example scss - Usage
|
|
51
|
+
/// @debug k-math-compatible( 10px, 10px ); // => true
|
|
52
|
+
/// @debug k-math-compatible( 10px, 10em ); // => false
|
|
13
53
|
@function k-math-compatible( $a, $b ) {
|
|
14
54
|
@return comparable( $a, $b );
|
|
15
55
|
}
|
|
16
56
|
|
|
57
|
+
/// Returns the quotient of two numbers.
|
|
58
|
+
/// @param {Number} $a - The dividend.
|
|
59
|
+
/// @param {Number} $b - The divisor.
|
|
60
|
+
/// @return {Number} - The quotient of `$a` and `$b`.
|
|
61
|
+
///
|
|
62
|
+
/// @example scss - Usage
|
|
63
|
+
/// @debug k-math-div( 10, 2 ); // => 5
|
|
64
|
+
/// @debug k-math-div( 10px, 2 ); // => 5px
|
|
17
65
|
@function k-math-div( $a, $b ) {
|
|
18
66
|
@return ( $a / $b );
|
|
19
67
|
}
|
|
20
68
|
|
|
69
|
+
/// Returns whether `$number` has no units.
|
|
70
|
+
/// @param {Number} $number - The number to check.
|
|
71
|
+
/// @return {Boolean} - Whether `$number` has no units.
|
|
72
|
+
///
|
|
73
|
+
/// @example scss - Usage
|
|
74
|
+
/// @debug k-math-is-unitless( 10 ); // => true
|
|
75
|
+
/// @debug k-math-is-unitless( 10px ); // => false
|
|
21
76
|
@function k-math-is-unitless( $number ) {
|
|
22
77
|
@return unitless( $number );
|
|
23
78
|
}
|
|
24
79
|
|
|
80
|
+
/// Returns the larger of two numbers.
|
|
81
|
+
/// @param {Number} $a - The first number.
|
|
82
|
+
/// @param {Number} $b - The second number.
|
|
83
|
+
/// @return {Number} - The larger of `$a` and `$b`.
|
|
84
|
+
///
|
|
85
|
+
/// @example scss - Usage
|
|
86
|
+
/// @debug k-math-max( 10, 20 ); // => 20
|
|
87
|
+
/// @debug k-math-max( 10px, 20px ); // => 20px
|
|
25
88
|
@function k-math-max( $a, $b ) {
|
|
26
89
|
@return max( $a, $b );
|
|
27
90
|
}
|
|
28
91
|
|
|
92
|
+
/// Returns the smaller of two numbers.
|
|
93
|
+
/// @param {Number} $a - The first number.
|
|
94
|
+
/// @param {Number} $b - The second number.
|
|
95
|
+
/// @return {Number} - The smaller of `$a` and `$b`.
|
|
96
|
+
///
|
|
97
|
+
/// @example scss - Usage
|
|
98
|
+
/// @debug k-math-min( 10, 20 ); // => 10
|
|
99
|
+
/// @debug k-math-min( 10px, 20px ); // => 10px
|
|
29
100
|
@function k-math-min( $a, $b ) {
|
|
30
101
|
@return min( $a, $b );
|
|
31
102
|
}
|
|
32
103
|
|
|
104
|
+
/// Returns the remainder of two numbers.
|
|
105
|
+
/// @param {Number} $a - The dividend.
|
|
106
|
+
/// @param {Number} $b - The divisor.
|
|
107
|
+
/// @return {Number} - The remainder of `$a` and `$b`.
|
|
108
|
+
///
|
|
109
|
+
/// @example scss - Usage
|
|
110
|
+
/// @debug k-math-mod( 10, 3 ); // => 1
|
|
111
|
+
/// @debug k-math-mod( 10px, 3 ); // => 1px
|
|
33
112
|
@function k-math-mod( $a, $b ) {
|
|
34
113
|
@return ( $a % $b );
|
|
35
114
|
}
|
|
36
115
|
|
|
116
|
+
/// Returns the product of two numbers.
|
|
117
|
+
/// @param {Number} $a - The first number.
|
|
118
|
+
/// @param {Number} $b - The second number.
|
|
119
|
+
/// @return {Number} - The product of `$a` and `$b`.
|
|
120
|
+
///
|
|
121
|
+
/// @example scss - Usage
|
|
122
|
+
/// @debug k-math-mul( 10, 2 ); // => 20
|
|
123
|
+
/// @debug k-math-mul( 10px, 2 ); // => 20px
|
|
37
124
|
@function k-math-mul( $a, $b ) {
|
|
38
125
|
@return ( $a * $b );
|
|
39
126
|
}
|
|
40
127
|
|
|
128
|
+
/// Converts a unitless number to a percentage.
|
|
129
|
+
/// @param {Number} $number - The number to convert.
|
|
130
|
+
/// @return {Number} - The percentage.
|
|
131
|
+
///
|
|
132
|
+
/// @example scss - Usage
|
|
133
|
+
/// @debug k-math-percentage( 0.5 ); // => 50%
|
|
41
134
|
@function k-math-percentage( $number ) {
|
|
42
|
-
@return ( $number
|
|
135
|
+
@return percentage( $number );
|
|
43
136
|
}
|
|
44
137
|
|
|
138
|
+
/// Returns the result of raising `$x` to the power of `$n`.
|
|
139
|
+
/// @param {Number} $x - The base.
|
|
140
|
+
/// @param {Number} $n - The exponent.
|
|
141
|
+
/// @return {Number} - The result of raising `$x` to the power of `$n`.
|
|
142
|
+
///
|
|
143
|
+
/// @example scss - Usage
|
|
144
|
+
/// @debug k-math-pow( 2, 3 ); // => 8
|
|
45
145
|
@function k-math-pow( $x, $n ) {
|
|
46
146
|
$ret: 1;
|
|
47
147
|
|
|
@@ -63,10 +163,12 @@
|
|
|
63
163
|
|
|
64
164
|
}
|
|
65
165
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
166
|
+
/// Returns a random number between 0 and 1.
|
|
167
|
+
/// @param {Number} $limit - The upper limit of the random number.
|
|
168
|
+
/// @return {Number} - A random number between 0 and 1.
|
|
169
|
+
///
|
|
170
|
+
/// @example scss - Usage
|
|
171
|
+
/// @debug k-math-random(); // => 0.123456789
|
|
70
172
|
@function k-math-random( $limit: null ) {
|
|
71
173
|
@if ( $limit == null ) {
|
|
72
174
|
@return random();
|
|
@@ -75,6 +177,14 @@
|
|
|
75
177
|
@return random( $limit );
|
|
76
178
|
}
|
|
77
179
|
|
|
180
|
+
/// Returns the result of rounding `$number` to the nearest integer
|
|
181
|
+
/// using the specified `$precision`.
|
|
182
|
+
/// @param {Number} $number - The number to round.
|
|
183
|
+
/// @param {Number} $precision - The number of decimal places to round to.
|
|
184
|
+
/// @return {Number} - The rounded number.
|
|
185
|
+
///
|
|
186
|
+
/// @example scss - Usage
|
|
187
|
+
/// @debug k-math-round( 10.123456789, 3 ); // => 10.123
|
|
78
188
|
@function k-math-round( $number, $precision: 0 ) {
|
|
79
189
|
|
|
80
190
|
@if ( $precision == 0 ) {
|
|
@@ -86,10 +196,22 @@
|
|
|
86
196
|
@return k-math-div( round( $number * $pow ), $pow );
|
|
87
197
|
}
|
|
88
198
|
|
|
199
|
+
/// Returns a string representation of `$number`'s unit.
|
|
200
|
+
/// @param {Number} $number - The number to get the unit of.
|
|
201
|
+
/// @return {String} - The unit of `$number`.
|
|
202
|
+
///
|
|
203
|
+
/// @example scss - Usage
|
|
204
|
+
/// @debug k-math-unit( 10px ); // => px
|
|
89
205
|
@function k-math-unit( $number ) {
|
|
90
206
|
@return unit( $number );
|
|
91
207
|
}
|
|
92
208
|
|
|
209
|
+
/// Remove the unit from a number.
|
|
210
|
+
/// @param {Number} $number - The number to remove the unit from.
|
|
211
|
+
/// @return {Number} - The unitless number.
|
|
212
|
+
///
|
|
213
|
+
/// @example scss - Usage
|
|
214
|
+
/// @debug k-math-strip-unit( 10px ); // => 10
|
|
93
215
|
@function k-math-strip-unit($number) {
|
|
94
216
|
@if ( k-meta-type-of( $number ) == "number" ) and not k-math-is-unitless( $number ) {
|
|
95
217
|
@return k-math-div( $number, 1 * k-math-unit( $number) );
|
|
@@ -1,77 +1,239 @@
|
|
|
1
1
|
// Adapted from https://css-tricks.com/snippets/sass/advanced-type-checking/
|
|
2
2
|
|
|
3
|
+
/// A wrapper around the `call()` function.
|
|
4
|
+
/// Calls the function `$function` with the arguments `$args`.
|
|
5
|
+
/// @param {Function} $function - The function to call.
|
|
6
|
+
/// @param {List} $args - The arguments to pass to `$function`.
|
|
7
|
+
/// @return {Any} - The result of calling `$function` with `$args`.
|
|
8
|
+
///
|
|
9
|
+
/// @example scss - Usage
|
|
10
|
+
/// @debug k-meta-call( k-meta-get-function( "k-string-replace" ), "foo bar", "bar", "baz" ); // => "foo baz"
|
|
3
11
|
@function k-meta-call( $function, $args... ) {
|
|
4
12
|
@return call( $function, $args... );
|
|
5
13
|
}
|
|
6
14
|
|
|
15
|
+
/// A wrapper around the `function-exists()` function.
|
|
16
|
+
/// Returns whether a function with the name `$name` exists.
|
|
17
|
+
/// @param {String} $name - The name of the function to check.
|
|
18
|
+
/// @return {Boolean} - Whether a function with the name `$name` exists.
|
|
19
|
+
///
|
|
20
|
+
/// @example scss - Usage
|
|
21
|
+
/// @debug k-meta-function-exists( "k-string-replace" ); // => true
|
|
7
22
|
@function k-meta-function-exists( $name ) {
|
|
8
23
|
@return function-exists( $name );
|
|
9
24
|
}
|
|
10
25
|
|
|
26
|
+
/// A wrapper around the `get-function()` function.
|
|
27
|
+
/// Returns the function with the name `$name`.
|
|
28
|
+
/// @param {String} $name - The name of the function to get.
|
|
29
|
+
/// @param {Boolean} $css - Whether to return the CSS representation of the function.
|
|
30
|
+
/// @param {Module} $module - The module to get the function from.
|
|
31
|
+
/// @return {Function} - The function with the name `$name`.
|
|
32
|
+
///
|
|
33
|
+
/// @example scss - Usage
|
|
34
|
+
/// @debug k-meta-get-function( "k-string-replace" ); // => Function
|
|
11
35
|
@function k-meta-get-function( $name, $args... ) {
|
|
12
36
|
@return get-function( $name, $args... );
|
|
13
37
|
}
|
|
14
38
|
|
|
39
|
+
/// A wrapper around the `inspect()` function.
|
|
40
|
+
/// Returns a string representation of `$value`.
|
|
41
|
+
/// @param {Any} $value - The value to inspect.
|
|
42
|
+
/// @return {String} - A string representation of `$value`.
|
|
43
|
+
///
|
|
44
|
+
/// @example scss - Usage
|
|
45
|
+
/// @debug k-meta-inspect( "foo bar" ); // => "foo bar"
|
|
15
46
|
@function k-meta-inspect( $value ) {
|
|
16
47
|
@return inspect( $value );
|
|
17
48
|
}
|
|
18
49
|
|
|
50
|
+
/// A wrapper around the `keywords()` function.
|
|
51
|
+
/// Returns a map of the keywords in `$args`.
|
|
52
|
+
/// @param {List} $args - The arguments to process.
|
|
53
|
+
/// @return {Map} - A map of the keywords in `$args`.
|
|
54
|
+
///
|
|
55
|
+
/// @example scss - Usage
|
|
56
|
+
/// @debug k-meta-keywords( ( "foo" "bar" "baz" "qux" ) ); // => ( "foo": "bar", "baz": "qux" )
|
|
19
57
|
@function k-meta-keywords( $args ) {
|
|
20
58
|
@return keywords( $args );
|
|
21
59
|
}
|
|
22
60
|
|
|
61
|
+
/// A wrapper around the `type-of()` function.
|
|
62
|
+
/// Returns the type of `$value`.
|
|
63
|
+
/// @param {Any} $value - The value to get the type of.
|
|
64
|
+
/// @return {String} - The type of `$value`.
|
|
65
|
+
///
|
|
66
|
+
/// @example scss - Usage
|
|
67
|
+
/// @debug k-meta-type-of( "foo bar" ); // => "string"
|
|
23
68
|
@function k-meta-type-of( $value ) {
|
|
24
69
|
@return type-of( $value );
|
|
25
70
|
}
|
|
26
71
|
|
|
72
|
+
/// A wrapper around the `variable-exists()` function.
|
|
73
|
+
/// Returns whether a variable with the name `$name` exists.
|
|
74
|
+
/// @param {String} $name - The name of the variable to check.
|
|
75
|
+
/// @return {Boolean} - Whether a variable with the name `$name` exists.
|
|
76
|
+
///
|
|
77
|
+
/// @example scss - Usage
|
|
78
|
+
/// @debug k-meta-variable-exists( "foo" ); // => true
|
|
27
79
|
@function k-meta-variable-exists( $name ) {
|
|
28
80
|
@return variable-exists( $name );
|
|
29
81
|
}
|
|
30
82
|
|
|
83
|
+
/// Checks whether `$value` is a <number> CSS data type.
|
|
84
|
+
/// @param {Any} $value - The value to check.
|
|
85
|
+
/// @return {Boolean} - Whether `$value` is a number.
|
|
86
|
+
///
|
|
87
|
+
/// @link https://developer.mozilla.org/en-US/docs/Web/CSS/number
|
|
88
|
+
///
|
|
89
|
+
/// @example scss - Usage
|
|
90
|
+
/// @debug k-meta-is-number( 1 ); // => true
|
|
91
|
+
/// @debug k-meta-is-number( "foo" ); // => false
|
|
31
92
|
@function k-meta-is-number( $value ) {
|
|
32
93
|
@return k-meta-type-of( $value ) == "number";
|
|
33
94
|
}
|
|
34
95
|
|
|
96
|
+
/// Checks whether `$value` is a <integer> CSS data type.
|
|
97
|
+
/// @param {Any} $value - The value to check.
|
|
98
|
+
/// @return {Boolean} - Whether `$value` is a integer.
|
|
99
|
+
///
|
|
100
|
+
/// @link https://developer.mozilla.org/en-US/docs/Web/CSS/integer
|
|
101
|
+
///
|
|
102
|
+
/// @example scss - Usage
|
|
103
|
+
/// @debug k-meta-is-integer( 1 ); // => true
|
|
104
|
+
/// @debug k-meta-is-integer( 1.5 ); // => false
|
|
35
105
|
@function k-meta-is-integer( $value ) {
|
|
36
106
|
@return k-meta-is-number( $value ) and k-math-round( $value ) == $value;
|
|
37
107
|
}
|
|
38
108
|
|
|
109
|
+
/// Checks whether `$value` is a <time> CSS data type.
|
|
110
|
+
/// @param {Any} $value - The value to check.
|
|
111
|
+
/// @return {Boolean} - Whether `$value` is a time.
|
|
112
|
+
///
|
|
113
|
+
/// @link https://developer.mozilla.org/en-US/docs/Web/CSS/time
|
|
114
|
+
///
|
|
115
|
+
/// @example scss - Usage
|
|
116
|
+
/// @debug k-meta-is-time( 1s ); // => true
|
|
117
|
+
/// @debug k-meta-is-time( 1 ); // => false
|
|
39
118
|
@function k-meta-is-time( $value ) {
|
|
40
119
|
@return k-meta-is-number( $value ) and k-string-index( "ms" "s", k-math-unit( $value ) ) != null;
|
|
41
120
|
}
|
|
42
121
|
|
|
122
|
+
/// Checks whether `$value` is a valid duration period.
|
|
123
|
+
/// @param {Any} $value - The value to check.
|
|
124
|
+
/// @return {Boolean} - Whether `$value` is a duration.
|
|
125
|
+
///
|
|
126
|
+
/// @link https://developer.mozilla.org/en-US/docs/Web/CSS/time
|
|
127
|
+
///
|
|
128
|
+
/// @example scss - Usage
|
|
129
|
+
/// @debug k-meta-is-duration( 1s ); // => true
|
|
130
|
+
/// @debug k-meta-is-duration( 1 ); // => false
|
|
43
131
|
@function k-meta-is-duration( $value ) {
|
|
44
132
|
@return k-meta-is-time( $value );
|
|
45
133
|
}
|
|
46
134
|
|
|
135
|
+
/// Checks whether `$value` is a <angle> CSS data type.
|
|
136
|
+
/// @param {Any} $value - The value to check.
|
|
137
|
+
/// @return {Boolean} - Whether `$value` is a angle.
|
|
138
|
+
///
|
|
139
|
+
/// @link https://developer.mozilla.org/en-US/docs/Web/CSS/angle
|
|
140
|
+
///
|
|
141
|
+
/// @example scss - Usage
|
|
142
|
+
/// @debug k-meta-is-angle( 1deg ); // => true
|
|
143
|
+
/// @debug k-meta-is-angle( 1 ); // => false
|
|
47
144
|
@function k-meta-is-angle( $value ) {
|
|
48
145
|
@return k-meta-is-number( $value ) and k-string-index( "deg" "rad" "grad" "turn", k-math-unit( $value ) ) != null;
|
|
49
146
|
}
|
|
50
147
|
|
|
148
|
+
/// Checks whether `$value` is a <frequency> CSS data type.
|
|
149
|
+
/// @param {Any} $value - The value to check.
|
|
150
|
+
/// @return {Boolean} - Whether `$value` is a frequency.
|
|
151
|
+
///
|
|
152
|
+
/// @link https://developer.mozilla.org/en-US/docs/Web/CSS/frequency
|
|
153
|
+
///
|
|
154
|
+
/// @example scss - Usage
|
|
155
|
+
/// @debug k-meta-is-frequency( 1Hz ); // => true
|
|
156
|
+
/// @debug k-meta-is-frequency( 1 ); // => false
|
|
51
157
|
@function k-meta-is-frequency( $value ) {
|
|
52
158
|
@return k-meta-is-number( $value ) and k-string-index( "Hz" "kHz", k-math-unit( $value ) ) != null;
|
|
53
159
|
}
|
|
54
160
|
|
|
161
|
+
/// Checks whether `$value` is a relative <length> CSS data type.
|
|
162
|
+
/// @param {Any} $value - The value to check.
|
|
163
|
+
/// @return {Boolean} - Whether `$value` is a relative length.
|
|
164
|
+
///
|
|
165
|
+
/// @link https://developer.mozilla.org/en-US/docs/Web/CSS/length#relative_length_units_based_on_font
|
|
166
|
+
/// @link https://developer.mozilla.org/en-US/docs/Web/CSS/length#relative_length_units_based_on_viewport
|
|
167
|
+
///
|
|
168
|
+
/// @example scss - Usage
|
|
169
|
+
/// @debug k-meta-is-relative-length( 1em ); // => true
|
|
170
|
+
/// @debug k-meta-is-relative-length( 1ch ); // => true
|
|
171
|
+
/// @debug k-meta-is-relative-length( 1 ); // => false
|
|
55
172
|
@function k-meta-is-relative-length( $value ) {
|
|
56
173
|
@return k-meta-is-number( $value ) and k-string-index( "em" "ex" "ch" "rem" "vw" "vh" "vmin" "vmax", k-math-unit( $value ) ) != null;
|
|
57
174
|
}
|
|
58
175
|
|
|
176
|
+
/// Checks whether `$value` is an absolute <length> CSS data type.
|
|
177
|
+
/// @param {Any} $value - The value to check.
|
|
178
|
+
/// @return {Boolean} - Whether `$value` is an absolute length.
|
|
179
|
+
///
|
|
180
|
+
/// @link https://developer.mozilla.org/en-US/docs/Web/CSS/length#absolute_length_units
|
|
181
|
+
///
|
|
182
|
+
/// @example scss - Usage
|
|
183
|
+
/// @debug k-meta-is-absolute-length( 1cm ); // => true
|
|
184
|
+
/// @debug k-meta-is-absolute-length( 1 ); // => false
|
|
59
185
|
@function k-meta-is-absolute-length( $value ) {
|
|
60
186
|
@return k-meta-is-number( $value ) and k-string-index( "cm" "mm" "in" "px" "pt" "pc", k-math-unit( $value ) ) != null;
|
|
61
187
|
}
|
|
62
188
|
|
|
189
|
+
/// Checks whether `$value` is a <percentage> CSS data type.
|
|
190
|
+
/// @param {Any} $value - The value to check.
|
|
191
|
+
/// @return {Boolean} - Whether `$value` is a percentage.
|
|
192
|
+
///
|
|
193
|
+
/// @link https://developer.mozilla.org/en-US/docs/Web/CSS/percentage
|
|
194
|
+
///
|
|
195
|
+
/// @example scss - Usage
|
|
196
|
+
/// @debug k-meta-is-percentage( 1% ); // => true
|
|
197
|
+
/// @debug k-meta-is-percentage( 1 ); // => false
|
|
63
198
|
@function k-meta-is-percentage( $value ) {
|
|
64
199
|
@return k-meta-is-number( $value ) and k-math-unit( $value ) == "%";
|
|
65
200
|
}
|
|
66
201
|
|
|
202
|
+
/// Checks whether `$value` is a <length> CSS data type.
|
|
203
|
+
/// @param {Any} $value - The value to check.
|
|
204
|
+
/// @return {Boolean} - Whether `$value` is a length.
|
|
205
|
+
///
|
|
206
|
+
/// @link https://developer.mozilla.org/en-US/docs/Web/CSS/length
|
|
207
|
+
///
|
|
208
|
+
/// @example scss - Usage
|
|
209
|
+
/// @debug k-meta-is-length( 1em ); // => true
|
|
210
|
+
/// @debug k-meta-is-length( 1cm ); // => true
|
|
211
|
+
/// @debug k-meta-is-length( 1 ); // => false
|
|
67
212
|
@function k-meta-is-length( $value ) {
|
|
68
213
|
@return k-meta-is-relative-length( $value ) or k-meta-is-absolute-length( $value );
|
|
69
214
|
}
|
|
70
215
|
|
|
216
|
+
/// Checks whether `$value` is a <resolution> CSS data type.
|
|
217
|
+
/// @param {Any} $value - The value to check.
|
|
218
|
+
/// @return {Boolean} - Whether `$value` is a resolution.
|
|
219
|
+
///
|
|
220
|
+
/// @link https://developer.mozilla.org/en-US/docs/Web/CSS/resolution
|
|
221
|
+
///
|
|
222
|
+
/// @example scss - Usage
|
|
223
|
+
/// @debug k-meta-is-resolution( 1dpi ); // => true
|
|
224
|
+
/// @debug k-meta-is-resolution( 1 ); // => false
|
|
71
225
|
@function k-meta-is-resolution( $value ) {
|
|
72
226
|
@return k-meta-is-number( $value ) and k-string-index( "dpi" "dpcm" "dppx", k-math-unit( $value ) ) != null;
|
|
73
227
|
}
|
|
74
228
|
|
|
229
|
+
/// Checks whether `$value` is a <position> CSS data type.
|
|
230
|
+
/// @param {Any} $value - The value to check.
|
|
231
|
+
/// @return {Boolean} - Whether `$value` is a position.
|
|
232
|
+
///
|
|
233
|
+
/// @link https://developer.mozilla.org/en-US/docs/Web/CSS/position
|
|
234
|
+
///
|
|
235
|
+
/// @example scss - Usage
|
|
236
|
+
/// @debug k-meta-is-position( center ); // => true
|
|
75
237
|
@function k-meta-is-position( $value ) {
|
|
76
238
|
@return k-meta-is-length( $value ) or k-meta-is-percentage( $value ) or k-string-index( "top" "right" "bottom" "left" "center", $value ) != null;
|
|
77
239
|
}
|
|
@@ -1,20 +1,57 @@
|
|
|
1
|
+
/// Returns the first index of `$substring` in `$string`, or `null` if `$string` doesn’t contain `$substring`.
|
|
2
|
+
/// @param {String} $string - The string to process.
|
|
3
|
+
/// @param {String} $substring - The substring to look for.
|
|
4
|
+
/// @return {Number} - The first index of `$substring` in `$string`, or `null` if `$string` doesn’t contain `$substring`.
|
|
5
|
+
///
|
|
6
|
+
/// @example scss - Usage
|
|
7
|
+
/// @debug k-string-index( "foo bar", "bar" ); // => 5
|
|
1
8
|
@function k-string-index( $string, $substring ) {
|
|
2
9
|
@return str-index( $string, $substring );
|
|
3
10
|
}
|
|
4
11
|
|
|
12
|
+
/// Returns a copy of `$string` with `$insert` inserted at `$index`.
|
|
13
|
+
/// @param {String} $string - The string to process.
|
|
14
|
+
/// @param {String} $insert - The string to insert.
|
|
15
|
+
/// @param {Number} $index - The index at which to insert `$insert`.
|
|
16
|
+
/// @return {String} - The resulting string.
|
|
17
|
+
///
|
|
18
|
+
/// @example scss - Usage
|
|
19
|
+
/// @debug k-string-insert( "foo bar", "baz", 5 ); // => "foo baz bar"
|
|
5
20
|
@function k-string-insert( $string, $insert, $index ) {
|
|
6
21
|
@return str-insert( $string, $insert, $index );
|
|
7
22
|
}
|
|
8
23
|
|
|
24
|
+
/// Returns the length of `$string`.
|
|
25
|
+
/// @param {String} $string - The string to process.
|
|
26
|
+
/// @return {Number} - The length of `$string`.
|
|
27
|
+
///
|
|
28
|
+
/// @example scss - Usage
|
|
29
|
+
/// @debug k-string-length( "foo bar" ); // => 7
|
|
9
30
|
@function k-string-length( $string ) {
|
|
10
31
|
@return str-length( $string );
|
|
11
32
|
}
|
|
12
33
|
|
|
34
|
+
/// Returns a copy of `$string` with quotes added.
|
|
35
|
+
/// @param {String} $string - The string to process.
|
|
36
|
+
/// @return {String} - The resulting string.
|
|
37
|
+
///
|
|
38
|
+
/// @example scss - Usage
|
|
39
|
+
/// @debug k-string-quote( "foo bar" ); // => "foo bar"
|
|
13
40
|
@function k-string-quote( $string ) {
|
|
14
41
|
@return quote( $string );
|
|
15
42
|
}
|
|
16
43
|
|
|
17
|
-
|
|
44
|
+
/// Returns a copy of `$string` with all occurrences of `$search`
|
|
45
|
+
/// replaced by `$replace`.
|
|
46
|
+
/// @param {String} $string - The string to process.
|
|
47
|
+
/// @param {String} $search - The substring to look for.
|
|
48
|
+
/// @param {String} $replace - The replacement string.
|
|
49
|
+
/// @return {String} - The resulting string.
|
|
50
|
+
///
|
|
51
|
+
/// @link https://www.sassmeister.com/gist/1b4f2da5527830088e4d
|
|
52
|
+
///
|
|
53
|
+
/// @example scss - Usage
|
|
54
|
+
/// @debug k-string-replace( "foo bar", "bar", "baz" ); // => "foo baz"
|
|
18
55
|
@function k-string-replace( $string, $search, $replace: "" ) {
|
|
19
56
|
@if k-meta-type-of( $string ) == number {
|
|
20
57
|
$string: $string + "";
|
|
@@ -29,22 +66,53 @@
|
|
|
29
66
|
@return $string;
|
|
30
67
|
}
|
|
31
68
|
|
|
69
|
+
/// Returns a substring of `$string` starting at `$start-at` and ending at `$end-at`.
|
|
70
|
+
/// @param {String} $string - The string to process.
|
|
71
|
+
/// @param {Number} $start-at - The index at which to start the substring.
|
|
72
|
+
/// @param {Number} $end-at - The index at which to end the substring.
|
|
73
|
+
/// @return {String} - The resulting string.
|
|
74
|
+
///
|
|
75
|
+
/// @example scss - Usage
|
|
76
|
+
/// @debug k-string-slice( "foo bar", 5 ); // => "bar"
|
|
32
77
|
@function k-string-slice( $string, $start-at, $end-at: -1 ) {
|
|
33
78
|
@return str-slice( $string, $start-at, $end-at );
|
|
34
79
|
}
|
|
35
80
|
|
|
81
|
+
/// Returns a copy of `$string` with all uppercase letters converted to lowercase.
|
|
82
|
+
/// @param {String} $string - The string to process.
|
|
83
|
+
/// @return {String} - The resulting string.
|
|
84
|
+
///
|
|
85
|
+
/// @example scss - Usage
|
|
86
|
+
/// @debug k-string-to-lower-case( "FOO BAR" ); // => "foo bar"
|
|
36
87
|
@function k-string-to-lower-case( $string ) {
|
|
37
88
|
@return to-lower-case( $string );
|
|
38
89
|
}
|
|
39
90
|
|
|
91
|
+
/// Returns a copy of `$string` with all lowercase letters converted to uppercase.
|
|
92
|
+
/// @param {String} $string - The string to process.
|
|
93
|
+
/// @return {String} - The resulting string.
|
|
94
|
+
///
|
|
95
|
+
/// @example scss - Usage
|
|
96
|
+
/// @debug k-string-to-upper-case( "foo bar" ); // => "FOO BAR"
|
|
40
97
|
@function k-string-to-upper-case( $string ) {
|
|
41
98
|
@return to-upper-case( $string );
|
|
42
99
|
}
|
|
43
100
|
|
|
101
|
+
/// Returns a unique identifier.
|
|
102
|
+
/// @return {String} - The unique identifier.
|
|
103
|
+
///
|
|
104
|
+
/// @example scss - Usage
|
|
105
|
+
/// @debug k-string-unique-id(); // => UNIQUE_ID
|
|
44
106
|
@function k-string-unique-id() {
|
|
45
107
|
@return unique-id();
|
|
46
108
|
}
|
|
47
109
|
|
|
110
|
+
/// Returns a copy of `$string` with quotes removed.
|
|
111
|
+
/// @param {String} $string - The string to process.
|
|
112
|
+
/// @return {String} - The resulting string.
|
|
113
|
+
///
|
|
114
|
+
/// @example scss - Usage
|
|
115
|
+
/// @debug k-string-unquote( "foo bar" ); // => foo bar
|
|
48
116
|
@function k-string-unquote( $string ) {
|
|
49
117
|
@return unquote( $string );
|
|
50
118
|
}
|