Skip to main content

encre_css/plugins/border/divide_width/
mod.rs

1#![doc = include_str!("README.md")]
2#![doc(alias = "border")]
3use crate::prelude::build_plugin::*;
4
5pub(crate) const PLUGIN_X_1: StaticPlugin = Plugin::ListProperties(ListProperties {
6    props: map! {
7        "divide-x-reverse" => &["--en-divide-x-reverse: 1;"],
8    },
9    extra_class: Some(" > :not([hidden]) ~ :not([hidden])"),
10    ..ListProperties::default()
11});
12
13pub(crate) const PLUGIN_X_2: StaticPlugin = Plugin::Number(Number {
14    namespace: "divide-x",
15    prop: MultipleProps(&["border-inline-start-width", "border-inline-end-width"]),
16    has_empty: Some(true),
17    extra_class: Some(" > :not([hidden]) ~ :not([hidden])"),
18    template: Some(MultipleProps(&[
19        "calc({}px * var(--en-divide-x-reverse))",
20        "calc({}px * calc(1 - var(--en-divide-x-reverse)))",
21    ])),
22    extra_rule_css: Some(&["--en-divide-x-reverse: 0;"]),
23    ..Number::default()
24});
25
26pub(crate) const PLUGIN_X_3: StaticPlugin = Plugin::Arbitrary(Arbitrary {
27    namespace: "divide-x",
28    prop: MultipleProps(&["border-inline-start-width", "border-inline-end-width"]),
29    extra_class: Some(" > :not([hidden]) ~ :not([hidden])"),
30    disambiguate: Some(ArbitraryDisambiguate {
31        matched: &[CssType::Length, CssType::LineWidth],
32        separation: ArbitraryDisambiguateSeparation::Space,
33    }),
34    template: Some(MultipleProps(&[
35        "calc({} * var(--en-divide-x-reverse))",
36        "calc({} * calc(1 - var(--en-divide-x-reverse)))",
37    ])),
38    extra_rule_css: Some(&["--en-divide-x-reverse: 0;"]),
39    ..Arbitrary::default()
40});
41
42pub(crate) const PLUGIN_Y_1: StaticPlugin = Plugin::ListProperties(ListProperties {
43    props: map! {
44        "divide-y-reverse" => &["--en-divide-y-reverse: 1;"],
45    },
46    extra_class: Some(" > :not([hidden]) ~ :not([hidden])"),
47    ..ListProperties::default()
48});
49
50pub(crate) const PLUGIN_Y_2: StaticPlugin = Plugin::Number(Number {
51    namespace: "divide-y",
52    prop: MultipleProps(&["border-block-start-width", "border-block-end-width"]),
53    has_empty: Some(true),
54    extra_class: Some(" > :not([hidden]) ~ :not([hidden])"),
55    template: Some(MultipleProps(&[
56        "calc({}px * var(--en-divide-y-reverse))",
57        "calc({}px * calc(1 - var(--en-divide-y-reverse)))",
58    ])),
59    extra_rule_css: Some(&["--en-divide-y-reverse: 0;"]),
60    ..Number::default()
61});
62
63pub(crate) const PLUGIN_Y_3: StaticPlugin = Plugin::Arbitrary(Arbitrary {
64    namespace: "divide-y",
65    prop: MultipleProps(&["border-block-start-width", "border-block-end-width"]),
66    extra_class: Some(" > :not([hidden]) ~ :not([hidden])"),
67    disambiguate: Some(ArbitraryDisambiguate {
68        matched: &[CssType::Length, CssType::LineWidth],
69        separation: ArbitraryDisambiguateSeparation::Space,
70    }),
71    template: Some(MultipleProps(&[
72        "calc({} * var(--en-divide-y-reverse))",
73        "calc({} * calc(1 - var(--en-divide-y-reverse)))",
74    ])),
75    extra_rule_css: Some(&["--en-divide-y-reverse: 0;"]),
76    ..Arbitrary::default()
77});