From ad91ffe29664d5f9f7116b4d197b9909af12e8ad Mon Sep 17 00:00:00 2001 From: elenamongelli <52746406+elenamongelli@users.noreply.github.com> Date: Mon, 21 Jun 2021 15:20:20 +0200 Subject: [PATCH 01/11] Implementation of rule 70: missing the expectations part of "either visible or included in the accessibility tree" since the correct predicate needs to be done --- packages/alfa-rules/src/sia-r70/rule.ts | 148 ++++++++++++++++++ .../alfa-rules/test/sia-r70/rule.spec.tsx | 108 +++++++++++++ packages/alfa-rules/tsconfig.json | 2 + 3 files changed, 258 insertions(+) create mode 100644 packages/alfa-rules/src/sia-r70/rule.ts create mode 100644 packages/alfa-rules/test/sia-r70/rule.spec.tsx diff --git a/packages/alfa-rules/src/sia-r70/rule.ts b/packages/alfa-rules/src/sia-r70/rule.ts new file mode 100644 index 0000000000..d03242a041 --- /dev/null +++ b/packages/alfa-rules/src/sia-r70/rule.ts @@ -0,0 +1,148 @@ +/// + +import { Rule, Diagnostic } from "@siteimprove/alfa-act"; +import { Document, Element, Namespace } from "@siteimprove/alfa-dom"; +import { Predicate } from "@siteimprove/alfa-predicate"; +import { Err, Ok } from "@siteimprove/alfa-result"; +import { Page } from "@siteimprove/alfa-web"; +import { List } from "@siteimprove/alfa-list"; +import { Iterable } from "@siteimprove/alfa-iterable"; + +import { expectation } from "../common/expectation"; +import { isIgnored, hasChild } from "../common/predicate"; +import { Group } from "../common/group"; + +import { isVisible } from "../common/predicate/is-visible"; + +import { isDocumentElement } from "../common/predicate/is-document-element"; + +const { isElement, hasName, hasNamespace } = Element; +const { and, or, test, not } = Predicate; +const deprecated = [ + "applet", + "basefont", + "bgsound", + "big", + "blink", + "center", + "content", + "dir", + "font", + "frame", + "frameset", + "hgroup", + "image", + "keygen", + "marquee", + "menuitem", + "nobr", + "noembed", + "noframes", + "plaintext", + "rb", + "rtc", + "shadow", + "spacer", + "strike", + "tt", + "xmp", +]; +export default Rule.Atomic.of>({ + uri: "https://alfa.siteimprove.com/rules/sia-r70", + evaluate({ device, document }) { + return { + applicability() { + return test(hasChild(isDocumentElement), document) ? [document] : []; + }, + + expectations(target) { + const deprecatedElements = target + .descendants({ flattened: true, nested: true }) + .filter(isElement) + .filter( + and( + hasNamespace(Namespace.HTML), + hasName("acronym", ...deprecated), + not(isIgnored(device)) + //or(isVisible(device), not(isIgnored(device))) + ) + ); + + //console.dir(deprecatedElements.toJSON(), { depth: null }); + + return { + 1: expectation( + deprecatedElements.isEmpty(), + () => Outcomes.IsNotDeprecated, + () => Outcomes.IsDeprecated(deprecatedElements) + ), + }; + }, + }; + }, +}); + +export namespace Outcomes { + export const IsNotDeprecated = Ok.of( + Diagnostic.of(`The document doesn't contain deprecated elements`) + ); + + export const IsDeprecated = (errors: Iterable) => + Err.of( + DeprecatedElements.of( + `The document contains deprecated elements: `, + errors + ) + ); +} + +class DeprecatedElements extends Diagnostic implements Iterable { + public static of( + message: string, + errors: Iterable = [] + ): DeprecatedElements { + return new DeprecatedElements(message, List.from(errors)); + } + + private readonly _errors: List; + + private constructor(message: string, errors: List) { + super(message); + this._errors = errors; + } + + public *[Symbol.iterator](): Iterator { + yield* this._errors; + } + + public equals(value: DeprecatedElements): boolean; + + public equals(value: unknown): value is this; + + public equals(value: unknown): boolean { + return ( + value instanceof DeprecatedElements && + value._message === this._message && + value._errors.equals(this._errors) + ); + } + + public toJSON(): DeprecatedElements.JSON { + return { + ...super.toJSON(), + errors: this._errors.toJSON(), + }; + } +} + +namespace DeprecatedElements { + export interface JSON extends Diagnostic.JSON { + errors: List.JSON; + } + + export function areDeprecatedElements( + value: unknown + ): value is DeprecatedElements { + return value instanceof DeprecatedElements; + } +} diff --git a/packages/alfa-rules/test/sia-r70/rule.spec.tsx b/packages/alfa-rules/test/sia-r70/rule.spec.tsx new file mode 100644 index 0000000000..c96fe208f9 --- /dev/null +++ b/packages/alfa-rules/test/sia-r70/rule.spec.tsx @@ -0,0 +1,108 @@ +import { h } from "@siteimprove/alfa-dom"; +import { test } from "@siteimprove/alfa-test"; + +import R70, { Outcomes } from "../../src/sia-r70/rule"; + +import { evaluate } from "../common/evaluate"; +import { passed, failed, inapplicable } from "../common/outcome"; +/* +test("evaluate() passes a page with no deprecated / obsolete elements ", async (t) => { + const target = ( + +

Lorem ipsum.

+ + ); + + const document = h.document([target]); + + t.deepEqual(await evaluate(R70, { document }), [ + passed(R70, document, { + 1: Outcomes.IsNotDeprecated, + }), + ]); +}); + +test("evaluate() passes a page with deprecated non visible element not into accessibility tree", async (t) => { + const target = ( + +

+ Lorem +

+ + ); + + const document = h.document([target]); + + t.deepEqual(await evaluate(R70, { document }), [ + passed(R70, document, { + 1: Outcomes.IsNotDeprecated, + }), + ]); +}); + +test("evaluate() passes a page with deprecated visible element in accessibility tree", async (t) => { + const blink = not; + const target = ( + +

Schrödinger's cat is {blink} dead.

+ + ); + + const document = h.document([target]); + + t.deepEqual(await evaluate(R70, { document }), [ + failed(R70, document, { + 1: Outcomes.IsDeprecated([blink]), + }), + ]); +}); + +test("evaluate() passes a page with deprecated visible element", async (t) => { + const blink = ; + const target = ( + +

Schrödinger's cat is {blink} dead.

+ + ); + + const document = h.document([target]); + + t.deepEqual(await evaluate(R70, { document }), [ + failed(R70, document, { + 1: Outcomes.IsDeprecated([blink]), + }), + ]); +}); +*/ + +test("evaluate() passes a page with two deprecated elements in the accessibility tree", async (t) => { + const menuitem1 = Foo; + const menuitem2 = Bar; + const target = ( + +
    + {menuitem1} + {menuitem2} +
+ + ); + + const document = h.document([target]); + + t.deepEqual(await evaluate(R70, { document }), [ + failed(R70, document, { + 1: Outcomes.IsDeprecated([menuitem1, menuitem2]), + }), + ]); +}); + +test("evaluate() is inapplicable to text nodes in disabled groups", async (t) => { + const document = h.document([ + + This is a circle + + , + ]); + + t.deepEqual(await evaluate(R70, { document }), [inapplicable(R70)]); +}); diff --git a/packages/alfa-rules/tsconfig.json b/packages/alfa-rules/tsconfig.json index 448d2d2a94..5d01b95166 100644 --- a/packages/alfa-rules/tsconfig.json +++ b/packages/alfa-rules/tsconfig.json @@ -132,6 +132,7 @@ "src/sia-r68/rule.ts", "src/sia-r69/rule.ts", "src/sia-r7/rule.ts", + "src/sia-r70/rule.ts", "src/sia-r71/rule.ts", "src/sia-r72/rule.ts", "src/sia-r73/rule.ts", @@ -205,6 +206,7 @@ "test/sia-r67/rule.spec.tsx", "test/sia-r68/rule.spec.tsx", "test/sia-r69/rule.spec.tsx", + "test/sia-r70/rule.spec.tsx", "test/sia-r71/rule.spec.tsx", "test/sia-r72/rule.spec.tsx", "test/sia-r73/rule.spec.tsx", From 975bf78693dcf7a8076fb11cf9db1d46d48c12fa Mon Sep 17 00:00:00 2001 From: elenamongelli <52746406+elenamongelli@users.noreply.github.com> Date: Wed, 23 Jun 2021 09:16:23 +0200 Subject: [PATCH 02/11] Expectation updated --- packages/alfa-rules/src/sia-r70/rule.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/alfa-rules/src/sia-r70/rule.ts b/packages/alfa-rules/src/sia-r70/rule.ts index d03242a041..37779d6e19 100644 --- a/packages/alfa-rules/src/sia-r70/rule.ts +++ b/packages/alfa-rules/src/sia-r70/rule.ts @@ -12,7 +12,7 @@ import { expectation } from "../common/expectation"; import { isIgnored, hasChild } from "../common/predicate"; import { Group } from "../common/group"; -import { isVisible } from "../common/predicate/is-visible"; +import { isRendered } from "../common/predicate/is-rendered"; import { isDocumentElement } from "../common/predicate/is-document-element"; @@ -63,8 +63,8 @@ export default Rule.Atomic.of>({ and( hasNamespace(Namespace.HTML), hasName("acronym", ...deprecated), - not(isIgnored(device)) - //or(isVisible(device), not(isIgnored(device))) + not(isIgnored(device)), + or(isRendered(device)) ) ); From 9509cbca364cbbf0f2602e8251260d8adb063ce2 Mon Sep 17 00:00:00 2001 From: elenamongelli <52746406+elenamongelli@users.noreply.github.com> Date: Wed, 23 Jun 2021 09:38:03 +0200 Subject: [PATCH 03/11] Update rule.spec.tsx --- packages/alfa-rules/test/sia-r70/rule.spec.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/alfa-rules/test/sia-r70/rule.spec.tsx b/packages/alfa-rules/test/sia-r70/rule.spec.tsx index c96fe208f9..eebac5253d 100644 --- a/packages/alfa-rules/test/sia-r70/rule.spec.tsx +++ b/packages/alfa-rules/test/sia-r70/rule.spec.tsx @@ -5,7 +5,7 @@ import R70, { Outcomes } from "../../src/sia-r70/rule"; import { evaluate } from "../common/evaluate"; import { passed, failed, inapplicable } from "../common/outcome"; -/* + test("evaluate() passes a page with no deprecated / obsolete elements ", async (t) => { const target = ( @@ -40,7 +40,7 @@ test("evaluate() passes a page with deprecated non visible element not into acce ]); }); -test("evaluate() passes a page with deprecated visible element in accessibility tree", async (t) => { +test("evaluate() fails a page with deprecated visible element in accessibility tree", async (t) => { const blink = not; const target = ( @@ -57,7 +57,7 @@ test("evaluate() passes a page with deprecated visible element in accessibility ]); }); -test("evaluate() passes a page with deprecated visible element", async (t) => { +test("evaluate() fails a page with deprecated visible element", async (t) => { const blink = ; const target = ( @@ -73,9 +73,8 @@ test("evaluate() passes a page with deprecated visible element", async (t) => { }), ]); }); -*/ -test("evaluate() passes a page with two deprecated elements in the accessibility tree", async (t) => { +test("evaluate() fails a page with two deprecated elements in the accessibility tree", async (t) => { const menuitem1 = Foo; const menuitem2 = Bar; const target = ( From bb5033ea7d68b06373c892c8d61b6988312f1bba Mon Sep 17 00:00:00 2001 From: elenamongelli <52746406+elenamongelli@users.noreply.github.com> Date: Wed, 23 Jun 2021 12:17:59 +0200 Subject: [PATCH 04/11] expectations updated as shown in sanshikan --- packages/alfa-rules/src/sia-r70/rule.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/alfa-rules/src/sia-r70/rule.ts b/packages/alfa-rules/src/sia-r70/rule.ts index 37779d6e19..ec5e7895ad 100644 --- a/packages/alfa-rules/src/sia-r70/rule.ts +++ b/packages/alfa-rules/src/sia-r70/rule.ts @@ -63,8 +63,7 @@ export default Rule.Atomic.of>({ and( hasNamespace(Namespace.HTML), hasName("acronym", ...deprecated), - not(isIgnored(device)), - or(isRendered(device)) + isRendered(device) ) ); From e3532b8a1338c7e48d2f5710bda609027944cf30 Mon Sep 17 00:00:00 2001 From: elenamongelli <52746406+elenamongelli@users.noreply.github.com> Date: Fri, 25 Jun 2021 13:44:56 +0200 Subject: [PATCH 05/11] Comments implemented --- packages/alfa-rules/src/sia-r70/rule.ts | 18 ++++++------------ packages/alfa-rules/test/sia-r70/rule.spec.tsx | 6 +++--- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/packages/alfa-rules/src/sia-r70/rule.ts b/packages/alfa-rules/src/sia-r70/rule.ts index ec5e7895ad..db03b0f2c4 100644 --- a/packages/alfa-rules/src/sia-r70/rule.ts +++ b/packages/alfa-rules/src/sia-r70/rule.ts @@ -1,5 +1,3 @@ -/// - import { Rule, Diagnostic } from "@siteimprove/alfa-act"; import { Document, Element, Namespace } from "@siteimprove/alfa-dom"; import { Predicate } from "@siteimprove/alfa-predicate"; @@ -9,15 +7,12 @@ import { List } from "@siteimprove/alfa-list"; import { Iterable } from "@siteimprove/alfa-iterable"; import { expectation } from "../common/expectation"; -import { isIgnored, hasChild } from "../common/predicate"; +import { hasChild, isRendered, isDocumentElement } from "../common/predicate"; import { Group } from "../common/group"; -import { isRendered } from "../common/predicate/is-rendered"; - -import { isDocumentElement } from "../common/predicate/is-document-element"; - const { isElement, hasName, hasNamespace } = Element; -const { and, or, test, not } = Predicate; +const { and, test } = Predicate; + const deprecated = [ "applet", "basefont", @@ -47,7 +42,8 @@ const deprecated = [ "tt", "xmp", ]; -export default Rule.Atomic.of>({ + +export default Rule.Atomic.of({ uri: "https://alfa.siteimprove.com/rules/sia-r70", evaluate({ device, document }) { return { @@ -67,8 +63,6 @@ export default Rule.Atomic.of>({ ) ); - //console.dir(deprecatedElements.toJSON(), { depth: null }); - return { 1: expectation( deprecatedElements.isEmpty(), @@ -98,7 +92,7 @@ export namespace Outcomes { class DeprecatedElements extends Diagnostic implements Iterable { public static of( message: string, - errors: Iterable = [] + errors: Iterable = List.empty() ): DeprecatedElements { return new DeprecatedElements(message, List.from(errors)); } diff --git a/packages/alfa-rules/test/sia-r70/rule.spec.tsx b/packages/alfa-rules/test/sia-r70/rule.spec.tsx index eebac5253d..cf5075bb76 100644 --- a/packages/alfa-rules/test/sia-r70/rule.spec.tsx +++ b/packages/alfa-rules/test/sia-r70/rule.spec.tsx @@ -22,7 +22,7 @@ test("evaluate() passes a page with no deprecated / obsolete elements ", async ( ]); }); -test("evaluate() passes a page with deprecated non visible element not into accessibility tree", async (t) => { +test("evaluate() passes a page with a deprecated but not rendered element", async (t) => { const target = (

@@ -40,7 +40,7 @@ test("evaluate() passes a page with deprecated non visible element not into acce ]); }); -test("evaluate() fails a page with deprecated visible element in accessibility tree", async (t) => { +test("evaluate() fails a page with deprecated and rendered element", async (t) => { const blink = not; const target = ( @@ -95,7 +95,7 @@ test("evaluate() fails a page with two deprecated elements in the accessibility ]); }); -test("evaluate() is inapplicable to text nodes in disabled groups", async (t) => { +test("evaluate() is inapplicable to non-HTML documents", async (t) => { const document = h.document([ This is a circle From d0929e90cda7d575cccfd4f52f523eb0a2438d07 Mon Sep 17 00:00:00 2001 From: elenamongelli <52746406+elenamongelli@users.noreply.github.com> Date: Mon, 5 Jul 2021 15:21:22 +0200 Subject: [PATCH 06/11] Comments implemented --- packages/alfa-rules/src/sia-r70/rule.ts | 13 ++++++------- packages/alfa-rules/test/sia-r70/rule.spec.tsx | 10 +++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/alfa-rules/src/sia-r70/rule.ts b/packages/alfa-rules/src/sia-r70/rule.ts index db03b0f2c4..b508aff583 100644 --- a/packages/alfa-rules/src/sia-r70/rule.ts +++ b/packages/alfa-rules/src/sia-r70/rule.ts @@ -8,7 +8,6 @@ import { Iterable } from "@siteimprove/alfa-iterable"; import { expectation } from "../common/expectation"; import { hasChild, isRendered, isDocumentElement } from "../common/predicate"; -import { Group } from "../common/group"; const { isElement, hasName, hasNamespace } = Element; const { and, test } = Predicate; @@ -66,8 +65,8 @@ export default Rule.Atomic.of({ return { 1: expectation( deprecatedElements.isEmpty(), - () => Outcomes.IsNotDeprecated, - () => Outcomes.IsDeprecated(deprecatedElements) + () => Outcomes.HasNoDeprecatedElement, + () => Outcomes.HasDeprecatedElements(deprecatedElements) ), }; }, @@ -76,11 +75,11 @@ export default Rule.Atomic.of({ }); export namespace Outcomes { - export const IsNotDeprecated = Ok.of( - Diagnostic.of(`The document doesn't contain deprecated elements`) + export const HasNoDeprecatedElement = Ok.of( + Diagnostic.of(`The document doesn't contain any deprecated element`) ); - export const IsDeprecated = (errors: Iterable) => + export const HasDeprecatedElements = (errors: Iterable) => Err.of( DeprecatedElements.of( `The document contains deprecated elements: `, @@ -133,7 +132,7 @@ namespace DeprecatedElements { errors: List.JSON; } - export function areDeprecatedElements( + export function isDeprecatedElements( value: unknown ): value is DeprecatedElements { return value instanceof DeprecatedElements; diff --git a/packages/alfa-rules/test/sia-r70/rule.spec.tsx b/packages/alfa-rules/test/sia-r70/rule.spec.tsx index cf5075bb76..f4b85098cc 100644 --- a/packages/alfa-rules/test/sia-r70/rule.spec.tsx +++ b/packages/alfa-rules/test/sia-r70/rule.spec.tsx @@ -17,7 +17,7 @@ test("evaluate() passes a page with no deprecated / obsolete elements ", async ( t.deepEqual(await evaluate(R70, { document }), [ passed(R70, document, { - 1: Outcomes.IsNotDeprecated, + 1: Outcomes.HasNoDeprecatedElement, }), ]); }); @@ -35,7 +35,7 @@ test("evaluate() passes a page with a deprecated but not rendered element", asyn t.deepEqual(await evaluate(R70, { document }), [ passed(R70, document, { - 1: Outcomes.IsNotDeprecated, + 1: Outcomes.HasNoDeprecatedElement, }), ]); }); @@ -52,7 +52,7 @@ test("evaluate() fails a page with deprecated and rendered element", async (t) = t.deepEqual(await evaluate(R70, { document }), [ failed(R70, document, { - 1: Outcomes.IsDeprecated([blink]), + 1: Outcomes.HasDeprecatedElements([blink]), }), ]); }); @@ -69,7 +69,7 @@ test("evaluate() fails a page with deprecated visible element", async (t) => { t.deepEqual(await evaluate(R70, { document }), [ failed(R70, document, { - 1: Outcomes.IsDeprecated([blink]), + 1: Outcomes.HasDeprecatedElements([blink]), }), ]); }); @@ -90,7 +90,7 @@ test("evaluate() fails a page with two deprecated elements in the accessibility t.deepEqual(await evaluate(R70, { document }), [ failed(R70, document, { - 1: Outcomes.IsDeprecated([menuitem1, menuitem2]), + 1: Outcomes.HasDeprecatedElements([menuitem1, menuitem2]), }), ]); }); From 29aa4b48f7cf0d52b4c155cb6c5cb5e9d676fb27 Mon Sep 17 00:00:00 2001 From: elenamongelli <52746406+elenamongelli@users.noreply.github.com> Date: Mon, 5 Jul 2021 15:26:58 +0200 Subject: [PATCH 07/11] Forgot exports --- packages/alfa-rules/src/rules.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/alfa-rules/src/rules.ts b/packages/alfa-rules/src/rules.ts index e2a7de2cfa..a0f6b9702b 100644 --- a/packages/alfa-rules/src/rules.ts +++ b/packages/alfa-rules/src/rules.ts @@ -63,6 +63,7 @@ export { default as R66 } from "./sia-r66/rule"; export { default as R67 } from "./sia-r67/rule"; export { default as R68 } from "./sia-r68/rule"; export { default as R69 } from "./sia-r69/rule"; +export { default as R70 } from "./sia-r70/rule"; export { default as R71 } from "./sia-r71/rule"; export { default as R72 } from "./sia-r72/rule"; export { default as R73 } from "./sia-r73/rule"; From 3a757c683427f26c35dd6c1432ad508517bdaaf3 Mon Sep 17 00:00:00 2001 From: elenamongelli <52746406+elenamongelli@users.noreply.github.com> Date: Thu, 8 Jul 2021 12:28:04 +0200 Subject: [PATCH 08/11] Comments implemented --- packages/alfa-rules/src/sia-r70/rule.ts | 36 ++++++++++++------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/packages/alfa-rules/src/sia-r70/rule.ts b/packages/alfa-rules/src/sia-r70/rule.ts index b508aff583..014af5f632 100644 --- a/packages/alfa-rules/src/sia-r70/rule.ts +++ b/packages/alfa-rules/src/sia-r70/rule.ts @@ -5,6 +5,7 @@ import { Err, Ok } from "@siteimprove/alfa-result"; import { Page } from "@siteimprove/alfa-web"; import { List } from "@siteimprove/alfa-list"; import { Iterable } from "@siteimprove/alfa-iterable"; +import { Array } from "@siteimprove/alfa-array"; import { expectation } from "../common/expectation"; import { hasChild, isRendered, isDocumentElement } from "../common/predicate"; @@ -12,7 +13,8 @@ import { hasChild, isRendered, isDocumentElement } from "../common/predicate"; const { isElement, hasName, hasNamespace } = Element; const { and, test } = Predicate; -const deprecated = [ +const isDeprecated = hasName( + "acronym", "applet", "basefont", "bgsound", @@ -39,8 +41,8 @@ const deprecated = [ "spacer", "strike", "tt", - "xmp", -]; + "xmp" +); export default Rule.Atomic.of({ uri: "https://alfa.siteimprove.com/rules/sia-r70", @@ -55,11 +57,7 @@ export default Rule.Atomic.of({ .descendants({ flattened: true, nested: true }) .filter(isElement) .filter( - and( - hasNamespace(Namespace.HTML), - hasName("acronym", ...deprecated), - isRendered(device) - ) + and(hasNamespace(Namespace.HTML), isDeprecated, isRendered(device)) ); return { @@ -91,14 +89,12 @@ export namespace Outcomes { class DeprecatedElements extends Diagnostic implements Iterable { public static of( message: string, - errors: Iterable = List.empty() + errors: Iterable = [] ): DeprecatedElements { - return new DeprecatedElements(message, List.from(errors)); + return new DeprecatedElements(message, Array.from(errors)); } - private readonly _errors: List; - - private constructor(message: string, errors: List) { + private constructor(message: string, errors: Array) { super(message); this._errors = errors; } @@ -107,24 +103,26 @@ class DeprecatedElements extends Diagnostic implements Iterable { yield* this._errors; } - public equals(value: DeprecatedElements): boolean; - - public equals(value: unknown): value is this; + private _errors: ReadonlyArray; - public equals(value: unknown): boolean { + public equalsError(value: unknown, errors: ReadonlyArray): boolean { return ( value instanceof DeprecatedElements && value._message === this._message && - value._errors.equals(this._errors) + Array.equals(value._errors, this._errors) ); } public toJSON(): DeprecatedElements.JSON { return { ...super.toJSON(), - errors: this._errors.toJSON(), + errors: Array.toJSON(this._errors), }; } + + public get errors(): ReadonlyArray { + return this._errors; + } } namespace DeprecatedElements { From 06bd3978d4a2f173201be5e40acd42c4a5183ad8 Mon Sep 17 00:00:00 2001 From: elenamongelli <52746406+elenamongelli@users.noreply.github.com> Date: Fri, 16 Jul 2021 11:23:11 +0200 Subject: [PATCH 09/11] Apply suggestions from code review Co-authored-by: Kasper Isager --- packages/alfa-rules/src/sia-r70/rule.ts | 26 ++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/alfa-rules/src/sia-r70/rule.ts b/packages/alfa-rules/src/sia-r70/rule.ts index 014af5f632..f5bef71514 100644 --- a/packages/alfa-rules/src/sia-r70/rule.ts +++ b/packages/alfa-rules/src/sia-r70/rule.ts @@ -93,41 +93,45 @@ class DeprecatedElements extends Diagnostic implements Iterable { ): DeprecatedElements { return new DeprecatedElements(message, Array.from(errors)); } + + private _errors: ReadonlyArray; private constructor(message: string, errors: Array) { super(message); this._errors = errors; } - - public *[Symbol.iterator](): Iterator { - yield* this._errors; + + public get errors(): ReadonlyArray { + return this._errors; } - private _errors: ReadonlyArray; + public equals(value: DeprecatedElements): boolean; + + public equals(value: unknown): value is this; - public equalsError(value: unknown, errors: ReadonlyArray): boolean { + public equals(value: unknown): boolean { return ( value instanceof DeprecatedElements && value._message === this._message && Array.equals(value._errors, this._errors) ); } + + public *[Symbol.iterator](): Iterator { + yield* this._errors; + } public toJSON(): DeprecatedElements.JSON { return { ...super.toJSON(), - errors: Array.toJSON(this._errors), + errors: this._errors.map((element) => element.path()), }; } - - public get errors(): ReadonlyArray { - return this._errors; - } } namespace DeprecatedElements { export interface JSON extends Diagnostic.JSON { - errors: List.JSON; + errors: Array; } export function isDeprecatedElements( From 11fc48b017e3f3da6c491cf45f29cef90fc9f81e Mon Sep 17 00:00:00 2001 From: elenamongelli <52746406+elenamongelli@users.noreply.github.com> Date: Fri, 16 Jul 2021 16:22:54 +0200 Subject: [PATCH 10/11] Ran yarn document --- .github/workflows/integrate.yml | 2 + .github/workflows/release.yml | 2 +- CHANGELOG.md | 18 - docs/api.md | 56 +- docs/releasing.md | 2 +- docs/review/api/alfa-act.api.md | 14 +- docs/review/api/alfa-applicative.api.md | 6 +- docs/review/api/alfa-array.api.md | 8 +- docs/review/api/alfa-branched.api.md | 9 +- docs/review/api/alfa-collection.api.md | 31 +- docs/review/api/alfa-comparable.api.md | 23 +- docs/review/api/alfa-css.api.md | 118 +- docs/review/api/alfa-dom.api.md | 17 +- docs/review/api/alfa-either.api.md | 36 +- docs/review/api/alfa-equatable.api.md | 5 +- docs/review/api/alfa-future.api.md | 5 +- docs/review/api/alfa-iterable.api.md | 10 +- docs/review/api/alfa-lazy.api.md | 10 +- docs/review/api/alfa-list.api.md | 19 +- docs/review/api/alfa-map.api.md | 39 +- docs/review/api/alfa-monad.api.md | 11 +- docs/review/api/alfa-option.api.md | 21 +- docs/review/api/alfa-result.api.md | 31 +- docs/review/api/alfa-rules.api.md | 17 +- docs/review/api/alfa-selective.api.md | 12 +- docs/review/api/alfa-sequence.api.md | 31 +- docs/review/api/alfa-set.api.md | 6 +- docs/review/api/alfa-slice.api.md | 14 +- docs/review/api/alfa-style.api.md | 7 +- docs/review/api/alfa-trampoline.api.md | 5 +- package.json | 4 +- packages/alfa-act/package.json | 39 +- packages/alfa-act/src/question.ts | 20 +- packages/alfa-act/tsconfig.json | 3 - packages/alfa-affine/package.json | 12 +- packages/alfa-angular/package.json | 14 +- packages/alfa-applicative/package.json | 7 +- packages/alfa-applicative/src/applicative.ts | 4 +- packages/alfa-applicative/tsconfig.json | 3 - packages/alfa-aria/package.json | 48 +- packages/alfa-aria/src/feature.ts | 47 +- packages/alfa-aria/src/name.ts | 5 +- packages/alfa-aria/test/name.spec.tsx | 143 -- packages/alfa-aria/test/node.spec.tsx | 76 +- packages/alfa-array/package.json | 28 +- packages/alfa-array/src/array.ts | 19 +- packages/alfa-assert/package.json | 12 +- packages/alfa-bits/package.json | 4 +- packages/alfa-branched/package.json | 28 +- packages/alfa-branched/src/branched.ts | 15 +- packages/alfa-cache/package.json | 10 +- packages/alfa-callback/package.json | 6 +- packages/alfa-cascade/package.json | 28 +- packages/alfa-chai/package.json | 12 +- packages/alfa-cheerio/package.json | 14 +- packages/alfa-cli/package.json | 44 +- packages/alfa-clone/package.json | 4 +- packages/alfa-collection/package.json | 34 +- packages/alfa-collection/src/collection.ts | 43 +- packages/alfa-command/package.json | 24 +- packages/alfa-comparable/package.json | 6 +- packages/alfa-comparable/src/comparable.ts | 99 +- packages/alfa-comparable/src/comparer.ts | 4 +- packages/alfa-compatibility/package.json | 8 +- packages/alfa-continuation/package.json | 8 +- packages/alfa-crawler/package.json | 18 +- packages/alfa-css/package.json | 36 +- packages/alfa-css/src/value/length.ts | 10 +- packages/alfa-cypress/package.json | 22 +- packages/alfa-device/package.json | 14 +- packages/alfa-dom/package.json | 28 +- packages/alfa-dom/src/jsx-runtime.ts | 4 +- packages/alfa-dom/src/jsx.ts | 16 +- packages/alfa-earl/package.json | 10 +- packages/alfa-either/package.json | 23 +- packages/alfa-either/src/either.ts | 16 +- packages/alfa-either/src/left.ts | 21 +- packages/alfa-either/src/right.ts | 12 +- packages/alfa-either/tsconfig.json | 3 - packages/alfa-emitter/package.json | 12 +- packages/alfa-encoding/package.json | 4 +- packages/alfa-enzyme/package.json | 8 +- packages/alfa-equatable/package.json | 4 +- packages/alfa-equatable/src/equatable.ts | 25 - packages/alfa-fnv/package.json | 6 +- packages/alfa-foldable/package.json | 6 +- packages/alfa-formatter-earl/package.json | 8 +- packages/alfa-formatter-json/package.json | 8 +- packages/alfa-formatter-sarif/package.json | 8 +- packages/alfa-formatter/package.json | 8 +- packages/alfa-frontier/package.json | 14 +- packages/alfa-functor/package.json | 6 +- packages/alfa-future/package.json | 24 +- packages/alfa-future/src/future.ts | 13 +- packages/alfa-generator/package.json | 8 +- packages/alfa-graph/package.json | 18 +- packages/alfa-hash/package.json | 12 +- packages/alfa-highlight/package.json | 2 +- packages/alfa-http/package.json | 22 +- packages/alfa-iana/package.json | 16 +- packages/alfa-interviewer/package.json | 8 +- packages/alfa-iterable/package.json | 24 +- packages/alfa-iterable/src/iterable.ts | 36 +- packages/alfa-jasmine/package.json | 14 +- packages/alfa-jest/package.json | 14 +- packages/alfa-jquery/package.json | 14 +- packages/alfa-json-ld/package.json | 6 +- packages/alfa-json/package.json | 6 +- packages/alfa-json/src/serializable.ts | 10 +- packages/alfa-lazy/package.json | 19 +- packages/alfa-lazy/src/lazy.ts | 13 +- packages/alfa-lazy/tsconfig.json | 3 - packages/alfa-list/package.json | 40 +- packages/alfa-list/src/list.ts | 48 +- packages/alfa-list/test/list.spec.ts | 7 - packages/alfa-map/package.json | 34 +- packages/alfa-map/src/map.ts | 79 +- packages/alfa-map/src/status.ts | 16 +- packages/alfa-map/test/map.spec.ts | 52 - packages/alfa-mapper/package.json | 4 +- packages/alfa-math/package.json | 4 +- packages/alfa-media/package.json | 24 +- packages/alfa-monad/package.json | 8 +- packages/alfa-monad/src/monad.ts | 7 +- packages/alfa-monad/tsconfig.json | 6 - packages/alfa-network/package.json | 20 +- packages/alfa-option/package.json | 30 +- packages/alfa-option/src/none.ts | 23 +- packages/alfa-option/src/option.ts | 19 +- packages/alfa-option/src/some.ts | 24 +- packages/alfa-option/test/option.spec.ts | 4 - packages/alfa-parser/package.json | 16 +- packages/alfa-performance/package.json | 12 +- packages/alfa-playwright/package.json | 14 +- packages/alfa-predicate/package.json | 10 +- packages/alfa-promise/package.json | 10 +- packages/alfa-protractor/package.json | 12 +- packages/alfa-puppeteer/package.json | 14 +- packages/alfa-react/package.json | 16 +- packages/alfa-record/package.json | 20 +- packages/alfa-reducer/package.json | 4 +- packages/alfa-refinement/package.json | 8 +- packages/alfa-result/package.json | 30 +- packages/alfa-result/src/err.ts | 20 +- packages/alfa-result/src/ok.ts | 20 +- packages/alfa-result/src/result.ts | 5 +- packages/alfa-rules/package.json | 78 +- .../src/common/expectation/get-colors.ts | 8 - packages/alfa-rules/src/sia-r62/rule.ts | 270 +-- packages/alfa-rules/src/sia-r70/rule.ts | 26 +- packages/alfa-rules/src/sia-r75/rule.ts | 32 +- .../alfa-rules/test/sia-r62/rule.spec.tsx | 355 +--- .../alfa-rules/test/sia-r69/rule.spec.tsx | 9 - packages/alfa-sarif/package.json | 8 +- packages/alfa-scraper/package.json | 32 +- packages/alfa-selective/package.json | 23 +- packages/alfa-selective/src/selective.ts | 46 +- .../alfa-selective/test/selective.spec.ts | 35 - packages/alfa-selective/tsconfig.json | 3 - packages/alfa-selector/package.json | 28 +- packages/alfa-sequence/package.json | 36 +- packages/alfa-sequence/src/cons.ts | 47 +- packages/alfa-sequence/src/nil.ts | 31 +- packages/alfa-sequence/src/sequence.ts | 35 +- packages/alfa-sequence/test/sequence.spec.ts | 32 - packages/alfa-set/package.json | 28 +- packages/alfa-set/src/set.ts | 12 +- packages/alfa-slice/package.json | 30 +- packages/alfa-slice/src/slice.ts | 47 +- packages/alfa-style/package.json | 49 +- packages/alfa-style/src/index.ts | 1 - .../alfa-style/src/property/text-shadow.ts | 111 -- packages/alfa-style/src/style.ts | 2 +- packages/alfa-style/src/value.ts | 13 +- .../test/property/text-shadow.spec.tsx | 78 - packages/alfa-style/tsconfig.json | 5 - packages/alfa-table/package.json | 26 +- packages/alfa-table/test/table.spec.tsx | 72 - packages/alfa-test/package.json | 4 +- packages/alfa-thenable/package.json | 6 +- packages/alfa-thunk/package.json | 8 +- packages/alfa-time/package.json | 4 +- packages/alfa-trampoline/package.json | 24 +- packages/alfa-trampoline/src/trampoline.ts | 15 +- packages/alfa-trilean/package.json | 8 +- packages/alfa-unexpected/package.json | 14 +- packages/alfa-url/package.json | 18 +- packages/alfa-vue/package.json | 14 +- packages/alfa-wcag/package.json | 12 +- packages/alfa-web/package.json | 22 +- packages/alfa-webdriver/package.json | 12 +- packages/alfa-xpath/package.json | 22 +- scripts/publish.sh | 2 +- scripts/version.sh | 2 +- yarn.lock | 1656 ++++++++--------- 195 files changed, 2423 insertions(+), 3780 deletions(-) delete mode 100644 packages/alfa-style/src/property/text-shadow.ts delete mode 100644 packages/alfa-style/test/property/text-shadow.spec.tsx diff --git a/.github/workflows/integrate.yml b/.github/workflows/integrate.yml index 80b27b39d6..106628de7b 100644 --- a/.github/workflows/integrate.yml +++ b/.github/workflows/integrate.yml @@ -14,6 +14,8 @@ jobs: os: [ubuntu-latest, windows-latest] node: [14, 16] runs-on: ${{ matrix.os }} + env: + NODE_OPTIONS: "--max-old-space-size=4096" steps: - uses: actions/checkout@v2.3.4 - uses: actions/setup-node@v2.2.0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9ee9022705..749219a4d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: - run: > yarn workspaces foreach --no-private - --topological-dev + --topological npm publish --tolerate-republish - uses: actions/create-release@v1.1.4 env: diff --git a/CHANGELOG.md b/CHANGELOG.md index e2fe230a8e..a15d965b84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,30 +21,12 @@ Items that are related, such as breaking changes, new features, or changes to ex ## [Unreleased] -## [0.20.0](../../compare/v0.19.0...v0.20.0) (2021-07-09) - In addition to the changes listed below, this release adjusts the compile target from `es2018` to `es2020`. -### Added - -- [@siteimprove/alfa-rules](packages/alfa-rules): Implementations of SIA-R54, SIA-R55, and SIA-R78 are now available. ([#834](../../pull/834), [#835](../../pull/835), [#854](../../pull/854)) - -- [@siteimprove/alfa-scraper](packages/alfa-scraper): The `Scraper#scrape()` methods now accepts an `archive` option for storing an archive of the page scraped. ([#840](../../pull/840)) - -- [@siteimprove/alfa-cli](packages/alfa-cli): Two new flags, `--archive` and `--archive-format`, are now available in the `alfa scrape` command for storing an archive of the page scraped. ([#840](../../pull/840)) - -- [@siteimprove/alfa-hash](packages/alfa-hash): `Hash#writeBigInt()`, `Hash#writeBigInt64()`, `Hash#writeBigUint64()`, `Hash#writeUndefined()`, `Hash#writeNull()`,`Hash#writeObject()`, and `Hash#writeSymbol()` are now available. ([#853](../../pull/853)) - ### Fixed -- [@siteimprove/alfa-aria](packages/alfa-aria): A bug in how names were computed for subtrees and implicitly referenced `(mapper: Question>): Question; - // (undocumented) flatMap(mapper: Mapper>): Question; // (undocumented) - flatten(this: Question>): Question; - // (undocumented) map(mapper: Mapper): Question; // (undocumented) get message(): string; @@ -407,7 +402,7 @@ export class Question implements Functor, Applicative, Mon get type(): Q; // (undocumented) get uri(): string; -} + } // @public (undocumented) export namespace Question { @@ -644,4 +639,5 @@ export namespace Tag { } } + ``` diff --git a/docs/review/api/alfa-applicative.api.md b/docs/review/api/alfa-applicative.api.md index 4b9140e70d..2de3416243 100644 --- a/docs/review/api/alfa-applicative.api.md +++ b/docs/review/api/alfa-applicative.api.md @@ -4,15 +4,13 @@ ```ts -import { Functor } from '@siteimprove/alfa-functor'; import { Mapper } from '@siteimprove/alfa-mapper'; // @public (undocumented) -export interface Applicative extends Functor { +export interface Applicative { // (undocumented) apply(mapper: Applicative>): Applicative; - // (undocumented) - map(mapper: Mapper): Applicative; } + ``` diff --git a/docs/review/api/alfa-array.api.md b/docs/review/api/alfa-array.api.md index b646bd0fd7..4b233d181a 100644 --- a/docs/review/api/alfa-array.api.md +++ b/docs/review/api/alfa-array.api.md @@ -28,7 +28,7 @@ namespace Array_2 { // (undocumented) function append(array: Array_2, value: T): Array_2; // (undocumented) - function apply(array: ReadonlyArray, mapper: ReadonlyArray>): Array_2; + function apply(iterable: ReadonlyArray, mapper: ReadonlyArray>): Array_2; // (undocumented) function clone>(array: ReadonlyArray): Array_2; // (undocumented) @@ -36,9 +36,9 @@ namespace Array_2 { // (undocumented) function collectFirst(array: ReadonlyArray, mapper: Mapper, [index: number]>): Option; // (undocumented) - function compare, U = T>(a: ReadonlyArray, b: Iterable_2): Comparison; + function compare>(a: ReadonlyArray, b: Iterable_2): Comparison; // (undocumented) - function compareWith(a: ReadonlyArray, b: Iterable_2, comparer: Comparer): Comparison; + function compareWith(a: ReadonlyArray, b: Iterable_2, comparer: Comparer): Comparison; // (undocumented) function concat(array: ReadonlyArray, ...iterables: Array_2>): Array_2; // (undocumented) @@ -134,6 +134,8 @@ namespace Array_2 { // (undocumented) function zip(array: ReadonlyArray, iterable: Iterable_2): Array_2<[T, U]>; } + export { Array_2 as Array } + ``` diff --git a/docs/review/api/alfa-branched.api.md b/docs/review/api/alfa-branched.api.md index 01f393fc04..073f4d9118 100644 --- a/docs/review/api/alfa-branched.api.md +++ b/docs/review/api/alfa-branched.api.md @@ -48,8 +48,6 @@ export class Branched implements Collection, Iterable_2<[T, Ite // (undocumented) flatMap(mapper: Mapper, [Iterable_2]>): Branched; // (undocumented) - flatten(this: Branched, B>): Branched; - // (undocumented) forEach(callback: Callback]>): void; // (undocumented) hash(hash: Hash): void; @@ -77,7 +75,7 @@ export class Branched implements Collection, Iterable_2<[T, Ite toArray(): Array<[T, Array]>; // (undocumented) toJSON(): Branched.JSON; -} + } // @public (undocumented) export namespace Branched { @@ -87,8 +85,8 @@ export namespace Branched { export function isBranched(value: unknown): value is Branched; // (undocumented) export type JSON = Array<[ - Serializable.ToJSON, - Array> + Serializable.ToJSON, + Array> ]>; // (undocumented) export function sequence(values: Iterable_2>): Branched, B>; @@ -96,6 +94,7 @@ export namespace Branched { export function traverse(values: Iterable_2, mapper: Mapper, [index: number]>): Branched, B>; } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-collection.api.md b/docs/review/api/alfa-collection.api.md index 788455631b..1e34d647b5 100644 --- a/docs/review/api/alfa-collection.api.md +++ b/docs/review/api/alfa-collection.api.md @@ -23,7 +23,7 @@ import { Refinement } from '@siteimprove/alfa-refinement'; import { Serializable } from '@siteimprove/alfa-json'; // @public (undocumented) -export interface Collection extends Functor, Applicative, Monad, Foldable, Equatable, Hashable { +export interface Collection extends Functor, Monad, Foldable, Applicative, Equatable, Hashable { // (undocumented) apply(mapper: Collection>): Collection; // (undocumented) @@ -47,8 +47,6 @@ export interface Collection extends Functor, Applicative, Monad, Fol // (undocumented) flatMap(mapper: Mapper>): Collection; // (undocumented) - flatten(this: Collection>): Collection; - // (undocumented) forEach(callback: Callback): void; // (undocumented) includes(value: T): boolean; @@ -73,7 +71,9 @@ export interface Collection extends Functor, Applicative, Monad, Fol // @public (undocumented) export namespace Collection { // (undocumented) - export interface Indexed extends Collection, Iterable_2, Comparable>, Serializable> { + export function compare>(a: Indexed, b: Iterable_2): Comparison; + // (undocumented) + export interface Indexed extends Collection, Iterable_2, Serializable> { // (undocumented) append(value: T): Indexed; // (undocumented) @@ -83,9 +83,7 @@ export namespace Collection { // (undocumented) collectFirst(mapper: Mapper, [index: number]>): Option; // (undocumented) - compare(this: Indexed>, iterable: Iterable_2): Comparison; - // (undocumented) - compareWith(iterable: Iterable_2, comparer: Comparer): Comparison; + compareWith(iterable: Iterable_2, comparer: Comparer): Comparison; // (undocumented) concat(iterable: Iterable_2): Indexed; // (undocumented) @@ -107,8 +105,6 @@ export namespace Collection { // (undocumented) flatMap(mapper: Mapper, [index: number]>): Indexed; // (undocumented) - flatten(this: Indexed>): Indexed; - // (undocumented) forEach(callback: Callback): void; // (undocumented) get(index: number): Option; @@ -165,8 +161,6 @@ export namespace Collection { // (undocumented) some(predicate: Predicate): boolean; // (undocumented) - sort>(this: Indexed): Indexed; - // (undocumented) sortWith(comparer: Comparer): Indexed; // (undocumented) subtract(iterable: Iterable_2): Indexed; @@ -177,14 +171,10 @@ export namespace Collection { // (undocumented) takeLastUntil(predicate: Predicate): Indexed; // (undocumented) - takeLastWhile(refinement: Refinement): Indexed; - // (undocumented) takeLastWhile(predicate: Predicate): Indexed; // (undocumented) takeUntil(predicate: Predicate): Indexed; // (undocumented) - takeWhile(refinement: Refinement): Indexed; - // (undocumented) takeWhile(predicate: Predicate): Indexed; // (undocumented) trim(predicate: Predicate): Indexed; @@ -229,8 +219,6 @@ export namespace Collection { // (undocumented) flatMap(mapper: Mapper, [key: K]>): Keyed; // (undocumented) - flatten(this: Keyed>): Keyed; - // (undocumented) forEach(callback: Callback): void; // (undocumented) get(key: K): Option; @@ -263,11 +251,13 @@ export namespace Collection { export namespace Keyed { // (undocumented) export type JSON = Array<[ - Serializable.ToJSON, - Serializable.ToJSON + Serializable.ToJSON, + Serializable.ToJSON ]>; } // (undocumented) + export function sort>(collection: Indexed): Indexed; + // (undocumented) export interface Unkeyed extends Collection, Iterable_2, Serializable> { // (undocumented) add(value: T): Unkeyed; @@ -298,8 +288,6 @@ export namespace Collection { // (undocumented) flatMap(mapper: Mapper>): Unkeyed; // (undocumented) - flatten(this: Unkeyed>): Unkeyed; - // (undocumented) forEach(callback: Callback): void; // (undocumented) get(value: T): Option; @@ -333,6 +321,7 @@ export namespace Collection { } } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-comparable.api.md b/docs/review/api/alfa-comparable.api.md index 19b33ea84c..fd1f8d2f65 100644 --- a/docs/review/api/alfa-comparable.api.md +++ b/docs/review/api/alfa-comparable.api.md @@ -4,38 +4,48 @@ ```ts -// @public +// @public (undocumented) export interface Comparable { + // (undocumented) compare(value: T): Comparison; } -// @public +// @public (undocumented) export namespace Comparable { + // (undocumented) export function compare(a: string, b: string): Comparison; + // (undocumented) export function compare(a: number, b: number): Comparison; + // (undocumented) export function compare(a: bigint, b: bigint): Comparison; + // (undocumented) export function compare(a: boolean, b: boolean): Comparison; - export function compare, U = T>(a: T, b: U): Comparison; + // (undocumented) + export function compare(a: Comparable, b: T): Comparison; // (undocumented) export function compareBigInt(a: bigint, b: bigint): Comparison; // (undocumented) export function compareBoolean(a: boolean, b: boolean): Comparison; // (undocumented) - export function compareComparable, U = T>(a: T, b: U): Comparison; + export function compareComparable(a: Comparable, b: T): Comparison; // (undocumented) export function compareNumber(a: number, b: number): Comparison; // (undocumented) export function compareString(a: string, b: string): Comparison; + // (undocumented) export function isComparable(value: unknown): value is Comparable; - export function isEqual(a: Comparable, b: T): boolean; + // (undocumented) export function isGreaterThan(a: Comparable, b: T): boolean; + // (undocumented) export function isGreaterThanOrEqual(a: Comparable, b: T): boolean; + // (undocumented) export function isLessThan(a: Comparable, b: T): boolean; + // (undocumented) export function isLessThanOrEqual(a: Comparable, b: T): boolean; } // @public (undocumented) -export type Comparer = []> = (a: T, b: U, ...args: A) => Comparison; +export type Comparer = []> = (a: T, b: T, ...args: A) => Comparison; // @public (undocumented) export enum Comparison { @@ -47,6 +57,7 @@ export enum Comparison { Less = -1 } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-css.api.md b/docs/review/api/alfa-css.api.md index 632ae7a5fe..b03c580ad5 100644 --- a/docs/review/api/alfa-css.api.md +++ b/docs/review/api/alfa-css.api.md @@ -72,7 +72,7 @@ export class Block implements Iterable, Equatable, Serializable { toString(): string; // (undocumented) get value(): Array; -} + } // @public (undocumented) export namespace Block { @@ -333,7 +333,7 @@ export namespace Calculation { get type(): "value"; // (undocumented) get value(): Numeric; - } + } // (undocumented) export namespace Value { // (undocumented) @@ -428,7 +428,7 @@ export class Component implements Iterable, Equatable, Serializable { toString(): string; // (undocumented) get value(): Array; -} + } // @public (undocumented) export namespace Component { @@ -488,7 +488,7 @@ export class Declaration implements Iterable, Equatable, Serializable { toString(): string; // (undocumented) get value(): Array; -} + } // @public (undocumented) export namespace Declaration { @@ -604,7 +604,7 @@ class Function_2 implements Iterable, Equatable, Serializable { toString(): string; // (undocumented) get value(): Array; -} + } // @public (undocumented) namespace Function_2 { @@ -622,6 +622,7 @@ namespace Function_2 { const // (undocumented) parse: (name?: string | undefined, body?: Parser, T, string, []> | undefined) => Parser, readonly [Function_2, T], string, []>; } + export { Function_2 as Function } // @public (undocumented) @@ -738,7 +739,7 @@ export class Hex extends Value<"color"> { get type(): "color"; // (undocumented) get value(): number; -} + } // @public (undocumented) export namespace Hex { @@ -943,7 +944,7 @@ export class Keyword extends Value<"keyword"> { get type(): "keyword"; // (undocumented) get value(): T; -} + } // @public (undocumented) export namespace Keyword { @@ -981,7 +982,7 @@ export class Length extends Dimension<"leng // (undocumented) static of(value: number, unit: U): Length; // (undocumented) - toJSON(): Length.JSON; + toJSON(): Length.JSON; // (undocumented) toString(): string; // (undocumented) @@ -999,9 +1000,9 @@ export namespace Length { const // (undocumented) parse: Parser, Length, string>; // (undocumented) - export interface JSON extends Dimension.JSON<"length"> { + export interface JSON extends Dimension.JSON<"length"> { // (undocumented) - unit: U; + unit: Unit.Length; } } @@ -1057,7 +1058,7 @@ export namespace Linear { get type(): "corner"; // (undocumented) get vertical(): Position.Vertical; - } + } // (undocumented) export namespace Corner { // (undocumented) @@ -1156,7 +1157,7 @@ export class Matrix extends Value<"transform"> { get type(): "transform"; // (undocumented) get values(): Matrix.Values; -} + } // @public (undocumented) export namespace Matrix { @@ -1171,30 +1172,30 @@ export namespace Matrix { } // (undocumented) export type Values = [ - [ - T, - T, - T, - T - ], - [ - T, - T, - T, - T - ], - [ - T, - T, - T, - T - ], - [ - T, - T, - T, - T - ] + [ + T, + T, + T, + T + ], + [ + T, + T, + T, + T + ], + [ + T, + T, + T, + T + ], + [ + T, + T, + T, + T + ] ]; const // (undocumented) parse: Parser, Matrix, string>; @@ -1311,6 +1312,7 @@ namespace Number_2 { const // (undocumented) parse: Parser, Number_2, string>; } + export { Number_2 as Number } // @public (undocumented) @@ -1430,7 +1432,7 @@ export class Polygon>; -} + } // @public (undocumented) export namespace Polygon { @@ -1469,7 +1471,7 @@ export class Position = Positi get type(): "position"; // (undocumented) get vertical(): V; -} + } // @public (undocumented) export namespace Position { @@ -1637,7 +1639,7 @@ export namespace Radial { get type(): "ellipse"; // (undocumented) get vertical(): R; - } + } // (undocumented) export namespace Ellipse { // (undocumented) @@ -1749,7 +1751,7 @@ export class Radius extends Value<"transform"> { get y(): Number_2; // (undocumented) get z(): Number_2; -} + } // @public (undocumented) export namespace Rotate { @@ -1948,7 +1950,7 @@ export class Scale extends Value<"transform"> { get x(): Number_2; // (undocumented) get y(): Number_2; -} + } // @public (undocumented) export namespace Scale { @@ -1993,7 +1995,7 @@ export class Shadow extends Valu get x(): X; // (undocumented) get y(): Y; -} + } // @public (undocumented) export namespace Skew { @@ -2106,7 +2108,7 @@ class String_2 extends Value<"string"> { get type(): "string"; // (undocumented) get value(): string; -} + } // @public (undocumented) namespace String_2 { @@ -2120,6 +2122,7 @@ namespace String_2 { const // (undocumented) parse: Parser, String_2, string>; } + export { String_2 as String } // @public (undocumented) @@ -2152,7 +2155,7 @@ export namespace Token { get type(): "at-keyword"; // (undocumented) get value(): string; - } + } // (undocumented) export namespace AtKeyword { // (undocumented) @@ -2372,7 +2375,7 @@ export namespace Token { get type(): "delim"; // (undocumented) get value(): number; - } + } const // (undocumented) url: typeof URL.of, // (undocumented) isURL: typeof URL.isURL; @@ -2410,7 +2413,7 @@ export namespace Token { get unit(): string; // (undocumented) get value(): number; - } + } // (undocumented) export namespace Dimension { // (undocumented) @@ -2449,7 +2452,7 @@ export namespace Token { get type(): "function"; // (undocumented) get value(): string; - } + } // (undocumented) export namespace Function { // (undocumented) @@ -2483,7 +2486,7 @@ export namespace Token { get type(): "hash"; // (undocumented) get value(): string; - } + } // (undocumented) export namespace Hash { // (undocumented) @@ -2514,7 +2517,7 @@ export namespace Token { get type(): "ident"; // (undocumented) get value(): string; - } + } const // (undocumented) number: typeof Number.of, // (undocumented) isNumber: typeof Number.isNumber; @@ -2552,7 +2555,7 @@ export namespace Token { get type(): "number"; // (undocumented) get value(): number; - } + } const // (undocumented) percentage: typeof Percentage.of, // (undocumented) isPercentage: typeof Percentage.isPercentage; @@ -2752,7 +2755,7 @@ export namespace Token { get type(): "percentage"; // (undocumented) get value(): number; - } + } // (undocumented) export namespace Percentage { // (undocumented) @@ -2818,7 +2821,7 @@ export namespace Token { get type(): "string"; // (undocumented) get value(): string; - } + } // (undocumented) export namespace String { // (undocumented) @@ -2852,7 +2855,7 @@ export namespace Token { get type(): "url"; // (undocumented) get value(): string; - } + } // (undocumented) export namespace URL { // (undocumented) @@ -2949,7 +2952,7 @@ export class Translate { get type(): "url"; // (undocumented) get url(): string; -} + } // @public (undocumented) export namespace URL { @@ -3083,6 +3086,7 @@ export namespace Value { } } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-dom.api.md b/docs/review/api/alfa-dom.api.md index a74f2b1587..7286420907 100644 --- a/docs/review/api/alfa-dom.api.md +++ b/docs/review/api/alfa-dom.api.md @@ -50,7 +50,7 @@ export class Attribute extends Node { toString(): string; // (undocumented) get value(): string; -} + } // @public (undocumented) export namespace Attribute { @@ -184,7 +184,7 @@ export class Declaration implements Equatable, Serializable { toString(): string; // (undocumented) get value(): string; -} + } // @public (undocumented) export namespace Declaration { @@ -548,15 +548,13 @@ function isEditingHost(element: Element): boolean; function isSuggestedFocusable(element: Element): boolean; // @public (undocumented) -export function jsx(name: string, properties?: jsx.Properties | null, ...children: jsx.Children): Element; +export function jsx(name: string, properties?: jsx.Properties | null, ...children: Array): Element; // @public (undocumented) export namespace jsx { // (undocumented) export type Child = Node | string; // (undocumented) - export type Children = (Child | Children)[]; - // (undocumented) export namespace JSX { // Warning: (ae-forgotten-export) The symbol "dom" needs to be exported by the entry point index.d.ts // @@ -787,10 +785,10 @@ export namespace Node { }; // (undocumented) "@type": [ - "ptr:Pointer", - "ptr:SinglePointer", - "ptr:ExpressionPointer", - "ptr:XPathPointer" + "ptr:Pointer", + "ptr:SinglePointer", + "ptr:ExpressionPointer", + "ptr:XPathPointer" ]; // (undocumented) "ptr:expression": string; @@ -1178,6 +1176,7 @@ export namespace Type { } } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-either.api.md b/docs/review/api/alfa-either.api.md index 4201ae7d3c..a3f91d6f89 100644 --- a/docs/review/api/alfa-either.api.md +++ b/docs/review/api/alfa-either.api.md @@ -4,7 +4,6 @@ ```ts -import { Applicative } from '@siteimprove/alfa-applicative'; import { Equatable } from '@siteimprove/alfa-equatable'; import { Foldable } from '@siteimprove/alfa-foldable'; import { Functor } from '@siteimprove/alfa-functor'; @@ -19,15 +18,11 @@ import { Reducer } from '@siteimprove/alfa-reducer'; import { Serializable } from '@siteimprove/alfa-json'; // @public (undocumented) -export interface Either extends Functor, Applicative, Monad, Foldable, Iterable, Equatable, Hashable, Serializable> { - // (undocumented) - apply(mapper: Either>): Either; +export interface Either extends Functor, Monad, Foldable, Iterable, Equatable, Hashable, Serializable> { // (undocumented) either(left: Mapper, right: Mapper): T; // (undocumented) - flatMap(mapper: Mapper>): Either; - // (undocumented) - flatten(this: Either>): Either; + flatMap(mapper: Mapper>): Either; // (undocumented) get(): L | R; // (undocumented) @@ -37,9 +32,9 @@ export interface Either extends Functor, Applicative, Monad, // (undocumented) left(): Option; // (undocumented) - map(mapper: Mapper): Either; + map(mapper: Mapper): Either; // (undocumented) - reduce(reducer: Reducer, accumulator: T): T; + reduce(reducer: Reducer, accumulator: T): T; // (undocumented) right(): Option; // (undocumented) @@ -65,17 +60,13 @@ export class Left implements Either { // (undocumented) [Symbol.iterator](): Iterator; // (undocumented) - apply(): Left; - // (undocumented) either(left: Mapper): T; // (undocumented) equals(value: Left): boolean; // (undocumented) equals(value: unknown): value is this; // (undocumented) - flatMap(): Left; - // (undocumented) - flatten(this: Either): Either; + flatMap(mapper: Mapper>): Either; // (undocumented) get(): L; // (undocumented) @@ -87,18 +78,18 @@ export class Left implements Either { // (undocumented) left(): Option; // (undocumented) - map(): Left; + map(mapper: Mapper): Either; // (undocumented) static of(value: L): Left; // (undocumented) - reduce(reducer: unknown, accumulator: T): T; + reduce(reducer: Reducer, accumulator: T): T; // (undocumented) right(): None; // (undocumented) toJSON(): Left.JSON; // (undocumented) toString(): string; -} + } // @public (undocumented) export namespace Left { @@ -122,17 +113,13 @@ export class Right implements Either { // (undocumented) [Symbol.iterator](): Iterator; // (undocumented) - apply(mapper: Either>): Either; - // (undocumented) either(left: unknown, right: Mapper): T; // (undocumented) equals(value: Right): boolean; // (undocumented) equals(value: unknown): value is this; // (undocumented) - flatMap(mapper: Mapper>): Either; - // (undocumented) - flatten(this: Right>): Either; + flatMap(mapper: Mapper>): Either; // (undocumented) get(): R; // (undocumented) @@ -144,7 +131,7 @@ export class Right implements Either { // (undocumented) left(): None; // (undocumented) - map(mapper: Mapper): Right; + map(mapper: Mapper): Either; // (undocumented) static of(value: R): Right; // (undocumented) @@ -155,7 +142,7 @@ export class Right implements Either { toJSON(): Right.JSON; // (undocumented) toString(): string; -} + } // @public (undocumented) export namespace Right { @@ -174,6 +161,7 @@ export namespace Right { } } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-equatable.api.md b/docs/review/api/alfa-equatable.api.md index 5c5c381baa..6d84a1d6dc 100644 --- a/docs/review/api/alfa-equatable.api.md +++ b/docs/review/api/alfa-equatable.api.md @@ -4,18 +4,19 @@ ```ts -// @public +// @public (undocumented) export interface Equatable { equals(value: this): boolean; equals(value: unknown): value is this; } -// @public +// @public (undocumented) export namespace Equatable { export function equals(a: unknown, b: unknown): boolean; export function isEquatable(value: unknown): value is Equatable; } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-future.api.md b/docs/review/api/alfa-future.api.md index dce35c2b1b..bf2ca03fcd 100644 --- a/docs/review/api/alfa-future.api.md +++ b/docs/review/api/alfa-future.api.md @@ -15,7 +15,7 @@ import { Thenable } from '@siteimprove/alfa-thenable'; import { Thunk } from '@siteimprove/alfa-thunk'; // @public (undocumented) -export abstract class Future implements Functor, Applicative, Monad, Thenable, AsyncIterable { +export abstract class Future implements Functor, Monad, Applicative, Thenable, AsyncIterable { // (undocumented) [Symbol.asyncIterator](): AsyncIterator; // (undocumented) @@ -25,8 +25,6 @@ export abstract class Future implements Functor, Applicative, Monad, // (undocumented) abstract flatMap(mapper: Mapper>): Future; // (undocumented) - flatten(this: Future>): Future; - // (undocumented) get(): T; // (undocumented) abstract isDeferred(): boolean; @@ -72,6 +70,7 @@ export namespace Future { export function traverse(values: Iterable_2, mapper: Mapper, [index: number]>): Future>; } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-iterable.api.md b/docs/review/api/alfa-iterable.api.md index 0826223dd0..28a6342681 100644 --- a/docs/review/api/alfa-iterable.api.md +++ b/docs/review/api/alfa-iterable.api.md @@ -30,9 +30,9 @@ namespace Iterable_2 { // (undocumented) function collectFirst(iterable: Iterable_2, mapper: Mapper, [index: number]>): Option; // (undocumented) - function compare, U = T>(a: Iterable_2, b: Iterable_2): Comparison; + function compare>(a: Iterable_2, b: Iterable_2): Comparison; // (undocumented) - function compareWith(a: Iterable_2, b: Iterable_2, comparer: Comparer): Comparison; + function compareWith(a: Iterable_2, b: Iterable_2, comparer: Comparer): Comparison; // (undocumented) function concat(iterable: Iterable_2, ...iterables: Array>): Iterable_2; // (undocumented) @@ -144,14 +144,10 @@ namespace Iterable_2 { // (undocumented) function takeLastUntil(iterable: Iterable_2, predicate: Predicate): Iterable_2; // (undocumented) - function takeLastWhile(iterable: Iterable_2, refinement: Refinement): Iterable_2; - // (undocumented) function takeLastWhile(iterable: Iterable_2, predicate: Predicate): Iterable_2; // (undocumented) function takeUntil(iterable: Iterable_2, predicate: Predicate): Iterable_2; // (undocumented) - function takeWhile(iterable: Iterable_2, refinement: Refinement): Iterable_2; - // (undocumented) function takeWhile(iterable: Iterable_2, predicate: Predicate): Iterable_2; // (undocumented) function toJSON(iterable: Iterable_2): Array>; @@ -164,8 +160,10 @@ namespace Iterable_2 { // (undocumented) function zip(a: Iterable_2, b: Iterable_2): Iterable_2<[T, U]>; } + export { Iterable_2 as Iterable } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-lazy.api.md b/docs/review/api/alfa-lazy.api.md index 15e97d2666..69bb3907c8 100644 --- a/docs/review/api/alfa-lazy.api.md +++ b/docs/review/api/alfa-lazy.api.md @@ -4,7 +4,6 @@ ```ts -import { Applicative } from '@siteimprove/alfa-applicative'; import { Equatable } from '@siteimprove/alfa-equatable'; import { Functor } from '@siteimprove/alfa-functor'; import { Mapper } from '@siteimprove/alfa-mapper'; @@ -13,20 +12,16 @@ import { Serializable } from '@siteimprove/alfa-json'; import { Thunk } from '@siteimprove/alfa-thunk'; // @public (undocumented) -export class Lazy implements Functor, Applicative, Monad, Iterable, Equatable, Serializable> { +export class Lazy implements Functor, Monad, Iterable, Equatable, Serializable> { // (undocumented) [Symbol.iterator](): Iterator; // (undocumented) - apply(mapper: Lazy>): Lazy; - // (undocumented) equals(value: Lazy): boolean; // (undocumented) equals(value: unknown): value is this; // (undocumented) flatMap(mapper: Mapper>): Lazy; // (undocumented) - flatten(this: Lazy>): Lazy; - // (undocumented) static force(value: T): Lazy; // (undocumented) force(): T; @@ -42,7 +37,7 @@ export class Lazy implements Functor, Applicative, Monad, Iterable; -} + } // @public (undocumented) export namespace Lazy { @@ -50,6 +45,7 @@ export namespace Lazy { export type JSON = Serializable.ToJSON; } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-list.api.md b/docs/review/api/alfa-list.api.md index fe19ec00fa..9d27152183 100644 --- a/docs/review/api/alfa-list.api.md +++ b/docs/review/api/alfa-list.api.md @@ -82,7 +82,7 @@ export class Leaf implements Node { set(index: number, value: T): Leaf; // (undocumented) get values(): Array; -} + } // @public (undocumented) export class List implements Collection.Indexed { @@ -97,9 +97,7 @@ export class List implements Collection.Indexed { // (undocumented) collectFirst(mapper: Mapper, [index: number]>): Option; // (undocumented) - compare(this: List>, iterable: Iterable_2): Comparison; - // (undocumented) - compareWith(iterable: Iterable_2, comparer: Comparer): Comparison; + compareWith(iterable: Iterable_2, comparer: Comparer): Comparison; // (undocumented) concat(iterable: Iterable_2): List; // (undocumented) @@ -127,8 +125,6 @@ export class List implements Collection.Indexed { // (undocumented) flatMap(mapper: Mapper, [index: number]>): List; // (undocumented) - flatten(this: List>): List; - // (undocumented) forEach(callback: Callback): void; // (undocumented) get(index: number): Option; @@ -193,8 +189,6 @@ export class List implements Collection.Indexed { // (undocumented) some(predicate: Predicate): boolean; // (undocumented) - sort>(this: List): List; - // (undocumented) sortWith(comparer: Comparer): List; // (undocumented) subtract(iterable: Iterable_2): List; @@ -205,14 +199,10 @@ export class List implements Collection.Indexed { // (undocumented) takeLastUntil(predicate: Predicate): List; // (undocumented) - takeLastWhile(refinement: Refinement): List; - // (undocumented) takeLastWhile(predicate: Predicate): List; // (undocumented) takeUntil(predicate: Predicate): List; // (undocumented) - takeWhile(refinement: Refinement): List; - // (undocumented) takeWhile(predicate: Predicate): List; // (undocumented) toArray(): Array_2; @@ -232,6 +222,8 @@ export class List implements Collection.Indexed { // @public (undocumented) export namespace List { + // (undocumented) + export function compare>(a: List, b: Iterable_2): Comparison; // (undocumented) export function from(iterable: Iterable_2): List; // (undocumented) @@ -244,6 +236,8 @@ export namespace List { export function isList(value: unknown): value is List; // (undocumented) export type JSON = Collection.Indexed.JSON; + // (undocumented) + export function sort>(list: List): List; } // Warning: (ae-internal-missing-underscore) The name "Node" should be prefixed with an underscore because the declaration is marked as @internal @@ -276,6 +270,7 @@ export namespace Node { export function underflow(shift: number): number; } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-map.api.md b/docs/review/api/alfa-map.api.md index 19555d49ac..806ad8f8e8 100644 --- a/docs/review/api/alfa-map.api.md +++ b/docs/review/api/alfa-map.api.md @@ -78,21 +78,22 @@ export class Leaf implements Node { set(key: K, value: V, hash: number, shift: number): Status>; // (undocumented) get value(): V; -} + } // @public (undocumented) class Map_2 implements Collection.Keyed { // (undocumented) [Symbol.iterator](): Iterator<[K, V]>; + // (undocumented) apply(mapper: Map_2>): Map_2; // (undocumented) - collect(mapper: Mapper, [key: K]>): Map_2; + collect(mapper: Mapper, [K]>): Map_2; // (undocumented) - collectFirst(mapper: Mapper, [key: K]>): Option; + collectFirst(mapper: Mapper, [K]>): Option; // (undocumented) concat(iterable: Iterable_2): Map_2; // (undocumented) - count(predicate: Predicate): number; + count(predicate: Predicate): number; // (undocumented) delete(key: K): Map_2; // (undocumented) @@ -104,21 +105,19 @@ class Map_2 implements Collection.Keyed { // (undocumented) equals(value: unknown): value is this; // (undocumented) - every(predicate: Predicate): boolean; - // (undocumented) - filter(refinement: Refinement): Map_2; + every(predicate: Predicate): boolean; // (undocumented) - filter(predicate: Predicate): Map_2; + filter(refinement: Refinement): Map_2; // (undocumented) - find(refinement: Refinement): Option; + filter(predicate: Predicate): Map_2; // (undocumented) - find(predicate: Predicate): Option; + find(refinement: Refinement): Option; // (undocumented) - flatMap(mapper: Mapper, [key: K]>): Map_2; + find(predicate: Predicate): Option; // (undocumented) - flatten(this: Map_2>): Map_2; + flatMap(mapper: Mapper, [K]>): Map_2; // (undocumented) - forEach(callback: Callback): void; + forEach(callback: Callback): void; // (undocumented) get(key: K): Option; // (undocumented) @@ -136,23 +135,23 @@ class Map_2 implements Collection.Keyed { // (undocumented) keys(): Iterable_2; // (undocumented) - map(mapper: Mapper): Map_2; + map(mapper: Mapper): Map_2; // (undocumented) - none(predicate: Predicate): boolean; + none(predicate: Predicate): boolean; // (undocumented) static of(...entries: Array_2): Map_2; // (undocumented) - reduce(reducer: Reducer, accumulator: R): R; + reduce(reducer: Reducer, accumulator: R): R; // (undocumented) - reject(refinement: Refinement): Map_2>; + reject(refinement: Refinement): Map_2>; // (undocumented) - reject(predicate: Predicate): Map_2; + reject(predicate: Predicate): Map_2; // (undocumented) set(key: K, value: V): Map_2; // (undocumented) get size(): number; // (undocumented) - some(predicate: Predicate): boolean; + some(predicate: Predicate): boolean; // (undocumented) subtract(iterable: Iterable_2): Map_2; // (undocumented) @@ -180,6 +179,7 @@ namespace Map_2 { // (undocumented) type JSON = Collection.Keyed.JSON; } + export { Map_2 as Map } // Warning: (ae-internal-missing-underscore) The name "Node" should be prefixed with an underscore because the declaration is marked as @internal @@ -234,6 +234,7 @@ export class Sparse implements Node { set(key: K, value: V, hash: number, shift: number): Status>; } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-monad.api.md b/docs/review/api/alfa-monad.api.md index ced96cd5c1..dc39da4a67 100644 --- a/docs/review/api/alfa-monad.api.md +++ b/docs/review/api/alfa-monad.api.md @@ -4,22 +4,15 @@ ```ts -import { Applicative } from '@siteimprove/alfa-applicative'; -import { Functor } from '@siteimprove/alfa-functor'; import { Mapper } from '@siteimprove/alfa-mapper'; // @public (undocumented) -export interface Monad extends Functor, Applicative { - // (undocumented) - apply(mapper: Monad>): Monad; +export interface Monad { // (undocumented) flatMap(mapper: Mapper>): Monad; - // (undocumented) - flatten(this: Monad>): Monad; - // (undocumented) - map(mapper: Mapper): Monad; } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-option.api.md b/docs/review/api/alfa-option.api.md index 4c19f75c83..bc9c1e4330 100644 --- a/docs/review/api/alfa-option.api.md +++ b/docs/review/api/alfa-option.api.md @@ -41,7 +41,7 @@ export namespace None { } // @public (undocumented) -export interface Option extends Functor, Applicative, Monad, Foldable, Iterable, Equatable, Hashable, Serializable> { +export interface Option extends Functor, Monad, Foldable, Applicative, Iterable, Equatable, Hashable, Serializable> { // (undocumented) and(option: Option): Option; // (undocumented) @@ -49,9 +49,7 @@ export interface Option extends Functor, Applicative, Monad, Foldabl // (undocumented) apply(mapper: Option>): Option; // (undocumented) - compare(this: Option>, option: Option): Comparison; - // (undocumented) - compareWith(option: Option, comparer: Comparer): Comparison; + compareWith(option: Option, comparer: Comparer): Comparison; // (undocumented) every(predicate: Predicate): boolean; // (undocumented) @@ -61,8 +59,6 @@ export interface Option extends Functor, Applicative, Monad, Foldabl // (undocumented) flatMap(mapper: Mapper>): Option; // (undocumented) - flatten(this: Option>): Option; - // (undocumented) get(): T; // (undocumented) getOr(value: U): T | U; @@ -98,9 +94,13 @@ export interface Option extends Functor, Applicative, Monad, Foldabl // @public (undocumented) export namespace Option { + // (undocumented) + export function compare>(a: Option, b: Option): Comparison; // (undocumented) export function empty(): Option; // (undocumented) + export function flatten(option: Option>): Option; + // (undocumented) export function from(value: T | null | undefined): Option>; // (undocumented) export function isNone(value: Iterable): value is None; @@ -133,9 +133,7 @@ export class Some implements Option { // (undocumented) apply(mapper: Option>): Option; // (undocumented) - compare(this: Option>, option: Option): Comparison; - // (undocumented) - compareWith(option: Option, comparer: Comparer): Comparison; + compareWith(option: Option, comparer: Comparer): Comparison; // (undocumented) equals(value: unknown): value is this; // (undocumented) @@ -147,8 +145,6 @@ export class Some implements Option { // (undocumented) flatMap(mapper: Mapper>): Option; // (undocumented) - flatten(this: Some>): Option; - // (undocumented) get(): T; // (undocumented) getOr(): T; @@ -186,7 +182,7 @@ export class Some implements Option { toJSON(): Some.JSON; // (undocumented) toString(): string; -} + } // @public (undocumented) export namespace Some { @@ -205,6 +201,7 @@ export namespace Some { } } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-result.api.md b/docs/review/api/alfa-result.api.md index f7d76be8c5..8d73bb6922 100644 --- a/docs/review/api/alfa-result.api.md +++ b/docs/review/api/alfa-result.api.md @@ -26,11 +26,11 @@ export class Err implements Result { // (undocumented) [Symbol.iterator](): Generator; // (undocumented) - and(): Err; + and(): this; // (undocumented) - andThen(): Err; + andThen(): this; // (undocumented) - apply(): Err; + apply(): this; // (undocumented) equals(value: unknown): value is this; // (undocumented) @@ -40,9 +40,7 @@ export class Err implements Result { // (undocumented) everyErr(predicate: Predicate): boolean; // (undocumented) - flatMap(): Err; - // (undocumented) - flatten(this: Result): Result; + flatMap(): this; // (undocumented) get(): never; // (undocumented) @@ -62,11 +60,11 @@ export class Err implements Result { // (undocumented) isOk(): this is Ok; // (undocumented) - map(): Err; + map(): this; // (undocumented) mapErr(mapper: Mapper): Err; // (undocumented) - mapOrElse(ok: unknown, err: Mapper): U; + mapOrElse(ok: Mapper, err: Mapper): U; // (undocumented) none(): boolean; // (undocumented) @@ -131,8 +129,6 @@ export class Ok implements Result { // (undocumented) flatMap(mapper: Mapper>): Result; // (undocumented) - flatten(this: Ok>): Result; - // (undocumented) get(): T; // (undocumented) getErr(): never; @@ -153,9 +149,9 @@ export class Ok implements Result { // (undocumented) map(mapper: Mapper): Ok; // (undocumented) - mapErr(): Ok; + mapErr(): this; // (undocumented) - mapOrElse(ok: Mapper): U; + mapOrElse(ok: Mapper): U; // (undocumented) none(predicate: Predicate): boolean; // (undocumented) @@ -165,9 +161,9 @@ export class Ok implements Result { // (undocumented) ok(): Option; // (undocumented) - or(): Ok; + or(): this; // (undocumented) - orElse(): Ok; + orElse(): this; // (undocumented) reduce(reducer: Reducer, accumulator: U): U; // (undocumented) @@ -182,7 +178,7 @@ export class Ok implements Result { toJSON(): Ok.JSON; // (undocumented) toString(): string; -} + } // @public (undocumented) export namespace Ok { @@ -200,7 +196,7 @@ export namespace Ok { } // @public (undocumented) -export interface Result extends Functor, Applicative, Monad, Foldable, Iterable, Equatable, Hashable, Serializable> { +export interface Result extends Functor, Monad, Foldable, Applicative, Iterable, Equatable, Hashable, Serializable> { // (undocumented) and(result: Result): Result; // (undocumented) @@ -216,8 +212,6 @@ export interface Result extends Functor, Applicative, Monad, // (undocumented) flatMap(mapper: Mapper>): Result; // (undocumented) - flatten(this: Result, E>): Result; - // (undocumented) get(): T; // (undocumented) getErr(): E; @@ -277,6 +271,7 @@ export namespace Result { export function of(value: T): Result; } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-rules.api.md b/docs/review/api/alfa-rules.api.md index b1d7ade697..185bbbdc57 100644 --- a/docs/review/api/alfa-rules.api.md +++ b/docs/review/api/alfa-rules.api.md @@ -208,7 +208,7 @@ const _default_64: Rule.Atomic; const _default_65: Rule.Atomic; // @public (undocumented) -const _default_66: Rule.Atomic; +const _default_66: Rule.Atomic; // @public (undocumented) const _default_67: Rule.Atomic; @@ -232,16 +232,16 @@ const _default_71: Rule.Atomic; const _default_72: Rule.Atomic; // @public (undocumented) -const _default_73: Rule.Atomic, Question>; +const _default_73: Rule.Atomic; // @public (undocumented) -const _default_74: Rule.Atomic; +const _default_74: Rule.Atomic, Question>; // @public (undocumented) -const _default_75: Rule.Atomic; +const _default_75: Rule.Atomic; // @public (undocumented) -const _default_76: Rule.Atomic; +const _default_76: Rule.Atomic; // @public (undocumented) const _default_77: Rule.Atomic; @@ -250,13 +250,13 @@ const _default_77: Rule.Atomic; const _default_78: Rule.Atomic; // @public (undocumented) -const _default_79: Rule.Atomic; +const _default_79: Rule.Atomic; // @public (undocumented) const _default_8: Rule.Atomic; // @public (undocumented) -const _default_80: Rule.Atomic; +const _default_80: Rule.Atomic; // @public (undocumented) const _default_81: Rule.Atomic; @@ -276,6 +276,9 @@ const _default_85: Rule.Atomic; // @public (undocumented) const _default_86: Rule.Atomic; +// @public (undocumented) +const _default_87: Rule.Atomic; + // @public (undocumented) const _default_9: Rule.Atomic; diff --git a/docs/review/api/alfa-selective.api.md b/docs/review/api/alfa-selective.api.md index f7366be4f3..36d369773a 100644 --- a/docs/review/api/alfa-selective.api.md +++ b/docs/review/api/alfa-selective.api.md @@ -4,7 +4,6 @@ ```ts -import { Applicative } from '@siteimprove/alfa-applicative'; import { Either } from '@siteimprove/alfa-either'; import { Equatable } from '@siteimprove/alfa-equatable'; import { Functor } from '@siteimprove/alfa-functor'; @@ -17,23 +16,18 @@ import { Refinement } from '@siteimprove/alfa-refinement'; import { Serializable } from '@siteimprove/alfa-json'; // @public (undocumented) -export class Selective implements Functor, Applicative, Monad, Iterable, Equatable, Hashable, Serializable> { +export class Selective implements Functor, Monad, Iterable, Equatable, Hashable, Serializable> { // (undocumented) [Symbol.iterator](): Iterator; // (undocumented) - apply(mapper: Selective>): Selective; - // (undocumented) else(mapper: Mapper): Selective; // (undocumented) equals(value: Selective): boolean; // (undocumented) equals(value: unknown): value is this; - exhaust(this: Selective): T; // (undocumented) flatMap(mapper: Mapper>): Selective; // (undocumented) - flatten(this: Selective>): Selective; - // (undocumented) get(): S | T; // (undocumented) hash(hash: Hash): void; @@ -51,14 +45,16 @@ export class Selective implements Functor, Applicative, Mona toJSON(): Selective.JSON; // (undocumented) toString(): string; -} + } // @public (undocumented) export namespace Selective { + export function exhaust(selective: Selective): T; // (undocumented) export type JSON = Either.JSON; } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-sequence.api.md b/docs/review/api/alfa-sequence.api.md index 7ba65cb679..a221523e6b 100644 --- a/docs/review/api/alfa-sequence.api.md +++ b/docs/review/api/alfa-sequence.api.md @@ -36,9 +36,7 @@ export class Cons implements Sequence { // (undocumented) collectFirst(mapper: Mapper, [index: number]>): Option; // (undocumented) - compare(this: Sequence>, iterable: Iterable_2): Comparison; - // (undocumented) - compareWith(iterable: Iterable_2, comparer: Comparer): Comparison; + compareWith(iterable: Iterable_2, comparer: Comparer): Comparison; // (undocumented) concat(iterable: Iterable_2): Cons; // (undocumented) @@ -68,8 +66,6 @@ export class Cons implements Sequence { // @internal (undocumented) flatMap(mapper: Mapper, [index: number]>, index: number): Sequence; // (undocumented) - flatten(this: Sequence>): Sequence; - // (undocumented) forEach(callback: Callback): void; // (undocumented) get(index: number): Option; @@ -138,8 +134,6 @@ export class Cons implements Sequence { // (undocumented) some(predicate: Predicate): boolean; // (undocumented) - sort>(this: Sequence): Sequence; - // (undocumented) sortWith(comparer: Comparer): Sequence; // (undocumented) subtract(iterable: Iterable_2): Sequence; @@ -150,16 +144,12 @@ export class Cons implements Sequence { // (undocumented) takeLastUntil(predicate: Predicate): Sequence; // (undocumented) - takeLastWhile(refinement: Refinement): Sequence; - // (undocumented) takeLastWhile(predicate: Predicate): Sequence; // (undocumented) takeUntil(predicate: Predicate): Sequence; // @internal (undocumented) takeUntil(predicate: Predicate, index: number): Sequence; // (undocumented) - takeWhile(refinement: Refinement): Sequence; - // (undocumented) takeWhile(predicate: Predicate): Sequence; // (undocumented) toArray(): Array_2; @@ -211,9 +201,7 @@ export interface Sequence extends Collection.Indexed { // (undocumented) collectFirst(mapper: Mapper, [index: number]>): Option; // (undocumented) - compare(this: Sequence>, iterable: Iterable): Comparison; - // (undocumented) - compareWith(iterable: Iterable, comparer: Comparer): Comparison; + compareWith(iterable: Iterable, comparer: Comparer): Comparison; // (undocumented) concat(iterable: Iterable): Sequence; // (undocumented) @@ -235,8 +223,6 @@ export interface Sequence extends Collection.Indexed { // (undocumented) flatMap(mapper: Mapper, [index: number]>): Sequence; // (undocumented) - flatten(this: Sequence>): Sequence; - // (undocumented) forEach(callback: Callback): void; // (undocumented) get(index: number): Option; @@ -295,8 +281,6 @@ export interface Sequence extends Collection.Indexed { // (undocumented) some(predicate: Predicate): boolean; // (undocumented) - sort>(this: Sequence): Sequence; - // (undocumented) sortWith(comparer: Comparer): Sequence; // (undocumented) subtract(iterable: Iterable): Sequence; @@ -307,14 +291,10 @@ export interface Sequence extends Collection.Indexed { // (undocumented) takeLastUntil(predicate: Predicate): Sequence; // (undocumented) - takeLastWhile(refinement: Refinement): Sequence; - // (undocumented) takeLastWhile(predicate: Predicate): Sequence; // (undocumented) takeUntil(predicate: Predicate): Sequence; // (undocumented) - takeWhile(refinement: Refinement): Sequence; - // (undocumented) takeWhile(predicate: Predicate): Sequence; // (undocumented) toArray(): Array_2; @@ -332,9 +312,13 @@ export interface Sequence extends Collection.Indexed { // @public (undocumented) export namespace Sequence { + // (undocumented) + export function compare>(a: Sequence, b: Iterable): Comparison; // (undocumented) export function empty(): Sequence; // (undocumented) + export function flatten(sequence: Sequence>): Sequence; + // (undocumented) export function from(iterable: Iterable): Sequence; // (undocumented) export function fromArray(array: Array_2): Sequence; @@ -358,8 +342,11 @@ export namespace Sequence { export type JSON = Cons.JSON | Nil.JSON; // (undocumented) export function of(head: T, tail?: Lazy>): Sequence; + // (undocumented) + export function sort>(sequence: Sequence): Sequence; } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-set.api.md b/docs/review/api/alfa-set.api.md index 80026042d7..48cde32acc 100644 --- a/docs/review/api/alfa-set.api.md +++ b/docs/review/api/alfa-set.api.md @@ -54,8 +54,6 @@ class Set_2 implements Collection.Unkeyed { // (undocumented) flatMap(mapper: Mapper>): Set_2; // (undocumented) - flatten(this: Set_2>): Set_2; - // (undocumented) forEach(callback: Callback): void; // (undocumented) get(value: T): Option; @@ -95,7 +93,7 @@ class Set_2 implements Collection.Unkeyed { toJSON(): Set_2.JSON; // (undocumented) toString(): string; -} + } // @public (undocumented) namespace Set_2 { @@ -112,8 +110,10 @@ namespace Set_2 { // (undocumented) type JSON = Collection.Unkeyed.JSON; } + export { Set_2 as Set } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-slice.api.md b/docs/review/api/alfa-slice.api.md index 06f35bfef5..cb77b04ca3 100644 --- a/docs/review/api/alfa-slice.api.md +++ b/docs/review/api/alfa-slice.api.md @@ -7,7 +7,6 @@ import { Array as Array_2 } from '@siteimprove/alfa-array'; import { Callback } from '@siteimprove/alfa-callback'; import { Collection } from '@siteimprove/alfa-collection'; -import { Comparable } from '@siteimprove/alfa-comparable'; import { Comparer } from '@siteimprove/alfa-comparable'; import { Comparison } from '@siteimprove/alfa-comparable'; import { Hash } from '@siteimprove/alfa-hash'; @@ -34,9 +33,7 @@ export class Slice implements Collection.Indexed { // (undocumented) collectFirst(mapper: Mapper, [index: number]>): Option; // (undocumented) - compare(this: Slice>, iterable: Iterable_2): Comparison; - // (undocumented) - compareWith(iterable: Iterable_2, comparer: Comparer): Comparison; + compareWith(iterable: Iterable_2, comparer: Comparer): Comparison; // (undocumented) concat(iterable: Iterable_2): Slice; // (undocumented) @@ -64,8 +61,6 @@ export class Slice implements Collection.Indexed { // (undocumented) flatMap(mapper: Mapper, [index: number]>): Slice; // (undocumented) - flatten(this: Slice>): Slice; - // (undocumented) forEach(callback: Callback): void; // (undocumented) get(index: number): Option; @@ -134,8 +129,6 @@ export class Slice implements Collection.Indexed { // (undocumented) some(predicate: Predicate): boolean; // (undocumented) - sort>(this: Slice): Slice; - // (undocumented) sortWith(comparer: Comparer): Slice; // (undocumented) subtract(iterable: Iterable_2): Slice; @@ -146,14 +139,10 @@ export class Slice implements Collection.Indexed { // (undocumented) takeLastUntil(predicate: Predicate): Slice; // (undocumented) - takeLastWhile(refinement: Refinement): Slice; - // (undocumented) takeLastWhile(predicate: Predicate): Slice; // (undocumented) takeUntil(predicate: Predicate): Slice; // (undocumented) - takeWhile(refinement: Refinement): Slice; - // (undocumented) takeWhile(predicate: Predicate): Slice; // (undocumented) toArray(): Array_2; @@ -183,6 +172,7 @@ export namespace Slice { export type JSON = Array_2>; } + // (No @packageDocumentation comment for this package) ``` diff --git a/docs/review/api/alfa-style.api.md b/docs/review/api/alfa-style.api.md index 368c4bb199..2fe9b2ebac 100644 --- a/docs/review/api/alfa-style.api.md +++ b/docs/review/api/alfa-style.api.md @@ -5,7 +5,6 @@ ```ts import { Angle } from '@siteimprove/alfa-css'; -import { Applicative } from '@siteimprove/alfa-applicative'; import { Color } from '@siteimprove/alfa-css'; import { Context } from '@siteimprove/alfa-selector'; import { Current } from '@siteimprove/alfa-css'; @@ -223,18 +222,14 @@ export namespace Style { } // @public (undocumented) -export class Value implements Functor, Applicative, Monad, Iterable, Equatable, Serializable> { +export class Value implements Functor, Monad, Iterable, Equatable, Serializable> { // (undocumented) [Symbol.iterator](): Iterator; // (undocumented) - apply(mapper: Value>): Value; - // (undocumented) equals(value: unknown): value is this; // (undocumented) flatMap(mapper: Mapper>): Value; // (undocumented) - flatten(this: Value>): Value; - // (undocumented) includes(value: T): boolean; // (undocumented) map(mapper: Mapper): Value; diff --git a/docs/review/api/alfa-trampoline.api.md b/docs/review/api/alfa-trampoline.api.md index b43d9b4bd7..be69c41801 100644 --- a/docs/review/api/alfa-trampoline.api.md +++ b/docs/review/api/alfa-trampoline.api.md @@ -15,7 +15,7 @@ import { Reducer } from '@siteimprove/alfa-reducer'; import { Thunk } from '@siteimprove/alfa-thunk'; // @public (undocumented) -export abstract class Trampoline implements Functor, Applicative, Monad, Foldable, Iterable_2 { +export abstract class Trampoline implements Functor, Monad, Foldable, Applicative, Iterable_2 { // (undocumented) [Symbol.iterator](): Iterator; // (undocumented) @@ -23,8 +23,6 @@ export abstract class Trampoline implements Functor, Applicative, Monad // (undocumented) abstract flatMap(mapper: Mapper>): Trampoline; // (undocumented) - flatten(this: Trampoline>): Trampoline; - // (undocumented) abstract isDone(): boolean; // (undocumented) abstract isSuspended(): boolean; @@ -62,6 +60,7 @@ export namespace Trampoline { export function traverse(values: Iterable_2, mapper: Mapper, [index: number]>): Trampoline>; } + // (No @packageDocumentation comment for this package) ``` diff --git a/package.json b/package.json index 89e33fc923..d4eeada0e8 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "bugs": "https://github.com/siteimprove/alfa/issues", "scripts": { - "build": "node --max-old-space-size=4096 scripts/build.js --pretty", + "build": "node scripts/build.js --pretty", "clean": "node scripts/clean.js --pretty", "test": "node scripts/test.js --pretty", "watch": "node scripts/watch.js --pretty", @@ -30,7 +30,7 @@ "execa": "^5.1.1", "minimist": "^1.2.5", "prettier": "^2.3.1", - "typescript": "^4.3.5" + "typescript": "^4.3.2" }, "resolutions": { "@microsoft/api-documenter": "patch:@microsoft/api-documenter@7.12.7#.yarn/patches/api-documenter.patch" diff --git a/packages/alfa-act/package.json b/packages/alfa-act/package.json index 95aa76370c..04dd5b4d3f 100644 --- a/packages/alfa-act/package.json +++ b/packages/alfa-act/package.json @@ -2,7 +2,7 @@ "$schema": "http://json.schemastore.org/package", "name": "@siteimprove/alfa-act", "homepage": "https://alfa.siteimprove.com", - "version": "0.20.0", + "version": "0.19.0", "license": "MIT", "description": "Functionality for implementing rules specified in the ACT Rules Format", "repository": { @@ -18,27 +18,26 @@ "src/**/*.d.ts" ], "dependencies": { - "@siteimprove/alfa-applicative": "workspace:^0.20.0", - "@siteimprove/alfa-earl": "workspace:^0.20.0", - "@siteimprove/alfa-equatable": "workspace:^0.20.0", - "@siteimprove/alfa-functor": "workspace:^0.20.0", - "@siteimprove/alfa-future": "workspace:^0.20.0", - "@siteimprove/alfa-iterable": "workspace:^0.20.0", - "@siteimprove/alfa-json": "workspace:^0.20.0", - "@siteimprove/alfa-list": "workspace:^0.20.0", - "@siteimprove/alfa-mapper": "workspace:^0.20.0", - "@siteimprove/alfa-monad": "workspace:^0.20.0", - "@siteimprove/alfa-option": "workspace:^0.20.0", - "@siteimprove/alfa-performance": "workspace:^0.20.0", - "@siteimprove/alfa-record": "workspace:^0.20.0", - "@siteimprove/alfa-result": "workspace:^0.20.0", - "@siteimprove/alfa-sarif": "workspace:^0.20.0", - "@siteimprove/alfa-sequence": "workspace:^0.20.0", - "@siteimprove/alfa-thunk": "workspace:^0.20.0", - "@siteimprove/alfa-trilean": "workspace:^0.20.0" + "@siteimprove/alfa-earl": "workspace:^0.19.0", + "@siteimprove/alfa-equatable": "workspace:^0.19.0", + "@siteimprove/alfa-functor": "workspace:^0.19.0", + "@siteimprove/alfa-future": "workspace:^0.19.0", + "@siteimprove/alfa-iterable": "workspace:^0.19.0", + "@siteimprove/alfa-json": "workspace:^0.19.0", + "@siteimprove/alfa-list": "workspace:^0.19.0", + "@siteimprove/alfa-mapper": "workspace:^0.19.0", + "@siteimprove/alfa-monad": "workspace:^0.19.0", + "@siteimprove/alfa-option": "workspace:^0.19.0", + "@siteimprove/alfa-performance": "workspace:^0.19.0", + "@siteimprove/alfa-record": "workspace:^0.19.0", + "@siteimprove/alfa-result": "workspace:^0.19.0", + "@siteimprove/alfa-sarif": "workspace:^0.19.0", + "@siteimprove/alfa-sequence": "workspace:^0.19.0", + "@siteimprove/alfa-thunk": "workspace:^0.19.0", + "@siteimprove/alfa-trilean": "workspace:^0.19.0" }, "devDependencies": { - "@siteimprove/alfa-test": "workspace:^0.20.0" + "@siteimprove/alfa-test": "workspace:^0.19.0" }, "publishConfig": { "access": "public", diff --git a/packages/alfa-act/src/question.ts b/packages/alfa-act/src/question.ts index 38373dadaa..1217936121 100644 --- a/packages/alfa-act/src/question.ts +++ b/packages/alfa-act/src/question.ts @@ -1,4 +1,3 @@ -import { Applicative } from "@siteimprove/alfa-applicative"; import { Functor } from "@siteimprove/alfa-functor"; import { Serializable } from "@siteimprove/alfa-json"; import { Mapper } from "@siteimprove/alfa-mapper"; @@ -10,12 +9,7 @@ import * as json from "@siteimprove/alfa-json"; * @public */ export class Question - implements - Functor, - Applicative, - Monad, - Serializable> -{ + implements Functor, Monad, Serializable> { public static of( uri: string, type: Q, @@ -71,12 +65,6 @@ export class Question ); } - public apply( - mapper: Question> - ): Question { - return mapper.flatMap((mapper) => this.map(mapper)); - } - public flatMap( mapper: Mapper> ): Question { @@ -89,12 +77,6 @@ export class Question ); } - public flatten( - this: Question> - ): Question { - return this.flatMap((question) => question); - } - public answer(answer: A): T { return this._quester(answer); } diff --git a/packages/alfa-act/tsconfig.json b/packages/alfa-act/tsconfig.json index e9b526c534..52a0d64481 100644 --- a/packages/alfa-act/tsconfig.json +++ b/packages/alfa-act/tsconfig.json @@ -15,9 +15,6 @@ "src/tag.ts" ], "references": [ - { - "path": "../alfa-applicative" - }, { "path": "../alfa-earl" }, diff --git a/packages/alfa-affine/package.json b/packages/alfa-affine/package.json index 6343880d71..05cd460ed6 100644 --- a/packages/alfa-affine/package.json +++ b/packages/alfa-affine/package.json @@ -2,7 +2,7 @@ "$schema": "http://json.schemastore.org/package", "name": "@siteimprove/alfa-affine", "homepage": "https://alfa.siteimprove.com", - "version": "0.20.0", + "version": "0.19.0", "license": "MIT", "description": "Functionality for working with affine transformations", "repository": { @@ -18,13 +18,13 @@ "src/**/*.d.ts" ], "dependencies": { - "@siteimprove/alfa-equatable": "workspace:^0.20.0", - "@siteimprove/alfa-json": "workspace:^0.20.0", - "@siteimprove/alfa-math": "workspace:^0.20.0", - "@siteimprove/alfa-option": "workspace:^0.20.0" + "@siteimprove/alfa-equatable": "workspace:^0.19.0", + "@siteimprove/alfa-json": "workspace:^0.19.0", + "@siteimprove/alfa-math": "workspace:^0.19.0", + "@siteimprove/alfa-option": "workspace:^0.19.0" }, "devDependencies": { - "@siteimprove/alfa-test": "workspace:^0.20.0" + "@siteimprove/alfa-test": "workspace:^0.19.0" }, "publishConfig": { "access": "public", diff --git a/packages/alfa-angular/package.json b/packages/alfa-angular/package.json index e2e962bf1e..b35cbb1e38 100644 --- a/packages/alfa-angular/package.json +++ b/packages/alfa-angular/package.json @@ -2,7 +2,7 @@ "$schema": "http://json.schemastore.org/package", "name": "@siteimprove/alfa-angular", "homepage": "https://alfa.siteimprove.com", - "version": "0.20.0", + "version": "0.19.0", "license": "MIT", "description": "Integrations and utilities for the Angular application framework", "repository": { @@ -19,16 +19,16 @@ ], "dependencies": { "@angular/core": "^11.0.0", - "@siteimprove/alfa-device": "workspace:^0.20.0", - "@siteimprove/alfa-dom": "workspace:^0.20.0", - "@siteimprove/alfa-http": "workspace:^0.20.0", - "@siteimprove/alfa-option": "workspace:^0.20.0", - "@siteimprove/alfa-web": "workspace:^0.20.0", + "@siteimprove/alfa-device": "workspace:^0.19.0", + "@siteimprove/alfa-dom": "workspace:^0.19.0", + "@siteimprove/alfa-http": "workspace:^0.19.0", + "@siteimprove/alfa-option": "workspace:^0.19.0", + "@siteimprove/alfa-web": "workspace:^0.19.0", "rxjs": "^7.1.0", "zone.js": "^0.11.4" }, "devDependencies": { - "@siteimprove/alfa-test": "workspace:^0.20.0" + "@siteimprove/alfa-test": "workspace:^0.19.0" }, "publishConfig": { "access": "public", diff --git a/packages/alfa-applicative/package.json b/packages/alfa-applicative/package.json index dec7745c17..d487a3fb10 100644 --- a/packages/alfa-applicative/package.json +++ b/packages/alfa-applicative/package.json @@ -2,7 +2,7 @@ "$schema": "http://json.schemastore.org/package", "name": "@siteimprove/alfa-applicative", "homepage": "https://alfa.siteimprove.com", - "version": "0.20.0", + "version": "0.19.0", "license": "MIT", "description": "Types for modelling applicative functors", "repository": { @@ -18,11 +18,10 @@ "src/**/*.d.ts" ], "dependencies": { - "@siteimprove/alfa-functor": "workspace:^0.20.0", - "@siteimprove/alfa-mapper": "workspace:^0.20.0" + "@siteimprove/alfa-mapper": "workspace:^0.19.0" }, "devDependencies": { - "@siteimprove/alfa-test": "workspace:^0.20.0" + "@siteimprove/alfa-test": "workspace:^0.19.0" }, "publishConfig": { "access": "public", diff --git a/packages/alfa-applicative/src/applicative.ts b/packages/alfa-applicative/src/applicative.ts index 46be90f618..88c1bb7d98 100644 --- a/packages/alfa-applicative/src/applicative.ts +++ b/packages/alfa-applicative/src/applicative.ts @@ -1,10 +1,8 @@ -import { Functor } from "@siteimprove/alfa-functor"; import { Mapper } from "@siteimprove/alfa-mapper"; /** * @public */ -export interface Applicative extends Functor { - map(mapper: Mapper): Applicative; +export interface Applicative { apply(mapper: Applicative>): Applicative; } diff --git a/packages/alfa-applicative/tsconfig.json b/packages/alfa-applicative/tsconfig.json index ba326f5d13..1e33dfa325 100644 --- a/packages/alfa-applicative/tsconfig.json +++ b/packages/alfa-applicative/tsconfig.json @@ -3,9 +3,6 @@ "extends": "../tsconfig.json", "files": ["src/applicative.ts", "src/index.ts"], "references": [ - { - "path": "../alfa-functor" - }, { "path": "../alfa-mapper" }, diff --git a/packages/alfa-aria/package.json b/packages/alfa-aria/package.json index 94e573a707..0337a3a402 100644 --- a/packages/alfa-aria/package.json +++ b/packages/alfa-aria/package.json @@ -2,7 +2,7 @@ "$schema": "http://json.schemastore.org/package", "name": "@siteimprove/alfa-aria", "homepage": "https://alfa.siteimprove.com", - "version": "0.20.0", + "version": "0.19.0", "license": "MIT", "description": "Functionality for working with ARIA and the accessibility tree", "repository": { @@ -21,31 +21,31 @@ "generate": "node scripts/attributes.js && node scripts/roles.js" }, "dependencies": { - "@siteimprove/alfa-array": "workspace:^0.20.0", - "@siteimprove/alfa-branched": "workspace:^0.20.0", - "@siteimprove/alfa-cache": "workspace:^0.20.0", - "@siteimprove/alfa-compatibility": "workspace:^0.20.0", - "@siteimprove/alfa-device": "workspace:^0.20.0", - "@siteimprove/alfa-dom": "workspace:^0.20.0", - "@siteimprove/alfa-equatable": "workspace:^0.20.0", - "@siteimprove/alfa-graph": "workspace:^0.20.0", - "@siteimprove/alfa-hash": "workspace:^0.20.0", - "@siteimprove/alfa-iterable": "workspace:^0.20.0", - "@siteimprove/alfa-json": "workspace:^0.20.0", - "@siteimprove/alfa-lazy": "workspace:^0.20.0", - "@siteimprove/alfa-map": "workspace:^0.20.0", - "@siteimprove/alfa-mapper": "workspace:^0.20.0", - "@siteimprove/alfa-option": "workspace:^0.20.0", - "@siteimprove/alfa-predicate": "workspace:^0.20.0", - "@siteimprove/alfa-refinement": "workspace:^0.20.0", - "@siteimprove/alfa-sequence": "workspace:^0.20.0", - "@siteimprove/alfa-set": "workspace:^0.20.0", - "@siteimprove/alfa-style": "workspace:^0.20.0", - "@siteimprove/alfa-table": "workspace:^0.20.0", - "@siteimprove/alfa-thunk": "workspace:^0.20.0" + "@siteimprove/alfa-array": "workspace:^0.19.0", + "@siteimprove/alfa-branched": "workspace:^0.19.0", + "@siteimprove/alfa-cache": "workspace:^0.19.0", + "@siteimprove/alfa-compatibility": "workspace:^0.19.0", + "@siteimprove/alfa-device": "workspace:^0.19.0", + "@siteimprove/alfa-dom": "workspace:^0.19.0", + "@siteimprove/alfa-equatable": "workspace:^0.19.0", + "@siteimprove/alfa-graph": "workspace:^0.19.0", + "@siteimprove/alfa-hash": "workspace:^0.19.0", + "@siteimprove/alfa-iterable": "workspace:^0.19.0", + "@siteimprove/alfa-json": "workspace:^0.19.0", + "@siteimprove/alfa-lazy": "workspace:^0.19.0", + "@siteimprove/alfa-map": "workspace:^0.19.0", + "@siteimprove/alfa-mapper": "workspace:^0.19.0", + "@siteimprove/alfa-option": "workspace:^0.19.0", + "@siteimprove/alfa-predicate": "workspace:^0.19.0", + "@siteimprove/alfa-refinement": "workspace:^0.19.0", + "@siteimprove/alfa-sequence": "workspace:^0.19.0", + "@siteimprove/alfa-set": "workspace:^0.19.0", + "@siteimprove/alfa-style": "workspace:^0.19.0", + "@siteimprove/alfa-table": "workspace:^0.19.0", + "@siteimprove/alfa-thunk": "workspace:^0.19.0" }, "devDependencies": { - "@siteimprove/alfa-test": "workspace:^0.20.0" + "@siteimprove/alfa-test": "workspace:^0.19.0" }, "publishConfig": { "access": "public", diff --git a/packages/alfa-aria/src/feature.ts b/packages/alfa-aria/src/feature.ts index 5405bfb7fe..bd8596bd68 100644 --- a/packages/alfa-aria/src/feature.ts +++ b/packages/alfa-aria/src/feature.ts @@ -124,18 +124,19 @@ const nameFromAttribute = (element: Element, ...attributes: Array) => { return None; }; -const nameFromChild = - (predicate: Predicate) => - (element: Element, device: Device, state: Name.State) => - element - .children() - .filter(isElement) - .find(predicate) - .flatMap((child) => - Name.fromDescendants(child, device, state.visit(child)).map((name) => - Name.of(name.value, [Name.Source.descendant(element, name)]) - ) - ); +const nameFromChild = (predicate: Predicate) => ( + element: Element, + device: Device, + state: Name.State +) => { + for (const child of element.children().filter(isElement).find(predicate)) { + return Name.fromDescendants(child, device, state.visit(child)).map((name) => + Name.of(name.value, [Name.Source.descendant(element, name)]) + ); + } + + return None; +}; const ids = Cache.empty>(); @@ -146,8 +147,8 @@ const nameFromLabel = (element: Element, device: Device, state: Name.State) => { const elements = root.inclusiveDescendants().filter(isElement); - const isFirstReference = element.id.some((id) => - ids + for (const id of element.id) { + const target = ids .get(root, () => Map.from( elements @@ -157,19 +158,21 @@ const nameFromLabel = (element: Element, device: Device, state: Name.State) => { .reverse() ) ) - .get(id) - .includes(element) - ); + .get(id); + + if (target.includes(element)) { + continue; + } else { + return None; + } + } const references = labels .get(root, () => elements.filter(hasName("label"))) .filter( or( + (label) => label.descendants().includes(element), (label) => - label.attribute("for").isNone() && - label.descendants().includes(element), - (label) => - isFirstReference && label .attribute("for") .some((attribute) => element.id.includes(attribute.value)) @@ -180,7 +183,7 @@ const nameFromLabel = (element: Element, device: Device, state: Name.State) => { Name.fromNode( element, device, - state.reference(Option.of(element)).recurse(true).descend(false) + state.reference(None).recurse(true).descend(false) ).map((name) => [name, element] as const) ); diff --git a/packages/alfa-aria/src/name.ts b/packages/alfa-aria/src/name.ts index d85932a0ae..6ce110a9f8 100644 --- a/packages/alfa-aria/src/name.ts +++ b/packages/alfa-aria/src/name.ts @@ -142,8 +142,7 @@ export namespace Name { } export class Descendant - implements Equatable, Serializable - { + implements Equatable, Serializable { public static of(element: Element, name: Name): Descendant { return new Descendant(element, name); } @@ -693,7 +692,7 @@ export namespace Name { // step produces an empty name. if ( !state.isReferencing && - !role.some((role) => role.isNamedBy("contents")) + !role.every((role) => role.isNamedBy("contents")) ) { return None; } diff --git a/packages/alfa-aria/test/name.spec.tsx b/packages/alfa-aria/test/name.spec.tsx index 6d16ae4be6..222df4766e 100644 --- a/packages/alfa-aria/test/name.spec.tsx +++ b/packages/alfa-aria/test/name.spec.tsx @@ -1599,146 +1599,3 @@ test(`.from() behaves correctly when encountering a descendant that doesn't }, }); }); - -test(`.from() does not use implicit

- - ; - - t.deepEqual(Name.from(input, device).toJSON(), { - type: "none", - }); -}); - -test(`.from() correctly assigns names to elements with implicit