core/css/css.c reads the stylesheets once into typed values and cascades them as CSS does: !important, then specificity, then source order. It takes var(), color-mix(in srgb, ...), em and rem, calc() over pixels, the @media features Reaktor answers, @import at the top of a sheet, :not(), :enabled, attribute selectors read as classes, descendant and child combinators, and escapes. Rules are bucketed by the last compound of their selector, so a query checks only the rules that could match. cssflat.c, LCUI's libcss and yutil, and the lcui submodule go. Screenshots of every showcase tab, notepad and simple, light and dark, with normal and more contrast, are byte-identical to the libcss build, with Water.css and with Simple.css; --a11y-dump differs only in the a11y struct's size. Three values change to what CSS says: an unset background is transparent black, an unset border color is the text's, and Simple.css's :enabled:hover no longer reaches a disabled button. Against libcss, loading the sheets takes 0.35 ms instead of 1.24 and a first query 0.32 us instead of 4.4. csstest covers the cascade, values, @media and hostile sheets: import loops and fan-out, var() that grows or expands too often, deep calc(), a sheet left open, a huge file. 200,000 mutated sheets ran clean under AddressSanitizer. Simplifications: dead state (redraw_always, sw_noaa, the hover-gap pin, a muted note, an overwritten slider range, the font-baking blocks of the SDL renderer, the a11y change index); REAKTOR_LAY_FILL for FILL_X | FILL_Y; one helper each for flag parsing, capture runs, timings, paths from the working directory, array growth, focus moves, tooltips, button presses, a11y slot probes, UIA fragments and test strings; launchtest's notef() and last_node(); the output folder set once in CMake and a write-if-changed function; one test list, tools/ci/tests.txt, for every workflow, so basetest and imagetest run. The showcase drops its relaunch button, an ask() button is as wide as its label, and build.sh takes a bare target. The docs follow, and PERFORMANCE.md and the chart carry a new pass of all seven benchmark arms on one machine. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
53 lines
2.2 KiB
PowerShell
53 lines
2.2 KiB
PowerShell
param([switch]$Serve)
|
|
|
|
$extra = @($args)
|
|
$ErrorActionPreference = "Stop"
|
|
$root = $PSScriptRoot
|
|
$outDir = Join-Path $root "build-wasm"
|
|
|
|
$emsdk = if ($env:EMSDK) { $env:EMSDK } else { "$env:USERPROFILE\emsdk" }
|
|
$toolchain = Join-Path $emsdk "upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake"
|
|
if (-not (Test-Path $toolchain)) {
|
|
throw "emsdk not found at $emsdk - clone https://github.com/emscripten-core/emsdk, run 'emsdk install latest' then 'emsdk activate latest', or set EMSDK"
|
|
}
|
|
|
|
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
|
if (-not (Test-Path $vswhere)) { throw "vswhere.exe not found - install Visual Studio Build Tools" }
|
|
$vsPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.CMake.Project -property installationPath
|
|
if (-not $vsPath) { throw "no Visual Studio with the C++ CMake tools - add them in the Visual Studio Installer" }
|
|
$cmake = Join-Path $vsPath "Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"
|
|
$ninja = Join-Path $vsPath "Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe"
|
|
foreach ($t in @($cmake, $ninja)) {
|
|
if (-not (Test-Path $t)) { throw "missing build tool: $t" }
|
|
}
|
|
|
|
if (-not (Test-Path (Join-Path $root "external\SDL\CMakeLists.txt"))) {
|
|
throw "submodules missing - run: git submodule update --init --recursive"
|
|
}
|
|
|
|
$prev = $ErrorActionPreference
|
|
$ErrorActionPreference = 'Continue'
|
|
|
|
& $cmake -S $root -B $outDir -G Ninja `
|
|
"-DCMAKE_MAKE_PROGRAM=$ninja" `
|
|
"-DCMAKE_TOOLCHAIN_FILE=$toolchain" `
|
|
"-DCMAKE_BUILD_TYPE=Release" @extra 2>&1 | ForEach-Object { "$_" }
|
|
$rc = $LASTEXITCODE
|
|
if ($rc -eq 0) {
|
|
& $cmake --build $outDir --parallel 2>&1 | ForEach-Object { "$_" }
|
|
$rc = $LASTEXITCODE
|
|
}
|
|
$ErrorActionPreference = $prev
|
|
if ($rc -ne 0) { throw "wasm build failed ($rc)" }
|
|
|
|
Write-Host ""
|
|
Write-Host "built: $outDir\showcase.html (plus simple.html and notepad.html)"
|
|
Write-Host "a file:// page cannot fetch the .wasm, so serve it:"
|
|
Write-Host " python -m http.server -d build-wasm 8000"
|
|
|
|
if ($Serve) {
|
|
$python = Get-ChildItem (Join-Path $emsdk "python") -Filter python.exe -Recurse -Depth 1 |
|
|
Sort-Object FullName | Select-Object -Last 1
|
|
& $python.FullName -m http.server -d $outDir 8000
|
|
}
|