UNPKG

5.33 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', { value: true });
4
5function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
7require('./slicedToArray-ef426d0f.js');
8require('./unsupportedIterableToArray-8a00e599.js');
9var React = require('react');
10var React__default = _interopDefault(React);
11require('./_commonjsHelpers-72d386ba.js');
12var index = require('./index-b0606964.js');
13require('./defineProperty-0921a47c.js');
14require('./toConsumableArray-7f36359f.js');
15var _styled = require('styled-components');
16var _styled__default = _interopDefault(_styled);
17require('./getPrototypeOf-e2d1e599.js');
18require('./color.js');
19require('./components.js');
20require('./contains-component.js');
21require('./css.js');
22require('./dayjs.min-aa59a48e.js');
23require('./date.js');
24require('./miscellaneous.js');
25require('./environment.js');
26var font = require('./font.js');
27require('./math-ecfd5d91.js');
28require('./characters.js');
29require('./format.js');
30require('./keycodes.js');
31require('./url.js');
32require('./web3.js');
33require('./constants.js');
34require('./breakpoints.js');
35require('./springs.js');
36var textStyles = require('./text-styles.js');
37require('./theme-dark.js');
38require('./theme-light.js');
39var Theme = require('./Theme.js');
40var _extends$1 = require('./extends-40571110.js');
41require('./getDisplayName-7ab6d318.js');
42var index$2 = require('./index-2b9f03ad.js');
43var taggedTemplateLiteral = require('./taggedTemplateLiteral-227ed122.js');
44
45var overpassLightWoff2 = "cf790334a5a6d45c.woff2";
46
47var overpassRegularWoff2 = "32a3f11e7740ce58.woff2";
48
49var overpassSemiBoldWoff2 = "5cfe62515c2f9b42.woff2";
50
51var overpassMonoLightWoff2 = "3dd21d4f0d28fecb.woff2";
52
53function _templateObject() {
54 var data = taggedTemplateLiteral._taggedTemplateLiteral(["\n\n // @font-face declarations\n ", "\n\n *, *:before, *:after {\n box-sizing: border-box;\n }\n html {\n -webkit-overflow-scrolling: touch;\n }\n body {\n height: 0;\n min-height: 100vh;\n color: ", ";\n background: ", ";\n font-family: ", ";\n ", ";\n }\n html, body {\n overflow: hidden;\n }\n body, ul, p, h1, h2, h3, h4, h5, h6 {\n margin: 0;\n padding: 0;\n }\n button, select, input, textarea, h1, h2, h3, h4, h5, h6 {\n font-size: inherit;\n font-family: inherit;\n font-weight: inherit;\n line-height: inherit;\n }\n a, button, select, input, textarea {\n color: inherit;\n }\n strong, b {\n font-weight: 600;\n }\n ::selection {\n background: ", ";\n color: ", ";\n }\n"]);
55
56 _templateObject = function _templateObject() {
57 return data;
58 };
59
60 return data;
61}
62var DEFAULT_FONTS = {
63 '400': {
64 url: overpassLightWoff2,
65 format: 'woff2'
66 },
67 '600': {
68 url: overpassRegularWoff2,
69 format: 'woff2'
70 },
71 '800': {
72 url: overpassSemiBoldWoff2,
73 format: 'woff2'
74 }
75};
76var MONOSPACE_FONTS = {
77 '400': {
78 url: overpassMonoLightWoff2,
79 format: 'woff2'
80 }
81};
82
83function fontSrc(publicUrl, _ref) {
84 var url = _ref.url,
85 format = _ref.format;
86 return "url(".concat(publicUrl + url, ") format('").concat(format, "')");
87}
88
89function fontFaceDeclarations(_ref2) {
90 var fontFamily = _ref2.fontFamily,
91 publicUrl = _ref2.publicUrl;
92
93 // No need to declare the font faces if the font family has changed.
94 if (fontFamily !== BaseStyles.defaultProps.fontFamily) {
95 return '';
96 }
97
98 return "\n @font-face {\n font-family: ".concat(font.DEFAULT_FONT_FAMILY, ";\n src: ").concat(fontSrc(publicUrl, DEFAULT_FONTS['400']), ";\n font-weight: 400;\n font-style: normal;\n }\n @font-face {\n font-family: ").concat(font.DEFAULT_FONT_FAMILY, ";\n src: ").concat(fontSrc(publicUrl, DEFAULT_FONTS['600']), ";\n font-weight: 600;\n font-style: normal;\n }\n @font-face {\n font-family: ").concat(font.DEFAULT_FONT_FAMILY, ";\n src: ").concat(fontSrc(publicUrl, DEFAULT_FONTS['800']), ";\n font-weight: 800;\n font-style: normal;\n }\n @font-face {\n font-family: ").concat(font.MONOSPACE_FONT_FAMILY, ";\n src: ").concat(fontSrc(publicUrl, MONOSPACE_FONTS['400']), ";\n font-weight: 400;\n font-style: normal;\n }\n ");
99}
100
101var BaseStyles = /*#__PURE__*/React__default.memo(function BaseStyles(props) {
102 var theme = Theme.useTheme();
103 return /*#__PURE__*/React__default.createElement(GlobalStyle, _extends$1._extends({}, props, {
104 theme: theme,
105 fontFaces: fontFaceDeclarations(props),
106 textStyleCss: textStyles.textStyle('body2')
107 }));
108});
109BaseStyles.propTypes = {
110 publicUrl: index.PropTypes.string,
111 fontFamily: index.PropTypes.string
112};
113BaseStyles.defaultProps = {
114 publicUrl: '/',
115 fontFamily: "".concat(font.DEFAULT_FONT_FAMILY, ", sans-serif")
116};
117var GlobalStyle = _styled.createGlobalStyle(_templateObject(), function (p) {
118 return p.fontFaces ? p.fontFaces : '';
119}, function (p) {
120 return p.theme.content;
121}, function (p) {
122 return p.theme.background;
123}, function (p) {
124 return p.fontFamily;
125}, function (p) {
126 return p.textStyleCss;
127}, function (p) {
128 return p.theme.selected;
129}, function (p) {
130 return p.theme.selectedContent;
131});
132var BaseStyles$1 = index$2.PublicUrl.hocWrap(BaseStyles);
133
134exports.default = BaseStyles$1;
135//# sourceMappingURL=BaseStyles.js.map