Skip to content
Merged
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
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# VisualCI's CI: lint, test (the CLI's crates; app/ with Postgres and RustFS; the Ruby client; the frontend
# VisualCI's CI: lint, test (the CLI's crates; app/ with Postgres and RustFS; the Ruby client; the gallery library; the frontend
# build), then on main build and push the app and renderer images and deploy them by committing their digests to
# talira-ai/infra (k3s/resources/visualci/kustomization.yaml), which ArgoCD applies. That commit is the deploy;
# reverting it is the rollback.
Expand Down Expand Up @@ -227,6 +227,8 @@ jobs:
working-directory: frontend
env:
GITHUB_TOKEN: ${{ github.token }} # the docs' CLI release (scripts/cli-version.mjs)
- run: pnpm install --frozen-lockfile && pnpm build
working-directory: clients/gallery/js
- uses: ./.github/actions/playwright
with:
save: ${{ github.ref == 'refs/heads/main' }}
Expand Down Expand Up @@ -430,6 +432,10 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: "24"
# The gallery library (clients/gallery): its type check, its build (the ES5 file's test reads it) and its tests,
# which check the contract's golden fixtures.
- run: pnpm install --frozen-lockfile && pnpm typecheck && pnpm build && pnpm test
working-directory: clients/gallery/js
# The Compare two PDFs page runs crates/visualci-wasm in the browser (scripts/wasm.mjs builds it).
- run: rustup target add wasm32-unknown-unknown
# Compile cache (kache, as Cargo's rustc wrapper): the R2 bucket every machine shares (KACHE_BUCKET), else the
Expand Down
12 changes: 12 additions & 0 deletions clients/gallery/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Gallery

A screenshots page for any site, from a VisualCI [public gallery](https://visualci.com/docs/gallery/) manifest: tabs
per group, light and dark, desktop and phone, a full-size view, keyboard support, and each site's own look through CSS
variables.

- [`contract/`](contract/SPEC.md): how a manifest becomes a gallery (pairing, defaults, the exact HTML) and the golden
fixtures every renderer's tests check.
- [`js/`](js/README.md): `visualci-gallery`, the browser library and reference renderer.

Coming: the Astro component, the Ruby gem, the Python package and the Rust crate, each emitting the contract's markup
for the JS library to hydrate.
254 changes: 254 additions & 0 deletions clients/gallery/contract/SPEC.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions clients/gallery/contract/errors/empty-groups.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"project": "acme/web", "groups": [{"name": "Web", "items": []}, {"name": "iOS", "title": "iOS", "items": []}]}
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/empty-groups.message
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
the gallery manifest has no screenshots to show
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/fractional-size.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"groups": [{"name": "Web", "items": [{"name": "a-light-1440", "url": "https://app.visualci.com/g/acme/web/a.png", "width": 1440.5, "height": 900}]}]}
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/fractional-size.message
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gallery manifest group Web, item 0 (a-light-1440): its width and height aren't positive integers
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/group-without-items.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"groups": [{"name": "Web"}]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gallery manifest group Web has no items
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/group-without-name.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"groups": [{"items": [{"name": "a-light-1440", "url": "https://app.visualci.com/g/acme/web/a.png", "width": 1440, "height": 900}]}]}
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/group-without-name.message
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gallery manifest group 0 has no name
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/item-without-name.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"groups": [{"name": "Web", "items": [{"url": "https://app.visualci.com/g/acme/web/a.png", "width": 1440, "height": 900}]}]}
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/item-without-name.message
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gallery manifest group Web, item 0 has no name
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/javascript-url.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"groups": [{"name": "Web", "items": [{"name": "a-light-1440", "url": "javascript:alert(1)", "width": 1440, "height": 900}]}]}
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/javascript-url.message
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gallery manifest group Web, item 0 (a-light-1440): its url isn't an http(s) URL
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/no-groups.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"project": "acme/web", "groups": []}
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/no-groups.message
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
the gallery manifest has no screenshots to show
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/no-size.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"groups": [{"name": "Web", "items": [{"name": "a-light-1440", "url": "https://app.visualci.com/g/acme/web/a.png"}]}]}
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/no-size.message
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gallery manifest group Web, item 0 (a-light-1440): its width and height aren't positive integers
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/not-a-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"project": "acme/web"}
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/not-a-manifest.message
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
not a gallery manifest: it has no groups
4 changes: 4 additions & 0 deletions clients/gallery/contract/errors/one-theme-order.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{"groups": [{"name": "Web", "items": [
{"name": "a-dark-390", "url": "https://app.visualci.com/g/acme/web/a-dark-390.png", "width": 390, "height": 844},
{"name": "a-light-1440", "url": "https://app.visualci.com/g/acme/web/a-light-1440.png", "width": 1440, "height": 900}
]}]}
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/one-theme-order.message
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gallery screen a in group Web has a light desktop screenshot but no dark one
5 changes: 5 additions & 0 deletions clients/gallery/contract/errors/one-theme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{"groups": [{"name": "Web", "items": [
{"name": "home-light-1440", "url": "https://app.visualci.com/g/acme/web/home-light-1440.png", "width": 1440, "height": 900},
{"name": "home-dark-1440", "url": "https://app.visualci.com/g/acme/web/home-dark-1440.png", "width": 1440, "height": 900},
{"name": "status-light-1440", "url": "https://app.visualci.com/g/acme/web/status-light-1440.png", "width": 1440, "height": 900}
]}]}
1 change: 1 addition & 0 deletions clients/gallery/contract/errors/one-theme.message
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gallery screen status in group Web has a light desktop screenshot but no dark one
38 changes: 38 additions & 0 deletions clients/gallery/contract/fixtures/duplicates/gallery.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<section class="vg" data-vg data-vg-layout="grid" aria-label="Screenshots" data-vg-size="desktop">
<div class="vg-tabs" role="tablist" aria-label="Screenshots">
<button type="button" role="tab" id="vg-tab-web" aria-controls="vg-panel-web" aria-selected="true" tabindex="0">Web</button>
<button type="button" role="tab" id="vg-tab-ios" aria-controls="vg-panel-ios" aria-selected="false" tabindex="-1">iOS</button>
<button type="button" role="tab" id="vg-tab-web-2" aria-controls="vg-panel-web-2" aria-selected="false" tabindex="-1">Web</button>
<button type="button" role="tab" id="vg-tab-web-2-2" aria-controls="vg-panel-web-2-2" aria-selected="false" tabindex="-1">web-2</button>
</div>
<div class="vg-panel" id="vg-panel-web" data-vg-sizes="desktop" role="tabpanel" aria-labelledby="vg-tab-web">
<div class="vg-bar"><h2 class="vg-group-title">Web</h2><div class="vg-controls"><div class="vg-seg" role="group" aria-label="Theme"><button type="button" data-vg-set-theme="light" aria-pressed="false">Light</button><button type="button" data-vg-set-theme="dark" aria-pressed="false">Dark</button></div></div></div>
<ul class="vg-grid">
<li class="vg-card" data-vg-screen="a/b/home" data-vg-sizes="desktop"><a class="vg-thumb" href="https://app.visualci.com/g/acme/web/a/b/home-light-1440.png" data-vg-open aria-label="Home: view full size"><img class="vg-img" data-vg-size="desktop" data-vg-theme="light" src="https://app.visualci.com/g/acme/web/a/b/home-light-1440.png" width="1440" height="900" alt="Home, desktop, light" loading="lazy" decoding="async"><img class="vg-img" data-vg-size="desktop" data-vg-theme="dark" src="https://app.visualci.com/g/acme/web/a/b/home-dark-1440.png" width="1440" height="900" alt="Home, desktop, dark" loading="lazy" decoding="async"></a><h3 class="vg-card-title">Home</h3></li>
</ul>
</div>
<div class="vg-panel" id="vg-panel-ios" data-vg-sizes="phone" role="tabpanel" aria-labelledby="vg-tab-ios" hidden>
<div class="vg-bar"><h2 class="vg-group-title">iOS</h2><div class="vg-controls"><div class="vg-seg" role="group" aria-label="Theme"><button type="button" data-vg-set-theme="light" aria-pressed="false">Light</button><button type="button" data-vg-set-theme="dark" aria-pressed="false">Dark</button></div></div></div>
<ul class="vg-grid">
<li class="vg-card" data-vg-screen="ios/home" data-vg-sizes="phone"><a class="vg-thumb" href="https://app.visualci.com/g/acme/web/ios/home-light.png" data-vg-open aria-label="Home: view full size"><img class="vg-img" data-vg-size="phone" data-vg-theme="light" src="https://app.visualci.com/g/acme/web/ios/home-light.png" width="1206" height="2622" alt="Home, phone, light" loading="lazy" decoding="async"><img class="vg-img" data-vg-size="phone" data-vg-theme="dark" src="https://app.visualci.com/g/acme/web/ios/home-dark.png" width="1206" height="2622" alt="Home, phone, dark" loading="lazy" decoding="async"></a><h3 class="vg-card-title">Home</h3></li>
</ul>
</div>
<div class="vg-panel" id="vg-panel-web-2" data-vg-sizes="desktop" role="tabpanel" aria-labelledby="vg-tab-web-2" hidden>
<div class="vg-bar"><h2 class="vg-group-title"></h2><div class="vg-controls"><div class="vg-seg" role="group" aria-label="Theme"><button type="button" data-vg-set-theme="light" aria-pressed="false">Light</button><button type="button" data-vg-set-theme="dark" aria-pressed="false">Dark</button></div></div></div>
<ul class="vg-grid">
<li class="vg-card" data-vg-screen="web2/x" data-vg-sizes="desktop"><a class="vg-thumb" href="https://app.visualci.com/g/acme/web/web2/x-light-1440.png" data-vg-open aria-label="X: view full size"><img class="vg-img" data-vg-size="desktop" data-vg-theme="light" src="https://app.visualci.com/g/acme/web/web2/x-light-1440.png" width="1440" height="900" alt="X, desktop, light" loading="lazy" decoding="async"><img class="vg-img" data-vg-size="desktop" data-vg-theme="dark" src="https://app.visualci.com/g/acme/web/web2/x-dark-1440.png" width="1440" height="900" alt="X, desktop, dark" loading="lazy" decoding="async"></a><h3 class="vg-card-title">X</h3></li>
</ul>
</div>
<div class="vg-panel" id="vg-panel-web-2-2" data-vg-sizes="desktop" role="tabpanel" aria-labelledby="vg-tab-web-2-2" hidden>
<div class="vg-bar"><h2 class="vg-group-title">web-2</h2><div class="vg-controls"><div class="vg-seg" role="group" aria-label="Theme"><button type="button" data-vg-set-theme="light" aria-pressed="false">Light</button><button type="button" data-vg-set-theme="dark" aria-pressed="false">Dark</button></div></div></div>
<ul class="vg-grid">
<li class="vg-card" data-vg-screen="x/١٤٤٠" data-vg-sizes="desktop"><a class="vg-thumb" href="https://app.visualci.com/g/acme/web/x/arabic.png" data-vg-open aria-label="X, ١٤٤٠: view full size"><img class="vg-img" data-vg-size="desktop" data-vg-theme="light" src="https://app.visualci.com/g/acme/web/x/arabic.png" width="1440" height="900" alt="X, ١٤٤٠, desktop, light" loading="lazy" decoding="async"><img class="vg-img" data-vg-size="desktop" data-vg-theme="dark" src="https://app.visualci.com/g/acme/web/x/arabic-dark.png" width="1440" height="900" alt="X, ١٤٤٠, desktop, dark" loading="lazy" decoding="async"></a><h3 class="vg-card-title">X, ١٤٤٠</h3></li>
<li class="vg-card" data-vg-screen="y" data-vg-sizes="desktop"><a class="vg-thumb" href="https://app.visualci.com/g/acme/web/y-light-1440.png" data-vg-open aria-label="Y: view full size"><img class="vg-img" data-vg-size="desktop" data-vg-theme="light" src="https://app.visualci.com/g/acme/web/y-light-1440.png" width="1440" height="900" alt="Y, desktop, light" loading="lazy" decoding="async"><img class="vg-img" data-vg-size="desktop" data-vg-theme="dark" src="https://app.visualci.com/g/acme/web/y-dark-1440.png" width="1440" height="900" alt="Y, desktop, dark" loading="lazy" decoding="async"></a><h3 class="vg-card-title">Y</h3><p class="vg-caption"></p></li>
</ul>
</div>
<p class="vg-credit">Screenshot Gallery Powered by <a href="https://visualci.com">VisualCI.com</a></p>
<dialog class="vg-box" aria-labelledby="vg-box-title">
<div class="vg-box-bar"><h2 class="vg-box-title" id="vg-box-title"></h2><div class="vg-controls"><div class="vg-seg" role="group" aria-label="Theme"><button type="button" data-vg-set-theme="light" aria-pressed="false">Light</button><button type="button" data-vg-set-theme="dark" aria-pressed="false">Dark</button></div><div class="vg-seg vg-box-sizes" role="group" aria-label="Screen size"><button type="button" data-vg-set-size="desktop" aria-pressed="false">Desktop</button><button type="button" data-vg-set-size="phone" aria-pressed="false">Phone</button></div><button type="button" class="vg-icon" data-vg-step="-1" aria-label="Previous screen">‹</button><button type="button" class="vg-icon" data-vg-step="1" aria-label="Next screen">›</button><button type="button" class="vg-icon" data-vg-close aria-label="Close">×</button></div></div>
<div class="vg-box-view"></div>
</dialog>
</section>
24 changes: 24 additions & 0 deletions clients/gallery/contract/fixtures/duplicates/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"project": "acme/web",
"groups": [
{"name": "Web", "items": [
{"name": "a/b/home-light-1440", "platform": "", "url": "https://app.visualci.com/g/acme/web/a/b/home-light-1440.png", "width": 1440, "height": 900, "sha256": "k1", "since": "2026-12-01T09:00:00+00:00"},
{"name": "a/b/home-dark-1440", "platform": "", "url": "https://app.visualci.com/g/acme/web/a/b/home-dark-1440.png", "width": 1440, "height": 900, "sha256": "k1d", "since": "2026-12-01T09:00:00+00:00"},
{"name": "c/1440-light-2x", "platform": "", "url": "https://app.visualci.com/g/acme/web/c/1440-light-2x.png", "width": 2880, "height": 1800, "sha256": "k2", "since": "2026-12-01T09:00:00+00:00"}
]},
{"name": "iOS", "title": null, "items": [
{"name": "ios/home-dark", "platform": "", "url": "https://app.visualci.com/g/acme/web/ios/home-dark.png", "width": 1206, "height": 2622, "sha256": "k3", "since": "2026-12-01T09:00:00+00:00"},
{"name": "ios/home-light", "platform": "", "url": "https://app.visualci.com/g/acme/web/ios/home-light.png", "width": 1206, "height": 2622, "sha256": "k3l", "since": "2026-12-01T09:00:00+00:00"}
]},
{"name": "Web", "title": "", "items": [
{"name": "web2/x-light-1440", "platform": "", "url": "https://app.visualci.com/g/acme/web/web2/x-light-1440.png", "width": 1440, "height": 900, "sha256": "k4", "since": "2026-12-01T09:00:00+00:00"},
{"name": "web2/x-dark-1440", "platform": "", "url": "https://app.visualci.com/g/acme/web/web2/x-dark-1440.png", "width": 1440, "height": 900, "sha256": "k4d", "since": "2026-12-01T09:00:00+00:00"}
]},
{"name": "web-2", "items": [
{"name": "y-light-1440", "platform": "", "url": "https://app.visualci.com/g/acme/web/y-light-1440.png", "width": 1440, "height": 900, "sha256": "k5", "since": "2026-12-01T09:00:00+00:00"},
{"name": "y-dark-1440", "platform": "", "url": "https://app.visualci.com/g/acme/web/y-dark-1440.png", "width": 1440, "height": 900, "sha256": "k5d", "since": "2026-12-01T09:00:00+00:00"},
{"name": "x/١٤٤٠-light", "platform": "", "url": "https://app.visualci.com/g/acme/web/x/arabic.png", "width": 1440, "height": 900, "sha256": "k6", "since": "2026-12-01T09:00:00+00:00"},
{"name": "x/١٤٤٠-dark", "platform": "", "url": "https://app.visualci.com/g/acme/web/x/arabic-dark.png", "width": 1440, "height": 900, "sha256": "k6d", "since": "2026-12-01T09:00:00+00:00"}
]}
]
}
171 changes: 171 additions & 0 deletions clients/gallery/contract/fixtures/duplicates/model.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
{
"layout": "grid",
"themeSwitch": true,
"seeAll": null,
"title": null,
"label": "Screenshots",
"headingLevel": 2,
"id": "vg",
"credit": true,
"groups": [
{
"name": "Web",
"title": "Web",
"slug": "web",
"fit": "cover",
"sizes": [
"desktop"
],
"screens": [
{
"key": "a/b/home",
"title": "Home",
"caption": null,
"variants": [
{
"size": "desktop",
"theme": "light",
"url": "https://app.visualci.com/g/acme/web/a/b/home-light-1440.png",
"url2x": null,
"width": 1440,
"height": 900
},
{
"size": "desktop",
"theme": "dark",
"url": "https://app.visualci.com/g/acme/web/a/b/home-dark-1440.png",
"url2x": null,
"width": 1440,
"height": 900
}
]
}
]
},
{
"name": "iOS",
"title": "iOS",
"slug": "ios",
"fit": "cover",
"sizes": [
"phone"
],
"screens": [
{
"key": "ios/home",
"title": "Home",
"caption": null,
"variants": [
{
"size": "phone",
"theme": "light",
"url": "https://app.visualci.com/g/acme/web/ios/home-light.png",
"url2x": null,
"width": 1206,
"height": 2622
},
{
"size": "phone",
"theme": "dark",
"url": "https://app.visualci.com/g/acme/web/ios/home-dark.png",
"url2x": null,
"width": 1206,
"height": 2622
}
]
}
]
},
{
"name": "Web",
"title": "",
"slug": "web-2",
"fit": "cover",
"sizes": [
"desktop"
],
"screens": [
{
"key": "web2/x",
"title": "X",
"caption": null,
"variants": [
{
"size": "desktop",
"theme": "light",
"url": "https://app.visualci.com/g/acme/web/web2/x-light-1440.png",
"url2x": null,
"width": 1440,
"height": 900
},
{
"size": "desktop",
"theme": "dark",
"url": "https://app.visualci.com/g/acme/web/web2/x-dark-1440.png",
"url2x": null,
"width": 1440,
"height": 900
}
]
}
]
},
{
"name": "web-2",
"title": "web-2",
"slug": "web-2-2",
"fit": "cover",
"sizes": [
"desktop"
],
"screens": [
{
"key": "x/١٤٤٠",
"title": "X, ١٤٤٠",
"caption": null,
"variants": [
{
"size": "desktop",
"theme": "light",
"url": "https://app.visualci.com/g/acme/web/x/arabic.png",
"url2x": null,
"width": 1440,
"height": 900
},
{
"size": "desktop",
"theme": "dark",
"url": "https://app.visualci.com/g/acme/web/x/arabic-dark.png",
"url2x": null,
"width": 1440,
"height": 900
}
]
},
{
"key": "y",
"title": "Y",
"caption": "",
"variants": [
{
"size": "desktop",
"theme": "light",
"url": "https://app.visualci.com/g/acme/web/y-light-1440.png",
"url2x": null,
"width": 1440,
"height": 900
},
{
"size": "desktop",
"theme": "dark",
"url": "https://app.visualci.com/g/acme/web/y-dark-1440.png",
"url2x": null,
"width": 1440,
"height": 900
}
]
}
]
}
]
}
1 change: 1 addition & 0 deletions clients/gallery/contract/fixtures/duplicates/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"title": null, "credit": null, "themeSwitch": null, "id": null, "screens": {"y": {"title": null, "caption": ""}}}
Loading
Loading