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:
1 parent
f16801aef3
commit
4d84231b9f
115 files changed
+707
-1564
No files matched your search
@@ -8,10 +8,7 @@ import {
|
||||
} from './ProjectStore';
|
||||
import { deserializeProject, serializeProject } from './serialize';
|
||||
|
||||
/**
|
||||
* Talks to the PHP backend in `api/index.php`. Routing goes through the `r` query
|
||||
* parameter (`?r=projects/{id}`) because the site's nginx config rejects PATH_INFO.
|
||||
*/
|
||||
/** Routing goes through the `r` query parameter because the site's nginx config rejects PATH_INFO. */
|
||||
export class HttpProjectStore implements ProjectStore {
|
||||
constructor(private readonly endpoint: string) {}
|
||||
|
||||
@@ -49,7 +46,7 @@ export class HttpProjectStore implements ProjectStore {
|
||||
await this.request<void>('DELETE', `projects/${encodeURIComponent(id)}`);
|
||||
}
|
||||
|
||||
/** One JSON round trip; 409 becomes a `StaleRevisionError`, every other failure an `Error` with the server's message. */
|
||||
/** 409 becomes a `StaleRevisionError`, every other failure an `Error` with the server's message. */
|
||||
private async request<T>(method: string, route: string, payload?: unknown): Promise<T> {
|
||||
const url = `${this.endpoint}?r=${encodeURIComponent(route)}`;
|
||||
const response = await fetch(url, {
|
||||
@@ -63,10 +60,8 @@ export class HttpProjectStore implements ProjectStore {
|
||||
try {
|
||||
data = text ? JSON.parse(text) : null;
|
||||
} catch {
|
||||
// Not every failure comes from our API: nginx rejects an oversized body itself and
|
||||
// answers with an HTML page. Such a response is explained by its status, and saying
|
||||
// "invalid JSON" instead of "too large" would send the user looking in the wrong place.
|
||||
// A *successful* response that is not JSON stays a defect and keeps its old message.
|
||||
// nginx rejects an oversized body itself and answers with an HTML page, so a failure is
|
||||
// explained by its status rather than as "invalid JSON".
|
||||
if (response.ok) throw new Error(`API ${method} ${route}: invalid JSON (${response.status})`);
|
||||
data = null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user