Trim needless comments and fix the picker width

Remove comments that only restate the code, keeping the section banners
and the notes that carry a reason, a measured fact or an external
contract.

ButtonOptions.width claimed to be a fixed width but only set minWidth,
so the Graph and Texture pickers grew with the name they showed. It is
now what it promises, with a separate minWidth for the buttons that have
two forms. Narrow buttons shrink their padding, otherwise a 24px icon
button had 8px left for its glyph and truncate dropped it entirely.

__gm.labelsDropped() guards that class: the overflow guard only saw text
that was too wide, never a label truncated to nothing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rootandClaude Opus 5 committed 2026-09-08 15:52:05 +02:00
1 parent f16801aef3
commit 4d84231b9f
115 files changed
+707 -1564

No files matched your search

+5 -13
View File
@@ -1,21 +1,16 @@
/** An item taken out of a list together with the index it had, so it can be put back exactly. */
export interface Removed<T> {
item: T;
index: number;
}
/**
* Removes the first item matching `predicate` in place and returns it with its former index.
* `undefined` means nothing matched – the list is then untouched, so a caller may reject the
* edit afterwards without having to revert anything.
*/
/** In place; `undefined` means nothing matched and the list is untouched. */
export function removeFirst<T>(list: T[], predicate: (item: T) => boolean): Removed<T> | undefined {
const index = list.findIndex(predicate);
// A valid index makes `splice` return exactly one element; the `!` is that index check.
// A valid index makes `splice` return exactly one element, which is what the `!` rests on.
return index < 0 ? undefined : { item: list.splice(index, 1)[0]!, index };
}
/** Removes every item matching `predicate` in place; returns them with their former indices, ascending. */
/** In place; the returned indices are the former ones, ascending. */
export function removeWhere<T>(list: T[], predicate: (item: T) => boolean): Removed<T>[] {
const removed: Removed<T>[] = [];
list.forEach((item, index) => {
@@ -25,15 +20,12 @@ export function removeWhere<T>(list: T[], predicate: (item: T) => boolean): Remo
return removed;
}
/** Puts removed items back at their former indices (ascending order restores the list exactly). */
/** Inserting in ascending index order is what restores the list exactly. */
export function restoreAt<T>(list: T[], removed: readonly Removed<T>[]): void {
for (const entry of [...removed].sort((a, b) => a.index - b.index)) list.splice(entry.index, 0, entry.item);
}
/**
* A **new** list without the item carrying `id` – unlike the `remove*` helpers above this one
* does not mutate, which is what undoing a `push` needs: `list = removeById(list, id)`.
*/
/** Returns a new list; unlike the helpers above this one does not mutate. */
export function removeById<T extends { id: string }>(list: readonly T[], id: string): T[] {
return list.filter((item) => item.id !== id);
}