diff --git a/.changeset/famous-onions-call.md b/.changeset/famous-onions-call.md new file mode 100644 index 0000000000..6a73960945 --- /dev/null +++ b/.changeset/famous-onions-call.md @@ -0,0 +1,5 @@ +--- +"@siteimprove/alfa-css": patch +--- + +**Added:** `Token.Function`, and the associated parsers, are now parametric in `N extends string`, typing the name of the function. diff --git a/.changeset/lazy-tires-invite.md b/.changeset/lazy-tires-invite.md new file mode 100644 index 0000000000..fa0cdb96fc --- /dev/null +++ b/.changeset/lazy-tires-invite.md @@ -0,0 +1,5 @@ +--- +"@siteimprove/alfa-tuple": patch +--- + +**Added:** `Tuple.every` is now able to refine its input. diff --git a/.changeset/poor-taxes-float.md b/.changeset/poor-taxes-float.md new file mode 100644 index 0000000000..27f5e34b3e --- /dev/null +++ b/.changeset/poor-taxes-float.md @@ -0,0 +1,5 @@ +--- +"@siteimprove/alfa-css": minor +--- + +**Added:** The `clamp()` and `min()` CSS functions are now supported. diff --git a/.changeset/twenty-webs-read.md b/.changeset/twenty-webs-read.md new file mode 100644 index 0000000000..568fcbcf6e --- /dev/null +++ b/.changeset/twenty-webs-read.md @@ -0,0 +1,5 @@ +--- +"@siteimprove/alfa-parser": minor +--- + +**Added:** A `Parser.exclusive` combinator is now available; it will map the result of a peeker to the actual parser to run and totally skip other parsers. diff --git a/docs/dependency-graph.dot b/docs/dependency-graph.dot index d36fbf176c..86420dc97a 100644 --- a/docs/dependency-graph.dot +++ b/docs/dependency-graph.dot @@ -2489,6 +2489,12 @@ digraph "dependency-graph-Alfa" { lhead = "cluster_Type definitions"; ltail = "cluster_Understanding the web"; ]; + "exit_Understanding the web" -> "name_Collections" [ + style = "invis"; + color = "#ff4600"; + lhead = "cluster_Collections"; + ltail = "cluster_Understanding the web"; + ]; "exit_Understanding the web" -> "name_other" [ style = "invis"; color = "#ff4600"; diff --git a/docs/dependency-graph.svg b/docs/dependency-graph.svg index 0b6520e271..e9e9bb884f 100644 --- a/docs/dependency-graph.svg +++ b/docs/dependency-graph.svg @@ -140,7 +140,7 @@ Logic - + exit_Comparison->name_Logic @@ -162,7 +162,7 @@ - + @siteimprove/alfa-callback->@siteimprove/alfa-mapper @@ -173,8 +173,8 @@ exit_Alternatives->name_other - - + + @@ -302,7 +302,7 @@ - + @siteimprove/alfa-foldable->@siteimprove/alfa-reducer @@ -322,7 +322,7 @@ - + @siteimprove/alfa-hash->@siteimprove/alfa-encoding @@ -346,7 +346,7 @@ - + @siteimprove/alfa-monad->@siteimprove/alfa-mapper @@ -359,7 +359,7 @@ - + @siteimprove/alfa-monad->@siteimprove/alfa-applicative @@ -372,7 +372,7 @@ - + @siteimprove/alfa-monad->@siteimprove/alfa-functor @@ -395,7 +395,7 @@ - + @siteimprove/alfa-refinement->@siteimprove/alfa-predicate @@ -492,7 +492,7 @@ Built ins - + @siteimprove/alfa-branched->name_Built ins @@ -505,7 +505,7 @@ - + @siteimprove/alfa-branched->@siteimprove/alfa-list @@ -518,7 +518,7 @@ - + @siteimprove/alfa-branched->@siteimprove/alfa-collection @@ -539,7 +539,7 @@ exit_Accessibility Conformance Testing->name_Type definitions - + @@ -576,7 +576,7 @@ exit_Accessibility Conformance Testing->name_Logic - + @@ -656,7 +656,7 @@ Understanding the web - + exit_Accessibility Conformance Testing->name_Understanding the web @@ -681,8 +681,8 @@ @siteimprove/alfa-option - -alfa-option + +alfa-option @@ -698,7 +698,7 @@ - + exit_other->name_Comparison @@ -706,21 +706,21 @@ - + exit_other->name_Hash tables - + exit_other->name_Serialization - + exit_other->name_Logic @@ -738,8 +738,8 @@ exit_other->name_Alternatives - - + + @@ -911,8 +911,8 @@ exit_Understanding the web->name_Collections - - + + @@ -962,6 +962,7 @@ + exit_Understanding the web->name_Alternatives @@ -998,7 +999,7 @@ - + exit_Understanding the web->name_Computations @@ -1041,7 +1042,7 @@ - + @siteimprove/alfa-map->name_Built ins @@ -1049,7 +1050,7 @@ - + @siteimprove/alfa-map->@siteimprove/alfa-collection @@ -1062,21 +1063,21 @@ - + @siteimprove/alfa-map->@siteimprove/alfa-bits - + @siteimprove/alfa-applicative->@siteimprove/alfa-mapper - + @siteimprove/alfa-applicative->@siteimprove/alfa-functor @@ -1246,7 +1247,7 @@ - + exit_Collections->name_Computations @@ -1282,7 +1283,7 @@ - + @siteimprove/alfa-functor->@siteimprove/alfa-mapper @@ -1303,7 +1304,7 @@ - + @siteimprove/alfa-earl->@siteimprove/alfa-json-ld @@ -1311,16 +1312,16 @@ @siteimprove/alfa-either - -alfa-either + +alfa-either - + @siteimprove/alfa-either->@siteimprove/alfa-option - - + + @@ -1336,7 +1337,7 @@ - + @siteimprove/alfa-future->@siteimprove/alfa-thenable @@ -1345,14 +1346,14 @@ - + @siteimprove/alfa-list->@siteimprove/alfa-map - + @siteimprove/alfa-list->name_Built ins @@ -1360,7 +1361,7 @@ - + @siteimprove/alfa-list->@siteimprove/alfa-collection @@ -1373,14 +1374,14 @@ - + @siteimprove/alfa-list->@siteimprove/alfa-set - + @siteimprove/alfa-list->@siteimprove/alfa-bits @@ -1414,14 +1415,14 @@ - + @siteimprove/alfa-record->name_Built ins - + @siteimprove/alfa-record->@siteimprove/alfa-list @@ -1429,16 +1430,16 @@ @siteimprove/alfa-result - -alfa-result + +alfa-result - + @siteimprove/alfa-result->@siteimprove/alfa-option - - + + @@ -1455,14 +1456,14 @@ - + @siteimprove/alfa-sequence->@siteimprove/alfa-map - + @siteimprove/alfa-sequence->name_Built ins @@ -1470,14 +1471,14 @@ - + @siteimprove/alfa-sequence->@siteimprove/alfa-collection - + @siteimprove/alfa-sequence->@siteimprove/alfa-set @@ -1490,7 +1491,7 @@ - + @siteimprove/alfa-string->@siteimprove/alfa-test @@ -1511,7 +1512,7 @@ - + @siteimprove/alfa-tuple->name_Built ins @@ -1588,14 +1589,14 @@ - + @siteimprove/alfa-continuation->@siteimprove/alfa-callback - + @siteimprove/alfa-continuation->@siteimprove/alfa-mapper @@ -1663,13 +1664,13 @@ - + exit_Computations->name_Logic - + exit_Computations->name_Collections @@ -1701,7 +1702,7 @@ - + exit_Serialization->name_Alternatives @@ -1719,7 +1720,7 @@ - + @siteimprove/alfa-slice->name_Built ins @@ -1727,7 +1728,7 @@ - + @siteimprove/alfa-slice->@siteimprove/alfa-collection @@ -1888,7 +1889,7 @@ - + @siteimprove/alfa-http->@siteimprove/alfa-url @@ -1900,19 +1901,19 @@ - + exit_Hash tables->name_Comparison - + exit_Hash tables->name_Serialization - + exit_Hash tables->name_Logic @@ -1953,14 +1954,14 @@ - + @siteimprove/alfa-flags->@siteimprove/alfa-map - + @siteimprove/alfa-flags->name_Built ins @@ -1973,7 +1974,7 @@ - + @siteimprove/alfa-parser->@siteimprove/alfa-test @@ -1990,8 +1991,8 @@ @siteimprove/alfa-selective->@siteimprove/alfa-either - - + + @@ -2019,7 +2020,7 @@ - + exit_HTML->@siteimprove/alfa-device @@ -2031,7 +2032,7 @@ CSS syntax - + exit_HTML->name_CSS syntax @@ -2046,7 +2047,7 @@ - + @siteimprove/alfa-css-feature->@siteimprove/alfa-css @@ -2060,7 +2061,7 @@ - + @siteimprove/alfa-rectangle->@siteimprove/alfa-test @@ -2075,21 +2076,21 @@ - + @siteimprove/alfa-tree->@siteimprove/alfa-sequence - + @siteimprove/alfa-tree->@siteimprove/alfa-flags - + @siteimprove/alfa-json-ld->@siteimprove/alfa-json @@ -2118,7 +2119,7 @@ - + @siteimprove/alfa-style->@siteimprove/alfa-selector @@ -2132,7 +2133,7 @@ - + @siteimprove/alfa-style->@siteimprove/alfa-cascade @@ -2155,7 +2156,7 @@ - + exit_CSS syntax->@siteimprove/alfa-device @@ -2166,7 +2167,7 @@ - + exit_CSS->@siteimprove/alfa-device @@ -2174,7 +2175,7 @@ - + exit_CSS->name_HTML @@ -2183,7 +2184,7 @@ - + exit_CSS->name_CSS syntax @@ -2195,7 +2196,7 @@ - + @siteimprove/alfa-cascade->@siteimprove/alfa-selector @@ -2209,7 +2210,7 @@ - + @siteimprove/alfa-affine->@siteimprove/alfa-test @@ -2217,7 +2218,7 @@ - + @siteimprove/alfa-affine->@siteimprove/alfa-math @@ -2231,20 +2232,20 @@ - + @siteimprove/alfa-aria->@siteimprove/alfa-device - + @siteimprove/alfa-aria->name_HTML - + @siteimprove/alfa-aria->name_CSS @@ -2258,7 +2259,7 @@ - + @siteimprove/alfa-eaa->@siteimprove/alfa-act @@ -2280,7 +2281,7 @@ - + @siteimprove/alfa-painting-order->@siteimprove/alfa-style @@ -2345,7 +2346,7 @@ - + @siteimprove/alfa-rules->@siteimprove/alfa-act @@ -2353,14 +2354,14 @@ - + @siteimprove/alfa-rules->@siteimprove/alfa-eaa - + @siteimprove/alfa-rules->@siteimprove/alfa-wcag @@ -2380,7 +2381,7 @@ - + @siteimprove/alfa-xpath->name_HTML @@ -2399,14 +2400,14 @@ - + @siteimprove/alfa-generator->@siteimprove/alfa-mapper - + @siteimprove/alfa-generator->@siteimprove/alfa-reducer diff --git a/docs/review/api/alfa-css.api.md b/docs/review/api/alfa-css.api.md index 00416ac036..0be02e4a9b 100644 --- a/docs/review/api/alfa-css.api.md +++ b/docs/review/api/alfa-css.api.md @@ -35,7 +35,8 @@ import { Serializable } from '@siteimprove/alfa-json'; import { Slice } from '@siteimprove/alfa-slice'; import { Some } from '@siteimprove/alfa-option'; import type { Thunk } from '@siteimprove/alfa-thunk'; -import { Token as Token_2 } from '../../syntax/token.js'; +import { Token as Token_2 } from '../../index.js'; +import { Token as Token_3 } from '../../syntax/token.js'; import { Unit as Unit_2 } from '../../index.js'; // @public (undocumented) @@ -793,18 +794,18 @@ export namespace Expression { } // @public (undocumented) -class Function_2 implements Iterable, Equatable, Serializable { +class Function_2 implements Iterable, Equatable, Serializable { // (undocumented) [Symbol.iterator](): Iterator; - protected constructor(name: string, value: Array); + protected constructor(name: N, value: Array); // (undocumented) equals(value: unknown): value is this; // (undocumented) - get name(): string; + get name(): N; // (undocumented) - static of(name: string, value: Iterable): Function_2; + static of(name: N, value: Iterable): Function_2; // (undocumented) - toJSON(): Function_2.JSON; + toJSON(): Function_2.JSON; // (undocumented) toString(): string; // (undocumented) @@ -814,18 +815,20 @@ class Function_2 implements Iterable, Equatable, Serializable { // @public (undocumented) namespace Function_2 { // (undocumented) - interface JSON { + interface JSON { // (undocumented) [key: string]: json.JSON; // (undocumented) - name: string; + name: N; // (undocumented) value: Array; } const // (undocumented) consume: Parser; - const // (undocumented) - parse: (query?: string | Array | Predicate, body?: Parser | Thunk>) => Parser<[Function_2, T]>; + // (undocumented) + function parse(query: N | ReadonlyArray | Refinement>, body?: Parser | Thunk>): Parser<[Function_2, T]>; + // (undocumented) + function parse(query?: Predicate, body?: Parser | Thunk>): Parser<[Function_2, T]>; } export { Function_2 as Function } @@ -1382,19 +1385,19 @@ namespace Math_2 { const // Warning: (ae-incompatible-release-tags) The symbol "parse" is marked as @public, but its signature references "Math_2" which is marked as @internal // // (undocumented) - parse: Parser_2, Math_2, string, []>; + parse: Parser_2, Math_2, string, []>; const // (undocumented) - parseAngle: Parser_2, Math_2<"angle">, string, []>; + parseAngle: Parser_2, Math_2<"angle">, string, []>; const // (undocumented) - parseAnglePercentage: Parser_2, Math_2<"angle-percentage">, string, []>; + parseAnglePercentage: Parser_2, Math_2<"angle-percentage">, string, []>; const // (undocumented) - parseLength: Parser_2, Math_2<"length">, string, []>; + parseLength: Parser_2, Math_2<"length">, string, []>; const // (undocumented) - parseLengthPercentage: Parser_2, Math_2<"length-percentage">, string, []>; + parseLengthPercentage: Parser_2, Math_2<"length-percentage">, string, []>; const // (undocumented) - parseNumber: Parser_2, Math_2<"number">, string, []>; + parseNumber: Parser_2, Math_2<"number">, string, []>; const // (undocumented) - parsePercentage: Parser_2, Math_2<"percentage">, string, []>; + parsePercentage: Parser_2, Math_2<"percentage">, string, []>; } export { Math_2 as Math } @@ -1459,7 +1462,7 @@ export namespace Matrix { ] ]; const // (undocumented) - parse: Parser_2, Matrix, string, []>; + parse: Parser_2, Matrix, string, []>; } // @public (undocumented) @@ -1801,9 +1804,9 @@ export namespace Perspective { // (undocumented) export type Resolver = Length.Resolver; const // (undocumented) - parse: Parser_2, Perspective>, string, []>; + parse: Parser_2, Perspective>, string, []>; const // (undocumented) - parseProp: Parser_2, Perspective>, string, []>; + parseProp: Parser_2, Perspective>, string, []>; } // Warning: (ae-incompatible-release-tags) The symbol "Polygon" is marked as @public, but its signature references "Resolvable" which is marked as @internal @@ -2162,9 +2165,9 @@ export namespace Scale { z: Number_2.Fixed.JSON | Percentage.Fixed.JSON; } const // (undocumented) - parse: Parser_2, Scale, string, []>; + parse: Parser_2, Scale, string, []>; const // (undocumented) - parseProp: Parser_2, Scale, string, []>; + parseProp: Parser_2, Scale, string, []>; } // Warning: (ae-incompatible-release-tags) The symbol "Shadow" is marked as @public, but its signature references "Resolvable" which is marked as @internal @@ -2337,7 +2340,7 @@ export namespace Skew { y: Angle.Fixed.JSON; } const // (undocumented) - parse: Parser_2, Skew, string, []>; + parse: Parser_2, Skew, string, []>; } // Warning: (ae-incompatible-release-tags) The symbol "String" is marked as @public, but its signature references "Resolvable" which is marked as @internal @@ -2551,8 +2554,6 @@ export namespace Token { // (undocumented) get type(): "close-square-bracket"; } - const // (undocumented) - atKeyword: typeof AtKeyword.of; // (undocumented) export namespace CloseSquareBracket { // (undocumented) @@ -2565,6 +2566,8 @@ export namespace Token { type: "close-square-bracket"; } } + const // (undocumented) + atKeyword: typeof AtKeyword.of; // (undocumented) export class Colon implements Equatable, Serializable { // (undocumented) @@ -2578,9 +2581,6 @@ export namespace Token { // (undocumented) get type(): "colon"; } - const // (undocumented) - hash: typeof Hash.of, // (undocumented) - isHash: typeof Hash.isHash; // (undocumented) export namespace Colon { // (undocumented) @@ -2593,6 +2593,9 @@ export namespace Token { type: "colon"; } } + const // (undocumented) + hash: typeof Hash.of, // (undocumented) + isHash: typeof Hash.isHash; // (undocumented) export class Comma implements Equatable, Serializable { // (undocumented) @@ -2618,9 +2621,6 @@ export namespace Token { type: "comma"; } } - const // (undocumented) - string: typeof String.of, // (undocumented) - isString: typeof String.isString; // (undocumented) export class Delim implements Equatable, Serializable { protected constructor(value: number); @@ -2637,6 +2637,9 @@ export namespace Token { // (undocumented) get value(): number; } + const // (undocumented) + string: typeof String.of, // (undocumented) + isString: typeof String.isString; // (undocumented) export namespace Delim { // (undocumented) @@ -2673,9 +2676,6 @@ export namespace Token { // (undocumented) get value(): number; } - const // (undocumented) - url: typeof URL.of, // (undocumented) - isURL: typeof URL.isURL; // (undocumented) export namespace Dimension { // (undocumented) @@ -2696,40 +2696,41 @@ export namespace Token { value: number; } } + const // (undocumented) + url: typeof URL.of, // (undocumented) + isURL: typeof URL.isURL; // (undocumented) - export class Function implements Equatable, Serializable { - protected constructor(value: string); + export class Function implements Equatable, Serializable { + protected constructor(value: N); // (undocumented) equals(value: unknown): value is this; // (undocumented) get mirror(): CloseParenthesis; // (undocumented) - static of(value: string): Function; + static of(value: N): Function; // (undocumented) - toJSON(): Function.JSON; + toJSON(): Function.JSON; // (undocumented) toString(): string; // (undocumented) get type(): "function"; // (undocumented) - get value(): string; + get value(): N; } // (undocumented) export namespace Function { // (undocumented) export function isFunction(value: unknown): value is Function; // (undocumented) - export interface JSON { + export interface JSON { // (undocumented) [key: string]: json.JSON; // (undocumented) type: "function"; // (undocumented) - value: string; + value: N; } } - const // (undocumented) - badURL: typeof BadURL.of; // (undocumented) export class Hash implements Equatable, Serializable { protected constructor(value: string, isIdentifier: boolean); @@ -2748,6 +2749,8 @@ export namespace Token { // (undocumented) get value(): string; } + const // (undocumented) + badURL: typeof BadURL.of; // (undocumented) export namespace Hash { // (undocumented) @@ -2764,9 +2767,6 @@ export namespace Token { value: string; } } - const // (undocumented) - delim: typeof Delim.of, // (undocumented) - isDelim: typeof Delim.isDelim; // (undocumented) export class Ident implements Equatable, Serializable> { protected constructor(value: N); @@ -2783,6 +2783,9 @@ export namespace Token { // (undocumented) get value(): N; } + const // (undocumented) + delim: typeof Delim.of, // (undocumented) + isDelim: typeof Delim.isDelim; // (undocumented) export namespace Ident { // (undocumented) @@ -2799,9 +2802,6 @@ export namespace Token { } // (undocumented) export type JSON = Ident.JSON | Function.JSON | AtKeyword.JSON | Hash.JSON | String.JSON | URL.JSON | BadURL.JSON | Delim.JSON | Number.JSON | Percentage.JSON | Dimension.JSON | Whitespace.JSON | Colon.JSON | Semicolon.JSON | Comma.JSON | OpenParenthesis.JSON | CloseParenthesis.JSON | OpenSquareBracket.JSON | CloseSquareBracket.JSON | OpenCurlyBracket.JSON | CloseCurlyBracket.JSON | OpenComment.JSON | CloseComment.JSON; - const // (undocumented) - number: typeof Number.of, // (undocumented) - isNumber: typeof Number.isNumber; // (undocumented) export class Number implements Equatable, Serializable { protected constructor(value: number, isInteger: boolean, isSigned: boolean); @@ -2822,6 +2822,9 @@ export namespace Token { // (undocumented) get value(): number; } + const // (undocumented) + number: typeof Number.of, // (undocumented) + isNumber: typeof Number.isNumber; // (undocumented) export namespace Number { // (undocumented) @@ -2853,9 +2856,6 @@ export namespace Token { // (undocumented) get type(): "open-comment"; } - const // (undocumented) - percentage: typeof Percentage.of, // (undocumented) - isPercentage: typeof Percentage.isPercentage; // (undocumented) export namespace OpenComment { // (undocumented) @@ -2868,6 +2868,9 @@ export namespace Token { type: "open-comment"; } } + const // (undocumented) + percentage: typeof Percentage.of, // (undocumented) + isPercentage: typeof Percentage.isPercentage; // (undocumented) export class OpenCurlyBracket implements Equatable, Serializable { // (undocumented) @@ -2895,9 +2898,6 @@ export namespace Token { type: "open-curly-bracket"; } } - const // (undocumented) - dimension: typeof Dimension.of, // (undocumented) - isDimension: typeof Dimension.isDimension; // (undocumented) export class OpenParenthesis implements Equatable, Serializable { // (undocumented) @@ -2913,6 +2913,9 @@ export namespace Token { // (undocumented) get type(): "open-parenthesis"; } + const // (undocumented) + dimension: typeof Dimension.of, // (undocumented) + isDimension: typeof Dimension.isDimension; // (undocumented) export namespace OpenParenthesis { // (undocumented) @@ -2940,11 +2943,6 @@ export namespace Token { // (undocumented) get type(): "open-square-bracket"; } - const // (undocumented) - whitespace: typeof Whitespace.of, // (undocumented) - isWhitespace: typeof Whitespace.isWhitespace; - const // (undocumented) - parseWhitespace: Parser_2, Whitespace, string, []>; // (undocumented) export namespace OpenSquareBracket { // (undocumented) @@ -2957,17 +2955,24 @@ export namespace Token { type: "open-square-bracket"; } } + const // (undocumented) + whitespace: typeof Whitespace.of, // (undocumented) + isWhitespace: typeof Whitespace.isWhitespace; + const // (undocumented) + parseWhitespace: Parser_2, Whitespace, string, []>; // (undocumented) export function parseDelim(query?: string | number | Predicate): Parser; + // (undocumented) + export function parseDimension(predicate?: Predicate): Parser; const // (undocumented) colon: typeof Colon.of, // (undocumented) isColon: typeof Colon.isColon; const // (undocumented) parseColon: Parser; // (undocumented) - export function parseDimension(predicate?: Predicate): Parser; + export function parseFunction(query: N | ReadonlyArray | Refinement>): Parser>; // (undocumented) - export function parseFunction(query?: string | Array_2 | Predicate): Parser; + export function parseFunction(query?: Predicate): Parser; const // (undocumented) semicolon: typeof Semicolon.of, // (undocumented) isSemicolon: typeof Semicolon.isSemicolon; @@ -3267,7 +3272,7 @@ export namespace Translate { const // (undocumented) parse: Parser; const // (undocumented) - parseProp: Parser_2, Translate, LengthPercentage, Length.Fixed<"px">> | Translate, LengthPercentage, Length>, string, []>; + parseProp: Parser_2, Translate, LengthPercentage, Length.Fixed<"px">> | Translate, LengthPercentage, Length>, string, []>; } // Warning: (ae-incompatible-release-tags) The symbol "TrimFlags" is marked as @public, but its signature references "Resolvable" which is marked as @internal diff --git a/docs/review/api/alfa-parser.api.md b/docs/review/api/alfa-parser.api.md index e8c442d86e..7f7a2f1f9c 100644 --- a/docs/review/api/alfa-parser.api.md +++ b/docs/review/api/alfa-parser.api.md @@ -29,6 +29,7 @@ export namespace Parser { export function either = []>(left: Parser, right: Parser, ...rest: Array_2>): Parser; // (undocumented) export function end, E>(ifError: Mapper ? T : unknown, E>): Parser>; + export function exclusive = []>(peeker: Parser, getParser: Mapper>): Parser; // (undocumented) export function filter = []>(parser: Parser, refinement: Refinement, ifError: Mapper): Parser; // (undocumented) diff --git a/docs/review/api/alfa-tuple.api.md b/docs/review/api/alfa-tuple.api.md index e98e325fa5..41c7c81083 100644 --- a/docs/review/api/alfa-tuple.api.md +++ b/docs/review/api/alfa-tuple.api.md @@ -40,6 +40,10 @@ export namespace Tuple { // (undocumented) export function equals(a: T, b: T): boolean; // (undocumented) + export function every>(tuple: T, refinement: Refinement, U, [index: number]>): tuple is { + [K in keyof T]: U extends T[K] ? U : never; + }; + // (undocumented) export function every(tuple: T, predicate: Predicate, [index: number]>): boolean; // (undocumented) export type Filter> = T extends readonly [ @@ -93,7 +97,9 @@ export namespace Tuple { // (undocumented) export function last(tuple: T): Option>; // (undocumented) - export type Map = T extends readonly [infer _, ...infer R] ? [U, ...Map] : Empty; + export type Map = { + [K in keyof T]: U; + }; // (undocumented) export function map(tuple: T, mapper: Mapper, U, [index: number]>): Map; // (undocumented) diff --git a/packages/alfa-css/docs/dependency-graph.dot b/packages/alfa-css/docs/dependency-graph.dot index ea760a60df..1572b189ae 100644 --- a/packages/alfa-css/docs/dependency-graph.dot +++ b/packages/alfa-css/docs/dependency-graph.dot @@ -1,8 +1,19 @@ digraph "dependency-graph-@siteimprove/alfa-css" { compound = true; + "src/calculation/math-expression/expression.ts"; + "exit_src/calculation/math-expression/function"; + "src/calculation/math-expression/function/function.ts"; + "src/calculation/math-expression/kind.ts"; + "src/calculation/math-expression/value.ts"; + "src/calculation/numeric/index.ts"; + "exit_src/calculation/math-expression"; + "name_src/calculation/numeric"; "src/syntax/index.ts"; - "exit_src/value"; + "exit_src/calculation"; "name_src/syntax"; + "src/unit/index.ts"; + "name_src/unit"; + "exit_src/value"; "src/value/color/index.ts"; "exit_src/value/image"; "name_src/value/color"; @@ -10,15 +21,8 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/value/numeric"; "src/value/resolvable.ts"; "src/value/value.ts"; - "src/calculation/math-expression/expression.ts"; - "src/calculation/math-expression/kind.ts"; - "src/calculation/math-expression/value.ts"; - "src/calculation/numeric/index.ts"; - "exit_src/calculation/math-expression"; - "name_src/calculation/numeric"; - "src/unit/index.ts"; - "exit_src/calculation"; - "name_src/unit"; + "src/calculation/math-expression/function/index.ts"; + "name_src/calculation/math-expression/function"; "exit_src/value/collection"; "src/calculation/index.ts"; "name_src/calculation"; @@ -77,6 +81,8 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "src/value/color/current.ts"; "src/value/color/system.ts"; "exit_src/value/color"; + "src/calculation/math-expression/function/calc.ts"; + "src/calculation/math-expression/function/max.ts"; "src/value/textual/custom-ident.ts"; "src/value/textual/string.ts"; "src/value/textual/url.ts"; @@ -97,7 +103,6 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "src/value/numeric/integer.ts"; "src/value/numeric/number.ts"; "src/value/color/color.ts"; - "src/calculation/math-expression/function.ts"; "src/calculation/math-expression/operation.ts"; "src/value/image/gradient/radial/circle.ts"; "src/value/image/gradient/radial/ellipse.ts"; @@ -152,7 +157,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src" [ penwidth = 5; shape = "rectangle"; - color = "#33ff00"; + color = "#00ff00"; label = "src"; ]; "exit_src" [ @@ -160,16 +165,256 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/index.ts" [ label = "index.ts"; - color = "#33ff00"; + color = "#00ff00"; penwidth = 5; ]; + subgraph "cluster_src/calculation" { + color = "#000000"; + label = ""; + "name_src/calculation" [ + penwidth = 5; + shape = "rectangle"; + color = "#ff0049"; + label = "calculation"; + ]; + "exit_src/calculation" [ + style = "invis"; + ]; + "src/calculation/index.ts" [ + label = "index.ts"; + color = "#ff0049"; + penwidth = 5; + ]; + subgraph "cluster_src/calculation/math-expression" { + color = "#000000"; + label = ""; + "name_src/calculation/math-expression" [ + penwidth = 5; + shape = "rectangle"; + color = "#00ffdb"; + label = "math-expression"; + ]; + "exit_src/calculation/math-expression" [ + style = "invis"; + ]; + "src/calculation/math-expression/operation.ts" [ + label = "operation.ts"; + ]; + "src/calculation/math-expression/math.ts" [ + label = "math.ts"; + ]; + "src/calculation/math-expression/index.ts" [ + label = "index.ts"; + color = "#00ffdb"; + penwidth = 5; + ]; + "src/calculation/math-expression/value.ts" [ + label = "value.ts"; + ]; + "src/calculation/math-expression/kind.ts" [ + label = "kind.ts"; + ]; + "src/calculation/math-expression/expression.ts" [ + label = "expression.ts"; + ]; + subgraph "cluster_src/calculation/math-expression/function" { + color = "#000000"; + label = ""; + "name_src/calculation/math-expression/function" [ + penwidth = 5; + shape = "rectangle"; + color = "#49ff00"; + label = "function"; + ]; + "exit_src/calculation/math-expression/function" [ + style = "invis"; + ]; + "src/calculation/math-expression/function/max.ts" [ + label = "max.ts"; + ]; + "src/calculation/math-expression/function/index.ts" [ + label = "index.ts"; + color = "#49ff00"; + penwidth = 5; + ]; + "src/calculation/math-expression/function/calc.ts" [ + label = "calc.ts"; + ]; + "src/calculation/math-expression/function/function.ts" [ + label = "function.ts"; + ]; + "src/calculation/math-expression/function/max.ts" -> "exit_src/calculation/math-expression/function" [ + style = "invis"; + ]; + "src/calculation/math-expression/function/index.ts" -> "exit_src/calculation/math-expression/function" [ + style = "invis"; + ]; + "src/calculation/math-expression/function/calc.ts" -> "exit_src/calculation/math-expression/function" [ + style = "invis"; + ]; + "src/calculation/math-expression/function/function.ts" -> "exit_src/calculation/math-expression/function" [ + style = "invis"; + ]; + } + "exit_src/calculation/math-expression/function" -> "exit_src/calculation/math-expression" [ + style = "invis"; + ]; + "src/calculation/math-expression/operation.ts" -> "exit_src/calculation/math-expression" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression/function" -> "exit_src/calculation/math-expression" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression/function" -> "exit_src/calculation/math-expression" [ + style = "invis"; + ]; + "src/calculation/math-expression/math.ts" -> "exit_src/calculation/math-expression" [ + style = "invis"; + ]; + "src/calculation/math-expression/index.ts" -> "exit_src/calculation/math-expression" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression/function" -> "exit_src/calculation/math-expression" [ + style = "invis"; + ]; + "src/calculation/math-expression/value.ts" -> "exit_src/calculation/math-expression" [ + style = "invis"; + ]; + "src/calculation/math-expression/kind.ts" -> "exit_src/calculation/math-expression" [ + style = "invis"; + ]; + "src/calculation/math-expression/expression.ts" -> "exit_src/calculation/math-expression" [ + style = "invis"; + ]; + } + subgraph "cluster_src/calculation/numeric" { + color = "#000000"; + label = ""; + "name_src/calculation/numeric" [ + penwidth = 5; + shape = "rectangle"; + color = "#00ff49"; + label = "numeric"; + ]; + "exit_src/calculation/numeric" [ + style = "invis"; + ]; + "src/calculation/numeric/numeric.ts" [ + label = "numeric.ts"; + ]; + "src/calculation/numeric/angle.ts" [ + label = "angle.ts"; + ]; + "src/calculation/numeric/length.ts" [ + label = "length.ts"; + ]; + "src/calculation/numeric/index.ts" [ + label = "index.ts"; + color = "#00ff49"; + penwidth = 5; + ]; + "src/calculation/numeric/integer.ts" [ + label = "integer.ts"; + ]; + "src/calculation/numeric/dimension.ts" [ + label = "dimension.ts"; + ]; + "src/calculation/numeric/number.ts" [ + label = "number.ts"; + ]; + "src/calculation/numeric/percentage.ts" [ + label = "percentage.ts"; + ]; + "src/calculation/numeric/numeric.ts" -> "exit_src/calculation/numeric" [ + style = "invis"; + ]; + "src/calculation/numeric/angle.ts" -> "exit_src/calculation/numeric" [ + style = "invis"; + ]; + "src/calculation/numeric/length.ts" -> "exit_src/calculation/numeric" [ + style = "invis"; + ]; + "src/calculation/numeric/index.ts" -> "exit_src/calculation/numeric" [ + style = "invis"; + ]; + "src/calculation/numeric/integer.ts" -> "exit_src/calculation/numeric" [ + style = "invis"; + ]; + "src/calculation/numeric/dimension.ts" -> "exit_src/calculation/numeric" [ + style = "invis"; + ]; + "src/calculation/numeric/number.ts" -> "exit_src/calculation/numeric" [ + style = "invis"; + ]; + "src/calculation/numeric/percentage.ts" -> "exit_src/calculation/numeric" [ + style = "invis"; + ]; + } + "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/numeric" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/numeric" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/numeric" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/numeric" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/numeric" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/numeric" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/numeric" -> "exit_src/calculation" [ + style = "invis"; + ]; + "src/calculation/index.ts" -> "exit_src/calculation" [ + style = "invis"; + ]; + "exit_src/calculation/numeric" -> "exit_src/calculation" [ + style = "invis"; + ]; + } subgraph "cluster_src/value" { color = "#000000"; label = ""; "name_src/value" [ penwidth = 5; shape = "rectangle"; - color = "#3300ff"; + color = "#4900ff"; label = "value"; ]; "exit_src/value" [ @@ -177,7 +422,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/index.ts" [ label = "index.ts"; - color = "#3300ff"; + color = "#4900ff"; penwidth = 5; ]; "src/value/shadow.ts" [ @@ -198,7 +443,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/value/image" [ penwidth = 5; shape = "rectangle"; - color = "#0019ff"; + color = "#0000ff"; label = "image"; ]; "exit_src/value/image" [ @@ -206,7 +451,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/image/index.ts" [ label = "index.ts"; - color = "#0019ff"; + color = "#0000ff"; penwidth = 5; ]; "src/value/image/image.ts" [ @@ -218,7 +463,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/value/image/gradient" [ penwidth = 5; shape = "rectangle"; - color = "#0066ff"; + color = "#0049ff"; label = "gradient"; ]; "exit_src/value/image/gradient" [ @@ -229,7 +474,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/image/gradient/index.ts" [ label = "index.ts"; - color = "#0066ff"; + color = "#0049ff"; penwidth = 5; ]; subgraph "cluster_src/value/image/gradient/item" { @@ -238,7 +483,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/value/image/gradient/item" [ penwidth = 5; shape = "rectangle"; - color = "#8000ff"; + color = "#9200ff"; label = "item"; ]; "exit_src/value/image/gradient/item" [ @@ -252,7 +497,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/image/gradient/item/index.ts" [ label = "index.ts"; - color = "#8000ff"; + color = "#9200ff"; penwidth = 5; ]; "src/value/image/gradient/item/item.ts" [ @@ -277,7 +522,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/value/image/gradient/linear" [ penwidth = 5; shape = "rectangle"; - color = "#ffe600"; + color = "#ffdb00"; label = "linear"; ]; "exit_src/value/image/gradient/linear" [ @@ -291,7 +536,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/image/gradient/linear/index.ts" [ label = "index.ts"; - color = "#ffe600"; + color = "#ffdb00"; penwidth = 5; ]; "src/value/image/gradient/linear/position.ts" [ @@ -328,7 +573,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/value/image/gradient/radial" [ penwidth = 5; shape = "rectangle"; - color = "#ff4c00"; + color = "#ff4900"; label = "radial"; ]; "exit_src/value/image/gradient/radial" [ @@ -351,7 +596,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/image/gradient/radial/index.ts" [ label = "index.ts"; - color = "#ff4c00"; + color = "#ff4900"; penwidth = 5; ]; "src/value/image/gradient/radial/circle.ts" -> "exit_src/value/image/gradient/radial" [ @@ -528,7 +773,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/value/numeric" [ penwidth = 5; shape = "rectangle"; - color = "#ff0099"; + color = "#ff0092"; label = "numeric"; ]; "exit_src/value/numeric" [ @@ -563,7 +808,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/numeric/index.ts" [ label = "index.ts"; - color = "#ff0099"; + color = "#ff0092"; penwidth = 5; ]; "src/value/numeric/integer.ts" -> "exit_src/value/numeric" [ @@ -603,7 +848,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/value/transform" [ penwidth = 5; shape = "rectangle"; - color = "#80ff00"; + color = "#92ff00"; label = "transform"; ]; "exit_src/value/transform" [ @@ -614,7 +859,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/transform/index.ts" [ label = "index.ts"; - color = "#80ff00"; + color = "#92ff00"; penwidth = 5; ]; "src/value/transform/function.ts" [ @@ -672,7 +917,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/value/shape" [ penwidth = 5; shape = "rectangle"; - color = "#00ffff"; + color = "#00dbff"; label = "shape"; ]; "exit_src/value/shape" [ @@ -704,7 +949,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/shape/index.ts" [ label = "index.ts"; - color = "#00ffff"; + color = "#00dbff"; penwidth = 5; ]; "src/value/shape/inset.ts" [ @@ -747,7 +992,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/value/textual" [ penwidth = 5; shape = "rectangle"; - color = "#ccff00"; + color = "#dbff00"; label = "textual"; ]; "exit_src/value/textual" [ @@ -758,7 +1003,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/textual/index.ts" [ label = "index.ts"; - color = "#ccff00"; + color = "#dbff00"; penwidth = 5; ]; "src/value/textual/custom-ident.ts" [ @@ -798,7 +1043,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/value/color" [ penwidth = 5; shape = "rectangle"; - color = "#ff9900"; + color = "#ff9200"; label = "color"; ]; "exit_src/value/color" [ @@ -812,7 +1057,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/color/index.ts" [ label = "index.ts"; - color = "#ff9900"; + color = "#ff9200"; penwidth = 5; ]; "src/value/color/color-mix.ts" [ @@ -855,7 +1100,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/value/position" [ penwidth = 5; shape = "rectangle"; - color = "#ff00e6"; + color = "#ff00db"; label = "position"; ]; "exit_src/value/position" [ @@ -875,7 +1120,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/position/index.ts" [ label = "index.ts"; - color = "#ff00e6"; + color = "#ff00db"; penwidth = 5; ]; "src/value/position/position.ts" -> "exit_src/value/position" [ @@ -900,7 +1145,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/value/flags" [ penwidth = 5; shape = "rectangle"; - color = "#00ff66"; + color = "#00ff92"; label = "flags"; ]; "exit_src/value/flags" [ @@ -911,7 +1156,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/flags/index.ts" [ label = "index.ts"; - color = "#00ff66"; + color = "#00ff92"; penwidth = 5; ]; "src/value/flags/contain.ts" [ @@ -1061,290 +1306,104 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/position" -> "exit_src/value" [ style = "invis"; - ]; - "exit_src/value/image" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/image" -> "exit_src/value" [ - style = "invis"; - ]; - "src/value/box.ts" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/transform" -> "exit_src/value" [ - style = "invis"; - ]; - "src/value/value.ts" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/transform" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/image" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/numeric" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/position" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/transform" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/shape" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/image" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/image" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/transform" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/image" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/image" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/image" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/transform" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/shape" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/image" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/position" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/flags" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/color" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/shape" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/numeric" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/shape" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/collection" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/image" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/numeric" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/numeric" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/position" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/numeric" -> "exit_src/value" [ - style = "invis"; - ]; - "exit_src/value/transform" -> "exit_src/value" [ - style = "invis"; - ]; - } - subgraph "cluster_src/calculation" { - color = "#000000"; - label = ""; - "name_src/calculation" [ - penwidth = 5; - shape = "rectangle"; - color = "#ff004d"; - label = "calculation"; - ]; - "exit_src/calculation" [ - style = "invis"; - ]; - "src/calculation/index.ts" [ - label = "index.ts"; - color = "#ff004d"; - penwidth = 5; - ]; - subgraph "cluster_src/calculation/math-expression" { - color = "#000000"; - label = ""; - "name_src/calculation/math-expression" [ - penwidth = 5; - shape = "rectangle"; - color = "#00ffb3"; - label = "math-expression"; - ]; - "exit_src/calculation/math-expression" [ - style = "invis"; - ]; - "src/calculation/math-expression/operation.ts" [ - label = "operation.ts"; - ]; - "src/calculation/math-expression/math.ts" [ - label = "math.ts"; - ]; - "src/calculation/math-expression/index.ts" [ - label = "index.ts"; - color = "#00ffb3"; - penwidth = 5; - ]; - "src/calculation/math-expression/function.ts" [ - label = "function.ts"; - ]; - "src/calculation/math-expression/value.ts" [ - label = "value.ts"; - ]; - "src/calculation/math-expression/kind.ts" [ - label = "kind.ts"; - ]; - "src/calculation/math-expression/expression.ts" [ - label = "expression.ts"; - ]; - "src/calculation/math-expression/operation.ts" -> "exit_src/calculation/math-expression" [ - style = "invis"; - ]; - "src/calculation/math-expression/math.ts" -> "exit_src/calculation/math-expression" [ - style = "invis"; - ]; - "src/calculation/math-expression/index.ts" -> "exit_src/calculation/math-expression" [ - style = "invis"; - ]; - "src/calculation/math-expression/function.ts" -> "exit_src/calculation/math-expression" [ - style = "invis"; - ]; - "src/calculation/math-expression/value.ts" -> "exit_src/calculation/math-expression" [ - style = "invis"; - ]; - "src/calculation/math-expression/kind.ts" -> "exit_src/calculation/math-expression" [ - style = "invis"; - ]; - "src/calculation/math-expression/expression.ts" -> "exit_src/calculation/math-expression" [ - style = "invis"; - ]; - } - subgraph "cluster_src/calculation/numeric" { - color = "#000000"; - label = ""; - "name_src/calculation/numeric" [ - penwidth = 5; - shape = "rectangle"; - color = "#00ff19"; - label = "numeric"; - ]; - "exit_src/calculation/numeric" [ - style = "invis"; - ]; - "src/calculation/numeric/numeric.ts" [ - label = "numeric.ts"; - ]; - "src/calculation/numeric/angle.ts" [ - label = "angle.ts"; - ]; - "src/calculation/numeric/length.ts" [ - label = "length.ts"; - ]; - "src/calculation/numeric/index.ts" [ - label = "index.ts"; - color = "#00ff19"; - penwidth = 5; - ]; - "src/calculation/numeric/integer.ts" [ - label = "integer.ts"; - ]; - "src/calculation/numeric/dimension.ts" [ - label = "dimension.ts"; - ]; - "src/calculation/numeric/number.ts" [ - label = "number.ts"; - ]; - "src/calculation/numeric/percentage.ts" [ - label = "percentage.ts"; - ]; - "src/calculation/numeric/numeric.ts" -> "exit_src/calculation/numeric" [ - style = "invis"; - ]; - "src/calculation/numeric/angle.ts" -> "exit_src/calculation/numeric" [ - style = "invis"; - ]; - "src/calculation/numeric/length.ts" -> "exit_src/calculation/numeric" [ - style = "invis"; - ]; - "src/calculation/numeric/index.ts" -> "exit_src/calculation/numeric" [ - style = "invis"; - ]; - "src/calculation/numeric/integer.ts" -> "exit_src/calculation/numeric" [ - style = "invis"; - ]; - "src/calculation/numeric/dimension.ts" -> "exit_src/calculation/numeric" [ - style = "invis"; - ]; - "src/calculation/numeric/number.ts" -> "exit_src/calculation/numeric" [ - style = "invis"; - ]; - "src/calculation/numeric/percentage.ts" -> "exit_src/calculation/numeric" [ - style = "invis"; - ]; - } - "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + ]; + "exit_src/value/image" -> "exit_src/value" [ style = "invis"; ]; - "exit_src/calculation/numeric" -> "exit_src/calculation" [ + "exit_src/value/image" -> "exit_src/value" [ style = "invis"; ]; - "exit_src/calculation/numeric" -> "exit_src/calculation" [ + "src/value/box.ts" -> "exit_src/value" [ style = "invis"; ]; - "exit_src/calculation/numeric" -> "exit_src/calculation" [ + "exit_src/value/transform" -> "exit_src/value" [ style = "invis"; ]; - "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + "src/value/value.ts" -> "exit_src/value" [ style = "invis"; ]; - "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + "exit_src/value/transform" -> "exit_src/value" [ style = "invis"; ]; - "exit_src/calculation/numeric" -> "exit_src/calculation" [ + "exit_src/value/image" -> "exit_src/value" [ style = "invis"; ]; - "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + "exit_src/value/numeric" -> "exit_src/value" [ style = "invis"; ]; - "exit_src/calculation/numeric" -> "exit_src/calculation" [ + "exit_src/value/position" -> "exit_src/value" [ style = "invis"; ]; - "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + "exit_src/value/transform" -> "exit_src/value" [ style = "invis"; ]; - "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + "exit_src/value/shape" -> "exit_src/value" [ style = "invis"; ]; - "exit_src/calculation/math-expression" -> "exit_src/calculation" [ + "exit_src/value/image" -> "exit_src/value" [ style = "invis"; ]; - "exit_src/calculation/numeric" -> "exit_src/calculation" [ + "exit_src/value/image" -> "exit_src/value" [ style = "invis"; ]; - "exit_src/calculation/numeric" -> "exit_src/calculation" [ + "exit_src/value/transform" -> "exit_src/value" [ style = "invis"; ]; - "src/calculation/index.ts" -> "exit_src/calculation" [ + "exit_src/value/image" -> "exit_src/value" [ style = "invis"; ]; - "exit_src/calculation/numeric" -> "exit_src/calculation" [ + "exit_src/value/image" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/image" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/transform" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/shape" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/image" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/position" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/flags" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/color" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/shape" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/numeric" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/shape" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/collection" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/image" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/numeric" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/numeric" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/position" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/numeric" -> "exit_src/value" [ + style = "invis"; + ]; + "exit_src/value/transform" -> "exit_src/value" [ style = "invis"; ]; } @@ -1354,7 +1413,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/syntax" [ penwidth = 5; shape = "rectangle"; - color = "#cc00ff"; + color = "#db00ff"; label = "syntax"; ]; "exit_src/syntax" [ @@ -1383,7 +1442,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/syntax/index.ts" [ label = "index.ts"; - color = "#cc00ff"; + color = "#db00ff"; penwidth = 5; ]; "src/syntax/lexer.ts" [ @@ -1435,7 +1494,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "name_src/unit" [ penwidth = 5; shape = "rectangle"; - color = "#00b2ff"; + color = "#0092ff"; label = "unit"; ]; "exit_src/unit" [ @@ -1443,7 +1502,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/unit/index.ts" [ label = "index.ts"; - color = "#00b2ff"; + color = "#0092ff"; penwidth = 5; ]; "src/unit/unit.ts" [ @@ -1462,6 +1521,9 @@ digraph "dependency-graph-@siteimprove/alfa-css" { style = "invis"; ]; } + "exit_src/calculation" -> "exit_src" [ + style = "invis"; + ]; "exit_src/value" -> "exit_src" [ style = "invis"; ]; @@ -1519,6 +1581,9 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "exit_src/value" -> "exit_src" [ style = "invis"; ]; + "exit_src/calculation" -> "exit_src" [ + style = "invis"; + ]; "exit_src/value" -> "exit_src" [ style = "invis"; ]; @@ -1528,6 +1593,9 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "exit_src/value" -> "exit_src" [ style = "invis"; ]; + "exit_src/calculation" -> "exit_src" [ + style = "invis"; + ]; "exit_src/syntax" -> "exit_src" [ style = "invis"; ]; @@ -1621,10 +1689,10 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "exit_src/value" -> "exit_src" [ style = "invis"; ]; - "exit_src/syntax" -> "exit_src" [ + "exit_src/calculation" -> "exit_src" [ style = "invis"; ]; - "exit_src/value" -> "exit_src" [ + "exit_src/syntax" -> "exit_src" [ style = "invis"; ]; "exit_src/value" -> "exit_src" [ @@ -1639,7 +1707,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "exit_src/value" -> "exit_src" [ style = "invis"; ]; - "exit_src/calculation" -> "exit_src" [ + "exit_src/value" -> "exit_src" [ style = "invis"; ]; "exit_src/calculation" -> "exit_src" [ @@ -2111,22 +2179,80 @@ digraph "dependency-graph-@siteimprove/alfa-css" { "exit_src" -> "exit_src" [ style = "invis"; ]; + "exit_src" -> "exit_src" [ + style = "invis"; + ]; + "exit_src" -> "exit_src" [ + style = "invis"; + ]; + "exit_src" -> "exit_src" [ + style = "invis"; + ]; } + "src/calculation/math-expression/function/max.ts" -> "src/calculation/math-expression/expression.ts" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression/function" -> "src/calculation/math-expression/expression.ts" [ + style = "solid"; + color = "#49ff00"; + ltail = "cluster_src/calculation/math-expression/function"; + ]; + "src/calculation/math-expression/function/max.ts" -> "src/calculation/math-expression/function/function.ts" [ + style = "invis"; + ]; + "src/calculation/math-expression/function/max.ts" -> "src/calculation/math-expression/function/function.ts" [ + style = "solid"; + color = "black"; + ]; + "src/calculation/math-expression/function/max.ts" -> "src/calculation/math-expression/kind.ts" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression/function" -> "src/calculation/math-expression/kind.ts" [ + style = "dotted"; + color = "#49ff00"; + ltail = "cluster_src/calculation/math-expression/function"; + ]; + "src/calculation/math-expression/function/max.ts" -> "src/calculation/math-expression/value.ts" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression/function" -> "src/calculation/math-expression/value.ts" [ + style = "solid"; + color = "#49ff00"; + ltail = "cluster_src/calculation/math-expression/function"; + ]; + "exit_src/calculation/math-expression" -> "name_src/calculation/numeric" [ + style = "solid"; + color = "#00ffdb"; + lhead = "cluster_src/calculation/numeric"; + ltail = "cluster_src/calculation/math-expression"; + ]; + "exit_src/calculation" -> "name_src/syntax" [ + style = "solid"; + color = "#ff0049"; + lhead = "cluster_src/syntax"; + ltail = "cluster_src/calculation"; + ]; + "exit_src/calculation" -> "name_src/unit" [ + style = "solid"; + color = "#ff0049"; + lhead = "cluster_src/unit"; + ltail = "cluster_src/calculation"; + ]; "exit_src/value" -> "name_src/syntax" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/image" -> "name_src/value/color" [ style = "solid"; - color = "#0019ff"; + color = "#0000ff"; lhead = "cluster_src/value/color"; ltail = "cluster_src/value/image"; ]; "exit_src/value/image" -> "name_src/value/numeric" [ style = "solid"; - color = "#0019ff"; + color = "#0000ff"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/image"; ]; @@ -2135,7 +2261,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/resolvable.ts" [ style = "dotted"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "src/value/image/gradient/item/stop.ts" -> "src/value/value.ts" [ @@ -2143,7 +2269,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/value.ts" [ style = "solid"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "src/calculation/math-expression/operation.ts" -> "src/calculation/math-expression/expression.ts" [ @@ -2153,6 +2279,11 @@ digraph "dependency-graph-@siteimprove/alfa-css" { style = "solid"; color = "black"; ]; + "src/calculation/math-expression/operation.ts" -> "name_src/calculation/math-expression/function" [ + style = "solid"; + color = "#00ffdb"; + lhead = "cluster_src/calculation/math-expression/function"; + ]; "src/calculation/math-expression/operation.ts" -> "src/calculation/math-expression/kind.ts" [ style = "invis"; ]; @@ -2168,20 +2299,26 @@ digraph "dependency-graph-@siteimprove/alfa-css" { color = "black"; ]; "exit_src/calculation/math-expression" -> "name_src/calculation/numeric" [ - style = "solid"; - color = "#00ffb3"; + style = "invis"; + color = "#00ffdb"; lhead = "cluster_src/calculation/numeric"; ltail = "cluster_src/calculation/math-expression"; ]; + "exit_src/calculation" -> "name_src/syntax" [ + style = "invis"; + color = "#ff0049"; + lhead = "cluster_src/syntax"; + ltail = "cluster_src/calculation"; + ]; "exit_src/calculation" -> "name_src/unit" [ - style = "solid"; - color = "#ff004d"; + style = "invis"; + color = "#ff0049"; lhead = "cluster_src/unit"; ltail = "cluster_src/calculation"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -2203,19 +2340,19 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/calculation" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -2238,30 +2375,30 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/numeric" -> "src/value/resolvable.ts" [ style = "dotted"; - color = "#ff0099"; + color = "#ff0092"; ltail = "cluster_src/value/numeric"; ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/unit" [ style = "dotted"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/unit"; ltail = "cluster_src/value"; ]; @@ -2305,24 +2442,24 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/numeric" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ff0099"; + color = "#ff0092"; ltail = "cluster_src/value/numeric"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/transform" -> "name_src/value/collection" [ style = "solid"; - color = "#80ff00"; + color = "#92ff00"; lhead = "cluster_src/value/collection"; ltail = "cluster_src/value/transform"; ]; "exit_src/value/transform" -> "name_src/value/numeric" [ style = "solid"; - color = "#80ff00"; + color = "#92ff00"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/transform"; ]; @@ -2331,7 +2468,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/transform" -> "src/value/resolvable.ts" [ style = "dotted"; - color = "#80ff00"; + color = "#92ff00"; ltail = "cluster_src/value/transform"; ]; "src/value/transform/rotate.ts" -> "src/value/transform/function.ts" [ @@ -2343,7 +2480,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -2359,7 +2496,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "src/value/image/gradient/linear/corner.ts" -> "src/value/value.ts" [ @@ -2367,7 +2504,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/value.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "src/syntax/function.ts" -> "src/syntax/component.ts" [ @@ -2400,32 +2537,32 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/index.ts" -> "name_src/value/collection" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/value/collection"; ]; "src/value/index.ts" -> "name_src/value/color" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/value/color"; ]; "src/value/index.ts" -> "name_src/value/flags" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/value/flags"; ]; "src/value/index.ts" -> "name_src/value/image" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/value/image"; ]; "src/value/index.ts" -> "name_src/value/numeric" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/value/numeric"; ]; "src/value/index.ts" -> "name_src/value/position" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/value/position"; ]; "src/value/index.ts" -> "src/value/resolvable.ts" [ @@ -2444,17 +2581,17 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/index.ts" -> "name_src/value/shape" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/value/shape"; ]; "src/value/index.ts" -> "name_src/value/textual" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/value/textual"; ]; "src/value/index.ts" -> "name_src/value/transform" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/value/transform"; ]; "src/value/index.ts" -> "src/value/value.ts" [ @@ -2466,13 +2603,13 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/shape" -> "name_src/value/numeric" [ style = "solid"; - color = "#00ffff"; + color = "#00dbff"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/shape"; ]; @@ -2481,7 +2618,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/resolvable.ts" [ style = "dotted"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "src/value/shape/radius.ts" -> "src/value/shape/basic-shape.ts" [ @@ -2493,7 +2630,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "name_src/value/textual" [ style = "solid"; - color = "#00ffff"; + color = "#00dbff"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/shape"; ]; @@ -2502,29 +2639,29 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/value.ts" [ style = "solid"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/unit" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/unit"; ltail = "cluster_src/value"; ]; "src/value/shadow.ts" -> "name_src/value/color" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/value/color"; ]; "src/value/shadow.ts" -> "name_src/value/numeric" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/value/numeric"; ]; "src/value/shadow.ts" -> "src/value/resolvable.ts" [ @@ -2536,7 +2673,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "src/value/shadow.ts" -> "name_src/value/textual" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/value/textual"; ]; "src/value/shadow.ts" -> "src/value/value.ts" [ @@ -2576,13 +2713,13 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/image/gradient/linear" -> "name_src/value/image/gradient/item" [ style = "solid"; - color = "#ffe600"; + color = "#ffdb00"; lhead = "cluster_src/value/image/gradient/item"; ltail = "cluster_src/value/image/gradient/linear"; ]; @@ -2605,7 +2742,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "src/value/image/gradient/linear/linear.ts" -> "src/value/value.ts" [ @@ -2613,12 +2750,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/value.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "src/value/image/index.ts" -> "name_src/value/image/gradient" [ style = "solid"; - color = "#0019ff"; + color = "#0000ff"; lhead = "cluster_src/value/image/gradient"; ]; "src/value/image/index.ts" -> "src/value/image/image.ts" [ @@ -2630,13 +2767,13 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; @@ -2652,7 +2789,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/numeric" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ff0099"; + color = "#ff0092"; ltail = "cluster_src/value/numeric"; ]; "src/value/numeric/numeric.ts" -> "src/value/value.ts" [ @@ -2660,7 +2797,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/numeric" -> "src/value/value.ts" [ style = "solid"; - color = "#ff0099"; + color = "#ff0092"; ltail = "cluster_src/value/numeric"; ]; "src/value/transform/index.ts" -> "src/value/transform/matrix.ts" [ @@ -2714,7 +2851,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -2723,7 +2860,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/textual" -> "src/value/resolvable.ts" [ style = "dotted"; - color = "#ccff00"; + color = "#dbff00"; ltail = "cluster_src/value/textual"; ]; "src/value/textual/keyword.ts" -> "src/value/textual/ident.ts" [ @@ -2735,7 +2872,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -2769,25 +2906,53 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/color" -> "name_src/value/numeric" [ style = "solid"; - color = "#ff9900"; + color = "#ff9200"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/color"; ]; "exit_src/value/color" -> "name_src/value/textual" [ style = "solid"; - color = "#ff9900"; + color = "#ff9200"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/color"; ]; + "src/calculation/math-expression/function/index.ts" -> "src/calculation/math-expression/expression.ts" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression/function" -> "src/calculation/math-expression/expression.ts" [ + style = "invis"; + color = "#49ff00"; + ltail = "cluster_src/calculation/math-expression/function"; + ]; + "src/calculation/math-expression/function/index.ts" -> "src/calculation/math-expression/function/calc.ts" [ + style = "invis"; + ]; + "src/calculation/math-expression/function/index.ts" -> "src/calculation/math-expression/function/calc.ts" [ + style = "solid"; + color = "black"; + ]; + "src/calculation/math-expression/function/index.ts" -> "src/calculation/math-expression/function/max.ts" [ + style = "invis"; + ]; + "src/calculation/math-expression/function/index.ts" -> "src/calculation/math-expression/function/max.ts" [ + style = "solid"; + color = "black"; + ]; + "exit_src/calculation" -> "name_src/syntax" [ + style = "invis"; + color = "#ff0049"; + lhead = "cluster_src/syntax"; + ltail = "cluster_src/calculation"; + ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/shape" -> "name_src/value/numeric" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/shape"; ]; @@ -2796,7 +2961,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "src/value/shape/rectangle.ts" -> "src/value/shape/basic-shape.ts" [ @@ -2808,7 +2973,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "name_src/value/textual" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/shape"; ]; @@ -2817,7 +2982,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/value.ts" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "src/value/textual/index.ts" -> "src/value/textual/custom-ident.ts" [ @@ -2857,7 +3022,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -2866,7 +3031,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/textual" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ccff00"; + color = "#dbff00"; ltail = "cluster_src/value/textual"; ]; "src/value/textual/custom-ident.ts" -> "src/value/textual/ident.ts" [ @@ -2876,6 +3041,55 @@ digraph "dependency-graph-@siteimprove/alfa-css" { style = "solid"; color = "black"; ]; + "src/calculation/math-expression/function/calc.ts" -> "src/calculation/math-expression/expression.ts" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression/function" -> "src/calculation/math-expression/expression.ts" [ + style = "invis"; + color = "#49ff00"; + ltail = "cluster_src/calculation/math-expression/function"; + ]; + "src/calculation/math-expression/function/calc.ts" -> "src/calculation/math-expression/function/function.ts" [ + style = "invis"; + ]; + "src/calculation/math-expression/function/calc.ts" -> "src/calculation/math-expression/function/function.ts" [ + style = "solid"; + color = "black"; + ]; + "src/calculation/math-expression/function/calc.ts" -> "src/calculation/math-expression/kind.ts" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression/function" -> "src/calculation/math-expression/kind.ts" [ + style = "invis"; + color = "#49ff00"; + ltail = "cluster_src/calculation/math-expression/function"; + ]; + "src/calculation/math-expression/function/calc.ts" -> "src/calculation/math-expression/value.ts" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression/function" -> "src/calculation/math-expression/value.ts" [ + style = "invis"; + color = "#49ff00"; + ltail = "cluster_src/calculation/math-expression/function"; + ]; + "exit_src/calculation/math-expression" -> "name_src/calculation/numeric" [ + style = "invis"; + color = "#00ffdb"; + lhead = "cluster_src/calculation/numeric"; + ltail = "cluster_src/calculation/math-expression"; + ]; + "exit_src/calculation" -> "name_src/syntax" [ + style = "invis"; + color = "#ff0049"; + lhead = "cluster_src/syntax"; + ltail = "cluster_src/calculation"; + ]; + "exit_src/calculation" -> "name_src/unit" [ + style = "invis"; + color = "#ff0049"; + lhead = "cluster_src/unit"; + ltail = "cluster_src/calculation"; + ]; "src/syntax/nth.ts" -> "src/syntax/parser.ts" [ style = "invis"; ]; @@ -2892,25 +3106,25 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/color" -> "name_src/value/textual" [ style = "invis"; - color = "#ff9900"; + color = "#ff9200"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/color"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/image" -> "name_src/value/numeric" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/image"; ]; @@ -2919,12 +3133,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "exit_src/value/image" -> "name_src/value/textual" [ style = "solid"; - color = "#0019ff"; + color = "#0000ff"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/image"; ]; @@ -2933,7 +3147,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/value.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "src/syntax/parser.ts" -> "src/syntax/token.ts" [ @@ -2952,19 +3166,19 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -2987,12 +3201,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/numeric" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ff0099"; + color = "#ff0092"; ltail = "cluster_src/value/numeric"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -3001,7 +3215,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/textual" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ccff00"; + color = "#dbff00"; ltail = "cluster_src/value/textual"; ]; "src/value/textual/string.ts" -> "src/value/value.ts" [ @@ -3009,18 +3223,18 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/textual" -> "src/value/value.ts" [ style = "solid"; - color = "#ccff00"; + color = "#dbff00"; ltail = "cluster_src/value/textual"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/shape" -> "name_src/value/position" [ style = "solid"; - color = "#00ffff"; + color = "#00dbff"; lhead = "cluster_src/value/position"; ltail = "cluster_src/value/shape"; ]; @@ -3029,7 +3243,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "src/value/shape/circle.ts" -> "src/value/shape/basic-shape.ts" [ @@ -3048,7 +3262,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "name_src/value/textual" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/shape"; ]; @@ -3057,7 +3271,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/value.ts" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "src/unit/index.ts" -> "src/unit/converter.ts" [ @@ -3076,7 +3290,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -3085,7 +3299,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/box.ts" [ style = "solid"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "src/value/shape/shape.ts" -> "src/value/resolvable.ts" [ @@ -3093,7 +3307,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "src/value/shape/shape.ts" -> "src/value/shape/circle.ts" [ @@ -3133,7 +3347,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "name_src/value/textual" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/shape"; ]; @@ -3142,7 +3356,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/value.ts" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "src/calculation/numeric/angle.ts" -> "src/calculation/numeric/dimension.ts" [ @@ -3153,53 +3367,53 @@ digraph "dependency-graph-@siteimprove/alfa-css" { color = "black"; ]; "exit_src/calculation" -> "name_src/syntax" [ - style = "solid"; - color = "#ff004d"; + style = "invis"; + color = "#ff0049"; lhead = "cluster_src/syntax"; ltail = "cluster_src/calculation"; ]; "exit_src/calculation" -> "name_src/unit" [ style = "invis"; - color = "#ff004d"; + color = "#ff0049"; lhead = "cluster_src/unit"; ltail = "cluster_src/calculation"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "src/value/image/gradient/gradient.ts" -> "name_src/value/image/gradient/item" [ style = "solid"; - color = "#0066ff"; + color = "#0049ff"; lhead = "cluster_src/value/image/gradient/item"; ]; "src/value/image/gradient/gradient.ts" -> "name_src/value/image/gradient/linear" [ style = "solid"; - color = "#0066ff"; + color = "#0049ff"; lhead = "cluster_src/value/image/gradient/linear"; ]; "src/value/image/gradient/gradient.ts" -> "name_src/value/image/gradient/radial" [ style = "solid"; - color = "#0066ff"; + color = "#0049ff"; lhead = "cluster_src/value/image/gradient/radial"; ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -3243,18 +3457,18 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/numeric" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ff0099"; + color = "#ff0092"; ltail = "cluster_src/value/numeric"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/shape" -> "name_src/value/position" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; lhead = "cluster_src/value/position"; ltail = "cluster_src/value/shape"; ]; @@ -3263,7 +3477,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "src/value/shape/ellipse.ts" -> "src/value/shape/basic-shape.ts" [ @@ -3282,7 +3496,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "name_src/value/textual" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/shape"; ]; @@ -3291,7 +3505,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/value.ts" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "src/value/color/index.ts" -> "src/value/color/color.ts" [ @@ -3331,13 +3545,13 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/calculation" -> "name_src/syntax" [ style = "invis"; - color = "#ff004d"; + color = "#ff0049"; lhead = "cluster_src/syntax"; ltail = "cluster_src/calculation"; ]; "exit_src/calculation" -> "name_src/unit" [ style = "invis"; - color = "#ff004d"; + color = "#ff0049"; lhead = "cluster_src/unit"; ltail = "cluster_src/calculation"; ]; @@ -3355,12 +3569,10 @@ digraph "dependency-graph-@siteimprove/alfa-css" { style = "dotted"; color = "black"; ]; - "src/calculation/math-expression/math.ts" -> "src/calculation/math-expression/function.ts" [ - style = "invis"; - ]; - "src/calculation/math-expression/math.ts" -> "src/calculation/math-expression/function.ts" [ + "src/calculation/math-expression/math.ts" -> "name_src/calculation/math-expression/function" [ style = "solid"; - color = "black"; + color = "#00ffdb"; + lhead = "cluster_src/calculation/math-expression/function"; ]; "src/calculation/math-expression/math.ts" -> "src/calculation/math-expression/kind.ts" [ style = "invis"; @@ -3376,34 +3588,21 @@ digraph "dependency-graph-@siteimprove/alfa-css" { style = "solid"; color = "black"; ]; - "src/calculation/math-expression/math.ts" -> "src/calculation/math-expression/value.ts" [ - style = "invis"; - ]; - "src/calculation/math-expression/math.ts" -> "src/calculation/math-expression/value.ts" [ - style = "solid"; - color = "black"; - ]; "exit_src/calculation/math-expression" -> "name_src/calculation/numeric" [ style = "invis"; - color = "#00ffb3"; + color = "#00ffdb"; lhead = "cluster_src/calculation/numeric"; ltail = "cluster_src/calculation/math-expression"; ]; - "exit_src/calculation" -> "name_src/syntax" [ - style = "invis"; - color = "#ff004d"; - lhead = "cluster_src/syntax"; - ltail = "cluster_src/calculation"; - ]; "exit_src/calculation" -> "name_src/unit" [ style = "invis"; - color = "#ff004d"; + color = "#ff0049"; lhead = "cluster_src/unit"; ltail = "cluster_src/calculation"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -3451,13 +3650,13 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/position" -> "name_src/value/numeric" [ style = "dotted"; - color = "#ff00e6"; + color = "#ff00db"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/position"; ]; @@ -3487,12 +3686,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/position" -> "src/value/resolvable.ts" [ style = "dotted"; - color = "#ff00e6"; + color = "#ff00db"; ltail = "cluster_src/value/position"; ]; "exit_src/value/position" -> "name_src/value/textual" [ style = "solid"; - color = "#ff00e6"; + color = "#ff00db"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/position"; ]; @@ -3501,12 +3700,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/position" -> "src/value/value.ts" [ style = "solid"; - color = "#ff00e6"; + color = "#ff00db"; ltail = "cluster_src/value/position"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -3515,12 +3714,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/flags" -> "src/value/resolvable.ts" [ style = "dotted"; - color = "#00ff66"; + color = "#00ff92"; ltail = "cluster_src/value/flags"; ]; "exit_src/value/flags" -> "name_src/value/textual" [ style = "solid"; - color = "#00ff66"; + color = "#00ff92"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/flags"; ]; @@ -3529,7 +3728,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/flags" -> "src/value/value.ts" [ style = "solid"; - color = "#00ff66"; + color = "#00ff92"; ltail = "cluster_src/value/flags"; ]; "src/calculation/math-expression/index.ts" -> "src/calculation/math-expression/expression.ts" [ @@ -3562,13 +3761,13 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/image" -> "name_src/value/numeric" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/image"; ]; @@ -3577,7 +3776,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "src/value/image/gradient/item/hint.ts" -> "src/value/value.ts" [ @@ -3585,18 +3784,18 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/value.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/shape" -> "name_src/value/numeric" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/shape"; ]; @@ -3605,7 +3804,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "src/value/shape/polygon.ts" -> "src/value/shape/basic-shape.ts" [ @@ -3617,7 +3816,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "name_src/value/textual" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/shape"; ]; @@ -3626,24 +3825,24 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/value.ts" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/color" -> "name_src/value/collection" [ style = "dotted"; - color = "#ff9900"; + color = "#ff9200"; lhead = "cluster_src/value/collection"; ltail = "cluster_src/value/color"; ]; @@ -3684,7 +3883,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/color" -> "name_src/value/numeric" [ style = "invis"; - color = "#ff9900"; + color = "#ff9200"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/color"; ]; @@ -3693,12 +3892,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/color" -> "src/value/resolvable.ts" [ style = "dotted"; - color = "#ff9900"; + color = "#ff9200"; ltail = "cluster_src/value/color"; ]; "exit_src/value/color" -> "name_src/value/textual" [ style = "invis"; - color = "#ff9900"; + color = "#ff9200"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/color"; ]; @@ -3707,12 +3906,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/color" -> "src/value/value.ts" [ style = "solid"; - color = "#ff9900"; + color = "#ff9200"; ltail = "cluster_src/value/color"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -3721,7 +3920,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/textual" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ccff00"; + color = "#dbff00"; ltail = "cluster_src/value/textual"; ]; "src/value/textual/url.ts" -> "src/value/value.ts" [ @@ -3729,7 +3928,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/textual" -> "src/value/value.ts" [ style = "invis"; - color = "#ccff00"; + color = "#dbff00"; ltail = "cluster_src/value/textual"; ]; "src/value/transform/function.ts" -> "src/value/value.ts" [ @@ -3737,18 +3936,18 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/transform" -> "src/value/value.ts" [ style = "solid"; - color = "#80ff00"; + color = "#92ff00"; ltail = "cluster_src/value/transform"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/image" -> "name_src/value/numeric" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/image"; ]; @@ -3757,12 +3956,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "exit_src/value/image" -> "name_src/value/textual" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/image"; ]; @@ -3771,7 +3970,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/value.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "src/value/collection/tuple.ts" -> "src/value/resolvable.ts" [ @@ -3790,6 +3989,22 @@ digraph "dependency-graph-@siteimprove/alfa-css" { color = "#ff0000"; ltail = "cluster_src/value/collection"; ]; + "src/calculation/math-expression/function/function.ts" -> "src/calculation/math-expression/expression.ts" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression/function" -> "src/calculation/math-expression/expression.ts" [ + style = "invis"; + color = "#49ff00"; + ltail = "cluster_src/calculation/math-expression/function"; + ]; + "src/calculation/math-expression/function/function.ts" -> "src/calculation/math-expression/kind.ts" [ + style = "invis"; + ]; + "exit_src/calculation/math-expression/function" -> "src/calculation/math-expression/kind.ts" [ + style = "invis"; + color = "#49ff00"; + ltail = "cluster_src/calculation/math-expression/function"; + ]; "src/syntax/index.ts" -> "src/syntax/block.ts" [ style = "invis"; ]; @@ -3855,25 +4070,25 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/color" -> "name_src/value/collection" [ style = "invis"; - color = "#ff9900"; + color = "#ff9200"; lhead = "cluster_src/value/collection"; ltail = "cluster_src/value/color"; ]; "exit_src/value/color" -> "name_src/value/numeric" [ style = "invis"; - color = "#ff9900"; + color = "#ff9200"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/color"; ]; @@ -3882,7 +4097,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/color" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ff9900"; + color = "#ff9200"; ltail = "cluster_src/value/color"; ]; "src/value/color/mix.ts" -> "src/value/value.ts" [ @@ -3890,7 +4105,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/color" -> "src/value/value.ts" [ style = "invis"; - color = "#ff9900"; + color = "#ff9200"; ltail = "cluster_src/value/color"; ]; "src/value/textual/ident.ts" -> "src/value/resolvable.ts" [ @@ -3898,7 +4113,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/textual" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ccff00"; + color = "#dbff00"; ltail = "cluster_src/value/textual"; ]; "src/value/textual/ident.ts" -> "src/value/value.ts" [ @@ -3906,18 +4121,18 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/textual" -> "src/value/value.ts" [ style = "invis"; - color = "#ccff00"; + color = "#dbff00"; ltail = "cluster_src/value/textual"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/color" -> "name_src/value/numeric" [ style = "invis"; - color = "#ff9900"; + color = "#ff9200"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/color"; ]; @@ -3926,7 +4141,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/color" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ff9900"; + color = "#ff9200"; ltail = "cluster_src/value/color"; ]; "src/value/color/css4-color.ts" -> "src/value/value.ts" [ @@ -3934,18 +4149,18 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/color" -> "src/value/value.ts" [ style = "invis"; - color = "#ff9900"; + color = "#ff9200"; ltail = "cluster_src/value/color"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/position" -> "name_src/value/numeric" [ style = "invis"; - color = "#ff00e6"; + color = "#ff00db"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/position"; ]; @@ -3965,7 +4180,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/position" -> "name_src/value/textual" [ style = "invis"; - color = "#ff00e6"; + color = "#ff00db"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/position"; ]; @@ -4025,42 +4240,9 @@ digraph "dependency-graph-@siteimprove/alfa-css" { style = "solid"; color = "black"; ]; - "src/calculation/math-expression/function.ts" -> "src/calculation/math-expression/expression.ts" [ - style = "invis"; - ]; - "src/calculation/math-expression/function.ts" -> "src/calculation/math-expression/expression.ts" [ - style = "solid"; - color = "black"; - ]; - "src/calculation/math-expression/function.ts" -> "src/calculation/math-expression/kind.ts" [ - style = "invis"; - ]; - "src/calculation/math-expression/function.ts" -> "src/calculation/math-expression/kind.ts" [ - style = "dotted"; - color = "black"; - ]; - "src/calculation/math-expression/function.ts" -> "src/calculation/math-expression/value.ts" [ - style = "invis"; - ]; - "src/calculation/math-expression/function.ts" -> "src/calculation/math-expression/value.ts" [ - style = "solid"; - color = "black"; - ]; - "exit_src/calculation/math-expression" -> "name_src/calculation/numeric" [ - style = "invis"; - color = "#00ffb3"; - lhead = "cluster_src/calculation/numeric"; - ltail = "cluster_src/calculation/math-expression"; - ]; - "exit_src/calculation" -> "name_src/unit" [ - style = "invis"; - color = "#ff004d"; - lhead = "cluster_src/unit"; - ltail = "cluster_src/calculation"; - ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -4073,24 +4255,24 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "src/value/box.ts" -> "name_src/value/textual" [ style = "solid"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/value/textual"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/transform" -> "name_src/value/numeric" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/transform"; ]; @@ -4099,7 +4281,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/transform" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; ltail = "cluster_src/value/transform"; ]; "src/value/transform/perspective.ts" -> "src/value/transform/function.ts" [ @@ -4114,7 +4296,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/transform" -> "src/value/value.ts" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; ltail = "cluster_src/value/transform"; ]; "src/value/value.ts" -> "src/value/resolvable.ts" [ @@ -4126,25 +4308,25 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/unit" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/unit"; ltail = "cluster_src/value"; ]; "exit_src/value/transform" -> "name_src/value/collection" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; lhead = "cluster_src/value/collection"; ltail = "cluster_src/value/transform"; ]; "exit_src/value/transform" -> "name_src/value/numeric" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/transform"; ]; @@ -4153,7 +4335,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/transform" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; ltail = "cluster_src/value/transform"; ]; "src/value/transform/translate.ts" -> "src/value/transform/function.ts" [ @@ -4168,38 +4350,38 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/transform" -> "src/value/value.ts" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; ltail = "cluster_src/value/transform"; ]; "src/index.ts" -> "name_src/calculation" [ style = "solid"; - color = "#33ff00"; + color = "#00ff00"; lhead = "cluster_src/calculation"; ]; "src/index.ts" -> "name_src/syntax" [ style = "solid"; - color = "#33ff00"; + color = "#00ff00"; lhead = "cluster_src/syntax"; ]; "src/index.ts" -> "name_src/unit" [ style = "solid"; - color = "#33ff00"; + color = "#00ff00"; lhead = "cluster_src/unit"; ]; "src/index.ts" -> "name_src/value" [ style = "solid"; - color = "#33ff00"; + color = "#00ff00"; lhead = "cluster_src/value"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/image/gradient/radial" -> "name_src/value/image/gradient/item" [ style = "solid"; - color = "#ff4c00"; + color = "#ff4900"; lhead = "cluster_src/value/image/gradient/item"; ltail = "cluster_src/value/image/gradient/radial"; ]; @@ -4219,7 +4401,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "name_src/value/position" [ style = "solid"; - color = "#0019ff"; + color = "#0000ff"; lhead = "cluster_src/value/position"; ltail = "cluster_src/value/image"; ]; @@ -4228,12 +4410,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "exit_src/value/image" -> "name_src/value/textual" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/image"; ]; @@ -4242,7 +4424,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/value.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "src/calculation/numeric/integer.ts" -> "src/calculation/numeric/numeric.ts" [ @@ -4254,31 +4436,31 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/calculation" -> "name_src/syntax" [ style = "invis"; - color = "#ff004d"; + color = "#ff0049"; lhead = "cluster_src/syntax"; ltail = "cluster_src/calculation"; ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/unit" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/unit"; ltail = "cluster_src/value"; ]; @@ -4315,18 +4497,18 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/numeric" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ff0099"; + color = "#ff0092"; ltail = "cluster_src/value/numeric"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/position" -> "name_src/value/numeric" [ style = "invis"; - color = "#ff00e6"; + color = "#ff00db"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/position"; ]; @@ -4342,12 +4524,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/position" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ff00e6"; + color = "#ff00db"; ltail = "cluster_src/value/position"; ]; "exit_src/value/position" -> "name_src/value/textual" [ style = "invis"; - color = "#ff00e6"; + color = "#ff00db"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/position"; ]; @@ -4356,24 +4538,24 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/position" -> "src/value/value.ts" [ style = "invis"; - color = "#ff00e6"; + color = "#ff00db"; ltail = "cluster_src/value/position"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/transform" -> "name_src/value/collection" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; lhead = "cluster_src/value/collection"; ltail = "cluster_src/value/transform"; ]; "exit_src/value/transform" -> "name_src/value/numeric" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/transform"; ]; @@ -4421,7 +4603,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "name_src/value/numeric" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/shape"; ]; @@ -4430,12 +4612,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/value.ts" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -4455,13 +4637,13 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "name_src/value/numeric" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/image"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -4470,12 +4652,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "exit_src/value/image" -> "name_src/value/textual" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/image"; ]; @@ -4484,24 +4666,24 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/value.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/transform" -> "name_src/value/collection" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; lhead = "cluster_src/value/collection"; ltail = "cluster_src/value/transform"; ]; "exit_src/value/transform" -> "name_src/value/numeric" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/transform"; ]; @@ -4510,7 +4692,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/transform" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; ltail = "cluster_src/value/transform"; ]; "src/value/transform/scale.ts" -> "src/value/transform/function.ts" [ @@ -4527,6 +4709,11 @@ digraph "dependency-graph-@siteimprove/alfa-css" { style = "solid"; color = "black"; ]; + "src/calculation/math-expression/value.ts" -> "name_src/calculation/math-expression/function" [ + style = "dotted"; + color = "#00ffdb"; + lhead = "cluster_src/calculation/math-expression/function"; + ]; "src/calculation/math-expression/value.ts" -> "src/calculation/math-expression/kind.ts" [ style = "invis"; ]; @@ -4536,13 +4723,19 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/calculation/math-expression" -> "name_src/calculation/numeric" [ style = "invis"; - color = "#00ffb3"; + color = "#00ffdb"; lhead = "cluster_src/calculation/numeric"; ltail = "cluster_src/calculation/math-expression"; ]; + "exit_src/calculation" -> "name_src/syntax" [ + style = "invis"; + color = "#ff0049"; + lhead = "cluster_src/syntax"; + ltail = "cluster_src/calculation"; + ]; "exit_src/calculation" -> "name_src/unit" [ style = "invis"; - color = "#ff004d"; + color = "#ff0049"; lhead = "cluster_src/unit"; ltail = "cluster_src/calculation"; ]; @@ -4555,7 +4748,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -4575,7 +4768,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/calculation/math-expression" -> "name_src/calculation/numeric" [ style = "invis"; - color = "#00ffb3"; + color = "#00ffdb"; lhead = "cluster_src/calculation/numeric"; ltail = "cluster_src/calculation/math-expression"; ]; @@ -4588,25 +4781,25 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/calculation/math-expression" -> "name_src/calculation/numeric" [ style = "invis"; - color = "#00ffb3"; + color = "#00ffdb"; lhead = "cluster_src/calculation/numeric"; ltail = "cluster_src/calculation/math-expression"; ]; "exit_src/calculation" -> "name_src/unit" [ style = "invis"; - color = "#ff004d"; + color = "#ff0049"; lhead = "cluster_src/unit"; ltail = "cluster_src/calculation"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "src/value/image/image.ts" -> "name_src/value/image/gradient" [ style = "solid"; - color = "#0019ff"; + color = "#0000ff"; lhead = "cluster_src/value/image/gradient"; ]; "src/value/image/image.ts" -> "src/value/resolvable.ts" [ @@ -4614,12 +4807,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "exit_src/value/image" -> "name_src/value/textual" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/image"; ]; @@ -4628,24 +4821,24 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/value.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/transform" -> "name_src/value/collection" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; lhead = "cluster_src/value/collection"; ltail = "cluster_src/value/transform"; ]; "exit_src/value/transform" -> "name_src/value/numeric" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/transform"; ]; @@ -4654,7 +4847,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/transform" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; ltail = "cluster_src/value/transform"; ]; "src/value/transform/skew.ts" -> "src/value/transform/function.ts" [ @@ -4673,7 +4866,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/calculation" -> "name_src/unit" [ style = "invis"; - color = "#ff004d"; + color = "#ff0049"; lhead = "cluster_src/unit"; ltail = "cluster_src/calculation"; ]; @@ -4682,12 +4875,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/value.ts" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -4703,7 +4896,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "src/value/image/gradient/linear/side.ts" -> "src/value/value.ts" [ @@ -4711,18 +4904,18 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/image" -> "src/value/value.ts" [ style = "invis"; - color = "#0019ff"; + color = "#0000ff"; ltail = "cluster_src/value/image"; ]; "exit_src/value/position" -> "name_src/value/textual" [ style = "invis"; - color = "#ff00e6"; + color = "#ff00db"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/position"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -4731,12 +4924,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/flags" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#00ff66"; + color = "#00ff92"; ltail = "cluster_src/value/flags"; ]; "exit_src/value/flags" -> "name_src/value/textual" [ style = "invis"; - color = "#00ff66"; + color = "#00ff92"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/flags"; ]; @@ -4745,12 +4938,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/flags" -> "src/value/value.ts" [ style = "invis"; - color = "#00ff66"; + color = "#00ff92"; ltail = "cluster_src/value/flags"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; @@ -4763,7 +4956,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/color" -> "name_src/value/textual" [ style = "invis"; - color = "#ff9900"; + color = "#ff9200"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/color"; ]; @@ -4783,7 +4976,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/calculation" -> "name_src/syntax" [ style = "invis"; - color = "#ff004d"; + color = "#ff0049"; lhead = "cluster_src/syntax"; ltail = "cluster_src/calculation"; ]; @@ -4873,25 +5066,25 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/unit" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/unit"; ltail = "cluster_src/value"; ]; @@ -4921,18 +5114,18 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/numeric" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ff0099"; + color = "#ff0092"; ltail = "cluster_src/value/numeric"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/shape" -> "name_src/value/numeric" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/shape"; ]; @@ -4941,7 +5134,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "src/value/shape/inset.ts" -> "src/value/shape/basic-shape.ts" [ @@ -4960,7 +5153,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "name_src/value/textual" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; lhead = "cluster_src/value/textual"; ltail = "cluster_src/value/shape"; ]; @@ -4969,7 +5162,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/shape" -> "src/value/value.ts" [ style = "invis"; - color = "#00ffff"; + color = "#00dbff"; ltail = "cluster_src/value/shape"; ]; "src/value/collection/index.ts" -> "src/value/collection/list.ts" [ @@ -4995,25 +5188,25 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/unit" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/unit"; ltail = "cluster_src/value"; ]; @@ -5036,18 +5229,18 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/numeric" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ff0099"; + color = "#ff0092"; ltail = "cluster_src/value/numeric"; ]; "exit_src/value" -> "name_src/calculation" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/calculation"; ltail = "cluster_src/value"; ]; "exit_src/value" -> "name_src/unit" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/unit"; ltail = "cluster_src/value"; ]; @@ -5063,12 +5256,12 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/numeric" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#ff0099"; + color = "#ff0092"; ltail = "cluster_src/value/numeric"; ]; "src/calculation/index.ts" -> "name_src/calculation/math-expression" [ style = "solid"; - color = "#ff004d"; + color = "#ff0049"; lhead = "cluster_src/calculation/math-expression"; ]; "src/value/position/index.ts" -> "src/value/position/position.ts" [ @@ -5087,7 +5280,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/calculation" -> "name_src/syntax" [ style = "invis"; - color = "#ff004d"; + color = "#ff0049"; lhead = "cluster_src/syntax"; ltail = "cluster_src/calculation"; ]; @@ -5156,19 +5349,19 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value" -> "name_src/syntax" [ style = "invis"; - color = "#3300ff"; + color = "#4900ff"; lhead = "cluster_src/syntax"; ltail = "cluster_src/value"; ]; "exit_src/value/transform" -> "name_src/value/collection" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; lhead = "cluster_src/value/collection"; ltail = "cluster_src/value/transform"; ]; "exit_src/value/transform" -> "name_src/value/numeric" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; lhead = "cluster_src/value/numeric"; ltail = "cluster_src/value/transform"; ]; @@ -5177,7 +5370,7 @@ digraph "dependency-graph-@siteimprove/alfa-css" { ]; "exit_src/value/transform" -> "src/value/resolvable.ts" [ style = "invis"; - color = "#80ff00"; + color = "#92ff00"; ltail = "cluster_src/value/transform"; ]; "src/value/transform/matrix.ts" -> "src/value/transform/function.ts" [ diff --git a/packages/alfa-css/docs/dependency-graph.svg b/packages/alfa-css/docs/dependency-graph.svg index 151bf21481..245a59dbbc 100644 --- a/packages/alfa-css/docs/dependency-graph.svg +++ b/packages/alfa-css/docs/dependency-graph.svg @@ -4,232 +4,546 @@ - - + + dependency-graph-@siteimprove/alfa-css - + cluster_src - + cluster_src - + -cluster_src/value - +cluster_src/calculation + -cluster_src/value/image - +cluster_src/calculation/math-expression + -cluster_src/value/image/gradient - +cluster_src/calculation/math-expression/function + -cluster_src/value/image/gradient/item - +cluster_src/calculation/numeric + -cluster_src/value/image/gradient/linear - +cluster_src/value + -cluster_src/value/image/gradient/radial - +cluster_src/value/image + -cluster_src/value/collection - +cluster_src/value/image/gradient + -cluster_src/value/numeric - +cluster_src/value/image/gradient/item + -cluster_src/value/transform - +cluster_src/value/image/gradient/linear + -cluster_src/value/shape - +cluster_src/value/image/gradient/radial + -cluster_src/value/textual - +cluster_src/value/collection + -cluster_src/value/color - +cluster_src/value/numeric + -cluster_src/value/position - +cluster_src/value/transform + -cluster_src/value/flags - +cluster_src/value/shape + -cluster_src/calculation - +cluster_src/value/textual + -cluster_src/calculation/math-expression - +cluster_src/value/color + -cluster_src/calculation/numeric - +cluster_src/value/position + -cluster_src/syntax - +cluster_src/value/flags + +cluster_src/syntax + + + cluster_src/unit - + - + +src/calculation/math-expression/expression.ts + +expression.ts + + + +src/calculation/math-expression/kind.ts + +kind.ts + + + + +src/calculation/math-expression/expression.ts->src/calculation/math-expression/kind.ts + + + + + + + + +exit_src/calculation/math-expression/function->src/calculation/math-expression/expression.ts + + + + + + + + +exit_src/calculation/math-expression/function->src/calculation/math-expression/kind.ts + + + + + + + +src/calculation/math-expression/value.ts + +value.ts + + + +exit_src/calculation/math-expression/function->src/calculation/math-expression/value.ts + + + + + + + + + + +src/calculation/math-expression/function/function.ts + +function.ts + + + + + + + + +src/calculation/math-expression/value.ts->src/calculation/math-expression/expression.ts + + + + + + +src/calculation/math-expression/value.ts->src/calculation/math-expression/kind.ts + + + + + + +name_src/calculation/math-expression/function + +function + + + +src/calculation/math-expression/value.ts->name_src/calculation/math-expression/function + + + + + +src/calculation/numeric/index.ts + +index.ts + + + +src/calculation/numeric/dimension.ts + +dimension.ts + + + + +src/calculation/numeric/index.ts->src/calculation/numeric/dimension.ts + + + + + +src/calculation/numeric/angle.ts + +angle.ts + + + + +src/calculation/numeric/index.ts->src/calculation/numeric/angle.ts + + + + + +src/calculation/numeric/integer.ts + +integer.ts + + + + +src/calculation/numeric/index.ts->src/calculation/numeric/integer.ts + + + + + +src/calculation/numeric/length.ts + +length.ts + + + + +src/calculation/numeric/index.ts->src/calculation/numeric/length.ts + + + + + +src/calculation/numeric/number.ts + +number.ts + + + + +src/calculation/numeric/index.ts->src/calculation/numeric/number.ts + + + + + +src/calculation/numeric/numeric.ts + +numeric.ts + + + + +src/calculation/numeric/index.ts->src/calculation/numeric/numeric.ts + + + + + +src/calculation/numeric/percentage.ts + +percentage.ts + + + + +src/calculation/numeric/index.ts->src/calculation/numeric/percentage.ts + + + + + + + +name_src/calculation/numeric + +numeric + + + +exit_src/calculation/math-expression->name_src/calculation/numeric + + + + + + + + + + + + + + + + + + + + + + src/syntax/index.ts - -index.ts + +index.ts - + src/syntax/component.ts - -component.ts + +component.ts - + src/syntax/index.ts->src/syntax/component.ts - - + + - + src/syntax/parser.ts - -parser.ts + +parser.ts - + src/syntax/index.ts->src/syntax/parser.ts - - + + - + src/syntax/token.ts - -token.ts + +token.ts - + src/syntax/index.ts->src/syntax/token.ts - - + + - + src/syntax/block.ts - -block.ts + +block.ts - + src/syntax/index.ts->src/syntax/block.ts - - + + - + src/syntax/function.ts - -function.ts + +function.ts - + src/syntax/index.ts->src/syntax/function.ts - - + + - + src/syntax/comma.ts - -comma.ts + +comma.ts - + src/syntax/index.ts->src/syntax/comma.ts - - + + - + src/syntax/declaration.ts - -declaration.ts + +declaration.ts - + src/syntax/index.ts->src/syntax/declaration.ts - - + + - + src/syntax/lexer.ts - -lexer.ts + +lexer.ts - + src/syntax/index.ts->src/syntax/lexer.ts - - + + - + src/syntax/nth.ts - -nth.ts + +nth.ts - + src/syntax/index.ts->src/syntax/nth.ts - - + + - - + name_src/syntax - -syntax + +syntax + + +exit_src/calculation->name_src/syntax + + + + + + + + + + + + + + +name_src/unit + +unit + + + +exit_src/calculation->name_src/unit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +src/unit/index.ts + +index.ts + + + +src/unit/converter.ts + +converter.ts + + + + +src/unit/index.ts->src/unit/converter.ts + + + + + +src/unit/unit.ts + +unit.ts + + + + +src/unit/index.ts->src/unit/unit.ts + + + + + + - + exit_src/value->name_src/syntax - - + + @@ -286,17 +600,11 @@ - - -name_src/unit - -unit - - + exit_src/value->name_src/unit - - + + @@ -305,16 +613,16 @@ - + name_src/calculation - -calculation + +calculation - + exit_src/value->name_src/calculation - - + + @@ -332,7 +640,6 @@ - @@ -412,64 +719,64 @@ - + src/value/color/index.ts - -index.ts + +index.ts - + src/value/color/css4-color.ts - -css4-color.ts + +css4-color.ts - + src/value/color/index.ts->src/value/color/css4-color.ts - - + + - + src/value/color/current.ts - -current.ts + +current.ts - + src/value/color/index.ts->src/value/color/current.ts - - + + - + src/value/color/system.ts - -system.ts + +system.ts - + src/value/color/index.ts->src/value/color/system.ts - - + + - + src/value/color/color.ts - -color.ts + +color.ts - + src/value/color/index.ts->src/value/color/color.ts - - + + @@ -493,44 +800,44 @@ - + name_src/value/color - -color + +color - + exit_src/value/image->name_src/value/color - - + + - + name_src/value/numeric - -numeric + +numeric - + exit_src/value/image->name_src/value/numeric - - + + - + src/value/resolvable.ts - -resolvable.ts + +resolvable.ts - + exit_src/value/image->src/value/resolvable.ts - - + + @@ -542,16 +849,16 @@ - + src/value/value.ts - -value.ts + +value.ts - + exit_src/value/image->src/value/value.ts - - + + @@ -563,476 +870,269 @@ - + name_src/value/position - -position + +position - + exit_src/value/image->name_src/value/position - - + + - + name_src/value/textual - -textual + +textual - + exit_src/value/image->name_src/value/textual - - + + - + src/value/numeric/index.ts - -index.ts + +index.ts - + src/value/numeric/length.ts - -length.ts + +length.ts - + src/value/numeric/index.ts->src/value/numeric/length.ts - - + + - + src/value/numeric/numeric.ts - -numeric.ts + +numeric.ts - + src/value/numeric/index.ts->src/value/numeric/numeric.ts - - + + - + src/value/numeric/angle.ts - -angle.ts + +angle.ts - + src/value/numeric/index.ts->src/value/numeric/angle.ts - - + + - + src/value/numeric/dimension.ts - -dimension.ts + +dimension.ts - + src/value/numeric/index.ts->src/value/numeric/dimension.ts - - + + - + src/value/numeric/percentage.ts - -percentage.ts + +percentage.ts - + src/value/numeric/index.ts->src/value/numeric/percentage.ts - - + + - + src/value/numeric/integer.ts - -integer.ts + +integer.ts - + src/value/numeric/index.ts->src/value/numeric/integer.ts - - + + - + src/value/numeric/number.ts - -number.ts + +number.ts - + src/value/numeric/index.ts->src/value/numeric/number.ts - - + + - + src/value/numeric/angle-percentage.ts - -angle-percentage.ts + +angle-percentage.ts - + src/value/numeric/index.ts->src/value/numeric/angle-percentage.ts - - + + - + src/value/numeric/length-percentage.ts - -length-percentage.ts + +length-percentage.ts - + src/value/numeric/index.ts->src/value/numeric/length-percentage.ts - - + + - + src/value/resolvable.ts->src/value/value.ts - - + + - + src/value/value.ts->src/value/resolvable.ts - - - - - -src/calculation/math-expression/expression.ts - -expression.ts - - - -src/calculation/math-expression/kind.ts - -kind.ts - - - - -src/calculation/math-expression/expression.ts->src/calculation/math-expression/kind.ts - - - - - - - - -src/calculation/math-expression/value.ts - -value.ts - - - - -src/calculation/math-expression/value.ts->src/calculation/math-expression/expression.ts - - - - - - -src/calculation/math-expression/value.ts->src/calculation/math-expression/kind.ts - - - - - - -src/calculation/numeric/index.ts - -index.ts - - - -src/calculation/numeric/dimension.ts - -dimension.ts - - - - -src/calculation/numeric/index.ts->src/calculation/numeric/dimension.ts - - - - - -src/calculation/numeric/angle.ts - -angle.ts - - - - -src/calculation/numeric/index.ts->src/calculation/numeric/angle.ts - - - - - -src/calculation/numeric/integer.ts - -integer.ts - - - - -src/calculation/numeric/index.ts->src/calculation/numeric/integer.ts - - - - - -src/calculation/numeric/length.ts - -length.ts - - - - -src/calculation/numeric/index.ts->src/calculation/numeric/length.ts - - - - - -src/calculation/numeric/number.ts - -number.ts - - - - -src/calculation/numeric/index.ts->src/calculation/numeric/number.ts - - - - - -src/calculation/numeric/numeric.ts - -numeric.ts - - - - -src/calculation/numeric/index.ts->src/calculation/numeric/numeric.ts - - - - - -src/calculation/numeric/percentage.ts - -percentage.ts - - - - -src/calculation/numeric/index.ts->src/calculation/numeric/percentage.ts - - + + - - - - -name_src/calculation/numeric - -numeric - - - -exit_src/calculation/math-expression->name_src/calculation/numeric - - - - - - - - - - - - - - - - - - -src/unit/index.ts - -index.ts + + +src/calculation/math-expression/function/index.ts + +index.ts - + + + + +src/calculation/math-expression/function/calc.ts + +calc.ts + + + + +src/calculation/math-expression/function/index.ts->src/calculation/math-expression/function/calc.ts + + + + -src/unit/converter.ts - -converter.ts - - - - -src/unit/index.ts->src/unit/converter.ts - - +src/calculation/math-expression/function/max.ts + +max.ts - - -src/unit/unit.ts - -unit.ts - - - - -src/unit/index.ts->src/unit/unit.ts - - - - - - - -exit_src/calculation->name_src/syntax - - - - - - - - - - -exit_src/calculation->name_src/unit - - + + + +src/calculation/math-expression/function/index.ts->src/calculation/math-expression/function/max.ts + + - - - - - - - - - - - - - - - - - - - - - - - - + exit_src/value/collection->src/value/resolvable.ts - - + + - + exit_src/value/collection->src/value/value.ts - - + + - + src/calculation/index.ts - -index.ts + +index.ts - + name_src/calculation/math-expression - -math-expression + +math-expression - + src/calculation/index.ts->name_src/calculation/math-expression - - + + - + src/value/numeric/length.ts->src/value/numeric/numeric.ts - - + + - + src/value/numeric/length.ts->src/value/numeric/dimension.ts - - + + - + src/value/numeric/numeric.ts->src/value/numeric/length.ts - - + + @@ -1046,10 +1146,10 @@ - + exit_src/value/numeric->src/value/resolvable.ts - - + + @@ -1060,112 +1160,112 @@ - + exit_src/value/numeric->src/value/value.ts - - + + - + src/value/numeric/angle.ts->src/value/numeric/length.ts - - + + - + src/value/numeric/angle.ts->src/value/numeric/numeric.ts - - + + - + src/value/numeric/angle.ts->src/value/numeric/dimension.ts - - + + - + src/value/numeric/dimension.ts->src/value/numeric/numeric.ts - - + + - + src/value/numeric/percentage.ts->src/value/numeric/length.ts - - + + - + src/value/numeric/percentage.ts->src/value/numeric/numeric.ts - - + + - + src/value/numeric/percentage.ts->src/value/numeric/angle.ts - - + + - + src/value/numeric/percentage.ts->src/value/numeric/integer.ts - - + + - + src/value/numeric/percentage.ts->src/value/numeric/number.ts - - + + - + src/value/collection/index.ts - -index.ts + +index.ts - + src/value/collection/list.ts - -list.ts + +list.ts - + src/value/collection/index.ts->src/value/collection/list.ts - - + + - + src/value/collection/tuple.ts - -tuple.ts + +tuple.ts - + src/value/collection/index.ts->src/value/collection/tuple.ts - - + + @@ -1178,10 +1278,10 @@ - + exit_src/value/transform->name_src/value/numeric - - + + @@ -1190,10 +1290,10 @@ - + exit_src/value/transform->src/value/resolvable.ts - - + + @@ -1201,24 +1301,24 @@ - + exit_src/value/transform->src/value/value.ts - - + + - + name_src/value/collection - -collection + +collection - + exit_src/value/transform->name_src/value/collection - - + + @@ -1226,498 +1326,498 @@ - + src/value/transform/function.ts - -function.ts + +function.ts - + src/value/image/gradient/linear/position.ts - -position.ts + +position.ts - + src/syntax/component.ts->src/syntax/parser.ts - - + + - + src/syntax/component.ts->src/syntax/token.ts - - + + - + src/syntax/component.ts->src/syntax/block.ts - - + + - + src/syntax/component.ts->src/syntax/function.ts - - + + - + src/syntax/parser.ts->src/syntax/token.ts - - + + - + src/syntax/token.ts->src/syntax/parser.ts - - + + - + src/value/box.ts - -box.ts + +box.ts - + src/value/box.ts->name_src/value/textual - - + + - + src/value/flags/index.ts - -index.ts + +index.ts - + src/value/flags/contain.ts - -contain.ts + +contain.ts - + src/value/flags/index.ts->src/value/flags/contain.ts - - + + - + src/value/flags/trim.ts - -trim.ts + +trim.ts - + src/value/flags/index.ts->src/value/flags/trim.ts - - + + - + name_src/value/flags - -flags + +flags - + src/value/image/index.ts - -index.ts + +index.ts - + name_src/value/image/gradient - -gradient + +gradient - + src/value/image/index.ts->name_src/value/image/gradient - - + + - + src/value/image/image.ts - -image.ts + +image.ts - + src/value/image/index.ts->src/value/image/image.ts - - + + - + name_src/value/image - -image + +image - + src/value/position/index.ts - -index.ts + +index.ts - + src/value/position/position.ts - -position.ts + +position.ts - + src/value/position/index.ts->src/value/position/position.ts - - + + - + src/value/shadow.ts - -shadow.ts + +shadow.ts - + src/value/shadow.ts->name_src/value/color - - + + - + src/value/shadow.ts->name_src/value/numeric - - + + - + src/value/shadow.ts->src/value/resolvable.ts - - + + - + src/value/shadow.ts->src/value/value.ts - - + + - + src/value/shadow.ts->name_src/value/textual - - + + - + src/value/shape/index.ts - -index.ts + +index.ts - + src/value/shape/radius.ts - -radius.ts + +radius.ts - + src/value/shape/index.ts->src/value/shape/radius.ts - - + + - + src/value/shape/circle.ts - -circle.ts + +circle.ts - + src/value/shape/index.ts->src/value/shape/circle.ts - - + + - + src/value/shape/ellipse.ts - -ellipse.ts + +ellipse.ts - + src/value/shape/index.ts->src/value/shape/ellipse.ts - - + + - + src/value/shape/inset.ts - -inset.ts + +inset.ts - + src/value/shape/index.ts->src/value/shape/inset.ts - - + + - + src/value/shape/polygon.ts - -polygon.ts + +polygon.ts - + src/value/shape/index.ts->src/value/shape/polygon.ts - - + + - + src/value/shape/rectangle.ts - -rectangle.ts + +rectangle.ts - + src/value/shape/index.ts->src/value/shape/rectangle.ts - - + + - + src/value/shape/shape.ts - -shape.ts + +shape.ts - + src/value/shape/index.ts->src/value/shape/shape.ts - - + + - + name_src/value/shape - -shape + +shape - + src/value/textual/index.ts - -index.ts + +index.ts - + src/value/textual/keyword.ts - -keyword.ts + +keyword.ts - + src/value/textual/index.ts->src/value/textual/keyword.ts - - + + - + src/value/textual/ident.ts - -ident.ts + +ident.ts - + src/value/textual/index.ts->src/value/textual/ident.ts - - + + - + src/value/textual/custom-ident.ts - -custom-ident.ts + +custom-ident.ts - + src/value/textual/index.ts->src/value/textual/custom-ident.ts - - + + - + src/value/textual/string.ts - -string.ts + +string.ts - + src/value/textual/index.ts->src/value/textual/string.ts - - + + - + src/value/textual/url.ts - -url.ts + +url.ts - + src/value/textual/index.ts->src/value/textual/url.ts - - + + - + src/value/transform/index.ts - -index.ts + +index.ts - + src/value/transform/matrix.ts - -matrix.ts + +matrix.ts - + src/value/transform/index.ts->src/value/transform/matrix.ts - - + + - + src/value/transform/perspective.ts - -perspective.ts + +perspective.ts - + src/value/transform/index.ts->src/value/transform/perspective.ts - - + + - + src/value/transform/rotate.ts - -rotate.ts + +rotate.ts - + src/value/transform/index.ts->src/value/transform/rotate.ts - - + + - + src/value/transform/scale.ts - -scale.ts + +scale.ts - + src/value/transform/index.ts->src/value/transform/scale.ts - - + + - + src/value/transform/skew.ts - -skew.ts + +skew.ts - + src/value/transform/index.ts->src/value/transform/skew.ts - - + + - + src/value/transform/transform.ts - -transform.ts + +transform.ts - + src/value/transform/index.ts->src/value/transform/transform.ts - - + + - + src/value/transform/translate.ts - -translate.ts + +translate.ts - + src/value/transform/index.ts->src/value/transform/translate.ts - - + + - + name_src/value/transform - -transform + +transform @@ -1730,20 +1830,20 @@ - + exit_src/value/shape->name_src/value/numeric - - + + - + exit_src/value/shape->src/value/resolvable.ts - - + + @@ -1752,10 +1852,10 @@ - + exit_src/value/shape->src/value/value.ts - - + + @@ -1766,23 +1866,23 @@ - + exit_src/value/shape->src/value/box.ts - - + + - + exit_src/value/shape->name_src/value/position - - + + - + exit_src/value/shape->name_src/value/textual - - + + @@ -1791,10 +1891,10 @@ - + src/value/shape/basic-shape.ts - -basic-shape.ts + +basic-shape.ts @@ -1802,87 +1902,87 @@ - + src/value/textual/keyword.ts->src/value/textual/ident.ts - - + + - + src/syntax/block.ts->src/syntax/component.ts - - + + - + src/syntax/block.ts->src/syntax/parser.ts - - + + - + src/syntax/block.ts->src/syntax/token.ts - - + + - + src/syntax/function.ts->src/syntax/component.ts - - + + - + src/syntax/function.ts->src/syntax/parser.ts - - + + - + src/syntax/function.ts->src/syntax/token.ts - - + + - + src/value/image/gradient/item/index.ts - -index.ts + +index.ts - + src/value/image/gradient/item/item.ts - -item.ts + +item.ts - + src/value/image/gradient/item/index.ts->src/value/image/gradient/item/item.ts - - + + - + name_src/value/image/gradient/item - -item + +item - + exit_src/value/image/gradient/linear->name_src/value/image/gradient/item - - + + @@ -1892,175 +1992,175 @@ - + src/value/image/gradient/linear/direction.ts - -direction.ts + +direction.ts - + src/value/image/gradient/linear/side.ts - -side.ts + +side.ts - + src/value/image/gradient/linear/direction.ts->src/value/image/gradient/linear/side.ts - - + + - + src/value/image/gradient/linear/corner.ts - -corner.ts + +corner.ts - + src/value/image/gradient/linear/direction.ts->src/value/image/gradient/linear/corner.ts - - + + - + src/value/image/gradient/linear/side.ts->src/value/image/gradient/linear/position.ts - - + + - + src/value/image/gradient/index.ts - -index.ts + +index.ts - + src/value/image/gradient/gradient.ts - -gradient.ts + +gradient.ts - + src/value/image/gradient/index.ts->src/value/image/gradient/gradient.ts - - + + - + src/value/image/image.ts->name_src/value/image/gradient - - + + - + src/value/transform/matrix.ts->src/value/transform/function.ts - - + + - + src/value/transform/perspective.ts->src/value/transform/function.ts - - + + - + src/value/transform/rotate.ts->src/value/transform/function.ts - - + + - + src/value/transform/scale.ts->src/value/transform/function.ts - - + + - + src/value/transform/skew.ts->src/value/transform/function.ts - - + + - + src/value/transform/transform.ts->src/value/transform/matrix.ts - - + + - + src/value/transform/transform.ts->src/value/transform/perspective.ts - - + + - + src/value/transform/transform.ts->src/value/transform/rotate.ts - - + + - + src/value/transform/transform.ts->src/value/transform/scale.ts - - + + - + src/value/transform/transform.ts->src/value/transform/skew.ts - - + + - + src/value/transform/transform.ts->src/value/transform/translate.ts - - + + - + src/value/transform/translate.ts->src/value/transform/function.ts - - + + @@ -2069,20 +2169,20 @@ - + exit_src/value/textual->src/value/resolvable.ts - - + + - + exit_src/value/textual->src/value/value.ts - - + + @@ -2090,54 +2190,54 @@ - + src/value/color/color-mix.ts - -color-mix.ts + +color-mix.ts - + src/value/color/color-mix.ts->src/value/color/css4-color.ts - - + + - + src/value/color/color-mix.ts->src/value/color/current.ts - - + + - + src/value/color/color-mix.ts->src/value/color/system.ts - - + + - + src/value/color/color-mix.ts->src/value/color/color.ts - - + + - + src/value/color/mix.ts - -mix.ts + +mix.ts - + src/value/color/color-mix.ts->src/value/color/mix.ts - - + + @@ -2145,10 +2245,10 @@ - + src/value/color/system.ts->src/value/color/css4-color.ts - - + + @@ -2159,54 +2259,76 @@ - + exit_src/value/color->name_src/value/numeric - - + + - + exit_src/value/color->src/value/resolvable.ts - - + + - + exit_src/value/color->src/value/value.ts - - + + - + exit_src/value/color->name_src/value/collection - - + + - + exit_src/value/color->name_src/value/textual - - + + + + + + + +src/calculation/math-expression/function/calc.ts->src/calculation/math-expression/function/function.ts + + + + + + + + + + +src/calculation/math-expression/function/max.ts->src/calculation/math-expression/function/function.ts + + + + + - + src/value/textual/custom-ident.ts->src/value/textual/ident.ts - - + + @@ -2215,44 +2337,44 @@ - + src/value/image/gradient/linear/linear.ts - -linear.ts + +linear.ts - + src/value/image/gradient/linear/linear.ts->src/value/image/gradient/linear/direction.ts - - + + - + src/value/image/gradient/linear/linear.ts->src/value/image/gradient/linear/side.ts - - + + - + src/value/shape/radius.ts->src/value/shape/basic-shape.ts - - + + - + src/unit/converter.ts->src/unit/unit.ts - - + + @@ -2261,273 +2383,251 @@ - + src/value/shape/circle.ts->src/value/shape/basic-shape.ts - - + + - + src/value/shape/circle.ts->src/value/shape/radius.ts - - + + - + src/value/shape/ellipse.ts->src/value/shape/basic-shape.ts - - + + - + src/value/shape/ellipse.ts->src/value/shape/radius.ts - - + + - + src/value/shape/inset.ts->src/value/shape/basic-shape.ts - - + + - + src/value/shape/corner.ts - -corner.ts + +corner.ts - + src/value/shape/inset.ts->src/value/shape/corner.ts - - + + - + src/value/shape/polygon.ts->src/value/shape/basic-shape.ts - - + + - + src/value/shape/rectangle.ts->src/value/shape/basic-shape.ts - - + + - + src/calculation/numeric/dimension.ts->src/calculation/numeric/numeric.ts - - + + - + src/value/image/gradient/linear/index.ts - -index.ts + +index.ts - + src/value/image/gradient/linear/index.ts->src/value/image/gradient/linear/linear.ts - - + + - + name_src/value/image/gradient/linear - -linear + +linear - + src/value/image/gradient/radial/index.ts - -index.ts + +index.ts - + src/value/image/gradient/radial/radial.ts - -radial.ts + +radial.ts - + src/value/image/gradient/radial/index.ts->src/value/image/gradient/radial/radial.ts - - + + - + name_src/value/image/gradient/radial - -radial + +radial - + src/value/numeric/integer.ts->src/value/numeric/length.ts - - + + - + src/value/numeric/integer.ts->src/value/numeric/numeric.ts - - + + - + src/value/numeric/number.ts->src/value/numeric/length.ts - - + + - + src/value/numeric/number.ts->src/value/numeric/numeric.ts - - + + - + src/value/color/color.ts->src/value/color/color-mix.ts - - + + - + src/value/color/color.ts->src/value/color/css4-color.ts - - + + - + src/value/color/color.ts->src/value/color/current.ts - - + + - + src/value/color/color.ts->src/value/color/system.ts - - + + - - -src/calculation/math-expression/function.ts - -function.ts - - - - -src/calculation/math-expression/function.ts->src/calculation/math-expression/expression.ts - - - - - - -src/calculation/math-expression/function.ts->src/calculation/math-expression/kind.ts - - - - - - -src/calculation/math-expression/function.ts->src/calculation/math-expression/value.ts - - - - - + src/calculation/math-expression/operation.ts - -operation.ts + +operation.ts - + src/calculation/math-expression/operation.ts->src/calculation/math-expression/expression.ts - - + + - + src/calculation/math-expression/operation.ts->src/calculation/math-expression/kind.ts - - + + - + src/calculation/math-expression/operation.ts->src/calculation/math-expression/value.ts - - + + + + +src/calculation/math-expression/operation.ts->name_src/calculation/math-expression/function + + + - + src/value/image/gradient/radial/circle.ts - -circle.ts + +circle.ts - + src/value/image/gradient/radial/ellipse.ts - -ellipse.ts + +ellipse.ts - + src/value/image/gradient/radial/extent.ts - -extent.ts + +extent.ts @@ -2538,68 +2638,68 @@ - + exit_src/value/position->name_src/value/numeric - - + + - + exit_src/value/position->src/value/resolvable.ts - - + + - + exit_src/value/position->src/value/value.ts - - + + - + exit_src/value/position->name_src/value/textual - - + + - + src/value/position/component.ts - -component.ts + +component.ts - + src/value/position/keywords.ts - -keywords.ts + +keywords.ts - + src/value/position/component.ts->src/value/position/keywords.ts - - + + - + src/value/position/side.ts - -side.ts + +side.ts - + src/value/position/component.ts->src/value/position/side.ts - - + + @@ -2607,76 +2707,68 @@ - + src/value/position/side.ts->src/value/position/keywords.ts - - + + - + exit_src/value/flags->src/value/resolvable.ts - - + + - + exit_src/value/flags->src/value/value.ts - - + + - + exit_src/value/flags->name_src/value/textual - - + + - + src/calculation/math-expression/math.ts - -math.ts + +math.ts - + src/calculation/math-expression/math.ts->src/calculation/math-expression/expression.ts - - + + - + src/calculation/math-expression/math.ts->src/calculation/math-expression/kind.ts - - - - - - -src/calculation/math-expression/math.ts->src/calculation/math-expression/value.ts - - + + - - - -src/calculation/math-expression/math.ts->src/calculation/math-expression/function.ts - - + + +src/calculation/math-expression/math.ts->name_src/calculation/math-expression/function + + - + src/calculation/math-expression/math.ts->src/calculation/math-expression/operation.ts - - + + @@ -2689,225 +2781,225 @@ - + src/syntax/comma.ts->src/syntax/token.ts - - + + - + src/syntax/declaration.ts->src/syntax/component.ts - - + + - + src/syntax/declaration.ts->src/syntax/parser.ts - - + + - + src/syntax/declaration.ts->src/syntax/token.ts - - + + - + src/syntax/lexer.ts->src/syntax/token.ts - - + + - + src/syntax/nth.ts->src/syntax/parser.ts - - + + - + src/syntax/nth.ts->src/syntax/token.ts - - + + - + src/value/image/gradient/item/hint.ts - -hint.ts + +hint.ts - + src/value/image/gradient/item/item.ts->src/value/image/gradient/item/hint.ts - - + + - + src/value/image/gradient/item/stop.ts - -stop.ts + +stop.ts - + src/value/image/gradient/item/item.ts->src/value/image/gradient/item/stop.ts - - + + - + src/calculation/numeric/angle.ts->src/calculation/numeric/dimension.ts - - + + - + src/calculation/numeric/integer.ts->src/calculation/numeric/numeric.ts - - + + - + src/calculation/numeric/length.ts->src/calculation/numeric/dimension.ts - - + + - + src/calculation/numeric/number.ts->src/calculation/numeric/numeric.ts - - + + - + src/calculation/numeric/percentage.ts->src/calculation/numeric/numeric.ts - - + + - + src/value/index.ts - -index.ts + +index.ts - + src/value/index.ts->name_src/value/color - - + + - + src/value/index.ts->name_src/value/numeric - - + + - + src/value/index.ts->src/value/resolvable.ts - - + + - + src/value/index.ts->src/value/value.ts - - + + - + src/value/index.ts->name_src/value/collection - - + + - + src/value/index.ts->src/value/box.ts - - + + - + src/value/index.ts->name_src/value/flags - - + + - + src/value/index.ts->name_src/value/image - - + + - + src/value/index.ts->name_src/value/position - - + + - + src/value/index.ts->src/value/shadow.ts - - + + - + src/value/index.ts->name_src/value/shape - - + + - + src/value/index.ts->name_src/value/textual - - + + - + src/value/index.ts->name_src/value/transform - - + + - + name_src/value - -value + +value - + exit_src/value/image/gradient/radial->name_src/value/image/gradient/item - - + + @@ -2916,60 +3008,60 @@ - + src/value/image/gradient/radial/shape.ts - -shape.ts + +shape.ts - + src/value/image/gradient/radial/shape.ts->src/value/image/gradient/radial/circle.ts - - + + - + src/value/image/gradient/radial/shape.ts->src/value/image/gradient/radial/ellipse.ts - - + + - + src/value/image/gradient/radial/shape.ts->src/value/image/gradient/radial/extent.ts - - + + - + src/value/image/gradient/linear/corner.ts->src/value/image/gradient/linear/position.ts - - + + - + src/value/image/gradient/gradient.ts->name_src/value/image/gradient/item - - + + - + src/value/image/gradient/gradient.ts->name_src/value/image/gradient/linear - - + + - + src/value/image/gradient/gradient.ts->name_src/value/image/gradient/radial - - + + @@ -2984,38 +3076,38 @@ - + src/value/shape/shape.ts->src/value/shape/circle.ts - - + + - + src/value/shape/shape.ts->src/value/shape/ellipse.ts - - + + - + src/value/shape/shape.ts->src/value/shape/inset.ts - - + + - + src/value/shape/shape.ts->src/value/shape/polygon.ts - - + + - + src/value/shape/shape.ts->src/value/shape/rectangle.ts - - + + @@ -3029,130 +3121,130 @@ - + src/value/image/gradient/radial/radial.ts->src/value/image/gradient/radial/extent.ts - - + + - + src/value/image/gradient/radial/radial.ts->src/value/image/gradient/radial/shape.ts - - + + - + src/calculation/math-expression/index.ts - -index.ts + +index.ts - + src/calculation/math-expression/index.ts->src/calculation/math-expression/expression.ts - - + + - + src/calculation/math-expression/index.ts->src/calculation/math-expression/math.ts - - + + - + src/value/position/position.ts->src/value/position/component.ts - - + + - + src/value/position/position.ts->src/value/position/keywords.ts - - + + - + src/value/position/position.ts->src/value/position/side.ts - - + + - + src/value/numeric/angle-percentage.ts->src/value/numeric/length.ts - - + + - + src/value/numeric/angle-percentage.ts->src/value/numeric/numeric.ts - - + + - + src/value/numeric/angle-percentage.ts->src/value/numeric/angle.ts - - + + - + src/value/numeric/angle-percentage.ts->src/value/numeric/dimension.ts - - + + - + src/value/numeric/angle-percentage.ts->src/value/numeric/percentage.ts - - + + - + src/value/numeric/length-percentage.ts->src/value/numeric/length.ts - - + + - + src/value/numeric/length-percentage.ts->src/value/numeric/numeric.ts - - + + - + src/value/numeric/length-percentage.ts->src/value/numeric/dimension.ts - - + + - + src/value/numeric/length-percentage.ts->src/value/numeric/percentage.ts - - + + @@ -3262,43 +3354,54 @@ + + + - + name_src - -src + +src - + src/index.ts - -index.ts + +index.ts - + src/index.ts->name_src/syntax - - + + - + src/index.ts->name_src/unit - - + + - + src/index.ts->name_src/calculation - - + + - + src/index.ts->name_src/value - - + + + + + + + + + + @@ -3321,14 +3424,6 @@ - - - - - - - - diff --git a/packages/alfa-css/package.json b/packages/alfa-css/package.json index 89b45c0f24..179a58d92e 100644 --- a/packages/alfa-css/package.json +++ b/packages/alfa-css/package.json @@ -41,6 +41,7 @@ "@siteimprove/alfa-slice": "workspace:^", "@siteimprove/alfa-string": "workspace:^", "@siteimprove/alfa-thunk": "workspace:^", + "@siteimprove/alfa-tuple": "workspace:^", "colorjs.io": "^0.6.1" }, "devDependencies": { diff --git a/packages/alfa-css/src/calculation/math-expression/function.ts b/packages/alfa-css/src/calculation/math-expression/function.ts deleted file mode 100644 index af012702b5..0000000000 --- a/packages/alfa-css/src/calculation/math-expression/function.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { Array } from "@siteimprove/alfa-array"; -import { Result } from "@siteimprove/alfa-result"; - -import { Unit } from "../../unit/index.js"; - -import type { Numeric } from "../numeric/index.js"; -import { Angle, Length, Number } from "../numeric/index.js"; - -import { Expression } from "./expression.js"; -import type { Kind } from "./kind.js"; -import { Value } from "./value.js"; - -const { isAngle } = Angle; -const { isLength } = Length; -const { isNumber } = Number; -const { isValueExpression } = Value; - -/** - * @public - */ -export abstract class Function< - T extends string = string, - A extends Array = Array, -> extends Expression { - protected readonly _args: Readonly; - protected readonly _kind: Kind; - - protected constructor(type: T, args: Readonly, kind: Kind) { - super(type, kind); - - this._args = args; - this._kind = kind; - } - - public get args(): Readonly { - return this._args; - } - - public equals(value: Function): boolean; - - public equals(value: unknown): value is this; - - public equals(value: unknown): boolean { - return ( - value instanceof Function && - value.type === this.type && - value._args.length === this._args.length && - value._args.every((arg: Expression, i: number) => - arg.equals(this._args[i]), - ) - ); - } - - public toJSON(): Function.JSON { - return { ...super.toJSON(), arguments: Array.toJSON(this._args) }; - } -} - -/** - * @public - */ -export namespace Function { - export interface JSON extends Expression.JSON { - arguments: Array; - } - - export class Calculation extends Function<"calculation", [Expression]> { - public static of(expression: Expression): Calculation { - return new Calculation([expression], expression.kind); - } - - protected constructor(args: [Expression], kind: Kind) { - super("calculation", args, kind); - } - - public reduce< - L extends Unit.Length = Unit.Length.Canonical, - P extends Numeric = Numeric, - >(resolver: Expression.Resolver): Expression { - const reduced = this._args[0].reduce(resolver); - - // If the calculation reduces to a value, no need to keep - // the `calc()` wrapper. - return isValueExpression(reduced) ? reduced : Calculation.of(reduced); - } - - public toString(): string { - return `calc(${this._args[0]})`; - } - } - - export function isCalculation(value: unknown): value is Calculation { - return value instanceof Calculation; - } - - export class Max extends Function<"max", [Expression, ...Array]> { - public static of( - first: Expression, - ...expressions: ReadonlyArray - ): Result { - // {@see https://drafts.csswg.org/css-values/#determine-the-type-of-a-calculation} - const kind = expressions.reduce( - (old, cur) => old.flatMap((kind) => kind.add(cur.kind)), - Result.of(first.kind), - ); - - return kind.map((kind) => new Max([first, ...expressions], kind)); - } - - protected constructor( - args: [Expression, ...Array], - kind: Kind, - ) { - super("max", args, kind); - } - - public reduce< - L extends Unit.Length = Unit.Length.Canonical, - P extends Numeric = Numeric, - >(resolver: Expression.Resolver): Expression { - // We know from the guard in Max.of that all args have the same kind. - - const reduced = this._args.map((expr) => expr.reduce(resolver)); - - if (Array.every(reduced, isValueExpression)) { - const values = reduced.map((expr) => expr.value); - // At this point, reduced args should be either: - // * numbers - // * angle, in canonical unit (deg) - // * absolute length, in canonical unit (px) - // * percentages - // * relative length, in any unit - // The first three are reduce-able further; percentages aren't because it - // may end up being percentages of negative values. - - if (values.every(isNumber)) { - return Value.of( - Number.of(Math.max(...values.map((value) => value.value))), - ); - } - - if ( - values.every( - // The unit test is theoretically not needed since reduced angle values - // should always be in the canonical unit (no relative angles) - (value) => isAngle(value) && value.hasUnit(Unit.Angle.Canonical), - ) - ) { - return Value.of( - Angle.of( - Math.max(...values.map((value) => value.value)), - Unit.Angle.Canonical, - ), - ); - } - - if ( - values.every( - (value) => isLength(value) && value.hasUnit(Unit.Length.Canonical), - ) - ) { - return Value.of( - Length.of( - Math.max(...values.map((value) => value.value)), - Unit.Length.Canonical, - ), - ); - } - // reduced contains percentages or relative lengths, we just fall through - // to the default case. - } - - // reduced contains unreduced calculations, we could eagerly compact on the - // fully reduced ones, but it's easier to just keep everything - return new Max(reduced as [Expression, ...Array], this._kind); - } - - public toString(): string { - return `max(${this._args.map((expr) => expr.toString()).join(", ")})`; - } - } -} diff --git a/packages/alfa-css/src/calculation/math-expression/function/calc.ts b/packages/alfa-css/src/calculation/math-expression/function/calc.ts new file mode 100644 index 0000000000..51a657c1e8 --- /dev/null +++ b/packages/alfa-css/src/calculation/math-expression/function/calc.ts @@ -0,0 +1,62 @@ +import { Parser } from "@siteimprove/alfa-parser"; +import { + Function as CSSFunction, + type Parser as CSSParser, +} from "../../../syntax/index.js"; + +import { Unit } from "../../../unit/index.js"; + +import type { Numeric } from "../../numeric/index.js"; + +import { Expression } from "../expression.js"; +import type { Kind } from "../kind.js"; +import { Value } from "../value.js"; + +import { Function } from "./function.js"; + +const { isValueExpression } = Value; + +const { map } = Parser; + +/** + * {@link https://drafts.csswg.org/css-values/#calc-func} + * + * @public + */ +export class Calculation extends Function<"calculation", [Expression]> { + public static of(expression: Expression): Calculation { + return new Calculation([expression], expression.kind); + } + + protected constructor(args: [Expression], kind: Kind) { + super("calculation", args, kind); + } + + public reduce< + L extends Unit.Length = Unit.Length.Canonical, + P extends Numeric = Numeric, + >(resolver: Expression.Resolver): Expression { + const reduced = this._args[0].reduce(resolver); + + // If the calculation reduces to a value, no need to keep + // the `calc()` wrapper. + return isValueExpression(reduced) ? reduced : Calculation.of(reduced); + } + + public toString(): string { + return `calc(${this._args[0]})`; + } +} + +/** @public */ +export namespace Calculation { + export function isCalculation(value: unknown): value is Calculation { + return value instanceof Calculation; + } + + export const parse = (parseSum: CSSParser) => + map( + CSSFunction.parse("calc", (input) => parseSum(input)), + ([, expression]) => Calculation.of(expression), + ); +} diff --git a/packages/alfa-css/src/calculation/math-expression/function/clamp.ts b/packages/alfa-css/src/calculation/math-expression/function/clamp.ts new file mode 100644 index 0000000000..ca493664a4 --- /dev/null +++ b/packages/alfa-css/src/calculation/math-expression/function/clamp.ts @@ -0,0 +1,151 @@ +import { Real } from "@siteimprove/alfa-math"; +import { Parser } from "@siteimprove/alfa-parser"; +import { Result } from "@siteimprove/alfa-result"; +import { Tuple } from "@siteimprove/alfa-tuple"; + +import { + Function as CSSFunction, + type Parser as CSSParser, + Token, +} from "../../../syntax/index.js"; + +import { Unit } from "../../../unit/index.js"; + +import { Angle, Length, Number, type Numeric } from "../../numeric/index.js"; + +import { Expression } from "../expression.js"; +import type { Kind } from "../kind.js"; +import { Value } from "../value.js"; + +import { Function } from "./function.js"; + +const { isAngle } = Angle; +const { isLength } = Length; +const { isNumber } = Number; +const { isValueExpression } = Value; + +const { delimited, mapResult, option, separatedList } = Parser; + +/** + * {@link https://drafts.csswg.org/css-values/#comp-func} + * + * @public + */ +export class Clamp extends Function< + "clamp", + [Expression, Expression, Expression] +> { + public static of( + min: Expression, + value: Expression, + max: Expression, + ): Result { + // {@see https://drafts.csswg.org/css-values/#determine-the-type-of-a-calculation} + const kind = [min, value, max].reduce( + (old, cur) => old.flatMap((kind) => kind.add(cur.kind)), + Result.of(min.kind), + ); + + return kind.map((kind) => new Clamp(min, value, max, kind)); + } + + protected constructor( + min: Expression, + value: Expression, + max: Expression, + kind: Kind, + ) { + super("clamp", [min, value, max], kind); + } + + public get min(): Expression { + return this._args[0]; + } + + public get value(): Expression { + return this._args[1]; + } + + public get max(): Expression { + return this._args[2]; + } + + public reduce< + L extends Unit.Length = Unit.Length.Canonical, + P extends Numeric = Numeric, + >(resolver: Expression.Resolver): Expression { + // We know from the guard in Clamp.of that all args have the same kind. + + const reduced = Tuple.map(this._args, (expr) => expr.reduce(resolver)); + + if (Tuple.every(reduced, isValueExpression)) { + const values = reduced.map((expr) => expr.value); + const [lower, value, upper] = Tuple.map(values, (value) => value.value); + // At this point, reduced args should be either: + // * numbers + // * angle, in canonical unit (deg) + // * absolute length, in canonical unit (px) + // * percentages + // * relative length, in any unit + // The first three are reduce-able further; percentages aren't because it + // may end up being percentages of negative values. + if (values.every(isNumber)) { + return Value.of(Number.of(Real.clamp(value, lower, upper))); + } + + if ( + Tuple.every( + values, + // The unit test is theoretically not needed since reduced angle values + // should always be in the canonical unit (no relative angles) + (value) => isAngle(value) && value.hasUnit(Unit.Angle.Canonical), + ) + ) { + return Value.of( + Angle.of(Real.clamp(value, lower, upper), Unit.Angle.Canonical), + ); + } + + if ( + Tuple.every( + values, + (value) => isLength(value) && value.hasUnit(Unit.Length.Canonical), + ) + ) { + return Value.of( + Length.of(Real.clamp(value, lower, upper), Unit.Length.Canonical), + ); + } + // reduced contains percentages or relative lengths, we just fall through + // to the default case. + } + + // reduced contains unreduced calculations, we could eagerly compact on the + // fully reduced ones, but it's easier to just keep everything + return new Clamp(reduced[0], reduced[1], reduced[2], this._kind); + } + + public toString(): string { + return `clamp(${this._args.map((expr) => expr.toString()).join(", ")})`; + } +} + +/** @public */ +export namespace Clamp { + export function isClamp(value: unknown): value is Clamp { + return value instanceof Clamp; + } + + export const parse = (parseSum: CSSParser) => + mapResult( + CSSFunction.parse("clamp", (input) => + separatedList( + parseSum, + delimited(option(Token.parseWhitespace), Token.parseComma), + 3, + 3, + )(input), + ), + ([, args]) => Clamp.of(args[0], args[1], args[2]), + ); +} diff --git a/packages/alfa-css/src/calculation/math-expression/function/function.ts b/packages/alfa-css/src/calculation/math-expression/function/function.ts new file mode 100644 index 0000000000..4ab0028703 --- /dev/null +++ b/packages/alfa-css/src/calculation/math-expression/function/function.ts @@ -0,0 +1,54 @@ +import { Array } from "@siteimprove/alfa-array"; + +import { Expression } from "../expression.js"; +import type { Kind } from "../kind.js"; + +/** + * @public + */ +export abstract class Function< + T extends string = string, + A extends Array = Array, +> extends Expression { + protected readonly _args: Readonly; + protected readonly _kind: Kind; + + protected constructor(type: T, args: Readonly, kind: Kind) { + super(type, kind); + + this._args = args; + this._kind = kind; + } + + public get args(): Readonly { + return this._args; + } + + public equals(value: Function): boolean; + + public equals(value: unknown): value is this; + + public equals(value: unknown): boolean { + return ( + value instanceof Function && + value.type === this.type && + value._args.length === this._args.length && + value._args.every((arg: Expression, i: number) => + arg.equals(this._args[i]), + ) + ); + } + + public toJSON(): Function.JSON { + return { ...super.toJSON(), arguments: Array.toJSON(this._args) }; + } +} + +/** + * @public + */ +export namespace Function { + export interface JSON extends Expression.JSON { + arguments: Array; + } +} diff --git a/packages/alfa-css/src/calculation/math-expression/function/index.ts b/packages/alfa-css/src/calculation/math-expression/function/index.ts new file mode 100644 index 0000000000..84598cc81c --- /dev/null +++ b/packages/alfa-css/src/calculation/math-expression/function/index.ts @@ -0,0 +1,48 @@ +import { Parser } from "@siteimprove/alfa-parser"; + +import { type Parser as CSSParser, Token } from "../../../syntax/index.js"; + +import { Expression } from "../expression.js"; + +import { Calculation } from "./calc.js"; +import { Clamp } from "./clamp.js"; +import { Max } from "./max.js"; +import { Min } from "./min.js"; + +const { exclusive } = Parser; + +/** @public */ +export type Function = Calculation | Clamp | Max | Min; + +/** @public */ +export namespace Function { + export const { isCalculation } = Calculation; + + export const { isMax } = Max; + + export const { isMin } = Min; + + const names = ["calc", "clamp", "max", "min"] as const; + type Name = (typeof names)[number]; + + const parsers: Record< + Name, + (parseSum: CSSParser) => CSSParser + > = { + calc: Calculation.parse, + clamp: Clamp.parse, + max: Max.parse, + min: Min.parse, + }; + + /** + * Parses a math function in a calculation. + * + * @param parseSum - A parser for the sum production in a calculation. + */ + export function parse(parseSum: CSSParser): CSSParser { + return exclusive(Token.parseFunction(names), (fn) => + parsers[fn.value](parseSum), + ); + } +} diff --git a/packages/alfa-css/src/calculation/math-expression/function/max.ts b/packages/alfa-css/src/calculation/math-expression/function/max.ts new file mode 100644 index 0000000000..18db5870ae --- /dev/null +++ b/packages/alfa-css/src/calculation/math-expression/function/max.ts @@ -0,0 +1,134 @@ +import { Array } from "@siteimprove/alfa-array"; +import { Parser } from "@siteimprove/alfa-parser"; +import { Result } from "@siteimprove/alfa-result"; + +import { + Function as CSSFunction, + type Parser as CSSParser, + Token, +} from "../../../syntax/index.js"; + +import { Unit } from "../../../unit/index.js"; + +import { Angle, Length, Number, type Numeric } from "../../numeric/index.js"; + +import { Expression } from "../expression.js"; +import type { Kind } from "../kind.js"; +import { Value } from "../value.js"; + +import { Function } from "./function.js"; + +const { isAngle } = Angle; +const { isLength } = Length; +const { isNumber } = Number; +const { isValueExpression } = Value; + +const { delimited, mapResult, option, separatedList } = Parser; + +/** + * {@link https://drafts.csswg.org/css-values/#comp-func} + * + * @public + */ +export class Max extends Function<"max", [Expression, ...Array]> { + public static of( + first: Expression, + ...expressions: ReadonlyArray + ): Result { + // {@see https://drafts.csswg.org/css-values/#determine-the-type-of-a-calculation} + const kind = expressions.reduce( + (old, cur) => old.flatMap((kind) => kind.add(cur.kind)), + Result.of(first.kind), + ); + + return kind.map((kind) => new Max([first, ...expressions], kind)); + } + + protected constructor(args: [Expression, ...Array], kind: Kind) { + super("max", args, kind); + } + + public reduce< + L extends Unit.Length = Unit.Length.Canonical, + P extends Numeric = Numeric, + >(resolver: Expression.Resolver): Expression { + // We know from the guard in Max.of that all args have the same kind. + + const reduced = this._args.map((expr) => expr.reduce(resolver)); + + if (Array.every(reduced, isValueExpression)) { + const values = reduced.map((expr) => expr.value); + // At this point, reduced args should be either: + // * numbers + // * angle, in canonical unit (deg) + // * absolute length, in canonical unit (px) + // * percentages + // * relative length, in any unit + // The first three are reduce-able further; percentages aren't because it + // may end up being percentages of negative values. + + if (values.every(isNumber)) { + return Value.of( + Number.of(Math.max(...values.map((value) => value.value))), + ); + } + + if ( + values.every( + // The unit test is theoretically not needed since reduced angle values + // should always be in the canonical unit (no relative angles) + (value) => isAngle(value) && value.hasUnit(Unit.Angle.Canonical), + ) + ) { + return Value.of( + Angle.of( + Math.max(...values.map((value) => value.value)), + Unit.Angle.Canonical, + ), + ); + } + + if ( + values.every( + (value) => isLength(value) && value.hasUnit(Unit.Length.Canonical), + ) + ) { + return Value.of( + Length.of( + Math.max(...values.map((value) => value.value)), + Unit.Length.Canonical, + ), + ); + } + // reduced contains percentages or relative lengths, we just fall through + // to the default case. + } + + // reduced contains unreduced calculations, we could eagerly compact on the + // fully reduced ones, but it's easier to just keep everything + return new Max(reduced as [Expression, ...Array], this._kind); + } + + public toString(): string { + return `max(${this._args.map((expr) => expr.toString()).join(", ")})`; + } +} + +/** @public */ +export namespace Max { + export function isMax(value: unknown): value is Max { + return value instanceof Max; + } + + export const parse = (parseSum: CSSParser) => + mapResult( + CSSFunction.parse( + "max", + separatedList( + parseSum, + delimited(option(Token.parseWhitespace), Token.parseComma), + ), + ), + ([, args]) => Max.of(...args), + ); +} diff --git a/packages/alfa-css/src/calculation/math-expression/function/min.ts b/packages/alfa-css/src/calculation/math-expression/function/min.ts new file mode 100644 index 0000000000..bc5061b3d7 --- /dev/null +++ b/packages/alfa-css/src/calculation/math-expression/function/min.ts @@ -0,0 +1,134 @@ +import { Array } from "@siteimprove/alfa-array"; +import { Parser } from "@siteimprove/alfa-parser"; +import { Result } from "@siteimprove/alfa-result"; + +import { + Function as CSSFunction, + type Parser as CSSParser, + Token, +} from "../../../syntax/index.js"; + +import { Unit } from "../../../unit/index.js"; + +import { Angle, Length, Number, type Numeric } from "../../numeric/index.js"; + +import { Expression } from "../expression.js"; +import type { Kind } from "../kind.js"; +import { Value } from "../value.js"; + +import { Function } from "./function.js"; + +const { isAngle } = Angle; +const { isLength } = Length; +const { isNumber } = Number; +const { isValueExpression } = Value; + +const { delimited, mapResult, option, separatedList } = Parser; + +/** + * {@link https://drafts.csswg.org/css-values/#comp-func} + * + * @public + */ +export class Min extends Function<"min", [Expression, ...Array]> { + public static of( + first: Expression, + ...expressions: ReadonlyArray + ): Result { + // {@see https://drafts.csswg.org/css-values/#determine-the-type-of-a-calculation} + const kind = expressions.reduce( + (old, cur) => old.flatMap((kind) => kind.add(cur.kind)), + Result.of(first.kind), + ); + + return kind.map((kind) => new Min([first, ...expressions], kind)); + } + + protected constructor(args: [Expression, ...Array], kind: Kind) { + super("min", args, kind); + } + + public reduce< + L extends Unit.Length = Unit.Length.Canonical, + P extends Numeric = Numeric, + >(resolver: Expression.Resolver): Expression { + // We know from the guard in Min.of that all args have the same kind. + + const reduced = this._args.map((expr) => expr.reduce(resolver)); + + if (Array.every(reduced, isValueExpression)) { + const values = reduced.map((expr) => expr.value); + // At this point, reduced args should be either: + // * numbers + // * angle, in canonical unit (deg) + // * absolute length, in canonical unit (px) + // * percentages + // * relative length, in any unit + // The first three are reduce-able further; percentages aren't because it + // may end up being percentages of negative values. + + if (values.every(isNumber)) { + return Value.of( + Number.of(Math.min(...values.map((value) => value.value))), + ); + } + + if ( + values.every( + // The unit test is theoretically not needed since reduced angle values + // should always be in the canonical unit (no relative angles) + (value) => isAngle(value) && value.hasUnit(Unit.Angle.Canonical), + ) + ) { + return Value.of( + Angle.of( + Math.min(...values.map((value) => value.value)), + Unit.Angle.Canonical, + ), + ); + } + + if ( + values.every( + (value) => isLength(value) && value.hasUnit(Unit.Length.Canonical), + ) + ) { + return Value.of( + Length.of( + Math.min(...values.map((value) => value.value)), + Unit.Length.Canonical, + ), + ); + } + // reduced contains percentages or relative lengths, we just fall through + // to the default case. + } + + // reduced contains unreduced calculations, we could eagerly compact on the + // fully reduced ones, but it's easier to just keep everything + return new Min(reduced as [Expression, ...Array], this._kind); + } + + public toString(): string { + return `min(${this._args.map((expr) => expr.toString()).join(", ")})`; + } +} + +/** @public */ +export namespace Min { + export function isMin(value: unknown): value is Min { + return value instanceof Min; + } + + export const parse = (parseSum: CSSParser) => + mapResult( + CSSFunction.parse( + "min", + separatedList( + parseSum, + delimited(option(Token.parseWhitespace), Token.parseComma), + ), + ), + ([, args]) => Min.of(...args), + ); +} diff --git a/packages/alfa-css/src/calculation/math-expression/math.ts b/packages/alfa-css/src/calculation/math-expression/math.ts index 03df5253eb..4a99ca397e 100644 --- a/packages/alfa-css/src/calculation/math-expression/math.ts +++ b/packages/alfa-css/src/calculation/math-expression/math.ts @@ -1,37 +1,20 @@ import type { Hash } from "@siteimprove/alfa-hash"; import { Parser } from "@siteimprove/alfa-parser"; -import type { Slice } from "@siteimprove/alfa-slice"; import { Err, Result } from "@siteimprove/alfa-result"; import type * as json from "@siteimprove/alfa-json"; -import { - Function as CSSFunction, - Token, - type Parser as CSSParser, -} from "../../syntax/index.js"; import type { Unit } from "../../unit/index.js"; import type { Numeric } from "../numeric/index.js"; import { Angle, Length, Number, Percentage } from "../numeric/index.js"; import type { Expression } from "./expression.js"; -import { Function } from "./function.js"; +import { Function } from "./function/index.js"; import type { Kind } from "./kind.js"; import { Operation } from "./operation.js"; -import { Value } from "./value.js"; - -const { - delimited, - either, - filter, - map, - mapResult, - option, - pair, - separatedList, - zeroOrMore, -} = Parser; + +const { filter, map } = Parser; /** * {@link https://drafts.csswg.org/css-values/#math} @@ -243,108 +226,10 @@ export namespace Math { | "number"; // Due to possibility of recursive expressions (`calc(1 + calc(2+3) )`), parsers - // are mutually recursive and must be kept together here rather than distributed - // in the corresponding files. - - let parseSum: CSSParser; - - const parseCalc = map( - CSSFunction.parse("calc", (input) => parseSum(input)), - ([, expression]) => Function.Calculation.of(expression), - ); - - const parseMax = mapResult( - CSSFunction.parse("max", (input) => - separatedList( - parseSum, - delimited(option(Token.parseWhitespace), Token.parseComma), - )(input), - ), - ([, args]) => Function.Max.of(...args), - ); - - const parseFunction = either(parseCalc, parseMax); - - /** - * {@link https://drafts.csswg.org/css-values/#typedef-calc-value} - */ - const parseValue = either, Expression, string>( - map( - either, Numeric, string>( - Number.parse, - Percentage.parse, - Length.parse, - Angle.parse, - ), - Value.of, - ), - parseFunction, - delimited( - Token.parseOpenParenthesis, - (input) => parseSum(input), - Token.parseCloseParenthesis, - ), - ); - - /** - * {@link https://drafts.csswg.org/css-values/#typedef-calc-product} - */ - const parseProduct = mapResult( - pair( - parseValue, - zeroOrMore( - pair( - delimited( - option(Token.parseWhitespace), - either( - map(Token.parseDelim("*"), () => false), - map(Token.parseDelim("/"), () => true), - ), - ), - parseValue, - ), - ), - ), - ([left, result]) => - result - .map(([invert, right]) => (invert ? Operation.Invert.of(right) : right)) - .reduce( - (left: Result, right: Expression) => - left.flatMap((left) => Operation.Product.of(left, right)), - Result.of(left), - ), - ); - - /** - * {@link https://drafts.csswg.org/css-values/#typedef-calc-sum} - */ - parseSum = mapResult( - pair( - parseProduct, - zeroOrMore( - pair( - delimited( - Token.parseWhitespace, - either( - map(Token.parseDelim("+"), () => false), - map(Token.parseDelim("-"), () => true), - ), - ), - parseProduct, - ), - ), - ), - ([left, result]) => - result - .map(([invert, right]) => (invert ? Operation.Negate.of(right) : right)) - .reduce( - (left: Result, right: Expression) => - left.flatMap((left) => Operation.Sum.of(left, right)), - Result.of(left), - ), - ); + // are mutually recursive. This is handled by injecting the top "sum" + // parser in the lower level parsers that need it. - export const parse = map(parseFunction, Math.of); + export const parse = map(Function.parse(Operation.Sum.parse), Math.of); // other parsers + filters can be added when needed export const parseAngle = filter( diff --git a/packages/alfa-css/src/calculation/math-expression/operation.ts b/packages/alfa-css/src/calculation/math-expression/operation.ts index 849abb738a..708ba50b01 100644 --- a/packages/alfa-css/src/calculation/math-expression/operation.ts +++ b/packages/alfa-css/src/calculation/math-expression/operation.ts @@ -1,5 +1,9 @@ import { Array } from "@siteimprove/alfa-array"; -import type { Result } from "@siteimprove/alfa-result"; +import { Parser } from "@siteimprove/alfa-parser"; +import { Result } from "@siteimprove/alfa-result"; +import type { Slice } from "@siteimprove/alfa-slice"; + +import { Token, type Parser as CSSParser } from "../../syntax/index.js"; import { Unit } from "../../unit/index.js"; @@ -13,6 +17,7 @@ import { } from "../numeric/index.js"; import { Expression } from "./expression.js"; +import { Function } from "./function/index.js"; import type { Kind } from "./kind.js"; import { Value } from "./value.js"; @@ -22,6 +27,8 @@ const { isLength } = Length; const { isNumber } = Number; const { isPercentage } = Percentage; +const { delimited, either, map, mapResult, option, pair, zeroOrMore } = Parser; + /** * {@link https://drafts.csswg.org/css-values/#calculation-tree-operator-nodes} * @@ -155,10 +162,47 @@ export namespace Operation { } } - export function isSumExpression(value: unknown): value is Sum { - return value instanceof Sum; + export namespace Sum { + export function isSumExpression(value: unknown): value is Sum { + return value instanceof Sum; + } + + /** + * {@link https://drafts.csswg.org/css-values/#typedef-calc-sum} + */ + export function parse(input: Slice) { + return mapResult( + pair( + Product.parse(parse), + zeroOrMore( + pair( + delimited( + Token.parseWhitespace, + either( + map(Token.parseDelim("+"), () => false), + map(Token.parseDelim("-"), () => true), + ), + ), + Product.parse(parse), + ), + ), + ), + ([left, result]) => + result + .map(([invert, right]) => + invert ? Operation.Negate.of(right) : right, + ) + .reduce( + (left: Result, right: Expression) => + left.flatMap((left) => Operation.Sum.of(left, right)), + Result.of(left), + ), + )(input); + } } + export const { isSumExpression } = Sum; + export class Negate extends Unary<"negate"> { public static of(operand: Expression): Negate { return new Negate([operand], operand.kind); @@ -276,10 +320,48 @@ export namespace Operation { } } - export function isProductExpression(value: unknown): value is Product { - return value instanceof Product; + export namespace Product { + export function isProductExpression(value: unknown): value is Product { + return value instanceof Product; + } + /** + * {@link https://drafts.csswg.org/css-values/#typedef-calc-product} + */ + export function parse( + parseSum: CSSParser, + ): CSSParser { + return mapResult( + pair( + Value.parse(Function.parse, parseSum), + zeroOrMore( + pair( + delimited( + option(Token.parseWhitespace), + either( + map(Token.parseDelim("*"), () => false), + map(Token.parseDelim("/"), () => true), + ), + ), + Value.parse(Function.parse, parseSum), + ), + ), + ), + ([left, result]) => + result + .map(([invert, right]) => + invert ? Operation.Invert.of(right) : right, + ) + .reduce( + (left: Result, right: Expression) => + left.flatMap((left) => Operation.Product.of(left, right)), + Result.of(left), + ), + ); + } } + export const { isProductExpression } = Product; + export class Invert extends Unary<"invert"> { public static of(operand: Expression): Invert { return new Invert([operand], operand.kind.invert()); diff --git a/packages/alfa-css/src/calculation/math-expression/value.ts b/packages/alfa-css/src/calculation/math-expression/value.ts index 920d94538d..3870e0a27c 100644 --- a/packages/alfa-css/src/calculation/math-expression/value.ts +++ b/packages/alfa-css/src/calculation/math-expression/value.ts @@ -1,14 +1,22 @@ import type { Mapper } from "@siteimprove/alfa-mapper"; +import { Parser } from "@siteimprove/alfa-parser"; import type { Result } from "@siteimprove/alfa-result"; import { Err, Ok } from "@siteimprove/alfa-result"; import { Selective } from "@siteimprove/alfa-selective"; +import type { Slice } from "@siteimprove/alfa-slice"; +import { Token, type Parser as CSSParser } from "../../syntax/index.js"; import { Unit } from "../../unit/index.js"; - -import type { Numeric } from "../numeric/index.js"; -import { Angle, Length, Number, Percentage } from "../numeric/index.js"; +import { + Angle, + Length, + Number, + type Numeric, + Percentage, +} from "../numeric/index.js"; import { Expression } from "./expression.js"; +import type { Function } from "./function/index.js"; import { Kind } from "./kind.js"; const { isAngle } = Angle; @@ -16,6 +24,8 @@ const { isLength } = Length; const { isNumber } = Number; const { isPercentage } = Percentage; +const { delimited, either, map } = Parser; + /** * @public */ @@ -204,4 +214,30 @@ export namespace Value { ? resolver(length) : length.withUnit(Unit.Length.Canonical); } + + /** + * {@link https://drafts.csswg.org/css-values/#typedef-calc-value} + */ + export function parse( + parseFunction: (parseSum: CSSParser) => CSSParser, + parseSum: CSSParser, + ): CSSParser { + return either, Expression, string>( + map( + either, Numeric, string>( + Number.parse, + Percentage.parse, + Length.parse, + Angle.parse, + ), + Value.of, + ), + parseFunction(parseSum), + delimited( + Token.parseOpenParenthesis, + parseSum, + Token.parseCloseParenthesis, + ), + ); + } } diff --git a/packages/alfa-css/src/syntax/function.ts b/packages/alfa-css/src/syntax/function.ts index 0769449ea9..cf180cef26 100644 --- a/packages/alfa-css/src/syntax/function.ts +++ b/packages/alfa-css/src/syntax/function.ts @@ -2,6 +2,7 @@ import type { Equatable } from "@siteimprove/alfa-equatable"; import type { Serializable } from "@siteimprove/alfa-json"; import { Parser } from "@siteimprove/alfa-parser"; import type { Predicate } from "@siteimprove/alfa-predicate"; +import type { Refinement } from "@siteimprove/alfa-refinement"; import { Err, Result } from "@siteimprove/alfa-result"; import { Slice } from "@siteimprove/alfa-slice"; @@ -31,20 +32,25 @@ const { * * @public */ -export class Function implements Iterable, Equatable, Serializable { - public static of(name: string, value: Iterable): Function { +export class Function + implements Iterable, Equatable, Serializable +{ + public static of( + name: N, + value: Iterable, + ): Function { return new Function(name, Array.from(value)); } - private readonly _name: string; + private readonly _name: N; private readonly _value: Array; - protected constructor(name: string, value: Array) { + protected constructor(name: N, value: Array) { this._name = name; this._value = value; } - public get name(): string { + public get name(): N { return this._name; } @@ -72,7 +78,7 @@ export class Function implements Iterable, Equatable, Serializable { ); } - public toJSON(): Function.JSON { + public toJSON(): Function.JSON { return { name: this._name, value: this._value.map((token) => token.toJSON()), @@ -88,9 +94,9 @@ export class Function implements Iterable, Equatable, Serializable { * @public */ export namespace Function { - export interface JSON { + export interface JSON { [key: string]: json.JSON; - name: string; + name: N; value: Array; } @@ -121,12 +127,25 @@ export namespace Function { ([{ value: name }, value]) => Function.of(name, value), )(input); - export const parse = ( - query?: string | Array | Predicate, + export function parse( + query: N | ReadonlyArray | Refinement>, body?: CSSParser | Thunk>, - ): CSSParser<[Function, T]> => - flatMap( - right(peek(Token.parseFunction(query)), Function.consume), + ): CSSParser<[Function, T]>; + + export function parse( + query?: Predicate, + body?: CSSParser | Thunk>, + ): CSSParser<[Function, T]>; + + export function parse( + query?: string | ReadonlyArray | Predicate, + body?: CSSParser | Thunk>, + ): CSSParser<[Function, T]> { + return flatMap( + // TypeScript is unable to match the overloads of this function with the + // ones of `Token.parseFunction` (the local overloads are ignored in the + // implementation); so we just tell it to ignore it. + right(peek(Token.parseFunction(query as any)), Function.consume), (fn) => (input) => { if (body === undefined) { return Result.of([input, [fn, undefined as never] as const]); @@ -169,4 +188,5 @@ export namespace Function { return Result.of([input, [fn, value] as const]); }, ); + } } diff --git a/packages/alfa-css/src/syntax/token.ts b/packages/alfa-css/src/syntax/token.ts index af596825f9..2fd896be3e 100644 --- a/packages/alfa-css/src/syntax/token.ts +++ b/packages/alfa-css/src/syntax/token.ts @@ -184,14 +184,16 @@ export namespace Token { return parseToken(and(isIdent, predicate)); } - export class Function implements Equatable, Serializable { - public static of(value: string): Function { + export class Function + implements Equatable, Serializable + { + public static of(value: N): Function { return new Function(value); } - private readonly _value: string; + private readonly _value: N; - protected constructor(value: string) { + protected constructor(value: N) { this._value = value; } @@ -199,7 +201,7 @@ export namespace Token { return "function"; } - public get value(): string { + public get value(): N { return this._value; } @@ -211,7 +213,7 @@ export namespace Token { return value instanceof Function && value._value === this._value; } - public toJSON(): Function.JSON { + public toJSON(): Function.JSON { return { type: "function", value: this._value, @@ -224,10 +226,10 @@ export namespace Token { } export namespace Function { - export interface JSON { + export interface JSON { [key: string]: json.JSON; type: "function"; - value: string; + value: N; } export function isFunction(value: unknown): value is Function { return value instanceof Function; @@ -236,9 +238,17 @@ export namespace Token { export const { of: func, isFunction } = Function; + export function parseFunction( + query: N | ReadonlyArray | Refinement>, + ): CSSParser>; + export function parseFunction( - query: string | Array | Predicate = () => true, - ) { + query?: Predicate, + ): CSSParser; + + export function parseFunction( + query: N | ReadonlyArray | Predicate = () => true, + ): CSSParser { const predicate: Predicate = typeof query === "function" ? query diff --git a/packages/alfa-css/src/tsconfig.json b/packages/alfa-css/src/tsconfig.json index 7cf517cb2c..81d58e6f19 100644 --- a/packages/alfa-css/src/tsconfig.json +++ b/packages/alfa-css/src/tsconfig.json @@ -7,7 +7,12 @@ "./calculation/math-expression/expression.ts", "./calculation/math-expression/index.ts", "./calculation/math-expression/kind.ts", - "./calculation/math-expression/function.ts", + "./calculation/math-expression/function/calc.ts", + "./calculation/math-expression/function/clamp.ts", + "./calculation/math-expression/function/function.ts", + "./calculation/math-expression/function/index.ts", + "./calculation/math-expression/function/max.ts", + "./calculation/math-expression/function/min.ts", "./calculation/math-expression/math.ts", "./calculation/math-expression/operation.ts", "./calculation/math-expression/value.ts", @@ -131,6 +136,7 @@ { "path": "../../alfa-selective" }, { "path": "../../alfa-slice" }, { "path": "../../alfa-string" }, - { "path": "../../alfa-thunk" } + { "path": "../../alfa-thunk" }, + { "path": "../../alfa-tuple" } ] } diff --git a/packages/alfa-css/test/calculation/calculation.spec.ts b/packages/alfa-css/test/calculation/calculation.spec.ts index 818a0a75e6..93f3c1fee8 100644 --- a/packages/alfa-css/test/calculation/calculation.spec.ts +++ b/packages/alfa-css/test/calculation/calculation.spec.ts @@ -2,6 +2,7 @@ import { test } from "@siteimprove/alfa-test"; import { Math } from "../../dist/index.js"; import { parser, parserUnsafe, serializer } from "../common/parse.js"; +import { resolver } from "./common.js"; const parseErr = parser(Math.parse); const parse = parserUnsafe(Math.parse); @@ -362,3 +363,41 @@ test(".parse() accepts whitespace inside parentheses", (t) => { }, }); }); + +test("parse() parses division of dimensions", (t) => { + const calculation = parse("calc(2em / 1rem)"); + + t.deepEqual(calculation.toJSON(), { + type: "math expression", + expression: { + type: "calculation", + arguments: [ + { + type: "product", + operands: [ + { + type: "value", + value: { value: 2, type: "length", unit: "em" }, + }, + { + type: "invert", + operands: [ + { + type: "value", + value: { value: 1, type: "length", unit: "rem" }, + }, + ], + }, + ], + }, + ], + }, + }); + + const reduced = calculation.reduce(resolver); + + t.deepEqual(reduced.toJSON(), { + type: "math expression", + expression: { type: "value", value: { value: 1, type: "number" } }, + }); +}); diff --git a/packages/alfa-css/test/calculation/common.ts b/packages/alfa-css/test/calculation/common.ts new file mode 100644 index 0000000000..b95bec514e --- /dev/null +++ b/packages/alfa-css/test/calculation/common.ts @@ -0,0 +1,18 @@ +import type { Expression } from "../../dist/calculation/index.js"; +import { Length } from "../../dist/calculation/numeric/index.js"; + +export const resolver: Expression.Resolver = { + length: (length) => { + switch (length.unit) { + case "em": + return Length.of(length.value * 16, "px"); + case "rem": + return Length.of(length.value * 32, "px"); + case "vh": + return Length.of(length.value * 1024, "px"); + default: + return Length.of(0, "px"); + } + }, + percentage: (percent) => Length.of(percent.value * 16, "px"), +}; diff --git a/packages/alfa-css/test/calculation/function/clamp.spec.ts b/packages/alfa-css/test/calculation/function/clamp.spec.ts new file mode 100644 index 0000000000..34e557c358 --- /dev/null +++ b/packages/alfa-css/test/calculation/function/clamp.spec.ts @@ -0,0 +1,130 @@ +import { test } from "@siteimprove/alfa-test"; + +import { Math } from "../../../dist/index.js"; +import { parser, parserUnsafe, serializer } from "../../common/parse.js"; + +import { resolver } from "../common.js"; + +const parseErr = parser(Math.parse); +const parse = parserUnsafe(Math.parse); +const serialize = serializer(Math.parse); + +test(".parse() parses a clamp with exactly three numbers or calculations", (t) => { + for (const [list, value] of [ + ["1, 5, 19", 5], + ["1,2, 1.5", 1.5], + ["3, 2,8", 3], + ["2, min(1, 4), 10", 2], + ]) { + const calculation = parse(`clamp(${list})`); + + t(calculation.isNumber()); + + t.deepEqual(calculation.toJSON(), { + type: "math expression", + expression: { + type: "value", + value: { type: "number", value: value }, + }, + }); + } + + for (const list of ["", "1, 2", "1, 2, 3, 4", "min(1, 2), 3"]) { + const error = parseErr(`clamp(${list})`); + + t.deepEqual(error.isErr(), true); + } +}); + +test(".parse() parses a clamp of absolute dimensions", (t) => { + for (const [list, value, type] of [ + ["1px, 2px, 3px", 2, "length"], + ["0px, 2px, 1cm", 2, "length"], + ["1rad, 90deg, 0.5turn", 90, "angle"], + ] as const) { + const actual = serialize(`clamp(${list})`); + + t.deepEqual(actual, { + type: "math expression", + expression: { + type: "value", + value: { + type: type, + value: value, + unit: type === "length" ? "px" : "deg", + }, + }, + }); + } +}); + +test(".parse() does not reduce relative dimensions", (t) => { + const calculation = parse("clamp(1em, 20px, 1vh + 20%)"); + + t.deepEqual(calculation.toJSON(), { + type: "math expression", + expression: { + type: "clamp", + arguments: [ + { + type: "value", + value: { value: 1, type: "length", unit: "em" }, + }, + { + type: "value", + value: { value: 20, type: "length", unit: "px" }, + }, + { + type: "sum", + operands: [ + { + type: "value", + value: { value: 1, type: "length", unit: "vh" }, + }, + { type: "value", value: { value: 0.2, type: "percentage" } }, + ], + }, + ], + }, + }); + + const reduced = calculation.reduce(resolver); + + t.deepEqual(reduced.toJSON(), { + type: "math expression", + expression: { + type: "value", + value: { value: 20, type: "length", unit: "px" }, + }, + }); +}); + +test(".parse() does not resolve percentages", (t) => { + const actual = serialize("clamp(5%, 10%, 20%)"); + + t.deepEqual(actual, { + type: "math expression", + expression: { + type: "clamp", + arguments: [ + { type: "value", value: { value: 0.05, type: "percentage" } }, + { type: "value", value: { value: 0.1, type: "percentage" } }, + { type: "value", value: { value: 0.2, type: "percentage" } }, + ], + }, + }); +}); + +test("parse() accept mixed clamp if they can combine", (t) => { + for (const list of ["1px, 10%, 1em", "1px, 10%, 30%"]) { + const calculation = parse(`clamp(${list})`).reduce(resolver); + + t.deepEqual(calculation.toJSON(), { + type: "math expression", + expression: { + type: "value", + value: { value: 1.6, type: "length", unit: "px" }, + }, + }); + } +}); diff --git a/packages/alfa-css/test/calculation/math-functions.spec.ts b/packages/alfa-css/test/calculation/function/max.spec.ts similarity index 60% rename from packages/alfa-css/test/calculation/math-functions.spec.ts rename to packages/alfa-css/test/calculation/function/max.spec.ts index 30900690b6..e32ca6fd1a 100644 --- a/packages/alfa-css/test/calculation/math-functions.spec.ts +++ b/packages/alfa-css/test/calculation/function/max.spec.ts @@ -1,14 +1,15 @@ import { test } from "@siteimprove/alfa-test"; -import { Math } from "../../dist/index.js"; -import { Length } from "../../dist/calculation/numeric/index.js"; -import { parser, parserUnsafe, serializer } from "../common/parse.js"; +import { Math } from "../../../dist/index.js"; +import { parser, parserUnsafe, serializer } from "../../common/parse.js"; + +import { resolver } from "../common.js"; const parseErr = parser(Math.parse); const parse = parserUnsafe(Math.parse); const serialize = serializer(Math.parse); -test(".parse() parses a max of one or more numbers or calculation", (t) => { +test(".parse() parses a max of one or more numbers or calculations", (t) => { for (const [list, value] of [ ["1", 1], ["1,2", 2], @@ -90,19 +91,7 @@ test(".parse() does not reduce relative dimensions", (t) => { }, }); - const reduced = calculation.reduce({ - length: (length) => { - switch (length.unit) { - case "em": - return Length.of(length.value * 16, "px"); - case "vh": - return Length.of(length.value * 1024, "px"); - default: - return Length.of(0, "px"); - } - }, - percentage: (percent) => Length.of(percent.value * 16, "px"), - }); + const reduced = calculation.reduce(resolver); t.deepEqual(reduced.toJSON(), { type: "math expression", @@ -130,10 +119,7 @@ test(".parse() does not resolve percentages", (t) => { test("parse() accept mixed max if they can combine", (t) => { for (const list of ["1px, 10%", "10%, 1px"]) { - const calculation = parse(`max(${list})`).reduce({ - length: () => Length.of(0, "px"), - percentage: (percent) => Length.of(percent.value * 16, "px"), - }); + const calculation = parse(`max(${list})`).reduce(resolver); t.deepEqual(calculation.toJSON(), { type: "math expression", @@ -144,53 +130,3 @@ test("parse() accept mixed max if they can combine", (t) => { }); } }); - -test("parse() parses division of dimensions", (t) => { - const calculation = parse("calc(2em / 1rem)"); - - t.deepEqual(calculation.toJSON(), { - type: "math expression", - expression: { - type: "calculation", - arguments: [ - { - type: "product", - operands: [ - { - type: "value", - value: { value: 2, type: "length", unit: "em" }, - }, - { - type: "invert", - operands: [ - { - type: "value", - value: { value: 1, type: "length", unit: "rem" }, - }, - ], - }, - ], - }, - ], - }, - }); - - const reduced = calculation.reduce({ - length: (length) => { - switch (length.unit) { - case "em": - return Length.of(length.value * 16, "px"); - case "rem": - return Length.of(length.value * 32, "px"); - default: - return Length.of(0, "px"); - } - }, - percentage: (percent) => Length.of(percent.value * 16, "px"), - }); - - t.deepEqual(reduced.toJSON(), { - type: "math expression", - expression: { type: "value", value: { value: 1, type: "number" } }, - }); -}); diff --git a/packages/alfa-css/test/calculation/function/min.spec.ts b/packages/alfa-css/test/calculation/function/min.spec.ts new file mode 100644 index 0000000000..773fa309d6 --- /dev/null +++ b/packages/alfa-css/test/calculation/function/min.spec.ts @@ -0,0 +1,132 @@ +import { test } from "@siteimprove/alfa-test"; + +import { Math } from "../../../dist/index.js"; +import { parser, parserUnsafe, serializer } from "../../common/parse.js"; + +import { resolver } from "../common.js"; + +const parseErr = parser(Math.parse); +const parse = parserUnsafe(Math.parse); +const serialize = serializer(Math.parse); + +test(".parse() parses a min of one or more numbers or calculations", (t) => { + for (const [list, value] of [ + ["1", 1], + ["1,2", 1], + ["3, 7,8 , 10 ,5, 1", 1], + ["1 + 2, 5, 2 * 3", 3], + ["2, min(1, 4)", 1], + ]) { + const calculation = parse(`min(${list})`); + + t(calculation.isNumber()); + + t.deepEqual(calculation.toJSON(), { + type: "math expression", + expression: { + type: "value", + value: { type: "number", value: value }, + }, + }); + } + + const error = parseErr("min()"); + + t.deepEqual(error.isErr(), true); +}); + +test(".parse() parses a min of absolute dimensions", (t) => { + for (const [list, value, type] of [ + ["1px", 1, "length"], + ["2px, 1cm", 2, "length"], + ["2rad, 90deg", 90, "angle"], + ] as const) { + const actual = serialize(`min(${list})`); + + t.deepEqual(actual, { + type: "math expression", + expression: { + type: "value", + value: { + type: type, + value: value, + unit: type === "length" ? "px" : "deg", + }, + }, + }); + } +}); + +test(".parse() does not reduce relative dimensions", (t) => { + const calculation = parse("min(1em, 20px, 2*4px, 1vh + 20%)"); + + t.deepEqual(calculation.toJSON(), { + type: "math expression", + expression: { + type: "min", + arguments: [ + { + type: "value", + value: { value: 1, type: "length", unit: "em" }, + }, + { + type: "value", + value: { value: 20, type: "length", unit: "px" }, + }, + { + type: "value", + value: { value: 8, type: "length", unit: "px" }, + }, + { + type: "sum", + operands: [ + { + type: "value", + value: { value: 1, type: "length", unit: "vh" }, + }, + { type: "value", value: { value: 0.2, type: "percentage" } }, + ], + }, + ], + }, + }); + + const reduced = calculation.reduce(resolver); + + t.deepEqual(reduced.toJSON(), { + type: "math expression", + expression: { + type: "value", + value: { value: 8, type: "length", unit: "px" }, + }, + }); +}); + +test(".parse() does not resolve percentages", (t) => { + const actual = serialize("min(5%, 10%)"); + + t.deepEqual(actual, { + type: "math expression", + expression: { + type: "min", + arguments: [ + { type: "value", value: { value: 0.05, type: "percentage" } }, + { type: "value", value: { value: 0.1, type: "percentage" } }, + ], + }, + }); +}); + +test("parse() accept mixed min if they can combine", (t) => { + for (const list of ["2px, 10%", "10%, 2px"]) { + const calculation = parse(`min(${list})`).reduce(resolver); + + t.deepEqual(calculation.toJSON(), { + type: "math expression", + expression: { + type: "value", + value: { value: 1.6, type: "length", unit: "px" }, + }, + }); + } +}); diff --git a/packages/alfa-css/test/tsconfig.json b/packages/alfa-css/test/tsconfig.json index 2d27b0f360..20169d34f3 100644 --- a/packages/alfa-css/test/tsconfig.json +++ b/packages/alfa-css/test/tsconfig.json @@ -16,7 +16,10 @@ "./syntax/nth.spec.ts", "./syntax/token.spec.ts", "./calculation/calculation.spec.ts", - "./calculation/math-functions.spec.ts", + "./calculation/common.ts", + "./calculation/function/clamp.spec.ts", + "./calculation/function/max.spec.ts", + "./calculation/function/min.spec.ts", "./value/collection/list.spec.ts", "./value/collection/tuple.spec.ts", "./value/color/css4-color.spec.ts", diff --git a/packages/alfa-math/test/real.spec.ts b/packages/alfa-math/test/real.spec.ts new file mode 100644 index 0000000000..29c0489104 --- /dev/null +++ b/packages/alfa-math/test/real.spec.ts @@ -0,0 +1,8 @@ +import { test } from "@siteimprove/alfa-test"; + +import { Real } from "../dist/real.js"; + +test(".clamp() prefers lower bound if they are in the wrong order", (t) => { + // This is the behavior of clamp in CSS. + t.equal(Real.clamp(1, 2, 0), 2); +}); diff --git a/packages/alfa-math/test/tsconfig.json b/packages/alfa-math/test/tsconfig.json index 2c09bbdb3d..3008d129ca 100644 --- a/packages/alfa-math/test/tsconfig.json +++ b/packages/alfa-math/test/tsconfig.json @@ -5,6 +5,6 @@ "noEmit": true, "lib": ["DOM", "ESNext"] }, - "files": ["./matrix.spec.ts", "./vector.spec.ts"], + "files": ["./matrix.spec.ts", "./real.spec.ts", "./vector.spec.ts"], "references": [{ "path": "../src" }, { "path": "../../alfa-test" }] } diff --git a/packages/alfa-parser/src/parser.ts b/packages/alfa-parser/src/parser.ts index f94e9da2b0..a58fd9a68a 100644 --- a/packages/alfa-parser/src/parser.ts +++ b/packages/alfa-parser/src/parser.ts @@ -283,6 +283,25 @@ export namespace Parser { }; } + /** + * Select a parser based on the peeked value. + * + * @remarks + * This is more efficient than a long chain of `either` since it does not try + * to re-parse the input multiple times after the first parser failed, if the + * peeked value is enough to differentiate the input. + * + * The parser will receive the full input, no matter how much the peeker looks + * at or tries to consume. The peeked tokens will be looked at twice, so the + * peeker should only be looking at a small number of tokens. + */ + export function exclusive = []>( + peeker: Parser, + getParser: Mapper>, + ): Parser { + return flatMap(peek(peeker), getParser); + } + export function pair = []>( left: Parser, right: Parser, diff --git a/packages/alfa-parser/test/parser.spec.ts b/packages/alfa-parser/test/parser.spec.ts index 6bae2b5903..c22316f42d 100644 --- a/packages/alfa-parser/test/parser.spec.ts +++ b/packages/alfa-parser/test/parser.spec.ts @@ -369,6 +369,75 @@ test("Parser.either() tries parsers in order", (t) => { }); }); +test("Parser.exclusive() tries parsers", (t) => { + const parseFooFoo = Parser.pair(parseFoo, parseFoo); + const parseBarBar = Parser.pair(parseBar, parseBar); + + const parser = Parser.exclusive(parseAny, (token: string) => + token === "foo" ? parseFooFoo : parseBarBar, + ); + + t.deepEqual(parser(["foo", "foo", "bar"]).toJSON(), { + type: "ok", + value: [["bar"], ["foo", "foo"]], + }); + + t.deepEqual(parser(["bar", "bar", "baz"]).toJSON(), { + type: "ok", + value: [["baz"], ["bar", "bar"]], + }); + + t.deepEqual(parser(["foo", "bar"]).toJSON(), { + type: "err", + error: "invalid token: bar", + }); +}); + +test("Parser.exclusive() only tries one parser", (t) => { + let foo = 0; + let bar = 0; + + const parseFooFoo = Parser.teeErr( + Parser.tee(Parser.pair(parseFoo, parseFoo), () => foo++), + () => foo++, + ); + const parseBarBar = Parser.teeErr( + Parser.tee(Parser.pair(parseBar, parseBar), () => bar++), + () => bar++, + ); + + const parser = Parser.exclusive(parseAny, (token: string) => + token === "foo" ? parseFooFoo : parseBarBar, + ); + + t.deepEqual(parser(["foo", "foo", "bar"]).toJSON(), { + type: "ok", + value: [["bar"], ["foo", "foo"]], + }); + + // FooFoo is triggered, BarBar is not, same behavior as either. + t.equal(foo, 1); + t.equal(bar, 0); + + t.deepEqual(parser(["bar", "bar", "baz"]).toJSON(), { + type: "ok", + value: [["baz"], ["bar", "bar"]], + }); + + // BarBar is triggered, FooFoo is skipped, different from either. + t.equal(foo, 1); + t.equal(bar, 1); + + t.deepEqual(parser(["foo", "bar"]).toJSON(), { + type: "err", + error: "invalid token: bar", + }); + + // FooFoo is triggered and fails, BarBar is skipped, different from either. + t.equal(foo, 2); + t.equal(bar, 1); +}); + test("Parser.pair() parses two values", (t) => { const parser = Parser.pair(parseFoo, parseBar); diff --git a/packages/alfa-tuple/src/tuple.ts b/packages/alfa-tuple/src/tuple.ts index 443c79e2e2..e26a8f47f5 100644 --- a/packages/alfa-tuple/src/tuple.ts +++ b/packages/alfa-tuple/src/tuple.ts @@ -51,15 +51,15 @@ export namespace Tuple { Array.forEach(tuple, callback); } - export type Map = T extends readonly [infer _, ...infer R] - ? [U, ...Map] - : Empty; + export type Map = { + [K in keyof T]: U; + }; export function map( tuple: T, mapper: Mapper, U, [index: number]>, ): Map { - return Array.map(tuple, mapper) as unknown as Map; + return Array.map(tuple, mapper) as Map; } export function reduce( @@ -202,6 +202,19 @@ export namespace Tuple { return Array.none(tuple, predicate); } + export function every>( + tuple: T, + refinement: Refinement, U, [index: number]>, + ): // Even though we know that U extends Item = T[number], + // TypeScript still needs to connect each to the keyed value in T, + // so we need the weird ?: in the mapped type. + tuple is { [K in keyof T]: U extends T[K] ? U : never }; + + export function every( + tuple: T, + predicate: Predicate, [index: number]>, + ): boolean; + export function every( tuple: T, predicate: Predicate, [index: number]>, diff --git a/yarn.lock b/yarn.lock index d3f031bb00..a43a12c2b0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1680,6 +1680,7 @@ __metadata: "@siteimprove/alfa-string": "workspace:^" "@siteimprove/alfa-test": "workspace:^" "@siteimprove/alfa-thunk": "workspace:^" + "@siteimprove/alfa-tuple": "workspace:^" colorjs.io: "npm:^0.6.1" languageName: unknown linkType: soft