From 0a76755f4efbeb94273a85364d64230ab7ee87cc Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Fri, 4 Dec 2026 20:25:43 +1300 Subject: [PATCH 1/6] Gallery: the HTML contract (clients/gallery/contract: SPEC.md and golden fixtures) and the browser library @visualci/gallery (sc-9297) How a public gallery manifest becomes a screenshots page, written down so every renderer emits the same markup: names pair into screens as -[-][-2x] or /-[-2x]; under 768 wide (or a portrait image with no width) is a phone; an image wider than its name's width is shown at that width; titles default from the key without the group's shared folders. Golden model.json and gallery.html per fixture, and manifests every renderer must refuse. clients/gallery/js: vanilla TS, no dependencies. mount() fetches and renders into an empty element, hydrate() brings server-rendered markup to life, load() + render() render at build time and throw when the manifest can't be read or shows nothing (no 'updating' fallback: a site's build fails). Grid (tabs per group, theme and size switches) or strip (one row with scroll-snap, for a homepage band) layouts; a native full-size view with previous/next and arrow keys; cards are links to their image, so no-JS and pre- browsers still work; themeSwitch: false follows ; gallery.css styled through --vg-* variables, no :has(); dist/gallery.iife.js is one ES5 file for sites without a bundler. CI's clients job type-checks, builds and tests it; visual-capture screenshots it. --- .github/workflows/ci.yml | 8 +- clients/gallery/README.md | 12 + clients/gallery/contract/SPEC.md | 218 +++ .../gallery/contract/errors/empty-groups.json | 1 + .../gallery/contract/errors/no-groups.json | 1 + .../contract/errors/not-a-manifest.json | 1 + .../contract/fixtures/escaping/gallery.html | 31 + .../contract/fixtures/escaping/manifest.json | 25 + .../contract/fixtures/escaping/model.json | 95 ++ .../contract/fixtures/escaping/options.json | 1 + .../contract/fixtures/fleetlayer/gallery.html | 35 + .../fixtures/fleetlayer/manifest.json | 40 + .../contract/fixtures/fleetlayer/model.json | 235 +++ .../contract/fixtures/fleetlayer/options.json | 10 + .../fixtures/group-order/gallery.html | 31 + .../fixtures/group-order/manifest.json | 14 + .../contract/fixtures/group-order/model.json | 87 + .../fixtures/group-order/options.json | 1 + .../contract/fixtures/page-theme/gallery.html | 27 + .../fixtures/page-theme/manifest.json | 27 + .../contract/fixtures/page-theme/model.json | 119 ++ .../contract/fixtures/page-theme/options.json | 1 + .../fixtures/single-group/gallery.html | 14 + .../fixtures/single-group/manifest.json | 14 + .../contract/fixtures/single-group/model.json | 60 + .../fixtures/single-group/options.json | 1 + .../contract/fixtures/strip/gallery.html | 19 + .../contract/fixtures/strip/manifest.json | 132 ++ .../contract/fixtures/strip/model.json | 196 +++ .../contract/fixtures/strip/options.json | 1 + .../contract/fixtures/visualci/gallery.html | 26 + .../contract/fixtures/visualci/manifest.json | 27 + .../contract/fixtures/visualci/model.json | 116 ++ .../contract/fixtures/visualci/options.json | 1 + clients/gallery/js/.gitignore | 1 + clients/gallery/js/README.md | 54 + clients/gallery/js/package.json | 47 + clients/gallery/js/pnpm-lock.yaml | 1427 +++++++++++++++++ clients/gallery/js/scripts/iife.mjs | 27 + clients/gallery/js/src/gallery.css | 355 ++++ clients/gallery/js/src/hydrate.ts | 281 ++++ clients/gallery/js/src/index.ts | 36 + clients/gallery/js/src/load.ts | 41 + clients/gallery/js/src/model.ts | 265 +++ clients/gallery/js/src/render-entry.ts | 5 + clients/gallery/js/src/render.ts | 165 ++ clients/gallery/js/test/contract.test.ts | 41 + clients/gallery/js/test/hydrate.test.ts | 212 +++ clients/gallery/js/test/iife.test.ts | 24 + clients/gallery/js/test/model.test.ts | 56 + clients/gallery/js/tsconfig.build.json | 4 + clients/gallery/js/tsconfig.json | 16 + clients/gallery/js/vitest.config.ts | 3 + docs/design.md | 6 + scripts/ci/visual.sh | 5 +- scripts/screenshots/gallery.mjs | 119 ++ 56 files changed, 4815 insertions(+), 2 deletions(-) create mode 100644 clients/gallery/README.md create mode 100644 clients/gallery/contract/SPEC.md create mode 100644 clients/gallery/contract/errors/empty-groups.json create mode 100644 clients/gallery/contract/errors/no-groups.json create mode 100644 clients/gallery/contract/errors/not-a-manifest.json create mode 100644 clients/gallery/contract/fixtures/escaping/gallery.html create mode 100644 clients/gallery/contract/fixtures/escaping/manifest.json create mode 100644 clients/gallery/contract/fixtures/escaping/model.json create mode 100644 clients/gallery/contract/fixtures/escaping/options.json create mode 100644 clients/gallery/contract/fixtures/fleetlayer/gallery.html create mode 100644 clients/gallery/contract/fixtures/fleetlayer/manifest.json create mode 100644 clients/gallery/contract/fixtures/fleetlayer/model.json create mode 100644 clients/gallery/contract/fixtures/fleetlayer/options.json create mode 100644 clients/gallery/contract/fixtures/group-order/gallery.html create mode 100644 clients/gallery/contract/fixtures/group-order/manifest.json create mode 100644 clients/gallery/contract/fixtures/group-order/model.json create mode 100644 clients/gallery/contract/fixtures/group-order/options.json create mode 100644 clients/gallery/contract/fixtures/page-theme/gallery.html create mode 100644 clients/gallery/contract/fixtures/page-theme/manifest.json create mode 100644 clients/gallery/contract/fixtures/page-theme/model.json create mode 100644 clients/gallery/contract/fixtures/page-theme/options.json create mode 100644 clients/gallery/contract/fixtures/single-group/gallery.html create mode 100644 clients/gallery/contract/fixtures/single-group/manifest.json create mode 100644 clients/gallery/contract/fixtures/single-group/model.json create mode 100644 clients/gallery/contract/fixtures/single-group/options.json create mode 100644 clients/gallery/contract/fixtures/strip/gallery.html create mode 100644 clients/gallery/contract/fixtures/strip/manifest.json create mode 100644 clients/gallery/contract/fixtures/strip/model.json create mode 100644 clients/gallery/contract/fixtures/strip/options.json create mode 100644 clients/gallery/contract/fixtures/visualci/gallery.html create mode 100644 clients/gallery/contract/fixtures/visualci/manifest.json create mode 100644 clients/gallery/contract/fixtures/visualci/model.json create mode 100644 clients/gallery/contract/fixtures/visualci/options.json create mode 100644 clients/gallery/js/.gitignore create mode 100644 clients/gallery/js/README.md create mode 100644 clients/gallery/js/package.json create mode 100644 clients/gallery/js/pnpm-lock.yaml create mode 100644 clients/gallery/js/scripts/iife.mjs create mode 100644 clients/gallery/js/src/gallery.css create mode 100644 clients/gallery/js/src/hydrate.ts create mode 100644 clients/gallery/js/src/index.ts create mode 100644 clients/gallery/js/src/load.ts create mode 100644 clients/gallery/js/src/model.ts create mode 100644 clients/gallery/js/src/render-entry.ts create mode 100644 clients/gallery/js/src/render.ts create mode 100644 clients/gallery/js/test/contract.test.ts create mode 100644 clients/gallery/js/test/hydrate.test.ts create mode 100644 clients/gallery/js/test/iife.test.ts create mode 100644 clients/gallery/js/test/model.test.ts create mode 100644 clients/gallery/js/tsconfig.build.json create mode 100644 clients/gallery/js/tsconfig.json create mode 100644 clients/gallery/js/vitest.config.ts create mode 100644 scripts/screenshots/gallery.mjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16e90a32..90eb91bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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. @@ -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' }} @@ -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 diff --git a/clients/gallery/README.md b/clients/gallery/README.md new file mode 100644 index 00000000..4b73addd --- /dev/null +++ b/clients/gallery/README.md @@ -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. diff --git a/clients/gallery/contract/SPEC.md b/clients/gallery/contract/SPEC.md new file mode 100644 index 00000000..b577b41e --- /dev/null +++ b/clients/gallery/contract/SPEC.md @@ -0,0 +1,218 @@ +# The gallery contract + +One screenshots page from a VisualCI public gallery manifest, rendered by any of the gallery's renderers (the JS +library in `../js`, the Astro component, the Ruby gem, the Python package, the Rust crate) and brought to life by the +JS library's `hydrate()`. Every renderer follows this file, and each one's tests check it against the golden fixtures +in `fixtures/` and `errors/`, so the markup can't drift between languages. + +The JS library is the reference implementation: when this file and `../js/src` disagree, fix one of them in the same +change, and regenerate the fixtures (`UPDATE_GOLDEN=1 pnpm test` in `../js`), reviewing their diff. + +## Input + +1. **The manifest**, `https://app.visualci.com/g//.json` (https://visualci.com/docs/gallery/): + `{project, groups: [{name, title?, items: [{name, platform, url, width, height, sha256, since}]}]}`. Only `name`, + `title`, `items`, and each item's `name`, `url`, `width` and `height` are read. +2. **Options**, JSON-shaped, every field optional: + + | Option | Default | Meaning | + | --- | --- | --- | + | `title` | `"Screenshots"` | The gallery's heading and accessible name. `null`: no heading, the name stays "Screenshots". | + | `headingLevel` | `2` | The heading's level, clamped to 1–4 (truncated to an integer). | + | `id` | `"vg"` | The prefix of every id in the markup. | + | `screens` | `{}` | `{"": {title?, caption?}}`. | + | `order` | `[]` | Screen keys in the order they show. | + | `groups` | `{}` | `{"": {title?}}`, over the manifest's titles. | + | `groupOrder` | `[]` | Group names in the order they show. | + | `credit` | `true` | The "Powered by VisualCI" line. | + | `layout` | `"grid"` | `"grid"` or `"strip"`; anything else is `"grid"`. | + | `themeSwitch` | `true` | Light and Dark buttons. Always false for the strip. | + | `seeAll` | `null` | `{href, text?}`: a link under the gallery; `text` defaults to "See all screenshots". | + + Each language takes them in its own spelling (`heading_level`, `group_order`, `theme_switch`, `see_all` in Ruby, + Python and Rust) with the same meaning. + +## Reading the manifest + +- Renderers that fetch it (at build time, or a server's `fetch` helper) **fail** when it can't be read (a network + error, a timeout, a status other than 200, JSON that doesn't parse) or has nothing to show. A static site's build + fails; a request-time helper raises to its caller. There is no "the gallery is updating" page and no empty gallery + (Nathan, 4 Dec 2026: "if visualci is down it should fail any static site build"). +- Retries (the JS library tries 3 times, 20 s each, by default) are the renderer's choice. A manifest that was read + but has nothing to show fails at once. +- `errors/*.json` are manifests every renderer must refuse. + +## The model + +Every renderer builds this, then renders it. `fixtures//model.json` is the model of +`fixtures//manifest.json` with `options.json`, as the JS library serializes it (two-space JSON, keys in the +order below, a newline at the end). Renderers in other languages compare it as data, not bytes. + +``` +{layout, themeSwitch, seeAll: {href, text} | null, title: string | null, label, headingLevel, id, credit, + groups: [{name, title, slug, sizes: ["desktop"?, "phone"?], screens: [{key, title, caption | null, + variants: [{size, theme, url, url2x | null, width, height}]}]}]} +``` + +### A shot's name + +Strip a trailing `.png`, `.jpg`, `.jpeg` or `.webp` (any case). Split it on `/`: the last part is `last`, the parts +before it joined with `/` are `folder` (possibly empty). Then, in this order: + +1. `last` matches `^(\d+)-(light|dark)(-2x)?$` and `folder` isn't empty: the screen key is `folder`, the CSS width + is the number, the theme the word, 2x when the suffix is there. (`screenshots/app/billing/1440-dark-2x`) +2. `last` matches `^(.+?)-(light|dark)(?:-(\d+))?(-2x)?$` (the first group lazy): the key is `folder/` (when there + is a folder) followed by the first group; the theme, CSS width (when present) and 2x as above. + (`ios/usage-light`, `overview-dark-1440`, `pages-edit-changed-light-390`) +3. Otherwise the key is the whole name without its extension, with no theme (it stands for both), no CSS width, not + 2x. + +Size: with a CSS width, under 768 is `phone`, else `desktop`. Without one, an image taller than it is wide +(`height > width`) is `phone`, else `desktop`. + +### Pairing + +For each manifest group, in order, for each item, in order: + +- The item is filed under its screen key and, for its theme (both `light` and `dark` when it has none), the variant + `-`. +- A 2x item sets the variant's `url2x`, unless one is already set. +- Any other item sets the variant's `url`, `width` and `height`, unless they are already set (the first wins, so the + same name on a second platform is ignored). When the name gives a CSS width `W` and the image is wider than `W`, + it was taken at a higher density: `width` is `W` and `height` is + `floor((2 * height * W + width) / (2 * width))` in integers (half rounds up). Otherwise both are the image's. +- A variant with no `url` (only a 2x copy) is dropped; a screen with no variants is dropped. +- Variants sort `desktop` before `phone`, then `light` before `dark`. + +### Screens + +- **Title:** `options.screens[key].title`, else made from the key: drop the longest run of leading folder parts that + every screen key in the group shares (folder parts are every part but the last), then for each remaining part + replace each run of `-` and `_` with one space and trim spaces, join the parts with `, `, and upper-case the first + character (`screenshots/app/billing/free` among `screenshots/app/…` keys: "Billing, free"). Upper-casing uses the + language's Unicode-aware upper case of that one character. +- **Caption:** `options.screens[key].caption`, else `null`. +- **Order:** keys in `options.order` first, in that order; then the rest, by key, comparing strings by code point. + +### Groups + +- A group with no screens is dropped. A manifest with no groups left is an error. +- `title`: `options.groups[name].title`, else the manifest group's `title` when it isn't null, else its `name`. +- `slug`: the name lower-cased (ASCII letters only: `A`–`Z` to `a`–`z`), each run of anything other than `a`–`z` and + `0`–`9` replaced by `-`, leading and trailing `-` removed; `group` when nothing is left. A slug already taken by + an earlier group (in manifest order) gets `-2`, `-3`, … appended to the base slug until it's free. +- `sizes`: `desktop` and `phone`, in that order, each when any of its screens has a variant at that size. +- **Order:** names in `options.groupOrder` first, in that order; then the rest, in the manifest's order. + +### The rest + +`title` is the option (`"Screenshots"` when absent), `label` is the title or "Screenshots" when it's null, +`layout`, `themeSwitch` (`layout == "grid"` and the option isn't false), `seeAll` (`null`, or `{href, text}` with +the default text), `headingLevel`, `id`, `credit` as above. + +## The markup + +`fixtures//gallery.html` is the exact output: every renderer produces it byte for byte. The JS library's +`src/render.ts` is the reference; this is what it does. + +- Text and attribute values are escaped by replacing `&` `<` `>` `"` `'` with `&` `<` `>` `"` `'` + (in that order, `&` first), and nothing else. Attribute values are always in double quotes. Numbers are plain + integers. +- The output is lines joined with `\n`, ending with `\n`. No indentation. Each line below is one line of output; a + line in brackets is present only when its condition holds. +- `h(n)` is the heading element `h`. `B` is 0 when `title` is null, else 1. +- The section's starting size `S`: for the grid, the first group's first size; for the strip, `desktop` when any + group has a desktop variant, else `phone`. + +``` +
+[{title} when title isn't null] +… the grid's or the strip's lines … +[

{seeAll.text}

when seeAll] +[

Screenshot Gallery Powered by VisualCI.com

when credit] + +
{THEMES if themeSwitch}{SIZES(desktop phone, " vg-box-sizes") if grid}{STEP(-1)}{STEP(1)}{CLOSE}
+
+
+
+``` + +with these fragments (no newlines inside them): + +- `THEMES`: `
` +- `SIZES(sizes, extra)`: `
` then for each size + ``, then `
`. +- `STEP(-1)`: ``; + `STEP(1)`: the same with `1`, `Next screen` and `›`; `CLOSE`: + ``. + +### The grid + +With more than one group, the tabs: + +``` +
+ (one line per group) +
+``` + +Then for each group, `i` its index: + +``` + +``` + +### The strip + +Every screen of every group, in order, that has a variant at size `S`, in one row: + +``` +
+
+
    +{CARD(screen, [S], h(B), without caption)} (one line per screen) +
+
+
+``` + +### A card + +`CARD(screen, sizes, heading, caption?)`: for each size in `sizes` at which the screen has variants (`shown`, in +order), the images: one image for both themes (`light dark`) when the size has one variant, or two whose `url` and +`url2x` are the same; else one image per variant, for its theme. `first` is the first variant of the first shown size. + +``` +
  • {IMAGES}{title}[

    {caption}

    when wanted and not null]
  • +``` + +An image, for a variant and its themes (`light`, `dark`, or `light dark`): + +``` +{title}, {desktop|phone}, {themes joined with +``` + +## Behaviour + +`hydrate(el)` (the JS library) works from the markup alone: + +- The gallery's theme and size are attributes on the section (`data-theme`, `data-size`), and the CSS shows only the + matching image in each card, and only the cards with a variant at that size. Before the script runs, the theme + follows the reader's setting and the size is `S`. +- Theme: `` when set, else `prefers-color-scheme`. With the Light and Dark buttons the + reader then chooses; without them (`data-vg-theme-source="page"`) the gallery follows `` as it + changes. +- Size: phone on a screen narrower than 48rem, else desktop. A tab without the chosen size shows the size it has, + without changing the choice. +- Tabs follow the WAI-ARIA tabs pattern: one panel at a time, arrow keys, Home and End, roving tabindex. +- A card is a link to the image it shows, so it works without the script, with a modified or middle click, and in a + browser without ``. Otherwise a click opens the full-size view: a modal `` with the same switches, + previous and next (buttons and arrow keys) through the cards shown at that size, Escape or a click on the backdrop + to close, and focus back on the card. A `data-src-2x` copy becomes the view's 2x source. +- The strip's buttons scroll it by most of its width (instantly with reduced motion) and are disabled at its ends. +- An image that can't load is replaced by its alt text, in the same place. diff --git a/clients/gallery/contract/errors/empty-groups.json b/clients/gallery/contract/errors/empty-groups.json new file mode 100644 index 00000000..f17cc7aa --- /dev/null +++ b/clients/gallery/contract/errors/empty-groups.json @@ -0,0 +1 @@ +{"project": "acme/web", "groups": [{"name": "Web", "items": []}, {"name": "iOS", "title": "iOS", "items": []}]} diff --git a/clients/gallery/contract/errors/no-groups.json b/clients/gallery/contract/errors/no-groups.json new file mode 100644 index 00000000..35e6c34c --- /dev/null +++ b/clients/gallery/contract/errors/no-groups.json @@ -0,0 +1 @@ +{"project": "acme/web", "groups": []} diff --git a/clients/gallery/contract/errors/not-a-manifest.json b/clients/gallery/contract/errors/not-a-manifest.json new file mode 100644 index 00000000..75538aec --- /dev/null +++ b/clients/gallery/contract/errors/not-a-manifest.json @@ -0,0 +1 @@ +{"project": "acme/web"} diff --git a/clients/gallery/contract/fixtures/escaping/gallery.html b/clients/gallery/contract/fixtures/escaping/gallery.html new file mode 100644 index 00000000..d0cfa3a3 --- /dev/null +++ b/clients/gallery/contract/fixtures/escaping/gallery.html @@ -0,0 +1,31 @@ +
    +

    Shots <& "friends">

    +
    + + + +
    +
    +

    "Quotes" & 'apostrophes' <b>

    +
      +
    • Q&a, desktop, lightQ&a, desktop, dark

      Q&a

      Ask & answer <fast>

    • +
    +
    + + +

    Screenshot Gallery Powered by VisualCI.com

    + +

    +
    +
    +
    diff --git a/clients/gallery/contract/fixtures/escaping/manifest.json b/clients/gallery/contract/fixtures/escaping/manifest.json new file mode 100644 index 00000000..f946fed1 --- /dev/null +++ b/clients/gallery/contract/fixtures/escaping/manifest.json @@ -0,0 +1,25 @@ +{ + "project": "acme/web", + "groups": [ + { + "name": "Web & ", + "title": "\"Quotes\" & 'apostrophes' ", + "items": [ + {"name": "q&a-light-1440", "platform": "", "url": "https://app.visualci.com/g/acme/web/q&a-light-1440.png?x=\"1\"", "width": 1440, "height": 900, "sha256": "g1", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "q&a-dark-1440", "platform": "", "url": "https://app.visualci.com/g/acme/web/q&a-dark-1440.png", "width": 1440, "height": 900, "sha256": "g2", "since": "2026-12-01T09:00:00+00:00"} + ] + }, + { + "name": "Web Mobile", + "items": [ + {"name": "café-light-390", "platform": "", "url": "https://app.visualci.com/g/acme/web/caf%C3%A9-light-390.png", "width": 390, "height": 844, "sha256": "g3", "since": "2026-12-01T09:00:00+00:00"} + ] + }, + { + "name": "!!!", + "items": [ + {"name": "x-dark-390", "platform": "", "url": "https://app.visualci.com/g/acme/web/x-dark-390.png", "width": 390, "height": 844, "sha256": "g4", "since": "2026-12-01T09:00:00+00:00"} + ] + } + ] +} diff --git a/clients/gallery/contract/fixtures/escaping/model.json b/clients/gallery/contract/fixtures/escaping/model.json new file mode 100644 index 00000000..bc24ae8d --- /dev/null +++ b/clients/gallery/contract/fixtures/escaping/model.json @@ -0,0 +1,95 @@ +{ + "layout": "grid", + "themeSwitch": true, + "seeAll": null, + "title": "Shots <& \"friends\">", + "label": "Shots <& \"friends\">", + "headingLevel": 2, + "id": "vg", + "credit": true, + "groups": [ + { + "name": "Web & ", + "title": "\"Quotes\" & 'apostrophes' ", + "slug": "web-mobile", + "sizes": [ + "desktop" + ], + "screens": [ + { + "key": "q&a", + "title": "Q&a", + "caption": "Ask & answer ", + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/q&a-light-1440.png?x=\"1\"", + "url2x": null, + "width": 1440, + "height": 900 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/q&a-dark-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + } + ] + } + ] + }, + { + "name": "Web Mobile", + "title": "Web Mobile", + "slug": "web-mobile-2", + "sizes": [ + "phone" + ], + "screens": [ + { + "key": "café", + "title": "Café", + "caption": null, + "variants": [ + { + "size": "phone", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/caf%C3%A9-light-390.png", + "url2x": null, + "width": 390, + "height": 844 + } + ] + } + ] + }, + { + "name": "!!!", + "title": "!!!", + "slug": "group", + "sizes": [ + "phone" + ], + "screens": [ + { + "key": "x", + "title": "X", + "caption": null, + "variants": [ + { + "size": "phone", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/x-dark-390.png", + "url2x": null, + "width": 390, + "height": 844 + } + ] + } + ] + } + ] +} diff --git a/clients/gallery/contract/fixtures/escaping/options.json b/clients/gallery/contract/fixtures/escaping/options.json new file mode 100644 index 00000000..6b55ccd3 --- /dev/null +++ b/clients/gallery/contract/fixtures/escaping/options.json @@ -0,0 +1 @@ +{"title": "Shots <& \"friends\">", "screens": {"q&a": {"caption": "Ask & answer "}}} diff --git a/clients/gallery/contract/fixtures/fleetlayer/gallery.html b/clients/gallery/contract/fixtures/fleetlayer/gallery.html new file mode 100644 index 00000000..a4d941ea --- /dev/null +++ b/clients/gallery/contract/fixtures/fleetlayer/gallery.html @@ -0,0 +1,35 @@ +
    +
    + + + +
    +
    +

    The dashboard

    +
      +
    • Overview, desktop, lightOverview, desktop, darkOverview, phone, lightOverview, phone, dark

      Overview

      What needs you, every machine with its sessions, and the newest events.

    • +
    • Access, desktop, lightAccess, desktop, dark

      Access

      Requests waiting for your approval.

    • +
    • Logo, desktop, light and dark

      Logo

    • +
    • The preview, phone, lightThe preview, phone, dark

      The preview

    • +
    • Status, desktop, light and dark

      Status

    • +
    +
    + + +

    Screenshot Gallery Powered by VisualCI.com

    + +

    +
    +
    +
    diff --git a/clients/gallery/contract/fixtures/fleetlayer/manifest.json b/clients/gallery/contract/fixtures/fleetlayer/manifest.json new file mode 100644 index 00000000..9d3719d9 --- /dev/null +++ b/clients/gallery/contract/fixtures/fleetlayer/manifest.json @@ -0,0 +1,40 @@ +{ + "project": "acme/web", + "groups": [ + { + "name": "Web", + "title": "The dashboard", + "items": [ + {"name": "overview-dark-1440", "platform": "chromium-linux", "url": "https://app.visualci.com/g/acme/web/overview-dark-1440.png", "width": 1440, "height": 900, "sha256": "a1", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "overview-dark-390", "platform": "chromium-linux", "url": "https://app.visualci.com/g/acme/web/overview-dark-390.png", "width": 390, "height": 844, "sha256": "a2", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "overview-light-1440", "platform": "chromium-linux", "url": "https://app.visualci.com/g/acme/web/overview-light-1440.png", "width": 1440, "height": 900, "sha256": "a3", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "overview-light-390", "platform": "chromium-linux", "url": "https://app.visualci.com/g/acme/web/overview-light-390.png", "width": 390, "height": 844, "sha256": "a4", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "access-dark-1440", "platform": "chromium-linux", "url": "https://app.visualci.com/g/acme/web/access-dark-1440.png", "width": 1440, "height": 1252, "sha256": "a5", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "access-light-1440", "platform": "chromium-linux", "url": "https://app.visualci.com/g/acme/web/access-light-1440.png", "width": 1440, "height": 1252, "sha256": "a6", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "pages-edit-preview-light-390", "platform": "chromium-linux", "url": "https://app.visualci.com/g/acme/web/pages-edit-preview-light-390.png", "width": 390, "height": 844, "sha256": "a7", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "pages-edit-preview-dark-390", "platform": "chromium-linux", "url": "https://app.visualci.com/g/acme/web/pages-edit-preview-dark-390.png", "width": 390, "height": 844, "sha256": "a8", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "status-light-1440", "platform": "chromium-linux", "url": "https://app.visualci.com/g/acme/web/status-light-1440.png", "width": 1440, "height": 900, "sha256": "a9", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "logo.png", "platform": "chromium-linux", "url": "https://app.visualci.com/g/acme/web/logo.png", "width": 1200, "height": 630, "sha256": "aa", "since": "2026-12-01T09:00:00+00:00"} + ] + }, + { + "name": "iPhone", + "title": "The iPhone app", + "items": [ + {"name": "ios/sessions-light", "platform": "ios-18", "url": "https://app.visualci.com/g/acme/web/ios/sessions-light.png", "width": 1206, "height": 2622, "sha256": "b1", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "ios/sessions-dark", "platform": "ios-18", "url": "https://app.visualci.com/g/acme/web/ios/sessions-dark.png", "width": 1206, "height": 2622, "sha256": "b2", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "ios/approval-dark", "platform": "ios-18", "url": "https://app.visualci.com/g/acme/web/ios/approval-dark.png", "width": 1206, "height": 2622, "sha256": "b3", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "ios/approval-light", "platform": "ios-18", "url": "https://app.visualci.com/g/acme/web/ios/approval-light.png", "width": 1206, "height": 2622, "sha256": "b4", "since": "2026-12-01T09:00:00+00:00"} + ] + }, + { + "name": "Mac approver", + "title": "The Mac approver", + "items": [ + {"name": "mac/approval-dark", "platform": "macos-15", "url": "https://app.visualci.com/g/acme/web/mac/approval-dark.png", "width": 920, "height": 752, "sha256": "c1", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "mac/approval-light", "platform": "macos-15", "url": "https://app.visualci.com/g/acme/web/mac/approval-light.png", "width": 920, "height": 752, "sha256": "c2", "since": "2026-12-01T09:00:00+00:00"} + ] + }, + {"name": "AI Auth Hub", "title": "The AI auth hub", "items": []} + ] +} diff --git a/clients/gallery/contract/fixtures/fleetlayer/model.json b/clients/gallery/contract/fixtures/fleetlayer/model.json new file mode 100644 index 00000000..4e31e459 --- /dev/null +++ b/clients/gallery/contract/fixtures/fleetlayer/model.json @@ -0,0 +1,235 @@ +{ + "layout": "grid", + "themeSwitch": true, + "seeAll": null, + "title": null, + "label": "Screenshots", + "headingLevel": 2, + "id": "vg", + "credit": true, + "groups": [ + { + "name": "Web", + "title": "The dashboard", + "slug": "web", + "sizes": [ + "desktop", + "phone" + ], + "screens": [ + { + "key": "overview", + "title": "Overview", + "caption": "What needs you, every machine with its sessions, and the newest events.", + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/overview-light-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/overview-dark-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + }, + { + "size": "phone", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/overview-light-390.png", + "url2x": null, + "width": 390, + "height": 844 + }, + { + "size": "phone", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/overview-dark-390.png", + "url2x": null, + "width": 390, + "height": 844 + } + ] + }, + { + "key": "access", + "title": "Access", + "caption": "Requests waiting for your approval.", + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/access-light-1440.png", + "url2x": null, + "width": 1440, + "height": 1252 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/access-dark-1440.png", + "url2x": null, + "width": 1440, + "height": 1252 + } + ] + }, + { + "key": "logo", + "title": "Logo", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/logo.png", + "url2x": null, + "width": 1200, + "height": 630 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/logo.png", + "url2x": null, + "width": 1200, + "height": 630 + } + ] + }, + { + "key": "pages-edit-preview", + "title": "The preview", + "caption": null, + "variants": [ + { + "size": "phone", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/pages-edit-preview-light-390.png", + "url2x": null, + "width": 390, + "height": 844 + }, + { + "size": "phone", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/pages-edit-preview-dark-390.png", + "url2x": null, + "width": 390, + "height": 844 + } + ] + }, + { + "key": "status", + "title": "Status", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/status-light-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + } + ] + } + ] + }, + { + "name": "iPhone", + "title": "The iPhone app", + "slug": "iphone", + "sizes": [ + "phone" + ], + "screens": [ + { + "key": "ios/sessions", + "title": "Sessions", + "caption": "Every session on every machine.", + "variants": [ + { + "size": "phone", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/ios/sessions-light.png", + "url2x": null, + "width": 1206, + "height": 2622 + }, + { + "size": "phone", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/ios/sessions-dark.png", + "url2x": null, + "width": 1206, + "height": 2622 + } + ] + }, + { + "key": "ios/approval", + "title": "Approval", + "caption": null, + "variants": [ + { + "size": "phone", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/ios/approval-light.png", + "url2x": null, + "width": 1206, + "height": 2622 + }, + { + "size": "phone", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/ios/approval-dark.png", + "url2x": null, + "width": 1206, + "height": 2622 + } + ] + } + ] + }, + { + "name": "Mac approver", + "title": "The Mac approver", + "slug": "mac-approver", + "sizes": [ + "desktop" + ], + "screens": [ + { + "key": "mac/approval", + "title": "Approval", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/mac/approval-light.png", + "url2x": null, + "width": 920, + "height": 752 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/mac/approval-dark.png", + "url2x": null, + "width": 920, + "height": 752 + } + ] + } + ] + } + ] +} diff --git a/clients/gallery/contract/fixtures/fleetlayer/options.json b/clients/gallery/contract/fixtures/fleetlayer/options.json new file mode 100644 index 00000000..9ab6bf28 --- /dev/null +++ b/clients/gallery/contract/fixtures/fleetlayer/options.json @@ -0,0 +1,10 @@ +{ + "title": null, + "screens": { + "overview": {"title": "Overview", "caption": "What needs you, every machine with its sessions, and the newest events."}, + "access": {"title": "Access", "caption": "Requests waiting for your approval."}, + "pages-edit-preview": {"title": "The preview"}, + "ios/sessions": {"title": "Sessions", "caption": "Every session on every machine."} + }, + "order": ["overview", "access", "ios/sessions", "ios/approval"] +} diff --git a/clients/gallery/contract/fixtures/group-order/gallery.html b/clients/gallery/contract/fixtures/group-order/gallery.html new file mode 100644 index 00000000..0fa61e3f --- /dev/null +++ b/clients/gallery/contract/fixtures/group-order/gallery.html @@ -0,0 +1,31 @@ +
    +

    Screenshots

    +
    + + + +
    +
    +

    iOS

    +
      +
    • A, phone, light and dark

      A

    • +
    +
    + + +

    Screenshot Gallery Powered by VisualCI.com

    + +

    +
    +
    +
    diff --git a/clients/gallery/contract/fixtures/group-order/manifest.json b/clients/gallery/contract/fixtures/group-order/manifest.json new file mode 100644 index 00000000..0012aa7a --- /dev/null +++ b/clients/gallery/contract/fixtures/group-order/manifest.json @@ -0,0 +1,14 @@ +{ + "project": "acme/web", + "groups": [ + {"name": "Web", "title": "In the browser", "items": [ + {"name": "a-light-1440", "platform": "", "url": "https://app.visualci.com/g/acme/web/a-light-1440.png", "width": 1440, "height": 900, "sha256": "h1", "since": "2026-12-01T09:00:00+00:00"} + ]}, + {"name": "iOS", "items": [ + {"name": "ios/a-light", "platform": "", "url": "https://app.visualci.com/g/acme/web/ios/a-light.png", "width": 1179, "height": 2556, "sha256": "h2", "since": "2026-12-01T09:00:00+00:00"} + ]}, + {"name": "Android", "items": [ + {"name": "android/a-light", "platform": "", "url": "https://app.visualci.com/g/acme/web/android/a-light.png", "width": 1080, "height": 2400, "sha256": "h3", "since": "2026-12-01T09:00:00+00:00"} + ]} + ] +} diff --git a/clients/gallery/contract/fixtures/group-order/model.json b/clients/gallery/contract/fixtures/group-order/model.json new file mode 100644 index 00000000..dc8fc5b3 --- /dev/null +++ b/clients/gallery/contract/fixtures/group-order/model.json @@ -0,0 +1,87 @@ +{ + "layout": "grid", + "themeSwitch": true, + "seeAll": null, + "title": "Screenshots", + "label": "Screenshots", + "headingLevel": 2, + "id": "vg", + "credit": true, + "groups": [ + { + "name": "iOS", + "title": "iOS", + "slug": "ios", + "sizes": [ + "phone" + ], + "screens": [ + { + "key": "ios/a", + "title": "A", + "caption": null, + "variants": [ + { + "size": "phone", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/ios/a-light.png", + "url2x": null, + "width": 1179, + "height": 2556 + } + ] + } + ] + }, + { + "name": "Web", + "title": "On the web", + "slug": "web", + "sizes": [ + "desktop" + ], + "screens": [ + { + "key": "a", + "title": "A", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/a-light-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + } + ] + } + ] + }, + { + "name": "Android", + "title": "Android phones", + "slug": "android", + "sizes": [ + "phone" + ], + "screens": [ + { + "key": "android/a", + "title": "A", + "caption": null, + "variants": [ + { + "size": "phone", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/android/a-light.png", + "url2x": null, + "width": 1080, + "height": 2400 + } + ] + } + ] + } + ] +} diff --git a/clients/gallery/contract/fixtures/group-order/options.json b/clients/gallery/contract/fixtures/group-order/options.json new file mode 100644 index 00000000..ca5e7103 --- /dev/null +++ b/clients/gallery/contract/fixtures/group-order/options.json @@ -0,0 +1 @@ +{"groupOrder": ["iOS", "Web"], "groups": {"Web": {"title": "On the web"}, "Android": {"title": "Android phones"}}} diff --git a/clients/gallery/contract/fixtures/page-theme/gallery.html b/clients/gallery/contract/fixtures/page-theme/gallery.html new file mode 100644 index 00000000..d62d5d6c --- /dev/null +++ b/clients/gallery/contract/fixtures/page-theme/gallery.html @@ -0,0 +1,27 @@ +
    +

    Screens

    +
    + + +
    +
    +

    The web app

    +
      +
    • Account, desktop, lightAccount, desktop, dark

      Account

    • +
    • Billing, free, desktop, lightBilling, free, desktop, dark

      Billing, free

    • +
    • Build detail, desktop, light and dark

      Build detail

    • +
    +
    + +

    Every screen

    +

    Screenshot Gallery Powered by VisualCI.com

    + +

    +
    +
    +
    diff --git a/clients/gallery/contract/fixtures/page-theme/manifest.json b/clients/gallery/contract/fixtures/page-theme/manifest.json new file mode 100644 index 00000000..3e378dcf --- /dev/null +++ b/clients/gallery/contract/fixtures/page-theme/manifest.json @@ -0,0 +1,27 @@ +{ + "project": "acme/web", + "groups": [ + { + "name": "App", + "title": "The web app", + "items": [ + {"name": "screenshots/app/account/1440-dark-2x", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-dark-2x.png", "width": 2880, "height": 1800, "sha256": "d1", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/account/1440-dark", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-dark.png", "width": 1440, "height": 900, "sha256": "d2", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/account/1440-light-2x", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-light-2x.png", "width": 2880, "height": 1800, "sha256": "d3", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/account/1440-light", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-light.png", "width": 1440, "height": 900, "sha256": "d4", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/billing/free/1440-light", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/billing/free/1440-light.png", "width": 1440, "height": 1100, "sha256": "d5", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/billing/free/1440-dark", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/billing/free/1440-dark.png", "width": 1440, "height": 1100, "sha256": "d6", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/build_detail/1440-light", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/build_detail/1440-light.png", "width": 1440, "height": 2000, "sha256": "d7", "since": "2026-12-01T09:00:00+00:00"} + ] + }, + { + "name": "Phone", + "title": "The web app on a phone", + "items": [ + {"name": "screenshots/app/account/390-light", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/390-light.png", "width": 390, "height": 1200, "sha256": "e1", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/account/390-dark", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/390-dark.png", "width": 390, "height": 1200, "sha256": "e2", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/account/390-dark-2x", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/390-dark-2x.png", "width": 780, "height": 2400, "sha256": "e3", "since": "2026-12-01T09:00:00+00:00"} + ] + } + ] +} diff --git a/clients/gallery/contract/fixtures/page-theme/model.json b/clients/gallery/contract/fixtures/page-theme/model.json new file mode 100644 index 00000000..e990ce67 --- /dev/null +++ b/clients/gallery/contract/fixtures/page-theme/model.json @@ -0,0 +1,119 @@ +{ + "layout": "grid", + "themeSwitch": false, + "seeAll": { + "href": "https://example.com/all", + "text": "Every screen" + }, + "title": "Screens", + "label": "Screens", + "headingLevel": 2, + "id": "vg", + "credit": true, + "groups": [ + { + "name": "App", + "title": "The web app", + "slug": "app", + "sizes": [ + "desktop" + ], + "screens": [ + { + "key": "screenshots/app/account", + "title": "Account", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-light.png", + "url2x": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-light-2x.png", + "width": 1440, + "height": 900 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-dark.png", + "url2x": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-dark-2x.png", + "width": 1440, + "height": 900 + } + ] + }, + { + "key": "screenshots/app/billing/free", + "title": "Billing, free", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/app/billing/free/1440-light.png", + "url2x": null, + "width": 1440, + "height": 1100 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/screenshots/app/billing/free/1440-dark.png", + "url2x": null, + "width": 1440, + "height": 1100 + } + ] + }, + { + "key": "screenshots/app/build_detail", + "title": "Build detail", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/app/build_detail/1440-light.png", + "url2x": null, + "width": 1440, + "height": 2000 + } + ] + } + ] + }, + { + "name": "Phone", + "title": "The web app on a phone", + "slug": "phone", + "sizes": [ + "phone" + ], + "screens": [ + { + "key": "screenshots/app/account", + "title": "Account", + "caption": null, + "variants": [ + { + "size": "phone", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/390-light.png", + "url2x": null, + "width": 390, + "height": 1200 + }, + { + "size": "phone", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/390-dark.png", + "url2x": "https://app.visualci.com/g/acme/web/screenshots/app/account/390-dark-2x.png", + "width": 390, + "height": 1200 + } + ] + } + ] + } + ] +} diff --git a/clients/gallery/contract/fixtures/page-theme/options.json b/clients/gallery/contract/fixtures/page-theme/options.json new file mode 100644 index 00000000..534f182b --- /dev/null +++ b/clients/gallery/contract/fixtures/page-theme/options.json @@ -0,0 +1 @@ +{"themeSwitch": false, "title": "Screens", "seeAll": {"href": "https://example.com/all", "text": "Every screen"}} diff --git a/clients/gallery/contract/fixtures/single-group/gallery.html b/clients/gallery/contract/fixtures/single-group/gallery.html new file mode 100644 index 00000000..6f9c530d --- /dev/null +++ b/clients/gallery/contract/fixtures/single-group/gallery.html @@ -0,0 +1,14 @@ +
    +

    Product tour

    +
    +

    Web

    +
      +
    • Home, desktop, lightHome, desktop, dark

      Home

    • +
    • Settings page, desktop, light and dark

      Settings page

    • +
    +
    + +

    +
    +
    +
    diff --git a/clients/gallery/contract/fixtures/single-group/manifest.json b/clients/gallery/contract/fixtures/single-group/manifest.json new file mode 100644 index 00000000..3c951c90 --- /dev/null +++ b/clients/gallery/contract/fixtures/single-group/manifest.json @@ -0,0 +1,14 @@ +{ + "project": "acme/web", + "groups": [ + { + "name": "Web", + "items": [ + {"name": "home-light-1440", "platform": "", "url": "https://app.visualci.com/g/acme/web/home-light-1440.png", "width": 1440, "height": 900, "sha256": "f1", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "home-dark-1440", "platform": "", "url": "https://app.visualci.com/g/acme/web/home-dark-1440.png", "width": 1440, "height": 900, "sha256": "f2", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "home-light-1440", "platform": "webkit", "url": "https://app.visualci.com/g/acme/web/home-light-1440@webkit.png", "width": 1440, "height": 900, "sha256": "f3", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "settings_page-light-1440.webp", "platform": "", "url": "https://app.visualci.com/g/acme/web/settings_page-light-1440.webp", "width": 1440, "height": 900, "sha256": "f4", "since": "2026-12-01T09:00:00+00:00"} + ] + } + ] +} diff --git a/clients/gallery/contract/fixtures/single-group/model.json b/clients/gallery/contract/fixtures/single-group/model.json new file mode 100644 index 00000000..d1e6b038 --- /dev/null +++ b/clients/gallery/contract/fixtures/single-group/model.json @@ -0,0 +1,60 @@ +{ + "layout": "grid", + "themeSwitch": true, + "seeAll": null, + "title": "Product tour", + "label": "Product tour", + "headingLevel": 1, + "id": "tour", + "credit": false, + "groups": [ + { + "name": "Web", + "title": "Web", + "slug": "web", + "sizes": [ + "desktop" + ], + "screens": [ + { + "key": "home", + "title": "Home", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/home-light-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/home-dark-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + } + ] + }, + { + "key": "settings_page", + "title": "Settings page", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/settings_page-light-1440.webp", + "url2x": null, + "width": 1440, + "height": 900 + } + ] + } + ] + } + ] +} diff --git a/clients/gallery/contract/fixtures/single-group/options.json b/clients/gallery/contract/fixtures/single-group/options.json new file mode 100644 index 00000000..e0aff863 --- /dev/null +++ b/clients/gallery/contract/fixtures/single-group/options.json @@ -0,0 +1 @@ +{"title": "Product tour", "headingLevel": 1, "id": "tour", "credit": false} diff --git a/clients/gallery/contract/fixtures/strip/gallery.html b/clients/gallery/contract/fixtures/strip/gallery.html new file mode 100644 index 00000000..6765e867 --- /dev/null +++ b/clients/gallery/contract/fixtures/strip/gallery.html @@ -0,0 +1,19 @@ +
    +
    +
    +
      +
    • Signing, desktop, light and dark

      Signing

    • +
    • Data requests, desktop, lightData requests, desktop, dark

      Data requests

    • +
    • Html editor, desktop, lightHtml editor, desktop, dark

      Html editor

    • +
    • Settings, desktop, lightSettings, desktop, dark

      Settings

    • +
    • Submissions, desktop, lightSubmissions, desktop, dark

      Submissions

    • +
    • Templates, desktop, lightTemplates, desktop, dark

      Templates

    • +
    +
    +
    +

    See all screenshots

    + +

    +
    +
    +
    diff --git a/clients/gallery/contract/fixtures/strip/manifest.json b/clients/gallery/contract/fixtures/strip/manifest.json new file mode 100644 index 00000000..4c1269a3 --- /dev/null +++ b/clients/gallery/contract/fixtures/strip/manifest.json @@ -0,0 +1,132 @@ +{ + "project": "acme/web", + "groups": [ + { + "name": "Web", + "items": [ + { + "name": "screenshots/templates-light-1440", + "platform": "chromium-linux", + "url": "https://app.visualci.com/g/acme/web/screenshots/templates-light-1440.png", + "width": 2880, + "height": 1800, + "sha256": "i1", + "since": "2026-12-01T09:00:00+00:00" + }, + { + "name": "screenshots/templates-dark-1440", + "platform": "chromium-linux", + "url": "https://app.visualci.com/g/acme/web/screenshots/templates-dark-1440.png", + "width": 2880, + "height": 1800, + "sha256": "i2", + "since": "2026-12-01T09:00:00+00:00" + }, + { + "name": "screenshots/signing-light-1440", + "platform": "chromium-linux", + "url": "https://app.visualci.com/g/acme/web/screenshots/signing-light-1440.png", + "width": 2880, + "height": 1801, + "sha256": "i3", + "since": "2026-12-01T09:00:00+00:00" + }, + { + "name": "screenshots/pdf-editor-light-390", + "platform": "chromium-linux", + "url": "https://app.visualci.com/g/acme/web/screenshots/pdf-editor-light-390.png", + "width": 780, + "height": 1688, + "sha256": "i4", + "since": "2026-12-01T09:00:00+00:00" + }, + { + "name": "screenshots/html-editor-light-1440", + "platform": "chromium-linux", + "url": "https://app.visualci.com/g/acme/web/screenshots/html-editor-light-1440.png", + "width": 2880, + "height": 1800, + "sha256": "j0l", + "since": "2026-12-01T09:00:00+00:00" + }, + { + "name": "screenshots/html-editor-dark-1440", + "platform": "chromium-linux", + "url": "https://app.visualci.com/g/acme/web/screenshots/html-editor-dark-1440.png", + "width": 2880, + "height": 1800, + "sha256": "j0d", + "since": "2026-12-01T09:00:00+00:00" + }, + { + "name": "screenshots/submissions-light-1440", + "platform": "chromium-linux", + "url": "https://app.visualci.com/g/acme/web/screenshots/submissions-light-1440.png", + "width": 2880, + "height": 1800, + "sha256": "j1l", + "since": "2026-12-01T09:00:00+00:00" + }, + { + "name": "screenshots/submissions-dark-1440", + "platform": "chromium-linux", + "url": "https://app.visualci.com/g/acme/web/screenshots/submissions-dark-1440.png", + "width": 2880, + "height": 1800, + "sha256": "j1d", + "since": "2026-12-01T09:00:00+00:00" + }, + { + "name": "screenshots/data-requests-light-1440", + "platform": "chromium-linux", + "url": "https://app.visualci.com/g/acme/web/screenshots/data-requests-light-1440.png", + "width": 2880, + "height": 1800, + "sha256": "j2l", + "since": "2026-12-01T09:00:00+00:00" + }, + { + "name": "screenshots/data-requests-dark-1440", + "platform": "chromium-linux", + "url": "https://app.visualci.com/g/acme/web/screenshots/data-requests-dark-1440.png", + "width": 2880, + "height": 1800, + "sha256": "j2d", + "since": "2026-12-01T09:00:00+00:00" + }, + { + "name": "screenshots/settings-light-1440", + "platform": "chromium-linux", + "url": "https://app.visualci.com/g/acme/web/screenshots/settings-light-1440.png", + "width": 2880, + "height": 1800, + "sha256": "j3l", + "since": "2026-12-01T09:00:00+00:00" + }, + { + "name": "screenshots/settings-dark-1440", + "platform": "chromium-linux", + "url": "https://app.visualci.com/g/acme/web/screenshots/settings-dark-1440.png", + "width": 2880, + "height": 1800, + "sha256": "j3d", + "since": "2026-12-01T09:00:00+00:00" + } + ] + }, + { + "name": "iOS", + "items": [ + { + "name": "ios/home-light", + "platform": "ios-18", + "url": "https://app.visualci.com/g/acme/web/ios/home-light.png", + "width": 1206, + "height": 2622, + "sha256": "i5", + "since": "2026-12-01T09:00:00+00:00" + } + ] + } + ] +} diff --git a/clients/gallery/contract/fixtures/strip/model.json b/clients/gallery/contract/fixtures/strip/model.json new file mode 100644 index 00000000..3919ae2d --- /dev/null +++ b/clients/gallery/contract/fixtures/strip/model.json @@ -0,0 +1,196 @@ +{ + "layout": "strip", + "themeSwitch": false, + "seeAll": { + "href": "/screenshots/", + "text": "See all screenshots" + }, + "title": null, + "label": "Screenshots", + "headingLevel": 2, + "id": "vg", + "credit": false, + "groups": [ + { + "name": "Web", + "title": "Web", + "slug": "web", + "sizes": [ + "desktop", + "phone" + ], + "screens": [ + { + "key": "screenshots/signing", + "title": "Signing", + "caption": "Not shown in a strip", + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/signing-light-1440.png", + "url2x": null, + "width": 1440, + "height": 901 + } + ] + }, + { + "key": "screenshots/data-requests", + "title": "Data requests", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/data-requests-light-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/screenshots/data-requests-dark-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + } + ] + }, + { + "key": "screenshots/html-editor", + "title": "Html editor", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/html-editor-light-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/screenshots/html-editor-dark-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + } + ] + }, + { + "key": "screenshots/pdf-editor", + "title": "Pdf editor", + "caption": null, + "variants": [ + { + "size": "phone", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/pdf-editor-light-390.png", + "url2x": null, + "width": 390, + "height": 844 + } + ] + }, + { + "key": "screenshots/settings", + "title": "Settings", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/settings-light-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/screenshots/settings-dark-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + } + ] + }, + { + "key": "screenshots/submissions", + "title": "Submissions", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/submissions-light-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/screenshots/submissions-dark-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + } + ] + }, + { + "key": "screenshots/templates", + "title": "Templates", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/templates-light-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/screenshots/templates-dark-1440.png", + "url2x": null, + "width": 1440, + "height": 900 + } + ] + } + ] + }, + { + "name": "iOS", + "title": "iOS", + "slug": "ios", + "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 + } + ] + } + ] + } + ] +} diff --git a/clients/gallery/contract/fixtures/strip/options.json b/clients/gallery/contract/fixtures/strip/options.json new file mode 100644 index 00000000..a6667b6f --- /dev/null +++ b/clients/gallery/contract/fixtures/strip/options.json @@ -0,0 +1 @@ +{"layout": "strip", "title": null, "seeAll": {"href": "/screenshots/"}, "credit": false, "screens": {"screenshots/signing": {"title": "Signing", "caption": "Not shown in a strip"}}, "order": ["screenshots/signing"]} diff --git a/clients/gallery/contract/fixtures/visualci/gallery.html b/clients/gallery/contract/fixtures/visualci/gallery.html new file mode 100644 index 00000000..5c85a0b1 --- /dev/null +++ b/clients/gallery/contract/fixtures/visualci/gallery.html @@ -0,0 +1,26 @@ +
    +

    Screenshots

    +
    + + +
    +
    +

    The web app

    +
      +
    • Account, desktop, lightAccount, desktop, dark

      Account

    • +
    • Billing, free, desktop, lightBilling, free, desktop, dark

      Billing, free

    • +
    • Build detail, desktop, light and dark

      Build detail

    • +
    +
    + +

    Screenshot Gallery Powered by VisualCI.com

    + +

    +
    +
    +
    diff --git a/clients/gallery/contract/fixtures/visualci/manifest.json b/clients/gallery/contract/fixtures/visualci/manifest.json new file mode 100644 index 00000000..3e378dcf --- /dev/null +++ b/clients/gallery/contract/fixtures/visualci/manifest.json @@ -0,0 +1,27 @@ +{ + "project": "acme/web", + "groups": [ + { + "name": "App", + "title": "The web app", + "items": [ + {"name": "screenshots/app/account/1440-dark-2x", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-dark-2x.png", "width": 2880, "height": 1800, "sha256": "d1", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/account/1440-dark", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-dark.png", "width": 1440, "height": 900, "sha256": "d2", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/account/1440-light-2x", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-light-2x.png", "width": 2880, "height": 1800, "sha256": "d3", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/account/1440-light", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-light.png", "width": 1440, "height": 900, "sha256": "d4", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/billing/free/1440-light", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/billing/free/1440-light.png", "width": 1440, "height": 1100, "sha256": "d5", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/billing/free/1440-dark", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/billing/free/1440-dark.png", "width": 1440, "height": 1100, "sha256": "d6", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/build_detail/1440-light", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/build_detail/1440-light.png", "width": 1440, "height": 2000, "sha256": "d7", "since": "2026-12-01T09:00:00+00:00"} + ] + }, + { + "name": "Phone", + "title": "The web app on a phone", + "items": [ + {"name": "screenshots/app/account/390-light", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/390-light.png", "width": 390, "height": 1200, "sha256": "e1", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/account/390-dark", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/390-dark.png", "width": 390, "height": 1200, "sha256": "e2", "since": "2026-12-01T09:00:00+00:00"}, + {"name": "screenshots/app/account/390-dark-2x", "platform": "", "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/390-dark-2x.png", "width": 780, "height": 2400, "sha256": "e3", "since": "2026-12-01T09:00:00+00:00"} + ] + } + ] +} diff --git a/clients/gallery/contract/fixtures/visualci/model.json b/clients/gallery/contract/fixtures/visualci/model.json new file mode 100644 index 00000000..9d80dc5b --- /dev/null +++ b/clients/gallery/contract/fixtures/visualci/model.json @@ -0,0 +1,116 @@ +{ + "layout": "grid", + "themeSwitch": true, + "seeAll": null, + "title": "Screenshots", + "label": "Screenshots", + "headingLevel": 2, + "id": "vg", + "credit": true, + "groups": [ + { + "name": "App", + "title": "The web app", + "slug": "app", + "sizes": [ + "desktop" + ], + "screens": [ + { + "key": "screenshots/app/account", + "title": "Account", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-light.png", + "url2x": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-light-2x.png", + "width": 1440, + "height": 900 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-dark.png", + "url2x": "https://app.visualci.com/g/acme/web/screenshots/app/account/1440-dark-2x.png", + "width": 1440, + "height": 900 + } + ] + }, + { + "key": "screenshots/app/billing/free", + "title": "Billing, free", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/app/billing/free/1440-light.png", + "url2x": null, + "width": 1440, + "height": 1100 + }, + { + "size": "desktop", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/screenshots/app/billing/free/1440-dark.png", + "url2x": null, + "width": 1440, + "height": 1100 + } + ] + }, + { + "key": "screenshots/app/build_detail", + "title": "Build detail", + "caption": null, + "variants": [ + { + "size": "desktop", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/app/build_detail/1440-light.png", + "url2x": null, + "width": 1440, + "height": 2000 + } + ] + } + ] + }, + { + "name": "Phone", + "title": "The web app on a phone", + "slug": "phone", + "sizes": [ + "phone" + ], + "screens": [ + { + "key": "screenshots/app/account", + "title": "Account", + "caption": null, + "variants": [ + { + "size": "phone", + "theme": "light", + "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/390-light.png", + "url2x": null, + "width": 390, + "height": 1200 + }, + { + "size": "phone", + "theme": "dark", + "url": "https://app.visualci.com/g/acme/web/screenshots/app/account/390-dark.png", + "url2x": "https://app.visualci.com/g/acme/web/screenshots/app/account/390-dark-2x.png", + "width": 390, + "height": 1200 + } + ] + } + ] + } + ] +} diff --git a/clients/gallery/contract/fixtures/visualci/options.json b/clients/gallery/contract/fixtures/visualci/options.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/clients/gallery/contract/fixtures/visualci/options.json @@ -0,0 +1 @@ +{} diff --git a/clients/gallery/js/.gitignore b/clients/gallery/js/.gitignore new file mode 100644 index 00000000..849ddff3 --- /dev/null +++ b/clients/gallery/js/.gitignore @@ -0,0 +1 @@ +dist/ diff --git a/clients/gallery/js/README.md b/clients/gallery/js/README.md new file mode 100644 index 00000000..6e55785a --- /dev/null +++ b/clients/gallery/js/README.md @@ -0,0 +1,54 @@ +# @visualci/gallery + +A screenshots page from a VisualCI [public gallery](https://visualci.com/docs/gallery/) manifest. No framework, no +dependencies. The markup is the [gallery contract](../contract/SPEC.md), so a page a server rendered (the Astro +component, the Ruby gem, the Python package) hydrates the same way. + +## In the browser + +```html + +
    + +``` + +On markup a server rendered, call `hydrate(element)` instead. Without a bundler, `dist/gallery.iife.js` (ES5, one +file) sets `window.VisualCIGallery` with the same functions. + +## At build time + +```ts +import { load, render } from "@visualci/gallery/render"; + +const html = render(await load({ manifest: "https://app.visualci.com/g/acme/web.json", title: "Screenshots" })); +``` + +`load` throws when the manifest can't be read or has nothing to show, so the build fails instead of shipping an empty +page. + +## Options + +`title` (default "Screenshots"; `null` for no heading), `headingLevel` (2), `id` ("vg", for two galleries on one +page), `screens` (`{key: {title, caption}}`), `order` (screen keys), `groups` (`{name: {title}}`), `groupOrder`, +`credit` (true), `layout` ("grid", or "strip": one row that scrolls sideways), `themeSwitch` (true; false follows +``), `seeAll` (`{href, text}`). `load` and `mount` also take `manifest`, `timeout`, `attempts` and +`fetch`. [SPEC.md](../contract/SPEC.md) has the details, including how screenshot names pair +(`-[-]` or `/-`). + +## Styling + +`gallery.css` is the default look. Set the `--vg-*` variables (`--vg-ink`, `--vg-muted`, `--vg-paper`, +`--vg-paper-2`, `--vg-rule`, `--vg-accent`, the radii, `--vg-shadow`, sizes and type) on `.vg` or an ancestor to match +your site. + +## Development + +`pnpm build && pnpm test`. The tests check the contract's golden fixtures; `UPDATE_GOLDEN=1 pnpm test` rewrites them +(review the diff). diff --git a/clients/gallery/js/package.json b/clients/gallery/js/package.json new file mode 100644 index 00000000..98dc12bc --- /dev/null +++ b/clients/gallery/js/package.json @@ -0,0 +1,47 @@ +{ + "name": "@visualci/gallery", + "version": "0.1.0", + "description": "A screenshots page from VisualCI's public gallery: render it into an empty element, or hydrate markup a server rendered.", + "license": "Apache-2.0", + "homepage": "https://visualci.com/docs/gallery/", + "repository": { + "type": "git", + "url": "git+https://github.com/DocSpring/visualci.git", + "directory": "clients/gallery/js" + }, + "type": "module", + "packageManager": "pnpm@10.12.4", + "sideEffects": [ + "*.css" + ], + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./render": { + "types": "./dist/render-entry.d.ts", + "default": "./dist/render-entry.js" + }, + "./gallery.css": "./dist/gallery.css", + "./iife": "./dist/gallery.iife.js" + }, + "files": [ + "dist", + "README.md" + ], + "scripts": { + "build": "rm -rf dist && tsc -p tsconfig.build.json && cp src/gallery.css dist/ && node scripts/iife.mjs", + "typecheck": "tsc --noEmit", + "test": "vitest run" + }, + "devDependencies": { + "@types/jsdom": "^30.0.0", + "@types/node": "^24.19.4", + "acorn": "^8.19.0", + "esbuild": "^0.28.2", + "jsdom": "^27.4.0", + "typescript": "^5", + "vitest": "^4.1.12" + } +} diff --git a/clients/gallery/js/pnpm-lock.yaml b/clients/gallery/js/pnpm-lock.yaml new file mode 100644 index 00000000..b8607deb --- /dev/null +++ b/clients/gallery/js/pnpm-lock.yaml @@ -0,0 +1,1427 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + devDependencies: + '@types/jsdom': + specifier: ^30.0.0 + version: 30.0.0 + '@types/node': + specifier: ^24.19.4 + version: 24.19.4 + acorn: + specifier: ^8.19.0 + version: 8.19.0 + esbuild: + specifier: ^0.28.2 + version: 0.28.2 + jsdom: + specifier: ^27.4.0 + version: 27.4.0 + typescript: + specifier: ^5 + version: 5.9.3 + vitest: + specifier: ^4.1.12 + version: 4.1.12(@types/node@24.19.4)(jsdom@27.4.0)(vite@8.4.1(@types/node@24.19.4)(esbuild@0.28.2)) + +packages: + + '@acemir/cssom@0.9.33': + resolution: {integrity: sha512-52IMmrBsIsDZLp/KFM+KmaMLJ8GTj113K+iFGFCoOjstZSZbsAxMJE8KYtwao7bz1LsEG810ts1m5wvkVEqPlg==} + + '@asamuzakjp/css-color@4.1.2': + resolution: {integrity: sha512-NfBUvBaYgKIuq6E/RBLY1m0IohzNHAYyaJGuTK79Z23uNwmz2jl1mPsC5ZxCCxylinKhT1Amn5oNTlx1wN8cQg==} + + '@asamuzakjp/dom-selector@6.8.1': + resolution: {integrity: sha512-MvRz1nCqW0fsy8Qz4dnLIvhOlMzqDVBabZx6lH+YywFDdjXhMY37SmpV1XFX3JzG5GWHn63j6HX6QPr3lZXHvQ==} + + '@asamuzakjp/nwsapi@2.3.9': + resolution: {integrity: sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q==} + + '@csstools/color-helpers@6.1.3': + resolution: {integrity: sha512-c6CpX5G1pvuOKTXiRFJ54Lzc8zQrZ3qUjp44QC5DJNt1OmA1vmfUxOMCcKdDqsvffVDG0/MHnY63J+Mn0nmdUg==} + engines: {node: '>=20.19.0'} + + '@csstools/css-calc@3.4.4': + resolution: {integrity: sha512-Jwo1Z8DUsZ8xVOLBdLMfhjJFvWD6pqaUTlBNQZ+qIB2i9g7yG8kd/UBJj2c9J9Twr+u87cjy9BjkmfvMbyOk3Q==} + engines: {node: '>=20.19.0'} + peerDependencies: + '@csstools/css-parser-algorithms': ^4.0.3 + '@csstools/css-tokenizer': ^4.0.3 + + '@csstools/css-color-parser@4.2.8': + resolution: {integrity: sha512-JLsKBee9dmnA3L+H+vYK4lQ6n5CoY3yEnh33zdlMutRfrTxtqt+hFeoZ1maHRt5vLw67huDLpOkDb3rl9A51MQ==} + engines: {node: '>=20.19.0'} + peerDependencies: + '@csstools/css-parser-algorithms': ^4.0.3 + '@csstools/css-tokenizer': ^4.0.3 + + '@csstools/css-parser-algorithms@4.0.3': + resolution: {integrity: sha512-EpCfUDaJtwohPHC7egoXxPGT/R1/WyyAhw87MKB/7BPPZvZU+IcEqo4er5FpLnby2Gvwt9Lpxy+WNEDyFjoXtA==} + engines: {node: '>=20.19.0'} + peerDependencies: + '@csstools/css-tokenizer': ^4.0.3 + + '@csstools/css-syntax-patches-for-csstree@1.1.17': + resolution: {integrity: sha512-IPx9W33+t0Yt5TVb+Y7oICrThOIry0TY6GuXfSHOatxA0uiHqbzi98Gai905lpBAX1m/LH7iI96e9jcI7Dkvxw==} + peerDependencies: + css-tree: ^3.2.1 + peerDependenciesMeta: + css-tree: + optional: true + + '@csstools/css-tokenizer@4.0.3': + resolution: {integrity: sha512-gdkFe/Z4KU1q8Y5S3GYScXGcOnO56dgWwIs5+97Ij1VIKISItOIUlCXUq4VLbdnRclF+SSQ49sLsn3KeV111AA==} + engines: {node: '>=20.19.0'} + + '@esbuild/aix-ppc64@0.28.2': + resolution: {integrity: sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.28.2': + resolution: {integrity: sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.28.2': + resolution: {integrity: sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.28.2': + resolution: {integrity: sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.28.2': + resolution: {integrity: sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.28.2': + resolution: {integrity: sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.28.2': + resolution: {integrity: sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.28.2': + resolution: {integrity: sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.28.2': + resolution: {integrity: sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.28.2': + resolution: {integrity: sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.28.2': + resolution: {integrity: sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.28.2': + resolution: {integrity: sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.28.2': + resolution: {integrity: sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.28.2': + resolution: {integrity: sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.28.2': + resolution: {integrity: sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.28.2': + resolution: {integrity: sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.28.2': + resolution: {integrity: sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.28.2': + resolution: {integrity: sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.28.2': + resolution: {integrity: sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.28.2': + resolution: {integrity: sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.28.2': + resolution: {integrity: sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.28.2': + resolution: {integrity: sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.28.2': + resolution: {integrity: sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.28.2': + resolution: {integrity: sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.28.2': + resolution: {integrity: sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.28.2': + resolution: {integrity: sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@exodus/bytes@1.16.0': + resolution: {integrity: sha512-IcpW84uEn3N7ETtNZMlxKhfl6Pec8rUNGOTBtWbK1FKhJxIFAptZyVrvVRVBimAJxJCgc3PxepxkdWWG4DVzfA==} + engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0} + peerDependencies: + '@noble/hashes': ^1.8.0 || ^2.0.0 + peerDependenciesMeta: + '@noble/hashes': + optional: true + + '@jridgewell/sourcemap-codec@1.6.0': + resolution: {integrity: sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==} + + '@oxc-project/types@0.160.0': + resolution: {integrity: sha512-gw4k9syEmnckbOgw2A2FU1TBDdX9hfwV9jEn/uio65pguPzwWiXQS3OIJDMEhv9m06tj9XiEe6RoD0YA+LgreA==} + + '@rolldown/binding-android-arm-eabi@1.3.4': + resolution: {integrity: sha512-xCW8CkL/ualx/SbYqeG9iK87lJCZGDQ0soE+kaORJ0Bd+pHALyE4qK7BStmEAyYWLEzZ3/biSIpA6/7GDFvzIg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@rolldown/binding-android-arm64@1.3.4': + resolution: {integrity: sha512-5lifIO+b/prcM9sx/bkPN4w6UEToEfQ3gjhx0+0neuL+dkYskI792CfAq03T51jc8JFcaYXs2hi3l8RjiH/VWQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@rolldown/binding-darwin-arm64@1.3.4': + resolution: {integrity: sha512-RCgxTI4AJQxhVF//BI3ImQOsXTHrF4Eg+f99jBy8WoETA2kSEGFxpnrVmW0leQq/2aBR4R5AC6csmy3rc66e3Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@rolldown/binding-darwin-x64@1.3.4': + resolution: {integrity: sha512-zNPJVVPUaDEj+L0lImoK3rFv2b+Z5gNijI6DWu/fcD3/1TfmRXKb9ZyxbSN+2AhlctqjbNzUvCsMa+EBhnEM4Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@rolldown/binding-freebsd-x64@1.3.4': + resolution: {integrity: sha512-upP6g7ZIRy5by1RDQ/EphHIdJ5xK0eUD7sUgfZFWJ49s4XdbYsIvIlAPtrFpayR70Hhf9J22lb4Pm8/9FhrZmg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@rolldown/binding-linux-arm-gnueabihf@1.3.4': + resolution: {integrity: sha512-SAX5C5+poMLCxu8dkPF6h5yst40rkzs+9Y3cbPn2OFSydmHjAEprrGi64zGgnYyPIVZfdGUFqJ2fJbfbnHI+mA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@rolldown/binding-linux-arm64-gnu@1.3.4': + resolution: {integrity: sha512-nwHqdlRZS6GWBef3dG5/pMY6RNTBBUjj7s0Da+m6xsFpe7jx6IC46SLZcCu8f46JOfCovZmwnrz51EzGE+7Fyw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@rolldown/binding-linux-arm64-musl@1.3.4': + resolution: {integrity: sha512-Gr78X2ur/AgLCkmZgHffk/FerIX8S5zb/eII4bCcvJo0ANzeXhTShahdNbpnY6bpiszIAgIfiuKS9ziziWsamw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@rolldown/binding-linux-ppc64-gnu@1.3.4': + resolution: {integrity: sha512-o9Wcn8nWrsQasaBRYM4d//FwhlBsTJYWkPVlhlt6FwzpwEoovY4IopRZjk5Fq3+ntRuSDORJjF/nA8sFeF2q6w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + + '@rolldown/binding-linux-s390x-gnu@1.3.4': + resolution: {integrity: sha512-UDWu4jkVcx2kiBKm3Ec//4lVCbeTWj8gmJ9SyLWCdLWtTlyq7fQVeVV/14nXvRtSLErvJ2+yA/Ux5taS31Y17Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + + '@rolldown/binding-linux-x64-gnu@1.3.4': + resolution: {integrity: sha512-W9mGtTa0w4fWh8RLMNPyaEhhcuqUfO07Q4I1bBc4PDMNg7gQSw0yPQNQ3D0qwbkXwxbyL4YrIzc8n6k1vuFExQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@rolldown/binding-linux-x64-musl@1.3.4': + resolution: {integrity: sha512-8B+ofyQZ7/aCmkqnyMonPr5zKLqMVNczhRGFNtdIuItiwNn8iQWJawMq2E58r7bxD1XEbtRRsULY/eCWwZQ01Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@rolldown/binding-openharmony-arm64@1.3.4': + resolution: {integrity: sha512-TlD0FSZaC7o2B4NCe9V5N11ugTnhzTM9ksj4sgRLvrKosDzjEkvlsTX3ehkw4ZlPv8AADimZZTvJGEa16pfXug==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@rolldown/binding-wasm32-wasi@1.3.4': + resolution: {integrity: sha512-jwO8P3o53ygo7b5061B7BeaJ1BGv3BKZ6jroFdw/01qWry7Z+qNBlDvulzbTle5s/A0Fc1FRgsTxrke9DvsSbA==} + engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0} + cpu: [wasm32] + + '@rolldown/binding-win32-arm64-msvc@1.3.4': + resolution: {integrity: sha512-8adGMrNtrdzi2WD1ozhYapER59gD8Q/DV6SCKJlyG2HqULPdeQUBvMa33lTsiEYwIqTZUaIU2MmvPp5f1wbtXA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@rolldown/binding-win32-x64-msvc@1.3.4': + resolution: {integrity: sha512-rIMjtESdXJCIoOiUTroQ1Y1rjVDZkuUVRUxs3APX2vNv175D7TDWvzdELiIhzGq9cUNUFat+co+PTmPHPqSREg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + + '@rolldown/pluginutils@1.1.1': + resolution: {integrity: sha512-glFIJDvLNDtJhT9qrMFWLPbvS+skxgt4L0K8Ei2YtnhPysAJnsI7nyxSJxKj4ADeKX0OLjC4ntRkwpLOoS3rwA==} + + '@standard-schema/spec@1.1.0': + resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} + + '@types/chai@5.2.3': + resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} + + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + + '@types/estree@1.0.11': + resolution: {integrity: sha512-YBdNe5JcjYR0sPhJW1QIeRCmI11YhYvaRuGCs9+WCeTTb+Yhb2BE2XMe5/wAqF10FK5g3+q1PDhQABfT7aX0gg==} + + '@types/jsdom@30.0.0': + resolution: {integrity: sha512-uAHGxujGE0cDaKGdK28zgDotFtNA7MKq5DXl8LrfdxdCI8VHcg15oJz+amHTChPNI5JpgEPQWc2xFdrw3em/nQ==} + + '@types/node@24.19.4': + resolution: {integrity: sha512-s04odlR3ksJrLu7QLi+pddkWLD0RmSbcP9KuWn2/ozQKAp/YgwBC/6x9kJj8yAzZnGPfxePm7zm7nysVPCRagw==} + + '@types/tough-cookie@4.0.5': + resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==} + + '@vitest/expect@4.1.12': + resolution: {integrity: sha512-vFlTt+YEu9WBpNjdGayNmlMVzrWPi1+sv853/7t2FU7hpO5gAFBKHzQmkCq5Xjpr+evegF2994LQT3hF3mRlqQ==} + + '@vitest/mocker@4.1.12': + resolution: {integrity: sha512-fKShNpKZzupWZuY0z7egydvL0sqW4INEZBEExMBMAa6izlENEVHwoXgdaTCaBZ5fwlr4xf2o1wXC83n9RpO+NA==} + peerDependencies: + msw: ^2.4.9 + vite: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + + '@vitest/pretty-format@4.1.12': + resolution: {integrity: sha512-XW9O8+Mxx4VpCtkYdMJLZQQwsVryP9wk7cPKDxtXFfwSak6yRh5+2fep/Y0XF/ElBvJHq8bcYdi6aeuai0opZA==} + + '@vitest/runner@4.1.12': + resolution: {integrity: sha512-NKlVKCr5QnCe8jijdMnmkpHHU+WTqiLFR6G0pHji9uRjXK9xJl1k1nTw6F3pOOj2PDcsDt2GKQMI7wIsaT491w==} + + '@vitest/snapshot@4.1.12': + resolution: {integrity: sha512-ko1y1Qgb/slzQ9mr+b89Cuqud8WG1TKtsPD8r7ZUBdvVOGt85Af2HwCqHujrhwJq95hs/9RM7fcAPg57o1vlzw==} + + '@vitest/spy@4.1.12': + resolution: {integrity: sha512-RGq9x4JNGNTZHEJxvN0oSiJjeSCExm0n2gZKKJZHY9cX5AVA6M7VJILBT3ZJ/tJ/0J9uWT7fETV9/btoi//vSg==} + + '@vitest/utils@4.1.12': + resolution: {integrity: sha512-Q3awXrwOfEV+qc3WmO5ONyE0yO7Q1gQ9/oyHxGLZ/pl7N3NO/ZztqQwKLuwMkV+CA1JYSIeO3gkHnRDIo4AVaA==} + + acorn@8.19.0: + resolution: {integrity: sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==} + engines: {node: '>=0.4.0'} + hasBin: true + + agent-base@7.1.4: + resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} + engines: {node: '>= 14'} + + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + + bidi-js@1.1.0: + resolution: {integrity: sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg==} + + chai@6.3.0: + resolution: {integrity: sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==} + engines: {node: '>=18'} + + convert-source-map@2.0.0: + resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + + css-tree@3.2.1: + resolution: {integrity: sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==} + engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0} + + cssstyle@5.3.7: + resolution: {integrity: sha512-7D2EPVltRrsTkhpQmksIu+LxeWAIEk6wRDMJ1qljlv+CKHJM+cJLlfhWIzNA44eAsHXSNe3+vO6DW1yCYx8SuQ==} + engines: {node: '>=20'} + + data-urls@6.0.1: + resolution: {integrity: sha512-euIQENZg6x8mj3fO6o9+fOW8MimUI4PpD/fZBhJfeioZVy9TUpM4UY7KjQNVZFlqwJ0UdzRDzkycB997HEq1BQ==} + engines: {node: '>=20'} + + debug@4.4.3: + resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + decimal.js@10.6.0: + resolution: {integrity: sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==} + + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} + engines: {node: '>=8'} + + entities@9.0.0: + resolution: {integrity: sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg==} + engines: {node: '>=20.19.0'} + + es-module-lexer@2.3.2: + resolution: {integrity: sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==} + + esbuild@0.28.2: + resolution: {integrity: sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==} + engines: {node: '>=18'} + hasBin: true + + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + + expect-type@1.4.0: + resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} + engines: {node: '>=12.0.0'} + + fdir@6.5.0: + resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} + engines: {node: '>=12.0.0'} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + html-encoding-sniffer@6.0.0: + resolution: {integrity: sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==} + engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0} + + http-proxy-agent@7.0.2: + resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} + engines: {node: '>= 14'} + + https-proxy-agent@7.0.6: + resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} + engines: {node: '>= 14'} + + is-potential-custom-element-name@1.0.1: + resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} + + jsdom@27.4.0: + resolution: {integrity: sha512-mjzqwWRD9Y1J1KUi7W97Gja1bwOOM5Ug0EZ6UDK3xS7j7mndrkwozHtSblfomlzyB4NepioNt+B2sOSzczVgtQ==} + engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0} + peerDependencies: + canvas: ^3.0.0 + peerDependenciesMeta: + canvas: + optional: true + + lightningcss-android-arm64@1.33.0: + resolution: {integrity: sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [android] + + lightningcss-darwin-arm64@1.33.0: + resolution: {integrity: sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [darwin] + + lightningcss-darwin-x64@1.33.0: + resolution: {integrity: sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [darwin] + + lightningcss-freebsd-x64@1.33.0: + resolution: {integrity: sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [freebsd] + + lightningcss-linux-arm-gnueabihf@1.33.0: + resolution: {integrity: sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==} + engines: {node: '>= 12.0.0'} + cpu: [arm] + os: [linux] + + lightningcss-linux-arm64-gnu@1.33.0: + resolution: {integrity: sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [linux] + + lightningcss-linux-arm64-musl@1.33.0: + resolution: {integrity: sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [linux] + + lightningcss-linux-x64-gnu@1.33.0: + resolution: {integrity: sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [linux] + + lightningcss-linux-x64-musl@1.33.0: + resolution: {integrity: sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [linux] + + lightningcss-win32-arm64-msvc@1.33.0: + resolution: {integrity: sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [win32] + + lightningcss-win32-x64-msvc@1.33.0: + resolution: {integrity: sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [win32] + + lightningcss@1.33.0: + resolution: {integrity: sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==} + engines: {node: '>= 12.0.0'} + + lru-cache@11.5.4: + resolution: {integrity: sha512-B8nJCTi8JuSaDBg0tBdnImV6j5O2CXaqKfdj24ZTCFbyivN8KZ2Z+RL3aHjwJAfLutD9cNnObG4SIgW4gMufiw==} + engines: {node: 20 || >=22} + + magic-string@0.30.21: + resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} + + mdn-data@2.27.1: + resolution: {integrity: sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + nanoid@3.3.20: + resolution: {integrity: sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + napi-windows-process-start-time@0.1.0: + resolution: {integrity: sha512-zHxhzKsIFu3elch3eFw69WEUGc79DFhbc3nD/WEOzWL/pFFLZRW13EHnuO0c+0YjncE5uCaS9ICHxOBXkb6vPw==} + engines: {node: '>=20'} + cpu: [x64, arm64] + os: [win32] + + obug@2.2.1: + resolution: {integrity: sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==} + engines: {node: '>=12.20.0'} + + parse5@8.1.1: + resolution: {integrity: sha512-EcR/6WDcU7b2N3vQSxKALCk9lXGtUMQxXio008OEMBE0kavu/7JLfBEeFPzi43nMqVDSbEn3QCK+BMCc9zO//w==} + + pathe@2.0.3: + resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + picomatch@4.0.7: + resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==} + engines: {node: '>=12'} + + postcss@8.5.34: + resolution: {integrity: sha512-P1Qzj0XXZjMda74C7qiVnBG90UKNbyNUAOeQRBW8X63RsIMV57gevRqjnkELdwtZ/S2/uQFksJhmwuN8xShLPw==} + engines: {node: ^10 || ^12 || >=14} + + punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + + require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + + rolldown@1.3.4: + resolution: {integrity: sha512-p2rq4bfBmF0M6yaR8+A89fbkBQynZI2fxUW4G07eq9kpctAkpo7q5BZ4X4Mo4XZ7HHROu33cX9PeopUFN6u+2Q==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + + saxes@6.0.0: + resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} + engines: {node: '>=v12.22.7'} + + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + + source-map-js@1.3.0: + resolution: {integrity: sha512-pdUVfIWcK0kCgK831ibqkZDcL7I9zljjOu0TQFnA+fiQ6y1CYqYB7RkTOHHO45FGMg5P/Mvk/+4ToQ7gAYAL5Q==} + engines: {node: '>=6.0.0'} + + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + + std-env@4.3.0: + resolution: {integrity: sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==} + + symbol-tree@3.2.4: + resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} + + tinybench@2.9.0: + resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + + tinyexec@1.4.0: + resolution: {integrity: sha512-PV6lIcJQh57aFeJDwx16JNHmgFRh5xguzallrDW1qe8nAghYgr5MKz2K5k7wEyV/ygZhdnIAP8+HZSarHPBCsg==} + engines: {node: '>=18'} + + tinyglobby@0.2.17: + resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} + engines: {node: '>=12.0.0'} + + tinyrainbow@3.2.0: + resolution: {integrity: sha512-LgO3D9yZJjApUiuUfl9iFAwrtaX4+lok3wJIqttGoKCHlWUqHqbQpnxCf82L8FjgKsh4iGo78hqJwgL8F6To2A==} + engines: {node: '>=14.0.0'} + + tldts-core@7.6.4: + resolution: {integrity: sha512-QywQ9lgQyZMuc3NVlqmuxHOhlwirSdvgD/vDLvX8dZYcYgy1cdri5rY/TXDHcF4J3VBSdJLcJNIJI6zGJ7jE+w==} + + tldts@7.6.4: + resolution: {integrity: sha512-wp+ZdvQyov404xynNcjbXoJyeGM28W/aCwMmry/rJ+Y0SsObukJYkWwuxWGbNpIjeqMaEbNUtXPNtPPfI5cTFA==} + hasBin: true + + tough-cookie@6.1.0: + resolution: {integrity: sha512-FTxc8u8Kl2tz0Lat1u8ksvcy8bwHRyEMawwTWybo51JqaC6O7SvfuhAKg+Ld6VqyIe2QRJBzY9HA7y2WyFRT2w==} + engines: {node: '>=16'} + + tr46@6.0.0: + resolution: {integrity: sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==} + engines: {node: '>=20'} + + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@7.24.6: + resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==} + + undici-types@8.14.0: + resolution: {integrity: sha512-adaTpowOLjSeKhwA1+gEN/F8Bw/wmKH7Csw+01zmDB1TAYJ+COEn/Cfb9RXSUdssbZOdPBRvI6wOubXyzbiotQ==} + + vite@8.4.1: + resolution: {integrity: sha512-2bl8n3+GkKBKQQR8CZC+t+3NvjWCBNh9S0Dbfu7hr7+Jjeg71jcZk7uKF6mo8GZXjIws+Nl6jhvAfHUO320VuQ==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + '@types/node': ^20.19.0 || >=22.12.0 + '@vitejs/devtools': ^0.7.1 || ^0.8.0 + esbuild: ^0.27.0 || ^0.28.0 + jiti: '>=1.21.0' + less: ^4.0.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: '>=0.54.8' + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + '@types/node': + optional: true + '@vitejs/devtools': + optional: true + esbuild: + optional: true + jiti: + optional: true + less: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + + vitest@4.1.12: + resolution: {integrity: sha512-5eWdz2yb3ajxWF3C8C4TjkXl7FGm3n2E/VlazALrQHzK7nYMSGFnCZto0bbPNl77AwkOZVLk0YnBAejUu0NiWA==} + engines: {node: ^20.0.0 || ^22.0.0 || >=24.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@opentelemetry/api': ^1.9.0 + '@types/node': ^20.0.0 || ^22.0.0 || >=24.0.0 + '@vitest/browser-playwright': 4.1.12 + '@vitest/browser-preview': 4.1.12 + '@vitest/browser-webdriverio': ^4.1.11 + '@vitest/coverage-istanbul': 4.1.12 + '@vitest/coverage-v8': 4.1.12 + '@vitest/ui': 4.1.12 + happy-dom: '*' + jsdom: '*' + vite: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@opentelemetry/api': + optional: true + '@types/node': + optional: true + '@vitest/browser-playwright': + optional: true + '@vitest/browser-preview': + optional: true + '@vitest/browser-webdriverio': + optional: true + '@vitest/coverage-istanbul': + optional: true + '@vitest/coverage-v8': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + + w3c-xmlserializer@5.0.0: + resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==} + engines: {node: '>=18'} + + webidl-conversions@8.0.1: + resolution: {integrity: sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==} + engines: {node: '>=20'} + + whatwg-mimetype@4.0.0: + resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==} + engines: {node: '>=18'} + + whatwg-mimetype@5.0.0: + resolution: {integrity: sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==} + engines: {node: '>=20'} + + whatwg-url@15.1.0: + resolution: {integrity: sha512-2ytDk0kiEj/yu90JOAp44PVPUkO9+jVhyf+SybKlRHSDlvOOZhdPIrr7xTH64l4WixO2cP+wQIcgujkGBPPz6g==} + engines: {node: '>=20'} + + why-is-node-running@2.3.0: + resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} + engines: {node: '>=8'} + hasBin: true + + ws@8.23.1: + resolution: {integrity: sha512-1rzWDSN0NOi3tpwgHsQExjWRoKUGtjCkJ2gZRaaRtzhYLboMytOI9pj9PU7yCgY37auqdd4OyLofZDbkeuZmPA==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + xml-name-validator@5.0.0: + resolution: {integrity: sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==} + engines: {node: '>=18'} + + xmlchars@2.2.0: + resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} + +snapshots: + + '@acemir/cssom@0.9.33': {} + + '@asamuzakjp/css-color@4.1.2': + dependencies: + '@csstools/css-calc': 3.4.4(@csstools/css-parser-algorithms@4.0.3(@csstools/css-tokenizer@4.0.3))(@csstools/css-tokenizer@4.0.3) + '@csstools/css-color-parser': 4.2.8(@csstools/css-parser-algorithms@4.0.3(@csstools/css-tokenizer@4.0.3))(@csstools/css-tokenizer@4.0.3) + '@csstools/css-parser-algorithms': 4.0.3(@csstools/css-tokenizer@4.0.3) + '@csstools/css-tokenizer': 4.0.3 + lru-cache: 11.5.4 + + '@asamuzakjp/dom-selector@6.8.1': + dependencies: + '@asamuzakjp/nwsapi': 2.3.9 + bidi-js: 1.1.0 + css-tree: 3.2.1 + is-potential-custom-element-name: 1.0.1 + lru-cache: 11.5.4 + + '@asamuzakjp/nwsapi@2.3.9': {} + + '@csstools/color-helpers@6.1.3': {} + + '@csstools/css-calc@3.4.4(@csstools/css-parser-algorithms@4.0.3(@csstools/css-tokenizer@4.0.3))(@csstools/css-tokenizer@4.0.3)': + dependencies: + '@csstools/css-parser-algorithms': 4.0.3(@csstools/css-tokenizer@4.0.3) + '@csstools/css-tokenizer': 4.0.3 + + '@csstools/css-color-parser@4.2.8(@csstools/css-parser-algorithms@4.0.3(@csstools/css-tokenizer@4.0.3))(@csstools/css-tokenizer@4.0.3)': + dependencies: + '@csstools/color-helpers': 6.1.3 + '@csstools/css-calc': 3.4.4(@csstools/css-parser-algorithms@4.0.3(@csstools/css-tokenizer@4.0.3))(@csstools/css-tokenizer@4.0.3) + '@csstools/css-parser-algorithms': 4.0.3(@csstools/css-tokenizer@4.0.3) + '@csstools/css-tokenizer': 4.0.3 + + '@csstools/css-parser-algorithms@4.0.3(@csstools/css-tokenizer@4.0.3)': + dependencies: + '@csstools/css-tokenizer': 4.0.3 + + '@csstools/css-syntax-patches-for-csstree@1.1.17(css-tree@3.2.1)': + optionalDependencies: + css-tree: 3.2.1 + + '@csstools/css-tokenizer@4.0.3': {} + + '@esbuild/aix-ppc64@0.28.2': + optional: true + + '@esbuild/android-arm64@0.28.2': + optional: true + + '@esbuild/android-arm@0.28.2': + optional: true + + '@esbuild/android-x64@0.28.2': + optional: true + + '@esbuild/darwin-arm64@0.28.2': + optional: true + + '@esbuild/darwin-x64@0.28.2': + optional: true + + '@esbuild/freebsd-arm64@0.28.2': + optional: true + + '@esbuild/freebsd-x64@0.28.2': + optional: true + + '@esbuild/linux-arm64@0.28.2': + optional: true + + '@esbuild/linux-arm@0.28.2': + optional: true + + '@esbuild/linux-ia32@0.28.2': + optional: true + + '@esbuild/linux-loong64@0.28.2': + optional: true + + '@esbuild/linux-mips64el@0.28.2': + optional: true + + '@esbuild/linux-ppc64@0.28.2': + optional: true + + '@esbuild/linux-riscv64@0.28.2': + optional: true + + '@esbuild/linux-s390x@0.28.2': + optional: true + + '@esbuild/linux-x64@0.28.2': + optional: true + + '@esbuild/netbsd-arm64@0.28.2': + optional: true + + '@esbuild/netbsd-x64@0.28.2': + optional: true + + '@esbuild/openbsd-arm64@0.28.2': + optional: true + + '@esbuild/openbsd-x64@0.28.2': + optional: true + + '@esbuild/openharmony-arm64@0.28.2': + optional: true + + '@esbuild/sunos-x64@0.28.2': + optional: true + + '@esbuild/win32-arm64@0.28.2': + optional: true + + '@esbuild/win32-ia32@0.28.2': + optional: true + + '@esbuild/win32-x64@0.28.2': + optional: true + + '@exodus/bytes@1.16.0': {} + + '@jridgewell/sourcemap-codec@1.6.0': {} + + '@oxc-project/types@0.160.0': {} + + '@rolldown/binding-android-arm-eabi@1.3.4': + optional: true + + '@rolldown/binding-android-arm64@1.3.4': + optional: true + + '@rolldown/binding-darwin-arm64@1.3.4': + optional: true + + '@rolldown/binding-darwin-x64@1.3.4': + optional: true + + '@rolldown/binding-freebsd-x64@1.3.4': + optional: true + + '@rolldown/binding-linux-arm-gnueabihf@1.3.4': + optional: true + + '@rolldown/binding-linux-arm64-gnu@1.3.4': + optional: true + + '@rolldown/binding-linux-arm64-musl@1.3.4': + optional: true + + '@rolldown/binding-linux-ppc64-gnu@1.3.4': + optional: true + + '@rolldown/binding-linux-s390x-gnu@1.3.4': + optional: true + + '@rolldown/binding-linux-x64-gnu@1.3.4': + optional: true + + '@rolldown/binding-linux-x64-musl@1.3.4': + optional: true + + '@rolldown/binding-openharmony-arm64@1.3.4': + optional: true + + '@rolldown/binding-wasm32-wasi@1.3.4': + dependencies: + '@oxc-project/types': 0.160.0 + optional: true + + '@rolldown/binding-win32-arm64-msvc@1.3.4': + optional: true + + '@rolldown/binding-win32-x64-msvc@1.3.4': + optional: true + + '@rolldown/pluginutils@1.1.1': {} + + '@standard-schema/spec@1.1.0': {} + + '@types/chai@5.2.3': + dependencies: + '@types/deep-eql': 4.0.2 + assertion-error: 2.0.1 + + '@types/deep-eql@4.0.2': {} + + '@types/estree@1.0.11': {} + + '@types/jsdom@30.0.0': + dependencies: + '@types/node': 24.19.4 + '@types/tough-cookie': 4.0.5 + parse5: 8.1.1 + undici-types: 8.14.0 + + '@types/node@24.19.4': + dependencies: + undici-types: 7.24.6 + + '@types/tough-cookie@4.0.5': {} + + '@vitest/expect@4.1.12': + dependencies: + '@standard-schema/spec': 1.1.0 + '@types/chai': 5.2.3 + '@vitest/spy': 4.1.12 + '@vitest/utils': 4.1.12 + chai: 6.3.0 + tinyrainbow: 3.2.0 + + '@vitest/mocker@4.1.12(vite@8.4.1(@types/node@24.19.4)(esbuild@0.28.2))': + dependencies: + '@vitest/spy': 4.1.12 + estree-walker: 3.0.3 + magic-string: 0.30.21 + optionalDependencies: + vite: 8.4.1(@types/node@24.19.4)(esbuild@0.28.2) + + '@vitest/pretty-format@4.1.12': + dependencies: + tinyrainbow: 3.2.0 + + '@vitest/runner@4.1.12': + dependencies: + '@vitest/utils': 4.1.12 + pathe: 2.0.3 + + '@vitest/snapshot@4.1.12': + dependencies: + '@vitest/pretty-format': 4.1.12 + '@vitest/utils': 4.1.12 + magic-string: 0.30.21 + pathe: 2.0.3 + + '@vitest/spy@4.1.12': {} + + '@vitest/utils@4.1.12': + dependencies: + '@vitest/pretty-format': 4.1.12 + convert-source-map: 2.0.0 + tinyrainbow: 3.2.0 + + acorn@8.19.0: {} + + agent-base@7.1.4: {} + + assertion-error@2.0.1: {} + + bidi-js@1.1.0: + dependencies: + require-from-string: 2.0.2 + + chai@6.3.0: {} + + convert-source-map@2.0.0: {} + + css-tree@3.2.1: + dependencies: + mdn-data: 2.27.1 + source-map-js: 1.3.0 + + cssstyle@5.3.7: + dependencies: + '@asamuzakjp/css-color': 4.1.2 + '@csstools/css-syntax-patches-for-csstree': 1.1.17(css-tree@3.2.1) + css-tree: 3.2.1 + lru-cache: 11.5.4 + + data-urls@6.0.1: + dependencies: + whatwg-mimetype: 5.0.0 + whatwg-url: 15.1.0 + + debug@4.4.3: + dependencies: + ms: 2.1.3 + + decimal.js@10.6.0: {} + + detect-libc@2.1.2: {} + + entities@9.0.0: {} + + es-module-lexer@2.3.2: {} + + esbuild@0.28.2: + optionalDependencies: + '@esbuild/aix-ppc64': 0.28.2 + '@esbuild/android-arm': 0.28.2 + '@esbuild/android-arm64': 0.28.2 + '@esbuild/android-x64': 0.28.2 + '@esbuild/darwin-arm64': 0.28.2 + '@esbuild/darwin-x64': 0.28.2 + '@esbuild/freebsd-arm64': 0.28.2 + '@esbuild/freebsd-x64': 0.28.2 + '@esbuild/linux-arm': 0.28.2 + '@esbuild/linux-arm64': 0.28.2 + '@esbuild/linux-ia32': 0.28.2 + '@esbuild/linux-loong64': 0.28.2 + '@esbuild/linux-mips64el': 0.28.2 + '@esbuild/linux-ppc64': 0.28.2 + '@esbuild/linux-riscv64': 0.28.2 + '@esbuild/linux-s390x': 0.28.2 + '@esbuild/linux-x64': 0.28.2 + '@esbuild/netbsd-arm64': 0.28.2 + '@esbuild/netbsd-x64': 0.28.2 + '@esbuild/openbsd-arm64': 0.28.2 + '@esbuild/openbsd-x64': 0.28.2 + '@esbuild/openharmony-arm64': 0.28.2 + '@esbuild/sunos-x64': 0.28.2 + '@esbuild/win32-arm64': 0.28.2 + '@esbuild/win32-ia32': 0.28.2 + '@esbuild/win32-x64': 0.28.2 + + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.11 + + expect-type@1.4.0: {} + + fdir@6.5.0(picomatch@4.0.7): + optionalDependencies: + picomatch: 4.0.7 + + fsevents@2.3.3: + optional: true + + html-encoding-sniffer@6.0.0: + dependencies: + '@exodus/bytes': 1.16.0 + transitivePeerDependencies: + - '@noble/hashes' + + http-proxy-agent@7.0.2: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + https-proxy-agent@7.0.6: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + is-potential-custom-element-name@1.0.1: {} + + jsdom@27.4.0: + dependencies: + '@acemir/cssom': 0.9.33 + '@asamuzakjp/dom-selector': 6.8.1 + '@exodus/bytes': 1.16.0 + cssstyle: 5.3.7 + data-urls: 6.0.1 + decimal.js: 10.6.0 + html-encoding-sniffer: 6.0.0 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 + is-potential-custom-element-name: 1.0.1 + parse5: 8.1.1 + saxes: 6.0.0 + symbol-tree: 3.2.4 + tough-cookie: 6.1.0 + w3c-xmlserializer: 5.0.0 + webidl-conversions: 8.0.1 + whatwg-mimetype: 4.0.0 + whatwg-url: 15.1.0 + ws: 8.23.1 + xml-name-validator: 5.0.0 + transitivePeerDependencies: + - '@noble/hashes' + - bufferutil + - supports-color + - utf-8-validate + + lightningcss-android-arm64@1.33.0: + optional: true + + lightningcss-darwin-arm64@1.33.0: + optional: true + + lightningcss-darwin-x64@1.33.0: + optional: true + + lightningcss-freebsd-x64@1.33.0: + optional: true + + lightningcss-linux-arm-gnueabihf@1.33.0: + optional: true + + lightningcss-linux-arm64-gnu@1.33.0: + optional: true + + lightningcss-linux-arm64-musl@1.33.0: + optional: true + + lightningcss-linux-x64-gnu@1.33.0: + optional: true + + lightningcss-linux-x64-musl@1.33.0: + optional: true + + lightningcss-win32-arm64-msvc@1.33.0: + optional: true + + lightningcss-win32-x64-msvc@1.33.0: + optional: true + + lightningcss@1.33.0: + dependencies: + detect-libc: 2.1.2 + optionalDependencies: + lightningcss-android-arm64: 1.33.0 + lightningcss-darwin-arm64: 1.33.0 + lightningcss-darwin-x64: 1.33.0 + lightningcss-freebsd-x64: 1.33.0 + lightningcss-linux-arm-gnueabihf: 1.33.0 + lightningcss-linux-arm64-gnu: 1.33.0 + lightningcss-linux-arm64-musl: 1.33.0 + lightningcss-linux-x64-gnu: 1.33.0 + lightningcss-linux-x64-musl: 1.33.0 + lightningcss-win32-arm64-msvc: 1.33.0 + lightningcss-win32-x64-msvc: 1.33.0 + + lru-cache@11.5.4: {} + + magic-string@0.30.21: + dependencies: + '@jridgewell/sourcemap-codec': 1.6.0 + + mdn-data@2.27.1: {} + + ms@2.1.3: {} + + nanoid@3.3.20: {} + + napi-windows-process-start-time@0.1.0: + optional: true + + obug@2.2.1: {} + + parse5@8.1.1: + dependencies: + entities: 9.0.0 + + pathe@2.0.3: {} + + picocolors@1.1.1: {} + + picomatch@4.0.7: {} + + postcss@8.5.34: + dependencies: + nanoid: 3.3.20 + picocolors: 1.1.1 + source-map-js: 1.3.0 + + punycode@2.3.1: {} + + require-from-string@2.0.2: {} + + rolldown@1.3.4: + dependencies: + '@oxc-project/types': 0.160.0 + '@rolldown/pluginutils': 1.1.1 + optionalDependencies: + '@rolldown/binding-android-arm-eabi': 1.3.4 + '@rolldown/binding-android-arm64': 1.3.4 + '@rolldown/binding-darwin-arm64': 1.3.4 + '@rolldown/binding-darwin-x64': 1.3.4 + '@rolldown/binding-freebsd-x64': 1.3.4 + '@rolldown/binding-linux-arm-gnueabihf': 1.3.4 + '@rolldown/binding-linux-arm64-gnu': 1.3.4 + '@rolldown/binding-linux-arm64-musl': 1.3.4 + '@rolldown/binding-linux-ppc64-gnu': 1.3.4 + '@rolldown/binding-linux-s390x-gnu': 1.3.4 + '@rolldown/binding-linux-x64-gnu': 1.3.4 + '@rolldown/binding-linux-x64-musl': 1.3.4 + '@rolldown/binding-openharmony-arm64': 1.3.4 + '@rolldown/binding-wasm32-wasi': 1.3.4 + '@rolldown/binding-win32-arm64-msvc': 1.3.4 + '@rolldown/binding-win32-x64-msvc': 1.3.4 + + saxes@6.0.0: + dependencies: + xmlchars: 2.2.0 + + siginfo@2.0.0: {} + + source-map-js@1.3.0: {} + + stackback@0.0.2: {} + + std-env@4.3.0: {} + + symbol-tree@3.2.4: {} + + tinybench@2.9.0: {} + + tinyexec@1.4.0: {} + + tinyglobby@0.2.17: + dependencies: + fdir: 6.5.0(picomatch@4.0.7) + picomatch: 4.0.7 + + tinyrainbow@3.2.0: {} + + tldts-core@7.6.4: {} + + tldts@7.6.4: + dependencies: + tldts-core: 7.6.4 + + tough-cookie@6.1.0: + dependencies: + tldts: 7.6.4 + + tr46@6.0.0: + dependencies: + punycode: 2.3.1 + + typescript@5.9.3: {} + + undici-types@7.24.6: {} + + undici-types@8.14.0: {} + + vite@8.4.1(@types/node@24.19.4)(esbuild@0.28.2): + dependencies: + lightningcss: 1.33.0 + picomatch: 4.0.7 + postcss: 8.5.34 + rolldown: 1.3.4 + tinyglobby: 0.2.17 + optionalDependencies: + '@types/node': 24.19.4 + esbuild: 0.28.2 + fsevents: 2.3.3 + napi-windows-process-start-time: 0.1.0 + + vitest@4.1.12(@types/node@24.19.4)(jsdom@27.4.0)(vite@8.4.1(@types/node@24.19.4)(esbuild@0.28.2)): + dependencies: + '@vitest/expect': 4.1.12 + '@vitest/mocker': 4.1.12(vite@8.4.1(@types/node@24.19.4)(esbuild@0.28.2)) + '@vitest/pretty-format': 4.1.12 + '@vitest/runner': 4.1.12 + '@vitest/snapshot': 4.1.12 + '@vitest/spy': 4.1.12 + '@vitest/utils': 4.1.12 + es-module-lexer: 2.3.2 + expect-type: 1.4.0 + magic-string: 0.30.21 + obug: 2.2.1 + pathe: 2.0.3 + picomatch: 4.0.7 + std-env: 4.3.0 + tinybench: 2.9.0 + tinyexec: 1.4.0 + tinyglobby: 0.2.17 + tinyrainbow: 3.2.0 + vite: 8.4.1(@types/node@24.19.4)(esbuild@0.28.2) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 24.19.4 + jsdom: 27.4.0 + transitivePeerDependencies: + - msw + + w3c-xmlserializer@5.0.0: + dependencies: + xml-name-validator: 5.0.0 + + webidl-conversions@8.0.1: {} + + whatwg-mimetype@4.0.0: {} + + whatwg-mimetype@5.0.0: {} + + whatwg-url@15.1.0: + dependencies: + tr46: 6.0.0 + webidl-conversions: 8.0.1 + + why-is-node-running@2.3.0: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + + ws@8.23.1: {} + + xml-name-validator@5.0.0: {} + + xmlchars@2.2.0: {} diff --git a/clients/gallery/js/scripts/iife.mjs b/clients/gallery/js/scripts/iife.mjs new file mode 100644 index 00000000..48204498 --- /dev/null +++ b/clients/gallery/js/scripts/iife.mjs @@ -0,0 +1,27 @@ +// dist/gallery.iife.js: the whole library in one ES5 file that sets window.VisualCIGallery, for sites without a +// bundler (DocSpring's Sprockets pages, where old Safari still has visitors). esbuild bundles it, TypeScript lowers it +// to ES5, and acorn checks that nothing newer than ES5 is left. +import { build } from "esbuild"; +import { parse } from "acorn"; +import ts from "typescript"; +import { writeFileSync } from "node:fs"; + +const bundled = await build({ + entryPoints: ["src/index.ts"], + bundle: true, + format: "iife", + globalName: "VisualCIGallery", + target: "es2017", + write: false, +}); +const { outputText } = ts.transpileModule(bundled.outputFiles[0].text, { + compilerOptions: { target: ts.ScriptTarget.ES5, allowJs: true, downlevelIteration: true, removeComments: false }, +}); +// One function around it all, so TypeScript's helpers stay out of the page's globals and its "use strict" stays out +// of whatever a site concatenates it with; the library is set on window by name. +const code = + "/*! @visualci/gallery | Apache-2.0 | https://visualci.com/docs/gallery/ */\n" + + `(function () {\n${outputText}\nwindow.VisualCIGallery = VisualCIGallery;\n})();\n`; +parse(code, { ecmaVersion: 5 }); +writeFileSync("dist/gallery.iife.js", code); +console.log(`dist/gallery.iife.js: ${code.length} bytes, ES5`); diff --git a/clients/gallery/js/src/gallery.css b/clients/gallery/js/src/gallery.css new file mode 100644 index 00000000..5119a806 --- /dev/null +++ b/clients/gallery/js/src/gallery.css @@ -0,0 +1,355 @@ +/* @visualci/gallery's default look. Each site keeps its own through the --vg-* variables: set them on .vg (or any + * ancestor) to the site's colours, radii and type. The defaults follow the text colour and the page's color-scheme. + * + * Each card holds every variant of its screen; only the chosen theme and size show (hidden lazy images never load). + * Before the script runs, the theme follows the reader's setting. */ +.vg { + --vg-ink: currentColor; + --vg-ink-2: currentColor; + --vg-muted: color-mix(in srgb, currentColor 65%, transparent); + --vg-paper: Canvas; + --vg-paper-2: color-mix(in srgb, currentColor 5%, Canvas); + --vg-rule: color-mix(in srgb, currentColor 16%, transparent); + --vg-accent: LinkText; + --vg-radius-sm: 4px; + --vg-radius-md: 8px; + --vg-radius-lg: 12px; + --vg-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 8px 24px rgb(0 0 0 / 0.08); + --vg-backdrop: rgb(0 0 0 / 0.6); + --vg-rule-width: 1px; + --vg-gap: 1.5rem; + --vg-card-min: 22rem; + --vg-phone-card-min: 9.5rem; + --vg-desktop-ratio: 1440 / 900; + --vg-phone-ratio: 390 / 844; + --vg-title-size: 2rem; + --vg-group-title-size: 1.5rem; + --vg-card-title-size: 1.125rem; + --vg-small: 0.875rem; + --vg-duration: 150ms; + --vg-ease: cubic-bezier(0.2, 0.8, 0.2, 1); + display: block; + min-width: 0; +} +.vg *, +.vg *::before, +.vg *::after { + box-sizing: border-box; +} +.vg :where(h1, h2, h3, h4, h5, h6, p, ul) { + margin: 0; +} + +.vg-title { + font-size: var(--vg-title-size); + font-weight: 650; + margin-bottom: calc(var(--vg-gap) * 1.33); +} + +.vg-tabs { + display: flex; + flex-wrap: wrap; + gap: 0.25rem; + border-bottom: var(--vg-rule-width) solid var(--vg-rule); + margin-bottom: calc(var(--vg-gap) * 1.33); +} +.vg-tabs [role="tab"] { + font: inherit; + font-weight: 600; + color: var(--vg-muted); + background: none; + border: 0; + border-bottom: 2px solid transparent; + padding: 0.5rem 1rem; + margin-bottom: calc(-1 * var(--vg-rule-width)); + cursor: pointer; +} +.vg-tabs [role="tab"]:hover { + color: var(--vg-ink); +} +.vg-tabs [role="tab"][aria-selected="true"] { + color: var(--vg-ink); + border-bottom-color: var(--vg-accent); +} + +.vg-bar, +.vg-box-bar { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: 0.75rem 1.5rem; +} +.vg-bar { + margin-bottom: calc(var(--vg-gap) * 1.33); +} +.vg-group-title { + font-size: var(--vg-group-title-size); + font-weight: 600; +} +.vg-controls { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.5rem; +} +.vg-seg { + display: inline-flex; + padding: 2px; + border: var(--vg-rule-width) solid var(--vg-rule); + border-radius: 999px; + background: var(--vg-paper-2); +} +.vg-seg[hidden], +.vg-seg button[hidden] { + display: none; +} +.vg-seg button, +.vg-icon { + font: inherit; + font-size: var(--vg-small); + font-weight: 500; + color: var(--vg-ink-2); + background: none; + border: 0; + border-radius: 999px; + padding: 0.25rem 1rem; + cursor: pointer; + min-height: 2.25rem; +} +.vg-seg button[aria-pressed="true"] { + background: var(--vg-paper); + color: var(--vg-ink); + box-shadow: 0 0 0 var(--vg-rule-width) var(--vg-rule); +} +.vg-icon { + font-size: 1.25rem; + line-height: 1; + min-width: 2.25rem; + padding: 0; + border: var(--vg-rule-width) solid var(--vg-rule); +} +.vg-seg button:focus-visible, +.vg-icon:focus-visible, +.vg-thumb:focus-visible, +.vg-tabs [role="tab"]:focus-visible, +.vg-credit a:focus-visible, +.vg-see-all a:focus-visible { + outline: 2px solid var(--vg-accent); + outline-offset: 2px; +} + +.vg-grid { + list-style: none; + padding: 0; + display: grid; + gap: calc(var(--vg-gap) * 1.33) var(--vg-gap); + grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--vg-card-min)), 1fr)); +} +.vg[data-size="phone"] .vg-grid { + grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--vg-phone-card-min)), 1fr)); + gap: var(--vg-gap) calc(var(--vg-gap) * 0.67); +} +.vg-card { + min-width: 0; +} +.vg-thumb { + display: block; + color: inherit; + text-decoration: none; + width: 100%; + padding: 0; + border: var(--vg-rule-width) solid var(--vg-rule); + border-radius: var(--vg-radius-md); + background: var(--vg-paper-2); + overflow: hidden; + cursor: zoom-in; + aspect-ratio: var(--vg-desktop-ratio); + box-shadow: var(--vg-shadow); + transition: transform var(--vg-duration) var(--vg-ease); +} +.vg[data-size="phone"] .vg-thumb { + aspect-ratio: var(--vg-phone-ratio); +} +.vg-thumb:hover { + transform: translateY(-2px); +} +.vg-card-title { + margin-top: 0.75rem; + font-size: var(--vg-card-title-size); + font-weight: 600; + color: var(--vg-ink); +} +.vg-caption { + margin-top: 0.25rem; + font-size: var(--vg-small); + color: var(--vg-muted); +} +.vg[data-size="phone"] .vg-caption { + display: none; +} + +/* Which variant shows. */ +.vg-img { + display: none; + width: 100%; + height: 100%; + object-fit: cover; + object-position: top; +} +.vg-missing { + place-items: center; + padding: 1rem; + font-size: var(--vg-small); + color: var(--vg-muted); + text-align: center; +} +/* A screen with no shot at this size isn't shown at it. */ +.vg[data-size="desktop"] .vg-card:not([data-sizes~="desktop"]), +.vg[data-size="phone"] .vg-card:not([data-sizes~="phone"]) { + display: none; +} +.vg[data-size="desktop"] .vg-img[data-size="desktop"], +.vg[data-size="phone"] .vg-img[data-size="phone"] { + display: block; +} +.vg[data-size="desktop"] .vg-missing[data-size="desktop"], +.vg[data-size="phone"] .vg-missing[data-size="phone"] { + display: grid; +} +.vg[data-theme="light"] .vg-img:not([data-theme~="light"]), +.vg[data-theme="dark"] .vg-img:not([data-theme~="dark"]) { + display: none; +} +@media not (prefers-color-scheme: dark) { + .vg:not([data-theme]) .vg-img:not([data-theme~="light"]) { + display: none; + } +} +@media (prefers-color-scheme: dark) { + .vg:not([data-theme]) .vg-img:not([data-theme~="dark"]) { + display: none; + } +} + +/* The strip: one row that scrolls sideways, snapping to each card, with a button at each end. */ +.vg-strip { + position: relative; +} +.vg-track { + display: grid; + grid-auto-flow: column; + grid-auto-columns: var(--vg-strip-card, min(22.5rem, 80%)); + grid-template-columns: none; + overflow-x: auto; + overscroll-behavior-x: contain; + scroll-snap-type: x mandatory; + scroll-padding-inline: 0.25rem; + padding: 0.25rem 0.25rem 0.75rem; + scrollbar-width: thin; +} +.vg[data-size="phone"] .vg-track { + grid-auto-columns: var(--vg-strip-phone-card, min(11rem, 45%)); + grid-template-columns: none; +} +.vg-track .vg-card { + scroll-snap-align: start; +} +.vg-strip .vg-icon { + position: absolute; + top: calc(50% - 1.5rem); + z-index: 1; + background: var(--vg-paper); + box-shadow: var(--vg-shadow); +} +.vg-strip-prev { + left: -0.75rem; +} +.vg-strip-next { + right: -0.75rem; +} +.vg-strip .vg-icon:disabled { + opacity: 0; + pointer-events: none; +} +.vg-see-all { + margin-top: 1rem; + text-align: center; +} +.vg-see-all a { + color: var(--vg-accent); + font-weight: 500; +} + +.vg-credit { + margin-top: calc(var(--vg-gap) * 2); + font-size: var(--vg-small); + color: var(--vg-muted); + text-align: center; +} +.vg-credit a { + color: inherit; +} + +.vg-error { + margin: 2rem 0; + color: var(--vg-muted); + text-align: center; +} + +/* The full-size view: the screen's whole image, scrolled inside the dialog. */ +.vg-box { + width: min(100vw - 2rem, 92rem); + max-width: none; + max-height: calc(100dvh - 2rem); + padding: 0; + border: var(--vg-rule-width) solid var(--vg-rule); + border-radius: var(--vg-radius-lg); + background: var(--vg-paper); + color: var(--vg-ink-2); + box-shadow: var(--vg-shadow); +} +.vg-box[open] { + display: flex; + flex-direction: column; +} +.vg-box::backdrop { + background: var(--vg-backdrop); +} +.vg-box-bar { + padding: 0.75rem 1rem; + border-bottom: var(--vg-rule-width) solid var(--vg-rule); +} +.vg-box-title { + font-size: 1.25rem; + font-weight: 600; + color: var(--vg-ink); +} +.vg-box-view { + overflow: auto; + padding: 1rem; + background: var(--vg-paper-2); + min-height: 0; + flex: 1; +} +.vg-box-view img { + display: block; + margin: 0 auto; + max-width: 100%; + height: auto; + border-radius: var(--vg-radius-sm); + border: var(--vg-rule-width) solid var(--vg-rule); +} +.vg-box-view[data-size="phone"] img { + max-width: min(100%, 390px); +} +.vg-box-view .vg-missing { + display: grid; + min-height: 12rem; +} + +@media (prefers-reduced-motion: reduce) { + .vg-thumb { + transition: none; + } +} diff --git a/clients/gallery/js/src/hydrate.ts b/clients/gallery/js/src/hydrate.ts new file mode 100644 index 00000000..802b77eb --- /dev/null +++ b/clients/gallery/js/src/hydrate.ts @@ -0,0 +1,281 @@ +// Brings the contract's markup to life (contract/SPEC.md, "Behaviour"): one theme and one size for the whole gallery +// and its full-size view, tabs, the strip's scroll buttons, and the full-size view itself, a native with +// previous and next. It reads only the markup, so it works the same on HTML a server rendered and on HTML mount() +// rendered. Without (Safari before 15.4) each card stays a link to its image. + +import type { Size, Theme } from "./model.js"; + +export interface Gallery { + /** The gallery's element (the contract's `section.vg`). */ + root: HTMLElement; + setTheme(theme: Theme): void; + setSize(size: Size): void; + /** Opens the full-size view of a screen by its key. */ + open(key: string): void; + close(): void; + /** Removes the listeners hydrate() added. */ + destroy(): void; +} + +const hydrated = new WeakMap(); + +function pageTheme(): Theme { + const set = document.documentElement.getAttribute("data-theme"); + if (set === "light" || set === "dark") return set; + return matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; +} + +function canOpen(): boolean { + return typeof HTMLDialogElement === "function" && typeof HTMLDialogElement.prototype.showModal === "function"; +} + +function reducedMotion(): boolean { + return matchMedia("(prefers-reduced-motion: reduce)").matches; +} + +/** An image that can't load shows its description instead, in the same place. */ +function watch(img: HTMLImageElement) { + const fail = () => { + const span = document.createElement("span"); + span.className = "vg-img vg-missing"; + span.setAttribute("data-size", img.getAttribute("data-size") ?? ""); + span.setAttribute("data-theme", img.getAttribute("data-theme") ?? ""); + span.textContent = img.alt; + img.replaceWith(span); + }; + if (img.complete && img.getAttribute("src") && img.naturalWidth === 0) fail(); + else img.addEventListener("error", fail, { once: true }); +} + +const listOf = (value: string | null | undefined) => (value ?? "").split(" ").filter(Boolean); + +/** Hydrates a gallery's markup: `el` is the contract's `section.vg`, or an element holding one. Hydrating twice + * returns the first. */ +export function hydrate(el: HTMLElement): Gallery { + const found = el.matches("[data-vg]") ? el : el.querySelector("[data-vg]"); + if (!found) throw new Error("hydrate: no gallery markup ([data-vg]) in this element"); + const root: HTMLElement = found; + const existing = hydrated.get(root); + if (existing) return existing; + + const box = root.querySelector(".vg-box")!; + const view = box.querySelector(".vg-box-view")!; + const boxTitle = box.querySelector(".vg-box-title")!; + const all = (selector: string) => Array.prototype.slice.call(root.querySelectorAll(selector)) as HTMLElement[]; + const tabs = all('[role="tab"]') as HTMLButtonElement[]; + const track = root.querySelector(".vg-track"); + const followsPage = root.getAttribute("data-vg-theme-source") === "page"; + let current: HTMLElement | null = null; + let opener: HTMLElement | null = null; + + const panel = () => root.querySelector(".vg-panel:not([hidden])"); + const panelOf = (t: HTMLButtonElement) => all(".vg-panel").find((p) => p.id === t.getAttribute("aria-controls")) ?? null; + const cardOf = (key: string, within: HTMLElement) => + (Array.prototype.slice.call(within.querySelectorAll("[data-vg-screen]")) as HTMLElement[]).find( + (c) => c.getAttribute("data-vg-screen") === key, + ) ?? null; + /** The card's image for the gallery's theme and size. */ + const shownIn = (card: HTMLElement) => + card.querySelector( + `.vg-img[data-size="${root.getAttribute("data-size")}"][data-theme~="${root.getAttribute("data-theme")}"]`, + ); + + function sync() { + // Each card links to the image it shows, so a middle click or a browser without opens that one. + for (const card of all(".vg-card")) { + const src = shownIn(card)?.getAttribute("src"); + const link = card.querySelector("a.vg-thumb"); + if (link && src) link.setAttribute("href", src); + } + if (box.open && current) show(current); + } + + function set(key: "theme" | "size", value: string) { + root.setAttribute(`data-${key}`, value); + for (const b of all(`[data-vg-${key}]`)) { + b.setAttribute("aria-pressed", String(b.getAttribute(`data-vg-${key}`) === value)); + } + sync(); + } + + // The size the reader chose (phone to begin with on a narrow screen). A tab without it shows the size it has, + // without changing the choice, so the next tab is back at the chosen size. + let chosen: Size = matchMedia("(max-width: 47.99rem)").matches ? "phone" : "desktop"; + function fit() { + const sizes = listOf(panel()?.getAttribute("data-sizes")) as Size[]; + set("size", sizes.length === 0 || sizes.indexOf(chosen) !== -1 ? chosen : sizes[0]); + } + + function select(tab: HTMLButtonElement, focus = false) { + for (const t of tabs) { + const on = t === tab; + t.setAttribute("aria-selected", String(on)); + t.tabIndex = on ? 0 : -1; + const p = panelOf(t); + if (p) p.hidden = !on; + } + if (focus) tab.focus(); + fit(); + } + + function cards(): HTMLElement[] { + const size = root.getAttribute("data-size") ?? ""; + return all(".vg-panel:not([hidden]) .vg-card").filter((c) => listOf(c.getAttribute("data-sizes")).indexOf(size) !== -1); + } + + function show(card: HTMLElement) { + current = card; + boxTitle.textContent = card.querySelector(".vg-card-title")?.textContent ?? ""; + const sizes = listOf(card.closest(".vg-panel")?.getAttribute("data-sizes")); + const boxSizes = box.querySelector(".vg-box-sizes"); + if (boxSizes) { + boxSizes.hidden = sizes.length < 2; + for (const b of Array.prototype.slice.call(boxSizes.querySelectorAll("[data-vg-size]")) as HTMLElement[]) { + b.hidden = sizes.indexOf(b.getAttribute("data-vg-size") ?? "") === -1; + } + } + const shown = shownIn(card); + view.setAttribute("data-size", root.getAttribute("data-size") ?? ""); + // A new element each time: reusing one keeps the previous picture on screen until the new one loads. + view.replaceChildren(); + if (shown instanceof HTMLImageElement) { + const big = document.createElement("img"); + const src = shown.getAttribute("src") ?? ""; + big.alt = shown.alt; + big.width = shown.width; + big.height = shown.height; + big.decoding = "async"; + const x2 = shown.getAttribute("data-src-2x"); + if (x2) { + big.srcset = `${src} 1x, ${x2} 2x`; + // A 2x copy that can't load: the 1x one. + big.addEventListener("error", () => big.removeAttribute("srcset"), { once: true }); + } + big.src = src; + view.append(big); + } else if (shown) { + view.append(shown.cloneNode(true)); + } + view.scrollTop = 0; + } + + function open(card: HTMLElement) { + opener = card.querySelector("[data-vg-open]"); + show(card); + if (!box.open) box.showModal(); + } + + function step(by: number) { + const list = cards(); + if (!current || list.length === 0) return; + const i = list.indexOf(current); + show(list[(Math.max(i, 0) + by + list.length) % list.length]); + } + + function edges() { + if (!track) return; + const prev = root.querySelector('[data-vg-scroll="-1"]'); + const next = root.querySelector('[data-vg-scroll="1"]'); + if (prev) prev.disabled = track.scrollLeft <= 1; + if (next) next.disabled = track.scrollLeft + track.clientWidth >= track.scrollWidth - 1; + } + + const onClick = (e: MouseEvent) => { + const target = e.target as Element; + if (target === box) return box.close(); // the dimmed backdrop, outside the dialog's box + const link = target.closest("a[data-vg-open]"); + if (link && root.contains(link)) { + if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || !canOpen()) return; + e.preventDefault(); + open(link.closest(".vg-card")!); + return; + } + const b = target.closest("button"); + if (!b || !root.contains(b)) return; + const theme = b.getAttribute("data-vg-theme"); + const size = b.getAttribute("data-vg-size") as Size | null; + const stepBy = b.getAttribute("data-vg-step"); + const scroll = b.getAttribute("data-vg-scroll"); + if (theme) set("theme", theme); + else if (size) { + chosen = size; + set("size", size); + } else if (stepBy) step(Number(stepBy)); + else if (scroll && track) { + track.scrollBy({ left: Number(scroll) * track.clientWidth * 0.9, behavior: reducedMotion() ? "auto" : "smooth" }); + } else if (b.hasAttribute("data-vg-close")) box.close(); + else if (b.getAttribute("role") === "tab") select(b); + }; + const onKey = (e: KeyboardEvent) => { + const target = e.target as HTMLElement; + if (box.open && box.contains(target)) { + if (e.key === "ArrowRight") step(1); + else if (e.key === "ArrowLeft") step(-1); + return; + } + if (target.getAttribute("role") !== "tab") return; + const i = tabs.indexOf(target as HTMLButtonElement); + const next = + e.key === "ArrowRight" ? i + 1 : e.key === "ArrowLeft" ? i - 1 : e.key === "Home" ? 0 : e.key === "End" ? tabs.length - 1 : null; + if (next === null || i === -1) return; + e.preventDefault(); + select(tabs[(next + tabs.length) % tabs.length], true); + }; + const onClose = () => { + current = null; + view.replaceChildren(); + if (opener?.isConnected) opener.focus(); + opener = null; + }; + + // A gallery without theme buttons follows the page: as it changes, else the reader's setting. + const scheme = matchMedia("(prefers-color-scheme: dark)"); + const onScheme = () => set("theme", pageTheme()); + let observer: MutationObserver | null = null; + if (followsPage) { + observer = new MutationObserver(onScheme); + observer.observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme"] }); + scheme.addEventListener?.("change", onScheme); + } + + root.addEventListener("click", onClick); + root.addEventListener("keydown", onKey); + box.addEventListener("close", onClose); + track?.addEventListener("scroll", edges, { passive: true }); + for (const img of all("img.vg-img") as HTMLImageElement[]) watch(img); + + set("theme", pageTheme()); + fit(); + edges(); + + const gallery: Gallery = { + root, + setTheme: (t) => set("theme", t), + setSize: (s) => { + chosen = s; + fit(); + }, + open: (key) => { + for (const t of tabs) { + const p = panelOf(t); + if (p && cardOf(key, p)) select(t); + } + const shownPanel = panel(); + const card = shownPanel ? cardOf(key, shownPanel) : null; + if (!card) throw new Error(`no screen "${key}" in this gallery`); + open(card); + }, + close: () => box.close(), + destroy: () => { + root.removeEventListener("click", onClick); + root.removeEventListener("keydown", onKey); + box.removeEventListener("close", onClose); + track?.removeEventListener("scroll", edges); + observer?.disconnect(); + scheme.removeEventListener?.("change", onScheme); + hydrated.delete(root); + }, + }; + hydrated.set(root, gallery); + return gallery; +} diff --git a/clients/gallery/js/src/index.ts b/clients/gallery/js/src/index.ts new file mode 100644 index 00000000..2852914d --- /dev/null +++ b/clients/gallery/js/src/index.ts @@ -0,0 +1,36 @@ +// @visualci/gallery: a screenshots page from VisualCI's public gallery (https://visualci.com/docs/gallery/). +// +// mount(el, { manifest }) fetches the manifest, renders the gallery into an empty element and hydrates it. +// hydrate(el) brings markup a server rendered (the Astro component, the Ruby gem, the Python package) +// to life. +// load(options) the manifest's model, for rendering at build time: it throws when the manifest can't be +// read or has nothing to show, so a static site's build fails instead of shipping an empty +// page. + +import type { Model } from "./model.js"; +import { render } from "./render.js"; +import { hydrate, type Gallery } from "./hydrate.js"; +import { load, type LoadOptions } from "./load.js"; + +export { buildModel, parseShot, humanize, slugify, DEFAULT_TITLE } from "./model.js"; +export type { Manifest, ManifestGroup, ManifestItem, Model, Group, Screen, Variant, Options, Size, Theme } from "./model.js"; +export { render, escapeHtml } from "./render.js"; +export { hydrate, type Gallery } from "./hydrate.js"; +export { load, type LoadOptions } from "./load.js"; + +/** Renders the gallery into an empty element and hydrates it. When the manifest can't be read, the element says so + * and the promise rejects. */ +export async function mount(el: HTMLElement, options: LoadOptions): Promise { + let model: Model; + try { + model = await load(options); + } catch (e) { + const p = document.createElement("p"); + p.className = "vg-error"; + p.textContent = "The screenshots couldn't be loaded."; + el.replaceChildren(p); + throw e; + } + el.innerHTML = render(model); + return hydrate(el); +} diff --git a/clients/gallery/js/src/load.ts b/clients/gallery/js/src/load.ts new file mode 100644 index 00000000..69229ecf --- /dev/null +++ b/clients/gallery/js/src/load.ts @@ -0,0 +1,41 @@ +// Reading the manifest: shared by mount() in the browser and by build-time renderers (the Astro component). + +import { buildModel, type Manifest, type Model, type Options } from "./model.js"; + +export interface LoadOptions extends Options { + /** The manifest's URL: `https://app.visualci.com/g//.json`. */ + manifest: string; + /** How long to wait for it, in milliseconds. Default 20000. */ + timeout?: number; + /** How many times to try. Default 3. */ + attempts?: number; + /** A fetch to use in place of the global one. */ + fetch?: typeof fetch; +} + +/** Fetches the manifest and builds its model. Throws, naming the URL, when it can't be read or shows nothing. */ +export async function load(options: LoadOptions): Promise { + const get = options.fetch ?? fetch; + const attempts = Math.max(1, options.attempts ?? 3); + let last: unknown; + let manifest: Manifest | undefined; + for (let attempt = 1; attempt <= attempts; attempt++) { + try { + const res = await get(options.manifest, { signal: AbortSignal.timeout(options.timeout ?? 20000) }); + if (!res.ok) throw new Error(`HTTP ${res.status}`); + manifest = (await res.json()) as Manifest; + break; + } catch (e) { + last = e; + if (attempt < attempts) await new Promise((r) => setTimeout(r, attempt * 1000)); + } + } + if (manifest === undefined) { + throw new Error(`The screenshots gallery couldn't read ${options.manifest}: ${last instanceof Error ? last.message : String(last)}`); + } + try { + return buildModel(manifest, options); + } catch (e) { + throw new Error(`The screenshots gallery can't show ${options.manifest}: ${e instanceof Error ? e.message : String(e)}`); + } +} diff --git a/clients/gallery/js/src/model.ts b/clients/gallery/js/src/model.ts new file mode 100644 index 00000000..ff08a018 --- /dev/null +++ b/clients/gallery/js/src/model.ts @@ -0,0 +1,265 @@ +// The manifest, grouped and paired: the step every renderer shares (contract/SPEC.md, "The model"). Pure: no DOM, no +// network, so it runs in the browser, at build time and in tests alike. + +export type Theme = "light" | "dark"; +export type Size = "desktop" | "phone"; + +/** VisualCI's public gallery manifest (https://visualci.com/docs/gallery/). */ +export interface Manifest { + project?: string; + groups: ManifestGroup[]; +} +export interface ManifestGroup { + name: string; + title?: string | null; + items: ManifestItem[]; +} +export interface ManifestItem { + name: string; + url: string; + width: number; + height: number; + platform?: string; + sha256?: string; + since?: string; +} + +export interface ScreenOptions { + title?: string; + caption?: string; +} +export interface GroupOptions { + title?: string; +} + +/** What a site can set. Every field is optional and JSON-shaped, so the server renderers take the same options. */ +export interface Options { + /** The gallery's heading and accessible name. Default "Screenshots"; null keeps the name but shows no heading. */ + title?: string | null; + /** The level of the gallery's heading (2 by default); groups and cards take the levels below it. */ + headingLevel?: number; + /** The prefix of every id in the markup, for more than one gallery on a page. Default "vg". */ + id?: string; + /** Titles and captions by screen key (`ios/usage`, `overview`). */ + screens?: Record; + /** Screen keys in the order they show; the rest follow by key. */ + order?: string[]; + /** Titles by group name, over the manifest's. */ + groups?: Record; + /** Group names in the order they show; the rest follow in the manifest's order. */ + groupOrder?: string[]; + /** The "Powered by VisualCI" line. Default true. */ + credit?: boolean; + /** "grid" (default): tabs per group, a grid of cards. "strip": every screen in one row that scrolls sideways, for + * a homepage band. */ + layout?: Layout; + /** Light and Dark buttons. Default true for the grid; the strip never has them. Without them the gallery follows + * the page: ``, else the reader's setting. */ + themeSwitch?: boolean; + /** A link under the gallery, such as the strip's link to the full page. */ + seeAll?: { href: string; text?: string } | null; +} + +export type Layout = "grid" | "strip"; + +export interface Variant { + size: Size; + theme: Theme; + url: string; + url2x: string | null; + width: number; + height: number; +} +export interface Screen { + key: string; + title: string; + caption: string | null; + variants: Variant[]; +} +export interface Group { + name: string; + title: string; + slug: string; + sizes: Size[]; + screens: Screen[]; +} +export interface Model { + layout: Layout; + themeSwitch: boolean; + seeAll: { href: string; text: string } | null; + title: string | null; + label: string; + headingLevel: number; + id: string; + credit: boolean; + groups: Group[]; +} + +export const DEFAULT_TITLE = "Screenshots"; + +const SIZES: Size[] = ["desktop", "phone"]; +const THEMES: Theme[] = ["light", "dark"]; +const EXTENSION = /\.(png|jpe?g|webp)$/i; +const WIDTH_THEME = /^(\d+)-(light|dark)(-2x)?$/; +const SCREEN_THEME = /^(.+?)-(light|dark)(?:-(\d+))?(-2x)?$/; + +export const SEE_ALL_TEXT = "See all screenshots"; + +export interface Shot { + /** The screen's key: the name without its theme, width and 2x parts. */ + key: string; + /** null when the name says nothing: the shot stands for both themes. */ + theme: Theme | null; + size: Size; + x2: boolean; + /** The CSS width the name gives (`-1440`), or null. */ + cssWidth: number | null; +} + +/** How a manifest name pairs: `-[-][-2x]`, or `/-[-2x]`. A name in + * neither shape is a screen of its own, in both themes. Under 768 wide is a phone; with no width, a portrait image + * is a phone and a landscape one a desktop. */ +export function parseShot(name: string, width: number, height: number): Shot { + const parts = name.replace(EXTENSION, "").split("/"); + const last = parts.pop()!; + const folder = parts.join("/"); + const sized = (w: string | undefined): Size => + w !== undefined ? (Number(w) < 768 ? "phone" : "desktop") : height > width ? "phone" : "desktop"; + + const css = (w: string | undefined) => (w !== undefined ? Number(w) : null); + + let m = WIDTH_THEME.exec(last); + if (m && folder) { + return { key: folder, theme: m[2] as Theme, size: sized(m[1]), x2: !!m[3], cssWidth: css(m[1]) }; + } + m = SCREEN_THEME.exec(last); + if (m) { + const key = folder ? `${folder}/${m[1]}` : m[1]; + return { key, theme: m[2] as Theme, size: sized(m[3]), x2: !!m[4], cssWidth: css(m[3]) }; + } + return { key: folder ? `${folder}/${last}` : last, theme: null, size: sized(undefined), x2: false, cssWidth: null }; +} + +/** `billing/free` → "Billing, free". */ +export function humanize(segments: string[]): string { + const text = segments.map((s) => s.replace(/[-_]+/g, " ").replace(/^ +| +$/g, "")).join(", "); + const first = text.codePointAt(0); + if (first === undefined) return text; + const head = String.fromCodePoint(first); + return head.toUpperCase() + text.slice(head.length); +} + +/** A group's name as an id: ASCII lower case, runs of anything else as one hyphen. */ +export function slugify(name: string): string { + return name.replace(/[A-Z]/g, (c) => c.toLowerCase()).replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "group"; +} + +function commonFolder(keys: string[]): string[] { + const folders = keys.map((k) => k.split("/").slice(0, -1)); + if (folders.length === 0) return []; + let common = folders[0]; + for (const f of folders.slice(1)) { + let i = 0; + while (i < common.length && i < f.length && common[i] === f[i]) i++; + common = common.slice(0, i); + } + return common; +} + +function rankBy(order: string[] | undefined) { + const list = order ?? []; + return (key: string) => { + const i = list.indexOf(key); + return i === -1 ? list.length : i; + }; +} + +/** By code point, as Ruby, Python and Rust compare strings (JavaScript's < compares UTF-16 units). */ +function compare(a: string, b: string): number { + const x = Array.from(a, (c) => c.codePointAt(0)!); + const y = Array.from(b, (c) => c.codePointAt(0)!); + for (let i = 0; i < Math.min(x.length, y.length); i++) if (x[i] !== y[i]) return x[i] - y[i]; + return x.length - y.length; +} + +/** The manifest as the gallery shows it (contract/SPEC.md). Throws when nothing in it can be shown. */ +export function buildModel(manifest: Manifest, options: Options = {}): Model { + if (!manifest || !Array.isArray(manifest.groups)) throw new Error("not a gallery manifest: it has no groups"); + const headingLevel = Math.min(Math.max(Math.trunc(options.headingLevel ?? 2), 1), 4); + const title = options.title === undefined ? DEFAULT_TITLE : options.title; + const slugs = new Set(); + + const groups: Group[] = []; + for (const g of manifest.groups) { + const screens = new Map>(); + for (const item of g.items ?? []) { + const shot = parseShot(item.name, item.width, item.height); + const variants = screens.get(shot.key) ?? new Map(); + screens.set(shot.key, variants); + for (const theme of shot.theme ? [shot.theme] : THEMES) { + const id = `${shot.size}-${theme}`; + const v = variants.get(id) ?? { size: shot.size, theme, url: "", url2x: null, width: 0, height: 0 }; + if (shot.x2) { + if (v.url2x === null) v.url2x = item.url; + } else if (v.url === "") { + // An image wider than the width its name gives was taken at a higher density: shown at the name's width, + // its height rounded half up in integers (the same in every language). + const scaled = shot.cssWidth !== null && item.width > shot.cssWidth; + const width = scaled ? shot.cssWidth! : item.width; + const height = scaled ? Math.floor((2 * item.height * shot.cssWidth! + item.width) / (2 * item.width)) : item.height; + Object.assign(v, { url: item.url, width, height }); + } + variants.set(id, v); + } + } + const keys = [...screens.keys()]; + const prefix = commonFolder(keys).length; + const rank = rankBy(options.order); + const list: Screen[] = keys + .map((key) => { + const variants = [...screens.get(key)!.values()] + .filter((v) => v.url !== "") + .sort((a, b) => SIZES.indexOf(a.size) - SIZES.indexOf(b.size) || THEMES.indexOf(a.theme) - THEMES.indexOf(b.theme)); + const set = options.screens?.[key]; + return { + key, + title: set?.title ?? humanize(key.split("/").slice(prefix)), + caption: set?.caption ?? null, + variants, + }; + }) + .filter((s) => s.variants.length > 0) + .sort((a, b) => rank(a.key) - rank(b.key) || compare(a.key, b.key)); + if (list.length === 0) continue; + + let slug = slugify(g.name); + for (let n = 2; slugs.has(slug); n++) slug = `${slugify(g.name)}-${n}`; + slugs.add(slug); + groups.push({ + name: g.name, + title: options.groups?.[g.name]?.title ?? g.title ?? g.name, + slug, + sizes: SIZES.filter((s) => list.some((sc) => sc.variants.some((v) => v.size === s))), + screens: list, + }); + } + if (groups.length === 0) throw new Error("the gallery manifest has no screenshots to show"); + + const groupRank = rankBy(options.groupOrder); + const order = groups.map((g) => g.name); + groups.sort((a, b) => groupRank(a.name) - groupRank(b.name) || order.indexOf(a.name) - order.indexOf(b.name)); + + const layout: Layout = options.layout === "strip" ? "strip" : "grid"; + const seeAll = options.seeAll ? { href: options.seeAll.href, text: options.seeAll.text ?? SEE_ALL_TEXT } : null; + return { + layout, + themeSwitch: layout === "grid" && options.themeSwitch !== false, + seeAll, + title, + label: title ?? DEFAULT_TITLE, + headingLevel, + id: options.id ?? "vg", + credit: options.credit ?? true, + groups, + }; +} diff --git a/clients/gallery/js/src/render-entry.ts b/clients/gallery/js/src/render-entry.ts new file mode 100644 index 00000000..e9dd26cb --- /dev/null +++ b/clients/gallery/js/src/render-entry.ts @@ -0,0 +1,5 @@ +// The server-safe half of the library: the model and the markup, with no DOM code, for rendering at build time. +export { buildModel, parseShot, humanize, slugify, DEFAULT_TITLE } from "./model.js"; +export type { Manifest, ManifestGroup, ManifestItem, Model, Group, Screen, Variant, Options, Size, Theme } from "./model.js"; +export { render, escapeHtml } from "./render.js"; +export { load, type LoadOptions } from "./load.js"; diff --git a/clients/gallery/js/src/render.ts b/clients/gallery/js/src/render.ts new file mode 100644 index 00000000..cbedc09c --- /dev/null +++ b/clients/gallery/js/src/render.ts @@ -0,0 +1,165 @@ +// The gallery's HTML from its model: the markup every renderer emits byte for byte (contract/SPEC.md, "The markup"), +// and that hydrate() brings to life. Pure string building, so it runs at build time with no DOM. + +import type { Group, Model, Screen, Size, Theme, Variant } from "./model.js"; + +/** & < > " ' as entities: the only escaping the contract allows, so every language's output is the same. */ +export function escapeHtml(s: string): string { + return s + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); +} + +const SIZE_LABEL: Record = { desktop: "Desktop", phone: "Phone" }; + +function themeSwitch(): string { + return ( + '
    ' + + '' + + '' + + "
    " + ); +} + +function sizeSwitch(sizes: Size[], extra = ""): string { + return ( + `
    ` + + sizes.map((s) => ``).join("") + + "
    " + ); +} + +function image(title: string, v: Variant, themes: Theme[]): string { + const alt = `${title}, ${SIZE_LABEL[v.size].toLowerCase()}, ${themes.join(" and ")}`; + return ( + `${escapeHtml(alt)}` + ); +} + +/** One card: a link to its first image (which hydrate() turns into the full-size view), every variant at the given + * sizes, its title and caption. */ +function card(sc: Screen, sizes: Size[], heading: string, caption: boolean): string { + const imgs: string[] = []; + const shown: Size[] = []; + let first: Variant | null = null; + for (const size of sizes) { + const at = sc.variants.filter((v) => v.size === size); + if (at.length === 0) continue; + shown.push(size); + first ??= at[0]; + // A size with one theme, or the same image for both, shows one image in both. + if (at.length === 1 || (at[0].url === at[1].url && at[0].url2x === at[1].url2x)) { + imgs.push(image(sc.title, at[0], ["light", "dark"])); + } + else for (const v of at) imgs.push(image(sc.title, v, [v.theme])); + } + return ( + `
  • ` + + `` + + imgs.join("") + + "" + + `<${heading} class="vg-card-title">${escapeHtml(sc.title)}` + + (caption && sc.caption !== null ? `

    ${escapeHtml(sc.caption)}

    ` : "") + + "
  • " + ); +} + +/** The gallery's markup: one line per block, no indentation, "\n" after each line. */ +export function render(model: Model): string { + const id = escapeHtml(model.id); + const h = (offset: number) => `h${Math.min(model.headingLevel + offset, 6)}`; + const below = model.title === null ? 0 : 1; + const out: string[] = []; + + // The size shown before the script runs: the first panel's (only it shows without the script). + const size = model.layout === "strip" ? stripSize(model) : model.groups[0].sizes[0]; + out.push( + `
    ", + ); + if (model.title !== null) out.push(`<${h(0)} class="vg-title">${escapeHtml(model.title)}`); + if (model.layout === "strip") strip(model, id, h(below), out); + else grid(model, id, h(below), h(below + 1), out); + + if (model.seeAll) { + out.push(`

    ${escapeHtml(model.seeAll.text)}

    `); + } + if (model.credit) { + out.push('

    Screenshot Gallery Powered by VisualCI.com

    '); + } + out.push(``); + out.push( + `
    <${h(below)} class="vg-box-title" id="${id}-box-title">` + + '
    ' + + (model.themeSwitch ? themeSwitch() : "") + + (model.layout === "grid" ? sizeSwitch(["desktop", "phone"], " vg-box-sizes") : "") + + '' + + '' + + '' + + "
    ", + ); + out.push('
    '); + out.push("
    "); + out.push("
    "); + return out.join("\n") + "\n"; +} + +function grid(model: Model, id: string, gh: string, ch: string, out: string[]) { + const tabs = model.groups.length > 1; + if (tabs) { + out.push(`
    `); + model.groups.forEach((g, i) => { + out.push( + ``, + ); + }); + out.push("
    "); + } + model.groups.forEach((g, i) => { + out.push( + `
    0 ? " hidden" : "") + + ">", + ); + const controls = (model.themeSwitch ? themeSwitch() : "") + (g.sizes.length > 1 ? sizeSwitch(g.sizes) : ""); + out.push( + `
    <${gh} class="vg-group-title">${escapeHtml(g.title)}` + + (controls ? `
    ${controls}
    ` : "") + + "
    ", + ); + out.push('
      '); + for (const sc of g.screens) out.push(card(sc, g.sizes, ch, true)); + out.push("
    "); + out.push("
    "); + }); +} + +/** Every screen of every group at one size (desktop when any group has it) in one row. */ +function stripSize(model: Model): Size { + return model.groups.some((g: Group) => g.sizes.includes("desktop")) ? "desktop" : "phone"; +} + +function strip(model: Model, id: string, ch: string, out: string[]) { + const size = stripSize(model); + out.push(`
    `); + out.push( + '
    ', + ); + out.push('
      '); + for (const g of model.groups) { + for (const sc of g.screens) if (sc.variants.some((v) => v.size === size)) out.push(card(sc, [size], ch, false)); + } + out.push("
    "); + out.push( + '
    ', + ); + out.push("
    "); +} diff --git a/clients/gallery/js/test/contract.test.ts b/clients/gallery/js/test/contract.test.ts new file mode 100644 index 00000000..7fe04d7c --- /dev/null +++ b/clients/gallery/js/test/contract.test.ts @@ -0,0 +1,41 @@ +// The contract's golden fixtures (../contract): every renderer must turn each fixture's manifest.json and +// options.json into exactly its model.json and gallery.html. UPDATE_GOLDEN=1 rewrites them from this, the reference +// implementation; review the diff before committing it. +import { existsSync, readdirSync, readFileSync, writeFileSync } from "node:fs"; +import { join } from "node:path"; +import { describe, expect, it } from "vitest"; +import { buildModel, render, type Manifest, type Options } from "../src/render-entry.js"; + +const contract = join(import.meta.dirname, "../../contract"); +const fixtures = join(contract, "fixtures"); +const update = process.env.UPDATE_GOLDEN === "1"; +const read = (path: string) => JSON.parse(readFileSync(path, "utf8")); + +describe("golden fixtures", () => { + const names = readdirSync(fixtures).sort(); + it("has fixtures", () => expect(names.length).toBeGreaterThan(0)); + for (const name of names) { + it(name, () => { + const dir = join(fixtures, name); + const model = buildModel(read(join(dir, "manifest.json")) as Manifest, read(join(dir, "options.json")) as Options); + const html = render(model); + const modelJson = JSON.stringify(model, null, 2) + "\n"; + if (update) { + writeFileSync(join(dir, "model.json"), modelJson); + writeFileSync(join(dir, "gallery.html"), html); + } + expect(existsSync(join(dir, "model.json")), `${name}/model.json is missing: run UPDATE_GOLDEN=1 pnpm test`).toBe(true); + expect(modelJson).toBe(readFileSync(join(dir, "model.json"), "utf8")); + expect(html).toBe(readFileSync(join(dir, "gallery.html"), "utf8")); + }); + } +}); + +describe("manifests that can't be shown", () => { + const errors = join(contract, "errors"); + for (const name of readdirSync(errors).sort()) { + it(name, () => { + expect(() => buildModel(read(join(errors, name)) as Manifest, {})).toThrow(); + }); + } +}); diff --git a/clients/gallery/js/test/hydrate.test.ts b/clients/gallery/js/test/hydrate.test.ts new file mode 100644 index 00000000..40cc33b4 --- /dev/null +++ b/clients/gallery/js/test/hydrate.test.ts @@ -0,0 +1,212 @@ +// @vitest-environment jsdom +// The behaviour on top of the contract's markup: theme and size for the whole gallery, tabs, the full-size view, +// following the page's theme, and mount() rendering into an empty element. +import { readFileSync } from "node:fs"; +import { join } from "node:path"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import { hydrate, load, mount } from "../src/index.js"; + +const fixtures = join(import.meta.dirname, "../../contract/fixtures"); +const golden = (name: string) => readFileSync(join(fixtures, name, "gallery.html"), "utf8"); +const manifest = (name: string) => readFileSync(join(fixtures, name, "manifest.json"), "utf8"); + +let media: Record = {}; +beforeEach(() => { + media = {}; + vi.stubGlobal("matchMedia", (q: string) => ({ + matches: !!media[q], + media: q, + addEventListener() {}, + removeEventListener() {}, + })); + // jsdom has but not its modal methods. + HTMLDialogElement.prototype.showModal = function (this: HTMLDialogElement) { + this.setAttribute("open", ""); + }; + HTMLDialogElement.prototype.close = function (this: HTMLDialogElement) { + if (!this.open) return; + this.removeAttribute("open"); + this.dispatchEvent(new Event("close")); + }; + document.documentElement.removeAttribute("data-theme"); +}); +afterEach(() => { + document.body.innerHTML = ""; + vi.unstubAllGlobals(); +}); + +function page(name: string) { + document.body.innerHTML = `
    ${golden(name)}
    `; + return hydrate(document.querySelector("main")!); +} +const q = (s: string) => document.querySelector(s)!; +const qa = (s: string) => [...document.querySelectorAll(s)]; +const click = (el: Element, init: MouseEventInit = {}) => + el.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true, button: 0, ...init })); +const key = (el: Element, k: string) => el.dispatchEvent(new KeyboardEvent("keydown", { key: k, bubbles: true })); +const pressed = (s: string) => qa(s).filter((b) => b.getAttribute("aria-pressed") === "true").map((b) => b.textContent); + +describe("hydrate", () => { + it("starts in the reader's theme at desktop size, and marks the buttons", () => { + media["(prefers-color-scheme: dark)"] = true; + const g = page("fleetlayer"); + expect(g.root.dataset.theme).toBe("dark"); + expect(g.root.dataset.size).toBe("desktop"); + expect(pressed("#vg-panel-web [data-vg-theme]")).toEqual(["Dark"]); + expect(pressed("#vg-panel-web [data-vg-size]")).toEqual(["Desktop"]); + }); + + it("starts at phone size on a narrow screen", () => { + media["(max-width: 47.99rem)"] = true; + expect(page("fleetlayer").root.dataset.size).toBe("phone"); + }); + + it("switches theme and size for every card, and each card links to the image it shows", () => { + const g = page("fleetlayer"); + click(q('#vg-panel-web [data-vg-theme="dark"]')); + expect(g.root.dataset.theme).toBe("dark"); + expect(q('[data-vg-screen="overview"] a').getAttribute("href")).toMatch(/overview-dark-1440\.png$/); + click(q('#vg-panel-web [data-vg-size="phone"]')); + expect(g.root.dataset.size).toBe("phone"); + expect(q('[data-vg-screen="overview"] a').getAttribute("href")).toMatch(/overview-dark-390\.png$/); + // A screen with only a light shot shows it in dark too. + click(q('#vg-panel-web [data-vg-size="desktop"]')); + expect(q('[data-vg-screen="status"] a').getAttribute("href")).toMatch(/status-light-1440\.png$/); + }); + + it("tabs show one panel, keep the chosen size where they have it, and move with the arrow keys", () => { + const g = page("fleetlayer"); + const tabs = qa('[role="tab"]'); + click(tabs[1]); + expect(q("#vg-panel-iphone").hidden).toBe(false); + expect(q("#vg-panel-web").hidden).toBe(true); + expect(tabs[1].getAttribute("aria-selected")).toBe("true"); + expect(tabs[0].tabIndex).toBe(-1); + expect(g.root.dataset.size).toBe("phone"); // the iPhone tab has only phone shots + key(tabs[1], "ArrowRight"); + expect(q("#vg-panel-mac-approver").hidden).toBe(false); + expect(document.activeElement).toBe(tabs[2]); + expect(g.root.dataset.size).toBe("desktop"); // back to the chosen size + key(tabs[2], "ArrowRight"); + expect(q("#vg-panel-web").hidden).toBe(false); + key(tabs[0], "End"); + expect(document.activeElement).toBe(tabs[2]); + key(tabs[2], "Home"); + expect(document.activeElement).toBe(tabs[0]); + }); + + it("opens the full-size view, steps through the cards at this size, and gives focus back on close", () => { + page("fleetlayer"); + const box = q(".vg-box"); + const link = q('[data-vg-screen="overview"] a'); + link.focus(); + expect(click(link)).toBe(false); // the link's navigation is cancelled + expect(box.open).toBe(true); + expect(q(".vg-box-title").textContent).toBe("Overview"); + expect(q(".vg-box-view img").getAttribute("src")).toMatch(/overview-light-1440\.png$/); + key(q(".vg-box-view"), "ArrowRight"); + expect(q(".vg-box-title").textContent).toBe("Access"); + click(q('.vg-box [data-vg-step="1"]')); + expect(q(".vg-box-title").textContent).toBe("Logo"); // the phone-only screen is skipped at desktop size + click(q('.vg-box [data-vg-step="1"]')); + expect(q(".vg-box-title").textContent).toBe("Status"); + click(q('.vg-box [data-vg-step="1"]')); + expect(q(".vg-box-title").textContent).toBe("Overview"); + click(q('.vg-box [data-vg-theme="dark"]')); + expect(q(".vg-box-view img").getAttribute("src")).toMatch(/overview-dark-1440\.png$/); + click(q(".vg-box [data-vg-close]")); + expect(box.open).toBe(false); + expect(document.activeElement).toBe(link); + }); + + it("uses the 2x copy in the full-size view", () => { + page("visualci"); + click(q('[data-vg-screen="screenshots/app/account"] a')); + expect(q(".vg-box-view img").getAttribute("srcset")).toMatch(/1440-light\.png 1x, .*1440-light-2x\.png 2x$/); + }); + + it("leaves a modified click, and a browser without , to the link", () => { + page("fleetlayer"); + const link = q('[data-vg-screen="overview"] a'); + expect(click(link, { metaKey: true })).toBe(true); + expect(q(".vg-box").open).toBe(false); + // @ts-expect-error removing the method, as in Safari before 15.4 + delete HTMLDialogElement.prototype.showModal; + expect(click(link)).toBe(true); + }); + + it("follows the page's theme when it has no theme buttons", async () => { + document.documentElement.dataset.theme = "dark"; + const g = page("page-theme"); + expect(qa("[data-vg-theme]")).toHaveLength(0); + expect(g.root.dataset.theme).toBe("dark"); + document.documentElement.dataset.theme = "light"; + await new Promise((r) => setTimeout(r, 0)); // the MutationObserver's callback + expect(g.root.dataset.theme).toBe("light"); + }); + + it("opens a screen by key on its own tab", () => { + const g = page("fleetlayer"); + g.open("ios/approval"); + expect(q("#vg-panel-iphone").hidden).toBe(false); + expect(q(".vg-box-title").textContent).toBe("Approval"); + expect(() => g.open("nope")).toThrow(/no screen/); + }); + + it("hydrates once", () => { + const g = page("fleetlayer"); + expect(hydrate(document.querySelector("main")!)).toBe(g); + expect(() => hydrate(document.createElement("div"))).toThrow(/no gallery markup/); + }); + + it("strip: scroll buttons and the full-size view", () => { + const g = page("strip"); + expect(g.root.dataset.size).toBe("desktop"); + const track = q(".vg-track"); + const scrollBy = vi.fn(); + track.scrollBy = scrollBy as never; + click(q('[data-vg-scroll="1"]')); + expect(scrollBy).toHaveBeenCalledOnce(); + click(q('[data-vg-screen="screenshots/signing"] a')); + expect(q(".vg-box-title").textContent).toBe("Signing"); + expect(qa(".vg-box [data-vg-size]")).toHaveLength(0); + }); +}); + +const ok = (body: string) => async () => new Response(body, { status: 200 }); + +describe("load and mount", () => { + it("mount renders into an empty element and hydrates it", async () => { + document.body.innerHTML = '
    '; + const g = await mount(q("#g"), { manifest: "https://x/m.json", fetch: ok(manifest("visualci")) }); + // The golden markup, hydrated. + const expected = document.createElement("div"); + expected.innerHTML = golden("visualci"); + expect(qa("#g .vg-card").map((c) => c.dataset.vgScreen)).toEqual( + [...expected.querySelectorAll(".vg-card")].map((c) => c.dataset.vgScreen), + ); + expect(g.root.dataset.theme).toBe("light"); + }); + + it("load fails, naming the URL, when the manifest can't be read, after its attempts", async () => { + const fetch = vi.fn(async () => new Response("down", { status: 503 })); + await expect(load({ manifest: "https://x/m.json", fetch, attempts: 2 })).rejects.toThrow( + "The screenshots gallery couldn't read https://x/m.json: HTTP 503", + ); + expect(fetch).toHaveBeenCalledTimes(2); + }); + + it("load fails at once when the manifest has nothing to show", async () => { + const fetch = vi.fn(ok('{"groups":[]}')); + await expect(load({ manifest: "https://x/m.json", fetch })).rejects.toThrow(/can't show https:\/\/x\/m\.json/); + expect(fetch).toHaveBeenCalledTimes(1); + }); + + it("mount says so in the element when it can't load", async () => { + document.body.innerHTML = '
    '; + await expect( + mount(q("#g"), { manifest: "https://x/m.json", attempts: 1, fetch: async () => new Response("", { status: 500 }) }), + ).rejects.toThrow(); + expect(q("#g").textContent).toBe("The screenshots couldn't be loaded."); + }); +}); diff --git a/clients/gallery/js/test/iife.test.ts b/clients/gallery/js/test/iife.test.ts new file mode 100644 index 00000000..c7a20dfb --- /dev/null +++ b/clients/gallery/js/test/iife.test.ts @@ -0,0 +1,24 @@ +// dist/gallery.iife.js, the ES5 file for sites without a bundler: it sets window.VisualCIGallery and hydrates the +// contract's markup. Run `pnpm build` first (CI does). +import { existsSync, readFileSync } from "node:fs"; +import { join } from "node:path"; +import { JSDOM } from "jsdom"; +import { expect, it } from "vitest"; + +const file = join(import.meta.dirname, "../dist/gallery.iife.js"); + +it("dist/gallery.iife.js hydrates the golden markup with nothing but window.VisualCIGallery", () => { + expect(existsSync(file), "dist/gallery.iife.js is missing: run pnpm build before the tests").toBe(true); + const html = readFileSync(join(import.meta.dirname, "../../contract/fixtures/fleetlayer/gallery.html"), "utf8"); + const dom = new JSDOM(`
    ${html}
    `, { runScripts: "outside-only" }); + const before = new Set(Object.keys(dom.window)); + Object.assign(dom.window, { + matchMedia: () => ({ matches: false, addEventListener() {}, removeEventListener() {} }), + }); + dom.window.eval(readFileSync(file, "utf8")); + const added = Object.keys(dom.window).filter((k) => !before.has(k) && k !== "matchMedia"); + expect(added).toEqual(["VisualCIGallery"]); + const g = dom.window.VisualCIGallery.hydrate(dom.window.document.querySelector("main")); + expect(g.root.dataset.theme).toBe("light"); + expect(g.root.dataset.size).toBe("desktop"); +}); diff --git a/clients/gallery/js/test/model.test.ts b/clients/gallery/js/test/model.test.ts new file mode 100644 index 00000000..431d0c3a --- /dev/null +++ b/clients/gallery/js/test/model.test.ts @@ -0,0 +1,56 @@ +// The model's rules (contract/SPEC.md, "The model") beyond what the golden fixtures show. +import { describe, expect, it } from "vitest"; +import { buildModel, humanize, parseShot, slugify } from "../src/render-entry.js"; + +describe("parseShot", () => { + it.each([ + ["overview-dark-1440", 1440, 900, { key: "overview", theme: "dark", size: "desktop", x2: false, cssWidth: 1440 }], + ["overview-light-390", 390, 844, { key: "overview", theme: "light", size: "phone", x2: false, cssWidth: 390 }], + ["ios/usage-light.png", 1206, 2622, { key: "ios/usage", theme: "light", size: "phone", x2: false, cssWidth: null }], + ["mac/setup-dark", 840, 420, { key: "mac/setup", theme: "dark", size: "desktop", x2: false, cssWidth: null }], + ["shots/app/billing/1440-dark-2x", 2880, 1800, { key: "shots/app/billing", theme: "dark", size: "desktop", x2: true, cssWidth: 1440 }], + ["home-light-767", 767, 900, { key: "home", theme: "light", size: "phone", x2: false, cssWidth: 767 }], + ["home-light-768", 768, 900, { key: "home", theme: "light", size: "desktop", x2: false, cssWidth: 768 }], + ["dark-mode-light", 1440, 900, { key: "dark-mode", theme: "light", size: "desktop", x2: false, cssWidth: null }], + // A width and theme with no folder isn't a screen of its own: it pairs as `-`. + ["1440-dark", 1440, 900, { key: "1440", theme: "dark", size: "desktop", x2: false, cssWidth: null }], + ["logo.PNG", 1200, 630, { key: "logo", theme: null, size: "desktop", x2: false, cssWidth: null }], + ] as const)("%s", (name, w, h, shot) => { + expect(parseShot(name, w, h)).toEqual(shot); + }); +}); + +it("humanize and slugify", () => { + expect(humanize(["billing", "free_plan"])).toBe("Billing, free plan"); + expect(humanize(["--x--"])).toBe("X"); + expect(humanize(["ßig"])).toBe("SSig"); + expect(slugify("Mac approver")).toBe("mac-approver"); + expect(slugify("İOS")).toBe("os"); + expect(slugify("---")).toBe("group"); +}); + +const item = (name: string, width = 1440, height = 900) => ({ name, url: `https://x/${name}.png`, width, height }); + +describe("buildModel", () => { + it("sorts by code point, not UTF-16 unit", () => { + const m = buildModel({ groups: [{ name: "G", items: [item("\u{1F600}-light-1440"), item("~-light-1440")] }] }); + expect(m.groups[0].screens.map((s) => s.key)).toEqual(["~", "\u{1F600}"]); + }); + + it("keeps the first image for a variant, so a second platform's is ignored", () => { + const first = item("a-light-1440"); + const second = { ...item("a-light-1440"), url: "https://x/a-light-1440@webkit.png" }; + expect(buildModel({ groups: [{ name: "G", items: [first, second] }] }).groups[0].screens[0].variants[0].url).toBe(first.url); + }); + + it("drops a screen with only a 2x copy, and fails when nothing is left", () => { + expect(() => buildModel({ groups: [{ name: "G", items: [item("a/1440-light-2x")] }] })).toThrow(/no screenshots/); + }); + + it("clamps the heading level", () => { + const groups = [{ name: "G", items: [item("a-light-1440")] }]; + expect(buildModel({ groups }, { headingLevel: 9 }).headingLevel).toBe(4); + expect(buildModel({ groups }, { headingLevel: 0 }).headingLevel).toBe(1); + expect(buildModel({ groups }, { headingLevel: 2.7 }).headingLevel).toBe(2); + }); +}); diff --git a/clients/gallery/js/tsconfig.build.json b/clients/gallery/js/tsconfig.build.json new file mode 100644 index 00000000..b90fc83e --- /dev/null +++ b/clients/gallery/js/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "include": ["src"] +} diff --git a/clients/gallery/js/tsconfig.json b/clients/gallery/js/tsconfig.json new file mode 100644 index 00000000..7ced33f2 --- /dev/null +++ b/clients/gallery/js/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "ES2022", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "module": "NodeNext", + "moduleResolution": "NodeNext", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "skipLibCheck": true, + "resolveJsonModule": true, + "declaration": true, + "outDir": "dist" + }, + "include": ["src", "test"] +} diff --git a/clients/gallery/js/vitest.config.ts b/clients/gallery/js/vitest.config.ts new file mode 100644 index 00000000..5539adc2 --- /dev/null +++ b/clients/gallery/js/vitest.config.ts @@ -0,0 +1,3 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ test: { include: ["test/**/*.test.ts"] } }); diff --git a/docs/design.md b/docs/design.md index f21abd3a..3b1191e0 100644 --- a/docs/design.md +++ b/docs/design.md @@ -624,6 +624,12 @@ review is the publish step. Only images from the `ci` environment are published. gallery`); 304s, 404s and the manifest are free. Serving never stops when the organization is out of credits: breaking a customer's page is worse. A per-address limit (120 a minute per web process) keeps the URLs from being free image hosting. +- **Renderers for sites** (`clients/gallery/`, epic sc-9295): one screenshots page from a manifest on any site. The + pairing of names into screens (theme, size, 2x copies), the defaults and the HTML are a contract + (`clients/gallery/contract/SPEC.md`) with golden fixtures, so the browser library (`js/`, which also hydrates + markup a server rendered) and the server renderers (Astro, Ruby, Python, Rust) emit the same markup byte for byte. + A renderer that fetches the manifest fails when it can't read it or it shows nothing: a site's build fails rather + than shipping an empty gallery. ## Multi-tenancy and security diff --git a/scripts/ci/visual.sh b/scripts/ci/visual.sh index 935293a6..864d9ba0 100755 --- a/scripts/ci/visual.sh +++ b/scripts/ci/visual.sh @@ -7,7 +7,8 @@ # scripts/ci/visual.sh capture seed, serve, take screenshots and component snapshots into tmp/visual # scripts/ci/visual.sh upload send tmp/visual (and $VISUAL_JSON_DIR) to VisualCI as one build, and finalize it # -# Needs: target/debug/visualci-app and target/debug/visualci (cargo build), frontend/dist (pnpm build), and +# Needs: target/debug/visualci-app and target/debug/visualci (cargo build), frontend/dist and clients/gallery/js/dist +# (pnpm build in each), and # scripts/screenshots/node_modules with Playwright's Chromium. Settings: PORT (5151), DATABASE_URL (a database this # script drops and recreates), VISUALCI_S3_ENDPOINT and VISUALCI_S3_BUCKET (made if missing), VISUAL_JSON_DIR (the request tests' JSON # snapshots), VISUALCI_TOKEN. @@ -101,6 +102,8 @@ EOF curl -fsS "http://127.0.0.1:$port/up" >/dev/null || { tail -50 "$out/server.log"; exit 1; } (cd "$root/scripts/screenshots" && node capture.mjs --base-url "http://127.0.0.1:$port" --out "$out/screenshots") (cd "$root/scripts/screenshots" && node checks.mjs --base-url "http://127.0.0.1:$port") + # The gallery library's own (clients/gallery, built by the CI job): no server needed. + (cd "$root/scripts/screenshots" && node gallery.mjs --out "$out/screenshots") # Files the site serves to agents. mkdir -p "$out/site/docs" curl -fsS "http://127.0.0.1:$port/llms.txt" -o "$out/site/llms.txt" diff --git a/scripts/screenshots/gallery.mjs b/scripts/screenshots/gallery.mjs new file mode 100644 index 00000000..57dddf59 --- /dev/null +++ b/scripts/screenshots/gallery.mjs @@ -0,0 +1,119 @@ +// The gallery library's own screenshots (clients/gallery): the contract's golden markup, hydrated by +// dist/gallery.iife.js and styled by its default gallery.css, at 1440 and 390 px wide, light and dark, as +// `gallery//-.png` under the output folder. Its images are made up here (an SVG per URL, coloured +// by theme and labelled with the screen's name), so the shots need no network and come out the same every run. +// +// node gallery.mjs [--out out/shots] (visual.sh capture runs it; needs `pnpm build` in clients/gallery/js) +import { mkdir, readFile } from 'node:fs/promises' +import { dirname, join } from 'node:path' +import { fileURLToPath } from 'node:url' +import { chromium } from 'playwright' + +import { STEADY_RASTER } from './raster.mjs' + +const here = dirname(fileURLToPath(import.meta.url)) +const gallery = join(here, '../../clients/gallery') + +function args() { + const out = { out: 'out/shots' } + const argv = process.argv.slice(2) + for (let i = 0; i < argv.length; i++) { + const key = argv[i].replace(/^--/, '') + if (!(key in out)) throw new Error(`unknown option ${argv[i]}`) + out[key] = argv[++i] + } + return out +} + +/** A made-up screenshot for a gallery URL, at the size its fixture's manifest gives: dark or light from the name, the + * screen's name written on it. */ +function picture(url, sizes) { + const name = decodeURIComponent(new URL(url).pathname.split('/').slice(4).join('/')).replace(/\.[a-z]+$/, '') + const dark = /-dark(-|$)|\/\d+-dark/.test(name) + const [w, h] = sizes.get(url) ?? [1440, 900] + const bg = dark ? '#16181d' : '#f6f7f9' + const panel = dark ? '#23262d' : '#ffffff' + const ink = dark ? '#e6e8ec' : '#1d2129' + const accent = dark ? '#7aa2ff' : '#2f5bd3' + const s = w / 390 + return ` + + + + + +${name} +` +} + +const PAGE_CSS = ` + html { color-scheme: light; } + html[data-theme="dark"] { color-scheme: dark; } + body { margin: 0; padding: 32px 24px; font-family: "DejaVu Sans", sans-serif; background: Canvas; color: CanvasText; } + main { max-width: 1200px; margin: 0 auto; } + *, *::before, *::after { animation: none !important; transition: none !important; caret-color: transparent !important; } +` + +// What each shot shows: a fixture's markup, and what to do before the shot. +const VIEWS = [ + { name: 'grid', fixture: 'fleetlayer' }, + { name: 'grid-phone-tab', fixture: 'fleetlayer', act: (p) => p.click('[role="tab"] >> nth=1') }, + { name: 'titled', fixture: 'visualci' }, + { name: 'strip', fixture: 'strip' }, + { name: 'lightbox', fixture: 'fleetlayer', act: (p) => p.click('[data-vg-screen="overview"] a'), viewport: true }, +] + +async function main() { + const opts = args() + const iife = join(gallery, 'js/dist/gallery.iife.js') + const css = await readFile(join(gallery, 'js/dist/gallery.css'), 'utf8').catch(() => { + throw new Error(`${iife} and gallery.css are missing: run pnpm build in clients/gallery/js first`) + }) + const browser = await chromium.launch({ args: STEADY_RASTER }) + let shots = 0 + try { + for (const view of VIEWS) { + const fixture = join(gallery, 'contract/fixtures', view.fixture) + const markup = await readFile(join(fixture, 'gallery.html'), 'utf8') + const manifest = JSON.parse(await readFile(join(fixture, 'manifest.json'), 'utf8')) + const sizes = new Map(manifest.groups.flatMap((g) => g.items.map((i) => [i.url, [i.width, i.height]]))) + for (const width of [1440, 390]) { + for (const theme of ['light', 'dark']) { + const ctx = await browser.newContext({ viewport: { width, height: 900 }, colorScheme: theme, reducedMotion: 'reduce' }) + await ctx.route('https://app.visualci.com/g/**', (route) => + route.fulfill({ status: 200, contentType: 'image/svg+xml', body: picture(route.request().url(), sizes) }), + ) + const page = await ctx.newPage() + await page.setContent( + `` + + `` + + `
    ${markup}
    `, + ) + await page.addScriptTag({ path: iife }) + await page.evaluate(() => window.VisualCIGallery.hydrate(document.querySelector('main'))) + if (view.act) await view.act(page) + // Every image the shot shows, loaded. + await page.evaluate(async () => { + for (const img of document.images) img.loading = 'eager' + await Promise.all([...document.images].map((i) => (i.complete ? null : new Promise((r) => (i.onload = i.onerror = r))))) + await document.fonts.ready + await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r))) + }) + const path = join(opts.out, 'gallery', view.name, `${width}-${theme}.png`) + await mkdir(dirname(path), { recursive: true }) + await page.screenshot({ path, fullPage: !view.viewport, animations: 'disabled' }) + // No sideways scrolling, at any width. + const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth) + if (overflow > 0) throw new Error(`gallery ${view.name} at ${width} px scrolls sideways by ${overflow}px`) + await ctx.close() + shots++ + } + } + } + } finally { + await browser.close() + } + console.log(`gallery: ${shots} screenshots in ${join(opts.out, 'gallery')}`) +} + +await main() From b8531b50a2aeebfd95278795077364da59586440 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Fri, 4 Dec 2026 20:38:48 +1300 Subject: [PATCH 2/6] Gallery: review fixes (sc-9297) - The full-size view shows the image at its own size (it took the thumbnail's rendered width); the screenshot script now fails when it doesn't. - Validation in the contract and the library: the manifest's shape (names, items, integer sizes), http(s) item URLs with no control characters, and every option's type (null means absent; an unknown layout is an error); seeAll's href absolute or relative, never another scheme. errors/ and new option-errors/ fixtures. - Groups with the same name keep the manifest's order; default titles ignore screens dropped for having only a 2x copy; SPEC's patterns are whole-string, ASCII digits and any-character, so Python, Ruby and Rust match the same. - The view offers only the sizes the open screen has; opening a screen by key shows a size it has; stepping from a screen outside the list goes to the first or last. - Every attribute is data-vg-* (the gallery's theme and size, the buttons, the images), so a site's [data-theme] rules can't reach it. Alt text names the theme an image really is. - The strip's buttons sit inside it (no sideways page scroll at 390 px), follow its width (ResizeObserver), and long titles wrap; the overflow check runs with no page margin. The no-JS theme rule uses Level 3 media query syntax. - load() works without AbortSignal.timeout (Safari 15); mount() again destroys the gallery it replaces. - A duplicates fixture; tests for the image fallback, destroy, remounting and the view's sizes. --- clients/gallery/contract/SPEC.md | 69 ++++++--- .../contract/errors/fractional-size.json | 1 + .../contract/errors/group-without-items.json | 1 + .../contract/errors/group-without-name.json | 1 + .../contract/errors/item-without-name.json | 1 + .../contract/errors/javascript-url.json | 1 + clients/gallery/contract/errors/no-size.json | 1 + .../contract/fixtures/duplicates/gallery.html | 38 +++++ .../fixtures/duplicates/manifest.json | 19 +++ .../contract/fixtures/duplicates/model.json | 127 +++++++++++++++++ .../contract/fixtures/duplicates/options.json | 1 + .../contract/fixtures/escaping/gallery.html | 22 +-- .../contract/fixtures/fleetlayer/gallery.html | 32 ++--- .../fixtures/group-order/gallery.html | 22 +-- .../contract/fixtures/page-theme/gallery.html | 16 +-- .../fixtures/single-group/gallery.html | 12 +- .../contract/fixtures/strip/gallery.html | 16 +-- .../contract/fixtures/visualci/gallery.html | 20 +-- .../contract/option-errors/credit-yes.json | 1 + .../option-errors/headinglevel-2-5.json | 1 + .../option-errors/headinglevel-x.json | 1 + .../contract/option-errors/id-1-x.json | 1 + .../option-errors/layout-carousel.json | 1 + .../contract/option-errors/order-a.json | 1 + .../option-errors/screens-a-title.json | 1 + .../seeall-href-javascript-alert-1.json | 1 + .../seeall-href-javascript-x.json | 1 + .../contract/option-errors/seeall.json | 1 + clients/gallery/js/src/gallery.css | 44 +++--- clients/gallery/js/src/hydrate.ts | 78 +++++++---- clients/gallery/js/src/index.ts | 5 +- clients/gallery/js/src/load.ts | 10 +- clients/gallery/js/src/model.ts | 132 +++++++++++++----- clients/gallery/js/src/render.ts | 29 ++-- clients/gallery/js/test/contract.test.ts | 10 ++ clients/gallery/js/test/hydrate.test.ts | 83 ++++++++--- clients/gallery/js/test/iife.test.ts | 4 +- clients/gallery/js/test/model.test.ts | 4 +- scripts/screenshots/gallery.mjs | 18 ++- 39 files changed, 613 insertions(+), 214 deletions(-) create mode 100644 clients/gallery/contract/errors/fractional-size.json create mode 100644 clients/gallery/contract/errors/group-without-items.json create mode 100644 clients/gallery/contract/errors/group-without-name.json create mode 100644 clients/gallery/contract/errors/item-without-name.json create mode 100644 clients/gallery/contract/errors/javascript-url.json create mode 100644 clients/gallery/contract/errors/no-size.json create mode 100644 clients/gallery/contract/fixtures/duplicates/gallery.html create mode 100644 clients/gallery/contract/fixtures/duplicates/manifest.json create mode 100644 clients/gallery/contract/fixtures/duplicates/model.json create mode 100644 clients/gallery/contract/fixtures/duplicates/options.json create mode 100644 clients/gallery/contract/option-errors/credit-yes.json create mode 100644 clients/gallery/contract/option-errors/headinglevel-2-5.json create mode 100644 clients/gallery/contract/option-errors/headinglevel-x.json create mode 100644 clients/gallery/contract/option-errors/id-1-x.json create mode 100644 clients/gallery/contract/option-errors/layout-carousel.json create mode 100644 clients/gallery/contract/option-errors/order-a.json create mode 100644 clients/gallery/contract/option-errors/screens-a-title.json create mode 100644 clients/gallery/contract/option-errors/seeall-href-javascript-alert-1.json create mode 100644 clients/gallery/contract/option-errors/seeall-href-javascript-x.json create mode 100644 clients/gallery/contract/option-errors/seeall.json diff --git a/clients/gallery/contract/SPEC.md b/clients/gallery/contract/SPEC.md index b577b41e..4fa6ea80 100644 --- a/clients/gallery/contract/SPEC.md +++ b/clients/gallery/contract/SPEC.md @@ -25,13 +25,34 @@ change, and regenerate the fixtures (`UPDATE_GOLDEN=1 pnpm test` in `../js`), re | `groups` | `{}` | `{"": {title?}}`, over the manifest's titles. | | `groupOrder` | `[]` | Group names in the order they show. | | `credit` | `true` | The "Powered by VisualCI" line. | - | `layout` | `"grid"` | `"grid"` or `"strip"`; anything else is `"grid"`. | + | `layout` | `"grid"` | `"grid"` or `"strip"`. | | `themeSwitch` | `true` | Light and Dark buttons. Always false for the strip. | | `seeAll` | `null` | `{href, text?}`: a link under the gallery; `text` defaults to "See all screenshots". | - Each language takes them in its own spelling (`heading_level`, `group_order`, `theme_switch`, `see_all` in Ruby, + An option set to `null` is the same as leaving it out, except `title`, where `null` means no heading. An empty + string is kept as it is. Each language takes them in its own spelling (`heading_level`, `group_order`, `theme_switch`, `see_all` in Ruby, Python and Rust) with the same meaning. +## Validation + +A renderer refuses (fails with an error naming the problem) a manifest or options that break these rules, before +building anything. `errors/*.json` are manifests every renderer must refuse; `option-errors/*.json` are options every +renderer must refuse with the `visualci` fixture's manifest. + +- The manifest is an object with a `groups` array. Each group is an object with a non-empty string `name`, a `title` + that's absent, null or a string, and an `items` array (possibly empty). Each item is an object with a non-empty + string `name`, a `url`, and a `width` and `height` that are positive integers (JSON numbers with no fraction). +- An item's `url` must be an absolute http or https URL: it starts with `http://` or `https://` (scheme in any case) + and has no character from U+0000 to U+0020 or U+007F anywhere (browsers drop those, so `java\tscript:` would + still run). +- Options: `title` absent, null or a string; `headingLevel` an integer (then clamped to 1–4); `id` matching + `^[A-Za-z][A-Za-z0-9_-]*$`; `screens` an object whose values are objects with only `title` and `caption`, each null + or a string; `groups` the same with only `title`; `order` and `groupOrder` arrays of strings; `credit` and + `themeSwitch` booleans; `layout` `"grid"` or `"strip"`; `seeAll` an object with a string `href` and a `text` that's + absent, null or a string. `seeAll.href` is an absolute URL as above, or a relative one: not empty, no character from + U+0000 to U+0020 or U+007F, and not starting with a scheme (`^[A-Za-z][A-Za-z0-9+.-]*:`). +- Other fields, in the manifest or the options, are ignored. + ## Reading the manifest - Renderers that fetch it (at build time, or a server's `fetch` helper) **fail** when it can't be read (a network @@ -56,12 +77,14 @@ order below, a newline at the end). Renderers in other languages compare it as d ### A shot's name -Strip a trailing `.png`, `.jpg`, `.jpeg` or `.webp` (any case). Split it on `/`: the last part is `last`, the parts -before it joined with `/` are `folder` (possibly empty). Then, in this order: +Strip a trailing `.png`, `.jpg`, `.jpeg` or `.webp` (ASCII letters in any case). Split it on `/`: the last part is +`last`, the parts before it joined with `/` are `folder` (possibly empty). Then, in this order, where each pattern +must match the whole of `last` (JS `^…$` without the m flag; Ruby `\A…\z`; Python `re.fullmatch`), `[0-9]` means +ASCII digits only, and `.` means any character at all, line breaks included: -1. `last` matches `^(\d+)-(light|dark)(-2x)?$` and `folder` isn't empty: the screen key is `folder`, the CSS width +1. `last` matches `([0-9]+)-(light|dark)(-2x)?` and `folder` isn't empty: the screen key is `folder`, the CSS width is the number, the theme the word, 2x when the suffix is there. (`screenshots/app/billing/1440-dark-2x`) -2. `last` matches `^(.+?)-(light|dark)(?:-(\d+))?(-2x)?$` (the first group lazy): the key is `folder/` (when there +2. `last` matches `(.+?)-(light|dark)(?:-([0-9]+))?(-2x)?` (the first group lazy): the key is `folder/` (when there is a folder) followed by the first group; the theme, CSS width (when present) and 2x as above. (`ios/usage-light`, `overview-dark-1440`, `pages-edit-changed-light-390`) 3. Otherwise the key is the whole name without its extension, with no theme (it stands for both), no CSS width, not @@ -87,7 +110,7 @@ For each manifest group, in order, for each item, in order: ### Screens - **Title:** `options.screens[key].title`, else made from the key: drop the longest run of leading folder parts that - every screen key in the group shares (folder parts are every part but the last), then for each remaining part + every kept screen key in the group shares (screens dropped above don't count) (folder parts are every part but the last), then for each remaining part replace each run of `-` and `_` with one space and trim spaces, join the parts with `, `, and upper-case the first character (`screenshots/app/billing/free` among `screenshots/app/…` keys: "Billing, free"). Upper-casing uses the language's Unicode-aware upper case of that one character. @@ -102,7 +125,8 @@ For each manifest group, in order, for each item, in order: `0`–`9` replaced by `-`, leading and trailing `-` removed; `group` when nothing is left. A slug already taken by an earlier group (in manifest order) gets `-2`, `-3`, … appended to the base slug until it's free. - `sizes`: `desktop` and `phone`, in that order, each when any of its screens has a variant at that size. -- **Order:** names in `options.groupOrder` first, in that order; then the rest, in the manifest's order. +- **Order:** names in `options.groupOrder` first, in that order (groups with the same name keep their manifest + order); then the rest, in the manifest's order. ### The rest @@ -125,7 +149,7 @@ the default text), `headingLevel`, `id`, `credit` as above. group has a desktop variant, else `phone`. ``` -
    +
    [{title} when title isn't null] … the grid's or the strip's lines … [

    {seeAll.text}

    when seeAll] @@ -139,9 +163,9 @@ the default text), `headingLevel`, `id`, `credit` as above. with these fragments (no newlines inside them): -- `THEMES`: `
    ` +- `THEMES`: `
    ` - `SIZES(sizes, extra)`: `
    ` then for each size - ``, then `
    `. + ``, then ``. - `STEP(-1)`: ``; `STEP(1)`: the same with `1`, `Next screen` and `›`; `CLOSE`: ``. @@ -159,7 +183,7 @@ With more than one group, the tabs: Then for each group, `i` its index: ``` -