@expo/styleguide 3.4.0 → 3.4.2-alpha.2

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,349 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.typography = void 0;
4
+ const themes_1 = require("./themes");
5
+ const sizing_1 = require("./sizing");
6
+ const spacing_1 = require("./spacing");
7
+ const breakpoints_1 = require("./breakpoints");
8
+ const baseFontSize = 16;
9
+ function round(value) {
10
+ return value
11
+ .toFixed(7)
12
+ .replace(/(\.[0-9]+?)0+$/, '$1') // remove trailing zeroes after decimals
13
+ .replace(/\.0$/, ''); // remove any remaining zeroes
14
+ }
15
+ function rem(px) {
16
+ return `${round(px / baseFontSize)}rem`;
17
+ }
18
+ const fontFaces = {
19
+ black: 'Inter-Black',
20
+ semiBold: 'Inter-SemiBold',
21
+ medium: 'Inter-Medium',
22
+ regular: 'Inter-Regular',
23
+ mono: 'Menlo-Regular',
24
+ };
25
+ const defaultFontStack = "system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,'Noto Sans',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji'";
26
+ const defaultMonoStack = "Monaco,Consolas,'Liberation Mono','Courier New',monospace, 'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji'";
27
+ const fontStacks = {
28
+ black: `${fontFaces.black}, ${defaultFontStack}`,
29
+ semiBold: `${fontFaces.semiBold}, ${defaultFontStack}`,
30
+ medium: `${fontFaces.medium}, ${defaultFontStack}`,
31
+ regular: `${fontFaces.regular}, ${defaultFontStack}`,
32
+ mono: `${fontFaces.mono}, ${defaultMonoStack}`,
33
+ };
34
+ const fontSizes = {
35
+ 61: {
36
+ fontSize: rem(61),
37
+ lineHeight: round(73 / 61),
38
+ letterSpacing: rem(-0.022 * baseFontSize),
39
+ },
40
+ 53: {
41
+ fontSize: rem(53),
42
+ lineHeight: round(64 / 53),
43
+ letterSpacing: rem(-0.022 * baseFontSize),
44
+ },
45
+ 49: {
46
+ fontSize: rem(49),
47
+ lineHeight: round(59 / 49),
48
+ letterSpacing: rem(-0.022 * baseFontSize),
49
+ },
50
+ 46: {
51
+ fontSize: rem(46),
52
+ lineHeight: round(55 / 46),
53
+ letterSpacing: rem(-0.022 * baseFontSize),
54
+ },
55
+ 43: {
56
+ fontSize: rem(43),
57
+ lineHeight: round(52 / 43),
58
+ letterSpacing: rem(-0.022 * baseFontSize),
59
+ },
60
+ 39: {
61
+ fontSize: rem(39),
62
+ lineHeight: round(51 / 39),
63
+ letterSpacing: rem(-0.022 * baseFontSize),
64
+ },
65
+ 37: {
66
+ fontSize: rem(37),
67
+ lineHeight: round(48 / 37),
68
+ letterSpacing: rem(-0.022 * baseFontSize),
69
+ },
70
+ 34: {
71
+ fontSize: rem(34),
72
+ lineHeight: round(44 / 34),
73
+ letterSpacing: rem(-0.022 * baseFontSize),
74
+ },
75
+ 31: {
76
+ fontSize: rem(31),
77
+ lineHeight: round(40 / 31),
78
+ letterSpacing: rem(-0.021 * baseFontSize),
79
+ },
80
+ 29: {
81
+ fontSize: rem(29),
82
+ lineHeight: round(38 / 29),
83
+ letterSpacing: rem(-0.021 * baseFontSize),
84
+ },
85
+ 27: {
86
+ fontSize: rem(27),
87
+ lineHeight: round(36 / 27),
88
+ letterSpacing: rem(-0.021 * baseFontSize),
89
+ },
90
+ 25: {
91
+ fontSize: rem(25),
92
+ lineHeight: round(35 / 25),
93
+ letterSpacing: rem(-0.021 * baseFontSize),
94
+ },
95
+ 23: {
96
+ fontSize: rem(23),
97
+ lineHeight: round(32 / 23),
98
+ letterSpacing: rem(-0.019 * baseFontSize),
99
+ },
100
+ 22: {
101
+ fontSize: rem(22),
102
+ lineHeight: round(31 / 22),
103
+ letterSpacing: rem(-0.018 * baseFontSize),
104
+ },
105
+ 20: {
106
+ fontSize: rem(20),
107
+ lineHeight: round(30 / 20),
108
+ letterSpacing: rem(-0.017 * baseFontSize),
109
+ },
110
+ 19: {
111
+ fontSize: rem(19),
112
+ lineHeight: round(29 / 19),
113
+ letterSpacing: rem(-0.015 * baseFontSize),
114
+ },
115
+ 18: {
116
+ fontSize: rem(18),
117
+ lineHeight: round(28 / 18),
118
+ letterSpacing: rem(-0.014 * baseFontSize),
119
+ },
120
+ 16: {
121
+ fontSize: rem(16),
122
+ lineHeight: round(26 / 16),
123
+ letterSpacing: rem(-0.011 * baseFontSize),
124
+ },
125
+ 15: {
126
+ fontSize: rem(15),
127
+ lineHeight: round(24 / 15),
128
+ letterSpacing: rem(-0.009 * baseFontSize),
129
+ },
130
+ 14: {
131
+ fontSize: rem(14),
132
+ lineHeight: round(22 / 14),
133
+ letterSpacing: rem(-0.006 * baseFontSize),
134
+ },
135
+ 13: {
136
+ fontSize: rem(13),
137
+ lineHeight: round(21 / 13),
138
+ letterSpacing: rem(-0.003 * baseFontSize),
139
+ },
140
+ 12: { fontSize: rem(12), lineHeight: round(19 / 12) },
141
+ };
142
+ const headers = {
143
+ huge: {
144
+ fontFamily: fontStacks.black,
145
+ fontWeight: 900,
146
+ ...fontSizes[61],
147
+ [`@media (max-width: ${breakpoints_1.breakpoints.medium}px)`]: fontSizes[53],
148
+ [`@media (max-width: ${breakpoints_1.breakpoints.small}px`]: fontSizes[46],
149
+ },
150
+ h1: {
151
+ fontFamily: fontStacks.semiBold,
152
+ fontWeight: 500,
153
+ ...fontSizes[49],
154
+ [`@media (max-width: ${breakpoints_1.breakpoints.medium}px)`]: fontSizes[43],
155
+ [`@media (max-width: ${breakpoints_1.breakpoints.small}px)`]: fontSizes[37],
156
+ },
157
+ h2: {
158
+ fontFamily: fontStacks.semiBold,
159
+ fontWeight: 500,
160
+ ...fontSizes[39],
161
+ [`@media (max-width: ${breakpoints_1.breakpoints.medium}px)`]: fontSizes[34],
162
+ [`@media (max-width: ${breakpoints_1.breakpoints.small}px)`]: fontSizes[29],
163
+ },
164
+ h3: {
165
+ fontFamily: fontStacks.semiBold,
166
+ fontWeight: 500,
167
+ ...fontSizes[31],
168
+ [`@media (max-width: ${breakpoints_1.breakpoints.medium}px)`]: fontSizes[27],
169
+ [`@media (max-width: ${breakpoints_1.breakpoints.small}px)`]: fontSizes[23],
170
+ },
171
+ h4: {
172
+ fontFamily: fontStacks.medium,
173
+ fontWeight: 500,
174
+ ...fontSizes[25],
175
+ [`@media (max-width: ${breakpoints_1.breakpoints.medium}px)`]: fontSizes[22],
176
+ [`@media (max-width: ${breakpoints_1.breakpoints.small}px)`]: fontSizes[19],
177
+ },
178
+ h5: {
179
+ fontFamily: fontStacks.medium,
180
+ fontWeight: 500,
181
+ ...fontSizes[20],
182
+ [`@media (max-width: ${breakpoints_1.breakpoints.medium}px)`]: fontSizes[18],
183
+ [`@media (max-width: ${breakpoints_1.breakpoints.small}px)`]: fontSizes[16],
184
+ },
185
+ h6: {
186
+ fontFamily: fontStacks.medium,
187
+ fontWeight: 500,
188
+ ...fontSizes[16],
189
+ },
190
+ };
191
+ const baseStyle = {
192
+ fontFamily: fontStacks.regular,
193
+ fontWeight: 400,
194
+ ...fontSizes[16],
195
+ };
196
+ const body = {
197
+ headline: {
198
+ fontFamily: fontStacks.medium,
199
+ fontWeight: 400,
200
+ ...fontSizes[16],
201
+ },
202
+ paragraph: baseStyle,
203
+ label: {
204
+ fontFamily: fontStacks.medium,
205
+ fontWeight: 400,
206
+ ...fontSizes[15],
207
+ },
208
+ callout: {
209
+ fontFamily: fontStacks.regular,
210
+ fontWeight: 400,
211
+ ...fontSizes[14],
212
+ },
213
+ footnote: {
214
+ fontFamily: fontStacks.regular,
215
+ fontWeight: 400,
216
+ ...fontSizes[13],
217
+ },
218
+ caption: {
219
+ fontFamily: fontStacks.regular,
220
+ fontWeight: 400,
221
+ ...fontSizes[12],
222
+ },
223
+ code: {
224
+ fontFamily: fontStacks.mono,
225
+ fontWeight: 400,
226
+ ...fontSizes[13],
227
+ },
228
+ ul: {
229
+ marginLeft: rem(1.5),
230
+ 'ol, ul': {
231
+ marginTop: rem(0.5),
232
+ marginBottom: rem(1),
233
+ },
234
+ },
235
+ ol: {
236
+ marginLeft: rem(1.5),
237
+ 'ol, ul': {
238
+ marginTop: rem(0.5),
239
+ marginBottom: rem(1),
240
+ },
241
+ },
242
+ li: {
243
+ ...baseStyle,
244
+ marginBottom: rem(0.5),
245
+ },
246
+ blockquote: {
247
+ ...baseStyle,
248
+ color: themes_1.theme.text.secondary,
249
+ paddingLeft: spacing_1.spacing[4],
250
+ borderLeft: `${spacing_1.spacing[1]}px solid ${themes_1.theme.border.default}`,
251
+ },
252
+ };
253
+ const utility = {
254
+ anchor: {
255
+ color: themes_1.theme.link.default,
256
+ fontWeight: 400,
257
+ textDecoration: 'none',
258
+ cursor: 'pointer',
259
+ opacity: 1,
260
+ // transform prevents a 1px shift on hover on Safari
261
+ transform: 'translate3d(0,0,0)',
262
+ ':visited': {
263
+ color: themes_1.theme.link.default,
264
+ },
265
+ ':hover': {
266
+ transition: '200ms',
267
+ opacity: 0.8,
268
+ },
269
+ },
270
+ inlineCode: {
271
+ ...body.code,
272
+ fontWeight: 400,
273
+ display: 'inline-block',
274
+ backgroundColor: themes_1.theme.background.secondary,
275
+ border: `1px solid ${themes_1.theme.border.default}`,
276
+ borderRadius: sizing_1.borderRadius.medium,
277
+ padding: '2px 4px',
278
+ lineHeight: '130%',
279
+ },
280
+ terminalCode: {
281
+ ...body.code,
282
+ fontWeight: 400,
283
+ display: 'inline-block',
284
+ backgroundColor: themes_1.darkTheme.background.secondary,
285
+ color: themes_1.darkTheme.text.default,
286
+ border: `1px solid ${themes_1.darkTheme.border.default}`,
287
+ borderRadius: sizing_1.borderRadius.medium,
288
+ padding: '2px 4px',
289
+ lineHeight: '130%',
290
+ },
291
+ pre: {
292
+ ...body.code,
293
+ fontWeight: 400,
294
+ backgroundColor: themes_1.theme.background.secondary,
295
+ borderRadius: sizing_1.borderRadius.medium,
296
+ border: `1px solid ${themes_1.theme.border.default}`,
297
+ padding: spacing_1.spacing[4],
298
+ whiteSpace: 'pre-wrap',
299
+ margin: `${spacing_1.spacing[4]}px 0`,
300
+ },
301
+ terminalPre: {
302
+ ...body.code,
303
+ fontWeight: 400,
304
+ backgroundColor: themes_1.darkTheme.background.secondary,
305
+ color: themes_1.darkTheme.text.default,
306
+ borderRadius: sizing_1.borderRadius.medium,
307
+ border: `1px solid ${themes_1.darkTheme.border.default}`,
308
+ padding: spacing_1.spacing[4],
309
+ margin: `${spacing_1.spacing[4]}px 0`,
310
+ whiteSpace: 'pre-wrap',
311
+ '&:before': {
312
+ content: '"➜ "',
313
+ },
314
+ },
315
+ hr: {
316
+ backgroundColor: themes_1.theme.border.default,
317
+ border: 0,
318
+ height: 1,
319
+ display: 'block',
320
+ width: '100%',
321
+ },
322
+ weight: {
323
+ black: {
324
+ fontFamily: fontStacks.black,
325
+ fontWeight: 900,
326
+ },
327
+ semiBold: {
328
+ fontFamily: fontStacks.semiBold,
329
+ fontWeight: 500,
330
+ },
331
+ medium: {
332
+ fontFamily: fontStacks.medium,
333
+ fontWeight: 500,
334
+ },
335
+ regular: {
336
+ fontFamily: fontStacks.regular,
337
+ fontWeight: 400,
338
+ },
339
+ },
340
+ };
341
+ exports.typography = {
342
+ baseFontSize,
343
+ headers,
344
+ body,
345
+ utility,
346
+ fontFaces,
347
+ fontStacks,
348
+ fontSizes,
349
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/styleguide",
3
- "version": "3.4.0",
3
+ "version": "3.4.2-alpha.2",
4
4
  "description": "Foundational styles for Expo interfaces.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -37,5 +37,5 @@
37
37
  "peerDependencies": {
38
38
  "react": "*"
39
39
  },
40
- "gitHead": "2b6779f5f4cceb8b07a2b5291135478b82100dc6"
40
+ "gitHead": "0cf39bd68ea3c2cd1d69c6ba10b5794b4ad129df"
41
41
  }