Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"fallout.cli": {
"version": "11.0.18",
"commands": [
"fallout"
]
}
}
}
16 changes: 11 additions & 5 deletions .nuke/build.schema.json → .fallout/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"enum": [
"Clean",
"Compile",
"CopyFiles",
"CreatePackage",
"Default",
"Package",
Expand All @@ -49,7 +48,7 @@
"Quiet"
]
},
"NukeBuild": {
"FalloutBuild": {
"properties": {
"Continue": {
"type": "boolean",
Expand Down Expand Up @@ -103,6 +102,13 @@
"Verbosity": {
"description": "Logging verbosity during build execution. Default is 'Normal'",
"$ref": "#/definitions/Verbosity"
},
"BuildProjectFile": {
"type": [
"null",
"string"
],
"description": "Path to the build project (.csproj) relative to the repository root. Defaults to 'build/_build.csproj' when unset. Read by the Fallout global tool's in-tool runner."
}
}
}
Expand All @@ -116,11 +122,11 @@
},
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"Release"
]
],
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)"
},
"ReleaseNotesFilePath": {
"type": "string",
Expand All @@ -133,7 +139,7 @@
}
},
{
"$ref": "#/definitions/NukeBuild"
"$ref": "#/definitions/FalloutBuild"
}
]
}
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# These are supported funding model platforms

github: FlorianRappl
custom: https://salt.bountysource.com/teams/anglesharp
custom: ['https://www.paypal.me/FlorianRappl', 'https://buymeacoffee.com/florianrappl']
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ local.properties
[Dd]ebug/
[Rr]elease/
[Bb]in/
[Bb]uild/
build/bin/
build/obj/
[Oo]bj/

# Visual Studio 2015 cache/options directory
Expand Down Expand Up @@ -171,7 +172,8 @@ Desktop.ini
*.egg
*.egg-info
dist
build
build/bin
build/obj
eggs
parts
var
Expand All @@ -195,5 +197,5 @@ pip-log.txt
# Mac crap
.DS_Store

# Nuke build tool
.nuke/temp
# Fallout build tool
.fallout/temp
154 changes: 154 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# AGENTS.md

This guide helps coding agents become productive quickly in the AngleSharp.Css repository.

## 1) What this repository is

- AngleSharp.Css is the CSS extension package for AngleSharp.
- It provides CSS parsing, CSSOM objects, declaration/value conversion, stylesheet integration, and render tree support.
- Main code lives in `src/AngleSharp.Css`.
- Tests live in `src/AngleSharp.Css.Tests`.

## 2) Fast start commands

From repository root:

```bash
# Full build + unit tests through Fallout (Linux/macOS)
./build.sh

# Full build + unit tests through Fallout (Windows PowerShell)
./build.ps1

# Run tests directly
dotnet test src/AngleSharp.Css.Tests/AngleSharp.Css.Tests.csproj

# Build solution directly
dotnet build src/AngleSharp.Css.sln

# Run CSS performance benchmark (Release)
dotnet run --project src/AngleSharp.Performance.Css/AngleSharp.Performance.Css.csproj -c Release --framework net10.0

# Short benchmark smoke run
dotnet run --project src/AngleSharp.Performance.Css/AngleSharp.Performance.Css.csproj -c Release --framework net10.0 -- --job short
```

Notes:

- CI invokes `./build.sh -AngleSharpVersion 1.5.0` on Linux and `./build.ps1` on Windows.
- Treat warnings as errors is enabled in `src/Directory.Build.props`.

## 3) Build and target framework facts

- Library project: `src/AngleSharp.Css/AngleSharp.Css.csproj`
- Targets: `netstandard2.0;net8.0;net10.0`
- Additional Windows-only targets: `net462;net472`
- Test project: `src/AngleSharp.Css.Tests/AngleSharp.Css.Tests.csproj`
- Targets: `net8.0`
- Fallout entrypoint: `build/Build.cs`
- Default target chain runs unit tests.

## 4) Repository map (where to change what)

- `src/AngleSharp.Css/Parser`
- Front-end parser (`CssParser`), tokenizer, builder, and micro parsers.
- If parsing/tokenization behavior changes, start here.

- `src/AngleSharp.Css/Declarations`
- One static class per declaration (name, converter, initial value, flags).
- Example pattern: `DisplayDeclaration.cs`.

- `src/AngleSharp.Css/Factories/DefaultDeclarationFactory.cs`
- Central registration table that wires declaration metadata.
- New declaration support usually needs an entry here.

- `src/AngleSharp.Css/ValueConverters.cs` and `src/AngleSharp.Css/Converters`
- Converter composition and reusable converter building blocks.
- New value grammar often starts with a converter addition or composition.

- `src/AngleSharp.Css/Values`
- CSS value object model (primitives, composites, function values, tuples/lists).

- `src/AngleSharp.Css/Dom` and `src/AngleSharp.Css/Dom/Internal`
- Public CSSOM interfaces/enums and internal implementations of rules, declarations, and sheets.

- `src/AngleSharp.Css/Constants`
- Canonical names and keyword constants (`PropertyNames`, `RuleNames`, `CssKeywords`, etc.).

- `src/AngleSharp.Css/RenderTree`
- Render tree construction and render node/value computation.

- `src/AngleSharp.Css/FeatureValidators`
- Validators used for media feature / supports-style checks.

- `src/AngleSharp.Css.Tests`
- Test suites grouped by concern: declarations, rules, parsing, values, styling, extensions.

## 5) Common change playbooks

### Add or adjust a CSS declaration/property

1. Add or update declaration metadata class in `src/AngleSharp.Css/Declarations`.
2. Ensure canonical property name exists in `src/AngleSharp.Css/Constants/PropertyNames.cs`.
3. Wire declaration in `src/AngleSharp.Css/Factories/DefaultDeclarationFactory.cs`.
4. Add tests in `src/AngleSharp.Css.Tests/Declarations` and/or related top-level declaration test files.
5. Validate computed/style integration with tests in `src/AngleSharp.Css.Tests/Styling` when behavior impacts cascade/computation.

### Add or adjust value grammar

1. Extend converter composition in `src/AngleSharp.Css/ValueConverters.cs` and/or converter implementations in `src/AngleSharp.Css/Converters`.
2. Add/update specific value objects in `src/AngleSharp.Css/Values` if needed.
3. If grammar requires function or token-level parser support, update `src/AngleSharp.Css/Parser/Micro`.
4. Add tests under `src/AngleSharp.Css.Tests/Values` and declaration tests that consume the grammar.

### Add or adjust at-rules / CSSOM rule behavior

1. Public contract changes in `src/AngleSharp.Css/Dom` interfaces.
2. Implementation changes in `src/AngleSharp.Css/Dom/Internal/Rules`.
3. Parser/builder adjustments in `src/AngleSharp.Css/Parser`.
4. Rule-focused tests in `src/AngleSharp.Css.Tests/Rules`.

### Render-tree-related changes

1. Update computation/building in `src/AngleSharp.Css/RenderTree`.
2. Confirm integration in `src/AngleSharp.Css/Extensions/WindowExtensions.cs` and styling flows.
3. Add or update tests in `src/AngleSharp.Css.Tests/Styling`.

## 6) Test strategy for agents

- Prefer targeted test runs while iterating:

```bash
dotnet test src/AngleSharp.Css.Tests/AngleSharp.Css.Tests.csproj --filter FullyQualifiedName~CssProperty
```

- Before finishing, run full tests for confidence:

```bash
dotnet test src/AngleSharp.Css.Tests/AngleSharp.Css.Tests.csproj
```

- If changing multi-target-sensitive code (conditional behavior, APIs), also run full build via Fallout script to mimic CI flow.

## 7) Style and safety expectations

- Follow `.editorconfig` (spaces, indent size 4 for `.cs`, LF endings).
- Preserve existing namespace/file organization; this repo is convention-heavy.
- Avoid broad refactors when making focused feature fixes.
- Keep public API changes intentional; many files under `Dom` are effectively surface area.
- Existing code mixes nullable contexts (`#nullable enable` and `#nullable disable`); do not normalize unrelated files.
- In `src/AngleSharp.Css/ValueConverters.cs`, avoid static field initializers that reference converters declared later in the same file. Forward references can capture `null` during type initialization and only fail at runtime.

## 8) Documentation and onboarding references

- Root overview: `README.md`
- Extended docs index: `docs/README.md`
- Suggested docs learning order is documented in `docs/README.md`.

## 9) Quick pre-PR checklist for agents

1. Did I update all required wiring points (constants, declaration metadata, factory registration, parser/converter where needed)?
2. Did I add focused tests in the closest matching test area?
3. Does `dotnet test src/AngleSharp.Css.Tests/AngleSharp.Css.Tests.csproj` pass?
4. If CI-relevant build behavior changed, did I run `./build.sh` (or `./build.ps1` on Windows)?
5. Did I avoid unrelated formatting churn and preserve established structure?
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 1.0.1

Released on Friday, July 31 2026.

- Fixed NRE in `mask-image` with gradients (#218)
- Improved cascade resolution performance (#220) @lahma

# 1.0.0

Released on Sunday, July 26 2026.
Expand Down
8 changes: 8 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

The guidance is shared with every AI agent working here, so it lives in AGENTS.md and is
imported below. Record new guidance there rather than in this file.

@AGENTS.md
16 changes: 5 additions & 11 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
# CONFIGURATION
###########################################################################

$BuildProjectFile = "$PSScriptRoot\nuke\_build.csproj"
$TempDirectory = "$PSScriptRoot\\.nuke\temp"
$TempDirectory = "$PSScriptRoot\.fallout\temp"

$DotNetGlobalFile = "$PSScriptRoot\\global.json"
$DotNetGlobalFile = "$PSScriptRoot\global.json"
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
$DotNetChannel = "STS"

Expand All @@ -32,7 +31,7 @@ function ExecSafe([scriptblock] $cmd) {
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}

# If dotnet CLI is installed globally and it matches requested version, use for execution
# If dotnet CLI is installed globally, use it; otherwise provision a local copy under .fallout\temp.
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
$env:DOTNET_EXE = (Get-Command "dotnet").Path
Expand Down Expand Up @@ -65,10 +64,5 @@ else {

Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"

if (Test-Path env:NUKE_ENTERPRISE_TOKEN) {
& $env:DOTNET_EXE nuget remove source "nuke-enterprise" > $null
& $env:DOTNET_EXE nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password $env:NUKE_ENTERPRISE_TOKEN > $null
}

ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
ExecSafe { & $env:DOTNET_EXE tool restore }
ExecSafe { & $env:DOTNET_EXE fallout $BuildArguments }
16 changes: 5 additions & 11 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
# CONFIGURATION
###########################################################################

BUILD_PROJECT_FILE="$SCRIPT_DIR/nuke/_build.csproj"
TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"
TEMP_DIRECTORY="$SCRIPT_DIR/.fallout/temp"

DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
DOTNET_GLOBAL_FILE="$SCRIPT_DIR/global.json"
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
DOTNET_CHANNEL="STS"

Expand All @@ -27,7 +26,7 @@ function FirstJsonValue {
perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}"
}

# If dotnet CLI is installed globally and it matches requested version, use for execution
# If dotnet CLI is installed globally, use it; otherwise provision a local copy under .fallout/temp.
if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then
export DOTNET_EXE="$(command -v dotnet)"
else
Expand Down Expand Up @@ -58,10 +57,5 @@ fi

echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"

if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "$NUKE_ENTERPRISE_TOKEN" != "" ]]; then
"$DOTNET_EXE" nuget remove source "nuke-enterprise" &>/dev/null || true
"$DOTNET_EXE" nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password "$NUKE_ENTERPRISE_TOKEN" --store-password-in-clear-text &>/dev/null || true
fi

"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"
"$DOTNET_EXE" tool restore
exec "$DOTNET_EXE" fallout "$@"
File renamed without changes.
Loading
Loading