Skip to content

Commit e7d1bfd

Browse files
committed
update ast
1 parent 86ac8f0 commit e7d1bfd

File tree

7 files changed

+270
-206
lines changed

7 files changed

+270
-206
lines changed

node/ast.d.ts

Lines changed: 56 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4230,23 +4230,30 @@ export type PositionComponentFor_VerticalPositionKeyword =
42304230
* See [RadialGradient](RadialGradient).
42314231
*/
42324232
export type EndingShape =
4233-
| {
4234-
type: "circle";
4235-
value: Circle;
4236-
}
42374233
| {
42384234
type: "ellipse";
42394235
value: Ellipse;
4236+
}
4237+
| {
4238+
type: "circle";
4239+
value: Circle;
42404240
};
42414241
/**
4242-
* A circle ending shape for a `radial-gradient()`.
4242+
* An ellipse ending shape for a `radial-gradient()`.
42434243
*
42444244
* See [RadialGradient](RadialGradient).
42454245
*/
4246-
export type Circle =
4246+
export type Ellipse =
42474247
| {
4248-
type: "radius";
4249-
value: Length;
4248+
type: "size";
4249+
/**
4250+
* The x-radius of the ellipse.
4251+
*/
4252+
x: DimensionPercentageFor_LengthValue;
4253+
/**
4254+
* The y-radius of the ellipse.
4255+
*/
4256+
y: DimensionPercentageFor_LengthValue;
42504257
}
42514258
| {
42524259
type: "extent";
@@ -4259,21 +4266,14 @@ export type Circle =
42594266
*/
42604267
export type ShapeExtent = "closest-side" | "farthest-side" | "closest-corner" | "farthest-corner";
42614268
/**
4262-
* An ellipse ending shape for a `radial-gradient()`.
4269+
* A circle ending shape for a `radial-gradient()`.
42634270
*
42644271
* See [RadialGradient](RadialGradient).
42654272
*/
4266-
export type Ellipse =
4273+
export type Circle =
42674274
| {
4268-
type: "size";
4269-
/**
4270-
* The x-radius of the ellipse.
4271-
*/
4272-
x: DimensionPercentageFor_LengthValue;
4273-
/**
4274-
* The y-radius of the ellipse.
4275-
*/
4276-
y: DimensionPercentageFor_LengthValue;
4275+
type: "radius";
4276+
value: Length;
42774277
}
42784278
| {
42794279
type: "extent";
@@ -4438,11 +4438,11 @@ export type WebKitGradientPointComponentFor_HorizontalPositionKeyword =
44384438
*/
44394439
export type NumberOrPercentage =
44404440
| {
4441-
type: "percentage";
4441+
type: "number";
44424442
value: number;
44434443
}
44444444
| {
4445-
type: "number";
4445+
type: "percentage";
44464446
value: number;
44474447
};
44484448
/**
@@ -4753,13 +4753,13 @@ export type RectFor_LengthOrNumber = [LengthOrNumber, LengthOrNumber, LengthOrNu
47534753
* Either a [`<length>`](https://www.w3.org/TR/css-values-4/#lengths) or a [`<number>`](https://www.w3.org/TR/css-values-4/#numbers).
47544754
*/
47554755
export type LengthOrNumber =
4756-
| {
4757-
type: "length";
4758-
value: Length;
4759-
}
47604756
| {
47614757
type: "number";
47624758
value: number;
4759+
}
4760+
| {
4761+
type: "length";
4762+
value: Length;
47634763
};
47644764
/**
47654765
* A single [border-image-repeat](https://www.w3.org/TR/css-backgrounds-3/#border-image-repeat) keyword.
@@ -5570,22 +5570,16 @@ export type AnimationRangeStart = AnimationAttachmentRange;
55705570
* A value for the [animation-range-start](https://drafts.csswg.org/scroll-animations/#animation-range-start) or [animation-range-end](https://drafts.csswg.org/scroll-animations/#animation-range-end) property.
55715571
*/
55725572
export type AnimationAttachmentRange =
5573-
| "Normal"
5574-
| {
5575-
LengthPercentage: DimensionPercentageFor_LengthValue;
5576-
}
5577-
| {
5578-
TimelineRange: {
5579-
/**
5580-
* The name of the timeline range.
5581-
*/
5582-
name: TimelineRangeName;
5583-
/**
5584-
* The offset from the start of the named timeline range.
5585-
*/
5586-
offset: DimensionPercentageFor_LengthValue;
5587-
};
5588-
};
5573+
"normal" | DimensionPercentageFor_LengthValue | {
5574+
/**
5575+
* The name of the timeline range.
5576+
*/
5577+
name: TimelineRangeName;
5578+
/**
5579+
* The offset from the start of the named timeline range.
5580+
*/
5581+
offset: DimensionPercentageFor_LengthValue;
5582+
};
55895583
/**
55905584
* A [view progress timeline range](https://drafts.csswg.org/scroll-animations/#view-timelines-ranges)
55915585
*/
@@ -5709,7 +5703,7 @@ export type Transform =
57095703
/**
57105704
* A value for the [transform-style](https://drafts.csswg.org/css-transforms-2/#transform-style-property) property.
57115705
*/
5712-
export type TransformStyle = "flat" | "preserve-3d";
5706+
export type TransformStyle = "flat" | "preserve3d";
57135707
/**
57145708
* A value for the [transform-box](https://drafts.csswg.org/css-transforms-1/#transform-box) property.
57155709
*/
@@ -6105,9 +6099,6 @@ export type MarkerSide = "match-self" | "match-parent";
61056099
* An SVG [`<paint>`](https://www.w3.org/TR/SVG2/painting.html#SpecifyingPaint) value used in the `fill` and `stroke` properties.
61066100
*/
61076101
export type SVGPaint =
6108-
| {
6109-
type: "none";
6110-
}
61116102
| {
61126103
/**
61136104
* A fallback to be used used in case the paint server cannot be resolved.
@@ -6128,6 +6119,9 @@ export type SVGPaint =
61286119
}
61296120
| {
61306121
type: "context-stroke";
6122+
}
6123+
| {
6124+
type: "none";
61316125
};
61326126
/**
61336127
* A fallback for an SVG paint in case a paint server `url()` cannot be resolved.
@@ -6938,6 +6932,10 @@ export type KeyframeSelector =
69386932
}
69396933
| {
69406934
type: "to";
6935+
}
6936+
| {
6937+
type: "timeline-range-percentage";
6938+
value: TimelineRangePercentage;
69416939
};
69426940
/**
69436941
* KeyframesName
@@ -9164,6 +9162,19 @@ export interface Keyframe<D = Declaration> {
91649162
*/
91659163
selectors: KeyframeSelector[];
91669164
}
9165+
/**
9166+
* A percentage of a given timeline range
9167+
*/
9168+
export interface TimelineRangePercentage {
9169+
/**
9170+
* The name of the timeline range.
9171+
*/
9172+
name: TimelineRangeName;
9173+
/**
9174+
* The percentage progress between the start and end of the range.
9175+
*/
9176+
percentage: number;
9177+
}
91679178
/**
91689179
* A [@font-face](https://drafts.csswg.org/css-fonts/#font-face-rule) rule.
91699180
*/

scripts/build-ast.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ compileFromFile('node/ast.json', {
6666
path.node.typeAnnotation.types[1].members[0].key.name === 'xyz'
6767
) {
6868
path.get('typeAnnotation.types.1').replaceWith(path.node.typeAnnotation.types[1].members[0].typeAnnotation.typeAnnotation);
69+
} else if (path.node.id.name === 'AnimationAttachmentRange' && path.node.typeAnnotation.type === 'TSUnionType') {
70+
let types = path.node.typeAnnotation.types;
71+
if (types[1].type === 'TSTypeLiteral' && types[1].members[0].key.name === 'lengthpercentage') {
72+
path.get('typeAnnotation.types.1').replaceWith(path.node.typeAnnotation.types[1].members[0].typeAnnotation.typeAnnotation);
73+
}
74+
75+
if (types[2].type === 'TSTypeLiteral' && types[2].members[0].key.name === 'timelinerange') {
76+
path.get('typeAnnotation.types.2').replaceWith(path.node.typeAnnotation.types[2].members[0].typeAnnotation.typeAnnotation);
77+
}
6978
}
7079
}
7180
});

src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ macro_rules! enum_property {
1010
) => {
1111
#[derive(Debug, Clone, Copy, PartialEq, Parse, ToCss)]
1212
#[cfg_attr(feature = "visitor", derive(Visit))]
13-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize), serde(rename_all = "lowercase"))]
13+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize), serde(rename_all = "kebab-case"))]
1414
#[cfg_attr(feature = "jsonschema", derive(schemars::JsonSchema))]
1515
#[cfg_attr(feature = "into_owned", derive(static_self::IntoOwned))]
1616
$(#[$outer])*

src/properties/animation.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,11 @@ impl ToCss for ViewTimeline {
379379
/// A [view progress timeline range](https://drafts.csswg.org/scroll-animations/#view-timelines-ranges)
380380
#[derive(Debug, Clone, PartialEq, Parse, ToCss)]
381381
#[cfg_attr(feature = "visitor", derive(Visit))]
382-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
382+
#[cfg_attr(
383+
feature = "serde",
384+
derive(serde::Serialize, serde::Deserialize),
385+
serde(rename_all = "kebab-case")
386+
)]
383387
#[cfg_attr(feature = "jsonschema", derive(schemars::JsonSchema))]
384388
#[cfg_attr(feature = "into_owned", derive(static_self::IntoOwned))]
385389
pub enum TimelineRangeName {
@@ -402,15 +406,17 @@ pub enum TimelineRangeName {
402406
/// or [animation-range-end](https://drafts.csswg.org/scroll-animations/#animation-range-end) property.
403407
#[derive(Debug, Clone, PartialEq)]
404408
#[cfg_attr(feature = "visitor", derive(Visit))]
405-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
409+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize), serde(rename_all = "lowercase"))]
406410
#[cfg_attr(feature = "jsonschema", derive(schemars::JsonSchema))]
407411
#[cfg_attr(feature = "into_owned", derive(static_self::IntoOwned))]
408412
pub enum AnimationAttachmentRange {
409413
/// The start of the animation’s attachment range is the start of its associated timeline.
410414
Normal,
411415
/// The animation attachment range starts at the specified point on the timeline measuring from the start of the timeline.
416+
#[cfg_attr(feature = "serde", serde(untagged))]
412417
LengthPercentage(LengthPercentage),
413418
/// The animation attachment range starts at the specified point on the timeline measuring from the start of the specified named timeline range.
419+
#[cfg_attr(feature = "serde", serde(untagged))]
414420
TimelineRange {
415421
/// The name of the timeline range.
416422
name: TimelineRangeName,

0 commit comments

Comments
 (0)