diff --git a/clients/gallery/astro/README.md b/clients/gallery/astro/README.md
index 5f72dc1e..be83ca70 100644
--- a/clients/gallery/astro/README.md
+++ b/clients/gallery/astro/README.md
@@ -20,7 +20,7 @@ import Gallery from "visualci-astro-gallery";
```
The props are `visualci-gallery`'s options (`title`, `headingLevel`, `id`, `screens`, `order`, `groups`,
-`groupOrder`, `credit`, `layout`, `themeSwitch`, `seeAll`, `preload`, `deepLinks`, `text`) and `load()`'s (`manifest`, `timeout`, `attempts`,
+`groupOrder`, `credit`, `layout`, `themeSwitch`, `seeAll`, `preload`, `deepLinks`, `text`, `search`, `zoom`, `newBadges`) and `load()`'s (`manifest`, `timeout`, `attempts`,
`fetch`). Give the gallery your site's look with the `--vg-*` CSS variables, set on `.vg` or any element around it.
They win over the component's defaults in any stylesheet order:
diff --git a/clients/gallery/astro/src/Gallery.astro b/clients/gallery/astro/src/Gallery.astro
index 63d84112..c332392a 100644
--- a/clients/gallery/astro/src/Gallery.astro
+++ b/clients/gallery/astro/src/Gallery.astro
@@ -6,7 +6,7 @@
//
//
// The props are the library's options (title, headingLevel, id, screens, order, groups, groupOrder, credit, layout,
-// themeSwitch, seeAll, preload, deepLinks, text) and load()'s (manifest, timeout, attempts, fetch). The default stylesheet comes with it; set the
+// themeSwitch, seeAll, preload, deepLinks, text, search, zoom, newBadges) and load()'s (manifest, timeout, attempts, fetch). The default stylesheet comes with it; set the
// --vg-* variables on .vg (or an ancestor) to give it the site's look.
import { load, render, type LoadOptions } from "visualci-gallery/render";
import "visualci-gallery/gallery.css";
diff --git a/clients/gallery/contract/SPEC.md b/clients/gallery/contract/SPEC.md
index 2c7faf46..b09074db 100644
--- a/clients/gallery/contract/SPEC.md
+++ b/clients/gallery/contract/SPEC.md
@@ -12,7 +12,9 @@ change, and regenerate the fixtures (`UPDATE_GOLDEN=1 pnpm test` in `../js`), re
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, bytes?, thumb?}]}]}`.
- Only `name`, `title`, `items`, and each item's `name`, `url`, `width`, `height`, `bytes` and `thumb` are read.
+ Only `name`, `title`, `items`, and each item's `name`, `url`, `width`, `height`, `bytes`, `thumb` and `since` are
+ read. `since` is when that picture was approved, an RFC 3339 time in UTC (it changes only when the image does);
+ one that isn't a string is ignored, never an error.
`bytes` is the image's size; `thumb` is a small copy for the cards, `{url, width, height, bytes?}` (VisualCI serves
a 640 px WebP of each published shot wider than that). Both are optional: a manifest without them shows the
originals in the cards and the preloader estimates sizes.
@@ -35,6 +37,9 @@ change, and regenerate the fixtures (`UPDATE_GOLDEN=1 pnpm test` in `../js`), re
| `preload` | `true` | Predictive preloading (Behaviour). `false` turns it off; `{fold?, count?, bytes?, parallel?}` sets its caps, the rest keeping their defaults (250, 500, 50000000, 4). |
| `deepLinks` | `false` | The URL's hash names the shown tab, the open screen and the chosen values, so a link opens them (Deep links). Off, the gallery never changes the page's URL. |
| `text` | `{}` | The gallery's own words, for another language or another tone (Text, below): any of its keys, each a string. |
+ | `search` | `40` | The grid's search box, which filters the cards by title and caption across tabs (Search). A number: shown once the gallery has that many screens (in every group); `true`, always; `false`, never. The strip never has one. |
+ | `zoom` | `true` | Zoom in the full-size view, by gestures and keys only (Zoom). `false` turns it off. |
+ | `newBadges` | `false` | A New badge on each screen whose picture changed in the last so many days (New badges): `true` for 30, or a whole number of days from 1 to 3650. |
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,
@@ -56,6 +61,9 @@ keeps its default:
| `forward` | `Scroll forward` | The strip's button that scrolls forward. |
| `credit` | `Screenshots by {link}` | The credit line, when `credit` is true; `{link}` is the link to VisualCI. |
| `and` | ` and ` | Between the values an image stands for in its alt text (`Light and Dark`). |
+| `search` | `Search screens` | The search box's accessible name and placeholder. |
+| `empty` | `No screens match` | What the grid says when no screen matches the search. |
+| `new` | `New` | The New badge. |
The words of the dimensions' switches are their labels (`dimensions`); the see-all link's is `seeAll.text`.
@@ -118,10 +126,12 @@ word for word, in every language. An invalid option's message names it in the co
`themeSwitch` booleans; `layout` `"grid"` or `"strip"`; `seeAll` an object with a string `href` and a `text` that's
absent, null or a string; `preload` a boolean or an object with only `fold`, `count` and `bytes` (null or a whole
number from 0 to 10^12) and `parallel` (null or a whole number from 1 to 8); `deepLinks` a boolean; `text` an object
- with only the keys of Text, each null or a string. `seeAll.href` is an absolute URL as above, or a relative one: not empty, no character from
+ with only the keys of Text, each null or a string; `search` a boolean or a whole number from 0 to 1000000; `zoom` a
+ boolean; `newBadges` a boolean or a whole number from 1 to 3650. `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+.-]*:`).
- The manifest is checked first, then the options in this order, and the first problem is the error: `headingLevel`,
- `title`, `id`, `dimensions`, `screens`, `groups`, `order`, `groupOrder`, `credit`, `themeSwitch`, `layout`, `seeAll`, `preload`, `deepLinks`, `text`.
+ `title`, `id`, `dimensions`, `screens`, `groups`, `order`, `groupOrder`, `credit`, `themeSwitch`, `layout`, `seeAll`, `preload`, `deepLinks`, `text`, `search`,
+ `zoom`, `newBadges`.
- Other fields, in the manifest or the options, are ignored.
## Reading the manifest
@@ -143,10 +153,11 @@ order below, a newline at the end). Renderers in other languages compare it as d
```
{layout, themeSwitch, seeAll: {href, text} | null, title: string | null, label, headingLevel, id, credit,
preload: null | "off" | {fold, count, bytes, parallel}, deepLinks,
- text: {label, open, previous, next, close, back, forward, credit, and},
+ text: {label, open, previous, next, close, back, forward, credit, and, search, empty, new},
+ search: boolean, zoom: boolean, newBadges: number | null,
dimensions: [{key, label, missing, values: [{key, label, below | null, shape: "landscape" | "portrait" | null}]}],
groups: [{name, title, slug, fit, values: {"": ["", …], …}, screens: [{key, title,
- caption | null, variants: [{values: {"": "", …}, url, url2x | null, width, height,
+ caption | null, since | null, variants: [{values: {"": "", …}, url, url2x | null, width, height,
bytes | null, bytes2x | null, thumb: {url, width, height, bytes | null} | null}]}]}]}
```
@@ -214,6 +225,9 @@ For each manifest group, in order:
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`.
+- **Since:** the greatest `since`, comparing strings by code point, of the manifest items whose name gives the
+ screen's key (2x copies included); items whose `since` is absent, not a string or empty don't count. `null` when
+ none has one.
- **Order:** keys in `options.order` first, in that order; then the rest, by key, comparing strings by code point.
### Groups
@@ -234,7 +248,10 @@ For each manifest group, in order:
is the title or `text.label` 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`, `deepLinks` as above. `preload`: `null` when the option is absent, null or
-true; `"off"` when false; else the caps with every key filled in from the defaults.
+true; `"off"` when false; else the caps with every key filled in from the defaults. `search` is true when the layout
+is `grid` and the option is true, or a number no greater than the number of screens in every group (absent or null:
+40); else false. `zoom` is the option, true when absent or null. `newBadges` is null when the option is absent, null
+or false; 30 when true; else the number.
## The markup
@@ -264,8 +281,9 @@ true; `"off"` when false; else the caps with every key filled in from the defaul
size values whose shape is `portrait`, joined with a space.
```
-
+
[{title} when title isn't null]
+[ when search]
… the grid's or the strip's lines …
[
when credit]
@@ -317,6 +335,12 @@ Then for each group, `i` its index:
```
+After the last panel, when `search`:
+
+```
+
{TEXT(empty)}
+```
+
### The strip
Every screen of every group, in order, that isn't off for `C`, in one row:
@@ -337,7 +361,7 @@ Every screen of every group, in order, that isn't off for `C`, in one row:
`url`, `url2x` and thumb `url`, in the order of each set's first variant; `first` is the card's image for `choice`.
```
-
{IMAGES}[{TEXT(new)} when newBadges and since]{title}[
{caption}
when wanted and not null]
```
An image, for its variants (`v` the first of them):
@@ -394,6 +418,29 @@ them. The card's link is the original.
checked again when its width changes.
- An image that can't load is replaced by its alt text, in the same place.
+### Search
+
+With a `.vg-search-input` (the `search` option), every word typed (split on white space) must appear in a card's title
+or caption, ignoring case and accents (Unicode NFD with the combining marks dropped). A card that doesn't match gets
+`data-vg-unmatched` and isn't shown, a tab none of whose shown cards match is hidden, and when the shown tab is hidden
+the first tab with a match is shown. When no tab has a match, `.vg-empty` shows. Previous and next step only through
+the cards that match. An empty box shows everything again; the switches keep filtering what they did.
+
+### Zoom
+
+Unless the section has `data-vg-zoom="off"`, the full-size view's image zooms from 1 to 8 times, with no buttons: the
+wheel with ctrl or cmd held (a trackpad's pinch), two fingers on a touch screen, a double-click on the image (2 times,
+or back to 1), and `+` (or `=`), `-` and `0` while the view has focus. The point under the pointer stays where it
+is. The image grows in the layout and the view scrolls, so a finger or the wheel pans it, and a mouse drags it while
+zoomed (the view gets `data-vg-zoomed`). Zoom is instant, so there's no motion to reduce. Another screen, or closing
+the view, starts at 1 again.
+
+### New badges
+
+With `data-vg-new="{days}"`, each card's `.vg-new` badge shows when its `data-vg-since` is in the past and less than
+that many days ago, by the reader's clock. It's decided in the browser, so a page built long ago never calls an old
+screen new. `since` changes whenever a screen's picture does, so a restyle that changes every screen marks them all.
+
### Deep links
With `data-vg-links` (the `deepLinks` option), the page's URL hash names what the gallery shows:
diff --git a/clients/gallery/contract/fixtures/dimensions/model.json b/clients/gallery/contract/fixtures/dimensions/model.json
index 2ee459f0..db64ae72 100644
--- a/clients/gallery/contract/fixtures/dimensions/model.json
+++ b/clients/gallery/contract/fixtures/dimensions/model.json
@@ -18,8 +18,14 @@
"back": "Scroll back",
"forward": "Scroll forward",
"credit": "Screenshots by {link}",
- "and": " and "
+ "and": " and ",
+ "search": "Search screens",
+ "empty": "No screens match",
+ "new": "New"
},
+ "search": false,
+ "zoom": true,
+ "newBadges": null,
"dimensions": [
{
"key": "theme",
@@ -132,6 +138,7 @@
"key": "pricing",
"title": "Pricing",
"caption": null,
+ "since": "2026-12-01T09:00:00+00:00",
"variants": [
{
"values": {
@@ -307,6 +314,7 @@
"key": "home",
"title": "Home",
"caption": null,
+ "since": "2026-12-01T09:00:00+00:00",
"variants": [
{
"values": {
@@ -818,6 +826,7 @@
"key": "settings",
"title": "Settings",
"caption": null,
+ "since": "2026-12-01T09:00:00+00:00",
"variants": [
{
"values": {
@@ -930,6 +939,7 @@
"key": "docs/start",
"title": "Start",
"caption": null,
+ "since": "2026-12-01T09:00:00+00:00",
"variants": [
{
"values": {
diff --git a/clients/gallery/contract/fixtures/duplicates/model.json b/clients/gallery/contract/fixtures/duplicates/model.json
index 0219481a..608fbf4c 100644
--- a/clients/gallery/contract/fixtures/duplicates/model.json
+++ b/clients/gallery/contract/fixtures/duplicates/model.json
@@ -18,8 +18,14 @@
"back": "Scroll back",
"forward": "Scroll forward",
"credit": "Screenshots by {link}",
- "and": " and "
+ "and": " and ",
+ "search": "Search screens",
+ "empty": "No screens match",
+ "new": "New"
},
+ "search": false,
+ "zoom": true,
+ "newBadges": null,
"dimensions": [
{
"key": "theme",
@@ -80,6 +86,7 @@
"key": "a/b/home",
"title": "Home",
"caption": null,
+ "since": "2026-12-01T09:00:00+00:00",
"variants": [
{
"values": {
@@ -130,6 +137,7 @@
"key": "ios/home",
"title": "Home",
"caption": null,
+ "since": "2026-12-01T09:00:00+00:00",
"variants": [
{
"values": {
@@ -180,6 +188,7 @@
"key": "web2/x",
"title": "X",
"caption": null,
+ "since": "2026-12-01T09:00:00+00:00",
"variants": [
{
"values": {
@@ -230,6 +239,7 @@
"key": "x/١٤٤٠",
"title": "X, ١٤٤٠",
"caption": null,
+ "since": "2026-12-01T09:00:00+00:00",
"variants": [
{
"values": {
@@ -263,6 +273,7 @@
"key": "y",
"title": "Y",
"caption": "",
+ "since": "2026-12-01T09:00:00+00:00",
"variants": [
{
"values": {
diff --git a/clients/gallery/contract/fixtures/escaping/model.json b/clients/gallery/contract/fixtures/escaping/model.json
index 8a082cc6..2acdd2ae 100644
--- a/clients/gallery/contract/fixtures/escaping/model.json
+++ b/clients/gallery/contract/fixtures/escaping/model.json
@@ -18,8 +18,14 @@
"back": "Scroll back",
"forward": "Scroll forward",
"credit": "Screenshots by {link}",
- "and": " and "
+ "and": " and ",
+ "search": "Search screens",
+ "empty": "No screens match",
+ "new": "New"
},
+ "search": false,
+ "zoom": true,
+ "newBadges": null,
"dimensions": [
{
"key": "theme",
@@ -80,6 +86,7 @@
"key": "q&a",
"title": "Q&a",
"caption": "Ask & answer ",
+ "since": "2026-12-01T09:00:00+00:00",
"variants": [
{
"values": {
@@ -130,6 +137,7 @@
"key": "café",
"title": "Café",
"caption": null,
+ "since": "2026-12-01T09:00:00+00:00",
"variants": [
{
"values": {
@@ -180,6 +188,7 @@
"key": "x",
"title": "X",
"caption": null,
+ "since": "2026-12-01T09:00:00+00:00",
"variants": [
{
"values": {
diff --git a/clients/gallery/contract/fixtures/extras/gallery.html b/clients/gallery/contract/fixtures/extras/gallery.html
new file mode 100644
index 00000000..37811511
--- /dev/null
+++ b/clients/gallery/contract/fixtures/extras/gallery.html
@@ -0,0 +1,26 @@
+
+
`);
}
function strip(model: Model, id: string, choice: Choice, ch: string, out: string[]) {
diff --git a/clients/gallery/js/test/hydrate.test.ts b/clients/gallery/js/test/hydrate.test.ts
index ba885a51..bd1cf376 100644
--- a/clients/gallery/js/test/hydrate.test.ts
+++ b/clients/gallery/js/test/hydrate.test.ts
@@ -574,3 +574,90 @@ describe("dimensions", () => {
expect(shown("docs/start")).toMatch(/docs\/start-light-fr-1440\.png$/); // English chosen; Docs is French only
});
});
+
+describe("search, zoom and New badges", () => {
+ const search = (text: string) => {
+ const input = q(".vg-search-input");
+ input.value = text;
+ input.dispatchEvent(new Event("input"));
+ };
+ const shownCards = () =>
+ Array.from(document.querySelectorAll(".vg-panel:not([hidden]) .vg-card"))
+ .filter((c) => !c.hasAttribute("data-vg-unmatched") && !c.hasAttribute("data-vg-off"))
+ .map((c) => c.dataset.vgScreen);
+
+ it("filter cards by title and caption across tabs, ignoring case and accents", () => {
+ page("extras");
+ search("INVOICES");
+ expect(shownCards()).toEqual(["billing"]);
+ expect(q("#vg-tab-phone").hidden).toBe(true);
+ search("inbóx");
+ // The shown tab has no match: the first tab that has one is shown.
+ expect(q("#vg-panel-phone").hidden).toBe(false);
+ expect(q("#vg-tab-app").hidden).toBe(true);
+ expect(shownCards()).toEqual(["inbox"]);
+ expect(q(".vg-empty").hidden).toBe(true);
+ search("nothing like it");
+ expect(q(".vg-empty").hidden).toBe(false);
+ search("");
+ expect(q("#vg-tab-app").hidden).toBe(false);
+ expect(q("#vg-tab-phone").hidden).toBe(false);
+ expect(q(".vg-empty").hidden).toBe(true);
+ expect(shownCards()).toEqual(["inbox"]);
+ });
+
+ it("step only through the screens the search shows", () => {
+ page("extras");
+ search("home");
+ click(q('[data-vg-screen="home"] a'));
+ click(q('.vg-box [data-vg-step="1"]'));
+ expect(q(".vg-box-title").textContent).toBe("Home");
+ });
+
+ it("show a New badge only within its window, decided in the browser", () => {
+ vi.useFakeTimers({ now: new Date("2026-12-10T00:00:00Z"), toFake: ["Date"] });
+ try {
+ page("extras");
+ expect(q('[data-vg-screen="home"] .vg-new').hidden).toBe(false);
+ expect(q('[data-vg-screen="inbox"] .vg-new').hidden).toBe(true);
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
+ it("zoom with the keys and reset on the next screen; never with data-vg-zoom=off", () => {
+ page("visualci");
+ const first = document.querySelector(".vg-panel:not([hidden]) .vg-card a")!;
+ click(first);
+ const view = q(".vg-box-view");
+ const key = (k: string) =>
+ view.dispatchEvent(new KeyboardEvent("keydown", { key: k, bubbles: true, cancelable: true }));
+ key("+");
+ expect(view.hasAttribute("data-vg-zoomed")).toBe(true);
+ expect(view.querySelector("img")!.style.width).not.toBe("");
+ key("0");
+ expect(view.hasAttribute("data-vg-zoomed")).toBe(false);
+ key("+");
+ click(q('.vg-box [data-vg-step="1"]'));
+ expect(view.hasAttribute("data-vg-zoomed")).toBe(false);
+
+ page("extras");
+ click(q('[data-vg-screen="home"] a'));
+ q(".vg-box-view").dispatchEvent(new KeyboardEvent("keydown", { key: "+", bubbles: true }));
+ expect(q(".vg-box-view").hasAttribute("data-vg-zoomed")).toBe(false);
+ });
+
+ it("zoom with ctrl-wheel about the pointer, and scroll with a plain wheel", () => {
+ page("visualci");
+ click(document.querySelector(".vg-panel:not([hidden]) .vg-card a")!);
+ const view = q(".vg-box-view");
+ const plain = new WheelEvent("wheel", { deltaY: -100, cancelable: true });
+ view.dispatchEvent(plain);
+ expect(plain.defaultPrevented).toBe(false);
+ expect(view.hasAttribute("data-vg-zoomed")).toBe(false);
+ const pinch = new WheelEvent("wheel", { deltaY: -100, ctrlKey: true, cancelable: true });
+ view.dispatchEvent(pinch);
+ expect(pinch.defaultPrevented).toBe(true);
+ expect(view.hasAttribute("data-vg-zoomed")).toBe(true);
+ });
+});
diff --git a/clients/gallery/python/README.md b/clients/gallery/python/README.md
index db8b4d98..576ed83b 100644
--- a/clients/gallery/python/README.md
+++ b/clients/gallery/python/README.md
@@ -64,8 +64,12 @@ for an app's windows), `group_order`, `credit`, `layout` (`"grid"` or `"strip"`)
`preload` (`False` turns predictive preloading off; `{"count": 100, "bytes": 20_000_000}` sets its caps, any of
`fold`, `count`, `bytes` and `parallel`, the rest keeping their defaults), `deep_links` (`True`: the URL's hash names
the shown tab, screen and values, so a link opens them), `text` (the gallery's own words, for another language: any of
-`label`, `open`, `previous`, `next`, `close`, `back`, `forward`, `credit` and `and`, such as `{"close": "Fermer"}`;
-`visualci_gallery.TEXT_DEFAULTS` has the defaults).
+`label`, `open`, `previous`, `next`, `close`, `back`, `forward`, `credit`, `and`, `search`, `empty` and `new`, such as
+`{"close": "Fermer"}`; `visualci_gallery.TEXT_DEFAULTS` has the defaults), `search` (the grid's search box, which
+filters the cards by title and caption across tabs: a number, default 40, shows it once the gallery has that many
+screens; `True`, always; `False`, never), `zoom` (default `True`: zoom in the full-size view by pinch, ctrl-wheel,
+double-click and the `+` and `-` keys; `False` turns it off) and `new_badges` (a New badge on each screen whose
+picture changed in the last so many days: `True` for 30, or a whole number from 1 to 3650; default `False`).
## Development
diff --git a/clients/gallery/python/src/visualci_gallery/__init__.py b/clients/gallery/python/src/visualci_gallery/__init__.py
index f394e20b..7bde39b1 100644
--- a/clients/gallery/python/src/visualci_gallery/__init__.py
+++ b/clients/gallery/python/src/visualci_gallery/__init__.py
@@ -62,7 +62,7 @@ def fetch(url: str, *, timeout: float = 20, attempts: int = 3) -> Any:
def render(manifest: Any, **options: Any) -> str:
"""The gallery's HTML for a parsed manifest. Options are the contract's, in Python spelling: title (None for no
heading), heading_level, id, dimensions, screens, order, groups, group_order, credit, layout, theme_switch, see_all, preload,
- deep_links, text.
+ deep_links, text, search, zoom, new_badges.
Raises GalleryError when the manifest or the options are invalid or nothing in the manifest can be shown."""
return render_model(build_model(manifest, **options))
diff --git a/clients/gallery/python/src/visualci_gallery/_model.py b/clients/gallery/python/src/visualci_gallery/_model.py
index f86a2c46..daeb1099 100644
--- a/clients/gallery/python/src/visualci_gallery/_model.py
+++ b/clients/gallery/python/src/visualci_gallery/_model.py
@@ -21,7 +21,14 @@
"forward": "Scroll forward",
"credit": "Screenshots by {link}",
"and": " and ",
+ "search": "Search screens",
+ "empty": "No screens match",
+ "new": "New",
}
+# The search box's default threshold: shown once the gallery has this many screens.
+SEARCH_FROM = 40
+# The New badge's default window, in days.
+NEW_DAYS = 30
SEE_ALL_TEXT = "See all screenshots"
# The built-in dimensions (contract/SPEC.md, "Dimensions"): the `dimensions` option changes them and adds others.
DEFAULT_DIMENSIONS: list[dict[str, Any]] = [
@@ -458,6 +465,9 @@ def build_model(
preload: Any = None,
deep_links: Any = None,
text: Any = None,
+ search: Any = None,
+ zoom: Any = None,
+ new_badges: Any = None,
) -> dict[str, Any]:
"""The manifest as the gallery shows it (contract/SPEC.md), as a dict with the keys of the fixtures' model.json.
Raises GalleryError when it or the options are invalid, or nothing in it can be shown."""
@@ -500,6 +510,13 @@ def build_model(
words = {k: text_opt[k] if text_opt.get(k) is not None else d for k, d in TEXT_DEFAULTS.items()}
if title is _UNSET:
title = words["label"]
+ # A boolean, or a whole number in range: True is a boolean here, never the number 1.
+ search = _opt(search, lambda v: isinstance(v, bool) or (_integral(v) and 0 <= v <= MAX_SIZE), "search")
+ search = SEARCH_FROM if search is None else search
+ zoom = _opt(zoom, lambda v: isinstance(v, bool), "zoom")
+ zoom = True if zoom is None else zoom
+ new_badges = _opt(new_badges, lambda v: isinstance(v, bool) or (_integral(v) and 1 <= v <= 3650), "newBadges")
+ new_badges = False if new_badges is None else new_badges
slugs: set[str] = set()
def rank_of(v: dict[str, Any]) -> list[int]:
@@ -519,8 +536,13 @@ def rank_of(v: dict[str, Any]) -> list[int]:
keys = [v["key"] for v in d["values"] if any(shot["values"].get(d["key"]) == v["key"] for _, shot in shots)]
named[d["key"]] = keys or [d["values"][0]["key"]]
found: dict[str, dict[str, dict[str, Any]]] = {}
+ sinces: dict[str, str] = {}
for item, shot in shots:
variants = found.setdefault(shot["key"], {})
+ # Compared by code point (Python's str order): VisualCI writes every time in the same RFC 3339 form, in UTC.
+ since = item.get("since")
+ if isinstance(since, str) and since != "" and (shot["key"] not in sinces or since > sinces[shot["key"]]):
+ sinces[shot["key"]] = since
given = shot["values"]
for values in _combinations(dims, lambda d: [given[d["key"]]] if d["key"] in given else named[d["key"]]):
v = variants.setdefault(
@@ -589,6 +611,7 @@ def rank_of(v: dict[str, Any]) -> list[int]:
"key": key,
"title": screen.get("title") if screen.get("title") is not None else humanize(key.split("/")[prefix:]),
"caption": screen.get("caption"),
+ "since": sinces.get(key),
"variants": variants,
}
)
@@ -615,6 +638,7 @@ def rank_of(v: dict[str, Any]) -> list[int]:
)
if not built:
_fail("the gallery manifest has no screenshots to show")
+ screen_count = sum(len(g["screens"]) for g in built)
# Named groups first; the rest keep the manifest's order (the sort is stable).
group_rank = _rank_by(group_order)
@@ -636,6 +660,9 @@ def rank_of(v: dict[str, Any]) -> list[int]:
"preload": _preload_model(preload),
"deepLinks": deep_links,
"text": words,
+ "search": layout == "grid" and (search is True or (search is not False and screen_count >= search)),
+ "zoom": zoom,
+ "newBadges": None if new_badges is False else NEW_DAYS if new_badges is True else int(new_badges),
"dimensions": _with_shapes(dims, built),
"groups": built,
}
diff --git a/clients/gallery/python/src/visualci_gallery/_render.py b/clients/gallery/python/src/visualci_gallery/_render.py
index a2d3d392..67191b60 100644
--- a/clients/gallery/python/src/visualci_gallery/_render.py
+++ b/clients/gallery/python/src/visualci_gallery/_render.py
@@ -153,14 +153,17 @@ def shown(i: list[dict[str, Any]]) -> str | None:
marks = [t for t in ("light", "dark") if holds(i, _card_combo(model, sc, {**choice, "theme": t}))]
return " ".join(marks) if marks else None
+ badge = model["newBadges"] is not None and sc["since"] is not None
return (
f'
'
+ end
+
def test_parse_shot_and_titles
assert_equal({ key: 'shots/app/billing', values: { 'theme' => 'dark' }, x2: true, css_width: 1440 },
VisualCI::Gallery.parse_shot('shots/app/billing/1440-dark-2x'))
diff --git a/clients/gallery/rust/README.md b/clients/gallery/rust/README.md
index 290b0a55..52c0eed0 100644
--- a/clients/gallery/rust/README.md
+++ b/clients/gallery/rust/README.md
@@ -39,7 +39,8 @@ which sets `window.VisualCIGallery`), then
## Options
`Options::default()` and its setters (`title`, `heading_level`, `id`, `dimension`, `screen`, `order`, `group`,
-`group_order`, `credit`, `layout`, `theme_switch`, `see_all`, `preload`, `preload_caps`, `deep_links`, `text`), or
+`group_order`, `credit`, `layout`, `theme_switch`, `see_all`, `preload`, `preload_caps`, `deep_links`, `text`, `search`,
+`search_from`, `zoom`, `new_badges`, `new_badges_days`), or
`Options::from_json` with the contract's JSON names.
Shots differ by theme (light, dark) and size (desktop, phone) out of the box. `.dimension(key, label, missing, values)`
@@ -63,8 +64,8 @@ let options = Options::default().preload_caps(None, Some(100), Some(20_000_000),
`.deep_links(true)` makes the page's URL name the open tab, screen and values, so a link opens them. `.text(key,
value)` changes one of the gallery's own words, for another language: `label`, `open` (`{title}` is the screen's title),
-`previous`, `next`, `close`, `back`, `forward`, `credit` (`{link}` is the link to VisualCI) or `and`. An unknown key
-is an error when the gallery renders.
+`previous`, `next`, `close`, `back`, `forward`, `credit` (`{link}` is the link to VisualCI), `and`, `search`, `empty`
+or `new`. An unknown key is an error when the gallery renders.
```rust
use visualci_gallery::Options;
@@ -72,6 +73,18 @@ use visualci_gallery::Options;
let options = Options::default().deep_links(true).text("label", "Captures d'écran").text("close", "Fermer");
```
+The grid gets a search box, which filters the cards by title and caption across tabs, once the gallery has 40
+screens: `.search_from(n)` changes that number (0 to 1000000), `.search(true)` always shows it and `.search(false)`
+never does. The strip has none. Zoom in the full-size view (pinch, ctrl-wheel, double-click, `+` and `-`) is on by
+default; `.zoom(false)` turns it off. `.new_badges(true)` puts a New badge on each screen whose picture changed in the
+last 30 days, decided in the reader's browser; `.new_badges_days(days)` sets the window (1 to 3650):
+
+```rust
+use visualci_gallery::Options;
+
+let options = Options::default().search_from(10).zoom(false).new_badges_days(14);
+```
+
## Development
`cargo test --all-features` checks the contract's golden fixtures, refusals and messages.
diff --git a/clients/gallery/rust/src/lib.rs b/clients/gallery/rust/src/lib.rs
index 6847eb9b..094293e1 100644
--- a/clients/gallery/rust/src/lib.rs
+++ b/clients/gallery/rust/src/lib.rs
@@ -25,9 +25,9 @@ mod render;
use std::fmt;
pub use model::{
- Dimension, DimensionValue, Group, Missing, Model, Options, Preload, PreloadCaps, SEE_ALL_TEXT, Screen, SeeAll,
- Shape, Shot, TEXT_DEFAULTS, Text, Thumb, Values, Variant, build_model, default_dimensions, humanize, parse_shot,
- slugify,
+ Dimension, DimensionValue, Group, Missing, Model, NEW_DAYS, Options, Preload, PreloadCaps, SEARCH_FROM,
+ SEE_ALL_TEXT, Screen, SeeAll, Shape, Shot, TEXT_DEFAULTS, Text, Thumb, Values, Variant, build_model,
+ default_dimensions, humanize, parse_shot, slugify,
};
pub use render::{escape, render_model};
diff --git a/clients/gallery/rust/src/model.rs b/clients/gallery/rust/src/model.rs
index 13523817..53f1d33a 100644
--- a/clients/gallery/rust/src/model.rs
+++ b/clients/gallery/rust/src/model.rs
@@ -11,7 +11,7 @@ use serde_json::{Map, Value};
use crate::Error;
/// The gallery's own words by key, with their defaults (contract/SPEC.md, "Text"), in the model's order.
-pub const TEXT_DEFAULTS: [(&str, &str); 9] = [
+pub const TEXT_DEFAULTS: [(&str, &str); 12] = [
("label", "Screenshots"),
("open", "{title}: view full size"),
("previous", "Previous screen"),
@@ -21,8 +21,15 @@ pub const TEXT_DEFAULTS: [(&str, &str); 9] = [
("forward", "Scroll forward"),
("credit", "Screenshots by {link}"),
("and", " and "),
+ ("search", "Search screens"),
+ ("empty", "No screens match"),
+ ("new", "New"),
];
pub const SEE_ALL_TEXT: &str = "See all screenshots";
+/// The search box's default threshold: shown once the gallery has this many screens.
+pub const SEARCH_FROM: u64 = 40;
+/// The New badge's default window, in days.
+pub const NEW_DAYS: u64 = 30;
// Whole-string matches (\A…\z), ASCII digits only and "any character" including line breaks, so every language's
// regex engine agrees (contract/SPEC.md, "A shot's name").
@@ -184,6 +191,8 @@ pub struct Screen {
pub key: String,
pub title: String,
pub caption: Option,
+ /// The newest `since` of the manifest items it's made from (the last time one of its pictures changed).
+ pub since: Option,
pub variants: Vec,
}
@@ -218,6 +227,9 @@ pub struct Text {
pub forward: String,
pub credit: String,
pub and: String,
+ pub search: String,
+ pub empty: String,
+ pub new: String,
}
impl Text {
@@ -234,6 +246,9 @@ impl Text {
forward: w("forward"),
credit: w("credit"),
and: w("and"),
+ search: w("search"),
+ empty: w("empty"),
+ new: w("new"),
}
}
}
@@ -260,6 +275,11 @@ pub struct Model {
pub preload: Option,
pub deep_links: bool,
pub text: Text,
+ /// Whether the grid shows its search box.
+ pub search: bool,
+ pub zoom: bool,
+ /// The New badge's window in days; None: no badges.
+ pub new_badges: Option,
pub dimensions: Vec,
pub groups: Vec,
}
@@ -648,9 +668,30 @@ impl Options {
pub fn deep_links(self, on: bool) -> Self {
self.set("deepLinks", on.into())
}
+ /// The grid's search box, which filters the cards by title and caption across tabs: `true` always shows it,
+ /// `false` never. By default it shows once the gallery has 40 screens; the strip never has one.
+ pub fn search(self, on: bool) -> Self {
+ self.set("search", on.into())
+ }
+ /// The grid's search box, shown once the gallery has this many screens (in every group), from 0 to 1000000.
+ pub fn search_from(self, screens: u64) -> Self {
+ self.set("search", screens.into())
+ }
+ /// Zoom in the full-size view, by gestures and keys only: on by default, `false` turns it off.
+ pub fn zoom(self, on: bool) -> Self {
+ self.set("zoom", on.into())
+ }
+ /// A New badge on each screen whose picture changed in the last 30 days (`true`); off by default.
+ pub fn new_badges(self, on: bool) -> Self {
+ self.set("newBadges", on.into())
+ }
+ /// A New badge on each screen whose picture changed in the last `days` days, from 1 to 3650.
+ pub fn new_badges_days(self, days: u64) -> Self {
+ self.set("newBadges", days.into())
+ }
/// One of the gallery's own words, by key (contract/SPEC.md, "Text"): `label`, `open` (`{title}` is the screen's
- /// title), `previous`, `next`, `close`, `back`, `forward`, `credit` (`{link}` is the link to VisualCI) or `and`. An
- /// unknown key makes the options invalid.
+ /// title), `previous`, `next`, `close`, `back`, `forward`, `credit` (`{link}` is the link to VisualCI), `and`,
+ /// `search`, `empty` or `new`. An unknown key makes the options invalid.
pub fn text(mut self, key: &str, value: &str) -> Self {
let text = self.raw.entry("text").or_insert_with(|| Value::Object(Map::new()));
if let Value::Object(m) = text {
@@ -933,6 +974,13 @@ pub fn build_model(manifest: &Value, options: &Options) -> Result
})?;
let text = Text::with(|k| text_opt.and_then(|t| t.get(k)).and_then(Value::as_str).map(str::to_string));
let title = title_opt.unwrap_or_else(|| Some(text.label.clone()));
+ let search_opt = options.get("search", |v| v.is_boolean() || whole_in(v, 0, MAX_SIZE).is_some())?;
+ let zoom = options.get("zoom", Value::is_boolean)?.and_then(Value::as_bool).unwrap_or(true);
+ let new_badges = match options.get("newBadges", |v| v.is_boolean() || whole_in(v, 1, 3650).is_some())? {
+ None | Some(Value::Bool(false)) => None,
+ Some(Value::Bool(true)) => Some(NEW_DAYS),
+ Some(v) => integral(v).map(|n| n as u64),
+ };
let rank_of = |v: &Variant| -> Vec {
dimensions.iter().map(|d| d.values.iter().position(|x| x.key == v.values[&d.key]).unwrap()).collect()
};
@@ -968,7 +1016,13 @@ pub fn build_model(manifest: &Value, options: &Options) -> Result
.collect();
// Screens in the order their key first appears, each with its variants in the order they were first filed.
let mut screens: Vec<(String, Vec<(String, Variant)>)> = Vec::new();
+ let mut sinces: HashMap = HashMap::new();
for (item, shot) in items.iter().zip(&shots) {
+ // Compared by code point: VisualCI writes every time in the same RFC 3339 form, in UTC.
+ let since = item.get("since").and_then(Value::as_str).filter(|s| !s.is_empty());
+ if let Some(since) = since.filter(|s| sinces.get(&shot.key).is_none_or(|was| *s > was.as_str())) {
+ sinces.insert(shot.key.clone(), since.into());
+ }
let (w, h) = (size_of(item.get("width")).unwrap(), size_of(item.get("height")).unwrap());
let url = item["url"].as_str().unwrap();
let at = match screens.iter().position(|(k, _)| *k == shot.key) {
@@ -1068,7 +1122,8 @@ pub fn build_model(manifest: &Value, options: &Options) -> Result
humanize(&parts)
});
let caption = set.and_then(|s| s.get("caption")).and_then(Value::as_str).map(str::to_string);
- Screen { key, title, caption, variants }
+ let since = sinces.get(&key).cloned();
+ Screen { key, title, caption, since, variants }
})
.collect();
// Rust compares strings by code point, as the contract does.
@@ -1094,6 +1149,13 @@ pub fn build_model(manifest: &Value, options: &Options) -> Result
}
// Named groups first; the rest keep the manifest's order (the sort is stable).
groups.sort_by_key(|g| rank(&group_order, &g.name));
+ let screen_count = groups.iter().map(|g| g.screens.len() as u64).sum::();
+ let search = layout == "grid"
+ && match search_opt {
+ None => screen_count >= SEARCH_FROM,
+ Some(Value::Bool(on)) => *on,
+ Some(v) => integral(v).is_some_and(|n| screen_count as f64 >= n),
+ };
Ok(Model {
theme_switch: layout == "grid" && switch,
@@ -1110,6 +1172,9 @@ pub fn build_model(manifest: &Value, options: &Options) -> Result
preload,
deep_links,
text,
+ search,
+ zoom,
+ new_badges,
dimensions: with_shapes(dimensions, &groups),
groups,
})
diff --git a/clients/gallery/rust/src/render.rs b/clients/gallery/rust/src/render.rs
index a155646a..87d84b6d 100644
--- a/clients/gallery/rust/src/render.rs
+++ b/clients/gallery/rust/src/render.rs
@@ -175,12 +175,19 @@ fn card(
let off = if card_off(model, sc, choice) { " data-vg-off" } else { "" };
let fit = if g.fit == "contain" { r#" data-vg-fit="contain""# } else { "" };
let images: String = imgs.iter().map(|i| image(model, g, &sc.title, i, shown(i))).collect();
+ let (since, badge) = match (&model.new_badges, &sc.since) {
+ (Some(_), Some(s)) => (
+ format!(r#" data-vg-since="{}""#, escape(s)),
+ format!(r#"{}"#, escape(&model.text.new)),
+ ),
+ _ => (String::new(), String::new()),
+ };
let caption = match (&sc.caption, caption) {
(Some(c), true) => format!(r#"
"#, escape(&model.text.empty)));
+ }
}
fn strip(model: &Model, id: &str, choice: &Choice, ch: &str, out: &mut Vec) {
@@ -367,14 +377,22 @@ pub fn render_model(model: &Model) -> String {
}
};
let links = if model.deep_links { " data-vg-links" } else { "" };
+ let zoom = if model.zoom { "" } else { r#" data-vg-zoom="off""# };
+ let new = model.new_badges.map_or(String::new(), |days| format!(r#" data-vg-new="{days}""#));
out.push(format!(
- r#""#,
+ r#""#,
model.layout,
escape(&model.label)
));
if let Some(title) = &model.title {
out.push(format!(r#"<{h} class="vg-title">{}{h}>"#, escape(title), h = h(0)));
}
+ if model.search {
+ let words = escape(&model.text.search);
+ out.push(format!(
+ r#""#
+ ));
+ }
if model.layout == "strip" {
strip(model, &id, &choice, &h(below), &mut out);
} else {
diff --git a/clients/gallery/rust/tests/contract.rs b/clients/gallery/rust/tests/contract.rs
index 1f73421a..e4b7af71 100644
--- a/clients/gallery/rust/tests/contract.rs
+++ b/clients/gallery/rust/tests/contract.rs
@@ -171,6 +171,33 @@ fn text_builder_matches_json_options() {
assert!(matches!(render(&manifest, &invalid), Err(Error::Invalid(m)) if m == "gallery option text is invalid"));
}
+#[test]
+fn search_zoom_and_new_badges_builders_match_json_options() {
+ let dir = contract().join("fixtures/extras");
+ let manifest = read(&dir.join("manifest.json"));
+ let from_json = Options::from_json(&read(&dir.join("options.json"))).unwrap();
+ let built = Options::default()
+ .search_from(3)
+ .zoom(false)
+ .new_badges_days(14)
+ .screen("billing", None, Some("Plans & invoices"))
+ .text("search", "Find a screen")
+ .text("empty", "Nothing found")
+ .text("new", "Fresh");
+ assert_eq!(render(&manifest, &from_json).unwrap(), render(&manifest, &built).unwrap());
+ // true: always a search box, and New badges for 30 days; false: neither.
+ let model = build_model(&manifest, &Options::default().search(true).new_badges(true)).unwrap();
+ assert_eq!((model.search, model.zoom, model.new_badges), (true, true, Some(30)));
+ let model = build_model(&manifest, &Options::default().search(false).new_badges(false)).unwrap();
+ assert_eq!((model.search, model.new_badges), (false, None));
+ let invalid = Options::default().new_badges_days(3651);
+ assert!(
+ matches!(render(&manifest, &invalid), Err(Error::Invalid(m)) if m == "gallery option newBadges is invalid")
+ );
+ let invalid = Options::default().search_from(1_000_001);
+ assert!(matches!(render(&manifest, &invalid), Err(Error::Invalid(m)) if m == "gallery option search is invalid"));
+}
+
#[test]
fn gallery_displays_its_html() {
let dir = contract().join("fixtures/single-group");
diff --git a/frontend/content/changelog/2026-12-06-0330-gallery-libraries-050-search-zoom-new-badges.md b/frontend/content/changelog/2026-12-06-0330-gallery-libraries-050-search-zoom-new-badges.md
new file mode 100644
index 00000000..ffb6e80d
--- /dev/null
+++ b/frontend/content/changelog/2026-12-06-0330-gallery-libraries-050-search-zoom-new-badges.md
@@ -0,0 +1 @@
+**Gallery libraries 0.5.0:** three options, each quiet until a gallery needs it. `search` puts a box over the grid once it has 40 screens (or your own number, or always, or never) that filters cards by title and caption across tabs. `zoom` lets a reader pinch, ctrl-scroll, double-click or press + and - in the full-size view, with no buttons; on by default. `newBadges` marks the screens whose picture changed in the last 30 days (or your own number), decided in the reader's browser so an old build doesn't keep calling them new; off by default. Every language and the Hugo module have all three. [Options](/docs/gallery/options/#search)
diff --git a/frontend/content/docs/gallery/hugo.md b/frontend/content/docs/gallery/hugo.md
index 78f34a7c..1157b036 100644
--- a/frontend/content/docs/gallery/hugo.md
+++ b/frontend/content/docs/gallery/hugo.md
@@ -47,7 +47,7 @@ Use `{{< >}}`, not `{{% %}}`, so Markdown leaves the gallery's HTML alone. Each
## Options
-Options go inside the shortcode as YAML, in the gallery's own spelling (`headingLevel`, `groupOrder`, `themeSwitch`, `seeAll`, `deepLinks`). On this page the gallery gets a heading, and two screens get a title and a caption. `order` puts two screens first. The Mac approver group gets a new title and shows its windows whole, and the iPhone tab comes first:
+Options go inside the shortcode as YAML, in the gallery's own spelling (`headingLevel`, `groupOrder`, `themeSwitch`, `seeAll`, `deepLinks`, `newBadges`). On this page the gallery gets a heading, and two screens get a title and a caption. `order` puts two screens first. The Mac approver group gets a new title and shows its windows whole, and the iPhone tab comes first:
```md
diff --git a/frontend/content/docs/gallery/mkdocs.md b/frontend/content/docs/gallery/mkdocs.md
index 64b83278..45fbfa92 100644
--- a/frontend/content/docs/gallery/mkdocs.md
+++ b/frontend/content/docs/gallery/mkdocs.md
@@ -71,7 +71,7 @@ The block is YAML: `manifest`, then the gallery's options. Each manifest is read
## Options
-The options are the [Python package's](/docs/gallery/python/), in its spelling (`heading_level`, `group_order`, `theme_switch`, `see_all`, `deep_links`), passed to it as they are. On this page the gallery gets a heading, and two screens get a title and a caption. `order` puts two screens first. The Mac approver group gets a new title and shows its windows whole, and the iPhone tab comes first:
+The options are the [Python package's](/docs/gallery/python/), in its spelling (`heading_level`, `group_order`, `theme_switch`, `see_all`, `deep_links`, `new_badges`), passed to it as they are. On this page the gallery gets a heading, and two screens get a title and a caption. `order` puts two screens first. The Mac approver group gets a new title and shows its windows whole, and the iPhone tab comes first:
````md
diff --git a/frontend/content/docs/gallery/options.md b/frontend/content/docs/gallery/options.md
index ef68d687..01b09b82 100644
--- a/frontend/content/docs/gallery/options.md
+++ b/frontend/content/docs/gallery/options.md
@@ -81,6 +81,9 @@ Every option is optional. Ruby and Python spell the multi-word ones in snake cas
| `preload` | `preload` | `.preload(false)`, `.preload_caps(fold, count, bytes, parallel)` | `true` | Preloading the images a reader is likely to look at next ([below](#preloading)). `false` turns it off. `{"count": 200, "bytes": 20000000}` sets your own limits: `fold`, `count`, `bytes` and `parallel`, the rest keeping their defaults. |
| `deepLinks` | `deep_links` | `.deep_links(true)` | `false` | The page's URL names the open tab, screen and values, so a link opens them ([below](#deep-links)). Off, the gallery never changes the URL. |
| `text` | `text` | `.text("close", "Fermer")` | `{}` | The gallery's own words, for another language ([below](#your-own-words)). |
+| `search` | `search` | `.search(true)`, `.search_from(20)` | `40` | A search box over the grid ([below](#search)). A number shows it once the gallery has that many screens; `true` always, `false` never. The strip has none. |
+| `zoom` | `zoom` | `.zoom(false)` | `true` | Zoom in the full-size view, by pinching, ctrl-scrolling, double-clicking and the + and - keys ([below](#zoom)). No buttons. |
+| `newBadges` | `new_badges` | `.new_badges(true)`, `.new_badges_days(14)` | `false` | A New badge on screens whose picture changed recently ([below](#new-badges)): `true` for the last 30 days, or a number of days. |
A library refuses options it can't use (an `id` that isn't a valid id, a `layout` it doesn't know) with an error that names the option, so a typo fails your build instead of rendering something else.
@@ -117,6 +120,9 @@ labels, so a French site changes those too. These are the options of the gallery
| `back`, `forward` | `Scroll back`, `Scroll forward` | The strip's scroll buttons. |
| `credit` | `Screenshots by {link}` | The credit line (with `credit` on). `{link}` is the link to VisualCI. |
| `and` | ` and ` | Between the values an image stands for in its description: "Billing, Light and Dark". |
+| `search` | `Search screens` | The search box's placeholder and its name for screen readers. |
+| `empty` | `No screens match` | What the grid says when nothing matches the search. |
+| `new` | `New` | The New badge. |
## Theming
@@ -194,6 +200,27 @@ ignores the rest. It's off by default because your page may use the hash itself,
Without JavaScript, each card is a link to its image, in the theme the reader's system prefers.
+## Search
+
+A gallery with 40 screens or more gets a search box over its tabs. Every word typed has to be in a screen's title or
+caption, in any case and with or without accents. Tabs with no match are hidden, previous and next in the full-size
+view step only through the matches, and when nothing matches the grid says so. `"search": 20` shows the box from 20
+screens, `true` on every gallery and `false` on none.
+
+## Zoom
+
+In the full-size view a reader can zoom into a tall or detailed capture, up to 8 times: pinch on a trackpad or touch
+screen, scroll with ctrl or cmd held, double-click the image (and again to go back), or press `+`, `-` and `0`. The
+point under the pointer stays put. Zoomed in, the image scrolls inside the view, and a mouse can drag it. The next
+screen starts unzoomed. There are no buttons for it, so nothing changes on screen; `"zoom": false` turns it off.
+
+## New badges
+
+`"newBadges": 14` puts a small New badge on each screen whose picture changed in the last 14 days (`true` for 30).
+The reader's browser decides from the time VisualCI approved the picture, so a page you built weeks ago doesn't still
+call those screens new. A screen counts as changed when any of its shots did, so a restyle that changes every screen
+marks them all. It's off by default.
+
## Preloading
Once the page has loaded, the gallery fetches the images a reader is likely to look at next, so a tab or the full-size view shows at once. It starts when the browser is idle, runs a few requests at a time at low priority, and never delays the page itself: on visualci.com's screenshots page and fleetlayer.ai's, first paint and the load event take the same time with it on and off.
diff --git a/frontend/content/docs/gallery/python.md b/frontend/content/docs/gallery/python.md
index 8c3262b7..67e5715a 100644
--- a/frontend/content/docs/gallery/python.md
+++ b/frontend/content/docs/gallery/python.md
@@ -336,7 +336,7 @@ Its template, `templates/index.html`, links the copied files by relative path:
## Options
-`render` takes the gallery's options as keyword arguments, in snake case: `title`, `heading_level`, `id`, `screens`, `order`, `groups`, `group_order`, `credit`, `layout`, `theme_switch`, `see_all`, `preload`, `deep_links` and `text`. `None` is the same as leaving an option out, except for `title`, where it means no heading. The Django view's options give two screens a title and a caption, put four screens first, and show the Mac app's windows whole:
+`render` takes the gallery's options as keyword arguments, in snake case: `title`, `heading_level`, `id`, `screens`, `order`, `groups`, `group_order`, `credit`, `layout`, `theme_switch`, `see_all`, `preload`, `deep_links`, `text`, `search`, `zoom` and `new_badges`. `None` is the same as leaving an option out, except for `title`, where it means no heading. The Django view's options give two screens a title and a caption, put four screens first, and show the Mac app's windows whole:
```python
@@ -357,7 +357,7 @@ An option that's wrong (an unknown `layout`, an `id` that isn't a valid id) rais
After the page has loaded, the gallery preloads the images a reader is likely to look at next. `preload=False` turns that off, and `preload={"count": 200, "bytes": 20_000_000}` sets your own limits. It's on by default, and [Preloading](/docs/gallery/options/#preloading) says what it fetches and when.
-`deep_links=True` puts what the reader is looking at in the page's URL (the tab, the open screen, the values), so a copied link opens the same view; [Deep links](/docs/gallery/options/#deep-links) has the details. `text` changes the gallery's own words, for a site in another language: `text={"close": "Fermer", "open": "Agrandir « {title} »"}`. [Your own words](/docs/gallery/options/#your-own-words) lists every key and its default.
+`deep_links=True` puts what the reader is looking at in the page's URL (the tab, the open screen, the values), so a copied link opens the same view; [Deep links](/docs/gallery/options/#deep-links) has the details. `text` changes the gallery's own words, for a site in another language: `text={"close": "Fermer", "open": "Agrandir « {title} »"}`. [Your own words](/docs/gallery/options/#your-own-words) lists every key and its default. `search=False` takes away the search box a gallery of 40 screens or more gets, `zoom=False` turns off zooming in the full-size view, and `new_badges=14` badges the screens that changed in the last 14 days ([Search](/docs/gallery/options/#search), [Zoom](/docs/gallery/options/#zoom), [New badges](/docs/gallery/options/#new-badges)).
## A band on the homepage
diff --git a/frontend/content/docs/gallery/ruby.md b/frontend/content/docs/gallery/ruby.md
index c4e4a110..1fd2ee38 100644
--- a/frontend/content/docs/gallery/ruby.md
+++ b/frontend/content/docs/gallery/ruby.md
@@ -273,11 +273,11 @@ bundle exec rackup
## Options
-The helper and `render` take the [gallery options](/docs/gallery/options/#options) as keyword arguments, in snake case: `title`, `heading_level`, `id`, `screens`, `order`, `groups`, `group_order`, `credit`, `layout`, `theme_switch`, `see_all`, `preload`, `deep_links` and `text`. Hash keys inside them can be strings or symbols, and `groups`' `size` and `fit` take either too (`fit: :contain`). The [screenshots view](#the-page) above uses five of them.
+The helper and `render` take the [gallery options](/docs/gallery/options/#options) as keyword arguments, in snake case: `title`, `heading_level`, `id`, `screens`, `order`, `groups`, `group_order`, `credit`, `layout`, `theme_switch`, `see_all`, `preload`, `deep_links`, `text`, `search`, `zoom` and `new_badges`. Hash keys inside them can be strings or symbols, and `groups`' `size` and `fit` take either too (`fit: :contain`). The [screenshots view](#the-page) above uses five of them.
After the page has loaded, the gallery preloads the images a reader is likely to look at next. `preload: false` turns that off, and `preload: { count: 200, bytes: 20_000_000 }` sets your own limits. It's on by default, and [Preloading](/docs/gallery/options/#preloading) says what it fetches and when.
-`deep_links: true` keeps the shown tab, the open screen and the chosen values in the page's URL, so a link opens them ([Deep links](/docs/gallery/options/#deep-links)). `text:` changes the gallery's own words, for another language or tone: `text: { label: 'Captures', open: 'Agrandir « {title} »', close: 'Fermer' }`. [Your own words](/docs/gallery/options/#your-own-words) lists every key.
+`deep_links: true` keeps the shown tab, the open screen and the chosen values in the page's URL, so a link opens them ([Deep links](/docs/gallery/options/#deep-links)). `text:` changes the gallery's own words, for another language or tone: `text: { label: 'Captures', open: 'Agrandir « {title} »', close: 'Fermer' }`. [Your own words](/docs/gallery/options/#your-own-words) lists every key. `search: false` takes away the search box a gallery of 40 screens or more gets, `zoom: false` turns off zooming in the full-size view, and `new_badges: 14` badges the screens that changed in the last 14 days ([Search](/docs/gallery/options/#search), [Zoom](/docs/gallery/options/#zoom), [New badges](/docs/gallery/options/#new-badges)).
An option the gem can't use raises `VisualCI::Gallery::Error`, naming the option as the [options page](/docs/gallery/options/) spells it (`gallery option headingLevel is invalid`). Give each gallery its own `id:` when a page has more than one.
diff --git a/frontend/content/docs/gallery/rust.md b/frontend/content/docs/gallery/rust.md
index 0b984fef..4be7a7a0 100644
--- a/frontend/content/docs/gallery/rust.md
+++ b/frontend/content/docs/gallery/rust.md
@@ -320,7 +320,7 @@ pub fn options() -> Options {
}
```
-The setters are `title`, `heading_level`, `id`, `screen` (a screen's title and caption, by key), `order`, `group` (a group's title, size and fit, by name), `group_order`, `credit`, `layout`, `theme_switch`, `see_all`, `preload`, `preload_caps`, `deep_links` and `text` (one of the gallery's own words, by key: `.text("close", "Fermer")`; see [Your own words](/docs/gallery/options/#your-own-words)). `title(None)` leaves out the heading. `Options::from_json` takes the same options as a `&serde_json::Value` object, with the names the JS library uses (`headingLevel`, `themeSwitch`). [Gallery options](/docs/gallery/options/) says what each one does.
+The setters are `title`, `heading_level`, `id`, `screen` (a screen's title and caption, by key), `order`, `group` (a group's title, size and fit, by name), `group_order`, `credit`, `layout`, `theme_switch`, `see_all`, `preload`, `preload_caps`, `deep_links`, `search` and `search_from` (the search box always or never, or from a number of screens), `zoom`, `new_badges` and `new_badges_days` (the New badge, for 30 days or your own number), and `text` (one of the gallery's own words, by key: `.text("close", "Fermer")`; see [Your own words](/docs/gallery/options/#your-own-words)). `title(None)` leaves out the heading. `Options::from_json` takes the same options as a `&serde_json::Value` object, with the names the JS library uses (`headingLevel`, `themeSwitch`). [Gallery options](/docs/gallery/options/) says what each one does.
After the page has loaded, the gallery preloads the images a reader is likely to look at next. `.preload(false)` turns that off, and `.preload_caps(None, Some(200), Some(20_000_000), None)` sets your own limits (fold, count, bytes and requests at once; `None` keeps a default). It's on by default, and [Preloading](/docs/gallery/options/#preloading) says what it fetches and when.