From 77a8a850bab275a41402248d08de76d1d382e912 Mon Sep 17 00:00:00 2001 From: Michael Aguiar Date: Fri, 27 Nov 2026 19:53:52 -0700 Subject: [PATCH 1/6] Add the website, published to GitHub Pages, and its design tokens site/ is the landing page for aliasproject.github.io/alias-calc: static HTML and CSS with no build step, the self-hosted JetBrains Mono (OFL) and a small script for the Copy buttons. It presents Alias Calc as a calculator for Linux, quotes only its own benchmark figures (one bench/run table: 3.0 ms, 2.4 MiB, 1 thread, 0.6 wakeups/s) and draws the calculator windows in HTML from the app's layout tokens. .github/workflows/pages.yml publishes site/ when it changes on main. design/tokens.json holds the design values, and design/build (design-gen 2.1.0, copied from the shared generator) writes them to site/tokens.css. 2.1.0 adds a CSS output, "only": "web" and a family's CSS fallback; the other apps' Rust and Swift output is unchanged by it. The app's Rust still holds its values as literals that must match the token file. .github/workflows/design-tokens.yml checks the generated file and every contrast pair. --- .github/workflows/design-tokens.yml | 54 + .github/workflows/pages.yml | 43 + README.md | 8 +- design/Cargo.lock | 7 + design/Cargo.toml | 18 + design/README.md | 85 + design/build | 15 + design/src/main.rs | 5044 +++++++++++++++++++++++ design/tokens.json | 553 +++ site/.nojekyll | 0 site/copy.js | 39 + site/fonts/JetBrainsMono-Light.woff2 | Bin 0 -> 93856 bytes site/fonts/JetBrainsMono-Regular.woff2 | Bin 0 -> 92164 bytes site/fonts/JetBrainsMono-SemiBold.woff2 | Bin 0 -> 94472 bytes site/fonts/OFL.txt | 93 + site/icon.svg | 4 + site/index.html | 198 + site/style.css | 563 +++ site/tokens.css | 182 + 19 files changed, 6905 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/design-tokens.yml create mode 100644 .github/workflows/pages.yml create mode 100644 design/Cargo.lock create mode 100644 design/Cargo.toml create mode 100644 design/README.md create mode 100755 design/build create mode 100644 design/src/main.rs create mode 100644 design/tokens.json create mode 100644 site/.nojekyll create mode 100644 site/copy.js create mode 100644 site/fonts/JetBrainsMono-Light.woff2 create mode 100644 site/fonts/JetBrainsMono-Regular.woff2 create mode 100644 site/fonts/JetBrainsMono-SemiBold.woff2 create mode 100644 site/fonts/OFL.txt create mode 100644 site/icon.svg create mode 100644 site/index.html create mode 100644 site/style.css create mode 100644 site/tokens.css diff --git a/.github/workflows/design-tokens.yml b/.github/workflows/design-tokens.yml new file mode 100644 index 0000000..80c61b7 --- /dev/null +++ b/.github/workflows/design-tokens.yml @@ -0,0 +1,54 @@ +# design/tokens.json is the only source of the website's CSS custom +# properties (design/README.md). A pull request or merge that touches it, +# the generator or the generated file checks that site/tokens.css is current +# and that every contrast pair passes (or is marked pending), and runs the +# generator's own checks. The generator is a small crate with no +# dependencies, so this needs only Rust: no container or apt packages. +name: Design tokens + +on: + push: + branches: [main] + paths: + - design/** + - site/tokens.css + - .github/workflows/design-tokens.yml + pull_request: + paths: + - design/** + - site/tokens.css + - .github/workflows/design-tokens.yml + workflow_dispatch: + +# A PR's runs share a group, so a new push cancels the one it supersedes. +# Each push to main has a group of its own, so every commit gets a result. +concurrency: + group: design-tokens-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +# The job runs pull request code: its token reads only. +permissions: + contents: read + +env: + CARGO_TERM_COLOR: always + +jobs: + check: + name: design tokens + runs-on: ubuntu-24.04 + timeout-minutes: 10 + steps: + # Fork code runs after this, so the token isn't left in git's config. + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + # The generator builds into target/design-build (gitignored), apart + # from the app's builds. + - run: cargo fmt --manifest-path design/Cargo.toml --check + - run: cargo clippy --manifest-path design/Cargo.toml --target-dir target/design-build --all-targets --locked -- -D warnings + - run: cargo test --manifest-path design/Cargo.toml --target-dir target/design-build --locked + - run: design/build --check diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..bc5893f --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,43 @@ +# Publishes site/ to GitHub Pages (aliasproject.github.io/alias-calc) when +# it changes on main. The site is static files with no build step; its +# tokens.css comes from design/build, and the design tokens workflow checks +# that it's up to date. +name: Pages + +on: + push: + branches: [main] + paths: + - "site/**" + - ".github/workflows/pages.yml" + workflow_dispatch: + +# One deployment at a time; a newer push waits rather than cancelling one +# that's halfway out. +concurrency: + group: pages + cancel-in-progress: false + +permissions: + contents: read + +jobs: + deploy: + name: Publish the website + runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + contents: read + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - uses: actions/checkout@v4 + - uses: actions/configure-pages@v6 + - uses: actions/upload-pages-artifact@v5 + with: + path: site + - id: deployment + uses: actions/deploy-pages@v5 diff --git a/README.md b/README.md index 70b5160..17bbcbb 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,12 @@ Hyprland pings every window every 1.5 s to check that it still responds (`xdg_wm [trace] 0.608 ms frame committed (320x480 px) ``` +## Website + +The website, https://aliasproject.github.io/alias-calc/, is the static files in `site/`, with no build step. `.github/workflows/pages.yml` publishes it when `site/` changes on main. To preview it, serve the folder (`python3 -m http.server -d site`) and open http://localhost:8000. + +Its design values come from `site/tokens.css`, which `design/build` generates from `design/tokens.json` (`design/README.md`). Change a value there, never in `style.css`. The benchmark figures on the page come from one `bench/run --bin /usr/bin/alias-calc` table; when they change, replace all of them from a new run. + ## Licence -MIT (`LICENSE`). The JetBrains Mono subsets compiled into the binary are under the SIL Open Font License 1.1 (`fonts/OFL.txt`). +MIT (`LICENSE`). The JetBrains Mono subsets compiled into the binary, and the full fonts the website serves (`site/fonts/`), are under the SIL Open Font License 1.1 (`fonts/OFL.txt`, `site/fonts/OFL.txt`). diff --git a/design/Cargo.lock b/design/Cargo.lock new file mode 100644 index 0000000..affbf4f --- /dev/null +++ b/design/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "design-build" +version = "2.1.0" diff --git a/design/Cargo.toml b/design/Cargo.toml new file mode 100644 index 0000000..888f0e4 --- /dev/null +++ b/design/Cargo.toml @@ -0,0 +1,18 @@ +# design/build: generates the themes from design/tokens.json and checks +# them (design/README.md). Its own workspace, with no dependencies, so the +# design/ folder can be copied unchanged into any app (Nitrate, Alias Notes, +# Daybreak, bosun, Alias Calc): everything app-specific is in tokens.json. +[package] +name = "design-build" +version = "2.1.0" +edition = "2021" +license = "UNLICENSED" +publish = false + +[[bin]] +name = "design-build" +path = "src/main.rs" + +[dependencies] + +[workspace] diff --git a/design/README.md b/design/README.md new file mode 100644 index 0000000..4078423 --- /dev/null +++ b/design/README.md @@ -0,0 +1,85 @@ +# Design tokens + +`tokens.json` is the only place an Alias Calc design value is defined: the colours of its one theme, JetBrains Mono and the type scales (the app's and the website's), and the spacing, radii, fixed sizes, motion and multiples the window and the website use. Each value has a note on where it's used. It uses the Design System artifact format: lists of `{name, value, usage}`, with colours given per theme. + +**One theme.** Alias Calc follows the installed aliasOS theme at run time (`colors.toml`), and derives its key fills and label colours from it (`src/ui.rs`). The colours here are its built-in palette, the aliasOS default (`aliasos`), which the app falls back to (`Palette::default`) and which the website is drawn in. The contrast list checks that palette; an installed theme is made readable where it's drawn, by `readable()` in `src/ui.rs`, since this file can't check a theme it hasn't seen. + +`build` turns it into the website's CSS. The generated file starts with a "Generated from design/tokens.json by design/build (design-gen 2.1.0) — don't edit" header: + +| File | What it is | +|---|---| +| `site/tokens.css` | CSS custom properties on `:root`, one `--` per token: colours (`--background`), `--font-mono`, each type style's `--