Skip to content

Commit

Permalink
tweak seralisation
Browse files Browse the repository at this point in the history
  • Loading branch information
keithamus committed Aug 6, 2023
1 parent 8af3a99 commit 42ad3d2
Show file tree
Hide file tree
Showing 20 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion crates/hdx_ast/src/css/rules/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl<'a> PageSelector<'a> {
}

#[derive(Atomizable, Debug, Clone, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(rename_all = "lowercase"))]
#[cfg_attr(feature = "serde", derive(Serialize), serde(rename_all = "kebab-case"))]
pub enum PagePseudoClass {
Left,
Right,
Expand Down
4 changes: 2 additions & 2 deletions crates/hdx_ast/src/css/selector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub enum AttributeModifier {
}

#[derive(Atomizable, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type"))]
#[cfg_attr(feature = "serde", derive(Serialize), serde(rename_all = "kebab-case"))]
pub enum PseudoClass {
Active, // atom!("active")
AnyLink, // atom!("any-link")
Expand Down Expand Up @@ -178,7 +178,7 @@ pub enum PseudoFunction<'a> {
}

#[derive(Atomizable, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type"))]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum DirValue {
Rtl, // atom!("rtl")
Ltr, // atom!("ltr")
Expand Down
2 changes: 1 addition & 1 deletion crates/hdx_ast/src/css/stylesheet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{

// https://drafts.csswg.org/cssom-1/#the-cssstylesheet-interface
#[derive(Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "camelCase"))]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type"))]
pub struct CSSStyleSheet<'a> {
pub rules: Vec<'a, CSSRule<'a>>,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hdx_ast/src/css/values/backgrounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub enum LineWidth {

// https://drafts.csswg.org/css-backgrounds-3/#typedef-line-style
#[derive(Atomizable, Debug, Default, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum LineStyle {
#[default]
None, // atom!("none")
Expand Down
8 changes: 4 additions & 4 deletions crates/hdx_ast/src/css/values/break.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{atom, Atom, Atomizable};

// https://drafts.csswg.org/css-break-4/#propdef-box-decoration-break
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum BoxDecorationBreakValue {
#[default]
Slice, // atom!("slice")
Expand All @@ -14,7 +14,7 @@ pub enum BoxDecorationBreakValue {

// https://drafts.csswg.org/css-break-4/#propdef-break-after
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum BreakValue {
#[default]
Auto, // atom!("auto")
Expand All @@ -35,7 +35,7 @@ pub enum BreakValue {

// https://drafts.csswg.org/css-break-4/#propdef-break-inside
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum BreakInsideValue {
#[default]
Auto, // atom!("auto")
Expand All @@ -47,7 +47,7 @@ pub enum BreakInsideValue {

// https://drafts.csswg.org/css-break-4/#propdef-margin-break
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum MarginBreakValue {
#[default]
Auto, // atom!("auto")
Expand Down
2 changes: 1 addition & 1 deletion crates/hdx_ast/src/css/values/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl<'a> ColorValue<'a> {
}

#[derive(Atomizable, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "name", rename_all = "lowercase"))]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum NamedColor {
Aliceblue, // atom!("aliceblue")
Antiquewhite, // atom!("antiquewhite")
Expand Down
2 changes: 1 addition & 1 deletion crates/hdx_ast/src/css/values/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub enum ContentElement<'a> {

// https://drafts.csswg.org/css-content-3/#typedef-quote
#[derive(Atomizable, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum Quote {
OpenQuote, // atom!("open-quote")
CloseQuote, // atom!("close-quote")
Expand Down
4 changes: 2 additions & 2 deletions crates/hdx_ast/src/css/values/counter_styles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub enum CounterStyle<'a> {

// https://drafts.csswg.org/css-counter-styles-3/#predefined-counters
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum PredefinedCounterStyle {
Decimal, // atom!("decimal"),
DecimalLeadingZero, // atom!("decimal-leading-zero"),
Expand Down Expand Up @@ -79,7 +79,7 @@ pub enum Symbol<'a> {

// https://drafts.csswg.org/css-counter-styles-3/#typedef-symbols-type
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum SymbolsType {
Cyclic, // atom!("cyclic")
Numeric, // atom!("numeric")
Expand Down
2 changes: 1 addition & 1 deletion crates/hdx_ast/src/css/values/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ impl DisplayMarker {

// https://drafts.csswg.org/css-display-4/#propdef-visibility
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum VisibilityValue {
#[default]
Visible, // atom!("visible")
Expand Down
4 changes: 2 additions & 2 deletions crates/hdx_ast/src/css/values/fonts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{atom, Atom, Atomizable, Spanned};

// https://drafts.csswg.org/css2/#value-def-absolute-size
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum AbsoluteSize {
XxSmall, // atom!("xx-small")
XSmall, // atom!("x-small")
Expand All @@ -20,7 +20,7 @@ pub enum AbsoluteSize {

// https://drafts.csswg.org/css2/#value-def-relative-size
#[derive(Atomizable, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum RelativeSize {
Larger, // atom!("larger")
Smaller, // atom!("smaller")
Expand Down
2 changes: 1 addition & 1 deletion crates/hdx_ast/src/css/values/images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub enum RadialGradientSize {

// https://drafts.csswg.org/css-images-3/#typedef-rg-ending-shape
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum RadialGradientEndingShape {
#[default]
Circle, // atom!("circle")
Expand Down
8 changes: 4 additions & 4 deletions crates/hdx_ast/src/css/values/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{atom, Atom, Atomizable, Spanned};

// https://drafts.csswg.org/css-inline/#propdef-alignment-baseline
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum AlignmentBaselineValue {
#[default]
Baseline, // atom!("baseline")
Expand All @@ -23,7 +23,7 @@ pub enum AlignmentBaselineValue {

// https://drafts.csswg.org/css-inline/#propdef-baseline-source
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum BaselineSourceValue {
#[default]
Auto, // atom!("auto")
Expand Down Expand Up @@ -51,7 +51,7 @@ impl Default for BaselineShiftValue {

// https://drafts.csswg.org/css-inline/#propdef-dominant-baseline
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum DominantBaselineValue {
#[default]
Auto, // atom!("auto")
Expand All @@ -67,7 +67,7 @@ pub enum DominantBaselineValue {

// https://drafts.csswg.org/css-inline/#propdef-inline-sizing
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum InlineSizingValue {
#[default]
Normal, // atom!("normal")
Expand Down
2 changes: 1 addition & 1 deletion crates/hdx_ast/src/css/values/lists.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct Counters<'a> {

// https://drafts.csswg.org/css-lists-3/#funcdef-counters
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum ListStylePositionValue {
#[default]
Outside, // atom!("outside")
Expand Down
2 changes: 1 addition & 1 deletion crates/hdx_ast/src/css/values/overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{atom, Atom, Atomizable};

// https://drafts.csswg.org/css-overflow-3/#propdef-overflow-block
#[derive(Atomizable, Copy, Clone, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum OverflowKeyword {
#[default]
Visible, // atom!("visible")
Expand Down
8 changes: 4 additions & 4 deletions crates/hdx_ast/src/css/values/page_floats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ impl FloatValue {
}

#[derive(Atomizable, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum SnapBlockFloat {
Start, // atom!("start")
End, // atom!("end")
Near, // atom!("near")
}

#[derive(Atomizable, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum SnapInlineFloat {
Right, // atom!("right")
Left, // atom!("left")
Expand All @@ -79,7 +79,7 @@ pub enum SnapInlineFloat {

// https://drafts.csswg.org/css-page-floats-3/#propdef-clear
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum ClearValue {
InlineStart, // atom!("inline-start")
InlineEnd, // atom!("inline-end")
Expand Down Expand Up @@ -138,7 +138,7 @@ impl From<i32> for FloatDeferValue {

// https://drafts.csswg.org/css-page-floats-3/#propdef-float-reference
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum FloatReferenceValue {
#[default]
Inline, // atom!("inline")
Expand Down
4 changes: 2 additions & 2 deletions crates/hdx_ast/src/css/values/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{atom, Atom, Atomizable};

// https://drafts.csswg.org/css-position-3/#propdef-position
#[derive(Atomizable, Debug, Default, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum PositionValue {
#[default]
Static, // atom!("static")
Expand All @@ -18,7 +18,7 @@ pub enum PositionValue {

// https://drafts.csswg.org/css-position-3/#inset-shorthands
#[derive(Debug, Default, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub struct InsetShorthand<'a> {
pub top: Shorthand<'a, MathExpr<'a, LengthPercentageOrAuto>>,
pub right: Shorthand<'a, MathExpr<'a, LengthPercentageOrAuto>>,
Expand Down
10 changes: 5 additions & 5 deletions crates/hdx_ast/src/css/values/sizing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{atom, Atom, Atomizable, Spanned};

// https://www.w3.org/TR/css-sizing-3/#propdef-box-sizing
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type"))]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum BoxSizingValue {
#[default]
ContentBox, // atom!("content-box")
Expand All @@ -15,7 +15,7 @@ pub enum BoxSizingValue {

// https://drafts.csswg.org/css-sizing-4/#sizing-values
#[derive(Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type"))]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum Sizing {
#[default]
Auto,
Expand All @@ -30,7 +30,7 @@ pub enum Sizing {
}

#[derive(Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type"))]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum MaxSizing {
#[default]
None,
Expand All @@ -45,7 +45,7 @@ pub enum MaxSizing {
}

#[derive(Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type"))]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum RatioOrAuto {
#[default]
Auto,
Expand All @@ -54,7 +54,7 @@ pub enum RatioOrAuto {

// https://drafts.csswg.org/css-sizing-4/#intrinsic-contribution-override
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum MinIntrinsicSizingValue {
#[default]
Legacy, // atom!("legacy")
Expand Down
8 changes: 4 additions & 4 deletions crates/hdx_ast/src/css/values/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{atom, Atom, Atomizable, Span};

// https://drafts.csswg.org/css-tables-3/#propdef-border-collapse
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum BorderCollapseValue {
#[default]
Separate, // atom!("separate")
Expand All @@ -15,7 +15,7 @@ pub enum BorderCollapseValue {

// https://drafts.csswg.org/css-tables-3/#propdef-caption-side
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum CaptionSideValue {
#[default]
Top, // atom!("top")
Expand All @@ -24,7 +24,7 @@ pub enum CaptionSideValue {

// https://drafts.csswg.org/css-tables-3/#propdef-caption-side
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum EmptyCellsValue {
#[default]
Show, // atom!("show")
Expand All @@ -33,7 +33,7 @@ pub enum EmptyCellsValue {

// https://drafts.csswg.org/css-tables-3/#propdef-caption-side
#[derive(Atomizable, Default, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde())]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))]
pub enum TableLayoutValue {
#[default]
Auto, // atom!("auto")
Expand Down
Loading

0 comments on commit 42ad3d2

Please sign in to comment.