Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ Versions follow `v*.*.*` with dots. Dates are UTC. From 1.50.1 the last number r

The app was renamed formvis at 1.50.5; its projects were `.fmv` until 1.87.0 and are `.fvd` since. The entries below read with the new name throughout; the git history keeps the former one.

## 2.8.4 · 2026-11-29

A long menu now shows that it has more options below.

- On Linux, Windows and in the browser, a menu of the menu bar that is longer than the room for it fades out its bottom rows and shows a small pill with a down arrow, so it is clear the menu scrolls.
- The fade and the pill go when you reach the last row, and fade back in when you scroll up again.
- Submenus of the menu bar's menus show the same hint when they are cut off. Menus that fit show nothing.
- When you move through a long menu with the arrow keys, the selected row stays above the fade.
- Right-click menus (on layers, tabs, guides and the canvas) no longer cover the menu bar in a small window. They still open at the pointer, are at most three quarters of the window tall, and show the same fade and pill when they have more rows below.
- The three browser demos are built again at this version.

## 2.8.3 · 2026-11-29

The menus of the menu bar no longer cover the menu bar.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</p>

<p align="center">
<img alt="version 2.8.3" src="https://img.shields.io/badge/version-2.8.3-eef0f4?style=flat-square">
<img alt="version 2.8.4" src="https://img.shields.io/badge/version-2.8.4-eef0f4?style=flat-square">
<img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-Vite-3178c6?style=flat-square&logo=typescript&logoColor=white">
<img alt="Python" src="https://img.shields.io/badge/Python-FastAPI-3776ab?style=flat-square">
<img alt="macOS, Windows, Linux" src="https://img.shields.io/badge/macOS%20%C2%B7%20Windows%20%C2%B7%20Linux-native-2f7bf5?style=flat-square">
Expand Down
2 changes: 1 addition & 1 deletion backend/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
except ImportError:
pass

__version__ = "2.8.3"
__version__ = "2.8.4"
2 changes: 1 addition & 1 deletion demo/assets/demo.css

Large diffs are not rendered by default.

364 changes: 182 additions & 182 deletions demo/assets/demo.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demos/design/assets/design.css

Large diffs are not rendered by default.

250 changes: 125 additions & 125 deletions demos/design/assets/design.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demos/retouch/assets/retouch.css

Large diffs are not rendered by default.

364 changes: 182 additions & 182 deletions demos/retouch/assets/retouch.js

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions frontend/HASHOUT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

Living log for the frontend side, _v0.1.0. Read the map and the TOC first; entries are anchored by file and symbol, and removed code is quoted in full.

## Right-click menus keep under the menu bar, take the same cap and show the same hint · _v2.8.4 (ui/menu.ts barFloor, PopupMenu.openAt, PopupMenu.floor, showMore)

- Kind: fix · logged 2026-11-29 · the owner saw the layer right-click menu in a 1280 by 800 window fill the window from top 4, over the menu bar and the title, and asked for it in 2.8.4.
- Cause: `openAt` (every menu opened at a point: the layer, tab, guide and task bar menus) still used the clamp 2.8.3 took off the bar menus: `const top = Math.max(4, Math.min(fitsBelow ? y : y - h, window.innerHeight - h - 4));`, removed, quoted. Its only cap was the stylesheet's `calc(100vh - 8px)`.
- Now `openAt` sets `floor` to `barFloor()` (the in-window menu bar's bottom edge plus 4 when the bar shows, else 4, as with the macOS menu bar), sets `max-height` to `menuCap(floor)` before measuring, keeps the pointer-corner placement (below and right, or flipped above or left), and clamps the top to `floor`, so `const top = Math.max(this.floor, ...)`. Its submenus read the same floor through `root()`.
- `showMore` now runs for every opened menu, since each has a floor: a right-click menu that is cut off shows the fade and the pill like a bar menu.
- Seen: right-click on the layer row, at 1280 by 800, before: top 4, 792 tall, over the bar; now top 74, 600 tall (three quarters), hint shown. At 1871 by 1080: top 38, 810 tall, hint shown. Right-click high and low on the canvas at 1280 by 800, 1871 by 1080 and 1000 by 480: under the bar, inside the window, no hint where the menu fits. Their last submenus keep under the bar and to the cap. The bar menu checks, the hint checks and vitest (299) still pass. Not seen in the Tauri window, or with the macOS menu bar.

## A long menu bar menu shows a fade and a pill while rows remain below · _v2.8.4 (ui/menu.ts PopupMenu.list, PopupMenu.showMore, openUnder, openBeside; styles/panels.css .cv-menu-list, .cv-menu-more, --menu-more)

- Kind: feature · logged 2026-11-29 · the person who reported the 2.8.3 overlap asked for a sign that a capped menu has more options below. The owner chose the look from mockups: a fade on the bottom rows and a narrow pill (56 by 12 pixels) with a chevron, at the bottom only, gone at the last row, back when the rows are scrolled up.
- Structure: a `PopupMenu` panel now holds `.cv-menu-list` (the rows, which scroll) and `.cv-menu-more` (the pill). The card keeps its glass, border and padding and no longer scrolls itself (`.cv-menu:not([hidden])` is a flex column with `overflow: hidden`); the list scrolls inside it. `max-height` stays on the panel.
- Removed, quoted, each now on `this.list`: `this.panel.addEventListener('scroll', () => { if (this.panel.scrollTop !== this.subTop) this.closeSub(); }, { passive: true });`, `this.panel.replaceChildren();`, the three `this.panel.appendChild(...)` of `setItems`, `Array.from(this.panel.children)` in `items()`, `this.subTop = this.panel.scrollTop;`, and the three `this.panel.scrollTop = 0;` of `openAt`, `openUnder` and `openBeside`.
- `showMore(instant)` sets `has-more` on the panel when the menu is a menu bar menu or a submenu of one (`root().floor !== null`) and rows remain below (`scrollHeight - clientHeight - scrollTop > 1`). It runs on every scroll of the list, and with `instant` at the end of `openUnder` and `openBeside`, before the menu is made visible: `no-fade` turns the transitions off, the state is set and read back, and `no-fade` goes, so a menu opens with its hint already in place and never fades it in.
- The fade is a mask on the list (`mask-image`, opaque down to `100% - min(88px, 40%)`, transparent from `100% - min(22px, 10%)` while `--menu-more` is 1), so the rows fade into the card's own glass and no colour is painted on it. `--menu-more` is a registered `@property` number, so it animates: 160 ms out at the last row, 490 ms back in. The pill's opacity follows the same timings. Reduced motion turns both transitions off. Where `@property` is not supported the fade switches without animating.
- `scroll-padding-block-end` on the list, while `has-more`, keeps a row focused with the arrow keys above the fade.
- Right-click menus (`openAt`, no floor) never get `has-more`; their mask stays fully opaque and their placement is unchanged.
- Seen: `tsc --noEmit` clean, vitest 299 passed. A production build in headless Chromium at 1871 by 1080: File opens with the pill at full opacity in its first three painted frames; at the last row the hint is gone (pill 0.29 at 80 ms, 0 by 380 ms); scrolled up 120 pixels it fades back (0.70 at 245 ms, 1 at 745 ms); F10 then End focuses Exit with no hint, Home brings it back; Filter, which fits, has none. At 1280 by 600, arrowing down File never put the focused row inside the fade while the hint showed. At 1000 by 420 a cut-off submenu has the hint. The 2.8.3 placement check, with the CPU slowed 4 times at four window sizes, still passes. The layer right-click menu opens as before, with no hint. Not seen in the Tauri window on Linux, Windows or macOS.

## The menu bar's menus open under the bar and are at most three quarters of the window tall · _v2.8.3 (ui/menu.ts MENU_SHARE, MENU_PAD, menuCap, PopupMenu.floor, PopupMenu.openUnder, PopupMenu.openBeside, MenuBar.open)

- Kind: fix · logged 2026-11-28 · a person on Linux reported that menus taller than the screen cover the File menu bar (File and View in a 1080-pixel window).
Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "formvis",
"private": true,
"version": "2.8.3",
"version": "2.8.4",
"description": "formvis · layered image editor in the NodeMode style",
"license": "Apache-2.0",
"type": "module",
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/styles/panels.css
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,19 @@
.cv-menu-item:hover:not(:disabled), .cv-menu-item.is-focus:not(:disabled), .cv-menu-item:focus:not(:disabled) { background: color-mix(in srgb, var(--text-primary) 10%, transparent); color: var(--text-primary); outline: none; }
.cv-menu-item:hover:not(:disabled) .cv-menu-keys, .cv-menu-keys { color: rgba(235, 235, 245, 0.45); font-size: 13px; letter-spacing: 0.04em; }
.cv-menu-sep { height: 1px; margin: 6px 10px; background: color-mix(in srgb, var(--text-primary) 12%, transparent); }
/* The rows scroll inside the card, so the card keeps its glass whole. On a menu bar menu or its submenu with rows below
the cap, the bottom rows fade into the glass and a narrow pill with a chevron sits over them; both go at the last row
(160ms) and come back when the rows are scrolled up (490ms). The rows fade by a mask, so no colour is painted on the
glass. */
@property --menu-more { syntax: '<number>'; inherits: false; initial-value: 0; }
.cv-menu:not([hidden]) { display: flex; flex-direction: column; overflow: hidden; }
.cv-menu-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; --menu-more: 0; -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - min(88px, 40%)), rgb(0 0 0 / calc(1 - var(--menu-more))) calc(100% - min(22px, 10%))); mask-image: linear-gradient(to bottom, #000 calc(100% - min(88px, 40%)), rgb(0 0 0 / calc(1 - var(--menu-more))) calc(100% - min(22px, 10%))); transition: --menu-more 160ms ease-out; }
.cv-menu-more { position: absolute; left: 50%; bottom: 6px; width: 56px; height: 12px; margin-left: -28px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--glass-border); border-radius: 999px; background: var(--glass-bg); color: var(--text-secondary); pointer-events: none; opacity: 0; transition: opacity 160ms ease-out; }
.cv-menu-more svg { width: 12px; height: 8px; }
.cv-menu.has-more > .cv-menu-list { --menu-more: 1; scroll-padding-block-end: min(88px, 40%); transition-duration: 490ms; }
.cv-menu.has-more > .cv-menu-more { opacity: 1; transition-duration: 490ms; }
.cv-menu.no-fade > .cv-menu-list, .cv-menu.no-fade > .cv-menu-more { transition: none; }
@media (prefers-reduced-motion: reduce) { .cv-menu-list, .cv-menu-more { transition: none; } }
.cv-brush-tip { cursor: grab; touch-action: none; }
.cv-brush-tip:active { cursor: grabbing; }

Expand Down
52 changes: 37 additions & 15 deletions frontend/src/ui/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const isSub = (i: MenuItem): i is SubMenu => typeof i === 'object';
* and never past the window's bottom edge. */
const MENU_SHARE = 0.75, MENU_PAD = 4;
const menuCap = (top: number): number => Math.max(0, Math.min(Math.floor(window.innerHeight * MENU_SHARE), Math.floor(window.innerHeight - top - MENU_PAD)));
/** The line a menu opened at a point may not go above: just under the in-window menu bar when one shows, else the window's top. */
const barFloor = (): number => { const r = document.querySelector('.cv-menubar')?.getBoundingClientRect(); return r && r.height > 0 ? r.bottom + MENU_PAD : MENU_PAD; };

/** Edit > Menus: command ids left out of the menu bar's menus, and the colour name each item is drawn in. */
let hiddenIds = new Set<string>();
Expand All @@ -36,22 +38,26 @@ export function trimMenu(items: MenuItem[]): MenuItem[] {

export class PopupMenu {
readonly panel: HTMLElement;
/** The rows, which scroll inside the card; the card itself keeps its glass and the more-below pill. */
private readonly list: HTMLElement;
private rows: Array<{ id: string; node: HTMLButtonElement }> = [];
private subs: Array<{ sub: SubMenu; node: HTMLButtonElement; menu: PopupMenu }> = [];
private seps: HTMLElement[] = [];
private key = '';
private openSub: PopupMenu | null = null;
private subTop = 0;
/** Set on a menubar menu: the line it opens on, just under the bar. Neither it nor its submenus go above it. */
/** Set when a menu opens: just under the bar (a menubar menu opens on it; a menu opened at a point keeps below it).
* Neither the menu nor its submenus go above it. */
private floor: number | null = null;
onClose: (() => void) | null = null;

constructor(private readonly commands: Commands, private readonly parent: PopupMenu | null = null, standalone = false) {
this.panel = el<HTMLElement>('<div class="cv-menu" role="menu" hidden></div>');
this.panel = el<HTMLElement>('<div class="cv-menu" role="menu" hidden><div class="cv-menu-list" role="none"></div><div class="cv-menu-more" aria-hidden="true"><svg viewBox="0 0 12 8"><path d="M1.5 1.5 6 6l4.5-4.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></div></div>');
this.list = q(this.panel, '.cv-menu-list');
document.getElementById('overlay-root')?.appendChild(this.panel);
this.panel.addEventListener('contextmenu', (e) => e.preventDefault());
// A scrolled menu moves its rows, so a submenu opened beside one would no longer line up.
this.panel.addEventListener('scroll', () => { if (this.panel.scrollTop !== this.subTop) this.closeSub(); }, { passive: true });
this.list.addEventListener('scroll', () => { if (this.list.scrollTop !== this.subTop) this.closeSub(); this.showMore(); }, { passive: true });
// A menu opened on its own (the layers' right-click menu) closes on a press anywhere outside it; the menubar's
// menus are closed by the menubar, which also owns their buttons.
if (standalone) document.addEventListener('pointerdown', (e) => { if (this.isOpen && !this.contains(e.target as Node)) this.close(); }, true);
Expand All @@ -68,12 +74,12 @@ export class PopupMenu {
this.key = key;
this.closeSub();
for (const s of this.subs) s.menu.panel.remove();
this.panel.replaceChildren();
this.list.replaceChildren();
this.rows = [];
this.subs = [];
this.seps = [];
for (const item of items) {
if (item === '-') { const sep = el<HTMLElement>('<div class="cv-menu-sep"></div>'); this.seps.push(sep); this.panel.appendChild(sep); continue; }
if (item === '-') { const sep = el<HTMLElement>('<div class="cv-menu-sep"></div>'); this.seps.push(sep); this.list.appendChild(sep); continue; }
if (isSub(item)) {
const node = el<HTMLButtonElement>(`<button class="cv-menu-item cv-menu-sub" role="menuitem" aria-haspopup="menu" type="button"><span class="cv-menu-check"></span><span class="cv-menu-label"></span><span class="cv-menu-keys">${icon('chevronRight', 12)}</span></button>`);
setText(q(node, '.cv-menu-label'), t(item.label));
Expand All @@ -82,7 +88,7 @@ export class PopupMenu {
node.addEventListener('pointerenter', () => this.showSub(menu, node));
node.addEventListener('click', () => this.showSub(menu, node));
this.subs.push({ sub: item, node, menu });
this.panel.appendChild(node);
this.list.appendChild(node);
continue;
}
const cmd = this.commands.get(item);
Expand All @@ -93,14 +99,14 @@ export class PopupMenu {
node.addEventListener('pointerenter', () => this.closeSub());
node.addEventListener('click', () => { this.root().close(); this.commands.run(item); });
this.rows.push({ id: item, node });
this.panel.appendChild(node);
this.list.appendChild(node);
}
}

private root(): PopupMenu { let m: PopupMenu = this; while (m.parent) m = m.parent; return m; }

/** The rows a key can reach, in order: the enabled commands and submenu rows. */
items(): HTMLButtonElement[] { return Array.from(this.panel.children).filter((n): n is HTMLButtonElement => n instanceof HTMLButtonElement && !n.disabled); }
items(): HTMLButtonElement[] { return Array.from(this.list.children).filter((n): n is HTMLButtonElement => n instanceof HTMLButtonElement && !n.disabled); }

/** This menu or, following the open submenus, the innermost one showing. */
deepest(): PopupMenu { let m: PopupMenu = this; while (m.openSub?.isOpen) m = m.openSub; return m; }
Expand All @@ -127,7 +133,7 @@ export class PopupMenu {
if (this.openSub === menu && menu.isOpen) return;
this.closeSub();
this.openSub = menu;
this.subTop = this.panel.scrollTop;
this.subTop = this.list.scrollTop;
setClass(row, 'is-open', true);
menu.onClose = () => setClass(row, 'is-open', false);
const r = row.getBoundingClientRect();
Expand All @@ -140,21 +146,24 @@ export class PopupMenu {
s?.close();
}

/** Refreshes labels, checks and enabled states, then shows the menu at `x, y`, kept within the window; a menu taller
* than the window scrolls. */
/** Refreshes labels, checks and enabled states, then shows the menu at `x, y`, kept within the window and never above
* the menu bar. Like a menu bar menu it is at most three quarters of the window tall; the rest scrolls. */
openAt(x: number, y: number): void {
this.floor = barFloor();
this.refresh();
this.panel.style.visibility = 'hidden';
this.panel.hidden = false;
this.panel.scrollTop = 0;
this.panel.style.maxHeight = `${menuCap(this.floor)}px`;
this.list.scrollTop = 0;
const { width: w, height: h } = this.panel.getBoundingClientRect();
// As native menus: below and right of the pointer when it fits, otherwise above or to the left of it, so the
// pointer sits at a corner and never over an item (clamping alone could put a submenu under it, opening it).
const fitsRight = x + w <= window.innerWidth - 4, fitsBelow = y + h <= window.innerHeight - 4;
const left = Math.max(4, Math.min(fitsRight ? x : x - w, window.innerWidth - w - 4));
const top = Math.max(4, Math.min(fitsBelow ? y : y - h, window.innerHeight - h - 4));
const top = Math.max(this.floor, Math.min(fitsBelow ? y : y - h, window.innerHeight - h - 4));
this.panel.style.left = `${Math.round(left)}px`;
this.panel.style.top = `${Math.round(top)}px`;
this.showMore(true);
this.panel.style.visibility = '';
}

Expand All @@ -166,11 +175,12 @@ export class PopupMenu {
this.panel.style.visibility = 'hidden';
this.panel.hidden = false;
this.panel.style.maxHeight = `${menuCap(y)}px`;
this.panel.scrollTop = 0;
this.list.scrollTop = 0;
const w = this.panel.offsetWidth;
const left = Math.max(MENU_PAD, Math.min(x, window.innerWidth - w - MENU_PAD));
this.panel.style.left = `${Math.round(left)}px`;
this.panel.style.top = `${Math.round(y)}px`;
this.showMore(true);
this.panel.style.visibility = '';
}

Expand All @@ -182,16 +192,28 @@ export class PopupMenu {
this.panel.hidden = false;
const floor = this.root().floor, pad = MENU_PAD;
this.panel.style.maxHeight = floor === null ? '' : `${menuCap(floor)}px`;
this.panel.scrollTop = 0;
this.list.scrollTop = 0;
const w = this.panel.offsetWidth, h = this.panel.offsetHeight;
const right = row.right - 2, left = row.left - w + 2;
const x = right + w <= window.innerWidth - pad ? right : Math.max(pad, left);
const y = Math.max(floor ?? pad, Math.min(row.top - pad, window.innerHeight - h - pad));
this.panel.style.left = `${Math.round(x)}px`;
this.panel.style.top = `${Math.round(y)}px`;
this.showMore(true);
this.panel.style.visibility = '';
}

/** Any menu or submenu (each has a floor once opened): the fade and the pill at the bottom show while rows remain
* below, go at the last row, and come back when the rows are scrolled up again. `instant` (on opening) shows the state
* with no fade. */
private showMore(instant = false): void {
const l = this.list;
const more = this.root().floor !== null && !this.panel.hidden && l.scrollHeight - l.clientHeight - l.scrollTop > 1;
if (instant) setClass(this.panel, 'no-fade', true);
setClass(this.panel, 'has-more', more);
if (instant) { void getComputedStyle(this.panel.lastElementChild ?? this.panel).opacity; setClass(this.panel, 'no-fade', false); }
}

private refresh(): void {
for (const r of this.rows) {
const cmd = this.commands.get(r.id);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '2.8.3';
export const VERSION = '2.8.4';
Loading
Loading