rspack_lightningcss/properties/
outline.rs1use super::border::{BorderSideWidth, GenericBorder, LineStyle};
4use super::{Property, PropertyId};
5use crate::context::PropertyHandlerContext;
6use crate::declaration::{DeclarationBlock, DeclarationList};
7use crate::error::{ParserError, PrinterError};
8use crate::macros::{impl_shorthand, shorthand_handler};
9use crate::targets::Browsers;
10use crate::traits::{FallbackValues, IsCompatible, Parse, PropertyHandler, Shorthand, ToCss};
11use crate::values::color::CssColor;
12#[cfg(feature = "visitor")]
13use crate::visitor::Visit;
14use cssparser::*;
15
16#[derive(Debug, Clone, PartialEq, Parse, ToCss)]
18#[cfg_attr(feature = "visitor", derive(Visit))]
19#[cfg_attr(
20 feature = "serde",
21 derive(serde::Serialize, serde::Deserialize),
22 serde(tag = "type", content = "value", rename_all = "kebab-case")
23)]
24#[cfg_attr(feature = "jsonschema", derive(schemars::JsonSchema))]
25#[cfg_attr(feature = "into_owned", derive(rspack_lightningcss_static_self::IntoOwned))]
26pub enum OutlineStyle {
27 Auto,
29 LineStyle(LineStyle),
31}
32
33impl Default for OutlineStyle {
34 fn default() -> OutlineStyle {
35 OutlineStyle::LineStyle(LineStyle::None)
36 }
37}
38
39impl IsCompatible for OutlineStyle {
40 fn is_compatible(&self, _browsers: Browsers) -> bool {
41 true
42 }
43}
44
45pub type Outline = GenericBorder<OutlineStyle, 11>;
47
48impl_shorthand! {
49 Outline(Outline) {
50 width: [OutlineWidth],
51 style: [OutlineStyle],
52 color: [OutlineColor],
53 }
54}
55
56shorthand_handler!(OutlineHandler -> Outline fallbacks: true {
57 width: OutlineWidth(BorderSideWidth),
58 style: OutlineStyle(OutlineStyle),
59 color: OutlineColor(CssColor, fallback: true),
60});