@carbon/styles 0.10.0 → 0.12.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.
@@ -0,0 +1,174 @@
1
+ //
2
+ // Copyright IBM Corp. 2018, 2018
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @use '../config';
9
+ @use 'sass:list';
10
+ @use 'sass:map';
11
+ @use 'sass:meta';
12
+
13
+ $-filenames: (
14
+ IBM-Plex-Mono: 'IBMPlexMono',
15
+ IBM-Plex-Sans-Arabic: 'IBMPlexSansArabic',
16
+ IBM-Plex-Sans-Devanagari: 'IBMPlexSansDevanagari',
17
+ IBM-Plex-Sans-Hebrew: 'IBMPlexSansHebrew',
18
+ IBM-Plex-Sans-Thai-Looped: 'IBMPlexSansThaiLooped',
19
+ IBM-Plex-Sans-Thai: 'IBMPlexSansThai',
20
+ IBM-Plex-Sans: 'IBMPlexSans',
21
+ IBM-Plex-Serif: 'IBMPlexSerif',
22
+ );
23
+
24
+ $-google-filenames: (
25
+ IBM-Plex-Mono: (
26
+ name: 'ibmplexmono',
27
+ version: 'v7',
28
+ hash: '-F63fjptAgt5VM-kVkqdyU8n1i8q131nj-otFQ',
29
+ ),
30
+ IBM-Plex-Sans-Arabic: (
31
+ name: 'ibmplexsansarabic',
32
+ version: 'v5',
33
+ hash: 'Qw3CZRtWPQCuHme67tEYUIx3Kh0PHR9N6Ys43PW5fslBEg0',
34
+ ),
35
+ IBM-Plex-Sans-Devanagari: (
36
+ name: 'ibmplexsansdevanagari',
37
+ version: 'v5',
38
+ hash: 'XRXH3JCMvG4IDoS9SubXB6W-UX5iehIMBFR2-O_PX0j1Uc7wCWQq',
39
+ ),
40
+ IBM-Plex-Sans-Hebrew: (
41
+ name: 'ibmplexsanshebrew',
42
+ version: 'v5',
43
+ hash: 'BCa2qYENg9Kw1mpLpO0bGM5lfHAAZHhDXE2v-lgVrjaNzC4',
44
+ ),
45
+ IBM-Plex-Sans-Thai-Looped: (
46
+ name: 'ibmplexsansthailooped',
47
+ version: 'v5',
48
+ hash: 'tss_AoJJRAhL3BTrK3r2xxbFhvKfyBB6l7hHT30L9BiKoXOrFCUb6Q',
49
+ ),
50
+ IBM-Plex-Sans-Thai: (
51
+ name: 'ibmplexsansthai',
52
+ version: 'v5',
53
+ hash: 'm8JPje1VVIzcq1HzJq2AEdo2Tj_qvLqMBNYgR8BKU4cX',
54
+ ),
55
+ IBM-Plex-Sans: (
56
+ name: 'ibmplexsans',
57
+ version: 'v9',
58
+ hash: 'zYXgKVElMYYaJe8bpLHnCwDKhdzeFaxOedfTDw',
59
+ ),
60
+ IBM-Plex-Serif: (
61
+ name: 'ibmplexserif',
62
+ version: 'v10',
63
+ hash: 'jizDREVNn1dOx-zrZ2X3pZvkTiUS2zcZiVbJsNo',
64
+ ),
65
+ );
66
+
67
+ @function -get-google-filename($map, $keys...) {
68
+ @each $key in $keys {
69
+ $map: map-get($map, $key);
70
+ }
71
+
72
+ @return $map;
73
+ }
74
+
75
+ @function -get-base-filename($name) {
76
+ @return map.get($-filenames, $name);
77
+ }
78
+
79
+ /// The default resolver for locating a font file in the `@ibm/plex` package.
80
+ /// This function will return a path that will work in bundling tools like
81
+ /// webpack but will not work without a tool that understands paths that are
82
+ /// prefixed with `~`
83
+ ///
84
+ /// @param {String} $name
85
+ /// @param {String} $weight
86
+ /// @param {String} $style
87
+ /// @param {String} $unicode-range
88
+ /// @param {List} $formats
89
+ /// @returns List
90
+ @function -default-resolver($name, $weight, $style, $unicode-range, $formats) {
91
+ @if (config.$use-google-fonts) {
92
+ $filename: -get-google-filename($-google-filenames, $name, 'name');
93
+ $version: -get-google-filename($-google-filenames, $name, 'version');
94
+ $hash: -get-google-filename($-google-filenames, $name, 'hash');
95
+
96
+ $filenames: ();
97
+
98
+ @each $format in $formats {
99
+ $url: 'https://fonts.gstatic.com/s/#{$filename}/#{$version}/#{$hash}';
100
+
101
+ // Add extension
102
+ $url: '#{$url}.#{$format}';
103
+ $filenames: list.append(
104
+ $filenames,
105
+ url('#{$url}') format('#{$format}'),
106
+ $separator: comma
107
+ );
108
+ }
109
+
110
+ @return $filenames;
111
+ } @else {
112
+ $filename: -get-base-filename($name);
113
+
114
+ // Special case for weight = Regular (400)
115
+ @if $weight == Regular {
116
+ @if $style == italic {
117
+ $filename: '#{$filename}-Italic';
118
+ } @else {
119
+ $filename: '#{$filename}-Regular';
120
+ }
121
+ } @else {
122
+ // Otherwise add weight + optional style (italic)
123
+ $filename: '#{$filename}-#{$weight}';
124
+ @if $style == italic {
125
+ $filename: '#{$filename}Italic';
126
+ }
127
+ }
128
+
129
+ $filenames: ();
130
+
131
+ @each $format in $formats {
132
+ $url: $filename;
133
+ @if $unicode-range {
134
+ $url: '#{config.$font-path}/#{$name}/fonts/split/#{$format}/#{$filename}-#{$unicode-range}';
135
+ } @else {
136
+ $url: '#{config.$font-path}/#{$name}/fonts/complete/#{$format}/#{$filename}';
137
+ }
138
+
139
+ // Add extension
140
+ $url: '#{$url}.#{$format}';
141
+ $filenames: list.append(
142
+ $filenames,
143
+ url('#{$url}') format('#{$format}'),
144
+ $separator: comma
145
+ );
146
+ }
147
+
148
+ @return $filenames;
149
+ }
150
+ }
151
+
152
+ /// The resolver used for locating the filepaths in `url() format()` values in
153
+ /// @font-face blocks
154
+ $resolver: meta.get-function('-default-resolver') !default;
155
+
156
+ /// Retrieve the list of `url() format()` values used in the `src` property in
157
+ /// an `@font-face` block
158
+
159
+ /// @param {String} $name
160
+ /// @param {String} $weight
161
+ /// @param {String} $style
162
+ /// @param {String} $unicode-range
163
+ /// @param {List} $formats
164
+ /// @returns List
165
+ @function get($name, $weight, $style, $unicode-range: null, $formats) {
166
+ @return meta.call(
167
+ $resolver,
168
+ $name: $name,
169
+ $weight: $weight,
170
+ $style: $style,
171
+ $unicode-range: $unicode-range,
172
+ $formats: $formats
173
+ );
174
+ }
@@ -0,0 +1,124 @@
1
+ //
2
+ // Copyright IBM Corp. 2018, 2018
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @use 'sass:map';
9
+
10
+ /// All available unicode ranges where the keys are unicode range names and the
11
+ /// value is the list of unicode ranges that are applicable
12
+ /// @type {List}
13
+ $ranges: (
14
+ Cyrillic: (
15
+ 'U+0400-045F',
16
+ 'U+0472-0473',
17
+ 'U+0490-049D',
18
+ 'U+04A0-04A5',
19
+ 'U+04AA-04AB',
20
+ 'U+04AE-04B3',
21
+ 'U+04B6-04BB',
22
+ 'U+04C0-04C2',
23
+ 'U+04CF-04D9',
24
+ 'U+04DC-04DF',
25
+ 'U+04E2-04E9',
26
+ 'U+04EE-04F5',
27
+ 'U+04F8-04F9',
28
+ ),
29
+ Greek: (
30
+ 'U+0384-038A',
31
+ 'U+038C',
32
+ 'U+038E-03A1',
33
+ 'U+03A3-03CE',
34
+ ),
35
+ Latin1: (
36
+ 'U+0000',
37
+ 'U+000D',
38
+ 'U+0020-007E',
39
+ 'U+00A0-00A3',
40
+ 'U+00A4-00FF',
41
+ 'U+0131',
42
+ 'U+0152-0153',
43
+ 'U+02C6',
44
+ 'U+02DA',
45
+ 'U+02DC',
46
+ 'U+2013-2014',
47
+ 'U+2018-201A',
48
+ 'U+201C-201E',
49
+ 'U+2020-2022',
50
+ 'U+2026',
51
+ 'U+2030',
52
+ 'U+2039-203A',
53
+ 'U+2044',
54
+ 'U+2074',
55
+ 'U+20AC',
56
+ 'U+2122',
57
+ 'U+2212',
58
+ 'U+FB01-FB02',
59
+ ),
60
+ Latin2: (
61
+ 'U+0100-024F',
62
+ 'U+0259',
63
+ 'U+1E00-1EFF',
64
+ 'U+20A0-20AB',
65
+ 'U+20AD-20CF',
66
+ 'U+2C60-2C7F',
67
+ 'U+A720-A7FF',
68
+ 'U+FB01-FB02',
69
+ ),
70
+ Latin3: (
71
+ 'U+0102-0103',
72
+ 'U+1EA0-1EF9',
73
+ 'U+20AB',
74
+ ),
75
+ Pi: (
76
+ 'U+0E3F',
77
+ 'U+2032-2033',
78
+ 'U+2070',
79
+ 'U+2075-2079',
80
+ 'U+2080-2081',
81
+ 'U+2083',
82
+ 'U+2085-2089',
83
+ 'U+2113',
84
+ 'U+2116',
85
+ 'U+2126',
86
+ 'U+212E',
87
+ 'U+2150-2151',
88
+ 'U+2153-215E',
89
+ 'U+2190-2199',
90
+ 'U+21A9-21AA',
91
+ 'U+21B0-21B3',
92
+ 'U+21B6-21B7',
93
+ 'U+21BA-21BB',
94
+ 'U+21C4',
95
+ 'U+21C6',
96
+ 'U+2202',
97
+ 'U+2206',
98
+ 'U+220F',
99
+ 'U+2211',
100
+ 'U+221A',
101
+ 'U+221E',
102
+ 'U+222B',
103
+ 'U+2248',
104
+ 'U+2260',
105
+ 'U+2264-2265',
106
+ 'U+25CA',
107
+ 'U+2713',
108
+ 'U+274C',
109
+ 'U+2B0E-2B11',
110
+ 'U+EBE1-EBE7',
111
+ 'U+ECE0',
112
+ 'U+EFCC',
113
+ ),
114
+ );
115
+
116
+ /// Retrieve the unicode range for a given unicode range name
117
+ /// @param {String} $name
118
+ /// @returns {List}
119
+ @function get-range($name) {
120
+ @if map.has-key($ranges, $name) {
121
+ @return map.get($ranges, $name);
122
+ }
123
+ @error 'Unable to find range with the name: #{$name}';
124
+ }
@@ -1,13 +0,0 @@
1
- @use 'config';
2
- @use '@ibm/plex/default' as sans;
3
- @use '@ibm/plex/mono' as mono;
4
- @use '@ibm/plex/arabic' as arabic;
5
-
6
- @if config.$css--font-face == true {
7
- @include sans.all;
8
- @include mono.all;
9
-
10
- @if config.$css--plex-arabic == true {
11
- @include arabic.all;
12
- }
13
- } ;
@@ -1,38 +0,0 @@
1
- //
2
- // Copyright IBM Corp. 2021
3
- //
4
- // This source code is licensed under the Apache-2.0 license found in the
5
- // LICENSE file in the root directory of this source tree.
6
- //
7
-
8
- @use 'sass:list';
9
- @use 'sass:meta';
10
- @use '../config' as *;
11
- @use './custom-property';
12
-
13
- /// Define a map of layer sets, each set should have values for each layer in
14
- /// the application. The key of this map is used for the CSS Custom Property
15
- /// name whose value is updated as more layers are added.
16
- /// @type {Map}
17
- $layer-sets: () !default;
18
-
19
- /// Emit the layer tokens defined in $layer-sets for the given $level
20
- /// @param {Number} $level
21
- @mixin -emit-layer-tokens($level) {
22
- @each $key, $layer-set in $layer-sets {
23
- $value: list.nth($layer-set, $level);
24
- @include custom-property.declaration($key, $value);
25
- }
26
- }
27
-
28
- :root {
29
- @include -emit-layer-tokens(1);
30
- }
31
-
32
- .#{$prefix}--layer {
33
- @include -emit-layer-tokens(2);
34
-
35
- .#{$prefix}--layer {
36
- @include -emit-layer-tokens(3);
37
- }
38
- }