layoutcss_parser/
reset.rs1use crate::config::LayoutStyleConfig;
2use indoc::formatdoc;
3pub const RESET_CSS: &str = r#"
9* {
10 margin: 0;
11 padding: 0;
12 box-sizing: border-box;
13}
14
15html {
16 font-size: 1rem;
17}
18
19body {
20 container-type: inline-size;
21}
22
23h1, h2, h3, h4, h5, h6 {
24 font-size: inherit;
25}
26
27img {
28 display: block;
29 width:100%;
30 object-fit: cover;
31}
32
33a, a:visited, a:hover, a:active, a:focus {
34 display: inline-block;
35 cursor: pointer;
36 text-decoration: none;
37 color: inherit;
38}
39
40input {
41 display: block;
42 width:100%;
43}
44
45button{
46 cursor: pointer;
47 color:inherit;
48 border:none;
49 font:inherit;
50}
51
52span, strong, label{
53 display: inline-block;
54}
55"#;
56
57pub fn get_font_size(config: &LayoutStyleConfig) -> String {
58 let base_value = &config.base_value;
59 let font_size = formatdoc!(
60 r#"
61 html{{
62 font-size: {base_value}
63 }}
64 "#
65 );
66
67 font_size
68}
69
70pub fn reset_css(config: &LayoutStyleConfig) -> String {
71 let font_size = get_font_size(config);
72 format!("{RESET_CSS}\n{font_size}")
73}