1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | require('./miscellaneous.js');
|
6 | var environment = require('./environment.js');
|
7 |
|
8 |
|
9 |
|
10 | var DEFAULT_FONT_FAMILY = 'aragon-ui';
|
11 | var MONOSPACE_FONT_FAMILY = 'aragon-ui-monospace';
|
12 | var monospace = function monospace() {
|
13 | return "\n font-family: ".concat(MONOSPACE_FONT_FAMILY, ", monospace;\n");
|
14 | };
|
15 | var FONT_SIZES = {
|
16 | xxsmall: '11px',
|
17 | xsmall: '12px',
|
18 | small: '14px',
|
19 | normal: '15px',
|
20 | large: '16px',
|
21 | xlarge: '20px',
|
22 | xxlarge: '22px',
|
23 | great: '37px'
|
24 | };
|
25 | var FONT_WEIGHTS = {
|
26 | normal: '400',
|
27 | bold: '600',
|
28 | bolder: '800'
|
29 | };
|
30 |
|
31 | var fontSizeCss = function fontSizeCss(size) {
|
32 | var fontSize = FONT_SIZES[size];
|
33 | return fontSize !== undefined ? "\n line-height: 1.5;\n font-size: ".concat(fontSize, "\n ") : '';
|
34 | };
|
35 |
|
36 | var weightCss = function weightCss(weight) {
|
37 | var fontWeight = FONT_WEIGHTS[weight];
|
38 | return fontWeight !== undefined ? "font-weight: ".concat(fontWeight) : '';
|
39 | };
|
40 |
|
41 | var smallcapsCss = function smallcapsCss(smallcaps) {
|
42 | return smallcaps ? "\n text-transform: lowercase;\n font-variant: small-caps;\n " : '';
|
43 | };
|
44 |
|
45 | var monospaceCss = function monospaceCss(monospace) {
|
46 | return monospace ? "\n font-family: ".concat(MONOSPACE_FONT_FAMILY, ", monospace;\n ") : '';
|
47 | };
|
48 |
|
49 | function font(_ref) {
|
50 | var size = _ref.size,
|
51 | weight = _ref.weight,
|
52 | _ref$smallcaps = _ref.smallcaps,
|
53 | smallcaps = _ref$smallcaps === void 0 ? false : _ref$smallcaps,
|
54 | _ref$monospace = _ref.monospace,
|
55 | monospace = _ref$monospace === void 0 ? false : _ref$monospace,
|
56 | _ref$deprecationNotic = _ref.deprecationNotice,
|
57 | deprecationNotice = _ref$deprecationNotic === void 0 ? true : _ref$deprecationNotic;
|
58 |
|
59 | if (deprecationNotice) {
|
60 | environment.warnOnce('font()', 'font() is deprecated. Please use textStyle() instead.');
|
61 | }
|
62 |
|
63 | return "\n ".concat(fontSizeCss(size), ";\n ").concat(weightCss(weight), ";\n ").concat(smallcapsCss(smallcaps), ";\n ").concat(monospaceCss(monospace), ";\n ");
|
64 | }
|
65 |
|
66 | exports.DEFAULT_FONT_FAMILY = DEFAULT_FONT_FAMILY;
|
67 | exports.MONOSPACE_FONT_FAMILY = MONOSPACE_FONT_FAMILY;
|
68 | exports.font = font;
|
69 | exports.monospace = monospace;
|
70 |
|