@matteusan/himig 1.5.1 → 1.7.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/README.md +2 -2
- package/_index.scss +5 -23
- package/ms-badge/_badge-base.scss +1 -1
- package/ms-badge/_badge-extend.scss +1 -1
- package/ms-badge/_badge-styles.scss +1 -1
- package/ms-button/_button-base.scss +1 -1
- package/ms-button/_button-extend.scss +1 -1
- package/ms-button/_button-mixins.scss +1 -1
- package/ms-button/_button-styles.scss +26 -26
- package/ms-card/_card-base.scss +1 -1
- package/ms-card/_card-extend.scss +1 -1
- package/ms-card/_card-styles.scss +1 -1
- package/ms-form-field/_form-field-base.scss +1 -1
- package/ms-form-field/_form-field-extend.scss +1 -1
- package/ms-form-field/_form-field-styles.scss +1 -1
- package/ms-link/_link-base.scss +1 -1
- package/ms-link/_link-extend.scss +1 -1
- package/ms-link/_link-styles.scss +1 -1
- package/ms-list/_list-base.scss +1 -1
- package/ms-list/_list-extend.scss +1 -1
- package/ms-list/_list-styles.scss +1 -1
- package/ms-select-field/_select-field-base.scss +1 -1
- package/ms-select-field/_select-field-extend.scss +1 -1
- package/ms-select-field/_select-field-styles.scss +1 -1
- package/ms-tick-field/_tick-field-base.scss +1 -1
- package/ms-tick-field/_tick-field-extend.scss +1 -1
- package/ms-tick-field/_tick-field-styles.scss +1 -1
- package/ms-utils/_color-utils.scss +1 -1
- package/ms-utils/_consts.scss +1 -1
- package/ms-utils/_layout-utils.scss +1 -1
- package/ms-utils/_struct-utils.scss +1 -1
- package/ms-utils/_typography-utils.scss +1 -1
- package/ms-utils/_util-helpers.scss +1 -1
- package/package.json +11 -3
- package/pintig/README.md +0 -2
- package/pintig/_index.scss +0 -77
- package/pintig/breakpoint/_breakpoint-sentro.scss +0 -53
- package/pintig/breakpoint/_index.scss +0 -23
- package/pintig/color/_color-constants.scss +0 -33
- package/pintig/color/_color-setters.scss +0 -75
- package/pintig/color/_color-utils.scss +0 -62
- package/pintig/color/_color-validators.scss +0 -59
- package/pintig/color/_index.scss +0 -25
- package/pintig/component/_component-extend.scss +0 -56
- package/pintig/component/_index.scss +0 -23
- package/pintig/component/component-base.ts +0 -81
- package/pintig/component/component-properties.ts +0 -25
- package/pintig/component/index.ts +0 -29
- package/pintig/component/types/ms-component.d.ts +0 -24
- package/pintig/index.ts +0 -29
- package/pintig/package.json +0 -15
- package/pintig/sprite/_index.scss +0 -23
- package/pintig/sprite/_sprite-mixins.scss +0 -29
- package/pintig/struct/_index.scss +0 -24
- package/pintig/struct/_struct-setters.scss +0 -98
- package/pintig/struct/_struct-utils.scss +0 -218
- package/pintig/struct/_struct-validators.scss +0 -57
- package/pintig/theme/_index.scss +0 -30
- package/pintig/theme/_theme-get.scss +0 -41
- package/pintig/theme/_theme-keys.scss +0 -43
- package/pintig/theme/_theme-merge.scss +0 -46
- package/pintig/theme/_theme-properties.scss +0 -61
- package/pintig/theme/_theme-setters.scss +0 -167
- package/pintig/theme/_theme-tokens.scss +0 -57
- package/pintig/tokens/_index.scss +0 -23
- package/pintig/tokens/_token-data.scss +0 -249
- package/pintig/tokens/_token-methods.scss +0 -118
- package/pintig/tools/_index.scss +0 -27
- package/pintig/tools/_tools-color.scss +0 -79
- package/pintig/tools/_tools-helpers.scss +0 -30
- package/pintig/tools/_tools-sentro.scss +0 -52
- package/pintig/tools/_tools-string.scss +0 -45
- package/pintig/tools/_tools-validation.scss +0 -71
- package/pintig/typography/_index.scss +0 -24
- package/pintig/typography/_typography-setters.scss +0 -78
- package/pintig/typography/_typography-utils.scss +0 -76
- package/pintig/typography/_typography-validators.scss +0 -47
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
//---------------------------------------------------
|
|
2
|
-
// Copyright (c) 2024 MatteuSan
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
// in the Software without restriction, including without limitation the rights
|
|
7
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
// furnished to do so, subject to the following conditions:
|
|
10
|
-
//
|
|
11
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
// copies or substantial portions of the Software.
|
|
13
|
-
//
|
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
// SOFTWARE.
|
|
21
|
-
//---------------------------------------------------
|
|
22
|
-
|
|
23
|
-
@use 'tools-validation' as validator;
|
|
24
|
-
@use 'sass:color';
|
|
25
|
-
@use 'sass:map';
|
|
26
|
-
@use 'sass:math';
|
|
27
|
-
|
|
28
|
-
/// Tints a color from a given percentage.
|
|
29
|
-
/// @param {color} $color
|
|
30
|
-
/// @param {number} $percent
|
|
31
|
-
/// @return {color} modified color.
|
|
32
|
-
@function tint($color, $percent) {
|
|
33
|
-
@return color.adjust(color.mix(#fff, $color, $percent), $saturation: 11%);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/// Shades a color from a given percentage.
|
|
37
|
-
/// @param {color} $color
|
|
38
|
-
/// @param {number} $percent
|
|
39
|
-
/// @return {color} modified color.
|
|
40
|
-
@function shade($color, $percent) {
|
|
41
|
-
@return color.adjust(color.mix(#000, $color, $percent), $saturation: 11%);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@function _get-linear($color) {
|
|
45
|
-
@if $color <= 0.4045 {
|
|
46
|
-
@return math.div($color, 12.92);
|
|
47
|
-
} @else {
|
|
48
|
-
@return math.pow(math.div($color + 0.055, 1.055), 2.4);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@function _get-luminance($color) {
|
|
53
|
-
$r: _get-linear(math.div(color.red($color), 255));
|
|
54
|
-
$g: _get-linear(math.div(color.green($color), 255));
|
|
55
|
-
$b: _get-linear(math.div(color.blue($color), 255));
|
|
56
|
-
|
|
57
|
-
@return (0.2126 * $r) + (0.7152 * $g) + (0.0722 * $b);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/// Gets accessible ink from a given fill.
|
|
61
|
-
/// @param {color} $fill
|
|
62
|
-
/// @param {boolean} $expressive
|
|
63
|
-
/// @return {color} accessible ink color.
|
|
64
|
-
@function get-ink($fill, $expressive: false) {
|
|
65
|
-
$_white-lumen: _get-luminance(#fff);
|
|
66
|
-
$_expressiveness: 87.4%;
|
|
67
|
-
|
|
68
|
-
@if $expressive {
|
|
69
|
-
@if math.abs(_get-luminance($fill) - $_white-lumen) > 0.7 {
|
|
70
|
-
@return tint($fill, $_expressiveness);
|
|
71
|
-
}
|
|
72
|
-
@return shade($fill, $_expressiveness);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@if math.abs(_get-luminance($fill) - $_white-lumen) > 0.7 {
|
|
76
|
-
@return #fff;
|
|
77
|
-
}
|
|
78
|
-
@return #000;
|
|
79
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
//---------------------------------------------------
|
|
2
|
-
// Copyright (c) 2024 MatteuSan
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
// in the Software without restriction, including without limitation the rights
|
|
7
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
// furnished to do so, subject to the following conditions:
|
|
10
|
-
//
|
|
11
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
// copies or substantial portions of the Software.
|
|
13
|
-
//
|
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
// SOFTWARE.
|
|
21
|
-
//---------------------------------------------------
|
|
22
|
-
|
|
23
|
-
@use 'tools-validation' as validators;
|
|
24
|
-
|
|
25
|
-
@function prioritize($priority, $fallback) {
|
|
26
|
-
@if validators.is-empty($priority) {
|
|
27
|
-
@return $fallback;
|
|
28
|
-
}
|
|
29
|
-
@return $priority;
|
|
30
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
//---------------------------------------------------
|
|
2
|
-
// Copyright (c) 2024 MatteuSan
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
// in the Software without restriction, including without limitation the rights
|
|
7
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
// furnished to do so, subject to the following conditions:
|
|
10
|
-
//
|
|
11
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
// copies or substantial portions of the Software.
|
|
13
|
-
//
|
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
// SOFTWARE.
|
|
21
|
-
//---------------------------------------------------
|
|
22
|
-
|
|
23
|
-
@use 'node_modules/@matteusan/sentro';
|
|
24
|
-
|
|
25
|
-
/// Converts px values to rem values.
|
|
26
|
-
/// @param {int} $px
|
|
27
|
-
/// @return {int} rem value.
|
|
28
|
-
@function to-rem($px) {
|
|
29
|
-
@return sentro.px-to-rem($px);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/// Converts rem values to px values.
|
|
33
|
-
/// @param {int} $rem
|
|
34
|
-
/// @return {int} px value.
|
|
35
|
-
@function to-px($rem) {
|
|
36
|
-
@return sentro.rem-to-px($rem);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/// Prefixes properties
|
|
40
|
-
/// @param {string} $property
|
|
41
|
-
/// @param {*} $value
|
|
42
|
-
/// @return {*} generated CSS.
|
|
43
|
-
@mixin prefix($property, $value) {
|
|
44
|
-
@include sentro.prefix($property, $value);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/// Line clamp mixin.
|
|
48
|
-
/// @param {string|int} $lines
|
|
49
|
-
/// @return {*} queried line clamp styles.
|
|
50
|
-
@mixin break($lines) {
|
|
51
|
-
@include sentro.line-clamp($lines);
|
|
52
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//---------------------------------------------------
|
|
2
|
-
// Copyright (c) 2024 MatteuSan
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
// in the Software without restriction, including without limitation the rights
|
|
7
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
// furnished to do so, subject to the following conditions:
|
|
10
|
-
//
|
|
11
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
// copies or substantial portions of the Software.
|
|
13
|
-
//
|
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
// SOFTWARE.
|
|
21
|
-
//---------------------------------------------------
|
|
22
|
-
|
|
23
|
-
@use 'sass:list';
|
|
24
|
-
@use 'sass:string';
|
|
25
|
-
|
|
26
|
-
/// Splits a string from a given separator.
|
|
27
|
-
/// Source: https://stackoverflow.com/a/42295154
|
|
28
|
-
/// @param {string} $string
|
|
29
|
-
/// @param {string} $separator
|
|
30
|
-
/// @return {list} returns split string list.
|
|
31
|
-
@function split($string, $separator) {
|
|
32
|
-
$split-list: ();
|
|
33
|
-
$index: string.index($string, $separator);
|
|
34
|
-
|
|
35
|
-
@while $index != null {
|
|
36
|
-
$item: string.slice($string, 1, $index - 1);
|
|
37
|
-
$split-list: list.append($split-list, $item, comma);
|
|
38
|
-
$string: string.slice($string, $index + string.length($separator));
|
|
39
|
-
$index: string.index($string, $separator);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
$split-list: list.append($split-list, $string, comma);
|
|
43
|
-
|
|
44
|
-
@return $split-list;
|
|
45
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
//---------------------------------------------------
|
|
2
|
-
// Copyright (c) 2024 MatteuSan
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
// in the Software without restriction, including without limitation the rights
|
|
7
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
// furnished to do so, subject to the following conditions:
|
|
10
|
-
//
|
|
11
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
// copies or substantial portions of the Software.
|
|
13
|
-
//
|
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
// SOFTWARE.
|
|
21
|
-
//---------------------------------------------------
|
|
22
|
-
|
|
23
|
-
@use 'sass:meta';
|
|
24
|
-
@use 'sass:string';
|
|
25
|
-
|
|
26
|
-
/// Public function for data type validation.
|
|
27
|
-
/// @param {*} $query
|
|
28
|
-
/// @param {string} $reference
|
|
29
|
-
/// @param {boolean} $errors
|
|
30
|
-
/// @return {boolean|error} true if matching, error/false if not.
|
|
31
|
-
@function is-type($query, $reference, $errors: true, $custom-error: null) {
|
|
32
|
-
@if $errors != true {
|
|
33
|
-
@return _validate-data-type($reference, $query);
|
|
34
|
-
} @else {
|
|
35
|
-
@if _validate-data-type($reference, $query) == false {
|
|
36
|
-
@if not is-empty($custom-error) {
|
|
37
|
-
@error $custom-error;
|
|
38
|
-
}
|
|
39
|
-
@error 'Invalid #{string.unquote($reference)}: #{$query}! Expecting a valid #{string.unquote($reference)}.';
|
|
40
|
-
} @else {
|
|
41
|
-
@return true;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/// Checks if query is empty.
|
|
47
|
-
/// @param {*} $query
|
|
48
|
-
/// @return {boolean} true if empty, false if not.
|
|
49
|
-
@function is-empty($query) {
|
|
50
|
-
@if not $query
|
|
51
|
-
or $query == ''
|
|
52
|
-
or $query == ()
|
|
53
|
-
or $query == none
|
|
54
|
-
or $query == null
|
|
55
|
-
or length($query) == 0 {
|
|
56
|
-
@return true;
|
|
57
|
-
}
|
|
58
|
-
@return false;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/// Validates a data type on a given reference and query.
|
|
62
|
-
/// @access private
|
|
63
|
-
/// @param {string} $reference
|
|
64
|
-
/// @param {*} $query
|
|
65
|
-
/// @return {boolean} true if matching, false if not.
|
|
66
|
-
@function _validate-data-type($reference, $query) {
|
|
67
|
-
@if meta.type-of($query) != string.unquote($reference) {
|
|
68
|
-
@return false;
|
|
69
|
-
}
|
|
70
|
-
@return true;
|
|
71
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//---------------------------------------------------
|
|
2
|
-
// Copyright (c) 2024 MatteuSan
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
// in the Software without restriction, including without limitation the rights
|
|
7
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
// furnished to do so, subject to the following conditions:
|
|
10
|
-
//
|
|
11
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
// copies or substantial portions of the Software.
|
|
13
|
-
//
|
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
// SOFTWARE.
|
|
21
|
-
//---------------------------------------------------
|
|
22
|
-
|
|
23
|
-
@forward 'typography-setters';
|
|
24
|
-
@forward 'typography-utils';
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
//---------------------------------------------------
|
|
2
|
-
// Copyright (c) 2024 MatteuSan
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
// in the Software without restriction, including without limitation the rights
|
|
7
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
// furnished to do so, subject to the following conditions:
|
|
10
|
-
//
|
|
11
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
// copies or substantial portions of the Software.
|
|
13
|
-
//
|
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
// SOFTWARE.
|
|
21
|
-
//---------------------------------------------------
|
|
22
|
-
|
|
23
|
-
@use '../theme';
|
|
24
|
-
@use '../tools';
|
|
25
|
-
@use 'sass:map';
|
|
26
|
-
@use 'sass:list';
|
|
27
|
-
@use 'typography-utils' as util;
|
|
28
|
-
@use 'typography-validators' as validator;
|
|
29
|
-
|
|
30
|
-
/// Base mixin for apply() and bind()
|
|
31
|
-
/// @access private
|
|
32
|
-
@mixin _base($component, $theme, $settings: ()) {
|
|
33
|
-
$_init-settings: ('intent': create);
|
|
34
|
-
$_settings: map.merge($_init-settings, $settings);
|
|
35
|
-
|
|
36
|
-
/// @type string
|
|
37
|
-
$intent: map.get($_settings, 'intent');
|
|
38
|
-
|
|
39
|
-
$family: theme.theme-get($theme, 'family');
|
|
40
|
-
$size: theme.theme-get($theme, 'size');
|
|
41
|
-
$weight: theme.theme-get($theme, 'weight');
|
|
42
|
-
$line-height: theme.theme-get($theme, 'line-height');
|
|
43
|
-
|
|
44
|
-
@if tools.is-type($theme, 'map', $custom-error: '$theme is expecting a map. Map was not given.') {
|
|
45
|
-
@include validator.validate-typography-props(map.keys($theme)) {
|
|
46
|
-
@if $family {
|
|
47
|
-
@include util.family($component, $family, $intent);
|
|
48
|
-
}
|
|
49
|
-
@if $size {
|
|
50
|
-
@include util.size($component, $size, $intent);
|
|
51
|
-
}
|
|
52
|
-
@if $weight {
|
|
53
|
-
@include util.weight($component, $weight, $intent);
|
|
54
|
-
}
|
|
55
|
-
@if $line-height {
|
|
56
|
-
@include util.line-height($component, $line-height, $intent);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/// Mixin that applies typography styles to a component.
|
|
63
|
-
/// @param {string} $component
|
|
64
|
-
/// @param {map<string, string>} $theme
|
|
65
|
-
/// @return {void} void.
|
|
66
|
-
@mixin apply($component, $theme) {
|
|
67
|
-
@include _base($component, $theme);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/// Mixin that binds typography styles to a component with existing keys.
|
|
71
|
-
/// @param {string} $component
|
|
72
|
-
/// @param {map<string, string>} $theme
|
|
73
|
-
/// @return {void} void.
|
|
74
|
-
@mixin bind($component, $theme) {
|
|
75
|
-
@include _base($component, $theme, (
|
|
76
|
-
'intent': bind
|
|
77
|
-
));
|
|
78
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
//---------------------------------------------------
|
|
2
|
-
// Copyright (c) 2024 MatteuSan
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
// in the Software without restriction, including without limitation the rights
|
|
7
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
// furnished to do so, subject to the following conditions:
|
|
10
|
-
//
|
|
11
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
// copies or substantial portions of the Software.
|
|
13
|
-
//
|
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
// SOFTWARE.
|
|
21
|
-
//---------------------------------------------------
|
|
22
|
-
|
|
23
|
-
@use '../theme';
|
|
24
|
-
@use '../tokens' as token;
|
|
25
|
-
|
|
26
|
-
/// Mixin for applying font family.
|
|
27
|
-
/// @param {string} $component
|
|
28
|
-
/// @param {string} $family
|
|
29
|
-
/// @param {string} $intent
|
|
30
|
-
/// @return {void} font family styles.
|
|
31
|
-
@mixin family($component, $family, $intent: 'create') {
|
|
32
|
-
@include theme.property(
|
|
33
|
-
font-family,
|
|
34
|
-
('#{$component}-family', theme.token-switch('family-#{$family}', token.primitive-token-switch('family.#{$family}', $family))),
|
|
35
|
-
$intent
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/// Mixin for applying font size.
|
|
40
|
-
/// @param {string} $component
|
|
41
|
-
/// @param {string} $size
|
|
42
|
-
/// @param {string} $intent
|
|
43
|
-
/// @return {void} font size styles.
|
|
44
|
-
@mixin size($component, $size, $intent: 'create') {
|
|
45
|
-
@include theme.property(
|
|
46
|
-
font-size,
|
|
47
|
-
('#{$component}-size', theme.token-switch('size-#{$size}', token.primitive-token-switch('size.#{$size}', $size))),
|
|
48
|
-
$intent
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/// Mixin for applying font weight.
|
|
53
|
-
/// @param {string} $component
|
|
54
|
-
/// @param {string} $weight
|
|
55
|
-
/// @param {string} $intent
|
|
56
|
-
/// @return {void} font weight styles.
|
|
57
|
-
@mixin weight($component, $weight, $intent: 'create') {
|
|
58
|
-
@include theme.property(
|
|
59
|
-
font-weight,
|
|
60
|
-
('#{$component}-weight', theme.token-switch('weight-#{$weight}', token.primitive-token-switch('weight.#{$weight}', $weight))),
|
|
61
|
-
$intent
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/// Mixin for applying line height.
|
|
66
|
-
/// @param {string} $component
|
|
67
|
-
/// @param {string} $line-height
|
|
68
|
-
/// @param {string} $intent
|
|
69
|
-
/// @return {void} line height styles.
|
|
70
|
-
@mixin line-height($component, $line-height, $intent: 'create') {
|
|
71
|
-
@include theme.property(
|
|
72
|
-
line-height,
|
|
73
|
-
('#{$component}-line-height', theme.token-switch('line-height-#{$line-height}', token.primitive-token-switch('line-height.#{$line-height}', $line-height))),
|
|
74
|
-
$intent
|
|
75
|
-
);
|
|
76
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
//---------------------------------------------------
|
|
2
|
-
// Copyright (c) 2024 MatteuSan
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
// in the Software without restriction, including without limitation the rights
|
|
7
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
// furnished to do so, subject to the following conditions:
|
|
10
|
-
//
|
|
11
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
// copies or substantial portions of the Software.
|
|
13
|
-
//
|
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
// SOFTWARE.
|
|
21
|
-
//---------------------------------------------------
|
|
22
|
-
|
|
23
|
-
@use 'sass:list';
|
|
24
|
-
|
|
25
|
-
/// Valid component props
|
|
26
|
-
/// @access private
|
|
27
|
-
$_valid-props: ('family', 'size', 'weight', 'line-height');
|
|
28
|
-
|
|
29
|
-
/// Validates a set of typography props.
|
|
30
|
-
/// @param {map} $props
|
|
31
|
-
/// @access protected
|
|
32
|
-
@mixin validate-typography-props($props) {
|
|
33
|
-
@each $prop in $props {
|
|
34
|
-
@if _is-typography-prop($prop) {
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
@content;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/// Validates a typography prop.
|
|
41
|
-
/// @access private
|
|
42
|
-
@function _is-typography-prop($query) {
|
|
43
|
-
@if not list.index($_valid-props, $query) {
|
|
44
|
-
@error 'Invalid/unrecognized prop: #{$query}. Please use one of the following props: #{$_valid-props}.'
|
|
45
|
-
}
|
|
46
|
-
@return true;
|
|
47
|
-
}
|