diff --git a/CLAUDE.md b/CLAUDE.md index fa99b97..8a74d65 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -101,6 +101,7 @@ v41 Iris turns the current design, the Interactive Tour, or the Before / After c - **Storage.** Each share is a folder in Vercel Blob, `shares//`, holding the rendered images (`0.webp`, `1.webp`, ..., `poster.webp` for link previews) and a `manifest.json`. **A manifest names its images by file name only, never by URL** (`src/share/share-core.js` `isAssetName`), so a share can only point at its own files. `normalizeManifest()` runs on the server at commit and again in the viewer. Nothing from a manifest is rendered as HTML. - **Flow.** `src/features/share-links.js` renders the frames (`renderInto` for a design, `collectTourSteps(onProgress, encode)` for a tour, `collectCompareFrames()` for a compare), then `POST /api/share-create` returns an id, the owner key and the planned file paths, and records the plan (names, types, sizes, a 15 minute window) in a pending marker at `shares-pending/.json`. The browser uploads each file with `@vercel/blob/client` `uploadPresigned` (lazy chunk `vendor-blob`), whose handshake hits `/api/share-upload` (`api/_share-upload.js`): it checks the owner key and the plan, then answers with a presigned PUT bound to that path, type and size (`issueSignedToken` + `handleUploadPresigned`), so the bytes go straight to Blob. Then `POST /api/share-commit` publishes the manifest (once) and removes the marker; the daily cron (`/api/share-sweep`, handled by `api/_share-sweep.js`) deletes unpublished uploads older than a day. +- **Kinds and expiry (v42).** Manifest kinds are `image`, `tour`, `compare` and `gallery` (the Roll's shots or a page's Pins). A link may carry `expiresAt`: the client only sends a choice (`expiresIn`), the server stamps the time at commit, every read treats an expired manifest as missing, and the sweep deletes the files through a marker at `shares-expiry/-.json`. - **Ownership** is stateless: the key is `base64url(HMAC-SHA256(SHARE_SIGNING_SECRET, 'own:' + id))`. The editor keeps it in `glint_shares` ("Your links"), and a manage link (`/s/#key=...`) lets the viewer page delete the share. - **Viewer.** `s/index.html` (Vite input `share`, entry `src/share/viewer.js`, also a knip entry) is the page. On Vercel, `vercel.json` rewrites `/s/` to `api/share.js?op=page` (`api/_share-page.js`), which fills `` (Open Graph tags, poster) and `` (the manifest as inline JSON) and sends a strict content security policy. Under `vite`, a dev middleware serves the static page and the viewer fetches `/api/share-manifest` itself. `?embed=1` hides the chrome. The service worker's navigation fallback skips `/s/` and `/api/` (`navigateFallbackDenylist`), or a returning visitor would get the cached homepage. - **Players are shared with the exports.** The Tour player (`src/share/tour-player.js`) and the Before / After slider (`src/share/compare-player.js`) have no imports; the viewer imports them, and `tour-export.js` / `compare-export.js` inline their raw text (`?raw`) into the downloaded .html files. Edit the player modules, never the export templates. A test checks they stay import-free. @@ -138,10 +139,10 @@ When you add, serialize, or migrate a state key, update this table in the same c | Key | In `snapshot()` (undo) | Serialized | Notes | |---|---|---|---| | `mockup3d` | yes | yes | `orbitProgress` is runtime-only and stripped | -| `tour` | yes | `PROJECT_FIELDS` | per-step hotspots persist with the project; each page is a tour step | +| `tour` | yes | `PROJECT_FIELDS` | per-step hotspots persist with the project; each page is a tour step. v42: a hotspot's `target` is a page id (or null = next step), stored as an id so it survives reorder; `state/tour-core.js` `normalizeTour` (schema 26, drops the old unused `action`) and `resolveTourTargets` turn targets into `goto` step indexes when steps are collected (blank pages are not steps; a missing, blank or own-page target falls back to next) | | `surface` | yes | `SERIALIZED_FIELDS` | Surface Studio mockups | | `spotlight` | yes | `SERIALIZED_FIELDS` | v34 Spotlight 2.0: `regions[]` (fractions of the canvas, `rect`/`ellipse`/`rounded`) + `blur`/`feather`/`tint`/`shape`; schema v19 -> v20 via `migrateSpotlightV20()` (v1's single `x/y/w/h` becomes `regions[0]`); `spotlightRegions()` also reads an un-migrated v1 block | -| `bokeh` | yes | `PROJECT_FIELDS` (carries the subject-mask dataURL, so kept out of lean `SERIALIZED_FIELDS`) | v34 Subject Bokeh; `ensureBokehDefaults()` in `normalizeProject`; the mask applies only to the exact image object it was detected on (`render/bokeh.js` tags images via runtime-only `img.__bokehMasks`, `bindMaskOwner`; `maskFits(img)` checked once in `getGradedImage`); after a page/project load `document.js` `applyDesignToState` calls `releaseMaskOwner()` in the image `onload` so that freshly decoded image claims the saved mask once; undo/redo never moves a mask to another image; `maskSig` = image aspect ratio (extra guard); cleared when a new image or a video loads; skipped while a video is loaded (`bokehActive()`) | +| `bokeh` | yes | `PROJECT_FIELDS` (carries the subject-mask dataURL, so kept out of lean `SERIALIZED_FIELDS`) | v34 Subject Bokeh; `ensureBokehDefaults()` in `normalizeProject` (v42: it runs `normalizeBokeh()`, schema 26, which adds `mode: 'subject'\|'tilt'`, `tilt: { pos, width, feather, angle }` and `pull: { enabled, from, to }`; tilt-shift needs no mask and applies to any image, so a new upload keeps it on); the mask applies only to the exact image object it was detected on (`render/bokeh.js` tags images via runtime-only `img.__bokehMasks`, `bindMaskOwner`; `maskFits(img)` checked once in `getGradedImage`); after a page/project load `document.js` `applyDesignToState` calls `releaseMaskOwner()` in the image `onload` so that freshly decoded image claims the saved mask once; undo/redo never moves a mask to another image; `maskSig` = image aspect ratio (extra guard); cleared when a new image or a video loads; skipped while a video is loaded (`bokehActive()`) | | `compare` | yes | `PROJECT_FIELDS` (carries the Before dataURL, so kept out of lean `SERIALIZED_FIELDS`) | v35 Before / After; schema v20 -> v21 via `ensureCompareDefaults()` (`normalizeCompare()` in `render/compare-core.js` repairs bad fields); the decoded Before image lives in `render/compare.js`'s cache, and `document.js` `applyDesignToState` awaits `ensureCompareImage()` so offscreen page renders draw it | | `canvasSelection` | no (deliberate) | no | runtime-only unified selection | | `timeline` | yes (runtime fields stripped, e.g. `_driving`) | `SERIALIZED_FIELDS` | schema v17 -> v18 via `migrateTimelineV18()` (builds default lanes from old `animation`/`kenBurns`/`mockup3d.spin`) | @@ -158,7 +159,7 @@ When you add, serialize, or migrate a state key, update this table in the same c `state.batch` and `state.mode === 'batch'` were removed in v37 (the Roll replaced Batch mode). -Current `SCHEMA_VERSION` is 25 (v40 Hindsight, Pins). The board is document-level: `pages.js` `DOC_VERSION` is 14, migrated by `migrateBoardV14()`. Bump `SCHEMA_VERSION` (with a migration in `serialize.js`) whenever the per-design serialized shape changes; bump `DOC_VERSION` (with a migration in `pages.js`) when the document envelope shape changes. +Current `SCHEMA_VERSION` is 26 (v42 Junction: tour hotspot targets, Bokeh tilt-shift and focus pull). The board is document-level: `pages.js` `DOC_VERSION` is 14, migrated by `migrateBoardV14()`. Bump `SCHEMA_VERSION` (with a migration in `serialize.js`) whenever the per-design serialized shape changes; bump `DOC_VERSION` (with a migration in `pages.js`) when the document envelope shape changes. ## Checklist: adding a new feature @@ -177,7 +178,7 @@ Current `SCHEMA_VERSION` is 25 (v40 Hindsight, Pins). The board is document-leve - **HTML partials**: `vite.config.js` injects shared markup from `site/partials/` into pages that contain `` placeholders (the editor has none, so it is untouched). `{{VERSION}}` in the footer is filled from `package.json`. - **Versioning**: `package.json` `version` is the single version source; it drives the footer and the returning-user "what's new" toast (`src/features/whats-new.js`). Bump it for a release. -- **Release codenames (from v33)**: every major gets a codename in A to Z order (v33 Aperture, v34 Bokeh, v35 Contrast, v36 Darkroom (the Glint relaunch), v37 Exposure, v38 Focus, v39 Glossifier, v40 Hindsight, ...). v33 to v38 used photography words; from v39 a codename can come from any theme, as long as it fits the release. The number stays semver in `package.json`; the codename shows in the editor header (`Glint v36 · Darkroom`), the what's-new heading, and as the changelog entry `

`. `whats-new.js` `CURRENT_VERSION` is compared by string equality, so any label works. +- **Release codenames (from v33)**: every major gets a codename in A to Z order (v33 Aperture, v34 Bokeh, v35 Contrast, v36 Darkroom (the Glint relaunch), v37 Exposure, v38 Focus, v39 Glossifier, v40 Hindsight, v41 Iris, v42 Junction, ...). v33 to v38 used photography words; from v39 a codename can come from any theme, as long as it fits the release. The number stays semver in `package.json`; the codename shows in the editor header (`Glint v36 · Darkroom`), the what's-new heading, and as the changelog entry `

`. `whats-new.js` `CURRENT_VERSION` is compared by string equality, so any label works. - **OG/social**: `__OG_BASE__` in HTML is replaced with the absolute site URL at build (from Vercel env, or `OG_BASE_URL` locally). - **PWA**: `vite-plugin-pwa` with `autoUpdate`; CDN model files (jsdelivr/unpkg/staticimgly) are runtime-cached. The precache downloads on the first visit to *any* page, so (v33.2) it skips PNGs and `assets/*.js` chunks over 100 KB other than the editor entry (`manifestTransforms`); those are cached on first use by a CacheFirst rule on `/assets/`. Keep the precache small (about 1.6 MB). Since v34.1 the manifest has `id: '/'` + `start_url: '/editor/'` (installed app opens the editor), and `src/features/install-app.js` (`bindInstallApp()`) shows a header "Install app" button when the browser fires `beforeinstallprompt` (or iOS Share-sheet instructions), hidden in standalone mode; Cmd-K `install-app`. - **Browser extension**: `chrome-extension/` is a standalone MV3 bundle (manifest + background + content scripts + popup + a self-contained quick editor), **NOT part of the Vite build**. Load-unpacked for dev; zip for the Chrome Web Store (`chrome-extension/store/` holds listing copy, the upload `.zip`, and generated screenshots from `scripts/build-store-shots.mjs`). The popup captures a page (visible / full-page scroll-stitch / region); `background.js` stashes the PNG under a nonce in `chrome.storage.local` and by default opens the extension's own quick editor (`chrome-extension/editor/`: crop, padding + background, arrow/text, Download PNG) so the extension works without the web app. Cross-origin handoff to the web studio: the extension cannot touch the site's Cache Storage (origin-scoped), so `content/bridge.js` relays the capture into `/editor/?ext=` via `window.postMessage`; `src/features/ext-receiver.js` (`bindExtReceiver()`, wired in `main.js`) validates origin+nonce and feeds it through the same `loadImage()` entry point as upload/drop/paste. The `/extension/` marketing page lives at repo `extension/index.html` (a Vite input; distinct folder from the bundle). @@ -212,14 +213,16 @@ Current `SCHEMA_VERSION` is 25 (v40 Hindsight, Pins). The board is document-leve | v39.5.2 | Amplified, printed (no more stock photos) | Site only. The last 26 picsum.photos images (device mockup, App Store, social, product mockup, OG, README, drop shadow, use cases and agent pages) replaced with real renders from new `scripts/build-site-shots.mjs` recipes (`dev-*`, `social-*`, `surf-*`, `agent-styled`, and `store-a/b/c` saved from the Set block); alt text rewritten to describe each image | | v40 | Hindsight (History panel + Pins + looks you can see) | History: `features/history-panel.js` (`bindHistoryPanel()`; Project > History `#history-section`, `data-simple`; one row per undo step with its name and a thumbnail, click to jump via `history.js` `goToStep`, hold the eye to peek via `peekStep`/`endPeek` (render-only: `render()` draws the step inside `withSnapshot`; `state` stays live) with a "Previewing a step" chip in `#drop-zone`, like v39's "Original" chip), `render/history-thumbs.js` (`renderStepThumb(snap, width)`: renders a snapshot offscreen through `withSnapshot` + `renderInto`), `state/history-labels.js` (`describeChange()` names a step from the snapshot diff; `saveStateToHistory(label)` can pass a name). Pins: `features/versions.js` (`bindVersions()`; "Pin this step" button, "Pinned" list; restoring a pin is one undo step) + `state/versions-core.js` (`makeVersion`, `MAX_VERSIONS` 12, `cleanName`, `normalizeVersions`, `ensureVersionsDefaults`); the UI calls them Pins, the code `state.versions`; the Projects panel's History button was renamed Project timeline. Looks: Look chips preview the current screenshot; Roll per-shot looks (`imageFilters` + `colorTools` join `ROLL_OVERRIDE_FIELDS`; This shot scope keeps a grade with the open shot); Design Agent tools `apply_look` and `set_light_dark` (`set_light_dark` matches the scene through the same record as the panel, so either can put it back when the flip is turned off). Cmd-K `history-open`/`history-pin`. Schema 24 -> 25. Release notes: `whats-new.js` `CURRENT_VERSION` `'40.0'`, editor header `v40 · Hindsight`, changelog Hindsight spotlight + entry, and a `hindsight-steps` shot in `scripts/build-site-shots.mjs` (one design at three history steps, each drawn back from its snapshot with `withSnapshot` + `renderInto`) | | v41 | Iris (share links) | Public `/s/` links for a design, a tour or a before / after, on Vercel Blob with no account (see the Share links architecture section). Core: `src/share/share-core.js` (DOM-free manifest normalizer, ids, HMAC keys, `planUploads`). API: `api/share.js` (the one deployed share function; Hobby allows 12 functions) dispatching to `api/_share-status`/`-create`/`-commit`/`-manifest`/`-delete`/`-page`/`-sweep`, `api/_share.js` (Blob and memory stores), `vercel.json` (rewrites, headers, cron). Viewer: `s/index.html`, `src/share/viewer.js` + `viewer.css`. Players moved into `src/share/tour-player.js` and `compare-player.js` (shared with the .html exports; tour callouts now stay inside the window on phones). Editor: `features/share-links.js` (`bindShareLinks()`; Export > Share rebuilt with Design / Tour / Before / after, title, progress + Cancel, result card with copy, open, QR, manage link and embed codes, and Your links; Share link buttons in the Tour and Compare panels), `src/share/share-poster.js` (1200x630 preview image), `features/share.js` keeps embed codes, QR and size presets (the Supabase upload is gone). Cmd-K `share-link-design`/`share-link-tour`/`share-link-compare`/`share-links-open`. Service worker skips `/s/` and `/api/` navigations. No schema change. Release notes: `whats-new.js` `CURRENT_VERSION` `'41.0'`, editor header `v41 · Iris`, changelog Iris spotlight + entry, Features page Share chapter, privacy wording, and `share-viewer` / `share-phone` shots in `scripts/build-site-shots.mjs` (editor renders served to the real viewer page) | +| v42 | Junction (branching tours + gallery links + print PDF + tilt-shift) | **Branching tours:** `state/tour-core.js` (DOM-free `normalizeTour`, `resolveTourTargets`, `tourLinks`); `tours.js` "Goes to" picker (`#tour-hotspot-target`, read the value before `saveStateToHistory`, which refreshes the panel) and destination badges via `tour-overlay.js` `setTourBadge`; `tour-export.js` `collectTourSteps` resolves targets; `share/tour-player.js` follows `goto`, keeps a visited `trail` so Back retraces the path, preloads jump targets; `share-core.js` keeps a `goto` only inside the tour. Board tour map: `board.js` `drawTourLinks` draws dashed arrows in its own `.board-tour-map` svg above the cards (derived, never in `state.board.objects`; toggle `glint_board_tour_links`, Cmd-K `board-tour-links`). `pages.js` `movePage` now keeps the edited page active (it used to mark the dragged page active without loading it). **Tilt-shift + focus pull:** `bokeh-core.js` `normalizeBokeh`, `tiltBand` (two gradient stop lists: half blur, full blur), `pullEase`; `bokeh.js` `blurredCopy` caches the lens blur per amount, `applyTiltShift` and the subject pull only composite cached layers (`tiltActive()`, `focusProgress()`); gate in `color-grade.js` `gradeAndBlur`; `motion-studio.js` `focus` lane; Cmd-K `bokeh-tilt-shift` / `bokeh-focus-pull`. **Share:** manifest kind `gallery` (`source: 'roll'\|'pins'`, up to 30 items; the panel calls them Roll and Pins), `roll.js` `renderRollShots`, `history-thumbs.js` `renderSnapshotFull`, viewer grid + ``, `share-poster.js` tile poster. Expiry: the client sends `expiresIn` (`EXPIRY` names), `_share-commit.js` stamps `expiresAt`, the manifest and page routes answer 404 once `isExpired`, and the sweep deletes through markers named `shares-expiry/-.json` (no new function or op). Cmd-K `share-link-roll` / `share-link-pins`. **Print PDF:** `render/print-core.js` (DOM-free, mm: `PAPERS`, `layoutPrint` trim / bleed / page boxes, source crop for Fill, crop marks, `effectiveDpi`), `features/print-pdf.js` (`bindPrintPdf()`; Export > Print PDF `#print-section`, Pro only; prefs in `glint_print_prefs`, not state; RGB only; `pages.js` `eachPageCanvas` for all pages), Cmd-K `export-print-pdf`. Schema 25 -> 26. Release notes: `whats-new.js` `CURRENT_VERSION` `'42.0'`, editor header `v42 · Junction`, changelog Junction spotlight + entry, and a `junction-tour` shot in `scripts/build-site-shots.mjs` (the Iris steps as a branching tour in the real viewer) | ## Backlog (unbuilt) -- **From v41:** the Roll's contact sheet and Pins as share kinds; link expiry options; view counts; a hosted "Your links" that follows the person across browsers (today the owner keys live in one browser's `glint_shares`). Retiring Supabase entirely (sign-in, cloud project and template sync, the community gallery, live collaboration) was proposed for v41.1 and needs a decision first. -- **Still open from the v39 options list:** print-ready PDF export, and the extension's element picker. From v39 itself: per-frame flips on video. (Raised cards in dark mode shipped in v41.0.1: `flipLightness` folds the top of the range so a white card lands above a light-gray page; the light direction still saturates everything below the surface to white.) +- **From v42:** CMYK conversion and real TrimBox / BleedBox entries for the print PDF; a true high-resolution re-render for print (today it is the design's own pixels plus a smooth upscale); tour links in the board's PNG export; an on-canvas handle for the tilt-shift band; Design Agent tools for tours. +- **From v41:** view counts; a hosted "Your links" that follows the person across browsers (today the owner keys live in one browser's `glint_shares`). Retiring Supabase entirely (sign-in, cloud project and template sync, the community gallery, live collaboration) was proposed for v41.1 and needs a decision first. +- **Still open from the v39 options list:** the extension's element picker. From v39 itself: per-frame flips on video. (Raised cards in dark mode shipped in v41.0.1: `flipLightness` folds the top of the range so a white card lands above a light-gray page; the light direction still saturates everything below the surface to white.) - **From v40:** nothing left; Look chip previews with temperature / tint and scaled blur, the shared Light / Dark scene record, clearing history on page switch and normalizing Roll grade overrides on load all shipped in v41.0.1. -- **New creative outputs:** Tour branching (deferred v25 stretch; hosted tours shipped in v41 as share links); AI Storyboard / multi-panel generator. -- **New mockup classes:** print-ready PDF export (bleed / crop marks / CMYK); billboard/large-format and more apparel bases (deferred v27 stretches). +- **New creative outputs:** AI Storyboard / multi-panel generator. (Tour branching shipped in v42.) +- **New mockup classes:** billboard/large-format and more apparel bases (deferred v27 stretches). (Print PDF with bleed and crop marks shipped in v42; CMYK is still open.) - **Automation & scale:** public REST API + CLI (headless generation). - **More capture surfaces:** element-pick + Firefox/Edge port for the extension (deferred v26 stretch); mobile camera capture. - **Collab & platform:** async review / approvals (pinned threaded comments, sign-off; distinct from live cursors); template marketplace + creator monetization; plugin / extension SDK. diff --git a/api/_share-commit.js b/api/_share-commit.js index a72fbce..1cdc4b0 100644 --- a/api/_share-commit.js +++ b/api/_share-commit.js @@ -1,7 +1,7 @@ // v41 — Share links: check the manifest and the uploaded files, then publish // the share by writing manifest.json. A share can be committed once. import { ApiError, parseBody } from './_shared.js'; -import { requireEnabled, store, checkKey, readId, pendingPath, sendError, siteOrigin } from './_share.js'; +import { requireEnabled, store, checkKey, readId, pendingPath, expiryPath, sendError, siteOrigin } from './_share.js'; import { normalizeManifest, manifestAssets, sharePrefix, LIMITS, MANIFEST_NAME } from '../src/share/share-core.js'; export default async function handler(req, res) { @@ -14,7 +14,9 @@ export default async function handler(req, res) { if (!(await checkKey(cfg.secret, id, body.key))) throw new ApiError(403, 'Not your share'); let manifest; - try { manifest = normalizeManifest(body.manifest, { id, now: Date.now() }); } catch (e) { throw new ApiError(400, e.message); } + // v42 — `expiresIn` ('never' | '1d' | '7d' | '30d') sets the link's expiry; + // the time itself is stamped here, never taken from the client. + try { manifest = normalizeManifest(body.manifest, { id, now: Date.now(), expiresIn: body.expiresIn == null ? undefined : body.expiresIn }); } catch (e) { throw new ApiError(400, e.message); } const st = store(cfg); const prefix = sharePrefix(id); @@ -37,7 +39,16 @@ export default async function handler(req, res) { throw e; } await st.del([pendingPath(id)]); - res.status(201).json({ id, url: `${siteOrigin(req)}/s/${id}` }); + if (manifest.expiresAt) { + // The marker only speeds up cleanup; the link stops working at its time + // either way, so a failed write is logged and the publish still stands. + try { + await st.put(expiryPath(id, Date.parse(manifest.expiresAt)), JSON.stringify({ id, expiresAt: manifest.expiresAt }), { contentType: 'application/json', cacheSeconds: 60 }); + } catch (e) { + console.error('[share-commit] expiry marker', e); + } + } + res.status(201).json({ id, url: `${siteOrigin(req)}/s/${id}`, expiresAt: manifest.expiresAt || null }); } catch (e) { sendError(res, e); } diff --git a/api/_share-delete.js b/api/_share-delete.js index 0427ee2..faa5aa8 100644 --- a/api/_share-delete.js +++ b/api/_share-delete.js @@ -1,7 +1,7 @@ // v41 — Share links: delete every file of a share. Needs the owner key that // share-create handed out (kept by the editor, or carried in a manage link). import { ApiError, parseBody } from './_shared.js'; -import { requireEnabled, store, checkKey, readId, pendingPath, sendError } from './_share.js'; +import { requireEnabled, store, checkKey, readId, pendingPath, expiryPath, readManifest, sendError } from './_share.js'; import { sharePrefix } from '../src/share/share-core.js'; export default async function handler(req, res) { @@ -15,7 +15,16 @@ export default async function handler(req, res) { const st = store(cfg); const files = await st.list(sharePrefix(id)); if (!files.length) throw new ApiError(404, 'This link is already gone.'); - await st.del([...files.map((f) => f.pathname), pendingPath(id)]); + // v42 — a link with an expiry also has a marker for the sweep. + const extra = [pendingPath(id)]; + try { + const found = await readManifest(st, id); + const t = found && typeof found.manifest.expiresAt === 'string' ? Date.parse(found.manifest.expiresAt) : NaN; + if (Number.isFinite(t)) extra.push(expiryPath(id, t)); + } catch (e) { + console.error('[share-delete] expiry marker', e); // the sweep removes a stray marker + } + await st.del([...files.map((f) => f.pathname), ...extra]); res.status(204).end(); } catch (e) { sendError(res, e); diff --git a/api/_share-manifest.js b/api/_share-manifest.js index 1501be0..5e6bc8c 100644 --- a/api/_share-manifest.js +++ b/api/_share-manifest.js @@ -2,7 +2,7 @@ // The viewer uses this when the page was not served with the data inline. import { ApiError } from './_shared.js'; import { requireEnabled, store, readId, readManifest, sendError } from './_share.js'; -import { normalizeManifest } from '../src/share/share-core.js'; +import { normalizeManifest, isExpired } from '../src/share/share-core.js'; export default async function handler(req, res) { try { @@ -15,6 +15,11 @@ export default async function handler(req, res) { throw new ApiError(404, 'This link was removed, or it never existed.'); } const manifest = normalizeManifest(found.manifest, { id }); + // v42 — an expired link reads as gone, even before the sweep deletes it. + if (isExpired(manifest)) { + res.setHeader('Cache-Control', 'public, max-age=0, s-maxage=30'); + throw new ApiError(404, 'This link has expired.'); + } res.setHeader('Cache-Control', 'public, max-age=30, s-maxage=60'); res.status(200).json({ manifest, base: found.base, report: cfg.reportEmail || null }); } catch (e) { diff --git a/api/_share-page.js b/api/_share-page.js index 1060914..5f13623 100644 --- a/api/_share-page.js +++ b/api/_share-page.js @@ -6,7 +6,7 @@ import { readFile } from 'node:fs/promises'; import path from 'node:path'; import { shareConfig, store, readManifest, siteOrigin } from './_share.js'; -import { normalizeManifest, describeShare, isShareId } from '../src/share/share-core.js'; +import { normalizeManifest, describeShare, isShareId, isExpired } from '../src/share/share-core.js'; export const SHARE_CSP = "default-src 'self'; img-src 'self' data: https://*.public.blob.vercel-storage.com; connect-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self'; frame-ancestors *; base-uri 'none'; form-action 'none'"; @@ -70,10 +70,13 @@ export default async function handler(req, res) { const cfg = shareConfig(); let found = null; + let expired = false; if (cfg.enabled && isShareId(id)) { try { const got = await readManifest(store(cfg), id); if (got) found = { manifest: normalizeManifest(got.manifest, { id }), base: got.base }; + // v42 — an expired link is served as a missing one. + if (found && isExpired(found.manifest)) { found = null; expired = true; } } catch (e) { console.error('[share-page]', e); } @@ -87,7 +90,7 @@ export default async function handler(req, res) { return; } - const data = found ? { manifest: found.manifest, base: found.base, report: cfg.reportEmail || null } : { missing: true }; + const data = found ? { manifest: found.manifest, base: found.base, report: cfg.reportEmail || null } : { missing: true, ...(expired ? { expired: true } : {}) }; const html = fillTemplate(template, shareMeta({ ...(found || {}), origin, id: isShareId(id) ? id : null }), data); res.setHeader('Content-Type', 'text/html; charset=utf-8'); res.setHeader('Content-Security-Policy', SHARE_CSP); diff --git a/api/_share-sweep.js b/api/_share-sweep.js index 2dd75d4..ae3b8aa 100644 --- a/api/_share-sweep.js +++ b/api/_share-sweep.js @@ -1,7 +1,9 @@ // v41 — Share links: daily cron. Removes uploads that were never published // (a closed tab, a cancelled upload) once their pending marker is a day old. +// v42 — it also deletes links whose expiry has passed, found through the +// markers in shares-expiry/ (the time is in each marker's name). import { ApiError } from './_shared.js'; -import { requireEnabled, store, sendError, PENDING_PREFIX } from './_share.js'; +import { requireEnabled, store, sendError, PENDING_PREFIX, EXPIRY_PREFIX } from './_share.js'; import { sharePrefix, isShareId, MANIFEST_NAME } from '../src/share/share-core.js'; const DAY_MS = 24 * 60 * 60 * 1000; @@ -27,8 +29,23 @@ export default async function handler(req, res) { await st.del([...files.map((f) => f.pathname), m.pathname]); removed++; } - console.log(`[share-sweep] removed ${removed} unpublished share(s)`); - res.status(200).json({ removed }); + // Expired links, with whatever is left of this run's budget. + const now = Date.now(); + let expired = 0; + const due = []; + for (const m of await st.list(EXPIRY_PREFIX)) { + const hit = /^(\d{1,16})-([A-Za-z0-9]{12})\.json$/.exec(m.pathname.slice(EXPIRY_PREFIX.length)); + if (!hit) { due.push({ marker: m.pathname, id: null }); continue; } + if (Number(hit[1]) <= now) due.push({ marker: m.pathname, id: hit[2] }); + } + for (const d of due.slice(0, Math.max(0, MAX_PER_RUN - markers.length))) { + if (!d.id) { await st.del([d.marker]); continue; } + const files = await st.list(sharePrefix(d.id)); + await st.del([...files.map((f) => f.pathname), d.marker]); + if (files.length) expired++; + } + console.log(`[share-sweep] removed ${removed} unpublished share(s), ${expired} expired link(s)`); + res.status(200).json({ removed, expired }); } catch (e) { sendError(res, e); } diff --git a/api/_share.js b/api/_share.js index 8c39296..48337ce 100644 --- a/api/_share.js +++ b/api/_share.js @@ -14,6 +14,11 @@ import { shareKey, verifyKey, isShareId, MANIFEST_NAME, base64url } from '../src export const PENDING_PREFIX = 'shares-pending/'; export const pendingPath = (id) => `${PENDING_PREFIX}${id}.json`; +// v42 — a link that expires leaves a marker whose NAME carries the time +// (`shares-expiry/-.json`), so the daily sweep finds expired shares +// by listing one folder, without reading any manifest. +export const EXPIRY_PREFIX = 'shares-expiry/'; +export const expiryPath = (id, ms) => `${EXPIRY_PREFIX}${Math.round(ms)}-${id}.json`; // A Blob store connects in one of two ways: newer stores add BLOB_STORE_ID and // the SDK signs in with the deployment's OIDC token; older ones add diff --git a/changelog/index.html b/changelog/index.html index e38faeb..1b0edee 100644 --- a/changelog/index.html +++ b/changelog/index.html @@ -4,11 +4,11 @@ - + Changelog · Glint - + @@ -975,21 +975,21 @@

Major updates, and every release.

Latest release -
v41 · October 2026
-

Iris.

-

Send a link, not a file. Share a design, a tour, or a before and after as a page anyone can open.

+
v42 · November 2026
+

Junction.

+

Tours that branch. A hotspot can jump to any page, so a tour becomes a demo people click through their own way.

- -
Send a linkOpen Share in the Export tab and press Create link. Anyone can open it, no account needed.
+ +
Tours that branchPick where each hotspot goes: the next step or any page. Back retraces the path.
- -
Tours and sliders, liveTours click through and sliders drag right on the page, and every link shows a preview card in chats.
+ +
Gallery links that can expireShare a whole Roll or your Pins as one page. A link can last a day, a week or a month.
- -
Yours to take backYour links lists everything you shared. Delete one and it is gone for everyone.
+ +
Print PDF and tilt-shiftReal paper sizes with bleed and crop marks, and a blur that keeps one band sharp.
@@ -998,9 +998,8 @@

Iris.

-
-
A shared onboarding tour open in the browser, with a callout on the revenue card
- A shared before and after slider open on a phone +
+
A shared tour open in the browser. Two hotspots on the first step lead to two different pages.
@@ -1013,6 +1012,24 @@

Iris.

Every release

  • + +
    +

    Junction

    +

    Tours that branch, plus gallery links, print PDF and tilt-shift.

    +
      +
    • Tours that branch. Each hotspot has a Goes to choice: the next step or any page. A tour can now offer paths, loop back, or skip ahead.
    • +
    • Back follows your path. In the player, Back returns to the step you came from. It works the same in shared links and exported files.
    • +
    • A map of the tour. On the board, dashed arrows show which page each hotspot jumps to. Turn them off with Tour links.
    • +
    • Share the Roll or your Pins. Both open as a gallery with a full screen viewer. A link holds up to 30 images.
    • +
    • Links that expire. A link can last 1, 7 or 30 days, or until you delete it. Your links shows how long each one has left.
    • +
    • Print PDF. Paper sizes from A3 to a business card, or your own, with bleed, crop marks and one page or all of them. The panel shows the real print resolution. The file is RGB.
    • +
    • Tilt-shift. Bokeh can keep one band sharp and blur the rest. It needs no subject, so it works on any screenshot.
    • +
    • Focus pull. Motion Studio gets a focus lane that moves the sharp band or fades the blur over time.
    • +
    • Fixed. The callout position choice now saves, and dragging a page tile no longer mixes up which page you are editing.
    • +
    +
    +
  • +
  • Iris

    diff --git a/editor/index.html b/editor/index.html index 838dcae..b704c3d 100644 --- a/editor/index.html +++ b/editor/index.html @@ -5,7 +5,7 @@ - Glint v41 · Iris + Glint v42 · Junction @@ -26,7 +26,7 @@
    - Glint v41 · Iris + Glint v42 · Junction
@@ -246,7 +246,8 @@

Image Editing

@@ -1253,7 +1268,7 @@

Watermark

+ + + + +
+ + + +
+ +
Open full size
+
+ +
diff --git a/scripts/build-site-shots.mjs b/scripts/build-site-shots.mjs index 702022a..44c0adf 100644 --- a/scripts/build-site-shots.mjs +++ b/scripts/build-site-shots.mjs @@ -719,7 +719,15 @@ const IRIS = { before: '0.webp', after: '1.webp', w: 1600, h: 1000, rect: { x: 0, y: 0, w: 1, h: 1 }, orientation: 'vertical', split: 0.42, labels: { enabled: true, before: 'Raw', after: 'Glint', position: 'top' }, divider: { color: '#ffffff', width: 3, handle: true } } } }; - for (const shot of [IRIS.tour, IRIS.compare]) { + // v42 — Junction: the same three steps as a branching tour. The first step + // has two hotspots that jump to two different pages. + const JUNCTION = { file: 'junction-tour', id: 'JunctionDemo', title: 'Lumen product tour', viewport: { width: 1440, height: 900 } }; + for (let i = 0; i < steps.length; i++) files[`${JUNCTION.id}/${i}.webp`] = files[`${IRIS.tour.id}/${i}.webp`]; + manifests[JUNCTION.id] = { v: 1, id: JUNCTION.id, kind: 'tour', title: JUNCTION.title, poster: null, tour: { steps: steps.map((st, i) => (i ? { ...st, hotspots: [] } : { ...st, hotspots: [ + { x: 0.33, y: 0.354, w: 0.108, h: 0.114, label: 'Open the team board', goto: 1, callout: { title: 'Open the team board', body: 'This hotspot jumps to the board.', side: 'bottom' } }, + { x: 0.664, y: 0.354, w: 0.101, h: 0.114, label: 'Skip to pricing', goto: 2, callout: { title: 'Skip to pricing', body: 'This one goes straight to the last page.', side: 'bottom' } } + ] })) } }; + for (const shot of [IRIS.tour, IRIS.compare, JUNCTION]) { const vctx = await browser.newContext({ viewport: shot.viewport, deviceScaleFactor: 2 }); await vctx.route('**/api/share-manifest*', (r) => { const id = new URL(r.request().url()).searchParams.get('id'); diff --git a/scripts/regression-tests.mjs b/scripts/regression-tests.mjs index a97bfa3..332afa4 100644 --- a/scripts/regression-tests.mjs +++ b/scripts/regression-tests.mjs @@ -14,6 +14,10 @@ import { normalizeModeFlip, resolveTarget, srgbToOklab, oklabToSrgb, flipLightne import { history, saveStateToHistory, undo, redo, historyTimeline, goToStep, peekStep, endPeek, isPeeking, peekSnapshot, withSnapshot, clearHistory, commitStep, onHistoryChange } from '../src/state/history.js'; import { describeChange } from '../src/state/history-labels.js'; import { makeVersion, normalizeVersions, MAX_VERSIONS, isSafeThumb } from '../src/state/versions-core.js'; +import { normalizeTour, resolveTourTargets, tourLinks } from '../src/state/tour-core.js'; +import { bokehDefaults, normalizeBokeh, tiltBand, pullEase, lensBlur } from '../src/render/bokeh-core.js'; +import { localProgress } from '../src/state/motion-clock.js'; +import { PAPERS, normalizePrint, trimSize, layoutPrint, effectiveDpi, dpiVerdict } from '../src/render/print-core.js'; import { createHmac, randomBytes } from 'node:crypto'; import { store as shareStore, memoryStoreEntries } from '../api/_share.js'; import shareStatusRoute from '../api/_share-status.js'; @@ -26,7 +30,7 @@ import { shareMeta, fillTemplate } from '../api/_share-page.js'; import shareRouter from '../api/share.js'; import shareUploadRoute from '../api/_share-upload.js'; import { join as waitlistJoin, exportList as waitlistExport, cleanEmail, WAITLIST_PREFIX } from '../api/_waitlist.js'; -import { LIMITS, newShareId, isShareId, isAssetName, shareKey, verifyKey, base64url, normalizeManifest, manifestAssets, describeShare, planUploads } from '../src/share/share-core.js'; +import { LIMITS, newShareId, isShareId, isAssetName, shareKey, verifyKey, base64url, normalizeManifest, manifestAssets, describeShare, planUploads, isExpired, EXPIRY } from '../src/share/share-core.js'; function mockRes() { return { @@ -743,6 +747,168 @@ function testVersionsNormalizeAndPersist() { } } +// v42 — branching tours: targets are page ids, the player wants step indexes. +function testTourCoreTargets() { + const old = normalizeTour({ hotspots: [{ id: 'a', x: 0.1, y: 0.2, w: 0.3, h: 0.1, label: '', callout: { title: 'Hi', body: '', side: 'left' }, action: 'next' }], autoAdvanceMs: 2000 }); + assert.equal(old.hotspots[0].action, undefined); + assert.equal(old.hotspots[0].target, null); + assert.equal(old.hotspots[0].callout.side, 'left'); + assert.equal(old.autoAdvanceMs, 2000); + + const bad = normalizeTour({ hotspots: [{ x: 4, y: -1, w: 2, h: 'x', callout: { side: 'up' }, target: 7 }, null], autoAdvanceMs: 'soon' }); + assert.equal(bad.hotspots.length, 2); + assert.deepEqual([bad.hotspots[0].x, bad.hotspots[0].y, bad.hotspots[0].w, bad.hotspots[0].h], [1, 0, 0, 0]); + assert.equal(bad.hotspots[0].callout.side, 'bottom'); + assert.equal(bad.hotspots[0].target, null); + assert.ok(bad.hotspots[0].id && bad.hotspots[1].id); + assert.equal(bad.autoAdvanceMs, 0); + assert.deepEqual(normalizeTour(undefined), { hotspots: [], autoAdvanceMs: 0 }); + + // Page p2 is blank, so it is not a step: p3 is step 1 and p4 is step 2. + const hs = (target) => ({ id: 'h', x: 0, y: 0, w: 0.5, h: 0.5, label: '', callout: null, target }); + const steps = resolveTourTargets([ + { pageId: 'p1', img: 'a', w: 10, h: 10, autoAdvanceMs: 0, hotspots: [hs('p4'), hs(null), hs('p2'), hs('gone'), hs('p1')] }, + { pageId: 'p3', img: 'b', w: 10, h: 10, autoAdvanceMs: 0, hotspots: [hs('p1')] }, + { pageId: 'p4', img: 'c', w: 10, h: 10, autoAdvanceMs: 0, hotspots: [] } + ]); + assert.equal(steps[0].pageId, undefined); + assert.deepEqual(steps[0].hotspots.map((h) => h.goto), [2, undefined, undefined, undefined, undefined]); + assert.equal(steps[1].hotspots[0].goto, 0); + assert.equal(steps[0].hotspots[0].target, undefined); + assert.equal(steps[0].hotspots[0].id, undefined); + + const page = (id, targets) => ({ id, payload: { design: { tour: { hotspots: targets.map((t) => ({ target: t })) } } } }); + assert.deepEqual(tourLinks([page('p1', ['p2', 'p2', 'p1', 'gone', null]), page('p2', ['p1']), { id: 'p3', payload: null }]), + [{ from: 'p1', to: 'p2' }, { from: 'p2', to: 'p1' }]); + + // A design saved before v42 comes back with targets and without `action`. + const migrated = normalizeProject({ schemaVersion: 25, design: { tour: { hotspots: [{ id: 'a', x: 0.1, y: 0.1, w: 0.2, h: 0.2, action: 'next' }] } } }); + assert.equal(migrated.design.tour.hotspots[0].target, null); + assert.equal(migrated.design.tour.hotspots[0].action, undefined); + assert.equal(SCHEMA_VERSION, 26); +} + +// v42 — tilt-shift and the focus pull. +function testBokehTiltAndPull() { + // A v34 block gains the new fields and keeps its mask. + const old = normalizeBokeh({ enabled: true, amount: 20, highlights: 0.2, shape: 'hexagon', maskDataUrl: 'data:image/png;base64,AA', maskSig: '1.600' }); + assert.equal(old.mode, 'subject'); + assert.equal(old.maskDataUrl, 'data:image/png;base64,AA'); + assert.deepEqual(old.tilt, bokehDefaults().tilt); + assert.deepEqual(old.pull, bokehDefaults().pull); + assert.equal(old.shape, 'hexagon'); + + const bad = normalizeBokeh({ enabled: 'yes', amount: 'lots', mode: 'sideways', shape: 'star', tilt: { pos: 7, width: -1, feather: 0, angle: 400 }, pull: { enabled: 1, from: null, to: 2 } }); + assert.equal(bad.enabled, false); + assert.equal(bad.amount, 12); + assert.equal(bad.mode, 'subject'); + assert.equal(bad.shape, 'circle'); + assert.deepEqual(bad.tilt, { pos: 1, width: 0, feather: 0.02, angle: 90 }); + assert.deepEqual(bad.pull, { enabled: false, from: 0.15, to: 1 }); + assert.deepEqual(normalizeBokeh(null), bokehDefaults()); + + const migrated = normalizeProject({ schemaVersion: 25, design: { bokeh: { enabled: true, amount: 8, mode: 'tilt' } } }); + assert.equal(migrated.design.bokeh.mode, 'tilt'); + assert.equal(migrated.design.bokeh.tilt.width, 0.2); + + // A horizontal band: the line runs straight down through the centre. + const band = tiltBand({ pos: 0.5, width: 0.2, feather: 0.4, angle: 0 }, 400, 200); + assert.equal(band.span, 200); + assert.ok(Math.abs(band.line.x0 - 200) < 1e-9 && Math.abs(band.line.x1 - 200) < 1e-9); + assert.equal(band.line.y0, -100); + assert.equal(band.line.y1, 300); + assert.equal(band.half, 20); + // Half blur fades in from the band edge (20px) to 60px, full blur from 60 to 100. + const at = (px) => 0.5 + px / 400; + assert.deepEqual(band.mid.map((s) => s[1]), [1, 1, 0, 0, 1, 1]); + assert.ok(Math.abs(band.mid[3][0] - at(20)) < 1e-9 && Math.abs(band.mid[4][0] - at(60)) < 1e-9); + assert.ok(Math.abs(band.full[3][0] - at(60)) < 1e-9 && Math.abs(band.full[4][0] - at(100)) < 1e-9); + for (const stops of [band.mid, band.full]) { + for (let i = 1; i < stops.length; i++) assert.ok(stops[i][0] >= stops[i - 1][0], 'stops must not go backwards'); + } + // Position moves the centre along the line; 90 degrees makes the band vertical. + assert.equal(tiltBand({ pos: 0.25, width: 0.2, feather: 0.4, angle: 0 }, 400, 200).centre.y, 50); + const upright = tiltBand({ pos: 1, width: 0.1, feather: 0.2, angle: 90 }, 400, 200); + assert.equal(upright.span, 400); + assert.ok(Math.abs(upright.centre.x - 0) < 1e-9 && Math.abs(upright.centre.y - 100) < 1e-9); + assert.equal(tiltBand({ pos: 0.5, width: 0.2, feather: 0.4, angle: 0 }, 400, 200, 1).centre.y, 200); + + assert.equal(pullEase(0), 0); + assert.equal(pullEase(1), 1); + assert.equal(pullEase(0.5), 0.5); + assert.equal(pullEase(5), 1); + + // A flat image stays flat under the lens blur; a radius under 0.5 copies. + const flat = new Uint8ClampedArray(4 * 16).fill(120); + assert.deepEqual(Array.from(lensBlur(flat, 4, 4, 2, 'circle', 0.4)), Array.from(flat)); + assert.deepEqual(Array.from(lensBlur(flat, 4, 4, 0.2)), Array.from(flat)); + + // The focus lane is read through the shared clock, and only while it drives. + const saved = state.timeline; + try { + state.timeline = { ...saved, _driving: true, currentTime: 500, lanes: [{ id: 'focus', kind: 'focus', target: null, clips: [{ start: 0, duration: 2000 }] }] }; + assert.equal(localProgress('focus', null, null), 0.25); + state.timeline._driving = false; + assert.equal(localProgress('focus', null, null), null); + } finally { + state.timeline = saved; + } +} + +// v42 — print PDF geometry (millimetres). +function testPrintCoreLayout() { + const near = (a, b, msg) => assert.ok(Math.abs(a - b) < 1e-6, `${msg || ''} ${a} vs ${b}`); + const bad = normalizePrint({ paper: 'napkin', orientation: 'diagonal', fit: 'stretch', margin: 999, bleed: -4, marks: 'no', scope: 'some', quality: 'gif', upscale: 9, customW: 'x' }); + assert.deepEqual(bad, { paper: 'a4', customW: 210, customH: 297, orientation: 'auto', fit: 'fit', margin: 50, bleed: 0, marks: true, scope: 'page', quality: 'jpeg', upscale: 1 }); + assert.equal(normalizePrint({ marks: false }).marks, false); + + // 'auto' turns the paper to match the picture. + assert.deepEqual(trimSize({ paper: 'a4' }, 1600, 1000), { w: 297, h: 210 }); + assert.deepEqual(trimSize({ paper: 'a4' }, 1000, 1600), { w: 210, h: 297 }); + assert.deepEqual(trimSize({ paper: 'a4', orientation: 'portrait' }, 1600, 1000), { w: 210, h: 297 }); + assert.deepEqual(trimSize({ paper: 'custom', customW: 300, customH: 100, orientation: 'portrait' }, 10, 10), { w: 100, h: 300 }); + assert.equal(PAPERS.letter.w, 215.9); + + // Fill: A4 landscape, 3mm bleed, marks. Slug = 3 + 1 + 5 + 1 = 10mm a side. + const fill = layoutPrint({ paper: 'a4', fit: 'fill', bleed: 3, marks: true }, 1600, 1000); + assert.deepEqual(fill.page, { w: 317, h: 230 }); + assert.deepEqual(fill.trim, { x: 10, y: 10, w: 297, h: 210 }); + assert.deepEqual(fill.bleed, { x: 7, y: 7, w: 303, h: 216 }); + assert.deepEqual(fill.image, fill.bleed); + // The picture is cropped to the bleed box's shape, centred, never stretched. + near(fill.source.sw / fill.source.sh, 303 / 216, 'crop ratio'); + near(fill.source.sx * 2 + fill.source.sw, 1600); + near(fill.source.sy * 2 + fill.source.sh, 1000); + assert.ok(fill.source.sw <= 1600 && fill.source.sh <= 1000); + near(fill.dpi, effectiveDpi(fill.source.sw, 303), 'dpi'); + // Eight marks, each 5mm, all outside the bleed and inside the page. + assert.equal(fill.marks.length, 8); + for (const m of fill.marks) { + near(Math.abs(m.x2 - m.x1) + Math.abs(m.y2 - m.y1), 5, 'mark length'); + const outside = (x, y) => x <= fill.bleed.x || x >= fill.bleed.x + fill.bleed.w || y <= fill.bleed.y || y >= fill.bleed.y + fill.bleed.h; + assert.ok(outside(m.x1, m.y1) && outside(m.x2, m.y2), 'marks stay out of the bleed'); + for (const v of [m.x1, m.x2]) assert.ok(v >= 0 && v <= fill.page.w); + for (const v of [m.y1, m.y2]) assert.ok(v >= 0 && v <= fill.page.h); + } + // Marks line up with the trim edges. + assert.ok(fill.marks.some((m) => m.y1 === 10 && m.y2 === 10 && m.x2 === 6)); + assert.ok(fill.marks.some((m) => m.x1 === 307 && m.x2 === 307 && m.y1 === 224)); + + // Fit: whole picture, inside the trim minus the margin, centred. + const fit = layoutPrint({ paper: 'a4', fit: 'fit', margin: 10, bleed: 3, marks: false }, 1000, 1000); + assert.deepEqual(fit.page, { w: 216, h: 303 }); // no marks: page = trim + bleed + assert.deepEqual(fit.source, { sx: 0, sy: 0, sw: 1000, sh: 1000 }); + near(fit.image.w, 190); near(fit.image.h, 190); + near(fit.image.x, 3 + 10); near(fit.image.y, 3 + (297 - 190) / 2); + assert.equal(fit.marks.length, 0); + // No bleed and no marks: the page is exactly the paper. + assert.deepEqual(layoutPrint({ paper: 'a5', bleed: 0, marks: false, orientation: 'portrait' }, 10, 10).page, { w: 148, h: 210 }); + + near(effectiveDpi(3000, 254), 300); + assert.equal(effectiveDpi(0, 10), 0); + assert.deepEqual([dpiVerdict(300), dpiVerdict(299), dpiVerdict(150), dpiVerdict(149)], ['sharp', 'ok', 'ok', 'soft']); +} + function shareHmac(secret, msg) { return createHmac('sha256', secret).update(msg).digest(); } @@ -756,6 +922,12 @@ function shareFixture(kind) { { src: '1.webp', w: 1200, h: 800 } ] } }; } + if (kind === 'gallery') { + return { ...base, gallery: { source: 'roll', items: [ + { src: '0.webp', w: 1200, h: 800, label: 'Home' }, + { src: '1.webp', w: 800, h: 1600, label: 'Settings' } + ] } }; + } return { ...base, compare: { before: '0.webp', after: '1.webp', w: 1600, h: 1000, rect: { x: 0.1, y: 0.1, w: 0.8, h: 0.8 }, split: 0.4, labels: { enabled: true, before: 'Before', after: 'After' }, divider: { color: '#ff00aa', width: 4, handle: true } } }; } @@ -797,6 +969,13 @@ function testShareCoreManifest() { assert.equal(tour.tour.steps[1].autoAdvanceMs, 0); assert.equal(tour.tour.steps[0].hotspots[0].callout.side, 'left'); assert.equal(describeShare(tour), 'An interactive tour in 2 steps. Made with Glint.'); + assert.equal(tour.tour.steps[0].hotspots[0].goto, undefined); + + // v42 — a hotspot's goto is kept only when it is a step inside the tour. + const jump = shareFixture('tour'); + const spot = (goto) => ({ x: 0, y: 0, w: 0.2, h: 0.2, goto }); + jump.tour.steps[0].hotspots = [spot(1), spot(2), spot(-1), spot(0.5), spot('1'), spot(0)]; + assert.deepEqual(normalizeManifest(jump).tour.steps[0].hotspots.map((h) => h.goto), [1, undefined, undefined, undefined, undefined, 0]); const long = shareFixture('tour'); long.tour.steps = Array.from({ length: 31 }, (_, i) => ({ src: `${i}.webp`, w: 10, h: 10 })); @@ -812,6 +991,42 @@ function testShareCoreManifest() { assert.equal(c.compare.divider.color, '#ffffff'); assert.equal(c.compare.labels.position, 'top'); + // v42 — galleries (the Roll's shots, a page's Pins). + const g = shareFixture('gallery'); + g.gallery.items[0].label = 'x'.repeat(200); + g.gallery.items[1].evil = '