Use TTF fonts throughout the UI; also add some more functions to app extension API

This commit is contained in:
James Babcock committed 2026-08-19 19:35:24 -07:00
1 parent 5abbe2a405
commit 96842ceb23
82 files changed
+2666 -288

No files matched your search

+2 -1
View File
@@ -1,5 +1,6 @@
import { G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
import { getDefaultSmallFont, type BdfFont } from "../../graphics/bdffont";
import { type BdfFont } from "../../graphics/bdffont";
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
import { GESTURE_DOUBLE_CLICK } from "../gestures";
import { drawSelectionHighlight } from "../menu";
import { Layer, type DashboardInputEvent, type LayerActions, type LayerContext } from "../layers";
+1 -1
View File
@@ -1,5 +1,5 @@
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/bdffont";
import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fonts";
import { BATTERY_ICON_WIDTH, drawBattery } from "../../graphics/battery";
import { readActiveNotificationIcons } from "../../native/notification-icons";
import { readPhoneBatteryState } from "../../native/phone-battery";
+15 -2
View File
@@ -41,6 +41,8 @@ export type InProcessWindowOptions = {
submitFrame: (planes: Plane[], paintMs: number, frameId: number) => Promise<void>;
setSurfaceVisible: (visible: boolean) => void;
removeSurface?: () => void;
/** Resize this window's compositor surface after a height-mode change. */
reconfigureSurface?: (heightMode: WindowHeightMode) => void;
onClosed?: () => void;
};
@@ -48,6 +50,8 @@ export type InProcessWindow = {
window: ShellWindow;
stack: LayerStack;
requestRender: () => void;
/** Change the window's height band at runtime (resizes the viewport + surface). */
setHeightMode: (mode: WindowHeightMode) => void;
};
/** The controller-provided plumbing common to every in-process app window. */
@@ -56,6 +60,7 @@ export type InProcessAppOptions = {
submitFrame: (planes: Plane[], paintMs: number, frameId: number) => Promise<void>;
setSurfaceVisible: (visible: boolean) => void;
removeSurface: () => void;
reconfigureSurface?: (heightMode: WindowHeightMode) => void;
onClosed: () => void;
};
@@ -65,7 +70,7 @@ export function createInProcessWindow(options: InProcessWindowOptions): InProces
console.error(`${options.windowId} render failed: ${error}`);
});
};
const heightMode = options.heightMode ?? "min";
let heightMode = options.heightMode ?? "min";
const stack = new LayerStack(
options.baseLayer,
{ ...options.actions, requestRender },
@@ -168,7 +173,15 @@ export function createInProcessWindow(options: InProcessWindowOptions): InProces
options.setSurfaceVisible(foreground);
},
};
return { window, stack, requestRender };
const setHeightMode = (mode: WindowHeightMode) => {
if (heightMode === mode) return;
heightMode = mode;
window.heightMode = mode;
stack.setBaseSize(appViewportSize(mode));
options.reconfigureSurface?.(mode);
requestRender();
};
return { window, stack, requestRender, setHeightMode };
}
/**
+1 -1
View File
@@ -1,6 +1,6 @@
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
import { singlePlane, type Plane } from "../../graphics/plane";
import { getDefaultSmallFont } from "../../graphics/bdffont";
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
import { EvenAIStatus, EventSourceType, OsEventTypeList } from "../../g2/events";
import type { RawInputEvent } from "../../native/faceclaw-communicator";
import { DashboardInputEvent, Layer, LayerActions, LayerContext, LayerStack, noopLayerActions } from "../layers";
+1 -1
View File
@@ -1,5 +1,5 @@
import { G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
import { getDefaultSmallFont } from "../../graphics/bdffont";
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
import { wrapText } from "../../graphics/textwrap";
import { clamp } from "../../util/numeric-util";
import type { ToolDebugEntry } from "../../assistant/tool-registry";
+2 -1
View File
@@ -1,6 +1,7 @@
import { G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
import { wrapText, truncateText } from "../../graphics/textwrap";
import { getDefaultSmallFont, type BdfFont } from "../../graphics/bdffont";
import { type BdfFont } from "../../graphics/bdffont";
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
import { voiceControlBridge, type VoiceTranscriptEvent } from "../../native/voice-control";
import { refineDictation, type AnthropicStreamHandle } from "../../native/anthropic";
import { anthropicApiKeySetting } from "../dashboard-settings";