From 41d30744dfa0ae7581bf1d221377fa6df75b7b37 Mon Sep 17 00:00:00 2001 From: Jean-Yves Moyen Date: Thu, 23 Nov 2023 15:42:33 +0100 Subject: [PATCH] Correctly implement (Partially)Resolvable --- .changeset/gentle-berries-decide.md | 5 +++++ .../alfa-css/src/value/image/gradient/linear/corner.ts | 6 +++++- .../alfa-css/src/value/image/gradient/linear/side.ts | 6 +++++- .../alfa-css/src/value/image/gradient/radial/circle.ts | 9 +++++---- .../alfa-css/src/value/image/gradient/radial/extent.ts | 6 +++++- packages/alfa-css/src/value/shape/rectangle.ts | 8 ++++++-- 6 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 .changeset/gentle-berries-decide.md diff --git a/.changeset/gentle-berries-decide.md b/.changeset/gentle-berries-decide.md new file mode 100644 index 0000000000..643b1f0287 --- /dev/null +++ b/.changeset/gentle-berries-decide.md @@ -0,0 +1,5 @@ +--- +"@siteimprove/alfa-css": patch +--- + +**Added:** all `Value` subtype now correctly implement the `(Partially)Resovable` interfaces. diff --git a/packages/alfa-css/src/value/image/gradient/linear/corner.ts b/packages/alfa-css/src/value/image/gradient/linear/corner.ts index 1b66f2438b..1385a273c8 100644 --- a/packages/alfa-css/src/value/image/gradient/linear/corner.ts +++ b/packages/alfa-css/src/value/image/gradient/linear/corner.ts @@ -3,6 +3,7 @@ import { Parser } from "@siteimprove/alfa-parser"; import { type Parser as CSSParser, Token } from "../../../../syntax"; +import { Resolvable } from "../../../resolvable"; import { Value } from "../../../value"; import { Position } from "./position"; @@ -12,7 +13,10 @@ const { map, either, pair, option, right } = Parser; /** * @internal */ -export class Corner extends Value<"corner", false> { +export class Corner + extends Value<"corner", false> + implements Resolvable +{ public static of( vertical: Position.Vertical, horizontal: Position.Horizontal, diff --git a/packages/alfa-css/src/value/image/gradient/linear/side.ts b/packages/alfa-css/src/value/image/gradient/linear/side.ts index c15f6588bd..3f0a17a4ec 100644 --- a/packages/alfa-css/src/value/image/gradient/linear/side.ts +++ b/packages/alfa-css/src/value/image/gradient/linear/side.ts @@ -3,6 +3,7 @@ import { Parser } from "@siteimprove/alfa-parser"; import { Token } from "../../../../syntax"; +import { Resolvable } from "../../../resolvable"; import { Value } from "../../../value"; import { Position } from "./position"; @@ -12,7 +13,10 @@ const { map, option, right } = Parser; /** * @internal */ -export class Side extends Value<"side", false> { +export class Side + extends Value<"side", false> + implements Resolvable +{ public static of(side: Position.Vertical | Position.Horizontal): Side { return new Side(side); } diff --git a/packages/alfa-css/src/value/image/gradient/radial/circle.ts b/packages/alfa-css/src/value/image/gradient/radial/circle.ts index 96bb450e67..740668573a 100644 --- a/packages/alfa-css/src/value/image/gradient/radial/circle.ts +++ b/packages/alfa-css/src/value/image/gradient/radial/circle.ts @@ -5,6 +5,7 @@ import { Parser as CSSParser, Token } from "../../../../syntax"; import { Keyword } from "../../../keyword"; import { Length } from "../../../numeric"; +import { Resolvable } from "../../../resolvable"; import { Value } from "../../../value"; /** @@ -12,10 +13,10 @@ import { Value } from "../../../value"; * * @internal */ -export class Circle extends Value< - "circle", - Value.HasCalculation<[R]> -> { +export class Circle + extends Value<"circle", Value.HasCalculation<[R]>> + implements Resolvable +{ public static of(radius: R): Circle { return new Circle(radius); } diff --git a/packages/alfa-css/src/value/image/gradient/radial/extent.ts b/packages/alfa-css/src/value/image/gradient/radial/extent.ts index 414f4c5427..f1782b0b95 100644 --- a/packages/alfa-css/src/value/image/gradient/radial/extent.ts +++ b/packages/alfa-css/src/value/image/gradient/radial/extent.ts @@ -5,6 +5,7 @@ import { Err, Result } from "@siteimprove/alfa-result"; import { Parser as CSSParser, Token } from "../../../../syntax"; import { Keyword } from "../../../keyword"; +import { Resolvable } from "../../../resolvable"; import { Value } from "../../../value"; const { map } = Parser; @@ -12,7 +13,10 @@ const { map } = Parser; /** * @internal */ -export class Extent extends Value<"extent", false> { +export class Extent + extends Value<"extent", false> + implements Resolvable +{ public static of( shape: Extent.Shape = Extent.Shape.Circle, size: Extent.Size = Extent.Size.FarthestCorner, diff --git a/packages/alfa-css/src/value/shape/rectangle.ts b/packages/alfa-css/src/value/shape/rectangle.ts index 0cc0ae7ace..e339a2e269 100644 --- a/packages/alfa-css/src/value/shape/rectangle.ts +++ b/packages/alfa-css/src/value/shape/rectangle.ts @@ -5,6 +5,7 @@ import { Comma, Function, type Parser as CSSParser, Token } from "../../syntax"; import { Keyword } from "../keyword"; import { Length } from "../numeric"; +import { Resolvable } from "../resolvable"; import { Value } from "../value"; import { BasicShape } from "./basic-shape"; @@ -18,8 +19,11 @@ const { either, map, option, separatedList } = Parser; * @deprecated Deprecated as of CSS Masking Module Level 1 */ export class Rectangle< - O extends Length | Rectangle.Auto = Length | Rectangle.Auto, -> extends BasicShape<"rectangle", Value.HasCalculation<[O, O, O, O]>> { + O extends Length | Rectangle.Auto = Length | Rectangle.Auto, + > + extends BasicShape<"rectangle", Value.HasCalculation<[O, O, O, O]>> + implements Resolvable +{ public static of( top: O, right: O,