vaadin-material-stylespackage.typography.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vaadin-webcomponents Show documentation
Show all versions of vaadin-webcomponents Show documentation
Mvnpm composite: Vaadin webcomponents
The newest version!
/**
* @license
* Copyright (c) 2017 - 2024 Vaadin Ltd.
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
*/
import './version.js';
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { addMaterialGlobalStyles } from './global.js';
const font = css`
:host {
/* Font family */
--material-font-family: 'Roboto', sans-serif;
/* Font sizes */
--material-h1-font-size: 6rem;
--material-h2-font-size: 3.75rem;
--material-h3-font-size: 3rem;
--material-h4-font-size: 2.125rem;
--material-h5-font-size: 1.5rem;
--material-h6-font-size: 1.25rem;
--material-body-font-size: 1rem;
--material-small-font-size: 0.875rem;
--material-button-font-size: 0.875rem;
--material-caption-font-size: 0.75rem;
/* Icon size */
--material-icon-font-size: 20px;
}
`;
const typography = css`
body,
:host {
font-family: var(--material-font-family);
font-size: var(--material-body-font-size);
line-height: 1.4;
-webkit-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: inherit;
line-height: 1.1;
margin-top: 1.5em;
}
h1 {
font-size: var(--material-h3-font-size);
font-weight: 300;
letter-spacing: -0.015em;
margin-bottom: 1em;
text-indent: -0.07em;
}
h2 {
font-size: var(--material-h4-font-size);
font-weight: 300;
letter-spacing: -0.01em;
margin-bottom: 0.75em;
text-indent: -0.07em;
}
h3 {
font-size: var(--material-h5-font-size);
font-weight: 400;
margin-bottom: 0.75em;
text-indent: -0.05em;
}
h4 {
font-size: var(--material-h6-font-size);
font-weight: 400;
letter-spacing: 0.01em;
margin-bottom: 0.75em;
text-indent: -0.05em;
}
h5 {
font-size: var(--material-body-font-size);
font-weight: 500;
margin-bottom: 0.5em;
text-indent: -0.025em;
}
h6 {
font-size: var(--material-small-font-size);
font-weight: 500;
letter-spacing: 0.01em;
margin-bottom: 0.25em;
text-indent: -0.025em;
}
a,
b,
strong {
font-weight: 500;
}
`;
registerStyles('', typography, { moduleId: 'material-typography' });
addMaterialGlobalStyles('font', font);
export { font, typography };
/* Import Roboto from Google Fonts */
if (!window.polymerSkipLoadingFontRoboto) {
/* prettier-ignore */
const font = 'https://fonts.googleapis.com/css?family=Roboto+Mono:400,700|Roboto:400,300,300italic,400italic,500,500italic,700,700italic';
const link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.crossOrigin = 'anonymous';
link.href = font;
document.head.appendChild(link);
}