layoutcss_parser/utilities/
p.rs1use indoc::formatdoc;
2use crate::harmonic::get_harmonic;
3
4use std::collections::HashSet;
5pub fn p_css(value: &str, harmonic_ratio: f64, set: &mut HashSet<String>) {
6 let harmonic_value = get_harmonic(value, harmonic_ratio);
7 set.insert(formatdoc!(
8 r#"
9 [layout~="p:{value}"]{{
10 padding: {harmonic_value};
11 --pl: {harmonic_value};
12 --pr: {harmonic_value};
13 }}
14 "#
15 ));
16}
17
18pub fn pt_css(value: &str, harmonic_ratio: f64, set: &mut HashSet<String>) {
19 let harmonic_value = get_harmonic(value, harmonic_ratio);
20 set.insert(formatdoc!(
21 r#"
22 [layout~="pt:{value}"]{{
23 padding-top: {harmonic_value};
24 }}
25 "#
26 ));
27}
28
29pub fn pb_css(value: &str, harmonic_ratio: f64, set: &mut HashSet<String>) {
30 let harmonic_value = get_harmonic(value, harmonic_ratio);
31 set.insert(formatdoc!(
32 r#"
33 [layout~="pb:{value}"]{{
34 padding-bottom: {harmonic_value};
35 }}
36 "#
37 ));
38}
39
40pub fn pl_css(value: &str, harmonic_ratio: f64, set: &mut HashSet<String>) {
41 let harmonic_value = get_harmonic(&value, harmonic_ratio);
42 set.insert(formatdoc!(
43 r#"
44 [layout~="pl:{value}"]{{
45 padding-left: {harmonic_value};
46 --pl: {harmonic_value};
47 }}
48 "#
49 ));
50}
51
52pub fn pr_css(value: &str, harmonic_ratio: f64, set: &mut HashSet<String>) {
53 let harmonic_value = get_harmonic(&value, harmonic_ratio);
54 set.insert(formatdoc!(
55 r#"
56 [layout~="pr:{value}"]{{
57 padding-right: {harmonic_value};
58 --pr: {harmonic_value};
59 }}
60 "#
61 ));
62}
63
64pub fn px_css(value: &str, harmonic_ratio: f64, set: &mut HashSet<String>) {
65 let harmonic_value = get_harmonic(&value, harmonic_ratio);
66 set.insert(formatdoc!(
67 r#"
68 [layout~="px:{value}"]{{
69 padding-left: {harmonic_value};
70 padding-right: {harmonic_value};
71 --pl: {harmonic_value};
72 --pr: {harmonic_value};
73 }}
74 "#
75 ));
76}
77
78pub fn py_css(value: &str, harmonic_ratio: f64, set: &mut HashSet<String>) {
79 let harmonic_value = get_harmonic(&value, harmonic_ratio);
80 set.insert(formatdoc!(
81 r#"
82 [layout~="py:{value}"]{{
83 padding-top: {harmonic_value};
84 padding-bottom: {harmonic_value};
85 }}
86 "#
87 ));
88}