Skip to content

Commit

Permalink
Refactor alfa-selector (#1508)
Browse files Browse the repository at this point in the history
* Break down (a bit) huge selector file

* Clean up types

* Imprvoe documentation

* Refactor selector type

* Start breaking simple.ts

* Improve inheritance

* Extract some simple selectors

* Extract more simple selectors

* Extract pseudo-class and -element

* Rework exports from alfa-selector

* Simplify parsing in tests

* Split test file

* Improve typing

* Start breaking down pseudo-class.ts

* Break down pseudo-class

* Move stuff around

* Move stuff around

* Move stuff around

* Allow thunks in Function.parse

* Refactor parsers

* Improve parsers

* Fix version numbers

* Improve parsers

* Finish refactoring pseudo-classes

* Break down pseudo-element

* Improve parsers

* Improve parsers

* Improve parsers

* Update documentation

* Clean up

* Clean up

* Clean up

* Extract API

* Typo

Co-authored-by: Rolf Christian Jørgensen <[email protected]>

* Break down double file/directory naming

* Mark unused exports as public

* Improve parser

* Rework List

* Clean up

* Rework Compound selectors

* Extract API

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Rolf Christian Jørgensen <[email protected]>
  • Loading branch information
3 people authored Nov 23, 2023
1 parent 28f88a8 commit 321a7eb
Show file tree
Hide file tree
Showing 83 changed files with 5,319 additions and 4,742 deletions.
7 changes: 7 additions & 0 deletions .changeset/lemon-rabbits-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@siteimprove/alfa-selector": minor
---

**Breaking:** The type guards on selectors are now under the namespace of the same name.

That is, use `Compound.isCompound` instead of `Selector.isCompound`, …
7 changes: 7 additions & 0 deletions .changeset/metal-pandas-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@siteimprove/alfa-selector": minor
---

**Breaking:** `Compound` selectors are now built on top of Iterable, rather than re-inventing chained lists.

That is, `Compound#left` and `Compound#right` are no more available, but `Compound.selectors` replaces them.
7 changes: 7 additions & 0 deletions .changeset/moody-kings-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@siteimprove/alfa-selector": minor
---

**Breaking:** The various kinds of selectors are now directly exported from the package, out of the `Selector` namespace.

That is, use `Id` instead of `Selector.Id`, … (or `import * as Selector` and keep using `Selector.Id`).
7 changes: 7 additions & 0 deletions .changeset/tidy-cars-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@siteimprove/alfa-css": minor
---

**Added:** `Function.parse` now also accepts a `Thunk` as body parser.

This notably allows to build recursive parsers by wrapping them in continuation.
7 changes: 7 additions & 0 deletions .changeset/twenty-seahorses-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@siteimprove/alfa-selector": minor
---

**Breaking:** `List` selectors are now built on top of Iterable, rather than re-inventing chained lists.

That is, `List#left` and `List#right` are no more available, but `List.selectors` replaces them.
3 changes: 2 additions & 1 deletion docs/review/api/alfa-css.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Record as Record_2 } from '@siteimprove/alfa-record';
import { Result } from '@siteimprove/alfa-result';
import { Serializable } from '@siteimprove/alfa-json';
import { Slice } from '@siteimprove/alfa-slice';
import { Thunk } from '@siteimprove/alfa-thunk';

// @public (undocumented)
export type Angle<U extends Unit.Angle = Unit.Angle> = Angle.Calculated | Angle.Fixed<U>;
Expand Down Expand Up @@ -539,7 +540,7 @@ namespace Function_2 {
const // (undocumented)
consume: Parser<Function_2>;
const // (undocumented)
parse: <T>(query?: string | Predicate<Token.Function>, body?: Parser<T> | undefined) => Parser_2<Slice<Token>, readonly [Function_2, T], string, []>;
parse: <T>(query?: string | Predicate<Token.Function>, body?: Parser<T> | Thunk<Parser<T>> | undefined) => Parser_2<Slice<Token>, readonly [Function_2, T], string, []>;
}
export { Function_2 as Function }

Expand Down
Loading

0 comments on commit 321a7eb

Please sign in to comment.